From f6bcfd974ef26faf6f91a62cac09827e09463fd1 Mon Sep 17 00:00:00 2001 From: Bryan Petty <bryan@ibaku.net> Date: Sat, 15 Jul 2000 19:51:35 +0000 Subject: [PATCH] merged 2.2 branch git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- BuildCVS.txt | 61 +- Makefile.in | 137 +- config.guess | 286 +- config.sub | 308 +- configure | 1778 ++- configure.in | 318 +- contrib/configure | 6 + contrib/configure.in | 3 + contrib/docs/latex/ogl/back.gif | Bin 225 -> 978 bytes contrib/docs/latex/ogl/contents.gif | Bin 231 -> 996 bytes contrib/docs/latex/ogl/forward.gif | Bin 164 -> 959 bytes contrib/docs/latex/ogl/ogl.hpj | 2 +- contrib/docs/latex/ogl/up.gif | Bin 137 -> 998 bytes contrib/include/wx/stc/SciLexer.h | 181 + contrib/include/wx/stc/stc.h | 127 +- contrib/samples/Makefile.in | 12 +- contrib/samples/mmedia/Makefile.in | 33 +- contrib/samples/ogl/Makefile.in | 12 + contrib/samples/ogl/ogledit/Makefile | 39 - contrib/samples/ogl/ogledit/Makefile.in | 16 + contrib/samples/ogl/ogledit/makefile.unx | 39 +- contrib/samples/ogl/studio/Makefile | 57 - contrib/samples/ogl/studio/Makefile.in | 19 + contrib/samples/ogl/studio/makefile.unx | 62 +- contrib/samples/stc/Makefile.in | 4 +- contrib/src/Makefile.in | 4 +- contrib/src/mmedia/Makefile.in | 20 +- contrib/src/ogl/Makefile.in | 22 +- contrib/src/ogl/makefile.vc | 21 +- contrib/src/stc/Makefile.in | 44 +- contrib/src/stc/PlatWX.cpp | 49 +- contrib/src/stc/ScintillaWX.cpp | 49 +- contrib/src/stc/ScintillaWX.h | 2 +- contrib/src/stc/StcVC.dsp | 42 +- contrib/src/stc/makefile.b32 | 37 +- contrib/src/stc/makefile.g95 | 10 + contrib/src/stc/makefile.vc | 11 +- contrib/src/stc/scintilla/README.txt | 5 +- contrib/src/stc/scintilla/include/Accessor.h | 78 +- contrib/src/stc/scintilla/include/KeyWords.h | 37 +- contrib/src/stc/scintilla/include/Platform.h | 13 +- contrib/src/stc/scintilla/include/PropSet.h | 6 +- contrib/src/stc/scintilla/include/SciLexer.h | 129 +- contrib/src/stc/scintilla/include/Scintilla.h | 51 +- contrib/src/stc/scintilla/include/WinDefs.h | 48 +- .../stc/scintilla/include/WindowAccessor.h | 47 + .../src/stc/scintilla/src/AutoComplete.cxx | 11 +- contrib/src/stc/scintilla/src/AutoComplete.h | 7 +- contrib/src/stc/scintilla/src/CallTip.cxx | 3 +- contrib/src/stc/scintilla/src/CallTip.h | 5 +- contrib/src/stc/scintilla/src/CellBuffer.cxx | 380 +- contrib/src/stc/scintilla/src/CellBuffer.h | 62 +- .../stc/scintilla/src/ContractionState.cxx | 27 +- contrib/src/stc/scintilla/src/Document.cxx | 369 +- contrib/src/stc/scintilla/src/Document.h | 40 +- .../stc/scintilla/src/DocumentAccessor.cxx | 174 + .../src/stc/scintilla/src/DocumentAccessor.h | 49 + contrib/src/stc/scintilla/src/Editor.cxx | 402 +- contrib/src/stc/scintilla/src/Editor.h | 19 +- contrib/src/stc/scintilla/src/Indicator.cxx | 16 + contrib/src/stc/scintilla/src/KeyMap.cxx | 100 +- contrib/src/stc/scintilla/src/KeyMap.h | 1 + contrib/src/stc/scintilla/src/KeyWords.cxx | 2220 +-- contrib/src/stc/scintilla/src/LexCPP.cxx | 258 + contrib/src/stc/scintilla/src/LexHTML.cxx | 1139 ++ contrib/src/stc/scintilla/src/LexOthers.cxx | 304 + contrib/src/stc/scintilla/src/LexPerl.cxx | 480 + contrib/src/stc/scintilla/src/LexPython.cxx | 274 + contrib/src/stc/scintilla/src/LexSQL.cxx | 156 + contrib/src/stc/scintilla/src/LexVB.cxx | 118 + contrib/src/stc/scintilla/src/LineMarker.cxx | 20 - contrib/src/stc/scintilla/src/PropSet.cxx | 11 +- contrib/src/stc/scintilla/src/SVector.h | 12 +- .../src/stc/scintilla/src/ScintillaBase.cxx | 36 +- contrib/src/stc/scintilla/src/ScintillaBase.h | 7 +- contrib/src/stc/scintilla/src/Style.cxx | 83 +- contrib/src/stc/scintilla/src/Style.h | 17 +- .../src/stc/scintilla/src/UniConversion.cxx | 77 + contrib/src/stc/scintilla/src/UniConversion.h | 9 + contrib/src/stc/scintilla/src/ViewStyle.cxx | 69 +- contrib/src/stc/scintilla/src/ViewStyle.h | 13 + .../src/stc/scintilla/src/WindowAccessor.cxx | 173 + contrib/src/stc/stc.cpp | 227 +- debian/README.Debian | 9 +- debian/changelog | 2 +- debian/control.in | 104 +- debian/libwxbase-dbg.dirs | 4 + debian/libwxbase-dbg.docs | 2 + debian/libwxbase-dbg.links | 2 + debian/libwxbase-dbg.postinst | 11 + debian/libwxbase-dbg.prerm | 7 + debian/libwxbase-dev.files | 4 +- debian/libwxbase.dirs | 2 + debian/libwxbase.files | 1 - debian/libwxgtk-contrib-dev.dirs | 2 + debian/libwxgtk-contrib-dev.docs | 2 + debian/libwxgtk-contrib-dev.files | 5 + debian/libwxgtk-contrib.dirs | 2 + debian/libwxgtk-contrib.docs | 2 + debian/libwxgtk-contrib.postinst | 10 + debian/libwxgtk-dbg.dirs | 4 + debian/libwxgtk-dbg.docs | 2 + debian/libwxgtk-dbg.links | 2 + debian/libwxgtk-dbg.postinst | 11 + debian/libwxgtk-dbg.prerm | 7 + debian/libwxgtk-dev.dirs | 1 - debian/libwxgtk-dev.files | 7 +- debian/libwxgtk-python.docs | 4 +- debian/libwxgtk-python.files | 4 +- debian/libwxgtk.files | 2 - debian/rules | 398 +- debian/wxwin-headers.dirs | 3 + debian/wxwin-headers.docs | 2 + debian/wxwin-headers.files | 1 + demos/dbbrowse/browsedb.cpp | 40 +- demos/dbbrowse/browsedb.h | 32 +- demos/dbbrowse/de/mo.cmd | 1 + demos/dbbrowse/de/mo_de.cmd | 1 + demos/dbbrowse/de/xget.cmd | 3 +- demos/dbbrowse/makefile.g95 | 2 +- demos/life/Makefile.in | 4 +- demos/life/bitmaps/info.bmp | Bin 0 -> 246 bytes demos/life/bitmaps/info.xpm | 24 + demos/life/bitmaps/open.bmp | Bin 0 -> 238 bytes demos/life/bitmaps/open.xpm | 26 + demos/life/bitmaps/reset.bmp | Bin 822 -> 238 bytes demos/life/bitmaps/reset.xpm | 30 +- demos/life/breeder.lif | 2523 +++ demos/life/dialogs.cpp | 27 +- demos/life/dialogs.h | 2 +- demos/life/game.cpp | 198 +- demos/life/game.h | 124 +- demos/life/life.cpp | 231 +- demos/life/life.h | 3 +- demos/life/life.rc | 3 + demos/life/makefile.b32 | 2 +- demos/life/makefile.bcc | 2 +- demos/life/makefile.dos | 2 +- demos/life/makefile.g95 | 3 +- demos/life/makefile.unx | 2 +- demos/life/makefile.vc | 2 +- demos/life/makefile.wat | 2 +- demos/life/reader.cpp | 91 + demos/life/reader.h | 58 + demos/life/samples.inc | 41 +- difflast.pl | 13 +- distrib/msw/extradoc.rsp | 3 + distrib/msw/generic.rsp | 13 + distrib/msw/jpeg.rsp | 4 +- distrib/msw/makefile.rsp | 55 +- distrib/msw/msw.rsp | 5 +- distrib/msw/ogl.rsp | 32 +- distrib/msw/patch.rsp | 27 + distrib/msw/tardist | 66 +- distrib/msw/tarwxmotif | 94 + distrib/msw/tex2rtf.rsp | 10 +- distrib/msw/tiff.rsp | 4 +- distrib/msw/tmake/b32.t | 29 +- distrib/msw/tmake/filelist.txt | 17 +- distrib/msw/tmake/g95.t | 23 +- distrib/msw/tmake/vc.t | 28 +- distrib/msw/tmake/vc6base.t | 8 +- distrib/msw/tmake/vc6bdll.t | 133 + distrib/msw/tmake/vc6dll.t | 16 +- distrib/msw/tmake/vcapp.t | 310 + distrib/msw/tmake/wat.t | 29 +- distrib/msw/vc.rsp | 20 +- distrib/msw/wisebott.txt | 16 +- distrib/msw/wisetop.txt | 8 +- distrib/msw/wx_chm.rsp | 3 + distrib/msw/wx_htb.rsp | 3 + distrib/msw/wx_html.rsp | 2 +- distrib/msw/zipdist.bat | 94 +- distrib/msw/zippatch.bat | 6 +- docs/changes.txt | 104 +- docs/gtk/changes.txt | 50 +- docs/gtk/install.txt | 2 +- docs/gtk/makewxgtk | 2 +- docs/gtk/readme.txt | 18 +- docs/gtk/todo.txt | 15 +- docs/html/faq.htm | 6 +- docs/html/faqgen.htm | 6 +- docs/html/faqgtk.htm | 6 +- docs/html/faqmac.htm | 6 +- docs/html/faqmsw.htm | 6 +- docs/html/gettext/gettext.htm | 4961 ------ docs/html/gettext/gettext_1.html | 636 + docs/html/gettext/gettext_10.html | 656 + docs/html/gettext/gettext_11.html | 164 + docs/html/gettext/gettext_12.html | 448 + docs/html/gettext/gettext_2.html | 667 + docs/html/gettext/gettext_3.html | 606 + docs/html/gettext/gettext_4.html | 337 + docs/html/gettext/gettext_5.html | 747 + docs/html/gettext/gettext_6.html | 258 + docs/html/gettext/gettext_7.html | 122 + docs/html/gettext/gettext_8.html | 896 ++ docs/html/gettext/gettext_9.html | 513 + docs/html/gettext/gettext_foot.html | 35 + docs/html/gettext/gettext_toc.html | 143 + docs/html/gettext/index.html | 143 + docs/html/gettext/msgfmt.htm | 222 - docs/html/gettext/xgettext.htm | 144 - docs/html/i18n.htm | 7 +- docs/html/index.htm | 48 +- docs/html/logo.gif | Bin 4656 -> 3590 bytes docs/html/news.htm | 33 +- docs/html/platform.htm | 46 +- docs/html/roadmap.htm | 6 +- docs/html/standard.htm | 63 +- docs/html/wxbook.htm | 6 +- docs/latex/wx/app.tex | 7 +- docs/latex/wx/array.tex | 17 +- docs/latex/wx/arrstrng.tex | 30 +- docs/latex/wx/back.gif | Bin 225 -> 978 bytes docs/latex/wx/bbutton.tex | 14 +- docs/latex/wx/bitmap.tex | 12 +- docs/latex/wx/body.tex | 34 +- docs/latex/wx/books.gif | Bin 242 -> 440 bytes docs/latex/wx/boxsizer.tex | 10 +- docs/latex/wx/button.tex | 8 +- docs/latex/wx/calctrl.tex | 433 +- docs/latex/wx/caret.tex | 143 + docs/latex/wx/category.tex | 39 +- docs/latex/wx/clasinfo.tex | 2 +- docs/latex/wx/classes.tex | 21 + docs/latex/wx/cmdlpars.tex | 451 + docs/latex/wx/colordlg.tex | 8 +- docs/latex/wx/colour.tex | 2 +- docs/latex/wx/combobox.tex | 2 +- docs/latex/wx/conditn.tex | 11 +- docs/latex/wx/config.tex | 70 +- docs/latex/wx/contents.gif | Bin 231 -> 996 bytes docs/latex/wx/csconv.tex | 60 + docs/latex/wx/cursor.tex | 2 +- docs/latex/wx/database.tex | 12 +- docs/latex/wx/dataform.tex | 2 +- docs/latex/wx/dataobj.tex | 2 +- docs/latex/wx/datespan.tex | 15 + docs/latex/wx/datetime.tex | 1126 +- docs/latex/wx/db.tex | 112 + docs/latex/wx/dc.tex | 50 + docs/latex/wx/ddeclint.tex | 2 +- docs/latex/wx/dialevt.tex | 48 + docs/latex/wx/dialog.tex | 13 +- docs/latex/wx/dialup.tex | 215 + docs/latex/wx/dir.tex | 2 +- docs/latex/wx/dllload.tex | 145 + docs/latex/wx/dobjcomp.tex | 2 +- docs/latex/wx/dobjsmpl.tex | 2 +- docs/latex/wx/document.tex | 4 +- docs/latex/wx/dragimag.tex | 60 + docs/latex/wx/dropsrc.tex | 29 +- docs/latex/wx/droptrgt.tex | 2 +- docs/latex/wx/encconv.tex | 31 +- docs/latex/wx/file.tex | 23 +- docs/latex/wx/filedlg.tex | 2 +- docs/latex/wx/filetype.tex | 2 +- docs/latex/wx/flexsizr.tex | 24 + docs/latex/wx/fontenum.tex | 2 +- docs/latex/wx/forward.gif | Bin 164 -> 959 bytes docs/latex/wx/frame.tex | 26 +- docs/latex/wx/fs.tex | 56 +- docs/latex/wx/fs_mem.tex | 2 + docs/latex/wx/fsfile.tex | 4 +- docs/latex/wx/ftp.tex | 2 +- docs/latex/wx/function.tex | 290 +- docs/latex/wx/gridsizr.tex | 24 + docs/latex/wx/hash.tex | 5 +- docs/latex/wx/helpinst.tex | 27 +- docs/latex/wx/hteasypr.tex | 41 +- docs/latex/wx/hthelpct.tex | 5 +- docs/latex/wx/hthlpfrm.tex | 5 + docs/latex/wx/htmlcell.tex | 4 +- docs/latex/wx/htmlhand.tex | 2 +- docs/latex/wx/htmlhlpf.tex | 2 +- docs/latex/wx/htmlstrt.tex | 4 +- docs/latex/wx/htparser.tex | 6 +- docs/latex/wx/httag.tex | 2 +- docs/latex/wx/httagmod.tex | 2 +- docs/latex/wx/htwidget.tex | 2 +- docs/latex/wx/htwindow.tex | 4 +- docs/latex/wx/htwinprs.tex | 4 +- docs/latex/wx/hworld.tex | 16 +- docs/latex/wx/image.tex | 51 +- docs/latex/wx/imaglist.tex | 20 + docs/latex/wx/keyevent.tex | 24 +- docs/latex/wx/listctrl.tex | 4 +- docs/latex/wx/listevt.tex | 59 +- docs/latex/wx/locale.tex | 2 +- docs/latex/wx/longlong.tex | 2 +- docs/latex/wx/manual.tex | 8 +- docs/latex/wx/mbcnvfil.tex | 49 + docs/latex/wx/mbcnvut7.tex | 38 + docs/latex/wx/mbcnvut8.tex | 59 + docs/latex/wx/mbconv.tex | 108 + docs/latex/wx/mdi.tex | 11 +- docs/latex/wx/menu.tex | 4 +- docs/latex/wx/mouseevt.tex | 20 +- docs/latex/wx/msgdlg.tex | 3 +- docs/latex/wx/mutexlck.tex | 2 +- docs/latex/wx/nbsizer.tex | 2 +- docs/latex/wx/node.tex | 2 +- docs/latex/wx/notebook.tex | 22 +- docs/latex/wx/porting.tex | 10 +- docs/latex/wx/print.tex | 40 +- docs/latex/wx/process.tex | 38 +- docs/latex/wx/proplist.tex | 4 +- docs/latex/wx/protocol.tex | 8 +- docs/latex/wx/psbox.tex | 4 +- docs/latex/wx/rect.tex | 4 +- docs/latex/wx/sashwin.tex | 5 +- docs/latex/wx/sbsizer.tex | 2 +- docs/latex/wx/scrolwin.tex | 2 +- docs/latex/wx/sizer.tex | 140 +- docs/latex/wx/socket.tex | 131 +- docs/latex/wx/spinbutt.tex | 37 +- docs/latex/wx/spinctrl.tex | 2 +- docs/latex/wx/spinevt.tex | 51 + docs/latex/wx/splitevt.tex | 2 +- docs/latex/wx/splitter.tex | 11 +- docs/latex/wx/stattext.tex | 4 +- docs/latex/wx/statusbr.tex | 3 + docs/latex/wx/stopwtch.tex | 2 +- docs/latex/wx/stream.tex | 8 +- docs/latex/wx/strmbase.tex | 10 +- docs/latex/wx/strmsock.tex | 2 +- docs/latex/wx/table.tex | 27 + docs/latex/wx/tbitmap.tex | 2 +- docs/latex/wx/tclipbrd.tex | 4 +- docs/latex/wx/tconfig.tex | 4 +- docs/latex/wx/tconstr.tex | 8 +- docs/latex/wx/tcpclint.tex | 2 +- docs/latex/wx/tdate.tex | 32 +- docs/latex/wx/tdb.tex | 2 +- docs/latex/wx/tdelwin.tex | 4 +- docs/latex/wx/tdnd.tex | 6 +- docs/latex/wx/tdocview.tex | 4 +- docs/latex/wx/tempfile.tex | 2 +- docs/latex/wx/tevent.tex | 8 +- docs/latex/wx/texpr.tex | 2 +- docs/latex/wx/text.tex | 2 +- docs/latex/wx/textfile.tex | 94 +- docs/latex/wx/tfile.tex | 8 +- docs/latex/wx/tfontenc.tex | 19 +- docs/latex/wx/tguide.tex | 2 +- docs/latex/wx/thread.tex | 12 +- docs/latex/wx/ti18n.tex | 10 +- docs/latex/wx/timer.tex | 4 +- docs/latex/wx/timespan.tex | 15 + docs/latex/wx/tipc.tex | 4 +- docs/latex/wx/tlog.tex | 14 +- docs/latex/wx/tmbconv.tex | 177 + docs/latex/wx/tnoneng.tex | 42 +- docs/latex/wx/tooltip.tex | 61 + docs/latex/wx/topics.tex | 2 + docs/latex/wx/treectrl.tex | 25 +- docs/latex/wx/tresourc.tex | 153 +- docs/latex/wx/truntime.tex | 2 +- docs/latex/wx/tsamples.tex | 80 +- docs/latex/wx/tscroll.tex | 12 +- docs/latex/wx/tstream.tex | 6 +- docs/latex/wx/tstring.tex | 12 +- docs/latex/wx/tthreads.tex | 2 +- docs/latex/wx/ttips.tex | 4 +- docs/latex/wx/ttoolbar.tex | 6 +- docs/latex/wx/ttreectl.tex | 4 +- docs/latex/wx/tunicode.tex | 26 +- docs/latex/wx/tvalidat.tex | 2 +- docs/latex/wx/txtstrm.tex | 33 +- docs/latex/wx/up.gif | Bin 137 -> 998 bytes docs/latex/wx/url.tex | 2 +- docs/latex/wx/variant.tex | 3 +- docs/latex/wx/window.tex | 107 +- docs/latex/wx/wizard.tex | 124 + docs/latex/wx/wizevt.tex | 66 + docs/latex/wx/wizpage.tex | 164 + docs/latex/wx/wnddisbl.tex | 2 +- docs/latex/wx/wxPython.tex | 43 +- docs/latex/wx/wxhtml.tex | 8 +- docs/latex/wx/wxstring.tex | 77 +- docs/latex/wx/zipstrm.tex | 7 + docs/motif/install.txt | 17 +- docs/motif/issues.txt | 20 +- docs/motif/makewxmotif | 2 +- docs/motif/readme.txt | 14 +- docs/msw/install.txt | 179 +- docs/msw/mingw32.txt | 32 - docs/msw/readme.txt | 9 +- docs/msw/todo.txt | 60 +- docs/readme.txt | 128 +- docs/tech/index.txt | 7 + docs/tech/tn0004.htm | 218 + docs/tech/tn0005.txt | 66 + docs/tech/tn0006.txt | 41 + docs/{msw/bc_ide.txt => tech/tn0007.txt} | 54 +- docs/tech/tn0008.htm | 144 + docs/tech/tn0009.htm | 60 + docs/tech/tn0010.htm | 282 + docs/todo.txt | 30 - include/wx/app.h | 41 +- include/wx/arrimpl.cpp | 8 +- include/wx/buffer.h | 2 + include/wx/calctrl.h | 2 + include/wx/cmdline.h | 3 +- include/wx/confbase.h | 11 +- include/wx/cursor.h | 42 +- include/wx/dataobj.h | 2 +- include/wx/date.h | 8 +- include/wx/datetime.h | 70 +- include/wx/datetime.inl | 214 +- include/wx/db.h | 213 +- include/wx/dbtable.h | 295 +- include/wx/dc.h | 31 +- include/wx/debug.h | 21 +- include/wx/defs.h | 184 +- include/wx/dialog.h | 2 +- include/wx/dialup.h | 2 +- include/wx/dynarray.h | 5 +- include/wx/dynlib.h | 3 + include/wx/encconv.h | 65 +- include/wx/event.h | 13 +- include/wx/ffile.h | 7 +- include/wx/file.h | 7 +- include/wx/fileconf.h | 14 +- include/wx/filefn.h | 74 + include/wx/font.h | 57 +- include/wx/fontenc.h | 71 + include/wx/fontmap.h | 31 +- include/wx/frame.h | 4 + include/wx/gdicmn.h | 8 +- include/wx/generic/caret.h | 17 +- include/wx/generic/colrdlgg.h | 123 +- include/wx/generic/dirdlgg.h | 20 +- include/wx/generic/dragimgg.h | 32 +- include/wx/generic/grid.h | 67 +- include/wx/generic/helpext.h | 2 +- include/wx/generic/helphtml.h | 6 +- include/wx/generic/helpwxht.h | 2 +- include/wx/generic/helpxlp.h | 5 + include/wx/generic/imaglist.h | 24 +- include/wx/generic/laywin.h | 18 +- include/wx/generic/panelg.h | 20 +- include/wx/generic/plot.h | 6 +- include/wx/generic/sashwin.h | 24 +- include/wx/generic/splitter.h | 37 +- include/wx/generic/treectrl.h | 3 + include/wx/generic/treelay.h | 2 +- include/wx/generic/wizard.h | 20 +- include/wx/gtk/bitmap.h | 4 +- include/wx/gtk/bmpbuttn.h | 8 + include/wx/gtk/brush.h | 4 +- include/wx/gtk/dc.h | 1 - include/wx/gtk/dialog.h | 3 + include/wx/gtk/dnd.h | 30 +- include/wx/gtk/mdi.h | 80 +- include/wx/gtk/pen.h | 8 +- include/wx/gtk/radiobox.h | 57 +- include/wx/gtk1/bitmap.h | 4 +- include/wx/gtk1/bmpbuttn.h | 8 + include/wx/gtk1/brush.h | 4 +- include/wx/gtk1/dc.h | 1 - include/wx/gtk1/dialog.h | 3 + include/wx/gtk1/dnd.h | 30 +- include/wx/gtk1/mdi.h | 80 +- include/wx/gtk1/pen.h | 8 +- include/wx/gtk1/radiobox.h | 57 +- include/wx/hash.h | 13 +- include/wx/helpbase.h | 84 +- include/wx/html/helpctrl.h | 1 + include/wx/html/helpfrm.h | 4 +- include/wx/html/htmprint.h | 12 +- include/wx/html/msw/wfolder.ico | Bin 318 -> 318 bytes include/wx/html/winpars.h | 1 + include/wx/imagbmp.h | 23 +- include/wx/image.h | 25 +- include/wx/ipcbase.h | 31 +- include/wx/list.h | 27 +- include/wx/listimpl.cpp | 8 +- include/wx/log.h | 34 +- include/wx/longlong.h | 19 +- include/wx/mac/dc.h | 2 - include/wx/mac/setup.h | 32 +- include/wx/menu.h | 57 +- include/wx/module.h | 2 +- include/wx/motif/bitmap.h | 4 +- include/wx/motif/brush.h | 4 +- include/wx/motif/choice.h | 2 + include/wx/motif/dc.h | 2 - include/wx/motif/dcmemory.h | 2 +- include/wx/motif/icon.h | 4 +- include/wx/motif/palette.h | 4 +- include/wx/motif/pen.h | 4 +- include/wx/msw/bitmap.h | 4 +- include/wx/msw/brush.h | 4 +- include/wx/msw/choice.h | 2 + include/wx/msw/colordlg.h | 34 +- include/wx/msw/combobox.h | 26 +- include/wx/msw/font.h | 5 + include/wx/msw/frame.h | 3 + include/wx/msw/helpchm.h | 57 + include/wx/msw/helpwin.h | 40 +- include/wx/msw/imaglist.h | 29 +- include/wx/msw/mdi.h | 23 +- include/wx/msw/notebook.h | 3 +- include/wx/msw/ole/dataobj.h | 2 +- include/wx/msw/ole/dropsrc.h | 10 + include/wx/msw/ole/oleutils.h | 16 +- include/wx/msw/palette.h | 4 +- include/wx/msw/pen.h | 4 +- include/wx/msw/private.h | 61 +- include/wx/msw/radiobox.h | 2 + include/wx/msw/radiobut.h | 3 + include/wx/msw/setup0.h | 133 +- include/wx/msw/spinctrl.h | 15 +- include/wx/msw/textctrl.h | 13 + include/wx/msw/window.h | 4 + include/wx/msw/winundef.h | 18 +- include/wx/object.h | 17 +- include/wx/os2/accel.h | 28 +- include/wx/os2/dc.h | 331 +- include/wx/os2/filedlg.h | 3 + include/wx/os2/frame.h | 3 +- include/wx/os2/helpwin.h | 5 +- include/wx/os2/menu.h | 5 + include/wx/os2/msgdlg.h | 37 +- include/wx/os2/private.h | 1 + include/wx/os2/setup.h | 28 +- include/wx/os2/setup0.h | 28 +- include/wx/paper.h | 3 +- include/wx/prntbase.h | 14 + include/wx/process.h | 18 +- include/wx/propform.h | 113 +- include/wx/proplist.h | 151 +- include/wx/qt/dc.h | 2 - include/wx/resource.h | 8 +- include/wx/sckipc.h | 27 +- include/wx/setup.h | 21 + include/wx/sizer.h | 228 +- include/wx/statusbr.h | 2 +- include/wx/stc/SciLexer.h | 181 + include/wx/stc/stc.h | 127 +- include/wx/strconv.h | 2 +- include/wx/string.h | 68 +- include/wx/stubs/dc.h | 2 - include/wx/stubs/setup.h | 23 +- include/wx/tbarbase.h | 2 +- include/wx/timer.h | 7 +- include/wx/txtstrm.h | 4 +- include/wx/url.h | 16 +- include/wx/utils.h | 50 +- include/wx/version.h | 18 +- include/wx/window.h | 2 +- include/wx/wizard.h | 5 + include/wx/wxchar.h | 39 +- include/wx/wxprec.h | 4 + include/wx/zipstrm.h | 57 +- lib/{wx214.def => wx22.def} | 415 +- locale/.cvsignore | 1 + locale/Makefile | 20 +- locale/cs.po | 4028 +++-- locale/da.po | 2991 ++++ locale/de.po | 919 +- locale/dk.po | 1975 --- locale/fr.po | 2927 ++++ locale/wxstd.po | 1264 +- modules | 1 - samples/caret/caret.cpp | 31 +- samples/configure | 2 + samples/configure.in | 1 + samples/console/console.cpp | 921 +- samples/controls/controls.cpp | 190 +- samples/db/dbtest.cpp | 216 +- samples/db/dbtest.h | 14 +- samples/db/listdb.cpp | 58 +- samples/db/listdb.h | 10 +- samples/dialogs/dialogs.cpp | 81 +- samples/dialogs/dialogs.h | 19 +- samples/dnd/dnd.cpp | 22 +- samples/dnd/dnd.rc | 3 + samples/dnd/dnd_copy.cur | Bin 0 -> 326 bytes samples/dnd/dnd_copy.xpm | 45 + samples/dnd/dnd_move.cur | Bin 0 -> 326 bytes samples/dnd/dnd_move.xpm | 44 + samples/dnd/dnd_none.cur | Bin 0 -> 326 bytes samples/dnd/dnd_none.xpm | 45 + samples/docview/doc.cpp | 444 +- samples/docview/doc.h | 110 +- samples/docview/docview.cpp | 338 +- samples/docview/docview.h | 36 +- samples/docview/view.cpp | 298 +- samples/docview/view.h | 68 +- samples/docvwmdi/docview.cpp | 8 +- samples/dragimag/Makefile.in | 1 + samples/dragimag/dragimag.cpp | 2 +- samples/dragimag/makefile.g95 | 2 +- samples/drawing/drawing.cpp | 170 +- samples/exec/exec.cpp | 156 +- samples/exec/makefile.g95 | 2 +- samples/font/font.cpp | 37 +- samples/grid/grid.cpp | 5 - samples/grid/makefile.g95 | 2 +- samples/help/Makefile.in | 1 + samples/help/back.gif | Bin 225 -> 978 bytes samples/help/contents.gif | Bin 231 -> 996 bytes samples/help/demo.cpp | 149 +- samples/help/doc.chm | Bin 0 -> 13434 bytes samples/help/doc.hhc | 35 + samples/help/doc.hhk | 31 + samples/help/doc.hhp | 27 + samples/help/doc.zip | Bin 5136 -> 5468 bytes samples/help/forward.gif | Bin 164 -> 959 bytes samples/help/makefile.b32 | 1 + samples/help/makefile.vc | 1 + samples/help/up.gif | Bin 137 -> 998 bytes samples/image/image.cpp | 22 +- samples/internat/internat.cpp | 6 + samples/ipc/client.cpp | 13 +- samples/ipc/server.cpp | 19 +- samples/ipc/server.h | 3 +- samples/joytest/Makefile.in | 14 +- samples/joytest/makefile.g95 | 2 +- samples/layout/layout.cpp | 18 +- samples/listctrl/listtest.cpp | 37 +- samples/listctrl/listtest.h | 3 + samples/makefile.g95 | 28 +- samples/makefile.vc | 2 +- samples/mdi/mdi.cpp | 29 +- samples/mdi/mdi.h | 2 + samples/menu/menu.cpp | 19 +- samples/mfc/mfctest.cpp | 7 +- samples/minifram/makefile.g95 | 2 +- samples/minimal/minimal.cpp | 6 +- samples/minimal/minimal.rc4 | 6 + samples/nativdlg/dialog1.rc | 4 + samples/newgrid/griddemo.cpp | 33 +- samples/newgrid/griddemo.h | 4 + samples/notebook/makefile.g95 | 2 +- samples/notebook/notebook.cpp | 19 +- samples/oleauto/oleauto.cpp | 4 + samples/opengl/cube/Makefile.in | 2 +- samples/opengl/cube/cube.cpp | 2 +- samples/opengl/isosurf/Makefile.in | 2 +- samples/opengl/penguin/Makefile.in | 2 +- samples/printing/printing.cpp | 7 +- samples/proplist/makefile.g95 | 2 +- samples/propsize/makefile.g95 | 2 +- samples/regtest/regtest.cpp | 24 +- samples/resource/dialog1.wxr | 18 +- samples/resource/resource.cpp | 2 + samples/richedit/README | 8 + samples/richedit/wxllist.cpp | 311 +- samples/richedit/wxllist.h | 66 +- samples/richedit/wxlwindow.cpp | 111 +- samples/richedit/wxlwindow.h | 13 +- samples/rotate/rotate.cpp | 49 +- samples/sashtest/makefile.g95 | 2 +- samples/sashtest/sashtest.cpp | 3 +- samples/scroll/scroll.cpp | 9 +- samples/splitter/makefile.g95 | 2 +- samples/splitter/splitter.cpp | 10 +- samples/statbar/makefile.g95 | 2 +- samples/statbar/statbar.cpp | 87 +- samples/stc/Makefile.in | 4 +- samples/tab/makefile.g95 | 2 +- samples/taskbar/tbtest.cpp | 5 + samples/text/makefile.b32 | 11 +- samples/text/makefile.bcc | 2 +- samples/text/makefile.wat | 2 +- samples/text/text.cpp | 110 +- samples/thread/makefile.g95 | 2 +- samples/thread/thread.cpp | 5 - samples/toolbar/makefile.g95 | 2 +- samples/toolbar/toolbar.cpp | 102 +- samples/treectrl/makefile.g95 | 2 +- samples/treectrl/treectrl.cpp | 80 +- samples/treelay/makefile.g95 | 2 +- samples/typetest/makefile.g95 | 2 +- samples/typetest/typetest.cpp | 268 +- samples/typetest/typetest.h | 2 + samples/validate/makefile.g95 | 2 +- samples/wizard/makefile.g95 | 2 +- samples/wizard/wizard.cpp | 13 +- setup.h.in | 20 +- setup.h_vms | 4 + src/Wxwindll.icc | 6 +- src/common/cmdline.cpp | 61 +- src/common/cmndata.cpp | 4 +- src/common/config.cpp | 39 +- src/common/datetime.cpp | 176 +- src/common/db.cpp | 1149 +- src/common/dbtable.cpp | 668 +- src/common/dlgcmn.cpp | 2 + src/common/docview.cpp | 83 +- src/common/dynlib.cpp | 98 +- src/common/encconv.cpp | 91 +- src/common/event.cpp | 2 - src/common/file.cpp | 94 +- src/common/fileconf.cpp | 72 +- src/common/filefn.cpp | 290 +- src/common/filesys.cpp | 29 +- src/common/fontmap.cpp | 129 +- src/common/framecmn.cpp | 52 +- src/common/fs_inet.cpp | 21 +- src/common/fs_mem.cpp | 4 +- src/common/fs_zip.cpp | 9 +- src/common/ftp.cpp | 26 +- src/common/gdicmn.cpp | 350 +- src/common/http.cpp | 2 +- src/common/imagbmp.cpp | 116 + src/common/image.cpp | 221 +- src/common/imagjpeg.cpp | 3 + src/common/imagtiff.cpp | 123 +- src/common/init.cpp | 2 +- src/common/intl.cpp | 81 +- src/common/list.cpp | 3 +- src/common/log.cpp | 17 +- src/common/memory.cpp | 16 +- src/common/mimecmn.cpp | 15 +- src/common/object.cpp | 26 +- src/common/paper.cpp | 90 +- src/common/parser.y | 12 +- src/common/prntbase.cpp | 8 +- src/common/process.cpp | 19 +- src/common/resource.cpp | 5190 +++--- src/common/sckaddr.cpp | 4 +- src/common/sckfile.cpp | 4 + src/common/sckipc.cpp | 49 +- src/common/sizer.cpp | 423 +- src/common/strconv.cpp | 234 +- src/common/string.cpp | 68 +- src/common/textfile.cpp | 12 +- src/common/timercmn.cpp | 37 +- src/common/txtstrm.cpp | 68 +- src/common/unzip.c | 11 +- src/common/url.cpp | 91 +- src/common/utilscmn.cpp | 84 +- src/common/valgen.cpp | 93 +- src/common/valtext.cpp | 10 +- src/common/variant.cpp | 39 +- src/common/wfstream.cpp | 197 +- src/common/wincmn.cpp | 72 +- src/common/wxchar.cpp | 10 + src/common/wxexpr.cpp | 28 +- src/common/zipstrm.cpp | 25 +- src/common/zstream.cpp | 21 +- src/files.lst | 14 +- src/generic/calctrl.cpp | 23 +- src/generic/caret.cpp | 71 +- src/generic/colrdlgg.cpp | 23 +- src/generic/dcpsg.cpp | 111 +- src/generic/dirdlgg.cpp | 131 +- src/generic/dragimgg.cpp | 82 +- src/generic/filedlgg.cpp | 17 +- src/generic/grid.cpp | 1304 +- src/generic/gridsel.cpp | 73 +- src/generic/helpext.cpp | 4 +- src/generic/helphtml.cpp | 12 +- src/generic/helpwxht.cpp | 17 +- src/generic/imaglist.cpp | 18 +- src/generic/laywin.cpp | 29 +- src/generic/listctrl.cpp | 699 +- src/generic/logg.cpp | 481 +- src/generic/notebook.cpp | 4 +- src/generic/numdlgg.cpp | 4 +- src/generic/panelg.cpp | 40 +- src/generic/printps.cpp | 28 +- src/generic/prop.cpp | 2 +- src/generic/propform.cpp | 918 +- src/generic/proplist.cpp | 8 +- src/generic/sashwin.cpp | 47 +- src/generic/scrolwin.cpp | 16 +- src/generic/splitter.cpp | 174 +- src/generic/treectrl.cpp | 82 +- src/generic/treelay.cpp | 16 +- src/generic/wizard.cpp | 101 +- src/gtk/app.cpp | 8 +- src/gtk/bitmap.cpp | 26 +- src/gtk/bmpbuttn.cpp | 100 +- src/gtk/brush.cpp | 4 +- src/gtk/colour.cpp | 4 +- src/gtk/combobox.cpp | 1 + src/gtk/cursor.cpp | 10 + src/gtk/data.cpp | 6 - src/gtk/dcclient.cpp | 24 +- src/gtk/dialog.cpp | 55 +- src/gtk/dnd.cpp | 87 +- src/gtk/files.lst | 6 +- src/gtk/font.cpp | 4 +- src/gtk/frame.cpp | 44 +- src/gtk/joystick.cpp | 2 +- src/gtk/mdi.cpp | 171 +- src/gtk/menu.cpp | 116 +- src/gtk/notebook.cpp | 8 +- src/gtk/pen.cpp | 4 +- src/gtk/radiobox.cpp | 73 +- src/gtk/radiobut.cpp | 6 +- src/gtk/settings.cpp | 24 +- src/gtk/slider.cpp | 1 + src/gtk/spinctrl.cpp | 2 +- src/gtk/tbargtk.cpp | 5 +- src/gtk/textctrl.cpp | 15 +- src/gtk/tooltip.cpp | 6 +- src/gtk/win_gtk.c | 181 +- src/gtk/window.cpp | 164 +- src/gtk1/app.cpp | 8 +- src/gtk1/bitmap.cpp | 26 +- src/gtk1/bmpbuttn.cpp | 100 +- src/gtk1/brush.cpp | 4 +- src/gtk1/colour.cpp | 4 +- src/gtk1/combobox.cpp | 1 + src/gtk1/cursor.cpp | 10 + src/gtk1/data.cpp | 6 - src/gtk1/dcclient.cpp | 24 +- src/gtk1/dialog.cpp | 55 +- src/gtk1/dnd.cpp | 87 +- src/gtk1/files.lst | 6 +- src/gtk1/font.cpp | 4 +- src/gtk1/frame.cpp | 44 +- src/gtk1/joystick.cpp | 2 +- src/gtk1/mdi.cpp | 171 +- src/gtk1/menu.cpp | 116 +- src/gtk1/notebook.cpp | 8 +- src/gtk1/pen.cpp | 4 +- src/gtk1/radiobox.cpp | 73 +- src/gtk1/radiobut.cpp | 6 +- src/gtk1/settings.cpp | 24 +- src/gtk1/slider.cpp | 1 + src/gtk1/spinctrl.cpp | 2 +- src/gtk1/tbargtk.cpp | 5 +- src/gtk1/textctrl.cpp | 15 +- src/gtk1/tooltip.cpp | 6 +- src/gtk1/win_gtk.c | 181 +- src/gtk1/window.cpp | 164 +- src/html/helpctrl.cpp | 16 +- src/html/helpdata.cpp | 131 +- src/html/helpfrm.cpp | 227 +- src/html/htmlcell.cpp | 5 +- src/html/htmlfilt.cpp | 4 +- src/html/htmlpars.cpp | 2 +- src/html/htmltag.cpp | 9 +- src/html/htmlwin.cpp | 11 +- src/html/htmprint.cpp | 32 +- src/html/m_dflist.cpp | 2 +- src/html/m_fonts.cpp | 2 +- src/html/m_hline.cpp | 2 +- src/html/m_image.cpp | 2 +- src/html/m_layout.cpp | 2 +- src/html/m_links.cpp | 2 +- src/html/m_list.cpp | 2 +- src/html/m_meta.cpp | 2 +- src/html/m_pre.cpp | 2 +- src/html/m_tables.cpp | 2 +- src/html/winpars.cpp | 12 +- src/jpeg/{jpeg.dsp => JpegVC.dsp} | 0 src/jpeg/{jpeg.dsw => JpegVC.dsw} | 2 +- src/jpeg/jconfig.h | 2 + src/jpeg/makefile.wat | 190 +- src/make.env.in | 9 +- src/makeb32.env | 9 +- src/makeg95.env | 2 +- src/makelib.env.in | 73 +- src/makeprog.b32 | 6 +- src/makeprog.env.in | 6 +- src/makeva.env | 6 +- src/makevc.env | 4 +- src/makewat.env | 8 +- src/motif/choice.cpp | 96 +- src/motif/combobox.cpp | 35 +- src/motif/control.cpp | 2 +- src/motif/dcclient.cpp | 2 +- src/motif/dialog.cpp | 14 + src/motif/files.lst | 3 +- src/motif/glcanvas.cpp | 144 +- src/motif/slider.cpp | 1 + src/motif/window.cpp | 11 +- src/motif/xmcombo/xmcombo.c | 4 +- src/msw/accel.cpp | 1 - src/msw/app.cpp | 90 +- src/msw/bitmap.cpp | 27 +- src/msw/bmpbuttn.cpp | 39 +- src/msw/button.cpp | 32 +- src/msw/caret.cpp | 6 +- src/msw/checkbox.cpp | 34 +- src/msw/choice.cpp | 46 +- src/msw/clipbrd.cpp | 6 +- src/msw/colordlg.cpp | 154 +- src/msw/combobox.cpp | 329 +- src/msw/control.cpp | 18 +- src/msw/curico.cpp | 4 +- src/msw/data.cpp | 29 +- src/msw/dc.cpp | 379 +- src/msw/dcclient.cpp | 2 +- src/msw/dcmemory.cpp | 5 +- src/msw/dcprint.cpp | 11 +- src/msw/dde.cpp | 9 +- src/msw/dialog.cpp | 108 +- src/msw/dialup.cpp | 51 +- src/msw/dib.cpp | 4 +- src/msw/dirdlg.cpp | 4 +- src/msw/dragimag.cpp | 2 +- src/msw/filedlg.cpp | 125 +- src/msw/files.lst | 6 +- src/msw/font.cpp | 11 +- src/msw/fontenum.cpp | 51 +- src/msw/fontutil.cpp | 120 +- src/msw/frame.cpp | 160 +- src/msw/gauge95.cpp | 71 +- src/msw/gaugemsw.cpp | 8 +- src/msw/gdiimage.cpp | 8 +- src/msw/glcanvas.cpp | 37 +- src/msw/helpchm.cpp | 152 + src/msw/helpwin.cpp | 127 +- src/msw/icon.cpp | 2 +- src/msw/imaglist.cpp | 18 +- src/msw/iniconf.cpp | 25 +- src/msw/listbox.cpp | 32 +- src/msw/listctrl.cpp | 13 +- src/msw/makefile.b32 | 28 +- src/msw/makefile.bcc | 2 +- src/msw/makefile.dos | 2 +- src/msw/makefile.g95 | 26 +- src/msw/makefile.sc | 2 +- src/msw/makefile.vc | 33 +- src/msw/makefile.wat | 41 +- src/msw/mdi.cpp | 49 +- src/msw/menu.cpp | 91 +- src/msw/menuitem.cpp | 6 +- src/msw/metafile.cpp | 8 +- src/msw/mimetype.cpp | 40 +- src/msw/nativdlg.cpp | 2 +- src/msw/ole/automtn.cpp | 24 +- src/msw/ole/dataobj.cpp | 68 +- src/msw/ole/droptgt.cpp | 10 +- src/msw/ole/oleutils.cpp | 24 +- src/msw/ole/uuid.cpp | 3 +- src/msw/printdlg.cpp | 32 +- src/msw/printwin.cpp | 30 +- src/msw/radiobox.cpp | 48 +- src/msw/radiobut.cpp | 34 +- src/msw/regconf.cpp | 5 + src/msw/registry.cpp | 36 +- src/msw/slider95.cpp | 1 + src/msw/slidrmsw.cpp | 4 +- src/msw/spinbutt.cpp | 7 +- src/msw/spinctrl.cpp | 73 +- src/msw/statbmp.cpp | 2 +- src/msw/statbr95.cpp | 22 +- src/msw/statline.cpp | 22 +- src/msw/stattext.cpp | 2 +- src/msw/taskbar.cpp | 6 + src/msw/tbar95.cpp | 126 +- src/msw/textctrl.cpp | 180 +- src/msw/thread.cpp | 106 +- src/msw/tooltip.cpp | 27 +- src/msw/treectrl.cpp | 103 +- src/msw/utils.cpp | 12 +- src/msw/utilsexc.cpp | 292 +- src/msw/version.rc | 47 + src/msw/window.cpp | 321 +- src/msw/xpmhand.cpp | 2 +- src/os2/accel.cpp | 147 +- src/os2/app.cpp | 29 +- src/os2/data.cpp | 6 - src/os2/dc.cpp | 191 +- src/os2/dcclient.cpp | 32 +- src/os2/dcmemory.cpp | 6 +- src/os2/dir.cpp | 2 - src/os2/font.cpp | 199 +- src/os2/frame.cpp | 88 +- src/os2/gdiimage.cpp | 2 + src/os2/makefile.va | 12 +- src/os2/mdi.cpp | 2 +- src/os2/menu.cpp | 129 +- src/os2/menuitem.cpp | 8 +- src/os2/metafile.cpp | 4 +- src/os2/msgdlg.cpp | 108 +- src/os2/thread.cpp | 4 + src/os2/utils.cpp | 2 - src/os2/utilsexc.cpp | 2 - src/os2/window.cpp | 8 +- src/png/{png.dsp => PngVC.dsp} | 6 +- src/{tiff/tiff.dsw => png/PngVC.dsw} | 2 +- src/stc/Makefile.in | 44 +- src/stc/PlatWX.cpp | 49 +- src/stc/ScintillaWX.cpp | 49 +- src/stc/ScintillaWX.h | 2 +- src/stc/StcVC.dsp | 42 +- src/stc/makefile.b32 | 37 +- src/stc/makefile.g95 | 10 + src/stc/makefile.vc | 11 +- src/stc/scintilla/README.txt | 5 +- src/stc/scintilla/include/Accessor.h | 78 +- src/stc/scintilla/include/KeyWords.h | 37 +- src/stc/scintilla/include/Platform.h | 13 +- src/stc/scintilla/include/PropSet.h | 6 +- src/stc/scintilla/include/SciLexer.h | 129 +- src/stc/scintilla/include/Scintilla.h | 51 +- src/stc/scintilla/include/WinDefs.h | 48 +- src/stc/scintilla/include/WindowAccessor.h | 47 + src/stc/scintilla/src/AutoComplete.cxx | 11 +- src/stc/scintilla/src/AutoComplete.h | 7 +- src/stc/scintilla/src/CallTip.cxx | 3 +- src/stc/scintilla/src/CallTip.h | 5 +- src/stc/scintilla/src/CellBuffer.cxx | 380 +- src/stc/scintilla/src/CellBuffer.h | 62 +- src/stc/scintilla/src/ContractionState.cxx | 27 +- src/stc/scintilla/src/Document.cxx | 369 +- src/stc/scintilla/src/Document.h | 40 +- src/stc/scintilla/src/DocumentAccessor.cxx | 174 + src/stc/scintilla/src/DocumentAccessor.h | 49 + src/stc/scintilla/src/Editor.cxx | 402 +- src/stc/scintilla/src/Editor.h | 19 +- src/stc/scintilla/src/Indicator.cxx | 16 + src/stc/scintilla/src/KeyMap.cxx | 100 +- src/stc/scintilla/src/KeyMap.h | 1 + src/stc/scintilla/src/KeyWords.cxx | 2220 +-- src/stc/scintilla/src/LexCPP.cxx | 258 + src/stc/scintilla/src/LexHTML.cxx | 1139 ++ src/stc/scintilla/src/LexOthers.cxx | 304 + src/stc/scintilla/src/LexPerl.cxx | 480 + src/stc/scintilla/src/LexPython.cxx | 274 + src/stc/scintilla/src/LexSQL.cxx | 156 + src/stc/scintilla/src/LexVB.cxx | 118 + src/stc/scintilla/src/LineMarker.cxx | 20 - src/stc/scintilla/src/PropSet.cxx | 11 +- src/stc/scintilla/src/SVector.h | 12 +- src/stc/scintilla/src/ScintillaBase.cxx | 36 +- src/stc/scintilla/src/ScintillaBase.h | 7 +- src/stc/scintilla/src/Style.cxx | 83 +- src/stc/scintilla/src/Style.h | 17 +- src/stc/scintilla/src/UniConversion.cxx | 77 + src/stc/scintilla/src/UniConversion.h | 9 + src/stc/scintilla/src/ViewStyle.cxx | 69 +- src/stc/scintilla/src/ViewStyle.h | 13 + src/stc/scintilla/src/WindowAccessor.cxx | 173 + src/stc/stc.cpp | 227 +- src/tiff/{tiff.dsp => TiffVC.dsp} | 0 src/{png/png.dsw => tiff/TiffVC.dsw} | 2 +- src/tiff/makefile.wat | 141 + src/tiff/tif_lzw.c | 5 + src/tiff/tif_pixarlog.c | 6 + src/tiff/tif_predict.c | 5 + src/tiff/tif_zip.c | 6 + src/unix/dialup.cpp | 570 +- src/unix/gsocket.c | 1 - src/unix/mimetype.cpp | 88 +- src/unix/utilsunx.cpp | 57 +- src/wxWin.icc | 2 + src/wxvc.dsp | 8 + src/wxvc.dsw | 10 +- src/wxvc_dll.dsp | 102 +- src/xpm/{attrib.c => Attrib.c} | 2 +- src/xpm/{crbuffri.c => CrBufFrI.c} | 0 src/xpm/{crdatfri.c => CrDatFrI.c} | 0 src/xpm/{crifrbuf.c => CrIFrBuf.c} | 0 src/xpm/{crifrdat.c => CrIFrDat.c} | 0 src/xpm/{image.c => Image.c} | 0 src/xpm/{info.c => Info.c} | 0 src/xpm/{rdftodat.c => RdFToDat.c} | 0 src/xpm/{rdftoi.c => RdFToI.c} | 0 src/xpm/{wrffrdat.c => WrFFrDat.c} | 0 src/xpm/{wrffri.c => WrFFrI.c} | 0 src/xpm/{xpmi.h => XpmI.h} | 0 src/xpm/XpmVC.dsp | 186 + src/xpm/{xpm.dsw => XpmVC.dsw} | 2 +- src/xpm/makefile.b32 | 7 + src/xpm/scan.c | 4 +- src/xpm/simx.c | 2 +- src/xpm/xpm.dsp | 8 +- src/zlib/{zlib.dsp => ZlibVC.dsp} | 0 src/zlib/ZlibVC.dsw | 29 + src/zlib/zlib.dsw | 29 - utils/HelpGen/src/HelpGen.cpp | 13 +- .../demo => Install/builder}/bitmaps/copy.bmp | Bin utils/Install/builder/bitmaps/copy.xpm | 25 + utils/Install/builder/bitmaps/cut.bmp | Bin 0 -> 238 bytes utils/Install/builder/bitmaps/cut.xpm | 24 + utils/Install/builder/bitmaps/help.bmp | Bin 0 -> 238 bytes utils/Install/builder/bitmaps/help.xpm | 25 + .../demo => Install/builder}/bitmaps/new.bmp | Bin utils/Install/builder/bitmaps/new.xpm | 24 + utils/Install/builder/bitmaps/open.bmp | Bin 0 -> 238 bytes utils/Install/builder/bitmaps/open.xpm | 26 + utils/Install/builder/bitmaps/page.bmp | Bin 0 -> 714 bytes .../builder}/bitmaps/paste.bmp | Bin utils/Install/builder/bitmaps/preview.bmp | Bin 0 -> 238 bytes utils/Install/builder/bitmaps/preview.xpm | 26 + utils/Install/builder/bitmaps/print.bmp | Bin 0 -> 238 bytes utils/Install/builder/bitmaps/print.xpm | 26 + utils/Install/builder/bitmaps/save.bmp | Bin 0 -> 238 bytes utils/Install/builder/bitmaps/save.xpm | 25 + utils/Install/builder/makefile | 23 + utils/Install/builder/makefile.b32 | 10 + utils/Install/builder/makefile.bcc | 14 + utils/Install/builder/makefile.dos | 10 + utils/Install/builder/makefile.g95 | 10 + utils/Install/builder/makefile.sc | 37 + utils/Install/builder/makefile.sl | 14 + utils/Install/builder/makefile.twn | 35 + utils/Install/builder/makefile.unx | 23 + utils/Install/builder/makefile.vc | 11 + utils/Install/builder/makefile.wat | 11 + .../bitmaps => Install/builder}/mondrian.ico | Bin utils/Install/builder/mondrian.xpm | 44 + utils/Install/builder/wxib.cpp | 647 + utils/Install/builder/wxib.def | 8 + utils/Install/builder/wxib.rc | 12 + utils/Install/builder/wxibVC.dsp | 175 + utils/Install/builder/wxibvc.dsw | 29 + utils/Install/incace/acestruc.h | 151 + utils/Install/incace/attribs.h | 33 + utils/Install/incace/declare.h | 38 + utils/Install/incace/globals.h | 90 + utils/Install/incace/os.h | 26 + utils/Install/incace/portable.h | 101 + utils/Install/incace/uac_comm.h | 14 + utils/Install/incace/uac_crc.h | 20 + utils/Install/incace/uac_crt.h | 12 + utils/Install/incace/uac_dcpr.h | 14 + utils/Install/incace/uac_sys.h | 18 + utils/Install/incace/unace.h | 66 + utils/Install/inczip/consts.h | 46 + utils/Install/inczip/crypt.h | 24 + utils/Install/inczip/ebcdic.h | 272 + utils/Install/inczip/globals.h | 395 + utils/Install/inczip/inflate.h | 24 + utils/Install/inczip/nt.h | 28 + utils/Install/inczip/os2acl.h | 32 + utils/Install/inczip/os2cfg.h | 136 + utils/Install/inczip/os2data.h | 139 + utils/Install/inczip/rsxntwin.h | 155 + utils/Install/inczip/tables.h | 81 + utils/Install/inczip/ttyio.h | 186 + utils/Install/inczip/unzip.h | 548 + utils/Install/inczip/unzpriv.h | 2384 +++ utils/Install/inczip/version.h | 44 + utils/Install/inczip/w32cfg.h | 222 + utils/Install/inczip/zip.h | 15 + utils/Install/install.c | 1081 ++ utils/Install/install.h | 116 + utils/Install/instsup.cpp | 717 + utils/Install/instsup.h | 26 + utils/Install/packace/globals.c | 134 + utils/Install/packace/makefile | 46 + utils/Install/packace/makefile.b32 | 41 + utils/Install/packace/makefile.g95 | 46 + utils/Install/packace/makefile.gcc | 46 + utils/Install/packace/uac_comm.c | 51 + utils/Install/packace/uac_crc.c | 36 + utils/Install/packace/uac_crt.c | 149 + utils/Install/packace/uac_dcpr.c | 553 + utils/Install/packace/uac_sys.c | 105 + utils/Install/packace/unace.c | 584 + utils/Install/packzip/api.c | 601 + utils/Install/packzip/apihelp.c | 147 + utils/Install/packzip/crc32.c | 56 + utils/Install/packzip/crc_i386.S | 230 + utils/Install/packzip/crc_i386.asm | 229 + utils/Install/packzip/crc_i386.c | 215 + utils/Install/packzip/crc_lcc.asm | 108 + utils/Install/packzip/crctab.c | 219 + utils/Install/packzip/crypt.c | 12 + utils/Install/packzip/envargs.c | 314 + utils/Install/packzip/explode.c | 871 + utils/Install/packzip/extract.c | 1985 +++ utils/Install/packzip/fileio.c | 2153 +++ utils/Install/packzip/funzip.c | 468 + utils/Install/packzip/globals.c | 204 + utils/Install/packzip/inflate.c | 1305 ++ utils/Install/packzip/list.c | 649 + utils/Install/packzip/makefile | 146 + utils/Install/packzip/makefile.b32 | 118 + utils/Install/packzip/makefile.g95 | 158 + utils/Install/packzip/makefile.gcc | 146 + utils/Install/packzip/makefile.os2 | 670 + utils/Install/packzip/match.c | 294 + utils/Install/packzip/nt.c | 659 + utils/Install/packzip/os2.c | 2187 +++ utils/Install/packzip/os2acl.c | 384 + utils/Install/packzip/process.c | 1383 ++ utils/Install/packzip/rexxapi.c | 886 + utils/Install/packzip/rexxapi.def | 18 + utils/Install/packzip/rexxhelp.c | 178 + utils/Install/packzip/stub.def | 6 + utils/Install/packzip/ttyio.c | 625 + utils/Install/packzip/unix.c | 1424 ++ utils/Install/packzip/unreduce.c | 230 + utils/Install/packzip/unshrink.c | 301 + utils/Install/packzip/unzip.c | 1744 ++ utils/Install/packzip/unzip.def | 4 + utils/Install/packzip/unzipstb.c | 48 + utils/Install/packzip/win32.c | 2390 +++ utils/Install/packzip/zipinfo.c | 1912 +++ utils/Install/script/finished.ini | 9 + utils/Install/script/finished.wxr | 25 + utils/Install/script/install.bmp | Bin 0 -> 14418 bytes utils/Install/script/install.xpm | 292 + utils/Install/script/license.txt | 26 + utils/Install/script/nocheck.ini | 5 + utils/Install/script/page1.ini | 12 + utils/Install/script/page1.wxr | 27 + utils/Install/script/page2.ini | 11 + utils/Install/script/page2.wxr | 27 + utils/Install/script/page3.ini | 11 + utils/Install/script/page3.wxr | 29 + utils/Install/script/page4.ini | 11 + utils/Install/script/page4.wxr | 25 + utils/Install/script/readme.ini | 8 + utils/Install/script/readme.txt | 25 + utils/Install/script/wxinst.cfg | 62 + utils/Install/sfxace/globals.c | 137 + utils/Install/sfxace/install.PRJ | 50 + utils/Install/sfxace/install.def | 3 + utils/Install/sfxace/install.rc | 2 + utils/Install/sfxace/makefile | 47 + utils/Install/sfxace/makefile.b32 | 76 + utils/Install/sfxace/makefile.g95 | 53 + utils/Install/sfxace/makefile.gcc | 47 + utils/Install/sfxace/sfx.RES | Bin 0 -> 13744 bytes utils/Install/sfxace/sfx.rc | 2 + utils/Install/sfxace/uac_comm.c | 51 + utils/Install/sfxace/uac_crc.c | 36 + utils/Install/sfxace/uac_crt.c | 303 + utils/Install/sfxace/uac_dcpr.c | 554 + utils/Install/sfxace/uac_sys.c | 96 + utils/Install/sfxace/unace.c | 555 + utils/Install/sfxzip/api.c | 601 + utils/Install/sfxzip/apihelp.c | 147 + utils/Install/sfxzip/crc32.c | 56 + utils/Install/sfxzip/crc_i386.S | 230 + utils/Install/sfxzip/crc_i386.asm | 229 + utils/Install/sfxzip/crc_i386.c | 215 + utils/Install/sfxzip/crc_lcc.asm | 108 + utils/Install/sfxzip/crctab.c | 219 + utils/Install/sfxzip/crypt.c | 12 + utils/Install/sfxzip/envargs.c | 314 + utils/Install/sfxzip/explode.c | 871 + utils/Install/sfxzip/extract.c | 1993 +++ utils/Install/sfxzip/fileio.c | 2161 +++ utils/Install/sfxzip/funzip.c | 468 + utils/Install/sfxzip/globals.c | 204 + utils/Install/sfxzip/inflate.c | 1305 ++ utils/Install/sfxzip/list.c | 644 + utils/Install/sfxzip/makefile | 142 + utils/Install/sfxzip/makefile.b32 | 135 + utils/Install/sfxzip/makefile.g95 | 164 + utils/Install/sfxzip/makefile.gcc | 142 + utils/Install/sfxzip/makefile.os2 | 670 + utils/Install/sfxzip/match.c | 294 + utils/Install/sfxzip/nt.c | 659 + utils/Install/sfxzip/os2.c | 2187 +++ utils/Install/sfxzip/os2acl.c | 384 + utils/Install/sfxzip/process.c | 1400 ++ utils/Install/sfxzip/rexxapi.c | 886 + utils/Install/sfxzip/rexxhelp.c | 178 + utils/Install/sfxzip/sfx.RES | Bin 0 -> 13744 bytes utils/Install/sfxzip/sfx.rc | 2 + utils/Install/sfxzip/ttyio.c | 625 + utils/Install/sfxzip/unix.c | 1424 ++ utils/Install/sfxzip/unreduce.c | 230 + utils/Install/sfxzip/unshrink.c | 301 + utils/Install/sfxzip/unzip.c | 1744 ++ utils/Install/sfxzip/unzipstb.c | 48 + utils/Install/sfxzip/win32.c | 2390 +++ utils/Install/sfxzip/zipinfo.c | 1912 +++ utils/Install/wxmain.cpp | 316 + utils/dialoged/docs/back.gif | Bin 225 -> 877 bytes utils/dialoged/docs/body.tex | 60 +- utils/dialoged/docs/changes.tex | 9 + utils/dialoged/docs/contents.gif | Bin 231 -> 821 bytes utils/dialoged/docs/copyhght.bmp | Bin 0 -> 238 bytes utils/dialoged/docs/copyhght.gif | Bin 0 -> 125 bytes utils/dialoged/docs/copywdth.bmp | Bin 0 -> 238 bytes utils/dialoged/docs/copywdth.gif | Bin 0 -> 127 bytes utils/dialoged/docs/dialoged.tex | 6 +- utils/dialoged/docs/disthor.bmp | Bin 0 -> 238 bytes utils/dialoged/docs/disthor.gif | Bin 0 -> 123 bytes utils/dialoged/docs/distvert.bmp | Bin 0 -> 238 bytes utils/dialoged/docs/distvert.gif | Bin 0 -> 113 bytes utils/dialoged/docs/forward.gif | Bin 109 -> 877 bytes utils/dialoged/docs/tex2rtf.ini | 5 + utils/dialoged/docs/up.gif | Bin 6 -> 998 bytes utils/dialoged/src/bitmaps/copyhght.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/copyhght.xpm | 21 + utils/dialoged/src/bitmaps/copywdth.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/copywdth.xpm | 21 + utils/dialoged/src/bitmaps/disthor.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/disthor.xpm | 21 + utils/dialoged/src/bitmaps/distvert.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/distvert.xpm | 21 + utils/dialoged/src/dialoged.cpp | 12 +- utils/dialoged/src/dialoged.h | 6 +- utils/dialoged/src/dialoged.rc | 4 + utils/dialoged/src/dlghndlr.cpp | 1873 +-- utils/dialoged/src/dlghndlr.h | 217 +- utils/dialoged/src/edlist.cpp | 20 +- utils/dialoged/src/edlist.h | 10 +- utils/dialoged/src/edtree.cpp | 24 +- utils/dialoged/src/edtree.h | 12 +- utils/dialoged/src/makefile.vc | 21 + utils/dialoged/src/reseditr.cpp | 3900 +++-- utils/dialoged/src/reseditr.h | 663 +- utils/dialoged/src/reswrite.cpp | 924 +- utils/dialoged/src/symbtabl.cpp | 88 +- utils/dialoged/src/symbtabl.h | 18 +- utils/dialoged/src/winprop.cpp | 3562 +++-- utils/dialoged/src/winprop.h | 492 +- utils/dialoged/src/winstyle.cpp | 303 +- utils/dialoged/src/winstyle.h | 30 +- utils/makegen/makefile.g95 | 2 +- utils/makegen/templates/makefile.g95 | 2 +- utils/tex2rtf/docs/back.gif | Bin 225 -> 978 bytes utils/tex2rtf/docs/contents.gif | Bin 231 -> 996 bytes utils/tex2rtf/docs/forward.gif | Bin 164 -> 959 bytes utils/tex2rtf/docs/tex2rtf.hpj | 2 +- utils/tex2rtf/docs/tex2rtf.ini | 5 + utils/tex2rtf/docs/tex2rtf.tex | 4 +- utils/tex2rtf/docs/up.gif | Bin 137 -> 998 bytes utils/tex2rtf/src/makefile.vc | 21 + utils/tex2rtf/src/tex2any.cpp | 67 +- utils/tex2rtf/src/tex2rtf.cpp | 12 +- utils/wxPython/.cvsignore | 124 - utils/wxPython/Makefile | 18 - utils/wxPython/SWIG.patches/Include.patch | 139 - utils/wxPython/SWIG.patches/Modules.patch | 202 - utils/wxPython/SWIG.patches/SWIG.patch | 530 - utils/wxPython/demo/FileBrowseButton.py | 19 - utils/wxPython/demo/wxGrid.py | 87 - utils/wxPython/distrib/.rpmrc | 5 - utils/wxPython/distrib/makerpm | 33 - utils/wxPython/distrib/maketgz | 48 - utils/wxPython/distrib/wxPython.rsp | 104 - utils/wxPython/distrib/wxPython.spec.in | 53 - utils/wxPython/distrib/wxPython.wsm | Bin 33 -> 0 bytes utils/wxPython/distrib/zipit.bat | 28 - utils/wxPython/lib/filebrowsebutton.py | 170 - utils/wxPython/modules/README | 14 - utils/wxPython/modules/glcanvas/build.cfg | 19 - utils/wxPython/modules/html/.cvsignore | 13 - utils/wxPython/modules/html/BUGS | 23 - utils/wxPython/modules/html/README | 20 - utils/wxPython/modules/html/build.cfg | 16 - utils/wxPython/modules/html/helpsys.cpp | 322 - utils/wxPython/modules/html/helpsys.h | 76 - utils/wxPython/modules/html/htmlc.def | 2 - utils/wxPython/modules/html/htmlhelper.py | 59 - utils/wxPython/modules/html/test/helpsys.py | 73 - utils/wxPython/modules/html/test/htmlhelp.py | 19 - utils/wxPython/modules/html/test/htmlview.py | 77 - .../wxPython/modules/html/test/htmlwidget.py | 97 - utils/wxPython/modules/lseditor/.cvsignore | 13 - utils/wxPython/modules/lseditor/BUGS | 6 - utils/wxPython/modules/lseditor/COPYING | 340 - utils/wxPython/modules/lseditor/README | 13 - utils/wxPython/modules/lseditor/build.cfg | 9 - utils/wxPython/modules/lseditor/config.h | 82 - utils/wxPython/modules/lseditor/controlarea.h | 262 - utils/wxPython/modules/lseditor/editorpl.h | 153 - utils/wxPython/modules/lseditor/finddlg.cpp | 146 - utils/wxPython/modules/lseditor/finddlg.h | 38 - .../wxPython/modules/lseditor/gtk/.cvsignore | 1 - .../modules/lseditor/gtk/lseditor.cpp | 1913 --- .../wxPython/modules/lseditor/gtk/lseditor.py | 189 - utils/wxPython/modules/lseditor/lseditor.i | 150 - utils/wxPython/modules/lseditor/lseditorc.def | 2 - .../wxPython/modules/lseditor/lseditorpl.cpp | 344 - utils/wxPython/modules/lseditor/lseditorpl.h | 133 - utils/wxPython/modules/lseditor/markup.cpp | 46 - utils/wxPython/modules/lseditor/markup.h | 51 - .../wxPython/modules/lseditor/msw/.cvsignore | 1 - .../modules/lseditor/msw/lseditor.cpp | 1866 --- .../wxPython/modules/lseditor/msw/lseditor.py | 189 - utils/wxPython/modules/lseditor/plugin.cpp | 58 - utils/wxPython/modules/lseditor/plugin.h | 98 - .../modules/lseditor/sourcepainter.cpp | 696 - .../wxPython/modules/lseditor/sourcepainter.h | 109 - utils/wxPython/modules/lseditor/tdefs.cpp | 4233 ----- utils/wxPython/modules/lseditor/tdefs.h | 903 -- .../wxPython/modules/lseditor/test/editor.py | 118 - utils/wxPython/modules/lseditor/wxsdefs.h | 374 - utils/wxPython/modules/lseditor/wxstlac.h | 659 - utils/wxPython/modules/lseditor/wxstldefs.h | 49 - utils/wxPython/modules/lseditor/wxstllst.h | 555 - utils/wxPython/modules/lseditor/wxstlvec.h | 857 - utils/wxPython/modules/ogl/build.cfg | 23 - utils/wxPython/modules/stubs/.cvsignore | 10 - utils/wxPython/modules/stubs/README | 21 - utils/wxPython/modules/stubs/gtk/.cvsignore | 1 - utils/wxPython/modules/stubs/msw/.cvsignore | 1 - utils/wxPython/modules/utils/.cvsignore | 7 - utils/wxPython/modules/utils/build.cfg | 5 - utils/wxPython/modules/utils/gtk/utils.cpp | 1336 -- utils/wxPython/modules/utils/gtk/utils.py | 111 - utils/wxPython/modules/utils/msw/utils.cpp | 1336 -- utils/wxPython/modules/utils/msw/utils.py | 111 - utils/wxPython/modules/utils/utils.i | 139 - utils/wxPython/modules/utils/utilsc.def | 2 - utils/wxPython/src/__version__.py | 1 - utils/wxPython/src/build.cfg | 123 - utils/wxPython/src/gtk/dummy | 0 utils/wxPython/src/gtk/windows2.cpp | 5544 ------- utils/wxPython/src/gtk/windows2.py | 600 - utils/wxPython/src/motif/dummy | 0 utils/wxPython/src/msw/dummy | 0 utils/wxPython/src/qt/dummy | 0 utils/wxPython/tests/paul.pyc | Bin 1091 -> 0 bytes wx-config.in | 2 +- wxBase.dsp | 16 +- wxBase.spec | 2 +- wxGTK.spec | 14 +- wxMotif.spec | 51 +- wxPython/.cvsignore | 2 + {utils/wxPython => wxPython}/BUILD.txt | 74 +- {utils/wxPython => wxPython}/CHANGES.txt | 95 +- {utils/wxPython => wxPython}/README.txt | 18 +- {utils/wxPython => wxPython}/buildall | 2 +- {utils/wxPython => wxPython}/buildall.bat | 2 +- .../modules => wxPython/contrib}/.cvsignore | 0 wxPython/contrib/README | 3 + .../modules => wxPython/contrib}/buildall.py | 4 +- .../contrib}/glcanvas/.cvsignore | 0 wxPython/contrib/glcanvas/build.cfg | 25 + .../contrib}/glcanvas/glcanvas.i | 2 +- .../contrib}/glcanvas/glcanvasc.def | 0 .../contrib}/glcanvas/gtk/.cvsignore | 0 .../contrib}/glcanvas/gtk/glcanvas.cpp | 28 +- .../contrib}/glcanvas/gtk/glcanvas.py | 2 +- .../contrib}/glcanvas/msw/.cvsignore | 0 .../contrib}/glcanvas/msw/glcanvas.cpp | 30 +- .../contrib}/glcanvas/msw/glcanvas.py | 2 +- .../contrib}/ogl/.cvsignore | 0 wxPython/contrib/ogl/README.txt | 7 + .../contrib}/ogl/_extras.py | 0 .../contrib}/ogl/_ogldefs.i | 0 wxPython/contrib/ogl/build.cfg | 52 + .../modules => wxPython/contrib}/ogl/ogl.cpp | 16 +- .../modules => wxPython/contrib}/ogl/ogl.i | 0 .../modules => wxPython/contrib}/ogl/ogl.py | 0 .../contrib}/ogl/oglbasic.cpp | 217 +- .../contrib}/ogl/oglbasic.i | 18 +- .../contrib}/ogl/oglbasic.py | 3 +- .../modules => wxPython/contrib}/ogl/oglc.def | 0 .../contrib}/ogl/oglcanvas.cpp | 41 +- .../contrib}/ogl/oglcanvas.i | 8 +- .../contrib}/ogl/oglcanvas.py | 6 +- .../contrib}/ogl/oglhelpers.cpp | 0 .../contrib}/ogl/oglhelpers.h | 0 .../contrib}/ogl/oglshapes.cpp | 167 +- .../contrib}/ogl/oglshapes.i | 28 +- .../contrib}/ogl/oglshapes.py | 14 +- .../contrib}/ogl/oglshapes2.cpp | 81 +- .../contrib}/ogl/oglshapes2.i | 20 +- .../contrib}/ogl/oglshapes2.py | 10 +- wxPython/contrib/stc/.cvsignore | 5 + wxPython/contrib/stc/README.txt | 7 + wxPython/contrib/stc/_stcextras.py | 3 + wxPython/contrib/stc/build.cfg | 83 + wxPython/contrib/stc/stc.py | 7 + wxPython/contrib/stc/stc_.cpp | 8083 ++++++++++ wxPython/contrib/stc/stc_.i | 102 + wxPython/contrib/stc/stc_.py | 1086 ++ {utils/wxPython => wxPython}/demo/.cvsignore | 0 {utils/wxPython => wxPython}/demo/About.py | 0 wxPython/demo/ActiveXWrapper_Acrobat.py | 130 + wxPython/demo/ActiveXWrapper_IE.py | 205 + .../wxPython => wxPython}/demo/ColorPanel.py | 0 .../demo/CustomDragAndDrop.py | 22 +- .../wxPython => wxPython}/demo/DialogUnits.py | 1 + .../wxPython => wxPython}/demo/DragAndDrop.py | 0 wxPython/demo/FileBrowseButton.py | 47 + .../demo/FontEnumerator.py | 0 .../demo/GenericButtons.py | 0 wxPython/demo/GridCustTable.py | 153 + wxPython/demo/GridEnterHandler.py | 62 + wxPython/demo/GridHugeTable.py | 71 + wxPython/demo/GridSimple.py | 153 + wxPython/demo/GridStdEdRend.py | 181 + {utils/wxPython => wxPython}/demo/Layoutf.py | 0 {utils/wxPython => wxPython}/demo/MDIDemo.py | 3 +- {utils/wxPython => wxPython}/demo/Main.py | 332 +- .../wxPython => wxPython}/demo/OldSizers.py | 3 + .../demo/PrintFramework.py | 0 {utils/wxPython => wxPython}/demo/PyShell.py | 0 wxPython/demo/PyShellWindow.py | 15 + .../demo/PythonEvents.py | 0 {utils/wxPython => wxPython}/demo/README.txt | 0 {utils/wxPython => wxPython}/demo/Sizers.py | 2 + {utils/wxPython => wxPython}/demo/SlashDot.py | 2 + {utils/wxPython => wxPython}/demo/Threads.py | 4 + .../wxPython => wxPython}/demo/XMLtreeview.py | 0 .../demo/bitmaps/.cvsignore | 0 wxPython/demo/bitmaps/01c.gif | Bin 0 -> 545 bytes wxPython/demo/bitmaps/10s.gif | Bin 0 -> 990 bytes wxPython/demo/bitmaps/12h.gif | Bin 0 -> 2770 bytes wxPython/demo/bitmaps/13d.gif | Bin 0 -> 2800 bytes .../demo/bitmaps/Calend.bmp | Bin .../demo/bitmaps/DbDec.bmp | Bin .../demo/bitmaps/DbInc.bmp | Bin .../demo/bitmaps/Dec.bmp | Bin .../demo/bitmaps/Inc.bmp | Bin .../wxPython => wxPython}/demo/bitmaps/Pt.bmp | Bin wxPython/demo/bitmaps/backgrnd.png | Bin 0 -> 16672 bytes .../tests => wxPython/demo}/bitmaps/copy.bmp | Bin .../demo/bitmaps/image.bmp | Bin .../demo/bitmaps/image.gif | Bin .../demo/bitmaps/image.jpg | Bin .../demo/bitmaps/image.png | Bin .../demo/bitmaps/lb1.bmp | Bin .../demo/bitmaps/lb2.bmp | Bin .../demo}/bitmaps/mondrian.ico | Bin .../tests => wxPython/demo}/bitmaps/new.bmp | Bin .../demo/bitmaps/open.bmp | Bin .../tests => wxPython/demo}/bitmaps/paste.bmp | Bin .../demo/bitmaps/smiles.bmp | Bin .../demo/bitmaps/smiles.ico | Bin .../demo/bitmaps/splash.gif | Bin .../demo/bitmaps/test2.bmp | Bin .../demo/bitmaps/test_image.png | Bin .../demo/bitmaps/test_mask.bmp | Bin .../demo/bitmaps/tog1.bmp | Bin .../demo/bitmaps/tog2.bmp | Bin wxPython/demo/data/.cvsignore | 2 + wxPython/demo/data/grid.i | 1749 ++ .../demo/data/imagemap.htm | 0 .../demo/data/imagemap.png | Bin .../wxPython => wxPython}/demo/data/pic.png | Bin .../wxPython => wxPython}/demo/data/pic2.bmp | Bin wxPython/demo/data/stc.h | 627 + .../demo/data/tables.htm | 0 .../wxPython => wxPython}/demo/data/test.htm | 0 wxPython/demo/data/tips.txt | 7 + .../demo/data/widgetTest.htm | 0 {utils/wxPython => wxPython}/demo/demo.py | 0 .../demo/demoMainLoop.py | 0 {utils/wxPython => wxPython}/demo/hangman.py | 3 + {utils/wxPython => wxPython}/demo/paper.xml | 0 {utils/wxPython => wxPython}/demo/pyTree.py | 0 {utils/wxPython => wxPython}/demo/quotes.xml | 0 wxPython/demo/redemo.py | 25 + {utils/wxPython => wxPython}/demo/run.py | 10 +- wxPython/demo/viewer.py | 96 + wxPython/demo/viewer_basics.py | 61 + .../wxPython => wxPython}/demo/widgetTest.py | 0 {utils/wxPython => wxPython}/demo/wxButton.py | 0 .../wxPython => wxPython}/demo/wxCalendar.py | 317 +- wxPython/demo/wxCalendarCtrl.py | 40 + .../wxPython => wxPython}/demo/wxCheckBox.py | 0 .../demo/wxCheckListBox.py | 0 {utils/wxPython => wxPython}/demo/wxChoice.py | 0 .../demo/wxColourDialog.py | 0 .../wxPython => wxPython}/demo/wxComboBox.py | 4 + {utils/wxPython => wxPython}/demo/wxDialog.py | 0 .../wxPython => wxPython}/demo/wxDirDialog.py | 0 wxPython/demo/wxDragImage.py | 249 + {utils/wxPython => wxPython}/demo/wxEditor.py | 0 .../demo/wxFileDialog.py | 5 +- .../wxPython => wxPython}/demo/wxFloatBar.py | 1 + .../demo/wxFontDialog.py | 0 {utils/wxPython => wxPython}/demo/wxFrame.py | 2 + .../wxPython => wxPython}/demo/wxGLCanvas.py | 4 + {utils/wxPython => wxPython}/demo/wxGauge.py | 0 wxPython/demo/wxGrid.py | 100 + .../demo/wxHtmlWindow.py | 0 {utils/wxPython => wxPython}/demo/wxImage.py | 0 .../demo/wxLayoutConstraints.py | 0 .../wxPython => wxPython}/demo/wxListBox.py | 0 .../wxPython => wxPython}/demo/wxListCtrl.py | 3 +- .../wxPython => wxPython}/demo/wxMVCTree.py | 0 {utils/wxPython => wxPython}/demo/wxMask.py | 3 +- .../demo/wxMessageDialog.py | 0 .../wxPython => wxPython}/demo/wxMiniFrame.py | 1 + .../demo/wxMultipleChoiceDialog.py | 0 .../wxPython => wxPython}/demo/wxNotebook.py | 4 +- {utils/wxPython => wxPython}/demo/wxOGL.py | 4 + .../demo/wxPageSetupDialog.py | 0 .../demo/wxPlotCanvas.py | 0 .../demo/wxPrintDialog.py | 0 .../demo/wxProgressDialog.py | 0 .../wxPython => wxPython}/demo/wxRadioBox.py | 0 .../demo/wxSashWindow.py | 1 + .../demo/wxScrolledMessageDialog.py | 0 .../demo/wxScrolledWindow.py | 10 +- .../demo/wxSingleChoiceDialog.py | 0 {utils/wxPython => wxPython}/demo/wxSlider.py | 0 .../demo/wxSpinButton.py | 0 wxPython/demo/wxSpinCtrl.py | 37 + .../demo/wxSplitterWindow.py | 0 .../demo/wxStaticBitmap.py | 0 .../demo/wxStaticText.py | 0 .../wxPython => wxPython}/demo/wxStatusBar.py | 2 + wxPython/demo/wxStyledTextCtrl_1.py | 186 + wxPython/demo/wxStyledTextCtrl_2.py | 298 + .../wxPython => wxPython}/demo/wxTextCtrl.py | 6 +- .../demo/wxTextEntryDialog.py | 0 {utils/wxPython => wxPython}/demo/wxTimer.py | 0 .../wxPython => wxPython}/demo/wxToolBar.py | 1 + .../wxPython => wxPython}/demo/wxTreeCtrl.py | 44 +- .../demo/wxVTKRenderWindow.py | 0 .../wxPython => wxPython}/demo/wxValidator.py | 0 .../wxPython => wxPython}/distrib/.cvsignore | 1 - wxPython/distrib/.rpmrc | 5 + wxPython/distrib/README.dbg.txt | 20 + .../distrib/autobuild.py | 95 +- {utils/wxPython => wxPython}/distrib/build.py | 125 +- wxPython/distrib/makedbg.bat | 14 + wxPython/distrib/makedev.bat | 41 + wxPython/distrib/makerpm | 47 + wxPython/distrib/maketgz | 62 + .../wxPython => wxPython}/distrib/makexferzip | 0 .../distrib/makexferzip.bat | 0 {utils/wxPython => wxPython}/distrib/wise.aut | 2 +- wxPython/distrib/wxPython.WSM | Bin 0 -> 33 bytes .../distrib/wxPython.bmp | Bin wxPython/distrib/wxPython.rsp | 102 + wxPython/distrib/wxPython.spec | 101 + .../distrib/wxPython.wse | 92 +- wxPython/distrib/zipit.bat | 43 + {utils/wxPython => wxPython}/src/.cvsignore | 1 + {utils/wxPython => wxPython}/src/__init__.py | 0 wxPython/src/__version__.py | 1 + wxPython/src/_calextras.py | 4 + {utils/wxPython => wxPython}/src/_defs.i | 6 + {utils/wxPython => wxPython}/src/_extras.py | 126 +- wxPython/src/_gridextras.py | 19 + .../_extras.py => wxPython/src/_htmlextras.py | 0 wxPython/src/build.cfg | 153 + wxPython/src/calendar.i | 231 + {utils/wxPython => wxPython}/src/clip_dnd.i | 44 +- {utils/wxPython => wxPython}/src/cmndlgs.i | 40 +- {utils/wxPython => wxPython}/src/controls.i | 55 +- {utils/wxPython => wxPython}/src/controls2.i | 187 +- {utils/wxPython => wxPython}/src/events.i | 17 +- {utils/wxPython => wxPython}/src/frames.i | 28 +- {utils/wxPython => wxPython}/src/gdi.i | 35 +- wxPython/src/grid.i | 1751 ++ .../wxPython => wxPython}/src/gtk/.cvsignore | 0 wxPython/src/gtk/calendar.cpp | 2037 +++ wxPython/src/gtk/calendar.py | 244 + .../src/gtk/clip_dnd.cpp | 113 +- .../wxPython => wxPython}/src/gtk/clip_dnd.py | 14 +- .../wxPython => wxPython}/src/gtk/cmndlgs.cpp | 131 +- .../wxPython => wxPython}/src/gtk/cmndlgs.py | 20 +- .../src/gtk/controls.cpp | 235 +- .../src/msw => wxPython/src/gtk}/controls.py | 55 +- .../msw => wxPython/src/gtk}/controls2.cpp | 3299 ++-- .../src/msw => wxPython/src/gtk}/controls2.py | 243 +- .../wxPython => wxPython}/src/gtk/events.cpp | 188 +- .../src/msw => wxPython/src/gtk}/events.py | 29 +- .../src/msw => wxPython/src/gtk}/frames.cpp | 266 +- .../src/msw => wxPython/src/gtk}/frames.py | 36 +- {utils/wxPython => wxPython}/src/gtk/gdi.cpp | 473 +- {utils/wxPython => wxPython}/src/gtk/gdi.py | 35 + wxPython/src/gtk/grid.cpp | 13331 +++++++++++++++ wxPython/src/gtk/grid.py | 1509 ++ .../html => wxPython/src/gtk}/html.cpp | 243 +- .../modules/html => wxPython/src/gtk}/html.py | 10 +- .../html => wxPython/src/gtk}/htmlhelp.cpp | 52 +- .../html => wxPython/src/gtk}/htmlhelp.py | 0 .../wxPython => wxPython}/src/gtk/image.cpp | 269 +- {utils/wxPython => wxPython}/src/gtk/image.py | 26 + {utils/wxPython => wxPython}/src/gtk/mdi.cpp | 6 +- {utils/wxPython => wxPython}/src/gtk/mdi.py | 8 +- .../src/msw => wxPython/src/gtk}/misc.cpp | 288 +- {utils/wxPython => wxPython}/src/gtk/misc.py | 44 +- .../wxPython => wxPython}/src/gtk/misc2.cpp | 2997 +++- .../src/msw => wxPython/src/gtk}/misc2.py | 324 +- .../wxPython => wxPython}/src/gtk/printfw.cpp | 19 +- .../wxPython => wxPython}/src/gtk/printfw.py | 8 +- .../wxPython => wxPython}/src/gtk/sizers.cpp | 1327 +- .../wxPython => wxPython}/src/gtk/sizers.py | 175 +- .../src/gtk/stattool.cpp | 6 +- .../src/msw => wxPython/src/gtk}/stattool.py | 6 +- wxPython/src/gtk/utils.cpp | 7520 +++++++++ wxPython/src/gtk/utils.py | 953 ++ .../src/msw => wxPython/src/gtk}/windows.cpp | 298 +- .../wxPython => wxPython}/src/gtk/windows.py | 67 +- wxPython/src/gtk/windows2.cpp | 2098 +++ wxPython/src/gtk/windows2.py | 221 + .../src/gtk/windows3.cpp | 12 +- .../src/msw => wxPython/src/gtk}/windows3.py | 8 +- .../src/msw => wxPython/src/gtk}/wx.cpp | 175 +- .../src/msw => wxPython/src/gtk}/wx.py | 130 +- {utils/wxPython => wxPython}/src/helpers.cpp | 109 +- {utils/wxPython => wxPython}/src/helpers.h | 109 +- .../modules/html => wxPython/src}/html.i | 52 +- .../modules/html => wxPython/src}/htmlhelp.i | 90 - {utils/wxPython => wxPython}/src/image.i | 17 +- {utils/wxPython => wxPython}/src/libpy.c | 0 {utils/wxPython => wxPython}/src/mdi.i | 8 +- {utils/wxPython => wxPython}/src/misc.i | 53 +- {utils/wxPython => wxPython}/src/misc2.i | 245 +- .../wxPython => wxPython}/src/msw/.cvsignore | 0 wxPython/src/msw/calendar.cpp | 2041 +++ wxPython/src/msw/calendar.py | 244 + .../src/msw/clip_dnd.cpp | 117 +- .../wxPython => wxPython}/src/msw/clip_dnd.py | 14 +- .../wxPython => wxPython}/src/msw/cmndlgs.cpp | 137 +- .../wxPython => wxPython}/src/msw/cmndlgs.py | 20 +- .../src/msw/controls.cpp | 239 +- .../src/gtk => wxPython/src/msw}/controls.py | 55 +- .../gtk => wxPython/src/msw}/controls2.cpp | 3294 +++- .../src/gtk => wxPython/src/msw}/controls2.py | 243 +- .../wxPython => wxPython}/src/msw/events.cpp | 190 +- .../src/gtk => wxPython/src/msw}/events.py | 29 +- .../src/gtk => wxPython/src/msw}/frames.cpp | 265 +- .../src/gtk => wxPython/src/msw}/frames.py | 36 +- {utils/wxPython => wxPython}/src/msw/gdi.cpp | 564 +- {utils/wxPython => wxPython}/src/msw/gdi.py | 44 +- wxPython/src/msw/grid.cpp | 13333 ++++++++++++++++ wxPython/src/msw/grid.py | 1509 ++ wxPython/src/msw/html.cpp | 6230 ++++++++ wxPython/src/msw/html.py | 743 + wxPython/src/msw/htmlhelp.cpp | 3188 ++++ wxPython/src/msw/htmlhelp.py | 356 + .../wxPython => wxPython}/src/msw/image.cpp | 273 +- {utils/wxPython => wxPython}/src/msw/image.py | 26 + {utils/wxPython => wxPython}/src/msw/mdi.cpp | 12 +- {utils/wxPython => wxPython}/src/msw/mdi.py | 8 +- .../src/gtk => wxPython/src/msw}/misc.cpp | 288 +- {utils/wxPython => wxPython}/src/msw/misc.py | 44 +- .../wxPython => wxPython}/src/msw/misc2.cpp | 3001 +++- .../src/gtk => wxPython/src/msw}/misc2.py | 324 +- .../wxPython => wxPython}/src/msw/printfw.cpp | 25 +- .../wxPython => wxPython}/src/msw/printfw.py | 8 +- .../wxPython => wxPython}/src/msw/sizers.cpp | 1333 +- .../wxPython => wxPython}/src/msw/sizers.py | 175 +- .../src/msw/stattool.cpp | 12 +- .../src/gtk => wxPython/src/msw}/stattool.py | 6 +- wxPython/src/msw/utils.cpp | 7520 +++++++++ wxPython/src/msw/utils.py | 953 ++ .../src/gtk => wxPython/src/msw}/windows.cpp | 294 +- .../wxPython => wxPython}/src/msw/windows.py | 67 +- .../src/msw/windows2.cpp | 19 +- .../wxPython => wxPython}/src/msw/windows2.py | 9 +- .../src/msw/windows3.cpp | 12 +- .../src/gtk => wxPython/src/msw}/windows3.py | 8 +- .../src/gtk => wxPython/src/msw}/wx.cpp | 179 +- .../src/gtk => wxPython/src/msw}/wx.py | 138 +- .../wxPython => wxPython}/src/my_typemaps.i | 10 + {utils/wxPython => wxPython}/src/printfw.h | 0 {utils/wxPython => wxPython}/src/printfw.i | 10 +- {utils/wxPython => wxPython}/src/sizers.i | 110 +- {utils/wxPython => wxPython}/src/stattool.i | 8 +- wxPython/src/utils.i | 1037 ++ {utils/wxPython => wxPython}/src/windows.i | 96 +- {utils/wxPython => wxPython}/src/windows2.i | 42 +- {utils/wxPython => wxPython}/src/windows3.i | 8 +- {utils/wxPython => wxPython}/src/wx.i | 16 +- {utils/wxPython => wxPython}/src/wxc.def | 0 {utils/wxPython => wxPython}/src/wxc.rc | 2 +- {utils/wxPython => wxPython}/src/wxp.ico | Bin {utils/wxPython => wxPython}/tests/.cvsignore | 0 {utils/wxPython => wxPython}/tests/README.txt | 0 .../wxPython => wxPython}/tests/TstLstIcon.py | 0 {utils/wxPython => wxPython}/tests/atom.bmp | Bin wxPython/tests/bitmaps/copy.bmp | Bin 0 -> 238 bytes wxPython/tests/bitmaps/mondrian.ico | Bin 0 -> 766 bytes wxPython/tests/bitmaps/new.bmp | Bin 0 -> 238 bytes .../tests/bitmaps/open.bmp | Bin wxPython/tests/bitmaps/paste.bmp | Bin 0 -> 238 bytes .../tests/bitmaps/smiles.bmp | Bin .../tests/bitmaps/smiles.ico | Bin .../tests/bitmaps/test2.bmp | Bin .../tests/bitmaps/tog1.bmp | Bin .../tests/bitmaps/tog2.bmp | Bin {utils/wxPython => wxPython}/tests/blit.py | 0 .../wxPython => wxPython}/tests/getvalues.py | 0 {utils/wxPython => wxPython}/tests/grid.py | 0 {utils/wxPython => wxPython}/tests/hangman.py | 0 {utils/wxPython => wxPython}/tests/hook.py | 0 {utils/wxPython => wxPython}/tests/info.bmp | Bin {utils/wxPython => wxPython}/tests/leave.py | 0 .../tests/listGetItem.py | 0 {utils/wxPython => wxPython}/tests/memleak.py | 0 wxPython/tests/og.py | 69 + {utils/wxPython => wxPython}/tests/paul.py | 0 {utils/wxPython => wxPython}/tests/popup.py | 0 {utils/wxPython => wxPython}/tests/pytree.py | 0 {utils/wxPython => wxPython}/tests/query.bmp | Bin .../tests/scroll_paint.py | 0 {utils/wxPython => wxPython}/tests/spies.py | 0 {utils/wxPython => wxPython}/tests/spies2.py | 0 {utils/wxPython => wxPython}/tests/ste.py | 0 {utils/wxPython => wxPython}/tests/table.bmp | Bin {utils/wxPython => wxPython}/tests/tabs.py | 0 {utils/wxPython => wxPython}/tests/test1.py | 0 {utils/wxPython => wxPython}/tests/test2.py | 11 + {utils/wxPython => wxPython}/tests/test3.py | 11 + {utils/wxPython => wxPython}/tests/test4.py | 11 + {utils/wxPython => wxPython}/tests/test5.py | 0 {utils/wxPython => wxPython}/tests/test6.py | 0 {utils/wxPython => wxPython}/tests/test7.py | 0 {utils/wxPython => wxPython}/tests/test8.py | 0 {utils/wxPython => wxPython}/tests/testDlg.py | 0 .../wxPython => wxPython}/tests/testTree.py | 0 {utils/wxPython => wxPython}/tests/testi.py | 0 {utils/wxPython => wxPython}/tests/thrtest.py | 0 {utils/wxPython => wxPython}/tests/thtest.py | 0 {utils/wxPython => wxPython}/tests/txml.py | 0 {utils/wxPython => wxPython}/tests/val.py | 0 .../tests/wxPlotCanvas.py | 0 {utils/wxPython => wxPython}/tests/wxSlash.py | 0 {utils/wxPython => wxPython}/tests/zigron.py | 0 wxPython/wxPython/.cvsignore | 3 + {utils => wxPython}/wxPython/lib/.cvsignore | 0 {utils => wxPython}/wxPython/lib/CDate.py | 0 {utils => wxPython}/wxPython/lib/__init__.py | 0 wxPython/wxPython/lib/activexwrapper.py | 140 + {utils => wxPython}/wxPython/lib/buttons.py | 22 +- {utils => wxPython}/wxPython/lib/calendar.py | 310 +- {utils => wxPython}/wxPython/lib/dialogs.py | 1 + .../wxPython/lib/editor/.cvsignore | 0 .../wxPython/lib/editor/README.txt | 0 .../wxPython/lib/editor/__init__.py | 0 .../wxPython/lib/editor/editor.py | 2 + .../wxPython/lib/editor/py_editor.py | 0 .../wxPython/lib/editor/tokenizer.py | 0 wxPython/wxPython/lib/filebrowsebutton.py | 404 + {utils => wxPython}/wxPython/lib/floatbar.py | 2 +- {utils => wxPython}/wxPython/lib/grids.py | 22 +- {utils => wxPython}/wxPython/lib/layoutf.py | 1 + {utils => wxPython}/wxPython/lib/mvctree.py | 3 + wxPython/wxPython/lib/pyshell.py | 324 + {utils => wxPython}/wxPython/lib/shell.py | 4 +- .../wxPython/lib/sizers/.cvsignore | 0 .../wxPython/lib/sizers/__init__.py | 0 .../wxPython/lib/sizers/border.py | 0 .../wxPython/lib/sizers/box.py | 0 .../wxPython/lib/sizers/shape.py | 0 .../wxPython/lib/sizers/sizer.py | 0 .../wxPython/lib/splashscreen.py | 14 +- {utils => wxPython}/wxPython/lib/vtk.py | 3 + .../wxPython/lib/wxPlotCanvas.py | 3 +- {utils => wxPython}/wxPython/lib/wxpTag.py | 2 +- 1835 files changed, 239011 insertions(+), 69272 deletions(-) create mode 100644 contrib/include/wx/stc/SciLexer.h create mode 100644 contrib/samples/ogl/Makefile.in delete mode 100644 contrib/samples/ogl/ogledit/Makefile create mode 100644 contrib/samples/ogl/ogledit/Makefile.in delete mode 100644 contrib/samples/ogl/studio/Makefile create mode 100644 contrib/samples/ogl/studio/Makefile.in create mode 100644 contrib/src/stc/scintilla/include/WindowAccessor.h create mode 100644 contrib/src/stc/scintilla/src/DocumentAccessor.cxx create mode 100644 contrib/src/stc/scintilla/src/DocumentAccessor.h create mode 100644 contrib/src/stc/scintilla/src/LexCPP.cxx create mode 100644 contrib/src/stc/scintilla/src/LexHTML.cxx create mode 100644 contrib/src/stc/scintilla/src/LexOthers.cxx create mode 100644 contrib/src/stc/scintilla/src/LexPerl.cxx create mode 100644 contrib/src/stc/scintilla/src/LexPython.cxx create mode 100644 contrib/src/stc/scintilla/src/LexSQL.cxx create mode 100644 contrib/src/stc/scintilla/src/LexVB.cxx create mode 100644 contrib/src/stc/scintilla/src/UniConversion.cxx create mode 100644 contrib/src/stc/scintilla/src/UniConversion.h create mode 100644 contrib/src/stc/scintilla/src/WindowAccessor.cxx create mode 100644 debian/libwxbase-dbg.dirs create mode 100644 debian/libwxbase-dbg.docs create mode 100644 debian/libwxbase-dbg.links create mode 100644 debian/libwxbase-dbg.postinst create mode 100644 debian/libwxbase-dbg.prerm delete mode 100644 debian/libwxbase.files create mode 100644 debian/libwxgtk-contrib-dev.dirs create mode 100644 debian/libwxgtk-contrib-dev.docs create mode 100644 debian/libwxgtk-contrib-dev.files create mode 100644 debian/libwxgtk-contrib.dirs create mode 100644 debian/libwxgtk-contrib.docs create mode 100644 debian/libwxgtk-contrib.postinst create mode 100644 debian/libwxgtk-dbg.dirs create mode 100644 debian/libwxgtk-dbg.docs create mode 100644 debian/libwxgtk-dbg.links create mode 100644 debian/libwxgtk-dbg.postinst create mode 100644 debian/libwxgtk-dbg.prerm delete mode 100644 debian/libwxgtk.files create mode 100644 debian/wxwin-headers.dirs create mode 100644 debian/wxwin-headers.docs create mode 100644 debian/wxwin-headers.files create mode 100644 demos/life/bitmaps/info.bmp create mode 100644 demos/life/bitmaps/info.xpm create mode 100644 demos/life/bitmaps/open.bmp create mode 100644 demos/life/bitmaps/open.xpm create mode 100644 demos/life/breeder.lif create mode 100644 demos/life/reader.cpp create mode 100644 demos/life/reader.h create mode 100644 distrib/msw/extradoc.rsp create mode 100644 distrib/msw/tarwxmotif create mode 100644 distrib/msw/tmake/vc6bdll.t create mode 100644 distrib/msw/tmake/vcapp.t create mode 100644 distrib/msw/wx_chm.rsp create mode 100644 distrib/msw/wx_htb.rsp delete mode 100644 docs/html/gettext/gettext.htm create mode 100644 docs/html/gettext/gettext_1.html create mode 100644 docs/html/gettext/gettext_10.html create mode 100644 docs/html/gettext/gettext_11.html create mode 100644 docs/html/gettext/gettext_12.html create mode 100644 docs/html/gettext/gettext_2.html create mode 100644 docs/html/gettext/gettext_3.html create mode 100644 docs/html/gettext/gettext_4.html create mode 100644 docs/html/gettext/gettext_5.html create mode 100644 docs/html/gettext/gettext_6.html create mode 100644 docs/html/gettext/gettext_7.html create mode 100644 docs/html/gettext/gettext_8.html create mode 100644 docs/html/gettext/gettext_9.html create mode 100644 docs/html/gettext/gettext_foot.html create mode 100644 docs/html/gettext/gettext_toc.html create mode 100644 docs/html/gettext/index.html delete mode 100644 docs/html/gettext/msgfmt.htm delete mode 100644 docs/html/gettext/xgettext.htm create mode 100644 docs/latex/wx/caret.tex create mode 100644 docs/latex/wx/cmdlpars.tex create mode 100644 docs/latex/wx/csconv.tex create mode 100644 docs/latex/wx/datespan.tex create mode 100644 docs/latex/wx/db.tex create mode 100644 docs/latex/wx/dialevt.tex create mode 100644 docs/latex/wx/dialup.tex create mode 100644 docs/latex/wx/dllload.tex create mode 100644 docs/latex/wx/flexsizr.tex create mode 100644 docs/latex/wx/gridsizr.tex create mode 100644 docs/latex/wx/mbcnvfil.tex create mode 100644 docs/latex/wx/mbcnvut7.tex create mode 100644 docs/latex/wx/mbcnvut8.tex create mode 100644 docs/latex/wx/mbconv.tex create mode 100644 docs/latex/wx/spinevt.tex create mode 100644 docs/latex/wx/table.tex create mode 100644 docs/latex/wx/timespan.tex create mode 100644 docs/latex/wx/tmbconv.tex create mode 100644 docs/latex/wx/tooltip.tex create mode 100644 docs/latex/wx/wizard.tex create mode 100644 docs/latex/wx/wizevt.tex create mode 100644 docs/latex/wx/wizpage.tex delete mode 100644 docs/msw/mingw32.txt create mode 100644 docs/tech/tn0004.htm create mode 100644 docs/tech/tn0005.txt create mode 100644 docs/tech/tn0006.txt rename docs/{msw/bc_ide.txt => tech/tn0007.txt} (58%) create mode 100644 docs/tech/tn0008.htm create mode 100644 docs/tech/tn0009.htm create mode 100644 docs/tech/tn0010.htm create mode 100644 include/wx/fontenc.h create mode 100644 include/wx/msw/helpchm.h create mode 100644 include/wx/stc/SciLexer.h rename lib/{wx214.def => wx22.def} (98%) create mode 100644 locale/.cvsignore create mode 100644 locale/da.po delete mode 100644 locale/dk.po create mode 100644 locale/fr.po create mode 100644 samples/dnd/dnd_copy.cur create mode 100644 samples/dnd/dnd_copy.xpm create mode 100644 samples/dnd/dnd_move.cur create mode 100644 samples/dnd/dnd_move.xpm create mode 100644 samples/dnd/dnd_none.cur create mode 100644 samples/dnd/dnd_none.xpm create mode 100644 samples/help/doc.chm create mode 100644 samples/help/doc.hhc create mode 100644 samples/help/doc.hhk create mode 100644 samples/help/doc.hhp create mode 100644 samples/minimal/minimal.rc4 rename src/jpeg/{jpeg.dsp => JpegVC.dsp} (100%) rename src/jpeg/{jpeg.dsw => JpegVC.dsw} (90%) create mode 100644 src/msw/helpchm.cpp create mode 100644 src/msw/version.rc rename src/png/{png.dsp => PngVC.dsp} (92%) rename src/{tiff/tiff.dsw => png/PngVC.dsw} (90%) create mode 100644 src/stc/scintilla/include/WindowAccessor.h create mode 100644 src/stc/scintilla/src/DocumentAccessor.cxx create mode 100644 src/stc/scintilla/src/DocumentAccessor.h create mode 100644 src/stc/scintilla/src/LexCPP.cxx create mode 100644 src/stc/scintilla/src/LexHTML.cxx create mode 100644 src/stc/scintilla/src/LexOthers.cxx create mode 100644 src/stc/scintilla/src/LexPerl.cxx create mode 100644 src/stc/scintilla/src/LexPython.cxx create mode 100644 src/stc/scintilla/src/LexSQL.cxx create mode 100644 src/stc/scintilla/src/LexVB.cxx create mode 100644 src/stc/scintilla/src/UniConversion.cxx create mode 100644 src/stc/scintilla/src/UniConversion.h create mode 100644 src/stc/scintilla/src/WindowAccessor.cxx rename src/tiff/{tiff.dsp => TiffVC.dsp} (100%) rename src/{png/png.dsw => tiff/TiffVC.dsw} (90%) create mode 100644 src/tiff/makefile.wat rename src/xpm/{attrib.c => Attrib.c} (99%) rename src/xpm/{crbuffri.c => CrBufFrI.c} (100%) rename src/xpm/{crdatfri.c => CrDatFrI.c} (100%) rename src/xpm/{crifrbuf.c => CrIFrBuf.c} (100%) rename src/xpm/{crifrdat.c => CrIFrDat.c} (100%) rename src/xpm/{image.c => Image.c} (100%) rename src/xpm/{info.c => Info.c} (100%) rename src/xpm/{rdftodat.c => RdFToDat.c} (100%) rename src/xpm/{rdftoi.c => RdFToI.c} (100%) rename src/xpm/{wrffrdat.c => WrFFrDat.c} (100%) rename src/xpm/{wrffri.c => WrFFrI.c} (100%) rename src/xpm/{xpmi.h => XpmI.h} (100%) create mode 100644 src/xpm/XpmVC.dsp rename src/xpm/{xpm.dsw => XpmVC.dsw} (90%) rename src/zlib/{zlib.dsp => ZlibVC.dsp} (100%) create mode 100644 src/zlib/ZlibVC.dsw delete mode 100644 src/zlib/zlib.dsw rename utils/{wxPython/demo => Install/builder}/bitmaps/copy.bmp (100%) create mode 100644 utils/Install/builder/bitmaps/copy.xpm create mode 100644 utils/Install/builder/bitmaps/cut.bmp create mode 100644 utils/Install/builder/bitmaps/cut.xpm create mode 100644 utils/Install/builder/bitmaps/help.bmp create mode 100644 utils/Install/builder/bitmaps/help.xpm rename utils/{wxPython/demo => Install/builder}/bitmaps/new.bmp (100%) create mode 100644 utils/Install/builder/bitmaps/new.xpm create mode 100644 utils/Install/builder/bitmaps/open.bmp create mode 100644 utils/Install/builder/bitmaps/open.xpm create mode 100644 utils/Install/builder/bitmaps/page.bmp rename utils/{wxPython/demo => Install/builder}/bitmaps/paste.bmp (100%) create mode 100644 utils/Install/builder/bitmaps/preview.bmp create mode 100644 utils/Install/builder/bitmaps/preview.xpm create mode 100644 utils/Install/builder/bitmaps/print.bmp create mode 100644 utils/Install/builder/bitmaps/print.xpm create mode 100644 utils/Install/builder/bitmaps/save.bmp create mode 100644 utils/Install/builder/bitmaps/save.xpm create mode 100644 utils/Install/builder/makefile create mode 100644 utils/Install/builder/makefile.b32 create mode 100644 utils/Install/builder/makefile.bcc create mode 100644 utils/Install/builder/makefile.dos create mode 100644 utils/Install/builder/makefile.g95 create mode 100644 utils/Install/builder/makefile.sc create mode 100644 utils/Install/builder/makefile.sl create mode 100644 utils/Install/builder/makefile.twn create mode 100644 utils/Install/builder/makefile.unx create mode 100644 utils/Install/builder/makefile.vc create mode 100644 utils/Install/builder/makefile.wat rename utils/{wxPython/demo/bitmaps => Install/builder}/mondrian.ico (100%) create mode 100644 utils/Install/builder/mondrian.xpm create mode 100644 utils/Install/builder/wxib.cpp create mode 100644 utils/Install/builder/wxib.def create mode 100644 utils/Install/builder/wxib.rc create mode 100644 utils/Install/builder/wxibVC.dsp create mode 100644 utils/Install/builder/wxibvc.dsw create mode 100644 utils/Install/incace/acestruc.h create mode 100644 utils/Install/incace/attribs.h create mode 100644 utils/Install/incace/declare.h create mode 100644 utils/Install/incace/globals.h create mode 100644 utils/Install/incace/os.h create mode 100644 utils/Install/incace/portable.h create mode 100644 utils/Install/incace/uac_comm.h create mode 100644 utils/Install/incace/uac_crc.h create mode 100644 utils/Install/incace/uac_crt.h create mode 100644 utils/Install/incace/uac_dcpr.h create mode 100644 utils/Install/incace/uac_sys.h create mode 100644 utils/Install/incace/unace.h create mode 100644 utils/Install/inczip/consts.h create mode 100644 utils/Install/inczip/crypt.h create mode 100644 utils/Install/inczip/ebcdic.h create mode 100644 utils/Install/inczip/globals.h create mode 100644 utils/Install/inczip/inflate.h create mode 100644 utils/Install/inczip/nt.h create mode 100644 utils/Install/inczip/os2acl.h create mode 100644 utils/Install/inczip/os2cfg.h create mode 100644 utils/Install/inczip/os2data.h create mode 100644 utils/Install/inczip/rsxntwin.h create mode 100644 utils/Install/inczip/tables.h create mode 100644 utils/Install/inczip/ttyio.h create mode 100644 utils/Install/inczip/unzip.h create mode 100644 utils/Install/inczip/unzpriv.h create mode 100644 utils/Install/inczip/version.h create mode 100644 utils/Install/inczip/w32cfg.h create mode 100644 utils/Install/inczip/zip.h create mode 100644 utils/Install/install.c create mode 100644 utils/Install/install.h create mode 100644 utils/Install/instsup.cpp create mode 100644 utils/Install/instsup.h create mode 100644 utils/Install/packace/globals.c create mode 100644 utils/Install/packace/makefile create mode 100644 utils/Install/packace/makefile.b32 create mode 100644 utils/Install/packace/makefile.g95 create mode 100644 utils/Install/packace/makefile.gcc create mode 100644 utils/Install/packace/uac_comm.c create mode 100644 utils/Install/packace/uac_crc.c create mode 100644 utils/Install/packace/uac_crt.c create mode 100644 utils/Install/packace/uac_dcpr.c create mode 100644 utils/Install/packace/uac_sys.c create mode 100644 utils/Install/packace/unace.c create mode 100644 utils/Install/packzip/api.c create mode 100644 utils/Install/packzip/apihelp.c create mode 100644 utils/Install/packzip/crc32.c create mode 100644 utils/Install/packzip/crc_i386.S create mode 100644 utils/Install/packzip/crc_i386.asm create mode 100644 utils/Install/packzip/crc_i386.c create mode 100644 utils/Install/packzip/crc_lcc.asm create mode 100644 utils/Install/packzip/crctab.c create mode 100644 utils/Install/packzip/crypt.c create mode 100644 utils/Install/packzip/envargs.c create mode 100644 utils/Install/packzip/explode.c create mode 100644 utils/Install/packzip/extract.c create mode 100644 utils/Install/packzip/fileio.c create mode 100644 utils/Install/packzip/funzip.c create mode 100644 utils/Install/packzip/globals.c create mode 100644 utils/Install/packzip/inflate.c create mode 100644 utils/Install/packzip/list.c create mode 100644 utils/Install/packzip/makefile create mode 100644 utils/Install/packzip/makefile.b32 create mode 100644 utils/Install/packzip/makefile.g95 create mode 100644 utils/Install/packzip/makefile.gcc create mode 100644 utils/Install/packzip/makefile.os2 create mode 100644 utils/Install/packzip/match.c create mode 100644 utils/Install/packzip/nt.c create mode 100644 utils/Install/packzip/os2.c create mode 100644 utils/Install/packzip/os2acl.c create mode 100644 utils/Install/packzip/process.c create mode 100644 utils/Install/packzip/rexxapi.c create mode 100644 utils/Install/packzip/rexxapi.def create mode 100644 utils/Install/packzip/rexxhelp.c create mode 100644 utils/Install/packzip/stub.def create mode 100644 utils/Install/packzip/ttyio.c create mode 100644 utils/Install/packzip/unix.c create mode 100644 utils/Install/packzip/unreduce.c create mode 100644 utils/Install/packzip/unshrink.c create mode 100644 utils/Install/packzip/unzip.c create mode 100644 utils/Install/packzip/unzip.def create mode 100644 utils/Install/packzip/unzipstb.c create mode 100644 utils/Install/packzip/win32.c create mode 100644 utils/Install/packzip/zipinfo.c create mode 100644 utils/Install/script/finished.ini create mode 100644 utils/Install/script/finished.wxr create mode 100644 utils/Install/script/install.bmp create mode 100644 utils/Install/script/install.xpm create mode 100644 utils/Install/script/license.txt create mode 100644 utils/Install/script/nocheck.ini create mode 100644 utils/Install/script/page1.ini create mode 100644 utils/Install/script/page1.wxr create mode 100644 utils/Install/script/page2.ini create mode 100644 utils/Install/script/page2.wxr create mode 100644 utils/Install/script/page3.ini create mode 100644 utils/Install/script/page3.wxr create mode 100644 utils/Install/script/page4.ini create mode 100644 utils/Install/script/page4.wxr create mode 100644 utils/Install/script/readme.ini create mode 100644 utils/Install/script/readme.txt create mode 100644 utils/Install/script/wxinst.cfg create mode 100644 utils/Install/sfxace/globals.c create mode 100644 utils/Install/sfxace/install.PRJ create mode 100644 utils/Install/sfxace/install.def create mode 100644 utils/Install/sfxace/install.rc create mode 100644 utils/Install/sfxace/makefile create mode 100644 utils/Install/sfxace/makefile.b32 create mode 100644 utils/Install/sfxace/makefile.g95 create mode 100644 utils/Install/sfxace/makefile.gcc create mode 100644 utils/Install/sfxace/sfx.RES create mode 100644 utils/Install/sfxace/sfx.rc create mode 100644 utils/Install/sfxace/uac_comm.c create mode 100644 utils/Install/sfxace/uac_crc.c create mode 100644 utils/Install/sfxace/uac_crt.c create mode 100644 utils/Install/sfxace/uac_dcpr.c create mode 100644 utils/Install/sfxace/uac_sys.c create mode 100644 utils/Install/sfxace/unace.c create mode 100644 utils/Install/sfxzip/api.c create mode 100644 utils/Install/sfxzip/apihelp.c create mode 100644 utils/Install/sfxzip/crc32.c create mode 100644 utils/Install/sfxzip/crc_i386.S create mode 100644 utils/Install/sfxzip/crc_i386.asm create mode 100644 utils/Install/sfxzip/crc_i386.c create mode 100644 utils/Install/sfxzip/crc_lcc.asm create mode 100644 utils/Install/sfxzip/crctab.c create mode 100644 utils/Install/sfxzip/crypt.c create mode 100644 utils/Install/sfxzip/envargs.c create mode 100644 utils/Install/sfxzip/explode.c create mode 100644 utils/Install/sfxzip/extract.c create mode 100644 utils/Install/sfxzip/fileio.c create mode 100644 utils/Install/sfxzip/funzip.c create mode 100644 utils/Install/sfxzip/globals.c create mode 100644 utils/Install/sfxzip/inflate.c create mode 100644 utils/Install/sfxzip/list.c create mode 100644 utils/Install/sfxzip/makefile create mode 100644 utils/Install/sfxzip/makefile.b32 create mode 100644 utils/Install/sfxzip/makefile.g95 create mode 100644 utils/Install/sfxzip/makefile.gcc create mode 100644 utils/Install/sfxzip/makefile.os2 create mode 100644 utils/Install/sfxzip/match.c create mode 100644 utils/Install/sfxzip/nt.c create mode 100644 utils/Install/sfxzip/os2.c create mode 100644 utils/Install/sfxzip/os2acl.c create mode 100644 utils/Install/sfxzip/process.c create mode 100644 utils/Install/sfxzip/rexxapi.c create mode 100644 utils/Install/sfxzip/rexxhelp.c create mode 100644 utils/Install/sfxzip/sfx.RES create mode 100644 utils/Install/sfxzip/sfx.rc create mode 100644 utils/Install/sfxzip/ttyio.c create mode 100644 utils/Install/sfxzip/unix.c create mode 100644 utils/Install/sfxzip/unreduce.c create mode 100644 utils/Install/sfxzip/unshrink.c create mode 100644 utils/Install/sfxzip/unzip.c create mode 100644 utils/Install/sfxzip/unzipstb.c create mode 100644 utils/Install/sfxzip/win32.c create mode 100644 utils/Install/sfxzip/zipinfo.c create mode 100644 utils/Install/wxmain.cpp create mode 100644 utils/dialoged/docs/copyhght.bmp create mode 100644 utils/dialoged/docs/copyhght.gif create mode 100644 utils/dialoged/docs/copywdth.bmp create mode 100644 utils/dialoged/docs/copywdth.gif create mode 100644 utils/dialoged/docs/disthor.bmp create mode 100644 utils/dialoged/docs/disthor.gif create mode 100644 utils/dialoged/docs/distvert.bmp create mode 100644 utils/dialoged/docs/distvert.gif create mode 100644 utils/dialoged/src/bitmaps/copyhght.bmp create mode 100644 utils/dialoged/src/bitmaps/copyhght.xpm create mode 100644 utils/dialoged/src/bitmaps/copywdth.bmp create mode 100644 utils/dialoged/src/bitmaps/copywdth.xpm create mode 100644 utils/dialoged/src/bitmaps/disthor.bmp create mode 100644 utils/dialoged/src/bitmaps/disthor.xpm create mode 100644 utils/dialoged/src/bitmaps/distvert.bmp create mode 100644 utils/dialoged/src/bitmaps/distvert.xpm delete mode 100644 utils/wxPython/.cvsignore delete mode 100644 utils/wxPython/Makefile delete mode 100644 utils/wxPython/SWIG.patches/Include.patch delete mode 100644 utils/wxPython/SWIG.patches/Modules.patch delete mode 100644 utils/wxPython/SWIG.patches/SWIG.patch delete mode 100644 utils/wxPython/demo/FileBrowseButton.py delete mode 100644 utils/wxPython/demo/wxGrid.py delete mode 100644 utils/wxPython/distrib/.rpmrc delete mode 100755 utils/wxPython/distrib/makerpm delete mode 100755 utils/wxPython/distrib/maketgz delete mode 100644 utils/wxPython/distrib/wxPython.rsp delete mode 100644 utils/wxPython/distrib/wxPython.spec.in delete mode 100644 utils/wxPython/distrib/wxPython.wsm delete mode 100755 utils/wxPython/distrib/zipit.bat delete mode 100644 utils/wxPython/lib/filebrowsebutton.py delete mode 100644 utils/wxPython/modules/README delete mode 100644 utils/wxPython/modules/glcanvas/build.cfg delete mode 100644 utils/wxPython/modules/html/.cvsignore delete mode 100644 utils/wxPython/modules/html/BUGS delete mode 100644 utils/wxPython/modules/html/README delete mode 100644 utils/wxPython/modules/html/build.cfg delete mode 100644 utils/wxPython/modules/html/helpsys.cpp delete mode 100644 utils/wxPython/modules/html/helpsys.h delete mode 100644 utils/wxPython/modules/html/htmlc.def delete mode 100644 utils/wxPython/modules/html/htmlhelper.py delete mode 100644 utils/wxPython/modules/html/test/helpsys.py delete mode 100644 utils/wxPython/modules/html/test/htmlhelp.py delete mode 100644 utils/wxPython/modules/html/test/htmlview.py delete mode 100644 utils/wxPython/modules/html/test/htmlwidget.py delete mode 100644 utils/wxPython/modules/lseditor/.cvsignore delete mode 100644 utils/wxPython/modules/lseditor/BUGS delete mode 100644 utils/wxPython/modules/lseditor/COPYING delete mode 100644 utils/wxPython/modules/lseditor/README delete mode 100644 utils/wxPython/modules/lseditor/build.cfg delete mode 100644 utils/wxPython/modules/lseditor/config.h delete mode 100644 utils/wxPython/modules/lseditor/controlarea.h delete mode 100644 utils/wxPython/modules/lseditor/editorpl.h delete mode 100644 utils/wxPython/modules/lseditor/finddlg.cpp delete mode 100644 utils/wxPython/modules/lseditor/finddlg.h delete mode 100644 utils/wxPython/modules/lseditor/gtk/.cvsignore delete mode 100644 utils/wxPython/modules/lseditor/gtk/lseditor.cpp delete mode 100644 utils/wxPython/modules/lseditor/gtk/lseditor.py delete mode 100644 utils/wxPython/modules/lseditor/lseditor.i delete mode 100644 utils/wxPython/modules/lseditor/lseditorc.def delete mode 100644 utils/wxPython/modules/lseditor/lseditorpl.cpp delete mode 100644 utils/wxPython/modules/lseditor/lseditorpl.h delete mode 100644 utils/wxPython/modules/lseditor/markup.cpp delete mode 100644 utils/wxPython/modules/lseditor/markup.h delete mode 100644 utils/wxPython/modules/lseditor/msw/.cvsignore delete mode 100644 utils/wxPython/modules/lseditor/msw/lseditor.cpp delete mode 100644 utils/wxPython/modules/lseditor/msw/lseditor.py delete mode 100644 utils/wxPython/modules/lseditor/plugin.cpp delete mode 100644 utils/wxPython/modules/lseditor/plugin.h delete mode 100644 utils/wxPython/modules/lseditor/sourcepainter.cpp delete mode 100644 utils/wxPython/modules/lseditor/sourcepainter.h delete mode 100644 utils/wxPython/modules/lseditor/tdefs.cpp delete mode 100644 utils/wxPython/modules/lseditor/tdefs.h delete mode 100644 utils/wxPython/modules/lseditor/test/editor.py delete mode 100644 utils/wxPython/modules/lseditor/wxsdefs.h delete mode 100644 utils/wxPython/modules/lseditor/wxstlac.h delete mode 100644 utils/wxPython/modules/lseditor/wxstldefs.h delete mode 100644 utils/wxPython/modules/lseditor/wxstllst.h delete mode 100644 utils/wxPython/modules/lseditor/wxstlvec.h delete mode 100644 utils/wxPython/modules/ogl/build.cfg delete mode 100644 utils/wxPython/modules/stubs/.cvsignore delete mode 100644 utils/wxPython/modules/stubs/README delete mode 100644 utils/wxPython/modules/stubs/gtk/.cvsignore delete mode 100644 utils/wxPython/modules/stubs/msw/.cvsignore delete mode 100644 utils/wxPython/modules/utils/.cvsignore delete mode 100644 utils/wxPython/modules/utils/build.cfg delete mode 100644 utils/wxPython/modules/utils/gtk/utils.cpp delete mode 100644 utils/wxPython/modules/utils/gtk/utils.py delete mode 100644 utils/wxPython/modules/utils/msw/utils.cpp delete mode 100644 utils/wxPython/modules/utils/msw/utils.py delete mode 100644 utils/wxPython/modules/utils/utils.i delete mode 100644 utils/wxPython/modules/utils/utilsc.def delete mode 100644 utils/wxPython/src/__version__.py delete mode 100644 utils/wxPython/src/build.cfg delete mode 100644 utils/wxPython/src/gtk/dummy delete mode 100644 utils/wxPython/src/gtk/windows2.cpp delete mode 100644 utils/wxPython/src/gtk/windows2.py delete mode 100644 utils/wxPython/src/motif/dummy delete mode 100644 utils/wxPython/src/msw/dummy delete mode 100644 utils/wxPython/src/qt/dummy delete mode 100644 utils/wxPython/tests/paul.pyc create mode 100644 wxPython/.cvsignore rename {utils/wxPython => wxPython}/BUILD.txt (67%) rename {utils/wxPython => wxPython}/CHANGES.txt (86%) rename {utils/wxPython => wxPython}/README.txt (74%) rename {utils/wxPython => wxPython}/buildall (89%) rename {utils/wxPython => wxPython}/buildall.bat (89%) rename {utils/wxPython/modules => wxPython/contrib}/.cvsignore (100%) create mode 100644 wxPython/contrib/README rename {utils/wxPython/modules => wxPython/contrib}/buildall.py (90%) rename {utils/wxPython/modules => wxPython/contrib}/glcanvas/.cvsignore (100%) create mode 100644 wxPython/contrib/glcanvas/build.cfg rename {utils/wxPython/modules => wxPython/contrib}/glcanvas/glcanvas.i (97%) rename {utils/wxPython/modules => wxPython/contrib}/glcanvas/glcanvasc.def (100%) rename {utils/wxPython/modules => wxPython/contrib}/glcanvas/gtk/.cvsignore (100%) rename {utils/wxPython/modules => wxPython/contrib}/glcanvas/gtk/glcanvas.cpp (97%) rename {utils/wxPython/modules => wxPython/contrib}/glcanvas/gtk/glcanvas.py (98%) rename {utils/wxPython/modules => wxPython/contrib}/glcanvas/msw/.cvsignore (100%) rename {utils/wxPython/modules => wxPython/contrib}/glcanvas/msw/glcanvas.cpp (97%) rename {utils/wxPython/modules => wxPython/contrib}/glcanvas/msw/glcanvas.py (98%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/.cvsignore (100%) create mode 100644 wxPython/contrib/ogl/README.txt rename {utils/wxPython/modules => wxPython/contrib}/ogl/_extras.py (100%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/_ogldefs.i (100%) create mode 100644 wxPython/contrib/ogl/build.cfg rename {utils/wxPython/modules => wxPython/contrib}/ogl/ogl.cpp (97%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/ogl.i (100%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/ogl.py (100%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglbasic.cpp (98%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglbasic.i (96%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglbasic.py (99%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglc.def (100%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglcanvas.cpp (98%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglcanvas.i (94%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglcanvas.py (98%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglhelpers.cpp (100%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglhelpers.h (100%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglshapes.cpp (99%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglshapes.i (96%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglshapes.py (99%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglshapes2.cpp (99%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglshapes2.i (96%) rename {utils/wxPython/modules => wxPython/contrib}/ogl/oglshapes2.py (99%) create mode 100644 wxPython/contrib/stc/.cvsignore create mode 100644 wxPython/contrib/stc/README.txt create mode 100644 wxPython/contrib/stc/_stcextras.py create mode 100644 wxPython/contrib/stc/build.cfg create mode 100644 wxPython/contrib/stc/stc.py create mode 100644 wxPython/contrib/stc/stc_.cpp create mode 100644 wxPython/contrib/stc/stc_.i create mode 100644 wxPython/contrib/stc/stc_.py rename {utils/wxPython => wxPython}/demo/.cvsignore (100%) rename {utils/wxPython => wxPython}/demo/About.py (100%) create mode 100644 wxPython/demo/ActiveXWrapper_Acrobat.py create mode 100644 wxPython/demo/ActiveXWrapper_IE.py rename {utils/wxPython => wxPython}/demo/ColorPanel.py (100%) rename {utils/wxPython => wxPython}/demo/CustomDragAndDrop.py (94%) rename {utils/wxPython => wxPython}/demo/DialogUnits.py (98%) rename {utils/wxPython => wxPython}/demo/DragAndDrop.py (100%) create mode 100644 wxPython/demo/FileBrowseButton.py rename {utils/wxPython => wxPython}/demo/FontEnumerator.py (100%) rename {utils/wxPython => wxPython}/demo/GenericButtons.py (100%) create mode 100644 wxPython/demo/GridCustTable.py create mode 100644 wxPython/demo/GridEnterHandler.py create mode 100644 wxPython/demo/GridHugeTable.py create mode 100644 wxPython/demo/GridSimple.py create mode 100644 wxPython/demo/GridStdEdRend.py rename {utils/wxPython => wxPython}/demo/Layoutf.py (100%) rename {utils/wxPython => wxPython}/demo/MDIDemo.py (94%) rename {utils/wxPython => wxPython}/demo/Main.py (52%) rename {utils/wxPython => wxPython}/demo/OldSizers.py (98%) rename {utils/wxPython => wxPython}/demo/PrintFramework.py (100%) rename {utils/wxPython => wxPython}/demo/PyShell.py (100%) create mode 100644 wxPython/demo/PyShellWindow.py rename {utils/wxPython => wxPython}/demo/PythonEvents.py (100%) rename {utils/wxPython => wxPython}/demo/README.txt (100%) rename {utils/wxPython => wxPython}/demo/Sizers.py (99%) rename {utils/wxPython => wxPython}/demo/SlashDot.py (99%) rename {utils/wxPython => wxPython}/demo/Threads.py (98%) rename {utils/wxPython => wxPython}/demo/XMLtreeview.py (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/.cvsignore (100%) create mode 100644 wxPython/demo/bitmaps/01c.gif create mode 100644 wxPython/demo/bitmaps/10s.gif create mode 100644 wxPython/demo/bitmaps/12h.gif create mode 100644 wxPython/demo/bitmaps/13d.gif rename {utils/wxPython => wxPython}/demo/bitmaps/Calend.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/DbDec.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/DbInc.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/Dec.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/Inc.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/Pt.bmp (100%) create mode 100644 wxPython/demo/bitmaps/backgrnd.png rename {utils/wxPython/tests => wxPython/demo}/bitmaps/copy.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/image.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/image.gif (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/image.jpg (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/image.png (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/lb1.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/lb2.bmp (100%) rename {utils/wxPython/tests => wxPython/demo}/bitmaps/mondrian.ico (100%) rename {utils/wxPython/tests => wxPython/demo}/bitmaps/new.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/open.bmp (100%) rename {utils/wxPython/tests => wxPython/demo}/bitmaps/paste.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/smiles.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/smiles.ico (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/splash.gif (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/test2.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/test_image.png (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/test_mask.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/tog1.bmp (100%) rename {utils/wxPython => wxPython}/demo/bitmaps/tog2.bmp (100%) create mode 100644 wxPython/demo/data/.cvsignore create mode 100644 wxPython/demo/data/grid.i rename {utils/wxPython => wxPython}/demo/data/imagemap.htm (100%) rename {utils/wxPython => wxPython}/demo/data/imagemap.png (100%) rename {utils/wxPython => wxPython}/demo/data/pic.png (100%) rename {utils/wxPython => wxPython}/demo/data/pic2.bmp (100%) create mode 100644 wxPython/demo/data/stc.h rename {utils/wxPython => wxPython}/demo/data/tables.htm (100%) rename {utils/wxPython => wxPython}/demo/data/test.htm (100%) create mode 100644 wxPython/demo/data/tips.txt rename {utils/wxPython => wxPython}/demo/data/widgetTest.htm (100%) rename {utils/wxPython => wxPython}/demo/demo.py (100%) rename {utils/wxPython => wxPython}/demo/demoMainLoop.py (100%) rename {utils/wxPython => wxPython}/demo/hangman.py (99%) rename {utils/wxPython => wxPython}/demo/paper.xml (100%) rename {utils/wxPython => wxPython}/demo/pyTree.py (100%) rename {utils/wxPython => wxPython}/demo/quotes.xml (100%) create mode 100644 wxPython/demo/redemo.py rename {utils/wxPython => wxPython}/demo/run.py (91%) mode change 100644 => 100755 create mode 100644 wxPython/demo/viewer.py create mode 100644 wxPython/demo/viewer_basics.py rename {utils/wxPython => wxPython}/demo/widgetTest.py (100%) rename {utils/wxPython => wxPython}/demo/wxButton.py (100%) rename {utils/wxPython => wxPython}/demo/wxCalendar.py (57%) create mode 100644 wxPython/demo/wxCalendarCtrl.py rename {utils/wxPython => wxPython}/demo/wxCheckBox.py (100%) rename {utils/wxPython => wxPython}/demo/wxCheckListBox.py (100%) rename {utils/wxPython => wxPython}/demo/wxChoice.py (100%) rename {utils/wxPython => wxPython}/demo/wxColourDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxComboBox.py (94%) rename {utils/wxPython => wxPython}/demo/wxDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxDirDialog.py (100%) create mode 100644 wxPython/demo/wxDragImage.py rename {utils/wxPython => wxPython}/demo/wxEditor.py (100%) rename {utils/wxPython => wxPython}/demo/wxFileDialog.py (92%) rename {utils/wxPython => wxPython}/demo/wxFloatBar.py (98%) rename {utils/wxPython => wxPython}/demo/wxFontDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxFrame.py (95%) rename {utils/wxPython => wxPython}/demo/wxGLCanvas.py (97%) rename {utils/wxPython => wxPython}/demo/wxGauge.py (100%) create mode 100644 wxPython/demo/wxGrid.py rename {utils/wxPython => wxPython}/demo/wxHtmlWindow.py (100%) rename {utils/wxPython => wxPython}/demo/wxImage.py (100%) rename {utils/wxPython => wxPython}/demo/wxLayoutConstraints.py (100%) rename {utils/wxPython => wxPython}/demo/wxListBox.py (100%) rename {utils/wxPython => wxPython}/demo/wxListCtrl.py (99%) rename {utils/wxPython => wxPython}/demo/wxMVCTree.py (100%) rename {utils/wxPython => wxPython}/demo/wxMask.py (97%) rename {utils/wxPython => wxPython}/demo/wxMessageDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxMiniFrame.py (95%) rename {utils/wxPython => wxPython}/demo/wxMultipleChoiceDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxNotebook.py (97%) rename {utils/wxPython => wxPython}/demo/wxOGL.py (98%) rename {utils/wxPython => wxPython}/demo/wxPageSetupDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxPlotCanvas.py (100%) rename {utils/wxPython => wxPython}/demo/wxPrintDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxProgressDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxRadioBox.py (100%) rename {utils/wxPython => wxPython}/demo/wxSashWindow.py (99%) rename {utils/wxPython => wxPython}/demo/wxScrolledMessageDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxScrolledWindow.py (94%) rename {utils/wxPython => wxPython}/demo/wxSingleChoiceDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxSlider.py (100%) rename {utils/wxPython => wxPython}/demo/wxSpinButton.py (100%) create mode 100644 wxPython/demo/wxSpinCtrl.py rename {utils/wxPython => wxPython}/demo/wxSplitterWindow.py (100%) rename {utils/wxPython => wxPython}/demo/wxStaticBitmap.py (100%) rename {utils/wxPython => wxPython}/demo/wxStaticText.py (100%) rename {utils/wxPython => wxPython}/demo/wxStatusBar.py (97%) create mode 100644 wxPython/demo/wxStyledTextCtrl_1.py create mode 100644 wxPython/demo/wxStyledTextCtrl_2.py rename {utils/wxPython => wxPython}/demo/wxTextCtrl.py (78%) rename {utils/wxPython => wxPython}/demo/wxTextEntryDialog.py (100%) rename {utils/wxPython => wxPython}/demo/wxTimer.py (100%) rename {utils/wxPython => wxPython}/demo/wxToolBar.py (98%) rename {utils/wxPython => wxPython}/demo/wxTreeCtrl.py (77%) rename {utils/wxPython => wxPython}/demo/wxVTKRenderWindow.py (100%) rename {utils/wxPython => wxPython}/demo/wxValidator.py (100%) rename {utils/wxPython => wxPython}/distrib/.cvsignore (76%) create mode 100644 wxPython/distrib/.rpmrc create mode 100644 wxPython/distrib/README.dbg.txt rename {utils/wxPython => wxPython}/distrib/autobuild.py (52%) mode change 100644 => 100755 rename {utils/wxPython => wxPython}/distrib/build.py (89%) create mode 100755 wxPython/distrib/makedbg.bat create mode 100755 wxPython/distrib/makedev.bat create mode 100755 wxPython/distrib/makerpm create mode 100755 wxPython/distrib/maketgz rename {utils/wxPython => wxPython}/distrib/makexferzip (100%) rename {utils/wxPython => wxPython}/distrib/makexferzip.bat (100%) rename {utils/wxPython => wxPython}/distrib/wise.aut (75%) create mode 100644 wxPython/distrib/wxPython.WSM rename {utils/wxPython => wxPython}/distrib/wxPython.bmp (100%) create mode 100644 wxPython/distrib/wxPython.rsp create mode 100644 wxPython/distrib/wxPython.spec rename {utils/wxPython => wxPython}/distrib/wxPython.wse (95%) create mode 100755 wxPython/distrib/zipit.bat rename {utils/wxPython => wxPython}/src/.cvsignore (93%) rename {utils/wxPython => wxPython}/src/__init__.py (100%) create mode 100644 wxPython/src/__version__.py create mode 100644 wxPython/src/_calextras.py rename {utils/wxPython => wxPython}/src/_defs.i (99%) rename {utils/wxPython => wxPython}/src/_extras.py (89%) create mode 100644 wxPython/src/_gridextras.py rename utils/wxPython/modules/html/_extras.py => wxPython/src/_htmlextras.py (100%) create mode 100644 wxPython/src/build.cfg create mode 100644 wxPython/src/calendar.i rename {utils/wxPython => wxPython}/src/clip_dnd.i (93%) rename {utils/wxPython => wxPython}/src/cmndlgs.i (82%) rename {utils/wxPython => wxPython}/src/controls.i (90%) rename {utils/wxPython => wxPython}/src/controls2.i (78%) rename {utils/wxPython => wxPython}/src/events.i (96%) rename {utils/wxPython => wxPython}/src/frames.i (81%) rename {utils/wxPython => wxPython}/src/gdi.i (95%) create mode 100644 wxPython/src/grid.i rename {utils/wxPython => wxPython}/src/gtk/.cvsignore (100%) create mode 100644 wxPython/src/gtk/calendar.cpp create mode 100644 wxPython/src/gtk/calendar.py rename {utils/wxPython => wxPython}/src/gtk/clip_dnd.cpp (97%) rename {utils/wxPython => wxPython}/src/gtk/clip_dnd.py (98%) rename {utils/wxPython => wxPython}/src/gtk/cmndlgs.cpp (97%) rename {utils/wxPython => wxPython}/src/gtk/cmndlgs.py (95%) rename {utils/wxPython => wxPython}/src/gtk/controls.cpp (97%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/controls.py (95%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/controls2.cpp (76%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/controls2.py (77%) rename {utils/wxPython => wxPython}/src/gtk/events.cpp (96%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/events.py (97%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/frames.cpp (86%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/frames.py (74%) rename {utils/wxPython => wxPython}/src/gtk/gdi.cpp (96%) rename {utils/wxPython => wxPython}/src/gtk/gdi.py (96%) create mode 100644 wxPython/src/gtk/grid.cpp create mode 100644 wxPython/src/gtk/grid.py rename {utils/wxPython/modules/html => wxPython/src/gtk}/html.cpp (97%) rename {utils/wxPython/modules/html => wxPython/src/gtk}/html.py (99%) rename {utils/wxPython/modules/html => wxPython/src/gtk}/htmlhelp.cpp (98%) rename {utils/wxPython/modules/html => wxPython/src/gtk}/htmlhelp.py (100%) rename {utils/wxPython => wxPython}/src/gtk/image.cpp (87%) rename {utils/wxPython => wxPython}/src/gtk/image.py (88%) rename {utils/wxPython => wxPython}/src/gtk/mdi.cpp (99%) rename {utils/wxPython => wxPython}/src/gtk/mdi.py (95%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/misc.cpp (96%) rename {utils/wxPython => wxPython}/src/gtk/misc.py (96%) rename {utils/wxPython => wxPython}/src/gtk/misc2.cpp (54%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/misc2.py (53%) rename {utils/wxPython => wxPython}/src/gtk/printfw.cpp (99%) rename {utils/wxPython => wxPython}/src/gtk/printfw.py (99%) rename {utils/wxPython => wxPython}/src/gtk/sizers.cpp (57%) rename {utils/wxPython => wxPython}/src/gtk/sizers.py (54%) rename {utils/wxPython => wxPython}/src/gtk/stattool.cpp (99%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/stattool.py (99%) create mode 100644 wxPython/src/gtk/utils.cpp create mode 100644 wxPython/src/gtk/utils.py rename {utils/wxPython/src/msw => wxPython/src/gtk}/windows.cpp (98%) rename {utils/wxPython => wxPython}/src/gtk/windows.py (93%) create mode 100644 wxPython/src/gtk/windows2.cpp create mode 100644 wxPython/src/gtk/windows2.py rename {utils/wxPython => wxPython}/src/gtk/windows3.cpp (99%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/windows3.py (97%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/wx.cpp (97%) rename {utils/wxPython/src/msw => wxPython/src/gtk}/wx.py (94%) rename {utils/wxPython => wxPython}/src/helpers.cpp (90%) rename {utils/wxPython => wxPython}/src/helpers.h (90%) rename {utils/wxPython/modules/html => wxPython/src}/html.i (91%) rename {utils/wxPython/modules/html => wxPython/src}/htmlhelp.i (59%) rename {utils/wxPython => wxPython}/src/image.i (86%) rename {utils/wxPython => wxPython}/src/libpy.c (100%) rename {utils/wxPython => wxPython}/src/mdi.i (89%) rename {utils/wxPython => wxPython}/src/misc.i (93%) rename {utils/wxPython => wxPython}/src/misc2.i (61%) rename {utils/wxPython => wxPython}/src/msw/.cvsignore (100%) create mode 100644 wxPython/src/msw/calendar.cpp create mode 100644 wxPython/src/msw/calendar.py rename {utils/wxPython => wxPython}/src/msw/clip_dnd.cpp (97%) rename {utils/wxPython => wxPython}/src/msw/clip_dnd.py (98%) rename {utils/wxPython => wxPython}/src/msw/cmndlgs.cpp (97%) rename {utils/wxPython => wxPython}/src/msw/cmndlgs.py (95%) rename {utils/wxPython => wxPython}/src/msw/controls.cpp (97%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/controls.py (95%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/controls2.cpp (72%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/controls2.py (73%) rename {utils/wxPython => wxPython}/src/msw/events.cpp (96%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/events.py (97%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/frames.cpp (82%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/frames.py (70%) rename {utils/wxPython => wxPython}/src/msw/gdi.cpp (96%) rename {utils/wxPython => wxPython}/src/msw/gdi.py (96%) create mode 100644 wxPython/src/msw/grid.cpp create mode 100644 wxPython/src/msw/grid.py create mode 100644 wxPython/src/msw/html.cpp create mode 100644 wxPython/src/msw/html.py create mode 100644 wxPython/src/msw/htmlhelp.cpp create mode 100644 wxPython/src/msw/htmlhelp.py rename {utils/wxPython => wxPython}/src/msw/image.cpp (87%) rename {utils/wxPython => wxPython}/src/msw/image.py (88%) rename {utils/wxPython => wxPython}/src/msw/mdi.cpp (99%) rename {utils/wxPython => wxPython}/src/msw/mdi.py (95%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/misc.cpp (96%) rename {utils/wxPython => wxPython}/src/msw/misc.py (96%) rename {utils/wxPython => wxPython}/src/msw/misc2.cpp (54%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/misc2.py (53%) rename {utils/wxPython => wxPython}/src/msw/printfw.cpp (99%) rename {utils/wxPython => wxPython}/src/msw/printfw.py (99%) rename {utils/wxPython => wxPython}/src/msw/sizers.cpp (57%) rename {utils/wxPython => wxPython}/src/msw/sizers.py (54%) rename {utils/wxPython => wxPython}/src/msw/stattool.cpp (99%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/stattool.py (99%) create mode 100644 wxPython/src/msw/utils.cpp create mode 100644 wxPython/src/msw/utils.py rename {utils/wxPython/src/gtk => wxPython/src/msw}/windows.cpp (97%) rename {utils/wxPython => wxPython}/src/msw/windows.py (93%) rename {utils/wxPython => wxPython}/src/msw/windows2.cpp (99%) rename {utils/wxPython => wxPython}/src/msw/windows2.py (96%) rename {utils/wxPython => wxPython}/src/msw/windows3.cpp (99%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/windows3.py (97%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/wx.cpp (95%) rename {utils/wxPython/src/gtk => wxPython/src/msw}/wx.py (93%) rename {utils/wxPython => wxPython}/src/my_typemaps.i (93%) rename {utils/wxPython => wxPython}/src/printfw.h (100%) rename {utils/wxPython => wxPython}/src/printfw.i (96%) rename {utils/wxPython => wxPython}/src/sizers.i (66%) rename {utils/wxPython => wxPython}/src/stattool.i (97%) create mode 100644 wxPython/src/utils.i rename {utils/wxPython => wxPython}/src/windows.i (83%) rename {utils/wxPython => wxPython}/src/windows2.i (88%) rename {utils/wxPython => wxPython}/src/windows3.i (92%) rename {utils/wxPython => wxPython}/src/wx.i (90%) rename {utils/wxPython => wxPython}/src/wxc.def (100%) rename {utils/wxPython => wxPython}/src/wxc.rc (68%) rename {utils/wxPython => wxPython}/src/wxp.ico (100%) rename {utils/wxPython => wxPython}/tests/.cvsignore (100%) rename {utils/wxPython => wxPython}/tests/README.txt (100%) rename {utils/wxPython => wxPython}/tests/TstLstIcon.py (100%) rename {utils/wxPython => wxPython}/tests/atom.bmp (100%) create mode 100644 wxPython/tests/bitmaps/copy.bmp create mode 100644 wxPython/tests/bitmaps/mondrian.ico create mode 100644 wxPython/tests/bitmaps/new.bmp rename {utils/wxPython => wxPython}/tests/bitmaps/open.bmp (100%) create mode 100644 wxPython/tests/bitmaps/paste.bmp rename {utils/wxPython => wxPython}/tests/bitmaps/smiles.bmp (100%) rename {utils/wxPython => wxPython}/tests/bitmaps/smiles.ico (100%) rename {utils/wxPython => wxPython}/tests/bitmaps/test2.bmp (100%) rename {utils/wxPython => wxPython}/tests/bitmaps/tog1.bmp (100%) rename {utils/wxPython => wxPython}/tests/bitmaps/tog2.bmp (100%) rename {utils/wxPython => wxPython}/tests/blit.py (100%) rename {utils/wxPython => wxPython}/tests/getvalues.py (100%) rename {utils/wxPython => wxPython}/tests/grid.py (100%) rename {utils/wxPython => wxPython}/tests/hangman.py (100%) rename {utils/wxPython => wxPython}/tests/hook.py (100%) rename {utils/wxPython => wxPython}/tests/info.bmp (100%) rename {utils/wxPython => wxPython}/tests/leave.py (100%) rename {utils/wxPython => wxPython}/tests/listGetItem.py (100%) rename {utils/wxPython => wxPython}/tests/memleak.py (100%) create mode 100644 wxPython/tests/og.py rename {utils/wxPython => wxPython}/tests/paul.py (100%) rename {utils/wxPython => wxPython}/tests/popup.py (100%) rename {utils/wxPython => wxPython}/tests/pytree.py (100%) rename {utils/wxPython => wxPython}/tests/query.bmp (100%) rename {utils/wxPython => wxPython}/tests/scroll_paint.py (100%) rename {utils/wxPython => wxPython}/tests/spies.py (100%) rename {utils/wxPython => wxPython}/tests/spies2.py (100%) rename {utils/wxPython => wxPython}/tests/ste.py (100%) rename {utils/wxPython => wxPython}/tests/table.bmp (100%) rename {utils/wxPython => wxPython}/tests/tabs.py (100%) rename {utils/wxPython => wxPython}/tests/test1.py (100%) rename {utils/wxPython => wxPython}/tests/test2.py (95%) rename {utils/wxPython => wxPython}/tests/test3.py (96%) rename {utils/wxPython => wxPython}/tests/test4.py (99%) rename {utils/wxPython => wxPython}/tests/test5.py (100%) rename {utils/wxPython => wxPython}/tests/test6.py (100%) rename {utils/wxPython => wxPython}/tests/test7.py (100%) rename {utils/wxPython => wxPython}/tests/test8.py (100%) rename {utils/wxPython => wxPython}/tests/testDlg.py (100%) rename {utils/wxPython => wxPython}/tests/testTree.py (100%) rename {utils/wxPython => wxPython}/tests/testi.py (100%) rename {utils/wxPython => wxPython}/tests/thrtest.py (100%) rename {utils/wxPython => wxPython}/tests/thtest.py (100%) rename {utils/wxPython => wxPython}/tests/txml.py (100%) rename {utils/wxPython => wxPython}/tests/val.py (100%) rename {utils/wxPython => wxPython}/tests/wxPlotCanvas.py (100%) rename {utils/wxPython => wxPython}/tests/wxSlash.py (100%) rename {utils/wxPython => wxPython}/tests/zigron.py (100%) create mode 100644 wxPython/wxPython/.cvsignore rename {utils => wxPython}/wxPython/lib/.cvsignore (100%) rename {utils => wxPython}/wxPython/lib/CDate.py (100%) rename {utils => wxPython}/wxPython/lib/__init__.py (100%) create mode 100644 wxPython/wxPython/lib/activexwrapper.py rename {utils => wxPython}/wxPython/lib/buttons.py (95%) rename {utils => wxPython}/wxPython/lib/calendar.py (56%) rename {utils => wxPython}/wxPython/lib/dialogs.py (99%) rename {utils => wxPython}/wxPython/lib/editor/.cvsignore (100%) rename {utils => wxPython}/wxPython/lib/editor/README.txt (100%) rename {utils => wxPython}/wxPython/lib/editor/__init__.py (100%) rename {utils => wxPython}/wxPython/lib/editor/editor.py (99%) rename {utils => wxPython}/wxPython/lib/editor/py_editor.py (100%) rename {utils => wxPython}/wxPython/lib/editor/tokenizer.py (100%) create mode 100644 wxPython/wxPython/lib/filebrowsebutton.py rename {utils => wxPython}/wxPython/lib/floatbar.py (99%) rename {utils => wxPython}/wxPython/lib/grids.py (88%) rename {utils => wxPython}/wxPython/lib/layoutf.py (99%) rename {utils => wxPython}/wxPython/lib/mvctree.py (99%) create mode 100644 wxPython/wxPython/lib/pyshell.py rename {utils => wxPython}/wxPython/lib/shell.py (99%) rename {utils => wxPython}/wxPython/lib/sizers/.cvsignore (100%) rename {utils => wxPython}/wxPython/lib/sizers/__init__.py (100%) rename {utils => wxPython}/wxPython/lib/sizers/border.py (100%) rename {utils => wxPython}/wxPython/lib/sizers/box.py (100%) rename {utils => wxPython}/wxPython/lib/sizers/shape.py (100%) rename {utils => wxPython}/wxPython/lib/sizers/sizer.py (100%) rename {utils => wxPython}/wxPython/lib/splashscreen.py (94%) rename {utils => wxPython}/wxPython/lib/vtk.py (97%) rename {utils => wxPython}/wxPython/lib/wxPlotCanvas.py (99%) rename {utils => wxPython}/wxPython/lib/wxpTag.py (99%) diff --git a/BuildCVS.txt b/BuildCVS.txt index 75480522d0..7b90e3ad9d 100644 --- a/BuildCVS.txt +++ b/BuildCVS.txt @@ -16,45 +16,30 @@ varaibles and PATH entries. Continue with item c) below. -b) If using the GNU MinGW32 or GNU CygWin32 compilers +b) If using the GNU Mingw32 or GNU Cygwin32 compilers -You'll need the compiler itself which is available from +You can get Mingw32 from http://www.mingw.org - http://www.cygwin.com +Cygwin32 is available at http://www.cygwin.com -When using MingW32 you'll need GNU make which is a part -of the CygWin32 toolchain and is also available as a stand -alone port without the infamous Cygwin.dll from - - http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32 - -The makefile has small problems with Cygwin´s tools -so it is recommended not to use these (but MingGW32 -and its make.exe). +The makefile might have small problems with Cygwin's tools +so it is recommended to use Mingw32 and its toolchain instead +if possible. -> Set your path so that it includes the directory where your compiler and tools reside -b-2) Using Mingw32 with gcc-2.95 and Anders Norlander's - Win32 headers - -Using the newer gcc-2.95/Noralander header combination -will allow you to compile more of the MSW code, such -as OLE and Drag-n-Drop. - -Instructions are similar to those for Regular Mingw32 except - -->Get the compiler from - ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95/ - -->patch the gcc headers with info in wxWin\Mingw32-gcc295.patches. - PLEASE APPLY THESE PATCHES BY HAND! There are apparently a few - different versions of the headers floating around. - -->Edit wx/src/makeg95.env and set the MINGW32 variable at the top of - the file to either 1 (you have Mingw32) or 0 (you have Cygwin32). - If using MINGW32, also set the MINGW32VERSION variable - appropriately. +-> If your are using an old Mingw32 version (gcc-2.95 or older), + you might need to fix some headers with the patches contained + in the wxWin\Mingw32-gcc295.patches file. PLEASE APPLY THESE + PATCHES BY HAND! There are apparently a few different versions + of the headers floating around. Note that these patches are + not needed if you are using Mingw32 gcc-2.95.2 or newer. + +-> Edit wx/src/makeg95.env and set the MINGW32 variable at the top of + the file to either 1 (you have Mingw32) or 0 (you have Cygwin32). + If using MINGW32, also set the MINGW32VERSION variable + appropiately. c) Build instructions @@ -64,9 +49,9 @@ c) Build instructions -> Copy c:\wxWin\include\wx\msw\setup0.h to c:\wxWin\include\wx\msw\setup.h -> Edit c:\wxWin\include\wx\msw\setup.h so that - most features are enabled (i.e. defined to 1) with + most features are enabled (i.e. defined to 1), for example: #define wxUSE_ODBC 0 - #define wxUSE_SOCKETS 0 + #define wxUSE_SOCKETS 1 #define wxUSE_HTML 1 #define wxUSE_THREADS 1 #define wxUSE_FS_INET 0 @@ -77,14 +62,12 @@ c) Build instructions #define wxUSE_LIBJPEG 1 #define wxUSE_LIBPNG 1 - and iostreams ares disabled with + and std iostreams are disabled with #define wxUSE_STD_IOSTREAM 0 - - note: ODBC and SOCKETS can be 1 for gcc-2.95 - + -> type: cd c:\wxWin\src\msw -> type: make -f makefile.g95 (if using GNU tools) -or type: make -f makefile.vc (if using MS VC++) +or type: nmake -f makefile.vc (if using MS VC++) II) Unix ports diff --git a/Makefile.in b/Makefile.in index 32d3e0e95c..c9a8436f74 100644 --- a/Makefile.in +++ b/Makefile.in @@ -67,6 +67,8 @@ oldincludedir = /usr/include DESTDIR = +localedir = $(datadir)/locale + pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -123,18 +125,28 @@ DEMODIR = $(WXDIR)/demos UTILSDIR = $(WXDIR)/utils MISCDIR = $(WXDIR)/misc -DOCDIR = $(WXDIR)/docs +DOCDIR = $(WXDIR)/docs +INTLDIR = $(WXDIR)/locale ########################## Archive name ############################### -WXARCHIVE = @DISTDIR@-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tgz -WXGLARCHIVE = @DISTDIR@-gl-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tgz -WXSAMPLES = wx$(TOOLKIT)-samples-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tgz -WXDEMOS = wx$(TOOLKIT)-demos-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tgz +WXARCHIVE = @DISTDIR@-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tar.gz +WXGLARCHIVE = @DISTDIR@-gl-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tar.gz +WXSAMPLES = wx$(TOOLKIT)-samples-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tar.gz +WXDEMOS = wx$(TOOLKIT)-demos-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tar.gz + +WXARCHIVE_BZIP = @DISTDIR@-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tar.bz2 +WXGLARCHIVE_BZIP = @DISTDIR@-gl-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tar.bz2 +WXSAMPLES_BZIP = wx$(TOOLKIT)-samples-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tar.bz2 +WXDEMOS_BZIP = wx$(TOOLKIT)-demos-$(WX_MAJOR_VERSION_NUMBER).$(WX_MINOR_VERSION_NUMBER).$(WX_RELEASE_NUMBER).tar.bz2 + DISTDIR = ./_dist_dir/@DISTDIR@ + ############################## Files ################################## +WX_LINGUAS = `cd $(top_srcdir)/locale && ls *.mo 2> /dev/null | sed -n 's/\.mo//p'` + # this line will include a file which defines ALL_SOURCES, ALL_OBJECTS, # ALL_DEPFILES and ALL_HEADERS variables with the complete list of .cpp, .o, # .d and .h/.inl files for the current toolkit @@ -380,7 +392,7 @@ afminstall: preinstall # this is the real install target: copies the library, wx-config and the # headers to the installation directory -preinstall: $(top_builddir)/lib/@WX_TARGET_LIBRARY@ $(top_builddir)/wx@TOOLKIT_DIR@-config +preinstall: $(top_builddir)/lib/@WX_TARGET_LIBRARY@ $(top_builddir)/wx@TOOLKIT_NAME@-config @echo " " @echo " Installing wxWindows..." @echo " " @@ -389,15 +401,15 @@ preinstall: $(top_builddir)/lib/@WX_TARGET_LIBRARY@ $(top_builddir)/wx@TOOLKIT_D $(INSTALL) -d $(bindir) $(INSTALL) -d $(libdir) - $(INSTALL_SCRIPT) $(top_builddir)/wx@TOOLKIT_DIR@-config $(bindir)/wx@TOOLKIT_DIR@-config - cd $(bindir) && rm -f wx-config && $(LN_S) wx@TOOLKIT_DIR@-config wx-config + $(INSTALL_SCRIPT) $(top_builddir)/wx@TOOLKIT_NAME@-config $(bindir)/wx@TOOLKIT_NAME@-config + cd $(bindir) && rm -f wx-config && $(LN_S) wx@TOOLKIT_NAME@-config wx-config $(INSTALL_PROGRAM) $(top_builddir)/lib/@WX_TARGET_LIBRARY@ $(libdir)/@WX_TARGET_LIBRARY@ $(INSTALL) -d $(libdir)/wx $(INSTALL) -d $(libdir)/wx/include $(INSTALL) -d $(libdir)/wx/include/wx - $(INSTALL) -d $(libdir)/wx/include/wx/@TOOLKIT_DIR@ - $(INSTALL_DATA) $(top_builddir)/include/wx/@TOOLKIT_DIR@/setup.h $(libdir)/wx/include/wx/@TOOLKIT_DIR@/setup.h + $(INSTALL) -d $(libdir)/wx/include/wx/@TOOLKIT_NAME@ + $(INSTALL_DATA) $(top_builddir)/include/wx/@TOOLKIT_DIR@/setup.h $(libdir)/wx/include/wx/@TOOLKIT_NAME@/setup.h $(INSTALL) -d $(includedir)/wx @if test "$(USE_GUI)" = 1; then $(INSTALL) -d $(includedir)/wx/@TOOLKIT_DIR@; fi @@ -410,6 +422,14 @@ preinstall: $(top_builddir)/lib/@WX_TARGET_LIBRARY@ $(top_builddir)/wx@TOOLKIT_D echo "$(INSTALL_DATA) $(top_srcdir)/include/wx/$$p $(includedir)/wx/$$p"; \ done + $(INSTALL) -d $(localedir) + @for p in $(WX_LINGUAS); do \ + $(INSTALL) -d $(localedir)/$$p; \ + $(INSTALL) -d $(localedir)/$$p/LC_MESSAGES; \ + $(INSTALL_DATA) $(top_srcdir)/locale/$$p.mo $(localedir)/$$p/LC_MESSAGES/wxstd.mo; \ + echo "$(INSTALL_DATA) $(top_srcdir)/locale/$$p.mo $(localedir)/$$p/LC_MESSAGES/wxstd.mo"; \ + done + preinstall_gl: $(top_builddir)/lib/@WX_TARGET_LIBRARY_GL@ @echo " " @echo " Installing wxWindows OpenGl add-on..." @@ -445,9 +465,9 @@ uninstall: @$(RM) $(libdir)/@WX_LIBRARY_LINK2_GL@ @$(RM) $(libdir)/@WX_LIBRARY_LINK3_GL@ @echo " Removing helper files..." - @$(RM) $(libdir)/wx/include/wx/@TOOLKIT_DIR@/setup.h + @$(RM) $(libdir)/wx/include/wx/@TOOLKIT_NAME@/setup.h @$(RM) $(bindir)/wx-config - @$(RM) $(bindir)/wx@TOOLKIT_DIR@-config + @$(RM) $(bindir)/wx@TOOLKIT_NAME@-config @$(RM) $(datadir)/wx/afm/* @$(RM) $(datadir)/wx/gs_afm/* # FIXME: wxBase doesnt install these next 3 dirs. @@ -458,8 +478,15 @@ uninstall: @list='$(HEADERS)'; for p in $$list; do \ $(RM) $(includedir)/wx/$$p; \ done + @echo " Removing i18n files..." + @-for p in $(WX_LINGUAS); do \ + $(RM) $(localedir)/$$p/LC_MESSAGES/wxstd.mo; \ + rmdir $(localedir)/$$p/LC_MESSAGES; \ + rmdir $(localedir)/$$p; \ + done @echo " Removing directories..." - @if test -d $(libdir)/wx/include/wx/@TOOLKIT_DIR@; then rmdir $(libdir)/wx/include/wx/@TOOLKIT_DIR@; fi + @-rmdir $(localedir) + @if test -d $(libdir)/wx/include/wx/@TOOLKIT_NAME@; then rmdir $(libdir)/wx/include/wx/@TOOLKIT_NAME@; fi @if test -d $(libdir)/wx/include/wx; then rmdir $(libdir)/wx/include/wx; fi @if test -d $(libdir)/wx/include; then rmdir $(libdir)/wx/include; fi @if test -d $(libdir)/wx; then rmdir $(libdir)/wx; fi @@ -657,6 +684,7 @@ DEMOS_DIST: ALL_GUI_DIST cp $(DEMODIR)/life/*.h $(DISTDIR)/demos/life cp $(DEMODIR)/life/*.xpm $(DISTDIR)/demos/life cp $(DEMODIR)/life/*.inc $(DISTDIR)/demos/life + cp $(DEMODIR)/life/*.lif $(DISTDIR)/demos/life cp $(DEMODIR)/life/bitmaps/*.xpm $(DISTDIR)/demos/life/bitmaps mkdir $(DISTDIR)/demos/poem @@ -1144,6 +1172,12 @@ MISC_DIST: ALL_GUI_DIST mkdir $(DISTDIR)/misc/gs_afm cp $(MISCDIR)/gs_afm/*.afm $(DISTDIR)/misc/gs_afm +INTL_DIST: + mkdir $(DISTDIR)/locale + cp $(INTLDIR)/Makefile $(DISTDIR)/locale + cp $(INTLDIR)/*.po $(DISTDIR)/locale + -cp $(INTLDIR)/*.mo $(DISTDIR)/locale + MANUAL_DIST: mkdir $(DISTDIR)/docs mkdir $(DISTDIR)/docs/latex @@ -1158,40 +1192,45 @@ MANUAL_DIST: # those files needed for the Debian source package. # see utils/wxPython/distrib for scripts to make a proper wxPython dist. PYTHON_DIST: - mkdir $(DISTDIR)/utils/wxPython - mkdir $(DISTDIR)/utils/wxPython/demo - mkdir $(DISTDIR)/utils/wxPython/demo/bitmaps - mkdir $(DISTDIR)/utils/wxPython/demo/data - mkdir $(DISTDIR)/utils/wxPython/distrib - mkdir $(DISTDIR)/utils/wxPython/lib - mkdir $(DISTDIR)/utils/wxPython/lib/editor - mkdir $(DISTDIR)/utils/wxPython/lib/sizers - mkdir $(DISTDIR)/utils/wxPython/modules - mkdir $(DISTDIR)/utils/wxPython/modules/html - mkdir $(DISTDIR)/utils/wxPython/modules/utils - mkdir $(DISTDIR)/utils/wxPython/modules/utils/gtk - mkdir $(DISTDIR)/utils/wxPython/src - mkdir $(DISTDIR)/utils/wxPython/src/gtk - - cp $(UTILSDIR)/wxPython/*.txt $(DISTDIR)/utils/wxPython - -cp $(UTILSDIR)/wxPython/demo/* $(DISTDIR)/utils/wxPython/demo - -cp $(UTILSDIR)/wxPython/demo/bitmaps/* $(DISTDIR)/utils/wxPython/demo/bitmaps - -cp $(UTILSDIR)/wxPython/demo/data/* $(DISTDIR)/utils/wxPython/demo/data - cp $(UTILSDIR)/wxPython/distrib/build.py $(DISTDIR)/utils/wxPython/distrib - cp $(UTILSDIR)/wxPython/lib/*.py $(DISTDIR)/utils/wxPython/lib - cp $(UTILSDIR)/wxPython/lib/editor/*.py $(DISTDIR)/utils/wxPython/lib/editor - cp $(UTILSDIR)/wxPython/lib/sizers/*.py $(DISTDIR)/utils/wxPython/lib/sizers - -cp $(UTILSDIR)/wxPython/modules/html/* $(DISTDIR)/utils/wxPython/modules/html - -cp $(UTILSDIR)/wxPython/modules/utils/* $(DISTDIR)/utils/wxPython/modules/utils - cp $(UTILSDIR)/wxPython/modules/utils/gtk/utils.* $(DISTDIR)/utils/wxPython/modules/utils/gtk - -cp $(UTILSDIR)/wxPython/src/* $(DISTDIR)/utils/wxPython/src - cp $(UTILSDIR)/wxPython/src/gtk/*.py $(DISTDIR)/utils/wxPython/src/gtk - cp $(UTILSDIR)/wxPython/src/gtk/*.cpp $(DISTDIR)/utils/wxPython/src/gtk + mkdir $(DISTDIR)/wxPython + mkdir $(DISTDIR)/wxPython/contrib + mkdir $(DISTDIR)/wxPython/contrib/glcanvas + mkdir $(DISTDIR)/wxPython/contrib/glcanvas/gtk + mkdir $(DISTDIR)/wxPython/contrib/ogl + mkdir $(DISTDIR)/wxPython/contrib/stc + mkdir $(DISTDIR)/wxPython/demo + mkdir $(DISTDIR)/wxPython/demo/bitmaps + mkdir $(DISTDIR)/wxPython/demo/data + mkdir $(DISTDIR)/wxPython/distrib + mkdir $(DISTDIR)/wxPython/src + mkdir $(DISTDIR)/wxPython/src/gtk + mkdir $(DISTDIR)/wxPython/wxPython + mkdir $(DISTDIR)/wxPython/wxPython/lib + mkdir $(DISTDIR)/wxPython/wxPython/lib/editor + mkdir $(DISTDIR)/wxPython/wxPython/lib/sizers + + cp $(WXDIR)/wxPython/*.txt $(DISTDIR)/wxPython + cp $(WXDIR)/wxPython/contrib/buildall.py $(DISTDIR)/wxPython/contrib + -cp $(WXDIR)/wxPython/contrib/glcanvas/* $(DISTDIR)/wxPython/contrib/glcanvas + cp $(WXDIR)/wxPython/contrib/glcanvas/gtk/glcanvas.* $(DISTDIR)/wxPython/contrib/glcanvas/gtk + -cp $(WXDIR)/wxPython/contrib/ogl/* $(DISTDIR)/wxPython/contrib/ogl + -cp $(WXDIR)/wxPython/contrib/stc/* $(DISTDIR)/wxPython/contrib/stc + -cp $(WXDIR)/wxPython/demo/* $(DISTDIR)/wxPython/demo + -cp $(WXDIR)/wxPython/demo/bitmaps/* $(DISTDIR)/wxPython/demo/bitmaps + -cp $(WXDIR)/wxPython/demo/data/* $(DISTDIR)/wxPython/demo/data + cp $(WXDIR)/wxPython/distrib/build.py $(DISTDIR)/wxPython/distrib + -cp $(WXDIR)/wxPython/src/* $(DISTDIR)/wxPython/src + cp $(WXDIR)/wxPython/src/gtk/*.py $(DISTDIR)/wxPython/src/gtk + cp $(WXDIR)/wxPython/src/gtk/*.cpp $(DISTDIR)/wxPython/src/gtk + cp $(WXDIR)/wxPython/wxPython/lib/*.py $(DISTDIR)/wxPython/wxPython/lib + cp $(WXDIR)/wxPython/wxPython/lib/editor/*.py $(DISTDIR)/wxPython/wxPython/lib/editor + cp $(WXDIR)/wxPython/wxPython/lib/sizers/*.py $(DISTDIR)/wxPython/wxPython/lib/sizers distclean: $(RM) -r _dist_dir dist: @GUIDIST@ + cp $(WXDIR)/src/files.lst $(DISTDIR)/src/ @echo "*** Creating wxWindows distribution in $(DISTDIR)..." cd _dist_dir; tar ch @DISTDIR@ | gzip -f9 > $(WXARCHIVE); mv $(WXARCHIVE) .. @if test "$(USE_GUI)" = 1; then \ @@ -1204,6 +1243,20 @@ dist: @GUIDIST@ mv wxDemos demos; \ fi +bzip-dist: @GUIDIST@ + cp $(WXDIR)/src/files.lst $(DISTDIR)/src/ + @echo "*** Creating wxWindows distribution in $(DISTDIR)..." + cd _dist_dir; tar ch @DISTDIR@ | bzip2 -f9 > $(WXARCHIVE_BZIP); mv $(WXARCHIVE_BZIP) .. + @if test "$(USE_GUI)" = 1; then \ + cd $(DISTDIR); \ + mv samples wxSamples; \ + tar ch wxSamples | bzip2 -f9 > ../../$(WXSAMPLES_BZIP); \ + mv wxSamples samples; \ + mv demos wxDemos; \ + tar ch wxDemos | bzip2 -f9 > ../../$(WXDEMOS_BZIP); \ + mv wxDemos demos; \ + fi + debian-dist: @GUIDIST@ MANUAL_DIST PYTHON_DIST mkdir $(DISTDIR)/debian -cp $(WXDIR)/debian/* $(DISTDIR)/debian diff --git a/config.guess b/config.guess index 1ec70cc19e..6cb567b8ae 100755 --- a/config.guess +++ b/config.guess @@ -1,6 +1,7 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 +# Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -23,6 +24,7 @@ # Written by Per Bothner <bothner@cygnus.com>. # The master version of this file is at the FSF in /home/gd/gnu/lib. +# Please send patches to the Autoconf mailing list <autoconf@gnu.org>. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and @@ -35,6 +37,20 @@ # (but try to keep the structure clean). # +# Use $HOST_CC if defined. $CC may point to a cross-compiler +if test x"$CC_FOR_BUILD" = x; then + if test x"$HOST_CC" != x; then + CC_FOR_BUILD="$HOST_CC" + else + if test x"$CC" != x; then + CC_FOR_BUILD="$CC" + else + CC_FOR_BUILD=cc + fi + fi +fi + + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then @@ -46,7 +62,8 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 # Note: order is significant - the case branches are not exclusive. @@ -59,7 +76,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <<EOF >dummy.s + cat <<EOF >$dummy.s .globl main .ent main main: @@ -76,9 +93,9 @@ main: ret \$31,(\$26),1 .end main EOF - ${CC-cc} dummy.s -o dummy 2>/dev/null + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then - ./dummy + ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" @@ -97,8 +114,14 @@ EOF ;; esac fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 @@ -142,7 +165,7 @@ EOF SR2?01:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; - Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 @@ -150,7 +173,7 @@ EOF echo pyramid-pyramid-bsd fi exit 0 ;; - NILE:*:*:dcosx) + NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) @@ -201,6 +224,32 @@ EOF atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; sun3*:NetBSD:*:*) echo m68k-sun-netbsd${UNAME_RELEASE} exit 0 ;; @@ -234,12 +283,16 @@ EOF VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; - 2020:CLIX:*:*) + 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >dummy.c - int main (argc, argv) int argc; char **argv; { + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); @@ -254,10 +307,10 @@ EOF exit (-1); } EOF - ${CC-cc} dummy.c -o dummy \ - && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) @@ -309,7 +362,7 @@ EOF exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >dummy.c + sed 's/^ //' << EOF >$dummy.c #include <sys/systemcfg.h> main() @@ -320,8 +373,8 @@ EOF exit(0); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -368,25 +421,25 @@ EOF case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 ) - sed 's/^ //' << EOF >dummy.c + 9000/[678][0-9][0-9]) + sed 's/^ //' << EOF >$dummy.c #include <stdlib.h> #include <unistd.h> - + int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); - #endif + #endif long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) + + switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: + case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) - switch (bits) + switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; @@ -394,20 +447,20 @@ EOF } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; - #endif + #endif default: puts ("hppa1.0"); break; } exit (0); } EOF - (${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy` - rm -f dummy.c dummy + ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + rm -f $dummy.c $dummy esac HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >dummy.c + sed 's/^ //' << EOF >$dummy.c #include <unistd.h> int main () @@ -432,8 +485,8 @@ EOF exit (0); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -442,6 +495,9 @@ EOF 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; @@ -458,6 +514,9 @@ EOF parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -490,11 +549,14 @@ EOF CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} exit 0 ;; + CRAY*T3E:*:*:*) + echo t3e-cray-unicosmk${UNAME_RELEASE} + exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; @@ -507,13 +569,22 @@ EOF hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; - i?86:BSD/386:*:* | *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) + if test -x /usr/bin/objformat; then + if test "elf" = "`/usr/bin/objformat`"; then + echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` + exit 0 + fi + fi echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:NetBSD:*:*) @@ -523,13 +594,22 @@ EOF echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin32 + echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin32 + echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -541,12 +621,14 @@ EOF # uname on the ARM produces all sorts of strangeness, and we need to # filter it out. case "$UNAME_MACHINE" in + armv*) UNAME_MACHINE=$UNAME_MACHINE ;; arm* | sa110*) UNAME_MACHINE="arm" ;; esac # The BFD linker knows what the default object file format is, so - # first see if it will tell us. - ld_help_string=`ld --help 2>&1` + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_help_string=`cd /; ld --help 2>&1` ld_supported_emulations=`echo $ld_help_string \ | sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g @@ -559,11 +641,40 @@ EOF sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; + elf32ppc) + # Determine Lib Version + cat >$dummy.c <<EOF +#include <features.h> +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unkown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <<EOF >dummy.s + sed 's/^ //' <<EOF >$dummy.s .globl main .ent main main: @@ -581,9 +692,9 @@ EOF .end main EOF LIBC="" - ${CC-cc} dummy.s -o dummy 2>/dev/null + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then - ./dummy + ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" @@ -600,22 +711,23 @@ EOF 16) UNAME_MACHINE="alphaev6" ;; - esac + esac - objdump --private-headers dummy | \ + objdump --private-headers $dummy | \ grep ld.so.1 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi - fi - rm -f dummy.s dummy + fi + rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 elif test "${UNAME_MACHINE}" = "mips" ; then - cat >dummy.c <<EOF -main(argc, argv) - int argc; - char *argv[]; -{ + cat >$dummy.c <<EOF +#ifdef __cplusplus + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #ifdef __MIPSEB__ printf ("%s-unknown-linux-gnu\n", argv[1]); #endif @@ -625,8 +737,8 @@ main(argc, argv) return 0; } EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy else # Either a pre-BFD a.out linker (linux-gnuoldld) # or one that does not give us useful --help. @@ -645,12 +757,13 @@ EOF ;; esac # Determine whether the default compiler is a.out or elf - cat >dummy.c <<EOF + cat >$dummy.c <<EOF #include <features.h> -main(argc, argv) - int argc; - char *argv[]; -{ +#ifdef __cplusplus + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 @@ -667,8 +780,8 @@ main(argc, argv) return 0; } EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy fi ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. @@ -690,6 +803,14 @@ EOF echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; + i?86:*:5:7*) + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585 + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE} + exit 0 ;; i?86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` @@ -699,18 +820,15 @@ EOF (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; - i?86:UnixWare:*:*) - if /bin/uname -X 2>/dev/null >/dev/null ; then - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - fi - echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} - exit 0 ;; pc:*:*:*) # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. @@ -752,7 +870,7 @@ EOF mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:*) + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) @@ -764,6 +882,9 @@ EOF SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; @@ -794,7 +915,7 @@ EOF news*:NEWS-OS:*:6*) echo mips-sony-newsos6 exit 0 ;; - R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else @@ -810,12 +931,24 @@ EOF BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 -cat >dummy.c <<EOF +cat >$dummy.c <<EOF #ifdef _SEQUENT_ # include <sys/types.h> # include <sys/utsname.h> @@ -853,7 +986,10 @@ main () #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif @@ -913,8 +1049,8 @@ main () } EOF -${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 -rm -f dummy.c dummy +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy # Apollos put the system type in the environment. diff --git a/config.sub b/config.sub index f791166458..2436b45347 100755 --- a/config.sub +++ b/config.sub @@ -1,6 +1,6 @@ #! /bin/sh # Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. @@ -98,11 +98,21 @@ case $os in os= basic_machine=$1 ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=vxworks + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; -sco5) - os=sco3.2v5 + os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) @@ -121,6 +131,9 @@ case $os in os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -151,14 +164,21 @@ case $basic_machine in # Some are omitted here because they have special meanings below. tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \ - | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ - | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el \ - | sparc | sparclet | sparclite | sparc64 | v850) + | 580 | i960 | h8300 \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ + | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v) basic_machine=$basic_machine-unknown ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65) + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -174,24 +194,41 @@ case $basic_machine in vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ - | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ - | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ - | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ + | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | mipstx39-* | mipstx39el-* \ - | f301-*) + | f301-* | armv*-* | t3e-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* ) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; alliant | fx80) basic_machine=fx80-alliant ;; @@ -221,6 +258,10 @@ case $basic_machine in basic_machine=m68k-apollo os=-sysv ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; aux) basic_machine=m68k-apple os=-aux @@ -297,6 +338,10 @@ case $basic_machine in encore | umax | mmax) basic_machine=ns32k-encore ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; fx2800) basic_machine=i860-alliant ;; @@ -315,6 +360,14 @@ case $basic_machine in basic_machine=h8300-hitachi os=-hms ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; harris) basic_machine=m88k-harris os=-sysv3 @@ -330,13 +383,30 @@ case $basic_machine in basic_machine=m68k-hp os=-hpux ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; - hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) @@ -345,6 +415,14 @@ case $basic_machine in hppa-next) os=-nextstep3 ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; i370-ibm* | ibm*) basic_machine=i370-ibm os=-mvs @@ -366,6 +444,22 @@ case $basic_machine in basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + i386-go32 | go32) + basic_machine=i386-unknown + os=-go32 + ;; + i386-mingw32 | mingw32) + basic_machine=i386-unknown + os=-mingw32 + ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -394,6 +488,10 @@ case $basic_machine in miniframe) basic_machine=m68000-convergent ;; + *mint | *MiNT) + basic_machine=m68k-atari + os=-mint + ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu @@ -408,10 +506,26 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-unknown + os=-msdos + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-corel + os=-linux + ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos @@ -424,6 +538,10 @@ case $basic_machine in basic_machine=mips-sony os=-newsos ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; next | m*-next ) basic_machine=m68k-next case $os in @@ -449,9 +567,25 @@ case $basic_machine in basic_machine=i960-intel os=-nindy ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; np1) basic_machine=np1-gould ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -469,19 +603,19 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | nexen) + pentium | p5 | k5 | k6 | nexen) basic_machine=i586-pc ;; - pentiumpro | p6 | k6 | 6x86) + pentiumpro | p6 | 6x86) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i786-pc ;; - pentium-* | p5-* | k5-* | nexen-*) + pentium-* | p5-* | k5-* | k6-* | nexen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumpro-* | p6-* | k6-* | 6x86-*) + pentiumpro-* | p6-* | 6x86-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) @@ -505,12 +639,20 @@ case $basic_machine in ps2) basic_machine=i386-ibm ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; sequent) basic_machine=i386-sequent ;; @@ -518,6 +660,10 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; sps7) basic_machine=m68k-bull os=-sysv2 @@ -525,6 +671,13 @@ case $basic_machine in spur) basic_machine=spur-unknown ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; sun2) basic_machine=m68000-sun ;; @@ -569,6 +722,10 @@ case $basic_machine in basic_machine=i386-sequent os=-dynix ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -586,6 +743,10 @@ case $basic_machine in basic_machine=a29k-nyu os=-sym1 ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; vaxv) basic_machine=vax-dec os=-sysv @@ -609,6 +770,14 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; xmp) basic_machine=xmp-cray os=-unicos @@ -616,6 +785,10 @@ case $basic_machine in xps | xps100) basic_machine=xps100-honeywell ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -623,6 +796,15 @@ case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown @@ -645,7 +827,7 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sparc) + sparc | sparcv9) basic_machine=sparc-sun ;; cydra) @@ -657,6 +839,16 @@ case $basic_machine in orion105) basic_machine=clipper-highlevel ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 @@ -710,13 +902,21 @@ case $os in | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos*) + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*) # Remember, each alternative MUST END IN *, to match a version number. ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -741,6 +941,9 @@ case $os in -acis*) os=-aos ;; + -386bsd) + os=-bsd + ;; -ctix* | -uts*) os=-sysv ;; @@ -772,9 +975,18 @@ case $os in # This must come after -sysvr4. -sysv*) ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; -xenix) os=-xenix ;; + -*mint | -*MiNT) + os=-mint + ;; -none) ;; *) @@ -800,6 +1012,9 @@ case $basic_machine in *-acorn) os=-riscix1.2 ;; + arm*-corel) + os=-linux + ;; arm*-semi) os=-aout ;; @@ -821,6 +1036,15 @@ case $basic_machine in # default. # os=-sunos4 ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; @@ -833,6 +1057,15 @@ case $basic_machine in *-ibm) os=-aix ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; *-hp) os=-hpux ;; @@ -896,6 +1129,18 @@ case $basic_machine in f301-fujitsu) os=-uxpv ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; *) os=-none ;; @@ -917,9 +1162,15 @@ case $basic_machine in -aix*) vendor=ibm ;; + -beos*) + vendor=be + ;; -hpux*) vendor=hp ;; + -mpeix*) + vendor=hp + ;; -hiux*) vendor=hitachi ;; @@ -947,6 +1198,15 @@ case $basic_machine in -aux*) vendor=apple ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -*MiNT) + vendor=atari + ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; diff --git a/configure b/configure index c6db93af1f..12aa701b07 100755 --- a/configure +++ b/configure @@ -147,8 +147,6 @@ ac_help="$ac_help ac_help="$ac_help --enable-wxprintfv use wxWindows implementation of vprintf()" ac_help="$ac_help ---enable-joystick compile in joystick support (Linux only)" -ac_help="$ac_help --enable-std_iostreams use standard C++ stream classes" ac_help="$ac_help --enable-filesystem use virtual file systems classes" @@ -277,6 +275,8 @@ ac_help="$ac_help ac_help="$ac_help --enable-plot use wxPlot" ac_help="$ac_help +--enable-joystick compile in joystick support (Linux only)" +ac_help="$ac_help --enable-gif use gif images (GIF file format)" ac_help="$ac_help --enable-pcx use pcx images (PCX file format)" @@ -906,11 +906,11 @@ test "$host_alias" != "$target_alias" && WX_MAJOR_VERSION_NUMBER=2 -WX_MINOR_VERSION_NUMBER=1 -WX_RELEASE_NUMBER=14 +WX_MINOR_VERSION_NUMBER=2 +WX_RELEASE_NUMBER=0 WX_INTERFACE_AGE=0 -WX_BINARY_AGE=0 +WX_BINARY_AGE=1 WX_VERSION=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER.$WX_RELEASE_NUMBER @@ -937,6 +937,7 @@ USE_ALPHA= USE_OSF= USE_BSD= USE_FREEBSD= +USE_NETBSD= USE_VMS= USE_ULTRIX= USE_CYGWIN= @@ -1037,7 +1038,7 @@ EOF DEFAULT_DEFAULT_wxUSE_MOTIF=1 ;; - *-*-freebsd* | *-*-netbsd*) + *-*-freebsd*) USE_BSD=1 USE_FREEBSD=1 cat >> confdefs.h <<\EOF @@ -1046,6 +1047,19 @@ EOF cat >> confdefs.h <<\EOF #define __BSD__ 1 +EOF + + DEFAULT_DEFAULT_wxUSE_GTK=1 + ;; + *-*-netbsd*) + USE_BSD=1 + USE_NETBSD=1 + cat >> confdefs.h <<\EOF +#define __FREEBSD__ 1 +EOF + + cat >> confdefs.h <<\EOF +#define __NETBSD__ 1 EOF DEFAULT_DEFAULT_wxUSE_GTK=1 @@ -1062,6 +1076,7 @@ EOF EOF DEFAULT_DEFAULT_wxUSE_MOTIF=1 + NEEDS_D_REENTRANT_FOR_R_FUNCS=1 ;; *-*-dgux5* ) USE_ALPHA=1 @@ -1178,7 +1193,7 @@ fi if test "$USE_LINUX" = 1; then echo $ac_n "checking for gettext in -lc""... $ac_c" 1>&6 -echo "configure:1182: checking for gettext in -lc" >&5 +echo "configure:1197: checking for gettext in -lc" >&5 ac_lib_var=`echo c'_'gettext | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1186,7 +1201,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <<EOF -#line 1190 "configure" +#line 1205 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1197,7 +1212,7 @@ int main() { gettext() ; return 0; } EOF -if { (eval echo configure:1201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1491,7 +1506,7 @@ done echo $ac_n "checking "for --enable-gui"""... $ac_c" 1>&6 -echo "configure:1495: checking "for --enable-gui"" >&5 +echo "configure:1510: checking "for --enable-gui"" >&5 no_cache=0 # Check whether --enable-gui or --disable-gui was given. if test "${enable_gui+set}" = set; then @@ -1587,7 +1602,7 @@ fi echo $ac_n "checking "for --with-libpng"""... $ac_c" 1>&6 -echo "configure:1591: checking "for --with-libpng"" >&5 +echo "configure:1606: checking "for --with-libpng"" >&5 no_cache=0 # Check whether --with-libpng or --without-libpng was given. if test "${with_libpng+set}" = set; then @@ -1634,7 +1649,7 @@ fi echo $ac_n "checking "for --with-libjpeg"""... $ac_c" 1>&6 -echo "configure:1638: checking "for --with-libjpeg"" >&5 +echo "configure:1653: checking "for --with-libjpeg"" >&5 no_cache=0 # Check whether --with-libjpeg or --without-libjpeg was given. if test "${with_libjpeg+set}" = set; then @@ -1681,7 +1696,7 @@ fi echo $ac_n "checking "for --with-libtiff"""... $ac_c" 1>&6 -echo "configure:1685: checking "for --with-libtiff"" >&5 +echo "configure:1700: checking "for --with-libtiff"" >&5 no_cache=0 # Check whether --with-libtiff or --without-libtiff was given. if test "${with_libtiff+set}" = set; then @@ -1728,7 +1743,7 @@ fi echo $ac_n "checking "for --with-opengl"""... $ac_c" 1>&6 -echo "configure:1732: checking "for --with-opengl"" >&5 +echo "configure:1747: checking "for --with-opengl"" >&5 no_cache=0 # Check whether --with-opengl or --without-opengl was given. if test "${with_opengl+set}" = set; then @@ -1770,7 +1785,7 @@ fi echo $ac_n "checking "for --with-dmalloc"""... $ac_c" 1>&6 -echo "configure:1774: checking "for --with-dmalloc"" >&5 +echo "configure:1789: checking "for --with-dmalloc"" >&5 no_cache=0 # Check whether --with-dmalloc or --without-dmalloc was given. if test "${with_dmalloc+set}" = set; then @@ -1809,7 +1824,7 @@ fi echo $ac_n "checking "for --with-zlib"""... $ac_c" 1>&6 -echo "configure:1813: checking "for --with-zlib"" >&5 +echo "configure:1828: checking "for --with-zlib"" >&5 no_cache=0 # Check whether --with-zlib or --without-zlib was given. if test "${with_zlib+set}" = set; then @@ -1856,7 +1871,7 @@ fi echo $ac_n "checking "for --with-odbc"""... $ac_c" 1>&6 -echo "configure:1860: checking "for --with-odbc"" >&5 +echo "configure:1875: checking "for --with-odbc"" >&5 no_cache=0 # Check whether --with-odbc or --without-odbc was given. if test "${with_odbc+set}" = set; then @@ -1898,7 +1913,7 @@ fi echo $ac_n "checking "for --enable-shared"""... $ac_c" 1>&6 -echo "configure:1902: checking "for --enable-shared"" >&5 +echo "configure:1917: checking "for --enable-shared"" >&5 no_cache=0 # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then @@ -1937,7 +1952,7 @@ fi echo $ac_n "checking "for --enable-burnt_name"""... $ac_c" 1>&6 -echo "configure:1941: checking "for --enable-burnt_name"" >&5 +echo "configure:1956: checking "for --enable-burnt_name"" >&5 no_cache=0 # Check whether --enable-burnt_name or --disable-burnt_name was given. if test "${enable_burnt_name+set}" = set; then @@ -1976,7 +1991,7 @@ fi echo $ac_n "checking "for --enable-optimise"""... $ac_c" 1>&6 -echo "configure:1980: checking "for --enable-optimise"" >&5 +echo "configure:1995: checking "for --enable-optimise"" >&5 no_cache=0 # Check whether --enable-optimise or --disable-optimise was given. if test "${enable_optimise+set}" = set; then @@ -2015,7 +2030,7 @@ fi echo $ac_n "checking "for --enable-debug"""... $ac_c" 1>&6 -echo "configure:2019: checking "for --enable-debug"" >&5 +echo "configure:2034: checking "for --enable-debug"" >&5 no_cache=0 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then @@ -2063,7 +2078,7 @@ fi echo $ac_n "checking "for --enable-debug_flag"""... $ac_c" 1>&6 -echo "configure:2067: checking "for --enable-debug_flag"" >&5 +echo "configure:2082: checking "for --enable-debug_flag"" >&5 no_cache=0 # Check whether --enable-debug_flag or --disable-debug_flag was given. if test "${enable_debug_flag+set}" = set; then @@ -2102,7 +2117,7 @@ fi echo $ac_n "checking "for --enable-debug_info"""... $ac_c" 1>&6 -echo "configure:2106: checking "for --enable-debug_info"" >&5 +echo "configure:2121: checking "for --enable-debug_info"" >&5 no_cache=0 # Check whether --enable-debug_info or --disable-debug_info was given. if test "${enable_debug_info+set}" = set; then @@ -2141,7 +2156,7 @@ fi echo $ac_n "checking "for --enable-debug_gdb"""... $ac_c" 1>&6 -echo "configure:2145: checking "for --enable-debug_gdb"" >&5 +echo "configure:2160: checking "for --enable-debug_gdb"" >&5 no_cache=0 # Check whether --enable-debug_gdb or --disable-debug_gdb was given. if test "${enable_debug_gdb+set}" = set; then @@ -2180,7 +2195,7 @@ fi echo $ac_n "checking "for --enable-debug_cntxt"""... $ac_c" 1>&6 -echo "configure:2184: checking "for --enable-debug_cntxt"" >&5 +echo "configure:2199: checking "for --enable-debug_cntxt"" >&5 no_cache=0 # Check whether --enable-debug_cntxt or --disable-debug_cntxt was given. if test "${enable_debug_cntxt+set}" = set; then @@ -2219,7 +2234,7 @@ fi echo $ac_n "checking "for --enable-mem_tracing"""... $ac_c" 1>&6 -echo "configure:2223: checking "for --enable-mem_tracing"" >&5 +echo "configure:2238: checking "for --enable-mem_tracing"" >&5 no_cache=0 # Check whether --enable-mem_tracing or --disable-mem_tracing was given. if test "${enable_mem_tracing+set}" = set; then @@ -2258,7 +2273,7 @@ fi echo $ac_n "checking "for --enable-profile"""... $ac_c" 1>&6 -echo "configure:2262: checking "for --enable-profile"" >&5 +echo "configure:2277: checking "for --enable-profile"" >&5 no_cache=0 # Check whether --enable-profile or --disable-profile was given. if test "${enable_profile+set}" = set; then @@ -2297,7 +2312,7 @@ fi echo $ac_n "checking "for --enable-no_rtti"""... $ac_c" 1>&6 -echo "configure:2301: checking "for --enable-no_rtti"" >&5 +echo "configure:2316: checking "for --enable-no_rtti"" >&5 no_cache=0 # Check whether --enable-no_rtti or --disable-no_rtti was given. if test "${enable_no_rtti+set}" = set; then @@ -2336,7 +2351,7 @@ fi echo $ac_n "checking "for --enable-no_exceptions"""... $ac_c" 1>&6 -echo "configure:2340: checking "for --enable-no_exceptions"" >&5 +echo "configure:2355: checking "for --enable-no_exceptions"" >&5 no_cache=0 # Check whether --enable-no_exceptions or --disable-no_exceptions was given. if test "${enable_no_exceptions+set}" = set; then @@ -2375,7 +2390,7 @@ fi echo $ac_n "checking "for --enable-permissive"""... $ac_c" 1>&6 -echo "configure:2379: checking "for --enable-permissive"" >&5 +echo "configure:2394: checking "for --enable-permissive"" >&5 no_cache=0 # Check whether --enable-permissive or --disable-permissive was given. if test "${enable_permissive+set}" = set; then @@ -2414,7 +2429,7 @@ fi echo $ac_n "checking "for --enable-no_deps"""... $ac_c" 1>&6 -echo "configure:2418: checking "for --enable-no_deps"" >&5 +echo "configure:2433: checking "for --enable-no_deps"" >&5 no_cache=0 # Check whether --enable-no_deps or --disable-no_deps was given. if test "${enable_no_deps+set}" = set; then @@ -2455,7 +2470,7 @@ fi echo $ac_n "checking "for --enable-intl"""... $ac_c" 1>&6 -echo "configure:2459: checking "for --enable-intl"" >&5 +echo "configure:2474: checking "for --enable-intl"" >&5 no_cache=0 # Check whether --enable-intl or --disable-intl was given. if test "${enable_intl+set}" = set; then @@ -2494,7 +2509,7 @@ fi echo $ac_n "checking "for --enable-config"""... $ac_c" 1>&6 -echo "configure:2498: checking "for --enable-config"" >&5 +echo "configure:2513: checking "for --enable-config"" >&5 no_cache=0 # Check whether --enable-config or --disable-config was given. if test "${enable_config+set}" = set; then @@ -2534,7 +2549,7 @@ fi echo $ac_n "checking "for --enable-sockets"""... $ac_c" 1>&6 -echo "configure:2538: checking "for --enable-sockets"" >&5 +echo "configure:2553: checking "for --enable-sockets"" >&5 no_cache=0 # Check whether --enable-sockets or --disable-sockets was given. if test "${enable_sockets+set}" = set; then @@ -2574,7 +2589,7 @@ fi echo $ac_n "checking "for --enable-ipc"""... $ac_c" 1>&6 -echo "configure:2578: checking "for --enable-ipc"" >&5 +echo "configure:2593: checking "for --enable-ipc"" >&5 no_cache=0 # Check whether --enable-ipc or --disable-ipc was given. if test "${enable_ipc+set}" = set; then @@ -2614,7 +2629,7 @@ fi echo $ac_n "checking "for --enable-dialupman"""... $ac_c" 1>&6 -echo "configure:2618: checking "for --enable-dialupman"" >&5 +echo "configure:2633: checking "for --enable-dialupman"" >&5 no_cache=0 # Check whether --enable-dialupman or --disable-dialupman was given. if test "${enable_dialupman+set}" = set; then @@ -2653,7 +2668,7 @@ fi echo $ac_n "checking "for --enable-apple_ieee"""... $ac_c" 1>&6 -echo "configure:2657: checking "for --enable-apple_ieee"" >&5 +echo "configure:2672: checking "for --enable-apple_ieee"" >&5 no_cache=0 # Check whether --enable-apple_ieee or --disable-apple_ieee was given. if test "${enable_apple_ieee+set}" = set; then @@ -2692,7 +2707,7 @@ fi echo $ac_n "checking "for --enable-timedate"""... $ac_c" 1>&6 -echo "configure:2696: checking "for --enable-timedate"" >&5 +echo "configure:2711: checking "for --enable-timedate"" >&5 no_cache=0 # Check whether --enable-timedate or --disable-timedate was given. if test "${enable_timedate+set}" = set; then @@ -2731,7 +2746,7 @@ fi echo $ac_n "checking "for --enable-wave"""... $ac_c" 1>&6 -echo "configure:2735: checking "for --enable-wave"" >&5 +echo "configure:2750: checking "for --enable-wave"" >&5 no_cache=0 # Check whether --enable-wave or --disable-wave was given. if test "${enable_wave+set}" = set; then @@ -2770,7 +2785,7 @@ fi echo $ac_n "checking "for --enable-fraction"""... $ac_c" 1>&6 -echo "configure:2774: checking "for --enable-fraction"" >&5 +echo "configure:2789: checking "for --enable-fraction"" >&5 no_cache=0 # Check whether --enable-fraction or --disable-fraction was given. if test "${enable_fraction+set}" = set; then @@ -2809,7 +2824,7 @@ fi echo $ac_n "checking "for --enable-dynlib"""... $ac_c" 1>&6 -echo "configure:2813: checking "for --enable-dynlib"" >&5 +echo "configure:2828: checking "for --enable-dynlib"" >&5 no_cache=0 # Check whether --enable-dynlib or --disable-dynlib was given. if test "${enable_dynlib+set}" = set; then @@ -2848,7 +2863,7 @@ fi echo $ac_n "checking "for --enable-longlong"""... $ac_c" 1>&6 -echo "configure:2852: checking "for --enable-longlong"" >&5 +echo "configure:2867: checking "for --enable-longlong"" >&5 no_cache=0 # Check whether --enable-longlong or --disable-longlong was given. if test "${enable_longlong+set}" = set; then @@ -2887,7 +2902,7 @@ fi echo $ac_n "checking "for --enable-log"""... $ac_c" 1>&6 -echo "configure:2891: checking "for --enable-log"" >&5 +echo "configure:2906: checking "for --enable-log"" >&5 no_cache=0 # Check whether --enable-log or --disable-log was given. if test "${enable_log+set}" = set; then @@ -2926,7 +2941,7 @@ fi echo $ac_n "checking "for --enable-streams"""... $ac_c" 1>&6 -echo "configure:2930: checking "for --enable-streams"" >&5 +echo "configure:2945: checking "for --enable-streams"" >&5 no_cache=0 # Check whether --enable-streams or --disable-streams was given. if test "${enable_streams+set}" = set; then @@ -2965,7 +2980,7 @@ fi echo $ac_n "checking "for --enable-file"""... $ac_c" 1>&6 -echo "configure:2969: checking "for --enable-file"" >&5 +echo "configure:2984: checking "for --enable-file"" >&5 no_cache=0 # Check whether --enable-file or --disable-file was given. if test "${enable_file+set}" = set; then @@ -3004,7 +3019,7 @@ fi echo $ac_n "checking "for --enable-textfile"""... $ac_c" 1>&6 -echo "configure:3008: checking "for --enable-textfile"" >&5 +echo "configure:3023: checking "for --enable-textfile"" >&5 no_cache=0 # Check whether --enable-textfile or --disable-textfile was given. if test "${enable_textfile+set}" = set; then @@ -3043,7 +3058,7 @@ fi echo $ac_n "checking "for --enable-unicode"""... $ac_c" 1>&6 -echo "configure:3047: checking "for --enable-unicode"" >&5 +echo "configure:3062: checking "for --enable-unicode"" >&5 no_cache=0 # Check whether --enable-unicode or --disable-unicode was given. if test "${enable_unicode+set}" = set; then @@ -3082,7 +3097,7 @@ fi echo $ac_n "checking "for --enable-wcsrtombs"""... $ac_c" 1>&6 -echo "configure:3086: checking "for --enable-wcsrtombs"" >&5 +echo "configure:3101: checking "for --enable-wcsrtombs"" >&5 no_cache=0 # Check whether --enable-wcsrtombs or --disable-wcsrtombs was given. if test "${enable_wcsrtombs+set}" = set; then @@ -3121,7 +3136,7 @@ fi echo $ac_n "checking "for --enable-wxprintfv"""... $ac_c" 1>&6 -echo "configure:3125: checking "for --enable-wxprintfv"" >&5 +echo "configure:3140: checking "for --enable-wxprintfv"" >&5 no_cache=0 # Check whether --enable-wxprintfv or --disable-wxprintfv was given. if test "${enable_wxprintfv+set}" = set; then @@ -3159,47 +3174,8 @@ fi fi - echo $ac_n "checking "for --enable-joystick"""... $ac_c" 1>&6 -echo "configure:3164: checking "for --enable-joystick"" >&5 - no_cache=0 - # Check whether --enable-joystick or --disable-joystick was given. -if test "${enable_joystick+set}" = set; then - enableval="$enable_joystick" - - if test "$enableval" = yes; then - ac_cv_use_joystick='wxUSE_JOYSTICK=yes' - else - ac_cv_use_joystick='wxUSE_JOYSTICK=no' - fi - -else - - LINE=`grep "wxUSE_JOYSTICK" ${wx_arg_cache_file}` - if test "x$LINE" != x ; then - eval "DEFAULT_$LINE" - else - no_cache=1 - fi - - ac_cv_use_joystick='wxUSE_JOYSTICK='$DEFAULT_wxUSE_JOYSTICK - -fi - - - eval "$ac_cv_use_joystick" - if test "$no_cache" != 1; then - echo $ac_cv_use_joystick >> ${wx_arg_cache_file}.tmp - fi - - if test "$wxUSE_JOYSTICK" = yes; then - echo "$ac_t""yes" 1>&6 - else - echo "$ac_t""no" 1>&6 - fi - - echo $ac_n "checking "for --enable-std_iostreams"""... $ac_c" 1>&6 -echo "configure:3203: checking "for --enable-std_iostreams"" >&5 +echo "configure:3179: checking "for --enable-std_iostreams"" >&5 no_cache=0 # Check whether --enable-std_iostreams or --disable-std_iostreams was given. if test "${enable_std_iostreams+set}" = set; then @@ -3238,7 +3214,7 @@ fi echo $ac_n "checking "for --enable-filesystem"""... $ac_c" 1>&6 -echo "configure:3242: checking "for --enable-filesystem"" >&5 +echo "configure:3218: checking "for --enable-filesystem"" >&5 no_cache=0 # Check whether --enable-filesystem or --disable-filesystem was given. if test "${enable_filesystem+set}" = set; then @@ -3277,7 +3253,7 @@ fi echo $ac_n "checking "for --enable-fs_inet"""... $ac_c" 1>&6 -echo "configure:3281: checking "for --enable-fs_inet"" >&5 +echo "configure:3257: checking "for --enable-fs_inet"" >&5 no_cache=0 # Check whether --enable-fs_inet or --disable-fs_inet was given. if test "${enable_fs_inet+set}" = set; then @@ -3316,7 +3292,7 @@ fi echo $ac_n "checking "for --enable-fs_zip"""... $ac_c" 1>&6 -echo "configure:3320: checking "for --enable-fs_zip"" >&5 +echo "configure:3296: checking "for --enable-fs_zip"" >&5 no_cache=0 # Check whether --enable-fs_zip or --disable-fs_zip was given. if test "${enable_fs_zip+set}" = set; then @@ -3355,7 +3331,7 @@ fi echo $ac_n "checking "for --enable-zipstream"""... $ac_c" 1>&6 -echo "configure:3359: checking "for --enable-zipstream"" >&5 +echo "configure:3335: checking "for --enable-zipstream"" >&5 no_cache=0 # Check whether --enable-zipstream or --disable-zipstream was given. if test "${enable_zipstream+set}" = set; then @@ -3395,7 +3371,7 @@ fi echo $ac_n "checking "for --enable-catch_segvs"""... $ac_c" 1>&6 -echo "configure:3399: checking "for --enable-catch_segvs"" >&5 +echo "configure:3375: checking "for --enable-catch_segvs"" >&5 no_cache=0 # Check whether --enable-catch_segvs or --disable-catch_segvs was given. if test "${enable_catch_segvs+set}" = set; then @@ -3436,7 +3412,7 @@ fi echo $ac_n "checking "for --enable-threads"""... $ac_c" 1>&6 -echo "configure:3440: checking "for --enable-threads"" >&5 +echo "configure:3416: checking "for --enable-threads"" >&5 no_cache=0 # Check whether --enable-threads or --disable-threads was given. if test "${enable_threads+set}" = set; then @@ -3475,7 +3451,7 @@ fi echo $ac_n "checking "for --enable-serial"""... $ac_c" 1>&6 -echo "configure:3479: checking "for --enable-serial"" >&5 +echo "configure:3455: checking "for --enable-serial"" >&5 no_cache=0 # Check whether --enable-serial or --disable-serial was given. if test "${enable_serial+set}" = set; then @@ -3518,7 +3494,7 @@ if test "$wxUSE_GUI" = "yes"; then echo $ac_n "checking "for --enable-docview"""... $ac_c" 1>&6 -echo "configure:3522: checking "for --enable-docview"" >&5 +echo "configure:3498: checking "for --enable-docview"" >&5 no_cache=0 # Check whether --enable-docview or --disable-docview was given. if test "${enable_docview+set}" = set; then @@ -3557,7 +3533,7 @@ fi echo $ac_n "checking "for --enable-help"""... $ac_c" 1>&6 -echo "configure:3561: checking "for --enable-help"" >&5 +echo "configure:3537: checking "for --enable-help"" >&5 no_cache=0 # Check whether --enable-help or --disable-help was given. if test "${enable_help+set}" = set; then @@ -3596,7 +3572,7 @@ fi echo $ac_n "checking "for --enable-constraints"""... $ac_c" 1>&6 -echo "configure:3600: checking "for --enable-constraints"" >&5 +echo "configure:3576: checking "for --enable-constraints"" >&5 no_cache=0 # Check whether --enable-constraints or --disable-constraints was given. if test "${enable_constraints+set}" = set; then @@ -3635,7 +3611,7 @@ fi echo $ac_n "checking "for --enable-printarch"""... $ac_c" 1>&6 -echo "configure:3639: checking "for --enable-printarch"" >&5 +echo "configure:3615: checking "for --enable-printarch"" >&5 no_cache=0 # Check whether --enable-printarch or --disable-printarch was given. if test "${enable_printarch+set}" = set; then @@ -3674,7 +3650,7 @@ fi echo $ac_n "checking "for --enable-mdi"""... $ac_c" 1>&6 -echo "configure:3678: checking "for --enable-mdi"" >&5 +echo "configure:3654: checking "for --enable-mdi"" >&5 no_cache=0 # Check whether --enable-mdi or --disable-mdi was given. if test "${enable_mdi+set}" = set; then @@ -3714,7 +3690,7 @@ fi echo $ac_n "checking "for --enable-postscript"""... $ac_c" 1>&6 -echo "configure:3718: checking "for --enable-postscript"" >&5 +echo "configure:3694: checking "for --enable-postscript"" >&5 no_cache=0 # Check whether --enable-postscript or --disable-postscript was given. if test "${enable_postscript+set}" = set; then @@ -3755,7 +3731,7 @@ fi echo $ac_n "checking "for --enable-prologio"""... $ac_c" 1>&6 -echo "configure:3759: checking "for --enable-prologio"" >&5 +echo "configure:3735: checking "for --enable-prologio"" >&5 no_cache=0 # Check whether --enable-prologio or --disable-prologio was given. if test "${enable_prologio+set}" = set; then @@ -3794,7 +3770,7 @@ fi echo $ac_n "checking "for --enable-resources"""... $ac_c" 1>&6 -echo "configure:3798: checking "for --enable-resources"" >&5 +echo "configure:3774: checking "for --enable-resources"" >&5 no_cache=0 # Check whether --enable-resources or --disable-resources was given. if test "${enable_resources+set}" = set; then @@ -3834,7 +3810,7 @@ fi echo $ac_n "checking "for --enable-xresources"""... $ac_c" 1>&6 -echo "configure:3838: checking "for --enable-xresources"" >&5 +echo "configure:3814: checking "for --enable-xresources"" >&5 no_cache=0 # Check whether --enable-xresources or --disable-xresources was given. if test "${enable_xresources+set}" = set; then @@ -3875,7 +3851,7 @@ fi echo $ac_n "checking "for --enable-clipboard"""... $ac_c" 1>&6 -echo "configure:3879: checking "for --enable-clipboard"" >&5 +echo "configure:3855: checking "for --enable-clipboard"" >&5 no_cache=0 # Check whether --enable-clipboard or --disable-clipboard was given. if test "${enable_clipboard+set}" = set; then @@ -3914,7 +3890,7 @@ fi echo $ac_n "checking "for --enable-dnd"""... $ac_c" 1>&6 -echo "configure:3918: checking "for --enable-dnd"" >&5 +echo "configure:3894: checking "for --enable-dnd"" >&5 no_cache=0 # Check whether --enable-dnd or --disable-dnd was given. if test "${enable_dnd+set}" = set; then @@ -3954,7 +3930,7 @@ fi echo $ac_n "checking "for --enable-wxtree"""... $ac_c" 1>&6 -echo "configure:3958: checking "for --enable-wxtree"" >&5 +echo "configure:3934: checking "for --enable-wxtree"" >&5 no_cache=0 # Check whether --enable-wxtree or --disable-wxtree was given. if test "${enable_wxtree+set}" = set; then @@ -3995,7 +3971,7 @@ fi echo $ac_n "checking "for --enable-controls"""... $ac_c" 1>&6 -echo "configure:3999: checking "for --enable-controls"" >&5 +echo "configure:3975: checking "for --enable-controls"" >&5 no_cache=0 # Check whether --enable-controls or --disable-controls was given. if test "${enable_controls+set}" = set; then @@ -4103,7 +4079,7 @@ fi echo $ac_n "checking "for --enable-accel"""... $ac_c" 1>&6 -echo "configure:4107: checking "for --enable-accel"" >&5 +echo "configure:4083: checking "for --enable-accel"" >&5 no_cache=0 # Check whether --enable-accel or --disable-accel was given. if test "${enable_accel+set}" = set; then @@ -4142,7 +4118,7 @@ fi echo $ac_n "checking "for --enable-caret"""... $ac_c" 1>&6 -echo "configure:4146: checking "for --enable-caret"" >&5 +echo "configure:4122: checking "for --enable-caret"" >&5 no_cache=0 # Check whether --enable-caret or --disable-caret was given. if test "${enable_caret+set}" = set; then @@ -4181,7 +4157,7 @@ fi echo $ac_n "checking "for --enable-bmpbutton"""... $ac_c" 1>&6 -echo "configure:4185: checking "for --enable-bmpbutton"" >&5 +echo "configure:4161: checking "for --enable-bmpbutton"" >&5 no_cache=0 # Check whether --enable-bmpbutton or --disable-bmpbutton was given. if test "${enable_bmpbutton+set}" = set; then @@ -4220,7 +4196,7 @@ fi echo $ac_n "checking "for --enable-checkbox"""... $ac_c" 1>&6 -echo "configure:4224: checking "for --enable-checkbox"" >&5 +echo "configure:4200: checking "for --enable-checkbox"" >&5 no_cache=0 # Check whether --enable-checkbox or --disable-checkbox was given. if test "${enable_checkbox+set}" = set; then @@ -4259,7 +4235,7 @@ fi echo $ac_n "checking "for --enable-checklst"""... $ac_c" 1>&6 -echo "configure:4263: checking "for --enable-checklst"" >&5 +echo "configure:4239: checking "for --enable-checklst"" >&5 no_cache=0 # Check whether --enable-checklst or --disable-checklst was given. if test "${enable_checklst+set}" = set; then @@ -4298,7 +4274,7 @@ fi echo $ac_n "checking "for --enable-choice"""... $ac_c" 1>&6 -echo "configure:4302: checking "for --enable-choice"" >&5 +echo "configure:4278: checking "for --enable-choice"" >&5 no_cache=0 # Check whether --enable-choice or --disable-choice was given. if test "${enable_choice+set}" = set; then @@ -4337,7 +4313,7 @@ fi echo $ac_n "checking "for --enable-combobox"""... $ac_c" 1>&6 -echo "configure:4341: checking "for --enable-combobox"" >&5 +echo "configure:4317: checking "for --enable-combobox"" >&5 no_cache=0 # Check whether --enable-combobox or --disable-combobox was given. if test "${enable_combobox+set}" = set; then @@ -4376,7 +4352,7 @@ fi echo $ac_n "checking "for --enable-gauge"""... $ac_c" 1>&6 -echo "configure:4380: checking "for --enable-gauge"" >&5 +echo "configure:4356: checking "for --enable-gauge"" >&5 no_cache=0 # Check whether --enable-gauge or --disable-gauge was given. if test "${enable_gauge+set}" = set; then @@ -4415,7 +4391,7 @@ fi echo $ac_n "checking "for --enable-grid"""... $ac_c" 1>&6 -echo "configure:4419: checking "for --enable-grid"" >&5 +echo "configure:4395: checking "for --enable-grid"" >&5 no_cache=0 # Check whether --enable-grid or --disable-grid was given. if test "${enable_grid+set}" = set; then @@ -4454,7 +4430,7 @@ fi echo $ac_n "checking "for --enable-newgrid"""... $ac_c" 1>&6 -echo "configure:4458: checking "for --enable-newgrid"" >&5 +echo "configure:4434: checking "for --enable-newgrid"" >&5 no_cache=0 # Check whether --enable-newgrid or --disable-newgrid was given. if test "${enable_newgrid+set}" = set; then @@ -4493,7 +4469,7 @@ fi echo $ac_n "checking "for --enable-imaglist"""... $ac_c" 1>&6 -echo "configure:4497: checking "for --enable-imaglist"" >&5 +echo "configure:4473: checking "for --enable-imaglist"" >&5 no_cache=0 # Check whether --enable-imaglist or --disable-imaglist was given. if test "${enable_imaglist+set}" = set; then @@ -4532,7 +4508,7 @@ fi echo $ac_n "checking "for --enable-listbox"""... $ac_c" 1>&6 -echo "configure:4536: checking "for --enable-listbox"" >&5 +echo "configure:4512: checking "for --enable-listbox"" >&5 no_cache=0 # Check whether --enable-listbox or --disable-listbox was given. if test "${enable_listbox+set}" = set; then @@ -4571,7 +4547,7 @@ fi echo $ac_n "checking "for --enable-listctrl"""... $ac_c" 1>&6 -echo "configure:4575: checking "for --enable-listctrl"" >&5 +echo "configure:4551: checking "for --enable-listctrl"" >&5 no_cache=0 # Check whether --enable-listctrl or --disable-listctrl was given. if test "${enable_listctrl+set}" = set; then @@ -4610,7 +4586,7 @@ fi echo $ac_n "checking "for --enable-notebook"""... $ac_c" 1>&6 -echo "configure:4614: checking "for --enable-notebook"" >&5 +echo "configure:4590: checking "for --enable-notebook"" >&5 no_cache=0 # Check whether --enable-notebook or --disable-notebook was given. if test "${enable_notebook+set}" = set; then @@ -4649,7 +4625,7 @@ fi echo $ac_n "checking "for --enable-radiobox"""... $ac_c" 1>&6 -echo "configure:4653: checking "for --enable-radiobox"" >&5 +echo "configure:4629: checking "for --enable-radiobox"" >&5 no_cache=0 # Check whether --enable-radiobox or --disable-radiobox was given. if test "${enable_radiobox+set}" = set; then @@ -4688,7 +4664,7 @@ fi echo $ac_n "checking "for --enable-radiobtn"""... $ac_c" 1>&6 -echo "configure:4692: checking "for --enable-radiobtn"" >&5 +echo "configure:4668: checking "for --enable-radiobtn"" >&5 no_cache=0 # Check whether --enable-radiobtn or --disable-radiobtn was given. if test "${enable_radiobtn+set}" = set; then @@ -4727,7 +4703,7 @@ fi echo $ac_n "checking "for --enable-sash"""... $ac_c" 1>&6 -echo "configure:4731: checking "for --enable-sash"" >&5 +echo "configure:4707: checking "for --enable-sash"" >&5 no_cache=0 # Check whether --enable-sash or --disable-sash was given. if test "${enable_sash+set}" = set; then @@ -4766,7 +4742,7 @@ fi echo $ac_n "checking "for --enable-scrollbar"""... $ac_c" 1>&6 -echo "configure:4770: checking "for --enable-scrollbar"" >&5 +echo "configure:4746: checking "for --enable-scrollbar"" >&5 no_cache=0 # Check whether --enable-scrollbar or --disable-scrollbar was given. if test "${enable_scrollbar+set}" = set; then @@ -4805,7 +4781,7 @@ fi echo $ac_n "checking "for --enable-slider"""... $ac_c" 1>&6 -echo "configure:4809: checking "for --enable-slider"" >&5 +echo "configure:4785: checking "for --enable-slider"" >&5 no_cache=0 # Check whether --enable-slider or --disable-slider was given. if test "${enable_slider+set}" = set; then @@ -4844,7 +4820,7 @@ fi echo $ac_n "checking "for --enable-spinbtn"""... $ac_c" 1>&6 -echo "configure:4848: checking "for --enable-spinbtn"" >&5 +echo "configure:4824: checking "for --enable-spinbtn"" >&5 no_cache=0 # Check whether --enable-spinbtn or --disable-spinbtn was given. if test "${enable_spinbtn+set}" = set; then @@ -4883,7 +4859,7 @@ fi echo $ac_n "checking "for --enable-spinctrl"""... $ac_c" 1>&6 -echo "configure:4887: checking "for --enable-spinctrl"" >&5 +echo "configure:4863: checking "for --enable-spinctrl"" >&5 no_cache=0 # Check whether --enable-spinctrl or --disable-spinctrl was given. if test "${enable_spinctrl+set}" = set; then @@ -4922,7 +4898,7 @@ fi echo $ac_n "checking "for --enable-splitter"""... $ac_c" 1>&6 -echo "configure:4926: checking "for --enable-splitter"" >&5 +echo "configure:4902: checking "for --enable-splitter"" >&5 no_cache=0 # Check whether --enable-splitter or --disable-splitter was given. if test "${enable_splitter+set}" = set; then @@ -4961,7 +4937,7 @@ fi echo $ac_n "checking "for --enable-statbmp"""... $ac_c" 1>&6 -echo "configure:4965: checking "for --enable-statbmp"" >&5 +echo "configure:4941: checking "for --enable-statbmp"" >&5 no_cache=0 # Check whether --enable-statbmp or --disable-statbmp was given. if test "${enable_statbmp+set}" = set; then @@ -5000,7 +4976,7 @@ fi echo $ac_n "checking "for --enable-statbox"""... $ac_c" 1>&6 -echo "configure:5004: checking "for --enable-statbox"" >&5 +echo "configure:4980: checking "for --enable-statbox"" >&5 no_cache=0 # Check whether --enable-statbox or --disable-statbox was given. if test "${enable_statbox+set}" = set; then @@ -5039,7 +5015,7 @@ fi echo $ac_n "checking "for --enable-statline"""... $ac_c" 1>&6 -echo "configure:5043: checking "for --enable-statline"" >&5 +echo "configure:5019: checking "for --enable-statline"" >&5 no_cache=0 # Check whether --enable-statline or --disable-statline was given. if test "${enable_statline+set}" = set; then @@ -5078,7 +5054,7 @@ fi echo $ac_n "checking "for --enable-statusbar"""... $ac_c" 1>&6 -echo "configure:5082: checking "for --enable-statusbar"" >&5 +echo "configure:5058: checking "for --enable-statusbar"" >&5 no_cache=0 # Check whether --enable-statusbar or --disable-statusbar was given. if test "${enable_statusbar+set}" = set; then @@ -5117,7 +5093,7 @@ fi echo $ac_n "checking "for --enable-tabdialog"""... $ac_c" 1>&6 -echo "configure:5121: checking "for --enable-tabdialog"" >&5 +echo "configure:5097: checking "for --enable-tabdialog"" >&5 no_cache=0 # Check whether --enable-tabdialog or --disable-tabdialog was given. if test "${enable_tabdialog+set}" = set; then @@ -5156,7 +5132,7 @@ fi echo $ac_n "checking "for --enable-toolbar"""... $ac_c" 1>&6 -echo "configure:5160: checking "for --enable-toolbar"" >&5 +echo "configure:5136: checking "for --enable-toolbar"" >&5 no_cache=0 # Check whether --enable-toolbar or --disable-toolbar was given. if test "${enable_toolbar+set}" = set; then @@ -5195,7 +5171,7 @@ fi echo $ac_n "checking "for --enable-tbarnative"""... $ac_c" 1>&6 -echo "configure:5199: checking "for --enable-tbarnative"" >&5 +echo "configure:5175: checking "for --enable-tbarnative"" >&5 no_cache=0 # Check whether --enable-tbarnative or --disable-tbarnative was given. if test "${enable_tbarnative+set}" = set; then @@ -5234,7 +5210,7 @@ fi echo $ac_n "checking "for --enable-tbarsmpl"""... $ac_c" 1>&6 -echo "configure:5238: checking "for --enable-tbarsmpl"" >&5 +echo "configure:5214: checking "for --enable-tbarsmpl"" >&5 no_cache=0 # Check whether --enable-tbarsmpl or --disable-tbarsmpl was given. if test "${enable_tbarsmpl+set}" = set; then @@ -5273,7 +5249,7 @@ fi echo $ac_n "checking "for --enable-treectrl"""... $ac_c" 1>&6 -echo "configure:5277: checking "for --enable-treectrl"" >&5 +echo "configure:5253: checking "for --enable-treectrl"" >&5 no_cache=0 # Check whether --enable-treectrl or --disable-treectrl was given. if test "${enable_treectrl+set}" = set; then @@ -5314,7 +5290,7 @@ fi echo $ac_n "checking "for --enable-commondlg"""... $ac_c" 1>&6 -echo "configure:5318: checking "for --enable-commondlg"" >&5 +echo "configure:5294: checking "for --enable-commondlg"" >&5 no_cache=0 # Check whether --enable-commondlg or --disable-commondlg was given. if test "${enable_commondlg+set}" = set; then @@ -5353,7 +5329,7 @@ fi echo $ac_n "checking "for --enable-dirdlg"""... $ac_c" 1>&6 -echo "configure:5357: checking "for --enable-dirdlg"" >&5 +echo "configure:5333: checking "for --enable-dirdlg"" >&5 no_cache=0 # Check whether --enable-dirdlg or --disable-dirdlg was given. if test "${enable_dirdlg+set}" = set; then @@ -5392,7 +5368,7 @@ fi echo $ac_n "checking "for --enable-textdlg"""... $ac_c" 1>&6 -echo "configure:5396: checking "for --enable-textdlg"" >&5 +echo "configure:5372: checking "for --enable-textdlg"" >&5 no_cache=0 # Check whether --enable-textdlg or --disable-textdlg was given. if test "${enable_textdlg+set}" = set; then @@ -5431,7 +5407,7 @@ fi echo $ac_n "checking "for --enable-tipdlg"""... $ac_c" 1>&6 -echo "configure:5435: checking "for --enable-tipdlg"" >&5 +echo "configure:5411: checking "for --enable-tipdlg"" >&5 no_cache=0 # Check whether --enable-tipdlg or --disable-tipdlg was given. if test "${enable_tipdlg+set}" = set; then @@ -5470,7 +5446,7 @@ fi echo $ac_n "checking "for --enable-progressdlg"""... $ac_c" 1>&6 -echo "configure:5474: checking "for --enable-progressdlg"" >&5 +echo "configure:5450: checking "for --enable-progressdlg"" >&5 no_cache=0 # Check whether --enable-progressdlg or --disable-progressdlg was given. if test "${enable_progressdlg+set}" = set; then @@ -5509,7 +5485,7 @@ fi echo $ac_n "checking "for --enable-miniframe"""... $ac_c" 1>&6 -echo "configure:5513: checking "for --enable-miniframe"" >&5 +echo "configure:5489: checking "for --enable-miniframe"" >&5 no_cache=0 # Check whether --enable-miniframe or --disable-miniframe was given. if test "${enable_miniframe+set}" = set; then @@ -5548,7 +5524,7 @@ fi echo $ac_n "checking "for --enable-html"""... $ac_c" 1>&6 -echo "configure:5552: checking "for --enable-html"" >&5 +echo "configure:5528: checking "for --enable-html"" >&5 no_cache=0 # Check whether --enable-html or --disable-html was given. if test "${enable_html+set}" = set; then @@ -5587,7 +5563,7 @@ fi echo $ac_n "checking "for --enable-tooltips"""... $ac_c" 1>&6 -echo "configure:5591: checking "for --enable-tooltips"" >&5 +echo "configure:5567: checking "for --enable-tooltips"" >&5 no_cache=0 # Check whether --enable-tooltips or --disable-tooltips was given. if test "${enable_tooltips+set}" = set; then @@ -5626,7 +5602,7 @@ fi echo $ac_n "checking "for --enable-splines"""... $ac_c" 1>&6 -echo "configure:5630: checking "for --enable-splines"" >&5 +echo "configure:5606: checking "for --enable-splines"" >&5 no_cache=0 # Check whether --enable-splines or --disable-splines was given. if test "${enable_splines+set}" = set; then @@ -5665,7 +5641,7 @@ fi echo $ac_n "checking "for --enable-validators"""... $ac_c" 1>&6 -echo "configure:5669: checking "for --enable-validators"" >&5 +echo "configure:5645: checking "for --enable-validators"" >&5 no_cache=0 # Check whether --enable-validators or --disable-validators was given. if test "${enable_validators+set}" = set; then @@ -5704,7 +5680,7 @@ fi echo $ac_n "checking "for --enable-busyinfo"""... $ac_c" 1>&6 -echo "configure:5708: checking "for --enable-busyinfo"" >&5 +echo "configure:5684: checking "for --enable-busyinfo"" >&5 no_cache=0 # Check whether --enable-busyinfo or --disable-busyinfo was given. if test "${enable_busyinfo+set}" = set; then @@ -5743,7 +5719,7 @@ fi echo $ac_n "checking "for --enable-plot"""... $ac_c" 1>&6 -echo "configure:5747: checking "for --enable-plot"" >&5 +echo "configure:5723: checking "for --enable-plot"" >&5 no_cache=0 # Check whether --enable-plot or --disable-plot was given. if test "${enable_plot+set}" = set; then @@ -5781,10 +5757,49 @@ fi fi + echo $ac_n "checking "for --enable-joystick"""... $ac_c" 1>&6 +echo "configure:5762: checking "for --enable-joystick"" >&5 + no_cache=0 + # Check whether --enable-joystick or --disable-joystick was given. +if test "${enable_joystick+set}" = set; then + enableval="$enable_joystick" + + if test "$enableval" = yes; then + ac_cv_use_joystick='wxUSE_JOYSTICK=yes' + else + ac_cv_use_joystick='wxUSE_JOYSTICK=no' + fi + +else + + LINE=`grep "wxUSE_JOYSTICK" ${wx_arg_cache_file}` + if test "x$LINE" != x ; then + eval "DEFAULT_$LINE" + else + no_cache=1 + fi + + ac_cv_use_joystick='wxUSE_JOYSTICK='$DEFAULT_wxUSE_JOYSTICK + +fi + + + eval "$ac_cv_use_joystick" + if test "$no_cache" != 1; then + echo $ac_cv_use_joystick >> ${wx_arg_cache_file}.tmp + fi + + if test "$wxUSE_JOYSTICK" = yes; then + echo "$ac_t""yes" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + echo $ac_n "checking "for --enable-gif"""... $ac_c" 1>&6 -echo "configure:5788: checking "for --enable-gif"" >&5 +echo "configure:5803: checking "for --enable-gif"" >&5 no_cache=0 # Check whether --enable-gif or --disable-gif was given. if test "${enable_gif+set}" = set; then @@ -5823,7 +5838,7 @@ fi echo $ac_n "checking "for --enable-pcx"""... $ac_c" 1>&6 -echo "configure:5827: checking "for --enable-pcx"" >&5 +echo "configure:5842: checking "for --enable-pcx"" >&5 no_cache=0 # Check whether --enable-pcx or --disable-pcx was given. if test "${enable_pcx+set}" = set; then @@ -5862,7 +5877,7 @@ fi echo $ac_n "checking "for --enable-pnm"""... $ac_c" 1>&6 -echo "configure:5866: checking "for --enable-pnm"" >&5 +echo "configure:5881: checking "for --enable-pnm"" >&5 no_cache=0 # Check whether --enable-pnm or --disable-pnm was given. if test "${enable_pnm+set}" = set; then @@ -5909,7 +5924,7 @@ fi echo $ac_n "checking for toolkit""... $ac_c" 1>&6 -echo "configure:5913: checking for toolkit" >&5 +echo "configure:5928: checking for toolkit" >&5 if test "$wxUSE_GUI" = "yes"; then @@ -6042,7 +6057,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6046: checking for $ac_word" >&5 +echo "configure:6061: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6072,7 +6087,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6076: checking for $ac_word" >&5 +echo "configure:6091: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6123,7 +6138,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6127: checking for $ac_word" >&5 +echo "configure:6142: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6155,7 +6170,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:6159: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:6174: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -6166,12 +6181,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 6170 "configure" +#line 6185 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:6175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -6197,12 +6212,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:6201: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:6216: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:6206: checking whether we are using GNU C" >&5 +echo "configure:6221: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6211,7 +6226,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:6215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:6230: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -6230,7 +6245,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:6234: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:6249: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6265,7 +6280,7 @@ fi CFLAGS=`echo "$CFLAGS" | sed 's/-g//g'` echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:6269: checking how to run the C preprocessor" >&5 +echo "configure:6284: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -6280,13 +6295,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 6284 "configure" +#line 6299 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6290: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6305: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -6297,13 +6312,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 6301 "configure" +#line 6316 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6322: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -6314,13 +6329,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 6318 "configure" +#line 6333 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6339: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -6347,13 +6362,13 @@ echo "$ac_t""$CPP" 1>&6 if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:6351: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:6366: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 6357 "configure" +#line 6372 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -6371,7 +6386,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 6375 "configure" +#line 6390 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -6407,7 +6422,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6411: checking for $ac_word" >&5 +echo "configure:6426: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6439,7 +6454,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:6443: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:6458: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -6450,12 +6465,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 6454 "configure" +#line 6469 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:6459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -6481,12 +6496,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:6485: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:6500: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:6490: checking whether we are using GNU C++" >&5 +echo "configure:6505: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6495,7 +6510,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:6499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:6514: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -6514,7 +6529,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:6518: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:6533: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6547,7 +6562,7 @@ fi echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:6551: checking how to run the C++ preprocessor" >&5 +echo "configure:6566: checking how to run the C++ preprocessor" >&5 if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6560,12 +6575,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext <<EOF -#line 6564 "configure" +#line 6579 "configure" #include "confdefs.h" #include <stdlib.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -6603,7 +6618,7 @@ cross_compiling=$ac_cv_prog_cc_cross # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6607: checking for $ac_word" >&5 +echo "configure:6622: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6634,7 +6649,7 @@ fi # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6638: checking for $ac_word" >&5 +echo "configure:6653: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6674,7 +6689,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:6678: checking for a BSD compatible install" >&5 +echo "configure:6693: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6730,7 +6745,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6734: checking for $ac_word" >&5 +echo "configure:6749: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6759,7 +6774,7 @@ fi echo $ac_n "checking "make for VPATH support"""... $ac_c" 1>&6 -echo "configure:6763: checking "make for VPATH support"" >&5 +echo "configure:6778: checking "make for VPATH support"" >&5 cat - << EOF > confMake check : file cp \$? \$@ @@ -6770,7 +6785,7 @@ if test ! -d sub ; then mkdir sub fi echo dummy > sub/file -${MAKE-make} -f confMake VPATH=sub 2> config.log > /dev/null +${MAKE-make} -f confMake VPATH=sub 2>&5 > /dev/null RESULT=$? rm -f sub/file check final_file confMake rmdir sub @@ -6788,7 +6803,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6792: checking for $ac_word" >&5 +echo "configure:6807: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6822,7 +6837,7 @@ test -n "$YACC" || YACC="yacc" # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6826: checking for $ac_word" >&5 +echo "configure:6841: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6856,7 +6871,7 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:6860: checking for yywrap in -l$ac_lib" >&5 +echo "configure:6875: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6864,7 +6879,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <<EOF -#line 6868 "configure" +#line 6883 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6875,7 +6890,7 @@ int main() { yywrap() ; return 0; } EOF -if { (eval echo configure:6879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6899,7 +6914,7 @@ fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:6903: checking whether ln -s works" >&5 +echo "configure:6918: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7057,6 +7072,7 @@ GUI_TK_LIBRARY= GUI_TK_LINK= WXGTK12= +WXGTK127= WXGTK13= WXWINE= @@ -7066,7 +7082,7 @@ if test "$wxUSE_CYGWIN" = 1 || test "$wxUSE_MINGW" = 1 ; then echo "configure: warning: skipping windows.h check for cross-compilation" 1>&2 else echo $ac_n "checking for Windows headers""... $ac_c" 1>&6 -echo "configure:7070: checking for Windows headers" >&5 +echo "configure:7086: checking for Windows headers" >&5 ac_find_includes= for ac_dir in $SEARCH_INCLUDE; @@ -7089,10 +7105,10 @@ for ac_dir in $SEARCH_INCLUDE; INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS msw" LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lcrtdll -ladvapi32 -lwsock32" - if test "$wxUSE_ODBC" = "yes" ; then - LIBS="$LIBS -lodbc32 -lole32 -loleaut32" - fi - + if test "$wxUSE_ODBC" = "yes" ; then + LIBS="$LIBS -lodbc32 -lole32 -loleaut32" + fi + if test "$wxUSE_MINGW" = 1; then LDFLAGS="$LDFLAGS -mwindows" fi @@ -7135,7 +7151,134 @@ if test "$wxUSE_GTK" = 1; then # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7139: checking for $ac_word" >&5 +echo "configure:7155: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GTK_CONFIG" in + /*) + ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GTK_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no" + ;; +esac +fi +GTK_CONFIG="$ac_cv_path_GTK_CONFIG" +if test -n "$GTK_CONFIG"; then + echo "$ac_t""$GTK_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + min_gtk_version=1.2.7 + echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 +echo "configure:7190: checking for GTK - version >= $min_gtk_version" >&5 + no_gtk="" + if test "$GTK_CONFIG" != "no" ; then + GTK_CFLAGS=`$GTK_CONFIG --cflags` + GTK_LIBS=`$GTK_CONFIG --libs gthread` + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat > conftest.$ac_ext <<EOF +#line 7203 "configure" +#include "confdefs.h" + +#include <gtk/gtk.h> +#include <gtk/gtkfeatures.h> +#include <stdio.h> +#include <stdlib.h> + +int +main () +{ + int major, minor, micro; + + if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((GTK_MAJOR_VERSION != gtk_major_version) || + (GTK_MINOR_VERSION != gtk_minor_version) || + (GTK_MICRO_VERSION != gtk_micro_version)) { + printf("Headers vs. library version mismatch!\n"); + exit(1); + } + + if (gtk_minor_version == 1) return FALSE; + + return !((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))); +} + +EOF +if { (eval echo configure:7236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + no_gtk=yes +fi +rm -fr conftest* +fi + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + else + no_gtk=yes + fi + if test "x$no_gtk" = x ; then + echo "$ac_t""yes" 1>&6 + WXGTK127=1 + else + echo "$ac_t""no" 1>&6 + GTK_CFLAGS="" + GTK_LIBS="" + : + fi + + + + + if test x$gtk_config_exec_prefix != x ; then + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config + fi + fi + if test x$gtk_config_prefix != x ; then + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config + fi + fi + + # Extract the first word of "gtk-config", so it can be a program name with args. +set dummy gtk-config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:7282: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7170,7 +7313,7 @@ fi min_gtk_version=1.2.3 echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 -echo "configure:7174: checking for GTK - version >= $min_gtk_version" >&5 +echo "configure:7317: checking for GTK - version >= $min_gtk_version" >&5 no_gtk="" if test "$GTK_CONFIG" != "no" ; then GTK_CFLAGS=`$GTK_CONFIG --cflags` @@ -7183,7 +7326,7 @@ echo "configure:7174: checking for GTK - version >= $min_gtk_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext <<EOF -#line 7187 "configure" +#line 7330 "configure" #include "confdefs.h" #include <gtk/gtk.h> @@ -7216,7 +7359,7 @@ main () } EOF -if { (eval echo configure:7220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -7277,7 +7420,7 @@ fi GUIDIST=GTK_DIST echo $ac_n "checking for gdk_im_open in -lgdk""... $ac_c" 1>&6 -echo "configure:7281: checking for gdk_im_open in -lgdk" >&5 +echo "configure:7424: checking for gdk_im_open in -lgdk" >&5 ac_lib_var=`echo gdk'_'gdk_im_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7285,7 +7428,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgdk $LIBS" cat > conftest.$ac_ext <<EOF -#line 7289 "configure" +#line 7432 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7296,7 +7439,7 @@ int main() { gdk_im_open() ; return 0; } EOF -if { (eval echo configure:7300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7323,7 +7466,7 @@ fi if test "$wxUSE_WINE" = 1; then echo $ac_n "checking for WINE includes""... $ac_c" 1>&6 -echo "configure:7327: checking for WINE includes" >&5 +echo "configure:7470: checking for WINE includes" >&5 ac_find_includes= for ac_dir in $SEARCH_INCLUDE; @@ -7344,7 +7487,7 @@ for ac_dir in $SEARCH_INCLUDE; XPM_LINK="" echo $ac_n "checking for Xpm library""... $ac_c" 1>&6 -echo "configure:7348: checking for Xpm library" >&5 +echo "configure:7491: checking for Xpm library" >&5 ac_find_libraries= for ac_dir in $SEARCH_LIB; @@ -7372,7 +7515,7 @@ EOF MESA_LINK="" echo $ac_n "checking for Mesa library""... $ac_c" 1>&6 -echo "configure:7376: checking for Mesa library" >&5 +echo "configure:7519: checking for Mesa library" >&5 ac_find_libraries= for ac_dir in $SEARCH_LIB; @@ -7416,7 +7559,7 @@ if test "$wxUSE_MOTIF" = 1; then # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:7420: checking for X" >&5 +echo "configure:7563: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -7478,12 +7621,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext <<EOF -#line 7482 "configure" +#line 7625 "configure" #include "confdefs.h" #include <$x_direct_test_include> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7487: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7630: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7552,14 +7695,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <<EOF -#line 7556 "configure" +#line 7699 "configure" #include "confdefs.h" int main() { ${x_direct_test_function}() ; return 0; } EOF -if { (eval echo configure:7563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -7665,17 +7808,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:7669: checking whether -R must be followed by a space" >&5 +echo "configure:7812: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <<EOF -#line 7672 "configure" +#line 7815 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:7679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -7691,14 +7834,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <<EOF -#line 7695 "configure" +#line 7838 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:7702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -7730,7 +7873,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:7734: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:7877: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7738,7 +7881,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <<EOF -#line 7742 "configure" +#line 7885 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7749,7 +7892,7 @@ int main() { dnet_ntoa() ; return 0; } EOF -if { (eval echo configure:7753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7771,7 +7914,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:7775: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:7918: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7779,7 +7922,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <<EOF -#line 7783 "configure" +#line 7926 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7790,7 +7933,7 @@ int main() { dnet_ntoa() ; return 0; } EOF -if { (eval echo configure:7794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7819,12 +7962,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:7823: checking for gethostbyname" >&5 +echo "configure:7966: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7828 "configure" +#line 7971 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname(); below. */ @@ -7847,7 +7990,7 @@ gethostbyname(); ; return 0; } EOF -if { (eval echo configure:7851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -7868,7 +8011,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:7872: checking for gethostbyname in -lnsl" >&5 +echo "configure:8015: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7876,7 +8019,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 7880 "configure" +#line 8023 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7887,7 +8030,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:7891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7917,12 +8060,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:7921: checking for connect" >&5 +echo "configure:8064: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7926 "configure" +#line 8069 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect(); below. */ @@ -7945,7 +8088,7 @@ connect(); ; return 0; } EOF -if { (eval echo configure:7949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -7966,7 +8109,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:7970: checking for connect in -lsocket" >&5 +echo "configure:8113: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7974,7 +8117,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 7978 "configure" +#line 8121 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7985,7 +8128,7 @@ int main() { connect() ; return 0; } EOF -if { (eval echo configure:7989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8132: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8009,12 +8152,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:8013: checking for remove" >&5 +echo "configure:8156: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8018 "configure" +#line 8161 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove(); below. */ @@ -8037,7 +8180,7 @@ remove(); ; return 0; } EOF -if { (eval echo configure:8041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -8058,7 +8201,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:8062: checking for remove in -lposix" >&5 +echo "configure:8205: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8066,7 +8209,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <<EOF -#line 8070 "configure" +#line 8213 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -8077,7 +8220,7 @@ int main() { remove() ; return 0; } EOF -if { (eval echo configure:8081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8101,12 +8244,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:8105: checking for shmat" >&5 +echo "configure:8248: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8110 "configure" +#line 8253 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat(); below. */ @@ -8129,7 +8272,7 @@ shmat(); ; return 0; } EOF -if { (eval echo configure:8133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -8150,7 +8293,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:8154: checking for shmat in -lipc" >&5 +echo "configure:8297: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8158,7 +8301,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <<EOF -#line 8162 "configure" +#line 8305 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -8169,7 +8312,7 @@ int main() { shmat() ; return 0; } EOF -if { (eval echo configure:8173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8202,7 +8345,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:8206: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:8349: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8210,7 +8353,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 8214 "configure" +#line 8357 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -8221,7 +8364,7 @@ int main() { IceConnectionNumber() ; return 0; } EOF -if { (eval echo configure:8225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8259,7 +8402,7 @@ fi COMPILED_X_PROGRAM=0 echo $ac_n "checking for Motif/Lesstif headers""... $ac_c" 1>&6 -echo "configure:8263: checking for Motif/Lesstif headers" >&5 +echo "configure:8406: checking for Motif/Lesstif headers" >&5 ac_find_includes= for ac_dir in $SEARCH_INCLUDE; @@ -8274,7 +8417,7 @@ for ac_dir in $SEARCH_INCLUDE; echo "$ac_t""found $ac_find_includes" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8278 "configure" +#line 8421 "configure" #include "confdefs.h" #include <Xm/Xm.h> @@ -8287,7 +8430,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8291: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""found in default search path" 1>&6 @@ -8308,7 +8451,7 @@ rm -f conftest* if test "$COMPILED_X_PROGRAM" = 0; then echo $ac_n "checking for Motif/Lesstif library""... $ac_c" 1>&6 -echo "configure:8312: checking for Motif/Lesstif library" >&5 +echo "configure:8455: checking for Motif/Lesstif library" >&5 ac_find_libraries= for ac_dir in $SEARCH_LIB; @@ -8347,7 +8490,7 @@ for ac_dir in $SEARCH_LIB; echo "$ac_t""found at $ac_find_libraries" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8351 "configure" +#line 8494 "configure" #include "confdefs.h" #include <Xm/Xm.h> @@ -8360,7 +8503,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8364: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8507: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""found in default search path" 1>&6 @@ -8383,7 +8526,7 @@ rm -f conftest* XPM_LINK="" echo $ac_n "checking for Xpm library""... $ac_c" 1>&6 -echo "configure:8387: checking for Xpm library" >&5 +echo "configure:8530: checking for Xpm library" >&5 ac_find_libraries= for ac_dir in $SEARCH_LIB; @@ -8415,7 +8558,7 @@ EOF echo "$ac_t""found at $ac_find_libraries" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8419 "configure" +#line 8562 "configure" #include "confdefs.h" #include <X11/xpm.h> @@ -8428,11 +8571,11 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8432: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8575: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - XPM_LINK="-lXpm " - cat >> confdefs.h <<\EOF + XPM_LINK="-lXpm " + cat >> confdefs.h <<\EOF #define wxHAVE_LIB_XPM 1 EOF @@ -8489,9 +8632,15 @@ else TOOLKIT_DIR="os2" fi + if test "$wxUSE_DEBUG_FLAG" = "yes"; then + TOOLKIT_NAME="${TOOLKIT_DIR}d" + else + TOOLKIT_NAME="${TOOLKIT_DIR}" + fi + TOOLKIT_DEF="-D__WX${TOOLKIT}__" - WX_LIBRARY="wx_${TOOLKIT_DIR}" + WX_LIBRARY="wx_${TOOLKIT_NAME}" ALL_OBJECTS="\$(GUIOBJS) \$(COMMONOBJS) \$(GENERICOBJS) \$(UNIXOBJS) \$(HTMLOBJS) \$(OGLOBJS)" @@ -8524,7 +8673,14 @@ fi else USE_GUI=0 - TOOLKIT_DIR="base" + TOOLKIT_DIR="base" + + if test "$wxUSE_DEBUG_FLAG" = "yes"; then + TOOLKIT_NAME="${TOOLKIT_DIR}d" + else + TOOLKIT_NAME="${TOOLKIT_DIR}" + fi + TOOLKIT_DEF="-D__WXBASE__" ALL_OBJECTS="\$(BASE_OBJS) \${BASE_UNIX_OBJS}" @@ -8534,7 +8690,7 @@ else ALL_OBJECTS="${ALL_OBJECTS} \$(ZLIBOBJS)" fi - WX_LIBRARY="wxbase" + WX_LIBRARY="wx_${TOOLKIT_NAME}" PORT_FILES="src/files.lst" RPM_FILES="src/rpmfiles.lst" @@ -8565,6 +8721,7 @@ PIC_FLAG= WX_ALL= WX_ALL_INSTALLED= BURNT_LIBRARY_NAME= +WX_TARGET_LIBRARY_SONAME= if test "$wxUSE_SHARED" = "yes"; then @@ -8574,12 +8731,15 @@ if test "$wxUSE_SHARED" = "yes"; then SHARED_LD="${CC} -shared -fPIC -o" PIC_FLAG="-fPIC" else + LDFLAGS="-L/usr/lib" + SHARED_LD="${CXX} -b -o" PIC_FLAG="+Z" fi - WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_DIR}.sl" - WX_LIBRARY_NAME_SHARED_GL="libwx_${TOOLKIT_DIR}_gl.sl" + WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_NAME}.sl" + WX_LIBRARY_NAME_SHARED_GL="libwx_${TOOLKIT_NAME}_gl.sl" if test "$wxUSE_OPENGL" = "yes"; then + WX_ALL_INSTALLED="preinstall_gl" WX_ALL="${WX_LIBRARY_NAME_SHARED} ${WX_LIBRARY_NAME_SHARED_GL}" else WX_ALL="${WX_LIBRARY_NAME_SHARED}" @@ -8592,6 +8752,7 @@ if test "$wxUSE_SHARED" = "yes"; then if test "$wxUSE_BURNT_NAME" = "yes" ; then BURNT_LIBRARY_NAME="-Wl,-soname,${WX_LIBRARY_LINK1}" BURNT_LIBRARY_NAME_GL="-Wl,-soname,${WX_LIBRARY_LINK1_GL}" + WX_TARGET_LIBRARY_SONAME="-Wl,-soname,\$(TARGETLIB_LINK1)" fi if test "$wxUSE_OPENGL" = "yes"; then WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL" @@ -8620,6 +8781,8 @@ if test "$wxUSE_SHARED" = "yes"; then if test "$GCC" = yes ; then SHARED_LD="${CC} -shared -o" PIC_FLAG="-fPIC" + + CPPFLAGS="$CPPFLAGS -isystem /usr/openwin/include" else SHARED_LD="${CXX} -G -o" PIC_FLAG="-KPIC" @@ -8669,12 +8832,22 @@ if test "$wxUSE_SHARED" = "yes"; then *-*-cygwin32* ) WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}" WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}" - WX_ALL="${WX_LIBRARY_NAME_STATIC}" + if test "$wxUSE_OPENGL" = "yes"; then + WX_ALL_INSTALLED="preinstall_gl" + WX_ALL="${WX_LIBRARY_NAME_STATIC} ${WX_LIBRARY_NAME_STATIC_GL}" + else + WX_ALL="${WX_LIBRARY_NAME_STATIC}" + fi ;; *-*-mingw32* ) WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}" WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}" - WX_ALL="${WX_LIBRARY_NAME_STATIC}" + if test "$wxUSE_OPENGL" = "yes"; then + WX_ALL_INSTALLED="preinstall_gl" + WX_ALL="${WX_LIBRARY_NAME_STATIC} ${WX_LIBRARY_NAME_STATIC_GL}" + else + WX_ALL="${WX_LIBRARY_NAME_STATIC}" + fi ;; *-pc-os2_emx ) WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}" @@ -8698,7 +8871,18 @@ if test "$wxUSE_SHARED" = "yes"; then else WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}" WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}" - WX_ALL="${WX_LIBRARY_NAME_STATIC}" + + if test "$wxUSE_OPENGL" = "yes"; then + WX_ALL_INSTALLED="preinstall_gl" + WX_ALL="${WX_LIBRARY_NAME_STATIC} ${WX_LIBRARY_NAME_STATIC_GL}" + else + WX_ALL="${WX_LIBRARY_NAME_STATIC}" + fi + + if test "$wxUSE_GUI" = "no"; then + WX_ALL_INSTALLED="${WX_ALL_INSTALLED} preinstall" + fi + WX_TARGET_LIBRARY_TYPE="a" fi @@ -8707,17 +8891,17 @@ for ac_hdr in strings.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8711: checking for $ac_hdr" >&5 +echo "configure:8895: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8716 "configure" +#line 8900 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8721: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8905: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8747,17 +8931,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8751: checking for $ac_hdr" >&5 +echo "configure:8935: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8756 "configure" +#line 8940 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8761: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8787,17 +8971,17 @@ for ac_hdr in wchar.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8791: checking for $ac_hdr" >&5 +echo "configure:8975: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8796 "configure" +#line 8980 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8827,17 +9011,17 @@ for ac_hdr in wcstr.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8831: checking for $ac_hdr" >&5 +echo "configure:9015: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8836 "configure" +#line 9020 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8841: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9025: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8867,17 +9051,17 @@ for ac_hdr in fnmatch.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8871: checking for $ac_hdr" >&5 +echo "configure:9055: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8876 "configure" +#line 9060 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9065: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8910,17 +9094,17 @@ if test "$wxUSE_GUI" = "yes"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8914: checking for $ac_hdr" >&5 +echo "configure:9098: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8919 "configure" +#line 9103 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9108: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8951,12 +9135,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:8955: checking for ANSI C header files" >&5 +echo "configure:9139: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8960 "configure" +#line 9144 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -8964,7 +9148,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9152: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8981,7 +9165,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 8985 "configure" +#line 9169 "configure" #include "confdefs.h" #include <string.h> EOF @@ -8999,7 +9183,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 9003 "configure" +#line 9187 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -9020,7 +9204,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 9024 "configure" +#line 9208 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -9031,7 +9215,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:9035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -9055,12 +9239,12 @@ EOF fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:9059: checking for mode_t" >&5 +echo "configure:9243: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9064 "configure" +#line 9248 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -9088,12 +9272,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:9092: checking for off_t" >&5 +echo "configure:9276: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9097 "configure" +#line 9281 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -9121,12 +9305,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:9125: checking for pid_t" >&5 +echo "configure:9309: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9130 "configure" +#line 9314 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -9154,12 +9338,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:9158: checking for size_t" >&5 +echo "configure:9342: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9163 "configure" +#line 9347 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -9187,12 +9371,12 @@ EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:9191: checking for uid_t in sys/types.h" >&5 +echo "configure:9375: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9196 "configure" +#line 9380 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -9223,13 +9407,13 @@ fi echo $ac_n "checking for pw_gecos in struct passwd""... $ac_c" 1>&6 -echo "configure:9227: checking for pw_gecos in struct passwd" >&5 +echo "configure:9411: checking for pw_gecos in struct passwd" >&5 if eval "test \"`echo '$''{'wx_cv_struct_pw_gecos'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9233 "configure" +#line 9417 "configure" #include "confdefs.h" #include <pwd.h> int main() { @@ -9240,7 +9424,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:9244: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9428: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_struct_pw_gecos=yes @@ -9270,12 +9454,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:9274: checking for working const" >&5 +echo "configure:9458: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9279 "configure" +#line 9463 "configure" #include "confdefs.h" int main() { @@ -9324,7 +9508,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:9328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -9345,21 +9529,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:9349: checking for inline" >&5 +echo "configure:9533: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 9356 "configure" +#line 9540 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:9363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9547: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -9386,7 +9570,7 @@ esac echo $ac_n "checking size of char""... $ac_c" 1>&6 -echo "configure:9390: checking size of char" >&5 +echo "configure:9574: checking size of char" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9394,7 +9578,7 @@ else ac_cv_sizeof_char=1 else cat > conftest.$ac_ext <<EOF -#line 9398 "configure" +#line 9582 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -9405,7 +9589,7 @@ main() exit(0); } EOF -if { (eval echo configure:9409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_char=`cat conftestval` else @@ -9425,7 +9609,7 @@ EOF echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:9429: checking size of short" >&5 +echo "configure:9613: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9433,7 +9617,7 @@ else ac_cv_sizeof_short=2 else cat > conftest.$ac_ext <<EOF -#line 9437 "configure" +#line 9621 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -9444,7 +9628,7 @@ main() exit(0); } EOF -if { (eval echo configure:9448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -9464,7 +9648,7 @@ EOF echo $ac_n "checking size of int *""... $ac_c" 1>&6 -echo "configure:9468: checking size of int *" >&5 +echo "configure:9652: checking size of int *" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int_p'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9472,7 +9656,7 @@ else ac_cv_sizeof_int_p=4 else cat > conftest.$ac_ext <<EOF -#line 9476 "configure" +#line 9660 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -9483,7 +9667,7 @@ main() exit(0); } EOF -if { (eval echo configure:9487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int_p=`cat conftestval` else @@ -9503,7 +9687,7 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:9507: checking size of int" >&5 +echo "configure:9691: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9511,7 +9695,7 @@ else ac_cv_sizeof_int=4 else cat > conftest.$ac_ext <<EOF -#line 9515 "configure" +#line 9699 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -9522,7 +9706,7 @@ main() exit(0); } EOF -if { (eval echo configure:9526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -9542,7 +9726,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:9546: checking size of long" >&5 +echo "configure:9730: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9550,7 +9734,7 @@ else ac_cv_sizeof_long=4 else cat > conftest.$ac_ext <<EOF -#line 9554 "configure" +#line 9738 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -9561,7 +9745,7 @@ main() exit(0); } EOF -if { (eval echo configure:9565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -9581,7 +9765,7 @@ EOF echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:9585: checking size of long long" >&5 +echo "configure:9769: checking size of long long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9589,7 +9773,7 @@ else ac_cv_sizeof_long_long=0 else cat > conftest.$ac_ext <<EOF -#line 9593 "configure" +#line 9777 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -9600,7 +9784,7 @@ main() exit(0); } EOF -if { (eval echo configure:9604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long=`cat conftestval` else @@ -9621,14 +9805,14 @@ EOF echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:9625: checking whether byte ordering is bigendian" >&5 +echo "configure:9809: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext <<EOF -#line 9632 "configure" +#line 9816 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -9639,11 +9823,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:9643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext <<EOF -#line 9647 "configure" +#line 9831 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -9654,7 +9838,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:9658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -9674,7 +9858,7 @@ if test "$cross_compiling" = yes; then ac_cv_c_bigendian=unknown else cat > conftest.$ac_ext <<EOF -#line 9678 "configure" +#line 9862 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -9687,7 +9871,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:9691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -9734,17 +9918,17 @@ cross_compiling=$ac_cv_prog_cxx_cross do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:9738: checking for $ac_hdr" >&5 +echo "configure:9922: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9743 "configure" +#line 9927 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9748: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9932: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9792,7 +9976,7 @@ cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking if C++ compiler supports bool""... $ac_c" 1>&6 -echo "configure:9796: checking if C++ compiler supports bool" >&5 +echo "configure:9980: checking if C++ compiler supports bool" >&5 if eval "test \"`echo '$''{'wx_cv_cpp_bool'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9807,7 +9991,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <<EOF -#line 9811 "configure" +#line 9995 "configure" #include "confdefs.h" @@ -9819,7 +10003,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:9823: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10007: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF @@ -9861,13 +10045,13 @@ EOF echo $ac_n "checking if you need GNU extensions""... $ac_c" 1>&6 -echo "configure:9865: checking if you need GNU extensions" >&5 +echo "configure:10049: checking if you need GNU extensions" >&5 if eval "test \"`echo '$''{'wx_cv_gnu_extensions'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9871 "configure" +#line 10055 "configure" #include "confdefs.h" #include <features.h> int main() { @@ -9880,7 +10064,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:9884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10068: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_gnu_extensions=yes else @@ -9905,7 +10089,7 @@ fi echo $ac_n "checking for wcslen in -lc""... $ac_c" 1>&6 -echo "configure:9909: checking for wcslen in -lc" >&5 +echo "configure:10093: checking for wcslen in -lc" >&5 ac_lib_var=`echo c'_'wcslen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -9913,7 +10097,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <<EOF -#line 9917 "configure" +#line 10101 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -9924,7 +10108,7 @@ int main() { wcslen() ; return 0; } EOF -if { (eval echo configure:9928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9950,7 +10134,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for wcslen in -lw""... $ac_c" 1>&6 -echo "configure:9954: checking for wcslen in -lw" >&5 +echo "configure:10138: checking for wcslen in -lw" >&5 ac_lib_var=`echo w'_'wcslen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -9958,7 +10142,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lw $LIBS" cat > conftest.$ac_ext <<EOF -#line 9962 "configure" +#line 10146 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -9969,7 +10153,7 @@ int main() { wcslen() ; return 0; } EOF -if { (eval echo configure:9973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10000,12 +10184,12 @@ fi echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:10004: checking for vprintf" >&5 +echo "configure:10188: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10009 "configure" +#line 10193 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vprintf(); below. */ @@ -10028,7 +10212,7 @@ vprintf(); ; return 0; } EOF -if { (eval echo configure:10032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -10052,12 +10236,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:10056: checking for _doprnt" >&5 +echo "configure:10240: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10061 "configure" +#line 10245 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt(); below. */ @@ -10080,7 +10264,7 @@ _doprnt(); ; return 0; } EOF -if { (eval echo configure:10084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -10105,132 +10289,121 @@ fi fi -for ac_func in vsnprintf -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10112: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 10117 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + + + + +echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6 +echo "configure:10305: checking for vsnprintf" >&5 +if eval "test \"`echo '$''{'wx_cv_func_vsnprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext <<EOF +#line 10311 "configure" +#include "confdefs.h" + + #include <stdio.h> + #include <stdarg.h> + int main() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif + int wx_test_vsnprintf(const char *, ...); + wx_test_vsnprintf("%s"); + return 0; + } + + int wx_test_vsnprintf(const char *fmt, ...) + { + char *s; + + va_list argp; + va_start(argp, fmt); + vsnprintf(s, 42, fmt, argp); + va_end(argp); + ; return 0; } EOF -if { (eval echo configure:10140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10336: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" + + cat >> confdefs.h <<\EOF +#define HAVE_VSNPRINTF 1 +EOF + + wx_cv_func_vsnprintf=yes + else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_func_$ac_func=no" + + echo "configure: warning: unsafe function sprintf will be used instead of snprintf" 1>&2 + wx_cv_func_vsnprintf=no + fi rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - cat >> confdefs.h <<\EOF -#define HAVE_VSNPRINTF 1 -EOF -else - echo "$ac_t""no" 1>&6 -echo "configure: warning: unsafe function sprintf will be used instead of snprintf" 1>&2 - fi -done - - - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross +echo "$ac_t""$wx_cv_func_vsnprintf" 1>&6 echo $ac_n "checking for vsscanf""... $ac_c" 1>&6 -echo "configure:10180: checking for vsscanf" >&5 +echo "configure:10361: checking for vsscanf" >&5 if eval "test \"`echo '$''{'wx_cv_func_vsscanf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - wx_cv_func_vsscanf=no - -else cat > conftest.$ac_ext <<EOF -#line 10190 "configure" +#line 10367 "configure" #include "confdefs.h" -#ifdef __cplusplus -extern "C" void exit(int); -#endif - - #include <stdio.h> - #include <stdarg.h> - int try_vsscanf(const char *format, ...) - { - va_list ap; - va_start(ap, format); + #include <stdio.h> + #include <stdarg.h> + +int main() { - vsscanf("17", format, ap); + int wx_test_vsscanf(const char *, ...); - va_end(ap); + wx_test_vsscanf("%d"); + return 0; } - int main() + int wx_test_vsscanf(const char *fmt, ...) { - int i; - try_vsscanf("%d", &i); - return i == 17 ? 0 : 1; - } - + va_list argp; + va_start(argp, fmt); + vsscanf("42", fmt, argp); + va_end(argp); + +; return 0; } EOF -if { (eval echo configure:10217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +if { (eval echo configure:10390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* - cat >> confdefs.h <<\EOF + cat >> confdefs.h <<\EOF #define HAVE_VSSCANF 1 EOF - wx_cv_func_vsscanf=yes - + wx_cv_func_vsscanf=yes + else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -fr conftest* - wx_cv_func_vsscanf=no -fi -rm -fr conftest* + rm -rf conftest* + + wx_cv_func_vsscanf=no + fi - +rm -f conftest* fi @@ -10250,12 +10423,12 @@ if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then for ac_func in sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10254: checking for $ac_func" >&5 +echo "configure:10427: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10259 "configure" +#line 10432 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -10278,7 +10451,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:10282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10307,17 +10480,79 @@ done echo "configure: warning: No POSIX signal functions on this system, wxApp::OnFatalException will not be called" 1>&2 wxUSE_ON_FATAL_EXCEPTION=no fi + + if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then + + ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + + + echo $ac_n "checking for sa_handler type""... $ac_c" 1>&6 +echo "configure:10496: checking for sa_handler type" >&5 +if eval "test \"`echo '$''{'wx_cv_type_sa_handler'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext <<EOF +#line 10502 "configure" +#include "confdefs.h" +#include <signal.h> +int main() { + + extern void testSigHandler(int); + + struct sigaction sa; + sa.sa_handler = testSigHandler; + +; return 0; } +EOF +if { (eval echo configure:10514: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + wx_cv_type_sa_handler=int + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + + wx_cv_type_sa_handler=void + +fi +rm -f conftest* + +fi + +echo "$ac_t""$wx_cv_type_sa_handler" 1>&6 + + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + + + cat >> confdefs.h <<EOF +#define wxTYPE_SA_HANDLER $wx_cv_type_sa_handler +EOF + + fi fi for ac_func in vfork do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10316: checking for $ac_func" >&5 +echo "configure:10551: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10321 "configure" +#line 10556 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -10340,7 +10575,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:10344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10368,12 +10603,12 @@ done for ac_func in timegm do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10372: checking for $ac_func" >&5 +echo "configure:10607: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10377 "configure" +#line 10612 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -10396,7 +10631,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:10400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10435,12 +10670,12 @@ if test "$HAVE_SOME_SLEEP_FUNC" != 1; then for ac_func in nanosleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10439: checking for $ac_func" >&5 +echo "configure:10674: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10444 "configure" +#line 10679 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -10463,7 +10698,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:10467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10488,7 +10723,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for nanosleep in -lposix4""... $ac_c" 1>&6 -echo "configure:10492: checking for nanosleep in -lposix4" >&5 +echo "configure:10727: checking for nanosleep in -lposix4" >&5 ac_lib_var=`echo posix4'_'nanosleep | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -10496,7 +10731,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix4 $LIBS" cat > conftest.$ac_ext <<EOF -#line 10500 "configure" +#line 10735 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -10507,7 +10742,7 @@ int main() { nanosleep() ; return 0; } EOF -if { (eval echo configure:10511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10535,12 +10770,12 @@ else for ac_func in usleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10539: checking for $ac_func" >&5 +echo "configure:10774: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10544 "configure" +#line 10779 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -10563,7 +10798,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:10567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10602,12 +10837,12 @@ fi for ac_func in uname gethostname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10606: checking for $ac_func" >&5 +echo "configure:10841: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10611 "configure" +#line 10846 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -10630,7 +10865,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:10634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10667,12 +10902,12 @@ cross_compiling=$ac_cv_prog_cxx_cross for ac_func in strtok_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10671: checking for $ac_func" >&5 +echo "configure:10906: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10676 "configure" +#line 10911 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -10698,7 +10933,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:10702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10735,12 +10970,12 @@ INET_LINK= for ac_func in inet_addr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10739: checking for $ac_func" >&5 +echo "configure:10974: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10744 "configure" +#line 10979 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -10763,7 +10998,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:10767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10788,7 +11023,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_addr in -lnsl""... $ac_c" 1>&6 -echo "configure:10792: checking for inet_addr in -lnsl" >&5 +echo "configure:11027: checking for inet_addr in -lnsl" >&5 ac_lib_var=`echo nsl'_'inet_addr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -10796,7 +11031,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 10800 "configure" +#line 11035 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -10807,7 +11042,7 @@ int main() { inet_addr() ; return 0; } EOF -if { (eval echo configure:10811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10826,7 +11061,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_addr in -lresolv""... $ac_c" 1>&6 -echo "configure:10830: checking for inet_addr in -lresolv" >&5 +echo "configure:11065: checking for inet_addr in -lresolv" >&5 ac_lib_var=`echo resolv'_'inet_addr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -10834,7 +11069,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <<EOF -#line 10838 "configure" +#line 11073 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -10845,7 +11080,7 @@ int main() { inet_addr() ; return 0; } EOF -if { (eval echo configure:10849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10878,12 +11113,12 @@ done for ac_func in inet_aton do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:10882: checking for $ac_func" >&5 +echo "configure:11117: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10887 "configure" +#line 11122 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -10906,7 +11141,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:10910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -10931,7 +11166,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_aton in -l$INET_LINK""... $ac_c" 1>&6 -echo "configure:10935: checking for inet_aton in -l$INET_LINK" >&5 +echo "configure:11170: checking for inet_aton in -l$INET_LINK" >&5 ac_lib_var=`echo $INET_LINK'_'inet_aton | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -10939,7 +11174,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$INET_LINK $LIBS" cat > conftest.$ac_ext <<EOF -#line 10943 "configure" +#line 11178 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -10950,7 +11185,7 @@ int main() { inet_aton() ; return 0; } EOF -if { (eval echo configure:10954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11056,16 +11291,22 @@ fi if test "$wxUSE_THREADS" = "yes" ; then - echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:11061: checking for pthread_create in -lpthread" >&5 -ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` + if test "$wxUSE_AIX" = 1; then + THREADS_LIB=pthreads + else + THREADS_LIB=pthread + fi + + echo $ac_n "checking for pthread_create in -l$THREADS_LIB""... $ac_c" 1>&6 +echo "configure:11302: checking for pthread_create in -l$THREADS_LIB" >&5 +ac_lib_var=`echo $THREADS_LIB'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lpthread $LIBS" +LIBS="-l$THREADS_LIB $LIBS" cat > conftest.$ac_ext <<EOF -#line 11069 "configure" +#line 11310 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11076,7 +11317,7 @@ int main() { pthread_create() ; return 0; } EOF -if { (eval echo configure:11080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11093,13 +11334,13 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 THREADS_OBJ="threadpsx.lo" - THREADS_LINK="pthread" + THREADS_LINK=$THREADS_LIB else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:11103: checking for pthread_create in -lc_r" >&5 +echo "configure:11344: checking for pthread_create in -lc_r" >&5 ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11107,7 +11348,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <<EOF -#line 11111 "configure" +#line 11352 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11118,7 +11359,7 @@ int main() { pthread_create() ; return 0; } EOF -if { (eval echo configure:11122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11142,17 +11383,17 @@ else ac_safe=`echo "sys/prctl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/prctl.h""... $ac_c" 1>&6 -echo "configure:11146: checking for sys/prctl.h" >&5 +echo "configure:11387: checking for sys/prctl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 11151 "configure" +#line 11392 "configure" #include "confdefs.h" #include <sys/prctl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11156: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11397: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11192,12 +11433,12 @@ if test "$wxUSE_THREADS" = "yes" ; then for ac_func in thr_setconcurrency do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:11196: checking for $ac_func" >&5 +echo "configure:11437: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 11201 "configure" +#line 11442 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -11220,7 +11461,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:11224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -11250,17 +11491,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11254: checking for $ac_hdr" >&5 +echo "configure:11495: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 11259 "configure" +#line 11500 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11264: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11505: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11288,7 +11529,7 @@ done echo $ac_n "checking for sched_yield in -l$THREADS_LINK""... $ac_c" 1>&6 -echo "configure:11292: checking for sched_yield in -l$THREADS_LINK" >&5 +echo "configure:11533: checking for sched_yield in -l$THREADS_LINK" >&5 ac_lib_var=`echo $THREADS_LINK'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11296,7 +11537,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$THREADS_LINK $LIBS" cat > conftest.$ac_ext <<EOF -#line 11300 "configure" +#line 11541 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11307,7 +11548,7 @@ int main() { sched_yield() ; return 0; } EOF -if { (eval echo configure:11311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11329,7 +11570,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -l"posix4"""... $ac_c" 1>&6 -echo "configure:11333: checking for sched_yield in -l"posix4"" >&5 +echo "configure:11574: checking for sched_yield in -l"posix4"" >&5 ac_lib_var=`echo "posix4"'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11337,7 +11578,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l"posix4" $LIBS" cat > conftest.$ac_ext <<EOF -#line 11341 "configure" +#line 11582 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11348,7 +11589,7 @@ int main() { sched_yield() ; return 0; } EOF -if { (eval echo configure:11352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11377,8 +11618,9 @@ fi fi - echo $ac_n "checking for pthread_attr_getschedpolicy in -l$THREADS_LINK""... $ac_c" 1>&6 -echo "configure:11382: checking for pthread_attr_getschedpolicy in -l$THREADS_LINK" >&5 + HAVE_PRIOR_FUNCS=0 + echo $ac_n "checking for pthread_attr_getschedpolicy in -l$THREADS_LINK""... $ac_c" 1>&6 +echo "configure:11624: checking for pthread_attr_getschedpolicy in -l$THREADS_LINK" >&5 ac_lib_var=`echo $THREADS_LINK'_'pthread_attr_getschedpolicy | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11386,7 +11628,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$THREADS_LINK $LIBS" cat > conftest.$ac_ext <<EOF -#line 11390 "configure" +#line 11632 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11397,7 +11639,7 @@ int main() { pthread_attr_getschedpolicy() ; return 0; } EOF -if { (eval echo configure:11401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11412,33 +11654,100 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_THREAD_PRIORITY_FUNCTIONS 1 + echo $ac_n "checking for pthread_attr_setschedparam in -l$THREADS_LINK""... $ac_c" 1>&6 +echo "configure:11659: checking for pthread_attr_setschedparam in -l$THREADS_LINK" >&5 +ac_lib_var=`echo $THREADS_LINK'_'pthread_attr_setschedparam | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-l$THREADS_LINK $LIBS" +cat > conftest.$ac_ext <<EOF +#line 11667 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_attr_setschedparam(); + +int main() { +pthread_attr_setschedparam() +; return 0; } EOF +if { (eval echo configure:11678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for sched_get_priority_max in -l$THREADS_LINK""... $ac_c" 1>&6 +echo "configure:11694: checking for sched_get_priority_max in -l$THREADS_LINK" >&5 +ac_lib_var=`echo $THREADS_LINK'_'sched_get_priority_max | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-l$THREADS_LINK $LIBS" +cat > conftest.$ac_ext <<EOF +#line 11702 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sched_get_priority_max(); + +int main() { +sched_get_priority_max() +; return 0; } +EOF +if { (eval echo configure:11713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + HAVE_PRIOR_FUNCS=1 else echo "$ac_t""no" 1>&6 -echo $ac_n "checking for pthread_attr_getschedpolicy in -l"posix4"""... $ac_c" 1>&6 -echo "configure:11423: checking for pthread_attr_getschedpolicy in -l"posix4"" >&5 -ac_lib_var=`echo "posix4"'_'pthread_attr_getschedpolicy | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sched_get_priority_max in -l"posix4"""... $ac_c" 1>&6 +echo "configure:11732: checking for sched_get_priority_max in -l"posix4"" >&5 +ac_lib_var=`echo "posix4"'_'sched_get_priority_max | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-l"posix4" $LIBS" cat > conftest.$ac_ext <<EOF -#line 11431 "configure" +#line 11740 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char pthread_attr_getschedpolicy(); +char sched_get_priority_max(); int main() { -pthread_attr_getschedpolicy() +sched_get_priority_max() ; return 0; } EOF -if { (eval echo configure:11442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11751: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11453,22 +11762,39 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_THREAD_PRIORITY_FUNCTIONS 1 -EOF - POSIX4_LINK="-lposix4" + + HAVE_PRIOR_FUNCS=1 + POSIX4_LINK="-lposix4" + +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + else echo "$ac_t""no" 1>&6 -echo "configure: warning: Setting thread priority will not work" 1>&2 - fi +else + echo "$ac_t""no" 1>&6 fi + if test "$HAVE_PRIOR_FUNCS" = 1; then + cat >> confdefs.h <<\EOF +#define HAVE_THREAD_PRIORITY_FUNCTIONS 1 +EOF + + else + echo "configure: warning: Setting thread priority will not work" 1>&2 + fi + echo $ac_n "checking for pthread_cancel in -l$THREADS_LINK""... $ac_c" 1>&6 -echo "configure:11472: checking for pthread_cancel in -l$THREADS_LINK" >&5 +echo "configure:11798: checking for pthread_cancel in -l$THREADS_LINK" >&5 ac_lib_var=`echo $THREADS_LINK'_'pthread_cancel | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11476,7 +11802,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$THREADS_LINK $LIBS" cat > conftest.$ac_ext <<EOF -#line 11480 "configure" +#line 11806 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11487,7 +11813,7 @@ int main() { pthread_cancel() ; return 0; } EOF -if { (eval echo configure:11491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11513,13 +11839,13 @@ fi echo $ac_n "checking for pthread_cleanup_push/pop""... $ac_c" 1>&6 -echo "configure:11517: checking for pthread_cleanup_push/pop" >&5 +echo "configure:11843: checking for pthread_cleanup_push/pop" >&5 if eval "test \"`echo '$''{'wx_cv_func_pthread_cleanup_push'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 11523 "configure" +#line 11849 "configure" #include "confdefs.h" #include <pthread.h> int main() { @@ -11529,7 +11855,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:11533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_pthread_cleanup_push=yes @@ -11570,7 +11896,7 @@ EOF else if test "$ac_cv_func_strtok_r" = "yes"; then echo $ac_n "checking if -D_REENTRANT is needed""... $ac_c" 1>&6 -echo "configure:11574: checking if -D_REENTRANT is needed" >&5 +echo "configure:11900: checking if -D_REENTRANT is needed" >&5 if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then CFLAGS="${CFLAGS} -D_REENTRANT" CXXFLAGS="${CXXFLAGS} -D_REENTRANT" @@ -11596,6 +11922,13 @@ EOF fi +if test "$WXGTK127" = 1 ; then + cat >> confdefs.h <<EOF +#define __WXGTK127__ $WXGTK127 +EOF + +fi + if test "$WXWINE" = 1 ; then TOOLKIT_DEF="${TOOLKIT_DEF} -D__WXWINE__" fi @@ -11701,17 +12034,17 @@ EOF ZLIB_LINK= ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for zlib.h""... $ac_c" 1>&6 -echo "configure:11705: checking for zlib.h" >&5 +echo "configure:12038: checking for zlib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 11710 "configure" +#line 12043 "configure" #include "confdefs.h" #include <zlib.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11715: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12048: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11728,7 +12061,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6 -echo "configure:11732: checking for deflate in -lz" >&5 +echo "configure:12065: checking for deflate in -lz" >&5 ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11736,7 +12069,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <<EOF -#line 11740 "configure" +#line 12073 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11747,7 +12080,7 @@ int main() { deflate() ; return 0; } EOF -if { (eval echo configure:11751: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11794,17 +12127,17 @@ EOF PNG_LINK= ac_safe=`echo "png.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for png.h""... $ac_c" 1>&6 -echo "configure:11798: checking for png.h" >&5 +echo "configure:12131: checking for png.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 11803 "configure" +#line 12136 "configure" #include "confdefs.h" #include <png.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12141: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11821,7 +12154,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for png_check_sig in -lpng""... $ac_c" 1>&6 -echo "configure:11825: checking for png_check_sig in -lpng" >&5 +echo "configure:12158: checking for png_check_sig in -lpng" >&5 ac_lib_var=`echo png'_'png_check_sig | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11829,7 +12162,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpng -lz -lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 11833 "configure" +#line 12166 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11840,7 +12173,7 @@ int main() { png_check_sig() ; return 0; } EOF -if { (eval echo configure:11844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11885,17 +12218,17 @@ EOF JPEG_LINK= ac_safe=`echo "jpeglib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for jpeglib.h""... $ac_c" 1>&6 -echo "configure:11889: checking for jpeglib.h" >&5 +echo "configure:12222: checking for jpeglib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 11894 "configure" +#line 12227 "configure" #include "confdefs.h" #include <jpeglib.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11899: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12232: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11912,7 +12245,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for jpeg_read_header in -ljpeg""... $ac_c" 1>&6 -echo "configure:11916: checking for jpeg_read_header in -ljpeg" >&5 +echo "configure:12249: checking for jpeg_read_header in -ljpeg" >&5 ac_lib_var=`echo jpeg'_'jpeg_read_header | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11920,7 +12253,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ljpeg $LIBS" cat > conftest.$ac_ext <<EOF -#line 11924 "configure" +#line 12257 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11931,7 +12264,7 @@ int main() { jpeg_read_header() ; return 0; } EOF -if { (eval echo configure:11935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11973,17 +12306,17 @@ EOF TIFF_LINK= ac_safe=`echo "tiffio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tiffio.h""... $ac_c" 1>&6 -echo "configure:11977: checking for tiffio.h" >&5 +echo "configure:12310: checking for tiffio.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 11982 "configure" +#line 12315 "configure" #include "confdefs.h" #include <tiffio.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11987: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12320: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12000,7 +12333,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for TIFFError in -ltiff""... $ac_c" 1>&6 -echo "configure:12004: checking for TIFFError in -ltiff" >&5 +echo "configure:12337: checking for TIFFError in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFError | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -12008,7 +12341,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltiff -lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 12012 "configure" +#line 12345 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -12019,7 +12352,7 @@ int main() { TIFFError() ; return 0; } EOF -if { (eval echo configure:12023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12052,17 +12385,17 @@ fi if test "$wxUSE_OPENGL" = "yes"; then ac_safe=`echo "GL/gl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/gl.h""... $ac_c" 1>&6 -echo "configure:12056: checking for GL/gl.h" >&5 +echo "configure:12389: checking for GL/gl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12061 "configure" +#line 12394 "configure" #include "confdefs.h" #include <GL/gl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12399: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12088,7 +12421,7 @@ EOF EOF echo $ac_n "checking for glFlush in -lGL""... $ac_c" 1>&6 -echo "configure:12092: checking for glFlush in -lGL" >&5 +echo "configure:12425: checking for glFlush in -lGL" >&5 ac_lib_var=`echo GL'_'glFlush | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -12096,7 +12429,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lGL $LIBS" cat > conftest.$ac_ext <<EOF -#line 12100 "configure" +#line 12433 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -12107,7 +12440,7 @@ int main() { glFlush() ; return 0; } EOF -if { (eval echo configure:12111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12123,13 +12456,13 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - OPENGL_LINK="-lGL" + OPENGL_LINK="-lGL -lGLU" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for glFlush in -lMesaGL""... $ac_c" 1>&6 -echo "configure:12133: checking for glFlush in -lMesaGL" >&5 +echo "configure:12466: checking for glFlush in -lMesaGL" >&5 ac_lib_var=`echo MesaGL'_'glFlush | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -12137,7 +12470,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lMesaGL $LIBS" cat > conftest.$ac_ext <<EOF -#line 12141 "configure" +#line 12474 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -12148,7 +12481,7 @@ int main() { glFlush() ; return 0; } EOF -if { (eval echo configure:12152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12164,7 +12497,7 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - OPENGL_LINK="-lMesaGL" + OPENGL_LINK="-lMesaGL -lMesaGLU" else echo "$ac_t""no" 1>&6 @@ -12306,6 +12639,7 @@ if test "$wxUSE_INTL" = "yes" ; then EOF SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS internat" + GUIDIST="$GUIDIST INTL_DIST" fi fi @@ -12350,12 +12684,12 @@ if test "$wxUSE_TIMEDATE" = "yes"; then for ac_func in strptime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:12354: checking for $ac_func" >&5 +echo "configure:12688: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12359 "configure" +#line 12693 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -12378,7 +12712,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:12382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -12404,13 +12738,13 @@ done echo $ac_n "checking for timezone variable in <time.h>""... $ac_c" 1>&6 -echo "configure:12408: checking for timezone variable in <time.h>" >&5 +echo "configure:12742: checking for timezone variable in <time.h>" >&5 if eval "test \"`echo '$''{'wx_cv_var_timezone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12414 "configure" +#line 12748 "configure" #include "confdefs.h" #include <time.h> @@ -12422,7 +12756,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:12760: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_var_timezone=__timezone @@ -12433,7 +12767,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 12437 "configure" +#line 12771 "configure" #include "confdefs.h" #include <time.h> @@ -12445,7 +12779,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:12783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_var_timezone=_timezone @@ -12456,7 +12790,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 12460 "configure" +#line 12794 "configure" #include "confdefs.h" #include <time.h> @@ -12468,7 +12802,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:12806: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_var_timezone=timezone @@ -12503,12 +12837,12 @@ EOF for ac_func in localtime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:12507: checking for $ac_func" >&5 +echo "configure:12841: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12512 "configure" +#line 12846 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -12531,7 +12865,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:12535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -12558,13 +12892,13 @@ done if test "$ac_cv_func_localtime" = "yes"; then echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:12562: checking for tm_gmtoff in struct tm" >&5 +echo "configure:12896: checking for tm_gmtoff in struct tm" >&5 if eval "test \"`echo '$''{'wx_cv_struct_tm_has_gmtoff'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12568 "configure" +#line 12902 "configure" #include "confdefs.h" #include <time.h> @@ -12576,7 +12910,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12580: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:12914: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_struct_tm_has_gmtoff=yes @@ -12602,12 +12936,12 @@ echo "$ac_t""$wx_cv_struct_tm_has_gmtoff" 1>&6 for ac_func in gettimeofday ftime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:12606: checking for $ac_func" >&5 +echo "configure:12940: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12611 "configure" +#line 12945 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -12630,7 +12964,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:12634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -12657,7 +12991,7 @@ done if test "$ac_cv_func_gettimeofday" = "yes"; then echo $ac_n "checking whether gettimeofday takes two arguments""... $ac_c" 1>&6 -echo "configure:12661: checking whether gettimeofday takes two arguments" >&5 +echo "configure:12995: checking whether gettimeofday takes two arguments" >&5 if eval "test \"`echo '$''{'wx_cv_func_gettimeofday_has_2_args'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12672,7 +13006,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <<EOF -#line 12676 "configure" +#line 13010 "configure" #include "confdefs.h" #include <sys/time.h> @@ -12686,7 +13020,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12690: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13024: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_gettimeofday_has_2_args=yes else @@ -12694,7 +13028,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 12698 "configure" +#line 13032 "configure" #include "confdefs.h" #include <sys/time.h> @@ -12707,7 +13041,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12711: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_func_gettimeofday_has_2_args=no else @@ -12753,12 +13087,12 @@ if test "$TOOLKIT" != "MSW"; then if test "$wxUSE_SOCKETS" = "yes"; then echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:12757: checking for socket" >&5 +echo "configure:13091: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12762 "configure" +#line 13096 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char socket(); below. */ @@ -12781,7 +13115,7 @@ socket(); ; return 0; } EOF -if { (eval echo configure:12785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -12799,7 +13133,7 @@ if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:12803: checking for socket in -lsocket" >&5 +echo "configure:13137: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -12807,7 +13141,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 12811 "configure" +#line 13145 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -12818,7 +13152,7 @@ int main() { socket() ; return 0; } EOF -if { (eval echo configure:12822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12852,7 +13186,7 @@ fi if test "$wxUSE_SOCKETS" = "yes" ; then echo $ac_n "checking what is the type of the third argument of getsockname""... $ac_c" 1>&6 -echo "configure:12856: checking what is the type of the third argument of getsockname" >&5 +echo "configure:13190: checking what is the type of the third argument of getsockname" >&5 if eval "test \"`echo '$''{'wx_cv_type_getsockname3'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12867,7 +13201,7 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <<EOF -#line 12871 "configure" +#line 13205 "configure" #include "confdefs.h" #include <sys/types.h> @@ -12880,7 +13214,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13218: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_getsockname3=socklen_t else @@ -12888,7 +13222,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 12892 "configure" +#line 13226 "configure" #include "confdefs.h" #include <sys/types.h> @@ -12901,7 +13235,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_getsockname3=size_t else @@ -12909,7 +13243,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 12913 "configure" +#line 13247 "configure" #include "confdefs.h" #include <sys/types.h> @@ -12922,7 +13256,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:12926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wx_cv_type_getsockname3=int else @@ -12982,17 +13316,17 @@ if test "$wxUSE_JOYSTICK" = "yes"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:12986: checking for $ac_hdr" >&5 +echo "configure:13320: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12991 "configure" +#line 13325 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12996: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13330: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13045,12 +13379,12 @@ if test "$wxUSE_DYNLIB_CLASS" = "yes"; then for ac_func in dlopen do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:13049: checking for $ac_func" >&5 +echo "configure:13383: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 13054 "configure" +#line 13388 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -13073,7 +13407,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:13077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -13101,7 +13435,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:13105: checking for dlopen in -ldl" >&5 +echo "configure:13439: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -13109,7 +13443,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 13113 "configure" +#line 13447 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -13120,7 +13454,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:13124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13149,12 +13483,12 @@ else for ac_func in shl_load do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:13153: checking for $ac_func" >&5 +echo "configure:13487: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 13158 "configure" +#line 13492 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -13177,7 +13511,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:13181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -13204,6 +13538,50 @@ EOF else echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dld in -lshl_load""... $ac_c" 1>&6 +echo "configure:13543: checking for dld in -lshl_load" >&5 +ac_lib_var=`echo shl_load'_'dld | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lshl_load $LIBS" +cat > conftest.$ac_ext <<EOF +#line 13551 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld(); + +int main() { +dld() +; return 0; } +EOF +if { (eval echo configure:13562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + HAVE_SHL_FUNCS=1 + LIBS="$LIBS -ldld" + +else + echo "$ac_t""no" 1>&6 +fi + + fi done @@ -13215,6 +13593,110 @@ fi done + if test "$HAVE_DL_FUNCS" = 1; then + for ac_func in dlerror +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:13601: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 13606 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:13629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + cat >> confdefs.h <<\EOF +#define HAVE_DLERROR 1 +EOF + +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlerror in -ldl""... $ac_c" 1>&6 +echo "configure:13654: checking for dlerror in -ldl" >&5 +ac_lib_var=`echo dl'_'dlerror | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <<EOF +#line 13662 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlerror(); + +int main() { +dlerror() +; return 0; } +EOF +if { (eval echo configure:13673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_DLERROR 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +fi +done + + fi + if test "$HAVE_DL_FUNCS" = 0; then if test "$HAVE_SHL_FUNCS" = 0; then if test "$USE_UNIX" = 1; then @@ -13412,17 +13894,17 @@ if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:13416: checking for $ac_hdr" >&5 +echo "configure:13898: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 13421 "configure" +#line 13903 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13426: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13850,23 +14332,30 @@ EOF -GUILIBS="$GUI_TK_LIBRARY $OPENGL_LINK $TOOLKIT_LINK" +GUILIBS="$GUI_TK_LIBRARY $TOOLKIT_LINK" +OPENGL_LIBS="$OPENGL_LINK" -EXTRA_LIBS="-lm $LIBS $ZLIB_LINK $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK" +EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -lm" if test "$wxUSE_GUI" = "yes"; then - EXTRA_LIBS="$EXTRA_LIBS $GUILIBS $PNG_LINK $JPEG_LINK $TIFF_LINK" + EXTRA_LIBS="$GUILIBS $PNG_LINK $JPEG_LINK $TIFF_LINK $EXTRA_LIBS" fi LD_LIBS="\${top_builddir}/lib/${WX_LIBRARY_NAME_STATIC} $EXTRA_LIBS" INCLUDES="-I. -I\${top_builddir}/include -I\${top_srcdir}/include $ZLIB_INCLUDE $PNG_INCLUDE $JPEG_INCLUDE $TIFF_INCLUDE $TOOLKIT_INCLUDE" +if test "$wxUSE_GTK" = 1; then + WXCONFIG_INCLUDE="" +else + WXCONFIG_INCLUDE="$TOOLKIT_INCLUDE" +fi + if test "$GXX" = yes ; then CXXWARNINGS="-Wall" fi EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE $INCLUDES" -CFLAGS=`echo $CFLAGS $EXTRA_CFLAGS | sed 's/ \\+/ /g'` +CFLAGS=`echo $CFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \\+/ /g'` CXXFLAGS=`echo $CXXFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \+/ /g'` LDFLAGS="$LDFLAGS $PROFILE" @@ -13968,13 +14457,17 @@ SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq + + + + echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:13978: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:14471: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14228,6 +14721,7 @@ s%@DEP_INFO_FLAGS@%$DEP_INFO_FLAGS%g s%@CODE_GEN_FLAGS@%$CODE_GEN_FLAGS%g s%@BURNT_LIBRARY_NAME@%$BURNT_LIBRARY_NAME%g s%@BURNT_LIBRARY_NAME_GL@%$BURNT_LIBRARY_NAME_GL%g +s%@WX_TARGET_LIBRARY_SONAME@%$WX_TARGET_LIBRARY_SONAME%g s%@WX_TARGET_LIBRARY_TYPE@%$WX_TARGET_LIBRARY_TYPE%g s%@WXDEBUG_DEFINE@%$WXDEBUG_DEFINE%g s%@USE_GUI@%$USE_GUI%g @@ -14235,7 +14729,9 @@ s%@AFMINSTALL@%$AFMINSTALL%g s%@TOOLKIT@%$TOOLKIT%g s%@TOOLKIT_DEF@%$TOOLKIT_DEF%g s%@TOOLKIT_DIR@%$TOOLKIT_DIR%g +s%@TOOLKIT_NAME@%$TOOLKIT_NAME%g s%@TOOLKIT_INCLUDE@%$TOOLKIT_INCLUDE%g +s%@WXCONFIG_INCLUDE@%$WXCONFIG_INCLUDE%g s%@GUIHEADERS@%$GUIHEADERS%g s%@GUIOBJS@%$GUIOBJS%g s%@COMMONOBJS@%$COMMONOBJS%g @@ -14260,6 +14756,7 @@ s%@DOCS_SUBDIRS@%$DOCS_SUBDIRS%g s%@SAMPLES_SUBDIRS@%$SAMPLES_SUBDIRS%g s%@USER_SUBDIRS@%$USER_SUBDIRS%g s%@EXTRA_LIBS@%$EXTRA_LIBS%g +s%@OPENGL_LIBS@%$OPENGL_LIBS%g s%@EXTRADEFS@%$EXTRADEFS%g s%@LD_LIBS@%$LD_LIBS%g s%@RCINPUTSWITCH@%$RCINPUTSWITCH%g @@ -14490,6 +14987,7 @@ EOF cat >> $CONFIG_STATUS <<EOF TOOLKIT_DIR="${TOOLKIT_DIR}" + TOOLKIT_NAME="${TOOLKIT_NAME}" LN_S="${LN_S}" @@ -14497,8 +14995,8 @@ EOF cat >> $CONFIG_STATUS <<\EOF chmod +x wx-config - mv wx-config wx${TOOLKIT_DIR}-config - ${LN_S} wx${TOOLKIT_DIR}-config wx-config + mv wx-config wx${TOOLKIT_NAME}-config + ${LN_S} wx${TOOLKIT_NAME}-config wx-config if test ! -d lib; then @@ -14513,11 +15011,11 @@ cat >> $CONFIG_STATUS <<\EOF if test ! -d lib/wx/include/wx; then mkdir lib/wx/include/wx fi - if test ! -d lib/wx/include/wx/${TOOLKIT_DIR}; then - mkdir lib/wx/include/wx/${TOOLKIT_DIR} + if test ! -d lib/wx/include/wx/${TOOLKIT_NAME}; then + mkdir lib/wx/include/wx/${TOOLKIT_NAME} fi if test -f setup.h; then - cp -f setup.h lib/wx/include/wx/${TOOLKIT_DIR}/setup.h + cp -f setup.h lib/wx/include/wx/${TOOLKIT_NAME}/setup.h fi diff --git a/configure.in b/configure.in index bde4a0e0f9..e42da80ccc 100644 --- a/configure.in +++ b/configure.in @@ -456,11 +456,11 @@ dnl dnl WX_INTERFACE_AGE = 0 WX_MAJOR_VERSION_NUMBER=2 -WX_MINOR_VERSION_NUMBER=1 -WX_RELEASE_NUMBER=14 +WX_MINOR_VERSION_NUMBER=2 +WX_RELEASE_NUMBER=0 WX_INTERFACE_AGE=0 -WX_BINARY_AGE=0 +WX_BINARY_AGE=1 WX_VERSION=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER.$WX_RELEASE_NUMBER @@ -492,6 +492,7 @@ USE_ALPHA= USE_OSF= USE_BSD= USE_FREEBSD= +USE_NETBSD= USE_VMS= USE_ULTRIX= USE_CYGWIN= @@ -572,19 +573,27 @@ case "${host}" in AC_DEFINE(__BSD__) DEFAULT_DEFAULT_wxUSE_MOTIF=1 ;; - *-*-freebsd* | *-*-netbsd*) + *-*-freebsd*) USE_BSD=1 USE_FREEBSD=1 AC_DEFINE(__FREEBSD__) AC_DEFINE(__BSD__) DEFAULT_DEFAULT_wxUSE_GTK=1 ;; + *-*-netbsd*) + USE_BSD=1 + USE_NETBSD=1 + AC_DEFINE(__FREEBSD__) + AC_DEFINE(__NETBSD__) + DEFAULT_DEFAULT_wxUSE_GTK=1 + ;; *-*-osf* ) USE_ALPHA=1 USE_OSF=1 AC_DEFINE(__ALPHA__) AC_DEFINE(__OSF__) DEFAULT_DEFAULT_wxUSE_MOTIF=1 + NEEDS_D_REENTRANT_FOR_R_FUNCS=1 ;; *-*-dgux5* ) USE_ALPHA=1 @@ -1028,7 +1037,6 @@ WX_ARG_ENABLE(textfile, [ --enable-textfile use wxTextFile classes], WX_ARG_ENABLE(unicode, [ --enable-unicode compile wxString with Unicode support], wxUSE_UNICODE) WX_ARG_ENABLE(wcsrtombs, [ --enable-wcsrtombs use wcsrtombs instead of buggy (GNU libc1/Linux libc5) wcstombs], wxUSE_WCSRTOMBS) WX_ARG_ENABLE(wxprintfv, [ --enable-wxprintfv use wxWindows implementation of vprintf()], wxUSE_EXPERIMENTAL_PRINTF) -WX_ARG_ENABLE(joystick, [ --enable-joystick compile in joystick support (Linux only)], wxUSE_JOYSTICK) WX_ARG_ENABLE(std_iostreams, [ --enable-std_iostreams use standard C++ stream classes], wxUSE_STD_IOSTREAM) WX_ARG_ENABLE(filesystem, [ --enable-filesystem use virtual file systems classes], wxUSE_FILESYSTEM) WX_ARG_ENABLE(fs_inet, [ --enable-fs_inet use virtual HTTP/FTP filesystems], wxUSE_FS_INET) @@ -1208,6 +1216,7 @@ WX_ARG_ENABLE(splines, [ --enable-splines use spline drawing code], WX_ARG_ENABLE(validators, [ --enable-validators use wxValidator and derived classes], wxUSE_VALIDATORS) WX_ARG_ENABLE(busyinfo, [ --enable-busyinfo use wxBusyInfo], wxUSE_BUSYINFO) WX_ARG_ENABLE(plot, [ --enable-plot use wxPlot], wxUSE_PLOT) +WX_ARG_ENABLE(joystick, [ --enable-joystick compile in joystick support (Linux only)], wxUSE_JOYSTICK) dnl --------------------------------------------------------------------------- dnl support for image formats that do not rely on external library @@ -1389,7 +1398,7 @@ if test ! -d sub ; then mkdir sub fi echo dummy > sub/file -${MAKE-make} -f confMake VPATH=sub 2> config.log > /dev/null +${MAKE-make} -f confMake VPATH=sub 2>&5 > /dev/null RESULT=$? rm -f sub/file check final_file confMake rmdir sub @@ -1531,6 +1540,7 @@ GUI_TK_LIBRARY= GUI_TK_LINK= WXGTK12= +WXGTK127= WXGTK13= WXWINE= @@ -1556,11 +1566,11 @@ if test "$wxUSE_CYGWIN" = 1 || test "$wxUSE_MINGW" = 1 ; then dnl --- This will bloat the executable, but it'll work for now... LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lcrtdll -ladvapi32 -lwsock32" - dnl add extra odbc libs if we have compiled in odbc - if test "$wxUSE_ODBC" = "yes" ; then - LIBS="$LIBS -lodbc32 -lole32 -loleaut32" - fi - + dnl add extra odbc libs if we have compiled in odbc + if test "$wxUSE_ODBC" = "yes" ; then + LIBS="$LIBS -lodbc32 -lole32 -loleaut32" + fi + dnl -mwindows is needed to avoid that spawning of a console window if test "$wxUSE_MINGW" = 1; then LDFLAGS="$LDFLAGS -mwindows" @@ -1591,6 +1601,7 @@ fi if test "$wxUSE_GTK" = 1; then dnl avoid calling AM_PATH_GTK twice, so check first for the newer version dnl and only then, if it wasn't found, for an older one + AM_PATH_GTK(1.2.7, WXGTK127=1) AM_PATH_GTK(1.2.3, WXGTK12=1) if test "$WXGTK12" != 1; then @@ -1850,8 +1861,8 @@ if test "$wxUSE_MOTIF" = 1; then version = XpmLibraryVersion(); ], [ - XPM_LINK="-lXpm " - AC_DEFINE(wxHAVE_LIB_XPM) + XPM_LINK="-lXpm " + AC_DEFINE(wxHAVE_LIB_XPM) AC_MSG_RESULT(found in default search path) COMPILED_X_PROGRAM=0 ], @@ -1900,11 +1911,18 @@ else TOOLKIT_DIR="os2" fi + dnl the (base) name of the library and support files for this toolkit + if test "$wxUSE_DEBUG_FLAG" = "yes"; then + TOOLKIT_NAME="${TOOLKIT_DIR}d" + else + TOOLKIT_NAME="${TOOLKIT_DIR}" + fi + dnl the symbol which allows conditional compilation for the given toolkit TOOLKIT_DEF="-D__WX${TOOLKIT}__" dnl the name of the (libtool) library - WX_LIBRARY="wx_${TOOLKIT_DIR}" + WX_LIBRARY="wx_${TOOLKIT_NAME}" dnl the sources, their dependenices and the headers ALL_OBJECTS="\$(GUIOBJS) \$(COMMONOBJS) \$(GENERICOBJS) \$(UNIXOBJS) \$(HTMLOBJS) \$(OGLOBJS)" @@ -1940,7 +1958,16 @@ fi else USE_GUI=0 + dnl this may be (almost) unneccesary for wxBase now we use TOOLKIT_NAME TOOLKIT_DIR="base" + + dnl the base name of the library and wxXXX-config files + if test "$wxUSE_DEBUG_FLAG" = "yes"; then + TOOLKIT_NAME="${TOOLKIT_DIR}d" + else + TOOLKIT_NAME="${TOOLKIT_DIR}" + fi + TOOLKIT_DEF="-D__WXBASE__" dnl the sources, their dependenices and the headers @@ -1952,7 +1979,7 @@ else fi dnl building wxBase only - WX_LIBRARY="wxbase" + WX_LIBRARY="wx_${TOOLKIT_NAME}" PORT_FILES="src/files.lst" RPM_FILES="src/rpmfiles.lst" @@ -1989,6 +2016,7 @@ PIC_FLAG= WX_ALL= WX_ALL_INSTALLED= BURNT_LIBRARY_NAME= +WX_TARGET_LIBRARY_SONAME= dnl --- the marker for quick search, leave it here: SHARED_LIB_SETUP --- @@ -1999,12 +2027,16 @@ if test "$wxUSE_SHARED" = "yes"; then SHARED_LD="${CC} -shared -fPIC -o" PIC_FLAG="-fPIC" else + dnl no idea why it wants it, but it does + LDFLAGS="-L/usr/lib" + SHARED_LD="${CXX} -b -o" PIC_FLAG="+Z" fi - WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_DIR}.sl" - WX_LIBRARY_NAME_SHARED_GL="libwx_${TOOLKIT_DIR}_gl.sl" + WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_NAME}.sl" + WX_LIBRARY_NAME_SHARED_GL="libwx_${TOOLKIT_NAME}_gl.sl" if test "$wxUSE_OPENGL" = "yes"; then + WX_ALL_INSTALLED="preinstall_gl" WX_ALL="${WX_LIBRARY_NAME_SHARED} ${WX_LIBRARY_NAME_SHARED_GL}" else WX_ALL="${WX_LIBRARY_NAME_SHARED}" @@ -2018,6 +2050,8 @@ if test "$wxUSE_SHARED" = "yes"; then if test "$wxUSE_BURNT_NAME" = "yes" ; then BURNT_LIBRARY_NAME="-Wl,-soname,${WX_LIBRARY_LINK1}" BURNT_LIBRARY_NAME_GL="-Wl,-soname,${WX_LIBRARY_LINK1_GL}" + dnl substitute this in makelib.env for the contrib libs + WX_TARGET_LIBRARY_SONAME="-Wl,-soname,\$(TARGETLIB_LINK1)" fi if test "$wxUSE_OPENGL" = "yes"; then WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL" @@ -2046,6 +2080,10 @@ if test "$wxUSE_SHARED" = "yes"; then if test "$GCC" = yes ; then SHARED_LD="${CC} -shared -o" PIC_FLAG="-fPIC" + + dnl newer versions of gcc need -isystem to compile X headers on + dnl Solaris (which use old style C syntax) + CPPFLAGS="$CPPFLAGS -isystem /usr/openwin/include" else SHARED_LD="${CXX} -G -o" PIC_FLAG="-KPIC" @@ -2096,13 +2134,23 @@ if test "$wxUSE_SHARED" = "yes"; then dnl only static for now WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}" WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}" - WX_ALL="${WX_LIBRARY_NAME_STATIC}" + if test "$wxUSE_OPENGL" = "yes"; then + WX_ALL_INSTALLED="preinstall_gl" + WX_ALL="${WX_LIBRARY_NAME_STATIC} ${WX_LIBRARY_NAME_STATIC_GL}" + else + WX_ALL="${WX_LIBRARY_NAME_STATIC}" + fi ;; *-*-mingw32* ) dnl only static for now WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}" WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}" - WX_ALL="${WX_LIBRARY_NAME_STATIC}" + if test "$wxUSE_OPENGL" = "yes"; then + WX_ALL_INSTALLED="preinstall_gl" + WX_ALL="${WX_LIBRARY_NAME_STATIC} ${WX_LIBRARY_NAME_STATIC_GL}" + else + WX_ALL="${WX_LIBRARY_NAME_STATIC}" + fi ;; *-pc-os2_emx ) dnl only static for now @@ -2132,7 +2180,20 @@ else dnl set target to static WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}" WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}" - WX_ALL="${WX_LIBRARY_NAME_STATIC}" + + if test "$wxUSE_OPENGL" = "yes"; then + WX_ALL_INSTALLED="preinstall_gl" + WX_ALL="${WX_LIBRARY_NAME_STATIC} ${WX_LIBRARY_NAME_STATIC_GL}" + else + WX_ALL="${WX_LIBRARY_NAME_STATIC}" + fi + + dnl give static wxBase build a working install target + if test "$wxUSE_GUI" = "no"; then + dnl we're here because WX_ALL_INSTALLED is empty, but play safe anyway + WX_ALL_INSTALLED="${WX_ALL_INSTALLED} preinstall" + fi + WX_TARGET_LIBRARY_TYPE="a" fi @@ -2249,53 +2310,81 @@ AC_CHECK_LIB(c, wcslen, [ dnl check for vprintf/vsprintf() which are GNU extensions AC_FUNC_VPRINTF -dnl check for vsnprintf() - a safe version of vsprintf() -AC_CHECK_FUNCS(vsnprintf, - AC_DEFINE(HAVE_VSNPRINTF), - AC_MSG_WARN(unsafe function sprintf will be used instead of snprintf) - ) - -dnl check for vsscanf() - on some platforms (Linux, glibc 2.1.1) it's -dnl available in the library but the prototype is missing, so we can't use -dnl AC_CHECK_FUNCS here, do it manually AC_LANG_SAVE AC_LANG_CPLUSPLUS -AC_CACHE_CHECK([for vsscanf], wx_cv_func_vsscanf, +dnl check for vsscanf() and vsnprintf() - on some platforms (Linux, glibc +dnl 2.1.1 for the first one, HP-UX for the second) it's available in the +dnl library but the prototype is missing, so we can't use AC_CHECK_FUNCS here, +dnl do it manually + +dnl we use AC_TRY_COMPILE() here instead of AC_TRY_RUN() to make the checks +dnl work for cross-compilation, but AC_TRY_COMPILE() normally only compiles +dnl one function while we need at least 2 - hence the ugly hack below. To +dnl understand why it works, remember that AC_TRY_COMPILE() just prepends +dnl "int main() {" in the beginning of the code and "; return 0; }" at the +dnl end... + +dnl check for vsnprintf() - a safe version of vsprintf() +AC_CACHE_CHECK([for vsnprintf], wx_cv_func_vsnprintf, [ - AC_TRY_RUN( - [ - #include <stdio.h> - #include <stdarg.h> + AC_TRY_COMPILE([ + #include <stdio.h> + #include <stdarg.h> + ], [ + int wx_test_vsnprintf(const char *, ...); - int try_vsscanf(const char *format, ...) - { - va_list ap; - va_start(ap, format); + wx_test_vsnprintf("%s"); + return 0; + } + + int wx_test_vsnprintf(const char *fmt, ...) + { + char *s; - vsscanf("17", format, ap); + va_list argp; + va_start(argp, fmt); + vsnprintf(s, 42, fmt, argp); + va_end(argp); + ], [ + AC_DEFINE(HAVE_VSNPRINTF) + wx_cv_func_vsnprintf=yes + ], [ + AC_MSG_WARN(unsafe function sprintf will be used instead of snprintf) + wx_cv_func_vsnprintf=no + ]) +]) - va_end(ap); +dnl check for vsscanf() +AC_CACHE_CHECK([for vsscanf], wx_cv_func_vsscanf, +[ + AC_TRY_COMPILE([ + #include <stdio.h> + #include <stdarg.h> + ], [ + int wx_test_vsscanf(const char *, ...); + + wx_test_vsscanf("%d"); + return 0; } - int main() + int wx_test_vsscanf(const char *fmt, ...) { - int i; - try_vsscanf("%d", &i); - return i == 17 ? 0 : 1; - } - ], [ - AC_DEFINE(HAVE_VSSCANF) - wx_cv_func_vsscanf=yes - ], - wx_cv_func_vsscanf=no, - wx_cv_func_vsscanf=no - ) + va_list argp; + va_start(argp, fmt); + vsscanf("42", fmt, argp); + va_end(argp); + ], [ + AC_DEFINE(HAVE_VSSCANF) + wx_cv_func_vsscanf=yes + ], [ + wx_cv_func_vsscanf=no + ]) ]) AC_LANG_RESTORE -dnl under MSW we always have Sleep() +dnl the following tests are for Unix(like) systems only if test "$TOOLKIT" != "MSW"; then dnl check for POSIX signals if we need them @@ -2306,6 +2395,30 @@ if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then AC_MSG_WARN([No POSIX signal functions on this system, wxApp::OnFatalException will not be called]) wxUSE_ON_FATAL_EXCEPTION=no fi + + if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + AC_CACHE_CHECK([for sa_handler type], wx_cv_type_sa_handler, + [ + AC_TRY_COMPILE([#include <signal.h>], + [ + extern void testSigHandler(int); + + struct sigaction sa; + sa.sa_handler = testSigHandler; + ], [ + wx_cv_type_sa_handler=int + ], [ + wx_cv_type_sa_handler=void + ]) + ]) + + AC_LANG_RESTORE + + AC_DEFINE_UNQUOTED(wxTYPE_SA_HANDLER, $wx_cv_type_sa_handler) + fi fi dnl check for vfork() (even if it's the same as fork() in modern Unices) @@ -2419,12 +2532,19 @@ fi if test "$wxUSE_THREADS" = "yes" ; then dnl find if POSIX threads are available + dnl AIX calls the library libpthreads - thanks IBM! + if test "$wxUSE_AIX" = 1; then + THREADS_LIB=pthreads + else + THREADS_LIB=pthread + fi + dnl standard lib name is pthread dnl We no longer test for pthread-0.7 as it breaks compilation on some dnl glibc2 systems, especially for static linkage. - AC_CHECK_LIB(pthread, pthread_create, [ + AC_CHECK_LIB($THREADS_LIB, pthread_create, [ THREADS_OBJ="threadpsx.lo" - THREADS_LINK="pthread" + THREADS_LINK=$THREADS_LIB ], [ dnl thread functions are in libc_r under FreeBSD AC_CHECK_LIB(c_r, pthread_create, [ @@ -2473,21 +2593,33 @@ if test "$wxUSE_THREADS" = "yes" ; then )] ) - dnl VZ: we should be checking for all of the following functions instead: + dnl to be able to set the thread priority, we need to have all of the + dnl following functions: dnl 1. pthread_attr_getschedpolicy dnl 2. sched_get_priority_min and sched_get_priority_max + dnl (this one can be in either libpthread or libposix4 (under Solaris)) dnl 3. pthread_attr_getschedparam and pthread_attr_setschedparam - dnl but it seems that if the first one is there, the other ones are too (of - dnl course the proper solution would be to implement AC_FUNC_THREAD above - dnl and do test for them all - anyone?) + HAVE_PRIOR_FUNCS=0 AC_CHECK_LIB($THREADS_LINK, pthread_attr_getschedpolicy, - AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS), - [AC_CHECK_LIB("posix4", pthread_attr_getschedpolicy, - [AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS) POSIX4_LINK="-lposix4"], - AC_MSG_WARN(Setting thread priority will not work) - )] + AC_CHECK_LIB($THREADS_LINK, pthread_attr_setschedparam, + AC_CHECK_LIB($THREADS_LINK, sched_get_priority_max, + HAVE_PRIOR_FUNCS=1, + AC_CHECK_LIB("posix4", sched_get_priority_max, + [ + HAVE_PRIOR_FUNCS=1 + POSIX4_LINK="-lposix4" + ], + ) + ) + ) ) + if test "$HAVE_PRIOR_FUNCS" = 1; then + AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS) + else + AC_MSG_WARN(Setting thread priority will not work) + fi + AC_CHECK_LIB($THREADS_LINK, pthread_cancel, AC_DEFINE(HAVE_PTHREAD_CANCEL), AC_MSG_WARN([wxThread::Kill() will not work properly])) @@ -2544,6 +2676,10 @@ if test "$WXGTK12" = 1 ; then AC_DEFINE_UNQUOTED(__WXGTK12__,$WXGTK12) fi +if test "$WXGTK127" = 1 ; then + AC_DEFINE_UNQUOTED(__WXGTK127__,$WXGTK127) +fi + if test "$WXWINE" = 1 ; then TOOLKIT_DEF="${TOOLKIT_DEF} -D__WXWINE__" fi @@ -2706,10 +2842,10 @@ if test "$wxUSE_OPENGL" = "yes"; then AC_DEFINE(wxUSE_OPENGL) AC_DEFINE(wxUSE_GLCANVAS) AC_CHECK_LIB(GL, glFlush, [ - OPENGL_LINK="-lGL" + OPENGL_LINK="-lGL -lGLU" ],[ AC_CHECK_LIB(MesaGL, glFlush, [ - OPENGL_LINK="-lMesaGL" + OPENGL_LINK="-lMesaGL -lMesaGLU" ],) ],) ],wxUSE_OPENGL=0) @@ -2812,6 +2948,7 @@ if test "$wxUSE_INTL" = "yes" ; then else AC_DEFINE(wxUSE_INTL) SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS internat" + GUIDIST="$GUIDIST INTL_DIST" fi fi @@ -3109,10 +3246,24 @@ if test "$wxUSE_DYNLIB_CLASS" = "yes"; then [ AC_DEFINE(HAVE_SHL_LOAD) HAVE_SHL_FUNCS=1 + ], + [ + AC_CHECK_LIB(shl_load, dld, + [ + HAVE_SHL_FUNCS=1 + LIBS="$LIBS -ldld" + ]) ]) ]) ]) + dnl check also for dlerror() + if test "$HAVE_DL_FUNCS" = 1; then + AC_CHECK_FUNCS(dlerror, + AC_DEFINE(HAVE_DLERROR), + AC_CHECK_LIB(dl, dlerror, AC_DEFINE(HAVE_DLERROR))) + fi + if test "$HAVE_DL_FUNCS" = 0; then if test "$HAVE_SHL_FUNCS" = 0; then if test "$USE_UNIX" = 1; then @@ -3554,15 +3705,16 @@ dnl --------------------------------------------------------------------------- dnl Output the makefiles and such from the results found above dnl --------------------------------------------------------------------------- -GUILIBS="$GUI_TK_LIBRARY $OPENGL_LINK $TOOLKIT_LINK" +GUILIBS="$GUI_TK_LIBRARY $TOOLKIT_LINK" +OPENGL_LIBS="$OPENGL_LINK" dnl all additional libraries (except wxWindows itself) we link with dnl dnl note that we always link with -lm - extended.c uses floor() and is always dnl linked in -EXTRA_LIBS="-lm $LIBS $ZLIB_LINK $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK" +EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -lm" if test "$wxUSE_GUI" = "yes"; then - EXTRA_LIBS="$EXTRA_LIBS $GUILIBS $PNG_LINK $JPEG_LINK $TIFF_LINK" + EXTRA_LIBS="$GUILIBS $PNG_LINK $JPEG_LINK $TIFF_LINK $EXTRA_LIBS" fi dnl all the libraries needed to link wxWindows programs when using the @@ -3572,6 +3724,13 @@ LD_LIBS="\${top_builddir}/lib/${WX_LIBRARY_NAME_STATIC} $EXTRA_LIBS" dnl all -I options we must pass to the compiler INCLUDES="-I. -I\${top_builddir}/include -I\${top_srcdir}/include $ZLIB_INCLUDE $PNG_INCLUDE $JPEG_INCLUDE $TIFF_INCLUDE $TOOLKIT_INCLUDE" +dnl wxGTK does not need TOOLKIT includes in wx-config +if test "$wxUSE_GTK" = 1; then + WXCONFIG_INCLUDE="" +else + WXCONFIG_INCLUDE="$TOOLKIT_INCLUDE" +fi + dnl C/C++ compiler options used to compile wxWindows if test "$GXX" = yes ; then dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror" @@ -3581,7 +3740,7 @@ if test "$GXX" = yes ; then fi EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE $INCLUDES" -CFLAGS=`echo $CFLAGS $EXTRA_CFLAGS | sed 's/ \\+/ /g'` +CFLAGS=`echo $CFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \\+/ /g'` CXXFLAGS=`echo $CXXFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \+/ /g'` LDFLAGS="$LDFLAGS $PROFILE" @@ -3649,6 +3808,7 @@ AC_SUBST(DEP_INFO_FLAGS) AC_SUBST(CODE_GEN_FLAGS) AC_SUBST(BURNT_LIBRARY_NAME) AC_SUBST(BURNT_LIBRARY_NAME_GL) +AC_SUBST(WX_TARGET_LIBRARY_SONAME) AC_SUBST(WX_TARGET_LIBRARY_TYPE) dnl debugging options @@ -3660,7 +3820,9 @@ AC_SUBST(AFMINSTALL) AC_SUBST(TOOLKIT) AC_SUBST(TOOLKIT_DEF) AC_SUBST(TOOLKIT_DIR) +AC_SUBST(TOOLKIT_NAME) AC_SUBST(TOOLKIT_INCLUDE) +AC_SUBST(WXCONFIG_INCLUDE) dnl what to compile AC_SUBST(GUIHEADERS) @@ -3694,6 +3856,7 @@ AC_SUBST(USER_SUBDIRS) dnl additional libraries and linker settings AC_SUBST(LDFLAGS) AC_SUBST(EXTRA_LIBS) +AC_SUBST(OPENGL_LIBS) AC_SUBST(EXTRADEFS) AC_SUBST(LIBS) AC_SUBST(LD_LIBS) @@ -3756,11 +3919,11 @@ AC_OUTPUT([ ], [ chmod +x wx-config - mv wx-config wx${TOOLKIT_DIR}-config - ${LN_S} wx${TOOLKIT_DIR}-config wx-config + mv wx-config wx${TOOLKIT_NAME}-config + ${LN_S} wx${TOOLKIT_NAME}-config wx-config - dnl the debian installer wants setup.h to be in the lib subdir - dnl so we *copy* it there + dnl the debian build process wants setup.h in the lib subdir so we + dnl can pretend wxWin is already installed, so we *copy* it there if test ! -d lib; then mkdir lib @@ -3774,11 +3937,11 @@ AC_OUTPUT([ if test ! -d lib/wx/include/wx; then mkdir lib/wx/include/wx fi - if test ! -d lib/wx/include/wx/${TOOLKIT_DIR}; then - mkdir lib/wx/include/wx/${TOOLKIT_DIR} + if test ! -d lib/wx/include/wx/${TOOLKIT_NAME}; then + mkdir lib/wx/include/wx/${TOOLKIT_NAME} fi if test -f setup.h; then - cp -f setup.h lib/wx/include/wx/${TOOLKIT_DIR}/setup.h + cp -f setup.h lib/wx/include/wx/${TOOLKIT_NAME}/setup.h fi dnl *move* setup.h to its final place @@ -3799,6 +3962,7 @@ AC_OUTPUT([ ], [ TOOLKIT_DIR="${TOOLKIT_DIR}" + TOOLKIT_NAME="${TOOLKIT_NAME}" LN_S="${LN_S}" ] ) diff --git a/contrib/configure b/contrib/configure index e5e4981399..1e0f10b3cb 100755 --- a/contrib/configure +++ b/contrib/configure @@ -819,6 +819,9 @@ trap 'rm -fr `echo " src/stc/Makefile samples/Makefile samples/mmedia/Makefile + samples/ogl/Makefile + samples/ogl/ogledit/Makefile + samples/ogl/studio/Makefile samples/stc/Makefile " | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF @@ -905,6 +908,9 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile src/stc/Makefile samples/Makefile samples/mmedia/Makefile + samples/ogl/Makefile + samples/ogl/ogledit/Makefile + samples/ogl/studio/Makefile samples/stc/Makefile "} EOF diff --git a/contrib/configure.in b/contrib/configure.in index fb7fc13b83..d4b6e3aa27 100644 --- a/contrib/configure.in +++ b/contrib/configure.in @@ -44,5 +44,8 @@ AC_OUTPUT([ src/stc/Makefile samples/Makefile samples/mmedia/Makefile + samples/ogl/Makefile + samples/ogl/ogledit/Makefile + samples/ogl/studio/Makefile samples/stc/Makefile ]) diff --git a/contrib/docs/latex/ogl/back.gif b/contrib/docs/latex/ogl/back.gif index 8a61076d3ba74bdedc1d24f60c3d1f5a361a6cee..88a3740f9134d7a569b56a9f76e6aa552672993e 100644 GIT binary patch literal 978 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0fnz;`IEReKh6M+kIfS)hPHb3s zxLrWmYmUc8MFs{@V=tBk4vcQS3gSg?UKlR%Y*zN1W>fj;(a}CV`%O8V#mmmJDyQBv znOUrUdY)b7H6AG;jlf>Rey!M3TUK6P?i!m{q7|$j(iU2nb+j@t;aY#t_B`I%AGL2Z zO6>3Q?Jm>3v>|kImhI|mtHW1|tWDEBQI>amZ`s68xzaas@2+e3%;$D{>W3T0V&ot1 Q_1d}V>FF7|>?{n{02fm-00000 literal 225 zcmV<703QEGNk%v~VLt#E0Pz3-zrVld=jU&4Z(9HWEC2ui06zd20008IjE||y?GK}z zNf>~$-n{z{YJwGn=81mem9{RpmcUHc_KoNIPRH~B4DyD9p%LJl6@Sa4^Epcbno6kk zD5XxT&EQg7><X(t<v2<zGtFvpm%NS3x723V`)<ec-&(({)sqHiQ-=rlS4S8Ibd!~% zh!dt38EIxWIOn%1Dfj2b8T!~6YUzo%W;uEjc(%yY2)pMhb!7`xd#gK?yX%Y7`zwsb bGHgs7FrvK7-0b`e9qpVfU2T0WT>t<(Iwfoo diff --git a/contrib/docs/latex/ogl/contents.gif b/contrib/docs/latex/ogl/contents.gif index 3dddfa3dd5f0c652e8b27cd6c29e1fdd49ced5a8..723174f81d04d16e94016186ac0322dcddb603c7 100644 GIT binary patch literal 996 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0RsaNgBYV=Gz5lX2>kxA zV8N1xh6Z3tW&ovR5Cx<mX<G3o3nK#qH-ipPlmV0{7&s0xh;ztzY*=uxnL}7B=ER1D zhuZ~|rC1mo6pnTY8GErDXmC8*FXe3Y#N(o}$3zXmNg)dwo-p-jCP#faF-g^PhEd?U zHJO)_&rPwe{C4E0u`<I#r%tiE5uYCg&h~b-%e`5+>e34SwPCqkp^L+21?)C@%eigo zjb6XYK{ltit-ZayK=RQZsqlw)b_u-S7xTMFKYoAy)o)vOlz%vRFz5Xto6e7mgSU6F l8>#t(=cJr!`K{OHv%&EGv6=dhWPNvSd3kw-DjN%fH2`phKPvzL literal 231 zcmV<D02u#ANk%v~VL<>G0Pz3-zrVld=jU&4Z(9HWEC2ui06_p40008OjE||y?GK}z zO&EZ)-n{z{a)K3v=81;mmA0<AmhVhw@iyc`&3|{61I~6YqK~98Vw5OmQ-xfDbjF=- z8N_A**6fx0#r(KaDON}}o43Sv(iTm3lx}qOEl<})aVL6>S4Fj_r^UyThZDG{h6k9m zHI_(7spd!5_$SH6m{<Auh$$AQ#YFX|N5^T`76u^M6AJ<hP-}aOo2$Fa+xtrD8!SAm hOG|u=TnwDd%p5ZU9W6agU2T1B9e};f-Q8UP06VhvYa0Ln diff --git a/contrib/docs/latex/ogl/forward.gif b/contrib/docs/latex/ogl/forward.gif index 9c81e8c92fed7fe851ce02e7854dc26a58eae9b2..d8862174ed264064e4092accd3b9cef539651ad1 100644 GIT binary patch literal 959 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0fnyGXIEReKh6M+kIfS)hPHb3s zxLrWmYmUc6#fEMMt*jmnhsLHJY3Haf96?J?Hp|-2i-|Ny^_-?1d#FXTc$r6!p5d)K zGcGBgoU2&9ibd*+`o-D${aUf7wyeCo+&Es%)uQy}(Z*2TG}~E%ORlfx_IlKED>NZ; wbH-jL-q~hvBDNIFUuAn+=ylY_lIO=twXW(!Y|OjPCFiqa!^6Y8%uEc{09+_1fB*mh literal 164 zcmV;V09*e@Nk%v~VI=?<0Pz3-zrVld=jU&4Z(9HWEC2ui03`qz0007gjE||y?Z1Qp zwAzdF6*A}#V%!v#-{_g@)>Q-cu3}3Ku`2^Nfa3dZ+VyHW%gtsZ`jV7k@%j8Ij}~W) zc{NUP6)X3OWa^|{8nl?rh|gZ1@{(qofnsWu+nmFHSnaq>lB41zSVC9`a)_v*xHx0L S5h*!IS!o$ynW>ps0028gDN7ju diff --git a/contrib/docs/latex/ogl/ogl.hpj b/contrib/docs/latex/ogl/ogl.hpj index 5db5ace6f0..062c8fb3e2 100644 --- a/contrib/docs/latex/ogl/ogl.hpj +++ b/contrib/docs/latex/ogl/ogl.hpj @@ -1,5 +1,5 @@ [OPTIONS] -BMROOT=d:\wx2\wxwind~1\docs\latex\ogl ; Assume that bitmaps are where the source is +BMROOT=d:\wx2\wxwind~1\contrib\docs\latex\ogl ; Assume that bitmaps are where the source is TITLE=OGL Manual CONTENTS=Contents COMPRESS=HIGH diff --git a/contrib/docs/latex/ogl/up.gif b/contrib/docs/latex/ogl/up.gif index 316d0d2a14b571bea2eb874efd04bfe509f53b34..870c89e80a826e3b225cc8fe9a30edf9c5a66c22 100644 GIT binary patch literal 998 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0f#WcPIEReKh6M+kIfS)hPHb3s zxLrWmYmUc8MFs{@V=tBk4vcQS3gSg?UKlR%Y*zN1W>fj;(a}CV`%O8V#mmmJDyQBv znOUrUdY)b7p%TfE<WsX;wdG=GmL&Ns@?GpT*Q<27-(3EUR##4aSao^5;NGM?9g}np z_6MXcGCdvoByvv1eJ&B}f}Gen<+rt#SZ_}_v)%vqI@ML?it&5Oe?N2Wl*mqONqVei lrfp&P=yaL+vexKtMaie;nK#$Ol;*#@ydrpYnS=m?H2|-sI%)s_ literal 137 zcmV;40CxXJNk%v~VHyA!0Pz3-zrVld=jU&4Z(9HWEC2ui02%-o0007FjE||ytzv+j zv|1owxcuhWh0?c)Avq0}dTQw^q7qBdoDA6WKJ*l>%gtCeAWZlgxpoy|ZDMRPr_m>p rx}08pS4?)u<%PW<QBYY9oyjHh?Q62&;&M&qj?e4yfxZ7PPyhfsDH=Ws diff --git a/contrib/include/wx/stc/SciLexer.h b/contrib/include/wx/stc/SciLexer.h new file mode 100644 index 0000000000..d869758f61 --- /dev/null +++ b/contrib/include/wx/stc/SciLexer.h @@ -0,0 +1,181 @@ +// Scintilla source code edit control +// SciLexer - interface to the added lexer functions in the SciLexer version of the edit control +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SCILEXER_H +#define SCILEXER_H + +// SciLexer features - not in standard Scintilla + +#define SCLEX_CONTAINER 0 +#define SCLEX_NULL 1 +#define SCLEX_PYTHON 2 +#define SCLEX_CPP 3 +#define SCLEX_HTML 4 +#define SCLEX_XML 5 +#define SCLEX_PERL 6 +#define SCLEX_SQL 7 +#define SCLEX_VB 8 +#define SCLEX_PROPERTIES 9 +#define SCLEX_ERRORLIST 10 +#define SCLEX_MAKEFILE 11 +#define SCLEX_BATCH 12 +#define SCLEX_XCODE 13 +#define SCLEX_LATEX 14 + +// Lexical states for SCLEX_PYTHON +#define SCE_P_DEFAULT 0 +#define SCE_P_COMMENTLINE 1 +#define SCE_P_NUMBER 2 +#define SCE_P_STRING 3 +#define SCE_P_CHARACTER 4 +#define SCE_P_WORD 5 +#define SCE_P_TRIPLE 6 +#define SCE_P_TRIPLEDOUBLE 7 +#define SCE_P_CLASSNAME 8 +#define SCE_P_DEFNAME 9 +#define SCE_P_OPERATOR 10 +#define SCE_P_IDENTIFIER 11 +#define SCE_P_COMMENTBLOCK 12 +#define SCE_P_STRINGEOL 13 + +// Lexical states for SCLEX_CPP, SCLEX_VB +#define SCE_C_DEFAULT 0 +#define SCE_C_COMMENT 1 +#define SCE_C_COMMENTLINE 2 +#define SCE_C_COMMENTDOC 3 +#define SCE_C_NUMBER 4 +#define SCE_C_WORD 5 +#define SCE_C_STRING 6 +#define SCE_C_CHARACTER 7 +#define SCE_C_UUID 8 +#define SCE_C_PREPROCESSOR 9 +#define SCE_C_OPERATOR 10 +#define SCE_C_IDENTIFIER 11 +#define SCE_C_STRINGEOL 12 + +// Lexical states for SCLEX_HTML, SCLEX_xML +#define SCE_H_DEFAULT 0 +#define SCE_H_TAG 1 +#define SCE_H_TAGUNKNOWN 2 +#define SCE_H_ATTRIBUTE 3 +#define SCE_H_ATTRIBUTEUNKNOWN 4 +#define SCE_H_NUMBER 5 +#define SCE_H_DOUBLESTRING 6 +#define SCE_H_SINGLESTRING 7 +#define SCE_H_OTHER 8 +#define SCE_H_COMMENT 9 +#define SCE_H_ENTITY 10 +// XML and ASP +#define SCE_H_TAGEND 11 +#define SCE_H_XMLSTART 12 +#define SCE_H_XMLEND 13 +#define SCE_H_SCRIPT 14 +#define SCE_H_ASP 15 +#define SCE_H_ASPAT 16 +// Embedded Javascript +#define SCE_HJ_START 40 +#define SCE_HJ_DEFAULT 41 +#define SCE_HJ_COMMENT 42 +#define SCE_HJ_COMMENTLINE 43 +#define SCE_HJ_COMMENTDOC 44 +#define SCE_HJ_NUMBER 45 +#define SCE_HJ_WORD 46 +#define SCE_HJ_KEYWORD 47 +#define SCE_HJ_DOUBLESTRING 48 +#define SCE_HJ_SINGLESTRING 49 +#define SCE_HJ_SYMBOLS 50 +#define SCE_HJ_STRINGEOL 51 +// ASP Javascript +#define SCE_HJA_START 55 +#define SCE_HJA_DEFAULT 56 +#define SCE_HJA_COMMENT 57 +#define SCE_HJA_COMMENTLINE 58 +#define SCE_HJA_COMMENTDOC 59 +#define SCE_HJA_NUMBER 60 +#define SCE_HJA_WORD 61 +#define SCE_HJA_KEYWORD 62 +#define SCE_HJA_DOUBLESTRING 63 +#define SCE_HJA_SINGLESTRING 64 +#define SCE_HJA_SYMBOLS 65 +#define SCE_HJA_STRINGEOL 66 +// Embedded VBScript +#define SCE_HB_START 70 +#define SCE_HB_DEFAULT 71 +#define SCE_HB_COMMENTLINE 72 +#define SCE_HB_NUMBER 73 +#define SCE_HB_WORD 74 +#define SCE_HB_STRING 75 +#define SCE_HB_IDENTIFIER 76 +#define SCE_HB_STRINGEOL 77 +// ASP VBScript +#define SCE_HBA_START 80 +#define SCE_HBA_DEFAULT 81 +#define SCE_HBA_COMMENTLINE 82 +#define SCE_HBA_NUMBER 83 +#define SCE_HBA_WORD 84 +#define SCE_HBA_STRING 85 +#define SCE_HBA_IDENTIFIER 86 +#define SCE_HBA_STRINGEOL 87 +// Embedded Python +#define SCE_HP_START 90 +#define SCE_HP_DEFAULT 91 +#define SCE_HP_COMMENTLINE 92 +#define SCE_HP_NUMBER 93 +#define SCE_HP_STRING 94 +#define SCE_HP_CHARACTER 95 +#define SCE_HP_WORD 96 +#define SCE_HP_TRIPLE 97 +#define SCE_HP_TRIPLEDOUBLE 98 +#define SCE_HP_CLASSNAME 99 +#define SCE_HP_DEFNAME 100 +#define SCE_HP_OPERATOR 101 +#define SCE_HP_IDENTIFIER 102 +// ASP Python +#define SCE_HPA_START 105 +#define SCE_HPA_DEFAULT 106 +#define SCE_HPA_COMMENTLINE 107 +#define SCE_HPA_NUMBER 108 +#define SCE_HPA_STRING 109 +#define SCE_HPA_CHARACTER 110 +#define SCE_HPA_WORD 111 +#define SCE_HPA_TRIPLE 112 +#define SCE_HPA_TRIPLEDOUBLE 113 +#define SCE_HPA_CLASSNAME 114 +#define SCE_HPA_DEFNAME 115 +#define SCE_HPA_OPERATOR 116 +#define SCE_HPA_IDENTIFIER 117 + +// Lexical states for SCLEX_PERL +#define SCE_PL_DEFAULT 0 +#define SCE_PL_HERE 1 +#define SCE_PL_COMMENTLINE 2 +#define SCE_PL_POD 3 +#define SCE_PL_NUMBER 4 +#define SCE_PL_WORD 5 +#define SCE_PL_STRING 6 +#define SCE_PL_CHARACTER 7 +#define SCE_PL_PUNCTUATION 8 +#define SCE_PL_PREPROCESSOR 9 +#define SCE_PL_OPERATOR 10 +#define SCE_PL_IDENTIFIER 11 +#define SCE_PL_SCALAR 12 +#define SCE_PL_ARRAY 13 +#define SCE_PL_HASH 14 +#define SCE_PL_SYMBOLTABLE 15 +#define SCE_PL_REF 16 +#define SCE_PL_REGEX 17 +#define SCE_PL_REGSUBST 18 +#define SCE_PL_LONGQUOTE 19 +#define SCE_PL_BACKTICKS 20 +#define SCE_PL_DATASECTION 21 + +// Lexical states for SCLEX_LATEX +#define SCE_L_DEFAULT 0 +#define SCE_L_COMMAND 1 +#define SCE_L_TAG 2 +#define SCE_L_MATH 3 +#define SCE_L_COMMENT 4 + +#endif diff --git a/contrib/include/wx/stc/stc.h b/contrib/include/wx/stc/stc.h index 628d87fd3d..d5925f19be 100644 --- a/contrib/include/wx/stc/stc.h +++ b/contrib/include/wx/stc/stc.h @@ -22,7 +22,7 @@ #include <wx/wx.h> - +#include "SciLexer.h" //---------------------------------------------------------------------- // constants and stuff @@ -53,7 +53,7 @@ const int wxSTC_STYLE_LINENUMBER = 33; const int wxSTC_STYLE_BRACELIGHT = 34; const int wxSTC_STYLE_BRACEBAD = 35; const int wxSTC_STYLE_CONTROLCHAR = 36; -const int wxSTC_STYLE_MAX = 63; +const int wxSTC_STYLE_MAX = 127; const int wxSTC_STYLE_MASK = 31; const int wxSTC_MARKER_MAX = 31; @@ -63,16 +63,32 @@ const int wxSTC_MARK_ARROW = 2; const int wxSTC_MARK_SMALLRECT = 3; const int wxSTC_MARK_SHORTARROW = 4; const int wxSTC_MARK_EMPTY = 5; +const int wxSTC_MARK_ARROWDOWN = 6; +const int wxSTC_MARK_MINUS = 7; +const int wxSTC_MARK_PLUS = 8; + +const int wxSTC_MARKNUM_FOLDER = 30; +const int wxSTC_MARKNUM_FOLDEROPEN= 31; +const int wxSTC_MASK_FOLDERS = ((1 << wxSTC_MARKNUM_FOLDER) | (1 << wxSTC_MARKNUM_FOLDEROPEN)); +const int wxSTC_INDIC_MAX = 7; const int wxSTC_INDIC_PLAIN = 0; const int wxSTC_INDIC_SQUIGGLE = 1; const int wxSTC_INDIC_TT = 2; +const int wxSTC_INDIC_DIAGONAL = 3; +const int wxSTC_INDIC_STRIKE = 4; const int wxSTC_INDIC0_MASK = 32; const int wxSTC_INDIC1_MASK = 64; const int wxSTC_INDIC2_MASK = 128; const int wxSTC_INDICS_MASK = (wxSTC_INDIC0_MASK | wxSTC_INDIC1_MASK | wxSTC_INDIC2_MASK); +const int wxSTC_FOLDLEVELBASE = 0x0400; +const int wxSTC_FOLDLEVELWHITEFLAG = 0x1000; +const int wxSTC_FOLDLEVELHEADERFLAG = 0x2000; +const int wxSTC_FOLDLEVELNUMBERMASK = 0x0FFF; + + // key commands enum { wxSTC_CMD_LINEDOWN = 2300, @@ -111,7 +127,14 @@ enum { wxSTC_CMD_ZOOMIN, wxSTC_CMD_ZOOMOUT, wxSTC_CMD_DELWORDLEFT, - wxSTC_CMD_DELWORDRIGHT + wxSTC_CMD_DELWORDRIGHT, + wxSTC_CMD_LINECUT, + wxSTC_CMD_LINEDELETE, + wxSTC_CMD_LINETRANSPOSE, + wxSTC_CMD_LOWERCASE, + wxSTC_CMD_UPPERCASE, + wxSTC_CMD_LINESCROLLDOWN, + wxSTC_CMD_LINESCROLLUP }; @@ -129,6 +152,8 @@ enum wxSTC_LEX { wxSTC_LEX_ERRORLIST, wxSTC_LEX_MAKEFILE, wxSTC_LEX_BATCH, + wxSTC_LEX_XCODE, + wxSTC_LEX_LATEX }; @@ -153,12 +178,22 @@ extern const wxChar* wxSTCNameStr; class wxStyledTextCtrl : public wxControl { public: +#ifdef SWIG + wxStyledTextCtrl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const char* name = "styledtext"); +#else wxStyledTextCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxSTCNameStr); - ~wxStyledTextCtrl(); +#endif + +#ifndef SWIG + ~wxStyledTextCtrl(); +#endif // Text retrieval and modification @@ -170,8 +205,10 @@ public: bool GetReadOnly(); wxString GetTextRange(int startPos, int endPos); wxString GetStyledTextRange(int startPos, int endPos); +#ifndef SWIG void GetTextRange(int startPos, int endPos, char* buff); void GetStyledTextRange(int startPos, int endPos, char* buff); +#endif void AddText(const wxString& text); void AddStyledText(const wxString& text); void InsertText(int pos, const wxString& text); @@ -203,7 +240,11 @@ public: // Selection and information +#ifdef SWIG + void GetSelection(int* OUTPUT, int* OUTPUT); +#else void GetSelection(int* startPos, int* endPos); +#endif void SetSelection(int startPos, int endPos); wxString GetSelectedText(); void HideSelection(bool hide); @@ -218,7 +259,11 @@ public: int GetLineStartPos(int line); int GetLineLengthAtPos(int pos); int GetLineLength(int line); - wxString GetCurrentLineText(int* linePos=NULL); +#ifdef SWIG + wxString GetCurrentLineText(int* OUTPUT); +#else + wxString GetCurrentLineText(int* linePos); +#endif int GetCurrentLine(); int PositionFromPoint(wxPoint pt); int LineFromPoint(wxPoint pt); @@ -239,7 +284,10 @@ public: void EnsureCaretVisible(); void SetCaretPolicy(int policy, int slop=0); int GetSelectionType(); - + int GetLinesOnScreen(); + bool IsSelectionRectangle(); + void SetUseHorizontalScrollBar(bool use); + bool GetUseHorizontalScrollBar(); // Searching @@ -268,6 +316,8 @@ public: void StartStyling(int pos, int mask); void SetStyleFor(int length, int style); void SetStyleBytes(int length, char* styleBytes); + void SetLineState(int line, int value); + int GetLineState(int line); // Style Definition @@ -277,12 +327,13 @@ public: void StyleSetForeground(int styleNum, const wxColour& colour); void StyleSetBackground(int styleNum, const wxColour& colour); void StyleSetFont(int styleNum, wxFont& font); - void StyleSetFontAttr(int styleNum, int size, const wxString& faceName, bool bold, bool italic); + void StyleSetFontAttr(int styleNum, int size, const wxString& faceName, bool bold=FALSE, bool italic=FALSE, bool underline=FALSE); void StyleSetBold(int styleNum, bool bold); void StyleSetItalic(int styleNum, bool italic); void StyleSetFaceName(int styleNum, const wxString& faceName); void StyleSetSize(int styleNum, int pointSize); void StyleSetEOLFilled(int styleNum, bool fillEOL); + void StyleSetUnderline(int styleNum, bool underline); // Margins in the edit area @@ -313,8 +364,15 @@ public: // Other settings void SetBufferedDraw(bool isBuffered); void SetTabWidth(int numChars); + void SetIndent(int numChars); + void SetUseTabs(bool usetabs); + void SetLineIndentation(int line, int indentation); + int GetLineIndentation(int line); + int GetLineIndentationPos(int line); void SetWordChars(const wxString& wordChars); + void SetUsePop(bool usepopup); + // Brace highlighting void BraceHighlight(int pos1, int pos2); @@ -352,7 +410,9 @@ public: int AutoCompPosAtStart(); void AutoCompComplete(); void AutoCompStopChars(const wxString& stopChars); - + void AutoCompSetSeparator(char separator); + char AutoCompGetSeparator(); + void AutoCompSelect(const wxString& stringtoselect); // Call tips void CallTipShow(int pos, const wxString& text); @@ -391,15 +451,23 @@ public: int DocLineFromVisible(int displayLine); int SetFoldLevel(int line, int level); int GetFoldLevel(int line); - int GetLastChild(int line); + int GetLastChild(int line, int level); int GetFoldParent(int line); void ShowLines(int lineStart, int lineEnd); void HideLines(int lineStart, int lineEnd); bool GetLineVisible(int line); - void SetFoldExpanded(int line); + void SetFoldExpanded(int line, bool expanded); bool GetFoldExpanded(int line); void ToggleFold(int line); void EnsureVisible(int line); + void SetFoldFlags(int flags); + + + // Zooming + void ZoomIn(); + void ZoomOut(); + void SetZoom(int zoom); + int GetZoom(); // Long Lines @@ -419,7 +487,11 @@ public: void SetKeywords(int keywordSet, const wxString& keywordList); + // Event mask for Modified Event + void SetModEventMask(int mask); + //int GetModEventMask(); +#ifndef SWIG private: // Event handlers void OnPaint(wxPaintEvent& evt); @@ -430,11 +502,13 @@ private: void OnMouseLeftUp(wxMouseEvent& evt); void OnMouseRightUp(wxMouseEvent& evt); void OnChar(wxKeyEvent& evt); + void OnKeyDown(wxKeyEvent& evt); void OnLoseFocus(wxFocusEvent& evt); void OnGainFocus(wxFocusEvent& evt); void OnSysColourChanged(wxSysColourChangedEvent& evt); void OnEraseBackground(wxEraseEvent& evt); void OnMenu(wxCommandEvent& evt); + void OnListBox(wxCommandEvent& evt); // Turn notifications from Scintilla into events @@ -445,6 +519,7 @@ private: private: DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxStyledTextCtrl) ScintillaWX* m_swx; wxStopWatch m_stopWatch; @@ -454,13 +529,14 @@ private: friend class ScintillaWX; friend class Platform; +#endif }; //---------------------------------------------------------------------- class wxStyledTextEvent : public wxCommandEvent { public: - wxStyledTextEvent(wxEventType commandType, int id); + wxStyledTextEvent(wxEventType commandType=0, int id=0); ~wxStyledTextEvent() {} void SetPosition(int pos) { m_position = pos; } @@ -499,7 +575,10 @@ public: void CopyObject(wxObject& obj) const; +#ifndef SWIG private: + DECLARE_DYNAMIC_CLASS(wxStyledTextEvent) + int m_position; int m_key; int m_modifiers; @@ -517,11 +596,11 @@ private: int m_message; // wxEVT_STC_MACRORECORD int m_wParam; int m_lParam; - +#endif }; - +// Event types enum { wxEVT_STC_CHANGE = 1650, wxEVT_STC_STYLENEEDED, @@ -538,6 +617,21 @@ enum { wxEVT_STC_NEEDSHOWN }; +// Modification and action types +const int wxSTC_MOD_INSERTTEXT = 0x1; +const int wxSTC_MOD_DELETETEXT = 0x2; +const int wxSTC_MOD_CHANGESTYLE = 0x4; +const int wxSTC_MOD_CHANGEFOLD = 0x8; +const int wxSTC_PERFORMED_USER = 0x10; +const int wxSTC_PERFORMED_UNDO = 0x20; +const int wxSTC_PERFORMED_REDO = 0x40; +const int wxSTC_LASTSTEPINUNDOREDO = 0x100; +const int wxSTC_MOD_CHANGEMARKER = 0x200; +const int wxSTC_MOD_BEFOREINSERT = 0x400; +const int wxSTC_MOD_BEFOREDELETE = 0x800; + + +#ifndef SWIG typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_CHANGE(id, fn) { wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, @@ -549,9 +643,12 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_ROMODIFYATTEMPT(id, fn) { wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, #define EVT_STC_DOUBLECLICK(id, fn) { wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, #define EVT_STC_MODIFIED(id, fn) { wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, -#define EVT_STC_CMDKEY(id, fn) { wxEVT_STC_CMDKEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, -#define EVT_STC_UNKNOWNCMDKEY(id, fn) { wxEVT_STC_UNKNOWNCMDKEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_KEY(id, fn) { wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MACRORECORD(id, fn) { wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MARGINCLICK(id, fn) { wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_NEEDSHOWN(id, fn) { wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#endif //---------------------------------------------------------------------- //---------------------------------------------------------------------- diff --git a/contrib/samples/Makefile.in b/contrib/samples/Makefile.in index 2ec692ed42..c054aa6453 100644 --- a/contrib/samples/Makefile.in +++ b/contrib/samples/Makefile.in @@ -1,12 +1,10 @@ -# -# Makefile : Builds wxWindows utils for Unix. -# +# $Id$ + +CONTRIB_SAMPLES=mmedia ogl stc all: - cd mmedia; make - cd stc; make + @for d in $(CONTRIB_SAMPLES); do (cd $$d && $(MAKE)); done clean: - cd mmedia; make clean - cd stc; make clean + @for d in $(CONTRIB_SAMPLES); do (cd $$d && $(MAKE) clean); done diff --git a/contrib/samples/mmedia/Makefile.in b/contrib/samples/mmedia/Makefile.in index 04b776a093..7c4c5cbbba 100644 --- a/contrib/samples/mmedia/Makefile.in +++ b/contrib/samples/mmedia/Makefile.in @@ -1,13 +1,5 @@ -# -# File: makefile.unx -# Author: Julian Smart -# Created: 1998 -# Updated: -# Copyright: (c) 1998 Julian Smart -# -# "%W% %G%" -# -# Makefile for minimal example (UNIX). +# Makefile for mmedia sample. +# $Id$ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. @@ -17,25 +9,8 @@ PROGRAM=mmboard OBJECTS=mmboard.o mmbman.o -EXTRA_LIBS= $(top_builddir)/contrib/src/mmedia/libmmedia.@WX_TARGET_LIBRARY_TYPE@ @ESD_LINK@ +APPEXTRALIBS=$(top_builddir)/lib/libmmedia.@WX_TARGET_LIBRARY_TYPE@ @ESD_LINK@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include -# the comment at the end of the next line is needed because otherwise autoconf -# would remove this line completely - it contains a built-in hack to remove -# any VPATH assignment not containing ':' -VPATH = @PATH_IFS@$(top_srcdir)/contrib/samples/mmedia # ':' for autoconf +include $(top_builddir)/src/makeprog.env -include ../../../src/make.env - -.SUFFIXES: .o .cpp .c - -.cpp.o: - $(CC) -c $(CPPFLAGS) $(EXTRA_CPPFLAGS) -o $@ $< - -all: $(PROGRAM) - -clean: - rm -f *.o $(PROGRAM) - -mmboard: $(OBJECTS) - $(CC) $(LDFLAGS) -o mmboard $(OBJECTS) $(EXTRA_LIBS) $(LDLIBS) $(top_builddir)/lib/@WX_TARGET_LIBRARY@ diff --git a/contrib/samples/ogl/Makefile.in b/contrib/samples/ogl/Makefile.in new file mode 100644 index 0000000000..e53c85784e --- /dev/null +++ b/contrib/samples/ogl/Makefile.in @@ -0,0 +1,12 @@ +# +# Makefile : Builds wxWindows utils for Unix. +# + +OGL_SAMPLES=ogledit studio + +all: + @for d in $(OGL_SAMPLES); do (cd $$d && $(MAKE)); done + +clean: + @for d in $(OGL_SAMPLES); do (cd $$d && $(MAKE) clean); done + diff --git a/contrib/samples/ogl/ogledit/Makefile b/contrib/samples/ogl/ogledit/Makefile deleted file mode 100644 index 76d11a5ebb..0000000000 --- a/contrib/samples/ogl/ogledit/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -# File: Makefile -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: (c) 2000 Julian Smart -# -# Makefile for OGL demo (GTK version) -# -# This makefile requires wxWindows/GTK to be -# installed (possibly using "make install") -# on your system. -# - -CPP = gcc -g -CC = gcc -WXCONFIG=../../../../wx-config -WXINCLUDE=-I../../../../include -I../../../include -WXLIB=-L../../../../lib -L../../../src/ogl - -OBJECTS=ogledit.o palette.o doc.o view.o - -ogledit: $(OBJECTS) - $(CPP) -o ogledit $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl - -ogledit.o: ogledit.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c ogledit.cpp - -palette.o: palette.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c palette.cpp - -doc.o: doc.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp - -view.o: view.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp - -clean: - rm -f *.o ogledit diff --git a/contrib/samples/ogl/ogledit/Makefile.in b/contrib/samples/ogl/ogledit/Makefile.in new file mode 100644 index 0000000000..055739c441 --- /dev/null +++ b/contrib/samples/ogl/ogledit/Makefile.in @@ -0,0 +1,16 @@ +# Makefile for OGLEdit example. +# $Id$ + +top_srcdir = @top_srcdir@/.. +top_builddir = ../../../.. +program_dir = contrib/samples/ogl/ogledit + +PROGRAM=ogledit + +OBJECTS=$(PROGRAM).o doc.o view.o palette.o + +APPEXTRALIBS=$(top_builddir)/lib/libogl.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRADEFS=-I$(top_srcdir)/contrib/include + +include $(top_builddir)/src/makeprog.env + diff --git a/contrib/samples/ogl/ogledit/makefile.unx b/contrib/samples/ogl/ogledit/makefile.unx index 31b223db53..76d11a5ebb 100644 --- a/contrib/samples/ogl/ogledit/makefile.unx +++ b/contrib/samples/ogl/ogledit/makefile.unx @@ -1,20 +1,39 @@ # -# File: makefile.unx +# File: Makefile # Author: Julian Smart -# Created: 1998 +# Created: 1999 # Updated: -# Copyright: (c) 1998 Julian Smart +# Copyright: (c) 2000 Julian Smart # -# "%W% %G%" +# Makefile for OGL demo (GTK version) # -# Makefile for OGLEdit example (UNIX). +# This makefile requires wxWindows/GTK to be +# installed (possibly using "make install") +# on your system. +# + +CPP = gcc -g +CC = gcc +WXCONFIG=../../../../wx-config +WXINCLUDE=-I../../../../include -I../../../include +WXLIB=-L../../../../lib -L../../../src/ogl + +OBJECTS=ogledit.o palette.o doc.o view.o + +ogledit: $(OBJECTS) + $(CPP) -o ogledit $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl -PROGRAM=ogledit +ogledit.o: ogledit.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c ogledit.cpp -OBJECTS=$(PROGRAM).o doc.o view.o palette.o +palette.o: palette.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c palette.cpp -# EXTRACPPFLAGS=-I$(WXDIR)/contrib/include -EXTRALDLIBS=-logl$(GUISUFFIX) +doc.o: doc.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp -include ../../../../src/makeprog.env +view.o: view.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp +clean: + rm -f *.o ogledit diff --git a/contrib/samples/ogl/studio/Makefile b/contrib/samples/ogl/studio/Makefile deleted file mode 100644 index 2070bc3b13..0000000000 --- a/contrib/samples/ogl/studio/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# -# File: Makefile -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: (c) 2000 Julian Smart -# -# Makefile for OGL demo (GTK version) -# -# This makefile requires wxWindows/GTK to be -# installed (possibly using "make install") -# on your system. -# - -CPP = gcc -g -CC = gcc -WXCONFIG=../../../../wx-config -WXINCLUDE=-I../../../../include -I../../../include -WXLIB=-L../../../../lib -L../../../src/ogl - -OBJECTS=studio.o cspalette.o csprint.o dialogs.o doc.o mainfrm.o project.o shapes.o symbols.o view.o - -studio: $(OBJECTS) - $(CPP) -o studio $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl - -studio.o: studio.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c studio.cpp - -cspalette.o: cspalette.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c cspalette.cpp - -doc.o: doc.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp - -view.o: view.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp - -dialogs.o: dialogs.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c dialogs.cpp - -mainfrm.o: mainfrm.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c mainfrm.cpp - -project.o: project.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c project.cpp - -shapes.o: shapes.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c shapes.cpp - -symbols.o: symbols.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c symbols.cpp - -csprint.o: csprint.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c csprint.cpp - -clean: - rm -f *.o studio diff --git a/contrib/samples/ogl/studio/Makefile.in b/contrib/samples/ogl/studio/Makefile.in new file mode 100644 index 0000000000..1f6d9c4673 --- /dev/null +++ b/contrib/samples/ogl/studio/Makefile.in @@ -0,0 +1,19 @@ +# Makefile for OGL Studio. +# $Id$ + +top_srcdir = @top_srcdir@/.. +top_builddir = ../../../.. +program_dir = contrib/samples/ogl/studio + +PROGRAM=studio + +DATAFILES=studio_resources.wxr + +OBJECTS=$(PROGRAM).o doc.o shapes.o symbols.o view.o cspalette.o\ + mainfrm.o project.o dialogs.o csprint.o + +APPEXTRALIBS=$(top_builddir)/lib/libogl.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRADEFS=-I$(top_srcdir)/contrib/include -I$(top_srcdir)/$(program_dir)/bitmaps + +include $(top_builddir)/src/makeprog.env + diff --git a/contrib/samples/ogl/studio/makefile.unx b/contrib/samples/ogl/studio/makefile.unx index 5fca57a097..2070bc3b13 100644 --- a/contrib/samples/ogl/studio/makefile.unx +++ b/contrib/samples/ogl/studio/makefile.unx @@ -1,39 +1,57 @@ # -# File: makefile.unx +# File: Makefile # Author: Julian Smart -# Created: 1998 +# Created: 1999 # Updated: -# Copyright: (c) 1998 Julian Smart +# Copyright: (c) 2000 Julian Smart # -# "%W% %G%" +# Makefile for OGL demo (GTK version) # -# Makefile for OGL Studio (UNIX). +# This makefile requires wxWindows/GTK to be +# installed (possibly using "make install") +# on your system. +# + +CPP = gcc -g +CC = gcc +WXCONFIG=../../../../wx-config +WXINCLUDE=-I../../../../include -I../../../include +WXLIB=-L../../../../lib -L../../../src/ogl + +OBJECTS=studio.o cspalette.o csprint.o dialogs.o doc.o mainfrm.o project.o shapes.o symbols.o view.o -PROGRAM=studio +studio: $(OBJECTS) + $(CPP) -o studio $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl -OBJECTS=$(PROGRAM).o doc.o shapes.o symbols.o view.o cspalette.o\ - mainfrm.o project.o dialogs.o csprint.o +studio.o: studio.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c studio.cpp -EXTRACPPFLAGS=-I$(WXDIR)/utils/ogl/src -I./bitmaps -EXTRALDLIBS=-logl$(GUISUFFIX) +cspalette.o: cspalette.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c cspalette.cpp -#WXDIR=/home/jacs/wx2 +doc.o: doc.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp -include $(WXDIR)/src/makeprog.env +view.o: view.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp -cleanogl: - cd $(WXDIR)/utils/ogl/src; make -f makefile.unx cleanmotif +dialogs.o: dialogs.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c dialogs.cpp -ogl: - cd $(WXDIR)/utils/ogl/src; make -f makefile.unx motif +mainfrm.o: mainfrm.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c mainfrm.cpp -wx: - cd $(WXDIR)/src/motif; make -f makefile.unx motif +project.o: project.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c project.cpp -cleanwx: - cd $(WXDIR)/src/motif; make -f makefile.unx cleanmotif +shapes.o: shapes.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c shapes.cpp -cleanall: cleanmotif cleanogl cleanwx +symbols.o: symbols.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c symbols.cpp -makeall: wx ogl motif +csprint.o: csprint.cpp + $(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c csprint.cpp +clean: + rm -f *.o studio diff --git a/contrib/samples/stc/Makefile.in b/contrib/samples/stc/Makefile.in index 39b2292d0d..cffdcc78d7 100644 --- a/contrib/samples/stc/Makefile.in +++ b/contrib/samples/stc/Makefile.in @@ -13,9 +13,9 @@ PROGRAM=stctest OBJECTS=$(PROGRAM).o -APPEXTRALIBS=$(top_builddir)/contrib/src/stc/libstc.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/libstc.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include DATAFILES=stctest.cpp -include ../../../src/makeprog.env +include $(top_builddir)/src/makeprog.env diff --git a/contrib/src/Makefile.in b/contrib/src/Makefile.in index 93e54c589c..42a7ef8d06 100644 --- a/contrib/src/Makefile.in +++ b/contrib/src/Makefile.in @@ -1,6 +1,4 @@ -# -# Makefile : Builds wxWindows contrib src for Unix. -# +# $Id$ CONTRIB_SUBDIRS=ogl mmedia stc diff --git a/contrib/src/mmedia/Makefile.in b/contrib/src/mmedia/Makefile.in index 9dbae70e85..3162aa9b3f 100644 --- a/contrib/src/mmedia/Makefile.in +++ b/contrib/src/mmedia/Makefile.in @@ -1,7 +1,8 @@ -# +# $Id$ -top_srcdir = @top_srcdir@ +top_srcdir = @top_srcdir@/.. top_builddir = ../../.. +libsrc_dir = contrib/src/mmedia TARGET_LIBNAME=libmmedia @@ -9,17 +10,20 @@ LIBVERSION_CURRENT=1 LIBVERSION_REVISION=0 LIBVERSION_AGE=0 +HEADER_PATH=$(top_srcdir)/contrib/include/wx +HEADER_SUBDIR=mmedia + +HEADERS=cdbase.h cdunix.h cdwin.h sndaiff.h sndbase.h sndcodec.h \ + sndcpcm.h sndesd.h sndfile.h sndg72x.h sndmsad.h sndoss.h \ + sndpcm.h sndulaw.h sndwav.h sndwin.h vidbase.h vidwin.h \ + vidxanm.h + OBJECTS=cdbase.o cdwin.o g711.o g721.o g723_24.o \ g723_40.o g72x.o sndaiff.o sndbase.o sndcodec.o \ sndcpcm.o sndfile.o sndg72x.o sndpcm.o sndulaw.o \ sndwav.o sndwin.o vidbase.o vidwin.o vidxanm.o sndoss.o sndesd.o -# the comment at the end of the next line is needed because otherwise autoconf -# would remove this line completely - it contains a built-in hack to remove -# any VPATH assignment not containing ':' -VPATH = :$(top_srcdir)/src/mmedia # ':' for autoconf - -APPEXTRADEFS=-I$(top_srcdir)/include -I$(top_srcdir)/../include +APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makelib.env diff --git a/contrib/src/ogl/Makefile.in b/contrib/src/ogl/Makefile.in index 65ac689d73..e1e0aedcd1 100644 --- a/contrib/src/ogl/Makefile.in +++ b/contrib/src/ogl/Makefile.in @@ -1,7 +1,8 @@ -# +# $Id$ -top_srcdir = @top_srcdir@ +top_srcdir = @top_srcdir@/.. top_builddir = ../../.. +libsrc_dir = contrib/src/ogl TARGET_LIBNAME=libogl @@ -9,14 +10,17 @@ LIBVERSION_CURRENT=1 LIBVERSION_REVISION=0 LIBVERSION_AGE=0 -OBJECTS=basic.o bmpshape.o composit.o divided.o lines.o misc.o \ - basic2.o canvas.o constrnt.o drawn.o mfutils.o ogldiag.o +HEADER_PATH=$(top_srcdir)/contrib/include/wx +HEADER_SUBDIR=ogl -# the comment at the end of the next line is needed because otherwise autoconf -# would remove this line completely - it contains a built-in hack to remove -# any VPATH assignment not containing ':' -VPATH = :$(top_srcdir)/src/ogl # ':' for autoconf +HEADERS=basic.h basicp.h bmpshape.h canvas.h composit.h constrnt.h \ + divided.h drawn.h drawnp.h lines.h linesp.h mfutils.h misc.h \ + ogl.h ogldiag.h -APPEXTRADEFS=-I$(top_srcdir)/include -I$(top_srcdir)/../include +OBJECTS=basic.o bmpshape.o composit.o divided.o lines.o misc.o \ + basic2.o canvas.o constrnt.o drawn.o mfutils.o ogldiag.o + +APPEXTRADEFS=-I$(top_srcdir)/contrib/include include $(top_builddir)/src/makelib.env + diff --git a/contrib/src/ogl/makefile.vc b/contrib/src/ogl/makefile.vc index df1072a2c2..f4d62a3a74 100644 --- a/contrib/src/ogl/makefile.vc +++ b/contrib/src/ogl/makefile.vc @@ -132,7 +132,8 @@ DOCSOURCES=$(LOCALDOCDIR)\ogl.tex \ $(LOCALDOCDIR)\topics.tex $(LOCALDOCDIR)\sample.tex html: $(DOCDIR)\html\ogl\ogl.htm -htmlhelp: $(DOCDIR)\html\ogl\ogl.chm +htmlhelp: $(DOCDIR)\htmlhelp\ogl.chm +htb: $(DOCDIR)\htb\ogl.htb hlp: $(DOCDIR)\winhelp\ogl.hlp pdfrtf: $(DOCDIR)\pdf\ogl.rtf ps: $(DOCDIR)\ps\ogl.ps @@ -166,16 +167,27 @@ $(DOCDIR)\html\ogl\ogl.htm: $(DOCSOURCES) copy *.gif $(DOCDIR)\html\ogl -start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\ogl.tex $(DOCDIR)\html\ogl\ogl.htm -twice -html -erase $(DOCDIR)\html\ogl\*.con - -erase *.con + -erase *.con -erase $(DOCDIR)\html\ogl\*.ref cd $(THISDIR) - -$(DOCDIR)\html\ogl\ogl.chm: $(DOCDIR)\html\ogl\ogl.htm $(DOCDIR)\html\ogl\ogl.hhp +$(DOCDIR)\htmlhelp\ogl.chm: $(DOCDIR)\html\ogl\ogl.htm $(DOCDIR)\html\ogl\ogl.hhp cd $(DOCDIR)\html\ogl -hhc ogl.hhp + move ogl.chm $(DOCDIR)\htmlhelp\ogl.chm cd $(THISDIR) +# An htb file is a zip file containing the .htm, .gif, .hhp, .hhc and .hhk +# files, renamed to htb. +# This can then be used with e.g. helpview. +# Optionally, a cached version of the .hhp file can be generated with hhp2cached. +$(DOCDIR)\htb\ogl.htb: $(DOCDIR)\html\ogl\ogl.htm + cd $(DOCDIR)\html\ogl + -erase /Y ogl.zip ogl.htb + zip32 ogl.zip *.htm *.gif *.hhp *.hhc *.hhk + -mkdir $(DOCDIR)\htb + move ogl.zip $(DOCDIR)\htb\ogl.htb + cd $(THISDIR) $(LOCALDOCDIR)\ogl.dvi: $(DOCSOURCES) cd $(LOCALDOCDIR) @@ -193,4 +205,3 @@ $(WXDIR)\docs\ps\ogl.ps: $(LOCALDOCDIR)\ogl.dvi move ogl.ps $(WXDIR)\docs\ps\ogl.ps cd $(THISDIR) - diff --git a/contrib/src/stc/Makefile.in b/contrib/src/stc/Makefile.in index b1f75c4945..73170e98e2 100644 --- a/contrib/src/stc/Makefile.in +++ b/contrib/src/stc/Makefile.in @@ -5,12 +5,11 @@ # Version: $Id$ ############################################################################### -top_srcdir = @top_srcdir@ +top_srcdir = @top_srcdir@/.. top_builddir = ../../.. -this_dir = $(top_srcdir)/src/stc -scintilla_dir=$(this_dir)/scintilla -VPATH=$(this_dir)@PATH_IFS@$(scintilla_dir)/src # ':' for autoconf +scintilla_dir = $(top_srcdir)/contrib/src/stc/scintilla +libsrc_dir = contrib/src/stc@PATH_IFS@$(scintilla_dir)/src TARGET_LIBNAME=libstc @@ -18,23 +17,38 @@ LIBVERSION_CURRENT=1 LIBVERSION_REVISION=0 LIBVERSION_AGE=0 +HEADER_PATH=$(top_srcdir)/contrib/include/wx +HEADER_SUBDIR=stc + +HEADERS=stc.h + OBJECTS=PlatWX.o ScintillaWX.o stc.o \ - Accessor.o \ - AutoComplete.o \ + DocumentAccessor.o \ + LexCPP.o \ + LexHTML.o \ + LexOthers.o \ + LexPerl.o \ + LexPython.o \ + LexSQL.o \ + LexVB.o \ + UniConversion.o \ + WindowAccessor.o \ + AutoComplete.o \ CallTip.o \ - CellBuffer.o \ - ContractionState.o \ + CellBuffer.o \ + ContractionState.o \ Document.o \ - Editor.o \ + Editor.o \ Indicator.o \ - KeyMap.o \ + KeyMap.o \ KeyWords.o \ - LineMarker.o \ + LineMarker.o \ PropSet.o \ - ScintillaBase.o \ + ScintillaBase.o \ Style.o \ - ViewStyle.o - -APPEXTRADEFS=-D__WX__ -DSCI_LEXER -I$(scintilla_dir)/src -I$(scintilla_dir)/include -I$(top_srcdir)/include -I$(top_srcdir)/../include + ViewStyle.o \ + + +APPEXTRADEFS=-D__WX__ -DSCI_LEXER -I$(scintilla_dir)/src -I$(scintilla_dir)/include -I$(top_srcdir)/contrib/include include $(top_builddir)/src/makelib.env diff --git a/contrib/src/stc/PlatWX.cpp b/contrib/src/stc/PlatWX.cpp index 0dbd3d5ea7..5045e6d506 100644 --- a/contrib/src/stc/PlatWX.cpp +++ b/contrib/src/stc/PlatWX.cpp @@ -4,12 +4,13 @@ // Robin Dunn <robin@aldunn.com> // The License.txt file describes the conditions under which this software may be distributed. +#include <ctype.h> #include "Platform.h" #include "wx/stc/stc.h" Point Point::FromLong(long lpoint) { - return Point(lpoint & 0xFFFF, lpoint >> 32); + return Point(lpoint & 0xFFFF, lpoint >> 16); } wxRect wxRectFromPRectangle(PRectangle prc) { @@ -105,14 +106,15 @@ Font::Font() { Font::~Font() { } -void Font::Create(const char *faceName, int size, bool bold, bool italic) { +void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) { Release(); id = new wxFont(size, wxDEFAULT, italic ? wxITALIC : wxNORMAL, bold ? wxBOLD : wxNORMAL, false, - faceName); + faceName, + wxFONTENCODING_DEFAULT); } @@ -167,7 +169,7 @@ void Surface::InitPixMap(int width, int height, Surface *surface_) { Release(); hdc = new wxMemoryDC(surface_->hdc); hdcOwned = true; - bitmap = new wxBitmap(width, height); + bitmap = new wxBitmap(width, height+1); ((wxMemoryDC*)hdc)->SelectObject(*bitmap); // **** ::SetTextAlign(hdc, TA_BASELINE); } @@ -181,13 +183,26 @@ void Surface::BrushColor(Colour back) { } void Surface::SetFont(Font &font_) { - hdc->SetFont(*font_.GetID()); + + // I think the following check is valid. + // It eliminates a crash for me. -- eric@sourcegear.com + + if (font_.GetID()) + { + hdc->SetFont(*font_.GetID()); + } } int Surface::LogPixelsY() { return hdc->GetPPI().y; } + +int Surface::DeviceHeightFont(int points) { + return points * LogPixelsY() / 72; +} + + void Surface::MoveTo(int x_, int y_) { x = x_; y = y_; @@ -232,7 +247,7 @@ void Surface::FillRectangle(PRectangle rc, Surface &surfacePattern) { void Surface::RoundedRectangle(PRectangle rc, Colour fore, Colour back) { PenColour(fore); BrushColor(back); - hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 8); + hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4); } void Surface::Ellipse(PRectangle rc, Colour fore, Colour back) { @@ -242,7 +257,8 @@ void Surface::Ellipse(PRectangle rc, Colour fore, Colour back) { } void Surface::Copy(PRectangle rc, Point from, Surface &surfaceSource) { - hdc->Blit(rc.left, rc.top, rc.Width(), rc.Height(), + wxRect r = wxRectFromPRectangle(rc); + hdc->Blit(r.x, r.y, r.width, r.height, surfaceSource.hdc, from.x, from.y, wxCOPY); } @@ -344,7 +360,11 @@ void Surface::SetClip(PRectangle rc) { hdc->SetClippingRegion(wxRectFromPRectangle(rc)); } - +void Surface::FlushCachedState() { + // TODO Is there anything we need to do here? eric@sourcegear.com + // TODO I had to add this method when I merged new Scintilla code + // TODO from Neil. +} Window::~Window() { } @@ -365,7 +385,8 @@ PRectangle Window::GetPosition() { } void Window::SetPosition(PRectangle rc) { - id->SetSize(rc.left, rc.top, rc.Width(), rc.Height()); + wxRect r = wxRectFromPRectangle(rc); + id->SetSize(r); } void Window::SetPositionRelative(PRectangle rc, Window) { @@ -386,7 +407,8 @@ void Window::InvalidateAll() { } void Window::InvalidateRectangle(PRectangle rc) { - id->Refresh(false, &wxRectFromPRectangle(rc)); + wxRect r = wxRectFromPRectangle(rc); + id->Refresh(false, &r); } void Window::SetFont(Font &font) { @@ -465,7 +487,12 @@ int ListBox::GetSelection() { } int ListBox::Find(const char *prefix) { - return ((wxListBox*)id)->FindString(prefix); + for (int x=0; x < ((wxListBox*)id)->Number(); x++) { + wxString text = ((wxListBox*)id)->GetString(x); + if (text.StartsWith(prefix)) + return x; + } + return -1; } void ListBox::GetValue(int n, char *value, int len) { diff --git a/contrib/src/stc/ScintillaWX.cpp b/contrib/src/stc/ScintillaWX.cpp index cd0064be5c..56ac221558 100644 --- a/contrib/src/stc/ScintillaWX.cpp +++ b/contrib/src/stc/ScintillaWX.cpp @@ -14,6 +14,8 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +#include <ctype.h> + #include "ScintillaWX.h" #include "wx/stc/stc.h" @@ -60,6 +62,29 @@ void wxSTCDropTarget::OnLeave() { } +class wxSTCCallTip : public wxWindow { +public: + wxSTCCallTip(wxWindow* parent, int ID, CallTip* ct) + : wxWindow(parent, ID) + { + m_ct = ct; + } + + void OnPaint(wxPaintEvent& evt) { + wxPaintDC dc(this); + Surface surfaceWindow; + surfaceWindow.Init(&dc); + m_ct->PaintCT(&surfaceWindow); + surfaceWindow.Release(); + } + + CallTip* m_ct; + DECLARE_EVENT_TABLE() +}; + +BEGIN_EVENT_TABLE(wxSTCCallTip, wxWindow) + EVT_PAINT(wxSTCCallTip::OnPaint) +END_EVENT_TABLE() //---------------------------------------------------------------------- // Constructor/Destructor @@ -193,9 +218,8 @@ void ScintillaWX::NotifyParent(SCNotification scn) { void ScintillaWX::Copy() { if (currentPos != anchor) { char* text = CopySelectionRange(); - textDO.SetText(text); wxTheClipboard->Open(); - wxTheClipboard->SetData(&textDO); + wxTheClipboard->SetData(new wxTextDataObject(text)); wxTheClipboard->Close(); } } @@ -236,7 +260,7 @@ bool ScintillaWX::CanPaste() { } void ScintillaWX::CreateCallTipWindow(PRectangle) { - ct.wCallTip = new wxWindow(wDraw.GetID(), -1); + ct.wCallTip = new wxSTCCallTip(wDraw.GetID(), -1, &ct); ct.wDraw = ct.wCallTip; } @@ -384,7 +408,10 @@ void ScintillaWX::DoButtonMove(Point pt) { void ScintillaWX::DoAddChar(char ch) { + //bool acActiveBeforeCharAdded = ac.Active(); AddChar(ch); + //if (acActiveBeforeCharAdded) + // AutoCompleteChanged(ch); } int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt) { @@ -401,6 +428,9 @@ void ScintillaWX::DoContextMenu(Point pt) { ContextMenu(pt); } +void ScintillaWX::DoOnListBox() { + AutoCompleteCompleted(); +} //---------------------------------------------------------------------- @@ -433,12 +463,13 @@ void ScintillaWX::DoDragLeave() { // Redraw all of text area. This paint will not be abandoned. void ScintillaWX::FullPaint() { paintState = painting; - rcPaint = GetTextRectangle(); - wxClientDC dc(wMain.GetID()); - Surface surfaceWindow; - surfaceWindow.Init(&dc); - Paint(&surfaceWindow, rcPaint); - surfaceWindow.Release(); +// rcPaint = GetTextRectangle(); +// wxClientDC dc(wMain.GetID()); +// Surface surfaceWindow; +// surfaceWindow.Init(&dc); +// Paint(&surfaceWindow, rcPaint); +// surfaceWindow.Release(); + wMain.GetID()->Refresh(FALSE); paintState = notPainting; } diff --git a/contrib/src/stc/ScintillaWX.h b/contrib/src/stc/ScintillaWX.h index 2d273fc99a..c2087c9682 100644 --- a/contrib/src/stc/ScintillaWX.h +++ b/contrib/src/stc/ScintillaWX.h @@ -126,6 +126,7 @@ public: void DoCommand(int ID); void DoContextMenu(Point pt); + void DoOnListBox(); // helpers @@ -139,7 +140,6 @@ private: bool capturedMouse; wxStyledTextCtrl* stc; - wxTextDataObject textDO; wxSTCDropTarget* dropTarget; wxDragResult dragResult; }; diff --git a/contrib/src/stc/StcVC.dsp b/contrib/src/stc/StcVC.dsp index 3b8fc6d9e7..5e77ef19e2 100644 --- a/contrib/src/stc/StcVC.dsp +++ b/contrib/src/stc/StcVC.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="StcVC" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# Microsoft Developer Studio Generated Build File, Format Version 5.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 @@ -22,11 +22,9 @@ CFG=StcVC - Win32 Debug !MESSAGE # Begin Project -# PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe -RSC=rc.exe !IF "$(CFG)" == "StcVC - Win32 Release" @@ -40,11 +38,12 @@ RSC=rc.exe # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" +RSC=rc.exe +# ADD BASE RSC /l 0x809 +# ADD RSC /l 0x809 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../include" /I "scintilla/include" /I "scintilla/src" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D "__WX__" /D "SCI_LEXER" /FD /c # SUBTRACT CPP /YX -# ADD BASE RSC /l 0x809 -# ADD RSC /l 0x809 BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -64,11 +63,12 @@ LIB32=link.exe -lib # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" +RSC=rc.exe +# ADD BASE RSC /l 0x809 +# ADD RSC /l 0x809 # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "../../../include" /I "../../include" /I "scintilla/include" /I "scintilla/src" /D "_DEBUG" /D DEBUG=1 /D "__WXDEBUG__" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D "__WX__" /D "SCI_LEXER" /FD /c # SUBTRACT CPP /YX -# ADD BASE RSC /l 0x809 -# ADD RSC /l 0x809 BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -179,6 +179,34 @@ SOURCE=.\scintilla\src\KeyWords.cxx # End Source File # Begin Source File +SOURCE=.\scintilla\src\LexCPP.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexHTML.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexOthers.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexPerl.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexPython.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexSQL.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexVB.cxx +# End Source File +# Begin Source File + SOURCE=.\scintilla\src\LineMarker.cxx # End Source File # Begin Source File diff --git a/contrib/src/stc/makefile.b32 b/contrib/src/stc/makefile.b32 index 3d52701553..6f5703b7dc 100644 --- a/contrib/src/stc/makefile.b32 +++ b/contrib/src/stc/makefile.b32 @@ -2,7 +2,7 @@ # File: makefile.b32 # Author: Julian Smart # Created: 1999 -# Updated: +# Updated: # Copyright: # # Makefile : Builds wxMMedia library for 32-bit BC++ @@ -21,25 +21,36 @@ STCEXTRACPPFLAGS=-D__WX__ -DSCI_LEXER -I$(SCINTILLA)/include -I$(S) LIBTARGET=$(WXDIR)\contrib\lib\stc.lib OBJECTS = \ - Accessor.obj \ + Accessor.obj \ AutoComplete.obj \ - CallTip.obj \ - CellBuffer.obj \ - ContractionState.obj\ - Document.obj \ + CallTip.obj \ + CellBuffer.obj \ + ContractionState.obj \ + Document.obj \ + DocumentAccessor.obj \ Editor.obj \ - Indicator.obj \ + Indicator.obj \ KeyMap.obj \ - KeyWords.obj \ - LineMarker.obj \ - PropSet.obj \ + KeyWords.obj \ + LexCPP.obj \ + LexHTML.obj \ + LexOthers.obj \ + LexPerl.obj \ + LexPython.obj \ + LexSQL.obj \ + LexVB.obj \ + LineMarker.obj \ + PropSet.obj \ ScintillaBase.obj \ Style.obj \ - ViewStyle.obj \ + UniConversion.obj \ + ViewStyle.obj \ + WindowAccessor.obj \ \ PlatWX.obj \ - ScintillaWX.obj \ - stc.obj \ + ScintillaWX.obj \ + stc.obj \ + !include $(WXDIR)\src\makelib.b32 diff --git a/contrib/src/stc/makefile.g95 b/contrib/src/stc/makefile.g95 index b6d802ecd9..640501e22a 100644 --- a/contrib/src/stc/makefile.g95 +++ b/contrib/src/stc/makefile.g95 @@ -25,6 +25,16 @@ OBJECTS = \ $(S)/ScintillaBase.$(OBJSUFF) \ $(S)/Style.$(OBJSUFF) \ $(S)/ViewStyle.$(OBJSUFF) \ + $(S)/LexCPP.$(OBJSUFF) \ + $(S)/LexHTML.$(OBJSUFF) \ + $(S)/LexOthers.$(OBJSUFF) \ + $(S)/LexPerl.$(OBJSUFF) \ + $(S)/LexPython.$(OBJSUFF) \ + $(S)/LexSQL.$(OBJSUFF) \ + $(S)/LexVB.$(OBJSUFF) \ + $(S)/DocumentAccessor.$(OBJSUFF)\ + $(S)/UniConversion.$(OBJSUFF) \ + $(S)/WindowAccessor.$(OBJSUFF) \ PlatWX.$(OBJSUFF) \ ScintillaWX.$(OBJSUFF) \ stc.$(OBJSUFF) diff --git a/contrib/src/stc/makefile.vc b/contrib/src/stc/makefile.vc index c1adeacff6..f7358c3e73 100644 --- a/contrib/src/stc/makefile.vc +++ b/contrib/src/stc/makefile.vc @@ -15,21 +15,30 @@ NOPCH=1 !include $(WXDIR)\src\makevc.env OBJECTS = \ - $(D)\Accessor.obj \ $(D)\AutoComplete.obj \ $(D)\CallTip.obj \ $(D)\CellBuffer.obj \ $(D)\ContractionState.obj\ $(D)\Document.obj \ + $(D)\DocumentAccessor.obj\ $(D)\Editor.obj \ $(D)\Indicator.obj \ $(D)\KeyMap.obj \ $(D)\KeyWords.obj \ + $(D)\LexCPP.obj \ + $(D)\LexHTML.obj \ + $(D)\LexOthers.obj \ + $(D)\LexPerl.obj \ + $(D)\LexPython.obj \ + $(D)\LexSQL.obj \ + $(D)\LexVB.obj \ $(D)\LineMarker.obj \ $(D)\PropSet.obj \ $(D)\ScintillaBase.obj \ $(D)\Style.obj \ + $(D)\UniConversion.obj \ $(D)\ViewStyle.obj \ + $(D)\WindowAccessor.obj \ \ $(D)\PlatWX.obj \ $(D)\ScintillaWX.obj \ diff --git a/contrib/src/stc/scintilla/README.txt b/contrib/src/stc/scintilla/README.txt index 705fb99652..409b44c3c2 100644 --- a/contrib/src/stc/scintilla/README.txt +++ b/contrib/src/stc/scintilla/README.txt @@ -3,5 +3,6 @@ scintilla/include directories from the Scintilla/SCiTE source distribution. All other code needed to implement Scintilla on top of wxWindows is located in the directory above this one. -The current version of the Scintilla code is somewhere between 1.22 -and 1.23, (from their CVS.) +The current version of the Scintilla code is 1.25+ (from their CVS on +5-19-2000). + diff --git a/contrib/src/stc/scintilla/include/Accessor.h b/contrib/src/stc/scintilla/include/Accessor.h index 1bba4af55e..b4b7e62ecf 100644 --- a/contrib/src/stc/scintilla/include/Accessor.h +++ b/contrib/src/stc/scintilla/include/Accessor.h @@ -3,26 +3,30 @@ // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. +enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8}; + +class Accessor; + +typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len); + +// Interface to data in a Scintilla class Accessor { protected: - // bufferSize is a trade off between time taken to copy the characters and SendMessage overhead + enum {extremePosition=0x7FFFFFFF}; + // bufferSize is a trade off between time taken to copy the characters and retrieval overhead // slopSize positions the buffer before the desired position in case there is some backtracking enum {bufferSize=4000, slopSize=bufferSize/8}; char buf[bufferSize+1]; - WindowID id; - PropSet &props; int startPos; int endPos; - int lenDoc; - int offset; // Optional but including an offset makes GCC generate better code - void Fill(int position); + int codePage; + + virtual bool InternalIsLeadByte(char ch)=0; + virtual void Fill(int position)=0; public: - Accessor(WindowID id_, PropSet &props_, int offset_=0) : - id(id_), props(props_), startPos(0x7FFFFFFF), endPos(0), - lenDoc(-1), offset(offset_) { - } + Accessor() : startPos(extremePosition), endPos(0), codePage(0) {} + virtual ~Accessor() {} char operator[](int position) { - position += offset; if (position < startPos || position >= endPos) { Fill(position); } @@ -30,7 +34,6 @@ public: } char SafeGetCharAt(int position, char chDefault=' ') { // Safe version of operator[], returning a defined value for invalid position - position += offset; if (position < startPos || position >= endPos) { Fill(position); if (position < startPos || position >= endPos) { @@ -40,37 +43,28 @@ public: } return buf[position - startPos]; } - char StyleAt(int position); - int GetLine(int position); - int LineStart(int line); - int LevelAt(int line); - int Length(); - void Flush() { - startPos = 0x7FFFFFFF; - lenDoc = -1; + bool IsLeadByte(char ch) { + return codePage && InternalIsLeadByte(ch); } - int GetLineState(int line); - int SetLineState(int line, int state); - PropSet &GetPropSet() { return props; } -}; + void SetCodePage(int codePage_) { codePage = codePage_; } -class StylingContext : public Accessor { - char styleBuf[bufferSize]; - int validLen; - char chFlags; - char chWhile; - unsigned int startSeg; -public: - StylingContext(WindowID id_, PropSet &props_, int offset_=0) : - Accessor(id_,props_,offset_), validLen(0), chFlags(0) {} - void StartAt(unsigned int start, char chMask=31); - void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; - void ColourSegment(unsigned int start, unsigned int end, int chAttr); - unsigned int GetStartSegment() { return startSeg; } - void StartSegment(unsigned int pos); - void ColourTo(unsigned int pos, int chAttr); - int GetLine(int position); - void SetLevel(int line, int level); - void Flush(); + virtual char StyleAt(int position)=0; + virtual int GetLine(int position)=0; + virtual int LineStart(int line)=0; + virtual int LevelAt(int line)=0; + virtual int Length()=0; + virtual void Flush()=0; + virtual int GetLineState(int line)=0; + virtual int SetLineState(int line, int state)=0; + virtual int GetPropertyInt(const char *key, int defaultValue=0)=0; + + // Style setting + virtual void StartAt(unsigned int start, char chMask=31)=0; + virtual void SetFlags(char chFlags_, char chWhile_)=0; + virtual unsigned int GetStartSegment()=0; + virtual void StartSegment(unsigned int pos)=0; + virtual void ColourTo(unsigned int pos, int chAttr)=0; + virtual void SetLevel(int line, int level)=0; + virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0; }; diff --git a/contrib/src/stc/scintilla/include/KeyWords.h b/contrib/src/stc/scintilla/include/KeyWords.h index 2cc03b788f..3159dcc1b4 100644 --- a/contrib/src/stc/scintilla/include/KeyWords.h +++ b/contrib/src/stc/scintilla/include/KeyWords.h @@ -3,6 +3,39 @@ // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. -void ColouriseDoc(int codePage, int startPos, int lengthDoc, int initStyle, - int language, WordList *keywordlists[], StylingContext &styler); +typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler); + +class LexerModule { + static LexerModule *base; + LexerModule *next; + int language; + LexerFunction fn; +public: + LexerModule(int language_, LexerFunction fn_); + static void Colourise(unsigned int startPos, int lengthDoc, int initStyle, + int language, WordList *keywordlists[], Accessor &styler); +}; + +inline bool iswordchar(char ch) { + return isalnum(ch) || ch == '.' || ch == '_'; +} + +inline bool iswordstart(char ch) { + return isalnum(ch) || ch == '_'; +} + +inline bool isoperator(char ch) { + if (isalnum(ch)) + return false; + // '.' left out as it is used to make up numbers + if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || + ch == '(' || ch == ')' || ch == '-' || ch == '+' || + ch == '=' || ch == '|' || ch == '{' || ch == '}' || + ch == '[' || ch == ']' || ch == ':' || ch == ';' || + ch == '<' || ch == '>' || ch == ',' || ch == '/' || + ch == '?' || ch == '!' || ch == '.' || ch == '~') + return true; + return false; +} diff --git a/contrib/src/stc/scintilla/include/Platform.h b/contrib/src/stc/scintilla/include/Platform.h index 3a5e9816dc..5a87c64feb 100644 --- a/contrib/src/stc/scintilla/include/Platform.h +++ b/contrib/src/stc/scintilla/include/Platform.h @@ -45,6 +45,7 @@ #pragma warning(disable: 4800 4244 4309) #endif #include <windows.h> +#include <commctrl.h> #include <richedit.h> #endif @@ -209,16 +210,19 @@ public: Font(); ~Font(); - void Create(const char *faceName, int size, bool bold=false, bool italic=false); + void Create(const char *faceName, int characterSet, int size, bool bold, bool italic); void Release(); FontID GetID() { return id; } + // Alias another font - caller guarantees not to Release + void SetID(FontID id_) { id = id_; } friend class Surface; }; // A surface abstracts a place to draw class Surface { private: + bool unicodeMode; #if PLAT_GTK GdkDrawable *drawable; GdkGC *gc; @@ -266,6 +270,7 @@ public: bool Initialised(); void PenColour(Colour fore); int LogPixelsY(); + int DeviceHeightFont(int points); void MoveTo(int x_, int y_); void LineTo(int x_, int y_); void Polygon(Point *pts, int npts, Colour fore, Colour back); @@ -290,6 +295,11 @@ public: int SetPalette(Palette *pal, bool inBackGround); void SetClip(PRectangle rc); + void FlushCachedState(); + + void SetUnicodeMode(bool unicodeMode_) { + unicodeMode=unicodeMode_; + } }; // Class to hide the details of window manipulation @@ -300,6 +310,7 @@ protected: WindowID id; public: Window() : id(0) {} + Window(const Window &source) : id(source.id) {} virtual ~Window(); Window &operator=(WindowID id_) { id = id_; diff --git a/contrib/src/stc/scintilla/include/PropSet.h b/contrib/src/stc/scintilla/include/PropSet.h index 31da01f954..bc1599f38a 100644 --- a/contrib/src/stc/scintilla/include/PropSet.h +++ b/contrib/src/stc/scintilla/include/PropSet.h @@ -75,7 +75,7 @@ public: else return 0; } - char operator[](int i) { + char operator[](int i) const { if (s) return s[i]; else @@ -95,7 +95,7 @@ public: } return *this; } - int value() { + int value() const { if (s) return atoi(s); else @@ -168,7 +168,7 @@ public: WordList(bool onlyLineEnds_ = false) : words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {} ~WordList() { Clear(); } - operator bool() { return list; } + operator bool() { return list ? true : false; } const char *operator[](int ind) { return words[ind]; } void Clear(); void Set(const char *s); diff --git a/contrib/src/stc/scintilla/include/SciLexer.h b/contrib/src/stc/scintilla/include/SciLexer.h index d6667e4e25..d869758f61 100644 --- a/contrib/src/stc/scintilla/include/SciLexer.h +++ b/contrib/src/stc/scintilla/include/SciLexer.h @@ -21,6 +21,8 @@ #define SCLEX_ERRORLIST 10 #define SCLEX_MAKEFILE 11 #define SCLEX_BATCH 12 +#define SCLEX_XCODE 13 +#define SCLEX_LATEX 14 // Lexical states for SCLEX_PYTHON #define SCE_P_DEFAULT 0 @@ -35,6 +37,8 @@ #define SCE_P_DEFNAME 9 #define SCE_P_OPERATOR 10 #define SCE_P_IDENTIFIER 11 +#define SCE_P_COMMENTBLOCK 12 +#define SCE_P_STRINGEOL 13 // Lexical states for SCLEX_CPP, SCLEX_VB #define SCE_C_DEFAULT 0 @@ -45,7 +49,7 @@ #define SCE_C_WORD 5 #define SCE_C_STRING 6 #define SCE_C_CHARACTER 7 -#define SCE_C_PUNTUATION 8 +#define SCE_C_UUID 8 #define SCE_C_PREPROCESSOR 9 #define SCE_C_OPERATOR 10 #define SCE_C_IDENTIFIER 11 @@ -63,49 +67,85 @@ #define SCE_H_OTHER 8 #define SCE_H_COMMENT 9 #define SCE_H_ENTITY 10 -// Embedded Javascript -#define SCE_HJ_START 11 -#define SCE_HJ_DEFAULT 12 -#define SCE_HJ_COMMENT 13 -#define SCE_HJ_COMMENTLINE 14 -#define SCE_HJ_COMMENTDOC 15 -#define SCE_HJ_NUMBER 16 -#define SCE_HJ_WORD 17 -#define SCE_HJ_KEYWORD 18 -#define SCE_HJ_DOUBLESTRING 19 -#define SCE_HJ_SINGLESTRING 20 -#define SCE_HJ_SYMBOLS 21 -#define SCE_HJ_STRINGEOL 28 // XML and ASP -#define SCE_H_TAGEND 22 -#define SCE_H_XMLSTART 23 -#define SCE_H_XMLEND 24 -#define SCE_H_SCRIPT 25 -#define SCE_H_ASP 26 -#define SCE_H_ASPAT 27 +#define SCE_H_TAGEND 11 +#define SCE_H_XMLSTART 12 +#define SCE_H_XMLEND 13 +#define SCE_H_SCRIPT 14 +#define SCE_H_ASP 15 +#define SCE_H_ASPAT 16 +// Embedded Javascript +#define SCE_HJ_START 40 +#define SCE_HJ_DEFAULT 41 +#define SCE_HJ_COMMENT 42 +#define SCE_HJ_COMMENTLINE 43 +#define SCE_HJ_COMMENTDOC 44 +#define SCE_HJ_NUMBER 45 +#define SCE_HJ_WORD 46 +#define SCE_HJ_KEYWORD 47 +#define SCE_HJ_DOUBLESTRING 48 +#define SCE_HJ_SINGLESTRING 49 +#define SCE_HJ_SYMBOLS 50 +#define SCE_HJ_STRINGEOL 51 +// ASP Javascript +#define SCE_HJA_START 55 +#define SCE_HJA_DEFAULT 56 +#define SCE_HJA_COMMENT 57 +#define SCE_HJA_COMMENTLINE 58 +#define SCE_HJA_COMMENTDOC 59 +#define SCE_HJA_NUMBER 60 +#define SCE_HJA_WORD 61 +#define SCE_HJA_KEYWORD 62 +#define SCE_HJA_DOUBLESTRING 63 +#define SCE_HJA_SINGLESTRING 64 +#define SCE_HJA_SYMBOLS 65 +#define SCE_HJA_STRINGEOL 66 // Embedded VBScript -#define SCE_HB_START 40 -#define SCE_HB_DEFAULT 41 -#define SCE_HB_COMMENTLINE 42 -#define SCE_HB_NUMBER 43 -#define SCE_HB_WORD 44 -#define SCE_HB_STRING 45 -#define SCE_HB_IDENTIFIER 46 -#define SCE_HB_STRINGEOL 47 +#define SCE_HB_START 70 +#define SCE_HB_DEFAULT 71 +#define SCE_HB_COMMENTLINE 72 +#define SCE_HB_NUMBER 73 +#define SCE_HB_WORD 74 +#define SCE_HB_STRING 75 +#define SCE_HB_IDENTIFIER 76 +#define SCE_HB_STRINGEOL 77 +// ASP VBScript +#define SCE_HBA_START 80 +#define SCE_HBA_DEFAULT 81 +#define SCE_HBA_COMMENTLINE 82 +#define SCE_HBA_NUMBER 83 +#define SCE_HBA_WORD 84 +#define SCE_HBA_STRING 85 +#define SCE_HBA_IDENTIFIER 86 +#define SCE_HBA_STRINGEOL 87 // Embedded Python -#define SCE_HP_START 50 -#define SCE_HP_DEFAULT 51 -#define SCE_HP_COMMENTLINE 52 -#define SCE_HP_NUMBER 53 -#define SCE_HP_STRING 54 -#define SCE_HP_CHARACTER 55 -#define SCE_HP_WORD 56 -#define SCE_HP_TRIPLE 57 -#define SCE_HP_TRIPLEDOUBLE 58 -#define SCE_HP_CLASSNAME 59 -#define SCE_HP_DEFNAME 60 -#define SCE_HP_OPERATOR 61 -#define SCE_HP_IDENTIFIER 62 +#define SCE_HP_START 90 +#define SCE_HP_DEFAULT 91 +#define SCE_HP_COMMENTLINE 92 +#define SCE_HP_NUMBER 93 +#define SCE_HP_STRING 94 +#define SCE_HP_CHARACTER 95 +#define SCE_HP_WORD 96 +#define SCE_HP_TRIPLE 97 +#define SCE_HP_TRIPLEDOUBLE 98 +#define SCE_HP_CLASSNAME 99 +#define SCE_HP_DEFNAME 100 +#define SCE_HP_OPERATOR 101 +#define SCE_HP_IDENTIFIER 102 +// ASP Python +#define SCE_HPA_START 105 +#define SCE_HPA_DEFAULT 106 +#define SCE_HPA_COMMENTLINE 107 +#define SCE_HPA_NUMBER 108 +#define SCE_HPA_STRING 109 +#define SCE_HPA_CHARACTER 110 +#define SCE_HPA_WORD 111 +#define SCE_HPA_TRIPLE 112 +#define SCE_HPA_TRIPLEDOUBLE 113 +#define SCE_HPA_CLASSNAME 114 +#define SCE_HPA_DEFNAME 115 +#define SCE_HPA_OPERATOR 116 +#define SCE_HPA_IDENTIFIER 117 // Lexical states for SCLEX_PERL #define SCE_PL_DEFAULT 0 @@ -131,4 +171,11 @@ #define SCE_PL_BACKTICKS 20 #define SCE_PL_DATASECTION 21 +// Lexical states for SCLEX_LATEX +#define SCE_L_DEFAULT 0 +#define SCE_L_COMMAND 1 +#define SCE_L_TAG 2 +#define SCE_L_MATH 3 +#define SCE_L_COMMENT 4 + #endif diff --git a/contrib/src/stc/scintilla/include/Scintilla.h b/contrib/src/stc/scintilla/include/Scintilla.h index 07572168dc..8e52ba59e2 100644 --- a/contrib/src/stc/scintilla/include/Scintilla.h +++ b/contrib/src/stc/scintilla/include/Scintilla.h @@ -89,7 +89,6 @@ extern "C" { #define SCI_GETVIEWWS SCI_START + 20 #define SCI_SETVIEWWS SCI_START + 21 -#define SCI_CHANGEPOSITION SCI_START + 22 #define SCI_GOTOLINE SCI_START + 24 #define SCI_GOTOPOS SCI_START + 25 #define SCI_SETANCHOR SCI_START + 26 @@ -107,6 +106,9 @@ extern "C" { #define SCI_STARTSTYLING SCI_START + 32 #define SCI_SETSTYLING SCI_START + 33 +// This is the same value as CP_UTF8 in Windows +#define SC_CP_UTF8 65001 + #define SCI_SETBUFFEREDDRAW SCI_START + 35 #define SCI_SETTABWIDTH SCI_START + 36 #define SCI_SETCODEPAGE SCI_START + 37 @@ -156,7 +158,11 @@ extern "C" { #define STYLE_BRACELIGHT 34 #define STYLE_BRACEBAD 35 #define STYLE_CONTROLCHAR 36 -#define STYLE_MAX 63 +#define STYLE_MAX 127 + +#define SC_CHARSET_ANSI 0 +#define SC_CHARSET_DEFAULT 1 +#define SC_CHARSET_RUSSIAN 204 #define SCI_STYLECLEARALL SCI_START + 50 #define SCI_STYLESETFORE SCI_START + 51 @@ -167,6 +173,8 @@ extern "C" { #define SCI_STYLESETFONT SCI_START + 56 #define SCI_STYLESETEOLFILLED SCI_START + 57 #define SCI_STYLERESETDEFAULT SCI_START + 58 +#define SCI_STYLESETUNDERLINE SCI_START + 59 +#define SCI_STYLESETCHARACTERSET SCI_START + 66 #define SCI_SETSELFORE SCI_START + 67 #define SCI_SETSELBACK SCI_START + 68 @@ -190,6 +198,8 @@ extern "C" { #define INDIC_PLAIN 0 #define INDIC_SQUIGGLE 1 #define INDIC_TT 2 +#define INDIC_DIAGONAL 3 +#define INDIC_STRIKE 4 #define INDIC0_MASK 32 #define INDIC1_MASK 64 @@ -213,6 +223,21 @@ extern "C" { #define SCI_AUTOCPOSSTART SCI_START + 103 #define SCI_AUTOCCOMPLETE SCI_START + 104 #define SCI_AUTOCSTOPS SCI_START + 105 +#define SCI_AUTOCSETSEPARATOR SCI_START + 106 +#define SCI_AUTOCGETSEPARATOR SCI_START + 107 +#define SCI_AUTOCSELECT SCI_START + 108 + +#define SCI_GETTABWIDTH SCI_START + 121 +#define SCI_SETINDENT SCI_START + 122 +#define SCI_GETINDENT SCI_START + 123 +#define SCI_SETUSETABS SCI_START + 124 +#define SCI_GETUSETABS SCI_START + 125 +#define SCI_SETLINEINDENTATION SCI_START + 126 +#define SCI_GETLINEINDENTATION SCI_START + 127 +#define SCI_GETLINEINDENTPOSITION SCI_START + 128 + +#define SCI_SETHSCROLLBAR SCI_START + 130 +#define SCI_GETHSCROLLBAR SCI_START + 131 #define SCI_CALLTIPSHOW SCI_START + 200 #define SCI_CALLTIPCANCEL SCI_START + 201 @@ -279,6 +304,13 @@ extern "C" { #define SCI_ZOOMOUT SCI_START + 334 #define SCI_DELWORDLEFT SCI_START + 335 #define SCI_DELWORDRIGHT SCI_START + 336 +#define SCI_LINECUT SCI_START + 337 +#define SCI_LINEDELETE SCI_START + 338 +#define SCI_LINETRANSPOSE SCI_START + 339 +#define SCI_LOWERCASE SCI_START + 340 +#define SCI_UPPERCASE SCI_START + 341 +#define SCI_LINESCROLLDOWN SCI_START + 342 +#define SCI_LINESCROLLUP SCI_START + 343 #define SCI_LINELENGTH SCI_START + 350 #define SCI_BRACEHIGHLIGHT SCI_START + 351 @@ -311,6 +343,14 @@ extern "C" { // OR this with CARET_SLOP to reposition whenever outside slop border #define SCI_SETCARETPOLICY SCI_START + 369 +#define SCI_LINESONSCREEN SCI_START + 370 +#define SCI_USEPOPUP SCI_START + 371 +#define SCI_SELECTIONISRECTANGLE SCI_START + 372 +#define SCI_SETZOOM SCI_START + 373 +#define SCI_GETZOOM SCI_START + 374 + +#define SCI_ADDREFDOC SCI_START + 375 +#define SCI_RELEASEDOC SCI_START + 376 // GTK+ Specific #define SCI_GRABFOCUS SCI_START + 400 @@ -342,8 +382,11 @@ typedef void (tMacroRecorder)(UINT iMessage, WPARAM wParam, LPARAM lParam, #define SC_PERFORMED_UNDO 0x20 #define SC_PERFORMED_REDO 0x40 #define SC_LASTSTEPINUNDOREDO 0x100 +#define SC_MOD_CHANGEMARKER 0x200 +#define SC_MOD_BEFOREINSERT 0x400 +#define SC_MOD_BEFOREDELETE 0x800 -#define SC_MODEVENTMASKALL 0x377 +#define SC_MODEVENTMASKALL 0xF77 struct SCNotification { NMHDR nmhdr; @@ -394,6 +437,8 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance); #ifdef INCLUDE_DEPRECATED_FEATURES +#define SCI_CHANGEPOSITION SCI_START + 22 + // Default style settings. These are deprecated and will be removed in a future version. #define SCI_SETFORE SCI_START + 60 #define SCI_SETBACK SCI_START + 61 diff --git a/contrib/src/stc/scintilla/include/WinDefs.h b/contrib/src/stc/scintilla/include/WinDefs.h index 0b125e7313..d1c25a595a 100644 --- a/contrib/src/stc/scintilla/include/WinDefs.h +++ b/contrib/src/stc/scintilla/include/WinDefs.h @@ -20,79 +20,34 @@ #define EM_CANPASTE (1074) #define EM_CANUNDO (198) #define EM_CHARFROMPOS (215) -#define EM_DISPLAYBAND (1075) #define EM_EMPTYUNDOBUFFER (205) #define EM_EXGETSEL (1076) -#define EM_EXLIMITTEXT (1077) #define EM_EXLINEFROMCHAR (1078) #define EM_EXSETSEL (1079) #define EM_FINDTEXT (1080) #define EM_FINDTEXTEX (1103) -#define EM_FINDWORDBREAK (1100) -#define EM_FMTLINES (200) #define EM_FORMATRANGE (1081) -#define EM_GETCHARFORMAT (1082) -#define EM_GETEVENTMASK (1083) #define EM_GETFIRSTVISIBLELINE (206) -#define EM_GETHANDLE (189) -#define EM_GETLIMITTEXT (213) #define EM_GETLINE (196) #define EM_GETLINECOUNT (186) #define EM_GETMARGINS (212) #define EM_GETMODIFY (184) -#define EM_GETIMECOLOR (1129) -#define EM_GETIMEOPTIONS (1131) -#define EM_GETOPTIONS (1102) -#define EM_GETOLEINTERFACE (1084) -#define EM_GETPARAFORMAT (1085) -#define EM_GETPASSWORDCHAR (210) -#define EM_GETPUNCTUATION (1125) #define EM_GETRECT (178) #define EM_GETSEL (176) #define EM_GETSELTEXT (1086) #define EM_GETTEXTRANGE (1099) -#define EM_GETTHUMB (190) -#define EM_GETWORDBREAKPROC (209) -#define EM_GETWORDBREAKPROCEX (1104) -#define EM_GETWORDWRAPMODE (1127) #define EM_HIDESELECTION (1087) -#define EM_LIMITTEXT (197) #define EM_LINEFROMCHAR (201) #define EM_LINEINDEX (187) #define EM_LINELENGTH (193) #define EM_LINESCROLL (182) -#define EM_PASTESPECIAL (1088) #define EM_POSFROMCHAR (214) #define EM_REPLACESEL (194) -#define EM_REQUESTRESIZE (1089) -#define EM_SCROLL (181) #define EM_SCROLLCARET (183) #define EM_SELECTIONTYPE (1090) -#define EM_SETBKGNDCOLOR (1091) -#define EM_SETCHARFORMAT (1092) -#define EM_SETEVENTMASK (1093) -#define EM_SETHANDLE (188) -#define EM_SETIMECOLOR (1128) -#define EM_SETIMEOPTIONS (1130) -#define EM_SETLIMITTEXT (197) #define EM_SETMARGINS (211) -#define EM_SETMODIFY (185) -#define EM_SETOLECALLBACK (1094) -#define EM_SETOPTIONS (1101) -#define EM_SETPARAFORMAT (1095) -#define EM_SETPASSWORDCHAR (204) -#define EM_SETPUNCTUATION (1124) #define EM_SETREADONLY (207) -#define EM_SETRECT (179) -#define EM_SETRECTNP (180) #define EM_SETSEL (177) -#define EM_SETTABSTOPS (203) -#define EM_SETTARGETDEVICE (1096) -#define EM_SETWORDBREAKPROC (208) -#define EM_SETWORDBREAKPROCEX (1105) -#define EM_SETWORDWRAPMODE (1126) -#define EM_STREAMIN (1097) -#define EM_STREAMOUT (1098) #define EM_UNDO (199) #define WM_NULL (0) @@ -132,6 +87,7 @@ #define VK_RETURN GDK_Return #define VK_ADD GDK_KP_Add #define VK_SUBTRACT GDK_KP_Subtract +#define VK_DIVIDE GDK_KP_Divide #endif #if PLAT_WX @@ -151,6 +107,8 @@ #define VK_RETURN WXK_RETURN #define VK_ADD WXK_ADD #define VK_SUBTRACT WXK_SUBTRACT +//TODO: +#define VK_DIVIDE WXK_DIVIDE // Are these needed any more #define LPSTR char * diff --git a/contrib/src/stc/scintilla/include/WindowAccessor.h b/contrib/src/stc/scintilla/include/WindowAccessor.h new file mode 100644 index 0000000000..89a542e82d --- /dev/null +++ b/contrib/src/stc/scintilla/include/WindowAccessor.h @@ -0,0 +1,47 @@ +// WindowAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +class WindowAccessor : public Accessor { + // Private so WindowAccessor objects can not be copied + WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {} + WindowAccessor &operator=(const WindowAccessor &) { return *this; } +protected: + WindowID id; + PropSet &props; + int lenDoc; + + char styleBuf[bufferSize]; + int validLen; + char chFlags; + char chWhile; + unsigned int startSeg; + + bool InternalIsLeadByte(char ch); + void Fill(int position); +public: + WindowAccessor(WindowID id_, PropSet &props_) : + Accessor(), id(id_), props(props_), + lenDoc(-1), validLen(0), chFlags(0) { + } + ~WindowAccessor(); + char StyleAt(int position); + int GetLine(int position); + int LineStart(int line); + int LevelAt(int line); + int Length(); + void Flush(); + int GetLineState(int line); + int SetLineState(int line, int state); + int GetPropertyInt(const char *key, int defaultValue=0) { + return props.GetInt(key, defaultValue); + } + + void StartAt(unsigned int start, char chMask=31); + void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; + unsigned int GetStartSegment() { return startSeg; } + void StartSegment(unsigned int pos); + void ColourTo(unsigned int pos, int chAttr); + void SetLevel(int line, int level); + int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); +}; diff --git a/contrib/src/stc/scintilla/src/AutoComplete.cxx b/contrib/src/stc/scintilla/src/AutoComplete.cxx index c3ec29c3c9..75e26fe283 100644 --- a/contrib/src/stc/scintilla/src/AutoComplete.cxx +++ b/contrib/src/stc/scintilla/src/AutoComplete.cxx @@ -15,6 +15,7 @@ AutoComplete::AutoComplete() { active = false; posStart = 0; strcpy(stopChars, ""); + separator = ' '; } AutoComplete::~AutoComplete() { @@ -44,6 +45,14 @@ bool AutoComplete::IsStopChar(char ch) { return ch && strchr(stopChars, ch); } +void AutoComplete::SetSeparator(char separator_) { + separator = separator_; +} + +char AutoComplete::GetSeparator() { + return separator; +} + int AutoComplete::SetList(const char *list) { int maxStrLen = 12; lb.Clear(); @@ -53,7 +62,7 @@ int AutoComplete::SetList(const char *list) { char *startword = words; int i = 0; for (; words && words[i]; i++) { - if (words[i] == ' ') { + if (words[i] == separator) { words[i] = '\0'; lb.Append(startword); maxStrLen = Platform::Maximum(maxStrLen, strlen(startword)); diff --git a/contrib/src/stc/scintilla/src/AutoComplete.h b/contrib/src/stc/scintilla/src/AutoComplete.h index 10216027bd..e4f8ade0d8 100644 --- a/contrib/src/stc/scintilla/src/AutoComplete.h +++ b/contrib/src/stc/scintilla/src/AutoComplete.h @@ -9,6 +9,7 @@ class AutoComplete { bool active; char stopChars[256]; + char separator; public: ListBox lb; int posStart; @@ -27,7 +28,11 @@ public: void SetStopChars(const char *stopChars_); bool IsStopChar(char ch); - // The list string contains a sequence of words separated by spaces + // The separator character is used when interpreting the list in SetList + void SetSeparator(char separator_); + char GetSeparator(); + + // The list string contains a sequence of words separated by the separator character int SetList(const char *list); void Show(); diff --git a/contrib/src/stc/scintilla/src/CallTip.cxx b/contrib/src/stc/scintilla/src/CallTip.cxx index ad6740208b..d22a963645 100644 --- a/contrib/src/stc/scintilla/src/CallTip.cxx +++ b/contrib/src/stc/scintilla/src/CallTip.cxx @@ -8,6 +8,7 @@ #include "Platform.h" +#include "Scintilla.h" #include "CallTip.h" CallTip::CallTip() { @@ -117,7 +118,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, Surface surfaceMeasure; surfaceMeasure.Init(); int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72; - font.Create(faceName, deviceHeight); + font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false); if (val) delete []val; val = new char[strlen(defn) + 1]; diff --git a/contrib/src/stc/scintilla/src/CallTip.h b/contrib/src/stc/scintilla/src/CallTip.h index cd5b093c84..cb5bc29032 100644 --- a/contrib/src/stc/scintilla/src/CallTip.h +++ b/contrib/src/stc/scintilla/src/CallTip.h @@ -6,13 +6,14 @@ #ifndef CALLTIP_H #define CALLTIP_H -const char callClassName[] = "CallTip"; - class CallTip { int startHighlight; int endHighlight; char *val; Font font; + // Private so CallTip objects can not be copied + CallTip(const CallTip &) {} + CallTip &operator=(const CallTip &) { return *this; } public: Window wCallTip; Window wDraw; diff --git a/contrib/src/stc/scintilla/src/CellBuffer.cxx b/contrib/src/stc/scintilla/src/CellBuffer.cxx index 777688511a..e6aa4a0134 100644 --- a/contrib/src/stc/scintilla/src/CellBuffer.cxx +++ b/contrib/src/stc/scintilla/src/CellBuffer.cxx @@ -191,11 +191,23 @@ void LineVector::InsertValue(int pos, int value) { } } lines++; - for (int i = lines + 1; i > pos; i--) { + for (int i = lines; i > pos; i--) { linesData[i] = linesData[i - 1]; } linesData[pos].startPosition = value; linesData[pos].handleSet = 0; + if (levels) { + for (int j = lines; j > pos; j--) { + levels[j] = levels[j - 1]; + } + if (pos == 0) { + levels[pos] = SC_FOLDLEVELBASE; + } else if (pos == (lines-1)) { // Last line will not be a folder + levels[pos] = SC_FOLDLEVELBASE; + } else { + levels[pos] = levels[pos-1]; + } + } } void LineVector::SetValue(int pos, int value) { @@ -221,6 +233,15 @@ void LineVector::Remove(int pos) { for (int i = pos; i < lines; i++) { linesData[i] = linesData[i + 1]; } + if (levels) { + // Level information merges back onto previous line + int posAbove = pos-1; + if (posAbove < 0) + posAbove = 0; + for (int j = posAbove; j < lines; j++) { + levels[j] = levels[j + 1]; + } + } lines--; } @@ -233,9 +254,8 @@ int LineVector::LineFromPosition(int pos) { return lines - 1; int lower = 0; int upper = lines; - int middle = 0; do { - middle = (upper + lower + 1) / 2; // Round high + int middle = (upper + lower + 1) / 2; // Round high if (pos < linesData[middle].startPosition) { upper = middle - 1; } else { @@ -316,12 +336,13 @@ Action::~Action() { Destroy(); } -void Action::Create(actionType at_, int position_, char *data_, int lenData_) { +void Action::Create(actionType at_, int position_, char *data_, int lenData_, bool mayCoalesce_) { delete []data; position = position_; at = at_; data = data_; lenData = lenData_; + mayCoalesce = mayCoalesce_; } void Action::Destroy() { @@ -336,39 +357,222 @@ void Action::Grab(Action *source) { at = source->at; data = source->data; lenData = source->lenData; - + mayCoalesce = source->mayCoalesce; + // Ownership of source data transferred to this source->position = 0; source->at = startAction; source->data = 0; source->lenData = 0; + source->mayCoalesce = true; +} + +// The undo history stores a sequence of user operations that represent the user's view of the +// commands executed on the text. +// Each user operation contains a sequence of text insertion and text deletion actions. +// All the user operations are stored in a list of individual actions with 'start' actions used +// as delimiters between user operations. +// Initially there is one start action in the history. +// As each action is performed, it is recorded in the history. The action may either become +// part of the current user operation or may start a new user operation. If it is to be part of the +// current operation, then it overwrites the current last action. If it is to be part of a new +// operation, it is appended after the current last action. +// After writing the new action, a new start action is appended at the end of the history. +// The decision of whether to start a new user operation is based upon two factors. If a +// compound operation has been explicitly started by calling BeginUndoAction and no matching +// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current +// operation. If there is no outstanding BeginUndoAction call then a new operation is started +// unless it looks as if the new action is caused by the user typing or deleting a stream of text. +// Sequences that look like typing or deletion are coalesced into a single user operation. + +UndoHistory::UndoHistory() { + + lenActions = 100; + actions = new Action[lenActions]; + maxAction = 0; + currentAction = 0; + undoSequenceDepth = 0; + savePoint = 0; + + actions[currentAction].Create(startAction); +} + +UndoHistory::~UndoHistory() { + delete []actions; + actions = 0; +} + +void UndoHistory::EnsureUndoRoom() { + //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, length, currentAction); + if (currentAction >= 2) { + // Have to test that there is room for 2 more actions in the array + // as two actions may be created by this function + if (currentAction >= (lenActions - 2)) { + // Run out of undo nodes so extend the array + int lenActionsNew = lenActions * 2; + Action *actionsNew = new Action[lenActionsNew]; + if (!actionsNew) + return; + for (int act = 0; act <= currentAction; act++) + actionsNew[act].Grab(&actions[act]); + delete []actions; + lenActions = lenActionsNew; + actions = actionsNew; + } + } +} + +void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData) { + EnsureUndoRoom(); + //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); + //Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at, + // actions[currentAction - 1].position, actions[currentAction - 1].lenData); + if (currentAction >= 1) { + if (0 == undoSequenceDepth) { + // Top level actions may not always be coalesced + Action &actPrevious = actions[currentAction - 1]; + // See if current action can be coalesced into previous action + // Will work if both are inserts or deletes and position is same + if (at != actPrevious.at) { + currentAction++; + } else if (currentAction == savePoint) { + currentAction++; + } else if ((at == removeAction) && + ((position + lengthData * 2) != actPrevious.position)) { + // Removals must be at same position to coalesce + currentAction++; + } else if ((at == insertAction) && + (position != (actPrevious.position + actPrevious.lenData*2))) { + // Insertions must be immediately after to coalesce + currentAction++; + } else { + //Platform::DebugPrintf("action coalesced\n"); + } + } else { + // Actions not at top level are always coalesced unless this is after return to top level + if (!actions[currentAction].mayCoalesce) + currentAction++; + } + } else { + currentAction++; + } + actions[currentAction].Create(at, position, data, lengthData); + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; +} + +void UndoHistory::BeginUndoAction() { + EnsureUndoRoom(); + if (undoSequenceDepth == 0) { + if (actions[currentAction].at != startAction) { + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; + } + actions[currentAction].mayCoalesce = false; + } + undoSequenceDepth++; +} + +void UndoHistory::EndUndoAction() { + EnsureUndoRoom(); + undoSequenceDepth--; + if (0 == undoSequenceDepth) { + if (actions[currentAction].at != startAction) { + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; + } + actions[currentAction].mayCoalesce = false; + } +} + +void UndoHistory::DropUndoSequence() { + undoSequenceDepth = 0; +} + +void UndoHistory::DeleteUndoHistory() { + for (int i = 1; i < maxAction; i++) + actions[i].Destroy(); + maxAction = 0; + currentAction = 0; + actions[currentAction].Create(startAction); + savePoint = 0; +} + +void UndoHistory::SetSavePoint() { + savePoint = currentAction; +} + +bool UndoHistory::IsSavePoint() const { + return savePoint == currentAction; +} + +bool UndoHistory::CanUndo() const { + return (currentAction > 0) && (maxAction > 0); +} + +int UndoHistory::StartUndo() { + // Drop any trailing startAction + if (actions[currentAction].at == startAction && currentAction > 0) + currentAction--; + + // Count the steps in this action + int act = currentAction; + while (actions[act].at != startAction && act > 0) { + act--; + } + return currentAction - act; +} + +const Action &UndoHistory::GetUndoStep() const { + return actions[currentAction]; +} + +void UndoHistory::CompletedUndoStep() { + currentAction--; +} + +bool UndoHistory::CanRedo() const { + return maxAction > currentAction; +} + +int UndoHistory::StartRedo() { + // Drop any leading startAction + if (actions[currentAction].at == startAction && currentAction < maxAction) + currentAction++; + + // Count the steps in this action + int act = currentAction; + while (actions[act].at != startAction && act < maxAction) { + act++; + } + return act - currentAction; +} + +const Action &UndoHistory::GetRedoStep() const { + return actions[currentAction]; +} + +void UndoHistory::CompletedRedoStep() { + currentAction++; } CellBuffer::CellBuffer(int initialLength) { body = new char[initialLength]; size = initialLength; length = 0; - part1len = 0; + part1len = 0; gaplen = initialLength; part2body = body + gaplen; readOnly = false; - - lenActions = 100; - actions = new Action[lenActions]; - maxAction = 0; - currentAction = 0; collectingUndo = undoCollectAutoStart; - undoSequenceDepth = 0; - savePoint = 0; - - actions[currentAction].Create(startAction); } CellBuffer::~CellBuffer() { delete []body; body = 0; - delete []actions; - actions = 0; } void CellBuffer::GapTo(int position) { @@ -486,7 +690,7 @@ const char *CellBuffer::InsertString(int position, char *s, int insertLength) { for (int i = 0; i < insertLength / 2; i++) { data[i] = s[i * 2]; } - AppendAction(insertAction, position, data, insertLength / 2); + uh.AppendAction(insertAction, position, data, insertLength / 2); } BasicInsertString(position, s, insertLength); @@ -504,7 +708,7 @@ void CellBuffer::InsertCharStyle(int position, char ch, char style) { bool CellBuffer::SetStyleAt(int position, char style, char mask) { char curVal = ByteAt(position*2 + 1); if ((curVal & mask) != style) { - SetByteAt(position*2 + 1, (curVal & ~mask) | style); + SetByteAt(position*2 + 1, static_cast<char>((curVal & ~mask) | style)); return true; } else { return false; @@ -517,7 +721,7 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mas while (lengthStyle--) { char curVal = ByteAt(bytePos); if ((curVal & mask) != style) { - SetByteAt(bytePos, (curVal & ~mask) | style); + SetByteAt(bytePos, static_cast<char>((curVal & ~mask) | style)); changed = true; } bytePos += 2; @@ -525,48 +729,6 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mas return changed; } -void CellBuffer::EnsureUndoRoom() { - //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, length, currentAction); - if (currentAction >= 2) { - // Have to test that there is room for 2 more actions in the array - // as two actions may be created by this function - if (currentAction >= (lenActions - 2)) { - // Run out of undo nodes so extend the array - int lenActionsNew = lenActions * 2; - Action *actionsNew = new Action[lenActionsNew]; - if (!actionsNew) - return; - for (int act = 0; act <= currentAction; act++) - actionsNew[act].Grab(&actions[act]); - delete []actions; - lenActions = lenActionsNew; - actions = actionsNew; - } - } -} - -void CellBuffer::AppendAction(actionType at, int position, char *data, int lengthData) { - EnsureUndoRoom(); - //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); - if (currentAction >= 2) { - // See if current action can be coalesced into previous action - // Will work if both are inserts or deletes and position is same or two different - if ((at != actions[currentAction - 1].at) || (abs(position - actions[currentAction - 1].position) > 2)) { - currentAction++; - } else if (currentAction == savePoint) { - currentAction++; - } - } else { - currentAction++; - } - actions[currentAction].Create(at, position, data, lengthData); - if ((collectingUndo == undoCollectAutoStart) && (0 == undoSequenceDepth)) { - currentAction++; - actions[currentAction].Create(startAction); - } - maxAction = currentAction; -} - const char *CellBuffer::DeleteChars(int position, int deleteLength) { // InsertString and DeleteChars are the bottleneck though which all changes occur char *data = 0; @@ -577,7 +739,7 @@ const char *CellBuffer::DeleteChars(int position, int deleteLength) { for (int i = 0; i < deleteLength / 2; i++) { data[i] = ByteAt(position + i * 2); } - AppendAction(removeAction, position, data, deleteLength / 2); + uh.AppendAction(removeAction, position, data, deleteLength / 2); } BasicDeleteChars(position, deleteLength); @@ -616,11 +778,11 @@ void CellBuffer::SetReadOnly(bool set) { } void CellBuffer::SetSavePoint() { - savePoint = currentAction; + uh.SetSavePoint(); } bool CellBuffer::IsSavePoint() { - return savePoint == currentAction; + return uh.IsSavePoint(); } int CellBuffer::AddMark(int line, int markerNum) { @@ -792,7 +954,7 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) { undoCollectionType CellBuffer::SetUndoCollection(undoCollectionType collectUndo) { collectingUndo = collectUndo; - undoSequenceDepth = 0; + uh.DropUndoSequence(); return collectingUndo; } @@ -800,69 +962,32 @@ bool CellBuffer::IsCollectingUndo() { return collectingUndo; } -void CellBuffer::AppendUndoStartAction() { - EnsureUndoRoom(); - // Finish any currently active undo sequence - undoSequenceDepth = 0; - if (actions[currentAction].at != startAction) { - undoSequenceDepth++; - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - } -} - void CellBuffer::BeginUndoAction() { - EnsureUndoRoom(); - if (undoSequenceDepth == 0) { - if (actions[currentAction].at != startAction) { - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - } - } - undoSequenceDepth++; + uh.BeginUndoAction(); } void CellBuffer::EndUndoAction() { - EnsureUndoRoom(); - undoSequenceDepth--; - if (0 == undoSequenceDepth) { - if (actions[currentAction].at != startAction) { - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - } - } + uh.EndUndoAction(); } void CellBuffer::DeleteUndoHistory() { - for (int i = 1; i < maxAction; i++) - actions[i].Destroy(); - maxAction = 0; - currentAction = 0; - savePoint = 0; + uh.DeleteUndoHistory(); } bool CellBuffer::CanUndo() { - return (!readOnly) && ((currentAction > 0) && (maxAction > 0)); + return (!readOnly) && (uh.CanUndo()); } int CellBuffer::StartUndo() { - // Drop any trailing startAction - if (actions[currentAction].at == startAction && currentAction > 0) - currentAction--; - - // Count the steps in this action - int act = currentAction; - while (actions[act].at != startAction && act > 0) { - act--; - } - return currentAction - act; + return uh.StartUndo(); +} + +const Action &CellBuffer::GetUndoStep() const { + return uh.GetUndoStep(); } -const Action &CellBuffer::UndoStep() { - const Action &actionStep = actions[currentAction]; +void CellBuffer::PerformUndoStep() { + const Action &actionStep = uh.GetUndoStep(); if (actionStep.at == insertAction) { BasicDeleteChars(actionStep.position, actionStep.lenData*2); } else if (actionStep.at == removeAction) { @@ -874,29 +999,23 @@ const Action &CellBuffer::UndoStep() { BasicInsertString(actionStep.position, styledData, actionStep.lenData*2); delete []styledData; } - currentAction--; - return actionStep; + uh.CompletedUndoStep(); } bool CellBuffer::CanRedo() { - return (!readOnly) && (maxAction > currentAction); + return (!readOnly) && (uh.CanRedo()); } int CellBuffer::StartRedo() { - // Drop any leading startAction - if (actions[currentAction].at == startAction && currentAction < maxAction) - currentAction++; - - // Count the steps in this action - int act = currentAction; - while (actions[act].at != startAction && act < maxAction) { - act++; - } - return act - currentAction; + return uh.StartRedo(); } -const Action &CellBuffer::RedoStep() { - const Action &actionStep = actions[currentAction]; +const Action &CellBuffer::GetRedoStep() const { + return uh.GetRedoStep(); +} + +void CellBuffer::PerformRedoStep() { + const Action &actionStep = uh.GetRedoStep(); if (actionStep.at == insertAction) { char *styledData = new char[actionStep.lenData * 2]; for (int i = 0; i < actionStep.lenData; i++) { @@ -908,8 +1027,7 @@ const Action &CellBuffer::RedoStep() { } else if (actionStep.at == removeAction) { BasicDeleteChars(actionStep.position, actionStep.lenData*2); } - currentAction++; - return actionStep; + uh.CompletedRedoStep(); } int CellBuffer::SetLineState(int line, int state) { diff --git a/contrib/src/stc/scintilla/src/CellBuffer.h b/contrib/src/stc/scintilla/src/CellBuffer.h index 5fbe2ea8a0..409a8749de 100644 --- a/contrib/src/stc/scintilla/src/CellBuffer.h +++ b/contrib/src/stc/scintilla/src/CellBuffer.h @@ -79,16 +79,55 @@ public: int position; char *data; int lenData; + bool mayCoalesce; Action(); ~Action(); - void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0); + void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0, bool mayCoalesce_=true); void Destroy(); void Grab(Action *source); }; enum undoCollectionType { undoCollectNone, undoCollectAutoStart, undoCollectManualStart }; +class UndoHistory { + Action *actions; + int lenActions; + int maxAction; + int currentAction; + int undoSequenceDepth; + int savePoint; + + void EnsureUndoRoom(); + +public: + UndoHistory(); + ~UndoHistory(); + + void AppendAction(actionType at, int position, char *data, int length); + + void BeginUndoAction(); + void EndUndoAction(); + void DropUndoSequence(); + void DeleteUndoHistory(); + + // The save point is a marker in the undo stack where the container has stated that + // the buffer was saved. Undo and redo can move over the save point. + void SetSavePoint(); + bool IsSavePoint() const; + + // To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is + // called that many times. Similarly for redo. + bool CanUndo() const; + int StartUndo(); + const Action &GetUndoStep() const; + void CompletedUndoStep(); + bool CanRedo() const; + int StartRedo(); + const Action &GetRedoStep() const; + void CompletedRedoStep(); +}; + // Holder for an expandable array of characters that supports undo and line markers // Based on article "Data Structures in a Bit-Mapped Text Editor" // by Wilfred J. Hansen, Byte January 1987, page 183 @@ -102,13 +141,8 @@ private: char *part2body; bool readOnly; - Action *actions; - int lenActions; - int maxAction; - int currentAction; undoCollectionType collectingUndo; - int undoSequenceDepth; - int savePoint; + UndoHistory uh; LineVector lv; @@ -117,9 +151,6 @@ private: void GapTo(int position); void RoomFor(int insertionLength); - void EnsureUndoRoom(); - void AppendAction(actionType at, int position, char *data, int length); - inline char ByteAt(int position); void SetByteAt(int position, char ch); @@ -143,7 +174,7 @@ public: // Setting styles for positions outside the range of the buffer is safe and has no effect. // True is returned if the style of a character changed. - bool SetStyleAt(int position, char style, char mask=(char)0xff); + bool SetStyleAt(int position, char style, char mask='\377'); bool SetStyleFor(int position, int length, char style, char mask); const char *DeleteChars(int position, int deleteLength); @@ -170,19 +201,20 @@ public: undoCollectionType SetUndoCollection(undoCollectionType collectUndo); bool IsCollectingUndo(); - void AppendUndoStartAction(); void BeginUndoAction(); void EndUndoAction(); void DeleteUndoHistory(); - // To perform an undo, StartUndo is called to retreive the number of steps, then UndoStep is + // To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is // called that many times. Similarly for redo. bool CanUndo(); int StartUndo(); - const Action &UndoStep(); + const Action &GetUndoStep() const; + void PerformUndoStep(); bool CanRedo(); int StartRedo(); - const Action &RedoStep(); + const Action &GetRedoStep() const; + void PerformRedoStep(); int SetLineState(int line, int state); int GetLineState(int line); diff --git a/contrib/src/stc/scintilla/src/ContractionState.cxx b/contrib/src/stc/scintilla/src/ContractionState.cxx index 6f41461eb1..4569489003 100644 --- a/contrib/src/stc/scintilla/src/ContractionState.cxx +++ b/contrib/src/stc/scintilla/src/ContractionState.cxx @@ -30,7 +30,6 @@ void ContractionState::MakeValid() const { if (!valid) { // Could be cleverer by keeping the index of the last still valid entry // rather than invalidating all. - int linePrev = -1; int lineDisplay = 0; for (int line=0; line<linesInDoc; line++) { lines[line].displayLine = lineDisplay; @@ -108,12 +107,12 @@ void ContractionState::InsertLines(int lineDoc, int lineCount) { return; } //Platform::DebugPrintf("InsertLine[%d] = %d\n", lineDoc); - if ((linesInDoc + 2) >= size) { - Grow(size + growSize); + if ((linesInDoc + lineCount + 2) >= size) { + Grow(linesInDoc + lineCount + growSize); } linesInDoc += lineCount; linesInDisplay += lineCount; - for (int i = linesInDoc + 1; i >= lineDoc + lineCount; i--) { + for (int i = linesInDoc; i >= lineDoc + lineCount; i--) { lines[i].visible = lines[i - lineCount].visible; lines[i].expanded = lines[i - lineCount].expanded; } @@ -130,16 +129,18 @@ void ContractionState::DeleteLines(int lineDoc, int lineCount) { linesInDisplay -= lineCount; return; } - int delta = 0; - for (int d=0;d<lineCount;d++) + int deltaDisplayed = 0; + for (int d=0;d<lineCount;d++) { if (lines[lineDoc+d].visible) - delta--; + deltaDisplayed--; + } for (int i = lineDoc; i < linesInDoc-lineCount; i++) { - lines[i].visible = lines[i + lineCount].visible; + if (i != 0) // Line zero is always visible + lines[i].visible = lines[i + lineCount].visible; lines[i].expanded = lines[i + lineCount].expanded; } linesInDoc -= lineCount; - linesInDisplay += delta; + linesInDisplay += deltaDisplayed; valid = false; } @@ -154,8 +155,12 @@ bool ContractionState::GetVisible(int lineDoc) const { } bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible) { + if (lineDocStart == 0) + lineDocStart++; + if (lineDocStart > lineDocEnd) + return false; if (size == 0) { - Grow(lineDocEnd + growSize); + Grow(linesInDoc + growSize); } // TODO: modify docLine members to mirror displayLine int delta = 0; @@ -191,7 +196,7 @@ bool ContractionState::GetExpanded(int lineDoc) const { bool ContractionState::SetExpanded(int lineDoc, bool expanded) { if (size == 0) { - Grow(lineDoc + growSize); + Grow(linesInDoc + growSize); } if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { if (lines[lineDoc].expanded != expanded) { diff --git a/contrib/src/stc/scintilla/src/Document.cxx b/contrib/src/stc/scintilla/src/Document.cxx index 7d832241fc..6614a7fc98 100644 --- a/contrib/src/stc/scintilla/src/Document.cxx +++ b/contrib/src/stc/scintilla/src/Document.cxx @@ -32,7 +32,10 @@ Document::Document() { } endStyled = 0; enteredCount = 0; + enteredReadOnlyCount = 0; tabInChars = 8; + indentInChars = 0; + useTabs = true; watchers = 0; lenWatchers = 0; } @@ -65,26 +68,54 @@ void Document::SetSavePoint() { NotifySavePoint(true); } -int Document::LineStart(int line) { - return cb.LineStart(line); +int Document::AddMark(int line, int markerNum) { + int prev = cb.AddMark(line, markerNum); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); + NotifyModified(mh); + return prev; } -int Document::LineFromPosition(int pos) { - return cb.LineFromPosition(pos); +void Document::DeleteMark(int line, int markerNum) { + cb.DeleteMark(line, markerNum); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); + NotifyModified(mh); } -int Document::LineEndPosition(int position) { - int line = LineFromPosition(position); +void Document::DeleteMarkFromHandle(int markerHandle) { + cb.DeleteMarkFromHandle(markerHandle); + DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); + NotifyModified(mh); +} + +void Document::DeleteAllMarks(int markerNum) { + cb.DeleteAllMarks(markerNum); + DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); + NotifyModified(mh); +} + +int Document::LineStart(int line) { + return cb.LineStart(line); +} + +int Document::LineEnd(int line) { if (line == LinesTotal() - 1) { - position = LineStart(line + 1); + return LineStart(line + 1); } else { - position = LineStart(line + 1) - 1; + int position = LineStart(line + 1) - 1; // When line terminator is CR+LF, may need to go back one more if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { position--; } + return position; } - return position; +} + +int Document::LineFromPosition(int pos) { + return cb.LineFromPosition(pos); +} + +int Document::LineEndPosition(int position) { + return LineEnd(LineFromPosition(position)); } int Document::VCHomePosition(int position) { @@ -124,7 +155,10 @@ int Document::GetLastChild(int lineParent, int level) { level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK; int maxLine = LinesTotal(); int lineMaxSubord = lineParent; - while ((lineMaxSubord < maxLine-1) && IsSubordinate(level, GetLevel(lineMaxSubord+1))) { + while (lineMaxSubord < maxLine-1) { + EnsureStyledTo(LineStart(lineMaxSubord+2)); + if (!IsSubordinate(level, GetLevel(lineMaxSubord+1))) + break; lineMaxSubord++; } if (lineMaxSubord > lineParent) { @@ -170,18 +204,23 @@ bool Document::IsCrLf(int pos) { bool Document::IsDBCS(int pos) { #if PLAT_WIN if (dbcsCodePage) { - // Anchor DBCS calculations at start of line because start of line can - // not be a DBCS trail byte. - int startLine = pos; - while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n') - startLine--; - while (startLine <= pos) { - if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) { + if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); + return ch >= 0x80; + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. + int startLine = pos; + while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n') + startLine--; + while (startLine <= pos) { + if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) { + startLine++; + if (startLine >= pos) + return true; + } startLine++; - if (startLine >= pos) - return true; } - startLine++; } } return false; @@ -190,6 +229,28 @@ bool Document::IsDBCS(int pos) { #endif } +int Document::LenChar(int pos) { + if (IsCrLf(pos)) { + return 2; + } else if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); + if (ch < 0x80) + return 1; + int len = 2; + if (ch >= (0x80+0x40+0x20)) + len = 3; + int lengthDoc = Length(); + if ((pos + len) > lengthDoc) + return lengthDoc-pos; + else + return len; + } else if (IsDBCS(pos)) { + return 2; + } else { + return 1; + } +} + // Normalise a position so that it is not halfway through a two byte character. // This can occur in two situations - // When lines are terminated with \r\n pairs which should be treated as one character. @@ -221,29 +282,41 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { #if PLAT_WIN if (dbcsCodePage) { - // Anchor DBCS calculations at start of line because start of line can - // not be a DBCS trail byte. - int startLine = pos; - while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n') - startLine--; - bool atLeadByte = false; - while (startLine < pos) { - if (atLeadByte) - atLeadByte = false; - else if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) - atLeadByte = true; - else - atLeadByte = false; - startLine++; - //Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-"); - } + if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); + while ((pos > 0) && (pos < Length()) && (ch >= 0x80) && (ch < (0x80 + 0x40))) { + // ch is a trail byte + if (moveDir > 0) + pos++; + else + pos--; + ch = static_cast<unsigned char>(cb.CharAt(pos)); + } + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. + int startLine = pos; + while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n') + startLine--; + bool atLeadByte = false; + while (startLine < pos) { + if (atLeadByte) + atLeadByte = false; + else if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) + atLeadByte = true; + else + atLeadByte = false; + startLine++; + //Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-"); + } - if (atLeadByte) { - // Position is between a lead byte and a trail byte - if (moveDir > 0) - return pos + 1; - else - return pos - 1; + if (atLeadByte) { + // Position is between a lead byte and a trail byte + if (moveDir > 0) + return pos + 1; + else + return pos - 1; + } } } #endif @@ -261,41 +334,60 @@ void Document::ModifiedAt(int pos) { // Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number void Document::DeleteChars(int pos, int len) { + if (cb.IsReadOnly() && enteredReadOnlyCount==0) { + enteredReadOnlyCount++; + NotifyModifyAttempt(); + enteredReadOnlyCount--; + } if (enteredCount == 0) { enteredCount++; - if (cb.IsReadOnly()) - NotifyModifyAttempt(); if (!cb.IsReadOnly()) { + NotifyModified( + DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, + pos, len, + 0, 0)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); const char *text = cb.DeleteChars(pos*2, len * 2); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); ModifiedAt(pos); - int modFlags = SC_MOD_DELETETEXT | SC_PERFORMED_USER; - DocModification mh(modFlags, pos, len, LinesTotal() - prevLinesTotal, text); - NotifyModified(mh); + NotifyModified( + DocModification( + SC_MOD_DELETETEXT | SC_PERFORMED_USER, + pos, len, + LinesTotal() - prevLinesTotal, text)); } enteredCount--; } } void Document::InsertStyledString(int position, char *s, int insertLength) { + if (cb.IsReadOnly() && enteredReadOnlyCount==0) { + enteredReadOnlyCount++; + NotifyModifyAttempt(); + enteredReadOnlyCount--; + } if (enteredCount == 0) { enteredCount++; - if (cb.IsReadOnly()) - NotifyModifyAttempt(); if (!cb.IsReadOnly()) { + NotifyModified( + DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, + position / 2, insertLength / 2, + 0, 0)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); const char *text = cb.InsertString(position, s, insertLength); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); ModifiedAt(position / 2); - - int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER; - DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text); - NotifyModified(mh); + NotifyModified( + DocModification( + SC_MOD_INSERTTEXT | SC_PERFORMED_USER, + position / 2, insertLength / 2, + LinesTotal() - prevLinesTotal, text)); } enteredCount--; } @@ -307,9 +399,18 @@ int Document::Undo() { enteredCount++; bool startSavePoint = cb.IsSavePoint(); int steps = cb.StartUndo(); + //Platform::DebugPrintf("Steps=%d\n", steps); for (int step=0; step<steps; step++) { int prevLinesTotal = LinesTotal(); - const Action &action = cb.UndoStep(); + const Action &action = cb.GetUndoStep(); + if (action.at == removeAction) { + NotifyModified(DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); + } else { + NotifyModified(DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); + } + cb.PerformUndoStep(); int cellPosition = action.position / 2; ModifiedAt(cellPosition); newPos = cellPosition; @@ -344,10 +445,17 @@ int Document::Redo() { int steps = cb.StartRedo(); for (int step=0; step<steps; step++) { int prevLinesTotal = LinesTotal(); - const Action &action = cb.RedoStep(); - int cellPosition = action.position / 2; - ModifiedAt(cellPosition); - newPos = cellPosition; + const Action &action = cb.GetRedoStep(); + if (action.at == insertAction) { + NotifyModified(DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); + } else { + NotifyModified(DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); + } + cb.PerformRedoStep(); + ModifiedAt(action.position / 2); + newPos = action.position / 2; int modFlags = SC_PERFORMED_REDO; if (action.at == insertAction) { @@ -358,7 +466,8 @@ int Document::Redo() { } if (step == steps-1) modFlags |= SC_LASTSTEPINUNDOREDO; - NotifyModified(DocModification(modFlags, cellPosition, action.lenData, + NotifyModified( + DocModification(modFlags, action.position / 2, action.lenData, LinesTotal() - prevLinesTotal, action.data)); } @@ -395,14 +504,13 @@ void Document::InsertString(int position, const char *s, int insertLength) { } } +void Document::ChangeChar(int pos, char ch) { + DeleteChars(pos, 1); + InsertChar(pos, ch); +} + void Document::DelChar(int pos) { - if (IsCrLf(pos)) { - DeleteChars(pos, 2); - } else if (IsDBCS(pos)) { - DeleteChars(pos, 2); - } else if (pos < Length()) { - DeleteChars(pos, 1); - } + DeleteChars(pos, LenChar(pos)); } int Document::DelCharBack(int pos) { @@ -411,6 +519,10 @@ int Document::DelCharBack(int pos) { } else if (IsCrLf(pos - 2)) { DeleteChars(pos - 2, 2); return pos - 2; + } else if (SC_CP_UTF8 == dbcsCodePage) { + int startChar = MovePositionOutsideChar(pos-1, -1, false); + DeleteChars(startChar, pos - startChar); + return startChar; } else if (IsDBCS(pos - 1)) { DeleteChars(pos - 2, 2); return pos - 2; @@ -420,28 +532,81 @@ int Document::DelCharBack(int pos) { } } -void Document::Indent(bool forwards, int lineBottom, int lineTop) { - if (forwards) { - // Indent by a tab - for (int line = lineBottom; line >= lineTop; line--) { - InsertChar(LineStart(line), '\t'); +static bool isindentchar(char ch) { + return (ch == ' ') || (ch == '\t'); +} + +static int NextTab(int pos, int tabSize) { + return ((pos / tabSize) + 1) * tabSize; +} + +static void CreateIndentation(char *linebuf, int length, int indent, int tabSize, bool insertSpaces) { + length--; // ensure space for \0 + if (!insertSpaces) { + while ((indent >= tabSize) && (length > 0)) { + *linebuf++ = '\t'; + indent -= tabSize; + length--; } - } else { - // Dedent - suck white space off the front of the line to dedent by equivalent of a tab - for (int line = lineBottom; line >= lineTop; line--) { - int ispc = 0; - while (ispc < tabInChars && cb.CharAt(LineStart(line) + ispc) == ' ') - ispc++; - int posStartLine = LineStart(line); - if (ispc == tabInChars) { - DeleteChars(posStartLine, ispc); - } else if (cb.CharAt(posStartLine + ispc) == '\t') { - DeleteChars(posStartLine, ispc + 1); - } else { // Hit a non-white - DeleteChars(posStartLine, ispc); - } + } + while ((indent > 0) && (length > 0)) { + *linebuf++ = ' '; + indent--; + length--; + } + *linebuf = '\0'; +} + +int Document::GetLineIndentation(int line) { + int indent = 0; + if ((line >= 0) && (line < LinesTotal())) { + int lineStart = LineStart(line); + int length = Length(); + for (int i=lineStart;i<length;i++) { + char ch = cb.CharAt(i); + if (ch == ' ') + indent++; + else if (ch == '\t') + indent = NextTab(indent, tabInChars); + else + return indent; } } + return indent; +} + +void Document::SetLineIndentation(int line, int indent) { + int indentOfLine = GetLineIndentation(line); + if (indent < 0) + indent = 0; + if (indent != indentOfLine) { + char linebuf[1000]; + CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs); + int thisLineStart = LineStart(line); + int indentPos = GetLineIndentPosition(line); + DeleteChars(thisLineStart, indentPos - thisLineStart); + InsertString(thisLineStart, linebuf); + } +} + +int Document::GetLineIndentPosition(int line) { + int pos = LineStart(line); + int length = Length(); + while ((pos < length) && isindentchar(cb.CharAt(pos))) { + pos++; + } + return pos; +} + +void Document::Indent(bool forwards, int lineBottom, int lineTop) { + // Dedent - suck white space off the front of the line to dedent by equivalent of a tab + for (int line = lineBottom; line >= lineTop; line--) { + int indentOfLine = GetLineIndentation(line); + if (forwards) + SetLineIndentation(line, indentOfLine + IndentSize()); + else + SetLineIndentation(line, indentOfLine - IndentSize()); + } } void Document::ConvertLineEnds(int eolModeSet) { @@ -485,6 +650,8 @@ void Document::ConvertLineEnds(int eolModeSet) { } bool Document::IsWordChar(unsigned char ch) { + if ((SC_CP_UTF8 == dbcsCodePage) && (ch >0x80)) + return true; return wordchars[ch]; } @@ -551,16 +718,14 @@ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitiv // Compute actual search ranges needed int lengthFind = strlen(s); - int endSearch = 0; + int endSearch = endPos; if (startPos <= endPos) { endSearch = endPos - lengthFind + 1; - } else { - endSearch = endPos; } //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); char firstChar = s[0]; if (!caseSensitive) - firstChar = toupper(firstChar); + firstChar = static_cast<char>(toupper(firstChar)); int pos = startPos; while (forward ? (pos < endSearch) : (pos >= endSearch)) { char ch = CharAt(pos); @@ -605,6 +770,25 @@ int Document::LinesTotal() { return cb.Lines(); } +void Document::ChangeCase(Range r, bool makeUpperCase) { + for (int pos=r.start; pos<r.end; pos++) { + char ch = CharAt(pos); + if (dbcsCodePage && IsDBCS(pos)) { + pos += LenChar(pos); + } else { + if (makeUpperCase) { + if (islower(ch)) { + ChangeChar(pos, static_cast<char>(toupper(ch))); + } + } else { + if (isupper(ch)) { + ChangeChar(pos, static_cast<char>(tolower(ch))); + } + } + } + } +} + void Document::SetWordChars(unsigned char *chars) { int ch; for (ch = 0; ch < 256; ch++) { @@ -671,6 +855,13 @@ void Document::SetStyles(int length, char *styles) { } } +bool Document::EnsureStyledTo(int pos) { + // Ask the watchers to style, and stop as soon as one responds. + for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) + watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos); + return pos <= GetEndStyled(); +} + bool Document::AddWatcher(DocWatcher *watcher, void *userData) { for (int i = 0; i < lenWatchers; i++) { if ((watchers[i].watcher == watcher) && diff --git a/contrib/src/stc/scintilla/src/Document.h b/contrib/src/stc/scintilla/src/Document.h index fba611c7f7..92e4ff14fe 100644 --- a/contrib/src/stc/scintilla/src/Document.h +++ b/contrib/src/stc/scintilla/src/Document.h @@ -74,9 +74,10 @@ private: CellBuffer cb; bool wordchars[256]; int stylingPos; - int stylingMask; + char stylingMask; int endStyled; int enteredCount; + int enteredReadOnlyCount; WatcherWithUserData *watchers; int lenWatchers; @@ -86,8 +87,11 @@ public: int stylingBitsMask; int eolMode; + // dbcsCodePage can also be SC_CP_UTF8 to enable UTF-8 mode int dbcsCodePage; int tabInChars; + int indentInChars; + bool useTabs; Document(); virtual ~Document(); @@ -98,6 +102,7 @@ public: int LineFromPosition(int pos); int ClampPositionIntoDocument(int pos); bool IsCrLf(int pos); + int LenChar(int pos); int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); // Gateways to modifying document @@ -111,11 +116,14 @@ public: undoCollectionType SetUndoCollection(undoCollectionType collectUndo) { return cb.SetUndoCollection(collectUndo); } - void AppendUndoStartAction() { cb.AppendUndoStartAction(); } void BeginUndoAction() { cb.BeginUndoAction(); } void EndUndoAction() { cb.EndUndoAction(); } void SetSavePoint(); bool IsSavePoint() { return cb.IsSavePoint(); } + + int GetLineIndentation(int line); + void SetLineIndentation(int line, int indent); + int GetLineIndentPosition(int line); void Indent(bool forwards, int lineBottom, int lineTop); void ConvertLineEnds(int eolModeSet); void SetReadOnly(bool set) { cb.SetReadOnly(set); } @@ -123,6 +131,7 @@ public: void InsertChar(int pos, char ch); void InsertString(int position, const char *s); void InsertString(int position, const char *s, int insertLength); + void ChangeChar(int pos, char ch); void DelChar(int pos); int DelCharBack(int pos); @@ -132,12 +141,13 @@ public: } char StyleAt(int position) { return cb.StyleAt(position); } int GetMark(int line) { return cb.GetMark(line); } - int AddMark(int line, int markerNum) { return cb.AddMark(line, markerNum); } - void DeleteMark(int line, int markerNum) { cb.DeleteMark(line, markerNum); } - void DeleteMarkFromHandle(int markerHandle) { cb.DeleteMarkFromHandle(markerHandle); } - void DeleteAllMarks(int markerNum) { cb.DeleteAllMarks(markerNum); } + int AddMark(int line, int markerNum); + void DeleteMark(int line, int markerNum); + void DeleteMarkFromHandle(int markerHandle); + void DeleteAllMarks(int markerNum); int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); } int LineStart(int line); + int LineEnd(int line); int LineEndPosition(int position); int VCHomePosition(int position); @@ -154,12 +164,15 @@ public: long FindText(WORD iMessage,WPARAM wParam,LPARAM lParam); int LinesTotal(); + void ChangeCase(Range r, bool makeUpperCase); + void SetWordChars(unsigned char *chars); void SetStylingBits(int bits); void StartStyling(int position, char mask); void SetStyleFor(int length, char style); void SetStyles(int length, char *styles); int GetEndStyled() { return endStyled; } + bool EnsureStyledTo(int pos); int SetLineState(int line, int state) { return cb.SetLineState(line, state); } int GetLineState(int line) { return cb.GetLineState(line); } @@ -175,10 +188,12 @@ private: bool IsWordChar(unsigned char ch); bool IsWordAt(int start, int end); void ModifiedAt(int pos); - + void NotifyModifyAttempt(); void NotifySavePoint(bool atSavePoint); void NotifyModified(DocModification mh); + + int IndentSize() { return indentInChars ? indentInChars : tabInChars; } }; // To optimise processing of document modifications by DocWatchers, a hint is passed indicating the @@ -205,6 +220,16 @@ public: line(0), foldLevelNow(0), foldLevelPrev(0) {} + + DocModification(int modificationType_, const Action &act, int linesAdded_=0) : + modificationType(modificationType_), + position(act.position / 2), + length(act.lenData), + linesAdded(linesAdded_), + text(act.data), + line(0), + foldLevelNow(0), + foldLevelPrev(0) {} }; // A class that wants to receive notifications from a Document must be derived from DocWatcher @@ -217,6 +242,7 @@ public: virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0; virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0; virtual void NotifyDeleted(Document *doc, void *userData) = 0; + virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0; }; #endif diff --git a/contrib/src/stc/scintilla/src/DocumentAccessor.cxx b/contrib/src/stc/scintilla/src/DocumentAccessor.cxx new file mode 100644 index 0000000000..d28840c166 --- /dev/null +++ b/contrib/src/stc/scintilla/src/DocumentAccessor.cxx @@ -0,0 +1,174 @@ +// SciTE - Scintilla based Text Editor +// Accessor.cxx - rapid easy access to contents of a Scintilla +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <ctype.h> +#include <stdio.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "SVector.h" +#include "Accessor.h" +#include "DocumentAccessor.h" +#include "CellBuffer.h" +#include "Scintilla.h" +#include "Document.h" + +DocumentAccessor::~DocumentAccessor() { +} + +bool DocumentAccessor::InternalIsLeadByte(char ch) { +#if PLAT_GTK + // TODO: support DBCS under GTK+ + return false; +#elif PLAT_WIN + if (SC_CP_UTF8 == codePage) + // For lexing, all characters >= 0x80 are treated the + // same so none is considered a lead byte. + return false; + else + return IsDBCSLeadByteEx(codePage, ch); +#elif PLAT_WX + return false; +#endif +} + +void DocumentAccessor::Fill(int position) { + if (lenDoc == -1) + lenDoc = pdoc->Length(); + startPos = position - slopSize; + if (startPos + bufferSize > lenDoc) + startPos = lenDoc - bufferSize; + if (startPos < 0) + startPos = 0; + endPos = startPos + bufferSize; + if (endPos > lenDoc) + endPos = lenDoc; + + pdoc->GetCharRange(buf, startPos, endPos-startPos); + buf[endPos-startPos] = '\0'; +} + +char DocumentAccessor::StyleAt(int position) { + return pdoc->StyleAt(position); +} + +int DocumentAccessor::GetLine(int position) { + return pdoc->LineFromPosition(position); +} + +int DocumentAccessor::LineStart(int line) { + return pdoc->LineStart(line); +} + +int DocumentAccessor::LevelAt(int line) { + return pdoc->GetLevel(line); +} + +int DocumentAccessor::Length() { + if (lenDoc == -1) + lenDoc = pdoc->Length(); + return lenDoc; +} + +int DocumentAccessor::GetLineState(int line) { + return pdoc->GetLineState(line); +} + +int DocumentAccessor::SetLineState(int line, int state) { + return pdoc->SetLineState(line, state); +} + +void DocumentAccessor::StartAt(unsigned int start, char chMask) { + pdoc->StartStyling(start, chMask); +} + +void DocumentAccessor::StartSegment(unsigned int pos) { + startSeg = pos; +} + +void DocumentAccessor::ColourTo(unsigned int pos, int chAttr) { + // Only perform styling if non empty range + if (pos != startSeg - 1) { + if (pos < startSeg) { + Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos); + } + + if (validLen + (pos - startSeg + 1) >= bufferSize) + Flush(); + if (validLen + (pos - startSeg + 1) >= bufferSize) { + // Too big for buffer so send directly + pdoc->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr)); + } else { + if (chAttr != chWhile) + chFlags = 0; + chAttr |= chFlags; + for (unsigned int i = startSeg; i <= pos; i++) { + styleBuf[validLen++] = static_cast<char>(chAttr); + } + } + } + startSeg = pos+1; +} + +void DocumentAccessor::SetLevel(int line, int level) { + pdoc->SetLevel(line, level); +} + +void DocumentAccessor::Flush() { + startPos = extremePosition; + lenDoc = -1; + if (validLen > 0) { + pdoc->SetStyles(validLen, styleBuf); + validLen = 0; + } +} + +int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { + int end = Length(); + int spaceFlags = 0; + + // Determines the indentation level of the current line and also checks for consistent + // indentation compared to the previous line. + // Indentation is judged consistent when the indentation whitespace of each line lines + // the same or the indentation of one line is a prefix of the other. + + int pos = LineStart(line); + char ch = (*this)[pos]; + int indent = 0; + bool inPrevPrefix = line > 0; + int posPrev = inPrevPrefix ? LineStart(line-1) : 0; + while ((ch == ' ' || ch == '\t') && (pos < end)) { + if (inPrevPrefix) { + char chPrev = (*this)[posPrev++]; + if (chPrev == ' ' || chPrev == '\t') { + if (chPrev != ch) + spaceFlags |= wsInconsistent; + } else { + inPrevPrefix = false; + } + } + if (ch == ' ') { + spaceFlags |= wsSpace; + indent++; + } else { // Tab + spaceFlags |= wsTab; + if (spaceFlags & wsSpace) + spaceFlags |= wsSpaceTab; + indent = (indent / 8 + 1) * 8; + } + ch = (*this)[++pos]; + } + + *flags = spaceFlags; + indent += SC_FOLDLEVELBASE; + // if completely empty line or the start of a comment... + if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) + return indent | SC_FOLDLEVELWHITEFLAG; + else + return indent; +} + diff --git a/contrib/src/stc/scintilla/src/DocumentAccessor.h b/contrib/src/stc/scintilla/src/DocumentAccessor.h new file mode 100644 index 0000000000..37a9db4149 --- /dev/null +++ b/contrib/src/stc/scintilla/src/DocumentAccessor.h @@ -0,0 +1,49 @@ +// DocumentAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +class Document; + +class DocumentAccessor : public Accessor { + // Private so DocumentAccessor objects can not be copied + DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {} + DocumentAccessor &operator=(const DocumentAccessor &) { return *this; } +protected: + Document *pdoc; + PropSet &props; + int lenDoc; + + char styleBuf[bufferSize]; + int validLen; + char chFlags; + char chWhile; + unsigned int startSeg; + + bool InternalIsLeadByte(char ch); + void Fill(int position); +public: + DocumentAccessor(Document *pdoc_, PropSet &props_) : + Accessor(), pdoc(pdoc_), props(props_), + lenDoc(-1), validLen(0), chFlags(0) { + } + ~DocumentAccessor(); + char StyleAt(int position); + int GetLine(int position); + int LineStart(int line); + int LevelAt(int line); + int Length(); + void Flush(); + int GetLineState(int line); + int SetLineState(int line, int state); + int GetPropertyInt(const char *key, int defaultValue=0) { + return props.GetInt(key, defaultValue); + } + + void StartAt(unsigned int start, char chMask=31); + void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; + unsigned int GetStartSegment() { return startSeg; } + void StartSegment(unsigned int pos); + void ColourTo(unsigned int pos, int chAttr); + void SetLevel(int line, int level); + int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); +}; diff --git a/contrib/src/stc/scintilla/src/Editor.cxx b/contrib/src/stc/scintilla/src/Editor.cxx index 6508c95b1f..ad8bab8c5f 100644 --- a/contrib/src/stc/scintilla/src/Editor.cxx +++ b/contrib/src/stc/scintilla/src/Editor.cxx @@ -69,6 +69,7 @@ Editor::Editor() { xOffset = 0; xCaretMargin = 50; + horizontalScrollBarVisible = true; currentPos = 0; anchor = 0; @@ -88,6 +89,8 @@ Editor::Editor() { modEventMask = SC_MODEVENTMASKALL; + displayPopupMenu = true; + pdoc = new Document(); pdoc ->AddRef(); pdoc->AddWatcher(this, 0); @@ -187,7 +190,7 @@ bool IsControlCharacter(char ch) { return ch >= 0 && ch < ' '; } -const char *ControlCharacterString(char ch) { +const char *ControlCharacterString(unsigned char ch) { const char *reps[] = { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", @@ -208,6 +211,7 @@ Point Editor::LocationFromPosition(unsigned int pos) { //Platform::DebugPrintf("line=%d\n", line); Surface surface; surface.Init(); + surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); Point pt; pt.y = (lineVisible - topLine) * vs.lineHeight; // + half a lineheight? unsigned int posLineStart = pdoc->LineStart(line); @@ -250,6 +254,7 @@ int Editor::PositionFromLocation(Point pt) { //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine); Surface surface; surface.Init(); + surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); unsigned int posLineStart = pdoc->LineStart(line); LineLayout ll; @@ -271,6 +276,7 @@ int Editor::PositionFromLineX(int line, int x) { //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine); Surface surface; surface.Init(); + surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); unsigned int posLineStart = pdoc->LineStart(line); LineLayout ll; @@ -483,7 +489,7 @@ void Editor::ScrollTo(int line) { } } -void Editor::ScrollText(int linesToMove) { +void Editor::ScrollText(int /* linesToMove */) { //Platform::DebugPrintf("Editor::ScrollText %d\n", linesToMove); Redraw(); } @@ -497,6 +503,19 @@ void Editor::HorizontalScrollTo(int xPos) { Redraw(); } +void Editor::MoveCaretInsideView() { + PRectangle rcClient = GetTextRectangle(); + Point pt = LocationFromPosition(currentPos); + if (pt.y < rcClient.top) { + MovePositionTo(PositionFromLocation( + Point(lastXChosen, rcClient.top))); + } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { + int yOfLastLineFullyDisplayed = rcClient.top + (LinesOnScreen()-1) * vs.lineHeight; + MovePositionTo(PositionFromLocation( + Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed))); + } +} + void Editor::EnsureCaretVisible(bool useMargin) { //Platform::DebugPrintf("EnsureCaretVisible %d\n", xOffset); PRectangle rcClient = GetTextRectangle(); @@ -631,7 +650,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { int line = cs.DocFromDisplay(visibleLine); int yposScreen = 0; - while (line < pdoc->LinesTotal() && yposScreen < rcMargin.bottom) { + while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) { int marks = pdoc->GetMark(line); if (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) { if (cs.GetExpanded(line)) { @@ -648,13 +667,12 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { char number[100]; number[0] = '\0'; sprintf(number, "%d", line + 1); - if (foldFlags & 8) + if (foldFlags & 64) sprintf(number, "%X", pdoc->GetLevel(line)); - int xpos = 0; PRectangle rcNumber=rcMarker; // Right justify int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, strlen(number)); - xpos = rcNumber.right - width - 3; + int xpos = rcNumber.right - width - 3; rcNumber.left = xpos; if ((visibleLine < cs.LinesDisplayed()) && cs.GetVisible(line)) { surface->DrawText(rcNumber, vs.styles[STYLE_LINENUMBER].font, @@ -718,8 +736,8 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou styleByte = pdoc->StyleAt(charInDoc); if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) { ll.chars[numCharsInLine] = chDoc; - ll.styles[numCharsInLine] = styleByte & styleMask; - ll.indicators[numCharsInLine] = styleByte & ~styleMask; + ll.styles[numCharsInLine] = static_cast<char>(styleByte & styleMask); + ll.indicators[numCharsInLine] = static_cast<char>(styleByte & ~styleMask); numCharsInLine++; } } @@ -853,7 +871,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int xStart, } else { rcSegment.left = ll.positions[startseg] + xStart; rcSegment.right = ll.positions[i + 1] + xStart; - // Only try do draw if really visible - enhances performance by not calling environment to + // Only try to draw if really visible - enhances performance by not calling environment to // draw strings that are completely past the right side of the window. if (rcSegment.left <= rcLine.right) { surface->DrawText(rcSegment, textFont, @@ -871,6 +889,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int xStart, } } } + if (vsDraw.styles[styleMain].underline) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + surface->FillRectangle(rcUL, textFore); + } } startseg = i + 1; } @@ -991,10 +1015,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { ypos += screenLinePaintFirst * vs.lineHeight; int yposScreen = screenLinePaintFirst * vs.lineHeight; - if (endPosPaint > pdoc->GetEndStyled()) { - // Notify container to do some more styling - NotifyStyleNeeded(endPosPaint); - } + // Ensure we are styled as far as we are painting. + pdoc->EnsureStyledTo(endPosPaint); + if (needUpdateUI) { NotifyUpdateUI(); needUpdateUI = false; @@ -1009,21 +1032,20 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { } if (paintState == paintAbandoned) { - // Either NotifyStyleNeeded or NotifyUpdateUI noticed that painting is needed + // Either styling or NotifyUpdateUI noticed that painting is needed // outside the current painting rectangle //Platform::DebugPrintf("Abandoning paint\n"); return; } //Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset); - Surface *surface = 0; if (rcArea.right > vs.fixedColumnWidth) { + Surface *surface = surfaceWindow; if (bufferedDraw) { surface = &pixmapLine; - } else { - surface = surfaceWindow; } + surface->SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); int visibleLine = topLine + screenLinePaintFirst; int line = cs.DocFromDisplay(visibleLine); @@ -1059,27 +1081,38 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { // Highlight the current braces if any if ((braces[0] >= posLineStart) && (braces[0] < posLineEnd)) - ll.styles[braces[0] - posLineStart] = bracesMatchStyle; + ll.styles[braces[0] - posLineStart] = + static_cast<char>(bracesMatchStyle); if ((braces[1] >= posLineStart) && (braces[1] < posLineEnd)) - ll.styles[braces[1] - posLineStart] = bracesMatchStyle; + ll.styles[braces[1] - posLineStart] = + static_cast<char>(bracesMatchStyle); // Draw the line if (cs.GetVisible(line)) DrawLine(surface, vs, line, xStart, rcLine, ll); - if (foldFlags & 2) { + bool expanded = cs.GetExpanded(line); + if ( (expanded && (foldFlags & 2)) || (!expanded && (foldFlags & 4)) ) { if (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) { PRectangle rcFoldLine = rcLine; rcFoldLine.bottom = rcFoldLine.top + 1; surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); } } + if ( (expanded && (foldFlags & 8)) || (!expanded && (foldFlags & 16)) ) { + if (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) { + PRectangle rcFoldLine = rcLine; + rcFoldLine.top = rcFoldLine.bottom - 1; + surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); + } + } // Draw the Caret if (line == lineCaret) { - int xposCaret = ll.positions[posCaret - posLineStart] + xStart; + int offset = Platform::Minimum(posCaret - posLineStart, LineLayout::maxLineLength); + int xposCaret = ll.positions[offset] + xStart; int widthOverstrikeCaret = - ll.positions[posCaret - posLineStart + 1] - ll.positions[posCaret - posLineStart]; + ll.positions[offset + 1] - ll.positions[offset]; if (posCaret == pdoc->Length()) // At end of document widthOverstrikeCaret = vs.aveCharWidth; if ((posCaret - posLineStart) >= ll.numCharsInLine) // At end of line @@ -1154,8 +1187,10 @@ long Editor::FormatRange(bool draw, FORMATRANGE *pfr) { Surface *surface = new Surface(); surface->Init(pfr->hdc); + surface->SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); Surface *surfaceMeasure = new Surface(); surfaceMeasure->Init(pfr->hdcTarget); + surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); ViewStyle vsPrint(vs); @@ -1204,10 +1239,9 @@ long Editor::FormatRange(bool draw, FORMATRANGE *pfr) { if (linePrintLast < pdoc->LinesTotal()) endPosPrint = pdoc->LineStart(linePrintLast + 1); - if (endPosPrint > pdoc->GetEndStyled()) { - // Notify container to do some more styling - NotifyStyleNeeded(endPosPrint); - } + // Ensure we are styled to where we are formatting. + pdoc->EnsureStyledTo(endPosPrint); + int xStart = vsPrint.fixedColumnWidth + pfr->rc.left + lineNumberWidth; int ypos = pfr->rc.top; int line = linePrintStart; @@ -1228,20 +1262,27 @@ long Editor::FormatRange(bool draw, FORMATRANGE *pfr) { PRectangle rcNumber = rcLine; rcNumber.right = rcNumber.left + lineNumberWidth; // Right justify - rcNumber.left += lineNumberWidth - + rcNumber.left -= surface->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, number, strlen(number)); surface->DrawText(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font, ypos + vsPrint.maxAscent, number, strlen(number), vsPrint.styles[STYLE_LINENUMBER].fore.allocated, vsPrint.styles[STYLE_LINENUMBER].back.allocated); } + + // When printing, the hdc and hdcTarget may be the same, so + // changing the state of surfaceMeasure may change the underlying + // state of surface. Therefore, any cached state is discarded before + // using each surface. // Copy this line and its styles from the document into local arrays // and determine the x position at which each character starts. + surfaceMeasure->FlushCachedState(); LineLayout ll; LayoutLine(line, surfaceMeasure, vsPrint, ll); // Draw the line + surface->FlushCachedState(); DrawLine(surface, vsPrint, line, xStart, rcLine, ll); ypos += vsPrint.lineHeight; @@ -1255,6 +1296,10 @@ long Editor::FormatRange(bool draw, FORMATRANGE *pfr) { return endPosPrint; } +// Empty method is overridden on GTK+ to show / hide scrollbars +void Editor::ReconfigureScrollBars() { +} + void Editor::SetScrollBarsTo(PRectangle) { RefreshStyleData(); @@ -1280,6 +1325,13 @@ void Editor::SetScrollBars() { } void Editor::AddChar(char ch) { + char s[2]; + s[0] = ch; + s[1] = '\0'; + AddCharUTF(s, 1); +} + +void Editor::AddCharUTF(char *s, unsigned int len) { bool wasSelection = currentPos != anchor; ClearSelection(); if (inOverstrike && !wasSelection) { @@ -1289,11 +1341,11 @@ void Editor::AddChar(char ch) { } } } - pdoc->InsertChar(currentPos, ch); - SetEmptySelection(currentPos + 1); + pdoc->InsertString(currentPos, s, len); + SetEmptySelection(currentPos + len); EnsureCaretVisible(); SetLastXChosen(); - NotifyChar(ch); + NotifyChar(s[0]); } void Editor::ClearSelection() { @@ -1302,8 +1354,7 @@ void Editor::ClearSelection() { int lineStart = pdoc->LineFromPosition(SelectionStart()); int lineEnd = pdoc->LineFromPosition(SelectionEnd()); int startPos = SelectionStart(); - int line; - for (line=lineStart; line <= lineEnd; line++) { + for (int line=lineEnd; line >= lineStart; line--) { startPos = SelectionStart(line); unsigned int chars = SelectionEnd(line) - startPos; if (0 != chars) { @@ -1414,13 +1465,17 @@ void Editor::DelCharBack() { void Editor::NotifyFocus(bool) { } -void Editor::NotifyStyleNeeded(int endStyleNeeded) { +void Editor::NotifyStyleToNeeded(int endStyleNeeded) { SCNotification scn; scn.nmhdr.code = SCN_STYLENEEDED; scn.position = endStyleNeeded; NotifyParent(scn); } +void Editor::NotifyStyleNeeded(Document*, void *, int endStyleNeeded) { + NotifyStyleToNeeded(endStyleNeeded); +} + void Editor::NotifyChar(char ch) { SCNotification scn; scn.nmhdr.code = SCN_CHARADDED; @@ -1563,13 +1618,17 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { } } } + if (mh.modificationType & SC_MOD_BEFOREINSERT) { + NotifyNeedShown(mh.position, 0); + } else if (mh.modificationType & SC_MOD_BEFOREDELETE) { + NotifyNeedShown(mh.position, mh.length); + } if (mh.linesAdded != 0) { // Update contraction state for inserted and removed lines // lineOfPos should be calculated in context of state before modification, shouldn't it int lineOfPos = pdoc->LineFromPosition(mh.position); if (mh.linesAdded > 0) { - NotifyNeedShown(mh.position, mh.length); cs.InsertLines(lineOfPos, mh.linesAdded); } else { cs.DeleteLines(lineOfPos, -mh.linesAdded); @@ -1599,6 +1658,10 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { SetScrollBars(); } + if (mh.modificationType & SC_MOD_CHANGEMARKER) { + RedrawSelMargin(); + } + // If client wants to see this modification if (mh.modificationType & modEventMask) { if ((mh.modificationType & SC_MOD_CHANGESTYLE) == 0) { @@ -1619,7 +1682,7 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { } } -void Editor::NotifyDeleted(Document *document, void *userData) { +void Editor::NotifyDeleted(Document *, void *) { /* Do nothing */ } @@ -1677,6 +1740,11 @@ void Editor::NotifyMacroRecord(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_VCHOMEEXTEND: case SCI_DELWORDLEFT: case SCI_DELWORDRIGHT: + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: break; // Filter out all others (display changes, etc) @@ -1712,6 +1780,60 @@ void Editor::PageMove(int direction, bool extend) { } } +void Editor::ChangeCaseOfSelection(bool makeUpperCase) { + pdoc->BeginUndoAction(); + int startCurrent = currentPos; + int startAnchor = anchor; + if (selType == selRectangle) { + int lineStart = pdoc->LineFromPosition(SelectionStart()); + int lineEnd = pdoc->LineFromPosition(SelectionEnd()); + for (int line=lineEnd; line >= lineStart; line--) { + pdoc->ChangeCase( + Range(SelectionStart(line), SelectionEnd(line)), + makeUpperCase); + } + // Would be nicer to keep the rectangular selection but this is complex + selType = selStream; + SetSelection(startCurrent, startCurrent); + } else { + pdoc->ChangeCase(Range(SelectionStart(), SelectionEnd()), + makeUpperCase); + SetSelection(startCurrent, startAnchor); + } + pdoc->EndUndoAction(); +} + + +void Editor::LineTranspose() { + int line = pdoc->LineFromPosition(currentPos); + if (line > 0) { + int startPrev = pdoc->LineStart(line-1); + int endPrev = pdoc->LineEnd(line-1); + int start = pdoc->LineStart(line); + int end = pdoc->LineEnd(line); + int startNext = pdoc->LineStart(line+1); + if (end < pdoc->Length()) { + end = startNext; + char *thisLine = CopyRange(start, end); + pdoc->DeleteChars(start, end-start); + pdoc->InsertString(startPrev, thisLine, end-start); + MovePositionTo(startPrev+end-start); + delete []thisLine; + } else { + // Last line so line has no line end + char *thisLine = CopyRange(start, end); + char *prevEnd = CopyRange(endPrev, start); + pdoc->DeleteChars(endPrev, end-endPrev); + pdoc->InsertString(startPrev, thisLine, end-start); + pdoc->InsertString(startPrev + end-start, prevEnd, start-endPrev); + MovePositionTo(startPrev + end-endPrev); + delete []thisLine; + delete []prevEnd; + } + + } +} + int Editor::KeyCommand(UINT iMessage) { Point pt = LocationFromPosition(currentPos); @@ -1724,6 +1846,10 @@ int Editor::KeyCommand(UINT iMessage) { MovePositionTo(PositionFromLocation( Point(lastXChosen, pt.y + vs.lineHeight)), true); break; + case SCI_LINESCROLLDOWN: + ScrollTo(topLine + 1); + MoveCaretInsideView(); + break; case SCI_LINEUP: MovePositionTo(PositionFromLocation( Point(lastXChosen, pt.y - vs.lineHeight))); @@ -1732,6 +1858,10 @@ int Editor::KeyCommand(UINT iMessage) { MovePositionTo(PositionFromLocation( Point(lastXChosen, pt.y - vs.lineHeight)), true); break; + case SCI_LINESCROLLUP: + ScrollTo(topLine - 1); + MoveCaretInsideView(); + break; case SCI_CHARLEFT: if (SelectionEmpty()) { MovePositionTo(MovePositionSoVisible(currentPos - 1, -1)); @@ -1827,6 +1957,7 @@ int Editor::KeyCommand(UINT iMessage) { break; case SCI_DELETEBACK: DelCharBack(); + SetLastXChosen(); EnsureCaretVisible(); break; case SCI_TAB: @@ -1879,13 +2010,46 @@ int Editor::KeyCommand(UINT iMessage) { int startWord = pdoc->NextWordStart(currentPos, -1); pdoc->DeleteChars(startWord, currentPos - startWord); MovePositionTo(startWord); + SetLastXChosen(); } break; case SCI_DELWORDRIGHT: { int endWord = pdoc->NextWordStart(currentPos, 1); pdoc->DeleteChars(currentPos, endWord - currentPos); + MovePositionTo(currentPos); + } + break; + case SCI_LINECUT: { + int lineStart = pdoc->LineFromPosition(currentPos); + int lineEnd = pdoc->LineFromPosition(anchor); + if (lineStart > lineEnd) { + int t = lineEnd; + lineEnd = lineStart; + lineStart = t; + } + int start = pdoc->LineStart(lineStart); + int end = pdoc->LineStart(lineEnd+1); + SetSelection(start,end); + Cut(); + } + break; + case SCI_LINEDELETE: { + int line = pdoc->LineFromPosition(currentPos); + int start = pdoc->LineStart(line); + int end = pdoc->LineStart(line+1); + pdoc->DeleteChars(start, end-start); + MovePositionTo(start); } break; + case SCI_LINETRANSPOSE: + LineTranspose(); + break; + case SCI_LOWERCASE: + ChangeCaseOfSelection(false); + break; + case SCI_UPPERCASE: + ChangeCaseOfSelection(true); + break; } return 0; } @@ -2111,7 +2275,11 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul int positionWasInSelection = PositionInSelection(position); - if ((!inDragDrop) || !(0 == positionWasInSelection)) { + bool positionOnEdgeOfSelection = + (position == SelectionStart()) || (position == SelectionEnd()); + + if ((!inDragDrop) || !(0 == positionWasInSelection) || + (positionOnEdgeOfSelection && !moving)) { int selStart = SelectionStart(); int selEnd = SelectionEnd(); @@ -2510,12 +2678,13 @@ char BraceOpposite(char ch) { // TODO: should be able to extend styled region to find matching brace // TODO: may need to make DBCS safe // so should be moved into Document -int Editor::BraceMatch(int position, int maxReStyle) { +int Editor::BraceMatch(int position, int /*maxReStyle*/) { char chBrace = pdoc->CharAt(position); char chSeek = BraceOpposite(chBrace); - if (!chSeek) + if (chSeek == '\0') return - 1; - char styBrace = pdoc->StyleAt(position) & pdoc->stylingBitsMask; + char styBrace = static_cast<char>( + pdoc->StyleAt(position) & pdoc->stylingBitsMask); int direction = -1; if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<') direction = 1; @@ -2523,7 +2692,7 @@ int Editor::BraceMatch(int position, int maxReStyle) { position = position + direction; while ((position >= 0) && (position < pdoc->Length())) { char chAtPos = pdoc->CharAt(position); - char styAtPos = pdoc->StyleAt(position) & pdoc->stylingBitsMask; + char styAtPos = static_cast<char>(pdoc->StyleAt(position) & pdoc->stylingBitsMask); if ((position > pdoc->GetEndStyled()) || (styAtPos == styBrace)) { if (chAtPos == chBrace) depth++; @@ -2566,6 +2735,10 @@ void Editor::SetDocPointer(Document *document) { pdoc = document; } pdoc->AddRef(); + // Reset the contraction state to fully shown. + cs.Clear(); + cs.InsertLines(0, pdoc->LinesTotal()-1); + pdoc->AddWatcher(this, 0); Redraw(); SetScrollBars(); @@ -2628,6 +2801,11 @@ void Editor::EnsureLineVisible(int line) { } } +static bool ValidMargin(WPARAM wParam) { + return wParam < ViewStyle::margins; +} + + LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { //Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam); @@ -2680,6 +2858,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case WM_PASTE: Paste(); SetLastXChosen(); + EnsureCaretVisible(); break; case WM_CLEAR: @@ -2734,19 +2913,20 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { // EM_GETPUNCTUATION // EM_SETPUNCTUATION // EM_GETTHUMB + // EM_SETTARGETDEVICE // Not supported but should be: // EM_GETEVENTMASK // EM_SETEVENTMASK // For printing: // EM_DISPLAYBAND - // EM_SETTARGETDEVICE case EM_CANUNDO: return pdoc->CanUndo() ? TRUE : FALSE; case EM_UNDO: Undo(); + SetLastXChosen(); break; case EM_EMPTYUNDOBUFFER: @@ -2782,12 +2962,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case EM_GETMODIFY: return !pdoc->IsSavePoint(); - case EM_SETMODIFY: - // Not really supported now that there is the save point stuff - //pdoc->isModified = wParam; - //return pdoc->isModified; - return false; - case EM_GETRECT: if (lParam == 0) return 0; @@ -2851,22 +3025,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { return iChar; } - case EM_GETWORDBREAKPROC: - return 0; - - case EM_SETWORDBREAKPROC: - break; - - case EM_LIMITTEXT: - // wParam holds the number of characters control should be limited to - break; - - case EM_GETLIMITTEXT: - return 0xffffffff; - - case EM_GETOLEINTERFACE: - return 0; - case EM_LINEFROMCHAR: if (static_cast<int>(wParam) < 0) wParam = SelectionStart(); @@ -2936,9 +3094,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { pdoc->SetReadOnly(wParam); return TRUE; - case EM_SETRECT: - break; - case EM_CANPASTE: return 1; @@ -3061,7 +3216,8 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { #ifdef INCLUDE_DEPRECATED_FEATURES case SCI_APPENDUNDOSTARTACTION: - pdoc->AppendUndoStartAction(); + // Not just deprecated - now dead + //pdoc->AppendUndoStartAction(); return 0; #endif @@ -3189,11 +3345,11 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { break; case SCI_STARTSTYLING: - pdoc->StartStyling(wParam, lParam); + pdoc->StartStyling(wParam, static_cast<char>(lParam)); break; case SCI_SETSTYLING: - pdoc->SetStyleFor(wParam, lParam); + pdoc->SetStyleFor(wParam, static_cast<char>(lParam)); break; case SCI_SETSTYLINGEX: // Specify a complete styling buffer @@ -3221,6 +3377,44 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { InvalidateStyleRedraw(); break; + case SCI_GETTABWIDTH: + return pdoc->tabInChars; + + case SCI_SETINDENT: + pdoc->indentInChars = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETINDENT: + return pdoc->indentInChars; + + case SCI_SETUSETABS: + pdoc->useTabs = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETUSETABS: + return pdoc->useTabs; + + case SCI_SETLINEINDENTATION: + pdoc->SetLineIndentation(wParam, lParam); + break; + + case SCI_GETLINEINDENTATION: + return pdoc->GetLineIndentation(wParam); + + case SCI_GETLINEINDENTPOSITION: + return pdoc->GetLineIndentPosition(wParam); + + case SCI_SETHSCROLLBAR : + horizontalScrollBarVisible = wParam; + SetScrollBars(); + ReconfigureScrollBars(); + break; + + case SCI_GETHSCROLLBAR: + return horizontalScrollBarVisible; + case SCI_SETCODEPAGE: pdoc->dbcsCodePage = wParam; break; @@ -3260,18 +3454,15 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { break; case SCI_MARKERADD: { int markerID = pdoc->AddMark(wParam, lParam); - RedrawSelMargin(); return markerID; } case SCI_MARKERDELETE: pdoc->DeleteMark(wParam, lParam); - RedrawSelMargin(); break; case SCI_MARKERDELETEALL: pdoc->DeleteAllMarks(static_cast<int>(wParam)); - RedrawSelMargin(); break; case SCI_MARKERGET: @@ -3295,53 +3486,53 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { return -1; case SCI_SETMARGINTYPEN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].symbol = (lParam == SC_MARGIN_SYMBOL); InvalidateStyleRedraw(); } break; case SCI_GETMARGINTYPEN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].symbol ? SC_MARGIN_SYMBOL : SC_MARGIN_NUMBER; else return 0; case SCI_SETMARGINWIDTHN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].width = lParam; InvalidateStyleRedraw(); } break; case SCI_GETMARGINWIDTHN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].width; else return 0; case SCI_SETMARGINMASKN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].mask = lParam; InvalidateStyleRedraw(); } break; case SCI_GETMARGINMASKN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].mask; else return 0; case SCI_SETMARGINSENSITIVEN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].sensitive = lParam; InvalidateStyleRedraw(); } break; case SCI_GETMARGINSENSITIVEN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].sensitive ? 1 : 0; else return 0; @@ -3391,7 +3582,19 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { if (lParam == 0) return 0; if (wParam <= STYLE_MAX) { - strcpy(vs.styles[wParam].fontName, reinterpret_cast<char *>(lParam)); + vs.SetStyleFontName(wParam, reinterpret_cast<const char *>(lParam)); + InvalidateStyleRedraw(); + } + break; + case SCI_STYLESETUNDERLINE: + if (wParam <= STYLE_MAX) { + vs.styles[wParam].underline = lParam; + InvalidateStyleRedraw(); + } + break; + case SCI_STYLESETCHARACTERSET: + if (wParam <= STYLE_MAX) { + vs.styles[wParam].characterSet = lParam; InvalidateStyleRedraw(); } break; @@ -3400,7 +3603,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { vs.ResetDefaultStyle(); InvalidateStyleRedraw(); break; - case SCI_SETSTYLEBITS: pdoc->SetStylingBits(wParam); break; @@ -3485,14 +3687,20 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_SEARCHNEXT: case SCI_SEARCHPREV: return SearchText(iMessage, wParam, lParam); - break; case SCI_SETCARETPOLICY: caretPolicy = wParam; caretSlop = lParam; break; -#ifdef INCLUDE_DEPRECATED_FEATURES + case SCI_LINESONSCREEN: + return LinesOnScreen(); + + case SCI_USEPOPUP: + displayPopupMenu = wParam; + break; + + #ifdef INCLUDE_DEPRECATED_FEATURES case SCI_SETFORE: vs.styles[STYLE_DEFAULT].fore.desired = Colour(wParam); InvalidateStyleRedraw(); @@ -3612,6 +3820,13 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_ZOOMOUT: case SCI_DELWORDLEFT: case SCI_DELWORDRIGHT: + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: + case SCI_LINESCROLLDOWN: + case SCI_LINESCROLLUP: return KeyCommand(iMessage); case SCI_BRACEHIGHLIGHT: @@ -3635,6 +3850,14 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { Redraw(); break; + case SCI_SETZOOM: + vs.zoomLevel = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETZOOM: + return vs.zoomLevel; + case SCI_GETEDGECOLUMN: return theEdge; @@ -3666,6 +3889,14 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { SetDocPointer(reinterpret_cast<Document *>(lParam)); return 0; + case SCI_ADDREFDOC: + (reinterpret_cast<Document *>(lParam))->AddRef(); + break; + + case SCI_RELEASEDOC: + (reinterpret_cast<Document *>(lParam))->Release(); + break; + case SCI_SETMODEVENTMASK: modEventMask = wParam; return 0; @@ -3675,6 +3906,9 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { SetSelection(currentPos, anchor); // Ensure selection inside document return 0; + case SCI_SELECTIONISRECTANGLE: + return (selType == selRectangle) ? 1 : 0; + #ifdef MACRO_SUPPORT case SCI_STARTRECORD: recordingMacro = 1; diff --git a/contrib/src/stc/scintilla/src/Editor.h b/contrib/src/stc/scintilla/src/Editor.h index 4ff334767a..808a656be1 100644 --- a/contrib/src/stc/scintilla/src/Editor.h +++ b/contrib/src/stc/scintilla/src/Editor.h @@ -38,6 +38,9 @@ public: }; class Editor : public DocWatcher { + // Private so Editor objects can not be copied + Editor(const Editor &) : DocWatcher() {} + Editor &operator=(const Editor &) { return *this; } protected: // ScintillaBase subclass needs access to much of Editor // On GTK+, Scintilla is a container widget holding two scroll bars and a drawing area @@ -61,13 +64,14 @@ protected: // ScintillaBase subclass needs access to much of Editor int xOffset; // Horizontal scrolled amount in pixels int xCaretMargin; // Ensure this many pixels visible on both sides of caret + bool horizontalScrollBarVisible; Surface pixmapLine; Surface pixmapSelMargin; Surface pixmapSelPattern; // Intellimouse support - currently only implemented for Windows unsigned int ucWheelScrollLines; - short cWheelDelta; //wheel delta from roll + int cWheelDelta; //wheel delta from roll KeyMap kmap; @@ -116,6 +120,8 @@ protected: // ScintillaBase subclass needs access to much of Editor int searchAnchor; + int displayPopupMenu; + #ifdef MACRO_SUPPORT int recordingMacro; #endif @@ -169,6 +175,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void ScrollTo(int line); virtual void ScrollText(int linesToMove); void HorizontalScrollTo(int xPos); + void MoveCaretInsideView(); void EnsureCaretVisible(bool useMargin=true); void ShowCaretAtCurrentPosition(); void DropCaret(); @@ -184,10 +191,12 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void SetVerticalScrollPos() = 0; virtual void SetHorizontalScrollPos() = 0; virtual bool ModifyScrollBars(int nMax, int nPage) = 0; + virtual void ReconfigureScrollBars(); void SetScrollBarsTo(PRectangle rsClient); void SetScrollBars(); - virtual void AddChar(char ch); + void AddChar(char ch); + virtual void AddCharUTF(char *s, unsigned int len); void ClearSelection(); void ClearAll(); void Cut(); @@ -205,7 +214,7 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void NotifyChange() = 0; virtual void NotifyFocus(bool focus); virtual void NotifyParent(SCNotification scn) = 0; - virtual void NotifyStyleNeeded(int endStyleNeeded); + virtual void NotifyStyleToNeeded(int endStyleNeeded); void NotifyChar(char ch); void NotifySavePoint(bool isSavePoint); void NotifyModifyAttempt(); @@ -218,12 +227,16 @@ protected: // ScintillaBase subclass needs access to much of Editor void NotifySavePoint(Document *document, void *userData, bool atSavePoint); void NotifyModified(Document *document, DocModification mh, void *userData); void NotifyDeleted(Document *document, void *userData); + void NotifyStyleNeeded(Document *doc, void *userData, int endPos); + #ifdef MACRO_SUPPORT void NotifyMacroRecord(UINT iMessage, WPARAM wParam, LPARAM lParam); #endif void PageMove(int direction, bool extend=false); + void ChangeCaseOfSelection(bool makeUpperCase); + void LineTranspose(); virtual int KeyCommand(UINT iMessage); virtual int KeyDefault(int /* key */, int /*modifiers*/); int KeyDown(int key, bool shift, bool ctrl, bool alt); diff --git a/contrib/src/stc/scintilla/src/Indicator.cxx b/contrib/src/stc/scintilla/src/Indicator.cxx index fb6ad09157..05bdf66b53 100644 --- a/contrib/src/stc/scintilla/src/Indicator.cxx +++ b/contrib/src/stc/scintilla/src/Indicator.cxx @@ -37,6 +37,22 @@ void Indicator::Draw(Surface *surface, PRectangle &rc) { surface->MoveTo(x-3, ymid); surface->LineTo(x-3, ymid+2); } + } else if (style == INDIC_DIAGONAL) { + int x = rc.left; + while (x < rc.right) { + surface->MoveTo(x, rc.top+2); + int endX = x+3; + int endY = rc.top - 1; + if (endX > rc.right) { + endY += endX - rc.right; + endX = rc.right; + } + surface->LineTo(endX, endY); + x += 4; + } + } else if (style == INDIC_STRIKE) { + surface->MoveTo(rc.left, rc.top - 4); + surface->LineTo(rc.right, rc.top - 4); } else { // Either INDIC_PLAIN or unknown surface->MoveTo(rc.left, ymid); surface->LineTo(rc.right, ymid); diff --git a/contrib/src/stc/scintilla/src/KeyMap.cxx b/contrib/src/stc/scintilla/src/KeyMap.cxx index f339cd2750..3a6a31f974 100644 --- a/contrib/src/stc/scintilla/src/KeyMap.cxx +++ b/contrib/src/stc/scintilla/src/KeyMap.cxx @@ -61,51 +61,59 @@ UINT KeyMap::Find(int key, int modifiers) { } KeyToCommand KeyMap::MapDefault[] = { - VK_DOWN, SCI_NORM, SCI_LINEDOWN, - VK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND, - VK_UP, SCI_NORM, SCI_LINEUP, - VK_UP, SCI_SHIFT, SCI_LINEUPEXTEND, - VK_LEFT, SCI_NORM, SCI_CHARLEFT, - VK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND, - VK_LEFT, SCI_CTRL, SCI_WORDLEFT, - VK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND, - VK_RIGHT, SCI_NORM, SCI_CHARRIGHT, - VK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND, - VK_RIGHT, SCI_CTRL, SCI_WORDRIGHT, - VK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND, - VK_HOME, SCI_NORM, SCI_VCHOME, - VK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND, - VK_HOME, SCI_CTRL, SCI_DOCUMENTSTART, - VK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND, - VK_END, SCI_NORM, SCI_LINEEND, - VK_END, SCI_SHIFT, SCI_LINEENDEXTEND, - VK_END, SCI_CTRL, SCI_DOCUMENTEND, - VK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND, - VK_PRIOR, SCI_NORM, SCI_PAGEUP, - VK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND, - VK_NEXT, SCI_NORM, SCI_PAGEDOWN, - VK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND, - VK_DELETE, SCI_NORM, WM_CLEAR, - VK_DELETE, SCI_SHIFT, WM_CUT, - VK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT, - VK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE, - VK_INSERT, SCI_SHIFT, WM_PASTE, - VK_INSERT, SCI_CTRL, WM_COPY, - VK_ESCAPE, SCI_NORM, SCI_CANCEL, - VK_BACK, SCI_NORM, SCI_DELETEBACK, - VK_BACK, SCI_CTRL, SCI_DELWORDLEFT, - 'Z', SCI_CTRL, WM_UNDO, - 'Y', SCI_CTRL, SCI_REDO, - 'X', SCI_CTRL, WM_CUT, - 'C', SCI_CTRL, WM_COPY, - 'V', SCI_CTRL, WM_PASTE, - 'A', SCI_CTRL, SCI_SELECTALL, - VK_TAB, SCI_NORM, SCI_TAB, - VK_TAB, SCI_SHIFT, SCI_BACKTAB, - VK_RETURN, SCI_NORM, SCI_NEWLINE, - 'L', SCI_CTRL, SCI_FORMFEED, - VK_ADD, SCI_CTRL, SCI_ZOOMIN, - VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT, - 0,0,0, + {VK_DOWN, SCI_NORM, SCI_LINEDOWN}, + {VK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND}, + {VK_DOWN, SCI_CTRL, SCI_LINESCROLLDOWN}, + {VK_UP, SCI_NORM, SCI_LINEUP}, + {VK_UP, SCI_SHIFT, SCI_LINEUPEXTEND}, + {VK_UP, SCI_CTRL, SCI_LINESCROLLUP}, + {VK_LEFT, SCI_NORM, SCI_CHARLEFT}, + {VK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND}, + {VK_LEFT, SCI_CTRL, SCI_WORDLEFT}, + {VK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND}, + {VK_RIGHT, SCI_NORM, SCI_CHARRIGHT}, + {VK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND}, + {VK_RIGHT, SCI_CTRL, SCI_WORDRIGHT}, + {VK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND}, + {VK_HOME, SCI_NORM, SCI_VCHOME}, + {VK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND}, + {VK_HOME, SCI_CTRL, SCI_DOCUMENTSTART}, + {VK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, + {VK_END, SCI_NORM, SCI_LINEEND}, + {VK_END, SCI_SHIFT, SCI_LINEENDEXTEND}, + {VK_END, SCI_CTRL, SCI_DOCUMENTEND}, + {VK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, + {VK_PRIOR, SCI_NORM, SCI_PAGEUP}, + {VK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND}, + {VK_NEXT, SCI_NORM, SCI_PAGEDOWN}, + {VK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND}, + {VK_DELETE, SCI_NORM, WM_CLEAR}, + {VK_DELETE, SCI_SHIFT, WM_CUT}, + {VK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT}, + {VK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE}, + {VK_INSERT, SCI_SHIFT, WM_PASTE}, + {VK_INSERT, SCI_CTRL, WM_COPY}, + {VK_ESCAPE, SCI_NORM, SCI_CANCEL}, + {VK_BACK, SCI_NORM, SCI_DELETEBACK}, + {VK_BACK, SCI_CTRL, SCI_DELWORDLEFT}, + {'Z', SCI_CTRL, WM_UNDO}, + {'Y', SCI_CTRL, SCI_REDO}, + {'X', SCI_CTRL, WM_CUT}, + {'C', SCI_CTRL, WM_COPY}, + {'V', SCI_CTRL, WM_PASTE}, + {'A', SCI_CTRL, SCI_SELECTALL}, + {VK_TAB, SCI_NORM, SCI_TAB}, + {VK_TAB, SCI_SHIFT, SCI_BACKTAB}, + {VK_RETURN, SCI_NORM, SCI_NEWLINE}, + {VK_ADD, SCI_CTRL, SCI_ZOOMIN}, + {VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT}, + {VK_DIVIDE, SCI_CTRL, SCI_SETZOOM}, + //'L', SCI_CTRL, SCI_FORMFEED, + {'L', SCI_CTRL, SCI_LINECUT}, + {'L', SCI_CSHIFT, SCI_LINEDELETE}, + {'T', SCI_CTRL, SCI_LINETRANSPOSE}, + {'U', SCI_CTRL, SCI_LOWERCASE}, + {'U', SCI_CSHIFT, SCI_UPPERCASE}, + {0,0,0}, }; diff --git a/contrib/src/stc/scintilla/src/KeyMap.h b/contrib/src/stc/scintilla/src/KeyMap.h index 814f3aa3b7..bc435e1970 100644 --- a/contrib/src/stc/scintilla/src/KeyMap.h +++ b/contrib/src/stc/scintilla/src/KeyMap.h @@ -11,6 +11,7 @@ #define SCI_CTRL LEFT_CTRL_PRESSED #define SCI_ALT LEFT_ALT_PRESSED #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT) +#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT) class KeyToCommand { public: diff --git a/contrib/src/stc/scintilla/src/KeyWords.cxx b/contrib/src/stc/scintilla/src/KeyWords.cxx index 20f6762470..113ba222df 100644 --- a/contrib/src/stc/scintilla/src/KeyWords.cxx +++ b/contrib/src/stc/scintilla/src/KeyWords.cxx @@ -17,2201 +17,29 @@ #include "Scintilla.h" #include "SciLexer.h" -inline bool IsLeadByte(int codePage, char ch) { -#if PLAT_GTK - // TODO: support DBCS under GTK+ - return false; -#elif PLAT_WIN - return codePage && IsDBCSLeadByteEx(codePage, ch); -#elif PLAT_WX - return false; -#endif -} - -inline bool iswordchar(char ch) { - return isalnum(ch) || ch == '.' || ch == '_'; -} - -inline bool iswordstart(char ch) { - return isalnum(ch) || ch == '_'; -} - -enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8}; - -static int IndentAmount(StylingContext &styler, int line, int *flags) { - int end = styler.Length(); - int spaceFlags = 0; - - // Determines the indentation level of the current line and also checks for consistent - // indentation compared to the previous line. - // Indentation is judged consistent when the indentation whitespace of each line lines - // the same or the indentation of one line is a prefix of the other. - - int pos = styler.LineStart(line); - char ch = styler[pos]; - int indent = 0; - bool inPrevPrefix = line > 0; - int posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0; - while ((ch == ' ' || ch == '\t') && (pos < end)) { - if (inPrevPrefix) { - char chPrev = styler[posPrev++]; - if (chPrev == ' ' || chPrev == '\t') { - if (chPrev != ch) - spaceFlags |= wsInconsistent; - } else { - inPrevPrefix = false; - } - } - if (ch == ' ') { - spaceFlags |= wsSpace; - indent++; - } else { // Tab - spaceFlags |= wsTab; - if (spaceFlags & wsSpace) - spaceFlags |= wsSpaceTab; - indent = (indent / 8 + 1) * 8; - } - ch = styler[++pos]; - } - - *flags = spaceFlags; - indent += SC_FOLDLEVELBASE; - if (isspace(ch)) // Completely empty line - return indent | SC_FOLDLEVELWHITEFLAG; - else - return indent; -} - -inline bool isoperator(char ch) { - if (isalnum(ch)) - return false; - // '.' left out as it is used to make up numbers - if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || - ch == '(' || ch == ')' || ch == '-' || ch == '+' || - ch == '=' || ch == '|' || ch == '{' || ch == '}' || - ch == '[' || ch == ']' || ch == ':' || ch == ';' || - ch == '<' || ch == '>' || ch == ',' || ch == '/' || - ch == '?' || ch == '!' || ch == '.' || ch == '~') - return true; - return false; -} - -static void classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_C_IDENTIFIER; - if (wordIsNumber) - chAttr = SCE_C_NUMBER; - else { - if (keywords.InList(s)) - chAttr = SCE_C_WORD; - } - styler.ColourSegment(start, end, chAttr); -} - -static void ColouriseCppDoc(int codePage, int startPos, int length, - int initStyle, WordList &keywords, StylingContext &styler) { - - bool fold = styler.GetPropSet().GetInt("fold"); - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - - int state = initStyle; - char chPrev = ' '; - char chNext = styler[startPos]; - int startSeg = startPos; - int lengthDoc = startPos + length; - int visChars = 0; - for (unsigned int i = startPos; i <= lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if ((fold) && ((ch == '\r' && chNext != '\n') || (ch == '\n'))) { - int lev = levelPrev; - if (visChars == 0) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - styler.SetLevel(lineCurrent, lev); - lineCurrent++; - visChars = 0; - levelPrev = levelCurrent; - } - if (!isspace(ch)) - visChars++; - - if (IsLeadByte(codePage, ch)) { // dbcs - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - i += 1; - continue; - } - - if (state == SCE_C_STRINGEOL) { - if (ch != '\r' && ch != '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_DEFAULT; - startSeg = i; - } - } - if (state == SCE_C_DEFAULT) { - if (iswordstart(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_WORD; - startSeg = i; - } else if (ch == '/' && chNext == '*') { - styler.ColourSegment(startSeg, i - 1, state); - if (styler.SafeGetCharAt(i + 2) == '*') - state = SCE_C_COMMENTDOC; - else - state = SCE_C_COMMENT; - startSeg = i; - } else if (ch == '/' && chNext == '/') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_COMMENTLINE; - startSeg = i; - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_STRING; - startSeg = i; - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_CHARACTER; - startSeg = i; - } else if (ch == '#') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_PREPROCESSOR; - startSeg = i; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - styler.ColourSegment(i, i, SCE_C_OPERATOR); - startSeg = i + 1; - if ((ch == '{') || (ch == '}')) { - levelCurrent += (ch == '{') ? 1 : -1; - } - } - } else if (state == SCE_C_WORD) { - if (!iswordchar(ch)) { - classifyWordCpp(startSeg, i - 1, keywords, styler); - state = SCE_C_DEFAULT; - startSeg = i; - if (ch == '/' && chNext == '*') { - if (styler.SafeGetCharAt(i + 2) == '*') - state = SCE_C_COMMENTDOC; - else - state = SCE_C_COMMENT; - } else if (ch == '/' && chNext == '/') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_C_STRING; - } else if (ch == '\'') { - state = SCE_C_CHARACTER; - } else if (ch == '#') { - state = SCE_C_PREPROCESSOR; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_C_OPERATOR); - startSeg = i + 1; - if ((ch == '{') || (ch == '}')) { - levelCurrent += (ch == '{') ? 1 : -1; - } - } - } - } else { - if (state == SCE_C_PREPROCESSOR) { - if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_DEFAULT; - startSeg = i; - } - } else if (state == SCE_C_COMMENT) { - if (ch == '/' && chPrev == '*' && ( - (i > startSeg + 2) || ((initStyle == SCE_C_COMMENT) && (startSeg == startPos)))) { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - startSeg = i + 1; - } - } else if (state == SCE_C_COMMENTDOC) { - if (ch == '/' && chPrev == '*' && ( - (i > startSeg + 3) || ((initStyle == SCE_C_COMMENTDOC) && (startSeg == startPos)))) { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - startSeg = i + 1; - } - } else if (state == SCE_C_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_DEFAULT; - startSeg = i; - } - } else if (state == SCE_C_STRING) { - if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_STRINGEOL; - startSeg = i; - } else if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } else if (state == SCE_C_CHARACTER) { - if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_STRINGEOL; - startSeg = i; - } else if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } - if (state == SCE_C_DEFAULT) { // One of the above succeeded - if (ch == '/' && chNext == '*') { - if (styler.SafeGetCharAt(i + 2) == '*') - state = SCE_C_COMMENTDOC; - else - state = SCE_C_COMMENT; - } else if (ch == '/' && chNext == '/') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_C_STRING; - } else if (ch == '\'') { - state = SCE_C_CHARACTER; - } else if (ch == '#') { - state = SCE_C_PREPROCESSOR; - } else if (iswordstart(ch)) { - state = SCE_C_WORD; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_C_OPERATOR); - startSeg = i + 1; - if ((ch == '{') || (ch == '}')) { - levelCurrent += (ch == '{') ? 1 : -1; - } - } - } - } - chPrev = ch; - } - if (startSeg < lengthDoc) - styler.ColourSegment(startSeg, lengthDoc - 1, state); - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - if (fold) { - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - //styler.SetLevel(lineCurrent, levelCurrent | flagsNext); - styler.SetLevel(lineCurrent, levelPrev | flagsNext); - - } -} - -inline bool isPerlOperator(char ch) { - if (isalnum(ch)) - return false; - // '.' left out as it is used to make up numbers - if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '\\' || - ch == '(' || ch == ')' || ch == '-' || ch == '+' || - ch == '=' || ch == '|' || ch == '{' || ch == '}' || - ch == '[' || ch == ']' || ch == ':' || ch == ';' || - ch == '<' || ch == '>' || ch == ',' || ch == '/' || - ch == '?' || ch == '!' || ch == '.' || ch == '~') - return true; - return false; -} - -static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_PL_IDENTIFIER; - if (wordIsNumber) - chAttr = SCE_PL_NUMBER; - else { - if (keywords.InList(s)) - chAttr = SCE_PL_WORD; - } - styler.ColourSegment(start, end, chAttr); - return chAttr; -} - -static bool isEndVar(char ch) { - return !isalnum(ch) && ch != '#' && ch != '$' && - ch != '_' && ch != '\''; -} - -static bool isMatch(StylingContext &styler, int lengthDoc, int pos, const char *val) { - if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) { - return false; - } - while (*val) { - if (*val != styler[pos++]) { - return false; - } - val++; - } - return true; -} - -static bool isOKQuote(char ch) { - if (isalnum(ch)) - return false; - if (isspace(ch)) - return false; - if (iscntrl(ch)) - return false; - return true; -} - -static char opposite(char ch) { - if (ch == '(') - return ')'; - if (ch == '[') - return ']'; - if (ch == '{') - return '}'; - if (ch == '<') - return '>'; - return ch; -} - -static void ColourisePerlDoc(int codePage, int startPos, int length, int initStyle, - WordList &keywords, StylingContext &styler) { - char sooked[100]; - int quotes = 0; - char quoteDown = 'd'; - char quoteUp = 'd'; - int quoteRep = 1; - int sookedpos = 0; - bool preferRE = true; - sooked[sookedpos] = '\0'; - int state = initStyle; - int lengthDoc = startPos + length; - // If in a long distance lexical state, seek to the beginning to find quote characters - if (state == SCE_PL_HERE || state == SCE_PL_REGEX || - state == SCE_PL_REGSUBST || state == SCE_PL_LONGQUOTE) { - while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) { - startPos--; - } - state = SCE_PL_DEFAULT; - } - styler.StartAt(startPos); - char chPrev = ' '; - char chNext = styler[startPos]; - int startSeg = startPos; - for (int i = startPos; i <= lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - char chNext2 = styler.SafeGetCharAt(i + 2); - - if (IsLeadByte(codePage, ch)) { // dbcs - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - i += 1; - continue; - } - - if (state == SCE_PL_DEFAULT) { - if (iswordstart(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - if (ch == 's' && !isalnum(chNext)) { - state = SCE_PL_REGSUBST; - quotes = 0; - quoteUp = '\0'; - quoteDown = '\0'; - quoteRep = 2; - startSeg = i; - } else if (ch == 'm' && !isalnum(chNext)) { - state = SCE_PL_REGEX; - quotes = 0; - quoteUp = '\0'; - quoteDown = '\0'; - quoteRep = 1; - startSeg = i; - } else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) { - state = SCE_PL_REGSUBST; - quotes = 0; - quoteUp = '\0'; - quoteDown = '\0'; - quoteRep = 2; - startSeg = i; - i++; - chNext = chNext2; - } else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) { - state = SCE_PL_LONGQUOTE; - startSeg = i; - i++; - chNext = chNext2; - quotes = 0; - quoteUp = '\0'; - quoteDown = '\0'; - quoteRep = 1; - } else { - state = SCE_PL_WORD; - startSeg = i; - preferRE = false; - } - } else if (ch == '#') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_COMMENTLINE; - startSeg = i; - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_STRING; - startSeg = i; - } else if (ch == '\'') { - if (chPrev == '&') { - // Archaic call - styler.ColourSegment(i, i, state); - startSeg = i + 1; - } else { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_CHARACTER; - startSeg = i; - } - } else if (ch == '`') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_BACKTICKS; - startSeg = i; - } else if (ch == '$') { - preferRE = false; - styler.ColourSegment(startSeg, i - 1, state); - if (isalnum(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { - state = SCE_PL_SCALAR; - startSeg = i; - } else if (chNext != '{' && chNext != '[') { - styler.ColourSegment(i - 1, i, SCE_PL_SCALAR); - i++; - startSeg = i + 1; - ch = ' '; - chNext = ' '; - } else { - styler.ColourSegment(i, i, SCE_PL_SCALAR); - startSeg = i + 1; - } - } else if (ch == '@') { - preferRE = false; - styler.ColourSegment(startSeg, i - 1, state); - if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { - state = SCE_PL_ARRAY; - startSeg = i; - } else if (chNext != '{' && chNext != '[') { - styler.ColourSegment(i - 1, i, SCE_PL_ARRAY); - i++; - startSeg = i + 1; - ch = ' '; - } else { - styler.ColourSegment(i, i, SCE_PL_ARRAY); - startSeg = i + 1; - } - } else if (ch == '%') { - preferRE = false; - styler.ColourSegment(startSeg, i - 1, state); - if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { - state = SCE_PL_HASH; - startSeg = i; - } else if (chNext != '{' && chNext != '[') { - styler.ColourSegment(i - 1, i, SCE_PL_HASH); - i++; - startSeg = i + 1; - ch = ' '; - } else { - styler.ColourSegment(i, i, SCE_PL_HASH); - startSeg = i + 1; - } - } else if (ch == '*') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_SYMBOLTABLE; - startSeg = i; - } else if (ch == '/' && preferRE) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_REGEX; - quoteUp = '/'; - quoteDown = '/'; - quotes = 1; - quoteRep = 1; - startSeg = i; - } else if (ch == '<' && chNext == '<') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_HERE; - startSeg = i; - i++; - ch = chNext; - chNext = chNext2; - quotes = 0; - sookedpos = 0; - sooked[sookedpos] = '\0'; - } else if (ch == '=' && isalpha(chNext)) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_POD; - startSeg = i; - quotes = 0; - sookedpos = 0; - sooked[sookedpos] = '\0'; - } else if (isPerlOperator(ch)) { - if (ch == ')' || ch == ']') - preferRE = false; - else - preferRE = true; - styler.ColourSegment(startSeg, i - 1, state); - styler.ColourSegment(i, i, SCE_PL_OPERATOR); - startSeg = i + 1; - } - } else if (state == SCE_PL_WORD) { - if (!iswordchar(ch) && ch != '\'') { // Archaic Perl has quotes inside names - if (isMatch(styler, lengthDoc, startSeg, "__DATA__")) { - styler.ColourSegment(startSeg, i, SCE_PL_DATASECTION); - state = SCE_PL_DATASECTION; - } else if (isMatch(styler, lengthDoc, startSeg, "__END__")) { - styler.ColourSegment(startSeg, i, SCE_PL_DATASECTION); - state = SCE_PL_DATASECTION; - } else { - if (classifyWordPerl(startSeg, i - 1, keywords, styler) == SCE_PL_WORD) - preferRE = true; - state = SCE_PL_DEFAULT; - startSeg = i; - if (ch == '#') { - state = SCE_PL_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_PL_STRING; - } else if (ch == '\'') { - state = SCE_PL_CHARACTER; - } else if (ch == '<' && chNext == '<') { - state = SCE_PL_HERE; - quotes = 0; - startSeg = i; - sookedpos = 0; - sooked[sookedpos] = '\0'; - } else if (isPerlOperator(ch)) { - if (ch == ')' || ch == ']') - preferRE = false; - else - preferRE = true; - styler.ColourSegment(startSeg, i, SCE_PL_OPERATOR); - state = SCE_PL_DEFAULT; - startSeg = i + 1; - } - } - } - } else { - if (state == SCE_PL_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_DEFAULT; - startSeg = i; - } - } else if (state == SCE_PL_HERE) { - if (isalnum(ch) && quotes < 2) { - sooked[sookedpos++] = ch; - sooked[sookedpos] = '\0'; - if (quotes == 0) - quotes = 1; - } else { - quotes++; - } - - if (quotes > 1 && isMatch(styler, lengthDoc, i, sooked)) { - styler.ColourSegment(startSeg, i + sookedpos - 1, SCE_PL_HERE); - state = SCE_PL_DEFAULT; - i += sookedpos; - startSeg = i; - chNext = ' '; - } - } else if (state == SCE_PL_STRING) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i, state); - state = SCE_PL_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } else if (state == SCE_PL_CHARACTER) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i, state); - state = SCE_PL_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } else if (state == SCE_PL_BACKTICKS) { - if (ch == '`') { - styler.ColourSegment(startSeg, i, state); - state = SCE_PL_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } else if (state == SCE_PL_POD) { - if (ch == '=') { - if (isMatch(styler, lengthDoc, i, "=cut")) { - styler.ColourSegment(startSeg, i - 1 + 4, state); - i += 4; - startSeg = i; - state = SCE_PL_DEFAULT; - chNext = ' '; - ch = ' '; - } - } - } else if (state == SCE_PL_SCALAR) { - if (isEndVar(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - state = SCE_PL_DEFAULT; - } - } else if (state == SCE_PL_ARRAY) { - if (isEndVar(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - state = SCE_PL_DEFAULT; - } - } else if (state == SCE_PL_HASH) { - if (isEndVar(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - state = SCE_PL_DEFAULT; - } - } else if (state == SCE_PL_SYMBOLTABLE) { - if (isEndVar(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - state = SCE_PL_DEFAULT; - } - } else if (state == SCE_PL_REF) { - if (isEndVar(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - state = SCE_PL_DEFAULT; - } - } else if (state == SCE_PL_REGEX) { - if (!quoteUp && !isspace(ch)) { - quoteUp = ch; - quoteDown = opposite(ch); - quotes++; - } else { - if (ch == quoteDown && chPrev != '\\') { - quotes--; - if (quotes == 0) { - quoteRep--; - if (quoteUp == quoteDown) { - quotes++; - } - } - if (!isalpha(chNext)) { - if (quoteRep <= 0) { - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - state = SCE_PL_DEFAULT; - ch = ' '; - } - } - } else if (ch == quoteUp && chPrev != '\\') { - quotes++; - } else if (!isalpha(chNext)) { - if (quoteRep <= 0) { - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - state = SCE_PL_DEFAULT; - ch = ' '; - } - } - } - } else if (state == SCE_PL_REGSUBST) { - if (!quoteUp && !isspace(ch)) { - quoteUp = ch; - quoteDown = opposite(ch); - quotes++; - } else { - if (ch == quoteDown && chPrev != '\\') { - quotes--; - if (quotes == 0) { - quoteRep--; - } - if (!isalpha(chNext)) { - if (quoteRep <= 0) { - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - state = SCE_PL_DEFAULT; - ch = ' '; - } - } - if (quoteUp == quoteDown) { - quotes++; - } - } else if (ch == quoteUp && chPrev != '\\') { - quotes++; - } else if (!isalpha(chNext)) { - if (quoteRep <= 0) { - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - state = SCE_PL_DEFAULT; - ch = ' '; - } - } - } - } else if (state == SCE_PL_LONGQUOTE) { - if (!quoteDown && !isspace(ch)) { - quoteUp = ch; - quoteDown = opposite(quoteUp); - quotes++; - } else if (ch == quoteDown) { - quotes--; - if (quotes == 0) { - quoteRep--; - if (quoteRep <= 0) { - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - state = SCE_PL_DEFAULT; - ch = ' '; - } - if (quoteUp == quoteDown) { - quotes++; - } - } - } else if (ch == quoteUp) { - quotes++; - } - } - - if (state == SCE_PL_DEFAULT) { // One of the above succeeded - if (ch == '#') { - state = SCE_PL_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_PL_STRING; - } else if (ch == '\'') { - state = SCE_PL_CHARACTER; - } else if (iswordstart(ch)) { - state = SCE_PL_WORD; - preferRE = false; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_PL_OPERATOR); - startSeg = i + 1; - } - } - } - chPrev = ch; - } - if (startSeg < lengthDoc) - styler.ColourSegment(startSeg, lengthDoc, state); -} - - -static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); - s[i + 1] = '\0'; - } - char chAttr = SCE_C_DEFAULT; - if (wordIsNumber) - chAttr = SCE_C_NUMBER; - else { - if (keywords.InList(s)) { - chAttr = SCE_C_WORD; - if (strcmp(s, "rem") == 0) - chAttr = SCE_C_COMMENTLINE; - } - } - styler.ColourSegment(start, end, chAttr); - if (chAttr == SCE_C_COMMENTLINE) - return SCE_C_COMMENTLINE; - else - return SCE_C_DEFAULT; -} - -static void ColouriseVBDoc(int codePage, int startPos, int length, int initStyle, - WordList &keywords, StylingContext &styler) { - int state = initStyle; - char chNext = styler[startPos]; - int startSeg = startPos; - int lengthDoc = startPos + length; - for (int i = startPos; i < lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if (IsLeadByte(codePage, ch)) { // dbcs - chNext = styler.SafeGetCharAt(i + 2); - i += 1; - continue; - } - - if (state == SCE_C_DEFAULT) { - if (iswordstart(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_WORD; - startSeg = i; - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_COMMENTLINE; - startSeg = i; - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_STRING; - startSeg = i; - } - } else if (state == SCE_C_WORD) { - if (!iswordchar(ch)) { - state = classifyWordVB(startSeg, i - 1, keywords, styler); - if (state == SCE_C_DEFAULT) { - startSeg = i; - if (ch == '\'') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_C_STRING; - } - } - } - } else { - if (state == SCE_C_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_DEFAULT; - startSeg = i; - } - } else if (state == SCE_C_STRING) { - // VB doubles quotes to preserve them - if (ch == '\"') { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } - if (state == SCE_C_DEFAULT) { // One of the above succeeded - if (ch == '\'') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_C_STRING; - } else if (iswordstart(ch)) { - state = SCE_C_WORD; - } - } - } - } - if (startSeg < lengthDoc) - styler.ColourSegment(startSeg, lengthDoc, state); -} - -static void classifyWordPy(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler, char *prevWord) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_P_IDENTIFIER; - if (0 == strcmp(prevWord, "class")) - chAttr = SCE_P_CLASSNAME; - else if (0 == strcmp(prevWord, "def")) - chAttr = SCE_P_DEFNAME; - else if (wordIsNumber) - chAttr = SCE_P_NUMBER; - else if (keywords.InList(s)) - chAttr = SCE_P_WORD; - styler.ColourSegment(start, end, chAttr); - strcpy(prevWord, s); -} - -static void ColourisePyDoc(int codePage, int startPos, int length, int initStyle, WordList &keywords, StylingContext &styler) { - //Platform::DebugPrintf("Python coloured\n"); - bool fold = styler.GetPropSet().GetInt("fold"); - int whingeLevel = styler.GetPropSet().GetInt("tab.timmy.whinge.level"); - char prevWord[200]; - prevWord[0] = '\0'; - if (length == 0) - return ; - int lineCurrent = styler.GetLine(startPos); - int spaceFlags = 0; - // TODO: Need to check previous line for indentation for both folding and bad indentation - int indentCurrent = IndentAmount(styler, lineCurrent, &spaceFlags); - - int state = initStyle & 31; - char chPrev = ' '; - char chPrev2 = ' '; - char chNext = styler[startPos]; - char chNext2 = styler[startPos]; - int startSeg = startPos; - int lengthDoc = startPos + length; - bool atStartLine = true; - for (int i = startPos; i <= lengthDoc; i++) { - - if (atStartLine) { - if (whingeLevel == 1) { - styler.SetFlags((spaceFlags & wsInconsistent) ? 64 : 0, state); - } else if (whingeLevel == 2) { - styler.SetFlags((spaceFlags & wsSpaceTab) ? 64 : 0, state); - } else if (whingeLevel == 3) { - styler.SetFlags((spaceFlags & wsSpace) ? 64 : 0, state); - } else if (whingeLevel == 4) { - styler.SetFlags((spaceFlags & wsTab) ? 64 : 0, state); - } - atStartLine = false; - } - - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - chNext2 = styler.SafeGetCharAt(i + 2); - - if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { - if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) { - // Perform colourisation of white space and triple quoted strings at end of each line to allow - // tab marking to work inside white space and triple quoted strings - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - } - - int lev = indentCurrent; - int indentNext = IndentAmount(styler, lineCurrent + 1, &spaceFlags); - if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - // Only non whitespace lines can be headers - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - } - indentCurrent = indentNext; - if (fold) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - atStartLine = true; - } - - if (IsLeadByte(codePage, ch)) { // dbcs - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - chPrev2 = ' '; - i += 1; - continue; - } - - if (state == SCE_P_DEFAULT) { - if (iswordstart(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_P_WORD; - startSeg = i; - } else if (ch == '#') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_P_COMMENTLINE; - startSeg = i; - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - if (chNext == '\"' && chNext2 == '\"') { - i += 2; - state = SCE_P_TRIPLEDOUBLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_P_STRING; - } - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_P_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_P_CHARACTER; - } - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - styler.ColourSegment(i, i, SCE_P_OPERATOR); - startSeg = i + 1; - } - } else if (state == SCE_P_WORD) { - if (!iswordchar(ch)) { - classifyWordPy(startSeg, i - 1, keywords, styler, prevWord); - state = SCE_P_DEFAULT; - startSeg = i; - if (ch == '#') { - state = SCE_P_COMMENTLINE; - } else if (ch == '\"') { - if (chNext == '\"' && chNext2 == '\"') { - i += 2; - state = SCE_P_TRIPLEDOUBLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_P_STRING; - } - } else if (ch == '\'') { - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_P_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_P_CHARACTER; - } - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_P_OPERATOR); - startSeg = i + 1; - } - } - } else { - if (state == SCE_P_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_P_DEFAULT; - startSeg = i; - } - } else if (state == SCE_P_STRING) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i, state); - state = SCE_P_DEFAULT; - startSeg = i + 1; - } - } else if (state == SCE_P_CHARACTER) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i, state); - state = SCE_P_DEFAULT; - startSeg = i + 1; - } - } else if (state == SCE_P_TRIPLE) { - if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { - styler.ColourSegment(startSeg, i, state); - state = SCE_P_DEFAULT; - startSeg = i + 1; - } - } else if (state == SCE_P_TRIPLEDOUBLE) { - if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { - styler.ColourSegment(startSeg, i, state); - state = SCE_P_DEFAULT; - startSeg = i + 1; - } - } - } - chPrev2 = chPrev; - chPrev = ch; - } - if (startSeg <= lengthDoc) { - if (state == SCE_P_DEFAULT) { - styler.ColourSegment(startSeg, lengthDoc, state); - } else if (state == SCE_P_WORD) { - classifyWordPy(startSeg, lengthDoc, keywords, styler, prevWord); - } else if (state == SCE_P_COMMENTLINE) { - styler.ColourSegment(startSeg, lengthDoc, state); - } else if (state == SCE_P_STRING) { - styler.ColourSegment(startSeg, lengthDoc, state); - } else if (state == SCE_P_CHARACTER) { - styler.ColourSegment(startSeg, lengthDoc, state); - } else if (state == SCE_P_TRIPLE) { - styler.ColourSegment(startSeg, lengthDoc, state); - } else if (state == SCE_P_TRIPLEDOUBLE) { - styler.ColourSegment(startSeg, lengthDoc, state); - } - } -} - -static void ColouriseBatchLine(char *lineBuffer, int lengthLine, StylingContext &styler) { - if (0 == strncmp(lineBuffer, "REM", 3)) { - styler.ColourSegment(0, lengthLine - 1, 1); - } else if (0 == strncmp(lineBuffer, "rem", 3)) { - styler.ColourSegment(0, lengthLine - 1, 1); - } else if (0 == strncmp(lineBuffer, "SET", 3)) { - styler.ColourSegment(0, lengthLine - 1, 2); - } else if (0 == strncmp(lineBuffer, "set", 3)) { - styler.ColourSegment(0, lengthLine - 1, 2); - } else if (lineBuffer[0] == ':') { - styler.ColourSegment(0, lengthLine - 1, 3); - } else { - styler.ColourSegment(0, lengthLine - 1, 0); - } -} - -static void ColouriseBatchDoc(int startPos, int length, int, StylingContext &styler) { - char lineBuffer[1024]; - unsigned int linePos = 0; - for (int i = startPos; i < startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { - ColouriseBatchLine(lineBuffer, linePos, styler); - linePos = 0; - } - } - if (linePos > 0) - ColouriseBatchLine(lineBuffer, linePos, styler); -} - -enum { eScriptNone, eScriptJS, eScriptVBS, eScriptPython }; -static int segIsScriptingIndicator(StylingContext &styler, unsigned int start, unsigned int end, int prevValue) { - char s[100]; - s[0] = '\0'; - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); - s[i + 1] = '\0'; - } -Platform::DebugPrintf("Scripting indicator [%s]\n", s); - if (strstr(s, "vbs")) - return eScriptVBS; - if (strstr(s, "pyth")) - return eScriptPython; - if (strstr(s, "javas")) - return eScriptJS; - if (strstr(s, "jscr")) - return eScriptJS; - - return prevValue; -} - -static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.') || - (styler[start] == '-') || (styler[start] == '#'); - char chAttr = SCE_H_ATTRIBUTEUNKNOWN; - if (wordIsNumber) { - chAttr = SCE_H_NUMBER; - } else { - char s[100]; - s[0] = '\0'; - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); - s[i + 1] = '\0'; - } - if (keywords.InList(s)) - chAttr = SCE_H_ATTRIBUTE; - } - styler.ColourTo(end, chAttr); -} - -static int classifyTagHTML(unsigned int start, unsigned int end, - WordList &keywords, StylingContext &styler) { - char s[100]; - // Copy after the '<' - unsigned int i = 0; - for (int cPos=start; cPos <= end && i < 30; cPos++) { - char ch = styler[cPos]; - if (ch != '<') - s[i++] = tolower(ch); - } - s[i] = '\0'; - char chAttr = SCE_H_TAGUNKNOWN; - if (s[0] == '!' && s[1] == '-' && s[2] == '-') { //Comment - chAttr = SCE_H_COMMENT; - } else if (s[0] == '/') { // Closing tag - if (keywords.InList(s + 1)) - chAttr = SCE_H_TAG; - } else { - if (keywords.InList(s)) { - chAttr = SCE_H_TAG; - if (0 == strcmp(s, "script")) - chAttr = SCE_H_SCRIPT; - } - } - styler.ColourTo(end, chAttr); - return chAttr; -} - -static void classifyWordHTJS(unsigned int start, unsigned int end, - WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_HJ_WORD; - if (wordIsNumber) - chAttr = SCE_HJ_NUMBER; - else { - if (keywords.InList(s)) - chAttr = SCE_HJ_KEYWORD; - } - styler.ColourTo(end, chAttr); -} - -static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); - s[i + 1] = '\0'; - } - char chAttr = SCE_HB_IDENTIFIER; - if (wordIsNumber) - chAttr = SCE_HB_NUMBER; - else { - if (keywords.InList(s)) { - chAttr = SCE_HB_WORD; - if (strcmp(s, "rem") == 0) - chAttr = SCE_HB_COMMENTLINE; - } - } - styler.ColourTo(end, chAttr); - if (chAttr == SCE_HB_COMMENTLINE) - return SCE_HB_COMMENTLINE; - else - return SCE_HB_DEFAULT; -} - -static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler, char *prevWord) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_HP_IDENTIFIER; - if (0 == strcmp(prevWord, "class")) - chAttr = SCE_HP_CLASSNAME; - else if (0 == strcmp(prevWord, "def")) - chAttr = SCE_HP_DEFNAME; - else if (wordIsNumber) - chAttr = SCE_HP_NUMBER; - else if (keywords.InList(s)) - chAttr = SCE_HP_WORD; - styler.ColourTo(end, chAttr); - strcpy(prevWord, s); -} - -inline bool ishtmlwordchar(char ch) { - return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#'; -} - -static bool InTagState(int state) { - return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN || - state == SCE_H_SCRIPT || - state == SCE_H_ATTRIBUTE || state == SCE_H_ATTRIBUTEUNKNOWN || - state == SCE_H_NUMBER || state == SCE_H_OTHER || - state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING; -} - -static bool isLineEnd(char ch) { - return ch == '\r' || ch == '\n'; -} - -static void ColouriseHyperTextDoc(int codePage, int startPos, int length, - int initStyle, WordList &keywords, WordList &keywords2, WordList &keywords3, WordList &keywords4, - StylingContext &styler) { - - styler.StartAt(startPos, 63); - bool lastTagWasScript = false; - char prevWord[200]; - prevWord[0] = '\0'; - int scriptLanguage = eScriptJS; - int state = initStyle; - // If inside a tag, it may be a script tage, so reread from the start to ensure any language tas are seen - if (InTagState(state)) { - while ((startPos > 1) && (InTagState(styler.StyleAt(startPos - 1)))) { - startPos--; - } - state = SCE_H_DEFAULT; - } - styler.StartAt(startPos, 63); - - int lineState = eScriptVBS; - int lineCurrent = styler.GetLine(startPos); - if (lineCurrent > 0) - lineState = styler.GetLineState(lineCurrent); - int defaultScript = lineState &0xff; - int beforeASP = (lineState >> 8) &0xff; - int inASP = (lineState >> 16) &0xff; - - char chPrev = ' '; - char chPrev2 = ' '; - styler.StartSegment(startPos); - int lengthDoc = startPos + length; - for (int i = startPos; i <= lengthDoc; i++) { - char ch = styler[i]; - char chNext = styler.SafeGetCharAt(i + 1); - char chNext2 = styler.SafeGetCharAt(i + 2); - - if (IsLeadByte(codePage, ch)) { // dbcs - chPrev2 = ' '; - chPrev = ' '; - i += 1; - continue; - } - - if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { - // New line -> record any line state onto /next/ line - lineCurrent++; - styler.SetLineState(lineCurrent, - defaultScript | (beforeASP << 8) | (inASP << 16)); - } - - // Handle ASP even within other constructs as it is a preprocessor - if ((ch == '<') && (chNext == '%')) { - beforeASP = state; - styler.ColourTo(i - 1, state); - if (chNext2 == '@') { - styler.ColourTo(i + 2, SCE_H_ASP); - state = SCE_H_ASPAT; - i+=2; - } else { - if (defaultScript == eScriptVBS) - state = SCE_HB_START; - else if (defaultScript == eScriptPython) - state = SCE_HP_START; - else - state = SCE_HJ_START; - if (chNext2 == '=') { - styler.ColourTo(i + 2, SCE_H_ASP); - i+=2; - } else { - styler.ColourTo(i + 1, SCE_H_ASP); - i++; - } - } - inASP = 1; - continue; - } - if (inASP && (ch == '%') && (chNext == '>')) { - if (state == SCE_H_ASPAT) - defaultScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i-1, defaultScript); - // Bounce out of any ASP mode - styler.ColourTo(i - 1, state); - //if (state == SCE_H_ASPAT) - // styler.ColourTo(i+1, SCE_H_ASPAT); - //else - styler.ColourTo(i+1, SCE_H_ASP); - i++; - state = beforeASP; - beforeASP = SCE_H_DEFAULT; - inASP = 0; - continue; - } - - if (state == SCE_H_DEFAULT) { - if (ch == '<') { - styler.ColourTo(i - 1, state); - state = SCE_H_TAGUNKNOWN; - if (chNext == '?') { - styler.ColourTo(i + 1, SCE_H_XMLSTART); - i++; - ch = chNext; - } - } else if (ch == '&') { - styler.ColourTo(i - 1, SCE_H_DEFAULT); - state = SCE_H_ENTITY; - } - } else if (state == SCE_H_COMMENT) { - if ((ch == '>') && (chPrev == '-')) { - styler.ColourTo(i, state); - state = SCE_H_DEFAULT; - } - } else if (state == SCE_H_ENTITY) { - if (ch == ';') { - styler.ColourTo(i, state); - state = SCE_H_DEFAULT; - } - } else if (state == SCE_H_TAGUNKNOWN) { - if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') { - int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler); - lastTagWasScript = eClass == SCE_H_SCRIPT; - if (lastTagWasScript) { - scriptLanguage = eScriptJS; - eClass = SCE_H_TAG; - } - if (ch == '>') { - styler.ColourTo(i, SCE_H_TAG); - if (lastTagWasScript) { - if (scriptLanguage == eScriptVBS) - state = SCE_HB_START; - else if (scriptLanguage == eScriptPython) - state = SCE_HP_START; - else - state = SCE_HJ_START; - } else { - state = SCE_H_DEFAULT; - } - } else { - if (eClass == SCE_H_COMMENT) { - state = SCE_H_COMMENT; - } else { - state = SCE_H_OTHER; - } - } - } - } else if (state == SCE_H_ATTRIBUTE) { - if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') { - if (lastTagWasScript) - scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i-1, scriptLanguage); - classifyAttribHTML(styler.GetStartSegment(), i - 1, keywords, styler); - if (ch == '>') { - styler.ColourTo(i, SCE_H_TAG); - if (lastTagWasScript) { - if (scriptLanguage == eScriptVBS) - state = SCE_HB_START; - else if (scriptLanguage == eScriptPython) - state = SCE_HP_START; - else - state = SCE_HJ_START; - } else { - state = SCE_H_DEFAULT; - } - } else { - state = SCE_H_OTHER; - } - } - } else if (state == SCE_H_ASP) { - if ((ch == '>') && (chPrev == '%')) { - styler.ColourTo(i, state); - state = SCE_H_DEFAULT; - } - } else if (state == SCE_H_ASPAT) { - if ((ch == '>') && (chPrev == '%')) { - styler.ColourTo(i, state); - state = SCE_H_DEFAULT; - } - } else if (state == SCE_H_OTHER) { - if (ch == '>') { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_H_TAG); - if (lastTagWasScript) { - if (scriptLanguage == eScriptVBS) - state = SCE_HB_START; - else if (scriptLanguage == eScriptPython) - state = SCE_HP_START; - else - state = SCE_HJ_START; - } else { - state = SCE_H_DEFAULT; - } - } else if (ch == '\"') { - styler.ColourTo(i - 1, state); - state = SCE_H_DOUBLESTRING; - } else if (ch == '\'') { - styler.ColourTo(i - 1, state); - state = SCE_H_SINGLESTRING; - } else if (ch == '/' && chNext == '>') { - styler.ColourTo(i - 1, state); - styler.ColourTo(i + 1, SCE_H_TAGEND); - i++; - ch = chNext; - state = SCE_H_DEFAULT; - } else if (ch == '?' && chNext == '>') { - styler.ColourTo(i - 1, state); - styler.ColourTo(i + 1, SCE_H_XMLEND); - i++; - ch = chNext; - state = SCE_H_DEFAULT; - } else if (ishtmlwordchar(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_H_ATTRIBUTE; - } - } else if (state == SCE_H_DOUBLESTRING) { - if (ch == '\"') { - if (lastTagWasScript) - scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); - styler.ColourTo(i, SCE_H_DOUBLESTRING); - state = SCE_H_OTHER; - } - } else if (state == SCE_H_SINGLESTRING) { - if (ch == '\'') { - if (lastTagWasScript) - scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); - styler.ColourTo(i, SCE_H_SINGLESTRING); - state = SCE_H_OTHER; - } - } else if (state == SCE_HJ_DEFAULT || state == SCE_HJ_START) { - if (iswordstart(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_HJ_WORD; - } else if (ch == '/' && chNext == '*') { - styler.ColourTo(i - 1, state); - if (chNext2 == '*') - state = SCE_HJ_COMMENTDOC; - else - state = SCE_HJ_COMMENT; - } else if (ch == '/' && chNext == '/') { - styler.ColourTo(i - 1, state); - state = SCE_HJ_COMMENTLINE; - } else if (ch == '\"') { - styler.ColourTo(i - 1, state); - state = SCE_HJ_DOUBLESTRING; - } else if (ch == '\'') { - styler.ColourTo(i - 1, state); - state = SCE_HJ_SINGLESTRING; - } else if ((ch == '<') && (chNext == '/')) { - styler.ColourTo(i - 1, state); - state = SCE_H_TAGUNKNOWN; - } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && - styler.SafeGetCharAt(i + 3) == '-') { - styler.ColourTo(i - 1, state); - state = SCE_HJ_COMMENTLINE; - } else if (isoperator(ch)) { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_HJ_SYMBOLS); - state = SCE_HJ_DEFAULT; - } else if ((ch == ' ') || (ch == '\t')) { - if (state == SCE_HJ_START) { - styler.ColourTo(i - 1, state); - state = SCE_HJ_DEFAULT; - } - } - } else if (state == SCE_HJ_WORD) { - if (!iswordchar(ch)) { - classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler); - //styler.ColourTo(i - 1, eHTJSKeyword); - state = SCE_HJ_DEFAULT; - if (ch == '/' && chNext == '*') { - if (chNext2 == '*') - state = SCE_HJ_COMMENTDOC; - else - state = SCE_HJ_COMMENT; - } else if (ch == '/' && chNext == '/') { - state = SCE_HJ_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_HJ_DOUBLESTRING; - } else if (ch == '\'') { - state = SCE_HJ_SINGLESTRING; - } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_HJ_SYMBOLS); - state = SCE_HJ_DEFAULT; - } - } - } else if (state == SCE_HJ_COMMENT) { - if (ch == '/' && chPrev == '*') { - state = SCE_HJ_DEFAULT; - styler.ColourTo(i, SCE_HJ_COMMENT); - } else if ((ch == '<') && (chNext == '/')) { - styler.ColourTo(i - 1, state); - styler.ColourTo(i + 1, SCE_H_TAGEND); - i++; - ch = chNext; - state = SCE_H_DEFAULT; - } - } else if (state == SCE_HJ_COMMENTDOC) { - if (ch == '/' && chPrev == '*') { - state = SCE_HJ_DEFAULT; - styler.ColourTo(i, SCE_HJ_COMMENTDOC); - } else if ((ch == '<') && (chNext == '/')) { - styler.ColourTo(i - 1, state); - styler.ColourTo(i + 1, SCE_H_TAGEND); - i++; - ch = chNext; - state = SCE_H_DEFAULT; - } - } else if (state == SCE_HJ_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, SCE_HJ_COMMENTLINE); - state = SCE_HJ_DEFAULT; - } else if ((ch == '<') && (chNext == '/')) { - // Common to hide end script tag in comment - styler.ColourTo(i - 1, SCE_HJ_COMMENTLINE); - state = SCE_H_TAGUNKNOWN; - } - } else if (state == SCE_HJ_DOUBLESTRING) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - } - } else if (ch == '\"') { - styler.ColourTo(i, SCE_HJ_DOUBLESTRING); - state = SCE_HJ_DEFAULT; - i++; - ch = chNext; - } else if (isLineEnd(ch)) { - styler.ColourTo(i-1, state); - state = SCE_HJ_STRINGEOL; - } - } else if (state == SCE_HJ_SINGLESTRING) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - } - } else if (ch == '\'') { - styler.ColourTo(i, SCE_HJ_SINGLESTRING); - state = SCE_HJ_DEFAULT; - i++; - ch = chNext; - } else if (isLineEnd(ch)) { - styler.ColourTo(i-1, state); - state = SCE_HJ_STRINGEOL; - } - } else if (state == SCE_HJ_STRINGEOL) { - if (!isLineEnd(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_HJ_DEFAULT; - } - } else if (state == SCE_HB_DEFAULT || state == SCE_HB_START) { - if (iswordstart(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_HB_WORD; - } else if (ch == '\'') { - styler.ColourTo(i - 1, state); - state = SCE_HB_COMMENTLINE; - } else if (ch == '\"') { - styler.ColourTo(i - 1, state); - state = SCE_HB_STRING; - } else if ((ch == '<') && (chNext == '/')) { - styler.ColourTo(i - 1, state); - state = SCE_H_TAGUNKNOWN; - } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && - styler.SafeGetCharAt(i + 3) == '-') { - styler.ColourTo(i - 1, state); - state = SCE_HB_COMMENTLINE; - } else if (isoperator(ch)) { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_HB_DEFAULT); - state = SCE_HB_DEFAULT; - } else if ((ch == ' ') || (ch == '\t')) { - if (state == SCE_HB_START) { - styler.ColourTo(i - 1, state); - state = SCE_HB_DEFAULT; - } - } - } else if (state == SCE_HB_WORD) { - if (!iswordchar(ch)) { - state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler); - if (state == SCE_HB_DEFAULT) { - if (ch == '\"') { - state = SCE_HB_STRING; - } else if (ch == '\'') { - state = SCE_HB_COMMENTLINE; - } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_HB_DEFAULT); - state = SCE_HB_DEFAULT; - } - } - } - } else if (state == SCE_HB_STRING) { - if (ch == '\"') { - styler.ColourTo(i, state); - state = SCE_HB_DEFAULT; - i++; - ch = chNext; - } else if (ch == '\r' || ch == '\n') { - styler.ColourTo(i-1, state); - state = SCE_HB_STRINGEOL; - } - } else if (state == SCE_HB_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, state); - state = SCE_HB_DEFAULT; - } else if ((ch == '<') && (chNext == '/')) { - // Common to hide end script tag in comment - styler.ColourTo(i - 1, state); - state = SCE_H_TAGUNKNOWN; - } - } else if (state == SCE_HB_STRINGEOL) { - if (!isLineEnd(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_HB_DEFAULT; - } - } else if (state == SCE_HP_DEFAULT || state == SCE_HP_START) { - if (iswordstart(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_HP_WORD; - } else if ((ch == '<') && (chNext == '/')) { - styler.ColourTo(i - 1, state); - state = SCE_H_TAGUNKNOWN; - } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && - styler.SafeGetCharAt(i + 3) == '-') { - styler.ColourTo(i - 1, state); - state = SCE_HP_COMMENTLINE; - } else if (ch == '#') { - styler.ColourTo(i - 1, state); - state = SCE_HP_COMMENTLINE; - } else if (ch == '\"') { - styler.ColourTo(i - 1, state); - if (chNext == '\"' && chNext2 == '\"') { - i += 2; - state = SCE_HP_TRIPLEDOUBLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_HP_STRING; - } - } else if (ch == '\'') { - styler.ColourTo(i - 1, state); - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_HP_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_HP_CHARACTER; - } - } else if (isoperator(ch)) { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_HP_OPERATOR); - } else if ((ch == ' ') || (ch == '\t')) { - if (state == SCE_HP_START) { - styler.ColourTo(i - 1, state); - state = SCE_HP_DEFAULT; - } - } - } else if (state == SCE_HP_WORD) { - if (!iswordchar(ch)) { - classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord); - state = SCE_HP_DEFAULT; - if (ch == '#') { - state = SCE_HP_COMMENTLINE; - } else if (ch == '\"') { - if (chNext == '\"' && chNext2 == '\"') { - i += 2; - state = SCE_HP_TRIPLEDOUBLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_HP_STRING; - } - } else if (ch == '\'') { - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_HP_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_HP_CHARACTER; - } - } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_HP_OPERATOR); - } - } - } else { - if (state == SCE_HP_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, state); - state = SCE_HP_DEFAULT; - } - } else if (state == SCE_HP_STRING) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\"') { - styler.ColourTo(i, state); - state = SCE_HP_DEFAULT; - } - } else if (state == SCE_HP_CHARACTER) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\'') { - styler.ColourTo(i, state); - state = SCE_HP_DEFAULT; - } - } else if (state == SCE_HP_TRIPLE) { - if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { - styler.ColourTo(i, state); - state = SCE_HP_DEFAULT; - } - } else if (state == SCE_HP_TRIPLEDOUBLE) { - if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { - styler.ColourTo(i, state); - state = SCE_HP_DEFAULT; - } - } - } - if (state == SCE_HB_DEFAULT) { // One of the above succeeded - if (ch == '\"') { - state = SCE_HB_STRING; - } else if (ch == '\'') { - state = SCE_HB_COMMENTLINE; - } else if (iswordstart(ch)) { - state = SCE_HB_WORD; - } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_HB_DEFAULT); - } - } - if (state == SCE_HJ_DEFAULT) { // One of the above succeeded - if (ch == '/' && chNext == '*') { - if (styler.SafeGetCharAt(i + 2) == '*') - state = SCE_HJ_COMMENTDOC; - else - state = SCE_HJ_COMMENT; - } else if (ch == '/' && chNext == '/') { - state = SCE_HJ_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_HJ_DOUBLESTRING; - } else if (ch == '\'') { - state = SCE_HJ_SINGLESTRING; - } else if (iswordstart(ch)) { - state = SCE_HJ_WORD; - } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_HJ_SYMBOLS); - } - } - chPrev2 = chPrev; - chPrev = ch; - } - styler.ColourTo(lengthDoc - 1, state); -} - -static void ColourisePropsLine(char *lineBuffer, int lengthLine, StylingContext &styler) { - int i = 0; - while (isspace(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces - i++; - if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') { - styler.ColourSegment(0, lengthLine - 1, 1); - } else if (lineBuffer[i] == '[') { - styler.ColourSegment(0, lengthLine - 1, 2); - } else if (lineBuffer[i] == '@') { - styler.ColourSegment(0, i, 4); - if (lineBuffer[++i] == '=') - styler.ColourSegment(i, i, 3); - if (++i < lengthLine) - styler.ColourSegment(i, lengthLine - 1, 0); - } else { - while (lineBuffer[i] != '=' && (i < lengthLine)) // Search the '=' character - i++; - if (lineBuffer[i] == '=') { - styler.ColourSegment(0, i - 1, 0); - styler.ColourSegment(i, i, 3); - if (++i < lengthLine) - styler.ColourSegment(i, lengthLine - 1, 0); - } else - styler.ColourSegment(0, lengthLine - 1, 0); - } -} - -static void ColourisePropsDoc(int startPos, int length, int, StylingContext &styler) { - char lineBuffer[1024]; - unsigned int linePos = 0; - for (int i = startPos; i <= startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { - lineBuffer[linePos] = '\0'; - ColourisePropsLine(lineBuffer, linePos, styler); - linePos = 0; - } - } - if (linePos > 0) - ColourisePropsLine(lineBuffer, linePos, styler); -} - -static void ColouriseMakeLine(char *lineBuffer, int lengthLine, StylingContext &styler) { - int i = 0; - while (isspace(lineBuffer[i]) && (i < lengthLine)) - i++; - if (lineBuffer[i] == '#' || lineBuffer[i] == '!') { - styler.ColourSegment(0, lengthLine - 1, 1); - } else { - styler.ColourSegment(0, lengthLine - 1, 0); - } -} - -static void ColouriseMakeDoc(int startPos, int length, int, StylingContext &styler) { - char lineBuffer[1024]; - unsigned int linePos = 0; - for (int i = startPos; i <= startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { - ColouriseMakeLine(lineBuffer, linePos, styler); - linePos = 0; - } - } - if (linePos > 0) - ColouriseMakeLine(lineBuffer, linePos, styler); -} - -static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, StylingContext &styler) { - if (lineBuffer[0] == '>') { - // Command or return status - styler.ColourSegment(0, lengthLine - 1, 4); - } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) { - styler.ColourSegment(0, lengthLine - 1, 1); - } else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) { - // Borland error message - styler.ColourSegment(0, lengthLine - 1, 5); - } else if (0 == strncmp(lineBuffer, "Warning ", strlen("Warning "))) { - // Borland warning message - styler.ColourSegment(0, lengthLine - 1, 5); - } else { - // Look for <filename>:<line>:message - // Look for <filename>(line)message - // Look for <filename>(line,pos)message - int state = 0; - for (int i = 0; i < lengthLine; i++) { - if (state == 0 && lineBuffer[i] == ':' && isdigit(lineBuffer[i + 1])) { - state = 1; - } else if (state == 0 && lineBuffer[i] == '(') { - state = 10; - } else if (state == 1 && isdigit(lineBuffer[i])) { - state = 2; - } else if (state == 2 && lineBuffer[i] == ':') { - state = 3; - break; - } else if (state == 2 && !isdigit(lineBuffer[i])) { - state = 99; - } else if (state == 10 && isdigit(lineBuffer[i])) { - state = 11; - } else if (state == 11 && lineBuffer[i] == ',') { - state = 14; - } else if (state == 11 && lineBuffer[i] == ')') { - state = 12; - break; - } else if (state == 12 && lineBuffer[i] == ':') { - state = 13; - } else if (state == 14 && lineBuffer[i] == ')') { - state = 15; - break; - } else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) { - state = 99; - } - } - if (state == 3) { - styler.ColourSegment(0, lengthLine - 1, 2); - } else if ((state == 14) || (state == 15)) { - styler.ColourSegment(0, lengthLine - 1, 3); - } else { - styler.ColourSegment(0, lengthLine - 1, 0); - } - } -} - -static void ColouriseErrorListDoc(int startPos, int length, int, StylingContext &styler) { - char lineBuffer[1024]; - unsigned int linePos = 0; - for (int i = startPos; i <= startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { - ColouriseErrorListLine(lineBuffer, linePos, styler); - linePos = 0; - } - } - if (linePos > 0) - ColouriseErrorListLine(lineBuffer, linePos, styler); -} - -static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = toupper(styler[start + i]); - s[i + 1] = '\0'; - } - char chAttr = SCE_C_IDENTIFIER; - if (wordIsNumber) - chAttr = SCE_C_NUMBER; - else { - if (keywords.InList(s)) - chAttr = SCE_C_WORD; - } - styler.ColourSegment(start, end, chAttr); -} - -static void ColouriseSQLDoc(int codePage, int startPos, int length, - int initStyle, WordList &keywords, StylingContext &styler) { - - bool fold = styler.GetPropSet().GetInt("fold"); - int lineCurrent = styler.GetLine(startPos); - int spaceFlags = 0; - int indentCurrent = 0; - - int state = initStyle; - char chPrev = ' '; - char chNext = styler[startPos]; - int startSeg = startPos; - int lengthDoc = startPos + length; - bool prevCr = false; - for (int i = startPos; i <= lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { - indentCurrent = IndentAmount(styler, lineCurrent, &spaceFlags); - int lev = indentCurrent; - if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - // Only non whitespace lines can be headers - int indentNext = IndentAmount(styler, lineCurrent + 1, &spaceFlags); - if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - } - if (fold) { - styler.SetLevel(lineCurrent, lev); - } - } - - if (IsLeadByte(codePage, ch)) { // dbcs - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - i += 1; - continue; - } - - if (state == SCE_C_DEFAULT) { - if (iswordstart(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_WORD; - startSeg = i; - } else if (ch == '/' && chNext == '*') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_COMMENT; - startSeg = i; - } else if (ch == '-' && chNext == '-') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_COMMENTLINE; - startSeg = i; - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_STRING; - startSeg = i; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - styler.ColourSegment(i, i, SCE_C_OPERATOR); - startSeg = i + 1; - } - } else if (state == SCE_C_WORD) { - if (!iswordchar(ch)) { - classifyWordSQL(startSeg, i - 1, keywords, styler); - state = SCE_C_DEFAULT; - startSeg = i; - if (ch == '/' && chNext == '*') { - state = SCE_C_COMMENT; - } else if (ch == '-' && chNext == '-') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\'') { - state = SCE_C_STRING; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_C_OPERATOR); - startSeg = i + 1; - } - } - } else { - if (state == SCE_C_COMMENT) { - if (ch == '/' && chPrev == '*' && ( - (i > startSeg + 2) || ((initStyle == SCE_C_COMMENT) && (startSeg == startPos)))) { - state = SCE_C_DEFAULT; - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - } - } else if (state == SCE_C_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_DEFAULT; - startSeg = i; - } - } else if (state == SCE_C_STRING) { - if (ch == '\'') { - if ( chNext == '\'' ) { - i++; - } else { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - i++; - startSeg = i; - } - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } - if (state == SCE_C_DEFAULT) { // One of the above succeeded - if (ch == '/' && chNext == '*') { - state = SCE_C_COMMENT; - } else if (ch == '-' && chNext == '-') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\'') { - state = SCE_C_STRING; - } else if (iswordstart(ch)) { - state = SCE_C_WORD; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_C_OPERATOR); - startSeg = i + 1; - } - } - } - chPrev = ch; - } - if (startSeg < lengthDoc) - styler.ColourSegment(startSeg, lengthDoc - 1, state); -} - -void ColouriseDoc(int codePage, int startPos, int lengthDoc, int initStyle, - int language, WordList *keywordlists[], StylingContext &styler) { - //Platform::DebugPrintf("ColouriseDoc <%s>\n", language); - if (language == SCLEX_PYTHON) { - // Python uses a different mask because bad indentation is marked by oring with 32 - styler.StartAt(startPos, 127); - ColourisePyDoc(codePage, startPos, lengthDoc, initStyle, *keywordlists[0], styler); - } else if (language == SCLEX_PERL) { - // Lexer for perl often has to backtrack to start of current style to determine - // which characters are being used as quotes, how deeply nested is the - // start position and what the termination string is for here documents - ColourisePerlDoc(codePage, startPos, lengthDoc, initStyle, *keywordlists[0], styler); - } else if ((language == SCLEX_HTML) || (language == SCLEX_XML)) { - // Lexer for HTML requires more lexical states (6 bits worth) than most lexers - ColouriseHyperTextDoc(codePage, startPos, lengthDoc, initStyle, - *keywordlists[0], *keywordlists[1], *keywordlists[2], *keywordlists[3], styler); - } else { - styler.StartAt(startPos); - if (language == SCLEX_CPP) { - ColouriseCppDoc(codePage, startPos, lengthDoc, initStyle, *keywordlists[0], styler); - } else if (language == SCLEX_SQL) { - ColouriseSQLDoc(codePage, startPos, lengthDoc, initStyle, *keywordlists[0], styler); - } else if (language == SCLEX_VB) { - ColouriseVBDoc(codePage, startPos, lengthDoc, initStyle, *keywordlists[0], styler); - } else if (language == SCLEX_PROPERTIES) { - ColourisePropsDoc(startPos, lengthDoc, initStyle, styler); - } else if (language == SCLEX_ERRORLIST) { - ColouriseErrorListDoc(startPos, lengthDoc, initStyle, styler); - } else if (language == SCLEX_MAKEFILE) { - ColouriseMakeDoc(startPos, lengthDoc, initStyle, styler); - } else if (language == SCLEX_BATCH) { - ColouriseBatchDoc(startPos, lengthDoc, initStyle, styler); - } else { - // Null language means all style bytes are 0 so just mark the end - no need to fill in. - styler.StartAt(startPos + lengthDoc - 1); - styler.ColourSegment(0, 0, 0); - } +LexerModule *LexerModule::base = 0; + +LexerModule::LexerModule(int language_, LexerFunction fn_) : + language(language_), fn(fn_) { + next = base; + base = this; +} + +void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle, + int language, WordList *keywordlists[], Accessor &styler) { + LexerModule *lm = base; + while (lm) { + if (lm->language == language) { + lm->fn(startPos, lengthDoc, initStyle, keywordlists, styler); + return; + } + lm = lm->next; + } + // Unknown language + // Null language means all style bytes are 0 so just mark the end - no need to fill in. + if (lengthDoc > 0) { + styler.StartAt(startPos + lengthDoc - 1); + styler.StartSegment(startPos + lengthDoc - 1); + styler.ColourTo(startPos + lengthDoc - 1, 0); } } diff --git a/contrib/src/stc/scintilla/src/LexCPP.cxx b/contrib/src/stc/scintilla/src/LexCPP.cxx new file mode 100644 index 0000000000..4f042bd61d --- /dev/null +++ b/contrib/src/stc/scintilla/src/LexCPP.cxx @@ -0,0 +1,258 @@ +// SciTE - Scintilla based Text Editor +// LexCPP.cxx - lexer for C++, C, Java, and Javascript +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + bool wordIsUUID = false; + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_C_IDENTIFIER; + if (wordIsNumber) + chAttr = SCE_C_NUMBER; + else { + if (keywords.InList(s)) { + chAttr = SCE_C_WORD; + wordIsUUID = strcmp(s, "uuid") == 0; + } + } + styler.ColourTo(end, chAttr); + return wordIsUUID; +} + +static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + + styler.StartAt(startPos); + + bool fold = styler.GetPropertyInt("fold"); + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + + int state = initStyle; + if (state == SCE_C_STRINGEOL) // Does not leak onto next line + state = SCE_C_DEFAULT; + char chPrev = ' '; + char chNext = styler[startPos]; + unsigned int lengthDoc = startPos + length; + int visChars = 0; + styler.StartSegment(startPos); + bool lastWordWasUUID = false; + for (unsigned int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { + // End of line + if (state == SCE_C_STRINGEOL) { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + } + if (fold) { + int lev = levelPrev; + if (visChars == 0) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((levelCurrent > levelPrev) && (visChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + styler.SetLevel(lineCurrent, lev); + lineCurrent++; + visChars = 0; + levelPrev = levelCurrent; + } + } + if (!isspace(ch)) + visChars++; + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + i += 1; + continue; + } + + if (state == SCE_C_DEFAULT) { + if (iswordstart(ch)) { + styler.ColourTo(i-1, state); + if (lastWordWasUUID) { + state = SCE_C_UUID; + lastWordWasUUID = false; + } else { + state = SCE_C_WORD; + } + } else if (ch == '/' && chNext == '*') { + styler.ColourTo(i-1, state); + if (styler.SafeGetCharAt(i + 2) == '*') + state = SCE_C_COMMENTDOC; + else + state = SCE_C_COMMENT; + } else if (ch == '/' && chNext == '/') { + styler.ColourTo(i-1, state); + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i-1, state); + state = SCE_C_STRING; + } else if (ch == '\'') { + styler.ColourTo(i-1, state); + state = SCE_C_CHARACTER; + } else if (ch == '#') { + styler.ColourTo(i-1, state); + state = SCE_C_PREPROCESSOR; + } else if (isoperator(ch)) { + styler.ColourTo(i-1, state); + styler.ColourTo(i, SCE_C_OPERATOR); + if ((ch == '{') || (ch == '}')) { + levelCurrent += (ch == '{') ? 1 : -1; + } + } + } else if (state == SCE_C_WORD) { + if (!iswordchar(ch)) { + lastWordWasUUID = classifyWordCpp(styler.GetStartSegment(), i - 1, keywords, styler); + state = SCE_C_DEFAULT; + if (ch == '/' && chNext == '*') { + if (styler.SafeGetCharAt(i + 2) == '*') + state = SCE_C_COMMENTDOC; + else + state = SCE_C_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_C_STRING; + } else if (ch == '\'') { + state = SCE_C_CHARACTER; + } else if (ch == '#') { + state = SCE_C_PREPROCESSOR; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_C_OPERATOR); + if ((ch == '{') || (ch == '}')) { + levelCurrent += (ch == '{') ? 1 : -1; + } + } + } + } else { + if (state == SCE_C_PREPROCESSOR) { + if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) { + styler.ColourTo(i-1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_COMMENT) { + if (ch == '/' && chPrev == '*') { + if (((i > styler.GetStartSegment() + 2) || ( + (initStyle == SCE_C_COMMENT) && + (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + } + } + } else if (state == SCE_C_COMMENTDOC) { + if (ch == '/' && chPrev == '*') { + if (((i > styler.GetStartSegment() + 2) || ( + (initStyle == SCE_C_COMMENTDOC) && + (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + } + } + } else if (state == SCE_C_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i-1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_STRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } else if (chNext == '\r' || chNext == '\n') { + styler.ColourTo(i-1, SCE_C_STRINGEOL); + state = SCE_C_STRINGEOL; + } + } else if (state == SCE_C_CHARACTER) { + if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { + styler.ColourTo(i-1, SCE_C_STRINGEOL); + state = SCE_C_STRINGEOL; + } else if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\'') { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (state == SCE_C_UUID) { + if (ch == '\r' || ch == '\n' || ch == ')') { + styler.ColourTo(i-1, state); + state = SCE_C_DEFAULT; + } + } + if (state == SCE_C_DEFAULT) { // One of the above succeeded + if (ch == '/' && chNext == '*') { + if (styler.SafeGetCharAt(i + 2) == '*') + state = SCE_C_COMMENTDOC; + else + state = SCE_C_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_C_STRING; + } else if (ch == '\'') { + state = SCE_C_CHARACTER; + } else if (ch == '#') { + state = SCE_C_PREPROCESSOR; + } else if (iswordstart(ch)) { + state = SCE_C_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_C_OPERATOR); + if ((ch == '{') || (ch == '}')) { + levelCurrent += (ch == '{') ? 1 : -1; + } + } + } + } + chPrev = ch; + } + styler.ColourTo(lengthDoc - 1, state); + + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + if (fold) { + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + //styler.SetLevel(lineCurrent, levelCurrent | flagsNext); + styler.SetLevel(lineCurrent, levelPrev | flagsNext); + + } +} + +LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc); diff --git a/contrib/src/stc/scintilla/src/LexHTML.cxx b/contrib/src/stc/scintilla/src/LexHTML.cxx new file mode 100644 index 0000000000..653aa4653f --- /dev/null +++ b/contrib/src/stc/scintilla/src/LexHTML.cxx @@ -0,0 +1,1139 @@ +// SciTE - Scintilla based Text Editor +// LexHTML.cxx - lexer for HTML +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +enum { eScriptNone, eScriptJS, eScriptVBS, eScriptPython }; +static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, int prevValue) { + char s[100]; + s[0] = '\0'; + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(tolower(styler[start + i])); + s[i + 1] = '\0'; + } +//Platform::DebugPrintf("Scripting indicator [%s]\n", s); + if (strstr(s, "vbs")) + return eScriptVBS; + if (strstr(s, "pyth")) + return eScriptPython; + if (strstr(s, "javas")) + return eScriptJS; + if (strstr(s, "jscr")) + return eScriptJS; + + return prevValue; +} + +static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.') || + (styler[start] == '-') || (styler[start] == '#'); + char chAttr = SCE_H_ATTRIBUTEUNKNOWN; + if (wordIsNumber) { + chAttr = SCE_H_NUMBER; + } else { + char s[100]; + s[0] = '\0'; + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(tolower(styler[start + i])); + s[i + 1] = '\0'; + } + if (keywords.InList(s)) + chAttr = SCE_H_ATTRIBUTE; + } + styler.ColourTo(end, chAttr); +} + +static int classifyTagHTML(unsigned int start, unsigned int end, + WordList &keywords, Accessor &styler) { + char s[100]; + // Copy after the '<' + unsigned int i = 0; + for (unsigned int cPos=start; cPos <= end && i < 30; cPos++) { + char ch = styler[cPos]; + if (ch != '<') + s[i++] = static_cast<char>(tolower(ch)); + } + s[i] = '\0'; + char chAttr = SCE_H_TAGUNKNOWN; + if (s[0] == '!' && s[1] == '-' && s[2] == '-') { //Comment + chAttr = SCE_H_COMMENT; + } else if (s[0] == '/') { // Closing tag + if (keywords.InList(s + 1)) + chAttr = SCE_H_TAG; + } else { + if (keywords.InList(s)) { + chAttr = SCE_H_TAG; + if (0 == strcmp(s, "script")) + chAttr = SCE_H_SCRIPT; + } + } + styler.ColourTo(end, chAttr); + return chAttr; +} + +static void classifyWordHTJS(unsigned int start, unsigned int end, + WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_HJ_WORD; + if (wordIsNumber) + chAttr = SCE_HJ_NUMBER; + else { + if (keywords.InList(s)) + chAttr = SCE_HJ_KEYWORD; + } + styler.ColourTo(end, chAttr); +} + +static void classifyWordHTJSA(unsigned int start, unsigned int end, + WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_HJA_WORD; + if (wordIsNumber) + chAttr = SCE_HJA_NUMBER; + else { + if (keywords.InList(s)) + chAttr = SCE_HJA_KEYWORD; + } + styler.ColourTo(end, chAttr); +} + +static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(tolower(styler[start + i])); + s[i + 1] = '\0'; + } + char chAttr = SCE_HB_IDENTIFIER; + if (wordIsNumber) + chAttr = SCE_HB_NUMBER; + else { + if (keywords.InList(s)) { + chAttr = SCE_HB_WORD; + if (strcmp(s, "rem") == 0) + chAttr = SCE_HB_COMMENTLINE; + } + } + styler.ColourTo(end, chAttr); + if (chAttr == SCE_HB_COMMENTLINE) + return SCE_HB_COMMENTLINE; + else + return SCE_HB_DEFAULT; +} + +static int classifyWordHTVBA(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(tolower(styler[start + i])); + s[i + 1] = '\0'; + } + char chAttr = SCE_HBA_IDENTIFIER; + if (wordIsNumber) + chAttr = SCE_HBA_NUMBER; + else { + if (keywords.InList(s)) { + chAttr = SCE_HBA_WORD; + if (strcmp(s, "rem") == 0) + chAttr = SCE_HBA_COMMENTLINE; + } + } + styler.ColourTo(end, chAttr); + if (chAttr == SCE_HBA_COMMENTLINE) + return SCE_HBA_COMMENTLINE; + else + return SCE_HBA_DEFAULT; +} + +static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_HP_IDENTIFIER; + if (0 == strcmp(prevWord, "class")) + chAttr = SCE_HP_CLASSNAME; + else if (0 == strcmp(prevWord, "def")) + chAttr = SCE_HP_DEFNAME; + else if (wordIsNumber) + chAttr = SCE_HP_NUMBER; + else if (keywords.InList(s)) + chAttr = SCE_HP_WORD; + styler.ColourTo(end, chAttr); + strcpy(prevWord, s); +} + +static void classifyWordHTPyA(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_HPA_IDENTIFIER; + if (0 == strcmp(prevWord, "class")) + chAttr = SCE_HPA_CLASSNAME; + else if (0 == strcmp(prevWord, "def")) + chAttr = SCE_HPA_DEFNAME; + else if (wordIsNumber) + chAttr = SCE_HPA_NUMBER; + else if (keywords.InList(s)) + chAttr = SCE_HPA_WORD; + styler.ColourTo(end, chAttr); + strcpy(prevWord, s); +} + +inline bool ishtmlwordchar(char ch) { + return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#'; +} + +static bool InTagState(int state) { + return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN || + state == SCE_H_SCRIPT || + state == SCE_H_ATTRIBUTE || state == SCE_H_ATTRIBUTEUNKNOWN || + state == SCE_H_NUMBER || state == SCE_H_OTHER || + state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING; +} + +static bool isLineEnd(char ch) { + return ch == '\r' || ch == '\n'; +} + +static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + WordList &keywords=*keywordlists[0]; + WordList &keywords2=*keywordlists[1]; + WordList &keywords3=*keywordlists[2]; + WordList &keywords4=*keywordlists[3]; + + // Lexer for HTML requires more lexical states (7 bits worth) than most lexers + styler.StartAt(startPos, 127); + bool lastTagWasScript = false; + char prevWord[200]; + prevWord[0] = '\0'; + int scriptLanguage = eScriptJS; + int state = initStyle; + // If inside a tag, it may be a script tage, so reread from the start to ensure any language tas are seen + if (InTagState(state)) { + while ((startPos > 1) && (InTagState(styler.StyleAt(startPos - 1)))) { + startPos--; + } + state = SCE_H_DEFAULT; + } + styler.StartAt(startPos, 127); + + int lineState = eScriptVBS; + int lineCurrent = styler.GetLine(startPos); + if (lineCurrent > 0) + lineState = styler.GetLineState(lineCurrent); + int defaultScript = lineState &0xff; + int beforeASP = (lineState >> 8) &0xff; + int inASP = (lineState >> 16) &0xff; + + char chPrev = ' '; + char chPrev2 = ' '; + styler.StartSegment(startPos); + int lengthDoc = startPos + length; + for (int i = startPos; i < lengthDoc; i++) { + char ch = styler[i]; + char chNext = styler.SafeGetCharAt(i + 1); + char chNext2 = styler.SafeGetCharAt(i + 2); + + if (styler.IsLeadByte(ch)) { + chPrev2 = ' '; + chPrev = ' '; + i += 1; + continue; + } + + if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { + // New line -> record any line state onto /next/ line + lineCurrent++; + styler.SetLineState(lineCurrent, + defaultScript | (beforeASP << 8) | (inASP << 16)); + } + + // Handle ASP even within other constructs as it is a preprocessor + if ((ch == '<') && (chNext == '%')) { + beforeASP = state; + styler.ColourTo(i - 1, state); + if (chNext2 == '@') { + styler.ColourTo(i + 2, SCE_H_ASP); + state = SCE_H_ASPAT; + i+=2; + } else { + if (defaultScript == eScriptVBS) + state = SCE_HBA_START; + else if (defaultScript == eScriptPython) + state = SCE_HPA_START; + else + state = SCE_HJA_START; + if (chNext2 == '=') { + styler.ColourTo(i + 2, SCE_H_ASP); + i+=2; + } else { + styler.ColourTo(i + 1, SCE_H_ASP); + i++; + } + } + inASP = 1; + continue; + } + if (inASP && (ch == '%') && (chNext == '>')) { + if (state == SCE_H_ASPAT) + defaultScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i-1, defaultScript); + // Bounce out of any ASP mode + if (state == SCE_HJA_WORD) { + classifyWordHTJSA(styler.GetStartSegment(), i - 1, keywords2, styler); + } else if (state == SCE_HBA_WORD) { + classifyWordHTVBA(styler.GetStartSegment(), i - 1, keywords3, styler); + } else if (state == SCE_HPA_WORD) { + classifyWordHTPyA(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord); + } else { + styler.ColourTo(i - 1, state); + } + //if (state == SCE_H_ASPAT) + // styler.ColourTo(i+1, SCE_H_ASPAT); + //else + styler.ColourTo(i+1, SCE_H_ASP); + i++; + state = beforeASP; + beforeASP = SCE_H_DEFAULT; + inASP = 0; + continue; + } + + if (state == SCE_H_DEFAULT) { + if (ch == '<') { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + if (chNext == '?') { + styler.ColourTo(i + 1, SCE_H_XMLSTART); + i++; + ch = chNext; + } + } else if (ch == '&') { + styler.ColourTo(i - 1, SCE_H_DEFAULT); + state = SCE_H_ENTITY; + } + } else if (state == SCE_H_COMMENT) { + if ((ch == '>') && (chPrev == '-')) { + styler.ColourTo(i, state); + state = SCE_H_DEFAULT; + } + } else if (state == SCE_H_ENTITY) { + if (ch == ';') { + styler.ColourTo(i, state); + state = SCE_H_DEFAULT; + } + } else if (state == SCE_H_TAGUNKNOWN) { + if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') { + int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler); + lastTagWasScript = eClass == SCE_H_SCRIPT; + if (lastTagWasScript) { + scriptLanguage = eScriptJS; + eClass = SCE_H_TAG; + } + if (ch == '>') { + styler.ColourTo(i, SCE_H_TAG); + if (lastTagWasScript) { + if (scriptLanguage == eScriptVBS) + state = SCE_HB_START; + else if (scriptLanguage == eScriptPython) + state = SCE_HP_START; + else + state = SCE_HJ_START; + } else { + state = SCE_H_DEFAULT; + } + } else { + if (eClass == SCE_H_COMMENT) { + state = SCE_H_COMMENT; + } else { + state = SCE_H_OTHER; + } + } + } + } else if (state == SCE_H_ATTRIBUTE) { + if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') { + if (lastTagWasScript) + scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i-1, scriptLanguage); + classifyAttribHTML(styler.GetStartSegment(), i - 1, keywords, styler); + if (ch == '>') { + styler.ColourTo(i, SCE_H_TAG); + if (lastTagWasScript) { + if (scriptLanguage == eScriptVBS) + state = SCE_HB_START; + else if (scriptLanguage == eScriptPython) + state = SCE_HP_START; + else + state = SCE_HJ_START; + } else { + state = SCE_H_DEFAULT; + } + } else { + state = SCE_H_OTHER; + } + } + } else if (state == SCE_H_ASP) { + if ((ch == '>') && (chPrev == '%')) { + styler.ColourTo(i, state); + state = SCE_H_DEFAULT; + } + } else if (state == SCE_H_ASPAT) { + if ((ch == '>') && (chPrev == '%')) { + styler.ColourTo(i, state); + state = SCE_H_DEFAULT; + } + } else if (state == SCE_H_OTHER) { + if (ch == '>') { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_H_TAG); + if (lastTagWasScript) { + if (scriptLanguage == eScriptVBS) + state = SCE_HB_START; + else if (scriptLanguage == eScriptPython) + state = SCE_HP_START; + else + state = SCE_HJ_START; + } else { + state = SCE_H_DEFAULT; + } + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_H_DOUBLESTRING; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_H_SINGLESTRING; + } else if (ch == '/' && chNext == '>') { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_TAGEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } else if (ch == '?' && chNext == '>') { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_XMLEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } else if (ishtmlwordchar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_H_ATTRIBUTE; + } + } else if (state == SCE_H_DOUBLESTRING) { + if (ch == '\"') { + if (lastTagWasScript) + scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); + styler.ColourTo(i, SCE_H_DOUBLESTRING); + state = SCE_H_OTHER; + } + } else if (state == SCE_H_SINGLESTRING) { + if (ch == '\'') { + if (lastTagWasScript) + scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); + styler.ColourTo(i, SCE_H_SINGLESTRING); + state = SCE_H_OTHER; + } + } else if (state == SCE_HJ_DEFAULT || state == SCE_HJ_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HJ_WORD; + } else if (ch == '/' && chNext == '*') { + styler.ColourTo(i - 1, state); + if (chNext2 == '*') + state = SCE_HJ_COMMENTDOC; + else + state = SCE_HJ_COMMENT; + } else if (ch == '/' && chNext == '/') { + styler.ColourTo(i - 1, state); + state = SCE_HJ_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_HJ_DOUBLESTRING; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_HJ_SINGLESTRING; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HJ_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HJ_SYMBOLS); + state = SCE_HJ_DEFAULT; + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HJ_START) { + styler.ColourTo(i - 1, state); + state = SCE_HJ_DEFAULT; + } + } + } else if (state == SCE_HJ_WORD) { + if (!iswordchar(ch)) { + classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler); + //styler.ColourTo(i - 1, eHTJSKeyword); + state = SCE_HJ_DEFAULT; + if (ch == '/' && chNext == '*') { + if (chNext2 == '*') + state = SCE_HJ_COMMENTDOC; + else + state = SCE_HJ_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_HJ_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_HJ_DOUBLESTRING; + } else if (ch == '\'') { + state = SCE_HJ_SINGLESTRING; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HJ_SYMBOLS); + state = SCE_HJ_DEFAULT; + } + } + } else if (state == SCE_HJ_COMMENT) { + if (ch == '/' && chPrev == '*') { + state = SCE_HJ_DEFAULT; + styler.ColourTo(i, SCE_HJ_COMMENT); + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_TAGEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } + } else if (state == SCE_HJ_COMMENTDOC) { + if (ch == '/' && chPrev == '*') { + state = SCE_HJ_DEFAULT; + styler.ColourTo(i, SCE_HJ_COMMENTDOC); + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_TAGEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } + } else if (state == SCE_HJ_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, SCE_HJ_COMMENTLINE); + state = SCE_HJ_DEFAULT; + } else if ((ch == '<') && (chNext == '/')) { + // Common to hide end script tag in comment + styler.ColourTo(i - 1, SCE_HJ_COMMENTLINE); + state = SCE_H_TAGUNKNOWN; + } + } else if (state == SCE_HJ_DOUBLESTRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + } + } else if (ch == '\"') { + styler.ColourTo(i, SCE_HJ_DOUBLESTRING); + state = SCE_HJ_DEFAULT; + i++; + ch = chNext; + } else if (isLineEnd(ch)) { + styler.ColourTo(i-1, state); + state = SCE_HJ_STRINGEOL; + } + } else if (state == SCE_HJ_SINGLESTRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + } + } else if (ch == '\'') { + styler.ColourTo(i, SCE_HJ_SINGLESTRING); + state = SCE_HJ_DEFAULT; + i++; + ch = chNext; + } else if (isLineEnd(ch)) { + styler.ColourTo(i-1, state); + state = SCE_HJ_STRINGEOL; + } + } else if (state == SCE_HJ_STRINGEOL) { + if (!isLineEnd(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HJ_DEFAULT; + } else if (!isLineEnd(chNext)) { + styler.ColourTo(i, state); + state = SCE_HJ_DEFAULT; + } + } else if (state == SCE_HJA_DEFAULT || state == SCE_HJA_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HJA_WORD; + } else if (ch == '/' && chNext == '*') { + styler.ColourTo(i - 1, state); + if (chNext2 == '*') + state = SCE_HJA_COMMENTDOC; + else + state = SCE_HJA_COMMENT; + } else if (ch == '/' && chNext == '/') { + styler.ColourTo(i - 1, state); + state = SCE_HJA_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_HJA_DOUBLESTRING; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_HJA_SINGLESTRING; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HJA_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HJA_SYMBOLS); + state = SCE_HJA_DEFAULT; + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HJA_START) { + styler.ColourTo(i - 1, state); + state = SCE_HJA_DEFAULT; + } + } + } else if (state == SCE_HJA_WORD) { + if (!iswordchar(ch)) { + classifyWordHTJSA(styler.GetStartSegment(), i - 1, keywords2, styler); + //styler.ColourTo(i - 1, eHTJSKeyword); + state = SCE_HJA_DEFAULT; + if (ch == '/' && chNext == '*') { + if (chNext2 == '*') + state = SCE_HJA_COMMENTDOC; + else + state = SCE_HJA_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_HJA_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_HJA_DOUBLESTRING; + } else if (ch == '\'') { + state = SCE_HJA_SINGLESTRING; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HJA_SYMBOLS); + state = SCE_HJA_DEFAULT; + } + } + } else if (state == SCE_HJA_COMMENT) { + if (ch == '/' && chPrev == '*') { + state = SCE_HJA_DEFAULT; + styler.ColourTo(i, SCE_HJA_COMMENT); + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_TAGEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } + } else if (state == SCE_HJA_COMMENTDOC) { + if (ch == '/' && chPrev == '*') { + state = SCE_HJA_DEFAULT; + styler.ColourTo(i, SCE_HJA_COMMENTDOC); + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_TAGEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } + } else if (state == SCE_HJA_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, SCE_HJA_COMMENTLINE); + state = SCE_HJA_DEFAULT; + } else if ((ch == '<') && (chNext == '/')) { + // Common to hide end script tag in comment + styler.ColourTo(i - 1, SCE_HJA_COMMENTLINE); + state = SCE_H_TAGUNKNOWN; + } + } else if (state == SCE_HJA_DOUBLESTRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + } + } else if (ch == '\"') { + styler.ColourTo(i, SCE_HJA_DOUBLESTRING); + state = SCE_HJA_DEFAULT; + i++; + ch = chNext; + } else if (isLineEnd(ch)) { + styler.ColourTo(i-1, state); + state = SCE_HJA_STRINGEOL; + } + } else if (state == SCE_HJA_SINGLESTRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + } + } else if (ch == '\'') { + styler.ColourTo(i, SCE_HJA_SINGLESTRING); + state = SCE_HJA_DEFAULT; + i++; + ch = chNext; + } else if (isLineEnd(ch)) { + styler.ColourTo(i-1, state); + state = SCE_HJA_STRINGEOL; + } + } else if (state == SCE_HJA_STRINGEOL) { + if (!isLineEnd(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HJA_DEFAULT; + } else if (!isLineEnd(chNext)) { + styler.ColourTo(i, state); + state = SCE_HJA_DEFAULT; + } + } else if (state == SCE_HB_DEFAULT || state == SCE_HB_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HB_WORD; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_HB_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_HB_STRING; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HB_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HB_DEFAULT); + state = SCE_HB_DEFAULT; + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HB_START) { + styler.ColourTo(i - 1, state); + state = SCE_HB_DEFAULT; + } + } + } else if (state == SCE_HB_WORD) { + if (!iswordchar(ch)) { + state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler); + if (state == SCE_HB_DEFAULT) { + if (ch == '\"') { + state = SCE_HB_STRING; + } else if (ch == '\'') { + state = SCE_HB_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HB_DEFAULT); + state = SCE_HB_DEFAULT; + } + } + } + } else if (state == SCE_HB_STRING) { + if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_HB_DEFAULT; + i++; + ch = chNext; + } else if (ch == '\r' || ch == '\n') { + styler.ColourTo(i-1, state); + state = SCE_HB_STRINGEOL; + } + } else if (state == SCE_HB_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_HB_DEFAULT; + } else if ((ch == '<') && (chNext == '/')) { + // Common to hide end script tag in comment + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } + } else if (state == SCE_HB_STRINGEOL) { + if (!isLineEnd(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HB_DEFAULT; + } else if (!isLineEnd(chNext)) { + styler.ColourTo(i, state); + state = SCE_HB_DEFAULT; + } + } else if (state == SCE_HBA_DEFAULT || state == SCE_HBA_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HBA_WORD; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_HBA_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_HBA_STRING; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HBA_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HBA_DEFAULT); + state = SCE_HBA_DEFAULT; + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HBA_START) { + styler.ColourTo(i - 1, state); + state = SCE_HBA_DEFAULT; + } + } + } else if (state == SCE_HBA_WORD) { + if (!iswordchar(ch)) { + state = classifyWordHTVBA(styler.GetStartSegment(), i - 1, keywords3, styler); + if (state == SCE_HBA_DEFAULT) { + if (ch == '\"') { + state = SCE_HBA_STRING; + } else if (ch == '\'') { + state = SCE_HBA_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HBA_DEFAULT); + state = SCE_HBA_DEFAULT; + } + } + } + } else if (state == SCE_HBA_STRING) { + if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_HBA_DEFAULT; + i++; + ch = chNext; + } else if (ch == '\r' || ch == '\n') { + styler.ColourTo(i-1, state); + state = SCE_HBA_STRINGEOL; + } + } else if (state == SCE_HBA_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_HBA_DEFAULT; + } else if ((ch == '<') && (chNext == '/')) { + // Common to hide end script tag in comment + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } + } else if (state == SCE_HBA_STRINGEOL) { + if (!isLineEnd(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HBA_DEFAULT; + } else if (!isLineEnd(chNext)) { + styler.ColourTo(i, state); + state = SCE_HBA_DEFAULT; + } + } else if (state == SCE_HP_DEFAULT || state == SCE_HP_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HP_WORD; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HP_COMMENTLINE; + } else if (ch == '#') { + styler.ColourTo(i - 1, state); + state = SCE_HP_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_HP_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HP_STRING; + } + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_HP_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HP_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HP_OPERATOR); + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HP_START) { + styler.ColourTo(i - 1, state); + state = SCE_HP_DEFAULT; + } + } + } else if (state == SCE_HP_WORD) { + if (!iswordchar(ch)) { + classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord); + state = SCE_HP_DEFAULT; + if (ch == '#') { + state = SCE_HP_COMMENTLINE; + } else if (ch == '\"') { + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_HP_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HP_STRING; + } + } else if (ch == '\'') { + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_HP_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HP_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HP_OPERATOR); + } + } + } else if (state == SCE_HP_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_HP_DEFAULT; + } + } else if (state == SCE_HP_STRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_HP_DEFAULT; + } + } else if (state == SCE_HP_CHARACTER) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\'') { + styler.ColourTo(i, state); + state = SCE_HP_DEFAULT; + } + } else if (state == SCE_HP_TRIPLE) { + if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { + styler.ColourTo(i, state); + state = SCE_HP_DEFAULT; + } + } else if (state == SCE_HP_TRIPLEDOUBLE) { + if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { + styler.ColourTo(i, state); + state = SCE_HP_DEFAULT; + } + } else if (state == SCE_HPA_DEFAULT || state == SCE_HPA_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HPA_WORD; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HPA_COMMENTLINE; + } else if (ch == '#') { + styler.ColourTo(i - 1, state); + state = SCE_HPA_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_HPA_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HPA_STRING; + } + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_HPA_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HPA_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HPA_OPERATOR); + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HPA_START) { + styler.ColourTo(i - 1, state); + state = SCE_HPA_DEFAULT; + } + } + } else if (state == SCE_HPA_WORD) { + if (!iswordchar(ch)) { + classifyWordHTPyA(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord); + state = SCE_HPA_DEFAULT; + if (ch == '#') { + state = SCE_HPA_COMMENTLINE; + } else if (ch == '\"') { + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_HPA_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HPA_STRING; + } + } else if (ch == '\'') { + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_HPA_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HPA_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HPA_OPERATOR); + } + } + } else if (state == SCE_HPA_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_HPA_DEFAULT; + } + } else if (state == SCE_HPA_STRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_HPA_DEFAULT; + } + } else if (state == SCE_HPA_CHARACTER) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\'') { + styler.ColourTo(i, state); + state = SCE_HPA_DEFAULT; + } + } else if (state == SCE_HPA_TRIPLE) { + if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { + styler.ColourTo(i, state); + state = SCE_HPA_DEFAULT; + } + } else if (state == SCE_HPA_TRIPLEDOUBLE) { + if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { + styler.ColourTo(i, state); + state = SCE_HPA_DEFAULT; + } + } + if (state == SCE_HB_DEFAULT) { // One of the above succeeded + if (ch == '\"') { + state = SCE_HB_STRING; + } else if (ch == '\'') { + state = SCE_HB_COMMENTLINE; + } else if (iswordstart(ch)) { + state = SCE_HB_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HB_DEFAULT); + } + } + if (state == SCE_HBA_DEFAULT) { // One of the above succeeded + if (ch == '\"') { + state = SCE_HBA_STRING; + } else if (ch == '\'') { + state = SCE_HBA_COMMENTLINE; + } else if (iswordstart(ch)) { + state = SCE_HBA_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HBA_DEFAULT); + } + } + if (state == SCE_HJ_DEFAULT) { // One of the above succeeded + if (ch == '/' && chNext == '*') { + if (styler.SafeGetCharAt(i + 2) == '*') + state = SCE_HJ_COMMENTDOC; + else + state = SCE_HJ_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_HJ_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_HJ_DOUBLESTRING; + } else if (ch == '\'') { + state = SCE_HJ_SINGLESTRING; + } else if (iswordstart(ch)) { + state = SCE_HJ_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HJ_SYMBOLS); + } + } + if (state == SCE_HJA_DEFAULT) { // One of the above succeeded + if (ch == '/' && chNext == '*') { + if (styler.SafeGetCharAt(i + 2) == '*') + state = SCE_HJA_COMMENTDOC; + else + state = SCE_HJA_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_HJA_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_HJA_DOUBLESTRING; + } else if (ch == '\'') { + state = SCE_HJA_SINGLESTRING; + } else if (iswordstart(ch)) { + state = SCE_HJA_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HJA_SYMBOLS); + } + } + chPrev2 = chPrev; + chPrev = ch; + } + styler.ColourTo(lengthDoc - 1, state); +} + +LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc); +LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc); diff --git a/contrib/src/stc/scintilla/src/LexOthers.cxx b/contrib/src/stc/scintilla/src/LexOthers.cxx new file mode 100644 index 0000000000..90f41e3bf3 --- /dev/null +++ b/contrib/src/stc/scintilla/src/LexOthers.cxx @@ -0,0 +1,304 @@ +// SciTE - Scintilla based Text Editor +// LexOthers.cxx - lexers for properties files, batch files, make files and error lists +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static void ColouriseBatchLine(char *lineBuffer, int endLine, Accessor &styler) { + if (0 == strncmp(lineBuffer, "REM", 3)) { + styler.ColourTo(endLine, 1); + } else if (0 == strncmp(lineBuffer, "rem", 3)) { + styler.ColourTo(endLine, 1); + } else if (0 == strncmp(lineBuffer, "SET", 3)) { + styler.ColourTo(endLine, 2); + } else if (0 == strncmp(lineBuffer, "set", 3)) { + styler.ColourTo(endLine, 2); + } else if (lineBuffer[0] == ':') { + styler.ColourTo(endLine, 3); + } else { + styler.ColourTo(endLine, 0); + } +} + +static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + unsigned int linePos = 0; + for (unsigned int i = startPos; i < startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { + ColouriseBatchLine(lineBuffer, i, styler); + linePos = 0; + } + } + if (linePos > 0) + ColouriseBatchLine(lineBuffer, startPos + length, styler); +} + +static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, Accessor &styler) { + int i = 0; + while (isspace(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces + i++; + if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') { + styler.ColourTo(endPos, 1); + } else if (lineBuffer[i] == '[') { + styler.ColourTo(endPos, 2); + } else if (lineBuffer[i] == '@') { + styler.ColourTo(startLine+i, 4); + if (lineBuffer[++i] == '=') + styler.ColourTo(startLine+i, 3); + styler.ColourTo(endPos, 0); + } else { + while (lineBuffer[i] != '=' && (i < lengthLine)) // Search the '=' character + i++; + if (lineBuffer[i] == '=') { + styler.ColourTo(startLine+i-1, 0); + styler.ColourTo(startLine+i, 3); + styler.ColourTo(endPos, 0); + } else { + styler.ColourTo(endPos, 0); + } + } +} + +static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + unsigned int linePos = 0; + int startLine = startPos; + for (unsigned int i = startPos; i <= startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if ((styler[i] == '\r' && styler.SafeGetCharAt(i+1) != '\n') || + styler[i] == '\n' || + (linePos >= sizeof(lineBuffer) - 1)) { + lineBuffer[linePos] = '\0'; + ColourisePropsLine(lineBuffer, linePos, startLine, i, styler); + linePos = 0; + startLine = i+1; + } + } + if (linePos > 0) + ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length, styler); +} + +static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) { + int i = 0; + while (isspace(lineBuffer[i]) && (i < lengthLine)) + i++; + if (lineBuffer[i] == '#' || lineBuffer[i] == '!') { + styler.ColourTo(endPos, 1); + } else { + styler.ColourTo(endPos, 0); + } +} + +static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + unsigned int linePos = 0; + for (unsigned int i = startPos; i <= startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { + ColouriseMakeLine(lineBuffer, linePos, i, styler); + linePos = 0; + } + } + if (linePos > 0) + ColouriseMakeLine(lineBuffer, linePos, startPos + length, styler); +} + +static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) { + if (lineBuffer[0] == '>') { + // Command or return status + styler.ColourTo(endPos, 4); + } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) { + styler.ColourTo(endPos, 1); + } else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) { + // Borland error message + styler.ColourTo(endPos, 5); + } else if (0 == strncmp(lineBuffer, "Warning ", strlen("Warning "))) { + // Borland warning message + styler.ColourTo(endPos, 5); + } else { + // Look for <filename>:<line>:message + // Look for <filename>(line)message + // Look for <filename>(line,pos)message + int state = 0; + for (int i = 0; i < lengthLine; i++) { + if (state == 0 && lineBuffer[i] == ':' && isdigit(lineBuffer[i + 1])) { + state = 1; + } else if (state == 0 && lineBuffer[i] == '(') { + state = 10; + } else if (state == 1 && isdigit(lineBuffer[i])) { + state = 2; + } else if (state == 2 && lineBuffer[i] == ':') { + state = 3; + break; + } else if (state == 2 && !isdigit(lineBuffer[i])) { + state = 99; + } else if (state == 10 && isdigit(lineBuffer[i])) { + state = 11; + } else if (state == 11 && lineBuffer[i] == ',') { + state = 14; + } else if (state == 11 && lineBuffer[i] == ')') { + state = 12; + } else if (state == 12 && lineBuffer[i] == ':') { + state = 13; + } else if (state == 14 && lineBuffer[i] == ')') { + state = 15; + break; + } else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) { + state = 99; + } + } + if (state == 3) { + styler.ColourTo(endPos, 2); + } else if ((state == 13) || (state == 14) || (state == 15)) { + styler.ColourTo(endPos, 3); + } else { + styler.ColourTo(endPos, 0); + } + } +} + +static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + unsigned int linePos = 0; + for (unsigned int i = startPos; i <= startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { + ColouriseErrorListLine(lineBuffer, linePos, i, styler); + linePos = 0; + } + } + if (linePos > 0) + ColouriseErrorListLine(lineBuffer, linePos, startPos + length, styler); +} + +static int isSpecial(char s) { + + return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') || + (s == '\"') || (s == '`') || (s == '^') || (s == '~'); +} + +static int isTag(int start, Accessor &styler) { + + char s[6]; + unsigned int i = 0, e=1; + while (i < 5 && e) { + s[i] = styler[start + i]; + i++; + e = styler[start + i] != '{'; + } + s[i] = '\0'; + return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0); +} + +static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle, + WordList *[], Accessor &styler) { + + styler.StartAt(startPos); + + int state = initStyle; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + int lengthDoc = startPos + length; + + for (int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + i++; + continue; + } + switch(state) { + case SCE_L_DEFAULT : + switch(ch) { + case '\\' : + styler.ColourTo(i - 1, state); + if (isSpecial(styler[i + 1])) { + styler.ColourTo(i + 1, SCE_L_COMMAND); + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + else { + if (isTag(i+1, styler)) + state = SCE_L_TAG; + else + state = SCE_L_COMMAND; + } + break; + case '$' : + styler.ColourTo(i - 1, state); + state = SCE_L_MATH; + if (chNext == '$') { + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case '%' : + styler.ColourTo(i - 1, state); + state = SCE_L_COMMENT; + break; + } + break; + case SCE_L_COMMAND : + if (chNext == '[' || chNext == '{' || chNext == '}' || + chNext == ' ' || chNext == '\r' || chNext == '\n') { + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case SCE_L_TAG : + if (ch == '}') { + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + } + break; + case SCE_L_MATH : + if (ch == '$') { + if (chNext == '$') { + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + } + break; + case SCE_L_COMMENT : + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_L_DEFAULT; + } + } + } + styler.ColourTo(lengthDoc, state); +} + +LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc); +LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc); +LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc); +LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc); +LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc); diff --git a/contrib/src/stc/scintilla/src/LexPerl.cxx b/contrib/src/stc/scintilla/src/LexPerl.cxx new file mode 100644 index 0000000000..3c9972e2d6 --- /dev/null +++ b/contrib/src/stc/scintilla/src/LexPerl.cxx @@ -0,0 +1,480 @@ +// SciTE - Scintilla based Text Editor +// LexPerl.cxx - lexer for subset of Perl +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +inline bool isPerlOperator(char ch) { + if (isalnum(ch)) + return false; + // '.' left out as it is used to make up numbers + if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '\\' || + ch == '(' || ch == ')' || ch == '-' || ch == '+' || + ch == '=' || ch == '|' || ch == '{' || ch == '}' || + ch == '[' || ch == ']' || ch == ':' || ch == ';' || + ch == '<' || ch == '>' || ch == ',' || ch == '/' || + ch == '?' || ch == '!' || ch == '.' || ch == '~') + return true; + return false; +} + +static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_PL_IDENTIFIER; + if (wordIsNumber) + chAttr = SCE_PL_NUMBER; + else { + if (keywords.InList(s)) + chAttr = SCE_PL_WORD; + } + styler.ColourTo(end, chAttr); + return chAttr; +} + +static bool isEndVar(char ch) { + return !isalnum(ch) && ch != '#' && ch != '$' && + ch != '_' && ch != '\''; +} + +static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) { + if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) { + return false; + } + while (*val) { + if (*val != styler[pos++]) { + return false; + } + val++; + } + return true; +} + +static char opposite(char ch) { + if (ch == '(') + return ')'; + if (ch == '[') + return ']'; + if (ch == '{') + return '}'; + if (ch == '<') + return '>'; + return ch; +} + +static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + // Lexer for perl often has to backtrack to start of current style to determine + // which characters are being used as quotes, how deeply nested is the + // start position and what the termination string is for here documents + + WordList &keywords = *keywordlists[0]; + + char sooked[100]; + int quotes = 0; + char quoteDown = 'd'; + char quoteUp = 'd'; + int quoteRep = 1; + int sookedpos = 0; + bool preferRE = true; + sooked[sookedpos] = '\0'; + int state = initStyle; + int lengthDoc = startPos + length; + // If in a long distance lexical state, seek to the beginning to find quote characters + if (state == SCE_PL_HERE || state == SCE_PL_REGEX || + state == SCE_PL_REGSUBST || state == SCE_PL_LONGQUOTE) { + while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) { + startPos--; + } + state = SCE_PL_DEFAULT; + } + styler.StartAt(startPos); + char chPrev = ' '; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + for (int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + char chNext2 = styler.SafeGetCharAt(i + 2); + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + i += 1; + continue; + } + + if (state == SCE_PL_DEFAULT) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + if (ch == 's' && !isalnum(chNext)) { + state = SCE_PL_REGSUBST; + quotes = 0; + quoteUp = '\0'; + quoteDown = '\0'; + quoteRep = 2; + } else if (ch == 'm' && !isalnum(chNext)) { + state = SCE_PL_REGEX; + quotes = 0; + quoteUp = '\0'; + quoteDown = '\0'; + quoteRep = 1; + } else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) { + state = SCE_PL_REGSUBST; + quotes = 0; + quoteUp = '\0'; + quoteDown = '\0'; + quoteRep = 2; + i++; + chNext = chNext2; + } else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) { + state = SCE_PL_LONGQUOTE; + i++; + chNext = chNext2; + quotes = 0; + quoteUp = '\0'; + quoteDown = '\0'; + quoteRep = 1; + } else { + state = SCE_PL_WORD; + preferRE = false; + } + } else if (ch == '#') { + styler.ColourTo(i - 1, state); + state = SCE_PL_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_PL_STRING; + } else if (ch == '\'') { + if (chPrev == '&') { + // Archaic call + styler.ColourTo(i, state); + } else { + styler.ColourTo(i - 1, state); + state = SCE_PL_CHARACTER; + } + } else if (ch == '`') { + styler.ColourTo(i - 1, state); + state = SCE_PL_BACKTICKS; + } else if (ch == '$') { + preferRE = false; + styler.ColourTo(i - 1, state); + if (isalnum(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { + state = SCE_PL_SCALAR; + } else if (chNext != '{' && chNext != '[') { + styler.ColourTo(i, SCE_PL_SCALAR); + i++; + ch = ' '; + chNext = ' '; + } else { + styler.ColourTo(i, SCE_PL_SCALAR); + } + } else if (ch == '@') { + preferRE = false; + styler.ColourTo(i - 1, state); + if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { + state = SCE_PL_ARRAY; + } else if (chNext != '{' && chNext != '[') { + styler.ColourTo(i, SCE_PL_ARRAY); + i++; + ch = ' '; + } else { + styler.ColourTo(i, SCE_PL_ARRAY); + } + } else if (ch == '%') { + preferRE = false; + styler.ColourTo(i - 1, state); + if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { + state = SCE_PL_HASH; + } else if (chNext != '{' && chNext != '[') { + styler.ColourTo(i, SCE_PL_HASH); + i++; + ch = ' '; + } else { + styler.ColourTo(i, SCE_PL_HASH); + } + } else if (ch == '*') { + styler.ColourTo(i - 1, state); + state = SCE_PL_SYMBOLTABLE; + } else if (ch == '/' && preferRE) { + styler.ColourTo(i - 1, state); + state = SCE_PL_REGEX; + quoteUp = '/'; + quoteDown = '/'; + quotes = 1; + quoteRep = 1; + } else if (ch == '<' && chNext == '<') { + styler.ColourTo(i - 1, state); + state = SCE_PL_HERE; + i++; + ch = chNext; + chNext = chNext2; + quotes = 0; + sookedpos = 0; + sooked[sookedpos] = '\0'; + } else if (ch == '=' && isalpha(chNext)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_POD; + quotes = 0; + sookedpos = 0; + sooked[sookedpos] = '\0'; + } else if (isPerlOperator(ch)) { + if (ch == ')' || ch == ']') + preferRE = false; + else + preferRE = true; + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_PL_OPERATOR); + } + } else if (state == SCE_PL_WORD) { + if (!iswordchar(ch) && ch != '\'') { // Archaic Perl has quotes inside names + if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")) { + styler.ColourTo(i, SCE_PL_DATASECTION); + state = SCE_PL_DATASECTION; + } else if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__END__")) { + styler.ColourTo(i, SCE_PL_DATASECTION); + state = SCE_PL_DATASECTION; + } else { + if (classifyWordPerl(styler.GetStartSegment(), i - 1, keywords, styler) == SCE_PL_WORD) + preferRE = true; + state = SCE_PL_DEFAULT; + if (ch == '#') { + state = SCE_PL_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_PL_STRING; + } else if (ch == '\'') { + state = SCE_PL_CHARACTER; + } else if (ch == '<' && chNext == '<') { + state = SCE_PL_HERE; + quotes = 0; + sookedpos = 0; + sooked[sookedpos] = '\0'; + } else if (isPerlOperator(ch)) { + if (ch == ')' || ch == ']') + preferRE = false; + else + preferRE = true; + styler.ColourTo(i, SCE_PL_OPERATOR); + state = SCE_PL_DEFAULT; + } + } + } + } else { + if (state == SCE_PL_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_HERE) { + if (isalnum(ch) && quotes < 2) { + sooked[sookedpos++] = ch; + sooked[sookedpos] = '\0'; + if (quotes == 0) + quotes = 1; + } else { + quotes++; + } + if (quotes > 1 && isMatch(styler, lengthDoc, i, sooked) && (chPrev == '\n' || chPrev == '\r') ) { + styler.ColourTo(i + sookedpos - 1, SCE_PL_HERE); + i += sookedpos; + chNext = styler.SafeGetCharAt(i); + if (chNext == '\n' || chNext == '\r') { + state = SCE_PL_DEFAULT; + } + chNext = ' '; + } + } else if (state == SCE_PL_STRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (state == SCE_PL_CHARACTER) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\'') { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (state == SCE_PL_BACKTICKS) { + if (ch == '`') { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (state == SCE_PL_POD) { + if (ch == '=') { + if (isMatch(styler, lengthDoc, i, "=cut")) { + styler.ColourTo(i - 1 + 4, state); + i += 4; + state = SCE_PL_DEFAULT; + chNext = ' '; + ch = ' '; + } + } + } else if (state == SCE_PL_SCALAR) { + if (isEndVar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_ARRAY) { + if (isEndVar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_HASH) { + if (isEndVar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_SYMBOLTABLE) { + if (isEndVar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_REF) { + if (isEndVar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_REGEX) { + if (!quoteUp && !isspace(ch)) { + quoteUp = ch; + quoteDown = opposite(ch); + quotes++; + } else { + if (ch == quoteDown && chPrev != '\\') { + quotes--; + if (quotes == 0) { + quoteRep--; + if (quoteUp == quoteDown) { + quotes++; + } + } + if (!isalpha(chNext)) { + if (quoteRep <= 0) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } + } + } else if (ch == quoteUp && chPrev != '\\') { + quotes++; + } else if (!isalpha(chNext)) { + if (quoteRep <= 0) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } + } + } + } else if (state == SCE_PL_REGSUBST) { + if (!quoteUp && !isspace(ch)) { + quoteUp = ch; + quoteDown = opposite(ch); + quotes++; + } else { + if (ch == quoteDown && chPrev != '\\') { + quotes--; + if (quotes == 0) { + quoteRep--; + } + if (!isalpha(chNext)) { + if (quoteRep <= 0) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } + } + if (quoteUp == quoteDown) { + quotes++; + } + } else if (ch == quoteUp && chPrev != '\\') { + quotes++; + } else if (!isalpha(chNext)) { + if (quoteRep <= 0) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } + } + } + } else if (state == SCE_PL_LONGQUOTE) { + if (!quoteDown && !isspace(ch)) { + quoteUp = ch; + quoteDown = opposite(quoteUp); + quotes++; + } else if (ch == quoteDown) { + quotes--; + if (quotes == 0) { + quoteRep--; + if (quoteRep <= 0) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } + if (quoteUp == quoteDown) { + quotes++; + } + } + } else if (ch == quoteUp) { + quotes++; + } + } + + if (state == SCE_PL_DEFAULT) { // One of the above succeeded + if (ch == '#') { + state = SCE_PL_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_PL_STRING; + } else if (ch == '\'') { + state = SCE_PL_CHARACTER; + } else if (iswordstart(ch)) { + state = SCE_PL_WORD; + preferRE = false; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_PL_OPERATOR); + } + } + } + chPrev = ch; + } + styler.ColourTo(lengthDoc, state); +} + +LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc); diff --git a/contrib/src/stc/scintilla/src/LexPython.cxx b/contrib/src/stc/scintilla/src/LexPython.cxx new file mode 100644 index 0000000000..df8b7085bf --- /dev/null +++ b/contrib/src/stc/scintilla/src/LexPython.cxx @@ -0,0 +1,274 @@ +// SciTE - Scintilla based Text Editor +// LexPython.cxx - lexer for Python +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_P_IDENTIFIER; + if (0 == strcmp(prevWord, "class")) + chAttr = SCE_P_CLASSNAME; + else if (0 == strcmp(prevWord, "def")) + chAttr = SCE_P_DEFNAME; + else if (wordIsNumber) + chAttr = SCE_P_NUMBER; + else if (keywords.InList(s)) + chAttr = SCE_P_WORD; + styler.ColourTo(end, chAttr); + strcpy(prevWord, s); +} + +static bool IsPyComment(Accessor &styler, int pos, int len) { + return len>0 && styler[pos]=='#'; +} + +static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + int lengthDoc = startPos + length; + + // Backtrack to previous line in case need to fix its fold status or tab whinging + int lineCurrent = styler.GetLine(startPos); + if (startPos > 0) { + if (lineCurrent > 0) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); + if (startPos == 0) + initStyle = SCE_P_DEFAULT; + else + initStyle = styler.StyleAt(startPos-1); + } + } + + // Python uses a different mask because bad indentation is marked by oring with 32 + styler.StartAt(startPos, 127); + + WordList &keywords = *keywordlists[0]; + + bool fold = styler.GetPropertyInt("fold"); + int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level"); + char prevWord[200]; + prevWord[0] = '\0'; + if (length == 0) + return ; + int spaceFlags = 0; + + int state = initStyle & 31; + + int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); + if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) + indentCurrent |= SC_FOLDLEVELWHITEFLAG; + + char chPrev = ' '; + char chPrev2 = ' '; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + bool atStartLine = true; + for (int i = startPos; i < lengthDoc; i++) { + + if (atStartLine) { + char chBad = static_cast<char>(64); + char chGood = static_cast<char>(0); + char chFlags = chGood; + if (whingeLevel == 1) { + chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood; + } else if (whingeLevel == 2) { + chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood; + } else if (whingeLevel == 3) { + chFlags = (spaceFlags & wsSpace) ? chBad : chGood; + } else if (whingeLevel == 4) { + chFlags = (spaceFlags & wsTab) ? chBad : chGood; + } + styler.SetFlags(chFlags, static_cast<char>(state)); + atStartLine = false; + } + + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + char chNext2 = styler.SafeGetCharAt(i + 2); + + if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) { + if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) { + // Perform colourisation of white space and triple quoted strings at end of each line to allow + // tab marking to work inside white space and triple quoted strings + styler.ColourTo(i, state); + } + + int lev = indentCurrent; + int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsPyComment); + if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) + indentNext |= SC_FOLDLEVELWHITEFLAG; + if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { + // Only non whitespace lines can be headers + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { + // Line after is blank so check the next - maybe should continue further? + int spaceFlags2 = 0; + int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsPyComment); + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + } + } + indentCurrent = indentNext; + if (fold) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + atStartLine = true; + } + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + chPrev2 = ' '; + i += 1; + continue; + } + + if (state == SCE_P_STRINGEOL) { + if (ch != '\r' && ch != '\n') { + styler.ColourTo(i - 1, state); + state = SCE_P_DEFAULT; + } + } + if (state == SCE_P_DEFAULT) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_P_WORD; + } else if (ch == '#') { + styler.ColourTo(i - 1, state); + state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_P_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_P_STRING; + } + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_P_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_P_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_P_OPERATOR); + } + } else if (state == SCE_P_WORD) { + if (!iswordchar(ch)) { + ClassifyWordPy(styler.GetStartSegment(), i - 1, keywords, styler, prevWord); + state = SCE_P_DEFAULT; + if (ch == '#') { + state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE; + } else if (ch == '\"') { + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_P_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_P_STRING; + } + } else if (ch == '\'') { + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_P_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_P_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_P_OPERATOR); + } + } + } else { + if (state == SCE_P_COMMENTLINE || state == SCE_P_COMMENTBLOCK) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_P_DEFAULT; + } + } else if (state == SCE_P_STRING) { + if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { + styler.ColourTo(i - 1, state); + state = SCE_P_STRINGEOL; + } else if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_P_DEFAULT; + } + } else if (state == SCE_P_CHARACTER) { + if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { + styler.ColourTo(i - 1, state); + state = SCE_P_STRINGEOL; + } else if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\'') { + styler.ColourTo(i, state); + state = SCE_P_DEFAULT; + } + } else if (state == SCE_P_TRIPLE) { + if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { + styler.ColourTo(i, state); + state = SCE_P_DEFAULT; + } + } else if (state == SCE_P_TRIPLEDOUBLE) { + if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { + styler.ColourTo(i, state); + state = SCE_P_DEFAULT; + } + } + } + chPrev2 = chPrev; + chPrev = ch; + } + if (state == SCE_P_WORD) { + ClassifyWordPy(styler.GetStartSegment(), lengthDoc, keywords, styler, prevWord); + } else { + styler.ColourTo(lengthDoc, state); + } +} + +LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc); diff --git a/contrib/src/stc/scintilla/src/LexSQL.cxx b/contrib/src/stc/scintilla/src/LexSQL.cxx new file mode 100644 index 0000000000..facd0e6b7b --- /dev/null +++ b/contrib/src/stc/scintilla/src/LexSQL.cxx @@ -0,0 +1,156 @@ +// SciTE - Scintilla based Text Editor +// LexSQL.cxx - lexer for SQL +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(toupper(styler[start + i])); + s[i + 1] = '\0'; + } + char chAttr = SCE_C_IDENTIFIER; + if (wordIsNumber) + chAttr = SCE_C_NUMBER; + else { + if (keywords.InList(s)) + chAttr = SCE_C_WORD; + } + styler.ColourTo(end, chAttr); +} + +static void ColouriseSQLDoc(unsigned int startPos, int length, + int initStyle, WordList *keywordlists[], Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + + styler.StartAt(startPos); + + bool fold = styler.GetPropertyInt("fold"); + int lineCurrent = styler.GetLine(startPos); + int spaceFlags = 0; + + int state = initStyle; + char chPrev = ' '; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + unsigned int lengthDoc = startPos + length; + for (unsigned int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { + int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags); + int lev = indentCurrent; + if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { + // Only non whitespace lines can be headers + int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags); + if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + } + if (fold) { + styler.SetLevel(lineCurrent, lev); + } + } + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + i += 1; + continue; + } + + if (state == SCE_C_DEFAULT) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_C_WORD; + } else if (ch == '/' && chNext == '*') { + styler.ColourTo(i - 1, state); + state = SCE_C_COMMENT; + } else if (ch == '-' && chNext == '-') { + styler.ColourTo(i - 1, state); + state = SCE_C_COMMENTLINE; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_C_STRING; + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_C_OPERATOR); + } + } else if (state == SCE_C_WORD) { + if (!iswordchar(ch)) { + classifyWordSQL(styler.GetStartSegment(), i - 1, keywords, styler); + state = SCE_C_DEFAULT; + if (ch == '/' && chNext == '*') { + state = SCE_C_COMMENT; + } else if (ch == '-' && chNext == '-') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\'') { + state = SCE_C_STRING; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_C_OPERATOR); + } + } + } else { + if (state == SCE_C_COMMENT) { + if (ch == '/' && chPrev == '*') { + if (((i > (styler.GetStartSegment() + 2)) || ((initStyle == SCE_C_COMMENT) && + (styler.GetStartSegment() == startPos)))) { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + } + } + } else if (state == SCE_C_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_STRING) { + if (ch == '\'') { + if ( chNext == '\'' ) { + i++; + } else { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + i++; + } + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } + if (state == SCE_C_DEFAULT) { // One of the above succeeded + if (ch == '/' && chNext == '*') { + state = SCE_C_COMMENT; + } else if (ch == '-' && chNext == '-') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\'') { + state = SCE_C_STRING; + } else if (iswordstart(ch)) { + state = SCE_C_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_C_OPERATOR); + } + } + } + chPrev = ch; + } + styler.ColourTo(lengthDoc - 1, state); +} + +LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc); diff --git a/contrib/src/stc/scintilla/src/LexVB.cxx b/contrib/src/stc/scintilla/src/LexVB.cxx new file mode 100644 index 0000000000..acc3b0d548 --- /dev/null +++ b/contrib/src/stc/scintilla/src/LexVB.cxx @@ -0,0 +1,118 @@ +// SciTE - Scintilla based Text Editor +// LexVB.cxx - lexer for Visual Basic and VBScript +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(tolower(styler[start + i])); + s[i + 1] = '\0'; + } + char chAttr = SCE_C_DEFAULT; + if (wordIsNumber) + chAttr = SCE_C_NUMBER; + else { + if (keywords.InList(s)) { + chAttr = SCE_C_WORD; + if (strcmp(s, "rem") == 0) + chAttr = SCE_C_COMMENTLINE; + } + } + styler.ColourTo(end, chAttr); + if (chAttr == SCE_C_COMMENTLINE) + return SCE_C_COMMENTLINE; + else + return SCE_C_DEFAULT; +} + +static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + + styler.StartAt(startPos); + + int state = initStyle; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + int lengthDoc = startPos + length; + for (int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + i += 1; + continue; + } + + if (state == SCE_C_DEFAULT) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_C_WORD; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_C_STRING; + } + } else if (state == SCE_C_WORD) { + if (!iswordchar(ch)) { + state = classifyWordVB(styler.GetStartSegment(), i - 1, keywords, styler); + if (state == SCE_C_DEFAULT) { + if (ch == '\'') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_C_STRING; + } + } + } + } else { + if (state == SCE_C_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_STRING) { + // VB doubles quotes to preserve them + if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } + if (state == SCE_C_DEFAULT) { // One of the above succeeded + if (ch == '\'') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_C_STRING; + } else if (iswordstart(ch)) { + state = SCE_C_WORD; + } + } + } + } + styler.ColourTo(lengthDoc, state); +} + +LexerModule lmVB(SCLEX_VB, ColouriseVBDoc); diff --git a/contrib/src/stc/scintilla/src/LineMarker.cxx b/contrib/src/stc/scintilla/src/LineMarker.cxx index 9afccb8227..f54978c3fc 100644 --- a/contrib/src/stc/scintilla/src/LineMarker.cxx +++ b/contrib/src/stc/scintilla/src/LineMarker.cxx @@ -51,20 +51,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) { } else if (markType == SC_MARK_PLUS) { int armSize = dimOn2-2; - Point xpts[] = { - Point(centreX - armSize, centreY), - Point(centreX, centreY), - Point(centreX, centreY - armSize), - Point(centreX, centreY - armSize), - Point(centreX, centreY), - Point(centreX + armSize, centreY), - Point(centreX + armSize, centreY), - Point(centreX, centreY), - Point(centreX, centreY + armSize), - Point(centreX, centreY + armSize), - Point(centreX, centreY), - Point(centreX - armSize, centreY), - }; Point pts[] = { Point(centreX - armSize, centreY - 1), Point(centreX - 1, centreY - 1), @@ -90,12 +76,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) { Point(centreX + armSize, centreY +1), Point(centreX - armSize, centreY + 1), }; - Point xpts[] = { - Point(centreX - armSize, centreY), - Point(centreX + armSize, centreY), - Point(centreX + armSize, centreY), - Point(centreX - armSize, centreY), - }; surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), fore.allocated, back.allocated); diff --git a/contrib/src/stc/scintilla/src/PropSet.cxx b/contrib/src/stc/scintilla/src/PropSet.cxx index 7e2a906a47..d3dbabaf3b 100644 --- a/contrib/src/stc/scintilla/src/PropSet.cxx +++ b/contrib/src/stc/scintilla/src/PropSet.cxx @@ -27,6 +27,7 @@ bool EqualCaseInsensitive(const char *a, const char *b) { // Get a line of input. If end of line escaped with '\\' then continue reading. static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) { bool continuation = true; + s[0] = '\0'; while ((len > 1) && lenData > 0) { char ch = *fpc; fpc++; @@ -38,7 +39,7 @@ static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) { fpc++; lenData--; } - *s++ = '\0'; + *s = '\0'; return true; } } else if ((ch == '\\') && (lenData > 0) && ((*fpc == '\r') || (*fpc == '\n'))) { @@ -46,6 +47,7 @@ static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) { } else { continuation = false; *s++ = ch; + *s = '\0'; len--; } } @@ -120,7 +122,7 @@ SString PropSet::Get(const char *key) { int PropSet::GetInt(const char *key, int defaultValue) { SString val = Get(key); if (val.length()) - return Get(key).value(); + return val.value(); else return defaultValue; } @@ -253,6 +255,9 @@ void PropSet::ReadFromMemory(const char *data, int len) { if (isalpha(linebuf[0])) Set(linebuf); } + // If there is a final line: + if (isalpha(linebuf[0])) + Set(linebuf); } } @@ -371,7 +376,7 @@ bool WordList::InList(const char *s) { for (int i = 0; words[i][0]; i++) len++; SortWordList(words, len); - for (int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++) + for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++) starts[k] = -1; for (int l = len - 1; l >= 0; l--) { unsigned char indexChar = words[l][0]; diff --git a/contrib/src/stc/scintilla/src/SVector.h b/contrib/src/stc/scintilla/src/SVector.h index 49fc376dda..550dd87ebd 100644 --- a/contrib/src/stc/scintilla/src/SVector.h +++ b/contrib/src/stc/scintilla/src/SVector.h @@ -30,7 +30,7 @@ class SVector { return; } size = newSize; - for (int i=0; i<len; i++) { + for (unsigned int i=0; i<len; i++) { newv[i] = v[i]; } delete []v; @@ -94,13 +94,13 @@ public: size = 0; len = 0; } - void SetLength(int newLen) { - if (newLen > len) { - if (newLen >= size) { - SizeTo(newLen); + void SetLength(unsigned int newLength) { + if (newLength > len) { + if (newLength >= size) { + SizeTo(newLength); } } - len = newLen; + len = newLength; } int Length() const { return len; diff --git a/contrib/src/stc/scintilla/src/ScintillaBase.cxx b/contrib/src/stc/scintilla/src/ScintillaBase.cxx index eb68904b79..87b84f7064 100644 --- a/contrib/src/stc/scintilla/src/ScintillaBase.cxx +++ b/contrib/src/stc/scintilla/src/ScintillaBase.cxx @@ -15,6 +15,8 @@ #include "SciLexer.h" #include "PropSet.h" #include "Accessor.h" +#include "WindowAccessor.h" +#include "DocumentAccessor.h" #include "KeyWords.h" #endif #include "ContractionState.h" @@ -50,11 +52,11 @@ void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) { ct.RefreshColourPalette(pal, want); } -void ScintillaBase::AddChar(char ch) { +void ScintillaBase::AddCharUTF(char *s, unsigned int len) { bool acActiveBeforeCharAdded = ac.Active(); - Editor::AddChar(ch); + Editor::AddCharUTF(s, len); if (acActiveBeforeCharAdded) - AutoCompleteChanged(ch); + AutoCompleteChanged(s[0]); } void ScintillaBase::Command(int cmdId) { @@ -276,20 +278,20 @@ void ScintillaBase::Colourise(int start, int end) { end = lengthDoc; int len = end - start; - PropSet props; - - StylingContext styler(wMain.GetID(), props); + //WindowAccessor styler(wMain.GetID(), props); + DocumentAccessor styler(pdoc, props); int styleStart = 0; if (start > 0) styleStart = styler.StyleAt(start - 1); - - ColouriseDoc(pdoc->dbcsCodePage, start, len, styleStart, lexLanguage, keyWordLists, styler); + styler.SetCodePage(pdoc->dbcsCodePage); + + LexerModule::Colourise(start, len, styleStart, lexLanguage, keyWordLists, styler); styler.Flush(); } #endif -void ScintillaBase::NotifyStyleNeeded(int endStyleNeeded) { +void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { #ifdef SCI_LEXER if (lexLanguage != SCLEX_CONTAINER) { int endStyled = Platform::SendScintilla(wMain.GetID(), SCI_GETENDSTYLED, 0, 0); @@ -299,7 +301,7 @@ void ScintillaBase::NotifyStyleNeeded(int endStyleNeeded) { return; } #endif - Editor::NotifyStyleNeeded(endStyleNeeded); + Editor::NotifyStyleToNeeded(endStyleNeeded); } LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { @@ -322,9 +324,20 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { AutoCompleteCompleted(); break; + case SCI_AUTOCSETSEPARATOR: + ac.SetSeparator(wParam); + break; + + case SCI_AUTOCGETSEPARATOR: + return ac.GetSeparator(); + case SCI_AUTOCSTOPS: ac.SetStopChars(reinterpret_cast<char *>(lParam)); break; + + case SCI_AUTOCSELECT: + ac.Select(reinterpret_cast<char *>(lParam)); + break; case SCI_CALLTIPSHOW: { AutoCompleteCancel(); @@ -377,6 +390,7 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_COLOURISE: Colourise(wParam, lParam); + Redraw(); break; case SCI_SETPROPERTY: @@ -385,7 +399,7 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { break; case SCI_SETKEYWORDS: - if ((wParam >= 0) && (wParam < numWordLists)) { + if (wParam < numWordLists) { keyWordLists[wParam]->Clear(); keyWordLists[wParam]->Set(reinterpret_cast<const char *>(lParam)); } diff --git a/contrib/src/stc/scintilla/src/ScintillaBase.h b/contrib/src/stc/scintilla/src/ScintillaBase.h index e9f8f28d03..6344b17a34 100644 --- a/contrib/src/stc/scintilla/src/ScintillaBase.h +++ b/contrib/src/stc/scintilla/src/ScintillaBase.h @@ -7,6 +7,9 @@ #define SCINTILLABASE_H class ScintillaBase : public Editor { + // Private so ScintillaBase objects can not be copied + ScintillaBase(const ScintillaBase &) : Editor() {} + ScintillaBase &operator=(const ScintillaBase &) { return *this; } protected: // Enumeration of commands and child windows enum { @@ -42,7 +45,7 @@ protected: virtual void RefreshColourPalette(Palette &pal, bool want); - virtual void AddChar(char ch); + virtual void AddCharUTF(char *s, unsigned int len); void Command(int cmdId); virtual int KeyCommand(UINT iMessage); @@ -59,7 +62,7 @@ protected: virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); - virtual void NotifyStyleNeeded(int endStyleNeeded); + virtual void NotifyStyleToNeeded(int endStyleNeeded); public: // Public so scintilla_send_message can use it virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam); diff --git a/contrib/src/stc/scintilla/src/Style.cxx b/contrib/src/stc/scintilla/src/Style.cxx index 56312314ff..7aa44c0eb9 100644 --- a/contrib/src/stc/scintilla/src/Style.cxx +++ b/contrib/src/stc/scintilla/src/Style.cxx @@ -7,49 +7,108 @@ #include "Platform.h" +#include "Scintilla.h" #include "Style.h" Style::Style() { - Clear(); + aliasOfDefaultFont = true; + Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), + Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT, + false, false, false, false); +} + +Style::Style(const Style &source) { + Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), + 0, 0, 0, + false, false, false, false); + fore.desired = source.fore.desired; + back.desired = source.back.desired; + characterSet = source.characterSet; + bold = source.bold; + italic = source.italic; + size = source.size; + eolFilled = source.eolFilled; + underline = source.underline; } Style::~Style() { - font.Release(); + if (aliasOfDefaultFont) + font.SetID(0); + else + font.Release(); + aliasOfDefaultFont = false; } Style &Style::operator=(const Style &source) { if (this == &source) return *this; - Clear(); + Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), + 0, 0, SC_CHARSET_DEFAULT, + false, false, false, false); fore.desired = source.fore.desired; back.desired = source.back.desired; + characterSet = source.characterSet; bold = source.bold; italic = source.italic; size = source.size; - strcpy(fontName, source.fontName); eolFilled = source.eolFilled; + underline = source.underline; return *this; } -void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_, - bool bold_, bool italic_, bool eolFilled_) { +void Style::Clear(Colour fore_, Colour back_, int size_, + const char *fontName_, int characterSet_, + bool bold_, bool italic_, bool eolFilled_, bool underline_) { fore.desired = fore_; back.desired = back_; + characterSet = characterSet_; bold = bold_; italic = italic_; size = size_; - strcpy(fontName, fontName_); + fontName = fontName_; eolFilled = eolFilled_; - font.Release(); + underline = underline_; + if (aliasOfDefaultFont) + font.SetID(0); + else + font.Release(); + aliasOfDefaultFont = false; } -void Style::Realise(Surface &surface, int zoomLevel) { +bool Style::EquivalentFontTo(const Style *other) const { + if (bold != other->bold || + italic != other->italic || + size != other->size || + characterSet != other->characterSet) + return false; + if (fontName == other->fontName) + return true; + if (!fontName) + return false; + if (!other->fontName) + return false; + return strcmp(fontName, other->fontName) == 0; +} + +void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) { int sizeZoomed = size + zoomLevel; if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1 sizeZoomed = 2; - - int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72; - font.Create(fontName, deviceHeight, bold, italic); + + if (aliasOfDefaultFont) + font.SetID(0); + else + font.Release(); + int deviceHeight = surface.DeviceHeightFont(sizeZoomed); + aliasOfDefaultFont = defaultStyle && + (EquivalentFontTo(defaultStyle) || !fontName); + if (aliasOfDefaultFont) { + font.SetID(defaultStyle->font.GetID()); + } else if (fontName) { + font.Create(fontName, characterSet, deviceHeight, bold, italic); + } else { + font.SetID(0); + } ascent = surface.Ascent(font); descent = surface.Descent(font); diff --git a/contrib/src/stc/scintilla/src/Style.h b/contrib/src/stc/scintilla/src/Style.h index 916b646315..dc643d08d2 100644 --- a/contrib/src/stc/scintilla/src/Style.h +++ b/contrib/src/stc/scintilla/src/Style.h @@ -10,11 +10,14 @@ class Style { public: ColourPair fore; ColourPair back; + bool aliasOfDefaultFont; bool bold; bool italic; int size; - char fontName[100]; + const char *fontName; + int characterSet; bool eolFilled; + bool underline; Font font; unsigned int lineHeight; @@ -25,13 +28,15 @@ public: unsigned int spaceWidth; Style(); + Style(const Style &source); ~Style(); Style &operator=(const Style &source); - void Clear(Colour fore_=Colour(0,0,0), Colour back_=Colour(0xff,0xff,0xff), - int size_=Platform::DefaultFontSize(), - const char *fontName_=Platform::DefaultFont(), - bool bold_=false, bool italic_=false, bool eolFilled_=false); - void Realise(Surface &surface, int zoomLevel); + void Clear(Colour fore_, Colour back_, + int size_, + const char *fontName_, int characterSet_, + bool bold_, bool italic_, bool eolFilled_, bool underline_); + bool EquivalentFontTo(const Style *other) const; + void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0); }; #endif diff --git a/contrib/src/stc/scintilla/src/UniConversion.cxx b/contrib/src/stc/scintilla/src/UniConversion.cxx new file mode 100644 index 0000000000..9306f307c2 --- /dev/null +++ b/contrib/src/stc/scintilla/src/UniConversion.cxx @@ -0,0 +1,77 @@ +// UniConversion.h - functions to handle UFT-8 and UCS-2 strings +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> + +#include "UniConversion.h" + +unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { + unsigned int len = 0; + for (unsigned int i = 0; i < tlen && uptr[i]; i++) { + unsigned int uch = uptr[i]; + if (uch < 0x80) + len++; + else if (uch < 0x800) + len+=2; + else + len +=3; + } + return len; +} + +void UTF8FromUCS2(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) { + int k = 0; + for (unsigned int i = 0; i < tlen && uptr[i]; i++) { + unsigned int uch = uptr[i]; + if (uch < 0x80) { + putf[k++] = static_cast<char>(uch); + } else if (uch < 0x800) { + putf[k++] = static_cast<char>(0xC0 | (uch >> 6)); + putf[k++] = static_cast<char>(0x80 | (uch & 0x3f)); + } else { + putf[k++] = static_cast<char>(0xE0 | (uch >> 12)); + putf[k++] = static_cast<char>(0x80 | ((uch >> 6) & 0x3f)); + putf[k++] = static_cast<char>(0x80 | (uch & 0x3f)); + } + } + putf[len] = '\0'; +} + +unsigned int UCS2Length(const char *s, unsigned int len) { + unsigned int ulen = 0; + for (unsigned int i=0;i<len;i++) { + unsigned char ch = static_cast<unsigned char>(s[i]); + if ((ch < 0x80) || (ch > (0x80 + 0x40))) + ulen++; + } + return ulen; +} + +unsigned int UCS2FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen) { +#ifdef USE_API + return ::MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, tlen); +#else + unsigned int ui=0; + const unsigned char *us = reinterpret_cast<const unsigned char *>(s); + unsigned int i=0; + while ((i<len) && (ui<tlen)) { + unsigned char ch = us[i++]; + if (ch < 0x80) { + tbuf[ui] = ch; + } else if (ch < 0x80 + 0x40 + 0x20) { + tbuf[ui] = static_cast<wchar_t>((ch & 0x1F) << 6); + ch = us[i++]; + tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + (ch & 0x7F)); + } else { + tbuf[ui] = static_cast<wchar_t>((ch & 0xF) << 12); + ch = us[i++]; + tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + ((ch & 0x7F) << 6)); + ch = us[i++]; + tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + (ch & 0x7F)); + } + ui++; + } + return ui; +#endif +} diff --git a/contrib/src/stc/scintilla/src/UniConversion.h b/contrib/src/stc/scintilla/src/UniConversion.h new file mode 100644 index 0000000000..cace497c48 --- /dev/null +++ b/contrib/src/stc/scintilla/src/UniConversion.h @@ -0,0 +1,9 @@ +// UniConversion.h - functions to handle UFT-8 and UCS-2 strings +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen); +void UTF8FromUCS2(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len); +unsigned int UCS2Length(const char *s, unsigned int len); +unsigned int UCS2FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen); + diff --git a/contrib/src/stc/scintilla/src/ViewStyle.cxx b/contrib/src/stc/scintilla/src/ViewStyle.cxx index 001ecdb319..580ecc71ff 100644 --- a/contrib/src/stc/scintilla/src/ViewStyle.cxx +++ b/contrib/src/stc/scintilla/src/ViewStyle.cxx @@ -17,14 +17,46 @@ MarginStyle::MarginStyle() : symbol(false), width(16), mask(0xffffffff), sensitive(false) { } +// A list of the fontnames - avoids wasting space in each style +FontNames::FontNames() { + max = 0; +} + +FontNames::~FontNames() { + Clear(); +} + +void FontNames::Clear() { + for (int i=0;i<max;i++) { + delete []names[i]; + } + max = 0; +} + +const char *FontNames::Save(const char *name) { + if (!name) + return 0; + for (int i=0;i<max;i++) { + if (strcmp(names[i], name) == 0) { + return names[i]; + } + } + names[max] = new char[strlen(name) + 1]; + strcpy(names[max], name); + max++; + return names[max-1]; +} + ViewStyle::ViewStyle() { Init(); } ViewStyle::ViewStyle(const ViewStyle &source) { Init(); - for (int sty=0;sty<=STYLE_MAX;sty++) { + for (unsigned int sty=0;sty<(sizeof(styles)/sizeof(styles[0]));sty++) { styles[sty] = source.styles[sty]; + // Can't just copy fontname as its lifetime is relative to its owning ViewStyle + styles[sty].fontName = fontNames.Save(source.styles[sty].fontName); } for (int mrk=0;mrk<=MARKER_MAX;mrk++) { markers[mrk] = source.markers[mrk]; @@ -59,6 +91,9 @@ ViewStyle::~ViewStyle() { } void ViewStyle::Init() { + fontNames.Clear(); + ResetDefaultStyle(); + indicators[0].style = INDIC_SQUIGGLE; indicators[0].fore = Colour(0, 0x7f, 0); indicators[1].style = INDIC_TT; @@ -136,14 +171,17 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) { void ViewStyle::Refresh(Surface &surface) { selbar.desired = Platform::Chrome(); selbarlight.desired = Platform::ChromeHighlight(); - maxAscent = 1; - maxDescent = 1; + styles[STYLE_DEFAULT].Realise(surface, zoomLevel); + maxAscent = styles[STYLE_DEFAULT].ascent; + maxDescent = styles[STYLE_DEFAULT].descent; for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) { - styles[i].Realise(surface, zoomLevel); - if (maxAscent < styles[i].ascent) - maxAscent = styles[i].ascent; - if (maxDescent < styles[i].descent) - maxDescent = styles[i].descent; + if (i != STYLE_DEFAULT) { + styles[i].Realise(surface, zoomLevel, &styles[STYLE_DEFAULT]); + if (maxAscent < styles[i].ascent) + maxAscent = styles[i].ascent; + if (maxDescent < styles[i].descent) + maxDescent = styles[i].descent; + } } lineHeight = maxAscent + maxDescent; @@ -162,22 +200,31 @@ void ViewStyle::Refresh(Surface &surface) { } void ViewStyle::ResetDefaultStyle() { - styles[STYLE_DEFAULT].Clear(); + styles[STYLE_DEFAULT].Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), + Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), + SC_CHARSET_DEFAULT, + false, false, false, false); } void ViewStyle::ClearStyles() { // Reset all styles to be like the default style - for (int i=0; i<=STYLE_MAX; i++) { + for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) { if (i != STYLE_DEFAULT) { styles[i].Clear( styles[STYLE_DEFAULT].fore.desired, styles[STYLE_DEFAULT].back.desired, styles[STYLE_DEFAULT].size, styles[STYLE_DEFAULT].fontName, + styles[STYLE_DEFAULT].characterSet, styles[STYLE_DEFAULT].bold, - styles[STYLE_DEFAULT].italic); + styles[STYLE_DEFAULT].italic, + styles[STYLE_DEFAULT].eolFilled, + styles[STYLE_DEFAULT].underline); } } styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); } +void ViewStyle::SetStyleFontName(int styleIndex, const char *name) { + styles[styleIndex].fontName = fontNames.Save(name); +} diff --git a/contrib/src/stc/scintilla/src/ViewStyle.h b/contrib/src/stc/scintilla/src/ViewStyle.h index 944872095a..4436e83ff4 100644 --- a/contrib/src/stc/scintilla/src/ViewStyle.h +++ b/contrib/src/stc/scintilla/src/ViewStyle.h @@ -15,8 +15,20 @@ public: MarginStyle(); }; +class FontNames { +private: + char *names[STYLE_MAX + 1]; + int max; +public: + FontNames(); + ~FontNames(); + void Clear(); + const char *Save(const char *name); +}; + class ViewStyle { public: + FontNames fontNames; Style styles[STYLE_MAX + 1]; LineMarker markers[MARKER_MAX + 1]; Indicator indicators[INDIC_MAX + 1]; @@ -54,6 +66,7 @@ public: void Refresh(Surface &surface); void ResetDefaultStyle(); void ClearStyles(); + void SetStyleFontName(int styleIndex, const char *name); }; #endif diff --git a/contrib/src/stc/scintilla/src/WindowAccessor.cxx b/contrib/src/stc/scintilla/src/WindowAccessor.cxx new file mode 100644 index 0000000000..059c877bda --- /dev/null +++ b/contrib/src/stc/scintilla/src/WindowAccessor.cxx @@ -0,0 +1,173 @@ +// SciTE - Scintilla based Text Editor +// Accessor.cxx - rapid easy access to contents of a Scintilla +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <ctype.h> +#include <stdio.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "WindowAccessor.h" +#include "Scintilla.h" + +WindowAccessor::~WindowAccessor() { +} + +bool WindowAccessor::InternalIsLeadByte(char ch) { +#if PLAT_GTK + // TODO: support DBCS under GTK+ + return false; +#elif PLAT_WIN + if (SC_CP_UTF8 == codePage) + // For lexing, all characters >= 0x80 are treated the + // same so none is considered a lead byte. + return false; + else + return IsDBCSLeadByteEx(codePage, ch); +#elif PLAT_WX + return false; +#endif +} + +void WindowAccessor::Fill(int position) { + if (lenDoc == -1) + lenDoc = Platform::SendScintilla(id, WM_GETTEXTLENGTH, 0, 0); + startPos = position - slopSize; + if (startPos + bufferSize > lenDoc) + startPos = lenDoc - bufferSize; + if (startPos < 0) + startPos = 0; + endPos = startPos + bufferSize; + if (endPos > lenDoc) + endPos = lenDoc; + + TEXTRANGE tr = {{startPos, endPos}, buf}; + Platform::SendScintilla(id, EM_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr)); +} + +char WindowAccessor::StyleAt(int position) { + return static_cast<char>(Platform::SendScintilla( + id, SCI_GETSTYLEAT, position, 0)); +} + +int WindowAccessor::GetLine(int position) { + return Platform::SendScintilla(id, EM_LINEFROMCHAR, position, 0); +} + +int WindowAccessor::LineStart(int line) { + return Platform::SendScintilla(id, EM_LINEINDEX, line, 0); +} + +int WindowAccessor::LevelAt(int line) { + return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0); +} + +int WindowAccessor::Length() { + if (lenDoc == -1) + lenDoc = Platform::SendScintilla(id, WM_GETTEXTLENGTH, 0, 0); + return lenDoc; +} + +int WindowAccessor::GetLineState(int line) { + return Platform::SendScintilla(id, SCI_GETLINESTATE, line); +} + +int WindowAccessor::SetLineState(int line, int state) { + return Platform::SendScintilla(id, SCI_SETLINESTATE, line, state); +} + +void WindowAccessor::StartAt(unsigned int start, char chMask) { + Platform::SendScintilla(id, SCI_STARTSTYLING, start, chMask); +} + +void WindowAccessor::StartSegment(unsigned int pos) { + startSeg = pos; +} + +void WindowAccessor::ColourTo(unsigned int pos, int chAttr) { + // Only perform styling if non empty range + if (pos != startSeg - 1) { + if (pos < startSeg) { + Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos); + } + + if (validLen + (pos - startSeg + 1) >= bufferSize) + Flush(); + if (validLen + (pos - startSeg + 1) >= bufferSize) { + // Too big for buffer so send directly + Platform::SendScintilla(id, SCI_SETSTYLING, pos - startSeg + 1, chAttr); + } else { + if (chAttr != chWhile) + chFlags = 0; + chAttr |= chFlags; + for (unsigned int i = startSeg; i <= pos; i++) { + styleBuf[validLen++] = static_cast<char>(chAttr); + } + } + } + startSeg = pos+1; +} + +void WindowAccessor::SetLevel(int line, int level) { + Platform::SendScintilla(id, SCI_SETFOLDLEVEL, line, level); +} + +void WindowAccessor::Flush() { + startPos = extremePosition; + lenDoc = -1; + if (validLen > 0) { + Platform::SendScintilla(id, SCI_SETSTYLINGEX, validLen, + reinterpret_cast<LPARAM>(styleBuf)); + validLen = 0; + } +} + +int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { + int end = Length(); + int spaceFlags = 0; + + // Determines the indentation level of the current line and also checks for consistent + // indentation compared to the previous line. + // Indentation is judged consistent when the indentation whitespace of each line lines + // the same or the indentation of one line is a prefix of the other. + + int pos = LineStart(line); + char ch = (*this)[pos]; + int indent = 0; + bool inPrevPrefix = line > 0; + int posPrev = inPrevPrefix ? LineStart(line-1) : 0; + while ((ch == ' ' || ch == '\t') && (pos < end)) { + if (inPrevPrefix) { + char chPrev = (*this)[posPrev++]; + if (chPrev == ' ' || chPrev == '\t') { + if (chPrev != ch) + spaceFlags |= wsInconsistent; + } else { + inPrevPrefix = false; + } + } + if (ch == ' ') { + spaceFlags |= wsSpace; + indent++; + } else { // Tab + spaceFlags |= wsTab; + if (spaceFlags & wsSpace) + spaceFlags |= wsSpaceTab; + indent = (indent / 8 + 1) * 8; + } + ch = (*this)[++pos]; + } + + *flags = spaceFlags; + indent += SC_FOLDLEVELBASE; + // if completely empty line or the start of a comment... + if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) + return indent | SC_FOLDLEVELWHITEFLAG; + else + return indent; +} + diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index e85c952886..aa7bf8dd98 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -5,7 +5,7 @@ // derive directly from the Scintilla classes, but instead // delegates most things to the real Scintilla class. // This allows the use of Scintilla without polluting the -// namespace with all the classes and itentifiers from Scintilla. +// namespace with all the classes and identifiers from Scintilla. // // Author: Robin Dunn // @@ -15,11 +15,53 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +#include <ctype.h> + #include "wx/stc/stc.h" #include "ScintillaWX.h" #include <wx/tokenzr.h> +// The following code forces a reference to all of the Scintilla lexers. +// If we don't do something like this, then the linker tends to "optimize" +// them away. (eric@sourcegear.com) + +int wxForceScintillaLexers(void) +{ + extern LexerModule lmCPP; + extern LexerModule lmHTML; + extern LexerModule lmXML; + extern LexerModule lmProps; + extern LexerModule lmErrorList; + extern LexerModule lmMake; + extern LexerModule lmBatch; + extern LexerModule lmPerl; + extern LexerModule lmPython; + extern LexerModule lmSQL; + extern LexerModule lmVB; + + if ( + &lmCPP + && &lmHTML + && &lmXML + && &lmProps + && &lmErrorList + && &lmMake + && &lmBatch + && &lmPerl + && &lmPython + && &lmSQL + && &lmVB + ) + { + return 1; + } + else + { + return 0; + } +} + //---------------------------------------------------------------------- const wxChar* wxSTCNameStr = "stcwindow"; @@ -33,13 +75,19 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp) EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp) EVT_CHAR (wxStyledTextCtrl::OnChar) + EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown) EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus) EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus) EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged) EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground) EVT_MENU_RANGE (-1, -1, wxStyledTextCtrl::OnMenu) + EVT_LISTBOX_DCLICK (-1, wxStyledTextCtrl::OnListBox) END_EVENT_TABLE() + +IMPLEMENT_CLASS(wxStyledTextCtrl, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent) + //---------------------------------------------------------------------- // Constructor and Destructor @@ -69,7 +117,7 @@ wxStyledTextCtrl::~wxStyledTextCtrl() { //---------------------------------------------------------------------- -inline long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) { +long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) { return m_swx->WndProc(msg, wp, lp); } @@ -81,9 +129,10 @@ inline long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) { wxString wxStyledTextCtrl::GetText() { wxString text; int len = GetTextLength(); - char* buff = text.GetWriteBuf(len); + char* buff = text.GetWriteBuf(len+1); SendMsg(WM_GETTEXT, len, (long)buff); + buff[len] = 0; text.UngetWriteBuf(); return text; } @@ -99,8 +148,9 @@ wxString wxStyledTextCtrl::GetLine(int line) { int len = GetLineLength(line); char* buff = text.GetWriteBuf(len+1); - *((WORD*)buff) = len+1; + *((WORD*)buff) = len; SendMsg(EM_GETLINE, line, (long)buff); + buff[len] = 0; text.UngetWriteBuf(); return text; } @@ -384,7 +434,7 @@ wxString wxStyledTextCtrl::GetCurrentLineText(int* linePos) { int len = GetLineLength(GetCurrentLine()); char* buff = text.GetWriteBuf(len+1); - int pos = SendMsg(SCI_GETCURLINE, len+1, (long)buff); + int pos = SendMsg(SCI_GETCURLINE, len, (long)buff); text.UngetWriteBuf(); if (linePos) @@ -410,7 +460,7 @@ int wxStyledTextCtrl::LineFromPoint(wxPoint pt) { wxPoint wxStyledTextCtrl::PointFromPosition(int pos) { Point pt; - SendMsg(EM_POSFROMCHAR, pos, (long)&pt); + SendMsg(EM_POSFROMCHAR, (long)&pt, pos); return wxPoint(pt.x, pt.y); } @@ -491,6 +541,27 @@ int wxStyledTextCtrl::GetSelectionType() { } +int wxStyledTextCtrl::GetLinesOnScreen() { + return SendMsg(SCI_LINESONSCREEN); +} + + +bool wxStyledTextCtrl::IsSelectionRectangle() { + return SendMsg(SCI_SELECTIONISRECTANGLE) != 0; +} + + +void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool use) { + SendMsg(SCI_SETHSCROLLBAR, use); +} + + +bool wxStyledTextCtrl::GetUseHorizontalScrollBar() { + return SendMsg(SCI_GETHSCROLLBAR) != 0; +} + + + //---------------------------------------------------------------------- @@ -598,6 +669,16 @@ void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) { } +void wxStyledTextCtrl::SetLineState(int line, int value) { + SendMsg(SCI_SETLINESTATE, line, value); +} + + +int wxStyledTextCtrl::GetLineState(int line) { + return SendMsg(SCI_GETLINESTATE, line); +} + + //---------------------------------------------------------------------- // Style Definition @@ -646,6 +727,7 @@ void wxStyledTextCtrl::StyleResetDefault() { // face:[facename] sets the font face name to use // size:[num] sets the font size in points // eol turns on eol filling +// underline turns on underlining // void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { @@ -663,6 +745,9 @@ void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { else if (option == "italic") StyleSetItalic(styleNum, true); + else if (option == "underline") + StyleSetUnderline(styleNum, true); + else if (option == "eol") StyleSetEOLFilled(styleNum, true); @@ -699,18 +784,21 @@ void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) { wxString faceName = font.GetFaceName(); bool bold = font.GetWeight() == wxBOLD; bool italic = font.GetStyle() != wxNORMAL; + bool under = font.GetUnderlined(); - StyleSetFontAttr(styleNum, size, faceName, bold, italic); + StyleSetFontAttr(styleNum, size, faceName, bold, italic, under); } void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size, const wxString& faceName, - bool bold, bool italic) { + bool bold, bool italic, + bool underline) { StyleSetSize(styleNum, size); StyleSetFaceName(styleNum, faceName); StyleSetBold(styleNum, bold); StyleSetItalic(styleNum, italic); + StyleSetUnderline(styleNum, underline); } @@ -739,6 +827,11 @@ void wxStyledTextCtrl::StyleSetEOLFilled(int styleNum, bool fillEOL) { } +void wxStyledTextCtrl::StyleSetUnderline(int styleNum, bool underline) { + SendMsg(SCI_STYLESETUNDERLINE, styleNum, underline); +} + + //---------------------------------------------------------------------- // Margins in the edit area @@ -829,7 +922,7 @@ void wxStyledTextCtrl::SetSelectionBackground(const wxColour& colour) { void wxStyledTextCtrl::SetCaretForeground(const wxColour& colour) { - SendMsg(SCI_SETCARETFORE, 0, wxColourAsLong(colour)); + SendMsg(SCI_SETCARETFORE, wxColourAsLong(colour)); } @@ -858,11 +951,41 @@ void wxStyledTextCtrl::SetTabWidth(int numChars) { } +void wxStyledTextCtrl::SetIndent(int numChars) { + SendMsg(SCI_SETINDENT, numChars); +} + + +void wxStyledTextCtrl::SetUseTabs(bool usetabs) { + SendMsg(SCI_SETUSETABS, usetabs); +} + + +void wxStyledTextCtrl::SetLineIndentation(int line, int indentation) { + SendMsg(SCI_SETLINEINDENTATION, line, indentation); +} + + +int wxStyledTextCtrl:: GetLineIndentation(int line) { + return SendMsg(SCI_GETLINEINDENTATION, line); +} + + +int wxStyledTextCtrl::GetLineIndentationPos(int line) { + return SendMsg(SCI_GETLINEINDENTPOSITION, line); +} + + void wxStyledTextCtrl::SetWordChars(const wxString& wordChars) { SendMsg(SCI_SETTABWIDTH, 0, (long)wordChars.c_str()); } +void wxStyledTextCtrl::SetUsePop(bool usepopup) { + SendMsg(SCI_USEPOPUP, usepopup); +} + + //---------------------------------------------------------------------- // Brace highlighting @@ -967,7 +1090,7 @@ int wxStyledTextCtrl::IndicatorGetStyle(int indicNum) { void wxStyledTextCtrl::IndicatorSetColour(int indicNum, const wxColour& colour) { - SendMsg(SCI_INDICSETSTYLE, indicNum, wxColourAsLong(colour)); + SendMsg(SCI_INDICSETFORE, indicNum, wxColourAsLong(colour)); } @@ -1006,6 +1129,21 @@ void wxStyledTextCtrl::AutoCompStopChars(const wxString& stopChars) { } +void wxStyledTextCtrl::AutoCompSetSeparator(char separator) { + SendMsg(SCI_AUTOCSETSEPARATOR, separator); +} + + +char wxStyledTextCtrl::AutoCompGetSeparator() { + return SendMsg(SCI_AUTOCGETSEPARATOR); +} + + +void wxStyledTextCtrl::AutoCompSelect(const wxString& stringtoselect) { + SendMsg(SCI_AUTOCSELECT, (long)stringtoselect.c_str()); +} + + //---------------------------------------------------------------------- // Call tips @@ -1129,8 +1267,8 @@ int wxStyledTextCtrl::GetFoldLevel(int line) { } -int wxStyledTextCtrl::GetLastChild(int line) { - return SendMsg(SCI_GETLASTCHILD, line); +int wxStyledTextCtrl::GetLastChild(int line, int level) { + return SendMsg(SCI_GETLASTCHILD, line, level); } @@ -1154,8 +1292,8 @@ bool wxStyledTextCtrl::GetLineVisible(int line) { } -void wxStyledTextCtrl::SetFoldExpanded(int line) { - SendMsg(SCI_SETFOLDEXPANDED, line); +void wxStyledTextCtrl::SetFoldExpanded(int line, bool expanded) { + SendMsg(SCI_SETFOLDEXPANDED, line, expanded); } @@ -1174,6 +1312,33 @@ void wxStyledTextCtrl::EnsureVisible(int line) { } +void wxStyledTextCtrl::SetFoldFlags(int flags) { + SendMsg(SCI_SETFOLDFLAGS, flags); +} + + +//---------------------------------------------------------------------- +// Zooming + +void wxStyledTextCtrl::ZoomIn() { + SendMsg(SCI_ZOOMIN); +} + + +void wxStyledTextCtrl::ZoomOut() { + SendMsg(SCI_ZOOMOUT); +} + + +void wxStyledTextCtrl::SetZoom(int zoom) { + SendMsg(SCI_SETZOOM, zoom); +} + + +int wxStyledTextCtrl::GetZoom() { + return SendMsg(SCI_GETZOOM); +} + //---------------------------------------------------------------------- // Long Lines @@ -1232,6 +1397,18 @@ void wxStyledTextCtrl::SetKeywords(int keywordSet, const wxString& keywordLi +//---------------------------------------------------------------------- +// Event mask for Modified Event + +void wxStyledTextCtrl::SetModEventMask(int mask) { + SendMsg(SCI_SETMODEVENTMASK, mask); +} + + +//int wxStyledTextCtrl::GetModEventMask() { +// return SendMsg(SCI_GETMODEVENTMASK); +//} + //---------------------------------------------------------------------- // Event handlers @@ -1278,20 +1455,23 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) { } void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { - int processed = 0; long key = evt.KeyCode(); if ((key > WXK_ESCAPE) && (key != WXK_DELETE) && (key < 255) && !evt.ControlDown() && !evt.AltDown()) { m_swx->DoAddChar(key); - processed = true; } else { - key = toupper(key); - processed = m_swx->DoKeyDown(key, evt.ShiftDown(), - evt.ControlDown(), evt.AltDown()); + evt.Skip(); } +} + +void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { + long key = evt.KeyCode(); + key = toupper(key); + int processed = m_swx->DoKeyDown(key, evt.ShiftDown(), + evt.ControlDown(), evt.AltDown()); if (! processed) evt.Skip(); } @@ -1319,9 +1499,15 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) { } +void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) { + m_swx->DoOnListBox(); +} + + //---------------------------------------------------------------------- // Turn notifications from Scintilla into events + void wxStyledTextCtrl::NotifyChange() { wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId()); GetEventHandler()->ProcessEvent(evt); @@ -1375,7 +1561,8 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetModifiers(scn.modifiers); if (eventType == wxEVT_STC_MODIFIED) { evt.SetModificationType(scn.modificationType); - evt.SetText(scn.text); + if (scn.text) + evt.SetText(wxString(scn.text, scn.length)); evt.SetLength(scn.length); evt.SetLinesAdded(scn.linesAdded); evt.SetLine(scn.line); diff --git a/debian/README.Debian b/debian/README.Debian index bc3cbd2c72..5e1fe433f0 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -3,9 +3,14 @@ wxwindows for Debian The following packages are built from the wxWindows CVS source. -libwxgtk wxGTK shared library -libwxgtk-dev Headers and static lib for building wxGTK apps +libwxbase wxBase runtime shared libraries +libwxbase-dev extra files and static libs for building wxBase apps +libwxgtk wxGTK runtime shared libraries +libwxgtk-dev extra files and static libs for building wxGTK apps libwxgtk-python Python binding to wxGTK +wxwin-contrib wxWin contrib runtime shared libs (built with wxGTK) +wxwin-contrib-dev extra files and static contrib libs for building apps +wxwin-headers common header files for building wxWindows apps wxwin-doc HTML version of the wxWindows manual wxwin-examples wxWindows and wxPython demos and samples (source) diff --git a/debian/changelog b/debian/changelog index 8eebb0864a..7f8f2f4584 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -wxwindows2.1 (2.1.14) unstable; urgency=low +wxwindows2.2 (2.2.1) unstable; urgency=low * Repackaged to build from cvs. diff --git a/debian/control.in b/debian/control.in index 9dbe952fb1..535ce2d60e 100644 --- a/debian/control.in +++ b/debian/control.in @@ -1,7 +1,7 @@ Source: wxwindows=V Section: libs Priority: optional -Build-Depends: debhelper, libgtk1.2-dev, python-dev (>=1.5), flex, bison +Build-Depends: debhelper, flex, bison, libgtk1.2-dev, python-dev (>=1.5), zlib1g-dev, libjpeg62-dev, libpng2-dev, libtiff3g-dev, mesag-dev Maintainer: Ron Lee <ron@debian.org> Standards-Version: 3.1.1 @@ -25,7 +25,7 @@ Description: wxBase library (runtime) - non-GUI support classes of wxWindows too Package: libwxbase=V-dev Architecture: any Section: devel -Depends: libwxbase=V (= ${Source-Version}), libwxgtk=V-dev (= ${Source-Version}), libc6-dev +Depends: wxwin=V-headers (= ${Source-Version}), libwxbase=V (= ${Source-Version}), libc6-dev Suggests: wxwin=V-doc, gettext Conflicts: libwxbase-dev Replaces: libwxbase-dev @@ -39,37 +39,70 @@ Description: wxBase library (development) - non-GUI support classes of wxWindows wxBase currently supports the following platforms: Win32, generic Unix (Linux, FreeBSD, Solaris, HP-UX, ...) and BeOS. . - This package is only useful for non-gui apps. It offers a subset of the - classes in libwx_gtk=V for use in console apps and daemons. It is currently - under development and may not be as stable as the gui version. + This package provides the files needed to compile apps using the wxBase library. + +Package: libwxbase=V-dbg +Architecture: any +Section: devel +Depends: wxwin=V-headers (= ${Source-Version}), libc6-dev +Description: wxBase library (debug) - non-GUI support classes of wxWindows toolkit + wxBase is a collection of C++ classes providing basic data structures + (strings, lists, arrays), powerful wxDateTime class for date manipulations, + portable wrappers around many OS-specific functions allowing to build the + same program under all supported folders, wxThread class for writing + multithreaded programs using either Win32 or POSIX threads and much more. + wxBase currently supports the following platforms: Win32, generic Unix + (Linux, FreeBSD, Solaris, HP-UX, ...) and BeOS. + . + This package provides a debug version of the wxBase library. It is compiled + both with -g for normal debugger tracing and with the __WXDEBUG__ flag which + provides many internal checks by wxWindows itself that are not performed on + apps compiled with the 'release version' libs in the -dev package. Package: libwxgtk=V Architecture: any Section: libs Depends: ${shlibs:Depends} +Suggests: mesag3 Description: wxWindows Cross-platform C++ GUI toolkit (GTK+ runtime) wxWindows is a class library for C++ providing GUI (Graphical User - Interface) and other facilities on more than one platform. Version 2.1 + Interface) and other facilities on more than one platform. Version =V currently supports subsets of GTK+, Motif, and MS Windows. . This package provides the shared libraries needed to run programs linked - against wxWindows. + against wxWindows. To use the (optional) glcanvas library you will need + to have Mesa or OpenGL installed. Package: libwxgtk=V-dev Architecture: any Section: devel -Depends: libwxgtk=V (= ${Source-Version}), libc6-dev -Suggests: wxwin=V-doc, libstdc++-dev, gettext +Depends: wxwin=V-headers (= ${Source-Version}), libwxgtk=V (= ${Source-Version}), libc6-dev +Suggests: wxwin=V-doc, libstdc++-dev, gettext, mesag-dev Conflicts: libwxgtk-dev Replaces: libwxgtk-dev Provides: libwxgtk-dev Description: wxWindows Cross-platform C++ GUI toolkit (GTK+ development) wxWindows is a class library for C++ providing GUI (Graphical User - Interface) and other facilities on more than one platform. Version 2.1 + Interface) and other facilities on more than one platform. Version =V currently supports subsets of GTK+, Motif, and MS Windows. . - This package provides files needed to compile wxWindows programs. It - includes header files and static libraries. + This package provides files needed to compile wxWindows programs. If you + want to compile apps using the (optional) glcanvas library you will need + to have Mesa or OpenGL installed too. + +Package: libwxgtk=V-dbg +Architecture: any +Section: devel +Depends: wxwin=V-headers (= ${Source-Version}), libc6-dev +Description: wxWindows Cross-platform C++ GUI toolkit (GTK+ development) + wxWindows is a class library for C++ providing GUI (Graphical User + Interface) and other facilities on more than one platform. Version =V + currently supports subsets of GTK+, Motif, and MS Windows. + . + This package provides a debug version of the wxGtk library. It is compiled + both with -g for normal debugger tracing and with the __WXDEBUG__ flag which + provides many internal checks by wxWindows itself that are not performed on + apps compiled with the 'release version' libs in the -dev package. Package: libwxgtk=V-python Architecture: any @@ -78,18 +111,59 @@ Depends: libwxgtk=V (= ${Source-Version}), python-base (>=1.5), ${shlibs:Depends Suggests: wxwin=V-doc Description: wxWindows Cross-platform C++ GUI toolkit (Python binding) wxWindows is a class library for C++ providing GUI (Graphical User - Interface) and other facilities on more than one platform. Version 2.1 + Interface) and other facilities on more than one platform. Version =V currently supports subsets of GTK+, Motif, and MS Windows. . This package provides a Python binding to the wxGTK library. +Package: libwxgtk=V-contrib +Architecture: any +Section: libs +Depends: libwxgtk=V (= ${Source-Version}), ${shlibs:Depends} +Description: wxWindows Cross-platform C++ GUI toolkit (runtime contrib libs) + wxWindows is a class library for C++ providing GUI (Graphical User + Interface) and other facilities on more than one platform. Version =V + currently supports subsets of GTK+, Motif, and MS Windows. + . + This package provides the contrib libs of the wxWindows source tree + (mmedia, ogl, stc) + +Package: libwxgtk=V-contrib-dev +Architecture: any +Section: devel +Depends: wxwin=V-headers (= ${Source-Version}), libwxgtk=V-dev (= ${Source-Version}), libc6-dev +Conflicts: libwxgtk-contrib-dev +Replaces: libwxgtk-contrib-dev +Provides: libwxgtk-contrib-dev +Description: wxWindows Cross-platform C++ GUI toolkit (development contrib libs) + wxWindows is a class library for C++ providing GUI (Graphical User + Interface) and other facilities on more than one platform. Version =V + currently supports subsets of GTK+, Motif, and MS Windows. + . + Install this package if you wish to compile applications that use the + contrib libs from the wxWindows source tree (mmedia, ogl, stc) + +Package: wxwin=V-headers +Architecture: any +Section: devel +Conflicts: wxwin-headers +Replaces: wxwin-headers +Provides: wxwin-headers +Description: wxWindows Cross-platform C++ GUI toolkit (header files) + wxWindows is a class library for C++ providing GUI (Graphical User + Interface) and other facilities on more than one platform. Version =V + currently supports subsets of GTK+, Motif, and MS Windows. + . + This package provides the common header files required to build applications + using the wxWindows toolkit. + Package: wxwin=V-doc Architecture: all Section: doc Suggests: doc-base, www-browser Description: wxWindows Cross-platform C++ GUI toolkit (documentation) wxWindows is a class library for C++ providing GUI (Graphical User - Interface) and other facilities on more than one platform. Version 2.1 + Interface) and other facilities on more than one platform. Version =V currently supports subsets of GTK+, Motif, and MS Windows. . This package provides a HTML version of the wxWindows reference manual. @@ -100,7 +174,7 @@ Section: devel Suggests: libwxgtk=V-dev (= ${Source-Version}), wxwin=V-doc Description: wxWindows Cross-platform C++ GUI toolkit (examples) wxWindows is a class library for C++ providing GUI (Graphical User - Interface) and other facilities on more than one platform. Version 2.1 + Interface) and other facilities on more than one platform. Version =V currently supports subsets of GTK+, Motif, and MS Windows. . This package contains examples of using the wxWindows toolkit. diff --git a/debian/libwxbase-dbg.dirs b/debian/libwxbase-dbg.dirs new file mode 100644 index 0000000000..1bb9506799 --- /dev/null +++ b/debian/libwxbase-dbg.dirs @@ -0,0 +1,4 @@ +usr/bin +usr/lib/wx/include/wx +usr/share/man/man1 + diff --git a/debian/libwxbase-dbg.docs b/debian/libwxbase-dbg.docs new file mode 100644 index 0000000000..4c4d01649e --- /dev/null +++ b/debian/libwxbase-dbg.docs @@ -0,0 +1,2 @@ +docs/licence.txt + diff --git a/debian/libwxbase-dbg.links b/debian/libwxbase-dbg.links new file mode 100644 index 0000000000..124b341bbb --- /dev/null +++ b/debian/libwxbase-dbg.links @@ -0,0 +1,2 @@ +usr/share/man/man1/wx-config.1.gz usr/share/man/man1/wxbased-config.1.gz + diff --git a/debian/libwxbase-dbg.postinst b/debian/libwxbase-dbg.postinst new file mode 100644 index 0000000000..eac3f0a3a8 --- /dev/null +++ b/debian/libwxbase-dbg.postinst @@ -0,0 +1,11 @@ +#! /bin/sh +set -e + +update-alternatives --install /usr/bin/wx-config wx-config /usr/bin/wxbased-config 50 + +if [ "$1" = "configure" ]; then + ldconfig +fi + +#DEBHELPER# + diff --git a/debian/libwxbase-dbg.prerm b/debian/libwxbase-dbg.prerm new file mode 100644 index 0000000000..c7dc094a7c --- /dev/null +++ b/debian/libwxbase-dbg.prerm @@ -0,0 +1,7 @@ +#! /bin/sh +set -e + +update-alternatives --remove wx-config /usr/bin/wxbased-config + +#DEBHELPER# + diff --git a/debian/libwxbase-dev.files b/debian/libwxbase-dev.files index 60de00e333..5e667db9c3 100644 --- a/debian/libwxbase-dev.files +++ b/debian/libwxbase-dev.files @@ -1,4 +1,4 @@ usr/bin/wxbase-config usr/lib/wx/include/wx/base/setup.h -usr/lib/libwxbase*.so -usr/lib/libwxbase*.a +usr/lib/libwx_base*.so + diff --git a/debian/libwxbase.dirs b/debian/libwxbase.dirs index 68457717bd..99e2a10872 100644 --- a/debian/libwxbase.dirs +++ b/debian/libwxbase.dirs @@ -1 +1,3 @@ +usr/bin usr/lib + diff --git a/debian/libwxbase.files b/debian/libwxbase.files deleted file mode 100644 index 35686b0e13..0000000000 --- a/debian/libwxbase.files +++ /dev/null @@ -1 +0,0 @@ -usr/lib/libwxbase*.so.* diff --git a/debian/libwxgtk-contrib-dev.dirs b/debian/libwxgtk-contrib-dev.dirs new file mode 100644 index 0000000000..7e033b0c69 --- /dev/null +++ b/debian/libwxgtk-contrib-dev.dirs @@ -0,0 +1,2 @@ +usr/lib/ + diff --git a/debian/libwxgtk-contrib-dev.docs b/debian/libwxgtk-contrib-dev.docs new file mode 100644 index 0000000000..4c4d01649e --- /dev/null +++ b/debian/libwxgtk-contrib-dev.docs @@ -0,0 +1,2 @@ +docs/licence.txt + diff --git a/debian/libwxgtk-contrib-dev.files b/debian/libwxgtk-contrib-dev.files new file mode 100644 index 0000000000..96ed45a3df --- /dev/null +++ b/debian/libwxgtk-contrib-dev.files @@ -0,0 +1,5 @@ +usr/include/wx/ +usr/lib/libmmedia.so +usr/lib/libogl.so +usr/lib/libstc.so + diff --git a/debian/libwxgtk-contrib.dirs b/debian/libwxgtk-contrib.dirs new file mode 100644 index 0000000000..7e033b0c69 --- /dev/null +++ b/debian/libwxgtk-contrib.dirs @@ -0,0 +1,2 @@ +usr/lib/ + diff --git a/debian/libwxgtk-contrib.docs b/debian/libwxgtk-contrib.docs new file mode 100644 index 0000000000..4c4d01649e --- /dev/null +++ b/debian/libwxgtk-contrib.docs @@ -0,0 +1,2 @@ +docs/licence.txt + diff --git a/debian/libwxgtk-contrib.postinst b/debian/libwxgtk-contrib.postinst new file mode 100644 index 0000000000..881b6e24e2 --- /dev/null +++ b/debian/libwxgtk-contrib.postinst @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +if [ "$1" = "configure" ]; then + ldconfig +fi + +#DEBHELPER# + diff --git a/debian/libwxgtk-dbg.dirs b/debian/libwxgtk-dbg.dirs new file mode 100644 index 0000000000..4361f0cadd --- /dev/null +++ b/debian/libwxgtk-dbg.dirs @@ -0,0 +1,4 @@ +usr/bin +usr/lib/wx/include/wx/gtkd/ +usr/share/man/man1 + diff --git a/debian/libwxgtk-dbg.docs b/debian/libwxgtk-dbg.docs new file mode 100644 index 0000000000..4c4d01649e --- /dev/null +++ b/debian/libwxgtk-dbg.docs @@ -0,0 +1,2 @@ +docs/licence.txt + diff --git a/debian/libwxgtk-dbg.links b/debian/libwxgtk-dbg.links new file mode 100644 index 0000000000..aa9cfe39cf --- /dev/null +++ b/debian/libwxgtk-dbg.links @@ -0,0 +1,2 @@ +usr/share/man/man1/wx-config.1.gz usr/share/man/man1/wxgtkd-config.1.gz + diff --git a/debian/libwxgtk-dbg.postinst b/debian/libwxgtk-dbg.postinst new file mode 100644 index 0000000000..a6eeacea7f --- /dev/null +++ b/debian/libwxgtk-dbg.postinst @@ -0,0 +1,11 @@ +#! /bin/sh +set -e + +update-alternatives --install /usr/bin/wx-config wx-config /usr/bin/wxgtkd-config 50 + +if [ "$1" = "configure" ]; then + ldconfig +fi + +#DEBHELPER# + diff --git a/debian/libwxgtk-dbg.prerm b/debian/libwxgtk-dbg.prerm new file mode 100644 index 0000000000..db293a0055 --- /dev/null +++ b/debian/libwxgtk-dbg.prerm @@ -0,0 +1,7 @@ +#! /bin/sh +set -e + +update-alternatives --remove wx-config /usr/bin/wxgtkd-config + +#DEBHELPER# + diff --git a/debian/libwxgtk-dev.dirs b/debian/libwxgtk-dev.dirs index f3281f468f..d5f4413e0c 100644 --- a/debian/libwxgtk-dev.dirs +++ b/debian/libwxgtk-dev.dirs @@ -1,4 +1,3 @@ usr/bin usr/lib/wx/include/wx/gtk/ -usr/include/wx usr/share/man/man1 diff --git a/debian/libwxgtk-dev.files b/debian/libwxgtk-dev.files index d1e42a2f78..11c13c2ee7 100644 --- a/debian/libwxgtk-dev.files +++ b/debian/libwxgtk-dev.files @@ -1,5 +1,6 @@ usr/bin/wxgtk-config -usr/include/wx/ usr/lib/wx/include/wx/gtk/setup.h -usr/lib/libwx_gtk*.so -usr/lib/libwx_gtk*.a +usr/lib/libwx_gtk-*.so +usr/lib/libwx_gtk.so +usr/lib/libwx_gtk_gl*.so + diff --git a/debian/libwxgtk-python.docs b/debian/libwxgtk-python.docs index 7a7c47f4db..7795de7506 100644 --- a/debian/libwxgtk-python.docs +++ b/debian/libwxgtk-python.docs @@ -1,3 +1,3 @@ -utils/wxPython/README.txt -utils/wxPython/CHANGES.txt +wxPython/README.txt +wxPython/CHANGES.txt docs/licence.txt diff --git a/debian/libwxgtk-python.files b/debian/libwxgtk-python.files index ac1d8ae000..33537433ce 100644 --- a/debian/libwxgtk-python.files +++ b/debian/libwxgtk-python.files @@ -1,2 +1,4 @@ usr/lib/python1.5/site-packages/wxPython -usr/lib/libwxPyHelpers.so +usr/lib/libwxPyHelpers*.so +usr/lib/libwxPyHelpers*.so.* + diff --git a/debian/libwxgtk.files b/debian/libwxgtk.files deleted file mode 100644 index ad2e7b204b..0000000000 --- a/debian/libwxgtk.files +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib/libwx_gtk*.so.* -usr/share/wx diff --git a/debian/rules b/debian/rules index 17d49a9165..df58c43300 100755 --- a/debian/rules +++ b/debian/rules @@ -3,39 +3,54 @@ # # Sculpted 13/2/2000 by Ron Lee <ron@debian.org> from new and # variously stolen code :-) -# (including a debhelper template, GNU copyright 1997 to 1999 by -# Joey Hess, and some ideas found in the ncurses rules file that -# I quite liked. Thanks!) +# It makes copious use of the debhelper utilities written by +# Joey Hess and others. #export DH_VERBOSE=1 export DH_COMPAT=2 +export DH_OPTIONS release:=$(shell dpkg-parsechangelog | sed -n 's/^Source: wxwindows//p') # Packages to build: package_wxbase_lib=libwxbase$(release) package_wxbase_dev=libwxbase$(release)-dev +package_wxbase_dbg=libwxbase$(release)-dbg package_gtk_lib=libwxgtk$(release) package_gtk_dev=libwxgtk$(release)-dev +package_gtk_dbg=libwxgtk$(release)-dbg package_gtk_py=libwxgtk$(release)-python +package_gtk_contrib=libwxgtk$(release)-contrib +package_gtk_contrib_dev=libwxgtk$(release)-contrib-dev +package_headers=wxwin$(release)-headers package_doc=wxwin$(release)-doc package_examples=wxwin$(release)-examples # Build directories: objdir_wxbase_shared=objs_wxbase_sh objdir_wxbase_static=objs_wxbase_st +objdir_wxbase_debug=objs_wxbase_d objdir_gtk_shared=objs_gtk_sh objdir_gtk_static=objs_gtk_st +objdir_gtk_debug=objs_gtk_d objdir_doc_cruft=objs_doc_con objdir_doc=docs/wxWindows-manual.html objdir_examples=docs/examples -objdirs=$(objdir_wxbase_shared) $(objdir_wxbase_static) $(objdir_gtk_shared) \ - $(objdir_gtk_static) $(objdir_doc) $(objdir_examples) +objdirs=$(objdir_wxbase_shared) $(objdir_wxbase_static) $(objdir_wxbase_debug) \ + $(objdir_gtk_shared) $(objdir_gtk_static) $(objdir_gtk_debug) \ + $(objdir_doc) $(objdir_examples) build_stamps=build-wxbase-shared-stamp build-wxbase-static-stamp \ - build-gtk-shared-stamp build-gtk-static-stamp \ + build-wxbase-debug-stamp build-gtk-shared-stamp \ + build-gtk-static-stamp build-gtk-debug-stamp \ + build-contrib-shared-stamp build-contrib-static-stamp \ build-gtk-python-stamp build-examples-stamp build-doc-stamp +install_all=install-wxbase-lib install-wxbase-dev install-wxbase-dbg \ + install-gtk-lib install-gtk-dev install-gtk-dbg \ + install-gtk-contrib install-gtk-contrib-dev install-gtk-py \ + install-headers install-doc install-examples + wxconfig:=$(shell pwd)/$(objdir_gtk_shared)/wx-config \ --prefix=$(shell pwd) \ --exec-prefix=$(shell pwd)/$(objdir_gtk_shared) @@ -49,13 +64,68 @@ debian/control: debian/control.in debian/wxwin-doc.doc-base: debian/wxwin-doc.doc-base.in sed -e 's/=V/$(release)/g' < debian/wxwin-doc.doc-base.in > debian/wxwin-doc.doc-base -build: debian/control debian/wxwin-doc.doc-base $(build_stamps) +control-files-stamp: debian/control debian/wxwin-doc.doc-base + dh_testdir + @for f in dirs docs postinst; do \ + echo "generating control file $(package_wxbase_lib).$$f"; \ + cp debian/libwxbase.$$f debian/$(package_wxbase_lib).$$f; \ + done; + @for f in dirs docs files links postinst prerm; do \ + echo "generating control file $(package_wxbase_dev).$$f"; \ + cp debian/libwxbase-dev.$$f debian/$(package_wxbase_dev).$$f; \ + done; + @for f in dirs docs links postinst prerm; do \ + echo "generating control file $(package_wxbase_dbg).$$f"; \ + cp debian/libwxbase-dbg.$$f debian/$(package_wxbase_dbg).$$f; \ + done; + @for f in dirs docs postinst; do \ + echo "generating control file $(package_gtk_lib).$$f"; \ + cp debian/libwxgtk.$$f debian/$(package_gtk_lib).$$f; \ + done; + @for f in dirs docs files links postinst prerm; do \ + echo "generating control file $(package_gtk_dev).$$f"; \ + cp debian/libwxgtk-dev.$$f debian/$(package_gtk_dev).$$f; \ + done; + @for f in dirs docs links postinst prerm; do \ + echo "generating control file $(package_gtk_dbg).$$f"; \ + cp debian/libwxgtk-dbg.$$f debian/$(package_gtk_dbg).$$f; \ + done; + @for f in dirs docs files postinst prerm; do \ + echo "generating control file $(package_gtk_py).$$f"; \ + cp debian/libwxgtk-python.$$f debian/$(package_gtk_py).$$f; \ + done; + @for f in dirs docs postinst; do \ + echo "generating control file $(package_gtk_contrib).$$f"; \ + cp debian/libwxgtk-contrib.$$f debian/$(package_gtk_contrib).$$f; \ + done; + @for f in dirs docs files; do \ + echo "generating control file $(package_gtk_contrib_dev).$$f"; \ + cp debian/libwxgtk-contrib-dev.$$f debian/$(package_gtk_contrib_dev).$$f; \ + done; + @for f in dirs docs files; do \ + echo "generating control file $(package_headers).$$f"; \ + cp debian/wxwin-headers.$$f debian/$(package_headers).$$f; \ + done; + @for f in dirs docs doc-base; do \ + echo "generating control file $(package_doc).$$f"; \ + cp debian/wxwin-doc.$$f debian/$(package_doc).$$f; \ + done; + @for f in docs examples; do \ + echo "generating control file $(package_examples).$$f"; \ + cp debian/wxwin-examples.$$f debian/$(package_examples).$$f; \ + done; + touch $@ + +build: control-files-stamp $(build_stamps) build-wxbase-shared-stamp: dh_testdir mkdir $(objdir_wxbase_shared) cd $(objdir_wxbase_shared) \ - && ../configure --prefix=/usr --disable-gui --enable-burnt_name \ + && ../configure --prefix=/usr \ + --disable-gui \ + --enable-burnt_name \ + --with-zlib=sys \ && $(MAKE) touch $@ @@ -63,7 +133,22 @@ build-wxbase-static-stamp: dh_testdir mkdir $(objdir_wxbase_static) cd $(objdir_wxbase_static) \ - && ../configure --prefix=/usr --disable-gui --disable-shared \ + && ../configure --prefix=/usr \ + --disable-gui \ + --disable-shared \ + --with-zlib=sys \ + && $(MAKE) + touch $@ + +build-wxbase-debug-stamp: + dh_testdir + mkdir $(objdir_wxbase_debug) + cd $(objdir_wxbase_debug) \ + && ../configure --prefix=/usr \ + --disable-gui \ + --enable-debug \ + --enable-burnt_name \ + --with-zlib=sys \ && $(MAKE) touch $@ @@ -71,7 +156,14 @@ build-gtk-shared-stamp: dh_testdir mkdir $(objdir_gtk_shared) cd $(objdir_gtk_shared) \ - && ../configure --prefix=/usr --with-gtk --enable-burnt_name --disable-newgrid \ + && ../configure --prefix=/usr \ + --with-gtk \ + --with-opengl \ + --enable-burnt_name \ + --with-zlib=sys \ + --with-libjpeg=sys \ + --with-libpng=sys \ + --with-libtiff=sys \ && $(MAKE) touch $@ @@ -79,19 +171,48 @@ build-gtk-static-stamp: dh_testdir mkdir $(objdir_gtk_static) cd $(objdir_gtk_static) \ - && ../configure --prefix=/usr --with-gtk --disable-shared \ + && ../configure --prefix=/usr \ + --with-gtk \ + --with-opengl \ + --disable-shared \ + --with-zlib=sys \ + --with-libjpeg=sys \ + --with-libpng=sys \ + --with-libtiff=sys \ && $(MAKE) touch $@ +build-gtk-debug-stamp: + dh_testdir + mkdir $(objdir_gtk_debug) + cd $(objdir_gtk_debug) \ + && ../configure --prefix=/usr \ + --with-gtk \ + --with-opengl \ + --enable-debug \ + --enable-burnt_name \ + --with-zlib=sys \ + --with-libjpeg=sys \ + --with-libpng=sys \ + --with-libtiff=sys \ + && $(MAKE) + touch $@ + +build-contrib-shared-stamp: build-gtk-shared-stamp + dh_testdir + cd $(objdir_gtk_shared)/contrib/src && $(MAKE) + touch $@ + +build-contrib-static-stamp: build-gtk-static-stamp + dh_testdir + cd $(objdir_gtk_static)/contrib/src && $(MAKE) + touch $@ + build-gtk-python-stamp: build-gtk-shared-stamp dh_testdir - cd utils/wxPython/src \ + cd wxPython/src \ && touch gtk/*.cpp gtk/*.py \ - && ../distrib/build.py -b WXDIR=../../.. WXCONFIG='$(wxconfig)' - cd utils/wxPython/modules/html \ - && ../../distrib/build.py -b WXDIR=../../../.. WXCONFIG='$(wxconfig)' - cd utils/wxPython/modules/utils \ - && ../../distrib/build.py -b WXDIR=../../../.. WXCONFIG='$(wxconfig)' + && ../distrib/build.py -b WXDIR=../.. WXCONFIG='$(wxconfig)' touch $@ build-doc-stamp: build-gtk-shared-stamp @@ -115,7 +236,7 @@ build-examples-stamp: mkdir $(objdir_examples) cp -a samples $(objdir_examples) cp -a demos $(objdir_examples) - cp -a utils/wxPython/demo $(objdir_examples)/wxPython + cp -a wxPython/demo $(objdir_examples)/wxPython @for d in $(objdir_examples)/demos $(objdir_examples)/samples; do \ (cd $$d \ && mv Makefile.in Makefile \ @@ -132,94 +253,147 @@ build-examples-stamp: clean: debian/control dh_testdir dh_testroot - rm -rf $(build_stamps) $(objdirs) - -cd utils/wxPython/src && $(MAKE) clean - -cd utils/wxPython/modules/html && $(MAKE) clean - -cd utils/wxPython/modules/utils && $(MAKE) clean + rm -rf control-files-stamp $(build_stamps) $(objdirs) + -cd wxPython/src && $(MAKE) clean dh_clean rm -f debian/$(package_wxbase_lib).* rm -f debian/$(package_wxbase_dev).* + rm -f debian/$(package_wxbase_dbg).* rm -f debian/$(package_gtk_lib).* rm -f debian/$(package_gtk_dev).* + rm -f debian/$(package_gtk_dbg).* rm -f debian/$(package_gtk_py).* + rm -f debian/$(package_gtk_contrib).* + rm -f debian/$(package_gtk_contrib_dev).* + rm -f debian/$(package_headers).* rm -f debian/$(package_doc).* rm -f debian/$(package_examples).* -install: build +install: build $(install_all) + +install-wxbase-lib: DH_OPTIONS=-p$(package_wxbase_lib) +install-wxbase-lib: build-wxbase-shared-stamp dh_testdir dh_testroot - @for f in dirs docs files postinst; do \ - echo "generating control file $(package_wxbase_lib).$$f"; \ - cp debian/libwxbase.$$f debian/$(package_wxbase_lib).$$f; \ - done; - @for f in dirs docs files links postinst prerm; do \ - echo "generating control file $(package_wxbase_dev).$$f"; \ - cp debian/libwxbase-dev.$$f debian/$(package_wxbase_dev).$$f; \ - done; - @for f in dirs docs files postinst; do \ - echo "generating control file $(package_gtk_lib).$$f"; \ - cp debian/libwxgtk.$$f debian/$(package_gtk_lib).$$f; \ - done; - @for f in dirs docs files links postinst prerm; do \ - echo "generating control file $(package_gtk_dev).$$f"; \ - cp debian/libwxgtk-dev.$$f debian/$(package_gtk_dev).$$f; \ - done; - @for f in dirs docs files postinst prerm; do \ - echo "generating control file $(package_gtk_py).$$f"; \ - cp debian/libwxgtk-python.$$f debian/$(package_gtk_py).$$f; \ - done; - @for f in dirs docs doc-base; do \ - echo "generating control file $(package_doc).$$f"; \ - cp debian/wxwin-doc.$$f debian/$(package_doc).$$f; \ - done; - @for f in docs examples; do \ - echo "generating control file $(package_examples).$$f"; \ - cp debian/wxwin-examples.$$f debian/$(package_examples).$$f; \ - done; dh_clean -k dh_installdirs + cp -a $(objdir_wxbase_shared)/lib/* debian/$(package_wxbase_lib)/usr/lib + cp $(objdir_wxbase_shared)/wxbase-config debian/$(package_wxbase_lib)/usr/bin/ + +install-wxbase-dev: DH_OPTIONS=-p$(package_wxbase_dev) +install-wxbase-dev: build-wxbase-static-stamp install-wxbase-lib + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + dh_movefiles --sourcedir=debian/$(package_wxbase_lib) + cp $(objdir_wxbase_static)/lib/*.a debian/$(package_wxbase_dev)/usr/lib + +install-wxbase-dbg: DH_OPTIONS=-p$(package_wxbase_dbg) +install-wxbase-dbg: build-wxbase-debug-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + cp -a $(objdir_wxbase_debug)/lib/* debian/$(package_wxbase_dbg)/usr/lib + cp $(objdir_wxbase_debug)/wxbased-config debian/$(package_wxbase_dbg)/usr/bin/ + +install-gtk-lib: DH_OPTIONS=-p$(package_gtk_lib) +install-gtk-lib: build-gtk-shared-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs cd $(objdir_gtk_shared) \ - && $(MAKE) install prefix=`pwd`/../debian/tmp/usr - rm -f debian/tmp/usr/bin/wx-config - cp $(objdir_gtk_static)/lib/*.a debian/tmp/usr/lib - cp -a $(objdir_wxbase_shared)/lib/* debian/tmp/usr/lib - cp $(objdir_wxbase_shared)/wxbase-config debian/tmp/usr/bin/ - cp $(objdir_wxbase_static)/lib/*.a debian/tmp/usr/lib - cd utils/wxPython/src \ - && ../distrib/build.py -i \ - TARGETDIR=../../../debian/tmp/usr/lib/python1.5/site-packages/wxPython \ - HELPERLIBDIR=../../../debian/tmp/usr/lib \ - WXDIR=../../.. - cd utils/wxPython/modules/html \ - && ../../distrib/build.py -i \ - TARGETDIR=../../../../debian/tmp/usr/lib/python1.5/site-packages/wxPython \ - WXDIR=../../../.. - cd utils/wxPython/modules/utils \ - && ../../distrib/build.py -i \ - TARGETDIR=../../../../debian/tmp/usr/lib/python1.5/site-packages/wxPython \ - WXDIR=../../../.. - rm -rf debian/tmp/usr/lib/python1.5/site-packages/wxPython/demo - find debian/tmp/usr/lib/python1.5/site-packages/wxPython \ - -name '*.py?' -exec rm '{}' ';' - dh_movefiles + && $(MAKE) install prefix=`pwd`/../debian/$(package_gtk_lib)/usr + rm -f debian/$(package_gtk_lib)/usr/bin/wx-config +install-gtk-dev: DH_OPTIONS=-p$(package_gtk_dev) +install-gtk-dev: build-gtk-static-stamp install-gtk-lib + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + dh_movefiles --sourcedir=debian/$(package_gtk_lib) + cp $(objdir_gtk_static)/lib/libwx_gtk*.a debian/$(package_gtk_dev)/usr/lib -# Build architecture-independent files here. -binary-indep: build install -# nothing to do. +install-gtk-dbg: DH_OPTIONS=-p$(package_gtk_dbg) +install-gtk-dbg: build-gtk-debug-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + cp -a $(objdir_gtk_debug)/lib/* debian/$(package_gtk_dbg)/usr/lib + cp $(objdir_gtk_debug)/wxgtkd-config debian/$(package_gtk_dbg)/usr/bin/ -# Build architecture-dependent files here. -binary-arch: build install +install-gtk-contrib: DH_OPTIONS=-p$(package_gtk_contrib) +install-gtk-contrib: build-contrib-shared-stamp dh_testdir dh_testroot - dh_installdocs - dh_installmanpages -p$(package_gtk_dev) \ + dh_clean -k + dh_installdirs + cd $(objdir_gtk_shared)/contrib/src \ + && $(MAKE) install prefix=`pwd`/../../../debian/$(package_gtk_contrib)/usr + +install-gtk-contrib-dev: DH_OPTIONS=-p$(package_gtk_contrib_dev) +install-gtk-contrib-dev: build-contrib-static-stamp install-gtk-dev + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + dh_movefiles --sourcedir=debian/$(package_gtk_contrib) + cp $(objdir_gtk_static)/lib/*.a debian/$(package_gtk_contrib_dev)/usr/lib + rm -f debian/$(package_gtk_contrib_dev)/usr/lib/libwx_gtk*.a + +install-gtk-py: DH_OPTIONS=-p$(package_gtk_py) +install-gtk-py: build-gtk-python-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + cd wxPython/src \ + && ../distrib/build.py -i \ + TARGETDIR=../../debian/$(package_gtk_py)/usr/lib/python1.5/site-packages/wxPython \ + HELPERLIBDIR=../../debian/$(package_gtk_py)/usr/lib \ + WXDIR=../.. + rm -rf debian/$(package_gtk_py)/usr/lib/python1.5/site-packages/wxPython/demo + find debian/$(package_gtk_py)/usr/lib/python1.5/site-packages/wxPython \ + -name '*.py?' -exec rm '{}' ';' + +install-headers: DH_OPTIONS=-p$(package_headers) +install-headers: install-gtk-lib + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + dh_movefiles --sourcedir=debian/$(package_gtk_lib) + dh_installmanpages \ ansi2knr.1 \ jpegtran.1 \ - libpng.3 \ + libpng.3 \ libpngpf.3 \ - zlib.3 \ + zlib.3 \ png.5 + +install-doc: DH_OPTIONS=-p$(package_doc) +install-doc: build-doc-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + +install-examples: DH_OPTIONS=-p$(package_examples) +install-examples: build-examples-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + +binary-common: + dh_testversion 1.1.17 + dh_testdir + dh_testroot + dh_installdocs dh_installchangelogs dh_installexamples dh_link @@ -233,5 +407,59 @@ binary-arch: build install dh_md5sums dh_builddeb -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install +# Build architecture-independent files here. +binary-indep: build install + $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common + +# Build architecture-dependent files here. +binary-arch: build install + $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common + +# Build all packages target. +binary: binary-arch binary-indep + + +############################################################################ +# +# Some rules to build a subset of the complete list of packages that can be +# built from CVS. Beware that packages produced with these rules may *NOT* +# be compatible with packages built using the 'binary' target or even with +# Debian policy. Do not distribute packages built with these rules, they +# are currently useful for rapid in-house testing by developers only. + +# libwxgtk shared lib package +binary-gtk: control-files-stamp install-gtk-lib install-headers + $(MAKE) -f debian/rules DH_OPTIONS="-p$(package_gtk_lib) -p$(package_headers)" binary-common + +binary-gtk-dev: control-files-stamp install-gtk-dev install-headers + $(MAKE) -f debian/rules \ + DH_OPTIONS="-p$(package_gtk_lib) -p$(package_gtk_dev) -p$(package_headers)" \ + binary-common + +binary-gtk-dbg: control-files-stamp install-gtk-dbg install-headers + $(MAKE) -f debian/rules DH_OPTIONS="-p$(package_gtk_dbg) -p$(package_headers)" binary-common + +# libwxbase shared lib package +binary-wxbase: control-files-stamp install-wxbase-lib install-headers + $(MAKE) -f debian/rules DH_OPTIONS="-p$(package_wxbase_lib) -p$(package_headers)" binary-common + +binary-wxbase-dev: control-files-stamp install-wxbase-dev install-headers + $(MAKE) -f debian/rules \ + DH_OPTIONS="-p$(package_wxbase_lib) -p$(package_wxbase_dev) -p$(package_headers)" \ + binary-common + +binary-wxbase-dbg: control-files-stamp install-wxbase-dbg install-headers + $(MAKE) -f debian/rules DH_OPTIONS="-p$(package_wxbase_dbg) -p$(package_headers)" binary-common + +# docs package +binary-doc: control-files-stamp install-doc + $(MAKE) -f debian/rules DH_OPTIONS=-p$(package_doc) binary-common + + +.PHONY: build clean binary-indep binary-arch binary binary-common binary-gtk \ + binary-gtk-dev binary-gtk-dbg binary-wxbase binary-wxbase-dev \ + binary-wxbase-dbg binary-doc install install-wxbase-lib \ + install-wxbase-dev install-wxbase-dbg install-gtk-lib install-gtk-dev \ + install-gtk-dbg install-gtk-contrib install-gtk-contrib-dev \ + install-gtk-py install-headers install-doc install-examples + diff --git a/debian/wxwin-headers.dirs b/debian/wxwin-headers.dirs new file mode 100644 index 0000000000..d3e1cff74a --- /dev/null +++ b/debian/wxwin-headers.dirs @@ -0,0 +1,3 @@ +usr/include/wx +usr/share/man/man1 + diff --git a/debian/wxwin-headers.docs b/debian/wxwin-headers.docs new file mode 100644 index 0000000000..4c4d01649e --- /dev/null +++ b/debian/wxwin-headers.docs @@ -0,0 +1,2 @@ +docs/licence.txt + diff --git a/debian/wxwin-headers.files b/debian/wxwin-headers.files new file mode 100644 index 0000000000..e3a60cecd2 --- /dev/null +++ b/debian/wxwin-headers.files @@ -0,0 +1 @@ +usr/include/wx/ diff --git a/demos/dbbrowse/browsedb.cpp b/demos/dbbrowse/browsedb.cpp index 122d3eeae3..0aced0e3ef 100644 --- a/demos/dbbrowse/browsedb.cpp +++ b/demos/dbbrowse/browsedb.cpp @@ -90,9 +90,9 @@ BrowserDB::~BrowserDB() Zeiger_auf_NULL(1); // Clean up Tables and Databases (Commit, Close und delete) } // BrowserDB destructor //---------------------------------------------------------------------------------------- -bool BrowserDB::Initialize(int Quite) +bool BrowserDB::Initialize(int Quiet) { - if (!OnStartDB(Quite)) + if (!OnStartDB(Quiet)) { wxLogMessage(_("\n\n-E-> BrowserDB::OnStartDB(%s) : Failed ! "),ODBCSource.c_str()); return FALSE; @@ -100,21 +100,21 @@ bool BrowserDB::Initialize(int Quite) return TRUE; } // BrowserDB:Initialize //---------------------------------------------------------------------------------------- -bool BrowserDB::OnStartDB(int Quite) +bool BrowserDB::OnStartDB(int Quiet) { wxStopWatch sw; - if (!Quite) + if (!Quiet) wxLogMessage(_("\n-I-> BrowserDB::OnStartDB(%s) : Begin "),ODBCSource.c_str()); if (db_BrowserDB != NULL) { - if (!Quite) + if (!Quiet) wxLogMessage(_("\n-I-> BrowserDB::OnStartDB() : DB is allready open.")); return TRUE; } // Initialize the ODBC Environment for Database Operations if (SQLAllocEnv(&ConnectInf.Henv) != SQL_SUCCESS) { - if (!Quite) + if (!Quiet) wxLogMessage(_("\n-E-> BrowserDB::OnStartDB() : DB CONNECTION ERROR : A problem occured while trying to get a connection to the data source")); return FALSE; } @@ -152,7 +152,7 @@ bool BrowserDB::OnStartDB(int Quite) strcpy(ConnectInf.Dsn, ""); strcpy(ConnectInf.Uid, ""); strcpy(ConnectInf.AuthStr, ""); - if (!Quite) + if (!Quiet) { wxLogMessage(_("\n-E-> BrowserDB::OnConnectDataSource() DB CONNECTION ERROR : Unable to connect to the data source.\n\nCheck the name of your data source to verify it has been correctly entered/spelled.\n\nWith some databases, the user name and password must\nbe created with full rights to the table prior to making a connection\n(using tools provided by the database manufacturer)")); wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End - Time needed : %ld ms"),ODBCSource.c_str(),sw.Time()); @@ -160,7 +160,7 @@ bool BrowserDB::OnStartDB(int Quite) return FALSE; } //-------------------------------------------------------------------------------------- - if (!Quite) + if (!Quiet) { Temp1 = db_BrowserDB->GetDatabaseName(); Temp2 = db_BrowserDB->GetDataSource(); @@ -171,9 +171,9 @@ bool BrowserDB::OnStartDB(int Quite) } else return FALSE; } //---------------------------------------------------------------------------------------- -bool BrowserDB::OnCloseDB(int Quite) +bool BrowserDB::OnCloseDB(int Quiet) { - if (!Quite) + if (!Quiet) wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin ")); if (db_BrowserDB) { @@ -187,12 +187,12 @@ bool BrowserDB::OnCloseDB(int Quite) } db_BrowserDB = NULL; } - if (!Quite) + if (!Quiet) wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End ")); return TRUE; } //---------------------------------------------------------------------------------------- -bool BrowserDB::OnGetNext(int Cols,int Quite) +bool BrowserDB::OnGetNext(int Cols,int Quiet) { SDWORD cb; int i_dbDataType; @@ -326,7 +326,7 @@ bool BrowserDB::OnGetNext(int Cols,int Quite) return TRUE; } //---------------------------------------------------------------------------------------- -bool BrowserDB::OnSelect(wxString tb_Name, int Quite) +bool BrowserDB::OnSelect(wxString tb_Name, int Quiet) { wxStopWatch sw; wxString SQLStmt; @@ -357,34 +357,34 @@ bool BrowserDB::OnSelect(wxString tb_Name, int Quite) //--------------------------------------------------------------------------------------- // SetColDefs ( 0,"NAME", DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), TRUE, TRUE); // Primary index //--------------------------------------------------------------------------------------- - if (!Quite) + if (!Quiet) { wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End - Time needed : %ld ms"),tb_Name.c_str(),i_Records,sw.Time()); } return TRUE; } //---------------------------------------------------------------------------------------- -bool BrowserDB::OnExecSql(wxString SQLStmt, int Quite) +bool BrowserDB::OnExecSql(wxString SQLStmt, int Quiet) { //--------------------------------------------------------------------------------------- if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData()))) { Temp0.Printf(_("\n-E-> BrowserDB::OnExecSQL - ODBC-Error with ExecSql of >%s<.\n-E-> "),SQLStmt.c_str()); Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__); - if (!Quite) + if (!Quiet) wxLogMessage(Temp0); else wxMessageBox("-E-> BrowserDB::OnExecSql - ExecSql()"); return FALSE; } - if (!Quite) + if (!Quiet) { // wxLogMessage(_("\n-I-> BrowserDB::OnExecSql(%s) - End - Time needed : %ld ms"),SQLStmt.c_str(),sw.Time()); } return TRUE; } //---------------------------------------------------------------------------------------- -wxDbInf* BrowserDB::OnGetCatalog(int Quite) +wxDbInf* BrowserDB::OnGetCatalog(int Quiet) { char UName[255]; strcpy(UName,UserName); @@ -392,13 +392,13 @@ wxDbInf* BrowserDB::OnGetCatalog(int Quite) return ct_BrowserDB; } //---------------------------------------------------------------------------------------- -wxColInf* BrowserDB::OnGetColumns(char *tableName, int numCols,int Quite) +wxDbColInf* BrowserDB::OnGetColumns(char *tableName, int numCols, int Quiet) { char UName[255]; int i; strcpy(UName,UserName); cl_BrowserDB = db_BrowserDB->GetColumns(tableName,&numCols,UName); - cl_BrowserDB->pColFor = new wxColFor[numCols]; + cl_BrowserDB->pColFor = new wxDbColFor[numCols]; for (i=0;i<numCols;i++) { (cl_BrowserDB->pColFor+i)->Format(1,(cl_BrowserDB+i)->dbDataType,(cl_BrowserDB+i)->sqlDataType, diff --git a/demos/dbbrowse/browsedb.h b/demos/dbbrowse/browsedb.h index 90fcc2bcca..d55d9c9f47 100644 --- a/demos/dbbrowse/browsedb.h +++ b/demos/dbbrowse/browsedb.h @@ -1,6 +1,6 @@ //---------------------------------------------------------------------------------------- // Name: browsedb.h -// Purpose: a wxDB class +// Purpose: a wxDb class // Author: Mark Johnson, mj10777@gmx.net // Modified by: // Created: 19991127.mj10777 @@ -26,24 +26,24 @@ class BrowserDB // for user login names and passwords, getting workstation settings, etc. // ---> IMPORTANT <--- // - // For each database object created which uses this wxDB pointer + // For each database object created which uses this wxDb pointer // connection to the database, when a CommitTrans() or RollBackTrans() - // will commit or rollback EVERY object which uses this wxDB pointer. + // will commit or rollback EVERY object which uses this wxDb pointer. // - // To allow each table object (those derived from wxTable) to be + // To allow each table object (those derived from wxDbTable) to be // individually committed or rolled back, you MUST use a different - // instance of wxDB in the constructor of the table. Doing so creates + // instance of wxDb in the constructor of the table. Doing so creates // more overhead, and will use more database connections (some DBs have // connection limits...), so use connections sparringly. // // It is recommended that one "main" database connection be created for // the entire program to use for READ-ONLY database accesses, but for each // table object which will do a CommitTrans() or RollbackTrans() that a - // new wxDB object be created and used for it. + // new wxDb object be created and used for it. //--------------------------------------------------------------------------------------- - wxDB* db_BrowserDB; + wxDb* db_BrowserDB; wxDbInf* ct_BrowserDB; - wxColInf* cl_BrowserDB; + wxDbColInf* cl_BrowserDB; wxString ODBCSource, UserName, Password; MainDoc *pDoc; //--------------------------------------------------------------------------------------- @@ -61,15 +61,15 @@ class BrowserDB BrowserDB(); ~BrowserDB(); void Zeiger_auf_NULL(int Art); - bool Initialize(int Quite); + bool Initialize(int Quiet); //--------------------------------------------------------------------------------------- - bool OnStartDB(int Quite); - bool OnCloseDB(int Quite); - bool OnSelect(wxString tb_Name,int Quite); - bool OnExecSql(wxString SQLStmt,int Quite); - bool OnGetNext(int Cols,int Quite); - wxDbInf* OnGetCatalog(int Quite); - wxColInf* OnGetColumns(char *tableName, int numCols,int Quite); + bool OnStartDB(int Quiet); + bool OnCloseDB(int Quiet); + bool OnSelect(wxString tb_Name,int Quiet); + bool OnExecSql(wxString SQLStmt,int Quiet); + bool OnGetNext(int Cols,int Quiet); + wxDbInf* OnGetCatalog(int Quiet); + wxDbColInf* OnGetColumns(char *tableName, int numCols,int Quiet); void OnFillSqlTyp(); void OnFilldbTyp(); //--------------------------------------------------------------------------------------- diff --git a/demos/dbbrowse/de/mo.cmd b/demos/dbbrowse/de/mo.cmd index da7c1256c9..d8ae41c89c 100755 --- a/demos/dbbrowse/de/mo.cmd +++ b/demos/dbbrowse/de/mo.cmd @@ -1,2 +1,3 @@ +#! /bin/sh msgfmt -o dbbrowse.mo dbbrowse.po msgfmt -o help.mo help.po diff --git a/demos/dbbrowse/de/mo_de.cmd b/demos/dbbrowse/de/mo_de.cmd index 722caf2c11..1e6d197077 100755 --- a/demos/dbbrowse/de/mo_de.cmd +++ b/demos/dbbrowse/de/mo_de.cmd @@ -1 +1,2 @@ +#! /bin/sh msgfmt -o wxStd.mo de.po diff --git a/demos/dbbrowse/de/xget.cmd b/demos/dbbrowse/de/xget.cmd index bbd922a278..17edc1468b 100755 --- a/demos/dbbrowse/de/xget.cmd +++ b/demos/dbbrowse/de/xget.cmd @@ -1 +1,2 @@ - xgettext -C -i -s -j -a -d PgmText -f xget.cfg +#! /bin/sh +xgettext -C -i -s -j -a -d PgmText -f xget.cfg diff --git a/demos/dbbrowse/makefile.g95 b/demos/dbbrowse/makefile.g95 index 1c535312d0..683a280f01 100644 --- a/demos/dbbrowse/makefile.g95 +++ b/demos/dbbrowse/makefile.g95 @@ -8,7 +8,7 @@ # Makefile for wxWindows sample (Cygwin/Mingw32). # Set WXDIR for your system -WXDIR = $(WXWIN) +WXDIR = ../.. TARGET=dbbrowse OBJECTS = dbbrowse.o doc.o pgmctrl.o tabpgwin.o \ diff --git a/demos/life/Makefile.in b/demos/life/Makefile.in index 14db842f1f..77da68dce4 100644 --- a/demos/life/Makefile.in +++ b/demos/life/Makefile.in @@ -13,11 +13,11 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../.. program_dir = demos/life -DATAFILES = samples.inc +DATAFILES = samples.inc breeder.lif PROGRAM=life -OBJECTS=$(PROGRAM).o dialogs.o game.o +OBJECTS=$(PROGRAM).o dialogs.o game.o reader.o include ../../src/makeprog.env diff --git a/demos/life/bitmaps/info.bmp b/demos/life/bitmaps/info.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3e27204adae286dfc247fec57bff534d8f90a287 GIT binary patch literal 246 zcmZ?r{l)+RWk5;;hy|dSk%0v)(Eucm@If$G08Rj9fQX@?0YU*uAd}(1fdfDqB=H}N v82<kUv49u|K|(;Hy!;Fh94`j~C`Bp_(+)BM1)Mnp=GH*Xh0#Fsk(2=d!VO_O literal 0 HcmV?d00001 diff --git a/demos/life/bitmaps/info.xpm b/demos/life/bitmaps/info.xpm new file mode 100644 index 0000000000..ac05447e24 --- /dev/null +++ b/demos/life/bitmaps/info.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *info_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 2 1", +" c None", +". c Blue", +/* pixels */ +" ", +" .... ", +" ...... ", +" ...... ", +" .... ", +" ", +" ", +" ....... ", +" ..... ", +" ..... ", +" ..... ", +" ..... ", +" ..... ", +" ..... ", +" ..... ", +" ......... " +}; diff --git a/demos/life/bitmaps/open.bmp b/demos/life/bitmaps/open.bmp new file mode 100644 index 0000000000000000000000000000000000000000..bbf93fe03364e63f3e18a3507a0e85ab8ea2f87d GIT binary patch literal 238 zcmXv{u@M3>3=;=;U&0ua+_3>YyQsonW~6N3OvKTr2(k@|B{{YeKb~(CUb3rr5zpcQ zCn>O}mP9XDa6kd~GO1FGG0<95V`X5i$V8neN$dxz4&8XX3!AZr-;ApY^eS-9oTLj~ Y^Hcc9z2|$wrXTtLH=Rc2n(WoWFRhqJ00000 literal 0 HcmV?d00001 diff --git a/demos/life/bitmaps/open.xpm b/demos/life/bitmaps/open.xpm new file mode 100644 index 0000000000..54748e910d --- /dev/null +++ b/demos/life/bitmaps/open.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *open_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 5 1", +" c None", +". c Black", +"X c Yellow", +"o c Gray100", +"O c #bfbf00", +/* pixels */ +" ", +" ... ", +" . . .", +" ..", +" ... ...", +" .XoX....... ", +" .oXoXoXoXo. ", +" .XoXoXoXoX. ", +" .oXoX..........", +" .XoX.OOOOOOOOO.", +" .oo.OOOOOOOOO. ", +" .X.OOOOOOOOO. ", +" ..OOOOOOOOO. ", +" ........... ", +" " +}; diff --git a/demos/life/bitmaps/reset.bmp b/demos/life/bitmaps/reset.bmp index 41ea143e80b3bdd14bc09ac2b704be967c27a1dc..d66feb2384ad4c626a078c995c1a3e49af78ec3c 100644 GIT binary patch literal 238 zcmbu2yA6Oa5JQcGL>b0l4tjP;1(ew=nJ8j|<6WY3bU0`GK9aK^RUId`!4(ELX-1{H u>6c`QQqJ8_T9s0iQsQ8(Wab^@`3kuPA_p->w)Xt<krS4l<G*-5<G>4Pkz>06 literal 822 zcmZ?rHDhJ~12Z700mK4O%*Y@C7H0s;AK`;whyVk_fx!wO4#adFesQ2IvKE*xQ3T-% z&}7lLaAn90xEeSESr#iBt`f+=ssK%pB=yLOA#60$khyTh5J5C9vPvKut1MPQWYf?L Lft!OVK1f6W`g6_} diff --git a/demos/life/bitmaps/reset.xpm b/demos/life/bitmaps/reset.xpm index b9ebd02762..4b17daab6f 100644 --- a/demos/life/bitmaps/reset.xpm +++ b/demos/life/bitmaps/reset.xpm @@ -1,24 +1,24 @@ /* XPM */ static char *reset_xpm[] = { /* columns rows colors chars-per-pixel */ -"16 16 2 1", +"16 15 3 1", " c None", ". c Black", +"X c Gray100", /* pixels */ " ", -" ", -" ", -" .. .. ", -" ... ... ", -" ... ... ", -" ...... ", -" .... ", -" .... ", -" ...... ", -" ... ... ", -" ... ... ", -" .. .. ", -" ", -" ", +" ........ ", +" .XXXXXX.. ", +" .XXXXXX.X. ", +" .XXXXXX.... ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" ........... ", " " }; diff --git a/demos/life/breeder.lif b/demos/life/breeder.lif new file mode 100644 index 0000000000..5a6ca8d581 --- /dev/null +++ b/demos/life/breeder.lif @@ -0,0 +1,2523 @@ +#Life 1.05 +#D Breeder, the classic original +#D by Bill Gosper, early 1970's. +#D +#D This is the first pattern to +#D demonstrate that quadratic +#D growth was possible in the +#D Game of Life. Much better +#D results have been achieved +#D since then (see MAX). +#N +#P -368 -2 +*** +..* +.* +#P -374 -16 +...** +...** +. +. +. +...* +..*** +.*...* +*.***.* +.***** +. +. +. +. +. +. +. +. +. +. +. +. +. +....*** +...*...* +..*.....* +..**.*.** +. +. +.....* +....*.* +....*.* +.....* +. +.....** +.....** +#P -339 -16 +** +** +. +. +. +. +. +. +. +. +. +** +*.* +.** +. +. +. +. +. +. +. +. +...** +..*.* +..** +. +. +. +. +. +. +. +. +. +..** +..** +#P -334 -15 +*.* +** +.* +#P -333 15 +** +*.* +* +#P -307 -16 +** +** +. +. +. +. +. +. +. +. +. +** +*.* +.** +. +. +. +. +. +. +. +. +...** +..*.* +..** +. +. +. +. +. +. +. +. +. +..** +..** +#P -286 -31 +*.* +** +.* +#P -285 31 +** +*.* +* +#P -275 -16 +** +** +. +. +. +. +. +. +. +. +. +** +*.* +.** +. +. +. +. +. +. +. +. +...** +..*.* +..** +. +. +. +. +. +. +. +. +. +..** +..** +#P -238 -47 +*.* +** +.* +#P -237 47 +** +*.* +* +#P -243 -16 +** +** +. +. +. +. +. +. +. +. +. +** +*.* +.** +. +. +. +. +. +. +. +. +...** +..*.* +..** +. +. +. +. +. +. +. +. +. +..** +..** +#P -190 -63 +*.* +** +.* +#P -189 63 +** +*.* +* +#P -211 -16 +** +** +. +. +. +. +. +. +. +. +. +** +*.* +.** +. +. +. +. +. +. +. +. +...** +..*.* +..** +. +. +. +. +. +. +. +. +. +..** +..** +#P -179 -16 +** +** +. +. +. +. +. +.....* +.....*.* +.....** +.** +*..* +*..* +.** +. +. +. +. +. +. +. +. +...** +..*..* +..*..* +...** +.......** +.......*.* +.......* +. +. +. +. +. +..** +..** +#P -142 -79 +*.* +** +.* +#P -141 79 +** +*.* +* +#P -147 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +. +. +. +. +. +. +. +. +...** +..*..* +..*..* +...** +. +. +. +. +. +. +. +. +..** +..** +#P -126 -25 +* +*.* +** +#P -124 26 +** +*.* +* +#P -94 -95 +*.* +** +.* +#P -93 95 +** +*.* +* +#P -115 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +. +. +. +. +. +. +. +. +...** +..*..* +..*..* +...** +. +. +. +. +. +. +. +. +..** +..** +#P -78 -41 +* +*.* +** +#P -76 42 +** +*.* +* +#P -46 -111 +*.* +** +.* +#P -45 111 +** +*.* +* +#P -83 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +. +. +. +. +. +. +. +. +...** +..*..* +..*..* +...** +. +. +. +. +. +. +. +. +..** +..** +#P -30 -57 +* +*.* +** +#P -28 58 +** +*.* +* +#P 3 127 +** +*.* +* +#P 2 -127 +*.* +** +.* +#P -51 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +. +. +. +. +. +. +. +. +...** +..*..* +..*..* +...** +. +. +. +. +. +. +. +. +..** +..** +#P 18 -73 +* +*.* +** +#P -4 66 +** +*.* +* +#P -19 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +. +. +. +. +. +. +. +. +...** +..*..* +..*..* +...** +. +. +. +. +. +. +. +. +..** +..** +#P 66 -89 +* +*.* +** +#P 44 82 +** +*.* +* +#P 13 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +#P 15 18 +** +** +#P 26 -8 +.* +* +*** +#P 25 16 +.** +** +..* +#P -14 54 +** +** +#P -33 -110 +** +** +#P -22 -119 +*.* +** +.* +#P -1 -110 +** +** +#P 20 74 +** +*.* +* +#P 68 90 +** +*.* +* +#P -31 112 +** +** +#P -21 119 +** +*.* +* +#P 1 112 +** +** +#P 45 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +#P 47 18 +** +** +#P 48 23 +* +* +..** +#P 74 -24 +.* +* +*** +#P 73 32 +.** +** +..* +#P 77 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +#P 79 18 +** +** +. +. +. +** +** +#P 109 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +#P 111 18 +** +** +. +. +. +** +** +#P 122 -40 +.* +* +*** +#P 141 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +#P 143 18 +** +** +. +. +. +** +** +#P 173 -16 +** +** +. +. +. +. +. +. +. +. +.** +*..* +*..* +.** +#P 175 18 +** +** +. +. +. +** +** +#P 205 -16 +** +** +#P 207 18 +** +** +. +. +. +** +** +#P 215 -14 +* +*.* +** +#P 215 8 +.** +** +..* +#P 237 -16 +** +** +#P 239 18 +** +** +. +. +. +** +** +#P 263 -30 +* +*.* +** +#P 263 24 +.** +** +..* +#P 269 -21 +** +** +. +. +. +** +** +#P 271 18 +** +** +. +. +. +** +** +#P 287 -38 +* +*.* +** +#P 311 -46 +* +*.* +** +#P 311 40 +.** +** +..* +#P 335 48 +.** +** +..* +#P 170 -56 +.* +* +*** +#P 194 -64 +.* +* +*** +#P 188 -59 +** +** +#P 220 -59 +** +** +#P 252 -64 +** +** +. +. +. +** +** +#P 139 -80 +** +** +#P 107 -80 +** +** +#P 75 -80 +** +** +#P 31 -115 +** +** +. +. +. +** +** +#P -19 -151 +** +** +. +. +. +** +** +#P 50 49 +** +** +. +. +. +** +** +#P 74 49 +** +** +. +. +. +** +** +#P 90 49 +** +** +. +. +. +** +** +#P -34 147 +** +** +. +. +. +** +** +#P 22 147 +** +** +. +. +. +** +** +#P 38 147 +** +** +. +. +. +** +** +#P 105 112 +** +** +. +. +. +** +** +#P 89 112 +** +** +. +. +. +** +** +#P 33 112 +** +** +. +. +. +** +** +#P 21 -151 +** +** +. +. +. +** +** +#P 37 -151 +** +** +. +. +. +** +** +#P 26 -135 +*.* +** +.* +#P 87 -115 +** +** +. +. +. +** +** +#P 103 -115 +** +** +. +. +. +** +** +#P 171 -85 +** +** +. +. +. +** +** +#P 195 -85 +** +** +. +. +. +** +** +#P 211 -85 +** +** +. +. +. +** +** +#P 308 -64 +** +** +. +. +. +** +** +#P 324 -64 +** +** +. +. +. +** +** +#P 301 -21 +** +** +. +. +. +** +** +#P 325 -21 +** +** +. +. +. +** +** +#P 341 -21 +** +** +. +. +. +** +** +#P 343 18 +** +** +. +. +. +** +** +#P 327 18 +** +** +. +. +. +** +** +#P 303 18 +** +** +. +. +. +** +** +#P 333 62 +** +** +. +. +. +** +** +#P 349 62 +** +** +. +. +. +** +** +#P 277 62 +** +** +. +. +. +** +** +#P 362 -30 +.....** +.****.** +.****** +..**** +.* +*.* +*.* +....** +....*.* +......* +....*** +. +. +. +....*** +......* +....*.* +....** +*.* +*.* +.* +..**** +.****** +.****.** +.....** +#P 346 -28 +...** +..*.* +.*..* +......* +* +.....*.*.* +..*..*.*..* +...**.....*..* +........*.*.*..* +.....**.*...*..* +. +.....**.*...*..* +........*.*.*..* +...**.....*..* +..*..*.*..* +.....*.*.* +* +......* +.*..* +..*.* +...** +#P 352 -33 +.**** +****** +****.** +....** +#P 352 -6 +....** +****.** +****** +.**** +#P 331 -23 +.** +*..* +*.* +.* +. +. +. +.* +*.* +*..* +.** +#P 327 -30 +.*** +***** +***.** +...** +#P 327 -9 +...** +***.** +***** +.*** + +#P 313 -22 +.** +*..*....* +.**.....* +. +. +. +.**.....* +*..*....* +.** + +#P 294 -20 +** +** +. +** +** +#P 287 -27 +....** +...*..* +**.* +.....** +*...** +..*.* +. +. +. +. +. +. +. +..*.* +*...** +.....** +**.* +...*..* +....** +#P 364 9 +.......** +...****.** +...****** +....**** +..* +** +.*..* +..***.** +........* +........* +....*..** +.....** +. +.....** +....*..** +........* +........* +..***.** +.*..* +** +..* +....**** +...****** +...****.** +.......** +#P 350 10 +.*** +.* +....* +...* +. +......* +.....**** +........* +****..*.** +*.*.*.*....** +.**..*.* +. +.**..*.* +*.*.*.*....** +****..*.** +........* +.....**** +......* +. +...* +....* +.* +.*** +#P 356 6 +.**** +****** +****.** +....** +#P 342 -38 +.** +**** +**.** +..** +#P 356 33 +....** +****.** +****** +.**** +#P 346 38 +..** +**.** +**** +.** +#P 326 -2 +.* +* +. +.*.* +...* +.* +..* +#P 331 9 +.*** +***** +***.** +...** +#P 331 30 +...** +***.** +***** +.*** +#P 333 16 +.** +*..* +*.* +.* +. +. +. +.* +*.* +*..* +.** +#P 315 17 +.** +*..* +.** +. +. +. +.** +*..* +.** +#P 296 19 +** +** +. +** +** +#P 290 11 +..** +...** +.*.* +*** +*..* +*.*** +.*..* +..** +. +. +. +. +. +..** +.*..* +*.*** +*..* +*** +.*.* +...** +..** +#P 287 32 +.** +** +..* +#P 367 51 +...** +.*....* +.......* +.*.....* +..****** +. +. +. +. +...*** +.*...** +.*.*..** +*.....* +.***** +. +.***** +*.....* +.*.*..** +.*...** +...*** +. +. +. +. +..****** +.*.....* +.......* +.*....* +...** +#P 355 57 +..*..* +.***.** +**...*.** +.*...* +.*.*.*.** +..*****.*.* +...*....** +.........* +. +.........* +...*....** +..*****.*.* +.*.*.*.** +.*...* +**...*.** +.***.** +..*..* +#P 357 51 +.****** +*.....* +......* +*....* +.*.* +#P 357 75 +.*.* +*....* +......* +*.....* +.****** +#P 339 60 +.** +*..* +*.* +.* +. +. +. +.* +*.* +*..* +.** +#P 332 54 +.***** +*....* +.....* +*...* +..* +#P 332 72 +..* +*...* +.....* +*....* +.***** +#P 322 60 +..**.* +.****.** +*....** +*.* +.* +. +.* +*.* +*....** +.****.** +..**.* +#P 306 62 +**.** +.*** +.** +. +.** +.*** +**.** +#P 302 63 +* +** +. +** +* +#P 292 57 +.......* +......*.* +.........* +....*.** +..*.** +***..** +.**..** +. +. +. +.**..** +***..** +..*.** +....*.** +.........* +......*.* +.......* +#P 272 56 +.***** +*....* +.....* +*...* +..* +#P 272 70 +..* +*...* +.....* +*....* +.***** +#P 347 81 +*..* +....* +*...* +.**** +#P 343 -74 +.**** +****** +****.** +....** +. +. +. +. +..** +.*..** +***..* +*....* +***** +. +***** +*....* +***..* +.*..** +..** +. +. +. +. +....** +****.** +****** +.**** +#P 330 -70 +...* +....* +..**** +**...*.** +.*.*.*.* +.*...***..* +..*.*...* +...*....*** +. +. +. +...*....*** +..*.*...* +.*...***..* +.*.*.*.* +**...*.** +..**** +....* +...* +#P 332 -75 +....** +****.** +****** +.**** +#P 332 -50 +.**** +****** +****.** +....** +#P 314 -66 +.** +*..* +*.* +.* +. +. +. +.* +*.* +*..* +.** +#P 307 -72 +...** +***.** +***** +.*** +#P 307 -53 +.*** +***** +***.** +...** +#P 297 -69 +..* +..* +. +......* +.****.* +*..*.** +*.* +.* +. +.* +*.* +*..*.** +.****.* +......* +. +..* +..* +#P 281 -65 +.*.* +....* +**.* +..* +. +..* +**.* +....* +.*.* +#P 277 -63 +* +*** +. +*** +* +#P 268 -68 +.....*** +...*..** +..*...*.* +*...* +*...** +* +.*...* +. +.*...* +* +*...** +*...* +..*...*.* +...*..** +.....*** +#P 322 -80 +..** +**.** +**** +.** +#P 247 -70 +...** +***.** +***** +.*** +#P 236 -94 +.....** +.****.** +.****** +..**** +. +. +..** +.*...* +.*....* +*.....* +.**.*** +. +. +. +.**.*** +*.....* +.*....* +.*...* +..** +. +. +..**** +.****** +.****.** +.....** +#P 232 -91 +.* +*..* +. +. +. +.* +..* +. +. +. +. +. +..* +.* +. +. +. +*..* +.* +#P 226 -97 +.**** +****** +****.** +....** +#P 226 -70 +....** +****.** +****** +.**** +#P 218 -89 +.....*** +...***** +..*** +.*...* +**..*....** +*......*** +.******** +. +.******** +*......*** +**..*....** +.*...* +..*** +...***** +.....*** +#P 216 -102 +.** +**** +**.** +..** +#P 218 -94 +*** +* +.* +#P 218 -72 +.* +* +*** +#P 201 -73 +...** +***.** +***** +.*** +#P 201 -94 +.*** +***** +***.** +...** +#P 201 -88 +.** +.** +*..* +*.* +.* +. +. +. +.* +*.* +*..* +.** +.** +#P 183 -86 +.** +*..* +.** +. +. +. +.** +*..* +.**. +#P 156 -93 +....*.* +...**..* +..***..* +.*** +.*.*..** +**.***.* +.*......* +..*....* +....***** +........** +........** +. +........** +........** +....***** +..*....* +.*......* +**.***.* +.*.*..** +.*** +..***..* +...**..* +....*.* +#P 141 -92 +.*** +***** +***.** +...** +#P 122 -125 +.**** +****** +****.** +....** +. +. +. +. +..** +.*..** +***..* +*....* +***** +. +***** +*....* +***..* +.*..** +..** +. +. +. +. +....** +****.** +****** +.**** +#P 109 -121 +...* +....* +..**** +**...*.** +.*.*.*.* +.*...***..* +..*.*...* +...*....*** +. +. +. +...*....*** +..*.*...* +.*...***..* +.*.*.*.* +**...*.** +..**** +....* +...* +#P 111 -126 +....** +****.** +****** +.**** +#P 111 -101 +.**** +****** +****.** +....** +#P 93 -117 +.** +*..* +*.* +.* +. +. +. +.* +*.* +*..* +.** +#P 86 -123 +...** +***.** +***** +.*** +#P 86 -104 +.*** +***** +***.** +...** +#P 76 -120 +..* +..* +. +......* +.****.* +*..*.** +*.* +.* +. +.* +*.* +*..*.** +.****.* +......* +. +..* +..* +#P 60 -116 +.*.* +....* +**.* +..* +. +..* +**.* +....* +.*.* +#P 56 -114 +* +*** +. +*** +* +#P 47 -119 +.....*** +...*..** +..*...*.* +*...* +*...** +* +.*...* +. +.*...* +* +*...** +*...* +..*...*.* +...*..** +.....*** +#P 101 -131 +..** +**.** +**** +.** +#P 90 -97 +* +*.* +** +#P 26 -121 +...** +***.** +***** +.*** +#P 51 -160 +.****** +*.....* +......* +*....* +..** +. +..** +.*.** +**.*.* +*.**.** +*...** +..*** +. +..*** +*...** +*.**.** +**.*.* +.*.** +..** +. +..** +*....* +......* +*.....* +.****** +#P 43 -154 +..*** +*...* +* +* +.*..* +..*.* +. +..*.* +.*..* +* +* +*...* +..*** +#P 40 -164 +..** +*....* +......* +*.....* +.****** +#P 40 -136 +.****** +*.....* +......* +*....* +..** +#P 27 -153 +..* +.*.* +* +.* +. +. +. +.* +* +.*.* +..* +#P 26 -163 +..* +*.* +*.* +#P 15 -161 +..* +*...* +.....* +*....* +.***** +#P 15 -139 +.***** +*....* +.....* +*...* +..* +#P 15 -153 +* +.* +.* +* +. +. +. +* +.* +.* +* +#P 8 -155 +...** +...** +...** +**.** +.*.* +.*** +. +. +. +.*** +.*.* +**.** +...** +...** +...** +#P 5 -151 +** +** +. +. +. +** +** +#P -7 -152 +.** +*..* +.** +. +. +. +.** +*..* +.** +#P -33 -161 +.*.* +.*.* +.*.** +...** +*..* +.** +#P -33 -140 +.** +*..* +...** +.*.** +.*.* +.*.* +#P -45 -159 +..* +*...* +.....* +*....* +.***** +#P -45 -141 +.***** +*....* +.....* +*...* +..* +#P 30 -168 +*..* +....* +*...* +.**** +#P 111 38 +......** +....*....* +..........* +....*.....* +.....****** +.* +.*** +*.**..* +..***..* +.*****..* +.***.*.*** +......**.** +.....**.** +. +. +. +.....**.** +......**.** +.***.*.*** +.*****..* +..***..* +*.**..* +.*** +.* +.....****** +....*.....* +..........* +....*....* +......** +#P 104 38 +.****** +*.....* +......* +*....* +..** +#P 104 62 +..** +*....* +......* +*.....* +.****** +#P 97 45 +......* +.....*** +..*** +.*...*...* +*..*.*....* +*........* +.******** +. +.******** +*........* +*..*.*....* +.*...*...* +..*** +.....*** +......* +#P 97 40 +.** +** +..* +#P 97 62 +..* +** +.** +#P 79 41 +.***** +*....* +.....* +*...* +..* +. +..** +.*..* +.*.* +..* +. +. +. +..* +.*.* +.*..* +..** +. +..* +*...* +.....* +*....* +.***** +#P 62 48 +.** +*..* +.** +. +. +. +.** +*..* +.** +#P 43 50 +** +** +. +** +** +#P 36 41 +....** +...*** +.**...* +.*...* +* +***..** +*.*.*** +.***.** +...** +. +. +. +. +. +...** +.***.** +*.*.*** +***..** +* +.*...* +.**...* +...*** +....** +#P 19 43 +.***** +*....* +.....* +*...* +..* +#P 18 54 +** +** +#P 94 68 +*..* +....* +*...* +.**** +#P 124 102 +.**** +****** +****.** +....** +. +. +. +. +..** +.*..** +***..* +*....* +***** +. +***** +*....* +***..* +.*..** +..** +. +. +. +. +....** +****.** +****** +.**** +#P 111 106 +...* +....* +..**** +**...*.** +.*.*.*.* +.*...***..* +..*.*...* +...*....*** +. +. +. +...*....*** +..*.*...* +.*...***..* +.*.*.*.* +**...*.** +..**** +....* +...* +#P 113 101 +....** +****.** +****** +.**** +#P 113 126 +.**** +****** +****.** +....** +#P 95 110 +.** +*..* +*.* +.* +. +. +. +.* +*.* +*..* +.** +#P 88 104 +...** +***.** +***** +.*** +#P 88 123 +.*** +***** +***.** +...** +#P 78 107 +..* +..* +. +......* +.****.* +*..*.** +*.* +.* +. +.* +*.* +*..*.** +.****.* +......* +. +..* +..* +#P 62 111 +.*.* +....* +**.* +..* +. +..* +**.* +....* +.*.* +#P 58 113 +* +*** +. +*** +* +#P 49 108 +.....*** +...*..** +..*...*.* +*...* +*...** +* +.*...* +. +.*...* +* +*...** +*...* +..*...*.* +...*..** +.....*** +#P 28 121 +.*** +***** +***.** +...** +#P 103 131 +.** +**** +**.** +..** +#P 92 98 +** +*.* +* +#P 51 137 +...**** +..****** +..****.** +......** +. +. +. +...*** +.** +.*....** +**.**..* +.......* +....*** +. +....*** +.......* +**.**..* +.*....** +.** +...*** +. +. +. +......** +..****.** +..****** +...**** +#P 43 143 +....* +....** +..*..* +*** +.** +..*.* +....* +. +....* +..*.* +.** +*** +..*..* +....** +....* +#P 42 136 +....** +****.** +****** +.**** +#P 42 161 +.**** +****** +****.** +....** +#P 28 145 +..* +.** +*** +. +. +. +. +. +*** +.** +..* +#P 17 139 +...** +***.** +***** +.*** +#P 17 158 +.*** +***** +***.** +...** +#P 16 146 +** +** +#P 16 153 +** +** +#P 9 143 +...** +..*..* +.....* +** +. +.*.* +..* +. +..* +.*.* +. +** +.....* +..*..* +...** +#P -15 139 +...............* +.............**.* +............*...* +........****.*.* +.......*.*...** +.**....*.* +**.*..**.** +.**.***..**** +...*...**.*.** +.........**.** +...........* +. +...........* +.........**.** +...*...**.*.** +.**.***..**** +**.*..**.** +.**....*.* +.......*.*...** +........****.*.* +............*...* +.............**.* +...............* +#P -21 144 +..* +.*.* +*...* +.*..* +.**.** +. +. +. +.**.** +.*..* +*...* +.*.* +..* +#P -43 141 +...** +***.** +***** +.*** +#P -43 156 +.*** +***** +***.** +...** +#P 28 164 +.** +* +#P 32 166 +.** +**** +**.** +..** +#P 27 135 +** +*.* +* diff --git a/demos/life/dialogs.cpp b/demos/life/dialogs.cpp index 0d8989793e..98b1cc21b6 100644 --- a/demos/life/dialogs.cpp +++ b/demos/life/dialogs.cpp @@ -93,16 +93,16 @@ LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent) 0, NULL, wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL ); - for (unsigned i = 0; i < (sizeof(g_shapes) / sizeof(LifeShape)); i++) - m_list->Append(g_shapes[i].m_name); + for (unsigned i = 0; i < (sizeof(g_patterns) / sizeof(LifePattern)); i++) + m_list->Append(g_patterns[i].m_name); // descriptions wxStaticBox *statbox = new wxStaticBox( this, -1, _("Description")); m_life = new Life(); - m_life->SetShape(g_shapes[0]); + m_life->SetPattern(g_patterns[0]); m_canvas = new LifeCanvas( this, m_life, FALSE ); m_text = new wxTextCtrl( this, -1, - g_shapes[0].m_desc, + g_patterns[0].m_description, wxDefaultPosition, wxSize(300, 60), wxTE_MULTILINE | wxTE_READONLY); @@ -136,9 +136,9 @@ LifeSamplesDialog::~LifeSamplesDialog() m_canvas->Destroy(); } -const LifeShape& LifeSamplesDialog::GetShape() +const LifePattern& LifeSamplesDialog::GetPattern() { - return g_shapes[m_value]; + return g_patterns[m_value]; } void LifeSamplesDialog::OnListBox(wxCommandEvent& event) @@ -148,15 +148,14 @@ void LifeSamplesDialog::OnListBox(wxCommandEvent& event) if (sel != -1) { m_value = m_list->GetSelection(); - m_text->SetValue(g_shapes[ sel ].m_desc); - m_life->SetShape(g_shapes[ sel ]); + m_text->SetValue(g_patterns[ sel ].m_description); + m_life->SetPattern(g_patterns[ sel ]); - // quick and dirty :-) - if ((g_shapes[ sel ].m_width > 36) || - (g_shapes[ sel ].m_height > 22)) - m_canvas->SetCellSize(2); - else + // these values shouldn't be hardcoded... + if ((size_t)sel < (sizeof(g_patterns) / sizeof(LifePattern)) - 3) m_canvas->SetCellSize(8); + else + m_canvas->SetCellSize(2); } } @@ -182,7 +181,7 @@ LifeAboutDialog::LifeAboutDialog(wxWindow *parent) wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); sizer->Add( sbmp, 0, wxCENTRE | wxALL, 10 ); sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 ); - sizer->Add( CreateTextSizer(_("Life! version 2.1 for wxWindows\n\n" + sizer->Add( CreateTextSizer(_("Life! version 2.2 for wxWindows\n\n" "(c) 2000 Guillermo Rodriguez Garcia\n\n" "<guille@iies.es>\n\n" "Portions of the code are based in XLife;\n" diff --git a/demos/life/dialogs.h b/demos/life/dialogs.h index b2187cb0c3..e41e45953c 100644 --- a/demos/life/dialogs.h +++ b/demos/life/dialogs.h @@ -44,7 +44,7 @@ public: ~LifeSamplesDialog(); // members - const LifeShape& GetShape(); + const LifePattern& GetPattern(); // event handlers void OnListBox(wxCommandEvent &event); diff --git a/demos/life/game.cpp b/demos/life/game.cpp index f5c2e09f3b..46264b5238 100644 --- a/demos/life/game.cpp +++ b/demos/life/game.cpp @@ -117,17 +117,24 @@ bool CellBox::SetCell(int dx, int dy, bool alive) Life::Life() { - m_numcells = 0; - m_boxes = new CellBox *[HASHSIZE]; - m_head = NULL; - m_available = NULL; + // pattern description + m_name = _(""); + m_rules = _(""); + m_description = _(""); + + // pattern data + m_numcells = 0; + m_boxes = new CellBox *[HASHSIZE]; + m_head = NULL; + m_available = NULL; for (int i = 0; i < HASHSIZE; i++) m_boxes[i] = NULL; - m_cells = new Cell[ARRAYSIZE]; - m_ncells = 0; - m_findmore = FALSE; - m_changed = FALSE; + // state vars for BeginFind & FindMore + m_cells = new Cell[ARRAYSIZE]; + m_ncells = 0; + m_findmore = FALSE; + m_changed = FALSE; } Life::~Life() @@ -145,8 +152,6 @@ void Life::Clear() { CellBox *c, *nc; - m_numcells = 0; - // clear the hash table pointers for (int i = 0; i < HASHSIZE; i++) m_boxes[i] = NULL; @@ -170,6 +175,12 @@ void Life::Clear() c = nc; } m_available = NULL; + + // reset state + m_name = _(""); + m_rules = _(""); + m_description = _(""); + m_numcells = 0; } // -------------------------------------------------------------------------- @@ -204,19 +215,38 @@ void Life::SetCell(wxInt32 x, wxInt32 y, bool alive) } } -void Life::SetShape(const LifeShape& shape) +void Life::SetPattern(const LifePattern& pattern) { - char *p = shape.m_data; - - int i0 = -(shape.m_width / 2); - int j0 = -(shape.m_height / 2); - int i1 = i0 + shape.m_width - 1; - int j1 = j0 + shape.m_height - 1; + wxArrayString data = pattern.m_shape; + wxString line; + long x = 0, + y = 0; Clear(); - for (int j = j0; j <= j1; j++) - for (int i = i0; i <= i1; i++) - SetCell(i, j, *(p++) == '*'); + for (size_t n = 0; n < data.GetCount(); n++) + { + line = data[n]; + + if ( (line.GetChar(0) != wxT('*')) && + (line.GetChar(0) != wxT('.')) ) + { + // assume that it is a digit or a minus sign + line.BeforeFirst(wxT(' ')).ToLong(&x); + line.AfterFirst(wxT(' ')).ToLong(&y); + } + else + { + // pattern data + for (size_t k = 0; k < line.Len(); k++) + SetCell(x + k, y, line.GetChar(k) == wxT('*')); + + y++; + } + } + + m_name = pattern.m_name; + m_rules = pattern.m_rules; + m_description = pattern.m_description; } // -------------------------------------------------------------------------- @@ -337,110 +367,110 @@ void Life::KillBox(CellBox *c) Cell Life::FindCenter() { - double i, j; + double sx, sy; int n; - i = 0.0; - j = 0.0; + sx = 0.0; + sy = 0.0; n = 0; CellBox *c; for (c = m_head; c; c = c->m_next) if (!c->m_dead) { - i += c->m_x; - j += c->m_y; + sx += c->m_x; + sy += c->m_y; n++; } if (n > 0) { - i = (i / n) + CELLBOX / 2; - j = (j / n) + CELLBOX / 2; + sx = (sx / n) + CELLBOX / 2; + sy = (sy / n) + CELLBOX / 2; } Cell cell; - cell.i = (wxInt32) i; - cell.j = (wxInt32) j; + cell.i = (wxInt32) sx; + cell.j = (wxInt32) sy; return cell; } Cell Life::FindNorth() { - wxInt32 i = 0, j = 0; + wxInt32 x = 0, y = 0; bool first = TRUE; CellBox *c; for (c = m_head; c; c = c->m_next) - if (!c->m_dead && ((first) || (c->m_y < j))) + if (!c->m_dead && ((first) || (c->m_y < y))) { - i = c->m_x; - j = c->m_y; + x = c->m_x; + y = c->m_y; first = FALSE; } Cell cell; - cell.i = first? 0 : i + CELLBOX / 2; - cell.j = first? 0 : j + CELLBOX / 2; + cell.i = first? 0 : x + CELLBOX / 2; + cell.j = first? 0 : y + CELLBOX / 2; return cell; } Cell Life::FindSouth() { - wxInt32 i = 0, j = 0; + wxInt32 x = 0, y = 0; bool first = TRUE; CellBox *c; for (c = m_head; c; c = c->m_next) - if (!c->m_dead && ((first) || (c->m_y > j))) + if (!c->m_dead && ((first) || (c->m_y > y))) { - i = c->m_x; - j = c->m_y; + x = c->m_x; + y = c->m_y; first = FALSE; } Cell cell; - cell.i = first? 0 : i + CELLBOX / 2; - cell.j = first? 0 : j + CELLBOX / 2; + cell.i = first? 0 : x + CELLBOX / 2; + cell.j = first? 0 : y + CELLBOX / 2; return cell; } Cell Life::FindWest() { - wxInt32 i = 0, j = 0; + wxInt32 x = 0, y = 0; bool first = TRUE; CellBox *c; for (c = m_head; c; c = c->m_next) - if (!c->m_dead && ((first) || (c->m_x < i))) + if (!c->m_dead && ((first) || (c->m_x < x))) { - i = c->m_x; - j = c->m_y; + x = c->m_x; + y = c->m_y; first = FALSE; } Cell cell; - cell.i = first? 0 : i + CELLBOX / 2; - cell.j = first? 0 : j + CELLBOX / 2; + cell.i = first? 0 : x + CELLBOX / 2; + cell.j = first? 0 : y + CELLBOX / 2; return cell; } Cell Life::FindEast() { - wxInt32 i = 0, j = 0; + wxInt32 x = 0, y = 0; bool first = TRUE; CellBox *c; for (c = m_head; c; c = c->m_next) - if (!c->m_dead && ((first) || (c->m_x > i))) + if (!c->m_dead && ((first) || (c->m_x > x))) { - i = c->m_x; - j = c->m_y; + x = c->m_x; + y = c->m_y; first = FALSE; } Cell cell; - cell.i = first? 0 : i + CELLBOX / 2; - cell.j = first? 0 : j + CELLBOX / 2; + cell.i = first? 0 : x + CELLBOX / 2; + cell.j = first? 0 : y + CELLBOX / 2; return cell; } @@ -453,35 +483,35 @@ Cell Life::FindEast() // argument (or pass 0, the default value) to post alive cells // only, else it will post cells which have changed. // -void Life::DoLine(wxInt32 i, wxInt32 j, wxUint32 live, wxUint32 old) +void Life::DoLine(wxInt32 x, wxInt32 y, wxUint32 live, wxUint32 old) { wxUint32 diff = (live ^ old) & 0xff; if (!diff) return; - for (wxInt32 k = 8; k; k--, i++) + for (wxInt32 k = 8; k; k--, x++) { if (diff & 0x01) { - m_cells[m_ncells].i = i; - m_cells[m_ncells].j = j; + m_cells[m_ncells].i = x; + m_cells[m_ncells].j = y; m_ncells++; } diff >>= 1; } } -void Life::BeginFind(wxInt32 i0, wxInt32 j0, wxInt32 i1, wxInt32 j1, bool changed) +void Life::BeginFind(wxInt32 x0, wxInt32 y0, wxInt32 x1, wxInt32 y1, bool changed) { // TODO: optimize for the case where the maximum number of // cellboxes that fit in the specified viewport is smaller // than the current total of boxes; iterating over the list // should then be faster than searching in the hash table. - m_i0 = m_i = i0 & 0xfffffff8; - m_j0 = m_j = j0 & 0xfffffff8; - m_i1 = (i1 + 7) & 0xfffffff8; - m_j1 = (j1 + 7) & 0xfffffff8; + m_x0 = m_x = x0 & 0xfffffff8; + m_y0 = m_y = y0 & 0xfffffff8; + m_x1 = (x1 + 7) & 0xfffffff8; + m_y1 = (y1 + 7) & 0xfffffff8; m_findmore = TRUE; m_changed = changed; @@ -495,10 +525,10 @@ bool Life::FindMore(Cell *cells[], size_t *ncells) if (m_changed) { - for ( ; m_j <= m_j1; m_j += 8, m_i = m_i0) - for ( ; m_i <= m_i1; m_i += 8) + for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0) + for ( ; m_x <= m_x1; m_x += 8) { - if ((c = LinkBox(m_i, m_j, FALSE)) == NULL) + if ((c = LinkBox(m_x, m_y, FALSE)) == NULL) continue; // check whether there is enough space left in the array @@ -508,22 +538,22 @@ bool Life::FindMore(Cell *cells[], size_t *ncells) return FALSE; } - DoLine(m_i, m_j , c->m_live1, c->m_old1 ); - DoLine(m_i, m_j + 1, c->m_live1 >> 8, c->m_old1 >> 8 ); - DoLine(m_i, m_j + 2, c->m_live1 >> 16, c->m_old1 >> 16); - DoLine(m_i, m_j + 3, c->m_live1 >> 24, c->m_old1 >> 24); - DoLine(m_i, m_j + 4, c->m_live2, c->m_old2 ); - DoLine(m_i, m_j + 5, c->m_live2 >> 8, c->m_old2 >> 8 ); - DoLine(m_i, m_j + 6, c->m_live2 >> 16, c->m_old2 >> 16); - DoLine(m_i, m_j + 7, c->m_live2 >> 24, c->m_old2 >> 24); + DoLine(m_x, m_y , c->m_live1, c->m_old1 ); + DoLine(m_x, m_y + 1, c->m_live1 >> 8, c->m_old1 >> 8 ); + DoLine(m_x, m_y + 2, c->m_live1 >> 16, c->m_old1 >> 16); + DoLine(m_x, m_y + 3, c->m_live1 >> 24, c->m_old1 >> 24); + DoLine(m_x, m_y + 4, c->m_live2, c->m_old2 ); + DoLine(m_x, m_y + 5, c->m_live2 >> 8, c->m_old2 >> 8 ); + DoLine(m_x, m_y + 6, c->m_live2 >> 16, c->m_old2 >> 16); + DoLine(m_x, m_y + 7, c->m_live2 >> 24, c->m_old2 >> 24); } } else { - for ( ; m_j <= m_j1; m_j += 8, m_i = m_i0) - for ( ; m_i <= m_i1; m_i += 8) + for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0) + for ( ; m_x <= m_x1; m_x += 8) { - if ((c = LinkBox(m_i, m_j, FALSE)) == NULL) + if ((c = LinkBox(m_x, m_y, FALSE)) == NULL) continue; // check whether there is enough space left in the array @@ -533,14 +563,14 @@ bool Life::FindMore(Cell *cells[], size_t *ncells) return FALSE; } - DoLine(m_i, m_j , c->m_live1 ); - DoLine(m_i, m_j + 1, c->m_live1 >> 8 ); - DoLine(m_i, m_j + 2, c->m_live1 >> 16); - DoLine(m_i, m_j + 3, c->m_live1 >> 24); - DoLine(m_i, m_j + 4, c->m_live2 ); - DoLine(m_i, m_j + 5, c->m_live2 >> 8 ); - DoLine(m_i, m_j + 6, c->m_live2 >> 16); - DoLine(m_i, m_j + 7, c->m_live2 >> 24); + DoLine(m_x, m_y , c->m_live1 ); + DoLine(m_x, m_y + 1, c->m_live1 >> 8 ); + DoLine(m_x, m_y + 2, c->m_live1 >> 16); + DoLine(m_x, m_y + 3, c->m_live1 >> 24); + DoLine(m_x, m_y + 4, c->m_live2 ); + DoLine(m_x, m_y + 5, c->m_live2 >> 8 ); + DoLine(m_x, m_y + 6, c->m_live2 >> 16); + DoLine(m_x, m_y + 7, c->m_live2 >> 24); } } diff --git a/demos/life/game.h b/demos/life/game.h index f88644cb9b..cca12fae4b 100644 --- a/demos/life/game.h +++ b/demos/life/game.h @@ -29,45 +29,44 @@ #endif // -------------------------------------------------------------------------- -// Cell -// -------------------------------------------------------------------------- - -// A Cell is just a struct which contains a pair of (i, j) coords. -// These structs are not used internally anywhere; they are just -// used to pass cell coordinates around. - -struct Cell -{ - wxInt32 i; - wxInt32 j; -}; - -// -------------------------------------------------------------------------- -// LifeShape +// LifePattern // -------------------------------------------------------------------------- // A class which holds a pattern -class LifeShape +class LifePattern { public: - LifeShape(wxString name, - wxString desc, - int width, - int height, - char *data) + // This ctor is used by the LifeReader class + LifePattern(wxString name, + wxString description, + wxString rules, + wxArrayString shape) + { + m_name = name; + m_description = description; + m_rules = rules; + m_shape = shape; + }; + + // A more convenient ctor for the built-in samples + LifePattern(wxString name, + wxString description, + int width, + int height, + const char *shape) { - m_name = name; - m_desc = desc; - m_width = width; - m_height = height; - m_data = data; - } - - wxString m_name; - wxString m_desc; - int m_width; - int m_height; - char *m_data; + m_name = name; + m_description = description; + m_rules = _(""); + m_shape.Add( wxString::Format("%i %i", -width/2, -height/2) ); + for(int j = 0; j < height; j++) + m_shape.Add( wxString(shape + (j * width), (size_t) width) ); + }; + + wxString m_name; + wxString m_description; + wxString m_rules; + wxArrayString m_shape; }; @@ -75,8 +74,17 @@ public: // Life // -------------------------------------------------------------------------- +// A struct used to pass cell coordinates around +struct Cell +{ + wxInt32 i; + wxInt32 j; +}; + +// A private class that contains data about a block of cells class CellBox; +// A class that models a Life game instance class Life { public: @@ -85,10 +93,12 @@ public: ~Life(); // accessors - inline wxUint32 GetNumCells() const { return m_numcells; }; - bool IsAlive (wxInt32 x, wxInt32 y); - void SetCell (wxInt32 x, wxInt32 y, bool alive = TRUE); - void SetShape (const LifeShape &shape); + inline wxUint32 GetNumCells() const { return m_numcells; }; + inline wxString GetRules() const { return m_rules; }; + inline wxString GetDescription() const { return m_description; }; + bool IsAlive(wxInt32 x, wxInt32 y); + void SetCell(wxInt32 x, wxInt32 y, bool alive = TRUE); + void SetPattern(const LifePattern &pattern); // game control void Clear(); @@ -119,8 +129,8 @@ public: // FALSE, then the operation is not complete: just process all cells // and call FillMore() again. // - void BeginFind(wxInt32 i0, wxInt32 j0, - wxInt32 i1, wxInt32 j1, + void BeginFind(wxInt32 x0, wxInt32 y0, + wxInt32 x1, wxInt32 y1, bool changed); bool FindMore(Cell *cells[], size_t *ncells); @@ -131,20 +141,28 @@ private: void KillBox(CellBox *c); // helper for BeginFind & FindMore - void DoLine(wxInt32 i, wxInt32 j, wxUint32 alive, wxUint32 old = 0); - - - CellBox *m_head; // list of alive boxes - CellBox *m_available; // list of reusable dead boxes - CellBox **m_boxes; // hash table of alive boxes - wxUint32 m_numcells; // population (number of alive cells) - Cell *m_cells; // cell array for FindMore() - size_t m_ncells; // number of valid cells in cell array - wxInt32 m_i, m_j, // state vars for FindMore() - m_i0, m_j0, - m_i1, m_j1; - bool m_changed; - bool m_findmore; + void DoLine(wxInt32 x, wxInt32 y, wxUint32 alive, wxUint32 old = 0); + + + // pattern description + wxString m_name; // name (currently unused) + wxString m_rules; // rules (currently unused) + wxString m_description; // description + + // pattern data + CellBox *m_head; // list of alive boxes + CellBox *m_available; // list of reusable dead boxes + CellBox **m_boxes; // hash table of alive boxes + wxUint32 m_numcells; // population (number of alive cells) + + // state vars for BeginFind & FindMore + Cell *m_cells; // array of cells + size_t m_ncells; // number of valid entries in m_cells + wxInt32 m_x, m_y, // counters and search mode + m_x0, m_y0, + m_x1, m_y1; + bool m_changed; + bool m_findmore; }; #endif // _LIFE_GAME_H_ diff --git a/demos/life/life.cpp b/demos/life/life.cpp index 8b29dca570..f01e3e0be7 100644 --- a/demos/life/life.cpp +++ b/demos/life/life.cpp @@ -29,10 +29,13 @@ #endif #include "wx/statline.h" +#include "wx/wfstream.h" +#include "wx/filedlg.h" #include "life.h" #include "game.h" #include "dialogs.h" +#include "reader.h" // -------------------------------------------------------------------------- // resources @@ -44,10 +47,12 @@ // bitmap buttons for the toolbar #include "bitmaps/reset.xpm" + #include "bitmaps/open.xpm" #include "bitmaps/play.xpm" #include "bitmaps/stop.xpm" #include "bitmaps/zoomin.xpm" #include "bitmaps/zoomout.xpm" + #include "bitmaps/info.xpm" // navigator #include "bitmaps/north.xpm" @@ -67,22 +72,14 @@ enum // timer ID_TIMER = 1001, - // menu items and toolbar buttons - ID_RESET, + // file menu + ID_NEW, + ID_OPEN, ID_SAMPLES, ID_ABOUT, ID_EXIT, - ID_START, - ID_STEP, - ID_STOP, - ID_ZOOMIN, - ID_ZOOMOUT, - ID_TOPSPEED, - - // speed selection slider - ID_SLIDER, - // navigation + // view menu ID_SHOWNAV, ID_ORIGIN, ID_CENTER, @@ -90,6 +87,18 @@ enum ID_SOUTH, ID_EAST, ID_WEST, + ID_ZOOMIN, + ID_ZOOMOUT, + ID_INFO, + + // game menu + ID_START, + ID_STEP, + ID_STOP, + ID_TOPSPEED, + + // speed selection slider + ID_SLIDER, }; // -------------------------------------------------------------------------- @@ -98,14 +107,11 @@ enum // Event tables BEGIN_EVENT_TABLE(LifeFrame, wxFrame) + EVT_MENU (ID_NEW, LifeFrame::OnMenu) + EVT_MENU (ID_OPEN, LifeFrame::OnOpen) EVT_MENU (ID_SAMPLES, LifeFrame::OnSamples) - EVT_MENU (ID_RESET, LifeFrame::OnMenu) EVT_MENU (ID_ABOUT, LifeFrame::OnMenu) EVT_MENU (ID_EXIT, LifeFrame::OnMenu) - EVT_MENU (ID_START, LifeFrame::OnMenu) - EVT_MENU (ID_STEP, LifeFrame::OnMenu) - EVT_MENU (ID_STOP, LifeFrame::OnMenu) - EVT_MENU (ID_TOPSPEED, LifeFrame::OnMenu) EVT_MENU (ID_SHOWNAV, LifeFrame::OnMenu) EVT_MENU (ID_ORIGIN, LifeFrame::OnNavigate) EVT_BUTTON (ID_CENTER, LifeFrame::OnNavigate) @@ -115,6 +121,11 @@ BEGIN_EVENT_TABLE(LifeFrame, wxFrame) EVT_BUTTON (ID_WEST, LifeFrame::OnNavigate) EVT_MENU (ID_ZOOMIN, LifeFrame::OnZoom) EVT_MENU (ID_ZOOMOUT, LifeFrame::OnZoom) + EVT_MENU (ID_INFO, LifeFrame::OnMenu) + EVT_MENU (ID_START, LifeFrame::OnMenu) + EVT_MENU (ID_STEP, LifeFrame::OnMenu) + EVT_MENU (ID_STOP, LifeFrame::OnMenu) + EVT_MENU (ID_TOPSPEED, LifeFrame::OnMenu) EVT_COMMAND_SCROLL (ID_SLIDER, LifeFrame::OnSlider) EVT_TIMER (ID_TIMER, LifeFrame::OnTimer) EVT_CLOSE ( LifeFrame::OnClose) @@ -128,7 +139,10 @@ BEGIN_EVENT_TABLE(LifeCanvas, wxWindow) EVT_PAINT ( LifeCanvas::OnPaint) EVT_SCROLLWIN ( LifeCanvas::OnScroll) EVT_SIZE ( LifeCanvas::OnSize) - EVT_MOUSE_EVENTS ( LifeCanvas::OnMouse) + EVT_MOTION ( LifeCanvas::OnMouse) + EVT_LEFT_DOWN ( LifeCanvas::OnMouse) + EVT_LEFT_UP ( LifeCanvas::OnMouse) + EVT_LEFT_DCLICK ( LifeCanvas::OnMouse) EVT_ERASE_BACKGROUND( LifeCanvas::OnEraseBackground) END_EVENT_TABLE() @@ -142,7 +156,7 @@ IMPLEMENT_APP(LifeApp) // ========================================================================== // some shortcuts -#define ADD_TOOL(id, bmp, tooltip, help) \ +#define ADD_TOOL(id, bmp, tooltip, help) \ toolBar->AddTool(id, bmp, wxNullBitmap, FALSE, -1, -1, (wxObject *)0, tooltip, help) @@ -184,32 +198,34 @@ LifeFrame::LifeFrame() : wxFrame((wxFrame *)0, -1, _("Life!"), wxPoint(200, 200) wxMenu *menuView = new wxMenu("", wxMENU_TEAROFF); wxMenu *menuGame = new wxMenu("", wxMENU_TEAROFF); - menuFile->Append(ID_RESET, _("Reset"), _("Start a new game")); - menuFile->Append(ID_SAMPLES, _("Sample game..."), _("Select a sample configuration")); + menuFile->Append(ID_NEW, _("&New"), _("Start a new game")); + menuFile->Append(ID_OPEN, _("&Open..."), _("Open an existing Life pattern")); + menuFile->Append(ID_SAMPLES, _("&Sample game..."), _("Select a sample configuration")); menuFile->AppendSeparator(); menuFile->Append(ID_ABOUT, _("&About...\tCtrl-A"), _("Show about dialog")); menuFile->AppendSeparator(); menuFile->Append(ID_EXIT, _("E&xit\tAlt-X"), _("Quit this program")); - menuView->Append(ID_SHOWNAV, _("Navigation toolbox"), _("Show or hide toolbox"), TRUE); + menuView->Append(ID_SHOWNAV, _("Navigation &toolbox"), _("Show or hide toolbox"), TRUE); menuView->Check (ID_SHOWNAV, TRUE); menuView->AppendSeparator(); - menuView->Append(ID_ORIGIN, _("Absolute origin"), _("Go to (0, 0)")); - menuView->Append(ID_CENTER, _("Center of mass"), _("Find center of mass")); - menuView->Append(ID_NORTH, _("North"), _("Find northernmost cell")); - menuView->Append(ID_SOUTH, _("South"), _("Find southernmost cell")); - menuView->Append(ID_EAST, _("East"), _("Find easternmost cell")); - menuView->Append(ID_WEST, _("West"), _("Find westernmost cell")); + menuView->Append(ID_ORIGIN, _("&Absolute origin"), _("Go to (0, 0)")); + menuView->Append(ID_CENTER, _("&Center of mass"), _("Find center of mass")); + menuView->Append(ID_NORTH, _("&North"), _("Find northernmost cell")); + menuView->Append(ID_SOUTH, _("&South"), _("Find southernmost cell")); + menuView->Append(ID_EAST, _("&East"), _("Find easternmost cell")); + menuView->Append(ID_WEST, _("&West"), _("Find westernmost cell")); menuView->AppendSeparator(); - menuView->Append(ID_ZOOMIN, _("Zoom &in\tCtrl-I")); - menuView->Append(ID_ZOOMOUT, _("Zoom &out\tCtrl-O")); + menuView->Append(ID_ZOOMIN, _("Zoom &in\tCtrl-I"), _("Zoom in")); + menuView->Append(ID_ZOOMOUT, _("Zoom &out\tCtrl-O"), _("Zoom out")); + menuView->Append(ID_INFO, _("&Description...\tCtrl-D"), _("View pattern description")); menuGame->Append(ID_START, _("&Start\tCtrl-S"), _("Start")); menuGame->Append(ID_STEP, _("&Next\tCtrl-N"), _("Single step")); menuGame->Append(ID_STOP, _("S&top\tCtrl-T"), _("Stop")); menuGame->Enable(ID_STOP, FALSE); menuGame->AppendSeparator(); - menuGame->Append(ID_TOPSPEED, _("Top speed!"), _("Go as fast as possible")); + menuGame->Append(ID_TOPSPEED, _("T&op speed!"), _("Go as fast as possible")); wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(menuFile, _("&File")); @@ -218,23 +234,30 @@ LifeFrame::LifeFrame() : wxFrame((wxFrame *)0, -1, _("Life!"), wxPoint(200, 200) SetMenuBar(menuBar); // tool bar - wxBitmap tbBitmaps[5]; + wxBitmap tbBitmaps[7]; tbBitmaps[0] = wxBITMAP(reset); - tbBitmaps[1] = wxBITMAP(play); - tbBitmaps[2] = wxBITMAP(stop); - tbBitmaps[3] = wxBITMAP(zoomin); - tbBitmaps[4] = wxBITMAP(zoomout); + tbBitmaps[1] = wxBITMAP(open); + tbBitmaps[2] = wxBITMAP(zoomin); + tbBitmaps[3] = wxBITMAP(zoomout); + tbBitmaps[4] = wxBITMAP(info); + tbBitmaps[5] = wxBITMAP(play); + tbBitmaps[6] = wxBITMAP(stop); wxToolBar *toolBar = CreateToolBar(); toolBar->SetMargins(5, 5); toolBar->SetToolBitmapSize(wxSize(16, 16)); - ADD_TOOL(ID_RESET, tbBitmaps[0], _("Reset"), _("Start a new game")); - ADD_TOOL(ID_START, tbBitmaps[1], _("Start"), _("Start")); - ADD_TOOL(ID_STOP, tbBitmaps[2], _("Stop"), _("Stop")); + + ADD_TOOL(ID_NEW, tbBitmaps[0], _("New"), _("Start a new game")); + ADD_TOOL(ID_OPEN, tbBitmaps[1], _("Open"), _("Open an existing Life pattern")); + toolBar->AddSeparator(); + ADD_TOOL(ID_ZOOMIN, tbBitmaps[2], _("Zoom in"), _("Zoom in")); + ADD_TOOL(ID_ZOOMOUT, tbBitmaps[3], _("Zoom out"), _("Zoom out")); + ADD_TOOL(ID_INFO, tbBitmaps[4], _("Description"), _("Show description")); toolBar->AddSeparator(); - ADD_TOOL(ID_ZOOMIN, tbBitmaps[3], _("Zoom in"), _("Zoom in")); - ADD_TOOL(ID_ZOOMOUT, tbBitmaps[4], _("Zoom out"), _("Zoom out")); + ADD_TOOL(ID_START, tbBitmaps[5], _("Start"), _("Start")); + ADD_TOOL(ID_STOP, tbBitmaps[6], _("Stop"), _("Stop")); + toolBar->Realize(); toolBar->EnableTool(ID_STOP, FALSE); // must be after Realize() ! @@ -344,20 +367,56 @@ void LifeFrame::UpdateUI() GetMenuBar()->GetMenu(1)->Enable(ID_ZOOMOUT, cellsize > 1); } -// event handlers +// Event handlers ----------------------------------------------------------- + +// OnMenu handles all events which don't have their own event handler void LifeFrame::OnMenu(wxCommandEvent& event) { switch (event.GetId()) { - case ID_START : OnStart(); break; - case ID_STEP : OnStep(); break; - case ID_STOP : OnStop(); break; + case ID_NEW: + { + // stop if it was running + OnStop(); + m_life->Clear(); + m_canvas->Recenter(0, 0); + m_tics = 0; + UpdateInfoText(); + break; + } + case ID_ABOUT: + { + LifeAboutDialog dialog(this); + dialog.ShowModal(); + break; + } + case ID_EXIT: + { + // TRUE is to force the frame to close + Close(TRUE); + break; + } case ID_SHOWNAV : { bool checked = GetMenuBar()->GetMenu(1)->IsChecked(ID_SHOWNAV); m_navigator->Show(checked); break; } + case ID_INFO: + { + wxString desc = m_life->GetDescription(); + + if ( desc.IsEmpty() ) + desc = _("Not available"); + + // should we make the description editable here? + wxMessageBox(desc, _("Description"), wxOK | wxICON_INFORMATION); + + break; + } + case ID_START : OnStart(); break; + case ID_STEP : OnStep(); break; + case ID_STOP : OnStop(); break; case ID_TOPSPEED: { m_running = TRUE; @@ -370,41 +429,39 @@ void LifeFrame::OnMenu(wxCommandEvent& event) } break; } - case ID_RESET: + } +} + +void LifeFrame::OnOpen(wxCommandEvent& WXUNUSED(event)) +{ + wxFileDialog filedlg(this, + _("Choose a file to open"), + _(""), + _(""), + _("Life patterns (*.lif)|*.lif|All files (*.*)|*.*"), + wxOPEN | wxFILE_MUST_EXIST); + + if (filedlg.ShowModal() == wxID_OK) + { + wxFileInputStream stream(filedlg.GetFilename()); + LifeReader reader(stream); + + // the reader handles errors itself, no need to do anything here + if (reader.IsOk()) { - // stop if it was running + // stop if running and put the pattern OnStop(); m_life->Clear(); + m_life->SetPattern(reader.GetPattern()); + + // recenter canvas m_canvas->Recenter(0, 0); m_tics = 0; UpdateInfoText(); - break; - } - case ID_ABOUT: - { - LifeAboutDialog dialog(this); - dialog.ShowModal(); - break; - } - case ID_EXIT : - { - // TRUE is to force the frame to close - Close(TRUE); - break; } } } -void LifeFrame::OnClose(wxCloseEvent& WXUNUSED(event)) -{ - // Stop if it was running; this is absolutely needed because - // the frame won't be actually destroyed until there are no - // more pending events, and this in turn won't ever happen - // if the timer is running faster than the window can redraw. - OnStop(); - Destroy(); -} - void LifeFrame::OnSamples(wxCommandEvent& WXUNUSED(event)) { // stop if it was running @@ -415,11 +472,11 @@ void LifeFrame::OnSamples(wxCommandEvent& WXUNUSED(event)) if (dialog.ShowModal() == wxID_OK) { - const LifeShape shape = dialog.GetShape(); + const LifePattern pattern = dialog.GetPattern(); - // put the shape + // put the pattern m_life->Clear(); - m_life->SetShape(shape); + m_life->SetPattern(pattern); // recenter canvas m_canvas->Recenter(0, 0); @@ -450,7 +507,7 @@ void LifeFrame::OnNavigate(wxCommandEvent& event) switch (event.GetId()) { - case ID_NORTH: c = m_life->FindNorth(); break; + case ID_NORTH: c = m_life->FindNorth(); break; case ID_SOUTH: c = m_life->FindSouth(); break; case ID_WEST: c = m_life->FindWest(); break; case ID_EAST: c = m_life->FindEast(); break; @@ -479,6 +536,16 @@ void LifeFrame::OnTimer(wxTimerEvent& WXUNUSED(event)) OnStep(); } +void LifeFrame::OnClose(wxCloseEvent& WXUNUSED(event)) +{ + // Stop if it was running; this is absolutely needed because + // the frame won't be actually destroyed until there are no + // more pending events, and this in turn won't ever happen + // if the timer is running faster than the window can redraw. + OnStop(); + Destroy(); +} + void LifeFrame::OnStart() { if (!m_running) @@ -820,17 +887,24 @@ void LifeCanvas::OnMouse(wxMouseEvent& event) msg.Printf(_("Cell: (%d, %d)"), i, j); ((LifeFrame *) wxGetApp().GetTopWindow())->SetStatusText(msg, 1); - // button pressed? + // NOTE that wxMouseEvent::LeftDown() and wxMouseEvent::LeftIsDown() + // have different semantics. The first one is used to signal that the + // button was just pressed (i.e., in "button down" events); the second + // one just describes the current status of the button, independently + // of the mouse event type. LeftIsDown is typically used in "mouse + // move" events, to test if the button is _still_ pressed. + + // is the button down? if (!event.LeftIsDown()) { m_status = MOUSE_NOACTION; return; } - // button just pressed? - if (m_status == MOUSE_NOACTION) + // was it pressed just now? + if (event.LeftDown()) { - // yes, update status and toggle this cell + // yes: start a new action and toggle this cell m_status = (m_life->IsAlive(i, j)? MOUSE_ERASING : MOUSE_DRAWING); m_mi = i; @@ -840,6 +914,7 @@ void LifeCanvas::OnMouse(wxMouseEvent& event) } else if ((m_mi != i) || (m_mj != j)) { + // no: continue ongoing action bool alive = (m_status == MOUSE_DRAWING); // prepare DC and pen + brush to optimize drawing diff --git a/demos/life/life.h b/demos/life/life.h index 0fa61a695c..75cd4d23a1 100644 --- a/demos/life/life.h +++ b/demos/life/life.h @@ -137,8 +137,9 @@ private: DECLARE_EVENT_TABLE() // event handlers - void OnSamples(wxCommandEvent& event); void OnMenu(wxCommandEvent& event); + void OnOpen(wxCommandEvent& event); + void OnSamples(wxCommandEvent& event); void OnNavigate(wxCommandEvent& event); void OnZoom(wxCommandEvent& event); void OnSlider(wxScrollEvent& event); diff --git a/demos/life/life.rc b/demos/life/life.rc index ae701642ed..269df77d17 100644 --- a/demos/life/life.rc +++ b/demos/life/life.rc @@ -2,13 +2,16 @@ mondrian ICON "mondrian.ico" #include "wx/msw/wx.rc" reset BITMAP "bitmaps/reset.bmp" +open BITMAP "bitmaps/open.bmp" play BITMAP "bitmaps/play.bmp" stop BITMAP "bitmaps/stop.bmp" zoomin BITMAP "bitmaps/zoomin.bmp" zoomout BITMAP "bitmaps/zoomout.bmp" +info BITMAP "bitmaps/info.bmp" north BITMAP "bitmaps/north.bmp" east BITMAP "bitmaps/east.bmp" south BITMAP "bitmaps/south.bmp" west BITMAP "bitmaps/west.bmp" center BITMAP "bitmaps/center.bmp" life BITMAP "bitmaps/life.bmp" + diff --git a/demos/life/makefile.b32 b/demos/life/makefile.b32 index 051d35b22f..a56b222798 100644 --- a/demos/life/makefile.b32 +++ b/demos/life/makefile.b32 @@ -10,7 +10,7 @@ WXDIR = $(WXWIN) TARGET=life -OBJECTS = $(TARGET).obj dialogs.obj game.obj +OBJECTS = $(TARGET).obj dialogs.obj game.obj reader.obj !include $(WXDIR)\src\makeprog.b32 diff --git a/demos/life/makefile.bcc b/demos/life/makefile.bcc index e7ac35af26..52b5acfd36 100644 --- a/demos/life/makefile.bcc +++ b/demos/life/makefile.bcc @@ -13,7 +13,7 @@ WXDIR = $(WXWIN) TARGET=life -OBJECTS=$(TARGET).obj dialogs.obj game.obj +OBJECTS=$(TARGET).obj dialogs.obj game.obj reader.obj !include $(WXDIR)\src\makeprog.bcc diff --git a/demos/life/makefile.dos b/demos/life/makefile.dos index c042c700cf..50e2bb53d4 100644 --- a/demos/life/makefile.dos +++ b/demos/life/makefile.dos @@ -11,7 +11,7 @@ WXDIR = $(WXWIN) TARGET=life -OBJECTS = $(TARGET).obj dialogs.obj game.obj +OBJECTS = $(TARGET).obj dialogs.obj game.obj reader.obj !include $(WXDIR)\src\makeprog.msc diff --git a/demos/life/makefile.g95 b/demos/life/makefile.g95 index 16127c981a..8f988b4a89 100644 --- a/demos/life/makefile.g95 +++ b/demos/life/makefile.g95 @@ -10,7 +10,8 @@ WXDIR = ../.. TARGET=life -OBJECTS = $(TARGET).o dialogs.o game.o +EXTRALDFLAGS=-Wl,--subsystem,console +OBJECTS = $(TARGET).o dialogs.o game.o reader.o include $(WXDIR)/src/makeprog.g95 diff --git a/demos/life/makefile.unx b/demos/life/makefile.unx index 8b8c3669d4..4fe657b60e 100644 --- a/demos/life/makefile.unx +++ b/demos/life/makefile.unx @@ -17,7 +17,7 @@ CC = gcc PROGRAM = life -OBJECTS = $(PROGRAM).o dialogs.o game.o +OBJECTS = $(PROGRAM).o dialogs.o game.o reader.o # implementation diff --git a/demos/life/makefile.vc b/demos/life/makefile.vc index 1f8314a8dd..c73905457d 100644 --- a/demos/life/makefile.vc +++ b/demos/life/makefile.vc @@ -12,7 +12,7 @@ WXDIR = $(WXWIN) PROGRAM=life -OBJECTS = $(PROGRAM).obj dialogs.obj game.obj +OBJECTS = $(PROGRAM).obj dialogs.obj game.obj reader.obj !include $(WXDIR)\src\makeprog.vc diff --git a/demos/life/makefile.wat b/demos/life/makefile.wat index 4ee7d9205c..4fd507ae4b 100644 --- a/demos/life/makefile.wat +++ b/demos/life/makefile.wat @@ -8,7 +8,7 @@ WXDIR = $(%WXWIN) PROGRAM = life -OBJECTS = $(PROGRAM).obj dialogs.obj game.obj +OBJECTS = $(PROGRAM).obj dialogs.obj game.obj reader.obj !include $(WXDIR)\src\makeprog.wat diff --git a/demos/life/reader.cpp b/demos/life/reader.cpp new file mode 100644 index 0000000000..8bb48ed375 --- /dev/null +++ b/demos/life/reader.cpp @@ -0,0 +1,91 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: reader.cpp +// Purpose: Life! pattern reader (writer coming soon) +// Author: Guillermo Rodriguez Garcia, <guille@iies.es> +// Modified by: +// Created: Jan/2000 +// RCS-ID: $Id$ +// Copyright: (c) 2000, Guillermo Rodriguez Garcia +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ========================================================================== +// headers, declarations, constants +// ========================================================================== + +#ifdef __GNUG__ + #pragma implementation "reader.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "wx/txtstrm.h" +#include "reader.h" + + +// ========================================================================== +// LifeReader +// ========================================================================== + +#define LIFE_CHECKVAL( msg ) \ + if (!m_ok) \ + { \ + wxMessageBox( msg, _("Error"), wxICON_EXCLAMATION | wxOK ); \ + return; \ + } + +LifeReader::LifeReader(wxInputStream& is) +{ + wxBufferedInputStream buff_is = wxBufferedInputStream(is); + wxTextInputStream text_is = wxTextInputStream(buff_is); + wxString line, rest; + + // check stream + m_ok = is.IsOk(); + LIFE_CHECKVAL(_("Couldn't read any data")); + + // read signature + m_ok = text_is.ReadLine().Contains(wxT("#Life 1.05")); + LIFE_CHECKVAL(_("Error reading signature. Not a Life pattern?")); + + // read description + m_description = wxT(""); + line = text_is.ReadLine(); + while (buff_is.IsOk() && line.StartsWith(wxT("#D"), &rest)) + { + m_description += rest.Trim(FALSE); + m_description += wxT("\n"); + line = text_is.ReadLine(); + } + + m_ok = buff_is.IsOk(); + LIFE_CHECKVAL(_("Unexpected EOF while reading description")); + + // read rules + m_ok = line.StartsWith(wxT("#N")); + LIFE_CHECKVAL(_("Sorry, non-conway rules not supported yet")); + + // read shape + while (buff_is.IsOk()) + { + line = ( text_is.ReadLine() ).Trim(); + + if (!line.IsEmpty()) + { + if (line.StartsWith(wxT("#P "), &rest)) + m_shape.Add(rest); + else + m_shape.Add(line); + } + } +} + diff --git a/demos/life/reader.h b/demos/life/reader.h new file mode 100644 index 0000000000..27a10af30e --- /dev/null +++ b/demos/life/reader.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: reader.h +// Purpose: Life! pattern reader (writer coming soon) +// Author: Guillermo Rodriguez Garcia, <guille@iies.es> +// Modified by: +// Created: Jan/2000 +// RCS-ID: $Id$ +// Copyright: (c) 2000, Guillermo Rodriguez Garcia +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _LIFE_READER_H_ +#define _LIFE_READER_H_ + +#ifdef __GNUG__ + #pragma interface "reader.h" +#endif + +// for compilers that support precompilation, includes "wx/wx.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// for all others, include the necessary headers +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "game.h" + +// -------------------------------------------------------------------------- +// LifeReader +// -------------------------------------------------------------------------- + +class LifeReader +{ +public: + LifeReader(wxInputStream& is); + + inline bool IsOk() const { return m_ok; }; + inline wxString GetDescription() const { return m_description; }; + inline wxString GetRules() const { return m_rules; }; + inline wxArrayString GetShape() const { return m_shape; }; + inline LifePattern GetPattern() const + { + return LifePattern(_(""), m_description, m_rules, m_shape); + }; + +private: + bool m_ok; + wxString m_description; + wxString m_rules; + wxArrayString m_shape; +}; + +#endif // _LIFE_READER_H_ diff --git a/demos/life/samples.inc b/demos/life/samples.inc index b8e7f59761..63b6d820c2 100644 --- a/demos/life/samples.inc +++ b/demos/life/samples.inc @@ -23,9 +23,10 @@ * */ -const LifeShape g_shapes[] = +const LifePattern g_patterns[] = { - LifeShape( _("Glider"), + LifePattern( + _("Glider"), _("The glider is the first of a series of life forms, known " "as spaceships or fishes, which can travel along the game " "field retaining their original shape."), @@ -33,7 +34,8 @@ const LifeShape g_shapes[] = ".*." "..*" "***"), - LifeShape( _("Heavyweight spaceship"), + LifePattern( + _("Heavyweight spaceship"), _("The glider is just the smaller of the spaceships; this " "one, known as the heavyweight spaceship or 'big fish', " "is the largest spaceship which can travel alone without " @@ -44,7 +46,8 @@ const LifeShape g_shapes[] = "......*" "*.....*" ".******"), - LifeShape( _("Eater"), + LifePattern( + _("Eater"), _("An eater is any still life that can repair itself from " "some attacks. This one (bottom right), also known as " "'fishhook', eats gliders and fishes (spaceships) provided " @@ -60,7 +63,8 @@ const LifeShape g_shapes[] = "......*.*." "........*." "........**" ), - LifeShape( _("Dice shaker"), + LifePattern( + _("Dice shaker"), _("Oscillators have been extensively explored in Life!. " "The dice shaker turns around each seven tics; thus, it " "is an oscillator with a period of fourteen."), @@ -71,7 +75,8 @@ const LifeShape g_shapes[] = "*.*.*.*" "*.*.*.*" "**...**" ), - LifeShape( _("Hertz oscillator"), + LifePattern( + _("Hertz oscillator"), _("The Hertz oscillator is a good example of a set of life " "patterns known as 'billiard tables'. A billiard table is " "an oscillator which is built inside a stable border. In " @@ -88,7 +93,8 @@ const LifeShape g_shapes[] = ".............." ".......**....." ".......**....." ), - LifeShape( _("Phoenix"), + LifePattern( + _("Phoenix"), _("A phoenix is a pattern whose cells all die in every " "generation, and yet lives forever. For example, this is " "a phoenix with period two."), @@ -101,7 +107,8 @@ const LifeShape g_shapes[] = ".*......" "...*.*.." "...*...." ), - LifeShape( _("R-pentomino"), + LifePattern( + _("R-pentomino"), _("The R-pentomino is a methuselah - a life form which " "lives for hundreds of generations without stabilizing " "or dying. In particular, the R-Pentomino requires more " @@ -111,7 +118,8 @@ const LifeShape g_shapes[] = ".**" "**." ".*." ), - LifeShape( _("Thunderbird"), + LifePattern( + _("Thunderbird"), _("The thunderbird is another popular methuselah, which " "doesn't stabilize until the 243th generation. Note that " "because the initial configuration is symmetrical with " @@ -123,14 +131,16 @@ const LifeShape g_shapes[] = ".*." ".*." ".*." ), - LifeShape( _("Accorn"), + LifePattern( + _("Accorn"), _("Probably the most popular methuselah, the accorn lives " "for 5206 (!) generations."), 7, 3, ".*....." "...*..." "**..***" ), - LifeShape( _("Galaxy"), + LifePattern( + _("Galaxy"), _("One from my personal collection. It is really beautiful " "to see this configuration expand and shrink periodically " "for hundreds of tics before reaching a stable state."), @@ -148,7 +158,8 @@ const LifeShape g_shapes[] = "......*......" "......*......" ".......***..." ), - LifeShape( _("Glider gun"), + LifePattern( + _("Glider gun"), _("A gun is a stationary pattern that emits spaceships " "forever. The glider gun shown here was the first known " "gun, and indeed the first known finite pattern with " @@ -164,7 +175,8 @@ const LifeShape g_shapes[] = "**.........*...**........*.........." "............*.*....................." ".............*......................" ), - LifeShape( _("Puffer train"), + LifePattern( + _("Puffer train"), _("A puffer is an object that moves like a spaceship, except " "that it leaves a trail of debris behind. The puffer train " "is one of the best-known puffers. Originally found by " @@ -191,7 +203,8 @@ const LifeShape g_shapes[] = "....*" "*...*" ".****" ), - LifeShape( _("Max"), + LifePattern( + _("Max"), _("Max is the fastest-growing known pattern in Conway's Game " "of Life (possibly the fastest possible). It fills space to " "a density of 1/2, conjectured to be the maximum density, " diff --git a/difflast.pl b/difflast.pl index 33aecea66a..d1473e627a 100755 --- a/difflast.pl +++ b/difflast.pl @@ -14,16 +14,17 @@ use strict; my $CVS = "cvs -z3"; # the cvs command +# the regexp for cvs revision number +my $RE_CVS_REV = "\\d+(?:\\.\\d+)+"; + sub dec_rev($) { my $rev = $_[0]; # decrement the revision number to get the previos one - # (FIXME this is totally bogus, won't work with branches) - my $revlen = length($rev) - rindex($rev, '.') - 1; - my $m = 10**$revlen; + $rev =~ s/(\d+)$/$1 - 1/e; - return int($rev) . "." . ($rev*$m - int($rev)*$m - 1) + return $rev; } sub get_last_rev($) @@ -39,7 +40,7 @@ sub get_last_rev($) while (<INPUT>) { # notice that we shouldn't have '$' followed by 'Id' or cvs will # substitute it! - if ( /\$(Id): $basename,v (\d+\.\d+)/ ) { + if ( /\$(Id): $basename,v ($RE_CVS_REV)/ ) { return &dec_rev($2); } } @@ -48,7 +49,7 @@ sub get_last_rev($) open(INPUT, "$CVS -q status $file |") or return 0; while (<INPUT>) { - if ( /Working revision:\s+(\d+\.\d+)/ ) { + if ( /Working revision:\s+($RE_CVS_REV)/ ) { return &dec_rev($1); } } diff --git a/distrib/msw/extradoc.rsp b/distrib/msw/extradoc.rsp new file mode 100644 index 0000000000..08d9c68619 --- /dev/null +++ b/distrib/msw/extradoc.rsp @@ -0,0 +1,3 @@ +docs/pdf/odbc.pdf +docs/html/gettext/*.html + diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index 69f8de0516..1c0ee6d7ca 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -25,6 +25,7 @@ distrib/msw/*.bat distrib/msw/*.cpp distrib/msw/*.txt distrib/msw/tardist +distrib/msw/tarwxmotif distrib/msw/tmake/*.t distrib/msw/tmake/Makefile distrib/msw/tmake/filelist.txt @@ -38,6 +39,7 @@ locale/*.po locale/*.mo docs/readme.txt +docs/readme_vms.txt docs/install.txt docs/release.txt docs/changes.txt @@ -58,6 +60,7 @@ docs/html/icons/*.gif docs/html/icons/*.png docs/html/icons/*.jpg docs/tech/*.txt +docs/tech/*.htm src/makeenvs/*.env src/make.env @@ -236,6 +239,8 @@ samples/sockets/client.b32 samples/sockets/server.b32 samples/sockets/client.bcc samples/sockets/server.bcc +samples/sockets/client.g95 +samples/sockets/server.g95 samples/sockets/*.xbm samples/sockets/*.xpm samples/sockets/*.ico @@ -255,6 +260,10 @@ samples/help/*.hlp samples/help/*.cnt samples/help/*.zip samples/help/*.htb +samples/help/*.chm +samples/help/*.hhp +samples/help/*.hhk +samples/help/*.hhc samples/help/*.hpj samples/help/*.tex samples/help/*.ini @@ -642,6 +651,7 @@ samples/image/*.pnm samples/image/*.pcx samples/image/*.jpg samples/image/*.gif +samples/image/*.tif samples/image/*.ico samples/image/*.txt @@ -670,6 +680,8 @@ samples/ipc/client.bcc samples/ipc/server.bcc samples/ipc/client.dos samples/ipc/server.dos +samples/ipc/client.g95 +samples/ipc/server.g95 samples/ipc/*.rc samples/ipc/*.def samples/ipc/*.bmp @@ -1063,6 +1075,7 @@ demos/life/*.def demos/life/*.ico demos/life/*.xpm demos/life/*.txt +demos/life/*.lif demos/life/bitmaps/*.xpm demos/life/bitmaps/*.bmp diff --git a/distrib/msw/jpeg.rsp b/distrib/msw/jpeg.rsp index 7095a60175..c3f84fcbc5 100644 --- a/distrib/msw/jpeg.rsp +++ b/distrib/msw/jpeg.rsp @@ -1,6 +1,6 @@ src/jpeg/make* -src/jpeg/jpeg.dsp -src/jpeg/jpeg.dsw +src/jpeg/JpegVC.dsp +src/jpeg/JpegVC.dsw src/jpeg/*.c src/jpeg/*.h src/jpeg/README diff --git a/distrib/msw/makefile.rsp b/distrib/msw/makefile.rsp index a25712dcd6..9013dba06a 100644 --- a/distrib/msw/makefile.rsp +++ b/distrib/msw/makefile.rsp @@ -17,9 +17,19 @@ samples/drawing/Makefile.in samples/dynamic/Makefile.in samples/exec/Makefile.in samples/genvalid/Makefile.in +samples/grid/Makefile.in +samples/newgrid/Makefile.in +samples/help/Makefile.in +samples/internat/Makefile.in +samples/ipc/Makefile.in +samples/png/Makefile.in +samples/richedit/Makefile.in +samples/resource/Makefile.in +samples/sockets/Makefile.in samples/html/Makefile.in samples/html/about/Makefile.in samples/html/help/Makefile.in +samples/html/helpview/Makefile.in samples/html/printing/Makefile.in samples/html/test/Makefile.in samples/html/virtual/Makefile.in @@ -59,11 +69,13 @@ samples/opengl/Makefile.in samples/opengl/cube/Makefile.in samples/opengl/penguin/Makefile.in samples/opengl/isosurf/Makefile.in +demos/Makefile.in demos/bombs/Makefile.in demos/forty/Makefile.in demos/fractal/Makefile.in demos/poem/Makefile.in demos/life/Makefile.in +demos/dbbrowse/Makefile.in utils/dialoged/Makefile.in utils/dialoged/src/Makefile.in utils/Makefile.in @@ -81,26 +93,23 @@ contrib/samples/mmedia/Makefile.in contrib/samples/stc/Makefile.in descrip.mms -lib\vms.opt -lib\vms_gtk.opt -contrib\samples\mmedia\descrip.mms -deliver\wx\src\common\descrip.mms -deliver\wx\src\png\scripts\descrip.mms -deliver\wx\src\zlib\descrip.mms -demos\bombs\descrip.mms -samples\caret\descrip.mms -samples\checklst\descrip.mms -samples\config\descrip.mms -samples\controls\descrip.mms -samples\dialogs\descrip.mms -samples\image\descrip.mms -samples\menu\descrip.mms -samples\minimal\descrip.mms -src\common\descrip.mms -src\generic\descrip.mms -src\gtk\descrip.mms -src\motif\descrip.mms -src\png\scripts\descrip.mms -src\unix\descrip.mms -src\zlib\descrip.mms -utils\dialoged\src\descrip.mms +lib/vms.opt +lib/vms_gtk.opt +contrib/samples/mmedia/descrip.mms +demos/bombs/descrip.mms +samples/caret/descrip.mms +samples/checklst/descrip.mms +samples/config/descrip.mms +samples/controls/descrip.mms +samples/dialogs/descrip.mms +samples/image/descrip.mms +samples/menu/descrip.mms +samples/minimal/descrip.mms +src/common/descrip.mms +src/generic/descrip.mms +src/gtk/descrip.mms +src/motif/descrip.mms +src/png/scripts/descrip.mms +src/unix/descrip.mms +src/zlib/descrip.mms +utils/dialoged/src/descrip.mms diff --git a/distrib/msw/msw.rsp b/distrib/msw/msw.rsp index c03417682f..952d1e6847 100644 --- a/distrib/msw/msw.rsp +++ b/distrib/msw/msw.rsp @@ -15,9 +15,8 @@ docs/wine/COPYING.LIB distrib/msw/*.rsp distrib/msw/*.bat -tools/gettext/xgettext.exe -tools/gettext/msgfmt.exe -tools/gettext/msgunfmt.exe +tools/gettext/*.exe +tools/gettext/*.sed src/makeb32.env src/makeprog.b32 diff --git a/distrib/msw/ogl.rsp b/distrib/msw/ogl.rsp index 626702ed4f..730a69dede 100644 --- a/distrib/msw/ogl.rsp +++ b/distrib/msw/ogl.rsp @@ -23,7 +23,15 @@ contrib/src/ogl/*.rc contrib/src/ogl/*.def contrib/src/ogl/*.xbm contrib/src/ogl/*.xpm -contrib/src/ogl/make*.* +contrib/src/ogl/makefile.vc +contrib/src/ogl/makefile.bcc +contrib/src/ogl/makefile.b32 +contrib/src/ogl/makefile.wat +contrib/src/ogl/makefile.g95 +contrib/src/ogl/makefile.unx +contrib/src/ogl/makefile.dos +contrib/src/ogl/makefile.vms +contrib/src/ogl/Makefile.in contrib/src/ogl/*.txt contrib/src/ogl/*.ico contrib/src/ogl/*.bmp @@ -35,8 +43,15 @@ contrib/samples/ogl/ogledit/*.h contrib/samples/ogl/ogledit/*.rc contrib/samples/ogl/ogledit/*.def contrib/samples/ogl/ogledit/*.xbm -contrib/samples/ogl/ogledit/make*.* -contrib/samples/ogl/ogledit/Makefile +contrib/samples/ogl/ogledit/makefile.vc +contrib/samples/ogl/ogledit/makefile.bcc +contrib/samples/ogl/ogledit/makefile.b32 +contrib/samples/ogl/ogledit/makefile.wat +contrib/samples/ogl/ogledit/makefile.g95 +contrib/samples/ogl/ogledit/makefile.unx +contrib/samples/ogl/ogledit/makefile.dos +contrib/samples/ogl/ogledit/makefile.vms +contrib/samples/ogl/ogledit/Makefile.in contrib/samples/ogl/ogledit/*.txt contrib/samples/ogl/ogledit/*.ico contrib/samples/ogl/ogledit/*.bmp @@ -53,8 +68,15 @@ contrib/samples/ogl/studio/*.h contrib/samples/ogl/studio/*.rc contrib/samples/ogl/studio/*.def contrib/samples/ogl/studio/*.xbm -contrib/samples/ogl/studio/make*.* -contrib/samples/ogl/studio/Makefile +contrib/samples/ogl/studio/makefile.vc +contrib/samples/ogl/studio/makefile.bcc +contrib/samples/ogl/studio/makefile.b32 +contrib/samples/ogl/studio/makefile.wat +contrib/samples/ogl/studio/makefile.g95 +contrib/samples/ogl/studio/makefile.unx +contrib/samples/ogl/studio/makefile.dos +contrib/samples/ogl/studio/makefile.vms +contrib/samples/ogl/studio/Makefile.in contrib/samples/ogl/studio/*.txt contrib/samples/ogl/studio/*.ico contrib/samples/ogl/studio/*.bmp diff --git a/distrib/msw/patch.rsp b/distrib/msw/patch.rsp index bc2643ce0b..58c7ffe9b4 100644 --- a/distrib/msw/patch.rsp +++ b/distrib/msw/patch.rsp @@ -1,4 +1,31 @@ include/wx/datetime.inl +include/wx/sckipc.h +include/wx/ipcbase.h +include/wx/gtk/pen.h +include/wx/defs.h +include/wx/version.h +include/wx/generic/grid.h src/msw/treectrl.cpp +src/common/sckipc.cpp +src/common/intl.cpp +src/gtk/frame.cpp +src/gtk/mdi.cpp +src/motif/dialog.cpp +src/generic/scrolwin.cpp +src/generic/listctrl.cpp +src/generic/grid.cpp +src/gtk/settings.cpp samples/treectrl/TreectrlVC.dsp +samples/treectrl/treectrl.cpp +samples/sockets/client.g95 +samples/sockets/server.g95 +samples/ipc/client.g95 +samples/ipc/server.g95 +samples/wizard/WizardVC.dsp + +src/xpm/makefile.b32 +configure +configure.in +docs/msw/install.txt +src/makewat.env diff --git a/distrib/msw/tardist b/distrib/msw/tardist index 72b1df566e..9896e06500 100644 --- a/distrib/msw/tardist +++ b/distrib/msw/tardist @@ -3,6 +3,7 @@ # Supply a source (e.g. ~/wx2) and destination (e.g. ~/wx2/deliver) init="" +WXVER=2.1.16 if [ $1 = "" ] then exit @@ -24,56 +25,55 @@ cd $1 echo Removing backup files... rm *~ */*~ */*/*~ */*/*/*~ */*/*/*/*~ -rm -f $2/wx200*.tgz +rm -f $2/wx${WXVER}*.tgz rm -f $2/tex2rtf2.tgz rm -f $2/ogl3.tgz -rm -f $2/treedraw.tar.gz -rm -f $2/glcanvas.tar.gz rm -f $2/jpeg.tgz +rm -f $2/tiff.tgz echo Tarring... ### Generic ls `cat $1/distrib/msw/generic.rsp $1/distrib/msw/makefile.rsp` > /tmp/wxgen.txt -tar cvf $2/wx200gen.tar -T /tmp/wxgen.txt -gzip $2/wx200gen.tar -mv $2/wx200gen.tar.gz $2/wx200gen.tgz +tar cvf $2/wx${WXVER}gen.tar -T /tmp/wxgen.txt +gzip $2/wx${WXVER}gen.tar +mv $2/wx${WXVER}gen.tar.gz $2/wx${WXVER}gen.tgz ### wxGTK ls `cat $1/distrib/msw/generic.rsp $1/distrib/msw/gtk.rsp $1/distrib/msw/makefile.rsp` > /tmp/wxgtk.txt -tar cvf $2/wx200gtk.tar -T /tmp/wxgtk.txt -gzip $2/wx200gtk.tar -mv $2/wx200gtk.tar.gz $2/wx200gtk.tgz +tar cvf $2/wx${WXVER}gtk.tar -T /tmp/wxgtk.txt +gzip $2/wx${WXVER}gtk.tar +mv $2/wx${WXVER}gtk.tar.gz $2/wx${WXVER}gtk.tgz ### wxMotif ls `cat $1/distrib/msw/generic.rsp $1/distrib/msw/motif.rsp $1/distrib/msw/makefile.rsp` > /tmp/wxmotif.txt -tar cvf $2/wx200mot.tar -T /tmp/wxmotif.txt -gzip $2/wx200mot.tar -mv $2/wx200mot.tar.gz $2/wx200mot.tgz +tar cvf $2/wx${WXVER}mot.tar -T /tmp/wxmotif.txt +gzip $2/wx${WXVER}mot.tar +mv $2/wx${WXVER}mot.tar.gz $2/wx${WXVER}mot.tgz ### Doc sources ls `cat $1/distrib/msw/docsrc.rsp` > /tmp/docsrc.txt -tar cvf $2/wx200doc.tar -T /tmp/docsrc.txt -gzip $2/wx200doc.tar -mv $2/wx200doc.tar.gz $2/wx200doc.tgz +tar cvf $2/wx${WXVER}doc.tar -T /tmp/docsrc.txt +gzip $2/wx${WXVER}doc.tar +mv $2/wx${WXVER}doc.tar.gz $2/wx${WXVER}doc.tgz ### HTML docs ls `cat $1/distrib/msw/wx_html.rsp` > /tmp/html.txt -tar cvf $2/wx200htm.tar -T /tmp/html.txt -gzip $2/wx200htm.tar -mv $2/wx200htm.tar.gz $2/wx200htm.tgz +tar cvf $2/wx${WXVER}htm.tar -T /tmp/html.txt +gzip $2/wx${WXVER}htm.tar +mv $2/wx${WXVER}htm.tar.gz $2/wx${WXVER}htm.tgz ### PDF docs ls `cat $1/distrib/msw/wx_pdf.rsp` > /tmp/pdf.txt -tar cvf $2/wx200pdf.tar -T /tmp/pdf.txt -gzip $2/wx200pdf.tar -mv $2/wx200pdf.tar.gz $2/wx200pdf.tgz +tar cvf $2/wx${WXVER}pdf.tar -T /tmp/pdf.txt +gzip $2/wx${WXVER}pdf.tar +mv $2/wx${WXVER}pdf.tar.gz $2/wx${WXVER}pdf.tgz ### Stubs files ls `cat $1/distrib/msw/stubs.rsp` > /tmp/stubs.txt -tar cvf $2/wx200stubs.tar -T /tmp/stubs.txt -gzip $2/wx200stubs.tar -mv $2/wx200stubs.tar.gz $2/wx200stubs.tgz +tar cvf $2/wx${WXVER}stubs.tar -T /tmp/stubs.txt +gzip $2/wx${WXVER}stubs.tar +mv $2/wx${WXVER}stubs.tar.gz $2/wx${WXVER}stubs.tgz ### Tex2RTF ls `cat $1/distrib/msw/tex2rtf.rsp` > /tmp/tex2rtf.txt @@ -87,22 +87,16 @@ tar cvf $2/ogl3.tar -T /tmp/ogl.txt gzip $2/ogl3.tar mv $2/ogl3.tar.gz $2/ogl3.tgz -### wxGLCanvas -ls `cat $1/distrib/msw/glcanvas.rsp` > /tmp/glcanvas.txt -tar cvf $2/glcanvas.tar -T /tmp/glcanvas.txt -gzip $2/glcanvas.tar -mv $2/glcanvas.tar.gz $2/glcanvas.tgz - -### wxTreeLayout -ls `cat $1/distrib/msw/wxtree.rsp` > /tmp/wxtree.txt -tar cvf $2/treedraw.tar -T /tmp/wxtree.txt -gzip $2/treedraw.tar -mv $2/treedraw.tar.gz $2/treedraw.tgz - ### JPEG ls `cat $1/distrib/msw/jpeg.rsp` > /tmp/jpeg.txt tar cvf $2/jpeg.tar -T /tmp/jpeg.txt gzip $2/jpeg.tar mv $2/jpeg.tar.gz $2/jpeg.tgz +### TIFF +ls `cat $1/distrib/msw/tiff.rsp` > /tmp/tiff.txt +tar cvf $2/tiff.tar -T /tmp/tiff.txt +gzip $2/tiff.tar +mv $2/tiff.tar.gz $2/tiff.tgz + echo Done! diff --git a/distrib/msw/tarwxmotif b/distrib/msw/tarwxmotif new file mode 100644 index 0000000000..839604113f --- /dev/null +++ b/distrib/msw/tarwxmotif @@ -0,0 +1,94 @@ +#!/bin/sh +# tardist: make up a tar.gz distribution of wxWindows 2 +# Supply a source (e.g. ~/wx2) and destination (e.g. ~/wx2/deliver) + +init="" +WXVER=2.2.0 +if [ $1 = "" ] +then + exit +fi + +if [ $2 = "" ] +then + exit +fi + +echo About to archive wxWindows: +echo From $1 +echo To $2 +echo CTRL-C if this is not correct. +read dummy + +cd $1 + +echo Removing backup files... +rm *~ */*~ */*/*~ */*/*/*~ */*/*/*/*~ + +echo Setting permissions... +chmod a+x $1/configure $1/config.sub $1/config.guess $1/samples/configure $1/demos/configure $1/contrib/configure + +rm -f $2/wxMotif-${WXVER}*.tgz +rm -f $2/wxWindows*.tgz +rm -f $2/tex2rtf2.tgz +rm -f $2/ogl3.tgz +rm -f $2/jpeg.tgz +rm -f $2/tiff.tgz + +echo Tarring... + +### wxMotif +ls `cat $1/distrib/msw/generic.rsp $1/distrib/msw/motif.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/utilmake.rsp $1/distrib/msw/jpeg.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/wx_html.rsp $1/distrib/msw/tex2rtf.rsp $1/distrib/msw/dialoged.rsp $1/distrib/msw/utils.rsp` > /tmp/wxmotif.txt +tar cvf $2/wxMotif-${WXVER}.tar -T /tmp/wxmotif.txt +gzip $2/wxMotif-${WXVER}.tar +mv $2/wxMotif-${WXVER}.tar.gz $2/wxMotif-${WXVER}.tgz + +### HTML docs +ls `cat $1/distrib/msw/wx_html.rsp` > /tmp/html.txt +tar cvf $2/wxWindows-${WXVER}-HTML.tar -T /tmp/html.txt +gzip $2/wxWindows-${WXVER}-HTML.tar +mv $2/wxWindows-${WXVER}-HTML.tar.gz $2/wxWindows-${WXVER}-HTML.tgz + +### HTB (wxHTML Help) docs +ls `cat $1/distrib/msw/wx_htb.rsp` > /tmp/htb.txt +tar cvf $2/wxWindows-${WXVER}-HTB.tar -T /tmp/htb.txt +gzip $2/wxWindows-${WXVER}-HTB.tar +mv $2/wxWindows-${WXVER}-HTB.tar.gz $2/wxWindows-${WXVER}-HTB.tgz + +### PDF docs +ls `cat $1/distrib/msw/wx_pdf.rsp` > /tmp/pdf.txt +tar cvf $2/wxWindows-${WXVER}-PDF.tar -T /tmp/pdf.txt +gzip $2/wxWindows-${WXVER}-PDF.tar +mv $2/wxWindows-${WXVER}-PDF.tar.gz $2/wxWindows-${WXVER}-PDF.tgz + +### Stubs files +#ls `cat $1/distrib/msw/stubs.rsp` > /tmp/stubs.txt +#tar cvf $2/wxWindows-${WXVER}-stubs.tar -T /tmp/stubs.txt +#gzip $2/wxWindows-${WXVER}-stubs.tar +#mv $2/wxWindows-${WXVER}-stubs.tar.gz $2/wxWindows-${WXVER}-stubs.tgz + +### Tex2RTF +ls `cat $1/distrib/msw/tex2rtf.rsp` > /tmp/tex2rtf.txt +tar cvf $2/tex2rtf2.tar -T /tmp/tex2rtf.txt +gzip $2/tex2rtf2.tar +mv $2/tex2rtf2.tar.gz $2/tex2rtf2.tgz + +### OGL +ls `cat $1/distrib/msw/ogl.rsp` > /tmp/ogl.txt +tar cvf $2/ogl3.tar -T /tmp/ogl.txt +gzip $2/ogl3.tar +mv $2/ogl3.tar.gz $2/ogl3.tgz + +### JPEG +#ls `cat $1/distrib/msw/jpeg.rsp` > /tmp/jpeg.txt +#tar cvf $2/jpeg.tar -T /tmp/jpeg.txt +#gzip $2/jpeg.tar +#mv $2/jpeg.tar.gz $2/jpeg.tgz + +### TIFF +#ls `cat $1/distrib/msw/tiff.rsp` > /tmp/tiff.txt +#tar cvf $2/tiff.tar -T /tmp/tiff.txt +#gzip $2/tiff.tar +#mv $2/tiff.tar.gz $2/tiff.tgz + +echo Done! diff --git a/distrib/msw/tex2rtf.rsp b/distrib/msw/tex2rtf.rsp index 536d55564c..278f47879b 100644 --- a/distrib/msw/tex2rtf.rsp +++ b/distrib/msw/tex2rtf.rsp @@ -1,7 +1,15 @@ utils/tex2rtf/Makefile.in utils/tex2rtf/src/*.cpp utils/tex2rtf/src/*.h -utils/tex2rtf/src/make*.* +utils/tex2rtf/src/makefile.vc +utils/tex2rtf/src/makefile.bcc +utils/tex2rtf/src/makefile.dos +utils/tex2rtf/src/makefile.b32 +utils/tex2rtf/src/makefile.wat +utils/tex2rtf/src/makefile.unx +utils/tex2rtf/src/makefile.vms +utils/tex2rtf/src/makefile.g95 +utils/tex2rtf/src/Makefile.in utils/tex2rtf/src/*.xbm utils/tex2rtf/src/*.xpm utils/tex2rtf/src/*.sty diff --git a/distrib/msw/tiff.rsp b/distrib/msw/tiff.rsp index 5fb9219b64..cba0610eb3 100644 --- a/distrib/msw/tiff.rsp +++ b/distrib/msw/tiff.rsp @@ -1,6 +1,6 @@ src/tiff/make* -src/tiff/tiff.dsp -src/tiff/tiff.dsw +src/tiff/TiffVC.dsp +src/tiff/TiffVC.dsw src/tiff/*.c src/tiff/*.h src/tiff/README diff --git a/distrib/msw/tmake/b32.t b/distrib/msw/tmake/b32.t index a7317f0c7c..a701f3c2be 100644 --- a/distrib/msw/tmake/b32.t +++ b/distrib/msw/tmake/b32.t @@ -39,11 +39,12 @@ foreach $file (sort keys %wxMSW) { next if $wxMSW{$file} =~ /\b16\b/; - if ( $file =~ /^automtn/ ) { - #! comment in old makefile.b32 seems to imply that this file can't - #! be compiled with Borland (leads to crash in oleauto sample) - next; - } +#! if ( $file =~ /^automtn/ ) { +#! #! comment in old makefile.b32 seems to imply that this file can not +#! #! be compiled with Borland (leads to crash in oleauto sample) +#! No longer true, at least for BC++ 5.2 +#! next; +#! } $isCFile = $file =~ /\.c$/; @@ -111,12 +112,12 @@ PERIPH_CLEAN_TARGET=clean_ctl3d $(PERIPH_CLEAN_TARGET) !endif !if "$(USE_XPM_IN_MSW)" == "1" -PERIPH_LIBS=$(WXLIB)\xpm.lib $(PERIPH_LIBS) +PERIPH_LIBS=$(WXDIR)\lib\xpm.lib $(PERIPH_LIBS) PERIPH_TARGET=xpm $(PERIPH_TARGET) PERIPH_CLEAN_TARGET=clean_xpm $(PERIPH_CLEAN_TARGET) !endif -#PERIPH_LIBS=$(WXDIR)\lib\zlib.lib $(WXDIR)\lib\winpng.lib $(WXDIR)\lib\jpeg.lib $(PERIPH_LIBS) +#PERIPH_LIBS=$(WXDIR)\lib\zlib.lib $(WXDIR)\lib\winpng.lib $(WXDIR)\lib\jpeg.lib $(WXDIR)\lib\tiff.lib $(PERIPH_LIBS) PERIPH_LIBS= PERIPH_TARGET=zlib png jpeg tiff $(PERIPH_TARGET) PERIPH_CLEAN_TARGET=clean_zlib clean_png clean_jpeg clean_tiff $(PERIPH_CLEAN_TARGET) @@ -125,7 +126,7 @@ PERIPH_CLEAN_TARGET=clean_zlib clean_png clean_jpeg clean_tiff $(PERIPH_CLEAN_TA DUMMY=dummy !else DUMMY=dummydll -LIBS= cw32 import32 ole2w32 +LIBS= cw32mti import32 ole2w32 odbc32 xpm zlib winpng jpeg tiff !endif LIBTARGET=$(WXLIB) @@ -163,7 +164,6 @@ OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(MSWOBJS) $(HTMLOBJS) default: wx -#wx: $(CFG) $(LNKCFG) $(DUMMY).obj $(OBJECTS) $(PERIPH_TARGET) $(LIBTARGET) wx: $(CFG) $(DUMMY).obj $(OBJECTS) $(PERIPH_TARGET) $(LIBTARGET) all: all_libs all_execs @@ -181,7 +181,7 @@ $(LIBTARGET): $(DUMMY).obj $(OBJECTS) $(LIBTARGET): $(DUMMY).obj $(OBJECTS) -erase $(LIBTARGET) -erase $(WXLIBDIR)\wx.dll - tlink32 $(LINK_FLAGS) /v @&&! + $(LINK) $(LINK_FLAGS) /L$(WXLIBDIR);$(BCCDIR)\lib;$(BCCDIR)\lib\psdk /v @&&! c0d32.obj $(OBJECTS) $(WXLIBDIR)\wx nul @@ -343,6 +343,7 @@ clean_tiff: $(CFG): makefile.b32 copy &&! +-Hc -H=$(WXDIR)\src\msw\wx32.csm -3 -d @@ -368,13 +369,11 @@ $(DEBUG_FLAGS) $(WIN95FLAG) ! $(CFG) -#$(LNKCFG): makefile.b32 -# copy &&! -#-L$(WXLIBDIR);$(WXLIBDIR2);$(BCCDIR)\lib;$(BCCDIR)\lib\psdk -#! $(LNKCFG) - clean: $(PERIPH_CLEAN_TARGET) -erase $(LIBTARGET) + -erase $(WXLIBDIR)\wx.dll + -erase $(WXLIBDIR)\wx.tds + -erase $(WXLIBDIR)\wx.il? -erase *.obj -erase *.pch -erase *.csm diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt index ca215871f1..bc6e317f83 100644 --- a/distrib/msw/tmake/filelist.txt +++ b/distrib/msw/tmake/filelist.txt @@ -94,7 +94,7 @@ scrolwin.cpp G splitter.cpp G statline.cpp G U,R,P statusbr.cpp G -tabg.cpp G 16,P +tabg.cpp G P numdlgg.cpp G tbarsmpl.cpp G textdlgg.cpp G @@ -123,7 +123,7 @@ docmdi.cpp C docview.cpp C dynarray.cpp C B dynlib.cpp C B -encconv.cpp C +encconv.cpp C B event.cpp C B extended.c C B ffile.cpp C B @@ -132,7 +132,7 @@ fileconf.cpp C B filefn.cpp C B filesys.cpp C B fontcmn.cpp C -fontmap.cpp C +fontmap.cpp C B framecmn.cpp C fs_inet.cpp C B fs_zip.cpp C B @@ -253,6 +253,7 @@ gaugemsw.cpp M 16 gdiimage.cpp M gdiobj.cpp M glcanvas.cpp M +helpchm.cpp M 32 helpwin.cpp M icon.cpp M imaglist.cpp M 32 @@ -349,6 +350,7 @@ frame.cpp R gauge.cpp R gdiobj.cpp R icon.cpp R +joystick.cpp R listbox.cpp R main.cpp R mdi.cpp R @@ -585,7 +587,7 @@ docview.h W dragimag.h W dynarray.h W B dynlib.h W B -encconv.h W +encconv.h W B event.h W B expr.h W ffile.h W B @@ -596,10 +598,11 @@ filefn.h W B filesys.h W B font.h W fontdlg.h W +fontenc.h W B fontenum.h W -fontmap.h W +fontmap.h W B fontdlg.h W -fontutil.h W +fontutil.h W B frame.h W fs_inet.h W B fs_zip.h W B @@ -616,6 +619,7 @@ hash.h W B help.h W helpbase.h W helphtml.h W +helpchm.h W helpwin.h W helpxlp.h W icon.h W @@ -901,6 +905,7 @@ gaugemsw.h 9 gdiimage.h 9 gdiobj.h 9 glcanvas.h 9 +helpchm.h 9 helpwin.h 9 icon.h 9 imaglist.h 9 diff --git a/distrib/msw/tmake/g95.t b/distrib/msw/tmake/g95.t index d830757770..55c9e53b01 100644 --- a/distrib/msw/tmake/g95.t +++ b/distrib/msw/tmake/g95.t @@ -236,25 +236,26 @@ JPEGOBJS = \ $(JPEGDIR)/jquant2.$(OBJSUFF) \ $(JPEGDIR)/jdmerge.$(OBJSUFF) -XPMOBJS = $(XPMDIR)/attrib.o\ - $(XPMDIR)/crbuffri.o\ - $(XPMDIR)/crdatfri.o\ +# NOTE: these filenames are case sensitive! +XPMOBJS = $(XPMDIR)/Attrib.o\ + $(XPMDIR)/CrBufFrI.o\ + $(XPMDIR)/CrDatFrI.o\ $(XPMDIR)/create.o\ - $(XPMDIR)/crifrbuf.o\ - $(XPMDIR)/crifrdat.o\ + $(XPMDIR)/CrIFrBuf.o\ + $(XPMDIR)/CrIFrDat.o\ $(XPMDIR)/data.o\ - $(XPMDIR)/image.o\ - $(XPMDIR)/info.o\ + $(XPMDIR)/Image.o\ + $(XPMDIR)/Info.o\ $(XPMDIR)/hashtab.o\ $(XPMDIR)/misc.o\ $(XPMDIR)/parse.o\ - $(XPMDIR)/rdftodat.o\ - $(XPMDIR)/rdftoi.o\ + $(XPMDIR)/RdFToDat.o\ + $(XPMDIR)/RdFToI.o\ $(XPMDIR)/rgb.o\ $(XPMDIR)/scan.o\ $(XPMDIR)/simx.o\ - $(XPMDIR)/wrffrdat.o\ - $(XPMDIR)/wrffri.o + $(XPMDIR)/WrFFrDat.o\ + $(XPMDIR)/WrFFrI.o TIFFOBJS = $(TIFFDIR)/tif_aux.o \ $(TIFFDIR)/tif_close.o \ diff --git a/distrib/msw/tmake/vc.t b/distrib/msw/tmake/vc.t index 97f19d896b..5a2ffd1646 100644 --- a/distrib/msw/tmake/vc.t +++ b/distrib/msw/tmake/vc.t @@ -243,6 +243,10 @@ $(WXDIR)\lib\$(WXLIBNAME).dll: $(DUMMYOBJ) $(OBJECTS) $(LINKFLAGS) -out:$(WXDIR)\lib\$(WXLIBNAME).dll $(DUMMYOBJ) $(OBJECTS) $(guilibsdll) shell32.lib comctl32.lib ctl3d32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib odbc32.lib advapi32.lib winmm.lib $(GL_LIBS) $(WXDIR)\lib\png$(LIBEXT).lib $(WXDIR)\lib\zlib$(LIBEXT).lib $(WXDIR)\lib\xpm$(LIBEXT).lib $(WXDIR)\lib\jpeg$(LIBEXT).lib $(WXDIR)\lib\tiff$(LIBEXT).lib + delayimp.lib + /delayload:ws2_32.dll /delayload:advapi32.dll /delayload:user32.dll /delayload:gdi32.dll + /delayload:comdlg32.dll /delayload:shell32.dll /delayload:comctl32.dll /delayload:ole32.dll + /delayload:oleaut32.dll /delayload:rpcrt4.dll /delayload:winmm.dll /delayload:opengl32.dll << !endif @@ -409,7 +413,7 @@ rcparser: nmake -f makefile.vc FINAL=$(FINAL) cd $(WXDIR)\src\msw -cleanall: clean_png clean_zlib clean_xpm clean_jpeg clean_tiff +cleanall: clean clean_png clean_zlib clean_xpm clean_jpeg clean_tiff -erase ..\..\lib\wx$(WXVERSION)$(LIBEXT).dll -erase ..\..\lib\wx$(WXVERSION)$(LIBEXT).lib -erase ..\..\lib\wx$(WXVERSION)$(LIBEXT).exp @@ -448,7 +452,7 @@ clean: $(PERIPH_CLEAN_TARGET) # Making documents -docs: allhlp allhtml allpdfrtf +docs: allhlp allhtml allpdfrtf htb htmlhelp alldocs: docs hlp: wxhlp wxhlp: $(DOCDIR)/winhelp/wx.hlp @@ -457,8 +461,9 @@ rtf: $(DOCDIR)/winhelp/wx.rtf pdfrtf: $(DOCDIR)/pdf/wx.rtf refpdfrtf: $(DOCDIR)/pdf/techref.rtf html: wxhtml +htb: $(DOCDIR)\htb\wx.htb wxhtml: $(DOCDIR)\html\wx\wx.htm -htmlhelp: $(DOCDIR)\html\wx\wx.chm +htmlhelp: $(DOCDIR)\htmlhelp\wx.chm ps: wxps referencps wxps: $(WXDIR)\docs\ps\wx.ps referencps: $(WXDIR)\docs\ps\referenc.ps @@ -569,6 +574,7 @@ $(DOCDIR)/pdf/techref.rtf: $(DOCDIR)/latex/techref/techref.tex $(DOCDIR)\html\wx\wx.htm: $(DOCDIR)\latex\wx\classes.tex $(DOCDIR)\latex\wx\body.tex $(DOCDIR)/latex/wx/topics.tex $(DOCDIR)\latex\wx\manual.tex cd $(DOCDIR)\latex\wx -mkdir $(DOCDIR)\html\wx + copy *.gif $(DOCDIR)\html\wx -start $(WAITFLAG) tex2rtf $(DOCDIR)\latex\wx\manual.tex $(DOCDIR)\html\wx\wx.htm -twice -html -erase $(DOCDIR)\html\wx\*.con -erase $(DOCDIR)\html\wx\*.ref @@ -576,9 +582,11 @@ $(DOCDIR)\html\wx\wx.htm: $(DOCDIR)\latex\wx\classes.tex $(DOCDIR)\latex -erase $(DOCDIR)\latex\wx\*.ref cd $(THISDIR) -$(DOCDIR)\html\wx\wx.chm : $(DOCDIR)\html\wx\wx.htm $(DOCDIR)\html\wx\wx.hhp +$(DOCDIR)\htmlhelp\wx.chm : $(DOCDIR)\html\wx\wx.htm $(DOCDIR)\html\wx\wx.hhp cd $(DOCDIR)\html\wx -hhc wx.hhp + -mkdir ..\..\htmlhelp + move wx.chm ..\..\htmlhelp cd $(THISDIR) $(WXDIR)\docs\latex\wx\manual.dvi: $(DOCDIR)/latex/wx/body.tex $(DOCDIR)/latex/wx/manual.tex @@ -617,11 +625,12 @@ $(WXDIR)\docs\ps\referenc.ps: $(WXDIR)\docs\latex\wx\referenc.dvi # files, renamed to htb. # This can then be used with e.g. helpview. # Optionally, a cached version of the .hhp file can be generated with hhp2cached. -htb: +$(DOCDIR)\htb\wx.htb: $(DOCDIR)\html\wx\wx.htm cd $(WXDIR)\docs\html\wx -erase /Y wx.zip wx.htb zip32 wx.zip *.htm *.gif *.hhp *.hhc *.hhk - ren wx.zip wx.htb + -mkdir $(DOCDIR)\htb + move wx.zip $(DOCDIR)\htb\wx.htb cd $(THISDIR) # In order to force document reprocessing @@ -630,6 +639,13 @@ touchmanual: updatedocs: touchmanual alldocs +cleandocs: + -erase /Y $(DOCDIR)\html\wx\wx.htm + -erase /Y $(DOCDIR)\pdf\wx.rtf + -erase /Y $(DOCDIR)\latex\wx\wx.rtf + -erase /Y $(DOCDIR)\htmlhelp\wx.chm + -erase /Y $(DOCDIR)\htb\wx.htb + # Start Word, running the GeneratePDF macro. MakeManual.dot should be in the # Office StartUp folder, and PDFMaker should be installed. updatepdf: # touchmanual pdfrtf diff --git a/distrib/msw/tmake/vc6base.t b/distrib/msw/tmake/vc6base.t index 3c40d7c4c4..c69fed6103 100644 --- a/distrib/msw/tmake/vc6base.t +++ b/distrib/msw/tmake/vc6base.t @@ -73,8 +73,8 @@ RSC=rc.exe # PROP Output_Dir "BaseRelease" # PROP Intermediate_Dir "BaseRelease" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MT" /YX /FD /c -# ADD CPP /nologo /MT /W4 /Zi /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D WIN95=1 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN32__" /D "_MT" /Yu"wx/wxprec.h" /FD /c +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MT" /YX /FD /c +# ADD CPP /nologo /MD /W4 /Zi /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D WIN95=1 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN32__" /D "_MT" /Yu"wx/wxprec.h" /FD /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 BSC32=bscmake.exe @@ -96,8 +96,8 @@ LIB32=link.exe -lib # PROP Output_Dir "BaseDebug" # PROP Intermediate_Dir "BaseDebug" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MT" /YX /FD /c -# ADD CPP /nologo /MTd /W4 /Zi /Od /I "$(wx)\include" /I "$(wx)\src\zlib" /D "_DEBUG" /D DEBUG=1 /D WXDEBUG=1 /D "__WXDEBUG__" /D wxUSE_GUI=0 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WIN32__" /D "__WXMSW__" /D "_MT" /Fr /Yu"wx/wxprec.h" /FD /c +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MT" /YX /FD /c +# ADD CPP /nologo /MDd /W4 /Zi /Od /I "$(wx)\include" /I "$(wx)\src\zlib" /D "_DEBUG" /D DEBUG=1 /D WXDEBUG=1 /D "__WXDEBUG__" /D wxUSE_GUI=0 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WIN32__" /D "__WXMSW__" /D "_MT" /Fr /Yu"wx/wxprec.h" /FD /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 BSC32=bscmake.exe diff --git a/distrib/msw/tmake/vc6bdll.t b/distrib/msw/tmake/vc6bdll.t new file mode 100644 index 0000000000..8ed6d304af --- /dev/null +++ b/distrib/msw/tmake/vc6bdll.t @@ -0,0 +1,133 @@ +#!############################################################################# +#! File: vc6bdll.t +#! Purpose: tmake template file from which wxBaseDll.dsp is generated by running +#! tmake -t vc6bdll wxwin.pro -o wxBaseDll.dsp +#! Author: Vadim Zeitlin +#! Created: 22.03.00 +#! Version: $Id$ +#!############################################################################# +#${ + #! include the code which parses filelist.txt file and initializes + #! %wxCommon, %wxGeneric and %wxMSW hashes. + IncludeTemplate("filelist.t"); + + #! now transform these hashes into $project tags + foreach $file (sort keys %wxCommon) { + next if $wxCommon{$file} !~ /\bB\b/; + + my $tag = $file =~ /\.c$/ ? "WXCSRCS" : "WXCOMMONSRCS"; + $project{$tag} .= $file . " " + } + + foreach $file (sort keys %wxMSW) { + next if $wxMSW{$file} !~ /\bB\b/; + + my $tag = $file =~ /\.c$/ ? "WXMSWCSRCS" : "WXMSWSRCS"; + $project{$tag} .= $file . " " + } + + foreach $file (sort keys %wxBase) { + my $tag = $file =~ /\.c$/ ? "WXCSRCS" : "WXCOMMONSRCS"; + $project{$tag} .= $file . " " + } +#$} +# Microsoft Developer Studio Project File - Name="wxBaseDll" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=wxBaseDll - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "wxBaseDll.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "wxBaseDll.mak" CFG="wxBaseDll - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "wxBaseDll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "wxBaseDll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "wxBaseDll - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "BaseDllRelease" +# PROP Intermediate_Dir "BaseDllRelease" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXBASEDLL_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W4 /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WIN32__" /D "__WXMSW__" /D "_MT" /D "WXMAKINGDLL" /Yu"wx/wxprec.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /i "$(wx)\include" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /version:2.2 /dll /machine:I386 + +!ELSEIF "$(CFG)" == "wxBaseDll - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "BaseDllDebug" +# PROP Intermediate_Dir "BaseDllDebug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXBASEDLL_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W4 /Gm /ZI /Od /I "$(wx)\include" /I "$(wx)\src\zlib" /D "_DEBUG" /D wxUSE_GUI=0 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WIN32__" /D "__WXMSW__" /D "_MT" /D "WXMAKINGDLL" /D "__WXDEBUG__" /Yu"wx/wxprec.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /i "$(wx)\include" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /version:2.2 /dll /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "wxBaseDll - Win32 Release" +# Name "wxBaseDll - Win32 Debug" +# Begin Source File + +SOURCE=.\src\msw\dummydll.cpp +# ADD CPP /Yc"wx/wxprec.h" +# End Source File +#$ ExpandGlue("WXCOMMONSRCS", "# Begin Source File\n\nSOURCE=.\\src\\common\\", "\n# End Source File\n# Begin Source File\n\nSOURCE=.\\src\\common\\", "\n# End Source File\n"); +#$ ExpandGlue("WXMSWSRCS", "# Begin Source File\n\nSOURCE=.\\src\\msw\\", "\n# End Source File\n# Begin Source File\n\nSOURCE=.\\src\\msw\\", "\n# End Source File\n"); +#$ ExpandGlue("WXCSRCS", "# Begin Source File\n\nSOURCE=.\\src\\common\\", "\n# SUBTRACT CPP /YX /Yc /Yu\n# End Source File\n# Begin Source File\n\nSOURCE=.\\src\\common\\", "\n# SUBTRACT CPP /YX /Yc /Yu\n# End Source File\n"); +#$ ExpandGlue("WXMSWCSRCS", "# Begin Source File\n\nSOURCE=.\\src\\msw\\", "\n# SUBTRACT CPP /YX /Yc /Yu\n# End Source File\n# Begin Source File\n\nSOURCE=.\\src\\msw\\", "\n# SUBTRACT CPP /YX /Yc /Yu\n# End Source File\n"); +# End Target +# End Project diff --git a/distrib/msw/tmake/vc6dll.t b/distrib/msw/tmake/vc6dll.t index 247c3c66c0..19bf5b936a 100644 --- a/distrib/msw/tmake/vc6dll.t +++ b/distrib/msw/tmake/vc6dll.t @@ -82,8 +82,8 @@ RSC=rc.exe # PROP Intermediate_Dir "ReleaseDLL" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W4 /GX /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /D "NDEBUG" /D wxUSE_GUI=1 /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /D "__WXMSW__" /D "__WIN95__" /D "__WINDOWS__" /D "__WIN32__" /D "WXMAKINGDLL" /Yu"wx/wxprec.h" /FD /c +# ADD BASE CPP /nologo /MD /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W4 /GX /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /D "NDEBUG" /D wxUSE_GUI=1 /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /D "__WXMSW__" /D "__WIN95__" /D "__WINDOWS__" /D "__WIN32__" /D "WXMAKINGDLL" /Yu"wx/wxprec.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -92,8 +92,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib src\png\png.lib src\xpm\xpm.lib src\zlib\zlib.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib winmm.lib src\png\png.lib src\xpm\xpm.lib src\zlib\zlib.lib /nologo /dll /machine:I386 +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib src\png\Release\png.lib src\xpm\Release\xpm.lib src\zlib\Release\zlib.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib winmm.lib src\png\Release\png.lib src\xpm\Release\xpm.lib src\zlib\Release\zlib.lib /nologo /dll /machine:I386 !ELSEIF "$(CFG)" == "wxWinDll - Win32 Debug" @@ -108,8 +108,8 @@ LINK32=link.exe # PROP Intermediate_Dir "DebugDLL" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W4 /Gm /ZI /Od /I "$(wx)\include" /I "$(wx)\src\zlib" /D "_DEBUG" /D "__WXDEBUG__" /D wxUSE_GUI=1 /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /D "__WXMSW__" /D "__WIN95__" /D "__WINDOWS__" /D "__WIN32__" /D "WXMAKINGDLL" /Yu"wx/wxprec.h" /FD /GZ /c +# ADD BASE CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W4 /Gm /ZI /Od /I "$(wx)\include" /I "$(wx)\src\zlib" /D "_DEBUG" /D "__WXDEBUG__" /D wxUSE_GUI=1 /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WXWINDLL_EXPORTS" /D "__WXMSW__" /D "__WIN95__" /D "__WINDOWS__" /D "__WIN32__" /D "WXMAKINGDLL" /Yu"wx/wxprec.h" /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -118,8 +118,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib lib\png.lib src\png\png.lib src\xpm\xpm.lib src\zlib\zlib.lib /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib src\png\png.lib src\xpm\xpm.lib src\zlib\zlib.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib src\png\Debug\png.lib src\xpm\Debug\xpm.lib src\zlib\Debug\zlib.lib /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib src\png\Debug\png.lib src\xpm\Debug\xpm.lib src\zlib\Debug\zlib.lib /nologo /dll /debug /machine:I386 /pdbtype:sept !ENDIF diff --git a/distrib/msw/tmake/vcapp.t b/distrib/msw/tmake/vcapp.t new file mode 100644 index 0000000000..afc6a86cea --- /dev/null +++ b/distrib/msw/tmake/vcapp.t @@ -0,0 +1,310 @@ +#! +#! This TMAKE template - Microsoft Visual C++ 6.0 applications +#! +#${ + if ( Config("qt") || Config("opengl") ) { + Project('CONFIG += windows'); + } + if ( Config("qt") ) { + $moc_aware = 1; + AddIncludePath(Project('TMAKE_INCDIR_QT')); + if ( Config("opengl") ) { + Project('TMAKE_LIBS *= $$TMAKE_LIBS_QT_OPENGL'); + } + Project('TMAKE_LIBS *= $$TMAKE_LIBS_QT'); + } + if ( Config("opengl") ) { + Project('TMAKE_LIBS *= $$TMAKE_LIBS_OPENGL'); + } + #! wxWindows specific things (added by VZ) + #! (1) set -I and -L options + #! (2) be sure we have the same project settings as wxWindows.dsp, here it + #! means that we must disable C++ exception handling + #! (3) define the necessary constants + if ( Config("wx") ) { + Project('CONFIG += windows'); + } + if ( Config("wxbase") ) { + Project('CONFIG += wx'); + } + if ( Config("wx") ) { + #! VC 6.0 supports env vars in include path + #! $WXDIR = $ENV{'WX'}; + $WXDIR = "\$(WX)"; + $TMAKE_INCDIR_WX = $WXDIR . "\\include"; + AddIncludePath($TMAKE_INCDIR_WX); + } + + if ( Config("dll") ) { + $DLL="Dll"; + $DLL_OR_LIB="wxWinDll"; + $DLL_FLAGS="/D WXUSINGDLL "; + } + else { + $DLL=""; + $DLL_OR_LIB="wxWindows"; + $DLL_FLAGS=" "; + } + + #! let's be smarter: first of all, if no extension is given, add .lib + #! (this allows for LIBS=libname in project files which map either on + #! -l libname.lib under Windows or on -llibname under Unix). + @libs = split(/\s+/, Project('LIBS')); + foreach $lib (@libs) { + if ( $lib !~ "\.lib\$" ) { $lib .= ".lib"; } + Project('TMAKE_LIBS *= ' . $lib); + } + + if ( Config("windows") ) { + $project{"VC_PROJ_TYPE"} = 'Win32 (x86) Application'; + $project{"VC_PROJ_CODE"} = '0x0101'; + $vc_base_libs = 'kernel32.lib user32.lib gdi32.lib winspool.lib ' . + 'comdlg32.lib advapi32.lib shell32.lib ole32.lib ' . + 'oleaut32.lib uuid.lib odbc32.lib odbccp32.lib '; + if ( Config("wx") ) { + $vc_base_libs .= "comctl32.lib rpcrt4.lib wsock32.lib "; + + $vc_link_release = "$WXDIR\\Release$DLL\\$DLL_OR_LIB.lib $WXDIR\\src\\xpm\\Release\\xpm.lib "; + $vc_link_debug = "$WXDIR\\Debug$DLL\\$DLL_OR_LIB.lib $WXDIR\\src\\xpm\\Debug\\xpm.lib "; + } + $vc_link_release .= '/nologo /subsystem:windows /machine:I386'; + $vc_link_debug .= '/nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept'; + + $vc_cpp_def_common = '/D "WIN32" /D "_WINDOWS" ' . $DLL_FLAGS; + $vc_cpp_def_release = '/D "NDEBUG" ' . $vc_cpp_def_common; + $vc_cpp_def_debug = '/D "_DEBUG" ' . $vc_cpp_def_common; + } else { + $project{"VC_PROJ_TYPE"} = 'Win32 (x86) Console Application'; + $project{"VC_PROJ_CODE"} = '0x0103'; + $vc_base_libs = 'kernel32.lib user32.lib advapi32.lib '; + if ( Config("wx") ) { + $vc_base_libs .= 'wsock32.lib '; + $vc_link_release = "$WXDIR\\Base${DLL}Release\\wxBase$DLL.lib "; + $vc_link_debug = "$WXDIR\\Base${DLL}Debug\\wxBase$DLL.lib "; + } + $vc_link_release .= '/nologo /subsystem:console /machine:I386'; + $vc_link_debug .= '/nologo /subsystem:console /debug /machine:I386 /pdbtype:sept'; + + $vc_cpp_def_common = '/D "WIN32" /D "_CONSOLE" ' . $DLL_FLAGS; + $vc_cpp_def_release = '/D "NDEBUG" ' . $vc_cpp_def_common; + $vc_cpp_def_debug = '/D "_DEBUG" ' . $vc_cpp_def_common; + } + #! define wxWin debug flags in debug build + if ( Config("wx") ) { + $vc_cpp_def_debug .= '/MDd /D "__WXDEBUG__" /D "WXDEBUG=1" '; + $vc_cpp_def_release .= '/MD ' + } + + $project{"VC_BASE_LINK_RELEASE"} = $vc_base_libs . $vc_link_release; + $project{"VC_BASE_LINK_DEBUG"} = $vc_base_libs . $vc_link_debug; + $tmake_libs = Project('TMAKE_LIBS') ? (Project('TMAKE_LIBS') . " ") : ""; + $project{"VC_LINK_RELEASE"} = $vc_base_libs . $tmake_libs . $vc_link_release; + $project{"VC_LINK_DEBUG"} = $vc_base_libs . $tmake_libs . $vc_link_debug; + + $vc_cpp_opt_common1 = '/nologo /W4 '; + if ( !Config("wx") ) { + $vc_cpp_opt_common1 = $vc_cpp_opt_common1 . '/GX '; + } + #! else: disable C++ exception handling for wxWindows + + $vc_cpp_opt_release = $vc_cpp_opt_common1 . '/O2 '; + $vc_cpp_opt_debug = $vc_cpp_opt_common1 . '/Zi /Od '; + $vc_cpp_opt_common = '/YX /FD /c'; + $project{"VC_BASE_CPP_RELEASE"} = $vc_cpp_opt_release . $vc_cpp_def_release . $vc_cpp_opt_common; + $project{"VC_BASE_CPP_DEBUG"} = $vc_cpp_opt_debug . $vc_cpp_def_debug . $vc_cpp_opt_common; + ExpandGlue("INCPATH",'/I "','" /I "','"'); + if ( $text ne "" ) { $vc_inc = $text . " "; $text = ""; } else { $vc_inc = ""; } + ExpandGlue("DEFINES",'/D "','" /D "','"'); + if ( $text ne "" ) { $vc_def = $text . " "; $text = ""; } else { $vc_def = ""; } + if ( Config("wx") ) { + #! define wxWindows compilation flags + $vc_def .= '/D _WIN32 /D __WIN32__ /D WINVER=0x400 /D __WINDOWS__ /D __WXMSW__ /D __WIN95__ /D __WIN32__ /D _MT '; + + if ( Config("wxbase") ) { + $vc_def .= '/D wxUSE_GUI=0 '; + } + else { + $vc_def .= '/D wxUSE_GUI=1 '; + } + } + + $project{"VC_CPP_INCLUDE"} = $vc_inc; + $project{"VC_CPP_RELEASE"} = $vc_cpp_opt_release . $vc_inc . $vc_cpp_def_release . $vc_def . $vc_cpp_opt_common; + $project{"VC_CPP_DEBUG"} = $vc_cpp_opt_debug . $vc_inc . $vc_cpp_def_debug . $vc_def . $vc_cpp_opt_common; + + if ( Project('RES_FILE') ) { + tmake_error(".res files are not supported, use .rc."); + } + + $project{"MAKEFILE"} = $project{"PROJECT"} . ".mak"; + $project{"TARGETAPP"} = $project{"TARGET"} . ".exe"; + Project('TMAKE_FILETAGS = HEADERS SOURCES TARGET DESTDIR $$FILETAGS'); + foreach ( split(/\s/,Project('TMAKE_FILETAGS')) ) { + $project{$_} =~ s-/-\\-g; + } + StdInit(); + if ( defined($project{"DESTDIR"}) ) { + $project{"TARGETAPP"} = $project{"DESTDIR"} . "\\" . $project{"TARGETAPP"}; + $project{"TARGETAPP"} =~ s/\\+/\\/g; + } + %all_files = (); + @files = split(/\s+/,$project{"HEADERS"}); + foreach ( @files ) { $all_files{$_} = "h" }; + @files = split(/\s+/,$project{"SOURCES"}); + foreach ( @files ) { $all_files{$_} = "s" }; + @files = split(/\s+/,$project{"RC_FILE"}); + foreach ( @files ) { $all_files{$_} = "r" }; + + if ( $moc_aware ) { + @files = split(/\s+/,$project{"_HDRMOC"}); + foreach ( @files ) { $all_files{$_} = "m"; } + @files = split(/\s+/,$project{"_SRCMOC"}); + foreach ( @files ) { $all_files{$_} = "i"; } + } + %file_names = (); + foreach $f ( %all_files ) { + $n = $f; + $n =~ s/^.*\\//; + $file_names{$n} = $f; + $file_path{$n} = ".\\" . $f; + $file_path2{$n} = (($f =~ /^\./) ? "" : ".\\") . $f; + } + +#$} +# Microsoft Developer Studio Project File - #$ Substitute('Name="$$TARGET" - Package Owner=<4>'); +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE #$ Substitute('"$$VC_PROJ_TYPE" $$VC_PROJ_CODE'); + +CFG=#$ Substitute('$$TARGET - Win32 Debug'); +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "#$ ExpandGlue('MAKEFILE','','','".'); +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f #$ Substitute('"$$MAKEFILE" CFG="$$TARGET - Win32 Debug"'); +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE #$ Substitute('"$$TARGET - Win32 Release" (based on "$$VC_PROJ_TYPE")'); +!MESSAGE #$ Substitute('"$$TARGET - Win32 Debug" (based on "$$VC_PROJ_TYPE")'); +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +#$ Config("windows") && ($text='MTL=midl.exe'); +RSC=rc.exe + +!IF "$(CFG)" == #$ Substitute('"$$TARGET - Win32 Release"'); + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +#$ Config("windows") && ($text='# PROP Ignore_Export_Lib 0'); +# PROP Target_Dir "" +# ADD BASE CPP #$ Expand("VC_BASE_CPP_RELEASE"); +# ADD CPP #$ Expand("VC_CPP_RELEASE"); +#$ Config("windows") || DisableOutput(); +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +#$ Config("windows") || EnableOutput(); +# ADD BASE RSC /l 0x409 /d "NDEBUG" #$ Expand("VC_CPP_INCLUDE"); +# ADD RSC /l 0x409 /d "NDEBUG" #$ Expand("VC_CPP_INCLUDE"); +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 #$ Expand("VC_BASE_LINK_RELEASE"); +# ADD LINK32 #$ Expand("VC_LINK_RELEASE"); + +!ELSEIF "$(CFG)" == #$ Substitute('"$$TARGET - Win32 Debug"'); + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +#$ Config("windows") && ($text='# PROP Ignore_Export_Lib 0'); +# PROP Target_Dir "" +# ADD BASE CPP #$ Expand("VC_BASE_CPP_DEBUG"); +# ADD CPP #$ Expand("VC_CPP_DEBUG"); +#$ Config("windows") || DisableOutput(); +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +#$ Config("windows") || EnableOutput(); +# ADD BASE RSC /l 0x409 /d "_DEBUG" #$ Expand("VC_CPP_INCLUDE"); +# ADD RSC /l 0x409 /d "_DEBUG" #$ Expand("VC_CPP_INCLUDE"); +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 #$ Expand("VC_BASE_LINK_DEBUG"); +# ADD LINK32 #$ Expand("VC_LINK_DEBUG"); + +!ENDIF + +# Begin Target + +# Name #$Substitute('"$$TARGET - Win32 Release"'); +# Name #$Substitute('"$$TARGET - Win32 Debug"'); +#${ + foreach $n ( sort keys %file_names ) { + $f = $file_names{$n}; + $p = $file_path{$n}; + $p2 = $file_path2{$n}; + $t = $all_files{$f}; + if ( ($t eq "h") && $moc_output{$f} ) { + my($build); + $build = "\n\n# Begin Custom Build - Running moc...\nInputPath=" . $p2 . "\n\n" + . '"' . $moc_output{$f} . '" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"' + . "\n\tmoc $p2 -o " . $moc_output{$f} . "\n\n" + . "# End Custom Build\n\n"; + $text .= ("# Begin Source File\n\nSOURCE=$p\n\n" + . '!IF "$(CFG)" == "' . $project{"TARGET"} . ' - Win32 Release"' + . $build); + $text .= ('!ELSEIF "$(CFG)" == "' . $project{"TARGET"} . ' - Win32 Debug"' + . $build + . "!ENDIF \n\n# End Source File\n"); + } elsif ( $t eq "i" ) { + my($build,$dn); + $build = "\n\n# Begin Custom Build - Running moc...\nInputPath=" . $p2 . "\n\n" + . '"' . $f . '" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"' + . "\n\tmoc ". $moc_input{$f} . " -o $f\n\n" + . "# End Custom Build\n\n"; + $dn = $n; + $dn =~ s/\..*//; + $dn =~ tr/a-z/A-Z/; + $text .= ("# Begin Source File\n\nSOURCE=$p\n" + . "USERDEP__$dn=" . '"' . $moc_input{$f} . '"' . "\n\n" + . '!IF "$(CFG)" == "' . $project{"TARGET"} . ' - Win32 Release"' + . $build); + $text .= ('!ELSEIF "$(CFG)" == "' . $project{"TARGET"} . ' - Win32 Debug"' + . $build + . "!ENDIF \n\n# End Source File\n"); + } elsif ( $t eq "s" || $t eq "m" || $t eq "h" || $t eq "r" ) { + $text .= "# Begin Source File\n\nSOURCE=$p\n"; + $text .= "# End Source File\n"; + } + } + chop $text; +#$} +# End Target +# End Project + +#! vim:sta:sw=4:ts=8:nolist:noet diff --git a/distrib/msw/tmake/wat.t b/distrib/msw/tmake/wat.t index 49c3c8957c..9e9f629805 100644 --- a/distrib/msw/tmake/wat.t +++ b/distrib/msw/tmake/wat.t @@ -30,9 +30,6 @@ } foreach $file (sort keys %wxCommon) { - #! doesn't compile, apparently - next if $file =~ /^imagjpeg\./; - $isCFile = $file =~ /\.c$/; $file =~ s/cp?p?$/obj/; $project{"WXCOMMONOBJS"} .= $file . " "; @@ -85,11 +82,13 @@ LIBTARGET = $(WXLIB)\wx.lib DUMMY=dummydll # ODBCLIB = ..\..\contrib\odbc\odbc32.lib -EXTRATARGETS = xpm png zlib -EXTRATARGETSCLEAN = clean_xpm clean_png clean_zlib +EXTRATARGETS = xpm png zlib jpeg tiff +EXTRATARGETSCLEAN = clean_xpm clean_png clean_zlib clean_jpeg clean_tiff GENDIR=$(WXDIR)\src\generic COMMDIR=$(WXDIR)\src\common XPMDIR=$(WXDIR)\src\xpm +JPEGDIR=$(WXDIR)\src\jpeg +TIFFDIR=$(WXDIR)\src\tiff MSWDIR=$(WXDIR)\src\msw OLEDIR=$(MSWDIR)\ole @@ -354,6 +353,26 @@ clean_zlib: .SYMBOLIC wmake -f makefile.wat clean cd $(WXDIR)\src\msw +jpeg: .SYMBOLIC + cd $(WXDIR)\src\jpeg + wmake -f makefile.wat all + cd $(WXDIR)\src\msw + +clean_jpeg: .SYMBOLIC + cd $(WXDIR)\src\jpeg + wmake -f makefile.wat clean + cd $(WXDIR)\src\msw + +tiff: .SYMBOLIC + cd $(WXDIR)\src\tiff + wmake -f makefile.wat all + cd $(WXDIR)\src\msw + +clean_tiff: .SYMBOLIC + cd $(WXDIR)\src\tiff + wmake -f makefile.wat clean + cd $(WXDIR)\src\msw + MFTYPE=wat self : .SYMBOLIC $(WXDIR)\distrib\msw\tmake\filelist.txt $(WXDIR)\distrib\msw\tmake\$(MFTYPE).t cd $(WXDIR)\distrib\msw\tmake diff --git a/distrib/msw/vc.rsp b/distrib/msw/vc.rsp index fd4b8ce900..67bffaec61 100644 --- a/distrib/msw/vc.rsp +++ b/distrib/msw/vc.rsp @@ -3,20 +3,20 @@ src/wxvc.dsw src/wxvc_dll.dsp src/wxvc_dll.dsw -src/jpeg/jpeg.dsp -src/jpeg/jpeg.dsw +src/jpeg/JpegVC.dsp +src/jpeg/JpegVC.dsw -src/tiff/tiff.dsp -src/tiff/tiff.dsw +src/tiff/TiffVC.dsp +src/tiff/TiffVC.dsw -src/zlib/zlib.dsp -src/zlib/zlib.dsw +src/zlib/ZlibVC.dsp +src/zlib/ZlibVC.dsw -src/png/png.dsp -src/png/png.dsw +src/png/PngVC.dsp +src/png/PngVC.dsw -src/xpm/xpm.dsp -src/xpm/xpm.dsw +src/xpm/XpmVC.dsp +src/xpm/XpmVC.dsw samples/SamplesVC.dsw diff --git a/distrib/msw/wisebott.txt b/distrib/msw/wisebott.txt index 309b56830e..f8a5c0c892 100644 --- a/distrib/msw/wisebott.txt +++ b/distrib/msw/wisebott.txt @@ -21,7 +21,7 @@ item: Set Variable Value=%GROUPDIR%\%GROUP% end item: Create Shortcut - Source=%MAINDIR%\Docs\Winhelp\Wx.hlp + Source=%MAINDIR%\Docs\htmlhelp\Wx.chm Destination=%GROUP%\wxWindows Manual.lnk Working Directory=%MAINDIR% end @@ -31,17 +31,17 @@ item: Create Shortcut Working Directory=%MAINDIR% end item: Create Shortcut - Source=%MAINDIR%\docs\winhelp\dialoged.hlp + Source=%MAINDIR%\docs\htmlhelp\dialoged.chm Destination=%GROUP%\Dialog Editor Help.lnk Working Directory=%MAINDIR% end item: Create Shortcut - Source=%MAINDIR%\contrib\docs\winhelp\ogl.hlp + Source=%MAINDIR%\contrib\docs\htmlhelp\ogl.chm Destination=%GROUP%\Object Graphics Library Help.lnk Working Directory=%MAINDIR% end item: Create Shortcut - Source=%MAINDIR%\docs\winhelp\tex2rtf.hlp + Source=%MAINDIR%\docs\htmlhelp\tex2rtf.chm Destination=%GROUP%\Tex2RTF Help.lnk Working Directory=%MAINDIR% end @@ -91,7 +91,7 @@ end item: Add ProgMan Icon Group=%GROUP% Icon Name=wxWindows Manual - Command Line=%MAINDIR%\Docs\Winhelp\Wx.hlp + Command Line=%MAINDIR%\Docs\htmlhelp\wx.chm Default Directory=%MAINDIR% end item: Add ProgMan Icon @@ -115,19 +115,19 @@ end item: Add ProgMan Icon Group=%GROUP% Icon Name=Dialog Editor Help - Command Line=%MAINDIR%\docs\winhelp\dialoged.hlp + Command Line=%MAINDIR%\docs\htmlhelp\dialoged.chm Default Directory=%MAINDIR% end item: Add ProgMan Icon Group=%GROUP% Icon Name=Object Graphics Library Help - Command Line=%MAINDIR%\contrib\docs\winhelp\ogl.hlp + Command Line=%MAINDIR%\contrib\docs\htmlhelp\ogl.chm Default Directory=%MAINDIR% end item: Add ProgMan Icon Group=%GROUP% Icon Name=Tex2RTF Help - Command Line=%MAINDIR%\docs\winhelp\tex2rtf.hlp + Command Line=%MAINDIR%\docs\htmlhelp\tex2rtf.chm Default Directory=%MAINDIR% end item: Add ProgMan Icon diff --git a/distrib/msw/wisetop.txt b/distrib/msw/wisetop.txt index d559db5e95..9e9b6ebc0e 100644 --- a/distrib/msw/wisetop.txt +++ b/distrib/msw/wisetop.txt @@ -1,7 +1,7 @@ Document Type: WSE item: Global Version=5.0 - Title=wxWindows 2.1.14 Installation + Title=wxWindows 2.2.0 Installation Flags=00000100 Split=1420 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 @@ -47,7 +47,7 @@ item: End Block end item: Set Variable Variable=APPTITLE - Value=wxWindows 2.1.14 + Value=wxWindows 2.2.0 end item: Set Variable Variable=GROUP @@ -207,7 +207,9 @@ item: Custom Dialog Set item: Static Rectangle=86 41 256 130 Create Flags=01010000000000000000000000000000 - Text=This installation program will install %APPTITLE%. It will need about 25 MB of hard disk space. + Text=This installation program will install %APPTITLE%. It will need 30-130 MB of hard disk space, + Text=depending on the disk cluster size. Allow further disk space for compiling the library + Text=and samples. Text= Text=Press the Next button to start the installation. You can press the Cancel button now if you do not want to install %APPTITLE% at this time. Text French=Ce programme d'installation va installer %APPTITLE%. diff --git a/distrib/msw/wx_chm.rsp b/distrib/msw/wx_chm.rsp new file mode 100644 index 0000000000..0c8a76da7e --- /dev/null +++ b/distrib/msw/wx_chm.rsp @@ -0,0 +1,3 @@ +docs/htmlhelp/*.chm +contrib/docs/htmlhelp/*.chm + diff --git a/distrib/msw/wx_htb.rsp b/distrib/msw/wx_htb.rsp new file mode 100644 index 0000000000..00792253b1 --- /dev/null +++ b/distrib/msw/wx_htb.rsp @@ -0,0 +1,3 @@ +docs/htb/*.htb +contrib/docs/htb/*.htb + diff --git a/distrib/msw/wx_html.rsp b/distrib/msw/wx_html.rsp index 478f9ef94c..e59cc21bda 100644 --- a/distrib/msw/wx_html.rsp +++ b/distrib/msw/wx_html.rsp @@ -12,7 +12,7 @@ docs/html/tex2rtf/*.gif docs/html/odbc/*.htm -docs/html/gettext/*.htm +docs/html/gettext/*.html contrib/docs/html/ogl/*.htm contrib/docs/html/ogl/*.gif diff --git a/distrib/msw/zipdist.bat b/distrib/msw/zipdist.bat index 846fd6f117..ebde4e8e07 100755 --- a/distrib/msw/zipdist.bat +++ b/distrib/msw/zipdist.bat @@ -1,11 +1,11 @@ @echo off -rem Zip up an external, generic + Windows distribution of wxWindows 2.0 +rem Zip up an external, generic + Windows distribution of wxWindows 2 set src=%wxwin set dest=%src\deliver set wise=0 Rem Set this to the required version -set version=2_1_14 +set version=2.2.0 if "%src" == "" goto usage if "%dest" == "" goto usage @@ -22,6 +22,7 @@ echo CTRL-C if this is not correct. pause erase %dest\wx*.zip +erase %dest\*.htb erase %dest\ogl3.zip erase %dest\tex2rtf2.zip erase %dest\jpeg.zip @@ -29,41 +30,55 @@ erase %dest\tiff.zip erase %dest\dialoged.zip erase %dest\utils.zip erase %dest\extradoc.zip +erase %dest\*-win32.zip if direxist %dest\wx deltree /Y %dest\wx cd %src echo Zipping... -zip32 -@ %dest\wx%version%_gen.zip < %src\distrib\msw\generic.rsp -zip32 -@ -u %dest\wx%version%_gen.zip < %src\distrib\msw\makefile.rsp -zip32 -@ %dest\wx%version%_msw.zip < %src\distrib\msw\msw.rsp -zip32 -@ -u %dest\wx%version%_msw.zip < %src\distrib\msw\makefile.rsp -zip32 -@ %dest\wx%version%_gtk.zip < %src\distrib\msw\gtk.rsp -zip32 -@ -u %dest\wx%version%_gtk.zip < %src\distrib\msw\makefile.rsp -zip32 -@ %dest\wx%version%_stubs.zip < %src\distrib\msw\stubs.rsp -zip32 -@ %dest\wx%version%_mot.zip < %src\distrib\msw\motif.rsp -zip32 -@ -u %dest\wx%version%_mot.zip < %src\distrib\msw\makefile.rsp -Rem (Obsolete) zip32 -@ %dest\wx%version%_user.zip < %src\distrib\msw\user.rsp - -zip32 -@ %dest\wx%version%_doc.zip < %src\distrib\msw\docsrc.rsp -zip32 -@ %dest\wx%version%_hlp.zip < %src\distrib\msw\wx_hlp.rsp -zip32 -@ %dest\wx%version%_htm.zip < %src\distrib\msw\wx_html.rsp -zip32 -@ %dest\wx%version%_pdf.zip < %src\distrib\msw\wx_pdf.rsp -zip32 -@ %dest\wx%version%_wrd.zip < %src\distrib\msw\wx_word.rsp +Rem Zip up the complete wxMSW-xxx.zip file +Rem NO, do it by unarchiving component files, deleting/copying some files, then +Rem rearchiving. +Rem zip32 -@ %dest\wxMSW-%version%.zip < %src\distrib\msw\generic.rsp +Rem zip32 -@ -u %dest\wxMSW-%version%.zip < %src\distrib\msw\msw.rsp +Rem zip32 -@ -u %dest\wxMSW-%version%.zip < %src\distrib\msw\wx_chm.rsp +Rem zip32 -@ -u %dest\wxMSW-%version%.zip < %src\distrib\msw\jpeg.rsp +Rem zip32 -@ -u %dest\wxMSW-%version%.zip < %src\distrib\msw\tiff.rsp + +Rem Below is the old-style separated-out format. This is retained only +Rem for local use, and for creating wxMSW-xxx.zip. +zip32 -@ %dest\wxWindows-%version%-gen.zip < %src\distrib\msw\generic.rsp +zip32 -@ -u %dest\wxWindows-%version%-gen.zip < %src\distrib\msw\makefile.rsp +zip32 -@ %dest\wxWindows-%version%-msw.zip < %src\distrib\msw\msw.rsp +zip32 -@ -u %dest\wxWindows-%version%-msw.zip < %src\distrib\msw\makefile.rsp +zip32 -@ %dest\wxWindows-%version%-gtk.zip < %src\distrib\msw\gtk.rsp +zip32 -@ -u %dest\wxWindows-%version%-gtk.zip < %src\distrib\msw\makefile.rsp +zip32 -@ %dest\wxWindows-%version%-stubs.zip < %src\distrib\msw\stubs.rsp +zip32 -@ %dest\wxWindows-%version%-mot.zip < %src\distrib\msw\motif.rsp +zip32 -@ -u %dest\wxWindows-%version%-mot.zip < %src\distrib\msw\makefile.rsp +Rem (Obsolete) zip32 -@ %dest\wxWindows-%version%-user.zip < %src\distrib\msw\user.rsp + +zip32 -@ %dest\wxWindows-%version%-DocSource.zip < %src\distrib\msw\docsrc.rsp +zip32 -@ %dest\wxWindows-%version%-WinHelp.zip < %src\distrib\msw\wx_hlp.rsp +zip32 -@ %dest\wxWindows-%version%-HTML.zip < %src\distrib\msw\wx_html.rsp +zip32 -@ %dest\wxWindows-%version%-PDF.zip < %src\distrib\msw\wx_pdf.rsp +zip32 -@ %dest\wxWindows-%version%-Word.zip < %src\distrib\msw\wx_word.rsp +zip32 -@ %dest\wxWindows-%version%-HTB.zip < %src\distrib\msw\wx_htb.rsp +zip32 -@ %dest\wxWindows-%version%-HTMLHelp.zip < %src\distrib\msw\wx_chm.rsp Rem PDF/HTML docs that should go into the Windows setup because Rem there are no WinHelp equivalents zip32 -@ %dest\extradoc.zip < %src\distrib\msw\extradoc.rsp rem VC++ project files -zip32 -@ %dest\wx%version%_vc.zip < %src\distrib\msw\vc.rsp +zip32 -@ %dest\wxWindows-%version%-vc.zip < %src\distrib\msw\vc.rsp rem BC++ project files -zip32 -@ %dest\wx%version%_bc.zip < %src\distrib\msw\bc.rsp +zip32 -@ %dest\wxWindows-%version%-bc.zip < %src\distrib\msw\bc.rsp rem CodeWarrior project files -zip32 -@ %dest\wx%version%_cw.zip < %src\distrib\msw\cw.rsp +zip32 -@ %dest\wxWindows-%version%-cw.zip < %src\distrib\msw\cw.rsp rem OGL 3 zip32 -@ %dest\ogl3.zip < %src\distrib\msw\ogl.rsp @@ -101,7 +116,10 @@ copy %src\docs\msw\install.txt %dest\install_msw.txt copy %src\docs\motif\install.txt %dest\install_motif.txt copy %src\docs\gtk\install.txt %dest\install_gtk.txt copy %src\docs\readme.txt %dest -copy %src\docs\release.txt %dest +copy %src\docs\motif\readme.txt %dest\readme_motif.txt +copy %src\docs\gtk\readme.txt %dest\readme_gtk.txt +copy %src\docs\msw\readme.txt %dest\readme_msw.txt +copy %src\docs\readme_vms.txt %dest copy %src\docs\motif\makewxmotif %dest copy %src\docs\gtk\makewxgtk %dest @@ -110,6 +128,13 @@ if "%wise" == "0" goto end :dounzip +Rem Make dialoged-win32.zip and tex2rtf-win32.zip + +cd %src\bin + +zip32 %dest\dialoged-win32.zip dialoged.* +zip32 %dest\tex2rtf-win32.zip tex2rtf.* + cd %dest rem Unzip the Windows files into 'wx' @@ -119,14 +144,14 @@ Rem After this change of directory, we're in the Rem temporary 'wx' directory and not acting on Rem the source wxWindows directory. cd %dest\wx -unzip32 -o ..\wx%version%_msw.zip -unzip32 -o ..\wx%version%_gen.zip -unzip32 -o ..\wx%version%_vc.zip -unzip32 -o ..\wx%version%_bc.zip -unzip32 -o ..\wx%version%_hlp.zip +unzip32 -o ..\wxWindows-%version%-msw.zip +unzip32 -o ..\wxWindows-%version%-gen.zip +unzip32 -o ..\wxWindows-%version%-vc.zip +unzip32 -o ..\wxWindows-%version%-bc.zip +unzip32 -o ..\wxWindows-%version%-HTMLHelp.zip unzip32 -o ..\extradoc.zip Rem Need Word file, for Remstar DB classes -unzip32 -o ..\wx%version%_wrd.zip +unzip32 -o ..\wxWindows-%version%-Word.zip unzip32 -o ..\ogl3.zip unzip32 -o ..\jpeg.zip unzip32 -o ..\tiff.zip @@ -141,9 +166,12 @@ erase /SY Makefile.in erase /Y docs\html\wxbook.htm docs\html\roadmap.htm erase /Y contrib\docs\winhelp\mmedia.* erase /Y contrib\docs\winhelp\stc.* +erase /Y contrib\docs\htmlhelp\mmedia.* +erase /Y contrib\docs\htmlhelp\stc.* erase /Y contrib\docs\pdf\*.* deltree /Y contrib\docs\latex\ogl erase /Y src\mingegcs.bat +erase /Y distrib rem Now copy some binary files to 'bin' if not isdir bin mkdir bin @@ -154,6 +182,9 @@ copy %src\bin\life.exe bin copy %src\docs\winhelp\dialoged.hlp %src\docs\winhelp\dialoged.cnt bin copy %src\docs\winhelp\tex2rtf.hlp %src\docs\winhelp\tex2rtf.cnt bin +Rem Make wxMSW-xxx.zip +zip32 -r ..\wxMSW-%version%.zip * + rem Time to regenerate the WISE install script, wxwin2.wse. rem NB: if you've changed wxwin2.wse using WISE, call splitwise.exe rem from within distrib\msw, to split off wisetop.txt and wisebott.txt. @@ -167,7 +198,7 @@ set wisecmd="c:\Program Files\wise\wise32.exe" /C %WXWIN\distrib\msw\wxwin2.wse echo Invoking %wisecmd... start %wisecmd pause Press any key to continue with the wxWindows distribution... -Rem ren %WXWIN\deliver\setup.EXE %WXWIN\deliver\setup_%version%.exe +Rem ren %WXWIN\deliver\setup.EXE %WXWIN\deliver\wxMSW-%version%-setup.exe cd %dest @@ -193,8 +224,11 @@ ren s setup.w06 ren setup.w07 s ren s setup.w07 +ren setup.w08 s +ren s setup.w08 + rem Put all the setup files into a single zip archive. -zip32 wx%version%_setup.zip readme.txt setup.* +zip32 wxMSW-%version%-setup.zip readme.txt setup.* echo wxWindows archived. diff --git a/distrib/msw/zippatch.bat b/distrib/msw/zippatch.bat index 37742c7514..4980369d25 100755 --- a/distrib/msw/zippatch.bat +++ b/distrib/msw/zippatch.bat @@ -1,12 +1,10 @@ @echo off rem Zip up a patch file -Rem m:\wx2 contains the latest version + any crucial patches -set src=m:\wx2 +set src=d:\wx2\wxWindows set dest=%wxwin\deliver -set wise=0 Rem Set this to the required patch version -set version=03 +set version=01 if "%src" == "" goto usage if "%dest" == "" goto usage diff --git a/docs/changes.txt b/docs/changes.txt index 2409dab2be..3af65ba2e0 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -1,7 +1,107 @@ wxWindows 2 Change Log ---------------------- -2.1.14 +2.2.0 +----- + +wxBase: + +- Fixed bug with directories with trailing (back)slashes in wxPathExists +- wxString: added wxArrayString::operator==() and !=() +- Fixes for wxCmdLineParser +- Added wxGetLocalTimeMillis +- Completed Czech translations +- Some stream corrections +- added missing consts to wxPoint operators +- wxDateTime ParseFormat fixes +- wxFile::Open(write_append) will create file if it doesn't exist +- small fixes to MIME mailcap test command handling, more MIME tests in the sample + +All (GUI): + +- wxGenericDragImage now allows virtual image drawing, and + flicker-free dragging is now possible +- Added wxPrinter::GetLastError +- Fixed wxLogGui reentrancy problem +- Paper names now translated +- wxGrid fixes +- Generic validator now caters for more cases (integers in + wxTextCtrl, strings in wxChoice, wxComboBox) +- Fixed crash when docview On... functions return FALSE. Show + error message when an non-existent filename is typed into the Open + File dialog. +- Corrected Baltic font encoding handling +- wxImage: enhanced TIFF code, added new platform-independent BMP + writing code +- wxKeyEvent::GetKeyCode() and HasModifiers() added and documented +- Fixed wxPropertyForm crashes in sample +- wxWizard now calls TransferDataFromWindow() before calling + wxWizardPage::GetNext() fixing an obvious bug + +wxMSW: + +- wxWindow::GetCharWidth/Height now calculated accurately. + This will affect all .wxr dialog resources, so for + backward compatibility, please set + wxDIALOG_UNIT_COMPATIBILITY to 1 in setup.h +- wxListCtrl: set item text in LIST_ITEM_ACTIVATED events +- wxTextCtrl: implemented setting colours for rich edit controls +- wxColour now accepts both grey and gray +- BC++ DLL compilation fixed +- Watcom C++ makefiles improved for JPEG and TIFF compilation +- Fixed submenu accelerator bug +- Fixed dialog focus bug (crash if the previous window to have + the focus was destroyed before the dialog closed) +- Too-small default wxTextCtrl height fixed +- fixed "missing" initial resize of wxMDIChildFrame +- wxFrame restores focus better +- Now ignore wxTHICK_FRAME in wxWindow constructor: only relevant to + frames anddialogs, interferes with other window styles otherwise + (sometimes you'd get a thick frame in a subwindow) +- wxTextCtrl insertion point set to the beginning of the control by SetValue +- Fix so wxMDIParentFrame is actually shown when Show(TRUE) is called. +- wxFileDialog: adjusts struct size if there's an error (struct + sizes can be different on different versions of Windows) +- wxImageList::GetSize() documented and added to wxMSW +- fixed default dialog style to make them non resizeable again +- fixed wxFrame::IsShown() which always returned TRUE before + +wxGTK: + +- Please see docs/gtk/changes.txt. + +wxMotif: + +- Small compilation fixes + +Documentation: + +- wxCaret documented + +2.1.16 +------ + +wxBase: + +All (GUI): + +wxMSW: + +- Various bug fixes +- Added wxCHMHelpController, for invoking MS HTML Help + files. This works under VC++ only +- Modal dialog handling improved +- Printer dialog now modal + +wxGTK: + +- Various bug fixes + +wxMotif: + +- Various bug fixes + +2.1.15 ------ Documentation: @@ -50,7 +150,7 @@ all (GUI): MIME types if available (Unix only) - wxDC::DrawRotatedText() (based on contribution by Hans-Joachim Baader) - TIFF support added (libtiff required and included in the distribution) -- PCX files can now be written (24 bit only so far) +- PCX files can now be written (256 and 24 bits) - validators may work recursively if wxWS_EX_VALIDATE_RECURSIVELY is set - wxScrolledWindow now has keyboard interface - wxTextEntryDialog may be used for entering passwords (supports wxTE_PASSWORD) diff --git a/docs/gtk/changes.txt b/docs/gtk/changes.txt index 8afa17d42e..ce290c2c1f 100644 --- a/docs/gtk/changes.txt +++ b/docs/gtk/changes.txt @@ -1,4 +1,52 @@ -19th March '2000: wxWindows 2.1.14 released +10th July 2000: wxWindows 2.2 released + +Added code for writing BMP images. + +Added code for writing TIFF images. + +Fixed problem with best visuals (on SGI) + +Applied a number of compile fixes for various Unix variants. + +Fixed wrong background colours appearing sometimes and fix +for resetting the default font in controls. + +Speed-up to wxListCtrl. + +Fixed bug wxTextStream::ReadLine() + +Various improvements commandline parser. + +Changed wxColour unequal operator to compare colours. + +Fixed wxMenuBar::Replace bug. + +Added new position to slider update event. + +Minor fix to idle handling (now wxGTK events come after all GTK events). + +Various fixes to the new wxGrid class. + +Bug-fixes. + +4th June 2000: wxWindows pre-2.2 release + +Complete freeze now. Only vital bug-fixes allowed. + +Various enhancements to wxSizer. + +Added wxGridSizer and wxFlexGridSizer. + +Reworked wxURL. + +MANY bugfixes. + +22th March 2000: wxWindows 2.1.15 released + +Build fix. RPMs no loner require GTK's include files. + +An extra library for the OpenGl class now gets builts +19th March 2000: wxWindows 2.1.14 released An extra library for the OpenGl class now gets builts and installed. There is also an extra RPM for this diff --git a/docs/gtk/install.txt b/docs/gtk/install.txt index 684f0f6615..9c9a1f9cbb 100644 --- a/docs/gtk/install.txt +++ b/docs/gtk/install.txt @@ -1,7 +1,7 @@ !!! When sending bug reports tell us what version of wxWindows you are using (including the beta) and what compiler on what system. One - example: wxGTK 2.1 beta 6, egcs 1.1.1, Redhat 5.0 !!! + example: wxGTK 2.2.0, egcs 1.1.1, Redhat 6.2 !!! * The most simple case ----------------------- diff --git a/docs/gtk/makewxgtk b/docs/gtk/makewxgtk index d6d76f2124..2e5bcdb220 100644 --- a/docs/gtk/makewxgtk +++ b/docs/gtk/makewxgtk @@ -6,6 +6,6 @@ # if you're feeling braven, you may wish to compile with threads. # -- Julian Smart rm -f *.cache -chmod a+x configure config.sub config.guess samples/configure contrib/configure +chmod a+x configure config.sub config.guess samples/configure demos/configure contrib/configure ./configure --disable-shared --with-gtk --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets -without-odbc -without-libjpeg make diff --git a/docs/gtk/readme.txt b/docs/gtk/readme.txt index 44dbddac2d..6ea6760d96 100644 --- a/docs/gtk/readme.txt +++ b/docs/gtk/readme.txt @@ -1,19 +1,13 @@ - Welcome to wxWindows/Gtk 2.1.14 + Welcome to wxWindows/Gtk 2.2 -you have downloaded a beta version of the GTK+ 1.2 port of -the wxWindows GUI library. Although this is not yet the -final stable release wxGTK 2.2, the current version has -been tested carefully on many systems and has been found -to work better than any other previous version. - -This is the last beta release. wxWindows is now in a code -freeze and only bugs will be corrected. +you have downloaded version 2.2 of the GTK port of the +wxWindows GUI library. wxWindows no longer supports GTK 1.0 (as did some early snapshots) so that you will need GTK 1.2 when using it. -GTK 1.2.6 is recommended although some programs will work -with GTK 1.2.3 onwards. +GTK 1.2.6 or above is recommended although some programs +will work with GTK 1.2.3 onwards. More information is available from my homepage at: @@ -44,7 +38,7 @@ VERSION OF GTK, WXGTK, WHAT DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect, but I tried... The library produced by the install process will be called -libwx_gtk.a (static) and libwx_gtk-2.1.so.14.0.0 (shared) so +libwx_gtk.a (static) and libwx_gtk-2.2.so.0.0.0 (shared) so that once a binary incompatible version of wxWindows/Gtk comes out we'll augment the library version number to avoid linking problems. diff --git a/docs/gtk/todo.txt b/docs/gtk/todo.txt index edeeb01b94..64fdea667b 100644 --- a/docs/gtk/todo.txt +++ b/docs/gtk/todo.txt @@ -1,22 +1,27 @@ -------------------- High priority --------------------- -Improve, update translations. Install *.mo files somewehere. +Improve, update translations. Install *.mo files somewhere. -------------------- Medium priority --------------------- +wxBitmapButton doesn't refresh when parent gets refreshed. + -> Not important. + Show accelerator control labels and actually implement them - -> Changed in GTK 1.2 (so let's do it for 1.2). Difficult. + -> Difficult. -------------------- Low priority --------------------- Right aligned checkboxes: focus highlighting is wrong, tooltips can't be set can't be set + -> Postponed. GTK 1.4 can do that. -More testing of Unicode support. +Add wxNoteBook::GetPageIndex() +Add wxNoteBook::SetTabPosition() -> Postponed. -OwnerDraw for wxListCtrl and others - -> Hardly necessary. +More testing of Unicode support. + -> Postponed. Implement wxPalette -> Postponed. diff --git a/docs/html/faq.htm b/docs/html/faq.htm index cbe471dcb6..582397d58d 100644 --- a/docs/html/faq.htm +++ b/docs/html/faq.htm @@ -8,10 +8,10 @@ <font face="Arial, Lucida Sans, Helvetica"> -<table width=100% border=4 cellpadding=5 cellspacing=0> +<table width=100% border=0 cellpadding=5 cellspacing=0> <tr> -<td bgcolor="#660000"> -<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +<td bgcolor="#C4ECF9"> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> wxWindows 2 FAQ </font> </td> diff --git a/docs/html/faqgen.htm b/docs/html/faqgen.htm index cdea35dd73..a4e15b4185 100644 --- a/docs/html/faqgen.htm +++ b/docs/html/faqgen.htm @@ -8,10 +8,10 @@ <font face="Arial, Lucida Sans, Helvetica"> -<table width=100% border=4 cellpadding=5 cellspacing=0> +<table width=100% border=0 cellpadding=5 cellspacing=0> <tr> -<td bgcolor="#660000"> -<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +<td bgcolor="#C4ECF9"> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> wxWindows 2 FAQ: General </font> </td> diff --git a/docs/html/faqgtk.htm b/docs/html/faqgtk.htm index 1fe2c3586f..ba070ce196 100644 --- a/docs/html/faqgtk.htm +++ b/docs/html/faqgtk.htm @@ -8,10 +8,10 @@ <font face="Arial, Lucida Sans, Helvetica"> -<table width=100% border=4 cellpadding=5 cellspacing=0> +<table width=100% border=0 cellpadding=5 cellspacing=0> <tr> -<td bgcolor="#660000"> -<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +<td bgcolor="#C4ECF9"> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> wxWindows 2 for GTK FAQ </font> </td> diff --git a/docs/html/faqmac.htm b/docs/html/faqmac.htm index c5ad70a4b3..434221f04d 100644 --- a/docs/html/faqmac.htm +++ b/docs/html/faqmac.htm @@ -8,10 +8,10 @@ <font face="Arial, Lucida Sans, Helvetica"> -<table width=100% border=4 cellpadding=5 cellspacing=0> +<table width=100% border=0 cellpadding=5 cellspacing=0> <tr> -<td bgcolor="#660000"> -<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +<td bgcolor="#C4ECF9"> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> wxWindows 2 for Mac FAQ </font> </td> diff --git a/docs/html/faqmsw.htm b/docs/html/faqmsw.htm index e5a7e96019..be0f8d9091 100644 --- a/docs/html/faqmsw.htm +++ b/docs/html/faqmsw.htm @@ -8,10 +8,10 @@ <font face="Arial, Lucida Sans, Helvetica"> -<table width=100% border=4 cellpadding=5 cellspacing=0> +<table width=100% border=0 cellpadding=5 cellspacing=0> <tr> -<td bgcolor="#660000"> -<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +<td bgcolor="#C4ECF9"> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> wxWindows 2 for Windows FAQ </font> </td> diff --git a/docs/html/gettext/gettext.htm b/docs/html/gettext/gettext.htm deleted file mode 100644 index c48fc3708b..0000000000 --- a/docs/html/gettext/gettext.htm +++ /dev/null @@ -1,4961 +0,0 @@ -<HTML> -<HEAD> -<!-- This HTML file has been created by texi2html 1.51 - from gettext.texi on 4 September 1998 --> - -<TITLE>GNU gettext utilities</TITLE> -</HEAD> -<BODY> -<H1>GNU gettext tools, version 0.10</H1> -<H2>Native Language Support Library and Tools</H2> -<H2>Edition 0.10, 26 November</H2> -<ADDRESS>Ulrich Drepper</ADDRESS> -<ADDRESS>Jim Meyering</ADDRESS> -<ADDRESS>Pinard</ADDRESS> -<P> -<P><HR><P> - -<P> -Copyright (C) 1995 Free Software Foundation, Inc. - -</P> -<P> -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -</P> -<P> -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -</P> -<P> -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. - -</P> - - - -<H1><A NAME="SEC1" HREF="gettext_toc.html#TOC1">Introduction</A></H1> - - -<BLOCKQUOTE> -<P> -This manual is still in <EM>DRAFT</EM> state. Some sections are still -empty, or almost. We keep merging material from other sources -(essentially email folders) while the proper integration of this -material is delayed. -</BLOCKQUOTE> - -<P> -In this manual, we use <EM>he</EM> when speaking of the programmer or -maintainer, <EM>she</EM> when speaking of the translator, and <EM>they</EM> -when speaking of the installers or end users of the translated program. -This is only a convenience for clarifying the documentation. It is -absolutely not meant to imply that some roles are more appropriate -to males or females. Besides, as you might guess, GNU <CODE>gettext</CODE> -is meant to be useful for people using computers, whatever their sex, -race, religion or nationality! - -</P> -<P> -This chapter explains what are the goals seeked by the mere existence -of GNU <CODE>gettext</CODE>. Then, it explains a few wide concepts around -Native Language Support, and situates message translation in regard -to other aspects of national and cultural variance, as applicable -to programs. It also surveys what are those files used to convey -translations. It explains how the various tools interrelate in the -initial generation for these files, and later, how the maintenance -cycle usually operate. - -</P> - - - -<H2><A NAME="SEC2" HREF="gettext_toc.html#TOC2">The Purpose of GNU <CODE>gettext</CODE></A></H2> - -<P> -Usually, programs are written and documented in English, and use -English at execution time for interacting with users. This is true -not only from within GNU, but also in a great deal of commercial -and free software. Using a common language is quite handy for -communication between developers, maintainers and users from all -countries. On the other hand, most people are less comfortable with -English than with their own native language, and would rather prefer -using their mother tongue for day to day's work, as far as possible. -Many would simply <EM>love</EM> seeing their computer screen showing -a lot less of English, and far more of their own spoken language. - -</P> -<P> -However, to some people, this dream might appear so far fetched that -they may believe it is not even worth spending time thinking about -it, and they have no confidence at all that the dream might ever -become true. Many did not loose hope yet, and organized themselves. -The GNU Translation Project is a formalization of this hope into a -workable structure, which has a good chance to get all of us nearer -the achievement of a truly multi-lingual set of programs. - -</P> -<P> -GNU <CODE>gettext</CODE> is an important step for the GNU Translation -Project, as it is an asset on which we may build many other steps. -This package offers to programmers, translators and even users, a -well integrated set of tools and documentation. Specifically, the GNU -<CODE>gettext</CODE> utilities are a set of tools that provides a framework -to help other GNU packages produce multi-lingual messages. These tools -include a set of conventions about how programs should be written to -support message catalogs, a directory and file naming organization -for the message catalogs themselves, a runtime library supporting the -retrieval of translated messages, and a few stand-alone programs to -massage in various ways the sets of translatable strings, or already -translated strings. A special GNU Emacs mode also helps interested -parties into preparing these sets, or bringing them up to date. - -</P> -<P> -GNU <CODE>gettext</CODE> is designed so it minimizes the impact of -internationalization on program sources, keeping this impact as small -and hardly noticeable as possible. Internationalization has better -chances of succeeding if it is very light weighted, or at least, -appear to be so, when looking at program sources. - -</P> -<P> -The GNU Translation Project also uses the GNU <CODE>gettext</CODE> -distribution as a vehicle for documenting its structure and methods, -even if this goes beyond the technicalities of the GNU <CODE>gettext</CODE> -proper. By doing so, translators will find in a single place, as -far as possible, all they need to know for properly doing their -translating work. Also, this supplementary documentation might also -help programmers, and even curious users, at understanding how GNU -<CODE>gettext</CODE> is related to the remainder of the GNU Translation -Project, and consequently, have a glimpse at the <EM>big picture</EM>. - -</P> - - -<H2><A NAME="SEC3" HREF="gettext_toc.html#TOC3">I18n, L10n, and Such</A></H2> - -<P> -Two long words appear all the time when we discuss support of native -language in programs, and these words have a precise meaning, worth -being explained here, once and for all in this document. The words are -<EM>internationalization</EM> and <EM>localization</EM>. Many people, -tired of writing these long words over and over again, took the -habit of writing <STRONG>i18n</STRONG> and <STRONG>l10n</STRONG> instead, quoting the first -and last letter of each word, and replacing the run of intermediate -letters by a number merely telling how many such letters there are. -But in this manual, in the sake of clarity, we will patiently write -the names in full, each time... - -</P> -<P> -By <STRONG>internationalization</STRONG>, one refers to the operation by which a -program, or a set of programs turned into a package, is made aware and -able to support multiple languages. This is a generalization process, -by which the programs are untied from using only English strings or -other English specific habits, and connected to generic ways of doing -the same, instead. Program developers may use various techniques to -internationalize their programs, some of them have been standardized. -GNU <CODE>gettext</CODE> offers one of these standards. See section <A HREF="gettext.html#SEC36">The Programmer's View</A>. - -</P> -<P> -By <STRONG>localization</STRONG>, one means the operation by which, in a set -of programs already internationalized, one gives the program all -needed information so that it can bend itself to handle its input -and output in a fashion which is correct for some native language and -cultural habits. This is a particularisation process, by which generic -methods already implemented in an internationalized program are used -in specific ways. The programming environment puts several functions -to the programmers disposal which allow this runtime configuration. -The formal description of specific set of cultural habits for some -country, together with all associated translations targeted to the -same native language, is called the <STRONG>locale</STRONG> for this language -or country. Users achieve localization of programs by setting proper -values to special environment variables, prior to executing those -programs, identifying which locale should be used. - -</P> -<P> -In fact, locale message support is only one component of the cultural -data that makes up a particular locale. There are a whole host of -routines and functions provided to aid programmers in developing -internationalized software and which allows them to access the data -stored in a particular locale. When someone presently refers to a -particular locale, they are obviously referring to the data stored -within that particular locale. Similarly, if a programmer is referring -to "accessing the locale routines", they are referring to the -complete suite of routines that access all of the locale's information. - -</P> -<P> -One uses the expression <STRONG>Native Language Support</STRONG>, or merely NLS, -for speaking of the overall activity or feature encompassing both -internationalization and localization, allowing for multi-lingual -interactions in a program. In a nutshell, one could say that -internationalization is the operation by which further localizations -are made possible. - -</P> -<P> -Also, very roughly said, when it comes to multi-lingual messages, -internationalization is usually taken care of by programmers, and -localization is usually taken care of by translators. - -</P> - - -<H2><A NAME="SEC4" HREF="gettext_toc.html#TOC4">Aspects in Native Language Support</A></H2> - -<P> -For a totally multi-lingual distribution, there are many things to -translate beyond output messages. - -</P> - -<UL> -<LI> - -As of today, GNU <CODE>gettext</CODE> offers a complete toolset for -translating messages output by C programs. Perl scripts and shell -scripts also need to be translated. Even if there are some hooks -so this can be done, these hooks are not integrated as well as they -should be. - -<LI> - -Some programs, like <CODE>autoconf</CODE> or <CODE>bison</CODE>, are able -to produce other programs (or scripts). Even if the generating -programs themselves are internationalized, the generated programs they -produce may need internationalization on their own, and this indirect -internationalization could be automated right from the generating -program. In fact, quite usually, generating and generated programs -could be internationalized independently, as the effort needed is -fairly orthogonal. - -<LI> - -A few programs include textual tables which might need translation -themselves, independently of the strings contained in the program -itself. For example, RFC 1345 gives an English description for each -character which GNU <CODE>recode</CODE> is able to reconstruct at execution. -Since these descriptions are extracted from the RFC by mechanical means, -translating them properly would require a prior translation of the RFC -itself. - -<LI> - -Almost all programs accept options, which are often worded out so to -be descriptive for the English readers; one might want to consider -offering translated versions for program options as well. - -<LI> - -Many programs read, interpret, compile, or are somewhat driven by -input files which are texts containing keywords, identifiers, or -replies which are inherently translatable. For example, one may want -<CODE>gcc</CODE> to allow diacriticized characters in identifiers or use -translated keywords; <SAMP>`rm -i'</SAMP> might accept something else than -<SAMP>`y'</SAMP> or <SAMP>`n'</SAMP> for replies, etc. Even if the program will -eventually make most of its output in the foreign languages, one has -to decide whether the input syntax, option values, etc., are to be -localized or not. - -<LI> - -The manual accompanying a package, as well as all documentation files -in the distribution, could surely be translated, too. Translating a -manual, with the intent of later keeping up with updates, is a major -undertaking in itself, generally. - -</UL> - -<P> -As we already stressed, translation is only one aspect of locales. -Other internationalization aspects are not currently handled by GNU -<CODE>gettext</CODE>, but perhaps may be handled in future versions. There -are many attributes that are needed to define a country's cultural -conventions. These attributes include beside the country's native -language, the formatting of the date and time, the representation of -numbers, the symbols for currency, etc. These local <STRONG>rules</STRONG> are -termed the country's locale. The locale represents the knowledge -needed to support the country's native attributes. - -</P> -<P> -There are a few major areas which may vary between countries and -hence, define what a locale must describe. The following list helps -putting multi-lingual messages into the proper context of other tasks -related to locales, and also presents some other areas which GNU -<CODE>gettext</CODE> might eventually tackle, maybe, one of these days. - -</P> -<DL COMPACT> - -<DT><EM>Characters and Codesets</EM> -<DD> -The codeset most commonly used through out the USA and most English -speaking parts of the world is the ASCII codeset. However, there are -many characters needed by various locales that are not found within -this codeset. The 8-bit ISO 8859-1 code set has most of the special -characters needed to handle the major European languages. However, in -many cases, the ISO 8859-1 font is not adequate. Hence each locale -will need to specify which codeset they need to use and will need -to have the appropriate character handling routines to cope with -the codeset. - -<DT><EM>Currency</EM> -<DD> -The symbols used vary from country to country as does the position -used by the symbol. Software needs to be able to transparently -display currency figures in the native mode for each locale. - -<DT><EM>Dates</EM> -<DD> -The format of date varies between locales. For example, Christmas day -in 1994 is written as 12/25/94 in the USA and as 25/12/94 in Australia. -Other countries might use ISO 8061 dates, etc. - -Time of the day may be noted as <VAR>hh</VAR>:<VAR>mm</VAR>, <VAR>hh</VAR>.<VAR>mm</VAR>, -or otherwise. Some locales require time to be specified in 24-hour -mode rather than as AM or PM. Further, the nature and yearly extent -of the Daylight Saving correction vary widely between countries. - -<DT><EM>Numbers</EM> -<DD> -Numbers can be represented differently in different locales. -For example, the following numbers are all written correctly for -their respective locales: - - -<PRE> -12,345.67 English -12.345,67 French -1,2345.67 Asia -</PRE> - -Some programs could go further and use different unit systems, like -English units or Metric units, or even take into account variants -about how numbers are spelled in full. - -<DT><EM>Messages</EM> -<DD> -The most obvious area is the language support within a locale. This is -where GNU <CODE>gettext</CODE> provide an ease for developers and users to -easily change the language that the software uses to communicate to -the user. - -</DL> - -<P> -In the near future we see no chance that beside message handling -more components of locale will be made available for use in other -GNU packages. The reason for this is that most modern system provide -a more or less reasonable support for at least some of the missing -components. Another point is that the GNU libc and Linux will get -a new and complete implementation of the whole locale functionality -which could be adopted by system lacking a reasonable locale support. - -</P> - - -<H2><A NAME="SEC5" HREF="gettext_toc.html#TOC5">Files Conveying Translations</A></H2> - -<P> -The letters PO in <TT>`.po'</TT> files means Portable Object, to -distinguish it from <TT>`.mo'</TT> files, where MO stands for Machine -Object. This paradigm, as well as the PO file format, is inspired -by the NLS standard developed by Uniforum, and implemented by Sun -in their Solaris system. - -</P> -<P> -PO files are meant to be read and edited by humans, and associate each -original, translatable string of a given package with its translation -in a particular target language. A single PO file is dedicated to -a single target language. If a package supports many languages, -there is one such PO file per language supported, and each package -has its own set of PO files. These PO files are best created by -the <CODE>xgettext</CODE> program, and later updated or refreshed through -the <CODE>tupdate</CODE> program. Program <CODE>xgettext</CODE> extracts all -marked messages from a set of C files and initializes a PO file with -empty translations. Program <CODE>tupdate</CODE> takes care of adjusting -PO files between releases of the corresponding sources, commenting -obsolete entries, initializing new ones, and updating all source -line references. Files ending with <TT>`.pot'</TT> are kind of base -translation files found in distributions, in PO file format, and -<TT>`.pox'</TT> files are often temporary PO files. - -</P> -<P> -MO files are meant to be read by programs, and are binary in nature. -A few systems already offer tools for creating and handling MO files -as part of the Native Language Support coming with the system, but the -format of these MO files is often different from system to system, -and non-portable. They do not necessary use <TT>`.mo'</TT> for file -extensions, but since system libraries are also used for accessing -these files, it works as long as the system is self-consistent about -it. If GNU <CODE>gettext</CODE> is able to interface with the tools already -provided with systems, it will consequently let these provided tools -take care of generating the MO files. Or else, if such tools are not -found or do not seem usable, GNU <CODE>gettext</CODE> will use its own ways -and its own format for MO files. Files ending with <TT>`.gmo'</TT> are -really MO files, when it is known that these files use the GNU format. - -</P> - - -<H2><A NAME="SEC6" HREF="gettext_toc.html#TOC6">Overview of GNU <CODE>gettext</CODE></A></H2> - -<P> -The following diagram summarizes the relation between the files -handled by GNU <CODE>gettext</CODE> and the tools acting on these files. -It is followed by a somewhat detailed explanations, which you should -read while keeping an eye on the diagram. Having a clear understanding -of these interrelations would surely help programmers, translators -and maintainers. - -</P> - -<PRE> -Original C Sources ---> PO mode ---> Marked C Sources ---. - | - .---------<--- GNU gettext Library | -.--- make <---+ | -| `---------<--------------------+-----------' -| | -| .-----<--- PACKAGE.pot <--- xgettext <---' .---<--- PO Compendium -| | | ^ -| | `---. | -| `---. +---> PO mode ---. -| +----> tupdate -------> LANG.pox --->--------' | -| .---' | -| | | -| `-------------<---------------. | -| +--- LANG.po <--- New LANG.pox <----' -| .--- LANG.gmo <--- msgfmt <---' -| | -| `---> install ---> /.../LANG/PACKAGE.mo ---. -| +---> "Hello world!" -`-------> install ---> /.../bin/PROGRAM -------' -</PRE> - -<P> -The indication <SAMP>`PO mode'</SAMP> appears in two places in this picture, -and you may safely read it as merely meaning "hand editing", using -any editor of your choice, really. However, for those of you being -the lucky users of GNU Emacs, PO mode has been specifically created -for providing a cosy environment for editing or modifying PO files. -While editing a PO file, PO mode allows for the easy browsing of -auxiliary and compendium PO files, as well as following references into -the set of C program sources from which PO files has been derived. -It has a few special features, among which the interactive marking -of program strings as translatable, and the validatation of PO files -with easy repositioning to PO file lines showing errors. - -</P> -<P> -As a programmer, the first step into bringing GNU <CODE>gettext</CODE> -into your package is identifying, right in the C sources, which -strings are meant to be translatable, and which are untranslatable. -This tedious job can be done a little more comfortably using PO -mode, but you can use any means being usual to you for modifying your -C sources. Some other simple, standard changes are also needed to -properly initialize the translation library. See section <A HREF="gettext.html#SEC13">Preparing Program Sources</A>, for -more information about all this. - -</P> -<P> -Once the C sources have been modified, the <CODE>xgettext</CODE> program -is used to find and extract all translatable strings, and create an -initial PO file out of all these. This <TT>`<VAR>package</VAR>.pot'</TT> file -contains all original program strings, it has sets of pointers to -exactly where in C sources each string is used, and all translations -are set to empty. The letter <KBD>t</KBD> in <TT>`.pot'</TT> marks that this is -a Template PO file, not yet oriented towards any particular language. -See section <A HREF="gettext.html#SEC19">Invoking the <CODE>xgettext</CODE> Program</A>, for more details about how one calls the -<CODE>xgettext</CODE> program. If you are <EM>really</EM> lazy, you might -be interested at working a lot more right away, and preparing the -whole distribution setup (see section <A HREF="gettext.html#SEC65">The Maintainer's View</A>). By doing so, you -spare typing the <CODE>xgettext</CODE> command yourself, as <CODE>make</CODE> -should now generate the proper things automatically for you! - -</P> -<P> -The first time through, there is no <TT>`<VAR>lang</VAR>.po'</TT> yet, so the -<CODE>tupdate</CODE> step may be skipped and replaced by a mere copy of -<TT>`<VAR>package</VAR>.pot'</TT> to <TT>`<VAR>lang</VAR>.pox'</TT>, where <VAR>lang</VAR> -represents the target language. - -</P> -<P> -Then comes the initial translation of messages. Translation in -itself is a whole matter, still exclusively meant for humans, -and whose complexity far overwhelms the level of this manual. -Nevertheless, a few hints are given in some other chapter of this -manual (see section <A HREF="gettext.html#SEC54">The Translator's View</A>). You will also find there indications -about how to contact translating teams, or becoming part of them, -for sharing your translating concerns with others who target the same -native language. - -</P> -<P> -While adding the translated messages into the <TT>`<VAR>lang</VAR>.pox'</TT> -PO file, if you do not have GNU Emacs handy, you are on your own -for ensuring that your fully respect the PO file format, and quoting -conventions (see section <A HREF="gettext.html#SEC9">The Format of PO Files</A>). This is surely not an impossible task, -as this is the way many people handled PO files already for Uniforum or -Solaris. On the other hand, using PO mode in GNU Emacs, most details -of PO file format are taken care for you, but you have to acquire -some familiarity with PO mode itself. Besides main PO mode commands -(see section <A HREF="gettext.html#SEC10">Main Commands</A>), you should know how to move between entries -(see section <A HREF="gettext.html#SEC11">Entry Positioning</A>), and how to handle untranslated entries -(see section <A HREF="gettext.html#SEC24">Untranslated Entries</A>). - -</P> -<P> -If some common translations have already been saved into a compendium -PO file, translators may use PO mode for initializing untranslated -entries from the compendium, and also save selected translations into -the compendium, updating it (see section <A HREF="gettext.html#SEC21">Using Translation Compendiums</A>). Compendium files -are meant to be exchanged between members of a given translation team. - -</P> -<P> -Programs, or packages of programs, are dynamic in nature: users write -bug reports and suggestion for improvements, maintainers react by -modifying programs in various ways. The fact that a package has -already been internationalized should not make maintainers shy -of adding new strings, or modifying strings already translated. -They just do their job the best they can. For the GNU Translation -Project to work smoothly, it is important that maintainers do not -carry translation concerns on their already loaded shoulders, and that -translators be kept as free as possible of programmatic concerns. - -</P> -<P> -The only concern maintainers should have is carefully marking new -strings are translatable, when they should be, and do not otherwise -worry about them being translated, as this will come in proper time. -Consequently, when programs and their strings are adjusted in various -ways by maintainers, and for matters usually unrelated to translation, -<CODE>xgettext</CODE> would construct <TT>`<VAR>package</VAR>.pot'</TT> files which are -evolving over time, so the translations carried by <TT>`<VAR>lang</VAR>.po'</TT> -are slowly fading out of date. - -</P> -<P> -It is important for translators (and even maintainers) to understand -that package translation is a continuous process in the lifetime of a -package, and not something which is done once and for all at the start. -After an initial burst of translation activity for a given package, -interventions are needed once in a while, because here and there, -translated entries become obsolete, and new untranslated entries -appear, needing translation. - -</P> -<P> -The <CODE>tupdate</CODE> program has the purpose of refreshing an already -existing <TT>`<VAR>lang</VAR>.po'</TT> file, by comparing it with a newer -<TT>`<VAR>package</VAR>.pot'</TT> template file, extracted by <CODE>xgettext</CODE> -out of recent C sources. The refreshing operation adjusts all -references to C source locations for strings, since these strings -move as programs are modified. Also, <CODE>tupdate</CODE> comments out as -obsolete, in <TT>`<VAR>lang</VAR>.pox'</TT>, those already translated entries -which are no longer used in the program sources (see section <A HREF="gettext.html#SEC25">Obsolete Entries</A>. It finally discovers new strings and insert them in -the resulting PO file as untranslated entries (see section <A HREF="gettext.html#SEC24">Untranslated Entries</A>. See section <A HREF="gettext.html#SEC23">Invoking the <CODE>tupdate</CODE> Program</A>, for more information about what -<CODE>tupdate</CODE> really does. - -</P> -<P> -Whatever route or means taken, the goal is obtaining an updated -<TT>`<VAR>lang</VAR>.pox'</TT> file offering translations for all strings. -When this is properly achieved, this file <TT>`<VAR>lang</VAR>.pox'</TT> may -take the place of the previous official <TT>`<VAR>lang</VAR>.po'</TT> file. - -</P> -<P> -The time mobility, or fluidity of PO files, is an integral part of -the translation game, and should be well understood, and accepted. -People resisting it will have a hard time participating in the GNU -Translation Project, or will give a hard time to other participants! -In particular, maintainers should relax and include all available PO -files in their distributions, even if these have not recently been -updated, without banging or otherwise trying to exert pressure on the -translator teams to get the job done. The pressure should rather -come from the community of users speaking a particular language, -and maintainers should consider themselves fairly relieved of any -concern about the adequacy of translation files. On the other hand, -translators should reasonably try updating the PO files they are -responsible for, while the package is undergoing pretest, prior to -an official distribution. - -</P> -<P> -Once the PO file is complete and dependable, the <CODE>msgfmt</CODE> program -is used for turning the PO file into a machine-oriented format, which -may yield efficient retrieval of translations by the programs of the -package, whenever needed at runtime (see section <A HREF="gettext.html#SEC31">The Format of GNU MO Files</A>). See section <A HREF="gettext.html#SEC30">Invoking the <CODE>msgfmt</CODE> Program</A>, for more information about all modalities of execution -for the <CODE>msgfmt</CODE> program. - -</P> -<P> -Finally, the modified and marked C sources are compiled and linked -with the GNU <CODE>gettext</CODE> library, usually through the operation of -<CODE>make</CODE>, given a suitable <TT>`Makefile'</TT> exists for the project, -and the resulting executable is installed somewhere users will find it. -The MO files themselves should also be properly installed. Given the -appropriate environment variables are set (see section <A HREF="gettext.html#SEC35">Magic for End Users</A>), the -program should localize itself automatically, whenever it executes. - -</P> -<P> -The remaining of this manual has the purpose of deepening the various -steps outlined in this section. - -</P> - - -<H1><A NAME="SEC7" HREF="gettext_toc.html#TOC7">PO Files and PO Mode Basics</A></H1> - -<P> -The GNU <CODE>gettext</CODE> toolset helps programmers and translators -at producing, updating and using translation files, mainly those -PO files which are textual, editable files. This chapter insists -on the format of PO files, and contains a PO mode starter. PO mode -description is spread over this manual instead of being concentrated -in one place, this chapter presents only the basics of PO mode. - -</P> - - - -<H2><A NAME="SEC8" HREF="gettext_toc.html#TOC8">Completing GNU <CODE>gettext</CODE> Installation</A></H2> - -<P> -Once you have received, unpacked, configured and compiled the GNU -<CODE>gettext</CODE> distribution, the <SAMP>`make install'</SAMP> command puts in -place the programs <CODE>xgettext</CODE>, <CODE>msgfmt</CODE>, <CODE>gettext</CODE>, and -<CODE>tupdate</CODE>, as well as their available message catalogs. For -completing a comfortable installation, you might also want to make the -PO mode available to your GNU Emacs users. - -</P> -<P> -To finish the installation of the PO mode, you might want modify your -file <TT>`.emacs'</TT>, once and for all, so it contains a few lines looking -like: - -</P> - -<PRE> -(setq auto-mode-alist - (cons '("\\.pox?\\'" . po-mode) auto-mode-alist)) -(autoload 'po-mode "po-mode") -</PRE> - -<P> -Later, whenever you edit some <TT>`.po'</TT> or <TT>`.pox'</TT> file, Emacs -loads <TT>`po-mode.elc'</TT> (or <TT>`po-mode.el'</TT>) as needed, and -automatically activate PO mode commands for the associated buffer. -The string <EM>PO</EM> appears in the mode line for any buffer for -which PO mode is active. Many PO files may be active at once in a -single Emacs session. - -</P> - - -<H2><A NAME="SEC9" HREF="gettext_toc.html#TOC9">The Format of PO Files</A></H2> - -<P> -A PO file is made up of many entries, each entry holding the relation -between an original untranslated string and its corresponding -translation. All entries in a given PO file usually pertain -to a single project, and all translations are expressed in a single -target language. One PO file <STRONG>entry</STRONG> has the following schematic -structure: - -</P> - -<PRE> -<VAR>white-space</VAR> -# <VAR>translator-comments</VAR> -#. <VAR>automatic-comments</VAR> -#: <VAR>reference</VAR>... -msgid <VAR>untranslated-string</VAR> -msgstr <VAR>translated-string</VAR> -</PRE> - -<P> -The general structure of a PO file should be well understood by -the translator. When using PO mode, very little has to be known -about the format details, as PO mode takes care of them for her. - -</P> -<P> -Entries begin with some optional white space. Usually, when generated -through GNU <CODE>gettext</CODE> tools, there is exactly one blank line -between entries. Then comments follow, on lines all starting with the -character <KBD>#</KBD>. There are two kinds of comments: those which have -some white space immediately following the <KBD>#</KBD>, which comments are -created and maintained exclusively by the translator, and those which -have some non-white character just after the <KBD>#</KBD>, which comments -are created and maintained automatically by GNU <CODE>gettext</CODE> tools. -All comments, of any kind, are optional. - -</P> -<P> -After white space and comments, entries show two strings, giving -first the untranslated string as it appears in the original program -sources, and then, the translation of this string. The original -string is introduced by the keyword <CODE>msgid</CODE>, and the translation, -by <CODE>msgstr</CODE>. The two strings, untranslated and translated, -are quoted in various ways in the PO file, using <KBD>"</KBD> -delimiters and <KBD>\</KBD> escapes, but the translator does not really -have to pay attention to the precise quoting format, as PO mode fully -intend to take care of quoting for her. - -</P> -<P> -The <CODE>msgid</CODE> strings, as well as automatic comments, are produced -and managed by other GNU <CODE>gettext</CODE> tools, and PO mode does not -provide means for the translator to alter these. The most she can -do is merely deleting them, and only by deleting the whole entry. -On the other hand, the <CODE>msgstr</CODE> string, as well as translator -comments, are really meant for the translator, and PO mode gives her -the full control she needs. - -</P> -<P> -It happens that some lines, usually whitespace or comments, follow the -very last entry of a PO file. Such lines are not part of any entry, -and PO mode is unable to take action on those lines. By using the -PO mode function <KBD>M-x po-normalize</KBD>, the translator may get -rid of those spurious lines. See section <A HREF="gettext.html#SEC12">Normalizing Strings in Entries</A>. - -</P> -<P> -The remainder of this section may be safely skipped for those using -PO mode, yet it may be interesting for everybody to have a better -idea of the precise format of a PO file. On the other hand, those -not having GNU Emacs handy should carefully continue reading on. - -</P> -<P> -Each of <VAR>untranslated-string</VAR> and <VAR>translated-string</VAR> respects -the C syntax for a character string, including the surrounding quotes -and imbedded backslashed escape sequences. When the time comes -to write multi-line strings, one should not use escaped newlines. -Instead, a closing quote should follow the last character on the -line to be continued, and an opening quote should resume the string -at the beginning of the following PO file line. For example: - -</P> - -<PRE> -msgid "" -"Here is an example of how one might continue a very long string\n" -"for the common case the string represents multi-line output.\n" -</PRE> - -<P> -In this example, the empty string is used on the first line, for -allowing the better alignment of the <KBD>H</KBD> from the word <SAMP>`Here'</SAMP> -over the <KBD>f</KBD> from the word <SAMP>`for'</SAMP>. In this example, the -<CODE>msgid</CODE> keyword is followed by three strings, which are meant -to be concatenated. Concatenating the empty string does not change -the resulting overall string, but it is a way for us to comply with -the necessity of <CODE>msgid</CODE> to be followed by a string on the same -line, while keeping the multi-line presentation left-justified, as -we find this to be cleaner disposition. The empty string could have -been omitted, but only if the string starting with <SAMP>`Here'</SAMP> was -promoted on the first line, right after <CODE>msgid</CODE>.<A NAME="DOCF1" HREF="gettext_foot.html#FOOT1">(1)</A> It was not really necessary -either to switch between the two last quoted strings immediately after -the newline <SAMP>`\n'</SAMP>, the switch could have occurred after <EM>any</EM> -other character, we just did it this way because it is neater. - -</P> -<P> -One should carefully distinguish between end of lines marked as -<SAMP>`\n'</SAMP> <EM>inside</EM> quotes, which are part of the represented -string, and end of lines in the PO file itself, outside string quotes, -which have no incidence on the represented string. - -</P> -<P> -Outside strings, white lines and comments may be used freely. -Comments start at the beginning of a line with <SAMP>`#'</SAMP> and extend -until the end of the PO file line. Comments written by translators -should have the initial <SAMP>`#'</SAMP> immediately followed by some white -space. If the <SAMP>`#'</SAMP> is not immediately followed by white space, -this comment is most likely generated and managed by specialized GNU -tools, and might disappear or be replaced unexpectandly when the PO -file is given to <CODE>tupdate</CODE>. - -</P> - - -<H2><A NAME="SEC10" HREF="gettext_toc.html#TOC10">Main Commands</A></H2> - -<P> -When Emacs finds a PO file in a window, PO mode is activated -for that window. This puts the window read-only and establishes a -po-mode-map, which is a genuine Emacs mode, in that way that it is -not derived from text mode in any way. - -</P> -<P> -The main PO commands are those who do not fit in the other categories in -subsequent sections, they allow for quitting PO mode or managing windows -in special ways. - -</P> -<DL COMPACT> - -<DT><KBD>u</KBD> -<DD> -Undo last modification to the PO file. - -<DT><KBD>q</KBD> -<DD> -Quit processing and save the PO file. - -<DT><KBD>o</KBD> -<DD> -Temporary leave the PO file window. - -<DT><KBD>h</KBD> -<DD> -Show help about PO mode. - -<DT><KBD>=</KBD> -<DD> -Give some PO file statistics. - -<DT><KBD>v</KBD> -<DD> -Batch validate the format of the whole PO file. - -</DL> - -<P> -The command <KBD>u</KBD> (<CODE>po-undo</CODE>) interfaces to the GNU Emacs -<EM>undo</EM> facility. See section `Undoing Changes' in <CITE>The Emacs Editor</CITE>. Each time <KBD>u</KBD> is typed, modifications the translator -did to the PO file are undone a little more. For the purpose of -undoing, each PO mode command is atomic. This is especially true for -the <KBD><KBD>RET</KBD></KBD> command: the whole edition made by using a single -use of this command is undone at once, even if the edition itself -implied several actions. However, while in the editing window, one -can undo the edition work quite parsimoniously. - -</P> -<P> -The command <KBD>q</KBD> (<CODE>po-quit</CODE>) is used when the translator is -done with the PO file. If the file has been modified, it is saved -on disk first. However, prior to all this, the command checks if -some untranslated message remains in the PO file and, if yes, the -translator is asked if she really wants to leave working with this -PO file. This is the preferred way of getting rid of an Emacs PO -file buffer. Merely killing it through the usual command <KBD>C-x -k</KBD> (<CODE>kill-buffer</CODE>), say, has the unnice effect of leaving a PO -internal work buffer behind. - -</P> -<P> -The command <KBD>o</KBD> (<CODE>po-other-window</CODE>) is another, softer -way, to leave PO mode, temporarily. It just moves the cursor in -some other Emacs window, and pops one if necessary. For example, if -the translator just got PO mode to show some source context in some -other, she might discover some apparent bug in the program source -that needs correction. This command allows the translator to change -sex, become a programmer, and have the cursor right into the window -containing the program she (or rather <EM>he</EM>) wants to modify. -By later getting the cursor back in the PO file window, or by -asking Emacs to edit this file once again, PO mode is then recovered. - -</P> -<P> -The command <KBD>h</KBD> (<CODE>po-help</CODE>) displays a summary of all -available PO mode commands. The translator should then type any -character to resume normal PO mode operations. The command <KBD>?</KBD> -has the same effect as <KBD>h</KBD>. - -</P> -<P> -The command <KBD>=</KBD> (<CODE>po-statistics</CODE>) computes the total number -of entries in the PO file, the ordinal of the current entry -(counted from 1), the number of untranslated entries, the number of -obsolete entries, and displays all these numbers. - -</P> -<P> -The command <KBD>v</KBD> (<CODE>po-validate</CODE>) launches <CODE>msgfmt</CODE> in -verbose mode over the current PO file. This command first offers -to save the current PO file on disk. The <CODE>msgfmt</CODE> tool, from -GNU <CODE>gettext</CODE>, has the purpose of creating an MO file out of a -PO file, and PO mode uses the features of this program for checking -the overall format of a PO file, as well as all individual entries. - -</P> -<P> -The program <CODE>msgfmt</CODE> runs asynchronously with Emacs, so -the translator regains control immediately while her PO file -is being studied. Error output is collected in the GNU Emacs -<SAMP>`*compilation*'</SAMP> buffer, displayed in another window. The regular -GNU Emacs command <KBD>C-x`</KBD> (<CODE>next-error</CODE>), as well as other -usual compile commands, allow the translator to reposition quickly to -the offending parts of the PO file. Once the cursor on the line in -error, the translator may decide for any PO mode action which would -help correcting the error. - -</P> - - -<H2><A NAME="SEC11" HREF="gettext_toc.html#TOC11">Entry Positioning</A></H2> - -<P> -The cursor in a PO file window is almost always part of -an entry. The only exceptions are the special case when the cursor -is after the last entry in the file, or when the PO file is -empty. The entry where the cursor is found to be is said to be the -current entry. Many PO mode commands operate on the current entry, -so moving the cursor does more than allowing the translator to browse -the PO file, this also selects on which entry commands operate. - -</P> -<P> -Some PO mode commands alter the position of the cursor in a specialized -way. A few of those special purpose positioning are described here, -the others are described in following sections. - -</P> -<DL COMPACT> - -<DT><KBD>.</KBD> -<DD> -Redisplay the current entry. - -<DT><KBD>n</KBD> -<DD> -<DT><KBD>SPC</KBD> -<DD> -Select the entry after the current one. - -<DT><KBD>p</KBD> -<DD> -<DT><KBD>DEL</KBD> -<DD> -Select the entry before the current one. - -<DT><KBD><</KBD> -<DD> -Select the first entry in the PO file. - -<DT><KBD>></KBD> -<DD> -Select the last entry in the PO file. - -<DT><KBD>m</KBD> -<DD> -Record the location of the current entry for later use. - -<DT><KBD>l</KBD> -<DD> -Return to a previously saved entry location. - -<DT><KBD>x</KBD> -<DD> -Exchange the current entry location with the previously saved one. - -</DL> - -<P> -Any GNU Emacs command able to reposition the cursor may be used -to select the current entry in PO mode, including commands which -move by characters, lines, paragraphs, screens or pages, and search -commands. However, there is a kind of standard way to display the -current entry in PO mode, which usual GNU Emacs commands moving -the cursor do not especially try to enforce. The command <KBD>.</KBD> -(<CODE>po-current-entry</CODE>) has the sole purpose of redisplaying the -current entry properly, after the current entry has been changed by -means external to PO mode, or the Emacs screen otherwise altered. - -</P> -<P> -It is yet to decide if PO mode would help the translator, or otherwise -irritate her, by forcing a more fixed window disposition while she -is doing her work. We originally had quite precise ideas about -how windows should behave, but on the other hand, anyone used to -GNU Emacs is often happy to keep full control. Maybe a fixed window -disposition might be offered as a PO mode option that the translator -might activate or deactivate at will, so it could be offered on an -experimental basis. If nobody feels a real need for using it, or -a compulsion for writing it, we might as well drop this whole idea. -The incentive for doing it should come from translators rather than -programmers, as opinions from an experienced translator are surely -more worth to me than opinions from programmers <EM>thinking</EM> about -how <EM>others</EM> should do translation. - -</P> -<P> -The commands <KBD>n</KBD> (<CODE>po-next-entry</CODE>) and <KBD>p</KBD> -(<CODE>po-previous-entry</CODE>) move the cursor the entry following, -or preceding, the current one. If <KBD>n</KBD> is given while the -cursor is on the last entry of the PO file, or if <KBD>p</KBD> -is given while the cursor is on the first entry, no move is done. -<KBD><KBD>SPC</KBD></KBD> and <KBD><KBD>DEL</KBD></KBD> are alternate keys for <KBD>n</KBD> and -<KBD>p</KBD>, respectively. - -</P> -<P> -The commands <KBD><</KBD> (<CODE>po-first-entry</CODE>) and <KBD>></KBD> -(<CODE>po-last-entry</CODE>) move the cursor to the first entry, or last -entry, of the PO file. When the cursor is located past the last -entry in a PO file, most PO mode commands will return an error saying -<SAMP>`After last entry'</SAMP>. However, the commands <KBD><</KBD> and <KBD>></KBD> -have the special property of being able to work even when the cursor -is not into some PO file entry, and you may use them for nicely -correcting this situation. But even these commands will fail on a -truly empty PO file. There are development plans for PO mode for it -to interactively fill an empty PO file from sources. See section <A HREF="gettext.html#SEC16">Marking Translatable Strings</A>. - -</P> -<P> -The translator may decide, before working at the translation of -a particular entry, that she needs browsing the remainder of the -PO file, maybe for finding the terminology or phraseology used -in related entries. She can of course use the standard Emacs idioms -for saving the current cursor location in some register, and use that -register for getting back, or else, to use the location ring. - -</P> -<P> -PO mode offers another approach, by which cursor locations may be saved -onto a special stack. The command <KBD>m</KBD> (<CODE>po-push-location</CODE>) -merely adds the location of current entry to the stack, pushing -the already saved locations under the new one. The command -<KBD>l</KBD> (<CODE>po-pop-location</CODE>) consumes the top stack element and -reposition the cursor to the entry associated with that top element. -This position is then lost, for the next <KBD>l</KBD> will move the cursor -to the previously saved location, and so on until locations remain -on the stack. - -</P> -<P> -If the translator wants the position to be kept on the location stack, -maybe for taking a mere look at the entry associated with the top -element, then go elsewhere with the intent of getting back later, she -ought to use <KBD>m</KBD> immediately after <KBD>l</KBD>. - -</P> -<P> -The command <KBD>x</KBD> (<CODE>po-exchange-location</CODE>) simultaneously -reposition the cursor to the entry associated with the top element of -the stack of saved locations, and replace that top element with the -location of the current entry before the move. Consequently, repeating -the <KBD>x</KBD> command toggles alternatively between two entries. -For achieving this, the translator will position the cursor on the -first entry, use <KBD>m</KBD>, then position to the second entry, and -merely use <KBD>x</KBD> for making the switch. - -</P> - - -<H2><A NAME="SEC12" HREF="gettext_toc.html#TOC12">Normalizing Strings in Entries</A></H2> - -<P> -There are many different ways for encoding a particular string into a -PO file entry, because there are so many different ways to split and -quote multi-line strings, and even, to represent special characters -by backslahsed escaped sequences. Some features of PO mode rely on -the ability for PO mode to scan an already existing PO file for a -particular string encoded into the <CODE>msgid</CODE> field of some entry. -Even if PO mode has internally all the built-in machinery for -implementing this recognition easily, doing it fast is technically -difficult. For facilitating a solution to this efficiency problem, -we decided for a canonical representation for strings. - -</P> -<P> -A conventional representation of strings in a PO file is currently -under discussion, and PO mode experiments a canonical representation. -Having both <CODE>xgettext</CODE> and PO mode converging towards a uniform -way of representing equivalent strings would be useful, as the internal -normalization needed by PO mode could be automatically satisfied -when using <CODE>xgettext</CODE> from GNU <CODE>gettext</CODE>. An explicit -PO mode normalization should then be only necessary for PO files -imported from elsewhere, or for when the convention itself evolves. - -</P> -<P> -So, for achieving normalization of at least the strings of a given -PO file needing a canonical representation, the following PO mode -command is available: - -</P> -<DL COMPACT> - -<DT><KBD>M-x po-normalize</KBD> -<DD> -Tidy the whole PO file by making entries more uniform. - -</DL> - -<P> -The special command <KBD>M-x po-normalize</KBD>, which has no associate -keys, revises all entries, ensuring that strings of both original -and translated entries use uniform internal quoting in the PO file. -It also removes any crumb after the last entry. This command may be -useful for PO files freshly imported from elsewhere, or if we ever -improve on the canonical quoting format we use. This canonical format -is not only meant for getting cleaner PO files, but also for greatly -speeding up <CODE>msgid</CODE> string lookup for some other PO mode commands. - -</P> -<P> -<KBD>M-x po-normalize</KBD> presently makes three passes over the entries. -The first implements heuristics for converting PO files for GNU -<CODE>gettext</CODE> 0.6 and earlier, in which <CODE>msgid</CODE> and <CODE>msgstr</CODE> -fields were using K&R style C string syntax for multi-line strings. -These heuristics may fail for comments not related to obsolete -entries and ending with a backslash; they also depend on subsequent -passes for finalizing the proper commenting of continued lines for -obsolete entries. This first pass might disappear once all oldish PO -files would have been adjusted. The second and third pass normalize -all <CODE>msgid</CODE> and <CODE>msgstr</CODE> strings respectively. They also -clean out those trailing backslashes used by XView's <CODE>msgfmt</CODE> -for continued lines. - -</P> -<P> -Having such an explicit normalizing command allows for importing PO -files from other sources, but also eases the evolution of the current -convention, evolution driven mostly by aesthetic concerns, as of now. -It is all easy to make suggested adjustments at a later time, as the -normalizing command and eventually, other GNU <CODE>gettext</CODE> tools -should greatly automate conformance. A description of the canonical -string format is given below, for the particular benefit of those not -having GNU Emacs handy, and who would nevertheless want to handcraft -their PO files in nice ways. - -</P> -<P> -Right now, in PO mode, strings are single line or multi-line. A string -goes multi-line if and only if it has <EM>embedded</EM> newlines, that -is, if it matches <SAMP>`[^\n]\n+[^\n]'</SAMP>. So, we would have: - -</P> - -<PRE> -msgstr "\n\nHello, world!\n\n\n" -</PRE> - -<P> -but, replacing the space by a newline, this becomes: - -</P> - -<PRE> -msgstr "" -"\n" -"\n" -"Hello,\n" -"world!\n" -"\n" -"\n" -</PRE> - -<P> -We are deliberately using a caricatural example, here, to make the -point clearer. Usually, multi-lines are not that bad looking. -It is probable that we will implement the following suggestion. -We might lump together all initial newlines into the empty string, -and also all newlines introducing empty lines (that is, for <VAR>n</VAR> -> 1, the <VAR>n</VAR>-1'th last newlines would go together on a separate -string), so making the previous example appear: - -</P> - -<PRE> -msgstr "\n\n" -"Hello,\n" -"world!\n" -"\n\n" -</PRE> - -<P> -There are a few yet undecided little points about string normalization, -to be documented in this manual, once these questions settle. - -</P> - - -<H1><A NAME="SEC13" HREF="gettext_toc.html#TOC13">Preparing Program Sources</A></H1> - -<P> -For the programmer, changes to the C source code fall into three -categories. First, you have to make the localization functions -known to all modules needing message translation. Second, you should -properly trigger the operation of GNU <CODE>gettext</CODE> when the program -initializes, usually from the <CODE>main</CODE> function. Last, you should -identify and especially mark all constant strings in your program -needing translation. - -</P> -<P> -Presuming that your set of programs, or package, has been adjusted -so all needed GNU <CODE>gettext</CODE> files are available, and your -<TT>`Makefile'</TT> files are adjusted (see section <A HREF="gettext.html#SEC65">The Maintainer's View</A>), each C module -having translated C strings should contain the line: - -</P> - -<PRE> -#include <libintl.h> -</PRE> - -<P> -The remaining changes to your C sources are discussed in the further -sections of this chapter. - -</P> - - - -<H2><A NAME="SEC14" HREF="gettext_toc.html#TOC14">Triggering <CODE>gettext</CODE> Operations</A></H2> - -<P> -The initialization of locale data should be done with more or less -the same code in every program, as demonstrated below: - -</P> - -<PRE> -int -main (argc, argv) - int argc; - char argv; -{ - ... - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); - ... -} -</PRE> - -<P> -<VAR>PACKAGE</VAR> and <VAR>LOCALEDIR</VAR> should be provided either by -<TT>`config.h'</TT> or by the Makefile. For now consult the <CODE>gettext</CODE> -sources for more information. - -</P> -<P> -The use of <CODE>LC_ALL</CODE> might not be appropriate for you. -<CODE>LC_ALL</CODE> includes all locale categories and especially -<CODE>LC_CTYPE</CODE>. This later category is responsible for determining -character classes with the <CODE>isalnum</CODE> etc. functions from -<TT>`ctype.h'</TT> which could especially for programs, which process some -kind of input language, be wrong. For example this would mean that a -source code using the (cedille character) is runnable in -France but not in the U.S. - -</P> -<P> -So it is sometimes necessary to replace the <CODE>LC_ALL</CODE> line in the -code above by a sequence of <CODE>setlocale</CODE> lines - -</P> - -<PRE> -{ - ... - setlocale (LC_TIME, ""); - setlocale (LC_MESSAGES, ""); - ... -} -</PRE> - -<P> -or to switch for and back to the character class in question. - -</P> - - -<H2><A NAME="SEC15" HREF="gettext_toc.html#TOC15">How Marks Appears in Sources</A></H2> - -<P> -The C sources should mark all strings requiring translation. Marking -is done in such a way that each translatable string appears to be -the sole argument of some function or preprocessor macro. There are -only a few such possible functions or macros meant for translation, -and their names are said to be marking keywords. The marking is -attached to strings themselves, rather than to what we do with them. -This approach has more uses. A blatant example is an error message -produced by formatting. The format string needs translation, as -well as some strings inserted through some <SAMP>`%s'</SAMP> specification -in the format, while the result from <CODE>sprintf</CODE> may have so many -different instances that it is unpractical to list them all in some -<SAMP>`error_string_out()'</SAMP> routine, say. - -</P> -<P> -This marking operation has two goals. The first goal of marking -is for triggering the retrieval of the translation, at run time. -The keyword are possibly resolved into a routine able to dynamically -return the proper translation, as far as possible or wanted, for the -argument string. Most localizable strings are found into executable -positions, that is, affected to variables or given as parameter to -functions. But this is not universal usage, and some translatable -strings appear in structured initializations. See section <A HREF="gettext.html#SEC17">Special Cases of Translatable Strings</A>. - -</P> -<P> -The second goal of the marking operation is to help <CODE>xgettext</CODE> -at properly extracting all translatable strings when it scans a set -of program sources and produces PO file templates. - -</P> -<P> -The canonical keyword for marking translatable strings is -<SAMP>`gettext'</SAMP>, it gave its name to the whole GNU <CODE>gettext</CODE> -package. For packages making only light use of the <SAMP>`gettext'</SAMP> -keyword, macro or function, it is easily used <EM>as is</EM>. However, -for packages using the <CODE>gettext</CODE> interface more heavily, it -is usually more convenient giving the main keyword a shorter, less -obtrusive name. Indeed, the keyword might appear on a lot of strings -all over the package, and programmers usually do not want nor need -that their program sources remind them loud, all the time, that they -are internationalized. Further, a long keyword has the disadvantage -of using more horizontal space, forcing more indentation work on -sources for those trying to keep them within 79 or 80 columns. - -</P> -<P> -Many GNU packages use <SAMP>`_'</SAMP> (a simple underline) as a keyword, -and write <SAMP>`_("Translatable string")'</SAMP> instead of <SAMP>`gettext -("Translatable string")'</SAMP>. Further, the usual GNU coding rule -wanting that there is a space between the keyword and the opening -parenthesis is relaxed, in practice, for this particular usage. -So, the textual overhead per translatable string is reduced to -only three characters: the underline and the two parentheses. -However, even if GNU <CODE>gettext</CODE> uses this convention internally, -it does not offer it officially. The real, genuine keyword is truly -<SAMP>`gettext'</SAMP> indeed. It is fairly easy for those wanting to use -<SAMP>`_'</SAMP> instead of <SAMP>`gettext'</SAMP> to declare: - -</P> - -<PRE> -#include <libintl.h> -#define _(String) gettext (String) -</PRE> - -<P> -instead of merely using <SAMP>`#include <libintl.h>'</SAMP>. - -</P> -<P> -Later on, the maintenance is relatively easy. If, as a programmer, -you add or modify a string, you will have to ask yourself if the -new or altered string requires translation, and include it within -<SAMP>`_()'</SAMP> if you think it should be translated. <SAMP>`"%s: %d"'</SAMP> is -an example of string <EM>not</EM> requiring translation! - -</P> - - -<H2><A NAME="SEC16" HREF="gettext_toc.html#TOC16">Marking Translatable Strings</A></H2> - -<P> -In PO mode, one set of features is meant more for the programmer than -for the translator, and allows him to interactively mark which strings, -in a set of program sources, are translatable, and which are not. -Even if it is a fairly easy job for a programmer to find and mark -such strings by other means, using any editor of his choice, PO mode -makes this work more comfortable. Further, this gives translators -who feel a little like programmers, or programmers who feel a little -like translators, a tool letting them work at marking translatable -strings in the program sources, while simultaneously producing a set of -translation in some language, for the package being internationalized. - -</P> -<P> -The set of program sources, aimed by the PO mode commands describe -here, should have an Emacs tags table constructed for your project, -prior to using these PO file commands. This is easy to do. In any -shell window, change the directory to the root of your project, then -execute a command resembling: - -</P> - -<PRE> -etags src/*.[hc] lib/*.[hc] -</PRE> - -<P> -presuming here you want to process all <TT>`.h'</TT> and <TT>`.c'</TT> files -from the <TT>`src/'</TT> and <TT>`lib/'</TT> directories. This command will -explore all said files and create a <TT>`TAGS'</TT> file in your root -directory, somewhat summarizing the contents using a special file -format Emacs can understand. - -</P> -<P> -For official GNU packages which follow the GNU coding standard there is -a make goal <CODE>tags</CODE> or <CODE>TAGS</CODE> which construct the tag files in -all directories and for all files containing source code. - -</P> -<P> -Once your <TT>`TAGS'</TT> file is ready, the following commands assist -the programmer at marking translatable strings in his set of sources. -But these commands are necessarily driven from within a PO file -window, and it is likely that you do not even have such a PO file yet. -This is not a problem at all, as you may safely open a new, empty PO -file, mainly for using these commands. This empty PO file will slowly -fill in while you mark strings as translatable in your program sources. - -</P> -<DL COMPACT> - -<DT><KBD>,</KBD> -<DD> -Search through program sources for a string which looks like a -candidate for translation. - -<DT><KBD>M-,</KBD> -<DD> -Mark the last string found with <SAMP>`_()'</SAMP>. - -<DT><KBD>M-.</KBD> -<DD> -Mark the last string found with a keyword taken from a set of possible -keywords. This command with a prefix allows some management of these -keywords. - -</DL> - -<P> -The <KBD>,</KBD> (<CODE>po-tags-search</CODE>) command search for the next -occurrence of a string which looks like a possible candidate for -translation, and displays the program source in another Emacs window, -positioned in such a way that the string is near the top of this other -window. If the string is to big to fit whole in this window, it is -rather positioned so only its end is shown. In any case, the cursor -is left in the PO file window. If the shown string would be better -presented differently in different native languages, you may mark it -using <KBD>M-,</KBD> or <KBD>M-.</KBD>. Otherwise, you might rather ignore it -and skip to the next string by merely repeating the <KBD>,</KBD> command. - -</P> -<P> -A string is a good candidate for translation if it contains a sequence -of three or more letters. A string containing at most two letters in -a row will be considered as a candidate if it has more letters than -non-letters. The command disregards strings containing no letters, -or isolated letters only. It also disregards strings within comments, -or strings already marked with some keyword PO mode knows (see below). - -</P> -<P> -If you have never told Emacs about some <TT>`TAGS'</TT> file to use, the -command will request that you specify one from the minibuffer, the -first time you use the command. You may later change your <TT>`TAGS'</TT> -file by using the regular Emacs command <KBD>M-x visit-tags-table</KBD>, -which will ask you to name the precise <TT>`TAGS'</TT> file you want -to use. See section `Tag Tables' in <CITE>The Emacs Editor</CITE>. - -</P> -<P> -Each time you use the <KBD>,</KBD> command, the search resumes where it was -left over by the previous search, and goes through all program sources, -obeying the <TT>`TAGS'</TT> file, until all sources have been processed. -However, by giving a prefix argument to the command (<KBD>C-u -,)</KBD>, you may request that the search be restarted all over again -from the first program source; but in this case, strings that you -recently marked as translatable will be automatically skipped. - -</P> -<P> -Using this <KBD>,</KBD> command does not prevent using of other regular -Emacs tags commands. For example, regular <CODE>tags-search</CODE> or -<CODE>tags-query-replace</CODE> commands may be used without disrupting the -independent <KBD>,</KBD> search sequence. However, as implemented, the -<EM>initial</EM> <KBD>,</KBD> command (or the <KBD>,</KBD> command is used with a -prefix) might also reinitialize the regular Emacs tags searching to the -first tags file, this reinitialization might be considered spurious. - -</P> -<P> -The <KBD>M-,</KBD> (<CODE>po-mark-translatable</CODE>) command will mark the -recently found string with the <SAMP>`_'</SAMP> keyword. The <KBD>M-.</KBD> -(<CODE>po-select-mark-and-mark</CODE>) command will request that you type -one keyword from the minibuffer and use that keyword for marking -the string. Both commands will automatically create a new PO file -untranslated entry for the string being marked, and make it the -current entry (making it easy for you to immediately proceed to its -translation, if you feel like doing it right away). It is possible -that the modifications made to the program source by <KBD>M-,</KBD> or -<KBD>M-.</KBD> render some source line longer than 80 columns, forcing you -to break and re-indent this line differently. You may use the <KBD>o</KBD> -command from PO mode, or any other window changing command from -GNU Emacs, to break out into the program source window, and do any -needed adjustments. You will have to use some regular Emacs command -to return the cursor to the PO file window, if you want commanding -<KBD>,</KBD> for the next string, say. - -</P> -<P> -The <KBD>M-.</KBD> command has a few built-in speedups, so you do not -have to explicitly type all keywords all the time. The first such -speedup is that you are presented with a <EM>preferred</EM> keyword, -which you may accept by merely typing <KBD><KBD>RET</KBD></KBD> at the prompt. -The second speedup is that you may type any non-ambiguous prefix of the -keyword you really mean, and the command will complete it automatically -for you. This also means that PO mode has to <EM>know</EM> all -your possible keywords, and that it will not accept mistyped keywords. - -</P> -<P> -If you reply <KBD>?</KBD> to the keyword request, the command gives a -list of all known keywords, from which you may choose. When the -command is prefixed by an argument (<KBD>C-u M-.</KBD>), it inhibits -updating any program source or PO file buffer, and does some simple -keyword management instead. In this case, the command asks for a -keyword, written in full, which becomes a new allowed keyword for -later <KBD>M-.</KBD> commands. Moreover, this new keyword automatically -becomes the <EM>preferred</EM> keyword for later commands. By typing -an already known keyword in response to <KBD>C-u M-.</KBD>, one merely -changes the <EM>preferred</EM> keyword and does nothing more. - -</P> -<P> -All keywords known for <KBD>M-.</KBD> are recognized by the <KBD>,</KBD> command -when scanning for strings, and strings already marked by any of those -known keywords are automatically skipped. If many PO files are opened -simultaneously, each one has its own independent set of known keywords. -There is no provision in PO mode, currently, for deleting a known -keyword, you have to quit the file (maybe using <KBD>q</KBD>) and reopen -it afresh. When a PO file is newly brought up in an Emacs window, only -<SAMP>`gettext'</SAMP> and <SAMP>`_'</SAMP> are known as keywords, and <SAMP>`gettext'</SAMP> -is preferred for the <KBD>M-.</KBD> command. In fact, this is not useful to -prefer <SAMP>`_'</SAMP>, as this one is already built in the <KBD>M-,</KBD> command. - -</P> - - -<H2><A NAME="SEC17" HREF="gettext_toc.html#TOC17">Special Cases of Translatable Strings</A></H2> - -<P> -The attentive reader might now point out that it is not always possible -to mark translatable string with <CODE>gettext</CODE> or something like this. -Consider the following case: - -</P> - -<PRE> -{ - static const char *messages[] = { - "some very meaningful message", - "and another one" - }; - const char *string; - ... - string - = index > 1 ? "a default message" : messages[index]; - - fputs (string); - ... -} -</PRE> - -<P> -While it is no problem to mark the string <CODE>"a default message"</CODE> it -is not possible to mark the string initializers for <CODE>messages</CODE>. -What is to do? We have to fulfill two tasks. First we have to mark the -strings so that the <CODE>xgettext</CODE> program (see section <A HREF="gettext.html#SEC19">Invoking the <CODE>xgettext</CODE> Program</A>) -can find them, and second we have to translate the string at runtime -before printing them. - -</P> -<P> -The first task can be fulfilled by creating a new keyword, which names a -no-op. For the second we have to mark all access points to a string -from the array. So one solution can look like this: - -</P> - -<PRE> -#define gettext_noop(String) (String) - -{ - static const char *messages[] = { - gettext_noop ("some very meaningful message"), - gettext_noop ("and another one") - }; - const char *string; - ... - string - = index > 1 ? gettext ("a default message") : gettext (messages[index]); - - fputs (string); - ... -} -</PRE> - -<P> -Please convince yourself that the string which is written by -<CODE>fputs</CODE> is translated in any case. How to get <CODE>xgettext</CODE> know -the additional keyword <CODE>gettext_noop</CODE> is explained in section <A HREF="gettext.html#SEC19">Invoking the <CODE>xgettext</CODE> Program</A>. - -</P> -<P> -The above is of course not the only solution. You could also come along -with the following one: - -</P> - -<PRE> -#define gettext_noop(String) (String) - -{ - static const char *messages[] = { - gettext_noop ("some very meaningful message", - gettext_noop ("and another one") - }; - const char *string; - ... - string - = index > 1 ? gettext_noop ("a default message") : messages[index]; - - fputs (gettext (string)); - ... -} -</PRE> - -<P> -But this has some drawbacks. First the programmer has to take care that -he uses <CODE>gettext_noop</CODE> for the string <CODE>"a default message"</CODE>. -A use of <CODE>gettext</CODE> could have in rare cases unpredictable results. -The second reason is found in the internals of the GNU <CODE>gettext</CODE> -Library which will make this solution less efficient. - -</P> -<P> -One advantage is that you need not make control flow analysis to make -sure the output is really translated in any case. But this analysis is -generally not very difficult. If it should be in any situation you can -use this second method in this situation. - -</P> - - - -<H1><A NAME="SEC18" HREF="gettext_toc.html#TOC18">Making the Initial PO File</A></H1> - - - -<H2><A NAME="SEC19" HREF="gettext_toc.html#TOC19">Invoking the <CODE>xgettext</CODE> Program</A></H2> - - -<PRE> -xgettext [<VAR>option</VAR>] <VAR>inputfile</VAR> ... -</PRE> - -<DL COMPACT> - -<DT><SAMP>`-a'</SAMP> -<DD> -<DT><SAMP>`--extract-all'</SAMP> -<DD> -Extract all strings. - -<DT><SAMP>`-c [<VAR>tag</VAR>]'</SAMP> -<DD> -<DT><SAMP>`--add-comments[=<VAR>tag</VAR>]'</SAMP> -<DD> -Place comment block with <VAR>tag</VAR> (or those preceding keyword lines) -in output file. - -<DT><SAMP>`-C'</SAMP> -<DD> -<DT><SAMP>`--c++'</SAMP> -<DD> -Recognize C++ style comments. - -<DT><SAMP>`-d <VAR>name</VAR>'</SAMP> -<DD> -<DT><SAMP>`--default-domain=<VAR>name</VAR>'</SAMP> -<DD> -Use <TT>`<VAR>name</VAR>.po'</TT> for output (instead of <TT>`messages.po'</TT>). - -<DT><SAMP>`-D <VAR>directory</VAR>'</SAMP> -<DD> -<DT><SAMP>`--directory=<VAR>directory</VAR>'</SAMP> -<DD> -Change to <VAR>directory</VAR> before beginning to search and scan source -files. The resulting <TT>`.po'</TT> file will be written relative to the -original directory, though. - -<DT><SAMP>`-f <VAR>file</VAR>'</SAMP> -<DD> -<DT><SAMP>`--files-from=<VAR>file</VAR>'</SAMP> -<DD> -Read the names of the input files from <VAR>file</VAR> instead of getting -them from the command line. - -<DT><SAMP>`-h'</SAMP> -<DD> -<DT><SAMP>`--help'</SAMP> -<DD> -Display this help and exit. - -<DT><SAMP>`-I <VAR>list</VAR>'</SAMP> -<DD> -<DT><SAMP>`--input-path=<VAR>list</VAR>'</SAMP> -<DD> -List of directories searched for input files. - -<DT><SAMP>`-j'</SAMP> -<DD> -<DT><SAMP>`--join-existing'</SAMP> -<DD> -Join messages with existing file. - -<DT><SAMP>`-k <VAR>word</VAR>'</SAMP> -<DD> -<DT><SAMP>`--keyword[=<VAR>word</VAR>]'</SAMP> -<DD> -Additonal keyword to be looked for (without <VAR>word</VAR> means not to -use default keywords). - -The default keywords, which are always looked for if not explicitly -disabled, are <CODE>gettext</CODE>, <CODE>dgettext</CODE>, <CODE>dcgettext</CODE> and -<CODE>gettext_noop</CODE>. - -<DT><SAMP>`-m [<VAR>string</VAR>]'</SAMP> -<DD> -<DT><SAMP>`--msgstr-prefix[=<VAR>string</VAR>]'</SAMP> -<DD> -Use <VAR>string</VAR> or "" as prefix for msgstr entries. - -<DT><SAMP>`-M [<VAR>string</VAR>]'</SAMP> -<DD> -<DT><SAMP>`--msgstr-suffix[=<VAR>string</VAR>]'</SAMP> -<DD> -Use <VAR>string</VAR> or "" as suffix for msgstr entries. - -<DT><SAMP>`--no-location'</SAMP> -<DD> -Do not write <SAMP>`#: <VAR>filename</VAR>:<VAR>line</VAR>'</SAMP> lines. - -<DT><SAMP>`-n'</SAMP> -<DD> -<DT><SAMP>`--add-location'</SAMP> -<DD> -Generate <SAMP>`#: <VAR>filename</VAR>:<VAR>line</VAR>'</SAMP> lines (default). - -<DT><SAMP>`--omit-header'</SAMP> -<DD> -Don't write header with <SAMP>`msgid ""'</SAMP> entry. - -This is useful for testing purposes because it eliminates a source -of variance for generated <CODE>.gmo</CODE> files. We can ship some of -these files in the GNU <CODE>gettext</CODE> package, and the result of -regenerating them through <CODE>msgfmt</CODE> should yield the same values. - -<DT><SAMP>`-p <VAR>dir</VAR>'</SAMP> -<DD> -<DT><SAMP>`--output-dir=<VAR>dir</VAR>'</SAMP> -<DD> -Output files will be placed in directory <VAR>dir</VAR>. - -<DT><SAMP>`-s'</SAMP> -<DD> -<DT><SAMP>`--sort-output'</SAMP> -<DD> -Generate sorted output and remove duplicates. - -<DT><SAMP>`--strict'</SAMP> -<DD> -Write out strict Uniforum conforming PO file. - -<DT><SAMP>`-v'</SAMP> -<DD> -<DT><SAMP>`--version'</SAMP> -<DD> -Output version information and exit. - -<DT><SAMP>`-x <VAR>file</VAR>'</SAMP> -<DD> -<DT><SAMP>`--exclude-file=<VAR>file</VAR>'</SAMP> -<DD> -Entries from <VAR>file</VAR> are not extracted. - -</DL> - -<P> -Search path for supplementary PO files is: -<TT>`/usr/local/share/nls/src/'</TT>. - -</P> -<P> -If <VAR>inputfile</VAR> is <SAMP>`-'</SAMP>, standard input is read. - -</P> -<P> -This implementation of <CODE>xgettext</CODE> is able to process a few awkward -cases, like strings in preprocessor macros, ANSI concatenation of -adjacent strings, and escaped end of lines for continued strings. - -</P> - - -<H2><A NAME="SEC20" HREF="gettext_toc.html#TOC20">C Sources Context</A></H2> - -<P> -PO mode is particularily powerful when used with PO files -created through GNU <CODE>gettext</CODE> utilities, as those utilities -insert special comments in the PO files they generate. -Some of these special comments relate the PO file entry to -exactly where the untranslated string appears in the program sources. - -</P> -<P> -When the translator gets to an untranslated entry, she is fairly -often faced with an original string which is not as informative as -it normally should, being succinct, cryptic, or otherwise ambiguous. -Before chosing how to translate the string, she needs to understand -better what the string really means and how tight the translation has -to be. Most of times, when problems arise, the only way left to make -her judgment is looking at the true program sources from where this -string originated, searching for surrounding comments the programmer -might have put in there, and looking around for helping clues of -<EM>any</EM> kind. - -</P> -<P> -Surely, when looking at program sources, the translator will receive -more help if she is a fluent programmer. However, even if she is -not versed in programming and feels a little lost in C code, the -translator should not be shy at taking a look, once in a while. -It is most probable that she will still be able to find some of the -hints she needs. She will learn quickly to not feel uncomfortable -in program code, paying more attention to programmer's comments, -variable and function names (if he dared chosing them well), and -overall organization, than to programmation itself. - -</P> -<P> -The following commands are meant to help the translator at getting -program source context for a PO file entry. - -</P> -<DL COMPACT> - -<DT><KBD>c</KBD> -<DD> -Resume the display of a program source context, or cycle through them. - -<DT><KBD>M-c</KBD> -<DD> -Display of a program source context selected by menu. - -<DT><KBD>d</KBD> -<DD> -Add a directory to the search path for source files. - -<DT><KBD>M-d</KBD> -<DD> -Delete a directory from the search path for source files. - -</DL> - -<P> -The commands <KBD>c</KBD> (<CODE>po-cycle-reference</CODE>) and <KBD>M-c</KBD> -(<CODE>po-select-reference</CODE>) both open another window displaying -some source program file, and already positioned in such a way that -it shows an actual use of the current string to translate. By doing -so, the command gives source program context for the string. But if -the entry has no source context references, or if all references -are unresolved along the search path for program sources, then the -command diagnoses this as an error. - -</P> -<P> -Even if <KBD>c</KBD> (or <KBD>M-c</KBD>) opens a new window, the cursor stays -in the PO file window. If the translator really wants to -get into the program source window, she ought to do it explicitly, -maybe by using command <KBD>o</KBD>. - -</P> -<P> -When <KBD>c</KBD> is typed for the first time, or for a PO file entry which -is different of the last one used for getting source context, then the -command reacts by giving the first context available for this entry, -if any. If some context has already been recently displayed for the -current PO file entry, and the translator wandered to do other -things, typing <KBD>c</KBD> again will merely resume, in another window, -the context last displayed. In particular, if the translator moved -the cursor away from the context in the source file, the command will -bring the cursor back to the context. By using <KBD>c</KBD> many times -in a row, with no interning other commands, PO mode will cycle to -the next available contexts for this particular entry, getting back -to the first context once the last has been shown. - -</P> -<P> -The command <KBD>M-c</KBD> behaves differently. Instead of cycling through -references, it lets the translator choose of particular reference among -many, and displays that reference. It is best used with completion, -if the translator types <KBD>TAB</KBD> immediately after <KBD>M-c</KBD>, in -response to the question, she will be offered a menu of all possible -references, as a reminder of which are the acceptable answers. -This command is useful only where there are really many contexts -available for a single string to translate. - -</P> -<P> -Program source files are usually found relative to where the PO -file stands. As a special provision, when this fails, the file is -also looked for, but relative to the directory immediately above it. -Those two cases take proper care of most PO files. However, it might -happen that a PO file has been moved, or is edited in a different -place than its normal location. When this happens, the translator -should tell PO mode in which directory normally sits the genuine PO -file. Many such directories may be specified, and all together, they -constitute what is called the <STRONG>search path</STRONG> for program sources. -The command <KBD>d</KBD> (<CODE>po-add-path</CODE>) is used to interactively -enter a new directory at the front of the search path, and the command -<KBD>M-d</KBD> (<CODE>po-delete-path</CODE>) is used to select, with completion, -one of the directories she does not want anymore on the search path. - -</P> - - -<H2><A NAME="SEC21" HREF="gettext_toc.html#TOC21">Using Translation Compendiums</A></H2> - -<P> -Compendiums are yet to be implemented. - -</P> -<P> -An incoming PO mode feature will let the translator maintain a -compendium of already achieved translations. A <STRONG>compendium</STRONG> -is a special PO file containing a set of translations recurring in -many different packages. The translator will be given commands for -adding entries to her compendium, and later initializing untranslated -entries, or updating already translated entries, from translations -kept in the compendium. For this to work, however, the compendium -would have to be normalized. See section <A HREF="gettext.html#SEC12">Normalizing Strings in Entries</A>. - -</P> - - - -<H1><A NAME="SEC22" HREF="gettext_toc.html#TOC22">Updating Existing PO Files</A></H1> - - - -<H2><A NAME="SEC23" HREF="gettext_toc.html#TOC23">Invoking the <CODE>tupdate</CODE> Program</A></H2> - - -<PRE> -tupdate --help -tupdate --version -tupdate <VAR>new</VAR> <VAR>old</VAR> -</PRE> - -<P> -File <VAR>new</VAR> is the last created PO file (generally by -<CODE>xgettext</CODE>). It need not contain any translations. File -<VAR>old</VAR> is the PO file including the old translations which will -be taken over to the newly created file as long as they still match. - -</P> -<P> -When English messages change in the programs, this is reflected in -the PO file as extracted by <CODE>xgettext</CODE>. In large messages, that -can be hard to detect, and will obviously result in an incomplete -translation. One of the virtues of <CODE>tupdate</CODE> is that it detects -such changes, saving the previous translation into a PO file comment, -so marking the entry as obsolete, and giving the modified string with -an empty translation, that is, marking the entry as untranslated. - -</P> - - -<H2><A NAME="SEC24" HREF="gettext_toc.html#TOC24">Untranslated Entries</A></H2> - -<P> -When <CODE>xgettext</CODE> originally creates a PO file, unless told -otherwise, it initializes the <CODE>msgid</CODE> field with the untranslated -string, and leaves the <CODE>msgstr</CODE> string to be empty. Such entries, -having an empty translation, are said to be <STRONG>untranslated</STRONG> entries. -Later, when the programmer slightly modifies some string right in -the program, this change is later reflected in the PO file -by the appearance of a new untranslated entry for the modified string. - -</P> -<P> -The usual commands moving from entry to entry consider untranslated -entries on the same level as active entries. Untranslated entries -are easily recognizable by the fact they end with <SAMP>`msgstr ""'</SAMP>. - -</P> -<P> -The work of the translator might be (quite naively) seen as the process -of seeking after an untranslated entry, editing a translation for -it, and repeating these actions until no untranslated entries remain. -Some commands are more specifically related to untranslated entry -processing. - -</P> -<DL COMPACT> - -<DT><KBD>e</KBD> -<DD> -Find the next untranslated entry. - -<DT><KBD>M-e</KBD> -<DD> -Find the previous untranslated entry. - -<DT><KBD>k</KBD> -<DD> -Turn the current entry into an untranslated one. - -</DL> - -<P> -The commands <KBD>e</KBD> (<CODE>po-next-empty-entry</CODE>) and <KBD>M-e</KBD> -(<CODE>po-previous-empty</CODE>) move forwards or backwards, chasing for an -obsolete entry. If none is found, the search is extended and wraps -around in the PO file buffer. - -</P> -<P> -An entry can be turned back into an untranslated entry by -merely emptying its translation, using the command <KBD>k</KBD> -(<CODE>po-kill-msgstr</CODE>). See section <A HREF="gettext.html#SEC26">Modifying Translations</A>. - -</P> -<P> -Also, when time comes to quit working on a PO file buffer -with the <KBD>q</KBD> command, the translator is asked for confirmation, -if some untranslated string still exists. - -</P> - - -<H2><A NAME="SEC25" HREF="gettext_toc.html#TOC25">Obsolete Entries</A></H2> - -<P> -By <STRONG>obsolete</STRONG> PO file entries, we mean those entries which are -commented out, usually by <CODE>tupdate</CODE> when it found that the -translation is not needed anymore by the package being localized. - -</P> -<P> -The usual commands moving from entry to entry consider obsolete -entries on the same level as active entries. Obsolete entries are -easily recognizable by the fact that all their lines start with -<KBD>#</KBD>, even those lines containing <CODE>msgid</CODE> or <CODE>msgstr</CODE>. - -</P> -<P> -Commands exist for emptying the translation or reinitializing it -to the original untranslated string. Commands interfacing with the -kill ring may force some previously saved text into the translation. -The user may interactively edit the translation. All these commands -may apply to obsolete entries, carefully leaving the entry obsolete -after the fact. - -</P> -<P> -Moreover, some commands are more specifically related to obsolete -entry processing. - -</P> -<DL COMPACT> - -<DT><KBD>M-n</KBD> -<DD> -<DT><KBD>M-<KBD>SPC</KBD></KBD> -<DD> -Find the next obsolete entry. - -<DT><KBD>M-p</KBD> -<DD> -<DT><KBD>M-<KBD>DEL</KBD></KBD> -<DD> -Find the previous obsolete entry. - -<DT><KBD>z</KBD> -<DD> -Make an active entry obsolete, or zap out an obsolete entry. - -</DL> - -<P> -The commands <KBD>M-n</KBD> (<CODE>po-next-obsolete-entry</CODE>) and <KBD>M-p</KBD> -(<CODE>po-previous-obsolete-entry</CODE>) move forwards or backwards, -chasing for an obsolete entry. If none is found, the search is -extended and wraps around in the PO file buffer. The commands -<KBD>M-<KBD>SPC</KBD></KBD> and <KBD>M-<KBD>DEL</KBD></KBD> are synonymous to <KBD>M-n</KBD> -and <KBD>M-p</KBD>, respectively. - -</P> -<P> -PO mode does not provide ways for un-commenting an obsolete entry -and making it active, because this would reintroduce an original -untranslated string which does not correspond to any marked string -in the program sources. This goes with the philosophy of never -introducing useless <CODE>msgid</CODE> values. - -</P> -<P> -However, it is possible to comment out an active entry, so making -it obsolete. GNU <CODE>gettext</CODE> utilities will later react to the -disappearance of a translation by using the untranslated string. -The command <KBD>z</KBD> (<CODE>po-fade-out-entry</CODE>) pushes the current entry -a little further towards annihilation. If the entry is active, then -the entry is merely commented out. If the entry is already obsolete, -then it is completely deleted from the PO file. It is easy to recycle -the translation so deleted into some other PO file entry, usually -one which is untranslated. See section <A HREF="gettext.html#SEC26">Modifying Translations</A>. - -</P> -<P> -Here is a quite interesting problem to solve for later development of -PO mode, for those nights you are not sleepy. The idea would be that -PO mode might become bright enough, one of these days, to make good -guesses at retrieving the most probable candidate, among all obsolete -entries, for initializing the translation of a newly appeared string. -I think it might be a quite hard problem to do this algorithmically, as -we have to develop good and efficient measures of string similarity. -Right now, PO mode completely lets the decision to the translator, -when the time comes to find the adequate obsolete translation, it -merely tries to provide handy tools for helping her to do so. - -</P> - - -<H2><A NAME="SEC26" HREF="gettext_toc.html#TOC26">Modifying Translations</A></H2> - -<P> -PO mode prevents direct edition of the PO file, by the usual -means Emacs give for altering a buffer's contents. By doing so, -it pretends helping the translator to avoid little clerical errors -about the overall file format, or the proper quoting of strings, -as those errors would be easily made. Other kinds of errors are -still possible, but some may be catched and diagnosed by the batch -validation process, which the translator may always trigger by the -<KBD>v</KBD> command. For all other errors, the translator has to rely on -her own judgment, and also on the linguistic reports submitted to her -by the users of the translated package, having the same mother tongue. - -</P> -<P> -When the time comes to create a translation, correct a error diagnosed -mechanically or reported by a user, the translator have to resort to -using the following commands for modifying the translations. - -</P> -<DL COMPACT> - -<DT><KBD>RET</KBD> -<DD> -Interactively edit the translation. - -<DT><KBD>TAB</KBD> -<DD> -Reinitialize the translation with the original, untranslated string. - -<DT><KBD>k</KBD> -<DD> -Save the translation on the kill ring, and delete it. - -<DT><KBD>w</KBD> -<DD> -Save the translation on the kill ring, without deleting it. - -<DT><KBD>y</KBD> -<DD> -Replace the translation, taking the new from the kill ring. - -</DL> - -<P> -The command <KBD>RET</KBD> (<CODE>po-edit-msgstr</CODE>) opens a new Emacs -window containing a copy of the translation taken from the current -PO file entry, all ready for edition, fully modifiable -and with the complete extent of GNU Emacs modifying commands. -The string is presented to the translator expunged of all quoting -marks, and she will modify the <EM>unquoted</EM> string in this -window to heart's content. Once done, the regular Emacs command -<KBD>M-C-c</KBD> (<CODE>exit-recursive-edit</CODE>) may be used to return the -edited translation into the PO file, replacing the original -translation. The keys <KBD>C-c C-c</KBD> are bound so they have the -same effect as <KBD>M-C-c</KBD>. - -</P> -<P> -If the translator becomes unsatisfied with her translation to the -extent she prefers keeping the translation which was existent prior to -the <KBD>RET</KBD> command, she may use the regular Emacs command <KBD>C-]</KBD> -(<CODE>abort-recursive-edit</CODE>) to merely get rid of edition, while -preserving the original translation. Another way would be for her -to exit normally with <KBD>C-c C-c</KBD>, then type <CODE>u</CODE> once for -undoing the whole effect of last edition. - -</P> -<P> -While editing her translation, the translator should pay attention at -not inserting unwanted <KBD><KBD>RET</KBD></KBD> (carriage returns) characters at -the end of the translated string if those are not meant to be there, -or removing such characters when they are required. Since these -characters are not visible in the editing buffer, they are easily to -introduce by mistake. To help her, <KBD><KBD>RET</KBD></KBD> automatically puts -the character <KBD><</KBD> at the end of the string being edited, but this -<KBD><</KBD> is not really part of the string. On exiting the editing -window with <KBD>C-c C-c</KBD>, PO mode automatically removes such -<KBD><</KBD> and all whitespace added after it. If the translator adds -characters after the terminating <KBD><</KBD>, it looses its delimiting -property and integrally becomes part of the string. If she removes -the delimiting <KBD><</KBD>, then the edited string is taken <EM>as -is</EM>, with all trailing newlines, even if invisible. Also, if the -translated string ought to end itself with a genuine <KBD><</KBD>, then the -delimiting <KBD><</KBD> may not be removed; so the string should appear, -in the editing window, as ending with two <KBD><</KBD> in a row. - -</P> -<P> -When a translation (or a comment) is being edited, the translator -may move the cursor back into the PO file buffer and freely -move to other entries, and browsing at will. The edited entry will -be recovered as soon as the edit ceases, because this is this entry -only which is being modified. If, with an edition still opened, the -translator wanders in the PO file buffer, she cannot modify -any other entry. If she tries to, PO mode will react by suggesting -that she aborts the current edit, or else, by inviting her to finish -the current edit prior to any other modification. - -</P> -<P> -The command <KBD>TAB</KBD> (<CODE>po-msgid-to-msgstr</CODE>) initializes, or -reinitializes the translation with the original string. This command -is normally used when the translator wants to redo a fresh translation -of the original string, disregarding any previous work. - -</P> -<P> -In fact, whether it is best to start a translation with an empty -string, or rather with a copy of the original string, is a matter of -taste or habit. Sometimes, the source mother tongue language and the -target language are so different that is simply best to start writing -on an empty page. At other times, the source and target languages -are so close that it would be a waste to retype a number of words -already being written in the original string. A translator may also -like having the original string right under her eyes, as she will -progressively overwrite the original text with the translation, even -if this requires some extra editing work to get rid of the original. - -</P> -<P> -The command <KBD>k</KBD> (<CODE>po-kill-msgstr</CODE>) merely empties the -translation string, so turning the entry into an untranslated -one. But while doing so, its previous contents is put apart in -a special place, known as the kill ring. The command <KBD>w</KBD> -(<CODE>po-kill-ring-save-msgstr</CODE>) has also the effect of taking a -copy of the translation onto the kill ring, but it otherwise leaves -the entry alone, and does <EM>not</EM> remove the translation from the -entry. Both commands use exactly the Emacs kill ring, which is shared -between buffers, and which is well known already to GNU Emacs lovers. - -</P> -<P> -The translator may use <KBD>k</KBD> or <KBD>w</KBD> many times in the course -of her work, as the kill ring may hold several saved translations. -From the kill ring, strings may later be reinserted in various -Emacs buffers. In particular, the kill ring may be used for moving -translation strings between different entries of a single PO file -buffer, or if the translator is handling many such buffers at once, -even between PO files. - -</P> -<P> -To facilitate exchanges with buffers which are not in PO mode, the -translation string put on the kill ring by the <KBD>k</KBD> command is fully -unquoted before being saved: external quotes are removed, multi-lines -strings are concatenated, and backslashed escaped sequences are turned -into their corresponding characters. In the special case of obsolete -entries, the translation is also uncommented prior to saving. - -</P> -<P> -The command <KBD>y</KBD> (<CODE>po-yank-msgstr</CODE>) completely replaces the -translation of the current entry by a string taken from the kill ring. -Following GNU Emacs terminology, we then say that the replacement -string is <STRONG>yanked</STRONG> into the PO file buffer. -See section `Yanking' in <CITE>The Emacs Editor</CITE>. -The first time <KBD>y</KBD> is used, the translation receives the value of -the most recent addition to the kill ring. If <KBD>y</KBD> is typed once -again, immediately, without intervening keystrokes, the translation -just inserted is taken away and replaced by the second most recent -addition to the kill ring. By repeating <KBD>y</KBD> many times in a row, -the translator may travel along the kill ring for saved strings, -until she finds the string she really wanted. - -</P> -<P> -When a string is yanked into a PO file entry, it is fully and -automatically requoted for complying with the format PO files should -have. Further, if the entry is obsolete, PO mode then appropriately -push the inserted string inside comments. Once again, translators -should not burden themselves with quoting considerations besides, of -course, the necessity of the translated string itself respective to -the program using it. - -</P> -<P> -Note that <KBD>k</KBD> or <KBD>w</KBD> are not the only commands pushing strings -on the kill ring, as almost any PO mode command replacing translation -strings (or the translator comments) automatically save the old string -on the kill ring. The main exceptions to this general rule are the -yanking commands themselves. - -</P> -<P> -To better illustrate the operation of killing and yanking, let's -use an actual example, taken from a common situation. When the -programmer slightly modifies some string right in the program, his -change is later reflected in the PO file by the appearance -of a new untranslated entry for the modified string, and the fact -that the entry translating the original or unmodified string becomes -obsolete. In many cases, the translator might spare herself some work -by retrieving the unmodified translation from the obsolete entry, -then initializing the untranslated entry <CODE>msgstr</CODE> field with -this retrieved translation. Once this done, the obsolete entry is -not wanted anymore, and may be safely deleted. - -</P> -<P> -When the translator finds an untranslated entry and suspects that a -slight variant of the translation exists, she immediately uses <KBD>m</KBD> -to mark the current entry location, then starts chasing obsolete -entries with <KBD>M-SPC</KBD>, hoping to find some translation corresponding -to the unmodified string. Once found, she uses the <KBD>z</KBD> command -for deleting the obsolete entry, knowing that <KBD>z</KBD> also <EM>kills</EM> -the translation, that is, pushes the translation on the kill ring. -Then, <KBD>l</KBD> returns to the initial untranslated entry, <KBD>y</KBD> -then <EM>yanks</EM> the saved translation right into the <CODE>msgstr</CODE> -field. The translator is then free to use <KBD><KBD>RET</KBD></KBD> for fine -tuning the translation contents, and maybe to later use <KBD>e</KBD>, -then <KBD>m</KBD> again, for going on with the next untranslated string. - -</P> -<P> -When some sequence of keys has to be typed over and over again, the -translator may find comfortable to become more acquainted with the GNU -Emacs capability of learning these sequences and playing them back under -request. See section `Keyboard Macros' in <CITE>The Emacs Editor</CITE>. - -</P> - - -<H2><A NAME="SEC27" HREF="gettext_toc.html#TOC27">Modifying Comments</A></H2> - -<P> -Any translation work done seriously will raise many linguistic -difficulties, for which decisions have to be made, and the choices -further documented. These documents may be saved within the -PO file in form of translator comments, which the translator -is free to create, delete, or modify at will. These comments may -be useful to herself when she returns to this PO file after a while. -Memory forgets! - -</P> -<P> -These commands are somewhat similar to those modifying translations, -so the general indications given for these apply here. See section <A HREF="gettext.html#SEC26">Modifying Translations</A>. - -</P> -<DL COMPACT> - -<DT><KBD>M-RET</KBD> -<DD> -Interactively edit the translator comments. - -<DT><KBD>M-k</KBD> -<DD> -Save the translator comments on the kill ring, and delete it. - -<DT><KBD>M-w</KBD> -<DD> -Save the translator comments on the kill ring, without deleting it. - -<DT><KBD>M-y</KBD> -<DD> -Replace the translator comments, taking the new from the kill ring. - -</DL> - -<P> -Those commands parallel PO mode commands for modifying the translation -strings, and behave much the same way as them, except that they handle -this part of PO file comments meant for translator usage, rather -than the translation strings. So, the descriptions given below are -slightly succinct, because the full details have already been given. -See section <A HREF="gettext.html#SEC26">Modifying Translations</A>. - -</P> -<P> -The command <KBD>M-RET</KBD> (<CODE>po-edit-comment</CODE>) opens a new Emacs -window containing a copy of the translator comments the current -PO file entry. If there is no such comments, PO mode -understands that the translator wants to add a comment to the entry, -and she is presented an empty screen. Comment marks (<KBD>#</KBD>) and -the space following them are automatically removed before edition, -and reinstated after. For translator comments pertaining to obsolete -entries, the uncommenting and recommenting operations are done twice. -The command <KBD>#</KBD> also has the same effect as <KBD>M-RET</KBD>, and might -be easier to type. Once in the editing window, the keys <KBD>C-c -C-c</KBD> allow the translator to tell she is finished with editing -the comment. - -</P> -<P> -The command <KBD>M-k</KBD> (<CODE>po-kill-comment</CODE>) get rid of all -translator comments, while saving those comments on the kill ring. -The command <KBD>M-w</KBD> (<CODE>po-kill-ring-save-comment</CODE>) takes -a copy of the translator comments on the kill ring, but leaves -them undisturbed in the current entry. The command <KBD>M-y</KBD> -(<CODE>po-yank-comment</CODE>) completely replaces the translator comments -by a string taken at the front of the kill ring. When this command -is immediately repeated, the comments just inserted are withdrawn, -and replaced by other strings taken along the kill ring. - -</P> -<P> -On the kill ring, all strings have the same nature. There is no -distinction between <EM>translation</EM> strings and <EM>translator -comments</EM> strings. So, for example, let's presume the translator -has just finished editing a translation, and wants to create a new -translator comments for documenting why the previous translation was -not good, just to remember what was the problem. Foreseeing that she -will do that in her documentation, the translator will want to quote -the previous translation in her translator comments. For doing so, she -may initialize the translator comments with the previous translation, -still at the head of the kill ring. Because editing already pushed the -previous translation on the kill ring, she just has to type <KBD>M-w</KBD> -prior to <KBD>#</KBD>, and the previous translation will be right there, -all ready for being introduced by some explanatory text. - -</P> -<P> -On the other hand, presume there are some translator comments already -and that the translator wants to add to those comments, instead -of wholly replacing them. Then, she should edit the comment right -away with <KBD>#</KBD>. Once inside the editing window, she can use the -regular GNU Emacs commands <KBD>C-y</KBD> (<CODE>yank</CODE>) and <KBD>M-y</KBD> -(<CODE>yank-pop</CODE>) for getting the previous translation where she likes. - -</P> - - -<H2><A NAME="SEC28" HREF="gettext_toc.html#TOC28">Consulting Auxiliary PO Files</A></H2> - -<P> -An incoming feature of PO mode should help the knowledgeable translator -to take advantage of translations already achieved in other languages -she just happens to know, by providing these other language translation -as additional context for her own work. Each PO file existing for -the same package the translator is working on, but targeted to a -different mother tongue language, is called an <STRONG>auxiliary</STRONG> PO file. -Commands will exist for declaring and handling auxiliary PO files, -and also for showing contexts for the entry under work. For this to -work fully, all auxiliary PO files will have to be normalized. - -</P> - - -<H1><A NAME="SEC29" HREF="gettext_toc.html#TOC29">Producing Binary MO Files</A></H1> - - - -<H2><A NAME="SEC30" HREF="gettext_toc.html#TOC30">Invoking the <CODE>msgfmt</CODE> Program</A></H2> - - -<PRE> -Usage: msgfmt [<VAR>option</VAR>] <VAR>filename</VAR>.po ... -</PRE> - -<DL COMPACT> - -<DT><SAMP>`-a <VAR>number</VAR>'</SAMP> -<DD> -<DT><SAMP>`--alignment=<VAR>number</VAR>'</SAMP> -<DD> -Align strings to <VAR>number</VAR> bytes (default: 1). - -<DT><SAMP>`-h'</SAMP> -<DD> -<DT><SAMP>`--help'</SAMP> -<DD> -Display this help and exit. - -<DT><SAMP>`-I <VAR>list</VAR>'</SAMP> -<DD> -<DT><SAMP>`--input-path=<VAR>list</VAR>'</SAMP> -<DD> -List of directories searched for input files. - -<DT><SAMP>`--no-hash'</SAMP> -<DD> -Binary file will not include the hash table. - -<DT><SAMP>`-o <VAR>file</VAR>'</SAMP> -<DD> -<DT><SAMP>`--output-file=<VAR>file</VAR>'</SAMP> -<DD> -Specify output file name as <VAR>file</VAR>. - -<DT><SAMP>`-v'</SAMP> -<DD> -<DT><SAMP>`--verbose'</SAMP> -<DD> -Detect and diagnose input file anomalies which might represent -translation errors. The <CODE>msgid</CODE> and <CODE>msgstr</CODE> strings are -studied and compared. It is considered abnormal that one string -starts or ends with a newline while the other does not. Also, both -strings should have the same number of <SAMP>`%'</SAMP> format specifiers, -with matching types. For example, the check will diagnose using -<SAMP>`%.*s'</SAMP> against <SAMP>`%s'</SAMP>, or <SAMP>`%d'</SAMP> against <SAMP>`%s'</SAMP>, or -<SAMP>`%d'</SAMP> against <SAMP>`%x'</SAMP>. It can even handle positional parameters. - -<DT><SAMP>`-V'</SAMP> -<DD> -<DT><SAMP>`--version'</SAMP> -<DD> -Output version information and exit. - -</DL> - -<P> -If input file is <SAMP>`-'</SAMP>, standard input is read. If output file -is <SAMP>`-'</SAMP>, output is written to standard output. - -</P> -<P> -The search patch for <CODE>msgfmt</CODE> is <TT>`/usr/local/share/nls/src/'</TT>, -by default. It represents the path to additional directories where -other PO files can be found. This feature could be used for some -PO files for standard libraries, in case we would like to spare -translating their strings over and over again. The <SAMP>`-x'</SAMP> option -could then exclude these strings from the generation. - -</P> - - -<H2><A NAME="SEC31" HREF="gettext_toc.html#TOC31">The Format of GNU MO Files</A></H2> - -<P> -The format of the generated MO files is best described by a picture, -which appears below. - -</P> -<P> -The first two words serve the identification of the file. The magic -number will always signal GNU MO files. The number is stored in the -byte order of the generating machine, so the magic number really is -two numbers: <CODE>0x950412de</CODE> and <CODE>0xde120495</CODE>. The second -word describes the current revision of the file format. For now the -revision is 0. This might change in future versions, and ensures -that the readers of MO files can distinguish new formats from old -ones, so that both can be handled correctly. The version is kept -separate from the magic number, instead of using different magic -numbers for different formats, mainly because <TT>`/etc/magic'</TT> is -not updated often. It might be better to have magic separated from -internal format version identification. - -</P> -<P> -Follow a number of pointers to later tables in the file, allowing -for the extension of the prefix part of MO files without having to -recompile programs reading them. This might become useful for later -inserting a few flag bits, indication about the charset used, new -tables, or other things. - -</P> -<P> -Then, at offset <VAR>O</VAR> and offset <VAR>T</VAR> in the picture, two tables -of string descriptors can be found. In both tables, each string -descriptor uses two 32 bits integers, one for the string length, -another for the offset of the string in the MO file, counting in bytes -from the start of the file. The first table contains descriptors -for the original strings, and is sorted so the original strings -are in increasing lexicographical order. The second table contains -descriptors for the translated strings, and is parallel to the first -table: to find the corresponding translation one has to access the -array slot in the second array with the same index. - -</P> -<P> -Having the original strings sorted enables the use of simple binary -search, for when the MO file does not contain an hashing table, or -for when it is not practical to use the hashing table provided in -the MO file. This also has another advantage, as the empty string -in a PO file GNU <CODE>gettext</CODE> is usually <EM>translated</EM> into -some system information attached to that particular MO file, and the -empty string necessarily becomes the first in both the original and -translated tables, making the system information very easy to find. - -</P> -<P> -The size <VAR>S</VAR> of the hash table can be zero. In this case, the -hash table itself is not contained in the MO file. Some people might -prefer this because a precomputed hashing table takes disk space, and -does not win <EM>that</EM> much speed. The hash table contains indices -to the sorted array of strings in the MO file. Conflict resolution is -done by double hashing. The precise hashing algorithm used is fairly -dependent of GNU <CODE>gettext</CODE> code, and is not documented here. - -</P> -<P> -As for the strings themselves, they follow the hash file, and each -is terminated with a <KBD>NUL</KBD>, and this <KBD>NUL</KBD> is not counted in -the length which appears in the string descriptor. The <CODE>msgfmt</CODE> -program has an option selecting the alignment for MO file strings. -With this option, each string is separately aligned so it starts at -an offset which is a multiple of the alignment value. On some RISC -machines, a correct alignment will speed things up. - -</P> -<P> -Nothing prevents an MO file from having embedded <KBD>NUL</KBD>s in strings. -However, the program interface currently used already presumes -that strings are <KBD>NUL</KBD> terminated, so embedded <KBD>NUL</KBD>s are -somewhat useless. But MO file format is general enough so other -interfaces would be later possible, if for example, we ever want to -implement wide characters right in MO files, where <KBD>NUL</KBD> bytes may -accidently appear. - -</P> -<P> -This particular issue has been strongly debated in the GNU -<CODE>gettext</CODE> development forum, and it is expectable that MO file -format will evolve or change over time. It is even possible that many -formats may later be supported concurrently. But surely, we got to -start somewhere, and the MO file format described here is a good start. -Nothing is cast in concrete, and the format may later evolve fairly -easily, so we should feel comfortable with the current approach. - -</P> - -<PRE> - byte - +------------------------------------------+ - 0 | magic number = 0x950412de | - | | - 4 | file format revision = 0 | - | | - 8 | number of strings | == N - | | - 12 | offset of table with original strings | == O - | | - 16 | offset of table with translation strings | == T - | | - 20 | size of hashing table | == S - | | - 24 | offset of hashing table | == H - | | - . . - . (possibly more entries later) . - . . - | | - O | length & offset 0th string ----------------. - O + 8 | length & offset 1st string ------------------. - ... ... | | -O + ((N-1)*8)| length & offset (N-1)th string | | | - | | | | - T | length & offset 0th translation ---------------. - T + 8 | length & offset 1st translation -----------------. - ... ... | | | | -T + ((N-1)*8)| length & offset (N-1)th translation | | | | | - | | | | | | - H | start hash table | | | | | - ... ... | | | | - H + S * 4 | end hash table | | | | | - | | | | | | - | NUL terminated 0th string <----------------' | | | - | | | | | - | NUL terminated 1st string <------------------' | | - | | | | - ... ... | | - | | | | - | NUL terminated 0th translation <---------------' | - | | | - | NUL terminated 1st translation <-----------------' - | | - ... ... - | | - +------------------------------------------+ -</PRE> - - - -<H1><A NAME="SEC32" HREF="gettext_toc.html#TOC32">The User's View</A></H1> - -<P> -When GNU <CODE>gettext</CODE> will truly have reached is goal, average users -should feel some kind of astonished pleasure, seeing the effect of -that strange kind of magic that just makes their own native language -appear everywhere on their screens. As for naive users, they would -ideally have no special pleasure about it, merely taking their own -language for <EM>granted</EM>, and becoming rather unhappy otherwise. - -</P> -<P> -So, let's try to describe here how we would like the magic to operate, -as we want the users' view to be the simplest, among all ways one -could look at GNU <CODE>gettext</CODE>. All other software engineers: -programmers, translators, maintainers, should work together in such a -way that the magic becomes possible. This is a long and progressive -undertaking, and information is available about the progress of the -GNU Translation Project. - -</P> -<P> -When a package is distributed, there are two kind of users: -<STRONG>installers</STRONG> who fetch the distribution, unpack it, configure -it, compile it and install it for themselves or others to use; and -<STRONG>end users</STRONG> that call programs of the package, once these have -been installed at their site. GNU <CODE>gettext</CODE> is offering magic -for both installers and end users. - -</P> - - - -<H2><A NAME="SEC33" HREF="gettext_toc.html#TOC33">The Current <TT>`NLS'</TT> Matrix for GNU</A></H2> - -<P> -Languages are not equally supported in all GNU packages. To know -if some GNU package uses GNU <CODE>gettext</CODE>, one may check -the distribution for the <TT>`NLS'</TT> information file, for some -<TT>`<VAR>ll</VAR>.po'</TT> files, often kept together into some <TT>`po/'</TT> -directory, or for an <TT>`intl/'</TT> directory. Internationalized -packages have usually many <TT>`<VAR>ll</VAR>.po'</TT> files, where <VAR>ll</VAR> -represents the language. section <A HREF="gettext.html#SEC35">Magic for End Users</A> for a complete description -of the format for <VAR>ll</VAR>. - -</P> -<P> -More generally, a matrix is available for showing the current state -of GNU internationalization, listing which packages are prepared -for multi-lingual messages, and which languages is supported by each. -Because this information changes often, this matrix is not kept within -this GNU <CODE>gettext</CODE> manual. This information is often found in -file <TT>`NLS'</TT> from various GNU distributions, but is also as old -as the distribution itself. A recent copy of this <TT>`NLS'</TT> file, -containing up-to-date information, should generally be found on most -GNU archive sites. - -</P> - - -<H2><A NAME="SEC34" HREF="gettext_toc.html#TOC34">Magic for Installers</A></H2> - -<P> -By default, packages fully using GNU <CODE>gettext</CODE>, internally, -are installed in such a way that they to allow translation of -messages. At <EM>configuration</EM> time, those packages should -automatically detect whether the underlying host system provides usable -<CODE>catgets</CODE> or <CODE>gettext</CODE> functions. If neither is present, -the GNU <CODE>gettext</CODE> library should be automatically prepared -and used. Installers may use special options at configuration -time for changing this behavior. The command <SAMP>`./configure ---with-gnu-gettext'</SAMP> bypasses system <CODE>catgets</CODE> or <CODE>gettext</CODE> to -use GNU <CODE>gettext</CODE> instead, while <SAMP>`./configure --disable-nls'</SAMP> -produces program totally unable to translate messages. - -</P> -<P> -Internationalized packages have usually many <TT>`<VAR>ll</VAR>.po'</TT> -files. Unless -translations are disabled, all those available are installed together -with the package. However, the environment variable <CODE>LINGUAS</CODE> -may be set, prior to configuration, to limit the installed set. -<CODE>LINGUAS</CODE> should then contain a space separated list of two-letter -codes, stating which languages are allowed. - -</P> - - -<H2><A NAME="SEC35" HREF="gettext_toc.html#TOC35">Magic for End Users</A></H2> - -<P> -We consider here those packages using GNU <CODE>gettext</CODE> internally, -and for which the installers did not disable translation at -<EM>configure</EM> time. Then, users only have to set the <CODE>LANG</CODE> -environment variable to the appropriate <SAMP>`<VAR>ll</VAR>'</SAMP> prior to -using the programs in the package. See section <A HREF="gettext.html#SEC33">The Current <TT>`NLS'</TT> Matrix for GNU</A>. For example, -let's presume a German site. At the shell prompt, users merely have to -execute <SAMP>`setenv LANG de'</SAMP> (in <CODE>csh</CODE>) or <SAMP>`export -LANG; LANG=de'</SAMP> (in <CODE>sh</CODE>). They could even do this from their -<TT>`.login'</TT> or <TT>`.profile'</TT> file. - -</P> - - -<H1><A NAME="SEC36" HREF="gettext_toc.html#TOC36">The Programmer's View</A></H1> - -<P> -One aim of the current message catalog implementation provided by -GNU <CODE>gettext</CODE> was to use the systems message catalog handling, if the -installer wishes to do so. So we perhaps should first take a look at -the solutions we know about. The people in the POSIX committee does not -manage to agree on one of the semi-official standards which we'll -describe below. In fact they couldn't agree on anything, so nothing -decide only to include an example of an interface. The major Unix vendors -are split in the usage of the two most important specifications: X/Opens -catgets vs. Uniforums gettext interface. We'll describe them both and -later explain our solution of this dilemma. - -</P> - - - -<H2><A NAME="SEC37" HREF="gettext_toc.html#TOC37">About <CODE>catgets</CODE></A></H2> - -<P> -The <CODE>catgets</CODE> implementation is defined in the X/Open Portability -Guide, Volume 3, XSI Supplementary Definitions, Chapter 5. But the -process of creating this standard seemed to be too slow for some of -the Unix vendors so they created their implementations on preliminary -versions of the standard. Of course this leads again to problems while -writing platform independent programs: even the usage of <CODE>catgets</CODE> -does not guarantee a unique interface. - -</P> -<P> -Another, personal comment on this that only a bunch of committee members -could have made this interface. They never really tried to program -using this interface. It is a fast, memory-saving implementation, an -user can happily live with it. But programmers hate it (at least me and -some others do...) - -</P> -<P> -But we must not forget one point: after all the trouble with transfering -the rights on Unix(tm) they at last came to X/Open, the very same who -published this specifications. This leads me to making the prediction -that this interface will be in future Unix standards (e.g. Spec1170) and -therefore part of all Unix implementation (implementations, which are -<EM>allowed</EM> to wear this name). - -</P> - - - -<H3><A NAME="SEC38" HREF="gettext_toc.html#TOC38">The Interface</A></H3> - -<P> -The interface to the <CODE>catgets</CODE> implementation consists of three -functions which correspond to those used in file access: <CODE>catopen</CODE> -to open the catalog for using, <CODE>catgets</CODE> for accessing the message -tables, and <CODE>catclose</CODE> for closing after work is done. Prototypes -for the functions and the needed definitions are in the -<CODE><nl_types.h></CODE> header file. - -</P> -<P> -<CODE>catopen</CODE> is used like in this: - -</P> - -<PRE> -nl_catd catd = catopen ("catalog_name", 0); -</PRE> - -<P> -The function takes as the argument the name of the catalog. This usual -refers to the name of the program or the package. The second parameter -is not further specified in the standard. I don't even know whether it -is implemented consistently among various systems. So the common advice -is to use <CODE>0</CODE> as the value. The return value is a handle to the -message catalog, equivalent to handles to file returned by <CODE>open</CODE>. - -</P> -<P> -This handle is of course used in the <CODE>catgets</CODE> function which can -be used like this: - -</P> - -<PRE> -char *translation = catgets (catd, set_no, msg_id, "original string"); -</PRE> - -<P> -The first parameter is this catalog descriptor. The second parameter -specifies the set of messages in this catalog, in which the message -described by <CODE>msg_id</CODE> is obtained. <CODE>catgets</CODE> therefore uses a -three-stage addressing: - -</P> - -<PRE> -catalog name => set number => message ID => translation -</PRE> - -<P> -The fourth argument is not used to address the translation. It is given -as a default value in case when one of the addressing stages fail. One -important thing to remember is that although the return type of catgets -is <CODE>char *</CODE> the resulting string <EM>must not</EM> be changed. It -should better <CODE>const char *</CODE>, but the standard is published in -1988, one year before ANSI C. - -</P> -<P> -The last of these function functions is used and behaves as expected: - -</P> - -<PRE> -catclose (catd); -</PRE> - -<P> -After this no <CODE>catgets</CODE> call using the descriptor is legal anymore. - -</P> - - -<H3><A NAME="SEC39" HREF="gettext_toc.html#TOC39">Problems with the <CODE>catgets</CODE> Interface?!</A></H3> - -<P> -Now that this descriptions seemed to be really easy where are the -problem we speak of. In fact the interface could be used in a -reasonable way, but constructing the message catalogs is a pain. The -reason for this lies in the third argument of <CODE>catgets</CODE>: the unique -message ID. This has to be a numeric value for all messages in a single -set. Perhaps you could imagine the problems keeping such list while -changing the source code. Add a new message here, remove one there. Of -course there have been developed a lot of tools helping to organize this -chaos but one as the other fails in one aspect or the other. We don't -want to say that the other approach has no problems but they are far -more easily to manage. - -</P> - - -<H2><A NAME="SEC40" HREF="gettext_toc.html#TOC40">About <CODE>gettext</CODE></A></H2> - -<P> -The definition of the <CODE>gettext</CODE> interface comes from a Uniforum -proposal and it is followed by at least one major Unix vendor -(Sun) in its last developments. It is not specified in any official -standard, though. - -</P> -<P> -The main points about this solution is that it does not follow the -method of normal file handling (open-use-close) and that it does not -burden the programmer so many task, especially the unique key handling. -Of course here is also a unique key needed, but this key is the -message itself (how long or short it is). See section <A HREF="gettext.html#SEC45">Comparing the Two Interfaces</A> for a -more detailed comparison of the two methods. - -</P> -<P> -The following section contains a rather detailed description of the -interface. We make it that detailed because this is the interface -we chose for the GNU <CODE>gettext</CODE> Library. Programmers interested -in using this library will be interested in this description. - -</P> - - - -<H3><A NAME="SEC41" HREF="gettext_toc.html#TOC41">The Interface</A></H3> - -<P> -The minimal functionality an interface must have is a) to select a -domain the strings are coming from (a single domain for all programs is -not reasonable because its construction and maintenance is difficult, -perhaps impossible) and b) to access a string in a selected domain. - -</P> -<P> -This is principally the description of the <CODE>gettext</CODE> interface. It -has an global domain which unqualified usages reference. Of course this -domain is selectable by the user. - -</P> - -<PRE> -char *textdomain (const char *domain_name); -</PRE> - -<P> -This provides the possibility to change or query the current status of -the current global domain of the <CODE>LC_MESSAGE</CODE> category. The -argument is a null-terminated string, whose characters must be legal in -the use in filenames. If the <VAR>domain_name</VAR> argument is <CODE>NULL</CODE>, -the function return the current value. If no value has been set -before, the name of the default domain is returned: <EM>messages</EM>. -Please note that although the return value of <CODE>textdomain</CODE> is of -type <CODE>char *</CODE> no changing is allowed. It is also important to know -that no checks of the availability are made. If the name is not -available you will see this by the fact that no translations are provided. - -</P> -<P> -To use a domain set by <CODE>textdomain</CODE> the function - -</P> - -<PRE> -char *gettext (const char *msgid); -</PRE> - -<P> -is to be used. This is the simplest reasonable form one can imagine. -The translation of the string <VAR>msgid</VAR> is returned if it is available -in the current domain. If not available the argument itself is -returned. If the argument is <CODE>NULL</CODE> the result is undefined. - -</P> -<P> -One things which should come into mind is that no explicit dependency to -the used domain is given. The current value of the domain for the -<CODE>LC_MESSAGES</CODE> locale is used. If this changes between two -executions of the same <CODE>gettext</CODE> call in the program, both calls -reference a different message catalog. - -</P> -<P> -For the easiest case, which is normally used in internationalized GNU -packages, once at the beginning of execution a call to <CODE>textdomain</CODE> -is issued, setting the domain to a unique name, normally the package -name. In the following code all strings which have to be translated are -filtered through the gettext function. That's all, the package speaks -your language. - -</P> - - -<H3><A NAME="SEC42" HREF="gettext_toc.html#TOC42">Solving Ambiguities</A></H3> - -<P> -While this single name domain work good for most applications there -might be the need to get translations from more than one domain. Of -course one could switch between different domains with calls to -<CODE>textdomain</CODE>, but this is really not convenient nor is it fast. A -possible situation could be one case discussing while this writing: all -error messages of functions in the set of common used functions should -go into a separate domain <CODE>error</CODE>. By this mean we would only need -to translate them once. - -</P> -<P> -For this reasons there are two more functions to retrieve strings: - -</P> - -<PRE> -char *dgettext (const char *domain_name, const char *msgid); -char *dcgettext (const char *domain_name, const char *msgid, - int category); -</PRE> - -<P> -Both take an additional argument at the first place, which corresponds -to the argument of <CODE>textdomain</CODE>. The third argument of -<CODE>dcgettext</CODE> allows to use another locale but <CODE>LC_MESSAGES</CODE>. -But I really don't know where this can be useful. If the -<VAR>domain_name</VAR> is <CODE>NULL</CODE> or <VAR>category</VAR> has an value beside -the known ones, the result is undefined. It should also be noted that -this function is not part of the second known implementation of this -function family, the one found in Solaris. - -</P> -<P> -A second ambiguity can arise by the fact, that perhaps more than one -domain has the same name. This can be solved by specifying where the -needed message catalog files can be found. - -</P> - -<PRE> -char *bindtextdomain (const char *domain_name, - const char *dir_name); -</PRE> - -<P> -Calling this function binds the given domain to a file in the specified -directory (how this file is determined follows below). Esp a file in -the systems default place is not favored against the specified file -anymore (as it would be by solely using <CODE>textdomain</CODE>). A <CODE>NULL</CODE> -pointer for the <VAR>dir_name</VAR> parameter returns the binding associated -with <VAR>domain_name</VAR>. If <VAR>domain_name</VAR> itself is <CODE>NULL</CODE> -nothing happens and a <CODE>NULL</CODE> pointer is returned. Here again as -for all the other functions is true that none of the return value must -be changed! - -</P> - - -<H3><A NAME="SEC43" HREF="gettext_toc.html#TOC43">Locating Message Catalog Files</A></H3> - -<P> -Because many different languages for many different packages have to be -stored we need some way to add these information to file message catalog -files. The way usually used in Unix environments is have this encoding -in the file name. This is also done here. The directory name given in -<CODE>bindtextdomain</CODE>s second argument (or the default directory), -followed by the value and name of the locale and the domain name are -concatenated: - -</P> - -<PRE> -<VAR>dir_name</VAR>/<VAR>locale</VAR>/LC_<VAR>category</VAR>/<VAR>domain_name</VAR>.mo -</PRE> - -<P> -The default value for <VAR>dir_name</VAR> is system specific. For the GNU -library it's: - -<PRE> -/usr/local/share/locale -</PRE> - -<P> -<VAR>locale</VAR> is the value of the locale whose name is this -<CODE>LC_<VAR>category</VAR></CODE>. For <CODE>gettext</CODE> and <CODE>dgettext</CODE> this -locale is always <CODE>LC_MESSAGES</CODE>. <CODE>dcgettext</CODE> specifies the -locale by the third argument.<A NAME="DOCF2" HREF="gettext_foot.html#FOOT2">(2)</A> <A NAME="DOCF3" HREF="gettext_foot.html#FOOT3">(3)</A> - -</P> - - -<H3><A NAME="SEC44" HREF="gettext_toc.html#TOC44">Optimization of the *gettext functions</A></H3> - -<P> -At this point of the discussion we should talk about an advantage of the -GNU <CODE>gettext</CODE> implementation. Some readers might have pointed out -that an internationalized program might have a poor performance if some -string has to be translated in an inner loop. While this is unavoidable -when the string varies from one run of the loop to the other it is -simply a waste of time when the string is always the same. Take the -following example: - -</P> - -<PRE> -{ - while (...) - { - puts (gettext ("Hello world")); - } -} -</PRE> - -<P> -When the locale selection does not change between two runs the resulting -string is always the same. One way to use this is: - -</P> - -<PRE> -{ - str = gettext ("Hello world"); - while (...) - { - puts (str); - } -} -</PRE> - -<P> -But this solution is not usable in all situation (e.g. when the locale -selection changes) nor is it good readable. - -</P> -<P> -The GNU C compiler, version 2.7 and above, provide another solution for -this. To describe this we show here some lines of the -<TT>`intl/libgettext.h'</TT> file. For an explanation of the expression -command block see section `Statements and Declarations in Expressions' in <CITE>The GNU CC Manual</CITE>. - -</P> - -<PRE> -# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7 -# define dcgettext(domainname, msgid, category) \ - (__extension__ \ - ({ \ - char *result; \ - if (__builtin_constant_p (msgid)) \ - { \ - extern int _nl_msg_cat_cntr; \ - static char *__translation__; \ - static int __catalog_counter__; \ - if (! __translation__ \ - || __catalog_counter__ != _nl_msg_cat_cntr) \ - { \ - __translation__ = \ - dcgettext__ ((domainname), (msgid), (category)); \ - __catalog_counter__ = _nl_msg_cat_cntr; \ - } \ - result = __translation__; \ - } \ - else \ - result = dcgettext__ ((domainname), (msgid), (category)); \ - result; \ - })) -# endif -</PRE> - -<P> -The interesting thing here is the <CODE>__builtin_constant_p</CODE> predicate. -This is evaluated at compile time and so optimization can take place -immediately. Here two cases are distinguished: the argument to -<CODE>gettext</CODE> is not a constant value in which case simply the function -<CODE>dcgettext__</CODE> is called, the real implementation of the -<CODE>dcgettext</CODE> function. - -</P> -<P> -If the string argument <EM>is</EM> constant we can reuse the once gained -translation when the locale selection has not changed. This is exactly -what is done here. The <CODE>_nl_msg_cat_cntr</CODE> variable is defined in -the <TT>`loadmsgcat.c'</TT> which is available in <TT>`libintl.a'</TT> and is -changed whenever a new message catalog is loaded. - -</P> - - -<H2><A NAME="SEC45" HREF="gettext_toc.html#TOC45">Comparing the Two Interfaces</A></H2> - -<P> -The following discussion is perhaps a little bit colored. As said -above we implemented GNU <CODE>gettext</CODE> following the Uniforum -proposal and this surely has its reasons. But it should show how we -came to this decision. - -</P> -<P> -First we take a look at the developing process. When we write an -application using NLS provided by <CODE>gettext</CODE> we proceed as always. -Only when we come to a string which might be seen by the users and thus -has to be translated we use <CODE>gettext("...")</CODE> instead of -<CODE>"..."</CODE>. At the beginning of each source file (or in a central -header file) we define - -</P> - -<PRE> -#define gettext(String) (String) -</PRE> - -<P> -Even this definition can be avoided when the system supports the -<CODE>gettext</CODE> function in its C library. When we compile this code the -result is the same as if no NLS code is used. When you take a look at -the GNU <CODE>gettext</CODE> code you will see that we use <CODE>_("...")</CODE> -instead of <CODE>gettext("...")</CODE>. This reduces the number of -additional characters per translatable string to <EM>3</EM> (in words: -three). - -</P> -<P> -When now a production version of the program is needed we simply replace -the definition - -</P> - -<PRE> -#define _(String) (String) -</PRE> - -<P> -by - -</P> - -<PRE> -#include <libintl.h> -#define _(String) gettext (String) -</PRE> - -<P> -and include the header <TT>`libintl.h'</TT>. Additionally we run the -program <TT>`xgettext'</TT> on all source code file which contain -translatable strings and we are gone. We have a running program which -does not depend on translations to be available, but which can use any -that becomes available. - -</P> -<P> -The same procedure can be done for the <CODE>gettext_noop</CODE> invocations -(see section <A HREF="gettext.html#SEC17">Special Cases of Translatable Strings</A>). First you can define <CODE>gettext_noop</CODE> to a -no-op macro and later use the definition from <TT>`libintl.h'</TT>. Because -this name is not used in Suns implementation of <TT>`libintl.h'</TT>, -you should consider the following code for your project: - -</P> - -<PRE> -#ifdef gettext_noop -# define N_(Str) gettext_noop (Str) -#else -# define N_(Str) (Str) -#endif -</PRE> - -<P> -<CODE>N_</CODE> is a short form similar to <CODE>_</CODE>. The <TT>`Makefile'</TT> in -the <TT>`po/'</TT> directory of GNU gettext knows by default both of the -mentioned short forms so you are invited to follow this proposal for -your own ease. - -</P> -<P> -Now to <CODE>catgets</CODE>. The main problem is the work for the -programmer. Every time he comes to a translatable string he has to -define a number (or a symbolic constant) which has also be defined in -the message catalog file. He also has to take care for duplicate -entries, duplicate message IDs etc. If he wants to have the same -quality in the message catalog as the GNU <CODE>gettext</CODE> program -provides he also has to put the descriptive comments for the strings and -the location in all source code files in the message catalog. This is -nearly a Mission: Impossible. - -</P> -<P> -But there are also some points people might call advantages speaking for -<CODE>catgets</CODE>. If you have a single word in a string and this string -is used in different contexts it is likely that in one or the other -language the word has different translations. Example: - -</P> - -<PRE> -printf ("%s: %d", gettext ("number"), number_of_errors) - -printf ("you should see %d %s", number_count, - number_count == 1 ? gettext ("number") : gettext ("numbers")) -</PRE> - -<P> -Here we have to translate two times the string <CODE>"number"</CODE>. Even -if you do not speak a language beside English it might be possible to -recognize that the two words have a different meaning. In German the -first appearance has to be translated to <CODE>"Anzahl"</CODE> and the second -to <CODE>"Zahl"</CODE>. - -</P> -<P> -Now you can say that this example is really esoteric. And you are -right! This is exactly how we felt about this problem and decide that -it does not weight that much. The solution for the above problem could -be very easy: - -</P> - -<PRE> -printf (gettext ("number: %d"), number_of_errors) - -printf (number_count == 1 ? gettext ("you should see %d number") - : gettext ("you should see %d numbers"), - number_count) -</PRE> - -<P> -We believe that we can solve all conflicts with this method. If it is -difficult one can also consider changing one of the conflicting string a -little bit. But it is not impossible to overcome. - -</P> -<P> -Translator note: It is perhaps appropriate here to tell those English -speaking programmers that the plural form of a noun cannot be formed by -appending a single `s'. Most other languages use different methods. So -you should at least use the method given in the above example. - -</P> -<P> -But I have been told that some languages have even more complex rules. -A good approach might be to consider methods like the one used for -<CODE>LC_TIME</CODE> in the POSIX.2 standard. - -</P> - - - -<H2><A NAME="SEC46" HREF="gettext_toc.html#TOC46">Using libintl.a in own programs</A></H2> - -<P> -Starting with version 0.9.4 the library <CODE>libintl.h</CODE> should be more -or less self-contained. I.e. you can use it in your own programs. The -<TT>`Makefile'</TT> will put the header and the library in directories -selected using the <CODE>$(prefix)</CODE>. - -</P> -<P> -One exception of the above is found on HP-UX systems. Here the C library -does not contain the <CODE>alloca</CODE> function (and the HP compiler does -not generate it inlined). But it is not intended to rewrite the whole -library just because of this dumb system. Instead include the -<CODE>alloca</CODE> function in all package you use the <CODE>libintl.a</CODE> in. - -</P> - - - -<H2><A NAME="SEC47" HREF="gettext_toc.html#TOC47">Being a <CODE>gettext</CODE> grok</A></H2> - -<P> -To fully exploit the functionality of the GNU <CODE>gettext</CODE> library it -is surely helpful to read the source code. But for those who don't want -to spend that much time in reading the (sometimes complicated) code here -is a list comments: - -</P> - -<UL> -<LI>Changing the language at runtime - -For interactive programs it might be useful to offer a selection of the -used language at runtime. To understand how to do this one need to know -how the used language is determined while executing the <CODE>gettext</CODE> -function. The method which is presented here only works correctly -with the GNU implementation of the <CODE>gettext</CODE> functions. It is not -possible with underlying <CODE>catgets</CODE> functions or <CODE>gettext</CODE> -functions from the systems C library. The exception is of course the -GNU C Library which uses the GNU gettext Library for message handling. - -In the function <CODE>dcgettext</CODE> at every call the current setting of -the highest priority environment variable is determined and used. -Highest priority means here the following list with decreasing -priority: - - -<OL> -<LI><CODE>LANGUAGE</CODE> - -<LI><CODE>LC_ALL</CODE> - -<LI><CODE>LC_xxx</CODE>, according to selected locale - -<LI><CODE>LANG</CODE> - -</OL> - -Afterwards the path is constructed using the found value and the -translation file is loaded if available. - -What is now when the value for, say, <CODE>LANGUAGE</CODE> changes. According -to the process explained above the new value of this variable is found -as soon as the <CODE>dcgettext</CODE> function is called. But this also means -the (perhaps) different message catalog file is loaded. In other -words: the used language is changed. - -But there is one little hook. The code for gcc-2.7.0 and up provides -some optimization. This optimization normally prevents the calling of -the <CODE>dcgettext</CODE> function as long as now new catalog is loaded. But -if <CODE>dcgettext</CODE> is not called we program also cannot find the -<CODE>LANGUAGE</CODE> variable be changed (see section <A HREF="gettext.html#SEC44">Optimization of the *gettext functions</A>). But the -solution is very easy. Include the following code in the language -switching function. - - -<PRE> - /* Change language. */ - setenv ("LANGUAGE", "fr", 1); - - /* Make change known. */ - { - extern int _nl_msg_cat_cntr; - ++_nl_msg_cat_cntr; - } -</PRE> - -The variable <CODE>_nl_msg_cat_cntr</CODE> is defined in <TT>`loadmsgcat.c'</TT>. - -</UL> - - - -<H2><A NAME="SEC48" HREF="gettext_toc.html#TOC48">Temporary Notes for the Programmers Chapter</A></H2> - - - -<H3><A NAME="SEC49" HREF="gettext_toc.html#TOC49">Temporary - Two Possible Implementations</A></H3> - -<P> -There are two competing methods for language independent messages: -the X/Open <CODE>catgets</CODE> method, and the Uniforum <CODE>gettext</CODE> -method. The <CODE>catgets</CODE> method indexes messages by integers; the -<CODE>gettext</CODE> method indexes them by their English translations. -The <CODE>catgets</CODE> method has been around longer and is supported -by more vendors. The <CODE>gettext</CODE> method is supported by Sun, -and it has been heard that the COSE multi-vendor initiative is -supporting it. Neither method is a POSIX standard; the POSIX.1 -committee had a lot of disagreement in this area. - -</P> -<P> -Neither one is in the POSIX standard. There was much disagreement -in the POSIX.1 committee about using the <CODE>gettext</CODE> routines -vs. <CODE>catgets</CODE> (XPG). In the end the committee couldn't -agree on anything, so no messaging system was included as part -of the standard. I believe the informative annex of the standard -includes the XPG3 messaging interfaces, "...as an example of -a messaging system that has been implemented..." - -</P> -<P> -They were very careful not to say anywhere that you should use one -set of interfaces over the other. For more on this topic please -see the Programming for Internationalization FAQ. - -</P> - - -<H3><A NAME="SEC50" HREF="gettext_toc.html#TOC50">Temporary - About <CODE>catgets</CODE></A></H3> - -<P> -There have been a few discussions of late on the use of -<CODE>catgets</CODE> as a base. I think it important to present both -sides of the argument and hence am opting to play devil's advocate -for a little bit. - -</P> -<P> -I'll not deny the fact that <CODE>catgets</CODE> could have been designed -a lot better. It currently has quite a number of limitations and -these have already been pointed out. - -</P> -<P> -However there is a great deal to be said for consistency and -standardization. A common recurring problem when writing Unix -software is the myriad portability problems across Unix platforms. -It seems as if every Unix vendor had a look at the operating system -and found parts they could improve upon. Undoubtedly, these -modifications are probably innovative and solve real problems. -However, software developers have a hard time keeping up with all -these changes across so many platforms. - -</P> -<P> -And this has prompted the Unix vendors to begin to standardize their -systems. Hence the impetus for Spec1170. Every major Unix vendor -has committed to supporting this standard and every Unix software -developer waits with glee the day they can write software to this -standard and simply recompile (without having to use autoconf) -across different platforms. - -</P> -<P> -As I understand it, Spec1170 is roughly based upon version 4 of the -X/Open Portability Guidelines (XPG4). Because <CODE>catgets</CODE> and -friends are defined in XPG4, I'm led to believe that <CODE>catgets</CODE> -is a part of Spec1170 and hence will become a standardized component -of all Unix systems. - -</P> - - -<H3><A NAME="SEC51" HREF="gettext_toc.html#TOC51">Temporary - Why a single implementation</A></H3> - -<P> -Now it seems kind of wasteful to me to have two different systems -installed for accessing message catalogs. If we do want to remedy -<CODE>catgets</CODE> deficiencies why don't we try to expand <CODE>catgets</CODE> -(in a compatible manner) rather than implement an entirely new system. -Otherwise, we'll end up with two message catalog access systems -installed with an operating system - one set of routines for GNU -software, and another set of routines (catgets) for all other software. -Bloated? - -</P> -<P> -Supposing another catalog access system is implemented. Which do -we recommend? At least for Linux, we need to attract as many -software developers as possible. Hence we need to make it as easy -for them to port their software as possible. Which means supporting -<CODE>catgets</CODE>. We will be implementing the <CODE>glocale</CODE> code -within our <CODE>libc</CODE>, but does this mean we also have to incorporate -another message catalog access scheme within our <CODE>libc</CODE> as well? -And what about people who are going to be using the <CODE>glocale</CODE> -+ non-<CODE>catgets</CODE> routines. When they port their software to -other platforms, they're now going to have to include the front-end -(<CODE>glocale</CODE>) code plus the back-end code (the non-<CODE>catgets</CODE> -access routines) with their software instead of just including the -<CODE>glocale</CODE> code with their software. - -</P> -<P> -Message catalog support is however only the tip of the iceberg. -What about the data for the other locale categories. They also have -a number of deficiencies. Are we going to abandon them as well and -develop another duplicate set of routines (should <CODE>glocale</CODE> -expand beyond message catalog support)? - -</P> -<P> -Like many parts of Unix that can be improved upon, we're stuck with balancing -compatibility with the past with useful improvements and innovations for -the future. - -</P> - - -<H3><A NAME="SEC52" HREF="gettext_toc.html#TOC52">Temporary - Double layer solution</A></H3> - -<P> -GNU locale implements a <CODE>gettext</CODE>-style interface on top of a -<CODE>catgets</CODE>-style interface. - -</P> -<P> -This is not needless complexity. It is absolutely vital, because -it enables <CODE>gettext</CODE> to run on top of <CODE>catgets</CODE>, which -enables Linux International to recommend users use it <EM>today</EM>. - -</P> -<P> -Rewriting <CODE>gettext</CODE> so that it could use <EM>either</EM> -<CODE>catgets</CODE> <EM>or</EM> some simpler mechanism would not break -anything, but would not reduce complexity either. It might be -worth doing, but it isn't urgent. - -</P> -<P> -In general, simplicity is not enough of a reason to rewrite a -program that works. Simplicity is just one desirable thing. -It is not overridingly important. - -</P> - - -<H3><A NAME="SEC53" HREF="gettext_toc.html#TOC53">Temporary - Notes</A></H3> - -<P> -X/Open agreed very late on the standard form so that many -implementations differ from the final form. Both of my system (old -Linux catgets and Ultrix-4) have a strange variation. - -</P> -<P> -OK. After incorporating the last changes I have to spend some time on -making the GNU/Linux libc gettext functions. So in future Solaris is -not the only system having gettext. - -</P> - - -<H1><A NAME="SEC54" HREF="gettext_toc.html#TOC54">The Translator's View</A></H1> - - - -<H2><A NAME="SEC55" HREF="gettext_toc.html#TOC55">Introduction 0</A></H2> - -<P> -GNU is going international! The GNU Translation Project is a way -to get maintainers, translators and users all together, so GNU will -gradually become able to speak many native languages. - -</P> -<P> -The GNU <CODE>gettext</CODE> tool set contains <EM>everything</EM> maintainers -need for internationalizing their packages for messages. It also -contains quite useful tools for helping translators at localizing -messages to their native language, once a package has already been -internationalized. - -</P> -<P> -To achieve the GNU Translation Project, we need many interested -people who like their own language and write it well, and who are also -able to synergize with other translators speaking the same language. -If you'd like to volunteer to <EM>work</EM> at translating messages, -please send mail to your translating team. - -</P> -<P> -Each team has its own mailing list, courtesy of Linux -International. You may reach your translating team at the address -<TT>`<VAR>ll</VAR>@li.org'</TT>, replacing <VAR>ll</VAR> by the two-letter ISO 639 -code for your language. Language codes are <EM>not</EM> the same as -country codes given in ISO 3166. The following translating teams -exist: - -</P> - -<BLOCKQUOTE> -<P> -Chinese <CODE>zh</CODE>, Czech <CODE>cs</CODE>, Danish <CODE>da</CODE>, Dutch <CODE>nl</CODE>, -Esperanto <CODE>eo</CODE>, Finnish <CODE>fi</CODE>, French <CODE>fr</CODE>, Irish -<CODE>ga</CODE>, German <CODE>de</CODE>, Greek <CODE>el</CODE>, Italian <CODE>it</CODE>, -Japanese <CODE>ja</CODE>, Indonesian <CODE>in</CODE>, Norwegian <CODE>no</CODE>, Polish -<CODE>pl</CODE>, Portuguese <CODE>pt</CODE>, Russian <CODE>ru</CODE>, Spanish <CODE>es</CODE>, -Swedish <CODE>sv</CODE> and Turkish <CODE>tr</CODE>. -</BLOCKQUOTE> - -<P> -For example, you may reach the Chinese translating team by writing to -<TT>`zh@li.org'</TT>. When you become a member of the translating team -for your own language, you may subscribe to its list. For example, -Swedish people can send a message to <TT>`sv-request@li.org'</TT>, -having this message body: - -</P> - -<PRE> -subscribe -</PRE> - -<P> -Keep in mind that team members should be interested in <EM>working</EM> -at translations, or at solving translational difficulties, rather than -merely lurking around. If your team does not exist yet and you want to -start one, please write to <TT>`gnu-translation@prep.ai.mit.edu'</TT>; -you will then reach the GNU coordinator for all translator teams. - -</P> -<P> -A handful of GNU packages have already been adapted and provided -with message translations for several languages. Translation -teams have begun to organize, using these packages as a starting -point. But there are many more packages and many languages for -which we have no volunteer translators. If you would like to -volunteer to work at translating messages, please send mail to -<TT>`gnu-translation@prep.ai.mit.edu'</TT> indicating what language(s) -you can work on. - -</P> - - -<H2><A NAME="SEC56" HREF="gettext_toc.html#TOC56">Introduction 1</A></H2> - -<P> -This is now official, GNU is going international! Here is the -announcement submitted for the January 1995 GNU Bulletin: - -</P> - -<BLOCKQUOTE> -<P> -A handful of GNU packages have already been adapted and provided -with message translations for several languages. Translation -teams have begun to organize, using these packages as a starting -point. But there are many more packages and many languages -for which we have no volunteer translators. If you'd like to -volunteer to work at translating messages, please send mail to -<SAMP>`gnu-translation@prep.ai.mit.edu'</SAMP> indicating what language(s) -you can work on. -</BLOCKQUOTE> - -<P> -This document should answer many questions for those who are curious -about the process or would like to contribute. Please at least skim -over it, hoping to cut down a little of the high volume of email -generated by this collective effort towards GNU internationalization. - -</P> -<P> -GNU programming is done in English, and currently, English is used -as the main communicating language between national communities -collaborating to the GNU project. This very document is written -in English. This will not change in the foreseeable future. - -</P> -<P> -However, there is a strong appetite from national communities for -having more software able to write using national language and habits, -and there is an on-going effort to modify GNU software in such a way -that it becomes able to do so. The experiments driven so far raised -an enthusiastic response from pretesters, so we believe that GNU -internationalization is dedicated to succeed. - -</P> -<P> -For suggestion clarifications, additions or corrections to this -document, please email to <TT>`gnu-translation@prep.ai.mit.edu'</TT>. - -</P> - - -<H2><A NAME="SEC57" HREF="gettext_toc.html#TOC57">Discussions</A></H2> - -<P> -Facing this internationalization effort, a few users expressed their -concerns. Some of these doubts are presented and discussed, here. - -</P> - -<UL> -<LI>Smaller groups - -Some languages are not spoken by a very large number of people, -so people speaking them sometimes consider that there may not be -all that much demand such versions of GNU packages. Moreover, many -people being <EM>into computers</EM>, in some countries, generally seem -to prefer English versions of their software. - -On the other end, people might enjoy their own language a lot, and -be very motivated at providing to themselves the pleasure of having -their beloved GNU software speaking their mother tongue. They do -themselves a personal favor, and do not pay that much attention to -the number of people beneficiating of their work. - -<LI>Misinterpretation - -Other users are shy to push forward their own language, seeing in this -some kind of misplaced propaganda. Someone thought there must be some -users of the language over the networks pestering other people with it. - -But any spoken language is worth localization, because there are -people behind the language for whom the language is important and -dear to their hearts. - -<LI>Odd translations - -The biggest problem is to find the right translations so that -everybody can understand the messages. Translations are usually a -little odd. Some people get used to English, to the extent they may -find translations into their own language "rather pushy, obnoxious -and sometimes even hilarious." As a French speaking man, I have -the experience of those instruction manuals for goods, so poorly -translated in French in Korea or Taiwan... - -The fact is that we sometimes have to create a kind of national -computer culture, and this is not easy without the collaboration of -many people liking their mother tongue. This is why translations are -better achieved by people knowing and loving their own language, and -ready to work together at improving the results they obtain. - -<LI>Dependencies over the GPL - -Some people wonder if using GNU <CODE>gettext</CODE> necessarily brings their package -under the protective wing of the GNU General Public License, when they -do not want to make their program free, or want other kinds of freedom. -The simplest answer is yes. - -The mere marking of localizable strings in a package, or conditional -inclusion of a few lines for initialization, is not really including -GPL'ed code. However, the localization routines themselves are under -the GPL and would bring the remainder of the package under the GPL -if they were distributed with it. So, I presume that, for those -for which this is a problem, it could be circumvented by letting to -the end installers the burden of assembling a package prepared for -localization, but not providing the localization routines themselves. - -</UL> - - - -<H2><A NAME="SEC58" HREF="gettext_toc.html#TOC58">Organization</A></H2> - -<P> -On a larger scale, the true solution would be to organize some kind of -fairly precise set up in which volunteers could participate. I gave -some thought to this idea lately, and realize there will be some -touchy points. I thought of writing to Richard Stallman to launch -such a project, but feel it might be good to shake out the ideas -between ourselves first. Most probably that Linux International has -some experience in the field already, or would like to orchestrate -the volunteer work, maybe. Food for thought, in any case! - -</P> -<P> -I guess we have to setup something early, somehow, that will help -many possible contributors of the same language to interlock and avoid -work duplication, and further be put in contact for solving together -problems particular to their tongue (in most languages, there are many -difficulties peculiar to translating technical English). My Swedish -contributor acknowledged these difficulties, and I'm well aware of -them for French. - -</P> -<P> -This is surely not a technical issue, but we should manage so the -effort of locale contributors be maximally useful, despite the national -team layer interface between contributors and maintainers. - -</P> -<P> -GNU needs some setup for coordinating language coordinators. -Localizing evolving GNU programs will surely become a permanent -and continuous activity in GNU, once started. The setup should be -minimally completed and tested before GNU <CODE>gettext</CODE> becomes an official -reality. The email address <TT>`gnu-translation@prep.ai.mit.edu'</TT> -has been setup for receiving offers from volunteers and general -email on these topics. This address reaches the GNU Translation -Project coordinator. - -</P> - - - -<H3><A NAME="SEC59" HREF="gettext_toc.html#TOC59">Central Coordination</A></H3> - -<P> -I also think GNU will need sooner than it thinks, that someone setup -a way to organize and coordinate these groups. Some kind of group -of groups. My opinion is that it would be good that GNU delegate -this task to a small group of collaborating volunteers, shortly. -Perhaps in <TT>`gnu.announce'</TT> a list of this national committee's -can be published. - -</P> -<P> -My role as coordinator would simply be to refer to Ulrich any German -speaking volunteer interested to localization of GNU programs, and -maybe helping national groups to initially organize, while maintaining -national registries for until national groups are ready to take over. -In fact, the coordinator should ease volunteers to get in contact with -one another for creating national teams, which should then select -one coordinator per language, or country (regionalized language). -If well done, the coordination should be useful without being an -overwhelming task, the time to put delegations in place. - -</P> - - -<H3><A NAME="SEC60" HREF="gettext_toc.html#TOC60">National Teams</A></H3> - -<P> -I suggest we look for volunteer coordinators/editors for individual -languages. These people will scan contributions of translation files -for various programs, for their own languages, and will ensure high -and uniform standards of diction. - -</P> -<P> -From my current experience with other people in these days, those who -provide localizations are very enthusiastic about the process, and are -more interested in the localization process than in the program they -localize, and want to do many programs, not just one. This seems -to confirm that having a coordinator/editor for each language is a -good idea. - -</P> -<P> -We need to choose someone who is good at writing clear and concise -prose in the language in question. That is hard--we can't check -it ourselves. So we need to ask a few people to judge each others' -writing and select the one who is best. - -</P> -<P> -I announce my prerelease to a few dozen people, and you would not -believe all the discussions it generated already. I shudder to think -what will happen when this will be launched, for true, officially, -world wide. Who am I to arbitrate between two Czekolsovak users -contradicting each other, for example? - -</P> -<P> -I assume that your German is not much better than my French so that -I would not be able to judge about these formulations. What I would -suggest is that for each language there is a group for people who -maintain the PO files and judge about changes. I suspect there will -be cultural differences between how such groups of people will behave. -Some will have relaxed ways, reach consensus easily, and have anyone -of the group relate to the maintainers, while others will fight to -death, organize heavy administrations up to national standards, and -use strict channels. - -</P> -<P> -The German team is putting out a good example. Right now, they are -maybe half a dozen people revising translations of each other and -discussing the linguistic issues. I do not even have all the names. -Ulrich Drepper is taking care of coordinating the German team. -He subscribed to all my pretest lists, so I do not even have to warn -him specifically of incoming releases. - -</P> -<P> -I'm sure, that is a good idea to get teams for each language working -on translations. That will make the translations better and more -consistent. - -</P> - - - -<H4><A NAME="SEC61" HREF="gettext_toc.html#TOC61">Sub-Cultures</A></H4> - -<P> -Taking French for example, there are a few sub-cultures around -computers which developed diverging vocabularies. Picking volunteers -here and there without addressing this problem in an organized way, -soon in the project, might produce a distasteful mix of GNU programs, -and possibly trigger endless quarrels among those who really care. - -</P> -<P> -Keeping some kind of unity in the way French localization of GNU -programs is achieved is a difficult (and delicate) job. Knowing the -latin character of French people (:-), if we take this the wrong -way, we could end up nowhere, or spoil a lot of energies. Maybe we -should begin to address this problem seriously <EM>before</EM> GNU -<CODE>gettext</CODE> become officially published. And I suspect that this -means soon! - -</P> - - -<H4><A NAME="SEC62" HREF="gettext_toc.html#TOC62">Organizational Ideas</A></H4> - -<P> -I expect the next big changes after the official release. Please note -that I use the German translation of the short GPL message. We need -to set a few good examples before the localization goes out for true -in GNU. Here are a few points to discuss: - -</P> - -<UL> -<LI> - -Each group should have one FTP server (at least one master). - -<LI> - -The files on the server should reflect the latest version (of -course!) and it should also contain a RCS directory with the -corresponding archives (I don't have this now). - -<LI> - -There should also be a ChangeLog file (this is more useful than the -RCS archive but can be generated automatically from the later by -Emacs). - -<LI> - -A <STRONG>core group</STRONG> should judge about questionable changes (for now -this group consists solely by me but I ask some others occasionally; -this also seems to work). - -</UL> - - - -<H3><A NAME="SEC63" HREF="gettext_toc.html#TOC63">Mailing Lists</A></H3> - -<P> -If we get any inquiries about GNU <CODE>gettext</CODE>, send them on to: - -</P> - -<PRE> -<TT>`gnu-translation@prep.ai.mit.edu'</TT> -</PRE> - -<P> -The <TT>`*-pretest'</TT> lists are quite useful to me, maybe the idea could -be generalized to all GNU packages. But each maintainer his/her way! - -</P> -<P> -, we have a mechanism in place here at -<TT>`gnu.ai.mit.edu'</TT> to track teams, support mailing lists for -them and log members. We have a slight preference that you use it. -If this is OK with you, I can get you clued in. - -</P> -<P> -Things are changing! A few years ago, when Daniel Fekete and I -asked for a mailing list for GNU localization, nested at the FSF, we -were politely invited to organize it anywhere else, and so did we. -For communicating with my pretesters, I later made a handful of -mailing lists located at iro.umontreal.ca and administrated by -<CODE>majordomo</CODE>. These lists have been <EM>very</EM> dependable -so far... - -</P> -<P> -I suspect that the German team will organize itself a mailing list -located in Germany, and so forth for other countries. But before they -organize for true, it could surely be useful to offer mailing lists -located at the FSF to each national team. So yes, please explain me -how I should proceed to create and handle them. - -</P> -<P> -We should create temporary mailing lists, one per country, to help -people organize. Temporary, because once regrouped and structured, it -would be fair the volunteers from country bring back <EM>their</EM> list -in there and manage it as they want. My feeling is that, in the long -run, each team should run its own list, from within their country. -There also should be some central list to which all teams could -subscribe as they see fit, as long as each team is represented in it. - -</P> - - -<H2><A NAME="SEC64" HREF="gettext_toc.html#TOC64">Information Flow</A></H2> - -<P> -There will surely be some discussion about this messages after the -packages are finally released. If people now send you some proposals -for better messages, how do you proceed? Jim, please note that -right now, as I put forward nearly a dozen of localizable programs, I -receive both the translations and the coordination concerns about them. - -</P> -<P> -If I put one of my things to pretest, Ulrich receives the announcement -and passes it on to the German team, who make last minute revisions. -Then he submits the translation files to me <EM>as the maintainer</EM>. -For GNU packages I do not maintain, I would not even hear about it. -This scheme could be made to work GNU-wide, I think. For security -reasons, maybe Ulrich (national coordinators, in fact) should update -central registry kept by GNU (Jim, me, or Len's recruits) once in -a while. - -</P> -<P> -In December/January, I was aggressively ready to internationalize -all of GNU, giving myself the duty of one small GNU package per week -or so, taking many weeks or months for bigger packages. But it does -not work this way. I first did all the things I'm responsible for. -I've nothing against some missionary work on other maintainers, but -I'm also loosing a lot of energy over it--same debates over again. - -</P> -<P> -And when the first localized packages are released we'll get a lot of -responses about ugly translations :-). Surely, and we need to have -beforehand a fairly good idea about how to handle the information -flow between the national teams and the package maintainers. - -</P> -<P> -Please start saving somewhere a quick history of each PO file. I know -for sure that the file format will change, allowing for comments. -It would be nice that each file has a kind of log, and references for -those who want to submit comments or gripes, or otherwise contribute. -I sent a proposal for a fast and flexible format, but it is not -receiving acceptance yet by the GNU deciders. I'll tell you when I -have more information about this. - -</P> - - -<H1><A NAME="SEC65" HREF="gettext_toc.html#TOC65">The Maintainer's View</A></H1> - -<P> -The maintainer of a package has many responsibilities. One of them -is ensuring that the package will install easily on many platforms, -and that the magic we described earlier (see section <A HREF="gettext.html#SEC32">The User's View</A>) will work -for installers and end users. - -</P> -<P> -Of course, there are many possible ways by which GNU <CODE>gettext</CODE> -might be integrated in a distribution, and this chapter does not cover -them in all generality. Instead, it details one possible approach -which is especially adequate for many GNU distributions, because -GNU <CODE>gettext</CODE> is purposely for helping the internationalization -of the whole GNU project. So, the maintainer's view presented here -presumes that the package already has a <TT>`configure.in'</TT> file and -uses Autoconf. - -</P> -<P> -Nevertheless, GNU <CODE>gettext</CODE> may surely be useful for non-GNU -packages, but the maintainers of such packages might have to show -imagination and initiative in organizing their distributions so -<CODE>gettext</CODE> work for them in all situations. There are surely -many, out there. - -</P> -<P> -Even if <CODE>gettext</CODE> methods are now stabilizing, slight adjustments -might be needed between successive <CODE>gettext</CODE> versions, so you -should ideally revise this chapter in subsequent releases, looking -for changes. - -</P> - - - -<H2><A NAME="SEC66" HREF="gettext_toc.html#TOC66">Flat or Non-Flat Directory Structures</A></H2> - -<P> -Some GNU packages are distributed as <CODE>tar</CODE> files which unpack -in a single directory, these are said to be <STRONG>flat</STRONG> distributions. -Other GNU packages have a one level hierarchy of subdirectories, using -for example a subdirectory named <TT>`doc/'</TT> for the Texinfo manual and -man pages, another called <TT>`lib/'</TT> for holding functions meant to -replace or complement C libraries, and a subdirectory <TT>`src/'</TT> for -holding the proper sources for the package. These other distributions -are said to be <STRONG>non-flat</STRONG>. - -</P> -<P> -For now, we cannot say much about flat distributions. A flat -directory structure has the disadvantage of increasing the difficulty -of updating to a new version of GNU <CODE>gettext</CODE>. Also, if you have -many PO files, this could somewhat pollute your single directory. -In the GNU <CODE>gettext</CODE> distribution, the <TT>`misc/'</TT> directory -contains a shell script named <TT>`combine-sh'</TT>. That script may -be used for combining all the C files of the <TT>`intl/'</TT> directory -into a pair of C files (one <TT>`.c'</TT> and one <TT>`.h'</TT>). Those two -generated files would fit more easily in a flat directory structure, -and you will then have to add these two files to your project. - -</P> -<P> -Maybe because GNU <CODE>gettext</CODE> itself has a non-flat structure, -we have more experience with this approach, and this is what will be -described in the remaining of this chapter. Some maintainers might -use this as an opportunity to unflatten their package structure. -Only later, once gained more experience adapting GNU <CODE>gettext</CODE> -to flat distributions, we might add some notes about how to proceed -in flat situations. - -</P> - - -<H2><A NAME="SEC67" HREF="gettext_toc.html#TOC67">Prerequisite Works</A></H2> - -<P> -There are some works which are required for using GNU <CODE>gettext</CODE> -in one of your package. These works have some kind of generality -that escape the point by point descriptions used in the remainder -of this chapter. So, we describe them here. - -</P> - -<UL> -<LI> - -Before attempting to use you should install some other packages first. -Ensure that recent versions of GNU <CODE>m4</CODE>, GNU Autoconf and GNU -<CODE>gettext</CODE> are already installed at your site, and if not, proceed -to do this first. If you got to install these things, beware that -GNU <CODE>m4</CODE> must be fully installed before GNU Autoconf is even -<EM>configured</EM>. - -Those three packages are only needed to you, as a maintainer; the -installers of your own package and end users do not really need any -of GNU <CODE>m4</CODE>, GNU Autoconf or GNU <CODE>gettext</CODE> for successfully -installing and running your package, with messages properly translated. -But this is not completely true if you provide internationalized -shell scripts within your own package: GNU <CODE>gettext</CODE> shall -then be installed at the user site if the end users want to see the -translation of shell script messages. - -<LI> - -Your package should use Autoconf and have a <TT>`configure.in'</TT> file. -If it does not, you have to learn how. The Autoconf documentation -is quite well written, it is a good idea that you print it and get -familiar with it. - -<LI> - -Your C sources should have already been modified according to -instructions given earlier in this manual. See section <A HREF="gettext.html#SEC13">Preparing Program Sources</A>. - -<LI> - -Your <TT>`po/'</TT> directory should receive all PO files submitted to you -by the translator teams, each having <TT>`<VAR>ll</VAR>.po'</TT> as a name. -This is not usually easy to get translation -work done before your package gets internationalized and available! -Since the cycle has to start somewhere, the easiest for the maintainer -is to start with absolutely no PO files, and wait until various -translator teams get interested in your package, and submit PO files. - -</UL> - -<P> -It is worth adding here a few words about how the maintainer should -ideally behave with PO files submissions. As a maintainer, your -role is to authentify the origin of the submission as being the -representative of the appropriate GNU translating team (forward the -submission to <TT>`gnu-translation@prep.ai.mit.edu'</TT> in case of -doubt), to ensure that the PO file format is not severely broken and -does not prevent successful installation, and for the rest, to merely -to put these PO files in <TT>`po/'</TT> for distribution. - -</P> -<P> -As a maintainer, you do not have to take on your shoulders the -responsibility of checking if the translations are adequate or -complete, and should avoid diving into linguistic matters. Translation -teams drive themselves and are fully responsible of their linguistic -choices for GNU. Keep in mind that translator teams are <EM>not</EM> -driven by maintainers. You can help by carefully redirecting all -communications and reports from users about linguistic matters to the -appropriate translation team, or explain users how to reach or join -their team. The simplest might be to send them the <TT>`NLS'</TT> file. - -</P> -<P> -Maintainers should <EM>never ever</EM> apply PO file bug reports -themselves, short-cutting translation teams. If some translator has -difficulty to get some of her points through her team, it should not be -an issue for her to directly negotiate translations with maintainers. -Teams ought to settle their problems themselves, if any. If you, as -a maintainer, ever think there is a real problem with a team, please -never try to <EM>solve</EM> a team's problem on your own. - -</P> - - -<H2><A NAME="SEC68" HREF="gettext_toc.html#TOC68">Invoking the <CODE>gettextize</CODE> Program</A></H2> - -<P> -Some files are consistently and identically needed in every package -internationalized through GNU <CODE>gettext</CODE>. As a matter of -convenience, the <CODE>gettextize</CODE> program puts all these files right -in your package. This program has the following synopsis: - -</P> - -<PRE> -gettextize [ <VAR>option</VAR>... ] [ <VAR>directory</VAR> ] -</PRE> - -<P> -and accepts the following options: - -</P> -<DL COMPACT> - -<DT><SAMP>`-f'</SAMP> -<DD> -<DT><SAMP>`--force'</SAMP> -<DD> -Force replacement of files which already exist. - -<DT><SAMP>`-h'</SAMP> -<DD> -<DT><SAMP>`--help'</SAMP> -<DD> -Display this help and exit. - -<DT><SAMP>`--version'</SAMP> -<DD> -Output version information and exit. - -</DL> - -<P> -If <VAR>directory</VAR> is given, this is the top level directory of a -package to prepare for using GNU <CODE>gettext</CODE>. If not given, it -is assumed that the current directory is the top level directory of -such a package. - -</P> -<P> -The program <CODE>gettextize</CODE> provides the following files. However, -no existing file will be replaced unless the option <CODE>--force</CODE> -(<CODE>-f</CODE>) is specified. - -</P> - -<OL> -<LI> - -The <TT>`NLS'</TT> file is copied in the main directory of your package, -the one being at the top level. This file gives the main indications -about how to install and use the Native Language Support features -of your program. You might elect to use a more recent copy of this -<TT>`NLS'</TT> file than the one provided through <CODE>gettextize</CODE>, if -you have one handy. You may also fetch a more recent copy of file -<TT>`NLS'</TT> from most GNU archive sites. - -<LI> - -A <TT>`po/'</TT> directory is created for eventually holding -all translation files, but initially only containing the file -<TT>`po/Makefile.in.in'</TT> from the GNU <CODE>gettext</CODE> distribution. -(beware the double <SAMP>`.in'</SAMP> in the file name). If the <TT>`po/'</TT> -directory already exists, it will be preserved along with the files -it contains, and only <TT>`Makefile.in.in'</TT> will be overwritten. - -<LI> - -A <TT>`intl/'</TT> directory is created and filled with most of the files -originally in the <TT>`intl/'</TT> directory of the GNU <CODE>gettext</CODE> -distribution. Also, if option <CODE>--force</CODE> (<CODE>-f</CODE>) is given, -the <TT>`intl/'</TT> directory is emptied first. - -</OL> - -<P> -If your site support symbolic links, <CODE>gettextize</CODE> will not -actually copy the files into your package, but establish symbolic -links instead. This avoids duplicating the disk space needed in -all packages. Merely using the <SAMP>`-h'</SAMP> option while creating the -<CODE>tar</CODE> archive of your distribution will resolve each link by an -actual copy in the distribution archive. So, to insist, you really -should use <SAMP>`-h'</SAMP> option with <CODE>tar</CODE> within your <CODE>dist</CODE> -goal of your main <TT>`Makefile.in'</TT>. - -</P> -<P> -It is interesting to understand that most new files for supporting -GNU <CODE>gettext</CODE> facilities in one package go in <TT>`intl/'</TT> -and <TT>`po/'</TT> subdirectories. One distinction between these two -directories is that <TT>`intl/'</TT> is meant to be completely identical -in all packages using GNU <CODE>gettext</CODE>, while all newly created -files, which have to be different, go into <TT>`po/'</TT>. There is a -common <TT>`Makefile.in.in'</TT> in <TT>`po/'</TT>, because the <TT>`po/'</TT> -directory needs its own <TT>`Makefile'</TT>, and it has been designed so -it can be identical in all packages. - -</P> - - -<H2><A NAME="SEC69" HREF="gettext_toc.html#TOC69">Files You Must Create or Alter</A></H2> - -<P> -Besides files which are automatically added through <CODE>gettextize</CODE>, -there are many files needing revision for properly interacting with -GNU <CODE>gettext</CODE>. If you are closely following GNU standards for -Makefile engineering and auto-configuration, the adaptations should -be easier to achieve. Here is a point by point description of the -changes needed in each. - -</P> -<P> -So, here comes a list of files, each one followed by a description of -all alterations it needs. Many examples are taken out from the GNU -<CODE>gettext</CODE> 0.10 distribution itself. You may indeed -refer to the source code of the GNU <CODE>gettext</CODE> package, as it -is intended to be a good example and master implementation for using -its own functionality. - -</P> - - - -<H3><A NAME="SEC70" HREF="gettext_toc.html#TOC70"><TT>`POTFILES'</TT> in <TT>`po/'</TT></A></H3> - -<P> -The <TT>`po/'</TT> directory should receive a file named -<TT>`POTFILES.in'</TT>. This file tells which files, among all program -sources, have marked strings needing translation. Here is an example -of such a file: - -</P> - -<PRE> -# List of source files containing translatable strings. -# Copyright (C) 1995 Free Software Foundation, Inc. - -# Common library files -lib/error.c -lib/getopt.c -lib/xmalloc.c - -# Package source files -src/gettextp.c -src/msgfmt.c -src/xgettext.c -</PRE> - -<P> -Dashed comments and white lines are ignored. All other lines -list those source files containing strings marked for translation -(see section <A HREF="gettext.html#SEC15">How Marks Appears in Sources</A>), in a notation relative to the top level -of your whole distribution, rather than the location of the -<TT>`POTFILES.in'</TT> file itself. - -</P> - - -<H3><A NAME="SEC71" HREF="gettext_toc.html#TOC71"><TT>`configure.in'</TT> at top level</A></H3> - - -<OL> -<LI>Declare the package and version. - -This is done by a set of lines like these: - - -<PRE> -PACKAGE=gettext -VERSION=0.10 -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") -AC_DEFINE_UNQUOTED(VERSION, "$VERSION") -AC_SUBST(PACKAGE) -AC_SUBST(VERSION) -</PRE> - -Of course, you replace <SAMP>`gettext'</SAMP> with the name of your package, -and <SAMP>`0.10'</SAMP> by its version numbers, exactly as they -should appear in the packaged <CODE>tar</CODE> file name of your distribution -(<TT>`gettext-0.10.tar.gz'</TT>, here). - -<LI>Declare the available translations. - -This is done by defining <CODE>ALL_LINGUAS</CODE> to the white separated, -quoted list of available languages, in a single line, like this: - - -<PRE> -ALL_LINGUAS="de fr" -</PRE> - -This example means that German and French PO files are available, so -that these languages are currently supported by your package. If you -want to further restrict, at installation time, the set of installed -languages, this should not be done by modifying <CODE>ALL_LINGUAS</CODE> in -<TT>`configure.in'</TT>, but rather by using the <CODE>LINGUAS</CODE> environment -variable (see section <A HREF="gettext.html#SEC34">Magic for Installers</A>). - -<LI>Check for internationalization support. - -Here is the main <CODE>m4</CODE> macro for triggering internationalization -support. Just add this line to <TT>`configure.in'</TT>: - - -<PRE> -ud_GNU_GETTEXT -</PRE> - -This call is purposely simple, even if it generates a lot of configure -time checking and actions. - -<LI>Obtain some <TT>`libintl.h'</TT> header file. - -Once you called <CODE>ud_GNU_GETTEXT</CODE> in <TT>`configure.in'</TT>, use: - - -<PRE> -AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) -</PRE> - -This will create one header file <TT>`libintl.h'</TT>. The reason for -this has to do with the fact that some systems, using the Uniforum -message handling functions, already have a file of this name. - -The <CODE>AC_LINK_FILES</CODE> call has not been integrated into the -<CODE>ud_GNU_GETTEXT</CODE> macro because there can be only one such call -in a <TT>`configure'</TT> file. If you already use it, you will have to -<EM>merge</EM> the needed <CODE>AC_LINK_FILES</CODE> within yours, by adding -the first argument at the end of the list of your first argument, -and adding the second argument at the end of the list of your second -argument. - -<LI>Have output files created. - -The <CODE>AC_OUTPUT</CODE> directive, at the end of your <TT>`configure.in'</TT> -file, needs to be modified in two ways: - - -<PRE> -AC_OUTPUT([<VAR>existing configuration files</VAR> intl/Makefile po/Makefile.in], -[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile -<VAR>existing additional actions</VAR>]) -</PRE> - -The modification to the first argument to <CODE>AC_OUTPUT</CODE> asks -for substitution in the <TT>`intl/'</TT> and <TT>`po/'</TT> directories. -Note the <SAMP>`.in'</SAMP> suffix used for <TT>`po/'</TT> only. This is because -the distributed file is really <TT>`po/Makefile.in.in'</TT>. - -The modification to the second argument ensures that <TT>`po/Makefile'</TT> -gets generated out of the <TT>`po/Makefile.in'</TT> just created, including -in it the <TT>`po/POTFILES'</TT> produced by <CODE>ud_GNU_GETTEXT</CODE>. -Two steps are needed because <TT>`po/POTFILES'</TT> can get lengthy in -some packages, too lengthy in fact for being able to merely use an -Autoconf substituted variable, as many <CODE>sed</CODE>s cannot handle very -long lines. - -</OL> - - - -<H3><A NAME="SEC72" HREF="gettext_toc.html#TOC72"><TT>`aclocal.m4'</TT> at top level</A></H3> - -<P> -If you do not have an <TT>`aclocal.m4'</TT> file in your distribution, -the simplest is taking a copy of <TT>`aclocal.m4'</TT> from -GNU <CODE>gettext</CODE>. But to be precise, you only need macros -<CODE>ud_LC_MESSAGES</CODE>, <CODE>ud_WITH_NLS</CODE> and <CODE>ud_GNU_GETTEXT</CODE>, -so you may use an editor and remove macros you do not need. - -</P> -<P> -If you already have an <TT>`aclocal.m4'</TT> file, then you will have -to merge the said macros into your <TT>`aclocal.m4'</TT>. Note that if -you are upgrading from a previous release of GNU <CODE>gettext</CODE>, you -should most probably <EM>replace</EM> the said macros, as they usually -change a little from one release of GNU <CODE>gettext</CODE> to the next. -Their contents may vary as we get more experience with strange systems -out there. - -</P> -<P> -These macros check for the internationalization support functions -and related informations. Hopefully, once stabilized, these macros -might be integrated in the standard Autoconf set, because this -piece of <CODE>m4</CODE> code will be the same for all projects using GNU -<CODE>gettext</CODE>. - -</P> - - -<H3><A NAME="SEC73" HREF="gettext_toc.html#TOC73"><TT>`acconfig.h'</TT> at top level</A></H3> - -<P> -If you do not have an <TT>`acconfig.h'</TT> file in your distribution, -the simplest is use take a copy of <TT>`acconfig.h'</TT> from -GNU <CODE>gettext</CODE>. But to be precise, you only need the -lines and comments for <CODE>ENABLE_NLS</CODE>, <CODE>HAVE_CATGETS</CODE>, -<CODE>HAVE_GETTEXT</CODE> and <CODE>HAVE_LC_MESSAGES</CODE>, so you may use -an editor and remove everything else. If you already have an -<TT>`acconfig.h'</TT> file, then you should merge the said definitions -into your <TT>`acconfig.h'</TT>. - -</P> - - -<H3><A NAME="SEC74" HREF="gettext_toc.html#TOC74"><TT>`Makefile.in'</TT> at top level</A></H3> - -<P> -Here are a few modifications you need to make to your main, top-level -<TT>`Makefile.in'</TT> file. - -</P> - -<OL> -<LI> - -Add the following lines near the beginning of your <TT>`Makefile.in'</TT>, -so the <SAMP>`dist:'</SAMP> goal will work properly (as explained further down): - - -<PRE> -PACKAGE = @PACKAGE@ -VERSION = @VERSION@ -</PRE> - -<LI> - -Add file <TT>`NLS'</TT> to the <CODE>DISTFILES</CODE> definition, so the file gets -distributed. - -<LI> - -Wherever you process subdirectories in your <TT>`Makefile.in'</TT>, be -sure you also process <CODE>@INTLSUB@</CODE> and <CODE>@POSUB@</CODE>, which -are replaced respectively by <SAMP>`intl'</SAMP> and <SAMP>`po'</SAMP>, or empty -when the configuration processes decides these directories should -not be processed. - -Here is an example of a canonical order of processing. In this -example, we also define <CODE>SUBDIRS</CODE> in <CODE>Makefile.in</CODE> for it -to be further used in the <SAMP>`dist:'</SAMP> goal. - - -<PRE> -SUBDIRS = doc lib @INTLSUB@ src @POSUB@ -</PRE> - -that you will have to adapt to your own package. - -<LI> - -A delicate point is the <SAMP>`dist:'</SAMP> goal, as both -<TT>`intl/Makefile'</TT> and <TT>`po/Makefile'</TT> will later assume that the -proper directory has been set up from the main <TT>`Makefile'</TT>. Here is -an example at what the <SAMP>`dist:'</SAMP> goal might look like: - - -<PRE> -distdir = $(PACKAGE)-$(VERSION) -dist: Makefile - rm -fr $(distdir) - mkdir $(distdir) - chmod 777 $(distdir) - for file in $(DISTFILES); do \ - ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir); \ - done - for subdir in $(SUBDIRS); do \ - mkdir $(distdir)/$$subdir || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $@) || exit 1; \ - done - tar chozf $(distdir).tar.gz $(distdir) - rm -fr $(distdir) -</PRE> - -</OL> - - - -<H3><A NAME="SEC75" HREF="gettext_toc.html#TOC75"><TT>`Makefile.in'</TT> in <TT>`src/'</TT></A></H3> - -<P> -Some of the modifications made in the main <TT>`Makefile.in'</TT> will -also be needed in the <TT>`Makefile.in'</TT> from your package sources, -which we assume here to be in the <TT>`src/'</TT> subdirectory. Here are -all the modifications needed in <TT>`src/Makefile.in'</TT>: - -</P> - -<OL> -<LI> - -In view of the <SAMP>`dist:'</SAMP> goal, you should have these lines near the -beginning of <TT>`src/Makefile.in'</TT>: - - -<PRE> -PACKAGE = @PACKAGE@ -VERSION = @VERSION@ -</PRE> - -<LI> - -If not done already, you should guarantee that <CODE>top_srcdir</CODE> -gets defined. This will serve for <CODE>cpp</CODE> include files. Just add -the line: - - -<PRE> -top_srcdir = @top_srcdir@ -</PRE> - -<LI> - -You might also want to define <CODE>subdir</CODE> as <SAMP>`src'</SAMP>, later -allowing for almost uniform <SAMP>`dist:'</SAMP> goals in all your -<TT>`Makefile.in'</TT>. At list, the <SAMP>`dist:'</SAMP> goal below assume that -you used: - - -<PRE> -subdir = src -</PRE> - -<LI> - -You should ensure that the final linking will use <CODE>@INTLLIBS@</CODE> as -a library. An easy way to achieve this is to manage that it gets into -<CODE>LIBS</CODE>, like this: - - -<PRE> -LIBS = @INTLLIBS@ @LIBS@ -</PRE> - -In most GNU packages one will find a directory <TT>`lib/'</TT> in which a -library containing some helper functions will be build. (You need at -least the few functions which the GNU <CODE>gettext</CODE> Library itself -needs.) However some of the functions in the <TT>`lib/'</TT> also give -messages to the user which of course should be translated, too. Taking -care of this it is not enough to place the support library (say -<TT>`libsupport.a'</TT>) just between the <CODE>@INTLLIBS@</CODE> and -<CODE>@LIBS@</CODE> in the above example. Instead one has to write this: - - -<PRE> -LIBS = ../lib/libsupport.a @INTLLIBS@ ../lib/libsupport.a @LIBS@ -</PRE> - -<LI> - -You should also ensure that directory <TT>`intl/'</TT> will be searched for -C preprocessor include files in all circumstances. So, you have to -manage so both <SAMP>`-I../intl'</SAMP> and <SAMP>`-I$(top_srcdir)/intl'</SAMP> will -be given to the C compiler. - -<LI> - -Your <SAMP>`dist:'</SAMP> goal has to conform with others. Here is a -reasonable definition for it: - - -<PRE> -distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) -dist: Makefile $(DISTFILES) - for file in $(DISTFILES); do \ - ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir); \ - done -</PRE> - -</OL> - - - -<H1><A NAME="SEC76" HREF="gettext_toc.html#TOC76">Concluding Remarks</A></H1> - -<P> -We would like to conclude this GNU <CODE>gettext</CODE> manual by presenting -an history of the GNU Translation Project so far. We finally give -a few pointers for those who want to do further research or readings -about Native Language Support matters. - -</P> - - - -<H2><A NAME="SEC77" HREF="gettext_toc.html#TOC77">History of GNU <CODE>gettext</CODE></A></H2> - -<P> -Internationalization concerns and algorithms have been informally -and casually discussed for years in GNU, sometimes around GNU -<CODE>libc</CODE>, maybe around the incoming <CODE>Hurd</CODE>, or otherwise -(nobody clearly remembers). And even then, when the work started for -real, this was somewhat independently of these previous discussions. - -</P> -<P> -This all began in July 1994, when Patrick D'Cruze had the idea and -initiative of internationalizing version 3.9.2 of GNU <CODE>fileutils</CODE>. -He then asked Jim Meyering, the maintainer, how to get those changes -folded into an official release. That first draft was full of -<CODE>#ifdef</CODE>s and somewhat disconcerting, and Jim wanted to find -nicer ways. Patrick and Jim shared some tries and experimentations -in this area. Then, feeling that this might eventually have a deeper -impact on GNU, Jim wanted to know what standards were, and contacted -Richard Stallman, who very quickly and verbally described an overall -design for what was meant to become <CODE>glocale</CODE>, at that time. - -</P> -<P> -Jim implemented <CODE>glocale</CODE> and got a lot of exhausting feedback -from Patrick and Richard, of course, but also from Mitchum DSouza -(who wrote a <CODE>catgets</CODE>-like package), Roland McGrath, maybe David -MacKenzie, Pinard, and Paul Eggert, all pushing and -pulling in various directions, not always compatible, to the extent -that after a couple of test releases, <CODE>glocale</CODE> was torn apart. - -</P> -<P> -While Jim took some distance and time and became dad for a second -time, Roland wanted to get GNU <CODE>libc</CODE> internationalized, and -got Ulrich Drepper involved in that project. Instead of starting -from <CODE>glocale</CODE>, Ulrich rewrote something from scratch, but -more conformant to the set of guidelines who emerged out of the -<CODE>glocale</CODE> effort. Then, Ulrich got people from the previous -forum to involve themselves into this new project, and the switch -from <CODE>glocale</CODE> to what was first named <CODE>msgutils</CODE>, renamed -<CODE>nlsutils</CODE>, and later <CODE>gettext</CODE>, became officially accepted -by Richard in May 1995 or so. - -</P> -<P> -Let's summarize by saying that Ulrich Drepper wrote GNU <CODE>gettext</CODE> -in April 1995. The first official release of the package, including -PO mode, occurred in July 1995, and was numbered 0.7. Other people -contributed to the effort by providing a discussion forum around -Ulrich, writing little pieces of code, or testing. These are quoted -in the <CODE>THANKS</CODE> file which comes with the GNU <CODE>gettext</CODE> -distribution. - -</P> -<P> -While this was being done, adapted half a dozen of -GNU packages to <CODE>glocale</CODE> first, then later to <CODE>gettext</CODE>, -putting them in pretest, so providing along the way an effective -user environment for fine tuning the evolving tools. He also took -the responsibility of organizing and coordinating the GNU Translation -Project. After nearly a year of informal exchanges between people from -many countries, translator teams started to exist in May 1995, through -the creation and support by Patrick D'Cruze of twenty unmoderated -mailing lists for that many native languages, and two moderated -lists: one for reaching all teams at once, the other for reaching -all maintainers of internationalized packages in GNU. - -</P> -<P> - also wrote PO mode in June 1995 with the collaboration -of Greg McGary, as a kind of contribution to Ulrich's package. -He also gave a hand with the GNU <CODE>gettext</CODE> Texinfo manual. - -</P> - - -<H2><A NAME="SEC78" HREF="gettext_toc.html#TOC78">Related Readings</A></H2> - -<P> -Eugene H. Dorr (<TT>`dorre@well.com'</TT>) maintains an interesting -bibliography on internationalization matters, called -<CITE>Internationalization Reference List</CITE>, which is available as: - -<PRE> -ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/i18n-books.txt -</PRE> - -<P> -Michael Gschwind (<TT>`mike@vlsivie.tuwien.ac.at'</TT>) maintains a -Frequently Asked Questions (FAQ) list, entitled <CITE>Programming for -Internationalisation</CITE>. This FAQ discusses writing programs which -can handle different language conventions, character sets, etc.; -and is applicable to all character set encodings, with particular -emphasis on ISO 8859-1. It is regularly published in Usenet -groups <TT>`comp.unix.questions'</TT>, <TT>`comp.std.internat'</TT>, -<TT>`comp.software.international'</TT>, <TT>`comp.lang.c'</TT>, -<TT>`comp.windows.x'</TT>, <TT>`comp.std.c'</TT>, <TT>`comp.answers'</TT> -and <TT>`news.answers'</TT>. The home location of this document is: - -<PRE> -ftp://ftp.vlsivie.tuwien.ac.at/pub/8bit/ISO-programming -</PRE> - -<P> -Patrick D'Cruze (<TT>`pdcruze@li.org'</TT>) wrote a tutorial about NLS -matters, and Jochen Hein (<TT>`Hein@student.tu-clausthal.de'</TT>) took -over the responsibility of maintaining it. It may be found as: - -<PRE> -ftp://sunsite.unc.edu/pub/Linux/utils/nls/catalogs/Incoming/... - ...locale-tutorial-0.8.txt.gz -</PRE> - -<P> -This site is mirrored in: - -<PRE> -ftp://ftp.ibp.fr/pub/linux/sunsite/ -</PRE> - -<P> -A French version of the same tutorial should be findable at: - -<PRE> -ftp://ftp.ibp.fr/pub/linux/french/docs/ -</PRE> - -<P> -together with French translations of many Linux-related documents. - -</P> -<P><HR><P> -This document was generated on 4 September 1998 using the -<A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A> -translator version 1.51.</P> -</BODY> -</HTML> diff --git a/docs/html/gettext/gettext_1.html b/docs/html/gettext/gettext_1.html new file mode 100644 index 0000000000..e6bb104861 --- /dev/null +++ b/docs/html/gettext/gettext_1.html @@ -0,0 +1,636 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - Introduction</TITLE> +<link href="gettext_2.html" rel=Next> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the first, previous, <A HREF="gettext_2.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC1" HREF="gettext_toc.html#TOC1">Introduction</A></H1> + + +<BLOCKQUOTE> +<P> +This manual is still in <EM>DRAFT</EM> state. Some sections are still +empty, or almost. We keep merging material from other sources +(essentially e-mail folders) while the proper integration of this +material is delayed. +</BLOCKQUOTE> + +<P> +In this manual, we use <EM>he</EM> when speaking of the programmer or +maintainer, <EM>she</EM> when speaking of the translator, and <EM>they</EM> +when speaking of the installers or end users of the translated program. +This is only a convenience for clarifying the documentation. It is +<EM>absolutely</EM> not meant to imply that some roles are more appropriate +to males or females. Besides, as you might guess, GNU <CODE>gettext</CODE> +is meant to be useful for people using computers, whatever their sex, +race, religion or nationality! + +</P> +<P> +This chapter explains the goals sought in the creation +of GNU <CODE>gettext</CODE> and the free Translation Project. +Then, it explains a few broad concepts around +Native Language Support, and positions message translation with regard +to other aspects of national and cultural variance, as they apply to +to programs. It also surveys those files used to convey the +translations. It explains how the various tools interact in the +initial generation of these files, and later, how the maintenance +cycle should usually operate. + +</P> +<P> +Please send suggestions and corrections to: + +</P> + +<PRE> +Internet address: + bug-gnu-utils@prep.ai.mit.edu +</PRE> + +<P> +Please include the manual's edition number and update date in your messages. + +</P> + + + +<H2><A NAME="SEC2" HREF="gettext_toc.html#TOC2">The Purpose of GNU <CODE>gettext</CODE></A></H2> + +<P> +Usually, programs are written and documented in English, and use +English at execution time to interact with users. This is true +not only of GNU software, but also of a great deal of commercial +and free software. Using a common language is quite handy for +communication between developers, maintainers and users from all +countries. On the other hand, most people are less comfortable with +English than with their own native language, and would prefer to +use their mother tongue for day to day's work, as far as possible. +Many would simply <EM>love</EM> to see their computer screen showing +a lot less of English, and far more of their own language. + +</P> +<P> +However, to many people, this dream might appear so far fetched that +they may believe it is not even worth spending time thinking about +it. They have no confidence at all that the dream might ever +become true. Yet some have not lost hope, and have organized themselves. +The Translation Project is a formalization of this hope into a +workable structure, which has a good chance to get all of us nearer +the achievement of a truly multi-lingual set of programs. + +</P> +<P> +GNU <CODE>gettext</CODE> is an important step for the Translation Project, +as it is an asset on which we may build many other steps. This package +offers to programmers, translators and even users, a well integrated +set of tools and documentation. Specifically, the GNU <CODE>gettext</CODE> +utilities are a set of tools that provides a framework within which +other free packages may produce multi-lingual messages. These tools +include a set of conventions about how programs should be written to +support message catalogs, a directory and file naming organization for the +message catalogs themselves, a runtime library supporting the retrieval of +translated messages, and a few stand-alone programs to massage in various +ways the sets of translatable strings, or already translated strings. +A special mode for GNU Emacs also helps ease interested parties into +preparing these sets, or bringing them up to date. + +</P> +<P> +GNU <CODE>gettext</CODE> is designed to minimize the impact of +internationalization on program sources, keeping this impact as small +and hardly noticeable as possible. Internationalization has better +chances of succeeding if it is very light weighted, or at least, +appear to be so, when looking at program sources. + +</P> +<P> +The Translation Project also uses the GNU <CODE>gettext</CODE> +distribution as a vehicle for documenting its structure and methods. +This goes beyond the strict technicalities of documenting the GNU <CODE>gettext</CODE> +proper. By so doing, translators will find in a single place, as +far as possible, all they need to know for properly doing their +translating work. Also, this supplemental documentation might also +help programmers, and even curious users, in understanding how GNU +<CODE>gettext</CODE> is related to the remainder of the Translation +Project, and consequently, have a glimpse at the <EM>big picture</EM>. + +</P> + + +<H2><A NAME="SEC3" HREF="gettext_toc.html#TOC3">I18n, L10n, and Such</A></H2> + +<P> +Two long words appear all the time when we discuss support of native +language in programs, and these words have a precise meaning, worth +being explained here, once and for all in this document. The words are +<EM>internationalization</EM> and <EM>localization</EM>. Many people, +tired of writing these long words over and over again, took the +habit of writing <STRONG>i18n</STRONG> and <STRONG>l10n</STRONG> instead, quoting the first +and last letter of each word, and replacing the run of intermediate +letters by a number merely telling how many such letters there are. +But in this manual, in the sake of clarity, we will patiently write +the names in full, each time... + +</P> +<P> +By <STRONG>internationalization</STRONG>, one refers to the operation by which a +program, or a set of programs turned into a package, is made aware of and +able to support multiple languages. This is a generalization process, +by which the programs are untied from calling only English strings or +other English specific habits, and connected to generic ways of doing +the same, instead. Program developers may use various techniques to +internationalize their programs. Some of these have been standardized. +GNU <CODE>gettext</CODE> offers one of these standards. See section <A HREF="gettext_8.html#SEC39">The Programmer's View</A>. + +</P> +<P> +By <STRONG>localization</STRONG>, one means the operation by which, in a set +of programs already internationalized, one gives the program all +needed information so that it can adapt itself to handle its input +and output in a fashion which is correct for some native language and +cultural habits. This is a particularisation process, by which generic +methods already implemented in an internationalized program are used +in specific ways. The programming environment puts several functions +to the programmers disposal which allow this runtime configuration. +The formal description of specific set of cultural habits for some +country, together with all associated translations targeted to the +same native language, is called the <STRONG>locale</STRONG> for this language +or country. Users achieve localization of programs by setting proper +values to special environment variables, prior to executing those +programs, identifying which locale should be used. + +</P> +<P> +In fact, locale message support is only one component of the cultural +data that makes up a particular locale. There are a whole host of +routines and functions provided to aid programmers in developing +internationalized software and which allow them to access the data +stored in a particular locale. When someone presently refers to a +particular locale, they are obviously referring to the data stored +within that particular locale. Similarly, if a programmer is referring +to "accessing the locale routines", they are referring to the +complete suite of routines that access all of the locale's information. + +</P> +<P> +One uses the expression <STRONG>Native Language Support</STRONG>, or merely NLS, +for speaking of the overall activity or feature encompassing both +internationalization and localization, allowing for multi-lingual +interactions in a program. In a nutshell, one could say that +internationalization is the operation by which further localizations +are made possible. + +</P> +<P> +Also, very roughly said, when it comes to multi-lingual messages, +internationalization is usually taken care of by programmers, and +localization is usually taken care of by translators. + +</P> + + +<H2><A NAME="SEC4" HREF="gettext_toc.html#TOC4">Aspects in Native Language Support</A></H2> + +<P> +For a totally multi-lingual distribution, there are many things to +translate beyond output messages. + +</P> + +<UL> +<LI> + +As of today, GNU <CODE>gettext</CODE> offers a complete toolset for +translating messages output by C programs. Perl scripts and shell +scripts will also need to be translated. Even if there are today some hooks +by which this can be done, these hooks are not integrated as well as they +should be. + +<LI> + +Some programs, like <CODE>autoconf</CODE> or <CODE>bison</CODE>, are able +to produce other programs (or scripts). Even if the generating +programs themselves are internationalized, the generated programs they +produce may need internationalization on their own, and this indirect +internationalization could be automated right from the generating +program. In fact, quite usually, generating and generated programs +could be internationalized independently, as the effort needed is +fairly orthogonal. + +<LI> + +A few programs include textual tables which might need translation +themselves, independently of the strings contained in the program +itself. For example, RFC 1345 gives an English description for each +character which GNU <CODE>recode</CODE> is able to reconstruct at execution. +Since these descriptions are extracted from the RFC by mechanical means, +translating them properly would require a prior translation of the RFC +itself. + +<LI> + +Almost all programs accept options, which are often worded out so to +be descriptive for the English readers; one might want to consider +offering translated versions for program options as well. + +<LI> + +Many programs read, interpret, compile, or are somewhat driven by +input files which are texts containing keywords, identifiers, or +replies which are inherently translatable. For example, one may want +<CODE>gcc</CODE> to allow diacriticized characters in identifiers or use +translated keywords; <SAMP>`rm -i'</SAMP> might accept something else than +<SAMP>`y'</SAMP> or <SAMP>`n'</SAMP> for replies, etc. Even if the program will +eventually make most of its output in the foreign languages, one has +to decide whether the input syntax, option values, etc., are to be +localized or not. + +<LI> + +The manual accompanying a package, as well as all documentation files +in the distribution, could surely be translated, too. Translating a +manual, with the intent of later keeping up with updates, is a major +undertaking in itself, generally. + +</UL> + +<P> +As we already stressed, translation is only one aspect of locales. +Other internationalization aspects are not currently handled by GNU +<CODE>gettext</CODE>, but perhaps may be handled in future versions. There +are many attributes that are needed to define a country's cultural +conventions. These attributes include beside the country's native +language, the formatting of the date and time, the representation of +numbers, the symbols for currency, etc. These local <STRONG>rules</STRONG> are +termed the country's locale. The locale represents the knowledge +needed to support the country's native attributes. + +</P> +<P> +There are a few major areas which may vary between countries and +hence, define what a locale must describe. The following list helps +putting multi-lingual messages into the proper context of other tasks +related to locales, and also presents some other areas which GNU +<CODE>gettext</CODE> might eventually tackle, maybe, one of these days. + +</P> +<DL COMPACT> + +<DT><EM>Characters and Codesets</EM> +<DD> +The codeset most commonly used through out the USA and most English +speaking parts of the world is the ASCII codeset. However, there are +many characters needed by various locales that are not found within +this codeset. The 8-bit ISO 8859-1 code set has most of the special +characters needed to handle the major European languages. However, in +many cases, the ISO 8859-1 font is not adequate. Hence each locale +will need to specify which codeset they need to use and will need +to have the appropriate character handling routines to cope with +the codeset. + +<DT><EM>Currency</EM> +<DD> +The symbols used vary from country to country as does the position +used by the symbol. Software needs to be able to transparently +display currency figures in the native mode for each locale. + +<DT><EM>Dates</EM> +<DD> +The format of date varies between locales. For example, Christmas day +in 1994 is written as 12/25/94 in the USA and as 25/12/94 in Australia. +Other countries might use ISO 8061 dates, etc. + +Time of the day may be noted as <VAR>hh</VAR>:<VAR>mm</VAR>, <VAR>hh</VAR>.<VAR>mm</VAR>, +or otherwise. Some locales require time to be specified in 24-hour +mode rather than as AM or PM. Further, the nature and yearly extent +of the Daylight Saving correction vary widely between countries. + +<DT><EM>Numbers</EM> +<DD> +Numbers can be represented differently in different locales. +For example, the following numbers are all written correctly for +their respective locales: + + +<PRE> +12,345.67 English +12.345,67 French +1,2345.67 Asia +</PRE> + +Some programs could go further and use different unit systems, like +English units or Metric units, or even take into account variants +about how numbers are spelled in full. + +<DT><EM>Messages</EM> +<DD> +The most obvious area is the language support within a locale. This is +where GNU <CODE>gettext</CODE> provides the means for developers and users to +easily change the language that the software uses to communicate to +the user. + +</DL> + +<P> +In the near future we see no chance that components of locale outside of +message handling will be made available for use in other +packages. The reason for this is that most modern systems provide +a more or less reasonable support for at least some of the missing +components. Another point is that the GNU <CODE>libc</CODE> and Linux will get +a new and complete implementation of the whole locale functionality +which could be adopted by system lacking a reasonable locale support. + +</P> + + +<H2><A NAME="SEC5" HREF="gettext_toc.html#TOC5">Files Conveying Translations</A></H2> + +<P> +The letters PO in <TT>`.po'</TT> files means Portable Object, to +distinguish it from <TT>`.mo'</TT> files, where MO stands for Machine +Object. This paradigm, as well as the PO file format, is inspired +by the NLS standard developed by Uniforum, and implemented by Sun +in their Solaris system. + +</P> +<P> +PO files are meant to be read and edited by humans, and associate each +original, translatable string of a given package with its translation +in a particular target language. A single PO file is dedicated to +a single target language. If a package supports many languages, +there is one such PO file per language supported, and each package +has its own set of PO files. These PO files are best created by +the <CODE>xgettext</CODE> program, and later updated or refreshed through +the <CODE>msgmerge</CODE> program. Program <CODE>xgettext</CODE> extracts all +marked messages from a set of C files and initializes a PO file with +empty translations. Program <CODE>msgmerge</CODE> takes care of adjusting +PO files between releases of the corresponding sources, commenting +obsolete entries, initializing new ones, and updating all source +line references. Files ending with <TT>`.pot'</TT> are kind of base +translation files found in distributions, in PO file format, and +<TT>`.pox'</TT> files are often temporary PO files. + +</P> +<P> +MO files are meant to be read by programs, and are binary in nature. +A few systems already offer tools for creating and handling MO files +as part of the Native Language Support coming with the system, but the +format of these MO files is often different from system to system, +and non-portable. They do not necessary use <TT>`.mo'</TT> for file +extensions, but since system libraries are also used for accessing +these files, it works as long as the system is self-consistent about +it. If GNU <CODE>gettext</CODE> is able to interface with the tools already +provided with systems, it will consequently let these provided tools +take care of generating the MO files. Or else, if such tools are not +found or do not seem usable, GNU <CODE>gettext</CODE> will use its own ways +and its own format for MO files. Files ending with <TT>`.gmo'</TT> are +really MO files, when it is known that these files use the GNU format. + +</P> + + +<H2><A NAME="SEC6" HREF="gettext_toc.html#TOC6">Overview of GNU <CODE>gettext</CODE></A></H2> + +<P> +The following diagram summarizes the relation between the files +handled by GNU <CODE>gettext</CODE> and the tools acting on these files. +It is followed by a somewhat detailed explanations, which you should +read while keeping an eye on the diagram. Having a clear understanding +of these interrelations would surely help programmers, translators +and maintainers. + +</P> + +<PRE> +Original C Sources ---> PO mode ---> Marked C Sources ---. + | + .---------<--- GNU gettext Library | +.--- make <---+ | +| `---------<--------------------+-----------' +| | +| .-----<--- PACKAGE.pot <--- xgettext <---' .---<--- PO Compendium +| | | ^ +| | `---. | +| `---. +---> PO mode ---. +| +----> msgmerge ------> LANG.pox --->--------' | +| .---' | +| | | +| `-------------<---------------. | +| +--- LANG.po <--- New LANG.pox <----' +| .--- LANG.gmo <--- msgfmt <---' +| | +| `---> install ---> /.../LANG/PACKAGE.mo ---. +| +---> "Hello world!" +`-------> install ---> /.../bin/PROGRAM -------' +</PRE> + +<P> +The indication <SAMP>`PO mode'</SAMP> appears in two places in this picture, +and you may safely read it as merely meaning "hand editing", using +any editor of your choice, really. However, for those of you being +the lucky users of GNU Emacs, PO mode has been specifically created +for providing a cozy environment for editing or modifying PO files. +While editing a PO file, PO mode allows for the easy browsing of +auxiliary and compendium PO files, as well as for following references into +the set of C program sources from which PO files have been derived. +It has a few special features, among which are the interactive marking +of program strings as translatable, and the validatation of PO files +with easy repositioning to PO file lines showing errors. + +</P> +<P> +As a programmer, the first step to bringing GNU <CODE>gettext</CODE> +into your package is identifying, right in the C sources, those strings +which are meant to be translatable, and those which are untranslatable. +This tedious job can be done a little more comfortably using emacs PO +mode, but you can use any means familiar to you for modifying your +C sources. Beside this some other simple, standard changes are needed to +properly initialize the translation library. See section <A HREF="gettext_3.html#SEC13">Preparing Program Sources</A>, for +more information about all this. + +</P> +<P> +For newly written software the strings of course can and should be +marked while writing the it. The <CODE>gettext</CODE> approach makes this +very easy. Simply put the following lines at the beginning of each file +or in a central header file: + +</P> + +<PRE> +#define _(String) (String) +#define N_(String) (String) +#define textdomain(Domain) +#define bindtextdomain(Package, Directory) +</PRE> + +<P> +Doing this allows you to prepare the sources for internationalization. +Later when you feel ready for the step to use the <CODE>gettext</CODE> library +simply remove these definitions, include <TT>`libintl.h'</TT> and link +against <TT>`libintl.a'</TT>. That is all you have to change. + +</P> +<P> +Once the C sources have been modified, the <CODE>xgettext</CODE> program +is used to find and extract all translatable strings, and create an +initial PO file out of all these. This <TT>`<VAR>package</VAR>.pot'</TT> file +contains all original program strings. It has sets of pointers to +exactly where in C sources each string is used. All translations +are set to empty. The letter <KBD>t</KBD> in <TT>`.pot'</TT> marks this as +a Template PO file, not yet oriented towards any particular language. +See section <A HREF="gettext_4.html#SEC20">Invoking the <CODE>xgettext</CODE> Program</A>, for more details about how one calls the +<CODE>xgettext</CODE> program. If you are <EM>really</EM> lazy, you might +be interested at working a lot more right away, and preparing the +whole distribution setup (see section <A HREF="gettext_10.html#SEC67">The Maintainer's View</A>). By doing so, you +spare yourself typing the <CODE>xgettext</CODE> command, as <CODE>make</CODE> +should now generate the proper things automatically for you! + +</P> +<P> +The first time through, there is no <TT>`<VAR>lang</VAR>.po'</TT> yet, so the +<CODE>msgmerge</CODE> step may be skipped and replaced by a mere copy of +<TT>`<VAR>package</VAR>.pot'</TT> to <TT>`<VAR>lang</VAR>.pox'</TT>, where <VAR>lang</VAR> +represents the target language. + +</P> +<P> +Then comes the initial translation of messages. Translation in +itself is a whole matter, still exclusively meant for humans, +and whose complexity far overwhelms the level of this manual. +Nevertheless, a few hints are given in some other chapter of this +manual (see section <A HREF="gettext_9.html#SEC56">The Translator's View</A>). You will also find there indications +about how to contact translating teams, or becoming part of them, +for sharing your translating concerns with others who target the same +native language. + +</P> +<P> +While adding the translated messages into the <TT>`<VAR>lang</VAR>.pox'</TT> +PO file, if you do not have GNU Emacs handy, you are on your own +for ensuring that your efforts fully respect the PO file format, and quoting +conventions (see section <A HREF="gettext_2.html#SEC9">The Format of PO Files</A>). This is surely not an impossible task, +as this is the way many people have handled PO files already for Uniforum or +Solaris. On the other hand, by using PO mode in GNU Emacs, most details +of PO file format are taken care of for you, but you have to acquire +some familiarity with PO mode itself. Besides main PO mode commands +(see section <A HREF="gettext_2.html#SEC10">Main PO mode Commands</A>), you should know how to move between entries +(see section <A HREF="gettext_2.html#SEC11">Entry Positioning</A>), and how to handle untranslated entries +(see section <A HREF="gettext_5.html#SEC27">Untranslated Entries</A>). + +</P> +<P> +If some common translations have already been saved into a compendium +PO file, translators may use PO mode for initializing untranslated +entries from the compendium, and also save selected translations into +the compendium, updating it (see section <A HREF="gettext_4.html#SEC22">Using Translation Compendiums</A>). Compendium files +are meant to be exchanged between members of a given translation team. + +</P> +<P> +Programs, or packages of programs, are dynamic in nature: users write +bug reports and suggestion for improvements, maintainers react by +modifying programs in various ways. The fact that a package has +already been internationalized should not make maintainers shy +of adding new strings, or modifying strings already translated. +They just do their job the best they can. For the Translation +Project to work smoothly, it is important that maintainers do not +carry translation concerns on their already loaded shoulders, and that +translators be kept as free as possible of programmatic concerns. + +</P> +<P> +The only concern maintainers should have is carefully marking new +strings as translatable, when they should be, and do not otherwise +worry about them being translated, as this will come in proper time. +Consequently, when programs and their strings are adjusted in various +ways by maintainers, and for matters usually unrelated to translation, +<CODE>xgettext</CODE> would construct <TT>`<VAR>package</VAR>.pot'</TT> files which are +evolving over time, so the translations carried by <TT>`<VAR>lang</VAR>.po'</TT> +are slowly fading out of date. + +</P> +<P> +It is important for translators (and even maintainers) to understand +that package translation is a continuous process in the lifetime of a +package, and not something which is done once and for all at the start. +After an initial burst of translation activity for a given package, +interventions are needed once in a while, because here and there, +translated entries become obsolete, and new untranslated entries +appear, needing translation. + +</P> +<P> +The <CODE>msgmerge</CODE> program has the purpose of refreshing an already +existing <TT>`<VAR>lang</VAR>.po'</TT> file, by comparing it with a newer +<TT>`<VAR>package</VAR>.pot'</TT> template file, extracted by <CODE>xgettext</CODE> +out of recent C sources. The refreshing operation adjusts all +references to C source locations for strings, since these strings +move as programs are modified. Also, <CODE>msgmerge</CODE> comments out as +obsolete, in <TT>`<VAR>lang</VAR>.pox'</TT>, those already translated entries +which are no longer used in the program sources (see section <A HREF="gettext_5.html#SEC28">Obsolete Entries</A>). It finally discovers new strings and inserts them in +the resulting PO file as untranslated entries (see section <A HREF="gettext_5.html#SEC27">Untranslated Entries</A>). See section <A HREF="gettext_5.html#SEC24">Invoking the <CODE>msgmerge</CODE> Program</A>, for more information about what +<CODE>msgmerge</CODE> really does. + +</P> +<P> +Whatever route or means taken, the goal is to obtain an updated +<TT>`<VAR>lang</VAR>.pox'</TT> file offering translations for all strings. +When this is properly achieved, this file <TT>`<VAR>lang</VAR>.pox'</TT> may +take the place of the previous official <TT>`<VAR>lang</VAR>.po'</TT> file. + +</P> +<P> +The temporal mobility, or fluidity of PO files, is an integral part of +the translation game, and should be well understood, and accepted. +People resisting it will have a hard time participating in the +Translation Project, or will give a hard time to other participants! In +particular, maintainers should relax and include all available official +PO files in their distributions, even if these have not recently been +updated, without banging or otherwise trying to exert pressure on the +translator teams to get the job done. The pressure should rather come +from the community of users speaking a particular language, and +maintainers should consider themselves fairly relieved of any concern +about the adequacy of translation files. On the other hand, translators +should reasonably try updating the PO files they are responsible for, +while the package is undergoing pretest, prior to an official +distribution. + +</P> +<P> +Once the PO file is complete and dependable, the <CODE>msgfmt</CODE> program +is used for turning the PO file into a machine-oriented format, which +may yield efficient retrieval of translations by the programs of the +package, whenever needed at runtime (see section <A HREF="gettext_6.html#SEC34">The Format of GNU MO Files</A>). See section <A HREF="gettext_6.html#SEC33">Invoking the <CODE>msgfmt</CODE> Program</A>, for more information about all modalities of execution +for the <CODE>msgfmt</CODE> program. + +</P> +<P> +Finally, the modified and marked C sources are compiled and linked +with the GNU <CODE>gettext</CODE> library, usually through the operation of +<CODE>make</CODE>, given a suitable <TT>`Makefile'</TT> exists for the project, +and the resulting executable is installed somewhere users will find it. +The MO files themselves should also be properly installed. Given the +appropriate environment variables are set (see section <A HREF="gettext_7.html#SEC38">Magic for End Users</A>), the +program should localize itself automatically, whenever it executes. + +</P> +<P> +The remainder of this manual has the purpose of explaining in depth the various +steps outlined above. + +</P> +<P><HR><P> +<p>Go to the first, previous, <A HREF="gettext_2.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_10.html b/docs/html/gettext/gettext_10.html new file mode 100644 index 0000000000..2b8d78b953 --- /dev/null +++ b/docs/html/gettext/gettext_10.html @@ -0,0 +1,656 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - The Maintainer's View</TITLE> +<link href="gettext_11.html" rel=Next> +<link href="gettext_9.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_9.html">previous</A>, <A HREF="gettext_11.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC67" HREF="gettext_toc.html#TOC67">The Maintainer's View</A></H1> + +<P> +The maintainer of a package has many responsibilities. One of them +is ensuring that the package will install easily on many platforms, +and that the magic we described earlier (see section <A HREF="gettext_7.html#SEC35">The User's View</A>) will work +for installers and end users. + +</P> +<P> +Of course, there are many possible ways by which GNU <CODE>gettext</CODE> +might be integrated in a distribution, and this chapter does not cover +them in all generality. Instead, it details one possible approach which +is especially adequate for many free software distributions following GNU +standards, or even better, Gnits standards, because GNU <CODE>gettext</CODE> +is purposely for helping the internationalization of the whole GNU +project, and as many other good free packages as possible. So, the +maintainer's view presented here presumes that the package already has +a <TT>`configure.in'</TT> file and uses GNU Autoconf. + +</P> +<P> +Nevertheless, GNU <CODE>gettext</CODE> may surely be useful for free packages +not following GNU standards and conventions, but the maintainers of such +packages might have to show imagination and initiative in organizing +their distributions so <CODE>gettext</CODE> work for them in all situations. +There are surely many, out there. + +</P> +<P> +Even if <CODE>gettext</CODE> methods are now stabilizing, slight adjustments +might be needed between successive <CODE>gettext</CODE> versions, so you +should ideally revise this chapter in subsequent releases, looking +for changes. + +</P> + + + +<H2><A NAME="SEC68" HREF="gettext_toc.html#TOC68">Flat or Non-Flat Directory Structures</A></H2> + +<P> +Some free software packages are distributed as <CODE>tar</CODE> files which unpack +in a single directory, these are said to be <STRONG>flat</STRONG> distributions. +Other free software packages have a one level hierarchy of subdirectories, using +for example a subdirectory named <TT>`doc/'</TT> for the Texinfo manual and +man pages, another called <TT>`lib/'</TT> for holding functions meant to +replace or complement C libraries, and a subdirectory <TT>`src/'</TT> for +holding the proper sources for the package. These other distributions +are said to be <STRONG>non-flat</STRONG>. + +</P> +<P> +For now, we cannot say much about flat distributions. A flat +directory structure has the disadvantage of increasing the difficulty +of updating to a new version of GNU <CODE>gettext</CODE>. Also, if you have +many PO files, this could somewhat pollute your single directory. +In the GNU <CODE>gettext</CODE> distribution, the <TT>`misc/'</TT> directory +contains a shell script named <TT>`combine-sh'</TT>. That script may +be used for combining all the C files of the <TT>`intl/'</TT> directory +into a pair of C files (one <TT>`.c'</TT> and one <TT>`.h'</TT>). Those two +generated files would fit more easily in a flat directory structure, +and you will then have to add these two files to your project. + +</P> +<P> +Maybe because GNU <CODE>gettext</CODE> itself has a non-flat structure, +we have more experience with this approach, and this is what will be +described in the remaining of this chapter. Some maintainers might +use this as an opportunity to unflatten their package structure. +Only later, once gained more experience adapting GNU <CODE>gettext</CODE> +to flat distributions, we might add some notes about how to proceed +in flat situations. + +</P> + + +<H2><A NAME="SEC69" HREF="gettext_toc.html#TOC69">Prerequisite Works</A></H2> + +<P> +There are some works which are required for using GNU <CODE>gettext</CODE> +in one of your package. These works have some kind of generality +that escape the point by point descriptions used in the remainder +of this chapter. So, we describe them here. + +</P> + +<UL> +<LI> + +Before attempting to use you should install some other packages first. +Ensure that recent versions of GNU <CODE>m4</CODE>, GNU Autoconf and GNU +<CODE>gettext</CODE> are already installed at your site, and if not, proceed +to do this first. If you got to install these things, beware that +GNU <CODE>m4</CODE> must be fully installed before GNU Autoconf is even +<EM>configured</EM>. + +To further ease the task of a package maintainer the <CODE>automake</CODE> +package was designed and implemented. GNU <CODE>gettext</CODE> now uses this +tool and the <TT>`Makefile'</TT>s in the <TT>`intl/'</TT> and <TT>`po/'</TT> +therefore know about all the goals necessary for using <CODE>automake</CODE> +and <TT>`libintl'</TT> in one project. + +Those four packages are only needed to you, as a maintainer; the +installers of your own package and end users do not really need any of +GNU <CODE>m4</CODE>, GNU Autoconf, GNU <CODE>gettext</CODE>, or GNU <CODE>automake</CODE> +for successfully installing and running your package, with messages +properly translated. But this is not completely true if you provide +internationalized shell scripts within your own package: GNU +<CODE>gettext</CODE> shall then be installed at the user site if the end users +want to see the translation of shell script messages. + +<LI> + +Your package should use Autoconf and have a <TT>`configure.in'</TT> file. +If it does not, you have to learn how. The Autoconf documentation +is quite well written, it is a good idea that you print it and get +familiar with it. + +<LI> + +Your C sources should have already been modified according to +instructions given earlier in this manual. See section <A HREF="gettext_3.html#SEC13">Preparing Program Sources</A>. + +<LI> + +Your <TT>`po/'</TT> directory should receive all PO files submitted to you +by the translator teams, each having <TT>`<VAR>ll</VAR>.po'</TT> as a name. +This is not usually easy to get translation +work done before your package gets internationalized and available! +Since the cycle has to start somewhere, the easiest for the maintainer +is to start with absolutely no PO files, and wait until various +translator teams get interested in your package, and submit PO files. + +</UL> + +<P> +It is worth adding here a few words about how the maintainer should +ideally behave with PO files submissions. As a maintainer, your role is +to authentify the origin of the submission as being the representative +of the appropriate translating teams of the Translation Project (forward +the submission to <TT>`translation@iro.umontreal.ca'</TT> in case of doubt), +to ensure that the PO file format is not severely broken and does not +prevent successful installation, and for the rest, to merely to put these +PO files in <TT>`po/'</TT> for distribution. + +</P> +<P> +As a maintainer, you do not have to take on your shoulders the +responsibility of checking if the translations are adequate or +complete, and should avoid diving into linguistic matters. Translation +teams drive themselves and are fully responsible of their linguistic +choices for the Translation Project. Keep in mind that translator teams are <EM>not</EM> +driven by maintainers. You can help by carefully redirecting all +communications and reports from users about linguistic matters to the +appropriate translation team, or explain users how to reach or join +their team. The simplest might be to send them the <TT>`ABOUT-NLS'</TT> file. + +</P> +<P> +Maintainers should <EM>never ever</EM> apply PO file bug reports +themselves, short-cutting translation teams. If some translator has +difficulty to get some of her points through her team, it should not be +an issue for her to directly negotiate translations with maintainers. +Teams ought to settle their problems themselves, if any. If you, as +a maintainer, ever think there is a real problem with a team, please +never try to <EM>solve</EM> a team's problem on your own. + +</P> + + +<H2><A NAME="SEC70" HREF="gettext_toc.html#TOC70">Invoking the <CODE>gettextize</CODE> Program</A></H2> + +<P> +Some files are consistently and identically needed in every package +internationalized through GNU <CODE>gettext</CODE>. As a matter of +convenience, the <CODE>gettextize</CODE> program puts all these files right +in your package. This program has the following synopsis: + +</P> + +<PRE> +gettextize [ <VAR>option</VAR>... ] [ <VAR>directory</VAR> ] +</PRE> + +<P> +and accepts the following options: + +</P> +<DL COMPACT> + +<DT><SAMP>`-c'</SAMP> +<DD> +<DT><SAMP>`--copy'</SAMP> +<DD> +Copy the needed files instead of making symbolic links. Using links +would allow the package to always use the latest <CODE>gettext</CODE> code +available on the system, but it might disturb some mechanism the +maintainer is used to apply to the sources. Because running +<CODE>gettextize</CODE> is easy there shouldn't be problems with using copies. + +<DT><SAMP>`-f'</SAMP> +<DD> +<DT><SAMP>`--force'</SAMP> +<DD> +Force replacement of files which already exist. + +<DT><SAMP>`-h'</SAMP> +<DD> +<DT><SAMP>`--help'</SAMP> +<DD> +Display this help and exit. + +<DT><SAMP>`--version'</SAMP> +<DD> +Output version information and exit. + +</DL> + +<P> +If <VAR>directory</VAR> is given, this is the top level directory of a +package to prepare for using GNU <CODE>gettext</CODE>. If not given, it +is assumed that the current directory is the top level directory of +such a package. + +</P> +<P> +The program <CODE>gettextize</CODE> provides the following files. However, +no existing file will be replaced unless the option <CODE>--force</CODE> +(<CODE>-f</CODE>) is specified. + +</P> + +<OL> +<LI> + +The <TT>`ABOUT-NLS'</TT> file is copied in the main directory of your package, +the one being at the top level. This file gives the main indications +about how to install and use the Native Language Support features +of your program. You might elect to use a more recent copy of this +<TT>`ABOUT-NLS'</TT> file than the one provided through <CODE>gettextize</CODE>, +if you have one handy. You may also fetch a more recent copy of file +<TT>`ABOUT-NLS'</TT> from Translation Project sites, and from most GNU +archive sites. + +<LI> + +A <TT>`po/'</TT> directory is created for eventually holding +all translation files, but initially only containing the file +<TT>`po/Makefile.in.in'</TT> from the GNU <CODE>gettext</CODE> distribution. +(beware the double <SAMP>`.in'</SAMP> in the file name). If the <TT>`po/'</TT> +directory already exists, it will be preserved along with the files +it contains, and only <TT>`Makefile.in.in'</TT> will be overwritten. + +<LI> + +A <TT>`intl/'</TT> directory is created and filled with most of the files +originally in the <TT>`intl/'</TT> directory of the GNU <CODE>gettext</CODE> +distribution. Also, if option <CODE>--force</CODE> (<CODE>-f</CODE>) is given, +the <TT>`intl/'</TT> directory is emptied first. + +</OL> + +<P> +If your site support symbolic links, <CODE>gettextize</CODE> will not +actually copy the files into your package, but establish symbolic +links instead. This avoids duplicating the disk space needed in +all packages. Merely using the <SAMP>`-h'</SAMP> option while creating the +<CODE>tar</CODE> archive of your distribution will resolve each link by an +actual copy in the distribution archive. So, to insist, you really +should use <SAMP>`-h'</SAMP> option with <CODE>tar</CODE> within your <CODE>dist</CODE> +goal of your main <TT>`Makefile.in'</TT>. + +</P> +<P> +It is interesting to understand that most new files for supporting +GNU <CODE>gettext</CODE> facilities in one package go in <TT>`intl/'</TT> +and <TT>`po/'</TT> subdirectories. One distinction between these two +directories is that <TT>`intl/'</TT> is meant to be completely identical +in all packages using GNU <CODE>gettext</CODE>, while all newly created +files, which have to be different, go into <TT>`po/'</TT>. There is a +common <TT>`Makefile.in.in'</TT> in <TT>`po/'</TT>, because the <TT>`po/'</TT> +directory needs its own <TT>`Makefile'</TT>, and it has been designed so +it can be identical in all packages. + +</P> + + +<H2><A NAME="SEC71" HREF="gettext_toc.html#TOC71">Files You Must Create or Alter</A></H2> + +<P> +Besides files which are automatically added through <CODE>gettextize</CODE>, +there are many files needing revision for properly interacting with +GNU <CODE>gettext</CODE>. If you are closely following GNU standards for +Makefile engineering and auto-configuration, the adaptations should +be easier to achieve. Here is a point by point description of the +changes needed in each. + +</P> +<P> +So, here comes a list of files, each one followed by a description of +all alterations it needs. Many examples are taken out from the GNU +<CODE>gettext</CODE> 0.10.35 distribution itself. You may indeed +refer to the source code of the GNU <CODE>gettext</CODE> package, as it +is intended to be a good example and master implementation for using +its own functionality. + +</P> + + + +<H3><A NAME="SEC72" HREF="gettext_toc.html#TOC72"><TT>`POTFILES.in'</TT> in <TT>`po/'</TT></A></H3> + +<P> +The <TT>`po/'</TT> directory should receive a file named +<TT>`POTFILES.in'</TT>. This file tells which files, among all program +sources, have marked strings needing translation. Here is an example +of such a file: + +</P> + +<PRE> +# List of source files containing translatable strings. +# Copyright (C) 1995 Free Software Foundation, Inc. + +# Common library files +lib/error.c +lib/getopt.c +lib/xmalloc.c + +# Package source files +src/gettextp.c +src/msgfmt.c +src/xgettext.c +</PRE> + +<P> +Dashed comments and white lines are ignored. All other lines +list those source files containing strings marked for translation +(see section <A HREF="gettext_3.html#SEC15">How Marks Appears in Sources</A>), in a notation relative to the top level +of your whole distribution, rather than the location of the +<TT>`POTFILES.in'</TT> file itself. + +</P> + + +<H3><A NAME="SEC73" HREF="gettext_toc.html#TOC73"><TT>`configure.in'</TT> at top level</A></H3> + + +<OL> +<LI>Declare the package and version. + +This is done by a set of lines like these: + + +<PRE> +PACKAGE=gettext +VERSION=0.10.35 +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") +AC_DEFINE_UNQUOTED(VERSION, "$VERSION") +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) +</PRE> + +Of course, you replace <SAMP>`gettext'</SAMP> with the name of your package, +and <SAMP>`0.10.35'</SAMP> by its version numbers, exactly as they +should appear in the packaged <CODE>tar</CODE> file name of your distribution +(<TT>`gettext-0.10.35.tar.gz'</TT>, here). + +<LI>Declare the available translations. + +This is done by defining <CODE>ALL_LINGUAS</CODE> to the white separated, +quoted list of available languages, in a single line, like this: + + +<PRE> +ALL_LINGUAS="de fr" +</PRE> + +This example means that German and French PO files are available, so +that these languages are currently supported by your package. If you +want to further restrict, at installation time, the set of installed +languages, this should not be done by modifying <CODE>ALL_LINGUAS</CODE> in +<TT>`configure.in'</TT>, but rather by using the <CODE>LINGUAS</CODE> environment +variable (see section <A HREF="gettext_7.html#SEC37">Magic for Installers</A>). + +<LI>Check for internationalization support. + +Here is the main <CODE>m4</CODE> macro for triggering internationalization +support. Just add this line to <TT>`configure.in'</TT>: + + +<PRE> +AM_GNU_GETTEXT +</PRE> + +This call is purposely simple, even if it generates a lot of configure +time checking and actions. + +<LI>Have output files created. + +The <CODE>AC_OUTPUT</CODE> directive, at the end of your <TT>`configure.in'</TT> +file, needs to be modified in two ways: + + +<PRE> +AC_OUTPUT([<VAR>existing configuration files</VAR> intl/Makefile po/Makefile.in], +<VAR>existing additional actions</VAR>]) +</PRE> + +The modification to the first argument to <CODE>AC_OUTPUT</CODE> asks +for substitution in the <TT>`intl/'</TT> and <TT>`po/'</TT> directories. +Note the <SAMP>`.in'</SAMP> suffix used for <TT>`po/'</TT> only. This is because +the distributed file is really <TT>`po/Makefile.in.in'</TT>. + +</OL> + + + +<H3><A NAME="SEC74" HREF="gettext_toc.html#TOC74"><TT>`aclocal.m4'</TT> at top level</A></H3> + +<P> +If you do not have an <TT>`aclocal.m4'</TT> file in your distribution, +the simplest is taking a copy of <TT>`aclocal.m4'</TT> from +GNU <CODE>gettext</CODE>. But to be precise, you only need macros +<CODE>AM_LC_MESSAGES</CODE>, <CODE>AM_WITH_NLS</CODE> and <CODE>AM_GNU_GETTEXT</CODE>, +and <CODE>AM_PATH_PROG_WITH_TEST</CODE>, which is called by <CODE>AM_WITH_NLS</CODE>, +so you may use an editor and remove macros you do not need. + +</P> +<P> +If you already have an <TT>`aclocal.m4'</TT> file, then you will have +to merge the said macros into your <TT>`aclocal.m4'</TT>. Note that if +you are upgrading from a previous release of GNU <CODE>gettext</CODE>, you +should most probably <EM>replace</EM> the said macros, as they usually +change a little from one release of GNU <CODE>gettext</CODE> to the next. +Their contents may vary as we get more experience with strange systems +out there. + +</P> +<P> +These macros check for the internationalization support functions +and related informations. Hopefully, once stabilized, these macros +might be integrated in the standard Autoconf set, because this +piece of <CODE>m4</CODE> code will be the same for all projects using GNU +<CODE>gettext</CODE>. + +</P> + + +<H3><A NAME="SEC75" HREF="gettext_toc.html#TOC75"><TT>`acconfig.h'</TT> at top level</A></H3> + +<P> +If you do not have an <TT>`acconfig.h'</TT> file in your distribution, the +simplest is use take a copy of <TT>`acconfig.h'</TT> from GNU +<CODE>gettext</CODE>. But to be precise, you only need the lines and comments +for <CODE>ENABLE_NLS</CODE>, <CODE>HAVE_CATGETS</CODE>, <CODE>HAVE_GETTEXT</CODE> and +<CODE>HAVE_LC_MESSAGES</CODE>, <CODE>HAVE_STPCPY</CODE>, <CODE>PACKAGE</CODE> and +<CODE>VERSION</CODE>, so you may use an editor and remove everything else. If +you already have an <TT>`acconfig.h'</TT> file, then you should merge the +said definitions into your <TT>`acconfig.h'</TT>. + +</P> + + +<H3><A NAME="SEC76" HREF="gettext_toc.html#TOC76"><TT>`Makefile.in'</TT> at top level</A></H3> + +<P> +Here are a few modifications you need to make to your main, top-level +<TT>`Makefile.in'</TT> file. + +</P> + +<OL> +<LI> + +Add the following lines near the beginning of your <TT>`Makefile.in'</TT>, +so the <SAMP>`dist:'</SAMP> goal will work properly (as explained further down): + + +<PRE> +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +</PRE> + +<LI> + +Add file <TT>`ABOUT-NLS'</TT> to the <CODE>DISTFILES</CODE> definition, so the file gets +distributed. + +<LI> + +Wherever you process subdirectories in your <TT>`Makefile.in'</TT>, be sure +you also process dir subdirectories <SAMP>`intl'</SAMP> and <SAMP>`po'</SAMP>. Special +rules in the <TT>`Makefiles'</TT> take care for the case where no +internationalization is wanted. + +If you are using Makefiles, either generated by automake, or hand-written +so they carefully follow the GNU coding standards, the effected goals for +which the new subdirectories must be handled include <SAMP>`installdirs'</SAMP>, +<SAMP>`install'</SAMP>, <SAMP>`uninstall'</SAMP>, <SAMP>`clean'</SAMP>, <SAMP>`distclean'</SAMP>. + +Here is an example of a canonical order of processing. In this +example, we also define <CODE>SUBDIRS</CODE> in <CODE>Makefile.in</CODE> for it +to be further used in the <SAMP>`dist:'</SAMP> goal. + + +<PRE> +SUBDIRS = doc lib @INTLSUB@ src @POSUB@ +</PRE> + +that you will have to adapt to your own package. + +<LI> + +A delicate point is the <SAMP>`dist:'</SAMP> goal, as both +<TT>`intl/Makefile'</TT> and <TT>`po/Makefile'</TT> will later assume that the +proper directory has been set up from the main <TT>`Makefile'</TT>. Here is +an example at what the <SAMP>`dist:'</SAMP> goal might look like: + + +<PRE> +distdir = $(PACKAGE)-$(VERSION) +dist: Makefile + rm -fr $(distdir) + mkdir $(distdir) + chmod 777 $(distdir) + for file in $(DISTFILES); do \ + ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir); \ + done + for subdir in $(SUBDIRS); do \ + mkdir $(distdir)/$$subdir || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $@) || exit 1; \ + done + tar chozf $(distdir).tar.gz $(distdir) + rm -fr $(distdir) +</PRE> + +</OL> + + + +<H3><A NAME="SEC77" HREF="gettext_toc.html#TOC77"><TT>`Makefile.in'</TT> in <TT>`src/'</TT></A></H3> + +<P> +Some of the modifications made in the main <TT>`Makefile.in'</TT> will +also be needed in the <TT>`Makefile.in'</TT> from your package sources, +which we assume here to be in the <TT>`src/'</TT> subdirectory. Here are +all the modifications needed in <TT>`src/Makefile.in'</TT>: + +</P> + +<OL> +<LI> + +In view of the <SAMP>`dist:'</SAMP> goal, you should have these lines near the +beginning of <TT>`src/Makefile.in'</TT>: + + +<PRE> +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +</PRE> + +<LI> + +If not done already, you should guarantee that <CODE>top_srcdir</CODE> +gets defined. This will serve for <CODE>cpp</CODE> include files. Just add +the line: + + +<PRE> +top_srcdir = @top_srcdir@ +</PRE> + +<LI> + +You might also want to define <CODE>subdir</CODE> as <SAMP>`src'</SAMP>, later +allowing for almost uniform <SAMP>`dist:'</SAMP> goals in all your +<TT>`Makefile.in'</TT>. At list, the <SAMP>`dist:'</SAMP> goal below assume that +you used: + + +<PRE> +subdir = src +</PRE> + +<LI> + +You should ensure that the final linking will use <CODE>@INTLLIBS@</CODE> as +a library. An easy way to achieve this is to manage that it gets into +<CODE>LIBS</CODE>, like this: + + +<PRE> +LIBS = @INTLLIBS@ @LIBS@ +</PRE> + +In most packages internationalized with GNU <CODE>gettext</CODE>, one will +find a directory <TT>`lib/'</TT> in which a library containing some helper +functions will be build. (You need at least the few functions which the +GNU <CODE>gettext</CODE> Library itself needs.) However some of the functions +in the <TT>`lib/'</TT> also give messages to the user which of course should be +translated, too. Taking care of this it is not enough to place the support +library (say <TT>`libsupport.a'</TT>) just between the <CODE>@INTLLIBS@</CODE> +and <CODE>@LIBS@</CODE> in the above example. Instead one has to write this: + + +<PRE> +LIBS = ../lib/libsupport.a @INTLLIBS@ ../lib/libsupport.a @LIBS@ +</PRE> + +<LI> + +You should also ensure that directory <TT>`intl/'</TT> will be searched for +C preprocessor include files in all circumstances. So, you have to +manage so both <SAMP>`-I../intl'</SAMP> and <SAMP>`-I$(top_srcdir)/intl'</SAMP> will +be given to the C compiler. + +<LI> + +Your <SAMP>`dist:'</SAMP> goal has to conform with others. Here is a +reasonable definition for it: + + +<PRE> +distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) +dist: Makefile $(DISTFILES) + for file in $(DISTFILES); do \ + ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir); \ + done +</PRE> + +</OL> + +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_9.html">previous</A>, <A HREF="gettext_11.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_11.html b/docs/html/gettext/gettext_11.html new file mode 100644 index 0000000000..cf4f4208cd --- /dev/null +++ b/docs/html/gettext/gettext_11.html @@ -0,0 +1,164 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - Concluding Remarks</TITLE> +<link href="gettext_12.html" rel=Next> +<link href="gettext_10.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_10.html">previous</A>, <A HREF="gettext_12.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC78" HREF="gettext_toc.html#TOC78">Concluding Remarks</A></H1> + +<P> +We would like to conclude this GNU <CODE>gettext</CODE> manual by presenting +an history of the Translation Project so far. We finally give +a few pointers for those who want to do further research or readings +about Native Language Support matters. + +</P> + + + +<H2><A NAME="SEC79" HREF="gettext_toc.html#TOC79">History of GNU <CODE>gettext</CODE></A></H2> + +<P> +Internationalization concerns and algorithms have been informally +and casually discussed for years in GNU, sometimes around GNU +<CODE>libc</CODE>, maybe around the incoming <CODE>Hurd</CODE>, or otherwise +(nobody clearly remembers). And even then, when the work started for +real, this was somewhat independently of these previous discussions. + +</P> +<P> +This all began in July 1994, when Patrick D'Cruze had the idea and +initiative of internationalizing version 3.9.2 of GNU <CODE>fileutils</CODE>. +He then asked Jim Meyering, the maintainer, how to get those changes +folded into an official release. That first draft was full of +<CODE>#ifdef</CODE>s and somewhat disconcerting, and Jim wanted to find +nicer ways. Patrick and Jim shared some tries and experimentations +in this area. Then, feeling that this might eventually have a deeper +impact on GNU, Jim wanted to know what standards were, and contacted +Richard Stallman, who very quickly and verbally described an overall +design for what was meant to become <CODE>glocale</CODE>, at that time. + +</P> +<P> +Jim implemented <CODE>glocale</CODE> and got a lot of exhausting feedback +from Patrick and Richard, of course, but also from Mitchum DSouza +(who wrote a <CODE>catgets</CODE>-like package), Roland McGrath, maybe David +MacKenzie, Fran@,{c}ois Pinard, and Paul Eggert, all pushing and +pulling in various directions, not always compatible, to the extent +that after a couple of test releases, <CODE>glocale</CODE> was torn apart. + +</P> +<P> +While Jim took some distance and time and became dad for a second +time, Roland wanted to get GNU <CODE>libc</CODE> internationalized, and +got Ulrich Drepper involved in that project. Instead of starting +from <CODE>glocale</CODE>, Ulrich rewrote something from scratch, but +more conformant to the set of guidelines who emerged out of the +<CODE>glocale</CODE> effort. Then, Ulrich got people from the previous +forum to involve themselves into this new project, and the switch +from <CODE>glocale</CODE> to what was first named <CODE>msgutils</CODE>, renamed +<CODE>nlsutils</CODE>, and later <CODE>gettext</CODE>, became officially accepted +by Richard in May 1995 or so. + +</P> +<P> +Let's summarize by saying that Ulrich Drepper wrote GNU <CODE>gettext</CODE> +in April 1995. The first official release of the package, including +PO mode, occurred in July 1995, and was numbered 0.7. Other people +contributed to the effort by providing a discussion forum around +Ulrich, writing little pieces of code, or testing. These are quoted +in the <CODE>THANKS</CODE> file which comes with the GNU <CODE>gettext</CODE> +distribution. + +</P> +<P> +While this was being done, Fran@,{c}ois adapted half a dozen of +GNU packages to <CODE>glocale</CODE> first, then later to <CODE>gettext</CODE>, +putting them in pretest, so providing along the way an effective +user environment for fine tuning the evolving tools. He also took +the responsibility of organizing and coordinating the Translation +Project. After nearly a year of informal exchanges between people from +many countries, translator teams started to exist in May 1995, through +the creation and support by Patrick D'Cruze of twenty unmoderated +mailing lists for that many native languages, and two moderated +lists: one for reaching all teams at once, the other for reaching +all willing maintainers of internationalized free software packages. + +</P> +<P> +Fran@,{c}ois also wrote PO mode in June 1995 with the collaboration +of Greg McGary, as a kind of contribution to Ulrich's package. +He also gave a hand with the GNU <CODE>gettext</CODE> Texinfo manual. + +</P> + + +<H2><A NAME="SEC80" HREF="gettext_toc.html#TOC80">Related Readings</A></H2> + +<P> +Eugene H. Dorr (<TT>`dorre@well.com'</TT>) maintains an interesting +bibliography on internationalization matters, called +<CITE>Internationalization Reference List</CITE>, which is available as: + +<PRE> +ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/i18n-books.txt +</PRE> + +<P> +Michael Gschwind (<TT>`mike@vlsivie.tuwien.ac.at'</TT>) maintains a +Frequently Asked Questions (FAQ) list, entitled <CITE>Programming for +Internationalisation</CITE>. This FAQ discusses writing programs which +can handle different language conventions, character sets, etc.; +and is applicable to all character set encodings, with particular +emphasis on ISO 8859-1. It is regularly published in Usenet +groups <TT>`comp.unix.questions'</TT>, <TT>`comp.std.internat'</TT>, +<TT>`comp.software.international'</TT>, <TT>`comp.lang.c'</TT>, +<TT>`comp.windows.x'</TT>, <TT>`comp.std.c'</TT>, <TT>`comp.answers'</TT> +and <TT>`news.answers'</TT>. The home location of this document is: + +<PRE> +ftp://ftp.vlsivie.tuwien.ac.at/pub/8bit/ISO-programming +</PRE> + +<P> +Patrick D'Cruze (<TT>`pdcruze@li.org'</TT>) wrote a tutorial about NLS +matters, and Jochen Hein (<TT>`Hein@student.tu-clausthal.de'</TT>) took +over the responsibility of maintaining it. It may be found as: + +<PRE> +ftp://sunsite.unc.edu/pub/Linux/utils/nls/catalogs/Incoming/... + ...locale-tutorial-0.8.txt.gz +</PRE> + +<P> +This site is mirrored in: + +<PRE> +ftp://ftp.ibp.fr/pub/linux/sunsite/ +</PRE> + +<P> +A French version of the same tutorial should be findable at: + +<PRE> +ftp://ftp.ibp.fr/pub/linux/french/docs/ +</PRE> + +<P> +together with French translations of many Linux-related documents. + +</P> +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_10.html">previous</A>, <A HREF="gettext_12.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_12.html b/docs/html/gettext/gettext_12.html new file mode 100644 index 0000000000..5d35fcaf03 --- /dev/null +++ b/docs/html/gettext/gettext_12.html @@ -0,0 +1,448 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - Country Codes</TITLE> +<link href="gettext_11.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_11.html">previous</A>, next, last section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC81" HREF="gettext_toc.html#TOC81">Country Codes</A></H1> + +<P> +The ISO 639 standard defines two character codes for many countries. +All abreviations for countries or languages used in the Translation +Project should come from this standard. + +</P> +<DL COMPACT> + +<DT><SAMP>`aa'</SAMP> +<DD> +Afar. +<DT><SAMP>`ab'</SAMP> +<DD> +Abkhazian. +<DT><SAMP>`af'</SAMP> +<DD> +Afrikaans. +<DT><SAMP>`am'</SAMP> +<DD> +Amharic. +<DT><SAMP>`ar'</SAMP> +<DD> +Arabic. +<DT><SAMP>`as'</SAMP> +<DD> +Assamese. +<DT><SAMP>`ay'</SAMP> +<DD> +Aymara. +<DT><SAMP>`az'</SAMP> +<DD> +Azerbaijani. +<DT><SAMP>`ba'</SAMP> +<DD> +Bashkir. +<DT><SAMP>`be'</SAMP> +<DD> +Byelorussian. +<DT><SAMP>`bg'</SAMP> +<DD> +Bulgarian. +<DT><SAMP>`bh'</SAMP> +<DD> +Bihari. +<DT><SAMP>`bi'</SAMP> +<DD> +Bislama. +<DT><SAMP>`bn'</SAMP> +<DD> +Bengali; Bangla. +<DT><SAMP>`bo'</SAMP> +<DD> +Tibetan. +<DT><SAMP>`br'</SAMP> +<DD> +Breton. +<DT><SAMP>`ca'</SAMP> +<DD> +Catalan. +<DT><SAMP>`co'</SAMP> +<DD> +Corsican. +<DT><SAMP>`cs'</SAMP> +<DD> +Czech. +<DT><SAMP>`cy'</SAMP> +<DD> +Welsh. +<DT><SAMP>`da'</SAMP> +<DD> +Danish. +<DT><SAMP>`de'</SAMP> +<DD> +German. +<DT><SAMP>`dz'</SAMP> +<DD> +Bhutani. +<DT><SAMP>`el'</SAMP> +<DD> +Greek. +<DT><SAMP>`en'</SAMP> +<DD> +English. +<DT><SAMP>`eo'</SAMP> +<DD> +Esperanto. +<DT><SAMP>`es'</SAMP> +<DD> +Spanish. +<DT><SAMP>`et'</SAMP> +<DD> +Estonian. +<DT><SAMP>`eu'</SAMP> +<DD> +Basque. +<DT><SAMP>`fa'</SAMP> +<DD> +Persian. +<DT><SAMP>`fi'</SAMP> +<DD> +Finnish. +<DT><SAMP>`fj'</SAMP> +<DD> +Fiji. +<DT><SAMP>`fo'</SAMP> +<DD> +Faroese. +<DT><SAMP>`fr'</SAMP> +<DD> +French. +<DT><SAMP>`fy'</SAMP> +<DD> +Frisian. +<DT><SAMP>`ga'</SAMP> +<DD> +Irish. +<DT><SAMP>`gd'</SAMP> +<DD> +Scots Gaelic. +<DT><SAMP>`gl'</SAMP> +<DD> +Galician. +<DT><SAMP>`gn'</SAMP> +<DD> +Guarani. +<DT><SAMP>`gu'</SAMP> +<DD> +Gujarati. +<DT><SAMP>`ha'</SAMP> +<DD> +Hausa. +<DT><SAMP>`he'</SAMP> +<DD> +Hebrew (formerly iw). +<DT><SAMP>`hi'</SAMP> +<DD> +Hindi. +<DT><SAMP>`hr'</SAMP> +<DD> +Croatian. +<DT><SAMP>`hu'</SAMP> +<DD> +Hungarian. +<DT><SAMP>`hy'</SAMP> +<DD> +Armenian. +<DT><SAMP>`ia'</SAMP> +<DD> +Interlingua. +<DT><SAMP>`id'</SAMP> +<DD> +Indonesian (formerly in). +<DT><SAMP>`ie'</SAMP> +<DD> +Interlingue. +<DT><SAMP>`ik'</SAMP> +<DD> +Inupiak. +<DT><SAMP>`is'</SAMP> +<DD> +Icelandic. +<DT><SAMP>`it'</SAMP> +<DD> +Italian. +<DT><SAMP>`iu'</SAMP> +<DD> +Inuktitut. +<DT><SAMP>`ja'</SAMP> +<DD> +Japanese. +<DT><SAMP>`jw'</SAMP> +<DD> +Javanese. +<DT><SAMP>`ka'</SAMP> +<DD> +Georgian. +<DT><SAMP>`kk'</SAMP> +<DD> +Kazakh. +<DT><SAMP>`kl'</SAMP> +<DD> +Greenlandic. +<DT><SAMP>`km'</SAMP> +<DD> +Cambodian. +<DT><SAMP>`kn'</SAMP> +<DD> +Kannada. +<DT><SAMP>`ko'</SAMP> +<DD> +Korean. +<DT><SAMP>`ks'</SAMP> +<DD> +Kashmiri. +<DT><SAMP>`ku'</SAMP> +<DD> +Kurdish. +<DT><SAMP>`ky'</SAMP> +<DD> +Kirghiz. +<DT><SAMP>`la'</SAMP> +<DD> +Latin. +<DT><SAMP>`ln'</SAMP> +<DD> +Lingala. +<DT><SAMP>`lo'</SAMP> +<DD> +Laothian. +<DT><SAMP>`lt'</SAMP> +<DD> +Lithuanian. +<DT><SAMP>`lv'</SAMP> +<DD> +Latvian, Lettish. +<DT><SAMP>`mg'</SAMP> +<DD> +Malagasy. +<DT><SAMP>`mi'</SAMP> +<DD> +Maori. +<DT><SAMP>`mk'</SAMP> +<DD> +Macedonian. +<DT><SAMP>`ml'</SAMP> +<DD> +Malayalam. +<DT><SAMP>`mn'</SAMP> +<DD> +Mongolian. +<DT><SAMP>`mo'</SAMP> +<DD> +Moldavian. +<DT><SAMP>`mr'</SAMP> +<DD> +Marathi. +<DT><SAMP>`ms'</SAMP> +<DD> +Malay. +<DT><SAMP>`mt'</SAMP> +<DD> +Maltese. +<DT><SAMP>`my'</SAMP> +<DD> +Burmese. +<DT><SAMP>`na'</SAMP> +<DD> +Nauru. +<DT><SAMP>`ne'</SAMP> +<DD> +Nepali. +<DT><SAMP>`nl'</SAMP> +<DD> +Dutch. +<DT><SAMP>`no'</SAMP> +<DD> +Norwegian. +<DT><SAMP>`oc'</SAMP> +<DD> +Occitan. +<DT><SAMP>`om'</SAMP> +<DD> +(Afan) Oromo. +<DT><SAMP>`or'</SAMP> +<DD> +Oriya. +<DT><SAMP>`pa'</SAMP> +<DD> +Punjabi. +<DT><SAMP>`pl'</SAMP> +<DD> +Polish. +<DT><SAMP>`ps'</SAMP> +<DD> +Pashto, Pushto. +<DT><SAMP>`pt'</SAMP> +<DD> +Portuguese. +<DT><SAMP>`qu'</SAMP> +<DD> +Quechua. +<DT><SAMP>`rm'</SAMP> +<DD> +Rhaeto-Romance. +<DT><SAMP>`rn'</SAMP> +<DD> +Kirundi. +<DT><SAMP>`ro'</SAMP> +<DD> +Romanian. +<DT><SAMP>`ru'</SAMP> +<DD> +Russian. +<DT><SAMP>`rw'</SAMP> +<DD> +Kinyarwanda. +<DT><SAMP>`sa'</SAMP> +<DD> +Sanskrit. +<DT><SAMP>`sd'</SAMP> +<DD> +Sindhi. +<DT><SAMP>`sg'</SAMP> +<DD> +Sangro. +<DT><SAMP>`sh'</SAMP> +<DD> +Serbo-Croatian. +<DT><SAMP>`si'</SAMP> +<DD> +Sinhalese. +<DT><SAMP>`sk'</SAMP> +<DD> +Slovak. +<DT><SAMP>`sl'</SAMP> +<DD> +Slovenian. +<DT><SAMP>`sm'</SAMP> +<DD> +Samoan. +<DT><SAMP>`sn'</SAMP> +<DD> +Shona. +<DT><SAMP>`so'</SAMP> +<DD> +Somali. +<DT><SAMP>`sq'</SAMP> +<DD> +Albanian. +<DT><SAMP>`sr'</SAMP> +<DD> +Serbian. +<DT><SAMP>`ss'</SAMP> +<DD> +Siswati. +<DT><SAMP>`st'</SAMP> +<DD> +Sesotho. +<DT><SAMP>`su'</SAMP> +<DD> +Sundanese. +<DT><SAMP>`sv'</SAMP> +<DD> +Swedish. +<DT><SAMP>`sw'</SAMP> +<DD> +Swahili. +<DT><SAMP>`ta'</SAMP> +<DD> +Tamil. +<DT><SAMP>`te'</SAMP> +<DD> +Telugu. +<DT><SAMP>`tg'</SAMP> +<DD> +Tajik. +<DT><SAMP>`th'</SAMP> +<DD> +Thai. +<DT><SAMP>`ti'</SAMP> +<DD> +Tigrinya. +<DT><SAMP>`tk'</SAMP> +<DD> +Turkmen. +<DT><SAMP>`tl'</SAMP> +<DD> +Tagalog. +<DT><SAMP>`tn'</SAMP> +<DD> +Setswana. +<DT><SAMP>`to'</SAMP> +<DD> +Tonga. +<DT><SAMP>`tr'</SAMP> +<DD> +Turkish. +<DT><SAMP>`ts'</SAMP> +<DD> +Tsonga. +<DT><SAMP>`tt'</SAMP> +<DD> +Tatar. +<DT><SAMP>`tw'</SAMP> +<DD> +Twi. +<DT><SAMP>`ug'</SAMP> +<DD> +Uighur. +<DT><SAMP>`uk'</SAMP> +<DD> +Ukrainian. +<DT><SAMP>`ur'</SAMP> +<DD> +Urdu. +<DT><SAMP>`uz'</SAMP> +<DD> +Uzbek. +<DT><SAMP>`vi'</SAMP> +<DD> +Vietnamese. +<DT><SAMP>`vo'</SAMP> +<DD> +Volapuk. +<DT><SAMP>`wo'</SAMP> +<DD> +Wolof. +<DT><SAMP>`xh'</SAMP> +<DD> +Xhosa. +<DT><SAMP>`yi'</SAMP> +<DD> +Yiddish (formerly ji). +<DT><SAMP>`yo'</SAMP> +<DD> +Yoruba. +<DT><SAMP>`za'</SAMP> +<DD> +Zhuang. +<DT><SAMP>`zh'</SAMP> +<DD> +Chinese. +<DT><SAMP>`zu'</SAMP> +<DD> +Zulu. +</DL> + +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_11.html">previous</A>, next, last section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_2.html b/docs/html/gettext/gettext_2.html new file mode 100644 index 0000000000..14e1844a33 --- /dev/null +++ b/docs/html/gettext/gettext_2.html @@ -0,0 +1,667 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - PO Files and PO Mode Basics</TITLE> +<link href="gettext_3.html" rel=Next> +<link href="gettext_1.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_1.html">previous</A>, <A HREF="gettext_3.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC7" HREF="gettext_toc.html#TOC7">PO Files and PO Mode Basics</A></H1> + +<P> +The GNU <CODE>gettext</CODE> toolset helps programmers and translators +at producing, updating and using translation files, mainly those +PO files which are textual, editable files. This chapter stresses +the format of PO files, and contains a PO mode starter. PO mode +description is spread throughout this manual instead of being concentrated +in one place. Here we present only the basics of PO mode. + +</P> + + + +<H2><A NAME="SEC8" HREF="gettext_toc.html#TOC8">Completing GNU <CODE>gettext</CODE> Installation</A></H2> + +<P> +Once you have received, unpacked, configured and compiled the GNU +<CODE>gettext</CODE> distribution, the <SAMP>`make install'</SAMP> command puts in +place the programs <CODE>xgettext</CODE>, <CODE>msgfmt</CODE>, <CODE>gettext</CODE>, and +<CODE>msgmerge</CODE>, as well as their available message catalogs. To +top off a comfortable installation, you might also want to make the +PO mode available to your GNU Emacs users. + +</P> +<P> +During the installation of the PO mode, you might want modify your +file <TT>`.emacs'</TT>, once and for all, so it contains a few lines looking +like: + +</P> + +<PRE> +(setq auto-mode-alist + (cons '("\\.po[tx]?\\'\\|\\.po\\." . po-mode) auto-mode-alist)) +(autoload 'po-mode "po-mode") +</PRE> + +<P> +Later, whenever you edit some <TT>`.po'</TT>, <TT>`.pot'</TT> or <TT>`.pox'</TT> +file, or any file having the string <SAMP>`.po.'</SAMP> within its name, +Emacs loads <TT>`po-mode.elc'</TT> (or <TT>`po-mode.el'</TT>) as needed, and +automatically activates PO mode commands for the associated buffer. +The string <EM>PO</EM> appears in the mode line for any buffer for +which PO mode is active. Many PO files may be active at once in a +single Emacs session. + +</P> +<P> +If you are using Emacs version 20 or better, and have already installed +the appropriate international fonts on your system, you may also manage +for the these fonts to be automatically loaded and used for displaying +the translations on your Emacs screen, whenever necessary. For this to +happen, you might want to add the lines: + +</P> + +<PRE> +(autoload 'po-find-file-coding-system "po-mode") +(modify-coding-system-alist 'file "\\.po[tx]?\\'\\|\\.po\\." + 'po-find-file-coding-system) +</PRE> + +<P> +to your <TT>`.emacs'</TT> file. + +</P> + + +<H2><A NAME="SEC9" HREF="gettext_toc.html#TOC9">The Format of PO Files</A></H2> + +<P> +A PO file is made up of many entries, each entry holding the relation +between an original untranslated string and its corresponding +translation. All entries in a given PO file usually pertain +to a single project, and all translations are expressed in a single +target language. One PO file <STRONG>entry</STRONG> has the following schematic +structure: + +</P> + +<PRE> +<VAR>white-space</VAR> +# <VAR>translator-comments</VAR> +#. <VAR>automatic-comments</VAR> +#: <VAR>reference</VAR>... +#, <VAR>flag</VAR>... +msgid <VAR>untranslated-string</VAR> +msgstr <VAR>translated-string</VAR> +</PRE> + +<P> +The general structure of a PO file should be well understood by +the translator. When using PO mode, very little has to be known +about the format details, as PO mode takes care of them for her. + +</P> +<P> +Entries begin with some optional white space. Usually, when generated +through GNU <CODE>gettext</CODE> tools, there is exactly one blank line +between entries. Then comments follow, on lines all starting with the +character <KBD>#</KBD>. There are two kinds of comments: those which have +some white space immediately following the <KBD>#</KBD>, which comments are +created and maintained exclusively by the translator, and those which +have some non-white character just after the <KBD>#</KBD>, which comments +are created and maintained automatically by GNU <CODE>gettext</CODE> tools. +All comments, of either kind, are optional. + +</P> +<P> +After white space and comments, entries show two strings, giving +first the untranslated string as it appears in the original program +sources, and then, the translation of this string. The original +string is introduced by the keyword <CODE>msgid</CODE>, and the translation, +by <CODE>msgstr</CODE>. The two strings, untranslated and translated, +are quoted in various ways in the PO file, using <KBD>"</KBD> +delimiters and <KBD>\</KBD> escapes, but the translator does not really +have to pay attention to the precise quoting format, as PO mode fully +intend to take care of quoting for her. + +</P> +<P> +The <CODE>msgid</CODE> strings, as well as automatic comments, are produced +and managed by other GNU <CODE>gettext</CODE> tools, and PO mode does not +provide means for the translator to alter these. The most she can +do is merely deleting them, and only by deleting the whole entry. +On the other hand, the <CODE>msgstr</CODE> string, as well as translator +comments, are really meant for the translator, and PO mode gives her +the full control she needs. + +</P> +<P> +The comment lines beginning with <KBD>#,</KBD> are special because they are +not completely ignored by the programs as comments generally are. The +comma separated list of <VAR>flag</VAR>s is used by the <CODE>msgfmt</CODE> +program to give the user some better disgnostic messages. Currently +there are two forms of flags defined: + +</P> +<DL COMPACT> + +<DT><KBD>fuzzy</KBD> +<DD> +This flag can be generated by the <CODE>msgmerge</CODE> program or it can be +inserted by the translator herself. It shows that the <CODE>msgstr</CODE> +string might not be a correct translation (anymore). Only the translator +can judge if the translation requires further modification, or is +acceptable as is. Once satisfied with the translation, she then removes +this <KBD>fuzzy</KBD> attribute. The <CODE>msgmerge</CODE> programs inserts this +when it combined the <CODE>msgid</CODE> and <CODE>msgstr</CODE> entries after fuzzy +search only. See section <A HREF="gettext_5.html#SEC26">Fuzzy Entries</A>. + +<DT><KBD>c-format</KBD> +<DD> +<DT><KBD>no-c-format</KBD> +<DD> +These flags should not be added by a human. Instead only the +<CODE>xgettext</CODE> program adds them. In an automatized PO file processing +system as proposed here the user changes would be thrown away again as +soon as the <CODE>xgettext</CODE> program generates a new template file. + +In case the <KBD>c-format</KBD> flag is given for a string the <CODE>msgfmt</CODE> +does some more tests to check to validity of the translation. +See section <A HREF="gettext_6.html#SEC33">Invoking the <CODE>msgfmt</CODE> Program</A>. + +</DL> + +<P> +It happens that some lines, usually whitespace or comments, follow the +very last entry of a PO file. Such lines are not part of any entry, +and PO mode is unable to take action on those lines. By using the +PO mode function <KBD>M-x po-normalize</KBD>, the translator may get +rid of those spurious lines. See section <A HREF="gettext_2.html#SEC12">Normalizing Strings in Entries</A>. + +</P> +<P> +The remainder of this section may be safely skipped by those using +PO mode, yet it may be interesting for everybody to have a better +idea of the precise format of a PO file. On the other hand, those +not having GNU Emacs handy should carefully continue reading on. + +</P> +<P> +Each of <VAR>untranslated-string</VAR> and <VAR>translated-string</VAR> respects +the C syntax for a character string, including the surrounding quotes +and imbedded backslashed escape sequences. When the time comes +to write multi-line strings, one should not use escaped newlines. +Instead, a closing quote should follow the last character on the +line to be continued, and an opening quote should resume the string +at the beginning of the following PO file line. For example: + +</P> + +<PRE> +msgid "" +"Here is an example of how one might continue a very long string\n" +"for the common case the string represents multi-line output.\n" +</PRE> + +<P> +In this example, the empty string is used on the first line, to +allow better alignment of the <KBD>H</KBD> from the word <SAMP>`Here'</SAMP> +over the <KBD>f</KBD> from the word <SAMP>`for'</SAMP>. In this example, the +<CODE>msgid</CODE> keyword is followed by three strings, which are meant +to be concatenated. Concatenating the empty string does not change +the resulting overall string, but it is a way for us to comply with +the necessity of <CODE>msgid</CODE> to be followed by a string on the same +line, while keeping the multi-line presentation left-justified, as +we find this to be a cleaner disposition. The empty string could have +been omitted, but only if the string starting with <SAMP>`Here'</SAMP> was +promoted on the first line, right after <CODE>msgid</CODE>.<A NAME="DOCF1" HREF="gettext_foot.html#FOOT1">(1)</A> It was not really necessary +either to switch between the two last quoted strings immediately after +the newline <SAMP>`\n'</SAMP>, the switch could have occurred after <EM>any</EM> +other character, we just did it this way because it is neater. + +</P> +<P> +One should carefully distinguish between end of lines marked as +<SAMP>`\n'</SAMP> <EM>inside</EM> quotes, which are part of the represented +string, and end of lines in the PO file itself, outside string quotes, +which have no incidence on the represented string. + +</P> +<P> +Outside strings, white lines and comments may be used freely. +Comments start at the beginning of a line with <SAMP>`#'</SAMP> and extend +until the end of the PO file line. Comments written by translators +should have the initial <SAMP>`#'</SAMP> immediately followed by some white +space. If the <SAMP>`#'</SAMP> is not immediately followed by white space, +this comment is most likely generated and managed by specialized GNU +tools, and might disappear or be replaced unexpectedly when the PO +file is given to <CODE>msgmerge</CODE>. + +</P> + + +<H2><A NAME="SEC10" HREF="gettext_toc.html#TOC10">Main PO mode Commands</A></H2> + +<P> +After setting up Emacs with something similar to the lines in +section <A HREF="gettext_2.html#SEC8">Completing GNU <CODE>gettext</CODE> Installation</A>, PO mode is activated for a window when Emacs finds a +PO file in that window. This puts the window read-only and establishes a +po-mode-map, which is a genuine Emacs mode, in a way that is not derived +from text mode in any way. Functions found on <CODE>po-mode-hook</CODE>, +if any, will be executed. + +</P> +<P> +When PO mode is active in a window, the letters <SAMP>`PO'</SAMP> appear +in the mode line for that window. The mode line also displays how +many entries of each kind are held in the PO file. For example, +the string <SAMP>`132t+3f+10u+2o'</SAMP> would tell the translator that the +PO mode contains 132 translated entries (see section <A HREF="gettext_5.html#SEC25">Translated Entries</A>, +3 fuzzy entries (see section <A HREF="gettext_5.html#SEC26">Fuzzy Entries</A>), 10 untranslated entries +(see section <A HREF="gettext_5.html#SEC27">Untranslated Entries</A>) and 2 obsolete entries (see section <A HREF="gettext_5.html#SEC28">Obsolete Entries</A>). Zero-coefficients items are not shown. So, in this example, if +the fuzzy entries were unfuzzied, the untranslated entries were translated +and the obsolete entries were deleted, the mode line would merely display +<SAMP>`145t'</SAMP> for the counters. + +</P> +<P> +The main PO commands are those which do not fit into the other categories of +subsequent sections. These allow for quitting PO mode or for managing windows +in special ways. + +</P> +<DL COMPACT> + +<DT><KBD>U</KBD> +<DD> +Undo last modification to the PO file. + +<DT><KBD>Q</KBD> +<DD> +Quit processing and save the PO file. + +<DT><KBD>q</KBD> +<DD> +Quit processing, possibly after confirmation. + +<DT><KBD>O</KBD> +<DD> +Temporary leave the PO file window. + +<DT><KBD>?</KBD> +<DD> +<DT><KBD>h</KBD> +<DD> +Show help about PO mode. + +<DT><KBD>=</KBD> +<DD> +Give some PO file statistics. + +<DT><KBD>V</KBD> +<DD> +Batch validate the format of the whole PO file. + +</DL> + +<P> +The command <KBD>U</KBD> (<CODE>po-undo</CODE>) interfaces to the GNU Emacs +<EM>undo</EM> facility. See section `Undoing Changes' in <CITE>The Emacs Editor</CITE>. Each time <KBD>U</KBD> is typed, modifications which the translator +did to the PO file are undone a little more. For the purpose of +undoing, each PO mode command is atomic. This is especially true for +the <KBD><KBD>RET</KBD></KBD> command: the whole edition made by using a single +use of this command is undone at once, even if the edition itself +implied several actions. However, while in the editing window, one +can undo the edition work quite parsimoniously. + +</P> +<P> +The commands <KBD>Q</KBD> (<CODE>po-quit</CODE>) and <KBD>q</KBD> +(<CODE>po-confirm-and-quit</CODE>) are used when the translator is done with the +PO file. The former is a bit less verbose than the latter. If the file +has been modified, it is saved to disk first. In both cases, and prior to +all this, the commands check if some untranslated message remains in the +PO file and, if yes, the translator is asked if she really wants to leave +off working with this PO file. This is the preferred way of getting rid +of an Emacs PO file buffer. Merely killing it through the usual command +<KBD>C-x k</KBD> (<CODE>kill-buffer</CODE>) is not the tidiest way to proceed. + +</P> +<P> +The command <KBD>O</KBD> (<CODE>po-other-window</CODE>) is another, softer way, +to leave PO mode, temporarily. It just moves the cursor to some other +Emacs window, and pops one if necessary. For example, if the translator +just got PO mode to show some source context in some other, she might +discover some apparent bug in the program source that needs correction. +This command allows the translator to change sex, become a programmer, +and have the cursor right into the window containing the program she +(or rather <EM>he</EM>) wants to modify. By later getting the cursor back +in the PO file window, or by asking Emacs to edit this file once again, +PO mode is then recovered. + +</P> +<P> +The command <KBD>h</KBD> (<CODE>po-help</CODE>) displays a summary of all available PO +mode commands. The translator should then type any character to resume +normal PO mode operations. The command <KBD>?</KBD> has the same effect +as <KBD>h</KBD>. + +</P> +<P> +The command <KBD>=</KBD> (<CODE>po-statistics</CODE>) computes the total number of +entries in the PO file, the ordinal of the current entry (counted from +1), the number of untranslated entries, the number of obsolete entries, +and displays all these numbers. + +</P> +<P> +The command <KBD>V</KBD> (<CODE>po-validate</CODE>) launches <CODE>msgfmt</CODE> in verbose +mode over the current PO file. This command first offers to save the +current PO file on disk. The <CODE>msgfmt</CODE> tool, from GNU <CODE>gettext</CODE>, +has the purpose of creating a MO file out of a PO file, and PO mode uses +the features of this program for checking the overall format of a PO file, +as well as all individual entries. + +</P> +<P> +The program <CODE>msgfmt</CODE> runs asynchronously with Emacs, so the +translator regains control immediately while her PO file is being studied. +Error output is collected in the GNU Emacs <SAMP>`*compilation*'</SAMP> buffer, +displayed in another window. The regular GNU Emacs command <KBD>C-x`</KBD> +(<CODE>next-error</CODE>), as well as other usual compile commands, allow the +translator to reposition quickly to the offending parts of the PO file. +Once the cursor is on the line in error, the translator may decide on +any PO mode action which would help correcting the error. + +</P> + + +<H2><A NAME="SEC11" HREF="gettext_toc.html#TOC11">Entry Positioning</A></H2> + +<P> +The cursor in a PO file window is almost always part of +an entry. The only exceptions are the special case when the cursor +is after the last entry in the file, or when the PO file is +empty. The entry where the cursor is found to be is said to be the +current entry. Many PO mode commands operate on the current entry, +so moving the cursor does more than allowing the translator to browse +the PO file, this also selects on which entry commands operate. + +</P> +<P> +Some PO mode commands alter the position of the cursor in a specialized +way. A few of those special purpose positioning are described here, +the others are described in following sections. + +</P> +<DL COMPACT> + +<DT><KBD>.</KBD> +<DD> +Redisplay the current entry. + +<DT><KBD>n</KBD> +<DD> +<DT><KBD>n</KBD> +<DD> +Select the entry after the current one. + +<DT><KBD>p</KBD> +<DD> +<DT><KBD>p</KBD> +<DD> +Select the entry before the current one. + +<DT><KBD><</KBD> +<DD> +Select the first entry in the PO file. + +<DT><KBD>></KBD> +<DD> +Select the last entry in the PO file. + +<DT><KBD>m</KBD> +<DD> +Record the location of the current entry for later use. + +<DT><KBD>l</KBD> +<DD> +Return to a previously saved entry location. + +<DT><KBD>x</KBD> +<DD> +Exchange the current entry location with the previously saved one. + +</DL> + +<P> +Any GNU Emacs command able to reposition the cursor may be used +to select the current entry in PO mode, including commands which +move by characters, lines, paragraphs, screens or pages, and search +commands. However, there is a kind of standard way to display the +current entry in PO mode, which usual GNU Emacs commands moving +the cursor do not especially try to enforce. The command <KBD>.</KBD> +(<CODE>po-current-entry</CODE>) has the sole purpose of redisplaying the +current entry properly, after the current entry has been changed by +means external to PO mode, or the Emacs screen otherwise altered. + +</P> +<P> +It is yet to be decided if PO mode helps the translator, or otherwise +irritates her, by forcing a rigid window disposition while she +is doing her work. We originally had quite precise ideas about +how windows should behave, but on the other hand, anyone used to +GNU Emacs is often happy to keep full control. Maybe a fixed window +disposition might be offered as a PO mode option that the translator +might activate or deactivate at will, so it could be offered on an +experimental basis. If nobody feels a real need for using it, or +a compulsion for writing it, we should drop this whole idea. +The incentive for doing it should come from translators rather than +programmers, as opinions from an experienced translator are surely +more worth to me than opinions from programmers <EM>thinking</EM> about +how <EM>others</EM> should do translation. + +</P> +<P> +The commands <KBD>n</KBD> (<CODE>po-next-entry</CODE>) and <KBD>p</KBD> +(<CODE>po-previous-entry</CODE>) move the cursor the entry following, +or preceding, the current one. If <KBD>n</KBD> is given while the +cursor is on the last entry of the PO file, or if <KBD>p</KBD> +is given while the cursor is on the first entry, no move is done. + +</P> +<P> +The commands <KBD><</KBD> (<CODE>po-first-entry</CODE>) and <KBD>></KBD> +(<CODE>po-last-entry</CODE>) move the cursor to the first entry, or last +entry, of the PO file. When the cursor is located past the last +entry in a PO file, most PO mode commands will return an error saying +<SAMP>`After last entry'</SAMP>. Moreover, the commands <KBD><</KBD> and <KBD>></KBD> +have the special property of being able to work even when the cursor +is not into some PO file entry, and one may use them for nicely +correcting this situation. But even these commands will fail on a +truly empty PO file. There are development plans for the PO mode for it +to interactively fill an empty PO file from sources. See section <A HREF="gettext_3.html#SEC16">Marking Translatable Strings</A>. + +</P> +<P> +The translator may decide, before working at the translation of +a particular entry, that she needs to browse the remainder of the +PO file, maybe for finding the terminology or phraseology used +in related entries. She can of course use the standard Emacs idioms +for saving the current cursor location in some register, and use that +register for getting back, or else, use the location ring. + +</P> +<P> +PO mode offers another approach, by which cursor locations may be saved +onto a special stack. The command <KBD>m</KBD> (<CODE>po-push-location</CODE>) +merely adds the location of current entry to the stack, pushing +the already saved locations under the new one. The command +<KBD>r</KBD> (<CODE>po-pop-location</CODE>) consumes the top stack element and +reposition the cursor to the entry associated with that top element. +This position is then lost, for the next <KBD>r</KBD> will move the cursor +to the previously saved location, and so on until no locations remain +on the stack. + +</P> +<P> +If the translator wants the position to be kept on the location stack, +maybe for taking a look at the entry associated with the top +element, then go elsewhere with the intent of getting back later, she +ought to use <KBD>m</KBD> immediately after <KBD>r</KBD>. + +</P> +<P> +The command <KBD>x</KBD> (<CODE>po-exchange-location</CODE>) simultaneously +reposition the cursor to the entry associated with the top element of +the stack of saved locations, and replace that top element with the +location of the current entry before the move. Consequently, repeating +the <KBD>x</KBD> command toggles alternatively between two entries. +For achieving this, the translator will position the cursor on the +first entry, use <KBD>m</KBD>, then position to the second entry, and +merely use <KBD>x</KBD> for making the switch. + +</P> + + +<H2><A NAME="SEC12" HREF="gettext_toc.html#TOC12">Normalizing Strings in Entries</A></H2> + +<P> +There are many different ways for encoding a particular string into a +PO file entry, because there are so many different ways to split and +quote multi-line strings, and even, to represent special characters +by backslahsed escaped sequences. Some features of PO mode rely on +the ability for PO mode to scan an already existing PO file for a +particular string encoded into the <CODE>msgid</CODE> field of some entry. +Even if PO mode has internally all the built-in machinery for +implementing this recognition easily, doing it fast is technically +difficult. To facilitate a solution to this efficiency problem, +we decided on a canonical representation for strings. + +</P> +<P> +A conventional representation of strings in a PO file is currently +under discussion, and PO mode experiments with a canonical representation. +Having both <CODE>xgettext</CODE> and PO mode converging towards a uniform +way of representing equivalent strings would be useful, as the internal +normalization needed by PO mode could be automatically satisfied +when using <CODE>xgettext</CODE> from GNU <CODE>gettext</CODE>. An explicit +PO mode normalization should then be only necessary for PO files +imported from elsewhere, or for when the convention itself evolves. + +</P> +<P> +So, for achieving normalization of at least the strings of a given +PO file needing a canonical representation, the following PO mode +command is available: + +</P> +<DL COMPACT> + +<DT><KBD>M-x po-normalize</KBD> +<DD> +Tidy the whole PO file by making entries more uniform. + +</DL> + +<P> +The special command <KBD>M-x po-normalize</KBD>, which has no associate +keys, revises all entries, ensuring that strings of both original +and translated entries use uniform internal quoting in the PO file. +It also removes any crumb after the last entry. This command may be +useful for PO files freshly imported from elsewhere, or if we ever +improve on the canonical quoting format we use. This canonical format +is not only meant for getting cleaner PO files, but also for greatly +speeding up <CODE>msgid</CODE> string lookup for some other PO mode commands. + +</P> +<P> +<KBD>M-x po-normalize</KBD> presently makes three passes over the entries. +The first implements heuristics for converting PO files for GNU +<CODE>gettext</CODE> 0.6 and earlier, in which <CODE>msgid</CODE> and <CODE>msgstr</CODE> +fields were using K&R style C string syntax for multi-line strings. +These heuristics may fail for comments not related to obsolete +entries and ending with a backslash; they also depend on subsequent +passes for finalizing the proper commenting of continued lines for +obsolete entries. This first pass might disappear once all oldish PO +files would have been adjusted. The second and third pass normalize +all <CODE>msgid</CODE> and <CODE>msgstr</CODE> strings respectively. They also +clean out those trailing backslashes used by XView's <CODE>msgfmt</CODE> +for continued lines. + +</P> +<P> +Having such an explicit normalizing command allows for importing PO +files from other sources, but also eases the evolution of the current +convention, evolution driven mostly by aesthetic concerns, as of now. +It is easy to make suggested adjustments at a later time, as the +normalizing command and eventually, other GNU <CODE>gettext</CODE> tools +should greatly automate conformance. A description of the canonical +string format is given below, for the particular benefit of those not +having GNU Emacs handy, and who would nevertheless want to handcraft +their PO files in nice ways. + +</P> +<P> +Right now, in PO mode, strings are single line or multi-line. A string +goes multi-line if and only if it has <EM>embedded</EM> newlines, that +is, if it matches <SAMP>`[^\n]\n+[^\n]'</SAMP>. So, we would have: + +</P> + +<PRE> +msgstr "\n\nHello, world!\n\n\n" +</PRE> + +<P> +but, replacing the space by a newline, this becomes: + +</P> + +<PRE> +msgstr "" +"\n" +"\n" +"Hello,\n" +"world!\n" +"\n" +"\n" +</PRE> + +<P> +We are deliberately using a caricatural example, here, to make the +point clearer. Usually, multi-lines are not that bad looking. +It is probable that we will implement the following suggestion. +We might lump together all initial newlines into the empty string, +and also all newlines introducing empty lines (that is, for <VAR>n</VAR> +> 1, the <VAR>n</VAR>-1'th last newlines would go together on a separate +string), so making the previous example appear: + +</P> + +<PRE> +msgstr "\n\n" +"Hello,\n" +"world!\n" +"\n\n" +</PRE> + +<P> +There are a few yet undecided little points about string normalization, +to be documented in this manual, once these questions settle. + +</P> +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_1.html">previous</A>, <A HREF="gettext_3.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_3.html b/docs/html/gettext/gettext_3.html new file mode 100644 index 0000000000..482a9872f7 --- /dev/null +++ b/docs/html/gettext/gettext_3.html @@ -0,0 +1,606 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - Preparing Program Sources</TITLE> +<link href="gettext_4.html" rel=Next> +<link href="gettext_2.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_2.html">previous</A>, <A HREF="gettext_4.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC13" HREF="gettext_toc.html#TOC13">Preparing Program Sources</A></H1> + +<P> +For the programmer, changes to the C source code fall into three +categories. First, you have to make the localization functions +known to all modules needing message translation. Second, you should +properly trigger the operation of GNU <CODE>gettext</CODE> when the program +initializes, usually from the <CODE>main</CODE> function. Last, you should +identify and especially mark all constant strings in your program +needing translation. + +</P> +<P> +Presuming that your set of programs, or package, has been adjusted +so all needed GNU <CODE>gettext</CODE> files are available, and your +<TT>`Makefile'</TT> files are adjusted (see section <A HREF="gettext_10.html#SEC67">The Maintainer's View</A>), each C module +having translated C strings should contain the line: + +</P> + +<PRE> +#include <libintl.h> +</PRE> + +<P> +The remaining changes to your C sources are discussed in the further +sections of this chapter. + +</P> + + + +<H2><A NAME="SEC14" HREF="gettext_toc.html#TOC14">Triggering <CODE>gettext</CODE> Operations</A></H2> + +<P> +The initialization of locale data should be done with more or less +the same code in every program, as demonstrated below: + +</P> + +<PRE> +int +main (argc, argv) + int argc; + char argv; +{ + ... + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + ... +} +</PRE> + +<P> +<VAR>PACKAGE</VAR> and <VAR>LOCALEDIR</VAR> should be provided either by +<TT>`config.h'</TT> or by the Makefile. For now consult the <CODE>gettext</CODE> +sources for more information. + +</P> +<P> +The use of <CODE>LC_ALL</CODE> might not be appropriate for you. +<CODE>LC_ALL</CODE> includes all locale categories and especially +<CODE>LC_CTYPE</CODE>. This later category is responsible for determining +character classes with the <CODE>isalnum</CODE> etc. functions from +<TT>`ctype.h'</TT> which could especially for programs, which process some +kind of input language, be wrong. For example this would mean that a +source code using the @,{c} (c-cedilla character) is runnable in +France but not in the U.S. + +</P> +<P> +Some systems also have problems with parsing number using the +<CODE>scanf</CODE> functions if an other but the <CODE>LC_ALL</CODE> locale is used. +The standards say that additional formats but the one known in the +<CODE>"C"</CODE> locale might be recognized. But some systems seem to reject +numbers in the <CODE>"C"</CODE> locale format. In some situation, it might +also be a problem with the notation itself which makes it impossible to +recognize whether the number is in the <CODE>"C"</CODE> locale or the local +format. This can happen if thousands separator characters are used. +Some locales define this character accordfing to the national +conventions to <CODE>'.'</CODE> which is the same character used in the +<CODE>"C"</CODE> locale to denote the decimal point. + +</P> +<P> +So it is sometimes necessary to replace the <CODE>LC_ALL</CODE> line in the +code above by a sequence of <CODE>setlocale</CODE> lines + +</P> + +<PRE> +{ + ... + setlocale (LC_TIME, ""); + setlocale (LC_MESSAGES, ""); + ... +} +</PRE> + +<P> +or to switch for and back to the character class in question. On all +POSIX conformant systems the locale categories <CODE>LC_CTYPE</CODE>, +<CODE>LC_COLLATE</CODE>, <CODE>LC_MONETARY</CODE>, <CODE>LC_NUMERIC</CODE>, and +<CODE>LC_TIME</CODE> are available. On some modern systems there is also a +locale <CODE>LC_MESSAGES</CODE> which is called on some old, XPG2 compliant +systems <CODE>LC_RESPONSES</CODE>. + +</P> + + +<H2><A NAME="SEC15" HREF="gettext_toc.html#TOC15">How Marks Appears in Sources</A></H2> + +<P> +All strings requiring translation should be marked in the C sources. Marking +is done in such a way that each translatable string appears to be +the sole argument of some function or preprocessor macro. There are +only a few such possible functions or macros meant for translation, +and their names are said to be marking keywords. The marking is +attached to strings themselves, rather than to what we do with them. +This approach has more uses. A blatant example is an error message +produced by formatting. The format string needs translation, as +well as some strings inserted through some <SAMP>`%s'</SAMP> specification +in the format, while the result from <CODE>sprintf</CODE> may have so many +different instances that it is impractical to list them all in some +<SAMP>`error_string_out()'</SAMP> routine, say. + +</P> +<P> +This marking operation has two goals. The first goal of marking +is for triggering the retrieval of the translation, at run time. +The keyword are possibly resolved into a routine able to dynamically +return the proper translation, as far as possible or wanted, for the +argument string. Most localizable strings are found in executable +positions, that is, attached to variables or given as parameters to +functions. But this is not universal usage, and some translatable +strings appear in structured initializations. See section <A HREF="gettext_3.html#SEC18">Special Cases of Translatable Strings</A>. + +</P> +<P> +The second goal of the marking operation is to help <CODE>xgettext</CODE> +at properly extracting all translatable strings when it scans a set +of program sources and produces PO file templates. + +</P> +<P> +The canonical keyword for marking translatable strings is +<SAMP>`gettext'</SAMP>, it gave its name to the whole GNU <CODE>gettext</CODE> +package. For packages making only light use of the <SAMP>`gettext'</SAMP> +keyword, macro or function, it is easily used <EM>as is</EM>. However, +for packages using the <CODE>gettext</CODE> interface more heavily, it +is usually more convenient to give the main keyword a shorter, less +obtrusive name. Indeed, the keyword might appear on a lot of strings +all over the package, and programmers usually do not want nor need +their program sources to remind them forcefully, all the time, that they +are internationalized. Further, a long keyword has the disadvantage +of using more horizontal space, forcing more indentation work on +sources for those trying to keep them within 79 or 80 columns. + +</P> +<P> +Many packages use <SAMP>`_'</SAMP> (a simple underline) as a keyword, +and write <SAMP>`_("Translatable string")'</SAMP> instead of <SAMP>`gettext +("Translatable string")'</SAMP>. Further, the coding rule, from GNU standards, +wanting that there is a space between the keyword and the opening +parenthesis is relaxed, in practice, for this particular usage. +So, the textual overhead per translatable string is reduced to +only three characters: the underline and the two parentheses. +However, even if GNU <CODE>gettext</CODE> uses this convention internally, +it does not offer it officially. The real, genuine keyword is truly +<SAMP>`gettext'</SAMP> indeed. It is fairly easy for those wanting to use +<SAMP>`_'</SAMP> instead of <SAMP>`gettext'</SAMP> to declare: + +</P> + +<PRE> +#include <libintl.h> +#define _(String) gettext (String) +</PRE> + +<P> +instead of merely using <SAMP>`#include <libintl.h>'</SAMP>. + +</P> +<P> +Later on, the maintenance is relatively easy. If, as a programmer, +you add or modify a string, you will have to ask yourself if the +new or altered string requires translation, and include it within +<SAMP>`_()'</SAMP> if you think it should be translated. <SAMP>`"%s: %d"'</SAMP> is +an example of string <EM>not</EM> requiring translation! + +</P> + + +<H2><A NAME="SEC16" HREF="gettext_toc.html#TOC16">Marking Translatable Strings</A></H2> + +<P> +In PO mode, one set of features is meant more for the programmer than +for the translator, and allows him to interactively mark which strings, +in a set of program sources, are translatable, and which are not. +Even if it is a fairly easy job for a programmer to find and mark +such strings by other means, using any editor of his choice, PO mode +makes this work more comfortable. Further, this gives translators +who feel a little like programmers, or programmers who feel a little +like translators, a tool letting them work at marking translatable +strings in the program sources, while simultaneously producing a set of +translation in some language, for the package being internationalized. + +</P> +<P> +The set of program sources, targetted by the PO mode commands describe +here, should have an Emacs tags table constructed for your project, +prior to using these PO file commands. This is easy to do. In any +shell window, change the directory to the root of your project, then +execute a command resembling: + +</P> + +<PRE> +etags src/*.[hc] lib/*.[hc] +</PRE> + +<P> +presuming here you want to process all <TT>`.h'</TT> and <TT>`.c'</TT> files +from the <TT>`src/'</TT> and <TT>`lib/'</TT> directories. This command will +explore all said files and create a <TT>`TAGS'</TT> file in your root +directory, somewhat summarizing the contents using a special file +format Emacs can understand. + +</P> +<P> +For packages following the GNU coding standards, there is +a make goal <CODE>tags</CODE> or <CODE>TAGS</CODE> which construct the tag files in +all directories and for all files containing source code. + +</P> +<P> +Once your <TT>`TAGS'</TT> file is ready, the following commands assist +the programmer at marking translatable strings in his set of sources. +But these commands are necessarily driven from within a PO file +window, and it is likely that you do not even have such a PO file yet. +This is not a problem at all, as you may safely open a new, empty PO +file, mainly for using these commands. This empty PO file will slowly +fill in while you mark strings as translatable in your program sources. + +</P> +<DL COMPACT> + +<DT><KBD>,</KBD> +<DD> +Search through program sources for a string which looks like a +candidate for translation. + +<DT><KBD>M-,</KBD> +<DD> +Mark the last string found with <SAMP>`_()'</SAMP>. + +<DT><KBD>M-.</KBD> +<DD> +Mark the last string found with a keyword taken from a set of possible +keywords. This command with a prefix allows some management of these +keywords. + +</DL> + +<P> +The <KBD>,</KBD> (<CODE>po-tags-search</CODE>) command search for the next +occurrence of a string which looks like a possible candidate for +translation, and displays the program source in another Emacs window, +positioned in such a way that the string is near the top of this other +window. If the string is too big to fit whole in this window, it is +positioned so only its end is shown. In any case, the cursor +is left in the PO file window. If the shown string would be better +presented differently in different native languages, you may mark it +using <KBD>M-,</KBD> or <KBD>M-.</KBD>. Otherwise, you might rather ignore it +and skip to the next string by merely repeating the <KBD>,</KBD> command. + +</P> +<P> +A string is a good candidate for translation if it contains a sequence +of three or more letters. A string containing at most two letters in +a row will be considered as a candidate if it has more letters than +non-letters. The command disregards strings containing no letters, +or isolated letters only. It also disregards strings within comments, +or strings already marked with some keyword PO mode knows (see below). + +</P> +<P> +If you have never told Emacs about some <TT>`TAGS'</TT> file to use, the +command will request that you specify one from the minibuffer, the +first time you use the command. You may later change your <TT>`TAGS'</TT> +file by using the regular Emacs command <KBD>M-x visit-tags-table</KBD>, +which will ask you to name the precise <TT>`TAGS'</TT> file you want +to use. See section `Tag Tables' in <CITE>The Emacs Editor</CITE>. + +</P> +<P> +Each time you use the <KBD>,</KBD> command, the search resumes from where it was +left by the previous search, and goes through all program sources, +obeying the <TT>`TAGS'</TT> file, until all sources have been processed. +However, by giving a prefix argument to the command (<KBD>C-u +,)</KBD>, you may request that the search be restarted all over again +from the first program source; but in this case, strings that you +recently marked as translatable will be automatically skipped. + +</P> +<P> +Using this <KBD>,</KBD> command does not prevent using of other regular +Emacs tags commands. For example, regular <CODE>tags-search</CODE> or +<CODE>tags-query-replace</CODE> commands may be used without disrupting the +independent <KBD>,</KBD> search sequence. However, as implemented, the +<EM>initial</EM> <KBD>,</KBD> command (or the <KBD>,</KBD> command is used with a +prefix) might also reinitialize the regular Emacs tags searching to the +first tags file, this reinitialization might be considered spurious. + +</P> +<P> +The <KBD>M-,</KBD> (<CODE>po-mark-translatable</CODE>) command will mark the +recently found string with the <SAMP>`_'</SAMP> keyword. The <KBD>M-.</KBD> +(<CODE>po-select-mark-and-mark</CODE>) command will request that you type +one keyword from the minibuffer and use that keyword for marking +the string. Both commands will automatically create a new PO file +untranslated entry for the string being marked, and make it the +current entry (making it easy for you to immediately proceed to its +translation, if you feel like doing it right away). It is possible +that the modifications made to the program source by <KBD>M-,</KBD> or +<KBD>M-.</KBD> render some source line longer than 80 columns, forcing you +to break and re-indent this line differently. You may use the <KBD>O</KBD> +command from PO mode, or any other window changing command from +GNU Emacs, to break out into the program source window, and do any +needed adjustments. You will have to use some regular Emacs command +to return the cursor to the PO file window, if you want command +<KBD>,</KBD> for the next string, say. + +</P> +<P> +The <KBD>M-.</KBD> command has a few built-in speedups, so you do not +have to explicitly type all keywords all the time. The first such +speedup is that you are presented with a <EM>preferred</EM> keyword, +which you may accept by merely typing <KBD><KBD>RET</KBD></KBD> at the prompt. +The second speedup is that you may type any non-ambiguous prefix of the +keyword you really mean, and the command will complete it automatically +for you. This also means that PO mode has to <EM>know</EM> all +your possible keywords, and that it will not accept mistyped keywords. + +</P> +<P> +If you reply <KBD>?</KBD> to the keyword request, the command gives a +list of all known keywords, from which you may choose. When the +command is prefixed by an argument (<KBD>C-u M-.</KBD>), it inhibits +updating any program source or PO file buffer, and does some simple +keyword management instead. In this case, the command asks for a +keyword, written in full, which becomes a new allowed keyword for +later <KBD>M-.</KBD> commands. Moreover, this new keyword automatically +becomes the <EM>preferred</EM> keyword for later commands. By typing +an already known keyword in response to <KBD>C-u M-.</KBD>, one merely +changes the <EM>preferred</EM> keyword and does nothing more. + +</P> +<P> +All keywords known for <KBD>M-.</KBD> are recognized by the <KBD>,</KBD> command +when scanning for strings, and strings already marked by any of those +known keywords are automatically skipped. If many PO files are opened +simultaneously, each one has its own independent set of known keywords. +There is no provision in PO mode, currently, for deleting a known +keyword, you have to quit the file (maybe using <KBD>q</KBD>) and reopen +it afresh. When a PO file is newly brought up in an Emacs window, only +<SAMP>`gettext'</SAMP> and <SAMP>`_'</SAMP> are known as keywords, and <SAMP>`gettext'</SAMP> +is preferred for the <KBD>M-.</KBD> command. In fact, this is not useful to +prefer <SAMP>`_'</SAMP>, as this one is already built in the <KBD>M-,</KBD> command. + +</P> + + +<H2><A NAME="SEC17" HREF="gettext_toc.html#TOC17">Special Comments preceding Keywords</A></H2> + +<P> +In C programs strings are often used within calls of functions from the +<CODE>printf</CODE> family. The special thing about these format strings is +that they can contain format specifiers introduced with <KBD>%</KBD>. Assume +we have the code + +</P> + +<PRE> +printf (gettext ("String `%s' has %d characters\n"), s, strlen (s)); +</PRE> + +<P> +A possible German translation for the above string might be: + +</P> + +<PRE> +"%d Zeichen lang ist die Zeichenkette `%s'" +</PRE> + +<P> +A C programmer, even if he cannot speak German, will recognize that +there is something wrong here. The order of the two format specifiers +is changed but of course the arguments in the <CODE>printf</CODE> don't have. +This will most probably lead to problems because now the length of the +string is regarded as the address. + +</P> +<P> +To prevent errors at runtime caused by translations the <CODE>msgfmt</CODE> +tool can check statically whether the arguments in the original and the +translation string match in type and number. If this is not the case a +warning will be given and the error cannot causes problems at runtime. + +</P> +<P> +If the word order in the above German translation would be correct one +would have to write + +</P> + +<PRE> +"%2$d Zeichen lang ist die Zeichenkette `%1$s'" +</PRE> + +<P> +The routines in <CODE>msgfmt</CODE> know about this special notation. + +</P> +<P> +Because not all strings in a program must be format strings it is not +useful for <CODE>msgfmt</CODE> to test all the strings in the <TT>`.po'</TT> file. +This might cause problems because the string might contain what looks +like a format specifier, but the string is not used in <CODE>printf</CODE>. + +</P> +<P> +Therefore the <CODE>xgettext</CODE> adds a special tag to those messages it +thinks might be a format string. There is no absolute rule for this, +only a heuristic. In the <TT>`.po'</TT> file the entry is marked using the +<CODE>c-format</CODE> flag in the <KBD>#,</KBD> comment line (see section <A HREF="gettext_2.html#SEC9">The Format of PO Files</A>). + +</P> +<P> +The careful reader now might say that this again can cause problems. +The heuristic might guess it wrong. This is true and therefore +<CODE>xgettext</CODE> knows about special kind of comment which lets +the programmer take over the decision. If in the same line or +the immediately preceding line of the <CODE>gettext</CODE> keyword +the <CODE>xgettext</CODE> program find a comment containing the words +<KBD>xgettext:c-format</KBD> it will mark the string in any case with +the <KBD>c-format</KBD> flag. This kind of comment should be used when +<CODE>xgettext</CODE> does not recognize the string as a format string but +is really is one and it should be tested. Please note that when the +comment is in the same line of the <CODE>gettext</CODE> keyword, it must be +before the string to be translated. + +</P> +<P> +This situation happens quite often. The <CODE>printf</CODE> function is often +called with strings which do not contain a format specifier. Of course +one would normally use <CODE>fputs</CODE> but it does happen. In this case +<CODE>xgettext</CODE> does not recognize this as a format string but what +happens if the translation introduces a valid format specifier? The +<CODE>printf</CODE> function will try to access one of the parameter but none +exists because the original code does not refer to any parameter. + +</P> +<P> +<CODE>xgettext</CODE> of course could make a wrong decision the other way +round. A string marked as a format string is not really a format +string. In this case the <CODE>msgfmt</CODE> might give too many warnings and +would prevent translating the <TT>`.po'</TT> file. The method to prevent +this wrong decision is similar to the one used above, only the comment +to use must contain the string <KBD>xgettext:no-c-format</KBD>. + +</P> +<P> +If a string is marked with <KBD>c-format</KBD> and this is not correct the +user can find out who is responsible for the decision. See section <A HREF="gettext_4.html#SEC20">Invoking the <CODE>xgettext</CODE> Program</A> to see how the <KBD>--debug</KBD> option can be used for solving +this problem. + +</P> + + +<H2><A NAME="SEC18" HREF="gettext_toc.html#TOC18">Special Cases of Translatable Strings</A></H2> + +<P> +The attentive reader might now point out that it is not always possible +to mark translatable string with <CODE>gettext</CODE> or something like this. +Consider the following case: + +</P> + +<PRE> +{ + static const char *messages[] = { + "some very meaningful message", + "and another one" + }; + const char *string; + ... + string + = index > 1 ? "a default message" : messages[index]; + + fputs (string); + ... +} +</PRE> + +<P> +While it is no problem to mark the string <CODE>"a default message"</CODE> it +is not possible to mark the string initializers for <CODE>messages</CODE>. +What is to be done? We have to fulfill two tasks. First we have to mark the +strings so that the <CODE>xgettext</CODE> program (see section <A HREF="gettext_4.html#SEC20">Invoking the <CODE>xgettext</CODE> Program</A>) +can find them, and second we have to translate the string at runtime +before printing them. + +</P> +<P> +The first task can be fulfilled by creating a new keyword, which names a +no-op. For the second we have to mark all access points to a string +from the array. So one solution can look like this: + +</P> + +<PRE> +#define gettext_noop(String) (String) + +{ + static const char *messages[] = { + gettext_noop ("some very meaningful message"), + gettext_noop ("and another one") + }; + const char *string; + ... + string + = index > 1 ? gettext ("a default message") : gettext (messages[index]); + + fputs (string); + ... +} +</PRE> + +<P> +Please convince yourself that the string which is written by +<CODE>fputs</CODE> is translated in any case. How to get <CODE>xgettext</CODE> know +the additional keyword <CODE>gettext_noop</CODE> is explained in section <A HREF="gettext_4.html#SEC20">Invoking the <CODE>xgettext</CODE> Program</A>. + +</P> +<P> +The above is of course not the only solution. You could also come along +with the following one: + +</P> + +<PRE> +#define gettext_noop(String) (String) + +{ + static const char *messages[] = { + gettext_noop ("some very meaningful message", + gettext_noop ("and another one") + }; + const char *string; + ... + string + = index > 1 ? gettext_noop ("a default message") : messages[index]; + + fputs (gettext (string)); + ... +} +</PRE> + +<P> +But this has some drawbacks. First the programmer has to take care that +he uses <CODE>gettext_noop</CODE> for the string <CODE>"a default message"</CODE>. +A use of <CODE>gettext</CODE> could have in rare cases unpredictable results. +The second reason is found in the internals of the GNU <CODE>gettext</CODE> +Library which will make this solution less efficient. + +</P> +<P> +One advantage is that you need not make control flow analysis to make +sure the output is really translated in any case. But this analysis is +generally not very difficult. If it should be in any situation you can +use this second method in this situation. + +</P> +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_2.html">previous</A>, <A HREF="gettext_4.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_4.html b/docs/html/gettext/gettext_4.html new file mode 100644 index 0000000000..f8f090eb2a --- /dev/null +++ b/docs/html/gettext/gettext_4.html @@ -0,0 +1,337 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - Making the Initial PO File</TITLE> +<link href="gettext_5.html" rel=Next> +<link href="gettext_3.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_3.html">previous</A>, <A HREF="gettext_5.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC19" HREF="gettext_toc.html#TOC19">Making the Initial PO File</A></H1> + + + +<H2><A NAME="SEC20" HREF="gettext_toc.html#TOC20">Invoking the <CODE>xgettext</CODE> Program</A></H2> + + +<PRE> +xgettext [<VAR>option</VAR>] <VAR>inputfile</VAR> ... +</PRE> + +<DL COMPACT> + +<DT><SAMP>`-a'</SAMP> +<DD> +<DT><SAMP>`--extract-all'</SAMP> +<DD> +Extract all strings. + +<DT><SAMP>`-c [<VAR>tag</VAR>]'</SAMP> +<DD> +<DT><SAMP>`--add-comments[=<VAR>tag</VAR>]'</SAMP> +<DD> +Place comment block with <VAR>tag</VAR> (or those preceding keyword lines) +in output file. + +<DT><SAMP>`-C'</SAMP> +<DD> +<DT><SAMP>`--c++'</SAMP> +<DD> +Recognize C++ style comments. + +<DT><SAMP>`--debug'</SAMP> +<DD> +Use the flags <KBD>c-format</KBD> and <KBD>possible-c-format</KBD> to show who was +responsible for marking a message as a format string. The later form is +used if the <CODE>xgettext</CODE> program decided, the format form is used if +the programmer prescribed it. + +By default only the <KBD>c-format</KBD> form is used. The translator should +not have to care about these details. + +<DT><SAMP>`-d <VAR>name</VAR>'</SAMP> +<DD> +<DT><SAMP>`--default-domain=<VAR>name</VAR>'</SAMP> +<DD> +Use <TT>`<VAR>name</VAR>.po'</TT> for output (instead of <TT>`messages.po'</TT>). + +The special domain name <TT>`-'</TT> or <TT>`/dev/stdout'</TT> means to write +the output to <TT>`stdout'</TT>. + +<DT><SAMP>`-D <VAR>directory</VAR>'</SAMP> +<DD> +<DT><SAMP>`--directory=<VAR>directory</VAR>'</SAMP> +<DD> +Change to <VAR>directory</VAR> before beginning to search and scan source +files. The resulting <TT>`.po'</TT> file will be written relative to the +original directory, though. + +<DT><SAMP>`-f <VAR>file</VAR>'</SAMP> +<DD> +<DT><SAMP>`--files-from=<VAR>file</VAR>'</SAMP> +<DD> +Read the names of the input files from <VAR>file</VAR> instead of getting +them from the command line. + +<DT><SAMP>`--force'</SAMP> +<DD> +Always write output file even if no message is defined. + +<DT><SAMP>`-h'</SAMP> +<DD> +<DT><SAMP>`--help'</SAMP> +<DD> +Display this help and exit. + +<DT><SAMP>`-I <VAR>list</VAR>'</SAMP> +<DD> +<DT><SAMP>`--input-path=<VAR>list</VAR>'</SAMP> +<DD> +List of directories searched for input files. + +<DT><SAMP>`-j'</SAMP> +<DD> +<DT><SAMP>`--join-existing'</SAMP> +<DD> +Join messages with existing file. + +<DT><SAMP>`-k <VAR>word</VAR>'</SAMP> +<DD> +<DT><SAMP>`--keyword[=<VAR>word</VAR>]'</SAMP> +<DD> +Additonal keyword to be looked for (without <VAR>word</VAR> means not to +use default keywords). + +The default keywords, which are always looked for if not explicitly +disabled, are <CODE>gettext</CODE>, <CODE>dgettext</CODE>, <CODE>dcgettext</CODE> and +<CODE>gettext_noop</CODE>. + +<DT><SAMP>`-m [<VAR>string</VAR>]'</SAMP> +<DD> +<DT><SAMP>`--msgstr-prefix[=<VAR>string</VAR>]'</SAMP> +<DD> +Use <VAR>string</VAR> or "" as prefix for msgstr entries. + +<DT><SAMP>`-M [<VAR>string</VAR>]'</SAMP> +<DD> +<DT><SAMP>`--msgstr-suffix[=<VAR>string</VAR>]'</SAMP> +<DD> +Use <VAR>string</VAR> or "" as suffix for msgstr entries. + +<DT><SAMP>`--no-location'</SAMP> +<DD> +Do not write <SAMP>`#: <VAR>filename</VAR>:<VAR>line</VAR>'</SAMP> lines. + +<DT><SAMP>`-n'</SAMP> +<DD> +<DT><SAMP>`--add-location'</SAMP> +<DD> +Generate <SAMP>`#: <VAR>filename</VAR>:<VAR>line</VAR>'</SAMP> lines (default). + +<DT><SAMP>`--omit-header'</SAMP> +<DD> +Don't write header with <SAMP>`msgid ""'</SAMP> entry. + +This is useful for testing purposes because it eliminates a source +of variance for generated <CODE>.gmo</CODE> files. We can ship some of +these files in the GNU <CODE>gettext</CODE> package, and the result of +regenerating them through <CODE>msgfmt</CODE> should yield the same values. + +<DT><SAMP>`-p <VAR>dir</VAR>'</SAMP> +<DD> +<DT><SAMP>`--output-dir=<VAR>dir</VAR>'</SAMP> +<DD> +Output files will be placed in directory <VAR>dir</VAR>. + +<DT><SAMP>`-s'</SAMP> +<DD> +<DT><SAMP>`--sort-output'</SAMP> +<DD> +Generate sorted output and remove duplicates. + +<DT><SAMP>`--strict'</SAMP> +<DD> +Write out strict Uniforum conforming PO file. + +<DT><SAMP>`-v'</SAMP> +<DD> +<DT><SAMP>`--version'</SAMP> +<DD> +Output version information and exit. + +<DT><SAMP>`-x <VAR>file</VAR>'</SAMP> +<DD> +<DT><SAMP>`--exclude-file=<VAR>file</VAR>'</SAMP> +<DD> +Entries from <VAR>file</VAR> are not extracted. + +</DL> + +<P> +Search path for supplementary PO files is: +<TT>`/usr/local/share/nls/src/'</TT>. + +</P> +<P> +If <VAR>inputfile</VAR> is <SAMP>`-'</SAMP>, standard input is read. + +</P> +<P> +This implementation of <CODE>xgettext</CODE> is able to process a few awkward +cases, like strings in preprocessor macros, ANSI concatenation of +adjacent strings, and escaped end of lines for continued strings. + +</P> + + +<H2><A NAME="SEC21" HREF="gettext_toc.html#TOC21">C Sources Context</A></H2> + +<P> +PO mode is particularily powerful when used with PO files +created through GNU <CODE>gettext</CODE> utilities, as those utilities +insert special comments in the PO files they generate. +Some of these special comments relate the PO file entry to +exactly where the untranslated string appears in the program sources. + +</P> +<P> +When the translator gets to an untranslated entry, she is fairly +often faced with an original string which is not as informative as +it normally should be, being succinct, cryptic, or otherwise ambiguous. +Before chosing how to translate the string, she needs to understand +better what the string really means and how tight the translation has +to be. Most of times, when problems arise, the only way left to make +her judgment is looking at the true program sources from where this +string originated, searching for surrounding comments the programmer +might have put in there, and looking around for helping clues of +<EM>any</EM> kind. + +</P> +<P> +Surely, when looking at program sources, the translator will receive +more help if she is a fluent programmer. However, even if she is +not versed in programming and feels a little lost in C code, the +translator should not be shy at taking a look, once in a while. +It is most probable that she will still be able to find some of the +hints she needs. She will learn quickly to not feel uncomfortable +in program code, paying more attention to programmer's comments, +variable and function names (if he dared chosing them well), and +overall organization, than to programmation itself. + +</P> +<P> +The following commands are meant to help the translator at getting +program source context for a PO file entry. + +</P> +<DL COMPACT> + +<DT><KBD>s</KBD> +<DD> +Resume the display of a program source context, or cycle through them. + +<DT><KBD>M-s</KBD> +<DD> +Display of a program source context selected by menu. + +<DT><KBD>S</KBD> +<DD> +Add a directory to the search path for source files. + +<DT><KBD>M-S</KBD> +<DD> +Delete a directory from the search path for source files. + +</DL> + +<P> +The commands <KBD>s</KBD> (<CODE>po-cycle-reference</CODE>) and <KBD>M-s</KBD> +(<CODE>po-select-source-reference</CODE>) both open another window displaying +some source program file, and already positioned in such a way that +it shows an actual use of the string to be translated. By doing +so, the command gives source program context for the string. But if +the entry has no source context references, or if all references +are unresolved along the search path for program sources, then the +command diagnoses this as an error. + +</P> +<P> +Even if <KBD>s</KBD> (or <KBD>M-s</KBD>) opens a new window, the cursor stays +in the PO file window. If the translator really wants to +get into the program source window, she ought to do it explicitly, +maybe by using command <KBD>O</KBD>. + +</P> +<P> +When <KBD>s</KBD> is typed for the first time, or for a PO file entry which +is different of the last one used for getting source context, then the +command reacts by giving the first context available for this entry, +if any. If some context has already been recently displayed for the +current PO file entry, and the translator wandered off to do other +things, typing <KBD>s</KBD> again will merely resume, in another window, +the context last displayed. In particular, if the translator moved +the cursor away from the context in the source file, the command will +bring the cursor back to the context. By using <KBD>s</KBD> many times +in a row, with no other commands intervening, PO mode will cycle to +the next available contexts for this particular entry, getting back +to the first context once the last has been shown. + +</P> +<P> +The command <KBD>M-s</KBD> behaves differently. Instead of cycling through +references, it lets the translator choose of particular reference among +many, and displays that reference. It is best used with completion, +if the translator types <KBD>TAB</KBD> immediately after <KBD>M-s</KBD>, in +response to the question, she will be offered a menu of all possible +references, as a reminder of which are the acceptable answers. +This command is useful only where there are really many contexts +available for a single string to translate. + +</P> +<P> +Program source files are usually found relative to where the PO +file stands. As a special provision, when this fails, the file is +also looked for, but relative to the directory immediately above it. +Those two cases take proper care of most PO files. However, it might +happen that a PO file has been moved, or is edited in a different +place than its normal location. When this happens, the translator +should tell PO mode in which directory normally sits the genuine PO +file. Many such directories may be specified, and all together, they +constitute what is called the <STRONG>search path</STRONG> for program sources. +The command <KBD>S</KBD> (<CODE>po-consider-source-path</CODE>) is used to interactively +enter a new directory at the front of the search path, and the command +<KBD>M-S</KBD> (<CODE>po-ignore-source-path</CODE>) is used to select, with completion, +one of the directories she does not want anymore on the search path. + +</P> + + +<H2><A NAME="SEC22" HREF="gettext_toc.html#TOC22">Using Translation Compendiums</A></H2> + +<P> +Compendiums are yet to be implemented. + +</P> +<P> +An incoming PO mode feature will let the translator maintain a +compendium of already achieved translations. A <STRONG>compendium</STRONG> +is a special PO file containing a set of translations recurring in +many different packages. The translator will be given commands for +adding entries to her compendium, and later initializing untranslated +entries, or updating already translated entries, from translations +kept in the compendium. For this to work, however, the compendium +would have to be normalized. See section <A HREF="gettext_2.html#SEC12">Normalizing Strings in Entries</A>. + +</P> + +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_3.html">previous</A>, <A HREF="gettext_5.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_5.html b/docs/html/gettext/gettext_5.html new file mode 100644 index 0000000000..81f4c9a24b --- /dev/null +++ b/docs/html/gettext/gettext_5.html @@ -0,0 +1,747 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - Updating Existing PO Files</TITLE> +<link href="gettext_6.html" rel=Next> +<link href="gettext_4.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_4.html">previous</A>, <A HREF="gettext_6.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC23" HREF="gettext_toc.html#TOC23">Updating Existing PO Files</A></H1> + + + +<H2><A NAME="SEC24" HREF="gettext_toc.html#TOC24">Invoking the <CODE>msgmerge</CODE> Program</A></H2> + + + +<H2><A NAME="SEC25" HREF="gettext_toc.html#TOC25">Translated Entries</A></H2> + +<P> +Each PO file entry for which the <CODE>msgstr</CODE> field has been filled with +a translation, and which is not marked as fuzzy (see section <A HREF="gettext_5.html#SEC26">Fuzzy Entries</A>), +is a said to be a <STRONG>translated</STRONG> entry. Only translated entries will +later be compiled by GNU <CODE>msgfmt</CODE> and become usable in programs. +Other entry types will be excluded; translation will not occur for them. + +</P> +<P> +Some commands are more specifically related to translated entry processing. + +</P> +<DL COMPACT> + +<DT><KBD>t</KBD> +<DD> +Find the next translated entry. + +<DT><KBD>M-t</KBD> +<DD> +Find the previous translated entry. + +</DL> + +<P> +The commands <KBD>t</KBD> (<CODE>po-next-translated-entry</CODE>) and <KBD>M-t</KBD> +(<CODE>po-previous-transted-entry</CODE>) move forwards or backwards, chasing +for an translated entry. If none is found, the search is extended and +wraps around in the PO file buffer. + +</P> +<P> +Translated entries usually result from the translator having edited in +a translation for them, section <A HREF="gettext_5.html#SEC29">Modifying Translations</A>. However, if the +variable <CODE>po-auto-fuzzy-on-edit</CODE> is not <CODE>nil</CODE>, the entry having +received a new translation first becomes a fuzzy entry, which ought to +be later unfuzzied before becoming an official, genuine translated entry. +See section <A HREF="gettext_5.html#SEC26">Fuzzy Entries</A>. + +</P> + + +<H2><A NAME="SEC26" HREF="gettext_toc.html#TOC26">Fuzzy Entries</A></H2> + +<P> +Each PO file entry may have a set of <STRONG>attributes</STRONG>, which are +qualities given an name and explicitely associated with the entry +translation, using a special system comment. One of these attributes +has the name <CODE>fuzzy</CODE>, and entries having this attribute are said +to have a fuzzy translation. They are called fuzzy entries, for short. + +</P> +<P> +Fuzzy entries, even if they account for translated entries for +most other purposes, usually call for revision by the translator. +Those may be produced by applying the program <CODE>msgmerge</CODE> to +update an older translated PO files according to a new PO template +file, when this tool hypothesises that some new <CODE>msgid</CODE> has +been modified only slightly out of an older one, and chooses to pair +what it thinks to be the old translation for the new modified entry. +The slight alteration in the original string (the <CODE>msgid</CODE> string) +should often be reflected in the translated string, and this requires +the intervention of the translator. For this reason, <CODE>msgmerge</CODE> +might mark some entries as being fuzzy. + +</P> +<P> +Also, the translator may decide herself to mark an entry as fuzzy +for her own convenience, when she wants to remember that the entry +has to be later revisited. So, some commands are more specifically +related to fuzzy entry processing. + +</P> +<DL COMPACT> + +<DT><KBD>f</KBD> +<DD> +Find the next fuzzy entry. + +<DT><KBD>M-f</KBD> +<DD> +Find the previous fuzzy entry. + +<DT><KBD>TAB</KBD> +<DD> +Remove the fuzzy attribute of the current entry. + +</DL> + +<P> +The commands <KBD>f</KBD> (<CODE>po-next-fuzzy</CODE>) and <KBD>M-f</KBD> +(<CODE>po-previous-fuzzy</CODE>) move forwards or backwards, chasing for +a fuzzy entry. If none is found, the search is extended and wraps +around in the PO file buffer. + +</P> +<P> +The command <KBD>TAB</KBD> (<CODE>po-unfuzzy</CODE>) removes the fuzzy +attribute associated with an entry, usually leaving it translated. +Further, if the variable <CODE>po-auto-select-on-unfuzzy</CODE> has not +the <CODE>nil</CODE> value, the <KBD>TAB</KBD> command will automatically chase +for another interesting entry to work on. The initial value of +<CODE>po-auto-select-on-unfuzzy</CODE> is <CODE>nil</CODE>. + +</P> +<P> +The initial value of <CODE>po-auto-fuzzy-on-edit</CODE> is <CODE>nil</CODE>. However, +if the variable <CODE>po-auto-fuzzy-on-edit</CODE> is set to <CODE>t</CODE>, any entry +edited through the <KBD>RET</KBD> command is marked fuzzy, as a way to ensure +some kind of double check, later. In this case, the usual paradigm is +that an entry becomes fuzzy (if not already) whenever the translator +modifies it. If she is satisfied with the translation, she then uses +<KBD>TAB</KBD> to pick another entry to work on, clearing the fuzzy attribute +on the same blow. If she is not satisfied yet, she merely uses <KBD>SPC</KBD> +to chase another entry, leaving the entry fuzzy. + +</P> +<P> +The translator may also use the <KBD>DEL</KBD> command +(<CODE>po-fade-out-entry</CODE>) over any translated entry to mark it as being +fuzzy, when she wants to easily leave a trace she wants to later return +working at this entry. + +</P> +<P> +Also, when time comes to quit working on a PO file buffer with the <KBD>q</KBD> +command, the translator is asked for confirmation, if fuzzy string +still exists. + +</P> + + +<H2><A NAME="SEC27" HREF="gettext_toc.html#TOC27">Untranslated Entries</A></H2> + +<P> +When <CODE>xgettext</CODE> originally creates a PO file, unless told +otherwise, it initializes the <CODE>msgid</CODE> field with the untranslated +string, and leaves the <CODE>msgstr</CODE> string to be empty. Such entries, +having an empty translation, are said to be <STRONG>untranslated</STRONG> entries. +Later, when the programmer slightly modifies some string right in +the program, this change is later reflected in the PO file +by the appearance of a new untranslated entry for the modified string. + +</P> +<P> +The usual commands moving from entry to entry consider untranslated +entries on the same level as active entries. Untranslated entries +are easily recognizable by the fact they end with <SAMP>`msgstr ""'</SAMP>. + +</P> +<P> +The work of the translator might be (quite naively) seen as the process +of seeking after an untranslated entry, editing a translation for +it, and repeating these actions until no untranslated entries remain. +Some commands are more specifically related to untranslated entry +processing. + +</P> +<DL COMPACT> + +<DT><KBD>u</KBD> +<DD> +Find the next untranslated entry. + +<DT><KBD>M-u</KBD> +<DD> +Find the previous untranslated entry. + +<DT><KBD>k</KBD> +<DD> +Turn the current entry into an untranslated one. + +</DL> + +<P> +The commands <KBD>u</KBD> (<CODE>po-next-untranslated-entry</CODE>) and <KBD>M-u</KBD> +(<CODE>po-previous-untransted-entry</CODE>) move forwards or backwards, +chasing for an untranslated entry. If none is found, the search is +extended and wraps around in the PO file buffer. + +</P> +<P> +An entry can be turned back into an untranslated entry by +merely emptying its translation, using the command <KBD>k</KBD> +(<CODE>po-kill-msgstr</CODE>). See section <A HREF="gettext_5.html#SEC29">Modifying Translations</A>. + +</P> +<P> +Also, when time comes to quit working on a PO file buffer +with the <KBD>q</KBD> command, the translator is asked for confirmation, +if some untranslated string still exists. + +</P> + + +<H2><A NAME="SEC28" HREF="gettext_toc.html#TOC28">Obsolete Entries</A></H2> + +<P> +By <STRONG>obsolete</STRONG> PO file entries, we mean those entries which are +commented out, usually by <CODE>msgmerge</CODE> when it found that the +translation is not needed anymore by the package being localized. + +</P> +<P> +The usual commands moving from entry to entry consider obsolete +entries on the same level as active entries. Obsolete entries are +easily recognizable by the fact that all their lines start with +<KBD>#</KBD>, even those lines containing <CODE>msgid</CODE> or <CODE>msgstr</CODE>. + +</P> +<P> +Commands exist for emptying the translation or reinitializing it +to the original untranslated string. Commands interfacing with the +kill ring may force some previously saved text into the translation. +The user may interactively edit the translation. All these commands +may apply to obsolete entries, carefully leaving the entry obsolete +after the fact. + +</P> +<P> +Moreover, some commands are more specifically related to obsolete +entry processing. + +</P> +<DL COMPACT> + +<DT><KBD>o</KBD> +<DD> +Find the next obsolete entry. + +<DT><KBD>M-o</KBD> +<DD> +Find the previous obsolete entry. + +<DT><KBD>DEL</KBD> +<DD> +Make an active entry obsolete, or zap out an obsolete entry. + +</DL> + +<P> +The commands <KBD>o</KBD> (<CODE>po-next-obsolete-entry</CODE>) and <KBD>M-o</KBD> +(<CODE>po-previous-obsolete-entry</CODE>) move forwards or backwards, +chasing for an obsolete entry. If none is found, the search is +extended and wraps around in the PO file buffer. + +</P> +<P> +PO mode does not provide ways for un-commenting an obsolete entry +and making it active, because this would reintroduce an original +untranslated string which does not correspond to any marked string +in the program sources. This goes with the philosophy of never +introducing useless <CODE>msgid</CODE> values. + +</P> +<P> +However, it is possible to comment out an active entry, so making +it obsolete. GNU <CODE>gettext</CODE> utilities will later react to the +disappearance of a translation by using the untranslated string. +The command <KBD>DEL</KBD> (<CODE>po-fade-out-entry</CODE>) pushes the current entry +a little further towards annihilation. If the entry is active (it is a +translated entry), then it is first made fuzzy. If it is already fuzzy, +then the entry is merely commented out, with confirmation. If the entry +is already obsolete, then it is completely deleted from the PO file. +It is easy to recycle the translation so deleted into some other PO file +entry, usually one which is untranslated. See section <A HREF="gettext_5.html#SEC29">Modifying Translations</A>. + +</P> +<P> +Here is a quite interesting problem to solve for later development of +PO mode, for those nights you are not sleepy. The idea would be that +PO mode might become bright enough, one of these days, to make good +guesses at retrieving the most probable candidate, among all obsolete +entries, for initializing the translation of a newly appeared string. +I think it might be a quite hard problem to do this algorithmically, as +we have to develop good and efficient measures of string similarity. +Right now, PO mode completely lets the decision to the translator, +when the time comes to find the adequate obsolete translation, it +merely tries to provide handy tools for helping her to do so. + +</P> + + +<H2><A NAME="SEC29" HREF="gettext_toc.html#TOC29">Modifying Translations</A></H2> + +<P> +PO mode prevents direct edition of the PO file, by the usual +means Emacs give for altering a buffer's contents. By doing so, +it pretends helping the translator to avoid little clerical errors +about the overall file format, or the proper quoting of strings, +as those errors would be easily made. Other kinds of errors are +still possible, but some may be caught and diagnosed by the batch +validation process, which the translator may always trigger by the +<KBD>V</KBD> command. For all other errors, the translator has to rely on +her own judgment, and also on the linguistic reports submitted to her +by the users of the translated package, having the same mother tongue. + +</P> +<P> +When the time comes to create a translation, correct an error diagnosed +mechanically or reported by a user, the translators have to resort to +using the following commands for modifying the translations. + +</P> +<DL COMPACT> + +<DT><KBD>RET</KBD> +<DD> +Interactively edit the translation. + +<DT><KBD>LFD</KBD> +<DD> +Reinitialize the translation with the original, untranslated string. + +<DT><KBD>k</KBD> +<DD> +Save the translation on the kill ring, and delete it. + +<DT><KBD>w</KBD> +<DD> +Save the translation on the kill ring, without deleting it. + +<DT><KBD>y</KBD> +<DD> +Replace the translation, taking the new from the kill ring. + +</DL> + +<P> +The command <KBD>RET</KBD> (<CODE>po-edit-msgstr</CODE>) opens a new Emacs window +containing a copy of the translation taken from the current PO file entry, +all ready for edition, fully modifiable and with the complete extent of +GNU Emacs modifying commands. The string is presented to the translator +expunged of all quoting marks, and she will modify the <EM>unquoted</EM> +string in this window to heart's content. Once done, the regular Emacs +command <KBD>M-C-c</KBD> (<CODE>exit-recursive-edit</CODE>) may be used to return the +edited translation into the PO file, replacing the original translation. +The keys <KBD>C-c C-c</KBD> are bound so they have the same effect as +<KBD>M-C-c</KBD>. + +</P> +<P> +If the translator becomes unsatisfied with her translation to the extent +she prefers keeping the translation which was existent prior to the +<KBD>RET</KBD> command, she may use the standard Emacs command <KBD>C-]</KBD> +(<CODE>abort-recursive-edit</CODE>) to merely get rid of edition, while +preserving the original translation. The keys <KBD>C-c C-k</KBD> are +bound so they have the same effect as <KBD>C-]</KBD>. Another way would +be for her to exit normally with <KBD>C-c C-c</KBD>, then type <CODE>U</CODE> +once for undoing the whole effect of last edition. + +</P> +<P> +Functions found on <CODE>po-subedit-mode-hook</CODE>, if any, are executed after +the string has been inserted in the edit buffer and before recursive edit +is entered. + +</P> +<P> +While editing her translation, the translator should pay attention to +not inserting unwanted <KBD><KBD>RET</KBD></KBD> (carriage returns) characters at +the end of the translated string if those are not meant to be there, +or to removing such characters when they are required. Since these +characters are not visible in the editing buffer, they are easily +introduced by mistake. To help her, <KBD><KBD>RET</KBD></KBD> automatically puts +the character <KBD><</KBD> at the end of the string being edited, but this +<KBD><</KBD> is not really part of the string. On exiting the editing +window with <KBD>C-c C-c</KBD>, PO mode automatically removes such +<KBD><</KBD> and all whitespace added after it. If the translator adds +characters after the terminating <KBD><</KBD>, it looses its delimiting +property and integrally becomes part of the string. If she removes +the delimiting <KBD><</KBD>, then the edited string is taken <EM>as +is</EM>, with all trailing newlines, even if invisible. Also, if the +translated string ought to end itself with a genuine <KBD><</KBD>, then the +delimiting <KBD><</KBD> may not be removed; so the string should appear, +in the editing window, as ending with two <KBD><</KBD> in a row. + +</P> +<P> +When a translation (or a comment) is being edited, the translator +may move the cursor back into the PO file buffer and freely +move to other entries, browsing at will. The edited entry will +be recovered as soon as the edit ceases, because it is this entry +only which is being modified. If, with an edition still opened, the +translator wanders in the PO file buffer, she cannot modify +any other entry. If she tries to, PO mode will react by suggesting +that she abort the current edit, or else, by inviting her to finish +the current edit prior to any other modification. + +</P> +<P> +The command <KBD>LFD</KBD> (<CODE>po-msgid-to-msgstr</CODE>) initializes, or +reinitializes the translation with the original string. This command +is normally used when the translator wants to redo a fresh translation +of the original string, disregarding any previous work. + +</P> +<P> +It is possible to arrange so, whenever editing an untranslated +entry, the <KBD>LFD</KBD> command be automatically executed. If you set +<CODE>po-auto-edit-with-msgid</CODE> to <CODE>t</CODE>, the translation gets +initialised with the original string, in case none exist already. +The default value for <CODE>po-auto-edit-with-msgid</CODE> is <CODE>nil</CODE>. + +</P> +<P> +In fact, whether it is best to start a translation with an empty +string, or rather with a copy of the original string, is a matter of +taste or habit. Sometimes, the source language and the +target language are so different that is simply best to start writing +on an empty page. At other times, the source and target languages +are so close that it would be a waste to retype a number of words +already being written in the original string. A translator may also +like having the original string right under her eyes, as she will +progressively overwrite the original text with the translation, even +if this requires some extra editing work to get rid of the original. + +</P> +<P> +The command <KBD>k</KBD> (<CODE>po-kill-msgstr</CODE>) merely empties the +translation string, so turning the entry into an untranslated +one. But while doing so, its previous contents is put apart in +a special place, known as the kill ring. The command <KBD>w</KBD> +(<CODE>po-kill-ring-save-msgstr</CODE>) has also the effect of taking a +copy of the translation onto the kill ring, but it otherwise leaves +the entry alone, and does <EM>not</EM> remove the translation from the +entry. Both commands use exactly the Emacs kill ring, which is shared +between buffers, and which is well known already to GNU Emacs lovers. + +</P> +<P> +The translator may use <KBD>k</KBD> or <KBD>w</KBD> many times in the course +of her work, as the kill ring may hold several saved translations. +From the kill ring, strings may later be reinserted in various +Emacs buffers. In particular, the kill ring may be used for moving +translation strings between different entries of a single PO file +buffer, or if the translator is handling many such buffers at once, +even between PO files. + +</P> +<P> +To facilitate exchanges with buffers which are not in PO mode, the +translation string put on the kill ring by the <KBD>k</KBD> command is fully +unquoted before being saved: external quotes are removed, multi-lines +strings are concatenated, and backslashed escaped sequences are turned +into their corresponding characters. In the special case of obsolete +entries, the translation is also uncommented prior to saving. + +</P> +<P> +The command <KBD>y</KBD> (<CODE>po-yank-msgstr</CODE>) completely replaces the +translation of the current entry by a string taken from the kill ring. +Following GNU Emacs terminology, we then say that the replacement +string is <STRONG>yanked</STRONG> into the PO file buffer. +See section `Yanking' in <CITE>The Emacs Editor</CITE>. +The first time <KBD>y</KBD> is used, the translation receives the value of +the most recent addition to the kill ring. If <KBD>y</KBD> is typed once +again, immediately, without intervening keystrokes, the translation +just inserted is taken away and replaced by the second most recent +addition to the kill ring. By repeating <KBD>y</KBD> many times in a row, +the translator may travel along the kill ring for saved strings, +until she finds the string she really wanted. + +</P> +<P> +When a string is yanked into a PO file entry, it is fully and +automatically requoted for complying with the format PO files should +have. Further, if the entry is obsolete, PO mode then appropriately +push the inserted string inside comments. Once again, translators +should not burden themselves with quoting considerations besides, of +course, the necessity of the translated string itself respective to +the program using it. + +</P> +<P> +Note that <KBD>k</KBD> or <KBD>w</KBD> are not the only commands pushing strings +on the kill ring, as almost any PO mode command replacing translation +strings (or the translator comments) automatically save the old string +on the kill ring. The main exceptions to this general rule are the +yanking commands themselves. + +</P> +<P> +To better illustrate the operation of killing and yanking, let's +use an actual example, taken from a common situation. When the +programmer slightly modifies some string right in the program, his +change is later reflected in the PO file by the appearance +of a new untranslated entry for the modified string, and the fact +that the entry translating the original or unmodified string becomes +obsolete. In many cases, the translator might spare herself some work +by retrieving the unmodified translation from the obsolete entry, +then initializing the untranslated entry <CODE>msgstr</CODE> field with +this retrieved translation. Once this done, the obsolete entry is +not wanted anymore, and may be safely deleted. + +</P> +<P> +When the translator finds an untranslated entry and suspects that a +slight variant of the translation exists, she immediately uses <KBD>m</KBD> +to mark the current entry location, then starts chasing obsolete +entries with <KBD>o</KBD>, hoping to find some translation corresponding +to the unmodified string. Once found, she uses the <KBD>DEL</KBD> command +for deleting the obsolete entry, knowing that <KBD>DEL</KBD> also <EM>kills</EM> +the translation, that is, pushes the translation on the kill ring. +Then, <KBD>r</KBD> returns to the initial untranslated entry, <KBD>y</KBD> +then <EM>yanks</EM> the saved translation right into the <CODE>msgstr</CODE> +field. The translator is then free to use <KBD><KBD>RET</KBD></KBD> for fine +tuning the translation contents, and maybe to later use <KBD>u</KBD>, +then <KBD>m</KBD> again, for going on with the next untranslated string. + +</P> +<P> +When some sequence of keys has to be typed over and over again, the +translator may find it useful to become better acquainted with the GNU +Emacs capability of learning these sequences and playing them back under +request. See section `Keyboard Macros' in <CITE>The Emacs Editor</CITE>. + +</P> + + +<H2><A NAME="SEC30" HREF="gettext_toc.html#TOC30">Modifying Comments</A></H2> + +<P> +Any translation work done seriously will raise many linguistic +difficulties, for which decisions have to be made, and the choices +further documented. These documents may be saved within the +PO file in form of translator comments, which the translator +is free to create, delete, or modify at will. These comments may +be useful to herself when she returns to this PO file after a while. + +</P> +<P> +Comments not having whitespace after the initial <SAMP>`#'</SAMP>, for example, +those beginning with <SAMP>`#.'</SAMP> or <SAMP>`#:'</SAMP>, are <EM>not</EM> translator +comments, they are exclusively created by other <CODE>gettext</CODE> tools. +So, the commands below will never alter such system added comments, +they are not meant for the translator to modify. See section <A HREF="gettext_2.html#SEC9">The Format of PO Files</A>. + +</P> +<P> +The following commands are somewhat similar to those modifying translations, +so the general indications given for those apply here. See section <A HREF="gettext_5.html#SEC29">Modifying Translations</A>. + +</P> +<DL COMPACT> + +<DT><KBD>#</KBD> +<DD> +Interactively edit the translator comments. + +<DT><KBD>K</KBD> +<DD> +Save the translator comments on the kill ring, and delete it. + +<DT><KBD>W</KBD> +<DD> +Save the translator comments on the kill ring, without deleting it. + +<DT><KBD>Y</KBD> +<DD> +Replace the translator comments, taking the new from the kill ring. + +</DL> + +<P> +These commands parallel PO mode commands for modifying the translation +strings, and behave much the same way as they do, except that they handle +this part of PO file comments meant for translator usage, rather +than the translation strings. So, if the descriptions given below are +slightly succinct, it is because the full details have already been given. +See section <A HREF="gettext_5.html#SEC29">Modifying Translations</A>. + +</P> +<P> +The command <KBD>#</KBD> (<CODE>po-edit-comment</CODE>) opens a new Emacs +window containing a copy of the translator comments on the current +PO file entry. If there are no such comments, PO mode +understands that the translator wants to add a comment to the entry, +and she is presented with an empty screen. Comment marks (<KBD>#</KBD>) and +the space following them are automatically removed before edition, +and reinstated after. For translator comments pertaining to obsolete +entries, the uncommenting and recommenting operations are done twice. +Once in the editing window, the keys <KBD>C-c C-c</KBD> allow the +translator to tell she is finished with editing the comment. + +</P> +<P> +Functions found on <CODE>po-subedit-mode-hook</CODE>, if any, are executed after +the string has been inserted in the edit buffer and before recursive edit +is entered. + +</P> +<P> +The command <KBD>K</KBD> (<CODE>po-kill-comment</CODE>) get rid of all +translator comments, while saving those comments on the kill ring. +The command <KBD>W</KBD> (<CODE>po-kill-ring-save-comment</CODE>) takes +a copy of the translator comments on the kill ring, but leaves +them undisturbed in the current entry. The command <KBD>Y</KBD> +(<CODE>po-yank-comment</CODE>) completely replaces the translator comments +by a string taken at the front of the kill ring. When this command +is immediately repeated, the comments just inserted are withdrawn, +and replaced by other strings taken along the kill ring. + +</P> +<P> +On the kill ring, all strings have the same nature. There is no +distinction between <EM>translation</EM> strings and <EM>translator +comments</EM> strings. So, for example, let's presume the translator +has just finished editing a translation, and wants to create a new +translator comment to document why the previous translation was +not good, just to remember what was the problem. Foreseeing that she +will do that in her documentation, the translator may want to quote +the previous translation in her translator comments. To do so, she +may initialize the translator comments with the previous translation, +still at the head of the kill ring. Because editing already pushed the +previous translation on the kill ring, she merely has to type <KBD>M-w</KBD> +prior to <KBD>#</KBD>, and the previous translation will be right there, +all ready for being introduced by some explanatory text. + +</P> +<P> +On the other hand, presume there are some translator comments already +and that the translator wants to add to those comments, instead +of wholly replacing them. Then, she should edit the comment right +away with <KBD>#</KBD>. Once inside the editing window, she can use the +regular GNU Emacs commands <KBD>C-y</KBD> (<CODE>yank</CODE>) and <KBD>M-y</KBD> +(<CODE>yank-pop</CODE>) to get the previous translation where she likes. + +</P> + + +<H2><A NAME="SEC31" HREF="gettext_toc.html#TOC31">Consulting Auxiliary PO Files</A></H2> + +<P> +PO mode is able to help the knowledgeable translator, being fluent in +many languages, at taking advantage of translations already achieved +in other languages she just happens to know. It provides these other +language translations as additional context for her own work. Moreover, +it has features to ease the production of translations for many languages +at once, for translators preferring to work in this way. + +</P> +<P> +An <STRONG>auxiliary</STRONG> PO file is an existing PO file meant for the same +package the translator is working on, but targeted to a different mother +tongue language. Commands exist for declaring and handling auxiliary +PO files, and also for showing contexts for the entry under work. + +</P> +<P> +Here are the auxiliary file commands available in PO mode. + +</P> +<DL COMPACT> + +<DT><KBD>a</KBD> +<DD> +Seek auxiliary files for another translation for the same entry. + +<DT><KBD>M-a</KBD> +<DD> +Switch to a particular auxiliary file. + +<DT><KBD>A</KBD> +<DD> +Declare this PO file as an auxiliary file. + +<DT><KBD>M-A</KBD> +<DD> +Remove this PO file from the list of auxiliary files. + +</DL> + +<P> +Command <KBD>A</KBD> (<CODE>po-consider-as-auxiliary</CODE>) adds the current +PO file to the list of auxiliary files, while command <KBD>M-A</KBD> +(<CODE>po-ignore-as-auxiliary</CODE> just removes it. + +</P> +<P> +The command <KBD>a</KBD> (<CODE>po-cycle-auxiliary</CODE>) seeks all auxiliary PO +files, round-robin, searching for a translated entry in some other language +having an <CODE>msgid</CODE> field identical as the one for the current entry. +The found PO file, if any, takes the place of the current PO file in +the display (its window gets on top). Before doing so, the current PO +file is also made into an auxiliary file, if not already. So, <KBD>a</KBD> +in this newly displayed PO file will seek another PO file, and so on, +so repeating <KBD>a</KBD> will eventually yield back the original PO file. + +</P> +<P> +The command <KBD>M-a</KBD> (<CODE>po-select-auxiliary</CODE>) asks the translator +for her choice of a particular auxiliary file, with completion, and +then switches to that selected PO file. The command also checks if +the selected file has an <CODE>msgid</CODE> field identical as the one for +the current entry, and if yes, this entry becomes current. Otherwise, +the cursor of the selected file is left undisturbed. + +</P> +<P> +For all this to work fully, auxiliary PO files will have to be normalized, +in that way that <CODE>msgid</CODE> fields should be written <EM>exactly</EM> +the same way. It is possible to write <CODE>msgid</CODE> fields in various +ways for representing the same string, different writing would break the +proper behaviour of the auxiliary file commands of PO mode. This is not +expected to be much a problem in practice, as most existing PO files have +their <CODE>msgid</CODE> entries written by the same GNU <CODE>gettext</CODE> tools. + +</P> +<P> +However, PO files initially created by PO mode itself, while marking +strings in source files, are normalised differently. So are PO +files resulting of the the <SAMP>`M-x normalize'</SAMP> command. Until these +discrepancies between PO mode and other GNU <CODE>gettext</CODE> tools get +fully resolved, the translator should stay aware of normalisation issues. + +</P> +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_4.html">previous</A>, <A HREF="gettext_6.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_6.html b/docs/html/gettext/gettext_6.html new file mode 100644 index 0000000000..09387ebe7a --- /dev/null +++ b/docs/html/gettext/gettext_6.html @@ -0,0 +1,258 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - Producing Binary MO Files</TITLE> +<link href="gettext_7.html" rel=Next> +<link href="gettext_5.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_5.html">previous</A>, <A HREF="gettext_7.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC32" HREF="gettext_toc.html#TOC32">Producing Binary MO Files</A></H1> + + + +<H2><A NAME="SEC33" HREF="gettext_toc.html#TOC33">Invoking the <CODE>msgfmt</CODE> Program</A></H2> + + +<PRE> +Usage: msgfmt [<VAR>option</VAR>] <VAR>filename</VAR>.po ... +</PRE> + +<DL COMPACT> + +<DT><SAMP>`-a <VAR>number</VAR>'</SAMP> +<DD> +<DT><SAMP>`--alignment=<VAR>number</VAR>'</SAMP> +<DD> +Align strings to <VAR>number</VAR> bytes (default: 1). + +<DT><SAMP>`-h'</SAMP> +<DD> +<DT><SAMP>`--help'</SAMP> +<DD> +Display this help and exit. + +<DT><SAMP>`--no-hash'</SAMP> +<DD> +Binary file will not include the hash table. + +<DT><SAMP>`-o <VAR>file</VAR>'</SAMP> +<DD> +<DT><SAMP>`--output-file=<VAR>file</VAR>'</SAMP> +<DD> +Specify output file name as <VAR>file</VAR>. + +<DT><SAMP>`--strict'</SAMP> +<DD> +Direct the program to work strictly following the Uniforum/Sun +implementation. Currently this only affects the naming of the output +file. If this option is not given the name of the output file is the +same as the domain name. If the strict Uniforum mode is enable the +suffix <TT>`.mo'</TT> is added to the file name if it is not already +present. + +We find this behaviour of Sun's implementation rather silly and so by +default this mode is <EM>not</EM> selected. + +<DT><SAMP>`-v'</SAMP> +<DD> +<DT><SAMP>`--verbose'</SAMP> +<DD> +Detect and diagnose input file anomalies which might represent +translation errors. The <CODE>msgid</CODE> and <CODE>msgstr</CODE> strings are +studied and compared. It is considered abnormal that one string +starts or ends with a newline while the other does not. + +Also, if the string represents a format sring used in a +<CODE>printf</CODE>-like function both strings should have the same number of +<SAMP>`%'</SAMP> format specifiers, with matching types. If the flag +<CODE>c-format</CODE> or <CODE>possible-c-format</CODE> appears in the special +comment <KBD>#,</KBD> for this entry a check is performed. For example, the +check will diagnose using <SAMP>`%.*s'</SAMP> against <SAMP>`%s'</SAMP>, or <SAMP>`%d'</SAMP> +against <SAMP>`%s'</SAMP>, or <SAMP>`%d'</SAMP> against <SAMP>`%x'</SAMP>. It can even handle +positional parameters. + +Normally the <CODE>xgettext</CODE> program automatically decides whether a +string is a format string or not. This algorithm is not perfect, +though. It might regard a string as a format string though it is not +used in a <CODE>printf</CODE>-like function and so <CODE>msgfmt</CODE> might report +errors where there are none. Or the other way round: a string is not +regarded as a format string but it is used in a <CODE>printf</CODE>-like +function. + +So solve this problem the programmer can dictate the decision to the +<CODE>xgettext</CODE> program (see section <A HREF="gettext_3.html#SEC17">Special Comments preceding Keywords</A>). The translator should not +consider removing the flag from the <KBD>#,</KBD> line. This "fix" would be +reversed again as soon as <CODE>msgmerge</CODE> is called the next time. + +<DT><SAMP>`-V'</SAMP> +<DD> +<DT><SAMP>`--version'</SAMP> +<DD> +Output version information and exit. + +</DL> + +<P> +If input file is <SAMP>`-'</SAMP>, standard input is read. If output file +is <SAMP>`-'</SAMP>, output is written to standard output. + +</P> + + +<H2><A NAME="SEC34" HREF="gettext_toc.html#TOC34">The Format of GNU MO Files</A></H2> + +<P> +The format of the generated MO files is best described by a picture, +which appears below. + +</P> +<P> +The first two words serve the identification of the file. The magic +number will always signal GNU MO files. The number is stored in the +byte order of the generating machine, so the magic number really is +two numbers: <CODE>0x950412de</CODE> and <CODE>0xde120495</CODE>. The second +word describes the current revision of the file format. For now the +revision is 0. This might change in future versions, and ensures +that the readers of MO files can distinguish new formats from old +ones, so that both can be handled correctly. The version is kept +separate from the magic number, instead of using different magic +numbers for different formats, mainly because <TT>`/etc/magic'</TT> is +not updated often. It might be better to have magic separated from +internal format version identification. + +</P> +<P> +Follow a number of pointers to later tables in the file, allowing +for the extension of the prefix part of MO files without having to +recompile programs reading them. This might become useful for later +inserting a few flag bits, indication about the charset used, new +tables, or other things. + +</P> +<P> +Then, at offset <VAR>O</VAR> and offset <VAR>T</VAR> in the picture, two tables +of string descriptors can be found. In both tables, each string +descriptor uses two 32 bits integers, one for the string length, +another for the offset of the string in the MO file, counting in bytes +from the start of the file. The first table contains descriptors +for the original strings, and is sorted so the original strings +are in increasing lexicographical order. The second table contains +descriptors for the translated strings, and is parallel to the first +table: to find the corresponding translation one has to access the +array slot in the second array with the same index. + +</P> +<P> +Having the original strings sorted enables the use of simple binary +search, for when the MO file does not contain an hashing table, or +for when it is not practical to use the hashing table provided in +the MO file. This also has another advantage, as the empty string +in a PO file GNU <CODE>gettext</CODE> is usually <EM>translated</EM> into +some system information attached to that particular MO file, and the +empty string necessarily becomes the first in both the original and +translated tables, making the system information very easy to find. + +</P> +<P> +The size <VAR>S</VAR> of the hash table can be zero. In this case, the +hash table itself is not contained in the MO file. Some people might +prefer this because a precomputed hashing table takes disk space, and +does not win <EM>that</EM> much speed. The hash table contains indices +to the sorted array of strings in the MO file. Conflict resolution is +done by double hashing. The precise hashing algorithm used is fairly +dependent of GNU <CODE>gettext</CODE> code, and is not documented here. + +</P> +<P> +As for the strings themselves, they follow the hash file, and each +is terminated with a <KBD>NUL</KBD>, and this <KBD>NUL</KBD> is not counted in +the length which appears in the string descriptor. The <CODE>msgfmt</CODE> +program has an option selecting the alignment for MO file strings. +With this option, each string is separately aligned so it starts at +an offset which is a multiple of the alignment value. On some RISC +machines, a correct alignment will speed things up. + +</P> +<P> +Nothing prevents a MO file from having embedded <KBD>NUL</KBD>s in strings. +However, the program interface currently used already presumes +that strings are <KBD>NUL</KBD> terminated, so embedded <KBD>NUL</KBD>s are +somewhat useless. But MO file format is general enough so other +interfaces would be later possible, if for example, we ever want to +implement wide characters right in MO files, where <KBD>NUL</KBD> bytes may +accidently appear. + +</P> +<P> +This particular issue has been strongly debated in the GNU +<CODE>gettext</CODE> development forum, and it is expectable that MO file +format will evolve or change over time. It is even possible that many +formats may later be supported concurrently. But surely, we have to +start somewhere, and the MO file format described here is a good start. +Nothing is cast in concrete, and the format may later evolve fairly +easily, so we should feel comfortable with the current approach. + +</P> + +<PRE> + byte + +------------------------------------------+ + 0 | magic number = 0x950412de | + | | + 4 | file format revision = 0 | + | | + 8 | number of strings | == N + | | + 12 | offset of table with original strings | == O + | | + 16 | offset of table with translation strings | == T + | | + 20 | size of hashing table | == S + | | + 24 | offset of hashing table | == H + | | + . . + . (possibly more entries later) . + . . + | | + O | length & offset 0th string ----------------. + O + 8 | length & offset 1st string ------------------. + ... ... | | +O + ((N-1)*8)| length & offset (N-1)th string | | | + | | | | + T | length & offset 0th translation ---------------. + T + 8 | length & offset 1st translation -----------------. + ... ... | | | | +T + ((N-1)*8)| length & offset (N-1)th translation | | | | | + | | | | | | + H | start hash table | | | | | + ... ... | | | | + H + S * 4 | end hash table | | | | | + | | | | | | + | NUL terminated 0th string <----------------' | | | + | | | | | + | NUL terminated 1st string <------------------' | | + | | | | + ... ... | | + | | | | + | NUL terminated 0th translation <---------------' | + | | | + | NUL terminated 1st translation <-----------------' + | | + ... ... + | | + +------------------------------------------+ +</PRE> + +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_5.html">previous</A>, <A HREF="gettext_7.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_7.html b/docs/html/gettext/gettext_7.html new file mode 100644 index 0000000000..758ce8ae69 --- /dev/null +++ b/docs/html/gettext/gettext_7.html @@ -0,0 +1,122 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - The User's View</TITLE> +<link href="gettext_8.html" rel=Next> +<link href="gettext_6.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_6.html">previous</A>, <A HREF="gettext_8.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC35" HREF="gettext_toc.html#TOC35">The User's View</A></H1> + +<P> +When GNU <CODE>gettext</CODE> will truly have reached is goal, average users +should feel some kind of astonished pleasure, seeing the effect of +that strange kind of magic that just makes their own native language +appear everywhere on their screens. As for naive users, they would +ideally have no special pleasure about it, merely taking their own +language for <EM>granted</EM>, and becoming rather unhappy otherwise. + +</P> +<P> +So, let's try to describe here how we would like the magic to operate, +as we want the users' view to be the simplest, among all ways one +could look at GNU <CODE>gettext</CODE>. All other software engineers: +programmers, translators, maintainers, should work together in such a +way that the magic becomes possible. This is a long and progressive +undertaking, and information is available about the progress of the +Translation Project. + +</P> +<P> +When a package is distributed, there are two kind of users: +<STRONG>installers</STRONG> who fetch the distribution, unpack it, configure +it, compile it and install it for themselves or others to use; and +<STRONG>end users</STRONG> that call programs of the package, once these have +been installed at their site. GNU <CODE>gettext</CODE> is offering magic +for both installers and end users. + +</P> + + + +<H2><A NAME="SEC36" HREF="gettext_toc.html#TOC36">The Current <TT>`ABOUT-NLS'</TT> Matrix</A></H2> + +<P> +Languages are not equally supported in all packages using GNU +<CODE>gettext</CODE>. To know if some package uses GNU <CODE>gettext</CODE>, one +may check the distribution for the <TT>`ABOUT-NLS'</TT> information file, for +some <TT>`<VAR>ll</VAR>.po'</TT> files, often kept together into some <TT>`po/'</TT> +directory, or for an <TT>`intl/'</TT> directory. Internationalized packages +have usually many <TT>`<VAR>ll</VAR>.po'</TT> files, where <VAR>ll</VAR> represents +the language. section <A HREF="gettext_7.html#SEC38">Magic for End Users</A> for a complete description of the format +for <VAR>ll</VAR>. + +</P> +<P> +More generally, a matrix is available for showing the current state +of the Translation Project, listing which packages are prepared for +multi-lingual messages, and which languages is supported by each. +Because this information changes often, this matrix is not kept within +this GNU <CODE>gettext</CODE> manual. This information is often found in +file <TT>`ABOUT-NLS'</TT> from various distributions, but is also as old as +the distribution itself. A recent copy of this <TT>`ABOUT-NLS'</TT> file, +containing up-to-date information, should generally be found on the +Translation Project sites, and also on most GNU archive sites. + +</P> + + +<H2><A NAME="SEC37" HREF="gettext_toc.html#TOC37">Magic for Installers</A></H2> + +<P> +By default, packages fully using GNU <CODE>gettext</CODE>, internally, +are installed in such a way that they to allow translation of +messages. At <EM>configuration</EM> time, those packages should +automatically detect whether the underlying host system provides usable +<CODE>catgets</CODE> or <CODE>gettext</CODE> functions. If neither is present, +the GNU <CODE>gettext</CODE> library should be automatically prepared +and used. Installers may use special options at configuration +time for changing this behavior. The command <SAMP>`./configure +--with-included-gettext'</SAMP> bypasses system <CODE>catgets</CODE> or <CODE>gettext</CODE> to +use GNU <CODE>gettext</CODE> instead, while <SAMP>`./configure --disable-nls'</SAMP> +produces program totally unable to translate messages. + +</P> +<P> +Internationalized packages have usually many <TT>`<VAR>ll</VAR>.po'</TT> +files. Unless +translations are disabled, all those available are installed together +with the package. However, the environment variable <CODE>LINGUAS</CODE> +may be set, prior to configuration, to limit the installed set. +<CODE>LINGUAS</CODE> should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +</P> + + +<H2><A NAME="SEC38" HREF="gettext_toc.html#TOC38">Magic for End Users</A></H2> + +<P> +We consider here those packages using GNU <CODE>gettext</CODE> internally, +and for which the installers did not disable translation at +<EM>configure</EM> time. Then, users only have to set the <CODE>LANG</CODE> +environment variable to the appropriate <SAMP>`<VAR>ll</VAR>'</SAMP> prior to +using the programs in the package. See section <A HREF="gettext_7.html#SEC36">The Current <TT>`ABOUT-NLS'</TT> Matrix</A>. For example, +let's presume a German site. At the shell prompt, users merely have to +execute <SAMP>`setenv LANG de'</SAMP> (in <CODE>csh</CODE>) or <SAMP>`export +LANG; LANG=de'</SAMP> (in <CODE>sh</CODE>). They could even do this from their +<TT>`.login'</TT> or <TT>`.profile'</TT> file. + +</P> +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_6.html">previous</A>, <A HREF="gettext_8.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_8.html b/docs/html/gettext/gettext_8.html new file mode 100644 index 0000000000..a028ce9f83 --- /dev/null +++ b/docs/html/gettext/gettext_8.html @@ -0,0 +1,896 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - The Programmer's View</TITLE> +<link href="gettext_9.html" rel=Next> +<link href="gettext_7.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_7.html">previous</A>, <A HREF="gettext_9.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC39" HREF="gettext_toc.html#TOC39">The Programmer's View</A></H1> + +<P> +One aim of the current message catalog implementation provided by +GNU <CODE>gettext</CODE> was to use the systems message catalog handling, if the +installer wishes to do so. So we perhaps should first take a look at +the solutions we know about. The people in the POSIX committee does not +manage to agree on one of the semi-official standards which we'll +describe below. In fact they couldn't agree on anything, so nothing +decide only to include an example of an interface. The major Unix vendors +are split in the usage of the two most important specifications: X/Opens +catgets vs. Uniforums gettext interface. We'll describe them both and +later explain our solution of this dilemma. + +</P> + + + +<H2><A NAME="SEC40" HREF="gettext_toc.html#TOC40">About <CODE>catgets</CODE></A></H2> + +<P> +The <CODE>catgets</CODE> implementation is defined in the X/Open Portability +Guide, Volume 3, XSI Supplementary Definitions, Chapter 5. But the +process of creating this standard seemed to be too slow for some of +the Unix vendors so they created their implementations on preliminary +versions of the standard. Of course this leads again to problems while +writing platform independent programs: even the usage of <CODE>catgets</CODE> +does not guarantee a unique interface. + +</P> +<P> +Another, personal comment on this that only a bunch of committee members +could have made this interface. They never really tried to program +using this interface. It is a fast, memory-saving implementation, an +user can happily live with it. But programmers hate it (at least me and +some others do...) + +</P> +<P> +But we must not forget one point: after all the trouble with transfering +the rights on Unix(tm) they at last came to X/Open, the very same who +published this specifications. This leads me to making the prediction +that this interface will be in future Unix standards (e.g. Spec1170) and +therefore part of all Unix implementation (implementations, which are +<EM>allowed</EM> to wear this name). + +</P> + + + +<H3><A NAME="SEC41" HREF="gettext_toc.html#TOC41">The Interface</A></H3> + +<P> +The interface to the <CODE>catgets</CODE> implementation consists of three +functions which correspond to those used in file access: <CODE>catopen</CODE> +to open the catalog for using, <CODE>catgets</CODE> for accessing the message +tables, and <CODE>catclose</CODE> for closing after work is done. Prototypes +for the functions and the needed definitions are in the +<CODE><nl_types.h></CODE> header file. + +</P> +<P> +<CODE>catopen</CODE> is used like in this: + +</P> + +<PRE> +nl_catd catd = catopen ("catalog_name", 0); +</PRE> + +<P> +The function takes as the argument the name of the catalog. This usual +refers to the name of the program or the package. The second parameter +is not further specified in the standard. I don't even know whether it +is implemented consistently among various systems. So the common advice +is to use <CODE>0</CODE> as the value. The return value is a handle to the +message catalog, equivalent to handles to file returned by <CODE>open</CODE>. + +</P> +<P> +This handle is of course used in the <CODE>catgets</CODE> function which can +be used like this: + +</P> + +<PRE> +char *translation = catgets (catd, set_no, msg_id, "original string"); +</PRE> + +<P> +The first parameter is this catalog descriptor. The second parameter +specifies the set of messages in this catalog, in which the message +described by <CODE>msg_id</CODE> is obtained. <CODE>catgets</CODE> therefore uses a +three-stage addressing: + +</P> + +<PRE> +catalog name => set number => message ID => translation +</PRE> + +<P> +The fourth argument is not used to address the translation. It is given +as a default value in case when one of the addressing stages fail. One +important thing to remember is that although the return type of catgets +is <CODE>char *</CODE> the resulting string <EM>must not</EM> be changed. It +should better <CODE>const char *</CODE>, but the standard is published in +1988, one year before ANSI C. + +</P> +<P> +The last of these function functions is used and behaves as expected: + +</P> + +<PRE> +catclose (catd); +</PRE> + +<P> +After this no <CODE>catgets</CODE> call using the descriptor is legal anymore. + +</P> + + +<H3><A NAME="SEC42" HREF="gettext_toc.html#TOC42">Problems with the <CODE>catgets</CODE> Interface?!</A></H3> + +<P> +Now that this descriptions seemed to be really easy where are the +problem we speak of. In fact the interface could be used in a +reasonable way, but constructing the message catalogs is a pain. The +reason for this lies in the third argument of <CODE>catgets</CODE>: the unique +message ID. This has to be a numeric value for all messages in a single +set. Perhaps you could imagine the problems keeping such list while +changing the source code. Add a new message here, remove one there. Of +course there have been developed a lot of tools helping to organize this +chaos but one as the other fails in one aspect or the other. We don't +want to say that the other approach has no problems but they are far +more easily to manage. + +</P> + + +<H2><A NAME="SEC43" HREF="gettext_toc.html#TOC43">About <CODE>gettext</CODE></A></H2> + +<P> +The definition of the <CODE>gettext</CODE> interface comes from a Uniforum +proposal and it is followed by at least one major Unix vendor +(Sun) in its last developments. It is not specified in any official +standard, though. + +</P> +<P> +The main points about this solution is that it does not follow the +method of normal file handling (open-use-close) and that it does not +burden the programmer so many task, especially the unique key handling. +Of course here is also a unique key needed, but this key is the +message itself (how long or short it is). See section <A HREF="gettext_8.html#SEC48">Comparing the Two Interfaces</A> for a +more detailed comparison of the two methods. + +</P> +<P> +The following section contains a rather detailed description of the +interface. We make it that detailed because this is the interface +we chose for the GNU <CODE>gettext</CODE> Library. Programmers interested +in using this library will be interested in this description. + +</P> + + + +<H3><A NAME="SEC44" HREF="gettext_toc.html#TOC44">The Interface</A></H3> + +<P> +The minimal functionality an interface must have is a) to select a +domain the strings are coming from (a single domain for all programs is +not reasonable because its construction and maintenance is difficult, +perhaps impossible) and b) to access a string in a selected domain. + +</P> +<P> +This is principally the description of the <CODE>gettext</CODE> interface. It +has an global domain which unqualified usages reference. Of course this +domain is selectable by the user. + +</P> + +<PRE> +char *textdomain (const char *domain_name); +</PRE> + +<P> +This provides the possibility to change or query the current status of +the current global domain of the <CODE>LC_MESSAGE</CODE> category. The +argument is a null-terminated string, whose characters must be legal in +the use in filenames. If the <VAR>domain_name</VAR> argument is <CODE>NULL</CODE>, +the function return the current value. If no value has been set +before, the name of the default domain is returned: <EM>messages</EM>. +Please note that although the return value of <CODE>textdomain</CODE> is of +type <CODE>char *</CODE> no changing is allowed. It is also important to know +that no checks of the availability are made. If the name is not +available you will see this by the fact that no translations are provided. + +</P> +<P> +To use a domain set by <CODE>textdomain</CODE> the function + +</P> + +<PRE> +char *gettext (const char *msgid); +</PRE> + +<P> +is to be used. This is the simplest reasonable form one can imagine. +The translation of the string <VAR>msgid</VAR> is returned if it is available +in the current domain. If not available the argument itself is +returned. If the argument is <CODE>NULL</CODE> the result is undefined. + +</P> +<P> +One things which should come into mind is that no explicit dependency to +the used domain is given. The current value of the domain for the +<CODE>LC_MESSAGES</CODE> locale is used. If this changes between two +executions of the same <CODE>gettext</CODE> call in the program, both calls +reference a different message catalog. + +</P> +<P> +For the easiest case, which is normally used in internationalized +packages, once at the beginning of execution a call to <CODE>textdomain</CODE> +is issued, setting the domain to a unique name, normally the package +name. In the following code all strings which have to be translated are +filtered through the gettext function. That's all, the package speaks +your language. + +</P> + + +<H3><A NAME="SEC45" HREF="gettext_toc.html#TOC45">Solving Ambiguities</A></H3> + +<P> +While this single name domain work good for most applications there +might be the need to get translations from more than one domain. Of +course one could switch between different domains with calls to +<CODE>textdomain</CODE>, but this is really not convenient nor is it fast. A +possible situation could be one case discussing while this writing: all +error messages of functions in the set of common used functions should +go into a separate domain <CODE>error</CODE>. By this mean we would only need +to translate them once. + +</P> +<P> +For this reasons there are two more functions to retrieve strings: + +</P> + +<PRE> +char *dgettext (const char *domain_name, const char *msgid); +char *dcgettext (const char *domain_name, const char *msgid, + int category); +</PRE> + +<P> +Both take an additional argument at the first place, which corresponds +to the argument of <CODE>textdomain</CODE>. The third argument of +<CODE>dcgettext</CODE> allows to use another locale but <CODE>LC_MESSAGES</CODE>. +But I really don't know where this can be useful. If the +<VAR>domain_name</VAR> is <CODE>NULL</CODE> or <VAR>category</VAR> has an value beside +the known ones, the result is undefined. It should also be noted that +this function is not part of the second known implementation of this +function family, the one found in Solaris. + +</P> +<P> +A second ambiguity can arise by the fact, that perhaps more than one +domain has the same name. This can be solved by specifying where the +needed message catalog files can be found. + +</P> + +<PRE> +char *bindtextdomain (const char *domain_name, + const char *dir_name); +</PRE> + +<P> +Calling this function binds the given domain to a file in the specified +directory (how this file is determined follows below). Especially a +file in the systems default place is not favored against the specified +file anymore (as it would be by solely using <CODE>textdomain</CODE>). A +<CODE>NULL</CODE> pointer for the <VAR>dir_name</VAR> parameter returns the binding +associated with <VAR>domain_name</VAR>. If <VAR>domain_name</VAR> itself is +<CODE>NULL</CODE> nothing happens and a <CODE>NULL</CODE> pointer is returned. Here +again as for all the other functions is true that none of the return +value must be changed! + +</P> +<P> +It is important to remember that relative path names for the +<VAR>dir_name</VAR> parameter can be trouble. Since the path is always +computed relative to the current directory different results will be +achieved when the program executes a <CODE>chdir</CODE> command. Relative +paths should always be avoided to avoid dependencies and +unreliabilities. + +</P> + + +<H3><A NAME="SEC46" HREF="gettext_toc.html#TOC46">Locating Message Catalog Files</A></H3> + +<P> +Because many different languages for many different packages have to be +stored we need some way to add these information to file message catalog +files. The way usually used in Unix environments is have this encoding +in the file name. This is also done here. The directory name given in +<CODE>bindtextdomain</CODE>s second argument (or the default directory), +followed by the value and name of the locale and the domain name are +concatenated: + +</P> + +<PRE> +<VAR>dir_name</VAR>/<VAR>locale</VAR>/LC_<VAR>category</VAR>/<VAR>domain_name</VAR>.mo +</PRE> + +<P> +The default value for <VAR>dir_name</VAR> is system specific. For the GNU +library, and for packages adhering to its conventions, it's: + +<PRE> +/usr/local/share/locale +</PRE> + +<P> +<VAR>locale</VAR> is the value of the locale whose name is this +<CODE>LC_<VAR>category</VAR></CODE>. For <CODE>gettext</CODE> and <CODE>dgettext</CODE> this +locale is always <CODE>LC_MESSAGES</CODE>. <CODE>dcgettext</CODE> specifies the +locale by the third argument.<A NAME="DOCF2" HREF="gettext_foot.html#FOOT2">(2)</A> <A NAME="DOCF3" HREF="gettext_foot.html#FOOT3">(3)</A> + +</P> + + +<H3><A NAME="SEC47" HREF="gettext_toc.html#TOC47">Optimization of the *gettext functions</A></H3> + +<P> +At this point of the discussion we should talk about an advantage of the +GNU <CODE>gettext</CODE> implementation. Some readers might have pointed out +that an internationalized program might have a poor performance if some +string has to be translated in an inner loop. While this is unavoidable +when the string varies from one run of the loop to the other it is +simply a waste of time when the string is always the same. Take the +following example: + +</P> + +<PRE> +{ + while (...) + { + puts (gettext ("Hello world")); + } +} +</PRE> + +<P> +When the locale selection does not change between two runs the resulting +string is always the same. One way to use this is: + +</P> + +<PRE> +{ + str = gettext ("Hello world"); + while (...) + { + puts (str); + } +} +</PRE> + +<P> +But this solution is not usable in all situation (e.g. when the locale +selection changes) nor is it good readable. + +</P> +<P> +The GNU C compiler, version 2.7 and above, provide another solution for +this. To describe this we show here some lines of the +<TT>`intl/libgettext.h'</TT> file. For an explanation of the expression +command block see section `Statements and Declarations in Expressions' in <CITE>The GNU CC Manual</CITE>. + +</P> + +<PRE> +# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7 +extern int _nl_msg_cat_cntr; +# define dcgettext(domainname, msgid, category) \ + (__extension__ \ + ({ \ + char *result; \ + if (__builtin_constant_p (msgid)) \ + { \ + static char *__translation__; \ + static int __catalog_counter__; \ + if (! __translation__ \ + || __catalog_counter__ != _nl_msg_cat_cntr) \ + { \ + __translation__ = \ + dcgettext__ ((domainname), (msgid), (category)); \ + __catalog_counter__ = _nl_msg_cat_cntr; \ + } \ + result = __translation__; \ + } \ + else \ + result = dcgettext__ ((domainname), (msgid), (category)); \ + result; \ + })) +# endif +</PRE> + +<P> +The interesting thing here is the <CODE>__builtin_constant_p</CODE> predicate. +This is evaluated at compile time and so optimization can take place +immediately. Here two cases are distinguished: the argument to +<CODE>gettext</CODE> is not a constant value in which case simply the function +<CODE>dcgettext__</CODE> is called, the real implementation of the +<CODE>dcgettext</CODE> function. + +</P> +<P> +If the string argument <EM>is</EM> constant we can reuse the once gained +translation when the locale selection has not changed. This is exactly +what is done here. The <CODE>_nl_msg_cat_cntr</CODE> variable is defined in +the <TT>`loadmsgcat.c'</TT> which is available in <TT>`libintl.a'</TT> and is +changed whenever a new message catalog is loaded. + +</P> + + +<H2><A NAME="SEC48" HREF="gettext_toc.html#TOC48">Comparing the Two Interfaces</A></H2> + +<P> +The following discussion is perhaps a little bit colored. As said +above we implemented GNU <CODE>gettext</CODE> following the Uniforum +proposal and this surely has its reasons. But it should show how we +came to this decision. + +</P> +<P> +First we take a look at the developing process. When we write an +application using NLS provided by <CODE>gettext</CODE> we proceed as always. +Only when we come to a string which might be seen by the users and thus +has to be translated we use <CODE>gettext("...")</CODE> instead of +<CODE>"..."</CODE>. At the beginning of each source file (or in a central +header file) we define + +</P> + +<PRE> +#define gettext(String) (String) +</PRE> + +<P> +Even this definition can be avoided when the system supports the +<CODE>gettext</CODE> function in its C library. When we compile this code the +result is the same as if no NLS code is used. When you take a look at +the GNU <CODE>gettext</CODE> code you will see that we use <CODE>_("...")</CODE> +instead of <CODE>gettext("...")</CODE>. This reduces the number of +additional characters per translatable string to <EM>3</EM> (in words: +three). + +</P> +<P> +When now a production version of the program is needed we simply replace +the definition + +</P> + +<PRE> +#define _(String) (String) +</PRE> + +<P> +by + +</P> + +<PRE> +#include <libintl.h> +#define _(String) gettext (String) +</PRE> + +<P> +Additionally we run the program <TT>`xgettext'</TT> on all source code file +which contain translatable strings and that's it: we have a running +program which does not depend on translations to be available, but which +can use any that becomes available. + +</P> +<P> +The same procedure can be done for the <CODE>gettext_noop</CODE> invocations +(see section <A HREF="gettext_3.html#SEC18">Special Cases of Translatable Strings</A>). First you can define <CODE>gettext_noop</CODE> to a +no-op macro and later use the definition from <TT>`libintl.h'</TT>. Because +this name is not used in Suns implementation of <TT>`libintl.h'</TT>, +you should consider the following code for your project: + +</P> + +<PRE> +#ifdef gettext_noop +# define N_(String) gettext_noop (String) +#else +# define N_(String) (String) +#endif +</PRE> + +<P> +<CODE>N_</CODE> is a short form similar to <CODE>_</CODE>. The <TT>`Makefile'</TT> in +the <TT>`po/'</TT> directory of GNU gettext knows by default both of the +mentioned short forms so you are invited to follow this proposal for +your own ease. + +</P> +<P> +Now to <CODE>catgets</CODE>. The main problem is the work for the +programmer. Every time he comes to a translatable string he has to +define a number (or a symbolic constant) which has also be defined in +the message catalog file. He also has to take care for duplicate +entries, duplicate message IDs etc. If he wants to have the same +quality in the message catalog as the GNU <CODE>gettext</CODE> program +provides he also has to put the descriptive comments for the strings and +the location in all source code files in the message catalog. This is +nearly a Mission: Impossible. + +</P> +<P> +But there are also some points people might call advantages speaking for +<CODE>catgets</CODE>. If you have a single word in a string and this string +is used in different contexts it is likely that in one or the other +language the word has different translations. Example: + +</P> + +<PRE> +printf ("%s: %d", gettext ("number"), number_of_errors) + +printf ("you should see %d %s", number_count, + number_count == 1 ? gettext ("number") : gettext ("numbers")) +</PRE> + +<P> +Here we have to translate two times the string <CODE>"number"</CODE>. Even +if you do not speak a language beside English it might be possible to +recognize that the two words have a different meaning. In German the +first appearance has to be translated to <CODE>"Anzahl"</CODE> and the second +to <CODE>"Zahl"</CODE>. + +</P> +<P> +Now you can say that this example is really esoteric. And you are +right! This is exactly how we felt about this problem and decide that +it does not weight that much. The solution for the above problem could +be very easy: + +</P> + +<PRE> +printf ("%s %d", gettext ("number:"), number_of_errors) + +printf (number_count == 1 ? gettext ("you should see %d number") + : gettext ("you should see %d numbers"), + number_count) +</PRE> + +<P> +We believe that we can solve all conflicts with this method. If it is +difficult one can also consider changing one of the conflicting string a +little bit. But it is not impossible to overcome. + +</P> +<P> +Translator note: It is perhaps appropriate here to tell those English +speaking programmers that the plural form of a noun cannot be formed by +appending a single `s'. Most other languages use different methods. +Even the above form is not general enough to cope with all languages. +Rafal Maszkowski <rzm@mat.uni.torun.pl> reports: + +</P> + +<BLOCKQUOTE> +<P> +In Polish we use e.g. plik (file) this way: + +<PRE> +1 plik +2,3,4 pliki +5-21 pliko'w +22-24 pliki +25-31 pliko'w +</PRE> + +<P> +and so on (o' means 8859-2 oacute which should be rather okreska, +similar to aogonek). +</BLOCKQUOTE> + +<P> +A workable approach might be to consider methods like the one used for +<CODE>LC_TIME</CODE> in the POSIX.2 standard. The value of the +<CODE>alt_digits</CODE> field can be up to 100 strings which represent the +numbers 1 to 100. Using this in a situation of an internationalized +program means that an array of translatable strings should be indexed by +the number which should represent. A small example: + +</P> + +<PRE> +void +print_month_info (int month) +{ + const char *month_pos[12] = + { N_("first"), N_("second"), N_("third"), N_("fourth"), + N_("fifth"), N_("sixth"), N_("seventh"), N_("eighth"), + N_("ninth"), N_("tenth"), N_("eleventh"), N_("twelfth") }; + printf (_("%s is the %s month\n"), nl_langinfo (MON_1 + month), + _(month_pos[month])); +} +</PRE> + +<P> +It should be obvious that this method is only reasonable for small +ranges of numbers. + +</P> + + + +<H2><A NAME="SEC49" HREF="gettext_toc.html#TOC49">Using libintl.a in own programs</A></H2> + +<P> +Starting with version 0.9.4 the library <CODE>libintl.h</CODE> should be +self-contained. I.e., you can use it in your own programs without +providing additional functions. The <TT>`Makefile'</TT> will put the header +and the library in directories selected using the <CODE>$(prefix)</CODE>. + +</P> +<P> +One exception of the above is found on HP-UX systems. Here the C library +does not contain the <CODE>alloca</CODE> function (and the HP compiler does +not generate it inlined). But it is not intended to rewrite the whole +library just because of this dumb system. Instead include the +<CODE>alloca</CODE> function in all package you use the <CODE>libintl.a</CODE> in. + +</P> + + +<H2><A NAME="SEC50" HREF="gettext_toc.html#TOC50">Being a <CODE>gettext</CODE> grok</A></H2> + +<P> +To fully exploit the functionality of the GNU <CODE>gettext</CODE> library it +is surely helpful to read the source code. But for those who don't want +to spend that much time in reading the (sometimes complicated) code here +is a list comments: + +</P> + +<UL> +<LI>Changing the language at runtime + +For interactive programs it might be useful to offer a selection of the +used language at runtime. To understand how to do this one need to know +how the used language is determined while executing the <CODE>gettext</CODE> +function. The method which is presented here only works correctly +with the GNU implementation of the <CODE>gettext</CODE> functions. It is not +possible with underlying <CODE>catgets</CODE> functions or <CODE>gettext</CODE> +functions from the systems C library. The exception is of course the +GNU C Library which uses the GNU <CODE>gettext</CODE> Library for message handling. + +In the function <CODE>dcgettext</CODE> at every call the current setting of +the highest priority environment variable is determined and used. +Highest priority means here the following list with decreasing +priority: + + +<OL> +<LI><CODE>LANGUAGE</CODE> + +<LI><CODE>LC_ALL</CODE> + +<LI><CODE>LC_xxx</CODE>, according to selected locale + +<LI><CODE>LANG</CODE> + +</OL> + +Afterwards the path is constructed using the found value and the +translation file is loaded if available. + +What is now when the value for, say, <CODE>LANGUAGE</CODE> changes. According +to the process explained above the new value of this variable is found +as soon as the <CODE>dcgettext</CODE> function is called. But this also means +the (perhaps) different message catalog file is loaded. In other +words: the used language is changed. + +But there is one little hook. The code for gcc-2.7.0 and up provides +some optimization. This optimization normally prevents the calling of +the <CODE>dcgettext</CODE> function as long as no new catalog is loaded. But +if <CODE>dcgettext</CODE> is not called the program also cannot find the +<CODE>LANGUAGE</CODE> variable be changed (see section <A HREF="gettext_8.html#SEC47">Optimization of the *gettext functions</A>). A +solution for this is very easy. Include the following code in the +language switching function. + + +<PRE> + /* Change language. */ + setenv ("LANGUAGE", "fr", 1); + + /* Make change known. */ + { + extern int _nl_msg_cat_cntr; + ++_nl_msg_cat_cntr; + } +</PRE> + +The variable <CODE>_nl_msg_cat_cntr</CODE> is defined in <TT>`loadmsgcat.c'</TT>. +The programmer will find himself in need for a construct like this only +when developing programs which do run longer and provide the user to +select the language at runtime. Non-interactive programs (like all +these little Unix tools) should never need this. + +</UL> + + + +<H2><A NAME="SEC51" HREF="gettext_toc.html#TOC51">Temporary Notes for the Programmers Chapter</A></H2> + + + +<H3><A NAME="SEC52" HREF="gettext_toc.html#TOC52">Temporary - Two Possible Implementations</A></H3> + +<P> +There are two competing methods for language independent messages: +the X/Open <CODE>catgets</CODE> method, and the Uniforum <CODE>gettext</CODE> +method. The <CODE>catgets</CODE> method indexes messages by integers; the +<CODE>gettext</CODE> method indexes them by their English translations. +The <CODE>catgets</CODE> method has been around longer and is supported +by more vendors. The <CODE>gettext</CODE> method is supported by Sun, +and it has been heard that the COSE multi-vendor initiative is +supporting it. Neither method is a POSIX standard; the POSIX.1 +committee had a lot of disagreement in this area. + +</P> +<P> +Neither one is in the POSIX standard. There was much disagreement +in the POSIX.1 committee about using the <CODE>gettext</CODE> routines +vs. <CODE>catgets</CODE> (XPG). In the end the committee couldn't +agree on anything, so no messaging system was included as part +of the standard. I believe the informative annex of the standard +includes the XPG3 messaging interfaces, "...as an example of +a messaging system that has been implemented..." + +</P> +<P> +They were very careful not to say anywhere that you should use one +set of interfaces over the other. For more on this topic please +see the Programming for Internationalization FAQ. + +</P> + + +<H3><A NAME="SEC53" HREF="gettext_toc.html#TOC53">Temporary - About <CODE>catgets</CODE></A></H3> + +<P> +There have been a few discussions of late on the use of +<CODE>catgets</CODE> as a base. I think it important to present both +sides of the argument and hence am opting to play devil's advocate +for a little bit. + +</P> +<P> +I'll not deny the fact that <CODE>catgets</CODE> could have been designed +a lot better. It currently has quite a number of limitations and +these have already been pointed out. + +</P> +<P> +However there is a great deal to be said for consistency and +standardization. A common recurring problem when writing Unix +software is the myriad portability problems across Unix platforms. +It seems as if every Unix vendor had a look at the operating system +and found parts they could improve upon. Undoubtedly, these +modifications are probably innovative and solve real problems. +However, software developers have a hard time keeping up with all +these changes across so many platforms. + +</P> +<P> +And this has prompted the Unix vendors to begin to standardize their +systems. Hence the impetus for Spec1170. Every major Unix vendor +has committed to supporting this standard and every Unix software +developer waits with glee the day they can write software to this +standard and simply recompile (without having to use autoconf) +across different platforms. + +</P> +<P> +As I understand it, Spec1170 is roughly based upon version 4 of the +X/Open Portability Guidelines (XPG4). Because <CODE>catgets</CODE> and +friends are defined in XPG4, I'm led to believe that <CODE>catgets</CODE> +is a part of Spec1170 and hence will become a standardized component +of all Unix systems. + +</P> + + +<H3><A NAME="SEC54" HREF="gettext_toc.html#TOC54">Temporary - Why a single implementation</A></H3> + +<P> +Now it seems kind of wasteful to me to have two different systems +installed for accessing message catalogs. If we do want to remedy +<CODE>catgets</CODE> deficiencies why don't we try to expand <CODE>catgets</CODE> +(in a compatible manner) rather than implement an entirely new system. +Otherwise, we'll end up with two message catalog access systems installed +with an operating system - one set of routines for packages using GNU +<CODE>gettext</CODE> for their internationalization, and another set of routines +(catgets) for all other software. Bloated? + +</P> +<P> +Supposing another catalog access system is implemented. Which do +we recommend? At least for Linux, we need to attract as many +software developers as possible. Hence we need to make it as easy +for them to port their software as possible. Which means supporting +<CODE>catgets</CODE>. We will be implementing the <CODE>glocale</CODE> code +within our <CODE>libc</CODE>, but does this mean we also have to incorporate +another message catalog access scheme within our <CODE>libc</CODE> as well? +And what about people who are going to be using the <CODE>glocale</CODE> ++ non-<CODE>catgets</CODE> routines. When they port their software to +other platforms, they're now going to have to include the front-end +(<CODE>glocale</CODE>) code plus the back-end code (the non-<CODE>catgets</CODE> +access routines) with their software instead of just including the +<CODE>glocale</CODE> code with their software. + +</P> +<P> +Message catalog support is however only the tip of the iceberg. +What about the data for the other locale categories. They also have +a number of deficiencies. Are we going to abandon them as well and +develop another duplicate set of routines (should <CODE>glocale</CODE> +expand beyond message catalog support)? + +</P> +<P> +Like many parts of Unix that can be improved upon, we're stuck with balancing +compatibility with the past with useful improvements and innovations for +the future. + +</P> + + + +<H3><A NAME="SEC55" HREF="gettext_toc.html#TOC55">Temporary - Notes</A></H3> + +<P> +X/Open agreed very late on the standard form so that many +implementations differ from the final form. Both of my system (old +Linux catgets and Ultrix-4) have a strange variation. + +</P> +<P> +OK. After incorporating the last changes I have to spend some time on +making the GNU/Linux <CODE>libc</CODE> <CODE>gettext</CODE> functions. So in future +Solaris is not the only system having <CODE>gettext</CODE>. + +</P> +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_7.html">previous</A>, <A HREF="gettext_9.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_9.html b/docs/html/gettext/gettext_9.html new file mode 100644 index 0000000000..f9b5852532 --- /dev/null +++ b/docs/html/gettext/gettext_9.html @@ -0,0 +1,513 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - The Translator's View</TITLE> +<link href="gettext_10.html" rel=Next> +<link href="gettext_8.html" rel=Previous> +<link href="gettext_toc.html" rel=ToC> + +</HEAD> +<BODY> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_8.html">previous</A>, <A HREF="gettext_10.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +<P><HR><P> + + +<H1><A NAME="SEC56" HREF="gettext_toc.html#TOC56">The Translator's View</A></H1> + + + +<H2><A NAME="SEC57" HREF="gettext_toc.html#TOC57">Introduction 0</A></H2> + +<P> +GNU is going international! The Translation Project is a way +to get maintainers, translators and users all together, so GNU will +gradually become able to speak many native languages. + +</P> +<P> +The GNU <CODE>gettext</CODE> tool set contains <EM>everything</EM> maintainers +need for internationalizing their packages for messages. It also +contains quite useful tools for helping translators at localizing +messages to their native language, once a package has already been +internationalized. + +</P> +<P> +To achieve the Translation Project, we need many interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +If you'd like to volunteer to <EM>work</EM> at translating messages, +please send mail to your translating team. + +</P> +<P> +Each team has its own mailing list, courtesy of Linux +International. You may reach your translating team at the address +<TT>`<VAR>ll</VAR>@li.org'</TT>, replacing <VAR>ll</VAR> by the two-letter ISO 639 +code for your language. Language codes are <EM>not</EM> the same as +country codes given in ISO 3166. The following translating teams +exist: + +</P> + +<BLOCKQUOTE> +<P> +Chinese <CODE>zh</CODE>, Czech <CODE>cs</CODE>, Danish <CODE>da</CODE>, Dutch <CODE>nl</CODE>, +Esperanto <CODE>eo</CODE>, Finnish <CODE>fi</CODE>, French <CODE>fr</CODE>, Irish +<CODE>ga</CODE>, German <CODE>de</CODE>, Greek <CODE>el</CODE>, Italian <CODE>it</CODE>, +Japanese <CODE>ja</CODE>, Indonesian <CODE>in</CODE>, Norwegian <CODE>no</CODE>, Polish +<CODE>pl</CODE>, Portuguese <CODE>pt</CODE>, Russian <CODE>ru</CODE>, Spanish <CODE>es</CODE>, +Swedish <CODE>sv</CODE> and Turkish <CODE>tr</CODE>. +</BLOCKQUOTE> + +<P> +For example, you may reach the Chinese translating team by writing to +<TT>`zh@li.org'</TT>. When you become a member of the translating team +for your own language, you may subscribe to its list. For example, +Swedish people can send a message to <TT>`sv-request@li.org'</TT>, +having this message body: + +</P> + +<PRE> +subscribe +</PRE> + +<P> +Keep in mind that team members should be interested in <EM>working</EM> +at translations, or at solving translational difficulties, rather than +merely lurking around. If your team does not exist yet and you want to +start one, please write to <TT>`gnu-translation@prep.ai.mit.edu'</TT>; +you will then reach the GNU coordinator for all translator teams. + +</P> +<P> +A handful of GNU packages have already been adapted and provided +with message translations for several languages. Translation +teams have begun to organize, using these packages as a starting +point. But there are many more packages and many languages for +which we have no volunteer translators. If you would like to +volunteer to work at translating messages, please send mail to +<TT>`gnu-translation@prep.ai.mit.edu'</TT> indicating what language(s) +you can work on. + +</P> + + +<H2><A NAME="SEC58" HREF="gettext_toc.html#TOC58">Introduction 1</A></H2> + +<P> +This is now official, GNU is going international! Here is the +announcement submitted for the January 1995 GNU Bulletin: + +</P> + +<BLOCKQUOTE> +<P> +A handful of GNU packages have already been adapted and provided +with message translations for several languages. Translation +teams have begun to organize, using these packages as a starting +point. But there are many more packages and many languages +for which we have no volunteer translators. If you'd like to +volunteer to work at translating messages, please send mail to +<SAMP>`gnu-translation@prep.ai.mit.edu'</SAMP> indicating what language(s) +you can work on. +</BLOCKQUOTE> + +<P> +This document should answer many questions for those who are curious +about the process or would like to contribute. Please at least skim +over it, hoping to cut down a little of the high volume of e-mail +generated by this collective effort towards GNU internationalization. + +</P> +<P> +Most free programming which is widely shared is done in English, and +currently, English is used as the main communicating language between +national communities collaborating to the GNU project. This very document +is written in English. This will not change in the foreseeable future. + +</P> +<P> +However, there is a strong appetite from national communities for +having more software able to write using national language and habits, +and there is an on-going effort to modify GNU software in such a way +that it becomes able to do so. The experiments driven so far raised +an enthusiastic response from pretesters, so we believe that GNU +internationalization is dedicated to succeed. + +</P> +<P> +For suggestion clarifications, additions or corrections to this +document, please e-mail to <TT>`gnu-translation@prep.ai.mit.edu'</TT>. + +</P> + + +<H2><A NAME="SEC59" HREF="gettext_toc.html#TOC59">Discussions</A></H2> + +<P> +Facing this internationalization effort, a few users expressed their +concerns. Some of these doubts are presented and discussed, here. + +</P> + +<UL> +<LI>Smaller groups + +Some languages are not spoken by a very large number of people, so people +speaking them sometimes consider that there may not be all that much +demand such versions of free software packages. Moreover, many people +being <EM>into computers</EM>, in some countries, generally seem to prefer +English versions of their software. + +On the other end, people might enjoy their own language a lot, and be +very motivated at providing to themselves the pleasure of having their +beloved free software speaking their mother tongue. They do themselves +a personal favor, and do not pay that much attention to the number of +people beneficiating of their work. + +<LI>Misinterpretation + +Other users are shy to push forward their own language, seeing in this +some kind of misplaced propaganda. Someone thought there must be some +users of the language over the networks pestering other people with it. + +But any spoken language is worth localization, because there are +people behind the language for whom the language is important and +dear to their hearts. + +<LI>Odd translations + +The biggest problem is to find the right translations so that +everybody can understand the messages. Translations are usually a +little odd. Some people get used to English, to the extent they may +find translations into their own language "rather pushy, obnoxious +and sometimes even hilarious." As a French speaking man, I have +the experience of those instruction manuals for goods, so poorly +translated in French in Korea or Taiwan... + +The fact is that we sometimes have to create a kind of national +computer culture, and this is not easy without the collaboration of +many people liking their mother tongue. This is why translations are +better achieved by people knowing and loving their own language, and +ready to work together at improving the results they obtain. + +<LI>Dependencies over the GPL + +Some people wonder if using GNU <CODE>gettext</CODE> necessarily brings their package +under the protective wing of the GNU General Public License, when they +do not want to make their program free, or want other kinds of freedom. +The simplest answer is yes. + +The mere marking of localizable strings in a package, or conditional +inclusion of a few lines for initialization, is not really including +GPL'ed code. However, the localization routines themselves are under +the GPL and would bring the remainder of the package under the GPL +if they were distributed with it. So, I presume that, for those +for which this is a problem, it could be circumvented by letting to +the end installers the burden of assembling a package prepared for +localization, but not providing the localization routines themselves. + +</UL> + + + +<H2><A NAME="SEC60" HREF="gettext_toc.html#TOC60">Organization</A></H2> + +<P> +On a larger scale, the true solution would be to organize some kind of +fairly precise set up in which volunteers could participate. I gave +some thought to this idea lately, and realize there will be some +touchy points. I thought of writing to Richard Stallman to launch +such a project, but feel it might be good to shake out the ideas +between ourselves first. Most probably that Linux International has +some experience in the field already, or would like to orchestrate +the volunteer work, maybe. Food for thought, in any case! + +</P> +<P> +I guess we have to setup something early, somehow, that will help +many possible contributors of the same language to interlock and avoid +work duplication, and further be put in contact for solving together +problems particular to their tongue (in most languages, there are many +difficulties peculiar to translating technical English). My Swedish +contributor acknowledged these difficulties, and I'm well aware of +them for French. + +</P> +<P> +This is surely not a technical issue, but we should manage so the +effort of locale contributors be maximally useful, despite the national +team layer interface between contributors and maintainers. + +</P> +<P> +The Translation Project needs some setup for coordinating language +coordinators. Localizing evolving programs will surely +become a permanent and continuous activity in the free software community, +once well started. +The setup should be minimally completed and tested before GNU +<CODE>gettext</CODE> becomes an official reality. The e-mail address +<TT>`translation@iro.umontreal.ca'</TT> has been setup for receiving +offers from volunteers and general e-mail on these topics. This address +reaches the Translation Project coordinator. + +</P> + + + +<H3><A NAME="SEC61" HREF="gettext_toc.html#TOC61">Central Coordination</A></H3> + +<P> +I also think GNU will need sooner than it thinks, that someone setup +a way to organize and coordinate these groups. Some kind of group +of groups. My opinion is that it would be good that GNU delegates +this task to a small group of collaborating volunteers, shortly. +Perhaps in <TT>`gnu.announce'</TT> a list of this national committee's +can be published. + +</P> +<P> +My role as coordinator would simply be to refer to Ulrich any German +speaking volunteer interested to localization of free software packages, and +maybe helping national groups to initially organize, while maintaining +national registries for until national groups are ready to take over. +In fact, the coordinator should ease volunteers to get in contact with +one another for creating national teams, which should then select +one coordinator per language, or country (regionalized language). +If well done, the coordination should be useful without being an +overwhelming task, the time to put delegations in place. + +</P> + + +<H3><A NAME="SEC62" HREF="gettext_toc.html#TOC62">National Teams</A></H3> + +<P> +I suggest we look for volunteer coordinators/editors for individual +languages. These people will scan contributions of translation files +for various programs, for their own languages, and will ensure high +and uniform standards of diction. + +</P> +<P> +From my current experience with other people in these days, those who +provide localizations are very enthusiastic about the process, and are +more interested in the localization process than in the program they +localize, and want to do many programs, not just one. This seems +to confirm that having a coordinator/editor for each language is a +good idea. + +</P> +<P> +We need to choose someone who is good at writing clear and concise +prose in the language in question. That is hard--we can't check +it ourselves. So we need to ask a few people to judge each others' +writing and select the one who is best. + +</P> +<P> +I announce my prerelease to a few dozen people, and you would not +believe all the discussions it generated already. I shudder to think +what will happen when this will be launched, for true, officially, +world wide. Who am I to arbitrate between two Czekolsovak users +contradicting each other, for example? + +</P> +<P> +I assume that your German is not much better than my French so that +I would not be able to judge about these formulations. What I would +suggest is that for each language there is a group for people who +maintain the PO files and judge about changes. I suspect there will +be cultural differences between how such groups of people will behave. +Some will have relaxed ways, reach consensus easily, and have anyone +of the group relate to the maintainers, while others will fight to +death, organize heavy administrations up to national standards, and +use strict channels. + +</P> +<P> +The German team is putting out a good example. Right now, they are +maybe half a dozen people revising translations of each other and +discussing the linguistic issues. I do not even have all the names. +Ulrich Drepper is taking care of coordinating the German team. +He subscribed to all my pretest lists, so I do not even have to warn +him specifically of incoming releases. + +</P> +<P> +I'm sure, that is a good idea to get teams for each language working +on translations. That will make the translations better and more +consistent. + +</P> + + + +<H4><A NAME="SEC63" HREF="gettext_toc.html#TOC63">Sub-Cultures</A></H4> + +<P> +Taking French for example, there are a few sub-cultures around computers +which developed diverging vocabularies. Picking volunteers here and +there without addressing this problem in an organized way, soon in the +project, might produce a distasteful mix of internationalized programs, +and possibly trigger endless quarrels among those who really care. + +</P> +<P> +Keeping some kind of unity in the way French localization of +internationalized programs is achieved is a difficult (and delicate) job. +Knowing the latin character of French people (:-), if we take this +the wrong way, we could end up nowhere, or spoil a lot of energies. +Maybe we should begin to address this problem seriously <EM>before</EM> +GNU <CODE>gettext</CODE> become officially published. And I suspect that this +means soon! + +</P> + + +<H4><A NAME="SEC64" HREF="gettext_toc.html#TOC64">Organizational Ideas</A></H4> + +<P> +I expect the next big changes after the official release. Please note +that I use the German translation of the short GPL message. We need +to set a few good examples before the localization goes out for true +in the free software community. Here are a few points to discuss: + +</P> + +<UL> +<LI> + +Each group should have one FTP server (at least one master). + +<LI> + +The files on the server should reflect the latest version (of +course!) and it should also contain a RCS directory with the +corresponding archives (I don't have this now). + +<LI> + +There should also be a ChangeLog file (this is more useful than the +RCS archive but can be generated automatically from the later by +Emacs). + +<LI> + +A <STRONG>core group</STRONG> should judge about questionable changes (for now +this group consists solely by me but I ask some others occasionally; +this also seems to work). + +</UL> + + + +<H3><A NAME="SEC65" HREF="gettext_toc.html#TOC65">Mailing Lists</A></H3> + +<P> +If we get any inquiries about GNU <CODE>gettext</CODE>, send them on to: + +</P> + +<PRE> +<TT>`translation@iro.umontreal.ca'</TT> +</PRE> + +<P> +The <TT>`*-pretest'</TT> lists are quite useful to me, maybe the idea could +be generalized to many GNU, and non-GNU packages. But each maintainer +his/her way! + +</P> +<P> +Fran@,{c}ois, we have a mechanism in place here at +<TT>`gnu.ai.mit.edu'</TT> to track teams, support mailing lists for +them and log members. We have a slight preference that you use it. +If this is OK with you, I can get you clued in. + +</P> +<P> +Things are changing! A few years ago, when Daniel Fekete and I +asked for a mailing list for GNU localization, nested at the FSF, we +were politely invited to organize it anywhere else, and so did we. +For communicating with my pretesters, I later made a handful of +mailing lists located at iro.umontreal.ca and administrated by +<CODE>majordomo</CODE>. These lists have been <EM>very</EM> dependable +so far... + +</P> +<P> +I suspect that the German team will organize itself a mailing list +located in Germany, and so forth for other countries. But before they +organize for true, it could surely be useful to offer mailing lists +located at the FSF to each national team. So yes, please explain me +how I should proceed to create and handle them. + +</P> +<P> +We should create temporary mailing lists, one per country, to help +people organize. Temporary, because once regrouped and structured, it +would be fair the volunteers from country bring back <EM>their</EM> list +in there and manage it as they want. My feeling is that, in the long +run, each team should run its own list, from within their country. +There also should be some central list to which all teams could +subscribe as they see fit, as long as each team is represented in it. + +</P> + + +<H2><A NAME="SEC66" HREF="gettext_toc.html#TOC66">Information Flow</A></H2> + +<P> +There will surely be some discussion about this messages after the +packages are finally released. If people now send you some proposals +for better messages, how do you proceed? Jim, please note that +right now, as I put forward nearly a dozen of localizable programs, I +receive both the translations and the coordination concerns about them. + +</P> +<P> +If I put one of my things to pretest, Ulrich receives the announcement +and passes it on to the German team, who make last minute revisions. +Then he submits the translation files to me <EM>as the maintainer</EM>. +For free packages I do not maintain, I would not even hear about it. +This scheme could be made to work for the whole Translation Project, +I think. For security reasons, maybe Ulrich (national coordinators, +in fact) should update central registry kept at the Translation Project +(Jim, me, or Len's recruits) once in a while. + +</P> +<P> +In December/January, I was aggressively ready to internationalize +all of GNU, giving myself the duty of one small GNU package per week +or so, taking many weeks or months for bigger packages. But it does +not work this way. I first did all the things I'm responsible for. +I've nothing against some missionary work on other maintainers, but +I'm also loosing a lot of energy over it--same debates over again. + +</P> +<P> +And when the first localized packages are released we'll get a lot of +responses about ugly translations :-). Surely, and we need to have +beforehand a fairly good idea about how to handle the information +flow between the national teams and the package maintainers. + +</P> +<P> +Please start saving somewhere a quick history of each PO file. I know +for sure that the file format will change, allowing for comments. +It would be nice that each file has a kind of log, and references for +those who want to submit comments or gripes, or otherwise contribute. +I sent a proposal for a fast and flexible format, but it is not +receiving acceptance yet by the GNU deciders. I'll tell you when I +have more information about this. + +</P> +<P><HR><P> +<p>Go to the <A HREF="gettext_1.html">first</A>, <A HREF="gettext_8.html">previous</A>, <A HREF="gettext_10.html">next</A>, <A HREF="gettext_12.html">last</A> section, <A HREF="gettext_toc.html">table of contents</A>. +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_foot.html b/docs/html/gettext/gettext_foot.html new file mode 100644 index 0000000000..2e742b9ad9 --- /dev/null +++ b/docs/html/gettext/gettext_foot.html @@ -0,0 +1,35 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - Footnotes</TITLE> + +</HEAD> +<BODY> +<H1>GNU gettext tools, version 0.10.35</H1> +<H2>Native Language Support Library and Tools</H2> +<H2>Edition 0.10.35, 1 May 1998</H2> +<ADDRESS>Ulrich Drepper</ADDRESS> +<ADDRESS>Jim Meyering</ADDRESS> +<ADDRESS>Fran@,{c}ois Pinard</ADDRESS> +<P> +<P><HR><P> +<H3><A NAME="FOOT1" HREF="gettext_2.html#DOCF1">(1)</A></H3> +<P>This +limitation is not imposed by GNU <CODE>gettext</CODE>, but comes from the +<CODE>msgfmt</CODE> implementation on Solaris. +<H3><A NAME="FOOT2" HREF="gettext_8.html#DOCF2">(2)</A></H3> +<P>Some +system, eg Ultrix, don't have <CODE>LC_MESSAGES</CODE>. Here we use a more or +less arbitrary value for it. +<H3><A NAME="FOOT3" HREF="gettext_8.html#DOCF3">(3)</A></H3> +<P>When the system does not support +<CODE>setlocale</CODE> its behavior in setting the locale values is simulated +by looking at the environment variables. +<P><HR><P> +This document was generated on 25 January 1999 using the +<A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A> +translator version 1.51a.</P> +</BODY> +</HTML> diff --git a/docs/html/gettext/gettext_toc.html b/docs/html/gettext/gettext_toc.html new file mode 100644 index 0000000000..c2d8d36831 --- /dev/null +++ b/docs/html/gettext/gettext_toc.html @@ -0,0 +1,143 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - Table of Contents</TITLE> + +</HEAD> +<BODY> +<H1>GNU gettext tools, version 0.10.35</H1> +<H2>Native Language Support Library and Tools</H2> +<H2>Edition 0.10.35, 1 May 1998</H2> +<ADDRESS>Ulrich Drepper</ADDRESS> +<ADDRESS>Jim Meyering</ADDRESS> +<ADDRESS>Fran@,{c}ois Pinard</ADDRESS> +<P> +<P><HR><P> + +</P> + +<UL> +<LI><A NAME="TOC1" HREF="gettext_1.html#SEC1">Introduction</A> +<UL> +<LI><A NAME="TOC2" HREF="gettext_1.html#SEC2">The Purpose of GNU <CODE>gettext</CODE></A> +<LI><A NAME="TOC3" HREF="gettext_1.html#SEC3">I18n, L10n, and Such</A> +<LI><A NAME="TOC4" HREF="gettext_1.html#SEC4">Aspects in Native Language Support</A> +<LI><A NAME="TOC5" HREF="gettext_1.html#SEC5">Files Conveying Translations</A> +<LI><A NAME="TOC6" HREF="gettext_1.html#SEC6">Overview of GNU <CODE>gettext</CODE></A> +</UL> +<LI><A NAME="TOC7" HREF="gettext_2.html#SEC7">PO Files and PO Mode Basics</A> +<UL> +<LI><A NAME="TOC8" HREF="gettext_2.html#SEC8">Completing GNU <CODE>gettext</CODE> Installation</A> +<LI><A NAME="TOC9" HREF="gettext_2.html#SEC9">The Format of PO Files</A> +<LI><A NAME="TOC10" HREF="gettext_2.html#SEC10">Main PO mode Commands</A> +<LI><A NAME="TOC11" HREF="gettext_2.html#SEC11">Entry Positioning</A> +<LI><A NAME="TOC12" HREF="gettext_2.html#SEC12">Normalizing Strings in Entries</A> +</UL> +<LI><A NAME="TOC13" HREF="gettext_3.html#SEC13">Preparing Program Sources</A> +<UL> +<LI><A NAME="TOC14" HREF="gettext_3.html#SEC14">Triggering <CODE>gettext</CODE> Operations</A> +<LI><A NAME="TOC15" HREF="gettext_3.html#SEC15">How Marks Appears in Sources</A> +<LI><A NAME="TOC16" HREF="gettext_3.html#SEC16">Marking Translatable Strings</A> +<LI><A NAME="TOC17" HREF="gettext_3.html#SEC17">Special Comments preceding Keywords</A> +<LI><A NAME="TOC18" HREF="gettext_3.html#SEC18">Special Cases of Translatable Strings</A> +</UL> +<LI><A NAME="TOC19" HREF="gettext_4.html#SEC19">Making the Initial PO File</A> +<UL> +<LI><A NAME="TOC20" HREF="gettext_4.html#SEC20">Invoking the <CODE>xgettext</CODE> Program</A> +<LI><A NAME="TOC21" HREF="gettext_4.html#SEC21">C Sources Context</A> +<LI><A NAME="TOC22" HREF="gettext_4.html#SEC22">Using Translation Compendiums</A> +</UL> +<LI><A NAME="TOC23" HREF="gettext_5.html#SEC23">Updating Existing PO Files</A> +<UL> +<LI><A NAME="TOC24" HREF="gettext_5.html#SEC24">Invoking the <CODE>msgmerge</CODE> Program</A> +<LI><A NAME="TOC25" HREF="gettext_5.html#SEC25">Translated Entries</A> +<LI><A NAME="TOC26" HREF="gettext_5.html#SEC26">Fuzzy Entries</A> +<LI><A NAME="TOC27" HREF="gettext_5.html#SEC27">Untranslated Entries</A> +<LI><A NAME="TOC28" HREF="gettext_5.html#SEC28">Obsolete Entries</A> +<LI><A NAME="TOC29" HREF="gettext_5.html#SEC29">Modifying Translations</A> +<LI><A NAME="TOC30" HREF="gettext_5.html#SEC30">Modifying Comments</A> +<LI><A NAME="TOC31" HREF="gettext_5.html#SEC31">Consulting Auxiliary PO Files</A> +</UL> +<LI><A NAME="TOC32" HREF="gettext_6.html#SEC32">Producing Binary MO Files</A> +<UL> +<LI><A NAME="TOC33" HREF="gettext_6.html#SEC33">Invoking the <CODE>msgfmt</CODE> Program</A> +<LI><A NAME="TOC34" HREF="gettext_6.html#SEC34">The Format of GNU MO Files</A> +</UL> +<LI><A NAME="TOC35" HREF="gettext_7.html#SEC35">The User's View</A> +<UL> +<LI><A NAME="TOC36" HREF="gettext_7.html#SEC36">The Current <TT>`ABOUT-NLS'</TT> Matrix</A> +<LI><A NAME="TOC37" HREF="gettext_7.html#SEC37">Magic for Installers</A> +<LI><A NAME="TOC38" HREF="gettext_7.html#SEC38">Magic for End Users</A> +</UL> +<LI><A NAME="TOC39" HREF="gettext_8.html#SEC39">The Programmer's View</A> +<UL> +<LI><A NAME="TOC40" HREF="gettext_8.html#SEC40">About <CODE>catgets</CODE></A> +<UL> +<LI><A NAME="TOC41" HREF="gettext_8.html#SEC41">The Interface</A> +<LI><A NAME="TOC42" HREF="gettext_8.html#SEC42">Problems with the <CODE>catgets</CODE> Interface?!</A> +</UL> +<LI><A NAME="TOC43" HREF="gettext_8.html#SEC43">About <CODE>gettext</CODE></A> +<UL> +<LI><A NAME="TOC44" HREF="gettext_8.html#SEC44">The Interface</A> +<LI><A NAME="TOC45" HREF="gettext_8.html#SEC45">Solving Ambiguities</A> +<LI><A NAME="TOC46" HREF="gettext_8.html#SEC46">Locating Message Catalog Files</A> +<LI><A NAME="TOC47" HREF="gettext_8.html#SEC47">Optimization of the *gettext functions</A> +</UL> +<LI><A NAME="TOC48" HREF="gettext_8.html#SEC48">Comparing the Two Interfaces</A> +<LI><A NAME="TOC49" HREF="gettext_8.html#SEC49">Using libintl.a in own programs</A> +<LI><A NAME="TOC50" HREF="gettext_8.html#SEC50">Being a <CODE>gettext</CODE> grok</A> +<LI><A NAME="TOC51" HREF="gettext_8.html#SEC51">Temporary Notes for the Programmers Chapter</A> +<UL> +<LI><A NAME="TOC52" HREF="gettext_8.html#SEC52">Temporary - Two Possible Implementations</A> +<LI><A NAME="TOC53" HREF="gettext_8.html#SEC53">Temporary - About <CODE>catgets</CODE></A> +<LI><A NAME="TOC54" HREF="gettext_8.html#SEC54">Temporary - Why a single implementation</A> +<LI><A NAME="TOC55" HREF="gettext_8.html#SEC55">Temporary - Notes</A> +</UL> +</UL> +<LI><A NAME="TOC56" HREF="gettext_9.html#SEC56">The Translator's View</A> +<UL> +<LI><A NAME="TOC57" HREF="gettext_9.html#SEC57">Introduction 0</A> +<LI><A NAME="TOC58" HREF="gettext_9.html#SEC58">Introduction 1</A> +<LI><A NAME="TOC59" HREF="gettext_9.html#SEC59">Discussions</A> +<LI><A NAME="TOC60" HREF="gettext_9.html#SEC60">Organization</A> +<UL> +<LI><A NAME="TOC61" HREF="gettext_9.html#SEC61">Central Coordination</A> +<LI><A NAME="TOC62" HREF="gettext_9.html#SEC62">National Teams</A> +<UL> +<LI><A NAME="TOC63" HREF="gettext_9.html#SEC63">Sub-Cultures</A> +<LI><A NAME="TOC64" HREF="gettext_9.html#SEC64">Organizational Ideas</A> +</UL> +<LI><A NAME="TOC65" HREF="gettext_9.html#SEC65">Mailing Lists</A> +</UL> +<LI><A NAME="TOC66" HREF="gettext_9.html#SEC66">Information Flow</A> +</UL> +<LI><A NAME="TOC67" HREF="gettext_10.html#SEC67">The Maintainer's View</A> +<UL> +<LI><A NAME="TOC68" HREF="gettext_10.html#SEC68">Flat or Non-Flat Directory Structures</A> +<LI><A NAME="TOC69" HREF="gettext_10.html#SEC69">Prerequisite Works</A> +<LI><A NAME="TOC70" HREF="gettext_10.html#SEC70">Invoking the <CODE>gettextize</CODE> Program</A> +<LI><A NAME="TOC71" HREF="gettext_10.html#SEC71">Files You Must Create or Alter</A> +<UL> +<LI><A NAME="TOC72" HREF="gettext_10.html#SEC72"><TT>`POTFILES.in'</TT> in <TT>`po/'</TT></A> +<LI><A NAME="TOC73" HREF="gettext_10.html#SEC73"><TT>`configure.in'</TT> at top level</A> +<LI><A NAME="TOC74" HREF="gettext_10.html#SEC74"><TT>`aclocal.m4'</TT> at top level</A> +<LI><A NAME="TOC75" HREF="gettext_10.html#SEC75"><TT>`acconfig.h'</TT> at top level</A> +<LI><A NAME="TOC76" HREF="gettext_10.html#SEC76"><TT>`Makefile.in'</TT> at top level</A> +<LI><A NAME="TOC77" HREF="gettext_10.html#SEC77"><TT>`Makefile.in'</TT> in <TT>`src/'</TT></A> +</UL> +</UL> +<LI><A NAME="TOC78" HREF="gettext_11.html#SEC78">Concluding Remarks</A> +<UL> +<LI><A NAME="TOC79" HREF="gettext_11.html#SEC79">History of GNU <CODE>gettext</CODE></A> +<LI><A NAME="TOC80" HREF="gettext_11.html#SEC80">Related Readings</A> +</UL> +<LI><A NAME="TOC81" HREF="gettext_12.html#SEC81">Country Codes</A> +</UL> +<P><HR><P> +This document was generated on 25 January 1999 using the +<A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A> +translator version 1.51a.</P> +</BODY> +</HTML> diff --git a/docs/html/gettext/index.html b/docs/html/gettext/index.html new file mode 100644 index 0000000000..c2d8d36831 --- /dev/null +++ b/docs/html/gettext/index.html @@ -0,0 +1,143 @@ +<HTML> +<HEAD> +<!-- This HTML file has been created by texi2html 1.54 + from gettext.texi on 25 January 1999 --> + +<TITLE>GNU gettext utilities - Table of Contents</TITLE> + +</HEAD> +<BODY> +<H1>GNU gettext tools, version 0.10.35</H1> +<H2>Native Language Support Library and Tools</H2> +<H2>Edition 0.10.35, 1 May 1998</H2> +<ADDRESS>Ulrich Drepper</ADDRESS> +<ADDRESS>Jim Meyering</ADDRESS> +<ADDRESS>Fran@,{c}ois Pinard</ADDRESS> +<P> +<P><HR><P> + +</P> + +<UL> +<LI><A NAME="TOC1" HREF="gettext_1.html#SEC1">Introduction</A> +<UL> +<LI><A NAME="TOC2" HREF="gettext_1.html#SEC2">The Purpose of GNU <CODE>gettext</CODE></A> +<LI><A NAME="TOC3" HREF="gettext_1.html#SEC3">I18n, L10n, and Such</A> +<LI><A NAME="TOC4" HREF="gettext_1.html#SEC4">Aspects in Native Language Support</A> +<LI><A NAME="TOC5" HREF="gettext_1.html#SEC5">Files Conveying Translations</A> +<LI><A NAME="TOC6" HREF="gettext_1.html#SEC6">Overview of GNU <CODE>gettext</CODE></A> +</UL> +<LI><A NAME="TOC7" HREF="gettext_2.html#SEC7">PO Files and PO Mode Basics</A> +<UL> +<LI><A NAME="TOC8" HREF="gettext_2.html#SEC8">Completing GNU <CODE>gettext</CODE> Installation</A> +<LI><A NAME="TOC9" HREF="gettext_2.html#SEC9">The Format of PO Files</A> +<LI><A NAME="TOC10" HREF="gettext_2.html#SEC10">Main PO mode Commands</A> +<LI><A NAME="TOC11" HREF="gettext_2.html#SEC11">Entry Positioning</A> +<LI><A NAME="TOC12" HREF="gettext_2.html#SEC12">Normalizing Strings in Entries</A> +</UL> +<LI><A NAME="TOC13" HREF="gettext_3.html#SEC13">Preparing Program Sources</A> +<UL> +<LI><A NAME="TOC14" HREF="gettext_3.html#SEC14">Triggering <CODE>gettext</CODE> Operations</A> +<LI><A NAME="TOC15" HREF="gettext_3.html#SEC15">How Marks Appears in Sources</A> +<LI><A NAME="TOC16" HREF="gettext_3.html#SEC16">Marking Translatable Strings</A> +<LI><A NAME="TOC17" HREF="gettext_3.html#SEC17">Special Comments preceding Keywords</A> +<LI><A NAME="TOC18" HREF="gettext_3.html#SEC18">Special Cases of Translatable Strings</A> +</UL> +<LI><A NAME="TOC19" HREF="gettext_4.html#SEC19">Making the Initial PO File</A> +<UL> +<LI><A NAME="TOC20" HREF="gettext_4.html#SEC20">Invoking the <CODE>xgettext</CODE> Program</A> +<LI><A NAME="TOC21" HREF="gettext_4.html#SEC21">C Sources Context</A> +<LI><A NAME="TOC22" HREF="gettext_4.html#SEC22">Using Translation Compendiums</A> +</UL> +<LI><A NAME="TOC23" HREF="gettext_5.html#SEC23">Updating Existing PO Files</A> +<UL> +<LI><A NAME="TOC24" HREF="gettext_5.html#SEC24">Invoking the <CODE>msgmerge</CODE> Program</A> +<LI><A NAME="TOC25" HREF="gettext_5.html#SEC25">Translated Entries</A> +<LI><A NAME="TOC26" HREF="gettext_5.html#SEC26">Fuzzy Entries</A> +<LI><A NAME="TOC27" HREF="gettext_5.html#SEC27">Untranslated Entries</A> +<LI><A NAME="TOC28" HREF="gettext_5.html#SEC28">Obsolete Entries</A> +<LI><A NAME="TOC29" HREF="gettext_5.html#SEC29">Modifying Translations</A> +<LI><A NAME="TOC30" HREF="gettext_5.html#SEC30">Modifying Comments</A> +<LI><A NAME="TOC31" HREF="gettext_5.html#SEC31">Consulting Auxiliary PO Files</A> +</UL> +<LI><A NAME="TOC32" HREF="gettext_6.html#SEC32">Producing Binary MO Files</A> +<UL> +<LI><A NAME="TOC33" HREF="gettext_6.html#SEC33">Invoking the <CODE>msgfmt</CODE> Program</A> +<LI><A NAME="TOC34" HREF="gettext_6.html#SEC34">The Format of GNU MO Files</A> +</UL> +<LI><A NAME="TOC35" HREF="gettext_7.html#SEC35">The User's View</A> +<UL> +<LI><A NAME="TOC36" HREF="gettext_7.html#SEC36">The Current <TT>`ABOUT-NLS'</TT> Matrix</A> +<LI><A NAME="TOC37" HREF="gettext_7.html#SEC37">Magic for Installers</A> +<LI><A NAME="TOC38" HREF="gettext_7.html#SEC38">Magic for End Users</A> +</UL> +<LI><A NAME="TOC39" HREF="gettext_8.html#SEC39">The Programmer's View</A> +<UL> +<LI><A NAME="TOC40" HREF="gettext_8.html#SEC40">About <CODE>catgets</CODE></A> +<UL> +<LI><A NAME="TOC41" HREF="gettext_8.html#SEC41">The Interface</A> +<LI><A NAME="TOC42" HREF="gettext_8.html#SEC42">Problems with the <CODE>catgets</CODE> Interface?!</A> +</UL> +<LI><A NAME="TOC43" HREF="gettext_8.html#SEC43">About <CODE>gettext</CODE></A> +<UL> +<LI><A NAME="TOC44" HREF="gettext_8.html#SEC44">The Interface</A> +<LI><A NAME="TOC45" HREF="gettext_8.html#SEC45">Solving Ambiguities</A> +<LI><A NAME="TOC46" HREF="gettext_8.html#SEC46">Locating Message Catalog Files</A> +<LI><A NAME="TOC47" HREF="gettext_8.html#SEC47">Optimization of the *gettext functions</A> +</UL> +<LI><A NAME="TOC48" HREF="gettext_8.html#SEC48">Comparing the Two Interfaces</A> +<LI><A NAME="TOC49" HREF="gettext_8.html#SEC49">Using libintl.a in own programs</A> +<LI><A NAME="TOC50" HREF="gettext_8.html#SEC50">Being a <CODE>gettext</CODE> grok</A> +<LI><A NAME="TOC51" HREF="gettext_8.html#SEC51">Temporary Notes for the Programmers Chapter</A> +<UL> +<LI><A NAME="TOC52" HREF="gettext_8.html#SEC52">Temporary - Two Possible Implementations</A> +<LI><A NAME="TOC53" HREF="gettext_8.html#SEC53">Temporary - About <CODE>catgets</CODE></A> +<LI><A NAME="TOC54" HREF="gettext_8.html#SEC54">Temporary - Why a single implementation</A> +<LI><A NAME="TOC55" HREF="gettext_8.html#SEC55">Temporary - Notes</A> +</UL> +</UL> +<LI><A NAME="TOC56" HREF="gettext_9.html#SEC56">The Translator's View</A> +<UL> +<LI><A NAME="TOC57" HREF="gettext_9.html#SEC57">Introduction 0</A> +<LI><A NAME="TOC58" HREF="gettext_9.html#SEC58">Introduction 1</A> +<LI><A NAME="TOC59" HREF="gettext_9.html#SEC59">Discussions</A> +<LI><A NAME="TOC60" HREF="gettext_9.html#SEC60">Organization</A> +<UL> +<LI><A NAME="TOC61" HREF="gettext_9.html#SEC61">Central Coordination</A> +<LI><A NAME="TOC62" HREF="gettext_9.html#SEC62">National Teams</A> +<UL> +<LI><A NAME="TOC63" HREF="gettext_9.html#SEC63">Sub-Cultures</A> +<LI><A NAME="TOC64" HREF="gettext_9.html#SEC64">Organizational Ideas</A> +</UL> +<LI><A NAME="TOC65" HREF="gettext_9.html#SEC65">Mailing Lists</A> +</UL> +<LI><A NAME="TOC66" HREF="gettext_9.html#SEC66">Information Flow</A> +</UL> +<LI><A NAME="TOC67" HREF="gettext_10.html#SEC67">The Maintainer's View</A> +<UL> +<LI><A NAME="TOC68" HREF="gettext_10.html#SEC68">Flat or Non-Flat Directory Structures</A> +<LI><A NAME="TOC69" HREF="gettext_10.html#SEC69">Prerequisite Works</A> +<LI><A NAME="TOC70" HREF="gettext_10.html#SEC70">Invoking the <CODE>gettextize</CODE> Program</A> +<LI><A NAME="TOC71" HREF="gettext_10.html#SEC71">Files You Must Create or Alter</A> +<UL> +<LI><A NAME="TOC72" HREF="gettext_10.html#SEC72"><TT>`POTFILES.in'</TT> in <TT>`po/'</TT></A> +<LI><A NAME="TOC73" HREF="gettext_10.html#SEC73"><TT>`configure.in'</TT> at top level</A> +<LI><A NAME="TOC74" HREF="gettext_10.html#SEC74"><TT>`aclocal.m4'</TT> at top level</A> +<LI><A NAME="TOC75" HREF="gettext_10.html#SEC75"><TT>`acconfig.h'</TT> at top level</A> +<LI><A NAME="TOC76" HREF="gettext_10.html#SEC76"><TT>`Makefile.in'</TT> at top level</A> +<LI><A NAME="TOC77" HREF="gettext_10.html#SEC77"><TT>`Makefile.in'</TT> in <TT>`src/'</TT></A> +</UL> +</UL> +<LI><A NAME="TOC78" HREF="gettext_11.html#SEC78">Concluding Remarks</A> +<UL> +<LI><A NAME="TOC79" HREF="gettext_11.html#SEC79">History of GNU <CODE>gettext</CODE></A> +<LI><A NAME="TOC80" HREF="gettext_11.html#SEC80">Related Readings</A> +</UL> +<LI><A NAME="TOC81" HREF="gettext_12.html#SEC81">Country Codes</A> +</UL> +<P><HR><P> +This document was generated on 25 January 1999 using the +<A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A> +translator version 1.51a.</P> +</BODY> +</HTML> diff --git a/docs/html/gettext/msgfmt.htm b/docs/html/gettext/msgfmt.htm deleted file mode 100644 index 7c4834163a..0000000000 --- a/docs/html/gettext/msgfmt.htm +++ /dev/null @@ -1,222 +0,0 @@ -<!-- manual page source format generated by PolyglotMan v3.0.3a12, --> -<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z --> - -<HTML> -<HEAD> -<TITLE>msgfmt(1) manual page</TITLE> -</HEAD> -<BODY> -<A HREF="#toc">Table of Contents</A><P> - -<H2><A NAME="sect0" HREF="#toc0">NAME </A></H2> -msgfmt - create a message object from a message file -<H2><A NAME="sect1" HREF="#toc1">SYNOPSIS -</A></H2> -<B>msgfmt</B> [ <B>-v</B> ] [ <B>-o</B><I> output-file</I> ] ... -<H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2> -<P> -<B>msgfmt</B> creates message -object files from portable object files (<I>filename<B>.po </B></I>), without changing -the portable object files. <P> -The <B>.po </B> file contains messages displayed to -users by system commands or by application programs. <B>.po</B> files can be edited, -and the messages in them can be rewritten in any language supported by -the system. <P> -The <B><A HREF="http://hoth.stsci.edu/man/man1/xgettext.html">xgettext</B>(1)</A> - command can be used to create <B>.po</B> files from -script or programs. <P> -<B>msgfmt</B> interprets data as characters according to the -current setting of the <FONT SIZE=-1><B>LC_CTYPE </B></FONT> - locale category. -<H3><A NAME="sect3" HREF="#toc3">Portable Object Files -</A></H3> - <P> -Formats for all <B>.po</B> files are the same. Each <B>.po</B> file contains one or -more lines, with each line containing either a comment or a statement. -Comments start the line with a hash mark (#) and end with the newline -character. All comments are ignored. The format of a statement is: -<DL> - -<DT><I>directive</I> -value </DT> -<DD></DD> -</DL> -<P> -Each directive starts at the beginning of the line and is separated -from <I>value</I> by white space (such as one or more space or tab characters). -<I>value</I> consists of one or more quoted strings separated by white space. -Use any of the following types of directives: <P> - <blockquote><B>domain</B> <I>domainname</I> <BR> -<B>msgid</B> -<I>message_identifier</I> <BR> -<B>msgstr</B> <I>message_string</I> </blockquote> -<P> -The behavior of the <B>domain</B> -directive is affected by the options used. See <FONT SIZE=-1>OPTIONS</FONT> - for the behavior -when the <B>-o</B> option is specified. If the <B>-o</B> option is not specified, the -behavior of the <B>domain</B> directive is as follows: <blockquote> -<UL> -·<LI>All <I>msgids</I> from the beginning -of each <B>.po</B> file to the first domain directive are put into a default -message object file, <B>messages.mo</B>. </LI>·<LI>When <B>msgfmt</B> encounters a <B>domain</B><I> domainname</I> -directive in the <B>.po</B> file, all following <I>msgids</I> until the next <B>domain</B> directive -are put into the message object file </LI>·<LI>Duplicate <I>msgids</I> are defined in -the scope of each domain. That is, a <I>msgid</I> is considered a duplicate only -if the identical <I>msgid</I> exists in the same domain. </LI>·<LI>All duplicate <I>msgids</I> -are ignored. </LI> -</UL> - </blockquote> -<P> -The <B>msgid</B> directive specifies the value of a message identifier -associated with the directive that follows it. The <I>message_identifier</I> string -identifies a target string to be used at retrieval time. Each statement -containing a <B>msgid</B> directive must be followed by a statement containing -a <B>msgstr</B> directive. <P> -The <B>msgstr</B> directive specifies the target string associated -with the <I>message_identifier</I> string declared in the immediately preceding -<B>msgid</B> directive. <P> -Message strings can contain the escape sequences <B>\n</B> for -newline, <B>\t</B> for tab, <B>\v</B> for vertical tab, <B>\b</B> for backspace, <B>\r</B> for carriage -return, <B>\f</B> for formfeed, <B>\\</B> for backslash, \" for double quote, <B>\ddd</B> for octal -bit pattern, and <B>\xDD</B> for hexadecimal bit pattern. -<H2><A NAME="sect4" HREF="#toc4">OPTIONS </A></H2> - -<DL> - -<DT><B>-v</B> </DT> -<DD>Verbose. - List duplicate message identifiers. Message strings are not redefined. -</DD> - -<DT><B>-o</B><I> output-file</I> </DT> -<DD>Specify output file name as <I>output-file</I>. All <B>domain</B> directives -and duplicate <I>msgids</I> in the <B>.po</B> file are ignored. </DD> -</DL> - -<H2><A NAME="sect5" HREF="#toc5">EXAMPLES </A></H2> -In this example -<B>module1.po</B> and <B>module2.po</B> are portable message objects files. <P> - <blockquote> example% -cat module1.po <BR> - # default domain "messages.mo" <BR> - msgid "msg 1" <BR> - msgstr "msg -1 translation" <BR> - # <BR> - domain "help_domain" <BR> - msgid "help 2" <BR> - msgstr "help -2 translation" <BR> - # <BR> - domain "error_domain" <BR> - msgid "error 3" <BR> - msgstr "error -3 translation" <BR> - <P> - example% cat module2.po <BR> - # default domain "messages.mo" -<BR> - msgid "mesg 4" <BR> - msgstr "mesg 4 translation" <BR> - # <BR> - domain "error_domain" -<BR> - msgid "error 5" <BR> - msgstr "error 5 translation" <BR> - # <BR> - domain "window_domain" -<BR> - msgid "window 6" <BR> - msgstr "window 6 translation" <BR> - </blockquote> -<P> -The following command -will produce the output files, <B>messages.mo</B>, <B>help_domain.mo</B>, and <B>error_domain.mo</B>. - -<DL> - -<DT><B>example% msgfmt module1.po</B> </DT> -<DD></DD> -</DL> -<P> -The following command will produce the output -files, <B>messages.mo</B>, <B>help_domain.mo</B>, <B>error_domain.mo</B>, and <B>window_domain.mo</B>. - -<DL> - -<DT><B>example% msgfmt module1.po module2.po</B> </DT> -<DD></DD> -</DL> -<P> -The following example will produce -the output file <B>hello.mo</B>. -<DL> - -<DT><B>example% msgfmt -o hello.mo module1.po module2.po</B> - </DT> -<DD></DD> -</DL> -<P> -Install message object files in <B>/usr/lib/locale/</B><I>locale</I><B><FONT SIZE=-1>/LC_MESSAGES/</FONT> -</B><I>domain</I><B>.mo</B> -where <I>locale</I> is the message locale as set by <B><A HREF="http://hoth.stsci.edu/man/man3C/setlocale.html">setlocale</B>(3C)</A> -, and <I>domain</I> -is text domain as set by <B>textdomain()</B>. The <B>/usr/lib/locale</B> portion can -optionally be changed by calling <B>bindtextdomain()</B>. See <B><A HREF="http://hoth.stsci.edu/man/man3C/gettext.html">gettext</B>(3C)</A> -. -<H2><A NAME="sect6" HREF="#toc6">ENVIRONMENT -</A></H2> -See <B><A HREF="http://hoth.stsci.edu/man/man5/environ.html">environ</B>(5)</A> - for descriptions of the following environmental variables -that affect the execution of <B>msgfmt</B>: <FONT SIZE=-1><B>LC_CTYPE</FONT> - </B>, <FONT SIZE=-1><B>LC_MESSAGES</FONT> - </B>, <FONT SIZE=-1><B>NLSPATH</FONT> - -</B>. -<H2><A NAME="sect7" HREF="#toc7">ATTRIBUTES </A></H2> -See <B><A HREF="http://hoth.stsci.edu/man/man5/attributes.html">attributes</B>(5)</A> - for descriptions of the following attributes: - <P> - <TABLE BORDER=0> - <TR> <TD ALIGN=CENTER><B>ATTRIBUTE TYPE</B> </TD> <TD ALIGN=CENTER><B>ATTRIBUTE VALUE</B> </TD> </TR> - <TR> <TR> <TD ALIGN=LEFT>Availability </TD> <TD ALIGN=LEFT>SUNWloc </TD> </TR> - <TR> <TD ALIGN=LEFT>CSI -</TD> <TD ALIGN=LEFT>Enabled </TD> </TR> - </TABLE> - -<H2><A NAME="sect8" HREF="#toc8">SEE ALSO </A></H2> -<B><A HREF="http://hoth.stsci.edu/man/man1/xgettext.html">xgettext</B>(1)</A> -, <B><A HREF="http://hoth.stsci.edu/man/man3C/gettext.html">gettext</B>(3C)</A> -, <B><A HREF="http://hoth.stsci.edu/man/man3C/setlocale.html">setlocale</B>(3C)</A> -, <B><A HREF="http://hoth.stsci.edu/man/man5/attributes.html">attributes</B>(5)</A> -, -<B><A HREF="http://hoth.stsci.edu/man/man5/environ.html">environ</B>(5)</A> - -<H2><A NAME="sect9" HREF="#toc9">NOTES </A></H2> -<P> -Neither <B>msgfmt</B> nor any <B>gettext()</B> routine imposes a limit -on the total length of a message. However, each line in the <B>*.po</B> file is -limited to <FONT SIZE=-1><B>MAX_INPUT </B></FONT> - (512) bytes. <P> -Installing message catalogs under the -C locale is pointless, since they are ignored for the sake of efficiency. - <P> - -<HR><P> -<A NAME="toc"><B>Table of Contents</B></A><P> -<UL> -<LI><A NAME="toc0" HREF="#sect0">NAME</A></LI> -<LI><A NAME="toc1" HREF="#sect1">SYNOPSIS</A></LI> -<LI><A NAME="toc2" HREF="#sect2">DESCRIPTION</A></LI> -<UL> -<LI><A NAME="toc3" HREF="#sect3">Portable Object Files</A></LI> -</UL> -<LI><A NAME="toc4" HREF="#sect4">OPTIONS</A></LI> -<LI><A NAME="toc5" HREF="#sect5">EXAMPLES</A></LI> -<LI><A NAME="toc6" HREF="#sect6">ENVIRONMENT</A></LI> -<LI><A NAME="toc7" HREF="#sect7">ATTRIBUTES</A></LI> -<LI><A NAME="toc8" HREF="#sect8">SEE ALSO</A></LI> -<LI><A NAME="toc9" HREF="#sect9">NOTES</A></LI> -</UL> -</BODY></HTML> diff --git a/docs/html/gettext/xgettext.htm b/docs/html/gettext/xgettext.htm deleted file mode 100644 index a999626c4c..0000000000 --- a/docs/html/gettext/xgettext.htm +++ /dev/null @@ -1,144 +0,0 @@ -<!-- manual page source format generated by PolyglotMan v3.0.3a12, --> -<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z --> - -<HTML> -<HEAD> -<TITLE>xgettext(1) manual page</TITLE> -</HEAD> -<BODY> -<A HREF="#toc">Table of Contents</A><P> - -<H2><A NAME="sect0" HREF="#toc0">NAME </A></H2> -xgettext - extract gettext call strings from C programs -<H2><A NAME="sect1" HREF="#toc1">SYNOPSIS -</A></H2> -<B>xgettext</B> [ <B>-ns</B> ] [ <B>-a</B> [ <B>-x</B><I> exclude-file</I> ] ] [ <B>-c</B><I> comment-tag</I> ] [ <B>-d</B><I> default-domain</I> -] [ <B>-j</B> ] [ <B>-m</B><I> prefix</I> ] [ <B>-M</B><I> suffix</I> ] [ <B>-p</B><I> pathname</I> ] <B>-</B>| <I>filename</I> ... <BR> -<B>xgettext</B> -<B>-h</B> -<H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2> - <P> -<B>xgettext</B> is used to automate the creation of portable -message files (<B>.po</B>). A <B>.po</B> file contains copies of `C' strings that are found -in ANSI C source code in <I>filename</I> or the standard input if `<B>-</B>' is specified -on the command line. The <B>.po</B> file can be used as input to the <B><A HREF="http://hoth.stsci.edu/man/man1/msgfmt.html">msgfmt</B>(1)</A> - -utility, which produces a binary form of the message file that can be - used by application during run-time. <P> -<B>xgettext</B> writes <I>msgid</I> strings from -<B><A HREF="http://hoth.stsci.edu/man/man3C/gettext.html">gettext</B>(3C)</A> - calls in <I>filename</I> to the default output file <B>messages.po</B>. The -default output file name can be changed by <B>-d</B> option. <I>msgid</I> strings in -<B>dgettext()</B> calls are written to the output file where <I>domainname</I> is the -first parameter to the <B>dgettext()</B> call. <P> -By default, <B>xgettext</B> creates a - <B>.po</B> file in the current working directory, and each entry is in the same -order the strings are extracted from <I>filenames</I>. When the <B>-p</B> option is specified, -the <B>.po</B> file is created in the <I>pathname</I> directory. An existing <B>.po</B> file -is overwritten. <P> -Duplicate <I>msgid</I>s are written to the <B>.po</B> file as comment -lines. When the <B>-s </B> option is specified, the <B>.po</B> is sorted by the <I>msgid</I> -string, and all duplicated <I>msgid</I>s are removed. All <I>msgstr</I> directives in -the <B>.po</B> file are empty unless the <B>-m </B> option is used. -<H2><A NAME="sect3" HREF="#toc3">OPTIONS </A></H2> - -<DL> - -<DT><B>-n</B> </DT> -<DD>Add comment -lines to the output file indicating file name and line number in the source -file where each extracted string is encountered. These lines appear before -each <I>msgid</I> in the following format: <blockquote><B>#</B> <B># File: </B><I>filename</I><B>, line: </DD> -</DL> -</B><I>line-number</I> - </blockquote> - -<DL> - -<DT><B>-s</B> </DT> -<DD>Generate output sorted by <I>msgid</I>s with all duplicate <I>msgid</I>s removed. - </DD> - -<DT><B>-a</B> </DT> -<DD>Extract all strings, not just those found in <B><A HREF="http://hoth.stsci.edu/man/man3C/gettext.html">gettext</B>(3C)</A> -, and <B>dgettext -()</B> calls. Only one <B>.po</B> file is created. </DD> - -<DT><B>-c</B><I> comment-tag</I> </DT> -<DD>The comment block -beginning with <I>comment-tag</I> as the first token of the comment block is -added to the output <B>.po</B> file as <I>#</I> delimited comments. For multiple domains, -<B>xgettext</B> directs comments and messages to the prevailing text domain. </DD> - -<DT><B>-d</B><I> -default-domain</I> </DT> -<DD>Rename default output file from <B>messages.po</B> to <I>default-domain</I> -<B>.po</B>. </DD> - -<DT><B>-j</B> </DT> -<DD>Join messages with existing message files. If a <B>.po</B> file does not -exist, it is created. If a <B>.po</B> file does exist, new messages are appended. - Any duplicate <B>msgid</B>s are commented out in the resulting <B>.po</B> file. Domain -directives in the existing <B>.po</B> file are ignored. Results not guaranteed -if the existing message file has been edited. </DD> - -<DT><B>-m</B><I> prefix</I> </DT> -<DD>Fill in the <I>msgstr</I> -with <I>prefix</I>. This is useful for debugging purposes. To make <I>msgstr</I> identical -to <I>msgid</I>, use an empty string (<B>"" </B>) for <I>prefix</I>. </DD> - -<DT><B>-M</B><I> suffix</I> </DT> -<DD>Fill in the -<I>msgstr</I> with <I>suffix</I>. This is useful for debugging purposes. </DD> - -<DT><B>-p</B><I> pathname</I> -</DT> -<DD>Specify the directory where the output files will be placed. This option -overrides the current working directory. <BR> - </DD> - -<DT><B>-x</B><I> exclude-file</I> </DT> -<DD>Specify a <B>.po</B> -file that contains a list of <I>msgid</I>s that are not to be extracted from -the input files. The format of <I>exclude-file</I> is identical to the <B>.po</B> file. -However, only the <I>msgid</I> directive line in <I>exclude-file</I> is used. All other -lines are simply ignored. The <B>-x</B> option can only be used with the <B>-a</B> option. -</DD> - -<DT><B>-h</B> </DT> -<DD>Print a help message on the standard output. </DD> -</DL> - -<H2><A NAME="sect4" HREF="#toc4">ATTRIBUTES </A></H2> -See <B><A HREF="http://hoth.stsci.edu/man/man5/attributes.html">attributes</B>(5)</A> - -for descriptions of the following attributes: <P> - <TABLE BORDER=0> - <TR> <TD ALIGN=CENTER><B>ATTRIBUTE TYPE</B> </TD> <TD ALIGN=CENTER><B>ATTRIBUTE -VALUE</B> </TD> </TR> - <TR> <TR> <TD ALIGN=LEFT>Availability </TD> <TD ALIGN=LEFT>SUNWloc </TD> </TR> - </TABLE> - -<H2><A NAME="sect5" HREF="#toc5">SEE ALSO </A></H2> -<B><A HREF="http://hoth.stsci.edu/man/man1/msgfmt.html">msgfmt</B>(1)</A> -, <B><A HREF="http://hoth.stsci.edu/man/man3C/gettext.html">gettext</B>(3C)</A> -, <B><A HREF="http://hoth.stsci.edu/man/man5/attributes.html">attributes</B>(5)</A> - - -<H2><A NAME="sect6" HREF="#toc6">NOTES </A></H2> -<B>xgettext</B> is not able to extract cast strings, for example ANSI -C casts of literal strings to <B>(const char *)</B>. This is unnecessary anyway, -since the prototypes in <B><libintl.h></B> already specify this type. <P> - -<HR><P> -<A NAME="toc"><B>Table of Contents</B></A><P> -<UL> -<LI><A NAME="toc0" HREF="#sect0">NAME</A></LI> -<LI><A NAME="toc1" HREF="#sect1">SYNOPSIS</A></LI> -<LI><A NAME="toc2" HREF="#sect2">DESCRIPTION</A></LI> -<LI><A NAME="toc3" HREF="#sect3">OPTIONS</A></LI> -<LI><A NAME="toc4" HREF="#sect4">ATTRIBUTES</A></LI> -<LI><A NAME="toc5" HREF="#sect5">SEE ALSO</A></LI> -<LI><A NAME="toc6" HREF="#sect6">NOTES</A></LI> -</UL> -</BODY></HTML> diff --git a/docs/html/i18n.htm b/docs/html/i18n.htm index d6833e12c8..db4e4776ad 100644 --- a/docs/html/i18n.htm +++ b/docs/html/i18n.htm @@ -32,7 +32,7 @@ translations as of wxWindows 2.2. <tr> <td valign=center>Czech</td> - <td align=center valign=center><IMG SRC="icons/no.gif" ALT="Not yet"></td> + <td align=center valign=center><IMG SRC="icons/yes.gif" ALT="Done"></td> <td align=center valign=center><A HREF="mailto:v.slavik@volny.cz">Vaclav Slavik</A> </td> </tr> @@ -112,9 +112,10 @@ any comments/suggestions. </body> </html> -<!-- :vi:se tw=0: !--> - <!-- " this makes a translator entry from the address cut-&-pasted from email nmap <C-H> O<A HREF=""><Esc>jdT<k$hPJxf<Xa/A<Esc> !--> + +<!-- vi: set tw=0: !--> + diff --git a/docs/html/index.htm b/docs/html/index.htm index 34f3422468..469abc3de8 100644 --- a/docs/html/index.htm +++ b/docs/html/index.htm @@ -5,18 +5,17 @@ </HEAD> -<!BODY BGCOLOR="#FFFFFF" TEXT=#000000 LINK=#FF0000 VLINK=#000000> -<BODY BGCOLOR="#CCDDDFF" TEXT=#000000 LINK=#FF0000 VLINK=#000000> +<BODY BGCOLOR="#FFFFFF" TEXT=#000000 LINK=#FF0000 VLINK=#000000> <font face="Arial, Lucida Sans, Helvetica"> <a name="top"></a> -<table width=100% border=4 cellpadding=5 cellspacing=0> +<table width=100% border=0 cellpadding=5 cellspacing=0> <tr> -<td bgcolor="#660000"> -<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> -<IMG src="logo.gif" align=right> +<td bgcolor="#C4ECF9"> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> +<IMG src="logo.gif" align=left> <!-- wxWindows Documentation --> </font> </td> @@ -84,6 +83,9 @@ downloaded from the <a href="http://www.wxwindows.org">wxWindows Web site</a>.<P <B>WinHelp</B> </td> <td align=center bgcolor="#FFFF00"> +<B>MS HTML Help</B> +</td> +<td align=center bgcolor="#FFFF00"> <B>PDF</B> </td> </tr> @@ -97,6 +99,10 @@ downloaded from the <a href="http://www.wxwindows.org">wxWindows Web site</a>.<P <a href="../winhelp/wx.hlp">Reference Manual</a> </td> +<td align=center> +<a href="../htmlhelp/wx.chm">Reference Manual</a> +</td> + <td align=center> <a href="../pdf/wx.pdf">Reference Manual</a> </td> @@ -111,11 +117,33 @@ downloaded from the <a href="http://www.wxwindows.org">wxWindows Web site</a>.<P <a href="../winhelp/dialoged.hlp">Dialog Editor Manual</a> </td> +<td align=center> +<a href="../htmlhelp/dialoged.chm">Dialog Editor Manual</a> +</td> + <td align=center> <a href="../pdf/dialoged.pdf">Dialog Editor Manual</a> </td> </tr> +<tr> +<td align=center> +<a href="tex2rtf/t2rtf.htm">Tex2RTF Manual</a> +</td> + +<td align=center> +<a href="../winhelp/tex2rtf.hlp">Tex2RTF Manual</a> +</td> + +<td align=center> +<a href="../htmlhelp/tex2rtf.chm">Tex2RTF Manual</a> +</td> + +<td align=center> +<a href="../pdf/tex2rtf.pdf">Tex2RTF Manual</a> +</td> +</tr> + <tr> <td align=center> <a href="odbc/odbc.htm">Remstar ODBC Classes</a> @@ -125,6 +153,10 @@ downloaded from the <a href="http://www.wxwindows.org">wxWindows Web site</a>.<P <BR><BR> </td> +<td align=center> +<BR><BR> +</td> + <td align=center> <a href="../pdf/odbc.pdf">Remstar ODBC Classes</a> </td> @@ -149,9 +181,7 @@ downloaded from the <a href="http://www.wxwindows.org">wxWindows Web site</a>.<P <h3 align=center><a name="thirdparty"><hr>Third-party tools<hr></a></h3> <ul> -<li><a href="gettext/gettext.htm">gettext Manual</a> -<li><a href="gettext/xgettext.htm">xgettext Manual</a> -<li><a href="gettext/msgfmt.htm">msgfmt Manual</a> +<li><a href="gettext/index.html">gettext Manual</a> </ul> <h3 align=center><a name="samples"><hr>Samples<hr></a></h3> diff --git a/docs/html/logo.gif b/docs/html/logo.gif index 2242fffd965a2779c29b9599d4e14bf2bebe4005..67ce9957bab31fcbc17589b8734e0164a04f86ad 100644 GIT binary patch literal 3590 zcmeH}{Xf&|AIG=ZX6A0jZ04qI?nXs4BI<0*!rU}+o80EMp~6I=-EcCkn%jt&`w{1e zI8i$xebNd`(Va>{=ya4$H##SMb^eC$kLUS#UXRyxJ>I{)AMfjWT(0iB9ULPA!J9yz zK|kRBySV=bcm2fW_OCP5-z0x0n|v-4iDV@uvZ_W|W4o-qTlND$28_x^Cx29*zm~mT zmMwn<Kp+5t0B|^fXaQK*05<D70*>p_0s6X3faweP?gRE601m9n2H5MS0;$J=ToE8D z0ZOWXsz#u(9cb?cx@F)0<G&94zdG>uJBg%$%jJGwpY!ja@BhYnuJ6_%u0p{e5Eis) zy$JeoCqRfbkTt@<twS;(KxkX;AMU8VaS~<Bta7_lck>i(>%pnvOZB(T5_T0BxOX<( zE++47-G95Y@y@v|2jo@mT}>mE4yj91x4W9hYN!IFA@j2IUcFnfWvKje%l&3nJ@W$d z;~X5VV(yH>-MH~Hnt)BrKm7jS9T@y-PP@FP;juv5ULvDL?GmX(-YUD<*Es|iaF$nc zxif-Dw51N&k2)hj@{x46D`Z;d9ppy0lJcwpo<P}T7$DQ47%-l;Z~Pe|YO4x*vxZgv zG}oozKK8j)M$%V$!NqFYu)lL3C3#F@eD`^FrQ@GGOu99z_A~v|1Xky+uJl6U!B>zM zYdL#(pZO`U*5IS*s9hg&Kbgv}nprEla?zC|s^O9=YdJFwAA7=5HoJGwl+~R3smizr z2{;b!B^iL@Bi@x$)sh*75Hm`~OC~0NdH_O7l;BjtPMZd(sAf#lV8{#tM5ym+HUr5S zVJP4Rq7J??p(?g4Xk%Lk4T&v5@R61oj6vweo-d?Oi{1UkIe}mEOlZaitCe97+NZH> zBN0IygdTFJ7rl&(nHHIPo0TCpracCgrX>^V3kis{`h0WwqZv5HVLCb!OUcBPgu7?r z3-tY(eU)%iw_^nOzXDmx6?M~+C=JS$38nn)P+DGH&ul+jBl_W>a7}+IcmN(77BP(s zC^#ILd2G7`6bxUqV5zpv0}r8?p@_25)CtZ&TlaHjVB5=&6_wqGj{G(W%VBJJQ%1@^ z%quM5Da?DZ<U8ksN!0=1%BY*^VDbGyB)jkCXdhknYH2Q!HcH<pzRU^kD}v$|+)%9> zG)%zoApdwi)g-@<C(zolN^9LDg#AJNZtElt4&9A^0gGa^vg3Z;@u_S$)=M(mnd0-$ zx#1*lC)@BtG3>Ar^4XY}2A8<s29R<f0DI4_vb4R+=xN)B2du40lh=K|dx*On^quTH zi1A#MQaOIM1&PYCM73&`Y}RVE5;hujd<VLhyPnd6NozsBe4PW|$)7W``aQlP#wv`m z?eBBX+S?mBW6mE;#id8}^?0Qg`*V7!#@y+L_4M#x%7YWXuKqTav-WX$>4b2CJD(Bx zb~zkmos;$|BB8wqf|GDj%j$HT5nMG2G(au4l<?r~%vpO6WR^d8K3p&j4l{p*;VGYG zg!5qp5sQ|80;{vAg!z)^5TFlT1&zqQv3Gn*&sNVIg;rdoijIMUdAyZ<rOG`nZBCp~ zNZ8*aQu}x1j^D<PTt4s&HUlZsEo7u)O>`i%-B(vb3CG*+g)*N^UK8vWWx(Ex^U`y9 zsG!+M+?Rfj=gqbX^=QbT@WK90tOaU1@8`8+<BBtP8*fzkxb7h>+`me)vok<@9dWu* zGiFv^*C&oSZfB4mNSHnMVXh5gS{$Y*gY%F3oK9CKJW*-TrF1rUMsn^D6)yQjJu3GS zjYtT!t<<Z$#I{IuLdbH2?G6{O=>yXDy3r(7>mo75HAu*9!c`3aLGBc5yUY@6Qipl0 zap$>J6IxR<cX3BtDs*v{WG<A3C&&+6?<02jwaDXyzNOa(N6hxNxHAHZOtt&_4OQtq zIJAoxPo99;2Mh|OgtPt?Q6Zxy7Ikg}8>Ps8<um3eIK>m}$rmB_OTlmx7jgDAE&*dE zKAqHPtHk3v`qc9yy;(5*HSJiMfrOu#;tE6YsfaWvII*e7eI(6&x~X@}T(5E0MheTw zv;aI>)k?FX-~kq)S3p51SqxF>>ko;tvvz~QAn2{P<&6y6g?b!W)4_?$KUJ{+QJ0EU zjqelmR?_mMnF#_M)32mT3{8kG=Y{oQFeYmLx15%sHj<VIJGZ^Hkk%Xc60j$+t@$Ur zChB&-`WOukAG1Ad3o(|jy)&L3@r=6D+JuOSkI7_=u-$h);i*J-d!SLX0rKJrjWlVb zNjZ+b(n3`6M~KJ#20WZ19>N&~?&>qDkBcnC)xK&6*lfl7l@>4pWbJ#DZzh<Jf}}5f z>^8Wx)<zXO>J20>)pz&36rfVZGt&uB411AEQGhwI_D<#7pSxT85nph0qiQ+71b?g; zTg!UjtN2IC*6LKK6h$;BwVbw983#?=&9ljRHHp7^QLK`6&e%MIn&hUa`Q)HOQXPJI zd$eR18nH~SwzFcLT741KluB@%OES8E^j4(b&*+iY6RiDgvIoUmwRI1xd~mGDBJF8o z%M|W5;*h-Pi)^^oA-ao#Ki<C7)Fn40Xz^!G-7WCBx#HDe)GPkubOiXPzG_Z9Ec#c! z2{L%JHGd30F2c`VSJH|`j89t9NK7TY?j#$#l0Da)_a=6EO}GamVl|Be+j<P&thpXK z7<F5?sZ3*9^XRoXX2{GOQ1ih{xUZDL+Sj=?WquT5!0n=|f2H(R86=Zc8evlN(B`LH z#Fv1krJ+o4d*T4Zp}y@efU%!5a2oo&QfDj&BOP<zBHwvzHjl7ZsUY-?^M!rY#g_98 zb4MzhbKkTSc%LKSl3ugwu@STYyJmIE<jNhvU5+%Qwb3aLF#ug87AL?+)S{qCEJe#% zKiqbPI-(P?L#MRxi2TX9(tYoKKWxJyL?NG?HOruE31v7GSAfLK+_D!XOWPLiX^&U$ zUBZ#n>abrA(2OSib?DI}=aK1BHT&4UDolpnvmg%(&g7DY+WCn_f9_h%V)SU$F`{{L z`ba=tnN-+lm32o=W|MR-vz{CmMN_>~>>|ynWn}*aS49lPnABBDt%?(P$6_A<>Ym)7 z0JJ*0B(E$zo0Xva35OE`vc?Fe(#N~T%K=|;xjV?2qJ(Z&fvY%cJ5|Y4<4>3;i})m_ z{7>Mn#nf(YYi4qfbHnCju7#fw+-;j*t9?zSe+~m^wsOlke@Zzbb!+n>w%akDUN~iJ zASZ8O8xb8ShdWdR_rAB*j|V5z?HtgV?Ko`s4R04Gd`r@;8qx|#sC(q>4c~Og*1SO> z(t>#XM8EddQXTx_=97?ysMaVHAxX)b>Eul#*KA{yLcG^twR7D}urbO)j(xFm*QxsT zURxRUAAZfdS;Xu4liy~~n>ohajCpFz{MNsJg9VIy>im>1b~B2zOoG(VPQW5f&H|~o zed$NEjx&fMV~xJX5)1S05G>2{%4-x(k_e?`yO!<2AiS^+dRsW=`t{(WodJfAz=kY; z3q(fw3OJwSwxv51MkLJ<b=%Q)q*p0{w2fbEQA2enrbx;C{LIrQbwg9|*WaglW78m! zR@s9m3TltNv)8r7Qg+R!`M5ed_;2-E(5J1KU3tHgj?ME8I+$pGRHKNcc^^D@gHSMm z((Dh0z4S9v985c@tEm7_m5?JIZZP!S2hoDOjp3MaUhm1t<z0A5;JPGQ=0RR@Q1TRv zDGAd2QXu-AFooV2;&$j@P_ECAFuwMX?F^=Qfiyq4VTf;Xad6wR5`;sv^1PLI<o!12 zf=SpVYiSUP-QZnFhYZ#VzocL|#AtV|_>MVH=@l)s1V0^Vlrm}fKnl|2CX980)T!~% zOQ7v_hNhJGhvkM(BhPF`8TLoTYrHdfawP7x18rJr#A`B$Tgjfd0{V3ZR8|K%-^0E4 z1;4nkW&8@{pmGSJLX7Mct34KLtcp>3g=oh@o!~;<%tBm6A-=cJ;BleRY9T?dh?H3f JUjOkr{STDsbxQyM literal 4656 zcmW+%d05m|`%N+{!z^JR8PtFS45BuOz^G`$qDDoHP$UT2C@N9G20<BHm$2yoO5=uD zu?7ot+=HSWE!rTcqqcRBR-yH)Bcftk>r}1U<@fQ?-+k_L{y6V>-}|1sJa@*->E?+` zc7h1-1^`SZ)8OEsz;PnaJMDIt)9D@<aM)}-O$#jBBZ^{OosD4#6y+((ZnX~d^wg20 zgXb9x6FH6}h&qB`F^t1;x65TC2rGsOB*~i1R<qeo5IlylD9V^jB0*S8CY#wT4hhU= z8bKU5ZZ(-K2;#(XO0VxBNm{RG^m>b4?;;4-5DCLH3^PNhR8jyi=yvlsR%b>TM9-0g zmB1M@>ZAw;Gg~p#YBpI=q=z9%GfJSQIud6wRHX183&{~?3xP4XnIkb4M=1j5DU7#J zbwfyFX4E8DDS;(Kj<R!<$dOhW<E<2DAq0+e+Nd6ZrYWM1CG2&i!$vy=rpIn^*=ZX` z@>W8qqa1?8X=j}RJ=kO6Ihti~hrozD;jj@scG@K}0}cykW!Rw=t)$h0+j&y74Q0_z z`%s9s)eZ54z|(dcBicx(o$e7Cfgci(E(bH<w77dLwmO36aK4TaY^;^VIV)br;V5b% zNt~t$i)Coyv;`+=f@BDiA}NL<=%F1aNehLMI5C7YfwL55A!)0{WJXCVgAb7mX||9! z$DkI{#0(uCV`fN{CQKA=A~3wpf^m%5N~7$*{xJ)U5;!_knIsvOr5FZd7?dQ3nm{nZ zL|Z9~6*1!kV?{91L|GA>Hq#tRS<MWOGBy*<;{<6!%>>Qjv=yUR6GmeH3OF-kLuuYb z4y7<AstzGogyi&u)l6~NP>8hR6pN7-Gr^!kHAxmFhO9CePU55mBN&nzx>-YwFcih& z|IgAmNnwPAp#IenByGlM)J*CT4ku{DB;bS{Cq$g+A;{oArNF;q%)jvOn*fx9K!Gv{ z7x?xvrO)VWhtSZm4IVYC9&b5(rCJ}o>Yk(Ep~gF{Ih*ZjX}rGMly)@x`st>dm1tc` zrjH2@GN*moX1RXm^IM0oGS#z)N81mLpCAdI)or@&tU(iTO+sQw<&pHLAFRK(9=m&r zk}YUSdd)RV-yP;r>RlV6ma0c2i);b_dgv0-@&`x)r1n7cB=uQel~U^6y69_r!F9tz z$Au$l*XI9lw#IPDk7~cVqa^Mpe+R-wURFXOoUa{B)GB<FV3bSx;PH?4!tmn>j+z58 zdxlRt?R!0<#{Z4`;@j<#X+9gr5<I1?l~#P~v1AO&i>2*;n=^a{Q(!FWib}5Zz4Ohb zi#fipknbOKd|nfr@KGOLdivJl2`jsjJ8I&6NJwQm5ajUCd>;XWNpZ<s5*P{lmI4N1 zhEoEf0x0vtJ260K&+V&Bj4GB)9efaVKVXf1Y39NW$)9~4*WGVViT$cEbymbt+v%!s z^@p-D2%>RLqb;|VX(UnvEY!jRsEy>X#0qF9&<>{fvkA#@Caxsk)O@6Q)^IZg%3tY6 zeKX-={N-x_o7pA%jddGO&yM{uFGmyigYiuDSnCgoH%8b0+MiC*{{1ZEbMi?OnDctt zZH-<{VW6=W?x~AAuGp!N<HF;k$Jew%@*sMU|5z4C6X2vfrcpJaAG*C}h8@Uz;elS4 zUYOIcHLPl2beok;^!)Q);m5oD+OcPe#>V1jn%#1OJ<{(bvOsemHe!hpN5#EHggBX` zZd=b;q!o95zWDYeAoYxB6z83ogglUqxXLBXi8$Q2>*nS2(lj;yA7kOyQQMjmZ=Aj$ zzEn>d*d9G6z9zA#OySWZ?*R3PTfE`%o<0%Mp+wKk4I4NKq?-Bm1Qy$Az~tKFNUIa- zM=?l&Vx=+&BY+GeiiXt|%$ed;6`a2cB#`eCn3U|;D*3|GBD|1zlshskZ_n+>QVu%M z4)qwIq{4sGs}kkNMdV;&)r7*D&%T{-lSrEz>osqqXN1S+OJ_%Z4q$W4PwIW<nt#ha z#z|yS4A4fIC=8Ngu0U`_xQIQ`BG}XYkQ9kc?ENjTM0!vm9)#K=2^O50gQb2cm13a$ zn1O27`1^868zjB_c*zwX*SK2c7_1%I;>DGL={x5F;4q9!&>G6I1gUD{Z?FH}am9V> z-T&K8B<nZ7O&B?{!kCI1yOsA`dv>bnpiu?a9kPh2?O2u=vi6!o9v9}=vD}J;#0nVT z%Sc}MB2kfU479yrZw0w>$4+Je25wS>8nf!wiU9YfO)9#!qDcFqftYiWegyhp^dZHd zKi8_RuZ+<#qP(X#IVf+)Cy#-MtHf|z+z{-><d6VB<&-ShSW-tJCCAOnmgOXgdw*Cf zk&-8nL?8V9>^iUGe}*POE#j~D%FAHK_LNl{msE%y9krdJZ2Z8CcWW8NH2q~=rTc!6 z1Kw6(N*Z=YkjDxIHS4j@h->iGv3r(R&nF)!ueq;I`gy+YBWH&~&*vn?3+<Y`7C`$} z{f9SaEb%>69!s)|7uvWy83w3&Ftxw){0U9@rtA=<{C1jNs^4KHZ?>xrn%JYpdFgZC z11OjU#?|adHJBD_y@|b%YuNbojR8sC0vqnfC+D{$fafv?VFN5q4tBJID~i3;=39Vr zY_L|#vn3`hT?>qqKd*$h)Xc2jx%RpW?$vpsFSNyE=f<~~eEhHNL3in`v(i`XaQHoJ zy5Q~%PYzb4av{Dm&{DK5SO-%sD4+-EMoPhm2sUY)u^o(OfbfPY6v~|QtBL3QFjt)d z&&Y1<3>tnT6^S!9EM0??1eshw@PtE)V^LPsi-91Qp`1<z1SO00e~kgW-c>I6YR{1* z?<0WJ*9C4;AyO^YE&pU0XLwHpN5Hspj8LMw=aN^SJ&rAK0im0>ZdmhS!0vcwFYzo5 z$)A;XYb{pdmxlmpg=3br&+1hUa-zgf#GFfAY+N58mx+(^6$Ee*{jLGtOTP+n8vUO7 zOAdAAR)+mO?A~QI9%9>7Bd9=cGZwS!thi*t&7Fabn0$<DhSv>Z>tuB4)Ma>CU>kdT zb<e)0XG6ct++fd)J(ru0IHmG>Q8uN&Jz$CxRBlw2Hcag=e>mz^ov80sBJ6o)uV>NS zoM<9q892NuL23dd9to@wCGRIRdz2i_6M;{&+BI?}I>;g>KwW*ea5zOq9z%5~wk!&5 zfDlBY&>JN6*MoIQ(v#WW<vwj|3Q*^@T$TR5A3Qhx(|ILcS0@rW_0?iPY2?dfW>InT z`;tR4WDuankI@DJAS8{0vVJ9=sD#kxPfwOFXxbt1cVE=_&)XoaWWg1=(@KIe5Z%Eu zYp+c&Ipa^wigh>qCZ{A%Kl!E83}fKpe;#Yv&PmLenEp**uQbJ^n8-9wUxi5#K2A1m zK=P5_{B7@S57sW$cT70hzJ1kuWy8M4rf&vO&kQlq?~v)r*u)ZPOi^&p%D0gJ9;a^0 ztFn=+i<H^XF7QSEkvvJ)$#P$zDQND~FAhfQ5|?gcRh)kIqce9PIWzXf9_#U_^&v4I z@KZjmTsX@tu(1m7QZ?HRelS;DG>j<=EnZi>v%-<>A(Xa3VRtfGy`!(ZT&l|BHys|V zit(^+zhH`p0)7i@(Ra-%1(yY#W!9w0C!M*aU86}?a|C3G{IbgMykAZ{rsCkQ?_wK| zto(MZeDs9zX}kNo%+{jhZ|u-*QIsriJ0`txuuNr{gc`lpRp#vI1&YL@F#iCWq+hL8 zFDUd0mIjML#c0zKk9B5g$UVUNPUjN!`*5f5@rmuLD9JD<U+%Y{p!&wg-v0aaoulMY zR_yo#&s8o+`Oky==<!D0ISTl)>tbWyH(KzY*0A$F-d`%lP&*cF!_;F0pj#}c8W$^i zd5n9<Yen0vshyc!cPx@+3m(a@q+#mOoTPt#JyQOysXXM_)02@WiY}Es8^nB120YvR ziP4t@zW;ICUz^sqS@28V5=-&lK=zRoZ?15p50D{Uc5`y8Z|1X?!;BnwPX>P5nG)v& z2X?QU84Ih?b#Gs<(3P%R7`IaN17HNSt;nqav+JkNR|BgKuaJN-VW%E}s<;>(y3Rw0 z_7oEg1+p!al48neL0L_dRWaeqM8zsZ^Lkp|*DiH0pqVa!dx;Gvhz*}{icUgv)#+&g z6mPqv2JFL;Jfw>X36f?n@y`rgItO$m2J?U|7A{`^#AU!O67Z*%%tsG_rV{v3Yhv`) z<+j7X@Gpj^KLCAQz%W-%>g$dF?DLb=6+P}7oBMh+H5fD1vJHNlJ1?|vQ|}9)`D)R_ z48vDf{OE0xr(bM7^l-+W7ZbjmF?AvZzWf~cqj-xhG<TF~oZPj=>d$7*0HjJ#N2Pm^ zfG530TSr&N#y0+u<oP|p)n+#r>(A_zJbGO1_Ad>6Q5k9}o!h@Y(gf@H&F_%<D1D_@ zf-Ikr)2w_wubgC8ZU>aFq7+3=#YN`**A<!vPGB+t`M6YnnLSSno;NAYzTGo#v)Wpx zG(gn-*9|7QVHGwlHjG$p1jcvA%$Yvd)0K7ij|eS+x4c}lmY#4a0|vH@?`|9cMTJzh zPdpV|_~^U$!rug<B5?Ut$}dHkmkKw@2P?qaWm~=Hhe=_{fA)dCaZ`u0peH=Xz)5t( znxB8K{H_@ISyJeGCqeEWuVgdN;BbB{5X{p$iWH}TqoS*O6AR9nLuOAj7{qF*fz4kZ zntRrGsSF4f!0=ayFCV{qIS|>pu4`0)SL%8=JY{NUVYhy@0nQGyMCZR*KlcoHr}Klw zX?h7#7FZ%JXXMqqvi|!1ZH$5?ltq+s59rZ}Y6nE^bC>paCpg(9`HcU#1@UaB#sKHl zKRPu}VA))*;=dx8Pp0IVW-Ofud!W|JC6bJCLh8zrJOCYyfCmNc359(b;MMJQLHmZw zc%bqRz}sc~?_kk;6`|nMmYvSxd4`o>^C<AVG|-z_K|*`gxl?EQ?1JaV`@(y&a+cpO z1iniszTdH&mxs1`t+;b|#iC?=Q5fj$nzryr$&(}irN}sEsqVsZ8M*149s23zl)`JZ zW>>AK-zP1|5o#rJGB~I9u<z)V&2LI2ZvMGqwb;GV_Yrt9Sbu-l*nz@TX1GL%UG*3$ ztKILV73FK4_;OLPiBM#*vL`m>vI2Q7Bb(s@!zd`6fJPwl<BaD?*s}pX(7~sE3!5&? z)V4i65CpIB?4l1e1&?eAm3T=OLNyZ`L)VX<5^o&cl|1<uFB=&$A{K-CTA<!a+x@|Y zkhl9o%LBdU?+*4twpND14j=HjcW~;<VflU8315teg~5Z9Vhti-$b|D(fc{rQy_nFH z%fJX0yjd1sRRtW2I@)w&?75cYuPT7--^1kX0kiLHjRXReV(3rl<LbSSQqzv!jE>!V zBk*+KY-m2Hh9yz#G20d3`X@PF?qQcMcunCOt0~1wUa?wG7P7JdylD%fSj)>YFElMu zHMbI;CtRuqSk)qUcGRZUCu@I!W$z-;XdW^GHSTV~@O!QHBSSp5|G=Mkm0M2nvO^IH zJWBcULushc6w01z<xc(m^Qn`7x{uJ@Wi`@jZ35gf{zq?3Kz;O}!5`=MSHY><1!Wc^ z%Vm_Sow7xO{MYZL;o>_}L{;c)&r_o6ucIHgbK2iv&Dg(BPg{Ft;oo}CFV9vNNJt=c z2`5WMrE!S#lMTL`-HKdFp6migq0sEC)29$s%CS@JjJjXc-gc^c1Z_X7&HUwTd6s=m zp(I6=#$#{{Cp$2+X+0y)MB~ryQrO)p-r3s9s@f2BKVaTGTl)~zZOyvS{ELvp$SF=n ziqa%x#J+UNK~a^Gb(%+@5L9;?&_*oRbR#<TM;9(nZo7~G#lV#loE~#lt4t_tLc!-q r_zTqDnRW3_^*duJmEGy_P2?_<pu4LvT<V*AsXyz|<470;fyw^^RZuMa diff --git a/docs/html/news.htm b/docs/html/news.htm index 6b9af3c139..0ac1d66ea8 100644 --- a/docs/html/news.htm +++ b/docs/html/news.htm @@ -8,16 +8,39 @@ <font face="Arial, Lucida Sans, Helvetica"> -<table width=100% border=4 cellpadding=5 cellspacing=0> +<table width=100% border=0 cellpadding=5 cellspacing=0> <tr> -<td bgcolor="#660000"> -<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +<td bgcolor="#C4ECF9"> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> News </font> </td> </tr> </table> +<H3><a name="release2_2_0">July 9th, 2000</H3><P> + +<ul> +<li><a href="download.htm" target=wxmain>wxWindows 2.2.0</a> is the result of many +fixes and enhancements to 2.1, and is an official stable release. +</ul> + +<H3><a name="release2_1_16">June 4th, 2000</H3><P> + +<ul> +<li><a href="download.htm" target=wxmain>wxWindows 2.1.16</a> contains fixes +for wxGTK, wxMSW and wxMotif. It is hoped that this is the last release before the stable 2.2 version. +</ul> + +<H3><a name="release2_1_15">March 28th, 2000</H3><P> + +<ul> +<li><a href="download.htm" target=wxmain>wxWindows 2.1.15</a> contains a few fixes +for wxGTK and wxMSW. wxMSW and wxMotif users who already have 2.1.14 do not need to rush to +download this version! The fixes in the patch file (see main download page) contain the +major differences between 2.1.14 and 2.1.15. +</ul> + <H3><a name="release2_1_14">March 21st, 2000</H3><P> <ul> @@ -26,9 +49,9 @@ Again, great strides have been made since the previous official version (2.1.11) stable version. Many things have been fixed and added but <a href="newver.htm">here are some highlights</a>. <li>Robin Dunn is contributing a wxStyledTextCtrl, a wrapper around the <a href="http://www.scintilla.org/" target=_new>Scintilla</a> styled text edit control. It can be used to provide syntax highlighting for various languages, and other applications. -A snapshot of this work in progress, stc.zip, is provided on the ftp site alongside wxWindows 2.1.14. +A snapshot of this work in progress, stc.zip, is provided on the ftp site alongside the latest wxWindows release. <li>Guilhem Lavaux has reworked his MMedia sound and video class library and started its documentation; -it too is available alongside 2.1.14 as mmedia.zip. +it too is available alongside the latest release as mmedia.zip. </ul> <H3>January 14th, 2000</H3><P> diff --git a/docs/html/platform.htm b/docs/html/platform.htm index d1dc3d635e..0fa514f1d6 100644 --- a/docs/html/platform.htm +++ b/docs/html/platform.htm @@ -8,10 +8,10 @@ <FONT FACE="Arial, Lucida Sans, Helvetica"> -<table align=center width=100% border=4 cellpadding=5 cellspacing=0> +<table align=center width=100% border=0 cellpadding=5 cellspacing=0> <tr> -<td bgcolor="#660000" align=left colspan=2> -<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +<td bgcolor="#C4ECF9" align=left colspan=2> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> Supported Platforms </font> </td> @@ -29,7 +29,9 @@ See also the <A HREF="http://www.lpthe.jussieu.fr/~zeitlin/wxWindows/daily/">dai <p> If you have tested wxWindows on a platform not mentioned here, please tell us about your experience on our mailing list! We would especially like to have information about compiling wxGTK on other Unix variants, such as IRIX, DG-UX, -other flavours of BSD, ... +other flavours of BSD, ... Please note that you will generally need GNU make +(also known as <tt>gmake</tt>) to compile wxWindows, native make programs +often don't work. <p> <table width=100% border=4 cellpadding=5 cellspacing=0> @@ -47,14 +49,15 @@ other flavours of BSD, ... </tr> <tr> -<td bgcolor="#FFFFFF" align=center valign=center rowspan=6>Win32 (Windows 9x/NT)</td> +<td bgcolor="#FFFFFF" align=center valign=center rowspan=7>Win32 (Windows 9x/NT)</td> <td>Visual C++ 4.2/5.x/6.0</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>VZ, JS</td><td>Project files are provided for all versions except 4.2</td> <tr> <td>Borland C++ 5.0</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td><br></td><td>Also works with free command line Borland C++ 5.5</td> <tr> <td>Mingw32</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>GRG, VZ</td><td>Cross compilation from Linux works as well<br> Version 2.95.2 recommended, otherwise some (included) patches must be applied<br> Memory debugging code doesn't seem to work well</td> -<tr> <td>Cygwin</td><td align=center><IMG SRC="icons/no.gif" ALT=Unknown></td><td><br></td><td>Hasn't been tested recently, anyone?</td> +<tr> <td>Cygwin</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>Stephane Junique<br>Andrea Venturoli</td><td>tested under NT 4, cross-compiling for mingw also works</td> <tr> <td>Watcom C++ 10</td><td align=center><IMG SRC="icons/somewhat.gif" ALT=Almost></td><td>JS</td><td>Tested with 10.6: works, but wxImage seems to be broken<br>no support for JPEG, TIFF or OpenGL</td> +<tr> <td>Watcom C++ 11</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>Markus Neifer</td><td>Tested with 11.0b under win95</td> <tr> <td>Symantec C++</td><td align=center><IMG SRC="icons/no.gif" ALT=Unknown></td><td><br></td><td><br></td> </tr> @@ -80,9 +83,10 @@ other flavours of BSD, ... </tr> <tr> -<td bgcolor="#FFFFFF" align=center valign=center rowspan=3>Solaris</td> - <td>wxMotif with Sun CC 4.2</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>VZ</td><td><tt>-mt</tt> should be added to <tt>CFLAGS</tt> for MT compilation</td> +<td bgcolor="#FFFFFF" align=center valign=center rowspan=4>Solaris</td> + <td>wxMotif with Sun CC 4.2</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>VZ</td><td>Thread support must be disabled on system with not MT-safe X11</td> <tr> <td>wxMotif with gcc</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td><br></td><td><br></td> +<tr> <td>wxGTK with Sun CC 4.2</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>Shiv Shankar Ramakrishnan</td><td><br></td> <tr> <td>wxGTK with gcc</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td><br></td><td><br></td> </tr> @@ -94,13 +98,31 @@ other flavours of BSD, ... <tr> <td bgcolor="#FFFFFF" align=center valign=center rowspan=2>HP-UX</td> - <td>wxGTK with HP CC A.10.22</td><td align=center><IMG SRC="icons/somewhat.gif" ALT=Almost></td><td><br></td> - <td>special extra compiler options must be manually added, see the docs for details</td> + <td>wxGTK with HP CC A.10.22<br>or HP aCC B3910B A.01.18 + </td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>Staf Verhaegen</td> + <td>you need to add <tt>-Aa -D_HPUX_SOURCE</tt> to <tt>CFLAGS</tt></td> <tr> <td>wxGTK with gcc</td><td align=center><IMG SRC="icons/no.gif" ALT=Unknown></td><td><br></td><td><br></td> </tr> <tr> -<td bgcolor="#F0F0F0" align=center valign=center rowspan=4>OS/2</td> +<td bgcolor="#F0F0F0" align=center valign=center rowspan=2>IRIX</td> + <td>wxGTK</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td><br></td><td>You may need to use <tt>--disable-catch_segvs</tt> if you get compiler<br>error in utilsunx.cpp</td> +<tr> <td>wxMotif with MIPSPro 7.30</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>David Marshall</td><td>On IRIX 6.5.6 (Indigo2, 64bit), with SGI Motif 1.2</td> +</tr> + +<tr> +<td bgcolor="#FFFFFF" align=center valign=center rowspan=1>SCO UnixWare</td> + <td>wxGTK with gcc</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>William Suetholz</td><td>UnixWare 2.1.3 with UnixWare 7 compatibility PTF</td> +</tr> + +<tr> +<td bgcolor="#F0F0F0" align=center valign=center rowspan=1>DEC OSF/1</td> + <td>wxGTK with gcc</td><td align=center><IMG SRC="icons/yes.gif" ALT=Ok></td><td>Fabrice Didierjean</td><td>OSF1 4.0 on Dec Alpha<br> + you may need to run configure with <tt>--host=alpha-dec-osf switch</tt></td> +</tr> + +<tr> +<td bgcolor="#FFFFFF" align=center valign=center rowspan=4>OS/2</td> <td>VisualAge 3.0/4.0</td><td align=center><IMG SRC="icons/no.gif" ALT="Not yet"></td><td>DW</td> <td rowspan=2 valign=center>OS/2 port is work in progress...</td> <tr> <td>EMX</td><td align=center><IMG SRC="icons/no.gif" ALT="Not yet"></td><td>SN</td> @@ -120,3 +142,5 @@ any comments/suggestions. </body> </html> + +<!-- vi: set tw=0: !--> diff --git a/docs/html/roadmap.htm b/docs/html/roadmap.htm index 8462fa7c50..c066c92475 100644 --- a/docs/html/roadmap.htm +++ b/docs/html/roadmap.htm @@ -59,7 +59,7 @@ available at dates convenient to the developers.<P> <H4>Release 2.1.14</H4> -Release date: March 12, 2000<P> +Release date: March 21st, 2000<P> This will be the final beta release before the final 2.2 release. It will be synchronized for as many platforms as possible (at least Windows and GTK, @@ -94,8 +94,8 @@ This is the next stable version of wxWindows. No new features since <ul> <li>bugs found during 2.1.14 will be fixed. -<li>translations of text strings used in wxWindows -<li>documentation updated to include all new classes +<li>translations of text strings used in wxWindows. +<li>documentation updated to include all new classes. </ul> <P> diff --git a/docs/html/standard.htm b/docs/html/standard.htm index 9bd3acac53..196b63ff5a 100644 --- a/docs/html/standard.htm +++ b/docs/html/standard.htm @@ -9,10 +9,10 @@ <font face="Arial, Lucida Sans, Helvetica"> -<table width=100% border=4 cellpadding=5 cellspacing=0> +<table width=100% border=0 cellpadding=5 cellspacing=0> <tr> -<td bgcolor="#660000"> -<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +<td bgcolor="#C4ECF9"> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> wxWindows Programmer Style Guide </font> </td> @@ -50,6 +50,7 @@ C++ portability guide</A> by David Williams. <LI><A HREF="#no_stl">Don't use STL</A></LI> <LI><A HREF="#no_fordecl">Don't declare variables inside <TT>for()</TT></A></LI> <LI><A HREF="#no_nestedclasses">Don't use nested classes</A></LI> + <LI><A HREF="#no_newlogicalops">Don't use new logical operators keywords</A></LI> </OL> <BR> <LI>Other compiler limitations</LI> @@ -270,30 +271,34 @@ The scope of a variable declared inside <TT>for()</TT> statement changed several years ago, however many compilers still will complain about second declaration of <TT>i</TT> in the following code: <PRE> - for ( int i = 0; i < 10; i++ ) { + for ( int i = 0; i < 10; i++ ) { ... } ... - for ( int i = 0; i < 10; i++ ) { + for ( int i = 0; i < 10; i++ ) { ... } </PRE> -Even if it's perfectly legal now. +even though if it's perfectly legal now. <P><U>Workaround</U>: write this instead: <PRE> int i; - for ( i = 0; i < 10; i++ ) { + for ( i = 0; i < 10; i++ ) { ... } ... - for ( i = 0; i < 10; i++ ) { + for ( i = 0; i < 10; i++ ) { ... } </PRE> +or, even better, use different names for the variables in the different for +loops (in particular, avoid mute variable names like <tt>i<tt> above) - then +you can declare them in the loop statement and don't pollute the outer name +space with local loop variables. <P><LI><A NAME="no_nestedclasses"></A><B>Don't use nested classes</B></LI><P> Nested classes are, without doubt, a very good thing because they allow to hide @@ -338,10 +343,27 @@ you can try the following: <P>A nice side effect is that you don't need to recompile all the files including the header if you change the PrivateLibClass declaration (it's an example of a more general interface/implementation separation idea). + +<P><LI><A NAME="no_newlogicalops"></A><B>Don't use new logical operators keywords</B></LI><P> +The C++ standard has introduced the following new reserved words: <tt>or</tt>, +<tt>and</tt>, <tt>not</tt>, <tt>xor</tt>, <tt>bitand</tt>, <tt>bitor</tt>, +<tt>compl</tt>, <tt>and_eq</tt>, <tt>or_eq</tt>, <tt>not_eq</tt>, +<tt>or_eq</tt> which can be used instead of the usual C operations &&, +||, ~ etc. +<P>This wonderful (and not backwards compatible in addition to being +absolutely useless) new feature means that these new keywords should not be +used as the variable names - even if current compilers usually will accept +this, your code will break in the future. For most of the keywords, using them +as variable names is quite unlikely, but <tt>or</tt> and <tt>compl</tt> were +used in the wxWindows sources which seems to indicate that they are the most +likely candidates. +<P>It goes without saying that these new keywords should not be used instead +of the tradional C operators neither both because most compilers don't accept +them and because using them in C code makes it less readable. </OL> <BR> - <LI>Other compiler limitations</B></LI><P> + <LI>Other compiler limitations</LI><P> This section lists the less obvious limitations of the current C++ compilers which are less restrictive than the ones mentioned in the previous section but are may be even more dangerous as a program which compiles perfectly well on @@ -351,18 +373,18 @@ compile on another platform and/or with another compiler. <OL> <P><LI><A NAME="no_ternarywithobjects"></A><B>Use ternary operator ?: carefully</B></LI><P> The ternary operator <TT>?:</TT> shouldn't be used with objects (i.e. if any -of its operands are objects) because some compilers (notable Borland C++) fail +of its operands are objects) because some compilers (notably Borland C++) fail to compile such code. <P><U>Workaround</U>: use <TT>if/else</TT> instead. <PRE> wxString s1, s2; // Borland C++ won't compile the line below - wxString s = s1.Len() < s2.Len() ? s1 : s2; + wxString s = s1.Len() < s2.Len() ? s1 : s2; // but any C++ compiler will compile this wxString s; - if ( s1.Len() < s2.Len() ) + if ( s1.Len() < s2.Len() ) s = s1; else s = s2; @@ -388,7 +410,7 @@ it has a destructor, remember to add an empty default constructor to it. </OL> <BR> - <LI>General recommendations</B></LI><P> + <LI>General recommendations</LI><P> While the recommendations in the previous section may not apply to you if you're only working with perfect compilers which implement the very newest directives of C++ standard, this section contains compiler- (and language-) independent advice @@ -585,7 +607,7 @@ put another one after it. </OL> <BR> - <LI>Unix/DOS differences</B></LI><P> + <LI>Unix/DOS differences</LI><P> Two operating systems supported by wxWindows right now are (different flavours of) Unix and Windows 3.1/95/NT (although Mac, OS/2 and other ports exist/are being developed as well). The main differences between them are summarized @@ -634,18 +656,19 @@ i.e. <TT>GetId</TT> is the same as <TT>GetID</TT>. </OL> <BR> - <LI>Style choices</B></LI><P> + <LI>Style choices</LI><P> All wxWindows specific style guidelines are specified in the next section, here are the choices which are not completely arbitrary, but have some deeper and not wxWindows-specific meaning. <OL> <P><LI><A NAME="naming_conv"></A><B>Naming conventions: use <TT>m_</TT> for members</B></LI><P> -It's extremely important to write readable code. One of the first steps in this -direction is the choice of naming convention. It may be quite vague or strictly -define the names of all the variables and function in the program, however it -surely must somehow allow the reader to distinguish between variable and -functions and local variables and member variables from the first glance. +We all know how important it is to write readable code. One of the first steps +in this direction is the choice of naming convention. It may be quite vague or +strictly define the names of all the variables and function in the program, +however it surely must somehow allow the reader to distinguish between +variable and functions and local variables and member variables from the first +glance. <P>The first requirement is commonly respected, but for some strange reasons, the second isn't, even if it's much more important because, after all, the immediate context usually allows you to distinguish a variable from a function in diff --git a/docs/html/wxbook.htm b/docs/html/wxbook.htm index f2f2fdde53..8900967c66 100644 --- a/docs/html/wxbook.htm +++ b/docs/html/wxbook.htm @@ -8,10 +8,10 @@ <font face="Arial, Lucida Sans, Helvetica"> -<table width=100% border=4 cellpadding=5 cellspacing=0> +<table width=100% border=0 cellpadding=5 cellspacing=0> <tr> -<td bgcolor="#660000"> -<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +<td bgcolor="#C4ECF9"> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> wxWindows Book </font> </td> diff --git a/docs/latex/wx/app.tex b/docs/latex/wx/app.tex index 55249bf1cd..2add770cd4 100644 --- a/docs/latex/wx/app.tex +++ b/docs/latex/wx/app.tex @@ -38,8 +38,9 @@ a reference to your application object) to be visible to other files. Constructor. Called implicitly with a definition of a wxApp object. -The argument is a language identifier; this is an experimental -feature and will be expanded and documented in future versions. +% VZ: there is no such feature so far... +% The argument is a language identifier; this is an experimental +% feature and will be expanded and documented in future versions. \membersection{wxApp::\destruct{wxApp}} @@ -457,7 +458,7 @@ deleted. If FALSE, the application will continue to run.} Sets the `top' window. You can call this from within \helpref{wxApp::OnInit}{wxapponinit} to let wxWindows know which is the main window. You don't have to set the top window; -it's only a convenience so that (for example) certain dialogs without parents can use a +it is only a convenience so that (for example) certain dialogs without parents can use a specific window as the top window. If no top window is specified by the application, wxWindows just uses the first frame or dialog in its top-level window list, when it needs to use the top window. diff --git a/docs/latex/wx/array.tex b/docs/latex/wx/array.tex index c5aca501c3..733e548d5d 100644 --- a/docs/latex/wx/array.tex +++ b/docs/latex/wx/array.tex @@ -51,7 +51,7 @@ wxArrayDouble class is scheduled for the next release of wxWindows). wxSortedArray is a wxArray variant which should be used when searching in the array is a frequently used operation. It requires you to define an additional function for comparing two elements of the array element type and always stores -its items in the sorted order (according to this function). Thus, it's +its items in the sorted order (according to this function). Thus, it is \helpref{Index()}{wxarrayindex} function execution time is $O(log(N))$ instead of $O(N)$ for the usual arrays but the \helpref{Add()}{wxarrayadd} method is slower: it is $O(log(N))$ instead of constant time (neglecting time spent in @@ -75,7 +75,7 @@ example: \begin{verbatim} #include <wx/dynarray.h> -// we must forward declare the array because it's used inside the class +// we must forward declare the array because it is used inside the class // declaration class MyDirectory; class MyFile; @@ -249,7 +249,6 @@ This macro defines a new sorted array class named {\it name} and containing the elements of type {\it T}. The second form is used when compiling DLL under Windows and array needs to be visible outside the DLL. - Example: \begin{verbatim} @@ -259,7 +258,7 @@ class MyClass; WX_DEFINE_SORTED_ARRAY(MyClass *, wxArrayOfMyClass); \end{verbatim} -You will have to initialize the objects of this class by passing a comparaison +You will have to initialize the objects of this class by passing a comparison function to the array object constructor like this: \begin{verbatim} @@ -356,7 +355,7 @@ Default constructor initializes an empty array object. \func{}{wxSortedArray}{\param{int (*)(T first, T second)}{compareFunction}} There is no default constructor for wxSortedArray classes - you must initialize it -with a function to use for item comparaison. It is a function which is passed +with a function to use for item comparison. It is a function which is passed two arguments of type {\it T} where {\it T} is the array element type and which should return a negative, zero or positive value according to whether the first element passed to it is less than, equal to or greater than the second one. @@ -530,14 +529,14 @@ the array classes. \func{\void}{Remove}{\param{T }{item}} -Removes the element from the array either by value: the first item of the +Removes an element from the array by value: the first item of the array equal to {\it item} is removed, an assert failure will result from an attempt to remove an item which doesn't exist in the array. When an element is removed from wxObjArray it is deleted by the array - use \helpref{Detach()}{wxobjarraydetach} if you don't want this to happen. On the other hand, when an object is removed from a wxArray nothing happens - you -should delete the it manually if required: +should delete it manually if required: \begin{verbatim} T *item = array[n]; @@ -552,11 +551,11 @@ elements of a wxArray (supposed to contain pointers). \func{\void}{RemoveAt}{\param{size\_t }{index}} -Removes the element from the array either by index. When an element +Removes an element from the array by index. When an element is removed from wxObjArray it is deleted by the array - use \helpref{Detach()}{wxobjarraydetach} if you don't want this to happen. On the other hand, when an object is removed from a wxArray nothing happens - you -should delete the it manually if required: +should delete it manually if required: \begin{verbatim} T *item = array[n]; diff --git a/docs/latex/wx/arrstrng.tex b/docs/latex/wx/arrstrng.tex index dc15f1dd0f..71f698a11c 100644 --- a/docs/latex/wx/arrstrng.tex +++ b/docs/latex/wx/arrstrng.tex @@ -80,6 +80,20 @@ reasons it is not virtual, so this class should not be derived from. Assignment operator. +\membersection{wxArrayString::operator==}\label{wxarraystringoperatorequal} + +\constfunc{bool}{operator $==$}{\param{const wxArrayString\&}{ array}} + +Compares 2 arrays respecting the case. Returns TRUE only if the arrays have +the same number of elements and the same strings in the same order. + +\membersection{wxArrayString::operator!=}\label{wxarraystringoperatornotequal} + +\constfunc{bool}{operator $!=$}{\param{const wxArrayString\&}{ array}} + +Compares 2 arrays respecting the case. Returns TRUE if the arrays have +different number of elements or if the elements don't match pairwise. + \membersection{wxArrayString::operator[]}\label{wxarraystringoperatorindex} \func{wxString\&}{operator[]}{\param{size\_t }{nIndex}} @@ -205,23 +219,19 @@ Returns the last element of the array. Attempt to access the last element of an empty array will result in assert failure in debug build, however no checks are done in release mode. -\membersection{wxArrayString::Remove (by value)}\label{wxarraystringremoveval} +\membersection{wxArrayString::Remove}\label{wxarraystringremove} \func{void}{Remove}{\param{const char *}{ sz}} Removes the first item matching this value. An assert failure is provoked by an attempt to remove an element which does not exist in debug build. -See also: \helpref{Index}{wxarraystringindex}, \helpref{Remove}{wxarraystringremove} - -\membersection{wxArrayString::Remove (by index)}\label{wxarraystringremove} +See also: \helpref{Index}{wxarraystringindex} \func{void}{Remove}{\param{size\_t }{nIndex}} Removes the item at given position. -See also: \helpref{Remove}{wxarraystringremoveval} - \membersection{wxArrayString::Shrink}\label{wxarraystringshrink} \func{void}{Shrink}{\void} @@ -231,7 +241,7 @@ minimize the array memory consumption. See also: \helpref{Alloc}{wxarraystringalloc}, \helpref{Dynamic array memory management}{wxarraymemorymanagement} -\membersection{wxArrayString::Sort (alphabetically)}\label{wxarraystringsort} +\membersection{wxArrayString::Sort}\label{wxarraystringsort} \func{void}{Sort}{\param{bool}{ reverseOrder = FALSE}} @@ -242,10 +252,6 @@ Sorts the array in alphabetical order or in reverse alphabetical order if could break the order of items and, for example, subsequent calls to \helpref{Index()}{wxarraystringindex} would then not work! -See also: \helpref{Sort}{wxarraystringsortcallback} - -\membersection{wxArrayString::Sort (user defined)}\label{wxarraystringsortcallback} - \func{void}{Sort}{\param{CompareFunction }{compareFunction}} Sorts the array using the specified {\it compareFunction} for item comparison. @@ -280,5 +286,3 @@ array.Sort(CompareStringLen); could break the order of items and, for example, subsequent calls to \helpref{Index()}{wxarraystringindex} would then not work! -See also: \helpref{Sort}{wxarraystringsort} - diff --git a/docs/latex/wx/back.gif b/docs/latex/wx/back.gif index 8a61076d3ba74bdedc1d24f60c3d1f5a361a6cee..88a3740f9134d7a569b56a9f76e6aa552672993e 100644 GIT binary patch literal 978 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0fnz;`IEReKh6M+kIfS)hPHb3s zxLrWmYmUc8MFs{@V=tBk4vcQS3gSg?UKlR%Y*zN1W>fj;(a}CV`%O8V#mmmJDyQBv znOUrUdY)b7H6AG;jlf>Rey!M3TUK6P?i!m{q7|$j(iU2nb+j@t;aY#t_B`I%AGL2Z zO6>3Q?Jm>3v>|kImhI|mtHW1|tWDEBQI>amZ`s68xzaas@2+e3%;$D{>W3T0V&ot1 Q_1d}V>FF7|>?{n{02fm-00000 literal 225 zcmV<703QEGNk%v~VLt#E0Pz3-zrVld=jU&4Z(9HWEC2ui06zd20008IjE||y?GK}z zNf>~$-n{z{YJwGn=81mem9{RpmcUHc_KoNIPRH~B4DyD9p%LJl6@Sa4^Epcbno6kk zD5XxT&EQg7><X(t<v2<zGtFvpm%NS3x723V`)<ec-&(({)sqHiQ-=rlS4S8Ibd!~% zh!dt38EIxWIOn%1Dfj2b8T!~6YUzo%W;uEjc(%yY2)pMhb!7`xd#gK?yX%Y7`zwsb bGHgs7FrvK7-0b`e9qpVfU2T0WT>t<(Iwfoo diff --git a/docs/latex/wx/bbutton.tex b/docs/latex/wx/bbutton.tex index 4aa48eeba7..14d993ffe5 100644 --- a/docs/latex/wx/bbutton.tex +++ b/docs/latex/wx/bbutton.tex @@ -20,7 +20,7 @@ almost any other window. A bitmap button can be supplied with a single bitmap, and wxWindows will draw all button states using this bitmap. If the application needs more control, additional bitmaps for -the selected state, unpressed focussed state, and greyed-out state may be supplied. +the selected state, unpressed focused state, and greyed-out state may be supplied. \wxheading{Window styles} @@ -29,7 +29,11 @@ the selected state, unpressed focussed state, and greyed-out state may be suppli \twocolitem{\windowstyle{wxBU\_AUTODRAW}}{If this is specified, the button will be drawn automatically using the label bitmap only, providing a 3D-look border. If this style is not specified, the button will be drawn without borders and using all -provided bitmaps.} +provided bitmaps. WIN32 only.} +\twocolitem{\windowstyle{wxBU\_LEFT}}{Left-justifies the bitmap label. WIN32 only.} +\twocolitem{\windowstyle{wxBU\_TOP}}{Aligns the bitmap label to the top of the button. WIN32 only.} +\twocolitem{\windowstyle{wxBU\_RIGHT}}{Right-justifies the bitmap label. WIN32 only.} +\twocolitem{\windowstyle{wxBU\_BOTTOM}}{Aligns the bitmap label to the bottom of the button. WIN32 only.} \end{twocollist} See also \helpref{window styles overview}{windowstyles}. @@ -115,7 +119,7 @@ Button creation function for two-step creation. For more details, see \helpref{w \membersection{wxBitmapButton::GetBitmapDisabled}\label{wxbitmapbuttongetbitmapdisabled} -\constfunc{wxBitmap\&}{GetBitmapLabel}{\void} +\constfunc{wxBitmap\&}{GetBitmapDisabled}{\void} Returns the bitmap for the disabled state. @@ -131,11 +135,11 @@ A reference to the disabled state bitmap. \constfunc{wxBitmap\&}{GetBitmapFocus}{\void} -Returns the bitmap for the focussed state. +Returns the bitmap for the focused state. \wxheading{Return value} -A reference to the focussed state bitmap. +A reference to the focused state bitmap. \wxheading{See also} diff --git a/docs/latex/wx/bitmap.tex b/docs/latex/wx/bitmap.tex index fa15dd36d3..b639c4d397 100644 --- a/docs/latex/wx/bitmap.tex +++ b/docs/latex/wx/bitmap.tex @@ -55,7 +55,7 @@ portable programs: in this case the {\it bits} parameter should contain an XBM image. For other bit depths, the behaviour is platform dependent: under Windows, the -data is passed withotu any changes to the underlying {\tt CreateBitmap()} API. +data is passed without any changes to the underlying {\tt CreateBitmap()} API. Under other platforms, only monochrome bitmaps may be created using this constructor and \helpref{wxImage}{wximage} should be used for creating colour bitmaps from static data. @@ -505,20 +505,14 @@ Sets the validity member (does not affect the bitmap data). \membersection{wxBitmap::SetPalette}\label{wxbitmapsetpalette} -\func{void}{SetPalette}{\param{wxPalette* }{palette}} +\func{void}{SetPalette}{\param{const wxPalette\& }{palette}} -Sets the associated palette: it will be deleted in the wxBitmap -destructor, so if you do not wish it to be deleted automatically, -reset the palette to NULL before the bitmap is deleted. +Sets the associated palette. \wxheading{Parameters} \docparam{palette}{The palette to set.} -\wxheading{Remarks} - -The bitmap object owns the palette once this has been called. - \wxheading{See also} \helpref{wxPalette}{wxpalette} diff --git a/docs/latex/wx/body.tex b/docs/latex/wx/body.tex index e19128f347..f78cce22ce 100644 --- a/docs/latex/wx/body.tex +++ b/docs/latex/wx/body.tex @@ -86,7 +86,7 @@ in Windows Help, HTML and Word RTF formats. \item Simple-to-use, object-oriented API. \item Flexible event system. \item Graphics calls include lines, rounded rectangles, splines, polylines, etc. -\item Constraint-based and sizer-based layouting. +\item Constraint-based and sizer-based layouts. \item Print/preview and document/view architectures. \item Toolbar, notebook, tree control, advanced list control classes. \item PostScript generation under Unix, normal MS Windows printing on the PC. @@ -99,7 +99,7 @@ them to the clipboard. \item Ready-to-use HTML window (supporting a subset of HTML). \item Dialog Editor for building dialogs. \item Network support via a family of socket and protocol classes. -\item Support for platform independent image procesing. +\item Support for platform independent image processing. \item Built-in support for many file formats (BMP, PNG, JPEG, GIF, XPM, PNM, PCX). \end{itemize} @@ -123,7 +123,7 @@ Additions and changes: \begin{itemize}\itemsep=0pt \item class hierarchy changed, and restrictions about subwindow nesting lifted; -\item header files reorganised to conform to normal C++ standards; +\item header files reorganized to conform to normal C++ standards; \item classes less dependent on each another, to reduce executable size; \item wxString used instead of char* wherever possible; \item the number of separate but mandatory utilities reduced; @@ -190,7 +190,7 @@ Additions and changes: \item Many optical improvements to GTK port. \item Support for menu accelerators in GTK port. \item Enhanced and improved support for scrolling, including child windows. -\item Complete rewrite of clipboard and drag'n'drop classes. +\item Complete rewrite of clipboard and drag and drop classes. \item Improved support for ODBC databases. \item Improved tab traversal in dialogs. \end{itemize} @@ -449,7 +449,7 @@ fine on some platforms, and then fail under Windows. \section{Architecture dependency} A problem which sometimes arises from writing multi-platform programs is that -the basic C types are not defiend the same on all platforms. This holds true +the basic C types are not defined the same on all platforms. This holds true for both the length in bits of the standard types (such as int and long) as well as their byte order, which might be little endian (typically on Intel computers) or big endian (typically on some Unix workstations). wxWindows @@ -492,7 +492,7 @@ its own run-time type information system, implemented using macros. Some compilers (e.g. the native IRIX cc) define NULL to be 0L so that no conversion to pointers is allowed. Because of that, all these -occurences of NULL in the GTK port use an explicit conversion such +occurrences of NULL in the GTK port use an explicit conversion such as {\small @@ -527,7 +527,7 @@ X and Windows parts of the library) conditional compilation that under Unix, includes a minimal set of headers; and when using Visual C++, includes {\tt wx.h}. This should help provide the optimal compilation for each compiler, although it is -biassed towards the precompiled headers facility available +biased towards the precompiled headers facility available in Microsoft C++. \section{File handling} @@ -577,7 +577,7 @@ more easily accessed via the Contributions page on the Web site. wxHelp is a stand-alone program, written using wxWindows, for displaying hypertext help. It is necessary since not all target systems (notably X) supply an adequate -standard for on-line help. wxHelp is modelled on the MS Windows help +standard for on-line help. wxHelp is modeled on the MS Windows help system, with contents, search and browse buttons, but does not reformat text to suit the size of window, as WinHelp does, and its input files are uncompressed ASCII with some embedded font commands and an .xlp @@ -690,9 +690,9 @@ it can alert you to problems later on. \subsection{Use wxString in preference to character arrays} Using wxString can be much safer and more convenient than using char *. -Again, I haven't practised what I'm preaching, but I'm now trying to use +Again, I haven't practiced what I'm preaching, but I'm now trying to use wxString wherever possible. You can reduce the possibility of memory -leaks substantially, and it's much more convenient to use the overloaded +leaks substantially, and it is much more convenient to use the overloaded operators than functions such as strcmp. wxString won't add a significant overhead to your program; the overhead is compensated for by easier manipulation (which means less code). @@ -721,7 +721,7 @@ kinds of bitmap depending on platform (see the section on resource files). \subsection{Positive thinking} -It's common to blow up the problem in one's imagination, so that it seems to threaten +It is common to blow up the problem in one's imagination, so that it seems to threaten weeks, months or even years of work. The problem you face may seem insurmountable: but almost never is. Once you have been programming for some time, you will be able to remember similar incidents that threw you into the depths of despair. But @@ -748,8 +748,8 @@ deallocation, this can still give totally spurious results! \subsection{Use a debugger} -This sounds like facetious advice, but it's surprising how often people -don't use a debugger. Often it's an overhead to install or learn how to +This sounds like facetious advice, but it is surprising how often people +don't use a debugger. Often it is an overhead to install or learn how to use a debugger, but it really is essential for anything but the most trivial programs. @@ -778,13 +778,13 @@ See the \helpref{debugging overview}{debuggingoverview} for further information. \subsection{Check Windows debug messages} -Under Windows, it's worth running your program with +Under Windows, it is worth running your program with \urlref{DbgView}{http://www.sysinternals.com} running or -some other program that shows Windows-generated debug messages. It's -possible it'll show invalid handles being used. You may have fun seeing +some other program that shows Windows-generated debug messages. It is +possible it will show invalid handles being used. You may have fun seeing what commercial programs cause these normally hidden errors! Microsoft recommend using the debugging version of Windows, which shows up even -more problems. However, I doubt it's worth the hassle for most +more problems. However, I doubt it is worth the hassle for most applications. wxWindows is designed to minimize the possibility of such errors, but they can still happen occasionally, slipping through unnoticed because they are not severe enough to cause a crash. diff --git a/docs/latex/wx/books.gif b/docs/latex/wx/books.gif index 036d016fb16b793dd714a3916251f59b7efc654d..118aa0a8192c37c9bb6485f20b5ade0301fc555e 100644 GIT binary patch delta 339 zcmV-Z0j&P=0k{K@Lk|f6EC2ui051S8000F3Fp*L(e}EQpxqBe2HDW>*)g^0Isllmo z%?`oGV+RBn#?J$~J>9+EZa7RvEBO6sYk7Eh2M7d+2smwjfJt_Dd58pZhl(D9V+Cpt z1%Z%wlbnW#ADIA+o{xi~oNA<(MFwh`YK~t9t(;(_1ekZ4jdcKst~61jmOj9!oT@^) z$GcsJf4;JjsX?vC$kNFKu^FeS(MHqfz1Mhu<!apL-{BYI<=y7)_SB^snTRa#U}(65 z_ez;KVBr1*4Cw9(K6KUiAvE#No40ol<B0=eNg+WRW)3a#is&IxMTQFpW-Mr}Lr0Ys zL4JI-uVg}kDFqs<CXd5QoiXpZ;z`0JPK;`ZIi~oT&y_i)H;k@ynn+6mrpDAvYH3xf lu}M9({Nx1IDh8=#&0=_2Rjr1t;M{J2Dz~oPyLcl206T3@oW%eD delta 139 zcmV;60CfMj1M&foLk|xCEC2ui051S8000F3@R3q4ajye%IYc~;PM9o8OYUA)sUb_+ z&ZGj#7ibti4^m*w3uw3NZY_&e==Xzacz1VK1cp{0asYmRbarEHh6Hd31c*M5ixUNa t4?CHX69<(9iJ6R?j**5Iqm~|Z5@Q7tjY)N(6g4fRu&0buJFL1+u9rQ}GnW7W diff --git a/docs/latex/wx/boxsizer.tex b/docs/latex/wx/boxsizer.tex index 638ceca882..2db19fd414 100644 --- a/docs/latex/wx/boxsizer.tex +++ b/docs/latex/wx/boxsizer.tex @@ -3,7 +3,7 @@ The basic idea behind a box sizer is that windows will most often be laid out in rather simple basic geomerty, typically in a row or a column or several hierachies of either. -As an exmaple, we will construct a dialog that will contain a text field at the top and +As an example, we will construct a dialog that will contain a text field at the top and two buttons at the bottom. This can be seen as a top-hierarchy column with the text at the top and buttons at the bottom and a low-hierchary row with an OK button to the left and a Cancel button to the right. In many cases (particulary dialogs under Unix and @@ -14,7 +14,7 @@ a thin border around all controls to make the dialog look nice and - to make mat the buttons shall be centred as the width of the dialog changes. It is the unique feature of a box sizer, that it can grow in both directions (height and -width) but can distribute its growth in the main direction (horizontal for a row) {\it unevenly} +width) but can distribute its growth in the main direction (horizontal for a row) {\it unevenly} among its children. In our example case, the vertical sizer is supposed to propagate all its height changes to only the text area, not to the button area. This is determined by the {\it option} parameter when adding a window (or another sizer) to a sizer. It is interpreted @@ -24,8 +24,8 @@ relative to the sum of all weight factors of the sizer, so when adding two windo a value of 1, they will both get resized equally much and each half as much as the sizer owning them. Then what do we do when a column sizer changes its width? This behaviour is controlled by {\it flags} (the second parameter of the Add() function): Zero or no flag -indicates that the window will preserve it's original size, wxGROW flag (same as wxEXPAND) -forces the window to grow with the sizer, and wxSHAPED flag tells the window to change it's +indicates that the window will preserve it is original size, wxGROW flag (same as wxEXPAND) +forces the window to grow with the sizer, and wxSHAPED flag tells the window to change it is size proportionally, preserving original aspect ratio. When wxGROW flag is not used, the item can be aligned within available space. wxALIGN\_LEFT, wxALIGN\_TOP, wxALIGN\_RIGHT, wxALIGN\_BOTTOM, wxALIGN\_CENTER\_HORIZONTAL and wxALIGN\_CENTER\_VERTICAL do what they say. @@ -35,7 +35,7 @@ wxALIGN\_CENTER\_VERTICAL). Default alignment is wxALIGN\_LEFT | wxALIGN\_TOP. As mentioned above, any window belonging to a sizer may have border, and it can be specified which of the four sides may have this border, using the wxTOP, wxLEFT, wxRIGHT and wxBOTTOM constants or wxALL for all directions (and you may also use wxNORTH, wxWEST etc instead). These -flags can be used in combintaion with the alignement flags above as the second paramter of the +flags can be used in combination with the alignment flags above as the second parameter of the Add() method using the binary or operator |. The sizer of the border also must be made known, and it is the third parameter in the Add() method. This means, that the entire behaviour of a sizer and its children can be controlled by the three parameters of the Add() method. diff --git a/docs/latex/wx/button.tex b/docs/latex/wx/button.tex index d4b848e12f..966fa06461 100644 --- a/docs/latex/wx/button.tex +++ b/docs/latex/wx/button.tex @@ -18,7 +18,13 @@ almost any other window. \wxheading{Window styles} -There are no special styles for wxButton. +\twocolwidtha{5cm}% +\begin{twocollist}\itemsep=0pt +\twocolitem{\windowstyle{wxBU\_LEFT}}{Left-justifies the label. WIN32 only.} +\twocolitem{\windowstyle{wxBU\_TOP}}{Aligns the label to the top of the button. WIN32 only.} +\twocolitem{\windowstyle{wxBU\_RIGHT}}{Right-justifies the bitmap label. WIN32 only.} +\twocolitem{\windowstyle{wxBU\_BOTTOM}}{Aligns the label to the bottom of the button. WIN32 only.} +\end{twocollist} See also \helpref{window styles overview}{windowstyles}. diff --git a/docs/latex/wx/calctrl.tex b/docs/latex/wx/calctrl.tex index de9d266b42..1142228f1f 100644 --- a/docs/latex/wx/calctrl.tex +++ b/docs/latex/wx/calctrl.tex @@ -6,18 +6,443 @@ %% Created: 03.01.00 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxCalendarCtrl}}\label{wxcalendarctrl} -The calendar control allows the user to pick a date interactively. +The calendar control allows the user to pick a date interactively. For this, +it displays a window containing several parts: the control to pick the month +and the year at the top (either or both of them may be disabled) and a month +area below them which shows all the days in the month. The user can move the +current selection using the keyboard and select the date (generating +{\tt EVT\_CALENDAR} event) by pressing {\tt <Return>} or double clicking it. + +It has advanced possibilities for the customization of its display. All global +settings (such as colours and fonts used) can, of course, be changed. But +also, the display style for each day in the month can be set independently +using \helpref{wxCalendarDateAttr}{wxcalendardateattr} class. + +An item without custom attributes is drawn with the default colours and +font and without border, but setting custom attributes with +\helpref{SetAttr}{wxcalendarctrlsetattr} allows to modify its appearance. Just +create a custom attribute object and set it for the day you want to be +displayed specially (note that the control will take ownership of the pointer, +i.e. it will delete it itself). A day may be marked as being a holiday, even +if it is not reckognized as oen by \helpref{wxDateTime}{tdateholidays} using +\helpref{SetHoliday}{wxcalendardateattrsetholiday} method. + +As the attributes are specified for each day, they may change when the month +is changed, so you will often want to update them in +{\tt EVT\_CALENDAR\_MONTH} event handler. + +\wxheading{Derived from} + +\helpref{wxControl}{wxcontrol}\\ +\helpref{wxWindow}{wxwindow}\\ +\helpref{wxEvtHandler}{wxevthandler}\\ +\helpref{wxObject}{wxobject} \wxheading{Include files} <wx/calctrl.h> -\wxheading{See also:} +\wxheading{Window styles} + +\twocolwidtha{5cm} +\begin{twocollist}\itemsep=4pt +\twocolitem{\windowstyle{wxCAL\_SUNDAY\_FIRST}}{Show Sunday as the first day in the week} +\twocolitem{\windowstyle{wxCAL\_MONDAY\_FIRST}}{Show Monday as the first day in the week} +\twocolitem{\windowstyle{wxCAL\_SHOW\_HOLIDAYS}}{Highlight holidays in the calendar} +\twocolitem{\windowstyle{wxCAL\_NO\_YEAR\_CHANGE}}{Disable the year changing} +\twocolitem{\windowstyle{wxCAL\_NO\_MONTH\_CHANGE}}{Disable the month (and, implicitly, the year) changing} +\end{twocollist} + +The default calendar style is {\tt wxCAL\_SHOW\_HOLIDAYS}. + +\wxheading{Event table macros} + +To process input from a calendar control, use these event handler macros to +direct input to member functions that take a +\helpref{wxCalendarEvent}{wxcalendarevent} argument. + +\twocolwidtha{7cm} +\begin{twocollist}\itemsep=7pt +\twocolitem{{\bf EVT\_CALENDAR(id, func)}}{A day was double clickedi n the calendar.} +\twocolitem{{\bf EVT\_CALENDAR\_SEL\_CHANGED(id, func)}}{The selected date changed.} +\twocolitem{{\bf EVT\_CALENDAR\_DAY(id, func)}}{The selected day changed.} +\twocolitem{{\bf EVT\_CALENDAR\_MONTH(id, func)}}{The selected month changed.} +\twocolitem{{\bf EVT\_CALENDAR\_YEAR(id, func)}}{The selected year changed.} +\twocolitem{{\bf EVT\_CALENDAR\_WEEKDAY\_CLICKED(id, func)}}{User clicked on the week day header} +\end{twocollist}% + +Note that changing the selected date will result in either of +{\tt EVT\_CALENDAR\_DAY}, {\tt MONTH} or {\tt YEAR} events and +{\tt EVT\_CALENDAR\_SEL\_CHANGED} one. + +\wxheading{Constants} + +The following are the possible return values for +\helpref{HitTest}{wxcalendarctrlhittest} method: +{\small \begin{verbatim} +enum wxCalendarHitTestResult +\{ + wxCAL_HITTEST_NOWHERE, // outside of anything + wxCAL_HITTEST_HEADER, // on the header (weekdays) + wxCAL_HITTEST_DAY // on a day in the calendar +\}; +\end{verbatim}} + +\wxheading{See also} + +\helpref{Calendar sample}{samplecalendar}\\ +\helpref{wxCalendarDateAttr}{wxcalendardateattr}\\ +\helpref{wxCalendarEvent}{wxcalendarevent} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxCalendarCtrl::wxCalendarCtrl}\label{wxcalendarctrlwxcalendarctrldef} + +\func{}{wxCalendarCtrl}{\void} + +Default constructor, use \helpref{Create}{wxcalendarctrlcreate} after it. + +\membersection{wxCalendarCtrl::wxCalendarCtrl}\label{wxcalendarctrlwxcalendarctrl} + +\func{}{wxCalendarCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxDateTime\& }{date = wxDefaultDateTime}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxCAL\_SHOW\_HOLIDAYS}, \param{const wxString\& }{name = wxCalendarNameStr}} + +Does the same as \helpref{Create}{wxcalendarctrlcreate} method. + +\membersection{wxCalendarCtrl::Create}\label{wxcalendarctrlcreate} + +\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxDateTime\& }{date = wxDefaultDateTime}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxCAL\_SHOW\_HOLIDAYS}, \param{const wxString\& }{name = wxCalendarNameStr}} + +Creates the control. See \helpref{wxWindow}{wxwindowctor} for the meaning of +the parameters and the control overview for the possible styles. + +\membersection{wxCalendarCtrl::\destruct{wxCalendarCtrl}}\label{wxcalendarctrldtor} + +\func{}{\destruct{wxCalendarCtrl}}{\void} + +Destroys the control. + +\membersection{wxCalendarCtrl::SetDate}\label{wxcalendarctrlsetdate} + +\func{void}{SetDate}{\param{const wxDateTime\& }{date}} + +Sets the current date. + +\membersection{wxCalendarCtrl::GetDate}\label{wxcalendarctrlgetdate} + +\constfunc{const wxDateTime\&}{GetDate}{\void} + +Gets the currently selected date. + +\membersection{wxCalendarCtrl::EnableYearChange}\label{wxcalendarctrlenableyearchange} + +\func{void}{EnableYearChange}{\param{bool }{enable = TRUE}} + +This function should be used instead of changing {\tt wxCAL\_NO\_YEAR\_CHANGE} +style bit directly. It allows or disallows the user to chaneg the year +interactively. + +\membersection{wxCalendarCtrl::EnableMonthChange}\label{wxcalendarctrlenablemonthchange} + +\func{void}{EnableMonthChange}{\param{bool }{enable = TRUE}} + +This function should be used instead of changing +{\tt wxCAL\_NO\_MONTH\_CHANGE} style bit. It allows or disallows the user to +change the month interactively. Note that if the month can not be changed, the +year can not be changed neither. + +\membersection{wxCalendarCtrl::EnableHolidayDisplay}\label{wxcalendarctrlenableholidaydisplay} + +\func{void}{EnableHolidayDisplay}{\param{bool }{display = TRUE}} + +This function should be used instead of changing {\tt wxCAL\_SHOW\_HOLIDAYS} +style bit directly. It enables or disables the special highlighting of the +holidays. + +\membersection{wxCalendarCtrl::SetHeaderColours}\label{wxcalendarctrlsetheadercolours} + +\func{void}{SetHeaderColours}{\param{const wxColour\& }{colFg}, \param{const wxColour\& }{colBg}} + +Set the colours used for painting the weekdays at the top of the control. + +\membersection{wxCalendarCtrl::GetHeaderColourFg}\label{wxcalendarctrlgetheadercolourfg} + +\constfunc{const wxColour\&}{GetHeaderColourFg}{\void} + +Gets the foreground colour of the header part of the calendar window. + +\wxheading{See also} + +\helpref{SetHeaderColours}{wxcalendarctrlsetheadercolours} + +\membersection{wxCalendarCtrl::GetHeaderColourBg}\label{wxcalendarctrlgetheadercolourbg} + +\constfunc{const wxColour\&}{GetHeaderColourBg}{\void} + +Gets the background colour of the header part of the calendar window. + +\wxheading{See also} + +\helpref{SetHeaderColours}{wxcalendarctrlsetheadercolours} + +\membersection{wxCalendarCtrl::SetHighlightColours}\label{wxcalendarctrlsethighlightcolours} + +\func{void}{SetHighlightColours}{\param{const wxColour\& }{colFg}, \param{const wxColour\& }{colBg}} + +Set the colours to be used for highlighting the currently selected date. + +\membersection{wxCalendarCtrl::GetHighlightColourFg}\label{wxcalendarctrlgethighlightcolourfg} + +\constfunc{const wxColour\&}{GetHighlightColourFg}{\void} + +Gets the foreground highlight colour. + +\wxheading{See also} + +\helpref{SetHighlightColours}{wxcalendarctrlsethighlightcolours} + +\membersection{wxCalendarCtrl::GetHighlightColourBg}\label{wxcalendarctrlgethighlightcolourbg} + +\constfunc{const wxColour\&}{GetHighlightColourBg}{\void} + +Gets the background highlight colour. + +\wxheading{See also} + +\helpref{SetHighlightColours}{wxcalendarctrlsethighlightcolours} + +\membersection{wxCalendarCtrl::SetHolidayColours}\label{wxcalendarctrlsetholidaycolours} + +\func{void}{SetHolidayColours}{\param{const wxColour\& }{colFg}, \param{const wxColour\& }{colBg}} + +Sets the colours to be used for the holidays highlighting (only used if the +window style includes {\tt wxCAL\_SHOW\_HOLIDAYS} flag). + +\membersection{wxCalendarCtrl::GetHolidayColourFg}\label{wxcalendarctrlgetholidaycolourfg} + +\constfunc{const wxColour\&}{GetHolidayColourFg}{\void} + +Return the foregound colour currently used for holiday highlighting. + +\wxheading{See also} + +\helpref{SetHolidayColours}{wxcalendarctrlsetholidaycolours} + +\membersection{wxCalendarCtrl::GetHolidayColourBg}\label{wxcalendarctrlgetholidaycolourbg} + +\constfunc{const wxColour\&}{GetHolidayColourBg}{\void} + +Return the background colour currently used for holiday highlighting. + +\wxheading{See also} + +\helpref{SetHolidayColours}{wxcalendarctrlsetholidaycolours} + +\membersection{wxCalendarCtrl::GetAttr}\label{wxcalendarctrlgetattr} + +\constfunc{wxCalendarDateAttr *}{GetAttr}{\param{size\_t }{day}} + +Returns the attribute for the given date (should be in the range $1\ldots31$). + +The returned pointer may be {\tt NULL}. + +\membersection{wxCalendarCtrl::SetAttr}\label{wxcalendarctrlsetattr} + +\func{void}{SetAttr}{\param{size\_t }{day}, \param{wxCalendarDateAttr* }{attr}} + +Associates the attribute with the specified date (in the range $1\ldots31$). + +If the pointer is {\tt NULL}, the items attribute is cleared. + +\membersection{wxCalendarCtrl::SetHoliday}\label{wxcalendarctrlsetholiday} + +\func{void}{SetHoliday}{\param{size\_t }{day}} + +Marks the specified day as being a holiday in the current month. + +\membersection{wxCalendarCtrl::ResetAttr}\label{wxcalendarctrlresetattr} + +\func{void}{ResetAttr}{\param{size\_t }{day}} + +Clears any attributes associated with the given day (in the range +$1\ldots31$). + +\membersection{wxCalendarCtrl::HitTest}\label{wxcalendarctrlhittest} + +\func{wxCalendarHitTestResult}{HitTest}{\param{const wxPoint\& }{pos}, \param{wxDateTime* }{date = NULL}, \param{wxDateTime::WeekDay* }{wd = NULL}} + +Returns one of {\tt wxCAL\_HITTEST\_XXX} +\helpref{constants}{wxcalendarctrl} and fills either {\it date} or +{\it wd} pointer with the corresponding value depending on the hit test code. + +\section{\class{wxCalendarDateAttr}}\label{wxcalendardateattr} + +wxCalendarDateAttr is a custom attributes for a calendar date. The objects of +this class are used with \helpref{wxCalendarCtrl}{wxcalendarctrl}. + +\wxheading{Derived from} + +No base class + +\wxheading{Constants} + +Here are the possible kinds of borders which may be used to decorate a date: + +{\small \begin{verbatim} +enum wxCalendarDateBorder +{ + wxCAL\_BORDER\_NONE, // no border (default) + wxCAL\_BORDER\_SQUARE, // a rectangular border + wxCAL\_BORDER\_ROUND // a round border +} +\end{verbatim}} + +\wxheading{See also} + +\helpref{wxCalendarCtrl}{wxcalendarctrl} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxCalendarDateAttr::wxCalendarDateAttr}\label{wxcalendardateattrwxcalendardateattr} + +\func{}{wxCalendarDateAttr}{\void} + +\func{}{wxCalendarDateAttr}{\param{const wxColour\& }{colText}, \param{const wxColour\& }{colBack = wxNullColour}, \param{const wxColour\& }{colBorder = wxNullColour}, \param{const wxFont\& }{font = wxNullFont}, \param{wxCalendarDateBorder }{border = wxCAL\_BORDER\_NONE}} + +\func{}{wxCalendarDateAttr}{\param{wxCalendarDateBorder }{border}, \param{const wxColour\& }{colBorder = wxNullColour}} + +The constructors. + +\membersection{wxCalendarDateAttr::SetTextColour}\label{wxcalendardateattrsettextcolour} + +\func{void}{SetTextColour}{\param{const wxColour\& }{colText}} + +Sets the text (foreground) colour to use. + +\membersection{wxCalendarDateAttr::SetBackgroundColour}\label{wxcalendardateattrsetbackgroundcolour} + +\func{void}{SetBackgroundColour}{\param{const wxColour\& }{colBack}} + +Sets the text background colour to use. + +\membersection{wxCalendarDateAttr::SetBorderColour}\label{wxcalendardateattrsetbordercolour} + +\func{void}{SetBorderColour}{\param{const wxColour\& }{col}} + +Sets the border colour to use. + +\membersection{wxCalendarDateAttr::SetFont}\label{wxcalendardateattrsetfont} + +\func{void}{SetFont}{\param{const wxFont\& }{font}} + +Sets the font to use. + +\membersection{wxCalendarDateAttr::SetBorder}\label{wxcalendardateattrsetborder} + +\func{void}{SetBorder}{\param{wxCalendarDateBorder }{border}} + +Sets the \helpref{border kind}{wxcalendardateattr} + +\membersection{wxCalendarDateAttr::SetHoliday}\label{wxcalendardateattrsetholiday} + +\func{void}{SetHoliday}{\param{bool }{holiday}} + +Display the date with this attribute as a holiday. + +\membersection{wxCalendarDateAttr::HasTextColour}\label{wxcalendardateattrhastextcolour} + +\constfunc{bool}{HasTextColour}{\void} + +Returns {\tt TRUE} if this item has a non default text foreground colour. + +\membersection{wxCalendarDateAttr::HasBackgroundColour}\label{wxcalendardateattrhasbackgroundcolour} + +\constfunc{bool}{HasBackgroundColour}{\void} + +Returns {\tt TRUE} if this attribute specifies a non default text background colour. + +\membersection{wxCalendarDateAttr::HasBorderColour}\label{wxcalendardateattrhasbordercolour} + +\constfunc{bool}{HasBorderColour}{\void} + +Returns {\tt TRUE} if this attribute specifies a non default border colour. + +\membersection{wxCalendarDateAttr::HasFont}\label{wxcalendardateattrhasfont} + +\constfunc{bool}{HasFont}{\void} + +Returns {\tt TRUE} if this attribute specifies a non default font. + +\membersection{wxCalendarDateAttr::HasBorder}\label{wxcalendardateattrhasborder} + +\constfunc{bool}{HasBorder}{\void} + +Returns {\tt TRUE} if this attribute specifies a non default (i.e. any) border. + +\membersection{wxCalendarDateAttr::IsHoliday}\label{wxcalendardateattrisholiday} + +\constfunc{bool}{IsHoliday}{\void} + +Returns {\tt TRUE} if this attribute specifies that this item should be +displayed as a holiday. + +\membersection{wxCalendarDateAttr::GetTextColour}\label{wxcalendardateattrgettextcolour} + +\constfunc{const wxColour\&}{GetTextColour}{\void} + +Returns the text colour to use for the item with this attribute. + +\membersection{wxCalendarDateAttr::GetBackgroundColour}\label{wxcalendardateattrgetbackgroundcolour} + +\constfunc{const wxColour\&}{GetBackgroundColour}{\void} + +Returns the background colour to use for the item with this attribute. + +\membersection{wxCalendarDateAttr::GetBorderColour}\label{wxcalendardateattrgetbordercolour} + +\constfunc{const wxColour\&}{GetBorderColour}{\void} + +Returns the border colour to use for the item with this attribute. + +\membersection{wxCalendarDateAttr::GetFont}\label{wxcalendardateattrgetfont} + +\constfunc{const wxFont\&}{GetFont}{\void} + +Returns the font to use for the item with this attribute. + +\membersection{wxCalendarDateAttr::GetBorder}\label{wxcalendardateattrgetborder} + +\constfunc{wxCalendarDateBorder}{GetBorder}{\void} + +Returns the \helpref{border}{wxcalendardateattr} to use for the item with this attribute. + +\section{\class{wxCalendarEvent}}\label{wxcalendarevent} + +The wxCalendarEvent class is used together with +\helpref{wxCalendarCtrl}{wxcalendarctrl}. + +\wxheading{See also} + +\helpref{wxCalendarCtrl}{wxcalendarctrl} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxCalendarEvent::GetDate}{wxcalendareventgetdate} + +\constfunc{const wxDateTime&}{GetDate}{\void} + +Returns the date. This function may be called for all event types except +{\tt EVT\_CALENDAR\_WEEKDAY\_CLICKED} one for which it doesn't make sense. + +\membersection{wxCalendarEvent::GetWeekDay}{wxcalendareventgetweekday} + +\constfunc{wxDateTime::WeekDay}{GetWeekDay}{\void} -\helpref{Calendar sample}{samplecalendar} +Returns the week day on which the user clicked in +{\tt EVT\_CALENDAR\_WEEKDAY\_CLICKED} handler. It doesn't make sense to call +this function in other handlers. diff --git a/docs/latex/wx/caret.tex b/docs/latex/wx/caret.tex new file mode 100644 index 0000000000..266915b7c2 --- /dev/null +++ b/docs/latex/wx/caret.tex @@ -0,0 +1,143 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: caret.tex +%% Purpose: wxCaret documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 20.06.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxCaret}}\label{wxcaret} + +A caret is a blinking cursor showing the position where the typed text will +appear. The text controls usually have a caret but wxCaret class also allows +to use a caret in other windows. + +Currently, the caret appears as a rectangle of the given size. In the future, +it will be possible to specify a bitmap to be used for the caret shape. + +A caret is always associated with a window and the current caret can be +retrieved using \helpref{wxWindow::GetCaret}{wxwindowgetcaret}. The same caret +can't be reused in two different windows. + +\wxheading{Derived from} + +No base class + +\wxheading{Data structures} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxCaret::wxCaret}\label{wxcaretwxcaret} + +\func{}{wxCaret}{\void} + +Default constructor: you must use one of Create() functions later. + +\func{}{wxCaret}{\param{wxWindow* }{window}, \param{int }{width}, \param{int }{height}} + +\func{}{wxCaret}{\param{wxWindowBase* }{window}, \param{const wxSize\& }{size}} + +Create the caret of given (in pixels) width and height and associates it +with the given window. + +\membersection{wxCaret::Create}\label{wxcaretcreate} + +\func{bool}{Create}{\param{wxWindowBase* }{window}, \param{int }{width}, \param{int }{height}} + +\func{bool}{Create}{\param{wxWindowBase* }{window}, \param{const wxSize\& }{size}} + +Create the caret of given (in pixels) width and height and associates it +with the given window (same as constructor). + +\membersection{wxCaret::GetBlinkTime}\label{wxcaretgetblinktime} + +\func{static int}{GetBlinkTime}{\void} + +Returns the blink time which is measured in milliseconds and is the time elapsed +between 2 inversions of the caret (blink time of the caret is the same +for all carets, so this functions is static). + +\membersection{wxCaret::GetPosition}\label{wxcaretgetposition} + +\constfunc{void}{GetPosition}{\param{int* }{x}, \param{int* }{y}} + +\constfunc{wxPoint}{GetPosition}{\void} + +Get the caret position (in pixels). + +\membersection{wxCaret::GetSize}\label{wxcaretgetsize} + +\constfunc{void}{GetSize}{\param{int* }{width}, \param{int* }{height}} + +\constfunc{wxSize}{GetSize}{\void} + +Get the caret size. + +\membersection{wxCaret::GetWindow}\label{wxcaretgetwindow} + +\constfunc{wxWindow*}{GetWindow}{\void} + +Get the window the caret is associated with. + +\membersection{wxCaret::Hide}\label{wxcarethide} + +\func{void}{Hide}{\void} + +Same as \helpref{wxCaret::Show(FALSE)}{wxcaretshow}. + +\membersection{wxCaret::IsOk}\label{wxcaretisok} + +\constfunc{bool}{IsOk}{\void} + +Returns TRUE if the caret was created successfully. + +\membersection{wxCaret::IsVisible}\label{wxcaretisvisible} + +\constfunc{bool}{IsVisible}{\void} + +Returns TRUE if the caret is visible and FALSE if it is permanently +hidden (if it is is blinking and not shown currently but will be after the +next blink, this method still returns TRUE). + +\membersection{wxCaret::Move}\label{wxcaretmove} + +\func{void}{Move}{\param{int }{x}, \param{int }{y}} + +\func{void}{Move}{\param{const wxPoint\& }{pt}} + +Move the caret to given position (in logical coordinates). + +\membersection{wxCaret::SetBlinkTime}\label{wxcaretsetblinktime} + +\func{static void}{SetBlinkTime}{\param{int }{milliseconds}} + +Sets the blink time for all the carets. + +\wxheading{Remarks} + +Under Windows, this function will change the blink time for {\bf all} carets +permanently (until the next time it is called), even for the carets in other +applications. + +\wxheading{See also} + +\helpref{GetBlinkTime}{wxcaretgetblinktime} + +\membersection{wxCaret::SetSize}\label{wxcaretsetsize} + +\func{void}{SetSize}{\param{int }{width}, \param{int }{height}} + +\func{void}{SetSize}{\param{const wxSize\& }{size}} + +Changes the size of the caret. + +\membersection{wxCaret::Show}\label{wxcaretshow} + +\func{void}{Show}{\param{bool }{show = TRUE}} + +Shows or hides the caret. Notice that if the caret was hidden $N$ times, it +must be shown $N$ times as well to reappear on the screen. + diff --git a/docs/latex/wx/category.tex b/docs/latex/wx/category.tex index d6c9061649..c9710911c9 100644 --- a/docs/latex/wx/category.tex +++ b/docs/latex/wx/category.tex @@ -17,6 +17,7 @@ Frames may contain windows, and dialog boxes may directly contain controls. \twocolitem{\helpref{wxMDIParentFrame}{wxmdiparentframe}}{MDI parent frame} \twocolitem{\helpref{wxMDIChildFrame}{wxmdichildframe}}{MDI child frame} \twocolitem{\helpref{wxMiniFrame}{wxminiframe}}{A frame with a small title bar} +\twocolitem{\helpref{wxWizard}{wxwizard}}{A wizard dialog.} \twocolitem{\helpref{wxTabbedDialog}{wxtabbeddialog}}{Tabbed dialog (deprecated, use wxNotebook instead)} \end{twocollist} @@ -39,6 +40,8 @@ The following are a variety of classes that are derived from wxWindow. \twocolitem{\helpref{wxPlotWindow}{wxplotwindow}}{A class to display data.} \twocolitem{\helpref{wxSashWindow}{wxsashwindow}}{Window with four optional sashes that can be dragged} \twocolitem{\helpref{wxSashLayoutWindow}{wxsashlayoutwindow}}{Window that can be involved in an IDE-like layout arrangement} +\twocolitem{\helpref{wxWizardPage}{wxwizardpage}}{A base class for the page in wizard dialog.} +\twocolitem{\helpref{wxWizardPageSimple}{wxwizardpagesimple}}{A page in wizard dialog.} \end{twocollist} {\large {\bf Common dialogs}} @@ -61,6 +64,7 @@ in an application. \twocolitem{\helpref{wxPrintDialog}{wxprintdialog}}{Standard print dialog} \twocolitem{\helpref{wxPageSetupDialog}{wxpagesetupdialog}}{Standard page setup dialog} \twocolitem{\helpref{wxMessageDialog}{wxmessagedialog}}{Simple message box dialog} +\twocolitem{\helpref{wxWizard}{wxwizard}}{A wizard dialog.} \end{twocollist} {\large {\bf Controls}} @@ -72,6 +76,7 @@ that are not static can have \helpref{validators}{wxvalidator} associated with t \twocolitem{\helpref{wxControl}{wxcontrol}}{The base class for controls} \twocolitem{\helpref{wxButton}{wxbutton}}{Push button control, displaying text} \twocolitem{\helpref{wxBitmapButton}{wxbitmapbutton}}{Push button control, displaying a bitmap} +\twocolitem{\helpref{wxCalendarCtrl}{wxcalendarctrl}}{Date picker control} \twocolitem{\helpref{wxCheckBox}{wxcheckbox}}{Checkbox control} \twocolitem{\helpref{wxCheckListBox}{wxchecklistbox}}{A listbox with a checkbox to the left of each item} \twocolitem{\helpref{wxChoice}{wxchoice}}{Choice control (a combobox without the editable area)} @@ -81,8 +86,8 @@ that are not static can have \helpref{validators}{wxvalidator} associated with t \twocolitem{\helpref{wxListBox}{wxlistbox}}{A list of strings for single or multiple selection} \twocolitem{\helpref{wxListCtrl}{wxlistctrl}}{A control for displaying lists of strings and/or icons, plus a multicolumn report view} \twocolitem{\helpref{wxTabCtrl}{wxtabctrl}}{Manages several tabs} -\twocolitem{\helpref{wxTextCtrl}{wxtextctrl}}{Single or multline text editing control} -\twocolitem{\helpref{wxTreeCtrl}{wxtreectrl}}{Tree (hierachy) control} +\twocolitem{\helpref{wxTextCtrl}{wxtextctrl}}{Single or multiline text editing control} +\twocolitem{\helpref{wxTreeCtrl}{wxtreectrl}}{Tree (hierarchy) control} \twocolitem{\helpref{wxScrollBar}{wxscrollbar}}{Scrollbar control} \twocolitem{\helpref{wxSpinButton}{wxspinbutton}}{A spin or `up-down' control} \twocolitem{\helpref{wxSpinCtrl}{wxspinctrl}}{A spin control - i.e. spin button and text control} @@ -103,7 +108,7 @@ that are not static can have \helpref{validators}{wxvalidator} associated with t {\large {\bf Window layout}} -There are two different systems for layouting windows (and dialogs in particluar). +There are two different systems for layouting windows (and dialogs in particular). One is based upon so-called sizers and it requires less typing, thinking and calculating and will in almost all cases produce dialogs looking equally well on all platforms, the other is based on so-called constraints and allows for more detailed layouts. @@ -112,6 +117,8 @@ These are the classes relevant to the sizer-based layout. \begin{twocollist}\itemsep=0pt \twocolitem{\helpref{wxSizer}{wxsizer}}{Abstract base class} +\twocolitem{\helpref{wxGridSizer}{wxgridsizer}}{A sizer for laying out windows in a grid with all fields having the same size} +\twocolitem{\helpref{wxFlexGridSizer}{wxflexgridsizer}}{A sizer for laying out windows in a flexible grid} \twocolitem{\helpref{wxBoxSizer}{wxboxsizer}}{A sizer for laying out windows in a row or column} \twocolitem{\helpref{wxStaticBoxSizer}{wxstaticboxsizer}}{Same as wxBoxSizer, but with surrounding static box} \twocolitem{\helpref{wxNotebookSizer}{wxnotebooksizer}}{Sizer to use with the wxNotebook control.} @@ -179,9 +186,11 @@ An event object contains information about a specific event. Event handlers \begin{twocollist}\itemsep=0pt \twocolitem{\helpref{wxActivateEvent}{wxactivateevent}}{A window or application activation event} +\twocolitem{\helpref{wxCalendarEvent}{wxcalendarevent}}{Used with \helpref{wxCalendarCtrl}{wxcalendarctrl}} \twocolitem{\helpref{wxCalculateLayoutEvent}{wxcalculatelayoutevent}}{Used to calculate window layout} \twocolitem{\helpref{wxCloseEvent}{wxcloseevent}}{A close window or end session event} \twocolitem{\helpref{wxCommandEvent}{wxcommandevent}}{An event from a variety of standard controls} +\twocolitem{\helpref{wxDialUpEvent}{wxdialupevent}}{Event send by \helpref{wxDialUpManager}{wxdialupmanager}} \twocolitem{\helpref{wxDropFilesEvent}{wxdropfilesevent}}{A drop files event} \twocolitem{\helpref{wxEraseEvent}{wxeraseevent}}{An erase background event} \twocolitem{\helpref{wxEvent}{wxevent}}{The event base class} @@ -203,10 +212,12 @@ An event object contains information about a specific event. Event handlers \twocolitem{\helpref{wxScrollWinEvent}{wxscrollwinevent}}{A scroll event from scrolled windows} \twocolitem{\helpref{wxSizeEvent}{wxsizeevent}}{A size event} \twocolitem{\helpref{wxSocketEvent}{wxsocketevent}}{A socket event} +\twocolitem{\helpref{wxSpinEvent}{wxspinevent}}{An event from \helpref{wxSpinButton}{wxspinbutton}} \twocolitem{\helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent}}{A system colour change event} \twocolitem{\helpref{wxTabEvent}{wxtabevent}}{A tab control event} \twocolitem{\helpref{wxTreeEvent}{wxtreeevent}}{A tree control event} \twocolitem{\helpref{wxUpdateUIEvent}{wxupdateuievent}}{A user interface update event} +\twocolitem{\helpref{wxWizardEvent}{wxwizardevent}}{A wizard event} \end{twocollist} {\large {\bf Validators}} @@ -227,10 +238,12 @@ user input. These are the data structure classes supported by wxWindows. \begin{twocollist}\itemsep=0pt -\twocolitem{\helpref{wxExpr}{wxexpr}}{A class for flexible I/O} -\twocolitem{\helpref{wxExprDatabase}{wxexprdatabase}}{A class for flexible I/O} +\twocolitem{\helpref{wxCmdLineParser}{wxcmdlineparser}}{Command line parser class} \twocolitem{\helpref{wxDate}{wxdate}}{A class for date manipulation (deprecated in favour of wxDateTime)} +\twocolitem{\helpref{wxDateSpan}{wxdatespan}}{A logical time interval.} \twocolitem{\helpref{wxDateTime}{wxdatetime}}{A class for date/time manipulations} +\twocolitem{\helpref{wxExpr}{wxexpr}}{A class for flexible I/O} +\twocolitem{\helpref{wxExprDatabase}{wxexprdatabase}}{A class for flexible I/O} \twocolitem{\helpref{wxHashTable}{wxhashtable}}{A simple hash table implementation} % \twocolitem{\helpref{wxHashTableLong}{wxhashtablelong}}{A wxHashTable version for storing long data} \twocolitem{\helpref{wxList}{wxlist}}{A simple linked list implementation} @@ -247,6 +260,7 @@ These are the data structure classes supported by wxWindows. \twocolitem{\helpref{wxRealPoint}{wxrealpoint}}{Representation of a point using floating point numbers} \twocolitem{\helpref{wxSize}{wxsize}}{Representation of a size} \twocolitem{\helpref{wxTime}{wxtime}}{A class for time manipulation (deprecated in favour of wxDateTime)} +\twocolitem{\helpref{wxTimeSpan}{wxtimespan}}{A time interval.} \twocolitem{\helpref{wxVariant}{wxvariant}}{A class for storing arbitrary types that may change at run-time} \end{twocollist} @@ -288,7 +302,8 @@ classes, functions and macros. wxWindows provides its own classes for socket based networking. \begin{twocollist}\itemsep=0pt -\twocolitem{\helpref{wxIPV4address}{wxipv4address}}{Represents an Internet adress} +\twocolitem{\helpref{wxDialUpManager}{wxdialupmanager}}{Provides functions to check the status of network connection and to establish one} +\twocolitem{\helpref{wxIPV4address}{wxipv4address}}{Represents an Internet address} \twocolitem{\helpref{wxSocketBase}{wxsocketbase}}{Represents a socket base object} \twocolitem{\helpref{wxSocketClient}{wxsocketclient}}{Represents a socket client} \twocolitem{\helpref{wxSocketServer}{wxsocketserver}}{Represents a socket server} @@ -326,7 +341,7 @@ housekeeping for a document-centric application. \begin{twocollist}\itemsep=0pt \twocolitem{\helpref{wxDocument}{wxdocument}}{Represents a document} \twocolitem{\helpref{wxView}{wxview}}{Represents a view} -\twocolitem{\helpref{wxDocTemplate}{wxdoctemplate}}{Manages the relationship between a document class and a veiw class} +\twocolitem{\helpref{wxDocTemplate}{wxdoctemplate}}{Manages the relationship between a document class and a view class} \twocolitem{\helpref{wxDocManager}{wxdocmanager}}{Manages the documents and views in an application} \twocolitem{\helpref{wxDocChildFrame}{wxdocchildframe}}{A child frame for showing a document view} \twocolitem{\helpref{wxDocParentFrame}{wxdocparentframe}}{A parent frame to contain views} @@ -339,7 +354,7 @@ housekeeping for a document-centric application. \overview{Overview}{printingoverview} A printing and previewing framework is implemented to -make it relatively straighforward to provide document printing +make it relatively straightforward to provide document printing facilities. \begin{twocollist}\itemsep=0pt @@ -432,7 +447,7 @@ capabilities of the various platforms. \twocolitem{\helpref{wxMutex}{wxmutex}}{Mutex class} \twocolitem{\helpref{wxMutexLocker}{wxmutexlocker}}{Mutex locker utility class} \twocolitem{\helpref{wxCriticalSection}{wxcriticalsection}}{Critical section class} -\twocolitem{\helpref{wxCriticalSectionLocker}{wxcriticalsectionlocker}}{ritical section locker utility class} +\twocolitem{\helpref{wxCriticalSectionLocker}{wxcriticalsectionlocker}}{Critical section locker utility class} \twocolitem{\helpref{wxCondition}{wxcondition}}{Condition class} \end{twocollist} @@ -467,7 +482,10 @@ used internally by the HTML classes. \begin{twocollist}\itemsep=0pt \twocolitem{\helpref{wxApp}{wxapp}}{Application class} -\twocolitem{\helpref{wxConfig}{wxconfigbase}}{Classes for configuration reading/writing} +\twocolitem{\helpref{wxCaret}{wxcaret}}{A caret (cursor) object} +\twocolitem{\helpref{wxCmdLineParser}{wxcmdlineparser}}{Command line parser class} +\twocolitem{\helpref{wxConfig}{wxconfigbase}}{Classes for configuration reading/writing (using either INI files or registry)} +\twocolitem{\helpref{wxDllLoader}{wxdllloader}}{Class to work with shared libraries.} \twocolitem{\helpref{wxHelpController}{wxhelpcontroller}}{Family of classes for controlling help windows} \twocolitem{\helpref{wxLayoutAlgorithm}{wxlayoutalgorithm}}{An alternative window layout facility} \twocolitem{\helpref{wxProcess}{wxprocess}}{Process class} @@ -479,6 +497,7 @@ used internally by the HTML classes. \twocolitem{\helpref{wxAutomationObject}{wxautomationobject}}{OLE automation class} \twocolitem{\helpref{wxFontMapper}{wxfontmapper}}{Font mapping, finding suitable font for given encoding} \twocolitem{\helpref{wxEncodingConverter}{wxencodingconverter}}{Encoding conversions} +\twocolitem{\helpref{wxCalendarDateAttr}{wxcalendardateattr}}{Used with \helpref{wxCalendarCtrl}{wxcalendarctrl}} \end{twocollist} {\large {\bf Database classes}} diff --git a/docs/latex/wx/clasinfo.tex b/docs/latex/wx/clasinfo.tex index bdb9e3fa75..66a1bd1f63 100644 --- a/docs/latex/wx/clasinfo.tex +++ b/docs/latex/wx/clasinfo.tex @@ -31,7 +31,7 @@ class, so there is no need to create such objects explicitly in an application. \func{wxObject*}{CreateObject}{\void} Creates an object of the appropriate kind. Returns NULL if the class has not been declared -dynamically createable (typically, it's an abstract class). +dynamically creatable (typically, it is an abstract class). \membersection{wxClassInfo::FindClass} diff --git a/docs/latex/wx/classes.tex b/docs/latex/wx/classes.tex index ab53709cac..3c4b90fc51 100644 --- a/docs/latex/wx/classes.tex +++ b/docs/latex/wx/classes.tex @@ -21,6 +21,7 @@ \input strmbfrd.tex \input calclevt.tex \input calctrl.tex +\input caret.tex \input checkbox.tex \input checklst.tex \input choice.tex @@ -28,6 +29,7 @@ \input clientdc.tex \input clipbrd.tex \input closeevt.tex +\input cmdlpars.tex \input colour.tex \input colordlg.tex \input combobox.tex @@ -40,15 +42,18 @@ \input countstr.tex \input critsect.tex \input crtslock.tex +\input csconv.tex \input custdobj.tex \input cursor.tex \input database.tex \input dataform.tex \input dataobj.tex +\input db.tex \input dobjcomp.tex \input dobjsmpl.tex \input datstrm.tex \input date.tex +\input datespan.tex \input datetime.tex \input dc.tex \input ddeclint.tex @@ -56,8 +61,11 @@ \input ddeservr.tex \input debugcxt.tex \input dialog.tex +\input dialevt.tex +\input dialup.tex \input dir.tex \input dirdlg.tex +\input dllload.tex \input docchfrm.tex \input docmanag.tex \input docmdich.tex @@ -84,6 +92,7 @@ \input filesys.tex \input filesysh.tex \input filetype.tex +\input flexsizr.tex \input fltinstr.tex \input fltoutst.tex \input focusevt.tex @@ -100,6 +109,7 @@ \input glcanvas.tex \input valgen.tex \input grid.tex +\input gridsizr.tex \input hash.tex \input helpinst.tex \input htcell.tex @@ -146,6 +156,10 @@ \input log.tex \input longlong.tex \input mask.tex +\input mbconv.tex +\input mbcnvfil.tex +\input mbcnvut7.tex +\input mbcnvut8.tex \input mdi.tex \input memorydc.tex \input fs_mem.tex @@ -233,6 +247,7 @@ \input strmsock.tex \input spinbutt.tex \input spinctrl.tex +\input spinevt.tex \input splitevt.tex \input splitter.tex \input statbmp.tex @@ -264,13 +279,16 @@ \input txtstrm.tex \input textdlg.tex \input txtdrptg.tex +\input timespan.tex \input valtext.tex +\input table.tex \input textfile.tex \input thread.tex \input time.tex \input timer.tex \input tipprov.tex \input toolbar.tex +\input tooltip.tex \input treectrl.tex \input treeevt.tex \input treelay.tex @@ -283,6 +301,9 @@ \input window.tex \input windowdc.tex \input wnddisbl.tex +\input wizard.tex +\input wizevt.tex +\input wizpage.tex \input zipstrm.tex \input strmzlib.tex \input function.tex diff --git a/docs/latex/wx/cmdlpars.tex b/docs/latex/wx/cmdlpars.tex new file mode 100644 index 0000000000..5fe7725f15 --- /dev/null +++ b/docs/latex/wx/cmdlpars.tex @@ -0,0 +1,451 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: cmdlpars.tex +%% Purpose: wxCmdLineParser documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 27.03.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxCmdLineParser}}\label{wxcmdlineparser} + +wxCmdLineParser is a class for parsing command line. + +It has the following features: +\begin{enumerate} +\item distinguishes options, switches and parameters; allows option grouping +\item allows both short and long options +\item automatically generates the usage message from the command line description +\item does type checks on the options values (number, date, $\ldots$). +\end{enumerate} + +To use it you should follow these steps: +\begin{enumerate} +\item \helpref{construct}{wxcmdlineparserconstruction} an object of this class +giving it the command line to parse and optionally its description or use +{\tt AddXXX()} functions later +\item call {\tt Parse()} +\item use {\tt Found()} to retrieve the results +\end{enumerate} + +In the documentation below the following terminology is used: + +\begin{twocollist}\itemsep=0pt +\twocolitem{switch}{This is a boolean option which can be given or not, but +which doesn't have any value. We use the word switch to distinguish such boolean +options from more generic options like those described below. For example, +{\tt -v} might be a switch meaning "enable verbose mode".} +\twocolitem{option}{Option for us here is something which comes with a value 0 +unlike a switch. For example, {\tt -o:filename} might be an option which allows +to specify the name of the output file.} +\twocolitem{parameter}{This is a required program argument.} +\end{twocollist} + +\wxheading{Derived from} + +No base class + +\wxheading{Include files} + +<wx/cmdline.h> + +\wxheading{Constants} + +The structure wxCmdLineEntryDesc is used to describe the one command +line switch, option or parameter. An array of such structures should be passed +to \helpref{SetDesc()}{wxcmdlineparsersetdesc}. Also, the meanings of parameters +of the {\tt AddXXX()} functions are the same as of the corresponding fields in +this structure: + +\begin{verbatim} +struct wxCmdLineEntryDesc +{ + wxCmdLineEntryType kind; + const wxChar *shortName; + const wxChar *longName; + const wxChar *description; + wxCmdLineParamType type; + int flags; +}; +\end{verbatim} + +The type of a command line entity is in the {\tt kind} field and may be one of +the following constants: +{\small \begin{verbatim} +enum wxCmdLineEntryType +{ + wxCMD\_LINE\_SWITCH, + wxCMD\_LINE\_OPTION, + wxCMD\_LINE\_PARAM, + wxCMD\_LINE\_NONE // use this to terminate the list +} +\end{verbatim}} + +The field {\tt shortName} is the usual, short, name of the switch or the option. +{\tt longName} is the corresponding long name or NULL if the option has no long +name. Both of these fields are unused for the parameters. Both the short and +long option names can contain only letters, digits and the underscores. + +{\tt description} is used by the \helpref{Usage()}{wxcmdlineparserusage} method +to construct a help message explaining the syntax of the program. + +The possible values of {\tt type} which specifies the type of the value accepted +by an option or parameter are: +{\small \begin{verbatim} +enum wxCmdLineParamType +{ + wxCMD\_LINE\_VAL\_STRING, // default + wxCMD\_LINE\_VAL\_NUMBER, + wxCMD\_LINE\_VAL\_DATE, + wxCMD\_LINE\_VAL\_NONE +} +\end{verbatim}} + +Finally, the {\tt flags} field is a combination of the following bit masks: +{\small \begin{verbatim} +enum +{ + wxCMD\_LINE\_OPTION\_MANDATORY = 0x01, // this option must be given + wxCMD\_LINE\_PARAM\_OPTIONAL = 0x02, // the parameter may be omitted + wxCMD\_LINE\_PARAM\_MULTIPLE = 0x04, // the parameter may be repeated + wxCMD\_LINE\_OPTION\_HELP = 0x08, // this option is a help request + wxCMD\_LINE\_NEEDS\_SEPARATOR = 0x10, // must have sep before the value +} +\end{verbatim}} + +Notice that by default (i.e. if flags are just $0$), options are optional (sic) +and each call to \helpref{AddParam()}{wxcmdlineparseraddparam} allows one more +parameter - this may be changed by giving non-default flags to it, i.e. use +{\tt wxCMD\_LINE\_OPTION\_MANDATORY} to require that the option is given and +{\tt wxCMD\_LINE\_PARAM\_OPTIONAL} to make a parameter optional. Also, +{\tt wxCMD\_LINE\_PARAM\_MULTIPLE} may be specified if the programs accepts a +variable number of parameters - but it only can be given for the last parameter +in the command line description. If you use this flag, you will probably need to +use \helpref{GetParamCount}{wxcmdlineparsergetparamcount} to retrieve the number +of parameters effectively specified after calling +\helpref{Parse}{wxcmdlineparserparse}. + +The last flag {\tt wxCMD\_LINE\_NEEDS\_SEPARATOR} can be specified to require a +separator (either a colon, an equal sign or white space) between the option +name and its value. By default, no separator is required. + +\wxheading{See also} + +\helpref{wxApp::argc}{wxappargc} and \helpref{wxApp::argv}{wxappargv}\\ +console sample + +%%%%%%%%%%%%% Methods by group %%%%%%%%%%%%% +\latexignore{\rtfignore{\wxheading{Function groups}}} + +\membersection{Construction}\label{wxcmdlineparserconstruction} + +Before \helpref{Parse}{wxcmdlineparserparse} can be called, the command line +parser object must have the command line to parse and also the rules saying +which switches, options and parameters are valid - this is called command line +description in what follows. + +You have complete freedom of choice as to when specify the required information, +the only restriction is that it must be done before calling +\helpref{Parse}{wxcmdlineparserparse}. + +To specify the command line to parse you may use either one of constructors +accepting it (\helpref{wxCmdLineParser(argc, argv)}{wxcmdlineparserwxcmdlineparserargc} or +\helpref{wxCmdLineParser}{wxcmdlineparserwxcmdlineparserdescargc} usually) or, +if you use \helpref{the default constructor}{wxcmdlineparserwxcmdlineparserdef}, +you can do it later by calling +\helpref{SetCmdLine}{wxcmdlineparsersetcmdlineargc}. + +The same holds for command line description: it can be specified either in +the constructor (\helpref{without command line}{wxcmdlineparserwxcmdlineparserdesc} or +\helpref{together with it}{wxcmdlineparserwxcmdlineparserdescargc}) or +constructed later using either \helpref{SetDesc}{wxcmdlineparsersetdesc} or +combination of \helpref{AddSwitch}{wxcmdlineparseraddswitch}, +\helpref{AddOption}{wxcmdlineparseraddoption} and +\helpref{AddParam}{wxcmdlineparseraddparam} methods. + +Using constructors or \helpref{SetDesc}{wxcmdlineparsersetdesc} uses a (usually +{\tt const static}) table containing the command line description. If you want +to decide which options to acccept during the run-time, using one of the +{\tt AddXXX()} functions above might be preferable. + +\membersection{Customization}\label{wxcmdlineparsercustomization} + +wxCmdLineParser has several global options which may be changed by the +application. All of the functions described in this section should be called +before \helpref{Parse}{wxcmdlineparserparse}. + +First global option is the support for long (also known as GNU-style) options. +The long options are the ones which start with two dashes ({\tt "--"}) and look +like this: {\tt --verbose}, i.e. they generally are complete words and not some +abbreviations of them. As long options are used by more and more applications, +they are enabled by default, but may be disabled with +\helpref{DisableLongOptions}{wxcmdlineparserdisablelongoptions}. + +Another global option is the set of characters which may be used to start an +option (otherwise, the word on the command line is assumed to be a parameter). +Under Unix, {\tt '-'} is always used, but Windows has at least two common +choices for this: {\tt '-'} and {\tt '/'}. Some programs also use {\tt '+'}. +The default is to use what suits most the current platform, but may be changed +with \helpref{SetSwitchChars}{wxcmdlineparsersetswitchchars} method. + +Finally, \helpref{SetLogo}{wxcmdlineparsersetlogo} can be used to show some +application-specific text before the explanation given by +\helpref{Usage}{wxcmdlineparserusage} function. + +\membersection{Parsing command line}\label{wxcmdlineparserparsing} + +After the command line description was constructed and the desiredoptions were +set, you can finally call \helpref{Parse}{wxcmdlineparserparse} method. +It returns $0$ if the command line was correct and was parsed, $-1$ if the help +option was specified (this is a separate case as, normally, the program will +terminate after this) or a positive number if there was an error during the +command line parsing. + +In the latter case, the appropriate error message and usage information are +logged by wxCmdLineParser itself using the standard wxWindows logging functions. + +\membersection{Getting results}\label{wxcmdlineparsergettingresults} + +After calling \helpref{Parse}{wxcmdlineparserparse} (and if it returned $0$), +you may access the results of parsing using one of overloaded {\tt Found()} +methods. + +For a simple switch, you will simply call +\helpref{Found}{wxcmdlineparserfoundswitch} to determine if the switch was given +or not, for an option or a parameter, you will call a version of {\tt Found()} +which also returns the associated value in the provided variable. All +{\tt Found()} functions return TRUE if the switch or option were found in the +command line or FALSE if they were not specified. + +%%%%%%%%%%%%% Methods in alphabetic order %%%%%%%%%%%%% +\helponly{\insertatlevel{2}{ + +\wxheading{Members} + +}} + +\membersection{wxCmdLineParser::wxCmdLineParser}\label{wxcmdlineparserwxcmdlineparserdef} + +\func{}{wxCmdLineParser}{\void} + +Default constructor. You must use +\helpref{SetCmdLine}{wxcmdlineparsersetcmdlineargc} or +\helpref{SetCmdLinelater.}{wxcmdlineparsersetcmdlinestr} later. + +\membersection{wxCmdLineParser::wxCmdLineParser}\label{wxcmdlineparserwxcmdlineparserargc} + +\func{}{wxCmdLineParser}{\param{int }{argc}, \param{char** }{argv}} + +Constructor specifies the command line to parse. This is the traditional +(Unix) command line format. The parameters {\it argc} and {\it argv} have the +same meaning as for {\tt main()} function. + +\membersection{wxCmdLineParser::wxCmdLineParser}\label{wxcmdlineparserwxcmdlineparserstr} + +\func{}{wxCmdLineParser}{\param{const wxString\& }{cmdline}} + +Constructor specifies the command line to parse in Windows format. The parameter +{\it cmdline} has the same meaning as the corresponding parameter of +{\tt WinMain()}. + +\membersection{wxCmdLineParser::wxCmdLineParser}\label{wxcmdlineparserwxcmdlineparserdesc} + +\func{}{wxCmdLineParser}{\param{const wxCmdLineEntryDesc* }{desc}} + +Same as \helpref{wxCmdLineParser}{wxcmdlineparserwxcmdlineparserdef}, but also +specifies the \helpref{command line description}{wxcmdlineparsersetdesc}. + +\membersection{wxCmdLineParser::wxCmdLineParser}\label{wxcmdlineparserwxcmdlineparserdescargc} + +\func{}{wxCmdLineParser}{\param{const wxCmdLineEntryDesc* }{desc}, \param{int }{argc}, \param{char** }{argv}} + +Same as \helpref{wxCmdLineParser}{wxcmdlineparserwxcmdlineparserargc}, but also +specifies the \helpref{command line description}{wxcmdlineparsersetdesc}. + +\membersection{wxCmdLineParser::wxCmdLineParser}\label{wxcmdlineparserwxcmdlineparserdescstr} + +\func{}{wxCmdLineParser}{\param{const wxCmdLineEntryDesc* }{desc}, \param{const wxString\& }{cmdline}} + +Same as \helpref{wxCmdLineParser}{wxcmdlineparserwxcmdlineparserstr}, but also +specifies the \helpref{command line description}{wxcmdlineparsersetdesc}. + +\membersection{wxCmdLineParser::SetCmdLine}\label{wxcmdlineparsersetcmdlineargc} + +\func{void}{SetCmdLine}{\param{int }{argc}, \param{char** }{argv}} + +Set command line to parse after using one of the constructors which don't do it. + +\wxheading{See also} + +\helpref{wxCmdLineParser}{wxcmdlineparserwxcmdlineparserargc} + +\membersection{wxCmdLineParser::SetCmdLine}\label{wxcmdlineparsersetcmdlinestr} + +\func{void}{SetCmdLine}{\param{const wxString\& }{cmdline}} + +Set command line to parse after using one of the constructors which don't do it. + +\wxheading{See also} + +\helpref{wxCmdLineParser}{wxcmdlineparserwxcmdlineparserstr} + +\membersection{wxCmdLineParser::\destruct{wxCmdLineParser}}\label{wxcmdlineparserdtor} + +\func{}{\destruct{wxCmdLineParser}}{\void} + +Frees resources allocated by the object. + +{\bf NB:} destructor is not virtual, don't use this class polymorphically. + +\membersection{wxCmdLineParser::SetSwitchChars}\label{wxcmdlineparsersetswitchchars} + +\func{void}{SetSwitchChars}{\param{const wxString\& }{switchChars}} + +{\it switchChars} contains all characters with which an option or switch may +start. Default is {\tt "-"} for Unix, {\tt "-/"} for Windows. + +\membersection{wxCmdLineParser::EnableLongOptions}\label{wxcmdlineparserenablelongoptions} + +\func{void}{EnableLongOptions}{\param{bool }{enable = TRUE}} + +Enable or disable support for the long options. + +As long options are not (yet) POSIX-compliant, this option allows to disable +them. + +\wxheading{See also} + +\helpref{Customization}{wxcmdlineparsercustomization} + +\membersection{wxCmdLineParser::DisableLongOptions}\label{wxcmdlineparserdisablelongoptions} + +\func{void}{DisableLongOptions}{\void} + +Ientical to \helpref{EnableLongOptions(FALSE)}{wxcmdlineparserenablelongoptions}. + +\membersection{wxCmdLineParser::SetLogo}\label{wxcmdlineparsersetlogo} + +\func{void}{SetLogo}{\param{const wxString\& }{logo}} + +{\it logo} is some extra text which will be shown by +\helpref{Usage}{wxcmdlineparserusage} method. + +\membersection{wxCmdLineParser::SetDesc}\label{wxcmdlineparsersetdesc} + +\func{void}{SetDesc}{\param{const wxCmdLineEntryDesc* }{desc}} + +Construct the command line description + +Take the command line description from the wxCMD\_LINE\_NONE terminated table. + +Example of usage: + +\begin{verbatim} +static const wxCmdLineEntryDesc cmdLineDesc[] = +{ + { wxCMD_LINE_SWITCH, "v", "verbose", "be verbose" }, + { wxCMD_LINE_SWITCH, "q", "quiet", "be quiet" }, + + { wxCMD_LINE_OPTION, "o", "output", "output file" }, + { wxCMD_LINE_OPTION, "i", "input", "input dir" }, + { wxCMD_LINE_OPTION, "s", "size", "output block size", wxCMD_LINE_VAL_NUMBER }, + { wxCMD_LINE_OPTION, "d", "date", "output file date", wxCMD_LINE_VAL_DATE }, + + { wxCMD_LINE_PARAM, NULL, NULL, "input file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE }, + + { wxCMD_LINE_NONE } +}; + +wxCmdLineParser parser; + +parser.SetDesc(cmdLineDesc); +\end{verbatim} + +\membersection{wxCmdLineParser::AddSwitch}\label{wxcmdlineparseraddswitch} + +\func{void}{AddSwitch}{\param{const wxString\& }{name}, \param{const wxString\& }{lng = wxEmptyString}, \param{const wxString\& }{desc = wxEmptyString}, \param{int }{flags = 0}} + +Add a switch {\it name} with an optional long name {\it lng} (no long name if it +is empty, which is default), description {\it desc} and flags {\it flags} to the +command line description. + +\membersection{wxCmdLineParser::AddOption}\label{wxcmdlineparseraddoption} + +\func{void}{AddOption}{\param{const wxString\& }{name}, \param{const wxString\& }{lng = wxEmptyString}, \param{const wxString\& }{desc = wxEmptyString}, \param{wxCmdLineParamType }{type = wxCMD\_LINE\_VAL\_STRING}, \param{int }{flags = 0}} + +Add an option {\it name} with an optional long name {\it lng} (no long name if +it is empty, which is default) taking a value of the given type (string by +default) to the command line description. + +\membersection{wxCmdLineParser::AddParam}\label{wxcmdlineparseraddparam} + +\func{void}{AddParam}{\param{const wxString\& }{desc = wxEmptyString}, \param{wxCmdLineParamType }{type = wxCMD\_LINE\_VAL\_STRING}, \param{int }{flags = 0}} + +Add a parameter of the given {\it type} to the command line description. + +\membersection{wxCmdLineParser::Parse}\label{wxcmdlineparserparse} + +\func{int}{Parse}{\void} + +Parse the command line, return $0$ if ok, $-1$ if {\tt "-h"} or {\tt "--help"} +option was encountered and the help message was given or a positive value if a +syntax error occured. + +\membersection{wxCmdLineParser::Usage}\label{wxcmdlineparserusage} + +\func{void}{Usage}{\void} + +Give the standard usage message describing all program options. It will use the +options and parameters descriptions specified earlier, so the resulting message +will not be helpful to the user unless the descriptions were indeed specified. + +\wxheading{See also} + +\helpref{SetLogo}{wxcmdlineparsersetlogo} + +\membersection{wxCmdLineParser::Found}\label{wxcmdlineparserfoundswitch} + +\constfunc{bool}{Found}{\param{const wxString\& }{name}} + +Returns TRUE if the given switch was found, FALSE otherwise. + +\membersection{wxCmdLineParser::Found}\label{wxcmdlineparserfoundstringoption} + +\constfunc{bool}{Found}{\param{const wxString\& }{name}, \param{wxString* }{value}} + +Returns TRUE if an option taking a string value was found and stores the +value in the provided pointer (which should not be NULL). + +\membersection{wxCmdLineParser::Found}\label{wxcmdlineparserfoundintoption} + +\constfunc{bool}{Found}{\param{const wxString\& }{name}, \param{long* }{value}} + +Returns TRUE if an option taking an integer value was found and stores +the value in the provided pointer (which should not be NULL). + +\membersection{wxCmdLineParser::Found}\label{wxcmdlineparserfounddateoption} + +\constfunc{bool}{Found}{\param{const wxString\& }{name}, \param{wxDateTime* }{value}} + +Returns TRUE if an option taking a date value was found and stores the +value in the provided pointer (which should not be NULL). + +\membersection{wxCmdLineParser::GetParamCount}\label{wxcmdlineparsergetparamcount} + +\constfunc{size\_t}{GetParamCount}{\void} + +Returns the number of parameters found. This function makes sense mostly if you +had used {\tt wxCMD\_LINE\_PARAM\_MULTIPLE} flag. + +\membersection{wxCmdLineParser::GetParam}\label{wxcmdlineparsergetparam} + +\constfunc{wxString}{GetParam}{\param{size\_t }{n = 0u}} + +Returns the value of Nth parameter (as string only for now). + +\wxheading{See also} + +\helpref{GetParamCount}{wxcmdlineparsergetparamcount} + diff --git a/docs/latex/wx/colordlg.tex b/docs/latex/wx/colordlg.tex index 98b10e3407..1d0a57e4f3 100644 --- a/docs/latex/wx/colordlg.tex +++ b/docs/latex/wx/colordlg.tex @@ -19,7 +19,7 @@ This class represents the colour chooser dialog. \latexignore{\rtfignore{\wxheading{Members}}} -\membersection{wxColourDialog::wxColourDialog} +\membersection{wxColourDialog::wxColourDialog}\label{wxcolourdialogwxcolourdialog} \func{}{wxColourDialog}{\param{wxWindow* }{parent}, \param{wxColourData* }{data = NULL}} @@ -36,6 +36,12 @@ data, which will be copied to the colour dialog's colour data. Destructor. +\membersection{wxColourDialog::Create} + +\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxColourData* }{data = NULL}} + +Same as \helpref{constructor}{wxcolourdialogwxcolourdialog}. + \membersection{wxColourDialog::GetColourData} \func{wxColourData\&}{GetColourData}{\void} diff --git a/docs/latex/wx/colour.tex b/docs/latex/wx/colour.tex index 2cd926e19a..b3e69e5ee7 100644 --- a/docs/latex/wx/colour.tex +++ b/docs/latex/wx/colour.tex @@ -222,7 +222,7 @@ The default colour is black. \membersection{wxColourData::SetCustomColour}\label{wxcolourdatasetcustomcolour} -\func{void}{SetColour}{\param{int}{ i}, \param{const wxColour\&}{ colour}} +\func{void}{SetCustomColour}{\param{int}{ i}, \param{const wxColour\&}{ colour}} Sets the {\it i}th custom colour for the colour dialog. {\it i} should be an integer between 0 and 15. diff --git a/docs/latex/wx/combobox.tex b/docs/latex/wx/combobox.tex index c09c0060a5..1615069a70 100644 --- a/docs/latex/wx/combobox.tex +++ b/docs/latex/wx/combobox.tex @@ -16,7 +16,7 @@ A combobox permits a single selection only. Combobox items are numbered from zer \wxheading{Include files} -<wx/combo.h> +<wx/combobox.h> \wxheading{Window styles} diff --git a/docs/latex/wx/conditn.tex b/docs/latex/wx/conditn.tex index 777a3cd226..a58d8b5ff4 100644 --- a/docs/latex/wx/conditn.tex +++ b/docs/latex/wx/conditn.tex @@ -5,12 +5,15 @@ objects. They may be used in a multithreaded application to wait until the given condition becomes true which happens when the condition becomes signaled. For example, if a worker thread is doing some long task and another thread has -to wait until it's finished, the latter thread will wait on the condition +to wait until it is finished, the latter thread will wait on the condition object and the worker thread will signal it on exit (this example is not perfect because in this particular case it would be much better to just \helpref{Wait()}{wxthreadwait} for the worker thread, but if there are several worker threads it already makes much more sense). +Once the thread(s) are signaled, the condition then resets to the not +signaled state, ready to fire again. + \wxheading{Derived from} None. @@ -51,18 +54,16 @@ Signals the object. \membersection{wxCondition::Wait}\label{wxconditionwait} -\func{void}{Wait}{\param{wxMutex\&}{ mutex}} +\func{void}{Wait}{\void} Waits indefinitely. -\func{bool}{Wait}{\param{wxMutex\&}{ mutex}, \param{unsigned long}{ sec}, \param{unsigned long}{ nsec}} +\func{bool}{Wait}{\param{unsigned long}{ sec}, \param{unsigned long}{ nsec}} Waits until a signal is raised or the timeout has elapsed. \wxheading{Parameters} -\docparam{mutex}{wxMutex object.} - \docparam{sec}{Timeout in seconds} \docparam{nsec}{Timeout nanoseconds component (added to {\it sec}).} diff --git a/docs/latex/wx/config.tex b/docs/latex/wx/config.tex index 2e231e1e8c..51e85c0c61 100644 --- a/docs/latex/wx/config.tex +++ b/docs/latex/wx/config.tex @@ -1,7 +1,7 @@ \section{\class{wxConfigBase}}\label{wxconfigbase} wxConfigBase class defines the basic interface of all config classes. It can -not be used by itself (it's an abstract base class) and you'll always use one +not be used by itself (it is an abstract base class) and you will always use one of its derivations: wxIniConfig, wxFileConfig, wxRegConfig or any other. However, usually you don't even need to know the precise nature of the class @@ -118,7 +118,7 @@ support a file system-like hierarchy of keys (files) and groups (directories). As in the file system case, to specify a key in the config class you must use a path to it. Config classes also support the notion of the current group, which makes it possible to use the relative paths. To clarify all this, here -is an example (it's only for the sake of demonstration, it doesn't do anything +is an example (it is only for the sake of demonstration, it doesn't do anything sensible!): \begin{verbatim} @@ -139,11 +139,11 @@ sensible!): wxASSERT( conf->Read("Subgroup/SubgroupEntry", 0l) == 3 ); - // use absolute path: it's allowed, too + // use absolute path: it is allowed, too wxASSERT( conf->Read("/RootEntry", 0l) == 1 ); \end{verbatim} -{\it Warning}: it's probably a good idea to always restore the path to its +{\it Warning}: it is probably a good idea to always restore the path to its old value on function exit: \begin{verbatim} @@ -175,7 +175,7 @@ doesn't save and restore the path): \end{verbatim} Finally, the path separator in wxConfigBase and derived classes is always '/', -regardless of the platform (i.e. it's {\bf not} '$\backslash\backslash$' under Windows). +regardless of the platform (i.e. it is {\bf not} '$\backslash\backslash$' under Windows). \helpref{SetPath}{wxconfigbasesetpath}\\ \helpref{GetPath}{wxconfigbasegetpath} @@ -186,9 +186,9 @@ The functions in this section allow to enumerate all entries and groups in the config file. All functions here return FALSE when there are no more items. You must pass the same index to GetNext and GetFirst (don't modify it). -Please note that it's {\bf not} the index of the current item (you will have +Please note that it is {\bf not} the index of the current item (you will have some great surprizes with wxRegConfig if you assume this) and you shouldn't -even look at it: it's just a "cookie" which stores the state of the +even look at it: it is just a "cookie" which stores the state of the enumeration. It can't be stored inside the class because it would prevent you from running several enumerations simultaneously, that's why you must pass it explicitly. @@ -241,10 +241,11 @@ actually enumerating them, but you will probably never need them. \helpref{Exists}{wxconfigbaseexists}\\ \helpref{GetEntryType}{wxconfigbasegetentrytype} -\membersection{Miscellaneous accessors} +\membersection{Miscellaneous functions} \helpref{GetAppName}{wxconfigbasegetappname}\\ -\helpref{GetVendorName}{wxconfigbasegetvendorname} +\helpref{GetVendorName}{wxconfigbasegetvendorname}\\ +\helpref{SetUmask}{wxfileconfigsetumask} \membersection{Key access} @@ -321,7 +322,7 @@ would be to prefix the offending symbols with a backslash. The following functions control this option: \helpref{IsExpandingEnvVars}{wxconfigbaseisexpandingenvvars}\\ -\helpref{SetExpandingEnvVars}{wxconfigbasesetexpandingenvvars}\\ +\helpref{SetExpandEnvVars}{wxconfigbasesetexpandenvvars}\\ \helpref{SetRecordDefaults}{wxconfigbasesetrecorddefaults}\\ \helpref{IsRecordingDefaults}{wxconfigbaseisrecordingdefaults} @@ -407,8 +408,7 @@ for use by desinstallation routine. \membersection{wxConfigBase::DeleteEntry}\label{wxconfigbasedeleteentry} -\func{bool}{DeleteEntry}{\param{const wxString\& }{ key}, \param{bool}{ -bDeleteGroupIfEmpty = TRUE}} +\func{bool}{DeleteEntry}{\param{const wxString\& }{ key}, \param{bool}{ bDeleteGroupIfEmpty = TRUE}} Deletes the specified entry and the group it belongs to if it was the last key in it and the second parameter is true. @@ -471,8 +471,7 @@ The result is an element of enum EntryType: \membersection{wxConfigBase::GetFirstGroup}\label{wxconfigbasegetfirstgroup} -\constfunc{bool}{GetFirstGroup}{\param{wxString\& }{str}, \param{long\&}{ -index}} +\constfunc{bool}{GetFirstGroup}{\param{wxString\& }{str}, \param{long\&}{ index}} Gets the first group. @@ -482,8 +481,7 @@ the next call.} \membersection{wxConfigBase::GetFirstEntry}\label{wxconfigbasegetfirstentry} -\constfunc{bool}{GetFirstEntry}{\param{wxString\& }{str}, \param{long\&}{ -index}} +\constfunc{bool}{GetFirstEntry}{\param{wxString\& }{str}, \param{long\&}{ index}} Gets the first entry. @@ -493,8 +491,7 @@ the next call.} \membersection{wxConfigBase::GetNextGroup}\label{wxconfigbasegetnextgroup} -\constfunc{bool}{GetNextGroup}{\param{wxString\& }{str}, \param{long\&}{ -index}} +\constfunc{bool}{GetNextGroup}{\param{wxString\& }{str}, \param{long\&}{ index}} Gets the next group. @@ -504,8 +501,7 @@ the next call.} \membersection{wxConfigBase::GetNextEntry}\label{wxconfigbasegetnextentry} -\constfunc{bool}{GetNextEntry}{\param{wxString\& }{str}, \param{long\&}{ -index}} +\constfunc{bool}{GetNextEntry}{\param{wxString\& }{str}, \param{long\&}{ index}} Gets the next entry. @@ -556,20 +552,18 @@ Returns TRUE if we are expanding environment variables in key values. \membersection{wxConfigBase::IsRecordingDefaults}\label{wxconfigbaseisrecordingdefaults} -\func{bool}{IsRecordingDefaults}{\void} const +\constfunc{bool}{IsRecordingDefaults}{\void} Returns TRUE if we are writing defaults back to the config file. \membersection{wxConfigBase::Read}\label{wxconfigbaseread} -\constfunc{bool}{Read}{\param{const wxString\& }{key}, \param{wxString*}{ -str}} +\constfunc{bool}{Read}{\param{const wxString\& }{key}, \param{wxString*}{ str}} Read a string from the key, returning TRUE if the value was read. If the key was not found, {\it str} is not changed. -\constfunc{bool}{Read}{\param{const wxString\& }{key}, \param{wxString*}{ -str}, \param{const wxString\& }{defaultVal}} +\constfunc{bool}{Read}{\param{const wxString\& }{key}, \param{wxString*}{ str}, \param{const wxString\& }{defaultVal}} Read a string from the key. The default value is returned if the key was not found. @@ -592,8 +586,7 @@ not found, {\it l} is not changed. Reads a long value, returning TRUE if the value was found. If the value was not found, {\it defaultVal} is used instead. -\constfunc{long }{Read}{\param{const wxString\& }{key}, \param{long}{ -defaultVal}} +\constfunc{long }{Read}{\param{const wxString\& }{key}, \param{long}{ defaultVal}} Reads a long value from the key and returns it. {\it defaultVal} is returned if the key is not found. @@ -667,7 +660,7 @@ exists. Sets the config object as the current one, returns the pointer to the previous current object (both the parameter and returned value may be NULL) -\membersection{wxConfigBase::SetExpandingEnvVars}\label{wxconfigbasesetexpandingenvvars} +\membersection{wxConfigBase::SetExpandEnvVars}\label{wxconfigbasesetexpandenvvars} \func{void}{SetExpandEnvVars }{\param{bool }{bDoIt = TRUE}} @@ -677,8 +670,8 @@ Determine whether we wish to expand environment variables in key values. \func{void}{SetPath}{\param{const wxString\& }{strPath}} -Set current path: if the first character is '/', it's the absolute path, -otherwise it's a relative path. '..' is supported. If the strPath doesn't +Set current path: if the first character is '/', it is the absolute path, +otherwise it is a relative path. '..' is supported. If the strPath doesn't exist it is created. \membersection{wxConfigBase::SetRecordDefaults}\label{wxconfigbasesetrecorddefaults} @@ -691,6 +684,19 @@ If on (default is off) all default values are written back to the config file. This allows the user to see what config options may be changed and is probably useful only for wxFileConfig. +\membersection{wxConfigBase::SetUmask}\label{wxfileconfigsetumask} + +\func{void}{SetUmask}{\param{int }{mode}} + +{\bf NB:} this function is not in the base wxConfigBase class but is only +implemented in wxFileConfig. Moreover, this function is Unix-specific and +doesn't do anything on other platforms. + +SetUmask() allows to set the mode to be used for the config file creation. +For example, to create a config file which is not readable by other users +(useful if it stores some sensitive information, such as passwords), you +should do {\tt SetUmask(0077)}. + \membersection{wxConfigBase::Write}\label{wxconfigbasewrite} \func{bool}{Write}{\param{const wxString\& }{ key}, \param{const wxString\& }{ @@ -714,7 +720,3 @@ implements the following methods:\par \end{twocollist}} } - - - - diff --git a/docs/latex/wx/contents.gif b/docs/latex/wx/contents.gif index 3dddfa3dd5f0c652e8b27cd6c29e1fdd49ced5a8..723174f81d04d16e94016186ac0322dcddb603c7 100644 GIT binary patch literal 996 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0RsaNgBYV=Gz5lX2>kxA zV8N1xh6Z3tW&ovR5Cx<mX<G3o3nK#qH-ipPlmV0{7&s0xh;ztzY*=uxnL}7B=ER1D zhuZ~|rC1mo6pnTY8GErDXmC8*FXe3Y#N(o}$3zXmNg)dwo-p-jCP#faF-g^PhEd?U zHJO)_&rPwe{C4E0u`<I#r%tiE5uYCg&h~b-%e`5+>e34SwPCqkp^L+21?)C@%eigo zjb6XYK{ltit-ZayK=RQZsqlw)b_u-S7xTMFKYoAy)o)vOlz%vRFz5Xto6e7mgSU6F l8>#t(=cJr!`K{OHv%&EGv6=dhWPNvSd3kw-DjN%fH2`phKPvzL literal 231 zcmV<D02u#ANk%v~VL<>G0Pz3-zrVld=jU&4Z(9HWEC2ui06_p40008OjE||y?GK}z zO&EZ)-n{z{a)K3v=81;mmA0<AmhVhw@iyc`&3|{61I~6YqK~98Vw5OmQ-xfDbjF=- z8N_A**6fx0#r(KaDON}}o43Sv(iTm3lx}qOEl<})aVL6>S4Fj_r^UyThZDG{h6k9m zHI_(7spd!5_$SH6m{<Auh$$AQ#YFX|N5^T`76u^M6AJ<hP-}aOo2$Fa+xtrD8!SAm hOG|u=TnwDd%p5ZU9W6agU2T1B9e};f-Q8UP06VhvYa0Ln diff --git a/docs/latex/wx/csconv.tex b/docs/latex/wx/csconv.tex new file mode 100644 index 0000000000..2d09197bf2 --- /dev/null +++ b/docs/latex/wx/csconv.tex @@ -0,0 +1,60 @@ +% +% automatically generated by HelpGen from +% ../include/wx/strconv.h at 25/Mar/00 10:20:56 +% + +\section{\class{wxCSConv}}\label{wxcsconv} + +This class converts between any character sets and Unicode. +It has one predefined instance, {\bf wxConvLocal}, for the +default user character set. + +\wxheading{Derived from} + +\helpref{wxMBConv}{wxmbconv} + +\wxheading{Include files} + +<wx/strconv.h> + +\wxheading{See also} + +\helpref{wxMBConv}{wxmbconv}, +\helpref{wxEncodingConverter}{wxencodingconverter}, +\helpref{wxMBConv classes overview}{mbconvclasses} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxCSConv::wxCSConv}\label{wxcsconvwxcsconv} + +\func{}{wxCSConv}{\param{const wxChar* }{charset}} + +Constructor. Specify the name of the character set you want to convert +from/to. + +\membersection{wxCSConv::\destruct{wxCSConv}}\label{wxcsconvdtor} + +\func{}{\destruct{wxCSConv}}{\void} + +Destructor. + +\membersection{wxCSConv::LoadNow}\label{wxcsconvloadnow} + +\func{void}{LoadNow}{\void} + +If the conversion tables needs to be loaded from disk, this method +will do so. Otherwise, they will be loaded when any of the conversion +methods are called. + +\membersection{wxCSConv::MB2WC}\label{wxcsconvmb2wc} + +\constfunc{size\_t}{MB2WC}{\param{wchar\_t* }{buf}, \param{const char* }{psz}, \param{size\_t }{n}} + +Converts from the selected character set to Unicode. Returns the size of the destination buffer. + +\membersection{wxCSConv::WC2MB}\label{wxcsconvwc2mb} + +\constfunc{size\_t}{WC2MB}{\param{char* }{buf}, \param{const wchar\_t* }{psz}, \param{size\_t }{n}} + +Converts from Unicode to the selected character set. Returns the size of the destination buffer. + diff --git a/docs/latex/wx/cursor.tex b/docs/latex/wx/cursor.tex index 40c5b81d20..6d0c748903 100644 --- a/docs/latex/wx/cursor.tex +++ b/docs/latex/wx/cursor.tex @@ -155,7 +155,7 @@ hotSpotY=0)}}{Constructs a cursor from a filename} Destroys the cursor. A cursor can be reused for more than one window, and does not get destroyed when the window is destroyed. wxWindows destroys all cursors on application exit, although -it's best to clean them up explicitly. +it is best to clean them up explicitly. \membersection{wxCursor::Ok}\label{wxcursorok} diff --git a/docs/latex/wx/database.tex b/docs/latex/wx/database.tex index 6647678df7..92c5c24936 100644 --- a/docs/latex/wx/database.tex +++ b/docs/latex/wx/database.tex @@ -18,6 +18,12 @@ Note: this class is considered obsolete, replaced by the Remstar wxDB/wxTable cl \overview{wxDatabase overview}{wxdatabaseoverview}, \helpref{wxRecordSet}{wxrecordset} +A much more robust and feature-rich set of ODBC classes is now +available and recommended for use in place of the wxDatabase class. + +See details of these classes in: +\helpref{wxDB}{wxdb}, \helpref{wxTable}{wxtable} + \latexignore{\rtfignore{\wxheading{Members}}} \membersection{wxDatabase::wxDatabase} @@ -74,9 +80,9 @@ and disconnects from the current data source. Commits previous transactions. Not implemented. -\membersection{wxDatabase::ErrorOccured} +\membersection{wxDatabase::ErrorOccurred} -\func{bool}{ErrorOccured}{\void} +\func{bool}{ErrorOccurred}{\void} Returns TRUE if the last action caused an error. @@ -84,7 +90,7 @@ Returns TRUE if the last action caused an error. \func{void}{ErrorSnapshot}{\param{HSTMT}{ statement = SQL\_NULL\_HSTMT}} -This function will be called whenever an ODBC error occured. It stores the +This function will be called whenever an ODBC error occurred. It stores the error related information returned by ODBC. If a statement handle of the concerning ODBC action is available it should be passed to the function. diff --git a/docs/latex/wx/dataform.tex b/docs/latex/wx/dataform.tex index 755b888236..3b9991e140 100644 --- a/docs/latex/wx/dataform.tex +++ b/docs/latex/wx/dataform.tex @@ -6,7 +6,7 @@ %% Created: 03.11.99 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxDataFormat}}\label{wxdataformat} diff --git a/docs/latex/wx/dataobj.tex b/docs/latex/wx/dataobj.tex index f38c7c16b6..5a62f8532e 100644 --- a/docs/latex/wx/dataobj.tex +++ b/docs/latex/wx/dataobj.tex @@ -6,7 +6,7 @@ %% Created: 18.10.99 %% RCS-ID: $Id$ %% Copyright: (c) wxWindows team -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxDataObject}}\label{wxdataobject} diff --git a/docs/latex/wx/datespan.tex b/docs/latex/wx/datespan.tex new file mode 100644 index 0000000000..bef43ef9c2 --- /dev/null +++ b/docs/latex/wx/datespan.tex @@ -0,0 +1,15 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: datespan.tex +%% Purpose: wxDateSpan documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 04.04.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxDateSpan}}\label{wxdatespan} + +The documentation for this section has not yet been written. + diff --git a/docs/latex/wx/datetime.tex b/docs/latex/wx/datetime.tex index b7cd210493..01d8b9e54c 100644 --- a/docs/latex/wx/datetime.tex +++ b/docs/latex/wx/datetime.tex @@ -6,7 +6,7 @@ %% Created: 07.03.00 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxDateTime}}\label{wxdatetime} @@ -88,14 +88,82 @@ Time zone symbolic names: \end{verbatim} Month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec and -Inv\_Month for an invalid.month value are the values of {\tt wxDateTime::Month} +Inv\_Month for an invalid.month value are the values of {\tt wxDateTime::Month} enum. -Likely, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv\_WeekDay are the values in +Likewise, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv\_WeekDay are the values in {\tt wxDateTime::WeekDay} enum. Finally, Inv\_Year is defined to be an invalid value for year parameter. +\helpref{GetMonthName()}{wxdatetimegetmonthname} and +\helpref{GetWeekDayName}{wxdatetimegetweekdayname} functions use the followign +flags: + +\begin{verbatim} + enum NameFlags + { + Name_Full = 0x01, // return full name + Name_Abbr = 0x02 // return abbreviated name + }; +\end{verbatim} + +Several functions accept an extra parameter specifying the calendar to use +(although most of them only support now the Gregorian calendar). This +parameters is one of the following values: + +\begin{verbatim} + enum Calendar + { + Gregorian, // calendar currently in use in Western countries + Julian // calendar in use since -45 until the 1582 (or later) + }; +\end{verbatim} + +Date calculatiosn often depend on the country adn wxDateTime allows to set the +country which conventions should be used using +\helpref{SetCountry}{wxdatetimesetcountry}. It takes one of the following +values as parameter: + +\begin{verbatim} + enum Country + { + Country_Unknown, // no special information for this country + Country_Default, // set the default country with SetCountry() method + // or use the default country with any other + + Country_WesternEurope_Start, + Country_EEC = Country_WesternEurope_Start, + France, + Germany, + UK, + Country_WesternEurope_End = UK, + + Russia, + + USA + }; +\end{verbatim} + +Differnet parst of the world use different conventions for the week start. +In some countries, the week starts on Sunday, while in others - on Monday. +The ISO standard doesn't address this issue, so we support both conventions in +the functions whose result depends on it ( +\helpref{GetWeekOfYear}{wxdatetimegetweekofyear} and +\helpref{GetWeekOfMonth}{wxdatetimegetweekofmonth}). + +The desired behvaiour may be specified by giving one of the following +constants as argument to these functions: + +\begin{verbatim} + enum WeekFlags + { + Default_First, // Sunday_First for US, Monday_First for the rest + Monday_First, // week starts with a Monday + Sunday_First // week starts with a Sunday + }; +\end{verbatim} + \wxheading{Derived from} No base class @@ -106,7 +174,7 @@ No base class \wxheading{See also} -%\helpref{Date classes overview}{wxdatetimeoverview},\rtfsp +\helpref{Date classes overview}{wxdatetimeoverview},\rtfsp wxTimeSpan,\rtfsp wxDateSpan,\rtfsp \helpref{wxCalendarCtrl}{wxcalendarctrl} @@ -120,6 +188,13 @@ either set or return the static variables of wxDateSpan (the country), return the current moment, year, month or number of days in it, or do some general calendar-related actions. +Please note that although several function accept an extra {\it Calendar} +parameter, it is currently ignored as only the Gregorian calendar is +supported. Future versions will support other calendars. + +\pythonnote{These methods are standalone functions named +{\tt wxDateTime_<StaticMethodName>} in wxPython.} + \helpref{SetCountry}{wxdatetimesetcountry}\\ \helpref{GetCountry}{wxdatetimegetcountry}\\ \helpref{IsWestEuropeanCountry}{wxdatetimeiswesteuropeancountry}\\ @@ -137,23 +212,198 @@ calendar-related actions. \helpref{GetBeginDST}{wxdatetimegetbegindst}\\ \helpref{GetEndDST}{wxdatetimegetenddst}\\ \helpref{Now}{wxdatetimenow}\\ +\helpref{UNow}{wxdatetimeunow}\\ \helpref{Today}{wxdatetimetoday} \membersection{Constructors, assignment operators and setters} +Constructors and various {\tt Set()} methods are collected here. If you +construct a date object from separate values for day, month and year, you +should use \helpref{IsValid}{wxdatetimeisvalid} method to check that the +values were correct as constructors can not return an error code. + +\helpref{wxDateTime()}{wxdatetimewxdatetimedef}\\ +\helpref{wxDateTime(time\_t)}{wxdatetimewxdatetimetimet}\\ +\helpref{wxDateTime(struct tm)}{wxdatetimewxdatetimetm}\\ +%\helpref{wxDateTime(struct Tm)}{wxdatetimewxdatetimetm} - Tm not documented yet\\ +\helpref{wxDateTime(double jdn)}{wxdatetimewxdatetimejdn}\\ +\helpref{wxDateTime(h, m, s, ms)}{wxdatetimewxdatetimetime}\\ +\helpref{wxDateTime(day, mon, year, h, m, s, ms)}{wxdatetimewxdatetimedate}\\ +\helpref{SetToCurrent}{wxdatetimesettocurrent}\\ +\helpref{Set(time\_t)}{wxdatetimesettimet}\\ +\helpref{Set(struct tm)}{wxdatetimesettm}\\ +%\helpref{Set(struct Tm)}{wxdatetimesettm} - Tm not documented yet\\ +\helpref{Set(double jdn)}{wxdatetimesetjdn}\\ +\helpref{Set(h, m, s, ms)}{wxdatetimesettime}\\ +\helpref{Set(day, mon, year, h, m, s, ms)}{wxdatetimesetdate}\\ +\helpref{ResetTime}{wxdatetimeresettime}\\ +\helpref{SetYear}{wxdatetimesetyear}\\ +\helpref{SetMonth}{wxdatetimesetmonth}\\ +\helpref{SetDay}{wxdatetimesetdate}\\ +\helpref{SetHour}{wxdatetimesethour}\\ +\helpref{SetMinute}{wxdatetimesetminute}\\ +\helpref{SetSecond}{wxdatetimesetsecond}\\ +\helpref{SetMillisecond}{wxdatetimesetmillisecond}\\ +\helpref{operator$=$(time\_t)}{wxdatetimeoperatoreqtimet}\\ +\helpref{operator$=$(struct tm)}{wxdatetimeoperatoreqtm} +%\helpref{operator$=$(struct Tm)}{wxdatetimeoperatortm2} + \membersection{Accessors} +Here are the trivial accessors. Other functions, which might have to perform +some more complicated calculations to find the answer are under +\helpref{Calendar calculations}{wxdatetimecalculations} section. + +\helpref{IsValid}{wxdatetimeisvalid}\\ +\helpref{GetTicks}{wxdatetimegetticks}\\ +\helpref{GetYear}{wxdatetimegetyear}\\ +\helpref{GetMonth}{wxdatetimegetmonth}\\ +\helpref{GetDay}{wxdatetimegetday}\\ +\helpref{GetWeekDay}{wxdatetimegetweekday}\\ +\helpref{GetHour}{wxdatetimegethour}\\ +\helpref{GeTMinute}{wxdatetimegetminute}\\ +\helpref{GetSecond}{wxdatetimegetsecond}\\ +\helpref{GetMillisecond}{wxdatetimegetmillisecond}\\ +\helpref{GetDayOfYear}{wxdatetimegetdayofyear}\\ +\helpref{GetWeekOfYear}{wxdatetimegetweekofyear}\\ +\helpref{GetWeekOfMonth}{wxdatetimegetweekofmonth}\\ +\helpref{GetYearDay}{wxdatetimegetyearday}\\ +\helpref{IsWorkDay}{wxdatetimeisworkday}\\ +\helpref{IsGregorianDate}{wxdatetimeisgregoriandate} + \membersection{Date comparison} +There are several function to allow date comparison. To supplement them, a few +global operators $>$, $<$ etc taking wxDateTime are defined. + +\helpref{IsEqualTo}{wxdatetimeisequalto}\\ +\helpref{IsEarlierThan}{wxdatetimeisearlierthan}\\ +\helpref{IsLaterThan}{wxdatetimeislaterthan}\\ +\helpref{IsStrictlyBetween}{wxdatetimeisstrictlybetween}\\ +\helpref{IsBetween}{wxdatetimeisbetween}\\ +\helpref{IsSameDate}{wxdatetimeissamedate}\\ +\helpref{IsSameTime}{wxdatetimeissametime}\\ +\helpref{IsEqualUpTo}{wxdatetimeisequalupto} + \membersection{Date arithmetics} +These functions carry out \helpref{arithmetics}{tdatearithm} on the wxDateTime +objects. As explained in the overview, either wxTimeSpan or wxDateSpan may be +added to wxDateTime, hence all functions are overloaded to accept both +arguments. + +Also, both {\tt Add()} and {\tt Subtract()} have both const and non-const +version. The first one returns a new obejct which represents the +sum/difference of the original one with the argument while the second form +modifies the object to which it is applied. The operators $-=$ and $+=$ are +defined to be equivalent to the second forms of these functions. + +\helpref{Add(wxTimeSpan)}{wxdatetimeaddts}\\ +\helpref{Add(wxDateSpan)}{wxdatetimeaddds}\\ +\helpref{Subtract(wxTimeSpan)}{wxdatetimesubtractts}\\ +\helpref{Subtract(wxDateSpan)}{wxdatetimesubtractds}\\ +\helpref{Subtract(wxDateTime)}{wxdatetimesubtractdt}\\ +\helpref{oparator$+=$(wxTimeSpan)}{wxdatetimeaddts}\\ +\helpref{oparator$+=$(wxDateSpan)}{wxdatetimeaddds}\\ +\helpref{oparator$-=$(wxTimeSpan)}{wxdatetimesubtractts}\\ +\helpref{oparator$-=$(wxDateSpan)}{wxdatetimesubtractds} + \membersection{Parsing and formatting dates} -\membersection{Calendar calculations} +These functions perform convert wxDateTime obejcts to and from text. The +conversions to text are mostly trivial: you can either do it using the default +date and time representations for the current locale ( +\helpref{FormatDate}{wxdatetimeformatdate} and +\helpref{FormatTime}{wxdatetimeformattime}), using the international standard +representation defined by ISO 8601 ( +\helpref{FormatISODate}{wxdatetimeformatisodate} and +\helpref{FormatISOTime}{wxdatetimeformatisotime}) or by specifying any format +at all and using \helpref{Format}{wxdatetimeformat} directly. + +The conversions from text are more interesting, as there are much more +possibilities to care about. The simples cases can be taken care of with +\helpref{ParseFormat}{wxdatetimeparseformat} which can parse any date in the +given (rigid) format. \helpref{ParseRfc822Date}{wxdatetimeparserfc822date} is +another function for parsing dates in predefined format - the one of RFC 822 +which (still...) defines the format of email messages on the Internet. This +format can not be described with {\tt strptime(3)}-like format strings used by +\helpref{Format}{wxdatetimeformat}, hence the need for a separate function. + +But the most interesting functions are +\helpref{ParseDateTime}{wxdatetimeparsedatetime} and +\helpref{ParseDate}{wxdatetimeparsedate} and +\helpref{ParseTime}{wxdatetimeparsetime}. They try to parse the date ans time +(or only one of them) in `free' format, i.e. allow them to be specified in any +of possible ways. These functions will usually be used to parse the +(interactive) user input which is not bound to be in any predefined format. As +an example, \helpref{ParseDateTime}{wxdatetimeparsedatetime} can parse the +strings such as {\tt "tomorrow"}, {\tt "March first"}, {\tt "next Sunday"}. + +\helpref{ParseRfc822Date}{wxdatetimeparserfc822date}\\ +\helpref{ParseFormat}{wxdatetimeparseformat}\\ +\helpref{ParseDateTime}{wxdatetimeparsedatetime}\\ +\helpref{ParseDate}{wxdatetimeparsedate}\\ +\helpref{ParseTime}{wxdatetimeparsetime}\\ +\helpref{Format}{wxdatetimeformat}\\ +\helpref{FormatDate}{wxdatetimeformatdate}\\ +\helpref{FormatTime}{wxdatetimeformattime}\\ +\helpref{FormatISODate}{wxdatetimeformatisodate}\\ +\helpref{FormatISOTime}{wxdatetimeformatisotime} + +\membersection{Calendar calculations}\label{wxdatetimecalculations} + +The functions in this section perform the basic calendar calculations, mostly +related to the week days. They allow to find the given week day in the +week with given number (either in the month or in the year) and so on. + +All (non-const) functions in this section don't modify the time part of the +wxDateTime - they only work with the date part of it. + +\helpref{SetToWeekDayInSameWeek}{wxdatetimesettoweekdayinsameweek}\\ +\helpref{GetWeekDayInSameWeek}{wxdatetimegetweekdayinsameweek}\\ +\helpref{SetToNextWeekDay}{wxdatetimesettonextweekday}\\ +\helpref{GetNextWeekDay}{wxdatetimegetnextweekday}\\ +\helpref{SetToPrevWeekDay}{wxdatetimesettoprevweekday}\\ +\helpref{GetPrevWeekDay}{wxdatetimegetprevweekday}\\ +\helpref{SetToWeekDay}{wxdatetimesettoweekday}\\ +\helpref{GetWeekDay}{wxdatetimegetweekday2}\\ +\helpref{SetToLastWeekDay}{wxdatetimesettolastweekday}\\ +\helpref{GetLastWeekDay}{wxdatetimegetlastweekday}\\ +\helpref{SetToTheWeek}{wxdatetimesettotheweek}\\ +\helpref{GetWeek}{wxdatetimegetweek}\\ +\helpref{SetToLastMonthDay}{wxdatetimesettolastmonthday}\\ +\helpref{GetLastMonthDay}{wxdatetimegetlastmonthday}\\ +\helpref{SetToYearDay}{wxdatetimesettoyearday}\\ +\helpref{GetYearDay}{wxdatetimegetyearday} \membersection{Astronomical/historical functions} -\membersection{Time zone support} +Some degree of support for the date units used in astronomy and/or history is +provided. You can construct a wxDateTime object from a +\helpref{JDN}{wxdatetimesetjdn} and you may also get its JDN, +\helpref{MJD}{wxdatetimegetmodifiedjuliandaynumber} or +\helpref{Rata Die number}{wxdatetimegetratadie} from it. + +\helpref{wxDateTime(double jdn)}{wxdatetimewxdatetimejdn}\\ +\helpref{Set(double jdn)}{wxdatetimesetjdn}\\ +\helpref{GetJulianDayNumber}{wxdatetimegetjuliandaynumber}\\ +\helpref{GetJDN}{wxdatetimegetjdn}\\ +\helpref{GetModifiedJulianDayNumber}{wxdatetimegetmodifiedjuliandaynumber}\\ +\helpref{GetMJD}{wxdatetimegetmjd}\\ +\helpref{GetRataDie}{wxdatetimegetratadie} + +\membersection{Time zone and DST support} + +Please see the \helpref{time zone overview}{tdatetimezones} for more +information about time zones. ormally, these functions should be rarely used. + +\helpref{ToTimezone}{wxdatetimetotimezone}\\ +\helpref{MakeTimezone}{wxdatetimemaketimezone}\\ +\helpref{ToGMT}{wxdatetimetogmt}\\ +\helpref{MakeGMT}{wxdatetimemakegmt}\\ +\helpref{GetBeginDST}{wxdatetimegetbegindst}\\ +\helpref{GetEndDST}{wxdatetimegetenddst}\\ +\helpref{IsDST}{wxdatetimeisdst} \helponly{\insertatlevel{2}{ @@ -161,6 +411,8 @@ calendar-related actions. }} +%%%%%%%%%%%%%%%%%%%%%%%%%%% static functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \membersection{wxDateTime::ConvertYearToBC}\label{wxdatetimeconvertyeartobc} \func{static int}{ConvertYearToBC}{\param{int }{year}} @@ -182,65 +434,927 @@ This function should be used like this: \func{static void}{GetAmPmStrings}{\param{wxString *}{am}, \param{wxString *}{pm}} +Returns the translations of the strings {\tt AM} and {\tt PM} used for time +formatting for the current locale. Either of the pointers may be {\tt NULL} if +the corresponding value is not needed. + \membersection{wxDateTime::GetBeginDST}\label{wxdatetimegetbegindst} \func{static wxDateTime}{GetBeginDST}{\param{int }{year = Inv\_Year}, \param{Country }{country = Country\_Default}} +Get the beginning of DST for the given country in the given year (current one +by default). This function suffers from limitations described in +\helpref{DST overview}{tdatedst}. + +\wxheading{See also} + +\helpref{GetEndDST}{wxdatetimegetenddst} + \membersection{wxDateTime::GetCountry}\label{wxdatetimegetcountry} \func{static Country}{GetCountry}{\void} +Returns the current default country. The default country is used for DST +calculations, for example. + +\wxheading{See also} + +\helpref{SetCountry}{wxdatetimesetcountry} + \membersection{wxDateTime::GetCurrentYear}\label{wxdatetimegetcurrentyear} \func{static int}{GetCurrentYear}{\param{Calendar }{cal = Gregorian}} +Get the current year in given calendar (only Gregorian is currently supported). + \membersection{wxDateTime::GetCurrentMonth}\label{wxdatetimegetcurrentmonth} \func{static Month}{GetCurrentMonth}{\param{Calendar }{cal = Gregorian}} +Get the current month in given calendar (only Gregorian is currently supported). + \membersection{wxDateTime::GetCentury}\label{wxdatetimegetcentury} \func{static int}{GetCentury}{\param{int }{year = Inv\_Year}} +Get the current century, i.e. first two digits of the year, in given calendar +(only Gregorian is currently supported). + \membersection{wxDateTime::GetEndDST}\label{wxdatetimegetenddst} \func{static wxDateTime}{GetEndDST}{\param{int }{year = Inv\_Year}, \param{Country }{country = Country\_Default}} +Returns the end of DST for the given country in the given year (current one by +default). + +\wxheading{See also} + +\helpref{GetBeginDST}{wxdatetimegetbegindst} + \membersection{wxDateTime::GetMonthName}\label{wxdatetimegetmonthname} \func{static wxString}{GetMonthName}{\param{Month }{month}, \param{NameFlags }{flags = Name\_Full}} +Gets the full (default) or abbreviated (specify {\tt Name\_Abbr} name of the +given month. + +\wxheading{See also} + +\helpref{GetWeekDayName}{wxdatetimegetweekdayname} + \membersection{wxDateTime::GetNumberOfDays}\label{wxdatetimegetnumberofdays} \func{static wxDateTime\_t}{GetNumberOfDays}{\param{int }{year}, \param{Calendar }{cal = Gregorian}} \func{static wxDateTime\_t}{GetNumberOfDays}{\param{Month }{month}, \param{int }{year = Inv\_Year}, \param{Calendar }{cal = Gregorian}} +Returns the number of days in the given year or in the given month of the +year. + +The only supported value for {\it cal} parameter is currently {\tt Gregorian}. + +\pythonnote{These two methods are named {\tt GetNumberOfDaysInYear} +and {\tt GetNumberOfDaysInMonth} in wxPython.} + \membersection{wxDateTime::GetWeekDayName}\label{wxdatetimegetweekdayname} \func{static wxString}{GetWeekDayName}{\param{WeekDay }{weekday}, \param{NameFlags }{flags = Name\_Full}} +Gets the full (default) or abbreviated (specify {\tt Name\_Abbr} name of the +given week day. + +\wxheading{See also} + +\helpref{GetMonthName}{wxdatetimegetmonthname} + \membersection{wxDateTime::IsLeapYear}\label{wxdatetimeisleapyear} \func{static bool}{IsLeapYear}{\param{int }{year = Inv\_Year}, \param{Calendar }{cal = Gregorian}} +Returns {\tt TRUE} if the {\it year} is a leap one in the specified calendar. + +This functions supports Gregorian and Julian calendars. + \membersection{wxDateTime::IsWestEuropeanCountry}\label{wxdatetimeiswesteuropeancountry} \func{static bool}{IsWestEuropeanCountry}{\param{Country }{country = Country\_Default}} +This function returns {\tt TRUE} if the specified (or default) country is one +of Western European ones. It is used internally by wxDateTime to determine the +DST convention and date and time formatting rules. + \membersection{wxDateTime::IsDSTApplicable}\label{wxdatetimeisdstapplicable} \func{static bool}{IsDSTApplicable}{\param{int }{year = Inv\_Year}, \param{Country }{country = Country\_Default}} +Returns {\tt TRUE} if DST was usedi n the given year (the current one by +default) in the given country. + \membersection{wxDateTime::Now}\label{wxdatetimenow} \func{static wxDateTime}{Now}{\void} +Returns the object corresopnding to the current time. + +Example: + +\begin{verbatim} + wxDateTime now = wxDateTime::Now(); + printf("Current time in Paris:\t%s\n", now.Format("%c", wxDateTime::CET).c_str()); +\end{verbatim} + +Note that this function is accurate up to second: +\helpref{wxDateTime::UNow}{wxdatetimeunow} should be used for better precision +(but it is less efficient and might not be availabel on all platforms). + +\wxheading{See also} + +\helpref{Today}{wxdatetimetoday} + \membersection{wxDateTime::SetCountry}\label{wxdatetimesetcountry} \func{static void}{SetCountry}{\param{Country }{country}} +Sets the country to use by default. This setting influences the DST +calculations, date formatting and other things. + +The possible values for {\it country} parameter are enumerated in +\helpref{wxDateTime constants section}{wxdatetime}. + +\wxheading{See also} + +\helpref{GetCountry}{wxdatetimegetcountry} + \membersection{wxDateTime::Today}\label{wxdatetimetoday} \func{static wxDateTime}{Today}{\void} +Returns the object corresponding to the midnight of the current day (i.e. the +same as \helpref{Now()}{wxdatetimenow}, but the time part is set to $0$). + +\wxheading{See also} + +\helpref{Now}{wxdatetimenow} + +\membersection{wxDateTime::UNow}\label{wxdatetimeunow} + +\func{static wxDateTime}{UNow}{\void} + +Returns the object corresopnding to the current time including the +milliseconds if a function to get time with such precision is available on the +current platform (supported under most Unices and Win32). + +\wxheading{See also} + +\helpref{Now}{wxdatetimenow} + +%%%%%%%%%%%%%%%%%%%%%%%%%%% constructors &c %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimedef} + +\func{}{wxDateTime}{\void} + +Default constructor. Use one of {\tt Set()} functions to initialize the object +later. + +\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimetimet} + +\func{wxDateTime\&}{wxDateTime}{\param{time\_t }{timet}} + +Same as \helpref{Set}{wxdatetimewxdatetimetimet}. + +\pythonnote{This constructor is named {\tt wxDateTimeFromTimeT} in wxPython.} + +\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimetm} + +\func{wxDateTime\&}{wxDateTime}{\param{const struct tm\& }{tm}} + +Same as \helpref{Set}{wxdatetimewxdatetimetm} + +\pythonnote{Unsupported.} + +\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimejdn} + +\func{wxDateTime\&}{wxDateTime}{\param{double }{jdn}} + +Same as \helpref{Set}{wxdatetimewxdatetimejdn} + +\pythonnote{This constructor is named {\tt wxDateTimeFromJDN} in wxPython.} + +\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimetime} + +\func{wxDateTime\&}{wxDateTime}{\param{wxDateTime\_t }{hour}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}} + +Same as \helpref{Set}{wxdatetimewxdatetimetime} + +\pythonnote{This constructor is named {\tt wxDateTimeFromHMS} in wxPython.} + +\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimedate} + +\func{wxDateTime\&}{wxDateTime}{\param{wxDateTime\_t }{day}, \param{Month }{month = Inv\_Month}, \param{wxDateTime\_t }{hour = 0}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}} + +Same as \helpref{Set}{wxdatetimesetdate} + +\pythonnote{This constructor is named {\tt wxDateTimeFromDMY} in wxPython.} + +\membersection{wxDateTime::SetToCurrent}\label{wxdatetimesettocurrent} + +\func{wxDateTime&}{SetToCurrent}{\void} + +Sets the date and time of to the current values. Same as assigning the result +of \helpref{Now()}{wxdatetimenow} to this object. + +\membersection{wxDateTime::Set}\label{wxdatetimesettimet} + +\func{wxDateTime\&}{Set}{\param{time\_t }{timet}} + +Constructs the object from {\it timet} value holding the number of seconds +since Jan 1, 1970. + +\pythonnote{This method is named {\tt SetTimeT} in wxPython.} + +\membersection{wxDateTime::Set}\label{wxdatetimesettm} + +\func{wxDateTime\&}{Set}{\param{const struct tm\& }{tm}} + +Sets the date and tiem from the broken down representation in the standard +{\tt tm} structure. + +\pythonnote{Unsupported.} + +\membersection{wxDateTime::Set}\label{wxdatetimesetjdn} + +\func{wxDateTime\&}{Set}{\param{double }{jdn}} + +Sets the date from the so-called {\it Julian Day Number}. + +By definition, the Julian Day Number, usually abbreviated as JDN, of a +particular instant is the fractional number of days since 12 hours Universal +Coordinated Time (Greenwhich mean noon) on January 1 of the year -4712 in the +Julian proleptic calendar. + +\pythonnote{This method is named {\tt SetJDN} in wxPython.} + +\membersection{wxDateTime::Set}\label{wxdatetimesettime} + +\func{wxDateTime\&}{Set}{\param{wxDateTime\_t }{hour}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}} + +Sets the date to be equal to \helpref{Today}{wxdatetimetoday} and the time +from supplied parameters. + +\pythonnote{This method is named {\tt SetHMS} in wxPython.} + +\membersection{wxDateTime::Set}\label{wxdatetimesetdate} + +\func{wxDateTime\&}{Set}{\param{wxDateTime\_t }{day}, \param{Month }{month = Inv\_Month}, \param{wxDateTime\_t }{hour = 0}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}} + +Sets the date and time from the parameters. + +\membersection{wxDateTime::ResetTime}\label{wxdatetimeresettime} + +\func{wxDateTime\&}{ResetTime}{\void} + +Reset time to midnight (00:00:00) without changing the date. + +\membersection{wxDateTime::SetYear}\label{wxdatetimesetyear} + +\func{wxDateTime\&}{SetYear}{\param{int }{year}} + +Sets the year without changing other date components. + +\membersection{wxDateTime::SetMonth}\label{wxdatetimesetmonth} + +\func{wxDateTime\&}{SetMonth}{\param{Month }{month}} + +Sets the month without changing other date components. + +\membersection{wxDateTime::SetDay}\label{wxdatetimesetday} + +\func{wxDateTime\&}{SetDay}{\param{wxDateTime\_t }{day}} + +Sets the day without changing other date components. + +\membersection{wxDateTime::SetHour}\label{wxdatetimesethour} + +\func{wxDateTime\&}{SetHour}{\param{wxDateTime\_t }{hour}} + +Sets the hour without changing other date components. + +\membersection{wxDateTime::SetMinute}\label{wxdatetimesetminute} + +\func{wxDateTime\&}{SetMinute}{\param{wxDateTime\_t }{minute}} + +Sets the minute without changing other date components. + +\membersection{wxDateTime::SetSecond}\label{wxdatetimesetsecond} + +\func{wxDateTime\&}{SetSecond}{\param{wxDateTime\_t }{second}} + +Sets the second without changing other date components. + +\membersection{wxDateTime::SetMillisecond}\label{wxdatetimesetmillisecond} + +\func{wxDateTime\&}{SetMillisecond}{\param{wxDateTime\_t }{millisecond}} + +Sets the millisecond without changing other date components. + +\membersection{wxDateTime::operator$=$}\label{wxdatetimeoperatoreqtimet} + +\func{wxDateTime\&}{operator}{\param{time\_t }{timet}} + +Same as \helpref{Set}{wxdatetimesettimet}. + +\membersection{wxDateTime::operator$=$}\label{wxdatetimeoperatoreqtm} + +\func{wxDateTime\&}{operator}{\param{const struct tm\& }{tm}} + +Same as \helpref{Set}{wxdatetimesettm}. + +%%%%%%%%%%%%%%%%%%%%%%%%%%% accessors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\membersection{wxDateTime::IsValid}\label{wxdatetimeisvalid} + +\constfunc{bool}{IsValid}{\void} + +Returns {\tt TRUE} if the object represents a valid time moment. + +\membersection{wxDateTime::GetTm}\label{wxdatetimegettm} + +\constfunc{Tm}{GetTm}{\param{const TimeZone\& }{tz = Local}} + +Returns broken down representation of the date and time. + +\membersection{wxDateTime::GetTicks}\label{wxdatetimegetticks} + +\constfunc{time\_t}{GetTicks}{\void} + +Returns the number of seconds since Jan 1, 1970. An assert failure will occur +if the date is not in the range covered by {\tt time\_t} type. + +\membersection{wxDateTime::GetYear}\label{wxdatetimegetyear} + +\constfunc{int}{GetYear}{\param{const TimeZone\& }{tz = Local}} + +Returns the year in the given timezone (local one by default). + +\membersection{wxDateTime::GetMonth}\label{wxdatetimegetmonth} + +\constfunc{Month}{GetMonth}{\param{const TimeZone\& }{tz = Local}} + +Returns the month in the given timezone (local one by default). + +\membersection{wxDateTime::GetDay}\label{wxdatetimegetday} + +\constfunc{wxDateTime\_t}{GetDay}{\param{const TimeZone\& }{tz = Local}} + +Returns the day in the given timezone (local one by default). + +\membersection{wxDateTime::GetWeekDay}\label{wxdatetimegetweekday} + +\constfunc{WeekDay}{GetWeekDay}{\param{const TimeZone\& }{tz = Local}} + +Returns the week day in the given timezone (local one by default). + +\membersection{wxDateTime::GetHour}\label{wxdatetimegethour} + +\constfunc{wxDateTime\_t}{GetHour}{\param{const TimeZone\& }{tz = Local}} + +Returns the hour in the given timezone (local one by default). + +\membersection{wxDateTime::GetMinute}\label{wxdatetimegetminute} + +\constfunc{wxDateTime\_t}{GetMinute}{\param{const TimeZone\& }{tz = Local}} + +Returns the minute in the given timezone (local one by default). + +\membersection{wxDateTime::GetSecond}\label{wxdatetimegetsecond} + +\constfunc{wxDateTime\_t}{GetSecond}{\param{const TimeZone\& }{tz = Local}} + +Returns the seconds in the given timezone (local one by default). + +\membersection{wxDateTime::GetMillisecond}\label{wxdatetimegetmillisecond} + +\constfunc{wxDateTime\_t}{GetMillisecond}{\param{const TimeZone\& }{tz = Local}} + +Returns the milliseconds in the given timezone (local one by default). + +\membersection{wxDateTime::GetDayOfYear}\label{wxdatetimegetdayofyear} + +\constfunc{wxDateTime\_t}{GetDayOfYear}{\param{const TimeZone\& }{tz = Local}} + +Returns the day of the year (in $1\ldots366$ range) in the given timezone +(local one by default). + +\membersection{wxDateTime::GetWeekOfYear}\label{wxdatetimegetweekofyear} + +\constfunc{wxDateTime\_t}{GetWeekOfYear}{\param{WeekFlags }{flags = Monday\_First}, \param{const TimeZone\& }{tz = Local}} + +Returns the number of the week of the year this date is in. The first week of +the year is, according to international standards, the one containing Jan 4. +The week number is in $1\ldots53$ range ($52$ for non leap years). + +The function depends on the \helpref{week start}{wxdatetime} convention +specified by the {\it flags} argument. + +\membersection{wxDateTime::GetWeekOfMonth}\label{wxdatetimegetweekofmonth} + +\constfunc{wxDateTime\_t}{GetWeekOfMonth}{\param{WeekFlags }{flags = Monday\_First}, \param{const TimeZone\& }{tz = Local}} + +Returns the ordinal number of the week in the month (in $1\ldots5$ range). + +As \helpref{GetWeekOfYear}{wxdatetimegetweekofyear}, this function supports +both conventions for the week start. See the description of these +\helpref{week start}{wxdatetime} conventions. + +\membersection{wxDateTime::IsWorkDay}\label{wxdatetimeisworkday} + +\constfunc{bool}{IsWorkDay}{\param{Country }{country = Country\_Default}} + +Returns {\tt TRUE} is this day is not a holiday in the given country. + +\membersection{wxDateTime::IsGregorianDate}\label{wxdatetimeisgregoriandate} + +\constfunc{bool}{IsGregorianDate}{\param{GregorianAdoption }{country = Gr\_Standard}} + +Returns {\tt TRUE} if the given date os later than the date of adoption of the +Gregorian calendar in the given country (and hence the Gregorian calendar +calculations make sense for it). + +%%%%%%%%%%%%%%%%%%%%%%%%%%% comparison %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\membersection{wxDateTime::IsEqualTo}\label{wxdatetimeisequalto} + +\constfunc{bool}{IsEqualTo}{\param{const wxDateTime& }{datetime}} + +Returns {\tt TRUE} if the two dates are strictly identical. + +\membersection{wxDateTime::IsEarlierThan}\label{wxdatetimeisearlierthan} + +\constfunc{bool}{IsEarlierThan}{\param{const wxDateTime& }{datetime}} + +Returns {\tt TRUE} if this date precedes the given one. + +\membersection{wxDateTime::IsLaterThan}\label{wxdatetimeislaterthan} + +\constfunc{bool}{IsLaterThan}{\param{const wxDateTime& }{datetime}} + +Returns {\tt TRUE} if this date is later than the given one. + +\membersection{wxDateTime::IsStrictlyBetween}\label{wxdatetimeisstrictlybetween} + +\constfunc{bool}{IsStrictlyBetween}{\param{const wxDateTime& }{t1}, \param{const wxDateTime& }{t2}} + +Returns {\tt TRUE} if this date lies strictly between the two others, + +\wxheading{See also} + +\helpref{IsBetween}{wxdatetimeisbetween} + +\membersection{wxDateTime::IsBetween}\label{wxdatetimeisbetween} + +\constfunc{bool}{IsBetween}{\param{const wxDateTime& }{t1}, \param{const wxDateTime& }{t2}} + +Returns {\tt TRUE} if \helpref{IsStrictlyBetween}{wxdatetimeisstrictlybetween} +is {\tt TRUE} or if the date is equal to one of the limi values. + +\wxheading{See also} + +\helpref{IsStrictlyBetween}{wxdatetimeisstrictlybetween} + +\membersection{wxDateTime::IsSameDate}\label{wxdatetimeissamedate} + +\constfunc{bool}{IsSameDate}{\param{const wxDateTime& }{dt}} + +Returns {\tt TRUE} if the date is the same without comparing the time parts. + +\membersection{wxDateTime::IsSameTime}\label{wxdatetimeissametime} + +\constfunc{bool}{IsSameTime}{\param{const wxDateTime& }{dt}} + +Returns {\tt TRUE} if the time is the same (although dates may differ). + +\membersection{wxDateTime::IsEqualUpTo}\label{wxdatetimeisequalupto} + +\constfunc{bool}{IsEqualUpTo}{\param{const wxDateTime\& }{dt}, \param{const wxTimeSpan\& }{ts}} + +Returns {\tt TRUE} if the date is equal to another one up to the given time +interval, i.e. if the absolute difference between the two dates is less than +this interval. + +%%%%%%%%%%%%%%%%%%%%%%%%%%% arithmetics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\membersection{wxDateTime::Add}\label{wxdatetimeaddts} + +\constfunc{wxDateTime}{Add}{\param{const wxTimeSpan\& }{diff}} + +\func{wxDateTime\&}{Add}{\param{const wxTimeSpan\& }{diff}} + +\func{wxDateTime\&}{operator$+=$}{\param{const wxTimeSpan\& }{diff}} + +Adds the given time span to this object. + +\pythonnote{This method is named {\tt AddTS} in wxPython.} + +\membersection{wxDateTime::Subtract}\label{wxdatetimesubtractts} + +\constfunc{wxDateTime}{Subtract}{\param{const wxTimeSpan\& }{diff}} + +\func{wxDateTime\&}{Subtract}{\param{const wxTimeSpan\& }{diff}} + +\func{wxDateTime\&}{operator$-=$}{\param{const wxTimeSpan\& }{diff}} + +Subtracts the given time span from this object. + +\pythonnote{This method is named {\tt SubtractTS} in wxPython.} + +\membersection{wxDateTime::Add}\label{wxdatetimeaddds} + +\constfunc{wxDateTime}{Add}{\param{const wxDateSpan\& }{diff}} + +\func{wxDateTime\&}{Add}{\param{const wxDateSpan\& }{diff}} + +\func{wxDateTime\&}{operator$+=$}{\param{const wxDateSpan\& }{diff}} + +Adds the given date span to this object. + +\pythonnote{This method is named {\tt AddDS} in wxPython.} + +\membersection{wxDateTime::Subtract}\label{wxdatetimesubtractds} + +\constfunc{wxDateTime}{Subtract}{\param{const wxDateSpan\& }{diff}} + +\func{wxDateTime\&}{Subtract}{\param{const wxDateSpan\& }{diff}} + +\func{wxDateTime\&}{operator$-=$}{\param{const wxDateSpan\& }{diff}} + +Subtracts the given date span from this object. + +\pythonnote{This method is named {\tt SubtractDS} in wxPython.} + +\membersection{wxDateTime::Subtract}\label{wxdatetimesubtractdt} + +\constfunc{wxTimeSpan}{Subtract}{\param{const wxDateTime\& }{dt}} + +Subtracts another date from this one and returns the difference between them +as wxTimeSpan. + +%%%%%%%%%%%%%%%%%%%%%%%%%%% parsing/formatting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\membersection{wxDateTime::ParseRfc822Date}\label{wxdatetimeparserfc822date} + +\func{const wxChar *}{ParseRfc822Date}{\param{const wxChar* }{date}} + +Parses the string {\it date} looking for a date formatted according to the RFC +822 in it. The exact description of this format may, of course, be found in +the RFC (section $5$), but, briefly, this is the format used in the headers of +Internet email messages and one of the most common strings expressing date in +this format may be something like {\tt "Sat, 18 Dec 1999 00:48:30 +0100"}. + +Returns {\tt NULL} if the conversion failed, otherwise return the pointer to +the character immediately following the part of the string which could be +parsed. If the entire string contains only the date in RFC 822 format, +the returned pointer will be pointing to a {\tt NUL} character. + +This function is intenionally strict, it will return an error for any string +which is not RFC 822 compliant. If you need to parse date formatted in more +free ways, you should use \helpref{ParseDateTime}{wxdatetimeparsedatetime} or +\helpref{ParseDate}{wxdatetimeparsedate} instead. + +\membersection{wxDateTime::ParseFormat}\label{wxdatetimeparseformat} + +\func{const wxChar *}{ParseFormat}{\param{const wxChar *}{date}, \param{const wxChar *}{format = "\%c"}, \param{const wxDateTime\& }{dateDef = wxDefaultDateTime}} + +This function parses the string {\it date} according to the given +{\it format}. The system {\tt strptime(3)} function is used whenever available, +but even if it is not, this function is still implemented (although support +for locale-dependent format specificators such as {\tt "\%c"}, {\tt "\%x"} or +{\tt "\%X"} may be not perfect). This function does handle the month and +weekday names in the current locale on all platforms, however. + +Please the description of ANSI C function {\tt strftime(3)} for the syntax of +the format string. + +The {\it dateDef} parameter is used to fill in the fields which could not be +determined from the format string. For example, if the format is {\tt "\%d"} +(the day of the month), the month and the year are taken from {\it dateDef}. +If it is not specified, \helpref{Today}{wxdatetimetoday} is used as the +default date. + +Returns {\tt NULL} if the conversion failed, otherwise return the pointer to +the character which stopped the scan. + +\membersection{wxDateTime::ParseDateTime}\label{wxdatetimeparsedatetime} + +\func{const wxChar *}{ParseDateTime}{\param{const wxChar *}{datetime}} + +Parses the string {\it datetime} containing the date and time in free format. +This function tries as hard as it can to interpret the given string as date +and time. Unlike \helpref{ParseRfc822Date}{wxdatetimeparserfc822date}, it +will accept anything that may be accepted and will only reject strings which +can not be parsed in any way at all. + +Returns {\tt NULL} if the conversion failed, otherwise return the pointer to +the character which stopped the scan. + +\membersection{wxDateTime::ParseDate}\label{wxdatetimeparsedate} + +\func{const wxChar *}{ParseDate}{\param{const wxChar *}{date}} + +This function is like \helpref{ParseDateTime}{wxdatetimeparsedatetime}, but it +only allows the date to be specified. It is thus flexible then +\helpref{ParseDateTime}{wxdatetimeparsedatetime}, but also has less chances to +misinterpret the user input. + +Returns {\tt NULL} if the conversion failed, otherwise return the pointer to +the character which stopped the scan. + +\membersection{wxDateTime::ParseTime}\label{wxdatetimeparsetime} + +\func{const wxChar *}{ParseTime}{\param{const wxChar *}{time}} + +This functions is like \helpref{ParseDateTime}{wxdatetimeparsedatetime}, but +only allows the time to be specified in the input string. + +Returns {\tt NULL} if the conversion failed, otherwise return the pointer to +the character which stopped the scan. + +\membersection{wxDateTime::Format}\label{wxdatetimeformat} + +\constfunc{wxString }{Format}{\param{const wxChar *}{format = "\%c"}, \param{const TimeZone\& }{tz = Local}} + +This function does the same as the standard ANSI C {\tt strftime(3)} function. +Please see its description for the meaning of {\it format} parameter. + +It also accepts a few wxWindows-specific extensions: you can optionally specify +the width of the field to follow using {\tt printf(3)}-like syntax and the +format specificator {\tt \%l} can be used to get the number of milliseconds. + +\wxheading{See also} + +\helpref{ParseFormat}{wxdatetimeparseformat} + +\membersection{wxDateTime::FormatDate}\label{wxdatetimeformatdate} + +\constfunc{wxString }{FormatDate}{\void} + +Identical to calling \helpref{Format()}{wxdatetimeformat} with {\tt "\%x"} +argument (which means `preferred date representation for the current locale'). + +\membersection{wxDateTime::FormatTime}\label{wxdatetimeformattime} + +\constfunc{wxString }{FormatTime}{\void} + +Identical to calling \helpref{Format()}{wxdatetimeformat} with {\tt "\%X"} +argument (which means `preferred time representation for the current locale'). + +\membersection{wxDateTime::FormatISODate}\label{wxdatetimeformatisodate} + +\constfunc{wxString }{FormatISODate}{\void} + +This function returns the date representation in the ISO 8601 format +(YYYY-MM-DD). + +\membersection{wxDateTime::FormatISOTime}\label{wxdatetimeformatisotime} + +\constfunc{wxString }{FormatISOTime}{\void} + +This function returns the time representation in the ISO 8601 format +(HH:MM:SS). + +%%%%%%%%%%%%%%%%%%%%%%%%%%% calendar calculations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\membersection{wxDateTime::SetToWeekDayInSameWeek}\label{wxdatetimesettoweekdayinsameweek} + +\func{wxDateTime\&}{SetToWeekDayInSameWeek}{\param{WeekDay }{weekday}} + +Adjusts the date so that it will still lie in the same week as before, but its +week day will be the given one. + +Returns the reference to the modified object itself. + +\membersection{wxDateTime::GetWeekDayInSameWeek}\label{wxdatetimegetweekdayinsameweek} + +\constfunc{wxDateTime}{GetWeekDayInSameWeek}{\param{WeekDay }{weekday}} + +Returns the copy of this object to which +\helpref{SetToWeekDayInSameWeek}{wxdatetimesettoweekdayinsameweek} was +applied. + +\membersection{wxDateTime::SetToNextWeekDay}\label{wxdatetimesettonextweekday} + +\func{wxDateTime\&}{SetToNextWeekDay}{\param{WeekDay }{weekday}} + +Sets the date so that it will be the first {\it weekday} following the current +date. + +Returns the reference to the modified object itself. + +\membersection{wxDateTime::GetNextWeekDay}\label{wxdatetimegetnextweekday} + +\constfunc{wxDateTime}{GetNextWeekDay}{\param{WeekDay }{weekday}} + +Returns the copy of this object to which +\helpref{SetToNextWeekDay}{wxdatetimesettonextweekday} was applied. + +\membersection{wxDateTime::SetToPrevWeekDay}\label{wxdatetimesettoprevweekday} + +\func{wxDateTime\&}{SetToPrevWeekDay}{\param{WeekDay }{weekday}} + +Sets the date so that it will be the last {\it weekday} before the current +date. + +Returns the reference to the modified object itself. + +\membersection{wxDateTime::GetPrevWeekDay}\label{wxdatetimegetprevweekday} + +\constfunc{wxDateTime}{GetPrevWeekDay}{\param{WeekDay }{weekday}} + +Returns the copy of this object to which +\helpref{SetToPrevWeekDay}{wxdatetimesettoprevweekday} was applied. + +\membersection{wxDateTime::SetToWeekDay}\label{wxdatetimesettoweekday} + +\func{bool}{SetToWeekDay}{\param{WeekDay }{weekday}, \param{int }{n = 1}, \param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}} + +Sets the date to the {\it n}-th {\it weekday} in the given month of the given +year (the current month and year are used by default). The parameter {\it n} +may be either opsitive (counting from the beginning of the month) or negative +(counting from the end of it). + +For example, {\tt SetToWeekDay(2, wxDateTime::Wed)} will set the date to the +second Wednesday in the current month and +{\tt SetToWeekDay(-1, wxDateTime::Sun)} - to the last Sunday in it. + +Returns {\tt TRUE} if the date was modified successfully, {\tt FALSE} +otherwise meaning that the specified date doesn't exist. + +\membersection{wxDateTime::GetWeekDay}\label{wxdatetimegetweekday2} + +\constfunc{wxDateTime}{GetWeekDay}{\param{WeekDay }{weekday}, \param{int }{n = 1}, \param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}} + +Returns the copy of this object to which +\helpref{SetToWeekDay}{wxdatetimesettoweekday} was applied. + +\membersection{wxDateTime::SetToLastWeekDay}\label{wxdatetimesettolastweekday} + +\func{bool}{SetToLastWeekDay}{\param{WeekDay }{weekday}, \param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}} + +The effect of calling this function is the same as of calling +{\tt SetToWeekDay(-1, weekday, month, year)}. The date will be set to the last +{\it weekday} in the given month and year (the current ones by default). + +Always returns {\tt TRUE}. + +\membersection{wxDateTime::GetLastWeekDay}\label{wxdatetimegetlastweekday} + +\func{wxDateTime}{GetLastWeekDay}{\param{WeekDay }{weekday}, \param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}} + +Returns the copy of this object to which +\helpref{SetToLastWeekDay}{wxdatetimesettolastweekday} was applied. + +\membersection{wxDateTime::SetToTheWeek}\label{wxdatetimesettotheweek} + +\func{bool}{SetToTheWeek}{\param{wxDateTime\_t }{numWeek}, \param{WeekDay }{weekday = Mon}} + +Set the date to the given {\it weekday} in the week with given number +{\it numWeek}. The number should be in range $1\ldots53$ and {\tt FALSE} will +be returned if the specified date doesn't exist. {\tt TRUE} is returned if the +date was changed successfully. + +\membersection{wxDateTime::GetWeek}\label{wxdatetimegetweek} + +\constfunc{wxDateTime}{GetWeek}{\param{wxDateTime\_t }{numWeek}, \param{WeekDay }{weekday = Mon}} + +Returns the copy of this object to which +\helpref{SetToTheWeek}{wxdatetimesettotheweek} was applied. + +\membersection{wxDateTime::SetToLastMonthDay}\label{wxdatetimesettolastmonthday} + +\func{wxDateTime\&}{SetToLastMonthDay}{\param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}} + +Sets the date to the last day in the specified month (the current one by +default). + +Returns the reference to the modified object itself. + +\membersection{wxDateTime::GetLastMonthDay}\label{wxdatetimegetlastmonthday} + +\constfunc{wxDateTime}{GetLastMonthDay}{\param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}} + +Returns the copy of this object to which +\helpref{SetToLastMonthDay}{wxdatetimesettolastmonthday} was applied. + +\membersection{wxDateTime::SetToYearDay}\label{wxdatetimesettoyearday} + +\func{wxDateTime\&}{SetToYearDay}{\param{wxDateTime\_t }{yday}} + +Sets the date to the day number {\it yday} in the same year (i.e., unlike the +other functions, this one does not use the current year). The day number +should be in the range $1\ldots366$ for the leap years and $1\ldots365$ for +the other ones. + +Returns the reference to the modified object itself. + +\membersection{wxDateTime::GetYearDay}\label{wxdatetimegetyearday} + +\constfunc{wxDateTime}{GetYearDay}{\param{wxDateTime\_t }{yday}} + +Returns the copy of this object to which +\helpref{SetToYearDay}{wxdatetimesettoyearday} was applied. + +%%%%%%%%%%%%%%%%%%%%%%%%%%% astronomical functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\membersection{wxDateTime::GetJulianDayNumber}\label{wxdatetimegetjuliandaynumber} + +\constfunc{double}{GetJulianDayNumber}{\void} + +Returns the \helpref{JDN}{wxdatetimesetjdn} corresponding to this date. Beware +of rounding errors! + +\wxheading{See also} + +\helpref{GetModifiedJulianDayNumber}{wxdatetimegetmodifiedjuliandaynumber} + +\membersection{wxDateTime::GetJDN}\label{wxdatetimegetjdn} + +\constfunc{double}{GetJDN}{\void} + +Synonym for \helpref{GetJulianDayNumber}{wxdatetimegetjuliandaynumber}. + +\membersection{wxDateTime::GetModifiedJulianDayNumber}\label{wxdatetimegetmodifiedjuliandaynumber} + +\constfunc{double}{GetModifiedJulianDayNumber}{\void} + +Returns the {\it Modified Julian Day Number} (MJD) which is, by definition, +equal to $JDN - 2400000.5$. The MJDs are simpler to work with as the integral +MJDs correspond to midnights of the dates in the Gregorian calendar and not th +noons like JDN. The MJD $0$ is Nov 17, 1858. + +\membersection{wxDateTime::GetMJD}\label{wxdatetimegetmjd} + +\constfunc{double}{GetMJD}{\void} + +Synonym for \helpref{GetModifiedJulianDayNumber}{wxdatetimegetmodifiedjuliandaynumber}. + +\membersection{wxDateTime::GetRataDie}\label{wxdatetimegetratadie} + +\constfunc{double}{GetRataDie}{\void} + +Return the {\it Rata Die number} of this date. + +By definition, the Rata Die number is a date specified as the number of days +relative to a base date of December 31 of the year 0. Thus January 1 of the +year 1 is Rata Die day 1. + +%%%%%%%%%%%%%%%%%%%%%%%%%%% timezone and DST %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\membersection{wxDateTime::ToTimezone}\label{wxdatetimetotimezone} + +\constfunc{wxDateTime}{ToTimezone}{\param{const TimeZone\& }{tz}, \param{bool }{noDST = FALSE}} + +Transform the date to the given time zone. If {\it noDST} is {\tt TRUE}, no +DST adjustments will be made. + +Returns the date in the new time zone. + +\membersection{wxDateTime::MakeTimezone}\label{wxdatetimemaketimezone} + +\func{wxDateTime\&}{MakeTimezone}{\param{const TimeZone\& }{tz}, \param{bool }{noDST = FALSE}} + +Modifies the object in place to represent the date in another time zone. If +{\it noDST} is {\tt TRUE}, no DST adjustments will be made. + +\membersection{wxDateTime::ToGMT}\label{wxdatetimetogmt} + +\constfunc{wxDateTime}{ToGMT}{\param{bool }{noDST = FALSE}} + +This is the same as calling \helpref{ToTimezone}{wxdatetimetotimezone} with +the argument {\tt GMT0}. + +\membersection{wxDateTime::MakeGMT}\label{wxdatetimemakegmt} + +\func{wxDateTime\&}{MakeGMT}{\param{bool }{noDST = FALSE}} + +This is the same as calling \helpref{MakeTimezone}{wxdatetimemaketimezone} with +the argument {\tt GMT0}. + +\membersection{wxDateTime::IsDST}\label{wxdatetimeisdst} + +\constfunc{int}{IsDST}{\param{Country }{country = Country\_Default}} + +Returns {\tt TRUE} if the DST is applied for this date in the given country. + +\wxheading{See also} + +\helpref{GetBeginDST}{wxdatetimegetbegindst} and +\helpref{GetEndDST}{wxdatetimegetenddst} + +\section{\class{wxDateTimeHolidayAuthority}}\label{wxdatetimeholidayauthority} + +TODO + +\section{\class{wxDateTimeWorkDays}}\label{wxdatetimeworkdays} + +TODO + diff --git a/docs/latex/wx/db.tex b/docs/latex/wx/db.tex new file mode 100644 index 0000000000..4ef79bd0c6 --- /dev/null +++ b/docs/latex/wx/db.tex @@ -0,0 +1,112 @@ +\section{\class{wxDB}}\label{wxdb} + +A wxDB instance is a connection to an ODBC data source which may +be opened, closed, and re-opened an unlimited number of times. A +database connection allows function to be performed directly on the +data source, as well as allowing access to any tables/views defined in +the data source to which the user has sufficient privileges. + +\wxheading{Include files} + +<wx/version.h> +<wx/iodbc.h> +<wx/isqlext.h> +<wx/db.h> + +\wxheading{Remarks} + +By default, cursor directional scrolling is defined by wxODBC_FWD_ONLY_CURSORS +when the wxWindows library is built. This behavior can be overridden when +an instance of a wxDB is created (see \helpref{wxDB constructor}{wxdbconstr} + +\wxheading{See also} + +\helpref{wxTable}{wxtable} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxDB::wxDB}\label{wxdbconstr} + +\func{}{wxDB}{\void} + +Default constructor. + +\func{}{wxDB}{\param{HENV\& }{aHenv}} + +Constructor, used to create an ODBC connection to a data source. + +\wxheading{Parameters} + +\docparam{aHenv}{Environment handle defined in iODBC} + +\wxheading{Remarks} + +This is the constructor for the wxDB class. The wxDB object must +be created and opened before any database activity can occur. + +\wxheading{Example} +\begin{verbatim} + HENV Db; + ....Set values for member variables here + + wxDB sampleDB(Db.Henv); + if (!sampleDB.Open(Db.Dsn, Db.Uid, Db.AuthStr)) + { + // Error opening data source + } +\end{verbatim} + + +\membersection{wxDB::Catalog} + +\func{bool}{Catalog}{\param{char *}{ userID}, \param{char *}{fileName = SQL_CATALOG_FILENAME}} + +\wxheading{Parameters} + +\docparam{userID}{Database user name to use in accessing the database. All tables to which this user has rights will be evaluated in the catalog.} + +\docparam{fileName}{OPTIONAL argument. Name of the text file to create and write the DB catalog to.} + +\wxheading{Remarks} + +Allows a data "dictionary" of the data source to be created, dumping pertinent information about all data tables to which the user specified in userID has access. + +\wxheading{Example} +\begin{verbatim} +============== ============== ================ ========= ======= +TABLE NAME COLUMN NAME DATA TYPE PRECISION LENGTH +============== ============== ================ ========= ======= +EMPLOYEE RECID (0008)NUMBER 15 8 +EMPLOYEE USER_ID (0012)VARCHAR2 13 13 +EMPLOYEE FULL_NAME (0012)VARCHAR2 26 26 +EMPLOYEE PASSWORD (0012)VARCHAR2 26 26 +EMPLOYEE START_DATE (0011)DATE 19 16 +\end{verbatim} + + +\membersection{wxDB::Close} + +\func{void}{Close}{\void} + +\wxheading{Remarks} + +At the end of your program, when you have finished all of your database work, you must close the ODBC connection to the data source. There are actually four steps involved in doing this as illustrated in the example. + +\wxheading{Example} +\begin{verbatim} + // Commit any open transactions on the data source + sampleDB.CommitTrans(); + + // Delete any remaining wxTable objects allocated with new + delete parts; + + // Close the wxDB connection when finished with it + sampleDB.Close(); + + // Free Environment Handle that ODBC uses + if (SQLFreeEnv(Db.Henv) != SQL_SUCCESS) + { + // Error freeing environment handle + } +\end{verbatim} + diff --git a/docs/latex/wx/dc.tex b/docs/latex/wx/dc.tex index a7ccf42499..5a3caed12a 100644 --- a/docs/latex/wx/dc.tex +++ b/docs/latex/wx/dc.tex @@ -108,6 +108,18 @@ See \helpref{wxMemoryDC}{wxmemorydc} for typical usage. \helpref{wxMemoryDC}{wxmemorydc}, \helpref{wxBitmap}{wxbitmap}, \helpref{wxMask}{wxmask} +\membersection{wxDC::CalcBoundingBox}\label{wxdccalcboundingbox} + +\func{void}{CalcBoundingBox}{\param{wxCoord }{x}, \param{wxCoord }{y}} + +Adds the specified point to the bounding box which can be retrieved with +\helpref{MinX}{wxdcminx}, \helpref{MaxX}{wxdcmaxx} and +\helpref{MinY}{wxdcminy}, \helpref{MaxY}{wxdcmaxy} functions. + +\wxheading{See also} + +\helpref{ResetBoundingBox}{wxdcresetboundingbox} + \membersection{wxDC::Clear}\label{wxdcclear} \func{void}{Clear}{\void} @@ -336,6 +348,11 @@ the string. See \helpref{wxDC::GetTextExtent}{wxdcgettextextent} for how to get the dimensions of a text string, which can be used to position the text more precisely. +{\bf NB:} under wxGTK the current +\helpref{logical function}{wxdcgetlogicalfunction} is used by this function +but it is ignored by wxMSW. Thus, you should avoid using logical functions +with this function in portable programs. + \membersection{wxDC::EndDoc}\label{wxdcenddoc} \func{void}{EndDoc}{\void} @@ -374,12 +391,26 @@ and using a style: \func{wxBrush\&}{GetBackground}{\void} +\constfunc{const wxBrush\&}{GetBackground}{\void} + Gets the brush used for painting the background (see \helpref{wxDC::SetBackground}{wxdcsetbackground}). +\membersection{wxDC::GetBackgroundMode}\label{wxdcgetbackgroundmode} + +\constfunc{int}{GetBackgroundMode}{\void} + +Returns the current background mode: {\tt wxSOLID} or {\tt wxTRANSPARENT}. + +\wxheading{See also} + +\helpref{SetBackgroundMode}{wxdcsetbackgroundmode} + \membersection{wxDC::GetBrush}\label{wxdcgetbrush} \func{wxBrush\&}{GetBrush}{\void} +\constfunc{const wxBrush\&}{GetBrush}{\void} + Gets the current brush (see \helpref{wxDC::SetBrush}{wxdcsetbrush}). \membersection{wxDC::GetCharHeight}\label{wxdcgetcharheight} @@ -407,6 +438,8 @@ rectangle are returned as a tuple.} \func{wxFont\&}{GetFont}{\void} +\constfunc{const wxFont\&}{GetFont}{\void} + Gets the current font (see \helpref{wxDC::SetFont}{wxdcsetfont}). \membersection{wxDC::GetLogicalFunction}\label{wxdcgetlogicalfunction} @@ -432,6 +465,8 @@ See \helpref{wxDC::SetOptimization}{wxsetoptimization} for details. \func{wxPen\&}{GetPen}{\void} +\constfunc{const wxPen\&}{GetPen}{\void} + Gets the current pen (see \helpref{wxDC::SetPen}{wxdcsetpen}). \membersection{wxDC::GetPixel}\label{wxdcgetpixel} @@ -478,6 +513,8 @@ implements the following methods:\par \func{wxColour\&}{GetTextBackground}{\void} +\constfunc{const wxColour\&}{GetTextBackground}{\void} + Gets the current text background colour (see \helpref{wxDC::SetTextBackground}{wxdcsettextbackground}). \membersection{wxDC::GetTextExtent}\label{wxdcgettextextent} @@ -511,6 +548,8 @@ See also \helpref{wxFont}{wxfont}, \helpref{wxDC::SetFont}{wxdcsetfont}. \func{wxColour\&}{GetTextForeground}{\void} +\constfunc{const wxColour\&}{GetTextForeground}{\void} + Gets the current text foreground colour (see \helpref{wxDC::SetTextForeground}{wxdcsettextforeground}). @@ -579,6 +618,17 @@ Gets the minimum vertical extent used in drawing commands so far. Returns TRUE if the DC is ok to use. +\membersection{wxDC::ResetBoundingBox}\label{wxdcresetboundingbox} + +\func{void}{ResetBoundingBox}{\void} + +Resets the bounding box: after a call to this function, the bounding box +doesn't contain anything. + +\wxheading{See also} + +\helpref{CalcBoundingBox}{wxdccalcboundingbox} + \membersection{wxDC::SetDeviceOrigin}\label{wxdcsetdeviceorigin} \func{void}{SetDeviceOrigin}{\param{wxCoord}{ x}, \param{wxCoord}{ y}} diff --git a/docs/latex/wx/ddeclint.tex b/docs/latex/wx/ddeclint.tex index 5bc85beb16..2f5fc7a858 100644 --- a/docs/latex/wx/ddeclint.tex +++ b/docs/latex/wx/ddeclint.tex @@ -7,7 +7,7 @@ To create a client which can communicate with a suitable server, you need to derive a class from wxDDEConnection and another from wxDDEClient. The custom wxDDEConnection class will intercept communications in a `conversation' with a server, and the custom wxDDEServer is required -so that a user-overriden \helpref{wxDDEClient::OnMakeConnection}{wxddeclientonmakeconnection} member can return +so that a user-overridden \helpref{wxDDEClient::OnMakeConnection}{wxddeclientonmakeconnection} member can return a wxDDEConnection of the required class, when a connection is made. This DDE-based implementation is diff --git a/docs/latex/wx/dialevt.tex b/docs/latex/wx/dialevt.tex new file mode 100644 index 0000000000..b434db72f5 --- /dev/null +++ b/docs/latex/wx/dialevt.tex @@ -0,0 +1,48 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: dialevt.tex +%% Purpose: wxDialUpEvent documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 08.04.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxDialUpEvent}}\label{wxdialupevent} + +This is the event class for the dialup events sent by +\helpref{wxDialUpManager}{wxdialupmanager}. + +\wxheading{Derived from} + +\helpref{wxEvent}{wxevent}\\ +\helpref{wxObject}{wxobject} + +\wxheading{Include files} + +<wx/dialup.h> + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxDialUpEvent::wxDialUpEvent}\label{wxdialupeventwxdialupevent} + +\func{}{wxDialUpEvent}{\param{bool }{isConnected}, \param{bool }{isOwnEvent}} + +Constructor is only used by \helpref{wxDialUpManager}{wxdialupmanager}. + +\membersection{wxDialUpEvent::IsConnectedEvent}\label{wxdialupeventisconnectedevent} + +\constfunc{bool}{IsConnectedEvent}{\void} + +Is this a {\tt CONNECTED} or {\tt DISCONNECTED} event? In other words, does it +notify about transition from offline to online state or vice versa? + +\membersection{wxDialUpEvent::IsOwnEvent}\label{wxdialupeventisownevent} + +\constfunc{bool}{IsOwnEvent}{\void} + +Does this event come from wxDialUpManager::Dial() or from some extrenal +process (i.e. does it result from our own attempt to establish the +connection)? + diff --git a/docs/latex/wx/dialog.tex b/docs/latex/wx/dialog.tex index b3b7d56918..0ea060871c 100644 --- a/docs/latex/wx/dialog.tex +++ b/docs/latex/wx/dialog.tex @@ -22,7 +22,10 @@ like a frame in that program flow continues, and input on other windows is still You specify the type of dialog with the {\bf wxDIALOG\_MODAL} and {\bf wxDIALOG\_MODELESS} window styles. -A dialog may be loaded from a wxWindows resource file (extension {\tt wxr}). +A dialog may be loaded from a wxWindows resource file (extension {\tt wxr}), which may itself +be created by Dialog Editor. For details, +see \helpref{The wxWindows resource system}{resourceformats}, \helpref{wxWindows resource functions}{resourcefuncs} and +the resource sample. An application can define an \helpref{OnCloseWindow}{wxwindowonclosewindow} handler for the dialog to respond to system close events. @@ -31,9 +34,10 @@ dialog to respond to system close events. \twocolwidtha{5cm} \begin{twocollist}\itemsep=0pt -\twocolitem{\windowstyle{wxCAPTION}}{Puts a caption on the dialog box (Motif only).} +\twocolitem{\windowstyle{wxDIALOG\_MODAL}}{Specifies that the dialog box will be modal.} +\twocolitem{\windowstyle{wxCAPTION}}{Puts a caption on the dialog box.} \twocolitem{\windowstyle{wxDEFAULT\_DIALOG\_STYLE}}{Equivalent to a combination of wxCAPTION, wxSYSTEM\_MENU and wxTHICK\_FRAME} -\twocolitem{\windowstyle{wxRESIZE\_BORDER}}{Display a resizeable frame around the window (Unix only).} +\twocolitem{\windowstyle{wxRESIZE\_BORDER}}{Display a resizeable frame around the window.} \twocolitem{\windowstyle{wxSYSTEM\_MENU}}{Display a system menu.} \twocolitem{\windowstyle{wxTHICK\_FRAME}}{Display a thick frame around the window.} \twocolitem{\windowstyle{wxSTAY\_ON\_TOP}}{The dialog stays on top of all other windows (Windows only).} @@ -279,6 +283,9 @@ propagate the notification to child windows and controls. \func{void}{SetModal}{\param{const bool}{ flag}} +{\bf NB:} This function is deprecated and doesn't work for all ports, just use +\helpref{ShowModal}{wxdialogshowmodal} to show a modal dialog instead. + Allows the programmer to specify whether the dialog box is modal (wxDialog::Show blocks control until the dialog is hidden) or modeless (control returns immediately). diff --git a/docs/latex/wx/dialup.tex b/docs/latex/wx/dialup.tex new file mode 100644 index 0000000000..7c13018ec5 --- /dev/null +++ b/docs/latex/wx/dialup.tex @@ -0,0 +1,215 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: dialup.tex +%% Purpose: wxDialUpManager documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 08.04.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxDialUpManager}}\label{wxdialupmanager} + +This class encapsulates functions dealing with veryfying the connection status +of the workstation (connected to the Internet via a direct connection, +connected through a modem or not connected at all) and to establish this +connection if possible/required (i.e. in the case of the modem). + +The program may also wish to be notified about the change in the connection +status (for example, to perform some action when the user connects to the +network the next time or, on the contrary, to stop receiving data from the net +when the user hangs up the modem). For this, you need to use one of the event +macros described below. + +This class is different from other wxWindows classes in that there is at most +one instance of this class in the program accessed via +\helpref{wxDialUpManager::Create()}{wxdialupmanagercreate} and you can't +create the objects of this class directly. + +\wxheading{Derived from} + +No base class + +\wxheading{Include files} + +<wx/dialup.h> + +\wxheading{Event table macros} + +To be notified about the change in the network connection status, use these +event handler macros to direct input to member functions that take a +\helpref{wxDialUpEvent}{wxdialupevent} argument. + +\twocolwidtha{7cm} +\begin{twocollist}\itemsep=0pt +\twocolitem{{\bf EVT\_DIALUP\_CONNECTED(func)}}{A connection with the network was established.} +\twocolitem{{\bf EVT\_DIALUP\_DISCONNECTED(func)}}{The connection with the network was lost.} +\end{twocollist}% + +\wxheading{See also} + +\helpref{dialup sample}{sampledialup}\\ +\helpref{wxDialUpEvent}{wxdialupevent} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxDialUpManager::Create}\label{wxdialupmanagercreate} + +\func{wxDialUpManager*}{Create}{\void} + +This function should create and return the object of the platform-specific +class derived from wxDialUpManager. You should delete the pointer when you are +done with it. + +\membersection{wxDialUpManager::IsOk}\label{wxdialupmanagerisok} + +\constfunc{bool}{IsOk}{\void} + +Returns {\tt TRUE} if the dialup manager was initialized correctly. If this +function returns {\tt FALSE}, no other functions will work neither, so it is a +good idea to call this function and check its result before calling any other +wxDialUpManager methods + +\membersection{wxDialUpManager::\destruct{wxDialUpManager}}\label{wxdialupmanagerdtor} + +\func{}{\destruct{wxDialUpManager}}{\void} + +Destructor. + +\membersection{wxDialUpManager::GetISPNames}\label{wxdialupmanagergetispnames} + +\constfunc{size\_t}{GetISPNames}{\param{wxArrayString\& }{names}} + +This function is only implemented under Windows. + +Fills the array with the names of all possible values for the first +parameter to \helpref{Dial()}{wxdialupmanagerdial} on this machine and returns +their number (may be $0$). + +\membersection{wxDialUpManager::Dial}\label{wxdialupmanagerdial} + +\func{bool}{Dial}{\param{const wxString\& }{nameOfISP = wxEmptyString}, \param{const wxString\& }{username = wxEmptyString}, \param{const wxString\& }{password = wxEmptyString}, \param{bool }{async = TRUE}} + +Dial the given ISP, use {\it username} and {\it password} to authentificate. + +The parameters are only used under Windows currently, for Unix you should use +\helpref{SetConnectCommand}{wxdialupmanagersetconnectcommand} to customize this +functions behaviour. + +If no {\it nameOfISP} is given, the function will select the default one +(proposing the user to choose among all connections defined on this machine) +and if no username and/or password are given, the function will try to do +without them, but will ask the user if really needed. + +If {\it async} parameter is {\tt FALSE}, the function waits until the end of dialing +and returns {\tt TRUE} upon successful completion. + +If {\it async} is {\tt TRUE}, the function only initiates the connection and +returns immediately - the result is reported via events (an event is sent +anyhow, but if dialing failed it will be a DISCONNECTED one). + +\membersection{wxDialUpManager::IsDialing}\label{wxdialupmanagerisdialing} + +\constfunc{bool}{IsDialing}{\void} + +Returns TRUE if (async) dialing is in progress. + +\wxheading{See also} + +\helpref{Dial}{wxdialupmanagerdial} + +\membersection{wxDialUpManager::CancelDialing}\label{wxdialupmanagercanceldialing} + +\func{bool}{CancelDialing}{\void} + +Cancel dialing the number initiated with \helpref{Dial}{wxdialupmanagerdial} +with async parameter equal to {\tt TRUE}. + +Note that this won't result in DISCONNECTED event being sent. + +\wxheading{See also} + +\helpref{IsDialing}{wxdialupmanagerisdialing} + +\membersection{wxDialUpManager::HangUp}\label{wxdialupmanagerhangup} + +\func{bool}{HangUp}{\void} + +Hang up the currently active dial up connection. + +\membersection{wxDialUpManager::IsAlwaysOnline}\label{wxdialupmanagerisalwaysonline} + +\constfunc{bool}{IsAlwaysOnline}{\void} + +Returns {\tt TRUE} if the computer has a permanent network connection (i.e. is +on a LAN) and so there is no need to use Dial() function to go online. + +{\bf NB:} this functions tries to guess the result and it is not always +guaranteed to be correct, so it is better to ask user for +confirmation or give him a possibility to override it. + +\membersection{wxDialUpManager::IsOnline}\label{wxdialupmanagerisonline} + +\constfunc{bool}{IsOnline}{\void} + +Returns {\tt TRUE} if the computer is connected to the network: under Windows, +this just means that a RAS connection exists, under Unix we check that +the "well-known host" (as specified by +\helpref{SetWellKnownHost}{wxdialupmanagersetwellknownhost}) is reachable. + +\membersection{wxDialUpManager::SetOnlineStatus}\label{wxdialupmanagersetonlinestatus} + +\func{void}{SetOnlineStatus}{\param{bool }{isOnline = TRUE}} + +Sometimes the built-in logic for determining the online status may fail, +so, in general, the user should be allowed to override it. This function +allows to forcefully set the online status - whatever our internal +algorithm may think about it. + +\wxheading{See also} + +\helpref{IsOnline}{wxdialupmanagerisonline} + +\membersection{wxDialUpManager::EnableAutoCheckOnlineStatus}\label{wxdialupmanagerenableautocheckonlinestatus} + +\func{bool}{EnableAutoCheckOnlineStatus}{\param{size\_t }{nSeconds = 60}} + +Enable automatical checks for the connection status and sending of +{\tt wxEVT\_DIALUP\_CONNECTED/wxEVT\_DIALUP\_DISCONNECTED} events. The interval +parameter is only for Unix where we do the check manually and specifies how +often should we repeat the check (each minute by default). Under Windows, the +notification about the change of connection status is sent by the system and so +we don't do any polling and this parameter is ignored. + +Returns {\tt FALSE} if couldn't set up automatic check for online status. + +\membersection{wxDialUpManager::DisableAutoCheckOnlineStatus}\label{wxdialupmanagerdisableautocheckonlinestatus} + +\func{void}{DisableAutoCheckOnlineStatus}{\void} + +Disable automatic check for connection status change - notice that the +{\tt wxEVT\_DIALUP\_XXX} events won't be sent any more neither. + +\membersection{wxDialUpManager::SetWellKnownHost}\label{wxdialupmanagersetwellknownhost} + +\func{void}{SetWellKnownHost}{\param{const wxString\& }{hostname}, \param{int }{portno = 80}} + +This method is for Unix only. + +Under Unix, the value of well-known host is used to check whether we're +connected to the internet. It is unused under Windows, but this function +is always safe to call. The default value is {\tt www.yahoo.com:80}. + +\membersection{wxDialUpManager::SetConnectCommand}\label{wxdialupmanagersetconnectcommand} + +\func{}{SetConnectCommand}{\param{const wxString\& }{commandDial = wxT("/usr/bin/pon")}, \param{const wxString\& }{commandHangup = wxT("/usr/bin/poff")}} + +This method is for Unix only. + +Sets the commands to start up the network and to hang up again. + +\wxheading{See also} + +\helpref{Dial}{wxdialupmanagerdial} + diff --git a/docs/latex/wx/dir.tex b/docs/latex/wx/dir.tex index e2e7997c3e..3b1e5b7e25 100644 --- a/docs/latex/wx/dir.tex +++ b/docs/latex/wx/dir.tex @@ -94,7 +94,7 @@ class is not meant to be used polymorphically. \func{bool}{Open}{\param{const wxString\& }{dir}} Open the directory for enumerating, returns TRUE on success or FALSE if an -error occured. +error occurred. \membersection{wxDir::IsOpened}\label{wxdirisopened} diff --git a/docs/latex/wx/dllload.tex b/docs/latex/wx/dllload.tex new file mode 100644 index 0000000000..dc4210e08d --- /dev/null +++ b/docs/latex/wx/dllload.tex @@ -0,0 +1,145 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: dllload.tex +%% Purpose: wxDllLoader documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 02.04.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxDllLoader}}\label{wxdllloader} + +wxDllLoader is a class providing an interface similar to Unix's {\tt +dlopen()}. It is used by the wxLibrary framework and manages the actual +loading of shared libraries and the resolving of symbols in them. There are no +instances of this class, it simply serves as a namespace for its static member +functions. + +The terms {\it DLL} and {\it shared library/object} will both be used in the +documentation to refer to the same thing: a {\tt .dll} file under Windows or +{\tt .so} or {\tt .sl} one under Unix. + +Example of using this class to dynamically load {\tt strlen()} function: + +\begin{verbatim} +#if defined(__WXMSW__) + static const wxChar *LIB_NAME = _T("kernel32"); + static const wxChar *FUNC_NAME = _T("lstrlenA"); +#elif defined(__UNIX__) + static const wxChar *LIB_NAME = _T("/lib/libc-2.0.7.so"); + static const wxChar *FUNC_NAME = _T("strlen"); +#endif + + wxDllType dllHandle = wxDllLoader::LoadLibrary(LIB_NAME); + if ( !dllHandle ) + { + ... error ... + } + else + { + typedef int (*strlenType)(char *); + strlenType pfnStrlen = (strlenType)wxDllLoader::GetSymbol(dllHandle, FUNC_NAME); + if ( !pfnStrlen ) + { + ... error ... + } + else + { + if ( pfnStrlen("foo") != 3 ) + { + ... error ... + } + else + { + ... ok! ... + } + } + + wxDllLoader::UnloadLibrary(dllHandle); + } +\end{verbatim} + +\wxheading{Derived from} + +No base class + +\wxheading{Include files} + +<wx/dynlib.h> + +\wxheading{Data structures} + +This header defines a platfrom-dependent {\tt wxDllType} typedef which stores +a handle to a loaded DLLs on the given platform. + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxDllLoader::GetDllExt}\label{wxdllloadergetdllext} + +\func{static wxString}{GetDllExt}{\void} + +Returns the string containing the usual extension for shared libraries for the +given systems (including the leading dot if not empty). + +For example, this function will return {\tt ".dll"} under Windows or (usually) +{\tt ".so"} under Unix. + +\membersection{wxDllLoader::GetProgramHandle}\label{wxdllloadergetprogramhandle} + +\func{wxDllType}{GetProgramHandle}{\void} + +This function returns a valid handle for the main program itself. Notice that +the {\tt NULL} return value is valid for some systems (i.e. doesn't mean that +the function failed). + +{\bf NB:} This function is Unix specific. It will always fail under Windows +or OS/2. + +\membersection{wxDllLoader::GetSymbol}\label{wxdllloadergetsymbol} + +\func{void *}{GetSymbol}{\param{wxDllType }{dllHandle}, \param{const wxString\& }{name}} + +This function resolves a symbol in a loaded DLL, such as a variable or +function name. + +Returned value will be {\tt NULL} if the symbol was not found in the DLL or if +an error occured. + +\wxheading{Parameters} + +\docparam{dllHandle}{Valid handle previously returned by +\helpref{LoadLibrary}{wxdllloaderloadlibrary}} + +\docparam{name}{Name of the symbol.} + +\membersection{wxDllLoader::LoadLibrary}\label{wxdllloaderloadlibrary} + +\func{wxDllType}{LoadLibrary}{\param{const wxString \& }{libname}, \param{bool* }{success = NULL}} + +This function loads a shared library into memory, with {\it libname} being the +name of the library: it may be either the full name including path and +(platform-dependent) extenesion, just the basename (no path and no extension) +or a basename with extentsion. In the last two cases, the library will be +searched in all standard locations. + +Returns a handle to the loaded DLL. Use {\it success} parameter to test if it +is valid. If the handle is valid, the library must be unloaded later with +\helpref{UnloadLibrary}{wxdllloaderunloadlibrary}. + +\wxheading{Parameters} + +\docparam{libname}{Name of the shared object to load.} + +\docparam{success}{May point to a bool variable which will be set to TRUE or +FALSE; may also be {\tt NULL}.} + +\membersection{wxDllLoader::UnloadLibrary}\label{wxdllloaderunloadlibrary} + +\func{void}{UnloadLibrary}{\param{wxDllType }{dllhandle}} + +This function unloads the shared library. The handle {\it dllhandle} must have +been returned by \helpref{LoadLibrary}{wxdllloaderloadlibrary} previously. + + diff --git a/docs/latex/wx/dobjcomp.tex b/docs/latex/wx/dobjcomp.tex index 9eca258530..fbdc1c5ac4 100644 --- a/docs/latex/wx/dobjcomp.tex +++ b/docs/latex/wx/dobjcomp.tex @@ -6,7 +6,7 @@ %% Created: 02.11.99 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxDataObjectComposite}}\label{wxdataobjectcomposite} diff --git a/docs/latex/wx/dobjsmpl.tex b/docs/latex/wx/dobjsmpl.tex index 2d98a385d4..6e9fe1d7d6 100644 --- a/docs/latex/wx/dobjsmpl.tex +++ b/docs/latex/wx/dobjsmpl.tex @@ -6,7 +6,7 @@ %% Created: 02.11.99 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxDataObjectSimple}}\label{wxdataobjectsimple} diff --git a/docs/latex/wx/document.tex b/docs/latex/wx/document.tex index 23ba287409..462d6365b6 100644 --- a/docs/latex/wx/document.tex +++ b/docs/latex/wx/document.tex @@ -336,10 +336,12 @@ framework. \membersection{wxDocument::SetFilename} -\func{void}{SetFilename}{\param{const wxString\& }{filename}} +\func{void}{SetFilename}{\param{const wxString\& }{filename}, \param{bool}{ notifyViews = FALSE}} Sets the filename for this document. Usually called by the framework. +If {\it notifyViews} is TRUE, wxView::OnChangeFilename is called for all views. + \membersection{wxDocument::SetTitle} \func{void}{SetTitle}{\param{const wxString\& }{title}} diff --git a/docs/latex/wx/dragimag.tex b/docs/latex/wx/dragimag.tex index be414f9123..171de387a4 100644 --- a/docs/latex/wx/dragimag.tex +++ b/docs/latex/wx/dragimag.tex @@ -7,6 +7,9 @@ On Windows, the WIN32 API is used to do achieve smooth dragging. On other platfo wxGenericDragImage is used. Applications may also prefer to use wxGenericDragImage on Windows, too. +\pythonnote{wxPython uses wxGenericDragImage on all platforms, but +uses the wxDragImage name.} + To use this class, when you wish to start dragging an image, create a wxDragImage object and store it somewhere you can access it as the drag progresses. Call BeginDrag to start, and EndDrag to stop the drag. To move the image, @@ -19,6 +22,10 @@ either across the whole screen, or just restricted to one area of the screen to save resources. If you want the user to drag between two windows, then you will need to use full-screen dragging. +If you wish to draw the image yourself, use wxGenericDragImage and +override \helpref{wxDragImage::DoDrawImage}{wxdragimagedodrawimage} and +\helpref{wxDragImage::GetImageRect}{wxdragimagegetimagerect}. + Please see {\tt samples/dragimag} for an example. \wxheading{Derived from} @@ -48,19 +55,34 @@ Constructs a drag image from a bitmap and optional cursor. Constructs a drag image from an icon and optional cursor. +\pythonnote{This constructor is called wxDragIcon in wxPython.} + \func{}{wxDragImage}{\param{const wxString\& }{text}, \param{const wxCursor\& }{cursor = wxNullCursor}, \param{const wxPoint& }{hotspot = wxPoint(0, 0)}} Constructs a drag image from a text string and optional cursor. +\pythonnote{This constructor is called wxDragString in wxPython.} + \func{}{wxDragImage}{\param{const wxTreeCtrl\& }{treeCtrl}, \param{wxTreeItemId\& }{id}} Constructs a drag image from the text in the given tree control item, and optional cursor. +\pythonnote{This constructor is called wxDragTreeItem in wxPython.} + \func{}{wxDragImage}{\param{const wxListCtrl\& }{treeCtrl}, \param{long }{id}} Constructs a drag image from the text in the given tree control item, and optional cursor. +\pythonnote{This constructor is called wxDragListItem in wxPython.} + +\func{}{wxDragImage}{\param{const wxCursor\& }{cursor = wxNullCursor}, + \param{const wxPoint& }{hotspot = wxPoint(0, 0)}} + +Constructs a drag image an optional cursor. This constructor is only available for +wxGenericDragImage, and can be used when the application +supplies \helpref{wxDragImage::DoDrawImage}{wxdragimagedodrawimage} and \helpref{wxDragImage::GetImageRect}{wxdragimagegetimagerect}. + \wxheading{Parameters} \docparam{image}{Icon or bitmap to be used as the drag image. The bitmap can @@ -117,6 +139,16 @@ bounds the dragging operation. Specifying this can make the operation more effic by cutting down on the area under consideration, and it can also make a visual difference since the drag is clipped to this area.} +\membersection{wxDragImage::DoDrawImage}\label{wxdragimagedodrawimage} + +\func{virtual bool}{DoDrawImage}{\param{wxDC\&}{ dc}, \param{const wxPoint\&}{ pos}} + +Draws the image on the device context with top-left corner at the given position. + +This function is only available with wxGenericDragImage, to allow applications to +draw their own image instead of using an actual bitmap. If you override this function, +you must also override \helpref{wxDragImage::GetImageRect}{wxdragimagegetimagerect}. + \membersection{wxDragImage::EndDrag}\label{wxdragimageenddrag} \func{bool}{EndDrag}{\void} @@ -125,6 +157,16 @@ Call this when the drag has finished. Note that this call automatically calls ReleaseMouse. +\membersection{wxDragImage::GetImageRect}\label{wxdragimagegetimagerect} + +\constfunc{virtual wxRect}{GetImageRect}{\param{const wxPoint\&}{ pos}} + +Returns the rectangle enclosing the image, assuming that the image is drawn with its +top-left corner at the given point. + +This function is available in wxGenericDragImage only, and may be overridden (together with +\helpref{wxDragImage::DoDrawImage}{wxdragimagedodrawimage}) to provide a virtual drawing capability. + \membersection{wxDragImage::Hide}\label{wxdragimagehide} \func{bool}{Hide}{\void} @@ -153,3 +195,21 @@ will be smoother if you move the image when it is shown. Shows the image. Call this at least once when dragging. +\membersection{wxDragImage::UpdateBackingFromWindow}\label{wxdragimageupdatebackingfromwindow} + +\constfunc{bool}{UpdateBackingFromWindow}{\param{wxDC\&}{ windowDC}, \param{wxMemoryDC\&}{ destDC}, + \param{const wxRect\&}{ sourceRect}, \param{const wxRect\&}{ destRect}} + +Override this if you wish to draw the window contents to the backing bitmap +yourself. This can be desirable if you wish to avoid flicker by not having to +redraw the updated window itself just before dragging, which can cause a flicker just +as the drag starts. Instead, paint the drag image's backing bitmap to show the appropriate +graphic {\it minus the objects to be dragged}, and leave the window itself to be updated +by the drag image. This can provide eerily smooth, flicker-free drag behaviour. + +The default implementation copies the window contents to the backing bitmap. A new +implementation will normally copy information from another source, such as from its +own backing bitmap if it has one, or directly from internal data structures. + +This function is available in wxGenericDragImage only. + diff --git a/docs/latex/wx/dropsrc.tex b/docs/latex/wx/dropsrc.tex index b9ec41ca95..9b306331ee 100644 --- a/docs/latex/wx/dropsrc.tex +++ b/docs/latex/wx/dropsrc.tex @@ -2,7 +2,7 @@ This class represents a source for a drag and drop operation. -See \helpref{Drag'n'Drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview} +See \helpref{Drag and drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview} for more information. \wxheading{Derived from} @@ -37,12 +37,31 @@ enum wxDragResult \membersection{wxDropSource::wxDropSource}\label{wxdropsourcewxdropsource} -\func{}{wxDropSource}{\param{wxWindow*}{ win = NULL}} +\func{}{wxDropSource}{\param{wxWindow*}{ win = NULL},\param{const wxIconOrCursor\& }{iconCopy = wxNullIconOrCursor}, \param{const wxIconOrCursor\& }{iconCopy = wxNullIconOrCursor}, \param{const wxIconOrCursor\& }{iconNone = wxNullIconOrCursor}} -Default/wxGTK-specific constructor. If you use the default constructor you must -call \helpref{SetData}{wxdropsourcesetdata} later. +\func{}{wxDropSource}{\param{wxDataObject\&}{ data}, \param{wxWindow*}{ win = NULL},\param{const wxIconOrCursor\& }{iconCopy = wxNullIconOrCursor}, \param{const wxIconOrCursor\& }{iconCopy = wxNullIconOrCursor}, \param{const wxIconOrCursor\& }{iconNone = wxNullIconOrCursor}} -Note that {\it win} is required by the GTK port and therefore should always be set. +The constructors for wxDataObject. + +If you use the constructor without {\it data} parameter you must call +\helpref{SetData}{wxdropsourcesetdata} later. + +Note that the exact type of {\it iconCopy} and subsequent parameters differs +between wxMSW and wxGTK: these are cursors under Windows but icons for GTK. +You should use the macro \helpref{wxDROP\_ICON}{wxdropicon} in portable +programs instead of directly using either of these types. + +\wxheading{Parameters} + +\docparam{win}{The window which initiates the drag and drop operation.} + +\docparam{iconCopy}{The icon or cursor used for feedback for copy operation.} + +\docparam{iconMove}{The icon or cursor used for feedback for move operation.} + +\docparam{iconNone}{The icon or cursor used for feedback when operation can't be done.} + +{\it win} is the window which initiates the drag and drop operation. \membersection{wxDropSource::\destruct{wxDropSource}}\label{wxdropsourcedtor} diff --git a/docs/latex/wx/droptrgt.tex b/docs/latex/wx/droptrgt.tex index 235118dd32..eb9ca1eed6 100644 --- a/docs/latex/wx/droptrgt.tex +++ b/docs/latex/wx/droptrgt.tex @@ -11,7 +11,7 @@ the whole window area, but only a small portion of it. The normal sequence of ca \helpref{OnEnter}{wxdroptargetonenter}, possibly many times \helpref{OnDragOver}{wxdroptargetondragover}, \helpref{OnDrop}{wxdroptargetondrop} and finally \helpref{OnData}{wxdroptargetondata}. -See \helpref{Drag'n'Drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview} +See \helpref{Drag and drop overview}{wxdndoverview} and \helpref{wxDataObject overview}{wxdataobjectoverview} for more information. \wxheading{Derived from} diff --git a/docs/latex/wx/encconv.tex b/docs/latex/wx/encconv.tex index bc95d61667..2bacaf4153 100644 --- a/docs/latex/wx/encconv.tex +++ b/docs/latex/wx/encconv.tex @@ -7,7 +7,7 @@ This class is capable of converting strings between any two 8-bit encodings/charsets. It can also convert from/to Unicode (but only -if you compiled wxWindows with wxUSE\_UNICODE set to 1). +if you compiled wxWindows with wxUSE\_WCHAR\_T set to 1). \wxheading{Derived from} @@ -20,6 +20,7 @@ if you compiled wxWindows with wxUSE\_UNICODE set to 1). \wxheading{See also} \helpref{wxFontMapper}{wxfontmapper}, +\helpref{wxMBConv}{wxmbconv}, \helpref{Writing non-English applications}{nonenglishoverview} @@ -48,14 +49,14 @@ cannot be converted because it does not exist in output encoding: \begin{twocollist}\itemsep=0pt \twocolitem{{\bf wxCONVERT\_STRICT}}{follow behaviour of GNU Recode - -just copy unconvertable characters to output and don't change them +just copy unconvertible characters to output and don't change them (its integer value will stay the same)} \twocolitem{{\bf wxCONVERT\_SUBSTITUTE}}{try some (lossy) substitutions -- e.g. replace unconvertable latin capitals with acute by ordinary +- e.g. replace unconvertible latin capitals with acute by ordinary capitals, replace en-dash or em-dash by '-' etc.} \end{twocollist} -Both modes gurantee that output string will have same length +Both modes guarantee that output string will have same length as input string. \wxheading{Return value} @@ -107,10 +108,10 @@ unix CP1252 {ISO8859_1,ISO8859_15} \end{verbatim} Equivalence is defined in terms of convertibility: -2 encodings are equivalent if you can convert text between -then without loosing information (it may - and will - happen -that you loose special chars like quotation marks or em-dashes -but you shouldn't loose any diacritics and language-specific +two encodings are equivalent if you can convert text between +then without losing information (it may - and will - happen +that you lose special chars like quotation marks or em-dashes +but you shouldn't lose any diacritics and language-specific characters when converting between equivalent encodings). Remember that this function does {\bf NOT} check for presence of @@ -121,14 +122,14 @@ encodings. (It usually returns only one encoding.) \begin{itemize}\itemsep=0pt \item Note that argument {\it enc} itself may be present in the returned array, -so that you can - as a side effect - detect whether the +so that you can, as a side-effect, detect whether the encoding is native for this platform or not. -\item helpref{Convert}{wxencodingconverterconvert} is not limited to -converting between equivalent encodings, it can convert between arbitrary -two encodings. -\item If {\it enc} is present in returned array, then it is {\bf always} first +\item \helpref{Convert}{wxencodingconverterconvert} is not limited to +converting between equivalent encodings, it can convert between two arbitrary +encodings. +\item If {\it enc} is present in the returned array, then it is {\bf always} the first item of it. -\item Please note that the returned array may not contain any items at all. +\item Please note that the returned array may contain no items at all. \end{itemize} \membersection{wxEncodingConverter::GetAllEquivalents}\label{wxencodingconvertergetallequivalents} @@ -138,7 +139,7 @@ item of it. Similar to \helpref{GetPlatformEquivalents}{wxencodingconvertergetplatformequivalents}, but this one will return ALL -equivalent encodings, regardless the platform, and including itself. +equivalent encodings, regardless of the platform, and including itself. This platform's encodings are before others in the array. And again, if {\it enc} is in the array, it is the very first item in it. diff --git a/docs/latex/wx/file.tex b/docs/latex/wx/file.tex index 45c210b98b..ac45262df2 100644 --- a/docs/latex/wx/file.tex +++ b/docs/latex/wx/file.tex @@ -5,6 +5,8 @@ minimize the overhead of using it - in fact, there is hardly any overhead at all, but using it brings you automatic error checking and hides differences between platforms and compilers. wxFile also automatically closes the file in its destructor making it unnecessary to worry about forgetting to do it. +wxFile is a wrapper around {\tt file descriptor.} - see also +\helpref{wxFFile}{wxffile} for a wrapper around {\tt FILE} structure. \wxheading{Derived from} @@ -39,7 +41,7 @@ These constants define the file access rights and are used with \helpref{wxFile::Create}{wxfilecreate} and \helpref{wxFile::Open}{wxfileopen}. The {\it OpenMode} enumeration defines the different modes for opening a file, -it's defined inside wxFile class so its members should be specified with {\it wxFile::} scope +it is defined inside wxFile class so its members should be specified with {\it wxFile::} scope resolution prefix. It is also used with \helpref{wxFile::Access}{wxfileaccess} function. \twocolwidtha{7cm} @@ -50,7 +52,8 @@ or test if it can be opened for writing with Access()} \twocolitem{{\bf wxFile::read\_write}}{Open file for reading and writing; can not be used with Access()} \twocolitem{{\bf wxFile::write\_append}}{Open file for appending: the file is opened for writing, but the old contents of the file is not erased and the file pointer is initially placed at the end of the file; -can not be used with Access()} +can not be used with Access(). This is the same as {\bf wxFile::write} if the +file doesn't exist.} \end{twocollist} Other constants defined elsewhere but used by wxFile functions are wxInvalidOffset which represents an @@ -158,7 +161,10 @@ in the file. Note also that this function doesn't work on unseekable file descriptors (examples include pipes, terminals and sockets under Unix) and an attempt to -use it will result in an error message in such case. +use it will result in an error message in such case. So, to read the entire +file into memory, you should write a loop which uses +\helpref{Read}{wxfileread} repeatedly and tests its return condition instead +of using Eof() as this will not work for special files under Unix. \membersection{wxFile::Exists}\label{wxfileexists} @@ -252,11 +258,11 @@ The actual offset position achieved, or wxInvalidOffset on failure. \constfunc{off\_t}{Tell}{\void} Returns the current position or wxInvalidOffset if file is not opened or if another -error occured. +error occurred. \membersection{wxFile::Write}\label{wxfilewrite} -\func{bool}{Write}{\param{const void*}{ buffer}, \param{off\_t}{ count}} +\func{size\_t}{Write}{\param{const void*}{ buffer}, \param{off\_t}{ count}} Writes the specified number of bytes from a buffer. @@ -268,7 +274,7 @@ Writes the specified number of bytes from a buffer. \wxheading{Return value} -TRUE if the operation was successful. +the number of bytes actually written \membersection{wxFile::Write}\label{wxfilewrites} @@ -278,10 +284,11 @@ Writes the contents of the string to the file, returns TRUE on success. \section{\class{wxFFile}}\label{wxffile} -A wxFFile performs raw file I/O. This is a very small class designed to +wxFFile implements buffered file I/O. This is a very small class designed to minimize the overhead of using it - in fact, there is hardly any overhead at all, but using it brings you automatic error checking and hides differences -between platforms and compilers. +between platforms and compilers. It wraps inside it a {\tt FILE *} handle used +by standard C IO library (also known as {\tt stdio}). \wxheading{Derived from} diff --git a/docs/latex/wx/filedlg.tex b/docs/latex/wx/filedlg.tex index 0932cb3306..23b6835bf8 100644 --- a/docs/latex/wx/filedlg.tex +++ b/docs/latex/wx/filedlg.tex @@ -186,7 +186,7 @@ Sets the wildcard, which in Windows can contain multiple file types. \func{int}{ShowModal}{\void} -Shows the dialog, returning wxID\_OK if the user pressed OK, and wxOK\_CANCEL +Shows the dialog, returning wxID\_OK if the user pressed OK, and wxID\_CANCEL otherwise. diff --git a/docs/latex/wx/filetype.tex b/docs/latex/wx/filetype.tex index e711958c3d..e9c0955493 100644 --- a/docs/latex/wx/filetype.tex +++ b/docs/latex/wx/filetype.tex @@ -13,7 +13,7 @@ will be returned if the corresponding information couldn't be found. The objects of this class are never created by the application code but are returned by \helpref{wxMimeTypesManager::GetFileTypeFromMimeType}{wxmimetypesmanagergetfiletypefrommimetype} and \helpref{wxMimeTypesManager::GetFileTypeFromExtension}{wxmimetypesmanagergetfiletypefromextension} methods. -But it's your responsibility to delete the returned pointer when you're done +But it is your responsibility to delete the returned pointer when you're done with it! % TODO describe MIME types better than this... diff --git a/docs/latex/wx/flexsizr.tex b/docs/latex/wx/flexsizr.tex new file mode 100644 index 0000000000..7004c0e1fa --- /dev/null +++ b/docs/latex/wx/flexsizr.tex @@ -0,0 +1,24 @@ +\section{\class{wxFlexGridSizer}}\label{wxflexgridsizer} + +A flex grid sizer is a sizer which lays out its children in a two-dimensional +table with all table fields in one row having the same +height and all fields in one column having the same width. + +\wxheading{Derived from} + +\helpref{wxGridSizer}{wxsizer}\\ +\helpref{wxSizer}{wxsizer}\\ +\helpref{wxObject}{wxobject} + +\membersection{wxFlexGridSizer::wxFlexGridSizer}\label{wxflexgridsizerwxflexgridsizer} + +\func{}{wxFlexGridSizer}{\param{int }{rows}, \param{int }{cols}, \param{int }{vgap}, \param{int }{hgap}} + +\func{}{wxFlexGridSizer}{\param{int }{cols}, \param{int }{vgap = 0}, \param{int }{hgap = 0}} + +Constructor for a wxGridSizer. {\it rows} and {\it cols} determine the number of +columns and rows in the sizer - if either of the parameters is zero, it will be +calculated to form the total number of children in the sizer, thus making the +sizer grow dynamically. {\it vgap} and {\it hgap} define extra space between +all children. + diff --git a/docs/latex/wx/fontenum.tex b/docs/latex/wx/fontenum.tex index 188cf5b819..8df3609217 100644 --- a/docs/latex/wx/fontenum.tex +++ b/docs/latex/wx/fontenum.tex @@ -6,7 +6,7 @@ %% Created: 03.11.99 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxFontEnumerator}}\label{wxfontenumerator} diff --git a/docs/latex/wx/forward.gif b/docs/latex/wx/forward.gif index 9c81e8c92fed7fe851ce02e7854dc26a58eae9b2..d8862174ed264064e4092accd3b9cef539651ad1 100644 GIT binary patch literal 959 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0fnyGXIEReKh6M+kIfS)hPHb3s zxLrWmYmUc6#fEMMt*jmnhsLHJY3Haf96?J?Hp|-2i-|Ny^_-?1d#FXTc$r6!p5d)K zGcGBgoU2&9ibd*+`o-D${aUf7wyeCo+&Es%)uQy}(Z*2TG}~E%ORlfx_IlKED>NZ; wbH-jL-q~hvBDNIFUuAn+=ylY_lIO=twXW(!Y|OjPCFiqa!^6Y8%uEc{09+_1fB*mh literal 164 zcmV;V09*e@Nk%v~VI=?<0Pz3-zrVld=jU&4Z(9HWEC2ui03`qz0007gjE||y?Z1Qp zwAzdF6*A}#V%!v#-{_g@)>Q-cu3}3Ku`2^Nfa3dZ+VyHW%gtsZ`jV7k@%j8Ij}~W) zc{NUP6)X3OWa^|{8nl?rh|gZ1@{(qofnsWu+nmFHSnaq>lB41zSVC9`a)_v*xHx0L S5h*!IS!o$ynW>ps0028gDN7ju diff --git a/docs/latex/wx/frame.tex b/docs/latex/wx/frame.tex index e6ec525ca4..6643c627ca 100644 --- a/docs/latex/wx/frame.tex +++ b/docs/latex/wx/frame.tex @@ -24,25 +24,29 @@ application windows. \twocolwidtha{5cm} \begin{twocollist}\itemsep=0pt +\twocolitem{\windowstyle{wxDEFAULT\_FRAME\_STYLE}}{Defined as {\bf wxMINIMIZE\_BOX \pipe wxMAXIMIZE\_BOX \pipe wxRESIZE\_BOX \pipe wxSYSTEM\_MENU \pipe wxCAPTION}.} \twocolitem{\windowstyle{wxICONIZE}}{Display the frame iconized (minimized). Windows only. } \twocolitem{\windowstyle{wxCAPTION}}{Puts a caption on the frame.} -\twocolitem{\windowstyle{wxDEFAULT\_FRAME\_STYLE}}{Defined as {\bf wxMINIMIZE\_BOX \pipe wxMAXIMIZE\_BOX \pipe wxTHICK\_FRAME \pipe wxSYSTEM\_MENU \pipe wxCAPTION}.} -\twocolitem{\windowstyle{wxMINIMIZE}}{Identical to {\bf wxICONIZE}. Windows only. } -\twocolitem{\windowstyle{wxMINIMIZE\_BOX}}{Displays a minimize box on the frame. } -\twocolitem{\windowstyle{wxMAXIMIZE}}{Displays the frame maximized. Windows only. } -\twocolitem{\windowstyle{wxMAXIMIZE\_BOX}}{Displays a maximize box on the frame. } -\twocolitem{\windowstyle{wxSTAY\_ON\_TOP}}{Stay on top of other windows. Windows only. } -\twocolitem{\windowstyle{wxSYSTEM\_MENU}}{Displays a system menu. } -\twocolitem{\windowstyle{wxTHICK\_FRAME}}{Displays a thick frame around the window. Windows and Motif only.} -\twocolitem{\windowstyle{wxSIMPLE\_BORDER}}{Displays no border or decorations. GTK and Windows only (?). } +\twocolitem{\windowstyle{wxMINIMIZE}}{Identical to {\bf wxICONIZE}. Windows only.} +\twocolitem{\windowstyle{wxMINIMIZE\_BOX}}{Displays a minimize box on the frame.} +\twocolitem{\windowstyle{wxMAXIMIZE}}{Displays the frame maximized. Windows only.} +\twocolitem{\windowstyle{wxMAXIMIZE\_BOX}}{Displays a maximize box on the frame.} +\twocolitem{\windowstyle{wxSTAY\_ON\_TOP}}{Stay on top of other windows. Windows only.} +\twocolitem{\windowstyle{wxSYSTEM\_MENU}}{Displays a system menu.} +\twocolitem{\windowstyle{wxSIMPLE\_BORDER}}{Displays no border or decorations. GTK and Windows only.} \twocolitem{\windowstyle{wxRESIZE\_BORDER}}{Displays a resizeable border around the window (Unix only).} \twocolitem{\windowstyle{wxFRAME\_FLOAT\_ON\_PARENT}}{Causes the frame to be above the parent window in the z-order and not shown in the taskbar. Without this style, frames are created as top-level windows that may be obscured by -the parent window, and frame titles are shown in the taskbar. Windows and GTK. } +the parent window, and frame titles are shown in the taskbar. Windows and GTK.} \twocolitem{\windowstyle{wxFRAME\_TOOL\_WINDOW}}{Causes a frame with a small titlebar to be created; -the frame title does not appear in the taskbar. Windows only. } +the frame title does not appear in the taskbar. Windows only.} \end{twocollist} +The default frame style is for normal, resizeable frames. To create a frame +which can not be resized by user, you may use the following combination of +styles: {\tt wxDEFAULT\_FRAME\_STYLE \& \~ (wxRESIZE\_BORDER \pipe wxRESIZE\_BOX \pipe wxMAXIMIZE\_BOX)}. +% Note: the space after the tilde is necessary or Tex2RTF complains. + See also \helpref{window styles overview}{windowstyles}. \wxheading{Remarks} diff --git a/docs/latex/wx/fs.tex b/docs/latex/wx/fs.tex index 61422f1947..21821955f6 100644 --- a/docs/latex/wx/fs.tex +++ b/docs/latex/wx/fs.tex @@ -2,36 +2,37 @@ The wxHTML library uses a {\bf virtual file systems} mechanism similar to the one used in Midnight Commander, Dos Navigator, -FAR or almost any modern file manager. (Do you remember? You can -press enter on ZIP file and its contents is displayed as if it -were a local directory...) +FAR or almost any modern file manager. It allows the user to access +data stored in archives as if they were ordinary files. On-the-fly +generated files that exist only in memory are also supported. \wxheading{Classes} -Three classes are used in order to provide full VFS: +Three classes are used in order to provide virtual file systems mechanism: \begin{itemize}\itemsep=0pt \item The \helpref{wxFSFile}{wxfsfile} class provides information -on opened file (name, input stream, mime type and anchor). +about opened file (name, input stream, mime type and anchor). \item The \helpref{wxFileSystem}{wxfilesystem} class is the interface. Its main methods are ChangePathTo() and OpenFile(). This class is most often used by the end user. \item The \helpref{wxFileSystemHandler}{wxfilesystemhandler} is the core -if VFS mechanism. You can derive your own handler and pass it to +of virtual file systems mechanism. You can derive your own handler and pass it to +of the VFS mechanism. You can derive your own handler and pass it to wxFileSystem's AddHandler() method. In the new handler you only need to -overwrite OpenFile() and CanOpen() methods. +override the OpenFile() and CanOpen() methods. \end{itemize} \wxheading{Locations} -Locations (aka filenames aka addresses) are constructed from 4 parts: +Locations (aka filenames aka addresses) are constructed from four parts: \begin{itemize}\itemsep=0pt \item {\bf protocol} - handler can recognize if it is able to open a file by checking its protocol. Examples are "http", "file" or "ftp". \item {\bf right location} - is the name of file within the protocol. In "http://www.wxwindows.org/index.html" the right location is "//www.wxwindows.org/index.html". -\item {\bf anchor} - anchor is optional and is usually not present. +\item {\bf anchor} - an anchor is optional and is usually not present. In "index.htm\#chapter2" the anchor is "chapter2". \item {\bf left location} - this is usually an empty string. It is used by 'local' protocols such as ZIP. @@ -40,33 +41,37 @@ See Combined Protocols paragraph for details. \wxheading{Combined Protocols} -Left location pretends protocol in URL string. -It's not used by global protocols like HTTP but it's used -by local ones - for example you can see this address: +The left location precedes the protocol in the URL string. +It is not used by global protocols like HTTP but it becomes handy when nesting +protocols - for example you may want to access files in ZIP archive that is +located on some FTP server: + +ftp:ftp.archives.org/pub/cpp\_doc.zip\#zip:reference/fopen.htm\#syntax + +In fact, you have to use 'left location' even when accessing local ZIPs: file:archives/cpp\_doc.zip\#zip:reference/fopen.htm\#syntax -In this example, protocol is "zip", left location is -"reference/fopen.htm", anchor is "syntax" and right location -is "file:archives/cpp\_doc.zip". It is used by zip handler -to determine in what file this particular zip VFS is stored. +In this example, the protocol is "zip", the left location is +"reference/fopen.htm", the anchor is "syntax" and the right location +is "file:archives/cpp\_doc.zip". -In fact there are two protocols used in this example: zip and file. +There are {\bf two} protocols used in this example: "zip" and "file". You can construct even more complicated addresses like this one: http://www.archives.org/myarchive.zip\#zip:local/docs/cpp/stdio.zip\#zip:index.htm -In this example you access zip VFS stdio.zip stored in another zip (myarchive.zip) -which is at WWW. +In this example you access zip virtual file system stdio.zip stored in another zip (myarchive.zip) +which can be found at WWW. \wxheading{File Systems Included in wxHTML} -Following VFS handlers are part of wxWindows so far: +The following virtual file system handlers are part of wxWindows so far: \begin{twocollist} -\twocolitem{{\bf wxInternetFSHandler}}{Handler for accessing documents +\twocolitem{{\bf wxInternetFSHandler}}{A handler for accessing documents via HTTP or FTP protocols. Include file is <wx/fs_inet.h>.} -\twocolitem{{\bf wxZipFSHandler}}{Handler for ZIP archives. +\twocolitem{{\bf wxZipFSHandler}}{A handler for ZIP archives. Include file is <wx/fs_zip.h>. URL is in form "archive.zip\#zip:filename".} \twocolitem{{\bf wxMemoryFSHandler}}{This handler allows you to access data stored in memory (such as bitmaps) as if they were regular files. @@ -75,8 +80,10 @@ Include file is <wx/fs_mem.h>. UURL is prefixed with memory:, e.g. "memory:myfile.htm"} \end{twocollist} -In addition, wxFileSystem can access local files. +In addition, wxFileSystem itself can access local files. + +\wxheading{Initializing file system handlers} Use \helpref{wxFileSystem::AddHandler}{wxfilesystemaddhandler} to initialize a handler, for example: @@ -90,7 +97,6 @@ bool MyApp::OnInit() { wxFileSystem::AddHandler(new wxMemoryFSHandler); ... +} \end{verbatim} - - diff --git a/docs/latex/wx/fs_mem.tex b/docs/latex/wx/fs_mem.tex index 41a02f0d88..fa28cf8300 100644 --- a/docs/latex/wx/fs_mem.tex +++ b/docs/latex/wx/fs_mem.tex @@ -87,6 +87,8 @@ data (bitmap, text or raw data) will be copied into private memory stream and available under name "memory:" + filename. +Note that when storing image/bitmap, you must use image format that wxWindows +can write (e.g. JPG, PNG, see \helpref{wxImage documentation}{wximage})! \membersection{wxMemoryFSHandler::RemoveFile}\label{wxmemoryfshandlerremovefile} diff --git a/docs/latex/wx/fsfile.tex b/docs/latex/wx/fsfile.tex index 0ce31a68b5..87b802f783 100644 --- a/docs/latex/wx/fsfile.tex +++ b/docs/latex/wx/fsfile.tex @@ -12,7 +12,7 @@ It provides more information than wxWindow's input stream {\bf Note:} Any pointer returned by wxFSFile's member is valid only as long as wxFSFile object exists. For example a call to GetStream() doesn't {\it create} the stream but only returns the pointer to it. In -other words after 10 calls to GetStream() you'll obtain ten identical +other words after 10 calls to GetStream() you will obtain ten identical pointers. \wxheading{Derived from} @@ -52,7 +52,7 @@ functions. \wxheading{Notes} -It is seldom used by the application programmer but you'll need it if +It is seldom used by the application programmer but you will need it if you are writing your own virtual FS. For example you may need something similar to wxMemoryInputStream, but because wxMemoryInputStream doesn't free the memory when destroyed and thus passing a memory stream diff --git a/docs/latex/wx/ftp.tex b/docs/latex/wx/ftp.tex index f49796142e..e3c5050379 100644 --- a/docs/latex/wx/ftp.tex +++ b/docs/latex/wx/ftp.tex @@ -181,7 +181,7 @@ You will be notified when the EOF is reached by an error. \wxheading{Return value} -Returns NULL if an error occured (it could be a network failure or the fact +Returns NULL if an error occurred (it could be a network failure or the fact that the file doesn't exist). Returns the initialized stream. You will have to delete it yourself when you diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index 3259724fe6..9df5c66f49 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -2,7 +2,51 @@ \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% \setfooter{\thepage}{}{}{}{}{\thepage} -The functions defined in wxWindows are described here. +The functions and macros defined in wxWindows are described here. + +\section{Version macros}\label{versionfunctions} + +The following constants are defined in wxWindows: + +\begin{itemize}\itemsep=0pt +\item {\tt wxMAJOR\_VERSION} is the major version of wxWindows +\item {\tt wxMINOR\_VERSION} is the minor version of wxWindows +\item {\tt wxRELASE\_NUMBER} is the release number +\end{itemize} + +For example, the values or these constants for wxWindows 2.1.15 are 2, 1 and +15. + +Additionally, {\tt wxVERSION\_STRING} is a user-readable string containing +the full wxWindows version and {\tt wxVERSION\_NUMBER} is a combination of the +three version numbers above: for 2.1.15, it is 2115 and it is 2200 for +wxWindows 2.2. + +\wxheading{Include files} + +<wx/version.h> or <wx/defs.h> + +\membersection{wxCHECK\_VERSION}\label{wxcheckversion} + +\func{bool}{wxCHECK\_VERSION}{\param{}{major, minor, release}} + +This is a macro which evaluates to true if the current wxWindows version is at +least major.minor.release. + +For example, to test if the program is compiled with wxWindows 2.2 or higher, +the following can be done: + +\begin{verbatim} + wxString s; +#if wxCHECK_VERSION(2, 2, 0) + if ( s.StartsWith("foo") ) +#else // replacement code for old version + if ( strncmp(s, "foo", 3) == 0 ) +#endif + { + ... + } +\end{verbatim} \section{Thread functions}\label{threadfunctions} @@ -21,8 +65,8 @@ The functions defined in wxWindows are described here. This function must be called when any thread other than the main GUI thread wants to get access to the GUI library. This function will block the execution of the calling thread until the main thread (or any other thread holding the -main GUI lock) leaves the GUI library and no other other thread will enter -the GUI library until the calling thread calls \helpref{::wxMutexGuiLeave()}{wxmutexguileave}. +main GUI lock) leaves the GUI library and no other thread will enter the GUI +library until the calling thread calls \helpref{::wxMutexGuiLeave()}{wxmutexguileave}. Typically, these functions are used like this: @@ -45,7 +89,7 @@ Note that under GTK, no creation of top-level windows is allowed in any thread but the main one. This function is only defined on platforms which support preemptive -threads. +threads. \membersection{::wxMutexGuiLeave}\label{wxmutexguileave} @@ -86,7 +130,7 @@ slashes. Returns TRUE if the file exists. It also returns TRUE if the file is a directory. -\membersection{::wxFileModificationTime} +\membersection{::wxFileModificationTime}\label{wxfilemodificationtime} \func{time\_t}{wxFileModificationTime}{\param{const wxString\& }{filename}} @@ -270,7 +314,7 @@ wxSplitPath() will correctly handle filenames with both DOS and Unix path separa Windows, however it will not consider backslashes as path separators under Unix (where backslash is a valid character in a filename). -On entry, {\it fullname} should be non NULL (it may be empty though). +On entry, {\it fullname} should be non-NULL (it may be empty though). On return, {\it path} contains the file path (without the trailing separator), {\it name} contains the file name and {\it ext} contains the file extension without leading dot. All @@ -632,7 +676,7 @@ to be used for entering passwords as the function name implies. \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\ \param{int}{ x = -1}, \param{int}{ y = -1}, \param{bool}{ centre = TRUE}} -Pop up a dialog box with title set to {\it caption}, message {\it message}, and a +Pop up a dialog box with title set to {\it caption}, {\it message}, and a \rtfsp{\it default\_value}. The user may type in text and press OK to return this text, or press Cancel to return the empty string. @@ -1056,6 +1100,21 @@ The clipboard must have previously been opened for this call to succeed. \section{Miscellaneous functions}\label{miscellany} +\membersection{::wxDROP\_ICON}\label{wxdropicon} + +\func{wxIconOrCursor}{wxDROP\_ICON}{\param{const char *}{name}} + +This macro creates either a cursor (MSW) or an icon (elsewhere) with the given +name. Under MSW, the cursor is loaded from the resource file and the icon is +loaded from XPM file under other platforms. + +This macro should be used with +\helpref{wxDropSource constructor}{wxdropsourcewxdropsource}. + +\wxheading{Include files} + +<wx/dnd.h> + \membersection{::wxNewId} \func{long}{wxNewId}{\void} @@ -1260,6 +1319,8 @@ wxWindows errors. See also \helpref{wxFatalError}{wxfatalerror}. \func{long}{wxExecute}{\param{const wxString\& }{command}, \param{wxArrayString\& }{output}} +\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{wxArrayString\& }{output}, \param{wxArrayString\& }{errors}} + Executes another program in Unix or Windows. The first form takes a command string, such as {\tt "emacs file.txt"}. @@ -1267,8 +1328,8 @@ The first form takes a command string, such as {\tt "emacs file.txt"}. The second form takes an array of values: a command, any number of arguments, terminated by NULL. -The semantics of the third version is different from the first two and is -described in more details below. +The semantics of the third and fourth versions is different from the first two +and is described in more details below. If {\it sync} is FALSE (the default), flow of control immediately returns. If TRUE, the current application waits until the other program has terminated. @@ -1285,13 +1346,14 @@ For asynchronous execution, however, the return value is the process id and zero value indicates that the command could not be executed. If callback isn't NULL and if execution is asynchronous (note that callback -parameter can not be non NULL for synchronous execution), +parameter can not be non-NULL for synchronous execution), \helpref{wxProcess::OnTerminate}{wxprocessonterminate} will be called when the process finishes. Finally, you may use the third overloaded version of this function to execute a process (always synchronously) and capture its output in the array -{\it output}. +{\it output}. The fourth version adds the possibility to additionally capture +the messages from standard error output in the {\it errors} array. See also \helpref{wxShell}{wxshell}, \helpref{wxProcess}{wxprocess}, \helpref{Exec sample}{sampleexec}. @@ -1397,21 +1459,6 @@ Return the (current) user's home directory. <wx/utils.h> -\membersection{::wxGetElapsedTime}\label{wxgetelapsedtime} - -\func{long}{wxGetElapsedTime}{\param{bool}{ resetTimer = TRUE}} - -Gets the time in milliseconds since the last \helpref{::wxStartTimer}{wxstarttimer}. - -If {\it resetTimer} is TRUE (the default), the timer is reset to zero -by this call. - -See also \helpref{wxTimer}{wxtimer}. - -\wxheading{Include files} - -<wx/timer.h> - \membersection{::wxGetFreeMemory}\label{wxgetfreememory} \func{long}{wxGetFreeMemory}{\void} @@ -1439,7 +1486,7 @@ Returns the mouse position in screen coordinates. \func{wxString}{wxGetOsDescription}{\void} Returns the string containing the description of the current platform in a -user-readable form. For example, this function may return strings like +user-readable form. For example, this function may return strings like {\tt Windows NT Version 4.0} or {\tt Linux 2.2.2 i386}. \wxheading{See also} @@ -1457,7 +1504,7 @@ user-readable form. For example, this function may return strings like Gets operating system version information. \begin{twocollist}\itemsep=0pt -\twocolitemruled{Platform}{Return tyes} +\twocolitemruled{Platform}{Return types} \twocolitem{Macintosh}{Return value is wxMACINTOSH.} \twocolitem{GTK}{Return value is wxGTK, For GTK 1.0, {\it major} is 1, {\it minor} is 0. } \twocolitem{Motif}{Return value is wxMOTIF\_X, {\it major} is X version, {\it minor} is X revision.} @@ -1741,18 +1788,6 @@ as a keyboard shortkey in Windows and Motif) and $\backslash$t (tab in Windows). <wx/utils.h> -\membersection{::wxStartTimer}\label{wxstarttimer} - -\func{void}{wxStartTimer}{\void} - -Starts a stopwatch; use \helpref{::wxGetElapsedTime}{wxgetelapsedtime} to get the elapsed time. - -See also \helpref{wxTimer}{wxtimer}. - -\wxheading{Include files} - -<wx/timer.h> - \membersection{::wxToLower}\label{wxtolower} \func{char}{wxToLower}{\param{char }{ch}} @@ -1862,7 +1897,7 @@ function. Note that wxYield will not flush the message logs. This is intentional as calling wxYield is usually done to quickly update the screen and popping up a -message box dialog may be undesirable. If you do with to flush the log +message box dialog may be undesirable. If you do wish to flush the log messages immediately (otherwise it will be done during the next idle loop iteration), call \helpref{wxLog::FlushActive}{wxlogflushactive}. @@ -1876,7 +1911,7 @@ iteration), call \helpref{wxLog::FlushActive}{wxlogflushactive}. This functions wakes up the (internal and platform dependent) idle system, i.e. it will force the system to send an idle event even if the system currently {\it is} -idle and thus would not send any idle event until after some other event would get + idle and thus would not send any idle event until after some other event would get sent. This is also useful for sending events between two threads and is used by the corresponding functions \helpref{::wxPostEvent}{wxpostevent} and \helpref{wxEvtHandler::AddPendingEvent}{wxevthandleraddpendingevent}. @@ -2008,7 +2043,7 @@ dynamically. The same as DECLARE\_ABSTRACT\_CLASS. \func{}{DECLARE\_DYNAMIC\_CLASS}{className} Used inside a class declaration to declare that the objects of this class should be dynamically -createable from run-time type information. +creatable from run-time type information. Example: @@ -2162,6 +2197,18 @@ avoid using {\tt \#ifdef}s when creating bitmaps. <wx/gdicmn.h> +\membersection{wxConstCast}\label{wxconstcast} + +\func{}{wxConstCast}{ptr, classname} + +This macro expands into {\tt const\_cast<classname *>(ptr)} if the compiler +supports {\it const\_cast} or into an old, C-style cast, otherwise. + +\wxheading{See also} + +\helpref{wxDynamicCast}{wxdynamiccast}\\ +\helpref{wxStaticCast}{wxstaticcast} + \membersection{WXDEBUG\_NEW}\label{debugnew} \func{}{WXDEBUG\_NEW}{arg} @@ -2185,7 +2232,7 @@ In non-debug mode, this is defined as the normal new operator. This macro returns the pointer {\it ptr} cast to the type {\it classname *} if the pointer is of this type (the check is done during the run-time) or NULL -otherwise. Usage of this macro is prefered over obsoleted wxObject::IsKindOf() +otherwise. Usage of this macro is preferred over obsoleted wxObject::IsKindOf() function. The {\it ptr} argument may be NULL, in which case NULL will be returned. @@ -2201,13 +2248,15 @@ Example: } else { - // no window has the focus or it's not a text control + // no window has the focus or it is not a text control } \end{verbatim} \wxheading{See also} -\helpref{RTTI overview}{runtimeclassoverview} +\helpref{RTTI overview}{runtimeclassoverview}\\ +\helpref{wxConstCast}{wxconstcast}\\ +\helpref{wxStatiicCast}{wxstaticcast} \membersection{wxICON}\label{wxiconmacro} @@ -2226,6 +2275,17 @@ avoid using {\tt \#ifdef}s when creating icons. <wx/gdicmn.h> +\membersection{wxStaticCast}\label{wxstaticcast} + +\func{}{wxStaticCast}{ptr, classname} + +This macro checks that the cast is valid in debug mode (an assert failure will +result if {\tt wxDynamicCast(ptr, classname) == NULL}) and then returns the +result of executing an equivalent of {\tt static\_cast<classname *>(ptr)}. + +\helpref{wxDynamicCast}{wxdynamiccast}\\ +\helpref{wxConstCast}{wxconstcast} + \membersection{WXTRACE}\label{trace} \wxheading{Include files} @@ -2268,15 +2328,13 @@ files and loading user interface elements from resources. \normalbox{Please note that this use of the word `resource' is different from that used when talking about initialisation file resource reading and writing, using such functions -as wxWriteResource and wxGetResource. It's just an unfortunate clash of terminology.} +as wxWriteResource and wxGetResource. It is just an unfortunate clash of terminology.} \helponly{For an overview of the wxWindows resource mechanism, see \helpref{the wxWindows resource system}{resourceformats}.} See also \helpref{wxWindow::LoadFromResource}{wxwindowloadfromresource} for loading from resource data. -{\bf Warning:} this needs updating for wxWindows 2. - \membersection{::wxResourceAddIdentifier}\label{wxresourceaddidentifier} \func{bool}{wxResourceAddIdentifier}{\param{const wxString\& }{name}, \param{int }{value}} @@ -2300,15 +2358,15 @@ wxWindows bitmap resource identifier. For example, if the .WXR file contains the following: \begin{verbatim} -static const wxString\& aiai_resource = "bitmap(name = 'aiai_resource',\ - bitmap = ['aiai', wxBITMAP_TYPE_BMP_RESOURCE, 'WINDOWS'],\ - bitmap = ['aiai.xpm', wxBITMAP_TYPE_XPM, 'X'])."; +static const wxString\& project_resource = "bitmap(name = 'project_resource',\ + bitmap = ['project', wxBITMAP_TYPE_BMP_RESOURCE, 'WINDOWS'],\ + bitmap = ['project.xpm', wxBITMAP_TYPE_XPM, 'X'])."; \end{verbatim} then this function can be called as follows: \begin{verbatim} - wxBitmap *bitmap = wxResourceCreateBitmap("aiai_resource"); + wxBitmap *bitmap = wxResourceCreateBitmap("project_resource"); \end{verbatim} \membersection{::wxResourceCreateIcon} @@ -2320,15 +2378,15 @@ wxWindows icon resource identifier. For example, if the .WXR file contains the following: \begin{verbatim} -static const wxString\& aiai_resource = "icon(name = 'aiai_resource',\ - icon = ['aiai', wxBITMAP_TYPE_ICO_RESOURCE, 'WINDOWS'],\ - icon = ['aiai', wxBITMAP_TYPE_XBM_DATA, 'X'])."; +static const wxString\& project_resource = "icon(name = 'project_resource',\ + icon = ['project', wxBITMAP_TYPE_ICO_RESOURCE, 'WINDOWS'],\ + icon = ['project', wxBITMAP_TYPE_XBM_DATA, 'X'])."; \end{verbatim} then this function can be called as follows: \begin{verbatim} - wxIcon *icon = wxResourceCreateIcon("aiai_resource"); + wxIcon *icon = wxResourceCreateIcon("project_resource"); \end{verbatim} \membersection{::wxResourceCreateMenuBar} @@ -2387,9 +2445,9 @@ dialog(name = 'dialog1', title = 'Test dialog box', x = 312, y = 234, width = 400, height = 300, modal = 0, - control = [wxGroupBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262, + control = [1000, wxStaticBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262, [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]], - control = [wxMultiText, 'Multitext', 'wxVERTICAL_LABEL', 'multitext3', + control = [1001, wxTextCtrl, '', 'wxTE_MULTILINE', 'text3', 156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.', [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0], [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]]). @@ -2415,7 +2473,7 @@ wxWindows resource data. \membersection{::wxResourceParseString}\label{wxresourceparsestring} -\func{bool}{wxResourceParseString}{\param{const wxString\& }{resource}, \param{wxResourceTable *}{table = NULL}} +\func{bool}{wxResourceParseString}{\param{char*}{ s}, \param{wxResourceTable *}{table = NULL}} Parses a string containing one or more wxWindows resource objects. If the resource objects are global static data that are included into the @@ -2425,17 +2483,17 @@ containing the resource data, to make it known to wxWindows. {\it resource} should contain data with the following form: \begin{verbatim} -static const wxString\& dialog1 = "dialog(name = 'dialog1',\ - style = 'wxCAPTION | wxDEFAULT_DIALOG_STYLE',\ - title = 'Test dialog box',\ - x = 312, y = 234, width = 400, height = 300,\ - modal = 0,\ - control = [wxGroupBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262,\ - [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],\ - control = [wxMultiText, 'Multitext', 'wxVERTICAL_LABEL', 'multitext3',\ - 156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.',\ - [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],\ - [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]])."; +dialog(name = 'dialog1', + style = 'wxCAPTION | wxDEFAULT_DIALOG_STYLE', + title = 'Test dialog box', + x = 312, y = 234, width = 400, height = 300, + modal = 0, + control = [1000, wxStaticBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262, + [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]], + control = [1001, wxTextCtrl, '', 'wxTE_MULTILINE', 'text3', + 156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.', + [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0], + [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]]). \end{verbatim} This function will typically be used after calling \helpref{wxLoadUserResource}{wxloaduserresource} to @@ -2443,10 +2501,10 @@ load an entire {\tt .wxr file} into a string. \membersection{::wxResourceRegisterBitmapData}\label{registerbitmapdata} -\func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{const wxString\& }{xbm\_data}, \param{int }{width}, +\func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{char* }{xbm\_data}, \param{int }{width}, \param{int }{height}, \param{wxResourceTable *}{table = NULL}} -\func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{const wxString\& *}{xpm\_data}} +\func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{char** }{xpm\_data}} Makes \verb$#$included XBM or XPM bitmap data known to the wxWindows resource system. This is required if other resources will use the bitmap data, since otherwise there @@ -2504,7 +2562,7 @@ meaningless. \func{void}{wxLogVerbose}{\param{const char*}{ formatString}, \param{...}{}} -For verbose output. Normally, it's suppressed, but +For verbose output. Normally, it is suppressed, but might be activated if the user wishes to know more details about the program progress (another, but possibly confusing name for the same function is {\bf wxLogInfo}). @@ -2528,7 +2586,7 @@ Mostly used by wxWindows itself, but might be handy for logging errors after system call (API function) failure. It logs the specified message text as well as the last system error code ({\it errno} or {\it ::GetLastError()} depending on the platform) and the corresponding error message. The second form -of this function takes the error code explitly as the first argument. +of this function takes the error code explicitly as the first argument. \wxheading{See also} @@ -2615,9 +2673,89 @@ Returns the error message corresponding to the given system error code. If \helpref{wxSysErrorCode}{wxsyserrorcode}, \helpref{wxLogSysError}{wxlogsyserror} +\section{Time functions}\label{timefunctions} + +The functions in this section deal with getting the current time and +starting/stopping the global timers. Please note that the timer functions are +deprecated because they work with one global timer only and +\helpref{wxTimer}{wxtimer} and/or \helpref{wxStopWatch}{wxstopwatch} classes +should be used instead. For retrieving the current time, you may also use +\helpref{wxDateTime::Now}{wxdatetimenow} or +\helpref{wxDateTime::UNow}{wxdatetimeunow} methods. + +\membersection{::wxGetElapsedTime}\label{wxgetelapsedtime} + +\func{long}{wxGetElapsedTime}{\param{bool}{ resetTimer = TRUE}} + +Gets the time in milliseconds since the last \helpref{::wxStartTimer}{wxstarttimer}. + +If {\it resetTimer} is TRUE (the default), the timer is reset to zero +by this call. + +See also \helpref{wxTimer}{wxtimer}. + +\wxheading{Include files} + +<wx/timer.h> + +\membersection{::wxGetLocalTime}\label{wxgetlocaltime} + +\func{long}{wxGetLocalTime}{\void} + +Returns the number of seconds since local time 00:00:00 Jan 1st 1970. + +\wxheading{See also} + +\helpref{wxDateTime::Now}{wxdatetimenow} + +\wxheading{Include files} + +<wx/timer.h> + +\membersection{::wxGetLocalTimeMillis}\label{wxgetlocaltimemillis} + +\func{wxLongLone}{wxGetLocalTimeMillis}{\void} + +Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970. + +\wxheading{See also} + +\helpref{wxDateTime::Now}{wxdatetimenow},\\ +\helpref{wxLongLone}{wxlonglong} + +\wxheading{Include files} + +<wx/timer.h> + +\membersection{::wxGetUTCTime}\label{wxgetutctime} + +\func{long}{wxGetUTCTime}{\void} + +Returns the number of seconds since GMT 00:00:00 Jan 1st 1970. + +\wxheading{See also} + +\helpref{wxDateTime::Now}{wxdatetimenow} + +\wxheading{Include files} + +<wx/timer.h> + +\membersection{::wxStartTimer}\label{wxstarttimer} + +\func{void}{wxStartTimer}{\void} + +Starts a stopwatch; use \helpref{::wxGetElapsedTime}{wxgetelapsedtime} to get the elapsed time. + +See also \helpref{wxTimer}{wxtimer}. + +\wxheading{Include files} + +<wx/timer.h> + \section{Debugging macros and functions}\label{debugmacros} -Useful macros and functins for error checking and defensive programming. ASSERTs are only +Useful macros and functions for error checking and defensive programming. ASSERTs are only compiled if \_\_WXDEBUG\_\_ is defined, whereas CHECK macros stay in release builds. diff --git a/docs/latex/wx/gridsizr.tex b/docs/latex/wx/gridsizr.tex new file mode 100644 index 0000000000..9662608084 --- /dev/null +++ b/docs/latex/wx/gridsizr.tex @@ -0,0 +1,24 @@ +\section{\class{wxGridSizer}}\label{wxgridsizer} + +A grid sizer is a sizer which lays out its children in a two-dimensional +table with all table fields having the same size, +i.e. the width of each field is the width of the widest child, +the height of each field is the height of the tallest child. + +\wxheading{Derived from} + +\helpref{wxSizer}{wxsizer}\\ +\helpref{wxObject}{wxobject} + +\membersection{wxGridSizer::wxGridSizer}\label{wxgridsizerwxgridsizer} + +\func{}{wxGridSizer}{\param{int }{rows}, \param{int }{cols}, \param{int }{vgap}, \param{int }{hgap}} + +\func{}{wxGridSizer}{\param{int }{cols}, \param{int }{vgap = 0}, \param{int }{hgap = 0}} + +Constructor for a wxGridSizer. {\it rows} and {\it cols} determine the number of +columns and rows in the sizer - if either of the parameters is zero, it will be +calculated to form the total number of children in the sizer, thus making the +sizer grow dynamically. {\it vgap} and {\it hgap} define extra space between +all children. + diff --git a/docs/latex/wx/hash.tex b/docs/latex/wx/hash.tex index 21dc3642cd..6e45cab36e 100644 --- a/docs/latex/wx/hash.tex +++ b/docs/latex/wx/hash.tex @@ -95,7 +95,7 @@ is destroyed. \func{wxObject *}{Get}{\param{long}{ key}} -\func{wxObject *}{Get}{\param{const wxString\& }{ key}} +\func{wxObject *}{Get}{\param{const char*}{ key}} Gets data from the hash table, using an integer or string key (depending on which has table constructor was used). @@ -121,13 +121,12 @@ description for \helpref{wxNode}{wxnode}. The user will probably only wish to us \func{void}{Put}{\param{long}{ key}, \param{wxObject *}{object}} -\func{void}{Put}{\param{const wxString\& }{ key}, \param{wxObject *}{object}} +\func{void}{Put}{\param{const char*}{ key}, \param{wxObject *}{object}} Inserts data into the hash table, using an integer or string key (depending on which has table constructor was used). The key string is copied and stored by the hash table implementation. - \membersection{wxList::GetCount} \constfunc{size\_t}{GetCount}{\void} diff --git a/docs/latex/wx/helpinst.tex b/docs/latex/wx/helpinst.tex index f0bcaaccb6..c93b02c263 100644 --- a/docs/latex/wx/helpinst.tex +++ b/docs/latex/wx/helpinst.tex @@ -31,6 +31,8 @@ There are currently the following help controller classes defined: \begin{itemize}\itemsep=0pt \item wxWinHelpController, for controlling Windows Help. +\item wxCHMHelpController, for controlling MS HTML Help. To use this, you need to set wxUSE\_MS\_HTML\_HELP +to 0 in setup.h, and link your application with Microsoft's htmlhelp.lib. Currently VC++ only. \item wxExtHelpController, for controlling external browsers under Unix. The default browser is Netscape Navigator. The 'help' sample shows its use. \item wxHelpControllerHtml, using \helpref{wxHTML}{wxhtml} to display help. See {\tt wx/helpwxht.h} for @@ -51,6 +53,7 @@ wxHelpControllerBase\\ <wx/help.h> (wxWindows chooses the appropriate help controller class)\\ <wx/helpbase.h> (wxHelpControllerBase class)\\ <wx/helpwin.h> (Windows Help controller)\\ +<wx/msw/helpchm.h> (MS HTML Help controller)\\ <wx/generic/helpext.h> (external HTML browser controller)\\ <wx/generic/helpwxht.h> (simple wxHTML-based help controller)\\ <wx/html/helpctrl.h> (advanced wxHTML based help controller: wxHtmlHelpController) @@ -98,10 +101,14 @@ If the help viewer is not running, runs it and displays the file at the given bl {\it WinHelp:} Refers to the context number. +{\it MS HTML Help:} Refers to the context number. + {\it External HTML help:} the same as for \helpref{wxHelpController::DisplaySection}{wxhelpcontrollerdisplaysection}. {\it wxHtmlHelpController:} {\it sectionNo} is an identifier as specified in the {\tt .hhc} file. See \helpref{Help files format}{helpformat}. +This function is for backward compatibility only, and applications should use \helpref{wxHelpController}{wxhelpcontrollerdisplaysection} instead. + \membersection{wxHelpController::DisplayContents}\label{wxhelpcontrollerdisplaycontents} \func{virtual bool}{DisplayContents}{\void} @@ -111,13 +118,23 @@ contents. \membersection{wxHelpController::DisplaySection}\label{wxhelpcontrollerdisplaysection} +\func{virtual bool}{DisplaySection}{\param{const wxString\&}{ section}} + +If the help viewer is not running, runs it and displays the given section. + +The interpretation of {\it section} differs between help viewers. For most viewers, +this call is equivalent to KeywordSearch. For MS HTML Help, external HTML help +and simple wxHTML help, if {\it section} has a .htm +or .html extension, that HTML file will be displayed; otherwise +a keyword search is done. + \func{virtual bool}{DisplaySection}{\param{int}{ sectionNo}} If the help viewer is not running, runs it and displays the given section. -{\it WinHelp:} {\it sectionNo} is a context id. +{\it WinHelp, MS HTML Help:} {\it sectionNo} is a context id. -{\it External HTML help/wxHTML based help:} wxExtHelpController and wxHelpControllerHtml implement {\it sectionNo} as an id in a map file, which is of the form: +{\it External HTML help/simple wxHTML help:} wxExtHelpController and wxHelpControllerHtml implement {\it sectionNo} as an id in a map file, which is of the form: \begin{verbatim} 0 wx.html ; Index @@ -127,6 +144,8 @@ If the help viewer is not running, runs it and displays the given section. {\it wxHtmlHelpController:} {\it sectionNo} is an identifier as specified in the {\tt .hhc} file. See \helpref{Help files format}{helpformat}. +See also the help sample for notes on how to specify section numbers for various help file formats. + \membersection{wxHelpController::GetFrameParameters}\label{wxhelpcontrollergetframeparameters} \func{virtual wxFrame *}{GetFrameParameters}{\param{const wxSize * }{size = NULL}, \param{const wxPoint * }{pos = NULL}, @@ -159,10 +178,10 @@ that the viewer is a variant of Netscape Navigator.} If the help viewer is not running, runs it, and searches for sections matching the given keyword. If one match is found, the file is displayed at this section. -{\it WinHelp:} If more than one match is found, +{\it WinHelp, MS HTML Help:} If more than one match is found, the first topic is displayed. -{\it External HTML help:} If more than one match is found, +{\it External HTML help, simple wxHTML help:} If more than one match is found, a choice of topics is displayed. {\it wxHtmlHelpController:} see \helpref{wxHtmlHelpController::KeywordSearch}{wxhtmlhelpcontrollerkeywordsearch}. diff --git a/docs/latex/wx/hteasypr.tex b/docs/latex/wx/hteasypr.tex index 03e8875f4c..ec4b0d337d 100644 --- a/docs/latex/wx/hteasypr.tex +++ b/docs/latex/wx/hteasypr.tex @@ -41,15 +41,24 @@ Constructor. \membersection{wxHtmlEasyPrinting::PreviewFile}\label{wxhtmleasyprintingpreviewfile} -\func{void}{PreviewFile}{\param{const wxString\& }{htmlfile}} +\func{bool}{PreviewFile}{\param{const wxString\& }{htmlfile}} + +Preview HTML file. + +Returns FALSE in case of error -- call +\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed +information about the kind of the error. -Previews HTML file. \membersection{wxHtmlEasyPrinting::PreviewText}\label{wxhtmleasyprintingpreviewtext} -\func{void}{PreviewText}{\param{const wxString\& }{htmltext}, \param{const wxString\& }{basepath = wxEmptyString}} +\func{bool}{PreviewText}{\param{const wxString\& }{htmltext}, \param{const wxString\& }{basepath = wxEmptyString}} + +Preview HTML text (not file!). -Previews HTML text (not file!). +Returns FALSE in case of error -- call +\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed +information about the kind of the error. \wxheading{Parameters} @@ -60,15 +69,23 @@ file). It is used to determine path for loading images, for example.} \membersection{wxHtmlEasyPrinting::PrintFile}\label{wxhtmleasyprintingprintfile} -\func{void}{PrintFile}{\param{const wxString\& }{htmlfile}} +\func{bool}{PrintFile}{\param{const wxString\& }{htmlfile}} -Prints HTML file. +Print HTML file. + +Returns FALSE in case of error -- call +\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed +information about the kind of the error. \membersection{wxHtmlEasyPrinting::PrintText}\label{wxhtmleasyprintingprinttext} -\func{void}{PrintText}{\param{const wxString\& }{htmltext}, \param{const wxString\& }{basepath = wxEmptyString}} +\func{bool}{PrintText}{\param{const wxString\& }{htmltext}, \param{const wxString\& }{basepath = wxEmptyString}} + +Print HTML text (not file!). -Prints HTML text (not file!). +Returns FALSE in case of error -- call +\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed +information about the kind of the error. \wxheading{Parameters} @@ -81,19 +98,19 @@ file). It is used to determine path for loading images, for example.} \func{void}{PrinterSetup}{\void} -Displays printer setup dialog and allows the user to modify settings. +Display printer setup dialog and allows the user to modify settings. \membersection{wxHtmlEasyPrinting::PageSetup}\label{wxhtmleasyprintingpagesetup} \func{void}{PageSetup}{\void} -Displays page setup dialog and allows the user to modify settings. +Display page setup dialog and allows the user to modify settings. \membersection{wxHtmlEasyPrinting::SetHeader}\label{wxhtmleasyprintingsetheader} \func{void}{SetHeader}{\param{const wxString\& }{header}, \param{int }{pg = wxPAGE\_ALL}} -Sets page header. +Set page header. \wxheading{Parameters} @@ -111,7 +128,7 @@ Sets page header. \func{void}{SetFooter}{\param{const wxString\& }{footer}, \param{int }{pg = wxPAGE\_ALL}} -Sets page footer. +Set page footer. \wxheading{Parameters} diff --git a/docs/latex/wx/hthelpct.tex b/docs/latex/wx/hthelpct.tex index 8d2a141ae1..fdc46abd1a 100644 --- a/docs/latex/wx/hthelpct.tex +++ b/docs/latex/wx/hthelpct.tex @@ -61,6 +61,7 @@ Constructor. \begin{twocollist}\itemsep=0pt \twocolitem{\windowstyle{wxHF\_TOOLBAR}}{Help frame has toolbar.} +\twocolitem{\windowstyle{wxHF\_FLATTOOLBAR}}{Help frame has toolbar with flat buttons (aka coolbar).} \twocolitem{\windowstyle{wxHF\_CONTENTS}}{Help frame has contents panel.} \twocolitem{\windowstyle{wxHF\_INDEX}}{Help frame has index panel.} \twocolitem{\windowstyle{wxHF\_SEARCH}}{Help frame has search panel.} @@ -89,7 +90,7 @@ If {\it show\_wait\_msg} is TRUE then a decorationless window with progress mess \func{virtual wxHtmlHelpFrame*}{CreateHelpFrame}{\param{wxHtmlHelpData * }{data}} -This protected virtual method may be overriden so that the controller +This protected virtual method may be overridden so that the controller uses slightly different frame. See {\it samples/html/helpview} sample for an example. \membersection{wxHtmlHelpController::Display}\label{wxhtmlhelpcontrollerdisplay} @@ -144,7 +145,7 @@ Displays help window and focuses index panel. Displays help window, focuses search panel and starts searching. Returns TRUE if the keyword was found. -{\bf Important:} KeywordSearch searches only pages listed in .htc file(s). +{\bf Important:} KeywordSearch searches only pages listed in .hhc file(s). You should list all pages in the contents file. \membersection{wxHtmlHelpController::ReadCustomization}\label{wxhtmlhelpcontrollerreadcustomization} diff --git a/docs/latex/wx/hthlpfrm.tex b/docs/latex/wx/hthlpfrm.tex index d255a73df8..4d6f187109 100644 --- a/docs/latex/wx/hthlpfrm.tex +++ b/docs/latex/wx/hthlpfrm.tex @@ -32,6 +32,7 @@ Constructor. \begin{twocollist}\itemsep=0pt \twocolitem{\windowstyle{wxHF\_TOOLBAR}}{Help frame has toolbar.} +\twocolitem{\windowstyle{wxHF\_FLATTOOLBAR}}{Help frame has toolbar with flat buttons (aka coolbar).} \twocolitem{\windowstyle{wxHF\_CONTENTS}}{Help frame has contents panel.} \twocolitem{\windowstyle{wxHF\_INDEX}}{Help frame has index panel.} \twocolitem{\windowstyle{wxHF\_SEARCH}}{Help frame has search panel.} @@ -50,9 +51,13 @@ Creates the frame. \begin{twocollist}\itemsep=0pt \twocolitem{\windowstyle{wxHF\_TOOLBAR}}{Help frame has toolbar.} +\twocolitem{\windowstyle{wxHF\_FLATTOOLBAR}}{Help frame has toolbar with flat buttons (aka coolbar).} \twocolitem{\windowstyle{wxHF\_CONTENTS}}{Help frame has contents panel.} \twocolitem{\windowstyle{wxHF\_INDEX}}{Help frame has index panel.} \twocolitem{\windowstyle{wxHF\_SEARCH}}{Help frame has search panel.} +\twocolitem{\windowstyle{wxHF\_BOOKMARKS}}{Help frame has bookmarks controls.} +\twocolitem{\windowstyle{wxHF\_OPENFILES}}{Allow user to open arbitrary HTML document.} +\twocolitem{\windowstyle{wxHF\_PRINT}}{Toolbar contains "print" button.} \end{twocollist} \membersection{wxHtmlHelpFrame::CreateContents}\label{wxhtmlhelpframecreatecontents} diff --git a/docs/latex/wx/htmlcell.tex b/docs/latex/wx/htmlcell.tex index 731cb02a12..15a8508bcf 100644 --- a/docs/latex/wx/htmlcell.tex +++ b/docs/latex/wx/htmlcell.tex @@ -30,7 +30,7 @@ This image shows you cells and containers: \wxheading{Using Containers in Tag Handler} \helpref{wxHtmlWinParser}{wxhtmlwinparser} provides a user-friendly way -of managing containers. It's based on the idea of opening and closing containers. +of managing containers. It is based on the idea of opening and closing containers. Use \helpref{OpenContainer}{wxhtmlwinparseropencontainer} to open new a container {\it within an already opened container}. This new container is a @@ -47,7 +47,7 @@ See explanation: \helponly{\image{}{cont.bmp}} \end{comment} -It's clear there must be same number of calls to +It is clear there must be same number of calls to OpenContainer as to CloseContainer... \wxheading{Example} diff --git a/docs/latex/wx/htmlhand.tex b/docs/latex/wx/htmlhand.tex index 5017dd593e..26012444c9 100644 --- a/docs/latex/wx/htmlhand.tex +++ b/docs/latex/wx/htmlhand.tex @@ -54,7 +54,7 @@ the structure of macros. See macros reference: Starts handler definition. {\it name} is handler identifier (in fact part of class name), {\it tags} is string containing list of tags supported by this handler (in uppercase). This macro derives new class from -wxHtmlWinTagHandler and implements it's +wxHtmlWinTagHandler and implements it is \helpref{GetSupportedTags}{wxhtmltaghandlergetsupportedtags} method. Example: TAG\_HANDLER\_BEGIN(FONTS, "B,I,U,T") diff --git a/docs/latex/wx/htmlhlpf.tex b/docs/latex/wx/htmlhlpf.tex index efb11a99ec..dbc30ba75a 100644 --- a/docs/latex/wx/htmlhlpf.tex +++ b/docs/latex/wx/htmlhlpf.tex @@ -6,7 +6,7 @@ your tex2rtf.ini file. (See \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller} for help controller description.) -A {\bf book} consists of three files : header file, contents file and index file. +A {\bf book} consists of three files: header file, contents file and index file. You can make a regular zip archive of these files, plus the HTML and any image files, for wxHTML (or helpview) to read; and the .zip file can optionally be renamed to .htb. diff --git a/docs/latex/wx/htmlstrt.tex b/docs/latex/wx/htmlstrt.tex index a8405f36cf..726b3223de 100644 --- a/docs/latex/wx/htmlstrt.tex +++ b/docs/latex/wx/htmlstrt.tex @@ -15,7 +15,7 @@ passed {\bf string}. See the example: mywin -> LoadPage("test.htm"); mywin -> SetPage("<html><body>" "<h1>Error</h1>" - "Some error occured :-H)" + "Some error occurred :-H)" "</body></hmtl>"); \end{verbatim} @@ -43,7 +43,7 @@ See the example: html -> SetRelatedStatusBar(0); \end{verbatim} -The first command associates html object with it's parent frame +The first command associates html object with it is parent frame (this points to wxFrame object there) and sets format of title. Page title "Hello, world!" will be displayed as "HTML : Hello, world!" in this example. diff --git a/docs/latex/wx/htparser.tex b/docs/latex/wx/htparser.tex index 9398443390..b9d848e609 100644 --- a/docs/latex/wx/htparser.tex +++ b/docs/latex/wx/htparser.tex @@ -103,7 +103,7 @@ This must be called after DoParsing(). \constfunc{wxFileSystem*}{GetFS}{\void} Returns pointer to the file system. Because each tag handler has -reference to it's parent parser it can easily request the file by +reference to it is parent parser it can easily request the file by calling \begin{verbatim} @@ -131,7 +131,7 @@ Returns pointer to the source being parsed. \func{virtual void}{InitParser}{\param{const wxString\& }{source}} -Setups the parser for parsing the {\it source} string. (Should be overriden +Setups the parser for parsing the {\it source} string. (Should be overridden in derived class) \membersection{wxHtmlParser::Parse}\label{wxhtmlparserparse} @@ -188,7 +188,7 @@ It is obvious that you cannot use only one tag handler for <param> tag. Instead you must use context-sensitive handlers for <param> inside <myitems> and <param> inside <execute>. -This is the prefered solution: +This is the preferred solution: \begin{verbatim} TAG_HANDLER_BEGIN(MYITEM, "MYITEMS") diff --git a/docs/latex/wx/httag.tex b/docs/latex/wx/httag.tex index 17fea3117d..91a4713494 100644 --- a/docs/latex/wx/httag.tex +++ b/docs/latex/wx/httag.tex @@ -22,7 +22,7 @@ wxObject \func{}{wxHtmlTag}{\param{const wxString\& }{source}, \param{int }{pos}, \param{int }{end\_pos}, \param{wxHtmlTagsCache* }{cache}} -Constructor. You'll probably never have to construct a wxHtmlTag object +Constructor. You will probably never have to construct a wxHtmlTag object yourself. Feel free to ignore the constructor parameters. Have a look at lib/htmlparser.cpp if you're interested in creating it. diff --git a/docs/latex/wx/httagmod.tex b/docs/latex/wx/httagmod.tex index 4a2533be67..891fe52091 100644 --- a/docs/latex/wx/httagmod.tex +++ b/docs/latex/wx/httagmod.tex @@ -28,7 +28,7 @@ tag handlers. It is used almost exclusively together with set of \func{virtual void}{FillHandlersTable}{\param{wxHtmlWinParser }{*parser}} -You must override this method. In most common case it's body consists +You must override this method. In most common case it is body consists only of lines of following type: \begin{verbatim} diff --git a/docs/latex/wx/htwidget.tex b/docs/latex/wx/htwidget.tex index f9b765a6db..21f3ea8094 100644 --- a/docs/latex/wx/htwidget.tex +++ b/docs/latex/wx/htwidget.tex @@ -28,7 +28,7 @@ Constructor. \wxheading{Parameters} -\docparam{wnd}{Connected window. It's parent window {\bf must} be the wxHtmlWindow object within +\docparam{wnd}{Connected window. It is parent window {\bf must} be the wxHtmlWindow object within which it is displayed!} \docparam{w}{Floating width. If non-zero width of {\it wnd} window is adjusted so that it is diff --git a/docs/latex/wx/htwindow.tex b/docs/latex/wx/htwindow.tex index 2c5345ca6a..622efd4e73 100644 --- a/docs/latex/wx/htwindow.tex +++ b/docs/latex/wx/htwindow.tex @@ -127,7 +127,7 @@ htmlwin -> SetPage("help/myproject/index.htm"); \wxheading{Return value} -FALSE if an error occured, TRUE otherwise +FALSE if an error occurred, TRUE otherwise \membersection{wxHtmlWindow::OnLinkClicked}\label{wxhtmlwindowonlinkclicked} @@ -230,7 +230,7 @@ If you want to load a document from some location use \wxheading{Return value} -FALSE if an error occured, TRUE otherwise. +FALSE if an error occurred, TRUE otherwise. \membersection{wxHtmlWindow::SetRelatedFrame}\label{wxhtmlwindowsetrelatedframe} diff --git a/docs/latex/wx/htwinprs.tex b/docs/latex/wx/htwinprs.tex index feea123a7c..cfdb392f39 100644 --- a/docs/latex/wx/htwinprs.tex +++ b/docs/latex/wx/htwinprs.tex @@ -80,7 +80,7 @@ Returns default horizontal alignment. \constfunc{int}{GetCharHeight}{\void} -Returns (average) char height in standard font. It's used as DC-independent metrics. +Returns (average) char height in standard font. It is used as DC-independent metrics. {\bf Note:} This function doesn't return the {\it actual} height. If you want to know the height of the current font, call {\tt GetDC -> GetCharHeight()}. @@ -89,7 +89,7 @@ know the height of the current font, call {\tt GetDC -> GetCharHeight()}. \constfunc{int}{GetCharWidth}{\void} -Returns average char width in standard font. It's used as DC-independent metrics. +Returns average char width in standard font. It is used as DC-independent metrics. {\bf Note:} This function doesn't return the {\it actual} width. If you want to know the height of the current font, call {\tt GetDC -> GetCharWidth()} diff --git a/docs/latex/wx/hworld.tex b/docs/latex/wx/hworld.tex index 72116a4400..13ef9285db 100644 --- a/docs/latex/wx/hworld.tex +++ b/docs/latex/wx/hworld.tex @@ -1,11 +1,11 @@ \section{wxWindows "Hello World"}\label{helloworld} As many people have requested a mini-sample to be published here -so that some quick judgements concerning syntax +so that some quick judgments concerning syntax and basic principles can be made, you can now look at wxWindows' "Hello World": -You have to include wxWindows's header files, of course. This can +You have to include wxWindows' header files, of course. This can be done on a file by file basis (such as \#include "wx/window.h") or using one global include (\#include "wx/wx.h"). This is also useful on platforms which support precompiled headers such @@ -75,7 +75,7 @@ enum }; \end{verbatim} -We then procede to actually implement an event table in which the events +We then proceed to actually implement an event table in which the events are routed to their respective handler functions in the class MyFrame. There are predefined macros for routing all common events, ranging from the selection of a list box entry to a resize event when a user resizes @@ -101,11 +101,11 @@ using this macro, which creates an application instance and starts the program. IMPLEMENT_APP(MyApp) \end{verbatim} -As mentionend above, wxApp::OnInit() is called upon startup and should be +As mentioned above, wxApp::OnInit() is called upon startup and should be used to initialize the program, maybe showing a "splash screen" and creating the main window (or several). The frame should get a title bar text ("Hello World") and a position and start-up size. One frame can also be declared to be the -top window. Returning TRUE indicates a successful intialization. +top window. Returning TRUE indicates a successful initialization. \begin{verbatim} bool MyApp::OnInit() @@ -142,9 +142,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) \end{verbatim} Here are the actual event handlers. MyFrame::OnQuit() closes the main window -by calling Close(). The paramter TRUE indicates that other windows have no veto +by calling Close(). The parameter TRUE indicates that other windows have no veto power such as after asking "Do you really want to close?". If there is no other -main window left, the applicatin will quit. +main window left, the application will quit. \begin{verbatim} void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) @@ -159,7 +159,7 @@ case a typical "About" window with information about the program. \begin{verbatim} void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - wxMessageBox( "This is a wxWindows's Hello world sample", + wxMessageBox( "This is a wxWindows' Hello world sample", "About Hello World", wxOK | wxICON_INFORMATION ); } \end{verbatim} diff --git a/docs/latex/wx/image.tex b/docs/latex/wx/image.tex index 136d07a3d5..3b161649a9 100644 --- a/docs/latex/wx/image.tex +++ b/docs/latex/wx/image.tex @@ -29,7 +29,7 @@ handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or \twocolitem{{\bf \indexit{wxGIFHandler}}}{Only for loading, due to legal issues.} \twocolitem{{\bf \indexit{wxPCXHandler}}}{For loading and saving (see below).} \twocolitem{{\bf \indexit{wxPNMHandler}}}{For loading and saving (see below).} -\twocolitem{{\bf \indexit{wxTIFFHandler}}}{For loading and saving.} +\twocolitem{{\bf \indexit{wxTIFFHandler}}}{For loading.} \end{twocollist} When saving in PCX format, {\bf wxPCXHandler} will count the number of @@ -74,6 +74,13 @@ and forth without loss in that respect. Creates an image with the given width and height. +\func{}{wxImage}{\param{int}{ width}, \param{int}{ height}, \param{unsigned char*}{ data}, \param{bool}{ static_data=FALSE}} + +Creates an image from given data with the given width and height. If +{\it static_data} is TRUE, then wxImage will not delete the actual +image data in its destructor, otherwise it will free it by calling +{\it free()}. + \func{}{wxImage}{\param{const wxString\& }{name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}} \func{}{wxImage}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}} @@ -180,6 +187,12 @@ on program start-up to look up colors. This ensures a very fast conversion, but the image quality won't be perfect (and could be better for photo images using more sophisticated dithering algorithms). +\membersection{wxImage::Copy}\label{wximagecopy} + +\constfunc{wxImage}{Copy}{\void} + +Returns an identical copy of the image. + \membersection{wxImage::Create}\label{wximagecreate} \func{bool}{Create}{\param{int}{ width}, \param{int}{ height}} @@ -458,7 +471,6 @@ Saves a image in the given stream. \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Save a PNG image file.} \twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Save a PCX image file (tries to save as 8-bit if possible, falls back to 24-bit otherwise).} \twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Save a PNM image file (as raw RGB always).} -\twocolitem{{\bf wxBITMAP\_TYPE\_TIF}}{Save a TIFF image file.} \end{twocollist}} \docparam{mimetype}{MIME type.} @@ -485,6 +497,13 @@ mimetype to the named file} \end{twocollist}} } +\membersection{wxImage::Mirror}\label{wximagemirror} + +\constfunc{wxImage}{Mirror}{\param{bool}{ horizontally = TRUE}} + +Returns a mirrored copy of the image. The parameter {\it horizontally} +indicates the orientation. + \membersection{wxImage::Replace}\label{wximagereplace} \func{void}{Replace}{\param{unsigned char}{ r1}, \param{unsigned char}{ g1}, \param{unsigned char}{ b1}, @@ -517,6 +536,13 @@ rotated image background. Else, black (rgb 0, 0, 0) will be used. Returns the rotated image, leaving this image intact. +\membersection{wxImage::Rotate90}\label{wximagerotate90} + +\constfunc{wxImage}{Rotate90}{\param{bool}{ clockwise = TRUE}} + +Returns a copy of the image rotated 90 degrees in the direction +indicated by {\it clockwise}. + \membersection{wxImage::Scale}\label{wximagescale} \constfunc{wxImage}{Scale}{\param{int}{ width}, \param{int}{ height}} @@ -526,7 +552,7 @@ scaling bitmaps in general as the only other way to scale bitmaps is to blit a wxMemoryDC into another wxMemoryDC. It may be mentioned that the GTK port uses this function internally -to scale bitmaps when using mapping mode in wxDC. +to scale bitmaps when using mapping modes in wxDC. Example: @@ -573,7 +599,7 @@ Sets the mask colour for this image (and tells the image to use the mask). \membersection{wxImage::SetRGB}\label{wximagesetrgb} -\func{void}{SetRGB}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{red}, \param{unsigned char }{blue}, \param{unsigned char }{green}} +\func{void}{SetRGB}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}} Sets the pixel at the given coordinate. This routine performs bounds-checks for the coordinate so it can be considered a safe way to manipulate the @@ -779,24 +805,23 @@ Sets the handler extension. \docparam{extension}{Handler extension.} -\membersection{wxImageHandler::SetType} +\membersection{wxImageHandler::SetMimeType}\label{wximagehandlersetmimetype} -\func{void}{SetType}{\param{long }{type}} +\func{void}{SetMimeType}{\param{const wxString\& }{mimetype}} -Sets the handler type. +Sets the handler MIME type. \wxheading{Parameters} -\docparam{name}{Handler type.} - +\docparam{mimename}{Handler MIME type.} -\membersection{wxImageHandler::SetMimeType} +\membersection{wxImageHandler::SetType} -\func{void}{SetMimeType}{\param{const wxString\& }{mimetype}} +\func{void}{SetType}{\param{long }{type}} -Sets the handler MIME type. +Sets the handler type. \wxheading{Parameters} -\docparam{mimename}{Handler MIME type.} +\docparam{name}{Handler type.} diff --git a/docs/latex/wx/imaglist.tex b/docs/latex/wx/imaglist.tex index 149b343724..548b3dae78 100644 --- a/docs/latex/wx/imaglist.tex +++ b/docs/latex/wx/imaglist.tex @@ -131,6 +131,26 @@ that the background is solid.} Returns the number of images in the list. +\membersection{wxImageList::GetSize}\label{wximagelistgetsize} + +\constfunc{bool}{GetSize}{\param{int }{index}, \param{int\& }{width}, \param{int \&}{height}} + +Retrieves the size of the images in the list. Currently, the {\it index} +parameter is ignored as all images in the list have the same size. + +\wxheading{Parameters} + +\docparam{index}{currently unused, should be 0} + +\docparam{width}{receives the width of the images in the list} + +\docparam{height}{receives the height of the images in the list} + +\wxheading{Return value} + +TRUE if the function succeeded, FALSE if it failed (for example, if the image +list was not yet initialized). + \membersection{wxImageList::Remove}\label{wximagelistremove} \func{bool}{Remove}{\param{int}{ index}} diff --git a/docs/latex/wx/keyevent.tex b/docs/latex/wx/keyevent.tex index 95552f4206..34dfc6afd3 100644 --- a/docs/latex/wx/keyevent.tex +++ b/docs/latex/wx/keyevent.tex @@ -93,6 +93,14 @@ Returns TRUE if the Alt key was down at the time of the key event. Returns TRUE if the control key was down at the time of the key event. +\membersection{wxKeyEvent::GetKeyCode} + +\constfunc{int}{GetKeyCode}{\void} + +Returns the virtual key code. ASCII events return normal ASCII values, +while non-ASCII events return values such as {\bf WXK\_LEFT} for the +left cursor key. See \helpref{Keycodes}{keycodes} for a full list of the virtual key codes. + \membersection{wxKeyEvent::GetX} \constfunc{long}{GetX}{\void} @@ -105,14 +113,6 @@ Returns the X position of the event. Returns the Y position of the event. -\membersection{wxKeyEvent::KeyCode} - -\constfunc{long}{KeyCode}{\void} - -Returns the virtual key code. ASCII events return normal ASCII values, -while non-ASCII events return values such as {\bf WXK\_LEFT} for the -left cursor key. See \helpref{Keycodes}{keycodes} for a full list of the virtual key codes. - \membersection{wxKeyEvent::MetaDown} \constfunc{bool}{MetaDown}{\void} @@ -127,6 +127,14 @@ Returns TRUE if the Meta key was down at the time of the key event. Obtains the position at which the key was pressed. +\membersection{wxKeyEvent::HasModifiers} + +\constfunc{bool}{HasModifiers}{\void} + +Returns TRUE if either of {\sc Ctrl}, {\sc Alt} or {\sc Meta} keys was down +at the time of the key event. Note that this function does not take into +account the {\sc Shift} key state. + \membersection{wxKeyEvent::ShiftDown} \constfunc{bool}{ShiftDown}{\void} diff --git a/docs/latex/wx/listctrl.tex b/docs/latex/wx/listctrl.tex index d6faae4522..02eaefa92b 100644 --- a/docs/latex/wx/listctrl.tex +++ b/docs/latex/wx/listctrl.tex @@ -261,8 +261,8 @@ You must call {\it info.SetId()} to se ID of item you're interested in before calling this method. \pythonnote{The wxPython version of this method takes an integer parameter -for the item ID, and returns the wxListItem object. -} +for the item ID, an optional integer for the column number, and +returns the wxListItem object. } \membersection{wxListCtrl::GetItemData}\label{wxlistctrlgetitemdata} diff --git a/docs/latex/wx/listevt.tex b/docs/latex/wx/listevt.tex index 1723a34d79..2358a8fab5 100644 --- a/docs/latex/wx/listevt.tex +++ b/docs/latex/wx/listevt.tex @@ -48,45 +48,76 @@ functions that take a wxListEvent argument. Constructor. -\membersection{wxListEvent::m\_code} +\membersection{wxListEvent::GetCode}\label{wxlisteventgetcode} -\member{int}{m\_code} +\constfunc{int}{GetCode}{\void} Key code if the event is a keypress event. -\membersection{wxListEvent::m\_itemIndex} +\membersection{wxListEvent::GetIndex}\label{wxlisteventgetindex} -\member{long}{m\_itemIndex} +\constfunc{long}{GetIndex}{\void} The item index. -\membersection{wxListEvent::m\_oldItemIndex} +\membersection{wxListEvent::GetOldIndex}\label{wxlisteventgetoldindex} -\member{long}{m\_oldItemIndex} +\constfunc{long}{GetOldIndex}{\void} The old item index. -\membersection{wxListEvent::m\_col} +\membersection{wxListEvent::GetColumn}\label{wxlisteventgetcolumn} -\member{int}{m\_col} +\constfunc{int}{GetColumn}{\void} The column position. -\membersection{wxListEvent::m\_cancelled} +\membersection{wxListEvent::Cancelled}\label{wxlisteventcancelled} -\member{bool}{m\_cancelled} +\constfunc{bool}{Cancelled}{\void} TRUE if this event is an end edit event and the user cancelled the edit. -\membersection{wxListEvent::m\_pointDrag} +\membersection{wxListEvent::GetPoint}\label{wxlisteventgetpoint} -\member{wxPoint}{m\_pointDrag} +\constfunc{wxPoint}{GetPoint}{\void} The position of the mouse pointer if the event is a drag event. -\membersection{wxListEvent::m\_item} -\member{wxListItem}{m\_item} +\membersection{wxListEvent::GetLabel}\label{wxlisteventgetlabel} + +\constfunc{const wxString\&}{GetLabel}{\void} + +The label. + +\membersection{wxListEvent::GetText}\label{wxlisteventgettext} + +\constfunc{const wxString\&}{GetText}{\void} + +The text. + +\membersection{wxListEvent::GetImage}\label{wxlisteventgetimage} + +\constfunc{int}{GetImage}{\void} + +The image. + +\membersection{wxListEvent::GetData}\label{wxlisteventgetdata} + +\constfunc{long}{GetData}{\void} + +The data. + +\membersection{wxListEvent::GetMask}\label{wxlisteventgetmask} + +\constfunc{long}{GetMask}{\void} + +The mask. + +\membersection{wxListEvent::GetItem}\label{wxlisteventgetitem} + +\constfunc{const wxListItem\&}{GetItem}{\void} An item object, used by some events. See also \helpref{wxListCtrl::SetItem}{wxlistctrlsetitem}. diff --git a/docs/latex/wx/locale.tex b/docs/latex/wx/locale.tex index f098360397..a5f1915c97 100644 --- a/docs/latex/wx/locale.tex +++ b/docs/latex/wx/locale.tex @@ -72,7 +72,7 @@ Returns the locale name as passed to the constructor or \func{bool}{AddCatalog}{\param{const char }{*szDomain}} -Add a catalog for use with the current locale: it's searched for in standard +Add a catalog for use with the current locale: it is searched for in standard places (current directory first, then the system one), but you may also prepend additional directories to the search path with \helpref{AddCatalogLookupPathPrefix()}{wxlocaleaddcataloglookuppathprefix}. diff --git a/docs/latex/wx/longlong.tex b/docs/latex/wx/longlong.tex index a37cff3edd..f2d56c1191 100644 --- a/docs/latex/wx/longlong.tex +++ b/docs/latex/wx/longlong.tex @@ -6,7 +6,7 @@ %% Created: 07.03.00 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxLongLong}}\label{wxlonglong} diff --git a/docs/latex/wx/manual.tex b/docs/latex/wx/manual.tex index d0061f3d62..18099a48a4 100644 --- a/docs/latex/wx/manual.tex +++ b/docs/latex/wx/manual.tex @@ -1,5 +1,5 @@ \documentstyle[a4,11pt,makeidx,verbatim,texhelp,fancyheadings,palatino]{report} -% JACS: doesn't make it through Tex2RTF, sorry. I'll put it into texhelp.sty +% JACS: doesn't make it through Tex2RTF, sorry. I will put it into texhelp.sty % since Tex2RTF doesn't parse it. % BTW, style MUST be report for it to work for Tex2RTF. %KB: @@ -25,13 +25,13 @@ %\special{!/@scaleunit 1 def} \parskip=10pt \parindent=0pt -\title{wxWindows 2.1.14: A portable C++ and Python GUI toolkit} +\title{wxWindows 2.2: A portable C++ and Python GUI toolkit} \winhelponly{\author{by Julian Smart et al %\winhelponly{\\$$\image{1cm;0cm}{wxwin.wmf}$$} }} \winhelpignore{\author{Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al} -\date{March 19th 2000} +\date{July 9th 2000} } \makeindex \begin{document} @@ -91,7 +91,7 @@ members of the wxWindows team\\ Portions (c) 1996 Artificial Intelligence Applications Institute\\ \end{center} -Please also see the wxWindows licence files (preamble.txt, lgpl.txt, gpl.txt, licence.txt, +Please also see the wxWindows license files (preamble.txt, lgpl.txt, gpl.txt, license.txt, licendoc.txt) for conditions of software and documentation use. \section*{wxWindows Library License, Version 3} diff --git a/docs/latex/wx/mbcnvfil.tex b/docs/latex/wx/mbcnvfil.tex new file mode 100644 index 0000000000..c7f99ad62e --- /dev/null +++ b/docs/latex/wx/mbcnvfil.tex @@ -0,0 +1,49 @@ +% +% automatically generated by HelpGen from +% ../include/wx/strconv.h at 25/Mar/00 10:20:56 +% + +\section{\class{wxMBConvFile}}\label{wxmbconvfile} + +This class converts file names between filesystem multibyte encoding and +Unicode. It has one predefined instance, {\bf wxConvFile}. +Since some platforms (e.g. Win32) use Unicode in the filenames, +and others (e.g. Unix) use multibyte encodings, this class should only +be used directly if wxMBFILES is defined to 1. A convenience macro, +wxFNCONV, is defined to wxConvFile.cWX2MB in this case. You could use it +like this: + +\begin{verbatim} +wxChar *name = wxT("rawfile.doc"); +FILE *fil = fopen(wxFNCONV(name), "r"); +\end{verbatim} + +(although it would be better to use wxFopen(name, wxT("r")) in this case.) + +\wxheading{Derived from} + +\helpref{wxMBConv}{wxmbconv} + +\wxheading{Include files} + +<wx/strconv.h> + +\wxheading{See also} + +\helpref{wxMBConv classes overview}{mbconvclasses} + +\latexignore{\rtfignore{\wxheading{Members}}} + + +\membersection{wxMBConvFile::MB2WC}\label{wxmbconvfilemb2wc} + +\constfunc{size\_t}{MB2WC}{\param{wchar\_t* }{buf}, \param{const char* }{psz}, \param{size\_t }{n}} + +Converts from multibyte filename encoding to Unicode. Returns the size of the destination buffer. + +\membersection{wxMBConvFile::WC2MB}\label{wxmbconvfilewc2mb} + +\constfunc{size\_t}{WC2MB}{\param{char* }{buf}, \param{const wchar\_t* }{psz}, \param{size\_t }{n}} + +Converts from Unicode to multibyte filename encoding. Returns the size of the destination buffer. + diff --git a/docs/latex/wx/mbcnvut7.tex b/docs/latex/wx/mbcnvut7.tex new file mode 100644 index 0000000000..05185f17a9 --- /dev/null +++ b/docs/latex/wx/mbcnvut7.tex @@ -0,0 +1,38 @@ +% +% automatically generated by HelpGen from +% ../include/wx/strconv.h at 25/Mar/00 10:20:56 +% + +\section{\class{wxMBConvUTF7}}\label{wxmbconvutf7} + +This class converts between the UTF-7 encoding and Unicode. +It has one predefined instance, {\bf wxConvUTF7}. +Unfortunately, this class is not quite implemented yet. + +\wxheading{Derived from} + +\helpref{wxMBConv}{wxmbconv} + +\wxheading{Include files} + +<wx/strconv.h> + +\wxheading{See also} + +\helpref{wxMBConvUTF8}{wxmbconvutf8}, +\helpref{wxMBConv classes overview}{mbconvclasses} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxMBConvUTF7::MB2WC}\label{wxmbconvutf7mb2wc} + +\constfunc{size\_t}{MB2WC}{\param{wchar\_t* }{buf}, \param{const char* }{psz}, \param{size\_t }{n}} + +Converts from UTF-7 encoding to Unicode. Returns the size of the destination buffer. + +\membersection{wxMBConvUTF7::WC2MB}\label{wxmbconvutf7wc2mb} + +\constfunc{size\_t}{WC2MB}{\param{char* }{buf}, \param{const wchar\_t* }{psz}, \param{size\_t }{n}} + +Converts from Unicode to UTF-7 encoding. Returns the size of the destination buffer. + diff --git a/docs/latex/wx/mbcnvut8.tex b/docs/latex/wx/mbcnvut8.tex new file mode 100644 index 0000000000..19801f9571 --- /dev/null +++ b/docs/latex/wx/mbcnvut8.tex @@ -0,0 +1,59 @@ +% +% automatically generated by HelpGen from +% ../include/wx/strconv.h at 25/Mar/00 10:20:56 +% + +\section{\class{wxMBConvUTF8}}\label{wxmbconvutf8} + +This class converts between the UTF-8 encoding and Unicode. +It has one predefined instance, {\bf wxConvUTF8}. + +\wxheading{Derived from} + +\helpref{wxMBConv}{wxmbconv} + +\wxheading{Include files} + +<wx/strconv.h> + +\wxheading{See also} + +\helpref{wxMBConvUTF7}{wxmbconvutf7}, +\helpref{wxMBConv classes overview}{mbconvclasses} + +\wxheading{Remarks} + +UTF-8 is a compatibility encoding used to encode Unicode text into anything that was +originally written for 8-bit strings, including (but not limited to) filenames, transfer +protocols, and database fields. Notable properties include: + +\begin{itemize} +\item Variable-length encoding able to encode up to 31 bits per character +\item ASCII characters (character values under 128) are encoded as plain ASCII +(1 byte per character) +\item Null bytes do not occur in the encoding, except when there's an actual Unicode +null character +\item Preserves sort ordering for plain 8-bit comparison routines like strcmp() +\item High bit patterns unambiguates character boundaries, and makes it easy to +detect whether a string is encoded with UTF-8 or not +\end{itemize} + +All of these properties make UTF-8 a very favorable solution in any situation +where full Unicode character support is desired while remaining compatible with +code written with only 8-bit extended-ASCII characters in mind. + +\latexignore{\rtfignore{\wxheading{Members}}} + + +\membersection{wxMBConvUTF8::MB2WC}\label{wxmbconvutf8mb2wc} + +\constfunc{size\_t}{MB2WC}{\param{wchar\_t* }{buf}, \param{const char* }{psz}, \param{size\_t }{n}} + +Converts from UTF-8 encoding to Unicode. Returns the size of the destination buffer. + +\membersection{wxMBConvUTF8::WC2MB}\label{wxmbconvutf8wc2mb} + +\constfunc{size\_t}{WC2MB}{\param{char* }{buf}, \param{const wchar\_t* }{psz}, \param{size\_t }{n}} + +Converts from Unicode to UTF-8 encoding. Returns the size of the destination buffer. + diff --git a/docs/latex/wx/mbconv.tex b/docs/latex/wx/mbconv.tex new file mode 100644 index 0000000000..5aaf60b65c --- /dev/null +++ b/docs/latex/wx/mbconv.tex @@ -0,0 +1,108 @@ +% +% automatically generated by HelpGen from +% ../include/wx/strconv.h at 25/Mar/00 10:20:56 +% + +\section{\class{wxMBConv}}\label{wxmbconv} + +This class is the base class of a hierarchy of classes capable of converting +text strings between multibyte (SBCS or DBCS) encodings and Unicode. It is itself +a wrapper around the standard libc mbstowcs() and wcstombs() routines, and has +one predefined instance, {\bf wxConvLibc}. + +\wxheading{Derived from} + +No base class + +\wxheading{Include files} + +<wx/strconv.h> + +\wxheading{See also} + +\helpref{wxCSConv}{wxcsconv}, +\helpref{wxEncodingConverter}{wxencodingconverter}, +\helpref{wxMBConv classes overview}{mbconvclasses} + +\latexignore{\rtfignore{\wxheading{Members}}} + + +\membersection{wxMBConv::wxMBConv}\label{wxmbconvwxmbconv} + +\func{}{wxMBConv}{\void} + +Constructor. + +\membersection{wxMBConv::MB2WC}\label{wxmbconvmb2wc} + +\constfunc{virtual size\_t}{MB2WC}{\param{wchar\_t* }{buf}, \param{const char* }{psz}, \param{size\_t }{n}} + +Converts from multibyte encoding to Unicode, using the libc routine mbstowcs() +(this is overridden by derived classes). Returns the size of the destination buffer. + +\membersection{wxMBConv::WC2MB}\label{wxmbconvwc2mb} + +\constfunc{virtual size\_t}{WC2MB}{\param{char* }{buf}, \param{const wchar\_t* }{psz}, \param{size\_t }{n}} + +Converts from Unicode to multibyte encoding, using the libc routine wcstombs() +(this is overridden by derived classes). Returns the size of the destination buffer. + +\membersection{wxMBConv::cMB2WC}\label{wxmbconvcmb2wc} + +\constfunc{const wxWCharBuffer}{cMB2WC}{\param{const char* }{psz}} + +Converts from multibyte encoding to Unicode by calling MB2WC, +allocating a temporary wxWCharBuffer to hold the result. + +\membersection{wxMBConv::cWC2MB}\label{wxmbconvcwc2mb} + +\constfunc{const wxCharBuffer}{cWC2MB}{\param{const wchar\_t* }{psz}} + +Converts from Unicode to multibyte encoding by calling WC2MB, +allocating a temporary wxCharBuffer to hold the result. + +\membersection{wxMBConv::cMB2WX}\label{wxmbconvcmb2wx} + +\constfunc{const char*}{cMB2WX}{\param{const char* }{psz}} + +\constfunc{const wxWCharBuffer}{cMB2WX}{\param{const char* }{psz}} + +Converts from multibyte encoding to the current wxChar type +(which depends on whether wxUSE\_UNICODE is set to 1). If wxChar is char, +it returns the parameter unaltered. If wxChar is wchar\_t, it returns the +result in a wxWCharBuffer. The macro wxMB2WXbuf is defined as the correct +return type (without const). + +\membersection{wxMBConv::cWX2MB}\label{wxmbconvcwx2mb} + +\constfunc{const char*}{cWX2MB}{\param{const wxChar* }{psz}} + +\constfunc{const wxCharBuffer}{cWX2MB}{\param{const wxChar* }{psz}} + +Converts from the current wxChar type to multibyte encoding. If wxChar is char, +it returns the parameter unaltered. If wxChar is wchar\_t, it returns the +result in a wxCharBuffer. The macro wxWX2MBbuf is defined as the correct +return type (without const). + +\membersection{wxMBConv::cWC2WX}\label{wxmbconvcwc2wx} + +\constfunc{const wchar\_t*}{cWC2WX}{\param{const wchar\_t* }{psz}} + +\constfunc{const wxCharBuffer}{cWC2WX}{\param{const wchar\_t* }{psz}} + +Converts from Unicode to the current wxChar type. If wxChar is wchar\_t, +it returns the parameter unaltered. If wxChar is char, it returns the +result in a wxCharBuffer. The macro wxWC2WXbuf is defined as the correct +return type (without const). + +\membersection{wxMBConv::cWX2WC}\label{wxmbconvcwx2wc} + +\constfunc{const wchar\_t*}{cWX2WC}{\param{const wxChar* }{psz}} + +\constfunc{const wxWCharBuffer}{cWX2WC}{\param{const wxChar* }{psz}} + +Converts from the current wxChar type to Unicode. If wxChar is wchar\_t, +it returns the parameter unaltered. If wxChar is char, it returns the +result in a wxWCharBuffer. The macro wxWX2WCbuf is defined as the correct +return type (without const). + diff --git a/docs/latex/wx/mdi.tex b/docs/latex/wx/mdi.tex index 38f456036c..1e59dcaf45 100644 --- a/docs/latex/wx/mdi.tex +++ b/docs/latex/wx/mdi.tex @@ -245,7 +245,7 @@ Child frames may be either \helpref{wxMDIChildFrame}{wxmdichildframe}, or \helpr An MDI parent frame always has a \helpref{wxMDIClientWindow}{wxmdiclientwindow} associated with it, which is the parent for MDI client frames. -This client window may be resized to accomodate non-MDI windows, as seen in Microsoft Visual C++ (TM) and +This client window may be resized to accommodate non-MDI windows, as seen in Microsoft Visual C++ (TM) and Microsoft Publisher (TM), where a documentation window is placed to one side of the workspace. MDI remains popular despite dire warnings from Microsoft itself that MDI is an obsolete @@ -476,7 +476,14 @@ is available under Windows only. \func{virtual wxMDIClientWindow*}{OnCreateClient}{\void} -Override this to return a different kind of client window. +Override this to return a different kind of client window. If you override this function, +you must create your parent frame in two stages, or your function will never be called, +due to the way C++ treats virtual functions called from constructors. For example: + +\begin{verbatim} + frame = new MyParentFrame; + frame->Create(parent, myParentFrameId, wxT("My Parent Frame")); +\end{verbatim} \wxheading{Remarks} diff --git a/docs/latex/wx/menu.tex b/docs/latex/wx/menu.tex index 4d9face292..027c789d8f 100644 --- a/docs/latex/wx/menu.tex +++ b/docs/latex/wx/menu.tex @@ -527,7 +527,7 @@ Adds the item to the end of the menu bar. \wxheading{Return value} -TRUE on success, FALSE if an error occured. +TRUE on success, FALSE if an error occurred. \wxheading{See also} @@ -720,7 +720,7 @@ position $0$ will insert it in the very beginning of it, inserting at position \wxheading{Return value} -TRUE on success, FALSE if an error occured. +TRUE on success, FALSE if an error occurred. \wxheading{See also} diff --git a/docs/latex/wx/mouseevt.tex b/docs/latex/wx/mouseevt.tex index 00967cad97..423811a297 100644 --- a/docs/latex/wx/mouseevt.tex +++ b/docs/latex/wx/mouseevt.tex @@ -9,6 +9,20 @@ drawbacks: the LEAVE\_WINDOW event might be received some time after the mouse left the window and the state variables for it may have changed during this time. +{\bf NB: } Note the difference between methods like +\helpref{LeftDown}{wxmouseeventleftdown} and +\helpref{LeftIsDown}{wxmouseeventleftisdown}: the formet returns {\tt TRUE} +when the event corresponds to the left mouse button click while the latter +returns {\tt TRUE} if the left mouse button is currently being pressed. For +example, when the user is dragging the mouse you can use +\helpref{LeftIsDown}{wxmouseeventleftisdown} to test +whether the left mouse button is (still) depressed. Also, by convention, if +\helpref{LeftDown}{wxmouseeventleftdown} returns {\tt TRUE}, +\helpref{LeftIsDown}{wxmouseeventleftisdown} will also return {\tt TRUE} in +wxWindows whatever the underlying GUI behaviour is (which is +platform-dependent). The same applies, of course, to other mouse buttons as +well. + \wxheading{Derived from} \helpref{wxEvent}{wxevent} @@ -242,7 +256,7 @@ Returns TRUE if the event was a left double click. Returns TRUE if the left mouse button changed to down. -\membersection{wxMouseEvent::LeftIsDown} +\membersection{wxMouseEvent::LeftIsDown}\label{wxmouseeventleftisdown} \constfunc{bool}{LeftIsDown}{\void} @@ -281,7 +295,7 @@ Returns TRUE if the event was a middle double click. Returns TRUE if the middle mouse button changed to down. -\membersection{wxMouseEvent::MiddleIsDown} +\membersection{wxMouseEvent::MiddleIsDown}\label{wxmouseeventmiddleisdown} \constfunc{bool}{MiddleIsDown}{\void} @@ -312,7 +326,7 @@ Returns TRUE if the event was a right double click. Returns TRUE if the right mouse button changed to down. -\membersection{wxMouseEvent::RightIsDown} +\membersection{wxMouseEvent::RightIsDown}\label{wxmouseeventrightisdown} \constfunc{bool}{RightIsDown}{\void} diff --git a/docs/latex/wx/msgdlg.tex b/docs/latex/wx/msgdlg.tex index b2e865e901..ec0b16e61e 100644 --- a/docs/latex/wx/msgdlg.tex +++ b/docs/latex/wx/msgdlg.tex @@ -43,7 +43,8 @@ Constructor. Use \helpref{wxMessageDialog::ShowModal}{wxmessagedialogshowmodal} \twocolitem{{\bf wxOK}}{Show an OK button.} \twocolitem{{\bf wxCANCEL}}{Show a Cancel button.} \twocolitem{{\bf wxYES\_NO}}{Show Yes and No buttons.} -\twocolitem{{\bf wx\_NO\_DEFAULT}}{Used with {\bf wxYES\_NO}, makes {\bf No} button the default.} +\twocolitem{{\bf wxYES\_DEFAULT}}{Used with {\bf wxYES\_NO}, makes {\bf Yes} button the default - which is the default behaviour.} +\twocolitem{{\bf wxNO\_DEFAULT}}{Used with {\bf wxYES\_NO}, makes {\bf No} button the default.} \twocolitem{{\bf wxCENTRE}}{Centre the message. Not Windows.} \twocolitem{{\bf wxICON\_EXCLAMATION}}{Shows an exclamation mark icon.} \twocolitem{{\bf wxICON\_HAND}}{Shows a hand icon.} diff --git a/docs/latex/wx/mutexlck.tex b/docs/latex/wx/mutexlck.tex index b0be0556c1..881105e11e 100644 --- a/docs/latex/wx/mutexlck.tex +++ b/docs/latex/wx/mutexlck.tex @@ -25,7 +25,7 @@ None. \func{}{wxMutexLocker}{\param{wxMutex *}{mutex}} -Constructs a wxMutexLocker object associated with mutex which must be non NULL +Constructs a wxMutexLocker object associated with mutex which must be non-NULL and locks it. Call \helpref{IsLocked}{wxmutexlockerisok} to check if the mutex was successfully locked. diff --git a/docs/latex/wx/nbsizer.tex b/docs/latex/wx/nbsizer.tex index b4be9489ab..9a9f915704 100644 --- a/docs/latex/wx/nbsizer.tex +++ b/docs/latex/wx/nbsizer.tex @@ -11,7 +11,7 @@ In order to query the size of notebook page, this page needs to have its own sizer, otherwise the wxNotebookSizer will ignore it. Notebook pages get there sizer by assiging one to them using \helpref{wxWindow::SetSizer}{wxwindowsetsizer} and setting the auto-layout option to TRUE using -\helpref{wxWindow::SetAutolayout}{wxwindowsetautoLayout}. Here is one +\helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout}. Here is one example showing how to add a notebook page that the notebook sizer is aware of: diff --git a/docs/latex/wx/node.tex b/docs/latex/wx/node.tex index c718a7220e..c2b6600772 100644 --- a/docs/latex/wx/node.tex +++ b/docs/latex/wx/node.tex @@ -3,7 +3,7 @@ A node structure used in linked lists (see \helpref{wxList}{wxlist}) and derived classes. You should never use wxNodeBase class directly because it works with untyped (void *) data and this is unsafe. Use wxNode-derived classes -which are defined by WX\_DECLARE\_LIST and WX\_DEFIBE\_LIST macros instead as +which are defined by WX\_DECLARE\_LIST and WX\_DEFINE\_LIST macros instead as described in \helpref{wxList}{wxlist} documentation (see example there). wxNode is defined for compatibility as wxNodeBase containing "wxObject *" pointer, but usage of this class is deprecated. diff --git a/docs/latex/wx/notebook.tex b/docs/latex/wx/notebook.tex index f97a2e9725..2ec54d1b11 100644 --- a/docs/latex/wx/notebook.tex +++ b/docs/latex/wx/notebook.tex @@ -23,12 +23,17 @@ managed by wxNotebook. \twocolwidtha{5cm} \begin{twocollist}\itemsep=0pt -\twocolitem{\windowstyle{wxNB\_FIXEDWIDTH}}{Make all tabs of equal width} -\twocolitem{\windowstyle{wxNB\_LEFT}}{Put the tabs on the left side of the notebook} -\twocolitem{\windowstyle{wxNB\_RIGHT}}{Put the tabs on the right side of the notebook} -\twocolitem{\windowstyle{wxNB\_BOTTOM}}{Put the tabs on the bottom of the notebook} + +\twocolitem{\windowstyle{wxNB\_FIXEDWIDTH}}{(Windows only)All tabs will have same width.} +\twocolitem{\windowstyle{wxNB\_LEFT}}{Place tabs on the left side.} +\twocolitem{\windowstyle{wxNB\_RIGHT}}{Place tabs on the right side.} +\twocolitem{\windowstyle{wxNB\_BOTTOM}}{Place tabs under instead of above the notebook pages.} + \end{twocollist} +See also \helpref{window styles overview}{windowstyles}. + + \wxheading{Event handling} To process input from a notebook control, use the following event handler macros to direct input to member @@ -71,10 +76,7 @@ Note that sometimes you can reduce flicker by passing the wxCLIP\_CHILDREN windo \docparam{size}{The window size.} -\docparam{style}{The window style. Its value is a bit list of zero or more of {\bf wxTC\_MULTILINE}, - {\bf wxTC\_RIGHTJUSTIFY}, {\bf wxTC\_FIXEDWIDTH} and {\bf wxTC\_OWNERDRAW} - possibly combined with one of {\bf wxNB\_LEFT}, {\bf wxNB\_RIGHT} or - {\bf wxNB\_BOTTOM}.} +\docparam{style}{The window style. See \helpref{wxNotebook}{wxnotebook}.} \docparam{name}{The name of the control (used only under Motif).} @@ -165,13 +167,13 @@ Returns the number of pages in the notebook control. \membersection{wxNotebook::GetPageImage}\label{wxnotebookgetpageimage} -\constfunc{int}{GetPageImage}{\void} +\constfunc{int}{GetPageImage}{\param{int }{nPage}} Returns the image index for the given page. \membersection{wxNotebook::GetPageText}\label{wxnotebookgetpagetext} -\constfunc{wxString}{GetPageText}{\void} +\constfunc{wxString}{GetPageText}{\param{int }{nPage}} Returns the string for the given page. diff --git a/docs/latex/wx/porting.tex b/docs/latex/wx/porting.tex index 306260b397..ca99053109 100644 --- a/docs/latex/wx/porting.tex +++ b/docs/latex/wx/porting.tex @@ -18,7 +18,7 @@ and will be supported by the user community for some time. And when you have changed to 2.0, we hope that you will appreciate the benefits in terms of greater flexibility, better user interface aesthetics, improved C++ conformance, improved compilation speed, and many other enhancements. The revised architecture -of 2.0 will ensure that wxWindows can continue to evolve for the forseeable +of 2.0 will ensure that wxWindows can continue to evolve for the foreseeable future. {\it Please note that this document is a work in progress.} @@ -75,7 +75,7 @@ be no conversion problems later on. font sizes (for example, a 12-point font will appear bigger than before). Write your application to be flexible where fonts are concerned. Don't rely on fonts being similarly-sized across platforms, as they were (by chance) between -Windows and X under wxWindows 1.66. Yes, this is not easy... but I think it's better to conform to the +Windows and X under wxWindows 1.66. Yes, this is not easy... but I think it is better to conform to the standards of each platform, and currently the size difference makes it difficult to conform to Windows UI standards. You may eventually wish to build in a global 'fudge-factor' to compensate for size differences. The old font sizing will still be available via wx\_setup.h, so do not panic... @@ -147,7 +147,7 @@ See \helpref{Device contexts and painting}{portingdc}. These objects - instances of classes such as wxPen, wxBrush, wxBitmap (but not wxColour) - are now implemented with reference-counting. This makes assignment a very cheap operation, and also means that management of the resource is largely automatic. You now pass {\it references} to -objects to functions such as wxDC::SetPen, not pointers, so you will need to derefence your pointers. +objects to functions such as wxDC::SetPen, not pointers, so you will need to dereference your pointers. The device context does not store a copy of the pen itself, but takes a copy of it (via reference counting), and the object's data gets freed up when the reference count goes to zero. The application does not have to worry so much about @@ -260,7 +260,7 @@ and simply assign the result to a wxString object. For example, replace this: {\small\begin{verbatim} char* s = wxFunctionThatReturnsString(); - s = copystring(s); // Take a copy in case it's temporary + s = copystring(s); // Take a copy in case it is temporary .... // Do something with it delete[] s; \end{verbatim} @@ -362,7 +362,7 @@ Add an OnCloseWindow event handler using an EVT\_CLOSE event table entry. For de about window destruction, see the Windows Deletion Overview in the manual. This is a subtle topic so please read it very carefully. Basically, OnCloseWindow is now responsible for destroying a window with Destroy(), but the default implementation (for example for wxDialog) may not -destroy the window, so to be sure, always provide this event handler so it's obvious what's going on. +destroy the window, so to be sure, always provide this event handler so it is obvious what's going on. \subsection{OnEvent} diff --git a/docs/latex/wx/print.tex b/docs/latex/wx/print.tex index 38016dcd28..0bdf7b6d16 100644 --- a/docs/latex/wx/print.tex +++ b/docs/latex/wx/print.tex @@ -598,6 +598,26 @@ Returns TRUE if the user has aborted the print job. Creates the default printing abort window, with a cancel button. + +\membersection{wxPrinter::GetLastError}\label{wxprintergetlasterror} + +\func{static wxPrinterError}{GetLastError}{\void} + +Return last error. Valid after calling \helpref{Print}{wxprinterprint}, +\helpref{PrintDialog}{wxprinterprintdialog} or +\helpref{wxPrintPreview::Print}{wxprintpreviewprint}. These functions +set last error to {\bf wxPRINTER\_NO\_ERROR} if no error happened. + +Returned value is one of the following: + +\twocolwidtha{7cm} +\begin{twocollist}\itemsep=0pt +\twocolitem{{\bf wxPRINTER\_NO\_ERROR}}{No error happened.} +\twocolitem{{\bf wxPRINTER\_CANCELLED}}{The user cancelled printing.} +\twocolitem{{\bf wxPRINTER\_ERROR}}{There was an error during printing.} +\end{twocollist} + + \membersection{wxPrinter::GetPrintDialogData}\label{wxprintergetprintdialogdata} \func{wxPrintDialogData\&}{GetPrintDialogData}{\void} @@ -612,7 +632,9 @@ Starts the printing process. Provide a parent window, a user-defined wxPrintout the printing of a document, and whether the print dialog should be invoked first. Print could return FALSE if there was a problem initializing the printer device context -(current printer not set, for example). +(current printer not set, for example) or the user cancelled printing. Call +\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed +information about the kind of the error. \membersection{wxPrinter::PrintDialog}\label{wxprinterprintdialog} @@ -620,7 +642,9 @@ Print could return FALSE if there was a problem initializing the printer device Invokes the print dialog. If successful (the user did not press Cancel and no error occurred), a suitable device context will be returned -(otherwise NULL is returned). +(otherwise NULL is returned -- call +\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed +information about the kind of the error). The application must delete this device context to avoid a memory leak. @@ -783,7 +807,7 @@ this by a scaling factor to take the preview DC size into account. \func{bool}{HasPage}{\param{int}{ pageNum}} -Should be overriden to return TRUE if the document has this page, or FALSE +Should be overridden to return TRUE if the document has this page, or FALSE if not. Returning FALSE signifies the end of the document. By default, HasPage behaves as if the document has only one page. @@ -802,9 +826,9 @@ this function cancels the print job. OnBeginDocument is called once for every copy printed. The base wxPrintout::OnBeginDocument {\it must} be called (and the return value -checked) from within the overriden function, since it calls wxDC::StartDoc. +checked) from within the overridden function, since it calls wxDC::StartDoc. -\pythonnote{If this method is overriden in a Python class then the +\pythonnote{If this method is overridden in a Python class then the base class version can be called by using the method {\tt base_OnBeginDocument(startPage, endPage)}. } @@ -816,7 +840,7 @@ Called by the framework at the end of document printing. OnEndDocument is called once for every copy printed. The base wxPrintout::OnEndDocument {\it must} be called -from within the overriden function, since it calls wxDC::EndDoc. +from within the overridden function, since it calls wxDC::EndDoc. \membersection{wxPrintout::OnBeginPrinting}\label{wxprintoutonbeginprinting} @@ -984,6 +1008,10 @@ supplied in the wxPrintPreview constructor. Will normally be called by the {\bf Print...} panel item on the preview frame's control bar. +Returns FALSE in case of error -- call +\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed +information about the kind of the error. + \membersection{wxPrintPreview::RenderPage}\label{wxprintpreviewrenderpage} \func{bool}{RenderPage}{\param{int }{pageNum}} diff --git a/docs/latex/wx/process.tex b/docs/latex/wx/process.tex index 4aa9a8df23..9438d0433e 100644 --- a/docs/latex/wx/process.tex +++ b/docs/latex/wx/process.tex @@ -14,6 +14,15 @@ However, if it is not processed, the object will delete itself and so the library users should only delete those objects whose notifications have been processed (and call \helpref{Detach()}{wxprocessdetach} for others). +wxProcess also supports IO redirection of the child process. For this, you have +to call its \helpref{Redirect}{wxprocessredirect} method before passing it to +\helpref{wxExecute}{wxexecute}. If the child process was launched successfully, +\helpref{GetInputStream}{wxprocessgetinputstream}, +\helpref{GetOutputStream}{wxprocessgetoutputstream} and +\helpref{GetErrorStream}{wxprocessgeterrorstream} can then be used to retrieve +the streams corresponding to the child process stdandard output, input and +error output respectively. + \wxheading{Derived from} \helpref{wxEvtHandler}{wxevthandler} @@ -22,6 +31,11 @@ processed (and call \helpref{Detach()}{wxprocessdetach} for others). <wx/process.h> +\wxheading{See also} + +\helpref{wxExecute}{wxexecute}\\ +\helpref{exec sample}{sampleexec} + \latexignore{\rtfignore{\wxheading{Members}}} \membersection{wxProcess::wxProcess}\label{wxprocessconstr} @@ -48,6 +62,15 @@ macro in the event table of the parent to handle it) with the given {\it id}. Destroys the wxProcess object. +\membersection{wxProcess::CloseOutput}\label{wxprocesscloseoutput} + +\func{void}{CloseOutput}{\void} + +Closes the output stream (the one connected to the stdin of the child +process). This function can be used to indicate to the child process that +there is no more data to be read - usually, a filter program will only +terminate when the input stream is closed. + \membersection{wxProcess::Detach}\label{wxprocessdetach} \func{void}{Detach}{\void} @@ -62,19 +85,26 @@ from its parent, no notification events will be sent to the parent and the object will delete itself upon reception of the process termination notification. +\membersection{wxProcess::GetErrorStream}\label{wxprocessgeterrorstream} + +\constfunc{wxInputStream* }{GetErrorStream}{\void} + +Returns an input stream which corresponds to the standard error output (stderr) +of the child process. + \membersection{wxProcess::GetInputStream}\label{wxprocessgetinputstream} \constfunc{wxInputStream* }{GetInputStream}{\void} -It returns a output stream corresponding to the input stream of the subprocess. -If it is NULL, you have not turned on the redirection. +It returns a output stream corresponding to the standard output stream of the +subprocess. If it is NULL, you have not turned on the redirection. See \helpref{wxProcess::Redirect}{wxprocessredirect}. \membersection{wxProcess::GetOutputStream}\label{wxprocessgetoutputstream} \constfunc{wxOutputStream* }{GetOutputStream}{\void} -It returns an output stream correspoding to the output stream of the subprocess. +It returns an output stream correspoding to the input stream of the subprocess. If it is NULL, you have not turned on the redirection. See \helpref{wxProcess::Redirect}{wxprocessredirect}. @@ -83,7 +113,7 @@ See \helpref{wxProcess::Redirect}{wxprocessredirect}. \constfunc{void}{OnTerminate}{\param{int}{ pid}, \param{int}{ status}} It is called when the process with the pid {\it pid} finishes. -It raises a wxWindows event when it isn't overriden. +It raises a wxWindows event when it isn't overridden. \docparam{pid}{The pid of the process which has just terminated.} diff --git a/docs/latex/wx/proplist.tex b/docs/latex/wx/proplist.tex index d782b0c598..f9ce7a77a2 100644 --- a/docs/latex/wx/proplist.tex +++ b/docs/latex/wx/proplist.tex @@ -333,7 +333,7 @@ one property, and there is no provision for invoking further dialogs. The reader may like to work out how the form view could be extended to provide some of the functionality of the property list! -Validator objects may be associated explictly with a wxProperty, or they may be +Validator objects may be associated explicitly with a wxProperty, or they may be indirectly associated by virtue of a property `kind' that matches validators having that kind. In the latter case, such validators are stored in a validator registry which is passed to the view before the dialog is shown. If the validator takes @@ -453,7 +453,7 @@ example, in Visual Basic and similar programming environments, you can `edit a button', or rather, edit the button's properties. One of the properties you can edit is {\it width} - but there is no explicit representation of width in a wxWindows button; instead, you call SetSize -and GetSize members. To translate this into a consisent, +and GetSize members. To translate this into a consistent, property-oriented scheme, we could derive a new class wxButtonWithProperties, which has two new functions: SetProperty and GetProperty. SetProperty accepts a property name and a value, and calls diff --git a/docs/latex/wx/protocol.tex b/docs/latex/wx/protocol.tex index d83dce4fd6..fcc9b406c3 100644 --- a/docs/latex/wx/protocol.tex +++ b/docs/latex/wx/protocol.tex @@ -68,19 +68,19 @@ Returns TRUE, if successful, else FALSE. \func{wxProtocolError}{GetError}{\void} -Returns the last occured error. +Returns the last occurred error. \twocolwidtha{7cm} \begin{twocollist}\itemsep=0pt \twocolitem{{\bf wxPROTO\_NOERR}}{No error.} -\twocolitem{{\bf wxPROTO\_NETERR}}{A generic network error occured.} -\twocolitem{{\bf wxPROTO\_PROTERR}}{An error occured during negotiation.} +\twocolitem{{\bf wxPROTO\_NETERR}}{A generic network error occurred.} +\twocolitem{{\bf wxPROTO\_PROTERR}}{An error occurred during negotiation.} \twocolitem{{\bf wxPROTO\_CONNERR}}{The client failed to connect the server.} \twocolitem{{\bf wxPROTO\_INVVAL}}{Invalid value.} \twocolitem{{\bf wxPROTO\_NOHNDLR}}{.} \twocolitem{{\bf wxPROTO\_NOFILE}}{The remote file doesn't exist.} \twocolitem{{\bf wxPROTO\_ABRT}}{Last action aborted.} -\twocolitem{{\bf wxPROTO\_RCNCT}}{An error occured during reconnection.} +\twocolitem{{\bf wxPROTO\_RCNCT}}{An error occurred during reconnection.} \twocolitem{{\bf wxPROTO\_STREAM}}{Someone tried to send a command during a transfer.} \end{twocollist} diff --git a/docs/latex/wx/psbox.tex b/docs/latex/wx/psbox.tex index b7438f4f29..3671764983 100644 --- a/docs/latex/wx/psbox.tex +++ b/docs/latex/wx/psbox.tex @@ -150,7 +150,7 @@ include "##1"}}} \newdimen\psxoffset\newdimen\psyoffset \newbox\drawingBox \newif\ifNotB@undingBox -\newhelp\PShelp{Proceed: you'll have a 5cm square blank box instead of +\newhelp\PShelp{Proceed: you will have a 5cm square blank box instead of your graphics (Jean Orloff).} \def\@mpty{} \def\s@tsize#1 #2 #3 #4\@ndsize{ @@ -388,7 +388,7 @@ press x or e) and rename it before retrying.} \w@{%-make sure you can \string\input\space psbox.tex (version>=1.3);} \w@{%-tex JOINTFIL using Plain, or LaTeX, or whatever is needed by} \w@{% the first part in the joining (after splitting JOINTFIL into} - \w@{% it's constituents, TeX will try to process it as it stands).} + \w@{% it is constituents, TeX will try to process it as it stands).} \w@{\string\input\space psbox.tex} \w@{\string\splitfile{\string\jobname}} } diff --git a/docs/latex/wx/rect.tex b/docs/latex/wx/rect.tex index 9a8c6f106f..4611502121 100644 --- a/docs/latex/wx/rect.tex +++ b/docs/latex/wx/rect.tex @@ -38,13 +38,13 @@ Creates a wxRect object from position and size values. \member{int}{x} -x member. +x coordinate of the top-level corner of the rectangle. \membersection{wxRect::y} \member{int}{y} -y member. +y coordinate of the top-level corner of the rectangle. \membersection{wxRect::width} diff --git a/docs/latex/wx/sashwin.tex b/docs/latex/wx/sashwin.tex index 219d8e1944..fb2dd26927 100644 --- a/docs/latex/wx/sashwin.tex +++ b/docs/latex/wx/sashwin.tex @@ -21,7 +21,10 @@ The following styles apply in addition to the normal wxWindow styles. \twocolwidtha{5cm}% \begin{twocollist}\itemsep=0pt -\twocolitem{\windowstyle{wxSW\_3D}}{Draws the sashes in 3D.} +\twocolitem{\windowstyle{wxSW\_3D}}{Draws a 3D effect sash and border.} +\twocolitem{\windowstyle{wxSW\_3DSASH}}{Draws a 3D effect sash.} +\twocolitem{\windowstyle{wxSW\_3DBORDER}}{Draws a 3D effect border.} +\twocolitem{\windowstyle{wxSW\_BORDER}}{Draws a thin black border.} \end{twocollist} See also \helpref{window styles overview}{windowstyles}. diff --git a/docs/latex/wx/sbsizer.tex b/docs/latex/wx/sbsizer.tex index df5a8a5e45..3cc226a5b4 100644 --- a/docs/latex/wx/sbsizer.tex +++ b/docs/latex/wx/sbsizer.tex @@ -19,7 +19,7 @@ See also \helpref{wxSizer}{wxsizer}, \helpref{wxStaticBox}{wxstaticbox} and \func{}{wxStaticBoxSizer}{\param{wxStaticBox* }{box}, \param{int }{orient}} -Constructor. It takes an associated static box and the orientation {\it orient} +Constructor. It takes an associated static box and the orientation {\it orient} as parameters - orient can be either of wxVERTICAL or wxHORIZONTAL. \membersection{wxStaticBoxSizer::GetStaticBox}\label{wxstaticboxsizergetstaticbox} diff --git a/docs/latex/wx/scrolwin.tex b/docs/latex/wx/scrolwin.tex index 8224091442..bfe54c172b 100644 --- a/docs/latex/wx/scrolwin.tex +++ b/docs/latex/wx/scrolwin.tex @@ -16,7 +16,7 @@ scroll position. A wxScrolledWindow will normally scroll itself and therefore its child windows as well. It might however be desired to scroll a different window than itself: e.g. when designing a -spreadsheet, you'll normally only have to scroll the (usually white) cell area, whereas the +spreadsheet, you will normally only have to scroll the (usually white) cell area, whereas the (usually grey) label area will scroll very differently. For this special purpose, you can call \helpref{SetTargetWindow}{wxscrolledwindowsettargetwindow} which means that pressing the scrollbars will scroll a different window. diff --git a/docs/latex/wx/sizer.tex b/docs/latex/wx/sizer.tex index 5bf380513a..7c83d6edc9 100644 --- a/docs/latex/wx/sizer.tex +++ b/docs/latex/wx/sizer.tex @@ -1,7 +1,7 @@ \section{\class{wxSizer}}\label{wxsizer} wxSizer is the abstract base class used for laying out subwindows in a window. You -cannot use wxSizer directly; instead, you'll have to use \helpref{wxBoxSizer}{wxboxsizer}, +cannot use wxSizer directly; instead, you will have to use \helpref{wxBoxSizer}{wxboxsizer}, \helpref{wxStaticBoxSizer}{wxstaticboxsizer} or \helpref{wxNotebookSizer}{wxnotebooksizer}. The layout algorithm used by sizers in wxWindows is closely related to layout @@ -20,7 +20,7 @@ What makes sizers so well fitted for use in wxWindows is the fact that every con reports its own minimal size and the algorithm can handle differences in font sizes or different window (dialog item) sizes on different platforms without problems. If e.g. the standard font as well as the overall design of Motif widgets requires more space than -on Windows, the intial dialog size will automatically be bigger on Motif than on Windows. +on Windows, the initial dialog size will automatically be bigger on Motif than on Windows. \pythonnote{If you wish to create a sizer class in wxPython you should derive the class from {\tt wxPySizer} in order to get Python-aware @@ -56,11 +56,11 @@ The destructor. Adds the {\it window} to the sizer. As wxSizer itself is an abstract class, the parameters have no meaning in the wxSizer class itself, but as there currently is only one class deriving directly from wxSizer and this class does not override these methods, the meaning -of the paramters is described here: +of the parameters is described here: \docparam{window}{The window to be added to the sizer. Its initial size (either set explicitly by the user or calculated internally when using wxDefaultSize) is interpreted as the minimal and in many -cases also the initial size. This is particularly useful in connection with \helpref{SetSizeHint}{wxsizersetsizehints}.} +cases also the initial size. This is particularly useful in connection with \helpref{SetSizeHints}{wxsizersetsizehints}.} \docparam{sizer}{The (child-)sizer to be added to the sizer. This allows placing a child sizer in a sizer and thus to create hierarchies of sizers (typically a vertical box as the top sizer and several @@ -75,21 +75,21 @@ the dialog.} \docparam{option}{Although the meaning of this parameter is undefined in wxSizer, it is used in wxBoxSizer to indicate if a child of a sizer can change its size in the main orientation of the wxBoxSizer - where -0 stands for not changable and a value of more than zero in interpreted relative to the value of other -children of the same wxBoxSizer. You might, e.g., have a horizontal wxBoxSizer with three children, two -of which are supposed to change their size with the sizer, then the two stretchable windows would get a +0 stands for not changable and a value of more than zero is interpreted relative to the value of other +children of the same wxBoxSizer. For example, you might have a horizontal wxBoxSizer with three children, two +of which are supposed to change their size with the sizer. Then the two stretchable windows would get a value of 1 each to make them grow and shrink equally with the sizer's horizontal dimension.} \docparam{flag}{This parameter can be used to set a number of flags which can be combined using -the binary OR operator |. Two main behaviours are defined using these flags: One is the border +the binary OR operator |. Two main behaviours are defined using these flags. One is the border around a window: the {\it border} parameter determines the border width whereas the flags given here determine where the border may be (wxTOP, wxBOTTOM, wxLEFT, wxRIGHT or wxALL). The other flags -determine the child window's behaviour if the size of the sizer changes, but - in contrast to -the {\it option} flag - not in the main orientation, but the respectively other orientation. So +determine the child window's behaviour if the size of the sizer changes. However this is not - in contrast to +the {\it option} flag - in the main orientation, but in the respectively other orientation. So if you created a wxBoxSizer with the wxVERTICAL option, these flags will be relevant if the sizer changes its horizontal size. A child may get resized to completely fill out the new size (using -either wxGROW or wxEXPAND), may get proportionally resized (wxSHAPED), may get centered (wxALIGN\_CENTER -or wxALIGN\_CENTRE) or may get aligned to either side (wxALIGN\_LEFT and wxALIGN\_TOP are set to 0 +either wxGROW or wxEXPAND), it may get proportionally resized (wxSHAPED), it may get centered (wxALIGN\_CENTER +or wxALIGN\_CENTRE) or it may get aligned to either side (wxALIGN\_LEFT and wxALIGN\_TOP are set to 0 and thus represent the default, wxALIGN\_RIGHT and wxALIGN\_BOTTOM have their obvious meaning). With proportional resize, a child may also be centered in the main orientation using wxALIGN\_CENTER\_VERTICAL (same as wxALIGN\_CENTRE\_VERTICAL) and wxALIGN\_CENTER\_HORIZONTAL @@ -99,7 +99,50 @@ wxALIGN\_CENTER\_VERTICAL (same as wxALIGN\_CENTRE\_VERTICAL) and wxALIGN\_CENTE \docparam{userData}{Allows an extra object to be attached to the sizer item, for use in derived classes when sizing information is more -complex than what {\it option} and {\it flag} will allow for.} +complex than the {\it option} and {\it flag} will allow for.} + +\membersection{wxSizer::CalcMin}\label{wxsizercalcmin} + +\func{wxSize}{CalcMin}{\void} + +This method is abstract and has to be overwritten by any derived class. +Here, the sizer will do the actual calculation of its children minimal sizes. + +\membersection{wxSizer::Fit}\label{wxsizerfit} + +\func{void}{Fit}{\param{wxWindow* }{window}} + +Tell the sizer to resize the {\it window} to match the sizer's minimal size. This +is commonly done in the constructor of the window itself, see sample in the description +of \helpref{wxBoxSizer}{wxboxsizer}. + +\membersection{wxSizer::GetSize}\label{wxsizergetsize} + +\func{wxSize}{GetSize}{\void} + +Returns the current size of the sizer. + +\membersection{wxSizer::GetPosition}\label{wxsizergetposition} + +\func{wxPoint}{GetPosition}{\void} + +Returns the current position of the sizer. + +\membersection{wxSizer::GetMinSize}\label{wxsizergetminsize} + +\func{wxSize}{GetMinSize}{\void} + +Returns the minimal size of the sizer. This is either the combined minimal +size of all the children and their borders or the minimal size set by +\helpref{SetMinSize}{wxsizersetminsize}, depending on which is bigger. + +\membersection{wxSizer::Layout}\label{wxsizerlayout} + +\func{void}{Layout}{\void} + +Call this to force layout of the children anew, e.g. after having added a child +to or removed a child (window, other sizer or space) from the sizer while keeping +the current dimension. \membersection{wxSizer::Prepend}\label{wxsizerprepend} @@ -112,6 +155,14 @@ complex than what {\it option} and {\it flag} will allow for.} Same as \helpref{wxSizer::Add}{wxsizeradd}, but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer. +\membersection{wxSizer::RecalcSizes}\label{wxsizerrecalcsizes} + +\func{void}{RecalcSizes}{\void} + +This method is abstract and has to be overwritten by any derived class. +Here, the sizer will do the actual calculation of its children's positions +and sizes. + \membersection{wxSizer::Remove}\label{wxsizerremove} \func{bool}{Remove}{\param{wxWindow* }{window}} @@ -120,10 +171,10 @@ list of items (windows, subsizers or spaces) owned by this sizer. \func{bool}{Remove}{\param{int }{nth}} -Removes a child from the sizer. {\it window} is the window to be removed, {\it sizer} the +Removes a child from the sizer. {\it window} is the window to be removed, {\it sizer} is the equivalent sizer and {\it nth} is the position of the child in the sizer, typically 0 for the first item. This method does not cause any layout or resizing to take place and does -not delete the window itself. Call \helpref{wxSizer::Layout}{wxsizerlayout} for updating +not delete the window itself. Call \helpref{wxSizer::Layout}{wxsizerlayout} to update the layout "on screen" after removing a child fom the sizer. Returns TRUE if the child item was found and removed, FALSE otherwise. @@ -134,56 +185,31 @@ Returns TRUE if the child item was found and removed, FALSE otherwise. Call this to force the sizer to take the given dimension and thus force the items owned by the sizer to resize themselves according to the rules defined by the paramater in the -\helpref{wxSizer::Add}{wxsizeradd} and \helpref{wxSizer::Prepend}{wxsizerprepend} methods. - -\membersection{wxSizer::GetSize}\label{wxsizergetsize} - -\func{wxSize}{GetSize}{\void} - -Returns the current size of the sizer. - -\membersection{wxSizer::GetPosition}\label{wxsizergetposition} - -\func{wxPoint}{GetPosition}{\void} - -Returns the current position of the sizer. - -\membersection{wxSizer::GetMinSize}\label{wxsizergetminsize} - -\func{wxSize}{GetMinSize}{\void} - -Returns the minimal size of the sizer. +\helpref{Add}{wxsizeradd} and \helpref{Prepend}{wxsizerprepend} methods. -\membersection{wxSizer::RecalcSizes}\label{wxsizerrecalcsizes} +\membersection{wxSizer::SetMinSize}\label{wxsizersetminsize} -\func{void}{RecalcSizes}{\void} +\func{void}{SetMinSize}{\param{int }{width}, \param{int }{height}} -This method is abstract and has to be overwritten by any derived class. -Here, the sizer will do the actual calculation of its children's positions -and sizes. +\func{void}{SetMinSize}{\param{wxSize }{size}} -\membersection{wxSizer::CalcMin}\label{wxsizercalcmin} +Call this to give the sizer a minimal size. Normally, the sizer will calculate its +minimal size based purely on how much space its children need. After calling this +method \helpref{GetMinSize}{wxsizergetminsize} will return either the minimal size +as requested by its children or the minimal size set here, depending on which is +bigger. -\func{wxSize}{CalcMin}{\void} +\membersection{wxSizer::SetItemMinSize}\label{wxsizersetitemminsize} -This method is abstract and has to be overwritten by any derived class. -Here, the sizer will do the actual calculation of its children minimal sizes. +\func{void}{SetItemMinSize}{\param{wxWindow* }{window}, \param{int}{ width}, \param{int}{ height}} -\membersection{wxSizer::Layout}\label{wxsizerlayout} +\func{void}{SetItemMinSize}{\param{wxSizer* }{sizer}, \param{int}{ width}, \param{int}{ height}} -\func{void}{Layout}{\void} +\func{void}{SetItemMinSize}{\param{int}{ pos}, \param{int}{ width}, \param{int}{ height}} -Call this to force laying out the children anew, e.g. after having added a child -to or removed a child (window, other sizer or space) from the sizer while keeping -the current dimension. - -\membersection{wxSizer::Fit}\label{wxsizerfit} - -\func{void}{Fit}{\param{wxWindow* }{window}} - -Tell the sizer to resize the {\it window} to match the sizer's minimal size. This -is commonly done in the constructor of the window itself, see sample in the description -of \helpref{wxBoxSizer}{wxboxsizer}. +Set an item's minimum size by window, sizer, or position. The item will be found recursively +in the sizer's descendants. This function enables an application to set the size of an item +after initial creation. \membersection{wxSizer::SetSizeHints}\label{wxsizersetsizehints} @@ -191,6 +217,6 @@ of \helpref{wxBoxSizer}{wxboxsizer}. Tell the sizer to set the minimal size of the {\it window} to match the sizer's minimal size. This is commonly done in the constructor of the window itself, see sample in the description -of \helpref{wxBoxSizer}{wxboxsizer} if the window is resizable (as many dialogs under Unix and +of \helpref{wxBoxSizer}{wxboxsizer} if the window is resizable (as are many dialogs under Unix and frames on probably all platforms). diff --git a/docs/latex/wx/socket.tex b/docs/latex/wx/socket.tex index 7e67b86192..1a288d3348 100644 --- a/docs/latex/wx/socket.tex +++ b/docs/latex/wx/socket.tex @@ -6,7 +6,7 @@ %% Created: 1999 %% RCS-ID: $Id$ %% Copyright: (c) wxWindows team -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxSocketBase}}\label{wxsocketbase} @@ -44,7 +44,7 @@ defines all basic IO functionality. \begin{twocollist}\itemsep=0pt \twocolitem{{\bf wxSOCKET\_INPUT}}{There is data available for reading.} \twocolitem{{\bf wxSOCKET\_OUTPUT}}{The socket is ready to be written to.} -\twocolitem{{\bf wxSOCKET\_CONNECTION}}{Incoming connection (server), or connection establishment (client).} +\twocolitem{{\bf wxSOCKET\_CONNECTION}}{Incoming connection request (server), or successful connection establishment (client).} \twocolitem{{\bf wxSOCKET\_LOST}}{The connection has been closed.} \end{twocollist} @@ -76,13 +76,13 @@ at the incoming queue (server). The {\bf wxSOCKET\_LOST} event is issued when a close indication is received for the socket. This means that the connection broke down or that it was closed by the peer. Also, this event will be issued if -a delayed connection request fails. +a connection request fails. \wxheading{Event handling} To process events coming from a socket object, use the following event -handler macro to direct events to member functions that take a -\helpref{wxSocketEvent}{wxsocketevent} argument. +handler macro to direct events to member functions that take +a \helpref{wxSocketEvent}{wxsocketevent} argument. \twocolwidtha{7cm}% \begin{twocollist}\itemsep=0pt @@ -106,7 +106,7 @@ handler macro to direct events to member functions that take a \helpref{wxSocketBase}{wxsocketbaseconstruct}\\ \helpref{\destruct{wxSocketBase}}{wxsocketbasedestruct}\\ -\helpref{wxDestroy}{wxsocketbasedestroy} +\helpref{Destroy}{wxsocketbasedestroy} \membersection{Socket state} @@ -219,16 +219,19 @@ void SocketCallback(wxSocketBase& sock, wxSocketNotify evt, char *cdata); \end{verbatim} The first parameter is a reference to the socket object in which the -event occured. The second parameter tells you which event occured. +event occurred. The second parameter tells you which event occurred. (See \helpref{wxSocket events}{wxsocketbase}). The third parameter is the user data you specified using \helpref{CallbackData}{wxsocketbasecallbackdata}. -Note that events are preferred over callbacks where possible. - \wxheading{Return value} A pointer to the previous callback. +\wxheading{Remark/Warning} + +Note that callbacks are now deprecated and unsupported, and they remain +for backwards compatibility only. Use events instead. + \wxheading{See also} \helpref{wxSocketBase::CallbackData}{wxsocketbasecallbackdata}, @@ -245,12 +248,17 @@ A pointer to the previous callback. This function sets the the user data which will be passed to a callback function set via \helpref{Callback}{wxsocketbasecallback}. -Note that events are preferred over callbacks where possible. - \wxheading{Return value} A pointer to the previous user data. +\wxheading{Remark/Warning} + +Note that callbacks are now deprecated and unsupported, and they remain +for backwards compatibility only. Use events instead. + +\wxheading{See also} + \helpref{wxSocketBase::Callback}{wxsocketbasecallback}, \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify}, \helpref{wxSocketBase::Notify}{wxsocketbasenotify} @@ -265,8 +273,9 @@ A pointer to the previous user data. This function shuts down the socket, disabling further transmission and reception of data; it also disables events for the socket and frees the associated system resources. Upon socket destruction, Close is automatically -called. This means that you don't need to do it yourself, unless you -explicitly want to disable further operation. +called, so in most cases you won't need to do it yourself, unless you +explicitly want to shut down the socket, typically to notify the peer +that you are closing the connection. \wxheading{Remark/Warning} @@ -316,7 +325,7 @@ If you use \helpref{Error}{wxsocketbaseerror}, it will always return FALSE. \constfunc{bool}{Error}{\void} -Returns TRUE if an error occured in the last IO operation. +Returns TRUE if an error occurred in the last IO operation. Use this function to check for an error condition after one of the following calls: Discard, Peek, Read, ReadMsg, Unread, Write, WriteMsg. @@ -336,7 +345,7 @@ Returns a pointer of the client data for this socket, as set with % \membersection{wxSocketBase::GetLocal}\label{wxsocketbasegetlocal} -\constfunc{bool}{GetLocal}{\param{wxSockAddress\& }{addr\_man}} +\constfunc{bool}{GetLocal}{\param{wxSockAddress\& }{addr}} This function returns the local address field of the socket. The local address field contains the complete local address of the socket (local @@ -344,7 +353,7 @@ address, local port, ...). \wxheading{Return value} -It returns TRUE if no errors happened, FALSE otherwise. +TRUE if no error happened, FALSE otherwise. % % GetFlags @@ -360,7 +369,7 @@ Returns current IO flags, as set with \helpref{SetFlags}{wxsocketbasesetflags} % \membersection{wxSocketBase::GetPeer}\label{wxsocketbasegetpeer} -\constfunc{bool}{GetPeer}{\param{wxSockAddress\& }{addr\_man}} +\constfunc{bool}{GetPeer}{\param{wxSockAddress\& }{addr}} This function returns the peer address field of the socket. The peer address field contains the complete peer host address of the socket @@ -368,7 +377,7 @@ address field contains the complete peer host address of the socket \wxheading{Return value} -It returns TRUE if no errors happened, FALSE otherwise. +TRUE if no error happened, FALSE otherwise. % % InterruptWait @@ -446,7 +455,7 @@ ReadMsg, Unread, Write, WriteMsg. Returns the last wxSocket error. See \helpref{wxSocket errors}{wxsocketbase}. Please note that this function merely returns the last error code, -but it should not be used to determine if an error has occured (this +but it should not be used to determine if an error has occurred (this is because successful operations do not change the LastError value). Use \helpref{Error}{wxsocketbaseerror} first, in order to determine if the last IO call failed. If this returns TRUE, use LastError @@ -484,8 +493,8 @@ For \helpref{wxSocketServer}{wxsocketserver}, Ok will return TRUE if the server could bind to the specified address and is already listening for new connections. -Ok does not check for IO errors; use \helpref{Error}{wxsocketbaseerror} -instead for that purpose. +Ok does not check for IO errors; +use \helpref{Error}{wxsocketbaseerror} instead for that purpose. % % RestoreState @@ -532,16 +541,15 @@ Calls to SaveState and RestoreState can be nested. \func{void}{SetClientData}{\param{void *}{data}} Sets user-supplied client data for this socket. All socket events will -contain a pointer to this data, which can be retrieved with the -\helpref{wxSocketEvent::GetClientData}{wxsocketeventgetclientdata} -function. +contain a pointer to this data, which can be retrieved with +the \helpref{wxSocketEvent::GetClientData}{wxsocketeventgetclientdata} function. % % SetEventHandler % \membersection{wxSocketBase::SetEventHandler}\label{wxsocketbaseseteventhandler} -\func{void}{SetEventHandler}{\param{wxEvtHandler\&}{ evt\_hdlr}, \param{int}{ id = -1}} +\func{void}{SetEventHandler}{\param{wxEvtHandler\&}{ handler}, \param{int}{ id = -1}} Sets an event handler to be called when a socket event occurs. The handler will be called for those events for which notification is @@ -550,7 +558,7 @@ enabled with \helpref{SetNotify}{wxsocketbasesetnotify} and \wxheading{Parameters} -\docparam{evt\_hdlr}{Specifies the event handler you want to use.} +\docparam{handler}{Specifies the event handler you want to use.} \docparam{id}{The id of socket event.} @@ -566,11 +574,11 @@ enabled with \helpref{SetNotify}{wxsocketbasesetnotify} and % \membersection{wxSocketBase::SetFlags}\label{wxsocketbasesetflags} -\func{void}{SetFlags}{\param{wxSocketBase::wxSocketFlags}{ flags}} +\func{void}{SetFlags}{\param{wxSocketFlags}{ flags}} -Use SetFlags to customize IO operation for this socket. The {\it flags} -parameter is a combination of flags ORed toghether. The following flags -can be used: +Use SetFlags to customize IO operation for this socket. +The {\it flags} parameter may be a combination of flags ORed toghether. +The following flags can be used: \twocolwidtha{7cm} \begin{twocollist}\itemsep=0pt @@ -585,9 +593,9 @@ A brief overview on how to use these flags follows. If no flag is specified (this is the same as {\bf wxSOCKET\_NONE}), IO calls will return after some data has been read or written, even when the transfer might not be complete. This is the same as issuing -exactly one blocking low-level call to recv() or send(). Note that -{\it blocking} here refers to when the function returns, not to whether -the GUI blocks during this time. +exactly one blocking low-level call to recv() or send(). Note +that {\it blocking} here refers to when the function returns, not +to whether the GUI blocks during this time. If {\bf wxSOCKET\_NOWAIT} is specified, IO calls will return immediately. Read operations will retrieve only available data. Write operations will @@ -601,9 +609,9 @@ If {\bf wxSOCKET\_WAITALL} is specified, IO calls won't return until ALL the data has been read or written (or until an error occurs), blocking if necessary, and issuing several low level calls if necessary. This is the same as having a loop which makes as many blocking low-level calls to -recv() or send() as needed so as to transfer all the data. Note that -{\it blocking} here refers to when the function returns, not to whether -the GUI blocks during this time. +recv() or send() as needed so as to transfer all the data. Note +that {\it blocking} here refers to when the function returns, not +to whether the GUI blocks during this time. The {\bf wxSOCKET\_BLOCK} flag controls whether the GUI blocks during IO operations. If this flag is specified, the socket will not yield @@ -632,7 +640,7 @@ it controls whether the GUI blocks. \func{void}{SetNotify}{\param{wxSocketEventFlags}{ flags}} SetNotify specifies which socket events are to be sent to the event handler. -The {\it flags} parameter is a combination of flags ORed toghether. The +The {\it flags} parameter may be combination of flags ORed toghether. The following flags can be used: \twocolwidtha{7cm} @@ -663,9 +671,9 @@ For more information on socket events see \helpref{wxSocket events}{wxsocketbase \func{void}{SetTimeout}{\param{int }{seconds}} This function sets the default socket timeout in seconds. This timeout -applies to all IO calls, and also to the \helpref{Wait}{wxsocketbasewait} -family of functions if you don't specify a wait interval. Initially, the -default is set to 10 minutes. +applies to all IO calls, and also to the \helpref{Wait}{wxsocketbasewait} family +of functions if you don't specify a wait interval. Initially, the default +timeout is 10 minutes. % % Peek @@ -816,18 +824,19 @@ Returns a reference to the current object. \func{bool}{Wait}{\param{long}{ seconds = -1}, \param{long}{ millisecond = 0}} -This function waits until one of the following conditions is TRUE. Note -that it is recommended to use the individual Wait functions to wait for -the required condition, instead of this one. +This function waits until any of the following conditions is TRUE: \begin{itemize} \item The socket becomes readable. \item The socket becomes writable. -\item An ongoing connection request has completed (only for clients) -\item An incoming connection request has arrived (only for servers) +\item An ongoing connection request has completed (\helpref{wxSocketClient}{wxsocketclient} only) +\item An incoming connection request has arrived (\helpref{wxSocketServer}{wxsocketserver} only) \item The connection has been closed. \end{itemize} +Note that it is recommended to use the individual Wait functions +to wait for the required condition, instead of this one. + \wxheading{Parameters} \docparam{seconds}{Number of seconds to wait. @@ -1054,7 +1063,7 @@ Constructor. \func{}{\destruct{wxSocketClient}}{\void} -Destructor. +Destructor. Please see \helpref{wxSocketBase::Destroy}{wxsocketbasedestroy}. % % Connect @@ -1065,8 +1074,8 @@ Destructor. Connects to a server using the specified address. -If {\it wait} is TRUE, Connect will wait until the connection completes. -{\bf Warning:} This will block the GUI. +If {\it wait} is TRUE, Connect will wait until the connection +completes. {\bf Warning:} This will block the GUI. If {\it wait} is FALSE, Connect will try to establish the connection and return immediately, without blocking the GUI. When used this way, even if @@ -1085,13 +1094,13 @@ and {\bf wxSOCKET\_LOST} events (for connection failure). Returns TRUE if the connection is established and no error occurs. -If {\it wait} was TRUE, and Connect returns FALSE, an error occured +If {\it wait} was TRUE, and Connect returns FALSE, an error occurred and the connection failed. If {\it wait} was FALSE, and Connect returns FALSE, you should still be prepared to handle the completion of this connection request, either -with \helpref{WaitOnConnect}{wxsocketclientwaitonconnect} or by watching -{\bf wxSOCKET\_CONNECTION} and {\bf wxSOCKET\_LOST} events. +with \helpref{WaitOnConnect}{wxsocketclientwaitonconnect} or by +watching {\bf wxSOCKET\_CONNECTION} and {\bf wxSOCKET\_LOST} events. \wxheading{See also} @@ -1107,8 +1116,8 @@ with \helpref{WaitOnConnect}{wxsocketclientwaitonconnect} or by watching \func{bool}{WaitOnConnect}{\param{long}{ seconds = -1}, \param{long}{ milliseconds = 0}} Wait until a connection request completes, or until the specified timeout -elapses. Use this function after issuing a call to \helpref{Connect}{wxsocketclientconnect} -with {\it wait} set to FALSE. +elapses. Use this function after issuing a call +to \helpref{Connect}{wxsocketclientconnect} with {\it wait} set to FALSE. \wxheading{Parameters} @@ -1139,7 +1148,7 @@ bool waitmore = TRUE; while ( !client->WaitOnConnect(seconds, millis) && waitmore ) { // possibly give some feedback to the user, - // and update waitmore if needed. + // and update waitmore as needed. } bool success = client->IsConnected(); \end{verbatim} @@ -1167,8 +1176,8 @@ This event class contains information about socket events. \wxheading{Event table macros} -To process a socket event, use these event handler macros to direct input to member -functions that take a wxSocketEvent argument. +To process a socket event, use these event handler macros to direct input +to member functions that take a wxSocketEvent argument. \twocolwidtha{7cm} \begin{twocollist}\itemsep=0pt @@ -1265,8 +1274,8 @@ Accepts an incoming connection request, and creates a new the server-side of the connection. If {\it wait} is TRUE and there are no pending connections to be -accepted, it will wait for the next incoming connection to arrive. -{\bf Warning:} This will block the GUI. +accepted, it will wait for the next incoming connection to +arrive. {\bf Warning:} This will block the GUI. If {\it wait} is FALSE, it will try to accept a pending connection if there is one, but it will always return immediately without blocking @@ -1277,7 +1286,7 @@ that there is an incoming connection waiting to be accepted. \wxheading{Return value} -Returns an opened socket connection, or NULL if an error occured or +Returns an opened socket connection, or NULL if an error occurred or if the {\it wait} parameter was FALSE and there were no pending connections. @@ -1303,14 +1312,14 @@ Accept an incoming connection using the specified socket object. \wxheading{Return value} -Returns TRUE on success, or FALSE if an error occured or if the +Returns TRUE on success, or FALSE if an error occurred or if the {\it wait} parameter was FALSE and there were no pending connections. \helpref{wxSocketServer::WaitForAccept}{wxsocketserverwaitforaccept}, \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify}, \helpref{wxSocketBase::Notify}{wxsocketbasenotify}, -\helpref{wxSocketServer::Accept}{wxsocketserveraccept} for a detailed explanation +\helpref{wxSocketServer::Accept}{wxsocketserveraccept} % % WaitForAccept diff --git a/docs/latex/wx/spinbutt.tex b/docs/latex/wx/spinbutt.tex index cbd1263151..a3b885708d 100644 --- a/docs/latex/wx/spinbutt.tex +++ b/docs/latex/wx/spinbutt.tex @@ -1,7 +1,10 @@ \section{\class{wxSpinButton}}\label{wxspinbutton} -A wxSpinButton has two small up and down (or left and right) arrow buttons. It is often -used next to a text control for increment and decrementing a value. +A wxSpinButton has two small up and down (or left and right) arrow buttons. It +is often used next to a text control for increment and decrementing a value. +Portable programs should try to use \helpref{wxSpinCtrl}{wxspinctrl} instead +as wxSpinButton is not implemented for all platforms (Win32 and GTK only +currently). \wxheading{Derived from} @@ -10,6 +13,10 @@ used next to a text control for increment and decrementing a value. \helpref{wxEvtHandler}{wxevthandler}\\ \helpref{wxObject}{wxobject} +\wxheading{See also} + +\helpref{wxSpinCtrl}{wxspinctrl} + \wxheading{Include files} <wx/spinbutt.h> @@ -18,7 +25,7 @@ used next to a text control for increment and decrementing a value. \twocolwidtha{5cm} \begin{twocollist}\itemsep=0pt -\twocolitem{\windowstyle{wxSP\_HORIZONTAL}}{Specifies a horizontal spin button.} +\twocolitem{\windowstyle{wxSP\_HORIZONTAL}}{Specifies a horizontal spin button (note that this style is not supported in wxGTK).} \twocolitem{\windowstyle{wxSP\_VERTICAL}}{Specifies a vertical spin button.} \twocolitem{\windowstyle{wxSP\_ARROW\_KEYS}}{The user can use arrow keys.} \twocolitem{\windowstyle{wxSP\_WRAP}}{The value wraps at the minimum and maximum.} @@ -28,23 +35,15 @@ See also \helpref{window styles overview}{windowstyles}. \wxheading{Event handling} -To process input from a spin button, use one of these event handler macros to direct input to member -functions that take a \helpref{wxScrollEvent}{wxscrollevent} argument: +To process input from a spin button, use one of these event handler macros to +direct input to member functions that take a +\helpref{wxSpinEvent}{wxspinevent} argument: \twocolwidtha{7cm} \begin{twocollist} -\twocolitem{{\bf EVT\_SPIN(id, func)}}{Catch all scroll commands.} -\twocolitem{{\bf EVT\_SPIN\_UP(id, func)}}{Catch up (or left) commands. Win32 only. } -\twocolitem{{\bf EVT\_SPIN\_DOWN(id, func)}}{Catch down (or right) commands. Win32 only. } -\twocolitem{{\bf EVT\_COMMAND\_TOP(id, func)}}{Catch a command to put the scroll thumb at the maximum position.} -\twocolitem{{\bf EVT\_COMMAND\_SCROLL(id, func)}}{Catch all scroll commands.} -\twocolitem{{\bf EVT\_COMMAND\_TOP(id, func)}}{Catch a command to put the scroll thumb at the maximum position.} -\twocolitem{{\bf EVT\_COMMAND\_BOTTOM(id, func)}}{Catch a command to put the scroll thumb at the maximum position.} -\twocolitem{{\bf EVT\_COMMAND\_LINEUP(id, func)}}{Catch a line up command.} -\twocolitem{{\bf EVT\_COMMAND\_LINEDOWN(id, func)}}{Catch a line down command.} -\twocolitem{{\bf EVT\_COMMAND\_PAGEUP(id, func)}}{Catch a page up command.} -\twocolitem{{\bf EVT\_COMMAND\_PAGEDOWN(id, func)}}{Catch a page down command.} -\twocolitem{{\bf EVT\_COMMAND\_THUMBTRACK(id, func)}}{Catch a thumbtrack command (continuous movement of the scroll thumb).} +\twocolitem{{\bf EVT\_SPIN(id, func)}}{Generated whenever an arros is pressed.} +\twocolitem{{\bf EVT\_SPIN\_UP(id, func)}}{Generated when left/up arrow is pressed.} +\twocolitem{{\bf EVT\_SPIN\_DOWN(id, func)}}{Generated when right/down arrow is pressed.} \end{twocollist}% \wxheading{See also} @@ -106,7 +105,7 @@ See \helpref{wxSpinButton::wxSpinButton}{wxspinbuttonconstr} for details. \constfunc{int}{GetMax}{\void} -Returns the maximum permissable value. +Returns the maximum permissible value. \wxheading{See also} @@ -116,7 +115,7 @@ Returns the maximum permissable value. \constfunc{int}{GetMin}{\void} -Returns the minimum permissable value. +Returns the minimum permissible value. \wxheading{See also} diff --git a/docs/latex/wx/spinctrl.tex b/docs/latex/wx/spinctrl.tex index 44570693f6..4cf5aaa00a 100644 --- a/docs/latex/wx/spinctrl.tex +++ b/docs/latex/wx/spinctrl.tex @@ -30,7 +30,7 @@ wxSpinCtrl combines \helpref{wxTextCtrl}{wxtextctrl} and \wxheading{Event handling} To process input from a spin button, use one of these event handler macros to direct input to member -functions that take a \helpref{wxScrollEvent}{wxscrollevent} argument: +functions that take a \helpref{wxSpinEvent}{wxspinevent} argument: \twocolwidtha{7cm} \begin{twocollist}\itemsep=0pt diff --git a/docs/latex/wx/spinevt.tex b/docs/latex/wx/spinevt.tex new file mode 100644 index 0000000000..6b063c96fb --- /dev/null +++ b/docs/latex/wx/spinevt.tex @@ -0,0 +1,51 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: spinevt.tex +%% Purpose: wxSpinEvent documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 29.03.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxSpinEvent}}\label{wxspinevent} + +This event class is used for the events generated by +\helpref{wxSpinButton}{wxspinbutton} and \helpref{wxSpinCtrl}{wxspinctrl}. + +\wxheading{Derived from} + +\helpref{wxNotifyEvent}{wxnotifyevent}\\ +\helpref{wxCommandEvent}{wxcommandevent}\\ +\helpref{wxEvent}{wxevent}\\ +\helpref{wxObject}{wxobject} + +\wxheading{Include files} + +<wx/spinbutt.h> or <wx/spinctrl.h> + +\wxheading{See also} + +\helpref{wxSpinButton}{wxspinbutton} and \helpref{wxSpinCtrl}{wxspinctrl} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxSpinEvent::wxSpinEvent}\label{wxspineventctor} + +\func{}{wxSpinEvent}{\param{wxEventType }{commandType = wxEVT\_NULL}, \param{int }{id = 0}} + +The constructor is not normally used by the user code. + +\membersection{wxSpinEvent::GetPosition}\label{wxspineventgetposition} + +\constfunc{int}{GetPosition}{\void} + +Retrieve the current spin button or control value. + +\membersection{wxSpinEvent::SetPosition}\label{wxspineventsetposition} + +\func{void}{SetPosition}{\param{int }{pos}} + +Set the value associated with the event. + diff --git a/docs/latex/wx/splitevt.tex b/docs/latex/wx/splitevt.tex index c2af34411c..759204f531 100644 --- a/docs/latex/wx/splitevt.tex +++ b/docs/latex/wx/splitevt.tex @@ -114,7 +114,7 @@ May only be called while processing wxEVT\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGING and wxEVT\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGED events. -\wxheading{Paramters} +\wxheading{Parameters} \docparam{pos}{New sash position.} diff --git a/docs/latex/wx/splitter.tex b/docs/latex/wx/splitter.tex index 879dc12714..bd311fcabc 100644 --- a/docs/latex/wx/splitter.tex +++ b/docs/latex/wx/splitter.tex @@ -13,7 +13,10 @@ This is also recommended for GTK. \begin{twocollist}\itemsep=0pt \twocolitem{\windowstyle{wxSP\_3D}}{Draws a 3D effect border and sash.} -\twocolitem{\windowstyle{wxSP\_BORDER}}{Draws a thin black border around the window, and a black sash.} +\twocolitem{\windowstyle{wxSP\_3DSASH}}{Draws a 3D effect sash.} +\twocolitem{\windowstyle{wxSP\_3DBORDER}}{Draws a 3D effect border.} +\twocolitem{\windowstyle{wxSP\_FULLSASH}}{Draws the ends of the sash (so the window can be used without a border).} +\twocolitem{\windowstyle{wxSP\_BORDER}}{Draws a thin black border around the window.} \twocolitem{\windowstyle{wxSP\_NOBORDER}}{No border, and a black sash.} \twocolitem{\windowstyle{wxSP\_PERMIT\_UNSPLIT}}{Always allow to unsplit, even with the minimum pane size other than zero.} @@ -252,7 +255,7 @@ and then resplitting the window back because it will provoke much less flicker (if any). It is valid to call this function whether the splitter has two windows or only one. -Both parameters should be non NULL and {\it winOld} must specify one of the +Both parameters should be non-NULL and {\it winOld} must specify one of the windows managed by the splitter. If the parameters are incorrect or the window couldn't be replaced, FALSE is returned. Otherwise the function will return TRUE, but please notice that it will not delete the replaced window and you @@ -343,7 +346,7 @@ Initializes the top and bottom panes of the splitter window. \docparam{window2}{The bottom pane.} \docparam{sashPosition}{The initial position of the sash. If this value is -positive, it specifies the size of the upper pane. If it's negative, it's +positive, it specifies the size of the upper pane. If it is negative, it is absolute value gives the size of the lower pane. Finally, specify 0 (default) to choose the default position (half of the total window height).} @@ -376,7 +379,7 @@ Initializes the left and right panes of the splitter window. \docparam{window2}{The right pane.} \docparam{sashPosition}{The initial position of the sash. If this value is -positive, it specifies the size of the left pane. If it's negative, it's +positive, it specifies the size of the left pane. If it is negative, it is absolute value gives the size of the right pane. Finally, specify 0 (default) to choose the default position (half of the total window width).} diff --git a/docs/latex/wx/stattext.tex b/docs/latex/wx/stattext.tex index 2802fe6ff8..433a509909 100644 --- a/docs/latex/wx/stattext.tex +++ b/docs/latex/wx/stattext.tex @@ -43,7 +43,7 @@ See also \helpref{window styles overview}{windowstyles}. Default constructor. \func{}{wxStaticText}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp -\param{const wxString\& }{label = ``"}, \param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp +\param{const wxString\& }{label}, \param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp \param{long}{ style = 0}, \param{const wxString\& }{name = ``staticText"}} Constructor, creating and showing a text control. @@ -71,7 +71,7 @@ Constructor, creating and showing a text control. \membersection{wxStaticText::Create}\label{wxstatictextcreate} \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp -\param{const wxString\& }{label = ``"}, \param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp +\param{const wxString\& }{label}, \param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp \param{long}{ style = 0}, \param{const wxString\& }{name = ``staticText"}} Creation function, for two-step construction. For details see \helpref{wxStaticText::wxStaticText}{wxstatictextconstr}. diff --git a/docs/latex/wx/statusbr.tex b/docs/latex/wx/statusbr.tex index 9f134c6ac7..172178f3a0 100644 --- a/docs/latex/wx/statusbr.tex +++ b/docs/latex/wx/statusbr.tex @@ -204,6 +204,9 @@ and refreshes the window. Sets the number of fields, and optionally the field widths. +\pythonnote{Only the first parameter is accepted. Use SetStatusWidths +to set the widths of the fields.} + \wxheading{Parameters} \docparam{number}{The number of fields.} diff --git a/docs/latex/wx/stopwtch.tex b/docs/latex/wx/stopwtch.tex index 98b60ed19f..cff119d2ca 100644 --- a/docs/latex/wx/stopwtch.tex +++ b/docs/latex/wx/stopwtch.tex @@ -1,6 +1,6 @@ \section{\class{wxStopWatch}}\label{wxstopwatch} -The wxStopWatch class allow you to measure time intervalls. +The wxStopWatch class allow you to measure time intervals. \wxheading{Include files} diff --git a/docs/latex/wx/stream.tex b/docs/latex/wx/stream.tex index 397098dd8c..a9f7c711c0 100644 --- a/docs/latex/wx/stream.tex +++ b/docs/latex/wx/stream.tex @@ -90,7 +90,7 @@ accordingly until all requested data is read. \wxheading{Return value} It returns the size of the data read. If the returned size is different of the specified -{\it size}, an error has occured and should be tested using +{\it size}, an error has occurred and should be tested using \helpref{LastError}{wxstreambaselasterror}. \func{size\_t}{Read}{\param{wxStreamBuffer *}{buffer}} @@ -121,7 +121,7 @@ Gets a single char from the stream buffer. It acts like the Read call. \wxheading{Problem} -You aren't directly notified if an error occured during the IO call. +You aren't directly notified if an error occurred during the IO call. \wxheading{See also} @@ -135,7 +135,7 @@ Puts a single char to the stream buffer. \wxheading{Problem} -You aren't directly notified if an error occured during the IO call. +You aren't directly notified if an error occurred during the IO call. \wxheading{See also} @@ -195,7 +195,7 @@ you create an empty stream buffer (See \helpref{wxStreamBuffer::wxStreamBuffer}{ \wxheading{Remarks} -When you use this function, you'll have to destroy the IO buffers yourself +When you use this function, you will have to destroy the IO buffers yourself after the stream buffer is destroyed or don't use it anymore. In the case you use it with an empty buffer, the stream buffer will not resize it when it is full. diff --git a/docs/latex/wx/strmbase.tex b/docs/latex/wx/strmbase.tex index 0a6a5a38ef..243e5a48ef 100644 --- a/docs/latex/wx/strmbase.tex +++ b/docs/latex/wx/strmbase.tex @@ -43,7 +43,7 @@ Destructor. \constfunc{wxStreamError}{IsOk}{\void} -Returns TRUE if no error occured on the stream. +Returns TRUE if no error occurred on the stream. \wxheading{See also} @@ -57,10 +57,10 @@ This function returns the last error. \twocolwidtha{5cm} \begin{twocollist}\itemsep=0pt -\twocolitem{{\bf wxSTREAM\_NO\_ERROR}}{No error occured.} -\twocolitem{{\bf wxSTREAM\_EOF}}{An End-Of-File occured.} -\twocolitem{{\bf wxSTREAM\_WRITE\_ERROR}}{A generic error occured on the last write call.} -\twocolitem{{\bf wxSTREAM\_READ\_ERROR}}{A generic error occured on the last read call.} +\twocolitem{{\bf wxSTREAM\_NO\_ERROR}}{No error occurred.} +\twocolitem{{\bf wxSTREAM\_EOF}}{An End-Of-File occurred.} +\twocolitem{{\bf wxSTREAM\_WRITE\_ERROR}}{A generic error occurred on the last write call.} +\twocolitem{{\bf wxSTREAM\_READ\_ERROR}}{A generic error occurred on the last read call.} \end{twocollist} \membersection{wxStreamBase::OnSysRead}\label{wxstreambaseonsysread} diff --git a/docs/latex/wx/strmsock.tex b/docs/latex/wx/strmsock.tex index 95aefe0e9c..d7179d0cbb 100644 --- a/docs/latex/wx/strmsock.tex +++ b/docs/latex/wx/strmsock.tex @@ -6,7 +6,7 @@ %% Created: 1999 %% RCS-ID: $Id$ %% Copyright: (c) wxWindows team -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ----------------------------------------------------------------------------- diff --git a/docs/latex/wx/table.tex b/docs/latex/wx/table.tex new file mode 100644 index 0000000000..458bb44f7f --- /dev/null +++ b/docs/latex/wx/table.tex @@ -0,0 +1,27 @@ +\section{\class{wxTable}}\label{wxtable} + +A wxTable instance provides access to rows of data in +a table contained within the associated ODBC data source + +\wxheading{Include files} + +<wx/version.h> +<wx/dbtable.h> +<wx/db.h> + +\wxheading{Data structures} + +\wxheading{Remarks} + +\wxheading{See also} + +\helpref{wxTable}{wxtable} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxTable::wxTable}\label{wxtableconstr} + +\func{}{wxTable}{\void} + +Default constructor. + diff --git a/docs/latex/wx/tbitmap.tex b/docs/latex/wx/tbitmap.tex index 856b8df220..8b45fe1478 100644 --- a/docs/latex/wx/tbitmap.tex +++ b/docs/latex/wx/tbitmap.tex @@ -80,7 +80,7 @@ it to wxBitmap form. Note that using wxImage is the preferred way to load images in wxWindows, with the exception of resources (XPM-files or native Windows resources). Writing an image format handler for wxImage is also far easier than writing one for wxBitmap, because wxImage has -exactly one format on all platforms wheras wxBitmap can store pixel data +exactly one format on all platforms whereas wxBitmap can store pixel data very differently, depending on colour depths and platform. \wxheading{wxBitmap} diff --git a/docs/latex/wx/tclipbrd.tex b/docs/latex/wx/tclipbrd.tex index 545c46195b..ae3f102ab3 100644 --- a/docs/latex/wx/tclipbrd.tex +++ b/docs/latex/wx/tclipbrd.tex @@ -35,7 +35,7 @@ should do. The data provider is responsible for creating a \helpref{wxDataObject}{wxdataobject} containing the data to be -transfered. Then it should either pass it to the clipboard using +transferred. Then it should either pass it to the clipboard using \helpref{SetData}{wxclipboardsetdata} function or to \helpref{wxDropSource}{wxdropsource} and call \helpref{DoDragDrop}{wxdropsourcedodragdrop} function. @@ -62,7 +62,7 @@ create a \helpref{wxDataObject}{wxdataobject} derived class which supports the data formats you need and pass it as argument to \helpref{wxClipboard::GetData}{wxclipboardgetdata}. If it returns {\tt FALSE}, no data in (any of) the supported format(s) is available. If it returns {\tt -TRUE}, the data has been successfully transfered to wxDataObject. +TRUE}, the data has been successfully transferred to wxDataObject. For drag and drop case, the \helpref{wxDropTarget::OnData}{wxdroptargetondata} virtual function will be called when a data object is dropped, from which the diff --git a/docs/latex/wx/tconfig.tex b/docs/latex/wx/tconfig.tex index 0002c0c33d..cff0337218 100644 --- a/docs/latex/wx/tconfig.tex +++ b/docs/latex/wx/tconfig.tex @@ -13,7 +13,7 @@ information. They were especially designed for this usage and, although may probably be used for many other things as well, should be limited to it. It means that this information should be: -\begin{enumerate} +\begin{enumerate}\itemsep=0pt \item Typed, i.e. strings or numbers for the moment. You can not store binary data, for example. \item Small. For instance, it is not recommended to use the Windows @@ -23,7 +23,7 @@ consumption point of view. \end{enumerate} On the other hand, the features provided make them very useful for storing all -kinds of small to medium volumes of hierarchically-organized, heterogenous +kinds of small to medium volumes of hierarchically-organized, heterogeneous data. In short, this is a place where you can conveniently stuff all your data (numbers and strings) organizing it in a tree where you use the filesystem-like paths to specify the location of a piece of data. In diff --git a/docs/latex/wx/tconstr.tex b/docs/latex/wx/tconstr.tex index 4d14c3dff0..35cf9baeb4 100644 --- a/docs/latex/wx/tconstr.tex +++ b/docs/latex/wx/tconstr.tex @@ -69,13 +69,13 @@ When the user sets constraints, many of the constraints for windows edges and dimensions remain unconstrained. For a given window, the wxWindow::Layout algorithm first resets all constraints in all children to have unknown edge or dimension values, and then iterates through the constraints, -evaulating them. For unconstrained edges and dimensions, it +evaluating them. For unconstrained edges and dimensions, it tries to find the value using known relationships that always hold. For example, an unconstrained {\it width} may be calculated from the {\it left} and {\it right edges}, if both are currently known. For edges and dimensions with user-supplied constraints, these -constraints are evaulated if the inputs of the constraint are known. +constraints are evaluated if the inputs of the constraint are known. -The algorithm stops when all child edges and dimension are known (success), or there +The algorithm stops when all child edges and dimension are known (success), or there are unknown edges or dimensions but there has been no change in this cycle (failure). It then sets all the window positions and sizes according to the values it has found. @@ -85,7 +85,7 @@ irrelevant, however you may reduce the number of iterations (and thus speed up the layout calculations) by creating the controls in such order that as many constraints as possible can be calculated during the first iteration. For example, if you have 2 buttons which you'd like to position in the lower right corner, it is -slighty more efficient to first create the second button and specify that its +slightly more efficient to first create the second button and specify that its right border IsSameAs(parent, wxRight) and then create the first one by specifying that it should be LeftOf() the second one than to do in a more natural left-to-right order. diff --git a/docs/latex/wx/tcpclint.tex b/docs/latex/wx/tcpclint.tex index 40ae1dc631..2d080a31d4 100644 --- a/docs/latex/wx/tcpclint.tex +++ b/docs/latex/wx/tcpclint.tex @@ -9,7 +9,7 @@ To create a client which can communicate with a suitable server, you need to derive a class from wxTCPConnection and another from wxTCPClient. The custom wxTCPConnection class will intercept communications in a `conversation' with a server, and the custom wxTCPServer is required -so that a user-overriden \helpref{wxTCPClient::OnMakeConnection}{wxtcpclientonmakeconnection} member can return +so that a user-overridden \helpref{wxTCPClient::OnMakeConnection}{wxtcpclientonmakeconnection} member can return a wxTCPConnection of the required class, when a connection is made. \wxheading{Derived from} diff --git a/docs/latex/wx/tdate.tex b/docs/latex/wx/tdate.tex index fa232d914d..9dfef5b2b7 100644 --- a/docs/latex/wx/tdate.tex +++ b/docs/latex/wx/tdate.tex @@ -6,12 +6,12 @@ %% Created: 07.03.00 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Date and time classes overview}\label{wxdatetimeoverview} -Classes: \helpref{wxDateTime}{wxdatetime}, \helpref{wxDateSpan}{wxdatespan}, \helpref{wxTimeSpan}, \helpref{wxtimespan}, \helpref{wxCalendarCtrl}{wxcalendarctrl} +Classes: \helpref{wxDateTime}{wxdatetime}, \helpref{wxDateSpan}{wxdatespan}, \helpref{wxTimeSpan}{wxtimespan}, \helpref{wxCalendarCtrl}{wxcalendarctrl} \subsection{Introduction} @@ -20,15 +20,15 @@ of the supported features of \helpref{wxDateTime}{wxdatetime} class are: \twocolwidtha{7cm} \begin{twocollist}\itemsep=0pt -\item{Wide range}{The range of supported dates goes from about 4714 B.C. to +\twocolitem{Wide range}{The range of supported dates goes from about 4714 B.C. to some 480 million years in the future.} -\item{Precision}{Not using floating point calculations anywhere ensures that +\twocolitem{Precision}{Not using floating point calculations anywhere ensures that the date calculations don't suffer from rounding errors.} -\item{Many features}{Not only all usual calculations with dates are supported, +\twocolitem{Many features}{Not only all usual calculations with dates are supported, but also more exotic week and year day calculations, work day testing, standard astronomical functions, conversion to and from strings in either strict or free format.} -\item{Efficiency}{Objects of wxDateTime are small (8 bytes) and working with +\twocolitem{Efficiency}{Objects of wxDateTime are small (8 bytes) and working with them is fast} \end{twocollist} @@ -44,7 +44,8 @@ There are also helper classes which are used together with wxDateTime: \helpref{wxDateTimeHolidayAuthority}{wxdatetimeholidayauthority} which is used to determine whether a given date is a holiday or not and \helpref{wxDateTimeWorkDays}{wxdatetimeworkdays} which is a derivation of this -class for which (only) Saturdays and Sundays are the holidays. +class for which (only) Saturdays and Sundays are the holidays. See more about +these classes in the discussion of the \helpref{holidays}{tdateholidays}. Finally, in other parts of this manual you may find mentions of wxDate and wxTime classes. \helpref{These classes}{tdatecompatibility} are obsolete and @@ -110,7 +111,7 @@ also more efficient). However, wxDateSpan may be very useful in situations when you do need to understand what does `in a month' mean (of course, it is just {\tt wxDateTime::Now() + wxDateSpan::Month()}). -\subsection{Date arithmetics} +\subsection{Date arithmetics}\label{tdatearithm} Many different operations may be performed with the dates, however not all of them make sense. For example, multiplying date by a number is an invalid @@ -119,7 +120,7 @@ perfectly valid. Here is what can be done: -\begin{twocollist} +\begin{twocollist}\itemsep=0pt \item{{\bf Addition}}{a wxTimeSpan or wxDateSpan can be added to wxDateTime resulting in a new wxDateTime object and also 2 objects of the same span class can be added together giving another object of the smae class.} @@ -174,9 +175,9 @@ simply print time in any time zone. To see how to do it, the last issue to address is how to construct a TimeZone object which must be passed to all these methods. First of all, you may construct it manually by specifying the time zone offset in seconds from GMT, but -usually you will just use one of the \helpref{symbolic time zone -names}{wxdatetimetimezones} and let the conversion constructor do the job. -I.e.. you would just write +usually you will just use one of the \helpref{symbolic time zone names}{wxdatetime} and +let the conversion constructor do the job. +I.e. you would just write \begin{verbatim} wxDateTime dt(...whatever...); @@ -184,7 +185,7 @@ printf("The time is %s in local time zone", dt.FormatTime().c_str()); printf("The time is %s in GMT", dt.FormatTime(wxDateTime::GMT).c_str()); \end{verbatim} -\subsection{Daylight saving time (DST)} +\subsection{Daylight saving time (DST)}\label{tdatedst} DST (a.k.a. `summer time') handling is always a delicate task which is better left to the operating system which is supposed to be configured by the @@ -204,9 +205,14 @@ too, so they are subject to the same limitations. % is this really needed? \subsection{Conversion to/from text} +\subsection{wxDateTime and Holidays}\label{tdateholidays} + +TODO. + \subsection{Compatibility}\label{tdatecompatibility} The old classes for date/time manipulations ported from wxWindows version 1.xx are still included but are reimplemented in terms of wxDateTime. However, using them is strongly discouraged because they have a few quirks/bugs and were not `Y2K' compatible. + diff --git a/docs/latex/wx/tdb.tex b/docs/latex/wx/tdb.tex index 33a52a9b6f..1d2dae0ef2 100644 --- a/docs/latex/wx/tdb.tex +++ b/docs/latex/wx/tdb.tex @@ -17,7 +17,7 @@ file via an ODBC driver. The language for most of the database operations is SQL, so you need to learn a small amount of SQL as well as the wxWindows ODBC wrapper API. Even though the databases may not be SQL-based, the ODBC drivers translate SQL into appropriate operations -for the database or file: even text files have rudimentry ODBC support, +for the database or file: even text files have rudimentary ODBC support, along with dBASE, Access, Excel and other file formats. The run-time files for ODBC are bundled with many existing database diff --git a/docs/latex/wx/tdelwin.tex b/docs/latex/wx/tdelwin.tex index f9df4e54f0..7d7b02a1b1 100644 --- a/docs/latex/wx/tdelwin.tex +++ b/docs/latex/wx/tdelwin.tex @@ -17,7 +17,7 @@ decide whether or not to destroy the window. If the application is for some reason forcing the application to close (\helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto} returns FALSE), the window should always be destroyed, otherwise there is the option to ignore the request, or maybe wait until the user has answered a question -before deciding whether it's safe to close. The handler for EVT\_CLOSE should +before deciding whether it is safe to close. The handler for EVT\_CLOSE should signal to the calling code if it does not destroy the window, by calling \helpref{wxCloseEvent::Veto}{wxcloseeventveto}. Calling this provides useful information to the calling code. @@ -70,7 +70,7 @@ the exit command altogether. \wxheading{What should I do to upgrade my 1.xx OnClose to 2.0?} -In wxWindows 1.xx, the {\bf OnClose} function did not actually delete 'this', but signalled +In wxWindows 1.xx, the {\bf OnClose} function did not actually delete 'this', but signaled to the calling function (either {\bf Close}, or the wxWindows framework) to delete or not delete the window. diff --git a/docs/latex/wx/tdnd.tex b/docs/latex/wx/tdnd.tex index 0e1837d51b..3f57d7ab24 100644 --- a/docs/latex/wx/tdnd.tex +++ b/docs/latex/wx/tdnd.tex @@ -1,4 +1,4 @@ -\section{Drag'n'Drop overview}\label{wxdndoverview} +\section{Drag and drop overview}\label{wxdndoverview} Classes: \helpref{wxDataObject}{wxdataobject}, \helpref{wxTextDataObject}{wxtextdataobject}, @@ -8,12 +8,12 @@ Classes: \helpref{wxDataObject}{wxdataobject}, \helpref{wxFileDropTarget}{wxfiledroptarget} Note that wxUSE\_DRAG\_AND\_DROP must be defined in setup.h in order -to use Drag'n'Drop in wxWindows. +to use drag and drop in wxWindows. See also: \helpref{wxDataObject overview}{wxdataobjectoverview} and \helpref{DnD sample}{samplednd} It may be noted that data transfer to and from the clipboard is quite -similar to data transfer with Drag'n'Drop and the code to implement +similar to data transfer with drag and drop and the code to implement these two types is almost the same. In particular, both data transfer mechanisms store data in some kind of \helpref{wxDataObject}{wxdataobject} and identify its format(s) using the \helpref{wxDataFormat}{wxdataformat} diff --git a/docs/latex/wx/tdocview.tex b/docs/latex/wx/tdocview.tex index af54462093..0e569ca94c 100644 --- a/docs/latex/wx/tdocview.tex +++ b/docs/latex/wx/tdocview.tex @@ -116,7 +116,7 @@ and \helpref{wxDocManager}{wxdocmanager} classes. See the example application in {\tt samples/docview}. To use the abstract wxView class, you need to derive a new class and override -at least the member functions OnCreate, OnDraw, OnUpdate and OnClose. You'll probably +at least the member functions OnCreate, OnDraw, OnUpdate and OnClose. You will probably want to override OnMenuCommand to respond to menu commands from the frame containing the view. @@ -189,7 +189,7 @@ The wxDocManager class is part of the document/view framework supported by wxWin and cooperates with the \helpref{wxView}{wxview}, \helpref{wxDocument}{wxdocument}\rtfsp and \helpref{wxDocTemplate}{wxdoctemplate} classes. -A wxDocManager instance coordinates documents, views and document templates. It keeps a list of document and +A wxDocManager instance coordinates documents, views and document templates. It keeps a list of document and template instances, and much functionality is routed through this object, such as providing selection and file dialogs. The application can use this class `as is' or derive a class and override some members to extend or change the functionality. diff --git a/docs/latex/wx/tempfile.tex b/docs/latex/wx/tempfile.tex index bc21de6fcd..4fe80189c9 100644 --- a/docs/latex/wx/tempfile.tex +++ b/docs/latex/wx/tempfile.tex @@ -66,7 +66,7 @@ Associates wxTempFile with the file to be replaced and opens it. You should use \func{bool}{Open}{\param{const wxString\& }{strName}} Open the temporary file (strName is the name of file to be replaced), returns -TRUE on success, FALSE if an error occured. +TRUE on success, FALSE if an error occurred. \membersection{wxTempFile::IsOpened}\label{wxtempfileisopened} \constfunc{bool}{IsOpened}{\void} diff --git a/docs/latex/wx/tevent.tex b/docs/latex/wx/tevent.tex index e6b7cb9382..d322a350fb 100644 --- a/docs/latex/wx/tevent.tex +++ b/docs/latex/wx/tevent.tex @@ -136,7 +136,7 @@ recursively applied to the parent window's event handler. If this returns TRUE, confused by this powerful feature of the wxWindows event processing system. To put it a different way, events derived either directly or indirectly from wxCommandEvent will travel up the containment -heirarchy from child to parent until an event handler is found that +hierarchy from child to parent until an event handler is found that doesn't call event.Skip(). Events not derived from wxCommandEvent are sent only to the window they occurred in and then stop. @@ -238,7 +238,7 @@ in, such as a frame and its children. You may use the wxID\_OK identifier, for e any number of dialogs so long as you don't have several within the same dialog. If you pass -1 to a window constructor, an identifier will be generated for you, but beware: -if things don't respond in the way they should, it could be because of an id conflict. It's safer +if things don't respond in the way they should, it could be because of an id conflict. It is safer to supply window ids at all times. Automatic generation of identifiers starts at 1 so may well conflict with your own identifiers. @@ -328,7 +328,7 @@ called via \helpref{wxWindow::Close}{wxwindowclose}.} \twocolitem{\helpref{wxDropFilesEvent}{wxdropfilesevent}}{The EVT\_DROP\_FILES macros handles file drop events.} \twocolitem{\helpref{wxEraseEvent}{wxeraseevent}}{The EVT\_ERASE\_BACKGROUND macro is used to handle window erase requests.} -\twocolitem{\helpref{wxFocusEvent}{wxfocusevent}}{The EVT\_SET\_FOCUS and EVT\_KILL\_FOCUS macros are used to handle keybaord focus events.} +\twocolitem{\helpref{wxFocusEvent}{wxfocusevent}}{The EVT\_SET\_FOCUS and EVT\_KILL\_FOCUS macros are used to handle keyboard focus events.} \twocolitem{\helpref{wxKeyEvent}{wxkeyevent}}{EVT\_CHAR and EVT\_CHAR\_HOOK macros handle keyboard input for any window.} \twocolitem{\helpref{wxIdleEvent}{wxidleevent}}{The EVT\_IDLE macro handle application idle events @@ -341,7 +341,7 @@ to handle dialog initialisation.} mouse events or all mouse events.} \twocolitem{\helpref{wxMoveEvent}{wxmoveevent}}{The EVT\_MOVE macro is used to handle a window move.} \twocolitem{\helpref{wxPaintEvent}{wxpaintevent}}{The EVT\_PAINT macro is used to handle window paint requests.} -\twocolitem{\helpref{wxScrollEvent}{wxscrollevent}}{These macros are used to handle scroll events from +\twocolitem{\helpref{wxScrollEvent}{wxscrollevent}}{These macros are used to handle scroll events from \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxSlider}{wxslider},and \helpref{wxSpinButton}{wxspinbutton}.} \twocolitem{\helpref{wxSizeEvent}{wxsizeevent}}{The EVT\_SIZE macro is used to handle a window resize.} \twocolitem{\helpref{wxSplitterEvent}{wxsplitterevent}}{The EVT\_SPLITTER\_SASH\_POS\_CHANGED, EVT\_SPLITTER\_UNSPLIT diff --git a/docs/latex/wx/texpr.tex b/docs/latex/wx/texpr.tex index 70a01967b0..0f915a823f 100644 --- a/docs/latex/wx/texpr.tex +++ b/docs/latex/wx/texpr.tex @@ -140,7 +140,7 @@ way to the current compilation. These are the known bugs: \begin{enumerate}\itemsep=0pt -\item Functors are permissable only in the main clause (object). +\item Functors are permissible only in the main clause (object). Therefore nesting of structures must be done using lists, not predicates as in Prolog. \item There is a limit to the size of strings read in (about 5000 bytes). diff --git a/docs/latex/wx/text.tex b/docs/latex/wx/text.tex index ce3b6c77db..657aa9ec13 100644 --- a/docs/latex/wx/text.tex +++ b/docs/latex/wx/text.tex @@ -515,7 +515,7 @@ Selects the text starting at the first position up to (but not including) the ch \func{virtual void}{SetValue}{\param{const wxString\& }{ value}} -Sets the text value. +Sets the text value and marks the control as not-modified. \wxheading{Parameters} diff --git a/docs/latex/wx/textfile.tex b/docs/latex/wx/textfile.tex index fb612de7da..ff7ecc856f 100644 --- a/docs/latex/wx/textfile.tex +++ b/docs/latex/wx/textfile.tex @@ -17,10 +17,11 @@ which are well handled by wxTextFile. The typical things you may do with wxTextFile in order are: \begin{itemize}\itemsep=0pt -\item Create and open it: this is done with \helpref{Open}{wxtextfileopen} -function which opens the file (name may be specified either as Open argument or -in the constructor), reads its contents in memory and closes it. If all of these -operations are successful, Open() will return TRUE and FALSE on error. +\item Create and open it: this is done with either +\helpref{Create}{wxtextfilecreate} or \helpref{Open}{wxtextfileopen} +function which opens the file (name may be specified either as the argument to +these functions or in the constructor), reads its contents in memory (in the +case of {\tt Open()}) and closes it. \item Work with the lines in the file: this may be done either with "direct access" functions like \helpref{GetLineCount}{wxtextfilegetlinecount} and \helpref{GetLine}{wxtextfilegetline} ({\it operator[]} does exactly the same @@ -73,7 +74,8 @@ enum wxTextFileType \constfunc{}{wxTextFile}{\void} -Default constructor, use Open(string) to initialize the object. +Default constructor, use \helpref{Create}{wxtextfilecreate} or +\helpref{Open}{wxtextfileopen} with a file name parameter to initialize the object. \membersection{wxTextFile::wxTextFile}\label{wxtextfilector} @@ -81,26 +83,17 @@ Default constructor, use Open(string) to initialize the object. Constructor does not load the file into memory, use Open() to do it. -\membersection{wxTextFile::Exists}\label{wxtextfileexists} - -\constfunc{bool}{Exists}{\void} - -Return TRUE if file exists - the name of the file should have been specified -in the constructor before calling Exists(). - -\membersection{wxTextFile::Open}\label{wxtextfileopen} +\membersection{wxTextFile::\destruct{wxTextFile}}\label{wxtextfiledtor} -\constfunc{bool}{Open}{\void} +\constfunc{}{\destruct{wxTextFile}}{\void} -Open() opens the file with the name which was given in the \helpref{constructor}{wxtextfilector} -and also loads file in memory on success. +Destructor does nothing. -\membersection{wxTextFile::Open}\label{wxtextfileopenname} +\membersection{wxTextFile::AddLine}\label{wxtextfileaddline} -\constfunc{bool}{Open}{\param{const wxString\& }{strFile}} +\constfunc{void}{AddLine}{\param{const wxString\& }{str}, \param{wxTextFileType }{type = typeDefault}} -Same as \helpref{Open()}{wxtextfileopen} but allows to specify the file name -(must be used if the default constructor was used to create the object). +Adds a line to the end of file. \membersection{wxTextFile::Close}\label{wxtextfileclose} @@ -109,6 +102,26 @@ Same as \helpref{Open()}{wxtextfileopen} but allows to specify the file name Closes the file and frees memory, {\bf losing all changes}. Use \helpref{Write()}{wxtextfilewrite} if you want to save them. +\membersection{wxTextFile::Create}\label{wxtextfilecreate} + +\constfunc{bool}{Create}{\void} + +\constfunc{bool}{Create}{\param{const wxString\& }{strFile}} + +Creates the file with the given name or the name which was given in the +\helpref{constructor}{wxtextfilector}. The array of file lines is initially +empty. + +It will fail if the file already exists, \helpref{Open}{wxtextfileopen} should +be used in this case. + +\membersection{wxTextFile::Exists}\label{wxtextfileexists} + +\constfunc{bool}{Exists}{\void} + +Return TRUE if file exists - the name of the file should have been specified +in the constructor before calling Exists(). + \membersection{wxTextFile::IsOpened}\label{wxtextfileisopened} \constfunc{bool}{IsOpened}{\void} @@ -158,6 +171,15 @@ and used by \helpref{GetFirstLine()}{wxtextfilegetfirstline}/\helpref{GetNextLin Returns TRUE if the current line is the last one. +\membersection{wxTextFile::GetEOL}\label{wxtextfilegeteol} + +\constfunc{static const char*}{GetEOL}{\param{wxTextFileType }{type = typeDefault}} + +Get the line termination string corresponding to given constant. {\it typeDefault} is +the value defined during the compilation and corresponds to the native format of the +platform, i.e. it will be wxTextFileType\_Dos under Windows, wxTextFileType\_Unix under +Unix and wxTextFileType\_Mac under Mac. + \membersection{wxTextFile::GetFirstLine}\label{wxtextfilegetfirstline} \constfunc{wxString\&}{GetFirstLine}{\void} @@ -212,18 +234,23 @@ be returned. If the detection mechanism fails wxTextFileType\_None is returned. Get the name of the file. -\membersection{wxTextFile::AddLine}\label{wxtextfileaddline} - -\constfunc{void}{AddLine}{\param{const wxString\& }{str}, \param{wxTextFileType }{type = typeDefault}} - -Adds a line to the end of file. - \membersection{wxTextFile::InsertLine}\label{wxtextfileinsertline} \constfunc{void}{InsertLine}{\param{const wxString\& }{str}, \param{size\_t }{n}, \param{wxTextFileType }{type = typeDefault}} Insert a line before the line number {\it n}. +\membersection{wxTextFile::Open}\label{wxtextfileopen} + +\constfunc{bool}{Open}{\void} + +\constfunc{bool}{Open}{\param{const wxString\& }{strFile}} + +Open() opens the file with the given name or the name which was given in the +\helpref{constructor}{wxtextfilector} and also loads file in memory on +success. It will fail if the file does not exist, +\helpref{Create}{wxtextfilecreate} should be used in this case. + \membersection{wxTextFile::RemoveLine}\label{wxtextfileremoveline} \constfunc{void}{RemoveLine}{\param{size\_t }{n}} @@ -240,18 +267,3 @@ convert, for example, DOS files to Unix. Returns TRUE if operation succeeded, FALSE if it failed. -\membersection{wxTextFile::GetEOL}\label{wxtextfilegeteol} - -\constfunc{static const char*}{GetEOL}{\param{wxTextFileType }{type = typeDefault}} - -Get the line termination string corresponding to given constant. {\it typeDefault} is -the value defined during the compilation and corresponds to the native format of the -platform, i.e. it will be wxTextFileType\_Dos under Windows, wxTextFileType\_Unix under -Unix and wxTextFileType\_Mac under Mac. - -\membersection{wxTextFile::\destruct{wxTextFile}}\label{wxtextfiledtor} - -\constfunc{}{\destruct{wxTextFile}}{\void} - -Destructor does nothing. - diff --git a/docs/latex/wx/tfile.tex b/docs/latex/wx/tfile.tex index 9e03bfe5bd..0d1b508a88 100644 --- a/docs/latex/wx/tfile.tex +++ b/docs/latex/wx/tfile.tex @@ -10,11 +10,11 @@ As usual, the accent is put on cross-platform features which explains, for example, the \helpref{wxTextFile}{wxtextfile} class which may be used to convert between different types of text files (DOS/Unix/Mac). -wxFile may be used for low-level IO. It contains all usual functions to work -with files (opening/closing, reading/writing, seeking...) but, compared to -using standard C functions, brings error checking (in case of an error a message +wxFile may be used for low-level IO. It contains all the usual functions to work +with files (opening/closing, reading/writing, seeking, and so on) but compared with +using standard C functions, has error checking (in case of an error a message is logged using \helpref{wxLog}{wxlog} facilities) and closes the file -automatically in destructor which may be quite convenient. +automatically in the destructor which may be quite convenient. wxTempFile is a very small file designed to make replacing the files contents safer - see its \helpref{documentation}{wxtempfile} for more details. diff --git a/docs/latex/wx/tfontenc.tex b/docs/latex/wx/tfontenc.tex index f6e08d0bc2..2cbccfa31a 100644 --- a/docs/latex/wx/tfontenc.tex +++ b/docs/latex/wx/tfontenc.tex @@ -6,7 +6,7 @@ %% Created: 03.11.99 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Font encoding overview}\label{wxfontencodingoverview} @@ -16,7 +16,7 @@ By encoding we mean here the mapping between the character codes and the letters. Probably the most well-known encoding is (7 bit) ASCII one which is used almost universally now to represent the letters of the English alphabet and some other common characters. However, it is not enough to represent the -letters of foreign alphabetes and here other encodings come into play. Please +letters of foreign alphabets and here other encodings come into play. Please note that we will only discuss 8-bit fonts here and not \helpref{Unicode}{unicode}. @@ -38,27 +38,28 @@ wxFONTENCODING\_SYSTEM, but may be changed to make all the fonts created later to use it (by default).} \twocolitem{wxFONTENCODING\_ISO8859\_1..15}{ISO8859 family encodings which are usually used by all non-Microsoft operating systems} -\twocolitem{wxFONTENCODING\_KOI8}{Standard cyrillic encoding for the Internet +\twocolitem{wxFONTENCODING\_KOI8}{Standard Cyrillic encoding for the Internet (but see also wxFONTENCODING\_ISO8859\_5 and wxFONTENCODING\_CP1251)} \twocolitem{wxFONTENCODING\_CP1250}{Microsoft analogue of ISO8859-2} \twocolitem{wxFONTENCODING\_CP1251}{Microsoft analogue of ISO8859-5} \twocolitem{wxFONTENCODING\_CP1252}{Microsoft analogue of ISO8859-1} \end{twocollist} -As you may see, Microsofts encoding partly mirror the standard ISO8859 ones, +As you may see, Microsoft's encoding partly mirror the standard ISO8859 ones, but there are (minor) differences even between ISO8859-1 (Latin1, ISO encoding for Western Europe) and CP1251 (WinLatin1, standard code page for English versions of Windows) and there are more of them for other encodings. -The situation is particularly complicated with cyrillic encodings for which +The situation is particularly complicated with Cyrillic encodings for which (more than) three incompatible encodings exist: KOI8 (the old standard, widely -used on the Internet), ISO8859-5 (ISO standard for cyrillic) and CP1251 +used on the Internet), ISO8859-5 (ISO standard for Cyrillic) and CP1251 (WinCyrillic). -This abundance of (incompatible) encodigns should make it clear that using +This abundance of (incompatible) encoding:w +s should make it clear that using encodings is less easy than it might seem. The problems arise both from the -fact that the standard encodigns for the given language (say Russian, which is -written in cyrillic) are different on different platforms and because the +fact that the standard encodings for the given language (say Russian, which is +written in Cyrillic) are different on differe nt platforms and because the fonts in the given encoding might just not be installed (this is especially a problem with Unix, or, in general, not Win32, systems). diff --git a/docs/latex/wx/tguide.tex b/docs/latex/wx/tguide.tex index 2179ddeb56..50703ecff9 100644 --- a/docs/latex/wx/tguide.tex +++ b/docs/latex/wx/tguide.tex @@ -1,6 +1,6 @@ \section{Writing a wxWindows application: a rough guide}\label{roughguide} -To set a wxWindows application going, you'll need to derive a \helpref{wxApp}{wxapp} class and +To set a wxWindows application going, you will need to derive a \helpref{wxApp}{wxapp} class and override \helpref{wxApp::OnInit}{wxapponinit}. An application must have a top-level \helpref{wxFrame}{wxframe} or \helpref{wxDialog}{wxdialog} window. diff --git a/docs/latex/wx/thread.tex b/docs/latex/wx/thread.tex index e67f8a688a..e531599ce2 100644 --- a/docs/latex/wx/thread.tex +++ b/docs/latex/wx/thread.tex @@ -43,12 +43,19 @@ None. \membersection{wxThread::wxThread}\label{wxthreadctor} -\func{}{wxThread}{\void} +\func{}{wxThread}{\param{wxThreadKind }{kind = wxTHREAD\_DETACHED}} Constructor creates a new detached (default) or joinable C++ thread object. It does not create (or starts execution of) the real thread - for this you should use \helpref{Create}{wxthreadcreate} and \helpref{Run}{wxthreadrun} methods. +The possible values for {\it kind} parameters are: +\twocolwidtha{7cm} +\begin{twocollist}\itemsep=0pt +\twocolitem{{\bf wxTHREAD\_DETACHED}}{Create a detached thread.} +\twocolitem{{\bf wxTHREAD\_JOINABLE}}{Create a joinable thread} +\end{twocollist} + \membersection{wxThread::\destruct{wxThread}} \func{}{\destruct{wxThread}}{\void} @@ -326,8 +333,7 @@ See also \helpref{Sleep()}{wxthreadsleep}. \constfunc{ExitCode}{Wait}{\void} -Waits until the thread terminates and returns its exit code or {\tt -(ExitCode)-1} on error. +Waits until the thread terminates and returns its exit code or {\tt (ExitCode)-1} on error. You can only Wait() for joinable (not detached) threads. diff --git a/docs/latex/wx/ti18n.tex b/docs/latex/wx/ti18n.tex index 77641c7457..9cc3af337b 100644 --- a/docs/latex/wx/ti18n.tex +++ b/docs/latex/wx/ti18n.tex @@ -1,11 +1,11 @@ \section{Internationalization}\label{internationalization} -Although internationalization (i18n for short) of an application involves far -more than just translating its text messages to another message (date, time and +Although internationalization of an application (i18n for short) involves far +more than just translating its text messages to another message -- date, time and currency formats need changing too, some languages are written left to right and others right to left, character encoding may differ and many other things -may need changing too), it is a necessary first step. wxWindows provides -facilities for the messages translation with its +may need changing too -- it is a necessary first step. wxWindows provides +facilities for message translation with its \helpref{wxLocale}{wxlocale} class and is itself fully translated into several languages. Please consult wxWindows home page for the most up-to-date translations - and if you translate it into one of the languages not done @@ -24,7 +24,7 @@ to be buggy, so you should find a later version of it! There are two kinds of message catalogs: source catalogs which are text files with extension .po and binary catalogs which are created from the source ones -with {\it msgfmt} program (part fo gettext package) and have the extension .mo. +with {\it msgfmt} program (part of gettext package) and have the extension .mo. Only the binary files are needed during program execution. The program i18n involves several steps: diff --git a/docs/latex/wx/timer.tex b/docs/latex/wx/timer.tex index 00eba9a6ca..62ddfb3f1a 100644 --- a/docs/latex/wx/timer.tex +++ b/docs/latex/wx/timer.tex @@ -34,7 +34,7 @@ be stopped later with \helpref{Stop}{wxtimerstop}. \latexignore{\rtfignore{\wxheading{Members}}} -\membersection{wxTimer::wxTimer}\label{wxtimerctordef} +\membersection{wxTimer::wxTimer}\label{wxtimerwxtimer} \func{}{wxTimer}{\void} @@ -42,8 +42,6 @@ Default constructor. If you use it to construct the object and don't call \helpref{SetOwner}{wxtimersetowner} later, you must override \helpref{Notify}{wxtimernotify} method to process the notifications. -\membersection{wxTimer::wxTimer}\label{wxtimerwxtimer} - \func{}{wxTimer}{\param{wxEvtHandler *}{owner}, \param{int }{id = -1}} Creates a timer and associates it with {\it owner}. Please see diff --git a/docs/latex/wx/timespan.tex b/docs/latex/wx/timespan.tex new file mode 100644 index 0000000000..b5909c76b6 --- /dev/null +++ b/docs/latex/wx/timespan.tex @@ -0,0 +1,15 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: datespan.tex +%% Purpose: wxDateSpan documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 04.04.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxTimeSpan}}\label{wxtimespan} + +TODO + diff --git a/docs/latex/wx/tipc.tex b/docs/latex/wx/tipc.tex index 5eb9e7d2ed..9ae5159e15 100644 --- a/docs/latex/wx/tipc.tex +++ b/docs/latex/wx/tipc.tex @@ -51,7 +51,7 @@ identify the server and a topic name to identify the topic for the duration of the connection. Under Unix, the service name must contain an integer port identifier. -The server then responds and either vetos the connection or allows it. +The server then responds and either vetoes the connection or allows it. If allowed, a connection object is created which persists until the connection is closed. The connection object is then used for subsequent messages between client and server. @@ -132,7 +132,7 @@ To create a client which can communicate with a suitable server, you need to derive a class from wxDDEConnection and another from wxDDEClient. The custom wxDDEConnection class will intercept communications in a `conversation' with a server, and the custom wxDDEServer is required -so that a user-overriden \helpref{wxDDEClient::OnMakeConnection}{wxddeclientonmakeconnection} member can return +so that a user-overridden \helpref{wxDDEClient::OnMakeConnection}{wxddeclientonmakeconnection} member can return a wxDDEConnection of the required class, when a connection is made. For example: diff --git a/docs/latex/wx/tlog.tex b/docs/latex/wx/tlog.tex index f123323aa0..22c9b78ceb 100644 --- a/docs/latex/wx/tlog.tex +++ b/docs/latex/wx/tlog.tex @@ -29,7 +29,7 @@ appear in a message box by default (but it can be changed, see below). Notice that the standard behaviour is to not show informational messages if there are any errors later - the logic being that the later error messages make the informational messages preceding them meaningless. -\item{\bf wxLogVerbose} is for verbose output. Normally, it's suppressed, but +\item{\bf wxLogVerbose} is for verbose output. Normally, it is suppressed, but might be activated if the user wishes to know more details about the program progress (another, but possibly confusing name for the same function is {\bf wxLogInfo}). @@ -39,7 +39,7 @@ bar of the active or specified (as the first argument) \helpref{wxFrame}{wxframe handy for logging errors after system call (API function) failure. It logs the specified message text as well as the last system error code ({\it errno} or {\it ::GetLastError()} depending on the platform) and the corresponding error -message. The second form of this function takes the error code explitly as the +message. The second form of this function takes the error code explicitly as the first argument. \item{\bf wxLogDebug} is {\bf the} right function for debug output. It only does anything at all in the debug mode (when the preprocessor symbol @@ -62,7 +62,7 @@ generic mechanisms, but are not really adapted for wxWindows, while the log classes are. Some of advantages in using wxWindows log functions are: \begin{itemize}\itemsep=0pt -\item{\bf Portability} It's a common practice to use {\it printf()} statements or +\item{\bf Portability} It is a common practice to use {\it printf()} statements or cout/cerr C++ streams for writing out some (debug or otherwise) information. Although it works just fine under Unix, these messages go strictly nowhere under Windows where the stdout of GUI programs is not assigned to anything. @@ -72,7 +72,7 @@ printf()}. Moreover {\it wxMSW} doesn't have a {\bf console} as you may have with {\it wxGTK}. Under {\it wxMSW}, a call using {\it cout} just goes nowhere. To cope with this problem, {\it wxWindows} provides a way to redirect {\it cout} -calls to \helpref{wxTreeCtrl}{wxtreectrl}, {\it i.e.}: +calls to \helpref{wxTextCtrl}{wxtextctrl}, {\it i.e.}: {\small \begin{verbatim} wxLogWindow *logger=new wxLogWindow(your_frame,"Logger"); @@ -109,7 +109,7 @@ After having enumerated all the functions which are normally used to log the messages, and why would you want to use them we now describe how all this works. -wxWindows has the notion of a {\it log target}: it's just a class deriving +wxWindows has the notion of a {\it log target}: it is just a class deriving from \helpref{wxLog}{wxlog}. As such, it implements the virtual functions of the base class which are called when a message is logged. Only one log target is {\it active} at any moment, this is the one used by {\it wxLogXXX()} @@ -136,7 +136,7 @@ stderr by default as its name suggests. \item{\bf wxLogStream} This class has the same functionality as wxLogStderr, but uses {\it ostream} and cerr instead of {\it FILE *} and stderr. \item{\bf wxLogGui} This is the standard log target for wxWindows -applications (it's used by default if you don't do anything) and provides the +applications (it is used by default if you don't do anything) and provides the most reasonable handling of all types of messages for given platform. \item{\bf wxLogWindow} This log target provides a "log console" which collects all messages generated by the application and also passes them to the @@ -146,7 +146,7 @@ clear the log, close it completely or save all messages to file. anything. The objects of this class may be instantiated to (temporarily) suppress output of {\it wxLogXXX()} functions. As an example, trying to open a non-existing file will usually provoke an error message, but if for some -reasons it's unwanted, just use this construction: +reasons it is unwanted, just use this construction: {\small \begin{verbatim} diff --git a/docs/latex/wx/tmbconv.tex b/docs/latex/wx/tmbconv.tex new file mode 100644 index 0000000000..4401bfa99b --- /dev/null +++ b/docs/latex/wx/tmbconv.tex @@ -0,0 +1,177 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: tmbconv.tex +%% Purpose: Overview of the wxMBConv classes in wxWindows +%% Author: Ove Kaaven +%% Modified by: +%% Created: 25.03.00 +%% RCS-ID: $Id$ +%% Copyright: (c) 2000 Ove Kaaven +%% Licence: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{wxMBConv classes overview}\label{mbconvclasses} + +Classes: \helpref{wxMBConv}{wxmbconv}, \helpref{wxMBConvFile}{wxmbconvfile}, +\helpref{wxMBConvUTF7}{wxmbconvutf7}, \helpref{wxMBConvUTF8}{wxmbconvutf8}, +\helpref{wxCSConv}{wxcsconv} + +The wxMBConv classes in wxWindows enables an Unicode-aware application to +easily convert between Unicode and the variety of 8-bit encoding systems still +in use. + +\subsection{Background: The need for conversion} + +As programs are becoming more and more globalized, and users exchange documents +across country boundaries as never before, applications increasingly need to +take into account all the different character sets in use around the world. It +is no longer enough to just depend on the default byte-sized character set that +computers have traditionally used. + +A few years ago, a solution was proposed: the Unicode standard. Able to contain +the complete set of characters in use in one unified global coding system, +it would resolve the character set problems once and for all. + +But it hasn't happened yet, and the migration towards Unicode has created new +challenges, resulting in "compatibility encodings" such as UTF-8. A large +number of systems out there still depends on the old 8-bit encodings, hampered +by the huge amounts of legacy code still widely deployed. Even sending +Unicode data from one Unicode-aware system to another may need encoding to an +8-bit multibyte encoding (UTF-7 or UTF-8 is typically used for this purpose), to +pass unhindered through any traditional transport channels. + +\subsection{Background: The wxString class} + +If you have compiled wxWindows in Unicode mode, the wxChar type will become +identical to wchar\_t rather than char, and a wxString stores wxChars. Hence, +all wxString manipulation in your application will then operate on Unicode +strings, and almost as easily as working with ordinary char strings (you +just need to remember to use the wxT() macro to encapsulate any string +literals). + +But often, your environment doesn't want Unicode strings. You could be sending +data over a network, or processing a text file for some other application. You +need a way to quickly convert your easily-handled Unicode data to and from a +traditional 8-bit-encoding. And this is what the wxMBConv classes do. + +\subsection{wxMBConv classes} + +The base class for all these conversions is the wxMBConv class (which itself +implements standard libc locale conversion). Derived classes include +wxMBConvFile, wxMBConvUTF7, wxMBConvUTF8, and wxCSConv, which implement +different kinds of conversions. You can also derive your own class for your +own custom encoding and use it, should you need it. All you need to do is +override the MB2WC and WC2MB methods. + +\subsection{wxMBConv objects} + +In C++, for a class to be useful and possible to pass around, it needs to be +instantiated. All of the wxWindows-provided wxMBConv classes have predefined +instances (wxConvLibc, wxConvFile, wxConvUTF7, wxConvUTF8, wxConvLocal). +You can use these predefined objects directly, or you can instantiate your own +objects. + +A variable, wxConvCurrent, points to the conversion object that the user interface +is supposed to use, in the case that the user interface is not Unicode-based (like +with GTK+ 1.2). By default, it points to wxConvLibc or wxConvLocal, depending on +which works best on the current platform. + +\subsection{wxCSConv} + +The wxCSConv class is special because when it is instantiated, you can tell it +which character set it should use, which makes it meaningful to keep many +instances of them around, each with a different character set (or you can +create a wxCSConv instance on the fly). + +The predefined wxCSConv instance, wxConvLocal, is preset to use the +default user character set, but you should rarely need to use it directly, +it is better to go through wxConvCurrent. + +\subsection{Converting strings} + +Once you have chosen which object you want to use to convert your text, +here is how you would use them with wxString. These examples all assume +that you are using a Unicode build of wxWindows, although they will still +compile in a non-Unicode build (they just won't convert anything). + +Example 1: Constructing a wxString from input in current encoding. + +\begin{verbatim} +wxString str(input_data, *wxConvCurrent); +\end{verbatim} + +Example 2: Input in UTF-8 encoding. + +\begin{verbatim} +wxString str(input_data, wxConvUTF8); +\end{verbatim} + +Example 3: Input in KOI8-R. Construction of wxCSConv instance on the fly. + +\begin{verbatim} +wxString str(input_data, wxCSConv(wxT("koi8-r"))); +\end{verbatim} + +Example 4: Printing a wxString to stdout in UTF-8 encoding. + +\begin{verbatim} +puts(str.mb_str(wxConvUTF8)); +\end{verbatim} + +Example 5: Printing a wxString to stdout in custom encoding. +Using preconstructed wxCSConv instance. + +\begin{verbatim} +wxCSConv cust(user_encoding); +printf("Data: %s\n", (const char*) str.mb_str(cust)); +\end{verbatim} + +Note: Since mb_str() returns a temporary wxCharBuffer to hold the result +of the conversion, you need to explicitly cast it to const char* if you use +it in a vararg context (like with printf). + +\subsection{Converting buffers} + +If you have specialized needs, or just don't want to use wxString, you +can also use the conversion methods of the conversion objects directly. +This can even be useful if you need to do conversion in a non-Unicode +build of wxWindows; converting a string from UTF-8 to the current +encoding should be possible by doing this: + +\begin{verbatim} +wxString str(wxConvUTF8.cMB2WC(input_data), *wxConvCurrent); +\end{verbatim} + +Here, cMB2WC of the UTF8 object returns a wxWCharBuffer containing a Unicode +string. The wxString constructor then converts it back to an 8-bit character +set using the passed conversion object, *wxConvCurrent. (In a Unicode build +of wxWindows, the constructor ignores the passed conversion object and +retains the Unicode data.) + +This could also be done by first making a wxString of the original data: + +\begin{verbatim} +wxString input_str(input_data); +wxString str(input_str.wc_str(wxConvUTF8), *wxConvCurrent); +\end{verbatim} + +To print a wxChar buffer to a non-Unicode stdout: + +\begin{verbatim} +printf("Data: %s\n", (const char*) wxConvCurrent->cWX2MB(unicode_data)); +\end{verbatim} + +If you need to do more complex processing on the converted data, you +may want to store the temporary buffer in a local variable: + +\begin{verbatim} +const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(unicode_data); +const char *tmp_str = (const char*) tmp_buf; +printf("Data: %s\n", tmp_str); +process_data(tmp_str); +\end{verbatim} + +If a conversion had taken place in cWX2MB (i.e. in a Unicode build), +the buffer will be deallocated as soon as tmp_buf goes out of scope. +(The macro wxWX2MBbuf reflects the correct return value of cWX2MB +(either char* or wxCharBuffer), except for the const.) + diff --git a/docs/latex/wx/tnoneng.tex b/docs/latex/wx/tnoneng.tex index e937c42010..a002c8ca92 100644 --- a/docs/latex/wx/tnoneng.tex +++ b/docs/latex/wx/tnoneng.tex @@ -8,23 +8,23 @@ many characters it is impossible to use same texts under all platforms. wxWindows provide mechanism that helps you avoid distributing many identical, only differently encoded, packages with your application (e.g. help files and menu items in iso8859-13 and windows-1257). Thanks -to this mechanism you can distribute only let's say iso8859-13 data +to this mechanism you can, for example, distribute only iso8859-13 data and it will be handled transparently under all systems. Please read \helpref{Internationalization}{internationalization} which -describes locales concept. +describes the locales concept. -Whereever in the following text {\it iso8859-2} and {\it windows-1250} are +In the following text, wherever {\it iso8859-2} and {\it windows-1250} are used, any encodings are meant and any encodings may be substituted there. \wxheading{Locales} -The best way how to ensure correctly displayed texts in GUI across platforms +The best way to ensure correctly displayed texts in a GUI across platforms is to use locales. Write your in-code messages in English or without -diacritics and put real messages into message catalog (see +diacritics and put real messages into the message catalog (see \helpref{Internationalization}{internationalization}). -Standard .po file begins with a header like this: +A standard .po file begins with a header like this: \begin{verbatim} # SOME DESCRIPTIVE TITLE. @@ -51,11 +51,11 @@ Notice these two lines: "Content-Type: text/plain; charset=CHARSET\n" \end{verbatim} -The first tells {\it msgfmt} compiler not to include string "" (empty) -to compiled .mo catalog. Second one informs about charset used to write +The first tells the {\it msgfmt} compiler not to include "" (the empty string) +in compiled .mo catalog. The second one specifies the charset used to write translated messages. -You have to do 2 things: fill-in proper charset information and delete +You have to do two things: fill in proper charset information and delete the {\tt fuzzy} line. Your .po file may look like this after doing so: \begin{verbatim} @@ -76,24 +76,24 @@ msgstr "" \end{verbatim} wxWindows is able to use this catalog under any supported platform -(although iso8859-2 is Unix encoding and is not understood by Windows). +(although iso8859-2 is a Unix encoding and is not understood by Windows). -How is this done? When you tell wxLocale class to load message catalog that -contains the header (msgid "". Normal .mo catalogs do {\bf not} contain it, +How is this done? When you tell the wxLocale class to load a message catalog that +contains the header (msgid ""; normal .mo catalogs do {\bf not} contain it, you must remove the line with {\it fuzzy}!), it checks the charset. If the charset is "alien" on the platform the program is currently running (e.g. -any of ISO encodings under Windows or CP12XX under Unix) it uses +any of ISO encodings under Windows or CP12XX under Unix) it uses \helpref{wxEncodingConverter::GetPlatformEquivalents}{wxencodingconvertergetplatformequivalents} -to obtain encoding that is more common on this platform and converts +to obtain an encoding that is more common on this platform and converts the message catalog to this encoding. Note that it does {\bf not} check for presence of this encoding! It only assumes that it is always better to have strings in platform native encoding than in an encoding that is rarely (if ever) used. -The behaviour described about is disabled by default. +The behaviour described above is disabled by default. You must set {\it bConvertEncoding} to TRUE in \helpref{wxLocale constructor}{wxlocaledefctor} in order to enable -runtime encoding conversion! +runtime encoding conversion. \wxheading{Font mapping} @@ -122,26 +122,26 @@ if (!wxTheFontMapper->IsEncodingAvailable(enc, facename)) \wxheading{Converting data} You may want to store all program data (created documents etc.) in -same encoding, let's say windows1250. Obviously, the best way would +the same encoding, let's say windows1250. Obviously, the best way would be to use \helpref{wxEncodingConverter}{wxencodingconverter}. \wxheading{Help files} If you're using \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller} there is -no problem at all. You must only make sure that all HTML files contain -META tag, e.g. +no problem at all. You must only make sure that all the HTML files contain +the META tag, e.g. \begin{verbatim} <meta http-equiv="Content-Type" content="iso8859-2"> \end{verbatim} -and that hhp project file contains one additional line in {\tt OPTIONS} +and that the hhp project file contains one additional line in the {\tt OPTIONS} section: \begin{verbatim} Charset=iso8859-2 \end{verbatim} -This additional entry tells HTML help controller what encoding is used +This additional entry tells the HTML help controller what encoding is used in contents and index tables. diff --git a/docs/latex/wx/tooltip.tex b/docs/latex/wx/tooltip.tex new file mode 100644 index 0000000000..0430c381f7 --- /dev/null +++ b/docs/latex/wx/tooltip.tex @@ -0,0 +1,61 @@ +% +% automatically generated by HelpGen from +% /home/vasek/tooltip.h at 24/May/00 16:57:08 +% + +\section{\class{wxToolTip}}\label{wxtooltip} + +This class holds information about a tooltip associated with a window +(see \helpref{wxWindow::SetToolTip}{wxwindowsettooltip}). + +The two static methods, \helpref{wxToolTip::Enable}{wxtooltipenable} and +\helpref{wxToolTip::SetDelay}{wxtooltipsetdelay} can be used to globally +alter tooltips behaviour. + +\wxheading{Derived from} + +\helpref{wxObject}{wxobject} + + +\latexignore{\rtfignore{\wxheading{Members}}} + + +\membersection{wxToolTip::Enable}\label{wxtooltipenable} + +\func{static void}{Enable}{\param{bool }{flag}} + +Enable or disable tooltips globally. + + +\membersection{wxToolTip::SetDelay}\label{wxtooltipsetdelay} + +\func{static void}{SetDelay}{\param{long }{msecs}} + +Set the delay after which the tooltip appears. + + +\membersection{wxToolTip::wxToolTip}\label{wxtooltipwxtooltip} + +\func{}{wxToolTip}{\param{const wxString\& }{tip}} + +Constructor. + +\membersection{wxToolTip::SetTip}\label{wxtooltipsettip} + +\func{void}{SetTip}{\param{const wxString\& }{tip}} + +Set the tooltip text. + + +\membersection{wxToolTip::GetTip}\label{wxtooltipgettip} + +\constfunc{wxString}{GetTip}{\void} + +Get the tooltip text. + +\membersection{wxToolTip::GetWindow}\label{wxtooltipgetwindow} + +\constfunc{wxWindow*}{GetWindow}{\void} + +Get the associated window. + diff --git a/docs/latex/wx/topics.tex b/docs/latex/wx/topics.tex index c232ebbef4..1c246e3404 100644 --- a/docs/latex/wx/topics.tex +++ b/docs/latex/wx/topics.tex @@ -11,7 +11,9 @@ This chapter contains a selection of topic overviews, first things first: \input tapp.tex \input truntime.tex \input tstring.tex +\input tdate.tex \input tunicode.tex +\input tmbconv.tex \input ti18n.tex \input tnoneng.tex \input tcontain.tex diff --git a/docs/latex/wx/treectrl.tex b/docs/latex/wx/treectrl.tex index c9ea91be34..0bd2bdc467 100644 --- a/docs/latex/wx/treectrl.tex +++ b/docs/latex/wx/treectrl.tex @@ -67,8 +67,8 @@ implemented in the system library {\tt comctl32.dll}. Some versions of this library are known to have bugs with handling the tree control colours: the usual symptom is that the expanded items leave black (or otherwise incorrectly coloured) background behind them, especially for the controls using non -default background colour. The recommended solution is to upgrade the {\tt comctl32.dll} -to a newer version: see +default background colour. The recommended solution is to upgrade the {\tt comctl32.dll} +to a newer version: see \urlref{http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp}{http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp}. \latexignore{\rtfignore{\wxheading{Members}}} @@ -178,7 +178,7 @@ will be sent which can be vetoed as well. \wxheading{See also} -\helpref{wxTreeCtrl::EndEditLabel}{wxtreectrlendeditlabel}, +\helpref{wxTreeCtrl::EndEditLabel}{wxtreectrlendeditlabel}, \helpref{wxTreeEvent}{wxtreeevent} \membersection{wxTreeCtrl::EndEditLabel}\label{wxtreectrlendeditlabel} @@ -329,7 +329,7 @@ Returns the last child of the item (or an invalid tree item if this item has no \wxheading{See also} -\helpref{GetFirstChild}{wxtreectrlgetfirstchild}, +\helpref{GetFirstChild}{wxtreectrlgetfirstchild}, \helpref{GetLastChild}{wxtreectrlgetlastchild} \membersection{wxTreeCtrl::GetNextChild}\label{wxtreectrlgetnextchild} @@ -408,7 +408,7 @@ Returns the root item for the tree control. \constfunc{int}{GetItemSelectedImage}{\param{const wxTreeItemId\& }{item}} -Gets the selected item image (this function is obsolete, use +Gets the selected item image (this function is obsolete, use {\tt GetItemImage(item, wxTreeItemIcon\_Selected}) instead). \membersection{wxTreeCtrl::GetSelection}\label{wxtreectrlgetselection} @@ -416,7 +416,7 @@ Gets the selected item image (this function is obsolete, use \constfunc{wxTreeItemId}{GetSelection}{\void} Returns the selection, or an invalid item if there is no selection. -This function only works with the controls without wxTR\_MULTIPLE style, use +This function only works with the controls without wxTR\_MULTIPLE style, use \helpref{GetSelections}{wxtreectrlgetselections} for the controls which do have this style. @@ -442,8 +442,8 @@ Returns the state image list (from which application-defined state images are ta \func{wxTreeItemId}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}} -Calculates which (if any) item is under the given point, returning extra information -in {\it flags}. {\it flags} is a bitlist of the following: +Calculates which (if any) item is under the given point, returning the tree item +id at this point plus extra information {\it flags}. {\it flags} is a bitlist of the following: \twocolwidtha{5cm} \begin{twocollist}\itemsep=0pt @@ -476,6 +476,9 @@ Inserts an item after a given one ({\it previous}) or before one identified by i If {\it image} > -1 and {\it selImage} is -1, the same image is used for both selected and unselected items. +\pythonnote{The second form of this method is called +\tt{InsertItemBefore} in wxPython.} + \membersection{wxTreeCtrl::IsBold}\label{wxtreectrlisbold} \constfunc{bool}{IsBold}{\param{const wxTreeItemId\& }{item}} @@ -609,7 +612,7 @@ usage and loading time. \func{void}{SetItemImage}{\param{const wxTreeItemId\&}{ item}, \param{int }{image}, \param{wxTreeItemIcon }{which = wxTreeItemIcon\_Normal}} -Sets the specified item image. See \helpref{GetItemImage}{wxtreectrlgetitemimage} +Sets the specified item image. See \helpref{GetItemImage}{wxtreectrlgetitemimage} for the description of the {\it which} parameter. \membersection{wxTreeCtrl::SetItemSelectedImage}\label{wxtreectrlsetitemselectedimage} @@ -640,7 +643,7 @@ Sets the state image list (from which application-defined state images are taken \func{void}{SortChildren}{\param{const wxTreeItemId\&}{ item}} -Sorts the children of the given item using +Sorts the children of the given item using \helpref{OnCompareItems}{wxtreectrloncompareitems} method of wxTreeCtrl. You should override that method to change the sort order (the default is ascending alphabetical order). @@ -665,7 +668,7 @@ Removes the selection from the currently selected item (if any). \func{void}{UnselectAll}{\void} -This function either behaves the same as \helpref{Unselect}{wxtreectrlunselect} +This function either behaves the same as \helpref{Unselect}{wxtreectrlunselect} if the control doesn't have wxTR\_MULTIPLE style, or removes the selection from all items if it does have this style. diff --git a/docs/latex/wx/tresourc.tex b/docs/latex/wx/tresourc.tex index 86f055a611..35aaea2b28 100644 --- a/docs/latex/wx/tresourc.tex +++ b/docs/latex/wx/tresourc.tex @@ -1,6 +1,6 @@ \section{The wxWindows resource system}\label{resourceformats} -From version 1.61, wxWindows has an optional {\it resource file} facility, +wxWindows has an optional {\it resource file} facility, which allows separation of dialog, menu, bitmap and icon specifications from the application code. @@ -11,49 +11,35 @@ the .WXR file does not {\it replace} the native Windows resource file, it merely supplements it. There is no existing native resource format in X (except for the defaults file, which has limited expressive power). -Using wxWindows resources for panels and dialogs has an effect on how -you deal with panel item callbacks: you can't specify a callback function in -a resource file, so how do you achieve the same effect as with programmatic -panel construction? The solution is similar to that adopted by Windows, which -is to use the {\it parent} panel or dialog to intercept user events. - -From 1.61, wxWindows routes panel item events that do not have a callback -to the \helpref{OnCommand}{wxwindowoncommand} member of the panel (or dialog). So, to use -panel or dialog resources, you need to derive a new class and override the -default (empty) OnCommand member. The first argument is a reference -to a wxWindow, and the second is a reference to a wxCommandEvent. Check the -name of the panel item that's generating an event by using the \helpref{wxWindow::GetName}{wxwindowgetname}\rtfsp -function and a string comparison function such as \helpref{wxStringEq}{wxstringeq}. -You may need to cast the reference to an appropriate specific type to perform -some operations. - -To obtain a pointer to a panel item when you only have the name (for example, -when you need to set a value of a text item from outside of the {\bf OnCommand} function), -use the function \helpref{wxFindWindowByName}{wxfindwindowbyname}. - For details of functions for manipulating resource files and loading user interface elements, see \helpref{wxWindows resource functions}{resourcefuncs}. +You can use Dialog Editor to create resource files. Unfortunately neither +Dialog Editor nor the .WXR format currently cover all wxWindows controls; +some are missing, such as wxSpinCtrl, wxSpinButton, wxListCtrl, wxTreeCtrl and others. + +Note that in later versions of wxWindows, this resource format will be replaced +by XML specifications that can also include sizers. + \subsection{The format of a .WXR file} -A wxWindows resource file may look a little odd at first. It's C++ +A wxWindows resource file may look a little odd at first. It is C++ compatible, comprising mostly of static string variable declarations with -PrologIO syntax within the string. +wxExpr syntax within the string. Here's a sample .WXR file: \begin{verbatim} /* * wxWindows Resource File - * Written by wxBuilder * */ #include "noname.ids" -static char *aiai_resource = "bitmap(name = 'aiai_resource',\ - bitmap = ['aiai', wxBITMAP_TYPE_BMP_RESOURCE, 'WINDOWS'],\ - bitmap = ['aiai.xpm', wxBITMAP_TYPE_XPM, 'X'])."; +static char *my_resource = "bitmap(name = 'my_resource',\ + bitmap = ['myproject', wxBITMAP_TYPE_BMP_RESOURCE, 'WINDOWS'],\ + bitmap = ['myproject.xpm', wxBITMAP_TYPE_XPM, 'X'])."; static char *menuBar11 = "menu(name = 'menuBar11',\ menu = \ @@ -79,9 +65,9 @@ static char *panel3 = "dialog(name = 'panel3',\ button_font = [14, 'wxSWISS', 'wxNORMAL', 'wxBOLD', 0],\ label_font = [10, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],\ x = 0, y = 37, width = 292, height = 164,\ - control = [wxButton, 'OK', '', 'button5', 23, 34, -1, -1, 'aiai_resource'],\ - control = [wxMessage, 'A Label', '', 'message7', 166, 61, -1, -1, 'aiai_resource'],\ - control = [wxText, 'Text', 'wxVERTICAL_LABEL', 'text8', 24, 110, -1, -1])."; + control = [1000, wxButton, 'OK', '', 'button5', 23, 34, -1, -1, 'my_resource'],\ + control = [1001, wxStaticText, 'A Label', '', 'message7', 166, 61, -1, -1, 'my_resource'],\ + control = [1002, wxTextCtrl, 'Text', 'wxTE_MULTITEXT', 'text8', 24, 110, -1, -1])."; \end{verbatim} As you can see, C++-style comments are allowed, and apparently include files @@ -89,15 +75,15 @@ are supported too: but this is a special case, where the included file is a file of defines shared by the C++ application code and resource file to relate identifiers (such as FILE\_OPEN) to integers. -Each {\it resource object} is of standard PrologIO syntax, that is, +Each {\it resource object} is of standard \helpref{wxExpr}{wxexpr} syntax, that is, an object name such as {\bf dialog} or {\bf icon}, then an open parenthesis, a list of comma-delimited attribute/value pairs, a closing parenthesis, and a full stop. Backslashes are required to escape newlines, for the benefit of C++ syntax. If double quotation marks are used to delimit strings, they need to be escaped with backslash within a C++ string -(so it's easier to use single quotation marks instead). +(so it is easier to use single quotation marks instead). -\normalbox{{\it A note on PrologIO string syntax:} A string that begins with +\normalbox{{\it A note on string syntax:} A string that begins with an alphabetic character, and contains only alphanumeric characters, hyphens and underscores, need not be quoted at all. Single quotes and double quotes may be used to delimit more complex strings. In fact, single-quoted @@ -107,8 +93,8 @@ as strings for the purpose of the resource system.} A resource file like this is typically included in the application main file, as if it were a normal C++ file. This eliminates the need for a separate resource file to be distributed alongside the executable. However, the -resource file can be dynamically loaded if desired (for example by a non-C++ -language such as CLIPS, Prolog or Python). +resource file can be dynamically loaded if desired (useful for non-C++ +languages such as Python). Once included, the resources need to be `parsed' (interpreted), because so far the data is just a number of static string variables. The function\rtfsp @@ -122,8 +108,8 @@ get all your resources into one variable if you want to. by functions such as {\bf ::wxResourceCreateBitmap} and {\bf wxPanel::LoadFromResource}. If a wxWindows resource object (such as a bitmap resource) refers to a -C++ data structure, such as static XBM or XPM data, a further call ({\bf -::wxResourceRegisterBitmapData}) needs to be made on initialization to tell +C++ data structure, such as static XPM data, a further call ({\bf ::wxResourceRegisterBitmapData}) needs +to be made on initialization to tell wxWindows about this data. The wxWindows resource object will refer to a string identifier, such as `project\_data' in the example file above. This identifier will be looked up in a table to get the C++ static data @@ -137,37 +123,52 @@ use. \begin{verbatim} /* - * File: noname.cc - * Purpose: main application module, generated by wxBuilder. + * File: project.cpp + * Purpose: main application module */ -#include "wx.h" -#include "wx_help.h" -#include "noname.h" +#include "wx/wx.h" +#include "project.h" // Includes the dialog, menu etc. resources -#include "noname.wxr" +#include "project.wxr" -// Includes XBM data -#include "project.xbm" +// Includes XPM data +#include "project.xpm" -// Declare an instance of the application: allows the program to start -AppClass theApp; +IMPLEMENT_APP(AppClass) // Called to initialize the program -wxFrame *AppClass::OnInit(void) +bool AppClass::OnInit() { -#ifdef wx_x wxResourceRegisterBitmapData("project_data", project_bits, project_width, project_height); -#endif + wxResourceParseData(menuBar11); - wxResourceParseData(aiai_resource); + wxResourceParseData(my_resource); wxResourceParseData(project_resource); wxResourceParseData(panel3); ... + + return TRUE; } \end{verbatim} +The following code shows a dialog: + +\begin{verbatim} + // project.wxr contains dialog1 + MyDialog *dialog = new MyDialog; + if (dialog->LoadFromResource(this, "dialog1")) + { + wxTextCtrl *text = (wxTextCtrl *)wxFindWindowByName("text3", dialog); + if (text) + text->SetValue("wxWindows resource demo"); + dialog->ShowModal(); + } + dialog->Destroy(); +\end{verbatim} + +Please see also the resource sample. \subsection{Dialog resource format} @@ -177,52 +178,52 @@ is a list consisting of point size, family, style, weight, underlined, optional \begin{twocollist}\itemsep=0pt \twocolitemruled{Attribute}{Value} +\twocolitem{id}{The integer identifier of the resource.} \twocolitem{name}{The name of the resource.} \twocolitem{style}{Optional dialog box or panel window style.} \twocolitem{title}{The title of the dialog box (unused if a panel).}. \twocolitem{modal}{Whether modal: 1 if modal, 0 if modeless, absent if a panel resource.} +\twocolitem{use_dialog_units}{If 1, use dialog units (dependent on the dialog font size) for control sizes and positions.} +\twocolitem{use_system_defaults}{If 1, override colours and fonts to use system settings instead.} \twocolitem{button\_font}{The font used for control buttons: a list comprising point size (integer), family (string), font style (string), font weight (string) and underlining (0 or 1).} \twocolitem{label\_font}{The font used for control labels: a list comprising point size (integer), -family (string), font style (string), font weight (string) and underlining (0 or 1).} +family (string), font style (string), font weight (string) and underlining (0 or 1). Now obsolete; use button\_font instead.} \twocolitem{x}{The x position of the dialog or panel.} \twocolitem{y}{The y position of the dialog or panel.} \twocolitem{width}{The width of the dialog or panel.} \twocolitem{height}{The height of the dialog or panel.} -\twocolitem{background\_colour}{The background colour of the dialog or panel. Only valid if the style includes wxUSER\_COLOURS.} -\twocolitem{label\_colour}{The default label colour for the children of the dialog or panel. Only valid if the style includes wxUSER\_COLOURS.} -\twocolitem{button\_colour}{The default button text colour for the children of the dialog or panel. Only valid if the style includes wxUSER\_COLOURS.} -\twocolitem{label\_font}{Font spec} -\twocolitem{button\_font}{Font spec} +\twocolitem{background\_colour}{The background colour of the dialog or panel.} +\twocolitem{label\_colour}{The default label colour for the children of the dialog or panel. Now obsolete; use button\_colour instead.} +\twocolitem{button\_colour}{The default button text colour for the children of the dialog or panel.} \end{twocollist} Then comes zero or more attributes named `control' for each control (panel item) on the dialog or panel. The value is a list of further elements. In the table below, the names in the first column correspond to the first element of the value list, and the second column details the -remaining elements of the list. +remaining elements of the list. Note that titles for some controls are obsolete +(they don't have titles), but the syntax is retained for backward compatibility. \begin{twocollist}\itemsep=0pt \twocolitemruled{Control}{Values} -\twocolitem{wxButton}{title (string), window style (string), name (string), x, y, width, height, button bitmap resource (optional string), button font spec} -\twocolitem{wxCheckBox}{title (string), window style (string), name (string), x, y, width, height, default value (optional integer, 1 or 0), label font spec} -\twocolitem{wxChoice}{title (string), window style (string), name (string), x, y, width, height, values (optional list of strings), label font spec, button font spec} -\twocolitem{wxComboBox}{title (string), window style (string), name (string), x, y, width, height, default text value, values (optional list of strings), label font spec, button font spec} -\twocolitem{wxGauge}{title (string), window style (string), name (string), x, y, width, height, value (optional integer), range (optional integer), label font spec, button font spec} -\twocolitem{wxGroupBox}{title (string), window style (string), name (string), x, y, width, height, label font spec} -\twocolitem{wxListBox}{title (string), window style (string), name (string), x, y, width, height, values (optional list of strings), multiple (optional string, wxSINGLE or wxMULTIPLE), -label font spec, button font spec} -\twocolitem{wxMessage}{title (string), window style (string), name (string), x, y, width, height, message bitmap resource (optional string), label font spec} -\twocolitem{wxMultiText}{title (string), window style (string), name (string), x, y, width, height, default value (optional string), +\twocolitem{wxButton}{id (integer), title (string), window style (string), name (string), x, y, width, height, button bitmap resource (optional string), button font spec} +\twocolitem{wxCheckBox}{id (integer), title (string), window style (string), name (string), x, y, width, height, default value (optional integer, 1 or 0), label font spec} +\twocolitem{wxChoice}{id (integer), title (string), window style (string), name (string), x, y, width, height, values (optional list of strings), label font spec, button font spec} +\twocolitem{wxComboBox}{id (integer), title (string), window style (string), name (string), x, y, width, height, default text value, values (optional list of strings), label font spec, button font spec} +\twocolitem{wxGauge}{id (integer), title (string), window style (string), name (string), x, y, width, height, value (optional integer), range (optional integer), label font spec, button font spec} +\twocolitem{wxStaticBox}{id (integer), title (string), window style (string), name (string), x, y, width, height, label font spec} +\twocolitem{wxListBox}{id (integer), title (string), window style (string), name (string), x, y, width, height, values (optional list of strings), multiple (optional string, wxSINGLE or wxMULTIPLE), label font spec, button font spec} -\twocolitem{wxRadioBox}{title (string), window style (string), name (string), x, y, width, height, values (optional list of strings), number of rows or cols, +\twocolitem{wxStaticText}{id (integer), title (string), window style (string), name (string), x, y, width, height, message bitmap resource (optional string), label font spec} +\twocolitem{wxRadioBox}{id (integer), title (string), window style (string), name (string), x, y, width, height, values (optional list of strings), number of rows or cols, label font spec, button font spec} -\twocolitem{wxRadioButton}{title (string), window style (string), name (string), x, y, width, height, default value (optional integer, 1 or 0), label font spec} -\twocolitem{wxScrollBar}{title (string), window style (string), name (string), x, y, width, height, value (optional integer), +\twocolitem{wxRadioButton}{id (integer), title (string), window style (string), name (string), x, y, width, height, default value (optional integer, 1 or 0), label font spec} +\twocolitem{wxScrollBar}{id (integer), title (string), window style (string), name (string), x, y, width, height, value (optional integer), page length (optional integer), object length (optional integer), view length (optional integer)} -\twocolitem{wxSlider}{title (string), window style (string), name (string), x, y, width, height, value (optional integer), minimum (optional integer), maximum (optional integer), +\twocolitem{wxSlider}{id (integer), title (string), window style (string), name (string), x, y, width, height, value (optional integer), minimum (optional integer), maximum (optional integer), label font spec, button font spec} -\twocolitem{wxText}{title (string), window style (string), name (string), x, y, width, height, default value (optional string), +\twocolitem{wxTextCtrl}{id (integer), title (string), window style (string), name (string), x, y, width, height, default value (optional string), label font spec, button font spec} \end{twocollist} @@ -292,7 +293,6 @@ a full list). \item Y resolution (optional). \end{itemize} - \subsection{Resource format design issues} The .WXR file format is a recent addition and subject to change. @@ -309,8 +309,8 @@ for non-C++ programs that use wxWindows. parser and a binary format). \item It would be difficult to append a binary resource component onto an executable in a portable way. -\item The file format is essentially the PrologIO object format, for which -a parser already exists, so parsing is easy. For those programs that use PrologIO +\item The file format is essentially the \helpref{wxExpr}{wxexpr} object format, for which +a parser already exists, so parsing is easy. For those programs that use wxExpr anyway, the size overhead of the parser is minimal. \end{itemize} @@ -329,5 +329,4 @@ object, in addition to providing \verb$#$defines for application code convenienc \subsection{Compiling the resource system} To enable the resource system, set {\bf wxUSE\_WX\_RESOURCES} to 1 in setup.h. -If your wxWindows makefile supports it, set the same name in the makefile to 1. diff --git a/docs/latex/wx/truntime.tex b/docs/latex/wx/truntime.tex index df443465ea..a0dc67d8d3 100644 --- a/docs/latex/wx/truntime.tex +++ b/docs/latex/wx/truntime.tex @@ -19,7 +19,7 @@ to use whenever possible \helpref{wxDynamicCast()}{wxdynamiccast} macro which, for the implementations that support it, is defined just as dynamic\_cast<> and uses wxWindows RTTI for all the others. This macro is limited to wxWindows classes only and only works with pointers (unlike the real dynamic\_cast<> which -also accepts referencies). +also accepts references). Each class that you wish to be known the type system should have a macro such as DECLARE\_DYNAMIC\_CLASS just inside the class declaration. diff --git a/docs/latex/wx/tsamples.tex b/docs/latex/wx/tsamples.tex index 1fa01ecf41..6c448dc45c 100644 --- a/docs/latex/wx/tsamples.tex +++ b/docs/latex/wx/tsamples.tex @@ -6,7 +6,7 @@ %% Created: 02.11.99 %% RCS-ID: $Id$ %% Copyright: (c) wxWindows team -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % NB: please keep the subsections in alphabetic order! @@ -61,8 +61,8 @@ menu) and also how to process the notifications from it. This sample demonstrates the use of the \helpref{wxCheckListBox}{wxchecklistbox} class intercepting check, select and double click events. It also tests the -use of various methods modifiying the control, such as by deleting items -from it or inserting new once (these fucntions are actually implememted in +use of various methods modifying the control, such as by deleting items +from it or inserting new once (these functions are actually implemented in the parent class \helpref{wxListBox}{wxlistbox} so the sample tests that class as well). The layout of the dialog is created using a \helpref{wxBoxSizer}{wxboxsizer} demonstrating a simple dynamic layout. @@ -70,7 +70,7 @@ demonstrating a simple dynamic layout. \subsection{Config sample}\label{sampleconfig} This sample demonstrates the \helpref{wxConfig}{wxconfigbase} classes in a platform -indepedent way, i.e. it uses text based files to store a given configuration under +indenpedent way, i.e. it uses text based files to store a given configuration under Unix and uses the Registry under Windows. See \helpref{wxConfig overview}{wxconfigoverview} for the descriptions of all @@ -83,9 +83,9 @@ wxWindows. The sample tests their basic functionality, events, placement, modification in terms of colour and font as well as the possibility to change the controls programmatically, such as adding item to a list box etc. Apart from that, the sample uses a \helpref{wxNotebook}{wxnotebook} and tests most -fetaures of this special control (using bitmap in the tabs, using +features of this special control (using bitmap in the tabs, using \helpref{wxSizers}{wxsizer} and \helpref{constraints}{wxlayoutconstraints} within -notebook pages, advanving pages programmatically and vetoing a page change +notebook pages, advancing pages programmatically and vetoing a page change by intercepting the \helpref{wxNotebookEvent}{wxnotebookevent}. The various controls tested are listed here: @@ -119,7 +119,20 @@ system. \subsection{Dialogs sample}\label{sampledialogs} This sample shows how to use the common dialogs available from wxWindows. These -dialogs are desrcibed in details in the \helpref{Common dialogs overview}{commondialogsoverview}. +dialogs are described in details in the \helpref{Common dialogs overview}{commondialogsoverview}. + +\subsection{Dialup sample}\label{sampledialup} + +This sample shows \helpref{wxDialUpManager}{wxdialupmanager} +class. It displays in the status bar the information gathered through itsi +nterface: in particular, the current connection status (online or offline) and +whether the connection is permanent (in which case a string `LAN' appears in +the thrid status bar field - but note that you may have be on a LAN not +connected to the Internet, in which case you will not see this) or not. + +Using the menu entries, you may also dial or hang up the line if you have a +modem attached and (this only makes sense for Windows) list the available +connections. \subsection{Dynamic sample}\label{sampledynamic} @@ -128,7 +141,7 @@ This sample is a very small sample that demonstrates the use of the should be used whenever it is not known at compile time, which control will receive which event or which controls are actually going to be in a dialog or frame. This is most typically the case for any scripting -languge that would work as a wrapper for wxWindows or programs where +language that would work as a wrapper for wxWindows or programs where forms or similar datagrams can be created by the uses. \subsection{Exec sample}\label{sampleexec} @@ -138,10 +151,13 @@ The exec sample demonstrates the \helpref{wxExecute}{wxexecute} and external programs and the sample shows how to do this synchronously (waiting until the program terminates) or asynchronously (notification will come later). +It also shows how to capture the output of the child process in both +synchronous and asynchronous cases. + \subsection{Scroll subwindow sample}\label{samplescrollsub} This sample demonstrates the use of the \helpref{wxScrolledWindow}{wxscrolledwindow} -class including placing subwindows into it and drawing simple graphics. It uses the +class including placing subwindows into it and drawing simple graphics. It uses the \helpref{SetTargetWindow}{wxscrolledwindowsettargetwindow} method and thus the effect of scrolling does not show in the scrolled window itself, but in one of its subwindows. @@ -226,7 +242,7 @@ the library to work with unsupported tags. handler (ships with wxWindows) allows you to access HTML pages stored in compressed archive as if they were ordinary files. -{\bf Virtual} is yet another VFS demo. This one generates pages at run-time. +{\bf Virtual} is yet another virtual file systems demo. This one generates pages at run-time. You may find it useful if you need to display some reports in your application. {\bf Printing} explains use of \helpref{wxHtmlEasyPrinting}{wxhtmleasyprinting} @@ -234,7 +250,7 @@ class which serves as as-simple-as-possible interface for printing HTML documents without much work. In fact, only few function calls are sufficient. {\bf Help} and {\bf Helpview} are variations on displaying HTML help -(compatible with MS HTML Help Workshop). {\it Help} shows how to embed +(compatible with MS HTML Help Workshop). {\it Help} shows how to embed \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller} in your application while {\it Helpview} is simple tool that only pops up help window and displays help books given at command line. @@ -244,7 +260,7 @@ displays help books given at command line. The image sample demonstrates the use of the \helpref{wxImage}{wximage} class and shows how to download images in a variety of formats, currently PNG, GIF, TIFF, JPEG, BMP, PNM and PCX. The top of the sample shows to rectangles, one -of which is drawn directly in the window, the other one is drawn into a +of which is drawn directly in the window, the other one is drawn into a \helpref{wxBitmap}{wxbitmap}, converted to a wxImage, saved as a PNG image and then reloaded from the PNG file again so that conversions between wxImage and wxBitmap as well as loading and save PNG files are tested. @@ -301,8 +317,8 @@ they set up their own event handler, and then request to be notified of {\bf wxSOCKET\_INPUT} (incoming data) or {\bf wxSOCKET\_LOST} (connection closed at the remote end) events. In the sample, the event handler is the same for all connections; to find out which socket the -event is addressed to, the \helpref{GetSocket}{wxsocketeventgetsocket} -function is used. +event is addressed to, the \helpref{GetSocket}{wxsocketeventgetsocket} function +is used. Although it might take some time to get used to the event-oriented system upon which wxSocket is built, the benefits are many. See, for @@ -323,8 +339,8 @@ both clients and connection objects in the server set up an event handler to catch {\bf wxSOCKET\_LOST} events, each one is immediately notified if the other end closes the connection. -There is also an URL test which shows how to use the \helpref{wxURL}{wxurl} -class to fetch data from a given URL. +There is also an URL test which shows how to use +the \helpref{wxURL}{wxurl} class to fetch data from a given URL. The sockets sample is work in progress. Some things to do: @@ -353,10 +369,10 @@ password, ignoring TAB, ignoring ENTER). Secondly it shows how to intercept a \helpref{wxKeyEvent}{wxkeyevent} in both the raw form using the {\tt EVT\_KEY\_UP} and {\tt EVT\_KEY\_DOWN} macros and the -higherlevel from using the {\tt EVT\_CHAR} macro. All characters will be logged +higher level from using the {\tt EVT\_CHAR} macro. All characters will be logged in a log window at the bottom of the main window. By pressing some of the function -keys, you can test some actions in the text ctrl as well as get statitics on the -text ctrls, which is useful for testing if these statitics actually are correct. +keys, you can test some actions in the text ctrl as well as get statistics on the +text ctrls, which is useful for testing if these stastitics actually are correct. Thirdly, on platforms which support it, the sample will offer to copy text to the \helpref{wxClipboard}{wxclipboard} and to paste text from it. The GTK version will @@ -397,7 +413,7 @@ The following things are demonstrated: and \helpref{wxToolBar::AddControl}{wxtoolbaraddcontrol}: see MyApp::InitToolbar in the sample. \item Using {\tt EVT\_UPDATE\_UI} handler for automatically enabling/disabling -toolbar buttons without having to explicitly call EnableTool. This is is done +toolbar buttons without having to explicitly call EnableTool. This is done in MyFrame::OnUpdateCopyAndCut. \item Using \helpref{wxToolBar::DeleteTool}{wxtoolbardeletetool} and \helpref{wxToolBar::InsertTool}{wxtoolbarinserttool} to dynamically update the @@ -415,3 +431,27 @@ Adding, inserting and deleting items and branches from the tree as well as sorting (in default alphabetical order as well as in custom one) is demonstrated here as well - try the corresponding menu entries. +\subsection{Wizard sample}\label{samplewizard} + +This sample shows so-called wizard dialog (implemented using +\helpref{wxWizard}{wxwizard} and related classes). It shows almost all +features supported: + +\begin{itemize}\itemsep=0pt +\item Using bitmaps with the wizard and changing them depending on the page +shown (notice that wxValidationPage in the sample has a different image from +the other ones) +\item Using \helpref{TransferDataFromWindow}{wxwindowtransferdatafromwindow} +to verify that the data entered is correct before passing to the next page +(done in wxValidationPage which forces the user to check a checkbox before +continuing). +\item Using more elaborated techniques to allow returning to the previous +page, but not continuing to the next one or vice versa (in wxRadioboxPage) +\item This (wxRadioboxPage) page also shows how the page may process {\tt +Cancel} button itself instead of relying on the wizard parent to do it. +\item Normally, the order of the pages in the wizard is known at compile-time, +but sometimes it depends on the user choices: wxCheckboxPage shows how to +dynamically decide which page to display next (see also +\helpref{wxWizardPage}{wxwizardpage}) +\end{itemize} + diff --git a/docs/latex/wx/tscroll.tex b/docs/latex/wx/tscroll.tex index 40986ab426..3f218b92e8 100644 --- a/docs/latex/wx/tscroll.tex +++ b/docs/latex/wx/tscroll.tex @@ -3,7 +3,7 @@ Classes: \helpref{wxWindow}{wxwindow}, \helpref{wxScrolledWindow}{wxscrolledwindow}, \helpref{wxIcon}{wxicon}, \helpref{wxScrollBar}{wxscrollbar}. Scrollbars come in various guises in wxWindows. All windows have the potential -to show a vertical scrollbar and/or a horizontal scrollbar: it's a basic capability of a window. +to show a vertical scrollbar and/or a horizontal scrollbar: it is a basic capability of a window. However, in practice, not all windows do make use of scrollbars, such as a single-line wxTextCtrl. Because any class derived from \helpref{wxWindow}{wxwindow} may have scrollbars, @@ -18,7 +18,7 @@ events varies from one window class to another. \helpref{wxScrolledWindow}{wxscrolledwindow} (formerly wxCanvas) is an example of a window that adds functionality to make scrolling really work. It assumes that scrolling happens in consistent units, not different-sized jumps, and that page size is represented -by the visible portion of the window. It's suited to drawing applications, but perhaps +by the visible portion of the window. It is suited to drawing applications, but perhaps not so suitable for a sophisticated editor in which the amount scrolled may vary according to the size of text on a given line. For this, you would derive from wxWindow and implement scrolling yourself. \helpref{wxGrid}{wxgrid} is an example of a class @@ -27,7 +27,7 @@ that implements its own scrolling, largely because columns and rows can vary in \wxheading{The scrollbar model} The function \helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar} gives a clue about -the way a scrollbar is modelled. This function takes the following arguments: +the way a scrollbar is modeled. This function takes the following arguments: \twocolwidtha{5cm}% \begin{twocollist} @@ -42,7 +42,7 @@ the way a scrollbar is modelled. This function takes the following arguments: the built-in horizontal or vertical scrollbar. {\it position} is simply the position of the `thumb' (the bit you drag to scroll around). -It's given in scroll units, and so is relative to the total range of the scrollbar. +It is given in scroll units, and so is relative to the total range of the scrollbar. {\it visible} gives the number of scroll units that represents the portion of the window currently visible. Normally, a scrollbar is capable of indicating this visually @@ -51,7 +51,7 @@ by showing a different length of thumb. {\it range} is the maximum value of the scrollbar, where zero is the start position. You choose the units that suit you, so if you wanted to display text that has 100 lines, you would set this to 100. -Note that this doesn't have to correspond to the number of pixels scrolled - it's +Note that this doesn't have to correspond to the number of pixels scrolled - it is up to you how you actually show the contents of the window. {\it refresh} just indicates whether the scrollbar should be repainted immediately or not. @@ -83,7 +83,7 @@ from your \helpref{wxWindow::OnSize}{wxwindowonsize} event handler function. %\normalbox{{\bf For Windows programmers:} note that scrollbar range in wxWindows has a different meaning %from that in Windows. In native Windows scrollbar calls, range is the number of positions that the scrollbar -%can physically scroll through - in our example above, it would be 34. But it's easier +%can physically scroll through - in our example above, it would be 34. But it is easier %to think in terms of the number of units that the whole scrollbar represents - the virtual %window size - which is why wxWindows does it differently.} diff --git a/docs/latex/wx/tstream.tex b/docs/latex/wx/tstream.tex index 9bb13376ab..a472c2f0e1 100644 --- a/docs/latex/wx/tstream.tex +++ b/docs/latex/wx/tstream.tex @@ -27,7 +27,7 @@ wxFilterIn/OutputStream \end{enumerate} wxStreamBase is the base definition of a stream. It defines, for example, -the API of OnSysRead, OnSysWrite, OnSysSeek and OnSysTell. These functions are +the API of OnSysRead, OnSysWrite, OnSysSeek and OnSysTell. These functions are really implemented by the "IO" classes. wxInputStream and wxOutputStream inherit from it. @@ -39,8 +39,8 @@ wxInputStream is the base class for read-only streams. It implements Read, SeekI (I for Input), and all read or IO generic related functions. wxOutputStream does the same thing but it is for write-only streams. -wxFilterIn/OutputStream is base class definition for stream filtering. -I mean by stream filtering, a stream which does no syscall but filter datas +wxFilterIn/OutputStream is the base class definition for stream filtering. +Stream filtering means a stream which does no syscall but filters data which are passed to it and then pass them to another stream. For example, wxZLibInputStream is an inline stream decompressor. diff --git a/docs/latex/wx/tstring.tex b/docs/latex/wx/tstring.tex index 4bd1f1aa26..e57912e91a 100644 --- a/docs/latex/wx/tstring.tex +++ b/docs/latex/wx/tstring.tex @@ -13,7 +13,7 @@ wxString only works with ASCII (8 bit characters) strings as of this release, but support for UNICODE (16 but characters) is planned for the next one. This class has all the standard operations you can expect to find in a string class: -dynamic memory management (string extends to accomodate new characters), +dynamic memory management (string extends to accommodate new characters), construction from other strings, C strings and characters, assignment operators, access to individual characters, string concatenation and comparison, substring extraction, case conversion, trimming and padding (with spaces), searching and @@ -60,8 +60,8 @@ wxString internally by wxWindows. However, there are several problems as well. The most important one is probably that there are often several functions to do exactly the same thing: for example, to get the length of the string either one of -\helpref{length()}{wxstringlength}, \helpref{Len()}{wxstringlen} or -\helpref{Length()}{wxstringLength} may be used. The first function, as almost +length(), \helpref{Len()}{wxstringlen} or +\helpref{Length()}{wxstringlength} may be used. The first function, as almost all the other functions in lowercase, is std::string compatible. The second one is "native" wxString version and the last one is wxWindows 1.xx way. So the question is: which one is better to use? And the answer is that: @@ -73,7 +73,7 @@ in both wxWindows and other programs (by just typedefing wxString as std::string when used outside wxWindows) and by staying compatible with future versions of wxWindows which will probably start using std::string sooner or later too. -In the situations where there is no correspondinw std::string function, please +In the situations where there is no corresponding std::string function, please try to use the new wxString methods and not the old wxWindows 1.xx variants which are deprecated and may disappear in future versions. @@ -171,7 +171,7 @@ share the same data. But as soon as one of the two (or more) strings is modified, the data has to be copied because the changes to one of the strings shouldn't be seen in the -otheres. As data copying only happens when the string is written to, this is +others. As data copying only happens when the string is written to, this is known as COW. What is important to understand is that all this happens absolutely @@ -259,7 +259,7 @@ which tells the wxString class to collect performance statistics and to show them on stderr on program termination. This will show you the average length of strings your program manipulates, their average initial length and also the percent of times when memory wasn't reallocated when string concatenation was -done but the alread preallocated memory was used (this value should be about +done but the already preallocated memory was used (this value should be about 98\% for the default allocation policy, if it is less than 90\% you should really consider fine tuning wxString for your application). diff --git a/docs/latex/wx/tthreads.tex b/docs/latex/wx/tthreads.tex index b9ba1b517b..26d769af94 100644 --- a/docs/latex/wx/tthreads.tex +++ b/docs/latex/wx/tthreads.tex @@ -15,7 +15,7 @@ well. These classes will hopefully make writing MT programs easier and they also provide some extra error checking (compared to the native (be it Win32 or Posix) -thread API), however it is still an untrivial undertaking especially for large +thread API), however it is still an non-trivial undertaking especially for large projects. Before starting an MT application (or starting to add MT features to an existing one) it is worth asking oneself if there is no easier and safer way to implement the same functionality. Of course, in some situations threads diff --git a/docs/latex/wx/ttips.tex b/docs/latex/wx/ttips.tex index f239b6b984..e63e6e5303 100644 --- a/docs/latex/wx/ttips.tex +++ b/docs/latex/wx/ttips.tex @@ -6,7 +6,7 @@ the advanced users of the program, the experience shows that the tips may be quite helpful for the novices and so more and more programs now do this. For a wxWindows programmer, implementing this feature is extremely easy. To -show a tip, it's enough to just call \helpref{wxShowTip}{wxshowtip} function +show a tip, it is enough to just call \helpref{wxShowTip}{wxshowtip} function like this: \begin{verbatim} @@ -19,7 +19,7 @@ like this: \end{verbatim} Of course, you need to get the text of the tips from somewhere - in the example -above, the text is supposed to be in the file tips.txt from where it's read by +above, the text is supposed to be in the file tips.txt from where it is read by the {\it tip provider}. The tip provider is just an object of a class deriving from \helpref{wxTipProvider}{wxtipprovider}. It has to implement one pure virtual function of the base class: \helpref{GetTip}{wxtipprovidergettip}. diff --git a/docs/latex/wx/ttoolbar.tex b/docs/latex/wx/ttoolbar.tex index 258e4c2416..9879a96323 100644 --- a/docs/latex/wx/ttoolbar.tex +++ b/docs/latex/wx/ttoolbar.tex @@ -39,7 +39,7 @@ No absolute positioning is supported but you can specify the number of rows, and add tool separators with {\bf AddSeparator}. Tooltips are supported. {\bf OnRightClick} is not supported. This is the default wxToolBar on Windows 95, Windows NT 4 and above. With the style wxTB\_FLAT, the flat toolbar -look is used, with a border that is highlit when the cursor moves over the buttons. +look is used, with a border that is highlighted when the cursor moves over the buttons. \end{itemize} A toolbar might appear as a single row of images under @@ -72,7 +72,7 @@ Include {\tt "wx/toolbar.h"}, or if using a class directly, one of: \end{itemize} Example of toolbar use are given in the sample program ``toolbar''. The -source is given below. In fact it's out of date because recommended +source is given below. In fact it is out of date because recommended practise is to use event handlers (using EVT\_MENU or EVT\_TOOL) instead of overriding OnLeftClick. @@ -86,7 +86,7 @@ overriding OnLeftClick. // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// License: wxWindows license ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx/wx.h". diff --git a/docs/latex/wx/ttreectl.tex b/docs/latex/wx/ttreectl.tex index 7c30c800b0..30847cf1d9 100644 --- a/docs/latex/wx/ttreectl.tex +++ b/docs/latex/wx/ttreectl.tex @@ -23,7 +23,7 @@ may be retrieved with the corresponding functions: \helpref{IsSelected}{wxtreectrlisselected}, \helpref{IsVisible}{wxtreectrlisvisible}, \helpref{IsBold}{wxtreectrlisbold} and \helpref{IsExpanded}{wxtreectrlisexpanded}. Only one item at a time may be -selected, selecting anopther one (with +selected, selecting another one (with \helpref{SelectItem}{wxtreectrlselectitem}) automatically unselects the previously selected one. @@ -47,7 +47,7 @@ beginning, only the root item is created (with EVT\_TREE\_ITEM\_EXPANDING event is received: then all items lying immediately under the item being expanded should be added, but, of course, only when this event is received for the first time for this item - otherwise, the items would -be added twice if the user expands/collapses/reexapnds the branch. +be added twice if the user expands/collapses/re-expands the branch. The tree control provides functions for enumerating its items. There are 3 groups of enumeration functions: for the children of a given item, for the diff --git a/docs/latex/wx/tunicode.tex b/docs/latex/wx/tunicode.tex index 3dd9814926..718c25d6fb 100644 --- a/docs/latex/wx/tunicode.tex +++ b/docs/latex/wx/tunicode.tex @@ -19,7 +19,7 @@ characters from languages other than English. Starting with release 2.1 wxWindows has support for compiling in Unicode mode on the platforms which support it. Unicode is a standard for character -encoding which addreses the shortcomings of the previous, 8 bit standards, by +encoding which addresses the shortcomings of the previous, 8 bit standards, by using 16 bit for encoding each character. This allows to have 65536 characters instead of the usual 256 and is sufficient to encode all of the world languages at once. More details about Unicode may be found at {\tt www.unicode.org}. @@ -28,14 +28,14 @@ languages at once. More details about Unicode may be found at {\tt www.unicode.o As this solution is obviously preferable to the previous ones (think of incompatible encodings for the same language, locale chaos and so on), many -modern ooperating systems support it. The probably first example is Windows NT +modern operating systems support it. The probably first example is Windows NT which uses only Unicode internally since its very first version. Writing internationalized programs is much easier with Unicode and, as the support for it improves, it should become more and more so. Moreover, in the Windows NT/2000 case, even the program which uses only standard ASCII can profit from using Unicode because they will work more efficiently - there will be no -need for the system to convert all strings hte program uses to/from Unicode +need for the system to convert all strings the program uses to/from Unicode each time a system call is made. \subsection{Unicode and ANSI modes} @@ -46,7 +46,7 @@ environment. A better solution is to write programs in such way that they may be compiled either in ANSI (traditional) mode or in the Unicode one. This can be achieved quite simply by using the means provided by wxWindows. -Basicly, there are only a few things to watch out for: +Basically, there are only a few things to watch out for: \begin{itemize} \item Character type ({\tt char} or {\tt wchar\_t}) @@ -116,7 +116,7 @@ a separate type for strings though, because the standard Unicode strings depending on the compile mode. Finally, there is a special {\tt wxT()} macro which should enclose all literal -strings in the program. As it's easy to see comparing the last fragment with +strings in the program. As it is easy to see comparing the last fragment with the one above, this macro expands to nothing in the (usual) ANSI mode and prefixes {\tt 'L'} to its argument in the Unicode mode. @@ -145,7 +145,7 @@ Although everything works fine inside the program, things can get nasty when it tries to communicate with the outside world which, sadly, often expects ANSI strings (a notable exception is the entire Win32 API which accepts either Unicode or ANSI strings and which thus makes it unnecessary to ever perform -any convertions in the program). +any conversions in the program). To get a ANSI string from a wxString, you may use the mb\_str() function which always returns an ANSI @@ -156,5 +156,17 @@ useful, is wc\_str() function which always returns the Unicode string. % TODO describe fn_str(), wx_str(), wxCharBuf classes, ... -% Please remember to put a blank line at the end of each file! (Tex2RTF 'issue') + +\subsection{Unicode-related compilation settings} + +You should define {\tt wxUSE\_UNICODE} to $1$ to compile your program in +Unicode mode. Note that it currently only works in Win32 and that some parts of +wxWindows are not Unicode-compliant yet (ODBC classes, for example). If you +compile your program in ANSI mode you can still define {\tt wxUSE\_WCHAR\_T} +to get some limited support for {\tt wchar\_t} type. + +This will allow your program to perform conversions between Unicode strings and +ANSI ones (\helpref{wxEncodingConverter}{wxencodingconverter} depends on this +partially) and construct wxString objects from Unicode strings (presumably read +from some external file or elsewhere). diff --git a/docs/latex/wx/tvalidat.tex b/docs/latex/wx/tvalidat.tex index c64e6749ce..871797c76a 100644 --- a/docs/latex/wx/tvalidat.tex +++ b/docs/latex/wx/tvalidat.tex @@ -117,6 +117,6 @@ void wxDialog::OnOK(wxCommandEvent& event) So if using validators and a normal OK button, you may not even need to write any code for handling dialog dismissal. -If you load your dialog from a resource file, you'll need to iterate through the controls +If you load your dialog from a resource file, you will need to iterate through the controls setting validators, since validators can't be specified in a dialog resource. diff --git a/docs/latex/wx/txtstrm.tex b/docs/latex/wx/txtstrm.tex index 515ecbaf6e..08217a6d98 100644 --- a/docs/latex/wx/txtstrm.tex +++ b/docs/latex/wx/txtstrm.tex @@ -76,12 +76,41 @@ Reads a 32 bit integer from the stream. Reads a double (IEEE encoded) from the stream. +\membersection{wxTextInputStream::ReadLine}\label{wxtextinputstreamreadline} + +\func{wxString}{wxTextInputStream::ReadLine}{\void} + +Reads a line from the input stream and returns it (without the end of line +character). + \membersection{wxTextInputStream::ReadString} \func{wxString}{wxTextInputStream::ReadString}{\void} -Reads a line from the stream. A line is a string which ends with -$\backslash$n or $\backslash$r$\backslash$n or $\backslash$r. +{\bf NB:} This method is deprecated, use \helpref{ReadLine}{wxtextinputstreamreadline} +or \helpref{ReadWord}{wxtextinputstreamreadword} instead. + +Same as \helpref{ReadLine}{wxtextinputstreamreadline}. + +\membersection{wxTextInputStream::ReadWord}\label{wxtextinputstreamreadword} + +\func{wxString}{wxTextInputStream::ReadWord}{\void} + +Reads a word (a sequence of characters until the next separator) from the +input stream. + +\wxheading{See also} + +\helpref{SetStringSeparators}{wxtextinputstreamsetstringseparators} + +\membersection{wxTextInputStream::SetStringSeparators}\label{wxtextinputstreamsetstringseparators} + +\func{void}{SetStringSeparators}{\param{const wxString\& }{sep}} + +Sets the characters which are used to define the word boundaries in +\helpref{ReadWord}{wxtextinputstreamreadword}. + +The default separators are the space and {\tt TAB} characters. % ---------------------------------------------------------------------------- % wxTextOutputStream diff --git a/docs/latex/wx/up.gif b/docs/latex/wx/up.gif index 316d0d2a14b571bea2eb874efd04bfe509f53b34..870c89e80a826e3b225cc8fe9a30edf9c5a66c22 100644 GIT binary patch literal 998 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0f#WcPIEReKh6M+kIfS)hPHb3s zxLrWmYmUc8MFs{@V=tBk4vcQS3gSg?UKlR%Y*zN1W>fj;(a}CV`%O8V#mmmJDyQBv znOUrUdY)b7p%TfE<WsX;wdG=GmL&Ns@?GpT*Q<27-(3EUR##4aSao^5;NGM?9g}np z_6MXcGCdvoByvv1eJ&B}f}Gen<+rt#SZ_}_v)%vqI@ML?it&5Oe?N2Wl*mqONqVei lrfp&P=yaL+vexKtMaie;nK#$Ol;*#@ydrpYnS=m?H2|-sI%)s_ literal 137 zcmV;40CxXJNk%v~VHyA!0Pz3-zrVld=jU&4Z(9HWEC2ui02%-o0007FjE||ytzv+j zv|1owxcuhWh0?c)Avq0}dTQw^q7qBdoDA6WKJ*l>%gtCeAWZlgxpoy|ZDMRPr_m>p rx}08pS4?)u<%PW<QBYY9oyjHh?Q62&;&M&qj?e4yfxZ7PPyhfsDH=Ws diff --git a/docs/latex/wx/url.tex b/docs/latex/wx/url.tex index c1515239d9..c648fb918a 100644 --- a/docs/latex/wx/url.tex +++ b/docs/latex/wx/url.tex @@ -89,7 +89,7 @@ It can be one of these errors: \twocolitem{{\bf wxURL\_NOHOST}}{An host name is required for this protocol.} \twocolitem{{\bf wxURL\_NOPATH}}{A path is required for this protocol.} \twocolitem{{\bf wxURL\_CONNERR}}{Connection error.} -\twocolitem{{\bf wxURL\_PROTOERR}}{An error occured during negotiation.} +\twocolitem{{\bf wxURL\_PROTOERR}}{An error occurred during negotiation.} \end{twocollist}% % diff --git a/docs/latex/wx/variant.tex b/docs/latex/wx/variant.tex index f91ca59e14..f09ee5898c 100644 --- a/docs/latex/wx/variant.tex +++ b/docs/latex/wx/variant.tex @@ -45,7 +45,8 @@ Default constructor. Copy constructor. -\func{}{wxVariant}{\param{const char*}{ value}, \param{const wxString\& }{name = ``"}}\\ +\func{}{wxVariant}{\param{const char*}{ value}, \param{const wxString\& }{name = ``"}} + \func{}{wxVariant}{\param{const wxString\&}{ value}, \param{const wxString\& }{name = ``"}} Construction from a string value. diff --git a/docs/latex/wx/window.tex b/docs/latex/wx/window.tex index 6fe0c93dce..594ec21503 100644 --- a/docs/latex/wx/window.tex +++ b/docs/latex/wx/window.tex @@ -42,9 +42,9 @@ the application-wide policy is for 3D controls. Windows only.} wants to get all char events - even for keys like TAB or ENTER which are usually used for dialog navigation and which wouldn't be generated without this style} -\twocolitem{\windowstyle{wxNO\_FULLREPAINT\_ON\_RESIZE}}{Disables repainting +\twocolitem{\windowstyle{wxNO\_FULL\_REPAINT\_ON\_RESIZE}}{Disables repainting the window completely when its size is changed - you will have to repaint the -new window area manually if you use style. Currently only has effect for +new window area manually if you use this style. Currently only has an effect for Windows.} \twocolitem{\windowstyle{wxVSCROLL}}{Use this style to enable a vertical scrollbar. (Still used?) } \twocolitem{\windowstyle{wxHSCROLL}}{Use this style to enable a horizontal scrollbar. (Still used?) } @@ -60,7 +60,7 @@ See also \helpref{window styles overview}{windowstyles}. \latexignore{\rtfignore{\wxheading{Members}}} -\membersection{wxWindow::wxWindow} +\membersection{wxWindow::wxWindow}\label{wxwindowctor} \func{}{wxWindow}{\void} @@ -481,6 +481,12 @@ control label is not truncated. For windows containing subwindows (typically same as the size the window would have had after calling \helpref{Fit}{wxwindowfit}. +\membersection{wxWindow::GetCaret}\label{wxwindowgetcaret} + +\constfunc{wxCaret *}{GetCaret}{\void} + +Returns the \helpref{caret}{wxcaret} associated with the window. + \membersection{wxWindow::GetCharHeight} \constfunc{virtual int}{GetCharHeight}{\void} @@ -1534,6 +1540,11 @@ Note that the size passed is of the whole window: call \helpref{wxWindow::GetClientSize}{wxwindowgetclientsize} for the area which may be used by the application. +When a window is resized, usually only a small part of the window is damaged and you +may only need to repaint that area. However, if your drawing depends on the size of the window, +you may need to clear the DC explicitly and repaint the whole window. In which case, you +may need to call \helpref{wxWindow::Refresh}{wxwindowrefresh} to invalidate the entire window. + \wxheading{See also} \helpref{wxSizeEvent}{wxsizeevent},\rtfsp @@ -1738,7 +1749,7 @@ Physically scrolls the pixels in the window and move child windows accordingly. \docparam{rect}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler -can optimise painting by checking for the invalidated region. This paramter is ignored under GTK.} +can optimize painting by checking for the invalidated region. This parameter is ignored under GTK.} \wxheading{Remarks} @@ -1758,7 +1769,7 @@ Sets the accelerator table for this window. See \helpref{wxAcceleratorTable}{wxa Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will be called automatically when the window is resized. Use in connection with \helpref{wxWindow::SetSizer}{wxwindowsetsizer} and -\helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} for layouting subwindows. +\helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} for laying out subwindows. \wxheading{Parameters} @@ -1802,6 +1813,12 @@ look as the user wishes with run-time loadable modules. \helpref{wxWindow::Refresh}{wxwindowrefresh},\rtfsp \helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground} +\membersection{wxWindow::SetCaret}\label{wxwindowsetcaret} + +\constfunc{void}{SetCaret}{\param{wxCaret *}{caret}} + +Sets the \helpref{caret}{wxcaret} associated with the window. + \membersection{wxWindow::SetClientSize}\label{wxwindowsetclientsize} \func{virtual void}{SetClientSize}{\param{int}{ width}, \param{int}{ height}} @@ -1849,36 +1866,6 @@ be reset back to default. \helpref{::wxSetCursor}{wxsetcursor}, \helpref{wxCursor}{wxcursor} -\membersection{wxWindow::SetEventHandler}\label{wxwindowseteventhandler} - -\func{void}{SetEventHandler}{\param{wxEvtHandler* }{handler}} - -Sets the event handler for this window. - -\wxheading{Parameters} - -\docparam{handler}{Specifies the handler to be set.} - -\wxheading{Remarks} - -An event handler is an object that is capable of processing the events -sent to a window. By default, the window is its own event handler, but -an application may wish to substitute another, for example to allow -central implementation of event-handling for a variety of different -window classes. - -It is usually better to use \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} since -this sets up a chain of event handlers, where an event not handled by one event handler is -handed to the next one in the chain. - -\wxheading{See also} - -\helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp -\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp -\helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp -\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp -\helpref{wxEvtHandler}{wxevthandler} - \membersection{wxWindow::SetConstraints}\label{wxwindowsetconstraints} \func{void}{SetConstraints}{\param{wxLayoutConstraints* }{constraints}} @@ -1913,6 +1900,36 @@ If the window already has a drop target, it is deleted. \helpref{wxWindow::GetDropTarget}{wxwindowgetdroptarget}, \helpref{Drag and drop overview}{wxdndoverview} +\membersection{wxWindow::SetEventHandler}\label{wxwindowseteventhandler} + +\func{void}{SetEventHandler}{\param{wxEvtHandler* }{handler}} + +Sets the event handler for this window. + +\wxheading{Parameters} + +\docparam{handler}{Specifies the handler to be set.} + +\wxheading{Remarks} + +An event handler is an object that is capable of processing the events +sent to a window. By default, the window is its own event handler, but +an application may wish to substitute another, for example to allow +central implementation of event-handling for a variety of different +window classes. + +It is usually better to use \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} since +this sets up a chain of event handlers, where an event not handled by one event handler is +handed to the next one in the chain. + +\wxheading{See also} + +\helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp +\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp +\helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp +\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp +\helpref{wxEvtHandler}{wxevthandler} + \membersection{wxWindow::SetExtraStyle}\label{wxwindowsetextrastyle} \func{void}{SetExtraStyle}{\param{long }{exStyle}} @@ -2297,6 +2314,26 @@ Sets the window's title. Applicable only to frames and dialogs. Deletes the current validator (if any) and sets the window validator, having called wxValidator::Clone to create a new validator of this type. +\membersection{wxWindow::SetToolTip}\label{wxwindowsettooltip} + +\func{void}{SetToolTip}{\param{const wxString\& }{tip}} + +\func{void}{SetToolTip}{\param{wxToolTip* }{tip}} + +Attach a tooltip to the window. + +See also: \helpref{GetToolTip}{wxwindowgettooltip}, + \helpref{wxToolTip}{wxtooltip} + + +\membersection{wxWindow::GetToolTip}\label{wxwindowgettooltip} + +\constfunc{wxToolTip*}{GetToolTip}{\void} + +Get the associated tooltip or NULL if none. + + + \membersection{wxWindow::SetWindowStyle}\label{wxwindowsetwindowstyle} \func{void}{SetWindowStyle}{\param{long}{ style}} diff --git a/docs/latex/wx/wizard.tex b/docs/latex/wx/wizard.tex new file mode 100644 index 0000000000..10de3469b7 --- /dev/null +++ b/docs/latex/wx/wizard.tex @@ -0,0 +1,124 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: wizard.tex +%% Purpose: wxWizard class documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 02.04.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxWizard}}\label{wxwizard} + +wxWizard is the central class for implementing `wizard-like' dialogs. These +dialogs are mostly familiar to Windows users and are nothing else but a +sequence of `pages' each of them displayed inside a dialog which has the +buttons to pas to the next (and previous) pages. + +The wizards are typically used to decompose a complex dialog into several +simple steps and are mainly useful to the novice users, hence it is important +to keep them as simple as possible. + +To show a wizard dialog, you must first create an object of wxWizard class +using \helpref{Create}{wxwizardcreate} function. Then you should add all pages +you want the wizard to show and call \helpref{RunWizard}{wxwizardrunwizard}. +Finally, don't forget to call {\tt wizard->Destroy()}. + +\wxheading{Derived from} + +\helpref{wxDialog}{wxdialog}\\ +\helpref{wxPanel}{wxpanel}\\ +\helpref{wxWindow}{wxwindow}\\ +\helpref{wxEvtHandler}{wxevthandler}\\ +\helpref{wxObject}{wxobject} + +\wxheading{Include files} + +<wx/wizard.h> + +\wxheading{Event table macros} + +To process input from a wizard dialog, use these event handler macros to +direct input to member functions that take a +\helpref{wxWizardEvent}{wxwizardevent} argument. For some events, +\helpref{Veto()}{wxnotifyeventveto} can be called to prevent the event from +happening. + +\twocolwidtha{7cm} +\begin{twocollist}\itemsep=2pt +\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGED(id, func)}}{The page has been just +changed (this event can not be vetoed).} +\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGING(id, func)}}{The page is being +changed (this event can be vetoed).} +\twocolitem{{\bf EVT\_WIZARD\_CANCEL(id, func)}}{The user attempted to cancel +the wizard (this event may also be vetoed).} +\end{twocollist}% + +\wxheading{See also} + +\helpref{wxWizardEvent}{wxwizardevent}, \helpref{wxWizardPage}{wxwizardpage}, \helpref{wxWizard sample}{samplewizard} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxWizard::Create}\label{wxwizardcreate} + +\func{static wxWizard*}{Create}{\param{wxWindow* }{parent}, \param{int }{id = -1}, \param{const wxString\& }{title = wxEmptyString}, \param{const wxBitmap\& }{bitmap = wxNullBitmap}, \param{const wxPoint\& }{pos = wxDefaultPosition}} + +Creates the wizard dialog. The returned pointer should not be deleted +directly, you should rather call {\tt Destroy()} on it and wxWindows will +delete it itself. + +Notice that unlike almost all other wxWindows classes, there is no {\it size} +parameter in wxWizard constructor because the wizard will have a predefined +default size by default. If you want to change this, you should use the +\helpref{SetPageSize}{wxwizardsetpagesize} function. + +\wxheading{Parameters} + +\docparam{parent}{The parent window, may be NULL.} + +\docparam{id}{The id of the dialog, will usually be just $-1$.} + +\docparam{title}{The title of the dialog.} + +\docparam{bitmap}{The default bitmap used in the left side of the wizard. See +also \helpref{GetBitmap}{wxwizardpagegetbitmap}.} + +\docparam{pos}{The position of the dialog, it will be centered on the screen +by default.} + +\membersection{wxWizard::RunWizard}\label{wxwizardrunwizard} + +\func{bool}{RunWizard}{\param{wxWizardPage* }{firstPage}} + +Executes the wizard starting from the given page, returns {\tt TRUE} if it was +successfully finished or {\tt FALSE} if user cancelled it. The {\it firstPage} +can not be {\tt NULL}. + +\membersection{wxWizard::GetCurrentPage}\label{wxwizardgetcurrentpage} + +\constfunc{wxWizardPage*}{GetCurrentPage}{\void} + +Get the current page while the wizard is running. {\tt NULL} is returned if +\helpref{RunWizard()}{wxwizardrunwizard} is not being executed now. + +\membersection{wxWizard::GetPageSize}\label{wxwizardgetpagesize} + +\constfunc{wxSize}{GetPageSize}{\void} + +Returns the size available for the pages. + +\membersection{wxWizard::SetPageSize}\label{wxwizardsetpagesize} + +\func{void}{SetPageSize}{\param{const wxSize\& }{sizePage}} + +Sets the minimal size to be made available for the wizard pages. The wizard +will take into account the size of the bitmap (if any) itself. Also, the +wizard will never be smaller than the default size. + +The recommended way to use this function is to layout all wizard pages using +the sizers (even though the wizard is not resizeable) and then use +\helpref{wxSizer::CalcMin}{wxsizercalcmin} in a loop to calculate the maximum +of minimal sizes of the pages and pass it to SetPageSize(). + diff --git a/docs/latex/wx/wizevt.tex b/docs/latex/wx/wizevt.tex new file mode 100644 index 0000000000..e62e8667a3 --- /dev/null +++ b/docs/latex/wx/wizevt.tex @@ -0,0 +1,66 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: wizevt.tex +%% Purpose: wxWizardEvent class documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 02.04.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxWizardEvent}}\label{wxwizardevent} + +wxWizardEvent class represents an event generated by the +\helpref{wizard}{wxwizard}: this event is first sent to the page itself and, +if not processed there, goes up the window hierarchy as usual. + +\wxheading{Derived from} + +\helpref{wxNotifyEvent}{wxnotifyevent}\\ +\helpref{wxCommandEvent}{wxcommandevent}\\ +\helpref{wxEvent}{wxevent}\\ +\helpref{wxObject}{wxobject} + +\wxheading{Include files} + +<wx/wizard.h> + +\wxheading{Event table macros} + +To process input from a wizard dialog, use these event handler macros to +direct input to member functions that take a wxWizardEvent argument. + +\twocolwidtha{7cm} +\begin{twocollist}\itemsep=2pt +\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGED(id, func)}}{The page has been just +changed (this event can not be vetoed).} +\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGING(id, func)}}{The page is being +changed (this event can be vetoed).} +\twocolitem{{\bf EVT\_WIZARD\_CANCEL(id, func)}}{The user attempted to cancel +the wizard (this event may also be vetoed).} +\end{twocollist}% + +\wxheading{See also} + +\helpref{wxWizard}{wxwizard}, \helpref{wxWizard sample}{samplewizard} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxWizardEvent::wxWizardEvent}\label{wxwizardeventwxwizardevent} + +\func{}{wxWizardEvent}{\param{wxEventType }{type = wxEVT\_NULL}, \param{int }{id = -1}, \param{bool }{direction = TRUE}} + +Constructor. It is not normally used by the user code as the objects of this +type are constructed by wxWizard. + +\membersection{wxWizardEvent::GetDirection}\label{wxwizardeventgetdirection} + +\constfunc{bool}{GetDirection}{\void} + +Return the direction in which the page is changing: for {\tt +EVT\_WIZARD\_PAGE\_CHANGING}, return {\tt TRUE} if we're going forward or +FALSE otherwise and for {\tt EVT\_WIZARD\_PAGE\_CHANGED} return {\tt TRUE} if +we came from the previous page and {\tt FALSE} if we returned from the next +one. + diff --git a/docs/latex/wx/wizpage.tex b/docs/latex/wx/wizpage.tex new file mode 100644 index 0000000000..2418fe5dd5 --- /dev/null +++ b/docs/latex/wx/wizpage.tex @@ -0,0 +1,164 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: wizpage.tex +%% Purpose: wxWizardPage and wxWizardPageSimple classes documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 02.04.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxWizardPage}}\label{wxwizardpage} + +wxWizardPage is one of the screens in \helpref{wxWizard}{wxwizard}: it must +know what are the following and preceding pages (which may be {\tt NULL} for the +first/last page). Except for this extra knowledge, wxWizardPage is just a +panel, so the controls may be placed directly on it in the usual way. + +This class allows to decide what is the orde fo pages in the wizard +dynamically (during run-time) and so providex maximal flexibility. Usually, +however, the order of pages is known in advance in which case +\helpref{wxWizardPageSimple}{wxwizardpagesimple} class is enough and it is simpler +to use. + +\wxheading{Virtual functions to override} + +To use this class, you must override \helpref{GetPrev}{wxwizardpagegetprev} +and \helpref{GetNext}{wxwizardpagegetnext} pure virtual functions (or you +may use \helpref{wxWizardPageSimple}{wxwizardpagesimple} instead). + +\helpref{GetBitmap}{wxwizardpagegetbitmap} can also be overridden, but this +should be very rarely needed. + +\wxheading{Derived from} + +\helpref{wxPanel}{wxpanel}\\ +\helpref{wxWindow}{wxwindow}\\ +\helpref{wxEvtHandler}{wxevthandler}\\ +\helpref{wxObject}{wxobject} + +\wxheading{Include files} + +<wx/wizard.h> + +\wxheading{See also} + +\helpref{wxWizard}{wxwizard}, \helpref{wxWizard sample}{samplewizard} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxWizardPage::wxWizardPage}\label{wxwizardpagewxwizardpage} + +\func{}{wxWizardPage}{\param{wxWizard* }{parent}, \param{const wxBitmap\& }{bitmap = wxNullBitmap}} + +Constructor accepts an optional bitmap which will be used for this page +instead of the default one for this wizard (note that all bitmaps used should +be of the same size). Notice that no other parameters are needed because the +wizard will resize and reposition the page anyhow. + +\membersection{wxWizardPage::GetPrev}\label{wxwizardpagegetprev} + +\constfunc{wxWizardPage*}{GetPrev}{\void} + +Get the page which should be shown when the user chooses the {\tt "Back"} +button: if {\tt NULL} is returned, this button will be disabled. The first +page of the wizard will usually return {\tt NULL} from here, but the others +will not. + +\wxheading{See also} + +\helpref{GetNext}{wxwizardpagegetnext} + +\membersection{wxWizardPage::GetNext}\label{wxwizardpagegetnext} + +\constfunc{wxWizardPage*}{GetNext}{\void} + +Get the page which should be shown when the user chooses the {\tt "Next"} +button: if {\tt NULL} is returned, this button will be disabled. The last +page of the wizard will usually return {\tt NULL} from here, but the others +will not. + +\wxheading{See also} + +\helpref{GetPrev}{wxwizardpagegetprev} + +\membersection{wxWizardPage::GetBitmap}\label{wxwizardpagegetbitmap} + +\constfunc{wxBitmap}{GetBitmap}{\void} + +This method is called by wxWizard to get the bitmap to display alongside the +page. By default, {\tt m\_bitmap} member variable which was set in the +\helpref{constructor}{wxwizardpagewxwizardpage}. + +If the bitmap was not explicitly set (i.e. if {\tt wxNullBitmap} is returned), +the default bitmap for the wizard should be used. + +The only cases when you would want to override this function is if the page +bitmap depends dynamically on the user choices, i.e. almost never. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxWizardPageSimple %%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{\class{wxWizardPageSimple}}\label{wxwizardpagesimple} + +wxWizardPageSimple is the simplest possible +\helpref{wxWizardPage}{wxwizardpage} implementation: it just returns the +pointers given to its constructor from GetNext() and GetPrev() functions. + +This makes it very easy to use the obejcts of this class in the wizards where +the pages order is known statically - on the other hand, if this is not the +case you must derive your own class from \helpref{wxWizardPage}{wxwizardpage} +instead. + +\wxheading{Derived from} + +\helpref{wxWizardPage}{wxwizardpage}\\ +\helpref{wxPanel}{wxpanel}\\ +\helpref{wxWindow}{wxwindow}\\ +\helpref{wxEvtHandler}{wxevthandler}\\ +\helpref{wxObject}{wxobject} + +\wxheading{Include files} + +<wx/wizard.h> + +\wxheading{See also} + +\helpref{wxWizard}{wxwizard}, \helpref{wxWizard sample}{samplewizard} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxWizardPageSimple::wxWizardPageSimple}\label{wxwizardpagesimplewxwizardpagesimple} + +\func{}{wxWizardPageSimple}{\param{wxWizard* }{parent = NULL}, \param{wxWizardPage* }{prev = NULL}, \param{wxWizardPage* }{next = NULL}} + +Constructor takes the previous and next pages. They may be modified later by +\helpref{SetPrev()}{wxwizardpagesimplesetprev} or +\helpref{SetNext()}{wxwizardpagesimplesetnext}. + +\membersection{wxWizardPageSimple::SetPrev}\label{wxwizardpagesimplesetprev} + +\func{void}{SetPrev}{\param{wxWizardPage* }{prev}} + +Sets the previous page. + +\membersection{wxWizardPageSimple::SetNext}\label{wxwizardpagesimplesetnext} + +\func{void}{SetNext}{\param{wxWizardPage* }{next}} + +Sets the next page. + +\membersection{wxWizardPageSimple::Chain}\label{wxwizardpagesimplechain} + +\func{static void}{Chain}{\param{wxWizardPageSimple* }{first}, \param{wxWizardPageSimple* }{second}} + +A convenience function to make the pages follow each other. + +Example: +\begin{verbatim} + wxRadioboxPage *page3 = new wxRadioboxPage(wizard); + wxValidationPage *page4 = new wxValidationPage(wizard); + + wxWizardPageSimple::Chain(page3, page4); +\end{verbatim} + diff --git a/docs/latex/wx/wnddisbl.tex b/docs/latex/wx/wnddisbl.tex index efd93453b4..798dae3dd7 100644 --- a/docs/latex/wx/wnddisbl.tex +++ b/docs/latex/wx/wnddisbl.tex @@ -6,7 +6,7 @@ %% Created: 03.03.00 %% RCS-ID: $Id$ %% Copyright: (c) Vadim Zeitlin -%% Licence: wxWindows licence +%% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxWindowDisabler}}\label{wxwindowdisabler} diff --git a/docs/latex/wx/wxPython.tex b/docs/latex/wx/wxPython.tex index 53d6881842..9a725ee0be 100644 --- a/docs/latex/wx/wxPython.tex +++ b/docs/latex/wx/wxPython.tex @@ -35,8 +35,8 @@ wxPython is a Python package that can be imported at runtime that includes a collection of Python modules and an extension module (native code). It provides a series of Python classes that mirror (or shadow) many of the wxWindows GUI classes. This extension module -attempts to mirror the class heiarchy of wxWindows as closely as -possble. This means that there is a wxFrame class in wxPython that +attempts to mirror the class heirarchy of wxWindows as closely as +possible. This means that there is a wxFrame class in wxPython that looks, smells, tastes and acts almost the same as the wxFrame class in the C++ version. @@ -55,7 +55,7 @@ details about getting wxPython working for you. So why would you want to use wxPython over just C++ and wxWindows? Personally I prefer using Python for everything. I only use C++ when I absolutely have to eek more performance out of an algorithm, and even -then I ususally code it as an extension module and leave the majority +then I usually code it as an extension module and leave the majority of the program in Python. Another good thing to use wxPython for is quick prototyping of your @@ -80,7 +80,7 @@ This has its upsides and its downsides... The upside is that Tk is a pretty versatile toolkit. It can be made to do a lot of things in a lot of different environments. It is fairly -easy to create new widgets and use them interchangably in your +easy to create new widgets and use them interchangeably in your programs. The downside is Tcl. When using Tkinter you actually have two @@ -89,7 +89,7 @@ Tcl interpreter for the GUI. Since the guts of Tcl is mostly about string processing, it is fairly slow as well. (Not too bad on a fast Pentium II, but you really notice the difference on slower machines.) -It wasn't until the lastest version of Tcl/Tk that native Look and +It wasn't until the latest version of Tcl/Tk that native Look and Feel was possible on non-Motif platforms. This is because Tk usually implements its own widgets (controls) even when there are native controls available. @@ -111,9 +111,9 @@ to use the GUI portions. \wxheading{Others} There are quite a few other GUI modules available for Python, some in -active use, some that havn't been updated for ages. Most are simple +active use, some that haven't been updated for ages. Most are simple wrappers around some C or C++ toolkit or another, and most are not -cross-platform compatible. See \urlref{this link}{http://www.python.org/download/Contributed.html\#Graphics} +cross-platform compatible. See \urlref{this link}{http://www.python.org/download/Contributed.html\#Graphics} for a listing of a few of them. %---------------------------------------------------------------------- @@ -123,7 +123,7 @@ I used SWIG (\urlref{http://www.swig.org}{http://www.swig.org}) to to create the source code for the extension module. This enabled me to only have to deal with a small amount of code and only have to bother with the exceptional issues. -SWIG takes care of the rest and generates all the repetative code for +SWIG takes care of the rest and generates all the repetitive code for me. You don't need SWIG to build the extension module as all the generated C++ code is included under the src directory. @@ -173,7 +173,7 @@ The build.py script actually generates a Makefile based on what it finds on your system and information found in the build.cfg file. If you have troubles building or you want it built or installed in a different way, take a look at the docstring in build.py. You are -able to to override many configuration options in a file named +able to override many configuration options in a file named build.local. \item To build and install the add-on modules, change to the appropriate directory under {\tt \$(WXWIN)/utils/wxPython/modules} and run the build @@ -300,7 +300,7 @@ methods of the class. These helper functions are intended to be like the event table macros that wxWindows employs. But since static event tables are impossible with wxPython, we use helpers that are named the same to dynamically build the table. The only real difference is -that the first arguemnt to the event helpers is always the window that +that the first argument to the event helpers is always the window that the event table entry should be added to. \item Notice the use of {\tt wxDLG\_PNT} and {\tt wxDLG\_SZE} in lines 19 - 29 to convert from dialog units to pixels. These helpers are unique @@ -311,14 +311,14 @@ called? The answer is, yes it does. This is because many of the {\em standard} events are attached to windows that have the associated {\em standard} method names. I have tried to follow the lead of the C++ classes in this area to determine what is {\em standard} but since -that changes from time to time I can make no guarentees, nor will it +that changes from time to time I can make no guarantees, nor will it be fully documented. When in doubt, use an EVT\_*** function. \item At lines 17 to 21 notice that there are no saved references to the panel or the static text items that are created. Those of you who know Python might be wondering what happens when Python deletes these objects when they go out of scope. Do they disappear from the GUI? They don't. Remember that in wxPython the Python objects are just shadows of the -coresponding C++ objects. Once the C++ windows and controls are +corresponding C++ objects. Once the C++ windows and controls are attached to their parents, the parents manage them and delete them when necessary. For this reason, most wxPython objects do not need to have a \_\_del\_\_ method that explicitly causes the C++ object to be @@ -360,6 +360,7 @@ as possible to the C++ spec over time. \item \helpref{wxBusyCursor}{wxbusycursor} \item \helpref{wxButton}{wxbutton} \item \helpref{wxCalculateLayoutEvent}{wxcalculatelayoutevent} +\item \helpref{wxCalendarCtrl}{wxcalendarctrl} \item wxCaret \item \helpref{wxCheckBox}{wxcheckbox} \item \helpref{wxCheckListBox}{wxchecklistbox} @@ -380,15 +381,19 @@ as possible to the C++ spec over time. \item \helpref{wxDataObject}{wxdataobject} \item \helpref{wxDataObjectComposite}{wxdataobjectcomposite} \item \helpref{wxDataObjectSimple}{wxdataobjectsimple} +\item \helpref{wxDateTime}{wxdatetime} +\item \helpref{wxDateSpan}{wxdatespan} \item \helpref{wxDC}{wxdc} \item \helpref{wxDialog}{wxdialog} \item \helpref{wxDirDialog}{wxdirdialog} +\item \helpref{wxDragImage}{wxdragimage} \item \helpref{wxDropFilesEvent}{wxdropfilesevent} \item \helpref{wxDropSource}{wxdropsource} \item \helpref{wxDropTarget}{wxdroptarget} \item \helpref{wxEraseEvent}{wxeraseevent} \item \helpref{wxEvent}{wxevent} \item \helpref{wxEvtHandler}{wxevthandler} +\item wxFileConfig \item \helpref{wxFileDataObject}{wxfiledataobject} \item \helpref{wxFileDialog}{wxfiledialog} \item \helpref{wxFileDropTarget}{wxfiledroptarget} @@ -400,9 +405,11 @@ as possible to the C++ spec over time. \item \helpref{wxGauge}{wxgauge} \item wxGIFHandler \item wxGLCanvas +\begin{comment} \item wxGridCell \item wxGridEvent \item \helpref{wxGrid}{wxgrid} +\end{comment} \item \helpref{wxHtmlCell}{wxhtmlcell} \item \helpref{wxHtmlContainerCell}{wxhtmlcontainercell} \item \helpref{wxHtmlDCRenderer}{wxhtmldcrenderer} @@ -504,6 +511,9 @@ as possible to the C++ spec over time. \item \helpref{wxTextDropTarget}{wxtextdroptarget} \item \helpref{wxTextEntryDialog}{wxtextentrydialog} \item \helpref{wxTimer}{wxtimer} +\item \helpref{wxTimerEvent}{wxtimerevent} +\item \helpref{wxTimeSpan}{wxtimespan} +\item \helpref{wxTipProvider}{wxtipprovider} \item wxToolBarTool \item \helpref{wxToolBar}{wxtoolbar} \item wxToolTip @@ -521,15 +531,16 @@ as possible to the C++ spec over time. \section{Where to go for help}\label{wxphelp} Since wxPython is a blending of multiple technologies, help comes from -multiple sources. See -\urlref{http://alldunn.com/wxPython}{http://alldunn.com/wxPython} for details on +multiple sources. See +\urlref{http://wxpython.org/}{http://wxpython.org/} for details on various sources of help, but probably the best source is the wxPython-users mail list. You can view the archive or subscribe by going to -\urlref{http://starship.python.net/mailman/listinfo/wxpython-users}{http://starship.python.net/mailman/listinfo/wxpython-users} +\urlref{http://wxwindows.org/mailman/listinfo/wxpython-users}{http://wxwindows.org/mailman/listinfo/wxpython-users} Or you can send mail directly to the list using this address: -wxpython-users@starship.python.net +wxpython-users@wxwindows.org + diff --git a/docs/latex/wx/wxhtml.tex b/docs/latex/wx/wxhtml.tex index 2375de3b12..9a72e5bd90 100644 --- a/docs/latex/wx/wxhtml.tex +++ b/docs/latex/wx/wxhtml.tex @@ -7,10 +7,8 @@ This addendum is written by Vaclav Slavik, the author of the wxHTML library. The wxHTML library provides classes for parsing and displaying HTML. -(It is not intended to be a high-end HTML browser. If you're looking for -something like that try \urlref{http://www.mozilla.org}{http://www.mozilla.org} - there's a -chance you'll be able to make their widget wxWindows-compatible. I'm sure -everyone will enjoy your work in that case...) +(It is not intended to be a high-end HTML browser. If you are looking for +something like that try \urlref{http://www.mozilla.org}{http://www.mozilla.org}) wxHTML can be used as a generic rich text viewer - for example to display a nice About Box (like those of GNOME apps) or to display the result of @@ -22,7 +20,7 @@ extend wxHtml library with new, unsupported tags. Not only that, you can even use your own application specific tags! See lib/mod\_*.cpp files for details. -There is a generic (non-wxHtmlWindow) wxHtmlParser class. +There is a generic (i.e. independent on wxHtmlWindow) wxHtmlParser class. \input htmlstrt.tex \input htmlprn.tex diff --git a/docs/latex/wx/wxstring.tex b/docs/latex/wx/wxstring.tex index 9c82d7fb3e..94157dacf4 100644 --- a/docs/latex/wx/wxstring.tex +++ b/docs/latex/wx/wxstring.tex @@ -93,16 +93,22 @@ insensitive comparisons you should use \helpref{CmpNoCase}{wxstringcmpnocase} or give a second parameter to IsSameAs. This last function is may be more convenient if only equality of the strings matters because it returns a boolean true value if the strings are the same and not 0 (which is usually FALSE in C) -as Cmp does. +as {\tt Cmp()} does. \helpref{Matches}{wxstringmatches} is a poor man's regular expression matcher: it only understands '*' and '?' metacharacters in the sense of DOS command line interpreter. +\helpref{StartsWith}{wxstringstartswith} is helpful when parsing a line of +text which should start with some predefined prefix and is more efficient than +doing direct string comparaison as you would also have to precalculate the +length of the prefix then. + \helpref{Cmp}{wxstringcmp}\\ \helpref{CmpNoCase}{wxstringcmpnocase}\\ \helpref{IsSameAs}{wxstringissameas}\\ -\helpref{Matches}{wxstringmatches} +\helpref{Matches}{wxstringmatches}\\ +\helpref{StartsWith}{wxstringstartswith} \membersection{Substring extraction} @@ -117,7 +123,8 @@ substring. \helpref{BeforeFirst}{wxstringbeforefirst}\\ \helpref{BeforeLast}{wxstringbeforelast}\\ \helpref{AfterFirst}{wxstringafterfirst}\\ -\helpref{AfterLast}{wxstringafterlast} +\helpref{AfterLast}{wxstringafterlast}\\ +\helpref{StartsWith}{wxstringstartswith} \membersection{Case conversion} @@ -196,9 +203,9 @@ Other string functions. \helpref{Pad}{wxstringpad}\\ \helpref{Truncate}{wxstringtruncate} -\membersection{wxWindows 1.xx compatiblity functions} +\membersection{wxWindows 1.xx compatibility functions} -These functiosn are deprecated, please consider using new wxWindows 2.0 +These functions are deprecated, please consider using new wxWindows 2.0 functions instead of them (or, even better, std::string compatible variants). \helpref{SubString}{wxstringsubstring}\\ @@ -395,7 +402,14 @@ Constructs a string of {\it n} copies of character {\it ch}. \func{}{wxString}{\param{const char*}{ psz}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}} Takes first {\it nLength} characters from the C string {\it psz}. -The default value of wxSTRING\_MAXLEN means take all the string. +The default value of wxSTRING\_MAXLEN means to take all the string. + +Note that this constructor may be used even if {\it psz} points to a buffer +with binary data (i.e. containing {\tt NUL} characters) as long as you provide +the correct value for {\it nLength}. However, the default form of it works +only with strings without intermediate {\tt NUL}s because it uses +{\tt strlen()} to calculate the effective length and it would not give correct +results otherwise. \func{}{wxString}{\param{const unsigned char*}{ psz}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}} @@ -509,7 +523,7 @@ See also: \helpref{Empty}{wxstringempty} Case-sensitive comparison. Returns a positive value if the string is greater than the argument, zero if -it si equal to it or negative value if it is less than argument (same semantics +it is equal to it or a negative value if it is less than the argument (same semantics as the standard {\it strcmp()} function). See also \helpref{CmpNoCase}{wxstringcmpnocase}, \helpref{IsSameAs}{wxstringissameas}. @@ -521,7 +535,7 @@ See also \helpref{CmpNoCase}{wxstringcmpnocase}, \helpref{IsSameAs}{wxstringissa Case-insensitive comparison. Returns a positive value if the string is greater than the argument, zero if -it si equal to it or negative value if it is less than argument (same semantics +it is equal to it or a negative value if it is less than the argument (same semantics as the standard {\it strcmp()} function). See also \helpref{Cmp}{wxstringcmp}, \helpref{IsSameAs}{wxstringissameas}. @@ -597,9 +611,9 @@ This static function returns the string containing the result of calling \membersection{wxString::Freq}\label{wxstringfreq} -\constfunc{int}{Frec}{\param{char }{ch}} +\constfunc{int}{Freq}{\param{char }{ch}} -Returns the number of occurences of {it ch} in the string. +Returns the number of occurrences of {\it ch} in the string. \membersection{wxString::GetChar}\label{wxstringgetchar} @@ -677,7 +691,7 @@ Returns TRUE if the string is NULL (same as IsEmpty). \constfunc{bool}{IsNumber}{\void} -Returns TRUE if the string is a number. +Returns TRUE if the string is a positive or negative integer. Will return FALSE for decimals. \membersection{wxString::IsSameAs}\label{wxstringissameas} @@ -862,6 +876,16 @@ Minimizes the string's memory. This can be useful after a call to The same as Printf. +\membersection{wxString::StartsWith}\label{wxstringstartswith} + +\constfunc{bool}{StartsWith}{\param{const wxChar }{*prefix}, \param{wxString }{*rest = NULL}} + +This function can be used to test if the string starts with the specified +{\it prefix}. If it does, the function will return {\tt TRUE} and put the rest +of the string (i.e. after the prefix) into {\it rest} string if it is not +{\tt NULL}. Otherwise, the function returns {\tt FALSE} and doesn't modify the +{\it rest}. + \membersection{wxString::Strip}\label{wxstringstrip} \begin{verbatim} @@ -875,34 +899,49 @@ doesn't change this string. \membersection{wxString::SubString}\label{wxstringsubstring} -\constfunc{wxString}{SubString}{\param{size\_t}{ to}, \param{size\_t}{ from}} +\constfunc{wxString}{SubString}{\param{size\_t}{ from}, \param{size\_t}{ to}} Same as \helpref{Mid}{wxstringmid}. \membersection{wxString::ToDouble}\label{wxstringtodouble} -\constfunc{bool}{To}{\param{double}{ *val}} +\constfunc{bool}{ToDouble}{\param{double}{ *val}} Attempts to convert the string to a floating point number. Returns TRUE on -suceess (the number is stored in the location pointed to by {\it val}) or FALSE +success (the number is stored in the location pointed to by {\it val}) or FALSE if the string does not represent such number. +\wxheading{See also} + +\helpref{wxString::ToLong}{wxstringtolong},\\ +\helpref{wxString::ToULong}{wxstringtoulong} + \membersection{wxString::ToLong}\label{wxstringtolong} -\constfunc{bool}{To}{\param{long}{ *val}} +\constfunc{bool}{ToLong}{\param{long}{ *val}} -Attempts to convert the string to a signed integer. Returns TRUE on suceess +Attempts to convert the string to a signed integer. Returns TRUE on success (the number is stored in the location pointed to by {\it val}) or FALSE if the string does not represent such number. +\wxheading{See also} + +\helpref{wxString::ToDouble}{wxstringtodouble},\\ +\helpref{wxString::ToULong}{wxstringtoulong} + \membersection{wxString::ToULong}\label{wxstringtoulong} -\constfunc{bool}{To}{\param{unsigned long}{ *val}} +\constfunc{bool}{ToULong}{\param{unsigned long}{ *val}} -Attempts to convert the string to an unsigned integer. Returns TRUE on suceess +Attempts to convert the string to an unsigned integer. Returns TRUE on success (the number is stored in the location pointed to by {\it val}) or FALSE if the string does not represent such number. +\wxheading{See also} + +\helpref{wxString::ToDouble}{wxstringtodouble},\\ +\helpref{wxString::ToLong}{wxstringtolong} + \membersection{wxString::Trim}\label{wxstringtrim} \func{wxString\&}{Trim}{\param{bool}{ fromRight = TRUE}} @@ -960,7 +999,7 @@ See also \helpref{IsEmpty()}{wxstringisempty}. Assignment: the effect of each operation is the same as for the corresponding constructor (see \helpref{wxString constructors}{wxstringconstruct}). -\membersection{operator wxString::$+$}\label{wxstringoperatorplus} +\membersection{wxString::operator $+$}\label{wxstringoperatorplus} Concatenation: all these operators return a new strign equal to the sum of the operands. diff --git a/docs/latex/wx/zipstrm.tex b/docs/latex/wx/zipstrm.tex index c2864364aa..33a4f3ff0b 100644 --- a/docs/latex/wx/zipstrm.tex +++ b/docs/latex/wx/zipstrm.tex @@ -9,6 +9,13 @@ This class is input stream from ZIP archive. The archive must be local file (accessible via FILE*). It has all features including GetSize and seeking. +\wxheading{Note} + +If you need to enumerate files in ZIP archive, you can use +\helpref{wxFileSystem}{wxfilesystem} together with wxZipFSHandler (see +\helpref{the overview}{fs}. + + \wxheading{Derived from} \helpref{wxInputStream}{wxinputstream} diff --git a/docs/motif/install.txt b/docs/motif/install.txt index 9d5feda8f1..294b687db6 100644 --- a/docs/motif/install.txt +++ b/docs/motif/install.txt @@ -1,4 +1,4 @@ -wxWindows 2.1 for Motif installation +wxWindows 2.2 for Motif installation ------------------------------------ IMPORTANT NOTE: @@ -11,7 +11,7 @@ IMPORTANT NOTE: When sending bug reports tell us what version of wxWindows you are using (including the beta) and what compiler on what system. One - example: wxMotif 2.1 beta 6, egcs 1.1.1, Redhat 5.0 + example: wxMotif 2.2.0, egcs 1.1.1, Redhat 5.0 First steps ----------- @@ -19,17 +19,12 @@ First steps - Prerequisites: Motif 1.2 or above, or Lesstif (not yet tested). Motif 2.0 and above may also be suitable. -- Download the appropriate .tgz archive, or alternatively the files - wx2_x_y_gen.zip and wx2_x_y_mot.zip. Download documentation in a - preferred format, such as wx2_x_y_htm.zip or wx2_x_y_pdf.zip. +- Download wxMotif-x.y.z.tgz, where x.y.z is the version number. + Download documentation in a preferred format, such as + wxWindows-HTML.zip or wxWindows-PDF.zip. - Make a directory such as ~/wx and unarchive the files into this - directory. If using the zip archives, use the -a option if available - to convert the ASCII files to Unix format. Don't worry about files being - overwritten: they should be identical anyway. - - (See http://www.cdrom.com/pub/infozip/ if you don't have zip/unzip - already installed. Zip isn't the same as gzip!) + directory. - It is recommended that you install bison and flex; using yacc and lex may require tweaking of the makefiles. You also need diff --git a/docs/motif/issues.txt b/docs/motif/issues.txt index 5bb2656c0e..98a32d4f3e 100644 --- a/docs/motif/issues.txt +++ b/docs/motif/issues.txt @@ -5,6 +5,8 @@ Last updated 19/3/2000. See also: todo.txt. +- Sockets not yet working since idle wake-up not implemented. + - wxTextCtrl doesn't work as a stream buffer in Linux/gcc. - No wxSpinButton. @@ -21,14 +23,22 @@ See also: todo.txt. e.g. wxScrolledWindows, so maybe have wxSystemSettings value for scrollbar colour, and/or ability to set scrollbar colour independently. -- wxFrame can accept events, but apps cannot draw into it for some reason, - so the rotate sample won't work. Workaround: use an embedded wxWindow. +- wxFrame can accept events, but apps cannot draw into it for + Workaround: use an embedded wxWindow. + +- The background of a window sometimes isn't restored when changing + notebook pages (see sashtest, mdi examples). The notebook background + colour shows through. A resize, or scroll, restores the correct + background colour. - In Life! sample, text above slider isn't legible. -- samples/html/helpview and samples/help show a problem when showing - the advanced HTML help controller: a BadDrawable X error occurs - (unfortunately hard to tell where). Somewhere in wxHtmlHelpFrame. +- samples/html/helpview and samples/help demonstrate that sometimes, + XPM images can't be loaded, perhaps only in 256-colour mode. This + will now cause an assert rather than an X error. But we need to + either cure the XPM loading problem, or provide alternative toolbar + buttons (for HelpView) and icons (for places where icons are used e.g. + in the log dialog). - Dialog Editor needs a lot of work. diff --git a/docs/motif/makewxmotif b/docs/motif/makewxmotif index 3146edfe56..bed60a303b 100644 --- a/docs/motif/makewxmotif +++ b/docs/motif/makewxmotif @@ -6,6 +6,6 @@ # if you're feeling brave, you may wish to compile with threads. # -- Julian Smart rm -f *.cache -chmod a+x configure config.sub config.guess samples/configure contrib/configure +chmod a+x configure config.sub config.guess samples/configure demos/configure contrib/configure ./configure --disable-shared --with-motif --without-gtk --with-debug_flag --with-debug_info --enable-debug --without-sockets --without-odbc --without-threads --enable-newgrid make diff --git a/docs/motif/readme.txt b/docs/motif/readme.txt index 442b0681ef..700075daf3 100644 --- a/docs/motif/readme.txt +++ b/docs/motif/readme.txt @@ -1,14 +1,8 @@ - Welcome to wxWindows/Motif 2.1.14 + Welcome to wxWindows/Motif 2.2.0 -You have downloaded version 2.1.14 of the Motif port of -the wxWindows GUI library. Although this is not yet the -final stable release wxMotif 2.2, the current version has -been tested carefully on many systems and has been found -to work better than any other previous version. - -This is the last beta release. wxWindows is now in a code -freeze and only bugs will be corrected. +You have downloaded version 2.2.0 of the Motif port of +the wxWindows GUI library. More information about the wxWindows project as a whole can be found at: @@ -39,7 +33,7 @@ Alternatively, you may also use the bug reporting system linked from the wxWindows web page. The library produced by the install process will be called -libwx_motif.a (static) and libwx_motif-2.1.so.14.0.0 (shared) so that +libwx_motif.a (static) and libwx_motif-2.2.so.0.0.0 (shared) so that once a binary incompatible version of wxWindows/Motif comes out we'll augment the library version number to avoid linking problems. diff --git a/docs/msw/install.txt b/docs/msw/install.txt index 2444068794..279aab16a4 100644 --- a/docs/msw/install.txt +++ b/docs/msw/install.txt @@ -1,11 +1,9 @@ -Installing wxWindows 2.1 +Installing wxWindows 2.2 ------------------------ -This is a beta release of wxWindows 2.1 for Microsoft -Windows 95, 98 and NT. This is not a production release, -although a huge number of bugs found in earlier versions -of wxWindows have been fixed. +This is wxWindows 2.2 for Microsoft Windows 3.1, 95, 98 and +Windows NT/Windows 2000. This is an official, stable release. IMPORTANT NOTE: If you experience problems installing, please re-read this instructions and other related files (changes.txt, @@ -34,20 +32,8 @@ program contains the following: - Tex2RTF source; - Dialog Editor binary. -Alternatively, you may unarchive the set of .zip files by hand, -where x is the minor version number and y is the release number: - -wx2_x_y_gen.zip Generic source code and samples (required) -wx2_x_y_msw.zip Windows-specific source code and samples (required) -wx2_x_y_doc.zip Documentation source code (not required) -wx2_x_y_hlp.zip WinHelp documentation -wx2_x_y_pdf.zip Acrobat PDF documentation -wx2_x_y_htm.zip HTML documentation -wx2_x_y_vc.zip MS VC++ 5.0 project files -wx2_x_y_cw.zip Metrowerks CodeWarrior project files -wx2_x_y_bc.zip BC++ 5 project files -jpeg.zip Use this to allow wxImage to read and write JPEG files -tiff.zip Use this to allow wxImage to read and write TIFF files +Alternatively, you may unarchive the .zip form by hand: +wxMSW-x.y.z.zip where x.y.z is the version number. Unarchive the required files plus any optional documentation files into a suitable directory such as c:\wx. @@ -81,7 +67,8 @@ Visual C++ 4.0/5.0/6.0 compilation Using project files (VC++ 5 and 6 only): -1. Unarchive wx2_x_y_vc.zip, the VC++ 5/6 project makefiles. +1. Unarchive wxWindows-x.y.z-vc.zip, the VC++ 5/6 project + makefiles (already included in wxMSW-x.y.z.zip and the setup version). 2. Open src/wxvc.dsp, set Debug or Release configuration for the wxvc project, and compile. Alternatively, use Batch Build to build both Debug and Release configurations. @@ -199,12 +186,13 @@ the project. After this, delete everything (including PCH) and recompile. Note (5): for some further notes about upgrading your project files to be compatible with wxWindows 2.1.14, please see -"Highlights of wxWindows 2.1.14" from the Download page of the +"Highlights of wxWindows" from the Download page of the web site or CD-ROM. Note (6): to create your own IDE files, see the technical note on the wxWindows web site or CD-ROM, entitled "Compiling wxWindows -applications in the VC++ IDE". You can also copy .dsp and .dsw +applications in the VC++ IDE" (technical note docs/tech/tn0010.htm in the +wxWindows distribution). You can also copy .dsp and .dsw files from an existing wxWindows sample and adapt them. Visual C++ 1.5 compilation (16-bit) @@ -239,6 +227,13 @@ Compiling using the makefiles: 'make -f makefile.b32 clean' 'make -f makefile.b32 FINAL=1' for the library and samples. +5. To make and use wxWindows as a DLL, type + 'make -f makefile.b32 clean' + 'make -f makefile.b32 DLL=1' + and then for each sample, + 'make -f makefile.b32 WXUSINGDLL=1' + Please note that the samples have not been exhaustively tested + with this configuration. Note (1): the wxWindows library and (some) samples compile in 16-bit mode using makefile.bcc, but at present the wxWindows resource system is switched @@ -299,16 +294,104 @@ some samples) you need to compile them with bc32.ide. Note (3): the debug version of the wxWindows library is about 40 MB, and the release version is around 5 MB. -See also the file bc_ide.txt for further instructions and details +See also the file docs/tech/tn0007.txt for further instructions and details of how to create your own project files. +Borland C++ 5.5 compilation +--------------------------- + +Before compiling wxWindows with Borland C++ 5.5, there are a few +issues concerning the compiler installation: + +1. The compiler must be installed to a path that does not contain + spaces, such as c:\Borland\Bcc55 (in particular, do not install + it below "C:\Program Files"). + +2. Make sure that you downloaded and installed the service pack 1 + for Borland C++ 5.5. This SP1 can be downloaded from: + http://www.borland.com/devsupport/bcppbuilder/file_supplements.html + + IMPORTANT: + When installing SP1, make sure that you extract (UnZip) the files + to the directory where you installed Borland C++ 5.5 (e.g., + c:\Borland\Bcc55) with the option "use folder names" selected. + This is necessary, to ensure that the files (mostly include files) + are extracted to the right directory. + +3. Create the following two files in the same directory where you + installed Borland C++ 5.5 (e.g., c:\Borland\Bcc55): + + a. bcc32.cfg + text file containing the following two lines: + -I"c:\Borland\Bcc55\include" + -L"c:\Borland\Bcc55\lib" + + b. ilink32.cfg + text file containing the following line: + -L"c:\Borland\Bcc55\lib" + + (replace c:\Borland\Bcc55 with the actual path where you installed + Borland C++ 5.5) + +4. Add the borland BIN directory to your path (e.g., c:\Borland\Bcc55\bin), + and define the environment variable BCCDIR=<Borland C++ 5.5 path> + (e.g., set BCCDIR=c:\Borland\Bcc55) + +Compiling wxWindows: + +Once the compiler and its service pack are properly installed, you build +wxWindows using the provided makefile.b32 in the src/msw directory: + +a. To build wxWindows in DEBUG mode: + + cd c:\wx2\src\msw + make -f makefile.b32 + + (replace c:\wx2 with the actual path where you installed wxWindows) + +b. To build wxWindows in RELEASE mode: + + cd c:\wx2\src\msw + make -f makefile.b32 FINAL=1 + + (if you had previously built wxWindows, you need to clean all of + the object and intermediate files. Before the above make command, + run: 'make -f makefile.b32 CLEANALL') + +IMPORTANT: +The Service Pack 1 for Borland C++ 5.5 must be installed before wxWindows +is compiled. If you compiled wxWindows before, it is advised that you +re-compile it following the next steps: + + cd c:\wx2\src\msw + make -f makefile.b32 CLEANALL + make -f makefile.b32 (or make -f makefile.b32 FINAL=1) + + (replace c:\wx2 with the actual path where you installed wxWindows) + +** REMEMBER ** + +In all of your wxWindows applications, your source code should include +the following preprocessor directive: + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +(check the samples -- e.g., \wx2\samples\minimal\minimal.cpp -- for +more details) + Borland C++Builder compilation ------------------------------ -C++Builder compilation is the same as for Borland C++ above. +1. Build the wxWindows libraries using the Borland make utility as + specified in the section called "Borland C++ 4.5/5.0 compilation" + above. (C++ Builder includes a stand-alone C++ compiler. For example, + C++ Builder 4.0 comes with C++ 5.4.) -Tested with C++Builder 1.0 and 3.0. Only makefiles are currently -supplied. +2. You can build samples using the makefiles as per the + instructions for BC++ above, or you can follow the instructions + in docs/tech/tn0004.htm or http://biolpc22.york.ac.uk/wx/bc/ide.html. Watcom C++ 10.6/11 compilation --------------------------- @@ -320,18 +403,16 @@ Watcom C++ 10.6/11 compilation 3. Change directory to wx\samples\minimal and type 'wmake -f makefile.wat' to make this sample. Repeat for other samples of interest. -Note (1): setup.h overrides wxUSE_LIBJPEG and sets it to 0, since -imagjpeg.cpp doesn't compile. -Note (2): makewat.env uses the odbc32.lib supplied in wxWindows' lib\watcom +Note (1): makewat.env uses the odbc32.lib supplied in wxWindows' lib\watcom directory. See the notes in that directory. -Note (3): if variant.cpp is compiled with date/time class +Note (2): if variant.cpp is compiled with date/time class options, the linker gives up. So the date/time option is switched off for Watcom C++. Also, wxAutomationObject is not compiled with Watcom C++. -Note (4): if Watcom can't read the precompiled header when +Note (3): if Watcom can't read the precompiled header when building a sample, try deleting src\msw\watcom.pch and compiling the sample again. -Note (5): if you get _popen_ and _pclose_ link errors, try +Note (4): if you get _popen_ and _pclose_ link errors, try recompiling wxWindows with XPM support disabled in setup.h. Alternatively, make sure these lines exist at the top of src\xpm\xpmi.h: @@ -344,7 +425,7 @@ src\xpm\xpmi.h: Metrowerks CodeWarrior compilation ---------------------------------- -1. Downloaded and unzip wx2_x_y_cw.zip. +1. Downloaded and unzip wxWindows-x.y.z-cw.zip. 2. Load the make_cw.mcp project in wx\src, and compile. 3. Load the make_cw.mcp project in wx\samples\minimal, and compile. Further project files for samples will be available in due @@ -397,13 +478,13 @@ Cygwin b19/b20/Mingw32 compilation ---------------------------------- wxWindows 2 supports Cygwin (formerly GnuWin32) b19, b20, Mingw32, -and Mingw32/EGCS. +and Mingw32/EGCS. Cygwin 1.1.0 and 1.1.1 are not yet supported. Thanks are due to Keith Garry Boyce (garp@opustel.com) and Cygnus for making it all possible. -From wxWindows 2.0 beta 9, both Cygwin and Mingw32 (the minimal -distribution of Cygwin) can be used with the same makefiles. +Both Cygwin and Mingw32 (the minimal distribution of Cygwin) can be used +with the same makefiles. Here are the steps required: @@ -414,16 +495,13 @@ Here are the steps required: extra files to use the wxWindows makefiles. You can find these files in ports/mingw32 on the ftp site or CD-ROM, as extra.zip. These should be extracted to the Mingw32 directory. - If you have already have downloaded bison, flex, make, rm, cp, mv + If you have alread downloaded bison, flex, make, rm, cp, mv from elsewhere, you won't need this. - If using Mingw32 2.8.1, see also see mingw32.txt in this directory - (docs/msw) about a fix that has to be applied to a Mingw32 header file. - If using Mingw32 2.95 and below with wxWindows 2.1 or above, you - must hand-patch in Mingw32-gcc295.patches (located in the top-level of the - wxWindows 2 installation). Mingw32 2.95.2 and above contain the - fixes already. + must hand-patch with Mingw32-gcc295.patches (located in the + top-level of the wxWindows 2 installation). Mingw32 2.95.2 + and above contain the fixes already. - Modify the file wx/src/cygnus.bat (or mingw32.bat or mingegcs.bat) to set up appropriate variables, if necessary mounting drives. @@ -437,10 +515,8 @@ Here are the steps required: - Edit wx/src/makeg95.env and set the MINGW32 variable at the top of the file to either 1 (you have Mingw32) or 0 (you have Cygwin32). If using MINGW32, also set the MINGW32VERSION variable - appropriately. - -- Mingw32 may not support winsock.h, so if you have a problem - here, comment out socket-related files in src/msw/makefile.g95. + appropriately. Note: Cygwin 1.1.0 and above may + need MINGW32 set to 1 to compile properly. - Set your WXWIN variable to where wxWindows is installed. *** IMPORTANT: For Cygwin/Mingw32, use forward slashes in the path, not @@ -487,9 +563,9 @@ Notes: (a missing bracket). -4. If there's a problem with the copy command in +4. If there's a problem with the copy or remove commands in src/msw/makefile.g95, you may need to change the COPY and - COPYSEP variables in makeg95.env. + RM variables in makeg95.env. 5. If there's a problem executing the windres program, try commenting out RCPREPROCESSOR in makeg95.env. @@ -512,7 +588,7 @@ References: - The GNU-WIN32 site is at http://www.cygnus.com/gnu-win32/ - Mingw32 is available at: - ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95/ + ftp://www,mingw.org - See also http://web.ukonline.co.uk/julian.smart/wxwin/gnuwin32.htm TWIN32 and gcc on Linux @@ -542,5 +618,6 @@ General Notes - If you are installing wxWindows 2 from CVS, you may find that include/wx/msw/setup.h is missing. This is deliberate, to avoid developers' different setup.h configurations getting confused. - Please copy setup0.h to setup.h before compiling. + Please copy setup0.h to setup.h before compiling. Also, read + the BuildCVS.txt for other hints. diff --git a/docs/msw/mingw32.txt b/docs/msw/mingw32.txt deleted file mode 100644 index 934585bc72..0000000000 --- a/docs/msw/mingw32.txt +++ /dev/null @@ -1,32 +0,0 @@ -Return-Path: <drfish@uswest.net> -Delivered-To: julian.smart@ukonline.co.uk -Delivered-To: fixup-julian.smart@ukonline.co.uk@fixme -Date: Tue, 01 Dec 1998 23:27:18 -0700 -From: "J.Russell Smyth" <drfish@uswest.net> -X-Accept-Language: en -To: Julian Smart <julian.smart@ukonline.co.uk> -Subject: fixes for mingw32 - -Julian, - - After 3 hours I have found the problem causing - -..\\..\\include\\wx/string.h:520: warning: ANSI C++ forbids implicit -conversion -from `void *' in assignment - --There is an error in -mingw\lib\gcc-lib\i386-mingw32\2.8.1\include\stdarg.h - -(not a real diff.. dont have win95 diff avail right now) -67c67 -<#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || -defined(__NetBSD__) ---- ->#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || -defined(__NetBSD__)||defined(__WIN32__) - -this fixes it!! I will send a message to the maintainer of mingw to let -him know of this problem. - - diff --git a/docs/msw/readme.txt b/docs/msw/readme.txt index 2ae9f1b797..c6e11e4380 100644 --- a/docs/msw/readme.txt +++ b/docs/msw/readme.txt @@ -1,5 +1,8 @@ -This is the wxWindows for Windows Preview. +This is wxWindows for Windows (wxMSW) +------------------------------------- -For more information, please see changes.txt, todo.txt, and the -manuals. +For information on installing wxWindows, please see install.txt. + +For further information, please see docs/html/index.htm and the +wxWindows reference manual. diff --git a/docs/msw/todo.txt b/docs/msw/todo.txt index a6a72a791f..559ee9e0ac 100644 --- a/docs/msw/todo.txt +++ b/docs/msw/todo.txt @@ -1,6 +1,6 @@ -Todo on wxWin 2.0, Windows platform ------------------------------------ +Todo on wxWin 2, Windows platform +--------------------------------- HIGH PRIORITY ------------- @@ -12,8 +12,6 @@ Add centring, right justify styles to wxStaticText. Extend wxSystemSettings to get symbols for current nationality, e.g. ',' instead of '.' for decimal points. -Supply correct ctl3d/odbc lib files for BC++, Watcom (corrupt?) - wxToolTip::Enable should be static for wxGTK compatibility (VZ) LOW PRIORITY (MEDIUM TERM) @@ -21,53 +19,19 @@ LOW PRIORITY (MEDIUM TERM) Supply VC++ project generator utility. -Convert remaining utilities e.g. wxGraphLayout. - More wxSystemSettings (see comment in settings.cpp). -Synchronize drawing functions on all platforms, using Chris's -code to test them. - Shell function to invoke a document with open, print, whatever... Write tutorial. Add wxDC::DeviceToLogical -> wxPoint etc (convenience accessors). -Generic makefiles? Rewrite makefiles to maintain simultaneous debug/release -objects. - -Add a wxTabCtrl sample. - -Improve printing. More API functions for printer DCs (to get -printer characteristics) and more reliable printing framework. - Add GetIcon, GetBitmap to wxImageList. Perhaps store bitmaps in image list so we can get them later. Merge dib.cpp, dibutils.cpp (see also some DIB code in bitmap.cpp). -Debug PNG support in wxBitmap (no 4-bit support), and possibly add a convertor from PNG -to HICON. We could perhaps also support inclusion of PNGs into -a .res file as a custom resource. - -Fonts: ability to enumerate them. - -Angled text. - -Think about reimplementing wxBitmapButton, wxStaticBitmap using -BS_BITMAP, SS_BITMAP - but this may not allow wxBitmap -argument, so instead just allow controls loaded from native -resource to deal with this style and call default processing. - -wxWizard class? - -Doc/view - have some standard views/docs e.g. wxTextView. - -Miscellaneous file/system function wrappers. - -Bug database. - Menu bitmaps - document Vadim's enhancements. wxCreateDynamicObject is apparently slow: ~ 2000 calls to strcmp. Need to @@ -76,25 +40,11 @@ use some kind of hash table scheme. Write wxDisplay class for querying settings and passing to wxFrame to mirror the X situation (multiple displays). -Write translator between old and new .wxr formats (including -substituting static text for obsolete labels). - -Write more validators. Also, how do they work if loading the -dialog from a .wxr? Could call SetValidator from within -InitDialog for all controls, then call TransferDataToWindow. - -Classes for file/OS utility functions. - -Add support for more static controls e.g. wxStaticLine. - Perhaps rewrite wxFile to use FILE* descriptors, so Eof and Flush can work. Find out how to set wxFileDialog position. -Maybe bundle Andrew Tucker's DBWIN32 with wxWindows (it's only -26KB), for viewing debug messages without a debugger. - Implement wxDC floating point transformations. A wxDC function (or two) for drawing 3D edges? @@ -102,15 +52,10 @@ A wxDC function (or two) for drawing 3D edges? LOW PRIORITY (LONG TERM) ------------------------ -Improve and expand wxSizer classes. - ActiveX support Look at porting to WinCE -Enhance Tex2RTF to generate Microsoft HTML help, perhaps Netscape -HTML help also. - GDI objects could be optimised further in constructors by searching for a matching, pre-existing object, and assigning from that, thus sharing the internal handle. A problem with this @@ -138,4 +83,3 @@ different platforms. Rich text class. - diff --git a/docs/readme.txt b/docs/readme.txt index 8d649fd4ca..0b0acafcc5 100644 --- a/docs/readme.txt +++ b/docs/readme.txt @@ -1,5 +1,5 @@ -wxWindows 2.1.14 ----------------- +wxWindows 2.2.0 +--------------- Welcome to wxWindows 2, a sophisticated cross-platform C++ framework for writing advanced GUI applications using (where @@ -12,7 +12,7 @@ and facilities for writing TCP/IP applications, thread handling, and more. Where certain features are not available on a platform, such as MDI and tree controls on Unix, they are emulated. -A detailed 1100-page reference manual is supplied in HTML, PDF and +A detailed 1400-page reference manual is supplied in HTML, PDF and Windows Help form: see the docs hierarchy. For a quick start, point your Web browser at docs/html/index.htm for a @@ -23,16 +23,6 @@ Changes in this release Please see changes.txt for details. -Note that there is a new contrib hierarchy for contributions, -which mirrors the regular wxWindows hierarchy. The Object -Graphics Library and MMedia library have been moved under -contrib, so you may need to change your makefiles or project -files, together with your source files. E.g. change #include "ogl.h" -to #include <wx/ogl/ogl>. - -Also VC++ project files and makefiles have been made more -consistent, so some paths and library names have changed. - Platforms supported ------------------- @@ -46,78 +36,87 @@ wxWindows 2 currently supports the following platforms: Most popular C++ compilers are supported; see the install.txt file for each platform (available via docs/html/index.htm) for details. +See also http://www.lpthe.jussieu.fr/~zeitlin/wxWindows/platform.html. Files ----- -The distribution is available in a number of formats. -The most convenient is the platform-specific distribution, -but the zip set forms a more complete distribution, for example if -you wish to take part in wxWindows development. Also, add-ons -such as OGL may only be available in zip form. - -Zip set -------- - -Depending on what you downloaded, you may have one or more of -these ports. You may unarchive any or all of the ports into -the same directory hierarchy. The zip archive set comprises the -following, where x is the minor version and y the release number: - -wx2_x_y_gen.zip Generic source code and samples (required) -wx2_x_y_msw.zip Windows-specific source code -wx2_x_y_mot.zip Motif-specific source code -wx2_x_y_gtk.zip GTK-specific source code -wx2_x_y_stubs.zip Stubs ('empty port') source. Needs - wx2_x_y_gen.zip/tgz. -wx2_x_y_doc.zip Documentation source code (not required) -wx2_x_y_hlp.zip WinHelp documentation -wx2_x_y_pdf.zip Acrobat PDF documentation -wx2_x_y_htm.zip HTML documentation -wx2_x_y_vc.zip MS VC++ 5/6 project files -wx2_x_y_bc.zip Borland C++ 5 project files -wx2_x_y_cw.zip Metrowerks CodeWarrior 4.1 project files -jpeg.zip Optional JPEG library -tiff.zip Optional TIFF library -ogl3.zip Optional Object Graphics Library -mmedia.zip Optional MMedia class library (Motif, GTK, MSW) -stc.zip Optional wxStyledTextCtrl library (Motif, GTK, MSW) -tex2rtf2.zip Tex2RTF documentation tool +The distribution is available in archive formats appropriate to the +target system. Documentation is available mainly in zip format. +Some add-on libraries (such as the Object Graphics Library) are +available in zip form only. In the following, x.y.z represents +the current version number. wxWindows for GTK distribution ------------------------------ -wxGTK-2.x.y.tgz wxGTK source distribution. You will - need the HTML and/or PDF documentation - from the zip set (above). +wxGTK-x.y.z.tgz wxGTK source distribution. You will + need the HTML, HTB and/or PDF documentation + (see below) +wxGTK-demos-x.y.z.tgz wxGTK demos source +wxGTK-samples-x.y.z.tgz wxGTK samples source +wxGTK-x.y.z-0.src.rpm wxGTK Linux source as an RPM, without manuals +wxGTK-x.y.z-0.i386.rpm wxGTK Linux binaries as an RPM, without manuals +wxGTK-devel-x.y.z-0.i386.rpm wxGTK Linux minimum development system as an RPM wxWindows for Motif distribution -------------------------------- -wxMotif-2.x.y.tgz wxMotif source distribution. You will - need the HTML and/or PDF documentation - -- OR -- from the zip set (above). +wxMotif-x.y.z.tgz wxMotif source distribution. Contains + TIFF, JPEG, Tex2RTF source plus HTML + documentation. -wx2_x_y_gen.zip -wx2_x_y_mot.zip -jpeg.zip -tiff.zip +wxWindows for MS Windows distribution +------------------------------------- -wxWindows for Windows distribution ----------------------------------- +setup.exe, setup.w* Setup files (Windows 95/98, NT) + in floppy-disk-sized chunks +wxMSW-x.y.z-setup.zip Zip archive containing the + setup files +wxMSW-x.y.z.zip Zip archive containing all the + files that are in the setup + distribution -As well as the core source, the Windows setup contains: +As well as the core source, the wxMSW distribution contains: -- Windows Help versions of the documentation (docs/winhelp); -- OGL 3 (Object Graphics Library, in contrib/src/ogl); +- Windows HTML Help versions of the documentation (docs/htmlhelp); +- Object Graphics Library, in contrib/src/ogl; - a Dialog Editor binary; - a Tex2RTF binary; - Life! sample binary; - the JPEG library source; - the TIFF library source. -setup.exe Setup file (Windows 95/98, NT) -setup.* Other setup files +Documentation files +------------------- + +wxWindows-x.y.z-WinHelp.zip WinHelp documentation +wxWindows-x.y.z-PDF.zip Acrobat PDF documentation +wxWindows-x.y.z-HTML.zip HTML documentation +wxWindows-x.y.z-HTMLHelp.zip Windows HTML Help documentation +wxWindows-x.y.z-HTB.zip wxHTML documentation (for + use with the helpview utility) +wxWindows-x.y.z-Word.zip MS Word documentation (currently, + database class documentation only) +wxWindows-x.y.z-DocSource.zip Documentation source code (not required) + +Add-ons +------- + +wxWindows-x.y.z-cw.zip Metrowerks CodeWarrior 4.1 project files +wxWindows-x.y.z-wat.zip Watcom C++ project files +wxWindows-x.y.z-vc.zip Visual C++ project files (in wxMSW distr.) +wxWindows-x.y.z-bc.zip Borland C++ project files (in wxMSW distr.) +jpeg.zip JPEG library (already included + in most distributions) +tiff.zip TIFF library (already included + in most distributions) +ogl3.zip Optional Object Graphics Library +mmedia.zip Optional MMedia library (Motif, GTK, MSW) +stc.zip Optional wxStyledTextCtrl library + (Motif, GTK, MSW) +tex2rtf2.zip Tex2RTF documentation tool +wxGTK-gl-x.y.z-0.i386.rpm add-on OpenGL binary as an RPM Installation ------------ @@ -169,7 +168,6 @@ If you use JPEG image handler, documentation for your program should contain following sentence: "This software is based in part on the work of the Independent JPEG Group". See src/jpeg/README for details. - Documentation ------------- @@ -208,5 +206,5 @@ web site) or contact Julian Smart <julian.smart@ukonline.co.uk>. Good luck! -The wxWindows Team, 19 March, 2000 +The wxWindows Team, 9th July, 2000 diff --git a/docs/tech/index.txt b/docs/tech/index.txt index a9cc1d5546..c54053606a 100644 --- a/docs/tech/index.txt +++ b/docs/tech/index.txt @@ -1,6 +1,13 @@ TN0001 How to add a new sample TN0002 wxWindows translator guide TN0003 Adding wxWindows class documentation +TN0004 Compiling a sample in the C++Builder IDE +TN0005 Adding a wxWindows contribution +TN0006 Making and installing RPMs for wxWindows +TN0007 Using and modifying the BC++ IDE files +TN0008 How to learn wxWindows programming +TN0009 Creating and converting icons +TN0010 Compiling wxWindows applications in the VC++ IDE Version: $Id$ diff --git a/docs/tech/tn0004.htm b/docs/tech/tn0004.htm new file mode 100644 index 0000000000..59fd68658e --- /dev/null +++ b/docs/tech/tn0004.htm @@ -0,0 +1,218 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="Author" content="chris elliott"> + <meta name="GENERATOR" content="Mozilla/4.7 [en] (Win95; I) [Netscape]"> + <title>Compiling wx Samples in the Borland IDE</title> +</head> +<body> + +<h2> +Compiling wxWindows samples with the Borland CBuilder</h2> + +This document is available online <a href="http://biolpc22.york.ac.uk/wx/bc/ide.html">here</a>.<P> + +<h2> +Before you begin</h2> +This refers to the 2.1.15 wxWindows distribution. It is my account of trying +to compile the samples so I can use the Borland IDE to edit/compile/debug. +I have used CBuilder 1.00 (2 patches, nice and fast) CBuilder 3 (slower) +and CBuilder 4 (only occasionally) +<p>Make sure that the wx distribution is extracted to a path with no spaces +in it, and preferably on the root of your drive. Borland's compilers sometimes +have problems with spaces and with the long paths which occur if you try +to place it in a tree like <tt>d:\compiler\gui\wx...</tt> +<h2> +Part 1 Build the library</h2> +Build the <b>wx\wx32.lib</b> and related files using the command line compiler +<br>Run a command prompt in the <tt>wx/src/msw</tt> directory and type +<p><tt>set wxwin=pathtowx</tt> +<br><tt>set bccdir=pathtobc4</tt> +<br><tt>make -f makefile.b32</tt> +<p>In my case this I extracted the wx distribution in <b>c:\ </b>and the +compiler is in <b>w:\borland\cb\bin </b>so this looks: +<p><tt>set wxwin=c:\wx</tt> +<br><tt>set bccdir=w:\borland\cb</tt> +<br><tt>make -f makefile.b32</tt> +<p>If this doesn't <b>compile</b>, +<ul> +<li> +you've probably got the <b><tt>set wxwin </tt></b>command wrong,</li> + +<li> +or the path was not set by the Borland setup</li> +</ul> +If this doesn't <b>link</b>, +<ul> +<li> +you've probably got the <b><tt>set bccdir </tt></b>command wrong</li> +</ul> + +<hr WIDTH="100%"> +<h2> +To make the samples</h2> + +<h3> +Solution 1</h3> + +<h4> +<a href="http://biolpc22.york.ac.uk/wx/bc/download.html">Download</a> a zip file which contains modifed +cpp, mak and bpr files - it will overwrite your wx distribution cpp files!</h4> + +<h4> +Solution 2</h4> +Creating the files by hand . This is for the calendar sample; you will +have to change the names for the other samples +<ul> +<li> +Create a calendar.mak file [must have the same name as the cpp file] in +a plain text editor with <a href="http://biolpc22.york.ac.uk/wx/bc/calendar.mak">this contents</a></li> +</ul> +<tt>#-----------------------------------------------------------------------------</tt> +<br><tt>#this is for Borland CBuilder IDE v1 and 3</tt> +<br><tt>#add a \ at the end of the lines if you editor breaks the long +lines up</tt> +<br><tt>#copy this into notepad and save from there</tt> +<br><tt>#-----------------------------------------------------------------------------</tt> +<br><tt>!ifndef BCB</tt> +<br><tt>BCB = $(MAKEDIR)\..</tt> +<br><tt>!endif</tt> +<br><tt>PROJECT = calendar.exe</tt> +<br><tt>OBJFILES =</tt> +<br><tt>RESFILES = calendar.res</tt> +<br><tt>RESDEPEN = $(RESFILES)</tt> +<br><tt>LIBFILES =</tt> +<br><tt>#-----------------------------------------------------------------------------</tt> +<br><tt>CFLAG1 = -Od -v -a1 -c</tt> +<br><tt># -Od disable optimisations -v debug -a1 byte align -c compile +only (matches my make for the library)</tt> +<br><tt>CFLAG2 = -DINC_OLE2;__WIN95__;__WXMSW__;__WINDOWS__;WIN32;__BIDE__;-I$(BCB)\include;$(BCB)\include\vcl;..\..\include; +-H=BC32.CSM</tt> +<br><tt>PFLAGS =</tt> +<br><tt>RFLAGS = -DINC_OLE2;__WIN95__;__WXMSW__;__WINDOWS__;WIN32;__BIDE__; +-I$(BCB)\include;..\..\include;</tt> +<br><tt>LFLAGS = -L$(BCB)\lib;$(BCB)\lib\obj;..\..\lib -aa -Tpe -v -V4.0 +-c</tt> +<br><tt>IFLAGS =</tt> +<br><tt>LINKER = ilink32</tt> +<br><tt>#-----------------------------------------------------------------------------</tt> +<br><tt>ALLOBJ = c0w32.obj $(OBJFILES)</tt> +<br><tt>ALLRES = $(RESFILES)</tt> +<br><tt>ALLLIB = $(LIBFILES) vcl.lib xpm.lib wx32.lib ole2w32.lib import32.lib +odbc32.lib cw32mt.lib</tt> +<br><tt>#you will need to add other libraries to the line above, eg the +jpeg.lib for image samples</tt> +<br><tt>---------------------------------------------------------------------------</tt> +<br><tt>.autodepend</tt> +<br> +<p><tt>#-----------------------------------------------------------------------------</tt> +<br><tt>$(PROJECT): $(OBJFILES) $(RESDEPEN)</tt> +<p><tt>#end of file</tt> +<br> +<ul> +<li> + modify the .cpp file to include these<a href="http://biolpc22.york.ac.uk/wx/bc/calendar_include.cpp"> +lines </a>near the top</li> +</ul> +<tt>#ifdef __BIDE__</tt> +<br><tt>#define _NO_VCL</tt> +<br><tt>#include "condefs.h"</tt> +<br><tt>#define WinMain WinMain</tt> +<br><tt> // USEUNIT ("another.cpp"); // use a line like this +if you have more than one .cpp file</tt> +<br><tt> USERC ("calendar.rc");</tt> +<br><tt>#endif</tt> +<br> +<p>In CBuilder 1 you can use <b>Open Project</b> to open the mak file and +edit/compile/debug. +<br>In CBuilder 3 and 4, then you can use <b>Open Project </b>and choose +the Open Borland CBuilder 1 Project from the drop down file types. The +system will modify the mak file and update it for you. +<p>Now try compiling it in the ide. +<h4> +Hints:</h4> + +<ul> +<li> +You can set it up for normal and debug modes (change the -v switch in CFLAG1 +and LFLAG)</li> + +<li> +If you get problems saying Project undefined, then copy the text using +a simple editor like notepad to the file minimal.mak (I have had problems +in CBuilder 1.00 with Unix style line endings)</li> + +<li> +If you want to avoid the warnings about hiding virtual methods add <b><tt>-w-hid +</tt></b>to the CFLAGS1 line</li> + +<li> +the #define WinMain WinMain line allows CBuilder to think it has a non-VCL +<tt>main </tt>function</li> + +<li> +the USEUNIT macros tell CBuilder which other source files to include, without +needing a VCL form</li> + +<li> +the condefs.h file defines the USEUNIT macros for non-VCL use</li> + +<li> +For the other samples, change the names of the cpp and rc files. If you +have multiple files, just add more USEUNIT and USERC macros</li> +</ul> + +<h3> +Solution 3</h3> + +<ul> +<li> +download the wxWindows-2.1.15-bcb.zip file,</li> + +<li> +extract it</li> + +<li> +use the <b><tt>idetomak</tt></b> (CBuilder 1) or <b><tt>idetobpr</tt></b> +(CBuilder 3/4) utility on the <b><tt>.ide</tt></b> file in the samples +directory. This modifies the cpp source and makes a "suitable" bpr file +(at least in CBuilder 1/3/4).</li> + +<li> +add the location of the wx/include files in the project | options +| directory dialog</li> +</ul> +I found in CBuilder 1 that the <tt>idetomak</tt> utility did not manage +to convert all the samples, but <tt>idetobpr</tt> worked OK in CBuilder +3 and 4. I have a report that not all the bpr files made inb CBuilder 4 +are correct +<h2> +Error with ODBC32</h2> +Sometimes you get an error saying that there are unreolved externals in +ODBC. The soltuion is to run a command prompt in your <b><tt>wx\lib </tt></b>directory +and use the <b><tt>implib </tt></b>command: +<p><tt>C:\wx\lib><b>implib odbc32 c:\windows\system\odbc32.dll</b></tt> +<p>This creates the necessary library, odbc32.lib +<h2> +Unresolved Problem</h2> +<tt>In Borland CBuilder 1.00 (with linker service patch) I frequently +get an error</tt> +<p><tt>Turbo Incremental Link Version 1.0 Copyright (c) 1997 Borland +International</tt> +<br><tt>Fatal: Assertion failed: typeInx < typeCnt at "ilinkdbg.c", +line 2060</tt> +<br><tt>Fatal: Access violation. Program terminated.</tt> +<br><tt>Error: Internal failure -- retrying link...</tt> +<br><tt>Fatal: Assertion failed: typeInx < typeCnt at "ilinkdbg.c", +line 2060</tt> +<br><tt>Fatal: Access violation. Program terminated.</tt> +<p><tt>** error 2 ** deleting minimal.exe</tt> +<p>I have not been able to track down why sometimes this error occurs and +other times it is OK +<br>I have not seen this in Cbuilder 3 or 4 +<p> +<hr WIDTH="100%"> +<p>Page updated on 31 May 2000 by Chris Elliott +</body> +</html> diff --git a/docs/tech/tn0005.txt b/docs/tech/tn0005.txt new file mode 100644 index 0000000000..db4a67275d --- /dev/null +++ b/docs/tech/tn0005.txt @@ -0,0 +1,66 @@ + Adding a wxWindows contribution + =============================== + +Here are some different kinds of contribution: + +1. Bug fixes. You can send these to the wx-devel list. +2. New classes. New classes normally go in the contrib hierarchy: + please see below for more details. They may be promoted to + the main wxWindows hierarchy if they are deemed to be 'core'. +3. A utility application, such as a new dialog editor or + file format conversion utility. If adding to the CVS + archive, you may put it under the utils hierarchy, + preferably with further src and docs directories. + +You may or may not wish to add your code to the main wxWindows CVS +archive. Whether your code is appropriate for this archive +should first be ascertained by discussing it on wx-devel@wxwindows.org. + +The contrib hierarchy +--------------------- + +When contributing a new class or set of classes, please +organise your files in the following hierarchy, so that +when a user unarchives your contribution, it +slots neatly into the existing source hierarchy. +It also simplifies compilation for users, since wxWindows +makefiles and project files are set up to search in +contrib/include/wx and contrib/lib. For example, to +include yourclass.h, the following directive is used: + +#include "wx/yourclass/yourclass.h" + +Here are the directories: + +contrib/include/wx/yourclass/ ; Your header(s) go here +contrib/src/yourclass/ ; Your source file(s) go here +contrib/samples/yourclass/ ; Your sample(s) go here +contrib/docs/latex/yourclass/ ; Your Latex doc sources go here +contrib/docs/html/yourclass/ ; Your HTML doc files go here +contrib/docs/htmlhelp/yourclass/ ; Your MS HTML Help doc files go here +contrib/docs/htb/yourclass/ ; Your wxHTML doc files go here +contrib/docs/pdf/yourclass/ ; Your PDF doc files go here +contrib/docs/winhelp/yourclass/ ; Your WinHelp doc files go here + +It is recommended that you produce a manual using Tex2RTF, as specified +in Technical Note TN0003. This allows you to output all the above +formats, though for PDF you will need Latex and Ghostscript or +Word and Adobe Acrobat, and for MS HTML Help and WinHelp you need +the appropriate (freely available) help compilers. + +Your binary library files can go in the main lib directory or contrib/lib, +but the main lib directory is recommended. + +Please include a readme.txt in your source directory, and conform +as much as possible to the coding guidelines specified on the web +site in the 'Backroom' section. Include as many makefiles as +possible for different compilers. + +Your archive can be in .tgz or .zip format. For inclusion on +the wxWindows ftp site and CD-ROM, please send your submission to +Julian Smart <julian@wxwindows.org> as a binary attachment. +An entry will be added to the Contributions web page. + +Author: Julian Smart +Version: $Id$ + diff --git a/docs/tech/tn0006.txt b/docs/tech/tn0006.txt new file mode 100644 index 0000000000..295939c128 --- /dev/null +++ b/docs/tech/tn0006.txt @@ -0,0 +1,41 @@ +How to make RPMs of the wxWindows sources +========================================= + +This is just a short description. It is assumed that you know what you are +doing. I do not take any responsibility for damaged systems, use at your own +risk! + + 1. Extract the archive in a temporary directory. Since you are + reading this text, you already have done this. + 2. Copy the .spec file to + (rpm-dir)/SPECS + 3. Copy the .tgz file to + (rpm-dir)/SOURCES + 4. Start the RPM manager with + rpm -bb (rpm-dir)/SPECS/(.spec-file) + or with + rpm -ba (rpm-dir)/SPECS/(.spec-file) + (the latter also builds the .src.rpm-file) + 5. You now have a nice set of RPMs in (rpm-dir)/RPMS + +Example +======= + +Here's how to install e.g. wxMotif 2.1.14: + + cp wxMotif.spec /usr/src/packages/SPECS + cp wxMotif-2.1.14.tgz /usr/src/packages/SOURCES + rpm -bb /usr/src/packages/SPECS/wxMotif.spec + +Install the resulting packages with + + rpm --install /usr/src/packages/RPMS/i386/wxMotif-2.1.14-0.i386.rpm + rpm --install /usr/src/packages/RPMS/i386/wxMotif-devel-2.1.14-0.i386.rpm + rpm --install /usr/src/packages/RPMS/i386/wxMotif-gl-2.1.14-0.i386.rpm + + + +That's all. You should now have a working wxWindows library. + +Regards, + Robert Fendt diff --git a/docs/msw/bc_ide.txt b/docs/tech/tn0007.txt similarity index 58% rename from docs/msw/bc_ide.txt rename to docs/tech/tn0007.txt index d0e0e59b7f..2d646b9976 100644 --- a/docs/msw/bc_ide.txt +++ b/docs/tech/tn0007.txt @@ -1,13 +1,16 @@ +Using and modifying the BC++ IDE files +====================================== + Readme for wxWindows 2.0 Ide-files First release Feb. 1999, detlev@reymann-online.de -1. What you can do with this IDE files +1. What you can do with the BC++ IDE files 2. Where to install the files 3. How to modify them for your own needs 4. How to create IDE files for your own wxWindows-programs -1. What you can do with this IDE files -====================================== +1. What you can do with the IDE files +===================================== There are two IDE files. src\bc32.ide should help you to create the wxWindows libraries from within the Ide of Borlands @@ -40,14 +43,14 @@ $inherit-macro (Julian found the trick), this should work. To add a new sample to samples\bc32.ide, follow these steps: -a. Choose Project->New target... and type in e.g. +1. Choose Project->New target... and type in e.g. samples\newsample. Press OK. -b. Static, no OWL, MFC or class libraries. Check Multithread +2. Static, no OWL, MFC or class libraries. Check Multithread on. Press OK. -c. Right-click on the new node, choose Add node... and add +3. Right-click on the new node, choose Add node... and add ..\lib\wx32.lib and ..\lib\xpm.lib. Add any other source files you require. -d. Right-click on the new node, choose Edit Local Options.. and +4. Right-click on the new node, choose Edit Local Options.. and add in Directories, specify the following: Include: $inherit;.\newsample @@ -59,22 +62,21 @@ d. Right-click on the new node, choose Edit Local Options.. and 4. How to create IDE files for your own wxWindows-programs ========================================================== -I think you are familiar with the necessary options for your own -program. So I will only describe what is neccessary to link -yout program with the wxWindows library. If you want to create -an IDE file for your own wxWindows program, create a new project -from the menu file->new->project. Deactivate all the -standard-options, the only three thing that should be activated is -"static" for the libraries, if you want to use the library -produced with the library-ide, the checkbox OLE (you can -leave this checkbox unchecked, but then you have to add the -library \bc5\lib\ole2w32.lib to your project), and the -Multithread checkbox. You have to add -the include-path of wxWindows to the include-path in the -options-dialog (options->project->directories->include). The -result should be something like: -path_of_my_program;\bc5\include;\wxwin2\include; Then you have -to add the libraries to the project. Open the project-view and -activate your program. Then right-click and choose "add" and -select the wxWindows library (e.g. \wxwin\lib\wx32.lib). Also -add the xpm library. +If you want to create an IDE file for your own wxWindows program, +please follow these steps. + +1. Create a new project from the menu file->new->project. +2. Deactivate all the standard-options, the only three things + that should be activated are "static" for the libraries, + the checkbox OLE (you can leave this checkbox unchecked, + but then you have to add the library \bc5\lib\ole2w32.lib + to your project), and the Multithread checkbox. +3. Add the include-path of wxWindows to the include-path in the + options-dialog (options->project->directories->include). The + result should be something like: + path_of_my_program;\bc5\include;\wxwin2\include; +4. Add the libraries to the project. Open the project-view and + activate your program. Then right-click and choose "add" and + select the wxWindows library (e.g. \wxwin\lib\wx32.lib). Also + add the xpm library. + diff --git a/docs/tech/tn0008.htm b/docs/tech/tn0008.htm new file mode 100644 index 0000000000..dcbc731c92 --- /dev/null +++ b/docs/tech/tn0008.htm @@ -0,0 +1,144 @@ +<HTML> + +<HEAD> +<TITLE>How to learn wxWindows programming</TITLE> +</HEAD> + +<BODY BGCOLOR=#FFFFFF TEXT=#000000 LINK=#FF0000 VLINK=#000000> + +<font face="Arial, Lucida Sans, Helvetica"> + +<a name="top"></a> + +<table align=center width=100% border=4 cellpadding=5 cellspacing=0> +<tr> +<td bgcolor="#660000" align=left colspan=2> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +How to learn wxWindows programming +</font> +</td> +</tr> +</table> + +<P> + +The following is a response by Edward Ream to a common question, +"What's the best way to learn wxWindows [and C++]?".<P> + +Date: Sun, 04 Jun 2000 14:37:06 -0500<BR> +From: "Edward K. Ream" <edream@tds.net> <BR> +To: wx-users@wxwindows.org<BR> +Subject: Re: [wx-users] How to learn using wx-windows <BR> +Reply-To: wx-users@wxwindows.org<P> + +> Reading the Linux Journal article on wxpython, and having used wxclips<BR> +> I got interested in wxwindows as a development interface. However, the<BR> +> programming experience I got is old, and from a former generation (For-<BR> +> tran). I'd like to refresh my experience and start in C++. Will<BR> +> wx-windows be a very high step to take?<P> + +I'm new to wxWindows myself, but I'd like to answer this question +anyway. In the past two years I've learned two similar frameworks +(Apple's Yellow Box, aka NextStep/OpenStep and Borland's C++ +Builder/Delphi) and last year I became a C++ enthusiast after 20 years +of using C.<P> + +<B>About C++.</B><P> + +The major Aha for me was that the complexity of C++ doesn't matter in +practice. What _does_ matter is that C++ allows you to do simple things +simply, more simply than C. With a system like wxWindows you will be +creating objects and then using those objects to call methods. So don't +be afraid of C++: you'll only be using the easy tip of the +iceberg.<P> + +Besides the C++ Programming Language, by Bjarne Stroustrup, the +"official" guide to C++, I highly recommend Inside the C++ Object Model, +by Stanley B. Lippman. (Lipmann was one of the C++ honchos at Bell +Labs.) This book will tell you what _not_ to do, as well as why +everything in C++ is as it is. If you are confused by anything in C++, +Lippman's book is the cure.<P> + +<B>About applications frameworks.</B><P> + +Application frameworks such as wxWindows are organized around a set of +cooperating classes. Take a look at the main application class, wxApp, +some frame and panel classes, graphics classes, menu classes, control +classes, etc. In general, to do anything in a framework involves +creating an object of the specified type, then doing something with that +object.<P> + +For example, suppose you want to create a menu bar. A menu bar is +composed of a single menu bar object of type(class) wxMenuBar that +contains menu objects of type wxMenu. Each menu object contains menu +item objects of type wxMenuItem. So you create the menu bar object, +then create all the menu objects (creating the menu item objects along +the way) and finally "attach" the menu objects to the menu bar object +using a call to the wxMenuBar::Append method.<P> + +As an overview I would look at the "Alphabetical class reference" +section of the reference manual. I find the HTML version to be the +easiest to use: you can browse very quickly through it. Here's how to +read this (very large) reference:<P> + +<ol> +<li>Get an overview of the kinds of classes involved. The class names +will tell you a lot about what each class does. Open some of the +classes, in particular, wxApp (the main application object), wxFrame, +wxControl (the base class for all controls) and one or two controls, +like wxButton. + +<li>When scanning a class for the first several times, read the +introductory remarks and quickly scan the list of methods of the class +to get a general idea about what kinds of operations can be done to +objects of the class. You are not looking for detail at this stage, +just for the big picture. In particular, what classes exist and how do +they work together. + +<li>Pay particular attention to the classes from which a class is +derived. For example, a button (an object of type wxButton) is derived +from the wxControl, wxWindow, wxEvtHandler and wxObject classes. What +does this mean? It means that a button _is_ a control, and a button +_is_ a window, and a button _is_ an event handler and a button _is_ an +object. So you must understand the parent classes of an object to +understand the object itself. + +For example, if b is a button you can invoke b.m for any of method m of +the wxControl, wxWindow, wxEvtHandler or wxObject classes. You are not +limited to just the methods of wxButton! This is one of the keys of +object oriented programming. +</ol> + +Some other tips:<P> + +Read some sample code. You will find that almost none of the C++ +language is actually being used; it's just endlessly creating objects +and then calling methods using those objects.<P> + +Learn as much as you can about the String class; after using a good +String class you'll never want to use C's string functions again. +wxWindows contains other nifty utilty classes as well.<P> + +The application class, wxApp, contains the main event loop. Learn about +event handling and event tables (reading sample code will help). Almost +everything in this kind of application framework happens as the result +of an event and your app is essentially doing nothing but responding to +events. Having the event loop written for you is a major, major +benefit.<P> + +I hope this helps. Perhaps we can work together in learning about +wxWindows. Please feel free to ask me any questions you might have. If +I've made any blunders in this posting I hope the wxWindows experts will +correct me gently.<P> + +Edward<BR> +--------------------------------------------------------------------<BR> +Edward K. Ream email: edream@tds.net<BR> +Leo: Literate Editor with Outlines<BR> +Leo: http://personalpages.tds.net/~edream/front.html<BR> +--------------------------------------------------------------------<P> + +</font> + +</body> +</html> diff --git a/docs/tech/tn0009.htm b/docs/tech/tn0009.htm new file mode 100644 index 0000000000..3bafb059fa --- /dev/null +++ b/docs/tech/tn0009.htm @@ -0,0 +1,60 @@ +<HTML> + +<HEAD> +<TITLE>Creating and converting icons</TITLE> +</HEAD> + +<BODY BGCOLOR=#FFFFFF TEXT=#000000 LINK=#FF0000 VLINK=#000000> + +<font face="Arial, Lucida Sans, Helvetica"> + +<a name="top"></a> + +<table align=center width=100% border=4 cellpadding=5 cellspacing=0> +<tr> +<td bgcolor="#660000" align=left colspan=2> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF"> +Creating and converting icons +</font> +</td> +</tr> +</table> + +<P> + +Icons are bitmaps that may contain transparency information. Under X, icons are +usually created from XPM files, which may be loaded from a file or created from +data embedded in a C++ source file.<P> + +Under Windows, icon files (extension .ico) may contain multiple icons for different sizes and colour +depths, and can be loaded from a file or loaded from the Windows resources compiled +into the executable.<P> + +You can decide to use only XPMs on Windows and Unix, or you could use XPMs on Unix and +Windows icons under Windows -- the latter will require some #idefs in your code or use of the wxICON macro.<P> + +If you are using a compiler such as Borland C++, Visual C++ or Watcom C++, you +can use the provided icon editor. However, if using Cygwin or Mingw32, there +is no icon editor so you must obtain one separately, such as <a href="http://hotfiles.zdnet.com/cgi-bin/texis/swlib/hotfiles/info.html?fcode=00165P">IconEdit32</a>.<P> + +To convert from XPM to BMP (which can be loaded or pasted into an icon editor to save as an ICO file), +you can use Vadim Zeitlin's <a href="ftp://www.remstar.com/pub/wxwin/support/xpm2bmp.exe">xpm2bmp.exe</a> utility. +To convert from BMP to XPM, you can use <a href="ftp://www.remstar.com/pub/wxwin/support/bmp2xpm.exe">bmp2xpm.exe</a> +which is actually the old wxWindows 1.68 utility, xpmshow. You will have to edit the resulting +file since the full path is used as the variable name, plus you may wish to specify a transparent colour e.g.:<P> + +<pre> +" s None c None", +</pre> + +This will indicate that the space character will be taken as the transparent colour throughout the image.<P> + +<!-- +Author: JS +Version: $Id$ +--> + +</font> + +</body> +</html> diff --git a/docs/tech/tn0010.htm b/docs/tech/tn0010.htm new file mode 100644 index 0000000000..f5051266bd --- /dev/null +++ b/docs/tech/tn0010.htm @@ -0,0 +1,282 @@ +<HTML> + +<HEAD> +<TITLE>Compiling wxWindows applications in the VC++ IDE</TITLE> + +</HEAD> + +<BODY BGCOLOR="#FFFFFF" TEXT=#000000 LINK=#FF0000 VLINK=#000000> + +<font face="Arial, Lucida Sans, Helvetica"> + +<a name="top"></a> + +<table width=100% border=0 cellpadding=5 cellspacing=0> +<tr> +<td bgcolor="#C4ECF9"> +<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#000000"> +Compiling wxWindows applications in the VC++ IDE +</font> +</td> +</tr> +</table> + +<P> + +<CENTER> +<a href="#wxwin2">Settings for wxWindows 2</a> / <a href="#wxwin1">Settings for wxWindows 1.68</a> +</CENTER> + +<P> + +To compile wxWindows samples and applications using the VC++ 5.0 or 6.0 IDE (having compiled wxWindows +using the makefile or project file provided), the following +steps and settings should be used.<P> + +<H2>Steps</H2> + +<ol> +<li>Create a new WIN32 Application project. +<li>Add the .cpp and .rc files for your project. +<li>Apply the settings listed below to the project, replacing c:\wx2 with your wxWindows +installation path. +</ol> + +<P> + +<H2><a name="wxwin2">Settings for wxWindows 2</a></H2> + +These settings apply to wxWindows 2.1.14 and above.<P> + +<DL> +<DT><B>General</B><DD> +The <B>Output files</B> and <B>Intermediate files</B> directory fields should be Debug +for the Debug configuration, and Release for the Release configuration.<P> + +<DT><B>Debug: General</B><DD> +The <B>Executable for debug sessions</B> field should be altered to be the path and name +you'd expect (it may have generated a different name).<P> + +<DT><B>C/C++: Preprocessor</B><DD> +The <B>Preprocessor definitions</B> field should contain the following symbols for Debug:<P> + +<PRE> +WIN32,_DEBUG,_WINDOWS,__WINDOWS__,__WXMSW__,__WXDEBUG__,WXDEBUG=1, +__WIN95__,__WIN32__,WINVER=0x0400,STRICT +</PRE> +<P> +and these for Release:<P> + +<PRE> +NDEBUG,WIN32,_WINDOWS,__WINDOWS__,__WXMSW__,__WIN95__,__WIN32__, +WINVER=0x0400,STRICT</PRE> +<P> +The <B>Additional include directories</B> field should contain the following:<P> +<PRE> +c:\wx2\include,c:\wx2\contrib\include +</PRE> +<P>(and of couse any other directories you wish to use in your project).<P> + +<DT><B>C/C++: Precompiled Headers</B><DD> + +The <B>Not using precompiled headers</B> or <B>Automatic use of precompiled headers</B> +button should be selected.<P> + +<DT><B>C/C++: Code Generation</B><DD> + +The <B>Use run-time library</B> control should be set to <B>Debug Multithreaded DLL</B> (Debug) +or <B>Multithreaded DLL</B> (Release).<P> + +<DT><B>Link: Input</B><DD> + +The <B>Object/library modules</B> field should contain: + +<PRE> +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib +ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib +winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib +</PRE> + +for the Debug configuration and + +<PRE> +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib +ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib +winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib +</PRE> + +for the Release configuration.<P> + +The <B>Ignore libraries</B> field should contain: + +<PRE> +libcd.lib,libcid.lib,msvcrt.lib +</PRE> + +for the Debug configuration and + +<PRE> +libc.lib,libci.lib,msvcrtd.lib +</PRE> + +for the Release configuration.<P> + +The <B>Additional library path</B> field should contain + +<PRE> +c:\wx2\lib,c:\wx2\contrib\lib +</PRE> + +for both Debug and Release configurations. + +<P> + +<DT><B>Resources</B><DD> + +Select your .rc file. The <B>Additional resource include directories</B> field should contain: + +<PRE> +c:\wx2\include;c:\wx2\contrib\include +</PRE> + +</DL> + +<HR> + +<H2><a name="wxwin1">Settings for wxWindows 1.68</a></H2> + +Note: these have not yet been checked.<P> + +<DL> +<DT><B>Debug: General</B><DD> +The <B>Executable for debug sessions</B> field should be altered to be the path and name +you'd expect (it may have generated a different name).<P> + +<DT><B>General</B><DD> +The <B>Output directories</B> fields can be made blank if you want the objects +and executable to be created in the project directory and not a subdirectory.<P> + +<DT><B>C/C++: Preprocessor</B><DD> +The <B>Preprocessor definitions</B> field should contain the following symbols:<P> +<PRE> +WIN32,_DEBUG,_WINDOWS,wx_msw,DEBUG=1,WIN95=1,WINVER=0x0400,STRICT +</PRE> +<P> +The <B>Additional include directories</B> field should contain the following:<P> +<PRE> +../../include/base,../../include/msw +</PRE> +<P>(and of couse any other directories you wish to use in your project).<P> + +<DT><B>C/C++: Precompiled Headers</B><DD> + +The <B>Not using precompiled headers</B> or <B>Automatic use of precompiled headers</B> +button should be selected (I can't find a way of using the wxWindows PCH file).<P> + +<DT><B>C/C++: Code Generation</B><DD> + +The <B>Use run-time library</B> control should be set to <B>Multithreaded DLL</B>. This +sets the compiler switch to /MD to match the wxWindows makefile.<P> + +<DT><B>Link: Input</B><DD> + +The <B>Object/library modules</B> field should contain: + +<PRE> +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib +shell32.lib odbc32.lib odbccp32.lib comctl32.lib +../../lib/wx.lib ../../src/msw/dummy.obj +</PRE> + +The <B>Ignore libraries</B> field should contain: + +<PRE> +libcd.lib,libcid.lib +</PRE> + +<P> + +<DT><B>Resources</B><DD> + +Select your .rc file. The <B>Additional resource include directories</B> field should contain: + +<PRE> +..\..\include\msw;..\..\contrib\fafa +</PRE> + +</DL> + +<P> + +<!-- +<PRE> +From: "Chris Breeze" <chris@hel.co.uk> +To: <wxwin-users@wx.dent.med.uni-muenchen.de> +Subject: Re: Compiling 2.0 wxWin Apps in the VC IDE +Date: Wed, 20 May 1998 14:18:02 +0100 + +First the apology: the description below is for wx1.68 +not for wx2.0 - sorry if I confused everybody. + +Anyway, third time lucky I hope! The settings for +VC++ 5.0, wx2.0 beta 8, NT Workstation 4.0 sp3 +are: + +In project / settings / C/C++: +Add "__WINDOWS__" to the pre-processor definitions +Add "{wx}\include" to the additional include directories +where {wx} is the directory in which wx is installed + +In project / settings / Resources: +add "{wx}\include" to the additional resource include directories + +In project / settings / Link: +Add "wx.lib comctl32.lib dummy.obj" to the Object/Library modules + +Add "libcd.lib,libcid.lib" to ignore libraries (under the "input" category) + +Add "{wx}\lib,{wx}\src\msw" to the additional library path + +I have tested these settings on samples/minimal and can +build exes which can be debugged using Developer Studio. + +I hope I've finally answered the original question. (Next time +I'll read the question more carefully!). + +Regards, +Chris + +Original message (settings for wx1.68c): +) Try the following (tested with VC++ 5 on NT4): +) +) Create a new Win32 Application project and insert the source files +) (including .rc files). +) +) In project / settings / C/C++: +) Add wx_msw to the pre-processor definitions +) add {wx}\include\base,{wx}\include\msw to the additional include +directories +) where {wx} is the directory in which wx is installed +) +) In project / settings / Resources: +) add {wx}\include\msw;{wx}\contrib\fafa to the additional resource include +) directories +) +) In project / settings / Link: +) Add comctl32.lib wx.lib dummy.obj ctl3d32.lib to the Object/Library modules +) +) Add libc to ignore libraries (under the "input" category) +) +) Add {wx}\lib,{wx}\src\msw to the additional library path +) +) These settings are for a debug build. You can use the same settings for +) a release build apart from ignoring libc. + +</PRE> +--> + +</font> + +</BODY> + +</HTML> diff --git a/docs/todo.txt b/docs/todo.txt index 1caf48797b..53c2818850 100644 --- a/docs/todo.txt +++ b/docs/todo.txt @@ -14,38 +14,8 @@ Please see also: usage, how many classes of each kind are in use, etc.? That would be neat. -- Documentation: mention include files with each class. - -- Document/update wxTime. - -- Document wxSpinCtrl & wxFontMapper. - -- Fix TCP/IP mode in dde sample (how to use; why does it crash). - - In doc/view file selector, document type is selected by extension, not the type selected in the (Windows) file selector. -- Add all makefiles/documentation for utils/serialize. - -- Implement wxScrolledWindow::OnChar to scroll the window using - the keyboard. - -- Documentation for ODBC classes - -For 2.1: small changes not involving rewriting anything -------------------------------------------------------- - - wxArrayDouble class? -- generate CREATE/DESTROY events just after/before a window (any window, not - just frame/dialog) is created/deleted - -- Dynamic menu handling: wxMenuBar::DeleteMenu(), InsertMenu() - -For 2.2: major new additions -------------------------------------------------------- - -- Unicode support (Win32 only probably) - -- DnD and OLE clipboard, uniform DnD/clipboard handling - diff --git a/include/wx/app.h b/include/wx/app.h index ab9e88a562..5538e053bd 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -380,35 +380,18 @@ public: #define WXAPIENTRY WXFAR wxSTDCALL #endif - // Patch from Mumit Khan to allow DLL compilation under mingw. Note that - // this includes <windows.h> which is a bad thing because it prevents - // wxWindows to work with MFC, so for now I'm making this change for - // mingw/cygwin only (these don't work with MFC yet). GRG Mar/2000 - #if defined(__GNUWIN32__) - #include <windows.h> - #include "wx/msw/winundef.h" - - #define IMPLEMENT_WXWIN_MAIN \ - extern "C" int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);\ - int WINAPI WinMain(HINSTANCE hInstance, \ - HINSTANCE hPrevInstance,\ - LPSTR m_lpCmdLine, int nCmdShow )\ - {\ - return wxEntry((WXHINSTANCE) hInstance, \ - (WXHINSTANCE) hPrevInstance,\ - m_lpCmdLine, nCmdShow);\ - } - #else - #define IMPLEMENT_WXWIN_MAIN \ - int WXAPIENTRY WinMain(HINSTANCE hInstance, \ - HINSTANCE hPrevInstance,\ - LPSTR m_lpCmdLine, int nCmdShow )\ - {\ - return wxEntry((WXHINSTANCE) hInstance, \ - (WXHINSTANCE) hPrevInstance,\ - m_lpCmdLine, nCmdShow);\ - } - #endif + #include <windows.h> + #include "wx/msw/winundef.h" + + #define IMPLEMENT_WXWIN_MAIN \ + extern "C" int WXAPIENTRY WinMain(HINSTANCE hInstance,\ + HINSTANCE hPrevInstance,\ + LPSTR m_lpCmdLine, int nCmdShow)\ + {\ + return wxEntry((WXHINSTANCE) hInstance,\ + (WXHINSTANCE) hPrevInstance,\ + m_lpCmdLine, nCmdShow);\ + } #else #define IMPLEMENT_WXWIN_MAIN #endif diff --git a/include/wx/arrimpl.cpp b/include/wx/arrimpl.cpp index 6496ca6b75..cf1e290613 100644 --- a/include/wx/arrimpl.cpp +++ b/include/wx/arrimpl.cpp @@ -57,21 +57,19 @@ name::name(const name& src) \ DoCopy(src); \ } \ \ -void name::Empty() \ +void name::DoEmpty() \ { \ for ( size_t ui = 0; ui < Count(); ui++ ) \ delete (T*)wxBaseArray::Item(ui); \ - \ - wxBaseArray::Clear(); \ } \ \ -void name::RemoveAt(size_t uiIndex) \ +void name::RemoveAt(size_t uiIndex) \ { \ wxCHECK_RET( uiIndex < Count(), _WX_ERROR_REMOVE2(name) ); \ \ delete (T*)wxBaseArray::Item(uiIndex); \ \ - wxBaseArray::RemoveAt(uiIndex); \ + wxBaseArray::RemoveAt(uiIndex); \ } \ \ void name::Add(const T& item) \ diff --git a/include/wx/buffer.h b/include/wx/buffer.h index d64ed386e6..6556f39cd6 100644 --- a/include/wx/buffer.h +++ b/include/wx/buffer.h @@ -54,6 +54,7 @@ public: return *this; } + const char *data() const { return m_str; } operator const char *() const { return m_str; } char operator[](size_t n) const { return m_str[n]; } @@ -103,6 +104,7 @@ public: return *this; } + const wchar_t *data() const { return m_wcs; } operator const wchar_t *() const { return m_wcs; } wchar_t operator[](size_t n) const { return m_wcs[n]; } diff --git a/include/wx/calctrl.h b/include/wx/calctrl.h index 337ee8e8c4..16c03fc153 100644 --- a/include/wx/calctrl.h +++ b/include/wx/calctrl.h @@ -139,6 +139,8 @@ protected: private: wxDateTime m_date; wxDateTime::WeekDay m_wday; + + DECLARE_DYNAMIC_CLASS(wxCalendarEvent) }; // ---------------------------------------------------------------------------- diff --git a/include/wx/cmdline.h b/include/wx/cmdline.h index c8bea6105f..7df010dbfc 100644 --- a/include/wx/cmdline.h +++ b/include/wx/cmdline.h @@ -32,7 +32,8 @@ enum wxCMD_LINE_OPTION_MANDATORY = 0x01, // this option must be given wxCMD_LINE_PARAM_OPTIONAL = 0x02, // the parameter may be omitted wxCMD_LINE_PARAM_MULTIPLE = 0x04, // the parameter may be repeated - wxCMD_LINE_OPTION_HELP = 0x08 // this option is a help request + wxCMD_LINE_OPTION_HELP = 0x08, // this option is a help request + wxCMD_LINE_NEEDS_SEPARATOR = 0x10, // must have sep before the value }; // an option value or parameter may be a string (the most common case), a diff --git a/include/wx/confbase.h b/include/wx/confbase.h index 840b5ed9a7..936e22190c 100644 --- a/include/wx/confbase.h +++ b/include/wx/confbase.h @@ -35,13 +35,13 @@ /// separates group and entry names (probably shouldn't be changed) #ifndef wxCONFIG_PATH_SEPARATOR - #define wxCONFIG_PATH_SEPARATOR '/' + #define wxCONFIG_PATH_SEPARATOR _T('/') #endif /// introduces immutable entries // (i.e. the ones which can't be changed from the local config file) #ifndef wxCONFIG_IMMUTABLE_PREFIX - #define wxCONFIG_IMMUTABLE_PREFIX '!' + #define wxCONFIG_IMMUTABLE_PREFIX _T('!') #endif /// should we use registry instead of configuration files under Windows? @@ -113,7 +113,7 @@ public: long style = 0); // empty but ensures that dtor of all derived classes is virtual - virtual ~wxConfigBase() { } + virtual ~wxConfigBase(); // path management // set current path: if the first character is '/', it's the absolute path, @@ -226,6 +226,7 @@ public: // misc accessors wxString GetAppName() const { return m_appName; } wxString GetVendorName() const { return m_vendorName; } + // Used wxIniConfig to set members in constructor void SetAppName(const wxString& appName) { m_appName = appName; } void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; } @@ -307,12 +308,12 @@ private: $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and '_' only. '$' must be escaped ('\$') in order to be taken literally. */ -extern wxString wxExpandEnvVars(const wxString &sz); +extern WXDLLEXPORT wxString wxExpandEnvVars(const wxString &sz); /* Split path into parts removing '..' in progress */ -extern void wxSplitPath(wxArrayString& aParts, const wxChar *sz); +extern WXDLLEXPORT void wxSplitPath(wxArrayString& aParts, const wxChar *sz); #endif // _WX_CONFIG_H_ diff --git a/include/wx/cursor.h b/include/wx/cursor.h index f163125fa6..10bc6a0cc3 100644 --- a/include/wx/cursor.h +++ b/include/wx/cursor.h @@ -21,23 +21,39 @@ /* This is a small class which can be used by all ports to temporarily suspend the busy cursor. Useful in modal dialogs. + + Actually that is not (any longer) quite true.. currently it is + only used in wxGTK Dialog::ShowModal() and now uses static + wxBusyCursor methods that are only implemented for wxGTK so far. + The BusyCursor handling code should probably be implemented in + common code somewhere instead of the separate implementations we + currently have. Also the name BusyCursorSuspender is a little + misleading since it doesn't actually suspend the BusyCursor, just + masks one that is already showing. + If another call to wxBeginBusyCursor is made while this is active + the Busy Cursor will again be shown. But at least now it doesn't + interfere with the state of wxIsBusy() -- RL + */ class wxBusyCursorSuspender { public: - wxBusyCursorSuspender() - { - m_wasBusy = wxIsBusy(); - if(m_wasBusy) - wxEndBusyCursor(); - } - ~wxBusyCursorSuspender() - { - if(m_wasBusy) - wxBeginBusyCursor(); - } - private: - bool m_wasBusy; + wxBusyCursorSuspender() + { + if( wxIsBusy() ) + { + wxSetCursor( wxBusyCursor::GetStoredCursor() ); + wxYield(); + } + } + ~wxBusyCursorSuspender() + { + if( wxIsBusy() ) + { + wxSetCursor( wxBusyCursor::GetBusyCursor() ); + wxYield(); + } + } }; #endif // _WX_CURSOR_H_BASE_ diff --git a/include/wx/dataobj.h b/include/wx/dataobj.h index 544d90ef13..e7042d2b07 100644 --- a/include/wx/dataobj.h +++ b/include/wx/dataobj.h @@ -250,7 +250,7 @@ private: // wxDataObject directly. // ---------------------------------------------------------------------------- -WX_DECLARE_LIST(wxDataObjectSimple, wxSimpleDataObjectList); +WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList); class WXDLLEXPORT wxDataObjectComposite : public wxDataObject { diff --git a/include/wx/date.h b/include/wx/date.h index 11ff72017f..09e8e00c49 100644 --- a/include/wx/date.h +++ b/include/wx/date.h @@ -161,16 +161,16 @@ public: int GetMonth() const { return m_date.GetMonth() + 1; } // First Date Of Month - wxDate GetMonthStart() const { return(wxDate(GetMonth(), 1, GetYear())); } + wxDate GetMonthStart() const { return(wxDate(GetMonth()-1, 1, GetYear())); } // Last Date Of Month - wxDate GetMonthEnd() const { return wxDate(GetMonth()+1, 1, GetYear())-1; } + wxDate GetMonthEnd() const { return wxDate(GetMonth(), 1, GetYear())-1; } // eg. 1992 int GetYear() const { return m_date.GetYear(); } // First Date Of Year - wxDate GetYearStart() const { return wxDate(1, 1, GetYear()); } + wxDate GetYearStart() const { return wxDate(0, 1, GetYear()); } // Last Date Of Year - wxDate GetYearEnd() const { return wxDate(1, 1, GetYear()+1) - 1; } + wxDate GetYearEnd() const { return wxDate(0, 1, GetYear()+1) - 1; } bool IsBetween(const wxDate& first, const wxDate& second) const { diff --git a/include/wx/datetime.h b/include/wx/datetime.h index 1d7a329e67..688b2debf4 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -30,12 +30,14 @@ class WXDLLEXPORT wxDateSpan; // performances and this only leads to increased rebuild time (because every // time an inline method is changed, all files including the header must be // rebuilt) -#ifdef __WXDEBUG__ +// For Mingw32, causes a link error. +#if defined( __WXDEBUG__) && !defined(__MINGW32__) + #undef inline #define inline #endif // Debug /* - * TODO Well, everything :-) + * TODO * * + 1. Time zones with minutes (make TimeZone a class) * ? 2. getdate() function like under Solaris @@ -63,7 +65,7 @@ class WXDLLEXPORT wxDateSpan; wxTimeSpan + wxTimeSpan = wxTimeSpan wxDateSpan + wxDateSpan = wxDateSpan - substraction + subtraction ------------ wxDateTime - wxDateTime = wxTimeSpan wxDateTime - wxTimeSpan = wxDateTime @@ -84,7 +86,7 @@ class WXDLLEXPORT wxDateSpan; -wxDateSpan = wxDateSpan For each binary operation OP (+, -, *) we have the following operatorOP=() as - a method and the method with a symbolic name OPER (Add, Substract, Multiply) + a method and the method with a symbolic name OPER (Add, Subtract, Multiply) as a synonym for it and another const method with the same name which returns the changed copy of the object and operatorOP() as a global function which is implemented in terms of the const version of OPEN. For the unary - we have @@ -510,6 +512,10 @@ public: // return the wxDateTime object for the current time static inline wxDateTime Now(); + // return the wxDateTime object for the current time with millisecond + // precision (if available on this platform) + static wxDateTime UNow(); + // return the wxDateTime object for today midnight: i.e. as Now() but // with time set to 0 static inline wxDateTime Today(); @@ -855,10 +861,10 @@ public: inline wxDateTime& operator+=(const wxTimeSpan& diff); // return the difference of the date with a time span - inline wxDateTime Substract(const wxTimeSpan& diff) const; - // substract a time span (positive or negative) - inline wxDateTime& Substract(const wxTimeSpan& diff); - // substract a time span (positive or negative) + inline wxDateTime Subtract(const wxTimeSpan& diff) const; + // subtract a time span (positive or negative) + inline wxDateTime& Subtract(const wxTimeSpan& diff); + // subtract a time span (positive or negative) inline wxDateTime& operator-=(const wxTimeSpan& diff); // return the sum of the date with a date span @@ -869,14 +875,14 @@ public: inline wxDateTime& operator+=(const wxDateSpan& diff); // return the difference of the date with a date span - inline wxDateTime Substract(const wxDateSpan& diff) const; - // substract a date span (positive or negative) - inline wxDateTime& Substract(const wxDateSpan& diff); - // substract a date span (positive or negative) + inline wxDateTime Subtract(const wxDateSpan& diff) const; + // subtract a date span (positive or negative) + inline wxDateTime& Subtract(const wxDateSpan& diff); + // subtract a date span (positive or negative) inline wxDateTime& operator-=(const wxDateSpan& diff); // return the difference between two dates - inline wxTimeSpan Substract(const wxDateTime& dt) const; + inline wxTimeSpan Subtract(const wxDateTime& dt) const; // conversion to/from text: all conversions from text return the pointer to // the next character following the date specification (i.e. the one where @@ -961,7 +967,7 @@ private: // ---------------------------------------------------------------------------- // This class contains a difference between 2 wxDateTime values, so it makes -// sense to add it to wxDateTime and it is the result of substraction of 2 +// sense to add it to wxDateTime and it is the result of subtraction of 2 // objects of that class. See also wxDateSpan. // ---------------------------------------------------------------------------- @@ -1017,11 +1023,11 @@ public: wxTimeSpan& operator+=(const wxTimeSpan& diff) { return Add(diff); } // return the difference of two timespans - inline wxTimeSpan Substract(const wxTimeSpan& diff) const; - // substract another timespan - inline wxTimeSpan& Substract(const wxTimeSpan& diff); - // substract another timespan - wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Substract(diff); } + inline wxTimeSpan Subtract(const wxTimeSpan& diff) const; + // subtract another timespan + inline wxTimeSpan& Subtract(const wxTimeSpan& diff); + // subtract another timespan + wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Subtract(diff); } // multiply timespan by a scalar inline wxTimeSpan Multiply(int n) const; @@ -1094,11 +1100,7 @@ public: // resulting text representation. Notice that only some of format // specifiers valid for wxDateTime are valid for wxTimeSpan: hours, // minutes and seconds make sense, but not "PM/AM" string for example. - wxString Format(const wxChar *format = _T("%c")) const; - // preferred date representation for the current locale - wxString FormatDate() const { return Format(_T("%x")); } - // preferred time representation for the current locale - wxString FormatTime() const { return Format(_T("%X")); } + wxString Format(const wxChar *format = _T("%H:%M:%S")) const; // implementation // ------------------------------------------------------------------------ @@ -1125,7 +1127,7 @@ private: // won't be changed unless the resulting date would be invalid: for example, // Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31. // -// Because of this feature, adding and substracting back again the same +// Because of this feature, adding and subtracting back again the same // wxDateSpan will *not*, in general give back the original date: Feb 28 - 1 // month will be Jan 28, not Jan 31! // @@ -1212,10 +1214,10 @@ public: inline wxDateSpan& operator+=(const wxDateSpan& other); // return difference of two date spans - inline wxDateSpan Substract(const wxDateSpan& other) const; - // substract another wxDateSpan from us - inline wxDateSpan& Substract(const wxDateSpan& other); - // substract another wxDateSpan from us + inline wxDateSpan Subtract(const wxDateSpan& other) const; + // subtract another wxDateSpan from us + inline wxDateSpan& Subtract(const wxDateSpan& other); + // subtract another wxDateSpan from us inline wxDateSpan& operator-=(const wxDateSpan& other); // return a copy of this time span with changed sign @@ -1245,7 +1247,7 @@ private: #include "wx/dynarray.h" -WX_DECLARE_OBJARRAY(wxDateTime, wxDateTimeArray); +WX_DECLARE_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray); // ---------------------------------------------------------------------------- // wxDateTimeHolidayAuthority: an object of this class will decide whether a @@ -1262,7 +1264,7 @@ WX_DEFINE_EXPORTED_ARRAY(wxDateTimeHolidayAuthority *, wxHolidayAuthoritiesArray class wxDateTimeHolidaysModule; class WXDLLEXPORT wxDateTimeHolidayAuthority { - friend wxDateTimeHolidaysModule; +friend class wxDateTimeHolidaysModule; public: // returns TRUE if the given date is a holiday static bool IsHoliday(const wxDateTime& dt); @@ -1350,7 +1352,7 @@ inline wxDateTime WXDLLEXPORT operator+(const wxDateTime& dt, inline wxDateTime WXDLLEXPORT operator-(const wxDateTime& dt, const wxTimeSpan& ts) { - return dt.Substract(ts); + return dt.Subtract(ts); } inline wxDateTime WXDLLEXPORT operator+(const wxDateTime& dt, @@ -1362,13 +1364,13 @@ inline wxDateTime WXDLLEXPORT operator+(const wxDateTime& dt, inline wxDateTime WXDLLEXPORT operator-(const wxDateTime& dt, const wxDateSpan& ds) { - return dt.Substract(ds); + return dt.Subtract(ds); } inline wxTimeSpan WXDLLEXPORT operator-(const wxDateTime& dt1, const wxDateTime& dt2) { - return dt1.Substract(dt2); + return dt1.Subtract(dt2); } // comparison diff --git a/include/wx/datetime.inl b/include/wx/datetime.inl index e051b29503..302d65c195 100644 --- a/include/wx/datetime.inl +++ b/include/wx/datetime.inl @@ -40,19 +40,19 @@ const long wxDateTime::TIME_T_FACTOR = 1000l; #endif // wxDEFINE_TIME_CONSTANTS -WXDLLEXPORT bool wxDateTime::IsInStdRange() const +inline bool wxDateTime::IsInStdRange() const { return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX; } /* static */ -WXDLLEXPORT wxDateTime wxDateTime::Now() +inline wxDateTime wxDateTime::Now() { return wxDateTime(*GetTmNow()); } /* static */ -WXDLLEXPORT wxDateTime wxDateTime::Today() +inline wxDateTime wxDateTime::Today() { struct tm *tm = GetTmNow(); tm->tm_hour = @@ -63,7 +63,7 @@ WXDLLEXPORT wxDateTime wxDateTime::Today() } #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -WXDLLEXPORT wxDateTime& wxDateTime::Set(time_t timet) +inline wxDateTime& wxDateTime::Set(time_t timet) { // assign first to avoid long multiplication overflow! m_time = timet; @@ -73,56 +73,56 @@ WXDLLEXPORT wxDateTime& wxDateTime::Set(time_t timet) } #endif -WXDLLEXPORT wxDateTime& wxDateTime::SetToCurrent() +inline wxDateTime& wxDateTime::SetToCurrent() { *this = Now(); return *this; } #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -WXDLLEXPORT wxDateTime::wxDateTime(time_t timet) +inline wxDateTime::wxDateTime(time_t timet) { Set(timet); } #endif -WXDLLEXPORT wxDateTime::wxDateTime(const struct tm& tm) +inline wxDateTime::wxDateTime(const struct tm& tm) { Set(tm); } -WXDLLEXPORT wxDateTime::wxDateTime(const Tm& tm) +inline wxDateTime::wxDateTime(const Tm& tm) { Set(tm); } -WXDLLEXPORT wxDateTime::wxDateTime(double jdn) +inline wxDateTime::wxDateTime(double jdn) { Set(jdn); } -WXDLLEXPORT wxDateTime& wxDateTime::Set(const Tm& tm) +inline wxDateTime& wxDateTime::Set(const Tm& tm) { wxASSERT_MSG( tm.IsValid(), _T("invalid broken down date/time") ); return Set(tm.mday, (Month)tm.mon, tm.year, tm.hour, tm.min, tm.sec); } -WXDLLEXPORT wxDateTime::wxDateTime(wxDateTime_t hour, - wxDateTime_t minute, - wxDateTime_t second, - wxDateTime_t millisec) +inline wxDateTime::wxDateTime(wxDateTime_t hour, + wxDateTime_t minute, + wxDateTime_t second, + wxDateTime_t millisec) { Set(hour, minute, second, millisec); } -WXDLLEXPORT wxDateTime::wxDateTime(wxDateTime_t day, - Month month, - int year, - wxDateTime_t hour, - wxDateTime_t minute, - wxDateTime_t second, - wxDateTime_t millisec) +inline wxDateTime::wxDateTime(wxDateTime_t day, + Month month, + int year, + wxDateTime_t hour, + wxDateTime_t minute, + wxDateTime_t second, + wxDateTime_t millisec) { Set(day, month, year, hour, minute, second, millisec); } @@ -131,14 +131,14 @@ WXDLLEXPORT wxDateTime::wxDateTime(wxDateTime_t day, // wxDateTime accessors // ---------------------------------------------------------------------------- -WXDLLEXPORT wxLongLong wxDateTime::GetValue() const +inline wxLongLong wxDateTime::GetValue() const { wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); return m_time; } -WXDLLEXPORT time_t wxDateTime::GetTicks() const +inline time_t wxDateTime::GetTicks() const { wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); if ( !IsInStdRange() ) @@ -149,60 +149,61 @@ WXDLLEXPORT time_t wxDateTime::GetTicks() const return (time_t)((m_time / (long)TIME_T_FACTOR).GetLo()); } -WXDLLEXPORT bool wxDateTime::SetToLastWeekDay(WeekDay weekday, - Month month, - int year) +inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday, + Month month, + int year) { return SetToWeekDay(weekday, -1, month, year); } -WXDLLEXPORT wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday) const +inline wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday) const { MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) ); } -WXDLLEXPORT wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const +inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const { MODIFY_AND_RETURN( SetToNextWeekDay(weekday) ); } -WXDLLEXPORT wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const +inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const { MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) ); } -WXDLLEXPORT wxDateTime wxDateTime::GetWeekDay(WeekDay weekday, - int n, - Month month, - int year) const +inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday, + int n, + Month month, + int year) const { wxDateTime dt(*this); return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime; } -WXDLLEXPORT wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday, - Month month, - int year) +inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday, + Month month, + int year) { wxDateTime dt(*this); return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime; } -WXDLLEXPORT wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek, WeekDay weekday) const +inline wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek, + WeekDay weekday) const { wxDateTime dt(*this); return dt.SetToTheWeek(numWeek, weekday) ? dt : wxInvalidDateTime; } -WXDLLEXPORT wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const +inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const { MODIFY_AND_RETURN( SetToLastMonthDay(month, year) ); } -WXDLLEXPORT wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const +inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const { MODIFY_AND_RETURN( SetToYearDay(yday) ); } @@ -211,46 +212,47 @@ WXDLLEXPORT wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const // wxDateTime comparison // ---------------------------------------------------------------------------- -WXDLLEXPORT bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const +inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const { wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); return m_time == datetime.m_time; } -WXDLLEXPORT bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const +inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const { wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); return m_time < datetime.m_time; } -WXDLLEXPORT bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const +inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const { wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); return m_time > datetime.m_time; } -WXDLLEXPORT bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1, - const wxDateTime& t2) const +inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1, + const wxDateTime& t2) const { // no need for assert, will be checked by the functions we call return IsLaterThan(t1) && IsEarlierThan(t2); } -WXDLLEXPORT bool wxDateTime::IsBetween(const wxDateTime& t1, const wxDateTime& t2) const +inline bool wxDateTime::IsBetween(const wxDateTime& t1, + const wxDateTime& t2) const { // no need for assert, will be checked by the functions we call return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2); } -WXDLLEXPORT bool wxDateTime::IsSameDate(const wxDateTime& dt) const +inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const { return (m_time - dt.m_time).Abs() < MILLISECONDS_PER_DAY; } -WXDLLEXPORT bool wxDateTime::IsSameTime(const wxDateTime& dt) const +inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const { // notice that we can't do something like this: // @@ -266,23 +268,24 @@ WXDLLEXPORT bool wxDateTime::IsSameTime(const wxDateTime& dt) const tm1.msec == tm2.msec; } -WXDLLEXPORT bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const +inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, + const wxTimeSpan& ts) const { - return IsBetween(dt.Substract(ts), dt.Add(ts)); + return IsBetween(dt.Subtract(ts), dt.Add(ts)); } // ---------------------------------------------------------------------------- // wxDateTime arithmetics // ---------------------------------------------------------------------------- -WXDLLEXPORT wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const +inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const { wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); return wxDateTime(m_time + diff.GetValue()); } -WXDLLEXPORT wxDateTime& wxDateTime::Add(const wxTimeSpan& diff) +inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff) { wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); @@ -291,19 +294,19 @@ WXDLLEXPORT wxDateTime& wxDateTime::Add(const wxTimeSpan& diff) return *this; } -WXDLLEXPORT wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff) +inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff) { return Add(diff); } -WXDLLEXPORT wxDateTime wxDateTime::Substract(const wxTimeSpan& diff) const +inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const { wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); return wxDateTime(m_time - diff.GetValue()); } -WXDLLEXPORT wxDateTime& wxDateTime::Substract(const wxTimeSpan& diff) +inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff) { wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); @@ -312,39 +315,39 @@ WXDLLEXPORT wxDateTime& wxDateTime::Substract(const wxTimeSpan& diff) return *this; } -WXDLLEXPORT wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff) +inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff) { - return Substract(diff); + return Subtract(diff); } -WXDLLEXPORT wxTimeSpan wxDateTime::Substract(const wxDateTime& datetime) const +inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const { wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); - return wxTimeSpan(datetime.GetValue() - GetValue()); + return wxTimeSpan(GetValue() - datetime.GetValue()); } -WXDLLEXPORT wxDateTime wxDateTime::Add(const wxDateSpan& diff) const +inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const { return wxDateTime(*this).Add(diff); } -WXDLLEXPORT wxDateTime& wxDateTime::Substract(const wxDateSpan& diff) +inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff) { return Add(diff.Negate()); } -WXDLLEXPORT wxDateTime wxDateTime::Substract(const wxDateSpan& diff) const +inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const { - return wxDateTime(*this).Substract(diff); + return wxDateTime(*this).Subtract(diff); } -WXDLLEXPORT wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff) +inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff) { - return Substract(diff); + return Subtract(diff); } -WXDLLEXPORT wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff) +inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff) { return Add(diff); } @@ -353,8 +356,8 @@ WXDLLEXPORT wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff) // wxDateTime and timezones // ---------------------------------------------------------------------------- -WXDLLEXPORT wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, - bool noDST) const +inline wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, + bool noDST) const { MODIFY_AND_RETURN( MakeTimezone(tz, noDST) ); } @@ -363,7 +366,10 @@ WXDLLEXPORT wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, // wxTimeSpan construction // ---------------------------------------------------------------------------- -WXDLLEXPORT wxTimeSpan::wxTimeSpan(long hours, long minutes, long seconds, long milliseconds) +inline wxTimeSpan::wxTimeSpan(long hours, + long minutes, + long seconds, + long milliseconds) { // assign first to avoid precision loss m_diff = hours; @@ -379,27 +385,27 @@ WXDLLEXPORT wxTimeSpan::wxTimeSpan(long hours, long minutes, long seconds, long // wxTimeSpan accessors // ---------------------------------------------------------------------------- -WXDLLEXPORT wxLongLong wxTimeSpan::GetSeconds() const +inline wxLongLong wxTimeSpan::GetSeconds() const { return m_diff / 1000l; } -WXDLLEXPORT int wxTimeSpan::GetMinutes() const +inline int wxTimeSpan::GetMinutes() const { return (GetSeconds() / 60l).GetLo(); } -WXDLLEXPORT int wxTimeSpan::GetHours() const +inline int wxTimeSpan::GetHours() const { return GetMinutes() / 60; } -WXDLLEXPORT int wxTimeSpan::GetDays() const +inline int wxTimeSpan::GetDays() const { return GetHours() / 24; } -WXDLLEXPORT int wxTimeSpan::GetWeeks() const +inline int wxTimeSpan::GetWeeks() const { return GetDays() / 7; } @@ -408,53 +414,53 @@ WXDLLEXPORT int wxTimeSpan::GetWeeks() const // wxTimeSpan arithmetics // ---------------------------------------------------------------------------- -WXDLLEXPORT wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const +inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const { return wxTimeSpan(m_diff + diff.GetValue()); } -WXDLLEXPORT wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff) +inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff) { m_diff += diff.GetValue(); return *this; } -WXDLLEXPORT wxTimeSpan wxTimeSpan::Substract(const wxTimeSpan& diff) const +inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const { return wxTimeSpan(m_diff - diff.GetValue()); } -WXDLLEXPORT wxTimeSpan& wxTimeSpan::Substract(const wxTimeSpan& diff) +inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff) { m_diff -= diff.GetValue(); return *this; } -WXDLLEXPORT wxTimeSpan& wxTimeSpan::Multiply(int n) +inline wxTimeSpan& wxTimeSpan::Multiply(int n) { m_diff *= (long)n; return *this; } -WXDLLEXPORT wxTimeSpan wxTimeSpan::Multiply(int n) const +inline wxTimeSpan wxTimeSpan::Multiply(int n) const { return wxTimeSpan(m_diff * (long)n); } -WXDLLEXPORT wxTimeSpan wxTimeSpan::Abs() const +inline wxTimeSpan wxTimeSpan::Abs() const { return wxTimeSpan(GetValue().Abs()); } -WXDLLEXPORT bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const +inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const { return GetValue() == ts.GetValue(); } -WXDLLEXPORT bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const +inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const { return GetValue().Abs() > ts.GetValue().Abs(); } @@ -463,8 +469,7 @@ WXDLLEXPORT bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const // wxDateSpan // ---------------------------------------------------------------------------- -WXDLLEXPORT wxDateSpan& -wxDateSpan::operator+=(const wxDateSpan& other) +inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other) { m_years += other.m_years; m_months += other.m_months; @@ -474,7 +479,19 @@ wxDateSpan::operator+=(const wxDateSpan& other) return *this; } -WXDLLEXPORT wxDateSpan& wxDateSpan::Multiply(int factor) +inline wxDateSpan& wxDateSpan::Add(const wxDateSpan& other) +{ + return *this += other; +} + +inline wxDateSpan wxDateSpan::Add(const wxDateSpan& other) const +{ + wxDateSpan ds(*this); + ds.Add(other); + return ds; +} + +inline wxDateSpan& wxDateSpan::Multiply(int factor) { m_years *= factor; m_months *= factor; @@ -484,17 +501,19 @@ WXDLLEXPORT wxDateSpan& wxDateSpan::Multiply(int factor) return *this; } -WXDLLEXPORT wxDateSpan wxDateSpan::Multiply(int factor) const +inline wxDateSpan wxDateSpan::Multiply(int factor) const { - return wxDateSpan(*this).Multiply(factor); + wxDateSpan ds(*this); + ds.Multiply(factor); + return ds; } -WXDLLEXPORT wxDateSpan wxDateSpan::Negate() const +inline wxDateSpan wxDateSpan::Negate() const { return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days); } -WXDLLEXPORT wxDateSpan& wxDateSpan::Neg() +inline wxDateSpan& wxDateSpan::Neg() { m_years = -m_years; m_months = -m_months; @@ -504,6 +523,23 @@ WXDLLEXPORT wxDateSpan& wxDateSpan::Neg() return *this; } +inline wxDateSpan& wxDateSpan::operator-=(const wxDateSpan& other) +{ + return *this += other.Negate(); +} + +inline wxDateSpan& wxDateSpan::Subtract(const wxDateSpan& other) +{ + return *this -= other; +} + +inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const +{ + wxDateSpan ds(*this); + ds.Subtract(other); + return ds; +} + #undef MILLISECONDS_PER_DAY #undef MODIFY_AND_RETURN diff --git a/include/wx/db.h b/include/wx/db.h index ab4310297b..c0763f6fd5 100644 --- a/include/wx/db.h +++ b/include/wx/db.h @@ -1,7 +1,7 @@ /////////////////////////////////////////////////////////////////////////////// // Name: db.h -// Purpose: Header file wxDB class. The wxDB class represents a connection -// to an ODBC data source. The wxDB class allows operations on the data +// Purpose: Header file wxDb class. The wxDb class represents a connection +// to an ODBC data source. The wxDb class allows operations on the data // source such as opening and closing the data source. // Author: Doug Card // Modified by: George Tasker @@ -38,6 +38,12 @@ #ifndef DB_DOT_H #define DB_DOT_H + +// BJO 20000503: introduce new GetColumns members which are more database independant and +// return columns in the order they were created +#define OLD_GETCOLUMNS 1 + + // Use this line for wxWindows v1.x //#include "wx_ver.h" // Use this line for wxWindows v2.x @@ -93,7 +99,7 @@ enum enumDummy {enumDum1}; #define FALSE 0 #endif -const int DB_PATH_MAX = 254; +const int wxDB_PATH_MAX = 254; extern char const *SQL_LOG_FILENAME; extern char const *SQL_CATALOG_FILENAME; @@ -243,10 +249,10 @@ struct wxDbConnectInf char fileType[SQL_MAX_DSN_LENGTH+1]; // Not sure what the max length is // Optionals needed for some databases like dBase - char defaultDir[DB_PATH_MAX]; // Directory that db file resides in + char defaultDir[wxDB_PATH_MAX]; // Directory that db file resides in }; -struct wxSqlTypeInfo +struct wxDbSqlTypeInfo { char TypeName[DB_TYPE_NAME_LEN]; int FsqlType; @@ -257,7 +263,7 @@ struct wxSqlTypeInfo }; -class WXDLLEXPORT wxColFor +class WXDLLEXPORT wxDbColFor { public: wxString s_Field; // Formated String for Output @@ -268,14 +274,14 @@ public: int i_dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes SWORD i_sqlDataType; - wxColFor(); - ~wxColFor(); + wxDbColFor(); + ~wxDbColFor(); int Format(int Nation, int dbDataType, SWORD sqlDataType, short columnSize, short decimalDigits); }; -class WXDLLEXPORT wxColInf +class WXDLLEXPORT wxDbColInf { public: char catalog[128+1]; @@ -296,39 +302,41 @@ public: char PkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Tables that use this PKey as a FKey int FkCol; // Foreign key column 0=No; 1= First Key, 2 = Second Key etc. char FkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Foreign key table name - wxColFor *pColFor; // How should this columns be formatted + wxDbColFor *pColFor; // How should this columns be formatted }; -class WXDLLEXPORT wxTableInf // Description of a Table + + +class WXDLLEXPORT wxDbTableInf // Description of a Table { public: - char tableName[DB_MAX_TABLE_NAME_LEN+1]; - char tableType[254+1]; // "TABLE" or "SYSTEM TABLE" etc. - char tableRemarks[254+1]; - int numCols; // How many Columns does this Table have: GetColumnCount(..); - wxColInf *pColInf; // pColInf = NULL ; User can later call GetColumns(..); + char tableName[DB_MAX_TABLE_NAME_LEN+1]; + char tableType[254+1]; // "TABLE" or "SYSTEM TABLE" etc. + char tableRemarks[254+1]; + int numCols; // How many Columns does this Table have: GetColumnCount(..); + wxDbColInf *pColInf; // pColInf = NULL ; User can later call GetColumns(..); }; class WXDLLEXPORT wxDbInf // Description of a Database { public: - char catalog[128+1]; - char schema[128+1]; - int numTables; // How many tables does this database have - wxTableInf *pTableInf; // pTableInf = new wxTableInf[numTables]; + char catalog[128+1]; + char schema[128+1]; + int numTables; // How many tables does this database have + wxDbTableInf *pTableInf; // pTableInf = new wxDbTableInf[numTables]; }; -enum wxSqlLogState +enum wxDbSqlLogState { sqlLogOFF, sqlLogON }; // These are the databases currently tested and working with these classes -// See the comments in wxDB::Dbms() for exceptions/issues with +// See the comments in wxDb::Dbms() for exceptions/issues with // each of these database engines enum wxDBMS { @@ -341,21 +349,22 @@ enum wxDBMS dbmsPOSTGRES, dbmsACCESS, dbmsDBASE, - dbmsINFORMIX + dbmsINFORMIX, + dbmsVIRTUOSO }; -// The wxDB::errorList is copied to this variable when the wxDB object +// The wxDb::errorList is copied to this variable when the wxDb object // is closed. This way, the error list is still available after the // database object is closed. This is necessary if the database // connection fails so the calling application can show the operator -// why the connection failed. Note: as each wxDB object is closed, it -// will overwrite the errors of the previously destroyed wxDB object in +// why the connection failed. Note: as each wxDb object is closed, it +// will overwrite the errors of the previously destroyed wxDb object in // this variable. extern char DBerrorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN]; -class WXDLLEXPORT wxDB +class WXDLLEXPORT wxDb { private: bool dbIsOpen; @@ -363,16 +372,52 @@ private: char *uid; // User ID char *authStr; // Authorization string (password) FILE *fpSqlLog; // Sql Log file pointer - wxSqlLogState sqlLogState; // On or Off + wxDbSqlLogState sqlLogState; // On or Off bool fwdOnlyCursors; // Private member functions bool getDbInfo(void); - bool getDataTypeInfo(SWORD fSqlType, wxSqlTypeInfo &structSQLTypeInfo); + bool getDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo); bool setConnectionOptions(void); void logError(const char *errMsg, const char *SQLState); +#if !wxODBC_BACKWARD_COMPATABILITY + // ODBC handles + HENV henv; // ODBC Environment handle + HDBC hdbc; // ODBC DB Connection handle + HSTMT hstmt; // ODBC Statement handle + + //Error reporting mode + bool silent; + + // Number of Ctable objects connected to this db object. FOR INTERNAL USE ONLY!!! + unsigned int nTables; + + // Information about logical data types VARCHAR, INTEGER, FLOAT and DATE. + // + // This information is obtained from the ODBC driver by use of the + // SQLGetTypeInfo() function. The key piece of information is the + // type name the data source uses for each logical data type. + // e.g. VARCHAR; Oracle calls it VARCHAR2. + wxDbSqlTypeInfo typeInfVarchar; + wxDbSqlTypeInfo typeInfInteger; + wxDbSqlTypeInfo typeInfFloat; + wxDbSqlTypeInfo typeInfDate; +#endif public: +#if wxODBC_BACKWARD_COMPATABILITY + // ODBC handles + HENV henv; // ODBC Environment handle + HDBC hdbc; // ODBC DB Connection handle + HSTMT hstmt; // ODBC Statement handle + + //Error reporting mode + bool silent; + + // Number of Ctable objects connected to this db object. FOR INTERNAL USE ONLY!!! + unsigned int nTables; +#endif + // The following structure contains database information gathered from the // datasource when the datasource is first opened. struct @@ -409,34 +454,29 @@ public: UDWORD loginTimeout; // Number seconds to wait for a login request } dbInf; - // ODBC handles - HENV henv; // ODBC Environment handle - HDBC hdbc; // ODBC DB Connection handle - HSTMT hstmt; // ODBC Statement handle - // ODBC Error Inf. - char sqlState[20]; - SDWORD nativeError; - char errorMsg[SQL_MAX_MESSAGE_LENGTH]; SWORD cbErrorMsg; - char errorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN]; int DB_STATUS; + wxChar errorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN]; + wxChar errorMsg[SQL_MAX_MESSAGE_LENGTH]; + SDWORD nativeError; + wxChar sqlState[20]; - //Error reporting mode - bool silent; - - // Number of Ctable objects connected to this db object - unsigned int nTables; - - // Inf. about logical data types VARCHAR, INTEGER, FLOAT and DATE. - // This inf. is obtained from the ODBC driver by use of the - // SQLGetTypeInfo() function. The key piece of inf. is the +#if wxODBC_BACKWARD_COMPATABILITY + // Information about logical data types VARCHAR, INTEGER, FLOAT and DATE. + // + // This information is obtained from the ODBC driver by use of the + // SQLGetTypeInfo() function. The key piece of information is the // type name the data source uses for each logical data type. // e.g. VARCHAR; Oracle calls it VARCHAR2. - wxSqlTypeInfo typeInfVarchar, typeInfInteger, typeInfFloat, typeInfDate; + wxDbSqlTypeInfo typeInfVarchar; + wxDbSqlTypeInfo typeInfInteger; + wxDbSqlTypeInfo typeInfFloat; + wxDbSqlTypeInfo typeInfDate; +#endif // Public member functions - wxDB(HENV &aHenv, bool FwdOnlyCursors=(bool)TRUE); + wxDb(HENV &aHenv, bool FwdOnlyCursors=(bool)TRUE); bool Open(char *Dsn, char *Uid, char *AuthStr); // Data Source Name, User ID, Password void Close(void); bool CommitTrans(void); @@ -450,12 +490,14 @@ public: bool GetNext(void); bool GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FAR *cbReturned); bool Grant(int privileges, const char *tableName, const char *userList = "PUBLIC"); - int TranslateSqlState(const char *SQLState); + int TranslateSqlState(const wxChar *SQLState); wxDbInf *GetCatalog(char *userID); bool Catalog(const char *userID=NULL, const char *fileName = SQL_CATALOG_FILENAME); - int GetKeyFields(char *tableName, wxColInf* colInf,int nocols); - wxColInf *GetColumns(char *tableName[], const char *userID=NULL); - wxColInf *GetColumns(char *tableName, int *numCols, const char *userID=NULL); + int GetKeyFields(char *tableName, wxDbColInf* colInf, int nocols); + + wxDbColInf *GetColumns(char *tableName[], const char *userID=NULL); + wxDbColInf *GetColumns(char *tableName, int *numCols, const char *userID=NULL); + int GetColumnCount(char *tableName, const char *userID=NULL); char *GetDatabaseName(void) {return dbInf.dbmsName;} char *GetDataSource(void) {return dsn;} @@ -465,13 +507,26 @@ public: HENV GetHENV(void) {return henv;} HDBC GetHDBC(void) {return hdbc;} HSTMT GetHSTMT(void) {return hstmt;} + int GetTableCount() {return nTables;}; // number of tables using this connection + wxDbSqlTypeInfo GetTypeInfVarchar(){return typeInfVarchar;} + wxDbSqlTypeInfo GetTypeInfInteger(){return typeInfInteger;} + wxDbSqlTypeInfo GetTypeInfFloat() {return typeInfFloat;} + wxDbSqlTypeInfo GetTypeInfDate() {return typeInfDate;} + bool TableExists(const char *tableName, const char *userID=NULL, const char *path=NULL); // Table name can refer to a table, view, alias or synonym void LogError(const char *errMsg, const char *SQLState = 0) {logError(errMsg, SQLState);} - bool SqlLog(wxSqlLogState state, const char *filename = SQL_LOG_FILENAME, bool append = FALSE); - bool WriteSqlLog(const char *logMsg); + void SetDebugErrorMessages(bool state) { silent = !state; } + bool SetSqlLogging(wxDbSqlLogState state, const wxChar *filename = SQL_LOG_FILENAME, bool append = FALSE); + bool WriteSqlLog(const wxChar *logMsg); wxDBMS Dbms(void); - bool FwdOnlyCursors(void) {return fwdOnlyCursors;} -}; // wxDB + bool FwdOnlyCursors(void) {return fwdOnlyCursors;} + + // These two functions are provided strictly for use by wxDbTable. + // DO NOT USE THESE FUNCTIONS, OR MEMORY LEAKS MAY OCCUR + void incrementTableCount() { nTables++; return; } + void decrementTableCount() { nTables--; return; } + +}; // wxDb // This structure forms a node in a linked list. The linked list of "DbList" objects @@ -481,8 +536,8 @@ public: struct wxDbList { wxDbList *PtrPrev; // Pointer to previous item in the list - char Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name - wxDB *PtrDb; // Pointer to the wxDB object + wxChar Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name + wxDb *PtrDb; // Pointer to the wxDb object bool Free; // Is item free or in use? wxDbList *PtrNext; // Pointer to next item in the list }; @@ -494,7 +549,7 @@ class wxTablesInUse : public wxObject public: const char *tableName; ULONG tableID; - class wxDB *pDb; + class wxDb *pDb; }; // wxTablesInUse #endif @@ -502,14 +557,14 @@ class wxTablesInUse : public wxObject // The following routines allow a user to get new database connections, free them // for other code segments to use, or close all of them when the application has // completed. -wxDB WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS); -bool WXDLLEXPORT wxDbFreeConnection(wxDB *pDb); +wxDb WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS); +bool WXDLLEXPORT wxDbFreeConnection(wxDb *pDb); void WXDLLEXPORT wxDbCloseConnections(void); int WXDLLEXPORT wxDbConnectionsInUse(void); -// This function sets the sql log state for all open wxDB objects -bool wxDbSqlLog(wxSqlLogState state, const char *filename = SQL_LOG_FILENAME); +// This function sets the sql log state for all open wxDb objects +bool wxDbSqlLog(wxDbSqlLogState state, const wxChar *filename = SQL_LOG_FILENAME); #if 0 @@ -527,22 +582,30 @@ bool WXDLLEXPORT wxDbGetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsD // Change this to 0 to remove use of all deprecated functions -#if 1 +#if wxODBC_BACKWARD_COMPATABILITY //################################################################################# //############### DEPRECATED functions for backward compatability ################# //################################################################################# // Backward compability structures/classes. This will eventually go away -typedef wxColInf CcolInf; -typedef wxSqlTypeInfo SqlTypeInfo; -typedef enum wxSqlLogState sqlLog; -typedef enum wxDBMS dbms; -typedef enum wxDBMS DBMS; -typedef wxODBC_ERRORS ODBC_ERRORS; -typedef wxDbConnectInf DbStuff; -typedef wxDbList DbList; +const int DB_PATH_MAX = wxDB_PATH_MAX; + +typedef wxDb wxDB; +typedef wxDbTableInf wxTableInf; +typedef wxDbColInf wxColInf; +typedef wxDbColInf CcolInf; +typedef wxDbColFor wxColFor; +typedef wxDbSqlTypeInfo SqlTypeInfo; +typedef wxDbSqlTypeInfo wxSqlTypeInfo; +typedef enum wxDbSqlLogState sqlLog; +typedef enum wxDbSqlLogState wxSqlLogState; +typedef enum wxDBMS dbms; +typedef enum wxDBMS DBMS; +typedef wxODBC_ERRORS ODBC_ERRORS; +typedef wxDbConnectInf DbStuff; +typedef wxDbList DbList; #ifdef __WXDEBUG__ -typedef wxTablesInUse CstructTablesInUse; +typedef wxTablesInUse CstructTablesInUse; #endif // Deprecated function names that are replaced by the function names listed above @@ -551,7 +614,7 @@ bool WXDLLEXPORT FreeDbConnection(wxDB *pDb); void WXDLLEXPORT CloseDbConnections(void); int WXDLLEXPORT NumberDbConnectionsInUse(void); -bool SqlLog(sqlLog state, const char *filename = SQL_LOG_FILENAME); +bool SqlLog(sqlLog state, const wxChar *filename = SQL_LOG_FILENAME); bool WXDLLEXPORT GetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD DsDescMax, UWORD direction = SQL_FETCH_NEXT); diff --git a/include/wx/dbtable.h b/include/wx/dbtable.h index 5a5e5c9a85..6f7e6866d5 100644 --- a/include/wx/dbtable.h +++ b/include/wx/dbtable.h @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // Name: dbtable.h -// Purpose: Declaration of the wxTable class. +// Purpose: Declaration of the wxDbTable class. // Author: Doug Card // Modified by: George Tasker // Created: 9.96 @@ -43,20 +43,20 @@ #include "db.h" #endif -const int ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger -const int DEFAULT_CURSOR = 0; -const bool QUERY_ONLY = TRUE; -const bool DISABLE_VIEW = TRUE; +const int wxDB_ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger +const int wxDB_DEFAULT_CURSOR = 0; +const bool wxDB_QUERY_ONLY = TRUE; +const bool wxDB_DISABLE_VIEW = TRUE; // The following class is used to define a column of a table. -// The wxTable constructor will dynamically allocate as many of +// The wxDbTable constructor will dynamically allocate as many of // these as there are columns in the table. The class derived -// from wxTable must initialize these column definitions in it's +// from wxDbTable must initialize these column definitions in it's // constructor. These column definitions provide inf. to the -// wxTable class which allows it to create a table in the data +// wxDbTable class which allows it to create a table in the data // source, exchange data between the data source and the C++ // object, and so on. -class WXDLLEXPORT wxColDef +class WXDLLEXPORT wxDbColDef { public: char ColName[DB_MAX_COLUMN_NAME_LEN+1]; // Column Name @@ -70,34 +70,35 @@ public: bool DerivedCol; // Specifies whether this column is a derived value SDWORD CbValue; // Internal use only!!! bool Null; // NOT FULLY IMPLEMENTED - Allows NULL values in Inserts and Updates -}; // wxColDef +}; // wxDbColDef -class WXDLLEXPORT wxColDataPtr +class WXDLLEXPORT wxDbColDataPtr { public: void *PtrDataObj; int SzDataObj; int SqlCtype; -}; // wxColDataPtr +}; // wxDbColDataPtr // This structure is used when creating secondary indexes. -class WXDLLEXPORT wxIdxDef +class WXDLLEXPORT wxDbIdxDef { public: char ColName[DB_MAX_COLUMN_NAME_LEN+1]; bool Ascending; -}; // wxIdxDef +}; // wxDbIdxDef -class WXDLLEXPORT wxTable +class WXDLLEXPORT wxDbTable { private: ULONG tableID; // Used for debugging. This can help to match up mismatched constructors/destructors // Private member variables UDWORD cursorType; + bool insertable; // Private member functions bool bindInsertParams(void); @@ -106,117 +107,209 @@ private: bool getRec(UWORD fetchType); bool execDelete(const char *pSqlStmt); bool execUpdate(const char *pSqlStmt); - bool query(int queryType, bool forUpdate, bool distinct, char *pSqlStmt = 0); + bool query(int queryType, bool forUpdate, bool distinct, const char *pSqlStmt = 0); -public: - // Pointer to the database object this table belongs to - wxDB *pDb; +#if !wxODBC_BACKWARD_COMPATABILITY +// these were public + // Where, Order By and From clauses + wxString where; // Standard SQL where clause, minus the word WHERE + wxString orderBy; // Standard SQL order by clause, minus the ORDER BY + wxString from; // Allows for joins in a wxDbTable::Query(). Format: ",tbl,tbl..." // ODBC Handles - HENV henv; // ODBC Environment handle - HDBC hdbc; // ODBC DB Connection handle - HSTMT hstmt; // ODBC Statement handle - HSTMT *hstmtDefault; // Default cursor - HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts - HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes - HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates - HSTMT hstmtInternal; // ODBC Statement handle used internally only - HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns) + HENV henv; // ODBC Environment handle + HDBC hdbc; // ODBC DB Connection handle + HSTMT hstmt; // ODBC Statement handle + HSTMT *hstmtDefault; // Default cursor + HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts + HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes + HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates + HSTMT hstmtInternal; // ODBC Statement handle used internally only + HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns) - // Table Inf. - char tableName[DB_MAX_TABLE_NAME_LEN+1]; // Table name - char queryTableName[DB_MAX_TABLE_NAME_LEN+1]; // Query Table Name - int noCols; // # of columns in the table - bool queryOnly; // Query Only, no inserts, updates or deletes + // Flags + bool selectForUpdate; - char tablePath[DB_PATH_MAX]; // needed for dBase tables + // Pointer to the database object this table belongs to + wxDb *pDb; - // Column Definitions - wxColDef *colDefs; // Array of wxColDef structures + // Table Inf. + char tablePath[wxDB_PATH_MAX]; // needed for dBase tables + char tableName[DB_MAX_TABLE_NAME_LEN+1]; // Table name + char queryTableName[DB_MAX_TABLE_NAME_LEN+1]; // Query Table Name + int noCols; // # of columns in the table + bool queryOnly; // Query Only, no inserts, updates or deletes + // Column Definitions + wxDbColDef *colDefs; // Array of wxDbColDef structures +#endif +public: +#if wxODBC_BACKWARD_COMPATABILITY // Where, Order By and From clauses - char *where; // Standard SQL where clause, minus the word WHERE - char *orderBy; // Standard SQL order by clause, minus the ORDER BY - char *from; // Allows for joins in a wxTable::Query(). Format: ",tbl,tbl..." + char *where; // Standard SQL where clause, minus the word WHERE + char *orderBy; // Standard SQL order by clause, minus the ORDER BY + char *from; // Allows for joins in a wxDbTable::Query(). Format: ",tbl,tbl..." + + // ODBC Handles + HENV henv; // ODBC Environment handle + HDBC hdbc; // ODBC DB Connection handle + HSTMT hstmt; // ODBC Statement handle + HSTMT *hstmtDefault; // Default cursor + HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts + HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes + HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates + HSTMT hstmtInternal; // ODBC Statement handle used internally only + HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns) // Flags - bool selectForUpdate; + bool selectForUpdate; + // Pointer to the database object this table belongs to + wxDb *pDb; + + // Table Inf. + char tablePath[wxDB_PATH_MAX]; // needed for dBase tables + char tableName[DB_MAX_TABLE_NAME_LEN+1]; // Table name + char queryTableName[DB_MAX_TABLE_NAME_LEN+1]; // Query Table Name + int noCols; // # of columns in the table + bool queryOnly; // Query Only, no inserts, updates or deletes + + // Column Definitions + wxDbColDef *colDefs; // Array of wxDbColDef structures +#endif // Public member functions - wxTable(wxDB *pwxDB, const char *tblName, const int nCols, - const char *qryTblName = 0, bool qryOnly = !QUERY_ONLY, const char *tblPath=NULL); - virtual ~wxTable(); - bool Open(void); - bool CreateTable(bool attemptDrop=TRUE); - bool DropTable(void); - bool CreateIndex(const char * idxName, bool unique, int noIdxCols, wxIdxDef *pIdxDefs, bool attemptDrop=TRUE); - bool DropIndex(const char * idxName); - bool CloseCursor(HSTMT cursor); - int Insert(void); - bool Update(void); - bool Update(const char *pSqlStmt); - bool UpdateWhere(const char *pWhereClause); - bool Delete(void); - bool DeleteWhere(const char *pWhereClause); - bool DeleteMatching(void); - virtual bool Query(bool forUpdate = FALSE, bool distinct = FALSE); - bool QueryBySqlStmt(char *pSqlStmt); - bool QueryMatching(bool forUpdate = FALSE, bool distinct = FALSE); - bool QueryOnKeyFields(bool forUpdate = FALSE, bool distinct = FALSE); - bool GetNext(void) { return(getRec(SQL_FETCH_NEXT)); } - bool operator++(int) { return(getRec(SQL_FETCH_NEXT)); } - - /***** These four functions only work with wxDB instances that are defined ***** + wxDbTable(wxDb *pwxDb, const char *tblName, const int nCols, + const char *qryTblName = 0, bool qryOnly = !wxDB_QUERY_ONLY, const char *tblPath=NULL); + virtual ~wxDbTable(); + + bool Open(void); + bool CreateTable(bool attemptDrop=TRUE); + bool DropTable(void); + bool CreateIndex(const char * idxName, bool unique, int noIdxCols, wxDbIdxDef *pIdxDefs, bool attemptDrop=TRUE); + bool DropIndex(const char * idxName); + +// Accessors + + // The member variables returned by these accessors are all + // set when the wxDbTable instance is createand cannot be + // changed, hence there is no corresponding SetXxxx function + wxDb *GetDb() { return pDb; } + const char *GetTableName() { return tableName; } + const char *GetQueryTableName() { return queryTableName; } + const char *GetTablePath() { return tablePath; } + + int GetNumberOfColumns() { return noCols; } // number of "defined" columns for this wxDbTable instance + + + const char *GetFromClause() { return from; } + const char *GetOrderByClause() { return orderBy; } + const char *GetWhereClause() { return where; } + + bool IsQueryOnly() { return queryOnly; } +#if wxODBC_BACKWARD_COMPATABILITY + void SetFromClause(const char *From) { from = (char *)From; } + void SetOrderByClause(const char *OrderBy) { orderBy = (char *)OrderBy; } + void SetWhereClause(const char *Where) { where = (char *)Where; } +#else + void SetFromClause(const wxString& From) { from = From; } + void SetOrderByClause(const wxString& OrderBy) { orderBy = OrderBy; } + void SetWhereClause(const wxString& Where) { where = Where; } +#endif + int Insert(void); + bool Update(void); + bool Update(const char *pSqlStmt); + bool UpdateWhere(const char *pWhereClause); + bool Delete(void); + bool DeleteWhere(const char *pWhereClause); + bool DeleteMatching(void); + virtual bool Query(bool forUpdate = FALSE, bool distinct = FALSE); + bool QueryBySqlStmt(const char *pSqlStmt); + bool QueryMatching(bool forUpdate = FALSE, bool distinct = FALSE); + bool QueryOnKeyFields(bool forUpdate = FALSE, bool distinct = FALSE); + bool Refresh(void); + bool GetNext(void) { return(getRec(SQL_FETCH_NEXT)); } + bool operator++(int) { return(getRec(SQL_FETCH_NEXT)); } + + /***** These four functions only work with wxDb instances that are defined ***** ***** as not being FwdOnlyCursors *****/ - bool GetPrev(void); - bool operator--(int); - bool GetFirst(void); - bool GetLast(void); - - bool IsCursorClosedOnCommit(void); - bool IsColNull(int colNo); - UWORD GetRowNum(void); - void GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct); - void GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = 0); - void GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = 0); - void GetWhereClause(char *pWhereClause, int typeOfWhere, const char *qualTableName = 0, bool useLikeComparison=FALSE); - bool CanSelectForUpdate(void); - bool CanUpdByROWID(void); - void ClearMemberVars(void); - bool SetQueryTimeout(UDWORD nSeconds); - void SetColDefs (int index, const char *fieldName, int dataType, void *pData, int cType, - int size, bool keyField = FALSE, bool upd = TRUE, - bool insAllow = TRUE, bool derivedCol = FALSE); - wxColDataPtr* SetColDefs (wxColInf *colInfs, ULONG numCols); - - HSTMT *NewCursor(bool setCursor = FALSE, bool bindColumns = TRUE); - bool DeleteCursor(HSTMT *hstmtDel); - void SetCursor(HSTMT *hstmtActivate = (void **) DEFAULT_CURSOR); - HSTMT GetCursor(void) { return(hstmt); } - ULONG Count(const char *args="*"); - int DB_STATUS(void) { return(pDb->DB_STATUS); } - bool Refresh(void); - bool SetNull(int colNo); - bool SetNull(const char *colName); + bool GetPrev(void); + bool operator--(int); + bool GetFirst(void); + bool GetLast(void); + + bool IsCursorClosedOnCommit(void); + UWORD GetRowNum(void); + + void BuildSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct); + void BuildDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = 0); + void BuildUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = 0); + void BuildWhereClause(char *pWhereClause, int typeOfWhere, const char *qualTableName = 0, bool useLikeComparison=FALSE); +#if wxODBC_BACKWARD_COMPATABILITY +// The following member functions are deprecated. You should use the BuildXxxxxStmt functions (above) + void GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct) + { BuildSelectStmt(pSqlStmt,typeOfSelect,distinct); } + void GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = 0) + { BuildDeleteStmt(pSqlStmt,typeOfDel,pWhereClause); } + void GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = 0) + { BuildUpdateStmt(pSqlStmt,typeOfUpd,pWhereClause); } + void GetWhereClause(char *pWhereClause, int typeOfWhere, + const char *qualTableName = 0, bool useLikeComparison=FALSE) + { BuildWhereClause(pWhereClause,typeOfWhere,qualTableName,useLikeComparison); } +#endif + bool CanSelectForUpdate(void); + bool CanUpdByROWID(void); + void ClearMemberVars(void); + bool SetQueryTimeout(UDWORD nSeconds); + + wxDbColDef *GetColDefs() { return colDefs; } + void SetColDefs(int index, const char *fieldName, int dataType, void *pData, int cType, + int size, bool keyField = FALSE, bool upd = TRUE, + bool insAllow = TRUE, bool derivedCol = FALSE); + wxDbColDataPtr *SetColDefs(wxDbColInf *colInfs, ULONG numCols); + + bool CloseCursor(HSTMT cursor); + bool DeleteCursor(HSTMT *hstmtDel); + void SetCursor(HSTMT *hstmtActivate = (void **) wxDB_DEFAULT_CURSOR); + HSTMT GetCursor(void) { return(hstmt); } + HSTMT *GetNewCursor(bool setCursor = FALSE, bool bindColumns = TRUE); +#if wxODBC_BACKWARD_COMPATABILITY +// The following member function is deprecated. You should use the GetNewCursor + HSTMT *NewCursor(bool setCursor = FALSE, bool bindColumns = TRUE) { return GetNewCursor(setCursor,bindColumns); } +#endif + + ULONG Count(const char *args="*"); + int DB_STATUS(void) { return(pDb->DB_STATUS); } + + bool IsColNull(int colNo); + bool SetNull(int colNo); + bool SetNull(const char *colName); #ifdef __WXDEBUG__ - ULONG GetTableID() { return tableID; }; + ULONG GetTableID() { return tableID; } #endif -}; // wxTable +}; // wxDbTable // Change this to 0 to remove use of all deprecated functions -#if 1 +#if wxODBC_BACKWARD_COMPATABILITY //################################################################################# //############### DEPRECATED functions for backward compatability ################# //################################################################################# // Backward compability. These will eventually go away -typedef wxColDef CcolDef; -typedef wxColDataPtr CcolDataPtr; -typedef wxIdxDef CidxDef; - +typedef wxDbTable wxTable; +typedef wxDbIdxDef wxIdxDef; +typedef wxDbIdxDef CidxDef; +typedef wxDbColDef wxColDef; +typedef wxDbColDef CcolDef; +typedef wxDbColDataPtr wxColDataPtr; +typedef wxDbColDataPtr CcolDataPtr; + +const int ROWID = wxDB_ROWID_LEN; +const int DEFAULT_CURSOR = wxDB_DEFAULT_CURSOR; +const bool QUERY_ONLY = wxDB_QUERY_ONLY; +const bool DISABLE_VIEW = wxDB_DISABLE_VIEW; #endif #endif diff --git a/include/wx/dc.h b/include/wx/dc.h index 551e35da34..4fc92c6f0a 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -49,7 +49,7 @@ public: m_clipping = FALSE; m_ok = TRUE; - m_minX = m_minY = m_maxX = m_maxY = 0; + ResetBoundingBox(); m_signX = m_signY = 1; @@ -330,6 +330,7 @@ public: // --------- // const... + int GetBackgroundMode() const { return m_backgroundMode; } const wxBrush& GetBackground() const { return m_backgroundBrush; } const wxBrush& GetBrush() const { return m_brush; } const wxFont& GetFont() const { return m_font; } @@ -400,10 +401,29 @@ public: virtual void CalcBoundingBox(wxCoord x, wxCoord y) { - if ( x < m_minX ) m_minX = x; - if ( y < m_minY ) m_minY = y; - if ( x > m_maxX ) m_maxX = x; - if ( y > m_maxY ) m_maxY = y; + if ( m_isBBoxValid ) + { + if ( x < m_minX ) m_minX = x; + if ( y < m_minY ) m_minY = y; + if ( x > m_maxX ) m_maxX = x; + if ( y > m_maxY ) m_maxY = y; + } + else + { + m_isBBoxValid = TRUE; + + m_minX = x; + m_minY = y; + m_maxX = x; + m_maxY = y; + } + } + + void ResetBoundingBox() + { + m_isBBoxValid = FALSE; + + m_minX = m_maxX = m_minY = m_maxY = 0; } // Get the final bounding box of the PostScript or Metafile picture. @@ -577,6 +597,7 @@ protected: bool m_ok:1; bool m_clipping:1; bool m_isInteractive:1; + bool m_isBBoxValid:1; // coordinate system variables diff --git a/include/wx/debug.h b/include/wx/debug.h index c7a69752d3..4cb9dd165d 100644 --- a/include/wx/debug.h +++ b/include/wx/debug.h @@ -43,6 +43,10 @@ // ---------------------------------------------------------------------------- //@{ +// Use of these suppresses compiler warnings about testing constant expression +WXDLLEXPORT_DATA(extern const bool) wxTrue; +WXDLLEXPORT_DATA(extern const bool) wxFalse; + /** @name Macros which are completely disabled in 'release' mode */ //@{ #ifdef __WXDEBUG__ @@ -58,15 +62,8 @@ /// generic assert macro #define wxASSERT(cond) if ( !(cond) ) wxOnAssert(__TFILE__, __LINE__) -#if 0 // defined(__BORLANDC__) && defined(__WIN16__) - // Too much text, so make wxASSERT_MSG the same as wxASSERT, - // thus removing the text from the program. - #define wxASSERT_MSG(x, m) if ( !(x) ) wxOnAssert(__TFILE__, __LINE__) -#else /// assert with additional message explaining it's cause #define wxASSERT_MSG(x, m) if ( !(x) ) wxOnAssert(__TFILE__, __LINE__, m) -#endif - #else // nothing to do in release modes (hopefully at this moment there are // no more bugs ;-) @@ -74,17 +71,11 @@ #define wxASSERT_MSG(x, m) #endif //__WXDEBUG__ - /// special form of assert: always triggers it (in debug mode) +/// special form of assert: always triggers it (in debug mode) #define wxFAIL wxASSERT(wxFalse) -#if 0 // defined(__BORLANDC__) && defined(__WIN16__) - // Too much text, so make wxFAIL_MSG the same as wxFAIL, - // thus removing the text from the program. -#define wxFAIL_MSG(msg) wxASSERT(wxFalse) -#else - /// FAIL with some message +/// FAIL with some message #define wxFAIL_MSG(msg) wxASSERT_MSG(wxFalse, msg) -#endif //@} // NB: these macros work also in release mode! diff --git a/include/wx/defs.h b/include/wx/defs.h index a5e111e13c..c5bba8db2c 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -22,8 +22,8 @@ // OS: first test for generic Unix defines, then for particular flavours and // finally for Unix-like systems -#if defined(__unix) || defined(__unix__) || defined(____SVR4____) || \ - defined(__LINUX__) || defined(__sgi) || \ +#if defined(__UNIX__) || defined(__unix) || defined(__unix__) || \ + defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \ defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \ defined(__EMX__) || defined(__VMS) || defined(__BEOS__) @@ -48,6 +48,10 @@ #endif #endif // Sun + #ifdef __EMX__ + #define OS2EMX_PLAIN_CHAR + #endif + #elif defined(applec) || defined(THINK_C) || ( defined( __MWERKS__ ) && !defined(__INTEL__) ) // MacOS #elif defined(__OS2__) @@ -380,25 +384,8 @@ typedef int wxWindowID; #if defined(__WXMSW__) -// _declspec works in BC++ 5 and later, as well as VC++ -#if defined(__VISUALC__) || defined(__BORLANDC__) - -# ifdef WXMAKINGDLL -# define WXDLLEXPORT _declspec( dllexport ) -# define WXDLLEXPORT_DATA(type) _declspec( dllexport ) type -# define WXDLLEXPORT_CTORFN -# elif defined(WXUSINGDLL) -# define WXDLLEXPORT _declspec( dllimport ) -# define WXDLLEXPORT_DATA(type) _declspec( dllimport ) type -# define WXDLLEXPORT_CTORFN -# else -# define WXDLLEXPORT -# define WXDLLEXPORT_DATA(type) type -# define WXDLLEXPORT_CTORFN -# endif - -#elif defined(__GNUC__) - +// __declspec works in BC++ 5 and later, as well as VC++ and gcc +#if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) # ifdef WXMAKINGDLL # define WXDLLEXPORT __declspec( dllexport ) # define WXDLLEXPORT_DATA(type) __declspec( dllexport ) type @@ -412,34 +399,46 @@ typedef int wxWindowID; # define WXDLLEXPORT_DATA(type) type # define WXDLLEXPORT_CTORFN # endif +#else +# define WXDLLEXPORT +# define WXDLLEXPORT_DATA(type) type +# define WXDLLEXPORT_CTORFN +#endif #elif defined(__WXPM__) -# ifdef WXMAKINGDLL -# define WXDLLEXPORT _Export -# define WXDLLEXPORT_DATA(type) _Export type -# define WXDLLEXPORT_CTORFN -# elif defined(WXUSINGDLL) -# define WXDLLEXPORT _Export -# define WXDLLEXPORT_DATA(type) _Export type -# define WXDLLEXPORT_CTORFN +# if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) + +# ifdef WXMAKINGDLL +# define WXDLLEXPORT _Export +# define WXDLLEXPORT_DATA(type) _Export type +# define WXDLLEXPORT_CTORFN +# elif defined(WXUSINGDLL) +# define WXDLLEXPORT _Export +# define WXDLLEXPORT_DATA(type) _Export type +# define WXDLLEXPORT_CTORFN +# else +# define WXDLLEXPORT +# define WXDLLEXPORT_DATA(type) type +# define WXDLLEXPORT_CTORFN +# endif + # else + # define WXDLLEXPORT # define WXDLLEXPORT_DATA(type) type # define WXDLLEXPORT_CTORFN + # endif -#else +#else // !(MSW or OS2) + # define WXDLLEXPORT # define WXDLLEXPORT_DATA(type) type # define WXDLLEXPORT_CTORFN + #endif -#else // !Windows -# define WXDLLEXPORT -# define WXDLLEXPORT_DATA(type) type -# define WXDLLEXPORT_CTORFN -#endif // Win/!Win // For ostream, istream ofstream #if defined(__BORLANDC__) && defined( _RTLDLL ) @@ -456,8 +455,12 @@ class WXDLLEXPORT wxEvent; #define wxNOT_FOUND (-1) // ---------------------------------------------------------------------------- -/** @name Very common macros */ +// Very common macros // ---------------------------------------------------------------------------- + +// everybody gets the assert and other debug macros +#include "wx/debug.h" + //@{ /// delete pointer if it is not NULL and NULL it afterwards // (checking that it's !NULL before passing it to delete is just a @@ -489,10 +492,6 @@ class WXDLLEXPORT wxEvent; /// size of statically declared array #define WXSIZEOF(array) (sizeof(array)/sizeof(array[0])) -// Use of these suppresses some compiler warnings -WXDLLEXPORT_DATA(extern const bool) wxTrue; -WXDLLEXPORT_DATA(extern const bool) wxFalse; - // ---------------------------------------------------------------------------- // compiler specific settings // ---------------------------------------------------------------------------- @@ -519,9 +518,13 @@ WXDLLEXPORT_DATA(extern const bool) wxFalse; // where should i put this? we need to make sure of this as it breaks // the <iostream> code. #if !wxUSE_IOSTREAMH && defined(__WXDEBUG__) -#ifndef __MWERKS__ -#undef __WXDEBUG__ -#endif +# ifndef __MWERKS__ +// #undef __WXDEBUG__ +# ifdef wxUSE_DEBUG_NEW_ALWAYS +# undef wxUSE_DEBUG_NEW_ALWAYS +# define wxUSE_DEBUG_NEW_ALWAYS 0 +# endif +# endif #endif // Callback function type definition @@ -893,16 +896,21 @@ enum wxStretch #define wxICONIZE 0x4000 #define wxMINIMIZE wxICONIZE #define wxMAXIMIZE 0x2000 -#define wxTHICK_FRAME 0x1000 +// free value: 0x1000 #define wxSYSTEM_MENU 0x0800 #define wxMINIMIZE_BOX 0x0400 #define wxMAXIMIZE_BOX 0x0200 #define wxTINY_CAPTION_HORIZ 0x0100 #define wxTINY_CAPTION_VERT 0x0080 -#define wxRESIZE_BOX wxMAXIMIZE_BOX #define wxRESIZE_BORDER 0x0040 + +// deprecated versions defined for compatibility reasons +#define wxRESIZE_BOX wxMAXIMIZE_BOX +#define wxTHICK_FRAME wxRESIZE_BORDER + #define wxDIALOG_MODAL 0x0020 #define wxDIALOG_MODELESS 0x0000 + // Add for normal Windows frame behaviour #define wxFRAME_FLOAT_ON_PARENT 0x0020 @@ -918,14 +926,16 @@ enum wxStretch #endif #define wxDEFAULT_FRAME_STYLE \ - (wxSYSTEM_MENU | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN) + (wxSYSTEM_MENU | wxRESIZE_BORDER | \ + wxMINIMIZE_BOX | wxMAXIMIZE_BOX | \ + wxCAPTION | wxCLIP_CHILDREN) #ifdef __WXMSW__ -# define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU|wxCAPTION|wxTHICK_FRAME) +# define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU | wxCAPTION) #else -// Under Unix, the dialogs don't have a system menu. Specifying -// wxSYSTEM_MENU here, will make a close button appear. -# define wxDEFAULT_DIALOG_STYLE (wxCAPTION|wxTHICK_FRAME) +// Under Unix, the dialogs don't have a system menu. Specifying wxSYSTEM_MENU +// here will make a close button appear. +# define wxDEFAULT_DIALOG_STYLE wxCAPTION #endif /* @@ -1062,6 +1072,10 @@ enum wxStretch */ #define wxBU_AUTODRAW 0x0004 #define wxBU_NOAUTODRAW 0x0000 +#define wxBU_LEFT 0x0040 +#define wxBU_TOP 0x0080 +#define wxBU_RIGHT 0x0100 +#define wxBU_BOTTOM 0x0200 /* * wxTreeCtrl flags @@ -1118,10 +1132,14 @@ enum wxStretch * wxSplitterWindow flags */ #define wxSP_NOBORDER 0x0000 -#define wxSP_3D 0x0010 +#define wxSP_NOSASH 0x0010 #define wxSP_BORDER 0x0020 #define wxSP_PERMIT_UNSPLIT 0x0040 #define wxSP_LIVE_UPDATE 0x0080 +#define wxSP_3DSASH 0x0100 +#define wxSP_3DBORDER 0x0200 +#define wxSP_FULLSASH 0x0400 +#define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH) /* * wxFrame extra flags @@ -1678,27 +1696,27 @@ typedef enum { #ifdef __WXMAC__ typedef WindowPtr WXHWND; -typedef Handle WXHANDLE; -typedef CIconHandle WXHICON; +typedef Handle WXHANDLE; +typedef CIconHandle WXHICON; //typedef unsigned long WXHFONT; -typedef MenuHandle WXHMENU; +typedef MenuHandle WXHMENU; //typedef unsigned long WXHPEN; //typedef unsigned long WXHBRUSH; //typedef unsigned long WXHPALETTE; -typedef CursHandle WXHCURSOR; +typedef CursHandle WXHCURSOR; typedef RgnHandle WXHRGN; //typedef unsigned long WXHACCEL; //typedef unsigned long WXHINSTANCE; -typedef GWorldPtr WXHBITMAP; +typedef GWorldPtr WXHBITMAP; //typedef unsigned long WXHIMAGELIST; //typedef unsigned long WXHGLOBAL; -typedef GrafPtr WXHDC; +typedef GrafPtr WXHDC; typedef unsigned int WXUINT; typedef unsigned long WXDWORD; typedef unsigned short WXWORD; //typedef unsigned int WXWPARAM; //typedef long WXLPARAM; -typedef RGBColor WXCOLORREF; +typedef RGBColor WXCOLORREF; //typedef void * WXRGNDATA; //typedef void * WXMSG; //typedef unsigned long WXHCONV; @@ -1708,12 +1726,26 @@ typedef RGBColor WXCOLORREF; //typedef void * WXLPCREATESTRUCT; typedef int (*WXFARPROC)(); -typedef WindowPtr WXWindow; -typedef ControlHandle WXWidget; +typedef WindowPtr WXWindow; +typedef ControlHandle WXWidget; #endif #if defined(__WXMSW__) || defined(__WXPM__) + +// the keywords needed for WinMain() declaration +#ifdef __WIN16__ +# ifdef __VISUALC__ +# define WXFAR __far +# else +# define WXFAR _far +# endif +#else // Win32 +# ifndef WXFAR +# define WXFAR +# endif +#endif // Win16/32 + // Stand-ins for Windows types or OS/2, to avoid #including all of windows.h or os2.h typedef unsigned long WXHWND; typedef unsigned long WXHANDLE; @@ -1726,7 +1758,7 @@ typedef unsigned long WXHPALETTE; typedef unsigned long WXHCURSOR; typedef unsigned long WXHRGN; typedef unsigned long WXHACCEL; -typedef unsigned long WXHINSTANCE; +typedef void WXFAR * WXHINSTANCE; typedef unsigned long WXHBITMAP; typedef unsigned long WXHIMAGELIST; typedef unsigned long WXHGLOBAL; @@ -1814,29 +1846,15 @@ typedef struct tagLOGPALETTE typedef WXHWND WXWidget; #if defined(__BORLANDC__) && !defined(__WIN32__) -#ifndef LPTSTR -#define LPTSTR LPSTR -#endif -#ifndef LPCTSTR -#define LPCTSTR LPSTR -#endif +# ifndef LPTSTR +# define LPTSTR LPSTR +# endif +# ifndef LPCTSTR +# define LPCTSTR LPSTR +# endif #endif -// the keywords needed for WinMain() declaration - -#ifdef __WIN16__ - #ifdef __VISUALC__ - #define WXFAR __far - #else // !VC++ - #define WXFAR _far - #endif -#else // Win32 - #ifndef WXFAR - #define WXFAR - #endif -#endif // Win16/32 - -#endif // MSW +#endif // MSW or OS2 #ifdef __WXMOTIF__ /* Stand-ins for X/Xt/Motif types */ @@ -1862,6 +1880,8 @@ typedef unsigned long Atom; /* this might fail on a few architectures */ #ifdef __WXGTK__ /* Stand-ins for GLIB types */ +typedef char gchar; +typedef signed char gint8; typedef int gint; typedef unsigned guint; typedef unsigned long gulong; diff --git a/include/wx/dialog.h b/include/wx/dialog.h index fb131cd96c..78e89ce307 100644 --- a/include/wx/dialog.h +++ b/include/wx/dialog.h @@ -27,7 +27,6 @@ public: void SetReturnCode(int returnCode) { m_returnCode = returnCode; } int GetReturnCode() const { return m_returnCode; } -protected: // splits text up at newlines and places the // lines into a vertical wxBoxSizer wxSizer *CreateTextSizer( const wxString &message ); @@ -35,6 +34,7 @@ protected: // places buttons into a horizontal wxBoxSizer wxSizer *CreateButtonSizer( long flags ); +protected: // the return code from modal dialog int m_returnCode; }; diff --git a/include/wx/dialup.h b/include/wx/dialup.h index ecd17efbe5..d861592739 100644 --- a/include/wx/dialup.h +++ b/include/wx/dialup.h @@ -24,7 +24,7 @@ class WXDLLEXPORT wxArrayString; -extern const wxChar *wxEmptyString; +WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; #define WXDIALUP_MANAGER_DEFAULT_BEACONHOST wxT("www.yahoo.com") diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index 109a89437c..702df0bad0 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -17,7 +17,6 @@ #endif #include "wx/defs.h" -#include "wx/debug.h" /** @name Dynamic arrays and object arrays (array which own their elements) @memo Arrays which grow on demand and do range checking (only in debug) @@ -304,7 +303,8 @@ public: \ void Insert(const T* pItem, size_t uiIndex) \ { wxBaseArray::Insert((long)pItem, uiIndex); } \ \ - void Empty(); \ + void Empty() { DoEmpty(); wxBaseArray::Empty(); } \ + void Clear() { DoEmpty(); wxBaseArray::Clear(); } \ \ T* Detach(size_t uiIndex) \ { T* p = (T*)wxBaseArray::Item(uiIndex); \ @@ -315,6 +315,7 @@ public: \ void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); } \ \ private: \ + void DoEmpty(); \ void DoCopy(const name& src); \ } diff --git a/include/wx/dynlib.h b/include/wx/dynlib.h index 0e29afa623..b13587e3e5 100644 --- a/include/wx/dynlib.h +++ b/include/wx/dynlib.h @@ -94,6 +94,9 @@ public: */ static void * GetSymbol(wxDllType dllHandle, const wxString &name); + // return the standard DLL extension (with leading dot) for this platform + static wxString GetDllExt(); + private: /// forbid construction of objects wxDllLoader(); diff --git a/include/wx/encconv.h b/include/wx/encconv.h index ca991709e0..13dc535342 100644 --- a/include/wx/encconv.h +++ b/include/wx/encconv.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: encconv.h +// Name: wx/encconv.h // Purpose: wxEncodingConverter class for converting between different // font encodings // Author: Vaclav Slavik @@ -7,26 +7,31 @@ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// -#ifndef __ENCCONV_H__ -#define __ENCCONV_H__ +#ifndef _WX_ENCCONV_H_ +#define _WX_ENCCONV_H_ #ifdef __GNUG__ #pragma interface "encconv.h" #endif #include "wx/defs.h" -#include "wx/font.h" +#include "wx/object.h" +#include "wx/fontenc.h" #include "wx/dynarray.h" +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- - -enum { +enum +{ wxCONVERT_STRICT, wxCONVERT_SUBSTITUTE }; -enum { +enum +{ wxPLATFORM_CURRENT = -1, wxPLATFORM_UNIX = 0, @@ -35,8 +40,11 @@ enum { wxPLATFORM_MAC }; -WX_DEFINE_ARRAY(wxFontEncoding, wxFontEncodingArray); +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- +WX_DEFINE_ARRAY(wxFontEncoding, wxFontEncodingArray); //-------------------------------------------------------------------------------- // wxEncodingConverter @@ -52,7 +60,7 @@ class WXDLLEXPORT wxEncodingConverter : public wxObject ~wxEncodingConverter() { if (m_Table) delete[] m_Table; } // Initialize convertion. Both output or input encoding may - // be wxFONTENCODING_UNICODE, but only if wxUSE_UNICODE is set to 1. + // be wxFONTENCODING_UNICODE, but only if wxUSE_WCHAR_T is set to 1. // // All subsequent calls to Convert() will interpret it's argument // as a string in input_enc encoding and will output string in @@ -82,15 +90,15 @@ class WXDLLEXPORT wxEncodingConverter : public wxObject // Convert input string according to settings passed to Init. // Note that you must call Init before using Convert! - void Convert(const wxChar* input, wxChar* output); - void Convert(wxChar* str) { Convert(str, str); } - wxString Convert(const wxString& input); - -#if wxUSE_UNICODE // otherwise wxChar === char - void Convert(const char* input, wxChar* output); - void Convert(const wxChar* input, char* output); void Convert(const char* input, char* output); void Convert(char* str) { Convert(str, str); } + wxString Convert(const wxString& input); + +#if wxUSE_WCHAR_T + void Convert(const char* input, wchar_t* output); + void Convert(const wchar_t* input, char* output); + void Convert(const wchar_t* input, wchar_t* output); + void Convert(wchar_t* str) { Convert(str, str); } #endif // Return equivalent(s) for given font that are used // under given platform. wxPLATFORM_CURRENT means the plaform @@ -129,28 +137,15 @@ class WXDLLEXPORT wxEncodingConverter : public wxObject private: - wxChar *m_Table; +#if wxUSE_WCHAR_T + wchar_t *m_Table; +#else + char *m_Table; +#endif bool m_UnicodeInput, m_UnicodeOutput; bool m_JustCopy; }; -#endif // __ENCCONV_H__ - - - - - - - - - - - - - - - - - +#endif // _WX_ENCCONV_H_ diff --git a/include/wx/event.h b/include/wx/event.h index 9d047f12cb..1a594944db 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -768,7 +768,11 @@ public: bool MetaDown() const { return m_metaDown; } bool AltDown() const { return m_altDown; } bool ShiftDown() const { return m_shiftDown; } - long KeyCode() const { return m_keyCode; } + + bool HasModifiers() const { return ControlDown() || AltDown() || MetaDown(); } + + // get the key code: an ASCII7 char or an element of wxKeyCode enum + int GetKeyCode() const { return (int)m_keyCode; } // Find the position of the event void GetPosition(wxCoord *xpos, wxCoord *ypos) const @@ -796,6 +800,9 @@ public: void CopyObject(wxObject& obj) const; + // deprecated + long KeyCode() const { return m_keyCode; } + public: wxCoord m_x, m_y; @@ -1369,7 +1376,7 @@ private: wxEVT_DESTROY */ -class WXDLLEXPORT wxWindowCreateEvent : public wxEvent +class WXDLLEXPORT wxWindowCreateEvent : public wxCommandEvent { DECLARE_DYNAMIC_CLASS(wxWindowCreateEvent) @@ -1379,7 +1386,7 @@ public: wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } }; -class WXDLLEXPORT wxWindowDestroyEvent : public wxEvent +class WXDLLEXPORT wxWindowDestroyEvent : public wxCommandEvent { DECLARE_DYNAMIC_CLASS(wxWindowDestroyEvent) diff --git a/include/wx/ffile.h b/include/wx/ffile.h index 4695dc989b..969aa40039 100644 --- a/include/wx/ffile.h +++ b/include/wx/ffile.h @@ -65,10 +65,11 @@ public: // returns the number of bytes written size_t Write(const void *pBuf, size_t nCount); // returns true on success - bool Write(const wxString& s) + bool Write(const wxString& s, wxMBConv& conv = wxConvLibc) { - size_t size = s.Len()*sizeof(wxChar); - return Write(s.c_str(), size) == size; + const wxWX2MBbuf buf = s.mb_str(conv); + size_t size = strlen(buf); + return Write((const char *)buf, size) == size; } // flush data not yet written bool Flush(); diff --git a/include/wx/file.h b/include/wx/file.h index 89718b6120..d52ad5f423 100644 --- a/include/wx/file.h +++ b/include/wx/file.h @@ -99,10 +99,11 @@ public: // returns the number of bytes written size_t Write(const void *pBuf, size_t nCount); // returns true on success - bool Write(const wxString& s) + bool Write(const wxString& s, wxMBConv& conv = wxConvLibc) { - size_t size = s.Len()*sizeof(wxChar); - return Write(s.c_str(), size) == size; + const wxWX2MBbuf buf = s.mb_str(conv); + size_t size = strlen(buf); + return Write((const char *) buf, size) == size; } // flush data not yet written bool Flush(); diff --git a/include/wx/fileconf.h b/include/wx/fileconf.h index 779dc8d4fa..b7cc9c2cdc 100644 --- a/include/wx/fileconf.h +++ b/include/wx/fileconf.h @@ -121,7 +121,7 @@ private: *m_pPrev; // previous one }; -class wxFileConfig : public wxConfigBase +class WXDLLEXPORT wxFileConfig : public wxConfigBase { public: // construct the "standard" full name for global (system-wide) and @@ -149,6 +149,14 @@ public: // dtor will save unsaved data virtual ~wxFileConfig(); + // under Unix, set the umask to be used for the file creation, do nothing + // under other systems +#ifdef __UNIX__ + void SetUmask(int mode) { m_umask = mode; } +#else // !__UNIX__ + void SetUmask(int WXUNUSED(mode)) { } +#endif // __UNIX__/!__UNIX__ + // implement inherited pure virtual functions virtual void SetPath(const wxString& strPath); virtual const wxString& GetPath() const { return m_strPath; } @@ -244,6 +252,10 @@ private: ConfigGroup *m_pRootGroup, // the top (unnamed) group *m_pCurrentGroup; // the current group +#ifdef __UNIX__ + int m_umask; // the umask to use for file creation +#endif // __UNIX__ + public: WX_DEFINE_SORTED_ARRAY(ConfigEntry *, ArrayEntries); WX_DEFINE_SORTED_ARRAY(ConfigGroup *, ArrayGroups); diff --git a/include/wx/filefn.h b/include/wx/filefn.h index f983b7e93a..0be6462ddb 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -60,6 +60,80 @@ enum wxSeekMode WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; +// ---------------------------------------------------------------------------- +// declare our versions of low level file functions: some compilers prepend +// underscores to the usual names, some also have Unicode versions of them +// ---------------------------------------------------------------------------- + +// Microsoft compiler loves underscores, feed them to it +#ifdef __VISUALC__ + // functions + #define wxClose _close + #define wxRead _read + #define wxWrite _write + #define wxLseek _lseek + #define wxFsync _commit + #define wxEof _eof + + #define wxTell _tell + + #if wxUSE_UNICODE + #define wxOpen _wopen + #define wxAccess _waccess + + #define wxMkDir _wmkdir + #define wxRmDir _wrmdir + + #define wxStat _wstat + #else // !wxUSE_UNICODE + #define wxOpen _open + #define wxAccess _access + + #define wxMkDir _mkdir + #define wxRmDir _rmdir + + #define wxStat _stat + #endif + + // types + #define wxStructStat struct _stat + + // constants (unless already defined by the user code) + #ifndef O_RDONLY + #define O_RDONLY _O_RDONLY + #define O_WRONLY _O_WRONLY + #define O_RDWR _O_RDWR + #define O_EXCL _O_EXCL + #define O_CREAT _O_CREAT + #define O_BINARY _O_BINARY + + #define S_IFMT _S_IFMT + #define S_IFDIR _S_IFDIR + #define S_IFREG _S_IFREG + #endif // O_RDONLY +#else + // functions + #define wxOpen open + #define wxClose close + #define wxRead read + #define wxWrite write + #define wxLseek lseek + #define wxFsync commit + #define wxAccess access + #define wxEof eof + + #define wxMkDir mkdir + #define wxRmDir rmdir + + #define wxTell(fd) lseek(fd, 0, SEEK_CUR) + + #define wxStat stat + + // types + #define wxStructStat struct stat + +#endif // VC++ + // ---------------------------------------------------------------------------- // functions // ---------------------------------------------------------------------------- diff --git a/include/wx/font.h b/include/wx/font.h index 6b1737db51..706aad009f 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -21,6 +21,7 @@ // ---------------------------------------------------------------------------- #include "wx/defs.h" // for wxDEFAULT &c +#include "wx/fontenc.h" // the font encoding constants #include "wx/gdiobj.h" // the base class // ---------------------------------------------------------------------------- @@ -66,62 +67,6 @@ enum wxFontWeight wxFONTWEIGHT_MAX }; -// font encodings -enum wxFontEncoding -{ - wxFONTENCODING_SYSTEM = -1, // system default - wxFONTENCODING_DEFAULT, // current default encoding - - // ISO8859 standard defines a number of single-byte charsets - wxFONTENCODING_ISO8859_1, // West European (Latin1) - wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) - wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) - wxFONTENCODING_ISO8859_4, // Baltic languages (Estonian) (Latin4) - wxFONTENCODING_ISO8859_5, // Cyrillic - wxFONTENCODING_ISO8859_6, // Arabic - wxFONTENCODING_ISO8859_7, // Greek - wxFONTENCODING_ISO8859_8, // Hebrew - wxFONTENCODING_ISO8859_9, // Turkish (Latin5) - wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) - wxFONTENCODING_ISO8859_11, // Thai - wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it - // here anyhow to make all ISO8859 - // consecutive numbers - wxFONTENCODING_ISO8859_13, // Latin7 - wxFONTENCODING_ISO8859_14, // Latin8 - wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) - wxFONTENCODING_ISO8859_MAX, - - // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) - wxFONTENCODING_KOI8, // we don't support any of KOI8 variants - wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 - wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria - - // what would we do without Microsoft? They have their own encodings - // for DOS - wxFONTENCODING_CP437, // original MS-DOS codepage - wxFONTENCODING_CP850, // CP437 merged with Latin1 - wxFONTENCODING_CP852, // CP437 merged with Latin2 - wxFONTENCODING_CP855, // another cyrillic encoding - wxFONTENCODING_CP866, // and another one - // and for Windows - wxFONTENCODING_CP874, // WinThai - wxFONTENCODING_CP1250, // WinLatin2 - wxFONTENCODING_CP1251, // WinCyrillic - wxFONTENCODING_CP1252, // WinLatin1 - wxFONTENCODING_CP1253, // WinGreek (8859-7) - wxFONTENCODING_CP1254, // WinTurkish - wxFONTENCODING_CP1255, // WinHebrew - wxFONTENCODING_CP1256, // WinArabic - wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7) - wxFONTENCODING_CP12_MAX, - - wxFONTENCODING_UNICODE, // Unicode - currently used only by - // wxEncodingConverter class - - wxFONTENCODING_MAX -}; - // ---------------------------------------------------------------------------- // wxFontBase represents a font object // ---------------------------------------------------------------------------- diff --git a/include/wx/fontenc.h b/include/wx/fontenc.h new file mode 100644 index 0000000000..83300a6f40 --- /dev/null +++ b/include/wx/fontenc.h @@ -0,0 +1,71 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/fontenc.h +// Purpose: wxFontEncoding constants +// Author: Vadim Zeitlin +// Modified by: +// Created: 29.03.00 +// RCS-ID: $Id$ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTENC_H_ +#define _WX_FONTENC_H_ + +// font encodings +enum wxFontEncoding +{ + wxFONTENCODING_SYSTEM = -1, // system default + wxFONTENCODING_DEFAULT, // current default encoding + + // ISO8859 standard defines a number of single-byte charsets + wxFONTENCODING_ISO8859_1, // West European (Latin1) + wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) + wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) + wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4) + wxFONTENCODING_ISO8859_5, // Cyrillic + wxFONTENCODING_ISO8859_6, // Arabic + wxFONTENCODING_ISO8859_7, // Greek + wxFONTENCODING_ISO8859_8, // Hebrew + wxFONTENCODING_ISO8859_9, // Turkish (Latin5) + wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) + wxFONTENCODING_ISO8859_11, // Thai + wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it + // here anyhow to make all ISO8859 + // consecutive numbers + wxFONTENCODING_ISO8859_13, // Baltic (Latin7) + wxFONTENCODING_ISO8859_14, // Latin8 + wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) + wxFONTENCODING_ISO8859_MAX, + + // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) + wxFONTENCODING_KOI8, // we don't support any of KOI8 variants + wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 + wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria + + // what would we do without Microsoft? They have their own encodings + // for DOS + wxFONTENCODING_CP437, // original MS-DOS codepage + wxFONTENCODING_CP850, // CP437 merged with Latin1 + wxFONTENCODING_CP852, // CP437 merged with Latin2 + wxFONTENCODING_CP855, // another cyrillic encoding + wxFONTENCODING_CP866, // and another one + // and for Windows + wxFONTENCODING_CP874, // WinThai + wxFONTENCODING_CP1250, // WinLatin2 + wxFONTENCODING_CP1251, // WinCyrillic + wxFONTENCODING_CP1252, // WinLatin1 + wxFONTENCODING_CP1253, // WinGreek (8859-7) + wxFONTENCODING_CP1254, // WinTurkish + wxFONTENCODING_CP1255, // WinHebrew + wxFONTENCODING_CP1256, // WinArabic + wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7) + wxFONTENCODING_CP12_MAX, + + wxFONTENCODING_UNICODE, // Unicode - currently used only by + // wxEncodingConverter class + + wxFONTENCODING_MAX +}; + +#endif // _WX_FONTENC_H_ diff --git a/include/wx/fontmap.h b/include/wx/fontmap.h index ba5403b81d..43285146c0 100644 --- a/include/wx/fontmap.h +++ b/include/wx/fontmap.h @@ -20,11 +20,18 @@ // headers // ---------------------------------------------------------------------------- -#include "wx/font.h" // for wxFont and wxFontEncoding -#include "wx/fontutil.h" // for wxNativeEncodingInfo +#include "wx/fontenc.h" // for wxFontEncoding +#if wxUSE_GUI + #include "wx/fontutil.h" // for wxNativeEncodingInfo +#endif // wxUSE_GUI -class WXDLLEXPORT wxConfigBase; -class WXDLLEXPORT wxWindow; +#if wxUSE_CONFIG + class WXDLLEXPORT wxConfigBase; +#endif // wxUSE_CONFIG + +#if wxUSE_GUI + class WXDLLEXPORT wxWindow; +#endif // wxUSE_GUI // ---------------------------------------------------------------------------- // wxFontMapper manages user-definable correspondence between logical font @@ -49,6 +56,7 @@ public: // virtual dtor for a base class virtual ~wxFontMapper(); +#if wxUSE_GUI // find an alternative for the given encoding (which is supposed to not be // available on this system). If successful, return TRUE and fill info // structure with the parameters required to create the font, otherwise @@ -69,6 +77,7 @@ public: // If no facename is given, virtual bool IsEncodingAvailable(wxFontEncoding encoding, const wxString& facename = wxEmptyString); +#endif // wxUSE_GUI // returns the encoding for the given charset (in the form of RFC 2046) or // wxFONTENCODING_SYSTEM if couldn't decode it @@ -90,11 +99,13 @@ public: // configure the appearance of the dialogs we may popup // ---------------------------------------------------- +#if wxUSE_GUI // the parent window for modal dialogs void SetDialogParent(wxWindow *parent) { m_windowParent = parent; } // the title for the dialogs (note that default is quite reasonable) void SetDialogTitle(const wxString& title) { m_titleDialog = title; } +#endif // wxUSE_GUI // functions which allow to configure the config object used: by default, // the global one (from wxConfigBase::Get() will be used) and the default @@ -102,6 +113,7 @@ public: // GetDefaultConfigPath() // ---------------------------------------------------------------------- +#if wxUSE_CONFIG // set the config object to use (may be NULL to use default) void SetConfig(wxConfigBase *config) { m_config = config; } @@ -110,8 +122,11 @@ public: // return default config path static const wxChar *GetDefaultConfigPath(); +#endif protected: + +#if wxUSE_CONFIG // get the config object we're using - if it wasn't set explicitly, this // function will use wxConfig::Get() to get the global one wxConfigBase *GetConfig(); @@ -119,6 +134,7 @@ protected: // gets the root path for our settings - if itwasn't set explicitly, use // GetDefaultConfigPath() const wxString& GetConfigPath(); +#endif // change to the given (relative) path in the config, return TRUE if ok // (then GetConfig() will return something !NULL), FALSE if no config @@ -131,6 +147,7 @@ protected: // restore the config path after use void RestorePath(const wxString& pathOld); +#if wxUSE_GUI // GetAltForEncoding() helper: tests for the existence of the given // encoding and saves the result in config if ok - this results in the // following (desired) behaviour: when an unknown/unavailable encoding is @@ -141,16 +158,22 @@ protected: bool TestAltEncoding(const wxString& configEntry, wxFontEncoding encReplacement, wxNativeEncodingInfo *info); +#endif // wxUSE_GUI +#if wxUSE_CONFIG // config object and path (in it) to use wxConfigBase *m_config; +#endif + wxString m_configRootPath; +#if wxUSE_GUI // the title for our dialogs wxString m_titleDialog; // the parent window for our dialogs wxWindow *m_windowParent; +#endif // wxUSE_GUI friend class wxFontMapperPathChanger; }; diff --git a/include/wx/frame.h b/include/wx/frame.h index 3a3c0354a3..6f5ca2de91 100644 --- a/include/wx/frame.h +++ b/include/wx/frame.h @@ -192,6 +192,10 @@ protected: // something changes virtual void PositionStatusBar() { } + // show the help string for this menu item in the given status bar: the + // status bar pointer can be NULL; return TRUE if help was shown + bool ShowMenuHelp(wxStatusBar *statbar, int id); + wxStatusBar *m_frameStatusBar; #endif // wxUSE_STATUSBAR diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index 9a7231e8ff..457c2da1e0 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -226,8 +226,8 @@ public: wxRealPoint() { x = y = 0.0; }; wxRealPoint(double xx, double yy) { x = xx; y = yy; }; - wxRealPoint operator+(const wxRealPoint& pt) { return wxRealPoint(x + pt.x, y + pt.y); } - wxRealPoint operator-(const wxRealPoint& pt) { return wxRealPoint(x - pt.x, y - pt.y); } + wxRealPoint operator+(const wxRealPoint& pt) const { return wxRealPoint(x + pt.x, y + pt.y); } + wxRealPoint operator-(const wxRealPoint& pt) const { return wxRealPoint(x - pt.x, y - pt.y); } bool operator==(const wxRealPoint& pt) const { return x == pt.x && y == pt.y; } }; @@ -247,8 +247,8 @@ public: bool operator!=(const wxPoint& p) const { return !(*this == p); } // arithmetic operations (component wise) - wxPoint operator+(const wxPoint& p) { return wxPoint(x + p.x, y + p.y); } - wxPoint operator-(const wxPoint& p) { return wxPoint(x - p.x, y - p.y); } + wxPoint operator+(const wxPoint& p) const { return wxPoint(x + p.x, y + p.y); } + wxPoint operator-(const wxPoint& p) const { return wxPoint(x - p.x, y - p.y); } wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } diff --git a/include/wx/generic/caret.h b/include/wx/generic/caret.h index ffb95c3422..9b2340de44 100644 --- a/include/wx/generic/caret.h +++ b/include/wx/generic/caret.h @@ -48,14 +48,24 @@ public: // implementation // -------------- - // blink the caret once - void Blink(); + // called by wxWindow (not using the event tables) + virtual void OnSetFocus(); + virtual void OnKillFocus(); + + // called by wxCaretTimer + void OnTimer(); protected: virtual void DoShow(); virtual void DoHide(); virtual void DoMove(); + // blink the caret once + void Blink(); + + // refresh the caret + void Refresh(); + // draw the caret on the given DC void DoDraw(wxDC *dc); @@ -64,7 +74,8 @@ private: void InitGeneric(); wxCaretTimer m_timer; - bool m_blinkedOut; // TRUE => caret hidden right now + bool m_blinkedOut, // TRUE => caret hidden right now + m_hasFocus; // TRUE => our window has focus }; #endif // _WX_CARET_H_ diff --git a/include/wx/generic/colrdlgg.h b/include/wx/generic/colrdlgg.h index 2b9e0dc4e1..e246d07966 100644 --- a/include/wx/generic/colrdlgg.h +++ b/include/wx/generic/colrdlgg.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: colrdlgg.h +// Name: wx/generic/colrdlgg.h // Purpose: wxGenericColourDialog // Author: Julian Smart // Modified by: @@ -27,88 +27,91 @@ #define wxID_BLUE_SLIDER 3003 class WXDLLEXPORT wxSlider; -class WXDLLEXPORT wxGenericColourDialog: public wxDialog +class WXDLLEXPORT wxGenericColourDialog : public wxDialog { - DECLARE_DYNAMIC_CLASS(wxGenericColourDialog) - protected: - wxColourData colourData; - wxWindow *dialogParent; +public: + wxGenericColourDialog(); + wxGenericColourDialog(wxWindow *parent, + wxColourData *data = (wxColourData *) NULL); + virtual ~wxGenericColourDialog(); - // Area reserved for grids of colours - wxRect standardColoursRect; - wxRect customColoursRect; - wxRect singleCustomColourRect; + bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL); - // Size of each colour rectangle - wxPoint smallRectangleSize; + wxColourData &GetColourData() { return colourData; } - // For single customizable colour - wxPoint customRectangleSize; + virtual int ShowModal(); - // Grid spacing (between rectangles) - int gridSpacing; + // Internal functions + void OnMouseEvent(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); - // Section spacing (between left and right halves of dialog box) - int sectionSpacing; + virtual void CalculateMeasurements(); + virtual void CreateWidgets(); + virtual void InitializeColours(); - // 48 'standard' colours - wxColour standardColours[48]; + virtual void PaintBasicColours(wxDC& dc); + virtual void PaintCustomColours(wxDC& dc); + virtual void PaintCustomColour(wxDC& dc); + virtual void PaintHighlight(wxDC& dc, bool draw); - // 16 'custom' colours - wxColour customColours[16]; + virtual void OnBasicColourClick(int which); + virtual void OnCustomColourClick(int which); - // One single custom colour (use sliders) - wxColour singleCustomColour; + void OnAddCustom(wxCommandEvent& event); - // Which colour is selected? An index into one of the two areas. - int colourSelection; - int whichKind; // 1 for standard colours, 2 for custom colours, + void OnRedSlider(wxCommandEvent& event); + void OnGreenSlider(wxCommandEvent& event); + void OnBlueSlider(wxCommandEvent& event); - wxSlider *redSlider; - wxSlider *greenSlider; - wxSlider *blueSlider; + void OnCloseWindow(wxCloseEvent& event); - int buttonY; +protected: + wxColourData colourData; + wxWindow *dialogParent; - int okButtonX; - int customButtonX; + // Area reserved for grids of colours + wxRect standardColoursRect; + wxRect customColoursRect; + wxRect singleCustomColourRect; -// static bool colourDialogCancelled; - public: - wxGenericColourDialog(void); - wxGenericColourDialog(wxWindow *parent, wxColourData *data = (wxColourData *) NULL); - ~wxGenericColourDialog(void); + // Size of each colour rectangle + wxPoint smallRectangleSize; - bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL); + // For single customizable colour + wxPoint customRectangleSize; - int ShowModal(void); - wxColourData &GetColourData(void) { return colourData; } + // Grid spacing (between rectangles) + int gridSpacing; - // Internal functions - void OnMouseEvent(wxMouseEvent& event); - void OnPaint(wxPaintEvent& event); + // Section spacing (between left and right halves of dialog box) + int sectionSpacing; - virtual void CalculateMeasurements(void); - virtual void CreateWidgets(void); - virtual void InitializeColours(void); - - virtual void PaintBasicColours(wxDC& dc); - virtual void PaintCustomColours(wxDC& dc); - virtual void PaintCustomColour(wxDC& dc); - virtual void PaintHighlight(wxDC& dc, bool draw); + // 48 'standard' colours + wxColour standardColours[48]; - virtual void OnBasicColourClick(int which); - virtual void OnCustomColourClick(int which); + // 16 'custom' colours + wxColour customColours[16]; - void OnAddCustom(wxCommandEvent& event); + // One single custom colour (use sliders) + wxColour singleCustomColour; - void OnRedSlider(wxCommandEvent& event); - void OnGreenSlider(wxCommandEvent& event); - void OnBlueSlider(wxCommandEvent& event); + // Which colour is selected? An index into one of the two areas. + int colourSelection; + int whichKind; // 1 for standard colours, 2 for custom colours, - void OnCloseWindow(wxCloseEvent& event); + wxSlider *redSlider; + wxSlider *greenSlider; + wxSlider *blueSlider; -DECLARE_EVENT_TABLE() + int buttonY; + + int okButtonX; + int customButtonX; + + // static bool colourDialogCancelled; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxGenericColourDialog) }; /* This shouldn't be necessary, we have a #define in wx/colordlg.h. diff --git a/include/wx/generic/dirdlgg.h b/include/wx/generic/dirdlgg.h index 2f06ecc14c..53135f57bb 100644 --- a/include/wx/generic/dirdlgg.h +++ b/include/wx/generic/dirdlgg.h @@ -6,7 +6,7 @@ // Created: 12/12/98 // Copyright: (c) Harm van der Heijden and Robert Roebling // RCS-ID: $Id$ -// Licence: wxWindows licence +// Licence: wxWindows licence // // Notes: wxDirDialog class written by Harm van der Heijden, // uses wxDirCtrl class written by Robert Roebling for the @@ -106,11 +106,11 @@ public: wxDirCtrl(); wxDirCtrl(wxWindow *parent, const wxWindowID id = -1, - const wxString &dir = wxDirDialogDefaultFolderStr, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - const long style = wxTR_HAS_BUTTONS, - const wxString& name = wxTreeCtrlNameStr ); + const wxString &dir = wxDirDialogDefaultFolderStr, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const long style = wxTR_HAS_BUTTONS, + const wxString& name = wxTreeCtrlNameStr ); void ShowHidden( const bool yesno ); void OnExpandItem(wxTreeEvent &event ); void OnCollapseItem(wxTreeEvent &event ); @@ -118,6 +118,8 @@ public: void OnEndEditItem(wxTreeEvent &event ); protected: + friend class wxDirDialog; + void CreateItems(const wxTreeItemId &parent); void SetupSections(); wxArrayString m_paths, m_names; @@ -136,9 +138,9 @@ class WXDLLEXPORT wxDirDialog: public wxDialog public: wxDirDialog() {} wxDirDialog(wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultPath = wxEmptyString, - long style = 0, const wxPoint& pos = wxDefaultPosition); + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = 0, const wxPoint& pos = wxDefaultPosition); inline void SetMessage(const wxString& message) { m_message = message; } inline void SetPath(const wxString& path) { m_path = path; } inline void SetStyle(long style) { m_dialogStyle = style; } diff --git a/include/wx/generic/dragimgg.h b/include/wx/generic/dragimgg.h index f35a28cc6f..53830a504c 100644 --- a/include/wx/generic/dragimgg.h +++ b/include/wx/generic/dragimgg.h @@ -97,7 +97,11 @@ public: // Ctors & dtor //////////////////////////////////////////////////////////////////////////// - wxGenericDragImage(); + wxGenericDragImage(const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0)) + { + Init(); + Create(cursor, hotspot); + } wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0)) { Init(); @@ -133,9 +137,16 @@ public: // Attributes //////////////////////////////////////////////////////////////////////////// + // For efficiency, tell wxGenericDragImage to use a bitmap that's already + // created (e.g. from last drag) + void SetBackingBitmap(wxBitmap* bitmap) { m_pBackingBitmap = bitmap; } + // Operations //////////////////////////////////////////////////////////////////////////// + // Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect) + bool Create(const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0)); + // Create a drag image from a bitmap and optional cursor bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0)); @@ -178,10 +189,22 @@ public: void Init(); - wxRect GetImageRect(const wxPoint& pos) const; + // Override this if you are using a virtual image (drawing your own image) + virtual wxRect GetImageRect(const wxPoint& pos) const; + + // Override this if you are using a virtual image (drawing your own image) + virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const; + + // Override this if you wish to draw the window contents to the backing bitmap + // yourself. This can be desirable if you wish to avoid flicker by not having to + // redraw the window itself before dragging in order to be graphic-minus-dragged-objects. + // Instead, paint the drag image's backing bitmap to be correct, and leave the window + // to be updated only when dragging the objects away (thus giving a smoother appearance). + virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC, + const wxRect& sourceRect, const wxRect& destRect) const; // Erase and redraw simultaneously if possible - bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew); + virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew); protected: wxBitmap m_bitmap; @@ -189,6 +212,7 @@ protected: wxCursor m_cursor; wxCursor m_oldCursor; wxPoint m_hotspot; + wxPoint m_offset; // The hostpot value passed to BeginDrag wxPoint m_position; bool m_isDirty; bool m_isShown; @@ -197,6 +221,8 @@ protected: // Stores the window contents while we're dragging the image around wxBitmap m_backingBitmap; + wxBitmap* m_pBackingBitmap; // Pointer to existing backing bitmap + // (pass to wxGenericDragImage as an efficiency measure) // A temporary bitmap for repairing/redrawing wxBitmap m_repairBitmap; diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 5f707fb54b..9709c570c5 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -298,6 +298,8 @@ public: wxGridCellEditor(); bool IsCreated() { return m_control != NULL; } + wxControl* GetControl() { return m_control; } + void SetControl(wxControl* control) { m_control = control; } // Creates the actual edit control virtual void Create(wxWindow* parent, @@ -326,9 +328,18 @@ public: // Reset the value in the control back to its starting value virtual void Reset() = 0; - // If the editor is enabled by pressing keys on the grid, - // this will be called to let the editor do something about - // that first key if desired. + // return TRUE to allow the given key to start editing: the base class + // version only checks that the event has no modifiers. The derived + // classes are supposed to do "if ( base::IsAcceptedKey() && ... )" in + // their IsAcceptedKey() implementation, although, of course, it is not a + // mandatory requirment. + // + // NB: if the key is F2 (special), editing will always start and this + // method will not be called at all (but StartingKey() will) + virtual bool IsAcceptedKey(wxKeyEvent& event); + + // If the editor is enabled by pressing keys on the grid, this will be + // called to let the editor do something about that first key if desired virtual void StartingKey(wxKeyEvent& event); // if the editor is enabled by clicking on the cell, this method will be @@ -377,6 +388,7 @@ public: virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + virtual bool IsAcceptedKey(wxKeyEvent& event); virtual void BeginEdit(int row, int col, wxGrid* grid); virtual bool EndEdit(int row, int col, wxGrid* grid); @@ -414,6 +426,7 @@ public: wxWindowID id, wxEvtHandler* evtHandler); + virtual bool IsAcceptedKey(wxKeyEvent& event); virtual void BeginEdit(int row, int col, wxGrid* grid); virtual bool EndEdit(int row, int col, wxGrid* grid); @@ -447,10 +460,13 @@ private: class WXDLLEXPORT wxGridCellFloatEditor : public wxGridCellTextEditor { public: + wxGridCellFloatEditor(int width = -1, int precision = -1); + virtual void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler); + virtual bool IsAcceptedKey(wxKeyEvent& event); virtual void BeginEdit(int row, int col, wxGrid* grid); virtual bool EndEdit(int row, int col, wxGrid* grid); @@ -460,12 +476,16 @@ public: virtual wxGridCellEditor *Clone() const { return new wxGridCellFloatEditor; } + // parameters string format is "width,precision" + virtual void SetParameters(const wxString& params); + protected: // string representation of m_valueOld - wxString GetString() const - { return wxString::Format(_T("%f"), m_valueOld); } + wxString GetString() const; private: + int m_width, + m_precision; double m_valueOld; }; @@ -480,6 +500,7 @@ public: virtual void SetSize(const wxRect& rect); virtual void Show(bool show, wxGridCellAttr *attr = (wxGridCellAttr *)NULL); + virtual bool IsAcceptedKey(wxKeyEvent& event); virtual void BeginEdit(int row, int col, wxGrid* grid); virtual bool EndEdit(int row, int col, wxGrid* grid); @@ -502,7 +523,7 @@ class WXDLLEXPORT wxGridCellChoiceEditor : public wxGridCellEditor public: // if !allowOthers, user can't type a string not in choices array wxGridCellChoiceEditor(size_t count = 0, - const wxChar* choices[] = NULL, + const wxString choices[] = NULL, bool allowOthers = FALSE); virtual void Create(wxWindow* parent, @@ -754,11 +775,6 @@ public: // a wxGridCellAttrProvider if necessary. virtual bool CanHaveAttributes(); - - // change row/col number in attribute if needed - virtual void UpdateAttrRows( size_t pos, int numRows ); - virtual void UpdateAttrCols( size_t pos, int numCols ); - // by default forwarded to wxGridCellAttrProvider if any. May be // overridden to handle attributes directly in the table. virtual wxGridCellAttr *GetAttr( int row, int col ); @@ -933,8 +949,8 @@ private: // For comparisons... // -extern wxGridCellCoords wxGridNoCellCoords; -extern wxRect wxGridNoCellRect; +extern WXDLLEXPORT wxGridCellCoords wxGridNoCellCoords; +extern WXDLLEXPORT wxRect wxGridNoCellRect; // An array of cell coords... // @@ -979,10 +995,10 @@ public: // ------ display update functions // - void CalcRowLabelsExposed( wxRegion& reg ); + void CalcRowLabelsExposed( const wxRegion& reg ); - void CalcColLabelsExposed( wxRegion& reg ); - void CalcCellsExposed( wxRegion& reg ); + void CalcColLabelsExposed( const wxRegion& reg ); + void CalcCellsExposed( const wxRegion& reg ); // ------ event handlers @@ -1049,7 +1065,8 @@ public: // flicker // void BeginBatch() { m_batchCount++; } - void EndBatch() { if ( m_batchCount > 0 ) m_batchCount--; } + void EndBatch(); + int GetBatchCount() { return m_batchCount; } @@ -1062,6 +1079,7 @@ public: void DisableCellEditControl() { EnableCellEditControl(FALSE); } bool CanEnableCellControl() const; bool IsCellEditControlEnabled() const; + bool IsCellEditControlShown() const; bool IsCurrentCellReadOnly() const; @@ -1131,6 +1149,7 @@ public: wxString GetRowLabelValue( int row ); wxString GetColLabelValue( int col ); wxColour GetGridLineColour() { return m_gridLineColour; } + wxColour GetCellHighlightColour() { return m_cellHighlightColour; } void SetRowLabelSize( int width ); void SetColLabelSize( int height ); @@ -1142,6 +1161,7 @@ public: void SetRowLabelValue( int row, const wxString& ); void SetColLabelValue( int col, const wxString& ); void SetGridLineColour( const wxColour& ); + void SetCellHighlightColour( const wxColour& ); void EnableDragRowSize( bool enable = TRUE ); void DisableDragRowSize() { EnableDragRowSize( FALSE ); } @@ -1296,15 +1316,6 @@ public: wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft, const wxGridCellCoords & bottomRight ); - // This function returns the rectangle that encloses the selected cells - // in device coords and clipped to the client size of the grid window. - // - wxRect SelectionToDeviceRect() - { - return BlockToDeviceRect( m_selectingTopLeft, - m_selectingBottomRight ); - } - // Access or update the selection fore/back colours wxColour GetSelectionBackground() const { return m_selectionBackground; } @@ -1347,7 +1358,7 @@ public: int x, int y, int w = -1, int h = -1, long style = wxWANTS_CHARS, const wxString& name = wxPanelNameStr ) - : wxScrolledWindow( parent, -1, wxPoint(x,y), wxSize(w,h), + : wxScrolledWindow( parent, -1, wxPoint(x,y), wxSize(w,h), (style|wxWANTS_CHARS), name ) { Create(); @@ -1579,6 +1590,7 @@ protected: wxColour m_gridLineColour; bool m_gridLinesEnabled; + wxColour m_cellHighlightColour; // common part of AutoSizeColumn/Row() and GetBestSize() int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = TRUE); @@ -1704,6 +1716,7 @@ protected: void OnPaint( wxPaintEvent& ); void OnSize( wxSizeEvent& ); void OnKeyDown( wxKeyEvent& ); + void OnKeyUp( wxKeyEvent& ); void OnEraseBackground( wxEraseEvent& ); diff --git a/include/wx/generic/helpext.h b/include/wx/generic/helpext.h index 3c0b0c0360..8cdedc4d89 100644 --- a/include/wx/generic/helpext.h +++ b/include/wx/generic/helpext.h @@ -74,7 +74,7 @@ DECLARE_CLASS(wxExtHelpController) /// Is the viewer a variant of netscape? bool m_BrowserIsNetscape; /// Call the browser using a relative URL. - virtual bool DisplayHelp(wxString const &); + virtual bool DisplayHelp(const wxString&); }; #endif // wxUSE_HELP diff --git a/include/wx/generic/helphtml.h b/include/wx/generic/helphtml.h index 6bf25dff3e..44a5cbc4a2 100644 --- a/include/wx/generic/helphtml.h +++ b/include/wx/generic/helphtml.h @@ -103,6 +103,10 @@ DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase) /** Display help for id sectionNo -- identical with DisplaySection(). @return true on success */ + virtual bool DisplaySection(const wxString& section); + /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch) + @return true on success + */ virtual bool DisplayBlock(long blockNo); /** Search comment/documentation fields in map file and present a list to chose from. @@ -117,7 +121,7 @@ DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase) virtual void OnQuit(void); /// Call the browser using a relative URL. - virtual bool DisplayHelp(wxString const &) = 0; + virtual bool DisplayHelp(const wxString &) = 0; /// Allows one to override the default settings for the help frame. virtual void SetFrameParameters(const wxString& WXUNUSED(title), diff --git a/include/wx/generic/helpwxht.h b/include/wx/generic/helpwxht.h index 449c20f085..62d3da59aa 100644 --- a/include/wx/generic/helpwxht.h +++ b/include/wx/generic/helpwxht.h @@ -58,7 +58,7 @@ DECLARE_CLASS(wxHelpControllerHtml) private: /// Call the browser using a relative URL. - virtual bool DisplayHelp(wxString const &); + virtual bool DisplayHelp(const wxString &); protected: friend class wxHelpFrame; class wxHelpFrame *m_Frame; diff --git a/include/wx/generic/helpxlp.h b/include/wx/generic/helpxlp.h index 823b5b936f..2452d92910 100644 --- a/include/wx/generic/helpxlp.h +++ b/include/wx/generic/helpxlp.h @@ -104,6 +104,11 @@ class WXDLLEXPORT wxXLPHelpController: public wxHelpControllerBase virtual bool DisplayBlock(long blockNo); virtual bool KeywordSearch(const wxString& k); + virtual bool DisplaySection(const wxString& section) + { + return wxHelpControllerBase::DisplaySection(section); + } + virtual bool Quit(void); virtual void OnQuit(void); diff --git a/include/wx/generic/imaglist.h b/include/wx/generic/imaglist.h index e65e1787c7..390a498328 100644 --- a/include/wx/generic/imaglist.h +++ b/include/wx/generic/imaglist.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: imaglist.h +// Name: wx/generic/imaglist.h // Purpose: // Author: Robert Roebling // Created: 01/02/97 // Id: // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __IMAGELISTH_G__ @@ -49,15 +49,16 @@ enum { class wxImageList: public wxObject { - DECLARE_DYNAMIC_CLASS(wxImageList) - - public: - +public: wxImageList() { } wxImageList( int width, int height, bool mask = TRUE, int initialCount = 1 ); ~wxImageList(); + bool Create( int width, int height, bool mask = TRUE, int initialCount = 1 ); bool Create(); + int GetImageCount() const; + bool GetSize( int index, int &width, int &height ) const; + int Add( const wxBitmap& bitmap ); int Add( const wxBitmap& bitmap, const wxBitmap& mask ); int Add( const wxBitmap& bitmap, const wxColour& maskColour ); @@ -65,15 +66,18 @@ class wxImageList: public wxObject bool Replace( int index, const wxBitmap &bitmap ); bool Remove( int index ); bool RemoveAll(); - bool GetSize( int index, int &width, int &height ) const; - bool Draw(int index, wxDC& dc, int x, int y, - int flags = wxIMAGELIST_DRAW_NORMAL, bool solidBackground = FALSE ); - private: + bool Draw(int index, wxDC& dc, int x, int y, + int flags = wxIMAGELIST_DRAW_NORMAL, + bool solidBackground = FALSE); +private: wxList m_images; + int m_width; int m_height; + + DECLARE_DYNAMIC_CLASS(wxImageList) }; #endif // __IMAGELISTH_G__ diff --git a/include/wx/generic/laywin.h b/include/wx/generic/laywin.h index bc6f743951..db428595fd 100644 --- a/include/wx/generic/laywin.h +++ b/include/wx/generic/laywin.h @@ -141,7 +141,18 @@ class WXDLLEXPORT wxSashLayoutWindow: public wxSashWindow { DECLARE_CLASS(wxSashLayoutWindow) public: + wxSashLayoutWindow() + { + Init(); + } + wxSashLayoutWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "layoutWindow") + { + Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "layoutWindow"); // Accessors @@ -161,7 +172,10 @@ public: // Called by layout algorithm to retrieve information about the window. void OnQueryLayoutInfo(wxQueryLayoutInfoEvent& event); -protected: + +private: + void Init(); + wxLayoutAlignment m_alignment; wxLayoutOrientation m_orientation; wxSize m_defaultSize; @@ -190,7 +204,7 @@ public: return LayoutWindow(frame, mainWindow); } - // mainWindow is sized to whatever's left over. This function for backward + // mainWindow is sized to whatever's left over. bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = (wxWindow*) NULL); }; diff --git a/include/wx/generic/panelg.h b/include/wx/generic/panelg.h index de9db536e2..eda2bd5abd 100644 --- a/include/wx/generic/panelg.h +++ b/include/wx/generic/panelg.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: panelg.h -// Purpose: wxPanel: similar to wxWindows but is coloured as for a dialog +// Name: wx/generic/panelg.h +// Purpose: wxPanel: a container for child controls // Author: Julian Smart // Modified by: // Created: 01/02/97 @@ -13,14 +13,23 @@ #define _WX_GENERIC_PANEL_H_ #ifdef __GNUG__ -#pragma interface "panelg.h" + #pragma interface "panelg.h" #endif +// ---------------------------------------------------------------------------- +// headers and forward declarations +// ---------------------------------------------------------------------------- + #include "wx/window.h" -#include "wx/button.h" + +class WXDLLEXPORT wxButton; WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr; +// ---------------------------------------------------------------------------- +// wxPanel contains other controls and implements TAB traversal between them +// ---------------------------------------------------------------------------- + class WXDLLEXPORT wxPanel : public wxWindow { public: @@ -106,5 +115,8 @@ private: DECLARE_EVENT_TABLE() }; +// this function is for wxWindows use only +extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child); + #endif // _WX_GENERIC_PANEL_H_ diff --git a/include/wx/generic/plot.h b/include/wx/generic/plot.h index 69db90d019..a929055c57 100644 --- a/include/wx/generic/plot.h +++ b/include/wx/generic/plot.h @@ -325,9 +325,9 @@ public: void ResetScrollbar(); private: - friend wxPlotArea; - friend wxPlotXAxisArea; - friend wxPlotYAxisArea; + friend class wxPlotArea; + friend class wxPlotXAxisArea; + friend class wxPlotYAxisArea; double m_xUnitsPerValue; double m_xZoom; diff --git a/include/wx/generic/sashwin.h b/include/wx/generic/sashwin.h index d1dfdbfefb..647cbd6aff 100644 --- a/include/wx/generic/sashwin.h +++ b/include/wx/generic/sashwin.h @@ -55,8 +55,11 @@ public: */ #define wxSW_NOBORDER 0x0000 -#define wxSW_3D 0x0010 +//#define wxSW_3D 0x0010 #define wxSW_BORDER 0x0020 +#define wxSW_3DSASH 0x0040 +#define wxSW_3DBORDER 0x0080 +#define wxSW_3D (wxSW_3DSASH | wxSW_3DBORDER) /* * wxSashWindow allows any of its edges to have a sash which can be dragged @@ -74,13 +77,24 @@ public: // Public API // Default constructor - wxSashWindow(); + wxSashWindow() + { + Init(); + } // Normal constructor wxSashWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "sashWindow"); + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "sashWindow") + { + Init(); + Create(parent, id, pos, size, style, name); + } + ~wxSashWindow(); + bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "sashWindow"); + // Set whether there's a sash in this position void SetSashVisible(wxSashEdgePosition edge, bool sash); @@ -151,7 +165,9 @@ public: // Initialize colours void InitColours(); -protected: +private: + void Init(); + wxSashEdge m_sashes[4]; int m_dragMode; wxSashEdgePosition m_draggingEdge; diff --git a/include/wx/generic/splitter.h b/include/wx/generic/splitter.h index 4bdd5ace6a..0307f1902a 100644 --- a/include/wx/generic/splitter.h +++ b/include/wx/generic/splitter.h @@ -60,16 +60,30 @@ public: // Public API // Default constructor - wxSplitterWindow(); + wxSplitterWindow() + { + Init(); + } // Normal constructor wxSplitterWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSP_3D|wxCLIP_CHILDREN, - const wxString& name = "splitter"); + const wxString& name = "splitter") + { + Init(); + Create(parent, id, pos, size, style, name); + } + ~wxSplitterWindow(); + bool Create(wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_3D|wxCLIP_CHILDREN, + const wxString& name = "splitter"); + // Gets the only or left/top pane wxWindow *GetWindow1() const { return m_windowOne; } @@ -164,23 +178,26 @@ public: void OnIdle(wxIdleEvent& event); // Draws borders - void DrawBorders(wxDC& dc); + virtual void DrawBorders(wxDC& dc); // Draws the sash - void DrawSash(wxDC& dc); + virtual void DrawSash(wxDC& dc); // Draws the sash tracker (for whilst moving the sash) - void DrawSashTracker(int x, int y); + virtual void DrawSashTracker(int x, int y); // Tests for x, y over sash - bool SashHitTest(int x, int y, int tolerance = 2); + virtual bool SashHitTest(int x, int y, int tolerance = 2); // Resizes subwindows - void SizeWindows(); + virtual void SizeWindows(); // Initialize colours void InitColours(); + void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; } + bool GetNeedUpdating() const { return m_needUpdating ; } + protected: // our event handlers void OnSashPosChanged(wxSplitterEvent& event); @@ -191,9 +208,13 @@ protected: void SendUnsplitEvent(wxWindow *winRemoved); +private: + void Init(); + + int m_splitMode; bool m_permitUnsplitAlways; - bool m_needUpdating; // when in live mode, set the to TRUE to resize children in idle + bool m_needUpdating; // when in live mode, set this to TRUE to resize children in idle wxWindow* m_windowOne; wxWindow* m_windowTwo; int m_dragMode; diff --git a/include/wx/generic/treectrl.h b/include/wx/generic/treectrl.h index 7d1dd7e39d..50d949b2b2 100644 --- a/include/wx/generic/treectrl.h +++ b/include/wx/generic/treectrl.h @@ -312,6 +312,8 @@ public: // expand this item void Expand(const wxTreeItemId& item); + // expand this item and all subitems recursively + void ExpandAll(const wxTreeItemId& item); // collapse the item without removing its children void Collapse(const wxTreeItemId& item); // collapse the item and remove all children @@ -408,6 +410,7 @@ protected: wxTimer *m_renameTimer; bool m_renameAccept; + bool m_lastOnSame; // last click on the same item as prev wxString m_renameRes; // the common part of all ctors diff --git a/include/wx/generic/treelay.h b/include/wx/generic/treelay.h index f4a90e808e..02a697132f 100644 --- a/include/wx/generic/treelay.h +++ b/include/wx/generic/treelay.h @@ -61,7 +61,7 @@ public: inline long GetLeftMargin(void) const { return m_leftMargin; } inline bool GetOrientation(void) const { return m_orientation; } - inline void SetOrientation(bool or) { m_orientation = or; } + inline void SetOrientation(bool orient) { m_orientation = orient; } private: void CalcLayout(long node_id, int level, wxDC& dc); diff --git a/include/wx/generic/wizard.h b/include/wx/generic/wizard.h index 7c26f62b85..32186f6bab 100644 --- a/include/wx/generic/wizard.h +++ b/include/wx/generic/wizard.h @@ -24,12 +24,12 @@ public: int id = -1, const wxString& title = wxEmptyString, const wxBitmap& bitmap = wxNullBitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize); + const wxPoint& pos = wxDefaultPosition); // implement base class pure virtuals virtual bool RunWizard(wxWizardPage *firstPage); virtual wxWizardPage *GetCurrentPage() const; + virtual void SetPageSize(const wxSize& size); virtual wxSize GetPageSize() const; // implementation only from now on @@ -39,15 +39,27 @@ public: bool IsRunning() const { return m_page != NULL; } // show the prev/next page, but call TransferDataFromWindow on the current - // page first and return FALSE without changing the page if it returns - // FALSE + // page first and return FALSE without changing the page if + // TransferDataFromWindow() returns FALSE - otherwise, returns TRUE bool ShowPage(wxWizardPage *page, bool goingForward = TRUE); private: + // was the dialog really created? + bool WasCreated() const { return m_btnPrev != NULL; } + + // do fill the dialog with controls + void DoCreateControls(); + // event handlers void OnCancel(wxCommandEvent& event); void OnBackOrNext(wxCommandEvent& event); + // the page size requested by user + wxSize m_sizePage; + + // the dialog position from the ctor + wxPoint m_posWizard; + // wizard dimensions int m_x, m_y; // the origin for the pages int m_width, // the size of the page itself diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index 5096d3b8b5..41959d5ba6 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -70,8 +70,8 @@ public: wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM ); ~wxBitmap(); wxBitmap& operator = ( const wxBitmap& bmp ); - bool operator == ( const wxBitmap& bmp ); - bool operator != ( const wxBitmap& bmp ); + bool operator == ( const wxBitmap& bmp ) const; + bool operator != ( const wxBitmap& bmp ) const; bool Ok() const; bool Create(int width, int height, int depth = -1); diff --git a/include/wx/gtk/bmpbuttn.h b/include/wx/gtk/bmpbuttn.h index 3f1c684d63..233e8d90e8 100644 --- a/include/wx/gtk/bmpbuttn.h +++ b/include/wx/gtk/bmpbuttn.h @@ -74,6 +74,10 @@ public: void SetBitmapLabel( const wxBitmap& bitmap ); void SetBitmapSelected( const wxBitmap& bitmap ); + void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } + int GetMarginX() const { return m_marginX; } + int GetMarginY() const { return m_marginY; } + virtual bool Enable(bool enable); // implementation @@ -93,6 +97,10 @@ public: wxBitmap m_focus; wxBitmap m_selected; +protected: + int m_marginX; + int m_marginY; + private: DECLARE_DYNAMIC_CLASS(wxBitmapButton) }; diff --git a/include/wx/gtk/brush.h b/include/wx/gtk/brush.h index d42e564a81..31d4b7292c 100644 --- a/include/wx/gtk/brush.h +++ b/include/wx/gtk/brush.h @@ -40,8 +40,8 @@ public: wxBrush( const wxBrush &brush ); ~wxBrush(); wxBrush& operator = ( const wxBrush& brush ); - bool operator == ( const wxBrush& brush ); - bool operator != ( const wxBrush& brush ); + bool operator == ( const wxBrush& brush ) const; + bool operator != ( const wxBrush& brush ) const; bool Ok() const; int GetStyle() const; diff --git a/include/wx/gtk/dc.h b/include/wx/gtk/dc.h index 2ce4f8de26..78c421c9c4 100644 --- a/include/wx/gtk/dc.h +++ b/include/wx/gtk/dc.h @@ -148,7 +148,6 @@ public: bool m_needComputeScaleX, m_needComputeScaleY; // not yet used - float m_scaleFactor; // wxPSDC wants to have this. Will disappear. private: DECLARE_ABSTRACT_CLASS(wxDC) diff --git a/include/wx/gtk/dialog.h b/include/wx/gtk/dialog.h index c996833727..7050e0b05e 100644 --- a/include/wx/gtk/dialog.h +++ b/include/wx/gtk/dialog.h @@ -103,6 +103,9 @@ protected: // common part of all ctors void Init(); + // common part of Destroy() and ~wxDialog + void CleanUp(); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); diff --git a/include/wx/gtk/dnd.h b/include/wx/gtk/dnd.h index e6e45f03a8..52199517b4 100644 --- a/include/wx/gtk/dnd.h +++ b/include/wx/gtk/dnd.h @@ -36,6 +36,16 @@ class wxFileDropTarget; class wxDropSource; +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// this macro may be used instead for wxDropSource ctor arguments: it will use +// the icon 'name' from an XPM file under GTK, but will expand to something +// else under MSW. If you don't use it, you will have to use #ifdef in the +// application code. +#define wxDROP_ICON(name) wxICON(name) + //------------------------------------------------------------------------- // wxDropTarget //------------------------------------------------------------------------- @@ -78,12 +88,16 @@ class wxDropSource: public wxDropSourceBase public: /* constructor. set data later with SetData() */ wxDropSource( wxWindow *win = (wxWindow *)NULL, - const wxIcon &go = wxNullIcon ); + const wxIcon © = wxNullIcon, + const wxIcon &move = wxNullIcon, + const wxIcon &none = wxNullIcon); /* constructor for setting one data object */ wxDropSource( wxDataObject& data, wxWindow *win, - const wxIcon &go = wxNullIcon ); + const wxIcon © = wxNullIcon, + const wxIcon &move = wxNullIcon, + const wxIcon &none = wxNullIcon); ~wxDropSource(); @@ -94,7 +108,7 @@ public: void RegisterWindow(); void UnregisterWindow(); - void PrepareIcon( int hot_x, int hot_y, GdkDragContext *context ); + void PrepareIcon( int action, GdkDragContext *context ); GtkWidget *m_widget; GtkWidget *m_iconWindow; @@ -102,9 +116,17 @@ public: wxWindow *m_window; wxDragResult m_retValue; - wxIcon m_icon; + wxIcon m_iconCopy, + m_iconMove, + m_iconNone; bool m_waiting; + +private: + // common part of both ctors + void SetIcons(const wxIcon& copy, + const wxIcon& move, + const wxIcon& none); }; #endif diff --git a/include/wx/gtk/mdi.h b/include/wx/gtk/mdi.h index e8f87df94d..08a518e3c2 100644 --- a/include/wx/gtk/mdi.h +++ b/include/wx/gtk/mdi.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: mdi.h +// Name: gtk/mdi.h // Purpose: // Author: Robert Roebling // Id: $Id$ // Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -45,12 +45,20 @@ extern const wxChar* wxStatusLineNameStr; class wxMDIParentFrame: public wxFrame { public: - wxMDIParentFrame(); - wxMDIParentFrame( wxWindow *parent, - wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr ); + wxMDIParentFrame() { Init(); } + wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + ~wxMDIParentFrame(void); bool Create( wxWindow *parent, wxWindowID id, const wxString& title, @@ -60,32 +68,31 @@ public: void GetClientSize(int *width, int *height) const; wxMDIChildFrame *GetActiveChild() const; - - wxMDIClientWindow *GetClientWindow() const; + + wxMDIClientWindow *GetClientWindow() const; virtual wxMDIClientWindow *OnCreateClient(); - + virtual void Cascade() {} virtual void Tile() {} virtual void ArrangeIcons() {} virtual void ActivateNext(); virtual void ActivatePrevious(); - void OnActivate( wxActivateEvent& event ); - void OnSysColourChanged( wxSysColourChangedEvent& event ); - - // implementation + // implementation wxMDIClientWindow *m_clientWindow; bool m_justInserted; virtual void GtkOnSize( int x, int y, int width, int height ); virtual void OnInternalIdle(); - + +protected: + void Init(); + private: friend class wxMDIChildFrame; - + DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) - DECLARE_EVENT_TABLE() }; //----------------------------------------------------------------------------- @@ -105,7 +112,7 @@ public: wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr ); - + virtual void SetMenuBar( wxMenuBar *menu_bar ); virtual wxMenuBar *GetMenuBar() const; @@ -113,11 +120,11 @@ public: virtual void AddChild( wxWindowBase *child ); virtual void Activate(); - + #if wxUSE_STATUSBAR // no status bars virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1, - long WXUNUSED(style) = 1, + long WXUNUSED(style) = 1, wxWindowID WXUNUSED(id) = 1, const wxString& WXUNUSED(name) = wxEmptyString) { return (wxStatusBar*)NULL; } @@ -131,37 +138,38 @@ public: virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), int WXUNUSED(maxH), int WXUNUSED(incW), int WXUNUSED(incH) ) {} - + #if wxUSE_TOOLBAR // no toolbar bars - virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id), + virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id), const wxString& WXUNUSED(name) ) { return (wxToolBar*)NULL; } virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } #endif - + // no icon void SetIcon( const wxIcon &icon ) { m_icon = icon; } - - // no title - void SetTitle( const wxString &title ) { m_title = title; } + + // no title + void SetTitle( const wxString &title ); wxString GetTitle() const { return m_title; } - + // no maximize etc virtual void Maximize( bool WXUNUSED(maximize) ) {} virtual void Restore() {} - + virtual bool IsTopLevel() const { return FALSE; } - - void OnActivate( wxActivateEvent &event ); - - // implementation - + + void OnActivate( wxActivateEvent& event ); + void OnMenuHighlight( wxMenuEvent& event ); + + // implementation + wxMenuBar *m_menuBar; GtkNotebookPage *m_page; bool m_justInserted; - + private: - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) }; diff --git a/include/wx/gtk/pen.h b/include/wx/gtk/pen.h index 2f1d51c909..7e6f2c7335 100644 --- a/include/wx/gtk/pen.h +++ b/include/wx/gtk/pen.h @@ -21,15 +21,13 @@ #include "wx/gdiobj.h" #include "wx/gdicmn.h" -#include <gtk/gtk.h> // only needed for wxGTKDash, should it go elsewhere.. - //----------------------------------------------------------------------------- // classes //----------------------------------------------------------------------------- class wxPen; -#if GTK_CHECK_VERSION(1,2,7) +#ifdef __WXGTK127__ typedef gint8 wxGTKDash; #else typedef gchar wxGTKDash; @@ -47,8 +45,8 @@ public: wxPen( const wxPen& pen ); ~wxPen(); wxPen& operator = ( const wxPen& pen ); - bool operator == ( const wxPen& pen ); - bool operator != ( const wxPen& pen ); + bool operator == ( const wxPen& pen ) const; + bool operator != ( const wxPen& pen ) const; void SetColour( const wxColour &colour ); void SetColour( int red, int green, int blue ); diff --git a/include/wx/gtk/radiobox.h b/include/wx/gtk/radiobox.h index eded3b86e9..d7805a70ca 100644 --- a/include/wx/gtk/radiobox.h +++ b/include/wx/gtk/radiobox.h @@ -43,24 +43,37 @@ extern const char *wxRadioBoxNameStr; class wxRadioBox: public wxControl { public: - wxRadioBox(); - inline wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, - int majorDim = 1, long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr ) + wxRadioBox() { Init(); } + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + int majorDim = 1, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) { - Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); + Init(); + + Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); } - ~wxRadioBox(void); - bool Create( wxWindow *parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, - int majorDim = 0, long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr ); - + + ~wxRadioBox(); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + int FindString( const wxString& s) const; void SetSelection( int n ); int GetSelection() const; @@ -100,12 +113,20 @@ public: void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); #endif // wxUSE_TOOLTIPS wxSize LayoutItems(); - void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); + + virtual void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); + virtual void OnInternalIdle(); bool m_alreadySent; + bool m_hasFocus, + m_lostFocus; int m_majorDim; wxList m_boxes; - + +protected: + // common part of all ctors + void Init(); + private: DECLARE_DYNAMIC_CLASS(wxRadioBox) }; diff --git a/include/wx/gtk1/bitmap.h b/include/wx/gtk1/bitmap.h index 5096d3b8b5..41959d5ba6 100644 --- a/include/wx/gtk1/bitmap.h +++ b/include/wx/gtk1/bitmap.h @@ -70,8 +70,8 @@ public: wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM ); ~wxBitmap(); wxBitmap& operator = ( const wxBitmap& bmp ); - bool operator == ( const wxBitmap& bmp ); - bool operator != ( const wxBitmap& bmp ); + bool operator == ( const wxBitmap& bmp ) const; + bool operator != ( const wxBitmap& bmp ) const; bool Ok() const; bool Create(int width, int height, int depth = -1); diff --git a/include/wx/gtk1/bmpbuttn.h b/include/wx/gtk1/bmpbuttn.h index 3f1c684d63..233e8d90e8 100644 --- a/include/wx/gtk1/bmpbuttn.h +++ b/include/wx/gtk1/bmpbuttn.h @@ -74,6 +74,10 @@ public: void SetBitmapLabel( const wxBitmap& bitmap ); void SetBitmapSelected( const wxBitmap& bitmap ); + void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } + int GetMarginX() const { return m_marginX; } + int GetMarginY() const { return m_marginY; } + virtual bool Enable(bool enable); // implementation @@ -93,6 +97,10 @@ public: wxBitmap m_focus; wxBitmap m_selected; +protected: + int m_marginX; + int m_marginY; + private: DECLARE_DYNAMIC_CLASS(wxBitmapButton) }; diff --git a/include/wx/gtk1/brush.h b/include/wx/gtk1/brush.h index d42e564a81..31d4b7292c 100644 --- a/include/wx/gtk1/brush.h +++ b/include/wx/gtk1/brush.h @@ -40,8 +40,8 @@ public: wxBrush( const wxBrush &brush ); ~wxBrush(); wxBrush& operator = ( const wxBrush& brush ); - bool operator == ( const wxBrush& brush ); - bool operator != ( const wxBrush& brush ); + bool operator == ( const wxBrush& brush ) const; + bool operator != ( const wxBrush& brush ) const; bool Ok() const; int GetStyle() const; diff --git a/include/wx/gtk1/dc.h b/include/wx/gtk1/dc.h index 2ce4f8de26..78c421c9c4 100644 --- a/include/wx/gtk1/dc.h +++ b/include/wx/gtk1/dc.h @@ -148,7 +148,6 @@ public: bool m_needComputeScaleX, m_needComputeScaleY; // not yet used - float m_scaleFactor; // wxPSDC wants to have this. Will disappear. private: DECLARE_ABSTRACT_CLASS(wxDC) diff --git a/include/wx/gtk1/dialog.h b/include/wx/gtk1/dialog.h index c996833727..7050e0b05e 100644 --- a/include/wx/gtk1/dialog.h +++ b/include/wx/gtk1/dialog.h @@ -103,6 +103,9 @@ protected: // common part of all ctors void Init(); + // common part of Destroy() and ~wxDialog + void CleanUp(); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); diff --git a/include/wx/gtk1/dnd.h b/include/wx/gtk1/dnd.h index e6e45f03a8..52199517b4 100644 --- a/include/wx/gtk1/dnd.h +++ b/include/wx/gtk1/dnd.h @@ -36,6 +36,16 @@ class wxFileDropTarget; class wxDropSource; +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// this macro may be used instead for wxDropSource ctor arguments: it will use +// the icon 'name' from an XPM file under GTK, but will expand to something +// else under MSW. If you don't use it, you will have to use #ifdef in the +// application code. +#define wxDROP_ICON(name) wxICON(name) + //------------------------------------------------------------------------- // wxDropTarget //------------------------------------------------------------------------- @@ -78,12 +88,16 @@ class wxDropSource: public wxDropSourceBase public: /* constructor. set data later with SetData() */ wxDropSource( wxWindow *win = (wxWindow *)NULL, - const wxIcon &go = wxNullIcon ); + const wxIcon © = wxNullIcon, + const wxIcon &move = wxNullIcon, + const wxIcon &none = wxNullIcon); /* constructor for setting one data object */ wxDropSource( wxDataObject& data, wxWindow *win, - const wxIcon &go = wxNullIcon ); + const wxIcon © = wxNullIcon, + const wxIcon &move = wxNullIcon, + const wxIcon &none = wxNullIcon); ~wxDropSource(); @@ -94,7 +108,7 @@ public: void RegisterWindow(); void UnregisterWindow(); - void PrepareIcon( int hot_x, int hot_y, GdkDragContext *context ); + void PrepareIcon( int action, GdkDragContext *context ); GtkWidget *m_widget; GtkWidget *m_iconWindow; @@ -102,9 +116,17 @@ public: wxWindow *m_window; wxDragResult m_retValue; - wxIcon m_icon; + wxIcon m_iconCopy, + m_iconMove, + m_iconNone; bool m_waiting; + +private: + // common part of both ctors + void SetIcons(const wxIcon& copy, + const wxIcon& move, + const wxIcon& none); }; #endif diff --git a/include/wx/gtk1/mdi.h b/include/wx/gtk1/mdi.h index e8f87df94d..08a518e3c2 100644 --- a/include/wx/gtk1/mdi.h +++ b/include/wx/gtk1/mdi.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: mdi.h +// Name: gtk/mdi.h // Purpose: // Author: Robert Roebling // Id: $Id$ // Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -45,12 +45,20 @@ extern const wxChar* wxStatusLineNameStr; class wxMDIParentFrame: public wxFrame { public: - wxMDIParentFrame(); - wxMDIParentFrame( wxWindow *parent, - wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr ); + wxMDIParentFrame() { Init(); } + wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + ~wxMDIParentFrame(void); bool Create( wxWindow *parent, wxWindowID id, const wxString& title, @@ -60,32 +68,31 @@ public: void GetClientSize(int *width, int *height) const; wxMDIChildFrame *GetActiveChild() const; - - wxMDIClientWindow *GetClientWindow() const; + + wxMDIClientWindow *GetClientWindow() const; virtual wxMDIClientWindow *OnCreateClient(); - + virtual void Cascade() {} virtual void Tile() {} virtual void ArrangeIcons() {} virtual void ActivateNext(); virtual void ActivatePrevious(); - void OnActivate( wxActivateEvent& event ); - void OnSysColourChanged( wxSysColourChangedEvent& event ); - - // implementation + // implementation wxMDIClientWindow *m_clientWindow; bool m_justInserted; virtual void GtkOnSize( int x, int y, int width, int height ); virtual void OnInternalIdle(); - + +protected: + void Init(); + private: friend class wxMDIChildFrame; - + DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) - DECLARE_EVENT_TABLE() }; //----------------------------------------------------------------------------- @@ -105,7 +112,7 @@ public: wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr ); - + virtual void SetMenuBar( wxMenuBar *menu_bar ); virtual wxMenuBar *GetMenuBar() const; @@ -113,11 +120,11 @@ public: virtual void AddChild( wxWindowBase *child ); virtual void Activate(); - + #if wxUSE_STATUSBAR // no status bars virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1, - long WXUNUSED(style) = 1, + long WXUNUSED(style) = 1, wxWindowID WXUNUSED(id) = 1, const wxString& WXUNUSED(name) = wxEmptyString) { return (wxStatusBar*)NULL; } @@ -131,37 +138,38 @@ public: virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), int WXUNUSED(maxH), int WXUNUSED(incW), int WXUNUSED(incH) ) {} - + #if wxUSE_TOOLBAR // no toolbar bars - virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id), + virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id), const wxString& WXUNUSED(name) ) { return (wxToolBar*)NULL; } virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } #endif - + // no icon void SetIcon( const wxIcon &icon ) { m_icon = icon; } - - // no title - void SetTitle( const wxString &title ) { m_title = title; } + + // no title + void SetTitle( const wxString &title ); wxString GetTitle() const { return m_title; } - + // no maximize etc virtual void Maximize( bool WXUNUSED(maximize) ) {} virtual void Restore() {} - + virtual bool IsTopLevel() const { return FALSE; } - - void OnActivate( wxActivateEvent &event ); - - // implementation - + + void OnActivate( wxActivateEvent& event ); + void OnMenuHighlight( wxMenuEvent& event ); + + // implementation + wxMenuBar *m_menuBar; GtkNotebookPage *m_page; bool m_justInserted; - + private: - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) }; diff --git a/include/wx/gtk1/pen.h b/include/wx/gtk1/pen.h index 2f1d51c909..7e6f2c7335 100644 --- a/include/wx/gtk1/pen.h +++ b/include/wx/gtk1/pen.h @@ -21,15 +21,13 @@ #include "wx/gdiobj.h" #include "wx/gdicmn.h" -#include <gtk/gtk.h> // only needed for wxGTKDash, should it go elsewhere.. - //----------------------------------------------------------------------------- // classes //----------------------------------------------------------------------------- class wxPen; -#if GTK_CHECK_VERSION(1,2,7) +#ifdef __WXGTK127__ typedef gint8 wxGTKDash; #else typedef gchar wxGTKDash; @@ -47,8 +45,8 @@ public: wxPen( const wxPen& pen ); ~wxPen(); wxPen& operator = ( const wxPen& pen ); - bool operator == ( const wxPen& pen ); - bool operator != ( const wxPen& pen ); + bool operator == ( const wxPen& pen ) const; + bool operator != ( const wxPen& pen ) const; void SetColour( const wxColour &colour ); void SetColour( int red, int green, int blue ); diff --git a/include/wx/gtk1/radiobox.h b/include/wx/gtk1/radiobox.h index eded3b86e9..d7805a70ca 100644 --- a/include/wx/gtk1/radiobox.h +++ b/include/wx/gtk1/radiobox.h @@ -43,24 +43,37 @@ extern const char *wxRadioBoxNameStr; class wxRadioBox: public wxControl { public: - wxRadioBox(); - inline wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, - int majorDim = 1, long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr ) + wxRadioBox() { Init(); } + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + int majorDim = 1, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) { - Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); + Init(); + + Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); } - ~wxRadioBox(void); - bool Create( wxWindow *parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, - int majorDim = 0, long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr ); - + + ~wxRadioBox(); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + int FindString( const wxString& s) const; void SetSelection( int n ); int GetSelection() const; @@ -100,12 +113,20 @@ public: void ApplyToolTip( GtkTooltips *tips, const wxChar *tip ); #endif // wxUSE_TOOLTIPS wxSize LayoutItems(); - void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); + + virtual void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); + virtual void OnInternalIdle(); bool m_alreadySent; + bool m_hasFocus, + m_lostFocus; int m_majorDim; wxList m_boxes; - + +protected: + // common part of all ctors + void Init(); + private: DECLARE_DYNAMIC_CLASS(wxRadioBox) }; diff --git a/include/wx/hash.h b/include/wx/hash.h index cf10d040c8..af9cbbce94 100644 --- a/include/wx/hash.h +++ b/include/wx/hash.h @@ -200,8 +200,8 @@ private: // defines a new type safe hash table which stores the elements of type eltype // in lists of class listclass -#define WX_DECLARE_HASH(eltype, listclass, hashclass) \ - class WXDLLEXPORT hashclass : public wxHashTableBase \ +#define _WX_DECLARE_HASH(eltype, listclass, hashclass, classexp) \ + classexp hashclass : public wxHashTableBase \ { \ public: \ hashclass(wxKeyType keyType = wxKEY_INTEGER, \ @@ -258,5 +258,14 @@ private: } \ } +// this macro is to be used in the user code +#define WX_DECLARE_HASH(el, list, hash) \ + _WX_DECLARE_HASH(el, list, hash, class) + +// and this one does exactly the same thing but should be used inside the +// library +#define WX_DECLARE_EXPORTED_HASH(el, list, hash) \ + _WX_DECLARE_HASH(el, list, hash, class WXDLLEXPORT) + #endif // _WX_HASH_H__ diff --git a/include/wx/helpbase.h b/include/wx/helpbase.h index 37cc6ea158..c35b3b0cb1 100644 --- a/include/wx/helpbase.h +++ b/include/wx/helpbase.h @@ -30,48 +30,52 @@ // Defines the API for help controllers class WXDLLEXPORT wxHelpControllerBase: public wxObject { - DECLARE_CLASS(wxHelpControllerBase) + DECLARE_CLASS(wxHelpControllerBase) + +public: + inline wxHelpControllerBase() {} + inline ~wxHelpControllerBase() {}; + + // Must call this to set the filename and server name. + // server is only required when implementing TCP/IP-based + // help controllers. + virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return FALSE; } + virtual bool Initialize(const wxString& WXUNUSED(file)) { return FALSE; } + + // Set viewer: only relevant to some kinds of controller + virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = "") = 0; + virtual bool DisplayContents(void) = 0; + virtual bool DisplaySection(int sectionNo) = 0; - public: - inline wxHelpControllerBase() {} - inline ~wxHelpControllerBase() {}; - - // Must call this to set the filename and server name. - // server is only required when implementing TCP/IP-based - // help controllers. - virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return FALSE; } - virtual bool Initialize(const wxString& WXUNUSED(file)) { return FALSE; } - - // Set viewer: only relevant to some kinds of controller - virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = "") = 0; - virtual bool DisplayContents(void) = 0; - virtual bool DisplaySection(int sectionNo) = 0; - virtual bool DisplayBlock(long blockNo) = 0; - virtual bool KeywordSearch(const wxString& k) = 0; - /// Allows one to override the default settings for the help frame. - virtual void SetFrameParameters(const wxString& WXUNUSED(title), - const wxSize& WXUNUSED(size), - const wxPoint& WXUNUSED(pos) = wxDefaultPosition, - bool WXUNUSED(newFrameEachTime) = FALSE) - { - // does nothing by default - } - /// Obtains the latest settings used by the help frame and the help - /// frame. - virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, - wxPoint *WXUNUSED(pos) = NULL, - bool *WXUNUSED(newFrameEachTime) = NULL) - { - return (wxFrame*) NULL;// does nothing by default - } - - virtual bool Quit(void) = 0; - virtual void OnQuit(void) {}; + // By default, uses KeywordSection to display a topic. Implementations + // may override this for more specific behaviour. + virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); }; + virtual bool DisplayBlock(long blockNo) = 0; + virtual bool KeywordSearch(const wxString& k) = 0; + /// Allows one to override the default settings for the help frame. + virtual void SetFrameParameters(const wxString& WXUNUSED(title), + const wxSize& WXUNUSED(size), + const wxPoint& WXUNUSED(pos) = wxDefaultPosition, + bool WXUNUSED(newFrameEachTime) = FALSE) + { + // does nothing by default + } + /// Obtains the latest settings used by the help frame and the help + /// frame. + virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, + wxPoint *WXUNUSED(pos) = NULL, + bool *WXUNUSED(newFrameEachTime) = NULL) + { + return (wxFrame*) NULL;// does nothing by default + } + + virtual bool Quit(void) = 0; + virtual void OnQuit(void) {}; }; #endif // wxUSE_HELP #endif - // _WX_HELPBASEH__ +// _WX_HELPBASEH__ diff --git a/include/wx/html/helpctrl.h b/include/wx/html/helpctrl.h index b052c83e94..4a247371a1 100644 --- a/include/wx/html/helpctrl.h +++ b/include/wx/html/helpctrl.h @@ -70,6 +70,7 @@ class WXDLLEXPORT wxHtmlHelpController : public wxHelpControllerBase // wxEvtHan virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {} virtual bool LoadFile(const wxString& file = ""); virtual bool DisplaySection(int sectionNo); + virtual bool DisplaySection(const wxString& section) { return Display(section); } virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); } virtual void SetFrameParameters(const wxString& title, const wxSize& size, diff --git a/include/wx/html/helpfrm.h b/include/wx/html/helpfrm.h index 5ac3a97957..7ce4bc2a7f 100644 --- a/include/wx/html/helpfrm.h +++ b/include/wx/html/helpfrm.h @@ -43,7 +43,9 @@ #define wxHF_BOOKMARKS 0x0010 #define wxHF_OPENFILES 0x0020 #define wxHF_PRINT 0x0040 -#define wxHF_DEFAULTSTYLE (wxHF_TOOLBAR | wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH | wxHF_BOOKMARKS | wxHF_PRINT) +#define wxHF_FLATTOOLBAR 0x0080 +#define wxHF_DEFAULTSTYLE (wxHF_TOOLBAR | wxHF_CONTENTS | wxHF_INDEX | \ + wxHF_SEARCH | wxHF_BOOKMARKS | wxHF_PRINT) // Command IDs : diff --git a/include/wx/html/htmprint.h b/include/wx/html/htmprint.h index f84dea24af..d185767c94 100644 --- a/include/wx/html/htmprint.h +++ b/include/wx/html/htmprint.h @@ -179,14 +179,14 @@ class WXDLLEXPORT wxHtmlEasyPrinting : public wxObject wxHtmlEasyPrinting(const wxString& name = "Printing", wxFrame *parent_frame = NULL); ~wxHtmlEasyPrinting(); - void PreviewFile(const wxString &htmlfile); - void PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString); + bool PreviewFile(const wxString &htmlfile); + bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString); // Preview file / html-text for printing // (and offers printing) // basepath is base directory for opening subsequent files (e.g. from <img> tag) - void PrintFile(const wxString &htmlfile); - void PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString); + bool PrintFile(const wxString &htmlfile); + bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString); // Print file / html-text w/o preview void PrinterSetup(); @@ -211,8 +211,8 @@ class WXDLLEXPORT wxHtmlEasyPrinting : public wxObject private: wxHtmlPrintout *CreatePrintout(); - void DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2); - void DoPrint(wxHtmlPrintout *printout); + bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2); + bool DoPrint(wxHtmlPrintout *printout); wxPrintData *m_PrintData; wxPageSetupDialogData *m_PageSetupData; diff --git a/include/wx/html/msw/wfolder.ico b/include/wx/html/msw/wfolder.ico index c42bea708246935d2e46dc9d47b364a5f5fe247e..0ffdb660e38b446fb5fa819bf39e77d9e615dd96 100644 GIT binary patch literal 318 zcma)&%?*Gc422)Y0l*N?c=Kp<f+p-GqjeNF!B^rz4<>x@O4_DB0dPFtdl;(&W_u}% zB+6l=1xmADqpB!{nOb@4H`(FkA0#xQ?1K?yOGdwcG@`I*2_fc*O>7n$zen22CgrZB MNBkc>f$OQe0YauNK>z>% literal 318 zcma)&!3}^Q3`IZ00YHgoym=H|!M$X(j^ZZx3tsfZga1j}v}phgk8=*nYJgc^N;8o% z80bK*{xuOn&a9NeTfW7P==gIslCOlcTP36|D*bVr8xorq@26w5cG4UNw^DOmStZ;x M_lW-^7jVCQ561^8O#lD@ diff --git a/include/wx/html/winpars.h b/include/wx/html/winpars.h index 2c90277586..1d96d69de5 100644 --- a/include/wx/html/winpars.h +++ b/include/wx/html/winpars.h @@ -66,6 +66,7 @@ class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser static void AddModule(wxHtmlTagsModule *module); // Adds tags module. see wxHtmlTagsModule for details. + static void RemoveModule(wxHtmlTagsModule *module); // parsing-related methods. These methods are called by tag handlers: wxHtmlContainerCell *GetContainer() const {return m_Container;} diff --git a/include/wx/imagbmp.h b/include/wx/imagbmp.h index 8fc5d9a820..ea5f4657ff 100644 --- a/include/wx/imagbmp.h +++ b/include/wx/imagbmp.h @@ -16,28 +16,29 @@ #include "wx/image.h" -//----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // wxBMPHandler -//----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- -class WXDLLEXPORT wxBMPHandler: public wxImageHandler +class WXDLLEXPORT wxBMPHandler : public wxImageHandler { - DECLARE_DYNAMIC_CLASS(wxBMPHandler) - public: - - inline wxBMPHandler() + wxBMPHandler() { - m_name = "BMP file"; - m_extension = "bmp"; + m_name = _T("BMP file"); + m_extension = _T("bmp"); m_type = wxBITMAP_TYPE_BMP; - m_mime = "image/bmp"; + m_mime = _T("image/bmp"); }; #if wxUSE_STREAMS + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=0 ); virtual bool DoCanRead( wxInputStream& stream ); -#endif +#endif // wxUSE_STREAMS + + DECLARE_DYNAMIC_CLASS(wxBMPHandler) }; diff --git a/include/wx/image.h b/include/wx/image.h index 09aa6ed4a2..423dc55f69 100644 --- a/include/wx/image.h +++ b/include/wx/image.h @@ -89,6 +89,7 @@ class WXDLLEXPORT wxImage: public wxObject public: wxImage(); wxImage( int width, int height ); + wxImage( int width, int height, unsigned char* data, bool static_data = FALSE ); wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY ); wxImage( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY ); wxImage( const wxString& name, const wxString& mimetype ); @@ -97,7 +98,6 @@ public: wxImage( const wxImage& image ); wxImage( const wxImage* image ); - // these functions get implemented in /src/(platform)/bitmap.cpp wxImage( const wxBitmap &bitmap ); operator wxBitmap() const { return ConvertToBitmap(); } wxBitmap ConvertToBitmap() const; @@ -106,10 +106,19 @@ public: #endif void Create( int width, int height ); + void Create( int width, int height, unsigned char* data, bool static_data = FALSE ); void Destroy(); + // creates an identical copy of the image (the = operator + // just raises the ref count) + wxImage Copy() const; + // return the new image with size width*height wxImage GetSubImage( const wxRect& ) const; + + // pastes image into this instance and takes care of + // the mask colour and out of bounds problems + void Paste( const wxImage &image, int x, int y ); // return the new image with size width*height wxImage Scale( int width, int height ) const; @@ -120,7 +129,10 @@ public: // Rotates the image about the given point, 'angle' radians. // Returns the rotated image, leaving this image intact. wxImage Rotate(double angle, const wxPoint & centre_of_rotation, - bool interpolating = TRUE, wxPoint * offset_after_rotation = (wxPoint*) NULL) const ; + bool interpolating = TRUE, wxPoint * offset_after_rotation = (wxPoint*) NULL) const; + + wxImage Rotate90( bool clockwise = TRUE ) const; + wxImage Mirror( bool horizontally = TRUE ) const; // replace one colour with another void Replace( unsigned char r1, unsigned char g1, unsigned char b1, @@ -128,9 +140,9 @@ public: // these routines are slow but safe void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b ); - unsigned char GetRed( int x, int y ); - unsigned char GetGreen( int x, int y ); - unsigned char GetBlue( int x, int y ); + unsigned char GetRed( int x, int y ) const; + unsigned char GetGreen( int x, int y ) const; + unsigned char GetBlue( int x, int y ) const; static bool CanRead( const wxString& name ); virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY ); @@ -156,7 +168,8 @@ public: char unsigned *GetData() const; void SetData( char unsigned *data ); - + void SetData( char unsigned *data, int new_width, int new_height ); + void SetMaskColour( unsigned char r, unsigned char g, unsigned char b ); unsigned char GetMaskRed() const; unsigned char GetMaskGreen() const; diff --git a/include/wx/ipcbase.h b/include/wx/ipcbase.h index 178cb3b31f..6d3e80562c 100644 --- a/include/wx/ipcbase.h +++ b/include/wx/ipcbase.h @@ -48,7 +48,8 @@ class WXDLLEXPORT wxClientBase; class WXDLLEXPORT wxConnectionBase: public wxObject { DECLARE_CLASS(wxConnectionBase) - public: + +public: inline wxConnectionBase(void) {} inline ~wxConnectionBase(void) {} @@ -102,8 +103,7 @@ class WXDLLEXPORT wxConnectionBase: public wxObject wxIPCFormat WXUNUSED(format) ) { return FALSE; }; - // Callbacks to BOTH - + // Callbacks to BOTH - override at will // Default behaviour is to delete connection and return TRUE virtual bool OnDisconnect(void) = 0; }; @@ -111,28 +111,35 @@ class WXDLLEXPORT wxConnectionBase: public wxObject class WXDLLEXPORT wxServerBase: public wxObject { DECLARE_CLASS(wxServerBase) - public: +public: inline wxServerBase(void) {} inline ~wxServerBase(void) {}; - virtual bool Create(const wxString& serverName) = 0; // Returns FALSE if can't create server (e.g. port - // number is already in use) - virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0; + // Returns FALSE on error (e.g. port number is already in use) + virtual bool Create(const wxString& serverName) = 0; + + // Callbacks to SERVER - override at will + virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0; }; class WXDLLEXPORT wxClientBase: public wxObject { DECLARE_CLASS(wxClientBase) - public: + +public: inline wxClientBase(void) {}; inline ~wxClientBase(void) {}; + virtual bool ValidHost(const wxString& host) = 0; - virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic) = 0; - // Call this to make a connection. - // Returns NULL if cannot. - virtual wxConnectionBase *OnMakeConnection(void) = 0; // Tailor this to return own connection. + // Call this to make a connection. Returns NULL if cannot. + virtual wxConnectionBase *MakeConnection(const wxString& host, + const wxString& server, + const wxString& topic) = 0; + + // Callbacks to CLIENT - override at will + virtual wxConnectionBase *OnMakeConnection(void) = 0; }; #endif diff --git a/include/wx/list.h b/include/wx/list.h index ff710bd22c..d475c569b4 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -34,7 +34,6 @@ // ----------------------------------------------------------------------------- #include "wx/defs.h" -#include "wx/debug.h" #include "wx/object.h" #include "wx/string.h" @@ -353,10 +352,10 @@ private: // wxWindowBase pointers are put into the list, but wxWindow pointers are // retrieved from it. -#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype) \ +#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype, classexp) \ typedef int (*wxSortFuncFor_##name)(const T **, const T **); \ \ - class WXDLLEXPORT nodetype : public wxNodeBase \ + classexp nodetype : public wxNodeBase \ { \ public: \ nodetype(wxListBase *list = (wxListBase *)NULL, \ @@ -379,7 +378,7 @@ private: virtual void DeleteData(); \ }; \ \ - class WXDLLEXPORT name : public wxListBase \ + classexp name : public wxListBase \ { \ public: \ typedef nodetype Node; \ @@ -389,6 +388,9 @@ private: name(size_t count, T *elements[]) \ : wxListBase(count, (void **)elements) { } \ \ + name& operator=(const name& list) \ + { return (name&)wxListBase::operator=(list); } \ + \ nodetype *GetFirst() const \ { return (nodetype *)wxListBase::GetFirst(); } \ nodetype *GetLast() const \ @@ -447,12 +449,16 @@ private: } \ } -#define WX_DECLARE_LIST_2(elementtype, listname, nodename) \ - WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename) +#define WX_DECLARE_LIST_2(elementtype, listname, nodename, classexp) \ + WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename, classexp) #define WX_DECLARE_LIST(elementtype, listname) \ typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ - WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node) + WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class) + +#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \ + typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ + WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class WXDLLEXPORT) // this macro must be inserted in your program after // #include <wx/listimpl.cpp> @@ -472,13 +478,16 @@ private: // wxList compatibility class: in fact, it's a list of wxObjects // ----------------------------------------------------------------------------- -WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode); +WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode, class WXDLLEXPORT); class WXDLLEXPORT wxList : public wxObjectList { public: wxList(int key_type = wxKEY_NONE) : wxObjectList((wxKeyType)key_type) { } + wxList& operator=(const wxList& list) + { return (wxList&)wxListBase::operator=(list); } + // compatibility methods void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); } @@ -489,7 +498,7 @@ public: // wxStringList class for compatibility with the old code // ----------------------------------------------------------------------------- -WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode); +WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode, class WXDLLEXPORT); class WXDLLEXPORT wxStringList : public wxStringListBase { diff --git a/include/wx/listimpl.cpp b/include/wx/listimpl.cpp index d7ef44dded..3beb66103d 100644 --- a/include/wx/listimpl.cpp +++ b/include/wx/listimpl.cpp @@ -9,10 +9,10 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -#define _DEFINE_LIST(T, name) \ - void wx##name##Node::DeleteData() \ - { \ - delete (T *)GetData(); \ +#define _DEFINE_LIST(T, name) \ + void wx##name##Node::DeleteData() \ + { \ + delete (T *)GetData(); \ } // redefine the macro so that now it will generate the class implementation diff --git a/include/wx/log.h b/include/wx/log.h index 8c17c182d8..6c2e4cdd51 100644 --- a/include/wx/log.h +++ b/include/wx/log.h @@ -298,12 +298,6 @@ protected: // empty everything void Clear(); - // the translated titles for misc message boxes: only translate ones to - // avoid reentrancy problems later - wxString m_error, - m_warning, - m_info; - wxArrayString m_aMessages; // the log message texts wxArrayInt m_aSeverity; // one of wxLOG_XXX values wxArrayLong m_aTimes; // the time of each message @@ -327,15 +321,15 @@ public: ~wxLogWindow(); // window operations - // show/hide the log window + // show/hide the log window void Show(bool bShow = TRUE); - // retrieve the pointer to the frame + // retrieve the pointer to the frame wxFrame *GetFrame() const; // accessors - // the previous log target (may be NULL) + // the previous log target (may be NULL) wxLog *GetOldLog() const { return m_pOldLog; } - // are we passing the messages to the previous log target? + // are we passing the messages to the previous log target? bool IsPassingMessages() const { return m_bPassMessages; } // we can pass the messages to the previous log target (we're in this mode by @@ -344,14 +338,20 @@ public: void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; } // base class virtuals - // we don't need it ourselves, but we pass it to the previous logger + // we don't need it ourselves, but we pass it to the previous logger virtual void Flush(); // overridables - // called immediately after the log frame creation allowing for - // any extra initializations + // called immediately after the log frame creation allowing for + // any extra initializations virtual void OnFrameCreate(wxFrame *frame); - // called right before the log frame is going to be deleted + // called if the user closes the window interactively, will not be + // called if it is destroyed for another reason (such as when program + // exits) - return TRUE from here to allow the frame to close, FALSE + // to prevent this from happening + virtual bool OnFrameClose(wxFrame *frame); + // called right before the log frame is going to be deleted: will + // always be called unlike OnFrameClose() virtual void OnFrameDelete(wxFrame *frame); protected: @@ -471,7 +471,7 @@ DECLARE_LOG_FUNCTION2(SysError, long lErrCode); // this second version will only log the message if the mask had been // added to the list of masks with AddTraceMask() - DECLARE_LOG_FUNCTION2(Trace, const char *mask); + DECLARE_LOG_FUNCTION2(Trace, const wxChar *mask); // the last one does nothing if all of level bits are not set // in wxLog::GetActive()->GetTraceMask() - it's deprecated in favour of @@ -500,13 +500,13 @@ DECLARE_LOG_FUNCTION2(SysError, long lErrCode); #ifdef __VISUALC__ #define wxLogApiError(api, rc) \ wxLogDebug(wxT("%s(%d): '%s' failed with error 0x%08lx (%s)."), \ - __TFILE__, __LINE__, _T(api), \ + __TFILE__, __LINE__, api, \ rc, wxSysErrorMsg(rc)) #else // !VC++ #define wxLogApiError(api, rc) \ wxLogDebug(wxT("In file %s at line %d: '%s' failed with " \ "error 0x%08lx (%s)."), \ - __TFILE__, __LINE__, _T(api), \ + __TFILE__, __LINE__, api, \ rc, wxSysErrorMsg(rc)) #endif // VC++/!VC++ diff --git a/include/wx/longlong.h b/include/wx/longlong.h index 5ff8a9b01c..113bc1dd33 100644 --- a/include/wx/longlong.h +++ b/include/wx/longlong.h @@ -3,8 +3,6 @@ // Purpose: declaration of wxLongLong class - best implementation of a 64 // bit integer for the current platform. // Author: Jeffrey C. Ollie <jeff@ollie.clive.ia.us>, Vadim Zeitlin -// Remarks: this class is not public in wxWindows 2.0! It is intentionally -// not documented and is for private use only. // Modified by: // Created: 10.02.99 // RCS-ID: $Id$ @@ -21,7 +19,6 @@ #include "wx/defs.h" #include "wx/wxchar.h" -#include "wx/debug.h" #include <limits.h> // for LONG_MAX @@ -30,7 +27,7 @@ // wxLongLongNative -- this is extremely useful to find the bugs in // wxLongLongWx class! -//#define wxLONGLONG_TEST_MODE +// #define wxLONGLONG_TEST_MODE #ifdef wxLONGLONG_TEST_MODE #define wxUSE_LONGLONG_WX 1 @@ -53,7 +50,7 @@ #define wxLongLongIsLong #elif (defined(__VISUALC__) && defined(__WIN32__)) || defined( __VMS__ ) #define wxLongLong_t __int64 -#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x530) +#elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520) #define wxLongLong_t __int64 #elif defined(__GNUG__) #define wxLongLong_t long long @@ -75,7 +72,6 @@ #pragma warning "Your compiler does not appear to support 64 bit "\ "integers, using emulation class instead." #endif - #define wxUSE_LONGLONG_WX 1 #endif // compiler @@ -460,6 +456,17 @@ public: bool operator>=(const wxLongLongWx& ll) const { return *this > ll || *this == ll; } + bool operator<(long l) const { return *this < wxLongLongWx(l); } + bool operator>(long l) const { return *this > wxLongLongWx(l); } + bool operator==(long l) const + { + return l >= 0 ? (m_hi == 0 && m_lo == (unsigned long)l) + : (m_hi == -1 && m_lo == (unsigned long)l); + } + + bool operator<=(long l) const { return *this < l || *this == l; } + bool operator>=(long l) const { return *this > l || *this == l; } + // multiplication wxLongLongWx operator*(const wxLongLongWx& ll) const; wxLongLongWx& operator*=(const wxLongLongWx& ll); diff --git a/include/wx/mac/dc.h b/include/wx/mac/dc.h index dd55252573..89d8cdd981 100644 --- a/include/wx/mac/dc.h +++ b/include/wx/mac/dc.h @@ -375,8 +375,6 @@ class WXDLLEXPORT wxDC: public wxObject bool m_needComputeScaleX,m_needComputeScaleY; // not yet used - float m_scaleFactor; // wxPSDC wants to have this. Will disappear. - long m_clipX1,m_clipY1,m_clipX2,m_clipY2; long m_minX,m_maxX,m_minY,m_maxY; diff --git a/include/wx/mac/setup.h b/include/wx/mac/setup.h index bfb74aab4d..44e5cb73a8 100644 --- a/include/wx/mac/setup.h +++ b/include/wx/mac/setup.h @@ -262,17 +262,27 @@ // Set this to 0 if your compiler can't cope // with omission of prototype parameters. -#define wxUSE_ODBC 1 - // Define 1 to use ODBC classes - - -#define wxODBC_FWD_ONLY_CURSORS 1 - // Some databases/ODBC drivers only allow forward scrolling cursors. - // Unless you specifically want to use backward scrolling - // cursors, and you know that all of the databases/ODBC drivers - // that you will use these odbc classes with allow backward - // scrolling cursors, this setting should remain set to 1 - // for maximum database/driver compatibilty +#define wxUSE_ODBC 1 + // Define 1 to use ODBC classes + + +#define wxODBC_FWD_ONLY_CURSORS 1 + // For backward compatibility reasons, this parameter now only + // controls the default scrolling method used by cursors. This + // default behavior can be overriden by setting the second param + // of wxDB::GetDbConnection() to indicate whether the connection + // (and any wxTable()s that use the connection) should support + // forward only scrolling of cursors, or both forward and backward + // Support for backward scrolling cursors is dependent on the + // data source as well as the ODBC driver being used. + +#define wxODBC_BACKWARD_COMPATABILITY 0 + // Default is 0. Set to 1 to use the deprecated classes, enum + // types, function, member variables. With a setting of 1, full + // backward compatability with the 2.0.x release is possible. + // It is STRONGLY recommended that this be set to 0, as + // future development will be done only on the non-deprecated + // functions/classes/member variables/etc. diff --git a/include/wx/menu.h b/include/wx/menu.h index c297b599a6..ca2e84ba20 100644 --- a/include/wx/menu.h +++ b/include/wx/menu.h @@ -32,8 +32,8 @@ class WXDLLEXPORT wxMenuBar; class WXDLLEXPORT wxMenuItem; // pseudo template list classes -WX_DECLARE_LIST(wxMenu, wxMenuList); -WX_DECLARE_LIST(wxMenuItem, wxMenuItemList); +WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList); +WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList); // ---------------------------------------------------------------------------- // conditional compilation @@ -102,6 +102,59 @@ public: // insert an item before given position bool Insert(size_t pos, wxMenuItem *item); + void Insert(size_t pos, + int id, + const wxString& text, + const wxString& help = wxEmptyString, + bool isCheckable = FALSE) + { + Insert(pos, wxMenuItem::New((wxMenu *)this, id, text, help, isCheckable)); + } + + // insert a separator + void InsertSeparator(size_t pos) + { + Insert(pos, wxMenuItem::New((wxMenu *)this)); + } + + // insert a submenu + void Insert(size_t pos, + int id, + const wxString& text, + wxMenu *submenu, + const wxString& help = wxEmptyString) + { + Insert(pos, wxMenuItem::New((wxMenu *)this, id, text, help, FALSE, submenu)); + } + + // prepend an item to the menu + void Prepend(wxMenuItem *item) + { + Insert(0u, item); + } + + void Prepend(int id, + const wxString& text, + const wxString& help = wxEmptyString, + bool isCheckable = FALSE) + { + Insert(0u, id, text, help, isCheckable); + } + + // insert a separator + void PrependSeparator() + { + InsertSeparator(0u); + } + + // insert a submenu + void Prepend(int id, + const wxString& text, + wxMenu *submenu, + const wxString& help = wxEmptyString) + { + Insert(0u, id, text, submenu, help); + } // detach an item from the menu, but don't delete it so that it can be // added back later (but if it's not, the caller is responsible for diff --git a/include/wx/module.h b/include/wx/module.h index e15b4de06b..73e913ee1b 100644 --- a/include/wx/module.h +++ b/include/wx/module.h @@ -21,7 +21,7 @@ // declare a linked list of modules class wxModule; -WX_DECLARE_LIST(wxModule, wxModuleList); +WX_DECLARE_EXPORTED_LIST(wxModule, wxModuleList); // declaring a class derived from wxModule will automatically create an // instance of this class on program startup, call its OnInit() method and call diff --git a/include/wx/motif/bitmap.h b/include/wx/motif/bitmap.h index c673a408fa..1af6e40347 100644 --- a/include/wx/motif/bitmap.h +++ b/include/wx/motif/bitmap.h @@ -183,8 +183,8 @@ public: void SetMask(wxMask *mask) ; wxBitmap& operator = (const wxBitmap& bitmap) { if (*this == bitmap) return (*this); Ref(bitmap); return *this; } - bool operator == (const wxBitmap& bitmap) { return m_refData == bitmap.m_refData; } - bool operator != (const wxBitmap& bitmap) { return m_refData != bitmap.m_refData; } + bool operator == (const wxBitmap& bitmap) const { return m_refData == bitmap.m_refData; } + bool operator != (const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; } // Format handling static wxList& GetHandlers() { return sm_handlers; } diff --git a/include/wx/motif/brush.h b/include/wx/motif/brush.h index 15488cba9b..03c23ce98a 100644 --- a/include/wx/motif/brush.h +++ b/include/wx/motif/brush.h @@ -56,8 +56,8 @@ public: virtual void SetStipple(const wxBitmap& stipple) ; inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; } - inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; } - inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; } + inline bool operator == (const wxBrush& brush) const { return m_refData == brush.m_refData; } + inline bool operator != (const wxBrush& brush) const { return m_refData != brush.m_refData; } inline wxColour& GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); }; inline int GetStyle() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); }; diff --git a/include/wx/motif/choice.h b/include/wx/motif/choice.h index 5171d41fe9..df445f9e9b 100644 --- a/include/wx/motif/choice.h +++ b/include/wx/motif/choice.h @@ -96,6 +96,8 @@ protected: WXWidget* m_widgetList ; WXWidget m_formWidget; wxStringList m_stringList; + wxList m_clientList; // contains the client data for the items + virtual void DoSetSize(int x, int y, int width, int height, diff --git a/include/wx/motif/dc.h b/include/wx/motif/dc.h index fb6316232e..5368b113b0 100644 --- a/include/wx/motif/dc.h +++ b/include/wx/motif/dc.h @@ -162,8 +162,6 @@ public: // recompute scale? bool m_needComputeScaleX, m_needComputeScaleY; - // wxPSDC wants to have this. Will disappear. - float m_scaleFactor; }; #endif diff --git a/include/wx/motif/dcmemory.h b/include/wx/motif/dcmemory.h index 51b16b19c9..bde81607ca 100644 --- a/include/wx/motif/dcmemory.h +++ b/include/wx/motif/dcmemory.h @@ -34,7 +34,7 @@ public: wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; } private: - friend wxPaintDC; + friend class wxPaintDC; wxBitmap m_bitmap; }; diff --git a/include/wx/motif/icon.h b/include/wx/motif/icon.h index c79cb7bb11..d1176761c5 100644 --- a/include/wx/motif/icon.h +++ b/include/wx/motif/icon.h @@ -61,8 +61,8 @@ public: { return wxBitmap::LoadFile(name, type); } inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; } - inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; } - inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; } + inline bool operator == (const wxIcon& icon) const { return m_refData == icon.m_refData; } + inline bool operator != (const wxIcon& icon) const { return m_refData != icon.m_refData; } virtual bool Ok() const { return ((m_refData != NULL) && (M_ICONDATA->m_ok)); } }; diff --git a/include/wx/motif/palette.h b/include/wx/motif/palette.h index cf198a273f..b40831a894 100644 --- a/include/wx/motif/palette.h +++ b/include/wx/motif/palette.h @@ -66,8 +66,8 @@ public: virtual bool Ok() const { return (m_refData != NULL) ; } wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; } - bool operator == (const wxPalette& palette) { return m_refData == palette.m_refData; } - bool operator != (const wxPalette& palette) { return m_refData != palette.m_refData; } + bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; } + bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; } // Motif-specific WXColormap GetXColormap(WXDisplay* display = NULL) const; diff --git a/include/wx/motif/pen.h b/include/wx/motif/pen.h index 120d793d89..b0a30769e1 100644 --- a/include/wx/motif/pen.h +++ b/include/wx/motif/pen.h @@ -57,8 +57,8 @@ public: ~wxPen(); inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; } - inline bool operator == (const wxPen& pen) { return m_refData == pen.m_refData; } - inline bool operator != (const wxPen& pen) { return m_refData != pen.m_refData; } + inline bool operator == (const wxPen& pen) const { return m_refData == pen.m_refData; } + inline bool operator != (const wxPen& pen) const { return m_refData != pen.m_refData; } virtual bool Ok() const { return (m_refData != NULL) ; } diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h index cc0989f68b..7b9820cbb0 100644 --- a/include/wx/msw/bitmap.h +++ b/include/wx/msw/bitmap.h @@ -142,8 +142,8 @@ public: wxMask *GetMask() const { return (GetBitmapData() ? GetBitmapData()->m_bitmapMask : (wxMask*) NULL); } void SetMask(wxMask *mask) ; - bool operator==(const wxBitmap& bitmap) { return m_refData == bitmap.m_refData; } - bool operator!=(const wxBitmap& bitmap) { return m_refData != bitmap.m_refData; } + bool operator==(const wxBitmap& bitmap) const { return m_refData == bitmap.m_refData; } + bool operator!=(const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; } #if WXWIN_COMPATIBILITY_2 void SetOk(bool isOk); diff --git a/include/wx/msw/brush.h b/include/wx/msw/brush.h index 05ae288300..1ec1b80b7e 100644 --- a/include/wx/msw/brush.h +++ b/include/wx/msw/brush.h @@ -57,8 +57,8 @@ public: virtual void SetStipple(const wxBitmap& stipple) ; inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; } - inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; } - inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; } + inline bool operator == (const wxBrush& brush) const { return m_refData == brush.m_refData; } + inline bool operator != (const wxBrush& brush) const { return m_refData != brush.m_refData; } inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); }; inline int GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); }; diff --git a/include/wx/msw/choice.h b/include/wx/msw/choice.h index f60a023057..cc00ce00b3 100644 --- a/include/wx/msw/choice.h +++ b/include/wx/msw/choice.h @@ -66,6 +66,8 @@ public: // MSW only virtual bool MSWCommand(WXUINT param, WXWORD id); long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); protected: virtual void DoSetItemClientData( int n, void* clientData ); diff --git a/include/wx/msw/colordlg.h b/include/wx/msw/colordlg.h index 5643ef6f2f..cf93a514ef 100644 --- a/include/wx/msw/colordlg.h +++ b/include/wx/msw/colordlg.h @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: colordlg.h +// Name: wx/msw/colordlg.h // Purpose: wxColourDialog class // Author: Julian Smart // Modified by: // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_COLORDLG_H_ @@ -20,25 +20,37 @@ #include "wx/dialog.h" #include "wx/cmndata.h" -/* - * COLOUR DIALOG - */ +// ---------------------------------------------------------------------------- +// wxColourDialog: dialog for choosing a colours +// ---------------------------------------------------------------------------- -class WXDLLEXPORT wxColourDialog: public wxDialog +class WXDLLEXPORT wxColourDialog : public wxDialog { -DECLARE_DYNAMIC_CLASS(wxColourDialog) public: - wxColourDialog(void); + wxColourDialog(); wxColourDialog(wxWindow *parent, wxColourData *data = NULL); bool Create(wxWindow *parent, wxColourData *data = NULL); - int ShowModal(void); - wxColourData& GetColourData(void) { return m_colourData; } + wxColourData& GetColourData() { return m_colourData; } + + // override some base class virtuals + virtual void SetTitle(const wxString& title); + virtual wxString GetTitle(); + + virtual int ShowModal(); protected: + virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + wxColourData m_colourData; - wxWindow* m_dialogParent; + wxString m_title; + + DECLARE_DYNAMIC_CLASS(wxColourDialog) }; #endif diff --git a/include/wx/msw/combobox.h b/include/wx/msw/combobox.h index 1828e0045a..ab5127be3d 100644 --- a/include/wx/msw/combobox.h +++ b/include/wx/msw/combobox.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: combobox.h +// Name: wx/msw/combobox.h // Purpose: wxComboBox class // Author: Julian Smart // Modified by: @@ -46,14 +46,16 @@ public: Create(parent, id, value, pos, size, n, choices, style, validator, name); } - bool Create(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); // List functions: see wxChoice @@ -75,7 +77,13 @@ public: virtual void SetSelection(long from, long to); virtual void SetEditable(bool editable); + // implementation only from now on virtual bool MSWCommand(WXUINT param, WXWORD id); + bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + + WXHWND GetEditHWND() const; protected: virtual void DoMoveWindow(int x, int y, int width, int height); diff --git a/include/wx/msw/font.h b/include/wx/msw/font.h index 1ab10844bc..f7c564b1e9 100644 --- a/include/wx/msw/font.h +++ b/include/wx/msw/font.h @@ -78,6 +78,11 @@ public: virtual bool RealizeResource(); virtual WXHANDLE GetResourceHandle(); virtual bool FreeResource(bool force = FALSE); + + // for consistency with other wxMSW classes and to have a const + // GetResourceHandle()-like function we have a synonym for it + WXHFONT GetHFONT() const; + /* virtual bool UseResource(); virtual bool ReleaseResource(); diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index f17f7e57df..410081887e 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -149,6 +149,9 @@ protected: static bool m_useNativeStatusBar; #endif // wxUSE_STATUSBAR + // the last focused child: we restore focus to it on activation + wxWindow *m_winLastFocused; + // Data to save/restore when calling ShowFullScreen long m_fsStyle; // Passed to ShowFullScreen wxRect m_fsOldSize; diff --git a/include/wx/msw/helpchm.h b/include/wx/msw/helpchm.h new file mode 100644 index 0000000000..d6db1b92c7 --- /dev/null +++ b/include/wx/msw/helpchm.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: helpchm.h +// Purpose: Help system: MS HTML Help implementation +// Author: Julian Smart +// Modified by: +// Created: 16/04/2000 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPCHM_H_ +#define _WX_HELPCHM_H_ + +#ifdef __GNUG__ +#pragma interface "helpchm.h" +#endif + +#include "wx/wx.h" + +#if wxUSE_HELP + +#include "wx/helpbase.h" + +class WXDLLEXPORT wxCHMHelpController: public wxHelpControllerBase +{ + DECLARE_CLASS(wxCHMHelpController) + +public: + wxCHMHelpController() {} + ~wxCHMHelpController() {} + + // Must call this to set the filename + virtual bool Initialize(const wxString& file); + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString); + virtual bool DisplayContents(); + virtual bool DisplaySection(int sectionNo); + virtual bool DisplaySection(const wxString& section); + virtual bool DisplayBlock(long blockNo); + virtual bool KeywordSearch(const wxString& k); + virtual bool Quit(); + + inline wxString GetHelpFile() const { return m_helpFile; } + +protected: + // Append extension if necessary. + wxString GetValidFilename(const wxString& file) const; + +protected: + wxString m_helpFile; +}; + +#endif // wxUSE_HELP +#endif +// _WX_HELPCHM_H_ diff --git a/include/wx/msw/helpwin.h b/include/wx/msw/helpwin.h index 308439b8b3..c3260a6e38 100644 --- a/include/wx/msw/helpwin.h +++ b/include/wx/msw/helpwin.h @@ -24,31 +24,33 @@ class WXDLLEXPORT wxWinHelpController: public wxHelpControllerBase { - DECLARE_CLASS(wxWinHelpController) + DECLARE_CLASS(wxWinHelpController) + +public: + wxWinHelpController() {}; + ~wxWinHelpController() {}; - public: - wxWinHelpController(void); - ~wxWinHelpController(void); + // Must call this to set the filename + virtual bool Initialize(const wxString& file); - // Must call this to set the filename and server name - virtual bool Initialize(const wxString& file); + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString); + virtual bool DisplayContents(); + virtual bool DisplaySection(int sectionNo); + virtual bool DisplayBlock(long blockNo); + virtual bool KeywordSearch(const wxString& k); + virtual bool Quit(); - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = ""); - virtual bool DisplayContents(void); - virtual bool DisplaySection(int sectionNo); - virtual bool DisplayBlock(long blockNo); - virtual bool KeywordSearch(const wxString& k); - - virtual bool Quit(void); - virtual void OnQuit(void); - - inline wxString GetHelpFile(void) const { return m_helpFile; } + inline wxString GetHelpFile() const { return m_helpFile; } protected: - wxString m_helpFile; + // Append extension if necessary. + wxString GetValidFilename(const wxString& file) const; + +private: + wxString m_helpFile; }; #endif // wxUSE_HELP #endif - // _WX_HELPWIN_H_ +// _WX_HELPWIN_H_ diff --git a/include/wx/msw/imaglist.h b/include/wx/msw/imaglist.h index 153cfd00d1..bef31bd242 100644 --- a/include/wx/msw/imaglist.h +++ b/include/wx/msw/imaglist.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: imaglist.h +// Name: wx/msw/imaglist.h // Purpose: wxImageList class // Author: Julian Smart // Modified by: @@ -49,32 +49,34 @@ enum { // now, the app must take care of ownership issues. That is, the // image lists must be explicitly deleted after the control(s) that uses them // is (are) deleted, or when the app exits. -class WXDLLEXPORT wxImageList: public wxObject +class WXDLLEXPORT wxImageList : public wxObject { - DECLARE_DYNAMIC_CLASS(wxImageList) - public: +public: /* * Public interface */ - wxImageList(void); + wxImageList(); // Creates an image list. // Specify the width and height of the images in the list, // whether there are masks associated with them (e.g. if creating images // from icons), and the initial size of the list. - inline wxImageList(int width, int height, bool mask = TRUE, int initialCount = 1) + wxImageList(int width, int height, bool mask = TRUE, int initialCount = 1) { Create(width, height, mask, initialCount); } - ~wxImageList(void); + ~wxImageList(); // Attributes //////////////////////////////////////////////////////////////////////////// // Returns the number of images in the image list. - int GetImageCount(void) const; + int GetImageCount() const; + + // Returns the size (same for all images) of the images in the list + bool GetSize(int index, int &width, int &height) const; // Operations //////////////////////////////////////////////////////////////////////////// @@ -118,14 +120,15 @@ class WXDLLEXPORT wxImageList: public wxObject bool Remove(int index); // Remove all images - bool RemoveAll(void); + bool RemoveAll(); // Draws the given image on a dc at the specified position. // If 'solidBackground' is TRUE, Draw sets the image list background // colour to the background colour of the wxDC, to speed up // drawing by eliminating masked drawing where possible. bool Draw(int index, wxDC& dc, int x, int y, - int flags = wxIMAGELIST_DRAW_NORMAL, bool solidBackground = FALSE); + int flags = wxIMAGELIST_DRAW_NORMAL, + bool solidBackground = FALSE); // TODO: miscellaneous functionality /* @@ -155,7 +158,7 @@ class WXDLLEXPORT wxImageList: public wxObject bool BeginDrag(int index, const wxPoint& hotSpot); // Ends a drag operation. - bool EndDrag(void); + bool EndDrag(); // Call this function to move the image that is being dragged during a drag-and-drop operation. // This function is typically called in response to a mouse move message. To begin a drag @@ -216,10 +219,12 @@ class WXDLLEXPORT wxImageList: public wxObject //////////////////////////////////////////////////////////////////////////// // Returns the native image list handle - inline WXHIMAGELIST GetHIMAGELIST(void) const { return m_hImageList; } + WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } protected: WXHIMAGELIST m_hImageList; + + DECLARE_DYNAMIC_CLASS(wxImageList) }; #endif diff --git a/include/wx/msw/mdi.h b/include/wx/msw/mdi.h index 319d880da3..385659df1c 100644 --- a/include/wx/msw/mdi.h +++ b/include/wx/msw/mdi.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: mdi.h +// Name: wx/msw/mdi.h // Purpose: MDI (Multiple Document Interface) classes // Author: Julian Smart // Modified by: @@ -121,7 +121,7 @@ private: class WXDLLEXPORT wxMDIChildFrame : public wxFrame { public: - wxMDIChildFrame(); + wxMDIChildFrame() { Init(); } wxMDIChildFrame(wxMDIParentFrame *parent, wxWindowID id, const wxString& title, @@ -130,6 +130,8 @@ public: long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr) { + Init(); + Create(parent, id, title, pos, size, style, name); } @@ -150,8 +152,10 @@ public: virtual void Restore(); virtual void Activate(); - // Handlers + // Implementation only from now on + // ------------------------------- + // Handlers bool HandleMDIActivate(long bActivate, WXHWND, WXHWND); bool HandleWindowPosChanging(void *lpPos); bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); @@ -162,14 +166,22 @@ public: virtual void MSWDestroyWindow(); - // Implementation bool ResetWindowStyle(void *vrect); + void OnIdle(wxIdleEvent& event); + protected: virtual void DoGetPosition(int *x, int *y) const; virtual void DoSetClientSize(int width, int height); virtual void InternalSetMenuBar(); + // common part of all ctors + void Init(); + +private: + bool m_needsResize; // flag which tells us to artificially resize the frame + + DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) }; @@ -179,8 +191,6 @@ protected: class WXDLLEXPORT wxMDIClientWindow : public wxWindow { - DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) - public: wxMDIClientWindow() { Init(); } wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) @@ -207,6 +217,7 @@ protected: private: DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) }; #endif diff --git a/include/wx/msw/notebook.h b/include/wx/msw/notebook.h index 7ac0e7945b..4b95a47eb7 100644 --- a/include/wx/msw/notebook.h +++ b/include/wx/msw/notebook.h @@ -31,7 +31,8 @@ class WXDLLEXPORT wxImageList; class WXDLLEXPORT wxWindow; // array of notebook pages -typedef wxWindow WXDLLEXPORT wxNotebookPage; // so far, any window can be a page +//typedef wxWindow WXDLLEXPORT wxNotebookPage; // so far, any window can be a page +typedef wxWindow wxNotebookPage; // so far, any window can be a page WX_DEFINE_EXPORTED_ARRAY(wxNotebookPage *, wxArrayPages); diff --git a/include/wx/msw/ole/dataobj.h b/include/wx/msw/ole/dataobj.h index dd2d0cf503..41b013a9e8 100644 --- a/include/wx/msw/ole/dataobj.h +++ b/include/wx/msw/ole/dataobj.h @@ -42,7 +42,7 @@ public: #ifdef __WXDEBUG__ // function to return symbolic name of clipboard format (for debug messages) - static const char *GetFormatName(wxDataFormat format); + static const wxChar *GetFormatName(wxDataFormat format); #define wxGetFormatName(format) wxDataObject::GetFormatName(format) #else // !Debug diff --git a/include/wx/msw/ole/dropsrc.h b/include/wx/msw/ole/dropsrc.h index 079514324b..4765f2e6df 100644 --- a/include/wx/msw/ole/dropsrc.h +++ b/include/wx/msw/ole/dropsrc.h @@ -28,6 +28,16 @@ class wxIDropSource; class WXDLLEXPORT wxDataObject; class WXDLLEXPORT wxWindow; +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// this macro may be used instead for wxDropSource ctor arguments: it will use +// the cursor 'name' from the resources under MSW, but will expand to +// something else under GTK. If you don't use it, you will have to use #ifdef +// in the application code. +#define wxDROP_ICON(name) wxCursor(#name) + // ---------------------------------------------------------------------------- // wxDropSource is used to start the drag-&-drop operation on associated // wxDataObject object. It's responsible for giving UI feedback while dragging. diff --git a/include/wx/msw/ole/oleutils.h b/include/wx/msw/ole/oleutils.h index d20c22c17b..98cb02176b 100644 --- a/include/wx/msw/ole/oleutils.h +++ b/include/wx/msw/ole/oleutils.h @@ -85,9 +85,9 @@ bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); #define IMPLEMENT_IUNKNOWN_METHODS(classname) \ STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv) \ { \ - wxLogQueryInterface(#classname, riid); \ + wxLogQueryInterface(_T(#classname), riid); \ \ - if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \ + if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \ *ppv = this; \ AddRef(); \ \ @@ -96,20 +96,20 @@ bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); else { \ *ppv = NULL; \ \ - return (HRESULT) E_NOINTERFACE; \ + return (HRESULT) E_NOINTERFACE; \ } \ } \ \ STDMETHODIMP_(ULONG) classname::AddRef() \ { \ - wxLogAddRef(#classname, m_cRef); \ + wxLogAddRef(_T(#classname), m_cRef); \ \ return ++m_cRef; \ } \ \ STDMETHODIMP_(ULONG) classname::Release() \ { \ - wxLogRelease(#classname, m_cRef); \ + wxLogRelease(_T(#classname), m_cRef); \ \ if ( --m_cRef == 0 ) { \ delete this; \ @@ -132,11 +132,11 @@ bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); // ---------------------------------------------------------------------------- // tries to translate riid into a symbolic name, if possible -void wxLogQueryInterface(const char *szInterface, REFIID riid); +void wxLogQueryInterface(const wxChar *szInterface, REFIID riid); // these functions print out the new value of reference counter -void wxLogAddRef (const char *szInterface, ULONG cRef); -void wxLogRelease(const char *szInterface, ULONG cRef); +void wxLogAddRef (const wxChar *szInterface, ULONG cRef); +void wxLogRelease(const wxChar *szInterface, ULONG cRef); #else //!WXDEBUG #define wxLogQueryInterface(szInterface, riid) diff --git a/include/wx/msw/palette.h b/include/wx/msw/palette.h index 4383c44a3f..3eaa3ac4ef 100644 --- a/include/wx/msw/palette.h +++ b/include/wx/msw/palette.h @@ -49,8 +49,8 @@ public: virtual bool Ok(void) const { return (m_refData != NULL) ; } inline wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; } - inline bool operator == (const wxPalette& palette) { return m_refData == palette.m_refData; } - inline bool operator != (const wxPalette& palette) { return m_refData != palette.m_refData; } + inline bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; } + inline bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; } virtual bool FreeResource(bool force = FALSE); diff --git a/include/wx/msw/pen.h b/include/wx/msw/pen.h index 719140d8cf..1cf0f4266c 100644 --- a/include/wx/msw/pen.h +++ b/include/wx/msw/pen.h @@ -57,8 +57,8 @@ public: ~wxPen(); inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; } - inline bool operator == (const wxPen& pen) { return m_refData == pen.m_refData; } - inline bool operator != (const wxPen& pen) { return m_refData != pen.m_refData; } + inline bool operator == (const wxPen& pen) const { return m_refData == pen.m_refData; } + inline bool operator != (const wxPen& pen) const { return m_refData != pen.m_refData; } virtual bool Ok() const { return (m_refData != NULL) ; } diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 2a27a0287d..8af2cfce9a 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -67,44 +67,17 @@ WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT; // this defines a CASTWNDPROC macro which casts a pointer to the type of a // window proc -#ifdef __GNUWIN32_OLD__ -# define CASTWNDPROC (long unsigned) -#else -# ifdef __BORLANDC__ -# ifdef __WIN32__ -#if __BORLANDC__ > 0x530 - typedef long (__stdcall * WndProcCast)( HWND__*, unsigned int, unsigned int, long) ; +#ifdef __GNUWIN32_OLD__ + #define CASTWNDPROC (long unsigned) #else - typedef int (pascal * WndProcCast) (); -#endif -# define CASTWNDPROC (WndProcCast) -# else - typedef int (pascal * WndProcCast) (); -# define CASTWNDPROC (WndProcCast) -# endif - -# else -# if defined (__WIN32__) && defined(STRICT) - typedef long (_stdcall * WndProcCast) (HWND, unsigned int, unsigned int, long); -# define CASTWNDPROC (WndProcCast) -# elif defined(__WIN16__) -# ifdef __BORLANDC__ - typedef int (pascal * WndProcCast) (); -# define CASTWNDPROC (WndProcCast) -# else -# if defined(__VISUALC__) && defined(STRICT) -# define CASTWNDPROC (WNDPROC) -# else - typedef int (PASCAL * WndProcCast) (); -# define CASTWNDPROC (WndProcCast) -# endif -# endif -# else -# define CASTWNDPROC -# endif -# endif -#endif + #if defined(STRICT) || defined(__GNUC__) + typedef WNDPROC WndProcCast; + #else + typedef FARPROC WndProcCast; + #endif + #define CASTWNDPROC (WndProcCast) +#endif // __GNUWIN32_OLD__ // --------------------------------------------------------------------------- // some stuff for old Windows versions (FIXME: what does it do here??) @@ -182,7 +155,8 @@ WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT; #define DEFAULT_ITEM_HEIGHT 80 // Scale font to get edit control height -#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2) +//#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (3*(cy)/2) +#define EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) (cy+8) // Generic subclass proc, for panel item moving/sizing and intercept // EDIT control VK_RETURN messages @@ -216,6 +190,8 @@ extern LONG APIENTRY _EXPORT #define wxZeroMemory(obj) memset((void*) & obj, 0, sizeof(obj)) #endif +#if wxUSE_GUI + #include <wx/gdicmn.h> // make conversion from wxColour and COLORREF a bit less painful @@ -314,15 +290,15 @@ private: #define GetHcursor() ((HCURSOR)GetHCURSOR()) #define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR()) +#define GetHfont() ((HFONT)GetHFONT()) +#define GetHfontOf(font) ((HFONT)(font).GetHFONT()) + +#endif // wxUSE_GUI + // --------------------------------------------------------------------------- // global data // --------------------------------------------------------------------------- -#if 0 // where is this?? -// The MakeProcInstance version of the function wxSubclassedGenericControlProc -WXDLLEXPORT_DATA(extern FARPROC) wxGenericControlSubClassProc; -#endif // 0 - WXDLLEXPORT_DATA(extern wxChar*) wxBuffer; WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance; @@ -349,6 +325,7 @@ WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd); WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font); WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, const wxFont *font); WXDLLEXPORT wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); +WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int charset); WXDLLEXPORT void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos); WXDLLEXPORT void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos); diff --git a/include/wx/msw/radiobox.h b/include/wx/msw/radiobox.h index 3736dc4dcf..8a98bb0a88 100644 --- a/include/wx/msw/radiobox.h +++ b/include/wx/msw/radiobox.h @@ -81,6 +81,8 @@ public: virtual bool SetFont(const wxFont& font); long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); WXHWND *GetRadioButtons() const { return m_radioButtons; } bool ContainsHWND(WXHWND hWnd) const; void SendNotificationEvent(); diff --git a/include/wx/msw/radiobut.h b/include/wx/msw/radiobut.h index f5bb924c91..b75df13479 100644 --- a/include/wx/msw/radiobut.h +++ b/include/wx/msw/radiobut.h @@ -48,6 +48,9 @@ class WXDLLEXPORT wxRadioButton: public wxControl virtual bool GetValue(void) const ; bool MSWCommand(WXUINT param, WXWORD id); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + void Command(wxCommandEvent& event); }; diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index d2b150d449..2f4fb7f723 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -16,8 +16,11 @@ // global settings // ---------------------------------------------------------------------------- -// define this to 0 when building wxBase library -#define wxUSE_GUI 1 +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI // ---------------------------------------------------------------------------- // compatibility settings @@ -118,6 +121,33 @@ #define wxUSE_ON_FATAL_EXCEPTION 0 #endif +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWindows in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000 (Windows 9x +// doesn't support it and the programs compiled in Unicode mode will not run +// under 9x). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000) +#define wxUSE_UNICODE 0 + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 1 + // ---------------------------------------------------------------------------- // global features // ---------------------------------------------------------------------------- @@ -442,9 +472,10 @@ #define wxUSE_IPC 1 // 0 for no interprocess comms -// Note: wxHELP uses IPC under X so these are interdependent! #define wxUSE_HELP 1 // 0 for no help facility +#define wxUSE_MS_HTML_HELP 0 + // 0 for no MS HTML Help #define wxUSE_RESOURCES 1 // 0 for no wxGetResource/wxWriteResource #define wxUSE_CONSTRAINTS 1 @@ -502,6 +533,14 @@ // Support for backward scrolling cursors is dependent on the // data source as well as the ODBC driver being used. +#define wxODBC_BACKWARD_COMPATABILITY 0 + // Default is 0. Set to 1 to use the deprecated classes, enum + // types, function, member variables. With a setting of 1, full + // backward compatability with the 2.0.x release is possible. + // It is STRONGLY recommended that this be set to 0, as + // future development will be done only on the non-deprecated + // functions/classes/member variables/etc. + // ---------------------------------------------------------------------------- // other compiler (mis)features // ---------------------------------------------------------------------------- @@ -545,8 +584,6 @@ // Windows-only settings // ---------------------------------------------------------------------------- -// Most of the settings in this section are obsolete or not used - // Make settings compatible with MFC #define wxUSE_MFC 0 @@ -557,7 +594,6 @@ #define wxUSE_CTL3D 0 #else // Define 1 to use Microsoft CTL3D library. -// See note above about using FAFA and CTL3D. #define wxUSE_CTL3D 1 #endif @@ -580,6 +616,10 @@ // Define 1 for font size to be backward compatible // to 1.63 and earlier. 1.64 and later define point // sizes to be compatible with Windows. +#define wxDIALOG_UNIT_COMPATIBILITY 0 + // Set to 0 for accurate dialog units, else + // 1 to be as per 2.1.16 and before. If migrating + // between versions, your dialogs may seem to shrink. #define wxUSE_PENWINDOWS 0 // Set to 1 to use PenWindows @@ -596,8 +636,8 @@ // disable the settings which don't work for some compilers // ---------------------------------------------------------------------------- -// These don't work as expected for mingw32 and cygwin32 #if defined(__GNUWIN32__) +// These don't work as expected for mingw32 and cygwin32 #undef wxUSE_MEMORY_TRACING #define wxUSE_MEMORY_TRACING 0 @@ -606,8 +646,18 @@ #undef wxUSE_DEBUG_NEW_ALWAYS #define wxUSE_DEBUG_NEW_ALWAYS 0 + +#undef wxUSE_MS_HTML_HELP +#define wxUSE_MS_HTML_HELP 0 + #endif // __GNUWIN32__ +// Cygwin b20 doesn't have wcslen +#if defined(__GNUWIN32__) && !defined(__MINGW32__) +#undef wxUSE_WCHAR_T +#define wxUSE_WCHAR_T 0 +#endif + // MFC duplicates these operators #if wxUSE_MFC #undef wxUSE_GLOBAL_MEMORY_OPERATORS @@ -617,6 +667,12 @@ #define wxUSE_DEBUG_NEW_ALWAYS 0 #endif // wxUSE_MFC +// ODBC classes aren't Unicode-compatible yet +#if wxUSE_UNICODE +#undef wxUSE_ODBC +#define wxUSE_ODBC 0 +#endif + #if (!defined(WIN32) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) // Can't use OLE drag and drop in Windows 3.1 because we don't know how // to implement UUIDs @@ -631,6 +687,11 @@ #define wxUSE_NATIVE_STATUSBAR 0 #endif +#if !wxUSE_OWNER_DRAWN +#undef wxUSE_CHECKLISTBOX +#define wxUSE_CHECKLISTBOX 0 +#endif + // Salford C++ doesn't like some of the memory operator definitions #ifdef __SALFORDC__ #undef wxUSE_MEMORY_TRACING @@ -647,7 +708,7 @@ #undef wxUSE_OWNER_DRAWN #define wxUSE_OWNER_DRAWN 0 -#endif +#endif // __SALFORDC__ #ifdef __TWIN32__ @@ -657,7 +718,7 @@ #undef wxUSE_ODBC #define wxUSE_ODBC 0 -#endif +#endif // __TWIN32__ // BC++/Win16 can't cope with the amount of data in resource.cpp #if defined(__WIN16__) && defined(__BORLANDC__) @@ -677,15 +738,29 @@ #define wxUSE_LIBJPEG 0 #endif -#if defined(__WXMSW__) && defined(__WATCOMC__) -#undef wxUSE_LIBJPEG -#define wxUSE_LIBJPEG 0 +#if defined(__BORLANDC__) +// Need a BC++-specific htmlhelp.lib before we can enable this +#undef wxUSE_MS_HTML_HELP +#define wxUSE_MS_HTML_HELP 0 +#endif -#undef wxUSE_LIBTIFF -#define wxUSE_LIBTIFF 0 +// wxUSE_DBEUG_NEW_ALWAYS = 1 not compatible with BC++ in DLL mode +#if defined(__BORLANDC__) && (defined(WXMAKINGDLL) || defined(WXUSINGDLL)) +#undef wxUSE_DEBUG_NEW_ALWAYS +#define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif +#if defined(__WXMSW__) && defined(__WATCOMC__) +/* #undef wxUSE_GLCANVAS #define wxUSE_GLCANVAS 0 +*/ + +#undef wxUSE_MS_HTML_HELP +#define wxUSE_MS_HTML_HELP 0 + +#undef wxUSE_WCHAR_T +#define wxUSE_WCHAR_T 0 #endif #if defined(__WXMSW__) && !defined(__WIN32__) @@ -726,7 +801,37 @@ #undef wxUSE_GLCANVAS #define wxUSE_GLCANVAS 0 +#undef wxUSE_MS_HTML_HELP +#define wxUSE_MS_HTML_HELP 0 + +#undef wxUSE_WCHAR_T +#define wxUSE_WCHAR_T 0 + +#endif // Win16 + +// ---------------------------------------------------------------------------- +// check the settings consistency: do it here to abort compilation immediately +// and not almost in the very end when the relevant file fails to compile and +// you need to modify setup.h and rebuild everything +// ---------------------------------------------------------------------------- + +#if wxUSE_TIMEDATE && !wxUSE_LONGLONG + #error wxDateTime requires wxLongLong #endif +#if wxUSE_TEXTFILE && !wxUSE_FILE + #error You cannot compile wxTextFile without wxFile +#endif + +#if wxUSE_FILESYSTEM && !wxUSE_STREAMS + #error You cannot compile virtual file systems without wxUSE_STREAMS +#endif + +#if wxUSE_HTML && !wxUSE_FILESYSTEM + #error You cannot compile wxHTML without virtual file systems +#endif + +// add more tests here... + #endif // _WX_SETUP_H_ diff --git a/include/wx/msw/spinctrl.h b/include/wx/msw/spinctrl.h index 9a160ff7aa..243e7b6833 100644 --- a/include/wx/msw/spinctrl.h +++ b/include/wx/msw/spinctrl.h @@ -1,4 +1,4 @@ -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////// // Name: msw/spinctrl.h // Purpose: wxSpinCtrl class declaration for Win32 // Author: Vadim Zeitlin @@ -57,6 +57,8 @@ public: // implementation only from now on // ------------------------------- + virtual ~wxSpinCtrl(); + virtual void SetValue(int val) { wxSpinButton::SetValue(val); } virtual int GetValue() const; virtual bool SetFont(const wxFont &font); @@ -65,16 +67,23 @@ public: virtual bool Enable(bool enable = TRUE); virtual bool Show(bool show = TRUE); - virtual bool AcceptsFocus() const { return TRUE; } + // wxSpinButton doesn't accept focus, but we do + virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); } + + WXFARPROC GetBuddyWndProc() const { return m_oldBuddyWndProc; } protected: + virtual void DoGetPosition(int *x, int *y) const; virtual void DoMoveWindow(int x, int y, int width, int height); virtual wxSize DoGetBestSize() const; + virtual void DoGetSize(int *width, int *height) const; // the handler for wxSpinButton events void OnSpinChange(wxSpinEvent& event); - WXHWND m_hwndBuddy; + // the data for the "buddy" text ctrl + WXHWND m_hwndBuddy; + WXFARPROC m_oldBuddyWndProc; private: DECLARE_DYNAMIC_CLASS(wxSpinCtrl) diff --git a/include/wx/msw/textctrl.h b/include/wx/msw/textctrl.h index 732a38ebe8..f233ee08f6 100644 --- a/include/wx/msw/textctrl.h +++ b/include/wx/msw/textctrl.h @@ -115,10 +115,23 @@ public: virtual void Command(wxCommandEvent& event); virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + + // In WIN16, need to override normal erasing because + // Ctl3D doesn't use the wxWindows background colour. +#ifdef __WIN16__ + void OnEraseBackground(wxEraseEvent& event); +#endif #if wxUSE_RICHEDIT bool IsRich() const { return m_isRich; } void SetRichEdit(bool isRich) { m_isRich = isRich; } + + // rich edit controls are not compatible with normal ones and wem ust set + // the colours for them otherwise + virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour); #endif // wxUSE_RICHEDIT virtual void AdoptAttributesFromHWND(); diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 20f6cbb2aa..72126d5668 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -161,6 +161,10 @@ public: wxWindow* GetWindowChild1(wxWindowID id); wxWindow* GetWindowChild(wxWindowID id); + // a MSW only function which sends a size event to the window using its + // current size - this has an effect of refreshing the window layout + void SendSizeEvent(); + // implementation from now on // -------------------------- diff --git a/include/wx/msw/winundef.h b/include/wx/msw/winundef.h index e580f24650..7a078f9a76 100644 --- a/include/wx/msw/winundef.h +++ b/include/wx/msw/winundef.h @@ -177,27 +177,33 @@ #ifdef LoadLibrary #undef LoadLibrary - inline HINSTANCE LoadLibrary(LPCTSTR lpLibFileName) - { #ifdef _UNICODE + inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName) + { return LoadLibraryW(lpLibFileName); + } #else + inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName) + { return LoadLibraryA(lpLibFileName); - #endif } + #endif #endif // FindResource #ifdef FindResource #undef FindResource - inline HRSRC FindResource(HMODULE hModule, LPCTSTR lpName, LPCTSTR lpType) - { #ifdef _UNICODE + inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType) + { return FindResourceW(hModule, lpName, lpType); + } #else + inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType) + { return FindResourceA(hModule, lpName, lpType); - #endif } + #endif #endif // IsMaximized diff --git a/include/wx/object.h b/include/wx/object.h index f444b6786e..3ce6e27bc3 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -170,6 +170,21 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \ ? (className *)(obj) \ : (className *)0) +#define wxConstCast(obj, className) ((className *)(obj)) + +#ifdef __WXDEBUG__ + inline void wxCheckCast(void *ptr) + { + wxASSERT_MSG( ptr, _T("wxStaticCast() used incorrectly") ); + } + + #define wxStaticCast(obj, className) \ + (wxCheckCast(wxDynamicCast(obj, className)), ((className *)(obj))) + +#else // !Debug + #define wxStaticCast(obj, className) ((className *)(obj)) +#endif // Debug/!Debug + // Unfortunately Borland seems to need this include. #ifdef __BORLANDC__ #if wxUSE_IOSTREAMH @@ -203,7 +218,7 @@ class WXDLLEXPORT wxObject // VC++ 6.0 #if defined(__VISUALC__) && (__VISUALC__ >= 1200) - void operator delete(void *buf, char*, int); + void operator delete(void *buf, wxChar*, int); #endif // Causes problems for VC++ diff --git a/include/wx/os2/accel.h b/include/wx/os2/accel.h index 49730d5d9b..226e0320bc 100644 --- a/include/wx/os2/accel.h +++ b/include/wx/os2/accel.h @@ -53,28 +53,32 @@ class WXDLLEXPORT wxAcceleratorTable: public wxObject DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) public: wxAcceleratorTable(); - wxAcceleratorTable(const wxString& resource); // Load from .rc resource - wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array + wxAcceleratorTable(const wxString& rsResource); // Load from .rc resource + wxAcceleratorTable( int n + ,wxAcceleratorEntry vaEntries[] + ); // Load from array // Copy constructors - inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); } - inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); } + inline wxAcceleratorTable(const wxAcceleratorTable& rAccel) { Ref(rAccel); } + inline wxAcceleratorTable(const wxAcceleratorTable* pAccel) { if (pAccel) Ref(*pAccel); } ~wxAcceleratorTable(); - inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) - { if (*this == accel) return (*this); Ref(accel); return *this; }; - inline bool operator == (const wxAcceleratorTable& accel) - { return m_refData == accel.m_refData; }; - inline bool operator != (const wxAcceleratorTable& accel) - { return m_refData != accel.m_refData; }; + inline wxAcceleratorTable& operator = (const wxAcceleratorTable& rAccel) + { if (*this == rAccel) return (*this); Ref(rAccel); return *this; }; + inline bool operator == (const wxAcceleratorTable& rAccel) + { return m_refData == rAccel.m_refData; }; + inline bool operator != (const wxAcceleratorTable& rAccel) + { return m_refData != rAccel.m_refData; }; bool Ok() const; void SetHACCEL(WXHACCEL hAccel); - WXHACCEL GetHACCEL() const; + WXHACCEL GetHACCEL(void) const; // translate the accelerator, return TRUE if done - bool Translate(wxWindow *window, WXMSG *msg) const; + bool Translate( WXHWND hWnd + ,WXMSG* pMsg + ) const; }; WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable; diff --git a/include/wx/os2/dc.h b/include/wx/os2/dc.h index 2df64604bc..d54d3f4488 100644 --- a/include/wx/os2/dc.h +++ b/include/wx/os2/dc.h @@ -78,148 +78,253 @@ public: // implement base class pure virtuals // ---------------------------------- - virtual void Clear(); - - virtual bool StartDoc(const wxString& message); - virtual void EndDoc(); - - virtual void StartPage(); - virtual void EndPage(); - - virtual void SetFont(const wxFont& font); - virtual void SetPen(const wxPen& pen); - virtual void SetBrush(const wxBrush& brush); - virtual void SetBackground(const wxBrush& brush); - virtual void SetBackgroundMode(int mode); - virtual void SetPalette(const wxPalette& palette); - - virtual void DestroyClippingRegion(); - - virtual wxCoord GetCharHeight() const; - virtual wxCoord GetCharWidth() const; - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const; - - virtual bool CanDrawBitmap() const; - virtual bool CanGetTextExtent() const; - virtual int GetDepth() const; - virtual wxSize GetPPI() const; - - virtual void SetMapMode(int mode); - virtual void SetUserScale(double x, double y); - virtual void SetSystemScale(double x, double y); - virtual void SetLogicalScale(double x, double y); - virtual void SetLogicalOrigin(wxCoord x, wxCoord y); - virtual void SetDeviceOrigin(wxCoord x, wxCoord y); - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); - virtual void SetLogicalFunction(int function); + virtual void Clear(void); + + virtual bool StartDoc(const wxString& rsMessage); + virtual void EndDoc(void); + + virtual void StartPage(void); + virtual void EndPage(void); + + virtual void SetFont(const wxFont& rFont); + virtual void SetPen(const wxPen& rPen); + virtual void SetBrush(const wxBrush& rBrush); + virtual void SetBackground(const wxBrush& rBrush); + virtual void SetBackgroundMode(int nMode); + virtual void SetPalette(const wxPalette& rPalette); + + virtual void DestroyClippingRegion(void); + + virtual wxCoord GetCharHeight(void) const; + virtual wxCoord GetCharWidth(void) const; + virtual void DoGetTextExtent( const wxString& rsString + ,wxCoord* pX + ,wxCoord* pY + ,wxCoord* pDescent = NULL + ,wxCoord* pExternalLeading = NULL + ,wxFont* pTheFont = NULL + ) const; + virtual bool CanDrawBitmap(void) const; + virtual bool CanGetTextExtent(void) const; + virtual int GetDepth(void) const; + virtual wxSize GetPPI(void) const; + + virtual void SetMapMode(int nMode); + virtual void SetUserScale( double dX + ,double dY + ); + virtual void SetSystemScale( double dX + ,double dY + ); + virtual void SetLogicalScale( double dX + ,double dY + ); + virtual void SetLogicalOrigin( wxCoord vX + ,wxCoord vY + ); + virtual void SetDeviceOrigin( wxCoord vX + ,wxCoord vY + ); + virtual void SetAxisOrientation( bool bXLeftRight + ,bool bYBottomUp + ); + virtual void SetLogicalFunction(int nFunction); // implementation from now on // -------------------------- - virtual void SetRop(WXHDC cdc); - virtual void DoClipping(WXHDC cdc); - virtual void SelectOldObjects(WXHDC dc); + virtual void SetRop(WXHDC hCdc); + virtual void SelectOldObjects(WXHDC hDc); - wxWindow *GetWindow() const { return m_canvas; } - void SetWindow(wxWindow *win) { m_canvas = win; } + wxWindow* GetWindow(void) const { return m_pCanvas; } + void SetWindow(wxWindow* pWin) { m_pCanvas = pWin; } - WXHDC GetHDC() const { return m_hDC; } - void SetHDC(WXHDC dc, bool bOwnsDC = FALSE) + WXHDC GetHDC(void) const { return m_hDC; } + void SetHDC( WXHDC hDc + ,bool bOwnsDC = FALSE + ) { - m_hDC = dc; + m_hDC = hDc; m_bOwnsDC = bOwnsDC; } + const wxBitmap& GetSelectedBitmap(void) const { return m_vSelectedBitmap; } + wxBitmap& GetSelectedBitmap(void) { return m_vSelectedBitmap; } + protected: - virtual void DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE); - - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; - - virtual void DoDrawPoint(wxCoord x, wxCoord y); - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - - virtual void DoDrawArc(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc); - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea); - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double radius); - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - - virtual void DoCrossHair(wxCoord x, wxCoord y); - - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = FALSE); - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); - virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, - double angle); - - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = FALSE); - - // this is gnarly - we can't even call this function DoSetClippingRegion() - // because of virtual function hiding - virtual void DoSetClippingRegionAsRegion(const wxRegion& region); - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y, - wxCoord *width, wxCoord *height) + virtual void DoFloodFill( wxCoord vX + ,wxCoord vY + ,const wxColour& rCol + ,int nStyle = wxFLOOD_SURFACE + ); + + virtual bool DoGetPixel( wxCoord vX + ,wxCoord vY + ,wxColour* pCol + ) const; + + virtual void DoDrawPoint( wxCoord vX + ,wxCoord vY + ); + virtual void DoDrawLine( wxCoord vX1 + ,wxCoord vY1 + ,wxCoord vX2 + ,wxCoord vY2 + ); + + virtual void DoDrawArc( wxCoord vX1 + ,wxCoord vY1 + ,wxCoord vX2 + ,wxCoord vY2 + ,wxCoord vXc + ,wxCoord vYc + ); + virtual void DoDrawCheckMark( wxCoord vX + ,wxCoord vY + ,wxCoord vWidth + ,wxCoord vHeight + ); + virtual void DoDrawEllipticArc( wxCoord vX + ,wxCoord vY + ,wxCoord vW + ,wxCoord vH + ,double dSa + ,double dEa + ); + + virtual void DoDrawRectangle( wxCoord vX + ,wxCoord vY + ,wxCoord vWidth + ,wxCoord vHeight + ); + virtual void DoDrawRoundedRectangle( wxCoord vX + ,wxCoord vY + ,wxCoord vWidth + ,wxCoord vHeight + ,double dRadius + ); + virtual void DoDrawEllipse( wxCoord vX + ,wxCoord vY + ,wxCoord vWidth + ,wxCoord vHeight + ); + + virtual void DoCrossHair( wxCoord vX + ,wxCoord vY + ); + + virtual void DoDrawIcon( const wxIcon& rIcon + ,wxCoord vX + ,wxCoord vY + ); + virtual void DoDrawBitmap( const wxBitmap& rBmp + ,wxCoord vX + ,wxCoord vY + ,bool bUseMask = FALSE + ); + + virtual void DoDrawText( const wxString& rsText + ,wxCoord vX + ,wxCoord vY + ); + virtual void DoDrawRotatedText( const wxString& rsText + ,wxCoord vX + ,wxCoord vY + ,double dAngle + ); + + virtual bool DoBlit( wxCoord vXdest + ,wxCoord vYdest + ,wxCoord vWidth + ,wxCoord vHeight + ,wxDC* pSource + ,wxCoord vXsrc + ,wxCoord vYsrc + ,int nRop = wxCOPY + ,bool bUseMask = FALSE + ); + + virtual void DoSetClippingRegionAsRegion(const wxRegion& rRegion); + virtual void DoSetClippingRegion( wxCoord vX + ,wxCoord vY + ,wxCoord vWidth + ,wxCoord vHeight + ); + virtual void DoGetClippingRegion( wxCoord* pX + ,wxCoord* pY + ,wxCoord* pWidth + ,wxCoord* pHeight) { - GetClippingBox(x, y, width, height); + GetClippingBox( pX + ,pY + ,pWidth + ,pHeight + ); } - virtual void DoGetSize(int *width, int *height) const; - virtual void DoGetSizeMM(int* width, int* height) const; - - virtual void DoDrawLines(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset); - virtual void DoDrawPolygon(int n, wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE); + virtual void DoGetSize( int* pWidth + ,int* pHeight + ) const; + virtual void DoGetSizeMM( int* pWidth + ,int* pHeight + ) const; + + virtual void DoDrawLines( int n + ,wxPoint vaPoints[] + ,wxCoord vXoffset + ,wxCoord yYoffset + ); + virtual void DoDrawPolygon( int n + ,wxPoint vaPoints[] + ,wxCoord vXoffset + ,wxCoord vYoffset + ,int nFillStyle = wxODDEVEN_RULE + ); #if wxUSE_SPLINES - virtual void DoDrawSpline(wxList *points); + virtual void DoDrawSpline(wxList* pPoints); #endif // wxUSE_SPLINES - // OS2-specific member variables - int m_windowExtX; - int m_windowExtY; + // + // common part of DoDrawText() and DoDrawRotatedText() + // + void DrawAnyText( const wxString& rsText + ,wxCoord vX + ,wxCoord vY + ); - // the window associated with this DC (may be NULL) - wxWindow *m_canvas; + // OS2-specific member variables ?? do we even need this under OS/2? + int m_nWindowExtX; + int m_nWindowExtY; - wxBitmap m_selectedBitmap; + // + // the window associated with this DC (may be NULL) + // + wxWindow* m_pCanvas; + wxBitmap m_vSelectedBitmap; + // // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it - bool m_bOwnsDC:1; + // + bool m_bOwnsDC:1; + // // our HDC and its usage count: we only free it when the usage count drops // to 0 - WXHDC m_hDC; - int m_hDCCount; + // + WXHDC m_hDC; + int m_nDCCount; + // // Store all old GDI objects when do a SelectObject, so we can select them // back in (this unselecting user's objects) so we can safely delete the // DC. - WXHBITMAP m_oldBitmap; - WXHPEN m_oldPen; - WXHBRUSH m_oldBrush; - WXHFONT m_oldFont; - WXHPALETTE m_oldPalette; - - float m_scaleFactor; // wxPSDC wants to have this. Will disappear. + // + WXHBITMAP m_hOldBitmap; + WXHPEN m_hOldPen; + WXHBRUSH m_hOldBrush; + WXHFONT m_hOldFont; + WXHPALETTE m_hOldPalette; }; #endif // _WX_DC_H_ diff --git a/include/wx/os2/filedlg.h b/include/wx/os2/filedlg.h index 134f26b77a..d1b17552db 100644 --- a/include/wx/os2/filedlg.h +++ b/include/wx/os2/filedlg.h @@ -39,8 +39,11 @@ public: inline wxString GetMessage() const { return m_message; } inline wxString GetPath() const { return m_path; } + inline void GetPaths(wxArrayString& a) { a.Empty(); a.Add(m_path); } inline wxString GetDirectory() const { return m_dir; } inline wxString GetFilename() const { return m_fileName; } + inline void GetFilenames(wxArrayString& a) { a.Empty(); + a.Add( m_fileName); } inline wxString GetWildcard() const { return m_wildCard; } inline long GetStyle() const { return m_dialogStyle; } inline int GetFilterIndex() const { return m_filterIndex ; } diff --git a/include/wx/os2/frame.h b/include/wx/os2/frame.h index bd3da1f994..94fe07be61 100644 --- a/include/wx/os2/frame.h +++ b/include/wx/os2/frame.h @@ -102,6 +102,7 @@ public: #endif // wxUSE_STATUSBAR WXHMENU GetWinMenu() const { return m_hMenu; } + WXHWND GetFrame() const { return m_hFrame; } // Returns the origin of client area (may be different from (0,0) if the // frame has a toolbar) @@ -217,7 +218,7 @@ private: WXHWND m_hVScroll; // - // Swp structures for various client data + // Swp structures for various client data // DW: Better off in attached RefData? // SWP m_vSwp; diff --git a/include/wx/os2/helpwin.h b/include/wx/os2/helpwin.h index 4b52caf81b..ab87cf1f5b 100644 --- a/include/wx/os2/helpwin.h +++ b/include/wx/os2/helpwin.h @@ -42,8 +42,9 @@ class WXDLLEXPORT wxWinHelpController: public wxHelpControllerBase protected: wxString m_helpFile; private: - // virtual function hiding supression :: do not use - bool Initialize(const wxString& file, int WXUNUSED(server) ) { return(Initialize(file)); } + // virtual function hiding supression :: do not use + bool Initialize(const wxString& rFile, int WXUNUSED(nServer) ) { return(Initialize(rFile)); } + bool DisplaySection(const wxString& rSection) { return wxHelpControllerBase::DisplaySection(rSection); } }; #endif diff --git a/include/wx/os2/menu.h b/include/wx/os2/menu.h index 948351c469..7b05ee3297 100644 --- a/include/wx/os2/menu.h +++ b/include/wx/os2/menu.h @@ -154,6 +154,11 @@ private: // WXHMENU m_hMenu; + // + // The helper variable for creating unique IDs. + // + static USHORT m_nextMenuId; + #if wxUSE_ACCEL // // The accelerators for our menu items diff --git a/include/wx/os2/msgdlg.h b/include/wx/os2/msgdlg.h index 0855e17f81..af7a32d046 100644 --- a/include/wx/os2/msgdlg.h +++ b/include/wx/os2/msgdlg.h @@ -22,25 +22,34 @@ WXDLLEXPORT_DATA(extern const char*) wxMessageBoxCaptionStr; -class WXDLLEXPORT wxMessageDialog: public wxDialog +class WXDLLEXPORT wxMessageDialog : public wxDialog { DECLARE_DYNAMIC_CLASS(wxMessageDialog) -protected: - wxString m_caption; - wxString m_message; - long m_dialogStyle; - wxWindow * m_parent; public: - wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); - - int ShowModal(); -}; + wxMessageDialog( wxWindow* pParent + ,const wxString& rsMessage + ,const wxString& rsCaption = wxMessageBoxCaptionStr + ,long lStyle = wxOK|wxCENTRE + ,const wxPoint& rPos = wxDefaultPosition + ); + int ShowModal(void); -int WXDLLEXPORT wxMessageBox(const wxString& message, const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK|wxCENTRE, - wxWindow *parent = NULL, int x = -1, int y = -1); +protected: + wxString m_sCaption; + wxString m_sMessage; + long m_lDialogStyle; + wxWindow* m_pParent; +}; // end of CLASS wxMessageDialog + + +int WXDLLEXPORT wxMessageBox( const wxString& rsMessage + ,const wxString& rsCaption = wxMessageBoxCaptionStr + ,long lStyle = wxOK|wxCENTRE + ,wxWindow* pParent = NULL + ,int nX = -1 + ,int nY = -1 + ); #endif // _WX_MSGBOXDLG_H_ diff --git a/include/wx/os2/private.h b/include/wx/os2/private.h index 2dd674aeed..1c83c9da7e 100644 --- a/include/wx/os2/private.h +++ b/include/wx/os2/private.h @@ -18,6 +18,7 @@ #define INCL_PM #define INCL_GPI #define INCL_WINSYS +#define INCL_SHLERRORS #include <os2.h> class WXDLLEXPORT wxFont; diff --git a/include/wx/os2/setup.h b/include/wx/os2/setup.h index 8ac9024a09..c3af84e11c 100644 --- a/include/wx/os2/setup.h +++ b/include/wx/os2/setup.h @@ -149,7 +149,11 @@ // since you may well need to output // an error log in a production // version (or non-debugging beta) +#if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ) +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 +#else #define wxUSE_GLOBAL_MEMORY_OPERATORS 1 +#endif // In debug mode, cause new and delete to be redefined globally. // If this causes problems (e.g. link errors), set this to 0. @@ -167,13 +171,23 @@ #define wxUSE_ODBC 1 // Define 1 to use ODBC classes -#define wxODBC_FWD_ONLY_CURSORS 1 - // Some databases/ODBC drivers only allow forward scrolling cursors. - // Unless you specifically want to use backward scrolling - // cursors, and you know that all of the databases/ODBC drivers - // that you will use these odbc classes with allow backward - // scrolling cursors, this setting should remain set to 1 - // for maximum database/driver compatibilty +#define wxODBC_FWD_ONLY_CURSORS 1 + // For backward compatibility reasons, this parameter now only + // controls the default scrolling method used by cursors. This + // default behavior can be overriden by setting the second param + // of wxDB::GetDbConnection() to indicate whether the connection + // (and any wxTable()s that use the connection) should support + // forward only scrolling of cursors, or both forward and backward + // Support for backward scrolling cursors is dependent on the + // data source as well as the ODBC driver being used. + +#define wxODBC_BACKWARD_COMPATABILITY 0 + // Default is 0. Set to 1 to use the deprecated classes, enum + // types, function, member variables. With a setting of 1, full + // backward compatability with the 2.0.x release is possible. + // It is STRONGLY recommended that this be set to 0, as + // future development will be done only on the non-deprecated + // functions/classes/member variables/etc. #define wxUSE_IOSTREAMH 1 // VC++ 4.2 and above allows <iostream> and <iostream.h> diff --git a/include/wx/os2/setup0.h b/include/wx/os2/setup0.h index 8ac9024a09..c3af84e11c 100644 --- a/include/wx/os2/setup0.h +++ b/include/wx/os2/setup0.h @@ -149,7 +149,11 @@ // since you may well need to output // an error log in a production // version (or non-debugging beta) +#if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ) +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 +#else #define wxUSE_GLOBAL_MEMORY_OPERATORS 1 +#endif // In debug mode, cause new and delete to be redefined globally. // If this causes problems (e.g. link errors), set this to 0. @@ -167,13 +171,23 @@ #define wxUSE_ODBC 1 // Define 1 to use ODBC classes -#define wxODBC_FWD_ONLY_CURSORS 1 - // Some databases/ODBC drivers only allow forward scrolling cursors. - // Unless you specifically want to use backward scrolling - // cursors, and you know that all of the databases/ODBC drivers - // that you will use these odbc classes with allow backward - // scrolling cursors, this setting should remain set to 1 - // for maximum database/driver compatibilty +#define wxODBC_FWD_ONLY_CURSORS 1 + // For backward compatibility reasons, this parameter now only + // controls the default scrolling method used by cursors. This + // default behavior can be overriden by setting the second param + // of wxDB::GetDbConnection() to indicate whether the connection + // (and any wxTable()s that use the connection) should support + // forward only scrolling of cursors, or both forward and backward + // Support for backward scrolling cursors is dependent on the + // data source as well as the ODBC driver being used. + +#define wxODBC_BACKWARD_COMPATABILITY 0 + // Default is 0. Set to 1 to use the deprecated classes, enum + // types, function, member variables. With a setting of 1, full + // backward compatability with the 2.0.x release is possible. + // It is STRONGLY recommended that this be set to 0, as + // future development will be done only on the non-deprecated + // functions/classes/member variables/etc. #define wxUSE_IOSTREAMH 1 // VC++ 4.2 and above allows <iostream> and <iostream.h> diff --git a/include/wx/paper.h b/include/wx/paper.h index 1d9a7bb750..f81b155079 100644 --- a/include/wx/paper.h +++ b/include/wx/paper.h @@ -19,6 +19,7 @@ #include "wx/defs.h" #include "wx/event.h" #include "wx/cmndata.h" +#include "wx/intl.h" /* * Paper type: see defs.h for wxPaperSize enum. @@ -40,7 +41,7 @@ public: // platformId is a platform-specific id, such as in Windows, DMPAPER_... wxPrintPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h); - inline const wxString& GetName() const { return m_paperName; } + inline wxString GetName() const { return wxGetTranslation(m_paperName); } inline wxPaperSize GetId() const { return m_paperId; } inline int GetPlatformId() const { return m_platformId; } diff --git a/include/wx/prntbase.h b/include/wx/prntbase.h index f323f25e85..1533a3d526 100644 --- a/include/wx/prntbase.h +++ b/include/wx/prntbase.h @@ -38,6 +38,15 @@ class WXDLLEXPORT wxPreviewCanvas; class WXDLLEXPORT wxPreviewControlBar; class WXDLLEXPORT wxPreviewFrame; + +enum wxPrinterError +{ + wxPRINTER_NO_ERROR = 0, + wxPRINTER_CANCELLED, + wxPRINTER_ERROR +}; + + /* * Represents the printer: manages printing a wxPrintout object */ @@ -56,6 +65,8 @@ public: wxPrintDialogData& GetPrintDialogData() const { return (wxPrintDialogData&) m_printDialogData; } bool GetAbort() const { return sm_abortIt; } + + static wxPrinterError GetLastError() { return sm_lastError; } /////////////////////////////////////////////////////////////////////////// // OVERRIDES @@ -67,6 +78,9 @@ public: protected: wxPrintDialogData m_printDialogData; wxPrintout* m_currentPrintout; + + static wxPrinterError sm_lastError; + public: static wxWindow* sm_abortWindow; static bool sm_abortIt; diff --git a/include/wx/process.h b/include/wx/process.h index f88b6a85c7..ea2fc303d8 100644 --- a/include/wx/process.h +++ b/include/wx/process.h @@ -19,7 +19,10 @@ #include "wx/defs.h" #include "wx/object.h" #include "wx/event.h" + +#if wxUSE_STREAMS #include "wx/stream.h" +#endif // Process Event handling class WXDLLEXPORT wxProcessEvent : public wxEvent @@ -72,20 +75,31 @@ public: // before the process it started terminates void Detach(); +#if wxUSE_STREAMS // Pipe handling wxInputStream *GetInputStream() const { return m_inputStream; } + wxInputStream *GetErrorStream() const { return m_errorStream; } wxOutputStream *GetOutputStream() const { return m_outputStream; } + // close the output stream indicating that nothing more will be written + void CloseOutput() { delete m_outputStream; m_outputStream = NULL; } + // implementation only (for wxExecute) - void SetPipeStreams(wxInputStream *inStream, wxOutputStream *outStream); + void SetPipeStreams(wxInputStream *inStream, + wxOutputStream *outStream, + wxInputStream *errStream); +#endif // wxUSE_STREAMS protected: void Init(wxEvtHandler *parent, int id, bool redirect); int m_id; - wxInputStream *m_inputStream; +#if wxUSE_STREAMS + wxInputStream *m_inputStream, + *m_errorStream; wxOutputStream *m_outputStream; +#endif // wxUSE_STREAMS bool m_redirect; }; diff --git a/include/wx/propform.h b/include/wx/propform.h index 120b0a1bf2..3b3b1ad859 100644 --- a/include/wx/propform.h +++ b/include/wx/propform.h @@ -236,23 +236,27 @@ class WXDLLEXPORT wxStringFormValidator: public wxPropertyFormValidator class WXDLLEXPORT wxPropertyFormDialog: public wxDialog { - DECLARE_CLASS(wxPropertyFormDialog) - public: - wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"); +public: + wxPropertyFormDialog(wxPropertyFormView *v = NULL, + wxWindow *parent = NULL, + const wxString& title = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = _T("dialogBox")); - void OnCloseWindow(wxCloseEvent& event); - void OnDefaultAction(wxControl *item); - void OnCommand(wxWindow& win, wxCommandEvent& event); + void OnCloseWindow(wxCloseEvent& event); + void OnDefaultAction(wxControl *item); + void OnCommand(wxWindow& win, wxCommandEvent& event); - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); - private: - wxPropertyFormView* m_view; +private: + wxPropertyFormView* m_view; -DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxPropertyFormDialog) }; /* @@ -261,22 +265,29 @@ DECLARE_EVENT_TABLE() class WXDLLEXPORT wxPropertyFormPanel: public wxPanel { - DECLARE_CLASS(wxPropertyFormPanel) - public: - wxPropertyFormPanel(wxPropertyFormView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "panel"): - wxPanel(parent, -1, pos, size, style, name) - { - m_view = v; - } - void OnDefaultAction(wxControl *item); - void OnCommand(wxWindow& win, wxCommandEvent& event); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); +public: + wxPropertyFormPanel(wxPropertyFormView *v = NULL, + wxWindow *parent = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = _T("panel")) + : wxPanel(parent, -1, pos, size, style, name) + { + m_view = v; + } + void OnDefaultAction(wxControl *item); + void OnCommand(wxWindow& win, wxCommandEvent& event); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); + void SetView(wxPropertyFormView* view) { m_view = view; } + wxPropertyFormView* GetView() const { return m_view; } - private: - wxPropertyFormView* m_view; +private: + wxPropertyFormView* m_view; + + DECLARE_CLASS(wxPropertyFormPanel) }; /* @@ -285,28 +296,32 @@ class WXDLLEXPORT wxPropertyFormPanel: public wxPanel class WXDLLEXPORT wxPropertyFormFrame: public wxFrame { - DECLARE_CLASS(wxPropertyFormFrame) - public: - wxPropertyFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"): - wxFrame(parent, -1, title, pos, size, style, name) - { - m_view = v; - m_propertyPanel = NULL; - } - void OnCloseWindow(wxCloseEvent& event); - - // Must call this to create panel and associate view - virtual bool Initialize(void); - virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v); - inline virtual wxPanel *GetPropertyPanel(void) const { return m_propertyPanel; } - - private: - wxPropertyFormView* m_view; - wxPanel* m_propertyPanel; +public: + wxPropertyFormFrame(wxPropertyFormView *v = NULL, + wxFrame *parent = NULL, + const wxString& title = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = _T("frame")) + : wxFrame(parent, -1, title, pos, size, style, name) + { + m_view = v; + m_propertyPanel = NULL; + } + void OnCloseWindow(wxCloseEvent& event); + + // Must call this to create panel and associate view + virtual bool Initialize(void); + virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v); + inline virtual wxPanel *GetPropertyPanel(void) const { return m_propertyPanel; } -DECLARE_EVENT_TABLE() +private: + wxPropertyFormView* m_view; + wxPanel* m_propertyPanel; + + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxPropertyFormFrame) }; #endif diff --git a/include/wx/proplist.h b/include/wx/proplist.h index de72221bbd..ea93c33eb0 100644 --- a/include/wx/proplist.h +++ b/include/wx/proplist.h @@ -191,15 +191,22 @@ private: class WXDLLEXPORT wxPropertyTextEdit: public wxTextCtrl { - DECLARE_CLASS(wxPropertyTextEdit) - public: - wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, const wxWindowID id, - const wxString& value, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "text"); - void OnSetFocus(void); - void OnKillFocus(void); +public: + wxPropertyTextEdit(wxPropertyListView *v = NULL, + wxWindow *parent = NULL, + const wxWindowID id = -1, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = _T("text")); + + void OnSetFocus(); + void OnKillFocus(); - wxPropertyListView* m_view; + wxPropertyListView* m_view; + + DECLARE_CLASS(wxPropertyTextEdit) }; #define wxPROP_ALLOW_TEXT_EDITING 1 @@ -272,22 +279,27 @@ class WXDLLEXPORT wxPropertyListValidator: public wxPropertyValidator class WXDLLEXPORT wxPropertyListDialog: public wxDialog { - DECLARE_CLASS(wxPropertyListDialog) - public: - wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"); - void OnCloseWindow(wxCloseEvent& event); - void OnDefaultAction(wxControl *item); - void OnCancel(wxCommandEvent& event); +public: + wxPropertyListDialog(wxPropertyListView *v = NULL, + wxWindow *parent = NULL, + const wxString& title = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = _T("dialogBox")); - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); + void OnCloseWindow(wxCloseEvent& event); + void OnDefaultAction(wxControl *item); + void OnCancel(wxCommandEvent& event); - private: - wxPropertyListView* m_view; + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); -DECLARE_EVENT_TABLE() +private: + wxPropertyListView* m_view; + + DECLARE_CLASS(wxPropertyListDialog) + DECLARE_EVENT_TABLE() }; /* @@ -296,31 +308,34 @@ DECLARE_EVENT_TABLE() class WXDLLEXPORT wxPropertyListPanel: public wxPanel { - DECLARE_CLASS(wxPropertyListPanel) - public: - wxPropertyListPanel(wxPropertyListView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = "panel"): - wxPanel(parent, -1, pos, size, style, name) - { - m_view = v; - } - ~wxPropertyListPanel(); - void OnDefaultAction(wxControl *item); - - inline void SetView(wxPropertyListView* v) { m_view = v; } - inline wxPropertyListView* GetView() const { return m_view; } - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); - - // Call Layout() - void OnSize(wxSizeEvent& event); +public: + wxPropertyListPanel(wxPropertyListView *v = NULL, + wxWindow *parent = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = _T("panel")) + : wxPanel(parent, -1, pos, size, style, name) + { + m_view = v; + } + ~wxPropertyListPanel(); + void OnDefaultAction(wxControl *item); + + inline void SetView(wxPropertyListView* v) { m_view = v; } + inline wxPropertyListView* GetView() const { return m_view; } + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); + + // Call Layout() + void OnSize(wxSizeEvent& event); - private: - wxPropertyListView* m_view; +private: + wxPropertyListView* m_view; -DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxPropertyListPanel) }; /* @@ -329,29 +344,33 @@ DECLARE_EVENT_TABLE() class WXDLLEXPORT wxPropertyListFrame: public wxFrame { - DECLARE_CLASS(wxPropertyListFrame) - public: - wxPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"): - wxFrame(parent, -1, title, pos, size, style, name) - { - m_view = v; - m_propertyPanel = NULL; - } - void OnCloseWindow(wxCloseEvent& event); - - // Must call this to create panel and associate view - virtual bool Initialize(void); - virtual wxPropertyListPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v); - inline virtual wxPropertyListPanel *GetPropertyPanel(void) const { return m_propertyPanel; } - inline wxPropertyListView* GetView() const { return m_view; } - - private: - wxPropertyListView* m_view; - wxPropertyListPanel* m_propertyPanel; +public: + wxPropertyListFrame(wxPropertyListView *v = NULL, + wxFrame *parent = NULL, + const wxString& title = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = _T("frame")) + : wxFrame(parent, -1, title, pos, size, style, name) + { + m_view = v; + m_propertyPanel = NULL; + } + void OnCloseWindow(wxCloseEvent& event); + + // Must call this to create panel and associate view + virtual bool Initialize(void); + virtual wxPropertyListPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v); + inline virtual wxPropertyListPanel *GetPropertyPanel(void) const { return m_propertyPanel; } + inline wxPropertyListView* GetView() const { return m_view; } -DECLARE_EVENT_TABLE() +private: + wxPropertyListView* m_view; + wxPropertyListPanel* m_propertyPanel; + + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxPropertyListFrame) }; /* diff --git a/include/wx/qt/dc.h b/include/wx/qt/dc.h index eb10154ab9..9943b0e2ab 100644 --- a/include/wx/qt/dc.h +++ b/include/wx/qt/dc.h @@ -365,8 +365,6 @@ class WXDLLEXPORT wxDC: public wxObject bool m_needComputeScaleX,m_needComputeScaleY; // not yet used - float m_scaleFactor; // wxPSDC wants to have this. Will disappear. - long m_clipX1,m_clipY1,m_clipX2,m_clipY2; long m_minX,m_maxX,m_minY,m_maxY; }; diff --git a/include/wx/resource.h b/include/wx/resource.h index ef958da862..34f282c777 100644 --- a/include/wx/resource.h +++ b/include/wx/resource.h @@ -36,9 +36,13 @@ // Extended styles: for resource usage only // Use dialog units instead of pixels -#define wxRESOURCE_DIALOG_UNITS 1 +#define wxRESOURCE_DIALOG_UNITS 0x0001 // Use default system colour and font -#define wxRESOURCE_USE_DEFAULTS 2 +#define wxRESOURCE_USE_DEFAULTS 0x0002 +// Old-style vertical label +#define wxRESOURCE_VERTICAL_LABEL 0x0004 +// Old-style horizontal label +#define wxRESOURCE_HORIZONTAL_LABEL 0x0008 // Macros to help use dialog units #define wxDLG_POINT(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxPoint(x, y)) : wxPoint(x, y)) diff --git a/include/wx/sckipc.h b/include/wx/sckipc.h index 603eef900c..743da0ab9f 100644 --- a/include/wx/sckipc.h +++ b/include/wx/sckipc.h @@ -59,6 +59,7 @@ class WXDLLEXPORT wxTCPClient; class WXDLLEXPORT wxTCPConnection: public wxConnectionBase { DECLARE_DYNAMIC_CLASS(wxTCPConnection) + public: wxTCPConnection(char *buffer, int size); wxTCPConnection(); @@ -77,18 +78,19 @@ public: // Calls that both can make virtual bool Disconnect(void); + // Callbacks to BOTH - override at will // Default behaviour is to delete connection and return TRUE virtual bool OnDisconnect(void) { delete this; return TRUE; } - // To enable the compressor + // To enable the compressor (NOTE: not implemented!) void Compress(bool on); protected: - wxSocketBase *m_sock; - wxSocketStream *m_sockstrm; - wxDataInputStream *m_codeci; + wxSocketBase *m_sock; + wxSocketStream *m_sockstrm; + wxDataInputStream *m_codeci; wxDataOutputStream *m_codeco; - wxString m_topic; + wxString m_topic; friend class wxTCPServer; friend class wxTCPClient; @@ -112,9 +114,14 @@ public: wxTCPServer(); virtual ~wxTCPServer(); - // Returns FALSE if can't create server (e.g. port number is already in use) - virtual bool Create(const wxString& server_name); + // Returns FALSE on error (e.g. port number is already in use) + virtual bool Create(const wxString& serverName); + + // Callbacks to SERVER - override at will virtual wxConnectionBase *OnAcceptConnection(const wxString& topic); + +protected: + wxSocketServer *m_server; }; class wxTCPClient: public wxClientBase @@ -126,13 +133,13 @@ public: virtual ~wxTCPClient(); virtual bool ValidHost(const wxString& host); - // Call this to make a connection. - // Returns NULL if cannot. + + // Call this to make a connection. Returns NULL if cannot. virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic); - // Tailor this to return own connection. + // Callbacks to CLIENT - override at will virtual wxConnectionBase *OnMakeConnection(); }; diff --git a/include/wx/setup.h b/include/wx/setup.h index aeadc41966..a38f59eb9f 100644 --- a/include/wx/setup.h +++ b/include/wx/setup.h @@ -16,24 +16,45 @@ #endif #ifdef __WXBASE__ +#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__) +#include "wx/based/setup.h" +#else #include "wx/base/setup.h" +#endif + #elif defined(__VMS) #include "wx_root:[wxwindows]setup.h" #elif defined(__WXMSW__) #include "wx/msw/setup.h" #elif defined(__WXMAC__) #include "wx/mac/setup.h" + #elif defined(__WXQT__) +#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__) +#include "wx/qtd/setup.h" +#else #include "wx/qt/setup.h" +#endif + #elif defined(__WXMOTIF__) +#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__) +#include "wx/motifd/setup.h" +#else #include "wx/motif/setup.h" +#endif + #elif defined(__WXPM__) #include "wx/os2/setup.h" #elif defined(__WXSTUBS__) #include "wx/stubs/setup.h" + #elif defined(__WXGTK__) +#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__) +#include "wx/gtkd/setup.h" +#else #include "wx/gtk/setup.h" #endif +#endif #endif /* _WX_SETUP_H_BASE_ */ diff --git a/include/wx/sizer.h b/include/wx/sizer.h index 091a17db79..c9ac671daf 100644 --- a/include/wx/sizer.h +++ b/include/wx/sizer.h @@ -81,8 +81,12 @@ public: wxWindow *GetWindow() const { return m_window; } + void SetWindow( wxWindow *window ) + { m_window = window; } wxSizer *GetSizer() const { return m_sizer; } + void SetSizer( wxSizer *sizer ) + { m_sizer = sizer; } int GetOption() const { return m_option; } int GetFlag() const @@ -91,11 +95,14 @@ public: { return m_border; } wxObject* GetUserData() { return m_userData; } + wxPoint GetPosition() + { return m_pos; } protected: wxWindow *m_window; wxSizer *m_sizer; wxSize m_size; + wxPoint m_pos; wxSize m_minSize; int m_option; int m_border; @@ -113,53 +120,150 @@ protected: class WXDLLEXPORT wxSizer: public wxObject { - DECLARE_CLASS(wxSizer); public: - wxSizer(); - ~wxSizer(); - - virtual void Add( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Add( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Add( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - - virtual void Insert( int before, wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Insert( int before, wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Insert( int before, int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - - virtual void Prepend( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Prepend( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Prepend( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + wxSizer(); + ~wxSizer(); + + /* These should be called Append() really. */ + virtual void Add( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual void Add( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual void Add( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + + virtual void Insert( int before, wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual void Insert( int before, wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual void Insert( int before, int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + + virtual void Prepend( wxWindow *window, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual void Prepend( wxSizer *sizer, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual void Prepend( int width, int height, int option = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + + virtual bool Remove( wxWindow *window ); + virtual bool Remove( wxSizer *sizer ); + virtual bool Remove( int pos ); + + void SetMinSize( int width, int height ) + { DoSetMinSize( width, height ); } + void SetMinSize( wxSize size ) + { DoSetMinSize( size.x, size.y ); } + + /* Searches recursively */ + bool SetItemMinSize( wxWindow *window, int width, int height ) + { return DoSetItemMinSize( window, width, height ); } + bool SetItemMinSize( wxWindow *window, wxSize size ) + { return DoSetItemMinSize( window, size.x, size.y ); } + + /* Searches recursively */ + bool SetItemMinSize( wxSizer *sizer, int width, int height ) + { return DoSetItemMinSize( sizer, width, height ); } + bool SetItemMinSize( wxSizer *sizer, wxSize size ) + { return DoSetItemMinSize( sizer, size.x, size.y ); } + + bool SetItemMinSize( int pos, int width, int height ) + { return DoSetItemMinSize( pos, width, height ); } + bool SetItemMinSize( int pos, wxSize size ) + { return DoSetItemMinSize( pos, size.x, size.y ); } + + wxSize GetSize() + { return m_size; } + wxPoint GetPosition() + { return m_position; } + + /* Calculate the minimal size or return m_minSize if bigger. */ + wxSize GetMinSize(); + + virtual void RecalcSizes() = 0; + virtual wxSize CalcMin() = 0; + + virtual void Layout(); + + void Fit( wxWindow *window ); + void SetSizeHints( wxWindow *window ); + + wxList& GetChildren() + { return m_children; } + + void SetDimension( int x, int y, int width, int height ); - virtual bool Remove( wxWindow *window ); - virtual bool Remove( wxSizer *sizer ); - virtual bool Remove( int pos ); - - void SetDimension( int x, int y, int width, int height ); - - wxSize GetSize() - { return m_size; } - wxPoint GetPosition() - { return m_position; } - wxSize GetMinSize() - { return CalcMin(); } +protected: + wxSize m_size; + wxSize m_minSize; + wxPoint m_position; + wxList m_children; + + wxSize GetMinWindowSize( wxWindow *window ); + + virtual void DoSetMinSize( int width, int height ); + virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); + virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); + virtual bool DoSetItemMinSize( int pos, int width, int height ); + +private: + DECLARE_CLASS(wxSizer); +}; - virtual void RecalcSizes() = 0; - virtual wxSize CalcMin() = 0; +//--------------------------------------------------------------------------- +// wxGridSizer +//--------------------------------------------------------------------------- - virtual void Layout(); +class WXDLLEXPORT wxGridSizer: public wxSizer +{ +public: + wxGridSizer( int rows, int cols, int vgap, int hgap ); + wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); + + void RecalcSizes(); + wxSize CalcMin(); + + void SetCols( int cols ) { m_cols = cols; } + void SetRows( int rows ) { m_rows = rows; } + void SetVGap( int gap ) { m_vgap = gap; } + void SetHGap( int gap ) { m_hgap = gap; } + int GetCols() { return m_cols; } + int GetRows() { return m_rows; } + int GetVGap() { return m_vgap; } + int GetHGap() { return m_hgap; } + +protected: + int m_rows; + int m_cols; + int m_vgap; + int m_hgap; + + void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); + +private: + DECLARE_CLASS(wxGridSizer); +}; - void Fit( wxWindow *window ); - void SetSizeHints( wxWindow *window ); +//--------------------------------------------------------------------------- +// wxFlexGridSizer +//--------------------------------------------------------------------------- - wxList& GetChildren() - { return m_children; } +class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer +{ +public: + wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); + wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); + ~wxFlexGridSizer(); + + void RecalcSizes(); + wxSize CalcMin(); + + void AddGrowableRow( size_t idx ); + void RemoveGrowableRow( size_t idx ); + void AddGrowableCol( size_t idx ); + void RemoveGrowableCol( size_t idx ); protected: - wxSize m_size; - wxPoint m_position; - wxList m_children; - - wxSize GetMinWindowSize( wxWindow *window ); + int *m_rowHeights; + int *m_colWidths; + wxArrayInt m_growableRows; + wxArrayInt m_growableCols; + + void CreateArrays(); + +private: + DECLARE_CLASS(wxFlexGridSizer); }; //--------------------------------------------------------------------------- @@ -168,15 +272,14 @@ protected: class WXDLLEXPORT wxBoxSizer: public wxSizer { - DECLARE_CLASS(wxBoxSizer); public: - wxBoxSizer( int orient ); + wxBoxSizer( int orient ); - void RecalcSizes(); - wxSize CalcMin(); + void RecalcSizes(); + wxSize CalcMin(); - int GetOrientation() - { return m_orient; } + int GetOrientation() + { return m_orient; } protected: int m_orient; @@ -185,6 +288,9 @@ protected: int m_minHeight; int m_fixedWidth; int m_fixedHeight; + +private: + DECLARE_CLASS(wxBoxSizer); }; //--------------------------------------------------------------------------- @@ -193,18 +299,20 @@ protected: class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer { - DECLARE_CLASS(wxStaticBoxSizer); public: - wxStaticBoxSizer( wxStaticBox *box, int orient ); + wxStaticBoxSizer( wxStaticBox *box, int orient ); - void RecalcSizes(); - wxSize CalcMin(); + void RecalcSizes(); + wxSize CalcMin(); - wxStaticBox *GetStaticBox() - { return m_staticBox; } + wxStaticBox *GetStaticBox() + { return m_staticBox; } protected: - wxStaticBox *m_staticBox; + wxStaticBox *m_staticBox; + +private: + DECLARE_CLASS(wxStaticBoxSizer); }; //--------------------------------------------------------------------------- @@ -215,18 +323,20 @@ protected: class WXDLLEXPORT wxNotebookSizer: public wxSizer { - DECLARE_CLASS(wxNotebookSizer); public: - wxNotebookSizer( wxNotebook *nb ); + wxNotebookSizer( wxNotebook *nb ); - void RecalcSizes(); - wxSize CalcMin(); + void RecalcSizes(); + wxSize CalcMin(); - wxNotebook *GetNotebook() - { return m_notebook; } + wxNotebook *GetNotebook() + { return m_notebook; } protected: - wxNotebook *m_notebook; + wxNotebook *m_notebook; + +private: + DECLARE_CLASS(wxNotebookSizer); }; #endif diff --git a/include/wx/statusbr.h b/include/wx/statusbr.h index 029c7cb621..510309de15 100644 --- a/include/wx/statusbr.h +++ b/include/wx/statusbr.h @@ -63,7 +63,7 @@ protected: // we can't just typedef wxStatusBar to be one of 95/Generic because we should // be able to forward declare it (done in several places) and because wxWin // RTTI wouldn't work then -class wxStatusBar : public wxStatusBarReal +class WXDLLEXPORT wxStatusBar : public wxStatusBarReal { public: wxStatusBar() { } diff --git a/include/wx/stc/SciLexer.h b/include/wx/stc/SciLexer.h new file mode 100644 index 0000000000..d869758f61 --- /dev/null +++ b/include/wx/stc/SciLexer.h @@ -0,0 +1,181 @@ +// Scintilla source code edit control +// SciLexer - interface to the added lexer functions in the SciLexer version of the edit control +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SCILEXER_H +#define SCILEXER_H + +// SciLexer features - not in standard Scintilla + +#define SCLEX_CONTAINER 0 +#define SCLEX_NULL 1 +#define SCLEX_PYTHON 2 +#define SCLEX_CPP 3 +#define SCLEX_HTML 4 +#define SCLEX_XML 5 +#define SCLEX_PERL 6 +#define SCLEX_SQL 7 +#define SCLEX_VB 8 +#define SCLEX_PROPERTIES 9 +#define SCLEX_ERRORLIST 10 +#define SCLEX_MAKEFILE 11 +#define SCLEX_BATCH 12 +#define SCLEX_XCODE 13 +#define SCLEX_LATEX 14 + +// Lexical states for SCLEX_PYTHON +#define SCE_P_DEFAULT 0 +#define SCE_P_COMMENTLINE 1 +#define SCE_P_NUMBER 2 +#define SCE_P_STRING 3 +#define SCE_P_CHARACTER 4 +#define SCE_P_WORD 5 +#define SCE_P_TRIPLE 6 +#define SCE_P_TRIPLEDOUBLE 7 +#define SCE_P_CLASSNAME 8 +#define SCE_P_DEFNAME 9 +#define SCE_P_OPERATOR 10 +#define SCE_P_IDENTIFIER 11 +#define SCE_P_COMMENTBLOCK 12 +#define SCE_P_STRINGEOL 13 + +// Lexical states for SCLEX_CPP, SCLEX_VB +#define SCE_C_DEFAULT 0 +#define SCE_C_COMMENT 1 +#define SCE_C_COMMENTLINE 2 +#define SCE_C_COMMENTDOC 3 +#define SCE_C_NUMBER 4 +#define SCE_C_WORD 5 +#define SCE_C_STRING 6 +#define SCE_C_CHARACTER 7 +#define SCE_C_UUID 8 +#define SCE_C_PREPROCESSOR 9 +#define SCE_C_OPERATOR 10 +#define SCE_C_IDENTIFIER 11 +#define SCE_C_STRINGEOL 12 + +// Lexical states for SCLEX_HTML, SCLEX_xML +#define SCE_H_DEFAULT 0 +#define SCE_H_TAG 1 +#define SCE_H_TAGUNKNOWN 2 +#define SCE_H_ATTRIBUTE 3 +#define SCE_H_ATTRIBUTEUNKNOWN 4 +#define SCE_H_NUMBER 5 +#define SCE_H_DOUBLESTRING 6 +#define SCE_H_SINGLESTRING 7 +#define SCE_H_OTHER 8 +#define SCE_H_COMMENT 9 +#define SCE_H_ENTITY 10 +// XML and ASP +#define SCE_H_TAGEND 11 +#define SCE_H_XMLSTART 12 +#define SCE_H_XMLEND 13 +#define SCE_H_SCRIPT 14 +#define SCE_H_ASP 15 +#define SCE_H_ASPAT 16 +// Embedded Javascript +#define SCE_HJ_START 40 +#define SCE_HJ_DEFAULT 41 +#define SCE_HJ_COMMENT 42 +#define SCE_HJ_COMMENTLINE 43 +#define SCE_HJ_COMMENTDOC 44 +#define SCE_HJ_NUMBER 45 +#define SCE_HJ_WORD 46 +#define SCE_HJ_KEYWORD 47 +#define SCE_HJ_DOUBLESTRING 48 +#define SCE_HJ_SINGLESTRING 49 +#define SCE_HJ_SYMBOLS 50 +#define SCE_HJ_STRINGEOL 51 +// ASP Javascript +#define SCE_HJA_START 55 +#define SCE_HJA_DEFAULT 56 +#define SCE_HJA_COMMENT 57 +#define SCE_HJA_COMMENTLINE 58 +#define SCE_HJA_COMMENTDOC 59 +#define SCE_HJA_NUMBER 60 +#define SCE_HJA_WORD 61 +#define SCE_HJA_KEYWORD 62 +#define SCE_HJA_DOUBLESTRING 63 +#define SCE_HJA_SINGLESTRING 64 +#define SCE_HJA_SYMBOLS 65 +#define SCE_HJA_STRINGEOL 66 +// Embedded VBScript +#define SCE_HB_START 70 +#define SCE_HB_DEFAULT 71 +#define SCE_HB_COMMENTLINE 72 +#define SCE_HB_NUMBER 73 +#define SCE_HB_WORD 74 +#define SCE_HB_STRING 75 +#define SCE_HB_IDENTIFIER 76 +#define SCE_HB_STRINGEOL 77 +// ASP VBScript +#define SCE_HBA_START 80 +#define SCE_HBA_DEFAULT 81 +#define SCE_HBA_COMMENTLINE 82 +#define SCE_HBA_NUMBER 83 +#define SCE_HBA_WORD 84 +#define SCE_HBA_STRING 85 +#define SCE_HBA_IDENTIFIER 86 +#define SCE_HBA_STRINGEOL 87 +// Embedded Python +#define SCE_HP_START 90 +#define SCE_HP_DEFAULT 91 +#define SCE_HP_COMMENTLINE 92 +#define SCE_HP_NUMBER 93 +#define SCE_HP_STRING 94 +#define SCE_HP_CHARACTER 95 +#define SCE_HP_WORD 96 +#define SCE_HP_TRIPLE 97 +#define SCE_HP_TRIPLEDOUBLE 98 +#define SCE_HP_CLASSNAME 99 +#define SCE_HP_DEFNAME 100 +#define SCE_HP_OPERATOR 101 +#define SCE_HP_IDENTIFIER 102 +// ASP Python +#define SCE_HPA_START 105 +#define SCE_HPA_DEFAULT 106 +#define SCE_HPA_COMMENTLINE 107 +#define SCE_HPA_NUMBER 108 +#define SCE_HPA_STRING 109 +#define SCE_HPA_CHARACTER 110 +#define SCE_HPA_WORD 111 +#define SCE_HPA_TRIPLE 112 +#define SCE_HPA_TRIPLEDOUBLE 113 +#define SCE_HPA_CLASSNAME 114 +#define SCE_HPA_DEFNAME 115 +#define SCE_HPA_OPERATOR 116 +#define SCE_HPA_IDENTIFIER 117 + +// Lexical states for SCLEX_PERL +#define SCE_PL_DEFAULT 0 +#define SCE_PL_HERE 1 +#define SCE_PL_COMMENTLINE 2 +#define SCE_PL_POD 3 +#define SCE_PL_NUMBER 4 +#define SCE_PL_WORD 5 +#define SCE_PL_STRING 6 +#define SCE_PL_CHARACTER 7 +#define SCE_PL_PUNCTUATION 8 +#define SCE_PL_PREPROCESSOR 9 +#define SCE_PL_OPERATOR 10 +#define SCE_PL_IDENTIFIER 11 +#define SCE_PL_SCALAR 12 +#define SCE_PL_ARRAY 13 +#define SCE_PL_HASH 14 +#define SCE_PL_SYMBOLTABLE 15 +#define SCE_PL_REF 16 +#define SCE_PL_REGEX 17 +#define SCE_PL_REGSUBST 18 +#define SCE_PL_LONGQUOTE 19 +#define SCE_PL_BACKTICKS 20 +#define SCE_PL_DATASECTION 21 + +// Lexical states for SCLEX_LATEX +#define SCE_L_DEFAULT 0 +#define SCE_L_COMMAND 1 +#define SCE_L_TAG 2 +#define SCE_L_MATH 3 +#define SCE_L_COMMENT 4 + +#endif diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 628d87fd3d..d5925f19be 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -22,7 +22,7 @@ #include <wx/wx.h> - +#include "SciLexer.h" //---------------------------------------------------------------------- // constants and stuff @@ -53,7 +53,7 @@ const int wxSTC_STYLE_LINENUMBER = 33; const int wxSTC_STYLE_BRACELIGHT = 34; const int wxSTC_STYLE_BRACEBAD = 35; const int wxSTC_STYLE_CONTROLCHAR = 36; -const int wxSTC_STYLE_MAX = 63; +const int wxSTC_STYLE_MAX = 127; const int wxSTC_STYLE_MASK = 31; const int wxSTC_MARKER_MAX = 31; @@ -63,16 +63,32 @@ const int wxSTC_MARK_ARROW = 2; const int wxSTC_MARK_SMALLRECT = 3; const int wxSTC_MARK_SHORTARROW = 4; const int wxSTC_MARK_EMPTY = 5; +const int wxSTC_MARK_ARROWDOWN = 6; +const int wxSTC_MARK_MINUS = 7; +const int wxSTC_MARK_PLUS = 8; + +const int wxSTC_MARKNUM_FOLDER = 30; +const int wxSTC_MARKNUM_FOLDEROPEN= 31; +const int wxSTC_MASK_FOLDERS = ((1 << wxSTC_MARKNUM_FOLDER) | (1 << wxSTC_MARKNUM_FOLDEROPEN)); +const int wxSTC_INDIC_MAX = 7; const int wxSTC_INDIC_PLAIN = 0; const int wxSTC_INDIC_SQUIGGLE = 1; const int wxSTC_INDIC_TT = 2; +const int wxSTC_INDIC_DIAGONAL = 3; +const int wxSTC_INDIC_STRIKE = 4; const int wxSTC_INDIC0_MASK = 32; const int wxSTC_INDIC1_MASK = 64; const int wxSTC_INDIC2_MASK = 128; const int wxSTC_INDICS_MASK = (wxSTC_INDIC0_MASK | wxSTC_INDIC1_MASK | wxSTC_INDIC2_MASK); +const int wxSTC_FOLDLEVELBASE = 0x0400; +const int wxSTC_FOLDLEVELWHITEFLAG = 0x1000; +const int wxSTC_FOLDLEVELHEADERFLAG = 0x2000; +const int wxSTC_FOLDLEVELNUMBERMASK = 0x0FFF; + + // key commands enum { wxSTC_CMD_LINEDOWN = 2300, @@ -111,7 +127,14 @@ enum { wxSTC_CMD_ZOOMIN, wxSTC_CMD_ZOOMOUT, wxSTC_CMD_DELWORDLEFT, - wxSTC_CMD_DELWORDRIGHT + wxSTC_CMD_DELWORDRIGHT, + wxSTC_CMD_LINECUT, + wxSTC_CMD_LINEDELETE, + wxSTC_CMD_LINETRANSPOSE, + wxSTC_CMD_LOWERCASE, + wxSTC_CMD_UPPERCASE, + wxSTC_CMD_LINESCROLLDOWN, + wxSTC_CMD_LINESCROLLUP }; @@ -129,6 +152,8 @@ enum wxSTC_LEX { wxSTC_LEX_ERRORLIST, wxSTC_LEX_MAKEFILE, wxSTC_LEX_BATCH, + wxSTC_LEX_XCODE, + wxSTC_LEX_LATEX }; @@ -153,12 +178,22 @@ extern const wxChar* wxSTCNameStr; class wxStyledTextCtrl : public wxControl { public: +#ifdef SWIG + wxStyledTextCtrl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const char* name = "styledtext"); +#else wxStyledTextCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxSTCNameStr); - ~wxStyledTextCtrl(); +#endif + +#ifndef SWIG + ~wxStyledTextCtrl(); +#endif // Text retrieval and modification @@ -170,8 +205,10 @@ public: bool GetReadOnly(); wxString GetTextRange(int startPos, int endPos); wxString GetStyledTextRange(int startPos, int endPos); +#ifndef SWIG void GetTextRange(int startPos, int endPos, char* buff); void GetStyledTextRange(int startPos, int endPos, char* buff); +#endif void AddText(const wxString& text); void AddStyledText(const wxString& text); void InsertText(int pos, const wxString& text); @@ -203,7 +240,11 @@ public: // Selection and information +#ifdef SWIG + void GetSelection(int* OUTPUT, int* OUTPUT); +#else void GetSelection(int* startPos, int* endPos); +#endif void SetSelection(int startPos, int endPos); wxString GetSelectedText(); void HideSelection(bool hide); @@ -218,7 +259,11 @@ public: int GetLineStartPos(int line); int GetLineLengthAtPos(int pos); int GetLineLength(int line); - wxString GetCurrentLineText(int* linePos=NULL); +#ifdef SWIG + wxString GetCurrentLineText(int* OUTPUT); +#else + wxString GetCurrentLineText(int* linePos); +#endif int GetCurrentLine(); int PositionFromPoint(wxPoint pt); int LineFromPoint(wxPoint pt); @@ -239,7 +284,10 @@ public: void EnsureCaretVisible(); void SetCaretPolicy(int policy, int slop=0); int GetSelectionType(); - + int GetLinesOnScreen(); + bool IsSelectionRectangle(); + void SetUseHorizontalScrollBar(bool use); + bool GetUseHorizontalScrollBar(); // Searching @@ -268,6 +316,8 @@ public: void StartStyling(int pos, int mask); void SetStyleFor(int length, int style); void SetStyleBytes(int length, char* styleBytes); + void SetLineState(int line, int value); + int GetLineState(int line); // Style Definition @@ -277,12 +327,13 @@ public: void StyleSetForeground(int styleNum, const wxColour& colour); void StyleSetBackground(int styleNum, const wxColour& colour); void StyleSetFont(int styleNum, wxFont& font); - void StyleSetFontAttr(int styleNum, int size, const wxString& faceName, bool bold, bool italic); + void StyleSetFontAttr(int styleNum, int size, const wxString& faceName, bool bold=FALSE, bool italic=FALSE, bool underline=FALSE); void StyleSetBold(int styleNum, bool bold); void StyleSetItalic(int styleNum, bool italic); void StyleSetFaceName(int styleNum, const wxString& faceName); void StyleSetSize(int styleNum, int pointSize); void StyleSetEOLFilled(int styleNum, bool fillEOL); + void StyleSetUnderline(int styleNum, bool underline); // Margins in the edit area @@ -313,8 +364,15 @@ public: // Other settings void SetBufferedDraw(bool isBuffered); void SetTabWidth(int numChars); + void SetIndent(int numChars); + void SetUseTabs(bool usetabs); + void SetLineIndentation(int line, int indentation); + int GetLineIndentation(int line); + int GetLineIndentationPos(int line); void SetWordChars(const wxString& wordChars); + void SetUsePop(bool usepopup); + // Brace highlighting void BraceHighlight(int pos1, int pos2); @@ -352,7 +410,9 @@ public: int AutoCompPosAtStart(); void AutoCompComplete(); void AutoCompStopChars(const wxString& stopChars); - + void AutoCompSetSeparator(char separator); + char AutoCompGetSeparator(); + void AutoCompSelect(const wxString& stringtoselect); // Call tips void CallTipShow(int pos, const wxString& text); @@ -391,15 +451,23 @@ public: int DocLineFromVisible(int displayLine); int SetFoldLevel(int line, int level); int GetFoldLevel(int line); - int GetLastChild(int line); + int GetLastChild(int line, int level); int GetFoldParent(int line); void ShowLines(int lineStart, int lineEnd); void HideLines(int lineStart, int lineEnd); bool GetLineVisible(int line); - void SetFoldExpanded(int line); + void SetFoldExpanded(int line, bool expanded); bool GetFoldExpanded(int line); void ToggleFold(int line); void EnsureVisible(int line); + void SetFoldFlags(int flags); + + + // Zooming + void ZoomIn(); + void ZoomOut(); + void SetZoom(int zoom); + int GetZoom(); // Long Lines @@ -419,7 +487,11 @@ public: void SetKeywords(int keywordSet, const wxString& keywordList); + // Event mask for Modified Event + void SetModEventMask(int mask); + //int GetModEventMask(); +#ifndef SWIG private: // Event handlers void OnPaint(wxPaintEvent& evt); @@ -430,11 +502,13 @@ private: void OnMouseLeftUp(wxMouseEvent& evt); void OnMouseRightUp(wxMouseEvent& evt); void OnChar(wxKeyEvent& evt); + void OnKeyDown(wxKeyEvent& evt); void OnLoseFocus(wxFocusEvent& evt); void OnGainFocus(wxFocusEvent& evt); void OnSysColourChanged(wxSysColourChangedEvent& evt); void OnEraseBackground(wxEraseEvent& evt); void OnMenu(wxCommandEvent& evt); + void OnListBox(wxCommandEvent& evt); // Turn notifications from Scintilla into events @@ -445,6 +519,7 @@ private: private: DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxStyledTextCtrl) ScintillaWX* m_swx; wxStopWatch m_stopWatch; @@ -454,13 +529,14 @@ private: friend class ScintillaWX; friend class Platform; +#endif }; //---------------------------------------------------------------------- class wxStyledTextEvent : public wxCommandEvent { public: - wxStyledTextEvent(wxEventType commandType, int id); + wxStyledTextEvent(wxEventType commandType=0, int id=0); ~wxStyledTextEvent() {} void SetPosition(int pos) { m_position = pos; } @@ -499,7 +575,10 @@ public: void CopyObject(wxObject& obj) const; +#ifndef SWIG private: + DECLARE_DYNAMIC_CLASS(wxStyledTextEvent) + int m_position; int m_key; int m_modifiers; @@ -517,11 +596,11 @@ private: int m_message; // wxEVT_STC_MACRORECORD int m_wParam; int m_lParam; - +#endif }; - +// Event types enum { wxEVT_STC_CHANGE = 1650, wxEVT_STC_STYLENEEDED, @@ -538,6 +617,21 @@ enum { wxEVT_STC_NEEDSHOWN }; +// Modification and action types +const int wxSTC_MOD_INSERTTEXT = 0x1; +const int wxSTC_MOD_DELETETEXT = 0x2; +const int wxSTC_MOD_CHANGESTYLE = 0x4; +const int wxSTC_MOD_CHANGEFOLD = 0x8; +const int wxSTC_PERFORMED_USER = 0x10; +const int wxSTC_PERFORMED_UNDO = 0x20; +const int wxSTC_PERFORMED_REDO = 0x40; +const int wxSTC_LASTSTEPINUNDOREDO = 0x100; +const int wxSTC_MOD_CHANGEMARKER = 0x200; +const int wxSTC_MOD_BEFOREINSERT = 0x400; +const int wxSTC_MOD_BEFOREDELETE = 0x800; + + +#ifndef SWIG typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_CHANGE(id, fn) { wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, @@ -549,9 +643,12 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_ROMODIFYATTEMPT(id, fn) { wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, #define EVT_STC_DOUBLECLICK(id, fn) { wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, #define EVT_STC_MODIFIED(id, fn) { wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, -#define EVT_STC_CMDKEY(id, fn) { wxEVT_STC_CMDKEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, -#define EVT_STC_UNKNOWNCMDKEY(id, fn) { wxEVT_STC_UNKNOWNCMDKEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_KEY(id, fn) { wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MACRORECORD(id, fn) { wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MARGINCLICK(id, fn) { wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_NEEDSHOWN(id, fn) { wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#endif //---------------------------------------------------------------------- //---------------------------------------------------------------------- diff --git a/include/wx/strconv.h b/include/wx/strconv.h index fa3e22c42d..92d5729370 100644 --- a/include/wx/strconv.h +++ b/include/wx/strconv.h @@ -46,7 +46,7 @@ public: const wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); } const wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); } const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; } - const wchar_t* cMB2WC(const wchar_t *psz) const { return psz; } + const wchar_t* cWX2WC(const wchar_t *psz) const { return psz; } #else // ANSI const char* cMB2WX(const char *psz) const { return psz; } const char* cWX2MB(const char *psz) const { return psz; } diff --git a/include/wx/string.h b/include/wx/string.h index 1b0c138ea9..fe9787845f 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -66,7 +66,6 @@ #endif // AIX #include "wx/defs.h" // everybody should include this -#include "wx/debug.h" // for wxASSERT() #include "wx/wxchar.h" // for wxChar #include "wx/buffer.h" // for wxCharBuffer #include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes @@ -205,6 +204,12 @@ struct WXDLLEXPORT wxStringData // lock/unlock void Lock() { if ( !IsEmpty() ) nRefs++; } + + // VC++ will refuse to inline this function but profiling shows that it + // is wrong +#if defined(__VISUALC__) && (__VISUALC__ >= 1200) + __forceinline +#endif void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); } // if we had taken control over string memory (GetWriteBuf), it's @@ -315,6 +320,8 @@ public: // (default value of wxSTRING_MAXLEN means take all the string) wxString(const wxChar *psz, size_t nLength = wxSTRING_MAXLEN) { InitWith(psz, 0, nLength); } + wxString(const wxChar *psz, wxMBConv& WXUNUSED(conv), size_t nLength = wxSTRING_MAXLEN) + { InitWith(psz, 0, nLength); } #if wxUSE_UNICODE // from multibyte string @@ -328,13 +335,10 @@ public: // from C string (for compilers using unsigned char) wxString(const unsigned char* psz, size_t nLength = wxSTRING_MAXLEN) { InitWith((const char*)psz, 0, nLength); } - // from multibyte string - wxString(const char *psz, wxMBConv& WXUNUSED(conv) , size_t nLength = wxSTRING_MAXLEN) - { InitWith(psz, 0, nLength); } #if wxUSE_WCHAR_T // from wide (Unicode) string - wxString(const wchar_t *pwz); + wxString(const wchar_t *pwz, wxMBConv& conv = wxConvLibc); #endif // !wxUSE_WCHAR_T // from wxCharBuffer @@ -423,18 +427,30 @@ public: operator const wxChar*() const { return m_pchData; } // explicit conversion to C string (use this with printf()!) const wxChar* c_str() const { return m_pchData; } - // (and this with [wx]Printf()!) + // identical to c_str() const wxChar* wx_str() const { return m_pchData; } // identical to c_str() const wxChar* GetData() const { return m_pchData; } // conversions with (possible) format convertions: have to return a // buffer with temporary data + // + // the functions defined (in either Unicode or ANSI) mode are mb_str() to + // return an ANSI (multibyte) string, wc_str() to return a wide string and + // fn_str() to return a string which should be used with the OS APIs + // accepting the file names. The return value is always the same, but the + // type differs because a function may either return pointer to the buffer + // directly or have to use intermediate buffer for translation. #if wxUSE_UNICODE - const wxCharBuffer mb_str(wxMBConv& conv = wxConvLibc) const { return conv.cWC2MB(m_pchData); } + const wxCharBuffer mb_str(wxMBConv& conv = wxConvLibc) const + { return conv.cWC2MB(m_pchData); } + const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); } - const wxChar* wc_str(wxMBConv& WXUNUSED(conv) = wxConvLibc) const { return m_pchData; } + const wxChar* wc_str() const { return m_pchData; } + + // for compatibility with !wxUSE_UNICODE version + const wxChar* wc_str(wxMBConv& WXUNUSED(conv)) const { return m_pchData; } #if wxMBFILES const wxCharBuffer fn_str() const { return mb_str(wxConvFile); } @@ -442,17 +458,18 @@ public: const wxChar* fn_str() const { return m_pchData; } #endif // wxMBFILES/!wxMBFILES #else // ANSI -#if wxUSE_MULTIBYTE - const wxChar* mb_str(wxMBConv& WXUNUSED(conv) = wxConvLibc) const - { return m_pchData; } - const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); } -#else // !mmultibyte const wxChar* mb_str() const { return m_pchData; } + + // for compatibility with wxUSE_UNICODE version + const wxChar* mb_str(wxMBConv& WXUNUSED(conv)) const { return m_pchData; } + const wxWX2MBbuf mbc_str() const { return mb_str(); } -#endif // multibyte/!multibyte + #if wxUSE_WCHAR_T - const wxWCharBuffer wc_str(wxMBConv& conv) const { return conv.cMB2WC(m_pchData); } + const wxWCharBuffer wc_str(wxMBConv& conv) const + { return conv.cMB2WC(m_pchData); } #endif // wxUSE_WCHAR_T + const wxChar* fn_str() const { return m_pchData; } #endif // Unicode/ANSI @@ -580,10 +597,15 @@ public: // if nCount = default value) wxString Mid(size_t nFirst, size_t nCount = wxSTRING_MAXLEN) const; - // operator version of Mid() + // operator version of Mid() wxString operator()(size_t start, size_t len) const { return Mid(start, len); } + // check that the tring starts with prefix and return the rest of the + // string in the provided pointer if it is not NULL, otherwise return + // FALSE + bool StartsWith(const wxChar *prefix, wxString *rest = NULL) const; + // get first nCount characters wxString Left(size_t nCount) const; // get last nCount characters @@ -994,6 +1016,12 @@ public: // sort array elements using specified comparaison function void Sort(CompareFunction compareFunction); + // comparison + // compare two arrays case sensitively + bool operator==(const wxArrayString& a) const; + // compare two arrays case sensitively + bool operator!=(const wxArrayString& a) const { return !(*this == a); } + protected: void Copy(const wxArrayString& src); // copies the contents of another array @@ -1072,11 +1100,19 @@ inline bool operator==(const wxString& s1, const wxWCharBuffer& s2) { return (s1.Cmp((const wchar_t *)s2) == 0); } inline bool operator==(const wxWCharBuffer& s1, const wxString& s2) { return (s2.Cmp((const wchar_t *)s1) == 0); } +inline bool operator!=(const wxString& s1, const wxWCharBuffer& s2) + { return (s1.Cmp((const wchar_t *)s2) != 0); } +inline bool operator!=(const wxWCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const wchar_t *)s1) != 0); } #else inline bool operator==(const wxString& s1, const wxCharBuffer& s2) { return (s1.Cmp((const char *)s2) == 0); } inline bool operator==(const wxCharBuffer& s1, const wxString& s2) { return (s2.Cmp((const char *)s1) == 0); } +inline bool operator!=(const wxString& s1, const wxCharBuffer& s2) + { return (s1.Cmp((const char *)s2) != 0); } +inline bool operator!=(const wxCharBuffer& s1, const wxString& s2) + { return (s2.Cmp((const char *)s1) != 0); } #endif wxString WXDLLEXPORT operator+(const wxString& string1, const wxString& string2); diff --git a/include/wx/stubs/dc.h b/include/wx/stubs/dc.h index ce3e9998d1..596e26de9a 100644 --- a/include/wx/stubs/dc.h +++ b/include/wx/stubs/dc.h @@ -364,8 +364,6 @@ class WXDLLEXPORT wxDC: public wxObject bool m_needComputeScaleX,m_needComputeScaleY; // not yet used - float m_scaleFactor; // wxPSDC wants to have this. Will disappear. - long m_clipX1,m_clipY1,m_clipX2,m_clipY2; long m_minX,m_maxX,m_minY,m_maxY; }; diff --git a/include/wx/stubs/setup.h b/include/wx/stubs/setup.h index b791618903..566b0d414d 100644 --- a/include/wx/stubs/setup.h +++ b/include/wx/stubs/setup.h @@ -103,13 +103,22 @@ // Define 1 to use ODBC classes #define wxODBC_FWD_ONLY_CURSORS 1 - // Some databases/ODBC drivers only allow forward scrolling cursors. - // Unless you specifically want to use backward scrolling - // cursors, and you know that all of the databases/ODBC drivers - // that you will use these odbc classes with allow backward - // scrolling cursors, this setting should remain set to 1 - // for maximum database/driver compatibilty - + // For backward compatibility reasons, this parameter now only + // controls the default scrolling method used by cursors. This + // default behavior can be overriden by setting the second param + // of wxDB::GetDbConnection() to indicate whether the connection + // (and any wxTable()s that use the connection) should support + // forward only scrolling of cursors, or both forward and backward + // Support for backward scrolling cursors is dependent on the + // data source as well as the ODBC driver being used. + +#define wxODBC_BACKWARD_COMPATABILITY 0 + // Default is 0. Set to 1 to use the deprecated classes, enum + // types, function, member variables. With a setting of 1, full + // backward compatability with the 2.0.x release is possible. + // It is STRONGLY recommended that this be set to 0, as + // future development will be done only on the non-deprecated + // functions/classes/member variables/etc. #define wxUSE_IOSTREAMH 1 // VC++ 4.2 and above allows <iostream> and <iostream.h> diff --git a/include/wx/tbarbase.h b/include/wx/tbarbase.h index e75206df99..863264c290 100644 --- a/include/wx/tbarbase.h +++ b/include/wx/tbarbase.h @@ -206,7 +206,7 @@ protected: }; // a list of toolbar tools -WX_DECLARE_LIST(wxToolBarToolBase, wxToolBarToolsList); +WX_DECLARE_EXPORTED_LIST(wxToolBarToolBase, wxToolBarToolsList); // ---------------------------------------------------------------------------- // the base class for all toolbars diff --git a/include/wx/timer.h b/include/wx/timer.h index eddeb32d2c..7ea894d04a 100644 --- a/include/wx/timer.h +++ b/include/wx/timer.h @@ -222,10 +222,13 @@ long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE); // ---------------------------------------------------------------------------- // Get number of seconds since local time 00:00:00 Jan 1st 1970. -long WXDLLEXPORT wxGetLocalTime(); +extern long WXDLLEXPORT wxGetLocalTime(); // Get number of seconds since GMT 00:00:00, Jan 1st 1970. -long WXDLLEXPORT wxGetUTCTime(); +extern long WXDLLEXPORT wxGetUTCTime(); + +// Get number of milliseconds since local time 00:00:00 Jan 1st 1970 +extern wxLongLong WXDLLEXPORT wxGetLocalTimeMillis(); #define wxGetCurrentTime() wxGetLocalTime() diff --git a/include/wx/txtstrm.h b/include/wx/txtstrm.h index 5b114305a8..9553ce1356 100644 --- a/include/wx/txtstrm.h +++ b/include/wx/txtstrm.h @@ -47,7 +47,7 @@ public: // Operators wxTextInputStream& operator>>(wxString& word); - wxTextInputStream& operator>>(wxChar& c); + wxTextInputStream& operator>>(char& c); wxTextInputStream& operator>>(wxInt16& i); wxTextInputStream& operator>>(wxInt32& i); wxTextInputStream& operator>>(wxUint16& i); @@ -90,7 +90,7 @@ public: wxTextOutputStream& operator<<(const wxChar *string); wxTextOutputStream& operator<<(const wxString& string); - wxTextOutputStream& operator<<(wxChar c); + wxTextOutputStream& operator<<(char c); wxTextOutputStream& operator<<(wxInt16 c); wxTextOutputStream& operator<<(wxInt32 c); wxTextOutputStream& operator<<(wxUint16 c); diff --git a/include/wx/url.h b/include/wx/url.h index 6b15187585..b941e10e16 100644 --- a/include/wx/url.h +++ b/include/wx/url.h @@ -8,6 +8,7 @@ // Copyright: (c) 1997, 1998 Guilhem Lavaux // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// + #ifndef _WX_URL_H #define _WX_URL_H @@ -42,11 +43,11 @@ public: virtual ~wxURL(); wxString GetProtocolName() const { return m_protoinfo->m_protoname; } - wxString GetHostName() const { return m_hostname; } - wxString GetURL() const { return m_url; } - wxProtocol& GetProtocol() { return *m_protocol; } - wxURLError GetError() const { return m_error; } - wxString GetPath() const { return m_path; } + wxString GetHostName() const { return m_hostname; } + wxString GetURL() const { return m_url; } + wxProtocol& GetProtocol() { return *m_protocol; } + wxURLError GetError() const { return m_error; } + wxString GetPath() const { return m_path; } wxInputStream *GetInputStream(); @@ -55,7 +56,10 @@ public: void SetProxy(const wxString& url_proxy); #endif // wxUSE_SOCKETS - static wxString ConvertToValidURI(const wxString& uri); + static wxString ConvertToValidURI( + const wxString& uri, + const wxChar* delims = wxT(";/?:@&=+$,") + ); static wxString ConvertFromURI(const wxString& uri); protected: diff --git a/include/wx/utils.h b/include/wx/utils.h index 2eec7b1c11..491dda2549 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -148,7 +148,13 @@ WXDLLEXPORT long wxExecute(const wxString& command, bool sync = FALSE, wxProcess *process = (wxProcess *) NULL); // execute the command capturing its output into an array line by line -WXDLLEXPORT long wxExecute(const wxString& command, wxArrayString& output); +WXDLLEXPORT long wxExecute(const wxString& command, + wxArrayString& output); + +// also capture stderr +WXDLLEXPORT long wxExecute(const wxString& command, + wxArrayString& output, + wxArrayString& error); enum wxSignal { @@ -320,25 +326,18 @@ class WXDLLEXPORT wxBusyCursor public: wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR) { wxBeginBusyCursor(cursor); } - ~wxBusyCursor() + ~wxBusyCursor() { wxEndBusyCursor(); } -}; -// ---------------------------------------------------------------------------- -// Error message functions used by wxWindows (deprecated, use wxLog) -// ---------------------------------------------------------------------------- - -// Format a message on the standard error (UNIX) or the debugging -// stream (Windows) -WXDLLEXPORT void wxDebugMsg(const wxChar *fmt ...); - -// Non-fatal error (continues) -WXDLLEXPORT_DATA(extern const wxChar*) wxInternalErrorStr; -WXDLLEXPORT void wxError(const wxString& msg, const wxString& title = wxInternalErrorStr); + // FIXME: These two methods are currently only implemented (and needed?) + // in wxGTK. BusyCursor handling should probably be moved to + // common code since the wxGTK and wxMSW implementations are very + // similar except for wxMSW using HCURSOR directly instead of + // wxCursor.. -- RL. + static const wxCursor &GetStoredCursor(); + static const wxCursor GetBusyCursor(); +}; -// Fatal error (exits) -WXDLLEXPORT_DATA(extern const wxChar*) wxFatalErrorStr; -WXDLLEXPORT void wxFatalError(const wxString& msg, const wxString& title = wxFatalErrorStr); // ---------------------------------------------------------------------------- // Reading and writing resources (eg WIN.INI, .Xdefaults) @@ -418,5 +417,22 @@ void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor); #endif // wxUSE_GUI +// ---------------------------------------------------------------------------- +// Error message functions used by wxWindows (deprecated, use wxLog) +// ---------------------------------------------------------------------------- + +// Format a message on the standard error (UNIX) or the debugging +// stream (Windows) +WXDLLEXPORT void wxDebugMsg(const wxChar *fmt ...); + +// Non-fatal error (continues) +WXDLLEXPORT_DATA(extern const wxChar*) wxInternalErrorStr; +WXDLLEXPORT void wxError(const wxString& msg, const wxString& title = wxInternalErrorStr); + +// Fatal error (exits) +WXDLLEXPORT_DATA(extern const wxChar*) wxFatalErrorStr; +WXDLLEXPORT void wxFatalError(const wxString& msg, const wxString& title = wxFatalErrorStr); + + #endif // _WX_UTILSH__ diff --git a/include/wx/version.h b/include/wx/version.h index 77e1bbf05a..d300d9655e 100644 --- a/include/wx/version.h +++ b/include/wx/version.h @@ -1,25 +1,31 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: version.h +// Name: wx/version.h // Purpose: wxWindows version numbers // Author: Julian Smart // Modified by: // Created: 29/01/98 // RCS-ID: $Id$ // Copyright: (c) 1998 Julian Smart -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_VERSIONH__ #define _WX_VERSIONH__ -/* Bump-up with each new version */ +// Bump-up with each new version #define wxMAJOR_VERSION 2 -#define wxMINOR_VERSION 1 -#define wxRELEASE_NUMBER 14 -#define wxVERSION_STRING "wxWindows 2.1.14" +#define wxMINOR_VERSION 2 +#define wxRELEASE_NUMBER 1 +#define wxVERSION_STRING _T("wxWindows 2.2.1") #define wxVERSION_NUMBER (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER #define wxBETA_NUMBER 0 #define wxVERSION_FLOAT wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0) +// check if the current version is at least major.minor.release +#define wxCHECK_VERSION(major,minor,release) \ + (wxMAJOR_VERSION > (major) || \ + (wxMAJOR_VERSION == (major) && wxMINOR_VERSION > (minor)) || \ + (wxMAJOR_VERSION == (major) && wxMINOR_VERSION == (minor) && wxRELEASE_NUMBER >= (release))) + #endif // _WX_VERSIONH__ diff --git a/include/wx/window.h b/include/wx/window.h index 3a1e9362bb..3410f7d3b5 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -58,7 +58,7 @@ class WXDLLEXPORT wxWindow; // (pseudo)template list classes // ---------------------------------------------------------------------------- -WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode); +WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLEXPORT); // ---------------------------------------------------------------------------- // global variables diff --git a/include/wx/wizard.h b/include/wx/wizard.h index 58eb283c51..ec311b7cb9 100644 --- a/include/wx/wizard.h +++ b/include/wx/wizard.h @@ -133,6 +133,11 @@ public: // get the current page (NULL if RunWizard() isn't running) virtual wxWizardPage *GetCurrentPage() const = 0; + // set the min size which should be available for the pages: a + // wizard will take into account the size of the bitmap (if any) + // itself and will never be less than some predefined fixed size + virtual void SetPageSize(const wxSize& size) = 0; + // get the size available for the page: the wizards are not resizeable, so // this size doesn't change virtual wxSize GetPageSize() const = 0; diff --git a/include/wx/wxchar.h b/include/wx/wxchar.h index 2f53037c71..6e6e875c54 100644 --- a/include/wx/wxchar.h +++ b/include/wx/wxchar.h @@ -22,6 +22,10 @@ // # error "MBCS is not supported by wxChar" #endif +// ---------------------------------------------------------------------------- +// first deal with Unicode setting +// ---------------------------------------------------------------------------- + // set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined #if defined(_UNICODE) || defined(UNICODE) # undef wxUSE_UNICODE @@ -30,7 +34,7 @@ # ifndef wxUSE_UNICODE # define wxUSE_UNICODE 0 # endif -#endif +#endif // Unicode // and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1... #if wxUSE_UNICODE @@ -40,7 +44,13 @@ # ifndef UNICODE # define UNICODE # endif -#endif +#endif // Unicode + +// Unicode support requires wchar_t +#if wxUSE_UNICODE +# undef wxUSE_WCHAR_T +# define wxUSE_WCHAR_T 1 +#endif // Unicode // ---------------------------------------------------------------------------- // define wxHAVE_TCHAR_FUNCTIONS for the compilers which support the @@ -98,9 +108,7 @@ // time.h functions -- none defined in tchar.h #define wxAsctime asctime #define wxCtime ctime - - -#endif +#endif // compilers with (good) TCHAR support #ifdef wxHAVE_TCHAR_FUNCTIONS # define HAVE_WCSLEN 1 @@ -116,9 +124,11 @@ typedef _TUCHAR wxUChar; # define wxSChar signed char # define wxUChar unsigned char # endif - // wchar_t is available -# undef wxUSE_WCHAR_T -# define wxUSE_WCHAR_T 1 + + // wchar_t is available + #ifndef wxUSE_WCHAR_T + #define wxUSE_WCHAR_T 1 + #endif // !defined(wxUSE_WCHAR_T) // ctype.h functions #ifndef wxNO_TCHAR_CTYPE @@ -239,10 +249,7 @@ typedef _TUCHAR wxUChar; #else // !TCHAR-aware compilers // check whether we should include wchar.h or equivalent -# if wxUSE_UNICODE -# undef wxUSE_WCHAR_T -# define wxUSE_WCHAR_T 1 // wchar_t *must* be available in Unicode mode -# elif !defined(wxUSE_WCHAR_T) +# if !defined(wxUSE_WCHAR_T) # if defined(__VISUALC__) && (__VISUALC__ < 900) # define wxUSE_WCHAR_T 0 // wchar_t is not available for MSVC++ 1.5 # elif defined(__UNIX__) @@ -263,7 +270,7 @@ typedef _TUCHAR wxUChar; // add additional compiler checks if this fails # define wxUSE_WCHAR_T 1 # endif -# endif//wxUSE_UNICODE +# endif // !defined(wxUSE_WCHAR_T) # if wxUSE_WCHAR_T # ifdef HAVE_WCSTR_H @@ -603,6 +610,8 @@ WXDLLEXPORT size_t wxStrxfrm(wxChar *dest, const wxChar *src, size_t n); # include <stdarg.h> WXDLLEXPORT FILE * wxFopen(const wxChar *path, const wxChar *mode); WXDLLEXPORT FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *stream); +WXDLLEXPORT int wxRemove(const wxChar *path); +WXDLLEXPORT int wxRename(const wxChar *oldpath, const wxChar *newpath); WXDLLEXPORT int wxPrintf(const wxChar *fmt, ...); WXDLLEXPORT int wxVprintf(const wxChar *fmt, va_list argptr); WXDLLEXPORT int wxFprintf(FILE *stream, const wxChar *fmt, ...); @@ -628,6 +637,10 @@ WXDLLEXPORT int wxSystem(const wxChar *psz); WXDLLEXPORT size_t wxStrftime(wxChar *s, size_t max, const wxChar *fmt, const struct tm *tm); #endif +// ---------------------------------------------------------------------------- +// common macros which are always defined +// ---------------------------------------------------------------------------- + // although global macros with such names are really bad, we want to have // another name for _T() which should be used to avoid confusion between _T() // and _() in wxWindows sources diff --git a/include/wx/wxprec.h b/include/wx/wxprec.h index e4f29ad5b4..0bfccf8d0d 100644 --- a/include/wx/wxprec.h +++ b/include/wx/wxprec.h @@ -27,6 +27,10 @@ #ifdef WX_PRECOMP +// include <wx/wxchar.h> first to ensure that UNICODE macro is correctly set +// _before_ including <windows.h> +#include "wx/wxchar.h" + // include standard Windows headers #if defined(__WXMSW__) && !wxUSE_MFC #include <windows.h> diff --git a/include/wx/zipstrm.h b/include/wx/zipstrm.h index 1c4be27845..4b8b4cf346 100644 --- a/include/wx/zipstrm.h +++ b/include/wx/zipstrm.h @@ -28,25 +28,27 @@ class WXDLLEXPORT wxZipInputStream : public wxInputStream { - private: - size_t m_Size; - off_t m_Pos; - void *m_Archive; - // this void* is handle of archive . - // I'm sorry it is void and not proper type but I don't want - // to make unzip.h header public. - - public: - wxZipInputStream(const wxString& archive, const wxString& file); - // archive is name of .zip archive, file is name of file to be extracted. - // Remember that archive must be local file accesible via fopen, fread functions! - ~wxZipInputStream(); - - protected: - virtual size_t GetSize() const {return m_Size;} - virtual size_t OnSysRead(void *buffer, size_t bufsize); - virtual off_t OnSysSeek(off_t seek, wxSeekMode mode); - virtual off_t OnSysTell() const {return m_Pos;} +public: + wxZipInputStream(const wxString& archive, const wxString& file); + // archive is name of .zip archive, file is name of file to be extracted. + // Remember that archive must be local file accesible via fopen, fread functions! + ~wxZipInputStream(); + + virtual size_t GetSize() const {return m_Size;} + virtual bool Eof() const; + +protected: + virtual size_t OnSysRead(void *buffer, size_t bufsize); + virtual off_t OnSysSeek(off_t seek, wxSeekMode mode); + virtual off_t OnSysTell() const {return m_Pos;} + +private: + size_t m_Size; + off_t m_Pos; + + // this void* is handle of archive . I'm sorry it is void and not proper + // type but I don't want to make unzip.h header public. + void *m_Archive; }; @@ -55,20 +57,3 @@ class WXDLLEXPORT wxZipInputStream : public wxInputStream #endif // __ZIPSTREAM_H__ - - - - - - - - - - - - - - - - - diff --git a/lib/wx214.def b/lib/wx22.def similarity index 98% rename from lib/wx214.def rename to lib/wx22.def index ef24d22806..5c8a3b35c0 100644 --- a/lib/wx214.def +++ b/lib/wx22.def @@ -1,11 +1,11 @@ -LIBRARY WX214 INITINSTANCE TERMINSTANCE +LIBRARY WX22 INITINSTANCE TERMINSTANCE PROTMODE DATA MULTIPLE NONSHARED READWRITE LOADONCALL CODE LOADONCALL EXPORTS -;From library: H:\dev\wx2\wxWindows\lib\wx.lib - ;From object file: dummydll.cpp +;From library: G:\DEV\WX22\WXWINDOWS\LIB\wx.lib + ;From object file: dummy.cpp ;PUBDEFs (Symbols available from object file): wxDummyChar ;From object file: ..\common\appcmn.cpp @@ -197,6 +197,8 @@ EXPORTS __ct__21wxPageSetupDialogDataFRC21wxPageSetupDialogData ;wxColourData::wxColourData(const wxColourData&) __ct__12wxColourDataFRC12wxColourData + ;wxPrintData::operator=(const wxPrintSetupData&) + __as__11wxPrintDataFRC16wxPrintSetupData ;wxConstructorForwxPrintDialogData() wxConstructorForwxPrintDialogData__Fv ;wxPrintData::~wxPrintData() @@ -215,6 +217,8 @@ EXPORTS Read__12wxConfigBaseCFRC8wxStringPii ;wxConfigBase::Read(const wxString&,wxString*,const wxString&) const Read__12wxConfigBaseCFRC8wxStringP8wxStringT1 + ;wxConfigBase::~wxConfigBase() + __dt__12wxConfigBaseFv ;wxConfigPathChanger::~wxConfigPathChanger() __dt__19wxConfigPathChangerFv ;wxConfigBase::Read(const wxString&,unsigned long*) const @@ -315,6 +319,12 @@ EXPORTS __dt__15wxDateTimeArrayFv ;wxDateTime::operator+=(const wxDateSpan&) __apl__10wxDateTimeFRC10wxDateSpan + ;wxTimeSpan::Subtract(const wxTimeSpan&) + Subtract__10wxTimeSpanFRC10wxTimeSpan + ;wxDateTime::Subtract(const wxDateSpan&) + Subtract__10wxDateTimeFRC10wxDateSpan + ;wxDateTime::Subtract(const wxDateSpan&) const + Subtract__10wxDateTimeCFRC10wxDateSpan ;wxDateTime::ResetTime() ResetTime__10wxDateTimeFv ;wxDateTime::Now() @@ -341,8 +351,6 @@ EXPORTS __ct__10wxTimeSpanFlN31 ;wxDateTime::Tm::Tm(const tm&,const wxDateTime::TimeZone&) __ct__Q2_10wxDateTime2TmFRC2tmRCQ2_10wxDateTime8TimeZone - ;wxDateTime::Substract(const wxDateTime&) const - Substract__10wxDateTimeCFRC10wxDateTime ;wxDateTime::SetYear(int) SetYear__10wxDateTimeFi ;wxDateTime::SetToLastMonthDay(wxDateTime::Month,int) @@ -359,12 +367,12 @@ EXPORTS GetDayOfYear__10wxDateTimeCFRCQ2_10wxDateTime8TimeZone ;wxDateTime::GetCentury(int) GetCentury__10wxDateTimeFi - ;wxTimeSpan::Substract(const wxTimeSpan&) - Substract__10wxTimeSpanFRC10wxTimeSpan - ;wxDateTime::Tm::Tm() - __ct__Q2_10wxDateTime2TmFv ;wxDateTime::SetToWeekDay(wxDateTime::WeekDay,int,wxDateTime::Month,int) SetToWeekDay__10wxDateTimeFQ2_10wxDateTime7WeekDayiQ2_10wxDateTime5MonthT2 + ;wxDateTime::Tm::Tm() + __ct__Q2_10wxDateTime2TmFv + ;wxDateTime::Subtract(const wxTimeSpan&) + Subtract__10wxDateTimeFRC10wxTimeSpan ;wxDateTime::GetNumberOfDays(wxDateTime::Month,int,wxDateTime::Calendar) GetNumberOfDays__10wxDateTimeFQ2_10wxDateTime5MonthiQ2_10wxDateTime8Calendar ;wxTimeSpan::GetHours() const @@ -425,10 +433,6 @@ EXPORTS AddMonths__Q2_10wxDateTime2TmFi ;wxDateTime::TimeZone::TimeZone(wxDateTime::TZ) __ct__Q2_10wxDateTime8TimeZoneFQ2_10wxDateTime2TZ - ;wxDateTime::Substract(const wxTimeSpan&) const - Substract__10wxDateTimeCFRC10wxTimeSpan - ;wxDateTime::Substract(const wxDateSpan&) const - Substract__10wxDateTimeCFRC10wxDateSpan ;wxDateSpan::Neg() Neg__10wxDateSpanFv ;wxDateTime::IsLeapYear(int,wxDateTime::Calendar) @@ -454,6 +458,8 @@ EXPORTS __vft18wxDateTimeWorkDays26wxDateTimeHolidayAuthority ;wxDateTime::TIME_T_FACTOR TIME_T_FACTOR__10wxDateTime + ;wxDateTime::Subtract(const wxDateTime&) const + Subtract__10wxDateTimeCFRC10wxDateTime ;wxDateTime::SetToWeekDayInSameWeek(wxDateTime::WeekDay) SetToWeekDayInSameWeek__10wxDateTimeFQ2_10wxDateTime7WeekDay ;wxDateTime::SetToTheWeek(unsigned short,wxDateTime::WeekDay) @@ -480,8 +486,8 @@ EXPORTS __apl__10wxDateTimeFRC10wxTimeSpan ;wxDateTime::operator-=(const wxDateSpan&) __ami__10wxDateTimeFRC10wxDateSpan - ;wxDateTime::Substract(const wxDateSpan&) - Substract__10wxDateTimeFRC10wxDateSpan + ;wxTimeSpan::Subtract(const wxTimeSpan&) const + Subtract__10wxTimeSpanCFRC10wxTimeSpan ;wxDateTime::SetToCurrent() SetToCurrent__10wxDateTimeFv ;wxDateSpan::Negate() const @@ -543,10 +549,8 @@ EXPORTS __ami__10wxDateTimeFRC10wxTimeSpan ;wxDateTime::Today() Today__10wxDateTimeFv - ;wxTimeSpan::Substract(const wxTimeSpan&) const - Substract__10wxTimeSpanCFRC10wxTimeSpan - ;wxDateTime::Substract(const wxTimeSpan&) - Substract__10wxDateTimeFRC10wxTimeSpan + ;wxDateTime::Subtract(const wxTimeSpan&) const + Subtract__10wxDateTimeCFRC10wxTimeSpan ;wxDateTime::IsEqualUpTo(const wxDateTime&,const wxTimeSpan&) const IsEqualUpTo__10wxDateTimeCFRC10wxDateTimeRC10wxTimeSpan ;wxDateTime::GetWeekDay(wxDateTime::WeekDay,int,wxDateTime::Month,int) const @@ -1158,6 +1162,8 @@ EXPORTS ;wxLibrary::PrepareClasses(wxClassInfo*) PrepareClasses__9wxLibraryFP11wxClassInfo __vft9wxLibrary8wxObject + ;wxDllLoader::GetDllExt() + GetDllExt__11wxDllLoaderFv ;wxLibraries::LoadLibrary(const wxString&) LoadLibrary__11wxLibrariesFRC8wxString wxTheLibraries @@ -1167,14 +1173,20 @@ EXPORTS GetAllEquivalents__19wxEncodingConverterF14wxFontEncoding ;wxEncodingConverter::wxEncodingConverter() __ct__19wxEncodingConverterFv + ;wxEncodingConverter::Convert(const char*,wchar_t*) + Convert__19wxEncodingConverterFPCcPw ;wxEncodingConverter::Init(wxFontEncoding,wxFontEncoding,int) Init__19wxEncodingConverterF14wxFontEncodingT1i + ;wxEncodingConverter::Convert(const wchar_t*,char*) + Convert__19wxEncodingConverterFPCwPc ;wxEncodingConverter::Convert(const wxString&) Convert__19wxEncodingConverterFRC8wxString ;wxEncodingConverter::GetPlatformEquivalents(wxFontEncoding,int) GetPlatformEquivalents__19wxEncodingConverterF14wxFontEncodingi ;wxEncodingConverter::Convert(const char*,char*) Convert__19wxEncodingConverterFPCcPc + ;wxEncodingConverter::Convert(const wchar_t*,wchar_t*) + Convert__19wxEncodingConverterFPCwPw ;From object file: ..\common\event.cpp ;PUBDEFs (Symbols available from object file): ;wxEvent::CopyObject(wxObject&) const @@ -1411,7 +1423,7 @@ EXPORTS wxConstructorForwxFocusEvent__Fv ;wxEvtHandler::sm_eventTable sm_eventTable__12wxEvtHandler - ;From object file: H:\DEV\WX2\WXWINDOWS\src\common\extended.c + ;From object file: G:\DEV\WX22\WXWINDOWS\src\common\extended.c ;PUBDEFs (Symbols available from object file): ConvertToIeeeExtended ConvertFromIeeeExtended @@ -1814,6 +1826,8 @@ EXPORTS CreateToolBar__11wxFrameBaseFliRC8wxString ;wxFrameBase::OnMenuHighlight(wxMenuEvent&) OnMenuHighlight__11wxFrameBaseFR11wxMenuEvent + ;wxFrameBase::ShowMenuHelp(wxStatusBar*,int) + ShowMenuHelp__11wxFrameBaseFP11wxStatusBari ;wxFrameBase::GetEventTable() const GetEventTable__11wxFrameBaseCFv __vft11wxFrameBase8wxObject @@ -1929,6 +1943,8 @@ EXPORTS SendCommand__5wxFTPFRC8wxStringc ;wxFTP::GetOutputStream(const wxString&) GetOutputStream__5wxFTPFRC8wxString + ;wxFTP::GetList(wxArrayString&,const wxString&) + GetList__5wxFTPFR13wxArrayStringRC8wxString ;wxFTP::sm_classwxFTP sm_classwxFTP__5wxFTP ;From object file: ..\common\gdicmn.cpp @@ -2221,6 +2237,8 @@ EXPORTS __vft12wxBMPHandler8wxObject ;From object file: ..\common\image.cpp ;PUBDEFs (Symbols available from object file): + ;wxImage::wxImage(int,int,unsigned char*,unsigned long) + __ct__7wxImageFiT1PUcUl ;wxImage::GetSubImage(const wxRect&) const GetSubImage__7wxImageCFRC6wxRect ;wxImage::FindHandler(long) @@ -2233,6 +2251,10 @@ EXPORTS __ct__7wxImageFiT1 ;wxImageModule::sm_classwxImageModule sm_classwxImageModule__13wxImageModule + ;wxImage::GetRed(int,int) const + GetRed__7wxImageCFiT1 + ;wxImage::GetGreen(int,int) const + GetGreen__7wxImageCFiT1 ;wxConstructorForwxImage() wxConstructorForwxImage__Fv ;wxImage::Ok() const @@ -2247,11 +2269,15 @@ EXPORTS GetData__7wxImageCFv ;wxImage::Destroy() Destroy__7wxImageFv + ;wxImage::Copy() const + Copy__7wxImageCFv ;wxImage::FindHandlerMime(const wxString&) FindHandlerMime__7wxImageFRC8wxString + ;wxImage::Mirror(unsigned long) const + Mirror__7wxImageCFUl + __vft14wxImageHandler8wxObject ;wxImage::LoadFile(const wxString&,long) LoadFile__7wxImageFRC8wxStringl - __vft14wxImageHandler8wxObject ;wxImage::Scale(int,int) const Scale__7wxImageCFiT1 ;wxImage::sm_handlers @@ -2291,6 +2317,8 @@ EXPORTS wxConstructorForwxImageModule__Fv ;wxImage::wxImage() __ct__7wxImageFv + ;wxImage::Paste(const wxImage&,int,int) + Paste__7wxImageFRC7wxImageiT2 ;wxImage::HasMask() const HasMask__7wxImageCFv ;wxImage::GetMaskRed() const @@ -2301,10 +2329,14 @@ EXPORTS RemoveHandler__7wxImageFRC8wxString ;wxImage::FindHandler(const wxString&) FindHandler__7wxImageFRC8wxString + ;wxImage::Create(int,int,unsigned char*,unsigned long) + Create__7wxImageFiT1PUcUl ;wxImage::wxImage(wxInputStream&,long) __ct__7wxImageFR13wxInputStreaml ;wxImage::SetMask(unsigned long) SetMask__7wxImageFUl + ;wxImage::Rotate90(unsigned long) const + Rotate90__7wxImageCFUl ;wxImage::Create(int,int) Create__7wxImageFiT1 __vft14wxImageRefData15wxObjectRefData @@ -2314,10 +2346,10 @@ EXPORTS SetMaskColour__7wxImageFUcN21 ;wxImageHandler::GetImageCount(wxInputStream&) GetImageCount__14wxImageHandlerFR13wxInputStream - ;wxImage::GetGreen(int,int) - GetGreen__7wxImageFiT1 ;wxImage::ConvertToBitmap() const ConvertToBitmap__7wxImageCFv + ;wxImage::SetData(unsigned char*,int,int) + SetData__7wxImageFPUciT2 ;wxImage::GetMaskBlue() const GetMaskBlue__7wxImageCFv ;wxImage::GetHeight() const @@ -2334,14 +2366,12 @@ EXPORTS SaveFile__14wxImageHandlerFP7wxImageR14wxOutputStreamUl ;wxImage::LoadFile(wxInputStream&,long) LoadFile__7wxImageFR13wxInputStreaml - ;wxImage::GetRed(int,int) - GetRed__7wxImageFiT1 + ;wxImage::GetBlue(int,int) const + GetBlue__7wxImageCFiT1 ;wxImage::sm_classwxImage sm_classwxImage__7wxImage ;wxImage::SaveFile(const wxString&,const wxString&) SaveFile__7wxImageFRC8wxStringT1 - ;wxImage::GetBlue(int,int) - GetBlue__7wxImageFiT1 ;wxImage::ComputeHistogram(wxHashTable&) ComputeHistogram__7wxImageFR11wxHashTable ;wxImage::CanRead(wxInputStream&) @@ -2448,8 +2478,6 @@ EXPORTS AddCatalog__8wxLocaleFPCc ;wxMsgCatalog::Load(const char*,const char*,unsigned long) Load__12wxMsgCatalogFPCcT1Ul - ;wxSuppressTransErrors() - wxSuppressTransErrors__Fv ;wxLocale::wxLocale() __ct__8wxLocaleFv ;wxLocale::Init(const char*,const char*,const char*,unsigned long,unsigned long) @@ -2458,14 +2486,12 @@ EXPORTS GetString__8wxLocaleCFPCcT1 ;wxGetLocale() wxGetLocale__Fv + ;NoTransErr::ms_suppressCount + ms_suppressCount__10NoTransErr ;wxMsgCatalog::GetString(const char*) const GetString__12wxMsgCatalogCFPCc ;wxLocale::FindCatalog(const char*) const FindCatalog__8wxLocaleCFPCc - ;wxRestoreTransErrors() - wxRestoreTransErrors__Fv - ;wxIsLoggingTransErrors() - wxIsLoggingTransErrors__Fv ;wxLocale::AddCatalogLookupPathPrefix(const wxString&) AddCatalogLookupPathPrefix__8wxLocaleFRC8wxString ;wxLocale::IsLoaded(const char*) const @@ -2819,8 +2845,6 @@ EXPORTS debugOn__14wxDebugContext ;wxDebugContext::checkPoint checkPoint__14wxDebugContext - ;operator new(unsigned int,char*,int) - __nw__FUiPci ;wxDebugContext::PaddedSize(const unsigned int) PaddedSize__14wxDebugContextFCUi ;wxMemStruct::AssertIt() @@ -2843,8 +2867,6 @@ EXPORTS m_balign__14wxDebugContext ;wxDebugContext::EndMarkerPos(const char*,const unsigned int) EndMarkerPos__14wxDebugContextFPCcCUi - ;operator new(unsigned int) - __nw__FUi ;wxMemStruct::AssertList() AssertList__11wxMemStructFv ;wxMemStruct::ErrorMsg(const char*) @@ -2871,10 +2893,6 @@ EXPORTS GetPadding__14wxDebugContextFCUi ;wxTrace(const char*,...) wxTrace__FPCce - ;operator new[](unsigned int,char*,int) - __vn__FUiPci - ;operator new[](unsigned int) - __vn__FUi ;wxDebugContext::TotSize(const unsigned int) TotSize__14wxDebugContextFCUi ;wxMemStruct::PrintNode() @@ -2893,8 +2911,6 @@ EXPORTS m_head__14wxDebugContext ;wxMemStruct::Append() Append__11wxMemStructFv - ;operator delete[](void*) - __vd__FPv ;wxDebugContext::Dump() Dump__14wxDebugContextFv ;From object file: ..\common\menucmn.cpp @@ -2915,12 +2931,12 @@ EXPORTS FindMenu__13wxMenuBarBaseCFRC8wxString ;wxMenuBarBase::SetHelpString(int,const wxString&) SetHelpString__13wxMenuBarBaseFiRC8wxString + ;wxMenuBase::Insert(unsigned int,wxMenuItem*) + Insert__10wxMenuBaseFUiP10wxMenuItem ;wxMenuBase::Remove(wxMenuItem*) Remove__10wxMenuBaseFP10wxMenuItem ;wxMenuBase::IsChecked(int) const IsChecked__10wxMenuBaseCFi - ;wxMenuBase::Insert(unsigned int,wxMenuItem*) - Insert__10wxMenuBaseFUiP10wxMenuItem ;wxMenuBarBase::GetLabel(int) const GetLabel__13wxMenuBarBaseCFi ;wxMenuBase::GetLabel(int) const @@ -3125,8 +3141,6 @@ EXPORTS StoreObject__8wxObjectFR20wxObjectOutputStream ;wxObjectRefData::~wxObjectRefData() __dt__15wxObjectRefDataFv - ;wxObject::operator delete[](void*) - __vd__8wxObjectFPv ;wxObject::Clone() const Clone__8wxObjectCFv ;wxClassInfo::sm_first @@ -3150,8 +3164,6 @@ EXPORTS sm_classwxObject__8wxObject ;wxObject::operator new(unsigned int,char*,int) __nw__8wxObjectFUiPci - ;wxObject::operator new[](unsigned int,char*,int) - __vn__8wxObjectFUiPci ;wxObject::wxObject() __ct__8wxObjectFv ;wxObject::~wxObject() @@ -3198,6 +3210,7 @@ EXPORTS ReadObjectDef__19wxObjectInputStreamFP18wxObjectStreamInfo ;wxObjectInputStream::RemoveChildren(int) RemoveChildren__19wxObjectInputStreamFi + ;From object file: ..\common\odbc.cpp ;From object file: ..\common\paper.cpp ;PUBDEFs (Symbols available from object file): __vft18wxPrintPaperModule8wxObject @@ -3410,25 +3423,21 @@ EXPORTS Detach__9wxProcessFv ;From object file: ..\common\protocol.cpp ;PUBDEFs (Symbols available from object file): - __vft16wxProtocolModule8wxObject ;wxProtocol::wxProtocol() __ct__10wxProtocolFv ;wxProtocol::Reconnect() Reconnect__10wxProtocolFv - ;wxProtocolModule::OnInit() - OnInit__16wxProtocolModuleFv - ;wxProtocolModule::OnExit() - OnExit__16wxProtocolModuleFv + ;wxProtocol::ReadLine(wxString&) + ReadLine__10wxProtocolFR8wxString ;wxProtocol::sm_classwxProtocol sm_classwxProtocol__10wxProtocol - ;wxConstructorForwxProtocolModule() - wxConstructorForwxProtocolModule__Fv + __vft10wxProtocol8wxObject ;wxProtoInfo::wxProtoInfo(const char*,const char*,const unsigned long,wxClassInfo*) __ct__11wxProtoInfoFPCcT1CUlP11wxClassInfo ;GetLine(wxSocketBase*,wxString&) GetLine__FP12wxSocketBaseR8wxString - ;wxProtocolModule::sm_classwxProtocolModule - sm_classwxProtocolModule__16wxProtocolModule + ;wxProtocol::ReadLine(wxSocketBase*,wxString&) + ReadLine__10wxProtocolFP12wxSocketBaseR8wxString ;From object file: ..\common\resource.cpp ;PUBDEFs (Symbols available from object file): ;wxResourceTable::ParseResourceFile(wxInputStream*) @@ -3621,14 +3630,16 @@ EXPORTS Advise__15wxTCPConnectionFRC8wxStringPci11wxIPCFormat ;wxTCPClient::wxTCPClient() __ct__11wxTCPClientFv + ;wxTCPEventHandler::sm_eventTableEntries + sm_eventTableEntries__17wxTCPEventHandler ;wxTCPServer::sm_classwxTCPServer sm_classwxTCPServer__11wxTCPServer - ;Client_OnRequest(wxSocketBase&,wxSocketNotify,char*) - Client_OnRequest__FR12wxSocketBase14wxSocketNotifyPc ;wxTCPClient::sm_classwxTCPClient sm_classwxTCPClient__11wxTCPClient ;wxConstructorForwxTCPServer() wxConstructorForwxTCPServer__Fv + ;wxConstructorForwxTCPEventHandlerModule() + wxConstructorForwxTCPEventHandlerModule__Fv ;wxTCPServer::~wxTCPServer() __dt__11wxTCPServerFv ;wxTCPConnection::Disconnect() @@ -3637,34 +3648,43 @@ EXPORTS ValidHost__11wxTCPClientFRC8wxString ;wxTCPConnection::StartAdvise(const wxString&) StartAdvise__15wxTCPConnectionFRC8wxString - ;Server_OnRequest(wxSocketServer&,wxSocketNotify,char*) - Server_OnRequest__FR14wxSocketServer14wxSocketNotifyPc ;wxTCPServer::OnAcceptConnection(const wxString&) OnAcceptConnection__11wxTCPServerFRC8wxString ;wxTCPServer::Create(const wxString&) Create__11wxTCPServerFRC8wxString ;wxTCPConnection::Poke(const wxString&,char*,int,wxIPCFormat) Poke__15wxTCPConnectionFRC8wxStringPci11wxIPCFormat + ;wxTCPEventHandler::Client_OnRequest(wxSocketEvent&) + Client_OnRequest__17wxTCPEventHandlerFR13wxSocketEvent ;wxTCPClient::MakeConnection(const wxString&,const wxString&,const wxString&) MakeConnection__11wxTCPClientFRC8wxStringN21 + ;wxTCPEventHandlerModule::sm_classwxTCPEventHandlerModule + sm_classwxTCPEventHandlerModule__23wxTCPEventHandlerModule ;wxTCPConnection::wxTCPConnection(char*,int) __ct__15wxTCPConnectionFPci ;wxTCPServer::wxTCPServer() __ct__11wxTCPServerFv ;wxConstructorForwxTCPClient() wxConstructorForwxTCPClient__Fv + ;wxTCPEventHandler::sm_eventTable + sm_eventTable__17wxTCPEventHandler ;wxTCPConnection::~wxTCPConnection() __dt__15wxTCPConnectionFv ;wxTCPConnection::Execute(const char*,int,wxIPCFormat) Execute__15wxTCPConnectionFPCci11wxIPCFormat + __vft17wxTCPEventHandler8wxObject ;wxTCPConnection::Request(const wxString&,int*,wxIPCFormat) Request__15wxTCPConnectionFRC8wxStringPi11wxIPCFormat ;wxTCPConnection::wxTCPConnection() __ct__15wxTCPConnectionFv ;wxTCPConnection::sm_classwxTCPConnection sm_classwxTCPConnection__15wxTCPConnection + ;wxTCPEventHandler::GetEventTable() const + GetEventTable__17wxTCPEventHandlerCFv ;wxTCPConnection::StopAdvise(const wxString&) StopAdvise__15wxTCPConnectionFRC8wxString + ;wxTCPEventHandler::Server_OnRequest(wxSocketEvent&) + Server_OnRequest__17wxTCPEventHandlerFR13wxSocketEvent __vft11wxTCPClient8wxObject ;wxTCPClient::~wxTCPClient() __dt__11wxTCPClientFv @@ -3720,26 +3740,42 @@ EXPORTS ;PUBDEFs (Symbols available from object file): ;wxSizerItem::wxSizerItem(int,int,int,int,int,wxObject*) __ct__11wxSizerItemFiN41P8wxObject + __vft11wxGridSizer8wxObject ;wxSizerItem::wxSizerItem(wxSizer*,int,int,int,wxObject*) __ct__11wxSizerItemFP7wxSizeriN22P8wxObject ;wxSizer::Insert(int,wxSizer*,int,int,int,wxObject*) Insert__7wxSizerFiP7wxSizerN31P8wxObject ;wxSizer::Add(wxWindow*,int,int,int,wxObject*) Add__7wxSizerFP8wxWindowiN22P8wxObject + ;wxSizer::DoSetItemMinSize(int,int,int) + DoSetItemMinSize__7wxSizerFiN21 ;wxStaticBoxSizer::wxStaticBoxSizer(wxStaticBox*,int) __ct__16wxStaticBoxSizerFP11wxStaticBoxi - ;wxBoxSizer::CalcMin() - CalcMin__10wxBoxSizerFv + ;wxGridSizer::wxGridSizer(int,int,int) + __ct__11wxGridSizerFiN21 + ;wxSizer::DoSetItemMinSize(wxWindow*,int,int) + DoSetItemMinSize__7wxSizerFP8wxWindowiT2 ;wxStaticBoxSizer::sm_classwxStaticBoxSizer sm_classwxStaticBoxSizer__16wxStaticBoxSizer + ;wxGridSizer::sm_classwxGridSizer + sm_classwxGridSizer__11wxGridSizer + ;wxFlexGridSizer::RecalcSizes() + RecalcSizes__15wxFlexGridSizerFv + ;wxGridSizer::RecalcSizes() + RecalcSizes__11wxGridSizerFv ;wxStaticBoxSizer::CalcMin() CalcMin__16wxStaticBoxSizerFv + ;wxFlexGridSizer::CalcMin() + CalcMin__15wxFlexGridSizerFv + ;wxBoxSizer::CalcMin() + CalcMin__10wxBoxSizerFv ;wxSizer::Fit(wxWindow*) Fit__7wxSizerFP8wxWindow ;wxSizer::GetMinWindowSize(wxWindow*) GetMinWindowSize__7wxSizerFP8wxWindow ;wxSizer::Prepend(wxWindow*,int,int,int,wxObject*) Prepend__7wxSizerFP8wxWindowiN22P8wxObject + __vft15wxFlexGridSizer8wxObject __vft11wxSizerItem8wxObject ;wxSizer::Insert(int,wxWindow*,int,int,int,wxObject*) Insert__7wxSizerFiP8wxWindowN31P8wxObject @@ -3749,6 +3785,12 @@ EXPORTS SetDimension__11wxSizerItemF7wxPoint6wxSize ;wxSizerItem::sm_classwxSizerItem sm_classwxSizerItem__11wxSizerItem + ;wxFlexGridSizer::wxFlexGridSizer(int,int,int) + __ct__15wxFlexGridSizerFiN21 + ;wxGridSizer::wxGridSizer(int,int,int,int) + __ct__11wxGridSizerFiN31 + ;wxFlexGridSizer::RemoveGrowableRow(unsigned int) + RemoveGrowableRow__15wxFlexGridSizerFUi ;wxSizer::~wxSizer() __dt__7wxSizerFv ;wxSizer::sm_classwxSizer @@ -3768,26 +3810,38 @@ EXPORTS __vft7wxSizer8wxObject ;wxSizer::Remove(int) Remove__7wxSizerFi - ;wxSizerItem::IsSpacer() - IsSpacer__11wxSizerItemFv + ;wxSizer::GetMinSize() + GetMinSize__7wxSizerFv + ;wxFlexGridSizer::~wxFlexGridSizer() + __dt__15wxFlexGridSizerFv ;wxSizer::wxSizer() __ct__7wxSizerFv ;wxBoxSizer::RecalcSizes() RecalcSizes__10wxBoxSizerFv + ;wxSizerItem::IsSpacer() + IsSpacer__11wxSizerItemFv + ;wxFlexGridSizer::CreateArrays() + CreateArrays__15wxFlexGridSizerFv ;wxSizer::SetSizeHints(wxWindow*) SetSizeHints__7wxSizerFP8wxWindow ;wxSizer::Add(wxSizer*,int,int,int,wxObject*) Add__7wxSizerFP7wxSizeriN22P8wxObject ;wxSizer::Prepend(int,int,int,int,int,wxObject*) Prepend__7wxSizerFiN41P8wxObject + ;wxFlexGridSizer::AddGrowableCol(unsigned int) + AddGrowableCol__15wxFlexGridSizerFUi ;wxBoxSizer::wxBoxSizer(int) __ct__10wxBoxSizerFi ;wxSizerItem::IsSizer() IsSizer__11wxSizerItemFv + ;wxFlexGridSizer::sm_classwxFlexGridSizer + sm_classwxFlexGridSizer__15wxFlexGridSizer ;wxBoxSizer::sm_classwxBoxSizer sm_classwxBoxSizer__10wxBoxSizer ;wxSizer::Remove(wxSizer*) Remove__7wxSizerFP7wxSizer + ;wxSizer::DoSetItemMinSize(wxSizer*,int,int) + DoSetItemMinSize__7wxSizerFP7wxSizeriT2 ;wxSizerItem::wxSizerItem(wxWindow*,int,int,int,wxObject*) __ct__11wxSizerItemFP8wxWindowiN22P8wxObject __vft16wxStaticBoxSizer8wxObject @@ -3798,8 +3852,20 @@ EXPORTS Add__7wxSizerFiN41P8wxObject ;wxSizer::SetDimension(int,int,int,int) SetDimension__7wxSizerFiN31 + ;wxFlexGridSizer::wxFlexGridSizer(int,int,int,int) + __ct__15wxFlexGridSizerFiN31 + ;wxFlexGridSizer::RemoveGrowableCol(unsigned int) + RemoveGrowableCol__15wxFlexGridSizerFUi + ;wxSizer::DoSetMinSize(int,int) + DoSetMinSize__7wxSizerFiT1 + ;wxFlexGridSizer::AddGrowableRow(unsigned int) + AddGrowableRow__15wxFlexGridSizerFUi ;wxSizer::Layout() Layout__7wxSizerFv + ;wxGridSizer::SetItemBounds(wxSizerItem*,int,int,int,int) + SetItemBounds__11wxGridSizerFP11wxSizerItemiN32 + ;wxGridSizer::CalcMin() + CalcMin__11wxGridSizerFv ;From object file: ..\common\socket.cpp ;PUBDEFs (Symbols available from object file): ;wxSocketBase::SetTimeout(long) @@ -3887,12 +3953,8 @@ EXPORTS __ct__12wxSocketBaseFv ;wxConstructorForwxSocketModule() wxConstructorForwxSocketModule__Fv - ;wxSocketBase::Callback(void(*)(wxSocketBase&,wxSocketNotify,char*)) - Callback__12wxSocketBaseFPFR12wxSocketBase14wxSocketNotifyPc_v ;wxSocketBase::GetPeer(wxSockAddress&) const GetPeer__12wxSocketBaseCFR13wxSockAddress - ;wxSocketBase::CallbackData(char*) - CallbackData__12wxSocketBaseFPc ;wxSocketBase::Notify(unsigned long) Notify__12wxSocketBaseFUl ;wxSocketServer::Accept(unsigned long) @@ -3923,27 +3985,17 @@ EXPORTS cMB2WC__8wxMBConvCFPCc ;wxCSConv::SetName(const char*) SetName__8wxCSConvFPCc - ;wxCSArray::Index(const wxCharacterSet&,unsigned long) const - Index__9wxCSArrayCFRC14wxCharacterSetUl ;wxMBConvUTF7::MB2WC(wchar_t*,const char*,unsigned int) const MB2WC__12wxMBConvUTF7CFPwPCcUi ;wxMBConvUTF8::WC2MB(char*,const wchar_t*,unsigned int) const WC2MB__12wxMBConvUTF8CFPcPCwUi - ;wxCSArray::RemoveAt(unsigned int) - RemoveAt__9wxCSArrayFUi ;wxMBConvUTF8::MB2WC(wchar_t*,const char*,unsigned int) const MB2WC__12wxMBConvUTF8CFPwPCcUi - ;wxCSArray::DoCopy(const wxCSArray&) - DoCopy__9wxCSArrayFRC9wxCSArray __vft12wxMBConvFile8wxMBConv __vft12wxMBConvUTF88wxMBConv wxConvCurrent ;wxMBConv::WC2MB(char*,const wchar_t*,unsigned int) const WC2MB__8wxMBConvCFPcPCwUi - ;wxCSArray::wxCSArray(const wxCSArray&) - __ct__9wxCSArrayFRC9wxCSArray - ;wxCSArray::Insert(const wxCharacterSet&,unsigned int) - Insert__9wxCSArrayFRC14wxCharacterSetUi ;wxCSConv::~wxCSConv() __dt__8wxCSConvFv wxConvUTF7 @@ -3952,8 +4004,6 @@ EXPORTS ;wxMBConvFile::MB2WC(wchar_t*,const char*,unsigned int) const MB2WC__12wxMBConvFileCFPwPCcUi wxConvFile - ;wxCSArray::operator=(const wxCSArray&) - __as__9wxCSArrayFRC9wxCSArray ;wxCSConv::WC2MB(char*,const wchar_t*,unsigned int) const WC2MB__8wxCSConvCFPcPCwUi ;wxMBConvUTF7::WC2MB(char*,const wchar_t*,unsigned int) const @@ -3962,19 +4012,13 @@ EXPORTS WC2MB__12wxMBConvFileCFPcPCwUi ;wxCSConv::MB2WC(wchar_t*,const char*,unsigned int) const MB2WC__8wxCSConvCFPwPCcUi - ;wxCSArray::~wxCSArray() - __dt__9wxCSArrayFv ;wxCSConv::LoadNow() LoadNow__8wxCSConvFv ;wxCSConv::wxCSConv(const char*) __ct__8wxCSConvFPCc wxConvLibc - ;wxCSArray::Add(const wxCharacterSet&) - Add__9wxCSArrayFRC14wxCharacterSet ;wxMBConv::MB2WC(wchar_t*,const char*,unsigned int) const MB2WC__8wxMBConvCFPwPCcUi - ;wxCSArray::Empty() - Empty__9wxCSArrayFv __vft8wxMBConv ;wxMBConv::cWC2MB(const wchar_t*) const cWC2MB__8wxMBConvCFPCw @@ -4224,8 +4268,6 @@ EXPORTS npos__8wxString ;operator+(const char*,const wxString&) __pl__FPCcRC8wxString - ;wxString::wxString(const wchar_t*) - __ct__8wxStringFPCw ;wxString::operator=(const unsigned char*) __as__8wxStringFPCUc ;wxArrayString::operator=(const wxArrayString&) @@ -4278,6 +4320,8 @@ EXPORTS __pl__FRC8wxStringPCc ;wxString::operator=(const wchar_t*) __as__8wxStringFPCw + ;wxString::StartsWith(const char*,wxString*) const + StartsWith__8wxStringCFPCcP8wxString ;wxArrayString::Remove(const char*) Remove__13wxArrayStringFPCc ;wxString::ConcatSelf(int,const char*) @@ -4326,6 +4370,8 @@ EXPORTS rfind__8wxStringCFPCcUiT2 ;wxArrayString::~wxArrayString() __dt__13wxArrayStringFv + ;wxString::wxString(const wchar_t*,wxMBConv&) + __ct__8wxStringFPCwR8wxMBConv ;wxString::Lower() const Lower__8wxStringCFv ;wxArrayString::Free() @@ -4607,7 +4653,7 @@ EXPORTS Read32__17wxTextInputStreamFv ;wxTextInputStream::SkipIfEndOfLine(char) SkipIfEndOfLine__17wxTextInputStreamFc - ;From object file: H:\DEV\WX2\WXWINDOWS\src\common\unzip.c + ;From object file: G:\DEV\WX22\WXWINDOWS\src\common\unzip.c ;PUBDEFs (Symbols available from object file): unzReadCurrentFile unzGetCurrentFileInfo @@ -4629,35 +4675,46 @@ EXPORTS ;PUBDEFs (Symbols available from object file): ;wxURL::PrepProto(wxString&) PrepProto__5wxURLFR8wxString - ;wxURL::ConvertToValidURI(const wxString&) - ConvertToValidURI__5wxURLFRC8wxString + ;wxURL::ConvertToValidURI(const wxString&,const char*) + ConvertToValidURI__5wxURLFRC8wxStringPCc ;wxURL::ConvertFromURI(const wxString&) ConvertFromURI__5wxURLFRC8wxString + ;wxURL::ms_protocols + ms_protocols__5wxURL + __vft11wxURLModule8wxObject + ;wxURLModule::sm_classwxURLModule + sm_classwxURLModule__11wxURLModule ;wxURL::SetProxy(const wxString&) SetProxy__5wxURLFRC8wxString ;wxProtoInfo::sm_classwxProtoInfo sm_classwxProtoInfo__11wxProtoInfo - ;wxURL::g_proxy - g_proxy__5wxURL + ;wxURL::ms_useDefaultProxy + ms_useDefaultProxy__5wxURL ;wxURL::ParseURL() ParseURL__5wxURLFv ;wxURL::~wxURL() __dt__5wxURLFv + ;wxURLModule::OnInit() + OnInit__11wxURLModuleFv ;wxURL::GetInputStream() GetInputStream__5wxURLFv ;wxURL::SetDefaultProxy(const wxString&) SetDefaultProxy__5wxURLFRC8wxString - ;wxURL::g_protocols - g_protocols__5wxURL ;wxURL::CleanData() CleanData__5wxURLFv + ;wxURLModule::OnExit() + OnExit__11wxURLModuleFv ;wxURL::PrepPath(wxString&) PrepPath__5wxURLFR8wxString ;wxURL::sm_classwxURL sm_classwxURL__5wxURL + ;wxURL::ms_proxyDefault + ms_proxyDefault__5wxURL __vft5wxURL8wxObject ;wxURL::FetchProtocol() FetchProtocol__5wxURLFv + ;wxConstructorForwxURLModule() + wxConstructorForwxURLModule__Fv ;wxURL::wxURL(const wxString&) __ct__5wxURLFRC8wxString ;wxURL::PrepHost(wxString&) @@ -6335,6 +6392,8 @@ EXPORTS SetViewer__19wxExtHelpControllerFRC8wxStringl ;From object file: ..\generic\helphtml.cpp ;PUBDEFs (Symbols available from object file): + ;wxHTMLHelpControllerBase::DisplaySection(const wxString&) + DisplaySection__24wxHTMLHelpControllerBaseFRC8wxString ;wxHTMLHelpControllerBase::DisplaySection(int) DisplaySection__24wxHTMLHelpControllerBaseFi ;wxHTMLHelpControllerBase::Initialize(const wxString&) @@ -6472,12 +6531,14 @@ EXPORTS LayoutMDIFrame__17wxLayoutAlgorithmFP16wxMDIParentFrameP6wxRect ;wxLayoutAlgorithm::LayoutWindow(wxWindow*,wxWindow*) LayoutWindow__17wxLayoutAlgorithmFP8wxWindowT1 + ;wxSashLayoutWindow::Init() + Init__18wxSashLayoutWindowFv ;wxConstructorForwxCalculateLayoutEvent() wxConstructorForwxCalculateLayoutEvent__Fv + ;wxSashLayoutWindow::Create(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&) + Create__18wxSashLayoutWindowFP8wxWindowiRC7wxPointRC6wxSizelRC8wxString ;wxSashLayoutWindow::GetEventTable() const GetEventTable__18wxSashLayoutWindowCFv - ;wxSashLayoutWindow::wxSashLayoutWindow(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&) - __ct__18wxSashLayoutWindowFP8wxWindowiRC7wxPointRC6wxSizelRC8wxString ;wxSashLayoutWindow::sm_classwxSashLayoutWindow sm_classwxSashLayoutWindow__18wxSashLayoutWindow ;wxCalculateLayoutEvent::sm_classwxCalculateLayoutEvent @@ -6977,6 +7038,8 @@ EXPORTS GetEventTable__10wxLogFrameCFv ;wxLogWindow::GetFrame() const GetFrame__11wxLogWindowCFv + ;wxLogDialog::ms_details + ms_details__11wxLogDialog ;wxLogDialog::sm_eventTableEntries sm_eventTableEntries__11wxLogDialog ;wxLogFrame::OnSave(wxCommandEvent&) @@ -6993,6 +7056,8 @@ EXPORTS __dt__10wxLogFrameFv ;wxLogGui::Flush() Flush__8wxLogGuiFv + ;wxLogFrame::DoClose() + DoClose__10wxLogFrameFv ;wxLogGui::DoLog(unsigned long,const char*,long) DoLog__8wxLogGuiFUlPCcl ;wxLogDialog::OnListSelect(wxListEvent&) @@ -7026,10 +7091,12 @@ EXPORTS __vft10wxLogFrame8wxObject ;wxLogDialog::OnOk(wxCommandEvent&) OnOk__11wxLogDialogFR14wxCommandEvent - ;wxLogWindow::OnFrameDelete(wxFrame*) - OnFrameDelete__11wxLogWindowFP7wxFrame + ;wxLogWindow::OnFrameClose(wxFrame*) + OnFrameClose__11wxLogWindowFP7wxFrame ;wxLogFrame::sm_eventTable sm_eventTable__10wxLogFrame + ;wxLogWindow::OnFrameDelete(wxFrame*) + OnFrameDelete__11wxLogWindowFP7wxFrame ;wxLogDialog::~wxLogDialog() __dt__11wxLogDialogFv ;wxLogWindow::Flush() @@ -7632,6 +7699,8 @@ EXPORTS OnUpdateView__18wxPropertyFormViewFv ;wxConstructorForwxStringFormValidator() wxConstructorForwxStringFormValidator__Fv + ;wxConstructorForwxPropertyFormDialog() + wxConstructorForwxPropertyFormDialog__Fv ;wxPropertyFormView::OnClose() OnClose__18wxPropertyFormViewFv ;wxRealFormValidator::OnCheckValue(wxProperty*,wxPropertyFormView*,wxWindow*) @@ -7657,6 +7726,8 @@ EXPORTS sm_eventTable__19wxPropertyFormFrame ;wxPropertyFormView::Check() Check__18wxPropertyFormViewFv + ;wxConstructorForwxPropertyFormPanel() + wxConstructorForwxPropertyFormPanel__Fv ;wxBoolFormValidator::sm_classwxBoolFormValidator sm_classwxBoolFormValidator__19wxBoolFormValidator ;wxPropertyFormView::TransferToPropertySheet() @@ -7711,6 +7782,8 @@ EXPORTS sm_classwxPropertyFormFrame__19wxPropertyFormFrame ;wxPropertyFormView::GetEventTable() const GetEventTable__18wxPropertyFormViewCFv + ;wxConstructorForwxPropertyFormFrame() + wxConstructorForwxPropertyFormFrame__Fv ;wxPropertyFormView::TransferToDialog() TransferToDialog__18wxPropertyFormViewFv ;wxPropertyFormView::ShowView(wxPropertySheet*,wxWindow*) @@ -7828,10 +7901,12 @@ EXPORTS sm_classwxPropertyListFrame__19wxPropertyListFrame ;wxPropertyListView::EditProperty(wxProperty*) EditProperty__18wxPropertyListViewFP10wxProperty - ;wxPropertyTextEdit::OnSetFocus() - OnSetFocus__18wxPropertyTextEditFv + ;wxConstructorForwxPropertyTextEdit() + wxConstructorForwxPropertyTextEdit__Fv ;wxConstructorForwxPropertyListView() wxConstructorForwxPropertyListView__Fv + ;wxConstructorForwxPropertyListDialog() + wxConstructorForwxPropertyListDialog__Fv ;wxConstructorForwxIntegerListValidator() wxConstructorForwxIntegerListValidator__Fv ;wxRealListValidator::sm_classwxRealListValidator @@ -7840,6 +7915,8 @@ EXPORTS sm_classwxIntegerListValidator__22wxIntegerListValidator ;wxPropertyStringListEditorDialog::ShowCurrentSelection() ShowCurrentSelection__32wxPropertyStringListEditorDialogFv + ;wxPropertyTextEdit::OnSetFocus() + OnSetFocus__18wxPropertyTextEditFv ;wxPropertyListView::OnClose() OnClose__18wxPropertyListViewFv ;wxPropertyListValidator::OnSelect(unsigned long,wxProperty*,wxPropertyListView*,wxWindow*) @@ -7949,6 +8026,8 @@ EXPORTS OnKillFocus__18wxPropertyTextEditFv ;wxConstructorForwxStringListValidator() wxConstructorForwxStringListValidator__Fv + ;wxConstructorForwxPropertyListFrame() + wxConstructorForwxPropertyListFrame__Fv ;wxConstructorForwxListOfStringsListValidator() wxConstructorForwxListOfStringsListValidator__Fv ;wxFilenameListValidator::~wxFilenameListValidator() @@ -8008,6 +8087,8 @@ EXPORTS GetEventTable__18wxPropertyListViewCFv ;wxConstructorForwxRealListValidator() wxConstructorForwxRealListValidator__Fv + ;wxConstructorForwxPropertyListPanel() + wxConstructorForwxPropertyListPanel__Fv ;wxConstructorForwxColourListValidator() wxConstructorForwxColourListValidator__Fv ;wxStringListValidator::sm_classwxStringListValidator @@ -8053,30 +8134,30 @@ EXPORTS OnPaint__12wxSashWindowFR12wxPaintEvent ;wxSashWindow::SashHitTest(int,int,int) SashHitTest__12wxSashWindowFiN21 - ;wxSashWindow::DrawBorders(wxDC&) - DrawBorders__12wxSashWindowFR4wxDC + ;wxSashWindow::Create(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&) + Create__12wxSashWindowFP8wxWindowiRC7wxPointRC6wxSizelRC8wxString ;wxSashWindow::DrawSash(wxSashEdgePosition,wxDC&) DrawSash__12wxSashWindowF18wxSashEdgePositionR4wxDC - ;wxSashWindow::~wxSashWindow() - __dt__12wxSashWindowFv + ;wxSashWindow::DrawBorders(wxDC&) + DrawBorders__12wxSashWindowFR4wxDC + ;wxSashWindow::Init() + Init__12wxSashWindowFv ;wxConstructorForwxSashWindow() wxConstructorForwxSashWindow__Fv ;wxConstructorForwxSashEvent() wxConstructorForwxSashEvent__Fv + ;wxSashWindow::~wxSashWindow() + __dt__12wxSashWindowFv ;wxSashWindow::InitColours() InitColours__12wxSashWindowFv ;wxSashWindow::GetEventTable() const GetEventTable__12wxSashWindowCFv ;wxSashWindow::DrawSashes(wxDC&) DrawSashes__12wxSashWindowFR4wxDC - ;wxSashWindow::wxSashWindow() - __ct__12wxSashWindowFv - ;wxSashWindow::wxSashWindow(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&) - __ct__12wxSashWindowFP8wxWindowiRC7wxPointRC6wxSizelRC8wxString - ;wxSashWindow::sm_eventTableEntries - sm_eventTableEntries__12wxSashWindow ;wxSashWindow::sm_classwxSashWindow sm_classwxSashWindow__12wxSashWindow + ;wxSashWindow::sm_eventTableEntries + sm_eventTableEntries__12wxSashWindow ;From object file: ..\generic\scrolwin.cpp ;PUBDEFs (Symbols available from object file): ;wxScrolledWindow::GetScrollPageSize(int) const @@ -8142,12 +8223,10 @@ EXPORTS OnUnsplitEvent__16wxSplitterWindowFR15wxSplitterEvent ;wxSplitterWindow::ReplaceWindow(wxWindow*,wxWindow*) ReplaceWindow__16wxSplitterWindowFP8wxWindowT1 - ;wxSplitterWindow::wxSplitterWindow() - __ct__16wxSplitterWindowFv ;wxSplitterWindow::InitColours() InitColours__16wxSplitterWindowFv - ;wxSplitterWindow::wxSplitterWindow(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&) - __ct__16wxSplitterWindowFP8wxWindowiRC7wxPointRC6wxSizelRC8wxString + ;wxSplitterWindow::OnSetCursor(wxSetCursorEvent&) + OnSetCursor__16wxSplitterWindowFR16wxSetCursorEvent __vft16wxSplitterWindow8wxObject ;wxSplitterWindow::DrawSashTracker(int,int) DrawSashTracker__16wxSplitterWindowFiT1 @@ -8173,16 +8252,20 @@ EXPORTS OnIdle__16wxSplitterWindowFR11wxIdleEvent ;wxSplitterWindow::OnDoubleClick(wxSplitterEvent&) OnDoubleClick__16wxSplitterWindowFR15wxSplitterEvent + ;wxSplitterWindow::Init() + Init__16wxSplitterWindowFv ;wxSplitterWindow::GetEventTable() const GetEventTable__16wxSplitterWindowCFv - ;wxSplitterWindow::DrawBorders(wxDC&) - DrawBorders__16wxSplitterWindowFR4wxDC + ;wxSplitterWindow::Create(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&) + Create__16wxSplitterWindowFP8wxWindowiRC7wxPointRC6wxSizelRC8wxString ;wxSplitterWindow::sm_eventTable sm_eventTable__16wxSplitterWindow ;wxSplitterWindow::sm_classwxSplitterWindow sm_classwxSplitterWindow__16wxSplitterWindow ;wxSplitterWindow::Initialize(wxWindow*) Initialize__16wxSplitterWindowFP8wxWindow + ;wxSplitterWindow::DrawBorders(wxDC&) + DrawBorders__16wxSplitterWindowFR4wxDC ;wxSplitterWindow::OnMouseEvent(wxMouseEvent&) OnMouseEvent__16wxSplitterWindowFR12wxMouseEvent ;wxSplitterWindow::SetSashPosition(int,unsigned long) @@ -8565,6 +8648,8 @@ EXPORTS GetItemData__10wxTreeCtrlCFRC12wxTreeItemId ;wxTreeCtrl::GetFirstChild(const wxTreeItemId&,long&) const GetFirstChild__10wxTreeCtrlCFRC12wxTreeItemIdRl + ;wxTreeCtrl::ExpandAll(const wxTreeItemId&) + ExpandAll__10wxTreeCtrlFRC12wxTreeItemId ;wxTreeCtrl::DrawBorder(const wxTreeItemId&) DrawBorder__10wxTreeCtrlFRC12wxTreeItemId ;wxTreeCtrl::Delete(const wxTreeItemId&) @@ -8651,11 +8736,13 @@ EXPORTS ;From object file: ..\generic\treelay.cpp ;From object file: ..\generic\wizard.cpp ;PUBDEFs (Symbols available from object file): + ;wxWizard::wxWizard(wxWindow*,int,const wxString&,const wxBitmap&,const wxPoint&) + __ct__8wxWizardFP8wxWindowiRC8wxStringRC8wxBitmapRC7wxPoint + __vft8wxWizard8wxObject ;wxWizard::OnCancel(wxCommandEvent&) OnCancel__8wxWizardFR14wxCommandEvent - __vft8wxWizard8wxObject - ;wxWizard::wxWizard(wxWindow*,int,const wxString&,const wxBitmap&,const wxPoint&,const wxSize&) - __ct__8wxWizardFP8wxWindowiRC8wxStringRC8wxBitmapRC7wxPointRC6wxSize + ;wxWizard::SetPageSize(const wxSize&) + SetPageSize__8wxWizardFRC6wxSize ;wxWizard::RunWizard(wxWizardPage*) RunWizard__8wxWizardFP12wxWizardPage ;wxWizard::GetEventTable() const @@ -8684,6 +8771,8 @@ EXPORTS sm_eventTable__8wxWizard ;wxWizard::sm_eventTableEntries sm_eventTableEntries__8wxWizard + ;wxWizard::DoCreateControls() + DoCreateControls__8wxWizardFv ;wxWizard::GetCurrentPage() const GetCurrentPage__8wxWizardCFv ;wxWizardPage::wxWizardPage(wxWizard*,const wxBitmap&) @@ -8699,8 +8788,12 @@ EXPORTS sm_classwxWizardPage__12wxWizardPage ;From object file: ..\html\helpctrl.cpp ;PUBDEFs (Symbols available from object file): + ;wxHtmlHelpController::GetFrameParameters(wxSize*,wxPoint*,unsigned long*) + GetFrameParameters__20wxHtmlHelpControllerFP6wxSizeP7wxPointPUl ;wxHtmlHelpController::CreateHelpFrame(wxHtmlHelpData*) CreateHelpFrame__20wxHtmlHelpControllerFP14wxHtmlHelpData + ;wxHtmlHelpController::DisplaySection(int) + DisplaySection__20wxHtmlHelpControllerFi ;wxHtmlHelpController::DestroyHelpWindow() DestroyHelpWindow__20wxHtmlHelpControllerFv ;wxHtmlHelpController::AddBook(const wxString&,unsigned long) @@ -8708,12 +8801,20 @@ EXPORTS __vft20wxHtmlHelpController8wxObject ;wxHtmlHelpController::CreateHelpWindow() CreateHelpWindow__20wxHtmlHelpControllerFv + ;wxHtmlHelpController::Quit() + Quit__20wxHtmlHelpControllerFv ;wxHtmlHelpController::ReadCustomization(wxConfigBase*,const wxString&) ReadCustomization__20wxHtmlHelpControllerFP12wxConfigBaseRC8wxString + ;wxHtmlHelpController::sm_classwxHtmlHelpController + sm_classwxHtmlHelpController__20wxHtmlHelpController ;wxHtmlHelpController::WriteCustomization(wxConfigBase*,const wxString&) WriteCustomization__20wxHtmlHelpControllerFP12wxConfigBaseRC8wxString ;wxHtmlHelpController::UseConfig(wxConfigBase*,const wxString&) UseConfig__20wxHtmlHelpControllerFP12wxConfigBaseRC8wxString + ;wxHtmlHelpController::Initialize(const wxString&) + Initialize__20wxHtmlHelpControllerFRC8wxString + ;wxHtmlHelpController::SetFrameParameters(const wxString&,const wxSize&,const wxPoint&,unsigned long) + SetFrameParameters__20wxHtmlHelpControllerFRC8wxStringRC6wxSizeRC7wxPointUl ;wxConstructorForwxHtmlHelpController() wxConstructorForwxHtmlHelpController__Fv ;wxHtmlHelpController::~wxHtmlHelpController() @@ -8724,6 +8825,8 @@ EXPORTS __ct__20wxHtmlHelpControllerFi ;wxHtmlHelpController::SetTitleFormat(const wxString&) SetTitleFormat__20wxHtmlHelpControllerFRC8wxString + ;wxHtmlHelpController::LoadFile(const wxString&) + LoadFile__20wxHtmlHelpControllerFRC8wxString ;From object file: ..\html\helpdata.cpp ;PUBDEFs (Symbols available from object file): ;wxHtmlHelpData::wxHtmlHelpData() @@ -8825,12 +8928,12 @@ EXPORTS __vft15wxHtmlHelpFrame8wxObject ;wxHtmlHelpFrame::wxHtmlHelpFrame(wxWindow*,int,const wxString&,int,wxHtmlHelpData*) __ct__15wxHtmlHelpFrameFP8wxWindowiRC8wxStringT2P14wxHtmlHelpData - ;wxHtmlHelpFrame::Create(wxWindow*,int,const wxString&,int) - Create__15wxHtmlHelpFrameFP8wxWindowiRC8wxStringT2 - ;wxHtmlHelpFrame::OptionsDialog() - OptionsDialog__15wxHtmlHelpFrameFv ;wxHtmlHelpFrame::DisplayContents() DisplayContents__15wxHtmlHelpFrameFv + ;wxHtmlHelpFrame::OptionsDialog() + OptionsDialog__15wxHtmlHelpFrameFv + ;wxHtmlHelpFrame::Create(wxWindow*,int,const wxString&,int) + Create__15wxHtmlHelpFrameFP8wxWindowiRC8wxStringT2 ;wxHtmlHelpFrame::CreateIndex() CreateIndex__15wxHtmlHelpFrameFv ;wxHtmlHelpFrameOptionsDialog::sm_eventTableEntries @@ -8841,18 +8944,18 @@ EXPORTS OnSearch__15wxHtmlHelpFrameFR14wxCommandEvent ;wxHtmlHelpFrame::Init(wxHtmlHelpData*) Init__15wxHtmlHelpFrameFP14wxHtmlHelpData - ;wxHtmlHelpFrame::NotifyPageChanged() - NotifyPageChanged__15wxHtmlHelpFrameFv + ;wxHtmlHelpFrame::DisplayIndex() + DisplayIndex__15wxHtmlHelpFrameFv ;wxConstructorForwxHtmlHelpFrame() wxConstructorForwxHtmlHelpFrame__Fv ;wxHtmlHelpFrame::~wxHtmlHelpFrame() __dt__15wxHtmlHelpFrameFv + ;wxHtmlHelpFrame::NotifyPageChanged() + NotifyPageChanged__15wxHtmlHelpFrameFv ;wxHtmlHelpFrameOptionsDialog::GetEventTable() const GetEventTable__28wxHtmlHelpFrameOptionsDialogCFv ;wxHtmlHelpFrame::GetEventTable() const GetEventTable__15wxHtmlHelpFrameCFv - ;wxHtmlHelpFrame::DisplayIndex() - DisplayIndex__15wxHtmlHelpFrameFv ;wxHtmlHelpFrame::CreateSearch() CreateSearch__15wxHtmlHelpFrameFv ;wxHtmlHelpFrame::ReadCustomization(wxConfigBase*,const wxString&) @@ -9349,6 +9452,8 @@ EXPORTS InitParser__15wxHtmlWinParserFRC8wxString ;wxHtmlWinParser::SetContainer(wxHtmlContainerCell*) SetContainer__15wxHtmlWinParserFP19wxHtmlContainerCell + ;wxHtmlWinParser::RemoveModule(wxHtmlTagsModule*) + RemoveModule__15wxHtmlWinParserFP16wxHtmlTagsModule ;wxHtmlWinParser::~wxHtmlWinParser() __dt__15wxHtmlWinParserFv ;wxHtmlWinParser::OpenContainer() @@ -9410,11 +9515,11 @@ EXPORTS __ct__18wxAcceleratorTableFv ;wxAcceleratorRefData::wxAcceleratorRefData() __ct__20wxAcceleratorRefDataFv - ;wxAcceleratorTable::Translate(wxWindow*,void**) const - Translate__18wxAcceleratorTableCFP8wxWindowPPv __vft18wxAcceleratorTable8wxObject ;wxAcceleratorRefData::~wxAcceleratorRefData() __dt__20wxAcceleratorRefDataFv + ;wxAcceleratorTable::Translate(unsigned long,void**) const + Translate__18wxAcceleratorTableCFUlPPv ;wxAcceleratorTable::wxAcceleratorTable(const wxString&) __ct__18wxAcceleratorTableFRC8wxString ;From object file: ..\os2\app.cpp @@ -9446,7 +9551,6 @@ EXPORTS OnIdle__5wxAppFR11wxIdleEvent ;wxMsgArray::wxMsgArray(const wxMsgArray&) __ct__10wxMsgArrayFRC10wxMsgArray - wxhInstance wxPanelClassName wxMDIFrameClassName ;wxMsgArray::Insert(const _QMSG&,unsigned int) @@ -9475,8 +9579,6 @@ EXPORTS wxYield__Fv wxSTD_FRAME_ICON wxDEFAULT_FRAME_ICON - ;wxApp::ProcessPendingEvents() - ProcessPendingEvents__5wxAppFv ;wxApp::ProcessIdle() ProcessIdle__5wxAppFv ;wxApp::MainLoop() @@ -10008,13 +10110,12 @@ EXPORTS wxLIGHT_GREY wxDefaultSize wxBLUE - wxOsVersion + wxPageNumber wxTextCtrlNameStr wxStaticTextNameStr wxStaticBoxNameStr wxSliderNameStr wxRED_PEN - wxPageNumber wxMultiTextNameStr wxMEDIUM_GREY_PEN wxGaugeNameStr @@ -10146,6 +10247,8 @@ EXPORTS DoDrawEllipse__4wxDCFiN31 ;wxDCBase::DeviceToLogicalYRel(int) const DeviceToLogicalYRel__8wxDCBaseCFi + ;wxDC::DrawAnyText(const wxString&,int,int) + DrawAnyText__4wxDCFRC8wxStringiT2 ;wxDC::sm_classwxDC sm_classwxDC__4wxDC ;wxDC::DoDrawRoundedRectangle(int,int,int,int,double) @@ -10175,6 +10278,8 @@ EXPORTS DoDrawPolygon__4wxDCFiP7wxPointN31 ;wxDC::DoDrawLines(int,wxPoint*,int,int) DoDrawLines__4wxDCFiP7wxPointN21 + ;wxDC::DoDrawCheckMark(int,int,int,int) + DoDrawCheckMark__4wxDCFiN31 ;wxDCBase::DeviceToLogicalX(int) const DeviceToLogicalX__8wxDCBaseCFi ;wxDC::~wxDC() @@ -10245,14 +10350,12 @@ EXPORTS StartPage__4wxDCFv ;wxDC::GetCharWidth() const GetCharWidth__4wxDCCFv - ;wxDC::DoClipping(unsigned long) - DoClipping__4wxDCFUl + ;wxDC::DoDrawRotatedText(const wxString&,int,int,double) + DoDrawRotatedText__4wxDCFRC8wxStringiT2d ;wxDC::SetRop(unsigned long) SetRop__4wxDCFUl ;wxDC::SetBackground(const wxBrush&) SetBackground__4wxDCFRC7wxBrush - ;wxDC::DoDrawRotatedText(const wxString&,int,int,double) - DoDrawRotatedText__4wxDCFRC8wxStringiT2d ;wxDC::DoDrawPoint(int,int) DoDrawPoint__4wxDCFiT1 ;wx_spline_push(double,double,double,double,double,double,double,double) @@ -11242,6 +11345,8 @@ EXPORTS __vft9wxMenuBar8wxObject ;wxMenuBar::Attach(wxFrame*) Attach__9wxMenuBarFP7wxFrame + ;wxMenu::m_nextMenuId + m_nextMenuId__6wxMenu ;wxMenu::Init() Init__6wxMenuFv ;wxConstructorForwxMenu() @@ -11558,8 +11663,8 @@ EXPORTS SetCap__5wxPenFi ;wxPen::~wxPen() __dt__5wxPenFv - ;wxPen::SetDashes(int,const long*) - SetDashes__5wxPenFiPCl + ;wxPen::SetDashes(int,const signed char*) + SetDashes__5wxPenFiPCSc ;wxPen::SetStyle(int) SetStyle__5wxPenFi ;wx2os2PenStyle(int) @@ -11757,8 +11862,6 @@ EXPORTS ;PUBDEFs (Symbols available from object file): ;wxRegion::Combine(const wxRect&,wxRegionOp) Combine__8wxRegionFRC6wxRect10wxRegionOp - ;wxRegion::Contains(long,long,long,long) const - Contains__8wxRegionCFlN31 ;wxRegion::GetBox() const GetBox__8wxRegionCFv ;wxRegionIterator::operator++() @@ -11767,8 +11870,8 @@ EXPORTS Combine__8wxRegionFRC8wxRegion10wxRegionOp ;wxRegion::wxRegion(const wxPoint&,const wxPoint&) __ct__8wxRegionFRC7wxPointT1 - ;wxRegion::GetBox(long&,long&,long&,long&) const - GetBox__8wxRegionCFRlN31 + ;wxRegion::Contains(int,int) const + Contains__8wxRegionCFiT1 ;wxRegionIterator::GetY() const GetY__16wxRegionIteratorCFv ;wxConstructorForwxRegion() @@ -11782,12 +11885,10 @@ EXPORTS __vft8wxRegion8wxObject ;wxRegion::Contains(const wxRect&) const Contains__8wxRegionCFRC6wxRect - ;wxRegion::wxRegion(long,long,long,long) - __ct__8wxRegionFlN31 + ;wxRegion::GetBox(int&,int&,int&,int&) const + GetBox__8wxRegionCFRiN31 ;wxRegionIterator::operator++(int) __pp__16wxRegionIteratorFi - ;wxRegion::Contains(long,long) const - Contains__8wxRegionCFlT1 ;wxRegion::wxRegion() __ct__8wxRegionFv ;wxConstructorForwxRegionIterator() @@ -11802,10 +11903,12 @@ EXPORTS GetHRGN__8wxRegionCFv ;wxRegion::Clear() Clear__8wxRegionFv - ;wxRegion::Combine(long,long,long,long,wxRegionOp) - Combine__8wxRegionFlN3110wxRegionOp + ;wxRegion::Combine(int,int,int,int,wxRegionOp) + Combine__8wxRegionFiN3110wxRegionOp ;wxRegion::Contains(const wxPoint&) const Contains__8wxRegionCFRC7wxPoint + ;wxRegion::Contains(int,int,int,int) const + Contains__8wxRegionCFiN31 ;wxRegionIterator::GetW() const GetW__16wxRegionIteratorCFv ;wxRegion::~wxRegion() @@ -11817,6 +11920,8 @@ EXPORTS ;wxRegion::wxRegion(unsigned long) __ct__8wxRegionFUl __vft16wxRegionIterator8wxObject + ;wxRegion::wxRegion(int,int,int,int) + __ct__8wxRegionFiN31 ;wxRegion::Empty() const Empty__8wxRegionCFv ;wxRegionIterator::GetX() const @@ -11921,6 +12026,8 @@ EXPORTS sm_classwxSlider__8wxSlider ;From object file: ..\os2\spinbutt.cpp ;PUBDEFs (Symbols available from object file): + ;wxSpinEvent::sm_classwxSpinEvent + sm_classwxSpinEvent__11wxSpinEvent ;wxSpinButton::GetValue() const GetValue__12wxSpinButtonCFv ;wxSpinButton::sm_classwxSpinButton @@ -11934,6 +12041,8 @@ EXPORTS SetValue__12wxSpinButtonFi ;wxSpinButton::SetRange(int,int) SetRange__12wxSpinButtonFiT1 + ;wxConstructorForwxSpinEvent() + wxConstructorForwxSpinEvent__Fv ;wxConstructorForwxSpinButton() wxConstructorForwxSpinButton__Fv ;wxSpinButton::~wxSpinButton() diff --git a/locale/.cvsignore b/locale/.cvsignore new file mode 100644 index 0000000000..cd1f2c9439 --- /dev/null +++ b/locale/.cvsignore @@ -0,0 +1 @@ +*.mo diff --git a/locale/Makefile b/locale/Makefile index 75deb8923e..eca5dd8e91 100644 --- a/locale/Makefile +++ b/locale/Makefile @@ -3,6 +3,12 @@ # this makefile may be invoked to build either wxstd.po or any lang.mo +# Autodetect the languages we support. Currently this relies on make +# being called with this dir as the cwd, but if we generate this file +# with configure an explicit path should be specified -- RL. + +WX_LINGUAS := `ls *.po 2> /dev/null | sed -n 's/\(wxstd\)\?\.po//p'` + # the programs we use (TODO: use configure to detect them) MSGFMT=msgfmt MSGMERGE=msgmerge @@ -10,7 +16,7 @@ XGETTEXT=xgettext XARGS=xargs # common xgettext args: C++ syntax, use the specified macro names as markers -XGETTEXT_ARGS=-C -k_ -kwxTRANSLATE -s +XGETTEXT_ARGS=-C -k_ -kwxGetTranslation -kwxTRANSLATE -s -j # implicit rules %.mo: %.po @@ -21,10 +27,22 @@ XGETTEXT_ARGS=-C -k_ -kwxTRANSLATE -s if [ -f $@ ]; then $(MSGMERGE) $@ wxstd.po > $@.new && mv $@.new $@; else cp wxstd.po $@; fi wxstd.po: + touch $@ find ../include -name "*.h" | $(XARGS) $(XGETTEXT) $(XGETTEXT_ARGS) -o wxstd.po find ../src -name "*.cpp" | $(XARGS) $(XGETTEXT) $(XGETTEXT_ARGS) -o wxstd.po +allpo: force-update + @-for t in $(WX_LINGUAS); do $(MAKE) $$t.po; done + +allmo: + @for t in $(WX_LINGUAS); do $(MAKE) $$t.mo; done + +force-update: + $(RM) wxstd.po + # targets depending on this one will be always remade FORCE: +.PHONY: allpo allmo force-update + # $Id$ diff --git a/locale/cs.po b/locale/cs.po index 9db969b1fc..4635c52ff4 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1,142 +1,444 @@ -#. This catalog was generated by i18n-ed -#. Number of items: 572 -#. Language: Czech -#. Prefix: _ -#. Paths: 1 -#. ../src -#. Wildcards: 4 -#. *.cpp -#. *.h -#. *.H -#. *.CPP - - msgid "" msgstr "" "Project-Id-Version: wxWindows-2.2\n" -"POT-Creation-Date: 1999-02-19 16:03+0100\n" -"PO-Revision-Date: 2000-03-14 12:30+0100\n" +"POT-Creation-Date: 2000-07-01 14:41+0200\n" +"PO-Revision-Date: 2000-06-17 19:23+0200\n" "Last-Translator: Vaclav Slavik <v.slavik@volny.cz>\n" "Language-Team: wxWindows Team <wx-devel@wxwindows.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso8859-2\n" "Content-Transfer-Encoding: 8-bit\n" -#: ../src/generic/dirdlgg.cpp:479 -msgid "\n(Do you have the required permissions?)" -msgstr "\n(Máte potøebná pøístupová práva?)" +#: ../src/generic/dirdlgg.cpp:550 +msgid "" +"\n" +"(Do you have the required permissions?)" +msgstr "" +"\n" +"(Máte potøebná pøístupová práva?)" -#: ../src/generic/dirdlgg.cpp:466 -msgid "\ndoes not exist\nCreate it now?" -msgstr "\nneexistuje\nChcete ho vytvoøit?" +#: ../src/generic/dirdlgg.cpp:537 +msgid "" +"\n" +"does not exist\n" +"Create it now?" +msgstr "" +"\n" +"neexistuje\n" +"Chcete ho vytvoøit?" #: ../src/common/log.cpp:238 +#, c-format msgid " (error %ld: %s)" msgstr " (chyba %ld: %s)" -#: ../src/common/resourc2.cpp:265 -#: ../src/common/resourc2.cpp:1334 -#: ../src/common/resource.cpp:1769 -#: ../src/common/resource.cpp:1899 -#: ../src/common/resource.cpp:2980 +#: ../src/common/docview.cpp:1204 +msgid " - " +msgstr " - " + +#: ../src/html/htmprint.cpp:491 +msgid " Preview" +msgstr " - náhled" + +#: ../src/generic/filedlgg.cpp:328 +msgid " bytes " +msgstr " bajtù " + +#: ../src/common/paper.cpp:124 +msgid "#10 Envelope, 4 1/8 x 9 1/2 in" +msgstr "Obálka è. 10, 4 1/8 x 9 1/2 palce" + +#: ../src/common/paper.cpp:125 +msgid "#11 Envelope, 4 1/2 x 10 3/8 in" +msgstr "Obálka è. 11, 4 1/2 x 10 3/8 palce" + +#: ../src/common/paper.cpp:126 +msgid "#12 Envelope, 4 3/4 x 11 in" +msgstr "Obálka è. 12, 4 3/4 x 11 palcù" + +#: ../src/common/paper.cpp:127 +msgid "#14 Envelope, 5 x 11 1/2 in" +msgstr "Obálka è. 14, 5 x 11 1/2 palce" + +#: ../src/common/paper.cpp:123 +msgid "#9 Envelope, 3 7/8 x 8 7/8 in" +msgstr "Obálka è. 9, 3 7/8 x 8 7/8 palce" + +#: ../src/common/resourc2.cpp:265 ../src/common/resourc2.cpp:1334 +#: ../src/common/resource.cpp:1778 ../src/common/resource.cpp:1908 +#: ../src/common/resource.cpp:2988 +#, c-format msgid "#define %s must be an integer." msgstr "#define %s musí být integer." -#: ../src/common/resourc2.cpp:709 -#: ../src/common/resource.cpp:2350 +#: ../src/html/helpfrm.cpp:718 ../src/html/helpfrm.cpp:719 +#: ../src/html/helpfrm.cpp:1277 ../src/html/helpfrm.cpp:1304 +#, c-format +msgid "%i of %i" +msgstr "%i z %i" + +#: ../src/common/cmdline.cpp:727 +#, c-format +msgid "%s (or %s)" +msgstr "%s (nebo %s)" + +#: ../src/generic/logg.cpp:239 +msgid "%s Error" +msgstr "%s - chyba" + +#: ../src/generic/logg.cpp:247 +msgid "%s Information" +msgstr "%s - informace" + +#: ../src/generic/logg.cpp:243 +msgid "%s Warning" +msgstr "%s - varování" + +#: ../src/common/resourc2.cpp:709 ../src/common/resource.cpp:2359 +#, c-format msgid "%s not a bitmap resource specification." msgstr "%s není specifikace bitmap resource." -#: ../src/common/resourc2.cpp:864 -#: ../src/common/resource.cpp:2506 +#: ../src/common/resourc2.cpp:864 ../src/common/resource.cpp:2514 +#, c-format msgid "%s not an icon resource specification." msgstr "%s není specifikace icon resource." -#: ../src/common/resourc2.cpp:357 -#: ../src/common/resourc2.cpp:1430 -#: ../src/common/resource.cpp:1862 -#: ../src/common/resource.cpp:1991 -#: ../src/common/resource.cpp:3077 +#: ../src/common/resourc2.cpp:357 ../src/common/resourc2.cpp:1430 +#: ../src/common/resource.cpp:1871 ../src/common/resource.cpp:2000 +#: ../src/common/resource.cpp:3085 +#, c-format msgid "%s: ill-formed resource file syntax." msgstr "%s: chybná syntaxe resource souboru." -#: ../src/generic/logg.cpp:435 -#: ../src/generic/tipdlg.cpp:170 +#: ../src/generic/logg.cpp:473 ../src/generic/tipdlg.cpp:170 msgid "&Close" msgstr "&Zavøít" -#: ../src/generic/logg.cpp:436 +#: ../src/generic/logg.cpp:685 +msgid "&Details" +msgstr "&Detaily" + +#: ../src/generic/wizard.cpp:284 +msgid "&Finish" +msgstr "&Dokonèit" + +#: ../src/generic/logg.cpp:474 msgid "&Log" msgstr "&Log" -#: ../src/common/docview.cpp:1889 -#: ../src/common/docview.cpp:1900 +#: ../src/generic/wizard.cpp:189 ../src/generic/wizard.cpp:286 +msgid "&Next >" +msgstr "&Dal¹í >" + +#: ../src/generic/tipdlg.cpp:175 +msgid "&Next Tip" +msgstr "&Dal¹í tip" + +#: ../src/common/docview.cpp:1900 ../src/common/docview.cpp:1911 msgid "&Redo" msgstr "&Zopakovat" -#: ../src/common/docview.cpp:1883 -#: ../src/common/docview.cpp:1910 +#: ../src/common/docview.cpp:1894 ../src/common/docview.cpp:1921 msgid "&Redo " msgstr "&Zopakovat " -#: ../src/generic/logg.cpp:431 +#: ../src/generic/logg.cpp:469 ../src/generic/logg.cpp:770 msgid "&Save..." msgstr "&Ulo¾it..." -#: ../src/common/docview.cpp:1895 +#: ../src/generic/tipdlg.cpp:172 +msgid "&Show tips at startup" +msgstr "&Zobrazit tipy pøi spu¹tìní" + +#: ../src/common/docview.cpp:1906 msgid "&Undo" msgstr "Z&pìt" -#: ../src/common/docview.cpp:1870 +#: ../src/common/docview.cpp:1881 msgid "&Undo " msgstr "Z&pìt " -#: ../src/common/config.cpp:390 +#: ../src/msw/mdi.cpp:1270 ../src/msw/mdi.cpp:1277 +msgid "&Window" +msgstr "&Okno" + +#: ../src/common/config.cpp:396 +#, c-format msgid "'%s' has extra '..', ignored." msgstr "'%s' obsahuje pøebyteèné '..', ignoruji." -#: ../src/common/intl.cpp:389 +#: ../src/common/valtext.cpp:140 +#, c-format +msgid "'%s' is invalid" +msgstr "'%s' je neplatný" + +#: ../src/common/cmdline.cpp:649 +#, c-format +msgid "'%s' is not a correct numeric value for option '%s'." +msgstr "'%s' není správná èíselná hodnota pro volbu '%s'." + +#: ../src/common/intl.cpp:395 +#, c-format msgid "'%s' is not a valid message catalog." msgstr "'%s' není katalog pøekladù." #: ../src/common/textfile.cpp:250 +#, c-format msgid "'%s' is probably a binary file." msgstr "'%s' je zøejmì binární soubor." -#: ../src/common/resourc2.cpp:297 -#: ../src/common/resourc2.cpp:1370 -#: ../src/common/resource.cpp:1801 -#: ../src/common/resource.cpp:1931 -#: ../src/common/resource.cpp:3016 -msgid ", expected static, #include or #define\nwhilst parsing resource." -msgstr ", oèekávám static, #include nebo #define\nbìhem parsování resource." +#: ../src/common/valtext.cpp:178 +#, c-format +msgid "'%s' should be numeric." +msgstr "'%s' má být èíslo." + +#: ../src/common/valtext.cpp:160 +#, c-format +msgid "'%s' should only contain ASCII characters." +msgstr "'%s' má obsahovat pouze ASCII znaky." + +#: ../src/common/valtext.cpp:166 +#, c-format +msgid "'%s' should only contain alphabetic characters." +msgstr "'%s' má obsahovat pouze písmena." + +#: ../src/common/valtext.cpp:172 +#, c-format +msgid "'%s' should only contain alphabetic or numeric characters." +msgstr "'%s' má obsahovat pouze písmena nebo èíslice." + +#: ../src/html/helpfrm.cpp:679 +msgid "(Help)" +msgstr "(Nápovìda)" + +#: ../src/html/helpfrm.cpp:276 ../src/html/helpfrm.cpp:783 +#: ../src/html/helpfrm.cpp:1330 +msgid "(bookmarks)" +msgstr "(zálo¾ky)" + +#: ../src/common/resourc2.cpp:297 ../src/common/resourc2.cpp:1370 +#: ../src/common/resource.cpp:1810 ../src/common/resource.cpp:1940 +#: ../src/common/resource.cpp:3024 +msgid "" +", expected static, #include or #define\n" +"whilst parsing resource." +msgstr "" +", oèekávám static, #include nebo #define\n" +"bìhem parsování resource." + +#: ../src/generic/dirdlgg.cpp:264 ../src/generic/filedlgg.cpp:713 +msgid "." +msgstr "." + +#: ../src/generic/dirdlgg.cpp:265 ../src/generic/filedlgg.cpp:714 +msgid ".." +msgstr ".." + +#: ../src/common/paper.cpp:120 +msgid "10 x 14 in" +msgstr "10 x 14 palcù" + +#: ../src/common/paper.cpp:121 +msgid "11 x 17 in" +msgstr "11 x 17 palcù" + +#: ../src/common/paper.cpp:139 +msgid "6 3/4 Envelope, 3 5/8 x 6 1/2 in" +msgstr "Obálka 6 3/4, 3 5/8 x 6 1/2 palce" + +#: ../src/html/htmprint.cpp:272 +msgid ": file does not exist!" +msgstr ": soubor neexistuje!" + +#: ../src/common/fontmap.cpp:462 +msgid ": unknown charset" +msgstr ": neznámá znaková sada" + +#: ../src/common/fontmap.cpp:651 +msgid ": unknown encoding" +msgstr ": neznámé kódování" -#: ../src/common/paper.cpp:97 -msgid "A3 297 x 420 mm" -msgstr "A3 297 x 420 mm" +#: ../src/generic/wizard.cpp:186 +msgid "< &Back" +msgstr "< &Zpìt" + +#: ../src/generic/filedlgg.cpp:356 +msgid "<DIR>" +msgstr "<ADR>" + +#: ../src/generic/filedlgg.cpp:323 +msgid "<DIR> " +msgstr "<ADR >" + +#: ../src/generic/filedlgg.cpp:357 +msgid "<LINK>" +msgstr "<LINK>" + +#: ../src/generic/filedlgg.cpp:324 +msgid "<LINK> " +msgstr "<LINK> " + +#: ../src/html/helpfrm.cpp:928 +msgid "" +"<html><body>Normal face<br>(and <u>underlined</u>. <i>Italic face.</i> " +"<b>Bold face.</b> <b><i>Bold italic face.</i></b><br><font size=-2>font size " +"-2</font><br><font size=-1>font size -1</font><br><font size=+0>font size " +"+0</font><br><font size=+1>font size +1</font><br><font size=+2>font size " +"+2</font><br><font size=+3>font size +3</font><br><font size=+4>font size " +"+4</font><br><p><tt>Fixed size face.<br> <b>bold</b> <i>italic</i> " +"<b><i>bold italic <u>underlined</u></i></b><br><font size=-2>font size " +"-2</font><br><font size=-1>font size -1</font><br><font size=+0>font size " +"+0</font><br><font size=+1>font size +1</font><br><font size=+2>font size " +"+2</font><br><font size=+3>font size +3</font><br><font size=+4>font size " +"+4</font></tt></body></html>" +msgstr "" +"<html><meta http-equiv=\"Content-Type\" content=\"text/html; " +"charset=iso8859-2\"><body>Obyèejné písmo<br>(a <u>podtr¾ené</u>. " +"<i>Kurziva.</i> <b>Tuèné.</b> <b><i>Tuèná kurziva.</i></b><br><font " +"size=-2>velikost -2</font><br><font size=-1>velikost -1</font><br><font " +"size=+0>velikost +0</font><br><font size=+1>velikost +1</font><br><font " +"size=+2>velikost +2</font><br><font size=+3>velikost +3</font><br><font " +"size=+4>velikost +4</font><br><p><tt>Neproporcionální písmo.<br> " +"<b>tuèné</b> <i>kurziva</i> <b><i>tuèná kurziva " +"<u>podtr¾ené</u></i></b><br><font size=-2>velikost -2</font><br><font " +"size=-1>velikost -1</font><br><font size=+0>velikost +0</font><br><font " +"size=+1>velikost +1</font><br><font size=+2>velikost +2</font><br><font " +"size=+3>velikost +3</font><br><font size=+4>velikost " +"+4</font></tt></body></html>" + +#: ../src/common/paper.cpp:113 +msgid "A3 sheet, 297 x 420 mm" +msgstr "stránka A3, 297 x 420 mm" + +#: ../src/common/paper.cpp:104 ../src/generic/dcpsg.cpp:2516 +msgid "A4 sheet, 210 x 297 mm" +msgstr "stránka A4, 210 x 297 mm" -#: ../src/common/paper.cpp:96 -msgid "A4 210 x 297 mm" -msgstr "A4 210 x 297 mm" +#: ../src/common/paper.cpp:114 +msgid "A4 small sheet, 210 x 297 mm" +msgstr "malá stránka A4, 210 x 297 mm" + +#: ../src/common/paper.cpp:115 +msgid "A5 sheet, 148 x 210 mm" +msgstr "stránka A5, 148 x 210 mm" #: ../src/generic/fontdlgg.cpp:325 msgid "ABCDEFGabcdefg12345" msgstr "ABCDEFGabcdefg12345" -#: ../src/generic/colrdlgg.cpp:264 +#: ../src/html/helpfrm.cpp:270 +msgid "Add current page to bookmarks" +msgstr "Pøidá tuto stránku k zálo¾kám" + +#: ../src/generic/colrdlgg.cpp:272 msgid "Add to custom colours" msgstr "Pøidat k u¾ivatelským barvám" +#: ../src/html/helpctrl.cpp:83 +#, c-format +msgid "Adding book %s" +msgstr "Pøidávám knihu %s" + #: ../src/generic/prntdlgg.cpp:163 msgid "All" msgstr "V¹echny" -#: ../src/generic/logg.cpp:476 +#: ../src/generic/filedlgg.cpp:825 +msgid "All files (*)|*" +msgstr "V¹echny (*)|*" + +#: ../src/unix/dialup.cpp:359 +msgid "Already dialling ISP." +msgstr "U¾ vytáèím." + +#: ../src/generic/logg.cpp:1017 +#, c-format msgid "Append log to file '%s' (choosing [No] will overwrite it)?" msgstr "Pøipojit log k souboru '%s' (pokud zvolíte [Ne], soubor pøepí¹ete)?" -#: ../src/common/resourc2.cpp:844 -#: ../src/common/resource.cpp:2486 +#: ../src/common/fontmap.cpp:102 +msgid "Arabic (ISO-8859-6)" +msgstr "Arabské (ISO-8859-6)" + +#: ../src/common/paper.cpp:134 +msgid "B4 Envelope, 250 x 353 mm" +msgstr "Obálka B4, 250 x 353 mm" + +#: ../src/common/paper.cpp:116 +msgid "B4 sheet, 250 x 354 mm" +msgstr "stránka B4, 250 x 354 mm" + +#: ../src/common/paper.cpp:135 +msgid "B5 Envelope, 176 x 250 mm" +msgstr "Obálka B5, 176 x 250 mm" + +#: ../src/common/paper.cpp:117 +msgid "B5 sheet, 182 x 257 millimeter" +msgstr "stránka A5, 182 x 257 mm" + +#: ../src/common/paper.cpp:136 +msgid "B6 Envelope, 176 x 125 mm" +msgstr "Obálka B6, 176 x 125 mm" + +#: ../src/common/imagbmp.cpp:387 +msgid "BMP: Cannot deal with 4bit encoded yet." +msgstr "BMP: Zatím neumím zpracovat 4bitové kódování." + +#: ../src/common/imagbmp.cpp:266 ../src/common/imagbmp.cpp:278 +msgid "BMP: Couldn't allocate memory." +msgstr "BMP: Nemohu alokovat pamì»." + +#: ../src/common/imagbmp.cpp:62 +msgid "BMP: Couldn't save invalid image." +msgstr "BMP: Nemohu ulo¾it po¹kozený obrázek." + +#: ../src/common/imagbmp.cpp:154 +msgid "BMP: Couldn't write data." +msgstr "BMP: Nemohu zapsat data." + +#: ../src/common/imagbmp.cpp:131 +msgid "BMP: Couldn't write the file header." +msgstr "BMP: Nemohu zapsat hlavièku souboru." + +#: ../src/common/imagbmp.cpp:257 +msgid "BMP: Encoding doesn't match bitdepth." +msgstr "BMP: Kódování neodpovídá bitové hloubce." + +#: ../src/common/imagbmp.cpp:220 +msgid "BMP: Image height > 32767 pixels for file." +msgstr "BMP: Obrázek má vý¹ku vìt¹í ne¾ 32767 pixelù." + +#: ../src/common/imagbmp.cpp:214 +msgid "BMP: Image width > 32767 pixels for file." +msgstr "BMP: Obrázek má ¹íøku vìt¹í ne¾ 32767 pixelù." + +#: ../src/common/imagbmp.cpp:234 +msgid "BMP: Unknown bitdepth in file." +msgstr "BMP: Neznámá bitová hloubka." + +#: ../src/common/imagbmp.cpp:243 +msgid "BMP: Unknown encoding in file." +msgstr "BMP: Neznámé kódování." + +#: ../src/generic/helpwxht.cpp:157 +msgid "Back" +msgstr "Zpìt" + +#: ../src/common/dlgcmn.cpp:135 +msgid "Backward" +msgstr "Zpìt" + +#: ../src/common/fontmap.cpp:109 +msgid "Baltic (ISO-8859-13)" +msgstr "Baltské (ISO-8859-13)" + +#: ../src/common/fontmap.cpp:100 +msgid "Baltic (old) (ISO-8859-4)" +msgstr "Baltské (staré) (ISO-8859-4)" + +#: ../src/common/resourc2.cpp:844 ../src/common/resource.cpp:2494 +#, c-format msgid "Bitmap resource specification %s not found." msgstr "Bitmap resource %s nenalezen." @@ -148,139 +450,356 @@ msgstr "Tu msgid "Bottom margin (mm):" msgstr "Dolní okraj (mm):" -#: ../src/generic/logg.cpp:433 +#: ../src/common/paper.cpp:105 +msgid "C sheet, 17 x 22 in" +msgstr "stránka C, 17 x 22 palcù" + +#: ../src/generic/logg.cpp:471 msgid "C&lear" msgstr "&Vymazat" -#: ../src/mac/thread.cpp:179 -#: ../src/msw/thread.cpp:222 -#: ../src/os2/THREAD.CPP:219 +#: ../src/common/paper.cpp:130 +msgid "C3 Envelope, 324 x 458 mm" +msgstr "Obálka C3, 324 x 458 mm" + +#: ../src/common/paper.cpp:131 +msgid "C4 Envelope, 229 x 324 mm" +msgstr "Obálka C4, 229 x 324 mm" + +#: ../src/common/paper.cpp:129 +msgid "C5 Envelope, 162 x 229 mm" +msgstr "Obálka C5, 162 x 229 mm" + +#: ../src/common/paper.cpp:132 +msgid "C6 Envelope, 114 x 162 mm" +msgstr "Obálka C6, 114 x 162 mm" + +#: ../src/common/paper.cpp:133 +msgid "C65 Envelope, 114 x 229 mm" +msgstr "Obálka C65, 114 x 229 mm" + +#: ../src/mac/thread.cpp:179 ../src/msw/thread.cpp:222 msgid "Can not create event object." msgstr "Nemohu vytvoøit object události." +#: ../src/msw/thread.cpp:124 +msgid "Can not create mutex" +msgstr "Nemohu vytvoøit mutex." + #: ../src/mac/thread.cpp:92 -#: ../src/os2/THREAD.CPP:93 msgid "Can not create mutex." msgstr "Nemohu vytvoøit mutex." -#: ../src/common/filefn.cpp:1279 -#: ../src/msw/dir.cpp:294 -#: ../src/os2/DIR.CPP:194 +#: ../src/common/filefn.cpp:1271 ../src/msw/dir.cpp:294 #: ../src/unix/dir.cpp:214 +#, c-format msgid "Can not enumerate files in directory '%s'" msgstr "Nemohu zjistit soubory v adresáøi '%s'" -#: ../src/mac/thread.cpp:407 -#: ../src/msw/thread.cpp:520 +#: ../src/msw/thread.cpp:527 +#, c-format msgid "Can not resume thread %x" msgstr "Nemohu obnovit vlákno %x" -#: ../src/mac/thread.cpp:327 -#: ../src/msw/thread.cpp:402 +#: ../src/msw/thread.cpp:408 msgid "Can not start thread: error writing TLS." msgstr "Nemohu spustit vlákno: chyba pøi zápisu TLS." -#: ../src/mac/thread.cpp:392 -#: ../src/msw/thread.cpp:505 +#: ../src/msw/thread.cpp:512 +#, c-format msgid "Can not suspend thread %x" msgstr "Nemohu pozastavit vlákno %x" -#: ../src/mac/thread.cpp:544 -#: ../src/msw/thread.cpp:823 +#: ../src/msw/thread.cpp:846 msgid "Can not wait for thread termination" msgstr "Nemohu poèkat na ukonèení vlákna" -#: ../src/common/docview.cpp:1872 +#: ../src/common/docview.cpp:1883 msgid "Can't &Undo " msgstr "Nemohu vzít zpìt" -#: ../src/mac/thread.cpp:356 -#: ../src/msw/thread.cpp:487 -#: ../src/os2/THREAD.CPP:427 +#: ../src/common/image.cpp:926 +#, c-format +msgid "Can't check image format of file '%s': file does not exist." +msgstr "Nemohu detekovat formát obrázku '%s': soubor neexistuje." + +#: ../src/msw/registry.cpp:410 +#, c-format +msgid "Can't close registry key '%s'" +msgstr "Nemohu zavøít registrový klíè '%s'" + +#: ../src/msw/registry.cpp:486 +#, c-format +msgid "Can't copy values of unsupported type %d." +msgstr "Nemohu kopírovat hodnoty nepodporovaného typu %d" + +#: ../src/msw/listctrl.cpp:212 +msgid "Can't create list control window, check that comctl32.dll is installed." +msgstr "" +"Nemohu vytvoøit ovládací prvek list, zkontrolujte, jestli máte " +"nainstalovanou comctl32.dll." + +#: ../src/msw/registry.cpp:393 +#, c-format +msgid "Can't create registry key '%s'" +msgstr "Nemohu vytvoøit registrový klíè '%s'" + +#: ../src/msw/utilsexc.cpp:418 +msgid "Can't create the inter-process read pipe" +msgstr "Nemohu vytvoøit meziprocesovou rouru pro ètení" + +#: ../src/msw/utilsexc.cpp:430 +msgid "Can't create the inter-process write pipe" +msgstr "Nemohu vytvoøit meziprocesovou rouru pro zápis" + +#: ../src/msw/thread.cpp:494 msgid "Can't create thread" msgstr "Nemohu vytvoøit vlákno" -#: ../src/msw/iniconf.cpp:472 -#: ../src/os2/INICONF.CPP:446 +#: ../src/msw/window.cpp:2388 +#, c-format +msgid "" +"Can't create window of class %s!\n" +"Possible Windows 3.x compatibility problem?" +msgstr "" +"Nemohu vytvoøit okno tøídy %s!\n" +"Mo¾ná se jedná o problém kompatibility Windows 3.x?" + +#: ../src/msw/registry.cpp:653 +#, c-format +msgid "Can't delete key '%s'" +msgstr "Nemohu smazat klíè '%s'" + +#: ../src/msw/iniconf.cpp:476 +#, c-format msgid "Can't delete the INI file '%s'" msgstr "Nemohu smazat INI soubor '%s'" -#: ../src/msw/utilsexc.cpp:400 -msgid "Can't execute command '%s'" -msgstr "Nemohu spustit pøíkaz '%s'" +#: ../src/msw/registry.cpp:678 +#, c-format +msgid "Can't delete value '%s' from key '%s'" +msgstr "Nemohu smazat hodnotu '%s' z klíèe '%s'" + +#: ../src/msw/registry.cpp:689 +#, c-format +msgid "Can't delete value of key '%s'" +msgstr "Nemohu smazat hodnotu klíèe '%s'" + +#: ../src/msw/registry.cpp:991 +#, c-format +msgid "Can't enumerate subkeys of key '%s'" +msgstr "Nemohu vyjmenovat podklíèe klíèe '%s'" + +#: ../src/msw/registry.cpp:946 +#, c-format +msgid "Can't enumerate values of key '%s'" +msgstr "Nemohu vyjmenovat hodnoty klíèe '%s'" + +#: ../src/common/ffile.cpp:234 +#, c-format +msgid "Can't find current position in file '%s'" +msgstr "Nemohu zjistit pozici v souboru '%s'" + +#: ../src/msw/window.cpp:2338 +msgid "" +"Can't find dummy dialog template!\n" +"Check resource include path for finding wx.rc." +msgstr "" +"Nemohu najít dialogovou ¹ablonu dummy!\n" +"Ovìøte, jestli je správnì nastavená cesta k wx.rc." -#: ../src/common/object.cpp:322 -#: ../src/common/object.cpp:343 +#: ../src/common/object.cpp:314 ../src/common/object.cpp:335 +#, c-format msgid "Can't find the serialization object '%s' for the object '%s'." msgstr "Nemohu najít serializaèní objekt '%s' k objektu '%s'." -#: ../src/common/object.cpp:314 +#: ../src/msw/registry.cpp:342 +#, c-format +msgid "Can't get info about registry key '%s'" +msgstr "Nemohu získat informace o registrovém klíèi '%s'" + +#: ../src/common/image.cpp:626 ../src/common/image.cpp:646 +#, c-format +msgid "Can't load image from file '%s': file does not exist." +msgstr "Nemohu naèíst obrázek ze souboru '%s': soubor neexistuje." + +#: ../src/common/object.cpp:307 msgid "Can't load wxSerial dynamic library." msgstr "Nemohu naèíst dynamickou knihovnu wxSerial." -#: ../src/generic/logg.cpp:522 +#: ../src/msw/dib.cpp:434 +#, c-format +msgid "Can't open file '%s'" +msgstr "Nemohu otevøít soubor '%s'" + +#: ../src/msw/registry.cpp:368 +#, c-format +msgid "Can't open registry key '%s'" +msgstr "Nemohu otevøít registrový klíè '%s'" + +#: ../src/msw/registry.cpp:870 +#, c-format +msgid "Can't read value of '%s'" +msgstr "Nemohu pøeèíst hodnotu '%s'" + +#: ../src/msw/registry.cpp:769 ../src/msw/registry.cpp:808 +#, c-format +msgid "Can't read value of key '%s'" +msgstr "Nemohu naèíst hodnotu klíèe '%s'" + +#: ../src/generic/logg.cpp:531 ../src/generic/logg.cpp:928 msgid "Can't save log contents to file." msgstr "Nemohu ulo¾it obsah logu do souboru." -#: ../src/mac/thread.cpp:381 -#: ../src/msw/thread.cpp:453 -#: ../src/os2/THREAD.CPP:409 +#: ../src/msw/thread.cpp:460 msgid "Can't set thread priority" msgstr "Nemohu nastavit prioritu vlákna" -#: ../src/common/dlgcmn.cpp:146 -#: ../src/common/prntbase.cpp:107 -#: ../src/generic/dcpsg.cpp:2192 -#: ../src/generic/dirdlgg.cpp:413 -#: ../src/generic/filedlgg.cpp:911 -#: ../src/generic/fontdlgg.cpp:257 -#: ../src/generic/prntdlgg.cpp:468 -#: ../src/generic/progdlgg.cpp:179 -#: ../src/generic/proplist.cpp:523 -#: ../src/generic/wizard.cpp:174 -#: ../src/gtk/filedlg.cpp:164 -#: ../src/gtk/fontdlg.cpp:178 -#: ../src/html/helpfrm.cpp:890 -#: ../src/motif/msgdlg.cpp:178 +#: ../src/msw/registry.cpp:794 ../src/msw/registry.cpp:894 +#, c-format +msgid "Can't set value of '%s'" +msgstr "Nemohu nastavit hodnotu '%s'" + +#: ../src/common/dlgcmn.cpp:148 ../src/common/prntbase.cpp:107 +#: ../src/generic/dcpsg.cpp:2241 ../src/generic/dirdlgg.cpp:424 +#: ../src/generic/filedlgg.cpp:916 ../src/generic/fontdlgg.cpp:257 +#: ../src/generic/prntdlgg.cpp:468 ../src/generic/progdlgg.cpp:179 +#: ../src/generic/proplist.cpp:523 ../src/generic/wizard.cpp:192 +#: ../src/gtk/filedlg.cpp:164 ../src/gtk/fontdlg.cpp:178 +#: ../src/html/helpfrm.cpp:910 ../src/motif/msgdlg.cpp:178 msgid "Cancel" msgstr "Storno" -#: ../src/msw/app.cpp:220 -msgid "Cannot initialize OLE" -msgstr "Nemohu inicializovat OLE" +#: ../src/msw/dialup.cpp:514 +#, c-format +msgid "Cannot find active dialup connection: %s" +msgstr "Nemohu nalézt aktivní vytáèené pøipojení: %s" -#: ../src/generic/logg.cpp:433 -msgid "Clear the log contents" +#: ../src/msw/dialup.cpp:827 +msgid "Cannot find the location of address book file" +msgstr "Nemohu najít umístìní adresáøe" + +#: ../src/unix/threadpsx.cpp:954 +#, c-format +msgid "Cannot get priority range for scheduling policy %d." +msgstr "Nemohu zjistit rozsah priorit pro plánovací politiku %d." + +#: ../src/unix/utilsunx.cpp:709 +msgid "Cannot get the hostname" +msgstr "Nemohu zjistit jméno poèítaèe" + +#: ../src/unix/utilsunx.cpp:745 +msgid "Cannot get the official hostname" +msgstr "Nemohu zjistit oficiální jméno poèítaèe" + +#: ../src/msw/dialup.cpp:920 +msgid "Cannot hang up - no active dialup connection." +msgstr "Nemohu zavìsit - ¾ádná aktivní vytáèená pøipojení." + +#: ../src/msw/app.cpp:252 +msgid "Cannot initialize OLE" +msgstr "Nemohu inicializovat OLE" + +#: ../src/html/htmlfilt.cpp:146 +#, c-format +msgid "Cannot open HTML document: %s" +msgstr "Nelze otevøít HTML dokument: %s" + +#: ../src/html/helpdata.cpp:657 +#, c-format +msgid "Cannot open HTML help book: %s" +msgstr "Nelze otevøít HTML nápovìdu: %s" + +#: ../src/generic/helpext.cpp:96 +#, c-format +msgid "Cannot open URL '%s'" +msgstr "Nemohu otevøít URL '%s'" + +#: ../src/html/helpdata.cpp:353 +#, c-format +msgid "Cannot open contents file: %s" +msgstr "Nelze otevøít soubor s obsahem: %s" + +#: ../src/generic/dcpsg.cpp:1584 +msgid "Cannot open file for PostScript printing!" +msgstr "Nemohu otevøít soubor k PostScriptovému tisku!" + +#: ../src/html/helpdata.cpp:368 +#, c-format +msgid "Cannot open index file: %s" +msgstr "Nelze otevøít soubor s rejstøíkem: %s" + +#: ../src/html/helpfrm.cpp:1174 +msgid "Cannot print empty page." +msgstr "Nemohu tisknout prázdnou stránku." + +#: ../src/unix/threadpsx.cpp:935 +msgid "Cannot retrieve thread scheduling policy." +msgstr "Nemohu obnovit plánovací politiku vlákna." + +#: ../src/unix/threadpsx.cpp:588 +msgid "Cannot start thread: error writing TLS" +msgstr "Nemohu spustit vlákno: chyba zápisu TLS" + +#: ../src/html/helpfrm.cpp:398 +msgid "Case sensitive" +msgstr "Rozli¹ovat velká/malá" + +#: ../src/common/fontmap.cpp:98 +msgid "Central European (ISO-8859-2/Latin 2)" +msgstr "Støedoevropské (ISO-8859-2/Latin 2)" + +#: ../src/msw/dialup.cpp:762 +msgid "Choose ISP to dial" +msgstr "Vyberte ISP, ke kterému se má volat" + +#: ../src/gtk/fontdlg.cpp:159 +msgid "Choose font" +msgstr "Vyberte písmo" + +#: ../src/generic/logg.cpp:471 +msgid "Clear the log contents" msgstr "Smazat obsah logu" -#: ../src/common/prntbase.cpp:357 -#: ../src/generic/progdlgg.cpp:307 +#: ../src/common/prntbase.cpp:357 ../src/generic/progdlgg.cpp:307 #: ../src/generic/proplist.cpp:518 msgid "Close" msgstr "Zavøít" -#: ../src/generic/logg.cpp:435 +#: ../src/generic/logg.cpp:473 msgid "Close this window" msgstr "Zavøít okno" -#: ../src/generic/filedlgg.cpp:1072 -#: ../src/gtk/filedlg.cpp:75 +#: ../src/common/fileconf.cpp:750 +#, c-format +msgid "Config entry name cannot start with '%c'." +msgstr "Polo¾ka konfigurace nemù¾e zaèínat na '%c'" + +#: ../src/generic/filedlgg.cpp:1077 ../src/gtk/filedlg.cpp:75 msgid "Confirm" msgstr "Potvrdit" +#: ../src/html/htmlwin.cpp:166 +msgid "Connecting..." +msgstr "Pøipojuji se..." + #: ../src/generic/helpxlp.cpp:240 +#, c-format msgid "Connection to wxHelp timed out in %d seconds" msgstr "Vypr¹elo spojení s wxHelp :%d sekund" +#: ../src/generic/helpwxht.cpp:159 ../src/html/helpfrm.cpp:303 +#: ../src/html/helpfrm.cpp:312 +msgid "Contents" +msgstr "Obsah" + #: ../src/generic/prntdlgg.cpp:196 msgid "Copies:" msgstr "Kopie:" -#: ../src/common/resourc2.cpp:287 -#: ../src/common/resourc2.cpp:1358 -#: ../src/common/resource.cpp:1791 -#: ../src/common/resource.cpp:1921 -#: ../src/common/resource.cpp:3004 +#: ../src/common/resourc2.cpp:287 ../src/common/resource.cpp:1800 +#: ../src/common/resource.cpp:1930 +#, c-format msgid "Could not find resource include file %s." msgstr "Nemohu nalézt resource include file %s." @@ -288,110 +807,214 @@ msgstr "Nemohu nal msgid "Could not find tab for id" msgstr "Nemohu najít tab k id" -#: ../src/common/resource.cpp:791 -msgid "Could not resolve control class or id '%s'. Use (non-zero) integer instead\n or provide #define (see manual for caveats)" -msgstr "Nemohu zjistit tøídu prvku (control) nebo jeho id: '%s'. Pou¾ijte (nenulové) èíslo\n nebo poskytnìte #define (viz. manuál)" +#: ../src/msw/textctrl.cpp:1191 +#, c-format +msgid "Could not load Rich Edit DLL '%s'" +msgstr "Nemohu naèíst Rich Edit DLL '%s'" + +#: ../src/common/resource.cpp:796 +#, c-format +msgid "" +"Could not resolve control class or id '%s'. Use (non-zero) integer instead\n" +" or provide #define (see manual for caveats)" +msgstr "" +"Nemohu zjistit tøídu prvku (control) nebo jeho id: '%s'. Pou¾ijte (nenulové) " +"èíslo\n" +" nebo poskytnìte #define (viz. manuál)" -#: ../src/common/resource.cpp:1236 -msgid "Could not resolve menu id '%s'. Use (non-zero) integer instead\nor provide #define (see manual for caveats)" -msgstr "Nemohu zjistit id menu '%s'. Pou¾ijte (nenulové) èíslo\nnebo poskytnìte #define (viz. manuál)" +#: ../src/common/resource.cpp:1245 +#, c-format +msgid "" +"Could not resolve menu id '%s'. Use (non-zero) integer instead\n" +"or provide #define (see manual for caveats)" +msgstr "" +"Nemohu zjistit id menu '%s'. Pou¾ijte (nenulové) èíslo\n" +"nebo poskytnìte #define (viz. manuál)" #: ../src/common/prntbase.cpp:709 msgid "Could not start document preview." msgstr "Nemohu zobrazit náhled dokumentu." -#: ../src/generic/printps.cpp:200 -#: ../src/msw/printwin.cpp:240 +#: ../src/generic/printps.cpp:200 ../src/msw/printwin.cpp:242 msgid "Could not start printing." msgstr "Nemohu zahájit tisk." -#: ../src/common/wincmn.cpp:762 +#: ../src/common/wincmn.cpp:777 msgid "Could not transfer data to window" msgstr "Nemohu pøenést data do okna." -#: ../src/mac/thread.cpp:121 #: ../src/msw/thread.cpp:166 -#: ../src/os2/THREAD.CPP:124 msgid "Couldn't acquire a mutex lock" msgstr "Nemohu získat zámek mutexu." -#: ../src/msw/dragimag.cpp:142 -#: ../src/msw/dragimag.cpp:179 -#: ../src/msw/imaglist.cpp:145 -#: ../src/msw/imaglist.cpp:167 -#: ../src/msw/imaglist.cpp:180 +#: ../src/msw/dragimag.cpp:142 ../src/msw/dragimag.cpp:179 +#: ../src/msw/imaglist.cpp:153 ../src/msw/imaglist.cpp:175 +#: ../src/msw/imaglist.cpp:188 msgid "Couldn't add an image to the image list." msgstr "Nemohu pøidat obrázek do seznamu." #: ../src/mac/thread.cpp:227 -#: ../src/os2/THREAD.CPP:258 msgid "Couldn't change the state of event object." msgstr "Nemohu zmìnit stav event object." #: ../src/msw/timer.cpp:96 -#: ../src/os2/TIMER.CPP:89 msgid "Couldn't create a timer" msgstr "Nemohu vytvoøit èasovaè" -#: ../src/mac/thread.cpp:427 -#: ../src/msw/thread.cpp:540 +#: ../src/common/dynlib.cpp:268 +#, c-format +msgid "Couldn't find symbol '%s' in a dynamic library" +msgstr "Nemohu v dynamické knihovnì nalézt symbol '%s'" + +#: ../src/msw/thread.cpp:553 msgid "Couldn't get the current thread pointer" msgstr "Nemohu získat ukazatel na aktuální vlákno" -#: ../src/mac/thread.cpp:155 +#: ../src/msw/utilsexc.cpp:625 +#, c-format +msgid "Couldn't launch DDE server '%s'." +msgstr "Nemohu spustit DDE server '%s'." + +#: ../src/common/imagpng.cpp:245 +msgid "Couldn't load a PNG image - file is corrupted or not enough memory." +msgstr "" +"Nemohu naèíst PNG obrázek - buï je po¹kozený soubor nebo je nedostatek " +"pamìti." + +#: ../src/msw/ole/dataobj.cpp:151 +#, c-format +msgid "Couldn't register clipboard format '%s'." +msgstr "Nemohu zaregistrovat formát schránky '%s'." + #: ../src/msw/thread.cpp:198 -#: ../src/os2/THREAD.CPP:157 msgid "Couldn't release a mutex" msgstr "Nemohu uvolnit mutex" -#: ../src/msw/listctrl.cpp:608 +#: ../src/msw/listctrl.cpp:612 +#, c-format msgid "Couldn't retrieve information about list control item %d." msgstr "Nemohu získat informace o polo¾ce %d v seznamu." -#: ../src/mac/thread.cpp:609 -#: ../src/msw/thread.cpp:910 +#: ../src/msw/thread.cpp:933 msgid "Couldn't terminate thread" msgstr "Nemohu pøeru¹it vlákno" +#: ../src/generic/dirdlgg.cpp:571 +msgid "Create directory" +msgstr "Vytváøení adresáøe" + +#: ../src/generic/filedlgg.cpp:883 +msgid "Create new directory" +msgstr "Vytvoøit nový adresáø" + +#: ../src/generic/filedlgg.cpp:890 +msgid "Current directory:" +msgstr "Aktuální adresáø:" + +#: ../src/common/fontmap.cpp:101 +msgid "Cyrillic (Latin 5)" +msgstr "Cyrilice (Latin 5)" + +#: ../src/common/paper.cpp:106 +msgid "D sheet, 22 x 34 in" +msgstr "stránka D, 22 x 34 palcù" + +#: ../src/msw/dde.cpp:586 +msgid "DDE poke request failed" +msgstr "Po¾adavek na DDE poke selhal" + +#: ../src/common/paper.cpp:128 +msgid "DL Envelope, 110 x 220 mm" +msgstr "Obálka DL, 110 x 220 mm" + +#: ../src/generic/filedlgg.cpp:535 +msgid "Date" +msgstr "Datum" + #: ../src/generic/fontdlgg.cpp:207 msgid "Decorative" msgstr "Ozdobný" -#: ../src/generic/dirdlgg.cpp:467 +#: ../src/msw/dialup.cpp:350 +msgid "" +"Dial up functions are unavailable because the remote access service (RAS) is " +"not installed on this machine. Please install it." +msgstr "" +"Vytáèené pøipojení není dostupné, proto¾e Remote Access Service (RAS) není " +"nainstalován. Prosím, nainstalujte ho." + +#: ../src/generic/tipdlg.cpp:177 +msgid "Did you know..." +msgstr "Víte, ¾e..." + +#: ../src/common/filefn.cpp:1086 +#, c-format +msgid "Directory '%s' couldn't be created" +msgstr "Nelze vytvoøit adresáø '%s'" + +#: ../src/generic/dirdlgg.cpp:538 msgid "Directory does not exist" msgstr "Adresáø neexistuje" -#: ../src/common/docview.cpp:431 +#: ../src/html/helpfrm.cpp:366 +msgid "" +"Display all index items that contain given substring. Search is case " +"insensitive." +msgstr "" +"Zobrazí v¹echny polo¾ky rejstøíku, které obsahují daný podøetìzec. " +"Nerozli¹uje velká a malá písmena." + +#: ../src/html/helpfrm.cpp:535 +msgid "Display options dialog" +msgstr "Zobrazí dialog s nastaveními" + +#: ../src/common/docview.cpp:438 +#, c-format msgid "Do you want to save changes to document %s?" msgstr "Chcete ulo¾it zmìny do dokumentu %s?" -#: ../src/generic/helphtml.cpp:310 +#: ../src/html/htmlwin.cpp:216 +msgid "Done" +msgstr "Hotovo" + +#: ../src/generic/progdlgg.cpp:313 +msgid "Done." +msgstr "Hotovo." + +#: ../src/common/paper.cpp:107 +msgid "E sheet, 34 x 44 in" +msgstr "stránka E, 34 x 44 palcù" + +#: ../src/generic/progdlgg.cpp:153 +msgid "Elapsed time : " +msgstr "Dosa¾ený èas : " + +#: ../src/generic/helphtml.cpp:320 msgid "Entries found" msgstr "Nalezené polo¾ky" -#: ../src/common/config.cpp:343 -msgid "Environment variables expansion failed: missing '%c' at position %d in '%s'." -msgstr "Chyba bìhem expanze promnìných prostøedí: chybí '%c' na pozici %d v '%s'." - -#: ../src/generic/dcpsg.cpp:1541 -#: ../src/generic/dirdlgg.cpp:263 -#: ../src/generic/dirdlgg.cpp:281 -#: ../src/generic/dirdlgg.cpp:292 -#: ../src/generic/dirdlgg.cpp:533 -#: ../src/generic/filedlgg.cpp:620 -#: ../src/generic/filedlgg.cpp:712 -#: ../src/generic/filedlgg.cpp:726 -#: ../src/generic/filedlgg.cpp:739 -#: ../src/generic/filedlgg.cpp:1038 -#: ../src/generic/filedlgg.cpp:1087 -#: ../src/generic/helpxlp.cpp:241 -#: ../src/generic/logg.cpp:201 -#: ../src/gtk/filedlg.cpp:83 -#: ../src/gtk/fontdlg.cpp:72 +#: ../src/common/config.cpp:349 +#, c-format +msgid "" +"Environment variables expansion failed: missing '%c' at position %d in '%s'." +msgstr "" +"Chyba bìhem expanze promìnných prostøedí: chybí '%c' na pozici %d v '%s'." + +#: ../src/generic/dcpsg.cpp:1584 ../src/generic/dirdlgg.cpp:268 +#: ../src/generic/dirdlgg.cpp:286 ../src/generic/dirdlgg.cpp:297 +#: ../src/generic/dirdlgg.cpp:604 ../src/generic/filedlgg.cpp:625 +#: ../src/generic/filedlgg.cpp:717 ../src/generic/filedlgg.cpp:731 +#: ../src/generic/filedlgg.cpp:744 ../src/generic/filedlgg.cpp:1043 +#: ../src/generic/filedlgg.cpp:1092 ../src/generic/helpxlp.cpp:241 +#: ../src/gtk/filedlg.cpp:83 ../src/gtk/fontdlg.cpp:72 msgid "Error" msgstr "Chyba" -#: ../src/generic/dirdlgg.cpp:480 +#: ../src/unix/utilsunx.cpp:948 ../src/unix/utilsunx.cpp:956 +msgid "Error " +msgstr "Chyba" + +#: ../src/generic/dirdlgg.cpp:551 msgid "Error creating directory" msgstr "Chyba pøi vytváøení adresáøe" @@ -399,145 +1022,438 @@ msgstr "Chyba p msgid "Error: " msgstr "Chyba: " -#: ../src/generic/dirdlgg.cpp:213 +#: ../src/common/fontmap.cpp:99 +msgid "Esperanto (ISO-8859-3)" +msgstr "Esperanto (ISO-8859-3)" + +#: ../src/generic/progdlgg.cpp:160 +msgid "Estimated time : " +msgstr "Odhadovaný èas : " + +#: ../src/generic/dirdlgg.cpp:217 msgid "Etcetera" msgstr "Etcetera" -#: ../src/msw/utilsexc.cpp:484 +#: ../src/msw/utilsexc.cpp:521 +#, c-format msgid "Execution of command '%s' failed" msgstr "Chyba pøi volání pøíkazu '%s'" -#: ../src/common/resourc2.cpp:326 -#: ../src/common/resourc2.cpp:1399 -#: ../src/common/resource.cpp:1830 -#: ../src/common/resource.cpp:1960 -#: ../src/common/resource.cpp:3045 +#: ../src/common/paper.cpp:112 +msgid "Executive, 7 1/4 x 10 1/2 in" +msgstr "Executive, 7 1/4 x 10 1/2 palce" + +#: ../src/common/resourc2.cpp:326 ../src/common/resourc2.cpp:1399 +#: ../src/common/resource.cpp:1839 ../src/common/resource.cpp:1969 +#: ../src/common/resource.cpp:3053 msgid "Expected '*' whilst parsing resource." msgstr "Pøi parsování resource oèekávám '*'." -#: ../src/common/resourc2.cpp:342 -#: ../src/common/resourc2.cpp:1415 -#: ../src/common/resource.cpp:1847 -#: ../src/common/resource.cpp:1976 -#: ../src/common/resource.cpp:3062 +#: ../src/common/resourc2.cpp:342 ../src/common/resourc2.cpp:1415 +#: ../src/common/resource.cpp:1856 ../src/common/resource.cpp:1985 +#: ../src/common/resource.cpp:3070 msgid "Expected '=' whilst parsing resource." msgstr "Pøi parsování resource oèekávám '='." -#: ../src/common/resourc2.cpp:312 -#: ../src/common/resourc2.cpp:1385 -#: ../src/common/resource.cpp:1816 -#: ../src/common/resource.cpp:1946 -#: ../src/common/resource.cpp:3031 +#: ../src/common/resourc2.cpp:312 ../src/common/resourc2.cpp:1385 +#: ../src/common/resource.cpp:1825 ../src/common/resource.cpp:1955 +#: ../src/common/resource.cpp:3039 msgid "Expected 'char' whilst parsing resource." msgstr "Pøi parsování resource oèekávám 'char'." +#: ../src/msw/dialup.cpp:855 +#, c-format +msgid "Failed to %s dialup connection: %s" +msgstr "Nepodaøilo se %s pøipojení k Internetu: %s" + #: ../src/msw/clipbrd.cpp:122 -#: ../src/os2/CLIPBRD.CPP:94 msgid "Failed to close the clipboard." msgstr "Nemohu uzavøít schránku." -#: ../src/generic/dirdlgg.cpp:478 +#: ../src/msw/dialup.cpp:796 +msgid "Failed to connect: missing username/password." +msgstr "Nepodaøilo se pøipojit: chybí u¾ivatelské jméno nebo heslo." + +#: ../src/msw/dialup.cpp:742 +msgid "Failed to connect: no ISP to dial." +msgstr "Nelze se pøipojit: ¾ádný ISP." + +#: ../src/msw/registry.cpp:590 +#, c-format +msgid "Failed to copy registry value '%s'" +msgstr "Nelze zkopírovat hodnotu registru '%s'" + +#: ../src/msw/registry.cpp:599 +#, c-format +msgid "Failed to copy the contents of registry key '%s' to '%s'." +msgstr "Nelze zkopírovat obsah registrového klíèe '%s' do '%s'." + +#: ../src/msw/dde.cpp:923 +msgid "Failed to create DDE string" +msgstr "Nelze vytvoøit DDE øe»ezec" + +#: ../src/msw/mdi.cpp:411 +msgid "Failed to create MDI parent frame." +msgstr "Nepodaøilo se vytvoøit rodièovské MDI okno." + +#: ../src/msw/statbr95.cpp:149 +msgid "Failed to create a status bar." +msgstr "Nelze vytvoøit status bar." + +#: ../src/msw/dde.cpp:401 +#, c-format +msgid "Failed to create connection to server '%s' on topic '%s'" +msgstr "Nelze navázat spojení se server '%s' na téma '%s'" + +#: ../src/msw/dialog.cpp:176 +msgid "" +"Failed to create dialog. You probably forgot to include wx/msw/wx.rc in your " +"resources." +msgstr "" +"Nelze vytvoøit dialog. Nejspí¹ jste zapomnìl vlo¾it wx/msw/wx.rc do resource " +"souboru." + +#: ../src/generic/dirdlgg.cpp:549 msgid "Failed to create directory " msgstr "Nemohu vytvoøit adresáø" -#: ../src/os2/tooltip.cpp:193 -msgid "Failed to create the tooltip '%s'" -msgstr "Nemohu vytvoøit tooltip '%s'" +#: ../src/html/winpars.cpp:364 +#, c-format +msgid "Failed to display HTML document in %s encoding" +msgstr "Nelze zobrati HTML dokument v kódování %s" #: ../src/msw/clipbrd.cpp:134 -#: ../src/os2/CLIPBRD.CPP:108 msgid "Failed to empty the clipboard." msgstr "Nemohu vyprázdnit shcránku." -#: ../src/common/resourc2.cpp:809 -#: ../src/common/resource.cpp:2450 -msgid "Failed to find XBM resource %s.\nForgot to use wxResourceLoadBitmapData?" -msgstr "Nemohu nalézt XBM resource %s.\nNezapomnìl jste pou¾ít wxResourceLoadBitmapData?" +#: ../src/msw/dde.cpp:605 +msgid "Failed to establish an advise loop with DDE server" +msgstr "Nelze navázat 'advise loop' s DDE serverem" -#: ../src/common/resourc2.cpp:964 -#: ../src/common/resource.cpp:2606 -msgid "Failed to find XBM resource %s.\nForgot to use wxResourceLoadIconData?" -msgstr "Nemohu nalézt XBM resource %s.\nNezapomnìl jste pou¾ít wxResourceLoadIconData?" +#: ../src/msw/dialup.cpp:635 +#, c-format +msgid "Failed to establish dialup connection: %s" +msgstr "Nepodaøilo se navázat vytáèené spojení: %s" -#: ../src/common/resourc2.cpp:825 -#: ../src/common/resource.cpp:2466 -msgid "Failed to find XPM resource %s.\nForgot to use wxResourceLoadBitmapData?" -msgstr "Nemohu nalézt XPM resource %s.\nNezapomnìl jste pou¾ít wxResourceLoadBitmapData?" +#: ../src/unix/utilsunx.cpp:441 ../src/unix/utilsunx.cpp:469 +#, c-format +msgid "Failed to execute '%s'\n" +msgstr "Nepodaøilo se spustit '%s'\n" -#: ../src/msw/clipbrd.cpp:102 -#: ../src/os2/CLIPBRD.CPP:71 -msgid "Failed to open the clipboard." -msgstr "Nemohu otevøít schránku." +#: ../src/common/resourc2.cpp:808 ../src/common/resource.cpp:2458 +#, c-format +msgid "" +"Failed to find XBM resource %s.\n" +"Forgot to use wxResourceLoadBitmapData?" +msgstr "" +"Nemohu nalézt XBM resource %s.\n" +"Nezapomnìl jste pou¾ít wxResourceLoadBitmapData?" -#: ../src/msw/clipbrd.cpp:428 -#: ../src/os2/CLIPBRD.CPP:401 -msgid "Failed to retrieve data from the clipboard." -msgstr "Nemohu získat data ze schránky." +#: ../src/common/resourc2.cpp:963 ../src/common/resource.cpp:2613 +#, c-format +msgid "" +"Failed to find XBM resource %s.\n" +"Forgot to use wxResourceLoadIconData?" +msgstr "" +"Nemohu nalézt XBM resource %s.\n" +"Nezapomnìl jste pou¾ít wxResourceLoadIconData?" -#: ../src/msw/clipbrd.cpp:300 -#: ../src/os2/CLIPBRD.CPP:274 -msgid "Failed to set clipboard data." -msgstr "Nemohu ulo¾it data do schránky." +#: ../src/common/resourc2.cpp:824 ../src/common/resource.cpp:2474 +#, c-format +msgid "" +"Failed to find XPM resource %s.\n" +"Forgot to use wxResourceLoadBitmapData?" +msgstr "" +"Nemohu nalézt XPM resource %s.\n" +"Nezapomnìl jste pou¾ít wxResourceLoadBitmapData?" -#: ../src/unix/threadpsx.cpp:1071 -msgid "Failed to set thread priority %d." -msgstr "Nemohu nastavit prioritu vlákna %d." +#: ../src/msw/dialup.cpp:695 +#, c-format +msgid "Failed to get ISP names: %s" +msgstr "Nepodaøilo se získat jména ISP: %s" -#: ../src/unix/threadpsx.cpp:1251 -msgid "Failed to terminate a thread." -msgstr "Nemohu ukonèit vlákno." +#: ../src/msw/clipbrd.cpp:623 +msgid "Failed to get data from the clipboard" +msgstr "Nelze získat data ze schránky" -#: ../src/generic/logg.cpp:329 -msgid "Fatal error" -msgstr "Kritická chyba" +#: ../src/common/timercmn.cpp:243 +msgid "Failed to get the UTC system time." +msgstr "Nemohu zjistit systémový UTC èas." -#: ../src/common/log.cpp:347 -msgid "Fatal error: " -msgstr "Kritická chyba: " +#: ../src/common/timercmn.cpp:195 +msgid "Failed to get the local system time" +msgstr "Nepodaøilo se zjistit místní systémový èas" -#: ../src/generic/filedlgg.cpp:1070 -#: ../src/gtk/filedlg.cpp:73 -msgid "File '%s' already exists, do you really want to overwrite it?" -msgstr "Soubor '%s' existuje, opravdu ho chcete pøepsat?" +#: ../src/unix/threadpsx.cpp:754 +msgid "" +"Failed to join a thread, potential memory leak detected - please restart the " +"program" +msgstr "" +"Nemohu pøipojit vlákno, zji¹tìna mo¾ná chybná alokace pamìti - restartujte " +"prosím program" -#: ../src/common/docview.cpp:287 -#: ../src/common/docview.cpp:323 -msgid "File error" -msgstr "Chyba souboru" +#: ../src/common/dynlib.cpp:225 +#, c-format +msgid "Failed to load shared library '%s'" +msgstr "Nelze naèíst sdílenou knihovnu '%s'" -#: ../src/msw/filedlg.cpp:280 -msgid "Files (%s)|%s" -msgstr "Soubory (%s)|%s" +#: ../src/msw/clipbrd.cpp:102 +msgid "Failed to open the clipboard." +msgstr "Nemohu otevøít schránku." -#: ../src/generic/fontdlgg.cpp:124 -msgid "Font" -msgstr "Font" +#: ../src/msw/clipbrd.cpp:539 +msgid "Failed to put data on the clipboard" +msgstr "Nepodaøilo se vlo¾it data do schránky" -#: ../src/unix/utilsunx.cpp:480 -msgid "Fork failed" -msgstr "Selhalo forkování" +#: ../src/unix/utilsunx.cpp:540 +msgid "Failed to redirect child process input/output" +msgstr "Nepodaøilo se pøesmìrovat vstup/výstup synovského procesu" -#: ../src/common/resourc2.cpp:295 -#: ../src/common/resourc2.cpp:1368 -#: ../src/common/resource.cpp:1799 -#: ../src/common/resource.cpp:1929 -#: ../src/common/resource.cpp:3014 -msgid "Found " +#: ../src/msw/dde.cpp:285 +#, c-format +msgid "Failed to register DDE server '%s'" +msgstr "Nelze zaregistrovat DDE server '%s'" + +#: ../src/common/fontmap.cpp:507 +#, c-format +msgid "Failed to remember the encoding for the charset '%s'." +msgstr "Nemohu ulo¾it kódování znakové sady '%s'." + +#: ../src/msw/registry.cpp:436 +#, c-format +msgid "Failed to rename registry value '%s' to '%s'." +msgstr "Nelze pøejmenovat registrový klíè '%s' na '%s'." + +#: ../src/msw/registry.cpp:536 +#, c-format +msgid "Failed to rename the registry key '%s' to '%s'." +msgstr "Nelze pøejmenovat registrový klíè '%s' na '%s'." + +#: ../src/msw/clipbrd.cpp:428 +msgid "Failed to retrieve data from the clipboard." +msgstr "Nemohu získat data ze schránky." + +#: ../src/msw/dialup.cpp:459 +msgid "Failed to retrieve text of RAS error message" +msgstr "Nepodaøilo se získat text chybového hlá¹ení RAS" + +#: ../src/msw/clipbrd.cpp:652 +msgid "Failed to retrieve the supported clipboard formats" +msgstr "Nelze zjistit formáty podporované schránkou" + +#: ../src/msw/dde.cpp:650 +msgid "Failed to send DDE advise notification" +msgstr "Nepodaøilo se poslat DDE advise notifikaci" + +#: ../src/msw/clipbrd.cpp:300 +msgid "Failed to set clipboard data." +msgstr "Nemohu ulo¾it data do schránky." + +#: ../src/unix/threadpsx.cpp:1071 +#, c-format +msgid "Failed to set thread priority %d." +msgstr "Nemohu nastavit prioritu vlákna %d." + +#: ../src/common/fs_mem.cpp:167 +#, c-format +msgid "Failed to store image '%s' to memory VFS!" +msgstr "Nepodaøilo se ulo¾it obrázek '%s' do pamì»ového VFS!" + +#: ../src/unix/threadpsx.cpp:1251 +msgid "Failed to terminate a thread." +msgstr "Nemohu ukonèit vlákno." + +#: ../src/msw/dde.cpp:624 +msgid "Failed to terminate the advise loop with DDE server" +msgstr "Nelze ukonèit 'advise loop' s DDE serverem" + +#: ../src/msw/dialup.cpp:928 +#, c-format +msgid "Failed to terminate the dialup connection: %s" +msgstr "Nelze ukonèit vytáèené spojení: %s" + +#: ../src/msw/dde.cpp:301 +#, c-format +msgid "Failed to unregister DDE server '%s'" +msgstr "Nelze odregistrovat DDE server '%s'" + +#: ../src/generic/logg.cpp:367 +msgid "Fatal error" +msgstr "Kritická chyba" + +#: ../src/common/log.cpp:347 +msgid "Fatal error: " +msgstr "Kritická chyba: " + +#: ../src/msw/app.cpp:1257 +msgid "Fatal error: exiting" +msgstr "Fatální chyba: program se ukonèí" + +#: ../src/generic/filedlgg.cpp:1074 ../src/gtk/filedlg.cpp:72 +#, c-format +msgid "File '%s' already exists, do you really want to overwrite it?" +msgstr "Soubor '%s' existuje, opravdu ho chcete pøepsat?" + +#: ../src/common/textcmn.cpp:94 +msgid "File couldn't be loaded." +msgstr "Soubor nelze naèíst." + +#: ../src/common/docview.cpp:294 ../src/common/docview.cpp:330 +msgid "File error" +msgstr "Chyba souboru" + +#: ../src/generic/dirdlgg.cpp:286 ../src/generic/filedlgg.cpp:731 +msgid "File name exists already." +msgstr "Soubor tohoto jména ji¾ existuje." + +#: ../src/msw/filedlg.cpp:297 +#, c-format +msgid "Files (%s)|%s" +msgstr "Soubory (%s)|%s" + +#: ../src/html/helpfrm.cpp:340 +msgid "Find" +msgstr "Najít" + +#: ../src/html/helpfrm.cpp:889 +msgid "Fixed font:" +msgstr "Neproporcionální písmo:" + +#: ../src/common/paper.cpp:118 +msgid "Folio, 8 1/2 x 13 in" +msgstr "Folio, 8 1/2 x 13 palcù" + +#: ../src/generic/fontdlgg.cpp:124 +msgid "Font" +msgstr "Font" + +#: ../src/html/helpfrm.cpp:899 +msgid "Font size:" +msgstr "Velikost písma:" + +#: ../src/unix/utilsunx.cpp:497 +msgid "Fork failed" +msgstr "Selhalo forkování" + +#: ../src/common/dlgcmn.cpp:132 ../src/generic/helpwxht.cpp:158 +msgid "Forward" +msgstr "Dále" + +#: ../src/common/resourc2.cpp:295 ../src/common/resourc2.cpp:1368 +#: ../src/common/resource.cpp:1808 ../src/common/resource.cpp:1938 +#: ../src/common/resource.cpp:3022 +msgid "Found " msgstr "Nalezeno " +#: ../src/html/helpfrm.cpp:637 +#, c-format +msgid "Found %i matches" +msgstr "Nalezeno výskytù: %i" + #: ../src/generic/prntdlgg.cpp:187 msgid "From:" msgstr "Od:" -#: ../src/generic/helphtml.cpp:309 -#: ../src/generic/helphtml.cpp:310 +#: ../src/common/imaggif.cpp:74 +msgid "GIF: data stream seems to be truncated." +msgstr "GIF: datový proud je useknutý pøed koncem." + +#: ../src/common/imaggif.cpp:58 +msgid "GIF: error in GIF image format." +msgstr "GIF: chyba ve formátu GIF obrázku." + +#: ../src/common/imaggif.cpp:61 +msgid "GIF: not enough memory." +msgstr "GIF: nedostatek pamìti." + +#: ../src/common/imaggif.cpp:64 +msgid "GIF: unknown error!!!" +msgstr "GIF: neznámá chyba!!!" + +#: ../src/common/paper.cpp:142 +msgid "German Legal Fanfold, 8 1/2 x 13 in" +msgstr "German Legal Fanfold, 8 1/2 x 13 palcù" + +#: ../src/common/paper.cpp:141 +msgid "German Std Fanfold, 8 1/2 x 12 in" +msgstr "German Std Fanfold, 8 1/2 x 12 palcù" + +#: ../src/html/helpfrm.cpp:501 +msgid "Go back" +msgstr "Jdi zpìt" + +#: ../src/html/helpfrm.cpp:504 +msgid "Go forward" +msgstr "Jdi dopøedu" + +#: ../src/html/helpfrm.cpp:509 +msgid "Go one level up in document hierarchy" +msgstr "Jdi o úroveò vý¹" + +#: ../src/generic/filedlgg.cpp:875 +msgid "Go to home directory" +msgstr "Jít do domovského adresáøe" + +#: ../src/generic/filedlgg.cpp:869 +msgid "Go to parent directory" +msgstr "Jít do nadøazeného adresáøe" + +#: ../src/common/fontmap.cpp:103 +msgid "Greek (ISO-8859-7)" +msgstr "Øecké (ISO-8859-7)" + +#: ../src/html/htmlwin.cpp:251 +#, c-format +msgid "HTML anchor %s does not exist." +msgstr "Kotva HTML %s neexistuje." + +#: ../src/html/helpfrm.cpp:1188 +msgid "" +"HTML files (*.htm)|*.htm|HTML files (*.html)|*.html|Help books " +"(*.htb)|*.htb|Help books (*.zip)|*.zip|HTML Help Project (*.hhp)|*.hhp|All " +"files (*.*)|*" +msgstr "" +"soubory HTML (*.htm)|*.htm|soubory HTML (*.html)|*.html|HTML nápovìda " +"(*.htb)|*.htb|HTML nápovìda (*.zip)|*.zip|Projekt HTML nápovìdy " +"(*.hhp)|*.hhp|V¹echny soubory (*.*)|*" + +#: ../src/common/fontmap.cpp:104 +msgid "Hebrew (ISO-8859-8)" +msgstr "Hebrejské (ISO-8859-8)" + +#: ../src/common/dlgcmn.cpp:144 ../src/generic/proplist.cpp:528 +#: ../src/html/helpfrm.cpp:208 ../src/msw/mdi.cpp:1266 +msgid "Help" +msgstr "Nápovìda" + +#: ../src/html/helpfrm.cpp:872 +msgid "Help Browser Options" +msgstr "Nastavení prohlí¾eèe nápovìdy" + +#: ../src/generic/helphtml.cpp:319 ../src/generic/helphtml.cpp:320 msgid "Help Index" msgstr "Index nápovìdy" -#: ../src/common/resourc2.cpp:997 -#: ../src/common/resourc2.cpp:1008 -#: ../src/common/resource.cpp:2639 -#: ../src/common/resource.cpp:2650 +#: ../src/html/helpfrm.cpp:1172 +msgid "Help Printing" +msgstr "Tisk nápovìdy" + +#: ../src/generic/helpwxht.cpp:251 ../src/html/helpctrl.cpp:38 +#, c-format +msgid "Help: %s" +msgstr "Nápovìda: %s" + +#: ../src/common/fontmap.cpp:108 +msgid "ISO-8859-12" +msgstr "ISO-8859-12" + +#: ../src/common/fontmap.cpp:110 +msgid "ISO-8859-14" +msgstr "ISO-8859-14" + +#: ../src/common/resourc2.cpp:997 ../src/common/resourc2.cpp:1008 +#: ../src/common/resource.cpp:2647 ../src/common/resource.cpp:2658 +#, c-format msgid "Icon resource specification %s not found." msgstr "Icon resource specification %s nenalezen." @@ -545,56 +1461,126 @@ msgstr "Icon resource specification %s nenalezen." msgid "Ill-formed resource file syntax." msgstr "©patná syntaxe resource souboru." -#: ../src/generic/logg.cpp:209 -msgid "Information" -msgstr "Informace" +#: ../src/generic/dirdlgg.cpp:268 ../src/generic/filedlgg.cpp:717 +msgid "Illegal directory name." +msgstr "Nedovolené jméno adresáøe." + +#: ../src/generic/filedlgg.cpp:1043 +msgid "Illegal file specification." +msgstr "Neplatná specifikace souboru." + +#: ../src/msw/textctrl.cpp:219 +msgid "" +"Impossible to create a rich edit control, using simple text control instead. " +"Please reinstall riched32.dll" +msgstr "" +"Není mo¾né vytvoøit rich edit prvek, pou¾iji obyèejný. Pøeinstalujte prosím " +"riched32.dll." + +#: ../src/unix/utilsunx.cpp:350 +msgid "Impossible to get child process input" +msgstr "Není mo¾né získat vstup synovského procesu" + +#: ../src/html/helpdata.cpp:403 +msgid "Incorrect version of HTML help book" +msgstr "©patná verze knihy s HTML nápovìdou" + +#: ../src/html/helpfrm.cpp:372 +msgid "Index" +msgstr "Rejtøík" + +#: ../src/common/imagtiff.cpp:171 +msgid "Invalid TIFF image index." +msgstr "Po¹kozený index v TIFF obrázku." #: ../src/generic/fontdlgg.cpp:213 msgid "Italic" msgstr "Kurzíva" -#: ../src/generic/dcpsg.cpp:2183 -#: ../src/generic/prntdlgg.cpp:441 +#: ../src/common/paper.cpp:137 +msgid "Italy Envelope, 110 x 230 mm" +msgstr "Italská obálka, 110 x 230 mm" + +#: ../src/common/imagjpeg.cpp:198 +msgid "JPEG: Couldn't load - file is probably corrupted." +msgstr "JPEG: Nemohu naèíst obrázek - soubor je nejspí¹ po¹kozen." + +#: ../src/common/imagjpeg.cpp:315 +msgid "JPEG: Couldn't save image." +msgstr "JPEG: Nemohu ulo¾it obrázek." + +#: ../src/common/fontmap.cpp:112 +msgid "KOI8-R" +msgstr "KOI8-R" + +#: ../src/generic/dcpsg.cpp:2232 ../src/generic/prntdlgg.cpp:441 #: ../src/generic/prntdlgg.cpp:637 msgid "Landscape" msgstr "Na ¹íøku" +#: ../src/common/paper.cpp:110 +msgid "Ledger, 17 x 11 in" +msgstr "Ledger, 17 x 11 palcù" + #: ../src/generic/prntdlgg.cpp:649 msgid "Left margin (mm):" msgstr "Levý okraj (mm):" -#: ../src/common/paper.cpp:99 -msgid "Legal 8 1/2 x 14 in" -msgstr "Legal 8 1/2 x 14 in" +#: ../src/common/paper.cpp:103 +msgid "Legal, 8 1/2 x 14 in" +msgstr "Legal, 8 1/2 x 14 palcù" -#: ../src/common/paper.cpp:98 -msgid "Letter 8 1/2 x 11 in" -msgstr "Letter 8 1/2 x 11 in" +#: ../src/common/paper.cpp:108 +msgid "Letter Small, 8 1/2 x 11 in" +msgstr "Letter Small, 8 1/2 x 11 in" + +#: ../src/common/paper.cpp:102 +msgid "Letter, 8 1/2 x 11 in" +msgstr "Letter, 8 1/2 x 11 palcù" #: ../src/generic/fontdlgg.cpp:216 msgid "Light" msgstr "Tenké" -#: ../src/generic/filedlgg.cpp:1265 -#: ../src/gtk/filedlg.cpp:241 -#: ../src/motif/filedlg.cpp:351 -#: ../src/msw/filedlg.cpp:438 +#: ../src/generic/filedlgg.cpp:1270 ../src/gtk/filedlg.cpp:241 +#: ../src/motif/filedlg.cpp:351 ../src/msw/filedlg.cpp:475 +#, c-format msgid "Load %s file" msgstr "Naèíst soubor %s" -#: ../src/generic/logg.cpp:525 +#: ../src/html/htmlwin.cpp:187 +msgid "Loading : " +msgstr "Naèítám : " + +#: ../src/common/imagpnm.cpp:72 +msgid "Loading Grey Ascii PNM image is not yet implemented." +msgstr "Naèítání ¹edých ascii PNM obrázkù není je¹tì implementováno." + +#: ../src/common/imagpnm.cpp:75 +msgid "Loading Grey Raw PNM image is not yet implemented." +msgstr "Naèítání ¹edých raw PNM obrázkù není je¹tì implementováno." + +#: ../src/generic/logg.cpp:534 +#, c-format msgid "Log saved to the file '%s'." msgstr "Log ulo¾en do souboru '%s'." -#: ../src/gtk/mdi.cpp:420 +#: ../src/gtk/mdi.cpp:435 msgid "MDI child" msgstr "MDI syn" -#: ../src/unix/mimetype.cpp:1542 +#: ../src/unix/mimetype.cpp:1570 +#, c-format msgid "Mailcap file %s, line %d: incomplete entry ignored." msgstr "Soubor Mailcap %s, øádka %d: nekompletní polo¾ka ignorována." -#: ../src/unix/mimetype.cpp:1262 +#: ../src/common/fs_mem.cpp:144 +#, c-format +msgid "Memory VFS already contains file '%s'!" +msgstr "Pamì»ový VFS u¾ obsahuje soubor '%s'!" + +#: ../src/unix/mimetype.cpp:1292 +#, c-format msgid "Mime.types file %s, line %d: unterminated quoted string." msgstr "Soubor Mime.types %s, øádka %d: neukonèený uzávorkovaný øetìzec." @@ -602,79 +1588,182 @@ msgstr "Soubor Mime.types %s, msgid "Modern" msgstr "Moderní" -#: ../src/generic/dirdlgg.cpp:209 +#: ../src/common/paper.cpp:138 +msgid "Monarch Envelope, 3 7/8 x 7 1/2 in" +msgstr "Obálka Monarch, 3 7/8 x 7 1/2 palce" + +#: ../src/common/dlgcmn.cpp:141 +msgid "More..." +msgstr "Dal¹í..." + +#: ../src/generic/dirdlgg.cpp:213 msgid "Mounted Devices" msgstr "Pøipojená zaøízení" #: ../src/generic/dirdlgg.cpp:208 +msgid "My Harddisk" +msgstr "Mùj disk" + +#: ../src/generic/dirdlgg.cpp:212 msgid "My Home" msgstr "Domovský adresáø" -#: ../src/generic/dirdlgg.cpp:415 +#: ../src/generic/filedlgg.cpp:533 +msgid "Name" +msgstr "Jméno" + +#: ../src/generic/dirdlgg.cpp:426 msgid "New..." msgstr "Nový..." -#: ../src/common/dlgcmn.cpp:109 -#: ../src/common/dlgcmn.cpp:119 +#: ../src/generic/filedlgg.cpp:610 +msgid "NewName" +msgstr "NoveJmeno" + +#: ../src/html/helpfrm.cpp:515 +msgid "Next page" +msgstr "Následující stránka" + +#: ../src/common/dlgcmn.cpp:111 ../src/common/dlgcmn.cpp:121 #: ../src/motif/msgdlg.cpp:178 msgid "No" msgstr "Ne" -#: ../src/common/resourc2.cpp:814 -#: ../src/common/resourc2.cpp:969 -#: ../src/common/resource.cpp:2455 -#: ../src/common/resource.cpp:2611 +#: ../src/common/resourc2.cpp:814 ../src/common/resourc2.cpp:969 +#: ../src/common/resource.cpp:2464 ../src/common/resource.cpp:2619 msgid "No XBM facility available!" msgstr "Chybí podpora XBM!" -#: ../src/common/resourc2.cpp:830 -#: ../src/common/resourc2.cpp:988 -#: ../src/common/resource.cpp:2471 -#: ../src/common/resource.cpp:2630 +#: ../src/common/resourc2.cpp:830 ../src/common/resource.cpp:2479 msgid "No XPM facility available!" msgstr "Chybí podpora XPM!" -#: ../src/common/resourc2.cpp:991 -#: ../src/common/resource.cpp:2633 +#: ../src/common/resourc2.cpp:991 ../src/common/resource.cpp:2641 msgid "No XPM icon facility available!" msgstr "Chybí podpora XPM ikon!" -#: ../src/generic/helphtml.cpp:304 +#: ../src/generic/helphtml.cpp:314 msgid "No entries found." msgstr "Nenalezeny ¾ádné polo¾ky." -#: ../src/generic/fontdlgg.cpp:212 -#: ../src/generic/fontdlgg.cpp:215 +#: ../src/common/image.cpp:731 +msgid "No handler found for image type." +msgstr "Nenalezen ¾ádný ovladaè pro tento typ obrázkù." + +#: ../src/common/image.cpp:739 ../src/common/image.cpp:773 +#, c-format +msgid "No image handler for type %d defined." +msgstr "®ádný ovladaè pro typ obrázkù %d." + +#: ../src/common/image.cpp:757 ../src/common/image.cpp:789 +#, c-format +msgid "No image handler for type %s defined." +msgstr "®ádný ovladaè pro typ obrázkù %s." + +#: ../src/html/helpfrm.cpp:628 +msgid "No matching page found yet" +msgstr "®ádný výskyt nenalezen" + +#: ../src/common/fontmap.cpp:106 +msgid "Nordic (ISO-8859-10)" +msgstr "Severské (ISO-8859-10)" + +#: ../src/generic/fontdlgg.cpp:212 ../src/generic/fontdlgg.cpp:215 msgid "Normal" msgstr "Normální" -#: ../src/common/dlgcmn.cpp:125 -#: ../src/generic/dcpsg.cpp:2191 -#: ../src/generic/dirdlgg.cpp:411 -#: ../src/generic/filedlgg.cpp:902 -#: ../src/generic/fontdlgg.cpp:256 -#: ../src/generic/prntdlgg.cpp:467 -#: ../src/generic/proplist.cpp:511 -#: ../src/gtk/filedlg.cpp:158 -#: ../src/gtk/fontdlg.cpp:172 -#: ../src/html/helpfrm.cpp:889 +#: ../src/html/helpfrm.cpp:881 +msgid "Normal font:" +msgstr "Normální písmo:" + +#: ../src/common/paper.cpp:122 +msgid "Note, 8 1/2 x 11 in" +msgstr "Note, 8 1/2 x 11 palcù" + +#: ../src/common/dlgcmn.cpp:127 ../src/generic/dcpsg.cpp:2240 +#: ../src/generic/dirdlgg.cpp:422 ../src/generic/filedlgg.cpp:907 +#: ../src/generic/fontdlgg.cpp:256 ../src/generic/logg.cpp:729 +#: ../src/generic/prntdlgg.cpp:467 ../src/generic/proplist.cpp:511 +#: ../src/gtk/filedlg.cpp:158 ../src/gtk/fontdlg.cpp:172 +#: ../src/html/helpfrm.cpp:909 msgid "OK" msgstr "OK" -#: ../src/generic/prntdlgg.cpp:447 -msgid "Options" -msgstr "Nastavení" +#: ../src/html/helpfrm.cpp:523 ../src/html/helpfrm.cpp:1183 +msgid "Open HTML document" +msgstr "Otevøi HTML dokument" -#: ../src/generic/prntdlgg.cpp:443 -#: ../src/generic/prntdlgg.cpp:638 -msgid "Orientation" -msgstr "Orientace" +#: ../src/generic/dirdlgg.cpp:297 ../src/generic/dirdlgg.cpp:604 +#: ../src/generic/filedlgg.cpp:625 ../src/generic/filedlgg.cpp:744 +msgid "Operation not permitted." +msgstr "Zakázaná operace." -#: ../src/common/prntbase.cpp:729 +#: ../src/common/cmdline.cpp:590 +#, c-format +msgid "Option '%s' requires a value, '=' expected." +msgstr "Volba '%s' vy¾aduje hodnotu, oèekávám '='." + +#: ../src/common/cmdline.cpp:609 +#, c-format +msgid "Option '%s' requires a value." +msgstr "Volba '%s' vy¾aduje hodnotu." + +#: ../src/common/cmdline.cpp:663 +#, c-format +msgid "Option '%s': '%s' cannot be converted to a date." +msgstr "Volba '%s': '%s' neudává datum." + +#: ../src/generic/prntdlgg.cpp:447 +msgid "Options" +msgstr "Nastavení" + +#: ../src/generic/prntdlgg.cpp:443 ../src/generic/prntdlgg.cpp:638 +msgid "Orientation" +msgstr "Orientace" + +#: ../src/common/imagpcx.cpp:448 ../src/common/imagpcx.cpp:471 +msgid "PCX: couldn't allocate memory" +msgstr "PCX: Nemohu alokovat pamì»." + +#: ../src/common/imagpcx.cpp:447 +msgid "PCX: image format unsupported" +msgstr "PCX: nepodporovaný formát obrázku" + +#: ../src/common/imagpcx.cpp:470 +msgid "PCX: invalid image" +msgstr "PCX: po¹kozený obrázek" + +#: ../src/common/imagpcx.cpp:434 +msgid "PCX: this is not a PCX file." +msgstr "PCX: tento soubor není PCX." + +#: ../src/common/imagpcx.cpp:450 ../src/common/imagpcx.cpp:472 +msgid "PCX: unknown error !!!" +msgstr "PCX: neznámá chyba !!!" + +#: ../src/common/imagpcx.cpp:449 +msgid "PCX: version number too low" +msgstr "PCX: èíslo verze je pøíli¹ malé" + +#: ../src/common/imagpnm.cpp:96 +msgid "PNM: Couldn't allocate memory." +msgstr "PNM: Nemohu alokovat pamì»." + +#: ../src/common/imagpnm.cpp:80 +msgid "PNM: File format is not recognized." +msgstr "PNM: formát souboru nerozeznán." + +#: ../src/common/imagpnm.cpp:112 +msgid "PNM: File seems truncated." +msgstr "PNM: Soubor je nejspí¹ uøíznutý pøed koncem." + +#: ../src/common/prntbase.cpp:729 +#, c-format msgid "Page %d" msgstr "Strana %d" #: ../src/common/prntbase.cpp:727 +#, c-format msgid "Page %d of %d" msgstr "Strana %d z %d" @@ -686,23 +1775,41 @@ msgstr "Nastaven msgid "Pages" msgstr "Strany" -#: ../src/generic/prntdlgg.cpp:433 -#: ../src/generic/prntdlgg.cpp:615 +#: ../src/generic/prntdlgg.cpp:555 ../src/generic/prntdlgg.cpp:626 +#: ../src/generic/prntdlgg.cpp:808 +msgid "Paper Size" +msgstr "Velikost papíru" + +#: ../src/generic/prntdlgg.cpp:433 ../src/generic/prntdlgg.cpp:615 #: ../src/generic/prntdlgg.cpp:804 msgid "Paper size" msgstr "Velikost papíru" -#: ../src/unix/utilsunx.cpp:429 -#: ../src/unix/utilsunx.cpp:453 +#: ../src/generic/filedlgg.cpp:537 +msgid "Permissions" +msgstr "Práva" + +#: ../src/unix/utilsunx.cpp:440 ../src/unix/utilsunx.cpp:468 msgid "Pipe creation failed" msgstr "Nelze vytvoøit rouru" +#: ../src/gtk/fontdlg.cpp:72 +msgid "Please choose a valid font." +msgstr "Prosím vyberte korektní font." + +#: ../src/generic/filedlgg.cpp:1092 ../src/gtk/filedlg.cpp:83 +msgid "Please choose an existing file." +msgstr "Vyberte prosím existující soubor." + +#: ../src/msw/dialup.cpp:763 +msgid "Please choose which ISP do you want to connect to" +msgstr "Prosím vyberte si poskytovatele (ISP), ke kterému se chcete pøipojit" + #: ../src/common/prntbase.cpp:105 msgid "Please wait..." msgstr "Èekejte prosím..." -#: ../src/generic/dcpsg.cpp:2182 -#: ../src/generic/prntdlgg.cpp:440 +#: ../src/generic/dcpsg.cpp:2231 ../src/generic/prntdlgg.cpp:440 #: ../src/generic/prntdlgg.cpp:636 msgid "Portrait" msgstr "Na vý¹ku" @@ -715,17 +1822,27 @@ msgstr "PostScript" msgid "PostScript file" msgstr "soubor PostScript" -#: ../src/generic/dcpsg.cpp:2224 +#: ../src/generic/dcpsg.cpp:2273 msgid "PostScript:" msgstr "PostScript:" -#: ../src/generic/dcpsg.cpp:2187 +#: ../src/generic/dcpsg.cpp:2236 msgid "Preview Only" msgstr "Pouze náhled" -#: ../src/generic/prntdlgg.cpp:113 -#: ../src/generic/prntdlgg.cpp:127 -#: ../src/generic/prntdlgg.cpp:141 +#: ../src/html/helpfrm.cpp:903 +msgid "Preview:" +msgstr "Náhled:" + +#: ../src/html/htmprint.cpp:486 +msgid "Previewing" +msgstr "Vytváøím náhled" + +#: ../src/html/helpfrm.cpp:512 +msgid "Previous page" +msgstr "Pøedchozí stránka" + +#: ../src/generic/prntdlgg.cpp:113 ../src/generic/prntdlgg.cpp:127 msgid "Print" msgstr "Vytisknout" @@ -733,12 +1850,11 @@ msgstr "Vytisknout" msgid "Print Error" msgstr "Chyba tisku" -#: ../src/common/docview.cpp:884 +#: ../src/common/docview.cpp:895 msgid "Print Preview" msgstr "Náhled tisku" -#: ../src/common/prntbase.cpp:685 -#: ../src/common/prntbase.cpp:709 +#: ../src/common/prntbase.cpp:685 ../src/common/prntbase.cpp:709 msgid "Print Preview Failure" msgstr "Chyba bìhem vytváøení náhledu." @@ -746,8 +1862,7 @@ msgstr "Chyba b msgid "Print Range" msgstr "Rozsah" -#: ../src/generic/prntdlgg.cpp:408 -#: ../src/generic/prntdlgg.cpp:415 +#: ../src/generic/prntdlgg.cpp:408 ../src/generic/prntdlgg.cpp:415 msgid "Print Setup" msgstr "Nastavení tisku" @@ -759,8 +1874,11 @@ msgstr "Tisknout barevn msgid "Print spooling" msgstr "Tisková fronta" -#: ../src/generic/dcpsg.cpp:2186 -#: ../src/generic/prntdlgg.cpp:150 +#: ../src/html/helpfrm.cpp:529 +msgid "Print this page" +msgstr "Vytiskne tuto stránku" + +#: ../src/generic/dcpsg.cpp:2235 ../src/generic/prntdlgg.cpp:150 msgid "Print to File" msgstr "Tisknout do souboru" @@ -768,11 +1886,11 @@ msgstr "Tisknout do souboru" msgid "Print..." msgstr "Tisknout..." -#: ../src/generic/dcpsg.cpp:2197 +#: ../src/generic/dcpsg.cpp:2246 msgid "Printer Command: " msgstr "Pøíkaz tisku: " -#: ../src/generic/dcpsg.cpp:2202 +#: ../src/generic/dcpsg.cpp:2251 msgid "Printer Options: " msgstr "Nastavení tiskárny: " @@ -796,8 +1914,7 @@ msgstr "Nastaven msgid "Printer..." msgstr "Tiskárna..." -#: ../src/common/prntbase.cpp:104 -#: ../src/common/prntbase.cpp:146 +#: ../src/common/prntbase.cpp:104 ../src/common/prntbase.cpp:146 #: ../src/html/htmprint.cpp:507 msgid "Printing" msgstr "Tisk" @@ -806,23 +1923,72 @@ msgstr "Tisk" msgid "Printing Error" msgstr "Chyba tisku" +#: ../src/generic/printps.cpp:218 +#, c-format +msgid "Printing page %d..." +msgstr "Tisknu stranu %d..." + +#: ../src/generic/printps.cpp:185 +msgid "Printing..." +msgstr "Tisknu..." + #: ../src/common/log.cpp:348 msgid "Program aborted." msgstr "Program pøeru¹en." -#: ../src/generic/logg.cpp:477 +#: ../src/common/paper.cpp:119 +msgid "Quarto, 215 x 275 mm" +msgstr "Quarto, 215 x 275 mm" + +#: ../src/generic/logg.cpp:1019 msgid "Question" msgstr "Otázka" -#: ../src/msw/registry.cpp:626 -msgid "Registry key '%s' is needed for normal system operation,\ndeleting it will leave your system in unusable state:\noperation aborted." -msgstr "Klíè registru '%s' je potøeba k normálnímu bìhu systému,\npokud ho sma¾ete, systém bude nestabilní:\noperace pøeru¹ena." +#: ../src/common/ffile.cpp:133 ../src/common/ffile.cpp:154 +#, c-format +msgid "Read error on file '%s'" +msgstr "Chyba pøi ètení ze souboru '%s'" + +#: ../src/msw/registry.cpp:528 +#, c-format +msgid "Registry key '%s' already exists." +msgstr "Registrový klíè '%s' u¾ existuje." + +#: ../src/msw/registry.cpp:497 +#, c-format +msgid "Registry key '%s' does not exist, cannot rename it." +msgstr "Registrový klíè '%s' neexistuje, nemohu ho pøejmenovat." + +#: ../src/msw/registry.cpp:623 +#, c-format +msgid "" +"Registry key '%s' is needed for normal system operation,\n" +"deleting it will leave your system in unusable state:\n" +"operation aborted." +msgstr "" +"Klíè registru '%s' je potøeba k normálnímu bìhu systému,\n" +"pokud ho sma¾ete, systém bude nestabilní:\n" +"operace pøeru¹ena." + +#: ../src/msw/registry.cpp:428 +#, c-format +msgid "Registry value '%s' already exists." +msgstr "Registrový klíè '%s' u¾ existuje." -#: ../src/generic/helphtml.cpp:309 +#: ../src/generic/helphtml.cpp:319 msgid "Relevant entries:" msgstr "Související polo¾ky:" -#: ../src/msw/filedlg.cpp:400 +#: ../src/generic/progdlgg.cpp:167 +msgid "Remaining time : " +msgstr "Zbývající èas : " + +#: ../src/html/helpfrm.cpp:269 +msgid "Remove current page from bookmarks" +msgstr "Odstraní tuto stránku ze zálo¾ek" + +#: ../src/msw/filedlg.cpp:437 +#, c-format msgid "Replace file '%s'?" msgstr "Nahradit soubor '%s'?" @@ -834,18 +2000,17 @@ msgstr "Prav msgid "Roman" msgstr "Patkové" -#: ../src/generic/filedlgg.cpp:1281 -#: ../src/gtk/filedlg.cpp:257 -#: ../src/motif/filedlg.cpp:353 -#: ../src/msw/filedlg.cpp:439 +#: ../src/generic/filedlgg.cpp:1286 ../src/gtk/filedlg.cpp:257 +#: ../src/motif/filedlg.cpp:353 ../src/msw/filedlg.cpp:476 +#, c-format msgid "Save %s file" msgstr "Ulo¾it soubor %s" -#: ../src/common/docview.cpp:240 +#: ../src/common/docview.cpp:247 msgid "Save as" msgstr "Ulo¾it jako" -#: ../src/generic/logg.cpp:431 +#: ../src/generic/logg.cpp:469 msgid "Save log contents to file" msgstr "Ulo¾it obsah logu do souboru" @@ -853,41 +2018,98 @@ msgstr "Ulo msgid "Script" msgstr "Psací" -#: ../src/common/docview.cpp:1414 +#: ../src/generic/helpwxht.cpp:161 ../src/html/helpfrm.cpp:414 +#: ../src/html/helpfrm.cpp:434 +msgid "Search" +msgstr "Hledat" + +#: ../src/html/helpfrm.cpp:416 +msgid "" +"Search contents of help book(s) for all occurences of the text you typed " +"above" +msgstr "" +"Prohledá obsah knih(y) s nápovìdou a vypí¹e v¹echny výskyty textu, který " +"jste zadal" + +#: ../src/html/helpfrm.cpp:735 +msgid "Search in all books" +msgstr "Hledej ve v¹ech knihách" + +#: ../src/html/helpfrm.cpp:628 +msgid "Searching..." +msgstr "Hledám..." + +#: ../src/generic/dirdlgg.cpp:191 +msgid "Sections" +msgstr "Sekce" + +#: ../src/common/ffile.cpp:221 +#, c-format +msgid "Seek error on file '%s'" +msgstr "Chyba pøi nastavování pozice v souboru '%s'" + +#: ../src/common/docview.cpp:1426 msgid "Select a document template" msgstr "Vyberte ¹ablonu dokumentu" -#: ../src/common/docview.cpp:1437 +#: ../src/common/docview.cpp:1449 msgid "Select a document view" msgstr "Vyberte zobrazení dokumentu" -#: ../src/common/docview.cpp:1332 -#: ../src/common/docview.cpp:1369 +#: ../src/common/docview.cpp:1344 ../src/common/docview.cpp:1381 msgid "Select a file" msgstr "Vyberte soubor" -#: ../src/generic/dcpsg.cpp:2185 +#: ../src/generic/dcpsg.cpp:2234 msgid "Send to Printer" msgstr "Poslat na tiskárnu" +#: ../src/common/dlgcmn.cpp:138 +msgid "Setup" +msgstr "Nastavení" + #: ../src/generic/prntdlgg.cpp:155 msgid "Setup..." msgstr "Nastavení..." +#: ../src/msw/dialup.cpp:535 +msgid "Several active dialup connections found, choosing one randomly." +msgstr "" +"Nalezeno nìkolik aktivních vytáèených pøipojení, vybírám jedno náhodnì." + +#: ../src/html/helpfrm.cpp:331 +msgid "Show all" +msgstr "Zobraz v¹e" + +#: ../src/html/helpfrm.cpp:365 +msgid "Show all items in index" +msgstr "Zobrazí v¹echny polo¾ky v rejstøíku" + +#: ../src/generic/filedlgg.cpp:913 +msgid "Show hidden files" +msgstr "Ukázat skryté soubory" + +#: ../src/html/helpfrm.cpp:496 +msgid "Show/hide navigation panel" +msgstr "Zobraz/schovej navigaèní panel" + +#: ../src/generic/filedlgg.cpp:534 +msgid "Size" +msgstr "Velikost" + #: ../src/generic/fontdlgg.cpp:214 msgid "Slant" msgstr "Sklonìné" -#: ../src/common/docview.cpp:297 +#: ../src/common/docview.cpp:304 msgid "Sorry, could not open this file for saving." msgstr "Tento soubor nelze otevøít pro zápis." -#: ../src/common/docview.cpp:333 -#: ../src/common/docview.cpp:345 +#: ../src/common/docview.cpp:340 ../src/common/docview.cpp:352 msgid "Sorry, could not open this file." msgstr "Tento soubor nelze otevøít." -#: ../src/common/docview.cpp:304 +#: ../src/common/docview.cpp:311 msgid "Sorry, could not save this file." msgstr "Tento soubor nelze ulo¾it." @@ -895,7 +2117,11 @@ msgstr "Tento soubor nelze ulo msgid "Sorry, not enough memory to create a preview." msgstr "Nedostatek pamìti na vytvoøení náhledu." -#: ../src/generic/logg.cpp:585 +#: ../src/common/paper.cpp:111 +msgid "Statement, 5 1/2 x 8 1/2 in" +msgstr "Statement, 5 1/2 x 8 1/2 palce" + +#: ../src/generic/logg.cpp:594 msgid "Status: " msgstr "Status: " @@ -903,35 +2129,165 @@ msgstr "Status: " msgid "Swiss" msgstr "Swiss" +#: ../src/common/imagtiff.cpp:192 ../src/common/imagtiff.cpp:203 +#: ../src/common/imagtiff.cpp:314 +msgid "TIFF: Couldn't allocate memory." +msgstr "TIFF: Nemohu alokovat pamì»." + +#: ../src/common/imagtiff.cpp:163 +msgid "TIFF: Error loading image." +msgstr "TIFF: Chyba pøi naèítání obrázku." + +#: ../src/common/imagtiff.cpp:214 +msgid "TIFF: Error reading image." +msgstr "TIFF: Chyba pøi naèítání obrázku." + +#: ../src/common/imagtiff.cpp:291 +msgid "TIFF: Error saving image." +msgstr "TIFF: Chyba pøi ukládání obrázku." + +#: ../src/common/imagtiff.cpp:338 +msgid "TIFF: Error writing image." +msgstr "TIFF: Chyba pøi ukládání obrázku." + +#: ../src/common/paper.cpp:109 +msgid "Tabloid, 11 x 17 in" +msgstr "Tabloid, 11 x 17 palcù" + #: ../src/generic/fontdlgg.cpp:211 msgid "Teletype" msgstr "Psací stroj" -#: ../src/common/docview.cpp:1414 +#: ../src/common/docview.cpp:1426 msgid "Templates" msgstr "©ablony" -#: ../src/generic/dirdlgg.cpp:214 +#: ../src/generic/dirdlgg.cpp:218 msgid "Temporary" msgstr "Doèasný" -#: ../src/generic/dirdlgg.cpp:206 +#: ../src/common/fontmap.cpp:107 +msgid "Thai (ISO-8859-11)" +msgstr "Thajské (ISO-8859-11)" + +#: ../src/generic/dirdlgg.cpp:210 msgid "The Computer" msgstr "Poèítaè" -#: ../src/generic/dirdlgg.cpp:464 +#: ../src/common/fontmap.cpp:466 +#, c-format +msgid "" +"The charset '%s' is unknown. You may select\n" +"another charset to replace it with or choose\n" +"[Cancel] if it cannot be replaced" +msgstr "" +"Znaková sada '%s' je neznámá. Mù¾ete vybrat\n" +"jinou sadu jako náhradu nebo stisknìte\n" +"[Zru¹it], pokud ji nelze nahradit" + +#: ../src/msw/ole/dataobj.cpp:169 +#, c-format +msgid "The clipboard format '%d' doesn't exist." +msgstr "Formát schránky '%d' neexistuje." + +#: ../src/generic/dirdlgg.cpp:535 msgid "The directory " msgstr "Adresáø " -#: ../src/mac/thread.cpp:728 -#: ../src/msw/thread.cpp:1038 -msgid "Thread module initialization failed: can not store value in thread local storage" -msgstr "Modul s vlákny se nepodaøilo iniciovat: nemohu ukládat hodnoty v 'local storage'" +#: ../src/common/fontmap.cpp:655 +#, c-format +msgid "" +"The encoding '%s' is unknown.\n" +"Would you like to select a font to be used for this encoding\n" +"(otherwise the text in this encoding will not be shown correctly)?" +msgstr "" +"Neznámé kódování '%s'.\n" +"Pøejete si vybrat font, který se má s tímto kódováním pou¾ít\n" +"(jinak se text v tomto kódování nezobrazí správnì)?" + +#: ../src/common/docview.cpp:1631 +#, c-format +msgid "" +"The file '%s' doesn't exist and couldn't be opened.\n" +"It has been also removed from the MRU files list." +msgstr "" +"Soubor '%s' neexistuje.\n" +"Bude odstranìn ze seznamu nedávno otevøených souborù." + +#: ../src/common/cmdline.cpp:753 +#, c-format +msgid "The required parameter '%s' was not specified." +msgstr "Po¾adovaný parametr '%s' nebyl zadán." + +#: ../src/common/textcmn.cpp:121 +msgid "The text couldn't be saved." +msgstr "Text nelze ulo¾it." + +#: ../src/common/cmdline.cpp:732 +#, c-format +msgid "The value for the option '%s' must be specified." +msgstr "Musíte zadat hodnotu volby '%s'." + +#: ../src/msw/dialup.cpp:411 +#, c-format +msgid "" +"The version of remote access service (RAS) installed on this machine is " +"tooold, please upgrade (the following required function is missing: %s)." +msgstr "" +"Verze Remote Access Service (RAS) na tomto poèítaèi je pøíli¹ stará, prosím " +"upgradujte (chybí tato funkce: %s)." + +#: ../src/html/htmprint.cpp:486 +msgid "" +"There was a problem previewing.\n" +"Perhaps your current printer is not set correctly?" +msgstr "" +"Pøi vytváøení náhledu se vyskytl problém.\n" +"Mo¾ná nemáte správnì nastavenou tiskárnu?" + +#: ../src/html/htmprint.cpp:507 +msgid "" +"There was a problem printing.\n" +"Perhaps your current printer is not set correctly?" +msgstr "" +"Pøi tisku se vyskytla chyba.\n" +"Mo¾ná máte ¹patnì nastavenou tiskárnu?" + +#: ../src/msw/thread.cpp:1058 +msgid "" +"Thread module initialization failed: can not store value in thread local " +"storage" +msgstr "" +"Modul s vlákny se nepodaøilo iniciovat: nemohu ukládat hodnoty v 'local " +"storage'" + +#: ../src/unix/threadpsx.cpp:1441 +msgid "Thread module initialization failed: failed to create thread key" +msgstr "Selhala inicializace modulu s vlákny: nelze vytvoøit klíè" + +#: ../src/msw/thread.cpp:1046 +msgid "" +"Thread module initialization failed: impossible to allocate index in thread " +"local storage" +msgstr "" +"Modul s vlákny se nepodaøilo iniciovat: nemohu alokovat index v 'local " +"storage'" + +#: ../src/unix/threadpsx.cpp:962 +msgid "Thread priority setting is ignored." +msgstr "Nastavení priority vlákna je ignorováno." + +#: ../src/generic/filedlgg.cpp:536 +msgid "Time" +msgstr "Èas" + +#: ../src/generic/tipdlg.cpp:162 +msgid "Tip of the Day" +msgstr "Tip dne" -#: ../src/mac/thread.cpp:715 -#: ../src/msw/thread.cpp:1025 -msgid "Thread module initialization failed: impossible to allocate index in thread local storage" -msgstr "Modul s vlákny se nepodaøilo iniciovat: nemohu alokovat index v 'local storage'" +#: ../src/generic/tipdlg.cpp:138 +msgid "Tips not available, sorry!" +msgstr "Tip není k dispozici!" #: ../src/generic/prntdlgg.cpp:191 msgid "To:" @@ -941,64 +2297,104 @@ msgstr "Do:" msgid "Top margin (mm):" msgstr "Horní okraj (mm)" +#: ../src/common/fs_mem.cpp:202 +#, c-format +msgid "Trying to remove file '%s' from memory VFS, but it is not loaded!" +msgstr "Soubor '%s' nelze odebrat z pamì»ového VFS, proto¾e nebyl naèten!" + +#: ../src/common/sckaddr.cpp:107 +msgid "Trying to solve a NULL hostname: giving up" +msgstr "Sna¾ím se zjistit NULLové jméno poèítaèe: vzdávám to" + +#: ../src/common/fontmap.cpp:105 +msgid "Turkish (ISO-8859-9)" +msgstr "Turské (ISO-8859-9)" + +#: ../src/common/paper.cpp:140 +msgid "US Std Fanfold, 14 7/8 x 11 in" +msgstr "US Std Fanfold, 17 7/8 x 11 palcù" + +#: ../src/html/htmlwin.cpp:175 +#, c-format +msgid "Unable to open requested HTML document: %s" +msgstr "Nelze otevøít po¾adovaný HTML dokument: %s" + #: ../src/generic/fontdlgg.cpp:242 msgid "Underline" msgstr "Podtr¾ené" -#: ../src/common/resourc2.cpp:305 -#: ../src/common/resourc2.cpp:319 -#: ../src/common/resourc2.cpp:335 -#: ../src/common/resourc2.cpp:349 -#: ../src/common/resourc2.cpp:1378 -#: ../src/common/resourc2.cpp:1392 -#: ../src/common/resourc2.cpp:1408 -#: ../src/common/resourc2.cpp:1422 -#: ../src/common/resource.cpp:1809 -#: ../src/common/resource.cpp:1823 -#: ../src/common/resource.cpp:1840 -#: ../src/common/resource.cpp:1854 -#: ../src/common/resource.cpp:1939 -#: ../src/common/resource.cpp:1953 -#: ../src/common/resource.cpp:1969 -#: ../src/common/resource.cpp:1983 -#: ../src/common/resource.cpp:3024 -#: ../src/common/resource.cpp:3038 -#: ../src/common/resource.cpp:3055 -#: ../src/common/resource.cpp:3069 +#: ../src/common/resourc2.cpp:305 ../src/common/resourc2.cpp:319 +#: ../src/common/resourc2.cpp:335 ../src/common/resourc2.cpp:349 +#: ../src/common/resourc2.cpp:1378 ../src/common/resourc2.cpp:1392 +#: ../src/common/resourc2.cpp:1408 ../src/common/resourc2.cpp:1422 +#: ../src/common/resource.cpp:1818 ../src/common/resource.cpp:1832 +#: ../src/common/resource.cpp:1849 ../src/common/resource.cpp:1863 +#: ../src/common/resource.cpp:1948 ../src/common/resource.cpp:1962 +#: ../src/common/resource.cpp:1978 ../src/common/resource.cpp:1992 +#: ../src/common/resource.cpp:3032 ../src/common/resource.cpp:3046 +#: ../src/common/resource.cpp:3063 ../src/common/resource.cpp:3077 msgid "Unexpected end of file whilst parsing resource." msgstr "Neoèekávaný konec souboru bìhem zpracování resource" -#: ../src/unix/mimetype.cpp:1304 -msgid "Unknown field in file %s, line %d: '%s'." -msgstr "Neznámá polo¾ka v souboru %s, øádka %d: '%s'." +#: ../src/common/cmdline.cpp:704 +#, c-format +msgid "Unexpected parameter '%s'" +msgstr "Neoèekávaný parametr '%s'" -#: ../src/common/mimecmn.cpp:162 -msgid "Unmatched '{' in an entry for mime type %s." -msgstr "Pøebyteèná '{' v popisu mime typu %s." +#: ../src/msw/dde.cpp:1019 +#, c-format +msgid "Unknown DDE error %08x" +msgstr "Neznámá chyba DDD: %08x" -#: ../src/common/docview.cpp:1867 -#: ../src/common/docview.cpp:1882 -#: ../src/common/docview.cpp:1909 +#: ../src/common/fontmap.cpp:329 +#, c-format +msgid "Unknown encoding (%d)" +msgstr "Neznámé kódování (%d)" + +#: ../src/unix/mimetype.cpp:1335 +#, c-format +msgid "Unknown field in file %s, line %d: '%s'." +msgstr "Neznámá polo¾ka v souboru %s, øádka %d: '%s'." + +#: ../src/common/cmdline.cpp:496 +#, c-format +msgid "Unknown long option '%s'" +msgstr "Neznámá 'dlouhá' volba '%s'" + +#: ../src/common/cmdline.cpp:518 +#, c-format +msgid "Unknown option '%s'" +msgstr "Neznámá volba '%s'" + +#: ../src/common/mimecmn.cpp:161 +#, c-format +msgid "Unmatched '{' in an entry for mime type %s." +msgstr "Pøebyteèná '{' v popisu mime typu %s." + +#: ../src/common/docview.cpp:1878 ../src/common/docview.cpp:1893 +#: ../src/common/docview.cpp:1920 msgid "Unnamed command" msgstr "Nepojmenovaný pøíkaz" -#: ../src/common/resourc2.cpp:687 -#: ../src/common/resource.cpp:2327 +#: ../src/common/resourc2.cpp:687 ../src/common/resource.cpp:2336 +#, c-format msgid "Unrecognized style %s whilst parsing resource." msgstr "Neznámý styl %s bìhem zpracování resource" -#: ../src/msw/clipbrd.cpp:268 -#: ../src/msw/clipbrd.cpp:369 -#: ../src/os2/CLIPBRD.CPP:242 -#: ../src/os2/CLIPBRD.CPP:342 +#: ../src/msw/clipbrd.cpp:268 ../src/msw/clipbrd.cpp:369 msgid "Unsupported clipboard format." msgstr "Nepodporovaný formát schránky." -#: ../src/generic/dirdlgg.cpp:210 +#: ../src/common/cmdline.cpp:789 +#, c-format +msgid "Usage: %s" +msgstr "Pou¾ití: %s" + +#: ../src/generic/dirdlgg.cpp:215 msgid "User" msgstr "User" -#: ../src/generic/dirdlgg.cpp:211 +#: ../src/generic/dirdlgg.cpp:214 msgid "User Local" msgstr "User Local" @@ -1006,17 +2402,27 @@ msgstr "User Local" msgid "Validation conflict" msgstr "Konflikt validace" -#: ../src/generic/dirdlgg.cpp:212 +#: ../src/generic/dirdlgg.cpp:216 msgid "Variables" msgstr "Promnìné" -#: ../src/common/docview.cpp:1437 +#: ../src/generic/filedlgg.cpp:861 +msgid "View files as a detailed view" +msgstr "Prohlí¾et soubory v detailním pohledu" + +#: ../src/generic/filedlgg.cpp:855 +msgid "View files as a list view" +msgstr "Prohlí¾et soubory v seznamu" + +#: ../src/common/docview.cpp:1449 msgid "Views" msgstr "Pohledy" -#: ../src/common/docview.cpp:428 -#: ../src/common/resource.cpp:121 -#: ../src/generic/logg.cpp:205 +#: ../src/unix/utilsunx.cpp:270 ../src/unix/utilsunx.cpp:619 +msgid "Waiting for subprocess termination failed" +msgstr "Èekání na ukonèení podprocesu selhalo" + +#: ../src/common/docview.cpp:435 ../src/common/resource.cpp:121 msgid "Warning" msgstr "Varování" @@ -1024,1523 +2430,605 @@ msgstr "Varov msgid "Warning: " msgstr "Varování: " -#: ../src/generic/dcpsg.cpp:2242 +#: ../src/html/htmlpars.cpp:179 +msgid "Warning: attempt to remove HTML tag handler from empty stack." +msgstr "Varování: pokus o vyjmutí HTML tag handleru z prázdného zásobníku." + +#: ../src/common/fontmap.cpp:97 +msgid "West European (ISO-8859-1/Latin 1)" +msgstr "Západoevropské (ISO-8859-1/Latin 1)" + +#: ../src/common/fontmap.cpp:111 +msgid "West European new (ISO-8859-15/Latin 0)" +msgstr "Západoevropské nové (ISO-8859-15/Latin 0)" + +#: ../src/html/helpfrm.cpp:406 +msgid "Whole words only" +msgstr "Pouze celá slova" + +#: ../src/msw/utils.cpp:545 +msgid "Win32s on Windows 3.1" +msgstr "Win32s na Windows 3.1" + +#: ../src/msw/mdi.cpp:1301 +msgid "Window" +msgstr "Windows 3.1" + +#: ../src/msw/utils.cpp:577 +msgid "Windows 3.1" +msgstr "Windows 3.1" + +#: ../src/msw/utils.cpp:549 +#, c-format +msgid "Windows 9%c" +msgstr "Windows 9%c" + +#: ../src/common/fontmap.cpp:119 +msgid "Windows Arabic (CP 1256)" +msgstr "Arabské pro Windows (CP 1256)" + +#: ../src/common/fontmap.cpp:120 +msgid "Windows Baltic (CP 1257)" +msgstr "Baltské pro Windows (CP 1257)" + +#: ../src/common/fontmap.cpp:114 +msgid "Windows Cyrillic (CP 1251)" +msgstr "Cyrilice pro Windows (CP 1251)" + +#: ../src/common/fontmap.cpp:116 +msgid "Windows Greek (CP 1253)" +msgstr "Øecké pro Windows (CP 1253)" + +#: ../src/common/fontmap.cpp:118 +msgid "Windows Hebrew (CP 1255)" +msgstr "Hebrejské pro Windows (CP 1255)" + +#: ../src/common/fontmap.cpp:115 +msgid "Windows Latin 1 (CP 1252)" +msgstr "Windows Latin 1 (CP 1252)" + +#: ../src/common/fontmap.cpp:113 +msgid "Windows Latin 2 (CP 1250)" +msgstr "Windows Latin 2 (CP 1250)" + +#: ../src/common/fontmap.cpp:117 +msgid "Windows Turkish (CP 1254)" +msgstr "Turecké pro Windows (CP 1254)" + +#: ../src/common/fontmap.cpp:121 +msgid "Windows/DOS OEM (CP 437)" +msgstr "Windows/DOS OEM (CP 437)" + +#: ../src/common/ffile.cpp:168 +#, c-format +msgid "Write error on file '%s'" +msgstr "Chyba pøi zápisu do souboru '%s'" + +#: ../src/generic/dcpsg.cpp:2291 msgid "X Scaling" msgstr "Mìøítko v X" -#: ../src/generic/dcpsg.cpp:2251 +#: ../src/generic/dcpsg.cpp:2300 msgid "X Translation" msgstr "Posunutí v X" -#: ../src/generic/dcpsg.cpp:2246 +#: ../src/generic/dcpsg.cpp:2295 msgid "Y Scaling" msgstr "Mìøítko v Y" -#: ../src/generic/dcpsg.cpp:2255 +#: ../src/generic/dcpsg.cpp:2304 msgid "Y Translation" msgstr "Posunutí v Y" -#: ../src/common/dlgcmn.cpp:107 -#: ../src/common/dlgcmn.cpp:114 +#: ../src/common/dlgcmn.cpp:109 ../src/common/dlgcmn.cpp:116 #: ../src/motif/msgdlg.cpp:178 msgid "Yes" msgstr "Ano" -#: ../src/common/docview.cpp:1978 +#: ../src/generic/dirdlgg.cpp:570 +msgid "You cannot add a new directory to this section." +msgstr "Nemù¾ete pøidat nový adresáø do této sekce." + +#: ../src/common/docview.cpp:1989 msgid "[EMPTY]" msgstr "[PRÁZDNÉ]" -#: ../src/common/fileconf.cpp:1416 +#: ../src/msw/dde.cpp:986 +msgid "a DDEML application has created a prolonged race condition." +msgstr "DDEML aplikace zpùsobila prodlou¾enou vzácnou podmínku." + +#: ../src/msw/dde.cpp:974 +msgid "" +"a DDEML function was called without first calling the DdeInitialize " +"function,\n" +"or an invalid instance identifier\n" +"was passed to a DDEML function." +msgstr "" +"Funkce DDEML byla zavolána bez pøedchozího volání DdeInitialize,\n" +"nebo dostala neplatný identifikátor\n" +"instance." + +#: ../src/msw/dde.cpp:992 +msgid "a client's attempt to establish a conversation has failed." +msgstr "clientùv pokus navázat konverzaci selhal." + +#: ../src/msw/dde.cpp:989 +msgid "a memory allocation failed." +msgstr "selhala alokace pamìti." + +#: ../src/msw/dde.cpp:983 +msgid "a parameter failed to be validated by the DDEML." +msgstr "nepodaøilo se ovìøit parametr pomocí DDEML." + +#: ../src/msw/dde.cpp:965 +msgid "a request for a synchronous advise transaction has timed out." +msgstr "po¾adavek na synchronní advise transakci vypr¹el." + +#: ../src/msw/dde.cpp:971 +msgid "a request for a synchronous data transaction has timed out." +msgstr "po¾adavek na synchronní datovou transakci vypr¹el." + +#: ../src/msw/dde.cpp:980 +msgid "a request for a synchronous execute transaction has timed out." +msgstr "po¾adavek na synchronní execute transakci vypr¹el." + +#: ../src/msw/dde.cpp:998 +msgid "a request for a synchronous poke transaction has timed out." +msgstr "po¾adavek na synchronní poke transakci vypr¹el." + +#: ../src/msw/dde.cpp:1013 +msgid "a request to end an advise transaction has timed out." +msgstr "po¾adavek na ukonèení advise transakce vypr¹el." + +#: ../src/msw/dde.cpp:1007 +msgid "" +"a server-side transaction was attempted on a conversation\n" +"that was terminated by the client, or the server\n" +"terminated before completing a transaction." +msgstr "" +"v konverzaci ukonèené klientem do¹lo k pokusu o serverovou\n" +"transakci, nebo se server\n" +"ukonèil pøed dodìláním transakce." + +#: ../src/msw/dde.cpp:995 +msgid "a transaction failed." +msgstr "transakce neuspìla." + +#: ../src/common/utilscmn.cpp:466 +msgid "alt" +msgstr "alt" + +#: ../src/msw/dde.cpp:977 +msgid "" +"an application initialized as APPCLASS_MONITOR has\n" +"attempted to perform a DDE transaction,\n" +"or an application initialized as APPCMD_CLIENTONLY has \n" +"attempted to perform server transactions." +msgstr "" +"aplikace inicializovaná jako APPCLASS_MONITOR se\n" +" pokusila o DDE transakci,\n" +"nebo se aplikace inicializovaná jako APPCMD_CLIENTONLY pokusila\n" +"o serverovou transakci." + +#: ../src/msw/dde.cpp:1001 +msgid "an internal call to the PostMessage function has failed. " +msgstr "interní volání PostMessage selhalo." + +#: ../src/msw/dde.cpp:1010 +msgid "an internal error has occurred in the DDEML." +msgstr "nastala interní chyba v DDEML." + +#: ../src/msw/dde.cpp:1016 +msgid "" +"an invalid transaction identifier was passed to a DDEML function.\n" +"Once the application has returned from an XTYP_XACT_COMPLETE callback,\n" +"the transaction identifier for that callback is no longer valid." +msgstr "" +"DDEML funkce dostala neplatný identifikátor transakce.\n" +"Identifikátor transakce se stává neplatný, jakmile se aplikace vrátí z\n" +"XTYP_XACT_COMPLETE callbacku." + +#: ../src/common/fileconf.cpp:1440 +#, c-format msgid "attempt to change immutable key '%s' ignored." msgstr "pokus o zmìnu nemìnného klíèe '%s' ignorován." -#: ../src/common/file.cpp:283 +#: ../src/common/ffile.cpp:101 +#, c-format +msgid "can't close file '%s'" +msgstr "nemohu zavøít soubor '%s'" + +#: ../src/common/file.cpp:257 +#, c-format msgid "can't close file descriptor %d" msgstr "nemohu zavøít deskriptor souboru %d" -#: ../src/common/file.cpp:581 -#: ../src/common/file.cpp:591 +#: ../src/common/file.cpp:555 ../src/common/file.cpp:565 +#, c-format msgid "can't commit changes to file '%s'" msgstr "Nemohu ulo¾it zmìny v souboru '%s'" -#: ../src/common/file.cpp:231 +#: ../src/common/file.cpp:200 +#, c-format msgid "can't create file '%s'" msgstr "nemohu vytvoøit soubor '%s'" -#: ../src/common/fileconf.cpp:886 +#: ../src/common/fileconf.cpp:910 +#, c-format msgid "can't delete user configuration file '%s'" msgstr "nemohu smazat u¾ivatelský konfiguraèní soubor '%s'" -#: ../src/common/file.cpp:462 +#: ../src/common/file.cpp:436 +#, c-format msgid "can't determine if the end of file is reached on descriptor %d" msgstr "nemohu zjistit, jestli byl dosa¾en konec souboru v deskriptoru %d" -#: ../src/common/file.cpp:428 +#: ../src/common/file.cpp:402 +#, c-format msgid "can't find length of file on file descriptor %d" msgstr "nemohu zjistit délku souboru na deskriptoru %d" -#: ../src/msw/utils.cpp:328 +#: ../src/msw/utils.cpp:376 msgid "can't find user's HOME, using current directory." msgstr "nemohu najít u¾ivatelùv domovský adresáø, pou¾iji aktuální adresáø" -#: ../src/common/file.cpp:342 +#: ../src/common/file.cpp:316 +#, c-format msgid "can't flush file descriptor %d" msgstr "nemohu vyprázdnit (flush) deskriptor %d" -#: ../src/common/file.cpp:396 +#: ../src/common/file.cpp:370 +#, c-format msgid "can't get seek position on file descriptor %d" msgstr "nemohu zjistit pozici v deskriptoru %d" -#: ../src/common/ffile.cpp:85 -#: ../src/common/file.cpp:269 +#: ../src/common/fontmap.cpp:597 +msgid "can't load any font, aborting" +msgstr "nemohu naèíst ¾ádný font, konèím" + +#: ../src/common/ffile.cpp:85 ../src/common/file.cpp:243 +#, c-format msgid "can't open file '%s'" msgstr "nemohu otevøít soubor '%s'" -#: ../src/common/fileconf.cpp:310 +#: ../src/common/fileconf.cpp:316 +#, c-format msgid "can't open global configuration file '%s'." msgstr "nemohu otevøít globální konfiguraèní soubor '%s'." -#: ../src/common/fileconf.cpp:322 +#: ../src/common/fileconf.cpp:328 +#, c-format msgid "can't open user configuration file '%s'." msgstr "nemohu otevøít konfiguraèní soubor '%s'" -#: ../src/common/fileconf.cpp:774 +#: ../src/common/fileconf.cpp:790 msgid "can't open user configuration file." msgstr "nemohu otevøít soubor s u¾ivatelskou konfigurací" -#: ../src/common/file.cpp:309 +#: ../src/common/file.cpp:283 +#, c-format msgid "can't read from file descriptor %d" msgstr "nemohu èíst z deskriptoru %d" -#: ../src/common/file.cpp:576 -#: ../src/common/file.cpp:586 +#: ../src/common/file.cpp:550 ../src/common/file.cpp:560 +#, c-format msgid "can't remove file '%s'" msgstr "nemohu odstranit soubor '%s'" -#: ../src/common/file.cpp:604 -#: ../src/common/file.cpp:607 +#: ../src/common/file.cpp:578 ../src/common/file.cpp:581 +#, c-format msgid "can't remove temporary file '%s'" msgstr "nemohu odstranit doèasný soubor '%s'" -#: ../src/common/file.cpp:382 +#: ../src/common/file.cpp:356 +#, c-format msgid "can't seek on file descriptor %d" msgstr "nemohu seekovat v deskriptoru %d" #: ../src/common/textfile.cpp:354 +#, c-format msgid "can't write file '%s' to disk." msgstr "nemohu zapsat soubor '%s' na disk." -#: ../src/common/file.cpp:327 +#: ../src/common/file.cpp:301 +#, c-format msgid "can't write to file descriptor %d" msgstr "nemohu zapisovat do deskriptoru %d" -#: ../src/common/fileconf.cpp:781 +#: ../src/common/fileconf.cpp:797 msgid "can't write user configuration file." msgstr "nemohu ulo¾it u¾ivatelskou konfiguraci" -#: ../src/common/intl.cpp:351 +#: ../src/common/intl.cpp:357 +#, c-format msgid "catalog file for domain '%s' not found." msgstr "katalog pro doménu '%s' nenalezen." -#: ../src/common/filefn.cpp:1774 -msgid "empty file name in wxFindFileInPath" -msgstr "prázdné jméno souboru ve wxFindFileInPath" +#: ../src/common/utilscmn.cpp:464 +msgid "ctrl" +msgstr "ctrl" + +#: ../src/common/cmdline.cpp:897 +msgid "date" +msgstr "datum" + +#: ../src/common/datetime.cpp:3213 +msgid "eighteenth" +msgstr "osmnáctý" + +#: ../src/common/datetime.cpp:3203 +msgid "eighth" +msgstr "osmý" -#: ../src/common/fileconf.cpp:1403 +#: ../src/common/datetime.cpp:3206 +msgid "eleventh" +msgstr "jedenáctý" + +#: ../src/common/fileconf.cpp:1427 +#, c-format msgid "entry '%s' appears more than once in group '%s'" msgstr "polo¾ka '%s' se v '%s' vyskytuje víc ne¾ jednou" -#: ../src/common/fileconf.cpp:464 +#: ../src/msw/dialup.cpp:856 +msgid "establish" +msgstr "navázat" + +#: ../src/common/ffile.cpp:182 +#, c-format +msgid "failed to flush the file '%s'" +msgstr "nelze vyprázdnit buffer souboru '%s'" + +#: ../src/common/datetime.cpp:3210 +msgid "fifteenth" +msgstr "patnáctý" + +#: ../src/common/datetime.cpp:3200 +msgid "fifth" +msgstr "pátý" + +#: ../src/common/fileconf.cpp:471 +#, c-format msgid "file '%s', line %d: '%s' ignored after group header." msgstr "soubor '%s', øádka %d: '%s' ignorováno po hlavièce skupiny." -#: ../src/common/fileconf.cpp:493 +#: ../src/common/fileconf.cpp:500 +#, c-format msgid "file '%s', line %d: '=' expected." msgstr "soubor '%s', øádka %d: oèekávám '='." -#: ../src/common/fileconf.cpp:521 +#: ../src/common/fileconf.cpp:526 +#, c-format msgid "file '%s', line %d: key '%s' was first found at line %d." msgstr "soubor '%s', øádka %d: klíè '%s' byl poprvé nalezen na øádce %d." -#: ../src/common/fileconf.cpp:510 +#: ../src/common/fileconf.cpp:516 +#, c-format msgid "file '%s', line %d: value for immutable key '%s' ignored." msgstr "soubor '%s', øádka %d: hodnota pro nemìnný klíè '%s' ignorována." -#: ../src/common/fileconf.cpp:431 +#: ../src/common/fileconf.cpp:439 +#, c-format msgid "file '%s': unexpected character %c at line %d." msgstr "soubor '%s': neoèekávaný znak %c na øádku %d." -#: ../src/common/file.cpp:466 +#: ../src/common/datetime.cpp:3196 +msgid "first" +msgstr "první" + +#: ../src/common/datetime.cpp:3209 +msgid "fourteenth" +msgstr "ètrnáctý" + +#: ../src/common/datetime.cpp:3199 +msgid "fourth" +msgstr "ètvrtý" + +#: ../src/common/timercmn.cpp:239 +msgid "gmtime() failed" +msgstr "gmtime() selhalo" + +#: ../src/msw/dialup.cpp:856 +msgid "initiate" +msgstr "inicializovat" + +#: ../src/common/file.cpp:440 msgid "invalid eof() return value." msgstr "¹patná návratová hodnota eof()." -#: ../src/generic/logg.cpp:490 +#: ../src/generic/logg.cpp:1033 msgid "invalid message box return value" msgstr "¹patná návratová hodnota message boxu" -#: ../src/common/intl.cpp:542 +#: ../src/html/helpfrm.cpp:874 +msgid "large" +msgstr "velké" + +#: ../src/common/intl.cpp:549 +#, c-format msgid "locale '%s' can not be set." msgstr "locale '%s' nemù¾e být nastaveno" -#: ../src/common/intl.cpp:635 -msgid "string '%s' not found in domain '%s' for locale '%s'." -msgstr "øetìzec '%s' nenalezen v doménì '%s' pro locale '%s'." - -#: ../src/common/intl.cpp:640 -msgid "string '%s' not found in locale '%s'." -msgstr "øetìzec '%s' nenalezen v locale '%s'." +#: ../src/common/intl.cpp:352 +#, c-format +msgid "looking for catalog '%s' in path '%s'." +msgstr "hledám katalog '%s' v cestì '%s'." -#: ../src/common/fileconf.cpp:1523 -msgid "unexpected \" at position %d in '%s'." -msgstr "neoèekávané \" na pozici %d v '%s'." +#: ../src/html/helpfrm.cpp:874 +msgid "medium" +msgstr "støední" -#: ../src/common/file.cpp:365 -msgid "unknown seek origin" -msgstr "neznámý poèátek pro nastavení pozice" +#: ../src/common/datetime.cpp:3360 +msgid "midnight" +msgstr "Tenké" -#: ../src/common/docview.cpp:397 -msgid "unnamed" -msgstr "nepojmenovaný" +#: ../src/common/timercmn.cpp:235 +msgid "mktime() failed" +msgstr "mktime() selhalo" -#: ../src/common/docview.cpp:1174 -msgid "unnamed%d" -msgstr "nepojmenovaný%d" +#: ../src/common/datetime.cpp:3214 +msgid "nineteenth" +msgstr "devatenáctý" -#: ../src/common/intl.cpp:356 -msgid "using catalog '%s' from '%s'." -msgstr "pou¾ívám katalog '%s' z '%s'." +#: ../src/common/datetime.cpp:3204 +msgid "ninth" +msgstr "devátý" -#: ../src/common/filefn.cpp:1222 -msgid "wxWindows: error finding temporary file name.\n" -msgstr "wxWindows: chyba pøi hledání jména doèasného souboru.\n" +#: ../src/msw/dde.cpp:961 +msgid "no DDE error." +msgstr "¾ádná chyba DDE." -#: ../src/common/cmdline.cpp:498 -msgid "Unknown long option '%s'" -msgstr "Neznámá 'dlouhá' volba '%s'" +#: ../src/html/helpdata.cpp:644 +msgid "noname" +msgstr "bezejmenná" -#: ../src/common/cmdline.cpp:520 -msgid "Unknown option '%s'" -msgstr "Neznámá volba '%s'" +#: ../src/common/datetime.cpp:3359 +msgid "noon" +msgstr "poledne" -#: ../src/common/cmdline.cpp:593 -msgid "Option '%s' requires a value, '=' expected." -msgstr "Volba '%s' vy¾aduje hodnotu, oèekávám '='." +#: ../src/common/cmdline.cpp:896 +msgid "num" +msgstr "èíslo" -#: ../src/common/cmdline.cpp:612 -msgid "Option '%s' requires a value." -msgstr "Volba '%s' vy¾aduje hodnotu." +#: ../src/msw/dde.cpp:1004 +msgid "reentrancy problem." +msgstr "problém reentrance." -#: ../src/common/cmdline.cpp:654 -msgid "'%s' is not a correct numeric value for option '%s'." -msgstr "'%s' není správná èíselná hodnota pro volbu '%s'." +#: ../src/common/datetime.cpp:3197 +msgid "second" +msgstr "druhý" -#: ../src/common/cmdline.cpp:669 -msgid "Option '%s': '%s' cannot be converted to a date." -msgstr "Volba '%s': '%s' neudává datum." +#: ../src/common/datetime.cpp:3212 +msgid "seventeenth" +msgstr "sedmnáctý" -#: ../src/common/cmdline.cpp:712 -msgid "Unexpected parameter '%s'" -msgstr "Neoèekávaný parametr '%s'" +#: ../src/common/datetime.cpp:3202 +msgid "seventh" +msgstr "sedmý" -#: ../src/common/cmdline.cpp:735 -msgid "%s (or %s)" -msgstr "%s (nebo %s)" +#: ../src/common/utilscmn.cpp:468 +msgid "shift" +msgstr "shift" -#: ../src/common/cmdline.cpp:740 -msgid "The value for the option '%s' must be specified." -msgstr "Musíte zadat hodnotu volby '%s'." +#: ../src/common/datetime.cpp:3211 +msgid "sixteenth" +msgstr "¹estnáctý" -#: ../src/common/cmdline.cpp:761 -msgid "The required parameter '%s' was not specified." -msgstr "Po¾adovaný parametr '%s' nebyl zadán." +#: ../src/common/datetime.cpp:3201 +msgid "sixth" +msgstr "¹estý" -#: ../src/common/cmdline.cpp:793 -msgid "Usage: %s" -msgstr "Pou¾ití: %s" +#: ../src/html/helpfrm.cpp:874 +msgid "small" +msgstr "malé" -#: ../src/common/cmdline.cpp:875 +#: ../src/common/cmdline.cpp:895 msgid "str" msgstr "øetìzec" -#: ../src/common/cmdline.cpp:876 -msgid "num" -msgstr "èíslo" +#: ../src/common/datetime.cpp:3205 +msgid "tenth" +msgstr "desátý" -#: ../src/common/cmdline.cpp:877 -msgid "date" -msgstr "datum" +#: ../src/msw/dde.cpp:968 +msgid "the response to the transaction caused the DDE_FBUSY bit to be set." +msgstr "odpovìï na transakci zpùsobila nastavení bitu DDE_FBUSY." -#: ../src/common/dlgcmn.cpp:130 -#: ../src/generic/helpwxht.cpp:157 -msgid "Forward" -msgstr "Dále" +#: ../src/common/datetime.cpp:3198 +msgid "third" +msgstr "tøetí" -#: ../src/common/dlgcmn.cpp:133 -msgid "Backward" -msgstr "Zpìt" +#: ../src/common/datetime.cpp:3208 +msgid "thirteenth" +msgstr "tøináctý" -#: ../src/common/dlgcmn.cpp:136 -msgid "Setup" -msgstr "Nastavení" +#: ../src/common/datetime.cpp:3003 +msgid "today" +msgstr "dnes" -#: ../src/common/dlgcmn.cpp:139 -msgid "More..." -msgstr "Dal¹í..." +#: ../src/common/datetime.cpp:3005 +msgid "tomorrow" +msgstr "vèera" -#: ../src/common/dlgcmn.cpp:142 -#: ../src/generic/prntdlgg.cpp:687 -#: ../src/generic/proplist.cpp:528 -#: ../src/html/helpfrm.cpp:208 -msgid "Help" -msgstr "Nápovìda" +#: ../src/common/datetime.cpp:3207 +msgid "twelfth" +msgstr "dvanáctý" -#: ../src/common/docview.cpp:1192 -msgid " - " -msgstr " - " +#: ../src/common/datetime.cpp:3215 +msgid "twentieth" +msgstr "dvacátý" -#: ../src/common/docview.cpp:1620 -msgid "The file '%s' doesn't exist and couldn't be opened.\nIt has been also removed from the MRU files list." -msgstr "Soubor '%s' neexistuje.\nBude odstranìn ze seznamu nedávno otevøených souborù." +#: ../src/common/fileconf.cpp:1547 +#, c-format +msgid "unexpected \" at position %d in '%s'." +msgstr "neoèekávané \" na pozici %d v '%s'." -#: ../src/common/dynlib.cpp:225 -msgid "Failed to load shared library '%s'" -msgstr "Nelze naèíst sdílenou knihovnu '%s'" +#: ../src/generic/progdlgg.cpp:241 +msgid "unknown" +msgstr "neznámý" -#: ../src/common/dynlib.cpp:268 -msgid "Couldn't find symbol '%s' in a dynamic library" -msgstr "Nemohu v dynamické knihovnì nalézt symbol '%s'" +#: ../src/msw/dialup.cpp:462 +#, c-format +msgid "unknown error (error code %08x)." +msgstr "neznámá chyba (kód %08x)." -#: ../src/common/ffile.cpp:101 -msgid "can't close file '%s'" -msgstr "nemohu zavøít soubor '%s'" +#: ../src/common/file.cpp:339 +msgid "unknown seek origin" +msgstr "neznámý poèátek pro nastavení pozice" -#: ../src/common/ffile.cpp:133 -#: ../src/common/ffile.cpp:154 -msgid "Read error on file '%s'" -msgstr "Chyba pøi ètení ze souboru '%s'" +#: ../src/common/fontmap.cpp:351 +#, c-format +msgid "unknown-%d" +msgstr "nezname-%d" -#: ../src/common/ffile.cpp:168 -msgid "Write error on file '%s'" -msgstr "Chyba pøi zápisu do souboru '%s'" - -#: ../src/common/ffile.cpp:182 -msgid "failed to flush the file '%s'" -msgstr "nelze vyprázdnit buffer souboru '%s'" - -#: ../src/common/ffile.cpp:221 -msgid "Seek error on file '%s'" -msgstr "Chyba pøi nastavování pozice v souboru '%s'" - -#: ../src/common/ffile.cpp:234 -msgid "Can't find current position in file '%s'" -msgstr "Nemohu zjistit pozici v souboru '%s'" - -#: ../src/common/fileconf.cpp:743 -msgid "Config entry name cannot start with '%c'." -msgstr "Polo¾ka konfigurace nemù¾e zaèínat na '%c'" - -#: ../src/common/filefn.cpp:1092 -msgid "Directory '%s' couldn't be created" -msgstr "Nelze vytvoøit adresáø '%s'" - -#: ../src/common/fontmap.cpp:306 -msgid "Unknown encoding (%d)" -msgstr "Neznámé kódování (%d)" - -#: ../src/common/fontmap.cpp:329 -msgid "unknown-%d" -msgstr "nezname-%d" - -#: ../src/common/fontmap.cpp:438 -msgid ": unknown charset" -msgstr ": neznámá znaková sada" - -#: ../src/common/fontmap.cpp:444 -msgid "The charset '%s' is unknown. You may select\nanother charset to replace it with or choose\n[Cancel] if it cannot be replaced" -msgstr "Znaková sada '%s' je neznámá. Mù¾ete vybrat\njinou sadu jako náhradu nebo stisknìte\n[Zru¹it], pokud ji nelze nahradit" - -#: ../src/common/fontmap.cpp:486 -msgid "Failed to remember the encoding for the charset '%s'." -msgstr "Nemohu ulo¾it kódování znakové sady '%s'." - -#: ../src/common/fontmap.cpp:545 -msgid "can't load any font, aborting" -msgstr "nemohu naèíst ¾ádný font, konèím" - -#: ../src/common/fontmap.cpp:598 -msgid ": unknown encoding" -msgstr ": neznámé kódování" - -#: ../src/common/fontmap.cpp:606 -msgid "The encoding '%s' is unknown.\nWould you like to select a font to be used for this encoding\n(otherwise the text in this encoding will not be shown correctly)?" -msgstr "Neznámé kódování '%s'.\nPøejete si vybrat font, který se má s tímto kódováním pou¾ít\n(jinak se text v tomto kódování nezobrazí správnì)?" - -#: ../src/common/imagbmp.cpp:98 -msgid "BMP: Image width > 32767 pixels for file." -msgstr "BMP: Obrázek má ¹íøku vìt¹í ne¾ 32767 pixelù." - -#: ../src/common/imagbmp.cpp:104 -msgid "BMP: Image height > 32767 pixels for file." -msgstr "BMP: Obrázek má vý¹ku vìt¹í ne¾ 32767 pixelù." - -#: ../src/common/imagbmp.cpp:118 -msgid "BMP: Unknown bitdepth in file." -msgstr "BMP: Neznámá bitová hloubka." - -#: ../src/common/imagbmp.cpp:127 -msgid "BMP: Unknown encoding in file." -msgstr "BMP: Neznámé kódování." - -#: ../src/common/imagbmp.cpp:141 -msgid "BMP: Encoding doesn't match bitdepth." -msgstr "BMP: Kódování neodpovídá bitové hloubce." - -#: ../src/common/imagbmp.cpp:150 -#: ../src/common/imagbmp.cpp:162 -msgid "BMP: Couldn't allocate memory." -msgstr "BMP: Nemohu alokovat pamì»." - -#: ../src/common/imagbmp.cpp:271 -msgid "BMP: Cannot deal with 4bit encoded yet." -msgstr "BMP: Zatím neumím zpracovat 4bitové kódování." - -#: ../src/common/image.cpp:413 -#: ../src/common/image.cpp:433 -msgid "Can't load image from file '%s': file does not exist." -msgstr "Nemohu naèíst obrázek ze souboru '%s': soubor neexistuje." - -#: ../src/common/image.cpp:518 -msgid "No handler found for image type." -msgstr "Nenalezen ¾ádný ovladaè pro tento typ obrázkù." - -#: ../src/common/image.cpp:526 -#: ../src/common/image.cpp:560 -msgid "No image handler for type %d defined." -msgstr "®ádný ovladaè pro typ obrázkù %d." - -#: ../src/common/image.cpp:544 -#: ../src/common/image.cpp:576 -msgid "No image handler for type %s defined." -msgstr "®ádný ovladaè pro typ obrázkù %s." - -#: ../src/common/image.cpp:713 -msgid "Can't check image format of file '%s': file does not exist." -msgstr "Nemohu detekovat formát obrázku '%s': soubor neexistuje." - -#: ../src/common/imagjpeg.cpp:195 -msgid "JPEG: Couldn't load - file is probably corrupted." -msgstr "JPEG: Nemohu naèíst obrázek - soubor je nejspí¹ po¹kozen." - -#: ../src/common/imagjpeg.cpp:312 -msgid "JPEG: Couldn't save image." -msgstr "JPEG: Nemohu ulo¾it obrázek." - -#: ../src/common/imagpcx.cpp:434 -msgid "PCX: this is not a PCX file." -msgstr "PCX: tento soubor není PCX." - -#: ../src/common/imagpng.cpp:245 -msgid "Couldn't load a PNG image - file is corrupted or not enough memory." -msgstr "Nemohu naèíst PNG obrázek - buï je po¹kozený soubor nebo je nedostatek pamìti." - -#: ../src/common/imagpnm.cpp:72 -msgid "Loading Grey Ascii PNM image is not yet implemented." -msgstr "Naèítání ¹edých ascii PNM obrázkù není je¹tì implementováno." - -#: ../src/common/imagpnm.cpp:75 -msgid "Loading Grey Raw PNM image is not yet implemented." -msgstr "Naèítání ¹edých raw PNM obrázkù není je¹tì implementováno." - -#: ../src/common/imagpnm.cpp:80 -msgid "PNM: File format is not recognized." -msgstr "PNM: formát souboru nerozeznán." - -#: ../src/common/imagpnm.cpp:96 -msgid "PNM: Couldn't allocate memory." -msgstr "PNM: Nemohu alokovat pamì»." - -#: ../src/common/imagpnm.cpp:112 -msgid "PNM: File seems truncated." -msgstr "PNM: Soubor je nejspí¹ uøíznutý pøed koncem." - -#: ../src/common/imagtiff.cpp:128 -msgid "TIFF: Error loading image." -msgstr "TIFF: Chyba pøi naèítání obrázku." - -#: ../src/common/imagtiff.cpp:136 -msgid "Invalid TIFF image index." -msgstr "Po¹kozený index v TIFF obrázku." - -#: ../src/common/imagtiff.cpp:157 -#: ../src/common/imagtiff.cpp:166 -msgid "TIFF: Couldn't allocate memory." -msgstr "TIFF: Nemohu alokovat pamì»." - -#: ../src/common/imagtiff.cpp:176 -msgid "TIFF: Error reading image." -msgstr "TIFF: Chyba pøi naèítání obrázku." - -#: ../src/common/layout.cpp:1093 -msgid "wxWindowBase::Layout() failed.\n" -msgstr "wxWindowBase::Layout() selhal.\n" - -#: ../src/common/resourc2.cpp:982 -#: ../src/common/resource.cpp:2624 -msgid "Failed to find XPM resource %s.\nForgot to use wxResourceLoadIconData?" -msgstr "Nelze najít XPM resource %s.\nNezpomnìl jste pou¾ít wxResourceLoadIconData?" - -#: ../src/common/sckaddr.cpp:107 -msgid "Trying to solve a NULL hostname: giving up" -msgstr "Sna¾ím se zjistit NULLové jméno poèítaèe: vzdávám to" - -#: ../src/common/socket.cpp:327 -#: ../src/common/socket.cpp:381 -msgid "wxSocket: invalid signature in ReadMsg." -msgstr "wxSocket: chybná signatura v ReadMsg." - -#: ../src/common/textcmn.cpp:94 -msgid "File couldn't be loaded." -msgstr "Soubor nelze naèíst." - -#: ../src/common/textcmn.cpp:121 -msgid "The text couldn't be saved." -msgstr "Text nelze ulo¾it." - -#: ../src/common/textfile.cpp:234 -msgid "unknown line terminator" -msgstr "neznámý ukonèovaè øádky" +#: ../src/common/docview.cpp:404 +msgid "unnamed" +msgstr "nepojmenovaný" -#: ../src/common/timercmn.cpp:195 -msgid "Failed to get the local system time" -msgstr "Nepodaøilo se zjistit místní systémový èas" +#: ../src/common/docview.cpp:1186 +#, c-format +msgid "unnamed%d" +msgstr "nepojmenovaný%d" -#: ../src/common/timercmn.cpp:235 -msgid "mktime() failed" -msgstr "mktime() selhalo" +#: ../src/common/intl.cpp:362 +#, c-format +msgid "using catalog '%s' from '%s'." +msgstr "pou¾ívám katalog '%s' z '%s'." -#: ../src/common/timercmn.cpp:239 -msgid "gmtime() failed" -msgstr "gmtime() selhalo" +#: ../src/html/helpfrm.cpp:874 +msgid "very large" +msgstr "velmi velké" -#: ../src/common/timercmn.cpp:243 -msgid "Failed to get the UTC system time." -msgstr "Nemohu zjistit systémový UTC èas." +#: ../src/html/helpfrm.cpp:874 +msgid "very small" +msgstr "velmi malé" #: ../src/common/timercmn.cpp:266 msgid "wxGetTimeOfDay failed." msgstr "wxGetTimeOfDay selhalo." -#: ../src/common/utilscmn.cpp:462 -msgid "ctrl" -msgstr "ctrl" - -#: ../src/common/utilscmn.cpp:464 -msgid "alt" -msgstr "alt" - -#: ../src/common/utilscmn.cpp:466 -msgid "shift" -msgstr "shift" - -#: ../src/common/valtext.cpp:140 -msgid "'%s' is invalid" -msgstr "'%s' je neplatný" - -#: ../src/common/valtext.cpp:160 -msgid "'%s' should only contain ASCII characters." -msgstr "'%s' má obsahovat pouze ASCII znaky." - -#: ../src/common/valtext.cpp:166 -msgid "'%s' should only contain alphabetic characters." -msgstr "'%s' má obsahovat pouze písmena." - -#: ../src/common/valtext.cpp:172 -msgid "'%s' should only contain alphabetic or numeric characters." -msgstr "'%s' má obsahovat pouze písmena nebo èíslice." - -#: ../src/common/valtext.cpp:178 -msgid "'%s' should be numeric." -msgstr "'%s' má být èíslo." - -#: ../src/common/fs_mem.cpp:142 -msgid "Memory VFS already contains file '%s'!" -msgstr "Pamì»ový VFS u¾ obsahuje soubor '%s'!" - -#: ../src/common/fs_mem.cpp:165 -msgid "Failed to store image '%s' to memory VFS!" -msgstr "Nepodaøilo se ulo¾it obrázek '%s' do pamì»ového VFS!" - -#: ../src/common/fs_mem.cpp:200 -msgid "Trying to remove file '%s' from memory VFS, but it is not loaded!" -msgstr "Soubor '%s' nelze odebrat z pamì»ového VFS, proto¾e nebyl naèten!" - -#: ../src/generic/dcpsg.cpp:1541 -msgid "Cannot open file for PostScript printing!" -msgstr "Nemohu otevøít soubor k PostScriptovému tisku!" - -#: ../src/generic/dcpsg.cpp:2467 -msgid "A4 sheet, 210 x 297 mm" -msgstr "A4 sheet, 210 x 297 mm" - -#: ../src/generic/dirdlgg.cpp:187 -msgid "Sections" -msgstr "Sekce" - -#: ../src/generic/dirdlgg.cpp:204 -msgid "My Harddisk" -msgstr "Mùj disk" - -#: ../src/generic/dirdlgg.cpp:259 -#: ../src/generic/filedlgg.cpp:708 -msgid "." -msgstr "." - -#: ../src/generic/dirdlgg.cpp:260 -#: ../src/generic/filedlgg.cpp:709 -msgid ".." -msgstr ".." - -#: ../src/generic/dirdlgg.cpp:263 -#: ../src/generic/filedlgg.cpp:712 -msgid "Illegal directory name." -msgstr "Nedovolené jméno adresáøe." - -#: ../src/generic/dirdlgg.cpp:281 -#: ../src/generic/filedlgg.cpp:726 -msgid "File name exists already." -msgstr "Soubor tohoto jména ji¾ existuje." - -#: ../src/generic/dirdlgg.cpp:292 -#: ../src/generic/dirdlgg.cpp:533 -#: ../src/generic/filedlgg.cpp:620 -#: ../src/generic/filedlgg.cpp:739 -msgid "Operation not permitted." -msgstr "Zakázaná operace." - -#: ../src/generic/dirdlgg.cpp:401 -msgid "Show hidden" -msgstr "Zobrazit skryté" - -#: ../src/generic/dirdlgg.cpp:499 -msgid "You cannot add a new directory to this section." -msgstr "Nemù¾ete pøidat nový adresáø do této sekce." - -#: ../src/generic/dirdlgg.cpp:500 -msgid "Create directory" -msgstr "Vytváøení adresáøe" - -#: ../src/generic/filedlgg.cpp:321 -msgid "<DIR> " -msgstr "<ADR >" - -#: ../src/generic/filedlgg.cpp:322 -msgid "<LINK> " -msgstr "<LINK> " +#: ../src/common/socket.cpp:329 ../src/common/socket.cpp:383 +msgid "wxSocket: invalid signature in ReadMsg." +msgstr "wxSocket: chybná signatura v ReadMsg." -#: ../src/generic/filedlgg.cpp:326 -msgid " bytes " -msgstr " bajtù" +#: ../src/common/socket.cpp:903 +msgid "wxSocket: unknown event!." +msgstr "wxSocket: neznámá událost!" -#: ../src/generic/filedlgg.cpp:354 -msgid "<DIR>" -msgstr "<ADR>" +#: ../src/motif/app.cpp:591 +#, c-format +msgid "wxWindows could not open display for '%s': exiting." +msgstr "wxWindows nemohou otevøít displej pro '%s': ukonèuji." -#: ../src/generic/filedlgg.cpp:355 -msgid "<LINK>" -msgstr "<LINK>" +#: ../src/common/filefn.cpp:1214 +msgid "wxWindows: error finding temporary file name.\n" +msgstr "wxWindows: chyba pøi hledání jména doèasného souboru.\n" -#: ../src/generic/filedlgg.cpp:531 -msgid "Name" -msgstr "Jméno" +#: ../src/common/datetime.cpp:3004 +msgid "yesterday" +msgstr "vèera" -#: ../src/generic/filedlgg.cpp:532 -msgid "Size" -msgstr "Velikost" - -#: ../src/generic/filedlgg.cpp:533 -msgid "Date" -msgstr "Datum" - -#: ../src/generic/filedlgg.cpp:534 -#: ../src/generic/logg.cpp:764 -msgid "Time" -msgstr "Èas" - -#: ../src/generic/filedlgg.cpp:535 -msgid "Permissions" -msgstr "Práva" - -#: ../src/generic/filedlgg.cpp:605 -msgid "NewName" -msgstr "NoveJmeno" - -#: ../src/generic/filedlgg.cpp:820 -msgid "All files (*)|*" -msgstr "V¹echny (*)|*" - -#: ../src/generic/filedlgg.cpp:850 -msgid "View files as a list view" -msgstr "Prohlí¾et soubory v seznamu" - -#: ../src/generic/filedlgg.cpp:856 -msgid "View files as a detailed view" -msgstr "Prohlí¾et soubory v detailním pohledu" - -#: ../src/generic/filedlgg.cpp:864 -msgid "Go to parent directory" -msgstr "Jít do nadøazeného adresáøe" - -#: ../src/generic/filedlgg.cpp:870 -msgid "Go to home directory" -msgstr "Jít do domovského adresáøe" - -#: ../src/generic/filedlgg.cpp:878 -msgid "Create new directory" -msgstr "Vytvoøit nový adresáø" - -#: ../src/generic/filedlgg.cpp:885 -msgid "Current directory:" -msgstr "Aktuální adresáø:" - -#: ../src/generic/filedlgg.cpp:908 -msgid "Show hidden files" -msgstr "Ukázat skryté soubory" - -#: ../src/generic/filedlgg.cpp:1038 -msgid "Illegal file specification." -msgstr "Neplatná specifikace souboru." - -#: ../src/generic/filedlgg.cpp:1087 -#: ../src/gtk/filedlg.cpp:83 -msgid "Please choose an existing file." -msgstr "Vyberte prosím existující soubor." - -#: ../src/generic/helpext.cpp:96 -#: ../src/generic/helpext.cpp:109 -msgid "Cannot open URL '%s'" -msgstr "Nemohu otevøít URL '%s'" - -#: ../src/generic/helpwxht.cpp:156 -msgid "Back" -msgstr "Zpìt" - -#: ../src/generic/helpwxht.cpp:158 -#: ../src/html/helpfrm.cpp:301 -#: ../src/html/helpfrm.cpp:310 -msgid "Contents" -msgstr "Obsah" - -#: ../src/generic/helpwxht.cpp:160 -#: ../src/html/helpfrm.cpp:412 -#: ../src/html/helpfrm.cpp:432 -msgid "Search" -msgstr "Hledat" - -#: ../src/generic/helpwxht.cpp:250 -#: ../src/html/helpctrl.cpp:44 -msgid "Help: %s" -msgstr "Nápovìda: %s" - -#: ../src/generic/logg.cpp:763 -msgid "Message" -msgstr "Zpráva" - -#: ../src/generic/printps.cpp:185 -msgid "Printing..." -msgstr "Tisknu..." - -#: ../src/generic/printps.cpp:218 -msgid "Printing page %d..." -msgstr "Tisknu stranu %d..." - -#: ../src/generic/prntdlgg.cpp:555 -#: ../src/generic/prntdlgg.cpp:626 -#: ../src/generic/prntdlgg.cpp:808 -msgid "Paper Size" -msgstr "Velikost papíru" - -#: ../src/generic/progdlgg.cpp:153 -msgid "Elapsed time : " -msgstr "Dosa¾ený èas : " - -#: ../src/generic/progdlgg.cpp:160 -msgid "Estimated time : " -msgstr "Odhadovaný èas : " - -#: ../src/generic/progdlgg.cpp:167 -msgid "Remaining time : " -msgstr "Zbývající èas : " - -#: ../src/generic/progdlgg.cpp:241 -msgid "unknown" -msgstr "neznámý" - -#: ../src/generic/progdlgg.cpp:313 -msgid "Done." -msgstr "Hotovo." - -#: ../src/generic/tipdlg.cpp:138 -msgid "Tips not available, sorry!" -msgstr "Tip není k dispozici!" - -#: ../src/generic/tipdlg.cpp:162 -msgid "Tip of the Day" -msgstr "Tip dne" - -#: ../src/generic/tipdlg.cpp:172 -msgid "&Show tips at startup" -msgstr "&Zobrazit tipy pøi spu¹tìní" - -#: ../src/generic/tipdlg.cpp:175 -msgid "&Next Tip" -msgstr "&Dal¹í tip" - -#: ../src/generic/tipdlg.cpp:177 -msgid "Did you know..." -msgstr "Vìdìl jste..." - -#: ../src/generic/wizard.cpp:168 -msgid "< &Back" -msgstr "< &Zpìt" - -#: ../src/generic/wizard.cpp:171 -#: ../src/generic/wizard.cpp:270 -msgid "&Next >" -msgstr "&Dal¹í >" - -#: ../src/generic/wizard.cpp:268 -msgid "&Finish" -msgstr "&Dokonèit" - -#: ../src/gtk/fontdlg.cpp:72 -msgid "Please choose a valid font." -msgstr "Prosím vyberte korektní font." - -#: ../src/gtk/fontdlg.cpp:159 -msgid "Choose font" -msgstr "Vyberte písmo" - -#: ../src/html/helpctrl.cpp:88 -msgid "Adding book %s" -msgstr "Pøidávám knihu %s" - -#: ../src/html/helpdata.cpp:238 -msgid "Cannot open contents file: %s" -msgstr "Nelze otevøít soubor s obsahem: %s" - -#: ../src/html/helpdata.cpp:253 -msgid "Cannot open index file: %s" -msgstr "Nelze otevøít soubor s rejstøíkem: %s" - -#: ../src/html/helpdata.cpp:288 -msgid "Incorrect version of HTML help book" -msgstr "©patná verze knihy s HTML nápovìdou" - -#: ../src/html/helpdata.cpp:529 -msgid "noname" -msgstr "bezejmenná" - -#: ../src/html/helpdata.cpp:542 -msgid "Cannot open HTML help book: %s" -msgstr "Nelze otevøít HTML nápovìdu: %s" - -#: ../src/html/helpfrm.cpp:267 -msgid "Remove current page from bookmarks" -msgstr "Odstraní tuto stránku ze zálo¾ek" - -#: ../src/html/helpfrm.cpp:268 -msgid "Add current page to bookmarks" -msgstr "Pøidá tuto stránku k zálo¾kám" - -#: ../src/html/helpfrm.cpp:274 -#: ../src/html/helpfrm.cpp:763 -#: ../src/html/helpfrm.cpp:1301 -msgid "(bookmarks)" -msgstr "(zálo¾ky)" - -#: ../src/html/helpfrm.cpp:329 -msgid "Show all" -msgstr "Zobraz v¹e" - -#: ../src/html/helpfrm.cpp:338 -msgid "Find" -msgstr "Najít" - -#: ../src/html/helpfrm.cpp:363 -msgid "Show all items in index" -msgstr "Zobrazí v¹echny polo¾ky v rejstøíku" - -#: ../src/html/helpfrm.cpp:364 -msgid "Display all index items that contain given substring. Search is case insensitive." -msgstr "Zobrazí v¹echny polo¾ky rejstøíku, které obsahují daný podøetìzec. Nerozli¹uje velká a malá písmena." - -#: ../src/html/helpfrm.cpp:370 -msgid "Index" -msgstr "Rejtøík" - -#: ../src/html/helpfrm.cpp:396 -msgid "Case sensitive" -msgstr "Rozli¹ovat velká/malá" - -#: ../src/html/helpfrm.cpp:404 -msgid "Whole words only" -msgstr "Pouze celá slova" - -#: ../src/html/helpfrm.cpp:414 -msgid "Search contents of help book(s) for all occurences of the text you typed above" -msgstr "Prohledá obsah knih(y) s nápovìdou a vypí¹e v¹echny výskyty textu, který jste zadal" - -#: ../src/html/helpfrm.cpp:476 -msgid "Show/hide navigation panel" -msgstr "Zobraz/schovej navigaèní panel" - -#: ../src/html/helpfrm.cpp:481 -msgid "Go back" -msgstr "Jdi zpìt" - -#: ../src/html/helpfrm.cpp:484 -msgid "Go forward" -msgstr "Jdi dopøedu" - -#: ../src/html/helpfrm.cpp:489 -msgid "Go one level up in document hierarchy" -msgstr "Jdi o úroveò vý¹" - -#: ../src/html/helpfrm.cpp:492 -msgid "Previous page" -msgstr "Pøedchozí stránka" - -#: ../src/html/helpfrm.cpp:495 -msgid "Next page" -msgstr "Následující stránka" - -#: ../src/html/helpfrm.cpp:503 -#: ../src/html/helpfrm.cpp:1161 -msgid "Open HTML document" -msgstr "Otevøi HTML dokument" - -#: ../src/html/helpfrm.cpp:509 -msgid "Print this page" -msgstr "Vytiskne tuto stránku" - -#: ../src/html/helpfrm.cpp:515 -msgid "Display options dialog" -msgstr "Zobrazí dialog s nastaveními" - -#: ../src/html/helpfrm.cpp:608 -msgid "Searching..." -msgstr "Hledám..." - -#: ../src/html/helpfrm.cpp:608 -msgid "No matching page found yet" -msgstr "®ádný výskyt nenalezen" - -#: ../src/html/helpfrm.cpp:617 -msgid "Found %i matches" -msgstr "Nalezeno výskytù: %i" - -#: ../src/html/helpfrm.cpp:659 -msgid "(Help)" -msgstr "(Nápovìda)" - -#: ../src/html/helpfrm.cpp:698 -#: ../src/html/helpfrm.cpp:699 -#: ../src/html/helpfrm.cpp:1248 -#: ../src/html/helpfrm.cpp:1275 -msgid "%i of %i" -msgstr "%i z %i" - -#: ../src/html/helpfrm.cpp:715 -msgid "Search in all books" -msgstr "Hledej ve v¹ech knihách" - -#: ../src/html/helpfrm.cpp:852 -msgid "Help Browser Options" -msgstr "Nastavení prohlí¾eèe nápovìdy" - -#: ../src/html/helpfrm.cpp:854 -msgid "very small" -msgstr "velmi malé" - -#: ../src/html/helpfrm.cpp:854 -msgid "small" -msgstr "malé" - -#: ../src/html/helpfrm.cpp:854 -msgid "medium" -msgstr "støední" - -#: ../src/html/helpfrm.cpp:854 -msgid "large" -msgstr "velké" - -#: ../src/html/helpfrm.cpp:854 -msgid "very large" -msgstr "velmi velké" - -#: ../src/html/helpfrm.cpp:861 -msgid "Normal font:" -msgstr "Normální písmo:" - -#: ../src/html/helpfrm.cpp:869 -msgid "Fixed font:" -msgstr "Neproporcionální písmo:" - -#: ../src/html/helpfrm.cpp:879 -msgid "Font size:" -msgstr "Velikost písma:" - -#: ../src/html/helpfrm.cpp:883 -msgid "Preview:" -msgstr "Náhled:" - -#: ../src/html/helpfrm.cpp:927 -msgid "<html><body>Normal face<br>(and <u>underlined</u>. <i>Italic face.</i> <b>Bold face.</b> <b><i>Bold italic face.</i></b><br><font size=-2>font size -2</font><br><font size=-1>font size -1</font><br><font size=+0>font size +0</font><br><font size=+1>font size +1</font><br><font size=+2>font size +2</font><br><font size=+3>font size +3</font><br><font size=+4>font size +4</font><br><p><tt>Fixed size face.<br> <b>bold</b> <i>italic</i> <b><i>bold italic <u>underlined</u></i></b><br><font size=-2>font size -2</font><br><font size=-1>font size -1</font><br><font size=+0>font size +0</font><br><font size=+1>font size +1</font><br><font size=+2>font size +2</font><br><font size=+3>font size +3</font><br><font size=+4>font size +4</font></tt></body></html>" -msgstr "<html><body>Obyèejné písmo<br>(a <u>podtr¾ené</u>. <i>Kurziva.</i> <b>Tuèné.</b> <b><i>Tuèná kurziva.</i></b><br><font size=-2>velikost -2</font><br><font size=-1>velikost -1</font><br><font size=+0>velikost +0</font><br><font size=+1>velikost +1</font><br><font size=+2>velikost +2</font><br><font size=+3>velikost +3</font><br><font size=+4>velikost +4</font><br><p><tt>Neproporcionální písmo.<br> <b>tuèné</b> <i>kurziva</i> <b><i>tuèná kurziva <u>podtr¾ené</u></i></b><br><font size=-2>velikost -2</font><br><font size=-1>velikost -1</font><br><font size=+0>velikost +0</font><br><font size=+1>velikost +1</font><br><font size=+2>velikost +2</font><br><font size=+3>velikost +3</font><br><font size=+4>velikost +4</font></tt></body></html>" - -#: ../src/html/helpfrm.cpp:1150 -msgid "Help Printing" -msgstr "Tisk nápovìdy" - -#: ../src/html/htmlfilt.cpp:146 -msgid "Cannot open HTML document: %s" -msgstr "Nelze otevøít HTML dokument: %s" - -#: ../src/html/htmlpars.cpp:179 -msgid "Warning: attempt to remove HTML tag handler from empty stack." -msgstr "Varování: pokus o vyjmutí HTML tag handleru z prázdného zásobníku." - -#: ../src/html/htmlwin.cpp:166 -msgid "Connecting..." -msgstr "Pøipojuji se..." - -#: ../src/html/htmlwin.cpp:175 -msgid "Unable to open requested HTML document: %s" -msgstr "Nelze otevøít po¾adovaný HTML dokument: %s" - -#: ../src/html/htmlwin.cpp:187 -msgid "Loading : " -msgstr "Naèítám : " - -#: ../src/html/htmlwin.cpp:216 -msgid "Done" -msgstr "Hotovo" - -#: ../src/html/htmlwin.cpp:251 -msgid "HTML anchor %s does not exist." -msgstr "Kotva HTML %s neexistuje." - -#: ../src/html/htmprint.cpp:486 -msgid "There was a problem previewing.\nPerhaps your current printer is not set correctly?" -msgstr "Pøi vytváøení náhledu se vyskytl problém.\nMo¾ná nemáte správnì nastavenou tiskárnu?" - -#: ../src/html/htmprint.cpp:486 -msgid "Previewing" -msgstr "Vytváøím náhled" - -#: ../src/html/htmprint.cpp:491 -msgid " Preview" -msgstr " Náhled" - -#: ../src/html/htmprint.cpp:507 -msgid "There was a problem printing.\nPerhaps your current printer is not set correctly?" -msgstr "Pøi tisku se vyskytla chyba.\nMo¾ná máte ¹patnì nastavenou tiskárnu?" - -#: ../src/html/winpars.cpp:357 -msgid "Failed to display HTML document in %s encoding" -msgstr "Nelze zobrati HTML dokument v kódování %s" - -#: ../src/motif/app.cpp:584 -msgid "wxWindows could not open display for '%s': exiting." -msgstr "wxWindows nemohou otevøít displej pro '%s': ukonèuji." - -#: ../src/msw/app.cpp:726 -msgid "Unrecoverable program error detected: the application will terminate." -msgstr "Nastala chyba, z ní¾ se nelze zotavit: program bude ukonèen." - -#: ../src/msw/app.cpp:727 -msgid "Fatal Error" -msgstr "Fatální chyba" - -#: ../src/msw/app.cpp:1224 -#: ../src/os2/APP.CPP:904 -msgid "Fatal error: exiting" -msgstr "Fatální chyba: program se ukonèí" - -#: ../src/msw/clipbrd.cpp:539 -msgid "Failed to put data on the clipboard" -msgstr "Nepodaøilo se vlo¾it data do schránky" - -#: ../src/msw/clipbrd.cpp:623 -msgid "Failed to get data from the clipboard" -msgstr "Nelze získat data ze schránky" - -#: ../src/msw/clipbrd.cpp:652 -msgid "Failed to retrieve the supported clipboard formats" -msgstr "Nelze zjistit formáty podporované schránkou" - -#: ../src/msw/dde.cpp:285 -msgid "Failed to register DDE server '%s'" -msgstr "Nelze zaregistrovat DDE server '%s'" - -#: ../src/msw/dde.cpp:301 -msgid "Failed to unregister DDE server '%s'" -msgstr "Nelze odregistrovat DDE server '%s'" - -#: ../src/msw/dde.cpp:402 -msgid "Failed to create connection to server '%s' on topic '%s'" -msgstr "Nelze navázat spojení se server '%s' na téma '%s'" - -#: ../src/msw/dde.cpp:587 -msgid "DDE poke request failed" -msgstr "Po¾adavek na DDE poke selhal" - -#: ../src/msw/dde.cpp:606 -msgid "Failed to establish an advise loop with DDE server" -msgstr "Nelze navázat 'advise loop' s DDE serverem" - -#: ../src/msw/dde.cpp:625 -msgid "Failed to terminate the advise loop with DDE server" -msgstr "Nelze ukonèit 'advise loop' s DDE serverem" - -#: ../src/msw/dde.cpp:651 -msgid "Failed to send DDE advise notification" -msgstr "Nepodaøilo se poslat DDE advise notifikaci" - -#: ../src/msw/dde.cpp:924 -msgid "Failed to create DDE string" -msgstr "Nelze vytvoøit DDE øe»ezec" - -#: ../src/msw/dde.cpp:962 -msgid "no DDE error." -msgstr "¾ádná chyba DDE." - -#: ../src/msw/dde.cpp:966 -msgid "a request for a synchronous advise transaction has timed out." -msgstr "po¾adavek na synchronní advise transakci vypr¹el." - -#: ../src/msw/dde.cpp:969 -msgid "the response to the transaction caused the DDE_FBUSY bit to be set." -msgstr "odpovìï na transakci zpùsobila nastavení bitu DDE_FBUSY." - -#: ../src/msw/dde.cpp:972 -msgid "a request for a synchronous data transaction has timed out." -msgstr "po¾adavek na synchronní datovou transakci vypr¹el." - -#: ../src/msw/dde.cpp:975 -msgid "a DDEML function was called without first calling the DdeInitialize function,\n\ror an invalid instance identifier\n\rwas passed to a DDEML function." -msgstr "DDEML funkce byla zavolána bez pøedchozího volání DdeInitialize,\n\rnebo byl do DDEML funkce\n\rpøedán neplatný identifikátor instance." - -#: ../src/msw/dde.cpp:978 -msgid "an application initialized as APPCLASS_MONITOR has\n\rattempted to perform a DDE transaction,\n\ror an application initialized as APPCMD_CLIENTONLY has \n\rattempted to perform server transactions." -msgstr "aplikace iniciovaná jako APPCLASS_MONITOR se\n\rpokusila provést DDE transakci,\n\rnebo se aplikace iniciovaná jako APPCMD_CLIENTONLY pokusila\n\rprovést serverové transakce." - -#: ../src/msw/dde.cpp:981 -msgid "a request for a synchronous execute transaction has timed out." -msgstr "po¾adavek na synchronní execute transakci vypr¹el." - -#: ../src/msw/dde.cpp:984 -msgid "a parameter failed to be validated by the DDEML." -msgstr "nepodaøilo se ovìøit parametr pomocí DDEML." - -#: ../src/msw/dde.cpp:987 -msgid "a DDEML application has created a prolonged race condition." -msgstr "DDEML aplikace zpùsobila prodlou¾enou vzácnou podmínku." - -#: ../src/msw/dde.cpp:990 -msgid "a memory allocation failed." -msgstr "selhala alokace pamìti." - -#: ../src/msw/dde.cpp:993 -msgid "a client's attempt to establish a conversation has failed." -msgstr "clientùv pokus navázat konverzaci selhal." - -#: ../src/msw/dde.cpp:996 -msgid "a transaction failed." -msgstr "transakce neuspìla." - -#: ../src/msw/dde.cpp:999 -msgid "a request for a synchronous poke transaction has timed out." -msgstr "po¾adavek na synchronní poke transakci vypr¹el." - -#: ../src/msw/dde.cpp:1002 -msgid "an internal call to the PostMessage function has failed. " -msgstr "interní volání PostMessage selhalo." - -#: ../src/msw/dde.cpp:1005 -msgid "reentrancy problem." -msgstr "problém reentrance." - -#: ../src/msw/dde.cpp:1008 -msgid "a server-side transaction was attempted on a conversation\n\rthat was terminated by the client, or the server\n\rterminated before completing a transaction." -msgstr "bìhem konverzace pøeru¹ené klientem do¹lo k pokusu o \n\rserverovou transakci, nebo se server ukonèil\n\rpøed dokonèením transakce." - -#: ../src/msw/dde.cpp:1011 -msgid "an internal error has occurred in the DDEML." -msgstr "nastala interní chyba v DDEML." - -#: ../src/msw/dde.cpp:1014 -msgid "a request to end an advise transaction has timed out." -msgstr "po¾adavek na ukonèení advise transakce vypr¹el." - -#: ../src/msw/dde.cpp:1017 -msgid "an invalid transaction identifier was passed to a DDEML function.\n\rOnce the application has returned from an XTYP_XACT_COMPLETE callback,\n\rthe transaction identifier for that callback is no longer valid." -msgstr "DDEML funkce dostala neplatný identifikátor transakce.\n\rJakmile se aplikace vrátí z XTYP_XACT_COMPLETE callbacku,identifikátor transakce je u¾ neplatný." - -#: ../src/msw/dde.cpp:1020 -msgid "Unknown DDE error %08x" -msgstr "Neznámá chyba DDD: %08x" - -#: ../src/msw/dialog.cpp:177 -msgid "Failed to create dialog." -msgstr "Nelze vytvoøit dialog." - -#: ../src/msw/dialup.cpp:352 -msgid "Dial up functions are unavailable because the remote access service (RAS) is not installed on this machine. Please install it." -msgstr "Vytáèené pøipojení není dostupné, proto¾e Remote Access Service (RAS) není nainstalován. Prosím, nainstalujte ho." - -#: ../src/msw/dialup.cpp:415 -msgid "The version of remote access service (RAS) installed on this machine is too old, please upgrade (the following required function is missing: %s)." -msgstr "Verze Remote Access Service (RAS) na tomto poèítaèi je pøíli¹ stará, prosím upgradujte (chybí tato funkce: %s)." - -#: ../src/msw/dialup.cpp:459 -msgid "Failed to retrieve text of RAS error message" -msgstr "Nepodaøilo se získat text chybového hlá¹ení RAS" - -#: ../src/msw/dialup.cpp:462 -msgid "unknown error (error code %08x)." -msgstr "neznámá chyba (kód %08x)." - -#: ../src/msw/dialup.cpp:514 -msgid "Cannot find active dialup connection: %s" -msgstr "Nemohu nalézt aktivní vytáèené pøipojení: %s" - -#: ../src/msw/dialup.cpp:536 -msgid "Several active dialup connections found, choosing one randomly." -msgstr "Nalezeno nìkolik aktivních vytáèených pøipojení, vybírám jedno náhodnì." - -#: ../src/msw/dialup.cpp:636 -msgid "Failed to establish dialup connection: %s" -msgstr "Nepodaøilo se navázat vytáèené spojení: %s" - -#: ../src/msw/dialup.cpp:696 -msgid "Failed to get ISP names: %s" -msgstr "Nepodaøilo se získat jména ISP: %s" - -#: ../src/msw/dialup.cpp:743 -msgid "Failed to connect: no ISP to dial." -msgstr "Nelze se pøipojit: ¾ádný ISP." - -#: ../src/msw/dialup.cpp:763 -msgid "Choose ISP to dial" -msgstr "Vyberte ISP, ke kterému se má volat" - -#: ../src/msw/dialup.cpp:765 -msgid "Please choose which ISP do you want to connect to" -msgstr "Prosím vyberte si poskytovatele (ISP), ke kterému se chcete pøipojit" - -#: ../src/msw/dialup.cpp:798 -msgid "Failed to connect: missing username/password." -msgstr "Nepodaøilo se pøipojit: chybí u¾ivatelské jméno nebo heslo." - -#: ../src/msw/dialup.cpp:829 -msgid "Cannot find the location of address book file" -msgstr "Nemohu najít umístìní adresáøe" - -#: ../src/msw/dialup.cpp:857 -msgid "Failed to %s dialup connection: %s" -msgstr "Nepodaøilo se %s pøipojení k Internetu: %s" - -#: ../src/msw/dialup.cpp:858 -msgid "initiate" -msgstr "inicializovat" - -#: ../src/msw/dialup.cpp:858 -msgid "establish" -msgstr "navázat" - -#: ../src/msw/dialup.cpp:922 -msgid "Cannot hang up - no active dialup connection." -msgstr "Nemohu zavìsit - ¾ádná aktivní vytáèená pøipojení." - -#: ../src/msw/dialup.cpp:930 -msgid "Failed to terminate the dialup connection: %s" -msgstr "Nelze ukonèit vytáèené spojení: %s" - -#: ../src/msw/dib.cpp:434 -msgid "Can't open file '%s'" -msgstr "Nemohu otevøít soubor '%s'" - -#: ../src/msw/listctrl.cpp:208 -msgid "Can't create list control window, check that comctl32.dll is installed." -msgstr "Nemohu vytvoøit ovládací prvek list, zkontrolujte, jestli máte nainstalovanou comctl32.dll." - -#: ../src/msw/mdi.cpp:402 -#: ../src/os2/MDI.CPP:336 -msgid "Failed to create MDI parent frame." -msgstr "Nepodaøilo se vytvoøit rodièovské MDI okno." - -#: ../src/msw/registry.cpp:342 -msgid "Can't get info about registry key '%s'" -msgstr "Nemohu získat informace o registrovém klíèi '%s'" - -#: ../src/msw/registry.cpp:368 -msgid "Can't open registry key '%s'" -msgstr "Nemohu otevøít registrový klíè '%s'" - -#: ../src/msw/registry.cpp:393 -msgid "Can't create registry key '%s'" -msgstr "Nemohu vytvoøit registrový klíè '%s'" - -#: ../src/msw/registry.cpp:410 -msgid "Can't close registry key '%s'" -msgstr "Nemohu zavøít registrový klíè '%s'" - -#: ../src/msw/registry.cpp:428 -msgid "Registry value '%s' already exists." -msgstr "Registrový klíè '%s' u¾ existuje." - -#: ../src/msw/registry.cpp:436 -msgid "Failed to rename registry value '%s' to '%s'." -msgstr "Nelze pøejmenovat registrový klíè '%s' na '%s'." - -#: ../src/msw/registry.cpp:486 -msgid "Can't copy values of unsupported type %d." -msgstr "Nemohu kopírovat hodnoty nepodporovaného typu %d" - -#: ../src/msw/registry.cpp:497 -msgid "Registry key '%s' does not exist, cannot rename it." -msgstr "Registrový klíè '%s' neexistuje, nemohu ho pøejmenovat." - -#: ../src/msw/registry.cpp:528 -msgid "Registry key '%s' already exists." -msgstr "Registrový klíè '%s' u¾ existuje." - -#: ../src/msw/registry.cpp:536 -msgid "Failed to rename the registry key '%s' to '%s'." -msgstr "Nelze pøejmenovat registrový klíè '%s' na '%s'." - -#: ../src/msw/registry.cpp:590 -msgid "Failed to copy registry value '%s'" -msgstr "Nelze zkopírovat hodnotu registru '%s'" - -#: ../src/msw/registry.cpp:600 -msgid "Failed to copy the contents of registry key '%s' to '%s'." -msgstr "Nelze zkopírovat obsah registrového klíèe '%s' do '%s'." - -#: ../src/msw/registry.cpp:656 -msgid "Can't delete key '%s'" -msgstr "Nemohu smazat klíè '%s'" - -#: ../src/msw/registry.cpp:681 -msgid "Can't delete value '%s' from key '%s'" -msgstr "Nemohu smazat hodnotu '%s' z klíèe '%s'" - -#: ../src/msw/registry.cpp:692 -msgid "Can't delete value of key '%s'" -msgstr "Nemohu smazat hodnotu klíèe '%s'" - -#: ../src/msw/registry.cpp:770 -#: ../src/msw/registry.cpp:809 -msgid "Can't read value of key '%s'" -msgstr "Nemohu naèíst hodnotu klíèe '%s'" - -#: ../src/msw/registry.cpp:795 -#: ../src/msw/registry.cpp:895 -msgid "Can't set value of '%s'" -msgstr "Nemohu nastavit hodnotu '%s'" - -#: ../src/msw/registry.cpp:871 -msgid "Can't read value of '%s'" -msgstr "Nemohu pøeèíst hodnotu '%s'" - -#: ../src/msw/registry.cpp:947 -msgid "Can't enumerate values of key '%s'" -msgstr "Nemohu vyjmenovat hodnoty klíèe '%s'" - -#: ../src/msw/registry.cpp:992 -msgid "Can't enumerate subkeys of key '%s'" -msgstr "Nemohu vyjmenovat podklíèe klíèe '%s'" - -#: ../src/msw/statbr95.cpp:121 -msgid "Failed to create a status bar." -msgstr "Nelze vytvoøit status bar." - -#: ../src/msw/textctrl.cpp:217 -msgid "Impossible to create a rich edit control, using simple text control instead. Please reinstall riched32.dll" -msgstr "Není mo¾né vytvoøit rich edit prvek, pou¾iji obyèejný. Pøeinstalujte prosím riched32.dll." - -#: ../src/msw/textctrl.cpp:1126 -msgid "Could not load Rich Edit DLL '%s'" -msgstr "Nemohu naèíst Rich Edit DLL '%s'" - -#: ../src/msw/thread.cpp:124 -msgid "Can not create mutex" -msgstr "Nemohu vytvoøit mutex." - -#: ../src/msw/utils.cpp:497 -msgid "Win32s on Windows 3.1" -msgstr "Win32s na Windows 3.1" - -#: ../src/msw/utils.cpp:501 -msgid "Windows 9%c" -msgstr "Windows 9%c" - -#: ../src/msw/utils.cpp:529 -msgid "Windows 3.1" -msgstr "Windows 3.1" - -#: ../src/msw/utilsexc.cpp:425 -msgid "Can't create the inter-process read pipe" -msgstr "Nemohu vytvoøit meziprocesovou rouru pro ètení" - -#: ../src/msw/utilsexc.cpp:435 -msgid "Can't create the inter-process write pipe" -msgstr "Nemohu vytvoøit meziprocesovou rouru pro zápis" - -#: ../src/msw/utilsexc.cpp:594 -msgid "Couldn't launch DDE server '%s'." -msgstr "Nemohu spustit DDE server '%s'." - -#: ../src/msw/window.cpp:2331 -msgid "Can't find dummy dialog template!\nCheck resource include path for finding wx.rc." -msgstr "Nemohu najít dialogovou ¹ablonu dummy!\nOvìøte, jestli je správnì nastavená cesta k wx.rc." - -#: ../src/msw/window.cpp:2378 -msgid "Can't create window of class %s!\nPossible Windows 3.x compatibility problem?" -msgstr "Nemohu vytvoøit okno tøídy %s!\nMo¾ná se jedná o problém kompatibility Windows 3.x?" - -#: ../src/msw/ole/dataobj.cpp:151 -msgid "Couldn't register clipboard format '%s'." -msgstr "Nemohu zaregistrovat formát schránky '%s'." - -#: ../src/msw/ole/dataobj.cpp:169 -msgid "The clipboard format '%d' doesn't exist." -msgstr "Formát schránky '%d' neexistuje." - -#: ../src/os2/CLIPBRD.CPP:137 -msgid "Failed to allocate %dKb of memory for clipboard transfer." -msgstr "Nepodaøilo se alokovat %dKb pamìti pro schránku." - -#: ../src/os2/CLIPBRD.CPP:151 -msgid "Failed to set clipboard data in format %s" -msgstr "Nepodaøilo se vlo¾it data ve formátu %s do schránky." - -#: ../src/os2/THREAD.CPP:175 -msgid "Can not create event semaphore." -msgstr "Nemohu vytvoøit semafor pro události." - -#: ../src/os2/THREAD.CPP:444 -#: ../src/os2/THREAD.CPP:457 -msgid "Can not suspend thread %lu" -msgstr "Nemohu pozastavit vlákno %lu." - -#: ../src/os2/UTILSEXC.CPP:175 -msgid "Execution of command '%s' failed with error: %ul" -msgstr "Chyba pøi vykonávání pøíkazu '%s': %ul" - -#: ../src/unix/dialup.cpp:336 -msgid "Already dialling ISP." -msgstr "U¾ vytáèím." - -#: ../src/unix/threadpsx.cpp:588 -msgid "Cannot start thread: error writing TLS" -msgstr "Nemohu spustit vlákno: chyba zápisu TLS" - -#: ../src/unix/threadpsx.cpp:755 -msgid "Failed to join a thread, potential memory leak detected - please restart the program" -msgstr "Nemohu pøipojit vlákno, zji¹tìna mo¾ná chybná alokace pamìti - restartujte prosím program" - -#: ../src/unix/threadpsx.cpp:935 -msgid "Cannot retrieve thread scheduling policy." -msgstr "Nemohu obnovit plánovací politiku vlákna." - -#: ../src/unix/threadpsx.cpp:954 -msgid "Cannot get priority range for scheduling policy %d." -msgstr "Nemohu zjistit rozsah priorit pro plánovací politiku %d." - -#: ../src/unix/threadpsx.cpp:962 -msgid "Thread priority setting is ignored." -msgstr "Nastavení priority vlákna je ignorováno." - -#: ../src/unix/threadpsx.cpp:1441 -msgid "Thread module initialization failed: failed to create thread key" -msgstr "Selhala inicializace modulu s vlákny: nelze vytvoøit klíè" - -#: ../src/unix/utilsunx.cpp:263 -#: ../src/unix/utilsunx.cpp:599 -msgid "Waiting for subprocess termination failed" -msgstr "Èekání na ukonèení podprocesu selhalo" - -#: ../src/unix/utilsunx.cpp:343 -msgid "Impossible to get child process input" -msgstr "Není mo¾né získat vstup synovského procesu" - -#: ../src/unix/utilsunx.cpp:430 -#: ../src/unix/utilsunx.cpp:454 -msgid "Failed to execute '%s'\n" -msgstr "Nepodaøilo se spustit '%s'\n" - -#: ../src/unix/utilsunx.cpp:524 -msgid "Failed to redirect child process input/output" -msgstr "Nepodaøilo se pøesmìrovat vstup/výstup synovského procesu" - -#: ../src/unix/utilsunx.cpp:691 -msgid "Cannot get the hostname" -msgstr "Nemohu zjistit jméno poèítaèe" - -#: ../src/unix/utilsunx.cpp:727 -msgid "Cannot get the official hostname" -msgstr "Nemohu zjistit oficiální jméno poèítaèe" - -#: ../src/unix/utilsunx.cpp:803 -#: ../src/unix/utilsunx.cpp:811 -msgid "Error " -msgstr "Chyba" - -#: ../src/html/helpfrm.cpp:1152 -msgid "Cannot print empty page." -msgstr "Nemohu tisknout prázdnou stránku." - -#: ../src/html/htmprint.cpp:272 -msgid ": file does not exist!" -msgstr ": soubor neexistuje!" - -#: ../src/common/imaggif.cpp:58 -msgid "GIF: error in GIF image format." -msgstr "GIF: chyba ve formátu GIF obrázku." - -#: ../src/common/imaggif.cpp:61 -msgid "GIF: not enough memory." -msgstr "GIF: nedostatek pamìti." - -#: ../src/common/imaggif.cpp:64 -msgid "GIF: unknown error!!!" -msgstr "GIF: neznámá chyba!!!" - -#: ../src/common/imaggif.cpp:74 -msgid "GIF: data stream seems to be truncated." -msgstr "GIF: datový proud je useknutý pøed koncem." - -#: ../src/common/imagpcx.cpp:447 -msgid "PCX: image format unsupported" -msgstr "PCX: nepodporovaný formát obrázku" - -#: ../src/common/imagpcx.cpp:448 -#: ../src/common/imagpcx.cpp:471 -msgid "PCX: couldn't allocate memory" -msgstr "PCX: nemohu alokovat pamì»" - -#: ../src/common/imagpcx.cpp:449 -msgid "PCX: version number too low" -msgstr "PCX: èíslo verze je pøíli¹ malé" - -#: ../src/common/imagpcx.cpp:450 -#: ../src/common/imagpcx.cpp:472 -msgid "PCX: unknown error !!!" -msgstr "PCX: neznámá chyba !!!" - -#: ../src/common/imagpcx.cpp:470 -msgid "PCX: invalid image" -msgstr "PCX: po¹kozený obrázek" +#~ msgid "Baltic II (ISO-8859-10)" +#~ msgstr "Baltské II (ISO-8859-10)" +#~ msgid "ISO-8859-13" +#~ msgstr "ISO-8859-13" diff --git a/locale/da.po b/locale/da.po new file mode 100644 index 0000000000..63cbfa71c1 --- /dev/null +++ b/locale/da.po @@ -0,0 +1,2991 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: wxWindows v2.1beta\n" +"POT-Creation-Date: 2000-04-13 16:08+0930\n" +"PO-Revision-Date: 1999-10-23 12:30+0100\n" +"Last-Translator: Leif Jensen <leif@danmos.dk>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso8859-1\n" +"Content-Transfer-Encoding: 8 bit\n" + +#: ../src/generic/dirdlgg.cpp:550 +msgid "" +"\n" +"(Do you have the required permissions?)" +msgstr "" +"\n" +"(Har du de nødvendige tilladelser?)" + +#: ../src/generic/dirdlgg.cpp:537 +msgid "" +"\n" +"does not exist\n" +"Create it now?" +msgstr "" +"\n" +"eksisterer ikke\n" +"Opret den nu?" + +#: ../src/common/log.cpp:238 +#, c-format +msgid " (error %ld: %s)" +msgstr " (fejl %ld: %s)" + +#: ../src/common/docview.cpp:1195 +msgid " - " +msgstr "" + +#: ../src/html/htmprint.cpp:491 +#, fuzzy +msgid " Preview" +msgstr "Udskriftsmugkig" + +#: ../src/generic/filedlgg.cpp:328 +msgid " bytes " +msgstr "" + +#: ../src/common/resourc2.cpp:265 ../src/common/resourc2.cpp:1334 +#: ../src/common/resource.cpp:1765 ../src/common/resource.cpp:1895 +#: ../src/common/resource.cpp:2975 +#, c-format +msgid "#define %s must be an integer." +msgstr "#define %s skal være et heltal" + +#: ../src/html/helpfrm.cpp:718 ../src/html/helpfrm.cpp:719 +#: ../src/html/helpfrm.cpp:1277 ../src/html/helpfrm.cpp:1304 +#, c-format +msgid "%i of %i" +msgstr "" + +#: ../src/common/cmdline.cpp:727 +#, fuzzy, c-format +msgid "%s (or %s)" +msgstr " (fejl %ld: %s)" + +#: ../src/common/resourc2.cpp:709 ../src/common/resource.cpp:2346 +#, c-format +msgid "%s not a bitmap resource specification." +msgstr "%s er ikke en bitmap resource specifikation" + +#: ../src/common/resourc2.cpp:864 ../src/common/resource.cpp:2501 +#, c-format +msgid "%s not an icon resource specification." +msgstr "%s er ikke en icon resource specifikation" + +#: ../src/common/resourc2.cpp:357 ../src/common/resourc2.cpp:1430 +#: ../src/common/resource.cpp:1858 ../src/common/resource.cpp:1987 +#: ../src/common/resource.cpp:3072 +#, c-format +msgid "%s: ill-formed resource file syntax." +msgstr "%s: forkert resourcefil syntax." + +#: ../src/generic/logg.cpp:446 ../src/generic/tipdlg.cpp:170 +msgid "&Close" +msgstr "&Luk" + +#: ../src/generic/logg.cpp:681 +msgid "&Details" +msgstr "" + +#: ../src/generic/wizard.cpp:268 +msgid "&Finish" +msgstr "" + +#: ../src/generic/logg.cpp:447 +msgid "&Log" +msgstr "&Log" + +#: ../src/generic/wizard.cpp:171 ../src/generic/wizard.cpp:270 +#, fuzzy +msgid "&Next >" +msgstr "&Næste" + +#: ../src/generic/tipdlg.cpp:175 +#, fuzzy +msgid "&Next Tip" +msgstr "&Næste" + +#: ../src/common/docview.cpp:1891 ../src/common/docview.cpp:1902 +msgid "&Redo" +msgstr "&Gendan" + +#: ../src/common/docview.cpp:1885 ../src/common/docview.cpp:1912 +msgid "&Redo " +msgstr "&Gendan " + +#: ../src/generic/logg.cpp:442 +msgid "&Save..." +msgstr "&Gem..." + +#: ../src/generic/tipdlg.cpp:172 +msgid "&Show tips at startup" +msgstr "&Vis tips ved opstart" + +#: ../src/common/docview.cpp:1897 +msgid "&Undo" +msgstr "" + +#: ../src/common/docview.cpp:1872 +msgid "&Undo " +msgstr "&Reetablér" + +#: ../src/common/config.cpp:395 +#, c-format +msgid "'%s' has extra '..', ignored." +msgstr "'%s' har ekstra '..', ignoreret." + +#: ../src/common/valtext.cpp:140 +#, c-format +msgid "'%s' is invalid" +msgstr "'%s' er ugyldigt" + +#: ../src/common/cmdline.cpp:649 +#, c-format +msgid "'%s' is not a correct numeric value for option '%s'." +msgstr "" + +#: ../src/common/intl.cpp:387 +#, c-format +msgid "'%s' is not a valid message catalog." +msgstr "'%s' er ikke et lovligt meddelelseskatalog" + +#: ../src/common/textfile.cpp:250 +#, c-format +msgid "'%s' is probably a binary file." +msgstr "'%s' er sandsynligvis en binær fil." + +#: ../src/common/valtext.cpp:178 +#, c-format +msgid "'%s' should be numeric." +msgstr "'%s' skal være numerisk." + +#: ../src/common/valtext.cpp:160 +#, c-format +msgid "'%s' should only contain ASCII characters." +msgstr "'%s' må kun indeholde ASCII karakterer." + +#: ../src/common/valtext.cpp:166 +#, c-format +msgid "'%s' should only contain alphabetic characters." +msgstr "'%s' må kun indeholde bogstaver." + +#: ../src/common/valtext.cpp:172 +#, c-format +msgid "'%s' should only contain alphabetic or numeric characters." +msgstr "'%s' må kun indeholde bogstaver eller tal." + +#: ../src/html/helpfrm.cpp:679 +#, fuzzy +msgid "(Help)" +msgstr "Hjælp" + +#: ../src/html/helpfrm.cpp:276 ../src/html/helpfrm.cpp:783 +#: ../src/html/helpfrm.cpp:1330 +msgid "(bookmarks)" +msgstr "" + +#: ../src/common/resourc2.cpp:297 ../src/common/resourc2.cpp:1370 +#: ../src/common/resource.cpp:1797 ../src/common/resource.cpp:1927 +#: ../src/common/resource.cpp:3011 +msgid "" +", expected static, #include or #define\n" +"whilst parsing resource." +msgstr "" +", forventet static, #include eller #define\n" +"under parsing af resource." + +#: ../src/generic/dirdlgg.cpp:264 ../src/generic/filedlgg.cpp:710 +msgid "." +msgstr "" + +#: ../src/generic/dirdlgg.cpp:265 ../src/generic/filedlgg.cpp:711 +msgid ".." +msgstr "" + +#: ../src/html/htmprint.cpp:272 +#, fuzzy +msgid ": file does not exist!" +msgstr "Bibliotek eksisterer ikke" + +#: ../src/common/fontmap.cpp:459 +msgid ": unknown charset" +msgstr "" + +#: ../src/common/fontmap.cpp:622 +#, fuzzy +msgid ": unknown encoding" +msgstr "ukendt søgeorigo" + +#: ../src/generic/wizard.cpp:168 +msgid "< &Back" +msgstr "" + +#: ../src/generic/filedlgg.cpp:356 +msgid "<DIR>" +msgstr "" + +#: ../src/generic/filedlgg.cpp:323 +msgid "<DIR> " +msgstr "" + +#: ../src/generic/filedlgg.cpp:357 +msgid "<LINK>" +msgstr "" + +#: ../src/generic/filedlgg.cpp:324 +msgid "<LINK> " +msgstr "" + +#: ../src/html/helpfrm.cpp:928 +msgid "" +"<html><body>Normal face<br>(and <u>underlined</u>. <i>Italic face.</i> " +"<b>Bold face.</b> <b><i>Bold italic face.</i></b><br><font size=-2>font size " +"-2</font><br><font size=-1>font size -1</font><br><font size=+0>font size " +"+0</font><br><font size=+1>font size +1</font><br><font size=+2>font size " +"+2</font><br><font size=+3>font size +3</font><br><font size=+4>font size " +"+4</font><br><p><tt>Fixed size face.<br> <b>bold</b> <i>italic</i> " +"<b><i>bold italic <u>underlined</u></i></b><br><font size=-2>font size " +"-2</font><br><font size=-1>font size -1</font><br><font size=+0>font size " +"+0</font><br><font size=+1>font size +1</font><br><font size=+2>font size " +"+2</font><br><font size=+3>font size +3</font><br><font size=+4>font size " +"+4</font></tt></body></html>" +msgstr "" + +#: ../src/generic/dcpsg.cpp:2467 +msgid "A4 sheet, 210 x 297 mm" +msgstr "A4 papir, 210 x 297 mm" + +#: ../src/generic/fontdlgg.cpp:325 +msgid "ABCDEFGabcdefg12345" +msgstr "ABCDEFGabcdefg12345" + +#: ../src/html/helpfrm.cpp:270 +msgid "Add current page to bookmarks" +msgstr "" + +#: ../src/generic/colrdlgg.cpp:264 +msgid "Add to custom colours" +msgstr "Tilføj til bruger farver" + +#: ../src/html/helpctrl.cpp:88 +#, c-format +msgid "Adding book %s" +msgstr "" + +#: ../src/generic/prntdlgg.cpp:163 +msgid "All" +msgstr "Alle" + +#: ../src/generic/filedlgg.cpp:822 +msgid "All files (*)|*" +msgstr "" + +#: ../src/unix/dialup.cpp:336 +msgid "Already dialling ISP." +msgstr "" + +#: ../src/generic/logg.cpp:486 +#, c-format +msgid "Append log to file '%s' (choosing [No] will overwrite it)?" +msgstr "Tilføj log til fil '%s' (valg af [Nej] vil overskrive den)?" + +#: ../src/common/fontmap.cpp:101 +msgid "Arabic (ISO-8859-6)" +msgstr "" + +#: ../src/common/imagbmp.cpp:271 +msgid "BMP: Cannot deal with 4bit encoded yet." +msgstr "" + +#: ../src/common/imagbmp.cpp:150 ../src/common/imagbmp.cpp:162 +#, fuzzy +msgid "BMP: Couldn't allocate memory." +msgstr "Kunne ikke oprette en timer" + +#: ../src/common/imagbmp.cpp:141 +msgid "BMP: Encoding doesn't match bitdepth." +msgstr "" + +#: ../src/common/imagbmp.cpp:104 +msgid "BMP: Image height > 32767 pixels for file." +msgstr "" + +#: ../src/common/imagbmp.cpp:98 +msgid "BMP: Image width > 32767 pixels for file." +msgstr "" + +#: ../src/common/imagbmp.cpp:118 +msgid "BMP: Unknown bitdepth in file." +msgstr "" + +#: ../src/common/imagbmp.cpp:127 +msgid "BMP: Unknown encoding in file." +msgstr "" + +#: ../src/generic/helpwxht.cpp:156 +#, fuzzy +msgid "Back" +msgstr "Tilbage" + +#: ../src/common/dlgcmn.cpp:133 +msgid "Backward" +msgstr "Tilbage" + +#: ../src/common/fontmap.cpp:99 +msgid "Baltic (ISO-8859-4)" +msgstr "" + +#: ../src/common/fontmap.cpp:105 +msgid "Baltic II (ISO-8859-10)" +msgstr "" + +#: ../src/common/resourc2.cpp:844 ../src/common/resource.cpp:2481 +#, c-format +msgid "Bitmap resource specification %s not found." +msgstr "Bitmap resourcespecifikation %s blev ikke fundet" + +#: ../src/generic/fontdlgg.cpp:217 +msgid "Bold" +msgstr "Fed" + +#: ../src/generic/prntdlgg.cpp:662 +msgid "Bottom margin (mm):" +msgstr "Bund margin (mm):" + +#: ../src/generic/logg.cpp:444 +msgid "C&lear" +msgstr "&Rens" + +#: ../src/mac/thread.cpp:179 ../src/msw/thread.cpp:222 +msgid "Can not create event object." +msgstr "Kan ikke oprette hændelsesobjekt." + +#: ../src/msw/thread.cpp:124 +#, fuzzy +msgid "Can not create mutex" +msgstr "Kan ikke oprette mutex." + +#: ../src/mac/thread.cpp:92 +msgid "Can not create mutex." +msgstr "Kan ikke oprette mutex." + +#: ../src/common/filefn.cpp:1271 ../src/msw/dir.cpp:294 +#: ../src/unix/dir.cpp:214 +#, c-format +msgid "Can not enumerate files in directory '%s'" +msgstr "Kan ikke nummerere filer i bibliotek '%s'" + +#: ../src/msw/thread.cpp:520 +#, c-format +msgid "Can not resume thread %x" +msgstr "Kan ikke genoptage tråd %x" + +#: ../src/msw/thread.cpp:402 +msgid "Can not start thread: error writing TLS." +msgstr "Kan ikke starte tråd: fejl ved skrivning af TLS." + +#: ../src/msw/thread.cpp:505 +#, c-format +msgid "Can not suspend thread %x" +msgstr "Kan ikke suspendere tråd %x" + +#: ../src/msw/thread.cpp:817 +msgid "Can not wait for thread termination" +msgstr "Kan ikke vente på trådafslutning" + +#: ../src/common/docview.cpp:1874 +msgid "Can't &Undo " +msgstr "Kan ikke &reetablere " + +#: ../src/common/image.cpp:715 +#, c-format +msgid "Can't check image format of file '%s': file does not exist." +msgstr "" + +#: ../src/msw/registry.cpp:410 +#, fuzzy, c-format +msgid "Can't close registry key '%s'" +msgstr "kan ikke lukke registry nøgle '%s'" + +#: ../src/msw/registry.cpp:486 +#, c-format +msgid "Can't copy values of unsupported type %d." +msgstr "" + +#: ../src/msw/listctrl.cpp:212 +msgid "Can't create list control window, check that comctl32.dll is installed." +msgstr "" + +#: ../src/msw/registry.cpp:393 +#, fuzzy, c-format +msgid "Can't create registry key '%s'" +msgstr "kan ikke oprette registry nøgle '%s'" + +#: ../src/msw/utilsexc.cpp:425 +#, fuzzy +msgid "Can't create the inter-process read pipe" +msgstr "Kan ikke danne tråd" + +#: ../src/msw/utilsexc.cpp:435 +msgid "Can't create the inter-process write pipe" +msgstr "" + +#: ../src/msw/thread.cpp:487 +msgid "Can't create thread" +msgstr "Kan ikke danne tråd" + +#: ../src/msw/window.cpp:2381 +#, c-format +msgid "" +"Can't create window of class %s!\n" +"Possible Windows 3.x compatibility problem?" +msgstr "" +"Kan ikke oprette vindue af klasse %s!\n" +"Muligvis Windows 3.x kompatibilitetsproblem?" + +#: ../src/msw/registry.cpp:653 +#, fuzzy, c-format +msgid "Can't delete key '%s'" +msgstr "kan ikke slette nøgle '%s'" + +#: ../src/msw/iniconf.cpp:474 +#, c-format +msgid "Can't delete the INI file '%s'" +msgstr "Kan ikke slette INI filen '%s'" + +#: ../src/msw/registry.cpp:678 +#, fuzzy, c-format +msgid "Can't delete value '%s' from key '%s'" +msgstr "kan ikke slette værdi '%s' fra nøgle '%s'" + +#: ../src/msw/registry.cpp:689 +#, fuzzy, c-format +msgid "Can't delete value of key '%s'" +msgstr "kan ikke slette værdi af nøgle '%s'" + +#: ../src/msw/registry.cpp:988 +#, fuzzy, c-format +msgid "Can't enumerate subkeys of key '%s'" +msgstr "kan ikke nummerere undernøgle af nøgle '%s'" + +#: ../src/msw/registry.cpp:943 +#, fuzzy, c-format +msgid "Can't enumerate values of key '%s'" +msgstr "kan ikke nummerere værdi af nøgle '%s'" + +#: ../src/msw/utilsexc.cpp:400 +#, c-format +msgid "Can't execute command '%s'" +msgstr "Kan ikke eksekvere kommandoen '%s'" + +#: ../src/common/ffile.cpp:234 +#, fuzzy, c-format +msgid "Can't find current position in file '%s'" +msgstr "kan ikke åbge brugerkonfigurationsfil '%s'." + +#: ../src/msw/window.cpp:2331 +msgid "" +"Can't find dummy dialog template!\n" +"Check resource include path for finding wx.rc." +msgstr "" +"Kan ikke finde dummy dialogskabelon!\n" +"Check resource include stien til at finde wx.rc." + +#: ../src/common/object.cpp:309 ../src/common/object.cpp:330 +#, c-format +msgid "Can't find the serialization object '%s' for the object '%s'." +msgstr "Kan ikke find serialisationsobjektet '%s' til objektet '%s'." + +#: ../src/msw/registry.cpp:342 +#, fuzzy, c-format +msgid "Can't get info about registry key '%s'" +msgstr "kan ikke gå information om registry nøgle '%s'" + +#: ../src/common/image.cpp:413 ../src/common/image.cpp:433 +#, c-format +msgid "Can't load image from file '%s': file does not exist." +msgstr "" + +#: ../src/common/object.cpp:302 +msgid "Can't load wxSerial dynamic library." +msgstr "Kan ikke load'e wxSerial dynamisk bibliotek" + +#: ../src/msw/dib.cpp:434 +#, fuzzy, c-format +msgid "Can't open file '%s'" +msgstr "kan ikke åbne filen '%s'" + +#: ../src/msw/registry.cpp:368 +#, fuzzy, c-format +msgid "Can't open registry key '%s'" +msgstr "kan ikke åbne registry nøgle '%s'" + +#: ../src/msw/registry.cpp:867 +#, fuzzy, c-format +msgid "Can't read value of '%s'" +msgstr "kan ikke læse værdien af '%s'" + +#: ../src/msw/registry.cpp:766 ../src/msw/registry.cpp:805 +#, fuzzy, c-format +msgid "Can't read value of key '%s'" +msgstr "kan ikke læse værdien af nøgle '%s'" + +#: ../src/generic/logg.cpp:533 +msgid "Can't save log contents to file." +msgstr "Kan ikke gemme log-indhold til fil." + +#: ../src/msw/thread.cpp:453 +msgid "Can't set thread priority" +msgstr "Kan ikke sætte trådprioritet" + +#: ../src/msw/registry.cpp:791 ../src/msw/registry.cpp:891 +#, fuzzy, c-format +msgid "Can't set value of '%s'" +msgstr "kan ikke sætte værdien af '%s'" + +#: ../src/common/dlgcmn.cpp:146 ../src/common/prntbase.cpp:107 +#: ../src/generic/dcpsg.cpp:2192 ../src/generic/dirdlgg.cpp:424 +#: ../src/generic/filedlgg.cpp:913 ../src/generic/fontdlgg.cpp:257 +#: ../src/generic/prntdlgg.cpp:468 ../src/generic/progdlgg.cpp:179 +#: ../src/generic/proplist.cpp:523 ../src/generic/wizard.cpp:174 +#: ../src/gtk/filedlg.cpp:164 ../src/gtk/fontdlg.cpp:178 +#: ../src/html/helpfrm.cpp:910 ../src/motif/msgdlg.cpp:178 +msgid "Cancel" +msgstr "Afbryd" + +#: ../src/msw/dialup.cpp:514 +#, c-format +msgid "Cannot find active dialup connection: %s" +msgstr "" + +#: ../src/msw/dialup.cpp:827 +msgid "Cannot find the location of address book file" +msgstr "" + +#: ../src/unix/threadpsx.cpp:954 +#, c-format +msgid "Cannot get priority range for scheduling policy %d." +msgstr "Kan ikke få prioritetsområde for afviklingsalgoritme %d." + +#: ../src/unix/utilsunx.cpp:692 +msgid "Cannot get the hostname" +msgstr "Kan ikke få host-navnet" + +#: ../src/unix/utilsunx.cpp:728 +msgid "Cannot get the official hostname" +msgstr "Kan ikke få det officielle host-navn" + +#: ../src/msw/dialup.cpp:920 +msgid "Cannot hang up - no active dialup connection." +msgstr "" + +#: ../src/msw/app.cpp:229 +msgid "Cannot initialize OLE" +msgstr "Kan ikke initialisere OLE" + +#: ../src/html/htmlfilt.cpp:146 +#, fuzzy, c-format +msgid "Cannot open HTML document: %s" +msgstr "Kan ikke åbne URL '%s'" + +#: ../src/html/helpdata.cpp:542 +#, fuzzy, c-format +msgid "Cannot open HTML help book: %s" +msgstr "Kan ikke åbne URL '%s'" + +#: ../src/generic/helpext.cpp:96 +#, c-format +msgid "Cannot open URL '%s'" +msgstr "Kan ikke åbne URL '%s'" + +#: ../src/html/helpdata.cpp:238 +#, fuzzy, c-format +msgid "Cannot open contents file: %s" +msgstr "Kan ikke åbne filen" + +#: ../src/generic/dcpsg.cpp:1541 +msgid "Cannot open file for PostScript printing!" +msgstr "Kan ikke åbne fil til PostScript udskrivning!" + +#: ../src/html/helpdata.cpp:253 +#, fuzzy, c-format +msgid "Cannot open index file: %s" +msgstr "Kan ikke åbne filen" + +#: ../src/html/helpfrm.cpp:1174 +#, fuzzy +msgid "Cannot print empty page." +msgstr "Kan ikke oprette mutex." + +#: ../src/unix/threadpsx.cpp:935 +msgid "Cannot retrieve thread scheduling policy." +msgstr "Kan ikke hente trådafviklingsalgoritme." + +#: ../src/unix/threadpsx.cpp:588 +msgid "Cannot start thread: error writing TLS" +msgstr "Kan ikke starte tråd: fejl ved skrivning af TLS" + +#: ../src/html/helpfrm.cpp:398 +msgid "Case sensitive" +msgstr "" + +#: ../src/common/fontmap.cpp:97 +msgid "Central European (ISO-8859-2/Latin 2)" +msgstr "" + +#: ../src/msw/dialup.cpp:762 +msgid "Choose ISP to dial" +msgstr "" + +#: ../src/gtk/fontdlg.cpp:159 +msgid "Choose font" +msgstr "" + +#: ../src/generic/logg.cpp:444 +msgid "Clear the log contents" +msgstr "Rens log indholdet" + +#: ../src/common/prntbase.cpp:357 ../src/generic/progdlgg.cpp:307 +#: ../src/generic/proplist.cpp:518 +msgid "Close" +msgstr "Luk" + +#: ../src/generic/logg.cpp:446 +msgid "Close this window" +msgstr "Luk dette vindue" + +#: ../src/common/fileconf.cpp:742 +#, c-format +msgid "Config entry name cannot start with '%c'." +msgstr "Konfigureringsindgangsnav kan ikke begynde med '%c'." + +#: ../src/generic/filedlgg.cpp:1074 ../src/gtk/filedlg.cpp:75 +msgid "Confirm" +msgstr "Bekræft" + +#: ../src/html/htmlwin.cpp:166 +#, fuzzy +msgid "Connecting..." +msgstr "Udskriver..." + +#: ../src/generic/helpxlp.cpp:240 +#, c-format +msgid "Connection to wxHelp timed out in %d seconds" +msgstr "Forbindelse til wxHelp havde timeout efter %d sekunder" + +#: ../src/generic/helpwxht.cpp:158 ../src/html/helpfrm.cpp:303 +#: ../src/html/helpfrm.cpp:312 +msgid "Contents" +msgstr "" + +#: ../src/generic/prntdlgg.cpp:196 +msgid "Copies:" +msgstr "Kopier:" + +#: ../src/common/resourc2.cpp:287 ../src/common/resource.cpp:1787 +#: ../src/common/resource.cpp:1917 +#, c-format +msgid "Could not find resource include file %s." +msgstr "Kunne ikke finde resource include file %s." + +#: ../src/generic/tabg.cpp:1042 +msgid "Could not find tab for id" +msgstr "Kunne ikke finde tab til id" + +#: ../src/msw/textctrl.cpp:1121 +#, fuzzy, c-format +msgid "Could not load Rich Edit DLL '%s'" +msgstr "Kunne ikke initialisere 'Rich Edit DLL'" + +#: ../src/common/resource.cpp:789 +#, c-format +msgid "" +"Could not resolve control class or id '%s'. Use (non-zero) integer instead\n" +" or provide #define (see manual for caveats)" +msgstr "" +"Kunne ikke opløse kontrolklass eller id '%d'. Brug (ikke-nul) heltal " +"istedet\n" +" eller angiv #define (se manualen for fenurligheder)" + +#: ../src/common/resource.cpp:1232 +#, c-format +msgid "" +"Could not resolve menu id '%s'. Use (non-zero) integer instead\n" +"or provide #define (see manual for caveats)" +msgstr "" +"Kunne ikke opløse meny-id '%s'. Brug (ikke-nul) heltal istedet\n" +"eller angiv #define (se manualen for fenurligheder)" + +#: ../src/common/prntbase.cpp:707 +msgid "Could not start document preview." +msgstr "Kunne ikke start dokument smugkig." + +#: ../src/generic/printps.cpp:200 ../src/msw/printwin.cpp:242 +msgid "Could not start printing." +msgstr "Kunne ikke starte udskrivning" + +#: ../src/common/wincmn.cpp:781 +msgid "Could not transfer data to window" +msgstr "Kunne ikke overføre data til vindue" + +#: ../src/msw/thread.cpp:166 +msgid "Couldn't acquire a mutex lock" +msgstr "Kunne ikke få en mutex-lås" + +#: ../src/msw/dragimag.cpp:142 ../src/msw/dragimag.cpp:179 +#: ../src/msw/imaglist.cpp:145 ../src/msw/imaglist.cpp:167 +#: ../src/msw/imaglist.cpp:180 +msgid "Couldn't add an image to the image list." +msgstr "Kunne ikek tilføje et billede til billedlisten." + +#: ../src/mac/thread.cpp:227 +msgid "Couldn't change the state of event object." +msgstr "Kunne ikke ændre tilstanden af hændelsesobjekt." + +#: ../src/msw/timer.cpp:96 +msgid "Couldn't create a timer" +msgstr "Kunne ikke oprette en timer" + +#: ../src/common/dynlib.cpp:299 +#, c-format +msgid "Couldn't find symbol '%s' in a dynamic library" +msgstr "Kunne ikke finde symbolet '%s' i et dynamisk bibliotek" + +#: ../src/msw/thread.cpp:540 +msgid "Couldn't get the current thread pointer" +msgstr "Kunne ikke få nuværende trådpegepind" + +#: ../src/msw/utilsexc.cpp:596 +#, c-format +msgid "Couldn't launch DDE server '%s'." +msgstr "" + +#: ../src/common/imagpng.cpp:245 +#, fuzzy +msgid "Couldn't load a PNG image - file is corrupted or not enough memory." +msgstr "Kunne ikke load'e et PNG billede - sandsynligvis er filen kurrupt." + +#: ../src/msw/ole/dataobj.cpp:151 +#, fuzzy, c-format +msgid "Couldn't register clipboard format '%s'." +msgstr "Kunne ikke skrive klippebordsdata i format %s" + +#: ../src/msw/thread.cpp:198 +msgid "Couldn't release a mutex" +msgstr "Kunne ikke frigive en mutex" + +#: ../src/msw/listctrl.cpp:612 +#, c-format +msgid "Couldn't retrieve information about list control item %d." +msgstr "Kunne ikke hente information om listekontorlenhed %d." + +#: ../src/msw/thread.cpp:904 +msgid "Couldn't terminate thread" +msgstr "Kunne ikke afslutte tråd" + +#: ../src/generic/dirdlgg.cpp:571 +#, fuzzy +msgid "Create directory" +msgstr "Opret nyt bibliotek" + +#: ../src/generic/filedlgg.cpp:880 +#, fuzzy +msgid "Create new directory" +msgstr "Opret nyt bibliotek" + +#: ../src/generic/filedlgg.cpp:887 +#, fuzzy +msgid "Current directory:" +msgstr "Biblioteket " + +#: ../src/common/fontmap.cpp:100 +msgid "Cyrillic (Latin 5)" +msgstr "" + +#: ../src/msw/dde.cpp:586 +#, fuzzy +msgid "DDE poke request failed" +msgstr "Røroprettelse fejlede" + +#: ../src/generic/filedlgg.cpp:535 +msgid "Date" +msgstr "" + +#: ../src/generic/fontdlgg.cpp:207 +msgid "Decorative" +msgstr "Dekorativt" + +#: ../src/msw/dialup.cpp:350 +msgid "" +"Dial up functions are unavailable because the remote access service (RAS) is " +"not installed on this machine. Please install it." +msgstr "" + +#: ../src/generic/tipdlg.cpp:177 +msgid "Did you know..." +msgstr "Vidste du..." + +#: ../src/common/filefn.cpp:1086 +#, c-format +msgid "Directory '%s' couldn't be created" +msgstr "Bibliotek '%s' kunne ikke oprettes" + +#: ../src/generic/dirdlgg.cpp:538 +msgid "Directory does not exist" +msgstr "Bibliotek eksisterer ikke" + +#: ../src/html/helpfrm.cpp:366 +msgid "" +"Display all index items that contain given substring. Search is case " +"insensitive." +msgstr "" + +#: ../src/html/helpfrm.cpp:535 +msgid "Display options dialog" +msgstr "" + +#: ../src/common/docview.cpp:431 +#, c-format +msgid "Do you want to save changes to document %s?" +msgstr "Ønsker du at gemme ændringer til dokument %s?" + +#: ../src/html/htmlwin.cpp:216 +msgid "Done" +msgstr "" + +#: ../src/generic/progdlgg.cpp:313 +msgid "Done." +msgstr "" + +#: ../src/generic/progdlgg.cpp:153 +msgid "Elapsed time : " +msgstr "" + +#: ../src/generic/helphtml.cpp:310 +msgid "Entries found" +msgstr "indgange blev fundet" + +#: ../src/common/config.cpp:348 +#, c-format +msgid "" +"Environment variables expansion failed: missing '%c' at position %d in '%s'." +msgstr "" +"Omegnsvariabelekspansion fejlede: manglende '%c' ved position %d i '%s'." + +#: ../src/generic/dcpsg.cpp:1541 ../src/generic/dirdlgg.cpp:268 +#: ../src/generic/dirdlgg.cpp:286 ../src/generic/dirdlgg.cpp:297 +#: ../src/generic/dirdlgg.cpp:604 ../src/generic/filedlgg.cpp:622 +#: ../src/generic/filedlgg.cpp:714 ../src/generic/filedlgg.cpp:728 +#: ../src/generic/filedlgg.cpp:741 ../src/generic/filedlgg.cpp:1040 +#: ../src/generic/filedlgg.cpp:1089 ../src/generic/helpxlp.cpp:241 +#: ../src/generic/logg.cpp:180 ../src/gtk/filedlg.cpp:83 +#: ../src/gtk/fontdlg.cpp:72 +msgid "Error" +msgstr "Fejl" + +#: ../src/unix/utilsunx.cpp:931 ../src/unix/utilsunx.cpp:939 +msgid "Error " +msgstr "Fejl " + +#: ../src/generic/dirdlgg.cpp:551 +msgid "Error creating directory" +msgstr "Fejl ved oprettelse af bibliotek" + +#: ../src/common/log.cpp:354 +msgid "Error: " +msgstr "Fejl: " + +#: ../src/common/fontmap.cpp:98 +msgid "Esperanto (ISO-8859-3)" +msgstr "" + +#: ../src/generic/progdlgg.cpp:160 +msgid "Estimated time : " +msgstr "" + +#: ../src/generic/dirdlgg.cpp:217 +msgid "Etcetera" +msgstr "og så videre" + +#: ../src/msw/utilsexc.cpp:484 +#, c-format +msgid "Execution of command '%s' failed" +msgstr "Afvikling af kommando '%s' fejlede" + +#: ../src/common/resourc2.cpp:326 ../src/common/resourc2.cpp:1399 +#: ../src/common/resource.cpp:1826 ../src/common/resource.cpp:1956 +#: ../src/common/resource.cpp:3040 +msgid "Expected '*' whilst parsing resource." +msgstr "Forventede '*' ved parsning af resource." + +#: ../src/common/resourc2.cpp:342 ../src/common/resourc2.cpp:1415 +#: ../src/common/resource.cpp:1843 ../src/common/resource.cpp:1972 +#: ../src/common/resource.cpp:3057 +msgid "Expected '=' whilst parsing resource." +msgstr "Forventede '=' ved parsning af resource." + +#: ../src/common/resourc2.cpp:312 ../src/common/resourc2.cpp:1385 +#: ../src/common/resource.cpp:1812 ../src/common/resource.cpp:1942 +#: ../src/common/resource.cpp:3026 +msgid "Expected 'char' whilst parsing resource." +msgstr "Forventede 'char' ved parsning af resource." + +#: ../src/msw/dialup.cpp:855 +#, c-format +msgid "Failed to %s dialup connection: %s" +msgstr "" + +#: ../src/msw/clipbrd.cpp:122 +msgid "Failed to close the clipboard." +msgstr "Kunne ikke lukke klippebordet." + +#: ../src/msw/dialup.cpp:796 +msgid "Failed to connect: missing username/password." +msgstr "" + +#: ../src/msw/dialup.cpp:742 +#, fuzzy +msgid "Failed to connect: no ISP to dial." +msgstr "Fejlede ved oprettelse af dialog." + +#: ../src/msw/registry.cpp:590 +#, fuzzy, c-format +msgid "Failed to copy registry value '%s'" +msgstr "kan ikke åbne registry nøgle '%s'" + +#: ../src/msw/registry.cpp:599 +#, c-format +msgid "Failed to copy the contents of registry key '%s' to '%s'." +msgstr "" + +#: ../src/msw/dde.cpp:923 +#, fuzzy +msgid "Failed to create DDE string" +msgstr "Fejlede ved oprettelse af dialog." + +#: ../src/msw/mdi.cpp:404 +msgid "Failed to create MDI parent frame." +msgstr "Kunne ikke oprette MDI forældreramme." + +#: ../src/msw/statbr95.cpp:149 +#, fuzzy +msgid "Failed to create a status bar." +msgstr "Kunne ikke oprette MDI forældreramme." + +#: ../src/msw/dde.cpp:401 +#, fuzzy, c-format +msgid "Failed to create connection to server '%s' on topic '%s'" +msgstr "Kunne ikke oprette tooltip '%s'" + +#: ../src/msw/dialog.cpp:177 +msgid "" +"Failed to create dialog. You probably forgot to include wx/msw/wx.rc in your " +"resources." +msgstr "" + +#: ../src/generic/dirdlgg.cpp:549 +msgid "Failed to create directory " +msgstr "Kunne ikke oprette bibliotek " + +#: ../src/html/winpars.cpp:357 +#, c-format +msgid "Failed to display HTML document in %s encoding" +msgstr "" + +#: ../src/msw/clipbrd.cpp:134 +msgid "Failed to empty the clipboard." +msgstr "Kunne ikke tømme klippebordet." + +#: ../src/msw/dde.cpp:605 +msgid "Failed to establish an advise loop with DDE server" +msgstr "" + +#: ../src/msw/dialup.cpp:635 +#, c-format +msgid "Failed to establish dialup connection: %s" +msgstr "" + +#: ../src/unix/utilsunx.cpp:431 ../src/unix/utilsunx.cpp:455 +#, fuzzy, c-format +msgid "Failed to execute '%s'\n" +msgstr "Kan ikke eksekvere '%s'\n" + +#: ../src/common/resourc2.cpp:808 ../src/common/resource.cpp:2445 +#, c-format +msgid "" +"Failed to find XBM resource %s.\n" +"Forgot to use wxResourceLoadBitmapData?" +msgstr "" +"Kunne ikke finde XBM resource %s.\n" +"Glemt at bruge wxResourceLoadBitmapData?" + +#: ../src/common/resourc2.cpp:963 ../src/common/resource.cpp:2600 +#, c-format +msgid "" +"Failed to find XBM resource %s.\n" +"Forgot to use wxResourceLoadIconData?" +msgstr "" +"Kunne ikke finde XBM resource %s.\n" +"Glemt at bruge wxResourceLoadIconData?" + +#: ../src/common/resourc2.cpp:824 ../src/common/resource.cpp:2461 +#, c-format +msgid "" +"Failed to find XPM resource %s.\n" +"Forgot to use wxResourceLoadBitmapData?" +msgstr "" +"Kunne ikke finde XPM resource %s.\n" +"Glemt at bruge wxResourceLoadBitmapData?" + +#: ../src/msw/dialup.cpp:695 +#, fuzzy, c-format +msgid "Failed to get ISP names: %s" +msgstr "Kunne ikke oprette MDI forældreramme." + +#: ../src/msw/clipbrd.cpp:623 +#, fuzzy +msgid "Failed to get data from the clipboard" +msgstr "Kunne ikke hente data fra klippebordet." + +#: ../src/common/timercmn.cpp:243 +msgid "Failed to get the UTC system time." +msgstr "" + +#: ../src/common/timercmn.cpp:195 +#, fuzzy +msgid "Failed to get the local system time" +msgstr "Kunne ikke oprette tooltip '%s'" + +#: ../src/unix/threadpsx.cpp:754 +msgid "" +"Failed to join a thread, potential memory leak detected - please restart the " +"program" +msgstr "" + +#: ../src/common/dynlib.cpp:229 +#, c-format +msgid "Failed to load shared library '%s'" +msgstr "Kunne ikke load'e delt bibliotek '%s'" + +#: ../src/msw/clipbrd.cpp:102 +msgid "Failed to open the clipboard." +msgstr "Kunne ikke åbne klippebordet." + +#: ../src/msw/clipbrd.cpp:539 +#, fuzzy +msgid "Failed to put data on the clipboard" +msgstr "Kunne ikke hente data fra klippebordet." + +#: ../src/unix/utilsunx.cpp:524 +msgid "Failed to redirect child process input/output" +msgstr "" + +#: ../src/msw/dde.cpp:285 +#, fuzzy, c-format +msgid "Failed to register DDE server '%s'" +msgstr "Kunne ikke oprette tooltip '%s'" + +#: ../src/common/fontmap.cpp:504 +#, fuzzy, c-format +msgid "Failed to remember the encoding for the charset '%s'." +msgstr "Kunne ikke oprette tooltip '%s'" + +#: ../src/msw/registry.cpp:436 +#, fuzzy, c-format +msgid "Failed to rename registry value '%s' to '%s'." +msgstr "Kunne ikke oprette tooltip '%s'" + +#: ../src/msw/registry.cpp:536 +#, fuzzy, c-format +msgid "Failed to rename the registry key '%s' to '%s'." +msgstr "kan ikke oprette registry nøgle '%s'" + +#: ../src/msw/clipbrd.cpp:428 +msgid "Failed to retrieve data from the clipboard." +msgstr "Kunne ikke hente data fra klippebordet." + +#: ../src/msw/dialup.cpp:459 +#, fuzzy +msgid "Failed to retrieve text of RAS error message" +msgstr "Kunne ikke hente data fra klippebordet." + +#: ../src/msw/clipbrd.cpp:652 +#, fuzzy +msgid "Failed to retrieve the supported clipboard formats" +msgstr "Kunne ikke hente data fra klippebordet." + +#: ../src/msw/dde.cpp:650 +msgid "Failed to send DDE advise notification" +msgstr "" + +#: ../src/msw/clipbrd.cpp:300 +msgid "Failed to set clipboard data." +msgstr "Kunne ikke skrive klippebordsdata." + +#: ../src/unix/threadpsx.cpp:1071 +#, c-format +msgid "Failed to set thread priority %d." +msgstr "Kunne ikke sætte trådprioritet %d." + +#: ../src/common/fs_mem.cpp:167 +#, c-format +msgid "Failed to store image '%s' to memory VFS!" +msgstr "" + +#: ../src/unix/threadpsx.cpp:1251 +msgid "Failed to terminate a thread." +msgstr "Kunne ikke afslutte en tråd." + +#: ../src/msw/dde.cpp:624 +#, fuzzy +msgid "Failed to terminate the advise loop with DDE server" +msgstr "Kunne ikke afslutte en tråd." + +#: ../src/msw/dialup.cpp:928 +#, fuzzy, c-format +msgid "Failed to terminate the dialup connection: %s" +msgstr "Kunne ikke afslutte en tråd." + +#: ../src/msw/dde.cpp:301 +#, fuzzy, c-format +msgid "Failed to unregister DDE server '%s'" +msgstr "Kunne ikke oprette tooltip '%s'" + +#: ../src/msw/app.cpp:749 +msgid "Fatal Error" +msgstr "Fatal fejl" + +#: ../src/generic/logg.cpp:340 +msgid "Fatal error" +msgstr "Fatal fejl" + +#: ../src/common/log.cpp:347 +msgid "Fatal error: " +msgstr "Fatal fejl: " + +#: ../src/msw/app.cpp:1237 +msgid "Fatal error: exiting" +msgstr "Fatal fejl: stopper" + +#: ../src/generic/filedlgg.cpp:1071 ../src/gtk/filedlg.cpp:72 +#, c-format +msgid "File '%s' already exists, do you really want to overwrite it?" +msgstr "Fil '%s' eksisterer allerede, vil du virkelig overskrive den?" + +#: ../src/common/textcmn.cpp:94 +#, fuzzy +msgid "File couldn't be loaded." +msgstr "Bibliotek '%s' kunne ikke oprettes" + +#: ../src/common/docview.cpp:287 ../src/common/docview.cpp:323 +msgid "File error" +msgstr "Fil fejl" + +#: ../src/generic/dirdlgg.cpp:286 ../src/generic/filedlgg.cpp:728 +msgid "File name exists already." +msgstr "" + +#: ../src/msw/filedlg.cpp:280 +#, c-format +msgid "Files (%s)|%s" +msgstr "Filer (%s)|%s" + +#: ../src/html/helpfrm.cpp:340 +#, fuzzy +msgid "Find" +msgstr "Fandt " + +#: ../src/html/helpfrm.cpp:889 +msgid "Fixed font:" +msgstr "" + +#: ../src/generic/fontdlgg.cpp:124 +msgid "Font" +msgstr "Font" + +#: ../src/html/helpfrm.cpp:899 +msgid "Font size:" +msgstr "" + +#: ../src/unix/utilsunx.cpp:481 +msgid "Fork failed" +msgstr "Gaffel fejlede ;-)" + +#: ../src/common/dlgcmn.cpp:130 ../src/generic/helpwxht.cpp:157 +msgid "Forward" +msgstr "Fremad" + +#: ../src/common/resourc2.cpp:295 ../src/common/resourc2.cpp:1368 +#: ../src/common/resource.cpp:1795 ../src/common/resource.cpp:1925 +#: ../src/common/resource.cpp:3009 +msgid "Found " +msgstr "Fandt " + +#: ../src/html/helpfrm.cpp:637 +#, c-format +msgid "Found %i matches" +msgstr "" + +#: ../src/generic/prntdlgg.cpp:187 +msgid "From:" +msgstr "Fra:" + +#: ../src/common/imaggif.cpp:74 +msgid "GIF: data stream seems to be truncated." +msgstr "" + +#: ../src/common/imaggif.cpp:58 +msgid "GIF: error in GIF image format." +msgstr "" + +#: ../src/common/imaggif.cpp:61 +msgid "GIF: not enough memory." +msgstr "" + +#: ../src/common/imaggif.cpp:64 +msgid "GIF: unknown error!!!" +msgstr "" + +#: ../src/html/helpfrm.cpp:501 +msgid "Go back" +msgstr "" + +#: ../src/html/helpfrm.cpp:504 +#, fuzzy +msgid "Go forward" +msgstr "Fremad" + +#: ../src/html/helpfrm.cpp:509 +msgid "Go one level up in document hierarchy" +msgstr "" + +#: ../src/generic/filedlgg.cpp:872 +#, fuzzy +msgid "Go to home directory" +msgstr "Biblioteket " + +#: ../src/generic/filedlgg.cpp:866 +#, fuzzy +msgid "Go to parent directory" +msgstr "Kunne ikke oprette bibliotek " + +#: ../src/common/fontmap.cpp:102 +msgid "Greek (ISO-8859-7)" +msgstr "" + +#: ../src/html/htmlwin.cpp:251 +#, fuzzy, c-format +msgid "HTML anchor %s does not exist." +msgstr "Bibliotek eksisterer ikke" + +#: ../src/html/helpfrm.cpp:1188 +msgid "" +"HTML files (*.htm)|*.htm|HTML files (*.html)|*.html|Help books " +"(*.htb)|*.htb|Help books (*.zip)|*.zip|HTML Help Project (*.hhp)|*.hhp|All " +"files (*.*)|*" +msgstr "" + +#: ../src/common/fontmap.cpp:103 +msgid "Hebrew (ISO-8859-8)" +msgstr "" + +#: ../src/common/dlgcmn.cpp:142 ../src/generic/proplist.cpp:528 +#: ../src/html/helpfrm.cpp:208 +msgid "Help" +msgstr "Hjælp" + +#: ../src/html/helpfrm.cpp:872 +msgid "Help Browser Options" +msgstr "" + +#: ../src/generic/helphtml.cpp:309 ../src/generic/helphtml.cpp:310 +msgid "Help Index" +msgstr "Hjælpeindex" + +#: ../src/html/helpfrm.cpp:1172 +#, fuzzy +msgid "Help Printing" +msgstr "Udskriver" + +#: ../src/generic/helpwxht.cpp:250 ../src/html/helpctrl.cpp:44 +#, fuzzy, c-format +msgid "Help: %s" +msgstr "Hjælp" + +#: ../src/common/fontmap.cpp:107 +msgid "ISO-8859-12" +msgstr "" + +#: ../src/common/fontmap.cpp:108 +msgid "ISO-8859-13" +msgstr "" + +#: ../src/common/fontmap.cpp:109 +msgid "ISO-8859-14" +msgstr "" + +#: ../src/common/resourc2.cpp:997 ../src/common/resourc2.cpp:1008 +#: ../src/common/resource.cpp:2634 ../src/common/resource.cpp:2645 +#, c-format +msgid "Icon resource specification %s not found." +msgstr "Ikonresource specifikation %s blev ikke fundet." + +#: ../src/common/resource.cpp:251 +msgid "Ill-formed resource file syntax." +msgstr "Forkert formateret resourcefil syntax." + +#: ../src/generic/dirdlgg.cpp:268 ../src/generic/filedlgg.cpp:714 +#, fuzzy +msgid "Illegal directory name." +msgstr "Biblioteket " + +#: ../src/generic/filedlgg.cpp:1040 +msgid "Illegal file specification." +msgstr "" + +#: ../src/msw/textctrl.cpp:216 +msgid "" +"Impossible to create a rich edit control, using simple text control instead. " +"Please reinstall riched32.dll" +msgstr "" + +#: ../src/unix/utilsunx.cpp:344 +msgid "Impossible to get child process input" +msgstr "" + +#: ../src/html/helpdata.cpp:288 +msgid "Incorrect version of HTML help book" +msgstr "" + +#: ../src/html/helpfrm.cpp:372 +#, fuzzy +msgid "Index" +msgstr "Hjælpeindex" + +#: ../src/generic/logg.cpp:182 +msgid "Information" +msgstr "Information" + +#: ../src/common/imagtiff.cpp:136 +msgid "Invalid TIFF image index." +msgstr "" + +#: ../src/generic/fontdlgg.cpp:213 +msgid "Italic" +msgstr "Kursiv" + +#: ../src/common/imagjpeg.cpp:198 +#, fuzzy +msgid "JPEG: Couldn't load - file is probably corrupted." +msgstr "Kunne ikke load'e et PNG billede - sandsynligvis er filen kurrupt." + +#: ../src/common/imagjpeg.cpp:315 +#, fuzzy +msgid "JPEG: Couldn't save image." +msgstr "Kunne ikke oprette en timer" + +#: ../src/common/fontmap.cpp:111 +msgid "KOI8-R" +msgstr "" + +#: ../src/generic/dcpsg.cpp:2183 ../src/generic/prntdlgg.cpp:441 +#: ../src/generic/prntdlgg.cpp:637 +msgid "Landscape" +msgstr "Liggende" + +#: ../src/generic/prntdlgg.cpp:649 +msgid "Left margin (mm):" +msgstr "Venstre margin (mm):" + +#: ../src/generic/fontdlgg.cpp:216 +msgid "Light" +msgstr "Let" + +#: ../src/generic/filedlgg.cpp:1267 ../src/gtk/filedlg.cpp:241 +#: ../src/motif/filedlg.cpp:351 ../src/msw/filedlg.cpp:438 +#, c-format +msgid "Load %s file" +msgstr "Load %s file" + +#: ../src/html/htmlwin.cpp:187 +#, fuzzy +msgid "Loading : " +msgstr "Advarsel: " + +#: ../src/common/imagpnm.cpp:72 +msgid "Loading Grey Ascii PNM image is not yet implemented." +msgstr "" + +#: ../src/common/imagpnm.cpp:75 +msgid "Loading Grey Raw PNM image is not yet implemented." +msgstr "" + +#: ../src/generic/logg.cpp:536 +#, c-format +msgid "Log saved to the file '%s'." +msgstr "Log gemt i filen '%s'." + +#: ../src/gtk/mdi.cpp:422 +msgid "MDI child" +msgstr "MDI barn" + +#: ../src/unix/mimetype.cpp:1541 +#, c-format +msgid "Mailcap file %s, line %d: incomplete entry ignored." +msgstr "Mailcap fil %s, linie %d: ufuldstændig indgang ignoreret." + +#: ../src/common/fs_mem.cpp:144 +#, c-format +msgid "Memory VFS already contains file '%s'!" +msgstr "" + +#: ../src/unix/mimetype.cpp:1261 +#, c-format +msgid "Mime.types file %s, line %d: unterminated quoted string." +msgstr "Mime.type fil %s, linie %d: uafsluttet streng." + +#: ../src/generic/fontdlgg.cpp:208 +msgid "Modern" +msgstr "Modern" + +#: ../src/common/dlgcmn.cpp:139 +msgid "More..." +msgstr "Mere..." + +#: ../src/generic/dirdlgg.cpp:213 +msgid "Mounted Devices" +msgstr "Monterede enheder" + +#: ../src/generic/dirdlgg.cpp:208 +msgid "My Harddisk" +msgstr "" + +#: ../src/generic/dirdlgg.cpp:212 +msgid "My Home" +msgstr "Mit hjem" + +#: ../src/generic/filedlgg.cpp:533 +#, fuzzy +msgid "Name" +msgstr "er " + +#: ../src/generic/dirdlgg.cpp:426 +msgid "New..." +msgstr "Ny..." + +#: ../src/generic/filedlgg.cpp:607 +msgid "NewName" +msgstr "" + +#: ../src/html/helpfrm.cpp:515 +msgid "Next page" +msgstr "" + +#: ../src/common/dlgcmn.cpp:109 ../src/common/dlgcmn.cpp:119 +#: ../src/motif/msgdlg.cpp:178 +msgid "No" +msgstr "Nej" + +#: ../src/common/resourc2.cpp:814 ../src/common/resourc2.cpp:969 +#: ../src/common/resource.cpp:2451 ../src/common/resource.cpp:2606 +msgid "No XBM facility available!" +msgstr "Ingen XBM facilitet tilgængelig!" + +#: ../src/common/resourc2.cpp:830 ../src/common/resource.cpp:2466 +msgid "No XPM facility available!" +msgstr "Ingen XPM facilitet tilgængelig!" + +#: ../src/common/resourc2.cpp:991 ../src/common/resource.cpp:2628 +msgid "No XPM icon facility available!" +msgstr "Ingen XPM ikonfacilitet tilgængelig!" + +#: ../src/generic/helphtml.cpp:304 +msgid "No entries found." +msgstr "Ingen indgange blev fundet." + +#: ../src/common/image.cpp:518 +msgid "No handler found for image type." +msgstr "" + +#: ../src/common/image.cpp:526 ../src/common/image.cpp:560 +#, c-format +msgid "No image handler for type %d defined." +msgstr "" + +#: ../src/common/image.cpp:544 ../src/common/image.cpp:576 +#, c-format +msgid "No image handler for type %s defined." +msgstr "" + +#: ../src/html/helpfrm.cpp:628 +msgid "No matching page found yet" +msgstr "" + +#: ../src/generic/fontdlgg.cpp:212 ../src/generic/fontdlgg.cpp:215 +msgid "Normal" +msgstr "Normal" + +#: ../src/html/helpfrm.cpp:881 +#, fuzzy +msgid "Normal font:" +msgstr "Normal" + +#: ../src/common/dlgcmn.cpp:125 ../src/generic/dcpsg.cpp:2191 +#: ../src/generic/dirdlgg.cpp:422 ../src/generic/filedlgg.cpp:904 +#: ../src/generic/fontdlgg.cpp:256 ../src/generic/logg.cpp:714 +#: ../src/generic/prntdlgg.cpp:467 ../src/generic/proplist.cpp:511 +#: ../src/gtk/filedlg.cpp:158 ../src/gtk/fontdlg.cpp:172 +#: ../src/html/helpfrm.cpp:909 +msgid "OK" +msgstr "OK" + +#: ../src/html/helpfrm.cpp:523 ../src/html/helpfrm.cpp:1183 +msgid "Open HTML document" +msgstr "" + +#: ../src/generic/dirdlgg.cpp:297 ../src/generic/dirdlgg.cpp:604 +#: ../src/generic/filedlgg.cpp:622 ../src/generic/filedlgg.cpp:741 +msgid "Operation not permitted." +msgstr "" + +#: ../src/common/cmdline.cpp:590 +#, fuzzy, c-format +msgid "Option '%s' requires a value, '=' expected." +msgstr "fil '%s', linie %d: '=' forventet." + +#: ../src/common/cmdline.cpp:609 +#, c-format +msgid "Option '%s' requires a value." +msgstr "" + +#: ../src/common/cmdline.cpp:663 +#, c-format +msgid "Option '%s': '%s' cannot be converted to a date." +msgstr "" + +#: ../src/generic/prntdlgg.cpp:447 +msgid "Options" +msgstr "Valgmuligheder" + +#: ../src/generic/prntdlgg.cpp:443 ../src/generic/prntdlgg.cpp:638 +msgid "Orientation" +msgstr "Orientering" + +#: ../src/common/imagpcx.cpp:448 ../src/common/imagpcx.cpp:471 +#, fuzzy +msgid "PCX: couldn't allocate memory" +msgstr "Kunne ikke oprette en timer" + +#: ../src/common/imagpcx.cpp:447 +msgid "PCX: image format unsupported" +msgstr "" + +#: ../src/common/imagpcx.cpp:470 +#, fuzzy +msgid "PCX: invalid image" +msgstr "ugyldig dato" + +#: ../src/common/imagpcx.cpp:434 +msgid "PCX: this is not a PCX file." +msgstr "" + +#: ../src/common/imagpcx.cpp:450 ../src/common/imagpcx.cpp:472 +msgid "PCX: unknown error !!!" +msgstr "" + +#: ../src/common/imagpcx.cpp:449 +msgid "PCX: version number too low" +msgstr "" + +#: ../src/common/imagpnm.cpp:96 +#, fuzzy +msgid "PNM: Couldn't allocate memory." +msgstr "Kunne ikke oprette en timer" + +#: ../src/common/imagpnm.cpp:80 +msgid "PNM: File format is not recognized." +msgstr "" + +#: ../src/common/imagpnm.cpp:112 +msgid "PNM: File seems truncated." +msgstr "" + +#: ../src/common/prntbase.cpp:727 +#, c-format +msgid "Page %d" +msgstr "Side %d" + +#: ../src/common/prntbase.cpp:725 +#, c-format +msgid "Page %d of %d" +msgstr "Side %d af %d" + +#: ../src/generic/prntdlgg.cpp:604 +msgid "Page Setup" +msgstr "Sideopsætning" + +#: ../src/generic/prntdlgg.cpp:164 +msgid "Pages" +msgstr "Sider" + +#: ../src/generic/prntdlgg.cpp:555 ../src/generic/prntdlgg.cpp:626 +#: ../src/generic/prntdlgg.cpp:808 +#, fuzzy +msgid "Paper Size" +msgstr "Side størrelse" + +#: ../src/generic/prntdlgg.cpp:433 ../src/generic/prntdlgg.cpp:615 +#: ../src/generic/prntdlgg.cpp:804 +msgid "Paper size" +msgstr "Side størrelse" + +#: ../src/generic/filedlgg.cpp:537 +msgid "Permissions" +msgstr "" + +#: ../src/unix/utilsunx.cpp:430 ../src/unix/utilsunx.cpp:454 +msgid "Pipe creation failed" +msgstr "Røroprettelse fejlede" + +#: ../src/gtk/fontdlg.cpp:72 +#, fuzzy +msgid "Please choose a valid font." +msgstr "Vælg venligst en eksisterende fil." + +#: ../src/generic/filedlgg.cpp:1089 ../src/gtk/filedlg.cpp:83 +msgid "Please choose an existing file." +msgstr "Vælg venligst en eksisterende fil." + +#: ../src/msw/dialup.cpp:763 +msgid "Please choose which ISP do you want to connect to" +msgstr "" + +#: ../src/common/prntbase.cpp:105 +msgid "Please wait..." +msgstr "Vent venligst..." + +#: ../src/generic/dcpsg.cpp:2182 ../src/generic/prntdlgg.cpp:440 +#: ../src/generic/prntdlgg.cpp:636 +msgid "Portrait" +msgstr "Opretstående" + +#: ../src/generic/dcpsg.cpp:377 +msgid "PostScript" +msgstr "EfterSkrift ;-)" + +#: ../src/generic/prntdlgg.cpp:272 +msgid "PostScript file" +msgstr "PostScript fil" + +#: ../src/generic/dcpsg.cpp:2224 +msgid "PostScript:" +msgstr "PostScript fil:" + +#: ../src/generic/dcpsg.cpp:2187 +msgid "Preview Only" +msgstr "Bare smugkig" + +#: ../src/html/helpfrm.cpp:903 +#, fuzzy +msgid "Preview:" +msgstr "Bare smugkig" + +#: ../src/html/htmprint.cpp:486 +#, fuzzy +msgid "Previewing" +msgstr "Bare smugkig" + +#: ../src/html/helpfrm.cpp:512 +msgid "Previous page" +msgstr "" + +#: ../src/generic/prntdlgg.cpp:113 ../src/generic/prntdlgg.cpp:127 +msgid "Print" +msgstr "Udskriv" + +#: ../src/generic/printps.cpp:200 +msgid "Print Error" +msgstr "Udskriv fejl" + +#: ../src/common/docview.cpp:887 +msgid "Print Preview" +msgstr "Udskriftsmugkig" + +#: ../src/common/prntbase.cpp:683 ../src/common/prntbase.cpp:707 +msgid "Print Preview Failure" +msgstr "Udskriftsmugkig fejlede" + +#: ../src/generic/prntdlgg.cpp:172 +msgid "Print Range" +msgstr "Udskriftsområde" + +#: ../src/generic/prntdlgg.cpp:408 ../src/generic/prntdlgg.cpp:415 +msgid "Print Setup" +msgstr "Udskriftsopsætning" + +#: ../src/generic/prntdlgg.cpp:455 +msgid "Print in colour" +msgstr "Udskriv i farver" + +#: ../src/generic/prntdlgg.cpp:457 +msgid "Print spooling" +msgstr "Udskriftsspuling" + +#: ../src/html/helpfrm.cpp:529 +#, fuzzy +msgid "Print this page" +msgstr "Udskriftsområde" + +#: ../src/generic/dcpsg.cpp:2186 ../src/generic/prntdlgg.cpp:150 +msgid "Print to File" +msgstr "Udskriv til fil" + +#: ../src/common/prntbase.cpp:364 +msgid "Print..." +msgstr "Udskriv..." + +#: ../src/generic/dcpsg.cpp:2197 +msgid "Printer Command: " +msgstr "Printer kommando: " + +#: ../src/generic/dcpsg.cpp:2202 +msgid "Printer Options: " +msgstr "Printer valgmuligheder: " + +#: ../src/generic/dcpsg.cpp:346 +msgid "Printer Settings" +msgstr "Printer opsætninger" + +#: ../src/generic/prntdlgg.cpp:459 +msgid "Printer command:" +msgstr "Printer kommando:" + +#: ../src/generic/prntdlgg.cpp:149 +msgid "Printer options" +msgstr "Printer valgmuligheder" + +#: ../src/generic/prntdlgg.cpp:463 +msgid "Printer options:" +msgstr "Printer valgmuligheder:" + +#: ../src/generic/prntdlgg.cpp:682 +msgid "Printer..." +msgstr "Printer..." + +#: ../src/common/prntbase.cpp:104 ../src/common/prntbase.cpp:146 +#: ../src/html/htmprint.cpp:507 +msgid "Printing" +msgstr "Udskriver" + +#: ../src/common/prntbase.cpp:118 +msgid "Printing Error" +msgstr "Udskriftsfejl" + +#: ../src/generic/printps.cpp:218 +#, c-format +msgid "Printing page %d..." +msgstr "Udskriver side %d..." + +#: ../src/generic/printps.cpp:185 +msgid "Printing..." +msgstr "Udskriver..." + +#: ../src/common/log.cpp:348 +msgid "Program aborted." +msgstr "Program afsluttet" + +#: ../src/generic/logg.cpp:488 +msgid "Question" +msgstr "Spørgsmål" + +#: ../src/common/ffile.cpp:133 ../src/common/ffile.cpp:154 +#, fuzzy, c-format +msgid "Read error on file '%s'" +msgstr "Erstat fil '%s'?" + +#: ../src/msw/registry.cpp:528 +#, c-format +msgid "Registry key '%s' already exists." +msgstr "" + +#: ../src/msw/registry.cpp:497 +#, c-format +msgid "Registry key '%s' does not exist, cannot rename it." +msgstr "" + +#: ../src/msw/registry.cpp:623 +#, c-format +msgid "" +"Registry key '%s' is needed for normal system operation,\n" +"deleting it will leave your system in unusable state:\n" +"operation aborted." +msgstr "" +"Registry nøgle '%s' er nødvendig for almindelig system operation,\n" +"hvis du sletter den vil efterlade dit system i ubrugelig tilstand:\n" +"operationen blev afbrudt." + +#: ../src/msw/registry.cpp:428 +#, c-format +msgid "Registry value '%s' already exists." +msgstr "" + +#: ../src/generic/helphtml.cpp:309 +msgid "Relevant entries:" +msgstr "Relevante indgange:" + +#: ../src/generic/progdlgg.cpp:167 +msgid "Remaining time : " +msgstr "" + +#: ../src/html/helpfrm.cpp:269 +msgid "Remove current page from bookmarks" +msgstr "" + +#: ../src/msw/filedlg.cpp:400 +#, c-format +msgid "Replace file '%s'?" +msgstr "Erstat fil '%s'?" + +#: ../src/generic/prntdlgg.cpp:661 +msgid "Right margin (mm):" +msgstr "Højre margin (mm):" + +#: ../src/generic/fontdlgg.cpp:206 +msgid "Roman" +msgstr "Roman" + +#: ../src/generic/filedlgg.cpp:1283 ../src/gtk/filedlg.cpp:257 +#: ../src/motif/filedlg.cpp:353 ../src/msw/filedlg.cpp:439 +#, c-format +msgid "Save %s file" +msgstr "Gem %s fil" + +#: ../src/common/docview.cpp:240 +msgid "Save as" +msgstr "Gem som" + +#: ../src/generic/logg.cpp:442 +msgid "Save log contents to file" +msgstr "Gen log indhold til fil" + +#: ../src/generic/fontdlgg.cpp:209 +msgid "Script" +msgstr "Script" + +#: ../src/generic/helpwxht.cpp:160 ../src/html/helpfrm.cpp:414 +#: ../src/html/helpfrm.cpp:434 +msgid "Search" +msgstr "" + +#: ../src/html/helpfrm.cpp:416 +msgid "" +"Search contents of help book(s) for all occurences of the text you typed " +"above" +msgstr "" + +#: ../src/html/helpfrm.cpp:735 +msgid "Search in all books" +msgstr "" + +#: ../src/html/helpfrm.cpp:628 +#, fuzzy +msgid "Searching..." +msgstr "Udskriver..." + +#: ../src/generic/dirdlgg.cpp:191 +#, fuzzy +msgid "Sections" +msgstr "Valgmuligheder" + +#: ../src/common/ffile.cpp:221 +#, fuzzy, c-format +msgid "Seek error on file '%s'" +msgstr "kan ikke åbne filen '%s'" + +#: ../src/common/docview.cpp:1417 +msgid "Select a document template" +msgstr "Vælg en dokumentskabelon" + +#: ../src/common/docview.cpp:1440 +msgid "Select a document view" +msgstr "Vælg et dokumentudseende" + +#: ../src/common/docview.cpp:1335 ../src/common/docview.cpp:1372 +msgid "Select a file" +msgstr "Vælg en file" + +#: ../src/generic/dcpsg.cpp:2185 +msgid "Send to Printer" +msgstr "Send til printer" + +#: ../src/common/dlgcmn.cpp:136 +msgid "Setup" +msgstr "Opsætning" + +#: ../src/generic/prntdlgg.cpp:155 +msgid "Setup..." +msgstr "Opsætning..." + +#: ../src/msw/dialup.cpp:535 +msgid "Several active dialup connections found, choosing one randomly." +msgstr "" + +#: ../src/html/helpfrm.cpp:331 +msgid "Show all" +msgstr "" + +#: ../src/html/helpfrm.cpp:365 +msgid "Show all items in index" +msgstr "" + +#: ../src/generic/filedlgg.cpp:910 +msgid "Show hidden files" +msgstr "" + +#: ../src/html/helpfrm.cpp:496 +msgid "Show/hide navigation panel" +msgstr "" + +#: ../src/generic/filedlgg.cpp:534 +msgid "Size" +msgstr "" + +#: ../src/generic/fontdlgg.cpp:214 +msgid "Slant" +msgstr "Hældning" + +#: ../src/common/docview.cpp:297 +msgid "Sorry, could not open this file for saving." +msgstr "Undskyld, jeg kunne ikke åbne denne fil mht. gemning." + +#: ../src/common/docview.cpp:333 ../src/common/docview.cpp:345 +msgid "Sorry, could not open this file." +msgstr "Undskyld, jeg kunne ikke åbne denne fil." + +#: ../src/common/docview.cpp:304 +msgid "Sorry, could not save this file." +msgstr "Undskyld, jeg kunne ikke gemme denne fil." + +#: ../src/common/prntbase.cpp:683 +msgid "Sorry, not enough memory to create a preview." +msgstr "Undskyld, der er ikke nok hukkomelse til at danne et smugkig." + +#: ../src/generic/logg.cpp:596 +msgid "Status: " +msgstr "Status: " + +#: ../src/generic/fontdlgg.cpp:210 +msgid "Swiss" +msgstr "Swiss" + +#: ../src/common/imagtiff.cpp:157 ../src/common/imagtiff.cpp:166 +#, fuzzy +msgid "TIFF: Couldn't allocate memory." +msgstr "Kunne ikke oprette en timer" + +#: ../src/common/imagtiff.cpp:128 +msgid "TIFF: Error loading image." +msgstr "" + +#: ../src/common/imagtiff.cpp:176 +#, fuzzy +msgid "TIFF: Error reading image." +msgstr "Fejl ved oprettelse af bibliotek" + +#: ../src/generic/fontdlgg.cpp:211 +msgid "Teletype" +msgstr "Skrivemaskine" + +#: ../src/common/docview.cpp:1417 +msgid "Templates" +msgstr "Skabeloner" + +#: ../src/generic/dirdlgg.cpp:218 +msgid "Temporary" +msgstr "Midlertidig" + +#: ../src/common/fontmap.cpp:106 +msgid "Thai (ISO-8859-11)" +msgstr "" + +#: ../src/generic/dirdlgg.cpp:210 +msgid "The Computer" +msgstr "Datamaskinen" + +#: ../src/common/fontmap.cpp:463 +#, c-format +msgid "" +"The charset '%s' is unknown. You may select\n" +"another charset to replace it with or choose\n" +"[Cancel] if it cannot be replaced" +msgstr "" + +#: ../src/msw/ole/dataobj.cpp:169 +#, c-format +msgid "The clipboard format '%d' doesn't exist." +msgstr "" + +#: ../src/generic/dirdlgg.cpp:535 +msgid "The directory " +msgstr "Biblioteket " + +#: ../src/common/fontmap.cpp:626 +#, c-format +msgid "" +"The encoding '%s' is unknown.\n" +"Would you like to select a font to be used for this encoding\n" +"(otherwise the text in this encoding will not be shown correctly)?" +msgstr "" + +#: ../src/common/docview.cpp:1622 +#, c-format +msgid "" +"The file '%s' doesn't exist and couldn't be opened.\n" +"It has been also removed from the MRU files list." +msgstr "" + +#: ../src/common/cmdline.cpp:753 +#, c-format +msgid "The required parameter '%s' was not specified." +msgstr "" + +#: ../src/common/textcmn.cpp:121 +msgid "The text couldn't be saved." +msgstr "" + +#: ../src/common/cmdline.cpp:732 +#, c-format +msgid "The value for the option '%s' must be specified." +msgstr "" + +#: ../src/msw/dialup.cpp:411 +#, c-format +msgid "" +"The version of remote access service (RAS) installed on this machine is " +"tooold, please upgrade (the following required function is missing: %s)." +msgstr "" + +#: ../src/html/htmprint.cpp:486 +msgid "" +"There was a problem previewing.\n" +"Perhaps your current printer is not set correctly?" +msgstr "" + +#: ../src/html/htmprint.cpp:507 +msgid "" +"There was a problem printing.\n" +"Perhaps your current printer is not set correctly?" +msgstr "" + +#: ../src/msw/thread.cpp:1029 +msgid "" +"Thread module initialization failed: can not store value in thread local " +"storage" +msgstr "" +"Trådmodul initialisering fejlede: kan ikke gemme værdi i lokal trådlager" + +#: ../src/unix/threadpsx.cpp:1441 +msgid "Thread module initialization failed: failed to create thread key" +msgstr "Trådmodul initialisering fejlede: kunne ikke oprette trådnøgle" + +#: ../src/msw/thread.cpp:1017 +msgid "" +"Thread module initialization failed: impossible to allocate index in thread " +"local storage" +msgstr "" +"Trådmodul initialisering fejlede: umuligt at allokere index i lokal trådlager" + +#: ../src/unix/threadpsx.cpp:962 +msgid "Thread priority setting is ignored." +msgstr "" + +#: ../src/generic/filedlgg.cpp:536 +msgid "Time" +msgstr "" + +#: ../src/generic/tipdlg.cpp:162 +msgid "Tip of the Day" +msgstr "Dagens tip" + +#: ../src/generic/tipdlg.cpp:138 +msgid "Tips not available, sorry!" +msgstr "Tips ikke tilgængelige, beklager!" + +#: ../src/generic/prntdlgg.cpp:191 +msgid "To:" +msgstr "Til:" + +#: ../src/generic/prntdlgg.cpp:650 +msgid "Top margin (mm):" +msgstr "Top margin (mm):" + +#: ../src/common/fs_mem.cpp:202 +#, c-format +msgid "Trying to remove file '%s' from memory VFS, but it is not loaded!" +msgstr "" + +#: ../src/common/sckaddr.cpp:107 +msgid "Trying to solve a NULL hostname: giving up" +msgstr "" + +#: ../src/common/fontmap.cpp:104 +msgid "Turkish (ISO-8859-9)" +msgstr "" + +#: ../src/html/htmlwin.cpp:175 +#, c-format +msgid "Unable to open requested HTML document: %s" +msgstr "" + +#: ../src/generic/fontdlgg.cpp:242 +msgid "Underline" +msgstr "Understeget" + +#: ../src/common/resourc2.cpp:305 ../src/common/resourc2.cpp:319 +#: ../src/common/resourc2.cpp:335 ../src/common/resourc2.cpp:349 +#: ../src/common/resourc2.cpp:1378 ../src/common/resourc2.cpp:1392 +#: ../src/common/resourc2.cpp:1408 ../src/common/resourc2.cpp:1422 +#: ../src/common/resource.cpp:1805 ../src/common/resource.cpp:1819 +#: ../src/common/resource.cpp:1836 ../src/common/resource.cpp:1850 +#: ../src/common/resource.cpp:1935 ../src/common/resource.cpp:1949 +#: ../src/common/resource.cpp:1965 ../src/common/resource.cpp:1979 +#: ../src/common/resource.cpp:3019 ../src/common/resource.cpp:3033 +#: ../src/common/resource.cpp:3050 ../src/common/resource.cpp:3064 +msgid "Unexpected end of file whilst parsing resource." +msgstr "Uventet afslutning på filen uder parsning af resource." + +#: ../src/common/cmdline.cpp:704 +#, c-format +msgid "Unexpected parameter '%s'" +msgstr "" + +#: ../src/msw/dde.cpp:1019 +#, c-format +msgid "Unknown DDE error %08x" +msgstr "" + +#: ../src/common/fontmap.cpp:326 +#, c-format +msgid "Unknown encoding (%d)" +msgstr "" + +#: ../src/unix/mimetype.cpp:1304 +#, c-format +msgid "Unknown field in file %s, line %d: '%s'." +msgstr "Ukendt felt i fil %s, linie %d: '%s'." + +#: ../src/common/cmdline.cpp:496 +#, c-format +msgid "Unknown long option '%s'" +msgstr "" + +#: ../src/common/cmdline.cpp:518 +#, fuzzy, c-format +msgid "Unknown option '%s'" +msgstr "Kan ikke åbne URL '%s'" + +#: ../src/common/mimecmn.cpp:161 +#, c-format +msgid "Unmatched '{' in an entry for mime type %s." +msgstr "Uparret '{' i en indgang for mime type %s." + +#: ../src/common/docview.cpp:1869 ../src/common/docview.cpp:1884 +#: ../src/common/docview.cpp:1911 +msgid "Unnamed command" +msgstr "Unavngiven kommando" + +#: ../src/common/resourc2.cpp:687 ../src/common/resource.cpp:2323 +#, c-format +msgid "Unrecognized style %s whilst parsing resource." +msgstr "Ugenkendt stil %s under parsning af resource." + +#: ../src/msw/app.cpp:748 +#, fuzzy +msgid "Unrecoverable program error detected: the application will terminate." +msgstr "Uoprettelig programfejl opdaget: programmet bliver afbrudt." + +#: ../src/msw/clipbrd.cpp:268 ../src/msw/clipbrd.cpp:369 +msgid "Unsupported clipboard format." +msgstr "Usupporteret klippebordsformat." + +#: ../src/common/cmdline.cpp:785 +#, fuzzy, c-format +msgid "Usage: %s" +msgstr "Side %d" + +#: ../src/generic/dirdlgg.cpp:215 +msgid "User" +msgstr "Bruger" + +#: ../src/generic/dirdlgg.cpp:214 +msgid "User Local" +msgstr "Lokal bruger" + +#: ../src/common/valtext.cpp:188 +msgid "Validation conflict" +msgstr "Valideringskonflikt" + +#: ../src/generic/dirdlgg.cpp:216 +msgid "Variables" +msgstr "Variable" + +#: ../src/generic/filedlgg.cpp:858 +msgid "View files as a detailed view" +msgstr "" + +#: ../src/generic/filedlgg.cpp:852 +msgid "View files as a list view" +msgstr "" + +#: ../src/common/docview.cpp:1440 +msgid "Views" +msgstr "Udseender" + +#: ../src/unix/utilsunx.cpp:264 ../src/unix/utilsunx.cpp:600 +msgid "Waiting for subprocess termination failed" +msgstr "Venten på under-process afslutning fejlede" + +#: ../src/common/docview.cpp:428 ../src/common/resource.cpp:121 +#: ../src/generic/logg.cpp:181 +msgid "Warning" +msgstr "Advarsel" + +#: ../src/common/log.cpp:358 +msgid "Warning: " +msgstr "Advarsel: " + +#: ../src/html/htmlpars.cpp:179 +msgid "Warning: attempt to remove HTML tag handler from empty stack." +msgstr "" + +#: ../src/common/fontmap.cpp:96 +msgid "West European (ISO-8859-1/Latin 1)" +msgstr "" + +#: ../src/common/fontmap.cpp:110 +msgid "West European new (ISO-8859-15/Latin 0)" +msgstr "" + +#: ../src/html/helpfrm.cpp:406 +msgid "Whole words only" +msgstr "" + +#: ../src/msw/utils.cpp:545 +msgid "Win32s on Windows 3.1" +msgstr "" + +#: ../src/msw/utils.cpp:577 +msgid "Windows 3.1" +msgstr "" + +#: ../src/msw/utils.cpp:549 +#, c-format +msgid "Windows 9%c" +msgstr "" + +#: ../src/common/fontmap.cpp:118 +msgid "Windows Arabic (CP 1256)" +msgstr "" + +#: ../src/common/fontmap.cpp:119 +msgid "Windows Baltic (CP 1257)" +msgstr "" + +#: ../src/common/fontmap.cpp:113 +msgid "Windows Cyrillic (CP 1251)" +msgstr "" + +#: ../src/common/fontmap.cpp:115 +msgid "Windows Greek (CP 1253)" +msgstr "" + +#: ../src/common/fontmap.cpp:117 +msgid "Windows Hebrew (CP 1255)" +msgstr "" + +#: ../src/common/fontmap.cpp:114 +msgid "Windows Latin 1 (CP 1252)" +msgstr "" + +#: ../src/common/fontmap.cpp:112 +msgid "Windows Latin 2 (CP 1250)" +msgstr "" + +#: ../src/common/fontmap.cpp:116 +msgid "Windows Turkish (CP 1254)" +msgstr "" + +#: ../src/common/ffile.cpp:168 +#, fuzzy, c-format +msgid "Write error on file '%s'" +msgstr "kan ikke åbne filen '%s'" + +#: ../src/generic/dcpsg.cpp:2242 +msgid "X Scaling" +msgstr "X scalering" + +#: ../src/generic/dcpsg.cpp:2251 +msgid "X Translation" +msgstr "X oversættelse" + +#: ../src/generic/dcpsg.cpp:2246 +msgid "Y Scaling" +msgstr "Y scalering" + +#: ../src/generic/dcpsg.cpp:2255 +msgid "Y Translation" +msgstr "Y oversættelse" + +#: ../src/common/dlgcmn.cpp:107 ../src/common/dlgcmn.cpp:114 +#: ../src/motif/msgdlg.cpp:178 +msgid "Yes" +msgstr "Ja" + +#: ../src/generic/dirdlgg.cpp:570 +msgid "You cannot add a new directory to this section." +msgstr "" + +#: ../src/common/docview.cpp:1980 +msgid "[EMPTY]" +msgstr "[TOM]" + +#: ../src/msw/dde.cpp:986 +msgid "a DDEML application has created a prolonged race condition." +msgstr "" + +#: ../src/msw/dde.cpp:974 +msgid "" +"a DDEML function was called without first calling the DdeInitialize " +"function,\n" +"or an invalid instance identifier\n" +"was passed to a DDEML function." +msgstr "" + +#: ../src/msw/dde.cpp:992 +msgid "a client's attempt to establish a conversation has failed." +msgstr "" + +#: ../src/msw/dde.cpp:989 +#, fuzzy +msgid "a memory allocation failed." +msgstr "Røroprettelse fejlede" + +#: ../src/msw/dde.cpp:983 +msgid "a parameter failed to be validated by the DDEML." +msgstr "" + +#: ../src/msw/dde.cpp:965 +msgid "a request for a synchronous advise transaction has timed out." +msgstr "" + +#: ../src/msw/dde.cpp:971 +msgid "a request for a synchronous data transaction has timed out." +msgstr "" + +#: ../src/msw/dde.cpp:980 +msgid "a request for a synchronous execute transaction has timed out." +msgstr "" + +#: ../src/msw/dde.cpp:998 +msgid "a request for a synchronous poke transaction has timed out." +msgstr "" + +#: ../src/msw/dde.cpp:1013 +msgid "a request to end an advise transaction has timed out." +msgstr "" + +#: ../src/msw/dde.cpp:1007 +msgid "" +"a server-side transaction was attempted on a conversation\n" +"that was terminated by the client, or the server\n" +"terminated before completing a transaction." +msgstr "" + +#: ../src/msw/dde.cpp:995 +#, fuzzy +msgid "a transaction failed." +msgstr "Røroprettelse fejlede" + +#: ../src/common/utilscmn.cpp:466 +msgid "alt" +msgstr "alt" + +#: ../src/msw/dde.cpp:977 +msgid "" +"an application initialized as APPCLASS_MONITOR has\n" +"attempted to perform a DDE transaction,\n" +"or an application initialized as APPCMD_CLIENTONLY has \n" +"attempted to perform server transactions." +msgstr "" + +#: ../src/msw/dde.cpp:1001 +msgid "an internal call to the PostMessage function has failed. " +msgstr "" + +#: ../src/msw/dde.cpp:1010 +msgid "an internal error has occurred in the DDEML." +msgstr "" + +#: ../src/msw/dde.cpp:1016 +msgid "" +"an invalid transaction identifier was passed to a DDEML function.\n" +"Once the application has returned from an XTYP_XACT_COMPLETE callback,\n" +"the transaction identifier for that callback is no longer valid." +msgstr "" + +#: ../src/common/fileconf.cpp:1415 +#, c-format +msgid "attempt to change immutable key '%s' ignored." +msgstr "forsøg på at ændre uforanderlig nøgle '%s' blev ignoreret." + +#: ../src/common/ffile.cpp:101 +#, fuzzy, c-format +msgid "can't close file '%s'" +msgstr "kan ikke åbne filen '%s'" + +#: ../src/common/file.cpp:252 +#, c-format +msgid "can't close file descriptor %d" +msgstr "kan ikke lukke fildeskriptor %d" + +#: ../src/common/file.cpp:550 ../src/common/file.cpp:560 +#, c-format +msgid "can't commit changes to file '%s'" +msgstr "kan ikke overgive ændringer til fil '%s'" + +#: ../src/common/file.cpp:200 +#, c-format +msgid "can't create file '%s'" +msgstr "kan ikke oprette file '%s'" + +#: ../src/common/fileconf.cpp:885 +#, c-format +msgid "can't delete user configuration file '%s'" +msgstr "kan ikke slette brugerkonfigurationsfil '%s'" + +#: ../src/common/file.cpp:431 +#, c-format +msgid "can't determine if the end of file is reached on descriptor %d" +msgstr "kan ikke afgøre om slutningen af filen er nået på deskriptor %d" + +#: ../src/common/file.cpp:397 +#, c-format +msgid "can't find length of file on file descriptor %d" +msgstr "kan ikke finde længden af filen på fildeskriptor %d" + +#: ../src/msw/utils.cpp:376 +msgid "can't find user's HOME, using current directory." +msgstr "kan ikke finde brugerens HJEM, bruger nuværende bibliotek." + +#: ../src/common/file.cpp:311 +#, c-format +msgid "can't flush file descriptor %d" +msgstr "kan ikke skylle fildeskriptor %d ud" + +#: ../src/common/file.cpp:365 +#, c-format +msgid "can't get seek position on file descriptor %d" +msgstr "kan ikke få søgeposition på fildescriptor %d" + +#: ../src/common/fontmap.cpp:568 +msgid "can't load any font, aborting" +msgstr "" + +#: ../src/common/ffile.cpp:85 ../src/common/file.cpp:238 +#, c-format +msgid "can't open file '%s'" +msgstr "kan ikke åbne filen '%s'" + +#: ../src/common/fileconf.cpp:310 +#, c-format +msgid "can't open global configuration file '%s'." +msgstr "kan ikke åbne global konfiguraionsfil '%s'." + +#: ../src/common/fileconf.cpp:322 +#, c-format +msgid "can't open user configuration file '%s'." +msgstr "kan ikke åbge brugerkonfigurationsfil '%s'." + +#: ../src/common/fileconf.cpp:773 +msgid "can't open user configuration file." +msgstr "kan ikke åbne brugerkonfigurationsfil." + +#: ../src/common/file.cpp:278 +#, c-format +msgid "can't read from file descriptor %d" +msgstr "kan ikke læse fra fildeskriptor %d" + +#: ../src/common/file.cpp:545 ../src/common/file.cpp:555 +#, c-format +msgid "can't remove file '%s'" +msgstr "kan ikke fjerne filen '%s'" + +#: ../src/common/file.cpp:573 ../src/common/file.cpp:576 +#, c-format +msgid "can't remove temporary file '%s'" +msgstr "kan ikke fjerne midlertidig fil '%s'" + +#: ../src/common/file.cpp:351 +#, c-format +msgid "can't seek on file descriptor %d" +msgstr "kan ikke søge på fildeskriptor %d" + +#: ../src/common/textfile.cpp:354 +#, c-format +msgid "can't write file '%s' to disk." +msgstr "kan ikke skrive fil '%s' til disk." + +#: ../src/common/file.cpp:296 +#, c-format +msgid "can't write to file descriptor %d" +msgstr "kan ikke skrive til fildeskriptor %d" + +#: ../src/common/fileconf.cpp:780 +msgid "can't write user configuration file." +msgstr "kan ikke skrive brugerkonfigurationsfil." + +#: ../src/common/intl.cpp:349 +#, c-format +msgid "catalog file for domain '%s' not found." +msgstr "katalogfil for domæne '%s' blev ikke fundet." + +#: ../src/common/utilscmn.cpp:464 +msgid "ctrl" +msgstr "ctrl" + +#: ../src/common/cmdline.cpp:869 +msgid "date" +msgstr "" + +#: ../src/common/datetime.cpp:3185 +msgid "eighteenth" +msgstr "" + +#: ../src/common/datetime.cpp:3175 +#, fuzzy +msgid "eighth" +msgstr "Let" + +#: ../src/common/datetime.cpp:3178 +msgid "eleventh" +msgstr "" + +#: ../src/common/fileconf.cpp:1402 +#, c-format +msgid "entry '%s' appears more than once in group '%s'" +msgstr "indgang '%s' optræder mere en engang i gruppe '%s'" + +#: ../src/msw/dialup.cpp:856 +msgid "establish" +msgstr "" + +#: ../src/common/ffile.cpp:182 +#, fuzzy, c-format +msgid "failed to flush the file '%s'" +msgstr "Log gemt i filen '%s'." + +#: ../src/common/datetime.cpp:3182 +msgid "fifteenth" +msgstr "" + +#: ../src/common/datetime.cpp:3172 +#, fuzzy +msgid "fifth" +msgstr "skift" + +#: ../src/common/fileconf.cpp:463 +#, c-format +msgid "file '%s', line %d: '%s' ignored after group header." +msgstr "fil '%s', linie %d: '%s' ignoreret efter gruppeindledning" + +#: ../src/common/fileconf.cpp:492 +#, c-format +msgid "file '%s', line %d: '=' expected." +msgstr "fil '%s', linie %d: '=' forventet." + +#: ../src/common/fileconf.cpp:518 +#, c-format +msgid "file '%s', line %d: key '%s' was first found at line %d." +msgstr "fil '%s', linie %d: nøgle '%s blev først fundet på linie %d." + +#: ../src/common/fileconf.cpp:508 +#, c-format +msgid "file '%s', line %d: value for immutable key '%s' ignored." +msgstr "fil '%s', linie %d: værdi af uforanderlig nøgle '%s' blev ignoreret." + +#: ../src/common/fileconf.cpp:431 +#, c-format +msgid "file '%s': unexpected character %c at line %d." +msgstr "fil '%s': uventet karakter %c på linie %d." + +#: ../src/common/datetime.cpp:3168 +msgid "first" +msgstr "" + +#: ../src/common/datetime.cpp:3181 +msgid "fourteenth" +msgstr "" + +#: ../src/common/datetime.cpp:3171 +msgid "fourth" +msgstr "" + +#: ../src/common/timercmn.cpp:239 +msgid "gmtime() failed" +msgstr "" + +#: ../src/msw/dialup.cpp:856 +#, fuzzy +msgid "initiate" +msgstr "ugyldig dato" + +#: ../src/common/file.cpp:435 +msgid "invalid eof() return value." +msgstr "ugyldig eof() returværdi." + +#: ../src/generic/logg.cpp:501 +msgid "invalid message box return value" +msgstr "ugyldig meddelelsesboks returværdi" + +#: ../src/html/helpfrm.cpp:874 +#, fuzzy +msgid "large" +msgstr "Sider" + +#: ../src/common/intl.cpp:541 +#, c-format +msgid "locale '%s' can not be set." +msgstr "locale '%s' kan ikke sættes." + +#: ../src/common/intl.cpp:344 +#, c-format +msgid "looking for catalog '%s' in path '%s'." +msgstr "søger efter katalog '%s' i sti '%s'." + +#: ../src/html/helpfrm.cpp:874 +msgid "medium" +msgstr "" + +#: ../src/common/datetime.cpp:3289 +#, fuzzy +msgid "midnight" +msgstr "Let" + +#: ../src/common/timercmn.cpp:235 +#, fuzzy +msgid "mktime() failed" +msgstr "Gaffel fejlede ;-)" + +#: ../src/common/datetime.cpp:3186 +msgid "nineteenth" +msgstr "" + +#: ../src/common/datetime.cpp:3176 +#, fuzzy +msgid "ninth" +msgstr "Udskriv" + +#: ../src/msw/dde.cpp:961 +msgid "no DDE error." +msgstr "" + +#: ../src/html/helpdata.cpp:529 +#, fuzzy +msgid "noname" +msgstr "unavngivet" + +#: ../src/common/datetime.cpp:3288 +msgid "noon" +msgstr "" + +#: ../src/common/cmdline.cpp:868 +msgid "num" +msgstr "" + +#: ../src/msw/dde.cpp:1004 +msgid "reentrancy problem." +msgstr "" + +#: ../src/common/datetime.cpp:3169 +msgid "second" +msgstr "" + +#: ../src/common/datetime.cpp:3184 +msgid "seventeenth" +msgstr "" + +#: ../src/common/datetime.cpp:3174 +msgid "seventh" +msgstr "" + +#: ../src/common/utilscmn.cpp:468 +msgid "shift" +msgstr "skift" + +#: ../src/common/datetime.cpp:3183 +msgid "sixteenth" +msgstr "" + +#: ../src/common/datetime.cpp:3173 +#, fuzzy +msgid "sixth" +msgstr "skift" + +#: ../src/html/helpfrm.cpp:874 +msgid "small" +msgstr "" + +#: ../src/common/cmdline.cpp:867 +msgid "str" +msgstr "" + +#: ../src/common/intl.cpp:634 +#, c-format +msgid "string '%s' not found in domain '%s' for locale '%s'." +msgstr "streng '%s' blev ikke fundet i domæne '%s for locale '%s'." + +#: ../src/common/intl.cpp:639 +#, c-format +msgid "string '%s' not found in locale '%s'." +msgstr "streng '%s' blev ikke fundet i locale '%s'." + +#: ../src/common/datetime.cpp:3177 +msgid "tenth" +msgstr "" + +#: ../src/msw/dde.cpp:968 +msgid "the response to the transaction caused the DDE_FBUSY bit to be set." +msgstr "" + +#: ../src/common/datetime.cpp:3170 +msgid "third" +msgstr "" + +#: ../src/common/datetime.cpp:3180 +msgid "thirteenth" +msgstr "" + +#: ../src/common/datetime.cpp:2981 +msgid "today" +msgstr "" + +#: ../src/common/datetime.cpp:2983 +msgid "tomorrow" +msgstr "" + +#: ../src/common/datetime.cpp:3179 +msgid "twelfth" +msgstr "" + +#: ../src/common/datetime.cpp:3187 +msgid "twentieth" +msgstr "" + +#: ../src/common/fileconf.cpp:1522 +#, c-format +msgid "unexpected \" at position %d in '%s'." +msgstr "uventet \" på position %s i '%s'." + +#: ../src/generic/progdlgg.cpp:241 +msgid "unknown" +msgstr "" + +#: ../src/msw/dialup.cpp:462 +#, c-format +msgid "unknown error (error code %08x)." +msgstr "" + +#: ../src/common/file.cpp:334 +msgid "unknown seek origin" +msgstr "ukendt søgeorigo" + +#: ../src/common/fontmap.cpp:348 +#, c-format +msgid "unknown-%d" +msgstr "" + +#: ../src/common/docview.cpp:397 +msgid "unnamed" +msgstr "unavngivet" + +#: ../src/common/docview.cpp:1177 +#, c-format +msgid "unnamed%d" +msgstr "unavngivet%d" + +#: ../src/common/intl.cpp:354 +#, c-format +msgid "using catalog '%s' from '%s'." +msgstr "bruger katalog '%s' fra '%s'." + +#: ../src/html/helpfrm.cpp:874 +msgid "very large" +msgstr "" + +#: ../src/html/helpfrm.cpp:874 +msgid "very small" +msgstr "" + +#: ../src/common/timercmn.cpp:266 +msgid "wxGetTimeOfDay failed." +msgstr "" + +#: ../src/common/socket.cpp:329 ../src/common/socket.cpp:383 +msgid "wxSocket: invalid signature in ReadMsg." +msgstr "" + +#: ../src/common/socket.cpp:903 +msgid "wxSocket: unknown event!." +msgstr "" + +#: ../src/motif/app.cpp:591 +#, c-format +msgid "wxWindows could not open display for '%s': exiting." +msgstr "wxWindows kunne ikke åbne diplay for '%s': stopper." + +#: ../src/common/filefn.cpp:1214 +msgid "wxWindows: error finding temporary file name.\n" +msgstr "wxWindows: fejl ved søgning efter midlertidig filnavn.\n" + +#: ../src/common/datetime.cpp:2982 +msgid "yesterday" +msgstr "" + +#~ msgid " B.C." +#~ msgstr " F.K." + +#~ msgid "%s is invalid." +#~ msgstr "%s er ulovlig" + +#~ msgid "%s should be numeric." +#~ msgstr "%s skulle være numerisk" + +#~ msgid "%s should only contain ASCII characters." +#~ msgstr "%s må kun indeholde ASCII karakterer" + +#~ msgid "%s should only contain alphabetic characters." +#~ msgstr "%s må kun indeholde bogstaver" + +#~ msgid "%s should only contain alphabetic or numeric characters." +#~ msgstr "%s må kun indeholde bogstaver eller tal" + +#~ msgid "A3 297 x 420 mm" +#~ msgstr "A3 297 x 420 mm" + +#~ msgid "A4 210 x 297 mm" +#~ msgstr "A4 210 x 297 mm" + +#~ msgid "Application Error" +#~ msgstr "Program fejl" + +#~ msgid "Can not create tooltip control" +#~ msgstr "Kan ikke oprette tooltip kontrol" + +#~ msgid "Can not get data in format '%s' from clipboard." +#~ msgstr "Kan ikke få data i format '%s' fra klippebordet." + +#~ msgid "Can not get priority range for scheduling policy %d." +#~ msgstr "Kan ikke få prioriteringsområde for afviklingsalgoritme %d." + +#~ msgid "Can not put data in format '%s' on clipboard." +#~ msgstr "Kan ikke skrive data i format '%s' til klippebordet." + +#~ msgid "Can not retrieve thread scheduling policy." +#~ msgstr "Kan ikke hente trådafviklingsalgoritme." + +#~ msgid "Character '%c' is invalid in a config entry name." +#~ msgstr "Karakter '%c' er ulovlig i en konfigurationsindgangsnavn." + +#~ msgid "Debug" +#~ msgstr "Aflus" + +#~ msgid "DoLogString must be overrided if it's called." +#~ msgstr "DoLogString skal overskrives, hvis det bliver kaldt." + +#~ msgid "Enter the name of the directory to create" +#~ msgstr "Indtast navnet på biblioteket, der skal oprettes" + +#~ msgid "Entry name can't start with '%c'." +#~ msgstr "Indgangsnavn kan ikke starte med '%c'." + +#~ msgid "Failed to created dialog." +#~ msgstr "Kunne ikke oprette dialog." + +#~ msgid "Legal 8 1/2 x 14 in" +#~ msgstr "Legal 8 1/2 x 14 in" + +#~ msgid "Letter 8 1/2 x 11 in" +#~ msgstr "Letter 8 1/2 x 11 in" + +#~ msgid "" +#~ "Mime.types file %s, line %d: extra characters after the field value ignored." +#~ msgstr "" +#~ "Mime.type fil %s, linie %d: ekstra karakterer efter feltværdien ignoreret." + +#~ msgid "Sizer error" +#~ msgstr "Sizer fejl" + +#~ msgid "Thread module initialization failed: failed to create pthread key." +#~ msgstr "Trådmodul initialisering fejlede: kunne ikke oprette ptrådnøgle." + +#~ msgid "bad index in wxArrayString::Remove" +#~ msgstr "forkert index i wxArrayString::Remove" + +#~ msgid "can't set value of a group!" +#~ msgstr "kan ikke sætte værdien af gruppe!" + +#~ msgid "empty file name in wxFindFileInPath" +#~ msgstr "tom filnavn i wxFindFileInPath" + +#~ msgid "invalid day" +#~ msgstr "ugyldig dag" + +#~ msgid "invalid month" +#~ msgstr "ugyldig måned" + +#~ msgid "pm" +#~ msgstr "efter middag" + +#~ msgid "removing inexistent element in wxArrayString::Remove" +#~ msgstr "fjerner ikke-eksisterende element i wxArrayString::Remove" + +#~ msgid "unknown log level in wxLog::DoLog" +#~ msgstr "ukendt log-niveau i wxLog::DoLog" + +#~ msgid "unknown log level in wxLogGui::DoLog" +#~ msgstr "ukendt log-niveau i wxLogGui::DoLog" + +#~ msgid "wxExpandSizer has no parent!" +#~ msgstr "wxExpandSizer har ingen forældre!" + +#~ msgid "" +#~ "wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to " +#~ "let me know about the canvas!" +#~ msgstr "" +#~ "wxPrintPreviewBase::RenderPage: skal bruge wxPrintPreviewBase::SetCanvas for " +#~ "at lade mig vide om kanvasen!" + +#~ msgid "" +#~ "can't determine if the end of file is reached on descriptor " +#~ "%d" +#~ msgstr "" +#~ "kan ikke afgøre, om slutning af filen er nået på deskriptor " +#~ "%d" + +#~ msgid "bad index in wxArrayString::Insert" +#~ msgstr "forkert index i wxArrayString::Insert" + +#~ msgid "Couldn't load a JPEG image - probably file is corrupted." +#~ msgstr "Kunne ikke load'e et JPEG billede - sandsynligvis er filen korrupt." + +#~ msgid "Couldn't save a JPEG image - probably file is corrupted." +#~ msgstr "Kunne ikke gemme et JPEG billede - sandsynligvis er filen korrupt." + +#~ msgid "Failed to allocate %dKb of memory for clipboard transfer." +#~ msgstr "Kunne ikke allokere %dKb hukommelse til klippebordsoverførsel." diff --git a/locale/de.po b/locale/de.po index 745b0df25a..79c61a695d 100644 --- a/locale/de.po +++ b/locale/de.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2000-03-07 11:31+0100\n" +"POT-Creation-Date: 2000-04-13 16:08+0930\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" -#: ../src/generic/dirdlgg.cpp:479 +#: ../src/generic/dirdlgg.cpp:550 msgid "" "\n" "(Do you have the required permissions?)" @@ -22,7 +22,7 @@ msgstr "" "\n" "(Haben Sie die nötigen Zugriffsrechte?)" -#: ../src/generic/dirdlgg.cpp:466 +#: ../src/generic/dirdlgg.cpp:537 msgid "" "\n" "does not exist\n" @@ -37,63 +37,67 @@ msgstr "" msgid " (error %ld: %s)" msgstr " (Fehler %ld: %s)" -#: ../src/common/docview.cpp:1192 +#: ../src/common/docview.cpp:1195 msgid " - " msgstr "" -#: ../src/html/htmprint.cpp:484 +#: ../src/html/htmprint.cpp:491 #, fuzzy msgid " Preview" msgstr "Druckvoransicht" -#: ../src/generic/filedlgg.cpp:326 +#: ../src/generic/filedlgg.cpp:328 msgid " bytes " msgstr "" #: ../src/common/resourc2.cpp:265 ../src/common/resourc2.cpp:1334 -#: ../src/common/resource.cpp:1769 ../src/common/resource.cpp:1899 -#: ../src/common/resource.cpp:2980 +#: ../src/common/resource.cpp:1765 ../src/common/resource.cpp:1895 +#: ../src/common/resource.cpp:2975 #, c-format msgid "#define %s must be an integer." msgstr "#define %s muß eine ganze Zahl sein" -#: ../src/html/helpfrm.cpp:695 ../src/html/helpfrm.cpp:696 -#: ../src/html/helpfrm.cpp:1242 ../src/html/helpfrm.cpp:1269 +#: ../src/html/helpfrm.cpp:718 ../src/html/helpfrm.cpp:719 +#: ../src/html/helpfrm.cpp:1277 ../src/html/helpfrm.cpp:1304 #, c-format msgid "%i of %i" msgstr "" -#: ../src/common/cmdline.cpp:735 +#: ../src/common/cmdline.cpp:727 #, fuzzy, c-format msgid "%s (or %s)" msgstr " (Fehler %ld: %s)" -#: ../src/common/resourc2.cpp:709 ../src/common/resource.cpp:2350 +#: ../src/common/resourc2.cpp:709 ../src/common/resource.cpp:2346 #, c-format msgid "%s not a bitmap resource specification." msgstr "%s ist keine Bitmap-Resourcenangabe" -#: ../src/common/resourc2.cpp:864 ../src/common/resource.cpp:2506 +#: ../src/common/resourc2.cpp:864 ../src/common/resource.cpp:2501 #, c-format msgid "%s not an icon resource specification." msgstr "%s ist keine Icon-Resourcenangabe" #: ../src/common/resourc2.cpp:357 ../src/common/resourc2.cpp:1430 -#: ../src/common/resource.cpp:1862 ../src/common/resource.cpp:1991 -#: ../src/common/resource.cpp:3077 +#: ../src/common/resource.cpp:1858 ../src/common/resource.cpp:1987 +#: ../src/common/resource.cpp:3072 #, c-format msgid "%s: ill-formed resource file syntax." msgstr "%s: falsch formatierte Resourcendatei-Syntax" -#: ../src/generic/logg.cpp:435 ../src/generic/tipdlg.cpp:170 +#: ../src/generic/logg.cpp:446 ../src/generic/tipdlg.cpp:170 msgid "&Close" msgstr "&Schließen" +#: ../src/generic/logg.cpp:681 +msgid "&Details" +msgstr "" + #: ../src/generic/wizard.cpp:268 msgid "&Finish" msgstr "" -#: ../src/generic/logg.cpp:436 +#: ../src/generic/logg.cpp:447 msgid "&Log" msgstr "&Log" @@ -105,15 +109,15 @@ msgstr "" msgid "&Next Tip" msgstr "" -#: ../src/common/docview.cpp:1889 ../src/common/docview.cpp:1900 +#: ../src/common/docview.cpp:1891 ../src/common/docview.cpp:1902 msgid "&Redo" msgstr "&Wieder-Ausführen" -#: ../src/common/docview.cpp:1883 ../src/common/docview.cpp:1910 +#: ../src/common/docview.cpp:1885 ../src/common/docview.cpp:1912 msgid "&Redo " msgstr "&Wieder-Ausführen " -#: ../src/generic/logg.cpp:431 +#: ../src/generic/logg.cpp:442 msgid "&Save..." msgstr "&Sichern..." @@ -121,15 +125,15 @@ msgstr "&Sichern..." msgid "&Show tips at startup" msgstr "" -#: ../src/common/docview.cpp:1895 +#: ../src/common/docview.cpp:1897 msgid "&Undo" msgstr "&Rückgängig" -#: ../src/common/docview.cpp:1870 +#: ../src/common/docview.cpp:1872 msgid "&Undo " msgstr "&Rückgängig " -#: ../src/common/config.cpp:390 +#: ../src/common/config.cpp:395 #, c-format msgid "'%s' has extra '..', ignored." msgstr "'%s' hat extra '..', ingoriert." @@ -139,17 +143,17 @@ msgstr "'%s' hat extra '..', ingoriert." msgid "'%s' is invalid" msgstr "" -#: ../src/common/cmdline.cpp:652 +#: ../src/common/cmdline.cpp:649 #, c-format msgid "'%s' is not a correct numeric value for option '%s'." msgstr "" -#: ../src/common/intl.cpp:389 +#: ../src/common/intl.cpp:387 #, c-format msgid "'%s' is not a valid message catalog." msgstr "'%s' ist kein gültiger Nachrichtenkatalog." -#: ../src/common/textfile.cpp:224 +#: ../src/common/textfile.cpp:250 #, c-format msgid "'%s' is probably a binary file." msgstr "'%s' ist vermutlich eine Binärdatei." @@ -174,18 +178,18 @@ msgstr "" msgid "'%s' should only contain alphabetic or numeric characters." msgstr "" -#: ../src/html/helpfrm.cpp:656 +#: ../src/html/helpfrm.cpp:679 msgid "(Help)" msgstr "" -#: ../src/html/helpfrm.cpp:271 ../src/html/helpfrm.cpp:760 -#: ../src/html/helpfrm.cpp:1295 +#: ../src/html/helpfrm.cpp:276 ../src/html/helpfrm.cpp:783 +#: ../src/html/helpfrm.cpp:1330 msgid "(bookmarks)" msgstr "" #: ../src/common/resourc2.cpp:297 ../src/common/resourc2.cpp:1370 -#: ../src/common/resource.cpp:1801 ../src/common/resource.cpp:1931 -#: ../src/common/resource.cpp:3016 +#: ../src/common/resource.cpp:1797 ../src/common/resource.cpp:1927 +#: ../src/common/resource.cpp:3011 msgid "" ", expected static, #include or #define\n" "whilst parsing resource." @@ -193,19 +197,24 @@ msgstr "" ", erwartete static, #include oder #define\n" "beim Lesen der Resource." -#: ../src/generic/dirdlgg.cpp:259 ../src/generic/filedlgg.cpp:708 +#: ../src/generic/dirdlgg.cpp:264 ../src/generic/filedlgg.cpp:710 msgid "." msgstr "" -#: ../src/generic/dirdlgg.cpp:260 ../src/generic/filedlgg.cpp:709 +#: ../src/generic/dirdlgg.cpp:265 ../src/generic/filedlgg.cpp:711 msgid ".." msgstr "" -#: ../src/common/fontmap.cpp:438 +#: ../src/html/htmprint.cpp:272 +#, fuzzy +msgid ": file does not exist!" +msgstr "Verzeichnis existiert nicht" + +#: ../src/common/fontmap.cpp:459 msgid ": unknown charset" msgstr "" -#: ../src/common/fontmap.cpp:598 +#: ../src/common/fontmap.cpp:622 msgid ": unknown encoding" msgstr "" @@ -213,23 +222,23 @@ msgstr "" msgid "< &Back" msgstr "" -#: ../src/generic/filedlgg.cpp:354 +#: ../src/generic/filedlgg.cpp:356 msgid "<DIR>" msgstr "" -#: ../src/generic/filedlgg.cpp:321 +#: ../src/generic/filedlgg.cpp:323 msgid "<DIR> " msgstr "" -#: ../src/generic/filedlgg.cpp:355 +#: ../src/generic/filedlgg.cpp:357 msgid "<LINK>" msgstr "" -#: ../src/generic/filedlgg.cpp:322 +#: ../src/generic/filedlgg.cpp:324 msgid "<LINK> " msgstr "" -#: ../src/html/helpfrm.cpp:904 +#: ../src/html/helpfrm.cpp:928 msgid "" "<html><body>Normal face<br>(and <u>underlined</u>. <i>Italic face.</i> " "<b>Bold face.</b> <b><i>Bold italic face.</i></b><br><font size=-2>font size " @@ -252,7 +261,7 @@ msgstr "" msgid "ABCDEFGabcdefg12345" msgstr "" -#: ../src/html/helpfrm.cpp:265 +#: ../src/html/helpfrm.cpp:270 msgid "Add current page to bookmarks" msgstr "" @@ -260,7 +269,7 @@ msgstr "" msgid "Add to custom colours" msgstr "Zu Benutzerfarben hinzufügen" -#: ../src/html/helpctrl.cpp:84 +#: ../src/html/helpctrl.cpp:88 #, c-format msgid "Adding book %s" msgstr "" @@ -269,7 +278,7 @@ msgstr "" msgid "All" msgstr "Alle" -#: ../src/generic/filedlgg.cpp:820 +#: ../src/generic/filedlgg.cpp:822 msgid "All files (*)|*" msgstr "" @@ -277,12 +286,12 @@ msgstr "" msgid "Already dialling ISP." msgstr "" -#: ../src/generic/logg.cpp:475 +#: ../src/generic/logg.cpp:486 #, c-format msgid "Append log to file '%s' (choosing [No] will overwrite it)?" msgstr "An Logdatei '%s' anhängen ([Nein] wird sie ersetzen)?" -#: ../src/common/fontmap.cpp:93 +#: ../src/common/fontmap.cpp:101 msgid "Arabic (ISO-8859-6)" msgstr "" @@ -323,15 +332,15 @@ msgstr "" msgid "Backward" msgstr "" -#: ../src/common/fontmap.cpp:91 +#: ../src/common/fontmap.cpp:99 msgid "Baltic (ISO-8859-4)" msgstr "" -#: ../src/common/fontmap.cpp:97 +#: ../src/common/fontmap.cpp:105 msgid "Baltic II (ISO-8859-10)" msgstr "" -#: ../src/common/resourc2.cpp:844 ../src/common/resource.cpp:2486 +#: ../src/common/resourc2.cpp:844 ../src/common/resource.cpp:2481 #, c-format msgid "Bitmap resource specification %s not found." msgstr "Bitmapresourceangabe %s nicht gefunden." @@ -344,11 +353,11 @@ msgstr "Fett" msgid "Bottom margin (mm):" msgstr "Unterer Rand (mm)" -#: ../src/generic/logg.cpp:433 +#: ../src/generic/logg.cpp:444 msgid "C&lear" msgstr "L&öschen" -#: ../src/msw/thread.cpp:222 +#: ../src/mac/thread.cpp:179 ../src/msw/thread.cpp:222 msgid "Can not create event object." msgstr "Kann Eventobjekt nicht erzeugen." @@ -357,7 +366,12 @@ msgstr "Kann Eventobjekt nicht erzeugen." msgid "Can not create mutex" msgstr "Kann Mutex nicht anlegen." -#: ../src/common/filefn.cpp:1279 ../src/msw/dir.cpp:294 +#: ../src/mac/thread.cpp:92 +#, fuzzy +msgid "Can not create mutex." +msgstr "Kann Mutex nicht anlegen." + +#: ../src/common/filefn.cpp:1271 ../src/msw/dir.cpp:294 #: ../src/unix/dir.cpp:214 #, c-format msgid "Can not enumerate files in directory '%s'" @@ -377,15 +391,15 @@ msgstr "Kann Thread nicht starten: Fehler beim Schreiben der TLS." msgid "Can not suspend thread %x" msgstr "Kann Thread %x nicht anhalten." -#: ../src/msw/thread.cpp:823 +#: ../src/msw/thread.cpp:817 msgid "Can not wait for thread termination" msgstr "Kann nicht auf Threadende warten" -#: ../src/common/docview.cpp:1872 +#: ../src/common/docview.cpp:1874 msgid "Can't &Undo " msgstr "Kann nicht rückgängig machen " -#: ../src/common/image.cpp:713 +#: ../src/common/image.cpp:715 #, c-format msgid "Can't check image format of file '%s': file does not exist." msgstr "" @@ -400,7 +414,7 @@ msgstr "Kann Datei '%s' nicht anlegen." msgid "Can't copy values of unsupported type %d." msgstr "" -#: ../src/msw/listctrl.cpp:207 +#: ../src/msw/listctrl.cpp:212 msgid "Can't create list control window, check that comctl32.dll is installed." msgstr "" @@ -422,39 +436,39 @@ msgstr "" msgid "Can't create thread" msgstr "Kann Thread nicht erzeugen" -#: ../src/msw/window.cpp:2372 +#: ../src/msw/window.cpp:2381 #, c-format msgid "" "Can't create window of class %s!\n" "Possible Windows 3.x compatibility problem?" msgstr "" -#: ../src/msw/registry.cpp:656 +#: ../src/msw/registry.cpp:653 #, fuzzy, c-format msgid "Can't delete key '%s'" msgstr "Kann Wert von Eintrag '%s' nicht löschen" -#: ../src/msw/iniconf.cpp:463 +#: ../src/msw/iniconf.cpp:474 #, c-format msgid "Can't delete the INI file '%s'" msgstr "Kann INI-Datei '%s' nicht löschen" -#: ../src/msw/registry.cpp:681 +#: ../src/msw/registry.cpp:678 #, fuzzy, c-format msgid "Can't delete value '%s' from key '%s'" msgstr "Kann Wert '%s' von Eintrag '%s' nicht löschen." -#: ../src/msw/registry.cpp:692 +#: ../src/msw/registry.cpp:689 #, fuzzy, c-format msgid "Can't delete value of key '%s'" msgstr "Kann Wert von Eintrag '%s' nicht löschen" -#: ../src/msw/registry.cpp:992 +#: ../src/msw/registry.cpp:988 #, fuzzy, c-format msgid "Can't enumerate subkeys of key '%s'" msgstr "Kann Untereinträge von '%s' nicht auflisten" -#: ../src/msw/registry.cpp:947 +#: ../src/msw/registry.cpp:943 #, fuzzy, c-format msgid "Can't enumerate values of key '%s'" msgstr "Kann Werte von Eintrag '%s' nicht auflisten" @@ -469,13 +483,13 @@ msgstr "Kann Befehl '%s' nicht ausf msgid "Can't find current position in file '%s'" msgstr "Kann Konfigurationsdatei '%s' nicht öffnen." -#: ../src/msw/window.cpp:2325 +#: ../src/msw/window.cpp:2331 msgid "" "Can't find dummy dialog template!\n" "Check resource include path for finding wx.rc." msgstr "" -#: ../src/common/object.cpp:321 ../src/common/object.cpp:342 +#: ../src/common/object.cpp:309 ../src/common/object.cpp:330 #, c-format msgid "Can't find the serialization object '%s' for the object '%s'." msgstr "Kann Serialisierungsobjekt '%s' für Object '%s' nicht finden." @@ -490,7 +504,7 @@ msgstr "" msgid "Can't load image from file '%s': file does not exist." msgstr "" -#: ../src/common/object.cpp:314 +#: ../src/common/object.cpp:302 msgid "Can't load wxSerial dynamic library." msgstr "Kann wxSerial DLL nicht laden." @@ -504,17 +518,17 @@ msgstr "Kann Datei '%s' nicht msgid "Can't open registry key '%s'" msgstr "Kann Datei '%s' nicht öffnen" -#: ../src/msw/registry.cpp:871 +#: ../src/msw/registry.cpp:867 #, fuzzy, c-format msgid "Can't read value of '%s'" msgstr "Kann Wert von Eintrag '%s' nicht löschen" -#: ../src/msw/registry.cpp:770 ../src/msw/registry.cpp:809 +#: ../src/msw/registry.cpp:766 ../src/msw/registry.cpp:805 #, fuzzy, c-format msgid "Can't read value of key '%s'" msgstr "Kann Wert von Eintrag '%s' nicht löschen" -#: ../src/generic/logg.cpp:522 +#: ../src/generic/logg.cpp:533 msgid "Can't save log contents to file." msgstr "Kann Logtexte nicht in Datei sichern." @@ -522,18 +536,18 @@ msgstr "Kann Logtexte nicht in Datei sichern." msgid "Can't set thread priority" msgstr "Kann Thread-Priorität nicht setzen" -#: ../src/msw/registry.cpp:795 ../src/msw/registry.cpp:895 +#: ../src/msw/registry.cpp:791 ../src/msw/registry.cpp:891 #, fuzzy, c-format msgid "Can't set value of '%s'" msgstr "Kann Wert von Eintrag '%s' nicht löschen" #: ../src/common/dlgcmn.cpp:146 ../src/common/prntbase.cpp:107 -#: ../src/generic/dcpsg.cpp:2192 ../src/generic/dirdlgg.cpp:413 -#: ../src/generic/filedlgg.cpp:911 ../src/generic/fontdlgg.cpp:257 -#: ../src/generic/prntdlgg.cpp:468 ../src/generic/progdlgg.cpp:182 +#: ../src/generic/dcpsg.cpp:2192 ../src/generic/dirdlgg.cpp:424 +#: ../src/generic/filedlgg.cpp:913 ../src/generic/fontdlgg.cpp:257 +#: ../src/generic/prntdlgg.cpp:468 ../src/generic/progdlgg.cpp:179 #: ../src/generic/proplist.cpp:523 ../src/generic/wizard.cpp:174 #: ../src/gtk/filedlg.cpp:164 ../src/gtk/fontdlg.cpp:178 -#: ../src/html/helpfrm.cpp:887 ../src/motif/msgdlg.cpp:178 +#: ../src/html/helpfrm.cpp:910 ../src/motif/msgdlg.cpp:178 msgid "Cancel" msgstr "Abbruch" @@ -542,7 +556,7 @@ msgstr "Abbruch" msgid "Cannot find active dialup connection: %s" msgstr "" -#: ../src/msw/dialup.cpp:829 +#: ../src/msw/dialup.cpp:827 msgid "Cannot find the location of address book file" msgstr "" @@ -551,19 +565,19 @@ msgstr "" msgid "Cannot get priority range for scheduling policy %d." msgstr "" -#: ../src/unix/utilsunx.cpp:691 +#: ../src/unix/utilsunx.cpp:692 msgid "Cannot get the hostname" msgstr "" -#: ../src/unix/utilsunx.cpp:727 +#: ../src/unix/utilsunx.cpp:728 msgid "Cannot get the official hostname" msgstr "" -#: ../src/msw/dialup.cpp:922 +#: ../src/msw/dialup.cpp:920 msgid "Cannot hang up - no active dialup connection." msgstr "" -#: ../src/msw/app.cpp:220 +#: ../src/msw/app.cpp:229 msgid "Cannot initialize OLE" msgstr "Kann OLE nicht initialisiern" @@ -596,6 +610,10 @@ msgstr "" msgid "Cannot open index file: %s" msgstr "Kann Datei nicht öffnen!" +#: ../src/html/helpfrm.cpp:1174 +msgid "Cannot print empty page." +msgstr "" + #: ../src/unix/threadpsx.cpp:935 msgid "Cannot retrieve thread scheduling policy." msgstr "" @@ -604,15 +622,15 @@ msgstr "" msgid "Cannot start thread: error writing TLS" msgstr "" -#: ../src/html/helpfrm.cpp:393 +#: ../src/html/helpfrm.cpp:398 msgid "Case sensitive" msgstr "" -#: ../src/common/fontmap.cpp:89 +#: ../src/common/fontmap.cpp:97 msgid "Central European (ISO-8859-2/Latin 2)" msgstr "" -#: ../src/msw/dialup.cpp:763 +#: ../src/msw/dialup.cpp:762 msgid "Choose ISP to dial" msgstr "" @@ -620,25 +638,25 @@ msgstr "" msgid "Choose font" msgstr "" -#: ../src/generic/logg.cpp:433 +#: ../src/generic/logg.cpp:444 msgid "Clear the log contents" msgstr "Logtexte löschen" -#: ../src/common/prntbase.cpp:357 ../src/generic/progdlgg.cpp:309 +#: ../src/common/prntbase.cpp:357 ../src/generic/progdlgg.cpp:307 #: ../src/generic/proplist.cpp:518 msgid "Close" msgstr "Schließen" -#: ../src/generic/logg.cpp:435 +#: ../src/generic/logg.cpp:446 msgid "Close this window" msgstr "Fenster schließen" -#: ../src/common/fileconf.cpp:743 +#: ../src/common/fileconf.cpp:742 #, c-format msgid "Config entry name cannot start with '%c'." msgstr "" -#: ../src/generic/filedlgg.cpp:1070 ../src/gtk/filedlg.cpp:75 +#: ../src/generic/filedlgg.cpp:1074 ../src/gtk/filedlg.cpp:75 msgid "Confirm" msgstr "Bestätigen" @@ -652,8 +670,8 @@ msgstr "Drucke..." msgid "Connection to wxHelp timed out in %d seconds" msgstr "Verbindung mit wxHelp nach %d Sekunden abgebrochen" -#: ../src/generic/helpwxht.cpp:158 ../src/html/helpfrm.cpp:298 -#: ../src/html/helpfrm.cpp:307 +#: ../src/generic/helpwxht.cpp:158 ../src/html/helpfrm.cpp:303 +#: ../src/html/helpfrm.cpp:312 msgid "Contents" msgstr "" @@ -661,8 +679,8 @@ msgstr "" msgid "Copies:" msgstr "Kopien:" -#: ../src/common/resourc2.cpp:287 ../src/common/resource.cpp:1791 -#: ../src/common/resource.cpp:1921 +#: ../src/common/resourc2.cpp:287 ../src/common/resource.cpp:1787 +#: ../src/common/resource.cpp:1917 #, c-format msgid "Could not find resource include file %s." msgstr "Konnte Resourcedatei %s nicht finden." @@ -671,7 +689,7 @@ msgstr "Konnte Resourcedatei %s nicht finden." msgid "Could not find tab for id" msgstr "Konnte Seite für Id nicht finden" -#: ../src/msw/textctrl.cpp:1126 +#: ../src/msw/textctrl.cpp:1121 #, c-format msgid "Could not load Rich Edit DLL '%s'" msgstr "" @@ -686,7 +704,7 @@ msgstr "" "Zahl\n" " oder ein #define." -#: ../src/common/resource.cpp:1234 +#: ../src/common/resource.cpp:1232 #, c-format msgid "" "Could not resolve menu id '%s'. Use (non-zero) integer instead\n" @@ -696,15 +714,15 @@ msgstr "" "Zahl\n" " oder ein #define." -#: ../src/common/prntbase.cpp:709 +#: ../src/common/prntbase.cpp:707 msgid "Could not start document preview." msgstr "Kann Druckvoransicht nicht starten." -#: ../src/generic/printps.cpp:200 ../src/msw/printwin.cpp:240 +#: ../src/generic/printps.cpp:200 ../src/msw/printwin.cpp:242 msgid "Could not start printing." msgstr "Kann Ausdruck nicht beginnen." -#: ../src/common/wincmn.cpp:762 +#: ../src/common/wincmn.cpp:781 msgid "Could not transfer data to window" msgstr "Kann Daten nicht ins Fenster übertragen." @@ -718,11 +736,15 @@ msgstr "Kann Mutex-Lock nicht bekommen" msgid "Couldn't add an image to the image list." msgstr "Kann Bild nicht zur Liste hinzufügen." +#: ../src/mac/thread.cpp:227 +msgid "Couldn't change the state of event object." +msgstr "Kann Zustand des Eventobjektes nicht ändern." + #: ../src/msw/timer.cpp:96 msgid "Couldn't create a timer" msgstr "Kann keinen Wecker anlegen." -#: ../src/common/dynlib.cpp:268 +#: ../src/common/dynlib.cpp:299 #, c-format msgid "Couldn't find symbol '%s' in a dynamic library" msgstr "" @@ -731,7 +753,7 @@ msgstr "" msgid "Couldn't get the current thread pointer" msgstr "Kann den aktuellen Threadzeiger nicht bekommen." -#: ../src/msw/utilsexc.cpp:594 +#: ../src/msw/utilsexc.cpp:596 #, c-format msgid "Couldn't launch DDE server '%s'." msgstr "" @@ -740,7 +762,7 @@ msgstr "" msgid "Couldn't load a PNG image - file is corrupted or not enough memory." msgstr "" -#: ../src/msw/ole/dataobj.cpp:139 +#: ../src/msw/ole/dataobj.cpp:151 #, fuzzy, c-format msgid "Couldn't register clipboard format '%s'." msgstr "Nicht unterstütztes Format in Zwischenablage." @@ -749,40 +771,40 @@ msgstr "Nicht unterst msgid "Couldn't release a mutex" msgstr "Kann Mutex nicht freigeben." -#: ../src/msw/listctrl.cpp:608 +#: ../src/msw/listctrl.cpp:612 #, c-format msgid "Couldn't retrieve information about list control item %d." msgstr "Kann keine Informationen über ListControl %d bekommen." -#: ../src/msw/thread.cpp:910 +#: ../src/msw/thread.cpp:904 msgid "Couldn't terminate thread" msgstr "Kann Thread nicht beenden" -#: ../src/generic/dirdlgg.cpp:500 +#: ../src/generic/dirdlgg.cpp:571 #, fuzzy msgid "Create directory" msgstr "Neues Verzeichnis anlegen" -#: ../src/generic/filedlgg.cpp:878 +#: ../src/generic/filedlgg.cpp:880 #, fuzzy msgid "Create new directory" msgstr "Neues Verzeichnis anlegen" -#: ../src/generic/filedlgg.cpp:885 +#: ../src/generic/filedlgg.cpp:887 #, fuzzy msgid "Current directory:" msgstr "Das Verzeichnis" -#: ../src/common/fontmap.cpp:92 +#: ../src/common/fontmap.cpp:100 msgid "Cyrillic (Latin 5)" msgstr "" -#: ../src/msw/dde.cpp:587 +#: ../src/msw/dde.cpp:586 #, fuzzy msgid "DDE poke request failed" msgstr "Konnte keine Pipe anlegen" -#: ../src/generic/filedlgg.cpp:533 +#: ../src/generic/filedlgg.cpp:535 msgid "Date" msgstr "" @@ -800,22 +822,22 @@ msgstr "" msgid "Did you know..." msgstr "" -#: ../src/common/filefn.cpp:1092 +#: ../src/common/filefn.cpp:1086 #, c-format msgid "Directory '%s' couldn't be created" msgstr "Verzeichnis '%s' konnte nicht angelegt werden." -#: ../src/generic/dirdlgg.cpp:467 +#: ../src/generic/dirdlgg.cpp:538 msgid "Directory does not exist" msgstr "Verzeichnis existiert nicht" -#: ../src/html/helpfrm.cpp:361 +#: ../src/html/helpfrm.cpp:366 msgid "" "Display all index items that contain given substring. Search is case " "insensitive." msgstr "" -#: ../src/html/helpfrm.cpp:512 +#: ../src/html/helpfrm.cpp:535 msgid "Display options dialog" msgstr "" @@ -828,11 +850,11 @@ msgstr "M msgid "Done" msgstr "" -#: ../src/generic/progdlgg.cpp:315 +#: ../src/generic/progdlgg.cpp:313 msgid "Done." msgstr "" -#: ../src/generic/progdlgg.cpp:156 +#: ../src/generic/progdlgg.cpp:153 msgid "Elapsed time : " msgstr "" @@ -840,7 +862,7 @@ msgstr "" msgid "Entries found" msgstr "Einträge gefunden" -#: ../src/common/config.cpp:342 +#: ../src/common/config.cpp:348 #, c-format msgid "" "Environment variables expansion failed: missing '%c' at position %d in '%s'." @@ -848,22 +870,22 @@ msgstr "" "Umgebungsvariablenexpansion schlug fehl: fehlendes '%c' an Position %d in " "'%s'." -#: ../src/generic/dcpsg.cpp:1541 ../src/generic/dirdlgg.cpp:263 -#: ../src/generic/dirdlgg.cpp:281 ../src/generic/dirdlgg.cpp:292 -#: ../src/generic/dirdlgg.cpp:533 ../src/generic/filedlgg.cpp:620 -#: ../src/generic/filedlgg.cpp:712 ../src/generic/filedlgg.cpp:726 -#: ../src/generic/filedlgg.cpp:739 ../src/generic/filedlgg.cpp:1036 -#: ../src/generic/filedlgg.cpp:1085 ../src/generic/helpxlp.cpp:241 -#: ../src/generic/logg.cpp:201 ../src/gtk/filedlg.cpp:83 +#: ../src/generic/dcpsg.cpp:1541 ../src/generic/dirdlgg.cpp:268 +#: ../src/generic/dirdlgg.cpp:286 ../src/generic/dirdlgg.cpp:297 +#: ../src/generic/dirdlgg.cpp:604 ../src/generic/filedlgg.cpp:622 +#: ../src/generic/filedlgg.cpp:714 ../src/generic/filedlgg.cpp:728 +#: ../src/generic/filedlgg.cpp:741 ../src/generic/filedlgg.cpp:1040 +#: ../src/generic/filedlgg.cpp:1089 ../src/generic/helpxlp.cpp:241 +#: ../src/generic/logg.cpp:180 ../src/gtk/filedlg.cpp:83 #: ../src/gtk/fontdlg.cpp:72 msgid "Error" msgstr "Fehler" -#: ../src/unix/utilsunx.cpp:803 ../src/unix/utilsunx.cpp:811 +#: ../src/unix/utilsunx.cpp:931 ../src/unix/utilsunx.cpp:939 msgid "Error " msgstr "" -#: ../src/generic/dirdlgg.cpp:480 +#: ../src/generic/dirdlgg.cpp:551 msgid "Error creating directory" msgstr "Fehler beim Anlegen des Verzeichnisses" @@ -871,15 +893,15 @@ msgstr "Fehler beim Anlegen des Verzeichnisses" msgid "Error: " msgstr "Fehler: " -#: ../src/common/fontmap.cpp:90 +#: ../src/common/fontmap.cpp:98 msgid "Esperanto (ISO-8859-3)" msgstr "" -#: ../src/generic/progdlgg.cpp:163 +#: ../src/generic/progdlgg.cpp:160 msgid "Estimated time : " msgstr "" -#: ../src/generic/dirdlgg.cpp:213 +#: ../src/generic/dirdlgg.cpp:217 msgid "Etcetera" msgstr "/etc" @@ -889,24 +911,24 @@ msgid "Execution of command '%s' failed" msgstr "Befehlsausführung '%s' schlug fehl" #: ../src/common/resourc2.cpp:326 ../src/common/resourc2.cpp:1399 -#: ../src/common/resource.cpp:1830 ../src/common/resource.cpp:1960 -#: ../src/common/resource.cpp:3045 +#: ../src/common/resource.cpp:1826 ../src/common/resource.cpp:1956 +#: ../src/common/resource.cpp:3040 msgid "Expected '*' whilst parsing resource." msgstr "Erwartete '*' beim Lesen der Resource." #: ../src/common/resourc2.cpp:342 ../src/common/resourc2.cpp:1415 -#: ../src/common/resource.cpp:1847 ../src/common/resource.cpp:1976 -#: ../src/common/resource.cpp:3062 +#: ../src/common/resource.cpp:1843 ../src/common/resource.cpp:1972 +#: ../src/common/resource.cpp:3057 msgid "Expected '=' whilst parsing resource." msgstr "" #: ../src/common/resourc2.cpp:312 ../src/common/resourc2.cpp:1385 -#: ../src/common/resource.cpp:1816 ../src/common/resource.cpp:1946 -#: ../src/common/resource.cpp:3031 +#: ../src/common/resource.cpp:1812 ../src/common/resource.cpp:1942 +#: ../src/common/resource.cpp:3026 msgid "Expected 'char' whilst parsing resource." msgstr "" -#: ../src/msw/dialup.cpp:857 +#: ../src/msw/dialup.cpp:855 #, c-format msgid "Failed to %s dialup connection: %s" msgstr "" @@ -915,11 +937,11 @@ msgstr "" msgid "Failed to close the clipboard." msgstr "Konnte Zwischenablage nicht schließen." -#: ../src/msw/dialup.cpp:798 +#: ../src/msw/dialup.cpp:796 msgid "Failed to connect: missing username/password." msgstr "" -#: ../src/msw/dialup.cpp:743 +#: ../src/msw/dialup.cpp:742 #, fuzzy msgid "Failed to connect: no ISP to dial." msgstr "Konnte Zwischenablage nicht öffnen." @@ -934,17 +956,17 @@ msgstr "" msgid "Failed to copy the contents of registry key '%s' to '%s'." msgstr "" -#: ../src/msw/dde.cpp:924 +#: ../src/msw/dde.cpp:923 #, fuzzy msgid "Failed to create DDE string" msgstr "Konnte Verzeichnis nicht anlegen " -#: ../src/msw/mdi.cpp:402 +#: ../src/msw/mdi.cpp:404 #, fuzzy msgid "Failed to create MDI parent frame." msgstr "Konnte Verzeichnis nicht anlegen " -#: ../src/msw/statbr95.cpp:123 +#: ../src/msw/statbr95.cpp:149 #, fuzzy msgid "Failed to create a status bar." msgstr "Konnte Verzeichnis nicht anlegen " @@ -955,10 +977,12 @@ msgid "Failed to create connection to server '%s' on topic '%s'" msgstr "" #: ../src/msw/dialog.cpp:177 -msgid "Failed to create dialog." +msgid "" +"Failed to create dialog. You probably forgot to include wx/msw/wx.rc in your " +"resources." msgstr "" -#: ../src/generic/dirdlgg.cpp:478 +#: ../src/generic/dirdlgg.cpp:549 msgid "Failed to create directory " msgstr "Konnte Verzeichnis nicht anlegen " @@ -971,42 +995,42 @@ msgstr "" msgid "Failed to empty the clipboard." msgstr "Konnte Zwischenablage nicht leeren." -#: ../src/msw/dde.cpp:606 +#: ../src/msw/dde.cpp:605 msgid "Failed to establish an advise loop with DDE server" msgstr "" -#: ../src/msw/dialup.cpp:636 +#: ../src/msw/dialup.cpp:635 #, c-format msgid "Failed to establish dialup connection: %s" msgstr "" -#: ../src/unix/utilsunx.cpp:430 ../src/unix/utilsunx.cpp:454 +#: ../src/unix/utilsunx.cpp:431 ../src/unix/utilsunx.cpp:455 #, fuzzy, c-format msgid "Failed to execute '%s'\n" msgstr "Kann '%s' nicht ausführen\n" -#: ../src/common/resourc2.cpp:808 ../src/common/resource.cpp:2449 +#: ../src/common/resourc2.cpp:808 ../src/common/resource.cpp:2445 #, c-format msgid "" "Failed to find XBM resource %s.\n" "Forgot to use wxResourceLoadBitmapData?" msgstr "" -#: ../src/common/resourc2.cpp:963 ../src/common/resource.cpp:2605 +#: ../src/common/resourc2.cpp:963 ../src/common/resource.cpp:2600 #, c-format msgid "" "Failed to find XBM resource %s.\n" "Forgot to use wxResourceLoadIconData?" msgstr "" -#: ../src/common/resourc2.cpp:824 ../src/common/resource.cpp:2465 +#: ../src/common/resourc2.cpp:824 ../src/common/resource.cpp:2461 #, c-format msgid "" "Failed to find XPM resource %s.\n" "Forgot to use wxResourceLoadBitmapData?" msgstr "" -#: ../src/msw/dialup.cpp:696 +#: ../src/msw/dialup.cpp:695 #, c-format msgid "Failed to get ISP names: %s" msgstr "" @@ -1031,7 +1055,7 @@ msgid "" "program" msgstr "" -#: ../src/common/dynlib.cpp:225 +#: ../src/common/dynlib.cpp:229 #, c-format msgid "Failed to load shared library '%s'" msgstr "" @@ -1045,7 +1069,7 @@ msgstr "Konnte Zwischenablage nicht msgid "Failed to put data on the clipboard" msgstr "Konnte Daten von der Zwischenablage nicht bekommen." -#: ../src/unix/utilsunx.cpp:523 +#: ../src/unix/utilsunx.cpp:524 msgid "Failed to redirect child process input/output" msgstr "" @@ -1054,7 +1078,7 @@ msgstr "" msgid "Failed to register DDE server '%s'" msgstr "Konnte Verzeichnis nicht anlegen " -#: ../src/common/fontmap.cpp:485 +#: ../src/common/fontmap.cpp:504 #, c-format msgid "Failed to remember the encoding for the charset '%s'." msgstr "" @@ -1073,7 +1097,7 @@ msgstr "" msgid "Failed to retrieve data from the clipboard." msgstr "Konnte Daten von der Zwischenablage nicht bekommen." -#: ../src/msw/dialup.cpp:458 +#: ../src/msw/dialup.cpp:459 #, fuzzy msgid "Failed to retrieve text of RAS error message" msgstr "Konnte Daten von der Zwischenablage nicht bekommen." @@ -1083,7 +1107,7 @@ msgstr "Konnte Daten von der Zwischenablage nicht bekommen." msgid "Failed to retrieve the supported clipboard formats" msgstr "Konnte Daten von der Zwischenablage nicht bekommen." -#: ../src/msw/dde.cpp:651 +#: ../src/msw/dde.cpp:650 msgid "Failed to send DDE advise notification" msgstr "" @@ -1096,7 +1120,7 @@ msgstr "Konnte Datein nicht in Zwischenablage kopieren." msgid "Failed to set thread priority %d." msgstr "" -#: ../src/common/fs_mem.cpp:165 +#: ../src/common/fs_mem.cpp:167 #, c-format msgid "Failed to store image '%s' to memory VFS!" msgstr "" @@ -1105,11 +1129,11 @@ msgstr "" msgid "Failed to terminate a thread." msgstr "" -#: ../src/msw/dde.cpp:625 +#: ../src/msw/dde.cpp:624 msgid "Failed to terminate the advise loop with DDE server" msgstr "" -#: ../src/msw/dialup.cpp:930 +#: ../src/msw/dialup.cpp:928 #, fuzzy, c-format msgid "Failed to terminate the dialup connection: %s" msgstr "Konnte Verzeichnis nicht anlegen " @@ -1119,11 +1143,11 @@ msgstr "Konnte Verzeichnis nicht anlegen " msgid "Failed to unregister DDE server '%s'" msgstr "Konnte Verzeichnis nicht anlegen " -#: ../src/msw/app.cpp:704 +#: ../src/msw/app.cpp:749 msgid "Fatal Error" msgstr "" -#: ../src/generic/logg.cpp:329 +#: ../src/generic/logg.cpp:340 msgid "Fatal error" msgstr "Nicht-behebbarer Fehler" @@ -1131,11 +1155,11 @@ msgstr "Nicht-behebbarer Fehler" msgid "Fatal error: " msgstr "Nicht-behebbarer Fehler" -#: ../src/msw/app.cpp:1199 +#: ../src/msw/app.cpp:1237 msgid "Fatal error: exiting" msgstr "" -#: ../src/generic/filedlgg.cpp:1067 ../src/gtk/filedlg.cpp:72 +#: ../src/generic/filedlgg.cpp:1071 ../src/gtk/filedlg.cpp:72 #, c-format msgid "File '%s' already exists, do you really want to overwrite it?" msgstr "Datei '%s' existiert bereits, möchten Sie sie wirklich überschreiben?" @@ -1149,7 +1173,7 @@ msgstr "Verzeichnis '%s' konnte nicht angelegt werden." msgid "File error" msgstr "Dateifehler" -#: ../src/generic/dirdlgg.cpp:281 ../src/generic/filedlgg.cpp:726 +#: ../src/generic/dirdlgg.cpp:286 ../src/generic/filedlgg.cpp:728 msgid "File name exists already." msgstr "" @@ -1158,12 +1182,12 @@ msgstr "" msgid "Files (%s)|%s" msgstr "Dateien (%s)|%s" -#: ../src/html/helpfrm.cpp:335 +#: ../src/html/helpfrm.cpp:340 #, fuzzy msgid "Find" msgstr "Gefunden " -#: ../src/html/helpfrm.cpp:866 +#: ../src/html/helpfrm.cpp:889 msgid "Fixed font:" msgstr "" @@ -1171,11 +1195,11 @@ msgstr "" msgid "Font" msgstr "Zeichensatz" -#: ../src/html/helpfrm.cpp:876 +#: ../src/html/helpfrm.cpp:899 msgid "Font size:" msgstr "" -#: ../src/unix/utilsunx.cpp:480 +#: ../src/unix/utilsunx.cpp:481 msgid "Fork failed" msgstr "" @@ -1184,12 +1208,12 @@ msgid "Forward" msgstr "" #: ../src/common/resourc2.cpp:295 ../src/common/resourc2.cpp:1368 -#: ../src/common/resource.cpp:1799 ../src/common/resource.cpp:1929 -#: ../src/common/resource.cpp:3014 +#: ../src/common/resource.cpp:1795 ../src/common/resource.cpp:1925 +#: ../src/common/resource.cpp:3009 msgid "Found " msgstr "Gefunden " -#: ../src/html/helpfrm.cpp:614 +#: ../src/html/helpfrm.cpp:637 #, c-format msgid "Found %i matches" msgstr "" @@ -1198,29 +1222,46 @@ msgstr "" msgid "From:" msgstr "Von:" -#: ../src/html/helpfrm.cpp:478 +#: ../src/common/imaggif.cpp:74 +msgid "GIF: data stream seems to be truncated." +msgstr "" + +#: ../src/common/imaggif.cpp:58 +#, fuzzy +msgid "GIF: error in GIF image format." +msgstr "Fehler beim Anlegen des Verzeichnisses" + +#: ../src/common/imaggif.cpp:61 +msgid "GIF: not enough memory." +msgstr "" + +#: ../src/common/imaggif.cpp:64 +msgid "GIF: unknown error!!!" +msgstr "" + +#: ../src/html/helpfrm.cpp:501 msgid "Go back" msgstr "" -#: ../src/html/helpfrm.cpp:481 +#: ../src/html/helpfrm.cpp:504 msgid "Go forward" msgstr "" -#: ../src/html/helpfrm.cpp:486 +#: ../src/html/helpfrm.cpp:509 msgid "Go one level up in document hierarchy" msgstr "" -#: ../src/generic/filedlgg.cpp:870 +#: ../src/generic/filedlgg.cpp:872 #, fuzzy msgid "Go to home directory" msgstr "Das Verzeichnis" -#: ../src/generic/filedlgg.cpp:864 +#: ../src/generic/filedlgg.cpp:866 #, fuzzy msgid "Go to parent directory" msgstr "Konnte Verzeichnis nicht anlegen " -#: ../src/common/fontmap.cpp:94 +#: ../src/common/fontmap.cpp:102 msgid "Greek (ISO-8859-7)" msgstr "" @@ -1229,16 +1270,23 @@ msgstr "" msgid "HTML anchor %s does not exist." msgstr "Verzeichnis existiert nicht" -#: ../src/common/fontmap.cpp:95 +#: ../src/html/helpfrm.cpp:1188 +msgid "" +"HTML files (*.htm)|*.htm|HTML files (*.html)|*.html|Help books " +"(*.htb)|*.htb|Help books (*.zip)|*.zip|HTML Help Project (*.hhp)|*.hhp|All " +"files (*.*)|*" +msgstr "" + +#: ../src/common/fontmap.cpp:103 msgid "Hebrew (ISO-8859-8)" msgstr "" #: ../src/common/dlgcmn.cpp:142 ../src/generic/proplist.cpp:528 -#: ../src/html/helpfrm.cpp:205 +#: ../src/html/helpfrm.cpp:208 msgid "Help" msgstr "" -#: ../src/html/helpfrm.cpp:849 +#: ../src/html/helpfrm.cpp:872 msgid "Help Browser Options" msgstr "" @@ -1246,30 +1294,30 @@ msgstr "" msgid "Help Index" msgstr "Hilfeindex" -#: ../src/html/helpfrm.cpp:1147 +#: ../src/html/helpfrm.cpp:1172 #, fuzzy msgid "Help Printing" msgstr "Drucke" -#: ../src/generic/helpwxht.cpp:243 ../src/html/helpctrl.cpp:42 +#: ../src/generic/helpwxht.cpp:250 ../src/html/helpctrl.cpp:44 #, c-format msgid "Help: %s" msgstr "" -#: ../src/common/fontmap.cpp:99 +#: ../src/common/fontmap.cpp:107 msgid "ISO-8859-12" msgstr "" -#: ../src/common/fontmap.cpp:100 +#: ../src/common/fontmap.cpp:108 msgid "ISO-8859-13" msgstr "" -#: ../src/common/fontmap.cpp:101 +#: ../src/common/fontmap.cpp:109 msgid "ISO-8859-14" msgstr "" #: ../src/common/resourc2.cpp:997 ../src/common/resourc2.cpp:1008 -#: ../src/common/resource.cpp:2639 ../src/common/resource.cpp:2650 +#: ../src/common/resource.cpp:2634 ../src/common/resource.cpp:2645 #, c-format msgid "Icon resource specification %s not found." msgstr "" @@ -1278,22 +1326,22 @@ msgstr "" msgid "Ill-formed resource file syntax." msgstr "" -#: ../src/generic/dirdlgg.cpp:263 ../src/generic/filedlgg.cpp:712 +#: ../src/generic/dirdlgg.cpp:268 ../src/generic/filedlgg.cpp:714 #, fuzzy msgid "Illegal directory name." msgstr "Das Verzeichnis" -#: ../src/generic/filedlgg.cpp:1036 +#: ../src/generic/filedlgg.cpp:1040 msgid "Illegal file specification." msgstr "" -#: ../src/msw/textctrl.cpp:215 +#: ../src/msw/textctrl.cpp:216 msgid "" "Impossible to create a rich edit control, using simple text control instead. " "Please reinstall riched32.dll" msgstr "" -#: ../src/unix/utilsunx.cpp:343 +#: ../src/unix/utilsunx.cpp:344 msgid "Impossible to get child process input" msgstr "" @@ -1301,12 +1349,12 @@ msgstr "" msgid "Incorrect version of HTML help book" msgstr "" -#: ../src/html/helpfrm.cpp:367 +#: ../src/html/helpfrm.cpp:372 #, fuzzy msgid "Index" msgstr "Hilfeindex" -#: ../src/generic/logg.cpp:209 +#: ../src/generic/logg.cpp:182 msgid "Information" msgstr "Information" @@ -1318,16 +1366,16 @@ msgstr "" msgid "Italic" msgstr "Kursiv" -#: ../src/common/imagjpeg.cpp:195 +#: ../src/common/imagjpeg.cpp:198 msgid "JPEG: Couldn't load - file is probably corrupted." msgstr "" -#: ../src/common/imagjpeg.cpp:312 +#: ../src/common/imagjpeg.cpp:315 #, fuzzy msgid "JPEG: Couldn't save image." msgstr "Kann keinen Wecker anlegen." -#: ../src/common/fontmap.cpp:103 +#: ../src/common/fontmap.cpp:111 msgid "KOI8-R" msgstr "" @@ -1344,7 +1392,7 @@ msgstr "Linker Rand (mm):" msgid "Light" msgstr "Dünn" -#: ../src/generic/filedlgg.cpp:1263 ../src/gtk/filedlg.cpp:241 +#: ../src/generic/filedlgg.cpp:1267 ../src/gtk/filedlg.cpp:241 #: ../src/motif/filedlg.cpp:351 ../src/msw/filedlg.cpp:438 #, c-format msgid "Load %s file" @@ -1363,29 +1411,25 @@ msgstr "" msgid "Loading Grey Raw PNM image is not yet implemented." msgstr "" -#: ../src/generic/logg.cpp:525 +#: ../src/generic/logg.cpp:536 #, c-format msgid "Log saved to the file '%s'." msgstr "Logtext in Datei '%s' gesichert." -#: ../src/gtk/mdi.cpp:420 +#: ../src/gtk/mdi.cpp:422 msgid "MDI child" msgstr "" -#: ../src/unix/mimetype.cpp:1540 +#: ../src/unix/mimetype.cpp:1541 #, c-format msgid "Mailcap file %s, line %d: incomplete entry ignored." msgstr "Mailcap-Datei %s, Zeile %d: unvollständiger Eintrag ignoriert." -#: ../src/common/fs_mem.cpp:142 +#: ../src/common/fs_mem.cpp:144 #, c-format msgid "Memory VFS already contains file '%s'!" msgstr "" -#: ../src/generic/logg.cpp:763 -msgid "Message" -msgstr "" - #: ../src/unix/mimetype.cpp:1261 #, c-format msgid "Mime.types file %s, line %d: unterminated quoted string." @@ -1400,32 +1444,32 @@ msgstr "" msgid "More..." msgstr "Neu..." -#: ../src/generic/dirdlgg.cpp:209 +#: ../src/generic/dirdlgg.cpp:213 msgid "Mounted Devices" msgstr "Dateisysteme" -#: ../src/generic/dirdlgg.cpp:204 +#: ../src/generic/dirdlgg.cpp:208 msgid "My Harddisk" msgstr "" -#: ../src/generic/dirdlgg.cpp:208 +#: ../src/generic/dirdlgg.cpp:212 msgid "My Home" msgstr "Mein Verzeichnis" -#: ../src/generic/filedlgg.cpp:531 +#: ../src/generic/filedlgg.cpp:533 #, fuzzy msgid "Name" msgstr "am" -#: ../src/generic/dirdlgg.cpp:415 +#: ../src/generic/dirdlgg.cpp:426 msgid "New..." msgstr "Neu..." -#: ../src/generic/filedlgg.cpp:605 +#: ../src/generic/filedlgg.cpp:607 msgid "NewName" msgstr "" -#: ../src/html/helpfrm.cpp:492 +#: ../src/html/helpfrm.cpp:515 msgid "Next page" msgstr "" @@ -1435,15 +1479,15 @@ msgid "No" msgstr "Nein" #: ../src/common/resourc2.cpp:814 ../src/common/resourc2.cpp:969 -#: ../src/common/resource.cpp:2455 ../src/common/resource.cpp:2611 +#: ../src/common/resource.cpp:2451 ../src/common/resource.cpp:2606 msgid "No XBM facility available!" msgstr "" -#: ../src/common/resourc2.cpp:830 ../src/common/resource.cpp:2471 +#: ../src/common/resourc2.cpp:830 ../src/common/resource.cpp:2466 msgid "No XPM facility available!" msgstr "" -#: ../src/common/resourc2.cpp:991 ../src/common/resource.cpp:2633 +#: ../src/common/resourc2.cpp:991 ../src/common/resource.cpp:2628 msgid "No XPM icon facility available!" msgstr "" @@ -1465,7 +1509,7 @@ msgstr "" msgid "No image handler for type %s defined." msgstr "" -#: ../src/html/helpfrm.cpp:605 +#: ../src/html/helpfrm.cpp:628 msgid "No matching page found yet" msgstr "" @@ -1473,38 +1517,39 @@ msgstr "" msgid "Normal" msgstr "" -#: ../src/html/helpfrm.cpp:858 +#: ../src/html/helpfrm.cpp:881 msgid "Normal font:" msgstr "" #: ../src/common/dlgcmn.cpp:125 ../src/generic/dcpsg.cpp:2191 -#: ../src/generic/dirdlgg.cpp:411 ../src/generic/filedlgg.cpp:902 -#: ../src/generic/fontdlgg.cpp:256 ../src/generic/prntdlgg.cpp:467 -#: ../src/generic/proplist.cpp:511 ../src/gtk/filedlg.cpp:158 -#: ../src/gtk/fontdlg.cpp:172 ../src/html/helpfrm.cpp:886 +#: ../src/generic/dirdlgg.cpp:422 ../src/generic/filedlgg.cpp:904 +#: ../src/generic/fontdlgg.cpp:256 ../src/generic/logg.cpp:714 +#: ../src/generic/prntdlgg.cpp:467 ../src/generic/proplist.cpp:511 +#: ../src/gtk/filedlg.cpp:158 ../src/gtk/fontdlg.cpp:172 +#: ../src/html/helpfrm.cpp:909 msgid "OK" msgstr "" -#: ../src/html/helpfrm.cpp:500 ../src/html/helpfrm.cpp:1155 +#: ../src/html/helpfrm.cpp:523 ../src/html/helpfrm.cpp:1183 msgid "Open HTML document" msgstr "" -#: ../src/generic/dirdlgg.cpp:292 ../src/generic/dirdlgg.cpp:533 -#: ../src/generic/filedlgg.cpp:620 ../src/generic/filedlgg.cpp:739 +#: ../src/generic/dirdlgg.cpp:297 ../src/generic/dirdlgg.cpp:604 +#: ../src/generic/filedlgg.cpp:622 ../src/generic/filedlgg.cpp:741 msgid "Operation not permitted." msgstr "" -#: ../src/common/cmdline.cpp:592 +#: ../src/common/cmdline.cpp:590 #, fuzzy, c-format msgid "Option '%s' requires a value, '=' expected." msgstr "Datei '%s', Zeile %d: '=' erwartet." -#: ../src/common/cmdline.cpp:612 +#: ../src/common/cmdline.cpp:609 #, c-format msgid "Option '%s' requires a value." msgstr "" -#: ../src/common/cmdline.cpp:668 +#: ../src/common/cmdline.cpp:663 #, c-format msgid "Option '%s': '%s' cannot be converted to a date." msgstr "" @@ -1517,10 +1562,32 @@ msgstr "Optionen" msgid "Orientation" msgstr "Orientierung" +#: ../src/common/imagpcx.cpp:448 ../src/common/imagpcx.cpp:471 +#, fuzzy +msgid "PCX: couldn't allocate memory" +msgstr "Kann keinen Wecker anlegen." + +#: ../src/common/imagpcx.cpp:447 +msgid "PCX: image format unsupported" +msgstr "" + +#: ../src/common/imagpcx.cpp:470 +#, fuzzy +msgid "PCX: invalid image" +msgstr "ungültiger Tag" + #: ../src/common/imagpcx.cpp:434 msgid "PCX: this is not a PCX file." msgstr "" +#: ../src/common/imagpcx.cpp:450 ../src/common/imagpcx.cpp:472 +msgid "PCX: unknown error !!!" +msgstr "" + +#: ../src/common/imagpcx.cpp:449 +msgid "PCX: version number too low" +msgstr "" + #: ../src/common/imagpnm.cpp:96 #, fuzzy msgid "PNM: Couldn't allocate memory." @@ -1534,12 +1601,12 @@ msgstr "" msgid "PNM: File seems truncated." msgstr "" -#: ../src/common/prntbase.cpp:729 +#: ../src/common/prntbase.cpp:727 #, c-format msgid "Page %d" msgstr "Seite %d" -#: ../src/common/prntbase.cpp:727 +#: ../src/common/prntbase.cpp:725 #, c-format msgid "Page %d of %d" msgstr "Seite %d aus %d" @@ -1563,11 +1630,11 @@ msgstr "Papierformat" msgid "Paper size" msgstr "Papierformat" -#: ../src/generic/filedlgg.cpp:535 +#: ../src/generic/filedlgg.cpp:537 msgid "Permissions" msgstr "" -#: ../src/unix/utilsunx.cpp:429 ../src/unix/utilsunx.cpp:453 +#: ../src/unix/utilsunx.cpp:430 ../src/unix/utilsunx.cpp:454 msgid "Pipe creation failed" msgstr "Konnte keine Pipe anlegen" @@ -1576,11 +1643,11 @@ msgstr "Konnte keine Pipe anlegen" msgid "Please choose a valid font." msgstr "Bitte wählen Sie eine bestehende Datei." -#: ../src/generic/filedlgg.cpp:1085 ../src/gtk/filedlg.cpp:83 +#: ../src/generic/filedlgg.cpp:1089 ../src/gtk/filedlg.cpp:83 msgid "Please choose an existing file." msgstr "Bitte wählen Sie eine bestehende Datei." -#: ../src/msw/dialup.cpp:764 +#: ../src/msw/dialup.cpp:763 msgid "Please choose which ISP do you want to connect to" msgstr "" @@ -1609,17 +1676,17 @@ msgstr "" msgid "Preview Only" msgstr "Nur Voransicht" -#: ../src/html/helpfrm.cpp:880 +#: ../src/html/helpfrm.cpp:903 #, fuzzy msgid "Preview:" msgstr "Nur Voransicht" -#: ../src/html/htmprint.cpp:479 +#: ../src/html/htmprint.cpp:486 #, fuzzy msgid "Previewing" msgstr "Nur Voransicht" -#: ../src/html/helpfrm.cpp:489 +#: ../src/html/helpfrm.cpp:512 msgid "Previous page" msgstr "" @@ -1631,11 +1698,11 @@ msgstr "Drucken" msgid "Print Error" msgstr "Fehler beim Drucken" -#: ../src/common/docview.cpp:884 +#: ../src/common/docview.cpp:887 msgid "Print Preview" msgstr "Druckvoransicht" -#: ../src/common/prntbase.cpp:685 ../src/common/prntbase.cpp:709 +#: ../src/common/prntbase.cpp:683 ../src/common/prntbase.cpp:707 msgid "Print Preview Failure" msgstr "Fehler bei Druckvoransicht" @@ -1655,7 +1722,7 @@ msgstr "In Farbe drucken" msgid "Print spooling" msgstr "Druckersteuerung" -#: ../src/html/helpfrm.cpp:506 +#: ../src/html/helpfrm.cpp:529 #, fuzzy msgid "Print this page" msgstr "Seitenbereich" @@ -1697,7 +1764,7 @@ msgid "Printer..." msgstr "Drucker..." #: ../src/common/prntbase.cpp:104 ../src/common/prntbase.cpp:146 -#: ../src/html/htmprint.cpp:500 +#: ../src/html/htmprint.cpp:507 msgid "Printing" msgstr "Drucke" @@ -1718,7 +1785,7 @@ msgstr "Drucke..." msgid "Program aborted." msgstr "Programm abgebrochen." -#: ../src/generic/logg.cpp:477 +#: ../src/generic/logg.cpp:488 msgid "Question" msgstr "Frage" @@ -1737,7 +1804,7 @@ msgstr "" msgid "Registry key '%s' does not exist, cannot rename it." msgstr "" -#: ../src/msw/registry.cpp:624 +#: ../src/msw/registry.cpp:623 #, c-format msgid "" "Registry key '%s' is needed for normal system operation,\n" @@ -1754,11 +1821,11 @@ msgstr "" msgid "Relevant entries:" msgstr "Relevante Einträge:" -#: ../src/generic/progdlgg.cpp:170 +#: ../src/generic/progdlgg.cpp:167 msgid "Remaining time : " msgstr "" -#: ../src/html/helpfrm.cpp:264 +#: ../src/html/helpfrm.cpp:269 msgid "Remove current page from bookmarks" msgstr "" @@ -1775,7 +1842,7 @@ msgstr "Rechter Rand (mm):" msgid "Roman" msgstr "Römisch" -#: ../src/generic/filedlgg.cpp:1279 ../src/gtk/filedlg.cpp:257 +#: ../src/generic/filedlgg.cpp:1283 ../src/gtk/filedlg.cpp:257 #: ../src/motif/filedlg.cpp:353 ../src/msw/filedlg.cpp:439 #, c-format msgid "Save %s file" @@ -1785,7 +1852,7 @@ msgstr "Datei %s sichern" msgid "Save as" msgstr "Sichern als" -#: ../src/generic/logg.cpp:431 +#: ../src/generic/logg.cpp:442 msgid "Save log contents to file" msgstr "Logtexte in Datei sichern" @@ -1793,27 +1860,27 @@ msgstr "Logtexte in Datei sichern" msgid "Script" msgstr "" -#: ../src/generic/helpwxht.cpp:160 ../src/html/helpfrm.cpp:409 -#: ../src/html/helpfrm.cpp:429 +#: ../src/generic/helpwxht.cpp:160 ../src/html/helpfrm.cpp:414 +#: ../src/html/helpfrm.cpp:434 msgid "Search" msgstr "" -#: ../src/html/helpfrm.cpp:411 +#: ../src/html/helpfrm.cpp:416 msgid "" "Search contents of help book(s) for all occurences of the text you typed " "above" msgstr "" -#: ../src/html/helpfrm.cpp:712 +#: ../src/html/helpfrm.cpp:735 msgid "Search in all books" msgstr "" -#: ../src/html/helpfrm.cpp:605 +#: ../src/html/helpfrm.cpp:628 #, fuzzy msgid "Searching..." msgstr "Drucke..." -#: ../src/generic/dirdlgg.cpp:187 +#: ../src/generic/dirdlgg.cpp:191 #, fuzzy msgid "Sections" msgstr "Optionen" @@ -1823,15 +1890,15 @@ msgstr "Optionen" msgid "Seek error on file '%s'" msgstr "Kann Datei '%s' nicht öffnen" -#: ../src/common/docview.cpp:1414 +#: ../src/common/docview.cpp:1417 msgid "Select a document template" msgstr "" -#: ../src/common/docview.cpp:1437 +#: ../src/common/docview.cpp:1440 msgid "Select a document view" msgstr "" -#: ../src/common/docview.cpp:1332 ../src/common/docview.cpp:1369 +#: ../src/common/docview.cpp:1335 ../src/common/docview.cpp:1372 msgid "Select a file" msgstr "" @@ -1852,23 +1919,23 @@ msgstr "Einstellungen..." msgid "Several active dialup connections found, choosing one randomly." msgstr "" -#: ../src/html/helpfrm.cpp:326 +#: ../src/html/helpfrm.cpp:331 msgid "Show all" msgstr "" -#: ../src/html/helpfrm.cpp:360 +#: ../src/html/helpfrm.cpp:365 msgid "Show all items in index" msgstr "" -#: ../src/generic/filedlgg.cpp:908 +#: ../src/generic/filedlgg.cpp:910 msgid "Show hidden files" msgstr "" -#: ../src/html/helpfrm.cpp:473 +#: ../src/html/helpfrm.cpp:496 msgid "Show/hide navigation panel" msgstr "" -#: ../src/generic/filedlgg.cpp:532 +#: ../src/generic/filedlgg.cpp:534 msgid "Size" msgstr "" @@ -1888,11 +1955,11 @@ msgstr "" msgid "Sorry, could not save this file." msgstr "" -#: ../src/common/prntbase.cpp:685 +#: ../src/common/prntbase.cpp:683 msgid "Sorry, not enough memory to create a preview." msgstr "Nicht genug Speicher für Voransicht." -#: ../src/generic/logg.cpp:585 +#: ../src/generic/logg.cpp:596 msgid "Status: " msgstr "" @@ -1918,23 +1985,23 @@ msgstr "Fehler beim Anlegen des Verzeichnisses" msgid "Teletype" msgstr "Schreibmaschine" -#: ../src/common/docview.cpp:1414 +#: ../src/common/docview.cpp:1417 msgid "Templates" msgstr "" -#: ../src/generic/dirdlgg.cpp:214 +#: ../src/generic/dirdlgg.cpp:218 msgid "Temporary" msgstr "" -#: ../src/common/fontmap.cpp:98 +#: ../src/common/fontmap.cpp:106 msgid "Thai (ISO-8859-11)" msgstr "" -#: ../src/generic/dirdlgg.cpp:206 +#: ../src/generic/dirdlgg.cpp:210 msgid "The Computer" msgstr "Der Computer" -#: ../src/common/fontmap.cpp:442 +#: ../src/common/fontmap.cpp:463 #, c-format msgid "" "The charset '%s' is unknown. You may select\n" @@ -1942,16 +2009,16 @@ msgid "" "[Cancel] if it cannot be replaced" msgstr "" -#: ../src/msw/ole/dataobj.cpp:157 +#: ../src/msw/ole/dataobj.cpp:169 #, c-format msgid "The clipboard format '%d' doesn't exist." msgstr "" -#: ../src/generic/dirdlgg.cpp:464 +#: ../src/generic/dirdlgg.cpp:535 msgid "The directory " msgstr "Das Verzeichnis" -#: ../src/common/fontmap.cpp:602 +#: ../src/common/fontmap.cpp:626 #, c-format msgid "" "The encoding '%s' is unknown.\n" @@ -1959,14 +2026,14 @@ msgid "" "(otherwise the text in this encoding will not be shown correctly)?" msgstr "" -#: ../src/common/docview.cpp:1619 +#: ../src/common/docview.cpp:1622 #, c-format msgid "" "The file '%s' doesn't exist and couldn't be opened.\n" "It has been also removed from the MRU files list." msgstr "" -#: ../src/common/cmdline.cpp:761 +#: ../src/common/cmdline.cpp:753 #, c-format msgid "The required parameter '%s' was not specified." msgstr "" @@ -1975,41 +2042,41 @@ msgstr "" msgid "The text couldn't be saved." msgstr "" -#: ../src/common/cmdline.cpp:740 +#: ../src/common/cmdline.cpp:732 #, c-format msgid "The value for the option '%s' must be specified." msgstr "" -#: ../src/msw/dialup.cpp:412 +#: ../src/msw/dialup.cpp:411 #, c-format msgid "" -"The version of remote access service (RAS) installed on this machine is too " -"old, please upgrade (the following required function is missing: %s)." +"The version of remote access service (RAS) installed on this machine is " +"tooold, please upgrade (the following required function is missing: %s)." msgstr "" -#: ../src/html/htmprint.cpp:479 +#: ../src/html/htmprint.cpp:486 msgid "" "There was a problem previewing.\n" "Perhaps your current printer is not set correctly?" msgstr "" -#: ../src/html/htmprint.cpp:500 +#: ../src/html/htmprint.cpp:507 msgid "" "There was a problem printing.\n" "Perhaps your current printer is not set correctly?" msgstr "" -#: ../src/msw/thread.cpp:1037 +#: ../src/msw/thread.cpp:1029 msgid "" "Thread module initialization failed: can not store value in thread local " "storage" msgstr "" -#: ../src/unix/threadpsx.cpp:1440 +#: ../src/unix/threadpsx.cpp:1441 msgid "Thread module initialization failed: failed to create thread key" msgstr "" -#: ../src/msw/thread.cpp:1023 +#: ../src/msw/thread.cpp:1017 msgid "" "Thread module initialization failed: impossible to allocate index in thread " "local storage" @@ -2019,7 +2086,7 @@ msgstr "" msgid "Thread priority setting is ignored." msgstr "" -#: ../src/generic/filedlgg.cpp:534 ../src/generic/logg.cpp:764 +#: ../src/generic/filedlgg.cpp:536 msgid "Time" msgstr "" @@ -2039,7 +2106,7 @@ msgstr "Bis:" msgid "Top margin (mm):" msgstr "Oberer Rand (mm):" -#: ../src/common/fs_mem.cpp:200 +#: ../src/common/fs_mem.cpp:202 #, c-format msgid "Trying to remove file '%s' from memory VFS, but it is not loaded!" msgstr "" @@ -2048,7 +2115,7 @@ msgstr "" msgid "Trying to solve a NULL hostname: giving up" msgstr "" -#: ../src/common/fontmap.cpp:96 +#: ../src/common/fontmap.cpp:104 msgid "Turkish (ISO-8859-9)" msgstr "" @@ -2065,41 +2132,41 @@ msgstr "Unterstreichen" #: ../src/common/resourc2.cpp:335 ../src/common/resourc2.cpp:349 #: ../src/common/resourc2.cpp:1378 ../src/common/resourc2.cpp:1392 #: ../src/common/resourc2.cpp:1408 ../src/common/resourc2.cpp:1422 -#: ../src/common/resource.cpp:1809 ../src/common/resource.cpp:1823 -#: ../src/common/resource.cpp:1840 ../src/common/resource.cpp:1854 -#: ../src/common/resource.cpp:1939 ../src/common/resource.cpp:1953 -#: ../src/common/resource.cpp:1969 ../src/common/resource.cpp:1983 -#: ../src/common/resource.cpp:3024 ../src/common/resource.cpp:3038 -#: ../src/common/resource.cpp:3055 ../src/common/resource.cpp:3069 +#: ../src/common/resource.cpp:1805 ../src/common/resource.cpp:1819 +#: ../src/common/resource.cpp:1836 ../src/common/resource.cpp:1850 +#: ../src/common/resource.cpp:1935 ../src/common/resource.cpp:1949 +#: ../src/common/resource.cpp:1965 ../src/common/resource.cpp:1979 +#: ../src/common/resource.cpp:3019 ../src/common/resource.cpp:3033 +#: ../src/common/resource.cpp:3050 ../src/common/resource.cpp:3064 msgid "Unexpected end of file whilst parsing resource." msgstr "" -#: ../src/common/cmdline.cpp:712 +#: ../src/common/cmdline.cpp:704 #, c-format msgid "Unexpected parameter '%s'" msgstr "" -#: ../src/msw/dde.cpp:1020 +#: ../src/msw/dde.cpp:1019 #, c-format msgid "Unknown DDE error %08x" msgstr "" -#: ../src/common/fontmap.cpp:306 +#: ../src/common/fontmap.cpp:326 #, c-format msgid "Unknown encoding (%d)" msgstr "" -#: ../src/unix/mimetype.cpp:1303 +#: ../src/unix/mimetype.cpp:1304 #, c-format msgid "Unknown field in file %s, line %d: '%s'." msgstr "Unbekanntest Feld '%s' in Datei %s, Zeile %d." -#: ../src/common/cmdline.cpp:498 +#: ../src/common/cmdline.cpp:496 #, c-format msgid "Unknown long option '%s'" msgstr "" -#: ../src/common/cmdline.cpp:520 +#: ../src/common/cmdline.cpp:518 #, c-format msgid "Unknown option '%s'" msgstr "" @@ -2109,34 +2176,34 @@ msgstr "" msgid "Unmatched '{' in an entry for mime type %s." msgstr "Fehlendes '}' in Eintrag für MIME-Typ %s." -#: ../src/common/docview.cpp:1867 ../src/common/docview.cpp:1882 -#: ../src/common/docview.cpp:1909 +#: ../src/common/docview.cpp:1869 ../src/common/docview.cpp:1884 +#: ../src/common/docview.cpp:1911 msgid "Unnamed command" msgstr "" -#: ../src/common/resourc2.cpp:687 ../src/common/resource.cpp:2327 +#: ../src/common/resourc2.cpp:687 ../src/common/resource.cpp:2323 #, c-format msgid "Unrecognized style %s whilst parsing resource." msgstr "" -#: ../src/msw/app.cpp:702 -msgid "Unrecoverable program error detected: the application will terminate." +#: ../src/msw/app.cpp:748 +msgid "Unrecoverable program error detected: the application will terminate." msgstr "" #: ../src/msw/clipbrd.cpp:268 ../src/msw/clipbrd.cpp:369 msgid "Unsupported clipboard format." msgstr "Nicht unterstütztes Format in Zwischenablage." -#: ../src/common/cmdline.cpp:793 +#: ../src/common/cmdline.cpp:785 #, fuzzy, c-format msgid "Usage: %s" msgstr "Seite %d" -#: ../src/generic/dirdlgg.cpp:210 +#: ../src/generic/dirdlgg.cpp:215 msgid "User" msgstr "Benutzer" -#: ../src/generic/dirdlgg.cpp:211 +#: ../src/generic/dirdlgg.cpp:214 msgid "User Local" msgstr "Lokaler Benutzer" @@ -2144,28 +2211,28 @@ msgstr "Lokaler Benutzer" msgid "Validation conflict" msgstr "" -#: ../src/generic/dirdlgg.cpp:212 +#: ../src/generic/dirdlgg.cpp:216 msgid "Variables" msgstr "Variablen" -#: ../src/generic/filedlgg.cpp:856 +#: ../src/generic/filedlgg.cpp:858 msgid "View files as a detailed view" msgstr "" -#: ../src/generic/filedlgg.cpp:850 +#: ../src/generic/filedlgg.cpp:852 msgid "View files as a list view" msgstr "" -#: ../src/common/docview.cpp:1437 +#: ../src/common/docview.cpp:1440 msgid "Views" msgstr "Ansichten" -#: ../src/unix/utilsunx.cpp:263 ../src/unix/utilsunx.cpp:599 +#: ../src/unix/utilsunx.cpp:264 ../src/unix/utilsunx.cpp:600 msgid "Waiting for subprocess termination failed" msgstr "" #: ../src/common/docview.cpp:428 ../src/common/resource.cpp:121 -#: ../src/generic/logg.cpp:205 +#: ../src/generic/logg.cpp:181 msgid "Warning" msgstr "Warnung" @@ -2177,60 +2244,60 @@ msgstr "Warning: " msgid "Warning: attempt to remove HTML tag handler from empty stack." msgstr "" -#: ../src/common/fontmap.cpp:88 +#: ../src/common/fontmap.cpp:96 msgid "West European (ISO-8859-1/Latin 1)" msgstr "" -#: ../src/common/fontmap.cpp:102 +#: ../src/common/fontmap.cpp:110 msgid "West European new (ISO-8859-15/Latin 0)" msgstr "" -#: ../src/html/helpfrm.cpp:401 +#: ../src/html/helpfrm.cpp:406 msgid "Whole words only" msgstr "" -#: ../src/msw/utils.cpp:497 +#: ../src/msw/utils.cpp:545 msgid "Win32s on Windows 3.1" msgstr "" -#: ../src/msw/utils.cpp:529 +#: ../src/msw/utils.cpp:577 msgid "Windows 3.1" msgstr "" -#: ../src/msw/utils.cpp:501 +#: ../src/msw/utils.cpp:549 #, c-format msgid "Windows 9%c" msgstr "" -#: ../src/common/fontmap.cpp:110 +#: ../src/common/fontmap.cpp:118 msgid "Windows Arabic (CP 1256)" msgstr "" -#: ../src/common/fontmap.cpp:111 +#: ../src/common/fontmap.cpp:119 msgid "Windows Baltic (CP 1257)" msgstr "" -#: ../src/common/fontmap.cpp:105 +#: ../src/common/fontmap.cpp:113 msgid "Windows Cyrillic (CP 1251)" msgstr "" -#: ../src/common/fontmap.cpp:107 +#: ../src/common/fontmap.cpp:115 msgid "Windows Greek (CP 1253)" msgstr "" -#: ../src/common/fontmap.cpp:109 +#: ../src/common/fontmap.cpp:117 msgid "Windows Hebrew (CP 1255)" msgstr "" -#: ../src/common/fontmap.cpp:106 +#: ../src/common/fontmap.cpp:114 msgid "Windows Latin 1 (CP 1252)" msgstr "" -#: ../src/common/fontmap.cpp:104 +#: ../src/common/fontmap.cpp:112 msgid "Windows Latin 2 (CP 1250)" msgstr "" -#: ../src/common/fontmap.cpp:108 +#: ../src/common/fontmap.cpp:116 msgid "Windows Turkish (CP 1254)" msgstr "" @@ -2260,19 +2327,19 @@ msgstr "Y Verschiebung" msgid "Yes" msgstr "Ja" -#: ../src/generic/dirdlgg.cpp:499 +#: ../src/generic/dirdlgg.cpp:570 msgid "You cannot add a new directory to this section." msgstr "" -#: ../src/common/docview.cpp:1978 +#: ../src/common/docview.cpp:1980 msgid "[EMPTY]" msgstr "[leer]" -#: ../src/msw/dde.cpp:987 +#: ../src/msw/dde.cpp:986 msgid "a DDEML application has created a prolonged race condition." msgstr "" -#: ../src/msw/dde.cpp:975 +#: ../src/msw/dde.cpp:974 msgid "" "a DDEML function was called without first calling the DdeInitialize " "function,\n" @@ -2280,56 +2347,56 @@ msgid "" "was passed to a DDEML function." msgstr "" -#: ../src/msw/dde.cpp:993 +#: ../src/msw/dde.cpp:992 msgid "a client's attempt to establish a conversation has failed." msgstr "" -#: ../src/msw/dde.cpp:990 +#: ../src/msw/dde.cpp:989 #, fuzzy msgid "a memory allocation failed." msgstr "Konnte keine Pipe anlegen" -#: ../src/msw/dde.cpp:984 +#: ../src/msw/dde.cpp:983 msgid "a parameter failed to be validated by the DDEML." msgstr "" -#: ../src/msw/dde.cpp:966 +#: ../src/msw/dde.cpp:965 msgid "a request for a synchronous advise transaction has timed out." msgstr "" -#: ../src/msw/dde.cpp:972 +#: ../src/msw/dde.cpp:971 msgid "a request for a synchronous data transaction has timed out." msgstr "" -#: ../src/msw/dde.cpp:981 +#: ../src/msw/dde.cpp:980 msgid "a request for a synchronous execute transaction has timed out." msgstr "" -#: ../src/msw/dde.cpp:999 +#: ../src/msw/dde.cpp:998 msgid "a request for a synchronous poke transaction has timed out." msgstr "" -#: ../src/msw/dde.cpp:1014 +#: ../src/msw/dde.cpp:1013 msgid "a request to end an advise transaction has timed out." msgstr "" -#: ../src/msw/dde.cpp:1008 +#: ../src/msw/dde.cpp:1007 msgid "" "a server-side transaction was attempted on a conversation\n" "that was terminated by the client, or the server\n" "terminated before completing a transaction." msgstr "" -#: ../src/msw/dde.cpp:996 +#: ../src/msw/dde.cpp:995 #, fuzzy msgid "a transaction failed." msgstr "Konnte keine Pipe anlegen" -#: ../src/common/utilscmn.cpp:464 +#: ../src/common/utilscmn.cpp:466 msgid "alt" msgstr "" -#: ../src/msw/dde.cpp:978 +#: ../src/msw/dde.cpp:977 msgid "" "an application initialized as APPCLASS_MONITOR has\n" "attempted to perform a DDE transaction,\n" @@ -2337,22 +2404,22 @@ msgid "" "attempted to perform server transactions." msgstr "" -#: ../src/msw/dde.cpp:1002 +#: ../src/msw/dde.cpp:1001 msgid "an internal call to the PostMessage function has failed. " msgstr "" -#: ../src/msw/dde.cpp:1011 +#: ../src/msw/dde.cpp:1010 msgid "an internal error has occurred in the DDEML." msgstr "" -#: ../src/msw/dde.cpp:1017 +#: ../src/msw/dde.cpp:1016 msgid "" "an invalid transaction identifier was passed to a DDEML function.\n" "Once the application has returned from an XTYP_XACT_COMPLETE callback,\n" "the transaction identifier for that callback is no longer valid." msgstr "" -#: ../src/common/fileconf.cpp:1416 +#: ../src/common/fileconf.cpp:1415 #, c-format msgid "attempt to change immutable key '%s' ignored." msgstr "Versuch, Eintrag '%s' zu ändern, verweigert. Ist nicht schreibbar." @@ -2362,55 +2429,55 @@ msgstr "Versuch, Eintrag '%s' zu msgid "can't close file '%s'" msgstr "Kann Datei '%s' nicht öffnen" -#: ../src/common/file.cpp:283 +#: ../src/common/file.cpp:252 #, c-format msgid "can't close file descriptor %d" msgstr "" -#: ../src/common/file.cpp:581 ../src/common/file.cpp:591 +#: ../src/common/file.cpp:550 ../src/common/file.cpp:560 #, c-format msgid "can't commit changes to file '%s'" msgstr "Kann Änderungen in Datei '%s' nicht sichern." -#: ../src/common/file.cpp:231 +#: ../src/common/file.cpp:200 #, c-format msgid "can't create file '%s'" msgstr "Kann Datei '%s' nicht anlegen." -#: ../src/common/fileconf.cpp:886 +#: ../src/common/fileconf.cpp:885 #, c-format msgid "can't delete user configuration file '%s'" msgstr "Kann Konfigurationsdatei '%s' nicht löschen." -#: ../src/common/file.cpp:462 +#: ../src/common/file.cpp:431 #, c-format msgid "can't determine if the end of file is reached on descriptor %d" msgstr "" -#: ../src/common/file.cpp:428 +#: ../src/common/file.cpp:397 #, c-format msgid "can't find length of file on file descriptor %d" msgstr "" -#: ../src/msw/utils.cpp:328 +#: ../src/msw/utils.cpp:376 msgid "can't find user's HOME, using current directory." msgstr "Kann Benutzerverzeichnis nicht finden, verwende aktuelles Verzeichnis." -#: ../src/common/file.cpp:342 +#: ../src/common/file.cpp:311 #, c-format msgid "can't flush file descriptor %d" msgstr "" -#: ../src/common/file.cpp:396 +#: ../src/common/file.cpp:365 #, c-format msgid "can't get seek position on file descriptor %d" msgstr "" -#: ../src/common/fontmap.cpp:545 +#: ../src/common/fontmap.cpp:568 msgid "can't load any font, aborting" msgstr "" -#: ../src/common/ffile.cpp:85 ../src/common/file.cpp:269 +#: ../src/common/ffile.cpp:85 ../src/common/file.cpp:238 #, c-format msgid "can't open file '%s'" msgstr "Kann Datei '%s' nicht öffnen" @@ -2425,54 +2492,54 @@ msgstr "Kann globale Konfigurationsdatei '%s' nicht msgid "can't open user configuration file '%s'." msgstr "Kann Konfigurationsdatei '%s' nicht öffnen." -#: ../src/common/fileconf.cpp:774 +#: ../src/common/fileconf.cpp:773 msgid "can't open user configuration file." msgstr "Kann Benutzer-Konfigurationsdatei nicht öffnen." -#: ../src/common/file.cpp:309 +#: ../src/common/file.cpp:278 #, c-format msgid "can't read from file descriptor %d" msgstr "" -#: ../src/common/file.cpp:576 ../src/common/file.cpp:586 +#: ../src/common/file.cpp:545 ../src/common/file.cpp:555 #, c-format msgid "can't remove file '%s'" msgstr "Kann Datei '%s' nicht löschen." -#: ../src/common/file.cpp:604 ../src/common/file.cpp:607 +#: ../src/common/file.cpp:573 ../src/common/file.cpp:576 #, c-format msgid "can't remove temporary file '%s'" msgstr "Kann Temporärdatei '%s' nicht löschen" -#: ../src/common/file.cpp:382 +#: ../src/common/file.cpp:351 #, c-format msgid "can't seek on file descriptor %d" msgstr "" -#: ../src/common/textfile.cpp:328 +#: ../src/common/textfile.cpp:354 #, c-format msgid "can't write file '%s' to disk." msgstr "Kann Datei '%s' nicht schreiben." -#: ../src/common/file.cpp:327 +#: ../src/common/file.cpp:296 #, c-format msgid "can't write to file descriptor %d" msgstr "" -#: ../src/common/fileconf.cpp:781 +#: ../src/common/fileconf.cpp:780 msgid "can't write user configuration file." msgstr "Kann Benutzers Konfigurationsdatei nicht schreiben." -#: ../src/common/intl.cpp:351 +#: ../src/common/intl.cpp:349 #, c-format msgid "catalog file for domain '%s' not found." msgstr "Nachrichtenkatalog für Sprachbereich '%s' nicht gefunden." -#: ../src/common/utilscmn.cpp:462 +#: ../src/common/utilscmn.cpp:464 msgid "ctrl" msgstr "" -#: ../src/common/cmdline.cpp:877 +#: ../src/common/cmdline.cpp:869 msgid "date" msgstr "" @@ -2489,16 +2556,12 @@ msgstr "D msgid "eleventh" msgstr "" -#: ../src/common/filefn.cpp:1729 -msgid "empty file name in wxFindFileInPath" -msgstr "" - -#: ../src/common/fileconf.cpp:1403 +#: ../src/common/fileconf.cpp:1402 #, c-format msgid "entry '%s' appears more than once in group '%s'" msgstr "Eintrag '%s' erscheint in Gruppe '%s' mehrfach" -#: ../src/msw/dialup.cpp:858 +#: ../src/msw/dialup.cpp:856 msgid "establish" msgstr "" @@ -2520,17 +2583,17 @@ msgstr "" msgid "file '%s', line %d: '%s' ignored after group header." msgstr "Datei '%s', Zeile %d: '%s' hinter Gruppenkopf ignoriert." -#: ../src/common/fileconf.cpp:493 +#: ../src/common/fileconf.cpp:492 #, c-format msgid "file '%s', line %d: '=' expected." msgstr "Datei '%s', Zeile %d: '=' erwartet." -#: ../src/common/fileconf.cpp:520 +#: ../src/common/fileconf.cpp:518 #, c-format msgid "file '%s', line %d: key '%s' was first found at line %d." msgstr "Datei '%s', Zeile %d: Eintrag '%s' taucht erstmals in Zeile %d auf." -#: ../src/common/fileconf.cpp:509 +#: ../src/common/fileconf.cpp:508 #, c-format msgid "file '%s', line %d: value for immutable key '%s' ignored." msgstr "" @@ -2557,30 +2620,35 @@ msgstr "" msgid "gmtime() failed" msgstr "" -#: ../src/msw/dialup.cpp:858 +#: ../src/msw/dialup.cpp:856 #, fuzzy msgid "initiate" msgstr "ungültiges Datum" -#: ../src/common/file.cpp:466 +#: ../src/common/file.cpp:435 msgid "invalid eof() return value." msgstr "" -#: ../src/generic/logg.cpp:490 +#: ../src/generic/logg.cpp:501 msgid "invalid message box return value" msgstr "" -#: ../src/html/helpfrm.cpp:851 +#: ../src/html/helpfrm.cpp:874 #, fuzzy msgid "large" msgstr "Seiten" -#: ../src/common/intl.cpp:542 +#: ../src/common/intl.cpp:541 #, c-format msgid "locale '%s' can not be set." msgstr "Lokale Umgebung '%s' kann nicht gesetzt werden." -#: ../src/html/helpfrm.cpp:851 +#: ../src/common/intl.cpp:344 +#, c-format +msgid "looking for catalog '%s' in path '%s'." +msgstr "Suche Nachrichtenkatalog '%s' in Pfad '%s'." + +#: ../src/html/helpfrm.cpp:874 msgid "medium" msgstr "" @@ -2602,11 +2670,7 @@ msgstr "" msgid "ninth" msgstr "Drucken" -#: ../src/html/winpars.cpp:133 -msgid "no DC assigned to wxHtmlWinParser!!" -msgstr "" - -#: ../src/msw/dde.cpp:962 +#: ../src/msw/dde.cpp:961 msgid "no DDE error." msgstr "" @@ -2619,11 +2683,11 @@ msgstr "Unbenannt" msgid "noon" msgstr "" -#: ../src/common/cmdline.cpp:876 +#: ../src/common/cmdline.cpp:868 msgid "num" msgstr "" -#: ../src/msw/dde.cpp:1005 +#: ../src/msw/dde.cpp:1004 msgid "reentrancy problem." msgstr "" @@ -2639,7 +2703,7 @@ msgstr "" msgid "seventh" msgstr "" -#: ../src/common/utilscmn.cpp:466 +#: ../src/common/utilscmn.cpp:468 msgid "shift" msgstr "" @@ -2651,20 +2715,20 @@ msgstr "" msgid "sixth" msgstr "" -#: ../src/html/helpfrm.cpp:851 +#: ../src/html/helpfrm.cpp:874 msgid "small" msgstr "" -#: ../src/common/cmdline.cpp:875 +#: ../src/common/cmdline.cpp:867 msgid "str" msgstr "" -#: ../src/common/intl.cpp:635 +#: ../src/common/intl.cpp:634 #, c-format msgid "string '%s' not found in domain '%s' for locale '%s'." msgstr "Text '%s' in Bereich '%s' für Umgebung '%s' nicht gefunden." -#: ../src/common/intl.cpp:640 +#: ../src/common/intl.cpp:639 #, c-format msgid "string '%s' not found in locale '%s'." msgstr "Text '%s' in Umgebung '%s' nicht gefunden." @@ -2673,11 +2737,7 @@ msgstr "Text '%s' in Umgebung '%s' nicht gefunden." msgid "tenth" msgstr "" -#: ../src/html/htmlfilt.cpp:133 -msgid "text/html" -msgstr "" - -#: ../src/msw/dde.cpp:969 +#: ../src/msw/dde.cpp:968 msgid "the response to the transaction caused the DDE_FBUSY bit to be set." msgstr "" @@ -2705,12 +2765,12 @@ msgstr "" msgid "twentieth" msgstr "" -#: ../src/common/fileconf.cpp:1523 +#: ../src/common/fileconf.cpp:1522 #, c-format msgid "unexpected \" at position %d in '%s'." msgstr "" -#: ../src/generic/progdlgg.cpp:243 +#: ../src/generic/progdlgg.cpp:241 msgid "unknown" msgstr "" @@ -2719,11 +2779,11 @@ msgstr "" msgid "unknown error (error code %08x)." msgstr "" -#: ../src/common/file.cpp:365 +#: ../src/common/file.cpp:334 msgid "unknown seek origin" msgstr "" -#: ../src/common/fontmap.cpp:329 +#: ../src/common/fontmap.cpp:348 #, c-format msgid "unknown-%d" msgstr "" @@ -2732,80 +2792,42 @@ msgstr "" msgid "unnamed" msgstr "Unbenannt" -#: ../src/common/docview.cpp:1174 +#: ../src/common/docview.cpp:1177 #, c-format msgid "unnamed%d" msgstr "Unbenannt" -#: ../src/common/intl.cpp:356 +#: ../src/common/intl.cpp:354 #, c-format msgid "using catalog '%s' from '%s'." msgstr "Verwende Nachrichtenkatalog '%s' von '%s'." -#: ../src/html/helpfrm.cpp:851 +#: ../src/html/helpfrm.cpp:874 msgid "very large" msgstr "" -#: ../src/html/helpfrm.cpp:851 +#: ../src/html/helpfrm.cpp:874 msgid "very small" msgstr "" -#: ../src/common/imaggif.cpp:74 -msgid "wxGIFHandler: data stream seems to be truncated." -msgstr "" - -#: ../src/common/imaggif.cpp:58 -msgid "wxGIFHandler: error in GIF image format." -msgstr "" - -#: ../src/common/imaggif.cpp:61 -msgid "wxGIFHandler: not enough memory." -msgstr "" - -#: ../src/common/imaggif.cpp:64 -msgid "wxGIFHandler: unknown error!!!" -msgstr "" - #: ../src/common/timercmn.cpp:266 msgid "wxGetTimeOfDay failed." msgstr "" -#: ../src/common/imagpcx.cpp:448 ../src/common/imagpcx.cpp:471 -msgid "wxPCXHandler: couldn't allocate memory" -msgstr "" - -#: ../src/common/imagpcx.cpp:447 -msgid "wxPCXHandler: image format unsupported" -msgstr "" - -#: ../src/common/imagpcx.cpp:470 -msgid "wxPCXHandler: invalid image" -msgstr "" - -#: ../src/common/imagpcx.cpp:450 ../src/common/imagpcx.cpp:472 -msgid "wxPCXHandler: unknown error !!!" -msgstr "" - -#: ../src/common/imagpcx.cpp:449 -msgid "wxPCXHandler: version number too low" +#: ../src/common/socket.cpp:329 ../src/common/socket.cpp:383 +msgid "wxSocket: invalid signature in ReadMsg." msgstr "" -#: ../src/common/prntbase.cpp:660 -msgid "" -"wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to " -"let me know about the canvas!" +#: ../src/common/socket.cpp:903 +msgid "wxSocket: unknown event!." msgstr "" -#: ../src/common/socket.cpp:296 ../src/common/socket.cpp:350 -msgid "wxSocket: invalid signature in ReadMsg." -msgstr "" - -#: ../src/motif/app.cpp:584 +#: ../src/motif/app.cpp:591 #, c-format msgid "wxWindows could not open display for '%s': exiting." msgstr "" -#: ../src/common/filefn.cpp:1222 +#: ../src/common/filefn.cpp:1214 msgid "wxWindows: error finding temporary file name.\n" msgstr "" @@ -2853,9 +2875,6 @@ msgstr "" #~ msgstr "" #~ "Zeichen '%c' ist in einem Konfigurationseintragsnamen nicht erlaubt." -#~ msgid "Couldn't change the state of event object." -#~ msgstr "Kann Zustand des Eventobjektes nicht ändern." - #~ msgid "Enter the name of the directory to create" #~ msgstr "Geben Sie einen Namen für das neue Verzeichnis ein" @@ -2867,14 +2886,8 @@ msgstr "" #~ msgstr "" #~ "Mime.types-Datei %s, Zeile %d: extra Zeichen nach dem Wert ignoriert." -#~ msgid "invalid day" -#~ msgstr "ungültiger Tag" - #~ msgid "invalid month" #~ msgstr "ungültiger Monat" -#~ msgid "looking for catalog '%s' in path '%s'." -#~ msgstr "Suche Nachrichtenkatalog '%s' in Pfad '%s'." - #~ msgid "pm" #~ msgstr "pm" diff --git a/locale/dk.po b/locale/dk.po deleted file mode 100644 index 0303971d64..0000000000 --- a/locale/dk.po +++ /dev/null @@ -1,1975 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Free Software Foundation, Inc. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: wxWindows v2.1beta\n" -"POT-Creation-Date: 1999-07-06 13:24+0100\n" -"PO-Revision-Date: 1999-10-23 12:30+0100\n" -"Last-Translator: Leif Jensen <leif@danmos.dk>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso8859-1\n" -"Content-Transfer-Encoding: 8 bit\n" - -#: ../src/generic/dirdlgg.cpp:461 ../src/generic/dirdlgg.cpp:465 -#: ../src/generic/dirdlgg.cpp:489 ../src/generic/dirdlgg.cpp:493 -#: src/generic/dirdlgg.cpp:461 src/generic/dirdlgg.cpp:489 -msgid "" -"\n" -"(Do you have the required permissions?)" -msgstr "" -"\n" -"(Har du de nødvendige tilladelser?)" - -#: ../src/generic/dirdlgg.cpp:449 ../src/generic/dirdlgg.cpp:453 -#: src/generic/dirdlgg.cpp:449 -msgid "" -"\n" -"does not exist\n" -"Create it now?" -msgstr "" -"\n" -"eksisterer ikke\n" -"Opret den nu?" - -#: ../src/common/log.cpp:223 ../src/common/log.cpp:227 src/common/log.cpp:209 -#, c-format -msgid " (error %ld: %s)" -msgstr " (fejl %ld: %s)" - -#: ../src/common/date.cpp:385 ../src/common/date.cpp:388 -#: ../src/common/date.cpp:400 ../src/common/date.cpp:403 -#: src/common/date.cpp:384 src/common/date.cpp:399 -msgid " B.C." -msgstr " F.K." - -#: ../src/common/resourc2.cpp:265 ../src/common/resourc2.cpp:1334 -#: ../src/common/resource.cpp:1630 ../src/common/resource.cpp:1631 -#: ../src/common/resource.cpp:2704 ../src/common/resource.cpp:2708 -#: src/common/resourc2.cpp:265 src/common/resourc2.cpp:1334 -#: src/common/resource.cpp:1613 src/common/resource.cpp:2682 -#, c-format -msgid "#define %s must be an integer." -msgstr "#define %s skal være et heltal" - -#: src/common/valtext.cpp:143 src/common/valtext.cpp:154 -#, c-format -msgid "%s is invalid." -msgstr "%s er ulovlig" - -#: ../src/common/resourc2.cpp:709 ../src/common/resource.cpp:2075 -#: ../src/common/resource.cpp:2079 src/common/resourc2.cpp:709 -#: src/common/resource.cpp:2057 -#, c-format -msgid "%s not a bitmap resource specification." -msgstr "%s er ikke en bitmap resource specifikation" - -#: ../src/common/resourc2.cpp:864 ../src/common/resource.cpp:2230 -#: ../src/common/resource.cpp:2234 src/common/resourc2.cpp:864 -#: src/common/resource.cpp:2212 -#, c-format -msgid "%s not an icon resource specification." -msgstr "%s er ikke en icon resource specifikation" - -#: src/common/valtext.cpp:188 -#, c-format -msgid "%s should be numeric." -msgstr "%s skulle være numerisk" - -#: src/common/valtext.cpp:163 -#, c-format -msgid "%s should only contain ASCII characters." -msgstr "%s må kun indeholde ASCII karakterer" - -#: src/common/valtext.cpp:171 -#, c-format -msgid "%s should only contain alphabetic characters." -msgstr "%s må kun indeholde bogstaver" - -#: src/common/valtext.cpp:179 -#, c-format -msgid "%s should only contain alphabetic or numeric characters." -msgstr "%s må kun indeholde bogstaver eller tal" - -#: ../src/common/resourc2.cpp:357 ../src/common/resourc2.cpp:1430 -#: ../src/common/resource.cpp:1723 ../src/common/resource.cpp:1724 -#: ../src/common/resource.cpp:2801 ../src/common/resource.cpp:2805 -#: src/common/resourc2.cpp:357 src/common/resourc2.cpp:1430 -#: src/common/resource.cpp:1705 src/common/resource.cpp:2778 -#, c-format -msgid "%s: ill-formed resource file syntax." -msgstr "%s: forkert resourcefil syntax." - -#: ../src/common/log.cpp:638 ../src/common/log.cpp:650 -#: ../src/generic/tipdlg.cpp:171 src/common/log.cpp:633 -msgid "&Close" -msgstr "&Luk" - -#: ../src/common/log.cpp:639 ../src/common/log.cpp:651 src/common/log.cpp:634 -msgid "&Log" -msgstr "&Log" - -#: ../src/common/docview.cpp:1725 ../src/common/docview.cpp:1729 -#: ../src/common/docview.cpp:1736 ../src/common/docview.cpp:1740 -#: ../src/common/docview.cpp:1756 ../src/common/docview.cpp:1767 -#: src/common/docview.cpp:1687 src/common/docview.cpp:1698 -msgid "&Redo" -msgstr "&Gendan" - -#: ../src/common/docview.cpp:1719 ../src/common/docview.cpp:1723 -#: ../src/common/docview.cpp:1746 ../src/common/docview.cpp:1750 -#: ../src/common/docview.cpp:1777 src/common/docview.cpp:1681 -#: src/common/docview.cpp:1708 -msgid "&Redo " -msgstr "&Gendan " - -#: ../src/common/log.cpp:635 ../src/common/log.cpp:646 src/common/log.cpp:630 -msgid "&Save..." -msgstr "&Gem..." - -#: ../src/common/docview.cpp:1731 ../src/common/docview.cpp:1735 -#: ../src/common/docview.cpp:1762 src/common/docview.cpp:1693 -msgid "&Undo" -msgstr "" - -#: ../src/common/docview.cpp:1706 ../src/common/docview.cpp:1710 -#: ../src/common/docview.cpp:1737 src/common/docview.cpp:1668 -msgid "&Undo " -msgstr "&Reetablér" - -#: ../src/common/config.cpp:381 ../src/common/config.cpp:382 -#: src/common/config.cpp:393 -#, c-format -msgid "'%s' has extra '..', ignored." -msgstr "'%s' har ekstra '..', ignoreret." - -#: ../src/common/intl.cpp:339 ../src/common/intl.cpp:372 -#: src/common/intl.cpp:338 -#, c-format -msgid "'%s' is not a valid message catalog." -msgstr "'%s' er ikke et lovligt meddelelseskatalog" - -#: ../src/common/textfile.cpp:133 ../src/common/textfile.cpp:139 -#: src/common/textfile.cpp:132 -#, c-format -msgid "'%s' is probably a binary file." -msgstr "'%s' er sandsynligvis en binær fil." - -#: ../src/common/resourc2.cpp:297 ../src/common/resourc2.cpp:1370 -#: ../src/common/resource.cpp:1662 ../src/common/resource.cpp:1663 -#: ../src/common/resource.cpp:2740 ../src/common/resource.cpp:2744 -#: src/common/resourc2.cpp:297 src/common/resourc2.cpp:1370 -#: src/common/resource.cpp:1645 src/common/resource.cpp:2718 -msgid "" -", expected static, #include or #define\n" -"whilst parsing resource." -msgstr "" -", forventet static, #include eller #define\n" -"under parsing af resource." - -#: src/generic/dcpsg.cpp:2389 -msgid "A3 297 x 420 mm" -msgstr "A3 297 x 420 mm" - -#: src/generic/dcpsg.cpp:1210 src/generic/dcpsg.cpp:1214 -#: src/generic/dcpsg.cpp:1800 src/generic/dcpsg.cpp:1804 -#: src/generic/dcpsg.cpp:2313 src/generic/dcpsg.cpp:2388 -#: src/generic/printps.cpp:239 src/generic/printps.cpp:243 -msgid "A4 210 x 297 mm" -msgstr "A4 210 x 297 mm" - -#: ../src/generic/fontdlgg.cpp:327 ../src/generic/fontdlgg.cpp:329 -#: src/generic/fontdlgg.cpp:329 -msgid "ABCDEFGabcdefg12345" -msgstr "ABCDEFGabcdefg12345" - -#: ../src/generic/colrdlgg.cpp:236 ../src/generic/colrdlgg.cpp:238 -#: src/generic/colrdlgg.cpp:236 -msgid "Add to custom colours" -msgstr "Tilføj til bruger farver" - -#: ../src/generic/prntdlgg.cpp:140 ../src/generic/prntdlgg.cpp:147 -#: src/generic/prntdlgg.cpp:83 -msgid "All" -msgstr "Alle" - -#: ../src/common/log.cpp:675 ../src/common/log.cpp:690 src/common/log.cpp:670 -#, c-format -msgid "Append log to file '%s' (choosing [No] will overwrite it)?" -msgstr "Tilføj log til fil '%s' (valg af [Nej] vil overskrive den)?" - -#: src/gtk/window.cpp:2716 -msgid "Application Error" -msgstr "Program fejl" - -#: ../src/common/resourc2.cpp:844 ../src/common/resource.cpp:2210 -#: ../src/common/resource.cpp:2214 src/common/resourc2.cpp:844 -#: src/common/resource.cpp:2192 -#, c-format -msgid "Bitmap resource specification %s not found." -msgstr "Bitmap resourcespecifikation %s blev ikke fundet" - -#: ../src/generic/fontdlgg.cpp:219 ../src/generic/fontdlgg.cpp:221 -#: src/generic/fontdlgg.cpp:221 -msgid "Bold" -msgstr "Fed" - -#: ../src/generic/prntdlgg.cpp:643 ../src/generic/prntdlgg.cpp:650 -#: src/generic/prntdlgg.cpp:536 -msgid "Bottom margin (mm):" -msgstr "Bund margin (mm):" - -#: ../src/common/log.cpp:636 ../src/common/log.cpp:648 src/common/log.cpp:631 -msgid "C&lear" -msgstr "&Rens" - -#: ../src/msw/thread.cpp:183 src/msw/thread.cpp:183 -msgid "Can not create event object." -msgstr "Kan ikke oprette hændelsesobjekt." - -#: ../src/msw/thread.cpp:99 src/msw/thread.cpp:99 -msgid "Can not create mutex." -msgstr "Kan ikke oprette mutex." - -#: ../src/msw/tooltip.cpp:199 src/msw/tooltip.cpp:199 -msgid "Can not create tooltip control" -msgstr "Kan ikke oprette tooltip kontrol" - -#: ../src/common/filefn.cpp:1179 src/common/filefn.cpp:1168 -#: src/common/filefn.cpp:1282 -#, c-format -msgid "Can not enumerate files in directory '%s'" -msgstr "Kan ikke nummerere filer i bibliotek '%s'" - -#: ../src/msw/clipbrd.cpp:549 src/msw/clipbrd.cpp:549 -#, c-format -msgid "Can not get data in format '%s' from clipboard." -msgstr "Kan ikke få data i format '%s' fra klippebordet." - -#: src/gtk/threadpsx.cpp:450 -#, c-format -msgid "Can not get priority range for scheduling policy %d." -msgstr "Kan ikke få prioriteringsområde for afviklingsalgoritme %d." - -#: ../src/msw/clipbrd.cpp:474 src/msw/clipbrd.cpp:474 -#, c-format -msgid "Can not put data in format '%s' on clipboard." -msgstr "Kan ikke skrive data i format '%s' til klippebordet." - -#: ../src/msw/thread.cpp:410 src/msw/thread.cpp:410 -#, c-format -msgid "Can not resume thread %x" -msgstr "Kan ikke genoptage tråd %x" - -#: src/gtk/threadpsx.cpp:442 -msgid "Can not retrieve thread scheduling policy." -msgstr "Kan ikke hente trådafviklingsalgoritme." - -#: ../src/msw/thread.cpp:330 src/gtk/threadpsx.cpp:270 src/msw/thread.cpp:330 -msgid "Can not start thread: error writing TLS." -msgstr "Kan ikke starte tråd: fejl ved skrivning af TLS." - -#: ../src/msw/thread.cpp:395 src/msw/thread.cpp:395 -#, c-format -msgid "Can not suspend thread %x" -msgstr "Kan ikke suspendere tråd %x" - -#: ../src/msw/thread.cpp:547 src/msw/thread.cpp:543 -msgid "Can not wait for thread termination" -msgstr "Kan ikke vente på trådafslutning" - -#: ../src/common/docview.cpp:1708 ../src/common/docview.cpp:1712 -#: ../src/common/docview.cpp:1739 src/common/docview.cpp:1670 -msgid "Can't &Undo " -msgstr "Kan ikke &reetablere " - -#: ../src/msw/thread.cpp:359 src/msw/thread.cpp:359 -msgid "Can't create thread" -msgstr "Kan ikke danne tråd" - -#: ../src/msw/iniconf.cpp:453 src/msw/iniconf.cpp:464 -#, c-format -msgid "Can't delete the INI file '%s'" -msgstr "Kan ikke slette INI filen '%s'" - -#: ../src/unix/utilsunx.cpp:316 ../src/unix/utilsunx.cpp:327 -#: src/gtk/utilsgtk.cpp:360 -#, c-format -msgid "Can't execute '%s'\n" -msgstr "Kan ikke eksekvere '%s'\n" - -#: ../src/msw/utilsexc.cpp:208 src/msw/utilsexc.cpp:208 -#, c-format -msgid "Can't execute command '%s'" -msgstr "Kan ikke eksekvere kommandoen '%s'" - -#: ../src/common/object.cpp:302 ../src/common/object.cpp:323 -#: src/common/object.cpp:290 src/common/object.cpp:311 -#, c-format -msgid "Can't find the serialization object '%s' for the object '%s'." -msgstr "Kan ikke find serialisationsobjektet '%s' til objektet '%s'." - -#: ../src/common/object.cpp:295 src/common/object.cpp:283 -msgid "Can't load wxSerial dynamic library." -msgstr "Kan ikke load'e wxSerial dynamisk bibliotek" - -#: ../src/common/log.cpp:722 ../src/common/log.cpp:737 src/common/log.cpp:717 -msgid "Can't save log contents to file." -msgstr "Kan ikke gemme log-indhold til fil." - -#: ../src/msw/thread.cpp:384 src/msw/thread.cpp:384 -msgid "Can't set thread priority" -msgstr "Kan ikke sætte trådprioritet" - -#: ../src/common/dlgcmn.cpp:121 ../src/common/dlgcmn.cpp:166 -#: ../src/common/prntbase.cpp:109 ../src/common/prntbase.cpp:114 -#: ../src/generic/choicdgg.cpp:306 ../src/generic/colrdlgg.cpp:235 -#: ../src/generic/colrdlgg.cpp:237 ../src/generic/dcpsg.cpp:1917 -#: ../src/generic/dcpsg.cpp:1918 ../src/generic/dcpsg.cpp:2039 -#: ../src/generic/dirdlgg.cpp:341 ../src/generic/dirdlgg.cpp:345 -#: ../src/generic/extdlgg.cpp:142 ../src/generic/fontdlgg.cpp:259 -#: ../src/generic/fontdlgg.cpp:261 ../src/generic/msgdlgg.cpp:123 -#: ../src/generic/msgdlgg.cpp:165 ../src/generic/prntdlgg.cpp:172 -#: ../src/generic/prntdlgg.cpp:179 ../src/generic/prntdlgg.cpp:430 -#: ../src/generic/prntdlgg.cpp:437 ../src/generic/prntdlgg.cpp:580 -#: ../src/generic/prntdlgg.cpp:587 ../src/generic/progdlgg.cpp:94 -#: ../src/generic/progdlgg.cpp:174 ../src/generic/textdlgg.cpp:141 -#: ../src/gtk/choicdlg.cpp:272 ../src/gtk/filedlg.cpp:154 -#: ../src/gtk/msgdlg.cpp:137 ../src/gtk/textdlg.cpp:115 -#: src/common/prntbase.cpp:113 src/generic/choicdgg.cpp:306 -#: src/generic/colrdlgg.cpp:235 src/generic/dcpsg.cpp:1875 -#: src/generic/dirdlgg.cpp:341 src/generic/fontdlgg.cpp:261 -#: src/generic/msgdlgg.cpp:143 src/generic/prntdlgg.cpp:111 -#: src/generic/prntdlgg.cpp:317 src/generic/prntdlgg.cpp:473 -#: src/generic/textdlgg.cpp:141 src/gtk/filedlg.cpp:131 -msgid "Cancel" -msgstr "Afbryd" - -#: ../src/msw/app.cpp:213 ../src/msw/app.cpp:223 src/msw/app.cpp:192 -msgid "Cannot initialize OLE" -msgstr "Kan ikke initialisere OLE" - -#: ../src/generic/dcpsg.cpp:1296 src/generic/dcpsg.cpp:1247 -msgid "Cannot open file!" -msgstr "Kan ikke åbne filen" - -#: src/common/CVS/Base/fileconf.cpp:614 src/common/fileconf.cpp:614 -#, c-format -msgid "Character '%c' is invalid in a config entry name." -msgstr "Karakter '%c' er ulovlig i en konfigurationsindgangsnavn." - -#: ../src/common/log.cpp:636 ../src/common/log.cpp:648 src/common/log.cpp:631 -msgid "Clear the log contents" -msgstr "Rens log indholdet" - -#: ../src/common/prntbase.cpp:343 ../src/common/prntbase.cpp:352 -#: ../src/generic/progdlgg.cpp:254 src/common/prntbase.cpp:342 -msgid "Close" -msgstr "Luk" - -#: ../src/common/log.cpp:638 ../src/common/log.cpp:650 src/common/log.cpp:633 -msgid "Close this window" -msgstr "Luk dette vindue" - -#: ../src/gtk/filedlg.cpp:71 src/gtk/filedlg.cpp:60 -msgid "Confirm" -msgstr "Bekræft" - -#: ../src/generic/helpxlp.cpp:242 src/generic/helpxlp.cpp:242 -#, c-format -msgid "Connection to wxHelp timed out in %d seconds" -msgstr "Forbindelse til wxHelp havde timeout efter %d sekunder" - -#: ../src/generic/prntdlgg.cpp:167 ../src/generic/prntdlgg.cpp:174 -#: src/generic/prntdlgg.cpp:106 -msgid "Copies:" -msgstr "Kopier:" - -#: ../src/common/resourc2.cpp:287 ../src/common/resource.cpp:1652 -#: ../src/common/resource.cpp:1653 src/common/resourc2.cpp:287 -#: src/common/resource.cpp:1635 -#, c-format -msgid "Could not find resource include file %s." -msgstr "Kunne ikke finde resource include file %s." - -#: ../src/generic/tabg.cpp:1038 src/generic/tabg.cpp:1038 -msgid "Could not find tab for id" -msgstr "Kunne ikke finde tab til id" - -#: ../src/common/resource.cpp:753 ../src/common/resource.cpp:754 -#: src/common/resource.cpp:753 -#, c-format -msgid "" -"Could not resolve control class or id '%s'. Use (non-zero) integer instead\n" -" or provide #define (see manual for caveats)" -msgstr "" -"Kunne ikke opløse kontrolklass eller id '%d'. Brug (ikke-nul) heltal istedet\n" -" eller angiv #define (se manualen for fenurligheder)" - -#: ../src/common/resource.cpp:1203 ../src/common/resource.cpp:1204 -#: src/common/resource.cpp:1199 -#, c-format -msgid "" -"Could not resolve menu id '%s'. Use (non-zero) integer instead\n" -"or provide #define (see manual for caveats)" -msgstr "" -"Kunne ikke opløse meny-id '%s'. Brug (ikke-nul) heltal istedet\n" -"eller angiv #define (se manualen for fenurligheder)" - -#: ../src/common/prntbase.cpp:675 ../src/common/prntbase.cpp:685 -#: src/common/prntbase.cpp:673 -msgid "Could not start document preview." -msgstr "Kunne ikke start dokument smugkig." - -#: ../src/generic/printps.cpp:189 ../src/generic/printps.cpp:193 -#: ../src/generic/printps.cpp:194 ../src/msw/printwin.cpp:228 -#: ../src/msw/printwin.cpp:232 src/generic/printps.cpp:165 -msgid "Could not start printing." -msgstr "Kunne ikke starte udskrivning" - -#: ../src/common/wincmn.cpp:598 ../src/common/wincmn.cpp:609 -#: ../src/common/wincmn.cpp:713 src/gtk/window.cpp:2716 -#: src/msw/window.cpp:3756 -msgid "Could not transfer data to window" -msgstr "Kunne ikke overføre data til vindue" - -#: ../src/msw/thread.cpp:127 src/msw/thread.cpp:127 -msgid "Couldn't acquire a mutex lock" -msgstr "Kunne ikke få en mutex-lås" - -#: ../src/msw/dragimag.cpp:88 ../src/msw/dragimag.cpp:116 -#: ../src/msw/imaglist.cpp:96 ../src/msw/imaglist.cpp:98 -#: src/msw/imaglist.cpp:96 -msgid "Couldn't add an image to the image list." -msgstr "Kunne ikek tilføje et billede til billedlisten." - -#: ../src/msw/thread.cpp:231 src/msw/thread.cpp:231 -msgid "Couldn't change the state of event object." -msgstr "Kunne ikke ændre tilstanden af hændelsesobjekt." - -#: ../src/msw/timer.cpp:109 ../src/msw/timer.cpp:111 src/msw/timer.cpp:109 -msgid "Couldn't create a timer" -msgstr "Kunne ikke oprette en timer" - -#: ../src/msw/thread.cpp:430 src/msw/thread.cpp:430 -msgid "Couldn't get the current thread pointer" -msgstr "Kunne ikke få nuværende trådpegepind" - -#: ../src/common/imagpng.cpp:216 ../src/common/imagpng.cpp:218 -#: src/common/image.cpp:662 -msgid "Couldn't load a PNG image - probably file is corrupted." -msgstr "Kunne ikke load'e et PNG billede - sandsynligvis er filen kurrupt." - -#: ../src/msw/thread.cpp:159 src/msw/thread.cpp:159 -msgid "Couldn't release a mutex" -msgstr "Kunne ikke frigive en mutex" - -#: ../src/msw/listctrl.cpp:526 ../src/msw/listctrl.cpp:534 -#: src/msw/listctrl.cpp:500 -#, c-format -msgid "Couldn't retrieve information about list control item %d." -msgstr "Kunne ikke hente information om listekontorlenhed %d." - -#: ../src/msw/thread.cpp:612 src/msw/thread.cpp:608 -msgid "Couldn't terminate thread" -msgstr "Kunne ikke afslutte tråd" - -#: ../src/generic/dirdlgg.cpp:478 ../src/generic/dirdlgg.cpp:482 -#: src/generic/dirdlgg.cpp:478 -msgid "Create New Directory" -msgstr "Opret nyt bibliotek" - -#: ../src/common/log.cpp:1041 ../src/common/log.cpp:1057 -#: src/common/log.cpp:1022 -msgid "Debug" -msgstr "Aflus" - -#: ../src/generic/fontdlgg.cpp:209 ../src/generic/fontdlgg.cpp:211 -#: src/generic/fontdlgg.cpp:211 -msgid "Decorative" -msgstr "Dekorativt" - -#: ../src/generic/dirdlgg.cpp:450 ../src/generic/dirdlgg.cpp:454 -#: src/generic/dirdlgg.cpp:450 -msgid "Directory does not exist" -msgstr "Bibliotek eksisterer ikke" - -#: ../src/common/docview.cpp:404 ../src/common/docview.cpp:423 -#: src/common/docview.cpp:371 -#, c-format -msgid "Do you want to save changes to document %s?" -msgstr "Ønsker du at gemme ændringer til dokument %s?" - -#: src/common/log.cpp:368 -msgid "DoLogString must be overrided if it's called." -msgstr "DoLogString skal overskrives, hvis det bliver kaldt." - -#: ../src/generic/dirdlgg.cpp:477 ../src/generic/dirdlgg.cpp:481 -#: src/generic/dirdlgg.cpp:477 -msgid "Enter the name of the directory to create" -msgstr "Indtast navnet på biblioteket, der skal oprettes" - -#: ../src/generic/helphtml.cpp:260 ../src/generic/helphtml.cpp:277 -#: src/generic/helphtml.cpp:260 -msgid "Entries found" -msgstr "indgange blev fundet" - -#: src/common/CVS/Base/fileconf.cpp:607 src/common/fileconf.cpp:607 -#, c-format -msgid "Entry name can't start with '%c'." -msgstr "Indgangsnavn kan ikke starte med '%c'." - -#: ../src/common/config.cpp:333 ../src/common/config.cpp:334 -#: src/common/config.cpp:345 -#, c-format -msgid "" -"Environment variables expansion failed: missing '%c' at position %d in '%s'." -msgstr "" -"Omegnsvariabelekspansion fejlede: manglende '%c' ved position %d i '%s'." - -#: ../src/common/log.cpp:474 ../src/common/log.cpp:478 -#: ../src/generic/dcpsg.cpp:1296 ../src/generic/dcpsg.cpp:1403 -#: ../src/generic/helpxlp.cpp:243 ../src/gtk/filedlg.cpp:79 -#: src/common/log.cpp:474 src/generic/dcpsg.cpp:1247 -#: src/generic/helpxlp.cpp:243 -msgid "Error" -msgstr "Fejl" - -#: ../src/generic/dirdlgg.cpp:462 ../src/generic/dirdlgg.cpp:466 -#: ../src/generic/dirdlgg.cpp:490 ../src/generic/dirdlgg.cpp:494 -#: src/generic/dirdlgg.cpp:462 src/generic/dirdlgg.cpp:490 -msgid "Error creating directory" -msgstr "Fejl ved oprettelse af bibliotek" - -#: ../src/common/log.cpp:325 ../src/common/log.cpp:329 src/common/log.cpp:332 -msgid "Error: " -msgstr "Fejl: " - -#: ../src/generic/dirdlgg.cpp:230 ../src/generic/dirdlgg.cpp:234 -#: src/generic/dirdlgg.cpp:230 -msgid "Etcetera" -msgstr "og så videre" - -#: ../src/msw/utilsexc.cpp:237 src/msw/utilsexc.cpp:237 -#, c-format -msgid "Execution of command '%s' failed" -msgstr "Afvikling af kommando '%s' fejlede" - -#: ../src/common/resourc2.cpp:326 ../src/common/resourc2.cpp:1399 -#: ../src/common/resource.cpp:1691 ../src/common/resource.cpp:1692 -#: ../src/common/resource.cpp:2769 ../src/common/resource.cpp:2773 -#: src/common/resourc2.cpp:326 src/common/resourc2.cpp:1399 -#: src/common/resource.cpp:1674 src/common/resource.cpp:2747 -msgid "Expected '*' whilst parsing resource." -msgstr "Forventede '*' ved parsning af resource." - -#: ../src/common/resourc2.cpp:342 ../src/common/resourc2.cpp:1415 -#: ../src/common/resource.cpp:1708 ../src/common/resource.cpp:1709 -#: ../src/common/resource.cpp:2786 ../src/common/resource.cpp:2790 -#: src/common/resourc2.cpp:342 src/common/resourc2.cpp:1415 -#: src/common/resource.cpp:1690 src/common/resource.cpp:2763 -msgid "Expected '=' whilst parsing resource." -msgstr "Forventede '=' ved parsning af resource." - -#: ../src/common/resourc2.cpp:312 ../src/common/resourc2.cpp:1385 -#: ../src/common/resource.cpp:1677 ../src/common/resource.cpp:1678 -#: ../src/common/resource.cpp:2755 ../src/common/resource.cpp:2759 -#: src/common/resourc2.cpp:312 src/common/resourc2.cpp:1385 -#: src/common/resource.cpp:1660 src/common/resource.cpp:2733 -msgid "Expected 'char' whilst parsing resource." -msgstr "Forventede 'char' ved parsning af resource." - -#: ../src/msw/clipbrd.cpp:106 ../src/msw/clipbrd.cpp:112 -#: src/msw/clipbrd.cpp:106 -msgid "Failed to close the clipboard." -msgstr "Kunne ikke lukke klippebordet." - -#: ../src/generic/dirdlgg.cpp:460 ../src/generic/dirdlgg.cpp:464 -#: ../src/generic/dirdlgg.cpp:488 ../src/generic/dirdlgg.cpp:492 -#: src/generic/dirdlgg.cpp:460 src/generic/dirdlgg.cpp:488 -msgid "Failed to create directory " -msgstr "Kunne ikke oprette bibliotek " - -#: ../src/msw/tooltip.cpp:260 src/msw/tooltip.cpp:260 -#, c-format -msgid "Failed to create the tooltip '%s'" -msgstr "Kunne ikke oprette tooltip '%s'" - -#: src/msw/dialog.cpp:143 -msgid "Failed to created dialog." -msgstr "Kunne ikke oprette dialog." - -#: ../src/msw/clipbrd.cpp:118 ../src/msw/clipbrd.cpp:124 -#: src/msw/clipbrd.cpp:118 -msgid "Failed to empty the clipboard." -msgstr "Kunne ikke tømme klippebordet." - -#: ../src/common/resourc2.cpp:808 ../src/common/resource.cpp:2174 -#: ../src/common/resource.cpp:2178 src/common/resourc2.cpp:808 -#: src/common/resource.cpp:2156 -#, c-format -msgid "" -"Failed to find XBM resource %s.\n" -"Forgot to use wxResourceLoadBitmapData?" -msgstr "" -"Kunne ikke finde XBM resource %s.\n" -"Glemt at bruge wxResourceLoadBitmapData?" - -#: ../src/common/resourc2.cpp:963 ../src/common/resource.cpp:2329 -#: ../src/common/resource.cpp:2333 src/common/resourc2.cpp:963 -#: src/common/resource.cpp:2311 -#, c-format -msgid "" -"Failed to find XBM resource %s.\n" -"Forgot to use wxResourceLoadIconData?" -msgstr "" -"Kunne ikke finde XBM resource %s.\n" -"Glemt at bruge wxResourceLoadIconData?" - -#: ../src/common/resourc2.cpp:824 ../src/common/resource.cpp:2190 -#: ../src/common/resource.cpp:2194 src/common/resourc2.cpp:824 -#: src/common/resource.cpp:2172 -#, c-format -msgid "" -"Failed to find XPM resource %s.\n" -"Forgot to use wxResourceLoadBitmapData?" -msgstr "" -"Kunne ikke finde XPM resource %s.\n" -"Glemt at bruge wxResourceLoadBitmapData?" - -#: ../src/msw/clipbrd.cpp:86 ../src/msw/clipbrd.cpp:92 src/msw/clipbrd.cpp:86 -msgid "Failed to open the clipboard." -msgstr "Kunne ikke åbne klippebordet." - -#: ../src/msw/clipbrd.cpp:375 ../src/msw/clipbrd.cpp:412 -#: src/msw/clipbrd.cpp:375 -msgid "Failed to retrieve data from the clipboard." -msgstr "Kunne ikke hente data fra klippebordet." - -#: ../src/msw/clipbrd.cpp:262 ../src/msw/clipbrd.cpp:286 -#: src/msw/clipbrd.cpp:262 -msgid "Failed to set clipboard data." -msgstr "Kunne ikke skrive klippebordsdata." - -#: ../src/unix/threadpsx.cpp:551 ../src/unix/threadpsx.cpp:592 -#: ../src/unix/threadpsx.cpp:601 src/gtk/threadpsx.cpp:508 -#, c-format -msgid "Failed to set thread priority %d." -msgstr "Kunne ikke sætte trådprioritet %d." - -#: ../src/unix/threadpsx.cpp:662 ../src/unix/threadpsx.cpp:703 -#: ../src/unix/threadpsx.cpp:713 src/gtk/threadpsx.cpp:611 -msgid "Failed to terminate a thread." -msgstr "Kunne ikke afslutte en tråd." - -#: ../src/common/log.cpp:545 ../src/common/log.cpp:551 src/common/log.cpp:543 -msgid "Fatal error" -msgstr "Fatal fejl" - -#: ../src/common/log.cpp:318 ../src/common/log.cpp:322 src/common/log.cpp:325 -msgid "Fatal error: " -msgstr "Fatal fejl: " - -#: ../src/gtk/filedlg.cpp:68 src/gtk/filedlg.cpp:57 -#, c-format -msgid "File '%s' already exists, do you really want to overwrite it?" -msgstr "Fil '%s' eksisterer allerede, vil du virkelig overskrive den?" - -#: ../src/common/docview.cpp:280 ../src/common/docview.cpp:281 -#: ../src/common/docview.cpp:311 ../src/common/docview.cpp:317 -#: src/common/docview.cpp:247 src/common/docview.cpp:278 -msgid "File error" -msgstr "Fil fejl" - -#: ../src/msw/filedlg.cpp:259 src/msw/filedlg.cpp:252 -#, c-format -msgid "Files (%s)|%s" -msgstr "Filer (%s)|%s" - -#: ../src/generic/fontdlgg.cpp:126 src/generic/fontdlgg.cpp:126 -msgid "Font" -msgstr "Font" - -#: ../src/unix/utilsunx.cpp:276 ../src/unix/utilsunx.cpp:287 -#: src/gtk/utilsgtk.cpp:327 -msgid "Fork failed" -msgstr "Gaffel fejlede ;-)" - -#: ../src/common/resourc2.cpp:295 ../src/common/resourc2.cpp:1368 -#: ../src/common/resource.cpp:1660 ../src/common/resource.cpp:1661 -#: ../src/common/resource.cpp:2738 ../src/common/resource.cpp:2742 -#: src/common/resourc2.cpp:295 src/common/resourc2.cpp:1368 -#: src/common/resource.cpp:1643 src/common/resource.cpp:2716 -msgid "Found " -msgstr "Fandt " - -#: ../src/generic/prntdlgg.cpp:158 ../src/generic/prntdlgg.cpp:165 -#: src/generic/prntdlgg.cpp:97 -msgid "From:" -msgstr "Fra:" - -#: ../src/generic/helphtml.cpp:259 ../src/generic/helphtml.cpp:260 -#: ../src/generic/helphtml.cpp:276 ../src/generic/helphtml.cpp:277 -#: src/generic/helphtml.cpp:259 src/generic/helphtml.cpp:260 -msgid "Help Index" -msgstr "Hjælpeindex" - -#: ../src/common/resourc2.cpp:997 ../src/common/resourc2.cpp:1008 -#: ../src/common/resource.cpp:2363 ../src/common/resource.cpp:2367 -#: ../src/common/resource.cpp:2374 ../src/common/resource.cpp:2378 -#: src/common/resourc2.cpp:997 src/common/resourc2.cpp:1008 -#: src/common/resource.cpp:2345 src/common/resource.cpp:2356 -#, c-format -msgid "Icon resource specification %s not found." -msgstr "Ikonresource specifikation %s blev ikke fundet." - -#: ../src/common/resource.cpp:232 ../src/common/resource.cpp:234 -#: src/common/resource.cpp:234 -msgid "Ill-formed resource file syntax." -msgstr "Forkert formateret resourcefil syntax." - -#: ../src/common/log.cpp:482 ../src/common/log.cpp:486 src/common/log.cpp:477 -msgid "Information" -msgstr "Information" - -#: ../src/generic/fontdlgg.cpp:215 ../src/generic/fontdlgg.cpp:217 -#: src/generic/fontdlgg.cpp:217 -msgid "Italic" -msgstr "Kursiv" - -#: ../src/generic/dcpsg.cpp:1908 ../src/generic/dcpsg.cpp:1909 -#: ../src/generic/dcpsg.cpp:2030 ../src/generic/prntdlgg.cpp:403 -#: ../src/generic/prntdlgg.cpp:410 ../src/generic/prntdlgg.cpp:606 -#: ../src/generic/prntdlgg.cpp:613 src/generic/dcpsg.cpp:1866 -#: src/generic/prntdlgg.cpp:289 src/generic/prntdlgg.cpp:499 -msgid "Landscape" -msgstr "Liggende" - -#: ../src/generic/prntdlgg.cpp:622 ../src/generic/prntdlgg.cpp:629 -#: src/generic/prntdlgg.cpp:515 -msgid "Left margin (mm):" -msgstr "Venstre margin (mm):" - -#: src/generic/dcpsg.cpp:2391 -msgid "Legal 8 1/2 x 14 in" -msgstr "Legal 8 1/2 x 14 in" - -#: src/generic/dcpsg.cpp:2390 -msgid "Letter 8 1/2 x 11 in" -msgstr "Letter 8 1/2 x 11 in" - -#: ../src/generic/fontdlgg.cpp:218 ../src/generic/fontdlgg.cpp:220 -#: src/generic/fontdlgg.cpp:220 -msgid "Light" -msgstr "Let" - -#: ../src/gtk/filedlg.cpp:212 ../src/gtk/filedlg.cpp:227 -#: ../src/gtk/filedlg.cpp:231 ../src/msw/filedlg.cpp:359 -#: ../src/msw/filedlg.cpp:360 src/gtk/filedlg.cpp:177 src/msw/filedlg.cpp:352 -#, c-format -msgid "Load %s file" -msgstr "Load %s file" - -#: ../src/common/log.cpp:725 ../src/common/log.cpp:740 src/common/log.cpp:720 -#, c-format -msgid "Log saved to the file '%s'." -msgstr "Log gemt i filen '%s'." - -#: ../src/gtk/mdi.cpp:347 ../src/gtk/mdi.cpp:369 src/gtk/mdi.cpp:321 -msgid "MDI child" -msgstr "MDI barn" - -#: ../src/common/mimetype.cpp:1263 ../src/common/mimetype.cpp:1265 -#: src/common/mimetype.cpp:1203 -#, c-format -msgid "Mailcap file %s, line %d: incomplete entry ignored." -msgstr "Mailcap fil %s, linie %d: ufuldstændig indgang ignoreret." - -#: src/common/mimetype.cpp:968 -#, c-format -msgid "" -"Mime.types file %s, line %d: extra characters after the field value ignored." -msgstr "" -"Mime.type fil %s, linie %d: ekstra karakterer efter feltværdien ignoreret." - -#: ../src/common/mimetype.cpp:977 ../src/common/mimetype.cpp:979 -#: src/common/mimetype.cpp:941 -#, c-format -msgid "Mime.types file %s, line %d: unterminated quoted string." -msgstr "Mime.type fil %s, linie %d: uafsluttet streng." - -#: ../src/generic/fontdlgg.cpp:210 ../src/generic/fontdlgg.cpp:212 -#: src/generic/fontdlgg.cpp:212 -msgid "Modern" -msgstr "Modern" - -#: ../src/generic/dirdlgg.cpp:226 ../src/generic/dirdlgg.cpp:230 -#: src/generic/dirdlgg.cpp:226 -msgid "Mounted Devices" -msgstr "Monterede enheder" - -#: ../src/generic/dirdlgg.cpp:225 ../src/generic/dirdlgg.cpp:229 -#: src/generic/dirdlgg.cpp:225 -msgid "My Home" -msgstr "Mit hjem" - -#: ../src/generic/dirdlgg.cpp:342 ../src/generic/dirdlgg.cpp:346 -#: src/generic/dirdlgg.cpp:342 -msgid "New..." -msgstr "Ny..." - -#: ../src/generic/extdlgg.cpp:103 ../src/generic/extdlgg.cpp:115 -#: ../src/generic/msgdlgg.cpp:111 ../src/generic/msgdlgg.cpp:148 -#: ../src/gtk/msgdlg.cpp:125 src/generic/msgdlgg.cpp:131 -msgid "No" -msgstr "Nej" - -#: ../src/common/resourc2.cpp:814 ../src/common/resourc2.cpp:969 -#: ../src/common/resource.cpp:2180 ../src/common/resource.cpp:2184 -#: ../src/common/resource.cpp:2335 ../src/common/resource.cpp:2339 -#: src/common/resourc2.cpp:814 src/common/resourc2.cpp:969 -#: src/common/resource.cpp:2162 src/common/resource.cpp:2317 -msgid "No XBM facility available!" -msgstr "Ingen XBM facilitet tilgængelig!" - -#: ../src/common/resourc2.cpp:830 ../src/common/resource.cpp:2196 -#: ../src/common/resource.cpp:2200 src/common/resourc2.cpp:830 -#: src/common/resource.cpp:2178 -msgid "No XPM facility available!" -msgstr "Ingen XPM facilitet tilgængelig!" - -#: ../src/common/resourc2.cpp:991 ../src/common/resource.cpp:2357 -#: ../src/common/resource.cpp:2361 src/common/resourc2.cpp:991 -#: src/common/resource.cpp:2339 -msgid "No XPM icon facility available!" -msgstr "Ingen XPM ikonfacilitet tilgængelig!" - -#: ../src/generic/helphtml.cpp:254 ../src/generic/helphtml.cpp:271 -#: src/generic/helphtml.cpp:254 -msgid "No entries found." -msgstr "Ingen indgange blev fundet." - -#: ../src/generic/fontdlgg.cpp:214 ../src/generic/fontdlgg.cpp:216 -#: ../src/generic/fontdlgg.cpp:217 ../src/generic/fontdlgg.cpp:219 -#: src/generic/fontdlgg.cpp:216 src/generic/fontdlgg.cpp:219 -msgid "Normal" -msgstr "Normal" - -#: ../src/common/dlgcmn.cpp:116 ../src/common/dlgcmn.cpp:159 -#: ../src/generic/choicdgg.cpp:301 ../src/generic/colrdlgg.cpp:231 -#: ../src/generic/colrdlgg.cpp:233 ../src/generic/dcpsg.cpp:1916 -#: ../src/generic/dcpsg.cpp:1917 ../src/generic/dcpsg.cpp:2038 -#: ../src/generic/dirdlgg.cpp:340 ../src/generic/dirdlgg.cpp:344 -#: ../src/generic/extdlgg.cpp:121 ../src/generic/fontdlgg.cpp:258 -#: ../src/generic/fontdlgg.cpp:260 ../src/generic/msgdlgg.cpp:117 -#: ../src/generic/msgdlgg.cpp:158 ../src/generic/prntdlgg.cpp:171 -#: ../src/generic/prntdlgg.cpp:178 ../src/generic/prntdlgg.cpp:429 -#: ../src/generic/prntdlgg.cpp:436 ../src/generic/prntdlgg.cpp:579 -#: ../src/generic/prntdlgg.cpp:586 ../src/generic/textdlgg.cpp:136 -#: ../src/gtk/choicdlg.cpp:266 ../src/gtk/filedlg.cpp:148 -#: ../src/gtk/msgdlg.cpp:131 ../src/gtk/textdlg.cpp:109 -#: src/generic/choicdgg.cpp:301 src/generic/colrdlgg.cpp:231 -#: src/generic/dcpsg.cpp:1874 src/generic/dirdlgg.cpp:340 -#: src/generic/fontdlgg.cpp:260 src/generic/msgdlgg.cpp:138 -#: src/generic/prntdlgg.cpp:110 src/generic/prntdlgg.cpp:316 -#: src/generic/prntdlgg.cpp:472 src/generic/textdlgg.cpp:136 -#: src/gtk/filedlg.cpp:125 -msgid "OK" -msgstr "OK" - -#: ../src/generic/prntdlgg.cpp:409 ../src/generic/prntdlgg.cpp:416 -#: src/generic/prntdlgg.cpp:295 -msgid "Options" -msgstr "Valgmuligheder" - -#: ../src/generic/prntdlgg.cpp:405 ../src/generic/prntdlgg.cpp:412 -#: ../src/generic/prntdlgg.cpp:607 ../src/generic/prntdlgg.cpp:614 -#: src/generic/prntdlgg.cpp:291 src/generic/prntdlgg.cpp:500 -msgid "Orientation" -msgstr "Orientering" - -#: ../src/common/prntbase.cpp:695 ../src/common/prntbase.cpp:705 -#: src/common/prntbase.cpp:693 -#, c-format -msgid "Page %d" -msgstr "Side %d" - -#: ../src/common/prntbase.cpp:693 ../src/common/prntbase.cpp:703 -#: src/common/prntbase.cpp:691 -#, c-format -msgid "Page %d of %d" -msgstr "Side %d af %d" - -#: ../src/generic/prntdlgg.cpp:564 ../src/generic/prntdlgg.cpp:571 -#: src/generic/prntdlgg.cpp:457 -msgid "Page Setup" -msgstr "Sideopsætning" - -#: ../src/generic/prntdlgg.cpp:141 ../src/generic/prntdlgg.cpp:148 -#: src/generic/prntdlgg.cpp:84 -msgid "Pages" -msgstr "Sider" - -#: ../src/generic/prntdlgg.cpp:395 ../src/generic/prntdlgg.cpp:402 -#: ../src/generic/prntdlgg.cpp:756 ../src/generic/prntdlgg.cpp:763 -#: src/generic/prntdlgg.cpp:281 src/generic/prntdlgg.cpp:629 -msgid "Paper size" -msgstr "Side størrelse" - -#: ../src/unix/utilsunx.cpp:259 ../src/unix/utilsunx.cpp:270 -#: src/gtk/utilsgtk.cpp:315 -msgid "Pipe creation failed" -msgstr "Røroprettelse fejlede" - -#: ../src/common/prntbase.cpp:107 ../src/common/prntbase.cpp:112 -#: src/common/prntbase.cpp:111 -msgid "Please wait..." -msgstr "Vent venligst..." - -#: ../src/generic/dcpsg.cpp:1907 ../src/generic/dcpsg.cpp:1908 -#: ../src/generic/dcpsg.cpp:2029 ../src/generic/prntdlgg.cpp:402 -#: ../src/generic/prntdlgg.cpp:409 ../src/generic/prntdlgg.cpp:605 -#: ../src/generic/prntdlgg.cpp:612 src/generic/dcpsg.cpp:1865 -#: src/generic/prntdlgg.cpp:288 src/generic/prntdlgg.cpp:498 -msgid "Portrait" -msgstr "Opretstående" - -#: ../src/generic/dcpsg.cpp:366 ../src/generic/dcpsg.cpp:372 -#: src/generic/dcpsg.cpp:338 -msgid "PostScript" -msgstr "EfterSkrift ;-)" - -#: ../src/generic/prntdlgg.cpp:234 ../src/generic/prntdlgg.cpp:241 -#: src/generic/prntdlgg.cpp:159 -msgid "PostScript file" -msgstr "PostScript fil" - -#: ../src/generic/dcpsg.cpp:1949 ../src/generic/dcpsg.cpp:1950 -#: ../src/generic/dcpsg.cpp:2071 src/generic/dcpsg.cpp:1907 -msgid "PostScript:" -msgstr "PostScript fil:" - -#: ../src/generic/dcpsg.cpp:1912 ../src/generic/dcpsg.cpp:1913 -#: ../src/generic/dcpsg.cpp:2034 src/generic/dcpsg.cpp:1870 -msgid "Preview Only" -msgstr "Bare smugkig" - -#: ../src/generic/prntdlgg.cpp:102 ../src/generic/prntdlgg.cpp:109 -#: ../src/generic/prntdlgg.cpp:116 ../src/generic/prntdlgg.cpp:123 -#: src/generic/prntdlgg.cpp:71 -msgid "Print" -msgstr "Udskriv" - -#: ../src/generic/printps.cpp:189 ../src/generic/printps.cpp:193 -#: ../src/generic/printps.cpp:194 src/generic/printps.cpp:165 -msgid "Print Error" -msgstr "Udskriv fejl" - -#: ../src/common/docview.cpp:831 ../src/common/docview.cpp:857 -#: src/common/docview.cpp:785 -msgid "Print Preview" -msgstr "Udskriftsmugkig" - -#: ../src/common/prntbase.cpp:636 ../src/common/prntbase.cpp:646 -#: ../src/common/prntbase.cpp:658 ../src/common/prntbase.cpp:668 -#: ../src/common/prntbase.cpp:675 ../src/common/prntbase.cpp:685 -#: src/common/prntbase.cpp:633 src/common/prntbase.cpp:655 -#: src/common/prntbase.cpp:673 -msgid "Print Preview Failure" -msgstr "Udskriftsmugkig fejlede" - -#: ../src/generic/prntdlgg.cpp:149 ../src/generic/prntdlgg.cpp:156 -#: src/generic/prntdlgg.cpp:90 -msgid "Print Range" -msgstr "Udskriftsområde" - -#: ../src/generic/prntdlgg.cpp:370 ../src/generic/prntdlgg.cpp:377 -#: ../src/generic/prntdlgg.cpp:384 src/generic/prntdlgg.cpp:276 -msgid "Print Setup" -msgstr "Udskriftsopsætning" - -#: ../src/generic/prntdlgg.cpp:417 ../src/generic/prntdlgg.cpp:424 -#: src/generic/prntdlgg.cpp:303 -msgid "Print in colour" -msgstr "Udskriv i farver" - -#: ../src/generic/prntdlgg.cpp:419 ../src/generic/prntdlgg.cpp:426 -#: src/generic/prntdlgg.cpp:306 -msgid "Print spooling" -msgstr "Udskriftsspuling" - -#: ../src/generic/dcpsg.cpp:1911 ../src/generic/dcpsg.cpp:1912 -#: ../src/generic/dcpsg.cpp:2033 ../src/generic/prntdlgg.cpp:135 -#: ../src/generic/prntdlgg.cpp:142 src/generic/dcpsg.cpp:1869 -#: src/generic/prntdlgg.cpp:78 -msgid "Print to File" -msgstr "Udskriv til fil" - -#: ../src/common/prntbase.cpp:350 ../src/common/prntbase.cpp:359 -#: src/common/prntbase.cpp:349 -msgid "Print..." -msgstr "Udskriv..." - -#: ../src/generic/dcpsg.cpp:1922 ../src/generic/dcpsg.cpp:1923 -#: ../src/generic/dcpsg.cpp:2044 src/generic/dcpsg.cpp:1880 -msgid "Printer Command: " -msgstr "Printer kommando: " - -#: ../src/generic/dcpsg.cpp:1927 ../src/generic/dcpsg.cpp:1928 -#: ../src/generic/dcpsg.cpp:2049 src/generic/dcpsg.cpp:1885 -msgid "Printer Options: " -msgstr "Printer valgmuligheder: " - -#: ../src/generic/dcpsg.cpp:335 ../src/generic/dcpsg.cpp:341 -#: src/generic/dcpsg.cpp:306 -msgid "Printer Settings" -msgstr "Printer opsætninger" - -#: ../src/generic/prntdlgg.cpp:421 ../src/generic/prntdlgg.cpp:428 -#: src/generic/prntdlgg.cpp:308 -msgid "Printer command:" -msgstr "Printer kommando:" - -#: ../src/generic/prntdlgg.cpp:133 ../src/generic/prntdlgg.cpp:140 -#: src/generic/prntdlgg.cpp:76 -msgid "Printer options" -msgstr "Printer valgmuligheder" - -#: ../src/generic/prntdlgg.cpp:425 ../src/generic/prntdlgg.cpp:432 -#: src/generic/prntdlgg.cpp:312 -msgid "Printer options:" -msgstr "Printer valgmuligheder:" - -#: ../src/generic/prntdlgg.cpp:582 ../src/generic/prntdlgg.cpp:589 -#: src/generic/prntdlgg.cpp:475 -msgid "Printer..." -msgstr "Printer..." - -#: ../src/common/prntbase.cpp:106 ../src/common/prntbase.cpp:111 -#: ../src/common/prntbase.cpp:148 ../src/common/prntbase.cpp:153 -#: src/common/prntbase.cpp:110 src/common/prntbase.cpp:152 -msgid "Printing" -msgstr "Udskriver" - -#: ../src/common/prntbase.cpp:120 ../src/common/prntbase.cpp:125 -#: src/common/prntbase.cpp:124 -msgid "Printing Error" -msgstr "Udskriftsfejl" - -#: ../src/common/log.cpp:319 ../src/common/log.cpp:323 src/common/log.cpp:326 -msgid "Program aborted." -msgstr "Program afsluttet" - -#: ../src/common/log.cpp:677 ../src/common/log.cpp:692 src/common/log.cpp:672 -msgid "Question" -msgstr "Spørgsmål" - -#: ../src/msw/registry.cpp:435 src/msw/registry.cpp:435 -#, c-format -msgid "" -"Registry key '%s' is needed for normal system operation,\n" -"deleting it will leave your system in unusable state:\n" -"operation aborted." -msgstr "" -"Registry nøgle '%s' er nødvendig for almindelig system operation,\n" -"hvis du sletter den vil efterlade dit system i ubrugelig tilstand:\n" -"operationen blev afbrudt." - -#: ../src/generic/helphtml.cpp:259 ../src/generic/helphtml.cpp:276 -#: src/generic/helphtml.cpp:259 -msgid "Relevant entries:" -msgstr "Relevante indgange:" - -#: ../src/msw/filedlg.cpp:336 src/msw/filedlg.cpp:329 -#, c-format -msgid "Replace file '%s'?" -msgstr "Erstat fil '%s'?" - -#: ../src/generic/prntdlgg.cpp:628 ../src/generic/prntdlgg.cpp:635 -#: src/generic/prntdlgg.cpp:521 -msgid "Right margin (mm):" -msgstr "Højre margin (mm):" - -#: ../src/generic/fontdlgg.cpp:208 ../src/generic/fontdlgg.cpp:210 -#: src/generic/fontdlgg.cpp:210 -msgid "Roman" -msgstr "Roman" - -#: ../src/gtk/filedlg.cpp:228 ../src/gtk/filedlg.cpp:243 -#: ../src/gtk/filedlg.cpp:247 ../src/msw/filedlg.cpp:359 -#: ../src/msw/filedlg.cpp:361 src/gtk/filedlg.cpp:193 src/msw/filedlg.cpp:352 -#, c-format -msgid "Save %s file" -msgstr "Gem %s fil" - -#: ../src/common/docview.cpp:231 ../src/common/docview.cpp:234 -#: src/common/docview.cpp:198 -msgid "Save as" -msgstr "Gem som" - -#: ../src/common/log.cpp:635 ../src/common/log.cpp:646 src/common/log.cpp:630 -msgid "Save log contents to file" -msgstr "Gen log indhold til fil" - -#: ../src/generic/fontdlgg.cpp:211 ../src/generic/fontdlgg.cpp:213 -#: src/generic/fontdlgg.cpp:213 -msgid "Script" -msgstr "Script" - -#: ../src/common/docview.cpp:1268 ../src/common/docview.cpp:1272 -#: ../src/common/docview.cpp:1299 src/common/docview.cpp:1243 -msgid "Select a document template" -msgstr "Vælg en dokumentskabelon" - -#: ../src/common/docview.cpp:1291 ../src/common/docview.cpp:1295 -#: ../src/common/docview.cpp:1322 src/common/docview.cpp:1266 -msgid "Select a document view" -msgstr "Vælg et dokumentudseende" - -#: ../src/common/docview.cpp:1185 ../src/common/docview.cpp:1189 -#: ../src/common/docview.cpp:1216 ../src/common/docview.cpp:1223 -#: ../src/common/docview.cpp:1227 ../src/common/docview.cpp:1254 -#: src/common/docview.cpp:1168 src/common/docview.cpp:1198 -msgid "Select a file" -msgstr "Vælg en file" - -#: ../src/generic/dcpsg.cpp:1910 ../src/generic/dcpsg.cpp:1911 -#: ../src/generic/dcpsg.cpp:2032 src/generic/dcpsg.cpp:1868 -msgid "Send to Printer" -msgstr "Send til printer" - -#: ../src/generic/prntdlgg.cpp:137 ../src/generic/prntdlgg.cpp:144 -#: src/generic/prntdlgg.cpp:80 -msgid "Setup..." -msgstr "Opsætning..." - -#: ../src/common/layout.cpp:1366 ../src/common/layout.cpp:1371 -#: src/common/layout.cpp:1326 -msgid "Sizer error" -msgstr "Sizer fejl" - -#: ../src/generic/fontdlgg.cpp:216 ../src/generic/fontdlgg.cpp:218 -#: src/generic/fontdlgg.cpp:218 -msgid "Slant" -msgstr "Hældning" - -#: ../src/common/docview.cpp:285 ../src/common/docview.cpp:291 -#: src/common/docview.cpp:252 -msgid "Sorry, could not open this file for saving." -msgstr "Undskyld, jeg kunne ikke åbne denne fil mht. gemning." - -#: ../src/common/docview.cpp:316 ../src/common/docview.cpp:322 -#: ../src/common/docview.cpp:327 ../src/common/docview.cpp:333 -#: src/common/docview.cpp:283 src/common/docview.cpp:289 -msgid "Sorry, could not open this file." -msgstr "Undskyld, jeg kunne ikke åbne denne fil." - -#: ../src/common/docview.cpp:292 ../src/common/docview.cpp:298 -#: src/common/docview.cpp:259 -msgid "Sorry, could not save this file." -msgstr "Undskyld, jeg kunne ikke gemme denne fil." - -#: ../src/common/prntbase.cpp:658 ../src/common/prntbase.cpp:668 -#: src/common/prntbase.cpp:655 -msgid "Sorry, not enough memory to create a preview." -msgstr "Undskyld, der er ikke nok hukkomelse til at danne et smugkig." - -#: ../src/common/log.cpp:787 ../src/common/log.cpp:803 src/common/log.cpp:781 -msgid "Status: " -msgstr "Status: " - -#: ../src/generic/fontdlgg.cpp:212 ../src/generic/fontdlgg.cpp:214 -#: src/generic/fontdlgg.cpp:214 -msgid "Swiss" -msgstr "Swiss" - -#: ../src/generic/fontdlgg.cpp:213 ../src/generic/fontdlgg.cpp:215 -#: src/generic/fontdlgg.cpp:215 -msgid "Teletype" -msgstr "Skrivemaskine" - -#: ../src/common/docview.cpp:1268 ../src/common/docview.cpp:1272 -#: ../src/common/docview.cpp:1299 src/common/docview.cpp:1243 -msgid "Templates" -msgstr "Skabeloner" - -#: ../src/generic/dirdlgg.cpp:231 ../src/generic/dirdlgg.cpp:235 -#: src/generic/dirdlgg.cpp:231 -msgid "Temporary" -msgstr "Midlertidig" - -#: ../src/generic/dirdlgg.cpp:223 ../src/generic/dirdlgg.cpp:227 -#: src/generic/dirdlgg.cpp:223 -msgid "The Computer" -msgstr "Datamaskinen" - -#: ../src/generic/dirdlgg.cpp:447 ../src/generic/dirdlgg.cpp:451 -#: src/generic/dirdlgg.cpp:447 -msgid "The directory " -msgstr "Biblioteket " - -#: ../src/msw/thread.cpp:730 src/msw/thread.cpp:719 -msgid "" -"Thread module initialization failed: can not store value in thread local " -"storage" -msgstr "" -"Trådmodul initialisering fejlede: kan ikke gemme værdi i lokal " -"trådlager" - -#: src/gtk/threadpsx.cpp:708 -msgid "Thread module initialization failed: failed to create pthread key." -msgstr "Trådmodul initialisering fejlede: kunne ikke oprette ptrådnøgle." - -#: ../src/msw/thread.cpp:716 src/msw/thread.cpp:705 -msgid "" -"Thread module initialization failed: impossible to allocate index in thread " -"local storage" -msgstr "" -"Trådmodul initialisering fejlede: umuligt at allokere index i lokal " -"trådlager" - -#: ../src/generic/prntdlgg.cpp:162 ../src/generic/prntdlgg.cpp:169 -#: src/generic/prntdlgg.cpp:101 -msgid "To:" -msgstr "Til:" - -#: ../src/generic/prntdlgg.cpp:637 ../src/generic/prntdlgg.cpp:644 -#: src/generic/prntdlgg.cpp:530 -msgid "Top margin (mm):" -msgstr "Top margin (mm):" - -#: ../src/generic/fontdlgg.cpp:244 ../src/generic/fontdlgg.cpp:246 -#: src/generic/fontdlgg.cpp:246 -msgid "Underline" -msgstr "Understeget" - -#: ../src/common/resourc2.cpp:305 ../src/common/resourc2.cpp:319 -#: ../src/common/resourc2.cpp:335 ../src/common/resourc2.cpp:349 -#: ../src/common/resourc2.cpp:1378 ../src/common/resourc2.cpp:1392 -#: ../src/common/resourc2.cpp:1408 ../src/common/resourc2.cpp:1422 -#: ../src/common/resource.cpp:1670 ../src/common/resource.cpp:1671 -#: ../src/common/resource.cpp:1684 ../src/common/resource.cpp:1685 -#: ../src/common/resource.cpp:1701 ../src/common/resource.cpp:1702 -#: ../src/common/resource.cpp:1715 ../src/common/resource.cpp:1716 -#: ../src/common/resource.cpp:2748 ../src/common/resource.cpp:2752 -#: ../src/common/resource.cpp:2762 ../src/common/resource.cpp:2766 -#: ../src/common/resource.cpp:2779 ../src/common/resource.cpp:2783 -#: ../src/common/resource.cpp:2793 ../src/common/resource.cpp:2797 -#: src/common/resourc2.cpp:305 src/common/resourc2.cpp:319 -#: src/common/resourc2.cpp:335 src/common/resourc2.cpp:349 -#: src/common/resourc2.cpp:1378 src/common/resourc2.cpp:1392 -#: src/common/resourc2.cpp:1408 src/common/resourc2.cpp:1422 -#: src/common/resource.cpp:1653 src/common/resource.cpp:1667 -#: src/common/resource.cpp:1683 src/common/resource.cpp:1697 -#: src/common/resource.cpp:2726 src/common/resource.cpp:2740 -#: src/common/resource.cpp:2756 src/common/resource.cpp:2770 -msgid "Unexpected end of file whilst parsing resource." -msgstr "Uventet afslutning på filen uder parsning af resource." - -#: ../src/common/mimetype.cpp:1019 ../src/common/mimetype.cpp:1021 -#: src/common/mimetype.cpp:985 -#, c-format -msgid "Unknown field in file %s, line %d: '%s'." -msgstr "Ukendt felt i fil %s, linie %d: '%s'." - -#: ../src/common/mimetype.cpp:379 ../src/common/mimetype.cpp:381 -#: src/common/mimetype.cpp:363 -#, c-format -msgid "Unmatched '{' in an entry for mime type %s." -msgstr "Uparret '{' i en indgang for mime type %s." - -#: ../src/common/docview.cpp:1703 ../src/common/docview.cpp:1707 -#: ../src/common/docview.cpp:1718 ../src/common/docview.cpp:1722 -#: ../src/common/docview.cpp:1734 ../src/common/docview.cpp:1745 -#: ../src/common/docview.cpp:1749 ../src/common/docview.cpp:1776 -#: src/common/docview.cpp:1665 src/common/docview.cpp:1680 -#: src/common/docview.cpp:1707 -msgid "Unnamed command" -msgstr "Unavngiven kommando" - -#: ../src/common/resourc2.cpp:687 ../src/common/resource.cpp:2053 -#: ../src/common/resource.cpp:2057 src/common/resourc2.cpp:687 -#: src/common/resource.cpp:2035 -#, c-format -msgid "Unrecognized style %s whilst parsing resource." -msgstr "Ugenkendt stil %s under parsning af resource." - -#: ../src/msw/clipbrd.cpp:220 ../src/msw/clipbrd.cpp:254 -#: ../src/msw/clipbrd.cpp:330 ../src/msw/clipbrd.cpp:353 -#: src/msw/clipbrd.cpp:220 src/msw/clipbrd.cpp:330 -msgid "Unsupported clipboard format." -msgstr "Usupporteret klippebordsformat." - -#: ../src/generic/dirdlgg.cpp:227 ../src/generic/dirdlgg.cpp:231 -#: src/generic/dirdlgg.cpp:227 -msgid "User" -msgstr "Bruger" - -#: ../src/generic/dirdlgg.cpp:228 ../src/generic/dirdlgg.cpp:232 -#: src/generic/dirdlgg.cpp:228 -msgid "User Local" -msgstr "Lokal bruger" - -#: ../src/common/valtext.cpp:188 ../src/common/valtext.cpp:194 -#: src/common/valtext.cpp:144 src/common/valtext.cpp:155 -#: src/common/valtext.cpp:164 src/common/valtext.cpp:172 -#: src/common/valtext.cpp:180 src/common/valtext.cpp:189 -msgid "Validation conflict" -msgstr "Valideringskonflikt" - -#: ../src/generic/dirdlgg.cpp:229 ../src/generic/dirdlgg.cpp:233 -#: src/generic/dirdlgg.cpp:229 -msgid "Variables" -msgstr "Variable" - -#: ../src/common/docview.cpp:1291 ../src/common/docview.cpp:1295 -#: ../src/common/docview.cpp:1322 src/common/docview.cpp:1266 -msgid "Views" -msgstr "Udseender" - -#: ../src/common/docview.cpp:401 ../src/common/docview.cpp:420 -#: ../src/common/log.cpp:478 ../src/common/log.cpp:482 -#: ../src/common/resource.cpp:119 ../src/common/resource.cpp:121 -#: src/common/docview.cpp:368 src/common/resource.cpp:121 -msgid "Warning" -msgstr "Advarsel" - -#: ../src/common/log.cpp:329 ../src/common/log.cpp:333 src/common/log.cpp:336 -msgid "Warning: " -msgstr "Advarsel: " - -#: ../src/generic/dcpsg.cpp:1967 ../src/generic/dcpsg.cpp:1968 -#: ../src/generic/dcpsg.cpp:2089 src/generic/dcpsg.cpp:1925 -msgid "X Scaling" -msgstr "X scalering" - -#: ../src/generic/dcpsg.cpp:1976 ../src/generic/dcpsg.cpp:1977 -#: ../src/generic/dcpsg.cpp:2098 src/generic/dcpsg.cpp:1934 -msgid "X Translation" -msgstr "X oversættelse" - -#: ../src/generic/dcpsg.cpp:1971 ../src/generic/dcpsg.cpp:1972 -#: ../src/generic/dcpsg.cpp:2093 src/generic/dcpsg.cpp:1929 -msgid "Y Scaling" -msgstr "Y scalering" - -#: ../src/generic/dcpsg.cpp:1980 ../src/generic/dcpsg.cpp:1981 -#: ../src/generic/dcpsg.cpp:2102 src/generic/dcpsg.cpp:1938 -msgid "Y Translation" -msgstr "Y oversættelse" - -#: ../src/generic/extdlgg.cpp:101 ../src/generic/extdlgg.cpp:109 -#: ../src/generic/msgdlgg.cpp:109 ../src/generic/msgdlgg.cpp:147 -#: ../src/gtk/msgdlg.cpp:123 src/generic/msgdlgg.cpp:130 -msgid "Yes" -msgstr "Ja" - -#: ../src/common/docview.cpp:1814 ../src/common/docview.cpp:1818 -#: ../src/common/docview.cpp:1845 src/common/docview.cpp:1777 -msgid "[EMPTY]" -msgstr "[TOM]" - -#: ../src/common/time.cpp:358 src/common/time.cpp:358 -msgid "am" -msgstr "er " - -#: ../src/common/fileconf.cpp:1265 ../src/common/fileconf.cpp:1266 -#: src/common/CVS/Base/fileconf.cpp:1269 src/common/fileconf.cpp:1269 -#, c-format -msgid "attempt to change immutable key '%s' ignored." -msgstr "forsøg på at ændre uforanderlig nøgle '%s' blev ignoreret." - -#: ../src/common/string.cpp:1703 ../src/common/string.cpp:1830 -#: src/common/string.cpp:1430 -msgid "bad index in wxArrayString::Remove" -msgstr "forkert index i wxArrayString::Remove" - -#: ../src/common/file.cpp:273 ../src/common/file.cpp:274 -#: src/common/file.cpp:268 -#, c-format -msgid "can't close file descriptor %d" -msgstr "kan ikke lukke fildeskriptor %d" - -#: ../src/msw/registry.cpp:403 src/msw/registry.cpp:403 -#, c-format -msgid "can't close registry key '%s'" -msgstr "kan ikke lukke registry nøgle '%s'" - -#: ../src/common/file.cpp:563 ../src/common/file.cpp:564 -#: src/common/file.cpp:520 -#, c-format -msgid "can't commit changes to file '%s'" -msgstr "kan ikke overgive ændringer til fil '%s'" - -#: ../src/common/file.cpp:224 ../src/common/file.cpp:225 -#: src/common/file.cpp:215 -#, c-format -msgid "can't create file '%s'" -msgstr "kan ikke oprette file '%s'" - -#: ../src/msw/registry.cpp:386 src/msw/registry.cpp:386 -#, c-format -msgid "can't create registry key '%s'" -msgstr "kan ikke oprette registry nøgle '%s'" - -#: ../src/msw/registry.cpp:467 src/msw/registry.cpp:467 -#, c-format -msgid "can't delete key '%s'" -msgstr "kan ikke slette nøgle '%s'" - -#: ../src/common/fileconf.cpp:735 ../src/common/fileconf.cpp:736 -#: src/common/CVS/Base/fileconf.cpp:742 src/common/fileconf.cpp:742 -#, c-format -msgid "can't delete user configuration file '%s'" -msgstr "kan ikke slette brugerkonfigurationsfil '%s'" - -#: ../src/msw/registry.cpp:492 src/msw/registry.cpp:492 -#, c-format -msgid "can't delete value '%s' from key '%s'" -msgstr "kan ikke slette værdi '%s' fra nøgle '%s'" - -#: ../src/msw/registry.cpp:503 src/msw/registry.cpp:503 -#, c-format -msgid "can't delete value of key '%s'" -msgstr "kan ikke slette værdi af nøgle '%s'" - -#: src/common/file.cpp:447 -#, c-format -msgid "can't determine if the end of file is reached on descriptor %d" -msgstr "kan ikke afgøre om slutningen af filen er nået på deskriptor %d" - -#: ../src/msw/registry.cpp:780 ../src/msw/registry.cpp:791 -#: src/msw/registry.cpp:780 -#, c-format -msgid "can't enumerate subkeys of key '%s'" -msgstr "kan ikke nummerere undernøgle af nøgle '%s'" - -#: ../src/msw/registry.cpp:735 ../src/msw/registry.cpp:746 -#: src/msw/registry.cpp:735 -#, c-format -msgid "can't enumerate values of key '%s'" -msgstr "kan ikke nummerere værdi af nøgle '%s'" - -#: ../src/common/file.cpp:418 ../src/common/file.cpp:419 -#: src/common/file.cpp:413 -#, c-format -msgid "can't find length of file on file descriptor %d" -msgstr "kan ikke finde længden af filen på fildeskriptor %d" - -#: ../src/msw/utils.cpp:584 ../src/msw/utils.cpp:622 src/msw/utils.cpp:561 -msgid "can't find user's HOME, using current directory." -msgstr "kan ikke finde brugerens HJEM, bruger nuværende bibliotek." - -#: ../src/common/file.cpp:332 ../src/common/file.cpp:333 -#: src/common/file.cpp:327 -#, c-format -msgid "can't flush file descriptor %d" -msgstr "kan ikke skylle fildeskriptor %d ud" - -#: ../src/msw/registry.cpp:335 src/msw/registry.cpp:335 -#, c-format -msgid "can't get info about registry key '%s'" -msgstr "kan ikke gå information om registry nøgle '%s'" - -#: ../src/common/file.cpp:386 ../src/common/file.cpp:387 -#: src/common/file.cpp:381 -#, c-format -msgid "can't get seek position on file descriptor %d" -msgstr "kan ikke få søgeposition på fildescriptor %d" - -#: ../src/common/file.cpp:259 ../src/common/file.cpp:260 -#: src/common/file.cpp:254 -#, c-format -msgid "can't open file '%s'" -msgstr "kan ikke åbne filen '%s'" - -#: ../src/common/fileconf.cpp:182 ../src/common/fileconf.cpp:183 -#: src/common/CVS/Base/fileconf.cpp:186 src/common/fileconf.cpp:186 -#, c-format -msgid "can't open global configuration file '%s'." -msgstr "kan ikke åbne global konfiguraionsfil '%s'." - -#: ../src/msw/registry.cpp:361 src/msw/registry.cpp:361 -#, c-format -msgid "can't open registry key '%s'" -msgstr "kan ikke åbne registry nøgle '%s'" - -#: ../src/common/fileconf.cpp:194 ../src/common/fileconf.cpp:195 -#: src/common/CVS/Base/fileconf.cpp:198 src/common/fileconf.cpp:198 -#, c-format -msgid "can't open user configuration file '%s'." -msgstr "kan ikke åbge brugerkonfigurationsfil '%s'." - -#: ../src/common/fileconf.cpp:641 ../src/common/fileconf.cpp:642 -#: src/common/CVS/Base/fileconf.cpp:646 src/common/fileconf.cpp:646 -msgid "can't open user configuration file." -msgstr "kan ikke åbne brugerkonfigurationsfil." - -#: ../src/common/file.cpp:299 ../src/common/file.cpp:300 -#: src/common/file.cpp:294 -#, c-format -msgid "can't read from file descriptor %d" -msgstr "kan ikke læse fra fildeskriptor %d" - -#: ../src/msw/registry.cpp:658 ../src/msw/registry.cpp:670 -#: src/msw/registry.cpp:658 -#, c-format -msgid "can't read value of '%s'" -msgstr "kan ikke læse værdien af '%s'" - -#: ../src/msw/registry.cpp:569 ../src/msw/registry.cpp:581 -#: ../src/msw/registry.cpp:608 ../src/msw/registry.cpp:620 -#: src/msw/registry.cpp:569 src/msw/registry.cpp:608 -#, c-format -msgid "can't read value of key '%s'" -msgstr "kan ikke læse værdien af nøgle '%s'" - -#: ../src/common/file.cpp:558 ../src/common/file.cpp:559 -#: src/common/file.cpp:515 -#, c-format -msgid "can't remove file '%s'" -msgstr "kan ikke fjerne filen '%s'" - -#: ../src/common/file.cpp:574 ../src/common/file.cpp:575 -#: src/common/file.cpp:531 -#, c-format -msgid "can't remove temporary file '%s'" -msgstr "kan ikke fjerne midlertidig fil '%s'" - -#: ../src/common/file.cpp:372 ../src/common/file.cpp:373 -#: src/common/file.cpp:367 -#, c-format -msgid "can't seek on file descriptor %d" -msgstr "kan ikke søge på fildeskriptor %d" - -#: ../src/msw/registry.cpp:594 ../src/msw/registry.cpp:606 -#: ../src/msw/registry.cpp:682 ../src/msw/registry.cpp:694 -#: src/msw/registry.cpp:594 src/msw/registry.cpp:682 -#, c-format -msgid "can't set value of '%s'" -msgstr "kan ikke sætte værdien af '%s'" - -#: src/common/CVS/Base/fileconf.cpp:594 src/common/fileconf.cpp:594 -msgid "can't set value of a group!" -msgstr "kan ikke sætte værdien af gruppe!" - -#: ../src/common/textfile.cpp:237 ../src/common/textfile.cpp:243 -#: src/common/textfile.cpp:229 -#, c-format -msgid "can't write file '%s' to disk." -msgstr "kan ikke skrive fil '%s' til disk." - -#: ../src/common/file.cpp:317 ../src/common/file.cpp:318 -#: src/common/file.cpp:312 -#, c-format -msgid "can't write to file descriptor %d" -msgstr "kan ikke skrive til fildeskriptor %d" - -#: ../src/common/fileconf.cpp:648 ../src/common/fileconf.cpp:649 -#: src/common/CVS/Base/fileconf.cpp:653 src/common/fileconf.cpp:653 -msgid "can't write user configuration file." -msgstr "kan ikke skrive brugerkonfigurationsfil." - -#: ../src/common/intl.cpp:301 ../src/common/intl.cpp:334 -#: src/common/intl.cpp:300 -#, c-format -msgid "catalog file for domain '%s' not found." -msgstr "katalogfil for domæne '%s' blev ikke fundet." - -#: ../src/common/filefn.cpp:1527 src/common/filefn.cpp:1497 -msgid "empty file name in wxFindFileInPath" -msgstr "tom filnavn i wxFindFileInPath" - -#: ../src/common/fileconf.cpp:1252 ../src/common/fileconf.cpp:1253 -#: src/common/CVS/Base/fileconf.cpp:1256 src/common/fileconf.cpp:1256 -#, c-format -msgid "entry '%s' appears more than once in group '%s'" -msgstr "indgang '%s' optræder mere en engang i gruppe '%s'" - -#: ../src/common/fileconf.cpp:334 ../src/common/fileconf.cpp:335 -#: src/common/CVS/Base/fileconf.cpp:338 src/common/fileconf.cpp:338 -#, c-format -msgid "file '%s', line %d: '%s' ignored after group header." -msgstr "fil '%s', linie %d: '%s' ignoreret efter gruppeindledning" - -#: ../src/common/fileconf.cpp:360 ../src/common/fileconf.cpp:361 -#: src/common/CVS/Base/fileconf.cpp:357 src/common/fileconf.cpp:357 -#, c-format -msgid "file '%s', line %d: '=' expected." -msgstr "fil '%s', linie %d: '=' forventet." - -#: ../src/common/fileconf.cpp:387 ../src/common/fileconf.cpp:388 -#: src/common/CVS/Base/fileconf.cpp:384 src/common/fileconf.cpp:384 -#, c-format -msgid "file '%s', line %d: key '%s' was first found at line %d." -msgstr "fil '%s', linie %d: nøgle '%s blev først fundet på linie %d." - -#: ../src/common/fileconf.cpp:376 ../src/common/fileconf.cpp:377 -#: src/common/CVS/Base/fileconf.cpp:373 src/common/fileconf.cpp:373 -#, c-format -msgid "file '%s', line %d: value for immutable key '%s' ignored." -msgstr "fil '%s', linie %d: værdi af uforanderlig nøgle '%s' blev ignoreret." - -#: ../src/common/fileconf.cpp:302 ../src/common/fileconf.cpp:303 -#: src/common/CVS/Base/fileconf.cpp:307 src/common/fileconf.cpp:307 -#, c-format -msgid "file '%s': unexpected character %c at line %d." -msgstr "fil '%s': uventet karakter %c på linie %d." - -#: ../src/common/date.cpp:374 ../src/common/date.cpp:377 -#: ../src/common/date.cpp:392 ../src/common/date.cpp:395 -#: ../src/common/date.cpp:406 ../src/common/date.cpp:409 -#: src/common/date.cpp:373 src/common/date.cpp:391 src/common/date.cpp:405 -msgid "invalid date" -msgstr "ugyldig dato" - -#: ../src/common/date.cpp:356 ../src/common/date.cpp:359 -#: src/common/date.cpp:355 -msgid "invalid day" -msgstr "ugyldig dag" - -#: ../src/common/file.cpp:457 ../src/common/file.cpp:458 -#: src/common/file.cpp:452 -msgid "invalid eof() return value." -msgstr "ugyldig eof() returværdi." - -#: ../src/common/log.cpp:690 ../src/common/log.cpp:705 src/common/log.cpp:685 -msgid "invalid message box return value" -msgstr "ugyldig meddelelsesboks returværdi" - -#: ../src/common/date.cpp:364 ../src/common/date.cpp:367 -#: src/common/date.cpp:363 -msgid "invalid month" -msgstr "ugyldig måned" - -#: ../src/common/intl.cpp:432 ../src/common/intl.cpp:465 -#: src/common/intl.cpp:431 -#, c-format -msgid "locale '%s' can not be set." -msgstr "locale '%s' kan ikke sættes." - -#: ../src/common/intl.cpp:296 ../src/common/intl.cpp:329 -#: src/common/intl.cpp:295 -#, c-format -msgid "looking for catalog '%s' in path '%s'." -msgstr "søger efter katalog '%s' i sti '%s'." - -#: ../src/common/time.cpp:360 src/common/time.cpp:360 -msgid "pm" -msgstr "efter middag" - -#: ../src/common/string.cpp:1719 ../src/common/string.cpp:1846 -#: src/common/string.cpp:1446 -msgid "removing inexistent element in wxArrayString::Remove" -msgstr "fjerner ikke-eksisterende element i wxArrayString::Remove" - -#: ../src/common/intl.cpp:521 ../src/common/intl.cpp:554 -#: src/common/intl.cpp:519 -#, c-format -msgid "string '%s' not found in domain '%s' for locale '%s'." -msgstr "streng '%s' blev ikke fundet i domæne '%s for locale '%s'." - -#: ../src/common/intl.cpp:526 ../src/common/intl.cpp:559 -#: src/common/intl.cpp:524 -#, c-format -msgid "string '%s' not found in locale '%s'." -msgstr "streng '%s' blev ikke fundet i locale '%s'." - -#: ../src/common/fileconf.cpp:1372 ../src/common/fileconf.cpp:1373 -#: src/common/CVS/Base/fileconf.cpp:1376 src/common/fileconf.cpp:1376 -#, c-format -msgid "unexpected \" at position %d in '%s'." -msgstr "uventet \" på position %s i '%s'." - -#: src/common/log.cpp:362 -msgid "unknown log level in wxLog::DoLog" -msgstr "ukendt log-niveau i wxLog::DoLog" - -#: src/common/log.cpp:559 -msgid "unknown log level in wxLogGui::DoLog" -msgstr "ukendt log-niveau i wxLogGui::DoLog" - -#: ../src/common/file.cpp:367 ../src/common/file.cpp:368 -#: src/common/file.cpp:362 -msgid "unknown seek origin" -msgstr "ukendt søgeorigo" - -#: ../src/common/docview.cpp:370 ../src/common/docview.cpp:389 -#: src/common/docview.cpp:337 -msgid "unnamed" -msgstr "unavngivet" - -#: ../src/common/docview.cpp:1055 ../src/common/docview.cpp:1082 -#: src/common/docview.cpp:1009 -#, c-format -msgid "unnamed%d" -msgstr "unavngivet%d" - -#: ../src/common/intl.cpp:306 ../src/common/intl.cpp:339 -#: src/common/intl.cpp:305 -#, c-format -msgid "using catalog '%s' from '%s'." -msgstr "bruger katalog '%s' fra '%s'." - -#: ../src/common/layout.cpp:1366 ../src/common/layout.cpp:1371 -#: src/common/layout.cpp:1326 -msgid "wxExpandSizer has no parent!" -msgstr "wxExpandSizer har ingen forældre!" - -#: ../src/common/prntbase.cpp:635 ../src/common/prntbase.cpp:645 -#: src/common/prntbase.cpp:632 -msgid "" -"wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to " -"let me know about the canvas!" -msgstr "" -"wxPrintPreviewBase::RenderPage: skal bruge wxPrintPreviewBase::SetCanvas " -"for at lade mig vide om kanvasen!" - -#: ../src/common/filefn.cpp:1134 src/common/filefn.cpp:1123 -msgid "wxWindows: error finding temporary file name.\n" -msgstr "wxWindows: fejl ved søgning efter midlertidig filnavn.\n" - -#: ../src/gtk/filedlg.cpp:79 -msgid "Please choose an existing file." -msgstr "Vælg venligst en eksisterende fil." - -#: ../src/generic/printps.cpp:173 ../src/generic/printps.cpp:177 -#: ../src/generic/printps.cpp:179 -msgid "Printing..." -msgstr "Udskriver..." - -#: ../src/generic/printps.cpp:207 ../src/generic/printps.cpp:211 -#: ../src/generic/printps.cpp:212 -#, c-format -msgid "Printing page %d..." -msgstr "Udskriver side %d..." - -#: ../src/generic/dcpsg.cpp:2188 ../src/generic/dcpsg.cpp:2189 -#: ../src/generic/dcpsg.cpp:2310 -msgid "A4 sheet, 210 x 297 mm" -msgstr "A4 papir, 210 x 297 mm" - -#: ../src/common/dynlib.cpp:187 ../src/common/dynlib.cpp:254 -#, c-format -msgid "Couldn't find symbol '%s' in a dynamic library" -msgstr "Kunne ikke finde symbolet '%s' i et dynamisk bibliotek" - -#: ../src/common/dynlib.cpp:215 ../src/common/dynlib.cpp:274 -#, c-format -msgid "Failed to load shared library '%s'" -msgstr "Kunne ikke load'e delt bibliotek '%s'" - -#: ../src/common/file.cpp:452 ../src/common/file.cpp:453 -#, c-format -msgid "" -"can't determine if the end of file is reached on descriptor " -"%d" -msgstr "" -"kan ikke afgøre, om slutning af filen er nået på deskriptor " -"%d" - -#: ../src/common/fileconf.cpp:610 ../src/common/fileconf.cpp:611 -#, c-format -msgid "Config entry name cannot start with '%c'." -msgstr "Konfigureringsindgangsnav kan ikke begynde med '%c'." - -#: ../src/common/filefn.cpp:1003 -#, c-format -msgid "Directory '%s' couldn't be created" -msgstr "Bibliotek '%s' kunne ikke oprettes" - -#: ../src/common/string.cpp:1687 ../src/common/string.cpp:1814 -msgid "bad index in wxArrayString::Insert" -msgstr "forkert index i wxArrayString::Insert" - -#: ../src/common/valtext.cpp:140 ../src/common/valtext.cpp:146 -#, c-format -msgid "'%s' is invalid" -msgstr "'%s' er ugyldigt" - -#: ../src/common/valtext.cpp:160 ../src/common/valtext.cpp:166 -#, c-format -msgid "'%s' should only contain ASCII characters." -msgstr "'%s' må kun indeholde ASCII karakterer." - -#: ../src/common/valtext.cpp:166 ../src/common/valtext.cpp:172 -#, c-format -msgid "'%s' should only contain alphabetic characters." -msgstr "'%s' må kun indeholde bogstaver." - -#: ../src/common/valtext.cpp:172 ../src/common/valtext.cpp:178 -#, c-format -msgid "'%s' should only contain alphabetic or numeric characters." -msgstr "'%s' må kun indeholde bogstaver eller tal." - -#: ../src/common/valtext.cpp:178 ../src/common/valtext.cpp:184 -#, c-format -msgid "'%s' should be numeric." -msgstr "'%s' skal være numerisk." - -#: ../src/common/imagjpeg.cpp:169 ../src/common/imagjpeg.cpp:174 -msgid "Couldn't load a JPEG image - probably file is corrupted." -msgstr "Kunne ikke load'e et JPEG billede - sandsynligvis er filen korrupt." - -#: ../src/common/imagjpeg.cpp:282 ../src/common/imagjpeg.cpp:287 -msgid "Couldn't save a JPEG image - probably file is corrupted." -msgstr "Kunne ikke gemme et JPEG billede - sandsynligvis er filen korrupt." - -#: ../src/motif/app.cpp:559 -#, c-format -msgid "wxWindows could not open display for '%s': exiting." -msgstr "wxWindows kunne ikke åbne diplay for '%s': stopper." - -#: ../src/msw/app.cpp:198 ../src/msw/app.cpp:200 -msgid "Could not initialise Rich Edit DLL" -msgstr "Kunne ikke initialisere 'Rich Edit DLL'" - -#: ../src/msw/app.cpp:653 ../src/msw/app.cpp:698 -msgid "Unrecoverable program error detected: the application will terminate." -msgstr "Uoprettelig programfejl opdaget: programmet bliver afbrudt." - -#: ../src/msw/app.cpp:655 ../src/msw/app.cpp:700 -msgid "Fatal Error" -msgstr "Fatal fejl" - -#: ../src/msw/app.cpp:1125 ../src/msw/app.cpp:1165 -msgid "Fatal error: exiting" -msgstr "Fatal fejl: stopper" - -#: ../src/msw/dialog.cpp:140 ../src/msw/dialog.cpp:142 -#: ../src/msw/dialog.cpp:145 -msgid "Failed to create dialog." -msgstr "Fejlede ved oprettelse af dialog." - -#: ../src/unix/threadpsx.cpp:296 ../src/unix/threadpsx.cpp:298 -#: ../src/unix/threadpsx.cpp:302 -msgid "Cannot start thread: error writing TLS" -msgstr "Kan ikke starte tråd: fejl ved skrivning af TLS" - -#: ../src/unix/threadpsx.cpp:477 ../src/unix/threadpsx.cpp:518 -#: ../src/unix/threadpsx.cpp:527 -msgid "Cannot retrieve thread scheduling policy." -msgstr "Kan ikke hente trådafviklingsalgoritme." - -#: ../src/unix/threadpsx.cpp:485 ../src/unix/threadpsx.cpp:526 -#: ../src/unix/threadpsx.cpp:535 -#, c-format -msgid "Cannot get priority range for scheduling policy %d." -msgstr "Kan ikke få prioritetsområde for afviklingsalgoritme %d." - -#: ../src/unix/threadpsx.cpp:768 ../src/unix/threadpsx.cpp:813 -#: ../src/unix/threadpsx.cpp:827 -msgid "Thread module initialization failed: failed to create thread key" -msgstr "Trådmodul initialisering fejlede: kunne ikke oprette trådnøgle" - -#: ../src/unix/utilsunx.cpp:211 ../src/unix/utilsunx.cpp:222 -msgid "Waiting for subprocess termination failed" -msgstr "Venten på under-process afslutning fejlede" - -#: ../src/unix/utilsunx.cpp:449 ../src/unix/utilsunx.cpp:460 -msgid "Cannot get the hostname" -msgstr "Kan ikke få host-navnet" - -#: ../src/unix/utilsunx.cpp:485 ../src/unix/utilsunx.cpp:496 -msgid "Cannot get the official hostname" -msgstr "Kan ikke få det officielle host-navn" - -#: ../src/unix/utilsunx.cpp:547 ../src/unix/utilsunx.cpp:555 -#: ../src/unix/utilsunx.cpp:558 ../src/unix/utilsunx.cpp:566 -msgid "Error " -msgstr "Fejl " - -#: ../src/msw/mdi.cpp:352 ../src/msw/mdi.cpp:355 -msgid "Failed to create MDI parent frame." -msgstr "Kunne ikke oprette MDI forældreramme." - -#: ../src/msw/window.cpp:1342 ../src/msw/window.cpp:2225 -msgid "" -"Can't find dummy dialog template!\n" -"Check resource include path for finding wx.rc." -msgstr "" -"Kan ikke finde dummy dialogskabelon!\n" -"Check resource include stien til at finde wx.rc." - -#: ../src/msw/window.cpp:1368 ../src/msw/window.cpp:2266 -#, c-format -msgid "" -"Can't create window of class %s!\n" -"Possible Windows 3.x compatibility problem?" -msgstr "" -"Kan ikke oprette vindue af klasse %s!\n" -"Muligvis Windows 3.x kompatibilitetsproblem?" - -#: ../src/generic/dcpsg.cpp:1403 -msgid "Cannot open file for PostScript printing!" -msgstr "Kan ikke åbne fil til PostScript udskrivning!" - -#: ../src/generic/helpext.cpp:90 -#, c-format -msgid "Cannot open URL '%s'" -msgstr "Kan ikke åbne URL '%s'" - -#: ../src/generic/extdlgg.cpp:126 -msgid "Forward" -msgstr "Fremad" - -#: ../src/generic/extdlgg.cpp:129 -msgid "Backward" -msgstr "Tilbage" - -#: ../src/generic/extdlgg.cpp:132 -msgid "Setup" -msgstr "Opsætning" - -#: ../src/generic/extdlgg.cpp:135 -msgid "More..." -msgstr "Mere..." - -#: ../src/generic/extdlgg.cpp:138 -msgid "Help" -msgstr "Hjælp" - -#: ../src/generic/tipdlg.cpp:137 -msgid "Tips not available, sorry!" -msgstr "Tips ikke tilgængelige, beklager!" - -#: ../src/generic/tipdlg.cpp:161 -msgid "Tip of the Day" -msgstr "Dagens tip" - -#: ../src/generic/tipdlg.cpp:172 -msgid "&Show tips at startup" -msgstr "&Vis tips ved opstart" - -#: ../src/generic/tipdlg.cpp:173 -msgid "&Next" -msgstr "&Næste" - -#: ../src/generic/tipdlg.cpp:175 -msgid "Did you know..." -msgstr "Vidste du..." - -#: ../src/msw/clipbrd.cpp:149 -#, c-format -msgid "Failed to allocate %dKb of memory for clipboard transfer." -msgstr "Kunne ikke allokere %dKb hukommelse til klippebordsoverførsel." - -#: ../src/msw/clipbrd.cpp:164 -#, c-format -msgid "Failed to set clipboard data in format %s" -msgstr "Kunne ikke skrive klippebordsdata i format %s" - -#: ../src/msw/menu.cpp:156 -msgid "ctrl" -msgstr "ctrl" - -#: ../src/msw/menu.cpp:158 -msgid "alt" -msgstr "alt" - -#: ../src/msw/menu.cpp:160 -msgid "shift" -msgstr "skift" diff --git a/locale/fr.po b/locale/fr.po new file mode 100644 index 0000000000..73fa506eb6 --- /dev/null +++ b/locale/fr.po @@ -0,0 +1,2927 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2000-04-13 16:08+0930\n" +"PO-Revision-Date: 2000-03-22 11:46Romance Standard Time\n" +"Last-Translator: Gil <gilles.guyot@krypton.be>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: ../src/generic/dirdlgg.cpp:550 +msgid "" +"\n" +"(Do you have the required permissions?)" +msgstr "" +"\n" +"(Avez-vous les permissions requises ?)" + +#: ../src/generic/dirdlgg.cpp:537 +msgid "" +"\n" +"does not exist\n" +"Create it now?" +msgstr "" +"\n" +"n'existe pas\n" +"Voulez-vous le créer maintenant ?" + +#: ../src/common/log.cpp:238 +#, c-format +msgid " (error %ld: %s)" +msgstr " (erreur %ld : %s)" + +#: ../src/common/docview.cpp:1195 +msgid " - " +msgstr " - " + +#: ../src/html/htmprint.cpp:491 +msgid " Preview" +msgstr " Aperçu" + +#: ../src/generic/filedlgg.cpp:328 +msgid " bytes " +msgstr " octets " + +#: ../src/common/resourc2.cpp:265 ../src/common/resourc2.cpp:1334 +#: ../src/common/resource.cpp:1765 ../src/common/resource.cpp:1895 +#: ../src/common/resource.cpp:2975 +#, c-format +msgid "#define %s must be an integer." +msgstr "#define %s doit être un entier." + +#: ../src/html/helpfrm.cpp:718 ../src/html/helpfrm.cpp:719 +#: ../src/html/helpfrm.cpp:1277 ../src/html/helpfrm.cpp:1304 +#, c-format +msgid "%i of %i" +msgstr "%i de %i" + +#: ../src/common/cmdline.cpp:727 +#, c-format +msgid "%s (or %s)" +msgstr "%s (ou %s)" + +#: ../src/common/resourc2.cpp:709 ../src/common/resource.cpp:2346 +#, c-format +msgid "%s not a bitmap resource specification." +msgstr "%s n'est pas une spécification d'une ressource bitmap." + +#: ../src/common/resourc2.cpp:864 ../src/common/resource.cpp:2501 +#, c-format +msgid "%s not an icon resource specification." +msgstr "%s n'est pas une spécification d'une ressource icône." + +#: ../src/common/resourc2.cpp:357 ../src/common/resourc2.cpp:1430 +#: ../src/common/resource.cpp:1858 ../src/common/resource.cpp:1987 +#: ../src/common/resource.cpp:3072 +#, c-format +msgid "%s: ill-formed resource file syntax." +msgstr "%s : syntaxe du fichier de ressource incorrecte." + +#: ../src/generic/logg.cpp:446 ../src/generic/tipdlg.cpp:170 +msgid "&Close" +msgstr "&Fermer" + +#: ../src/generic/logg.cpp:681 +msgid "&Details" +msgstr "" + +#: ../src/generic/wizard.cpp:268 +msgid "&Finish" +msgstr "&Fin" + +#: ../src/generic/logg.cpp:447 +msgid "&Log" +msgstr "&Journal" + +#: ../src/generic/wizard.cpp:171 ../src/generic/wizard.cpp:270 +msgid "&Next >" +msgstr "&Suivant >" + +#: ../src/generic/tipdlg.cpp:175 +msgid "&Next Tip" +msgstr "&Prochain Conseil" + +#: ../src/common/docview.cpp:1891 ../src/common/docview.cpp:1902 +msgid "&Redo" +msgstr "&Refaire" + +#: ../src/common/docview.cpp:1885 ../src/common/docview.cpp:1912 +msgid "&Redo " +msgstr "&Refaire " + +#: ../src/generic/logg.cpp:442 +msgid "&Save..." +msgstr "&Enregistrer ..." + +#: ../src/generic/tipdlg.cpp:172 +msgid "&Show tips at startup" +msgstr "&Afficher les conseils au démarrage" + +#: ../src/common/docview.cpp:1897 +msgid "&Undo" +msgstr "&Annuler" + +#: ../src/common/docview.cpp:1872 +msgid "&Undo " +msgstr "&Annuler " + +#: ../src/common/config.cpp:395 +#, c-format +msgid "'%s' has extra '..', ignored." +msgstr "'%s' a trop de '..', ils sont ignorés." + +#: ../src/common/valtext.cpp:140 +#, c-format +msgid "'%s' is invalid" +msgstr "'%s' n'est pas valide" + +#: ../src/common/cmdline.cpp:649 +#, c-format +msgid "'%s' is not a correct numeric value for option '%s'." +msgstr "'%s' n'est pas une valeur numérique correcte pour l'option '%s'." + +#: ../src/common/intl.cpp:387 +#, c-format +msgid "'%s' is not a valid message catalog." +msgstr "'%s' n'est pas un catalogue de messages valide." + +#: ../src/common/textfile.cpp:250 +#, c-format +msgid "'%s' is probably a binary file." +msgstr "'%s' est probablement un fichier binaire." + +#: ../src/common/valtext.cpp:178 +#, c-format +msgid "'%s' should be numeric." +msgstr "'%s' devrait être numérique." + +#: ../src/common/valtext.cpp:160 +#, c-format +msgid "'%s' should only contain ASCII characters." +msgstr "'%s' ne devrait contenir que des caractères ASCII." + +#: ../src/common/valtext.cpp:166 +#, c-format +msgid "'%s' should only contain alphabetic characters." +msgstr "'%s' ne devrait contenir que des caractères alphabétiques." + +#: ../src/common/valtext.cpp:172 +#, c-format +msgid "'%s' should only contain alphabetic or numeric characters." +msgstr "" +"'%s' ne devrait contenir que des caractères alphabétiques ou numériques." + +#: ../src/html/helpfrm.cpp:679 +msgid "(Help)" +msgstr "(Aide)" + +#: ../src/html/helpfrm.cpp:276 ../src/html/helpfrm.cpp:783 +#: ../src/html/helpfrm.cpp:1330 +msgid "(bookmarks)" +msgstr "(signets)" + +#: ../src/common/resourc2.cpp:297 ../src/common/resourc2.cpp:1370 +#: ../src/common/resource.cpp:1797 ../src/common/resource.cpp:1927 +#: ../src/common/resource.cpp:3011 +msgid "" +", expected static, #include or #define\n" +"whilst parsing resource." +msgstr "" +", static, #include ou #define\n" +"attendu au cours de l'analyse des ressources." + +#: ../src/generic/dirdlgg.cpp:264 ../src/generic/filedlgg.cpp:710 +msgid "." +msgstr "." + +#: ../src/generic/dirdlgg.cpp:265 ../src/generic/filedlgg.cpp:711 +msgid ".." +msgstr ".." + +#: ../src/html/htmprint.cpp:272 +#, fuzzy +msgid ": file does not exist!" +msgstr "Le répertoire n'existe pas" + +#: ../src/common/fontmap.cpp:459 +msgid ": unknown charset" +msgstr " : jeu de caractères inconnu" + +#: ../src/common/fontmap.cpp:622 +msgid ": unknown encoding" +msgstr " : codage inconnu" + +#: ../src/generic/wizard.cpp:168 +msgid "< &Back" +msgstr "< &Retour" + +#: ../src/generic/filedlgg.cpp:356 +msgid "<DIR>" +msgstr "<DIR>" + +#: ../src/generic/filedlgg.cpp:323 +msgid "<DIR> " +msgstr "<DIR> " + +#: ../src/generic/filedlgg.cpp:357 +msgid "<LINK>" +msgstr "<LINK>" + +#: ../src/generic/filedlgg.cpp:324 +msgid "<LINK> " +msgstr "<LINK> " + +#: ../src/html/helpfrm.cpp:928 +msgid "" +"<html><body>Normal face<br>(and <u>underlined</u>. <i>Italic face.</i> " +"<b>Bold face.</b> <b><i>Bold italic face.</i></b><br><font size=-2>font size " +"-2</font><br><font size=-1>font size -1</font><br><font size=+0>font size " +"+0</font><br><font size=+1>font size +1</font><br><font size=+2>font size " +"+2</font><br><font size=+3>font size +3</font><br><font size=+4>font size " +"+4</font><br><p><tt>Fixed size face.<br> <b>bold</b> <i>italic</i> " +"<b><i>bold italic <u>underlined</u></i></b><br><font size=-2>font size " +"-2</font><br><font size=-1>font size -1</font><br><font size=+0>font size " +"+0</font><br><font size=+1>font size +1</font><br><font size=+2>font size " +"+2</font><br><font size=+3>font size +3</font><br><font size=+4>font size " +"+4</font></tt></body></html>" +msgstr "" +"<html><body>Normal<br>(et <u>souligné</u>. <i>Italique.</i> <b>Gras.</b> " +"<b><i>Gras italique.</i></b><br><font size=-2>taille de police " +"-2</font><br><font size=-1>taille de police -1</font><br><font " +"size=+0>taille de police +0</font><br><font size=+1>taille de police " +"+1</font><br><font size=+2>taille de police +2</font><br><font " +"size=+3>taille de police +3</font><br><font size=+4>taille de police " +"+4</font><br><p><tt>Police à taille fixe.<br> <b>gras</b> <i>italique</i> " +"<b><i>gras italique <u>souligné</u></i></b><br><font size=-2>taille de " +"police -2</font><br><font size=-1>taille de police -1</font><br><font " +"size=+0>taille de police +0</font><br><font size=+1>taille de police " +"+1</font><br><font size=+2>taille de police +2</font><br><font " +"size=+3>taille de police +3</font><br><font size=+4>taille de police " +"+4</font></tt></body></html>" + +#: ../src/generic/dcpsg.cpp:2467 +msgid "A4 sheet, 210 x 297 mm" +msgstr "feuille A4, 210 x 297 mm" + +#: ../src/generic/fontdlgg.cpp:325 +msgid "ABCDEFGabcdefg12345" +msgstr "ABCDEFGabcdefg12345" + +#: ../src/html/helpfrm.cpp:270 +msgid "Add current page to bookmarks" +msgstr "Ajouter la page courante aux signets" + +#: ../src/generic/colrdlgg.cpp:264 +msgid "Add to custom colours" +msgstr "Ajouter aux couleurs personnalisées" + +#: ../src/html/helpctrl.cpp:88 +#, c-format +msgid "Adding book %s" +msgstr "Ajouter le livre %s" + +#: ../src/generic/prntdlgg.cpp:163 +msgid "All" +msgstr "Tout" + +#: ../src/generic/filedlgg.cpp:822 +msgid "All files (*)|*" +msgstr "Tous les fichiers (*)|*" + +#: ../src/unix/dialup.cpp:336 +msgid "Already dialling ISP." +msgstr "Déjà en cours d'appel ISP." + +#: ../src/generic/logg.cpp:486 +#, c-format +msgid "Append log to file '%s' (choosing [No] will overwrite it)?" +msgstr "Ajouter le journal au fichier '%s' (choisir [Non] pour l'écraser) ?" + +#: ../src/common/fontmap.cpp:101 +msgid "Arabic (ISO-8859-6)" +msgstr "Arabe (ISO-8859-6)" + +#: ../src/common/imagbmp.cpp:271 +msgid "BMP: Cannot deal with 4bit encoded yet." +msgstr "" +"BMP : Impossible d'utiliser actuellement les fichiers codés sur 4 bits." + +#: ../src/common/imagbmp.cpp:150 ../src/common/imagbmp.cpp:162 +msgid "BMP: Couldn't allocate memory." +msgstr "BMP : Impossible d'allouer la mémoire nécessaire." + +#: ../src/common/imagbmp.cpp:141 +msgid "BMP: Encoding doesn't match bitdepth." +msgstr "BMP : L'encodage ne correspond pas aux nombres de bits par pixel." + +#: ../src/common/imagbmp.cpp:104 +msgid "BMP: Image height > 32767 pixels for file." +msgstr "BMP : La hauteur de l'image est > 32767 pixels pour le fichier." + +#: ../src/common/imagbmp.cpp:98 +msgid "BMP: Image width > 32767 pixels for file." +msgstr "BMP : La largeur de l'image est > 32767 pixels pour le fichier." + +#: ../src/common/imagbmp.cpp:118 +msgid "BMP: Unknown bitdepth in file." +msgstr "BMP : Nombre de bits par pixel inconnu dans le fichier." + +#: ../src/common/imagbmp.cpp:127 +msgid "BMP: Unknown encoding in file." +msgstr "BMP : Codage inconnu dans le fichier." + +#: ../src/generic/helpwxht.cpp:156 +msgid "Back" +msgstr "Retour" + +#: ../src/common/dlgcmn.cpp:133 +msgid "Backward" +msgstr "Précédent" + +#: ../src/common/fontmap.cpp:99 +msgid "Baltic (ISO-8859-4)" +msgstr "Balte (ISO-8859-4)" + +#: ../src/common/fontmap.cpp:105 +msgid "Baltic II (ISO-8859-10)" +msgstr "Balte II (ISO-8859-10)" + +#: ../src/common/resourc2.cpp:844 ../src/common/resource.cpp:2481 +#, c-format +msgid "Bitmap resource specification %s not found." +msgstr "La spécification de la ressource bitmap %s est introuvable." + +#: ../src/generic/fontdlgg.cpp:217 +msgid "Bold" +msgstr "Gras" + +#: ../src/generic/prntdlgg.cpp:662 +msgid "Bottom margin (mm):" +msgstr "Marge bas de page (mm) :" + +#: ../src/generic/logg.cpp:444 +msgid "C&lear" +msgstr "E&ffacer" + +#: ../src/mac/thread.cpp:179 ../src/msw/thread.cpp:222 +msgid "Can not create event object." +msgstr "Impossible de créer l'objet événement." + +#: ../src/msw/thread.cpp:124 +msgid "Can not create mutex" +msgstr "Impossible de créer le mutex" + +#: ../src/mac/thread.cpp:92 +#, fuzzy +msgid "Can not create mutex." +msgstr "Impossible de créer le mutex" + +#: ../src/common/filefn.cpp:1271 ../src/msw/dir.cpp:294 +#: ../src/unix/dir.cpp:214 +#, c-format +msgid "Can not enumerate files in directory '%s'" +msgstr "Impossible d'énumérer les fichiers dans le répertoire '%s'" + +#: ../src/msw/thread.cpp:520 +#, c-format +msgid "Can not resume thread %x" +msgstr "Impossible de reprendre le thread %x" + +#: ../src/msw/thread.cpp:402 +msgid "Can not start thread: error writing TLS." +msgstr "Impossible de démarrer le thread : erreur à l'écriture de TLS." + +#: ../src/msw/thread.cpp:505 +#, c-format +msgid "Can not suspend thread %x" +msgstr "Impossible de suspendre le thread %x" + +#: ../src/msw/thread.cpp:817 +msgid "Can not wait for thread termination" +msgstr "Impossible d'attendre la fin du thread" + +#: ../src/common/docview.cpp:1874 +msgid "Can't &Undo " +msgstr "Impossible d'&Annuler" + +#: ../src/common/image.cpp:715 +#, c-format +msgid "Can't check image format of file '%s': file does not exist." +msgstr "" +"Impossible de vérifier le format du fichier image '%s' : le fichier n'existe " +"pas." + +#: ../src/msw/registry.cpp:410 +#, c-format +msgid "Can't close registry key '%s'" +msgstr "Impossible de fermer la clé de registre '%s'" + +#: ../src/msw/registry.cpp:486 +#, c-format +msgid "Can't copy values of unsupported type %d." +msgstr "Impossible de copier les valeurs du type non supporté %d." + +#: ../src/msw/listctrl.cpp:212 +msgid "Can't create list control window, check that comctl32.dll is installed." +msgstr "" +"Impossible de créer une fenêtre avec un contrôle liste, vérifier que " +"comctl32.dll est installée." + +#: ../src/msw/registry.cpp:393 +#, c-format +msgid "Can't create registry key '%s'" +msgstr "Impossible de créer la clé de registre '%s'" + +#: ../src/msw/utilsexc.cpp:425 +msgid "Can't create the inter-process read pipe" +msgstr "Impossible de créer le tube de lecture entre processus" + +#: ../src/msw/utilsexc.cpp:435 +msgid "Can't create the inter-process write pipe" +msgstr "Impossible de créer le tube d'écriture entre processus" + +#: ../src/msw/thread.cpp:487 +msgid "Can't create thread" +msgstr "Impossible de créer le thread" + +#: ../src/msw/window.cpp:2381 +#, c-format +msgid "" +"Can't create window of class %s!\n" +"Possible Windows 3.x compatibility problem?" +msgstr "" +"Impossible de créer la fenêtre de classe %s !\n" +"Peut-être un problème de compatibilité avec Windows 3.x ?" + +#: ../src/msw/registry.cpp:653 +#, c-format +msgid "Can't delete key '%s'" +msgstr "Impossible d'effacer la clé '%s'" + +#: ../src/msw/iniconf.cpp:474 +#, c-format +msgid "Can't delete the INI file '%s'" +msgstr "Impossible d'effacer le fichier INI '%s'" + +#: ../src/msw/registry.cpp:678 +#, c-format +msgid "Can't delete value '%s' from key '%s'" +msgstr "Impossible d'effacer la valeur '%s' de la clé '%s'" + +#: ../src/msw/registry.cpp:689 +#, c-format +msgid "Can't delete value of key '%s'" +msgstr "Impossible d'effacer la valeur de la clé '%s'" + +#: ../src/msw/registry.cpp:988 +#, c-format +msgid "Can't enumerate subkeys of key '%s'" +msgstr "Impossible d'énumérer les sous-clés de la clé '%s'" + +#: ../src/msw/registry.cpp:943 +#, c-format +msgid "Can't enumerate values of key '%s'" +msgstr "Impossible d'énumérer les valeurs de la clé '%s'" + +#: ../src/msw/utilsexc.cpp:400 +#, c-format +msgid "Can't execute command '%s'" +msgstr "Impossible d'exécuter la commande '%s'" + +#: ../src/common/ffile.cpp:234 +#, c-format +msgid "Can't find current position in file '%s'" +msgstr "Impossible de trouver la position courante dans le fichier '%s'" + +#: ../src/msw/window.cpp:2331 +msgid "" +"Can't find dummy dialog template!\n" +"Check resource include path for finding wx.rc." +msgstr "" +"Impossible de trouver le modèle pour le dialogue bidon !\n" +"Vérifier le chemin d'inclusion de la ressource pour trouver wx.rc." + +#: ../src/common/object.cpp:309 ../src/common/object.cpp:330 +#, c-format +msgid "Can't find the serialization object '%s' for the object '%s'." +msgstr "Impossible de trouver l'objet d'enregistrement '%s' pour l'objet '%s'." + +#: ../src/msw/registry.cpp:342 +#, c-format +msgid "Can't get info about registry key '%s'" +msgstr "Impossible d'obtenir l'information sur la clé de registre '%s'" + +#: ../src/common/image.cpp:413 ../src/common/image.cpp:433 +#, c-format +msgid "Can't load image from file '%s': file does not exist." +msgstr "" +"Impossible de charger l'image du fichier '%s' : le fichier n'existe pas." + +#: ../src/common/object.cpp:302 +msgid "Can't load wxSerial dynamic library." +msgstr "Impossible de charger la bibliothèque dynamique wxSerial." + +#: ../src/msw/dib.cpp:434 +#, c-format +msgid "Can't open file '%s'" +msgstr "Impossible d'ouvrir le fichier '%s'" + +#: ../src/msw/registry.cpp:368 +#, c-format +msgid "Can't open registry key '%s'" +msgstr "Impossible d'ouvrir la clé de registre '%s'" + +#: ../src/msw/registry.cpp:867 +#, c-format +msgid "Can't read value of '%s'" +msgstr "Impossible de lire la valeur de '%s'" + +#: ../src/msw/registry.cpp:766 ../src/msw/registry.cpp:805 +#, c-format +msgid "Can't read value of key '%s'" +msgstr "Impossible de lire la valeur de la clé '%s'" + +#: ../src/generic/logg.cpp:533 +msgid "Can't save log contents to file." +msgstr "Impossible d'enregistrer le contenu du journal dans le fichier." + +#: ../src/msw/thread.cpp:453 +msgid "Can't set thread priority" +msgstr "Impossible de spécifier la priorité pour le thread" + +#: ../src/msw/registry.cpp:791 ../src/msw/registry.cpp:891 +#, c-format +msgid "Can't set value of '%s'" +msgstr "Impossible de spécifier la valeur de '%s'" + +#: ../src/common/dlgcmn.cpp:146 ../src/common/prntbase.cpp:107 +#: ../src/generic/dcpsg.cpp:2192 ../src/generic/dirdlgg.cpp:424 +#: ../src/generic/filedlgg.cpp:913 ../src/generic/fontdlgg.cpp:257 +#: ../src/generic/prntdlgg.cpp:468 ../src/generic/progdlgg.cpp:179 +#: ../src/generic/proplist.cpp:523 ../src/generic/wizard.cpp:174 +#: ../src/gtk/filedlg.cpp:164 ../src/gtk/fontdlg.cpp:178 +#: ../src/html/helpfrm.cpp:910 ../src/motif/msgdlg.cpp:178 +msgid "Cancel" +msgstr "Annuler" + +#: ../src/msw/dialup.cpp:514 +#, c-format +msgid "Cannot find active dialup connection: %s" +msgstr "Impossible de trouver la connexion active : %s" + +#: ../src/msw/dialup.cpp:827 +msgid "Cannot find the location of address book file" +msgstr "Impossible de trouver l'emplacement du fichier du livre des adresses" + +#: ../src/unix/threadpsx.cpp:954 +#, c-format +msgid "Cannot get priority range for scheduling policy %d." +msgstr "" +"Impossible d'obtenir une gamme de priorité pour le choix de la planification " +"%d." + +#: ../src/unix/utilsunx.cpp:692 +msgid "Cannot get the hostname" +msgstr "Impossible d'obtenir le nom de l'hôte" + +#: ../src/unix/utilsunx.cpp:728 +msgid "Cannot get the official hostname" +msgstr "Impossible d'obtenir le nom officiel de l'hôte" + +#: ../src/msw/dialup.cpp:920 +msgid "Cannot hang up - no active dialup connection." +msgstr "Impossible de raccrocher - pas de connexion active." + +#: ../src/msw/app.cpp:229 +msgid "Cannot initialize OLE" +msgstr "Impossible d'initialiser l'OLE" + +#: ../src/html/htmlfilt.cpp:146 +#, c-format +msgid "Cannot open HTML document: %s" +msgstr "Impossible d'ouvrir le document HTML : %s" + +#: ../src/html/helpdata.cpp:542 +#, c-format +msgid "Cannot open HTML help book: %s" +msgstr "Impossible d'ouvrir l'aide HTML : %s" + +#: ../src/generic/helpext.cpp:96 +#, c-format +msgid "Cannot open URL '%s'" +msgstr "Impossible d'ouvrir l'URL '%s'" + +#: ../src/html/helpdata.cpp:238 +#, c-format +msgid "Cannot open contents file: %s" +msgstr "Impossible d'ouvrir le fichier table des matières : %s" + +#: ../src/generic/dcpsg.cpp:1541 +msgid "Cannot open file for PostScript printing!" +msgstr "Impossible d'ouvrir le fichier pour l'impression PostScript !" + +#: ../src/html/helpdata.cpp:253 +#, c-format +msgid "Cannot open index file: %s" +msgstr "Impossible d'ouvrir le fichier d'index : %s" + +#: ../src/html/helpfrm.cpp:1174 +msgid "Cannot print empty page." +msgstr "" + +#: ../src/unix/threadpsx.cpp:935 +msgid "Cannot retrieve thread scheduling policy." +msgstr "Impossible de retrouver le choix de la planification des threads." + +#: ../src/unix/threadpsx.cpp:588 +msgid "Cannot start thread: error writing TLS" +msgstr "Impossible de démarrer le thread : erreur à l'écriture de TLS" + +#: ../src/html/helpfrm.cpp:398 +msgid "Case sensitive" +msgstr "Sensible à la casse" + +#: ../src/common/fontmap.cpp:97 +msgid "Central European (ISO-8859-2/Latin 2)" +msgstr "Europe Centrale (ISO-8859-2/Latin 2)" + +#: ../src/msw/dialup.cpp:762 +msgid "Choose ISP to dial" +msgstr "Choisissez l'ISP pour composer le numéro" + +#: ../src/gtk/fontdlg.cpp:159 +msgid "Choose font" +msgstr "Choisissez la police" + +#: ../src/generic/logg.cpp:444 +msgid "Clear the log contents" +msgstr "Effacer le contenu du journal" + +#: ../src/common/prntbase.cpp:357 ../src/generic/progdlgg.cpp:307 +#: ../src/generic/proplist.cpp:518 +msgid "Close" +msgstr "Fermer" + +#: ../src/generic/logg.cpp:446 +msgid "Close this window" +msgstr "Fermer cette fenêtre" + +#: ../src/common/fileconf.cpp:742 +#, c-format +msgid "Config entry name cannot start with '%c'." +msgstr "" +"Le nom pour l'entrée de la configuration ne peut pas commencer par '%c'." + +#: ../src/generic/filedlgg.cpp:1074 ../src/gtk/filedlg.cpp:75 +msgid "Confirm" +msgstr "Confirmer" + +#: ../src/html/htmlwin.cpp:166 +msgid "Connecting..." +msgstr "Connexion ..." + +#: ../src/generic/helpxlp.cpp:240 +#, c-format +msgid "Connection to wxHelp timed out in %d seconds" +msgstr "Connexion à wxHelp annulée dans %d secondes" + +#: ../src/generic/helpwxht.cpp:158 ../src/html/helpfrm.cpp:303 +#: ../src/html/helpfrm.cpp:312 +msgid "Contents" +msgstr "Table des matières" + +#: ../src/generic/prntdlgg.cpp:196 +msgid "Copies:" +msgstr "Copies :" + +#: ../src/common/resourc2.cpp:287 ../src/common/resource.cpp:1787 +#: ../src/common/resource.cpp:1917 +#, c-format +msgid "Could not find resource include file %s." +msgstr "Impossible de trouver le fichier de ressources inclus %s." + +#: ../src/generic/tabg.cpp:1042 +msgid "Could not find tab for id" +msgstr "Impossible de trouver l'étiquette pour l'id" + +#: ../src/msw/textctrl.cpp:1121 +#, c-format +msgid "Could not load Rich Edit DLL '%s'" +msgstr "Impossible de charger la bibliothèque DLL Rich Edit '%s'" + +#: ../src/common/resource.cpp:789 +#, c-format +msgid "" +"Could not resolve control class or id '%s'. Use (non-zero) integer instead\n" +" or provide #define (see manual for caveats)" +msgstr "" +"Impossible de résoudre la classe de contrôle ou l'id '%s'. Utilisez un " +"entier (non nul) à la place\n" +"ou fournissez un #define (voir le manuel pour les mises en garde)" + +#: ../src/common/resource.cpp:1232 +#, c-format +msgid "" +"Could not resolve menu id '%s'. Use (non-zero) integer instead\n" +"or provide #define (see manual for caveats)" +msgstr "" +"Impossible de résoudre l'id du menu '%s'. Utilisez un entier (non nul) à la " +"place\n" +"ou fournissez un #define (voir le manuel pour les mises en garde)" + +#: ../src/common/prntbase.cpp:707 +msgid "Could not start document preview." +msgstr "Impossible de lancer l'aperçu du document." + +#: ../src/generic/printps.cpp:200 ../src/msw/printwin.cpp:242 +msgid "Could not start printing." +msgstr "Impossible de lancer l'impression." + +#: ../src/common/wincmn.cpp:781 +msgid "Could not transfer data to window" +msgstr "Impossible de transférer les données à la fenêtre" + +#: ../src/msw/thread.cpp:166 +msgid "Couldn't acquire a mutex lock" +msgstr "Impossible d'obtenir un verrouillage de mutex" + +#: ../src/msw/dragimag.cpp:142 ../src/msw/dragimag.cpp:179 +#: ../src/msw/imaglist.cpp:145 ../src/msw/imaglist.cpp:167 +#: ../src/msw/imaglist.cpp:180 +msgid "Couldn't add an image to the image list." +msgstr "Impossible d'ajouter une image à la liste." + +#: ../src/mac/thread.cpp:227 +#, fuzzy +msgid "Couldn't change the state of event object." +msgstr "Impossible de créer l'objet événement." + +#: ../src/msw/timer.cpp:96 +msgid "Couldn't create a timer" +msgstr "Impossible de créer un minuteur" + +#: ../src/common/dynlib.cpp:299 +#, c-format +msgid "Couldn't find symbol '%s' in a dynamic library" +msgstr "Impossible de trouver le symbole '%s' dans la bibliothèque dynamique" + +#: ../src/msw/thread.cpp:540 +msgid "Couldn't get the current thread pointer" +msgstr "Impossible d'obtenir le pointeur sur le thread courant" + +#: ../src/msw/utilsexc.cpp:596 +#, c-format +msgid "Couldn't launch DDE server '%s'." +msgstr "Impossible de lancer le serveur DDE '%s'." + +#: ../src/common/imagpng.cpp:245 +msgid "Couldn't load a PNG image - file is corrupted or not enough memory." +msgstr "" +"Impossible de charger une image PNG - le fichier est corrompu ou bien il n'y " +"a pas assez de mémoire." + +#: ../src/msw/ole/dataobj.cpp:151 +#, c-format +msgid "Couldn't register clipboard format '%s'." +msgstr "Impossible d'enregistrer le format de presse-papier '%s'." + +#: ../src/msw/thread.cpp:198 +msgid "Couldn't release a mutex" +msgstr "Impossible de détacher un mutex" + +#: ../src/msw/listctrl.cpp:612 +#, c-format +msgid "Couldn't retrieve information about list control item %d." +msgstr "" +"Impossible d'obtenir de l'information sur un élément de la liste de contrôle " +"%d." + +#: ../src/msw/thread.cpp:904 +msgid "Couldn't terminate thread" +msgstr "Impossible d'arrêter le thread" + +#: ../src/generic/dirdlgg.cpp:571 +msgid "Create directory" +msgstr "Créer le répertoire" + +#: ../src/generic/filedlgg.cpp:880 +msgid "Create new directory" +msgstr "Créer un nouveau répertoire" + +#: ../src/generic/filedlgg.cpp:887 +msgid "Current directory:" +msgstr "Répertoire courant :" + +#: ../src/common/fontmap.cpp:100 +msgid "Cyrillic (Latin 5)" +msgstr "Cyrillique (Latin 5)" + +#: ../src/msw/dde.cpp:586 +msgid "DDE poke request failed" +msgstr "La demande de transfert DDE a échoué" + +#: ../src/generic/filedlgg.cpp:535 +msgid "Date" +msgstr "Date" + +#: ../src/generic/fontdlgg.cpp:207 +msgid "Decorative" +msgstr "Décoratif" + +#: ../src/msw/dialup.cpp:350 +msgid "" +"Dial up functions are unavailable because the remote access service (RAS) is " +"not installed on this machine. Please install it." +msgstr "" +"Les fonctions de composition de numéros ne sont pas disponibles car le " +"service d'accès à distance (RAS) n'est pas installé sur cet ordinateur. " +"Installez-le svp." + +#: ../src/generic/tipdlg.cpp:177 +msgid "Did you know..." +msgstr "Saviez-vous ..." + +#: ../src/common/filefn.cpp:1086 +#, c-format +msgid "Directory '%s' couldn't be created" +msgstr "Le répertoire '%s' ne peut pas être créé" + +#: ../src/generic/dirdlgg.cpp:538 +msgid "Directory does not exist" +msgstr "Le répertoire n'existe pas" + +#: ../src/html/helpfrm.cpp:366 +msgid "" +"Display all index items that contain given substring. Search is case " +"insensitive." +msgstr "" +"Afficher tous les éléments index qui contiennent une sous-chaîne donnée. " +"Recherche non sensible à la casse." + +#: ../src/html/helpfrm.cpp:535 +msgid "Display options dialog" +msgstr "Dialogue d'options de l'affichage" + +#: ../src/common/docview.cpp:431 +#, c-format +msgid "Do you want to save changes to document %s?" +msgstr "Voulez-vous sauvegarder les modifications dans le document %s ?" + +#: ../src/html/htmlwin.cpp:216 +msgid "Done" +msgstr "Fait" + +#: ../src/generic/progdlgg.cpp:313 +msgid "Done." +msgstr "Fait." + +#: ../src/generic/progdlgg.cpp:153 +msgid "Elapsed time : " +msgstr "Temps écoulé : " + +#: ../src/generic/helphtml.cpp:310 +msgid "Entries found" +msgstr "Entrées trouvées" + +#: ../src/common/config.cpp:348 +#, c-format +msgid "" +"Environment variables expansion failed: missing '%c' at position %d in '%s'." +msgstr "" +"L'expansion des variables d'environnement a échoué : caractère '%c' manquant " +"à la position %d dans '%s'." + +#: ../src/generic/dcpsg.cpp:1541 ../src/generic/dirdlgg.cpp:268 +#: ../src/generic/dirdlgg.cpp:286 ../src/generic/dirdlgg.cpp:297 +#: ../src/generic/dirdlgg.cpp:604 ../src/generic/filedlgg.cpp:622 +#: ../src/generic/filedlgg.cpp:714 ../src/generic/filedlgg.cpp:728 +#: ../src/generic/filedlgg.cpp:741 ../src/generic/filedlgg.cpp:1040 +#: ../src/generic/filedlgg.cpp:1089 ../src/generic/helpxlp.cpp:241 +#: ../src/generic/logg.cpp:180 ../src/gtk/filedlg.cpp:83 +#: ../src/gtk/fontdlg.cpp:72 +msgid "Error" +msgstr "Erreur" + +#: ../src/unix/utilsunx.cpp:931 ../src/unix/utilsunx.cpp:939 +msgid "Error " +msgstr "Erreur " + +#: ../src/generic/dirdlgg.cpp:551 +msgid "Error creating directory" +msgstr "Erreur en créant le répertoire" + +#: ../src/common/log.cpp:354 +msgid "Error: " +msgstr "Erreur : " + +#: ../src/common/fontmap.cpp:98 +msgid "Esperanto (ISO-8859-3)" +msgstr "Espéranto (ISO-8859-3)" + +#: ../src/generic/progdlgg.cpp:160 +msgid "Estimated time : " +msgstr "Temps estimé : " + +#: ../src/generic/dirdlgg.cpp:217 +msgid "Etcetera" +msgstr "Et cetera" + +#: ../src/msw/utilsexc.cpp:484 +#, c-format +msgid "Execution of command '%s' failed" +msgstr "L'exécution de la commande '%s' a échoué" + +#: ../src/common/resourc2.cpp:326 ../src/common/resourc2.cpp:1399 +#: ../src/common/resource.cpp:1826 ../src/common/resource.cpp:1956 +#: ../src/common/resource.cpp:3040 +msgid "Expected '*' whilst parsing resource." +msgstr "'*' attendu pendant l'analyse de la ressource." + +#: ../src/common/resourc2.cpp:342 ../src/common/resourc2.cpp:1415 +#: ../src/common/resource.cpp:1843 ../src/common/resource.cpp:1972 +#: ../src/common/resource.cpp:3057 +msgid "Expected '=' whilst parsing resource." +msgstr "'=' attendu pendant l'analyse de la ressource." + +#: ../src/common/resourc2.cpp:312 ../src/common/resourc2.cpp:1385 +#: ../src/common/resource.cpp:1812 ../src/common/resource.cpp:1942 +#: ../src/common/resource.cpp:3026 +msgid "Expected 'char' whilst parsing resource." +msgstr "'char' attendu pendant l'analyse de la ressource." + +#: ../src/msw/dialup.cpp:855 +#, c-format +msgid "Failed to %s dialup connection: %s" +msgstr "Impossible de %s la connexion : %s" + +#: ../src/msw/clipbrd.cpp:122 +msgid "Failed to close the clipboard." +msgstr "Impossible de fermer le presse-papier." + +#: ../src/msw/dialup.cpp:796 +msgid "Failed to connect: missing username/password." +msgstr "Connexion impossible : nom d'utilisateur/mot de passe manquant." + +#: ../src/msw/dialup.cpp:742 +msgid "Failed to connect: no ISP to dial." +msgstr "Impossible de se connecter : pas de numéro ISP à composer." + +#: ../src/msw/registry.cpp:590 +#, c-format +msgid "Failed to copy registry value '%s'" +msgstr "Impossible de copier la valeur de registre '%s'" + +#: ../src/msw/registry.cpp:599 +#, c-format +msgid "Failed to copy the contents of registry key '%s' to '%s'." +msgstr "Impossible de copier les contenus de la clé de registre '%s' vers '%s'" + +#: ../src/msw/dde.cpp:923 +msgid "Failed to create DDE string" +msgstr "Impossible de créer la chaîne DDE" + +#: ../src/msw/mdi.cpp:404 +msgid "Failed to create MDI parent frame." +msgstr "Impossible de créer une fenêtre parent MDI." + +#: ../src/msw/statbr95.cpp:149 +msgid "Failed to create a status bar." +msgstr "Impossible de créer une barre de statut." + +#: ../src/msw/dde.cpp:401 +#, c-format +msgid "Failed to create connection to server '%s' on topic '%s'" +msgstr "Impossible de créer une connexion au serveur '%s' sur le sujet '%s'" + +#: ../src/msw/dialog.cpp:177 +msgid "" +"Failed to create dialog. You probably forgot to include wx/msw/wx.rc in your " +"resources." +msgstr "" + +#: ../src/generic/dirdlgg.cpp:549 +msgid "Failed to create directory " +msgstr "Impossible de créer le répertoire " + +#: ../src/html/winpars.cpp:357 +#, c-format +msgid "Failed to display HTML document in %s encoding" +msgstr "Impossible d'afficher le document HTML avec l'encodage %s" + +#: ../src/msw/clipbrd.cpp:134 +msgid "Failed to empty the clipboard." +msgstr "Impossible de vider le presse-papier." + +#: ../src/msw/dde.cpp:605 +msgid "Failed to establish an advise loop with DDE server" +msgstr "" +"Impossible d'établir une boucle de conseil (advise loop) avec le serveur DDE" + +#: ../src/msw/dialup.cpp:635 +#, c-format +msgid "Failed to establish dialup connection: %s" +msgstr "Impossible de réaliser une connexion : %s" + +#: ../src/unix/utilsunx.cpp:431 ../src/unix/utilsunx.cpp:455 +#, c-format +msgid "Failed to execute '%s'\n" +msgstr "Impossible d'exécuter '%s'\n" + +#: ../src/common/resourc2.cpp:808 ../src/common/resource.cpp:2445 +#, c-format +msgid "" +"Failed to find XBM resource %s.\n" +"Forgot to use wxResourceLoadBitmapData?" +msgstr "" +"Impossible de trouver la ressource XBM %s.\n" +"Oublié d'utiliser wxResourceLoadBitmapData ?" + +#: ../src/common/resourc2.cpp:963 ../src/common/resource.cpp:2600 +#, c-format +msgid "" +"Failed to find XBM resource %s.\n" +"Forgot to use wxResourceLoadIconData?" +msgstr "" +"Impossible de trouver la ressource XBM %s.\n" +"Oublié d'utiliser wxResourceLoadIconData ?" + +#: ../src/common/resourc2.cpp:824 ../src/common/resource.cpp:2461 +#, c-format +msgid "" +"Failed to find XPM resource %s.\n" +"Forgot to use wxResourceLoadBitmapData?" +msgstr "" +"Impossible de trouver la ressource XPM %s.\n" +"Oublié d'utiliser wxResourceLoadBitmapData ?" + +#: ../src/msw/dialup.cpp:695 +#, c-format +msgid "Failed to get ISP names: %s" +msgstr "Impossible d'obtenir les noms ISP : %s" + +#: ../src/msw/clipbrd.cpp:623 +msgid "Failed to get data from the clipboard" +msgstr "Impossible d'obtenir des données du presse-papier" + +#: ../src/common/timercmn.cpp:243 +msgid "Failed to get the UTC system time." +msgstr "Impossible d'obtenir le temps système TUC." + +#: ../src/common/timercmn.cpp:195 +msgid "Failed to get the local system time" +msgstr "Impossible d'obtenir le temps système local" + +#: ../src/unix/threadpsx.cpp:754 +msgid "" +"Failed to join a thread, potential memory leak detected - please restart the " +"program" +msgstr "" +"Impossible d'adjoindre un thread, fuite potentielle de mémoire détectée - " +"redémarrez le programme svp" + +#: ../src/common/dynlib.cpp:229 +#, c-format +msgid "Failed to load shared library '%s'" +msgstr "Impossible de charger la bibliothèque partagée '%s'" + +#: ../src/msw/clipbrd.cpp:102 +msgid "Failed to open the clipboard." +msgstr "Impossible d'ouvrir le presse-papier." + +#: ../src/msw/clipbrd.cpp:539 +msgid "Failed to put data on the clipboard" +msgstr "Impossible de placer des données sur le presse-papier" + +#: ../src/unix/utilsunx.cpp:524 +msgid "Failed to redirect child process input/output" +msgstr "Impossible de rediriger les entrées/sorties du processus fils" + +#: ../src/msw/dde.cpp:285 +#, c-format +msgid "Failed to register DDE server '%s'" +msgstr "Impossible d'enregistrer le serveur DDE '%s'" + +#: ../src/common/fontmap.cpp:504 +#, c-format +msgid "Failed to remember the encoding for the charset '%s'." +msgstr "Impossible de se rappeler l'encodage pour le jeu de caractères '%s'." + +#: ../src/msw/registry.cpp:436 +#, c-format +msgid "Failed to rename registry value '%s' to '%s'." +msgstr "Impossible de renommer la valeur de registre '%s' en '%s'." + +#: ../src/msw/registry.cpp:536 +#, c-format +msgid "Failed to rename the registry key '%s' to '%s'." +msgstr "Impossible de renommer la clé de registre '%s' en '%s'." + +#: ../src/msw/clipbrd.cpp:428 +msgid "Failed to retrieve data from the clipboard." +msgstr "Impossible de retrouver des données du presse-papier." + +#: ../src/msw/dialup.cpp:459 +msgid "Failed to retrieve text of RAS error message" +msgstr "Impossible de retrouver le texte du message d'erreur RAS" + +#: ../src/msw/clipbrd.cpp:652 +msgid "Failed to retrieve the supported clipboard formats" +msgstr "Impossible de retrouver les formats supportés par le presse-papier" + +#: ../src/msw/dde.cpp:650 +msgid "Failed to send DDE advise notification" +msgstr "Impossible d'envoyer un avis de notification au DDE" + +#: ../src/msw/clipbrd.cpp:300 +msgid "Failed to set clipboard data." +msgstr "Impossible de passer les données au presse-papier." + +#: ../src/unix/threadpsx.cpp:1071 +#, c-format +msgid "Failed to set thread priority %d." +msgstr "Impossible d'assigner au thread la priorité %d." + +#: ../src/common/fs_mem.cpp:167 +#, c-format +msgid "Failed to store image '%s' to memory VFS!" +msgstr "Impossible de stocker l'image '%s' dans la mémoire VFS !" + +#: ../src/unix/threadpsx.cpp:1251 +msgid "Failed to terminate a thread." +msgstr "Impossible de terminer le thread." + +#: ../src/msw/dde.cpp:624 +msgid "Failed to terminate the advise loop with DDE server" +msgstr "" +"Impossible de terminer la boucle de conseil (advise loop) avec le server DDE" + +#: ../src/msw/dialup.cpp:928 +#, c-format +msgid "Failed to terminate the dialup connection: %s" +msgstr "Impossible de terminer la connexion : %s" + +#: ../src/msw/dde.cpp:301 +#, c-format +msgid "Failed to unregister DDE server '%s'" +msgstr "Impossible de supprimer l'enregistrement du serveur DDE '%s'" + +#: ../src/msw/app.cpp:749 +msgid "Fatal Error" +msgstr "Erreur Fatale" + +#: ../src/generic/logg.cpp:340 +msgid "Fatal error" +msgstr "Erreur fatale" + +#: ../src/common/log.cpp:347 +msgid "Fatal error: " +msgstr "Erreur fatale : " + +#: ../src/msw/app.cpp:1237 +msgid "Fatal error: exiting" +msgstr "Erreur fatale : fin du programme" + +#: ../src/generic/filedlgg.cpp:1071 ../src/gtk/filedlg.cpp:72 +#, c-format +msgid "File '%s' already exists, do you really want to overwrite it?" +msgstr "Le fichier '%s' existe déjà, voulez-vous vraiment l'écraser ?" + +#: ../src/common/textcmn.cpp:94 +msgid "File couldn't be loaded." +msgstr "Le fichier n'a pas pu être chargé." + +#: ../src/common/docview.cpp:287 ../src/common/docview.cpp:323 +msgid "File error" +msgstr "Erreur fichier" + +#: ../src/generic/dirdlgg.cpp:286 ../src/generic/filedlgg.cpp:728 +msgid "File name exists already." +msgstr "Ce nom de fichier existe déjà." + +#: ../src/msw/filedlg.cpp:280 +#, c-format +msgid "Files (%s)|%s" +msgstr "Fichiers (%s)|%s" + +#: ../src/html/helpfrm.cpp:340 +msgid "Find" +msgstr "Trouver" + +#: ../src/html/helpfrm.cpp:889 +msgid "Fixed font:" +msgstr "Police à taille fixe :" + +#: ../src/generic/fontdlgg.cpp:124 +msgid "Font" +msgstr "Police" + +#: ../src/html/helpfrm.cpp:899 +msgid "Font size:" +msgstr "Taille de la police :" + +#: ../src/unix/utilsunx.cpp:481 +msgid "Fork failed" +msgstr "Le fork a échoué" + +#: ../src/common/dlgcmn.cpp:130 ../src/generic/helpwxht.cpp:157 +msgid "Forward" +msgstr "Suivant" + +#: ../src/common/resourc2.cpp:295 ../src/common/resourc2.cpp:1368 +#: ../src/common/resource.cpp:1795 ../src/common/resource.cpp:1925 +#: ../src/common/resource.cpp:3009 +msgid "Found " +msgstr "Trouvé " + +#: ../src/html/helpfrm.cpp:637 +#, c-format +msgid "Found %i matches" +msgstr "Trouvé %i correspondances" + +#: ../src/generic/prntdlgg.cpp:187 +msgid "From:" +msgstr "De :" + +#: ../src/common/imaggif.cpp:74 +#, fuzzy +msgid "GIF: data stream seems to be truncated." +msgstr "wxGIFHandler : le flot de données semble être tronqué." + +#: ../src/common/imaggif.cpp:58 +#, fuzzy +msgid "GIF: error in GIF image format." +msgstr "wxGIFHandler : erreur dans le format GIF de l'image." + +#: ../src/common/imaggif.cpp:61 +#, fuzzy +msgid "GIF: not enough memory." +msgstr "wxGIFHandler : pas assez de mémoire." + +#: ../src/common/imaggif.cpp:64 +#, fuzzy +msgid "GIF: unknown error!!!" +msgstr "wxGIFHandler : erreur inconnue !!!" + +#: ../src/html/helpfrm.cpp:501 +msgid "Go back" +msgstr "Précédent" + +#: ../src/html/helpfrm.cpp:504 +msgid "Go forward" +msgstr "Suivant" + +#: ../src/html/helpfrm.cpp:509 +msgid "Go one level up in document hierarchy" +msgstr "Niveau supérieur dans la hiérarchie du document" + +#: ../src/generic/filedlgg.cpp:872 +msgid "Go to home directory" +msgstr "Répertoire initial" + +#: ../src/generic/filedlgg.cpp:866 +msgid "Go to parent directory" +msgstr "Répertoire parent" + +#: ../src/common/fontmap.cpp:102 +msgid "Greek (ISO-8859-7)" +msgstr "Grec (ISO-8859-7)" + +#: ../src/html/htmlwin.cpp:251 +#, c-format +msgid "HTML anchor %s does not exist." +msgstr "L'ancrage HTML %s n'existe pas." + +#: ../src/html/helpfrm.cpp:1188 +msgid "" +"HTML files (*.htm)|*.htm|HTML files (*.html)|*.html|Help books " +"(*.htb)|*.htb|Help books (*.zip)|*.zip|HTML Help Project (*.hhp)|*.hhp|All " +"files (*.*)|*" +msgstr "" + +#: ../src/common/fontmap.cpp:103 +msgid "Hebrew (ISO-8859-8)" +msgstr "Hébreu (ISO-8859-8)" + +#: ../src/common/dlgcmn.cpp:142 ../src/generic/proplist.cpp:528 +#: ../src/html/helpfrm.cpp:208 +msgid "Help" +msgstr "Aide" + +#: ../src/html/helpfrm.cpp:872 +msgid "Help Browser Options" +msgstr "Aide Options Navigateur" + +#: ../src/generic/helphtml.cpp:309 ../src/generic/helphtml.cpp:310 +msgid "Help Index" +msgstr "Aide Index" + +#: ../src/html/helpfrm.cpp:1172 +msgid "Help Printing" +msgstr "Aide Impression" + +#: ../src/generic/helpwxht.cpp:250 ../src/html/helpctrl.cpp:44 +#, c-format +msgid "Help: %s" +msgstr "Aide : %s" + +#: ../src/common/fontmap.cpp:107 +msgid "ISO-8859-12" +msgstr "ISO-8859-12" + +#: ../src/common/fontmap.cpp:108 +msgid "ISO-8859-13" +msgstr "ISO-8859-13" + +#: ../src/common/fontmap.cpp:109 +msgid "ISO-8859-14" +msgstr "ISO-8859-14" + +#: ../src/common/resourc2.cpp:997 ../src/common/resourc2.cpp:1008 +#: ../src/common/resource.cpp:2634 ../src/common/resource.cpp:2645 +#, c-format +msgid "Icon resource specification %s not found." +msgstr "La spécification pour la ressource icône %s n'a pas été trouvée." + +#: ../src/common/resource.cpp:251 +msgid "Ill-formed resource file syntax." +msgstr "Syntaxe incorrecte dans le fichier de ressource." + +#: ../src/generic/dirdlgg.cpp:268 ../src/generic/filedlgg.cpp:714 +msgid "Illegal directory name." +msgstr "Nom de répertoire illégal." + +#: ../src/generic/filedlgg.cpp:1040 +msgid "Illegal file specification." +msgstr "Spécification de fichier illégale." + +#: ../src/msw/textctrl.cpp:216 +msgid "" +"Impossible to create a rich edit control, using simple text control instead. " +"Please reinstall riched32.dll" +msgstr "" +"Impossible de créer un contrôle de type rich edit, utilisez à la place un " +"contrôle de type texte simple. Réinstallez riched32.dll svp" + +#: ../src/unix/utilsunx.cpp:344 +msgid "Impossible to get child process input" +msgstr "Impossible d'obtenir l'entrée du processus fils" + +#: ../src/html/helpdata.cpp:288 +msgid "Incorrect version of HTML help book" +msgstr "Version incorrecte du livre d'aide HTML" + +#: ../src/html/helpfrm.cpp:372 +msgid "Index" +msgstr "Index" + +#: ../src/generic/logg.cpp:182 +msgid "Information" +msgstr "Information" + +#: ../src/common/imagtiff.cpp:136 +msgid "Invalid TIFF image index." +msgstr "Index d'image TIFF non valide." + +#: ../src/generic/fontdlgg.cpp:213 +msgid "Italic" +msgstr "Italique" + +#: ../src/common/imagjpeg.cpp:198 +msgid "JPEG: Couldn't load - file is probably corrupted." +msgstr "JPEG : Chargement impossible - le fichier est probablement corrompu." + +#: ../src/common/imagjpeg.cpp:315 +msgid "JPEG: Couldn't save image." +msgstr "JPEG : Sauvegarde de l'image impossible." + +#: ../src/common/fontmap.cpp:111 +msgid "KOI8-R" +msgstr "KOI8-R" + +#: ../src/generic/dcpsg.cpp:2183 ../src/generic/prntdlgg.cpp:441 +#: ../src/generic/prntdlgg.cpp:637 +msgid "Landscape" +msgstr "Paysage" + +#: ../src/generic/prntdlgg.cpp:649 +msgid "Left margin (mm):" +msgstr "Marge gauche (mm) :" + +#: ../src/generic/fontdlgg.cpp:216 +msgid "Light" +msgstr "Léger" + +#: ../src/generic/filedlgg.cpp:1267 ../src/gtk/filedlg.cpp:241 +#: ../src/motif/filedlg.cpp:351 ../src/msw/filedlg.cpp:438 +#, c-format +msgid "Load %s file" +msgstr "Charger le fichier %s" + +#: ../src/html/htmlwin.cpp:187 +msgid "Loading : " +msgstr "Chargement : " + +#: ../src/common/imagpnm.cpp:72 +msgid "Loading Grey Ascii PNM image is not yet implemented." +msgstr "" +"Le chargement d'une image PNM mode Ascii en niveau de gris n'est pas encore " +"implémentée." + +#: ../src/common/imagpnm.cpp:75 +msgid "Loading Grey Raw PNM image is not yet implemented." +msgstr "" +"Le chargement d'une image PNM mode source en niveau de gris n'est pas encore " +"implémentée." + +#: ../src/generic/logg.cpp:536 +#, c-format +msgid "Log saved to the file '%s'." +msgstr "Journal sauvé dans le fichier '%s'." + +#: ../src/gtk/mdi.cpp:422 +msgid "MDI child" +msgstr "fils MDI" + +#: ../src/unix/mimetype.cpp:1541 +#, c-format +msgid "Mailcap file %s, line %d: incomplete entry ignored." +msgstr "Fichier mailcap %s, ligne %d : entrée incomplète ignorée." + +#: ../src/common/fs_mem.cpp:144 +#, c-format +msgid "Memory VFS already contains file '%s'!" +msgstr "La mémoire VFS contient déjà le fichier '%s' !" + +#: ../src/unix/mimetype.cpp:1261 +#, c-format +msgid "Mime.types file %s, line %d: unterminated quoted string." +msgstr "Fichier types mime %s, ligne %d : chaîne entre quotes non terminée." + +#: ../src/generic/fontdlgg.cpp:208 +msgid "Modern" +msgstr "Moderne" + +#: ../src/common/dlgcmn.cpp:139 +msgid "More..." +msgstr "Plus ..." + +#: ../src/generic/dirdlgg.cpp:213 +msgid "Mounted Devices" +msgstr "Périphériques Montés" + +#: ../src/generic/dirdlgg.cpp:208 +msgid "My Harddisk" +msgstr "Mon Disque Dur" + +#: ../src/generic/dirdlgg.cpp:212 +msgid "My Home" +msgstr "Mon Répertoire Initial (Home)" + +#: ../src/generic/filedlgg.cpp:533 +msgid "Name" +msgstr "Nom" + +#: ../src/generic/dirdlgg.cpp:426 +msgid "New..." +msgstr "Nouveau ..." + +#: ../src/generic/filedlgg.cpp:607 +msgid "NewName" +msgstr "NouveauNom" + +#: ../src/html/helpfrm.cpp:515 +msgid "Next page" +msgstr "Page suivante" + +#: ../src/common/dlgcmn.cpp:109 ../src/common/dlgcmn.cpp:119 +#: ../src/motif/msgdlg.cpp:178 +msgid "No" +msgstr "Non" + +#: ../src/common/resourc2.cpp:814 ../src/common/resourc2.cpp:969 +#: ../src/common/resource.cpp:2451 ../src/common/resource.cpp:2606 +msgid "No XBM facility available!" +msgstr "Pas de fonctionalités XBM disponibles !" + +#: ../src/common/resourc2.cpp:830 ../src/common/resource.cpp:2466 +msgid "No XPM facility available!" +msgstr "Pas de fonctionalités XPM disponibles !" + +#: ../src/common/resourc2.cpp:991 ../src/common/resource.cpp:2628 +msgid "No XPM icon facility available!" +msgstr "Pas de fonctionalités icône XPM disponibles !" + +#: ../src/generic/helphtml.cpp:304 +msgid "No entries found." +msgstr "Entrées non trouvées." + +#: ../src/common/image.cpp:518 +msgid "No handler found for image type." +msgstr "Pas de fonctions spécifiques disponibles pour ce type d'image." + +#: ../src/common/image.cpp:526 ../src/common/image.cpp:560 +#, c-format +msgid "No image handler for type %d defined." +msgstr "Pas de fonctions spécifiques disponibles pour l'image de type : %d." + +#: ../src/common/image.cpp:544 ../src/common/image.cpp:576 +#, c-format +msgid "No image handler for type %s defined." +msgstr "Pas de fonctions spécifiques disponibles pour l'image de type : %s." + +#: ../src/html/helpfrm.cpp:628 +msgid "No matching page found yet" +msgstr "Pas encore trouvé la page correspondante" + +#: ../src/generic/fontdlgg.cpp:212 ../src/generic/fontdlgg.cpp:215 +msgid "Normal" +msgstr "Normal" + +#: ../src/html/helpfrm.cpp:881 +msgid "Normal font:" +msgstr "Police normale :" + +#: ../src/common/dlgcmn.cpp:125 ../src/generic/dcpsg.cpp:2191 +#: ../src/generic/dirdlgg.cpp:422 ../src/generic/filedlgg.cpp:904 +#: ../src/generic/fontdlgg.cpp:256 ../src/generic/logg.cpp:714 +#: ../src/generic/prntdlgg.cpp:467 ../src/generic/proplist.cpp:511 +#: ../src/gtk/filedlg.cpp:158 ../src/gtk/fontdlg.cpp:172 +#: ../src/html/helpfrm.cpp:909 +msgid "OK" +msgstr "OK" + +#: ../src/html/helpfrm.cpp:523 ../src/html/helpfrm.cpp:1183 +msgid "Open HTML document" +msgstr "Ouvrir un document HTML" + +#: ../src/generic/dirdlgg.cpp:297 ../src/generic/dirdlgg.cpp:604 +#: ../src/generic/filedlgg.cpp:622 ../src/generic/filedlgg.cpp:741 +msgid "Operation not permitted." +msgstr "Opération interdite." + +#: ../src/common/cmdline.cpp:590 +#, c-format +msgid "Option '%s' requires a value, '=' expected." +msgstr "L'option '%s' nécessite une valeur, signe '=' attendu." + +#: ../src/common/cmdline.cpp:609 +#, c-format +msgid "Option '%s' requires a value." +msgstr "L'option '%s' nécessite une valeur." + +#: ../src/common/cmdline.cpp:663 +#, c-format +msgid "Option '%s': '%s' cannot be converted to a date." +msgstr "Option '%s' : '%s' ne peut pas être convertie en date." + +#: ../src/generic/prntdlgg.cpp:447 +msgid "Options" +msgstr "Options" + +#: ../src/generic/prntdlgg.cpp:443 ../src/generic/prntdlgg.cpp:638 +msgid "Orientation" +msgstr "Orientation" + +#: ../src/common/imagpcx.cpp:448 ../src/common/imagpcx.cpp:471 +#, fuzzy +msgid "PCX: couldn't allocate memory" +msgstr "BMP : Impossible d'allouer la mémoire nécessaire." + +#: ../src/common/imagpcx.cpp:447 +#, fuzzy +msgid "PCX: image format unsupported" +msgstr "wxPCXHandler : format d'image non supporté" + +#: ../src/common/imagpcx.cpp:470 +#, fuzzy +msgid "PCX: invalid image" +msgstr "wxPCXHandler : image non valide" + +#: ../src/common/imagpcx.cpp:434 +msgid "PCX: this is not a PCX file." +msgstr "PCX: ce n'est pas un fichier PCX." + +#: ../src/common/imagpcx.cpp:450 ../src/common/imagpcx.cpp:472 +#, fuzzy +msgid "PCX: unknown error !!!" +msgstr "wxPCXHandler : erreur inconnue !!!" + +#: ../src/common/imagpcx.cpp:449 +#, fuzzy +msgid "PCX: version number too low" +msgstr "wxPCXHandler : numéro de version trop petit" + +#: ../src/common/imagpnm.cpp:96 +msgid "PNM: Couldn't allocate memory." +msgstr "PNM : Impossible d'allouer la mémoire nécessaire." + +#: ../src/common/imagpnm.cpp:80 +msgid "PNM: File format is not recognized." +msgstr "PNM : Le format de fichier n'est pas reconnu." + +#: ../src/common/imagpnm.cpp:112 +msgid "PNM: File seems truncated." +msgstr "PNM : Le fichier semble tronqué." + +#: ../src/common/prntbase.cpp:727 +#, c-format +msgid "Page %d" +msgstr "Page %d" + +#: ../src/common/prntbase.cpp:725 +#, c-format +msgid "Page %d of %d" +msgstr "Page %d sur %d" + +#: ../src/generic/prntdlgg.cpp:604 +msgid "Page Setup" +msgstr "Paramètrage de la page" + +#: ../src/generic/prntdlgg.cpp:164 +msgid "Pages" +msgstr "Pages" + +#: ../src/generic/prntdlgg.cpp:555 ../src/generic/prntdlgg.cpp:626 +#: ../src/generic/prntdlgg.cpp:808 +msgid "Paper Size" +msgstr "Taille de la page" + +#: ../src/generic/prntdlgg.cpp:433 ../src/generic/prntdlgg.cpp:615 +#: ../src/generic/prntdlgg.cpp:804 +msgid "Paper size" +msgstr "Taille de la page" + +#: ../src/generic/filedlgg.cpp:537 +msgid "Permissions" +msgstr "Droits" + +#: ../src/unix/utilsunx.cpp:430 ../src/unix/utilsunx.cpp:454 +msgid "Pipe creation failed" +msgstr "La création du tube a échoué" + +#: ../src/gtk/fontdlg.cpp:72 +msgid "Please choose a valid font." +msgstr "Veuillez choisir une police valide." + +#: ../src/generic/filedlgg.cpp:1089 ../src/gtk/filedlg.cpp:83 +msgid "Please choose an existing file." +msgstr "Veuillez choisir un fichier existant." + +#: ../src/msw/dialup.cpp:763 +msgid "Please choose which ISP do you want to connect to" +msgstr "Veuillez choisir à quel ISP vous voulez vous connecter" + +#: ../src/common/prntbase.cpp:105 +msgid "Please wait..." +msgstr "Veuillez attendre ..." + +#: ../src/generic/dcpsg.cpp:2182 ../src/generic/prntdlgg.cpp:440 +#: ../src/generic/prntdlgg.cpp:636 +msgid "Portrait" +msgstr "Portrait" + +#: ../src/generic/dcpsg.cpp:377 +msgid "PostScript" +msgstr "Postscript" + +#: ../src/generic/prntdlgg.cpp:272 +msgid "PostScript file" +msgstr "Fichier postscript" + +#: ../src/generic/dcpsg.cpp:2224 +msgid "PostScript:" +msgstr "Postscript :" + +#: ../src/generic/dcpsg.cpp:2187 +msgid "Preview Only" +msgstr "Aperçu Seulement" + +#: ../src/html/helpfrm.cpp:903 +msgid "Preview:" +msgstr "Aperçu :" + +#: ../src/html/htmprint.cpp:486 +msgid "Previewing" +msgstr "Aperçu en cours" + +#: ../src/html/helpfrm.cpp:512 +msgid "Previous page" +msgstr "Page précédente" + +#: ../src/generic/prntdlgg.cpp:113 ../src/generic/prntdlgg.cpp:127 +msgid "Print" +msgstr "Impression" + +#: ../src/generic/printps.cpp:200 +msgid "Print Error" +msgstr "Erreur à l'impression" + +#: ../src/common/docview.cpp:887 +msgid "Print Preview" +msgstr "Aperçu avant impression" + +#: ../src/common/prntbase.cpp:683 ../src/common/prntbase.cpp:707 +msgid "Print Preview Failure" +msgstr "Erreur à l'exécution de l'aperçu avant impression" + +#: ../src/generic/prntdlgg.cpp:172 +msgid "Print Range" +msgstr "Pages à imprimer" + +#: ../src/generic/prntdlgg.cpp:408 ../src/generic/prntdlgg.cpp:415 +msgid "Print Setup" +msgstr "Paramètrage d'impression" + +#: ../src/generic/prntdlgg.cpp:455 +msgid "Print in colour" +msgstr "Impression couleur" + +#: ../src/generic/prntdlgg.cpp:457 +msgid "Print spooling" +msgstr "Queue d'impression" + +#: ../src/html/helpfrm.cpp:529 +msgid "Print this page" +msgstr "Imprimer cette page" + +#: ../src/generic/dcpsg.cpp:2186 ../src/generic/prntdlgg.cpp:150 +msgid "Print to File" +msgstr "Imprimer vers un fichier" + +#: ../src/common/prntbase.cpp:364 +msgid "Print..." +msgstr "Imprimer ..." + +#: ../src/generic/dcpsg.cpp:2197 +msgid "Printer Command: " +msgstr "Commande Imprimante :" + +#: ../src/generic/dcpsg.cpp:2202 +msgid "Printer Options: " +msgstr "Options Imprimante :" + +#: ../src/generic/dcpsg.cpp:346 +msgid "Printer Settings" +msgstr "Paramètres de l'Imprimante" + +#: ../src/generic/prntdlgg.cpp:459 +msgid "Printer command:" +msgstr "Commande imprimante :" + +#: ../src/generic/prntdlgg.cpp:149 +msgid "Printer options" +msgstr "Options de l'imprimante" + +#: ../src/generic/prntdlgg.cpp:463 +msgid "Printer options:" +msgstr "Options de l'imprimante :" + +#: ../src/generic/prntdlgg.cpp:682 +msgid "Printer..." +msgstr "Imprimante ..." + +#: ../src/common/prntbase.cpp:104 ../src/common/prntbase.cpp:146 +#: ../src/html/htmprint.cpp:507 +msgid "Printing" +msgstr "Impression" + +#: ../src/common/prntbase.cpp:118 +msgid "Printing Error" +msgstr "Erreur lors de l'impression" + +#: ../src/generic/printps.cpp:218 +#, c-format +msgid "Printing page %d..." +msgstr "Impression de la page %d ..." + +#: ../src/generic/printps.cpp:185 +msgid "Printing..." +msgstr "Impression en cours ..." + +#: ../src/common/log.cpp:348 +msgid "Program aborted." +msgstr "Abandon du programme." + +#: ../src/generic/logg.cpp:488 +msgid "Question" +msgstr "Question" + +#: ../src/common/ffile.cpp:133 ../src/common/ffile.cpp:154 +#, c-format +msgid "Read error on file '%s'" +msgstr "Erreur de lecture dans le fichier '%s'" + +#: ../src/msw/registry.cpp:528 +#, c-format +msgid "Registry key '%s' already exists." +msgstr "La clé de registre '%s' existe déjà." + +#: ../src/msw/registry.cpp:497 +#, c-format +msgid "Registry key '%s' does not exist, cannot rename it." +msgstr "Impossible de renommer la clé de registre '%s', celle-ci n'existe pas." + +#: ../src/msw/registry.cpp:623 +#, c-format +msgid "" +"Registry key '%s' is needed for normal system operation,\n" +"deleting it will leave your system in unusable state:\n" +"operation aborted." +msgstr "" +"La clé de registre '%s' est nécessaire pour un fonctionnement correct du " +"système,\n" +"l'effacer mettra votre système dans un état instable:\n" +"opération abandonnée." + +#: ../src/msw/registry.cpp:428 +#, c-format +msgid "Registry value '%s' already exists." +msgstr "La valeur '%s' existe déjà dans le registre." + +#: ../src/generic/helphtml.cpp:309 +msgid "Relevant entries:" +msgstr "Entrées pertinentes :" + +#: ../src/generic/progdlgg.cpp:167 +msgid "Remaining time : " +msgstr "Temps restant :" + +#: ../src/html/helpfrm.cpp:269 +msgid "Remove current page from bookmarks" +msgstr "Retirer la page courante de la liste de vos signets" + +#: ../src/msw/filedlg.cpp:400 +#, c-format +msgid "Replace file '%s'?" +msgstr "Ecraser le fichier '%s' ?" + +#: ../src/generic/prntdlgg.cpp:661 +msgid "Right margin (mm):" +msgstr "Marge de droite (mm) :" + +#: ../src/generic/fontdlgg.cpp:206 +msgid "Roman" +msgstr "Roman" + +#: ../src/generic/filedlgg.cpp:1283 ../src/gtk/filedlg.cpp:257 +#: ../src/motif/filedlg.cpp:353 ../src/msw/filedlg.cpp:439 +#, c-format +msgid "Save %s file" +msgstr "Enregistrer le fichier %s" + +#: ../src/common/docview.cpp:240 +msgid "Save as" +msgstr "Enregistrer sous" + +#: ../src/generic/logg.cpp:442 +msgid "Save log contents to file" +msgstr "Enregistrement du contenu du journal dans un fichier" + +#: ../src/generic/fontdlgg.cpp:209 +msgid "Script" +msgstr "Script" + +#: ../src/generic/helpwxht.cpp:160 ../src/html/helpfrm.cpp:414 +#: ../src/html/helpfrm.cpp:434 +msgid "Search" +msgstr "Recherche" + +#: ../src/html/helpfrm.cpp:416 +msgid "" +"Search contents of help book(s) for all occurences of the text you typed " +"above" +msgstr "" +"Recherche dans la table des matières du/des livre(s) d'aide de toutes les " +"occurences du texte que vous avez tapé ci-dessus" + +#: ../src/html/helpfrm.cpp:735 +msgid "Search in all books" +msgstr "Recherche dans tous les livres" + +#: ../src/html/helpfrm.cpp:628 +msgid "Searching..." +msgstr "Recherche ..." + +#: ../src/generic/dirdlgg.cpp:191 +msgid "Sections" +msgstr "Sections" + +#: ../src/common/ffile.cpp:221 +#, c-format +msgid "Seek error on file '%s'" +msgstr "Erreur de recherche dans le fichier '%s'" + +#: ../src/common/docview.cpp:1417 +msgid "Select a document template" +msgstr "Choisissez un modèle de document" + +#: ../src/common/docview.cpp:1440 +msgid "Select a document view" +msgstr "Choisissez une vue du document" + +#: ../src/common/docview.cpp:1335 ../src/common/docview.cpp:1372 +msgid "Select a file" +msgstr "Choisissez un fichier" + +#: ../src/generic/dcpsg.cpp:2185 +msgid "Send to Printer" +msgstr "Envoyer vers l'imprimante" + +#: ../src/common/dlgcmn.cpp:136 +msgid "Setup" +msgstr "Paramètrage" + +#: ../src/generic/prntdlgg.cpp:155 +msgid "Setup..." +msgstr "Paramètrage ..." + +#: ../src/msw/dialup.cpp:535 +msgid "Several active dialup connections found, choosing one randomly." +msgstr "" +"J'ai trouvé plusieurs connexions par ligne téléphonique, j'en choisis une au " +"hasard :-)" + +#: ../src/html/helpfrm.cpp:331 +msgid "Show all" +msgstr "Tout montrer" + +#: ../src/html/helpfrm.cpp:365 +msgid "Show all items in index" +msgstr "Montrer tous les éléments dans l'index" + +#: ../src/generic/filedlgg.cpp:910 +msgid "Show hidden files" +msgstr "Montrer les fichiers cachés" + +#: ../src/html/helpfrm.cpp:496 +msgid "Show/hide navigation panel" +msgstr "Montrer/cacher le panneau de navigation" + +#: ../src/generic/filedlgg.cpp:534 +msgid "Size" +msgstr "Taille" + +#: ../src/generic/fontdlgg.cpp:214 +msgid "Slant" +msgstr "Italique" + +#: ../src/common/docview.cpp:297 +msgid "Sorry, could not open this file for saving." +msgstr "Désolé, impossible d'ouvrir ce fichier pour enregistrer." + +#: ../src/common/docview.cpp:333 ../src/common/docview.cpp:345 +msgid "Sorry, could not open this file." +msgstr "Désolé, impossible d'ouvrir ce fichier." + +#: ../src/common/docview.cpp:304 +msgid "Sorry, could not save this file." +msgstr "Désolé, impossible d'enregistrer ce fichier." + +#: ../src/common/prntbase.cpp:683 +msgid "Sorry, not enough memory to create a preview." +msgstr "Désolé, il n'y a pas assez de mémoire pour créer un aperçu." + +#: ../src/generic/logg.cpp:596 +msgid "Status: " +msgstr "Statut :" + +#: ../src/generic/fontdlgg.cpp:210 +msgid "Swiss" +msgstr "Suisse" + +#: ../src/common/imagtiff.cpp:157 ../src/common/imagtiff.cpp:166 +msgid "TIFF: Couldn't allocate memory." +msgstr "TIFF: Impossible d'allouer la mémoire nécessaire." + +#: ../src/common/imagtiff.cpp:128 +msgid "TIFF: Error loading image." +msgstr "TIFF: Erreur au chargement de l'image." + +#: ../src/common/imagtiff.cpp:176 +msgid "TIFF: Error reading image." +msgstr "TIFF: Erreur à la lecture de l'image." + +#: ../src/generic/fontdlgg.cpp:211 +msgid "Teletype" +msgstr "Télétype" + +#: ../src/common/docview.cpp:1417 +msgid "Templates" +msgstr "Modèles" + +#: ../src/generic/dirdlgg.cpp:218 +msgid "Temporary" +msgstr "Temporaire" + +#: ../src/common/fontmap.cpp:106 +msgid "Thai (ISO-8859-11)" +msgstr "Thaï (ISO-8859-11)" + +#: ../src/generic/dirdlgg.cpp:210 +msgid "The Computer" +msgstr "L'ordinateur" + +#: ../src/common/fontmap.cpp:463 +#, c-format +msgid "" +"The charset '%s' is unknown. You may select\n" +"another charset to replace it with or choose\n" +"[Cancel] if it cannot be replaced" +msgstr "" +"Le jeu de caractères '%s' est inconnu. Vous pouvez en choisir un autre\n" +"pour le remplacer ou choisir [Annuler]\n" +"s'il ne peut pas l'être" + +#: ../src/msw/ole/dataobj.cpp:169 +#, c-format +msgid "The clipboard format '%d' doesn't exist." +msgstr "Le format de presse-papier '%d' n'existe pas." + +#: ../src/generic/dirdlgg.cpp:535 +msgid "The directory " +msgstr "Le répertoire" + +#: ../src/common/fontmap.cpp:626 +#, c-format +msgid "" +"The encoding '%s' is unknown.\n" +"Would you like to select a font to be used for this encoding\n" +"(otherwise the text in this encoding will not be shown correctly)?" +msgstr "" +"L'encodage '%s' est inconnu.\n" +"Souhaitez-vous choisir une police à utiliser pour cet encodage?\n" +"(sinon le texte n'apparaitra pas correctement en utilisant cet encodage) ?" + +#: ../src/common/docview.cpp:1622 +#, c-format +msgid "" +"The file '%s' doesn't exist and couldn't be opened.\n" +"It has been also removed from the MRU files list." +msgstr "" +"Le fichier '%s' n'existe pas et n'a pas pu être ouvert.\n" +"Il a aussi été retiré de la liste des fichiers MRU." + +#: ../src/common/cmdline.cpp:753 +#, c-format +msgid "The required parameter '%s' was not specified." +msgstr "Le paramètre nécessaire '%s' n'a pas été fourni." + +#: ../src/common/textcmn.cpp:121 +msgid "The text couldn't be saved." +msgstr "Le texte n'a pas pu être enregistré." + +#: ../src/common/cmdline.cpp:732 +#, c-format +msgid "The value for the option '%s' must be specified." +msgstr "La valeur pour l'option '%s' doit être précisée." + +#: ../src/msw/dialup.cpp:411 +#, fuzzy, c-format +msgid "" +"The version of remote access service (RAS) installed on this machine is " +"tooold, please upgrade (the following required function is missing: %s)." +msgstr "" +"La version du service d'accès distant (RAS en anglais) installé sur cette " +"machine est trop ancien. Prière de le mettre à jour (la fonction '%s' est " +"manquante)." + +#: ../src/html/htmprint.cpp:486 +msgid "" +"There was a problem previewing.\n" +"Perhaps your current printer is not set correctly?" +msgstr "" +"Problème lors de l'aperçu.\n" +"Votre paramètrage actuel de l'imprimante n'est peut-être pas correct ?" + +#: ../src/html/htmprint.cpp:507 +msgid "" +"There was a problem printing.\n" +"Perhaps your current printer is not set correctly?" +msgstr "" +"Problème lors de l'impression.\n" +"Votre paramètrage actuel de l'imprimante n'est peut-être pas correct ?" + +#: ../src/msw/thread.cpp:1029 +msgid "" +"Thread module initialization failed: can not store value in thread local " +"storage" +msgstr "" +"Echec de l'initialisation du thread : impossible d'enregistrer une valeur en " +"local" + +#: ../src/unix/threadpsx.cpp:1441 +msgid "Thread module initialization failed: failed to create thread key" +msgstr "" +"Echec de l'initialisation du thread : échec à la création de la clé du thread" + +#: ../src/msw/thread.cpp:1017 +msgid "" +"Thread module initialization failed: impossible to allocate index in thread " +"local storage" +msgstr "" +"Echec de l'initialisation du thread : impossible d'allouer un index en local" + +#: ../src/unix/threadpsx.cpp:962 +msgid "Thread priority setting is ignored." +msgstr "La priorité donnée au thread est ignorée." + +#: ../src/generic/filedlgg.cpp:536 +msgid "Time" +msgstr "Temps" + +#: ../src/generic/tipdlg.cpp:162 +msgid "Tip of the Day" +msgstr "Le Conseil du Jour" + +#: ../src/generic/tipdlg.cpp:138 +msgid "Tips not available, sorry!" +msgstr "Désolé mais les conseils ne sont pas disponibles !" + +#: ../src/generic/prntdlgg.cpp:191 +msgid "To:" +msgstr "Pour :" + +#: ../src/generic/prntdlgg.cpp:650 +msgid "Top margin (mm):" +msgstr "Marge haut de page (mm) :" + +#: ../src/common/fs_mem.cpp:202 +#, c-format +msgid "Trying to remove file '%s' from memory VFS, but it is not loaded!" +msgstr "" +"Tentative de retirer le fichier '%s' de la mémoire VFS, mais celui-ci n'est " +"pas chargé !" + +#: ../src/common/sckaddr.cpp:107 +msgid "Trying to solve a NULL hostname: giving up" +msgstr "Tenative de résoudre le nom d'hôte NULL : j'abandonne" + +#: ../src/common/fontmap.cpp:104 +msgid "Turkish (ISO-8859-9)" +msgstr "Turque (ISO-8859-9)" + +#: ../src/html/htmlwin.cpp:175 +#, c-format +msgid "Unable to open requested HTML document: %s" +msgstr "Impossible d'ouvrir le document HTML demandé : %s" + +#: ../src/generic/fontdlgg.cpp:242 +msgid "Underline" +msgstr "Souligner" + +#: ../src/common/resourc2.cpp:305 ../src/common/resourc2.cpp:319 +#: ../src/common/resourc2.cpp:335 ../src/common/resourc2.cpp:349 +#: ../src/common/resourc2.cpp:1378 ../src/common/resourc2.cpp:1392 +#: ../src/common/resourc2.cpp:1408 ../src/common/resourc2.cpp:1422 +#: ../src/common/resource.cpp:1805 ../src/common/resource.cpp:1819 +#: ../src/common/resource.cpp:1836 ../src/common/resource.cpp:1850 +#: ../src/common/resource.cpp:1935 ../src/common/resource.cpp:1949 +#: ../src/common/resource.cpp:1965 ../src/common/resource.cpp:1979 +#: ../src/common/resource.cpp:3019 ../src/common/resource.cpp:3033 +#: ../src/common/resource.cpp:3050 ../src/common/resource.cpp:3064 +msgid "Unexpected end of file whilst parsing resource." +msgstr "Fin de fichier inattendue lors de l'analyse des ressources." + +#: ../src/common/cmdline.cpp:704 +#, c-format +msgid "Unexpected parameter '%s'" +msgstr "Paramètre '%s' inattendu" + +#: ../src/msw/dde.cpp:1019 +#, c-format +msgid "Unknown DDE error %08x" +msgstr "Erreur DDE inconnue: %08x" + +#: ../src/common/fontmap.cpp:326 +#, c-format +msgid "Unknown encoding (%d)" +msgstr "Codage inconnu (%d)" + +#: ../src/unix/mimetype.cpp:1304 +#, c-format +msgid "Unknown field in file %s, line %d: '%s'." +msgstr "Champ inconnu dans le fichier %s, ligne %d: '%s'." + +#: ../src/common/cmdline.cpp:496 +#, c-format +msgid "Unknown long option '%s'" +msgstr "Option longue '%s' inconnue" + +#: ../src/common/cmdline.cpp:518 +#, c-format +msgid "Unknown option '%s'" +msgstr "Option '%s' inconnue" + +#: ../src/common/mimecmn.cpp:161 +#, c-format +msgid "Unmatched '{' in an entry for mime type %s." +msgstr "Symbole '{' non assorti dans une entrée pour le type mime %s." + +#: ../src/common/docview.cpp:1869 ../src/common/docview.cpp:1884 +#: ../src/common/docview.cpp:1911 +msgid "Unnamed command" +msgstr "Commande sans nom" + +#: ../src/common/resourc2.cpp:687 ../src/common/resource.cpp:2323 +#, c-format +msgid "Unrecognized style %s whilst parsing resource." +msgstr "Style %s non reconnu pendant l'analyse des ressources." + +#: ../src/msw/app.cpp:748 +#, fuzzy +msgid "Unrecoverable program error detected: the application will terminate." +msgstr "" +"Erreur irrécupérable détectée dans le programme: l'application va s'arrêter." + +#: ../src/msw/clipbrd.cpp:268 ../src/msw/clipbrd.cpp:369 +msgid "Unsupported clipboard format." +msgstr "Format de presse-papier non supporté." + +#: ../src/common/cmdline.cpp:785 +#, c-format +msgid "Usage: %s" +msgstr "Usage : %s" + +#: ../src/generic/dirdlgg.cpp:215 +msgid "User" +msgstr "Utilisateur" + +#: ../src/generic/dirdlgg.cpp:214 +msgid "User Local" +msgstr "Répertoire /usr/local" + +#: ../src/common/valtext.cpp:188 +msgid "Validation conflict" +msgstr "Conflit de validation" + +#: ../src/generic/dirdlgg.cpp:216 +msgid "Variables" +msgstr "Variables" + +#: ../src/generic/filedlgg.cpp:858 +msgid "View files as a detailed view" +msgstr "Voir les fichiers - vue détaillée" + +#: ../src/generic/filedlgg.cpp:852 +msgid "View files as a list view" +msgstr "Voir les fichiers comme une liste" + +#: ../src/common/docview.cpp:1440 +msgid "Views" +msgstr "Vues" + +#: ../src/unix/utilsunx.cpp:264 ../src/unix/utilsunx.cpp:600 +msgid "Waiting for subprocess termination failed" +msgstr "Echec lors de l'attente de fin de sous-processus" + +#: ../src/common/docview.cpp:428 ../src/common/resource.cpp:121 +#: ../src/generic/logg.cpp:181 +msgid "Warning" +msgstr "Alarme" + +#: ../src/common/log.cpp:358 +msgid "Warning: " +msgstr "Alarme :" + +#: ../src/html/htmlpars.cpp:179 +msgid "Warning: attempt to remove HTML tag handler from empty stack." +msgstr "" +"Alarme : tentative de retrait d'un pointeur d'étiquette HTML de la pile " +"alors que celle-ci est vide !" + +#: ../src/common/fontmap.cpp:96 +msgid "West European (ISO-8859-1/Latin 1)" +msgstr "Europe de l'Ouest (ISO-8859-1/Latin 1)" + +#: ../src/common/fontmap.cpp:110 +msgid "West European new (ISO-8859-15/Latin 0)" +msgstr "Europe de l'Ouest nouveau (ISO-8859-15/Latin 0)" + +#: ../src/html/helpfrm.cpp:406 +msgid "Whole words only" +msgstr "Mots complets seulement" + +#: ../src/msw/utils.cpp:545 +msgid "Win32s on Windows 3.1" +msgstr "Win32s sur Windows 3.1" + +#: ../src/msw/utils.cpp:577 +msgid "Windows 3.1" +msgstr "Windows 3.1" + +#: ../src/msw/utils.cpp:549 +#, c-format +msgid "Windows 9%c" +msgstr "Windows 9%c" + +#: ../src/common/fontmap.cpp:118 +msgid "Windows Arabic (CP 1256)" +msgstr "Windows Arabe (CP 1256)" + +#: ../src/common/fontmap.cpp:119 +msgid "Windows Baltic (CP 1257)" +msgstr "Windows Balte (CP 1257)" + +#: ../src/common/fontmap.cpp:113 +msgid "Windows Cyrillic (CP 1251)" +msgstr "Windows Cyrillique (CP 1251)" + +#: ../src/common/fontmap.cpp:115 +msgid "Windows Greek (CP 1253)" +msgstr "Windows Grec (CP 1253)" + +#: ../src/common/fontmap.cpp:117 +msgid "Windows Hebrew (CP 1255)" +msgstr "Windows Hébreu (CP 1255)" + +#: ../src/common/fontmap.cpp:114 +msgid "Windows Latin 1 (CP 1252)" +msgstr "Windows Latin 1 (CP 1252 )" + +#: ../src/common/fontmap.cpp:112 +msgid "Windows Latin 2 (CP 1250)" +msgstr "Windows Latin 2 (CP 1250)" + +#: ../src/common/fontmap.cpp:116 +msgid "Windows Turkish (CP 1254)" +msgstr "Windows Turque (CP 1254)" + +#: ../src/common/ffile.cpp:168 +#, c-format +msgid "Write error on file '%s'" +msgstr "Erreur d'écriture dans le fichier '%s'" + +#: ../src/generic/dcpsg.cpp:2242 +msgid "X Scaling" +msgstr "Echelle X" + +#: ../src/generic/dcpsg.cpp:2251 +msgid "X Translation" +msgstr "Translation X" + +#: ../src/generic/dcpsg.cpp:2246 +msgid "Y Scaling" +msgstr "Echelle Y" + +#: ../src/generic/dcpsg.cpp:2255 +msgid "Y Translation" +msgstr "Translation Y" + +#: ../src/common/dlgcmn.cpp:107 ../src/common/dlgcmn.cpp:114 +#: ../src/motif/msgdlg.cpp:178 +msgid "Yes" +msgstr "Oui" + +#: ../src/generic/dirdlgg.cpp:570 +msgid "You cannot add a new directory to this section." +msgstr "Vous ne pouvez pas ajouter un nouveau répertoire à cette section." + +#: ../src/common/docview.cpp:1980 +msgid "[EMPTY]" +msgstr "[VIDE]" + +#: ../src/msw/dde.cpp:986 +msgid "a DDEML application has created a prolonged race condition." +msgstr "" +"une application DDEML a créé une situation de rivalité prolongée\n" +"(je n'ai bientôt plus de mémoire ...)" + +#: ../src/msw/dde.cpp:974 +msgid "" +"a DDEML function was called without first calling the DdeInitialize " +"function,\n" +"or an invalid instance identifier\n" +"was passed to a DDEML function." +msgstr "" +"une fonction DDEML a été appelée sans appel préalable à la fonction " +"DdeInitialize,\n" +"ou un identifiant invalide a \n" +"été fourni à la fonction DDEML." + +#: ../src/msw/dde.cpp:992 +msgid "a client's attempt to establish a conversation has failed." +msgstr "une tentative client d'établir une conversation a échoué." + +#: ../src/msw/dde.cpp:989 +msgid "a memory allocation failed." +msgstr "une allocation mémoire a échoué." + +#: ../src/msw/dde.cpp:983 +msgid "a parameter failed to be validated by the DDEML." +msgstr "un paramètre n'a pas pu être validé par la DDEML." + +#: ../src/msw/dde.cpp:965 +msgid "a request for a synchronous advise transaction has timed out." +msgstr "une demande de transaction synchrone (advise) a expiré." + +#: ../src/msw/dde.cpp:971 +msgid "a request for a synchronous data transaction has timed out." +msgstr "une demande de transaction synchrone (données) a expiré." + +#: ../src/msw/dde.cpp:980 +msgid "a request for a synchronous execute transaction has timed out." +msgstr "une demande de transaction synchrone (exécution) a expiré." + +#: ../src/msw/dde.cpp:998 +msgid "a request for a synchronous poke transaction has timed out." +msgstr "une demande de transaction synchrone (poke) a expiré." + +#: ../src/msw/dde.cpp:1013 +msgid "a request to end an advise transaction has timed out." +msgstr "une demande pour terminer une transaction (advise) a expiré." + +#: ../src/msw/dde.cpp:1007 +msgid "" +"a server-side transaction was attempted on a conversation\n" +"that was terminated by the client, or the server\n" +"terminated before completing a transaction." +msgstr "" +"une transaction a été tentée du côté serveur lors d'une conversation déjà " +"terminée par le client, \n" +"ou le serveur a quitté avant d'avoir terminé une transaction." + +#: ../src/msw/dde.cpp:995 +msgid "a transaction failed." +msgstr "une transaction a échoué." + +#: ../src/common/utilscmn.cpp:466 +msgid "alt" +msgstr "alt" + +#: ../src/msw/dde.cpp:977 +msgid "" +"an application initialized as APPCLASS_MONITOR has\n" +"attempted to perform a DDE transaction,\n" +"or an application initialized as APPCMD_CLIENTONLY has \n" +"attempted to perform server transactions." +msgstr "" +"une application initialisée en tant que APPCLASS_MONITOR \n" +"a tenté d'effectuer une transaction DDE,\n" +"ou une application initialisée en tant que APPCMD_CLIENTONLY a tenté " +"d'effectuer des transactions serveur." + +#: ../src/msw/dde.cpp:1001 +msgid "an internal call to the PostMessage function has failed. " +msgstr "un appel interne à la fonction PostMessage a échoué." + +#: ../src/msw/dde.cpp:1010 +msgid "an internal error has occurred in the DDEML." +msgstr "une erreur interne s'est produite dans le DDEML." + +#: ../src/msw/dde.cpp:1016 +msgid "" +"an invalid transaction identifier was passed to a DDEML function.\n" +"Once the application has returned from an XTYP_XACT_COMPLETE callback,\n" +"the transaction identifier for that callback is no longer valid." +msgstr "" +"un identifiant de transaction invalide a été fourni à la fonction DDEML.\n" +"Quand l'application sort d'un appel XTYP_XACT_COMPLETE, \n" +"l'identifiant de transaction pour cet appel n'est plus valide." + +#: ../src/common/fileconf.cpp:1415 +#, c-format +msgid "attempt to change immutable key '%s' ignored." +msgstr "tentative de modifier la touche non configurable '%s' ignorée." + +#: ../src/common/ffile.cpp:101 +#, c-format +msgid "can't close file '%s'" +msgstr "impossible de fermer le fichier '%s'" + +#: ../src/common/file.cpp:252 +#, c-format +msgid "can't close file descriptor %d" +msgstr "impossible de fermer le descripteur de fichier %d" + +#: ../src/common/file.cpp:550 ../src/common/file.cpp:560 +#, c-format +msgid "can't commit changes to file '%s'" +msgstr "impossible d'appliquer les changements au fichier '%s'" + +#: ../src/common/file.cpp:200 +#, c-format +msgid "can't create file '%s'" +msgstr "impossible de créer le fichier '%s'" + +#: ../src/common/fileconf.cpp:885 +#, c-format +msgid "can't delete user configuration file '%s'" +msgstr "impossible d'effacer le fichier de configuration utilisateur '%s'" + +#: ../src/common/file.cpp:431 +#, c-format +msgid "can't determine if the end of file is reached on descriptor %d" +msgstr "" +"impossible de savoir si la fin du fichier a été atteinte dans le descripteur " +"%d" + +#: ../src/common/file.cpp:397 +#, c-format +msgid "can't find length of file on file descriptor %d" +msgstr "" +"impossible de trouver la taille du fichier dans le descripteur de fichier %d" + +#: ../src/msw/utils.cpp:376 +msgid "can't find user's HOME, using current directory." +msgstr "" +"impossible de trouver le répertoire par défaut (HOME) de l'utilisateur - " +"j'utilise le répertoire courant." + +#: ../src/common/file.cpp:311 +#, c-format +msgid "can't flush file descriptor %d" +msgstr "" +"impossible de forcer l'écriture sur disque du descripteur de fichier %d" + +#: ../src/common/file.cpp:365 +#, c-format +msgid "can't get seek position on file descriptor %d" +msgstr "" +"impossible de trouver la position courante sur le descripteur de fichier %d" + +#: ../src/common/fontmap.cpp:568 +msgid "can't load any font, aborting" +msgstr "impossible de charger une police de caractères - j'abandonne" + +#: ../src/common/ffile.cpp:85 ../src/common/file.cpp:238 +#, c-format +msgid "can't open file '%s'" +msgstr "impossible d'ouvrir le fichier '%s'" + +#: ../src/common/fileconf.cpp:310 +#, c-format +msgid "can't open global configuration file '%s'." +msgstr "impossible d'ouvrir le fichier de configuration global '%s'." + +#: ../src/common/fileconf.cpp:322 +#, c-format +msgid "can't open user configuration file '%s'." +msgstr "impossible d'ouvrir le fichier de configuration utilisateur '%s'." + +#: ../src/common/fileconf.cpp:773 +msgid "can't open user configuration file." +msgstr "impossible d'ouvrir le fichier de configuration utilisateur." + +#: ../src/common/file.cpp:278 +#, c-format +msgid "can't read from file descriptor %d" +msgstr "impossible de lire en utilisant le descripteur de fichier %d" + +#: ../src/common/file.cpp:545 ../src/common/file.cpp:555 +#, c-format +msgid "can't remove file '%s'" +msgstr "impossible de supprimer le fichier '%s'" + +#: ../src/common/file.cpp:573 ../src/common/file.cpp:576 +#, c-format +msgid "can't remove temporary file '%s'" +msgstr "impossible de supprimer le fichier temporaire '%s'" + +#: ../src/common/file.cpp:351 +#, c-format +msgid "can't seek on file descriptor %d" +msgstr "recherche impossible sur le descripteur de fichier %d" + +#: ../src/common/textfile.cpp:354 +#, c-format +msgid "can't write file '%s' to disk." +msgstr "impossible d'écrire le fichier '%s' sur le disque." + +#: ../src/common/file.cpp:296 +#, c-format +msgid "can't write to file descriptor %d" +msgstr "impossible d'écrire dans le descripteur de fichier %d" + +#: ../src/common/fileconf.cpp:780 +msgid "can't write user configuration file." +msgstr "impossible d'écrire le fichier de configuration utilisateur." + +#: ../src/common/intl.cpp:349 +#, c-format +msgid "catalog file for domain '%s' not found." +msgstr "fichier catalogue introuvable pour le domaine '%s'." + +#: ../src/common/utilscmn.cpp:464 +msgid "ctrl" +msgstr "ctrl" + +#: ../src/common/cmdline.cpp:869 +msgid "date" +msgstr "date" + +#: ../src/common/datetime.cpp:3185 +msgid "eighteenth" +msgstr "dix-huitième" + +#: ../src/common/datetime.cpp:3175 +msgid "eighth" +msgstr "huitième" + +#: ../src/common/datetime.cpp:3178 +msgid "eleventh" +msgstr "onzième" + +#: ../src/common/fileconf.cpp:1402 +#, c-format +msgid "entry '%s' appears more than once in group '%s'" +msgstr "l'entrée '%s' apparaît plus d'une fois dans le groupe '%s'" + +#: ../src/msw/dialup.cpp:856 +msgid "establish" +msgstr "établir" + +#: ../src/common/ffile.cpp:182 +#, c-format +msgid "failed to flush the file '%s'" +msgstr "la mise a jour du fichier '%s' a échoué" + +#: ../src/common/datetime.cpp:3182 +msgid "fifteenth" +msgstr "quinzième" + +#: ../src/common/datetime.cpp:3172 +msgid "fifth" +msgstr "cinquième" + +#: ../src/common/fileconf.cpp:463 +#, c-format +msgid "file '%s', line %d: '%s' ignored after group header." +msgstr "fichier %s, ligne %d: '%s' est ignoré après l'entête de groupe." + +#: ../src/common/fileconf.cpp:492 +#, c-format +msgid "file '%s', line %d: '=' expected." +msgstr "fichier %s, ligne %d: symbole '=' est attendu." + +#: ../src/common/fileconf.cpp:518 +#, c-format +msgid "file '%s', line %d: key '%s' was first found at line %d." +msgstr "" +"fichier %s, ligne %d: première occurence du caractère %s à la ligne %d." + +#: ../src/common/fileconf.cpp:508 +#, c-format +msgid "file '%s', line %d: value for immutable key '%s' ignored." +msgstr "" +"fichier '%s', ligne %d: la valeur pour la touche non configurable '%s' est " +"ignorée." + +#: ../src/common/fileconf.cpp:431 +#, c-format +msgid "file '%s': unexpected character %c at line %d." +msgstr "fichier %s: caractère %c inattendu a la ligne %d." + +#: ../src/common/datetime.cpp:3168 +msgid "first" +msgstr "premier" + +#: ../src/common/datetime.cpp:3181 +msgid "fourteenth" +msgstr "quatorzième" + +#: ../src/common/datetime.cpp:3171 +msgid "fourth" +msgstr "quatrième" + +#: ../src/common/timercmn.cpp:239 +msgid "gmtime() failed" +msgstr "gmtime() a échoué" + +#: ../src/msw/dialup.cpp:856 +msgid "initiate" +msgstr "initialisation" + +#: ../src/common/file.cpp:435 +msgid "invalid eof() return value." +msgstr "eof() a renvoyé une valeur non valide." + +#: ../src/generic/logg.cpp:501 +msgid "invalid message box return value" +msgstr "la fenêtre de message a renvoyé une valeur non valide" + +#: ../src/html/helpfrm.cpp:874 +msgid "large" +msgstr "grand" + +#: ../src/common/intl.cpp:541 +#, c-format +msgid "locale '%s' can not be set." +msgstr "le langage local '%s' ne peut pas être sélectionné." + +#: ../src/common/intl.cpp:344 +#, fuzzy, c-format +msgid "looking for catalog '%s' in path '%s'." +msgstr "utilisation du catalogue '%s' de '%s'." + +#: ../src/html/helpfrm.cpp:874 +msgid "medium" +msgstr "moyen" + +#: ../src/common/datetime.cpp:3289 +msgid "midnight" +msgstr "minuit" + +#: ../src/common/timercmn.cpp:235 +msgid "mktime() failed" +msgstr "mktime() a échoué" + +#: ../src/common/datetime.cpp:3186 +msgid "nineteenth" +msgstr "dix-neuvième" + +#: ../src/common/datetime.cpp:3176 +msgid "ninth" +msgstr "neuvième" + +#: ../src/msw/dde.cpp:961 +msgid "no DDE error." +msgstr "erreur - pas de DDE." + +#: ../src/html/helpdata.cpp:529 +msgid "noname" +msgstr "sansnom" + +#: ../src/common/datetime.cpp:3288 +msgid "noon" +msgstr "midi" + +#: ../src/common/cmdline.cpp:868 +msgid "num" +msgstr "num" + +#: ../src/msw/dde.cpp:1004 +msgid "reentrancy problem." +msgstr "problème de ré-entrance." + +#: ../src/common/datetime.cpp:3169 +msgid "second" +msgstr "second" + +#: ../src/common/datetime.cpp:3184 +msgid "seventeenth" +msgstr "dix-septième" + +#: ../src/common/datetime.cpp:3174 +msgid "seventh" +msgstr "septième" + +#: ../src/common/utilscmn.cpp:468 +msgid "shift" +msgstr "shift" + +#: ../src/common/datetime.cpp:3183 +msgid "sixteenth" +msgstr "seizième" + +#: ../src/common/datetime.cpp:3173 +msgid "sixth" +msgstr "sixième" + +#: ../src/html/helpfrm.cpp:874 +msgid "small" +msgstr "petit" + +#: ../src/common/cmdline.cpp:867 +msgid "str" +msgstr "str" + +#: ../src/common/intl.cpp:634 +#, c-format +msgid "string '%s' not found in domain '%s' for locale '%s'." +msgstr "" +"chaîne ' %s' introuvable dans le domaine '%s' pour le langage local '%s'." + +#: ../src/common/intl.cpp:639 +#, c-format +msgid "string '%s' not found in locale '%s'." +msgstr "chaîne '%s' introuvable pour le langage local '%s'." + +#: ../src/common/datetime.cpp:3177 +msgid "tenth" +msgstr "dixième" + +#: ../src/msw/dde.cpp:968 +msgid "the response to the transaction caused the DDE_FBUSY bit to be set." +msgstr "la réponse à la transaction a provoqué l'activation du bit DDE_FBUSY." + +#: ../src/common/datetime.cpp:3170 +msgid "third" +msgstr "troisième" + +#: ../src/common/datetime.cpp:3180 +msgid "thirteenth" +msgstr "treizième" + +#: ../src/common/datetime.cpp:2981 +msgid "today" +msgstr "aujourd'hui" + +#: ../src/common/datetime.cpp:2983 +msgid "tomorrow" +msgstr "demain" + +#: ../src/common/datetime.cpp:3179 +msgid "twelfth" +msgstr "douzième" + +#: ../src/common/datetime.cpp:3187 +msgid "twentieth" +msgstr "vingtième" + +#: ../src/common/fileconf.cpp:1522 +#, c-format +msgid "unexpected \" at position %d in '%s'." +msgstr "symbole \" inattendu à la position %d dans '%s'." + +#: ../src/generic/progdlgg.cpp:241 +msgid "unknown" +msgstr "inconnu" + +#: ../src/msw/dialup.cpp:462 +#, c-format +msgid "unknown error (error code %08x)." +msgstr "erreur inconnue (code d'erreur %08x)." + +#: ../src/common/file.cpp:334 +msgid "unknown seek origin" +msgstr "origine de la recherche inconnue" + +#: ../src/common/fontmap.cpp:348 +#, c-format +msgid "unknown-%d" +msgstr "inconnu-%d" + +#: ../src/common/docview.cpp:397 +msgid "unnamed" +msgstr "sansnom" + +#: ../src/common/docview.cpp:1177 +#, c-format +msgid "unnamed%d" +msgstr "sansnom%d" + +#: ../src/common/intl.cpp:354 +#, c-format +msgid "using catalog '%s' from '%s'." +msgstr "utilisation du catalogue '%s' de '%s'." + +#: ../src/html/helpfrm.cpp:874 +msgid "very large" +msgstr "très grand" + +#: ../src/html/helpfrm.cpp:874 +msgid "very small" +msgstr "très petit" + +#: ../src/common/timercmn.cpp:266 +msgid "wxGetTimeOfDay failed." +msgstr "wxGetTimeOfDay a échoué." + +#: ../src/common/socket.cpp:329 ../src/common/socket.cpp:383 +msgid "wxSocket: invalid signature in ReadMsg." +msgstr "wxSocket: signature non valide dans ReadMsg." + +#: ../src/common/socket.cpp:903 +msgid "wxSocket: unknown event!." +msgstr "" + +#: ../src/motif/app.cpp:591 +#, c-format +msgid "wxWindows could not open display for '%s': exiting." +msgstr "" +"wxWindows n'a pas pu ouvrir de zone d'affichage (display) pour %s : abandon." + +#: ../src/common/filefn.cpp:1214 +msgid "wxWindows: error finding temporary file name.\n" +msgstr "wxWindows : impossible de trouver le nom du fichier temporaire.\n" + +#: ../src/common/datetime.cpp:2982 +msgid "yesterday" +msgstr "hier" + +#~ msgid "Failed to create dialog." +#~ msgstr "Impossible de créer le dialogue." + +#~ msgid "Message" +#~ msgstr "Message" + +#~ msgid "empty file name in wxFindFileInPath" +#~ msgstr "nom de fichier vide dans wxFindFilelnPath" + +#~ msgid "no DC assigned to wxHtmlWinParser!!" +#~ msgstr "pas de DC affecté a wxHtmlWinParser !!" + +#~ msgid "text/html" +#~ msgstr "texte/html" + +#~ msgid "wxPCXHandler: couldn't allocate memory" +#~ msgstr "wxPCXHandler : impossible d'allouer la mémoire nécessaire" + +#~ msgid "" +#~ "wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to " +#~ "let me know about the canvas!" +#~ msgstr "" +#~ "wxPrintPreviewBase::RenderPage : doit utiliser wxPrintPreviewBase::SetCanvas " +#~ "pour savoir quel canvas utiliser !" diff --git a/locale/wxstd.po b/locale/wxstd.po index 2d88418109..900d9ae0b0 100644 --- a/locale/wxstd.po +++ b/locale/wxstd.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2000-03-07 11:31+0100\n" +"POT-Creation-Date: 2000-06-17 16:43+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -14,13 +14,13 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" -#: ../src/generic/dirdlgg.cpp:479 +#: ../src/generic/dirdlgg.cpp:550 msgid "" "\n" "(Do you have the required permissions?)" msgstr "" -#: ../src/generic/dirdlgg.cpp:466 +#: ../src/generic/dirdlgg.cpp:537 msgid "" "\n" "does not exist\n" @@ -32,66 +32,90 @@ msgstr "" msgid " (error %ld: %s)" msgstr "" -#: ../src/common/docview.cpp:1192 +#: ../src/common/docview.cpp:1195 msgid " - " msgstr "" -#: ../src/html/htmprint.cpp:484 +#: ../src/html/htmprint.cpp:491 msgid " Preview" msgstr "" -#: ../src/generic/filedlgg.cpp:326 +#: ../src/generic/filedlgg.cpp:328 msgid " bytes " msgstr "" +#: ../src/common/paper.cpp:124 +msgid "#10 Envelope, 4 1/8 x 9 1/2 in" +msgstr "" + +#: ../src/common/paper.cpp:125 +msgid "#11 Envelope, 4 1/2 x 10 3/8 in" +msgstr "" + +#: ../src/common/paper.cpp:126 +msgid "#12 Envelope, 4 3/4 x 11 in" +msgstr "" + +#: ../src/common/paper.cpp:127 +msgid "#14 Envelope, 5 x 11 1/2 in" +msgstr "" + +#: ../src/common/paper.cpp:123 +msgid "#9 Envelope, 3 7/8 x 8 7/8 in" +msgstr "" + #: ../src/common/resourc2.cpp:265 ../src/common/resourc2.cpp:1334 -#: ../src/common/resource.cpp:1769 ../src/common/resource.cpp:1899 -#: ../src/common/resource.cpp:2980 +#: ../src/common/resource.cpp:1778 ../src/common/resource.cpp:1908 +#: ../src/common/resource.cpp:2988 #, c-format msgid "#define %s must be an integer." msgstr "" -#: ../src/html/helpfrm.cpp:695 ../src/html/helpfrm.cpp:696 -#: ../src/html/helpfrm.cpp:1242 ../src/html/helpfrm.cpp:1269 +#: ../src/html/helpfrm.cpp:718 ../src/html/helpfrm.cpp:719 +#: ../src/html/helpfrm.cpp:1277 ../src/html/helpfrm.cpp:1304 #, c-format msgid "%i of %i" msgstr "" -#: ../src/common/cmdline.cpp:735 +#: ../src/common/cmdline.cpp:727 #, c-format msgid "%s (or %s)" msgstr "" -#: ../src/common/resourc2.cpp:709 ../src/common/resource.cpp:2350 +#: ../src/common/resourc2.cpp:709 ../src/common/resource.cpp:2359 #, c-format msgid "%s not a bitmap resource specification." msgstr "" -#: ../src/common/resourc2.cpp:864 ../src/common/resource.cpp:2506 +#: ../src/common/resourc2.cpp:864 ../src/common/resource.cpp:2514 #, c-format msgid "%s not an icon resource specification." msgstr "" #: ../src/common/resourc2.cpp:357 ../src/common/resourc2.cpp:1430 -#: ../src/common/resource.cpp:1862 ../src/common/resource.cpp:1991 -#: ../src/common/resource.cpp:3077 +#: ../src/common/resource.cpp:1871 ../src/common/resource.cpp:2000 +#: ../src/common/resource.cpp:3085 #, c-format msgid "%s: ill-formed resource file syntax." msgstr "" -#: ../src/generic/logg.cpp:435 ../src/generic/tipdlg.cpp:170 +#: ../src/generic/logg.cpp:477 ../src/generic/tipdlg.cpp:170 msgid "&Close" msgstr "" -#: ../src/generic/wizard.cpp:268 +#: ../src/generic/logg.cpp:689 +msgid "&Details" +msgstr "" + +#: ../src/generic/wizard.cpp:283 msgid "&Finish" msgstr "" -#: ../src/generic/logg.cpp:436 +#: ../src/generic/logg.cpp:478 msgid "&Log" msgstr "" -#: ../src/generic/wizard.cpp:171 ../src/generic/wizard.cpp:270 +#: ../src/generic/wizard.cpp:188 ../src/generic/wizard.cpp:285 msgid "&Next >" msgstr "" @@ -99,15 +123,15 @@ msgstr "" msgid "&Next Tip" msgstr "" -#: ../src/common/docview.cpp:1889 ../src/common/docview.cpp:1900 +#: ../src/common/docview.cpp:1891 ../src/common/docview.cpp:1902 msgid "&Redo" msgstr "" -#: ../src/common/docview.cpp:1883 ../src/common/docview.cpp:1910 +#: ../src/common/docview.cpp:1885 ../src/common/docview.cpp:1912 msgid "&Redo " msgstr "" -#: ../src/generic/logg.cpp:431 +#: ../src/generic/logg.cpp:473 ../src/generic/logg.cpp:771 msgid "&Save..." msgstr "" @@ -115,15 +139,19 @@ msgstr "" msgid "&Show tips at startup" msgstr "" -#: ../src/common/docview.cpp:1895 +#: ../src/common/docview.cpp:1897 msgid "&Undo" msgstr "" -#: ../src/common/docview.cpp:1870 +#: ../src/common/docview.cpp:1872 msgid "&Undo " msgstr "" -#: ../src/common/config.cpp:390 +#: ../src/msw/mdi.cpp:1249 ../src/msw/mdi.cpp:1256 +msgid "&Window" +msgstr "" + +#: ../src/common/config.cpp:396 #, c-format msgid "'%s' has extra '..', ignored." msgstr "" @@ -133,17 +161,17 @@ msgstr "" msgid "'%s' is invalid" msgstr "" -#: ../src/common/cmdline.cpp:652 +#: ../src/common/cmdline.cpp:649 #, c-format msgid "'%s' is not a correct numeric value for option '%s'." msgstr "" -#: ../src/common/intl.cpp:389 +#: ../src/common/intl.cpp:395 #, c-format msgid "'%s' is not a valid message catalog." msgstr "" -#: ../src/common/textfile.cpp:224 +#: ../src/common/textfile.cpp:250 #, c-format msgid "'%s' is probably a binary file." msgstr "" @@ -168,60 +196,76 @@ msgstr "" msgid "'%s' should only contain alphabetic or numeric characters." msgstr "" -#: ../src/html/helpfrm.cpp:656 +#: ../src/html/helpfrm.cpp:679 msgid "(Help)" msgstr "" -#: ../src/html/helpfrm.cpp:271 ../src/html/helpfrm.cpp:760 -#: ../src/html/helpfrm.cpp:1295 +#: ../src/html/helpfrm.cpp:276 ../src/html/helpfrm.cpp:783 +#: ../src/html/helpfrm.cpp:1330 msgid "(bookmarks)" msgstr "" #: ../src/common/resourc2.cpp:297 ../src/common/resourc2.cpp:1370 -#: ../src/common/resource.cpp:1801 ../src/common/resource.cpp:1931 -#: ../src/common/resource.cpp:3016 +#: ../src/common/resource.cpp:1810 ../src/common/resource.cpp:1940 +#: ../src/common/resource.cpp:3024 msgid "" ", expected static, #include or #define\n" "whilst parsing resource." msgstr "" -#: ../src/generic/dirdlgg.cpp:259 ../src/generic/filedlgg.cpp:708 +#: ../src/generic/dirdlgg.cpp:264 ../src/generic/filedlgg.cpp:710 msgid "." msgstr "" -#: ../src/generic/dirdlgg.cpp:260 ../src/generic/filedlgg.cpp:709 +#: ../src/generic/dirdlgg.cpp:265 ../src/generic/filedlgg.cpp:711 msgid ".." msgstr "" -#: ../src/common/fontmap.cpp:438 +#: ../src/common/paper.cpp:120 +msgid "10 x 14 in" +msgstr "" + +#: ../src/common/paper.cpp:121 +msgid "11 x 17 in" +msgstr "" + +#: ../src/common/paper.cpp:139 +msgid "6 3/4 Envelope, 3 5/8 x 6 1/2 in" +msgstr "" + +#: ../src/html/htmprint.cpp:272 +msgid ": file does not exist!" +msgstr "" + +#: ../src/common/fontmap.cpp:462 msgid ": unknown charset" msgstr "" -#: ../src/common/fontmap.cpp:598 +#: ../src/common/fontmap.cpp:625 msgid ": unknown encoding" msgstr "" -#: ../src/generic/wizard.cpp:168 +#: ../src/generic/wizard.cpp:185 msgid "< &Back" msgstr "" -#: ../src/generic/filedlgg.cpp:354 +#: ../src/generic/filedlgg.cpp:356 msgid "<DIR>" msgstr "" -#: ../src/generic/filedlgg.cpp:321 +#: ../src/generic/filedlgg.cpp:323 msgid "<DIR> " msgstr "" -#: ../src/generic/filedlgg.cpp:355 +#: ../src/generic/filedlgg.cpp:357 msgid "<LINK>" msgstr "" -#: ../src/generic/filedlgg.cpp:322 +#: ../src/generic/filedlgg.cpp:324 msgid "<LINK> " msgstr "" -#: ../src/html/helpfrm.cpp:904 +#: ../src/html/helpfrm.cpp:928 msgid "" "<html><body>Normal face<br>(and <u>underlined</u>. <i>Italic face.</i> " "<b>Bold face.</b> <b><i>Bold italic face.</i></b><br><font size=-2>font size " @@ -236,15 +280,27 @@ msgid "" "+4</font></tt></body></html>" msgstr "" -#: ../src/generic/dcpsg.cpp:2467 +#: ../src/common/paper.cpp:113 +msgid "A3 sheet, 297 x 420 mm" +msgstr "" + +#: ../src/common/paper.cpp:104 ../src/generic/dcpsg.cpp:2516 msgid "A4 sheet, 210 x 297 mm" msgstr "" +#: ../src/common/paper.cpp:114 +msgid "A4 small sheet, 210 x 297 mm" +msgstr "" + +#: ../src/common/paper.cpp:115 +msgid "A5 sheet, 148 x 210 mm" +msgstr "" + #: ../src/generic/fontdlgg.cpp:325 msgid "ABCDEFGabcdefg12345" msgstr "" -#: ../src/html/helpfrm.cpp:265 +#: ../src/html/helpfrm.cpp:270 msgid "Add current page to bookmarks" msgstr "" @@ -252,7 +308,7 @@ msgstr "" msgid "Add to custom colours" msgstr "" -#: ../src/html/helpctrl.cpp:84 +#: ../src/html/helpctrl.cpp:83 #, c-format msgid "Adding book %s" msgstr "" @@ -261,48 +317,80 @@ msgstr "" msgid "All" msgstr "" -#: ../src/generic/filedlgg.cpp:820 +#: ../src/generic/filedlgg.cpp:822 msgid "All files (*)|*" msgstr "" -#: ../src/unix/dialup.cpp:336 +#: ../src/unix/dialup.cpp:359 msgid "Already dialling ISP." msgstr "" -#: ../src/generic/logg.cpp:475 +#: ../src/generic/logg.cpp:1018 #, c-format msgid "Append log to file '%s' (choosing [No] will overwrite it)?" msgstr "" -#: ../src/common/fontmap.cpp:93 +#: ../src/common/fontmap.cpp:102 msgid "Arabic (ISO-8859-6)" msgstr "" -#: ../src/common/imagbmp.cpp:271 +#: ../src/common/paper.cpp:134 +msgid "B4 Envelope, 250 x 353 mm" +msgstr "" + +#: ../src/common/paper.cpp:116 +msgid "B4 sheet, 250 x 354 mm" +msgstr "" + +#: ../src/common/paper.cpp:135 +msgid "B5 Envelope, 176 x 250 mm" +msgstr "" + +#: ../src/common/paper.cpp:117 +msgid "B5 sheet, 182 x 257 millimeter" +msgstr "" + +#: ../src/common/paper.cpp:136 +msgid "B6 Envelope, 176 x 125 mm" +msgstr "" + +#: ../src/common/imagbmp.cpp:356 msgid "BMP: Cannot deal with 4bit encoded yet." msgstr "" -#: ../src/common/imagbmp.cpp:150 ../src/common/imagbmp.cpp:162 +#: ../src/common/imagbmp.cpp:235 ../src/common/imagbmp.cpp:247 msgid "BMP: Couldn't allocate memory." msgstr "" -#: ../src/common/imagbmp.cpp:141 +#: ../src/common/imagbmp.cpp:62 +msgid "BMP: Couldn't save invalid image." +msgstr "" + +#: ../src/common/imagbmp.cpp:126 +msgid "BMP: Couldn't write data." +msgstr "" + +#: ../src/common/imagbmp.cpp:110 +msgid "BMP: Couldn't write the file header." +msgstr "" + +#: ../src/common/imagbmp.cpp:226 msgid "BMP: Encoding doesn't match bitdepth." msgstr "" -#: ../src/common/imagbmp.cpp:104 +#: ../src/common/imagbmp.cpp:189 msgid "BMP: Image height > 32767 pixels for file." msgstr "" -#: ../src/common/imagbmp.cpp:98 +#: ../src/common/imagbmp.cpp:183 msgid "BMP: Image width > 32767 pixels for file." msgstr "" -#: ../src/common/imagbmp.cpp:118 +#: ../src/common/imagbmp.cpp:203 msgid "BMP: Unknown bitdepth in file." msgstr "" -#: ../src/common/imagbmp.cpp:127 +#: ../src/common/imagbmp.cpp:212 msgid "BMP: Unknown encoding in file." msgstr "" @@ -314,15 +402,15 @@ msgstr "" msgid "Backward" msgstr "" -#: ../src/common/fontmap.cpp:91 +#: ../src/common/fontmap.cpp:100 msgid "Baltic (ISO-8859-4)" msgstr "" -#: ../src/common/fontmap.cpp:97 +#: ../src/common/fontmap.cpp:106 msgid "Baltic II (ISO-8859-10)" msgstr "" -#: ../src/common/resourc2.cpp:844 ../src/common/resource.cpp:2486 +#: ../src/common/resourc2.cpp:844 ../src/common/resource.cpp:2494 #, c-format msgid "Bitmap resource specification %s not found." msgstr "" @@ -335,11 +423,35 @@ msgstr "" msgid "Bottom margin (mm):" msgstr "" -#: ../src/generic/logg.cpp:433 +#: ../src/common/paper.cpp:105 +msgid "C sheet, 17 x 22 in" +msgstr "" + +#: ../src/generic/logg.cpp:475 msgid "C&lear" msgstr "" -#: ../src/msw/thread.cpp:222 +#: ../src/common/paper.cpp:130 +msgid "C3 Envelope, 324 x 458 mm" +msgstr "" + +#: ../src/common/paper.cpp:131 +msgid "C4 Envelope, 229 x 324 mm" +msgstr "" + +#: ../src/common/paper.cpp:129 +msgid "C5 Envelope, 162 x 229 mm" +msgstr "" + +#: ../src/common/paper.cpp:132 +msgid "C6 Envelope, 114 x 162 mm" +msgstr "" + +#: ../src/common/paper.cpp:133 +msgid "C65 Envelope, 114 x 229 mm" +msgstr "" + +#: ../src/mac/thread.cpp:179 ../src/msw/thread.cpp:222 msgid "Can not create event object." msgstr "" @@ -347,35 +459,39 @@ msgstr "" msgid "Can not create mutex" msgstr "" -#: ../src/common/filefn.cpp:1279 ../src/msw/dir.cpp:294 +#: ../src/mac/thread.cpp:92 +msgid "Can not create mutex." +msgstr "" + +#: ../src/common/filefn.cpp:1271 ../src/msw/dir.cpp:294 #: ../src/unix/dir.cpp:214 #, c-format msgid "Can not enumerate files in directory '%s'" msgstr "" -#: ../src/msw/thread.cpp:520 +#: ../src/msw/thread.cpp:527 #, c-format msgid "Can not resume thread %x" msgstr "" -#: ../src/msw/thread.cpp:402 +#: ../src/msw/thread.cpp:408 msgid "Can not start thread: error writing TLS." msgstr "" -#: ../src/msw/thread.cpp:505 +#: ../src/msw/thread.cpp:512 #, c-format msgid "Can not suspend thread %x" msgstr "" -#: ../src/msw/thread.cpp:823 +#: ../src/msw/thread.cpp:846 msgid "Can not wait for thread termination" msgstr "" -#: ../src/common/docview.cpp:1872 +#: ../src/common/docview.cpp:1874 msgid "Can't &Undo " msgstr "" -#: ../src/common/image.cpp:713 +#: ../src/common/image.cpp:926 #, c-format msgid "Can't check image format of file '%s': file does not exist." msgstr "" @@ -390,7 +506,7 @@ msgstr "" msgid "Can't copy values of unsupported type %d." msgstr "" -#: ../src/msw/listctrl.cpp:207 +#: ../src/msw/listctrl.cpp:212 msgid "Can't create list control window, check that comctl32.dll is installed." msgstr "" @@ -399,72 +515,67 @@ msgstr "" msgid "Can't create registry key '%s'" msgstr "" -#: ../src/msw/utilsexc.cpp:425 +#: ../src/msw/utilsexc.cpp:418 msgid "Can't create the inter-process read pipe" msgstr "" -#: ../src/msw/utilsexc.cpp:435 +#: ../src/msw/utilsexc.cpp:430 msgid "Can't create the inter-process write pipe" msgstr "" -#: ../src/msw/thread.cpp:487 +#: ../src/msw/thread.cpp:494 msgid "Can't create thread" msgstr "" -#: ../src/msw/window.cpp:2372 +#: ../src/msw/window.cpp:2394 #, c-format msgid "" "Can't create window of class %s!\n" "Possible Windows 3.x compatibility problem?" msgstr "" -#: ../src/msw/registry.cpp:656 +#: ../src/msw/registry.cpp:653 #, c-format msgid "Can't delete key '%s'" msgstr "" -#: ../src/msw/iniconf.cpp:463 +#: ../src/msw/iniconf.cpp:476 #, c-format msgid "Can't delete the INI file '%s'" msgstr "" -#: ../src/msw/registry.cpp:681 +#: ../src/msw/registry.cpp:678 #, c-format msgid "Can't delete value '%s' from key '%s'" msgstr "" -#: ../src/msw/registry.cpp:692 +#: ../src/msw/registry.cpp:689 #, c-format msgid "Can't delete value of key '%s'" msgstr "" -#: ../src/msw/registry.cpp:992 +#: ../src/msw/registry.cpp:991 #, c-format msgid "Can't enumerate subkeys of key '%s'" msgstr "" -#: ../src/msw/registry.cpp:947 +#: ../src/msw/registry.cpp:946 #, c-format msgid "Can't enumerate values of key '%s'" msgstr "" -#: ../src/msw/utilsexc.cpp:400 -#, c-format -msgid "Can't execute command '%s'" -msgstr "" - #: ../src/common/ffile.cpp:234 #, c-format msgid "Can't find current position in file '%s'" msgstr "" -#: ../src/msw/window.cpp:2325 +#: ../src/msw/window.cpp:2344 msgid "" "Can't find dummy dialog template!\n" "Check resource include path for finding wx.rc." msgstr "" -#: ../src/common/object.cpp:321 ../src/common/object.cpp:342 +#: ../src/common/object.cpp:314 ../src/common/object.cpp:335 #, c-format msgid "Can't find the serialization object '%s' for the object '%s'." msgstr "" @@ -474,12 +585,12 @@ msgstr "" msgid "Can't get info about registry key '%s'" msgstr "" -#: ../src/common/image.cpp:413 ../src/common/image.cpp:433 +#: ../src/common/image.cpp:626 ../src/common/image.cpp:646 #, c-format msgid "Can't load image from file '%s': file does not exist." msgstr "" -#: ../src/common/object.cpp:314 +#: ../src/common/object.cpp:307 msgid "Can't load wxSerial dynamic library." msgstr "" @@ -493,36 +604,36 @@ msgstr "" msgid "Can't open registry key '%s'" msgstr "" -#: ../src/msw/registry.cpp:871 +#: ../src/msw/registry.cpp:870 #, c-format msgid "Can't read value of '%s'" msgstr "" -#: ../src/msw/registry.cpp:770 ../src/msw/registry.cpp:809 +#: ../src/msw/registry.cpp:769 ../src/msw/registry.cpp:808 #, c-format msgid "Can't read value of key '%s'" msgstr "" -#: ../src/generic/logg.cpp:522 +#: ../src/generic/logg.cpp:535 ../src/generic/logg.cpp:929 msgid "Can't save log contents to file." msgstr "" -#: ../src/msw/thread.cpp:453 +#: ../src/msw/thread.cpp:460 msgid "Can't set thread priority" msgstr "" -#: ../src/msw/registry.cpp:795 ../src/msw/registry.cpp:895 +#: ../src/msw/registry.cpp:794 ../src/msw/registry.cpp:894 #, c-format msgid "Can't set value of '%s'" msgstr "" #: ../src/common/dlgcmn.cpp:146 ../src/common/prntbase.cpp:107 -#: ../src/generic/dcpsg.cpp:2192 ../src/generic/dirdlgg.cpp:413 -#: ../src/generic/filedlgg.cpp:911 ../src/generic/fontdlgg.cpp:257 -#: ../src/generic/prntdlgg.cpp:468 ../src/generic/progdlgg.cpp:182 -#: ../src/generic/proplist.cpp:523 ../src/generic/wizard.cpp:174 +#: ../src/generic/dcpsg.cpp:2241 ../src/generic/dirdlgg.cpp:424 +#: ../src/generic/filedlgg.cpp:913 ../src/generic/fontdlgg.cpp:257 +#: ../src/generic/prntdlgg.cpp:468 ../src/generic/progdlgg.cpp:179 +#: ../src/generic/proplist.cpp:523 ../src/generic/wizard.cpp:191 #: ../src/gtk/filedlg.cpp:164 ../src/gtk/fontdlg.cpp:178 -#: ../src/html/helpfrm.cpp:887 ../src/motif/msgdlg.cpp:178 +#: ../src/html/helpfrm.cpp:910 ../src/motif/msgdlg.cpp:178 msgid "Cancel" msgstr "" @@ -531,7 +642,7 @@ msgstr "" msgid "Cannot find active dialup connection: %s" msgstr "" -#: ../src/msw/dialup.cpp:829 +#: ../src/msw/dialup.cpp:827 msgid "Cannot find the location of address book file" msgstr "" @@ -540,19 +651,19 @@ msgstr "" msgid "Cannot get priority range for scheduling policy %d." msgstr "" -#: ../src/unix/utilsunx.cpp:691 +#: ../src/unix/utilsunx.cpp:703 msgid "Cannot get the hostname" msgstr "" -#: ../src/unix/utilsunx.cpp:727 +#: ../src/unix/utilsunx.cpp:739 msgid "Cannot get the official hostname" msgstr "" -#: ../src/msw/dialup.cpp:922 +#: ../src/msw/dialup.cpp:920 msgid "Cannot hang up - no active dialup connection." msgstr "" -#: ../src/msw/app.cpp:220 +#: ../src/msw/app.cpp:252 msgid "Cannot initialize OLE" msgstr "" @@ -561,7 +672,7 @@ msgstr "" msgid "Cannot open HTML document: %s" msgstr "" -#: ../src/html/helpdata.cpp:542 +#: ../src/html/helpdata.cpp:657 #, c-format msgid "Cannot open HTML help book: %s" msgstr "" @@ -571,20 +682,24 @@ msgstr "" msgid "Cannot open URL '%s'" msgstr "" -#: ../src/html/helpdata.cpp:238 +#: ../src/html/helpdata.cpp:353 #, c-format msgid "Cannot open contents file: %s" msgstr "" -#: ../src/generic/dcpsg.cpp:1541 +#: ../src/generic/dcpsg.cpp:1584 msgid "Cannot open file for PostScript printing!" msgstr "" -#: ../src/html/helpdata.cpp:253 +#: ../src/html/helpdata.cpp:368 #, c-format msgid "Cannot open index file: %s" msgstr "" +#: ../src/html/helpfrm.cpp:1174 +msgid "Cannot print empty page." +msgstr "" + #: ../src/unix/threadpsx.cpp:935 msgid "Cannot retrieve thread scheduling policy." msgstr "" @@ -593,15 +708,15 @@ msgstr "" msgid "Cannot start thread: error writing TLS" msgstr "" -#: ../src/html/helpfrm.cpp:393 +#: ../src/html/helpfrm.cpp:398 msgid "Case sensitive" msgstr "" -#: ../src/common/fontmap.cpp:89 +#: ../src/common/fontmap.cpp:98 msgid "Central European (ISO-8859-2/Latin 2)" msgstr "" -#: ../src/msw/dialup.cpp:763 +#: ../src/msw/dialup.cpp:762 msgid "Choose ISP to dial" msgstr "" @@ -609,25 +724,25 @@ msgstr "" msgid "Choose font" msgstr "" -#: ../src/generic/logg.cpp:433 +#: ../src/generic/logg.cpp:475 msgid "Clear the log contents" msgstr "" -#: ../src/common/prntbase.cpp:357 ../src/generic/progdlgg.cpp:309 +#: ../src/common/prntbase.cpp:357 ../src/generic/progdlgg.cpp:307 #: ../src/generic/proplist.cpp:518 msgid "Close" msgstr "" -#: ../src/generic/logg.cpp:435 +#: ../src/generic/logg.cpp:477 msgid "Close this window" msgstr "" -#: ../src/common/fileconf.cpp:743 +#: ../src/common/fileconf.cpp:750 #, c-format msgid "Config entry name cannot start with '%c'." msgstr "" -#: ../src/generic/filedlgg.cpp:1070 ../src/gtk/filedlg.cpp:75 +#: ../src/generic/filedlgg.cpp:1074 ../src/gtk/filedlg.cpp:75 msgid "Confirm" msgstr "" @@ -640,8 +755,8 @@ msgstr "" msgid "Connection to wxHelp timed out in %d seconds" msgstr "" -#: ../src/generic/helpwxht.cpp:158 ../src/html/helpfrm.cpp:298 -#: ../src/html/helpfrm.cpp:307 +#: ../src/generic/helpwxht.cpp:158 ../src/html/helpfrm.cpp:303 +#: ../src/html/helpfrm.cpp:312 msgid "Contents" msgstr "" @@ -649,8 +764,8 @@ msgstr "" msgid "Copies:" msgstr "" -#: ../src/common/resourc2.cpp:287 ../src/common/resource.cpp:1791 -#: ../src/common/resource.cpp:1921 +#: ../src/common/resourc2.cpp:287 ../src/common/resource.cpp:1800 +#: ../src/common/resource.cpp:1930 #, c-format msgid "Could not find resource include file %s." msgstr "" @@ -659,19 +774,19 @@ msgstr "" msgid "Could not find tab for id" msgstr "" -#: ../src/msw/textctrl.cpp:1126 +#: ../src/msw/textctrl.cpp:1191 #, c-format msgid "Could not load Rich Edit DLL '%s'" msgstr "" -#: ../src/common/resource.cpp:789 +#: ../src/common/resource.cpp:796 #, c-format msgid "" "Could not resolve control class or id '%s'. Use (non-zero) integer instead\n" " or provide #define (see manual for caveats)" msgstr "" -#: ../src/common/resource.cpp:1234 +#: ../src/common/resource.cpp:1245 #, c-format msgid "" "Could not resolve menu id '%s'. Use (non-zero) integer instead\n" @@ -682,11 +797,11 @@ msgstr "" msgid "Could not start document preview." msgstr "" -#: ../src/generic/printps.cpp:200 ../src/msw/printwin.cpp:240 +#: ../src/generic/printps.cpp:200 ../src/msw/printwin.cpp:242 msgid "Could not start printing." msgstr "" -#: ../src/common/wincmn.cpp:762 +#: ../src/common/wincmn.cpp:777 msgid "Could not transfer data to window" msgstr "" @@ -695,11 +810,15 @@ msgid "Couldn't acquire a mutex lock" msgstr "" #: ../src/msw/dragimag.cpp:142 ../src/msw/dragimag.cpp:179 -#: ../src/msw/imaglist.cpp:145 ../src/msw/imaglist.cpp:167 -#: ../src/msw/imaglist.cpp:180 +#: ../src/msw/imaglist.cpp:153 ../src/msw/imaglist.cpp:175 +#: ../src/msw/imaglist.cpp:188 msgid "Couldn't add an image to the image list." msgstr "" +#: ../src/mac/thread.cpp:227 +msgid "Couldn't change the state of event object." +msgstr "" + #: ../src/msw/timer.cpp:96 msgid "Couldn't create a timer" msgstr "" @@ -709,11 +828,11 @@ msgstr "" msgid "Couldn't find symbol '%s' in a dynamic library" msgstr "" -#: ../src/msw/thread.cpp:540 +#: ../src/msw/thread.cpp:553 msgid "Couldn't get the current thread pointer" msgstr "" -#: ../src/msw/utilsexc.cpp:594 +#: ../src/msw/utilsexc.cpp:625 #, c-format msgid "Couldn't launch DDE server '%s'." msgstr "" @@ -722,7 +841,7 @@ msgstr "" msgid "Couldn't load a PNG image - file is corrupted or not enough memory." msgstr "" -#: ../src/msw/ole/dataobj.cpp:139 +#: ../src/msw/ole/dataobj.cpp:151 #, c-format msgid "Couldn't register clipboard format '%s'." msgstr "" @@ -731,36 +850,44 @@ msgstr "" msgid "Couldn't release a mutex" msgstr "" -#: ../src/msw/listctrl.cpp:608 +#: ../src/msw/listctrl.cpp:612 #, c-format msgid "Couldn't retrieve information about list control item %d." msgstr "" -#: ../src/msw/thread.cpp:910 +#: ../src/msw/thread.cpp:933 msgid "Couldn't terminate thread" msgstr "" -#: ../src/generic/dirdlgg.cpp:500 +#: ../src/generic/dirdlgg.cpp:571 msgid "Create directory" msgstr "" -#: ../src/generic/filedlgg.cpp:878 +#: ../src/generic/filedlgg.cpp:880 msgid "Create new directory" msgstr "" -#: ../src/generic/filedlgg.cpp:885 +#: ../src/generic/filedlgg.cpp:887 msgid "Current directory:" msgstr "" -#: ../src/common/fontmap.cpp:92 +#: ../src/common/fontmap.cpp:101 msgid "Cyrillic (Latin 5)" msgstr "" -#: ../src/msw/dde.cpp:587 +#: ../src/common/paper.cpp:106 +msgid "D sheet, 22 x 34 in" +msgstr "" + +#: ../src/msw/dde.cpp:586 msgid "DDE poke request failed" msgstr "" -#: ../src/generic/filedlgg.cpp:533 +#: ../src/common/paper.cpp:128 +msgid "DL Envelope, 110 x 220 mm" +msgstr "" + +#: ../src/generic/filedlgg.cpp:535 msgid "Date" msgstr "" @@ -778,22 +905,22 @@ msgstr "" msgid "Did you know..." msgstr "" -#: ../src/common/filefn.cpp:1092 +#: ../src/common/filefn.cpp:1086 #, c-format msgid "Directory '%s' couldn't be created" msgstr "" -#: ../src/generic/dirdlgg.cpp:467 +#: ../src/generic/dirdlgg.cpp:538 msgid "Directory does not exist" msgstr "" -#: ../src/html/helpfrm.cpp:361 +#: ../src/html/helpfrm.cpp:366 msgid "" "Display all index items that contain given substring. Search is case " "insensitive." msgstr "" -#: ../src/html/helpfrm.cpp:512 +#: ../src/html/helpfrm.cpp:535 msgid "Display options dialog" msgstr "" @@ -806,40 +933,44 @@ msgstr "" msgid "Done" msgstr "" -#: ../src/generic/progdlgg.cpp:315 +#: ../src/generic/progdlgg.cpp:313 msgid "Done." msgstr "" -#: ../src/generic/progdlgg.cpp:156 +#: ../src/common/paper.cpp:107 +msgid "E sheet, 34 x 44 in" +msgstr "" + +#: ../src/generic/progdlgg.cpp:153 msgid "Elapsed time : " msgstr "" -#: ../src/generic/helphtml.cpp:310 +#: ../src/generic/helphtml.cpp:320 msgid "Entries found" msgstr "" -#: ../src/common/config.cpp:342 +#: ../src/common/config.cpp:349 #, c-format msgid "" "Environment variables expansion failed: missing '%c' at position %d in '%s'." msgstr "" -#: ../src/generic/dcpsg.cpp:1541 ../src/generic/dirdlgg.cpp:263 -#: ../src/generic/dirdlgg.cpp:281 ../src/generic/dirdlgg.cpp:292 -#: ../src/generic/dirdlgg.cpp:533 ../src/generic/filedlgg.cpp:620 -#: ../src/generic/filedlgg.cpp:712 ../src/generic/filedlgg.cpp:726 -#: ../src/generic/filedlgg.cpp:739 ../src/generic/filedlgg.cpp:1036 -#: ../src/generic/filedlgg.cpp:1085 ../src/generic/helpxlp.cpp:241 -#: ../src/generic/logg.cpp:201 ../src/gtk/filedlg.cpp:83 +#: ../src/generic/dcpsg.cpp:1584 ../src/generic/dirdlgg.cpp:268 +#: ../src/generic/dirdlgg.cpp:286 ../src/generic/dirdlgg.cpp:297 +#: ../src/generic/dirdlgg.cpp:604 ../src/generic/filedlgg.cpp:622 +#: ../src/generic/filedlgg.cpp:714 ../src/generic/filedlgg.cpp:728 +#: ../src/generic/filedlgg.cpp:741 ../src/generic/filedlgg.cpp:1040 +#: ../src/generic/filedlgg.cpp:1089 ../src/generic/helpxlp.cpp:241 +#: ../src/generic/logg.cpp:211 ../src/gtk/filedlg.cpp:83 #: ../src/gtk/fontdlg.cpp:72 msgid "Error" msgstr "" -#: ../src/unix/utilsunx.cpp:803 ../src/unix/utilsunx.cpp:811 +#: ../src/unix/utilsunx.cpp:942 ../src/unix/utilsunx.cpp:950 msgid "Error " msgstr "" -#: ../src/generic/dirdlgg.cpp:480 +#: ../src/generic/dirdlgg.cpp:551 msgid "Error creating directory" msgstr "" @@ -847,42 +978,46 @@ msgstr "" msgid "Error: " msgstr "" -#: ../src/common/fontmap.cpp:90 +#: ../src/common/fontmap.cpp:99 msgid "Esperanto (ISO-8859-3)" msgstr "" -#: ../src/generic/progdlgg.cpp:163 +#: ../src/generic/progdlgg.cpp:160 msgid "Estimated time : " msgstr "" -#: ../src/generic/dirdlgg.cpp:213 +#: ../src/generic/dirdlgg.cpp:217 msgid "Etcetera" msgstr "" -#: ../src/msw/utilsexc.cpp:484 +#: ../src/msw/utilsexc.cpp:521 #, c-format msgid "Execution of command '%s' failed" msgstr "" +#: ../src/common/paper.cpp:112 +msgid "Executive, 7 1/4 x 10 1/2 in" +msgstr "" + #: ../src/common/resourc2.cpp:326 ../src/common/resourc2.cpp:1399 -#: ../src/common/resource.cpp:1830 ../src/common/resource.cpp:1960 -#: ../src/common/resource.cpp:3045 +#: ../src/common/resource.cpp:1839 ../src/common/resource.cpp:1969 +#: ../src/common/resource.cpp:3053 msgid "Expected '*' whilst parsing resource." msgstr "" #: ../src/common/resourc2.cpp:342 ../src/common/resourc2.cpp:1415 -#: ../src/common/resource.cpp:1847 ../src/common/resource.cpp:1976 -#: ../src/common/resource.cpp:3062 +#: ../src/common/resource.cpp:1856 ../src/common/resource.cpp:1985 +#: ../src/common/resource.cpp:3070 msgid "Expected '=' whilst parsing resource." msgstr "" #: ../src/common/resourc2.cpp:312 ../src/common/resourc2.cpp:1385 -#: ../src/common/resource.cpp:1816 ../src/common/resource.cpp:1946 -#: ../src/common/resource.cpp:3031 +#: ../src/common/resource.cpp:1825 ../src/common/resource.cpp:1955 +#: ../src/common/resource.cpp:3039 msgid "Expected 'char' whilst parsing resource." msgstr "" -#: ../src/msw/dialup.cpp:857 +#: ../src/msw/dialup.cpp:855 #, c-format msgid "Failed to %s dialup connection: %s" msgstr "" @@ -891,11 +1026,11 @@ msgstr "" msgid "Failed to close the clipboard." msgstr "" -#: ../src/msw/dialup.cpp:798 +#: ../src/msw/dialup.cpp:796 msgid "Failed to connect: missing username/password." msgstr "" -#: ../src/msw/dialup.cpp:743 +#: ../src/msw/dialup.cpp:742 msgid "Failed to connect: no ISP to dial." msgstr "" @@ -909,15 +1044,15 @@ msgstr "" msgid "Failed to copy the contents of registry key '%s' to '%s'." msgstr "" -#: ../src/msw/dde.cpp:924 +#: ../src/msw/dde.cpp:923 msgid "Failed to create DDE string" msgstr "" -#: ../src/msw/mdi.cpp:402 +#: ../src/msw/mdi.cpp:407 msgid "Failed to create MDI parent frame." msgstr "" -#: ../src/msw/statbr95.cpp:123 +#: ../src/msw/statbr95.cpp:149 msgid "Failed to create a status bar." msgstr "" @@ -926,15 +1061,17 @@ msgstr "" msgid "Failed to create connection to server '%s' on topic '%s'" msgstr "" -#: ../src/msw/dialog.cpp:177 -msgid "Failed to create dialog." +#: ../src/msw/dialog.cpp:176 +msgid "" +"Failed to create dialog. You probably forgot to include wx/msw/wx.rc in your " +"resources." msgstr "" -#: ../src/generic/dirdlgg.cpp:478 +#: ../src/generic/dirdlgg.cpp:549 msgid "Failed to create directory " msgstr "" -#: ../src/html/winpars.cpp:357 +#: ../src/html/winpars.cpp:364 #, c-format msgid "Failed to display HTML document in %s encoding" msgstr "" @@ -943,42 +1080,42 @@ msgstr "" msgid "Failed to empty the clipboard." msgstr "" -#: ../src/msw/dde.cpp:606 +#: ../src/msw/dde.cpp:605 msgid "Failed to establish an advise loop with DDE server" msgstr "" -#: ../src/msw/dialup.cpp:636 +#: ../src/msw/dialup.cpp:635 #, c-format msgid "Failed to establish dialup connection: %s" msgstr "" -#: ../src/unix/utilsunx.cpp:430 ../src/unix/utilsunx.cpp:454 +#: ../src/unix/utilsunx.cpp:435 ../src/unix/utilsunx.cpp:463 #, c-format msgid "Failed to execute '%s'\n" msgstr "" -#: ../src/common/resourc2.cpp:808 ../src/common/resource.cpp:2449 +#: ../src/common/resourc2.cpp:808 ../src/common/resource.cpp:2458 #, c-format msgid "" "Failed to find XBM resource %s.\n" "Forgot to use wxResourceLoadBitmapData?" msgstr "" -#: ../src/common/resourc2.cpp:963 ../src/common/resource.cpp:2605 +#: ../src/common/resourc2.cpp:963 ../src/common/resource.cpp:2613 #, c-format msgid "" "Failed to find XBM resource %s.\n" "Forgot to use wxResourceLoadIconData?" msgstr "" -#: ../src/common/resourc2.cpp:824 ../src/common/resource.cpp:2465 +#: ../src/common/resourc2.cpp:824 ../src/common/resource.cpp:2474 #, c-format msgid "" "Failed to find XPM resource %s.\n" "Forgot to use wxResourceLoadBitmapData?" msgstr "" -#: ../src/msw/dialup.cpp:696 +#: ../src/msw/dialup.cpp:695 #, c-format msgid "Failed to get ISP names: %s" msgstr "" @@ -1014,7 +1151,7 @@ msgstr "" msgid "Failed to put data on the clipboard" msgstr "" -#: ../src/unix/utilsunx.cpp:523 +#: ../src/unix/utilsunx.cpp:534 msgid "Failed to redirect child process input/output" msgstr "" @@ -1023,7 +1160,7 @@ msgstr "" msgid "Failed to register DDE server '%s'" msgstr "" -#: ../src/common/fontmap.cpp:485 +#: ../src/common/fontmap.cpp:507 #, c-format msgid "Failed to remember the encoding for the charset '%s'." msgstr "" @@ -1042,7 +1179,7 @@ msgstr "" msgid "Failed to retrieve data from the clipboard." msgstr "" -#: ../src/msw/dialup.cpp:458 +#: ../src/msw/dialup.cpp:459 msgid "Failed to retrieve text of RAS error message" msgstr "" @@ -1050,7 +1187,7 @@ msgstr "" msgid "Failed to retrieve the supported clipboard formats" msgstr "" -#: ../src/msw/dde.cpp:651 +#: ../src/msw/dde.cpp:650 msgid "Failed to send DDE advise notification" msgstr "" @@ -1063,7 +1200,7 @@ msgstr "" msgid "Failed to set thread priority %d." msgstr "" -#: ../src/common/fs_mem.cpp:165 +#: ../src/common/fs_mem.cpp:167 #, c-format msgid "Failed to store image '%s' to memory VFS!" msgstr "" @@ -1072,11 +1209,11 @@ msgstr "" msgid "Failed to terminate a thread." msgstr "" -#: ../src/msw/dde.cpp:625 +#: ../src/msw/dde.cpp:624 msgid "Failed to terminate the advise loop with DDE server" msgstr "" -#: ../src/msw/dialup.cpp:930 +#: ../src/msw/dialup.cpp:928 #, c-format msgid "Failed to terminate the dialup connection: %s" msgstr "" @@ -1086,11 +1223,7 @@ msgstr "" msgid "Failed to unregister DDE server '%s'" msgstr "" -#: ../src/msw/app.cpp:704 -msgid "Fatal Error" -msgstr "" - -#: ../src/generic/logg.cpp:329 +#: ../src/generic/logg.cpp:371 msgid "Fatal error" msgstr "" @@ -1098,11 +1231,11 @@ msgstr "" msgid "Fatal error: " msgstr "" -#: ../src/msw/app.cpp:1199 +#: ../src/msw/app.cpp:1257 msgid "Fatal error: exiting" msgstr "" -#: ../src/generic/filedlgg.cpp:1067 ../src/gtk/filedlg.cpp:72 +#: ../src/generic/filedlgg.cpp:1071 ../src/gtk/filedlg.cpp:72 #, c-format msgid "File '%s' already exists, do you really want to overwrite it?" msgstr "" @@ -1115,32 +1248,36 @@ msgstr "" msgid "File error" msgstr "" -#: ../src/generic/dirdlgg.cpp:281 ../src/generic/filedlgg.cpp:726 +#: ../src/generic/dirdlgg.cpp:286 ../src/generic/filedlgg.cpp:728 msgid "File name exists already." msgstr "" -#: ../src/msw/filedlg.cpp:280 +#: ../src/msw/filedlg.cpp:297 #, c-format msgid "Files (%s)|%s" msgstr "" -#: ../src/html/helpfrm.cpp:335 +#: ../src/html/helpfrm.cpp:340 msgid "Find" msgstr "" -#: ../src/html/helpfrm.cpp:866 +#: ../src/html/helpfrm.cpp:889 msgid "Fixed font:" msgstr "" +#: ../src/common/paper.cpp:118 +msgid "Folio, 8 1/2 x 13 in" +msgstr "" + #: ../src/generic/fontdlgg.cpp:124 msgid "Font" msgstr "" -#: ../src/html/helpfrm.cpp:876 +#: ../src/html/helpfrm.cpp:899 msgid "Font size:" msgstr "" -#: ../src/unix/utilsunx.cpp:480 +#: ../src/unix/utilsunx.cpp:491 msgid "Fork failed" msgstr "" @@ -1149,12 +1286,12 @@ msgid "Forward" msgstr "" #: ../src/common/resourc2.cpp:295 ../src/common/resourc2.cpp:1368 -#: ../src/common/resource.cpp:1799 ../src/common/resource.cpp:1929 -#: ../src/common/resource.cpp:3014 +#: ../src/common/resource.cpp:1808 ../src/common/resource.cpp:1938 +#: ../src/common/resource.cpp:3022 msgid "Found " msgstr "" -#: ../src/html/helpfrm.cpp:614 +#: ../src/html/helpfrm.cpp:637 #, c-format msgid "Found %i matches" msgstr "" @@ -1163,27 +1300,51 @@ msgstr "" msgid "From:" msgstr "" -#: ../src/html/helpfrm.cpp:478 +#: ../src/common/imaggif.cpp:74 +msgid "GIF: data stream seems to be truncated." +msgstr "" + +#: ../src/common/imaggif.cpp:58 +msgid "GIF: error in GIF image format." +msgstr "" + +#: ../src/common/imaggif.cpp:61 +msgid "GIF: not enough memory." +msgstr "" + +#: ../src/common/imaggif.cpp:64 +msgid "GIF: unknown error!!!" +msgstr "" + +#: ../src/common/paper.cpp:142 +msgid "German Legal Fanfold, 8 1/2 x 13 in" +msgstr "" + +#: ../src/common/paper.cpp:141 +msgid "German Std Fanfold, 8 1/2 x 12 in" +msgstr "" + +#: ../src/html/helpfrm.cpp:501 msgid "Go back" msgstr "" -#: ../src/html/helpfrm.cpp:481 +#: ../src/html/helpfrm.cpp:504 msgid "Go forward" msgstr "" -#: ../src/html/helpfrm.cpp:486 +#: ../src/html/helpfrm.cpp:509 msgid "Go one level up in document hierarchy" msgstr "" -#: ../src/generic/filedlgg.cpp:870 +#: ../src/generic/filedlgg.cpp:872 msgid "Go to home directory" msgstr "" -#: ../src/generic/filedlgg.cpp:864 +#: ../src/generic/filedlgg.cpp:866 msgid "Go to parent directory" msgstr "" -#: ../src/common/fontmap.cpp:94 +#: ../src/common/fontmap.cpp:103 msgid "Greek (ISO-8859-7)" msgstr "" @@ -1192,46 +1353,53 @@ msgstr "" msgid "HTML anchor %s does not exist." msgstr "" -#: ../src/common/fontmap.cpp:95 +#: ../src/html/helpfrm.cpp:1188 +msgid "" +"HTML files (*.htm)|*.htm|HTML files (*.html)|*.html|Help books " +"(*.htb)|*.htb|Help books (*.zip)|*.zip|HTML Help Project (*.hhp)|*.hhp|All " +"files (*.*)|*" +msgstr "" + +#: ../src/common/fontmap.cpp:104 msgid "Hebrew (ISO-8859-8)" msgstr "" #: ../src/common/dlgcmn.cpp:142 ../src/generic/proplist.cpp:528 -#: ../src/html/helpfrm.cpp:205 +#: ../src/html/helpfrm.cpp:208 ../src/msw/mdi.cpp:1245 msgid "Help" msgstr "" -#: ../src/html/helpfrm.cpp:849 +#: ../src/html/helpfrm.cpp:872 msgid "Help Browser Options" msgstr "" -#: ../src/generic/helphtml.cpp:309 ../src/generic/helphtml.cpp:310 +#: ../src/generic/helphtml.cpp:319 ../src/generic/helphtml.cpp:320 msgid "Help Index" msgstr "" -#: ../src/html/helpfrm.cpp:1147 +#: ../src/html/helpfrm.cpp:1172 msgid "Help Printing" msgstr "" -#: ../src/generic/helpwxht.cpp:243 ../src/html/helpctrl.cpp:42 +#: ../src/generic/helpwxht.cpp:250 ../src/html/helpctrl.cpp:38 #, c-format msgid "Help: %s" msgstr "" -#: ../src/common/fontmap.cpp:99 +#: ../src/common/fontmap.cpp:108 msgid "ISO-8859-12" msgstr "" -#: ../src/common/fontmap.cpp:100 +#: ../src/common/fontmap.cpp:109 msgid "ISO-8859-13" msgstr "" -#: ../src/common/fontmap.cpp:101 +#: ../src/common/fontmap.cpp:110 msgid "ISO-8859-14" msgstr "" #: ../src/common/resourc2.cpp:997 ../src/common/resourc2.cpp:1008 -#: ../src/common/resource.cpp:2639 ../src/common/resource.cpp:2650 +#: ../src/common/resource.cpp:2647 ../src/common/resource.cpp:2658 #, c-format msgid "Icon resource specification %s not found." msgstr "" @@ -1240,33 +1408,33 @@ msgstr "" msgid "Ill-formed resource file syntax." msgstr "" -#: ../src/generic/dirdlgg.cpp:263 ../src/generic/filedlgg.cpp:712 +#: ../src/generic/dirdlgg.cpp:268 ../src/generic/filedlgg.cpp:714 msgid "Illegal directory name." msgstr "" -#: ../src/generic/filedlgg.cpp:1036 +#: ../src/generic/filedlgg.cpp:1040 msgid "Illegal file specification." msgstr "" -#: ../src/msw/textctrl.cpp:215 +#: ../src/msw/textctrl.cpp:219 msgid "" "Impossible to create a rich edit control, using simple text control instead. " "Please reinstall riched32.dll" msgstr "" -#: ../src/unix/utilsunx.cpp:343 +#: ../src/unix/utilsunx.cpp:344 msgid "Impossible to get child process input" msgstr "" -#: ../src/html/helpdata.cpp:288 +#: ../src/html/helpdata.cpp:403 msgid "Incorrect version of HTML help book" msgstr "" -#: ../src/html/helpfrm.cpp:367 +#: ../src/html/helpfrm.cpp:372 msgid "Index" msgstr "" -#: ../src/generic/logg.cpp:209 +#: ../src/generic/logg.cpp:213 msgid "Information" msgstr "" @@ -1278,33 +1446,53 @@ msgstr "" msgid "Italic" msgstr "" -#: ../src/common/imagjpeg.cpp:195 +#: ../src/common/paper.cpp:137 +msgid "Italy Envelope, 110 x 230 mm" +msgstr "" + +#: ../src/common/imagjpeg.cpp:198 msgid "JPEG: Couldn't load - file is probably corrupted." msgstr "" -#: ../src/common/imagjpeg.cpp:312 +#: ../src/common/imagjpeg.cpp:315 msgid "JPEG: Couldn't save image." msgstr "" -#: ../src/common/fontmap.cpp:103 +#: ../src/common/fontmap.cpp:112 msgid "KOI8-R" msgstr "" -#: ../src/generic/dcpsg.cpp:2183 ../src/generic/prntdlgg.cpp:441 +#: ../src/generic/dcpsg.cpp:2232 ../src/generic/prntdlgg.cpp:441 #: ../src/generic/prntdlgg.cpp:637 msgid "Landscape" msgstr "" +#: ../src/common/paper.cpp:110 +msgid "Ledger, 17 x 11 in" +msgstr "" + #: ../src/generic/prntdlgg.cpp:649 msgid "Left margin (mm):" msgstr "" +#: ../src/common/paper.cpp:103 +msgid "Legal, 8 1/2 x 14 in" +msgstr "" + +#: ../src/common/paper.cpp:108 +msgid "Letter Small, 8 1/2 x 11 in" +msgstr "" + +#: ../src/common/paper.cpp:102 +msgid "Letter, 8 1/2 x 11 in" +msgstr "" + #: ../src/generic/fontdlgg.cpp:216 msgid "Light" msgstr "" -#: ../src/generic/filedlgg.cpp:1263 ../src/gtk/filedlg.cpp:241 -#: ../src/motif/filedlg.cpp:351 ../src/msw/filedlg.cpp:438 +#: ../src/generic/filedlgg.cpp:1267 ../src/gtk/filedlg.cpp:241 +#: ../src/motif/filedlg.cpp:351 ../src/msw/filedlg.cpp:475 #, c-format msgid "Load %s file" msgstr "" @@ -1321,30 +1509,26 @@ msgstr "" msgid "Loading Grey Raw PNM image is not yet implemented." msgstr "" -#: ../src/generic/logg.cpp:525 +#: ../src/generic/logg.cpp:538 #, c-format msgid "Log saved to the file '%s'." msgstr "" -#: ../src/gtk/mdi.cpp:420 +#: ../src/gtk/mdi.cpp:435 msgid "MDI child" msgstr "" -#: ../src/unix/mimetype.cpp:1540 +#: ../src/unix/mimetype.cpp:1570 #, c-format msgid "Mailcap file %s, line %d: incomplete entry ignored." msgstr "" -#: ../src/common/fs_mem.cpp:142 +#: ../src/common/fs_mem.cpp:144 #, c-format msgid "Memory VFS already contains file '%s'!" msgstr "" -#: ../src/generic/logg.cpp:763 -msgid "Message" -msgstr "" - -#: ../src/unix/mimetype.cpp:1261 +#: ../src/unix/mimetype.cpp:1292 #, c-format msgid "Mime.types file %s, line %d: unterminated quoted string." msgstr "" @@ -1353,35 +1537,39 @@ msgstr "" msgid "Modern" msgstr "" +#: ../src/common/paper.cpp:138 +msgid "Monarch Envelope, 3 7/8 x 7 1/2 in" +msgstr "" + #: ../src/common/dlgcmn.cpp:139 msgid "More..." msgstr "" -#: ../src/generic/dirdlgg.cpp:209 +#: ../src/generic/dirdlgg.cpp:213 msgid "Mounted Devices" msgstr "" -#: ../src/generic/dirdlgg.cpp:204 +#: ../src/generic/dirdlgg.cpp:208 msgid "My Harddisk" msgstr "" -#: ../src/generic/dirdlgg.cpp:208 +#: ../src/generic/dirdlgg.cpp:212 msgid "My Home" msgstr "" -#: ../src/generic/filedlgg.cpp:531 +#: ../src/generic/filedlgg.cpp:533 msgid "Name" msgstr "" -#: ../src/generic/dirdlgg.cpp:415 +#: ../src/generic/dirdlgg.cpp:426 msgid "New..." msgstr "" -#: ../src/generic/filedlgg.cpp:605 +#: ../src/generic/filedlgg.cpp:607 msgid "NewName" msgstr "" -#: ../src/html/helpfrm.cpp:492 +#: ../src/html/helpfrm.cpp:515 msgid "Next page" msgstr "" @@ -1391,37 +1579,37 @@ msgid "No" msgstr "" #: ../src/common/resourc2.cpp:814 ../src/common/resourc2.cpp:969 -#: ../src/common/resource.cpp:2455 ../src/common/resource.cpp:2611 +#: ../src/common/resource.cpp:2464 ../src/common/resource.cpp:2619 msgid "No XBM facility available!" msgstr "" -#: ../src/common/resourc2.cpp:830 ../src/common/resource.cpp:2471 +#: ../src/common/resourc2.cpp:830 ../src/common/resource.cpp:2479 msgid "No XPM facility available!" msgstr "" -#: ../src/common/resourc2.cpp:991 ../src/common/resource.cpp:2633 +#: ../src/common/resourc2.cpp:991 ../src/common/resource.cpp:2641 msgid "No XPM icon facility available!" msgstr "" -#: ../src/generic/helphtml.cpp:304 +#: ../src/generic/helphtml.cpp:314 msgid "No entries found." msgstr "" -#: ../src/common/image.cpp:518 +#: ../src/common/image.cpp:731 msgid "No handler found for image type." msgstr "" -#: ../src/common/image.cpp:526 ../src/common/image.cpp:560 +#: ../src/common/image.cpp:739 ../src/common/image.cpp:773 #, c-format msgid "No image handler for type %d defined." msgstr "" -#: ../src/common/image.cpp:544 ../src/common/image.cpp:576 +#: ../src/common/image.cpp:757 ../src/common/image.cpp:789 #, c-format msgid "No image handler for type %s defined." msgstr "" -#: ../src/html/helpfrm.cpp:605 +#: ../src/html/helpfrm.cpp:628 msgid "No matching page found yet" msgstr "" @@ -1429,38 +1617,43 @@ msgstr "" msgid "Normal" msgstr "" -#: ../src/html/helpfrm.cpp:858 +#: ../src/html/helpfrm.cpp:881 msgid "Normal font:" msgstr "" -#: ../src/common/dlgcmn.cpp:125 ../src/generic/dcpsg.cpp:2191 -#: ../src/generic/dirdlgg.cpp:411 ../src/generic/filedlgg.cpp:902 -#: ../src/generic/fontdlgg.cpp:256 ../src/generic/prntdlgg.cpp:467 -#: ../src/generic/proplist.cpp:511 ../src/gtk/filedlg.cpp:158 -#: ../src/gtk/fontdlg.cpp:172 ../src/html/helpfrm.cpp:886 +#: ../src/common/paper.cpp:122 +msgid "Note, 8 1/2 x 11 in" +msgstr "" + +#: ../src/common/dlgcmn.cpp:125 ../src/generic/dcpsg.cpp:2240 +#: ../src/generic/dirdlgg.cpp:422 ../src/generic/filedlgg.cpp:904 +#: ../src/generic/fontdlgg.cpp:256 ../src/generic/logg.cpp:730 +#: ../src/generic/prntdlgg.cpp:467 ../src/generic/proplist.cpp:511 +#: ../src/gtk/filedlg.cpp:158 ../src/gtk/fontdlg.cpp:172 +#: ../src/html/helpfrm.cpp:909 msgid "OK" msgstr "" -#: ../src/html/helpfrm.cpp:500 ../src/html/helpfrm.cpp:1155 +#: ../src/html/helpfrm.cpp:523 ../src/html/helpfrm.cpp:1183 msgid "Open HTML document" msgstr "" -#: ../src/generic/dirdlgg.cpp:292 ../src/generic/dirdlgg.cpp:533 -#: ../src/generic/filedlgg.cpp:620 ../src/generic/filedlgg.cpp:739 +#: ../src/generic/dirdlgg.cpp:297 ../src/generic/dirdlgg.cpp:604 +#: ../src/generic/filedlgg.cpp:622 ../src/generic/filedlgg.cpp:741 msgid "Operation not permitted." msgstr "" -#: ../src/common/cmdline.cpp:592 +#: ../src/common/cmdline.cpp:590 #, c-format msgid "Option '%s' requires a value, '=' expected." msgstr "" -#: ../src/common/cmdline.cpp:612 +#: ../src/common/cmdline.cpp:609 #, c-format msgid "Option '%s' requires a value." msgstr "" -#: ../src/common/cmdline.cpp:668 +#: ../src/common/cmdline.cpp:663 #, c-format msgid "Option '%s': '%s' cannot be converted to a date." msgstr "" @@ -1473,10 +1666,30 @@ msgstr "" msgid "Orientation" msgstr "" +#: ../src/common/imagpcx.cpp:448 ../src/common/imagpcx.cpp:471 +msgid "PCX: couldn't allocate memory" +msgstr "" + +#: ../src/common/imagpcx.cpp:447 +msgid "PCX: image format unsupported" +msgstr "" + +#: ../src/common/imagpcx.cpp:470 +msgid "PCX: invalid image" +msgstr "" + #: ../src/common/imagpcx.cpp:434 msgid "PCX: this is not a PCX file." msgstr "" +#: ../src/common/imagpcx.cpp:450 ../src/common/imagpcx.cpp:472 +msgid "PCX: unknown error !!!" +msgstr "" + +#: ../src/common/imagpcx.cpp:449 +msgid "PCX: version number too low" +msgstr "" + #: ../src/common/imagpnm.cpp:96 msgid "PNM: Couldn't allocate memory." msgstr "" @@ -1517,11 +1730,11 @@ msgstr "" msgid "Paper size" msgstr "" -#: ../src/generic/filedlgg.cpp:535 +#: ../src/generic/filedlgg.cpp:537 msgid "Permissions" msgstr "" -#: ../src/unix/utilsunx.cpp:429 ../src/unix/utilsunx.cpp:453 +#: ../src/unix/utilsunx.cpp:434 ../src/unix/utilsunx.cpp:462 msgid "Pipe creation failed" msgstr "" @@ -1529,11 +1742,11 @@ msgstr "" msgid "Please choose a valid font." msgstr "" -#: ../src/generic/filedlgg.cpp:1085 ../src/gtk/filedlg.cpp:83 +#: ../src/generic/filedlgg.cpp:1089 ../src/gtk/filedlg.cpp:83 msgid "Please choose an existing file." msgstr "" -#: ../src/msw/dialup.cpp:764 +#: ../src/msw/dialup.cpp:763 msgid "Please choose which ISP do you want to connect to" msgstr "" @@ -1541,7 +1754,7 @@ msgstr "" msgid "Please wait..." msgstr "" -#: ../src/generic/dcpsg.cpp:2182 ../src/generic/prntdlgg.cpp:440 +#: ../src/generic/dcpsg.cpp:2231 ../src/generic/prntdlgg.cpp:440 #: ../src/generic/prntdlgg.cpp:636 msgid "Portrait" msgstr "" @@ -1554,23 +1767,23 @@ msgstr "" msgid "PostScript file" msgstr "" -#: ../src/generic/dcpsg.cpp:2224 +#: ../src/generic/dcpsg.cpp:2273 msgid "PostScript:" msgstr "" -#: ../src/generic/dcpsg.cpp:2187 +#: ../src/generic/dcpsg.cpp:2236 msgid "Preview Only" msgstr "" -#: ../src/html/helpfrm.cpp:880 +#: ../src/html/helpfrm.cpp:903 msgid "Preview:" msgstr "" -#: ../src/html/htmprint.cpp:479 +#: ../src/html/htmprint.cpp:486 msgid "Previewing" msgstr "" -#: ../src/html/helpfrm.cpp:489 +#: ../src/html/helpfrm.cpp:512 msgid "Previous page" msgstr "" @@ -1582,7 +1795,7 @@ msgstr "" msgid "Print Error" msgstr "" -#: ../src/common/docview.cpp:884 +#: ../src/common/docview.cpp:887 msgid "Print Preview" msgstr "" @@ -1606,11 +1819,11 @@ msgstr "" msgid "Print spooling" msgstr "" -#: ../src/html/helpfrm.cpp:506 +#: ../src/html/helpfrm.cpp:529 msgid "Print this page" msgstr "" -#: ../src/generic/dcpsg.cpp:2186 ../src/generic/prntdlgg.cpp:150 +#: ../src/generic/dcpsg.cpp:2235 ../src/generic/prntdlgg.cpp:150 msgid "Print to File" msgstr "" @@ -1618,11 +1831,11 @@ msgstr "" msgid "Print..." msgstr "" -#: ../src/generic/dcpsg.cpp:2197 +#: ../src/generic/dcpsg.cpp:2246 msgid "Printer Command: " msgstr "" -#: ../src/generic/dcpsg.cpp:2202 +#: ../src/generic/dcpsg.cpp:2251 msgid "Printer Options: " msgstr "" @@ -1647,7 +1860,7 @@ msgid "Printer..." msgstr "" #: ../src/common/prntbase.cpp:104 ../src/common/prntbase.cpp:146 -#: ../src/html/htmprint.cpp:500 +#: ../src/html/htmprint.cpp:507 msgid "Printing" msgstr "" @@ -1668,7 +1881,11 @@ msgstr "" msgid "Program aborted." msgstr "" -#: ../src/generic/logg.cpp:477 +#: ../src/common/paper.cpp:119 +msgid "Quarto, 215 x 275 mm" +msgstr "" + +#: ../src/generic/logg.cpp:1020 msgid "Question" msgstr "" @@ -1687,7 +1904,7 @@ msgstr "" msgid "Registry key '%s' does not exist, cannot rename it." msgstr "" -#: ../src/msw/registry.cpp:624 +#: ../src/msw/registry.cpp:623 #, c-format msgid "" "Registry key '%s' is needed for normal system operation,\n" @@ -1700,19 +1917,19 @@ msgstr "" msgid "Registry value '%s' already exists." msgstr "" -#: ../src/generic/helphtml.cpp:309 +#: ../src/generic/helphtml.cpp:319 msgid "Relevant entries:" msgstr "" -#: ../src/generic/progdlgg.cpp:170 +#: ../src/generic/progdlgg.cpp:167 msgid "Remaining time : " msgstr "" -#: ../src/html/helpfrm.cpp:264 +#: ../src/html/helpfrm.cpp:269 msgid "Remove current page from bookmarks" msgstr "" -#: ../src/msw/filedlg.cpp:400 +#: ../src/msw/filedlg.cpp:437 #, c-format msgid "Replace file '%s'?" msgstr "" @@ -1725,8 +1942,8 @@ msgstr "" msgid "Roman" msgstr "" -#: ../src/generic/filedlgg.cpp:1279 ../src/gtk/filedlg.cpp:257 -#: ../src/motif/filedlg.cpp:353 ../src/msw/filedlg.cpp:439 +#: ../src/generic/filedlgg.cpp:1283 ../src/gtk/filedlg.cpp:257 +#: ../src/motif/filedlg.cpp:353 ../src/msw/filedlg.cpp:476 #, c-format msgid "Save %s file" msgstr "" @@ -1735,7 +1952,7 @@ msgstr "" msgid "Save as" msgstr "" -#: ../src/generic/logg.cpp:431 +#: ../src/generic/logg.cpp:473 msgid "Save log contents to file" msgstr "" @@ -1743,26 +1960,26 @@ msgstr "" msgid "Script" msgstr "" -#: ../src/generic/helpwxht.cpp:160 ../src/html/helpfrm.cpp:409 -#: ../src/html/helpfrm.cpp:429 +#: ../src/generic/helpwxht.cpp:160 ../src/html/helpfrm.cpp:414 +#: ../src/html/helpfrm.cpp:434 msgid "Search" msgstr "" -#: ../src/html/helpfrm.cpp:411 +#: ../src/html/helpfrm.cpp:416 msgid "" "Search contents of help book(s) for all occurences of the text you typed " "above" msgstr "" -#: ../src/html/helpfrm.cpp:712 +#: ../src/html/helpfrm.cpp:735 msgid "Search in all books" msgstr "" -#: ../src/html/helpfrm.cpp:605 +#: ../src/html/helpfrm.cpp:628 msgid "Searching..." msgstr "" -#: ../src/generic/dirdlgg.cpp:187 +#: ../src/generic/dirdlgg.cpp:191 msgid "Sections" msgstr "" @@ -1771,19 +1988,19 @@ msgstr "" msgid "Seek error on file '%s'" msgstr "" -#: ../src/common/docview.cpp:1414 +#: ../src/common/docview.cpp:1417 msgid "Select a document template" msgstr "" -#: ../src/common/docview.cpp:1437 +#: ../src/common/docview.cpp:1440 msgid "Select a document view" msgstr "" -#: ../src/common/docview.cpp:1332 ../src/common/docview.cpp:1369 +#: ../src/common/docview.cpp:1335 ../src/common/docview.cpp:1372 msgid "Select a file" msgstr "" -#: ../src/generic/dcpsg.cpp:2185 +#: ../src/generic/dcpsg.cpp:2234 msgid "Send to Printer" msgstr "" @@ -1799,23 +2016,23 @@ msgstr "" msgid "Several active dialup connections found, choosing one randomly." msgstr "" -#: ../src/html/helpfrm.cpp:326 +#: ../src/html/helpfrm.cpp:331 msgid "Show all" msgstr "" -#: ../src/html/helpfrm.cpp:360 +#: ../src/html/helpfrm.cpp:365 msgid "Show all items in index" msgstr "" -#: ../src/generic/filedlgg.cpp:908 +#: ../src/generic/filedlgg.cpp:910 msgid "Show hidden files" msgstr "" -#: ../src/html/helpfrm.cpp:473 +#: ../src/html/helpfrm.cpp:496 msgid "Show/hide navigation panel" msgstr "" -#: ../src/generic/filedlgg.cpp:532 +#: ../src/generic/filedlgg.cpp:534 msgid "Size" msgstr "" @@ -1839,7 +2056,11 @@ msgstr "" msgid "Sorry, not enough memory to create a preview." msgstr "" -#: ../src/generic/logg.cpp:585 +#: ../src/common/paper.cpp:111 +msgid "Statement, 5 1/2 x 8 1/2 in" +msgstr "" + +#: ../src/generic/logg.cpp:598 msgid "Status: " msgstr "" @@ -1859,27 +2080,31 @@ msgstr "" msgid "TIFF: Error reading image." msgstr "" +#: ../src/common/paper.cpp:109 +msgid "Tabloid, 11 x 17 in" +msgstr "" + #: ../src/generic/fontdlgg.cpp:211 msgid "Teletype" msgstr "" -#: ../src/common/docview.cpp:1414 +#: ../src/common/docview.cpp:1417 msgid "Templates" msgstr "" -#: ../src/generic/dirdlgg.cpp:214 +#: ../src/generic/dirdlgg.cpp:218 msgid "Temporary" msgstr "" -#: ../src/common/fontmap.cpp:98 +#: ../src/common/fontmap.cpp:107 msgid "Thai (ISO-8859-11)" msgstr "" -#: ../src/generic/dirdlgg.cpp:206 +#: ../src/generic/dirdlgg.cpp:210 msgid "The Computer" msgstr "" -#: ../src/common/fontmap.cpp:442 +#: ../src/common/fontmap.cpp:466 #, c-format msgid "" "The charset '%s' is unknown. You may select\n" @@ -1887,16 +2112,16 @@ msgid "" "[Cancel] if it cannot be replaced" msgstr "" -#: ../src/msw/ole/dataobj.cpp:157 +#: ../src/msw/ole/dataobj.cpp:169 #, c-format msgid "The clipboard format '%d' doesn't exist." msgstr "" -#: ../src/generic/dirdlgg.cpp:464 +#: ../src/generic/dirdlgg.cpp:535 msgid "The directory " msgstr "" -#: ../src/common/fontmap.cpp:602 +#: ../src/common/fontmap.cpp:629 #, c-format msgid "" "The encoding '%s' is unknown.\n" @@ -1904,14 +2129,14 @@ msgid "" "(otherwise the text in this encoding will not be shown correctly)?" msgstr "" -#: ../src/common/docview.cpp:1619 +#: ../src/common/docview.cpp:1622 #, c-format msgid "" "The file '%s' doesn't exist and couldn't be opened.\n" "It has been also removed from the MRU files list." msgstr "" -#: ../src/common/cmdline.cpp:761 +#: ../src/common/cmdline.cpp:753 #, c-format msgid "The required parameter '%s' was not specified." msgstr "" @@ -1920,41 +2145,41 @@ msgstr "" msgid "The text couldn't be saved." msgstr "" -#: ../src/common/cmdline.cpp:740 +#: ../src/common/cmdline.cpp:732 #, c-format msgid "The value for the option '%s' must be specified." msgstr "" -#: ../src/msw/dialup.cpp:412 +#: ../src/msw/dialup.cpp:411 #, c-format msgid "" -"The version of remote access service (RAS) installed on this machine is too " -"old, please upgrade (the following required function is missing: %s)." +"The version of remote access service (RAS) installed on this machine is " +"tooold, please upgrade (the following required function is missing: %s)." msgstr "" -#: ../src/html/htmprint.cpp:479 +#: ../src/html/htmprint.cpp:486 msgid "" "There was a problem previewing.\n" "Perhaps your current printer is not set correctly?" msgstr "" -#: ../src/html/htmprint.cpp:500 +#: ../src/html/htmprint.cpp:507 msgid "" "There was a problem printing.\n" "Perhaps your current printer is not set correctly?" msgstr "" -#: ../src/msw/thread.cpp:1037 +#: ../src/msw/thread.cpp:1058 msgid "" "Thread module initialization failed: can not store value in thread local " "storage" msgstr "" -#: ../src/unix/threadpsx.cpp:1440 +#: ../src/unix/threadpsx.cpp:1441 msgid "Thread module initialization failed: failed to create thread key" msgstr "" -#: ../src/msw/thread.cpp:1023 +#: ../src/msw/thread.cpp:1046 msgid "" "Thread module initialization failed: impossible to allocate index in thread " "local storage" @@ -1964,7 +2189,7 @@ msgstr "" msgid "Thread priority setting is ignored." msgstr "" -#: ../src/generic/filedlgg.cpp:534 ../src/generic/logg.cpp:764 +#: ../src/generic/filedlgg.cpp:536 msgid "Time" msgstr "" @@ -1984,7 +2209,7 @@ msgstr "" msgid "Top margin (mm):" msgstr "" -#: ../src/common/fs_mem.cpp:200 +#: ../src/common/fs_mem.cpp:202 #, c-format msgid "Trying to remove file '%s' from memory VFS, but it is not loaded!" msgstr "" @@ -1993,10 +2218,14 @@ msgstr "" msgid "Trying to solve a NULL hostname: giving up" msgstr "" -#: ../src/common/fontmap.cpp:96 +#: ../src/common/fontmap.cpp:105 msgid "Turkish (ISO-8859-9)" msgstr "" +#: ../src/common/paper.cpp:140 +msgid "US Std Fanfold, 14 7/8 x 11 in" +msgstr "" + #: ../src/html/htmlwin.cpp:175 #, c-format msgid "Unable to open requested HTML document: %s" @@ -2010,41 +2239,41 @@ msgstr "" #: ../src/common/resourc2.cpp:335 ../src/common/resourc2.cpp:349 #: ../src/common/resourc2.cpp:1378 ../src/common/resourc2.cpp:1392 #: ../src/common/resourc2.cpp:1408 ../src/common/resourc2.cpp:1422 -#: ../src/common/resource.cpp:1809 ../src/common/resource.cpp:1823 -#: ../src/common/resource.cpp:1840 ../src/common/resource.cpp:1854 -#: ../src/common/resource.cpp:1939 ../src/common/resource.cpp:1953 -#: ../src/common/resource.cpp:1969 ../src/common/resource.cpp:1983 -#: ../src/common/resource.cpp:3024 ../src/common/resource.cpp:3038 -#: ../src/common/resource.cpp:3055 ../src/common/resource.cpp:3069 +#: ../src/common/resource.cpp:1818 ../src/common/resource.cpp:1832 +#: ../src/common/resource.cpp:1849 ../src/common/resource.cpp:1863 +#: ../src/common/resource.cpp:1948 ../src/common/resource.cpp:1962 +#: ../src/common/resource.cpp:1978 ../src/common/resource.cpp:1992 +#: ../src/common/resource.cpp:3032 ../src/common/resource.cpp:3046 +#: ../src/common/resource.cpp:3063 ../src/common/resource.cpp:3077 msgid "Unexpected end of file whilst parsing resource." msgstr "" -#: ../src/common/cmdline.cpp:712 +#: ../src/common/cmdline.cpp:704 #, c-format msgid "Unexpected parameter '%s'" msgstr "" -#: ../src/msw/dde.cpp:1020 +#: ../src/msw/dde.cpp:1019 #, c-format msgid "Unknown DDE error %08x" msgstr "" -#: ../src/common/fontmap.cpp:306 +#: ../src/common/fontmap.cpp:329 #, c-format msgid "Unknown encoding (%d)" msgstr "" -#: ../src/unix/mimetype.cpp:1303 +#: ../src/unix/mimetype.cpp:1335 #, c-format msgid "Unknown field in file %s, line %d: '%s'." msgstr "" -#: ../src/common/cmdline.cpp:498 +#: ../src/common/cmdline.cpp:496 #, c-format msgid "Unknown long option '%s'" msgstr "" -#: ../src/common/cmdline.cpp:520 +#: ../src/common/cmdline.cpp:518 #, c-format msgid "Unknown option '%s'" msgstr "" @@ -2054,34 +2283,30 @@ msgstr "" msgid "Unmatched '{' in an entry for mime type %s." msgstr "" -#: ../src/common/docview.cpp:1867 ../src/common/docview.cpp:1882 -#: ../src/common/docview.cpp:1909 +#: ../src/common/docview.cpp:1869 ../src/common/docview.cpp:1884 +#: ../src/common/docview.cpp:1911 msgid "Unnamed command" msgstr "" -#: ../src/common/resourc2.cpp:687 ../src/common/resource.cpp:2327 +#: ../src/common/resourc2.cpp:687 ../src/common/resource.cpp:2336 #, c-format msgid "Unrecognized style %s whilst parsing resource." msgstr "" -#: ../src/msw/app.cpp:702 -msgid "Unrecoverable program error detected: the application will terminate." -msgstr "" - #: ../src/msw/clipbrd.cpp:268 ../src/msw/clipbrd.cpp:369 msgid "Unsupported clipboard format." msgstr "" -#: ../src/common/cmdline.cpp:793 +#: ../src/common/cmdline.cpp:789 #, c-format msgid "Usage: %s" msgstr "" -#: ../src/generic/dirdlgg.cpp:210 +#: ../src/generic/dirdlgg.cpp:215 msgid "User" msgstr "" -#: ../src/generic/dirdlgg.cpp:211 +#: ../src/generic/dirdlgg.cpp:214 msgid "User Local" msgstr "" @@ -2089,28 +2314,28 @@ msgstr "" msgid "Validation conflict" msgstr "" -#: ../src/generic/dirdlgg.cpp:212 +#: ../src/generic/dirdlgg.cpp:216 msgid "Variables" msgstr "" -#: ../src/generic/filedlgg.cpp:856 +#: ../src/generic/filedlgg.cpp:858 msgid "View files as a detailed view" msgstr "" -#: ../src/generic/filedlgg.cpp:850 +#: ../src/generic/filedlgg.cpp:852 msgid "View files as a list view" msgstr "" -#: ../src/common/docview.cpp:1437 +#: ../src/common/docview.cpp:1440 msgid "Views" msgstr "" -#: ../src/unix/utilsunx.cpp:263 ../src/unix/utilsunx.cpp:599 +#: ../src/unix/utilsunx.cpp:264 ../src/unix/utilsunx.cpp:613 msgid "Waiting for subprocess termination failed" msgstr "" #: ../src/common/docview.cpp:428 ../src/common/resource.cpp:121 -#: ../src/generic/logg.cpp:205 +#: ../src/generic/logg.cpp:212 msgid "Warning" msgstr "" @@ -2122,81 +2347,89 @@ msgstr "" msgid "Warning: attempt to remove HTML tag handler from empty stack." msgstr "" -#: ../src/common/fontmap.cpp:88 +#: ../src/common/fontmap.cpp:97 msgid "West European (ISO-8859-1/Latin 1)" msgstr "" -#: ../src/common/fontmap.cpp:102 +#: ../src/common/fontmap.cpp:111 msgid "West European new (ISO-8859-15/Latin 0)" msgstr "" -#: ../src/html/helpfrm.cpp:401 +#: ../src/html/helpfrm.cpp:406 msgid "Whole words only" msgstr "" -#: ../src/msw/utils.cpp:497 +#: ../src/msw/utils.cpp:545 msgid "Win32s on Windows 3.1" msgstr "" -#: ../src/msw/utils.cpp:529 +#: ../src/msw/mdi.cpp:1280 +msgid "Window" +msgstr "" + +#: ../src/msw/utils.cpp:577 msgid "Windows 3.1" msgstr "" -#: ../src/msw/utils.cpp:501 +#: ../src/msw/utils.cpp:549 #, c-format msgid "Windows 9%c" msgstr "" -#: ../src/common/fontmap.cpp:110 +#: ../src/common/fontmap.cpp:119 msgid "Windows Arabic (CP 1256)" msgstr "" -#: ../src/common/fontmap.cpp:111 +#: ../src/common/fontmap.cpp:120 msgid "Windows Baltic (CP 1257)" msgstr "" -#: ../src/common/fontmap.cpp:105 +#: ../src/common/fontmap.cpp:114 msgid "Windows Cyrillic (CP 1251)" msgstr "" -#: ../src/common/fontmap.cpp:107 +#: ../src/common/fontmap.cpp:116 msgid "Windows Greek (CP 1253)" msgstr "" -#: ../src/common/fontmap.cpp:109 +#: ../src/common/fontmap.cpp:118 msgid "Windows Hebrew (CP 1255)" msgstr "" -#: ../src/common/fontmap.cpp:106 +#: ../src/common/fontmap.cpp:115 msgid "Windows Latin 1 (CP 1252)" msgstr "" -#: ../src/common/fontmap.cpp:104 +#: ../src/common/fontmap.cpp:113 msgid "Windows Latin 2 (CP 1250)" msgstr "" -#: ../src/common/fontmap.cpp:108 +#: ../src/common/fontmap.cpp:117 msgid "Windows Turkish (CP 1254)" msgstr "" +#: ../src/common/fontmap.cpp:121 +msgid "Windows/DOS OEM (CP 437)" +msgstr "" + #: ../src/common/ffile.cpp:168 #, c-format msgid "Write error on file '%s'" msgstr "" -#: ../src/generic/dcpsg.cpp:2242 +#: ../src/generic/dcpsg.cpp:2291 msgid "X Scaling" msgstr "" -#: ../src/generic/dcpsg.cpp:2251 +#: ../src/generic/dcpsg.cpp:2300 msgid "X Translation" msgstr "" -#: ../src/generic/dcpsg.cpp:2246 +#: ../src/generic/dcpsg.cpp:2295 msgid "Y Scaling" msgstr "" -#: ../src/generic/dcpsg.cpp:2255 +#: ../src/generic/dcpsg.cpp:2304 msgid "Y Translation" msgstr "" @@ -2205,19 +2438,19 @@ msgstr "" msgid "Yes" msgstr "" -#: ../src/generic/dirdlgg.cpp:499 +#: ../src/generic/dirdlgg.cpp:570 msgid "You cannot add a new directory to this section." msgstr "" -#: ../src/common/docview.cpp:1978 +#: ../src/common/docview.cpp:1980 msgid "[EMPTY]" msgstr "" -#: ../src/msw/dde.cpp:987 +#: ../src/msw/dde.cpp:986 msgid "a DDEML application has created a prolonged race condition." msgstr "" -#: ../src/msw/dde.cpp:975 +#: ../src/msw/dde.cpp:974 msgid "" "a DDEML function was called without first calling the DdeInitialize " "function,\n" @@ -2225,54 +2458,54 @@ msgid "" "was passed to a DDEML function." msgstr "" -#: ../src/msw/dde.cpp:993 +#: ../src/msw/dde.cpp:992 msgid "a client's attempt to establish a conversation has failed." msgstr "" -#: ../src/msw/dde.cpp:990 +#: ../src/msw/dde.cpp:989 msgid "a memory allocation failed." msgstr "" -#: ../src/msw/dde.cpp:984 +#: ../src/msw/dde.cpp:983 msgid "a parameter failed to be validated by the DDEML." msgstr "" -#: ../src/msw/dde.cpp:966 +#: ../src/msw/dde.cpp:965 msgid "a request for a synchronous advise transaction has timed out." msgstr "" -#: ../src/msw/dde.cpp:972 +#: ../src/msw/dde.cpp:971 msgid "a request for a synchronous data transaction has timed out." msgstr "" -#: ../src/msw/dde.cpp:981 +#: ../src/msw/dde.cpp:980 msgid "a request for a synchronous execute transaction has timed out." msgstr "" -#: ../src/msw/dde.cpp:999 +#: ../src/msw/dde.cpp:998 msgid "a request for a synchronous poke transaction has timed out." msgstr "" -#: ../src/msw/dde.cpp:1014 +#: ../src/msw/dde.cpp:1013 msgid "a request to end an advise transaction has timed out." msgstr "" -#: ../src/msw/dde.cpp:1008 +#: ../src/msw/dde.cpp:1007 msgid "" "a server-side transaction was attempted on a conversation\n" "that was terminated by the client, or the server\n" "terminated before completing a transaction." msgstr "" -#: ../src/msw/dde.cpp:996 +#: ../src/msw/dde.cpp:995 msgid "a transaction failed." msgstr "" -#: ../src/common/utilscmn.cpp:464 +#: ../src/common/utilscmn.cpp:466 msgid "alt" msgstr "" -#: ../src/msw/dde.cpp:978 +#: ../src/msw/dde.cpp:977 msgid "" "an application initialized as APPCLASS_MONITOR has\n" "attempted to perform a DDE transaction,\n" @@ -2280,22 +2513,22 @@ msgid "" "attempted to perform server transactions." msgstr "" -#: ../src/msw/dde.cpp:1002 +#: ../src/msw/dde.cpp:1001 msgid "an internal call to the PostMessage function has failed. " msgstr "" -#: ../src/msw/dde.cpp:1011 +#: ../src/msw/dde.cpp:1010 msgid "an internal error has occurred in the DDEML." msgstr "" -#: ../src/msw/dde.cpp:1017 +#: ../src/msw/dde.cpp:1016 msgid "" "an invalid transaction identifier was passed to a DDEML function.\n" "Once the application has returned from an XTYP_XACT_COMPLETE callback,\n" "the transaction identifier for that callback is no longer valid." msgstr "" -#: ../src/common/fileconf.cpp:1416 +#: ../src/common/fileconf.cpp:1440 #, c-format msgid "attempt to change immutable key '%s' ignored." msgstr "" @@ -2305,142 +2538,138 @@ msgstr "" msgid "can't close file '%s'" msgstr "" -#: ../src/common/file.cpp:283 +#: ../src/common/file.cpp:252 #, c-format msgid "can't close file descriptor %d" msgstr "" -#: ../src/common/file.cpp:581 ../src/common/file.cpp:591 +#: ../src/common/file.cpp:550 ../src/common/file.cpp:560 #, c-format msgid "can't commit changes to file '%s'" msgstr "" -#: ../src/common/file.cpp:231 +#: ../src/common/file.cpp:200 #, c-format msgid "can't create file '%s'" msgstr "" -#: ../src/common/fileconf.cpp:886 +#: ../src/common/fileconf.cpp:910 #, c-format msgid "can't delete user configuration file '%s'" msgstr "" -#: ../src/common/file.cpp:462 +#: ../src/common/file.cpp:431 #, c-format msgid "can't determine if the end of file is reached on descriptor %d" msgstr "" -#: ../src/common/file.cpp:428 +#: ../src/common/file.cpp:397 #, c-format msgid "can't find length of file on file descriptor %d" msgstr "" -#: ../src/msw/utils.cpp:328 +#: ../src/msw/utils.cpp:376 msgid "can't find user's HOME, using current directory." msgstr "" -#: ../src/common/file.cpp:342 +#: ../src/common/file.cpp:311 #, c-format msgid "can't flush file descriptor %d" msgstr "" -#: ../src/common/file.cpp:396 +#: ../src/common/file.cpp:365 #, c-format msgid "can't get seek position on file descriptor %d" msgstr "" -#: ../src/common/fontmap.cpp:545 +#: ../src/common/fontmap.cpp:571 msgid "can't load any font, aborting" msgstr "" -#: ../src/common/ffile.cpp:85 ../src/common/file.cpp:269 +#: ../src/common/ffile.cpp:85 ../src/common/file.cpp:238 #, c-format msgid "can't open file '%s'" msgstr "" -#: ../src/common/fileconf.cpp:310 +#: ../src/common/fileconf.cpp:316 #, c-format msgid "can't open global configuration file '%s'." msgstr "" -#: ../src/common/fileconf.cpp:322 +#: ../src/common/fileconf.cpp:328 #, c-format msgid "can't open user configuration file '%s'." msgstr "" -#: ../src/common/fileconf.cpp:774 +#: ../src/common/fileconf.cpp:790 msgid "can't open user configuration file." msgstr "" -#: ../src/common/file.cpp:309 +#: ../src/common/file.cpp:278 #, c-format msgid "can't read from file descriptor %d" msgstr "" -#: ../src/common/file.cpp:576 ../src/common/file.cpp:586 +#: ../src/common/file.cpp:545 ../src/common/file.cpp:555 #, c-format msgid "can't remove file '%s'" msgstr "" -#: ../src/common/file.cpp:604 ../src/common/file.cpp:607 +#: ../src/common/file.cpp:573 ../src/common/file.cpp:576 #, c-format msgid "can't remove temporary file '%s'" msgstr "" -#: ../src/common/file.cpp:382 +#: ../src/common/file.cpp:351 #, c-format msgid "can't seek on file descriptor %d" msgstr "" -#: ../src/common/textfile.cpp:328 +#: ../src/common/textfile.cpp:354 #, c-format msgid "can't write file '%s' to disk." msgstr "" -#: ../src/common/file.cpp:327 +#: ../src/common/file.cpp:296 #, c-format msgid "can't write to file descriptor %d" msgstr "" -#: ../src/common/fileconf.cpp:781 +#: ../src/common/fileconf.cpp:797 msgid "can't write user configuration file." msgstr "" -#: ../src/common/intl.cpp:351 +#: ../src/common/intl.cpp:357 #, c-format msgid "catalog file for domain '%s' not found." msgstr "" -#: ../src/common/utilscmn.cpp:462 +#: ../src/common/utilscmn.cpp:464 msgid "ctrl" msgstr "" -#: ../src/common/cmdline.cpp:877 +#: ../src/common/cmdline.cpp:897 msgid "date" msgstr "" -#: ../src/common/datetime.cpp:3185 +#: ../src/common/datetime.cpp:3195 msgid "eighteenth" msgstr "" -#: ../src/common/datetime.cpp:3175 +#: ../src/common/datetime.cpp:3185 msgid "eighth" msgstr "" -#: ../src/common/datetime.cpp:3178 +#: ../src/common/datetime.cpp:3188 msgid "eleventh" msgstr "" -#: ../src/common/filefn.cpp:1729 -msgid "empty file name in wxFindFileInPath" -msgstr "" - -#: ../src/common/fileconf.cpp:1403 +#: ../src/common/fileconf.cpp:1427 #, c-format msgid "entry '%s' appears more than once in group '%s'" msgstr "" -#: ../src/msw/dialup.cpp:858 +#: ../src/msw/dialup.cpp:856 msgid "establish" msgstr "" @@ -2449,48 +2678,48 @@ msgstr "" msgid "failed to flush the file '%s'" msgstr "" -#: ../src/common/datetime.cpp:3182 +#: ../src/common/datetime.cpp:3192 msgid "fifteenth" msgstr "" -#: ../src/common/datetime.cpp:3172 +#: ../src/common/datetime.cpp:3182 msgid "fifth" msgstr "" -#: ../src/common/fileconf.cpp:463 +#: ../src/common/fileconf.cpp:471 #, c-format msgid "file '%s', line %d: '%s' ignored after group header." msgstr "" -#: ../src/common/fileconf.cpp:493 +#: ../src/common/fileconf.cpp:500 #, c-format msgid "file '%s', line %d: '=' expected." msgstr "" -#: ../src/common/fileconf.cpp:520 +#: ../src/common/fileconf.cpp:526 #, c-format msgid "file '%s', line %d: key '%s' was first found at line %d." msgstr "" -#: ../src/common/fileconf.cpp:509 +#: ../src/common/fileconf.cpp:516 #, c-format msgid "file '%s', line %d: value for immutable key '%s' ignored." msgstr "" -#: ../src/common/fileconf.cpp:431 +#: ../src/common/fileconf.cpp:439 #, c-format msgid "file '%s': unexpected character %c at line %d." msgstr "" -#: ../src/common/datetime.cpp:3168 +#: ../src/common/datetime.cpp:3178 msgid "first" msgstr "" -#: ../src/common/datetime.cpp:3181 +#: ../src/common/datetime.cpp:3191 msgid "fourteenth" msgstr "" -#: ../src/common/datetime.cpp:3171 +#: ../src/common/datetime.cpp:3181 msgid "fourth" msgstr "" @@ -2498,32 +2727,37 @@ msgstr "" msgid "gmtime() failed" msgstr "" -#: ../src/msw/dialup.cpp:858 +#: ../src/msw/dialup.cpp:856 msgid "initiate" msgstr "" -#: ../src/common/file.cpp:466 +#: ../src/common/file.cpp:435 msgid "invalid eof() return value." msgstr "" -#: ../src/generic/logg.cpp:490 +#: ../src/generic/logg.cpp:1034 msgid "invalid message box return value" msgstr "" -#: ../src/html/helpfrm.cpp:851 +#: ../src/html/helpfrm.cpp:874 msgid "large" msgstr "" -#: ../src/common/intl.cpp:542 +#: ../src/common/intl.cpp:549 #, c-format msgid "locale '%s' can not be set." msgstr "" -#: ../src/html/helpfrm.cpp:851 +#: ../src/common/intl.cpp:352 +#, c-format +msgid "looking for catalog '%s' in path '%s'." +msgstr "" + +#: ../src/html/helpfrm.cpp:874 msgid "medium" msgstr "" -#: ../src/common/datetime.cpp:3289 +#: ../src/common/datetime.cpp:3342 msgid "midnight" msgstr "" @@ -2531,122 +2765,104 @@ msgstr "" msgid "mktime() failed" msgstr "" -#: ../src/common/datetime.cpp:3186 +#: ../src/common/datetime.cpp:3196 msgid "nineteenth" msgstr "" -#: ../src/common/datetime.cpp:3176 +#: ../src/common/datetime.cpp:3186 msgid "ninth" msgstr "" -#: ../src/html/winpars.cpp:133 -msgid "no DC assigned to wxHtmlWinParser!!" -msgstr "" - -#: ../src/msw/dde.cpp:962 +#: ../src/msw/dde.cpp:961 msgid "no DDE error." msgstr "" -#: ../src/html/helpdata.cpp:529 +#: ../src/html/helpdata.cpp:644 msgid "noname" msgstr "" -#: ../src/common/datetime.cpp:3288 +#: ../src/common/datetime.cpp:3341 msgid "noon" msgstr "" -#: ../src/common/cmdline.cpp:876 +#: ../src/common/cmdline.cpp:896 msgid "num" msgstr "" -#: ../src/msw/dde.cpp:1005 +#: ../src/msw/dde.cpp:1004 msgid "reentrancy problem." msgstr "" -#: ../src/common/datetime.cpp:3169 +#: ../src/common/datetime.cpp:3179 msgid "second" msgstr "" -#: ../src/common/datetime.cpp:3184 +#: ../src/common/datetime.cpp:3194 msgid "seventeenth" msgstr "" -#: ../src/common/datetime.cpp:3174 +#: ../src/common/datetime.cpp:3184 msgid "seventh" msgstr "" -#: ../src/common/utilscmn.cpp:466 +#: ../src/common/utilscmn.cpp:468 msgid "shift" msgstr "" -#: ../src/common/datetime.cpp:3183 +#: ../src/common/datetime.cpp:3193 msgid "sixteenth" msgstr "" -#: ../src/common/datetime.cpp:3173 +#: ../src/common/datetime.cpp:3183 msgid "sixth" msgstr "" -#: ../src/html/helpfrm.cpp:851 +#: ../src/html/helpfrm.cpp:874 msgid "small" msgstr "" -#: ../src/common/cmdline.cpp:875 +#: ../src/common/cmdline.cpp:895 msgid "str" msgstr "" -#: ../src/common/intl.cpp:635 -#, c-format -msgid "string '%s' not found in domain '%s' for locale '%s'." -msgstr "" - -#: ../src/common/intl.cpp:640 -#, c-format -msgid "string '%s' not found in locale '%s'." -msgstr "" - -#: ../src/common/datetime.cpp:3177 +#: ../src/common/datetime.cpp:3187 msgid "tenth" msgstr "" -#: ../src/html/htmlfilt.cpp:133 -msgid "text/html" -msgstr "" - -#: ../src/msw/dde.cpp:969 +#: ../src/msw/dde.cpp:968 msgid "the response to the transaction caused the DDE_FBUSY bit to be set." msgstr "" -#: ../src/common/datetime.cpp:3170 +#: ../src/common/datetime.cpp:3180 msgid "third" msgstr "" -#: ../src/common/datetime.cpp:3180 +#: ../src/common/datetime.cpp:3190 msgid "thirteenth" msgstr "" -#: ../src/common/datetime.cpp:2981 +#: ../src/common/datetime.cpp:2985 msgid "today" msgstr "" -#: ../src/common/datetime.cpp:2983 +#: ../src/common/datetime.cpp:2987 msgid "tomorrow" msgstr "" -#: ../src/common/datetime.cpp:3179 +#: ../src/common/datetime.cpp:3189 msgid "twelfth" msgstr "" -#: ../src/common/datetime.cpp:3187 +#: ../src/common/datetime.cpp:3197 msgid "twentieth" msgstr "" -#: ../src/common/fileconf.cpp:1523 +#: ../src/common/fileconf.cpp:1547 #, c-format msgid "unexpected \" at position %d in '%s'." msgstr "" -#: ../src/generic/progdlgg.cpp:243 +#: ../src/generic/progdlgg.cpp:241 msgid "unknown" msgstr "" @@ -2655,11 +2871,11 @@ msgstr "" msgid "unknown error (error code %08x)." msgstr "" -#: ../src/common/file.cpp:365 +#: ../src/common/file.cpp:334 msgid "unknown seek origin" msgstr "" -#: ../src/common/fontmap.cpp:329 +#: ../src/common/fontmap.cpp:351 #, c-format msgid "unknown-%d" msgstr "" @@ -2668,83 +2884,45 @@ msgstr "" msgid "unnamed" msgstr "" -#: ../src/common/docview.cpp:1174 +#: ../src/common/docview.cpp:1177 #, c-format msgid "unnamed%d" msgstr "" -#: ../src/common/intl.cpp:356 +#: ../src/common/intl.cpp:362 #, c-format msgid "using catalog '%s' from '%s'." msgstr "" -#: ../src/html/helpfrm.cpp:851 +#: ../src/html/helpfrm.cpp:874 msgid "very large" msgstr "" -#: ../src/html/helpfrm.cpp:851 +#: ../src/html/helpfrm.cpp:874 msgid "very small" msgstr "" -#: ../src/common/imaggif.cpp:74 -msgid "wxGIFHandler: data stream seems to be truncated." -msgstr "" - -#: ../src/common/imaggif.cpp:58 -msgid "wxGIFHandler: error in GIF image format." -msgstr "" - -#: ../src/common/imaggif.cpp:61 -msgid "wxGIFHandler: not enough memory." -msgstr "" - -#: ../src/common/imaggif.cpp:64 -msgid "wxGIFHandler: unknown error!!!" -msgstr "" - #: ../src/common/timercmn.cpp:266 msgid "wxGetTimeOfDay failed." msgstr "" -#: ../src/common/imagpcx.cpp:448 ../src/common/imagpcx.cpp:471 -msgid "wxPCXHandler: couldn't allocate memory" -msgstr "" - -#: ../src/common/imagpcx.cpp:447 -msgid "wxPCXHandler: image format unsupported" -msgstr "" - -#: ../src/common/imagpcx.cpp:470 -msgid "wxPCXHandler: invalid image" -msgstr "" - -#: ../src/common/imagpcx.cpp:450 ../src/common/imagpcx.cpp:472 -msgid "wxPCXHandler: unknown error !!!" -msgstr "" - -#: ../src/common/imagpcx.cpp:449 -msgid "wxPCXHandler: version number too low" -msgstr "" - -#: ../src/common/prntbase.cpp:660 -msgid "" -"wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to " -"let me know about the canvas!" +#: ../src/common/socket.cpp:329 ../src/common/socket.cpp:383 +msgid "wxSocket: invalid signature in ReadMsg." msgstr "" -#: ../src/common/socket.cpp:296 ../src/common/socket.cpp:350 -msgid "wxSocket: invalid signature in ReadMsg." +#: ../src/common/socket.cpp:903 +msgid "wxSocket: unknown event!." msgstr "" -#: ../src/motif/app.cpp:584 +#: ../src/motif/app.cpp:591 #, c-format msgid "wxWindows could not open display for '%s': exiting." msgstr "" -#: ../src/common/filefn.cpp:1222 +#: ../src/common/filefn.cpp:1214 msgid "wxWindows: error finding temporary file name.\n" msgstr "" -#: ../src/common/datetime.cpp:2982 +#: ../src/common/datetime.cpp:2986 msgid "yesterday" msgstr "" diff --git a/modules b/modules index c9f0c831dd..9f70b65af4 100644 --- a/modules +++ b/modules @@ -106,4 +106,3 @@ wxOS2 -a wxWindows wxWindows/docs !wxWindows/docs/latex !wxWindows/docs/motif \ wxWindows/testconf -wxStudio wxStudio diff --git a/samples/caret/caret.cpp b/samples/caret/caret.cpp index 36801972fc..b3f8ca5fe7 100644 --- a/samples/caret/caret.cpp +++ b/samples/caret/caret.cpp @@ -61,6 +61,7 @@ public: // event handlers (these functions should _not_ be virtual) void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); + void OnSetBlinkTime(wxCommandEvent& event); private: // any class wishing to process wxWindows events must use this macro @@ -124,8 +125,7 @@ enum // menu items Caret_Quit = 1, Caret_About, - Caret_Test1, - Caret_Test2, + Caret_SetBlinkTime, // controls start here (the numbers are, of course, arbitrary) Caret_Text = 1000 @@ -141,6 +141,7 @@ enum BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(Caret_Quit, MyFrame::OnQuit) EVT_MENU(Caret_About, MyFrame::OnAbout) + EVT_MENU(Caret_SetBlinkTime, MyFrame::OnSetBlinkTime) END_EVENT_TABLE() // Create a new application object: this macro will allow wxWindows to create @@ -190,6 +191,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) // create a menu bar wxMenu *menuFile = new wxMenu; + menuFile->Append(Caret_SetBlinkTime, "&Blink time...\tCtrl-B"); + menuFile->AppendSeparator(); menuFile->Append(Caret_About, "&About...\tCtrl-A", "Show about dialog"); menuFile->AppendSeparator(); menuFile->Append(Caret_Quit, "E&xit\tAlt-X", "Quit this program"); @@ -219,9 +222,26 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - wxMessageBox(_T("This is the about dialog of caret sample."), "About Caret", wxOK | wxICON_INFORMATION, this); + wxMessageBox(_T("The caret wxWindows sample.\n© 1999 Vadim Zeitlin"), + _T("About Caret"), wxOK | wxICON_INFORMATION, this); } +void MyFrame::OnSetBlinkTime(wxCommandEvent& WXUNUSED(event)) +{ + long blinkTime = wxGetNumberFromUser + ( + _T("The caret blink time is the time between two blinks"), + _T("Time in milliseconds:"), + _T("wxCaret sample"), + wxCaret::GetBlinkTime(), 0, 10000, + this + ); + if ( blinkTime != -1 ) + { + wxCaret::SetBlinkTime((int)blinkTime); + wxLogStatus(this, _T("Blink time set to %ld milliseconds."), blinkTime); + } +} // ---------------------------------------------------------------------------- // MyCanvas @@ -292,10 +312,15 @@ void MyCanvas::OnSize( wxSizeEvent &event ) event.Skip(); } +// NB: this method is horrible inefficient especially because the caret +// needs to be redrawn often and in this case we only have to redraw +// the caret location and not the entire window - in a real program we +// would use GetUpdateRegion() and iterate over rectangles it contains void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc( this ); PrepareDC( dc ); + dc.Clear(); dc.SetFont( m_font ); diff --git a/samples/configure b/samples/configure index 839a611c85..ebbe38a6eb 100755 --- a/samples/configure +++ b/samples/configure @@ -662,6 +662,7 @@ trap 'rm -fr `echo " dnd/Makefile dragimag/Makefile drawing/Makefile + dynamic/Makefile exec/Makefile font/Makefile grid/Makefile @@ -805,6 +806,7 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile dnd/Makefile dragimag/Makefile drawing/Makefile + dynamic/Makefile exec/Makefile font/Makefile grid/Makefile diff --git a/samples/configure.in b/samples/configure.in index ee2ae94fdb..94f8876d06 100644 --- a/samples/configure.in +++ b/samples/configure.in @@ -30,6 +30,7 @@ AC_OUTPUT([ dnd/Makefile dragimag/Makefile drawing/Makefile + dynamic/Makefile exec/Makefile font/Makefile grid/Makefile diff --git a/samples/console/console.cpp b/samples/console/console.cpp index 0c1a371415..74b31145f1 100644 --- a/samples/console/console.cpp +++ b/samples/console/console.cpp @@ -37,19 +37,51 @@ //#define TEST_ARRAYS //#define TEST_CMDLINE -//#define TEST_DATETIME +#define TEST_DATETIME //#define TEST_DIR +//#define TEST_DLLLOADER //#define TEST_EXECUTE +//#define TEST_FILE //#define TEST_FILECONF //#define TEST_HASH +//#define TEST_LIST //#define TEST_LOG //#define TEST_LONGLONG //#define TEST_MIME -#define TEST_INFO_FUNCTIONS +//#define TEST_INFO_FUNCTIONS //#define TEST_SOCKETS //#define TEST_STRINGS //#define TEST_THREADS //#define TEST_TIMER +//#define TEST_VCARD +//#define TEST_WCHAR +//#define TEST_ZIP + +// ---------------------------------------------------------------------------- +// test class for container objects +// ---------------------------------------------------------------------------- + +#if defined(TEST_ARRAYS) || defined(TEST_LIST) + +class Bar // Foo is already taken in the hash test +{ +public: + Bar(const wxString& name) : m_name(name) { ms_bars++; } + ~Bar() { ms_bars--; } + + static size_t GetNumber() { return ms_bars; } + + const char *GetName() const { return m_name; } + +private: + wxString m_name; + + static size_t ms_bars; +}; + +size_t Bar::ms_bars = 0; + +#endif // defined(TEST_ARRAYS) || defined(TEST_LIST) // ============================================================================ // implementation @@ -108,6 +140,8 @@ static void ShowCmdLine(const wxCmdLineParser& parser) s << "Size:\t" << lVal << '\n'; if ( parser.Found("d", &dt) ) s << "Date:\t" << dt.FormatISODate() << '\n'; + if ( parser.Found("project_name", &strVal) ) + s << "Project:\t" << strVal << '\n'; wxLogMessage(s); } @@ -191,6 +225,61 @@ static void TestDirEnum() #endif // TEST_DIR +// ---------------------------------------------------------------------------- +// wxDllLoader +// ---------------------------------------------------------------------------- + +#ifdef TEST_DLLLOADER + +#include <wx/dynlib.h> + +static void TestDllLoad() +{ +#if defined(__WXMSW__) + static const wxChar *LIB_NAME = _T("kernel32.dll"); + static const wxChar *FUNC_NAME = _T("lstrlenA"); +#elif defined(__UNIX__) + // weird: using just libc.so does *not* work! + static const wxChar *LIB_NAME = _T("/lib/libc-2.0.7.so"); + static const wxChar *FUNC_NAME = _T("strlen"); +#else + #error "don't know how to test wxDllLoader on this platform" +#endif + + puts("*** testing wxDllLoader ***\n"); + + wxDllType dllHandle = wxDllLoader::LoadLibrary(LIB_NAME); + if ( !dllHandle ) + { + wxPrintf(_T("ERROR: failed to load '%s'.\n"), LIB_NAME); + } + else + { + typedef int (*strlenType)(char *); + strlenType pfnStrlen = (strlenType)wxDllLoader::GetSymbol(dllHandle, FUNC_NAME); + if ( !pfnStrlen ) + { + wxPrintf(_T("ERROR: function '%s' wasn't found in '%s'.\n"), + FUNC_NAME, LIB_NAME); + } + else + { + if ( pfnStrlen("foo") != 3 ) + { + wxPrintf(_T("ERROR: loaded function is not strlen()!\n")); + } + else + { + puts("... ok"); + } + } + + wxDllLoader::UnloadLibrary(dllHandle); + } +} + +#endif // TEST_DLLLOADER + // ---------------------------------------------------------------------------- // wxExecute // ---------------------------------------------------------------------------- @@ -258,6 +347,73 @@ static void TestExecute() #endif // TEST_EXECUTE +// ---------------------------------------------------------------------------- +// file +// ---------------------------------------------------------------------------- + +#ifdef TEST_FILE + +#include <wx/file.h> +#include <wx/textfile.h> + +static void TestFileRead() +{ + puts("*** wxFile read test ***"); + + wxFile file(_T("testdata.fc")); + if ( file.IsOpened() ) + { + printf("File length: %lu\n", file.Length()); + + puts("File dump:\n----------"); + + static const size_t len = 1024; + char buf[len]; + for ( ;; ) + { + off_t nRead = file.Read(buf, len); + if ( nRead == wxInvalidOffset ) + { + printf("Failed to read the file."); + break; + } + + fwrite(buf, nRead, 1, stdout); + + if ( nRead < len ) + break; + } + + puts("----------"); + } + else + { + printf("ERROR: can't open test file.\n"); + } + + puts(""); +} + +static void TestTextFileRead() +{ + puts("*** wxTextFile read test ***"); + + wxTextFile file(_T("testdata.fc")); + if ( file.Open() ) + { + printf("Number of lines: %u\n", file.GetLineCount()); + printf("Last line: '%s'\n", file.GetLastLine().c_str()); + } + else + { + printf("ERROR: can't open '%s'\n", file.GetName()); + } + + puts(""); +} + +#endif // TEST_FILE + // ---------------------------------------------------------------------------- // wxFileConfig // ---------------------------------------------------------------------------- @@ -407,6 +563,44 @@ static void TestHash() #endif // TEST_HASH +// ---------------------------------------------------------------------------- +// wxList +// ---------------------------------------------------------------------------- + +#ifdef TEST_LIST + +#include <wx/list.h> + +WX_DECLARE_LIST(Bar, wxListBars); +#include <wx/listimpl.cpp> +WX_DEFINE_LIST(wxListBars); + +static void TestListCtor() +{ + puts("*** Testing wxList construction ***\n"); + + { + wxListBars list1; + list1.Append(new Bar(_T("first"))); + list1.Append(new Bar(_T("second"))); + + printf("After 1st list creation: %u objects in the list, %u objects total.\n", + list1.GetCount(), Bar::GetNumber()); + + wxListBars list2; + list2 = list1; + + printf("After 2nd list creation: %u and %u objects in the lists, %u objects total.\n", + list1.GetCount(), list2.GetCount(), Bar::GetNumber()); + + list1.DeleteContents(TRUE); + } + + printf("After list destruction: %u objects left.\n", Bar::GetNumber()); +} + +#endif // TEST_LIST + // ---------------------------------------------------------------------------- // MIME types // ---------------------------------------------------------------------------- @@ -415,12 +609,13 @@ static void TestHash() #include <wx/mimetype.h> +static wxMimeTypesManager g_mimeManager; + static void TestMimeEnum() { - wxMimeTypesManager mimeTM; wxArrayString mimetypes; - size_t count = mimeTM.EnumAllFileTypes(mimetypes); + size_t count = g_mimeManager.EnumAllFileTypes(mimetypes); printf("*** All %u known filetypes: ***\n", count); @@ -429,7 +624,7 @@ static void TestMimeEnum() for ( size_t n = 0; n < count; n++ ) { - wxFileType *filetype = mimeTM.GetFileTypeFromMimeType(mimetypes[n]); + wxFileType *filetype = g_mimeManager.GetFileTypeFromMimeType(mimetypes[n]); if ( !filetype ) { printf("nothing known about the filetype '%s'!\n", @@ -455,6 +650,60 @@ static void TestMimeEnum() } } +static void TestMimeOverride() +{ + wxPuts(_T("*** Testing wxMimeTypesManager additional files loading ***\n")); + + wxString mailcap = _T("/tmp/mailcap"), + mimetypes = _T("/tmp/mime.types"); + + wxPrintf(_T("Loading mailcap from '%s': %s\n"), + mailcap.c_str(), + g_mimeManager.ReadMailcap(mailcap) ? _T("ok") : _T("ERROR")); + wxPrintf(_T("Loading mime.types from '%s': %s\n"), + mimetypes.c_str(), + g_mimeManager.ReadMimeTypes(mimetypes) ? _T("ok") : _T("ERROR")); +} + +static void TestMimeFilename() +{ + wxPuts(_T("*** Testing MIME type from filename query ***\n")); + + static const wxChar *filenames[] = + { + _T("readme.txt"), + _T("document.pdf"), + _T("image.gif"), + }; + + for ( size_t n = 0; n < WXSIZEOF(filenames); n++ ) + { + const wxString fname = filenames[n]; + wxString ext = fname.AfterLast(_T('.')); + wxFileType *ft = g_mimeManager.GetFileTypeFromExtension(ext); + if ( !ft ) + { + wxPrintf(_T("WARNING: extension '%s' is unknown.\n"), ext.c_str()); + } + else + { + wxString desc; + if ( !ft->GetDescription(&desc) ) + desc = _T("<no description>"); + + wxString cmd; + if ( !ft->GetOpenCommand(&cmd, + wxFileType::MessageParameters(fname, _T(""))) ) + cmd = _T("<no command available>"); + + wxPrintf(_T("To open %s (%s) do '%s'.\n"), + fname.c_str(), desc.c_str(), cmd.c_str()); + + delete ft; + } + } +} + #endif // TEST_MIME // ---------------------------------------------------------------------------- @@ -703,28 +952,16 @@ static void TestBitOperations() { puts("*** Testing wxLongLong bit operation ***\n"); - wxLongLong a, c; + wxLongLong ll; size_t nTested = 0; for ( size_t n = 0; n < 100000; n++ ) { - a = RAND_LL(); + ll = RAND_LL(); #if wxUSE_LONGLONG_NATIVE for ( size_t n = 0; n < 33; n++ ) { - wxLongLongNative b(a.GetHi(), a.GetLo()); - - b >>= n; - c = a >> n; - - wxASSERT_MSG( b == c, "bit shift failure" ); - - b = wxLongLongNative(a.GetHi(), a.GetLo()) << n; - c = a << n; - - wxASSERT_MSG( b == c, "bit shift failure" ); } - #else // !wxUSE_LONGLONG_NATIVE puts("Can't do it without native long long type, test skipped."); @@ -743,6 +980,55 @@ static void TestBitOperations() puts(" done!"); } +static void TestLongLongComparison() +{ + puts("*** Testing wxLongLong comparison ***\n"); + + static const long testLongs[] = + { + 0, + 1, + -1, + LONG_MAX, + LONG_MIN, + 0x1234, + -0x1234 + }; + + static const long ls[2] = + { + 0x1234, + -0x1234, + }; + + wxLongLongWx lls[2]; + lls[0] = ls[0]; + lls[1] = ls[1]; + + for ( size_t n = 0; n < WXSIZEOF(testLongs); n++ ) + { + bool res; + + for ( size_t m = 0; m < WXSIZEOF(lls); m++ ) + { + res = lls[m] > testLongs[n]; + printf("0x%lx > 0x%lx is %s (%s)\n", + ls[m], testLongs[n], res ? "true" : "false", + res == (ls[m] > testLongs[n]) ? "ok" : "ERROR"); + + res = lls[m] < testLongs[n]; + printf("0x%lx < 0x%lx is %s (%s)\n", + ls[m], testLongs[n], res ? "true" : "false", + res == (ls[m] < testLongs[n]) ? "ok" : "ERROR"); + + res = lls[m] == testLongs[n]; + printf("0x%lx == 0x%lx is %s (%s)\n", + ls[m], testLongs[n], res ? "true" : "false", + res == (ls[m] == testLongs[n]) ? "ok" : "ERROR"); + } + } +} + #undef MAKE_LL #undef RAND_LL @@ -881,7 +1167,7 @@ static void TestSocketClient() static void TestProtocolFtp() { - puts("*** Testing wxFTP ***\n"); + puts("*** Testing wxFTP download ***\n"); wxLog::AddTraceMask(_T("ftp")); @@ -951,6 +1237,49 @@ static void TestProtocolFtp() } } +static void TestProtocolFtpUpload() +{ + puts("*** Testing wxFTP uploading ***\n"); + + wxLog::AddTraceMask(_T("ftp")); + + static const char *hostname = "localhost"; + + printf("--- Attempting to connect to %s:21...\n", hostname); + + wxFTP ftp; + ftp.SetUser("zeitlin"); + ftp.SetPassword("insert your password here"); + if ( !ftp.Connect(hostname) ) + { + printf("ERROR: failed to connect to %s\n", hostname); + } + else + { + printf("--- Connected to %s, current directory is '%s'\n", + hostname, ftp.Pwd().c_str()); + + // upload a file + static const char *file1 = "test1"; + static const char *file2 = "test2"; + wxOutputStream *out = ftp.GetOutputStream(file1); + if ( out ) + { + printf("--- Uploading to %s ---\n", file1); + out->Write("First hello", 11); + delete out; + } + + out = ftp.GetOutputStream(file2); + if ( out ) + { + printf("--- Uploading to %s ---\n", file1); + out->Write("Second hello", 12); + delete out; + } + } +} + #endif // TEST_SOCKETS // ---------------------------------------------------------------------------- @@ -1003,6 +1332,317 @@ static void TestStopWatch() #endif // TEST_TIMER +// ---------------------------------------------------------------------------- +// vCard support +// ---------------------------------------------------------------------------- + +#ifdef TEST_VCARD + +#include <wx/vcard.h> + +static void DumpVObject(size_t level, const wxVCardObject& vcard) +{ + void *cookie; + wxVCardObject *vcObj = vcard.GetFirstProp(&cookie); + while ( vcObj ) + { + printf("%s%s", + wxString(_T('\t'), level).c_str(), + vcObj->GetName().c_str()); + + wxString value; + switch ( vcObj->GetType() ) + { + case wxVCardObject::String: + case wxVCardObject::UString: + { + wxString val; + vcObj->GetValue(&val); + value << _T('"') << val << _T('"'); + } + break; + + case wxVCardObject::Int: + { + unsigned int i; + vcObj->GetValue(&i); + value.Printf(_T("%u"), i); + } + break; + + case wxVCardObject::Long: + { + unsigned long l; + vcObj->GetValue(&l); + value.Printf(_T("%lu"), l); + } + break; + + case wxVCardObject::None: + break; + + case wxVCardObject::Object: + value = _T("<node>"); + break; + + default: + value = _T("<unknown value type>"); + } + + if ( !!value ) + printf(" = %s", value.c_str()); + putchar('\n'); + + DumpVObject(level + 1, *vcObj); + + delete vcObj; + vcObj = vcard.GetNextProp(&cookie); + } +} + +static void DumpVCardAddresses(const wxVCard& vcard) +{ + puts("\nShowing all addresses from vCard:\n"); + + size_t nAdr = 0; + void *cookie; + wxVCardAddress *addr = vcard.GetFirstAddress(&cookie); + while ( addr ) + { + wxString flagsStr; + int flags = addr->GetFlags(); + if ( flags & wxVCardAddress::Domestic ) + { + flagsStr << _T("domestic "); + } + if ( flags & wxVCardAddress::Intl ) + { + flagsStr << _T("international "); + } + if ( flags & wxVCardAddress::Postal ) + { + flagsStr << _T("postal "); + } + if ( flags & wxVCardAddress::Parcel ) + { + flagsStr << _T("parcel "); + } + if ( flags & wxVCardAddress::Home ) + { + flagsStr << _T("home "); + } + if ( flags & wxVCardAddress::Work ) + { + flagsStr << _T("work "); + } + + printf("Address %u:\n" + "\tflags = %s\n" + "\tvalue = %s;%s;%s;%s;%s;%s;%s\n", + ++nAdr, + flagsStr.c_str(), + addr->GetPostOffice().c_str(), + addr->GetExtAddress().c_str(), + addr->GetStreet().c_str(), + addr->GetLocality().c_str(), + addr->GetRegion().c_str(), + addr->GetPostalCode().c_str(), + addr->GetCountry().c_str() + ); + + delete addr; + addr = vcard.GetNextAddress(&cookie); + } +} + +static void DumpVCardPhoneNumbers(const wxVCard& vcard) +{ + puts("\nShowing all phone numbers from vCard:\n"); + + size_t nPhone = 0; + void *cookie; + wxVCardPhoneNumber *phone = vcard.GetFirstPhoneNumber(&cookie); + while ( phone ) + { + wxString flagsStr; + int flags = phone->GetFlags(); + if ( flags & wxVCardPhoneNumber::Voice ) + { + flagsStr << _T("voice "); + } + if ( flags & wxVCardPhoneNumber::Fax ) + { + flagsStr << _T("fax "); + } + if ( flags & wxVCardPhoneNumber::Cellular ) + { + flagsStr << _T("cellular "); + } + if ( flags & wxVCardPhoneNumber::Modem ) + { + flagsStr << _T("modem "); + } + if ( flags & wxVCardPhoneNumber::Home ) + { + flagsStr << _T("home "); + } + if ( flags & wxVCardPhoneNumber::Work ) + { + flagsStr << _T("work "); + } + + printf("Phone number %u:\n" + "\tflags = %s\n" + "\tvalue = %s\n", + ++nPhone, + flagsStr.c_str(), + phone->GetNumber().c_str() + ); + + delete phone; + phone = vcard.GetNextPhoneNumber(&cookie); + } +} + +static void TestVCardRead() +{ + puts("*** Testing wxVCard reading ***\n"); + + wxVCard vcard(_T("vcard.vcf")); + if ( !vcard.IsOk() ) + { + puts("ERROR: couldn't load vCard."); + } + else + { + // read individual vCard properties + wxVCardObject *vcObj = vcard.GetProperty("FN"); + wxString value; + if ( vcObj ) + { + vcObj->GetValue(&value); + delete vcObj; + } + else + { + value = _T("<none>"); + } + + printf("Full name retrieved directly: %s\n", value.c_str()); + + + if ( !vcard.GetFullName(&value) ) + { + value = _T("<none>"); + } + + printf("Full name from wxVCard API: %s\n", value.c_str()); + + // now show how to deal with multiply occuring properties + DumpVCardAddresses(vcard); + DumpVCardPhoneNumbers(vcard); + + // and finally show all + puts("\nNow dumping the entire vCard:\n" + "-----------------------------\n"); + + DumpVObject(0, vcard); + } +} + +static void TestVCardWrite() +{ + puts("*** Testing wxVCard writing ***\n"); + + wxVCard vcard; + if ( !vcard.IsOk() ) + { + puts("ERROR: couldn't create vCard."); + } + else + { + // set some fields + vcard.SetName("Zeitlin", "Vadim"); + vcard.SetFullName("Vadim Zeitlin"); + vcard.SetOrganization("wxWindows", "R&D"); + + // just dump the vCard back + puts("Entire vCard follows:\n"); + puts(vcard.Write()); + } +} + +#endif // TEST_VCARD + +// ---------------------------------------------------------------------------- +// wide char (Unicode) support +// ---------------------------------------------------------------------------- + +#ifdef TEST_WCHAR + +#include <wx/strconv.h> +#include <wx/buffer.h> + +static void TestUtf8() +{ + puts("*** Testing UTF8 support ***\n"); + + wxString testString = "français"; +#if 0 +"************ French - Français ****************" +"Juste un petit exemple pour dire que les français aussi" +"ont à cÅur de pouvoir utiliser tous leurs caractères ! :)"; +#endif + + wxWCharBuffer wchBuf = testString.wc_str(wxConvUTF8); + const wchar_t *pwz = (const wchar_t *)wchBuf; + wxString testString2(pwz, wxConvLocal); + + printf("Decoding '%s' => '%s'\n", testString.c_str(), testString2.c_str()); + + char *psz = "fran" "\xe7" "ais"; + size_t len = strlen(psz); + wchar_t *pwz2 = new wchar_t[len + 1]; + for ( size_t n = 0; n <= len; n++ ) + { + pwz2[n] = (wchar_t)(unsigned char)psz[n]; + } + + wxString testString3(pwz2, wxConvUTF8); + delete [] pwz2; + + printf("Encoding '%s' -> '%s'\n", psz, testString3.c_str()); +} + +#endif // TEST_WCHAR + +// ---------------------------------------------------------------------------- +// ZIP stream +// ---------------------------------------------------------------------------- + +#ifdef TEST_ZIP + +#include "wx/zipstrm.h" + +static void TestZipStreamRead() +{ + puts("*** Testing ZIP reading ***\n"); + + wxZipInputStream istr(_T("idx.zip"), _T("IDX.txt")); + printf("Archive size: %u\n", istr.GetSize()); + + puts("Dumping the file:"); + while ( !istr.Eof() ) + { + putchar(istr.GetC()); + fflush(stdout); + } + + puts("\n----- done ------"); +} + +#endif // TEST_ZIP + // ---------------------------------------------------------------------------- // date time // ---------------------------------------------------------------------------- @@ -1662,6 +2302,7 @@ static void TestTimeFormat() { CompareBoth, "Date is %x, time is %X" }, { CompareTime, "Time is %H:%M:%S or %I:%M:%S %p" }, { CompareNone, "The day of year: %j, the week of year: %W" }, + { CompareDate, "ISO date without separators: %4Y%2m%2d" }, }; static const Date formatTestDates[] = @@ -1807,16 +2448,24 @@ static void TestInteractive() if ( !fgets(buf, WXSIZEOF(buf), stdin) ) break; + // kill the last '\n' + buf[strlen(buf) - 1] = 0; + wxDateTime dt; - if ( !dt.ParseDate(buf) ) + const char *p = dt.ParseDate(buf); + if ( !p ) { - puts("failed to parse the date"); + printf("ERROR: failed to parse the date '%s'.\n", buf); continue; } + else if ( *p ) + { + printf("WARNING: parsed only first %u characters.\n", p - buf); + } printf("%s: day %u, week of month %u/%u, week of year %u\n", - dt.FormatISODate().c_str(), + dt.Format("%b %d, %Y").c_str(), dt.GetDayOfYear(), dt.GetWeekOfMonth(wxDateTime::Monday_First), dt.GetWeekOfMonth(wxDateTime::Sunday_First), @@ -1826,21 +2475,38 @@ static void TestInteractive() puts("\n*** done ***"); } +static void TestTimeMS() +{ + puts("*** testing millisecond-resolution support in wxDateTime ***"); + + wxDateTime dt1 = wxDateTime::Now(), + dt2 = wxDateTime::UNow(); + + printf("Now = %s\n", dt1.Format("%H:%M:%S:%l").c_str()); + printf("UNow = %s\n", dt2.Format("%H:%M:%S:%l").c_str()); + printf("Difference is %s\n", (dt2 - dt1).Format("%l").c_str()); + + puts("\n*** done ***"); +} + static void TestTimeArithmetics() { puts("\n*** testing arithmetic operations on wxDateTime ***"); - static const struct + static const struct ArithmData { + ArithmData(const wxDateSpan& sp, const char *nam) + : span(sp), name(nam) { } + wxDateSpan span; const char *name; } testArithmData[] = { - { wxDateSpan::Day(), "day" }, - { wxDateSpan::Week(), "week" }, - { wxDateSpan::Month(), "month" }, - { wxDateSpan::Year(), "year" }, - { wxDateSpan(1, 2, 3, 4), "year, 2 months, 3 weeks, 4 days" }, + ArithmData(wxDateSpan::Day(), "day"), + ArithmData(wxDateSpan::Week(), "week"), + ArithmData(wxDateSpan::Month(), "month"), + ArithmData(wxDateSpan::Year(), "year"), + ArithmData(wxDateSpan(1, 2, 3, 4), "year, 2 months, 3 weeks, 4 days"), }; wxDateTime dt(29, wxDateTime::Dec, 1999), dt1, dt2; @@ -1915,6 +2581,23 @@ static void TestTimeHolidays() puts(""); } +static void TestTimeZoneBug() +{ + puts("\n*** testing for DST/timezone bug ***\n"); + + wxDateTime date = wxDateTime(1, wxDateTime::Mar, 2000); + for ( int i = 0; i < 31; i++ ) + { + printf("Date %s: week day %s.\n", + date.Format(_T("%d-%m-%Y")).c_str(), + date.GetWeekDayName(date.GetWeekDay()).c_str()); + + date += wxDateSpan::Day(); + } + + puts(""); +} + #if 0 // test compatibility with the old wxDate/wxTime classes @@ -2191,7 +2874,7 @@ void TestThreadDelete() #ifdef TEST_ARRAYS -void PrintArray(const char* name, const wxArrayString& array) +static void PrintArray(const char* name, const wxArrayString& array) { printf("Dump of the array '%s'\n", name); @@ -2202,6 +2885,44 @@ void PrintArray(const char* name, const wxArrayString& array) } } +static int StringLenCompare(const wxString& first, const wxString& second) +{ + return first.length() - second.length(); +} + +#include "wx/dynarray.h" + +WX_DECLARE_OBJARRAY(Bar, ArrayBars); +#include "wx/arrimpl.cpp" +WX_DEFINE_OBJARRAY(ArrayBars); + +static void TestArrayOfObjects() +{ + puts("*** Testing wxObjArray ***\n"); + + { + ArrayBars bars; + Bar bar("second bar"); + + printf("Initially: %u objects in the array, %u objects total.\n", + bars.GetCount(), Bar::GetNumber()); + + bars.Add(new Bar("first bar")); + bars.Add(bar); + + printf("Now: %u objects in the array, %u objects total.\n", + bars.GetCount(), Bar::GetNumber()); + + bars.Empty(); + + printf("After Empty(): %u objects in the array, %u objects total.\n", + bars.GetCount(), Bar::GetNumber()); + } + + printf("Finally: no more objects in the array, %u objects total.\n", + Bar::GetNumber()); +} + #endif // TEST_ARRAYS // ---------------------------------------------------------------------------- @@ -2306,6 +3027,32 @@ static void TestStringSub() printf("substr(3, 5) = '%s'\n", s.substr(3, 5).c_str()); printf("substr(3) = '%s'\n", s.substr(3).c_str()); + static const wxChar *prefixes[] = + { + _T("Hello"), + _T("Hello, "), + _T("Hello, world!"), + _T("Hello, world!!!"), + _T(""), + _T("Goodbye"), + _T("Hi"), + }; + + for ( size_t n = 0; n < WXSIZEOF(prefixes); n++ ) + { + wxString prefix = prefixes[n], rest; + bool rc = s.StartsWith(prefix, &rest); + printf("StartsWith('%s') = %s", prefix.c_str(), rc ? "TRUE" : "FALSE"); + if ( rc ) + { + printf(" (the rest is '%s')\n", rest.c_str()); + } + else + { + putchar('\n'); + } + } + puts(""); } @@ -2429,7 +3176,7 @@ static void TestStringTokenizer() } // if we emulate strtok(), check that we do it correctly - wxChar *buf, *s, *last; + wxChar *buf, *s = NULL, *last; if ( tkz.GetMode() == wxTOKEN_STRTOK ) { @@ -2484,6 +3231,49 @@ static void TestStringTokenizer() puts(""); } +static void TestStringReplace() +{ + puts("*** Testing wxString::replace ***"); + + static const struct StringReplaceTestData + { + const wxChar *original; // original test string + size_t start, len; // the part to replace + const wxChar *replacement; // the replacement string + const wxChar *result; // and the expected result + } stringReplaceTestData[] = + { + { _T("012-AWORD-XYZ"), 4, 5, _T("BWORD"), _T("012-BWORD-XYZ") }, + { _T("increase"), 0, 2, _T("de"), _T("decrease") }, + { _T("wxWindow"), 8, 0, _T("s"), _T("wxWindows") }, + { _T("foobar"), 3, 0, _T("-"), _T("foo-bar") }, + { _T("barfoo"), 0, 6, _T("foobar"), _T("foobar") }, + }; + + for ( size_t n = 0; n < WXSIZEOF(stringReplaceTestData); n++ ) + { + const StringReplaceTestData data = stringReplaceTestData[n]; + + wxString original = data.original; + original.replace(data.start, data.len, data.replacement); + + wxPrintf(_T("wxString(\"%s\").replace(%u, %u, %s) = %s "), + data.original, data.start, data.len, data.replacement, + original.c_str()); + + if ( original == data.result ) + { + puts("(ok)"); + } + else + { + wxPrintf(_T("(ERROR: should be '%s')\n"), data.result); + } + } + + puts(""); +} + #endif // TEST_STRINGS // ---------------------------------------------------------------------------- @@ -2521,6 +3311,10 @@ int main(int argc, char **argv) wxCmdLineParser parser(cmdLineDesc, argc, argv); + parser.AddOption("project_name", "", "full path to project file", + wxCMD_LINE_VAL_STRING, + wxCMD_LINE_OPTION_MANDATORY | wxCMD_LINE_NEEDS_SEPARATOR); + switch ( parser.Parse() ) { case -1: @@ -2543,13 +3337,14 @@ int main(int argc, char **argv) TestPChar(); TestString(); } + TestStringSub(); if ( 0 ) { TestStringConstruction(); - TestStringSub(); TestStringFormat(); TestStringFind(); TestStringTokenizer(); + TestStringReplace(); } #endif // TEST_STRINGS @@ -2583,12 +3378,30 @@ int main(int argc, char **argv) a3 = a2 = a1; PrintArray("a2", a2); PrintArray("a3", a3); + + puts("*** After sorting a1"); + a1.Sort(); + PrintArray("a1", a1); + + puts("*** After sorting a1 in reverse order"); + a1.Sort(TRUE); + PrintArray("a1", a1); + + puts("*** After sorting a1 by the string length"); + a1.Sort(StringLenCompare); + PrintArray("a1", a1); + + TestArrayOfObjects(); #endif // TEST_ARRAYS #ifdef TEST_DIR TestDirEnum(); #endif // TEST_DIR +#ifdef TEST_DLLLOADER + TestDllLoad(); +#endif // TEST_DLLLOADER + #ifdef TEST_EXECUTE TestExecute(); #endif // TEST_EXECUTE @@ -2597,6 +3410,10 @@ int main(int argc, char **argv) TestFileConfRead(); #endif // TEST_FILECONF +#ifdef TEST_LIST + TestListCtor(); +#endif // TEST_LIST + #ifdef TEST_LOG wxString s; for ( size_t n = 0; n < 8000; n++ ) @@ -2616,6 +3433,11 @@ int main(int argc, char **argv) wxLogMessage("A very very long message 2: '%s', the end!", s.c_str()); #endif // TEST_LOG +#ifdef TEST_FILE + TestFileRead(); + TestTextFileRead(); +#endif // TEST_FILE + #ifdef TEST_THREADS int nCPUs = wxThread::GetCPUCount(); printf("This system has %d CPUs\n", nCPUs); @@ -2644,14 +3466,15 @@ int main(int argc, char **argv) { TestSpeed(); } - TestMultiplication(); if ( 0 ) { + TestMultiplication(); TestDivision(); TestAddition(); TestLongLongConversion(); TestBitOperations(); } + TestLongLongComparison(); #endif // TEST_LONGLONG #ifdef TEST_HASH @@ -2659,7 +3482,11 @@ int main(int argc, char **argv) #endif // TEST_HASH #ifdef TEST_MIME - TestMimeEnum(); + wxLog::AddTraceMask(_T("mime")); + if ( 0 ) + TestMimeEnum(); + TestMimeOverride(); + TestMimeFilename(); #endif // TEST_MIME #ifdef TEST_INFO_FUNCTIONS @@ -2668,13 +3495,13 @@ int main(int argc, char **argv) #endif // TEST_INFO_FUNCTIONS #ifdef TEST_SOCKETS - if ( 1 ) - TestSocketServer(); if ( 0 ) { + TestSocketServer(); TestSocketClient(); TestProtocolFtp(); } + TestProtocolFtpUpload(); #endif // TEST_SOCKETS #ifdef TEST_TIMER @@ -2694,15 +3521,33 @@ int main(int argc, char **argv) TestTimeWDays(); TestTimeWNumber(); TestTimeParse(); - TestTimeFormat(); TestTimeArithmetics(); + TestTimeHolidays(); + TestTimeFormat(); + + TestTimeZoneBug(); } - TestTimeHolidays(); + TestTimeMS(); if ( 0 ) TestInteractive(); #endif // TEST_DATETIME +#ifdef TEST_VCARD + if ( 0 ) + TestVCardRead(); + TestVCardWrite(); +#endif // TEST_VCARD + +#ifdef TEST_WCHAR + TestUtf8(); +#endif // TEST_WCHAR + +#ifdef TEST_ZIP + TestZipStreamRead(); +#endif // TEST_ZIP + wxUninitialize(); return 0; } + diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 7255bc38bc..5f623ff4cc 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -88,6 +88,8 @@ public: void OnChoice( wxCommandEvent &event ); void OnChoiceButtons( wxCommandEvent &event ); void OnCombo( wxCommandEvent &event ); + void OnComboTextChanged( wxCommandEvent &event ); + void OnComboTextEnter( wxCommandEvent &event ); void OnComboButtons( wxCommandEvent &event ); void OnRadio( wxCommandEvent &event ); void OnRadioButtons( wxCommandEvent &event ); @@ -183,6 +185,96 @@ private: DECLARE_EVENT_TABLE() }; +// a button which intercepts double clicks (for testing...) +class MyButton : public wxButton +{ +public: + MyButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize) + : wxButton(parent, id, label, pos, size) + { + } + + void OnDClick(wxMouseEvent& event) + { + wxLogMessage(_T("MyButton::OnDClick")); + + event.Skip(); + } + +private: + DECLARE_EVENT_TABLE() +}; + +// a combo which intercepts chars (to test Windows behaviour) +class MyComboBox : public wxComboBox +{ +public: + MyComboBox(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxComboBox(parent, id, value, pos, size, n, choices, style, + validator, name) { } + +protected: + void OnChar(wxKeyEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnKeyUp(wxKeyEvent& event); + void OnFocusGot(wxFocusEvent& event) + { + wxLogMessage(_T("MyComboBox::OnFocusGot")); + + event.Skip(); + } + +private: + DECLARE_EVENT_TABLE() +}; + +// a radiobox which handles focus set/kill (for testing) +class MyRadioBox : public wxRadioBox +{ +public: + MyRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 1, + long style = wxRA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxRadioBox(parent, id, title, pos, size, n, choices, majorDim, + style, validator, name) { } + +protected: + void OnFocusGot(wxFocusEvent& event) + { + wxLogMessage(_T("MyRadioBox::OnFocusGot")); + + event.Skip(); + } + + void OnFocusLost(wxFocusEvent& event) + { + wxLogMessage(_T("MyRadioBox::OnFocusLost")); + + event.Skip(); + } + +private: + DECLARE_EVENT_TABLE() +}; + //---------------------------------------------------------------------- // other //---------------------------------------------------------------------- @@ -356,6 +448,8 @@ EVT_BUTTON (ID_CHOICE_DELETE, MyPanel::OnChoiceButtons) EVT_BUTTON (ID_CHOICE_FONT, MyPanel::OnChoiceButtons) EVT_CHECKBOX (ID_CHOICE_ENABLE, MyPanel::OnChoiceButtons) EVT_COMBOBOX (ID_COMBO, MyPanel::OnCombo) +EVT_TEXT (ID_COMBO, MyPanel::OnComboTextChanged) +EVT_TEXT_ENTER(ID_COMBO, MyPanel::OnComboTextEnter) EVT_BUTTON (ID_COMBO_SEL_NUM, MyPanel::OnComboButtons) EVT_BUTTON (ID_COMBO_SEL_STR, MyPanel::OnComboButtons) EVT_BUTTON (ID_COMBO_CLEAR, MyPanel::OnComboButtons) @@ -387,6 +481,27 @@ EVT_BUTTON (ID_BUTTON_TEST2, MyPanel::OnTestButton) EVT_BUTTON (ID_BITMAP_BTN, MyPanel::OnBmpButton) END_EVENT_TABLE() +BEGIN_EVENT_TABLE(MyButton, wxButton) + EVT_LEFT_DCLICK(MyButton::OnDClick) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(MyComboBox, wxComboBox) + EVT_CHAR(MyComboBox::OnChar) + EVT_KEY_DOWN(MyComboBox::OnKeyDown) + EVT_KEY_UP(MyComboBox::OnKeyUp) + + EVT_SET_FOCUS(MyComboBox::OnFocusGot) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(MyRadioBox, wxRadioBox) + EVT_SET_FOCUS(MyRadioBox::OnFocusGot) + EVT_KILL_FOCUS(MyRadioBox::OnFocusLost) +END_EVENT_TABLE() + +// ============================================================================ +// implementation +// ============================================================================ + MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ), m_text(NULL), m_notebook(NULL) @@ -485,9 +600,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_lbSelectNum = new wxButton( panel, ID_LISTBOX_SEL_NUM, "Select #&2", wxPoint(180,30), wxSize(140,30) ); m_lbSelectThis = new wxButton( panel, ID_LISTBOX_SEL_STR, "&Select 'This'", wxPoint(340,30), wxSize(140,30) ); (void)new wxButton( panel, ID_LISTBOX_CLEAR, "&Clear", wxPoint(180,80), wxSize(140,30) ); - (void)new wxButton( panel, ID_LISTBOX_APPEND, "&Append 'Hi!'", wxPoint(340,80), wxSize(140,30) ); + (void)new MyButton( panel, ID_LISTBOX_APPEND, "&Append 'Hi!'", wxPoint(340,80), wxSize(140,30) ); (void)new wxButton( panel, ID_LISTBOX_DELETE, "D&elete selected item", wxPoint(180,130), wxSize(140,30) ); - wxButton *button = new wxButton( panel, ID_LISTBOX_FONT, "Set &Italic font", wxPoint(340,130), wxSize(140,30) ); + wxButton *button = new MyButton( panel, ID_LISTBOX_FONT, "Set &Italic font", wxPoint(340,130), wxSize(140,30) ); button->SetDefault(); @@ -512,10 +627,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,-1), 5, choices, wxCB_SORT ); -#ifndef __WXMOTIF__ SetControlClientData("choice", m_choice); SetControlClientData("choice", m_choiceSorted); -#endif m_choice->SetSelection(2); m_choice->SetBackgroundColour( "red" ); @@ -532,7 +645,11 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) panel = new wxPanel(m_notebook); (void)new wxStaticBox( panel, -1, "&Box around combobox", wxPoint(5, 5), wxSize(150, 100)); - m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(20,25), wxSize(120,-1), 5, choices, wxCB_READONLY ); + m_combo = new MyComboBox( panel, ID_COMBO, "This", + wxPoint(20,25), wxSize(120, -1), + 5, choices, + /* wxCB_READONLY | */ wxPROCESS_ENTER); + (void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #&2", wxPoint(180,30), wxSize(140,30) ); (void)new wxButton( panel, ID_COMBO_SEL_STR, "&Select 'This'", wxPoint(340,30), wxSize(140,30) ); (void)new wxButton( panel, ID_COMBO_CLEAR, "&Clear", wxPoint(180,80), wxSize(140,30) ); @@ -551,7 +668,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) }; panel = new wxPanel(m_notebook); - (void)new wxRadioBox( panel, ID_RADIOBOX, "&That", wxPoint(10,160), wxSize(-1,-1), WXSIZEOF(choices2), choices2, 1, wxRA_SPECIFY_ROWS ); + (void)new MyRadioBox( panel, ID_RADIOBOX, "&That", wxPoint(10,160), wxSize(-1,-1), WXSIZEOF(choices2), choices2, 1, wxRA_SPECIFY_ROWS ); m_radio = new wxRadioBox( panel, ID_RADIOBOX, "T&his", wxPoint(10,10), wxSize(-1,-1), WXSIZEOF(choices), choices, 1, wxRA_SPECIFY_COLS ); #if wxUSE_TOOLTIPS @@ -571,7 +688,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) panel = new wxPanel(m_notebook); (void)new wxStaticBox( panel, -1, "&wxGauge and wxSlider", wxPoint(10,10), wxSize(200,130) ); - m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155, 30) ); + m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155, 30), wxGA_HORIZONTAL|wxNO_BORDER ); + m_gauge->SetBackgroundColour(*wxGREEN); + m_gauge->SetForegroundColour(*wxRED); m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1), wxSL_LABELS ); (void)new wxStaticBox( panel, -1, "&Explanation", wxPoint(220,10), wxSize(270,130) ); #ifdef __WXMOTIF__ @@ -662,7 +781,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxButton(panel, ID_BUTTON_LABEL, "&Toggle label", wxPoint(250, 20)); m_label = new wxStaticText(panel, -1, "Label with some long text", wxPoint(250, 60), wxDefaultSize, - wxALIGN_RIGHT | wxST_NO_AUTORESIZE); + wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/); m_label->SetForegroundColour( *wxBLUE ); m_notebook->AddPage(panel, "wxBitmapXXX"); @@ -727,7 +846,7 @@ void MyPanel::OnPageChanging( wxNotebookEvent &event ) "page change from taking place - if you select\n" "[No] the current page will stay the third one\n", "Control sample", - wxICON_QUESTION | wxYES_NO) != wxYES ) + wxICON_QUESTION | wxYES_NO, this) != wxYES ) { event.Veto(); @@ -875,9 +994,11 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event ) { int idx; idx = m_listbox->GetSelection(); - m_listbox->Delete( idx ); + if ( idx != wxNOT_FOUND ) + m_listbox->Delete( idx ); idx = m_listboxSorted->GetSelection(); - m_listboxSorted->Delete( idx ); + if ( idx != wxNOT_FOUND ) + m_listboxSorted->Delete( idx ); break; } case ID_LISTBOX_FONT: @@ -958,9 +1079,11 @@ void MyPanel::OnChoiceButtons( wxCommandEvent &event ) case ID_CHOICE_DELETE: { int idx = m_choice->GetSelection(); - m_choice->Delete( idx ); + if ( idx != wxNOT_FOUND ) + m_choice->Delete( idx ); idx = m_choiceSorted->GetSelection(); - m_choiceSorted->Delete( idx ); + if ( idx != wxNOT_FOUND ) + m_choiceSorted->Delete( idx ); break; } case ID_CHOICE_FONT: @@ -982,6 +1105,18 @@ void MyPanel::OnCombo( wxCommandEvent &event ) m_text->AppendText( "\n" ); } +void MyPanel::OnComboTextChanged(wxCommandEvent& WXUNUSED(event)) +{ + wxLogMessage(_T("Text in the combobox changed: now is '%s'."), + m_combo->GetValue().c_str()); +} + +void MyPanel::OnComboTextEnter(wxCommandEvent& WXUNUSED(event)) +{ + wxLogMessage(_T("Enter pressed in the combobox: value is '%s'."), + m_combo->GetValue().c_str()); +} + void MyPanel::OnComboButtons( wxCommandEvent &event ) { switch (event.GetId()) @@ -1070,7 +1205,7 @@ void MyPanel::OnUpdateLabel( wxCommandEvent &WXUNUSED(event) ) static bool s_long = TRUE; s_long = !s_long; - m_label->SetLabel(s_long ? "very very very long text" : "shorter text"); + m_label->SetLabel(s_long ? "Very very very very very long text." : "Shorter text."); } void MyPanel::OnSliderUpdate( wxCommandEvent &WXUNUSED(event) ) @@ -1323,6 +1458,33 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) } } +void MyComboBox::OnChar(wxKeyEvent& event) +{ + wxLogMessage(_T("MyComboBox::OnChar")); + + if ( event.KeyCode() == 'w' ) + wxLogMessage(_T("MyComboBox: 'w' will be ignored.")); + else + event.Skip(); +} + +void MyComboBox::OnKeyDown(wxKeyEvent& event) +{ + wxLogMessage(_T("MyComboBox::OnKeyDown")); + + if ( event.KeyCode() == 'w' ) + wxLogMessage(_T("MyComboBox: 'w' will be ignored.")); + else + event.Skip(); +} + +void MyComboBox::OnKeyUp(wxKeyEvent& event) +{ + wxLogMessage(_T("MyComboBox::OnKeyUp")); + + event.Skip(); +} + static void SetControlClientData(const char *name, wxControlWithItems *control) { diff --git a/samples/db/dbtest.cpp b/samples/db/dbtest.cpp index f9cb9c0835..1b5522ec68 100644 --- a/samples/db/dbtest.cpp +++ b/samples/db/dbtest.cpp @@ -16,7 +16,7 @@ donated by the development team at Remstar International. The table this sample is based on is developer contact table, and shows - some of the simple uses of the database classes wxDB and wxTable. + some of the simple uses of the database classes wxDb and wxDbTable. * SYNOPSIS END */ @@ -42,7 +42,7 @@ #include <stdio.h> /* Included strictly for reading the text file with the database parameters */ #include <wx/db.h> /* Required in the file which will get the data source connection */ -#include <wx/dbtable.h> /* Has the wxTable object from which all data objects will inherit their data table functionality */ +#include <wx/dbtable.h> /* Has the wxDbTable object from which all data objects will inherit their data table functionality */ extern wxDbList WXDLLEXPORT *PtrBegDbList; /* from db.cpp, used in getting back error results from db connections */ @@ -61,23 +61,23 @@ DatabaseDemoFrame *DemoFrame; /* Pointer to the main frame */ * for user login names and passwords, getting workstation settings, etc. * ---> IMPORTANT <--- * - * For each database object created which uses this wxDB pointer + * For each database object created which uses this wxDb pointer * connection to the database, when a CommitTrans() or RollBackTrans() - * will commit or rollback EVERY object which uses this wxDB pointer. + * will commit or rollback EVERY object which uses this wxDb pointer. * - * To allow each table object (those derived from wxTable) to be + * To allow each table object (those derived from wxDbTable) to be * individually committed or rolled back, you MUST use a different - * instance of wxDB in the constructor of the table. Doing so creates + * instance of wxDb in the constructor of the table. Doing so creates * more overhead, and will use more database connections (some DBs have * connection limits...), so use connections sparringly. * * It is recommended that one "main" database connection be created for * the entire program to use for READ-ONLY database accesses, but for each * table object which will do a CommitTrans() or RollbackTrans() that a - * new wxDB object be created and used for it. + * new wxDb object be created and used for it. */ -wxDB *READONLY_DB; +wxDb *READONLY_DB; /* * This function will return the exact string(s) from the database engine @@ -103,7 +103,7 @@ char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine) msg += ErrFile; msg += " Line: "; tStr.Printf("%d",ErrLine); - msg += tStr.GetData(); + msg += tStr.c_str(); msg += "\n"; } @@ -125,7 +125,7 @@ char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine) if (pDbList->PtrDb->errorList[i]) { msg.Append(pDbList->PtrDb->errorList[i]); - if (strcmp(pDbList->PtrDb->errorList[i],"") != 0) + if (wxStrcmp(pDbList->PtrDb->errorList[i],"") != 0) msg.Append("\n"); } } @@ -187,37 +187,37 @@ bool DatabaseDemoApp::OnInit() char buffer[1000+1]; fgets(buffer, sizeof(params.ODBCSource), paramFile); - buffer[strlen(buffer)-1] = '\0'; - strcpy(params.ODBCSource,buffer); + buffer[wxStrlen(buffer)-1] = '\0'; + wxStrcpy(params.ODBCSource,buffer); fgets(buffer, sizeof(params.UserName), paramFile); - buffer[strlen(buffer)-1] = '\0'; - strcpy(params.UserName,buffer); + buffer[wxStrlen(buffer)-1] = '\0'; + wxStrcpy(params.UserName,buffer); fgets(buffer, sizeof(params.Password), paramFile); - buffer[strlen(buffer)-1] = '\0'; - strcpy(params.Password,buffer); + buffer[wxStrlen(buffer)-1] = '\0'; + wxStrcpy(params.Password,buffer); fgets(buffer, sizeof(params.DirPath), paramFile); - buffer[strlen(buffer)-1] = '\0'; - strcpy(params.DirPath,buffer); + buffer[wxStrlen(buffer)-1] = '\0'; + wxStrcpy(params.DirPath,buffer); fclose(paramFile); // Connect to datasource - strcpy(DbConnectInf.Dsn, params.ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT) - strcpy(DbConnectInf.Uid, params.UserName); // database username - must already exist in the data source - strcpy(DbConnectInf.AuthStr, params.Password); // password database username - strcpy(DbConnectInf.defaultDir, params.DirPath); // path where the table exists (needed for dBase) + wxStrcpy(DbConnectInf.Dsn, params.ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT) + wxStrcpy(DbConnectInf.Uid, params.UserName); // database username - must already exist in the data source + wxStrcpy(DbConnectInf.AuthStr, params.Password); // password database username + wxStrcpy(DbConnectInf.defaultDir, params.DirPath); // path where the table exists (needed for dBase) READONLY_DB = wxDbGetConnection(&DbConnectInf); if (READONLY_DB == 0) { wxMessageBox("Unable to connect to the data source.\n\nCheck the name of your data source to verify it has been correctly entered/spelled.\n\nWith some databases, the user name and password must\nbe created with full rights to the CONTACT table prior to making a connection\n(using tools provided by the database manufacturer)", "DB CONNECTION ERROR...",wxOK | wxICON_EXCLAMATION); DemoFrame->BuildParameterDialog(NULL); - strcpy(DbConnectInf.Dsn, ""); - strcpy(DbConnectInf.Uid, ""); - strcpy(DbConnectInf.AuthStr, ""); + wxStrcpy(DbConnectInf.Dsn, ""); + wxStrcpy(DbConnectInf.Uid, ""); + wxStrcpy(DbConnectInf.AuthStr, ""); wxMessageBox("Now exiting program.\n\nRestart program to try any new settings.","Notice...",wxOK | wxICON_INFORMATION); return(FALSE); } @@ -278,7 +278,13 @@ void DatabaseDemoFrame::OnCloseWindow(wxCloseEvent& event) if (pEditorDlg->Close()) pEditorDlg = NULL; else + { event.Veto(); + return; + } + + // Cleans up the environment space allocated for the SQL/ODBC connection handle + SQLFreeEnv(DbConnectInf.Henv); this->Destroy(); @@ -353,24 +359,24 @@ void DatabaseDemoFrame::BuildParameterDialog(wxWindow *parent) /* - * Constructor note: If no wxDB object is passed in, a new connection to the database + * Constructor note: If no wxDb object is passed in, a new connection to the database * is created for this instance of Ccontact. This can be a slow process depending * on the database engine being used, and some database engines have a limit on the * number of connections (either hard limits, or license restricted) so care should * be used to use as few connections as is necessary. * - * IMPORTANT: Objects which share a wxDB pointer are ALL acted upon whenever a member + * IMPORTANT: Objects which share a wxDb pointer are ALL acted upon whenever a member * function of pDb is called (i.e. CommitTrans() or RollbackTrans(), so if modifying * or creating a table objects which use the same pDb, know that all the objects * will be committed or rolled back when any of the objects has this function call made. */ -Ccontact::Ccontact (wxDB *pwxDB) : wxTable(pwxDB ? pwxDB : wxDbGetConnection(&DbConnectInf),CONTACT_TABLE_NAME,CONTACT_NO_COLS,NULL,!QUERY_ONLY,DbConnectInf.defaultDir) +Ccontact::Ccontact (wxDb *pwxDb) : wxDbTable(pwxDb ? pwxDb : wxDbGetConnection(&DbConnectInf),CONTACT_TABLE_NAME,CONTACT_NO_COLS,NULL,!wxDB_QUERY_ONLY,DbConnectInf.defaultDir) { // This is used to represent whether the database connection should be released // when this instance of the object is deleted. If using the same connection // for multiple instance of database objects, then the connection should only be // released when the last database instance using the connection is deleted - freeDbConn = !pwxDB; + freeDbConn = !pwxDb; SetupColumns(); @@ -404,7 +410,7 @@ Ccontact::~Ccontact() { if (freeDbConn) { - if (!wxDbFreeConnection(pDb)) + if (!wxDbFreeConnection(GetDb())) { wxString tStr; tStr = "Unable to Free the Ccontact data table handle\n\n"; @@ -416,7 +422,7 @@ Ccontact::~Ccontact() /* - * Handles setting up all the connections for the interface from the wxTable + * Handles setting up all the connections for the interface from the wxDbTable * functions to interface to the data structure used to store records in * memory, and for all the column definitions that define the table structure */ @@ -444,19 +450,19 @@ bool Ccontact::CreateIndexes(void) // This index could easily be accomplished with an "orderBy" clause, // but is done to show how to construct a non-primary index. wxString indexName; - CidxDef idxDef[2]; + wxDbIdxDef idxDef[2]; bool Ok = TRUE; - strcpy(idxDef[0].ColName, "IS_DEV"); + wxStrcpy(idxDef[0].ColName, "IS_DEV"); idxDef[0].Ascending = TRUE; - strcpy(idxDef[1].ColName, "NAME"); + wxStrcpy(idxDef[1].ColName, "NAME"); idxDef[1].Ascending = TRUE; - indexName = CONTACT_TABLE_NAME; + indexName = GetTableName(); indexName += "_IDX1"; - Ok = CreateIndex((char*) (const char*) indexName, TRUE, 2, idxDef); + Ok = CreateIndex(indexName.c_str(), TRUE, 2, idxDef); return Ok; } // Ccontact::CreateIndexes() @@ -470,8 +476,8 @@ bool Ccontact::CreateIndexes(void) bool Ccontact::FetchByName(char *name) { whereStr.Printf("NAME = '%s'",name); - where = (char*) (const char*) this->whereStr; - orderBy = 0; + SetWhereClause(whereStr.c_str()); + SetOrderByClause(""); if (!Query()) return(FALSE); @@ -523,7 +529,7 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 1, 1, 460, 455) // Check if the table exists or not. If it doesn't, ask the user if they want to // create the table. Continue trying to create the table until it exists, or user aborts - while (!Contact->pDb->TableExists((char *)CONTACT_TABLE_NAME,DbConnectInf.Uid,DbConnectInf.defaultDir)) + while (!Contact->GetDb()->TableExists((char *)CONTACT_TABLE_NAME,DbConnectInf.Uid,DbConnectInf.defaultDir)) { wxString tStr; tStr.Printf("Unable to open the table '%s'.\n\nTable may need to be created...?\n\n",CONTACT_TABLE_NAME); @@ -549,7 +555,7 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 1, 1, 460, 455) // Table does exist, there was some problem opening it. Currently this should // never fail, except in the case of the table not exisiting. Open() basically // only sets up variable/pointer values, other than checking for table existence. - if (Contact->pDb->TableExists((char *)CONTACT_TABLE_NAME)) + if (Contact->GetDb()->TableExists((char *)CONTACT_TABLE_NAME)) { wxString tStr; tStr.Printf("Unable to open the table '%s'.\n\n",CONTACT_TABLE_NAME); @@ -622,24 +628,24 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 1, 1, 460, 455) // as there will only be one record being shown on the dialog at a time, this optimizes // network traffic by only returning a one row result - Contact->orderBy = "NAME"; // field name to sort by + Contact->SetOrderByClause("NAME"); // field name to sort by - // The wxString "whereStr" is not a member of the wxTable object, it is a member variable + // The wxString "whereStr" is not a member of the wxDbTable object, it is a member variable // specifically in the Ccontact class. It is used here for simpler construction of a varying - // length string, and then after the string is built, the wxTable member variable "where" is + // length string, and then after the string is built, the wxDbTable member variable "where" is // assigned the pointer to the constructed string. // // The constructed where clause below has a sub-query within it "SELECT MIN(NAME) FROM %s" // to achieve a single row (in this case the first name in alphabetical order). - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { - Contact->whereStr.sprintf("NAME = (SELECT MIN(NAME) FROM %s)",Contact->tableName); + Contact->whereStr.sprintf("NAME = (SELECT MIN(NAME) FROM %s)",Contact->GetTableName()); // NOTE: (const char*) returns a pointer which may not be valid later, so this is short term use only - Contact->where = (char*) (const char*) Contact->whereStr; + Contact->SetWhereClause(Contact->whereStr.c_str()); } else - Contact->where = 0; + Contact->SetWhereClause(""); // Perform the Query to get the result set. // NOTE: If there are no rows returned, that is a valid result, so Query() would return TRUE. @@ -743,7 +749,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) // of Ccontact is deleted. If the Commit wasn't performed, the // database will automatically Rollback the changes when the database // connection is terminated - Contact->pDb->CommitTrans(); + Contact->GetDb()->CommitTrans(); // Try to get the row that followed the just deleted row in the orderBy sequence if (!GetNextRec()) @@ -761,7 +767,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) } else // Delete failed - Contact->pDb->RollbackTrans(); + Contact->GetDb()->RollbackTrans(); SetMode(mView); return; @@ -780,7 +786,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) if (!Ok) return; - if (!strcmp((const char*) saveName,"")) + if (!wxStrcmp((const char*) saveName,"")) { Contact->Initialize(); PutData(); @@ -799,15 +805,15 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) } // Previous record not available, retrieve first record in table - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; - Contact->whereStr += Contact->tableName; + Contact->whereStr += Contact->GetTableName(); Contact->whereStr += ")"; - Contact->where = (char*) (const char*) Contact->whereStr; + Contact->SetWhereClause(Contact->whereStr.c_str()); } else - Contact->where = 0; + Contact->SetWhereClause(""); if (!Contact->Query()) { @@ -849,19 +855,19 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) { // Display the query dialog box char qryWhere[DB_MAX_WHERE_CLAUSE_LEN+1]; - strcpy(qryWhere, (const char*) Contact->qryWhereStr); + wxStrcpy(qryWhere, (const char*) Contact->qryWhereStr); char *tblName[] = {(char *)CONTACT_TABLE_NAME, 0}; - new CqueryDlg(GetParent(), Contact->pDb, tblName, qryWhere); + new CqueryDlg(GetParent(), Contact->GetDb(), tblName, qryWhere); // Query the first record in the new record set and // display it, if the query string has changed. - if (strcmp(qryWhere, (const char*) Contact->qryWhereStr)) + if (wxStrcmp(qryWhere, (const char*) Contact->qryWhereStr)) { Contact->whereStr = ""; - Contact->orderBy = "NAME"; + Contact->SetOrderByClause("NAME"); - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; Contact->whereStr += CONTACT_TABLE_NAME; @@ -869,7 +875,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) // Append the query where string (if there is one) Contact->qryWhereStr = qryWhere; - if (strlen(qryWhere)) + if (wxStrlen(qryWhere)) { Contact->whereStr += " WHERE "; Contact->whereStr += Contact->qryWhereStr; @@ -877,7 +883,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) // Close the expression with a right paren Contact->whereStr += ")"; // Requery the table - Contact->where = (char*) (const char*) Contact->whereStr; + Contact->SetWhereClause(Contact->whereStr.c_str()); if (!Contact->Query()) { wxString tStr; @@ -903,16 +909,16 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) { // Clear the additional where criteria established by the query feature Contact->qryWhereStr = ""; - Contact->orderBy = "NAME"; + Contact->SetOrderByClause("NAME"); - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; Contact->whereStr += CONTACT_TABLE_NAME; Contact->whereStr += ")"; } - Contact->where = (char*) (const char*) Contact->whereStr; + Contact->SetWhereClause(Contact->whereStr.c_str()); if (!Contact->Query()) { wxString tStr; @@ -941,7 +947,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) /* char *orderBy */ "NAME", /* bool distinctValues */ TRUE); - if (ListDB_Selection && strlen(ListDB_Selection)) + if (ListDB_Selection && wxStrlen(ListDB_Selection)) { wxString w = "NAME = '"; w += ListDB_Selection; @@ -996,9 +1002,9 @@ void CeditorDlg::SetMode(enum DialogModes m) if (widgetPtrsSet) { pCreateBtn->Enable( !edit ); - pEditBtn->Enable( !edit && (strcmp(Contact->Name,"")!=0) ); - pDeleteBtn->Enable( !edit && (strcmp(Contact->Name,"")!=0) ); - pCopyBtn->Enable( !edit && (strcmp(Contact->Name,"")!=0) ); + pEditBtn->Enable( !edit && (wxStrcmp(Contact->Name,"")!=0) ); + pDeleteBtn->Enable( !edit && (wxStrcmp(Contact->Name,"")!=0) ); + pCopyBtn->Enable( !edit && (wxStrcmp(Contact->Name,"")!=0) ); pSaveBtn->Enable( edit ); pCancelBtn->Enable( edit ); pPrevBtn->Enable( !edit ); @@ -1055,7 +1061,7 @@ bool CeditorDlg::GetData() wxString tStr; tStr = pNameTxt->GetValue(); - if (!strcmp((const char*) tStr,"")) + if (!wxStrcmp((const char*) tStr,"")) { wxMessageBox("A name is required for entry into the contact table","Notice...",wxOK | wxICON_INFORMATION); return FALSE; @@ -1127,13 +1133,13 @@ bool CeditorDlg::GetData() } tStr = pNameTxt->GetValue(); - strcpy(Contact->Name,(const char*) tStr); - strcpy(Contact->Addr1,pAddress1Txt->GetValue()); - strcpy(Contact->Addr2,pAddress2Txt->GetValue()); - strcpy(Contact->City,pCityTxt->GetValue()); - strcpy(Contact->State,pStateTxt->GetValue()); - strcpy(Contact->Country,pCountryTxt->GetValue()); - strcpy(Contact->PostalCode,pPostalCodeTxt->GetValue()); + wxStrcpy(Contact->Name,(const char*) tStr); + wxStrcpy(Contact->Addr1,pAddress1Txt->GetValue()); + wxStrcpy(Contact->Addr2,pAddress2Txt->GetValue()); + wxStrcpy(Contact->City,pCityTxt->GetValue()); + wxStrcpy(Contact->State,pStateTxt->GetValue()); + wxStrcpy(Contact->Country,pCountryTxt->GetValue()); + wxStrcpy(Contact->PostalCode,pPostalCodeTxt->GetValue()); Contact->Contributions = atoi(pContribTxt->GetValue()); Contact->LinesOfCode = atol(pLinesTxt->GetValue()); @@ -1207,11 +1213,11 @@ bool CeditorDlg::Save() if (!failed) { - Contact->pDb->CommitTrans(); + Contact->GetDb()->CommitTrans(); SetMode(mView); // Sets the dialog mode back to viewing after save is successful } else - Contact->pDb->RollbackTrans(); + Contact->GetDb()->RollbackTrans(); wxEndBusyCursor(); } @@ -1229,10 +1235,10 @@ bool CeditorDlg::GetNextRec() { wxString w; - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { w = "NAME = (SELECT MIN(NAME) FROM "; - w += Contact->tableName; + w += Contact->GetTableName(); w += " WHERE NAME > '"; } else @@ -1264,10 +1270,10 @@ bool CeditorDlg::GetPrevRec() { wxString w; - if (Contact->pDb->Dbms() != dbmsPOSTGRES) + if (Contact->GetDb()->Dbms() != dbmsPOSTGRES) { w = "NAME = (SELECT MAX(NAME) FROM "; - w += Contact->tableName; + w += Contact->GetTableName(); w += " WHERE NAME < '"; } else @@ -1297,8 +1303,8 @@ bool CeditorDlg::GetPrevRec() */ bool CeditorDlg::GetRec(char *whereStr) { - Contact->where = whereStr; - Contact->orderBy = "NAME"; + Contact->SetWhereClause(whereStr); + Contact->SetOrderByClause("NAME"); if (!Contact->Query()) { @@ -1452,7 +1458,7 @@ bool CparameterDlg::GetData() wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION); return FALSE; } - strcpy(wxGetApp().params.ODBCSource, tStr); + wxStrcpy(wxGetApp().params.ODBCSource, tStr); } else return FALSE; @@ -1465,7 +1471,7 @@ bool CparameterDlg::GetData() wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION); return FALSE; } - strcpy(wxGetApp().params.UserName, tStr); + wxStrcpy(wxGetApp().params.UserName, tStr); tStr = pParamPasswordTxt->GetValue(); if (tStr.Length() > (sizeof(wxGetApp().params.Password)-1)) @@ -1475,7 +1481,7 @@ bool CparameterDlg::GetData() wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION); return FALSE; } - strcpy(wxGetApp().params.Password,tStr); + wxStrcpy(wxGetApp().params.Password,tStr); tStr = pParamDirPathTxt->GetValue(); tStr.Replace("\\","/"); @@ -1486,7 +1492,7 @@ bool CparameterDlg::GetData() wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION); return FALSE; } - strcpy(wxGetApp().params.DirPath,tStr); + wxStrcpy(wxGetApp().params.DirPath,tStr); return TRUE; } // CparameterDlg::GetData() @@ -1537,7 +1543,7 @@ void CparameterDlg::FillDataSourceList() char **p = strList.ListToArray(); int i; - for (i = 0; strlen(p[i]); i++) + for (i = 0; wxStrlen(p[i]); i++) pParamODBCSourceList->Append(p[i]); } // CparameterDlg::CparameterDlg::FillDataSourceList() @@ -1548,7 +1554,7 @@ BEGIN_EVENT_TABLE(CqueryDlg, wxDialog) END_EVENT_TABLE() // CqueryDlg() constructor -CqueryDlg::CqueryDlg(wxWindow *parent, wxDB *pDb, char *tblName[], char *pWhereArg) : wxDialog (parent, QUERY_DIALOG, "Query", wxPoint(-1, -1), wxSize(480, 360)) +CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereArg) : wxDialog (parent, QUERY_DIALOG, "Query", wxPoint(-1, -1), wxSize(480, 360)) { wxBeginBusyCursor(); @@ -1560,7 +1566,7 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDB *pDb, char *tblName[], char *pWhereA // Initialize the WHERE clause from the string passed in pWhere = pWhereArg; // Save a pointer to the output buffer - if (strlen(pWhere) > DB_MAX_WHERE_CLAUSE_LEN) // Check the length of the buffer passed in + if (wxStrlen(pWhere) > DB_MAX_WHERE_CLAUSE_LEN) // Check the length of the buffer passed in { wxString s; s.Printf("Maximum where clause length exceeded.\nLength must be less than %d", DB_MAX_WHERE_CLAUSE_LEN+1); @@ -1623,11 +1629,11 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDB *pDb, char *tblName[], char *pWhereA } int i; - for (i = 0; colInf[i].colName && strlen(colInf[i].colName); i++) + for (i = 0; colInf[i].colName && wxStrlen(colInf[i].colName); i++) { // If there is more than one table being queried, qualify // the column names with the table name prefix. - if (tblName[1] && strlen(tblName[1])) + if (tblName[1] && wxStrlen(tblName[1])) { qualName.Printf("%s.%s", colInf[i].tableName, colInf[i].colName); pQueryCol1Choice->Append(qualName); @@ -1842,7 +1848,7 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event) if (widgetName == pQueryDoneBtn->GetName()) { // Be sure the where clause will not overflow the output buffer - if (strlen(pQuerySqlWhereMtxt->GetValue()) > DB_MAX_WHERE_CLAUSE_LEN) + if (wxStrlen(pQuerySqlWhereMtxt->GetValue()) > DB_MAX_WHERE_CLAUSE_LEN) { wxString s; s.Printf("Maximum where clause length exceeded.\nLength must be less than %d", DB_MAX_WHERE_CLAUSE_LEN+1); @@ -1853,7 +1859,7 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event) if (!ValidateWhereClause()) return; // Copy the where clause to the output buffer and exit - strcpy(pWhere, pQuerySqlWhereMtxt->GetValue()); + wxStrcpy(pWhere, pQuerySqlWhereMtxt->GetValue()); Close(); return; @@ -1902,7 +1908,7 @@ void CqueryDlg::OnCloseWindow(wxCloseEvent& event) while (wxIsBusy()) wxEndBusyCursor(); - Show(FALSE); + Show(FALSE); this->Destroy(); } // CqueryDlg::OnCloseWindow() @@ -1925,7 +1931,7 @@ void CqueryDlg::ProcessAddBtn() if (pQueryCol2Choice->GetSelection() == 0) // "Value" is selected { // Verify that value 1 is filled in - if (strlen(pQueryValue1Txt->GetValue()) == 0) + if (wxStrlen(pQueryValue1Txt->GetValue()) == 0) { wxBell(); pQueryValue1Txt->SetFocus(); @@ -1933,7 +1939,7 @@ void CqueryDlg::ProcessAddBtn() } // For the BETWEEN operator, value 2 must be filled in as well if (oper == qryOpBETWEEN && - strlen(pQueryValue2Txt->GetValue()) == 0) + wxStrlen(pQueryValue2Txt->GetValue()) == 0) { wxBell(); pQueryValue2Txt->SetFocus(); @@ -2023,11 +2029,11 @@ void CqueryDlg::ProcessCountBtn() if (!ValidateWhereClause()) return; - if (dbTable == 0) // wxTable object needs to be created and opened + if (dbTable == 0) // wxDbTable object needs to be created and opened { - if (!(dbTable = new wxTable(pDB, masterTableName, 0, NULL, !QUERY_ONLY, DbConnectInf.defaultDir))) + if (!(dbTable = new wxDbTable(pDB, masterTableName, 0, NULL, !wxDB_QUERY_ONLY, DbConnectInf.defaultDir))) { - wxMessageBox("Memory allocation failed creating a wxTable object.","Error...",wxOK | wxICON_EXCLAMATION); + wxMessageBox("Memory allocation failed creating a wxDbTable object.","Error...",wxOK | wxICON_EXCLAMATION); return; } if (!dbTable->Open()) @@ -2041,14 +2047,14 @@ void CqueryDlg::ProcessCountBtn() } // Count() with WHERE clause - wxString whereStr; + wxString whereStr; whereStr = pQuerySqlWhereMtxt->GetValue(); - dbTable->where = (char *)whereStr.GetData(); + dbTable->SetWhereClause(whereStr.c_str()); ULONG whereCnt = dbTable->Count(); // Count() of all records in the table - dbTable->where = 0; + dbTable->SetWhereClause(""); ULONG totalCnt = dbTable->Count(); if (whereCnt > 0 || totalCnt == 0) @@ -2108,7 +2114,7 @@ bool CqueryDlg::ValidateWhereClause() SQLInstallerError(1,&retcode,errMsg,500,&cb); - wxMessageBox("FAILED creating data source","FAILED"); + wxMessageBox("FAILED creating data source","FAILED"); } else wxMessageBox("SUCCEEDED creating data source","SUCCESS"); diff --git a/samples/db/dbtest.h b/samples/db/dbtest.h index ae5bdc21e6..375dd149e3 100644 --- a/samples/db/dbtest.h +++ b/samples/db/dbtest.h @@ -74,9 +74,9 @@ class CstructContact : public wxObject // -// NOTE: Ccontact inherits wxTable, which gives access to all the database functionality +// NOTE: Ccontact inherits wxDbTable, which gives access to all the database functionality // -class Ccontact : public wxTable, public CstructContact +class Ccontact : public wxDbTable, public CstructContact { private: bool freeDbConn; @@ -86,7 +86,7 @@ class Ccontact : public wxTable, public CstructContact wxString whereStr; wxString qryWhereStr; // Where string returned from the query dialog - Ccontact(wxDB *pwxDB=NULL); + Ccontact(wxDb *pwxDb=NULL); ~Ccontact(); void Initialize(); @@ -307,11 +307,11 @@ char * const langQRY_BETWEEN = "column BETWEEN value AND value"; class CqueryDlg : public wxDialog { private: - wxColInf *colInf; // Column inf. returned by db->GetColumns() - wxTable *dbTable; + wxDbColInf *colInf; // Column inf. returned by db->GetColumns() + wxDbTable *dbTable; char *masterTableName; char *pWhere; // A pointer to the storage for the resulting where clause - wxDB *pDB; + wxDb *pDB; public: bool widgetPtrsSet; @@ -345,7 +345,7 @@ class CqueryDlg : public wxDialog wxTextCtrl *pFocusTxt; - CqueryDlg(wxWindow *parent, wxDB *pDb, char *tblName[], char *pWhereArg); + CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereArg); ~CqueryDlg(); void OnButton( wxCommandEvent &event ); diff --git a/samples/db/listdb.cpp b/samples/db/listdb.cpp index 6cc5dbf358..57e48dd087 100644 --- a/samples/db/listdb.cpp +++ b/samples/db/listdb.cpp @@ -30,7 +30,7 @@ data table/object for building the list. The data table record access is all handled through the routines - in this module, interfacing with the methods defined in wxTable. + in this module, interfacing with the methods defined in wxDbTable. All objects which use data table access must be initialized and have opened the table prior to passing them in the dialog @@ -64,7 +64,7 @@ extern wxDbList WXDLLEXPORT *PtrBegDbList; /* from db.cpp, used in getting ba extern wxDbConnectInf DbConnectInf; // Global database connection -extern wxDB *READONLY_DB; +extern wxDb *READONLY_DB; // Used for passing the selected listbox selection back to the calling @@ -105,7 +105,7 @@ char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine) msg += ErrFile; msg += " Line: "; tStr.Printf("%d",ErrLine); - msg += tStr.GetData(); + msg += tStr.c_str(); msg += "\n"; } @@ -126,7 +126,7 @@ char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine) if (pDbList->PtrDb->errorList[i]) { msg.Append(pDbList->PtrDb->errorList[i]); - if (strcmp(pDbList->PtrDb->errorList[i],"") != 0) + if (wxStrcmp(pDbList->PtrDb->errorList[i],"") != 0) msg.Append("\n"); } } @@ -139,7 +139,7 @@ char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine) // Clookup constructor -Clookup::Clookup(char *tblName, char *colName) : wxTable(READONLY_DB, tblName, 1, NULL, !QUERY_ONLY, DbConnectInf.defaultDir) +Clookup::Clookup(char *tblName, char *colName) : wxDbTable(READONLY_DB, tblName, 1, NULL, !wxDB_QUERY_ONLY, DbConnectInf.defaultDir) { SetColDefs (0, colName, DB_DATA_TYPE_VARCHAR, lookupCol, SQL_C_CHAR, LOOKUP_COL_LEN+1, FALSE, FALSE); @@ -148,14 +148,14 @@ Clookup::Clookup(char *tblName, char *colName) : wxTable(READONLY_DB, tblName, 1 // Clookup2 constructor -Clookup2::Clookup2(char *tblName, char *colName1, char *colName2, wxDB *pDb) - : wxTable(pDb, tblName, (1 + (strlen(colName2) > 0)), NULL, !QUERY_ONLY, DbConnectInf.defaultDir) +Clookup2::Clookup2(char *tblName, char *colName1, char *colName2, wxDb *pDb) + : wxDbTable(pDb, tblName, (1 + (wxStrlen(colName2) > 0)), NULL, !wxDB_QUERY_ONLY, DbConnectInf.defaultDir) { int i = 0; SetColDefs (i, colName1, DB_DATA_TYPE_VARCHAR, lookupCol1, SQL_C_CHAR, LOOKUP_COL_LEN+1, FALSE, FALSE); - if (strlen(colName2) > 0) + if (wxStrlen(colName2) > 0) SetColDefs (++i, colName2, DB_DATA_TYPE_VARCHAR, lookupCol2, SQL_C_CHAR, LOOKUP_COL_LEN+1, FALSE, FALSE); } // Clookup2() @@ -174,7 +174,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, cha { wxBeginBusyCursor(); - strcpy(ListDB_Selection,""); + wxStrcpy(ListDB_Selection,""); widgetPtrsSet = FALSE; lookup = 0; lookup2 = 0; @@ -204,8 +204,8 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, cha return; } - lookup->orderBy = orderBy; - lookup->where = where; + lookup->SetOrderByClause(orderBy); + lookup->SetWhereClause(where); if (!lookup->Query()) { wxMessageBox("ODBC error during Query()","ODBC Error..."); @@ -264,16 +264,16 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, cha // ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, char *dispCol1, char *dispCol2, char *where, char *orderBy, bool distinctValues, - char *selectStmt, int maxLenCol1, wxDB *pDb, bool allowOk) : wxDialog (parent, LOOKUP_DIALOG, "Select...", wxPoint(-1, -1), wxSize(400, 290)) + char *selectStmt, int maxLenCol1, wxDb *pDb, bool allowOk) : wxDialog (parent, LOOKUP_DIALOG, "Select...", wxPoint(-1, -1), wxSize(400, 290)) { wxBeginBusyCursor(); - strcpy(ListDB_Selection,""); - strcpy(ListDB_Selection2,""); + wxStrcpy(ListDB_Selection,""); + wxStrcpy(ListDB_Selection2,""); widgetPtrsSet = FALSE; lookup = 0; lookup2 = 0; - noDisplayCols = (strlen(dispCol2) ? 2 : 1); + noDisplayCols = (wxStrlen(dispCol2) ? 2 : 1); col1Len = 0; wxFont fixedFont(12,wxMODERN,wxNORMAL,wxNORMAL); @@ -314,14 +314,14 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, else { maxColLen = LOOKUP_COL_LEN; - if (strlen(dispCol2)) + if (wxStrlen(dispCol2)) { wxString q = "SELECT MAX({fn LENGTH("; q += dispCol1; q += ")}), NULL"; q += " FROM "; q += tableName; - if (strlen(where)) + if (wxStrlen(where)) { q += " WHERE "; q += where; @@ -340,7 +340,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, } // Query the actual record set - if (selectStmt && strlen(selectStmt)) // Query by sql stmt passed in + if (selectStmt && wxStrlen(selectStmt)) // Query by sql stmt passed in { if (!lookup2->QueryBySqlStmt(selectStmt)) { @@ -351,8 +351,8 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, } else // Query using where and order by clauses { - lookup2->orderBy = orderBy; - lookup2->where = where; + lookup2->SetOrderByClause(orderBy); + lookup2->SetWhereClause(where); if (!lookup2->Query(FALSE, distinctValues)) { wxMessageBox("ODBC error during Query()","ODBC Error..."); @@ -366,9 +366,9 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, while (lookup2->GetNext()) { s = lookup2->lookupCol1; - if (strlen(dispCol2)) // Append the optional column 2 + if (wxStrlen(dispCol2)) // Append the optional column 2 { - s.Append(' ', (maxColLen + LISTDB_NO_SPACES_BETWEEN_COLS - strlen(lookup2->lookupCol1))); + s.Append(' ', (maxColLen + LISTDB_NO_SPACES_BETWEEN_COLS - wxStrlen(lookup2->lookupCol1))); s.Append(lookup2->lookupCol2); } pLookUpSelectList->Append(s); @@ -434,25 +434,25 @@ void ClookUpDlg::OnCommand(wxWindow& win, wxCommandEvent& event) if (pLookUpSelectList->GetSelection() != -1) { if (noDisplayCols == 1) - strcpy (ListDB_Selection, pLookUpSelectList->GetStringSelection()); + wxStrcpy (ListDB_Selection, pLookUpSelectList->GetStringSelection()); else // 2 display columns { wxString s = pLookUpSelectList->GetStringSelection(); // Column 1 s = s.SubString(0, col1Len-1); s = s.Strip(); - strcpy(ListDB_Selection, s); + wxStrcpy(ListDB_Selection, s); // Column 2 s = pLookUpSelectList->GetStringSelection(); s = s.Mid(col1Len + LISTDB_NO_SPACES_BETWEEN_COLS); s = s.Strip(); - strcpy(ListDB_Selection2, s); + wxStrcpy(ListDB_Selection2, s); } } else { - strcpy(ListDB_Selection,""); - strcpy(ListDB_Selection2,""); + wxStrcpy(ListDB_Selection,""); + wxStrcpy(ListDB_Selection2,""); } Close(); } // OK Button @@ -460,8 +460,8 @@ void ClookUpDlg::OnCommand(wxWindow& win, wxCommandEvent& event) // Cancel Button if (widgetName == pLookUpCancelBtn->GetName()) { - strcpy (ListDB_Selection,""); - strcpy (ListDB_Selection2,""); + wxStrcpy (ListDB_Selection,""); + wxStrcpy (ListDB_Selection2,""); Close(); } // Cancel Button } diff --git a/samples/db/listdb.h b/samples/db/listdb.h index 9aac867020..0f84b82e03 100644 --- a/samples/db/listdb.h +++ b/samples/db/listdb.h @@ -26,10 +26,10 @@ const int LOOKUP_COL_LEN = 250; // Global database connection -extern wxDB *READONLY_DB; +extern wxDb *READONLY_DB; // Clookup class -class Clookup : public wxTable +class Clookup : public wxDbTable { public: @@ -40,14 +40,14 @@ class Clookup : public wxTable }; // Clookup // Clookup2 class -class Clookup2 : public wxTable +class Clookup2 : public wxDbTable { public: char lookupCol1[LOOKUP_COL_LEN+1]; char lookupCol2[LOOKUP_COL_LEN+1]; - Clookup2(char *tblName, char *colName1, char *colName2, wxDB *pDb); + Clookup2(char *tblName, char *colName1, char *colName2, wxDb *pDb); }; // Clookup2 @@ -109,7 +109,7 @@ class ClookUpDlg : public wxDialog bool distinctValues, // e.g. SELECT DISTINCT ... char *selectStmt = 0, // If you wish to query by SQLstmt (complicated lookups) int maxLenCol1 = 0, // Mandatory if querying by SQLstmt - wxDB *pDb = READONLY_DB, // Database connection pointer + wxDb *pDb = READONLY_DB, // Database connection pointer bool allowOk = TRUE); // is the OK button enabled void OnButton( wxCommandEvent &event ); diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 2f194b38be..ecf4a76016 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -61,6 +61,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(DIALOGS_FILES_OPEN, MyFrame::FilesOpen) EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave) EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose) + EVT_MENU(DIALOGS_MODAL, MyFrame::ModalDlg) EVT_MENU(DIALOGS_MODELESS, MyFrame::ModelessDlg) EVT_MENU(DIALOGS_TIP, MyFrame::ShowTip) #if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW @@ -75,6 +76,10 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_BUTTON(DIALOGS_MODELESS_BTN, MyFrame::OnButton) END_EVENT_TABLE() +BEGIN_EVENT_TABLE(MyModalDialog, wxDialog) + EVT_BUTTON(-1, MyModalDialog::OnButton) +END_EVENT_TABLE() + BEGIN_EVENT_TABLE(MyModelessDialog, wxDialog) EVT_CLOSE(MyModelessDialog::OnClose) END_EVENT_TABLE() @@ -124,10 +129,11 @@ bool MyApp::OnInit() file_menu->Append(DIALOGS_FILES_OPEN, "Open &files\tCtrl-Q"); file_menu->Append(DIALOGS_FILE_SAVE, "Sa&ve file\tCtrl-S"); file_menu->Append(DIALOGS_DIR_CHOOSE, "&Choose a directory\tCtrl-D"); - file_menu->AppendSeparator(); #if wxUSE_PROGRESSDLG file_menu->Append(DIALOGS_PROGRESS, "Pro&gress dialog\tCtrl-G"); #endif // wxUSE_PROGRESSDLG + file_menu->AppendSeparator(); + file_menu->Append(DIALOGS_MODAL, "Mo&dal dialog\tCtrl-F"); file_menu->Append(DIALOGS_MODELESS, "Modeless &dialog\tCtrl-Z", "", TRUE); file_menu->AppendSeparator(); file_menu->Append(wxID_EXIT, "E&xit\tAlt-X"); @@ -160,25 +166,25 @@ MyFrame::MyFrame(wxWindow *parent, void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event) ) { - wxColourData data; - data.SetChooseFull(TRUE); - for (int i = 0; i < 16; i++) - { + wxColourData data; + data.SetChooseFull(TRUE); + for (int i = 0; i < 16; i++) + { wxColour colour(i*16, i*16, i*16); data.SetCustomColour(i, colour); - } + } - wxColourDialog *dialog = new wxColourDialog(this, &data); - if (dialog->ShowModal() == wxID_OK) - { + wxColourDialog *dialog = new wxColourDialog(this, &data); + dialog->SetTitle("Choose the background colour"); + if (dialog->ShowModal() == wxID_OK) + { wxColourData retData = dialog->GetColourData(); wxColour col = retData.GetColour(); -// wxBrush *brush = wxTheBrushList->FindOrCreateBrush(&col, wxSOLID); myCanvas->SetBackgroundColour(col); myCanvas->Clear(); myCanvas->Refresh(); - } - dialog->Destroy(); + } + dialog->Destroy(); } void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) ) @@ -261,7 +267,7 @@ void MyFrame::LogDialog(wxCommandEvent& event) void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) ) { - wxMessageDialog dialog( this, "This is a message box\nA long, long string to test out the message box properly", + wxMessageDialog dialog( NULL, "This is a message box\nA long, long string to test out the message box properly", "Message box text", wxYES_NO|wxCANCEL|wxICON_INFORMATION); dialog.ShowModal(); @@ -412,6 +418,12 @@ void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) ) } } +void MyFrame::ModalDlg(wxCommandEvent& WXUNUSED(event)) +{ + MyModalDialog dlg(this); + dlg.ShowModal(); +} + void MyFrame::ModelessDlg(wxCommandEvent& event) { bool show = GetMenuBar()->IsChecked(event.GetInt()); @@ -565,3 +577,46 @@ void MyModelessDialog::OnClose(wxCloseEvent& event) } } +// ---------------------------------------------------------------------------- +// MyModalDialog +// ---------------------------------------------------------------------------- + +MyModalDialog::MyModalDialog(wxWindow *parent) + : wxDialog(parent, -1, wxString("Modal dialog")) +{ + wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); + + m_btnFocused = new wxButton(this, -1, "Default button"); + m_btnDelete = new wxButton(this, -1, "&Delete button"); + sizerTop->Add(m_btnFocused, 0, wxALIGN_CENTER | wxALL, 5); + sizerTop->Add(m_btnDelete, 0, wxALIGN_CENTER | wxALL, 5); + + SetAutoLayout(TRUE); + SetSizer(sizerTop); + + sizerTop->SetSizeHints(this); + sizerTop->Fit(this); + + m_btnFocused->SetFocus(); + m_btnFocused->SetDefault(); +} + +void MyModalDialog::OnButton(wxCommandEvent& event) +{ + if ( event.GetEventObject() == m_btnDelete ) + { + delete m_btnFocused; + m_btnFocused = NULL; + + m_btnDelete->Disable(); + } + else if ( event.GetEventObject() == m_btnFocused ) + { + wxGetTextFromUser("Dummy prompt", "Modal dialog called from dialog", + "", this); + } + else + { + event.Skip(); + } +} diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h index d0e114f6b9..d8e4665ab9 100644 --- a/samples/dialogs/dialogs.h +++ b/samples/dialogs/dialogs.h @@ -22,7 +22,7 @@ public: wxColour m_canvasTextColour; }; -// A modeless dialog +// A custom modeless dialog class MyModelessDialog : public wxDialog { public: @@ -34,6 +34,21 @@ private: DECLARE_EVENT_TABLE() }; +// A custom modal dialog +class MyModalDialog : public wxDialog +{ +public: + MyModalDialog(wxWindow *parent); + + void OnButton(wxCommandEvent& event); + +private: + wxButton *m_btnFocused; + wxButton *m_btnDelete; + + DECLARE_EVENT_TABLE() +}; + // Define a new frame type class MyFrame: public wxFrame { @@ -54,6 +69,7 @@ public: void FileSave(wxCommandEvent& event); void DirChoose(wxCommandEvent& event); void ShowTip(wxCommandEvent& event); + void ModalDlg(wxCommandEvent& event); void ModelessDlg(wxCommandEvent& event); void ShowProgress(wxCommandEvent& event); @@ -101,6 +117,7 @@ enum DIALOGS_TIP, DIALOGS_NUM_ENTRY, DIALOGS_LOG_DIALOG, + DIALOGS_MODAL, DIALOGS_MODELESS, DIALOGS_MODELESS_BTN, DIALOGS_PROGRESS diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index 6ba0420bb3..96b14ad477 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -46,6 +46,10 @@ #if defined(__WXGTK__) || defined(__WXMOTIF__) #include "mondrian.xpm" + + #include "dnd_copy.xpm" + #include "dnd_move.xpm" + #include "dnd_none.xpm" #endif // ---------------------------------------------------------------------------- @@ -1065,14 +1069,10 @@ void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) ) textData.AddFile( "/file1.txt" ); textData.AddFile( "/file2.txt" ); */ - wxDropSource source(textData, this - -#ifdef __WXMSW__ - ,wxCURSOR_PENCIL, // for copy - wxCURSOR_SPRAYCAN, // for move - wxCURSOR_QUESTION_ARROW // for nothing -#endif - ); + wxDropSource source(textData, this, + wxDROP_ICON(dnd_copy), + wxDROP_ICON(dnd_move), + wxDROP_ICON(dnd_none)); const char *pc; @@ -1511,19 +1511,19 @@ DnDShapeFrame::DnDShapeFrame(wxFrame *parent) SetDropTarget(new DnDShapeDropTarget(this)); m_shape = NULL; - + SetBackgroundColour(*wxWHITE); } DnDShapeFrame::~DnDShapeFrame() { - if (m_shape) + if (m_shape) delete m_shape; } void DnDShapeFrame::SetShape(DnDShape *shape) { - if (m_shape) + if (m_shape) delete m_shape; m_shape = shape; Refresh(); diff --git a/samples/dnd/dnd.rc b/samples/dnd/dnd.rc index 7655c62a4c..21cba3bc3c 100644 --- a/samples/dnd/dnd.rc +++ b/samples/dnd/dnd.rc @@ -1,3 +1,6 @@ mondrian ICON "mondrian.ico" #include "wx/msw/wx.rc" +dnd_copy CURSOR "dnd_copy.cur" +dnd_move CURSOR "dnd_move.cur" +dnd_none CURSOR "dnd_none.cur" diff --git a/samples/dnd/dnd_copy.cur b/samples/dnd/dnd_copy.cur new file mode 100644 index 0000000000000000000000000000000000000000..ce349aa3324a9dee883052b92064b2d63300ede7 GIT binary patch literal 326 zcmaLRu?@m75QX92Ae4e49YUfYB_$h>Q5b+7V3Vw3i9tw5o01~R%X5enBm!rB_W3ON z4i*H80@kcJ2G{@xbBWS|*AV0JzD&EM>GCVfYDn@1_AfXkEnH14;bE2Y-DPx!E#F+4 n3(xRBnp{fiOo~hCmIO~8)S0^vy3)0n_&rwA-QRwC&bR3S<|=*2 literal 0 HcmV?d00001 diff --git a/samples/dnd/dnd_copy.xpm b/samples/dnd/dnd_copy.xpm new file mode 100644 index 0000000000..7144747bb9 --- /dev/null +++ b/samples/dnd/dnd_copy.xpm @@ -0,0 +1,45 @@ +/* XPM */ +static char * dnd_copy_xpm[] = { +/* width height ncolors chars_per_pixel */ +"32 32 6 1", +/* colors */ +" s None c None", +". c black", +"X c wheat", +"o c tan", +"O c #6699FF", +"r c red", +/* pixels */ +" ................... r ", +" .XXXXXXXXXXXXXXXXX.. r ", +" .XXXXXXXXXXXXXXXXX.o.rrrrrrr", +" .XXXXXXXXXXXXXXXXX.oo. r ", +" .XXXXXXXXXXXXXXXXX.ooo. r ", +" .XXXXXXXXXXXXXXXXX.oooo. ", +" .XXXXXXXXXXXXXXXXX....... ", +" .XXXXXOOOOOOOOOOXXXooooo. ", +" .XXXXXXXXXXXXXXXXXXooooo. ", +" .XXXXXOOOOOOOOOOXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXOOOOOOOOOXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXOOOOOOOOOOXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXOOOOOOOOOOXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXOOOOOOOOOXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXOOOOOOOOOOXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXOOOOOOOOOOXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXOOOOOOOOOOXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXOOOOOOOXXXXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" ......................... "}; + diff --git a/samples/dnd/dnd_move.cur b/samples/dnd/dnd_move.cur new file mode 100644 index 0000000000000000000000000000000000000000..ce349aa3324a9dee883052b92064b2d63300ede7 GIT binary patch literal 326 zcmaLRu?@m75QX92Ae4e49YUfYB_$h>Q5b+7V3Vw3i9tw5o01~R%X5enBm!rB_W3ON z4i*H80@kcJ2G{@xbBWS|*AV0JzD&EM>GCVfYDn@1_AfXkEnH14;bE2Y-DPx!E#F+4 n3(xRBnp{fiOo~hCmIO~8)S0^vy3)0n_&rwA-QRwC&bR3S<|=*2 literal 0 HcmV?d00001 diff --git a/samples/dnd/dnd_move.xpm b/samples/dnd/dnd_move.xpm new file mode 100644 index 0000000000..9a0eaf4dcc --- /dev/null +++ b/samples/dnd/dnd_move.xpm @@ -0,0 +1,44 @@ +/* XPM */ +static char * dnd_move_xpm[] = { +/* width height ncolors chars_per_pixel */ +"32 32 5 1", +/* colors */ +" s None c None", +". c black", +"X c wheat", +"o c tan", +"O c #6699FF", +/* pixels */ +" ................... ", +" .XXXXXXXXXXXXXXXXX.. ", +" .XXXXXXXXXXXXXXXXX.o. ", +" .XXXXXXXXXXXXXXXXX.oo. ", +" .XXXXXXXXXXXXXXXXX.ooo. ", +" .XXXXXXXXXXXXXXXXX.oooo. ", +" .XXXXXXXXXXXXXXXXX....... ", +" .XXXXXOOOOOOOOOOXXXooooo. ", +" .XXXXXXXXXXXXXXXXXXooooo. ", +" .XXXXXOOOOOOOOOOXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXOOOOOOOOOXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXOOOOOOOOOOXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXOOOOOOOOOOXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXOOOOOOOOOXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXOOOOOOOOOOXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXOOOOOOOOOOXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXOOOOOOOOOOXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXOOOOOOOXXXXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" ......................... "}; + diff --git a/samples/dnd/dnd_none.cur b/samples/dnd/dnd_none.cur new file mode 100644 index 0000000000000000000000000000000000000000..ce349aa3324a9dee883052b92064b2d63300ede7 GIT binary patch literal 326 zcmaLRu?@m75QX92Ae4e49YUfYB_$h>Q5b+7V3Vw3i9tw5o01~R%X5enBm!rB_W3ON z4i*H80@kcJ2G{@xbBWS|*AV0JzD&EM>GCVfYDn@1_AfXkEnH14;bE2Y-DPx!E#F+4 n3(xRBnp{fiOo~hCmIO~8)S0^vy3)0n_&rwA-QRwC&bR3S<|=*2 literal 0 HcmV?d00001 diff --git a/samples/dnd/dnd_none.xpm b/samples/dnd/dnd_none.xpm new file mode 100644 index 0000000000..dfd7f0cdad --- /dev/null +++ b/samples/dnd/dnd_none.xpm @@ -0,0 +1,45 @@ +/* XPM */ +static char * dnd_none_xpm[] = { +/* width height ncolors chars_per_pixel */ +"32 32 6 1", +/* colors */ +" s None c None", +". c black", +"X c wheat", +"o c tan", +"O c #6699FF", +"r c red", +/* pixels */ +" ................... ", +" .XXXXXXXXXXXXXXXXX.. ", +" .XXXXXXXXXXXXXXXXX.o. ", +" .XXXXXXXXXXXXXXXXX.oo. ", +" .XXXXXXXXXXXXXXXXX.ooo. ", +" .XXXXXXXXXXXXXXXXX.oooo. ", +" .XXXXXXXXXXXXXXXXX....... ", +" .rXXXXOOOOOOOOOOXXXoooor. ", +" .XrXXXXXXXXXXXXXXXXoooro. ", +" .XXrXXOOOOOOOOOOXXXXXrXX. ", +" .XXXrXXXXXXXXXXXXXXXrXXX. ", +" .XXXXrXXOOOOOOOOOXXrXXXX. ", +" .XXXXXrXXXXXXXXXXXrXXXXX. ", +" .XXXXXXrOOOOOOOOOrXXXXXX. ", +" .XXXXXXXrXXXXXXXrXXXXXXX. ", +" .XXXXXOOOrOOOOOrXXXXXXXX. ", +" .XXXXXXXXXrXXXrXXXXXXXXX. ", +" .XXXXXXXOOOrOrOOOXXXXXXX. ", +" .XXXXXXXXXXXrXXXXXXXXXXX. ", +" .XXXXXXOOOOrOrOOOXXXXXXX. ", +" .XXXXXXXXXrXXXrXXXXXXXXX. ", +" .XXXXXOOOrOOOOOrXXXXXXXX. ", +" .XXXXXXXrXXXXXXXrXXXXXXX. ", +" .XXXXXXrOOOOOOOOOrXXXXXX. ", +" .XXXXXrXXXXXXXXXXXrXXXXX. ", +" .XXXXrOOOOOOOXXXXXXrXXXX. ", +" .XXXrXXXXXXXXXXXXXXXrXXX. ", +" .XXrXXXXXXXXXXXXXXXXXrXX. ", +" .XrXXXXXXXXXXXXXXXXXXXrX. ", +" .rXXXXXXXXXXXXXXXXXXXXXr. ", +" .XXXXXXXXXXXXXXXXXXXXXXX. ", +" ......................... "}; + diff --git a/samples/docview/doc.cpp b/samples/docview/doc.cpp index d679a53221..864981f878 100644 --- a/samples/docview/doc.cpp +++ b/samples/docview/doc.cpp @@ -40,88 +40,88 @@ DrawingDocument::DrawingDocument(void) DrawingDocument::~DrawingDocument(void) { - doodleSegments.DeleteContents(TRUE); + doodleSegments.DeleteContents(TRUE); } #if wxUSE_STD_IOSTREAM ostream& DrawingDocument::SaveObject(ostream& stream) { - wxDocument::SaveObject(stream); - - wxInt32 n = doodleSegments.Number(); - stream << n << '\n'; - - wxNode *node = doodleSegments.First(); - while (node) - { - DoodleSegment *segment = (DoodleSegment *)node->Data(); - segment->SaveObject(stream); - stream << '\n'; + wxDocument::SaveObject(stream); - node = node->Next(); - } - - return stream; + wxInt32 n = doodleSegments.Number(); + stream << n << '\n'; + + wxNode *node = doodleSegments.First(); + while (node) + { + DoodleSegment *segment = (DoodleSegment *)node->Data(); + segment->SaveObject(stream); + stream << '\n'; + + node = node->Next(); + } + + return stream; } #else wxOutputStream& DrawingDocument::SaveObject(wxOutputStream& stream) { - wxDocument::SaveObject(stream); - - wxTextOutputStream text_stream( stream ); - - wxInt32 n = doodleSegments.Number(); - text_stream << n << '\n'; - - wxNode *node = doodleSegments.First(); - while (node) - { - DoodleSegment *segment = (DoodleSegment *)node->Data(); - segment->SaveObject(stream); - text_stream << '\n'; + wxDocument::SaveObject(stream); + + wxTextOutputStream text_stream( stream ); + + wxInt32 n = doodleSegments.Number(); + text_stream << n << '\n'; + + wxNode *node = doodleSegments.First(); + while (node) + { + DoodleSegment *segment = (DoodleSegment *)node->Data(); + segment->SaveObject(stream); + text_stream << '\n'; + + node = node->Next(); + } - node = node->Next(); - } - - return stream; + return stream; } #endif #if wxUSE_STD_IOSTREAM istream& DrawingDocument::LoadObject(istream& stream) { - wxDocument::LoadObject(stream); - - wxInt32 n = 0; - stream >> n; - - for (int i = 0; i < n; i++) - { - DoodleSegment *segment = new DoodleSegment; - segment->LoadObject(stream); - doodleSegments.Append(segment); - } - - return stream; + wxDocument::LoadObject(stream); + + wxInt32 n = 0; + stream >> n; + + for (int i = 0; i < n; i++) + { + DoodleSegment *segment = new DoodleSegment; + segment->LoadObject(stream); + doodleSegments.Append(segment); + } + + return stream; } #else wxInputStream& DrawingDocument::LoadObject(wxInputStream& stream) { - wxDocument::LoadObject(stream); - - wxTextInputStream text_stream( stream ); - - wxInt32 n = 0; - text_stream >> n; - - for (int i = 0; i < n; i++) - { - DoodleSegment *segment = new DoodleSegment; - segment->LoadObject(stream); - doodleSegments.Append(segment); - } - - return stream; + wxDocument::LoadObject(stream); + + wxTextInputStream text_stream( stream ); + + wxInt32 n = 0; + text_stream >> n; + + for (int i = 0; i < n; i++) + { + DoodleSegment *segment = new DoodleSegment; + segment->LoadObject(stream); + doodleSegments.Append(segment); + } + + return stream; } #endif @@ -131,204 +131,204 @@ DoodleSegment::DoodleSegment(void) DoodleSegment::DoodleSegment(DoodleSegment& seg) { - wxNode *node = seg.lines.First(); - while (node) - { - DoodleLine *line = (DoodleLine *)node->Data(); - DoodleLine *newLine = new DoodleLine; - newLine->x1 = line->x1; - newLine->y1 = line->y1; - newLine->x2 = line->x2; - newLine->y2 = line->y2; - - lines.Append(newLine); - - node = node->Next(); - } + wxNode *node = seg.lines.First(); + while (node) + { + DoodleLine *line = (DoodleLine *)node->Data(); + DoodleLine *newLine = new DoodleLine; + newLine->x1 = line->x1; + newLine->y1 = line->y1; + newLine->x2 = line->x2; + newLine->y2 = line->y2; + + lines.Append(newLine); + + node = node->Next(); + } } DoodleSegment::~DoodleSegment(void) { - lines.DeleteContents(TRUE); + lines.DeleteContents(TRUE); } #if wxUSE_STD_IOSTREAM ostream& DoodleSegment::SaveObject(ostream& stream) { - wxInt32 n = lines.Number(); - stream << n << '\n'; - - wxNode *node = lines.First(); - while (node) - { - DoodleLine *line = (DoodleLine *)node->Data(); - stream << line->x1 << " " << - line->y1 << " " << - line->x2 << " " << - line->y2 << "\n"; - node = node->Next(); - } - - return stream; + wxInt32 n = lines.Number(); + stream << n << '\n'; + + wxNode *node = lines.First(); + while (node) + { + DoodleLine *line = (DoodleLine *)node->Data(); + stream << line->x1 << " " << + line->y1 << " " << + line->x2 << " " << + line->y2 << "\n"; + node = node->Next(); + } + + return stream; } #else wxOutputStream &DoodleSegment::SaveObject(wxOutputStream& stream) { - wxTextOutputStream text_stream( stream ); - - wxInt32 n = lines.Number(); - text_stream << n << '\n'; - - wxNode *node = lines.First(); - while (node) - { - DoodleLine *line = (DoodleLine *)node->Data(); - text_stream << line->x1 << " " << - line->y1 << " " << - line->x2 << " " << - line->y2 << "\n"; - node = node->Next(); - } - - return stream; + wxTextOutputStream text_stream( stream ); + + wxInt32 n = lines.Number(); + text_stream << n << '\n'; + + wxNode *node = lines.First(); + while (node) + { + DoodleLine *line = (DoodleLine *)node->Data(); + text_stream << line->x1 << " " << + line->y1 << " " << + line->x2 << " " << + line->y2 << "\n"; + node = node->Next(); + } + + return stream; } #endif #if wxUSE_STD_IOSTREAM istream& DoodleSegment::LoadObject(istream& stream) { - wxInt32 n = 0; - stream >> n; - - for (int i = 0; i < n; i++) - { - DoodleLine *line = new DoodleLine; - stream >> line->x1 >> - line->y1 >> - line->x2 >> - line->y2; - lines.Append(line); - } - - return stream; + wxInt32 n = 0; + stream >> n; + + for (int i = 0; i < n; i++) + { + DoodleLine *line = new DoodleLine; + stream >> line->x1 >> + line->y1 >> + line->x2 >> + line->y2; + lines.Append(line); + } + + return stream; } #else wxInputStream &DoodleSegment::LoadObject(wxInputStream& stream) { - wxTextInputStream text_stream( stream ); - - wxInt32 n = 0; - text_stream >> n; - - for (int i = 0; i < n; i++) - { - DoodleLine *line = new DoodleLine; - text_stream >> line->x1 >> - line->y1 >> - line->x2 >> - line->y2; - lines.Append(line); - } - - return stream; + wxTextInputStream text_stream( stream ); + + wxInt32 n = 0; + text_stream >> n; + + for (int i = 0; i < n; i++) + { + DoodleLine *line = new DoodleLine; + text_stream >> line->x1 >> + line->y1 >> + line->x2 >> + line->y2; + lines.Append(line); + } + + return stream; } #endif void DoodleSegment::Draw(wxDC *dc) { - wxNode *node = lines.First(); - while (node) - { - DoodleLine *line = (DoodleLine *)node->Data(); - dc->DrawLine(line->x1, line->y1, line->x2, line->y2); - node = node->Next(); - } + wxNode *node = lines.First(); + while (node) + { + DoodleLine *line = (DoodleLine *)node->Data(); + dc->DrawLine(line->x1, line->y1, line->x2, line->y2); + node = node->Next(); + } } /* - * Implementation of drawing command - */ +* Implementation of drawing command +*/ DrawingCommand::DrawingCommand(const wxString& name, int command, DrawingDocument *ddoc, DoodleSegment *seg): - wxCommand(TRUE, name) +wxCommand(TRUE, name) { - doc = ddoc; - segment = seg; - cmd = command; + doc = ddoc; + segment = seg; + cmd = command; } DrawingCommand::~DrawingCommand(void) { - if (segment) - delete segment; + if (segment) + delete segment; } bool DrawingCommand::Do(void) { - switch (cmd) - { - case DOODLE_CUT: + switch (cmd) { - // Cut the last segment - if (doc->GetDoodleSegments().Number() > 0) - { - wxNode *node = doc->GetDoodleSegments().Last(); - if (segment) - delete segment; - - segment = (DoodleSegment *)node->Data(); - delete node; - - doc->Modify(TRUE); - doc->UpdateAllViews(); - } - break; - } + case DOODLE_CUT: + { + // Cut the last segment + if (doc->GetDoodleSegments().Number() > 0) + { + wxNode *node = doc->GetDoodleSegments().Last(); + if (segment) + delete segment; + + segment = (DoodleSegment *)node->Data(); + delete node; + + doc->Modify(TRUE); + doc->UpdateAllViews(); + } + break; + } case DOODLE_ADD: - { - doc->GetDoodleSegments().Append(new DoodleSegment(*segment)); - doc->Modify(TRUE); - doc->UpdateAllViews(); - break; + { + doc->GetDoodleSegments().Append(new DoodleSegment(*segment)); + doc->Modify(TRUE); + doc->UpdateAllViews(); + break; + } } - } - return TRUE; + return TRUE; } bool DrawingCommand::Undo(void) { - switch (cmd) - { - case DOODLE_CUT: + switch (cmd) { - // Paste the segment - if (segment) - { - doc->GetDoodleSegments().Append(segment); - doc->Modify(TRUE); - doc->UpdateAllViews(); - segment = (DoodleSegment *) NULL; - } - doc->Modify(TRUE); - doc->UpdateAllViews(); - break; - } + case DOODLE_CUT: + { + // Paste the segment + if (segment) + { + doc->GetDoodleSegments().Append(segment); + doc->Modify(TRUE); + doc->UpdateAllViews(); + segment = (DoodleSegment *) NULL; + } + doc->Modify(TRUE); + doc->UpdateAllViews(); + break; + } case DOODLE_ADD: - { - // Cut the last segment - if (doc->GetDoodleSegments().Number() > 0) - { - wxNode *node = doc->GetDoodleSegments().Last(); - DoodleSegment *seg = (DoodleSegment *)node->Data(); - delete seg; - delete node; - - doc->Modify(TRUE); - doc->UpdateAllViews(); - } + { + // Cut the last segment + if (doc->GetDoodleSegments().Number() > 0) + { + wxNode *node = doc->GetDoodleSegments().Last(); + DoodleSegment *seg = (DoodleSegment *)node->Data(); + delete seg; + delete node; + + doc->Modify(TRUE); + doc->UpdateAllViews(); + } + } } - } - return TRUE; + return TRUE; } IMPLEMENT_DYNAMIC_CLASS(TextEditDocument, wxDocument) @@ -338,7 +338,7 @@ IMPLEMENT_DYNAMIC_CLASS(TextEditDocument, wxDocument) bool TextEditDocument::OnSaveDocument(const wxString& filename) { TextEditView *view = (TextEditView *)GetFirstView(); - + if (!view->textsw->SaveFile(filename)) return FALSE; Modify(FALSE); @@ -350,7 +350,7 @@ bool TextEditDocument::OnOpenDocument(const wxString& filename) TextEditView *view = (TextEditView *)GetFirstView(); if (!view->textsw->LoadFile(filename)) return FALSE; - + SetFilename(filename, TRUE); Modify(FALSE); UpdateAllViews(); @@ -359,21 +359,21 @@ bool TextEditDocument::OnOpenDocument(const wxString& filename) bool TextEditDocument::IsModified(void) const { - TextEditView *view = (TextEditView *)GetFirstView(); - if (view) - { - return (wxDocument::IsModified() || view->textsw->IsModified()); - } - else - return wxDocument::IsModified(); + TextEditView *view = (TextEditView *)GetFirstView(); + if (view) + { + return (wxDocument::IsModified() || view->textsw->IsModified()); + } + else + return wxDocument::IsModified(); } void TextEditDocument::Modify(bool mod) { - TextEditView *view = (TextEditView *)GetFirstView(); - - wxDocument::Modify(mod); - - if (!mod && view && view->textsw) - view->textsw->DiscardEdits(); + TextEditView *view = (TextEditView *)GetFirstView(); + + wxDocument::Modify(mod); + + if (!mod && view && view->textsw) + view->textsw->DiscardEdits(); } diff --git a/samples/docview/doc.h b/samples/docview/doc.h index 2842a32315..06ec872828 100644 --- a/samples/docview/doc.h +++ b/samples/docview/doc.h @@ -21,53 +21,53 @@ // Plots a line from one point to the other class DoodleLine: public wxObject { - public: - wxInt32 x1; - wxInt32 y1; - wxInt32 x2; - wxInt32 y2; +public: + wxInt32 x1; + wxInt32 y1; + wxInt32 x2; + wxInt32 y2; }; // Contains a list of lines: represents a mouse-down doodle class DoodleSegment: public wxObject { - public: - wxList lines; - - DoodleSegment(void); - DoodleSegment(DoodleSegment& seg); - ~DoodleSegment(void); - - void Draw(wxDC *dc); +public: + wxList lines; + + DoodleSegment(void); + DoodleSegment(DoodleSegment& seg); + ~DoodleSegment(void); + + void Draw(wxDC *dc); #if wxUSE_STD_IOSTREAM - ostream& SaveObject(ostream& text_stream); - istream& LoadObject(istream& text_stream); + ostream& SaveObject(ostream& text_stream); + istream& LoadObject(istream& text_stream); #else - wxOutputStream& SaveObject(wxOutputStream& stream); - wxInputStream& LoadObject(wxInputStream& stream); + wxOutputStream& SaveObject(wxOutputStream& stream); + wxInputStream& LoadObject(wxInputStream& stream); #endif - + }; class DrawingDocument: public wxDocument { - DECLARE_DYNAMIC_CLASS(DrawingDocument) - private: - public: - wxList doodleSegments; - - DrawingDocument(void); - ~DrawingDocument(void); - + DECLARE_DYNAMIC_CLASS(DrawingDocument) +private: +public: + wxList doodleSegments; + + DrawingDocument(void); + ~DrawingDocument(void); + #if wxUSE_STD_IOSTREAM - ostream& SaveObject(ostream& text_stream); - istream& LoadObject(istream& text_stream); + ostream& SaveObject(ostream& text_stream); + istream& LoadObject(istream& text_stream); #else - wxOutputStream& SaveObject(wxOutputStream& stream); - wxInputStream& LoadObject(wxInputStream& stream); + wxOutputStream& SaveObject(wxOutputStream& stream); + wxInputStream& LoadObject(wxInputStream& stream); #endif - - inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; }; + + inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; }; }; #define DOODLE_CUT 1 @@ -75,34 +75,34 @@ class DrawingDocument: public wxDocument class DrawingCommand: public wxCommand { - protected: - DoodleSegment *segment; - DrawingDocument *doc; - int cmd; - public: - DrawingCommand(const wxString& name, int cmd, DrawingDocument *ddoc, DoodleSegment *seg); - ~DrawingCommand(void); - - bool Do(void); - bool Undo(void); +protected: + DoodleSegment *segment; + DrawingDocument *doc; + int cmd; +public: + DrawingCommand(const wxString& name, int cmd, DrawingDocument *ddoc, DoodleSegment *seg); + ~DrawingCommand(void); + + bool Do(void); + bool Undo(void); }; class TextEditDocument: public wxDocument { - DECLARE_DYNAMIC_CLASS(TextEditDocument) - private: - public: + DECLARE_DYNAMIC_CLASS(TextEditDocument) +private: +public: /* - ostream& SaveObject(ostream& stream); - istream& LoadObject(istream& stream); -*/ - virtual bool OnSaveDocument(const wxString& filename); - virtual bool OnOpenDocument(const wxString& filename); - virtual bool IsModified(void) const; - virtual void Modify(bool mod); - - TextEditDocument(void) {} - ~TextEditDocument(void) {} +ostream& SaveObject(ostream& stream); +istream& LoadObject(istream& stream); + */ + virtual bool OnSaveDocument(const wxString& filename); + virtual bool OnOpenDocument(const wxString& filename); + virtual bool IsModified(void) const; + virtual void Modify(bool mod); + + TextEditDocument(void) {} + ~TextEditDocument(void) {} }; diff --git a/samples/docview/docview.cpp b/samples/docview/docview.cpp index b142b5f843..977e9dde6f 100644 --- a/samples/docview/docview.cpp +++ b/samples/docview/docview.cpp @@ -14,10 +14,10 @@ #endif /* - * Purpose: Document/view architecture demo for wxWindows class library - * Run with no arguments for multiple top-level windows, -single - * for a single window. - */ +* Purpose: Document/view architecture demo for wxWindows class library +* Run with no arguments for multiple top-level windows, -single +* for a single window. +*/ // For compilers that support precompilation, includes "wx/wx.h". @@ -56,98 +56,98 @@ MyApp::MyApp(void) bool MyApp::OnInit(void) { - //// Find out if we're: - //// SDI : multiple windows and documents but not MDI - //// MDI : multiple windows and documents with containing frame - MSW only) - /// single window : (one document at a time, only one frame, as in Windows Write) - if (argc > 1) - { - if (wxStrcmp(argv[1], _T("-single")) == 0) + //// Find out if we're: + //// multiple window: multiple windows, each view in a separate frame + //// single window: one view (within the main frame) and one document at a time, as in Windows Write. + //// In single window mode, we only allow one document type + if (argc > 1) { - singleWindowMode = TRUE; + if (wxStrcmp(argv[1], _T("-single")) == 0) + { + singleWindowMode = TRUE; + } } - } - - //// Create a document manager - m_docManager = new wxDocManager; - - //// Create a template relating drawing documents to their views - (void) new wxDocTemplate(m_docManager, "Drawing", "*.drw", "", "drw", "Drawing Doc", "Drawing View", - CLASSINFO(DrawingDocument), CLASSINFO(DrawingView)); - - if (singleWindowMode) - { - // If we've only got one window, we only get to edit - // one document at a time. Therefore no text editing, just - // doodling. - m_docManager->SetMaxDocsOpen(1); - } - else - //// Create a template relating text documents to their views - (void) new wxDocTemplate(m_docManager, "Text", "*.txt", "", "txt", "Text Doc", "Text View", - CLASSINFO(TextEditDocument), CLASSINFO(TextEditView)); - - //// Create the main frame window - frame = new MyFrame(m_docManager, (wxFrame *) NULL, -1, "DocView Demo", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE); - - //// Give it an icon (this is ignored in MDI mode: uses resources) + + //// Create a document manager + m_docManager = new wxDocManager; + + //// Create a template relating drawing documents to their views + (void) new wxDocTemplate(m_docManager, "Drawing", "*.drw", "", "drw", "Drawing Doc", "Drawing View", + CLASSINFO(DrawingDocument), CLASSINFO(DrawingView)); + + if (singleWindowMode) + { + // If we've only got one window, we only get to edit + // one document at a time. Therefore no text editing, just + // doodling. + m_docManager->SetMaxDocsOpen(1); + } + else + //// Create a template relating text documents to their views + (void) new wxDocTemplate(m_docManager, "Text", "*.txt", "", "txt", "Text Doc", "Text View", + CLASSINFO(TextEditDocument), CLASSINFO(TextEditView)); + + //// Create the main frame window + frame = new MyFrame(m_docManager, (wxFrame *) NULL, -1, "DocView Demo", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE); + + //// Give it an icon (this is ignored in MDI mode: uses resources) #ifdef __WXMSW__ - frame->SetIcon(wxIcon("doc_icn")); + frame->SetIcon(wxIcon("doc_icn")); #endif - - //// Make a menubar - wxMenu *file_menu = new wxMenu; - wxMenu *edit_menu = (wxMenu *) NULL; - - file_menu->Append(wxID_NEW, "&New..."); - file_menu->Append(wxID_OPEN, "&Open..."); - - if (singleWindowMode) - { - file_menu->Append(wxID_CLOSE, "&Close"); - file_menu->Append(wxID_SAVE, "&Save"); - file_menu->Append(wxID_SAVEAS, "Save &As..."); + + //// Make a menubar + wxMenu *file_menu = new wxMenu; + wxMenu *edit_menu = (wxMenu *) NULL; + + file_menu->Append(wxID_NEW, "&New..."); + file_menu->Append(wxID_OPEN, "&Open..."); + + if (singleWindowMode) + { + file_menu->Append(wxID_CLOSE, "&Close"); + file_menu->Append(wxID_SAVE, "&Save"); + file_menu->Append(wxID_SAVEAS, "Save &As..."); + file_menu->AppendSeparator(); + file_menu->Append(wxID_PRINT, "&Print..."); + file_menu->Append(wxID_PRINT_SETUP, "Print &Setup..."); + file_menu->Append(wxID_PREVIEW, "Print Pre&view"); + + edit_menu = new wxMenu; + edit_menu->Append(wxID_UNDO, "&Undo"); + edit_menu->Append(wxID_REDO, "&Redo"); + edit_menu->AppendSeparator(); + edit_menu->Append(DOCVIEW_CUT, "&Cut last segment"); + + frame->editMenu = edit_menu; + } + file_menu->AppendSeparator(); - file_menu->Append(wxID_PRINT, "&Print..."); - file_menu->Append(wxID_PRINT_SETUP, "Print &Setup..."); - file_menu->Append(wxID_PREVIEW, "Print Pre&view"); - - edit_menu = new wxMenu; - edit_menu->Append(wxID_UNDO, "&Undo"); - edit_menu->Append(wxID_REDO, "&Redo"); - edit_menu->AppendSeparator(); - edit_menu->Append(DOCVIEW_CUT, "&Cut last segment"); - - frame->editMenu = edit_menu; - } - - file_menu->AppendSeparator(); - file_menu->Append(wxID_EXIT, "E&xit"); - - // A nice touch: a history of files visited. Use this menu. - m_docManager->FileHistoryUseMenu(file_menu); - - wxMenu *help_menu = new wxMenu; - help_menu->Append(DOCVIEW_ABOUT, "&About"); - - wxMenuBar *menu_bar = new wxMenuBar; - - menu_bar->Append(file_menu, "&File"); - if (edit_menu) - menu_bar->Append(edit_menu, "&Edit"); - menu_bar->Append(help_menu, "&Help"); - - if (singleWindowMode) - frame->canvas = frame->CreateCanvas((wxView *) NULL, frame); - - //// Associate the menu bar with the frame - frame->SetMenuBar(menu_bar); - - frame->Centre(wxBOTH); - frame->Show(TRUE); - - SetTopWindow(frame); - return TRUE; + file_menu->Append(wxID_EXIT, "E&xit"); + + // A nice touch: a history of files visited. Use this menu. + m_docManager->FileHistoryUseMenu(file_menu); + + wxMenu *help_menu = new wxMenu; + help_menu->Append(DOCVIEW_ABOUT, "&About"); + + wxMenuBar *menu_bar = new wxMenuBar; + + menu_bar->Append(file_menu, "&File"); + if (edit_menu) + menu_bar->Append(edit_menu, "&Edit"); + menu_bar->Append(help_menu, "&Help"); + + if (singleWindowMode) + frame->canvas = frame->CreateCanvas((wxView *) NULL, frame); + + //// Associate the menu bar with the frame + frame->SetMenuBar(menu_bar); + + frame->Centre(wxBOTH); + frame->Show(TRUE); + + SetTopWindow(frame); + return TRUE; } int MyApp::OnExit(void) @@ -157,85 +157,85 @@ int MyApp::OnExit(void) } /* - * Centralised code for creating a document frame. - * Called from view.cpp, when a view is created, but not used at all - * in 'single window' mode. - */ - +* Centralised code for creating a document frame. +* Called from view.cpp, when a view is created, but not used at all +* in 'single window' mode. +*/ + wxFrame *MyApp::CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas) { - //// Make a child frame - wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, GetMainFrame(), -1, "Child Frame", + //// Make a child frame + wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, GetMainFrame(), -1, "Child Frame", wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE); - + #ifdef __WXMSW__ - subframe->SetIcon(wxString(isCanvas ? "chrt_icn" : "notepad_icn")); + subframe->SetIcon(wxString(isCanvas ? "chrt_icn" : "notepad_icn")); #endif - - //// Make a menubar - wxMenu *file_menu = new wxMenu; - - file_menu->Append(wxID_NEW, "&New..."); - file_menu->Append(wxID_OPEN, "&Open..."); - file_menu->Append(wxID_CLOSE, "&Close"); - file_menu->Append(wxID_SAVE, "&Save"); - file_menu->Append(wxID_SAVEAS, "Save &As..."); - - if (isCanvas) - { - file_menu->AppendSeparator(); - file_menu->Append(wxID_PRINT, "&Print..."); - file_menu->Append(wxID_PRINT_SETUP, "Print &Setup..."); - file_menu->Append(wxID_PREVIEW, "Print Pre&view"); - } - - wxMenu *edit_menu = (wxMenu *) NULL; - - if (isCanvas) - { - edit_menu = new wxMenu; - edit_menu->Append(wxID_UNDO, "&Undo"); - edit_menu->Append(wxID_REDO, "&Redo"); - edit_menu->AppendSeparator(); - edit_menu->Append(DOCVIEW_CUT, "&Cut last segment"); - - doc->GetCommandProcessor()->SetEditMenu(edit_menu); - } - - wxMenu *help_menu = new wxMenu; - help_menu->Append(DOCVIEW_ABOUT, "&About"); - - wxMenuBar *menu_bar = new wxMenuBar; - - menu_bar->Append(file_menu, "&File"); - if (isCanvas) - menu_bar->Append(edit_menu, "&Edit"); - menu_bar->Append(help_menu, "&Help"); - - //// Associate the menu bar with the frame - subframe->SetMenuBar(menu_bar); - - subframe->Centre(wxBOTH); - - return subframe; + + //// Make a menubar + wxMenu *file_menu = new wxMenu; + + file_menu->Append(wxID_NEW, "&New..."); + file_menu->Append(wxID_OPEN, "&Open..."); + file_menu->Append(wxID_CLOSE, "&Close"); + file_menu->Append(wxID_SAVE, "&Save"); + file_menu->Append(wxID_SAVEAS, "Save &As..."); + + if (isCanvas) + { + file_menu->AppendSeparator(); + file_menu->Append(wxID_PRINT, "&Print..."); + file_menu->Append(wxID_PRINT_SETUP, "Print &Setup..."); + file_menu->Append(wxID_PREVIEW, "Print Pre&view"); + } + + wxMenu *edit_menu = (wxMenu *) NULL; + + if (isCanvas) + { + edit_menu = new wxMenu; + edit_menu->Append(wxID_UNDO, "&Undo"); + edit_menu->Append(wxID_REDO, "&Redo"); + edit_menu->AppendSeparator(); + edit_menu->Append(DOCVIEW_CUT, "&Cut last segment"); + + doc->GetCommandProcessor()->SetEditMenu(edit_menu); + } + + wxMenu *help_menu = new wxMenu; + help_menu->Append(DOCVIEW_ABOUT, "&About"); + + wxMenuBar *menu_bar = new wxMenuBar; + + menu_bar->Append(file_menu, "&File"); + if (isCanvas) + menu_bar->Append(edit_menu, "&Edit"); + menu_bar->Append(help_menu, "&Help"); + + //// Associate the menu bar with the frame + subframe->SetMenuBar(menu_bar); + + subframe->Centre(wxBOTH); + + return subframe; } /* - * This is the top-level window of the application. - */ - +* This is the top-level window of the application. +*/ + IMPLEMENT_CLASS(MyFrame, wxDocParentFrame) BEGIN_EVENT_TABLE(MyFrame, wxDocParentFrame) EVT_MENU(DOCVIEW_ABOUT, MyFrame::OnAbout) END_EVENT_TABLE() MyFrame::MyFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, const long type): - wxDocParentFrame(manager, frame, id, title, pos, size, type) + const wxPoint& pos, const wxSize& size, const long type): +wxDocParentFrame(manager, frame, id, title, pos, size, type) { - // This pointer only needed if in single window mode - canvas = (MyCanvas *) NULL; - editMenu = (wxMenu *) NULL; + // This pointer only needed if in single window mode + canvas = (MyCanvas *) NULL; + editMenu = (wxMenu *) NULL; } void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) @@ -248,23 +248,23 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) // if in 'single window' mode. MyCanvas *MyFrame::CreateCanvas(wxView *view, wxFrame *parent) { - int width, height; - parent->GetClientSize(&width, &height); - - // Non-retained canvas - MyCanvas *canvas = new MyCanvas(view, parent, wxPoint(0, 0), wxSize(width, height), 0); - canvas->SetCursor(wxCursor(wxCURSOR_PENCIL)); - - // Give it scrollbars - canvas->SetScrollbars(20, 20, 50, 50); - canvas->SetBackgroundColour(*wxWHITE); - canvas->Clear(); - - return canvas; + int width, height; + parent->GetClientSize(&width, &height); + + // Non-retained canvas + MyCanvas *canvas = new MyCanvas(view, parent, wxPoint(0, 0), wxSize(width, height), 0); + canvas->SetCursor(wxCursor(wxCURSOR_PENCIL)); + + // Give it scrollbars + canvas->SetScrollbars(20, 20, 50, 50); + canvas->SetBackgroundColour(*wxWHITE); + canvas->Clear(); + + return canvas; } MyFrame *GetMainFrame(void) { - return frame; + return frame; } diff --git a/samples/docview/docview.h b/samples/docview/docview.h index fb9201406f..473e8b526e 100644 --- a/samples/docview/docview.h +++ b/samples/docview/docview.h @@ -23,14 +23,14 @@ class wxDocManager; // Define a new application class MyApp: public wxApp { - public: +public: MyApp(void); bool OnInit(void); int OnExit(void); - + wxFrame *CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas); - - protected: + +protected: wxDocManager* m_docManager; }; @@ -40,20 +40,20 @@ DECLARE_APP(MyApp) class MyCanvas; class MyFrame: public wxDocParentFrame { - DECLARE_CLASS(MyFrame) - public: - wxMenu *editMenu; - - // This pointer only needed if in single window mode - MyCanvas *canvas; - - MyFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, - const long type); - - void OnAbout(wxCommandEvent& event); - MyCanvas *CreateCanvas(wxView *view, wxFrame *parent); - -DECLARE_EVENT_TABLE() + DECLARE_CLASS(MyFrame) +public: + wxMenu *editMenu; + + // This pointer only needed if in single window mode + MyCanvas *canvas; + + MyFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, + const long type); + + void OnAbout(wxCommandEvent& event); + MyCanvas *CreateCanvas(wxView *view, wxFrame *parent); + + DECLARE_EVENT_TABLE() }; extern MyFrame *GetMainFrame(void); diff --git a/samples/docview/view.cpp b/samples/docview/view.cpp index 61cec41421..06e35d3a84 100644 --- a/samples/docview/view.cpp +++ b/samples/docview/view.cpp @@ -46,74 +46,74 @@ END_EVENT_TABLE() // windows for displaying the view. bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) { - if (!singleWindowMode) - { - // Multiple windows - frame = wxGetApp().CreateChildFrame(doc, this, TRUE); - frame->SetTitle("DrawingView"); - - canvas = GetMainFrame()->CreateCanvas(this, frame); + if (!singleWindowMode) + { + // Multiple windows + frame = wxGetApp().CreateChildFrame(doc, this, TRUE); + frame->SetTitle("DrawingView"); + + canvas = GetMainFrame()->CreateCanvas(this, frame); #ifdef __X__ - // X seems to require a forced resize - int x, y; - frame->GetSize(&x, &y); - frame->SetSize(-1, -1, x, y); + // X seems to require a forced resize + int x, y; + frame->GetSize(&x, &y); + frame->SetSize(-1, -1, x, y); #endif - frame->Show(TRUE); - } - else - { - // Single-window mode - frame = GetMainFrame(); - canvas = GetMainFrame()->canvas; - canvas->view = this; - - // Associate the appropriate frame with this view. - SetFrame(frame); - - // Make sure the document manager knows that this is the - // current view. - Activate(TRUE); - - // Initialize the edit menu Undo and Redo items - doc->GetCommandProcessor()->SetEditMenu(((MyFrame *)frame)->editMenu); - doc->GetCommandProcessor()->Initialize(); - } - - return TRUE; + frame->Show(TRUE); + } + else + { + // Single-window mode + frame = GetMainFrame(); + canvas = GetMainFrame()->canvas; + canvas->view = this; + + // Associate the appropriate frame with this view. + SetFrame(frame); + + // Make sure the document manager knows that this is the + // current view. + Activate(TRUE); + + // Initialize the edit menu Undo and Redo items + doc->GetCommandProcessor()->SetEditMenu(((MyFrame *)frame)->editMenu); + doc->GetCommandProcessor()->Initialize(); + } + + return TRUE; } // Sneakily gets used for default print/preview // as well as drawing on the screen. void DrawingView::OnDraw(wxDC *dc) { - dc->SetFont(*wxNORMAL_FONT); - dc->SetPen(*wxBLACK_PEN); - - wxNode *node = ((DrawingDocument *)GetDocument())->GetDoodleSegments().First(); - while (node) - { - DoodleSegment *seg = (DoodleSegment *)node->Data(); - seg->Draw(dc); - node = node->Next(); - } + dc->SetFont(*wxNORMAL_FONT); + dc->SetPen(*wxBLACK_PEN); + + wxNode *node = ((DrawingDocument *)GetDocument())->GetDoodleSegments().First(); + while (node) + { + DoodleSegment *seg = (DoodleSegment *)node->Data(); + seg->Draw(dc); + node = node->Next(); + } } void DrawingView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)) { - if (canvas) - canvas->Refresh(); - + if (canvas) + canvas->Refresh(); + /* Is the following necessary? #ifdef __WXMSW__ - if (canvas) - canvas->Refresh(); + if (canvas) + canvas->Refresh(); #else - if (canvas) + if (canvas) { - wxClientDC dc(canvas); - dc.Clear(); - OnDraw(& dc); + wxClientDC dc(canvas); + dc.Clear(); + OnDraw(& dc); } #endif */ @@ -122,29 +122,29 @@ void DrawingView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)) // Clean up windows used for displaying the view. bool DrawingView::OnClose(bool deleteWindow) { - if (!GetDocument()->Close()) - return FALSE; - - // Clear the canvas in case we're in single-window mode, - // and the canvas stays. - canvas->Clear(); - canvas->view = (wxView *) NULL; - canvas = (MyCanvas *) NULL; - - wxString s(wxTheApp->GetAppName()); - if (frame) - frame->SetTitle(s); - - SetFrame((wxFrame *) NULL); - - Activate(FALSE); - - if (deleteWindow && !singleWindowMode) - { - delete frame; + if (!GetDocument()->Close()) + return FALSE; + + // Clear the canvas in case we're in single-window mode, + // and the canvas stays. + canvas->Clear(); + canvas->view = (wxView *) NULL; + canvas = (MyCanvas *) NULL; + + wxString s(wxTheApp->GetAppName()); + if (frame) + frame->SetTitle(s); + + SetFrame((wxFrame *) NULL); + + Activate(FALSE); + + if (deleteWindow && !singleWindowMode) + { + delete frame; + return TRUE; + } return TRUE; - } - return TRUE; } void DrawingView::OnCut(wxCommandEvent& WXUNUSED(event) ) @@ -157,24 +157,24 @@ IMPLEMENT_DYNAMIC_CLASS(TextEditView, wxView) bool TextEditView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) { - frame = wxGetApp().CreateChildFrame(doc, this, FALSE); - - int width, height; - frame->GetClientSize(&width, &height); - textsw = new MyTextWindow(this, frame, wxPoint(0, 0), wxSize(width, height), wxTE_MULTILINE); - frame->SetTitle("TextEditView"); - + frame = wxGetApp().CreateChildFrame(doc, this, FALSE); + + int width, height; + frame->GetClientSize(&width, &height); + textsw = new MyTextWindow(this, frame, wxPoint(0, 0), wxSize(width, height), wxTE_MULTILINE); + frame->SetTitle("TextEditView"); + #ifdef __X__ - // X seems to require a forced resize - int x, y; - frame->GetSize(&x, &y); - frame->SetSize(-1, -1, x, y); + // X seems to require a forced resize + int x, y; + frame->GetSize(&x, &y); + frame->SetSize(-1, -1, x, y); #endif - - frame->Show(TRUE); - Activate(TRUE); - - return TRUE; + + frame->Show(TRUE); + Activate(TRUE); + + return TRUE; } // Handled by wxTextWindow @@ -188,22 +188,22 @@ void TextEditView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) bool TextEditView::OnClose(bool deleteWindow) { - if (!GetDocument()->Close()) - return FALSE; + if (!GetDocument()->Close()) + return FALSE; - Activate(FALSE); - - if (deleteWindow) - { - delete frame; + Activate(FALSE); + + if (deleteWindow) + { + delete frame; + return TRUE; + } return TRUE; - } - return TRUE; } /* - * Window implementations - */ +* Window implementations +*/ BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent) @@ -211,76 +211,76 @@ END_EVENT_TABLE() // Define a constructor for my canvas MyCanvas::MyCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style): - wxScrolledWindow(frame, -1, pos, size, style) + wxScrolledWindow(frame, -1, pos, size, style) { - view = v; + view = v; } // Define the repainting behaviour void MyCanvas::OnDraw(wxDC& dc) { - if (view) - view->OnDraw(& dc); + if (view) + view->OnDraw(& dc); } // This implements a tiny doodling program. Drag the mouse using // the left button. void MyCanvas::OnMouseEvent(wxMouseEvent& event) { - if (!view) - return; + if (!view) + return; - static DoodleSegment *currentSegment = (DoodleSegment *) NULL; - - wxClientDC dc(this); - PrepareDC(dc); - - dc.SetPen(*wxBLACK_PEN); - - wxPoint pt(event.GetLogicalPosition(dc)); - - if (currentSegment && event.LeftUp()) - { - if (currentSegment->lines.Number() == 0) + static DoodleSegment *currentSegment = (DoodleSegment *) NULL; + + wxClientDC dc(this); + PrepareDC(dc); + + dc.SetPen(*wxBLACK_PEN); + + wxPoint pt(event.GetLogicalPosition(dc)); + + if (currentSegment && event.LeftUp()) { - delete currentSegment; - currentSegment = (DoodleSegment *) NULL; + if (currentSegment->lines.Number() == 0) + { + delete currentSegment; + currentSegment = (DoodleSegment *) NULL; + } + else + { + // We've got a valid segment on mouse left up, so store it. + DrawingDocument *doc = (DrawingDocument *)view->GetDocument(); + + doc->GetCommandProcessor()->Submit(new DrawingCommand("Add Segment", DOODLE_ADD, doc, currentSegment)); + + view->GetDocument()->Modify(TRUE); + currentSegment = (DoodleSegment *) NULL; + } } - else + + if (xpos > -1 && ypos > -1 && event.Dragging()) { - // We've got a valid segment on mouse left up, so store it. - DrawingDocument *doc = (DrawingDocument *)view->GetDocument(); - - doc->GetCommandProcessor()->Submit(new DrawingCommand("Add Segment", DOODLE_ADD, doc, currentSegment)); - - view->GetDocument()->Modify(TRUE); - currentSegment = (DoodleSegment *) NULL; + if (!currentSegment) + currentSegment = new DoodleSegment; + + DoodleLine *newLine = new DoodleLine; + newLine->x1 = (long)xpos; + newLine->y1 = (long)ypos; + newLine->x2 = pt.x; + newLine->y2 = pt.y; + currentSegment->lines.Append(newLine); + + dc.DrawLine( (long)xpos, (long)ypos, pt.x, pt.y); } - } - - if (xpos > -1 && ypos > -1 && event.Dragging()) - { - if (!currentSegment) - currentSegment = new DoodleSegment; - - DoodleLine *newLine = new DoodleLine; - newLine->x1 = (long)xpos; - newLine->y1 = (long)ypos; - newLine->x2 = pt.x; - newLine->y2 = pt.y; - currentSegment->lines.Append(newLine); - - dc.DrawLine( (long)xpos, (long)ypos, pt.x, pt.y); - } - xpos = pt.x; - ypos = pt.y; + xpos = pt.x; + ypos = pt.y; } // Define a constructor for my text subwindow MyTextWindow::MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style): - wxTextCtrl(frame, -1, "", pos, size, style) + wxTextCtrl(frame, -1, "", pos, size, style) { - view = v; + view = v; } diff --git a/samples/docview/view.h b/samples/docview/view.h index d69cef8fec..950d8b6dcd 100644 --- a/samples/docview/view.h +++ b/samples/docview/view.h @@ -20,19 +20,19 @@ class MyCanvas: public wxScrolledWindow { - public: +public: wxView *view; MyCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style); virtual void OnDraw(wxDC& dc); void OnMouseEvent(wxMouseEvent& event); - -DECLARE_EVENT_TABLE() + + DECLARE_EVENT_TABLE() }; class MyTextWindow: public wxTextCtrl { - public: +public: wxView *view; MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style); @@ -40,40 +40,40 @@ class MyTextWindow: public wxTextCtrl class DrawingView: public wxView { - DECLARE_DYNAMIC_CLASS(DrawingView) - private: - public: - wxFrame *frame; - MyCanvas *canvas; - - DrawingView(void) { canvas = (MyCanvas *) NULL; frame = (wxFrame *) NULL; }; - ~DrawingView(void) {}; - - bool OnCreate(wxDocument *doc, long flags); - void OnDraw(wxDC *dc); - void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL); - bool OnClose(bool deleteWindow = TRUE); - - void OnCut(wxCommandEvent& event); - -DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(DrawingView) +private: +public: + wxFrame *frame; + MyCanvas *canvas; + + DrawingView(void) { canvas = (MyCanvas *) NULL; frame = (wxFrame *) NULL; }; + ~DrawingView(void) {}; + + bool OnCreate(wxDocument *doc, long flags); + void OnDraw(wxDC *dc); + void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL); + bool OnClose(bool deleteWindow = TRUE); + + void OnCut(wxCommandEvent& event); + + DECLARE_EVENT_TABLE() }; class TextEditView: public wxView { - DECLARE_DYNAMIC_CLASS(TextEditView) - private: - public: - wxFrame *frame; - MyTextWindow *textsw; - - TextEditView(): wxView() { frame = (wxFrame *) NULL; textsw = (MyTextWindow *) NULL; } - ~TextEditView(void) {} - - bool OnCreate(wxDocument *doc, long flags); - void OnDraw(wxDC *dc); - void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL); - bool OnClose(bool deleteWindow = TRUE); + DECLARE_DYNAMIC_CLASS(TextEditView) +private: +public: + wxFrame *frame; + MyTextWindow *textsw; + + TextEditView(): wxView() { frame = (wxFrame *) NULL; textsw = (MyTextWindow *) NULL; } + ~TextEditView(void) {} + + bool OnCreate(wxDocument *doc, long flags); + void OnDraw(wxDC *dc); + void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL); + bool OnClose(bool deleteWindow = TRUE); }; #endif diff --git a/samples/docvwmdi/docview.cpp b/samples/docvwmdi/docview.cpp index 9889a2f146..9be2d6edab 100644 --- a/samples/docvwmdi/docview.cpp +++ b/samples/docvwmdi/docview.cpp @@ -78,17 +78,17 @@ bool MyApp::OnInit(void) wxMenu *file_menu = new wxMenu; wxMenu *edit_menu = (wxMenu *) NULL; - file_menu->Append(wxID_NEW, "&New..."); - file_menu->Append(wxID_OPEN, "&Open..."); + file_menu->Append(wxID_NEW, "&New...\tCtrl-N"); + file_menu->Append(wxID_OPEN, "&Open...\tCtrl-X"); file_menu->AppendSeparator(); - file_menu->Append(wxID_EXIT, "E&xit"); + file_menu->Append(wxID_EXIT, "E&xit\tAlt-X"); // A nice touch: a history of files visited. Use this menu. m_docManager->FileHistoryUseMenu(file_menu); wxMenu *help_menu = new wxMenu; - help_menu->Append(DOCVIEW_ABOUT, "&About"); + help_menu->Append(DOCVIEW_ABOUT, "&About\tF1"); wxMenuBar *menu_bar = new wxMenuBar; diff --git a/samples/dragimag/Makefile.in b/samples/dragimag/Makefile.in index 1e8c6416bf..5fac7499b9 100644 --- a/samples/dragimag/Makefile.in +++ b/samples/dragimag/Makefile.in @@ -6,6 +6,7 @@ top_builddir = ../.. program_dir = samples/dragimag PROGRAM=dragimag +DATAFILES=backgrnd.png shape01.png shape02.png shape03.png OBJECTS=$(PROGRAM).o diff --git a/samples/dragimag/dragimag.cpp b/samples/dragimag/dragimag.cpp index 2ef5db853c..208dae675e 100644 --- a/samples/dragimag/dragimag.cpp +++ b/samples/dragimag/dragimag.cpp @@ -25,7 +25,7 @@ // Under Windows, change this to 1 // to use wxGenericDragImage -#define wxUSE_GENERIC_DRAGIMAGE 0 +#define wxUSE_GENERIC_DRAGIMAGE 1 #if wxUSE_GENERIC_DRAGIMAGE #include "wx/generic/dragimgg.h" diff --git a/samples/dragimag/makefile.g95 b/samples/dragimag/makefile.g95 index dd6a09ce52..6ffd3941ba 100644 --- a/samples/dragimag/makefile.g95 +++ b/samples/dragimag/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=dragimag OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index c0bd806ac8..831b75f128 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -61,20 +61,21 @@ enum ScreenToShow Show_Polygons, Show_Mask, Show_Ops, - Show_Regions + Show_Regions, + Show_Circles }; // ---------------------------------------------------------------------------- // global variables // ---------------------------------------------------------------------------- -static wxBitmap gs_bmpNoMask, - gs_bmpWithColMask, - gs_bmpMask, - gs_bmpWithMask, - gs_bmp4, - gs_bmp4_mono, - gs_bmp36; +static wxBitmap *gs_bmpNoMask = NULL, + *gs_bmpWithColMask = NULL, + *gs_bmpMask = NULL, + *gs_bmpWithMask = NULL, + *gs_bmp4 = NULL, + *gs_bmp4_mono = NULL, + *gs_bmp36 = NULL; // ---------------------------------------------------------------------------- // private classes @@ -92,7 +93,11 @@ public: // return: if OnInit() returns false, the application terminates) virtual bool OnInit(); + virtual int OnExit() { DeleteBitmaps(); return 0; } + protected: + void DeleteBitmaps(); + bool LoadImages(); }; @@ -151,6 +156,7 @@ protected: void DrawImages(wxDC& dc); void DrawWithLogicalOps(wxDC& dc); void DrawRegions(wxDC& dc); + void DrawCircles(wxDC& dc); void DrawDefault(wxDC& dc); private: @@ -182,7 +188,8 @@ enum File_ShowMask, File_ShowOps, File_ShowRegions, - MenuShow_Last = File_ShowRegions, + File_ShowCircles, + MenuShow_Last = File_ShowCircles, MenuOption_First, @@ -237,6 +244,14 @@ IMPLEMENT_APP(MyApp) bool MyApp::LoadImages() { + gs_bmpNoMask = new wxBitmap; + gs_bmpWithColMask = new wxBitmap; + gs_bmpMask = new wxBitmap; + gs_bmpWithMask = new wxBitmap; + gs_bmp4 = new wxBitmap; + gs_bmp4_mono = new wxBitmap; + gs_bmp36 = new wxBitmap; + wxPathList pathList; pathList.Add("."); pathList.Add(".."); @@ -244,41 +259,38 @@ bool MyApp::LoadImages() wxString path = pathList.FindValidPath("pat4.bmp"); if ( !path ) return FALSE; + /* 4 colour bitmap */ - gs_bmp4.LoadFile(path, wxBITMAP_TYPE_BMP); + gs_bmp4->LoadFile(path, wxBITMAP_TYPE_BMP); /* turn into mono-bitmap */ - gs_bmp4_mono.LoadFile(path, wxBITMAP_TYPE_BMP); - wxMask* mask4 = new wxMask(gs_bmp4_mono, *wxBLACK); - gs_bmp4_mono.SetMask(mask4); + gs_bmp4_mono->LoadFile(path, wxBITMAP_TYPE_BMP); + wxMask* mask4 = new wxMask(*gs_bmp4_mono, *wxBLACK); + gs_bmp4_mono->SetMask(mask4); path = pathList.FindValidPath("pat36.bmp"); if ( !path ) return FALSE; - gs_bmp36.LoadFile(path, wxBITMAP_TYPE_BMP); - wxMask* mask36 = new wxMask(gs_bmp36, *wxBLACK); - gs_bmp36.SetMask(mask36); + gs_bmp36->LoadFile(path, wxBITMAP_TYPE_BMP); + wxMask* mask36 = new wxMask(*gs_bmp36, *wxBLACK); + gs_bmp36->SetMask(mask36); path = pathList.FindValidPath("image.bmp"); if ( !path ) return FALSE; - gs_bmpNoMask.LoadFile(path, wxBITMAP_TYPE_BMP); - gs_bmpWithMask.LoadFile(path, wxBITMAP_TYPE_BMP); - gs_bmpWithColMask.LoadFile(path, wxBITMAP_TYPE_BMP); + gs_bmpNoMask->LoadFile(path, wxBITMAP_TYPE_BMP); + gs_bmpWithMask->LoadFile(path, wxBITMAP_TYPE_BMP); + gs_bmpWithColMask->LoadFile(path, wxBITMAP_TYPE_BMP); path = pathList.FindValidPath("mask.bmp"); if ( !path ) return FALSE; - gs_bmpMask.LoadFile(path, wxBITMAP_TYPE_BMP); + gs_bmpMask->LoadFile(path, wxBITMAP_TYPE_BMP); -// This is so wrong, it hurts. -// gs_bmpMask.SetDepth(1); -// wxMask *mask = new wxMask(gs_bmpMask); + wxMask *mask = new wxMask(*gs_bmpMask, *wxBLACK); + gs_bmpWithMask->SetMask(mask); - wxMask *mask = new wxMask(gs_bmpMask, *wxBLACK); - gs_bmpWithMask.SetMask(mask); - - mask = new wxMask(gs_bmpWithColMask, *wxWHITE); - gs_bmpWithColMask.SetMask(mask); + mask = new wxMask(*gs_bmpWithColMask, *wxWHITE); + gs_bmpWithColMask->SetMask(mask); return TRUE; } @@ -301,6 +313,8 @@ bool MyApp::OnInit() "there."); // stop here + DeleteBitmaps(); + return FALSE; } @@ -308,6 +322,17 @@ bool MyApp::OnInit() return TRUE; } +void MyApp::DeleteBitmaps() +{ + delete gs_bmpNoMask; + delete gs_bmpWithColMask; + delete gs_bmpMask; + delete gs_bmpWithMask; + delete gs_bmp4; + delete gs_bmp4_mono; + delete gs_bmp36; +} + // ---------------------------------------------------------------------------- // MyCanvas // ---------------------------------------------------------------------------- @@ -342,9 +367,9 @@ MyCanvas::MyCanvas( MyFrame *parent ) : wxScrolledWindow( parent ) void MyCanvas::DrawTestPoly( int x, int y,wxDC &dc,int transparent ) { - wxBrush* brush4 = new wxBrush(gs_bmp4); - wxBrush* brush4_mono = new wxBrush(gs_bmp4_mono); - wxBrush* brush36 = new wxBrush(gs_bmp36); + wxBrush* brush4 = new wxBrush(*gs_bmp4); + wxBrush* brush4_mono = new wxBrush(*gs_bmp4_mono); + wxBrush* brush36 = new wxBrush(*gs_bmp36); wxPoint todraw[5]; todraw[0].x=(long)x+100; @@ -542,8 +567,10 @@ void MyCanvas::DrawTestLines( int x, int y, int width, wxDC &dc ) { dc.SetPen( wxPen( "black", width, wxSOLID) ); dc.SetBrush( *wxRED_BRUSH ); + dc.DrawText(wxString::Format("Testing lines of width %d", width), x + 10, y - 10); dc.DrawRectangle( x+10, y+10, 100, 190 ); + dc.DrawText("Solid/dot/short dash/long dash/dot dash", x + 150, y + 10); dc.SetPen( wxPen( "black", width, wxSOLID) ); dc.DrawLine( x+20, y+20, 100, y+20 ); dc.SetPen( wxPen( "black", width, wxDOT) ); @@ -555,6 +582,7 @@ void MyCanvas::DrawTestLines( int x, int y, int width, wxDC &dc ) dc.SetPen( wxPen( "black", width, wxDOT_DASH) ); dc.DrawLine( x+20, y+60, 100, y+60 ); + dc.DrawText("Misc hatches", x + 150, y + 70); dc.SetPen( wxPen( "black", width, wxBDIAGONAL_HATCH) ); dc.DrawLine( x+20, y+70, 100, y+70 ); dc.SetPen( wxPen( "black", width, wxCROSSDIAG_HATCH) ); @@ -568,6 +596,7 @@ void MyCanvas::DrawTestLines( int x, int y, int width, wxDC &dc ) dc.SetPen( wxPen( "black", width, wxVERTICAL_HATCH) ); dc.DrawLine( x+20, y+120, 100, y+120 ); + dc.DrawText("User dash", x + 150, y + 140); wxPen ud( "black", width, wxUSER_DASH ); wxDash dash1[1]; dash1[0] = 0; @@ -579,7 +608,7 @@ void MyCanvas::DrawTestLines( int x, int y, int width, wxDC &dc ) dash1[0] = 2; ud.SetDashes( 1, dash1 ); dc.DrawLine( x+20, y+160, 100, y+160 ); - dash1[0] = 0xFF; + dash1[0] = 0x7F; ud.SetDashes( 1, dash1 ); dc.DrawLine( x+20, y+170, 100, y+170 ); } @@ -793,7 +822,7 @@ void MyCanvas::DrawText(wxDC& dc) dc.SetFont( *wxNORMAL_FONT ); wxString text; - dc. SetBackgroundMode(wxTRANSPARENT); + dc.SetBackgroundMode(wxTRANSPARENT); for ( int n = -180; n < 180; n += 30 ) { @@ -816,6 +845,24 @@ void MyCanvas::DrawText(wxDC& dc) dc.DrawText( text, 110, 120 ); dc.DrawRectangle( 100, 40, 4, height ); + + // test the logical function effect + wxCoord y = 150; + dc.SetLogicalFunction(wxINVERT); + dc.DrawText( "There should be no text below", 110, 150 ); + dc.DrawRectangle( 110, y, 100, height ); + + // twice drawn inverted should result in invisible + y += height; + dc.DrawText( "Invisible text", 110, y ); + dc.DrawRectangle( 110, y, 100, height ); + dc.DrawText( "Invisible text", 110, y ); + dc.DrawRectangle( 110, y, 100, height ); + dc.SetLogicalFunction(wxCOPY); + + y += height; + dc.DrawRectangle( 110, y, 100, height ); + dc.DrawText( "Visible text", 110, y ); } static const struct @@ -844,16 +891,16 @@ static const struct void MyCanvas::DrawImages(wxDC& dc) { dc.DrawText("original image", 0, 0); - dc.DrawBitmap(gs_bmpNoMask, 0, 20, 0); + dc.DrawBitmap(*gs_bmpNoMask, 0, 20, 0); dc.DrawText("with colour mask", 0, 100); - dc.DrawBitmap(gs_bmpWithColMask, 0, 120, TRUE); + dc.DrawBitmap(*gs_bmpWithColMask, 0, 120, TRUE); dc.DrawText("the mask image", 0, 200); - dc.DrawBitmap(gs_bmpMask, 0, 220, 0); + dc.DrawBitmap(*gs_bmpMask, 0, 220, 0); dc.DrawText("masked image", 0, 300); - dc.DrawBitmap(gs_bmpWithMask, 0, 320, TRUE); + dc.DrawBitmap(*gs_bmpWithMask, 0, 320, TRUE); - int cx = gs_bmpWithColMask.GetWidth(), - cy = gs_bmpWithColMask.GetHeight(); + int cx = gs_bmpWithColMask->GetWidth(), + cy = gs_bmpWithColMask->GetHeight(); wxMemoryDC memDC; for ( size_t n = 0; n < WXSIZEOF(rasterOperations); n++ ) @@ -862,7 +909,7 @@ void MyCanvas::DrawImages(wxDC& dc) y = 20 + 100*(n/4); dc.DrawText(rasterOperations[n].name, x, y - 20); - memDC.SelectObject(gs_bmpWithColMask); + memDC.SelectObject(*gs_bmpWithColMask); dc.Blit(x, y, cx, cy, &memDC, 0, 0, rasterOperations[n].rop, TRUE); } } @@ -903,6 +950,36 @@ void MyCanvas::DrawWithLogicalOps(wxDC& dc) } } +void MyCanvas::DrawCircles(wxDC& dc) +{ + int x = 100, + y = 100, + r = 20; + + dc.DrawText("Some circles", 0, y); + dc.DrawCircle(x, y, r); + dc.DrawCircle(x + 2*r, y, r); + dc.DrawCircle(x + 4*r, y, r); + + y += 2*r; + dc.DrawText("And ellipses", 0, y); + dc.DrawEllipse(x - r, y, 2*r, r); + dc.DrawEllipse(x + r, y, 2*r, r); + dc.DrawEllipse(x + 3*r, y, 2*r, r); + + y += 2*r; + dc.DrawText("And arcs", 0, y); + dc.DrawArc(x - r, y, x + r, y, x, y); + dc.DrawArc(x + 4*r, y, x + 2*r, y, x + 3*r, y); + dc.DrawArc(x + 5*r, y, x + 5*r, y, x + 6*r, y); + + y += 2*r; + dc.DrawEllipticArc(x - r, y, 2*r, r, 0, 90); + dc.DrawEllipticArc(x + r, y, 2*r, r, 90, 180); + dc.DrawEllipticArc(x + 3*r, y, 2*r, r, 180, 270); + dc.DrawEllipticArc(x + 5*r, y, 2*r, r, 270, 360); +} + void MyCanvas::DrawRegions(wxDC& dc) { dc.SetBrush( *wxWHITE_BRUSH ); @@ -969,6 +1046,10 @@ void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event)) DrawDefault(dc); break; + case Show_Circles: + DrawCircles(dc); + break; + case Show_Regions: DrawRegions(dc); break; @@ -979,9 +1060,9 @@ void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event)) case Show_Lines: DrawTestLines( 0, 100, 0, dc ); - DrawTestLines( 0, 300, 1, dc ); - DrawTestLines( 0, 500, 2, dc ); - DrawTestLines( 0, 700, 6, dc ); + DrawTestLines( 0, 320, 1, dc ); + DrawTestLines( 0, 540, 2, dc ); + DrawTestLines( 0, 760, 6, dc ); break; case Show_Polygons: @@ -1046,7 +1127,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) menuFile->Append(File_ShowPolygons, "&Polygons screen\tF4"); menuFile->Append(File_ShowMask, "wx&Mask screen\tF5"); menuFile->Append(File_ShowOps, "&ROP screen\tF6"); - menuFile->Append(File_ShowRegions, "Re&gions screen\tF6"); + menuFile->Append(File_ShowRegions, "Re&gions screen\tF7"); + menuFile->Append(File_ShowCircles, "&Circles screen\tF8"); menuFile->AppendSeparator(); menuFile->Append(File_About, "&About...\tCtrl-A", "Show about dialog"); menuFile->AppendSeparator(); diff --git a/samples/exec/exec.cpp b/samples/exec/exec.cpp index 06e51aa59d..e8483a828a 100644 --- a/samples/exec/exec.cpp +++ b/samples/exec/exec.cpp @@ -86,6 +86,8 @@ public: void OnAsyncExec(wxCommandEvent& event); void OnShell(wxCommandEvent& event); void OnExecWithRedirect(wxCommandEvent& event); + void OnExecWithPipe(wxCommandEvent& event); + void OnDDEExec(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); @@ -94,11 +96,14 @@ public: void OnIdle(wxIdleEvent& event); // for MyPipedProcess - void OnProcessTerminated(MyPipedProcess *process) - { m_running.Remove(process); } + void OnProcessTerminated(MyPipedProcess *process); wxListBox *GetLogListBox() const { return m_lbox; } private: + void ShowOutput(const wxString& cmd, + const wxArrayString& output, + const wxString& title); + wxString m_cmdLast; wxListBox *m_lbox; @@ -141,7 +146,23 @@ public: virtual void OnTerminate(int pid, int status); - bool HasInput(); + virtual bool HasInput(); +}; + +// A version of MyPipedProcess which also sends input to the stdin of the +// child process +class MyPipedProcess2 : public MyPipedProcess +{ +public: + MyPipedProcess2(MyFrame *parent, const wxString& cmd, const wxString& input) + : MyPipedProcess(parent, cmd), m_input(input) + { + } + + virtual bool HasInput(); + +private: + wxString m_input; }; // ---------------------------------------------------------------------------- @@ -159,6 +180,7 @@ enum Exec_Shell, Exec_DDEExec, Exec_Redirect, + Exec_Pipe, Exec_About = 300 }; @@ -179,6 +201,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(Exec_AsyncExec, MyFrame::OnAsyncExec) EVT_MENU(Exec_Shell, MyFrame::OnShell) EVT_MENU(Exec_Redirect, MyFrame::OnExecWithRedirect) + EVT_MENU(Exec_Pipe, MyFrame::OnExecWithPipe) + EVT_MENU(Exec_DDEExec, MyFrame::OnDDEExec) EVT_MENU(Exec_About, MyFrame::OnAbout) @@ -232,11 +256,6 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) wxApp::s_macAboutMenuItemId = Exec_About; #endif - // set the frame icon -#ifndef __WXGTK__ - SetIcon(wxICON(mondrian)); -#endif - // create a menu bar wxMenu *menuFile = new wxMenu(_T(""), wxMENU_TEAROFF); menuFile->Append(Exec_ClearLog, _T("&Clear log\tCtrl-C"), @@ -251,8 +270,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) _T("Launch a program and return immediately")); execMenu->Append(Exec_Shell, _T("Execute &shell command...\tCtrl-S"), _T("Launch a shell and execute a command in it")); + execMenu->AppendSeparator(); execMenu->Append(Exec_Redirect, _T("Capture command &output...\tCtrl-O"), _T("Launch a program and capture its output")); + execMenu->Append(Exec_Pipe, _T("&Pipe through command...\tCtrl-P"), + _T("Pipe a string through a filter")); #ifdef __WINDOWS__ execMenu->AppendSeparator(); @@ -387,21 +409,15 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event)) if ( sync ) { - wxArrayString output; - int code = wxExecute(cmd, output); + wxArrayString output, errors; + int code = wxExecute(cmd, output, errors); wxLogStatus(_T("command '%s' terminated with exit code %d."), cmd.c_str(), code); if ( code != -1 ) { - m_lbox->Append(wxString::Format(_T("--- Output of '%s' ---"), - cmd.c_str())); - - size_t count = output.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - m_lbox->Append(output[n]); - } + ShowOutput(cmd, output, _T("Output")); + ShowOutput(cmd, errors, _T("Errors")); } } else // async exec @@ -422,6 +438,42 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event)) m_cmdLast = cmd; } +void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event)) +{ + if ( !m_cmdLast ) + m_cmdLast = _T("tr [a-z] [A-Z]"); + + wxString cmd = wxGetTextFromUser(_T("Enter the command: "), + DIALOG_TITLE, + m_cmdLast); + + if ( !cmd ) + return; + + wxString input = wxGetTextFromUser(_T("Enter the string to send to it: "), + DIALOG_TITLE); + if ( !input ) + return; + + // always execute the filter asynchronously + MyPipedProcess2 *process = new MyPipedProcess2(this, cmd, input); + int pid = wxExecute(cmd, FALSE /* async */, process); + if ( pid ) + { + wxLogStatus(_T("Process %ld (%s) launched."), pid, cmd.c_str()); + + m_running.Add(process); + } + else + { + wxLogError(_T("Execution of '%s' failed."), cmd.c_str()); + + delete process; + } + + m_cmdLast = cmd; +} + void MyFrame::OnDDEExec(wxCommandEvent& WXUNUSED(event)) { #ifdef __WINDOWS__ @@ -477,6 +529,31 @@ void MyFrame::OnIdle(wxIdleEvent& event) } } +void MyFrame::OnProcessTerminated(MyPipedProcess *process) +{ + m_running.Remove(process); +} + + +void MyFrame::ShowOutput(const wxString& cmd, + const wxArrayString& output, + const wxString& title) +{ + size_t count = output.GetCount(); + if ( !count ) + return; + + m_lbox->Append(wxString::Format(_T("--- %s of '%s' ---"), + title.c_str(), cmd.c_str())); + + for ( size_t n = 0; n < count; n++ ) + { + m_lbox->Append(output[n]); + } + + m_lbox->Append(_T("--- End of output ---")); +} + // ---------------------------------------------------------------------------- // MyProcess // ---------------------------------------------------------------------------- @@ -496,6 +573,8 @@ void MyProcess::OnTerminate(int pid, int status) bool MyPipedProcess::HasInput() { + bool hasInput = FALSE; + wxInputStream& is = *GetInputStream(); if ( !is.Eof() ) { @@ -503,16 +582,28 @@ bool MyPipedProcess::HasInput() // this assumes that the output is always line buffered wxString msg; - msg << m_cmd << _T(": ") << tis.ReadLine(); + msg << m_cmd << _T(" (stdout): ") << tis.ReadLine(); m_parent->GetLogListBox()->Append(msg); - return TRUE; + hasInput = TRUE; } - else + + wxInputStream& es = *GetErrorStream(); + if ( !es.Eof() ) { - return FALSE; + wxTextInputStream tis(es); + + // this assumes that the output is always line buffered + wxString msg; + msg << m_cmd << _T(" (stderr): ") << tis.ReadLine(); + + m_parent->GetLogListBox()->Append(msg); + + hasInput = TRUE; } + + return hasInput; } void MyPipedProcess::OnTerminate(int pid, int status) @@ -525,3 +616,24 @@ void MyPipedProcess::OnTerminate(int pid, int status) MyProcess::OnTerminate(pid, status); } + +// ---------------------------------------------------------------------------- +// MyPipedProcess2 +// ---------------------------------------------------------------------------- + +bool MyPipedProcess2::HasInput() +{ + if ( !!m_input ) + { + wxTextOutputStream os(*GetOutputStream()); + os.WriteString(m_input); + + CloseOutput(); + m_input.clear(); + + // call us once again - may be we'll have output + return TRUE; + } + + return MyPipedProcess::HasInput(); +} diff --git a/samples/exec/makefile.g95 b/samples/exec/makefile.g95 index 6292100f68..13bcf455d2 100644 --- a/samples/exec/makefile.g95 +++ b/samples/exec/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=exec OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/font/font.cpp b/samples/font/font.cpp index 8c1a0b630a..c8dd213baa 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -84,6 +84,9 @@ public: // event handlers (these functions should _not_ be virtual) void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); + void OnIncFont(wxCommandEvent& event) { DoResizeFont(+2); } + void OnDecFont(wxCommandEvent& event) { DoResizeFont(-2); } + void OnViewMsg(wxCommandEvent& event); void OnSelectFont(wxCommandEvent& event); void OnEnumerateFamiliesForEncoding(wxCommandEvent& event); @@ -100,10 +103,13 @@ protected: wxFontEncoding encoding = wxFONTENCODING_SYSTEM, bool silent = FALSE); + void DoResizeFont(int diff); void DoChangeFont(const wxFont& font, const wxColour& col = wxNullColour); void Resize(const wxSize& size, const wxFont& font = wxNullFont); + size_t m_fontSize; // in points + wxTextCtrl *m_textctrl; MyCanvas *m_canvas; @@ -123,6 +129,8 @@ enum Font_Quit = 1, Font_About, Font_ViewMsg, + Font_IncSize, + Font_DecSize, Font_Choose = 100, Font_EnumFamiliesForEncoding, Font_EnumFamilies, @@ -141,6 +149,8 @@ enum BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(Font_Quit, MyFrame::OnQuit) EVT_MENU(Font_About, MyFrame::OnAbout) + EVT_MENU(Font_IncSize, MyFrame::OnIncFont) + EVT_MENU(Font_DecSize, MyFrame::OnDecFont) EVT_MENU(Font_ViewMsg, MyFrame::OnViewMsg) EVT_MENU(Font_Choose, MyFrame::OnSelectFont) EVT_MENU(Font_EnumFamiliesForEncoding, MyFrame::OnEnumerateFamiliesForEncoding) @@ -191,6 +201,8 @@ bool MyApp::OnInit() MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame((wxFrame *)NULL, -1, title, pos, size), m_textctrl(NULL) { + m_fontSize = 12; + // create a menu bar wxMenu *menuFile = new wxMenu; @@ -202,12 +214,15 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) menuFile->Append(Font_Quit, "E&xit\tAlt-X", "Quit this program"); wxMenu *menuFont = new wxMenu; + menuFont->Append(Font_IncSize, "&Increase font size by 2 points\tCtrl-I"); + menuFont->Append(Font_DecSize, "&Decrease font size by 2 points\tCtrl-D"); + menuFont->AppendSeparator(); menuFont->Append(Font_Choose, "&Select font...\tCtrl-S", "Select a standard font"); menuFont->AppendSeparator(); menuFont->Append(Font_EnumFamilies, "Enumerate font &families\tCtrl-F"); menuFont->Append(Font_EnumFixedFamilies, - "Enumerate f&ixed font families\tCtrl-I"); + "Enumerate fi&xed font families\tCtrl-X"); menuFont->Append(Font_EnumEncodings, "Enumerate &encodings\tCtrl-E"); menuFont->Append(Font_EnumFamiliesForEncoding, @@ -391,6 +406,23 @@ void MyFrame::OnEnumerateFamiliesForEncoding(wxCommandEvent& WXUNUSED(event)) } } +void MyFrame::DoResizeFont(int diff) +{ + wxFont fontOld = m_canvas->GetTextFont(); + + DoChangeFont( + wxFont( + fontOld.GetPointSize() + diff, + fontOld.GetFamily(), + fontOld.GetStyle(), + fontOld.GetWeight(), + fontOld.GetUnderlined(), + fontOld.GetFaceName(), + fontOld.GetEncoding() + ) + ); +} + void MyFrame::DoChangeFont(const wxFont& font, const wxColour& col) { Resize(GetSize(), font); @@ -610,7 +642,8 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) // output the font name/info wxString fontInfo; - fontInfo.Printf("Font family is '%s', style '%s', weight '%s'", + fontInfo.Printf("Font size is %d points, family is %s, style %s, weight %s", + m_font.GetPointSize(), m_font.GetFamilyString().c_str(), m_font.GetStyleString().c_str(), m_font.GetWeightString().c_str()); diff --git a/samples/grid/grid.cpp b/samples/grid/grid.cpp index ed7ad8001a..8aa405111d 100644 --- a/samples/grid/grid.cpp +++ b/samples/grid/grid.cpp @@ -9,11 +9,6 @@ static const char sccsid[] = "%W% %G%"; -#ifdef __GNUG__ -#pragma implementation -#pragma interface -#endif - // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" diff --git a/samples/grid/makefile.g95 b/samples/grid/makefile.g95 index ae8121341f..e2f55732d5 100644 --- a/samples/grid/makefile.g95 +++ b/samples/grid/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=grid OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/help/Makefile.in b/samples/help/Makefile.in index 2828c680d8..ab6a3d4232 100644 --- a/samples/help/Makefile.in +++ b/samples/help/Makefile.in @@ -17,6 +17,7 @@ PROGRAM=help OBJECTS=demo.o +DATADIRS=doc DATAFILES=doc.cnt doc.hlp doc.hpj doc.tex doc.zip back.gif forward.gif books.gif contents.gif include ../../src/makeprog.env diff --git a/samples/help/back.gif b/samples/help/back.gif index 8a61076d3ba74bdedc1d24f60c3d1f5a361a6cee..88a3740f9134d7a569b56a9f76e6aa552672993e 100644 GIT binary patch literal 978 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0fnz;`IEReKh6M+kIfS)hPHb3s zxLrWmYmUc8MFs{@V=tBk4vcQS3gSg?UKlR%Y*zN1W>fj;(a}CV`%O8V#mmmJDyQBv znOUrUdY)b7H6AG;jlf>Rey!M3TUK6P?i!m{q7|$j(iU2nb+j@t;aY#t_B`I%AGL2Z zO6>3Q?Jm>3v>|kImhI|mtHW1|tWDEBQI>amZ`s68xzaas@2+e3%;$D{>W3T0V&ot1 Q_1d}V>FF7|>?{n{02fm-00000 literal 225 zcmV<703QEGNk%v~VLt#E0Pz3-zrVld=jU&4Z(9HWEC2ui06zd20008IjE||y?GK}z zNf>~$-n{z{YJwGn=81mem9{RpmcUHc_KoNIPRH~B4DyD9p%LJl6@Sa4^Epcbno6kk zD5XxT&EQg7><X(t<v2<zGtFvpm%NS3x723V`)<ec-&(({)sqHiQ-=rlS4S8Ibd!~% zh!dt38EIxWIOn%1Dfj2b8T!~6YUzo%W;uEjc(%yY2)pMhb!7`xd#gK?yX%Y7`zwsb bGHgs7FrvK7-0b`e9qpVfU2T0WT>t<(Iwfoo diff --git a/samples/help/contents.gif b/samples/help/contents.gif index 3dddfa3dd5f0c652e8b27cd6c29e1fdd49ced5a8..723174f81d04d16e94016186ac0322dcddb603c7 100644 GIT binary patch literal 996 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0RsaNgBYV=Gz5lX2>kxA zV8N1xh6Z3tW&ovR5Cx<mX<G3o3nK#qH-ipPlmV0{7&s0xh;ztzY*=uxnL}7B=ER1D zhuZ~|rC1mo6pnTY8GErDXmC8*FXe3Y#N(o}$3zXmNg)dwo-p-jCP#faF-g^PhEd?U zHJO)_&rPwe{C4E0u`<I#r%tiE5uYCg&h~b-%e`5+>e34SwPCqkp^L+21?)C@%eigo zjb6XYK{ltit-ZayK=RQZsqlw)b_u-S7xTMFKYoAy)o)vOlz%vRFz5Xto6e7mgSU6F l8>#t(=cJr!`K{OHv%&EGv6=dhWPNvSd3kw-DjN%fH2`phKPvzL literal 231 zcmV<D02u#ANk%v~VL<>G0Pz3-zrVld=jU&4Z(9HWEC2ui06_p40008OjE||y?GK}z zO&EZ)-n{z{a)K3v=81;mmA0<AmhVhw@iyc`&3|{61I~6YqK~98Vw5OmQ-xfDbjF=- z8N_A**6fx0#r(KaDON}}o43Sv(iTm3lx}qOEl<})aVL6>S4Fj_r^UyThZDG{h6k9m zHI_(7spd!5_$SH6m{<Auh$$AQ#YFX|N5^T`76u^M6AJ<hP-}aOo2$Fa+xtrD8!SAm hOG|u=TnwDd%p5ZU9W6agU2T1B9e};f-Q8UP06VhvYa0Ln diff --git a/samples/help/demo.cpp b/samples/help/demo.cpp index ff02c60120..ed5eb84f1d 100644 --- a/samples/help/demo.cpp +++ b/samples/help/demo.cpp @@ -39,20 +39,29 @@ #define USE_HTML_HELP 1 +// Use old-style HTML help if 1 +#define USE_OLD_HTML_HELP 0 + #if !wxUSE_HTML #undef USE_HTML_HELP #define USE_HTML_HELP 0 #endif #if USE_HTML_HELP - #include <wx/filesys.h> #include <wx/fs_zip.h> +#if USE_OLD_HTML_HELP #include "wx/generic/helpwxht.h" +#endif + #include "wx/html/helpctrl.h" #endif +#if wxUSE_MS_HTML_HELP +#include "wx/msw/helpchm.h" +#endif + // ---------------------------------------------------------------------------- // ressources // ---------------------------------------------------------------------------- @@ -88,15 +97,21 @@ public: wxHelpController& GetHelpController() { return m_help; } #if USE_HTML_HELP +#if USE_OLD_HTML_HELP wxHelpControllerHtml& GetHtmlHelpController() { return m_htmlHelp; } +#endif wxHtmlHelpController& GetAdvancedHtmlHelpController() { return m_advancedHtmlHelp; } #endif +#if wxUSE_MS_HTML_HELP + wxCHMHelpController& GetMSHtmlHelpController() { return m_msHtmlHelp; } +#endif // event handlers (these functions should _not_ be virtual) void OnQuit(wxCommandEvent& event); void OnHelp(wxCommandEvent& event); void OnHtmlHelp(wxCommandEvent& event); void OnAdvancedHtmlHelp(wxCommandEvent& event); + void OnMSHtmlHelp(wxCommandEvent& event); void ShowHelp(int commandId, wxHelpControllerBase& helpController); @@ -104,10 +119,16 @@ private: wxHelpController m_help; #if USE_HTML_HELP +#if USE_OLD_HTML_HELP wxHelpControllerHtml m_htmlHelp; +#endif wxHtmlHelpController m_advancedHtmlHelp; #endif +#if wxUSE_MS_HTML_HELP + wxCHMHelpController m_msHtmlHelp; +#endif + // any class wishing to process wxWindows events must use this macro DECLARE_EVENT_TABLE() }; @@ -139,6 +160,12 @@ enum HelpDemo_Advanced_Html_Help_Help, HelpDemo_Advanced_Html_Help_Search, + HelpDemo_MS_Html_Help_Index, + HelpDemo_MS_Html_Help_Classes, + HelpDemo_MS_Html_Help_Functions, + HelpDemo_MS_Html_Help_Help, + HelpDemo_MS_Html_Help_Search, + HelpDemo_Help_KDE, HelpDemo_Help_GNOME, HelpDemo_Help_Netscape, @@ -173,6 +200,12 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(HelpDemo_Advanced_Html_Help_Help, MyFrame::OnAdvancedHtmlHelp) EVT_MENU(HelpDemo_Advanced_Html_Help_Search, MyFrame::OnAdvancedHtmlHelp) + EVT_MENU(HelpDemo_MS_Html_Help_Index, MyFrame::OnMSHtmlHelp) + EVT_MENU(HelpDemo_MS_Html_Help_Classes, MyFrame::OnMSHtmlHelp) + EVT_MENU(HelpDemo_MS_Html_Help_Functions, MyFrame::OnMSHtmlHelp) + EVT_MENU(HelpDemo_MS_Html_Help_Help, MyFrame::OnMSHtmlHelp) + EVT_MENU(HelpDemo_MS_Html_Help_Search, MyFrame::OnMSHtmlHelp) + EVT_MENU(HelpDemo_Help_KDE, MyFrame::OnHelp) EVT_MENU(HelpDemo_Help_GNOME, MyFrame::OnHelp) EVT_MENU(HelpDemo_Help_Netscape, MyFrame::OnHelp) @@ -229,12 +262,14 @@ bool MyApp::OnInit() #if USE_HTML_HELP // initialise the standard HTML help system: this means that the HTML docs are in the // subdirectory doc for platforms using HTML help +#if USE_OLD_HTML_HELP if ( !frame->GetHtmlHelpController().Initialize("doc") ) { wxLogError("Cannot initialize the HTML help system, aborting."); return FALSE; } +#endif // initialise the advanced HTML help system: this means that the HTML docs are in .htb // (zipped) form @@ -246,6 +281,15 @@ bool MyApp::OnInit() } #endif +#if wxUSE_MS_HTML_HELP + if ( !frame->GetMSHtmlHelpController().Initialize("doc") ) + { + wxLogError("Cannot initialize the MS HTML help system, aborting."); + + return FALSE; + } +#endif + return TRUE; } @@ -269,12 +313,14 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) menuFile->Append(HelpDemo_Help_Help, "&About Help Demo..."); menuFile->Append(HelpDemo_Help_Search, "&Search help..."); #if USE_HTML_HELP +#if USE_OLD_HTML_HELP menuFile->AppendSeparator(); menuFile->Append(HelpDemo_Html_Help_Index, "HTML &Help Index..."); menuFile->Append(HelpDemo_Html_Help_Classes, "HTML &Help on Classes..."); menuFile->Append(HelpDemo_Html_Help_Functions, "HTML &Help on Functions..."); menuFile->Append(HelpDemo_Html_Help_Help, "HTML &About Help Demo..."); menuFile->Append(HelpDemo_Html_Help_Search, "HTML &Search help..."); +#endif menuFile->AppendSeparator(); menuFile->Append(HelpDemo_Advanced_Html_Help_Index, "Advanced HTML &Help Index..."); menuFile->Append(HelpDemo_Advanced_Html_Help_Classes, "Advanced HTML &Help on Classes..."); @@ -283,6 +329,15 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) menuFile->Append(HelpDemo_Advanced_Html_Help_Search, "Advanced HTML &Search help..."); #endif +#if wxUSE_MS_HTML_HELP + menuFile->AppendSeparator(); + menuFile->Append(HelpDemo_MS_Html_Help_Index, "MS HTML &Help Index..."); + menuFile->Append(HelpDemo_MS_Html_Help_Classes, "MS HTML &Help on Classes..."); + menuFile->Append(HelpDemo_MS_Html_Help_Functions, "MS HTML &Help on Functions..."); + menuFile->Append(HelpDemo_MS_Html_Help_Help, "MS HTML &About Help Demo..."); + menuFile->Append(HelpDemo_MS_Html_Help_Search, "MS HTML &Search help..."); +#endif + #ifndef __WXMSW__ #if !wxUSE_HTML menuFile->AppendSeparator(); @@ -331,7 +386,7 @@ void MyFrame::OnHelp(wxCommandEvent& event) void MyFrame::OnHtmlHelp(wxCommandEvent& event) { -#if USE_HTML_HELP +#if USE_HTML_HELP && USE_OLD_HTML_HELP ShowHelp(event.GetId(), m_htmlHelp); #endif } @@ -343,38 +398,111 @@ void MyFrame::OnAdvancedHtmlHelp(wxCommandEvent& event) #endif } +void MyFrame::OnMSHtmlHelp(wxCommandEvent& event) +{ +#if wxUSE_MS_HTML_HELP + ShowHelp(event.GetId(), m_msHtmlHelp); +#endif +} + +/* + Notes: ShowHelp uses section ids for displaying particular topics, + but you might want to use a unique keyword to display a topic, instead. + + Section ids are specified as follows for the different formats. + + WinHelp + + The [MAP] section specifies the topic to integer id mapping, e.g. + + [MAP] + #define intro 100 + #define functions 1 + #define classes 2 + #define about 3 + + The identifier name corresponds to the label used for that topic. + You could also put these in a .h file and #include it in both the MAP + section and your C++ source. + + Note that Tex2RTF doesn't currently generate the MAP section automatically. + + MS HTML Help + + The [MAP] section specifies the HTML filename root to integer id mapping, e.g. + + [MAP] + #define doc1 100 + #define doc3 1 + #define doc2 2 + #define doc4 3 + + The identifier name corresponds to the HTML filename used for that topic. + You could also put these in a .h file and #include it in both the MAP + section and your C++ source. + + Note that Tex2RTF doesn't currently generate the MAP section automatically. + + Simple wxHTML Help and External HTML Help + + A wxhelp.map file is used, for example: + + 0 wx.htm ; wxWindows: Help index; additional keywords like overview + 1 wx204.htm ; wxWindows Function Reference + 2 wx34.htm ; wxWindows Class Reference + + Note that Tex2RTF doesn't currently generate the MAP section automatically. + + Advanced HTML Help + + An extension to the .hhc file format is used, specifying a new parameter + with name="ID": + + <OBJECT type="text/sitemap"> + <param name="Local" value="doc2.htm#classes"> + <param name="Name" value="Classes"> + <param name="ID" value=2> + </OBJECT> + + Again, this is not generated automatically by Tex2RTF, though it could + be added quite easily. + + Unfortunately adding the ID parameters appears to interfere with MS HTML Help, + so you should not try to compile a .chm file from a .hhc file with + this extension, or the contents will be messed up. + */ + void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController) { switch(commandId) { - - // Note: For WinHelp, these ids are specified in the map session, mapping - // topic names to numbers. - // For HTML and external help, a wxhelp.map file is used. - case HelpDemo_Help_Classes: case HelpDemo_Html_Help_Classes: case HelpDemo_Advanced_Html_Help_Classes: + case HelpDemo_MS_Html_Help_Classes: helpController.DisplaySection(2); - - // if (helpController.IsKindOf(CLASSINFO(wxHtmlHelpController))) - // ((wxHtmlHelpController&)helpController).Display("Classes"); // An alternative form for this controller + //helpController.DisplaySection("Classes"); // An alternative form for most controllers break; case HelpDemo_Help_Functions: case HelpDemo_Html_Help_Functions: case HelpDemo_Advanced_Html_Help_Functions: + case HelpDemo_MS_Html_Help_Functions: helpController.DisplaySection(1); + //helpController.DisplaySection("Functions"); // An alternative form for most controllers break; case HelpDemo_Help_Help: case HelpDemo_Html_Help_Help: case HelpDemo_Advanced_Html_Help_Help: + case HelpDemo_MS_Html_Help_Help: helpController.DisplaySection(3); + //helpController.DisplaySection("About"); // An alternative form for most controllers break; case HelpDemo_Help_Search: case HelpDemo_Html_Help_Search: case HelpDemo_Advanced_Html_Help_Search: + case HelpDemo_MS_Html_Help_Search: { wxString key = wxGetTextFromUser("Search for?", "Search help for keyword", @@ -388,6 +516,7 @@ void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController) case HelpDemo_Help_Index: case HelpDemo_Html_Help_Index: case HelpDemo_Advanced_Html_Help_Index: + case HelpDemo_MS_Html_Help_Index: helpController.DisplayContents(); break; diff --git a/samples/help/doc.chm b/samples/help/doc.chm new file mode 100644 index 0000000000000000000000000000000000000000..6e9157cfcbfc93d39bb425f11bb54d27609007d2 GIT binary patch literal 13434 zcmeHOXH=8jmVSeXfK(|`1gVNZ2!t9?K}zTlLXake0HH%Dp{alYk=~0U(u;zEC{+<q z1f&XnGzCFA(gdYRzX|HSGjs2(JM&}Knjh?Uo$T}Ma?U=_%8z8P^J=0D;l}^~up$l+ zaftdi+fz{j0K*>WX7P<4#!MO@yNz#Vk@3G^Qanl6eks83w?;Ainsolw`=mvQa$V|| z{`0AcGDMJEDB_?d8Hw>^L`AY45QStS329EUQIP|HQzDs#7;g__#@4TzNVz2cA3^A< z>wsxUS^uzuAVfe3;n!3((NIN#2#?X(hY+Pqtbph`PIO&W1`Ue~P(k<&QAkZabwd!L zN0$I5CK;L<qSSN&0!0oR5ux-EnkqzR2bzE&LL;OOF&;#CuN_SG3!;>DK!h#`;S6yp zV@*9(ePct=CtHHfNr(Vk(+=;bi*a-V5rTz_q^TeR`pR0GdWI;_5`79M3q-)!_==Yo z&c+dgcl5#PIJ!A|kqYPfmkxv{&K>KC_XjPVBxfW=Xk-0-ah|q+Ph<TjqcX}9iv<m% z;&l%9`cDa}7(52F$a97HpR#l@?w~~sHTyp~{$9bNGY=KS8e`)uX76YRYBvl+(n4%- zZg{L4-s{j*OBH5I39-f5h&edefF6s7i~T{)pmNJFk>3dK3W_rg_M#$1N{BfSVWLi$ z*dc@-!nEtRp@&fN5N3+rmOF$}hcMUnw%Q?-K7<c1+&)1AvBP=#VmxgR%lJz$Oz{N7 z+x-wUx`x>?%gd9_ZRn1%!9w&fu0+ng@Bna8=s(&G@i<S6Jr<&CsDg8K_r!X6VQnEQ zzm5mwa_3u#{*R(PaW1620H-q-{%t(5AU91nI~-t53Hi6dC{K)=7x9>`ki+UPo<sjH zQf|n?RiJV(DRD4NRZ;>hA)!i~DMMw!;^J4tRbUcoFcn#q0EniW7arqggC(7S^p$k{ zKi&d~^}^y&7;6_S&=M$4-0(<_7&v0!h=C&pju<#%;D~`E296jwV&I4Y0H`H9Nmd8) z0IdVJ0eRpYz)kER&;Uk&8(;(A09U{r@C2}c7xBRYwnV~c0A0WkQ2Cd>8-OeTC;Fg( z8~_8P0C50J)T)3aAVHi-5Fb^dZQJ1&?-WF(V`id4>R9|4zZ)F@shdI#kOSZgyK+<j zE1;oqh36{P)5{U(#v>&rD<vi;D-I?41prc?g(RfRKiNFzcSBDXHT;3Z)hU6)f6sVV z;>y&32G+%$M-}Ue11N}V5Iw;0UlAk+aDr$v$U7H8L)0XpCH7TN{D!)b5XNJqC5iY@ zNF5W>gk<~EJ^AnSpE!~}k|PF=7&v0!h=C&pju<#%;D~`E296jwV&I5@BL<Eb`2WcO z{qJ4?<>8GCUaYS)0HA@Y1E1x_;gq2^!Io~7qHqZcLr%^X6E<J-^4i)CyCt{JuJ60* zuVpX4>RjUsH#?<@RMxUHlF_1$5H7xSGr1lG<Vpf?e!$)eSPi^UeIsaoxpq$N%iNQ1 zJY(e!k`gEEsn3hJO1C`lZ@rrq>*Iy1_K~T5HS9Zm;Pb$|R^-8j$9BVG;l}q0O%tV0 z@x+pw$dU<8z2!iN@rkPLHf|H|WdKtARtTKh-A`3@sngcagiIpIrkKkfX{pk(y$O#3 zm?peUX4-0EPlnS?{P?*5h@PF*T#ZUDr*>NHNtzsA7yViw**5*-qfsapo7e0fwW7K@ zl~(O!AVg?Q@36tKr<U5Mmc&t(#L_L^lws0OE;b<RZEmC5m{p2PcgTK2;QLy7k1$sI zQ2x`SVwp9$8t)<hS5-GJUfX9ciMM_**W@240mlbcyp%|g@2QXl>`e($@2c};Yih1k zddpQ*?UluPkDhA``4X?4zj~&EvrBZ(X2JgMFe`hy^7y7fMu=(V3Z_RvwpsD4AM*iN z)p<eXUDr}h7sH!!=Lia9=VztwIt$z#6TXxC1hy>tuT!&=2S1k~sMlf6;rlMJP@5O= z3ZD}cn3lqA6=p&-1oG+=SCs}aY^M`?i&8rk@bz|?>@#;M_W2FYb)|hXmvr0eQ;L;b zNc8HUG}S))O<CWSC0MZtT)f50{KiNh&7Bcu9c_HMsK1g8H{~eC&PaAPG296H%}JfM z`q|_>PjSK9K9Thl8>_wXiRtE7MLAoqo=x}<t92(FI6Z_0`B<g&`TK0Vs((|DlG!&O z65H~*Zre%bv=?~ZrvP!oc-x-qvkGA&Lk3X-ro)O~UR55m$Ahm_*;|Uk2vWB@Tjakc zEtuL&_73+*<GZpOFMh`LY|4c8(`9*YP90QjYMmXs?3pQZ&uYBb5d(Ie<1R;cGT(>Z zHd|b?oZn37_6#lEoeQdSx+?EL-<|TvCA-_<M&WS_D&O(^{3VDl9h>wne~g;+(voSS zvuD1mZ>+ppVB!szDAi95ubVSA1fQf<q*ZCDYFnFKRE^N8o#81c@zraZH1(=)6X(NW zB6mvf#Ik?R%;P<cilhj)OkQ9#aI!v^TN(~tqI-YMeuBN2|KSPN<JGy#iO6p2wY7ey zuN$<Ji{^$0;dre8A33<%cNtjjtpDX~6_=O{g(#>N2aG{8@2YlHUOciS<a^0<MQlS1 zA773%Ef{+c9Xz3>$*aF)UeH!v5+iNmpXD_^CTAsDt@*z8pnR#R$5U<}_Z?@@zyF=# zCym+lM>kJfG%i#<Doj*v*md*e_1>v_cf!-1L9w#$8#h$a>tif@mVx`WCDSLK%=Zy) zhHKnn$@H@n!}~p4a|1NvXRpI8xdu5H6m@b8v_I}`t?d;FwafF~WLA97c>MmvL-~;T zbW8uiw2T}p`5SkN=4XO;W)UOkfvU14z4il|r1>!Qp)$MNsBL+UhNYh`D`5{S@>GY| zOkqo%FMiC$j`Xfw>XlqSRarQi6_q?K?~yzwBg<TIJ}^2cph8n}(JFA{W@6x@IYa(n zxP|3?eXkfT14wE$M7QbFMf?_0oy$Yvtr!evxg8hs9JXp{@ibKjw|X0ZHx!v&2)^$< z<An5(U9?>F7j(!{Jor?*_xj|64VOJG+lBml<UWT9+!P`P-`B9!PbR@qf*h-bpU! zCyx}2RG+Kr*Um*>PfP6+LoYSpTZ^^1If9>CS_j!z*gWVfay%s+=<c(=Sq>-c`?K12 zS=Z?=IwE4N@I#3^0m>*Irs9U}^U>gWrT8AgC5G2IbkKO-6TYns;qs-KUEp$=_;MOL zMR)p8-oE68TbDrJ{X#EQytGExJ_#AYGa%R$4R`BmPiE-OPCmNWuDG}MFyEVTFFWUE zU-v2Y*5g|_w<!E`8Xx{RG1zrO<x+~}7YR<W`R4pW!J=rXx)Td8kC*HBUZwQLiAK0A z>o?6moloi+Fn{<>jv;L6US`E)UJ4|wuHIAmDX!Wt<}=d*9521n!kmG4)5Q6B-m}bv z=F+QX>XNEq-6g-lmdabH&iq4<o$u3PB380@g<~eJclW<x`+A(UHmo`WPxTSETb9av zCu*eeMKbL-?zob%(drsbw@&YaW-lE20l0nDxVb#*8=@$7XMSD&8OwY|TuxtV>D~QP zq1qy48<;)K=^?95b5~EOo%YbP=P)I!solC#5eit<&c^NYTidI8sR@(wVvAqSKp>^% z{e~i^={hJfHo3K5p0;mh<vdNNZs3}b_wgR~j1Q#Nv^_7Jc6OZlacQ51E>D@Io&6|w zgKs!xflxSTJ0crZ-h6$<Y+a^S;kaxG3epiN4L@1AT6RfjLS{g#l>buoePorJsHR`0 z5#G50d)i{-`~4-!!KEaoUB%4GQ;9|=+-RH%KSR5_Qho})^nHKL;KQ?F#?t5K<~oyh zk~mQwSOpESGX>=MU3zob$+z*r-kP~1#-RguQG$=dHd8AI$dYV&M9TST9pM;-4PoWE zH(0i-VPY~<fnp)XZH07@?Q(D>$Qa{}EFCCh>5O`w;9@q6Gb&Hk{wY@1Q@JQ3<EK0t z_L=W=qq&FiWs^9TAJg7<$wu2J2kQ*`L-rW(Zxy1w2c*B|zji{VBxgvS_ZoUvm8ZZw zDatmq*%tU*?!&XLf|QdMb2GdZIr{Yl8T-#qD!xXeg%e%UgQT5X1aVq|8^$;ca<STQ zK}>zq8lzhg|D?-DSSIl7r?(bzeXJWYX8pSvzAhSKhLNscriN-i&iLx)-G8*~25V<& zF=Es1t#;Yfx$a$usX;#NW7d5g3BUa`ZhL!DqHRSwIRMNq=#+aQ{G)DyB41mJyczyn z5VDBvj<J`ACVA>3UB(O_HQ@^s@1o0#Q@h+{I__{ZZAB`mI11|Pzw7^yl>hKK)QSQm zOWBHm_H}IqMZ3^0$}8<sNYyoh)I^;8l(fQBKk~Fh7?Rt?8f0qmxkc~`T^idO6)Ihs zWbTji>!)#Tn!T$-{$gc_rtl6Wv)l(l8#x&RW%qf|-dX74Y<P=h?y--pX-O1`)Wdw; zlL4_<n=iuU?*_pa#WRrMcS28O>~NVQKbN>IH)B2|V6KG#dku`L>o+~W7LjixnY5pk zlGshOBLAtDUMwo2bpCzRMFMjkf=7tLB(Xb>eOln`=>|}n1{`6fL6HzKr7>tNN~N#G zHmzAWXx)yslxz@Sa_S6q{vxy@b4;78k=0;dIgwR+zbVl`8`(lcLRrm;iqCD66Yu?K zZvV2qlXHel7@>EoidyT*DN&y9T2W=4%o3a?%I_&+ueKru1*_R8>12+%_IwpYObcJ> z5}~TFG^NG}%CUzwRUgZh>ZE#)c9b?ZAwZvAVDc!kHg!rySaQS*8K;>Oii(x*aR?`u ze9C#$WfG~A&C=O-Ek~D@g?iwl@xZZw;V}tnrlwA$L*Xr}SxFbNWK-R-m5!o5_uvc! zjL<DI;lo9H-V`G$*%hHD#X9$a?-OTSru~IeRT8<OrK$z42`=g2?tB)_;WIx`XA=fw zG-_IkwC5u8aj%BmiPk6It;hJPy4tz{*6mMxp!6oRn}t9XJJogqpWAspDIqm?Jpn5L zLylQKc0CJsC1?Wde4;q{d5if3h9uP22a)+1jn+C>1!kutwEX$D^gNSo@k%0*!>^!F zif5hiWU;3EE9<v7@8J5HgJYc0trhlB?p+IfXT;l^a^a>X%tBF7jaWtlHc@NpJT*~F za=2Rb^JhW^tgNB!e7WMLP0a8plSU!NC^oFML5JvNKWoQhFN8dSYaW-!lwZ6NNmhKF z;~sRerv2k?ys@L9TAj**LO~e)3d=S#RnX<eu@%%KJ=mrJH2{wZ*qIEFM*1RIeOZ{Z z<lD}V*P{sVV%9<yfl@O@{^YN-@{#^#$3si%8>KY39Aj%tc#L|s=HK1IA5$2~VX{8H zS4Q^1w49^$&DRpMn;!gT;sM?wlJ%<54iBcCKwhf1ax)iX#$F1!C)}~1T`v90yi35z z@5cH><hcZjw(5~R=dN9+_@F)7HVz@HH$#<-YiN_nf+r?n*VK3-;?NT|cA}=eaZj!o zSHZh|cWNd@$Cqhr0oN(N$<bF=(W7@Hw4L#G5;2f+d+~9rw6?JqJfYV(;0_<Yzjux= z&}CzH_Iqsf<)+!$(L3a0(4iVFa_(b#U~}0A+ceM_e>qlv>8YWr;$q#M5somoV!&Kw zZ%LW{>drWahWq0l96woEOlghB-X7ef`b*X~cHbU8=)TN*;9wD);VjTq9gL^NyzDMp zsWl(ee0upW_=w!t7n&9ei(0Xobt>B_bV@Mf&Uji#!!2LhjoMv7dbhw3+BdKKE?z`C z(bN0mx;Z<*s|-KdE%OJT%1sEV)@eBQqF#<S%Hy$4($_NN<BMQuo7e#U-iN$9Obfgb zcbB)PH`Cw4{A}$5=hI^S?mI{DZ_Vh|MJ`lnUMYMOM2YfxeXwg~JL(^c&xC}}%1xdL zWQop$Pmgono{af`*;tpNE8KWzBw>?~vGxwcrNbs_363t%no0<el$QU|s&Q`TqL!Xx zZ}<;y&xcxf4Eu`SwmS8D<~yaZJu?o2A?=NYapzbIrBc=VA5XWkEWm<$WBBn;(liDh z&*U1tgt<?9#+p}W@cWLykW2Gh-psXLtn=$!-vf`s>wO^MBPK26qDz5Ikuq@1TgLze zieN6rH={k|kgIrJZ7!~s*voKiM?U}Nh@$6~|DfMr+5z>w0V`Gya03@~q7&&oJluSq zIb5svk_PKA%eZxKT0CTPuV8t2zajtNqpQAh?0Udk9N#pmQ8ZaZw$Q&)En5vX`>c$h z#ge+Dcy4CtvS~S`5|p6yabxY)T6+h~Af`VtSG6Ci#NE^y*jx9&hnL~ln9L^)sF19x z`t+4YShP`11kYO^@u&8~_QIWW>J=T1r%y?g+2oWRuQ{P!*m1px1<F2AF|fWDkVMVV zE}~+{-_*+-PbG}}tRjWGK027$SNASi>0DaTT}8YGgmcf};>-ByTXbCWukVB+*6H#M z18n2U9}qfyH9X{R5$u-UMLutn5R!To(PmWGgRq;pvq%wrH^OuGo}B$Q-)7toKMMzk zUiu)X&vh4k7xj7t0&Tiq3d3_Qap=*~+Lf~KB};>Nc9QQSHYA?jw0jC08I!D`Et8h_ zb)#roQ-A(uiZ>%&K$7SAOm^zsto(a*-?Kg?wvz=c&&j4QuP68<Yd#O1uC52wQa@TA zeQZy*S?jv8YI?A?6_{UQ!4Wi?9J=^!u&HOYAO1aiO!lw347<XqUeycb==5AfIDL-& zkZ1{b$o0jQwYQhFCstE~qpw@9n57v6j&feix>Ul}vz5D9Mb9%Bsh2Yybd31Y!v2CT zTF_eRN)yE712g_R2gljjhz`2WR!6i<&y_00$fS`3bWHQ*?Sr(&7;%%SHjdl$SDq#n ze<+%0wY$v;Gs{}D;;cvJ(LWW8moUTS8`b_bkpChj0lZ)v&$OSE7Qeiqz@HnGK2?3c zhVuR}1G>a<{1~z~$kEJKwm<FM=Sis$Np$sAfsk1BwS^YE?B>{VJAMv9Tj{bQRV2CB z;KAw8WyPxwE>Qd~NOQf&A?KN5y>OOX$Yy{3SbdP8KiW9SqZ3|&zN+YK5O!4szulZ@ zq23;NeW{D})3=}GJMm>ZDY|l7``jBJzBoGkwKAXp8tUd=<5U}0EKjAve67&o`n)o# z^L{_Q$4h5@K$48_%fNnz>We)gk*v=!F^V!u9UcaP66v==n4%ENrWe-ei`20HY{0Pt zvu`tPkH3)%Fi<M-kP#@!NpZ+cM?q_*2?3}qB~#$z#BS=HofjuBFK$+azeGfKs$XNS zv5iemI1{0bpgFj&<0q_TP7v0h$&F(uEcn>_F?x~dg)j$A8&`=RM{?`^eQ^0QLMUeD zLg!+7cI!%<wx!4pV);FC8*w8-hB=gTxUG#bIRQ1tdCY$M-Tu%t(mws`L%%o#c<Uw0 zB^L1Y)0;P$C_^7l=Bjb4c|G%<ICB$)%rk9Kco&eD+Yyklf3_y1vHsw0rScPZk=N7` zSC-6>$Kz;Z(c9LOfik;+ADoR(AbyyXC^k7v%9kZJw0Ym%=-U9Fs{HwUS0!t8K9hd0 zbZ&C-K%7kdvP(Jt*__i-DPV4B%U*+y%LyqPNm!FO>>tdK7$l*!6aRR7hjgh$h&cY- Qm9aYYyDxU@xBjjE2IMsWO8@`> literal 0 HcmV?d00001 diff --git a/samples/help/doc.hhc b/samples/help/doc.hhc new file mode 100644 index 0000000000..347c998cd7 --- /dev/null +++ b/samples/help/doc.hhc @@ -0,0 +1,35 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<HTML> +<HEAD> +<meta name="GENERATOR" content="tex2rtf"> +<!-- Sitemap 1.0 --> +</HEAD><BODY> +<OBJECT type="text/site properties"> + <param name="ImageType" value="Folder"> +</OBJECT> +<UL> +<LI> <OBJECT type="text/sitemap"> +<param name="Local" value="doc.htm"> +<param name="Name" value="Contents"> +</OBJECT> + <LI> <OBJECT type="text/sitemap"> + <param name="Local" value="doc1.htm#intro"> + <param name="Name" value="Introduction"> + </OBJECT> +<UL> <LI> <OBJECT type="text/sitemap"> + <param name="Local" value="doc2.htm#classes"> + <param name="Name" value="Classes"> + </OBJECT> + <LI> <OBJECT type="text/sitemap"> + <param name="Local" value="doc3.htm#functions"> + <param name="Name" value="Functions"> + </OBJECT> + <LI> <OBJECT type="text/sitemap"> + <param name="Local" value="doc4.htm#about"> + <param name="Name" value="About"> + </OBJECT> +</UL> <LI> <OBJECT type="text/sitemap"> + <param name="Local" value="doc5.htm#chapter2"> + <param name="Name" value="Chapter 2"> + </OBJECT> +</UL> diff --git a/samples/help/doc.hhk b/samples/help/doc.hhk new file mode 100644 index 0000000000..6a8020524f --- /dev/null +++ b/samples/help/doc.hhk @@ -0,0 +1,31 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<HTML> +<HEAD> +<meta name="GENERATOR" content="tex2rtf"> +<!-- Sitemap 1.0 --> +</HEAD><BODY> +<OBJECT type="text/site properties"> + <param name="ImageType" value="Folder"> +</OBJECT> +<UL> + <LI> <OBJECT type="text/sitemap"> + <param name="Local" value="doc4.htm#about"> + <param name="Name" value="About"> + </OBJECT> + <LI> <OBJECT type="text/sitemap"> + <param name="Local" value="doc1.htm#intro"> + <param name="Name" value="Introduction"> + </OBJECT> + <LI> <OBJECT type="text/sitemap"> + <param name="Local" value="doc2.htm#classes"> + <param name="Name" value="Classes"> + </OBJECT> + <LI> <OBJECT type="text/sitemap"> + <param name="Local" value="doc5.htm#chapter2"> + <param name="Name" value="Chapter 2"> + </OBJECT> + <LI> <OBJECT type="text/sitemap"> + <param name="Local" value="doc3.htm#functions"> + <param name="Name" value="Functions"> + </OBJECT> +</UL> diff --git a/samples/help/doc.hhp b/samples/help/doc.hhp new file mode 100644 index 0000000000..ef2d0ac236 --- /dev/null +++ b/samples/help/doc.hhp @@ -0,0 +1,27 @@ +[OPTIONS] +Compatibility=1.1 +Full-text search=Yes +Contents file=doc.hhc +Compiled file=doc.chm +Default Window=docHelp +Default topic=doc.htm +Index file=doc.hhk +Title=Help Demo + +[WINDOWS] +docHelp=,"doc.hhc","doc.hhk","doc.htm",,,,,,0x2420,,0x380e,,,,,0,,, + +[FILES] +doc.htm +doc1.htm +doc2.htm +doc3.htm +doc4.htm +doc5.htm + +[MAP] +#define doc1 100 +#define doc3 1 +#define doc2 2 +#define doc4 3 + diff --git a/samples/help/doc.zip b/samples/help/doc.zip index 72bec9f9c4825c87aeb88f65ab1509a3d709752a..f907771079285737de6408286b75f67b158b3b3f 100644 GIT binary patch delta 1511 zcmbQBaYt)|IZwR^0|NsG!=8{Hjb%0laq^4|49}Pu7}$WKr3HHFnQ6t}OEz!tDM<)O z_;HSbi8tX6!!oG@YnUAho*&p0EdP(0k@@idKm)Eey&r!Q4>qat^70;-a^}PQhxRjm z@ux91KJpiHV`Ix>lMV1=c*@DvcbMmqjFFtQm`u(yfools8|xDvJ}hHQU2iETEh;JD z(z`c8%)(&TSFH~5y_JbOj%<#+Sv<@4>2i1X-(TLCKP?c`w?4gUPSyF8w2i-BR+dd| z_fm15<bSs4>a^~;k&~WmK2g5$dd&JuPwR?*nn%T2eoegk^lMY~<ZmTDmn?6{PuO+h zOUaALCoCnu?{rziU6k~EO8xz7QAvAkAD$`ufB$tz_)P6%?=}DbJ+n1f$$F#e%Z;;U zZfkwG_;TvA(@~4}i>l6_m3}WqIC$3oPoKITTul{X;<?5U;LXee3B;|yKzx1GiH{o? zh?jtY$N>z*q{QTGe8E^xW;lLD3rBK;u^tkR*DIE^m@rlI{@$A8pBq_OxidQ_t}|>y zl}B_&;<byX4zy(db-ew#BE9~~zKa?g_n+Rr+voeGwhJdCx2;~kmM>m+lbP>#m&ki> z_ofQlKlQqQV(;#C4~^&Fe!EgWPo{ff{hsUD&zCJ<p8jIfW`hW3q#*mmJgZn^@mF3( zXgZt%48p6cdQ236LHGn1ggn3?OwP|MNzE%M#uto;P-GVPFVDI-p`+=(yqHeJr3)7r zd`|K#m~w`}^Wp@PwLd1ePHb$P?Z`ew*rBqi@v%a)MSIWjHdglf*_JI^ll*cbDt5#= zM0T|vbbOdGeZofZ(~WG$7yk`97v^uHr&aB9MPQD|rUef<gZtBpu1pu69AcX;!MZMb za;4?ZJ0h=7<-6BOX&dX5yb{?h{qbkugPi>E-FIfUuGU-oAYOXfZP8s8IbjF#7H^+( zd)mDhUw6x-6j$B8b^A8AihTXsiCpy+>C+GVt~K1>{pIoZ=kb5HmAe0IpUhr-Pkz(O zKRYZcs>OFtoaJBPcWULd`&GGi(me0wXRrM4ajpFNwCU5sS8Upd8n)|!VHq=3VDfih z814s#B{z^x%P%TVEK0!)%6f`(wk56<DJ&|zOLEJmDhnB@*;PyCF5XwbqHB3mC)-|M z?UKUP;#p;H7K)wCdXy?>Th+Gx-I*OrYKqn+ebo|MssBnm{q^_kqw{WU`t+&jafNAk z_oeCX($1BabJ98WcJ7;X`*q;ywHI1WoRzGeTai9{Z|995gZim&a~EC@l=hw{uYGmb zD&dWW@2#fKIp4?2&;QxT*btcdHlG)eWfH+w?oAR_aKN3Ffx!m^3P4=Oi^$jk-i%Bl z3=mzPfQfl>g0NKmaz3Df{QPWinnhNDEq#Mbg_ygMA2qcj>%<nD2%WzLkmGjpPhmke IX(5m_0Do3;od5s; delta 1177 zcmcbkH9=#8IZr(o0|;2n4OPEzDgAdRkPX6YKwMg&m!6sC?&)S>o+!m2!SIoRVgLU9 z&!0cf&(Du$V9)_7VE~CUFeUZ$uROgrsbS8RD20R_f1cfFy|lek(UNysRn|+bMMB;e z=kVP4Z1+WE-RZLtW(qz(q;{5xCgmpO7%jh8uRdwloVeO>pRyBATlXpi21N4BJ*oQn zZT6-IkBWSs^__qHv2pKz{Qw3A>i}<N7Km#rTHecut%wzW2y_7ma{zHtVsbXZz4kcV z3le8w+68j&TmHp!JSFNIHs9Oxn?I{bwB=c6-Q%g-^ma@;;B)<3@AF@N$G<S}d}?c6 zDEMHuX#MHMpDn$aW_hjns<G5>_1OnO(Qmj`+dsAN(lS1qRWyB1@9FJV(ysl^JO258 z)c!SBC$psox3hl_cb8x*nLKrIhww5n$;>o!i|5-lHNQVUCi&}zWY){h9chl1Rl*h9 zPF&&G{amXwl{>V0we^(Uue&e**6ulGl;a~~uxQVjJ8%B*$iAJU6PsJB8w(8x5wN!_ zCvmAR-pa=ajm1VFH;~`>(Q}|A2=f4Oa(-S(YF<e(B5WLSgbhfXf$0D&Y<wjkK~n?{ znl@n2tlK&5y-)f_vnS4H>&vGxpDWW})W5_qX^KW#eQ;|`Q^~Qpd6Gxc7_YsV`upgg z9l@Gm9%i$*A1S*e=371`ujH$)|8>_w^{U=**R9K!A3Z*)U3kZeHuf1?Os9ExtbFEv z{fGL=V>7~k{^-yYTYl8#>vH$wnb*bG6mAN0GjRuGS9i}|z5Dd--(Ihzb!^snd)M^D z@XR@LM#h*)R@b)P7Z^6VvJHFB-n|P8Aw<GfFs|9M1Q-+`%nih8`9<Z4MJb37QN<A= zAaMq!T5yQ$Z(-bWtNXL4(F^{hJ0jEWznJ;zS}60kbxGd58?|GZ%^M#5&b#$B%j)#m zH058DrX+s+`A4%~EWM}F)UQxf`+HZ)t0l2gTV|Z?I3G9v)1<W7jY(NkZqGSfAMtjF z&!okVR3e-rIEp$}EZkv{d_Yjs(latsGGXS*nUTQw-YhL7%OryE4<e&Z_7PEVz?~<6 zegy&rAbtQ$3a}g!;LXS+!hlFXlh=qy)j#J2D#*{z2B#B<3W&Mb(iF&4h`As6P*WJP bPEeVG9`p#EOajOeG1*mAknKEBh=BnBilDrJ diff --git a/samples/help/forward.gif b/samples/help/forward.gif index 9c81e8c92fed7fe851ce02e7854dc26a58eae9b2..d8862174ed264064e4092accd3b9cef539651ad1 100644 GIT binary patch literal 959 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0fnyGXIEReKh6M+kIfS)hPHb3s zxLrWmYmUc6#fEMMt*jmnhsLHJY3Haf96?J?Hp|-2i-|Ny^_-?1d#FXTc$r6!p5d)K zGcGBgoU2&9ibd*+`o-D${aUf7wyeCo+&Es%)uQy}(Z*2TG}~E%ORlfx_IlKED>NZ; wbH-jL-q~hvBDNIFUuAn+=ylY_lIO=twXW(!Y|OjPCFiqa!^6Y8%uEc{09+_1fB*mh literal 164 zcmV;V09*e@Nk%v~VI=?<0Pz3-zrVld=jU&4Z(9HWEC2ui03`qz0007gjE||y?Z1Qp zwAzdF6*A}#V%!v#-{_g@)>Q-cu3}3Ku`2^Nfa3dZ+VyHW%gtsZ`jV7k@%j8Ij}~W) zc{NUP6)X3OWa^|{8nl?rh|gZ1@{(qofnsWu+nmFHSnaq>lB41zSVC9`a)_v*xHx0L S5h*!IS!o$ynW>ps0028gDN7ju diff --git a/samples/help/makefile.b32 b/samples/help/makefile.b32 index 98bc1c286f..18009827b4 100644 --- a/samples/help/makefile.b32 +++ b/samples/help/makefile.b32 @@ -10,6 +10,7 @@ WXDIR = $(WXWIN) TARGET=demo +#EXTRALIBS=htmlhelp.lib OBJECTS = $(TARGET).obj !include $(WXDIR)\src\makeprog.b32 diff --git a/samples/help/makefile.vc b/samples/help/makefile.vc index 3cbe3b33c2..723b606f7e 100644 --- a/samples/help/makefile.vc +++ b/samples/help/makefile.vc @@ -12,6 +12,7 @@ WXDIR = $(WXWIN) PROGRAM=demo +EXTRALIBS=htmlhelp.lib OBJECTS = $(PROGRAM).obj !include $(WXDIR)\src\makeprog.vc diff --git a/samples/help/up.gif b/samples/help/up.gif index 316d0d2a14b571bea2eb874efd04bfe509f53b34..870c89e80a826e3b225cc8fe9a30edf9c5a66c22 100644 GIT binary patch literal 998 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0f#WcPIEReKh6M+kIfS)hPHb3s zxLrWmYmUc8MFs{@V=tBk4vcQS3gSg?UKlR%Y*zN1W>fj;(a}CV`%O8V#mmmJDyQBv znOUrUdY)b7p%TfE<WsX;wdG=GmL&Ns@?GpT*Q<27-(3EUR##4aSao^5;NGM?9g}np z_6MXcGCdvoByvv1eJ&B}f}Gen<+rt#SZ_}_v)%vqI@ML?it&5Oe?N2Wl*mqONqVei lrfp&P=yaL+vexKtMaie;nK#$Ol;*#@ydrpYnS=m?H2|-sI%)s_ literal 137 zcmV;40CxXJNk%v~VHyA!0Pz3-zrVld=jU&4Z(9HWEC2ui02%-o0007FjE||ytzv+j zv|1owxcuhWh0?c)Avq0}dTQw^q7qBdoDA6WKJ*l>%gtCeAWZlgxpoy|ZDMRPr_m>p rx}08pS4?)u<%PW<QBYY9oyjHh?Q62&;&M&qj?e4yfxZ7PPyhfsDH=Ws diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 7898661a03..55b68053ff 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -84,7 +84,7 @@ public: MyImageFrame(wxFrame *parent, const wxBitmap& bitmap) : wxFrame(parent, -1, _T("Frame with image"), wxDefaultPosition, wxDefaultSize, - wxCAPTION), + wxCAPTION | wxSYSTEM_MENU), m_bitmap(bitmap) { SetClientSize(bitmap.GetWidth(), bitmap.GetHeight()); @@ -172,12 +172,12 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, #if wxUSE_LIBPNG if ( !image.SaveFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG )) wxLogError("Can't save file"); - + image.Destroy(); image.LoadFile( dir + wxString("test.png") ); my_square = new wxBitmap( image.ConvertToBitmap() ); - + image.Destroy(); if ( !image.LoadFile( dir + wxString("horse.png")) ) @@ -458,7 +458,7 @@ MyFrame::MyFrame() wxPoint(20,20), wxSize(470,360) ) { wxMenu *file_menu = new wxMenu(); - file_menu->Append( ID_NEW, "&New frame"); + file_menu->Append( ID_NEW, "&Show image..."); file_menu->AppendSeparator(); file_menu->Append( ID_ABOUT, "&About..."); file_menu->AppendSeparator(); @@ -493,7 +493,19 @@ void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) ) void MyFrame::OnNewFrame( wxCommandEvent &WXUNUSED(event) ) { - (new MyImageFrame(this, *m_canvas->my_horse_bmp))->Show(); + wxString filename = wxFileSelector(_T("Select image file")); + if ( !filename ) + return; + + wxImage image; + if ( !image.LoadFile(filename) ) + { + wxLogError(_T("Couldn't load image from '%s'."), filename.c_str()); + + return; + } + + (new MyImageFrame(this, image.ConvertToBitmap()))->Show(); } //----------------------------------------------------------------------------- diff --git a/samples/internat/internat.cpp b/samples/internat/internat.cpp index 5bbfb76410..e46910a920 100644 --- a/samples/internat/internat.cpp +++ b/samples/internat/internat.cpp @@ -105,6 +105,12 @@ bool MyApp::OnInit() // there are very few systems right now which support locales other than "C" m_locale.Init(language, langid, "C"); + // note that under GTK starting from version 1.2.8 if + // you set locale to "C" and then use ASCII characters above + // #128 in GUI elements, they will be truncated (it seems GTK + // replaces them by \0). You should use either "" (checks + // the value of LC_ALL etc. environment variables) or the form + // accepted by glibc, e.g cs_CZ. // Initialize the catalogs we'll be using /* not needed any more, done in wxLocale ctor diff --git a/samples/ipc/client.cpp b/samples/ipc/client.cpp index 4cabdc42cb..9b694cc696 100644 --- a/samples/ipc/client.cpp +++ b/samples/ipc/client.cpp @@ -74,11 +74,14 @@ MyClient *my_client ; // main frame bool MyApp::OnInit() { - wxString server = "4242"; - wxString hostName = wxGetHostName(); + // service name (DDE classes) or port number (TCP/IP based classes) + wxString service = "4242"; + + // ignored under DDE, host name in TCP/IP based classes + wxString hostName = "localhost"; if (argc > 1) - server = argv[1]; + service = argv[1]; if (argc > 2) hostName = argv[2]; @@ -88,7 +91,7 @@ bool MyApp::OnInit() // suppress the log messages from MakeConnection() { wxLogNull nolog; - the_connection = (MyConnection *)my_client->MakeConnection(hostName, server, "IPC TEST"); + the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, "IPC TEST"); while ( !the_connection ) { @@ -100,7 +103,7 @@ bool MyApp::OnInit() return FALSE; } - the_connection = (MyConnection *)my_client->MakeConnection(hostName, server, "IPC TEST"); + the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, "IPC TEST"); } } diff --git a/samples/ipc/server.cpp b/samples/ipc/server.cpp index 820bdefc8a..92b727abb5 100644 --- a/samples/ipc/server.cpp +++ b/samples/ipc/server.cpp @@ -45,6 +45,7 @@ IMPLEMENT_APP(MyApp) BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU (SERVER_EXIT, MyFrame::OnExit) EVT_LISTBOX(SERVER_LISTBOX, MyFrame::OnListBoxClick) END_EVENT_TABLE() @@ -72,14 +73,15 @@ bool MyApp::OnInit() // Create the main frame window (new MyFrame(NULL, "Server"))->Show(TRUE); - // create the server object - wxString server_name = "4242"; + // service name (DDE classes) or port number (TCP/IP based classes) + wxString service = "4242"; + if (argc > 1) - server_name = argv[1]; + service = argv[1]; // Create a new server m_server = new MyServer; - m_server->Create(server_name); + m_server->Create(service); return TRUE; } @@ -109,7 +111,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title) // Make a menubar wxMenu *file_menu = new wxMenu; - file_menu->Append(SERVER_QUIT, "&Exit"); + file_menu->Append(SERVER_EXIT, "&Exit"); wxMenuBar *menu_bar = new wxMenuBar; @@ -132,7 +134,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title) } // Set the client process's listbox to this item -void MyFrame::OnListBoxClick(wxCommandEvent& event) +void MyFrame::OnListBoxClick(wxCommandEvent& WXUNUSED(event)) { wxListBox* listBox = (wxListBox*) panel->FindWindow(SERVER_LISTBOX); if (listBox) @@ -145,6 +147,11 @@ void MyFrame::OnListBoxClick(wxCommandEvent& event) } } +void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event)) +{ + Close(TRUE); +} + // ---------------------------------------------------------------------------- // IPCDialogBox // ---------------------------------------------------------------------------- diff --git a/samples/ipc/server.h b/samples/ipc/server.h index 03b358b1f4..ac85cd4b0d 100644 --- a/samples/ipc/server.h +++ b/samples/ipc/server.h @@ -30,6 +30,7 @@ public: MyFrame(wxFrame *frame, const wxString& title); void OnListBoxClick(wxCommandEvent& event); + void OnExit(wxCommandEvent& event); private: wxPanel *panel; @@ -76,6 +77,6 @@ private: DECLARE_EVENT_TABLE() }; -#define SERVER_QUIT wxID_EXIT +#define SERVER_EXIT wxID_EXIT #define SERVER_LISTBOX 500 #define SERVER_QUIT_BUTTON 501 diff --git a/samples/joytest/Makefile.in b/samples/joytest/Makefile.in index ffb1d9c7e1..7cf10698fb 100644 --- a/samples/joytest/Makefile.in +++ b/samples/joytest/Makefile.in @@ -1,18 +1,12 @@ -# -# File: makefile.unx -# Author: Julian Smart -# Created: 1998 -# Updated: -# Copyright: (c) 1998 Julian Smart -# -# "%W% %G%" -# -# Makefile for joytest example (UNIX). +# Purpose: makefile for joytest example (UNIX). +# Created: 2000-03-14 top_srcdir = @top_srcdir@/.. top_builddir = ../.. program_dir = samples/joytest +DATAFILES=gun.wav + PROGRAM=joytest OBJECTS=$(PROGRAM).o diff --git a/samples/joytest/makefile.g95 b/samples/joytest/makefile.g95 index 67132e46c5..334bd4ad49 100644 --- a/samples/joytest/makefile.g95 +++ b/samples/joytest/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=joytest OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/layout/layout.cpp b/samples/layout/layout.cpp index 1b5fa69511..fbec3d7dc0 100644 --- a/samples/layout/layout.cpp +++ b/samples/layout/layout.cpp @@ -227,7 +227,7 @@ void MyFrame::TestNotebookSizers(wxCommandEvent& WXUNUSED(event) ) wxPanel *panel = new wxPanel( notebook, -1 ); notebook->AddPage( panel, "Page Two" ); - wxBoxSizer *panelsizer = new wxBoxSizer( wxVERTICAL ); + wxSizer *panelsizer = new wxBoxSizer( wxVERTICAL ); wxTextCtrl *text = new wxTextCtrl( panel, -1, "TextLine 1.", wxDefaultPosition, wxSize(250,-1) ); panelsizer->Add( text, 0, wxGROW|wxALL, 30 ); @@ -350,6 +350,22 @@ MySizerFrame::MySizerFrame(wxFrame *frame, char *title, int x, int y ): 30); topsizer->Add(statsizer, 1, wxEXPAND | wxALL, 10); + // 2.7) And a test of wxGridSizer + wxGridSizer *gridsizer = new wxGridSizer(2, 5, 5); + gridsizer->Add(new wxStaticText(this, -1, "Label"), 0, + wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + gridsizer->Add(new wxTextCtrl(this, -1, "Grid sizer demo"), 1, + wxGROW | wxALIGN_CENTER_VERTICAL); + gridsizer->Add(new wxStaticText(this, -1, "Another label"), 0, + wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + gridsizer->Add(new wxTextCtrl(this, -1, "More text"), 1, + wxGROW | wxALIGN_CENTER_VERTICAL); + gridsizer->Add(new wxStaticText(this, -1, "Final label"), 0, + wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + gridsizer->Add(new wxTextCtrl(this, -1, "And yet more text"), 1, + wxGROW | wxALIGN_CENTER_VERTICAL); + topsizer->Add(gridsizer, 1, wxGROW | wxALL, 10); + // 3) middle: create wxStaticLine with minimum size (3x3) topsizer->Add( diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index 68bdf84300..5ebd4f6568 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -66,6 +66,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour) EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour) EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel) + EVT_MENU(LIST_SHOW_COL_INFO, MyFrame::OnShowColInfo) + EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateShowColInfo) END_EVENT_TABLE() BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl) @@ -82,6 +84,8 @@ BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl) EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown) EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated) EVT_LIST_COL_CLICK(LIST_CTRL, MyListCtrl::OnColClick) + + EVT_CHAR(MyListCtrl::OnChar) END_EVENT_TABLE() IMPLEMENT_APP(MyApp) @@ -170,6 +174,7 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h) menuList->Append(LIST_TOGGLE_FIRST, "&Toggle first item\tCtrl-T"); menuList->Append(LIST_DESELECT_ALL, "&Deselect All\tCtrl-D"); menuList->Append(LIST_SELECT_ALL, "S&elect All\tCtrl-A"); + menuList->Append(LIST_SHOW_COL_INFO, "Show &column info\tCtrl-C"); menuList->AppendSeparator(); menuList->Append(LIST_SORT, "&Sort\tCtrl-S"); menuList->AppendSeparator(); @@ -316,7 +321,7 @@ void MyFrame::OnReportView(wxCommandEvent& WXUNUSED(event)) wxStopWatch sw; wxString buf; - static const int NUM_ITEMS = 3000; + static const int NUM_ITEMS = 30;//00; for ( int i = 0; i < NUM_ITEMS; i++ ) { buf.Printf(_T("This is item %d"), i); @@ -430,6 +435,22 @@ void MyFrame::OnSort(wxCommandEvent& WXUNUSED(event)) sw.Time())); } +void MyFrame::OnShowColInfo(wxCommandEvent& event) +{ + int count = m_listCtrl->GetColumnCount(); + wxLogMessage("%d columns:", count); + for ( int c = 0; c < count; c++ ) + { + wxLogMessage("\tcolumn %d has width %d", c, + m_listCtrl->GetColumnWidth(c)); + } +} + +void MyFrame::OnUpdateShowColInfo(wxUpdateUIEvent& event) +{ + event.Enable( (m_listCtrl->GetWindowStyleFlag() & wxLC_REPORT) != 0 ); +} + void MyFrame::OnToggleMultiSel(wxCommandEvent& WXUNUSED(event)) { m_logWindow->WriteText("Current selection mode: "); @@ -579,11 +600,21 @@ void MyListCtrl::OnActivated(wxListEvent& event) void MyListCtrl::OnListKeyDown(wxListEvent& event) { LogEvent(event, _T("OnListKeyDown")); + + event.Skip(); +} + +void MyListCtrl::OnChar(wxKeyEvent& event) +{ + wxLogMessage(_T("Got char event.")); + + event.Skip(); } void MyListCtrl::LogEvent(const wxListEvent& event, const wxChar *eventName) { - wxLogMessage(_T("Item %ld: %s (item data = %ld)"), - event.GetIndex(), eventName, event.GetData()); + wxLogMessage(_T("Item %ld: %s (item text = %s, data = %ld)"), + event.GetIndex(), eventName, + event.GetText().c_str(), event.GetData()); } diff --git a/samples/listctrl/listtest.h b/samples/listctrl/listtest.h index a79c15066c..e0ca2f31f7 100644 --- a/samples/listctrl/listtest.h +++ b/samples/listctrl/listtest.h @@ -74,6 +74,8 @@ public: void OnSetFgColour(wxCommandEvent& event); void OnSetBgColour(wxCommandEvent& event); void OnToggleMultiSel(wxCommandEvent& event); + void OnShowColInfo(wxCommandEvent& event); + void OnUpdateShowColInfo(wxUpdateUIEvent& event); void BusyOn(wxCommandEvent& event); void BusyOff(wxCommandEvent& event); @@ -109,6 +111,7 @@ enum LIST_SET_BG_COL, LIST_TOGGLE_MULTI_SEL, LIST_TOGGLE_FIRST, + LIST_SHOW_COL_INFO, LIST_CTRL = 1000 }; diff --git a/samples/makefile.g95 b/samples/makefile.g95 index 8fec5a178c..d88cefd678 100644 --- a/samples/makefile.g95 +++ b/samples/makefile.g95 @@ -20,41 +20,43 @@ MAKEFILE=makefile.g95 # Mingw make may not have a shell to use, so can't use a loop here. Sigh. # Please add new sample directories alphabetically to make it easier to # keep track. + all clean: -$(MAKE) -C calendar -f $(MAKEFILE) $@ -$(MAKE) -C caret -f $(MAKEFILE) $@ -$(MAKE) -C checklst -f $(MAKEFILE) $@ -$(MAKE) -C config -f $(MAKEFILE) $@ - -$(MAKE) -C console -f $(MAKEFILE) $@ -$(MAKE) -C controls -f $(MAKEFILE) $@ -$(MAKE) -C db -f $(MAKEFILE) $@ - -$(MAKE) -C ipc -f $(MAKEFILE) $@ -$(MAKE) -C dialogs -f $(MAKEFILE) $@ + -$(MAKE) -C dialup -f $(MAKEFILE) $@ -$(MAKE) -C dnd -f $(MAKEFILE) $@ -$(MAKE) -C docview -f $(MAKEFILE) $@ -$(MAKE) -C docvwmdi -f $(MAKEFILE) $@ + -$(MAKE) -C dragimag -f $(MAKEFILE) $@ -$(MAKE) -C drawing -f $(MAKEFILE) $@ -$(MAKE) -C dynamic -f $(MAKEFILE) $@ + -$(MAKE) -C exec -f $(MAKEFILE) $@ -$(MAKE) -C font -f $(MAKEFILE) $@ -$(MAKE) -C grid -f $(MAKEFILE) $@ -$(MAKE) -C help -f $(MAKEFILE) $@ -$(MAKE) -C html -f $(MAKEFILE) $@ -$(MAKE) -C image -f $(MAKEFILE) $@ -$(MAKE) -C internat -f $(MAKEFILE) $@ + -$(MAKE) -C ipc -f $(MAKEFILE) $@ -$(MAKE) -C joytest -f $(MAKEFILE) $@ -$(MAKE) -C layout -f $(MAKEFILE) $@ -$(MAKE) -C listctrl -f $(MAKEFILE) $@ -$(MAKE) -C mdi -f $(MAKEFILE) $@ - -$(MAKE) -C memcheck -f $(MAKEFILE) $@ -$(MAKE) -C menu -f $(MAKEFILE) $@ -$(MAKE) -C minifram -f $(MAKEFILE) $@ -$(MAKE) -C minimal -f $(MAKEFILE) $@ -$(MAKE) -C nativdlg -f $(MAKEFILE) $@ - -$(MAKE) -C dialup -f $(MAKEFILE) $@ -$(MAKE) -C newgrid -f $(MAKEFILE) $@ -$(MAKE) -C notebook -f $(MAKEFILE) $@ -$(MAKE) -C oleauto -f $(MAKEFILE) $@ -$(MAKE) -C ownerdrw -f $(MAKEFILE) $@ + -$(MAKE) -C plot -f $(MAKEFILE) $@ -$(MAKE) -C png -f $(MAKEFILE) $@ -$(MAKE) -C printing -f $(MAKEFILE) $@ -$(MAKE) -C proplist -f $(MAKEFILE) $@ @@ -66,20 +68,34 @@ all clean: -$(MAKE) -C sashtest -f $(MAKEFILE) $@ -$(MAKE) -C scroll -f $(MAKEFILE) $@ -$(MAKE) -C scrollsub -f $(MAKEFILE) $@ + -$(MAKE) -C sockets -f $(MAKEFILE) $@ -$(MAKE) -C splitter -f $(MAKEFILE) $@ + -$(MAKE) -C statbar -f $(MAKEFILE) $@ -$(MAKE) -C tab -f $(MAKEFILE) $@ -$(MAKE) -C taskbar -f $(MAKEFILE) $@ -$(MAKE) -C text -f $(MAKEFILE) $@ -$(MAKE) -C thread -f $(MAKEFILE) $@ -$(MAKE) -C toolbar -f $(MAKEFILE) $@ -$(MAKE) -C treectrl -f $(MAKEFILE) $@ + -$(MAKE) -C treelay -f $(MAKEFILE) $@ -$(MAKE) -C typetest -f $(MAKEFILE) $@ -$(MAKE) -C validate -f $(MAKEFILE) $@ -$(MAKE) -C wizard -f $(MAKEFILE) $@ - -$(MAKE) -C sockets -f $(MAKEFILE) $@ -# MFC still not available for mingw32 + +# Samples untested +# +# -$(MAKE) -C opengl -f $(MAKEFILE) $@ + +# Missing makefile, sample untested +# +# -$(MAKE) -C console -f $(MAKEFILE) $@ + +# MFC still not available for cygwin/mingw # # -$(MAKE) -C mfc -f $(MAKEFILE) $@ +# Memcheck does not work under cygwin/mingw +# +# -$(MAKE) -C memcheck -f $(MAKEFILE) $@ diff --git a/samples/makefile.vc b/samples/makefile.vc index ca4931f5c3..61942eb0ff 100644 --- a/samples/makefile.vc +++ b/samples/makefile.vc @@ -235,7 +235,7 @@ clean: cd $(WXDIR)\samples\png nmake -f makefile.vc clean cd $(WXDIR)\samples\plot - nmake -f makefile.vc FINAL=$(FINAL) + nmake -f makefile.vc clean cd $(WXDIR)\samples\printing nmake -f makefile.vc clean cd $(WXDIR)\samples\proplist diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp index 892bdd5537..423a2447be 100644 --- a/samples/mdi/mdi.cpp +++ b/samples/mdi/mdi.cpp @@ -80,6 +80,7 @@ END_EVENT_TABLE() BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame) EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit) EVT_MENU(MDI_REFRESH, MyChild::OnRefresh) + EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle) EVT_CLOSE(MyChild::OnClose) END_EVENT_TABLE() @@ -123,11 +124,11 @@ bool MyApp::OnInit() // Make a menubar wxMenu *file_menu = new wxMenu; - file_menu->Append(MDI_NEW_WINDOW, "&New window", "Create a new child window"); - file_menu->Append(MDI_QUIT, "&Exit", "Quit the program"); + file_menu->Append(MDI_NEW_WINDOW, "&New window\tCtrl-N", "Create a new child window"); + file_menu->Append(MDI_QUIT, "&Exit\tAlt-X", "Quit the program"); wxMenu *help_menu = new wxMenu; - help_menu->Append(MDI_ABOUT, "&About"); + help_menu->Append(MDI_ABOUT, "&About\tF1"); wxMenuBar *menu_bar = new wxMenuBar; @@ -233,8 +234,8 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) ) wxMenu *option_menu = new wxMenu; - // Dummy option option_menu->Append(MDI_REFRESH, "&Refresh picture"); + option_menu->Append(MDI_CHANGE_TITLE, "Change &title...\tCtrl-T"); wxMenu *help_menu = new wxMenu; help_menu->Append(MDI_ABOUT, "&About"); @@ -415,9 +416,25 @@ void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event)) Close(TRUE); } -void MyChild::OnRefresh(wxCommandEvent& event) +void MyChild::OnRefresh(wxCommandEvent& WXUNUSED(event)) +{ + if ( canvas ) + canvas->Refresh(); +} + +void MyChild::OnChangeTitle(wxCommandEvent& WXUNUSED(event)) { - Refresh(); + static wxString s_title = _T("Canvas Frame"); + + wxString title = wxGetTextFromUser(_T("Enter the new title for MDI child"), + _T("MDI sample question"), + s_title, + GetParent()->GetParent()); + if ( !title ) + return; + + s_title = title; + SetTitle(s_title); } void MyChild::OnActivate(wxActivateEvent& event) diff --git a/samples/mdi/mdi.h b/samples/mdi/mdi.h index 6efb5b61ad..b05f205a02 100644 --- a/samples/mdi/mdi.h +++ b/samples/mdi/mdi.h @@ -64,6 +64,7 @@ public: void OnActivate(wxActivateEvent& event); void OnRefresh(wxCommandEvent& event); + void OnChangeTitle(wxCommandEvent& event); void OnQuit(wxCommandEvent& event); void OnClose(wxCloseEvent& event); @@ -76,6 +77,7 @@ enum MDI_QUIT = 100, MDI_NEW_WINDOW, MDI_REFRESH, + MDI_CHANGE_TITLE, MDI_CHILD_QUIT, MDI_ABOUT }; diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp index 1b098b2f39..529577f799 100644 --- a/samples/menu/menu.cpp +++ b/samples/menu/menu.cpp @@ -408,11 +408,11 @@ void MyFrame::OnAppendMenuItem(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event)) { wxMenuBar *menubar = GetMenuBar(); - + wxMenu *menu = menubar->GetMenu(menubar->GetMenuCount() - 1); - - menu->Append(Menu_Dummy_Last, "Dummy sub menu\tCtrl-F2", - CreateDummyMenu(NULL)); + + menu->Append(Menu_Dummy_Last, "Dummy sub menu", + CreateDummyMenu(NULL), "Dummy sub menu help"); } void MyFrame::OnDeleteMenuItem(wxCommandEvent& WXUNUSED(event)) @@ -498,7 +498,7 @@ void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event)) msg << "The item is " << (item->IsEnabled() ? "enabled" : "disabled") << '\n'; - + if ( item->IsCheckable() ) { msg << "It is checkable and " << (item->IsChecked() ? "" : "un") @@ -575,9 +575,16 @@ void MyFrame::OnRightDown(wxMouseEvent &event ) menu.AppendSeparator(); menu.Append(Menu_File_Quit, "E&xit"); - //menu.Delete(Menu_Popup_ToBeDeleted); + menu.Delete(Menu_Popup_ToBeDeleted); menu.Check(Menu_Popup_ToBeChecked, TRUE); menu.Enable(Menu_Popup_ToBeGreyed, FALSE); PopupMenu( &menu, event.GetX(), event.GetY() ); + + // test for destroying items in popup menus +#if 0 + menu.Destroy(Menu_Popup_Submenu); + + PopupMenu( &menu, event.GetX(), event.GetY() ); +#endif // 0 } diff --git a/samples/mfc/mfctest.cpp b/samples/mfc/mfctest.cpp index ab1e42de2e..d50d963470 100644 --- a/samples/mfc/mfctest.cpp +++ b/samples/mfc/mfctest.cpp @@ -46,6 +46,9 @@ // version. Perhaps someone else is a wizard at working out the required settings // in the wxWin library and the sample; then debugging the assert problem may be // easier. +// +// (4) Compiling wxWindows in DLL mode currently includes windows.h, so you must only +// try linking wxWindows statically. // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -56,8 +59,8 @@ #include "wx/wx.h" -#ifdef _WINDOWS_ -#error Sorry, you need to edit include/wx/wxprec.h, comment out the windows.h inclusion, and recompile. +#if defined(_WINDOWS_) || !wxUSE_MFC +#error Sorry, you need to edit include/wx/msw/setup.h, set wxUSE_MFC to 1, and recompile. #endif #ifdef new diff --git a/samples/minifram/makefile.g95 b/samples/minifram/makefile.g95 index 413fb4a6b0..3a7ba816f8 100644 --- a/samples/minifram/makefile.g95 +++ b/samples/minifram/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=minifram OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp index 6a093c743e..300c169a78 100644 --- a/samples/minimal/minimal.cpp +++ b/samples/minimal/minimal.cpp @@ -29,13 +29,13 @@ #endif // for all others, include the necessary headers (this file is usually all you -// need because it includes almost all "standard" wxWindows headers +// need because it includes almost all "standard" wxWindows headers) #ifndef WX_PRECOMP #include "wx/wx.h" #endif // ---------------------------------------------------------------------------- -// ressources +// resources // ---------------------------------------------------------------------------- // the application icon #if defined(__WXGTK__) || defined(__WXMOTIF__) @@ -114,7 +114,7 @@ IMPLEMENT_APP(MyApp) // the application class // ---------------------------------------------------------------------------- -// `Main program' equivalent: the program execution "starts" here +// 'Main program' equivalent: the program execution "starts" here bool MyApp::OnInit() { // create the main application window diff --git a/samples/minimal/minimal.rc4 b/samples/minimal/minimal.rc4 new file mode 100644 index 0000000000..fc50aa7d7f --- /dev/null +++ b/samples/minimal/minimal.rc4 @@ -0,0 +1,6 @@ +ICON 1 PRELOAD "..\\samples\\minimal\\mondros2.ico" +#include "H:\DEV\WX22\WXWINDOWS\include\wx\os2\wx.rc" + +#define MINIMAL_QUIT 1 +#define MINIMAL_ABOUT 102 + diff --git a/samples/nativdlg/dialog1.rc b/samples/nativdlg/dialog1.rc index 54c00b55a9..2d708852be 100644 --- a/samples/nativdlg/dialog1.rc +++ b/samples/nativdlg/dialog1.rc @@ -13,6 +13,10 @@ #define __WIN95__ #endif +//#ifdef _MSC_VER +#define __VISUALC__ _MSC_VER +//#endif + #ifdef __GNUWIN32__ #define wxID_OK 5100 #define wxID_CANCEL 5101 diff --git a/samples/newgrid/griddemo.cpp b/samples/newgrid/griddemo.cpp index 15b56fe752..5f34c1c833 100644 --- a/samples/newgrid/griddemo.cpp +++ b/samples/newgrid/griddemo.cpp @@ -71,6 +71,8 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame ) EVT_MENU( ID_TOGGLEROWSIZING, GridFrame::ToggleRowSizing ) EVT_MENU( ID_TOGGLECOLSIZING, GridFrame::ToggleColSizing ) EVT_MENU( ID_TOGGLEGRIDSIZING, GridFrame::ToggleGridSizing ) + EVT_MENU( ID_TOGGLEGRIDLINES, GridFrame::ToggleGridLines ) + EVT_MENU( ID_AUTOSIZECOLS, GridFrame::AutoSizeCols ) EVT_MENU( ID_SETLABELCOLOUR, GridFrame::SetLabelColour ) EVT_MENU( ID_SETLABELTEXTCOLOUR, GridFrame::SetLabelTextColour ) EVT_MENU( ID_ROWLABELHORIZALIGN, GridFrame::SetRowLabelHorizAlignment ) @@ -129,6 +131,8 @@ GridFrame::GridFrame() viewMenu->Append( ID_TOGGLEROWSIZING, "Ro&w drag-resize", "", TRUE ); viewMenu->Append( ID_TOGGLECOLSIZING, "C&ol drag-resize", "", TRUE ); viewMenu->Append( ID_TOGGLEGRIDSIZING, "&Grid drag-resize", "", TRUE ); + viewMenu->Append( ID_TOGGLEGRIDLINES, "&Grid Lines", "", TRUE ); + viewMenu->Append( ID_AUTOSIZECOLS, "&Auto-size cols" ); wxMenu *rowLabelMenu = new wxMenu; @@ -288,6 +292,7 @@ void GridFrame::SetDefaults() GetMenuBar()->Check( ID_TOGGLEROWSIZING, TRUE ); GetMenuBar()->Check( ID_TOGGLECOLSIZING, TRUE ); GetMenuBar()->Check( ID_TOGGLEGRIDSIZING, TRUE ); + GetMenuBar()->Check( ID_TOGGLEGRIDLINES, TRUE ); } @@ -344,6 +349,20 @@ void GridFrame::ToggleGridSizing( wxCommandEvent& WXUNUSED(ev) ) } +void GridFrame::ToggleGridLines( wxCommandEvent& WXUNUSED(ev) ) +{ + grid->EnableGridLines( + GetMenuBar()->IsChecked( ID_TOGGLEGRIDLINES ) ); +} + + +void GridFrame::AutoSizeCols( wxCommandEvent& WXUNUSED(ev) ) +{ + grid->AutoSizeColumns(); + grid->Refresh(); +} + + void GridFrame::SetLabelColour( wxCommandEvent& WXUNUSED(ev) ) { wxColourDialog dlg( NULL ); @@ -497,9 +516,13 @@ void GridFrame::DeleteSelectedRows( wxCommandEvent& WXUNUSED(ev) ) { if ( grid->IsSelection() ) { - for ( int n = 0; n < grid->GetNumberRows(); n++ ) + grid->BeginBatch(); + for ( int n = 0; n < grid->GetNumberRows(); ) if ( grid->IsInSelection( n , 0 ) ) grid->DeleteRows( n, 1 ); + else + n++; + grid->EndBatch(); } } @@ -508,9 +531,13 @@ void GridFrame::DeleteSelectedCols( wxCommandEvent& WXUNUSED(ev) ) { if ( grid->IsSelection() ) { - for ( int n = 0; n < grid->GetNumberCols(); n++ ) + grid->BeginBatch(); + for ( int n = 0; n < grid->GetNumberCols(); ) if ( grid->IsInSelection( 0 , n ) ) grid->DeleteCols( n, 1 ); + else + n++; + grid->EndBatch(); } } @@ -847,7 +874,7 @@ enum Severity Sev_Max }; -static const wxChar* severities[] = +static const wxString severities[] = { _T("wishlist"), _T("minor"), diff --git a/samples/newgrid/griddemo.h b/samples/newgrid/griddemo.h index 5140bfbbb4..29f1bca2df 100644 --- a/samples/newgrid/griddemo.h +++ b/samples/newgrid/griddemo.h @@ -40,6 +40,8 @@ class GridFrame : public wxFrame void ToggleRowSizing( wxCommandEvent& ); void ToggleColSizing( wxCommandEvent& ); void ToggleGridSizing( wxCommandEvent& ); + void ToggleGridLines( wxCommandEvent& ); + void AutoSizeCols( wxCommandEvent& ); void SetLabelColour( wxCommandEvent& ); void SetLabelTextColour( wxCommandEvent& ); void SetRowLabelHorizAlignment( wxCommandEvent& ); @@ -88,6 +90,8 @@ public: ID_TOGGLEROWSIZING, ID_TOGGLECOLSIZING, ID_TOGGLEGRIDSIZING, + ID_TOGGLEGRIDLINES, + ID_AUTOSIZECOLS, ID_SETLABELCOLOUR, ID_SETLABELTEXTCOLOUR, ID_ROWLABELALIGN, diff --git a/samples/notebook/makefile.g95 b/samples/notebook/makefile.g95 index b87471f38d..c610092a4c 100644 --- a/samples/notebook/makefile.g95 +++ b/samples/notebook/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=notebook OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp index 7ffa097f23..b69850bd96 100644 --- a/samples/notebook/notebook.cpp +++ b/samples/notebook/notebook.cpp @@ -67,7 +67,6 @@ void MyApp::InitTabView(wxNotebook* notebook, wxPanel* window) m_okButton->SetDefault(); wxLayoutConstraints *c; - c = new wxLayoutConstraints; c->right.SameAs(window, wxRight, 4); c->bottom.SameAs(window, wxBottom, 4); @@ -242,9 +241,25 @@ void MyFrame::OnInsertPage(wxCommandEvent& WXUNUSED(event)) m_notebook->SetSelection(0); } +wxWindow *test = NULL; + void MyFrame::OnDeletePage(wxCommandEvent& WXUNUSED(event)) { - m_notebook->DeletePage( m_notebook->GetPageCount()-1 ); + if (m_notebook->GetPageCount() > 0) + m_notebook->DeletePage( m_notebook->GetPageCount()-1 ); + +/* + if (test) + { + m_notebook->AddPage( test, "Readded" ); + test = NULL; + } + else + { + test = m_notebook->GetPage( m_notebook->GetPageCount()-1 ); + m_notebook->RemovePage( m_notebook->GetPageCount()-1 ); + } +*/ } void MyFrame::OnNextPage(wxCommandEvent& WXUNUSED(event)) diff --git a/samples/oleauto/oleauto.cpp b/samples/oleauto/oleauto.cpp index b4021b93ae..d50c7ecd4b 100644 --- a/samples/oleauto/oleauto.cpp +++ b/samples/oleauto/oleauto.cpp @@ -40,6 +40,10 @@ #error "Sorry, this sample works under Windows only." #endif +#ifdef __WATCOMC__ +#error "Sorry, Watcom C++ does not support wxAutomationObject." +#endif + // ---------------------------------------------------------------------------- // ressources // ---------------------------------------------------------------------------- diff --git a/samples/opengl/cube/Makefile.in b/samples/opengl/cube/Makefile.in index 04a390497b..311847e12e 100644 --- a/samples/opengl/cube/Makefile.in +++ b/samples/opengl/cube/Makefile.in @@ -15,7 +15,7 @@ program_dir = samples/opengl/cube PROGRAM=cube -LIBRARIES=-lMesaGL -lMesaGLU ../../../lib/libwx_gtk_gl.so +LIBRARIES=$(OPENGLLIBS) ../../../lib/libwx_gtk_gl.so OBJECTS=$(PROGRAM).o diff --git a/samples/opengl/cube/cube.cpp b/samples/opengl/cube/cube.cpp index 38c9d0f48a..997b37131b 100644 --- a/samples/opengl/cube/cube.cpp +++ b/samples/opengl/cube/cube.cpp @@ -427,7 +427,7 @@ void MyFrame::OnNewWindow() MyFrame *frame = new MyFrame(NULL, "Cube OpenGL Demo Clone", wxPoint(50, 50), wxSize(400, 300)); // Give it an icon -#ifdef wx_msw +#ifdef __WXMSW__ frame->SetIcon(wxIcon("mondrian")); #endif diff --git a/samples/opengl/isosurf/Makefile.in b/samples/opengl/isosurf/Makefile.in index 0dc1538282..4c4867009d 100644 --- a/samples/opengl/isosurf/Makefile.in +++ b/samples/opengl/isosurf/Makefile.in @@ -17,7 +17,7 @@ DATAFILES = isosurf.dat.gz PROGRAM=isosurf -LIBRARIES=-lMesaGL -lMesaGLU ../../../lib/libwx_gtk_gl.so +LIBRARIES=$(OPENGLLIBS) ../../../lib/libwx_gtk_gl.so OBJECTS=$(PROGRAM).o diff --git a/samples/opengl/penguin/Makefile.in b/samples/opengl/penguin/Makefile.in index ad3f1f37da..f65cb0ebb2 100644 --- a/samples/opengl/penguin/Makefile.in +++ b/samples/opengl/penguin/Makefile.in @@ -17,7 +17,7 @@ DATAFILES = penguin.lwo PROGRAM=penguin -LIBRARIES=-lMesaGL -lMesaGLU ../../../lib/libwx_gtk_gl.so +LIBRARIES=$(OPENGLLIBS) ../../../lib/libwx_gtk_gl.so OBJECTS=$(PROGRAM).o lw.o trackball.o diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index bdc779878e..45703a7f3d 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -192,7 +192,12 @@ void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event)) wxPrinter printer(& printDialogData); MyPrintout printout("My printout"); if (!printer.Print(this, &printout, TRUE)) - wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK); + { + if (wxPrinter::GetLastError() == wxPRINTER_ERROR) + wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK); + else + wxMessageBox("You canceled printing", "Printing", wxOK); + } else { (*g_printData) = printer.GetPrintDialogData().GetPrintData(); diff --git a/samples/proplist/makefile.g95 b/samples/proplist/makefile.g95 index 5489c858c7..7fa5bd6868 100644 --- a/samples/proplist/makefile.g95 +++ b/samples/proplist/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=proplist OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/propsize/makefile.g95 b/samples/propsize/makefile.g95 index 7c38b8a26a..ed32b82b54 100644 --- a/samples/propsize/makefile.g95 +++ b/samples/propsize/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=propsize OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/regtest/regtest.cpp b/samples/regtest/regtest.cpp index f1960608af..2e8b20c303 100644 --- a/samples/regtest/regtest.cpp +++ b/samples/regtest/regtest.cpp @@ -162,7 +162,7 @@ public: void AddStdKeys(); private: - DECLARE_EVENT_TABLE(); + DECLARE_EVENT_TABLE() }; // ---------------------------------------------------------------------------- @@ -194,7 +194,7 @@ public: void OnInfo (wxCommandEvent& event); - DECLARE_EVENT_TABLE(); + DECLARE_EVENT_TABLE() private: RegTreeCtrl *m_treeCtrl; @@ -913,10 +913,11 @@ bool RegTreeCtrl::TreeNode::OnExpand() if ( isEmpty ) { // this is for the case when our last child was just deleted - m_pTree->Collapse(Id()); + wxTreeItemId theId(Id()); // Temp variable seems necessary for BC++ + m_pTree->Collapse(theId); // we won't be expanded any more - m_pTree->SetItemHasChildren(Id(), FALSE); + m_pTree->SetItemHasChildren(theId, FALSE); } return TRUE; @@ -935,14 +936,15 @@ void RegTreeCtrl::TreeNode::Refresh() if ( !IsKey() ) return; - bool wasExpanded = m_pTree->IsExpanded(Id()); + wxTreeItemId theId(Id()); // Temp variable seems necessary for BC++ + bool wasExpanded = m_pTree->IsExpanded(theId); if ( wasExpanded ) - m_pTree->Collapse(Id()); + m_pTree->Collapse(theId); OnCollapse(); - m_pTree->SetItemHasChildren(Id()); + m_pTree->SetItemHasChildren(theId); if ( wasExpanded ) { - m_pTree->Expand(Id()); + m_pTree->Expand(theId); OnExpand(); } } @@ -967,7 +969,8 @@ bool RegTreeCtrl::TreeNode::DeleteChild(TreeNode *child) } if ( ok ) { - m_pTree->Delete(child->Id()); + wxTreeItemId theId(child->Id()); // Temp variable seems necessary for BC++ + m_pTree->Delete(theId); Refresh(); } @@ -983,7 +986,8 @@ void RegTreeCtrl::TreeNode::DestroyChildren() long lId = m_aChildren[n]->Id(); // no, wxTreeCtrl will do it //delete m_aChildren[n]; - m_pTree->Delete(lId); + wxTreeItemId theId(lId); // Temp variable seems necessary for BC++ + m_pTree->Delete(theId); } m_aChildren.Empty(); diff --git a/samples/resource/dialog1.wxr b/samples/resource/dialog1.wxr index 6823b00437..4a48e75a46 100644 --- a/samples/resource/dialog1.wxr +++ b/samples/resource/dialog1.wxr @@ -2,25 +2,25 @@ static char *dialog1 = "dialog(name = 'dialog1',\ style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\ title = 'Test dialog box',\ id = 100,\ - x = 10, y = 10, width = 197, height = 146,\ + x = 10, y = 10, width = 210, height = 145,\ background_colour = 'D6D6D6',\ use_dialog_units = 1,\ use_system_defaults = 1,\ font = [12, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],\ - control = [101, wxStaticBox, 'wxStaticBox', '0', 'group6', 5, 7, 184, 103,\ + control = [101, wxStaticBox, 'wxStaticBox', '0', 'group6', 5, 7, 200, 103,\ [12, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],\ - control = [102, wxRadioBox, 'Radiobox', 'wxRA_SPECIFY_COLS', 'radiobox2', 13, 24, 40, 72, ['One', 'Two', 'Three', 'Four', 'One more'], 1,\ + control = [102, wxRadioBox, 'Radiobox', 'wxRA_SPECIFY_COLS', 'radiobox2', 13, 24, 60, 72, ['One', 'Two', 'Three', 'Four', 'One more'], 1,\ [12, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],\ - control = [104, wxTextCtrl, '', 'wxTE_MULTILINE', 'multitext3', 62, 24, 67, 33, 'wxWindows rules!',\ + control = [104, wxTextCtrl, '', 'wxTE_MULTILINE', 'multitext3', 80, 24, 67, 33, 'wxWindows rules!',\ [12, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],\ - control = [105, wxListBox, '', '0', 'listbox4', 62, 66, 67, 33, ['Apples', 'Bananas', 'Pears', 'Kiwis'],\ + control = [105, wxListBox, '', '0', 'listbox4', 80, 66, 67, 33, ['Apples', 'Bananas', 'Pears', 'Kiwis'],\ [12, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],\ - control = [106, wxCheckBox, 'Checkbox', '0', 'checkbox9', 141, 26, 36, 14, 0,\ + control = [106, wxCheckBox, 'Checkbox', '0', 'checkbox9', 150, 26, 50, 14, 0,\ [12, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],\ - control = [107, wxStaticText, 'My Message', '0', 'message10', 143, 57, 39, 12, '',\ + control = [107, wxStaticText, 'My Message', '0', 'message10', 150, 57, 50, 12, '',\ [12, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],\ - control = [108, wxButton, 'Press me', '0', 'button7', 141, 81, 36, 13, '',\ + control = [108, wxButton, 'Press me', '0', 'button7', 150, 81, 50, 13, '',\ [12, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],\ - control = [109, wxButton, 'Cancel', '0', 'button8', 62, 119, 55, 17, '',\ + control = [109, wxButton, 'Cancel', '0', 'button8', 80, 119, 55, 17, '',\ [12, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]])."; diff --git a/samples/resource/resource.cpp b/samples/resource/resource.cpp index 588b3873ff..ab0405be9b 100644 --- a/samples/resource/resource.cpp +++ b/samples/resource/resource.cpp @@ -113,8 +113,10 @@ bool MyApp::OnInit(void) MyApp::~MyApp() { +#if defined(__WXMSW__) delete dialog1; delete menu1; +#endif } BEGIN_EVENT_TABLE(MyPanel, wxPanel) diff --git a/samples/richedit/README b/samples/richedit/README index 5539268bc7..48f7aeff7c 100644 --- a/samples/richedit/README +++ b/samples/richedit/README @@ -10,6 +10,14 @@ by Karsten Ballueder <ballueder@usa.net>. This is still work in progress, so if you want to make any significant changes, please get in touch with me before. + +*** THIS SOURCE IS USUALLY OUTDATED AND FOR DEMONSTRATION ONLY *** +*** GET THE VERY LATEST VERSION OF THE WXLAYOUT CLASSES FROM *** +*** THE SOURCE OF THE MAHOGANY MAIL/NEWS CLIENT, AVAILABLE FROM *** +*** http://www.wxwindows.org/Mahogany/ *** + + + There are three building blocks for rich text editing: wxllist : diff --git a/samples/richedit/wxllist.cpp b/samples/richedit/wxllist.cpp index 3a8e75082e..3a6cdd1b64 100644 --- a/samples/richedit/wxllist.cpp +++ b/samples/richedit/wxllist.cpp @@ -1,7 +1,7 @@ /*-*- c++ -*-******************************************************** * wxllist: wxLayoutList, a layout engine for text and graphics * * * - * (C) 1998-1999 by Karsten Ballüder (Ballueder@usa.net) * + * (C) 1998-2000 by Karsten Ballüder (Ballueder@gmx.net) * * * * $Id$ *******************************************************************/ @@ -60,6 +60,7 @@ #include <ctype.h> + /// This should never really get created #define WXLLIST_TEMPFILE "__wxllist.tmp" @@ -72,16 +73,19 @@ { "invalid", "text", "cmd", "icon" }; - void - wxLayoutObject::Debug(void) + wxString + wxLayoutObject::DebugDump(void) const { - WXLO_DEBUG(("%s",g_aTypeStrings[GetType()])); + wxString str; + str.Printf("%s",g_aTypeStrings[GetType()]); + return str; } #else -# define TypeString(t) "" -# define WXLO_DEBUG(x) +# define TypeString(t) "" +# define WXLO_DEBUG(x) #endif + // FIXME under MSW, this constant is needed to make the thing properly redraw // itself - I don't know where the size calculation error is and I can't // waste time looking for it right now. Search for occurences of @@ -165,6 +169,7 @@ bool Contains(const wxRect &r, const wxPoint &p) //@} +static void ReadString(wxString &to, wxString &from) { to = ""; @@ -187,7 +192,7 @@ wxLayoutObject::Read(wxString &istr) { wxString tmp; ReadString(tmp, istr); - int type = -1; + int type = WXLO_TYPE_INVALID; sscanf(tmp.c_str(),"%d", &type); switch(type) @@ -370,11 +375,14 @@ wxLayoutObjectText::Layout(wxDC &dc, class wxLayoutList *llist) #ifdef WXLAYOUT_DEBUG -void -wxLayoutObjectText::Debug(void) +wxString +wxLayoutObjectText::DebugDump(void) const { - wxLayoutObject::Debug(); - WXLO_DEBUG((" `%s`", m_Text.c_str())); + wxString str; + str = wxLayoutObject::DebugDump(); + wxString str2; + str2.Printf(" `%s`", m_Text.c_str()); + return str+str2; } #endif @@ -412,7 +420,7 @@ wxLayoutObjectIcon::Write(wxString &ostr) wxString file = wxGetTempFileName("wxloexport"); - ostr << WXLO_TYPE_ICON << '\n' + ostr << (int) WXLO_TYPE_ICON << '\n' << file << '\n'; m_Icon->SaveFile(file, WXLO_BITMAP_FORMAT); } @@ -449,11 +457,7 @@ wxLayoutObjectIcon::wxLayoutObjectIcon(wxBitmap *icon) { m_Icon = icon; if(! m_Icon) -#if wxICON_IS_BITMAP - m_Icon = new wxIcon; -#else m_Icon = new wxBitmap; -#endif } void @@ -557,25 +561,25 @@ wxLayoutObjectCmd::Copy(void) void wxLayoutObjectCmd::Write(wxString &ostr) { - ostr << WXLO_TYPE_CMD << '\n' - << m_StyleInfo->family << '\n' - << m_StyleInfo->size << '\n' - << m_StyleInfo->style << '\n' - << m_StyleInfo->weight << '\n' - << m_StyleInfo->underline << '\n' - << m_StyleInfo->m_fg_valid << '\n' - << m_StyleInfo->m_bg_valid << '\n'; + ostr << (int) WXLO_TYPE_CMD << '\n' + << (int) m_StyleInfo->family << '\n' + << (int) m_StyleInfo->size << '\n' + << (int) m_StyleInfo->style << '\n' + << (int) m_StyleInfo->weight << '\n' + << (int) m_StyleInfo->underline << '\n' + << (int) m_StyleInfo->m_fg_valid << '\n' + << (int) m_StyleInfo->m_bg_valid << '\n'; if(m_StyleInfo->m_fg_valid) { - ostr << m_StyleInfo->m_fg.Red() << '\n' - << m_StyleInfo->m_fg.Green() << '\n' - << m_StyleInfo->m_fg.Blue() << '\n'; + ostr << (int) m_StyleInfo->m_fg.Red() << '\n' + << (int) m_StyleInfo->m_fg.Green() << '\n' + << (int) m_StyleInfo->m_fg.Blue() << '\n'; } if(m_StyleInfo->m_bg_valid) { - ostr << m_StyleInfo->m_bg.Red() << '\n' - << m_StyleInfo->m_bg.Green() << '\n' - << m_StyleInfo->m_bg.Blue() << '\n'; + ostr << (int) m_StyleInfo->m_bg.Red() << '\n' + << (int) m_StyleInfo->m_bg.Green() << '\n' + << (int) m_StyleInfo->m_bg.Blue() << '\n'; } } /* static */ @@ -665,10 +669,9 @@ wxLayoutLine::wxLayoutLine(wxLayoutLine *prev, wxLayoutList *llist) m_Length = 0; m_updateLeft = -1; - MarkDirty(0); - m_Previous = prev; m_Next = NULL; + MarkDirty(0); m_LineNumber = 0; RecalculatePosition(llist); @@ -1273,7 +1276,9 @@ wxLayoutLine::Break(CoordType xpos, wxLayoutList *llist) wxLayoutLine *newLine = new wxLayoutLine(this, llist); // split object at i: - if((**i).GetType() == WXLO_TYPE_TEXT && offset != 0) + if((**i).GetType() == WXLO_TYPE_TEXT + && offset != 0 + && offset != (**i).GetLength() ) { wxString left, right; wxLayoutObjectText *tobj = (wxLayoutObjectText *) *i; @@ -1304,6 +1309,130 @@ wxLayoutLine::Break(CoordType xpos, wxLayoutList *llist) return newLine; } +bool +wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist) +{ + if(GetLength() < wrapmargin) + return FALSE; // nothing to do + + // find the object which covers the wrapmargin: + CoordType offset; + wxLOiterator i = FindObject(wrapmargin, &offset); + wxCHECK_MSG( i != NULLIT, FALSE, "Cannot find object covering wrapmargin."); + + // from this object on, the rest of the line must be copied to the + // next one: + wxLOiterator copyObject = NULLIT; + // if we split a text-object, we must pre-pend some text to the + // next line later on, remember it here: + wxString prependText = ""; + // we might need to adjust the cursor position later, so remember it + size_t xpos = llist->GetCursorPos().x; + // by how much did we shorten the current line: + size_t shorter = 0; + // remember cursor location of object + size_t objectCursorPos = 0; + + size_t breakpos = offset; + + if( (**i).GetType() != WXLO_TYPE_TEXT ) + { + // break before a non-text object + copyObject = i; + } + else + { + bool foundSpace = FALSE; + do + { +// while(i != NULLIT && (**i).GetType() != WXLO_TYPE_TEXT) +// i--; + // try to find a suitable place to split the object: + wxLayoutObjectText *tobj = (wxLayoutObjectText *)*i; + if((**i).GetType() == WXLO_TYPE_TEXT + && tobj->GetText().Length() >= breakpos) + { + do + { + foundSpace = isspace(tobj->GetText()[breakpos]) != 0; + if ( foundSpace ) + break; + } + while ( breakpos-- > 0 ); + } + else + { + breakpos = 0; + } + + if(! foundSpace) // breakpos == 0! + { + if(i == m_ObjectList.begin()) + return FALSE; // could not break line + else + { + i--; + while(i != m_ObjectList.begin() + && (**i).GetType() != WXLO_TYPE_TEXT ) + { + i--; + } + breakpos = (**i).GetLength(); + } + } + }while(! foundSpace); + // before we actually break the object, we need to know at which + // cursorposition it starts, so we can restore the cursor if needed: + if( this == llist->GetCursorLine() && xpos >= breakpos ) + { + for(wxLOiterator j = m_ObjectList.begin(); + j != NULLIT && j != i; j++) + objectCursorPos += (**j).GetLength(); + } + // now we know where to break it: + wxLayoutObjectText *tobj = (wxLayoutObjectText *)*i; + shorter = tobj->GetLength() - breakpos; + // remember text to copy from this object + prependText = tobj->GetText().Mid(breakpos+1); + tobj->SetText(tobj->GetText().Left(breakpos)); + // copy every following object: + copyObject = i; copyObject ++; + } + + // make sure there is an empty m_Next line: + (void) new wxLayoutLine(this, llist); + wxASSERT(m_Next); + // We need to move this and all following objects to the next + // line. Starting from the end of line, to keep the order right. + if(copyObject != NULLIT) + { + wxLOiterator j; + for(j = m_ObjectList.tail(); j != copyObject; j--) + m_Next->Prepend(*j); + m_Next->Prepend(*copyObject); + // and now remove them from this list: + while( copyObject != m_ObjectList.end() ) + { + shorter += (**copyObject).GetLength(); + m_ObjectList.remove(copyObject); // remove without deleting it + } + } + m_Length -= shorter; + + if(prependText.Length() > 0) + m_Next->Insert(0, prependText); + + // do we need to adjust the cursor position? + if( this == llist->GetCursorLine() && xpos >= breakpos) + { + xpos = objectCursorPos + (xpos - objectCursorPos - breakpos - + ((xpos > breakpos) ? 1 : 0 )); + wxASSERT(xpos >= 0); + llist->MoveCursorTo( wxPoint( xpos, m_Next->GetLineNumber()) ); + } + return TRUE; // we wrapped the line +} + void wxLayoutLine::ReNumber(void) { @@ -1389,7 +1518,7 @@ wxLayoutLine::GetWrapPosition(CoordType column) { do { - if( isspace(((wxLayoutObjectText*)*i)->GetText().c_str()[(size_t)offset])) + if(isspace(((wxLayoutObjectText*)*i)->GetText().c_str()[(size_t)offset])) return column; else { @@ -1418,25 +1547,23 @@ wxLayoutLine::GetWrapPosition(CoordType column) i++; } if(i == NULLIT) return -1; //why should this happen? + + // now we are behind the one long text object and need to find the + // first space in it + for(offset = 0; offset < (**i).GetLength(); offset++) + if( isspace(((wxLayoutObjectText*)*i)->GetText().c_str()[(size_t)offset])) + { + return pos+offset; + } pos += (**i).GetLength(); - i++; - while(i != NULLIT && (**i).GetType() != WXLO_TYPE_TEXT) - { - pos += (**i).GetLength(); - i++; - } - if(i == NULLIT) return -1; //this is possible, if there is only one text object - // now we are at the second text object: - pos -= (**i).GetLength(); - return pos; // in front of it + return pos; } #ifdef WXLAYOUT_DEBUG void -wxLayoutLine::Debug(void) +wxLayoutLine::Debug(void) const { - wxString tmp; wxPoint pos = GetPosition(); WXLO_DEBUG(("Line %ld, Pos (%ld,%ld), Height %ld, BL %ld, Font: %d", (long int) GetLineNumber(), @@ -1445,7 +1572,9 @@ wxLayoutLine::Debug(void) (long int) m_BaseLine, (int) m_StyleInfo.family)); if(m_ObjectList.begin() != NULLIT) - (**m_ObjectList.begin()).Debug(); + { + WXLO_DEBUG(((**m_ObjectList.begin()).DebugDump().c_str())); + } } #endif @@ -1592,9 +1721,22 @@ wxLayoutList::Read(wxString &istr) while(istr.Length()) { - wxLayoutObject *obj = wxLayoutObject::Read(istr); - if(obj) - Insert(obj); + // check for a linebreak: + wxString tmp; + tmp = istr.BeforeFirst('\n'); + int type = WXLO_TYPE_INVALID; + sscanf(tmp.c_str(),"%d", &type); + if(type == WXLO_TYPE_LINEBREAK) + { + LineBreak(); + istr = istr.AfterFirst('\n'); + } + else + { + wxLayoutObject *obj = wxLayoutObject::Read(istr); + if(obj) + Insert(obj); + } } /* Now we use the current_si to restore our last font settings: */ Insert(new wxLayoutObjectCmd(current_si)); @@ -1746,6 +1888,7 @@ wxLayoutList::MoveCursorVertically(int n) { n--; m_CursorPos.y ++; + last = m_CursorLine; m_CursorLine = m_CursorLine->GetNextLine(); } if(! m_CursorLine) @@ -1983,9 +2126,10 @@ wxLayoutList::Insert(wxString const &text) AddCursorPosToUpdateRect(); + wxASSERT(m_CursorLine->GetLength() >= m_CursorPos.x); + if ( !m_CursorLine->Insert(m_CursorPos.x, text) ) return false; - m_CursorPos.x += text.Length(); m_movedCursor = true; @@ -2076,29 +2220,22 @@ wxLayoutList::LineBreak(void) bool wxLayoutList::WrapLine(CoordType column) { - if(m_CursorPos.x <= column || column < 1) - return false; // do nothing yet - else - { - CoordType xpos = m_CursorLine->GetWrapPosition(column); - if(xpos == -1) - return false; // cannot break line - //else: - CoordType newpos = m_CursorPos.x - xpos - 1; - m_CursorPos.x = xpos; - - AddCursorPosToUpdateRect(); - - LineBreak(); - Delete(1); // delete the space - m_CursorPos.x = newpos; - - m_CursorLine->MarkDirty(); - - m_movedCursor = true; + return m_CursorLine->Wrap(column, this); +} - return true; +bool +wxLayoutList::WrapAll(CoordType column) +{ + wxLayoutLine *line = m_FirstLine; + if(! line) + return FALSE; + bool rc = TRUE; + while(line && rc) + { + rc &= line->Wrap(column, this); + line = line->GetNextLine(); } + return rc; } bool @@ -2262,6 +2399,9 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll, // If one line was dirty, we need to re-calculate all // following lines, too. bool wasDirty = forceAll; + // we need to layout until we reach at least the cursor line, + // otherwise we won't be able to scroll to it + bool cursorReached = false; wxLayoutLine *line = m_FirstLine; while(line) { @@ -2271,6 +2411,8 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll, // if any previous line was dirty, we need to layout all // following lines: wasDirty + // go on until we find the cursorline + || ! cursorReached // layout dirty lines: || line->IsDirty() // always layout the cursor line toupdate the cursor @@ -2278,6 +2420,9 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll, || line == m_CursorLine // or if it's the line we are asked to look for: || (cpos && line->GetLineNumber() == cpos->y) + // layout at least the desired region: + || (bottom == -1 ) + || (line->GetPosition().y <= bottom) ) { if(line->IsDirty()) @@ -2299,17 +2444,20 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll, if ( csize ) *csize = m_CursorSize; } + cursorReached = TRUE; } else + { if(cpos && line->GetLineNumber() == cpos->y) + { line->Layout(dc, this, cpos, csize, NULL, cpos->x); - else - line->Layout(dc, this); - // little condition to speed up redrawing: - if(bottom != -1 && line->GetPosition().y > bottom) - break; + cursorReached = TRUE; + } + else + line->Layout(dc, this); + } } line = line->GetNextLine(); } @@ -2385,7 +2533,7 @@ wxLayoutList::Draw(wxDC &dc, } InvalidateUpdateRect(); - WXLO_DEBUG(("Selection is %s : l%d,%ld/%ld,%ld", + WXLO_DEBUG(("Selection is %s : %ld,%ld/%ld,%ld", m_Selection.m_valid ? "valid" : "invalid", m_Selection.m_CursorA.x, m_Selection.m_CursorA.y, m_Selection.m_CursorB.x, m_Selection.m_CursorB.y)); @@ -2500,7 +2648,7 @@ wxLayoutList::DrawCursor(wxDC &dc, bool active, wxPoint const &translate) #ifdef WXLAYOUT_DEBUG WXLO_DEBUG(("Drawing cursor (%ld,%ld) at %ld,%ld, size %ld,%ld, line: %ld, len %ld", (long)m_CursorPos.x, (long)m_CursorPos.y, - (long)coords.x, (long)coords.y, + (long)coords.x, (long)coords.y, (long)m_CursorSize.x, (long)m_CursorSize.y, (long)m_CursorLine->GetLineNumber(), (long)m_CursorLine->GetLength())); @@ -2522,7 +2670,8 @@ wxLayoutList::DrawCursor(wxDC &dc, bool active, wxPoint const &translate) dc.DrawRectangle(coords.x, coords.y, m_CursorSize.x, m_CursorSize.y); SetUpdateRect(coords.x, coords.y); - SetUpdateRect(coords.x+m_CursorSize.x, coords.y+m_CursorSize.y); + SetUpdateRect(coords.x+m_CursorSize.x, + coords.y+m_CursorSize.y); } else { @@ -2883,7 +3032,7 @@ wxLayoutList::GetSelection(wxLayoutDataObject *wxlo, bool invalidate) while((exp = wxLayoutExport( &status, WXLO_EXPORT_AS_OBJECTS)) != NULL) { if(exp->type == WXLO_EXPORT_EMPTYLINE) - ; //FIXME missing support for linebreaks in string format + string << (int) WXLO_TYPE_LINEBREAK << '\n'; else exp->content.object->Write(string); delete exp; diff --git a/samples/richedit/wxllist.h b/samples/richedit/wxllist.h index 71e7d381ae..0669c25804 100644 --- a/samples/richedit/wxllist.h +++ b/samples/richedit/wxllist.h @@ -1,7 +1,7 @@ /*-*- c++ -*-******************************************************** * wxLayoutList.h - a formatted text rendering engine for wxWindows * * * - * (C) 1999 by Karsten Ballüder (ballueder@gmx.net) * + * (C) 1999-2000 by Karsten Ballüder (ballueder@gmx.net) * * * * $Id$ *******************************************************************/ @@ -38,17 +38,38 @@ # define WXLAYOUT_USE_CARET 1 #endif // __WXMSW__ -// do not enable debug mode within Mahogany -#if defined(__WXDEBUG__) && ! defined(M_BASEDIR) +// do not enable debug mode within Mahogany unless in debug mode +#if defined(__WXDEBUG__) && (( ! defined(M_BASEDIR) )|| defined(DEBUG)) # define WXLAYOUT_DEBUG #endif #ifdef WXLAYOUT_DEBUG # define WXLO_TRACE(x) wxLogDebug(x) +// activate profiling: # define WXLO_PROFILE #else # define WXLO_TRACE(x) #endif +/* Some profiling code: */ +#if defined (WXLO_PROFILE) +#include <sys/time.h> +#include <unistd.h> + +# define WXLO_TIMER_DEFINE(x) static struct timeval x +# define WXLO_TIMER_START(x) gettimeofday(&x,NULL) +# define WXLO_TIMER_STOP(x) { struct timeval y; \ + gettimeofday(&y,NULL); \ + x.tv_sec -= y.tv_sec; x.tv_usec -= y.tv_usec; } +# define WXLO_TIMER_PRINT(x) wxLogDebug("Timer " #x " elapsed: %ld", \ + (long)(x.tv_sec * -1000 - x.tv_usec)); +#else +# define WXLO_TIMER_DEFINE(x) +# define WXLO_TIMER_START(x) +# define WXLO_TIMER_STOP(x) +# define WXLO_TIMER_PRINT(x) +#endif + + #define WXLO_DEBUG_URECT 0 #ifndef WXLO_DEFAULTFONTSIZE @@ -71,7 +92,9 @@ enum wxLayoutObjectType /// command object, containing font or colour changes WXLO_TYPE_CMD, /// icon object, any kind of image - WXLO_TYPE_ICON + WXLO_TYPE_ICON, + /// a linebreak, does not exist as an object + WXLO_TYPE_LINEBREAK }; /// Type used for coordinates in drawing. Must be signed. @@ -171,7 +194,7 @@ public: virtual ~wxLayoutObject() { if(m_UserData) m_UserData->DecRef(); } #ifdef WXLAYOUT_DEBUG - virtual void Debug(void); + virtual wxString DebugDump(void) const; #endif /** Tells the object about some user data. This data is associated @@ -266,7 +289,7 @@ public: static wxLayoutObjectText *Read(wxString &istr); #ifdef WXLAYOUT_DEBUG - virtual void Debug(void); + virtual wxString DebugDump(void) const; #endif virtual CoordType GetLength(void) const { return strlen(m_Text.c_str()); } @@ -475,11 +498,18 @@ public: void Append(wxLayoutObject * obj) { wxASSERT(obj); - m_ObjectList.push_back(obj); m_Length += obj->GetLength(); } + /** This function prepends an object to the line. */ + void Prepend(wxLayoutObject * obj) + { + wxASSERT(obj); + m_ObjectList.push_front(obj); + m_Length += obj->GetLength(); + } + /** This function appens the next line to this, i.e. joins the two lines into one. */ @@ -498,6 +528,13 @@ public: */ wxLayoutLine *Break(CoordType xpos, wxLayoutList *llist); + /** This function wraps the line: breaks it at a suitable point + and merges it with the next. + @param wrapmargin + @return TRUE if broken + */ + bool Wrap(CoordType wrapmargin, wxLayoutList *llist); + /** Deletes the next word from this position, including leading whitespace. This function does not delete over font changes, i.e. a word @@ -662,7 +699,7 @@ public: CoordType to = -1); #ifdef WXLAYOUT_DEBUG - void Debug(void); + void Debug(void) const; #endif wxLayoutStyleInfo const & GetStyleInfo() const { return m_StyleInfo; } @@ -680,6 +717,7 @@ public: } m_Dirty = true; + if(m_Next) m_Next->MarkDirty(); } /// Reset the dirty flag void MarkClean() { m_Dirty = false; m_updateLeft = -1; } @@ -815,7 +853,8 @@ public: /// Returns current cursor position. const wxPoint &GetCursorPos(wxDC &dc) const { return m_CursorPos; } const wxPoint &GetCursorPos() const { return m_CursorPos; } - + wxLayoutLine * GetCursorLine(void) { return m_CursorLine; } + /// move cursor to the end of text void MoveCursorToEnd(void) { @@ -845,6 +884,12 @@ public: @return true if line got broken */ bool WrapLine(CoordType column); + + /** Wraps the complete buffer. + @param column the break position for the line, maximum length + @return true if line got broken + */ + bool WrapAll(CoordType column); /** This function deletes npos cursor positions. @param npos how many positions @return true if everything got deleted @@ -1142,7 +1187,8 @@ public: /// get the line by number wxLayoutLine *GetLine(CoordType index) const; - /** Reads objects from a string and inserts them. + /** Reads objects from a string and inserts them. Returns NULL if + string is empty or a linebreak was found. @param istr stream to read from, will bee changed */ void Read(wxString &istr); diff --git a/samples/richedit/wxlwindow.cpp b/samples/richedit/wxlwindow.cpp index 0993e2ca99..125790f178 100644 --- a/samples/richedit/wxlwindow.cpp +++ b/samples/richedit/wxlwindow.cpp @@ -1,7 +1,7 @@ /*-*- c++ -*-******************************************************** * wxLwindow.h : a scrolled Window for displaying/entering rich text* * * - * (C) 1998, 1999 by Karsten Ballüder (karsten@phy.hw.ac.uk) * + * (C) 1998-2000 by Karsten Ballüder (ballueder@gmx.net) * * * * $Id$ *******************************************************************/ @@ -56,6 +56,7 @@ #include <ctype.h> + // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -66,6 +67,13 @@ # define WXLO_DEBUG(x) #endif +// for profiling in debug mode: +WXLO_TIMER_DEFINE(UpdateTimer); +WXLO_TIMER_DEFINE(BlitTimer); +WXLO_TIMER_DEFINE(LayoutTimer); +WXLO_TIMER_DEFINE(TmpTimer); +WXLO_TIMER_DEFINE(DrawTimer); + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -160,6 +168,7 @@ wxLayoutWindow::wxLayoutWindow(wxWindow *parent) #ifndef __WXMSW__ m_FocusFollowMode = false; #endif + SetWordWrap(false); SetWrapMargin(0); // no scrollbars initially @@ -230,10 +239,11 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event) { wxClientDC dc( this ); PrepareDC( dc ); - if ( eventId != WXLOWIN_MENU_MOUSEMOVE + if ( (eventId != WXLOWIN_MENU_MOUSEMOVE #ifndef __WXMSW__ || m_FocusFollowMode #endif + ) && (wxWindow::FindFocus() != this) ) SetFocus(); @@ -479,6 +489,7 @@ wxLayoutWindow::OnChar(wxKeyEvent& event) bool deletedSelection = false; // pressing any non-arrow key optionally replaces the selection: if(m_AutoDeleteSelection + && IsEditable() && !m_Selecting && m_llist->HasSelection() && ! IsDirectionKey(keyCode) @@ -635,10 +646,21 @@ wxLayoutWindow::OnChar(wxKeyEvent& event) case 'x': Cut(); break; + case 'w': + if(m_WrapMargin > 0) + m_llist->WrapLine(m_WrapMargin); + break; + case 'q': + if(m_WrapMargin > 0) + m_llist->WrapAll(m_WrapMargin); + break; #ifdef WXLAYOUT_DEBUG case WXK_F1: m_llist->SetFont(-1,-1,-1,-1,true); // underlined break; + case 'l': + Refresh(TRUE); + break; #endif default: // we don't handle it, maybe an accelerator? @@ -688,7 +710,9 @@ wxLayoutWindow::OnChar(wxKeyEvent& event) } break; case WXK_RETURN: - if(m_WrapMargin > 0) + if(m_DoWordWrap && + m_WrapMargin > 0 + && m_llist->GetCursorPos().x > m_WrapMargin) m_llist->WrapLine(m_WrapMargin); m_llist->LineBreak(); SetDirty(); @@ -706,23 +730,19 @@ wxLayoutWindow::OnChar(wxKeyEvent& event) SetDirty(); } break; - + default: if((!(event.ControlDown() || event.AltDown() )) && (keyCode < 256 && keyCode >= 32) ) { - if(m_WrapMargin > 0 && isspace(keyCode)) - { - bool wrapped = m_llist->WrapLine(m_WrapMargin); - // don´t insert space as first thing in line - // after wrapping: - if(! wrapped || m_llist->GetCursorPos().x != 0) - m_llist->Insert((char)keyCode); - } - else - m_llist->Insert((char)keyCode); + if(m_DoWordWrap + && m_WrapMargin > 0 + && m_llist->GetCursorPos().x > m_WrapMargin + && isspace(keyCode)) + m_llist->WrapLine(m_WrapMargin); + m_llist->Insert((char)keyCode); SetDirty(); } else @@ -765,7 +785,10 @@ wxLayoutWindow::ScrollToCursor(void) { //is always needed to make sure we know where the cursor is //if(IsDirty()) - RequestUpdate(m_llist->GetUpdateRect()); + //RequestUpdate(m_llist->GetUpdateRect()); + + + ResizeScrollbars(); int x0,y0,x1,y1, dx, dy; @@ -802,7 +825,7 @@ wxLayoutWindow::ScrollToCursor(void) ny = 0; } - if ( nx != -1 || ny != -1 ) + if( nx != -1 || ny != -1 ) { // set new view start Scroll(nx == -1 ? -1 : (nx+dx-1)/dx, ny == -1 ? -1 : (ny+dy-1)/dy); @@ -836,6 +859,7 @@ wxLayoutWindow::RequestUpdate(const wxRect *updateRect) void wxLayoutWindow::InternalPaint(const wxRect *updateRect) { + wxPaintDC dc( this ); PrepareDC( dc ); @@ -864,9 +888,9 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect) updateRect->y+updateRect->height)); } - ResizeScrollbars(); + ResizeScrollbars(true); - + WXLO_TIMER_START(TmpTimer); /* Check whether the window has grown, if so, we need to reallocate the bitmap to be larger. */ if(x1 > m_bitmapSize.x || y1 > m_bitmapSize.y) @@ -887,7 +911,8 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect) 0,wxTRANSPARENT)); m_memDC->SetLogicalFunction(wxCOPY); m_memDC->Clear(); - + WXLO_TIMER_STOP(TmpTimer); + // fill the background with the background bitmap if(m_BGbitmap) { @@ -922,7 +947,7 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect) // update rectangle (although they are drawn on the memDC, this is // needed to erase it): m_llist->InvalidateUpdateRect(); - if(m_CursorVisibility != 0) + if(m_CursorVisibility == 1) { // draw a thick cursor for editable windows with focus m_llist->DrawCursor(*m_memDC, @@ -930,6 +955,7 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect) offset); } + WXLO_TIMER_START(BlitTimer); // Now copy everything to the screen: #if 0 // This somehow doesn't work, but even the following bit with the @@ -955,6 +981,8 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect) // y1 += WXLO_YOFFSET; //FIXME might not be needed dc.Blit(x0,y0,x1,y1,m_memDC,0,0,wxCOPY,FALSE); } + WXLO_TIMER_STOP(BlitTimer); + #ifdef WXLAYOUT_USE_CARET // show the caret back after everything is redrawn @@ -979,6 +1007,10 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect) m_StatusBar->SetStatusText(label, m_StatusFieldCursor); } } + + WXLO_TIMER_PRINT(LayoutTimer); + WXLO_TIMER_PRINT(BlitTimer); + WXLO_TIMER_PRINT(TmpTimer); } void @@ -999,14 +1031,20 @@ as needed. void wxLayoutWindow::ResizeScrollbars(bool exact) { + wxClientDC dc( this ); + PrepareDC( dc ); +// m_llist->ForceTotalLayout(); if(! IsDirty()) + { + // we are laying out just the minimum, but always up to the + // cursor line, so the cursor position is updated. + m_llist->Layout(dc, 0); return; - - wxClientDC dc( this ); - PrepareDC( dc ); -// m_llist->ForceTotalLayout(); - m_llist->Layout(dc); + } + WXLO_TIMER_START(LayoutTimer); + m_llist->Layout(dc, -1); + WXLO_TIMER_STOP(LayoutTimer); ResetDirty(); wxPoint max = m_llist->GetSize(); @@ -1025,8 +1063,8 @@ wxLayoutWindow::ResizeScrollbars(bool exact) // TODO why do we set both at once? they're independent... if( max.x > m_maxx - WXLO_ROFFSET || max.y > m_maxy - WXLO_BOFFSET - || max.x < m_maxx - X_SCROLL_PAGE - || max.y < m_maxy - Y_SCROLL_PAGE + || (max.x < m_maxx - X_SCROLL_PAGE) + || (max.y < m_maxy - Y_SCROLL_PAGE) || exact ) { // text became too large @@ -1038,31 +1076,36 @@ wxLayoutWindow::ResizeScrollbars(bool exact) } bool done = FALSE; - if(max.x < X_SCROLL_PAGE) + if(max.x < X_SCROLL_PAGE && m_hasHScrollbar) { SetScrollbars(0,-1,0,-1,0,-1,true); m_hasHScrollbar = FALSE; done = TRUE; } - if(max.y < Y_SCROLL_PAGE) + if(max.y < Y_SCROLL_PAGE && m_hasVScrollbar) { SetScrollbars(-1,0,-1,0,-1,0,true); m_hasVScrollbar = FALSE; done = TRUE; } - if(! done) + if(! done && +// (max.x > X_SCROLL_PAGE || max.y > Y_SCROLL_PAGE) + (max.x > size.x - X_SCROLL_PAGE|| max.y > size.y - Y_SCROLL_PAGE) + ) { ViewStart(&m_ViewStartX, &m_ViewStartY); SetScrollbars(X_SCROLL_PAGE, Y_SCROLL_PAGE, - max.x / X_SCROLL_PAGE + 1, - max.y / Y_SCROLL_PAGE + 1, - m_ViewStartX, m_ViewStartY, + max.x / X_SCROLL_PAGE + 2, + max.y / Y_SCROLL_PAGE + 2, + m_ViewStartX, + m_ViewStartY, true); m_hasHScrollbar = m_hasVScrollbar = true; +// ScrollToCursor(); } - + m_maxx = max.x + X_SCROLL_PAGE; m_maxy = max.y + Y_SCROLL_PAGE; } diff --git a/samples/richedit/wxlwindow.h b/samples/richedit/wxlwindow.h index fa0ba4b291..8958e62fab 100644 --- a/samples/richedit/wxlwindow.h +++ b/samples/richedit/wxlwindow.h @@ -1,7 +1,7 @@ /*-*- c++ -*-******************************************************** * wxLwindow.h : a scrolled Window for displaying/entering rich text* * * - * (C) 1998-1999 by Karsten Ballüder (karsten@phy.hw.ac.uk) * + * (C) 1998-2000 by Karsten Ballüder (ballueder@gmx.net) * * * * $Id$ *******************************************************************/ @@ -118,6 +118,11 @@ public: */ void SetWrapMargin(CoordType margin) { m_WrapMargin = margin; } + /** Toggle wordwrap as we type. + @param on true to activate word wrap + */ + void SetWordWrap(bool on = true) { m_DoWordWrap = on; } + /** Redraws the window. Internally, this stores the parameter and calls a refresh on wxMSW, draws directly on wxGTK. @@ -230,6 +235,10 @@ protected: int m_maxx; int m_maxy; int m_lineHeight; + /// do we want automatic word wrap? + bool m_DoWordWrap; + /// wrap margin + CoordType m_WrapMargin; /// do we have the corresponding scrollbar? bool m_hasHScrollbar, @@ -253,8 +262,6 @@ private: bool m_Editable; /// Are we currently building a selection with the keyboard? bool m_Selecting; - /// wrap margin - CoordType m_WrapMargin; /// Has list changed since last redraw, e.g. in size? bool m_Dirty; /// Has the list ever been modified? diff --git a/samples/rotate/rotate.cpp b/samples/rotate/rotate.cpp index 5ab6b68b92..89c7a0d299 100644 --- a/samples/rotate/rotate.cpp +++ b/samples/rotate/rotate.cpp @@ -43,6 +43,19 @@ private: }; +class MyCanvas: public wxScrolledWindow +{ +public: + MyCanvas(wxWindow* parent); + + void OnMouseLeftUp (wxMouseEvent & event); + void OnMouseRightUp (wxMouseEvent & event); + +private: + + DECLARE_EVENT_TABLE() +}; + class MyFrame: public wxFrame { public: @@ -50,10 +63,7 @@ public: void OnQuit (wxCommandEvent &); void OnAngle(wxCommandEvent &); - void OnMouseLeftUp (wxMouseEvent & event); - void OnMouseRightUp (wxMouseEvent & event); -private: double m_angle; DECLARE_EVENT_TABLE() @@ -65,16 +75,18 @@ enum ID_Angle }; +BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) + EVT_LEFT_UP (MyCanvas::OnMouseLeftUp) + EVT_RIGHT_UP (MyCanvas::OnMouseRightUp) +END_EVENT_TABLE() + BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU (ID_Quit, MyFrame::OnQuit) EVT_MENU (ID_Angle, MyFrame::OnAngle) - EVT_LEFT_UP (MyFrame::OnMouseLeftUp) - EVT_RIGHT_UP (MyFrame::OnMouseRightUp) END_EVENT_TABLE() IMPLEMENT_APP(MyApp) - bool MyApp::OnInit() { m_image = wxImage("kclub.bmp", wxBITMAP_TYPE_BMP); @@ -92,8 +104,6 @@ bool MyApp::OnInit() MyFrame *frame = new MyFrame ("wxWindows rotate sample", wxPoint(20,20), wxSize(600,450)); - frame->SetBackgroundColour (wxColour (0,80,60)); - frame->Clear(); frame->Show (TRUE); SetTopWindow (frame); return TRUE; @@ -104,6 +114,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) { m_angle = 0.1; + new MyCanvas(this); + wxMenu *menuFile = new wxMenu; menuFile->Append (ID_Angle, "Set &angle\tCtrl-A"); menuFile->AppendSeparator(); @@ -124,7 +136,8 @@ void MyFrame::OnAngle (wxCommandEvent &) degrees, -180, +180, this); - m_angle = (degrees * M_PI) / 180.0; + if ( degrees != -1 ) + m_angle = (degrees * M_PI) / 180.0; } void MyFrame::OnQuit (wxCommandEvent &) @@ -132,13 +145,21 @@ void MyFrame::OnQuit (wxCommandEvent &) Close (TRUE); } +MyCanvas::MyCanvas(wxWindow* parent): + wxScrolledWindow(parent, -1) +{ + SetBackgroundColour (wxColour (0,80,60)); + Clear(); +} // Rotate with interpolation and with offset correction -void MyFrame::OnMouseLeftUp (wxMouseEvent & event) +void MyCanvas::OnMouseLeftUp (wxMouseEvent & event) { + MyFrame* frame = (MyFrame*) GetParent(); + wxPoint offset; const wxImage& img = wxGetApp().GetImage(); - wxImage img2 = img.Rotate(m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), TRUE, &offset); + wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), TRUE, &offset); wxBitmap bmp = img2.ConvertToBitmap (); @@ -147,10 +168,12 @@ void MyFrame::OnMouseLeftUp (wxMouseEvent & event) } // without interpolation, and without offset correction -void MyFrame::OnMouseRightUp (wxMouseEvent & event) +void MyCanvas::OnMouseRightUp (wxMouseEvent & event) { + MyFrame* frame = (MyFrame*) GetParent(); + const wxImage& img = wxGetApp().GetImage(); - wxImage img2 = img.Rotate(m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), FALSE); + wxImage img2 = img.Rotate(frame->m_angle, wxPoint(img.GetWidth()/2, img.GetHeight()/2), FALSE); wxBitmap bmp = img2.ConvertToBitmap (); diff --git a/samples/sashtest/makefile.g95 b/samples/sashtest/makefile.g95 index 9e76f66b10..fe93070c07 100644 --- a/samples/sashtest/makefile.g95 +++ b/samples/sashtest/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=sashtest OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/sashtest/sashtest.cpp b/samples/sashtest/sashtest.cpp index 128f20e495..9ae3762560 100644 --- a/samples/sashtest/sashtest.cpp +++ b/samples/sashtest/sashtest.cpp @@ -43,7 +43,7 @@ bool MyApp::OnInit(void) // Create the main frame window frame = new MyFrame(NULL, -1, "Sash Demo", wxPoint(0, 0), wxSize(500, 400), - wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); + wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); // Give it an icon (this is ignored in MDI mode: uses resources) #ifdef __WXMSW__ @@ -266,6 +266,7 @@ END_EVENT_TABLE() MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size): wxScrolledWindow(parent, -1, pos, size, wxSUNKEN_BORDER) { + SetBackgroundColour(* wxWHITE); } // Define the repainting behaviour diff --git a/samples/scroll/scroll.cpp b/samples/scroll/scroll.cpp index c16f08b042..b190de4637 100644 --- a/samples/scroll/scroll.cpp +++ b/samples/scroll/scroll.cpp @@ -188,12 +188,9 @@ void MyCanvas::OnMouseDown( wxMouseEvent &event ) int x,y; CalcUnscrolledPosition( pt.x, pt.y, &x, &y ); wxLogMessage( "Mouse down event at: %d %d, scrolled: %d %d", pt.x, pt.y, x, y ); - } - - if (event.LeftIsDown() && - event.LeftDown()) - { - wxLogMessage( "Error: both LeftDown() and LeftIsDown() are TRUE!" ); + + if ( !event.LeftIsDown() ) + wxLogMessage( "Error: LeftIsDown() should be TRUE if for LeftDown()" ); } } diff --git a/samples/splitter/makefile.g95 b/samples/splitter/makefile.g95 index fc4af58f1d..2766d0e106 100644 --- a/samples/splitter/makefile.g95 +++ b/samples/splitter/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=splitter OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/splitter/splitter.cpp b/samples/splitter/splitter.cpp index 054e799a9c..c28422a5a8 100644 --- a/samples/splitter/splitter.cpp +++ b/samples/splitter/splitter.cpp @@ -90,7 +90,7 @@ DECLARE_EVENT_TABLE() class MyCanvas: public wxScrolledWindow { public: - MyCanvas(wxWindow* parent, wxWindowID id, int x, int y, int w, int h, const wxString &name); + MyCanvas(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxString& name = ""); virtual ~MyCanvas(); virtual void OnDraw(wxDC& dc); @@ -170,12 +170,12 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, cons wxSize sz( m_splitter->GetSize() ); wxLogMessage( "Initial splitter size: %d %d\n", (int)sz.x, (int)sz.y ); - m_leftCanvas = new MyCanvas(m_splitter, CANVAS1, 0, 0, 400, 400, "Test1" ); + m_leftCanvas = new MyCanvas(m_splitter, CANVAS1, wxPoint(0, 0), wxSize(400, 400), "Test1" ); m_leftCanvas->SetBackgroundColour(*wxRED); m_leftCanvas->SetScrollbars(20, 20, 50, 50); m_leftCanvas->SetCursor(wxCursor(wxCURSOR_MAGNIFIER)); - m_rightCanvas = new MyCanvas(m_splitter, CANVAS2, 0, 0, 400, 400, "Test2" ); + m_rightCanvas = new MyCanvas(m_splitter, CANVAS2, wxPoint(0, 0), wxSize(400, 400), "Test2" ); m_rightCanvas->SetBackgroundColour(*wxCYAN); m_rightCanvas->SetScrollbars(20, 20, 50, 50); m_rightCanvas->Show(FALSE); @@ -256,8 +256,8 @@ void MyFrame::UpdatePosition() SetStatusText(str); } -MyCanvas::MyCanvas(wxWindow* parent, wxWindowID id, int x, int y, int w, int h, const wxString &name ) : - wxScrolledWindow(parent, id, wxPoint(x, y), wxSize(w, h), 0, name ) +MyCanvas::MyCanvas(wxWindow* parent, wxWindowID id, const wxPoint& point, const wxSize& size, const wxString &name ) : + wxScrolledWindow(parent, id, point, size, 0, name ) { } diff --git a/samples/statbar/makefile.g95 b/samples/statbar/makefile.g95 index e641b5144a..af0dfc16c8 100644 --- a/samples/statbar/makefile.g95 +++ b/samples/statbar/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=statbar OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/statbar/statbar.cpp b/samples/statbar/statbar.cpp index 158b31403b..588d97b2f5 100644 --- a/samples/statbar/statbar.cpp +++ b/samples/statbar/statbar.cpp @@ -46,16 +46,26 @@ #include "wx/textdlg.h" #include "wx/sizer.h" #include "wx/stattext.h" + #include "wx/bmpbuttn.h" + #include "wx/dcmemory.h" #endif #include "wx/datetime.h" +// define this for the platforms which don't support wxBitmapButton (such as +// Motif), else a wxBitmapButton will be used +#ifdef __WXMOTIF__ + #define USE_STATIC_BITMAP +#endif + // ---------------------------------------------------------------------------- // resources // ---------------------------------------------------------------------------- -#include "green.xpm" -#include "red.xpm" +#ifdef USE_STATIC_BITMAP + #include "green.xpm" + #include "red.xpm" +#endif // USE_STATIC_BITMAP // ---------------------------------------------------------------------------- // private classes @@ -87,8 +97,14 @@ public: void OnTimer(wxTimerEvent& event) { UpdateClock(); } void OnSize(wxSizeEvent& event); void OnToggleClock(wxCommandEvent& event); + void OnButton(wxCommandEvent& event); private: + // toggle the state of the status bar controls + void DoToggle(); + + wxBitmap CreateBitmapForButton(bool on = FALSE); + enum { Field_Text, @@ -101,7 +117,11 @@ private: wxTimer m_timer; wxCheckBox *m_checkbox; +#ifdef USE_STATIC_BITMAP wxStaticBitmap *m_statbmp; +#else + wxBitmapButton *m_statbmp; +#endif DECLARE_EVENT_TABLE() }; @@ -180,6 +200,7 @@ END_EVENT_TABLE() BEGIN_EVENT_TABLE(MyStatusBar, wxStatusBar) EVT_SIZE(MyStatusBar::OnSize) EVT_CHECKBOX(StatusBar_Checkbox, MyStatusBar::OnToggleClock) + EVT_BUTTON(-1, MyStatusBar::OnButton) EVT_TIMER(-1, MyStatusBar::OnTimer) END_EVENT_TABLE() @@ -295,8 +316,8 @@ void MyFrame::DoCreateStatusBar(MyFrame::StatBarKind kind) wxFAIL_MSG("unknown stat bar kind"); } - PositionStatusBar(); GetStatusBar()->Show(); + PositionStatusBar(); m_statbarKind = kind; } @@ -412,7 +433,7 @@ MyAboutDialog::MyAboutDialog(wxWindow *parent) #endif MyStatusBar::MyStatusBar(wxWindow *parent) - : wxStatusBar(parent, -1), m_timer(this) + : wxStatusBar(parent, -1), m_timer(this), m_checkbox(NULL) { static const int widths[Field_Max] = { -1, 150, BITMAP_SIZE_X, 100 }; @@ -422,7 +443,11 @@ MyStatusBar::MyStatusBar(wxWindow *parent) m_checkbox = new wxCheckBox(this, StatusBar_Checkbox, _T("&Toggle clock")); m_checkbox->SetValue(TRUE); +#ifdef USE_STATIC_BITMAP m_statbmp = new wxStaticBitmap(this, -1, wxIcon(green_xpm)); +#else + m_statbmp = new wxBitmapButton(this, -1, CreateBitmapForButton()); +#endif m_timer.Start(1000); @@ -443,27 +468,70 @@ MyStatusBar::~MyStatusBar() } } +wxBitmap MyStatusBar::CreateBitmapForButton(bool on) +{ + static const int BMP_BUTTON_SIZE_X = 10; + static const int BMP_BUTTON_SIZE_Y = 9; + + wxBitmap bitmap(BMP_BUTTON_SIZE_X, BMP_BUTTON_SIZE_Y); + wxMemoryDC dc; + dc.SelectObject(bitmap); + dc.SetBrush(on ? *wxGREEN_BRUSH : *wxRED_BRUSH); + dc.SetBackground(*wxLIGHT_GREY_BRUSH); + dc.Clear(); + dc.DrawEllipse(0, 0, BMP_BUTTON_SIZE_X, BMP_BUTTON_SIZE_Y); + dc.SelectObject(wxNullBitmap); + + return bitmap; +} + void MyStatusBar::OnSize(wxSizeEvent& event) { + if ( !m_checkbox ) + return; + wxRect rect; GetFieldRect(Field_Checkbox, rect); m_checkbox->SetSize(rect.x + 2, rect.y + 2, rect.width - 4, rect.height - 4); GetFieldRect(Field_Bitmap, rect); - m_statbmp->Move(rect.x + (rect.width - BITMAP_SIZE_X) / 2, - rect.y + (rect.height - BITMAP_SIZE_Y) / 2); +#ifdef USE_BUTTON_FOR_BITMAP + wxSize size(BITMAP_SIZE_X, BITMAP_SIZE_Y); +#else + wxSize size = m_statbmp->GetSize(); +#endif + + m_statbmp->Move(rect.x + (rect.width - size.x) / 2, + rect.y + (rect.height - size.y) / 2); event.Skip(); } -void MyStatusBar::OnToggleClock(wxCommandEvent& event) +void MyStatusBar::OnButton(wxCommandEvent& WXUNUSED(event)) +{ + m_checkbox->SetValue(!m_checkbox->GetValue()); + + DoToggle(); +} + +void MyStatusBar::OnToggleClock(wxCommandEvent& WXUNUSED(event)) +{ + DoToggle(); +} + +void MyStatusBar::DoToggle() { if ( m_checkbox->GetValue() ) { m_timer.Start(1000); +#ifdef USE_STATIC_BITMAP m_statbmp->SetIcon(wxIcon(green_xpm)); +#else + m_statbmp->SetBitmapLabel(CreateBitmapForButton(FALSE)); + m_statbmp->Refresh(); +#endif UpdateClock(); } @@ -471,7 +539,12 @@ void MyStatusBar::OnToggleClock(wxCommandEvent& event) { m_timer.Stop(); +#ifdef USE_STATIC_BITMAP m_statbmp->SetIcon(wxIcon(red_xpm)); +#else + m_statbmp->SetBitmapLabel(CreateBitmapForButton(TRUE)); + m_statbmp->Refresh(); +#endif SetStatusText("", Field_Clock); } diff --git a/samples/stc/Makefile.in b/samples/stc/Makefile.in index 39b2292d0d..cffdcc78d7 100644 --- a/samples/stc/Makefile.in +++ b/samples/stc/Makefile.in @@ -13,9 +13,9 @@ PROGRAM=stctest OBJECTS=$(PROGRAM).o -APPEXTRALIBS=$(top_builddir)/contrib/src/stc/libstc.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRALIBS=$(top_builddir)/lib/libstc.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include DATAFILES=stctest.cpp -include ../../../src/makeprog.env +include $(top_builddir)/src/makeprog.env diff --git a/samples/tab/makefile.g95 b/samples/tab/makefile.g95 index 22604cb9ca..6415ef0c17 100644 --- a/samples/tab/makefile.g95 +++ b/samples/tab/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=tab OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/taskbar/tbtest.cpp b/samples/taskbar/tbtest.cpp index 98c0658536..45896485f1 100644 --- a/samples/taskbar/tbtest.cpp +++ b/samples/taskbar/tbtest.cpp @@ -111,6 +111,11 @@ void MyTaskBarIcon::OnMenuRestore(wxCommandEvent& ) void MyTaskBarIcon::OnMenuExit(wxCommandEvent& ) { dialog->Close(TRUE); + + // Nudge wxWindows into destroying the dialog, since + // with a hidden window no messages will get sent to put + // it into idle processing. + wxGetApp().ProcessIdle(); } diff --git a/samples/text/makefile.b32 b/samples/text/makefile.b32 index 8accc1bcfd..0c85385358 100644 --- a/samples/text/makefile.b32 +++ b/samples/text/makefile.b32 @@ -9,8 +9,17 @@ WXDIR = $(WXWIN) -TARGET=controls +TARGET=texttst OBJECTS = $(TARGET).obj +# We have to copy to a different root name, +# since BC++ doesn't seem to like the name 'text' +# when linking +all: copyfiles $(TARGET).exe $(EXTRATARGETS) + !include $(WXDIR)\src\makeprog.b32 +copyfiles: + copy text.cpp texttst.cpp + copy text.rc texttst.rc + diff --git a/samples/text/makefile.bcc b/samples/text/makefile.bcc index 400c6539d2..2577cf9245 100644 --- a/samples/text/makefile.bcc +++ b/samples/text/makefile.bcc @@ -12,7 +12,7 @@ WXDIR = $(WXWIN) -TARGET=controls +TARGET=text OBJECTS=$(TARGET).obj !include $(WXDIR)\src\makeprog.bcc diff --git a/samples/text/makefile.wat b/samples/text/makefile.wat index db1d6cc5b6..6ba2275933 100644 --- a/samples/text/makefile.wat +++ b/samples/text/makefile.wat @@ -7,7 +7,7 @@ WXDIR = $(%WXWIN) -PROGRAM = controls +PROGRAM = text OBJECTS = $(PROGRAM).obj !include $(WXDIR)\src\makeprog.wat diff --git a/samples/text/text.cpp b/samples/text/text.cpp index 2f6c1a5de8..03895e1d11 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -70,7 +70,7 @@ public: void OnText(wxCommandEvent& event); void OnMouseEvent(wxMouseEvent& event); - bool m_hasCapture; + bool m_hasCapture; private: static inline wxChar GetChar(bool on, wxChar c) { return on ? c : _T('-'); } @@ -139,6 +139,9 @@ public: void OnFileSave(wxCommandEvent& event); void OnFileLoad(wxCommandEvent& event); + void OnSetEditable(wxCommandEvent& event); + void OnSetEnabled(wxCommandEvent& event); + void OnIdle( wxIdleEvent& event ); private: @@ -173,9 +176,11 @@ enum TEXT_TOOLTIPS_SETDELAY = 300, TEXT_TOOLTIPS_ENABLE, - // move menu + // text menu TEXT_MOVE_ENDTEXT = 400, - TEXT_MOVE_ENDENTRY + TEXT_MOVE_ENDENTRY, + TEXT_SET_EDITABLE, + TEXT_SET_ENABLED }; bool MyApp::OnInit() @@ -219,10 +224,14 @@ bool MyApp::OnInit() menu_bar->Append(menuClipboard, "&Clipboard"); #endif // wxUSE_CLIPBOARD - wxMenu *menuMove = new wxMenu; - menuMove->Append(TEXT_MOVE_ENDTEXT, "To the end of &text"); - menuMove->Append(TEXT_MOVE_ENDENTRY, "To the end of &entry"); - menu_bar->Append(menuMove, "&Move"); + wxMenu *menuText = new wxMenu; + menuText->Append(TEXT_MOVE_ENDTEXT, "Move cursor to the end of &text"); + menuText->Append(TEXT_MOVE_ENDENTRY, "Move cursor to the end of &entry"); + menuText->Append(TEXT_SET_EDITABLE, "Toggle &editable state", "", TRUE); + menuText->Append(TEXT_SET_ENABLED, "Toggle e&nabled state", "", TRUE); + menuText->Check(TEXT_SET_EDITABLE, TRUE); + menuText->Check(TEXT_SET_ENABLED, TRUE); + menu_bar->Append(menuText, "&Text"); frame->SetMenuBar(menu_bar); @@ -447,6 +456,10 @@ void MyTextCtrl::OnText(wxCommandEvent& event) { wxLogMessage(_T("Text changed in control '%s'"), data); } + else + { + wxLogMessage(_T("Text changed in some control")); + } } void MyTextCtrl::OnChar(wxKeyEvent& event) @@ -488,11 +501,12 @@ void MyTextCtrl::OnKeyDown(wxKeyEvent& event) "Current line, column: (%ld, %ld)\n" "Number of lines: %ld\n" "Current line length: %ld\n" - "Total text length: %ld"), + "Total text length: %u (%ld)"), pos, line, column, GetNumberOfLines(), GetLineLength(line), + GetValue().length(), GetLastPosition()); } break; @@ -527,10 +541,17 @@ void MyTextCtrl::OnKeyDown(wxKeyEvent& event) WriteText("\n"); break; - default: - LogEvent( wxT("Key down"), event); + case WXK_F6: + SetValue("F6 was just pressed."); + break; + + case WXK_F7: + ShowPosition(10); + break; } + LogEvent( wxT("Key down"), event); + event.Skip(); } @@ -554,7 +575,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) // single line text controls m_text = new MyTextCtrl( this, -1, "Single line.", - wxPoint(10,10), wxSize(140,-1), 0); + wxPoint(10,10), wxSize(140,-1), + wxTE_PROCESS_ENTER); m_text->SetForegroundColour(*wxBLUE); m_text->SetBackgroundColour(*wxLIGHT_GREY); (*m_text) << " Appended."; @@ -571,16 +593,39 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_horizontal = new MyTextCtrl( this, -1, "Multiline text control with a horizontal scrollbar.", wxPoint(10,170), wxSize(140,70), wxTE_MULTILINE | wxHSCROLL ); - m_horizontal->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxNORMAL, - FALSE, "", wxFONTENCODING_ISO8859_2)); //wxFONTENCODING_KOI8)); - //m_horizontal->SetValue("ËÁÖÅÔÓÑ ÕÄÁÞÎÙÍ"); - m_horizontal->SetValue("®lu»ouèký kùò zbìsile èe¹tina «»"); + + // a little hack to use the command line argument for encoding testing + if ( wxTheApp->argc == 2 ) + { + switch ( wxTheApp->argv[1][0] ) + { + case '2': + m_horizontal->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxNORMAL, + FALSE, "", + wxFONTENCODING_ISO8859_2)); + m_horizontal->SetValue("®lu»ouèký kùò zbìsile èe¹tina «»"); + break; + + default: + m_horizontal->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxNORMAL, + FALSE, "", + wxFONTENCODING_KOI8)); + m_horizontal->SetValue("ËÁÖÅÔÓÑ ÕÄÁÞÎÙÍ"); + } + } + else + { + m_horizontal->SetValue("Text in default encoding"); + } m_multitext = new MyTextCtrl( this, -1, "Multi line.", wxPoint(180,10), wxSize(240,70), wxTE_MULTILINE ); + m_multitext->SetFont(*wxITALIC_FONT); (*m_multitext) << " Appended."; m_multitext->SetInsertionPoint(0); m_multitext->WriteText( "Prepended. " ); + m_multitext->SetForegroundColour(*wxRED); + m_multitext->SetBackgroundColour(*wxLIGHT_GREY); #if wxUSE_TOOLTIPS m_multitext->SetToolTip("Press F1 here for statitics, F4 for capture and uncapture mouse."); @@ -595,9 +640,14 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_enter->SetClientData((void *)_T("enter")); m_textrich = new MyTextCtrl(this, -1, "Allows more than 30Kb of text\n" - "(even under broken Win9x)", + "(even under broken Win9x)\n" + "and a very very very very very " + "very very very long line to test" + "wxHSCROLL style", wxPoint(450, 10), wxSize(200, 230), - wxTE_RICH | wxTE_MULTILINE); + wxTE_RICH | wxTE_MULTILINE | wxHSCROLL); + m_textrich->SetForegroundColour(wxColour(0, 255, 255)); + m_textrich->SetBackgroundColour(*wxBLUE); } void MyPanel::OnSize( wxSizeEvent &event ) @@ -732,6 +782,9 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(TEXT_MOVE_ENDTEXT, MyFrame::OnMoveToEndOfText) EVT_MENU(TEXT_MOVE_ENDENTRY, MyFrame::OnMoveToEndOfEntry) + EVT_MENU(TEXT_SET_EDITABLE, MyFrame::OnSetEditable) + EVT_MENU(TEXT_SET_ENABLED, MyFrame::OnSetEnabled) + EVT_IDLE(MyFrame::OnIdle) END_EVENT_TABLE() @@ -805,6 +858,29 @@ void MyFrame::OnLogClear(wxCommandEvent& WXUNUSED(event)) m_panel->m_log->Clear(); } +void MyFrame::OnSetEditable(wxCommandEvent& WXUNUSED(event)) +{ + static bool s_editable = TRUE; + + s_editable = !s_editable; + m_panel->m_text->SetEditable(s_editable); + m_panel->m_password->SetEditable(s_editable); + m_panel->m_multitext->SetEditable(s_editable); + m_panel->m_textrich->SetEditable(s_editable); +} + +void MyFrame::OnSetEnabled(wxCommandEvent& WXUNUSED(event)) +{ + bool enabled = m_panel->m_text->IsEnabled(); + enabled = !enabled; + + m_panel->m_text->Enable(enabled); + m_panel->m_password->Enable(enabled); + m_panel->m_multitext->Enable(enabled); + m_panel->m_readonly->Enable(enabled); + m_panel->m_textrich->Enable(enabled); +} + void MyFrame::OnFileSave(wxCommandEvent& event) { if ( m_panel->m_textrich->SaveFile("dummy.txt") ) diff --git a/samples/thread/makefile.g95 b/samples/thread/makefile.g95 index bc6829768c..76f6cae37f 100644 --- a/samples/thread/makefile.g95 +++ b/samples/thread/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=thread OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/thread/thread.cpp b/samples/thread/thread.cpp index d53bbca802..19a99c2d6c 100644 --- a/samples/thread/thread.cpp +++ b/samples/thread/thread.cpp @@ -14,11 +14,6 @@ messages - it will be more visual */ -#ifdef __GNUG__ - #pragma implementation "thread.cpp" - #pragma interface "thread.cpp" -#endif - // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" diff --git a/samples/toolbar/makefile.g95 b/samples/toolbar/makefile.g95 index 25bcc5b88a..75d00f416f 100644 --- a/samples/toolbar/makefile.g95 +++ b/samples/toolbar/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=toolbar OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index 2394247175..ce30338920 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -35,6 +35,13 @@ // define this to 1 to use wxToolBarSimple instead of the native one #define USE_GENERIC_TBAR 0 +// define this to use XPMs everywhere (by default, BMPs are used under Win) +#ifdef __WXMSW__ + #define USE_XPM_BITMAPS 0 +#else + #define USE_XPM_BITMAPS 1 +#endif + #if USE_GENERIC_TBAR #if !wxUSE_TOOLBAR_SIMPLE #error wxToolBarSimple is not compiled in, set wxUSE_TOOLBAR_SIMPLE \ @@ -44,11 +51,15 @@ #endif #endif // USE_GENERIC_TBAR +#if USE_XPM_BITMAPS && defined(__WXMSW__) && !wxUSE_XPM_IN_MSW + #error You need to enable XPM support to use XPM bitmaps with toolbar! +#endif // USE_XPM_BITMAPS + // ---------------------------------------------------------------------------- // resources // ---------------------------------------------------------------------------- -#if defined(__WXGTK__) || defined(__WXMOTIF__) +#if USE_XPM_BITMAPS #include "mondrian.xpm" #include "bitmaps/new.xpm" #include "bitmaps/open.xpm" @@ -58,7 +69,7 @@ #include "bitmaps/preview.xpm" // paste XPM #include "bitmaps/print.xpm" #include "bitmaps/help.xpm" -#endif // GTK or Motif +#endif // USE_XPM_BITMAPS // ---------------------------------------------------------------------------- // classes @@ -87,6 +98,10 @@ public: void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); + void OnSize(wxSizeEvent& event); + + void OnToggleAnotherToolbar(wxCommandEvent& event); + void OnToggleToolbarSize(wxCommandEvent& event); void OnToggleToolbarOrient(wxCommandEvent& event); void OnToggleToolbarRows(wxCommandEvent& event); @@ -116,11 +131,15 @@ private: void DoDeletePrint(); void DoToggleHelp(); + void LayoutChildren(); + bool m_smallToolbar, m_horzToolbar; size_t m_rows; // 1 or 2 only - wxTextCtrl* m_textWindow; + wxTextCtrl *m_textWindow; + + wxToolBar *m_tbar; DECLARE_EVENT_TABLE() }; @@ -141,6 +160,7 @@ enum IDM_TOOLBAR_INSERTPRINT, IDM_TOOLBAR_TOGGLEHELP, IDM_TOOLBAR_TOGGLEFULLSCREEN, + IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, ID_COMBO = 1000 }; @@ -153,9 +173,13 @@ enum // help button. BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_SIZE(MyFrame::OnSize) + EVT_MENU(wxID_EXIT, MyFrame::OnQuit) EVT_MENU(wxID_HELP, MyFrame::OnAbout) + EVT_MENU(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, MyFrame::OnToggleAnotherToolbar) + EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARSIZE, MyFrame::OnToggleToolbarSize) EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARORIENT, MyFrame::OnToggleToolbarOrient) EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARROWS, MyFrame::OnToggleToolbarRows) @@ -221,6 +245,16 @@ void MyFrame::RecreateToolbar() // Set up toolbar wxBitmap toolBarBitmaps[8]; +#if USE_XPM_BITMAPS + toolBarBitmaps[0] = wxBitmap(new_xpm); + toolBarBitmaps[1] = wxBitmap(open_xpm); + toolBarBitmaps[2] = wxBitmap(save_xpm); + toolBarBitmaps[3] = wxBitmap(copy_xpm); + toolBarBitmaps[4] = wxBitmap(cut_xpm); + toolBarBitmaps[5] = wxBitmap(paste_xpm); + toolBarBitmaps[6] = wxBitmap(print_xpm); + toolBarBitmaps[7] = wxBitmap(help_xpm); +#else // !USE_XPM_BITMAPS toolBarBitmaps[0] = wxBITMAP(new); toolBarBitmaps[1] = wxBITMAP(open); toolBarBitmaps[2] = wxBITMAP(save); @@ -229,6 +263,7 @@ void MyFrame::RecreateToolbar() toolBarBitmaps[5] = wxBITMAP(paste); toolBarBitmaps[6] = wxBITMAP(print); toolBarBitmaps[7] = wxBITMAP(help); +#endif // USE_XPM_BITMAPS/!USE_XPM_BITMAPS if ( !m_smallToolbar ) { @@ -304,6 +339,7 @@ MyFrame::MyFrame(wxFrame* parent, long style) : wxFrame(parent, id, title, pos, size, style) { + m_tbar = NULL; m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0, 0), wxSize(-1, -1), wxTE_MULTILINE); m_smallToolbar = TRUE; @@ -318,6 +354,11 @@ MyFrame::MyFrame(wxFrame* parent, // Make a menubar wxMenu *tbarMenu = new wxMenu; + tbarMenu->Append(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, + "Toggle &another toolbar\tCtrl-A", + "Show/hide another test toolbar", + TRUE); + tbarMenu->Append(IDM_TOOLBAR_TOGGLETOOLBARSIZE, "&Toggle toolbar size\tCtrl-S", "Toggle between big/small toolbar", @@ -375,6 +416,61 @@ wxToolBar* MyFrame::OnCreateToolBar(long style, #endif // USE_GENERIC_TBAR +void MyFrame::LayoutChildren() +{ + wxSize size = GetClientSize(); + + int offset; + if ( m_tbar ) + { + m_tbar->SetSize(-1, size.y); + m_tbar->Move(0, 0); + + offset = m_tbar->GetSize().x; + } + else + { + offset = 0; + } + + m_textWindow->SetSize(offset, 0, size.x - offset, size.y); +} + +void MyFrame::OnSize(wxSizeEvent& event) +{ + if ( m_tbar ) + { + LayoutChildren(); + } + else + { + event.Skip(); + } +} + +void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event)) +{ + if ( m_tbar ) + { + delete m_tbar; + m_tbar = NULL; + } + else + { + m_tbar = new wxToolBar(this, -1, + wxDefaultPosition, wxDefaultSize, + wxTB_VERTICAL); + m_tbar->AddTool(wxID_HELP, wxBITMAP(help), + wxNullBitmap, FALSE, + NULL, + "This is the help button", + "This is the long help for the help button"); + m_tbar->Realize(); + } + + LayoutChildren(); +} + void MyFrame::OnToggleToolbarSize(wxCommandEvent& WXUNUSED(event)) { m_smallToolbar = !m_smallToolbar; diff --git a/samples/treectrl/makefile.g95 b/samples/treectrl/makefile.g95 index 431577814b..dac77c45d0 100644 --- a/samples/treectrl/makefile.g95 +++ b/samples/treectrl/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=treectrl OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/treectrl/treectrl.cpp b/samples/treectrl/treectrl.cpp index 15a8cb2a6d..0ae0d46847 100644 --- a/samples/treectrl/treectrl.cpp +++ b/samples/treectrl/treectrl.cpp @@ -9,9 +9,12 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +// important: the #pragma argument must be different from treectrl.cpp, +// otherwise gcc gets confused (as there is also treectrl.cpp in the library +// which has identical #pragma) and the sample crashes on startup! #ifdef __GNUG__ - #pragma implementation - #pragma interface + #pragma interface "treetest.cpp" + #pragma implementation "treetest.cpp" #endif // For compilers that support precompilation, includes "wx/wx.h". @@ -428,7 +431,18 @@ void MyFrame::OnSetImageSize(wxCommandEvent& event) void MyFrame::OnToggleImages(wxCommandEvent& event) { - wxGetApp().SetShowImages(!wxGetApp().ShowImages()); + if ( wxGetApp().ShowImages() ) + { + m_treeCtrl->CreateImageList(-1); + + wxGetApp().SetShowImages(FALSE); + } + else + { + m_treeCtrl->CreateImageList(); + + wxGetApp().SetShowImages(TRUE); + } OnRecreate(event); } @@ -522,42 +536,42 @@ void MyTreeCtrl::CreateImageList(int size) if ( size == -1 ) { m_imageListNormal = NULL; - - return; } + else + { + // Make an image list containing small icons + m_imageListNormal = new wxImageList(size, size, TRUE); - // Make an image list containing small icons - m_imageListNormal = new wxImageList(size, size, TRUE); - - // should correspond to TreeCtrlIcon_xxx enum + // should correspond to TreeCtrlIcon_xxx enum #if defined(__WXMSW__) && defined(__WIN16__) - m_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE)); - m_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE)); - m_imageListNormal->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE)); - m_imageListNormal->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE)); - m_imageListNormal->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE)); -#else - wxIcon icons[5]; - icons[0] = wxICON(icon1); - icons[1] = wxICON(icon2); - icons[2] = wxICON(icon3); - icons[3] = wxICON(icon4); - icons[4] = wxICON(icon5); - - int sizeOrig = icons[0].GetWidth(); - for ( size_t i = 0; i < WXSIZEOF(icons); i++ ) - { - if ( size == sizeOrig ) + m_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE)); + m_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE)); + m_imageListNormal->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE)); + m_imageListNormal->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE)); + m_imageListNormal->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE)); +#else // !MSW + wxIcon icons[5]; + icons[0] = wxICON(icon1); + icons[1] = wxICON(icon2); + icons[2] = wxICON(icon3); + icons[3] = wxICON(icon4); + icons[4] = wxICON(icon5); + + int sizeOrig = icons[0].GetWidth(); + for ( size_t i = 0; i < WXSIZEOF(icons); i++ ) { - m_imageListNormal->Add(icons[i]); - } - else - { - m_imageListNormal->Add(wxImage(icons[i]).Rescale(size, size). - ConvertToBitmap()); + if ( size == sizeOrig ) + { + m_imageListNormal->Add(icons[i]); + } + else + { + m_imageListNormal->Add(wxImage(icons[i]).Rescale(size, size). + ConvertToBitmap()); + } } +#endif // MSW/!MSW } -#endif SetImageList(m_imageListNormal); } diff --git a/samples/treelay/makefile.g95 b/samples/treelay/makefile.g95 index f4c08f1b0c..f31905199d 100644 --- a/samples/treelay/makefile.g95 +++ b/samples/treelay/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=treelay OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/typetest/makefile.g95 b/samples/typetest/makefile.g95 index 1fa426f499..5ec0fa7169 100644 --- a/samples/typetest/makefile.g95 +++ b/samples/typetest/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=typetest OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index fd0c99b1e9..26cf4051df 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -46,6 +46,7 @@ #include "wx/wfstream.h" #include "wx/datstrm.h" #include "wx/txtstrm.h" +#include "wx/mstream.h" // Create a new application object IMPLEMENT_APP (MyApp) @@ -64,6 +65,7 @@ BEGIN_EVENT_TABLE(MyApp, wxApp) EVT_MENU(TYPES_STREAM2, MyApp::DoStreamDemo2) EVT_MENU(TYPES_STREAM3, MyApp::DoStreamDemo3) EVT_MENU(TYPES_STREAM4, MyApp::DoStreamDemo4) + EVT_MENU(TYPES_STREAM5, MyApp::DoStreamDemo5) EVT_MENU(TYPES_MIME, MyApp::DoMIMEDemo) END_EVENT_TABLE() @@ -95,6 +97,7 @@ bool MyApp::OnInit() test_menu->Append(TYPES_STREAM2, "&Stream seek test"); test_menu->Append(TYPES_STREAM3, "&Stream error test"); test_menu->Append(TYPES_STREAM4, "&Stream buffer test"); + test_menu->Append(TYPES_STREAM5, "&Stream peek test"); test_menu->AppendSeparator(); test_menu->Append(TYPES_MIME, "&MIME database test"); @@ -157,7 +160,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( tmp ); text_output << str << "\n"; std_file_output << str.c_str() << "\n"; - + textCtrl.WriteText( "\nReading from ifstream:\n" ); ifstream std_file_input( "test_std.dat" ); @@ -178,10 +181,11 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) tmp.Printf( _T("Float: %f\n"), f ); textCtrl.WriteText( tmp ); - // This doesn't compile (at least with VC++ 4) + // Why doesn't this work? #if 0 - std_file_input >> str; - tmp.Printf( _T("String: %s\n"), str.c_str() ); + char std_buf[200]; + std_file_input >> std_buf; + tmp.Printf( _T("String: %s\n"), std_buf ); textCtrl.WriteText( tmp ); #endif @@ -214,6 +218,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( tmp ); + textCtrl << "\nTest for wxDataStream:\n\n"; textCtrl.WriteText( "Writing to wxDataOutputStream:\n" ); @@ -286,7 +291,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event)) for (ch2 = 0; ch2 < 10; ch2++) { file_input.Read( &ch, 1 ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (char)(ch + '0') ); } textCtrl.WriteText( "\n\n\n" ); @@ -306,7 +311,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event)) for (ch2 = 0; ch2 < 10; ch2++) { file_input2.Read( &ch, 1 ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (char)(ch + '0') ); } textCtrl.WriteText( "\n\n\n" ); @@ -325,7 +330,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event)) for (ch2 = 0; ch2 < 10; ch2++) { buf_input3.Read( &ch, 1 ); - textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( (char)(ch + '0') ); } for (int j = 0; j < 2000; j++) buf_input3.Read( &ch, 1 ); @@ -360,17 +365,17 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) for (ch2 = 0; ch2 < 11; ch2++) { file_input.Read( &ch, 1 ); - textCtrl.WriteText( "Value read: " ); - textCtrl.WriteText( (char)(ch + '0') ); - textCtrl.WriteText( "; stream.LastError() returns: " ); - switch (file_input.LastError()) - { - case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; - } + textCtrl.WriteText( "Value read: " ); + textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( "; stream.LastError() returns: " ); + switch (file_input.LastError()) + { + case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; + } } textCtrl.WriteText( "\n" ); @@ -378,11 +383,11 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) file_input.SeekI( 0 ); switch (file_input.LastError()) { - case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } textCtrl.WriteText( "\n" ); @@ -392,11 +397,11 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( "; stream.LastError() returns: " ); switch (file_input.LastError()) { - case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } textCtrl.WriteText( "\n\n" ); @@ -409,17 +414,17 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) for (ch2 = 0; ch2 < 11; ch2++) { ffile_input.Read( &ch, 1 ); - textCtrl.WriteText( "Value read: " ); - textCtrl.WriteText( (char)(ch + '0') ); - textCtrl.WriteText( "; stream.LastError() returns: " ); - switch (ffile_input.LastError()) - { - case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; - } + textCtrl.WriteText( "Value read: " ); + textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( "; stream.LastError() returns: " ); + switch (ffile_input.LastError()) + { + case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; + } } textCtrl.WriteText( "\n" ); @@ -427,11 +432,11 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) ffile_input.SeekI( 0 ); switch (ffile_input.LastError()) { - case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } textCtrl.WriteText( "\n" ); @@ -441,11 +446,11 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( "; stream.LastError() returns: " ); switch (ffile_input.LastError()) { - case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } textCtrl.WriteText( "\n\n" ); @@ -458,17 +463,17 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) for (ch2 = 0; ch2 < 11; ch2++) { buf_input.Read( &ch, 1 ); - textCtrl.WriteText( "Value read: " ); - textCtrl.WriteText( (char)(ch + '0') ); - textCtrl.WriteText( "; stream.LastError() returns: " ); - switch (buf_input.LastError()) - { - case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; - } + textCtrl.WriteText( "Value read: " ); + textCtrl.WriteText( (char)(ch + '0') ); + textCtrl.WriteText( "; stream.LastError() returns: " ); + switch (buf_input.LastError()) + { + case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; + } } textCtrl.WriteText( "\n" ); @@ -476,11 +481,11 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) buf_input.SeekI( 0 ); switch (buf_input.LastError()) { - case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } textCtrl.WriteText( "\n" ); @@ -490,11 +495,11 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( "; stream.LastError() returns: " ); switch (buf_input.LastError()) { - case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } } @@ -526,10 +531,10 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) switch (buf_input.LastError()) { case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); @@ -546,10 +551,10 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) switch (buf_input.LastError()) { case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); @@ -568,10 +573,10 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) switch (buf_input.LastError()) { case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); @@ -587,10 +592,10 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) switch (buf_input.LastError()) { case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); @@ -606,10 +611,10 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) switch (buf_input.LastError()) { case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); @@ -625,10 +630,10 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) switch (buf_input.LastError()) { case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break; - case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; - case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; - case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; - default: textCtrl.WriteText( "Huh?\n" ); break; + case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break; + case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; + case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; + default: textCtrl.WriteText( "Huh?\n" ); break; } msg.Printf( "wxBufferedInputStream.LastRead() returns: %d\n", (int)buf_input.LastRead() ); textCtrl.WriteText( msg ); @@ -637,6 +642,81 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( "\n\n" ); } +void MyApp::DoStreamDemo5(wxCommandEvent& WXUNUSED(event)) +{ + wxTextCtrl& textCtrl = * GetTextCtrl(); + + textCtrl.Clear(); + textCtrl << "\nTesting wxFileInputStream's Peek():\n\n"; + + char ch; + wxString str; + + textCtrl.WriteText( "Writing number 0 to 9 to wxFileOutputStream:\n\n" ); + + wxFileOutputStream file_output( wxString("test_wx.dat") ); + for (ch = 0; ch < 10; ch++) + file_output.Write( &ch, 1 ); + + file_output.Sync(); + + wxFileInputStream file_input( wxString("test_wx.dat") ); + + ch = file_input.Peek(); + str.Printf( "First char peeked: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + ch = file_input.GetC(); + str.Printf( "First char read: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + ch = file_input.Peek(); + str.Printf( "Second char peeked: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + ch = file_input.GetC(); + str.Printf( "Second char read: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + ch = file_input.Peek(); + str.Printf( "Third char peeked: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + ch = file_input.GetC(); + str.Printf( "Third char read: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + + textCtrl << "\n\n\nTesting wxMemoryInputStream's Peek():\n\n"; + + char buf[] = { 0,1,2,3,4,5,6,7,8,9,10 }; + wxMemoryInputStream input( buf, 10 ); + + ch = input.Peek(); + str.Printf( "First char peeked: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + ch = input.GetC(); + str.Printf( "First char read: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + ch = input.Peek(); + str.Printf( "Second char peeked: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + ch = input.GetC(); + str.Printf( "Second char read: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + ch = input.Peek(); + str.Printf( "Third char peeked: %d\n", (int) ch ); + textCtrl.WriteText( str ); + + ch = input.GetC(); + str.Printf( "Third char read: %d\n", (int) ch ); + textCtrl.WriteText( str ); +} + #if wxUSE_UNICODE void MyApp::DoUnicodeDemo(wxCommandEvent& WXUNUSED(event)) { diff --git a/samples/typetest/typetest.h b/samples/typetest/typetest.h index 481b26ff34..90c4e153bb 100644 --- a/samples/typetest/typetest.h +++ b/samples/typetest/typetest.h @@ -33,6 +33,7 @@ public: void DoStreamDemo2(wxCommandEvent& event); void DoStreamDemo3(wxCommandEvent& event); void DoStreamDemo4(wxCommandEvent& event); + void DoStreamDemo5(wxCommandEvent& event); #if wxUSE_UNICODE void DoUnicodeDemo(wxCommandEvent& event); #endif @@ -80,6 +81,7 @@ enum TYPES_STREAM2, TYPES_STREAM3, TYPES_STREAM4, + TYPES_STREAM5, TYPES_MIME }; diff --git a/samples/validate/makefile.g95 b/samples/validate/makefile.g95 index 0b00e7e4f0..d9e8c085ba 100644 --- a/samples/validate/makefile.g95 +++ b/samples/validate/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=validate OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/wizard/makefile.g95 b/samples/wizard/makefile.g95 index 2cee3f0c2f..08d6e90f0f 100644 --- a/samples/wizard/makefile.g95 +++ b/samples/wizard/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=wizard OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/samples/wizard/wizard.cpp b/samples/wizard/wizard.cpp index 52cd493983..c405271857 100644 --- a/samples/wizard/wizard.cpp +++ b/samples/wizard/wizard.cpp @@ -319,12 +319,12 @@ void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event)) // a wizard page may be either an object of predefined class wxWizardPageSimple *page1 = new wxWizardPageSimple(wizard); - (void)new wxStaticText(page1, -1, - "This wizard doesn't help you to do anything at " - "all.\n" - "\n" - "The next pages will present you with more useless " - "controls."); + wxStaticText *text = new wxStaticText(page1, -1, + "This wizard doesn't help you to do anything at all.\n" + "\n" + "The next pages will present you with more useless controls." + ); + wxSize size = text->GetBestSize(); // ... or a derived class wxRadioboxPage *page3 = new wxRadioboxPage(wizard); @@ -340,6 +340,7 @@ void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event)) page1->SetNext(page2); page3->SetPrev(page2); + wizard->SetPageSize(size); if ( wizard->RunWizard(page1) ) { wxMessageBox("The wizard successfully completed", "That's all", diff --git a/setup.h.in b/setup.h.in index 527664b360..c7af59835a 100644 --- a/setup.h.in +++ b/setup.h.in @@ -61,6 +61,9 @@ /* Define this if your version of GTK+ is greater than 1.2 */ #undef __WXGTK12__ +/* Define this if your version of GTK+ is greater than 1.2.7 */ +#undef __WXGTK127__ + /* Define this if your version of GTK+ is greater than 1.3 */ #undef __WXGTK13__ @@ -83,6 +86,7 @@ #undef __OSF__ #undef __BSD__ #undef __FREEBSD__ +#undef __NETBSD__ #undef __VMS__ #undef __ULTRIX__ #undef __DATA_GENERAL__ @@ -138,6 +142,7 @@ */ #define wxUSE_ODBC 0 #define wxODBC_FWD_ONLY_CURSORS 1 +#define wxODBC_BACKWARD_COMPATABILITY 0 /* * Use Threads */ @@ -425,20 +430,15 @@ #define wxUSE_POSTSCRIPT 0 /* - * Compile wxString with some Unicode support? + * Compile wxString with some Unicode (wide character) support? */ #define wxUSE_WCHAR_T 0 /* - * Compile wxString in wide character (Unicode) mode? + * Compile wxWindows in Unicode mode (Win32 only for now)? */ #define wxUSE_UNICODE 0 -/* - * Compile wxString with (limited) multibyte char support? - */ -#define wxUSE_MULTIBYTE 0 - /* * Work around a bug in GNU libc 5.x wcstombs() implementation. * @@ -633,6 +633,9 @@ /* The type of 3rd argument to getsockname() - usually size_t or int */ #undef SOCKLEN_T +/* The signal handler prototype */ +#undef wxTYPE_SA_HANDLER + /* gettimeofday() usually takes 2 arguments, but some really old systems might * have only one, in which case define WX_GETTIMEOFDAY_NO_TZ */ #undef WX_GETTIMEOFDAY_NO_TZ @@ -718,6 +721,9 @@ /* Define if you have the dlopen function. */ #undef HAVE_DLOPEN +/* Define if you have the dlerror function. */ +#undef HAVE_DLERROR + /* Define if you have the gethostname function. */ #undef HAVE_GETHOSTNAME diff --git a/setup.h_vms b/setup.h_vms index 20faff8f5f..ecda510f73 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -70,6 +70,9 @@ /* Define this if your version of GTK+ is greater than 1.2 */ #define __WXGTK12__ 1 +/* Define this if your version of GTK+ is greater than 1.2.7 */ +#define __WXGTK127__ 1 + /* Define this if your version of GTK+ is greater than 1.3 */ #undef __WXGTK13__ @@ -138,6 +141,7 @@ */ #define wxUSE_ODBC 0 #define wxODBC_FWD_ONLY_CURSORS 1 +#define wxODBC_BACKWARD_COMPATABILITY 0 /* * Use Threads */ diff --git a/src/Wxwindll.icc b/src/Wxwindll.icc index 9474d9d524..b7ada619e5 100644 --- a/src/Wxwindll.icc +++ b/src/Wxwindll.icc @@ -9,7 +9,7 @@ option ProjectOptions = lang(longlong, "yes"), gen(manglelinkagekeywordonlyfunc link(defaultlibsname, "..\\lib\\os2xpm.lib"), link(defaultlibsname, "..\\lib\\os2jpeg.lib"), link(defaultlibsname, "..\\lib\\os2zlib.lib"), - link(defaultlibsname, "..\\lib\\os2tifd.lib"), + link(defaultlibsname, "..\\lib\\os2tiff.lib"), link(defaultlibsname, "NETAPI32.LIB"), link(defaultlibsname, "UPM32.LIB"), link(defaultlibsname, "TCP32DLL.LIB"), @@ -32,6 +32,8 @@ option ProjectOptions = lang(longlong, "yes"), gen(manglelinkagekeywordonlyfunc { run before '-mkdir ' '..\\src\\common\\dbgos240dll' run before '-mkdir ' '..\\samples\\minimal\\dbgos240dll' + run before 'copy ' '..\\src\common\\dosyacc.c ' '..\\src\\common\\y_tab.c' + run before 'copy ' '..\\src\common\\doslex.c ' '..\\src\\common\\lex_yy.c' } target type("dll") "..\\lib\\Wxwindll.dll" { @@ -284,6 +286,6 @@ option ProjectOptions = lang(longlong, "yes"), gen(manglelinkagekeywordonlyfunc target "..\\samples\\minimal\\dbgos240dll\\Minimal.exe" { source type(cpp) "..\\SAMPLES\\MINIMAL\\MINIMAL.CPP" - source type(rc) "..\\SAMPLES\\MINIMAL\\MINIMAL.RCO" + source type(rc) "..\\SAMPLES\\MINIMAL\\MINIMAL.RC4" } } diff --git a/src/common/cmdline.cpp b/src/common/cmdline.cpp index d98bb96d48..965d1143de 100644 --- a/src/common/cmdline.cpp +++ b/src/common/cmdline.cpp @@ -485,7 +485,7 @@ int wxCmdLineParser::Parse() isLong = TRUE; const wxChar *p = arg.c_str() + 2; - while ( wxIsalpha(*p) || (*p == _T('-')) ) + while ( wxIsalnum(*p) || (*p == _T('_')) || (*p == _T('-')) ) { name += *p++; } @@ -503,7 +503,7 @@ int wxCmdLineParser::Parse() // a short one: as they can be cumulated, we try to find the // longest substring which is a valid option const wxChar *p = arg.c_str() + 1; - while ( wxIsalpha(*p) ) + while ( wxIsalnum(*p) || (*p == _T('_')) ) { name += *p++; } @@ -596,6 +596,7 @@ int wxCmdLineParser::Parse() { switch ( *p ) { + case _T('='): case _T(':'): // the value follows p++; @@ -619,8 +620,15 @@ int wxCmdLineParser::Parse() break; default: - // the value is right here - ; + // the value is right here: this may be legal or + // not depending on the option style + if ( opt.flags & wxCMD_LINE_NEEDS_SEPARATOR ) + { + wxLogError(_("Separator expected after the option '%s'."), + name.c_str()); + + ok = FALSE; + } } } @@ -781,9 +789,18 @@ void wxCmdLineParser::Usage() wxStripExtension(appname); } - wxString brief, detailed; + // we construct the brief cmd line desc on the fly, but not the detailed + // help message below because we want to align the options descriptions + // and for this we must first know the longest one of them + wxString brief; + wxArrayString namesOptions, descOptions; brief.Printf(_("Usage: %s"), appname.c_str()); + // the switch char is usually '-' but this can be changed with + // SetSwitchChars() and then the first one of possible chars is used + wxChar chSwitch = !m_data->m_switchChars ? _T('-') + : m_data->m_switchChars[0u]; + size_t n, count = m_data->m_options.GetCount(); for ( n = 0; n < count; n++ ) { @@ -795,11 +812,13 @@ void wxCmdLineParser::Usage() brief << _T('['); } - brief << _T('-') << opt.shortName; - detailed << _T(" -") << opt.shortName; + brief << chSwitch << opt.shortName; + + wxString option; + option << _T(" ") << chSwitch << opt.shortName; if ( !!opt.longName ) { - detailed << _T(" --") << opt.longName; + option << _T(" --") << opt.longName; } if ( opt.kind != wxCMD_LINE_SWITCH ) @@ -807,7 +826,7 @@ void wxCmdLineParser::Usage() wxString val; val << _T('<') << GetTypeName(opt.type) << _T('>'); brief << _T(' ') << val; - detailed << (!opt.longName ? _T(':') : _T('=')) << val; + option << (!opt.longName ? _T(':') : _T('=')) << val; } if ( !(opt.flags & wxCMD_LINE_OPTION_MANDATORY) ) @@ -815,7 +834,8 @@ void wxCmdLineParser::Usage() brief << _T(']'); } - detailed << _T('\t') << opt.description << _T('\n'); + namesOptions.Add(option); + descOptions.Add(opt.description); } count = m_data->m_paramDesc.GetCount(); @@ -848,6 +868,27 @@ void wxCmdLineParser::Usage() } wxLogMessage(brief); + + // now construct the detailed help message + size_t len, lenMax = 0; + count = namesOptions.GetCount(); + for ( n = 0; n < count; n++ ) + { + len = namesOptions[n].length(); + if ( len > lenMax ) + lenMax = len; + } + + wxString detailed; + for ( n = 0; n < count; n++ ) + { + len = namesOptions[n].length(); + detailed << namesOptions[n] + << wxString(_T(' '), lenMax - len) << _T('\t') + << descOptions[n] + << _T('\n'); + } + wxLogMessage(detailed); } diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index 5919aa46a2..6da76e2029 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -475,7 +475,7 @@ void wxPrintData::ConvertToNative() } // TODO: I hope it's OK to pass some empty strings to DEVNAMES. - hDevNames = wxCreateDevNames("", m_printerName, ""); + m_devNames = (void*) (long) wxCreateDevNames("", m_printerName, ""); } void wxPrintData::ConvertFromNative() @@ -668,7 +668,7 @@ void wxPrintData::ConvertFromNative() // Not sure if we should check for this mismatch // wxASSERT_MSG( (m_printerName == "" || (devName == m_printerName)), "Printer name obtained from DEVMODE and DEVNAMES were different!"); - if (printerName != "") + if (printerName != wxT("")) m_printerName = printerName; GlobalUnlock(hDevNames); diff --git a/src/common/config.cpp b/src/common/config.cpp index 018b9e01df..feccd99ab0 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -42,7 +42,7 @@ #include <stdlib.h> #include <math.h> -#include <ctype.h> // for isalnum() +#include <ctype.h> // ---------------------------------------------------------------------------- // global and class static variables @@ -59,15 +59,22 @@ bool wxConfigBase::ms_bAutoCreate = TRUE; // wxConfigBase // ---------------------------------------------------------------------------- -// Not all args will always be used by derived classes, but -// including them all in each class ensures compatibility. -wxConfigBase::wxConfigBase(const wxString& appName, const wxString& vendorName, - const wxString& WXUNUSED(localFilename), const wxString& WXUNUSED(globalFilename), long style): - m_appName(appName), m_vendorName(vendorName), m_style(style) +// Not all args will always be used by derived classes, but including them all +// in each class ensures compatibility. +wxConfigBase::wxConfigBase(const wxString& appName, + const wxString& vendorName, + const wxString& WXUNUSED(localFilename), + const wxString& WXUNUSED(globalFilename), + long style) + : m_appName(appName), m_vendorName(vendorName), m_style(style) { m_bExpandEnvVars = TRUE; m_bRecordDefaults = FALSE; } +wxConfigBase::~wxConfigBase() +{ +} + wxConfigBase *wxConfigBase::Set(wxConfigBase *pConfig) { wxConfigBase *pOld = ms_pConfig; @@ -130,8 +137,8 @@ bool wxConfigBase::Read(const wxString& key, double* val) const *val = wxAtof(str); return TRUE; } - else - return FALSE; + + return FALSE; } bool wxConfigBase::Read(const wxString& key, double* val, double defVal) const @@ -285,13 +292,13 @@ wxString wxExpandEnvVars(const wxString& str) for ( size_t n = 0; n < str.Len(); n++ ) { switch ( str[n] ) { #ifdef __WXMSW__ - case '%': + case wxT('%'): #endif //WINDOWS - case '$': + case wxT('$'): { Bracket bracket; #ifdef __WXMSW__ - if ( str[n] == '%' ) + if ( str[n] == wxT('%') ) bracket = Bracket_Windows; else #endif //WINDOWS @@ -300,12 +307,12 @@ wxString wxExpandEnvVars(const wxString& str) } else { switch ( str[n + 1] ) { - case '(': + case wxT('('): bracket = Bracket_Normal; n++; // skip the bracket break; - case '{': + case wxT('{'): bracket = Bracket_Curly; n++; // skip the bracket break; @@ -317,7 +324,7 @@ wxString wxExpandEnvVars(const wxString& str) m = n + 1; - while ( m < str.Len() && (isalnum(str[m]) || str[m] == '_') ) + while ( m < str.Len() && (wxIsalnum(str[m]) || str[m] == wxT('_')) ) m++; wxString strVarName(str.c_str() + n + 1, m - n - 1); @@ -356,7 +363,7 @@ wxString wxExpandEnvVars(const wxString& str) case '\\': // backslash can be used to suppress special meaning of % and $ - if ( n != str.Len() && (str[n + 1] == '%' || str[n + 1] == '$') ) { + if ( n != str.Len() && (str[n + 1] == wxT('%') || str[n + 1] == wxT('$')) ) { strResult += str[++n]; break; @@ -400,7 +407,7 @@ void wxSplitPath(wxArrayString& aParts, const wxChar *sz) // could log an error here, but we prefer to ignore extra '/' if ( *pc == wxT('\0') ) - return; + break; } else strCurrent += *pc; diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index 61ac755d79..c0afcdaab2 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -78,6 +78,7 @@ #include <ctype.h> #include "wx/datetime.h" +#include "wx/timer.h" // for wxGetLocalTimeMillis() // ---------------------------------------------------------------------------- // conditional compilation @@ -98,8 +99,8 @@ #if defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__) #define WX_TIMEZONE _timezone #elif defined(__MWERKS__) - long wxmw_timezone = 28800; - #define WX_TIMEZONE wxmw_timezone ; + long wxmw_timezone = 28800; + #define WX_TIMEZONE wxmw_timezone; #else // unknown platform - try timezone #define WX_TIMEZONE timezone #endif @@ -390,13 +391,17 @@ static wxDateTime::WeekDay GetWeekDayFromName(const wxString& name, int flags) return wd; } -// scans all digits and returns the resulting number -static bool GetNumericToken(const wxChar*& p, unsigned long *number) +// scans all digits (but no more than len) and returns the resulting number +static bool GetNumericToken(size_t len, const wxChar*& p, unsigned long *number) { + size_t n = 1; wxString s; while ( wxIsdigit(*p) ) { s += *p++; + + if ( len && ++n > len ) + break; } return !!s && s.ToULong(number); @@ -1032,6 +1037,12 @@ wxDateTime wxDateTime::GetEndDST(int year, Country country) // constructors and assignment operators // ---------------------------------------------------------------------------- +// return the current time with ms precision +/* static */ wxDateTime wxDateTime::UNow() +{ + return wxDateTime(wxGetLocalTimeMillis()); +} + // the values in the tm structure contain the local time wxDateTime& wxDateTime::Set(const struct tm& tm) { @@ -1207,7 +1218,7 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const tm = localtime(&time); // should never happen - wxCHECK_MSG( tm, Tm(), _T("gmtime() failed") ); + wxCHECK_MSG( tm, Tm(), _T("localtime() failed") ); } else { @@ -1232,7 +1243,11 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const if ( tm ) { - return Tm(*tm, tz); + // adjust the milliseconds + Tm tm2(*tm, tz); + long timeOnly = (m_time % MILLISECONDS_PER_DAY).ToLong(); + tm2.msec = (wxDateTime_t)(timeOnly % 1000); + return tm2; } //else: use generic code below } @@ -1474,7 +1489,7 @@ wxDateTime& wxDateTime::SetToWeekDayInSameWeek(WeekDay weekday) } else if ( weekday < wdayThis ) { - return Substract(wxDateSpan::Days(wdayThis - weekday)); + return Subtract(wxDateSpan::Days(wdayThis - weekday)); } else // weekday > wdayThis { @@ -1527,7 +1542,7 @@ wxDateTime& wxDateTime::SetToPrevWeekDay(WeekDay weekday) diff = wdayThis - weekday; } - return Substract(wxDateSpan::Days(diff)); + return Subtract(wxDateSpan::Days(diff)); } bool wxDateTime::SetToWeekDay(WeekDay weekday, @@ -1745,7 +1760,7 @@ wxDateTime& wxDateTime::MakeTimezone(const TimeZone& tz, bool noDST) secDiff -= 3600; } - return Substract(wxTimeSpan::Seconds(secDiff)); + return Subtract(wxTimeSpan::Seconds(secDiff)); } // ---------------------------------------------------------------------------- @@ -1756,8 +1771,10 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const { wxCHECK_MSG( format, _T(""), _T("NULL format in wxDateTime::Format") ); + // we have to use our own implementation if the date is out of range of + // strftime() or if we use non standard specificators time_t time = GetTicks(); - if ( time != (time_t)-1 ) + if ( (time != (time_t)-1) && !wxStrstr(format, _T("%l")) ) { // use strftime() tm *tm; @@ -1799,7 +1816,8 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const } // we only parse ANSI C format specifications here, no POSIX 2 - // complications, no GNU extensions + // complications, no GNU extensions but we do add support for a "%l" format + // specifier allowing to get the number of milliseconds Tm tm = GetTm(tz); // used for calls to strftime() when we only deal with time @@ -1833,6 +1851,7 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const break; case _T('j'): // day of year has 3 digits + case _T('l'): // milliseconds have 3 digits fmt = _T("%03d"); break; @@ -2019,6 +2038,10 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const res += wxString::Format(fmt, GetDayOfYear(tz)); break; + case _T('l'): // milliseconds (NOT STANDARD) + res += wxString::Format(fmt, GetMillisecond(tz)); + break; + case _T('m'): // month as a number (01-12) res += wxString::Format(fmt, tm.mon + 1); break; @@ -2466,7 +2489,17 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, } // start of a format specification - switch ( *++fmt ) + + // parse the optional width + size_t width = 0; + while ( isdigit(*++fmt) ) + { + width *= 10; + width += *fmt - _T('0'); + } + + // then the format itself + switch ( *fmt ) { case _T('a'): // a weekday name case _T('A'): @@ -2539,7 +2572,8 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, break; case _T('d'): // day of a month (01-31) - if ( !GetNumericToken(input, &num) || (num > 31) || (num < 1) ) + if ( !GetNumericToken(width, input, &num) || + (num > 31) || (num < 1) ) { // no match return (wxChar *)NULL; @@ -2552,7 +2586,7 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, break; case _T('H'): // hour in 24h format (00-23) - if ( !GetNumericToken(input, &num) || (num > 23) ) + if ( !GetNumericToken(width, input, &num) || (num > 23) ) { // no match return (wxChar *)NULL; @@ -2563,7 +2597,7 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, break; case _T('I'): // hour in 12h format (01-12) - if ( !GetNumericToken(input, &num) || !num || (num > 12) ) + if ( !GetNumericToken(width, input, &num) || !num || (num > 12) ) { // no match return (wxChar *)NULL; @@ -2575,7 +2609,7 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, break; case _T('j'): // day of the year - if ( !GetNumericToken(input, &num) || !num || (num > 366) ) + if ( !GetNumericToken(width, input, &num) || !num || (num > 366) ) { // no match return (wxChar *)NULL; @@ -2586,7 +2620,7 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, break; case _T('m'): // month as a number (01-12) - if ( !GetNumericToken(input, &num) || !num || (num > 12) ) + if ( !GetNumericToken(width, input, &num) || !num || (num > 12) ) { // no match return (wxChar *)NULL; @@ -2597,7 +2631,7 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, break; case _T('M'): // minute as a decimal number (00-59) - if ( !GetNumericToken(input, &num) || (num > 59) ) + if ( !GetNumericToken(width, input, &num) || (num > 59) ) { // no match return (wxChar *)NULL; @@ -2661,7 +2695,7 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, } case _T('S'): // second as a decimal number (00-61) - if ( !GetNumericToken(input, &num) || (num > 61) ) + if ( !GetNumericToken(width, input, &num) || (num > 61) ) { // no match return (wxChar *)NULL; @@ -2691,7 +2725,7 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, break; case _T('w'): // weekday as a number (0-6), Sunday = 0 - if ( !GetNumericToken(input, &num) || (wday > 6) ) + if ( !GetNumericToken(width, input, &num) || (wday > 6) ) { // no match return (wxChar *)NULL; @@ -2820,18 +2854,21 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, break; case _T('y'): // year without century (00-99) - if ( !GetNumericToken(input, &num) || (num > 99) ) + if ( !GetNumericToken(width, input, &num) || (num > 99) ) { // no match return (wxChar *)NULL; } haveYear = TRUE; - year = 1900 + (wxDateTime_t)num; + + // TODO should have an option for roll over date instead of + // hard coding it here + year = (num > 30 ? 1900 : 2000) + (wxDateTime_t)num; break; case _T('Y'): // year with century - if ( !GetNumericToken(input, &num) ) + if ( !GetNumericToken(width, input, &num) ) { // no match return (wxChar *)NULL; @@ -2870,7 +2907,11 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date, // take this date as default tmDef = dateDef.GetTm(); } +#ifdef __WIN16__ else if ( m_time != 0 ) +#else + else if ( m_time != wxLongLong(0) ) +#endif { // if this date is valid, don't change it tmDef = GetTm(); @@ -3016,7 +3057,9 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) int year = 0; // tokenize the string - wxStringTokenizer tok(p, _T(",/-\t\n ")); + size_t nPosCur = 0; + static const wxChar *dateDelimiters = _T(".,/-\t\n "); + wxStringTokenizer tok(p, dateDelimiters); while ( tok.HasMoreTokens() ) { wxString token = tok.GetNextToken(); @@ -3098,7 +3141,8 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) haveMon = TRUE; - mon = (wxDateTime::Month)val; + // month 1 is Jan + mon = (wxDateTime::Month)(val - 1); } else { @@ -3116,7 +3160,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) if ( (day <= 12) && !haveMon ) { // exchange day and month - mon = (wxDateTime::Month)day; + mon = (wxDateTime::Month)(day - 1); haveMon = TRUE; } @@ -3136,8 +3180,9 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) } else // not a number { - mon = GetMonthFromName(token, Name_Full | Name_Abbr); - if ( mon != Inv_Month ) + // be careful not to overwrite the current mon value + Month mon2 = GetMonthFromName(token, Name_Full | Name_Abbr); + if ( mon2 != Inv_Month ) { // it's a month if ( haveMon ) @@ -3145,6 +3190,8 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) break; } + mon = mon2; + haveMon = TRUE; } else @@ -3219,19 +3266,21 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) } } } + + nPosCur = tok.GetPosition(); } // either no more tokens or the scan was stopped by something we couldn't // parse - in any case, see if we can construct a date from what we have if ( !haveDay && !haveWDay ) { - wxLogDebug(_T("no day, no weekday hence no date.")); + wxLogDebug(_T("ParseDate: no day, no weekday hence no date.")); return (wxChar *)NULL; } if ( haveWDay && (haveMon || haveYear || haveDay) && - !(haveMon && haveMon && haveYear) ) + !(haveDay && haveMon && haveYear) ) { // without adjectives (which we don't support here) the week day only // makes sense completely separately or with the full date @@ -3239,6 +3288,37 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) return (wxChar *)NULL; } + if ( !haveWDay && haveYear && !(haveDay && haveMon) ) + { + // may be we have month and day instead of day and year? + if ( haveDay && !haveMon ) + { + if ( day <= 12 ) + { + // exchange day and month + mon = (wxDateTime::Month)(day - 1); + + // we're in the current year then + if ( year <= GetNumOfDaysInMonth(Inv_Year, mon) ) + { + day = year; + + haveMon = TRUE; + haveYear = FALSE; + } + //else: no, can't exchange, leave haveMon == FALSE + } + } + + if ( !haveMon ) + { + // if we give the year, month and day must be given too + wxLogDebug(_T("ParseDate: day and month should be specified if year is.")); + + return (wxChar *)NULL; + } + } + if ( !haveMon ) { mon = GetCurrentMonth(); @@ -3259,6 +3339,8 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) if ( GetWeekDay() != wday ) { // inconsistency detected + wxLogDebug(_T("ParseDate: inconsistent day/weekday.")); + return (wxChar *)NULL; } } @@ -3270,8 +3352,16 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date) SetToWeekDayInSameWeek(wday); } - // return the pointer to the next char - return p + wxStrlen(p) - wxStrlen(tok.GetString()); + // return the pointer to the first unparsed char + p += nPosCur; + if ( nPosCur && wxStrchr(dateDelimiters, *(p - 1)) ) + { + // if we couldn't parse the token after the delimiter, put back the + // delimiter as well + p--; + } + + return p; } const wxChar *wxDateTime::ParseTime(const wxChar *time) @@ -3381,46 +3471,46 @@ wxString wxTimeSpan::Format(const wxChar *format) const wxString str; str.Alloc(wxStrlen(format)); - for ( const wxChar *pch = format; pch; pch++ ) + for ( const wxChar *pch = format; *pch; pch++ ) { wxChar ch = *pch; - if ( ch == '%' ) + if ( ch == _T('%') ) { wxString tmp; - ch = *pch++; + ch = *++pch; // get the format spec char switch ( ch ) { default: wxFAIL_MSG( _T("invalid format character") ); // fall through - case '%': + case _T('%'): // will get to str << ch below break; - case 'D': + case _T('D'): tmp.Printf(_T("%d"), GetDays()); break; - case 'E': + case _T('E'): tmp.Printf(_T("%d"), GetWeeks()); break; - case 'H': + case _T('H'): tmp.Printf(_T("%02d"), GetHours()); break; - case 'l': + case _T('l'): tmp.Printf(_T("%03ld"), GetMilliseconds().ToLong()); break; - case 'M': + case _T('M'): tmp.Printf(_T("%02d"), GetMinutes()); break; - case 'S': + case _T('S'): tmp.Printf(_T("%02ld"), GetSeconds().ToLong()); break; } @@ -3446,7 +3536,7 @@ wxString wxTimeSpan::Format(const wxChar *format) const #include "wx/arrimpl.cpp" -WX_DEFINE_OBJARRAY(wxDateTimeArray) +WX_DEFINE_OBJARRAY(wxDateTimeArray); static int wxCMPFUNC_CONV wxDateTimeCompareFunc(wxDateTime **first, wxDateTime **second) diff --git a/src/common/db.cpp b/src/common/db.cpp index 64c41312da..cd146b9004 100644 --- a/src/common/db.cpp +++ b/src/common/db.cpp @@ -1,7 +1,7 @@ /////////////////////////////////////////////////////////////////////////////// // Name: db.cpp -// Purpose: Implementation of the wxDB class. The wxDB class represents a connection -// to an ODBC data source. The wxDB class allows operations on the data +// Purpose: Implementation of the wxDb class. The wxDb class represents a connection +// to an ODBC data source. The wxDb class allows operations on the data // source such as opening and closing the data source. // Author: Doug Card // Modified by: George Tasker @@ -35,6 +35,7 @@ #include "wx/wxprec.h" + // Use this line for wxWindows v1.x //#include "wx_ver.h" // Use this line for wxWindows v2.x @@ -67,6 +68,7 @@ #include "wx/wxchar.h" #endif + #if wxMAJOR_VERSION == 1 # if defined(wx_msw) || defined(wx_x) # ifdef WX_PRECOMP @@ -94,6 +96,7 @@ WXDLLEXPORT_DATA(wxDbList*) PtrBegDbList = 0; + char const *SQL_LOG_FILENAME = "sqllog.txt"; char const *SQL_CATALOG_FILENAME = "catalog.txt"; @@ -102,23 +105,23 @@ char const *SQL_CATALOG_FILENAME = "catalog.txt"; #endif // SQL Log defaults to be used by GetDbConnection -wxSqlLogState SQLLOGstate = sqlLogOFF; +wxDbSqlLogState SQLLOGstate = sqlLogOFF; -//char SQLLOGfn[DB_PATH_MAX+1] = SQL_LOG_FILENAME; -char *SQLLOGfn = (char*) SQL_LOG_FILENAME; +//char SQLLOGfn[wxDB_PATH_MAX+1] = SQL_LOG_FILENAME; +wxChar *SQLLOGfn = (wxChar*) SQL_LOG_FILENAME; -// The wxDB::errorList is copied to this variable when the wxDB object +// The wxDb::errorList is copied to this variable when the wxDb object // is closed. This way, the error list is still available after the // database object is closed. This is necessary if the database // connection fails so the calling application can show the operator -// why the connection failed. Note: as each wxDB object is closed, it -// will overwrite the errors of the previously destroyed wxDB object in +// why the connection failed. Note: as each wxDb object is closed, it +// will overwrite the errors of the previously destroyed wxDb object in // this variable. char DBerrorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN]; -/********** wxColFor Constructor **********/ -wxColFor::wxColFor() +/********** wxDbColFor Constructor **********/ +wxDbColFor::wxDbColFor() { i_Nation = 0; // 0=EU, 1=UK, 2=International, 3=US s_Field = ""; @@ -130,15 +133,15 @@ wxColFor::wxColFor() i_Menge[i] = 0; } Format(1,DB_DATA_TYPE_VARCHAR,0,0,0); // the Function that does the work -} // wxColFor::wxColFor() +} // wxDbColFor::wxDbColFor() -wxColFor::~wxColFor() +wxDbColFor::~wxDbColFor() { -} // wxColFor::~wxColFor() +} // wxDbColFor::~wxDbColFor() -int wxColFor::Format(int Nation,int dbDataType,SWORD sqlDataType,short columnSize,short decimalDigits) +int wxDbColFor::Format(int Nation,int dbDataType,SWORD sqlDataType,short columnSize,short decimalDigits) { // ---------------------------------------------------------------------------------------- // -- 19991224 : mj10777@gmx.net : Create @@ -215,11 +218,11 @@ int wxColFor::Format(int Nation,int dbDataType,SWORD sqlDataType,short columnSiz break; }; return TRUE; -} // wxColFor::Format() +} // wxDbColFor::Format() -/********** wxDB Constructor **********/ -wxDB::wxDB(HENV &aHenv, bool FwdOnlyCursors) +/********** wxDb Constructor **********/ +wxDb::wxDb(HENV &aHenv, bool FwdOnlyCursors) { int i; @@ -275,11 +278,11 @@ wxDB::wxDB(HENV &aHenv, bool FwdOnlyCursors) // Mark database as not open as of yet dbIsOpen = FALSE; -} // wxDB::wxDB() +} // wxDb::wxDb() -/********** wxDB::Open() **********/ -bool wxDB::Open(char *Dsn, char *Uid, char *AuthStr) +/********** wxDb::Open() **********/ +bool wxDb::Open(char *Dsn, char *Uid, char *AuthStr) { assert(Dsn && wxStrlen(Dsn)); dsn = Dsn; @@ -306,6 +309,7 @@ bool wxDB::Open(char *Dsn, char *Uid, char *AuthStr) retcode = SQLConnect(hdbc, (UCHAR FAR *) Dsn, SQL_NTS, (UCHAR FAR *) Uid, SQL_NTS, (UCHAR FAR *) AuthStr,SQL_NTS); + if (retcode == SQL_SUCCESS_WITH_INFO) DispAllErrors(henv, hdbc); else if (retcode != SQL_SUCCESS) @@ -386,6 +390,7 @@ bool wxDB::Open(char *Dsn, char *Uid, char *AuthStr) // Float if (! getDataTypeInfo(SQL_DOUBLE, typeInfFloat)) + if (! getDataTypeInfo(SQL_REAL, typeInfFloat)) if (! getDataTypeInfo(SQL_FLOAT, typeInfFloat)) if (! getDataTypeInfo(SQL_DECIMAL, typeInfFloat)) @@ -402,11 +407,12 @@ bool wxDB::Open(char *Dsn, char *Uid, char *AuthStr) else typeInfFloat.FsqlType = SQL_DOUBLE; + // Integer - if (! getDataTypeInfo(SQL_INTEGER, typeInfInteger)) - // If SQL_INTEGER is not supported, use the floating point - // data type to store integers as well as floats - if (! getDataTypeInfo(typeInfFloat.FsqlType, typeInfInteger)) + if (! getDataTypeInfo(SQL_INTEGER, typeInfInteger)) + // If SQL_INTEGER is not supported, use the floating point + // data type to store integers as well as floats + if (! getDataTypeInfo(typeInfFloat.FsqlType, typeInfInteger)) return(FALSE); else typeInfInteger.FsqlType = typeInfFloat.FsqlType; @@ -440,11 +446,11 @@ bool wxDB::Open(char *Dsn, char *Uid, char *AuthStr) // Completed Successfully return(TRUE); -} // wxDB::Open() +} // wxDb::Open() -/********** wxDB::setConnectionOptions() **********/ -bool wxDB::setConnectionOptions(void) +/********** wxDb::setConnectionOptions() **********/ +bool wxDb::setConnectionOptions(void) /* * NOTE: The Intersolv/Oracle 7 driver was "Not Capable" of setting the login timeout. */ @@ -488,11 +494,11 @@ bool wxDB::setConnectionOptions(void) // Completed Successfully return(TRUE); -} // wxDB::setConnectionOptions() +} // wxDb::setConnectionOptions() -/********** wxDB::getDbInfo() **********/ -bool wxDB::getDbInfo(void) +/********** wxDb::getDbInfo() **********/ +bool wxDb::getDbInfo(void) { SWORD cb; RETCODE retcode; @@ -791,49 +797,58 @@ bool wxDB::getDbInfo(void) // Completed Successfully return(TRUE); -} // wxDB::getDbInfo() +} // wxDb::getDbInfo() -/********** wxDB::getDataTypeInfo() **********/ -bool wxDB::getDataTypeInfo(SWORD fSqlType, wxSqlTypeInfo &structSQLTypeInfo) +/********** wxDb::getDataTypeInfo() **********/ +bool wxDb::getDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo) { /* * fSqlType will be something like SQL_VARCHAR. This parameter determines * the data type inf. is gathered for. * - * wxSqlTypeInfo is a structure that is filled in with data type information, + * wxDbSqlTypeInfo is a structure that is filled in with data type information, */ RETCODE retcode; - SDWORD cbRet; - + SDWORD cbRet; + // Get information about the data type specified if (SQLGetTypeInfo(hstmt, fSqlType) != SQL_SUCCESS) return(DispAllErrors(henv, hdbc, hstmt)); // Fetch the record if ((retcode = SQLFetch(hstmt)) != SQL_SUCCESS) - { + { #ifdef DBDEBUG_CONSOLE - if (retcode == SQL_NO_DATA_FOUND) - cout << "SQL_NO_DATA_FOUND fetching inf. about data type." << endl; + if (retcode == SQL_NO_DATA_FOUND) + cout << "SQL_NO_DATA_FOUND fetching inf. about data type." << endl; #endif - DispAllErrors(henv, hdbc, hstmt); - SQLFreeStmt(hstmt, SQL_CLOSE); - return(FALSE); - } + DispAllErrors(henv, hdbc, hstmt); + SQLFreeStmt(hstmt, SQL_CLOSE); + return(FALSE); + } // Obtain columns from the record if (SQLGetData(hstmt, 1, SQL_C_CHAR, (UCHAR*) structSQLTypeInfo.TypeName, DB_TYPE_NAME_LEN, &cbRet) != SQL_SUCCESS) return(DispAllErrors(henv, hdbc, hstmt)); + + // BJO 20000503: no more needed with new GetColumns... +#if OLD_GETCOLUMNS // BJO 991209 if (Dbms() == dbmsMY_SQL) - { - if (!strcmp(structSQLTypeInfo.TypeName, "middleint")) strcpy(structSQLTypeInfo.TypeName, "mediumint"); - if (!strcmp(structSQLTypeInfo.TypeName, "middleint unsigned")) strcpy(structSQLTypeInfo.TypeName, "mediumint unsigned"); - if (!strcmp(structSQLTypeInfo.TypeName, "integer")) strcpy(structSQLTypeInfo.TypeName, "int"); - if (!strcmp(structSQLTypeInfo.TypeName, "integer unsigned")) strcpy(structSQLTypeInfo.TypeName, "int unsigned"); - if (!strcmp(structSQLTypeInfo.TypeName, "middleint")) strcpy(structSQLTypeInfo.TypeName, "mediumint"); - if (!strcmp(structSQLTypeInfo.TypeName, "varchar")) strcpy(structSQLTypeInfo.TypeName, "char"); - } + { + if (!wxStrcmp(structSQLTypeInfo.TypeName, "middleint")) wxStrcpy(structSQLTypeInfo.TypeName, "mediumint"); + if (!wxStrcmp(structSQLTypeInfo.TypeName, "middleint unsigned")) wxStrcpy(structSQLTypeInfo.TypeName, "mediumint unsigned"); + if (!wxStrcmp(structSQLTypeInfo.TypeName, "integer")) wxStrcpy(structSQLTypeInfo.TypeName, "int"); + if (!wxStrcmp(structSQLTypeInfo.TypeName, "integer unsigned")) wxStrcpy(structSQLTypeInfo.TypeName, "int unsigned"); + if (!wxStrcmp(structSQLTypeInfo.TypeName, "middleint")) wxStrcpy(structSQLTypeInfo.TypeName, "mediumint"); + if (!wxStrcmp(structSQLTypeInfo.TypeName, "varchar")) wxStrcpy(structSQLTypeInfo.TypeName, "char"); + } + + // BJO 20000427 : OpenLink driver + if (!wxStrncmp(dbInf.driverName, "oplodbc", 7) || + !wxStrncmp(dbInf.driverName, "OLOD", 4)) + if (!wxStrcmp(structSQLTypeInfo.TypeName, "double precision")) wxStrcpy(structSQLTypeInfo.TypeName, "real"); +#endif if (SQLGetData(hstmt, 3, SQL_C_LONG, (UCHAR*) &structSQLTypeInfo.Precision, 0, &cbRet) != SQL_SUCCESS) return(DispAllErrors(henv, hdbc, hstmt)); @@ -855,11 +870,11 @@ bool wxDB::getDataTypeInfo(SWORD fSqlType, wxSqlTypeInfo &structSQLTypeInfo) // Completed Successfully return(TRUE); -} // wxDB::getDataTypeInfo() +} // wxDb::getDataTypeInfo() -/********** wxDB::Close() **********/ -void wxDB::Close(void) +/********** wxDb::Close() **********/ +void wxDb::Close(void) { // Close the Sql Log file if (fpSqlLog) @@ -909,11 +924,11 @@ void wxDB::Close(void) for (i = 0; i < DB_MAX_ERROR_HISTORY; i++) wxStrcpy(DBerrorList[i],errorList[i]); -} // wxDB::Close() +} // wxDb::Close() -/********** wxDB::CommitTrans() **********/ -bool wxDB::CommitTrans(void) +/********** wxDb::CommitTrans() **********/ +bool wxDb::CommitTrans(void) { if (this) { @@ -925,11 +940,11 @@ bool wxDB::CommitTrans(void) // Completed successfully return(TRUE); -} // wxDB::CommitTrans() +} // wxDb::CommitTrans() -/********** wxDB::RollbackTrans() **********/ -bool wxDB::RollbackTrans(void) +/********** wxDb::RollbackTrans() **********/ +bool wxDb::RollbackTrans(void) { // Rollback the transaction if (SQLTransact(henv, hdbc, SQL_ROLLBACK) != SQL_SUCCESS) @@ -938,11 +953,11 @@ bool wxDB::RollbackTrans(void) // Completed successfully return(TRUE); -} // wxDB::RollbackTrans() +} // wxDb::RollbackTrans() -/********** wxDB::DispAllErrors() **********/ -bool wxDB::DispAllErrors(HENV aHenv, HDBC aHdbc, HSTMT aHstmt) +/********** wxDb::DispAllErrors() **********/ +bool wxDb::DispAllErrors(HENV aHenv, HDBC aHdbc, HSTMT aHstmt) { // char odbcErrMsg[DB_MAX_ERROR_MSG_LEN]; wxString odbcErrMsg; @@ -950,62 +965,67 @@ bool wxDB::DispAllErrors(HENV aHenv, HDBC aHdbc, HSTMT aHstmt) while (SQLError(aHenv, aHdbc, aHstmt, (UCHAR FAR *) sqlState, &nativeError, (UCHAR FAR *) errorMsg, SQL_MAX_MESSAGE_LENGTH - 1, &cbErrorMsg) == SQL_SUCCESS) { odbcErrMsg.sprintf("SQL State = %s\nNative Error Code = %li\nError Message = %s\n", sqlState, nativeError, errorMsg); - logError(odbcErrMsg.GetData(), sqlState); + logError(odbcErrMsg.c_str(), sqlState); if (!silent) { #ifdef DBDEBUG_CONSOLE // When run in console mode, use standard out to display errors. - cout << odbcErrMsg.GetData() << endl; + cout << odbcErrMsg.c_str() << endl; cout << "Press any key to continue..." << endl; getchar(); #endif - } #ifdef __WXDEBUG__ - wxLogDebug(odbcErrMsg.GetData(),"DEBUG MESSAGE from DispAllErrors()"); + wxLogDebug(odbcErrMsg.c_str(),wxT("ODBC DEBUG MESSAGE from DispAllErrors()")); #endif + } } return(FALSE); // This function always returns false. -} // wxDB::DispAllErrors() +} // wxDb::DispAllErrors() -/********** wxDB::GetNextError() **********/ -bool wxDB::GetNextError(HENV aHenv, HDBC aHdbc, HSTMT aHstmt) +/********** wxDb::GetNextError() **********/ +bool wxDb::GetNextError(HENV aHenv, HDBC aHdbc, HSTMT aHstmt) { if (SQLError(aHenv, aHdbc, aHstmt, (UCHAR FAR *) sqlState, &nativeError, (UCHAR FAR *) errorMsg, SQL_MAX_MESSAGE_LENGTH - 1, &cbErrorMsg) == SQL_SUCCESS) return(TRUE); else return(FALSE); -} // wxDB::GetNextError() +} // wxDb::GetNextError() -/********** wxDB::DispNextError() **********/ -void wxDB::DispNextError(void) +/********** wxDb::DispNextError() **********/ +void wxDb::DispNextError(void) { // char odbcErrMsg[DB_MAX_ERROR_MSG_LEN]; wxString odbcErrMsg; odbcErrMsg.sprintf("SQL State = %s\nNative Error Code = %li\nError Message = %s\n", sqlState, nativeError, errorMsg); - logError(odbcErrMsg.GetData(), sqlState); + logError(odbcErrMsg.c_str(), sqlState); if (silent) return; #ifdef DBDEBUG_CONSOLE // When run in console mode, use standard out to display errors. - cout << odbcErrMsg.GetData() << endl; + cout << odbcErrMsg.c_str() << endl; cout << "Press any key to continue..." << endl; getchar(); #endif -} // wxDB::DispNextError() +#ifdef __WXDEBUG__ + wxLogDebug(odbcErrMsg,wxT("ODBC DEBUG MESSAGE")); +#endif // __WXDEBUG__ -/********** wxDB::logError() **********/ -void wxDB::logError(const char *errMsg, const char *SQLState) +} // wxDb::DispNextError() + + +/********** wxDb::logError() **********/ +void wxDb::logError(const char *errMsg, const char *SQLState) { assert(errMsg && wxStrlen(errMsg)); @@ -1029,199 +1049,199 @@ void wxDB::logError(const char *errMsg, const char *SQLState) // Add the errmsg to the sql log WriteSqlLog(errMsg); -} // wxDB::logError() +} // wxDb::logError() -/**********wxDB::TranslateSqlState() **********/ -int wxDB::TranslateSqlState(const char *SQLState) +/**********wxDb::TranslateSqlState() **********/ +int wxDb::TranslateSqlState(const wxChar *SQLState) { - if (!wxStrcmp(SQLState, "01000")) + if (!wxStrcmp(SQLState, wxT("01000"))) return(DB_ERR_GENERAL_WARNING); - if (!wxStrcmp(SQLState, "01002")) + if (!wxStrcmp(SQLState, wxT("01002"))) return(DB_ERR_DISCONNECT_ERROR); - if (!wxStrcmp(SQLState, "01004")) + if (!wxStrcmp(SQLState, wxT("01004"))) return(DB_ERR_DATA_TRUNCATED); - if (!wxStrcmp(SQLState, "01006")) + if (!wxStrcmp(SQLState, wxT("01006"))) return(DB_ERR_PRIV_NOT_REVOKED); - if (!wxStrcmp(SQLState, "01S00")) + if (!wxStrcmp(SQLState, wxT("01S00"))) return(DB_ERR_INVALID_CONN_STR_ATTR); - if (!wxStrcmp(SQLState, "01S01")) + if (!wxStrcmp(SQLState, wxT("01S01"))) return(DB_ERR_ERROR_IN_ROW); - if (!wxStrcmp(SQLState, "01S02")) + if (!wxStrcmp(SQLState, wxT("01S02"))) return(DB_ERR_OPTION_VALUE_CHANGED); - if (!wxStrcmp(SQLState, "01S03")) + if (!wxStrcmp(SQLState, wxT("01S03"))) return(DB_ERR_NO_ROWS_UPD_OR_DEL); - if (!wxStrcmp(SQLState, "01S04")) + if (!wxStrcmp(SQLState, wxT("01S04"))) return(DB_ERR_MULTI_ROWS_UPD_OR_DEL); - if (!wxStrcmp(SQLState, "07001")) + if (!wxStrcmp(SQLState, wxT("07001"))) return(DB_ERR_WRONG_NO_OF_PARAMS); - if (!wxStrcmp(SQLState, "07006")) + if (!wxStrcmp(SQLState, wxT("07006"))) return(DB_ERR_DATA_TYPE_ATTR_VIOL); - if (!wxStrcmp(SQLState, "08001")) + if (!wxStrcmp(SQLState, wxT("08001"))) return(DB_ERR_UNABLE_TO_CONNECT); - if (!wxStrcmp(SQLState, "08002")) + if (!wxStrcmp(SQLState, wxT("08002"))) return(DB_ERR_CONNECTION_IN_USE); - if (!wxStrcmp(SQLState, "08003")) + if (!wxStrcmp(SQLState, wxT("08003"))) return(DB_ERR_CONNECTION_NOT_OPEN); - if (!wxStrcmp(SQLState, "08004")) + if (!wxStrcmp(SQLState, wxT("08004"))) return(DB_ERR_REJECTED_CONNECTION); - if (!wxStrcmp(SQLState, "08007")) + if (!wxStrcmp(SQLState, wxT("08007"))) return(DB_ERR_CONN_FAIL_IN_TRANS); - if (!wxStrcmp(SQLState, "08S01")) + if (!wxStrcmp(SQLState, wxT("08S01"))) return(DB_ERR_COMM_LINK_FAILURE); - if (!wxStrcmp(SQLState, "21S01")) + if (!wxStrcmp(SQLState, wxT("21S01"))) return(DB_ERR_INSERT_VALUE_LIST_MISMATCH); - if (!wxStrcmp(SQLState, "21S02")) + if (!wxStrcmp(SQLState, wxT("21S02"))) return(DB_ERR_DERIVED_TABLE_MISMATCH); - if (!wxStrcmp(SQLState, "22001")) + if (!wxStrcmp(SQLState, wxT("22001"))) return(DB_ERR_STRING_RIGHT_TRUNC); - if (!wxStrcmp(SQLState, "22003")) + if (!wxStrcmp(SQLState, wxT("22003"))) return(DB_ERR_NUMERIC_VALUE_OUT_OF_RNG); - if (!wxStrcmp(SQLState, "22005")) + if (!wxStrcmp(SQLState, wxT("22005"))) return(DB_ERR_ERROR_IN_ASSIGNMENT); - if (!wxStrcmp(SQLState, "22008")) + if (!wxStrcmp(SQLState, wxT("22008"))) return(DB_ERR_DATETIME_FLD_OVERFLOW); - if (!wxStrcmp(SQLState, "22012")) + if (!wxStrcmp(SQLState, wxT("22012"))) return(DB_ERR_DIVIDE_BY_ZERO); - if (!wxStrcmp(SQLState, "22026")) + if (!wxStrcmp(SQLState, wxT("22026"))) return(DB_ERR_STR_DATA_LENGTH_MISMATCH); - if (!wxStrcmp(SQLState, "23000")) + if (!wxStrcmp(SQLState, wxT("23000"))) return(DB_ERR_INTEGRITY_CONSTRAINT_VIOL); - if (!wxStrcmp(SQLState, "24000")) + if (!wxStrcmp(SQLState, wxT("24000"))) return(DB_ERR_INVALID_CURSOR_STATE); - if (!wxStrcmp(SQLState, "25000")) + if (!wxStrcmp(SQLState, wxT("25000"))) return(DB_ERR_INVALID_TRANS_STATE); - if (!wxStrcmp(SQLState, "28000")) + if (!wxStrcmp(SQLState, wxT("28000"))) return(DB_ERR_INVALID_AUTH_SPEC); - if (!wxStrcmp(SQLState, "34000")) + if (!wxStrcmp(SQLState, wxT("34000"))) return(DB_ERR_INVALID_CURSOR_NAME); - if (!wxStrcmp(SQLState, "37000")) + if (!wxStrcmp(SQLState, wxT("37000"))) return(DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL); - if (!wxStrcmp(SQLState, "3C000")) + if (!wxStrcmp(SQLState, wxT("3C000"))) return(DB_ERR_DUPLICATE_CURSOR_NAME); - if (!wxStrcmp(SQLState, "40001")) + if (!wxStrcmp(SQLState, wxT("40001"))) return(DB_ERR_SERIALIZATION_FAILURE); - if (!wxStrcmp(SQLState, "42000")) + if (!wxStrcmp(SQLState, wxT("42000"))) return(DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2); - if (!wxStrcmp(SQLState, "70100")) + if (!wxStrcmp(SQLState, wxT("70100"))) return(DB_ERR_OPERATION_ABORTED); - if (!wxStrcmp(SQLState, "IM001")) + if (!wxStrcmp(SQLState, wxT("IM001"))) return(DB_ERR_UNSUPPORTED_FUNCTION); - if (!wxStrcmp(SQLState, "IM002")) + if (!wxStrcmp(SQLState, wxT("IM002"))) return(DB_ERR_NO_DATA_SOURCE); - if (!wxStrcmp(SQLState, "IM003")) + if (!wxStrcmp(SQLState, wxT("IM003"))) return(DB_ERR_DRIVER_LOAD_ERROR); - if (!wxStrcmp(SQLState, "IM004")) + if (!wxStrcmp(SQLState, wxT("IM004"))) return(DB_ERR_SQLALLOCENV_FAILED); - if (!wxStrcmp(SQLState, "IM005")) + if (!wxStrcmp(SQLState, wxT("IM005"))) return(DB_ERR_SQLALLOCCONNECT_FAILED); - if (!wxStrcmp(SQLState, "IM006")) + if (!wxStrcmp(SQLState, wxT("IM006"))) return(DB_ERR_SQLSETCONNECTOPTION_FAILED); - if (!wxStrcmp(SQLState, "IM007")) + if (!wxStrcmp(SQLState, wxT("IM007"))) return(DB_ERR_NO_DATA_SOURCE_DLG_PROHIB); - if (!wxStrcmp(SQLState, "IM008")) + if (!wxStrcmp(SQLState, wxT("IM008"))) return(DB_ERR_DIALOG_FAILED); - if (!wxStrcmp(SQLState, "IM009")) + if (!wxStrcmp(SQLState, wxT("IM009"))) return(DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL); - if (!wxStrcmp(SQLState, "IM010")) + if (!wxStrcmp(SQLState, wxT("IM010"))) return(DB_ERR_DATA_SOURCE_NAME_TOO_LONG); - if (!wxStrcmp(SQLState, "IM011")) + if (!wxStrcmp(SQLState, wxT("IM011"))) return(DB_ERR_DRIVER_NAME_TOO_LONG); - if (!wxStrcmp(SQLState, "IM012")) + if (!wxStrcmp(SQLState, wxT("IM012"))) return(DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR); - if (!wxStrcmp(SQLState, "IM013")) + if (!wxStrcmp(SQLState, wxT("IM013"))) return(DB_ERR_TRACE_FILE_ERROR); - if (!wxStrcmp(SQLState, "S0001")) + if (!wxStrcmp(SQLState, wxT("S0001"))) return(DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS); - if (!wxStrcmp(SQLState, "S0002")) + if (!wxStrcmp(SQLState, wxT("S0002"))) return(DB_ERR_TABLE_NOT_FOUND); - if (!wxStrcmp(SQLState, "S0011")) + if (!wxStrcmp(SQLState, wxT("S0011"))) return(DB_ERR_INDEX_ALREADY_EXISTS); - if (!wxStrcmp(SQLState, "S0012")) + if (!wxStrcmp(SQLState, wxT("S0012"))) return(DB_ERR_INDEX_NOT_FOUND); - if (!wxStrcmp(SQLState, "S0021")) + if (!wxStrcmp(SQLState, wxT("S0021"))) return(DB_ERR_COLUMN_ALREADY_EXISTS); - if (!wxStrcmp(SQLState, "S0022")) + if (!wxStrcmp(SQLState, wxT("S0022"))) return(DB_ERR_COLUMN_NOT_FOUND); - if (!wxStrcmp(SQLState, "S0023")) + if (!wxStrcmp(SQLState, wxT("S0023"))) return(DB_ERR_NO_DEFAULT_FOR_COLUMN); - if (!wxStrcmp(SQLState, "S1000")) + if (!wxStrcmp(SQLState, wxT("S1000"))) return(DB_ERR_GENERAL_ERROR); - if (!wxStrcmp(SQLState, "S1001")) + if (!wxStrcmp(SQLState, wxT("S1001"))) return(DB_ERR_MEMORY_ALLOCATION_FAILURE); - if (!wxStrcmp(SQLState, "S1002")) + if (!wxStrcmp(SQLState, wxT("S1002"))) return(DB_ERR_INVALID_COLUMN_NUMBER); - if (!wxStrcmp(SQLState, "S1003")) + if (!wxStrcmp(SQLState, wxT("S1003"))) return(DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1004")) + if (!wxStrcmp(SQLState, wxT("S1004"))) return(DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1008")) + if (!wxStrcmp(SQLState, wxT("S1008"))) return(DB_ERR_OPERATION_CANCELLED); - if (!wxStrcmp(SQLState, "S1009")) + if (!wxStrcmp(SQLState, wxT("S1009"))) return(DB_ERR_INVALID_ARGUMENT_VALUE); - if (!wxStrcmp(SQLState, "S1010")) + if (!wxStrcmp(SQLState, wxT("S1010"))) return(DB_ERR_FUNCTION_SEQUENCE_ERROR); - if (!wxStrcmp(SQLState, "S1011")) + if (!wxStrcmp(SQLState, wxT("S1011"))) return(DB_ERR_OPERATION_INVALID_AT_THIS_TIME); - if (!wxStrcmp(SQLState, "S1012")) + if (!wxStrcmp(SQLState, wxT("S1012"))) return(DB_ERR_INVALID_TRANS_OPERATION_CODE); - if (!wxStrcmp(SQLState, "S1015")) + if (!wxStrcmp(SQLState, wxT("S1015"))) return(DB_ERR_NO_CURSOR_NAME_AVAIL); - if (!wxStrcmp(SQLState, "S1090")) + if (!wxStrcmp(SQLState, wxT("S1090"))) return(DB_ERR_INVALID_STR_OR_BUF_LEN); - if (!wxStrcmp(SQLState, "S1091")) + if (!wxStrcmp(SQLState, wxT("S1091"))) return(DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1092")) + if (!wxStrcmp(SQLState, wxT("S1092"))) return(DB_ERR_OPTION_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1093")) + if (!wxStrcmp(SQLState, wxT("S1093"))) return(DB_ERR_INVALID_PARAM_NO); - if (!wxStrcmp(SQLState, "S1094")) + if (!wxStrcmp(SQLState, wxT("S1094"))) return(DB_ERR_INVALID_SCALE_VALUE); - if (!wxStrcmp(SQLState, "S1095")) + if (!wxStrcmp(SQLState, wxT("S1095"))) return(DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1096")) + if (!wxStrcmp(SQLState, wxT("S1096"))) return(DB_ERR_INF_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1097")) + if (!wxStrcmp(SQLState, wxT("S1097"))) return(DB_ERR_COLUMN_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1098")) + if (!wxStrcmp(SQLState, wxT("S1098"))) return(DB_ERR_SCOPE_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1099")) + if (!wxStrcmp(SQLState, wxT("S1099"))) return(DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1100")) + if (!wxStrcmp(SQLState, wxT("S1100"))) return(DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1101")) + if (!wxStrcmp(SQLState, wxT("S1101"))) return(DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1103")) + if (!wxStrcmp(SQLState, wxT("S1103"))) return(DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1104")) + if (!wxStrcmp(SQLState, wxT("S1104"))) return(DB_ERR_INVALID_PRECISION_VALUE); - if (!wxStrcmp(SQLState, "S1105")) + if (!wxStrcmp(SQLState, wxT("S1105"))) return(DB_ERR_INVALID_PARAM_TYPE); - if (!wxStrcmp(SQLState, "S1106")) + if (!wxStrcmp(SQLState, wxT("S1106"))) return(DB_ERR_FETCH_TYPE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1107")) + if (!wxStrcmp(SQLState, wxT("S1107"))) return(DB_ERR_ROW_VALUE_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1108")) + if (!wxStrcmp(SQLState, wxT("S1108"))) return(DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE); - if (!wxStrcmp(SQLState, "S1109")) + if (!wxStrcmp(SQLState, wxT("S1109"))) return(DB_ERR_INVALID_CURSOR_POSITION); - if (!wxStrcmp(SQLState, "S1110")) + if (!wxStrcmp(SQLState, wxT("S1110"))) return(DB_ERR_INVALID_DRIVER_COMPLETION); - if (!wxStrcmp(SQLState, "S1111")) + if (!wxStrcmp(SQLState, wxT("S1111"))) return(DB_ERR_INVALID_BOOKMARK_VALUE); - if (!wxStrcmp(SQLState, "S1C00")) + if (!wxStrcmp(SQLState, wxT("S1C00"))) return(DB_ERR_DRIVER_NOT_CAPABLE); - if (!wxStrcmp(SQLState, "S1T00")) + if (!wxStrcmp(SQLState, wxT("S1T00"))) return(DB_ERR_TIMEOUT_EXPIRED); // No match return(0); -} // wxDB::TranslateSqlState() +} // wxDb::TranslateSqlState() -/********** wxDB::Grant() **********/ -bool wxDB::Grant(int privileges, const char *tableName, const char *userList) +/********** wxDb::Grant() **********/ +bool wxDb::Grant(int privileges, const char *tableName, const char *userList) { // char sqlStmt[DB_MAX_STATEMENT_LEN]; wxString sqlStmt; @@ -1264,18 +1284,18 @@ bool wxDB::Grant(int privileges, const char *tableName, const char *userList) sqlStmt += userList; #ifdef DBDEBUG_CONSOLE - cout << endl << sqlStmt.GetData() << endl; + cout << endl << sqlStmt.c_str() << endl; #endif - WriteSqlLog(sqlStmt.GetData()); + WriteSqlLog(sqlStmt.c_str()); - return(ExecSql(sqlStmt.GetData())); + return(ExecSql(sqlStmt.c_str())); -} // wxDB::Grant() +} // wxDb::Grant() -/********** wxDB::CreateView() **********/ -bool wxDB::CreateView(const char *viewName, const char *colList, const char *pSqlStmt, bool attemptDrop) +/********** wxDb::CreateView() **********/ +bool wxDb::CreateView(const char *viewName, const char *colList, const char *pSqlStmt, bool attemptDrop) { // char sqlStmt[DB_MAX_STATEMENT_LEN]; wxString sqlStmt; @@ -1298,19 +1318,19 @@ bool wxDB::CreateView(const char *viewName, const char *colList, const char *pSq sqlStmt += " AS "; sqlStmt += pSqlStmt; - WriteSqlLog(sqlStmt.GetData()); + WriteSqlLog(sqlStmt.c_str()); #ifdef DBDEBUG_CONSOLE - cout << sqlStmt.GetData() << endl; + cout << sqlStmt.c_str() << endl; #endif - return(ExecSql(sqlStmt.GetData())); + return(ExecSql(sqlStmt.c_str())); -} // wxDB::CreateView() +} // wxDb::CreateView() -/********** wxDB::DropView() **********/ -bool wxDB::DropView(const char *viewName) +/********** wxDb::DropView() **********/ +bool wxDb::DropView(const char *viewName) { /* * NOTE: This function returns TRUE if the View does not exist, but @@ -1323,20 +1343,20 @@ bool wxDB::DropView(const char *viewName) sqlStmt.sprintf("DROP VIEW %s", viewName); - WriteSqlLog(sqlStmt.GetData()); + WriteSqlLog(sqlStmt.c_str()); #ifdef DBDEBUG_CONSOLE - cout << endl << sqlStmt.GetData() << endl; + cout << endl << sqlStmt.c_str() << endl; #endif - if (SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.GetData(), SQL_NTS) != SQL_SUCCESS) + if (SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.c_str(), SQL_NTS) != SQL_SUCCESS) { // Check for "Base table not found" error and ignore GetNextError(henv, hdbc, hstmt); - if (wxStrcmp(sqlState,"S0002")) // "Base table not found" + if (wxStrcmp(sqlState,wxT("S0002"))) // "Base table not found" { // Check for product specific error codes - if (!((Dbms() == dbmsSYBASE_ASA && !wxStrcmp(sqlState,"42000")))) // 5.x (and lower?) + if (!((Dbms() == dbmsSYBASE_ASA && !wxStrcmp(sqlState,wxT("42000"))))) // 5.x (and lower?) { DispNextError(); DispAllErrors(henv, hdbc, hstmt); @@ -1352,11 +1372,11 @@ bool wxDB::DropView(const char *viewName) return TRUE; -} // wxDB::DropView() +} // wxDb::DropView() -/********** wxDB::ExecSql() **********/ -bool wxDB::ExecSql(const char *pSqlStmt) +/********** wxDb::ExecSql() **********/ +bool wxDb::ExecSql(const char *pSqlStmt) { SQLFreeStmt(hstmt, SQL_CLOSE); if (SQLExecDirect(hstmt, (UCHAR FAR *) pSqlStmt, SQL_NTS) == SQL_SUCCESS) @@ -1367,11 +1387,11 @@ bool wxDB::ExecSql(const char *pSqlStmt) return(FALSE); } -} // wxDB::ExecSql() +} // wxDb::ExecSql() -/********** wxDB::GetNext() **********/ -bool wxDB::GetNext(void) +/********** wxDb::GetNext() **********/ +bool wxDb::GetNext(void) { if (SQLFetch(hstmt) == SQL_SUCCESS) return(TRUE); @@ -1381,11 +1401,11 @@ bool wxDB::GetNext(void) return(FALSE); } -} // wxDB::GetNext() +} // wxDb::GetNext() -/********** wxDB::GetData() **********/ -bool wxDB::GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FAR *cbReturned) +/********** wxDb::GetData() **********/ +bool wxDb::GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FAR *cbReturned) { assert(pData); assert(cbReturned); @@ -1398,11 +1418,11 @@ bool wxDB::GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FA return(FALSE); } -} // wxDB::GetData() +} // wxDb::GetData() -/********** wxDB::GetKeyFields() **********/ -int wxDB::GetKeyFields(char *tableName, wxColInf* colInf,int noCols) +/********** wxDb::GetKeyFields() **********/ +int wxDb::GetKeyFields(char *tableName, wxDbColInf* colInf, int noCols) { char szPkTable[DB_MAX_TABLE_NAME_LEN+1]; /* Primary key table name */ char szFkTable[DB_MAX_TABLE_NAME_LEN+1]; /* Foreign key table name */ @@ -1481,15 +1501,15 @@ int wxDB::GetKeyFields(char *tableName, wxColInf* colInf,int noCols) GetData( 5, SQL_C_SSHORT, &iKeySeq, 0, &cb); GetData( 7, SQL_C_CHAR, szFkTable, DB_MAX_TABLE_NAME_LEN+1, &cb); GetData( 8, SQL_C_CHAR, szFkCol, DB_MAX_COLUMN_NAME_LEN+1, &cb); - Temp0.Printf("%s[%s] ",Temp0.c_str(),szFkTable); // [ ] in case there is a blank in the Table name + Temp0.Printf(wxT("%s[%s] "),Temp0.c_str(),szFkTable); // [ ] in case there is a blank in the Table name } // if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) } // while ((retcode == SQL_SUCCESS) || (retcode == SQL_SUCCESS_WITH_INFO)) Temp0.Trim(); // Get rid of any unneeded blanks - if (Temp0 != "") + if (Temp0 != wxT("")) { for (i=0;i<noCols;i++) // Find the Column name if (!wxStrcmp(colInf[i].colName,szPkCol)) // We have found the Column, store the Information - strcpy(colInf[i].PkTableName,Temp0); // Name of the Tables where this Primary Key is used as a Foreign Key + wxStrcpy(colInf[i].PkTableName,Temp0.c_str()); // Name of the Tables where this Primary Key is used as a Foreign Key } // if (Temp0 != "") SQLFreeStmt(hstmt, SQL_CLOSE); /* Close the cursor (the hstmt is still allocated). */ @@ -1524,7 +1544,7 @@ int wxDB::GetKeyFields(char *tableName, wxColInf* colInf,int noCols) if (!wxStrcmp(colInf[i].colName,szFkCol)) // We have found the (Foreign Key) Column { colInf[i].FkCol = iKeySeq; // Which Foreign Key is this (first, second usw.) ? - strcpy(colInf[i].FkTableName,szPkTable); // Name of the Table where this Foriegn is the Primary Key + wxStrcpy(colInf[i].FkTableName,szPkTable); // Name of the Table where this Foriegn is the Primary Key } // if (!wxStrcmp(colInf[i].colName,szFkCol)) } // for (i=0;i<noCols;i++) } // if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) @@ -1533,20 +1553,21 @@ int wxDB::GetKeyFields(char *tableName, wxColInf* colInf,int noCols) /*---------------------------------------------------------------------*/ return TRUE; -} // wxDB::GetKeyFields() +} // wxDb::GetKeyFields() -/********** wxDB::GetColumns() **********/ -wxColInf *wxDB::GetColumns(char *tableName[], const char *userID) +#if OLD_GETCOLUMNS +/********** wxDb::GetColumns() **********/ +wxDbColInf *wxDb::GetColumns(char *tableName[], const char *userID) /* * 1) The last array element of the tableName[] argument must be zero (null). * This is how the end of the array is detected. - * 2) This function returns an array of wxColInf structures. If no columns + * 2) This function returns an array of wxDbColInf structures. If no columns * were found, or an error occured, this pointer will be zero (null). THE * CALLING FUNCTION IS RESPONSIBLE FOR DELETING THE MEMORY RETURNED WHEN IT * IS FINISHED WITH IT. i.e. * - * wxColInf *colInf = pDb->GetColumns(tableList, userID); + * wxDbColInf *colInf = pDb->GetColumns(tableList, userID); * if (colInf) * { * // Use the column inf @@ -1560,14 +1581,14 @@ wxColInf *wxDB::GetColumns(char *tableName[], const char *userID) * userID == "" ... UserID set equal to 'this->uid' * userID != "" ... UserID set equal to 'userID' * - * NOTE: ALL column bindings associated with this wxDB instance are unbound - * by this function. This function should use its own wxDB instance + * NOTE: ALL column bindings associated with this wxDb instance are unbound + * by this function. This function should use its own wxDb instance * to avoid undesired unbinding of columns. */ { int noCols = 0; int colNo = 0; - wxColInf *colInf = 0; + wxDbColInf *colInf = 0; RETCODE retcode; SDWORD cb; @@ -1595,7 +1616,7 @@ wxColInf *wxDB::GetColumns(char *tableName[], const char *userID) UserID = UserID.Upper(); // Pass 1 - Determine how many columns there are. - // Pass 2 - Allocate the wxColInf array and fill in + // Pass 2 - Allocate the wxDbColInf array and fill in // the array with the column information. int pass; for (pass = 1; pass <= 2; pass++) @@ -1604,13 +1625,13 @@ wxColInf *wxDB::GetColumns(char *tableName[], const char *userID) { if (noCols == 0) // Probably a bogus table name(s) break; - // Allocate n wxColInf objects to hold the column information - colInf = new wxColInf[noCols+1]; + // Allocate n wxDbColInf objects to hold the column information + colInf = new wxDbColInf[noCols+1]; if (!colInf) break; // Mark the end of the array - wxStrcpy(colInf[noCols].tableName, ""); - wxStrcpy(colInf[noCols].colName, ""); + wxStrcpy(colInf[noCols].tableName, wxT("")); + wxStrcpy(colInf[noCols].colName, wxT("")); colInf[noCols].sqlDataType = 0; } // Loop through each table name @@ -1627,14 +1648,14 @@ wxColInf *wxDB::GetColumns(char *tableName[], const char *userID) // MySQL and Access cannot accept a user name when looking up column names, so we // use the call below that leaves out the user name - if (wxStrcmp(UserID.GetData(),"") && + if (wxStrcmp(UserID.c_str(),wxT("")) && Dbms() != dbmsMY_SQL && Dbms() != dbmsACCESS) { retcode = SQLColumns(hstmt, NULL, 0, // All qualifiers - (UCHAR *) UserID.GetData(), SQL_NTS, // Owner - (UCHAR *) TableName.GetData(), SQL_NTS, + (UCHAR *) UserID.c_str(), SQL_NTS, // Owner + (UCHAR *) TableName.c_str(), SQL_NTS, NULL, 0); // All columns } else @@ -1642,7 +1663,7 @@ wxColInf *wxDB::GetColumns(char *tableName[], const char *userID) retcode = SQLColumns(hstmt, NULL, 0, // All qualifiers NULL, 0, // Owner - (UCHAR *) TableName.GetData(), SQL_NTS, + (UCHAR *) TableName.c_str(), SQL_NTS, NULL, 0); // All columns } if (retcode != SQL_SUCCESS) @@ -1675,8 +1696,8 @@ wxColInf *wxDB::GetColumns(char *tableName[], const char *userID) GetData(10, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].numPrecRadix, 0, &cb); GetData(11, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].nullable, 0, &cb); GetData(12, SQL_C_CHAR, (UCHAR*) colInf[colNo].remarks, 254+1, &cb); - - // Determine the wxDB data type that is used to represent the native data type of this data source + + // Determine the wxDb data type that is used to represent the native data type of this data source colInf[colNo].dbDataType = 0; if (!wxStricmp(typeInfVarchar.TypeName,colInf[colNo].typeName)) { @@ -1713,29 +1734,30 @@ wxColInf *wxDB::GetColumns(char *tableName[], const char *userID) SQLFreeStmt(hstmt, SQL_CLOSE); return colInf; -} // wxDB::GetColumns() +} // wxDb::GetColumns() -/********** wxDB::GetColumns() **********/ -wxColInf *wxDB::GetColumns(char *tableName, int *numCols, const char *userID) -/* - * Same as the above GetColumns() function except this one gets columns - * only for a single table, and if 'numCols' is not NULL, the number of - * columns stored in the returned wxColInf is set in '*numCols' - * - * userID is evaluated in the following manner: - * userID == NULL ... UserID is ignored - * userID == "" ... UserID set equal to 'this->uid' - * userID != "" ... UserID set equal to 'userID' - * - * NOTE: ALL column bindings associated with this wxDB instance are unbound - * by this function. This function should use its own wxDB instance - * to avoid undesired unbinding of columns. - */ +/********** wxDb::GetColumns() **********/ + +wxDbColInf *wxDb::GetColumns(char *tableName, int *numCols, const char *userID) +// +// Same as the above GetColumns() function except this one gets columns +// only for a single table, and if 'numCols' is not NULL, the number of +// columns stored in the returned wxDbColInf is set in '*numCols' +// +// userID is evaluated in the following manner: +// userID == NULL ... UserID is ignored +// userID == "" ... UserID set equal to 'this->uid' +// userID != "" ... UserID set equal to 'userID' +// +// NOTE: ALL column bindings associated with this wxDb instance are unbound +// by this function. This function should use its own wxDb instance +// to avoid undesired unbinding of columns. + { int noCols = 0; int colNo = 0; - wxColInf *colInf = 0; + wxDbColInf *colInf = 0; RETCODE retcode; SDWORD cb; @@ -1763,7 +1785,7 @@ wxColInf *wxDB::GetColumns(char *tableName, int *numCols, const char *userID) UserID = UserID.Upper(); // Pass 1 - Determine how many columns there are. - // Pass 2 - Allocate the wxColInf array and fill in + // Pass 2 - Allocate the wxDbColInf array and fill in // the array with the column information. int pass; for (pass = 1; pass <= 2; pass++) @@ -1772,13 +1794,13 @@ wxColInf *wxDB::GetColumns(char *tableName, int *numCols, const char *userID) { if (noCols == 0) // Probably a bogus table name(s) break; - // Allocate n wxColInf objects to hold the column information - colInf = new wxColInf[noCols+1]; + // Allocate n wxDbColInf objects to hold the column information + colInf = new wxDbColInf[noCols+1]; if (!colInf) break; // Mark the end of the array - wxStrcpy(colInf[noCols].tableName, ""); - wxStrcpy(colInf[noCols].colName, ""); + wxStrcpy(colInf[noCols].tableName, wxT("")); + wxStrcpy(colInf[noCols].colName, wxT("")); colInf[noCols].sqlDataType = 0; } @@ -1792,14 +1814,14 @@ wxColInf *wxDB::GetColumns(char *tableName, int *numCols, const char *userID) // MySQL and Access cannot accept a user name when looking up column names, so we // use the call below that leaves out the user name - if (wxStrcmp(UserID.GetData(),"") && + if (wxStrcmp(UserID.c_str(),wxT("")) && Dbms() != dbmsMY_SQL && Dbms() != dbmsACCESS) { retcode = SQLColumns(hstmt, NULL, 0, // All qualifiers - (UCHAR *) UserID.GetData(), SQL_NTS, // Owner - (UCHAR *) TableName.GetData(), SQL_NTS, + (UCHAR *) UserID.c_str(), SQL_NTS, // Owner + (UCHAR *) TableName.c_str(), SQL_NTS, NULL, 0); // All columns } else @@ -1807,7 +1829,7 @@ wxColInf *wxDB::GetColumns(char *tableName, int *numCols, const char *userID) retcode = SQLColumns(hstmt, NULL, 0, // All qualifiers NULL, 0, // Owner - (UCHAR *) TableName.GetData(), SQL_NTS, + (UCHAR *) TableName.c_str(), SQL_NTS, NULL, 0); // All columns } if (retcode != SQL_SUCCESS) @@ -1849,39 +1871,47 @@ wxColInf *wxDB::GetColumns(char *tableName, int *numCols, const char *userID) colInf[colNo].FkCol = 0; // Foreign key column 0=No; 1= First Key, 2 = Second Key etc. colInf[colNo].FkTableName[0] = 0; // Foreign key table name - // Determine the wxDB data type that is used to represent the native data type of this data source - colInf[colNo].dbDataType = 0; - if (!wxStricmp(typeInfVarchar.TypeName,colInf[colNo].typeName)) - { - if (colInf[colNo].columnSize < 1) - { - // IODBC does not return a correct columnSize, so we set - // columnSize = bufferLength if no column size was returned - colInf[colNo].columnSize = colInf[colNo].bufferLength; - } - colInf[colNo].dbDataType = DB_DATA_TYPE_VARCHAR; - } - else if (!wxStricmp(typeInfInteger.TypeName,colInf[colNo].typeName)) - colInf[colNo].dbDataType = DB_DATA_TYPE_INTEGER; - else if (!wxStricmp(typeInfFloat.TypeName,colInf[colNo].typeName)) - colInf[colNo].dbDataType = DB_DATA_TYPE_FLOAT; - else if (!wxStricmp(typeInfDate.TypeName,colInf[colNo].typeName)) - colInf[colNo].dbDataType = DB_DATA_TYPE_DATE; - + // BJO 20000428 : Virtuoso returns type names with upper cases! + if (Dbms() == dbmsVIRTUOSO) + { + wxString s = colInf[colNo].typeName; + s = s.MakeLower(); + wxStrcmp(colInf[colNo].typeName, s.c_str()); + } + + // Determine the wxDb data type that is used to represent the native data type of this data source + colInf[colNo].dbDataType = 0; + if (!wxStricmp(typeInfVarchar.TypeName,colInf[colNo].typeName)) + { + if (colInf[colNo].columnSize < 1) + { + // IODBC does not return a correct columnSize, so we set + // columnSize = bufferLength if no column size was returned + colInf[colNo].columnSize = colInf[colNo].bufferLength; + } + colInf[colNo].dbDataType = DB_DATA_TYPE_VARCHAR; + } + else if (!wxStricmp(typeInfInteger.TypeName,colInf[colNo].typeName)) + colInf[colNo].dbDataType = DB_DATA_TYPE_INTEGER; + else if (!wxStricmp(typeInfFloat.TypeName,colInf[colNo].typeName)) + colInf[colNo].dbDataType = DB_DATA_TYPE_FLOAT; + else if (!wxStricmp(typeInfDate.TypeName,colInf[colNo].typeName)) + colInf[colNo].dbDataType = DB_DATA_TYPE_DATE; + colNo++; } } } if (retcode != SQL_NO_DATA_FOUND) - { // Error occured, abort + { // Error occured, abort DispAllErrors(henv, hdbc, hstmt); if (colInf) - delete [] colInf; + delete [] colInf; SQLFreeStmt(hstmt, SQL_CLOSE); if (numCols) - *numCols = 0; + *numCols = 0; return(0); - } + } } SQLFreeStmt(hstmt, SQL_CLOSE); @@ -1893,11 +1923,361 @@ wxColInf *wxDB::GetColumns(char *tableName, int *numCols, const char *userID) *numCols = noCols; return colInf; -} // wxDB::GetColumns() +} // wxDb::GetColumns() + +#else // New GetColumns + -/********** wxDB::GetColumnCount() **********/ -int wxDB::GetColumnCount(char *tableName, const char *userID) +/* + +BJO 20000503 + +These are tentative new GetColumns members: + +- The first one (wxDbColInf *wxDb::GetColumns(char *tableName[], const char* userID)) calls + the second implementation for each separate table before merging the results. This makes the + code easier to maintain as only one member (the second) makes the real work +- wxDbColInf *wxDb::GetColumns(char *tableName, int *numCols, const char *userID) is a little bit improved + - It doesn't anymore rely on the type-name to find out which database-type each column has + - It ends by sorting the columns, so that they are returned in the same order they were created + +*/ + +typedef struct +{ + int noCols; + wxDbColInf *colInf; +} _TableColumns; + +wxDbColInf *wxDb::GetColumns(char *tableName[], const char* userID) +{ + int i, j; + // The last array element of the tableName[] argument must be zero (null). + // This is how the end of the array is detected. + + int noCols = 0; + + // How many tables ? + int tbl; + for (tbl = 0 ; tableName[tbl]; tbl++); + + // Create a table to maintain the columns for each separate table + _TableColumns *TableColumns = new _TableColumns[tbl]; + + // Fill the table + for (i = 0 ; i < tbl ; i++) + + { + TableColumns[i].colInf = GetColumns(tableName[i], &TableColumns[i].noCols, userID); + if (TableColumns[i].colInf == NULL) return NULL; + noCols += TableColumns[i].noCols; + } + + // Now merge all the separate table infos + wxDbColInf *colInf = new wxDbColInf[noCols+1]; + + // Mark the end of the array + wxStrcpy(colInf[noCols].tableName, wxT("")); + wxStrcpy(colInf[noCols].colName, wxT("")); + colInf[noCols].sqlDataType = 0; + + // Merge ... + int offset = 0; + + for (i = 0 ; i < tbl ; i++) + { + for (j = 0 ; j < TableColumns[i].noCols ; j++) + { + colInf[offset++] = TableColumns[i].colInf[j]; + } + } + + delete [] TableColumns; + + return colInf; +} + + +wxDbColInf *wxDb::GetColumns(char *tableName, int *numCols, const char *userID) + // + // Same as the above GetColumns() function except this one gets columns + // only for a single table, and if 'numCols' is not NULL, the number of + // columns stored in the returned wxDbColInf is set in '*numCols' + // + // userID is evaluated in the following manner: + // userID == NULL ... UserID is ignored + // userID == "" ... UserID set equal to 'this->uid' + // userID != "" ... UserID set equal to 'userID' + // + // NOTE: ALL column bindings associated with this wxDb instance are unbound + // by this function. This function should use its own wxDb instance + // to avoid undesired unbinding of columns. + +{ + SWORD noCols = 0; + int colNo = 0; + wxDbColInf *colInf = 0; + + RETCODE retcode; + SDWORD cb; + + wxString UserID; + wxString TableName; + + if (userID) + { + if (!wxStrlen(userID)) + UserID = uid; + else + UserID = userID; + } + else + UserID = ""; + + // dBase does not use user names, and some drivers fail if you try to pass one + if (Dbms() == dbmsDBASE) + UserID = ""; + + // Oracle user names may only be in uppercase, so force + // the name to uppercase + if (Dbms() == dbmsORACLE) + UserID = UserID.Upper(); + + // Pass 1 - Determine how many columns there are. + // Pass 2 - Allocate the wxDbColInf array and fill in + // the array with the column information. + int pass; + for (pass = 1; pass <= 2; pass++) + { + if (pass == 2) + { + if (noCols == 0) // Probably a bogus table name(s) + break; + // Allocate n wxDbColInf objects to hold the column information + colInf = new wxDbColInf[noCols+1]; + if (!colInf) + break; + // Mark the end of the array + wxStrcpy(colInf[noCols].tableName, wxT("")); + wxStrcpy(colInf[noCols].colName, wxT("")); + colInf[noCols].sqlDataType = 0; + } + + TableName = tableName; + // Oracle table names are uppercase only, so force + // the name to uppercase just in case programmer forgot to do this + if (Dbms() == dbmsORACLE) + TableName = TableName.Upper(); + + SQLFreeStmt(hstmt, SQL_CLOSE); + + // MySQL and Access cannot accept a user name when looking up column names, so we + // use the call below that leaves out the user name + if (wxStrcmp(UserID.c_str(),wxT("")) && + Dbms() != dbmsMY_SQL && + Dbms() != dbmsACCESS) + { + retcode = SQLColumns(hstmt, + NULL, 0, // All qualifiers + (UCHAR *) UserID.c_str(), SQL_NTS, // Owner + (UCHAR *) TableName.c_str(), SQL_NTS, + NULL, 0); // All columns + } + else + { + retcode = SQLColumns(hstmt, + NULL, 0, // All qualifiers + NULL, 0, // Owner + (UCHAR *) TableName.c_str(), SQL_NTS, + NULL, 0); // All columns + } + if (retcode != SQL_SUCCESS) + { // Error occured, abort + DispAllErrors(henv, hdbc, hstmt); + if (colInf) + delete [] colInf; + SQLFreeStmt(hstmt, SQL_CLOSE); + if (numCols) + *numCols = 0; + return(0); + } + + while ((retcode = SQLFetch(hstmt)) == SQL_SUCCESS) + { + if (pass == 1) // First pass, just add up the number of columns + noCols++; + else // Pass 2; Fill in the array of structures + { + if (colNo < noCols) // Some extra error checking to prevent memory overwrites + { + // NOTE: Only the ODBC 1.x fields are retrieved + GetData( 1, SQL_C_CHAR, (UCHAR*) colInf[colNo].catalog, 128+1, &cb); + GetData( 2, SQL_C_CHAR, (UCHAR*) colInf[colNo].schema, 128+1, &cb); + GetData( 3, SQL_C_CHAR, (UCHAR*) colInf[colNo].tableName, DB_MAX_TABLE_NAME_LEN+1, &cb); + GetData( 4, SQL_C_CHAR, (UCHAR*) colInf[colNo].colName, DB_MAX_COLUMN_NAME_LEN+1, &cb); + GetData( 5, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].sqlDataType, 0, &cb); + GetData( 6, SQL_C_CHAR, (UCHAR*) colInf[colNo].typeName, 128+1, &cb); + GetData( 7, SQL_C_SLONG, (UCHAR*) &colInf[colNo].columnSize, 0, &cb); + GetData( 8, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].bufferLength, 0, &cb); + GetData( 9, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].decimalDigits,0, &cb); + GetData(10, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].numPrecRadix, 0, &cb); + GetData(11, SQL_C_SSHORT, (UCHAR*) &colInf[colNo].nullable, 0, &cb); + GetData(12, SQL_C_CHAR, (UCHAR*) colInf[colNo].remarks, 254+1, &cb); + // Start Values for Primary/Foriegn Key (=No) + colInf[colNo].PkCol = 0; // Primary key column 0=No; 1= First Key, 2 = Second Key etc. + colInf[colNo].PkTableName[0] = 0; // Tablenames where Primary Key is used as a Foreign Key + colInf[colNo].FkCol = 0; // Foreign key column 0=No; 1= First Key, 2 = Second Key etc. + colInf[colNo].FkTableName[0] = 0; // Foreign key table name + +#ifdef _IODBC_ + // IODBC returns the columnSize in bufferLength.. (bug) + colInf[colNo].columnSize = colInf[colNo].bufferLength; +#endif + + // Determine the wxDb data type that is used to represent the native data type of this data source + colInf[colNo].dbDataType = 0; + // Get the intern datatype + switch (colInf[colNo].sqlDataType) + { + case SQL_VARCHAR: + case SQL_CHAR: + colInf[colNo].dbDataType = DB_DATA_TYPE_VARCHAR; + break; + + case SQL_TINYINT: + case SQL_SMALLINT: + case SQL_INTEGER: + colInf[colNo].dbDataType = DB_DATA_TYPE_INTEGER; + break; + case SQL_DOUBLE: + case SQL_DECIMAL: + case SQL_NUMERIC: + case SQL_FLOAT: + case SQL_REAL: + colInf[colNo].dbDataType = DB_DATA_TYPE_FLOAT; + break; + case SQL_DATE: + colInf[colNo].dbDataType = DB_DATA_TYPE_DATE; + break; + + +#ifdef __WXDEBUG__ + default: + wxString errMsg; + errMsg.sprintf("SQL Data type %d currently not supported by wxWindows", colInf[colNo].sqlDataType); + wxLogDebug(errMsg,wxT("ODBC DEBUG MESSAGE")); +#endif + } + + + + colNo++; + } + } + } + if (retcode != SQL_NO_DATA_FOUND) + { // Error occured, abort + DispAllErrors(henv, hdbc, hstmt); + if (colInf) + delete [] colInf; + SQLFreeStmt(hstmt, SQL_CLOSE); + if (numCols) + *numCols = 0; + return(0); + } + } + + SQLFreeStmt(hstmt, SQL_CLOSE); + + // Store Primary and Foreign Keys + GetKeyFields(tableName,colInf,noCols); + + + + /////////////////////////////////////////////////////////////////////////// + // Now sort the the columns in order to make them appear in the right order + /////////////////////////////////////////////////////////////////////////// + + // Build a generic SELECT statement which returns 0 rows + wxString Stmt; + + Stmt.sprintf("select * from %s where 0=1", tableName); + + // Execute query + if (SQLExecDirect(hstmt, (UCHAR FAR *) Stmt.c_str(), SQL_NTS) != SQL_SUCCESS) + { + DispAllErrors(henv, hdbc, hstmt); + return NULL; + } + + // Get the number of result columns + if (SQLNumResultCols (hstmt, &noCols) != SQL_SUCCESS) + { + DispAllErrors(henv, hdbc, hstmt); + return NULL; + } + + if (noCols == 0) // Probably a bogus table name + return NULL; + + // Get the name + int i; + short colNum; + UCHAR name[100]; + SWORD Sword; + SDWORD Sdword; + for (colNum = 0; colNum < noCols; colNum++) + { + if (SQLColAttributes(hstmt,colNum+1, SQL_COLUMN_NAME, + name, sizeof(name), + &Sword, &Sdword) != SQL_SUCCESS) + { + DispAllErrors(henv, hdbc, hstmt); + return NULL; + } + + wxString Name1 = name; + Name1 = Name1.Upper(); + + // Where is this name in the array ? + for (i = colNum ; i < noCols ; i++) + { + wxString Name2 = colInf[i].colName; + Name2 = Name2.Upper(); + if (Name2 == Name1) + { + if (colNum != i) // swap to sort + { + wxDbColInf tmpColInf = colInf[colNum]; + colInf[colNum] = colInf[i]; + colInf[i] = tmpColInf; + } + break; + } + } + } + SQLFreeStmt(hstmt, SQL_CLOSE); + + /////////////////////////////////////////////////////////////////////////// + // End sorting + /////////////////////////////////////////////////////////////////////////// + + + + + if (numCols) + *numCols = noCols; + return colInf; + +} // wxDb::GetColumns() + + +#endif + + +/********** wxDb::GetColumnCount() **********/ +int wxDb::GetColumnCount(char *tableName, const char *userID) /* * Returns a count of how many columns are in a table. * If an error occurs in computing the number of columns @@ -1908,8 +2288,8 @@ int wxDB::GetColumnCount(char *tableName, const char *userID) * userID == "" ... UserID set equal to 'this->uid' * userID != "" ... UserID set equal to 'userID' * - * NOTE: ALL column bindings associated with this wxDB instance are unbound - * by this function. This function should use its own wxDB instance + * NOTE: ALL column bindings associated with this wxDb instance are unbound + * by this function. This function should use its own wxDb instance * to avoid undesired unbinding of columns. */ { @@ -1928,11 +2308,11 @@ int wxDB::GetColumnCount(char *tableName, const char *userID) UserID = userID; } else - UserID = ""; + UserID = wxT(""); // dBase does not use user names, and some drivers fail if you try to pass one if (Dbms() == dbmsDBASE) - UserID = ""; + UserID = wxT(""); // Oracle user names may only be in uppercase, so force // the name to uppercase @@ -1952,14 +2332,14 @@ int wxDB::GetColumnCount(char *tableName, const char *userID) // MySQL and Access cannot accept a user name when looking up column names, so we // use the call below that leaves out the user name - if (wxStrcmp(UserID.GetData(),"") && + if (wxStrcmp(UserID.c_str(),wxT("")) && Dbms() != dbmsMY_SQL && Dbms() != dbmsACCESS) { retcode = SQLColumns(hstmt, NULL, 0, // All qualifiers - (UCHAR *) UserID.GetData(), SQL_NTS, // Owner - (UCHAR *) TableName.GetData(), SQL_NTS, + (UCHAR *) UserID.c_str(), SQL_NTS, // Owner + (UCHAR *) TableName.c_str(), SQL_NTS, NULL, 0); // All columns } else @@ -1967,7 +2347,7 @@ int wxDB::GetColumnCount(char *tableName, const char *userID) retcode = SQLColumns(hstmt, NULL, 0, // All qualifiers NULL, 0, // Owner - (UCHAR *) TableName.GetData(), SQL_NTS, + (UCHAR *) TableName.c_str(), SQL_NTS, NULL, 0); // All columns } if (retcode != SQL_SUCCESS) @@ -1993,11 +2373,11 @@ int wxDB::GetColumnCount(char *tableName, const char *userID) SQLFreeStmt(hstmt, SQL_CLOSE); return noCols; -} // wxDB::GetColumnCount() +} // wxDb::GetColumnCount() -/********** wxDB::GetCatalog() *******/ -wxDbInf *wxDB::GetCatalog(char *userID) +/********** wxDb::GetCatalog() *******/ +wxDbInf *wxDb::GetCatalog(char *userID) /* * --------------------------------------------------------------------- * -- 19991203 : mj10777@gmx.net : Create ------ @@ -2015,8 +2395,8 @@ wxDbInf *wxDB::GetCatalog(char *userID) * userID == "" ... UserID set equal to 'this->uid' * userID != "" ... UserID set equal to 'userID' * - * NOTE: ALL column bindings associated with this wxDB instance are unbound - * by this function. This function should use its own wxDB instance + * NOTE: ALL column bindings associated with this wxDb instance are unbound + * by this function. This function should use its own wxDb instance * to avoid undesired unbinding of columns. */ { @@ -2038,11 +2418,11 @@ wxDbInf *wxDB::GetCatalog(char *userID) UserID = userID; } else - UserID = ""; + UserID = wxT(""); // dBase does not use user names, and some drivers fail if you try to pass one if (Dbms() == dbmsDBASE) - UserID = ""; + UserID = wxT(""); // Oracle user names may only be in uppercase, so force // the name to uppercase @@ -2061,39 +2441,46 @@ wxDbInf *wxDB::GetCatalog(char *userID) // Pass 2 - Create the Table array and fill it // - Create the Cols array = NULL //------------------------------------------------------------- + + for (pass = 1; pass <= 2; pass++) { SQLFreeStmt(hstmt, SQL_CLOSE); // Close if Open - tblNameSave = ""; + tblNameSave = wxT(""); - if (wxStrcmp(UserID.GetData(),"") && + if (wxStrcmp(UserID.c_str(),wxT("")) && Dbms() != dbmsMY_SQL && Dbms() != dbmsACCESS) { + retcode = SQLTables(hstmt, NULL, 0, // All qualifiers - (UCHAR *) UserID.GetData(), SQL_NTS, // User specified + (UCHAR *) UserID.c_str(), SQL_NTS, // User specified NULL, 0, // All tables NULL, 0); // All columns } else { + retcode = SQLTables(hstmt, NULL, 0, // All qualifiers NULL, 0, // User specified NULL, 0, // All tables NULL, 0); // All columns } + if (retcode != SQL_SUCCESS) { + DispAllErrors(henv, hdbc, hstmt); pDbInf = NULL; SQLFreeStmt(hstmt, SQL_CLOSE); return pDbInf; } - + while ((retcode = SQLFetch(hstmt)) == SQL_SUCCESS) // Table Information { + if (pass == 1) // First pass, just count the Tables { if (pDbInf->numTables == 0) @@ -2107,7 +2494,7 @@ wxDbInf *wxDB::GetCatalog(char *userID) { if (pDbInf->pTableInf == NULL) // Has the Table Array been created { // no, then create the Array - pDbInf->pTableInf = new wxTableInf[pDbInf->numTables]; + pDbInf->pTableInf = new wxDbTableInf[pDbInf->numTables]; for (noTab=0;noTab<pDbInf->numTables;noTab++) { (pDbInf->pTableInf+noTab)->tableName[0] = 0; @@ -2117,10 +2504,12 @@ wxDbInf *wxDB::GetCatalog(char *userID) (pDbInf->pTableInf+noTab)->pColInf = NULL; } noTab = 0; - } // if (pDbInf->pTableInf == NULL) // Has the Table Array been created + } // if (pDbInf->pTableInf == NULL) // Has the Table Array been created + GetData( 3, SQL_C_CHAR, (UCHAR*) (pDbInf->pTableInf+noTab)->tableName, DB_MAX_TABLE_NAME_LEN+1, &cb); GetData( 4, SQL_C_CHAR, (UCHAR*) (pDbInf->pTableInf+noTab)->tableType, 30+1, &cb); GetData( 5, SQL_C_CHAR, (UCHAR*) (pDbInf->pTableInf+noTab)->tableRemarks, 254+1, &cb); + noTab++; } // if (pass == 2) We now know the amount of Tables } // while ((retcode = SQLFetch(hstmt)) == SQL_SUCCESS) @@ -2133,11 +2522,11 @@ wxDbInf *wxDB::GetCatalog(char *userID) (pDbInf->pTableInf+noTab)->numCols = GetColumnCount((pDbInf->pTableInf+noTab)->tableName,UserID); } return pDbInf; -} // wxDB::GetCatalog() +} // wxDb::GetCatalog() -/********** wxDB::Catalog() **********/ -bool wxDB::Catalog(const char *userID, const char *fileName) +/********** wxDb::Catalog() **********/ +bool wxDb::Catalog(const char *userID, const char *fileName) /* * Creates the text file specified in 'filename' which will contain * a minimal data dictionary of all tables accessible by the user specified @@ -2148,8 +2537,8 @@ bool wxDB::Catalog(const char *userID, const char *fileName) * userID == "" ... UserID set equal to 'this->uid' * userID != "" ... UserID set equal to 'userID' * - * NOTE: ALL column bindings associated with this wxDB instance are unbound - * by this function. This function should use its own wxDB instance + * NOTE: ALL column bindings associated with this wxDb instance are unbound + * by this function. This function should use its own wxDb instance * to avoid undesired unbinding of columns. */ { @@ -2180,24 +2569,24 @@ bool wxDB::Catalog(const char *userID, const char *fileName) UserID = userID; } else - UserID = ""; + UserID = wxT(""); // dBase does not use user names, and some drivers fail if you try to pass one if (Dbms() == dbmsDBASE) - UserID = ""; + UserID = wxT(""); // Oracle user names may only be in uppercase, so force // the name to uppercase if (Dbms() == dbmsORACLE) UserID = UserID.Upper(); - if (wxStrcmp(UserID.GetData(),"") && + if (wxStrcmp(UserID.c_str(),wxT("")) && Dbms() != dbmsMY_SQL && Dbms() != dbmsACCESS) { retcode = SQLColumns(hstmt, NULL, 0, // All qualifiers - (UCHAR *) UserID.GetData(), SQL_NTS, // User specified + (UCHAR *) UserID.c_str(), SQL_NTS, // User specified NULL, 0, // All tables NULL, 0); // All columns } @@ -2217,12 +2606,12 @@ bool wxDB::Catalog(const char *userID, const char *fileName) } wxString outStr; - tblNameSave = ""; + tblNameSave = wxT(""); int cnt = 0; while ((retcode = SQLFetch(hstmt)) == SQL_SUCCESS) { - if (wxStrcmp(tblName,tblNameSave.GetData())) + if (wxStrcmp(tblName,tblNameSave.c_str())) { if (cnt) fputs("\n", fp); @@ -2231,9 +2620,9 @@ bool wxDB::Catalog(const char *userID, const char *fileName) fputs("===================== ", fp); fputs("========= ", fp); fputs("=========\n", fp); - outStr.sprintf("%-32s %-32s %-21s %9s %9s\n", - "TABLE NAME", "COLUMN NAME", "DATA TYPE", "PRECISION", "LENGTH"); - fputs(outStr.GetData(), fp); + outStr.sprintf(wxT("%-32s %-32s %-21s %9s %9s\n"), + wxT("TABLE NAME"), wxT("COLUMN NAME"), wxT("DATA TYPE"), wxT("PRECISION"), wxT("LENGTH")); + fputs(outStr.c_str(), fp); fputs("================================ ", fp); fputs("================================ ", fp); fputs("===================== ", fp); @@ -2251,7 +2640,7 @@ bool wxDB::Catalog(const char *userID, const char *fileName) outStr.sprintf("%-32s %-32s (%04d)%-15s %9d %9d\n", tblName, colName, sqlDataType, typeName, precision, length); - if (fputs(outStr.GetData(), fp) == EOF) + if (fputs(outStr.c_str(), fp) == EOF) { SQLFreeStmt(hstmt, SQL_CLOSE); fclose(fp); @@ -2268,10 +2657,10 @@ bool wxDB::Catalog(const char *userID, const char *fileName) fclose(fp); return(retcode == SQL_NO_DATA_FOUND); -} // wxDB::Catalog() +} // wxDb::Catalog() -bool wxDB::TableExists(const char *tableName, const char *userID, const char *tablePath) +bool wxDb::TableExists(const char *tableName, const char *userID, const char *tablePath) /* * Table name can refer to a table, view, alias or synonym. Returns true * if the object exists in the database. This function does not indicate @@ -2289,17 +2678,18 @@ bool wxDB::TableExists(const char *tableName, const char *userID, const char *ta assert(tableName && wxStrlen(tableName)); - if (Dbms() == dbmsDBASE) + if (Dbms() == dbmsDBASE) { - wxString dbName; - if (tablePath && wxStrlen(tablePath)) - dbName.sprintf("%s/%s.dbf",tablePath,tableName); - else - dbName.sprintf("%s.dbf",tableName); - - bool exists; - exists = wxFileExists(dbName.GetData()); - return exists; + + wxString dbName; + if (tablePath && wxStrlen(tablePath)) + dbName.sprintf("%s\\%s.dbf",tablePath,tableName); + else + dbName.sprintf("%s.dbf",tableName); + + bool exists; + exists = wxFileExists(dbName.c_str()); + return exists; } if (userID) @@ -2334,8 +2724,8 @@ bool wxDB::TableExists(const char *tableName, const char *userID, const char *ta { retcode = SQLTables(hstmt, NULL, 0, // All qualifiers - (UCHAR *) UserID.GetData(), SQL_NTS, // All owners - (UCHAR FAR *)TableName.GetData(), SQL_NTS, + (UCHAR *) UserID.c_str(), SQL_NTS, // All owners + (UCHAR FAR *)TableName.c_str(), SQL_NTS, NULL, 0); // All table types } else @@ -2343,7 +2733,7 @@ bool wxDB::TableExists(const char *tableName, const char *userID, const char *ta retcode = SQLTables(hstmt, NULL, 0, // All qualifiers NULL, 0, // All owners - (UCHAR FAR *)TableName.GetData(), SQL_NTS, + (UCHAR FAR *)TableName.c_str(), SQL_NTS, NULL, 0); // All table types } if (retcode != SQL_SUCCESS) @@ -2359,11 +2749,11 @@ bool wxDB::TableExists(const char *tableName, const char *userID, const char *ta SQLFreeStmt(hstmt, SQL_CLOSE); return(TRUE); -} // wxDB::TableExists() +} // wxDb::TableExists() -/********** wxDB::SqlLog() **********/ -bool wxDB::SqlLog(wxSqlLogState state, const char *filename, bool append) +/********** wxDb::SetSqlLogging() **********/ +bool wxDb::SetSqlLogging(wxDbSqlLogState state, const char *filename, bool append) { assert(state == sqlLogON || state == sqlLogOFF); assert(state == sqlLogOFF || filename); @@ -2390,11 +2780,11 @@ bool wxDB::SqlLog(wxSqlLogState state, const char *filename, bool append) sqlLogState = state; return(TRUE); -} // wxDB::SqlLog() +} // wxDb::SetSqlLogging() -/********** wxDB::WriteSqlLog() **********/ -bool wxDB::WriteSqlLog(const char *logMsg) +/********** wxDb::WriteSqlLog() **********/ +bool wxDb::WriteSqlLog(const wxChar *logMsg) { assert(logMsg); @@ -2407,18 +2797,18 @@ bool wxDB::WriteSqlLog(const char *logMsg) return(TRUE); -} // wxDB::WriteSqlLog() +} // wxDb::WriteSqlLog() -/********** wxDB::Dbms() **********/ -wxDBMS wxDB::Dbms(void) +/********** wxDb::Dbms() **********/ +wxDBMS wxDb::Dbms(void) /* * Be aware that not all database engines use the exact same syntax, and not * every ODBC compliant database is compliant to the same level of compliancy. * Some manufacturers support the minimum Level 1 compliancy, and others up * through Level 3. Others support subsets of features for levels above 1. * - * If you find an inconsistency between the wxDB class and a specific database + * If you find an inconsistency between the wxDb class and a specific database * engine, and an identifier to this section, and special handle the database in * the area where behavior is non-conforming with the other databases. * @@ -2457,12 +2847,26 @@ wxDBMS wxDB::Dbms(void) */ { wxChar baseName[25+1]; - wxStrncpy(baseName,dbInf.dbmsName,25); + + // BJO 20000428 : add support for Virtuoso + if (!wxStricmp(dbInf.dbmsName,"OpenLink Virtuoso VDBMS")) + return(dbmsVIRTUOSO); + + if (!wxStricmp(dbInf.dbmsName,"Adaptive Server Anywhere")) return(dbmsSYBASE_ASA); - if (!wxStricmp(dbInf.dbmsName,"SQL Server")) // Sybase Adaptive Server - return(dbmsSYBASE_ASE); + + // BJO 20000427 : The "SQL Server" string is also returned by SQLServer when + // connected through an OpenLink driver. + // Is it also returned by Sybase Adapatitve server? + // OpenLink driver name is OLOD3032.DLL for msw and oplodbc.so for unix + if (!wxStricmp(dbInf.dbmsName,"SQL Server")) + if (!wxStrncmp(dbInf.driverName, "oplodbc", 7) || + !wxStrncmp(dbInf.driverName, "OLOD", 4)) + return dbmsMS_SQL_SERVER; else return dbmsSYBASE_ASE; + + if (!wxStricmp(dbInf.dbmsName,"Microsoft SQL Server")) return(dbmsMS_SQL_SERVER); if (!wxStricmp(dbInf.dbmsName,"MySQL")) @@ -2474,6 +2878,7 @@ wxDBMS wxDB::Dbms(void) if (!wxStricmp(baseName,"Informix")) return(dbmsINFORMIX); + baseName[6] = 0; if (!wxStricmp(baseName,"Oracle")) return(dbmsORACLE); @@ -2481,17 +2886,19 @@ wxDBMS wxDB::Dbms(void) return(dbmsACCESS); if (!wxStricmp(dbInf.dbmsName,"MySQL")) return(dbmsMY_SQL); + if (!wxStricmp(baseName,"Sybase")) + return(dbmsSYBASE_ASE); baseName[5] = 0; if (!wxStricmp(baseName,"DBASE")) return(dbmsDBASE); return(dbmsUNIDENTIFIED); -} // wxDB::Dbms() +} // wxDb::Dbms() /********** wxDbGetConnection() **********/ -wxDB WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCursors) +wxDb WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCursors) { wxDbList *pList; @@ -2530,12 +2937,12 @@ wxDB WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCurso pList->PtrNext = 0; pList->Free = FALSE; wxStrcpy(pList->Dsn, pDbConfig->Dsn); - pList->PtrDb = new wxDB(pDbConfig->Henv,FwdOnlyCursors); + pList->PtrDb = new wxDb(pDbConfig->Henv,FwdOnlyCursors); // Connect to the datasource if (pList->PtrDb->Open(pDbConfig->Dsn, pDbConfig->Uid, pDbConfig->AuthStr)) { - pList->PtrDb->SqlLog(SQLLOGstate,SQLLOGfn,TRUE); + pList->PtrDb->SetSqlLogging(SQLLOGstate,SQLLOGfn,TRUE); return(pList->PtrDb); } else // Unable to connect, destroy list item @@ -2544,9 +2951,9 @@ wxDB WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCurso pList->PtrPrev->PtrNext = 0; else PtrBegDbList = 0; // Empty list again - pList->PtrDb->CommitTrans(); // Commit any open transactions on wxDB object - pList->PtrDb->Close(); // Close the wxDB object - delete pList->PtrDb; // Deletes the wxDB object + pList->PtrDb->CommitTrans(); // Commit any open transactions on wxDb object + pList->PtrDb->Close(); // Close the wxDb object + delete pList->PtrDb; // Deletes the wxDb object delete pList; // Deletes the linked list object return(0); } @@ -2555,7 +2962,7 @@ wxDB WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCurso /********** wxDbFreeConnection() **********/ -bool WXDLLEXPORT wxDbFreeConnection(wxDB *pDb) +bool WXDLLEXPORT wxDbFreeConnection(wxDb *pDb) { wxDbList *pList; @@ -2581,9 +2988,9 @@ void WXDLLEXPORT wxDbCloseConnections(void) for (pList = PtrBegDbList; pList; pList = pNext) { pNext = pList->PtrNext; // Save the pointer to next - pList->PtrDb->CommitTrans(); // Commit any open transactions on wxDB object - pList->PtrDb->Close(); // Close the wxDB object - delete pList->PtrDb; // Deletes the wxDB object + pList->PtrDb->CommitTrans(); // Commit any open transactions on wxDb object + pList->PtrDb->Close(); // Close the wxDb object + delete pList->PtrDb; // Deletes the wxDb object delete pList; // Deletes the linked list object } @@ -2612,14 +3019,14 @@ int WXDLLEXPORT wxDbConnectionsInUse(void) /********** wxDbSqlLog() **********/ -bool wxDbSqlLog(wxSqlLogState state, char *filename) +bool wxDbSqlLog(wxDbSqlLogState state, const wxChar *filename) { bool append = FALSE; wxDbList *pList; for (pList = PtrBegDbList; pList; pList = pList->PtrNext) { - if (!pList->PtrDb->SqlLog(state,filename,append)) + if (!pList->PtrDb->SetSqlLogging(state,filename,append)) return(FALSE); append = TRUE; } @@ -2669,7 +3076,7 @@ int wxDbCreateDataSource(const char *driverName, const char *dsn, const char *de while (k != wxNOT_FOUND); result = SQLConfigDataSource((HWND)parent->GetHWND(), dsnLocation, - driverName, setupStr.GetData()); + driverName, setupStr.c_str()); if (!result) { @@ -2682,20 +3089,19 @@ int wxDbCreateDataSource(const char *driverName, const char *dsn, const char *de SQLInstallerError(1,&retcode,errMsg,500,&cb); if (retcode) { -// logError(errMsg, sqlState); -// if (!silent) -// { + if (!silent) + { #ifdef DBDEBUG_CONSOLE - // When run in console mode, use standard out to display errors. - cout << errMsg << endl; - cout << "Press any key to continue..." << endl; - getchar(); + // When run in console mode, use standard out to display errors. + cout << errMsg << endl; + cout << "Press any key to continue..." << endl; + getchar(); #endif // DBDEBUG_CONSOLE -// } #ifdef __WXDEBUG__ - wxLogDebug(errMsg,"DEBUG MESSAGE"); + wxLogDebug(errMsg,wxT("ODBC DEBUG MESSAGE")); #endif // __WXDEBUG__ + } } } else @@ -2733,7 +3139,7 @@ bool wxDbGetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD D // Change this to 0 to remove use of all deprecated functions -#if 1 +#if wxODBC_BACKWARD_COMPATABILITY /******************************************************************** ******************************************************************** * @@ -2742,9 +3148,9 @@ bool wxDbGetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD D * ******************************************************************** ********************************************************************/ -bool SqlLog(sqlLog state, char *filename) +bool SqlLog(sqlLog state, const wxChar *filename) { - return wxDbSqlLog((enum wxSqlLogState)state, filename); + return wxDbSqlLog((enum wxDbSqlLogState)state, filename); } /***** DEPRECATED: use wxGetDataSource() *****/ bool GetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD DsDescMax, @@ -2753,12 +3159,12 @@ bool GetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD DsDes return wxDbGetDataSource(henv, Dsn, DsnMax, DsDesc, DsDescMax, direction); } /***** DEPRECATED: use wxDbGetConnection() *****/ -wxDB WXDLLEXPORT *GetDbConnection(DbStuff *pDbStuff, bool FwdOnlyCursors) +wxDb WXDLLEXPORT *GetDbConnection(DbStuff *pDbStuff, bool FwdOnlyCursors) { return wxDbGetConnection((wxDbConnectInf *)pDbStuff, FwdOnlyCursors); } /***** DEPRECATED: use wxDbFreeConnection() *****/ -bool WXDLLEXPORT FreeDbConnection(wxDB *pDb) +bool WXDLLEXPORT FreeDbConnection(wxDb *pDb) { return wxDbFreeConnection(pDb); } @@ -2775,8 +3181,5 @@ int WXDLLEXPORT NumberDbConnectionsInUse(void) #endif - - - #endif // wxUSE_ODBC diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index 817c5332bf..9daf02fcb7 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -1,13 +1,13 @@ /////////////////////////////////////////////////////////////////////////////// // Name: dbtable.cpp -// Purpose: Implementation of the wxTable class. +// Purpose: Implementation of the wxDbTable class. // Author: Doug Card // Modified by: George Tasker // Mods: April 1999 // -Dynamic cursor support - Only one predefined cursor, as many others as // you need may be created on demand // -Reduced number of active cursors significantly -// -Query-Only wxTable objects +// -Query-Only wxDbTable objects // Created: 9.96 // RCS-ID: $Id$ // Copyright: (c) 1996 Remstar International, Inc. @@ -31,8 +31,8 @@ // Use this line for wxWindows v1.x //#include "wx_ver.h" // Use this line for wxWindows v2.x -#include "wx/version.h" #include "wx/wxprec.h" +#include "wx/version.h" #if wxMAJOR_VERSION == 2 # ifdef __GNUG__ @@ -44,6 +44,7 @@ #include "wx/ioswrap.h" #endif + #ifdef __BORLANDC__ #pragma hdrstop #endif //__BORLANDC__ @@ -71,6 +72,7 @@ # define wxUSE_ODBC 1 #endif + #if wxUSE_ODBC #include <stdio.h> @@ -103,11 +105,11 @@ ULONG lastTableID = 0; #endif -/********** wxTable::wxTable() **********/ -wxTable::wxTable(wxDB *pwxDB, const char *tblName, const int nCols, +/********** wxDbTable::wxDbTable() **********/ +wxDbTable::wxDbTable(wxDb *pwxDb, const char *tblName, const int nCols, const char *qryTblName, bool qryOnly, const char *tblPath) { - pDb = pwxDB; // Pointer to the wxDB object + pDb = pwxDb; // Pointer to the wxDb object henv = 0; hdbc = 0; hstmt = 0; @@ -120,11 +122,12 @@ wxTable::wxTable(wxDB *pwxDB, const char *tblName, const int nCols, colDefs = 0; tableID = 0; noCols = nCols; // No. of cols in the table - where = 0; // Where clause - orderBy = 0; // Order By clause - from = 0; // From clause + where = ""; // Where clause + orderBy = ""; // Order By clause + from = ""; // From clause selectForUpdate = FALSE; // SELECT ... FOR UPDATE; Indicates whether to include the FOR UPDATE phrase queryOnly = qryOnly; + insertable = TRUE; assert (tblName); @@ -140,11 +143,11 @@ wxTable::wxTable(wxDB *pwxDB, const char *tblName, const int nCols, if (!pDb) return; - pDb->nTables++; + pDb->incrementTableCount(); wxString s; tableID = ++lastTableID; - s.sprintf("wxTable constructor (%-20s) tableID:[%6lu] pDb:[%p]", tblName,tableID,pDb); + s.sprintf("wxDbTable constructor (%-20s) tableID:[%6lu] pDb:[%p]", tblName,tableID,pDb); #ifdef __WXDEBUG__ wxTablesInUse *tableInUse; @@ -155,15 +158,15 @@ wxTable::wxTable(wxDB *pwxDB, const char *tblName, const int nCols, TablesInUse.Append(tableInUse); #endif - pDb->WriteSqlLog(s.GetData()); + pDb->WriteSqlLog(s.c_str()); - // Grab the HENV and HDBC from the wxDB object - henv = pDb->henv; - hdbc = pDb->hdbc; + // Grab the HENV and HDBC from the wxDb object + henv = pDb->GetHENV(); + hdbc = pDb->GetHDBC(); // Allocate space for column definitions if (noCols) - colDefs = new wxColDef[noCols]; // Points to the first column defintion + colDefs = new wxDbColDef[noCols]; // Points to the first column defintion // Allocate statement handles for the table if (!queryOnly) @@ -184,38 +187,53 @@ wxTable::wxTable(wxDB *pwxDB, const char *tblName, const int nCols, // Set the cursor type for the statement handles cursorType = SQL_CURSOR_STATIC; + if (SQLSetStmtOption(hstmtInternal, SQL_CURSOR_TYPE, cursorType) != SQL_SUCCESS) - { + { // Check to see if cursor type is supported pDb->GetNextError(henv, hdbc, hstmtInternal); if (! wxStrcmp(pDb->sqlState, "01S02")) // Option Value Changed - { + { + // Datasource does not support static cursors. Driver // will substitute a cursor type. Call SQLGetStmtOption() // to determine which cursor type was selected. if (SQLGetStmtOption(hstmtInternal, SQL_CURSOR_TYPE, &cursorType) != SQL_SUCCESS) - pDb->DispAllErrors(henv, hdbc, hstmtInternal); + pDb->DispAllErrors(henv, hdbc, hstmtInternal); #ifdef DBDEBUG_CONSOLE cout << "Static cursor changed to: "; switch(cursorType) - { - case SQL_CURSOR_FORWARD_ONLY: + { + case SQL_CURSOR_FORWARD_ONLY: cout << "Forward Only"; break; - case SQL_CURSOR_STATIC: + case SQL_CURSOR_STATIC: cout << "Static"; break; - case SQL_CURSOR_KEYSET_DRIVEN: + case SQL_CURSOR_KEYSET_DRIVEN: cout << "Keyset Driven"; break; - case SQL_CURSOR_DYNAMIC: + case SQL_CURSOR_DYNAMIC: cout << "Dynamic"; break; - } + } cout << endl << endl; #endif - } - else - { + + // BJO20000425 + if (pDb->FwdOnlyCursors() && cursorType != SQL_CURSOR_FORWARD_ONLY) + { + // Force the use of a forward only cursor... + cursorType = SQL_CURSOR_FORWARD_ONLY; + if (SQLSetStmtOption(hstmtInternal, SQL_CURSOR_TYPE, cursorType) != SQL_SUCCESS) + { + // Should never happen + pDb->GetNextError(henv, hdbc, hstmtInternal); + return; + } + } + } + else + { pDb->DispNextError(); pDb->DispAllErrors(henv, hdbc, hstmtInternal); - } + } } #ifdef DBDEBUG_CONSOLE else @@ -236,21 +254,21 @@ wxTable::wxTable(wxDB *pwxDB, const char *tblName, const int nCols, } // Make the default cursor the active cursor - hstmtDefault = NewCursor(FALSE,FALSE); + hstmtDefault = GetNewCursor(FALSE,FALSE); assert(hstmtDefault); hstmt = *hstmtDefault; -} // wxTable::wxTable() +} // wxDbTable::wxDbTable() -/********** wxTable::~wxTable() **********/ -wxTable::~wxTable() +/********** wxDbTable::~wxDbTable() **********/ +wxDbTable::~wxDbTable() { wxString s; if (pDb) { - s.sprintf("wxTable destructor (%-20s) tableID:[%6lu] pDb:[%p]", tableName,tableID,pDb); - pDb->WriteSqlLog(s.GetData()); + s.sprintf("wxDbTable destructor (%-20s) tableID:[%6lu] pDb:[%p]", tableName,tableID,pDb); + pDb->WriteSqlLog(s.c_str()); } #ifdef __WXDEBUG__ @@ -267,7 +285,7 @@ wxTable::~wxTable() { found = TRUE; if (!TablesInUse.DeleteNode(pNode)) - wxLogDebug (s.GetData(),"Unable to delete node!"); + wxLogDebug (s.c_str(),wxT("Unable to delete node!")); } else pNode = pNode->Next(); @@ -275,17 +293,15 @@ wxTable::~wxTable() if (!found) { wxString msg; - msg.sprintf("Unable to find the tableID in the linked\nlist of tables in use.\n\n%s",s.GetData()); - wxLogDebug (msg.GetData(),"NOTICE..."); + msg.sprintf(wxT("Unable to find the tableID in the linked\nlist of tables in use.\n\n%s"),s.c_str()); + wxLogDebug (msg.c_str(),wxT("NOTICE...")); } } #endif - - - // Decrement the wxDB table count + // Decrement the wxDb table count if (pDb) - pDb->nTables--; + pDb->decrementTableCount(); // Delete memory allocated for column definitions if (colDefs) @@ -318,7 +334,7 @@ wxTable::~wxTable() DeleteCursor(hstmtCount); -} // wxTable::~wxTable() +} // wxDbTable::~wxDbTable() @@ -326,8 +342,8 @@ wxTable::~wxTable() -/********** wxTable::bindInsertParams() **********/ -bool wxTable::bindInsertParams(void) +/********** wxDbTable::bindInsertParams() **********/ +bool wxDbTable::bindInsertParams(void) { assert(!queryOnly); if (queryOnly) @@ -345,22 +361,23 @@ bool wxTable::bindInsertParams(void) continue; switch(colDefs[i].DbDataType) { + case DB_DATA_TYPE_VARCHAR: - fSqlType = pDb->typeInfVarchar.FsqlType; + fSqlType = pDb->GetTypeInfVarchar().FsqlType; precision = colDefs[i].SzDataObj; scale = 0; colDefs[i].CbValue = SQL_NTS; break; case DB_DATA_TYPE_INTEGER: - fSqlType = pDb->typeInfInteger.FsqlType; - precision = pDb->typeInfInteger.Precision; + fSqlType = pDb->GetTypeInfInteger().FsqlType; + precision = pDb->GetTypeInfInteger().Precision; scale = 0; colDefs[i].CbValue = 0; break; case DB_DATA_TYPE_FLOAT: - fSqlType = pDb->typeInfFloat.FsqlType; - precision = pDb->typeInfFloat.Precision; - scale = pDb->typeInfFloat.MaximumScale; + fSqlType = pDb->GetTypeInfFloat().FsqlType; + precision = pDb->GetTypeInfFloat().Precision; + scale = pDb->GetTypeInfFloat().MaximumScale; // SQL Sybase Anywhere v5.5 returned a negative number for the // MaxScale. This caused ODBC to kick out an error on ibscale. // I check for this here and set the scale = precision. @@ -369,8 +386,8 @@ bool wxTable::bindInsertParams(void) colDefs[i].CbValue = 0; break; case DB_DATA_TYPE_DATE: - fSqlType = pDb->typeInfDate.FsqlType; - precision = pDb->typeInfDate.Precision; + fSqlType = pDb->GetTypeInfDate().FsqlType; + precision = pDb->GetTypeInfDate().Precision; scale = 0; colDefs[i].CbValue = 0; break; @@ -381,20 +398,21 @@ bool wxTable::bindInsertParams(void) colDefs[i].CbValue = SQL_NULL_DATA; colDefs[i].Null = FALSE; } - if (SQLBindParameter(hstmtInsert, colNo++, SQL_PARAM_INPUT, colDefs[i].SqlCtype, - fSqlType, precision, scale, (UCHAR*) colDefs[i].PtrDataObj, - precision+1,&colDefs[i].CbValue) != SQL_SUCCESS) - return(pDb->DispAllErrors(henv, hdbc, hstmtInsert)); + + if (SQLBindParameter(hstmtInsert, colNo++, SQL_PARAM_INPUT, colDefs[i].SqlCtype, + fSqlType, precision, scale, (UCHAR*) colDefs[i].PtrDataObj, + precision+1,&colDefs[i].CbValue) != SQL_SUCCESS) + return(pDb->DispAllErrors(henv, hdbc, hstmtInsert)); } // Completed successfully return(TRUE); -} // wxTable::bindInsertParams() +} // wxDbTable::bindInsertParams() -/********** wxTable::bindUpdateParams() **********/ -bool wxTable::bindUpdateParams(void) +/********** wxDbTable::bindUpdateParams() **********/ +bool wxDbTable::bindUpdateParams(void) { assert(!queryOnly); if (queryOnly) @@ -413,21 +431,21 @@ bool wxTable::bindUpdateParams(void) switch(colDefs[i].DbDataType) { case DB_DATA_TYPE_VARCHAR: - fSqlType = pDb->typeInfVarchar.FsqlType; + fSqlType = pDb->GetTypeInfVarchar().FsqlType; precision = colDefs[i].SzDataObj; scale = 0; colDefs[i].CbValue = SQL_NTS; break; case DB_DATA_TYPE_INTEGER: - fSqlType = pDb->typeInfInteger.FsqlType; - precision = pDb->typeInfInteger.Precision; + fSqlType = pDb->GetTypeInfInteger().FsqlType; + precision = pDb->GetTypeInfInteger().Precision; scale = 0; colDefs[i].CbValue = 0; break; case DB_DATA_TYPE_FLOAT: - fSqlType = pDb->typeInfFloat.FsqlType; - precision = pDb->typeInfFloat.Precision; - scale = pDb->typeInfFloat.MaximumScale; + fSqlType = pDb->GetTypeInfFloat().FsqlType; + precision = pDb->GetTypeInfFloat().Precision; + scale = pDb->GetTypeInfFloat().MaximumScale; // SQL Sybase Anywhere v5.5 returned a negative number for the // MaxScale. This caused ODBC to kick out an error on ibscale. // I check for this here and set the scale = precision. @@ -436,46 +454,47 @@ bool wxTable::bindUpdateParams(void) colDefs[i].CbValue = 0; break; case DB_DATA_TYPE_DATE: - fSqlType = pDb->typeInfDate.FsqlType; - precision = pDb->typeInfDate.Precision; + fSqlType = pDb->GetTypeInfDate().FsqlType; + precision = pDb->GetTypeInfDate().Precision; scale = 0; colDefs[i].CbValue = 0; break; } - if (SQLBindParameter(hstmtUpdate, colNo++, SQL_PARAM_INPUT, colDefs[i].SqlCtype, - fSqlType, precision, scale, (UCHAR*) colDefs[i].PtrDataObj, - precision+1, &colDefs[i].CbValue) != SQL_SUCCESS) - return(pDb->DispAllErrors(henv, hdbc, hstmtUpdate)); + + if (SQLBindParameter(hstmtUpdate, colNo++, SQL_PARAM_INPUT, colDefs[i].SqlCtype, + fSqlType, precision, scale, (UCHAR*) colDefs[i].PtrDataObj, + precision+1, &colDefs[i].CbValue) != SQL_SUCCESS) + return(pDb->DispAllErrors(henv, hdbc, hstmtUpdate)); } // Completed successfully return(TRUE); -} // wxTable::bindUpdateParams() +} // wxDbTable::bindUpdateParams() -/********** wxTable::bindCols() **********/ -bool wxTable::bindCols(HSTMT cursor) +/********** wxDbTable::bindCols() **********/ +bool wxDbTable::bindCols(HSTMT cursor) { static SDWORD cb; // Bind each column of the table to a memory address for fetching data int i; for (i = 0; i < noCols; i++) - { - if (SQLBindCol(cursor, i+1, colDefs[i].SqlCtype, (UCHAR*) colDefs[i].PtrDataObj, - colDefs[i].SzDataObj, &cb) != SQL_SUCCESS) - return(pDb->DispAllErrors(henv, hdbc, cursor)); - } + { + if (SQLBindCol(cursor, i+1, colDefs[i].SqlCtype, (UCHAR*) colDefs[i].PtrDataObj, + colDefs[i].SzDataObj, &cb) != SQL_SUCCESS) + return (pDb->DispAllErrors(henv, hdbc, cursor)); + } // Completed successfully return(TRUE); -} // wxTable::bindCols() +} // wxDbTable::bindCols() -/********** wxTable::getRec() **********/ -bool wxTable::getRec(UWORD fetchType) +/********** wxDbTable::getRec() **********/ +bool wxDbTable::getRec(UWORD fetchType) { RETCODE retcode; @@ -508,11 +527,11 @@ bool wxTable::getRec(UWORD fetchType) // Completed successfully return(TRUE); -} // wxTable::getRec() +} // wxDbTable::getRec() -/********** wxTable::execDelete() **********/ -bool wxTable::execDelete(const char *pSqlStmt) +/********** wxDbTable::execDelete() **********/ +bool wxDbTable::execDelete(const char *pSqlStmt) { // Execute the DELETE statement if (SQLExecDirect(hstmtDelete, (UCHAR FAR *) pSqlStmt, SQL_NTS) != SQL_SUCCESS) @@ -521,11 +540,11 @@ bool wxTable::execDelete(const char *pSqlStmt) // Record deleted successfully return(TRUE); -} // wxTable::execDelete() +} // wxDbTable::execDelete() -/********** wxTable::execUpdate() **********/ -bool wxTable::execUpdate(const char *pSqlStmt) +/********** wxDbTable::execUpdate() **********/ +bool wxDbTable::execUpdate(const char *pSqlStmt) { // Execute the UPDATE statement if (SQLExecDirect(hstmtUpdate, (UCHAR FAR *) pSqlStmt, SQL_NTS) != SQL_SUCCESS) @@ -534,12 +553,26 @@ bool wxTable::execUpdate(const char *pSqlStmt) // Record deleted successfully return(TRUE); -} // wxTable::execUpdate() +} // wxDbTable::execUpdate() -/********** wxTable::query() **********/ -bool wxTable::query(int queryType, bool forUpdate, bool distinct, char *pSqlStmt) +/********** wxDbTable::query() **********/ +bool wxDbTable::query(int queryType, bool forUpdate, bool distinct, const char *pSqlStmt) { + + + +/* SQLFreeStmt(hstmt, SQL_CLOSE); + if (SQLExecDirect(hstmt, (UCHAR FAR *) pSqlStmt, SQL_NTS) == SQL_SUCCESS) + return(TRUE); + else + { + pDb->DispAllErrors(henv, hdbc, hstmt); + return(FALSE); + } +*/ + + char sqlStmt[DB_MAX_STATEMENT_LEN]; // Set the selectForUpdate member variable @@ -552,36 +585,43 @@ bool wxTable::query(int queryType, bool forUpdate, bool distinct, char *pSqlStmt // Set the SQL SELECT string if (queryType != DB_SELECT_STATEMENT) // A select statement was not passed in, { // so generate a select statement. - GetSelectStmt(sqlStmt, queryType, distinct); + BuildSelectStmt(sqlStmt, queryType, distinct); pDb->WriteSqlLog(sqlStmt); - } + } else wxStrcpy(sqlStmt, pSqlStmt); + + SQLFreeStmt(hstmt, SQL_CLOSE); + if (SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt, SQL_NTS) == SQL_SUCCESS) + return(TRUE); + else + { + pDb->DispAllErrors(henv, hdbc, hstmt); + return(FALSE); + } // Make sure the cursor is closed first if (! CloseCursor(hstmt)) - return(FALSE); + return(FALSE); // Execute the SQL SELECT statement - int retcode; - - retcode = SQLExecDirect(hstmt, (UCHAR FAR *) (queryType == DB_SELECT_STATEMENT ? pSqlStmt : sqlStmt), SQL_NTS); + int retcode; + retcode = SQLExecDirect(hstmt, (UCHAR FAR *) (queryType == DB_SELECT_STATEMENT ? pSqlStmt : sqlStmt), SQL_NTS); if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) - return(pDb->DispAllErrors(henv, hdbc, hstmt)); + return(pDb->DispAllErrors(henv, hdbc, hstmt)); // Completed successfully return(TRUE); -} // wxTable::query() +} // wxDbTable::query() /***************************** PUBLIC FUNCTIONS *****************************/ -/********** wxTable::Open() **********/ -bool wxTable::Open(void) +/********** wxDbTable::Open() **********/ +bool wxDbTable::Open(void) { if (!pDb) - return FALSE; - + return FALSE; int i; wxString sqlStmt; @@ -590,30 +630,35 @@ bool wxTable::Open(void) { wxString s; if (wxStrcmp(tablePath,"")) - s.sprintf("Error opening '%s/%s'.\n",tablePath,tableName); + s.sprintf(wxT("Error opening '%s/%s'.\n"),tablePath,tableName); else - s.sprintf("Error opening '%s'.\n", tableName); + s.sprintf(wxT("Error opening '%s'.\n"), tableName); if (!pDb->TableExists(tableName,NULL,tablePath)) - s += "Table/view does not exist in the database.\n"; + s += wxT("Table/view does not exist in the database.\n"); else - s += "Current logged in user does not have sufficient privileges to access this table.\n"; - pDb->LogError(s.GetData()); + s += wxT("Current logged in user does not have sufficient privileges to access this table.\n"); + pDb->LogError(s.c_str()); return(FALSE); } // Bind the member variables for field exchange between - // the wxTable object and the ODBC record. + // the wxDbTable object and the ODBC record. if (!queryOnly) { + if (!bindInsertParams()) // Inserts return(FALSE); + if (!bindUpdateParams()) // Updates return(FALSE); + } if (!bindCols(*hstmtDefault)) // Selects return(FALSE); + if (!bindCols(hstmtInternal)) // Internal use only return(FALSE); + /* * Do NOT bind the hstmtCount cursor!!! */ @@ -634,6 +679,9 @@ bool wxTable::Open(void) } needComma = FALSE; sqlStmt += ") VALUES ("; + + int insertableCount = 0; + for (i = 0; i < noCols; i++) { if (! colDefs[i].InsertAllowed) @@ -642,113 +690,119 @@ bool wxTable::Open(void) sqlStmt += ","; sqlStmt += "?"; needComma = TRUE; + insertableCount++; } sqlStmt += ")"; // pDb->WriteSqlLog(sqlStmt); // Prepare the insert statement for execution - if (SQLPrepare(hstmtInsert, (UCHAR FAR *) sqlStmt.GetData(), SQL_NTS) != SQL_SUCCESS) - return(pDb->DispAllErrors(henv, hdbc, hstmtInsert)); + if (insertableCount) + { + if (SQLPrepare(hstmtInsert, (UCHAR FAR *) sqlStmt.c_str(), SQL_NTS) != SQL_SUCCESS) + return(pDb->DispAllErrors(henv, hdbc, hstmtInsert)); + } + else + insertable= FALSE; } // Completed successfully return(TRUE); -} // wxTable::Open() +} // wxDbTable::Open() -/********** wxTable::Query() **********/ -bool wxTable::Query(bool forUpdate, bool distinct) +/********** wxDbTable::Query() **********/ +bool wxDbTable::Query(bool forUpdate, bool distinct) { return(query(DB_SELECT_WHERE, forUpdate, distinct)); -} // wxTable::Query() +} // wxDbTable::Query() -/********** wxTable::QueryBySqlStmt() **********/ -bool wxTable::QueryBySqlStmt(char *pSqlStmt) +/********** wxDbTable::QueryBySqlStmt() **********/ +bool wxDbTable::QueryBySqlStmt(const char *pSqlStmt) { pDb->WriteSqlLog(pSqlStmt); return(query(DB_SELECT_STATEMENT, FALSE, FALSE, pSqlStmt)); -} // wxTable::QueryBySqlStmt() +} // wxDbTable::QueryBySqlStmt() -/********** wxTable::QueryMatching() **********/ -bool wxTable::QueryMatching(bool forUpdate, bool distinct) +/********** wxDbTable::QueryMatching() **********/ +bool wxDbTable::QueryMatching(bool forUpdate, bool distinct) { return(query(DB_SELECT_MATCHING, forUpdate, distinct)); -} // wxTable::QueryMatching() +} // wxDbTable::QueryMatching() -/********** wxTable::QueryOnKeyFields() **********/ -bool wxTable::QueryOnKeyFields(bool forUpdate, bool distinct) +/********** wxDbTable::QueryOnKeyFields() **********/ +bool wxDbTable::QueryOnKeyFields(bool forUpdate, bool distinct) { return(query(DB_SELECT_KEYFIELDS, forUpdate, distinct)); -} // wxTable::QueryOnKeyFields() +} // wxDbTable::QueryOnKeyFields() -/********** wxTable::GetPrev() **********/ -bool wxTable::GetPrev(void) +/********** wxDbTable::GetPrev() **********/ +bool wxDbTable::GetPrev(void) { if (pDb->FwdOnlyCursors()) { - wxFAIL_MSG(wxT("GetPrev()::Backward scrolling cursors are not enabled for this instance of wxTable")); + wxFAIL_MSG(wxT("GetPrev()::Backward scrolling cursors are not enabled for this instance of wxDbTable")); return FALSE; } else return(getRec(SQL_FETCH_PRIOR)); -} // wxTable::GetPrev() +} // wxDbTable::GetPrev() -/********** wxTable::operator-- **********/ -bool wxTable::operator--(int) +/********** wxDbTable::operator-- **********/ +bool wxDbTable::operator--(int) { if (pDb->FwdOnlyCursors()) { - wxFAIL_MSG(wxT("operator--:Backward scrolling cursors are not enabled for this instance of wxTable")); + wxFAIL_MSG(wxT("operator--:Backward scrolling cursors are not enabled for this instance of wxDbTable")); return FALSE; } else return(getRec(SQL_FETCH_PRIOR)); -} // wxTable::operator-- +} // wxDbTable::operator-- -/********** wxTable::GetFirst() **********/ -bool wxTable::GetFirst(void) +/********** wxDbTable::GetFirst() **********/ +bool wxDbTable::GetFirst(void) { if (pDb->FwdOnlyCursors()) { - wxFAIL_MSG(wxT("GetFirst():Backward scrolling cursors are not enabled for this instance of wxTable")); + wxFAIL_MSG(wxT("GetFirst():Backward scrolling cursors are not enabled for this instance of wxDbTable")); return FALSE; } else return(getRec(SQL_FETCH_FIRST)); -} // wxTable::GetFirst() +} // wxDbTable::GetFirst() -/********** wxTable::GetLast() **********/ -bool wxTable::GetLast(void) +/********** wxDbTable::GetLast() **********/ +bool wxDbTable::GetLast(void) { if (pDb->FwdOnlyCursors()) { - wxFAIL_MSG(wxT("GetLast()::Backward scrolling cursors are not enabled for this instance of wxTable")); + wxFAIL_MSG(wxT("GetLast()::Backward scrolling cursors are not enabled for this instance of wxDbTable")); return FALSE; } else return(getRec(SQL_FETCH_LAST)); -} // wxTable::GetLast() +} // wxDbTable::GetLast() -/********** wxTable::GetSelectStmt() **********/ -void wxTable::GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct) +/********** wxDbTable::BuildSelectStmt() **********/ +void wxDbTable::BuildSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct) { char whereClause[DB_MAX_WHERE_CLAUSE_LEN]; @@ -764,8 +818,13 @@ void wxTable::GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct) // Was a FROM clause specified to join tables to the base table? // Available for ::Query() only!!! bool appendFromClause = FALSE; +#if wxODBC_BACKWARD_COMPATABILITY if (typeOfSelect == DB_SELECT_WHERE && from && wxStrlen(from)) appendFromClause = TRUE; +#else + if (typeOfSelect == DB_SELECT_WHERE && from.Length()) + appendFromClause = TRUE; +#endif // Add the column list int i; @@ -817,14 +876,18 @@ void wxTable::GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct) switch(typeOfSelect) { case DB_SELECT_WHERE: +#if wxODBC_BACKWARD_COMPATABILITY if (where && wxStrlen(where)) // May not want a where clause!!! +#else + if (where.Length()) // May not want a where clause!!! +#endif { wxStrcat(pSqlStmt, " WHERE "); wxStrcat(pSqlStmt, where); } break; case DB_SELECT_KEYFIELDS: - GetWhereClause(whereClause, DB_WHERE_KEYFIELDS); + BuildWhereClause(whereClause, DB_WHERE_KEYFIELDS); if (wxStrlen(whereClause)) { wxStrcat(pSqlStmt, " WHERE "); @@ -832,7 +895,7 @@ void wxTable::GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct) } break; case DB_SELECT_MATCHING: - GetWhereClause(whereClause, DB_WHERE_MATCHING); + BuildWhereClause(whereClause, DB_WHERE_MATCHING); if (wxStrlen(whereClause)) { wxStrcat(pSqlStmt, " WHERE "); @@ -842,7 +905,11 @@ void wxTable::GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct) } // Append the ORDER BY clause +#if wxODBC_BACKWARD_COMPATABILITY if (orderBy && wxStrlen(orderBy)) +#else + if (orderBy.Length()) +#endif { wxStrcat(pSqlStmt, " ORDER BY "); wxStrcat(pSqlStmt, orderBy); @@ -854,11 +921,11 @@ void wxTable::GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct) if (selectForUpdate && CanSelectForUpdate()) wxStrcat(pSqlStmt, " FOR UPDATE"); -} // wxTable::GetSelectStmt() +} // wxDbTable::BuildSelectStmt() -/********** wxTable::GetRowNum() **********/ -UWORD wxTable::GetRowNum(void) +/********** wxDbTable::GetRowNum() **********/ +UWORD wxDbTable::GetRowNum(void) { UDWORD rowNum; @@ -871,11 +938,11 @@ UWORD wxTable::GetRowNum(void) // Completed successfully return((UWORD) rowNum); -} // wxTable::GetRowNum() +} // wxDbTable::GetRowNum() -/********** wxTable::CloseCursor() **********/ -bool wxTable::CloseCursor(HSTMT cursor) +/********** wxDbTable::CloseCursor() **********/ +bool wxDbTable::CloseCursor(HSTMT cursor) { if (SQLFreeStmt(cursor, SQL_CLOSE) != SQL_SUCCESS) return(pDb->DispAllErrors(henv, hdbc, cursor)); @@ -883,11 +950,11 @@ bool wxTable::CloseCursor(HSTMT cursor) // Completed successfully return(TRUE); -} // wxTable::CloseCursor() +} // wxDbTable::CloseCursor() -/********** wxTable::CreateTable() **********/ -bool wxTable::CreateTable(bool attemptDrop) +/********** wxDbTable::CreateTable() **********/ +bool wxDbTable::CreateTable(bool attemptDrop) { if (!pDb) return FALSE; @@ -950,13 +1017,13 @@ bool wxTable::CreateTable(bool attemptDrop) switch(colDefs[i].DbDataType) { case DB_DATA_TYPE_VARCHAR: - sqlStmt += pDb->typeInfVarchar.TypeName; break; + sqlStmt += pDb->GetTypeInfVarchar().TypeName; break; case DB_DATA_TYPE_INTEGER: - sqlStmt += pDb->typeInfInteger.TypeName; break; + sqlStmt += pDb->GetTypeInfInteger().TypeName; break; case DB_DATA_TYPE_FLOAT: - sqlStmt += pDb->typeInfFloat.TypeName; break; + sqlStmt += pDb->GetTypeInfFloat().TypeName; break; case DB_DATA_TYPE_DATE: - sqlStmt += pDb->typeInfDate.TypeName; break; + sqlStmt += pDb->GetTypeInfDate().TypeName; break; } // For varchars, append the size of the string if (colDefs[i].DbDataType == DB_DATA_TYPE_VARCHAR) @@ -966,7 +1033,7 @@ bool wxTable::CreateTable(bool attemptDrop) // wxStrcat(sqlStmt, itoa(colDefs[i].SzDataObj, s, 10)); // wxStrcat(sqlStmt, ")"); s.sprintf("(%d)", colDefs[i].SzDataObj); - sqlStmt += s.GetData(); + sqlStmt += s.c_str(); } if (pDb->Dbms() == dbmsSYBASE_ASE || pDb->Dbms() == dbmsMY_SQL) @@ -1017,14 +1084,14 @@ bool wxTable::CreateTable(bool attemptDrop) // Append the closing parentheses for the create table statement sqlStmt += ")"; - pDb->WriteSqlLog(sqlStmt.GetData()); + pDb->WriteSqlLog(sqlStmt.c_str()); #ifdef DBDEBUG_CONSOLE - cout << endl << sqlStmt.GetData() << endl; + cout << endl << sqlStmt.c_str() << endl; #endif // Execute the CREATE TABLE statement - RETCODE retcode = SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.GetData(), SQL_NTS); + RETCODE retcode = SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.c_str(), SQL_NTS); if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) { pDb->DispAllErrors(henv, hdbc, hstmt); @@ -1042,11 +1109,11 @@ bool wxTable::CreateTable(bool attemptDrop) // Database table created successfully return(TRUE); -} // wxTable::CreateTable() +} // wxDbTable::CreateTable() -/********** wxTable::DropTable() **********/ -bool wxTable::DropTable() +/********** wxDbTable::DropTable() **********/ +bool wxDbTable::DropTable() { // NOTE: This function returns TRUE if the Table does not exist, but // only for identified databases. Code will need to be added @@ -1057,22 +1124,22 @@ bool wxTable::DropTable() sqlStmt.sprintf("DROP TABLE %s", tableName); - pDb->WriteSqlLog(sqlStmt.GetData()); + pDb->WriteSqlLog(sqlStmt.c_str()); #ifdef DBDEBUG_CONSOLE - cout << endl << sqlStmt.GetData() << endl; + cout << endl << sqlStmt.c_str() << endl; #endif - if (SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.GetData(), SQL_NTS) != SQL_SUCCESS) + if (SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.c_str(), SQL_NTS) != SQL_SUCCESS) { // Check for "Base table not found" error and ignore - pDb->GetNextError(henv, hdbc, hstmt); - if (wxStrcmp(pDb->sqlState,"S0002")) // "Base table not found" - { + pDb->GetNextError(henv, hdbc, hstmt); + if (wxStrcmp(pDb->sqlState,"S0002") && wxStrcmp(pDb->sqlState, "S1000")) // "Base table not found" + { // Check for product specific error codes - if (!((pDb->Dbms() == dbmsSYBASE_ASA && !wxStrcmp(pDb->sqlState,"42000")) || // 5.x (and lower?) - (pDb->Dbms() == dbmsMY_SQL && !wxStrcmp(pDb->sqlState,"S1000")) || // untested - (pDb->Dbms() == dbmsPOSTGRES && !wxStrcmp(pDb->sqlState,"08S01")))) // untested + if (!((pDb->Dbms() == dbmsSYBASE_ASA && !wxStrcmp(pDb->sqlState,"42000")) || // 5.x (and lower?) + (pDb->Dbms() == dbmsSYBASE_ASE && !wxStrcmp(pDb->sqlState,"37000")) || + (pDb->Dbms() == dbmsPOSTGRES && !wxStrcmp(pDb->sqlState,"08S01")))) { pDb->DispNextError(); pDb->DispAllErrors(henv, hdbc, hstmt); @@ -1090,11 +1157,11 @@ bool wxTable::DropTable() return(FALSE); return(TRUE); -} // wxTable::DropTable() +} // wxDbTable::DropTable() -/********** wxTable::CreateIndex() **********/ -bool wxTable::CreateIndex(const char * idxName, bool unique, int noIdxCols, wxIdxDef *pIdxDefs, bool attemptDrop) +/********** wxDbTable::CreateIndex() **********/ +bool wxDbTable::CreateIndex(const char * idxName, bool unique, int noIdxCols, wxDbIdxDef *pIdxDefs, bool attemptDrop) { // char sqlStmt[DB_MAX_STATEMENT_LEN]; wxString sqlStmt; @@ -1135,14 +1202,14 @@ bool wxTable::CreateIndex(const char * idxName, bool unique, int noIdxCols, wxId // Append closing parentheses sqlStmt += ")"; - pDb->WriteSqlLog(sqlStmt.GetData()); + pDb->WriteSqlLog(sqlStmt.c_str()); #ifdef DBDEBUG_CONSOLE - cout << endl << sqlStmt.GetData() << endl << endl; + cout << endl << sqlStmt.c_str() << endl << endl; #endif // Execute the CREATE INDEX statement - if (SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.GetData(), SQL_NTS) != SQL_SUCCESS) + if (SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.c_str(), SQL_NTS) != SQL_SUCCESS) { pDb->DispAllErrors(henv, hdbc, hstmt); pDb->RollbackTrans(); @@ -1159,11 +1226,11 @@ bool wxTable::CreateIndex(const char * idxName, bool unique, int noIdxCols, wxId // Index Created Successfully return(TRUE); -} // wxTable::CreateIndex() +} // wxDbTable::CreateIndex() -/********** wxTable::DropIndex() **********/ -bool wxTable::DropIndex(const char * idxName) +/********** wxDbTable::DropIndex() **********/ +bool wxDbTable::DropIndex(const char * idxName) { // NOTE: This function returns TRUE if the Index does not exist, but // only for identified databases. Code will need to be added @@ -1179,23 +1246,26 @@ bool wxTable::DropIndex(const char * idxName) else sqlStmt.sprintf("DROP INDEX %s",idxName); - pDb->WriteSqlLog(sqlStmt.GetData()); + pDb->WriteSqlLog(sqlStmt.c_str()); #ifdef DBDEBUG_CONSOLE - cout << endl << sqlStmt.GetData() << endl; + cout << endl << sqlStmt.c_str() << endl; #endif - if (SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.GetData(), SQL_NTS) != SQL_SUCCESS) + if (SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.c_str(), SQL_NTS) != SQL_SUCCESS) { // Check for "Index not found" error and ignore pDb->GetNextError(henv, hdbc, hstmt); if (wxStrcmp(pDb->sqlState,"S0012")) // "Index not found" { // Check for product specific error codes - if (!((pDb->Dbms() == dbmsSYBASE_ASA && !wxStrcmp(pDb->sqlState,"42000")) || // v5.x (and lower?) - (pDb->Dbms() == dbmsSYBASE_ASE && !wxStrcmp(pDb->sqlState,"S0002")) || // Base table not found - (pDb->Dbms() == dbmsMY_SQL && !wxStrcmp(pDb->sqlState,"42S02")) // untested - )) + if (!((pDb->Dbms() == dbmsSYBASE_ASA && !wxStrcmp(pDb->sqlState,"42000")) || // v5.x (and lower?) + (pDb->Dbms() == dbmsSYBASE_ASE && !wxStrcmp(pDb->sqlState,"37000")) || + (pDb->Dbms() == dbmsMS_SQL_SERVER && !wxStrcmp(pDb->sqlState,"S1000")) || + (pDb->Dbms() == dbmsSYBASE_ASE && !wxStrcmp(pDb->sqlState,"S0002")) || // Base table not found + (pDb->Dbms() == dbmsMY_SQL && !wxStrcmp(pDb->sqlState,"42S02")) || // untested + (pDb->Dbms() == dbmsPOSTGRES && !wxStrcmp(pDb->sqlState,"08S01")) + )) { pDb->DispNextError(); pDb->DispAllErrors(henv, hdbc, hstmt); @@ -1213,14 +1283,14 @@ bool wxTable::DropIndex(const char * idxName) return(FALSE); return(TRUE); -} // wxTable::DropIndex() +} // wxDbTable::DropIndex() -/********** wxTable::Insert() **********/ -int wxTable::Insert(void) +/********** wxDbTable::Insert() **********/ +int wxDbTable::Insert(void) { assert(!queryOnly); - if (queryOnly) + if (queryOnly || !insertable) return(DB_FAILURE); bindInsertParams(); @@ -1245,11 +1315,11 @@ int wxTable::Insert(void) // Record inserted into the datasource successfully return(DB_SUCCESS); -} // wxTable::Insert() +} // wxDbTable::Insert() -/********** wxTable::Update() **********/ -bool wxTable::Update(void) +/********** wxDbTable::Update() **********/ +bool wxDbTable::Update(void) { assert(!queryOnly); if (queryOnly) @@ -1258,7 +1328,7 @@ bool wxTable::Update(void) char sqlStmt[DB_MAX_STATEMENT_LEN]; // Build the SQL UPDATE statement - GetUpdateStmt(sqlStmt, DB_UPD_KEYFIELDS); + BuildUpdateStmt(sqlStmt, DB_UPD_KEYFIELDS); pDb->WriteSqlLog(sqlStmt); @@ -1269,11 +1339,11 @@ bool wxTable::Update(void) // Execute the SQL UPDATE statement return(execUpdate(sqlStmt)); -} // wxTable::Update() +} // wxDbTable::Update() -/********** wxTable::Update(pSqlStmt) **********/ -bool wxTable::Update(const char *pSqlStmt) +/********** wxDbTable::Update(pSqlStmt) **********/ +bool wxDbTable::Update(const char *pSqlStmt) { assert(!queryOnly); if (queryOnly) @@ -1283,11 +1353,11 @@ bool wxTable::Update(const char *pSqlStmt) return(execUpdate(pSqlStmt)); -} // wxTable::Update(pSqlStmt) +} // wxDbTable::Update(pSqlStmt) -/********** wxTable::UpdateWhere() **********/ -bool wxTable::UpdateWhere(const char *pWhereClause) +/********** wxDbTable::UpdateWhere() **********/ +bool wxDbTable::UpdateWhere(const char *pWhereClause) { assert(!queryOnly); if (queryOnly) @@ -1296,7 +1366,7 @@ bool wxTable::UpdateWhere(const char *pWhereClause) char sqlStmt[DB_MAX_STATEMENT_LEN]; // Build the SQL UPDATE statement - GetUpdateStmt(sqlStmt, DB_UPD_WHERE, pWhereClause); + BuildUpdateStmt(sqlStmt, DB_UPD_WHERE, pWhereClause); pDb->WriteSqlLog(sqlStmt); @@ -1307,11 +1377,11 @@ bool wxTable::UpdateWhere(const char *pWhereClause) // Execute the SQL UPDATE statement return(execUpdate(sqlStmt)); -} // wxTable::UpdateWhere() +} // wxDbTable::UpdateWhere() -/********** wxTable::Delete() **********/ -bool wxTable::Delete(void) +/********** wxDbTable::Delete() **********/ +bool wxDbTable::Delete(void) { assert(!queryOnly); if (queryOnly) @@ -1320,18 +1390,18 @@ bool wxTable::Delete(void) char sqlStmt[DB_MAX_STATEMENT_LEN]; // Build the SQL DELETE statement - GetDeleteStmt(sqlStmt, DB_DEL_KEYFIELDS); + BuildDeleteStmt(sqlStmt, DB_DEL_KEYFIELDS); pDb->WriteSqlLog(sqlStmt); // Execute the SQL DELETE statement return(execDelete(sqlStmt)); -} // wxTable::Delete() +} // wxDbTable::Delete() -/********** wxTable::DeleteWhere() **********/ -bool wxTable::DeleteWhere(const char *pWhereClause) +/********** wxDbTable::DeleteWhere() **********/ +bool wxDbTable::DeleteWhere(const char *pWhereClause) { assert(!queryOnly); if (queryOnly) @@ -1340,18 +1410,18 @@ bool wxTable::DeleteWhere(const char *pWhereClause) char sqlStmt[DB_MAX_STATEMENT_LEN]; // Build the SQL DELETE statement - GetDeleteStmt(sqlStmt, DB_DEL_WHERE, pWhereClause); + BuildDeleteStmt(sqlStmt, DB_DEL_WHERE, pWhereClause); pDb->WriteSqlLog(sqlStmt); // Execute the SQL DELETE statement return(execDelete(sqlStmt)); -} // wxTable::DeleteWhere() +} // wxDbTable::DeleteWhere() -/********** wxTable::DeleteMatching() **********/ -bool wxTable::DeleteMatching(void) +/********** wxDbTable::DeleteMatching() **********/ +bool wxDbTable::DeleteMatching(void) { assert(!queryOnly); if (queryOnly) @@ -1360,18 +1430,18 @@ bool wxTable::DeleteMatching(void) char sqlStmt[DB_MAX_STATEMENT_LEN]; // Build the SQL DELETE statement - GetDeleteStmt(sqlStmt, DB_DEL_MATCHING); + BuildDeleteStmt(sqlStmt, DB_DEL_MATCHING); pDb->WriteSqlLog(sqlStmt); // Execute the SQL DELETE statement return(execDelete(sqlStmt)); -} // wxTable::DeleteMatching() +} // wxDbTable::DeleteMatching() -/********** wxTable::GetUpdateStmt() **********/ -void wxTable::GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause) +/********** wxDbTable::BuildUpdateStmt() **********/ +void wxDbTable::BuildUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause) { assert(!queryOnly); if (queryOnly) @@ -1410,12 +1480,12 @@ void wxTable::GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereCla if (CanUpdByROWID()) { SDWORD cb; - char rowid[ROWID_LEN]; + char rowid[wxDB_ROWID_LEN]; // Get the ROWID value. If not successful retreiving the ROWID, // simply fall down through the code and build the WHERE clause // based on the key fields. - if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS) + if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, wxDB_ROWID_LEN, &cb) == SQL_SUCCESS) { wxStrcat(pSqlStmt, "ROWID = '"); wxStrcat(pSqlStmt, rowid); @@ -1425,18 +1495,18 @@ void wxTable::GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereCla } // Unable to delete by ROWID, so build a WHERE // clause based on the keyfields. - GetWhereClause(whereClause, DB_WHERE_KEYFIELDS); + BuildWhereClause(whereClause, DB_WHERE_KEYFIELDS); wxStrcat(pSqlStmt, whereClause); break; case DB_UPD_WHERE: wxStrcat(pSqlStmt, pWhereClause); break; } -} // GetUpdateStmt() +} // BuildUpdateStmt() -/********** wxTable::GetDeleteStmt() **********/ -void wxTable::GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause) +/********** wxDbTable::BuildDeleteStmt() **********/ +void wxDbTable::BuildDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause) { assert(!queryOnly); if (queryOnly) @@ -1466,12 +1536,12 @@ void wxTable::GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereCla if (CanUpdByROWID()) { SDWORD cb; - char rowid[ROWID_LEN]; + char rowid[wxDB_ROWID_LEN]; // Get the ROWID value. If not successful retreiving the ROWID, // simply fall down through the code and build the WHERE clause // based on the key fields. - if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS) + if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, wxDB_ROWID_LEN, &cb) == SQL_SUCCESS) { wxStrcat(pSqlStmt, "ROWID = '"); wxStrcat(pSqlStmt, rowid); @@ -1481,26 +1551,26 @@ void wxTable::GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereCla } // Unable to delete by ROWID, so build a WHERE // clause based on the keyfields. - GetWhereClause(whereClause, DB_WHERE_KEYFIELDS); + BuildWhereClause(whereClause, DB_WHERE_KEYFIELDS); wxStrcat(pSqlStmt, whereClause); break; case DB_DEL_WHERE: wxStrcat(pSqlStmt, pWhereClause); break; case DB_DEL_MATCHING: - GetWhereClause(whereClause, DB_WHERE_MATCHING); + BuildWhereClause(whereClause, DB_WHERE_MATCHING); wxStrcat(pSqlStmt, whereClause); break; } -} // GetDeleteStmt() +} // BuildDeleteStmt() -/********** wxTable::GetWhereClause() **********/ -void wxTable::GetWhereClause(char *pWhereClause, int typeOfWhere, - const char *qualTableName, bool useLikeComparison) +/********** wxDbTable::BuildWhereClause() **********/ +void wxDbTable::BuildWhereClause(char *pWhereClause, int typeOfWhere, + const char *qualTableName, bool useLikeComparison) /* - * Note: GetWhereClause() currently ignores timestamp columns. + * Note: BuildWhereClause() currently ignores timestamp columns. * They are not included as part of the where clause. */ { @@ -1561,11 +1631,11 @@ void wxTable::GetWhereClause(char *pWhereClause, int typeOfWhere, wxStrcat(pWhereClause, colValue); } } -} // wxTable::GetWhereClause() +} // wxDbTable::BuildWhereClause() -/********** wxTable::IsColNull() **********/ -bool wxTable::IsColNull(int colNo) +/********** wxDbTable::IsColNull() **********/ +bool wxDbTable::IsColNull(int colNo) { switch(colDefs[colNo].SqlCtype) { @@ -1593,11 +1663,11 @@ bool wxTable::IsColNull(int colNo) default: return(TRUE); } -} // wxTable::IsColNull() +} // wxDbTable::IsColNull() -/********** wxTable::CanSelectForUpdate() **********/ -bool wxTable::CanSelectForUpdate(void) +/********** wxDbTable::CanSelectForUpdate() **********/ +bool wxDbTable::CanSelectForUpdate(void) { if (pDb->Dbms() == dbmsMY_SQL) return FALSE; @@ -1607,11 +1677,11 @@ bool wxTable::CanSelectForUpdate(void) else return(FALSE); -} // wxTable::CanSelectForUpdate() +} // wxDbTable::CanSelectForUpdate() -/********** wxTable::CanUpdByROWID() **********/ -bool wxTable::CanUpdByROWID(void) +/********** wxDbTable::CanUpdByROWID() **********/ +bool wxDbTable::CanUpdByROWID(void) { /* * NOTE: Returning FALSE for now until this can be debugged, @@ -1624,22 +1694,22 @@ bool wxTable::CanUpdByROWID(void) else return(FALSE); -} // wxTable::CanUpdByROWID() +} // wxDbTable::CanUpdByROWID() -/********** wxTable::IsCursorClosedOnCommit() **********/ -bool wxTable::IsCursorClosedOnCommit(void) +/********** wxDbTable::IsCursorClosedOnCommit() **********/ +bool wxDbTable::IsCursorClosedOnCommit(void) { if (pDb->dbInf.cursorCommitBehavior == SQL_CB_PRESERVE) return(FALSE); else return(TRUE); -} // wxTable::IsCursorClosedOnCommit() +} // wxDbTable::IsCursorClosedOnCommit() -/********** wxTable::ClearMemberVars() **********/ -void wxTable::ClearMemberVars(void) +/********** wxDbTable::ClearMemberVars() **********/ +void wxDbTable::ClearMemberVars(void) { // Loop through the columns setting each member variable to zero int i; @@ -1683,11 +1753,11 @@ void wxTable::ClearMemberVars(void) } } -} // wxTable::ClearMemberVars() +} // wxDbTable::ClearMemberVars() -/********** wxTable::SetQueryTimeout() **********/ -bool wxTable::SetQueryTimeout(UDWORD nSeconds) +/********** wxDbTable::SetQueryTimeout() **********/ +bool wxDbTable::SetQueryTimeout(UDWORD nSeconds) { if (SQLSetStmtOption(hstmtInsert, SQL_QUERY_TIMEOUT, nSeconds) != SQL_SUCCESS) return(pDb->DispAllErrors(henv, hdbc, hstmtInsert)); @@ -1701,11 +1771,11 @@ bool wxTable::SetQueryTimeout(UDWORD nSeconds) // Completed Successfully return(TRUE); -} // wxTable::SetQueryTimeout() +} // wxDbTable::SetQueryTimeout() -/********** wxTable::SetColDefs() **********/ -void wxTable::SetColDefs (int index, const char *fieldName, int dataType, void *pData, +/********** wxDbTable::SetColDefs() **********/ +void wxDbTable::SetColDefs (int index, const char *fieldName, int dataType, void *pData, int cType, int size, bool keyField, bool upd, bool insAllow, bool derivedCol) { @@ -1740,21 +1810,21 @@ void wxTable::SetColDefs (int index, const char *fieldName, int dataType, void * colDefs[index].Null = FALSE; -} // wxTable::SetColDefs() +} // wxDbTable::SetColDefs() -/********** wxTable::SetColDef() **********/ -wxColDataPtr* wxTable::SetColDefs (wxColInf *pColInfs, ULONG numCols) +/********** wxDbTable::SetColDef() **********/ +wxDbColDataPtr* wxDbTable::SetColDefs (wxDbColInf *pColInfs, ULONG numCols) { assert(pColInfs); - wxColDataPtr *pColDataPtrs = NULL; + wxDbColDataPtr *pColDataPtrs = NULL; if (pColInfs) { ULONG index; - pColDataPtrs = new wxColDataPtr[numCols+1]; + pColDataPtrs = new wxDbColDataPtr[numCols+1]; for (index = 0; index < numCols; index++) { @@ -1815,22 +1885,22 @@ wxColDataPtr* wxTable::SetColDefs (wxColInf *pColInfs, ULONG numCols) } } return (pColDataPtrs); -} // wxTable::SetColDef() +} // wxDbTable::SetColDef() -/********** wxTable::SetCursor() **********/ -void wxTable::SetCursor(HSTMT *hstmtActivate) +/********** wxDbTable::SetCursor() **********/ +void wxDbTable::SetCursor(HSTMT *hstmtActivate) { - if (hstmtActivate == DEFAULT_CURSOR) + if (hstmtActivate == wxDB_DEFAULT_CURSOR) hstmt = *hstmtDefault; else hstmt = *hstmtActivate; -} // wxTable::SetCursor() +} // wxDbTable::SetCursor() -/********** wxTable::Count(const char *) **********/ -ULONG wxTable::Count(const char *args) +/********** wxDbTable::Count(const char *) **********/ +ULONG wxDbTable::Count(const char *args) { ULONG l; wxString sqlStmt; @@ -1841,30 +1911,37 @@ ULONG wxTable::Count(const char *args) sqlStmt += args; sqlStmt += ") FROM "; sqlStmt += queryTableName; - +#if wxODBC_BACKWARD_COMPATABILITY if (from && wxStrlen(from)) +#else + if (from.Length()) +#endif sqlStmt += from; // Add the where clause if one is provided +#if wxODBC_BACKWARD_COMPATABILITY if (where && wxStrlen(where)) +#else + if (where.Length()) +#endif { sqlStmt += " WHERE "; sqlStmt += where; } - pDb->WriteSqlLog(sqlStmt.GetData()); + pDb->WriteSqlLog(sqlStmt.c_str()); // Initialize the Count cursor if it's not already initialized if (!hstmtCount) { - hstmtCount = NewCursor(FALSE,FALSE); + hstmtCount = GetNewCursor(FALSE,FALSE); assert(hstmtCount); if (!hstmtCount) return(0); } // Execute the SQL statement - if (SQLExecDirect(*hstmtCount, (UCHAR FAR *) sqlStmt.GetData(), SQL_NTS) != SQL_SUCCESS) + if (SQLExecDirect(*hstmtCount, (UCHAR FAR *) sqlStmt.c_str(), SQL_NTS) != SQL_SUCCESS) { pDb->DispAllErrors(henv, hdbc, *hstmtCount); return(0); @@ -1891,22 +1968,25 @@ ULONG wxTable::Count(const char *args) // Return the record count return(l); -} // wxTable::Count() +} // wxDbTable::Count() -/********** wxTable::Refresh() **********/ -bool wxTable::Refresh(void) +/********** wxDbTable::Refresh() **********/ +bool wxDbTable::Refresh(void) { bool result = TRUE; // Switch to the internal cursor so any active cursors are not corrupted HSTMT currCursor = GetCursor(); hstmt = hstmtInternal; - +#if wxODBC_BACKWARD_COMPATABILITY // Save the where and order by clauses char *saveWhere = where; char *saveOrderBy = orderBy; - +#else + wxString saveWhere = where; + wxString saveOrderBy = orderBy; +#endif // Build a where clause to refetch the record with. Try and use the // ROWID if it's available, ow use the key fields. char whereClause[DB_MAX_WHERE_CLAUSE_LEN+1]; @@ -1914,12 +1994,12 @@ bool wxTable::Refresh(void) if (CanUpdByROWID()) { SDWORD cb; - char rowid[ROWID_LEN+1]; + char rowid[wxDB_ROWID_LEN+1]; // Get the ROWID value. If not successful retreiving the ROWID, // simply fall down through the code and build the WHERE clause // based on the key fields. - if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS) + if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, wxDB_ROWID_LEN, &cb) == SQL_SUCCESS) { wxStrcat(whereClause, queryTableName); wxStrcat(whereClause, ".ROWID = '"); @@ -1930,11 +2010,11 @@ bool wxTable::Refresh(void) // If unable to use the ROWID, build a where clause from the keyfields if (wxStrlen(whereClause) == 0) - GetWhereClause(whereClause, DB_WHERE_KEYFIELDS, queryTableName); + BuildWhereClause(whereClause, DB_WHERE_KEYFIELDS, queryTableName); // Requery the record where = whereClause; - orderBy = 0; + orderBy = ""; if (!Query()) result = FALSE; @@ -1954,22 +2034,22 @@ bool wxTable::Refresh(void) return(result); -} // wxTable::Refresh() +} // wxDbTable::Refresh() -/********** wxTable::SetNull(int colNo) **********/ -bool wxTable::SetNull(int colNo) +/********** wxDbTable::SetNull(int colNo) **********/ +bool wxDbTable::SetNull(int colNo) { if (colNo < noCols) return(colDefs[colNo].Null = TRUE); else return(FALSE); -} // wxTable::SetNull(int colNo) +} // wxDbTable::SetNull(int colNo) -/********** wxTable::SetNull(char *colName) **********/ -bool wxTable::SetNull(const char *colName) +/********** wxDbTable::SetNull(char *colName) **********/ +bool wxDbTable::SetNull(const char *colName) { int i; for (i = 0; i < noCols; i++) @@ -1983,11 +2063,11 @@ bool wxTable::SetNull(const char *colName) else return(FALSE); -} // wxTable::SetNull(char *colName) +} // wxDbTable::SetNull(char *colName) -/********** wxTable::NewCursor() **********/ -HSTMT *wxTable::NewCursor(bool setCursor, bool bindColumns) +/********** wxDbTable::GetNewCursor() **********/ +HSTMT *wxDbTable::GetNewCursor(bool setCursor, bool bindColumns) { HSTMT *newHSTMT = new HSTMT; assert(newHSTMT); @@ -2022,11 +2102,11 @@ HSTMT *wxTable::NewCursor(bool setCursor, bool bindColumns) return(newHSTMT); -} // wxTable::NewCursor() +} // wxDbTable::GetNewCursor() -/********** wxTable::DeleteCursor() **********/ -bool wxTable::DeleteCursor(HSTMT *hstmtDel) +/********** wxDbTable::DeleteCursor() **********/ +bool wxDbTable::DeleteCursor(HSTMT *hstmtDel) { bool result = TRUE; @@ -2043,7 +2123,7 @@ bool wxTable::DeleteCursor(HSTMT *hstmtDel) return(result); -} // wxTable::DeleteCursor() +} // wxDbTable::DeleteCursor() #endif // wxUSE_ODBC diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 82fe581edb..d16c32fd0f 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -29,12 +29,14 @@ #endif #ifndef WX_PRECOMP + #include "wx/button.h" #include "wx/dialog.h" #include "wx/dcclient.h" #include "wx/intl.h" #include "wx/settings.h" #include "wx/stattext.h" #include "wx/sizer.h" + #include "wx/button.h" #endif //-------------------------------------------------------------------------- diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 538bb871f4..cf02ef0e08 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -130,6 +130,7 @@ wxDocument::wxDocument(wxDocument *parent) m_documentModified = FALSE; m_documentParent = parent; m_documentTemplate = (wxDocTemplate *) NULL; + m_commandProcessor = (wxCommandProcessor*) NULL; m_savedYet = FALSE; } @@ -145,7 +146,8 @@ wxDocument::~wxDocument() if (m_commandProcessor) delete m_commandProcessor; - GetDocumentManager()->RemoveDocument(this); + if (GetDocumentManager()) + GetDocumentManager()->RemoveDocument(this); // Not safe to do here, since it'll invoke virtual view functions // expecting to see valid derived objects: and by the time we get here, @@ -172,6 +174,8 @@ bool wxDocument::OnCloseDocument() // deleted. bool wxDocument::DeleteAllViews() { + wxDocManager* manager = GetDocumentManager(); + wxNode *node = m_documentViews.First(); while (node) { @@ -184,6 +188,11 @@ bool wxDocument::DeleteAllViews() delete view; // Deletes node implicitly node = next; } + // If we haven't yet deleted the document (for example + // if there were no views) then delete it. + if (manager && manager->GetDocuments().Member(this)) + delete this; + return TRUE; } @@ -196,7 +205,7 @@ wxView *wxDocument::GetFirstView() const wxDocManager *wxDocument::GetDocumentManager() const { - return m_documentTemplate->GetDocumentManager(); + return (m_documentTemplate ? m_documentTemplate->GetDocumentManager() : (wxDocManager*) NULL); } bool wxDocument::OnNewDocument() @@ -287,7 +296,7 @@ bool wxDocument::OnSaveDocument(const wxString& file) msgTitle = wxString(_("File error")); #if wxUSE_STD_IOSTREAM - ofstream store(wxString(file.fn_str())); + ofstream store(wxString(file.fn_str()).mb_str()); if (store.fail() || store.bad()) #else wxFileOutputStream store(wxString(file.fn_str())); @@ -323,7 +332,7 @@ bool wxDocument::OnOpenDocument(const wxString& file) msgTitle = wxString(_("File error")); #if wxUSE_STD_IOSTREAM - ifstream store(wxString(file.fn_str())); + ifstream store(wxString(file.fn_str()).mb_str()); if (store.fail() || store.bad()) #else wxFileInputStream store(wxString(file.fn_str())); @@ -655,7 +664,8 @@ wxDocument *wxDocTemplate::CreateDocument(const wxString& path, long flags) return doc; else { - delete doc; + if (GetDocumentManager()->GetDocuments().Member(doc)) + doc->DeleteAllViews(); return (wxDocument *) NULL; } } @@ -1096,7 +1106,8 @@ wxDocument *wxDocManager::CreateDocument(const wxString& path, long flags) newDoc->SetDocumentTemplate(temp); if (!newDoc->OnOpenDocument(path2)) { - delete newDoc; + newDoc->DeleteAllViews(); + // delete newDoc; // Implicitly deleted by DeleteAllViews return (wxDocument *) NULL; } AddFileToHistory(path2); @@ -1294,6 +1305,28 @@ wxDocTemplate *wxDocManager::FindTemplateForPath(const wxString& path) return theTemplate; } +// Try to get a more suitable parent frame than the top window, +// for selection dialogs. Otherwise you may get an unexpected +// window being activated when a dialog is shown. +static wxWindow* wxFindSuitableParent() +{ + wxWindow* parent = wxTheApp->GetTopWindow(); + + wxWindow* focusWindow = wxWindow::FindFocus(); + if (focusWindow) + { + while (focusWindow && + !focusWindow->IsKindOf(CLASSINFO(wxDialog)) && + !focusWindow->IsKindOf(CLASSINFO(wxFrame))) + + focusWindow = focusWindow->GetParent(); + + if (focusWindow) + parent = focusWindow; + } + return parent; +} + // Prompts user to open a file, using file specs in templates. // How to implement in wxWindows? Must extend the file selector // dialog or implement own; OR match the extension to the @@ -1332,16 +1365,33 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, #endif int FilterIndex = 0; + + wxWindow* parent = wxFindSuitableParent(); + wxString pathTmp = wxFileSelectorEx(_("Select a file"), m_lastDirectory, wxT(""), &FilterIndex, descrBuf, 0, - wxTheApp->GetTopWindow()); + parent); if (!pathTmp.IsEmpty()) { + if (!wxFileExists(pathTmp)) + { + wxString msgTitle; + if (!wxTheApp->GetAppName().IsEmpty()) + msgTitle = wxTheApp->GetAppName(); + else + msgTitle = wxString(_("File error")); + + (void)wxMessageBox(_("Sorry, could not open this file."), msgTitle, wxOK | wxICON_EXCLAMATION, + parent); + + path = wxT(""); + return (wxDocTemplate *) NULL; + } m_lastDirectory = wxPathOnly(pathTmp); path = pathTmp; @@ -1414,8 +1464,10 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates, return temp; } + wxWindow* parent = wxFindSuitableParent(); + wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document template"), _("Templates"), n, - strings, (void **)data); + strings, (void **)data, parent); delete[] strings; delete[] data; return theTemplate; @@ -1437,8 +1489,10 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates, n ++; } } + wxWindow* parent = wxFindSuitableParent(); + wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document view"), _("Views"), n, - strings, (void **)data); + strings, (void **)data, parent); delete[] strings; delete[] data; return theTemplate; @@ -1619,8 +1673,7 @@ void wxDocParentFrame::OnMRUFile(wxCommandEvent& event) // about it m_docManager->RemoveFileFromHistory(n); - wxLogError(_("The file '%s' doesn't exist and couldn't be opened.\n" - "It has been also removed from the MRU files list."), + wxLogError(_("The file '%s' doesn't exist and couldn't be opened.\nIt has been also removed from the MRU files list."), filename.c_str()); } } @@ -2165,7 +2218,7 @@ bool wxTransferFileToStream(const wxString& filename, ostream& stream) FILE *fd1; int ch; - if ((fd1 = fopen (filename.fn_str(), "rb")) == NULL) + if ((fd1 = wxFopen (filename.fn_str(), _T("rb"))) == NULL) return FALSE; while ((ch = getc (fd1)) != EOF) @@ -2180,7 +2233,7 @@ bool wxTransferStreamToFile(istream& stream, const wxString& filename) FILE *fd1; int ch; - if ((fd1 = fopen (filename.fn_str(), "wb")) == NULL) + if ((fd1 = wxFopen (filename.fn_str(), _T("wb"))) == NULL) { return FALSE; } @@ -2200,7 +2253,7 @@ bool wxTransferFileToStream(const wxString& filename, wxOutputStream& stream) FILE *fd1; int ch; - if ((fd1 = fopen (filename.fn_str(), "rb")) == NULL) + if ((fd1 = wxFopen (filename.fn_str(), wxT("rb"))) == NULL) return FALSE; while ((ch = getc (fd1)) != EOF) @@ -2215,7 +2268,7 @@ bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename) FILE *fd1; char ch; - if ((fd1 = fopen (filename.fn_str(), "wb")) == NULL) + if ((fd1 = wxFopen (filename.fn_str(), wxT("wb"))) == NULL) { return FALSE; } diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index a156ad5931..cc41e9f693 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -22,15 +22,17 @@ #endif #include "wx/wxprec.h" -#if defined(__WINDOWS__) -#include "wx/msw/private.h" -#endif #ifdef __BORLANDC__ #pragma hdrstop #endif + #if wxUSE_DYNLIB_CLASS +#if defined(__WINDOWS__) + #include "wx/msw/private.h" +#endif + #include "wx/dynlib.h" #include "wx/filefn.h" #include "wx/intl.h" @@ -48,8 +50,8 @@ # define wxDllGetSymbol(handle, modaddr) DosQueryProcAddr(handle, 1L, NULL, (PFN*)modaddr) # define wxDllClose(handle) DosFreeModule(handle) #elif defined(HAVE_DLOPEN) -# define wxDllOpen(lib) dlopen(lib.fn_str(), RTLD_NOW|RTLD_GLOBAL/*RTLD_LAZY*/) -# define wxDllGetSymbol(handle, name) dlsym(handle, name.mb_str()) +# define wxDllOpen(lib) dlopen(lib.fn_str(), RTLD_NOW/*RTLD_LAZY*/) +# define wxDllGetSymbol(handle, name) dlsym(handle, name) # define wxDllClose dlclose #elif defined(HAVE_SHL_LOAD) # define wxDllOpen(lib) shl_load(lib.fn_str(), BIND_DEFERRED, 0) @@ -66,7 +68,11 @@ #elif defined(__WINDOWS__) // using LoadLibraryEx under Win32 to avoid name clash with LoadLibrary # ifdef __WIN32__ -# define wxDllOpen(lib) ::LoadLibraryEx(lib, 0, 0) +#ifdef _UNICODE +# define wxDllOpen(lib) ::LoadLibraryExW(lib, 0, 0) +#else +# define wxDllOpen(lib) ::LoadLibraryExA(lib, 0, 0) +#endif # else // Win16 # define wxDllOpen(lib) ::LoadLibrary(lib) # endif // Win32/16 @@ -82,33 +88,20 @@ wxLibraries wxTheLibraries; -// ---------------------------------------------------------------------------- -// private functions -// ---------------------------------------------------------------------------- +// ============================================================================ +// implementation +// ============================================================================ // construct the full name from the base shared object name: adds a .dll // suffix under Windows or .so under Unix static wxString ConstructLibraryName(const wxString& basename) { - wxString fullname(basename); - -#if defined(__WINDOWS__) || defined(__WXPM__) || defined(__EMX__) - fullname << ".dll"; -#elif defined(__UNIX__) -# if defined(__HPUX__) - fullname << ".sl"; -# else //__HPUX__ - fullname << ".so"; -# endif //__HPUX__ -#endif + wxString fullname; + fullname << basename << wxDllLoader::GetDllExt(); return fullname; } -// ============================================================================ -// implementation -// ============================================================================ - // --------------------------------------------------------------------------- // wxLibrary (one instance per dynamic library) @@ -178,6 +171,24 @@ void *wxLibrary::GetSymbol(const wxString& symbname) // wxDllLoader // --------------------------------------------------------------------------- +/* static */ +wxString wxDllLoader::GetDllExt() +{ + wxString ext; + +#if defined(__WINDOWS__) || defined(__WXPM__) || defined(__EMX__) + ext = _T(".dll"); +#elif defined(__UNIX__) +# if defined(__HPUX__) + ext = _T(".sl"); +# else //__HPUX__ + ext = _T(".so"); +# endif //__HPUX__ +#endif + + return ext; +} + /* static */ wxDllType wxDllLoader::GetProgramHandle(void) @@ -202,8 +213,8 @@ wxDllLoader::LoadLibrary(const wxString & libname, bool *success) #if defined(__WXMAC__) FSSpec myFSSpec ; - Ptr myMainAddr ; - Str255 myErrName ; + Ptr myMainAddr ; + Str255 myErrName ; wxMacPathToFSSpec( libname , &myFSSpec ) ; if (GetDiskFragment( &myFSSpec , 0 , kCFragGoesToEOF , "\p" , kPrivateCFragCopy , &handle , &myMainAddr , @@ -214,7 +225,7 @@ wxDllLoader::LoadLibrary(const wxString & libname, bool *success) return NULL ; } #elif defined(__WXPM__) || defined(__EMX__) - char zError[256] = ""; + char zError[256] = ""; wxDllOpen(zError, libname, handle); #else // !Mac handle = wxDllOpen(libname); @@ -222,7 +233,33 @@ wxDllLoader::LoadLibrary(const wxString & libname, bool *success) if ( !handle ) { - wxLogSysError(_("Failed to load shared library '%s'"), libname.c_str()); + wxString msg(_("Failed to load shared library '%s'")); + +#ifdef HAVE_DLERROR + const char *errmsg = dlerror(); + if ( errmsg ) + { + // the error string format is "libname: ...", but we already have + // libname, so cut it off + const char *p = strchr(errmsg, ':'); + if ( p ) + { + if ( *++p == ' ' ) + p++; + } + else + { + p = errmsg; + } + + msg += _T(" (%s)"); + wxLogError(msg, libname.c_str(), p); + } + else +#endif // HAVE_DLERROR + { + wxLogSysError(msg, libname.c_str()); + } } if ( success ) @@ -250,7 +287,7 @@ wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name) #if defined( __WXMAC__ ) Ptr symAddress ; CFragSymbolClass symClass ; - Str255 symName ; + Str255 symName ; strcpy( (char*) symName , name ) ; c2pstr( (char*) symName ) ; @@ -260,7 +297,8 @@ wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name) #elif defined( __WXPM__ ) || defined(__EMX__) wxDllGetSymbol(dllHandle, symbol); #else - symbol = wxDllGetSymbol(dllHandle, name); + // mb_str() is necessary in Unicode build + symbol = wxDllGetSymbol(dllHandle, name.mb_str()); #endif if ( !symbol ) diff --git a/src/common/encconv.cpp b/src/common/encconv.cpp index 3a5ce7faba..5336da7bf1 100644 --- a/src/common/encconv.cpp +++ b/src/common/encconv.cpp @@ -29,6 +29,11 @@ #include "unictabl.inc" #endif +#if wxUSE_WCHAR_T +typedef wchar_t tchar; +#else +typedef char tchar; +#endif static wxUint16* LINKAGEMODE GetEncTable(wxFontEncoding enc) { @@ -83,7 +88,7 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e if (m_Table) {delete[] m_Table; m_Table = NULL;} -#if !wxUSE_UNICODE +#if !wxUSE_WCHAR_T if (input_enc == wxFONTENCODING_UNICODE || output_enc == wxFONTENCODING_UNICODE) return FALSE; #endif @@ -96,19 +101,19 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e { if ((out_tbl = GetEncTable(output_enc)) == NULL) return FALSE; - m_Table = new wxChar[65536]; - for (i = 0; i < 128; i++) m_Table[i] = (wxChar)i; // 7bit ASCII - for (i = 128; i < 65536; i++) m_Table[i] = (wxChar)'?'; + m_Table = new tchar[65536]; + for (i = 0; i < 128; i++) m_Table[i] = (tchar)i; // 7bit ASCII + for (i = 128; i < 65536; i++) m_Table[i] = (tchar)'?'; // FIXME - this should be character that means `unicode to charset' impossible, not '?' if (method == wxCONVERT_SUBSTITUTE) { for (i = 0; i < encoding_unicode_fallback_count; i++) - m_Table[encoding_unicode_fallback[i].c] = (wxChar) encoding_unicode_fallback[i].s; + m_Table[encoding_unicode_fallback[i].c] = (tchar) encoding_unicode_fallback[i].s; } for (i = 0; i < 128; i++) - m_Table[out_tbl[i]] = (wxChar)(128 + i); + m_Table[out_tbl[i]] = (tchar)(128 + i); m_UnicodeInput = TRUE; return TRUE; @@ -122,12 +127,12 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e m_UnicodeInput = FALSE; - m_Table = new wxChar[256]; - for (i = 0; i < 128; i++) m_Table[i] = (wxChar)i; // 7bit ASCII + m_Table = new tchar[256]; + for (i = 0; i < 128; i++) m_Table[i] = (tchar)i; // 7bit ASCII if (output_enc == wxFONTENCODING_UNICODE) { - for (i = 0; i < 128; i++) m_Table[128 + i] = (wxChar)in_tbl[i]; // wxChar is 2byte now + for (i = 0; i < 128; i++) m_Table[128 + i] = (tchar)in_tbl[i]; return TRUE; } else @@ -143,7 +148,7 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e item = (CharsetItem*) bsearch(&key, encoding_unicode_fallback, encoding_unicode_fallback_count, sizeof(CharsetItem), CompareCharsetItems); if (item) - m_Table[128 + i] = (wxChar)item -> c; + m_Table[128 + i] = (tchar)item -> c; else m_Table[128 + i] = 128 + i; // don't know => don't touch } @@ -156,42 +161,42 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e -void wxEncodingConverter::Convert(const wxChar* input, wxChar* output) +void wxEncodingConverter::Convert(const char* input, char* output) { + wxASSERT_MSG(!m_UnicodeOutput, wxT("You cannot convert to unicode if output is const char*!")); + wxASSERT_MSG(!m_UnicodeInput, wxT("You cannot convert from unicode if input is const char*!")); + + const char *i; + char *o; + if (m_JustCopy) { - wxStrcpy(output, input); + strcpy(output, input); return; } wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); - - const wxChar *i; - wxChar *o; - - if (m_UnicodeInput) - for (i = input, o = output; *i != 0; i++, o++) - *o = (wxChar)(m_Table[(wxUint16)*i]); - else - for (i = input, o = output; *i != 0; i++, o++) - *o = (wxChar)(m_Table[(wxUint8)*i]); + + for (i = input, o = output; *i != 0;) + *(o++) = (char)(m_Table[(wxUint8)*(i++)]); *o = 0; } -#if wxUSE_UNICODE // otherwise wxChar === char +#if wxUSE_WCHAR_T -void wxEncodingConverter::Convert(const char* input, wxChar* output) +void wxEncodingConverter::Convert(const char* input, wchar_t* output) { + wxASSERT_MSG(m_UnicodeOutput, wxT("You cannot convert to 8-bit if output is const wchar_t*!")); wxASSERT_MSG(!m_UnicodeInput, wxT("You cannot convert from unicode if input is const char*!")); const char *i; - wxChar *o; + wchar_t *o; if (m_JustCopy) { for (i = input, o = output; *i != 0;) - *(o++) = (wxChar)(*(i++)); + *(o++) = (wchar_t)(*(i++)); *o = 0; return; } @@ -199,17 +204,18 @@ void wxEncodingConverter::Convert(const char* input, wxChar* output) wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); for (i = input, o = output; *i != 0;) - *(o++) = (wxChar)(m_Table[(wxUint8)*(i++)]); + *(o++) = (wchar_t)(m_Table[(wxUint8)*(i++)]); *o = 0; } -void wxEncodingConverter::Convert(const wxChar* input, char* output) +void wxEncodingConverter::Convert(const wchar_t* input, char* output) { wxASSERT_MSG(!m_UnicodeOutput, wxT("You cannot convert to unicode if output is const char*!")); + wxASSERT_MSG(m_UnicodeInput, wxT("You cannot convert from 8-bit if input is const wchar_t*!")); - const wxChar *i; + const wchar_t *i; char *o; if (m_JustCopy) @@ -222,39 +228,38 @@ void wxEncodingConverter::Convert(const wxChar* input, char* output) wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); - if (m_UnicodeInput) - for (i = input, o = output; *i != 0; i++, o++) - *o = (char)(m_Table[(wxUint16)*i]); - else - for (i = input, o = output; *i != 0; i++, o++) - *o = (char)(m_Table[(wxUint8)*i]); + for (i = input, o = output; *i != 0;) + *(o++) = (char)(m_Table[(wxUint16)*(i++)]); *o = 0; } -void wxEncodingConverter::Convert(const char* input, char* output) +void wxEncodingConverter::Convert(const wchar_t* input, wchar_t* output) { - wxASSERT_MSG(!m_UnicodeOutput, wxT("You cannot convert to unicode if output is const char*!")); - wxASSERT_MSG(!m_UnicodeInput, wxT("You cannot convert from unicode if input is const char*!")); + wxASSERT_MSG(m_UnicodeOutput, wxT("You cannot convert to 8-bit if output is const wchar_t*!")); + wxASSERT_MSG(m_UnicodeInput, wxT("You cannot convert from 8-bit if input is const wchar_t*!")); - const char *i; - char *o; + const wchar_t *i; + wchar_t *o; if (m_JustCopy) { - strcpy(output, input); + // wcscpy() is not guaranteed to exist + for (i = input, o = output; *i != 0;) + *(o++) = (*(i++)); + *o = 0; return; } wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!")); for (i = input, o = output; *i != 0;) - *(o++) = (char)(m_Table[(wxUint8)*(i++)]); + *(o++) = (wchar_t)(m_Table[(wxUint8)*(i++)]); *o = 0; } -#endif // wxUSE_UNICODE +#endif // wxUSE_WCHAR_T wxString wxEncodingConverter::Convert(const wxString& input) diff --git a/src/common/event.cpp b/src/common/event.cpp index 646b0b89c4..3ace246251 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -524,14 +524,12 @@ void wxQueryNewPaletteEvent::CopyObject(wxObject& obj_d) const } wxWindowCreateEvent::wxWindowCreateEvent(wxWindow *win) - : wxEvent() { SetEventType(wxEVT_CREATE); SetEventObject(win); } wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow *win) - : wxEvent() { SetEventType(wxEVT_DESTROY); SetEventObject(win); diff --git a/src/common/file.cpp b/src/common/file.cpp index 93598c8bb0..cd4f7c7a01 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -62,7 +62,6 @@ #endif #elif (defined(__WXPM__)) #include <io.h> - #include <direct.h> #define W_OK 2 #define R_OK 4 #elif (defined(__WXSTUBS__)) @@ -87,36 +86,6 @@ #include <sys/stat.h> // stat #endif -// Microsoft compiler loves underscores, feed them to it -#ifdef __VISUALC__ - // functions - #define open _open - #define close _close - #define read _read - #define write _write - #define lseek _lseek - #define fsync _commit - #define access _access - #define eof _eof - - // types - #define stat _stat - - // constants - - #define O_RDONLY _O_RDONLY - #define O_WRONLY _O_WRONLY - #define O_RDWR _O_RDWR - #define O_EXCL _O_EXCL - #define O_CREAT _O_CREAT - #define O_BINARY _O_BINARY - - #define S_IFDIR _S_IFDIR - #define S_IFREG _S_IFREG -#else - #define tell(fd) lseek(fd, 0, SEEK_CUR) -#endif // VC++ - #if defined(__BORLANDC__) || defined(_MSC_VER) #define W_OK 2 #define R_OK 4 @@ -132,12 +101,6 @@ #include <unix.h> #endif -// wxWindows -#include "wx/string.h" -#include "wx/intl.h" -#include "wx/file.h" -#include "wx/log.h" - #ifndef MAX_PATH #define MAX_PATH 512 #endif @@ -150,6 +113,12 @@ #define ACCESS(access) , (access) #endif // Salford C +// wxWindows +#include "wx/string.h" +#include "wx/intl.h" +#include "wx/file.h" +#include "wx/log.h" + // ============================================================================ // implementation of wxFile // ============================================================================ @@ -159,23 +128,23 @@ // ---------------------------------------------------------------------------- bool wxFile::Exists(const wxChar *name) { - struct stat st; + wxStructStat st; #if wxUSE_UNICODE && wxMBFILES wxCharBuffer fname = wxConvFile.cWC2MB(name); #ifdef __WXMAC__ return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG); #else - return !access(fname, 0) && - !stat(wxMBSTRINGCAST fname, &st) && + return !wxAccess(fname, 0) && + !wxStat(wxMBSTRINGCAST fname, &st) && (st.st_mode & S_IFREG); #endif #else #ifdef __WXMAC__ return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG); #else - return !access(name, 0) && - !stat((wxChar*) name, &st) && + return !wxAccess(name, 0) && + !wxStat(name, &st) && (st.st_mode & S_IFREG); #endif #endif @@ -198,7 +167,7 @@ bool wxFile::Access(const wxChar *name, OpenMode mode) wxFAIL_MSG(wxT("bad wxFile::Access mode parameter.")); } - return access(wxFNCONV(name), how) == 0; + return wxAccess(wxFNCONV(name), how) == 0; } // ---------------------------------------------------------------------------- @@ -222,10 +191,10 @@ bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode) #ifdef __WXMAC__ int fd = open(wxUnix2MacFilename( szFileName ), O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access); #else - int fd = open(wxFNCONV(szFileName), - O_BINARY | O_WRONLY | O_CREAT | - (bOverwrite ? O_TRUNC : O_EXCL) - ACCESS(accessMode)); + int fd = wxOpen(wxFNCONV(szFileName), + O_BINARY | O_WRONLY | O_CREAT | + (bOverwrite ? O_TRUNC : O_EXCL) + ACCESS(accessMode)); #endif if ( fd == -1 ) { wxLogSysError(_("can't create file '%s'"), szFileName); @@ -247,14 +216,19 @@ bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode) flags |= O_RDONLY; break; + case write_append: + if ( wxFile::Exists(szFileName) ) + { + flags |= O_WRONLY | O_APPEND; + break; + } + //else: fall through as write_append is the same as write if the + // file doesn't exist + case write: flags |= O_WRONLY | O_CREAT | O_TRUNC; break; - case write_append: - flags |= O_WRONLY | O_APPEND; - break; - case read_write: flags |= O_RDWR; break; @@ -263,7 +237,7 @@ bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode) #ifdef __WXMAC__ int fd = open(wxUnix2MacFilename( szFileName ), flags, access); #else - int fd = open(wxFNCONV(szFileName), flags ACCESS(accessMode)); + int fd = wxOpen(wxFNCONV(szFileName), flags ACCESS(accessMode)); #endif if ( fd == -1 ) { wxLogSysError(_("can't open file '%s'"), szFileName); @@ -337,7 +311,7 @@ bool wxFile::Flush() { if ( IsOpened() ) { #if defined(__VISUALC__) || wxHAVE_FSYNC - if ( fsync(m_fd) == -1 ) + if ( wxFsync(m_fd) == -1 ) { wxLogSysError(_("can't flush file descriptor %d"), m_fd); return FALSE; @@ -391,7 +365,7 @@ off_t wxFile::Tell() const { wxASSERT( IsOpened() ); - int iRc = tell(m_fd); + int iRc = wxTell(m_fd); if ( iRc == -1 ) { wxLogSysError(_("can't get seek position on file descriptor %d"), m_fd); return wxInvalidOffset; @@ -408,7 +382,7 @@ off_t wxFile::Length() const #ifdef __VISUALC__ int iRc = _filelength(m_fd); #else // !VC++ - int iRc = tell(m_fd); + int iRc = wxTell(m_fd); if ( iRc != -1 ) { // @ have to use const_cast :-( int iLen = ((wxFile *)this)->SeekEnd(); @@ -500,7 +474,7 @@ bool wxTempFile::Open(const wxString& strName) // OS/2 supports that have them (HPFS, FAT32) and security (HPFS386) static const wxChar *szMktempSuffix = wxT("XXX"); m_strTemp << strName << szMktempSuffix; - mkdir(m_strTemp.GetWriteBuf(MAX_PATH)); + ::DosCreateDir(m_strTemp.GetWriteBuf(MAX_PATH), NULL); #else // Windows wxString strPath; wxSplitPath(strName, &strPath, NULL, NULL); @@ -522,7 +496,7 @@ bool wxTempFile::Open(const wxString& strName) mode_t umaskOld = 0; // just to suppress compiler warning bool changedUmask; - struct stat st; + wxStructStat st; if ( stat(strName.fn_str(), &st) == 0 ) { // this assumes that only lower bits of st_mode contain the access @@ -572,12 +546,12 @@ bool wxTempFile::Commit() m_file.Close(); #ifndef __WXMAC__ - if ( wxFile::Exists(m_strName) && remove(m_strName.fn_str()) != 0 ) { + if ( wxFile::Exists(m_strName) && wxRemove(m_strName) != 0 ) { wxLogSysError(_("can't remove file '%s'"), m_strName.c_str()); return FALSE; } - if ( rename(m_strTemp.fn_str(), m_strName.fn_str()) != 0 ) { + if ( wxRename(m_strTemp, m_strName) != 0 ) { wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str()); return FALSE; } @@ -600,7 +574,7 @@ void wxTempFile::Discard() { m_file.Close(); #ifndef __WXMAC__ - if ( remove(m_strTemp.fn_str()) != 0 ) + if ( wxRemove(m_strTemp) != 0 ) wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str()); #else if ( remove( wxUnix2MacFilename(m_strTemp.fn_str())) != 0 ) diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index d9ab373bdb..a6916f0995 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -54,6 +54,12 @@ #include <stdlib.h> #include <ctype.h> +// headers needed for umask() +#ifdef __UNIX__ + #include <sys/types.h> + #include <sys/stat.h> +#endif // __UNIX__ + // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -371,6 +377,8 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName, } } + SetUmask(-1); + Init(); } @@ -460,8 +468,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) break; default: - wxLogWarning(_("file '%s', line %d: '%s' " - "ignored after group header."), + wxLogWarning(_("file '%s', line %d: '%s' ignored after group header."), file.GetName(), n + 1, pEnd); bCont = FALSE; } @@ -486,7 +493,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) wxString strKey(FilterInEntryName(wxString(pStart, pEnd))); // skip whitespace - while ( isspace(*pEnd) ) + while ( wxIsspace(*pEnd) ) pEnd++; if ( *pEnd++ != wxT('=') ) { @@ -506,8 +513,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) else { if ( bLocal && pEntry->IsImmutable() ) { // immutable keys can't be changed by user - wxLogWarning(_("file '%s', line %d: value for " - "immutable key '%s' ignored."), + wxLogWarning(_("file '%s', line %d: value for immutable key '%s' ignored."), file.GetName(), n + 1, strKey.c_str()); continue; } @@ -517,8 +523,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) // (c) key from global file now found in local one // which is exactly what we want. else if ( !bLocal || pEntry->IsLocal() ) { - wxLogWarning(_("file '%s', line %d: key '%s' was first " - "found at line %d."), + wxLogWarning(_("file '%s', line %d: key '%s' was first found at line %d."), file.GetName(), n + 1, strKey.c_str(), pEntry->Line()); if ( bLocal ) @@ -684,10 +689,9 @@ bool wxFileConfig::Read(const wxString& key, if (pEntry == NULL) { return FALSE; } - else { - *pStr = ExpandEnvVars(pEntry->Value()); - return TRUE; - } + + *pStr = ExpandEnvVars(pEntry->Value()); + return TRUE; } bool wxFileConfig::Read(const wxString& key, @@ -696,28 +700,31 @@ bool wxFileConfig::Read(const wxString& key, wxConfigPathChanger path(this, key); ConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name()); + bool ok; if (pEntry == NULL) { if( IsRecordingDefaults() ) ((wxFileConfig *)this)->Write(key,defVal); *pStr = ExpandEnvVars(defVal); - return FALSE; + ok = FALSE; } else { *pStr = ExpandEnvVars(pEntry->Value()); - return TRUE; + ok = TRUE; } + + return ok; } bool wxFileConfig::Read(const wxString& key, long *pl) const { wxString str; - if ( Read(key, & str) ) { - *pl = wxAtol(str); - return TRUE; - } - else { + if ( !Read(key, & str) ) + { return FALSE; } + + *pl = wxAtol(str); + return TRUE; } bool wxFileConfig::Write(const wxString& key, const wxString& szValue) @@ -768,6 +775,15 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() || !m_strLocalFile ) return TRUE; +#ifdef __UNIX__ + // set the umask if needed + mode_t umaskOld = 0; + if ( m_umask != -1 ) + { + umaskOld = umask((mode_t)m_umask); + } +#endif // __UNIX__ + wxTempFile file(m_strLocalFile); if ( !file.IsOpened() ) { @@ -783,10 +799,9 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) } } -#ifndef __WXMAC__ - return file.Commit(); -#else bool ret = file.Commit(); + +#ifdef __WXMAC__ if ( ret ) { FSSpec spec ; @@ -800,8 +815,17 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) FSpSetFInfo( &spec , &finfo ) ; } } - return ret ; -#endif +#endif // __WXMAC__ + +#ifdef __UNIX__ + // restore the old umask if we changed it + if ( m_umask != -1 ) + { + (void)umask(umaskOld); + } +#endif // __UNIX__ + + return ret; } // ---------------------------------------------------------------------------- @@ -882,7 +906,7 @@ bool wxFileConfig::DeleteAll() { CleanUp(); - if ( remove(m_strLocalFile.fn_str()) == -1 ) + if ( wxRemove(m_strLocalFile) == -1 ) wxLogSysError(_("can't delete user configuration file '%s'"), m_strLocalFile.c_str()); m_strLocalFile = m_strGlobalFile = wxT(""); diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 2a1694b0a7..7cf2962bf7 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -29,10 +29,6 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP - #include "wx/defs.h" -#endif - #include "wx/utils.h" #include "wx/intl.h" @@ -66,9 +62,9 @@ #include <dirent.h> #endif -#ifdef __OS2__ - #include <direct.h> +#ifdef __WXPM__ #include <process.h> + #include "wx/os2/private.h" #endif #ifdef __WINDOWS__ #if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) @@ -277,14 +273,10 @@ wxFileExists (const wxString& filename) return FALSE ; #else -#ifdef __SALFORDC__ - struct _stat stbuf; -#else - struct stat stbuf; -#endif - - if ((filename != wxT("")) && stat (wxFNSTRINGCAST filename.fn_str(), &stbuf) == 0) + wxStructStat stbuf; + if ((filename != wxT("")) && wxStat (wxFNSTRINGCAST filename.fn_str(), &stbuf) == 0) return TRUE; + return FALSE; #endif } @@ -570,7 +562,7 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) /* prefix ~ */ if (nm[1] == SEP || nm[1] == 0) { /* ~/filename */ - // FIXME: wxGetUserHome could return temporary storage in Unicode mode + // FIXME: wxGetUserHome could return temporary storage in Unicode mode if ((s = WXSTRINGCAST wxGetUserHome(wxT(""))) != NULL) { if (*++nm) nm++; @@ -584,7 +576,7 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) was_sep = (*s == SEP); nnm = *s ? s + 1 : s; *s = 0; - // FIXME: wxGetUserHome could return temporary storage in Unicode mode + // FIXME: wxGetUserHome could return temporary storage in Unicode mode if ((home = WXSTRINGCAST wxGetUserHome(wxString(nm + 1))) == NULL) { if (was_sep) /* replace only if it was there: */ *s = SEP; @@ -836,8 +828,8 @@ static char sMacFileNameConversion[ 1000 ] ; wxString wxMac2UnixFilename (const char *str) { - char *s = sMacFileNameConversion ; - strcpy( s , str ) ; + char *s = sMacFileNameConversion ; + strcpy( s , str ) ; if (s) { memmove( s+1 , s ,strlen( s ) + 1) ; @@ -860,8 +852,8 @@ wxString wxMac2UnixFilename (const char *str) wxString wxUnix2MacFilename (const char *str) { - char *s = sMacFileNameConversion ; - strcpy( s , str ) ; + char *s = sMacFileNameConversion ; + strcpy( s , str ) ; if (s) { if ( *s == '.' ) @@ -882,13 +874,13 @@ wxString wxUnix2MacFilename (const char *str) { if (*s == '/' || *s == '\\') { - // convert any back-directory situations - if ( *(s+1) == '.' && *(s+2) == '.' && ( (*(s+3) == '/' || *(s+3) == '\\') ) ) - { + // convert any back-directory situations + if ( *(s+1) == '.' && *(s+2) == '.' && ( (*(s+3) == '/' || *(s+3) == '\\') ) ) + { *s = ':'; - memmove( s+1 , s+3 ,strlen( s+3 ) + 1 ) ; - } - else + memmove( s+1 , s+3 ,strlen( s+3 ) + 1 ) ; + } + else *s = ':'; } @@ -900,36 +892,36 @@ wxString wxUnix2MacFilename (const char *str) wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) { - Handle myPath ; - short length ; - - FSpGetFullPath( spec , &length , &myPath ) ; - ::SetHandleSize( myPath , length + 1 ) ; - ::HLock( myPath ) ; - (*myPath)[length] = 0 ; - if ( length > 0 && (*myPath)[length-1] ==':' ) - (*myPath)[length-1] = 0 ; - - wxString result( (char*) *myPath ) ; - ::HUnlock( myPath ) ; - ::DisposeHandle( myPath ) ; - return result ; + Handle myPath ; + short length ; + + FSpGetFullPath( spec , &length , &myPath ) ; + ::SetHandleSize( myPath , length + 1 ) ; + ::HLock( myPath ) ; + (*myPath)[length] = 0 ; + if ( length > 0 && (*myPath)[length-1] ==':' ) + (*myPath)[length-1] = 0 ; + + wxString result( (char*) *myPath ) ; + ::HUnlock( myPath ) ; + ::DisposeHandle( myPath ) ; + return result ; } wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) { - return wxMac2UnixFilename( wxMacFSSpec2MacFilename( spec) ) ; + return wxMac2UnixFilename( wxMacFSSpec2MacFilename( spec) ) ; } void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) { - FSpLocationFromFullPath( strlen(path ) , path , spec ) ; + FSpLocationFromFullPath( strlen(path ) , path , spec ) ; } void wxUnixFilename2FSSpec( const char *path , FSSpec *spec ) { - wxString var = wxUnix2MacFilename( path ) ; - wxMacFilename2FSSpec( var , spec ) ; + wxString var = wxUnix2MacFilename( path ) ; + wxMacFilename2FSSpec( var , spec ) ; } #endif @@ -1050,7 +1042,7 @@ wxRenameFile (const wxString& file1, const wxString& file2) return TRUE; #else // Normal system call - if (0 == rename (wxFNSTRINGCAST file1.fn_str(), wxFNSTRINGCAST file2.fn_str())) + if (0 == wxRename (wxCSTRINGCAST file1, wxCSTRINGCAST file2)) return TRUE; #endif // Try to copy @@ -1065,7 +1057,7 @@ wxRenameFile (const wxString& file1, const wxString& file2) bool wxRemoveFile(const wxString& file) { #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) - int flag = remove(wxFNSTRINGCAST file.fn_str()); + int flag = wxRemove(wxFNSTRINGCAST file.fn_str()); #elif defined( __WXMAC__ ) int flag = unlink(wxUnix2MacFilename( file )); #else @@ -1083,10 +1075,12 @@ bool wxMkdir(const wxString& dir, int perm) // assume mkdir() has 2 args on non Windows-OS/2 platforms and on Windows too // for the GNU compiler -#if (!(defined(__WXMSW__) || defined(__OS2__))) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WXWINE__) +#if (!(defined(__WXMSW__) || defined(__WXPM__))) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WXWINE__) if ( mkdir(wxFNCONV(dirname), perm) != 0 ) +#elif defined(__WXPM__) + if (::DosCreateDir((PSZ)dirname, NULL) != 0) // enhance for EAB's?? #else // !MSW and !OS/2 VAC++ - if ( mkdir(wxFNSTRINGCAST wxFNCONV(dirname)) != 0 ) + if ( wxMkDir(wxFNSTRINGCAST wxFNCONV(dirname)) != 0 ) #endif // !MSW/MSW { wxLogSysError(_("Directory '%s' couldn't be created"), dirname); @@ -1104,12 +1098,14 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags)) return FALSE; //to be changed since rmdir exists in VMS7.x #elif defined( __WXMAC__ ) return (rmdir(wxUnix2MacFilename( dir )) == 0); +#elif defined(__WXPM__) + return (::DosDeleteDir((PSZ)dir.c_str()) == 0); #else #ifdef __SALFORDC__ return FALSE; // What to do? #else - return (rmdir(wxFNSTRINGCAST dir.fn_str()) == 0); + return (wxRmDir(wxFNSTRINGCAST dir.fn_str()) == 0); #endif #endif @@ -1164,19 +1160,25 @@ bool wxDirExists(const wxString& dir) // does the path exists? (may have or not '/' or '\\' at the end) bool wxPathExists(const wxChar *pszPathName) { - /* Windows API returns -1 from stat for "c:\dir\" if "c:\dir" exists - * OTOH, we should change "d:" to "d:\" and leave "\" as is. */ - wxString strPath(pszPathName); - if ( wxEndsWithPathSeparator(pszPathName) && pszPathName[1] != wxT('\0') ) - strPath.Last() = wxT('\0'); + wxString strPath(pszPathName); +#ifdef __WINDOWS__ + // Windows fails to find directory named "c:\dir\" even if "c:\dir" exists, + // so remove all trailing backslashes from the path - but don't do this for + // the pathes "d:\" (which are different from "d:") nor for just "\" + while ( wxEndsWithPathSeparator(strPath) ) + { + size_t len = strPath.length(); + if ( len == 1 || strPath[len - 1] == _T(':') ) + break; -#ifdef __SALFORDC__ - struct _stat st; -#else - struct stat st; -#endif + strPath.Truncate(len - 1); + } +#endif // __WINDOWS__ + + wxStructStat st; - return stat(wxFNSTRINGCAST strPath.fn_str(), &st) == 0 && (st.st_mode & S_IFDIR); + return wxStat(wxFNSTRINGCAST strPath.fn_str(), &st) == 0 && + ((st.st_mode & S_IFMT) == S_IFDIR); } // Get a temporary filename, opening and closing the file. @@ -1311,8 +1313,8 @@ wxString wxFindNextFile() nextDir = readdir(gs_dirStream) ) { if (wxMatchWild(name, nextDir->d_name, FALSE) && // RR: added FALSE to find hidden files - strcmp(nextDir->d_name, ".") && - strcmp(nextDir->d_name, "..") ) + strcmp(nextDir->d_name, ".") && + strcmp(nextDir->d_name, "..") ) { result.Empty(); if ( !path.IsEmpty() ) @@ -1360,10 +1362,10 @@ wxString wxFindNextFile() struct MacDirectoryIterator { - CInfoPBRec m_CPB ; - wxInt16 m_index ; - long m_dirId ; - Str255 m_name ; + CInfoPBRec m_CPB ; + wxInt16 m_index ; + long m_dirId ; + Str255 m_name ; } ; static int g_iter_flags ; @@ -1381,57 +1383,57 @@ wxString wxFindFirstFile(const wxChar *spec, int flags) if ( !path.IsEmpty() ) result << path << wxT('\\'); - FSSpec fsspec ; - - wxUnixFilename2FSSpec( result , &fsspec ) ; - g_iter.m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ; - g_iter.m_CPB.hFileInfo.ioNamePtr = g_iter.m_name ; - g_iter.m_index = 0 ; - - Boolean isDir ; - FSpGetDirectoryID( &fsspec , &g_iter.m_dirId , &isDir ) ; - if ( !isDir ) - return wxEmptyString ; - - return wxFindNextFile( ) ; + FSSpec fsspec ; + + wxUnixFilename2FSSpec( result , &fsspec ) ; + g_iter.m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ; + g_iter.m_CPB.hFileInfo.ioNamePtr = g_iter.m_name ; + g_iter.m_index = 0 ; + + Boolean isDir ; + FSpGetDirectoryID( &fsspec , &g_iter.m_dirId , &isDir ) ; + if ( !isDir ) + return wxEmptyString ; + + return wxFindNextFile( ) ; } wxString wxFindNextFile() { wxString result; - short err = noErr ; - - while ( err == noErr ) - { - g_iter.m_index++ ; - g_iter.m_CPB.dirInfo.ioFDirIndex = g_iter.m_index; - g_iter.m_CPB.dirInfo.ioDrDirID = g_iter.m_dirId; /* we need to do this every time */ - err = PBGetCatInfoSync((CInfoPBPtr)&g_iter.m_CPB); - if ( err != noErr ) - break ; - - if ( ( g_iter.m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (g_iter_flags & wxDIR) ) // we have a directory - break ; - - if ( ( g_iter.m_CPB.dirInfo.ioFlAttrib & ioDirMask) == 0 && !(g_iter_flags & wxFILE ) ) - continue ; - - // hit ! - break ; - } - if ( err != noErr ) - { - return wxEmptyString ; - } - FSSpec spec ; - - FSMakeFSSpecCompat(g_iter.m_CPB.hFileInfo.ioVRefNum, - g_iter.m_dirId, - g_iter.m_name, - &spec) ; - - return wxMacFSSpec2UnixFilename( &spec ) ; + short err = noErr ; + + while ( err == noErr ) + { + g_iter.m_index++ ; + g_iter.m_CPB.dirInfo.ioFDirIndex = g_iter.m_index; + g_iter.m_CPB.dirInfo.ioDrDirID = g_iter.m_dirId; /* we need to do this every time */ + err = PBGetCatInfoSync((CInfoPBPtr)&g_iter.m_CPB); + if ( err != noErr ) + break ; + + if ( ( g_iter.m_CPB.dirInfo.ioFlAttrib & ioDirMask) != 0 && (g_iter_flags & wxDIR) ) // we have a directory + break ; + + if ( ( g_iter.m_CPB.dirInfo.ioFlAttrib & ioDirMask) == 0 && !(g_iter_flags & wxFILE ) ) + continue ; + + // hit ! + break ; + } + if ( err != noErr ) + { + return wxEmptyString ; + } + FSSpec spec ; + + FSMakeFSSpecCompat(g_iter.m_CPB.hFileInfo.ioVRefNum, + g_iter.m_dirId, + g_iter.m_name, + &spec) ; + + return wxMacFSSpec2UnixFilename( &spec ) ; } #elif defined(__WXMSW__) @@ -1485,9 +1487,9 @@ wxString wxFindFirstFile(const wxChar *spec, int flags) result += gs_findDataStruct.cFileName; return result; -#else +#else // !Win32 int flag = _A_NORMAL; - if (flags & wxDIR) /* MATTHEW: [5] Use & */ + if (flags & wxDIR) flag = _A_SUBDIR; #ifdef __BORLANDC__ @@ -1496,7 +1498,6 @@ wxString wxFindFirstFile(const wxChar *spec, int flags) if (_dos_findfirst(WXSTRINGCAST spec, flag, &gs_findDataStruct) == 0) #endif { - /* MATTHEW: [5] Check directory flag */ char attrib; #ifdef __BORLANDC__ @@ -1519,9 +1520,9 @@ wxString wxFindFirstFile(const wxChar *spec, int flags) #endif ; } -#endif // __WIN32__ return result; +#endif // __WIN32__ } @@ -1591,9 +1592,9 @@ try_again: #endif ; } -#endif // Win32/16 return result; +#endif // Win32/16 } #elif defined(__WXPM__) @@ -1654,16 +1655,16 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) #ifdef _MSC_VER if (_getcwd(cbuf, sz) == NULL) { #elif defined( __WXMAC__) - enum - { - SFSaveDisk = 0x214, CurDirStore = 0x398 - }; - FSSpec cwdSpec ; - - FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ; - wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ; - strcpy( buf , res ) ; - if (0) { + enum + { + SFSaveDisk = 0x214, CurDirStore = 0x398 + }; + FSSpec cwdSpec ; + + FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ; + wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ; + strcpy( buf , res ) ; + if (0) { #else if (getcwd(cbuf, sz) == NULL) { #endif @@ -1672,16 +1673,23 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) #ifdef _MSC_VER if (_getcwd(buf, sz) == NULL) { #elif defined( __WXMAC__) - enum - { - SFSaveDisk = 0x214, CurDirStore = 0x398 - }; - FSSpec cwdSpec ; - - FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ; - wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ; - strcpy( buf , res ) ; - if (0) { + enum + { + SFSaveDisk = 0x214, CurDirStore = 0x398 + }; + FSSpec cwdSpec ; + + FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ; + wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ; + strcpy( buf , res ) ; + if (0) { +#elif(__VISAGECPP__) + APIRET rc; + rc = ::DosQueryCurrentDir( 0 // current drive + ,buf + ,(PULONG)&sz + ); + if (rc != 0) { #else if (getcwd(buf, sz) == NULL) { #endif @@ -1711,8 +1719,10 @@ wxString wxGetCwd() bool wxSetWorkingDirectory(const wxString& d) { -#if defined( __UNIX__ ) || defined( __WXMAC__ ) || defined(__WXPM__) +#if defined( __UNIX__ ) || defined( __WXMAC__ ) return (chdir(wxFNSTRINGCAST d.fn_str()) == 0); +#elif defined(__WXPM__) + return (::DosSetCurrentDir((PSZ)d.c_str()) == 0); #elif defined(__WINDOWS__) #ifdef __WIN32__ @@ -1771,7 +1781,7 @@ bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFi { // we assume that it's not empty wxCHECK_MSG( !wxIsEmpty(pszFile), FALSE, - _("empty file name in wxFindFileInPath")); + _T("empty file name in wxFindFileInPath")); // skip path separator in the beginning of the file name if present if ( wxIsPathSeparator(*pszFile) ) @@ -1868,13 +1878,11 @@ void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName, } } - - time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename) { - struct stat buf; + wxStructStat buf; - stat(filename.fn_str(), &buf); + wxStat(filename.fn_str(), &buf); return buf.st_mtime; } diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index ea9f907982..197fec8941 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -89,14 +89,13 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) } ft = wxTheMimeTypesManager -> GetFileTypeFromExtension(ext); - if (ft && (ft -> GetMimeType(&mime))) { - delete ft; - return mime; - } - else { - delete ft; - return wxEmptyString; + if ( !ft || !ft -> GetMimeType(&mime) ) { + mime = wxEmptyString; } + + delete ft; + + return mime; } @@ -186,13 +185,15 @@ bool wxLocalFSHandler::CanOpen(const wxString& location) wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location) { wxString right = GetRightLocation(location); - if (wxFileExists(right)) - return new wxFSFile(new wxFileInputStream(right), - right, - GetMimeTypeFromExt(location), - GetAnchor(location), - wxDateTime(wxFileModificationTime(right))); - else return (wxFSFile*) NULL; + if (!wxFileExists(right)) + return (wxFSFile*) NULL; + + return new wxFSFile(new wxFileInputStream(right), + right, + GetMimeTypeFromExt(location), + GetAnchor(location), + wxDateTime(wxFileModificationTime(right))); + } wxString wxLocalFSHandler::FindFirst(const wxString& spec, int flags) diff --git a/src/common/fontmap.cpp b/src/common/fontmap.cpp index 61538ec230..fe2909b43f 100644 --- a/src/common/fontmap.cpp +++ b/src/common/fontmap.cpp @@ -35,12 +35,18 @@ #endif // PCH #include "wx/fontmap.h" -#include "wx/config.h" -#include "wx/memconf.h" -#include "wx/msgdlg.h" -#include "wx/fontdlg.h" -#include "wx/choicdlg.h" +#if wxUSE_CONFIG + #include "wx/config.h" + #include "wx/memconf.h" +#endif + +#if wxUSE_GUI + #include "wx/msgdlg.h" + #include "wx/fontdlg.h" + #include "wx/choicdlg.h" +#endif // wxUSE_GUI + #include "wx/encconv.h" // ---------------------------------------------------------------------------- @@ -51,7 +57,9 @@ static const wxChar* FONTMAPPER_ROOT_PATH = wxT("wxWindows/FontMapper"); static const wxChar* FONTMAPPER_CHARSET_PATH = wxT("Charsets"); static const wxChar* FONTMAPPER_CHARSET_ALIAS_PATH = wxT("Aliases"); -static const wxChar* FONTMAPPER_FONT_FROM_ENCODING_PATH = wxT("Encodings"); +#if wxUSE_GUI + static const wxChar* FONTMAPPER_FONT_FROM_ENCODING_PATH = wxT("Encodings"); +#endif // wxUSE_GUI // encodings supported by GetEncodingDescription static wxFontEncoding gs_encodings[] = @@ -80,6 +88,7 @@ static wxFontEncoding gs_encodings[] = wxFONTENCODING_CP1255, wxFONTENCODING_CP1256, wxFONTENCODING_CP1257, + wxFONTENCODING_CP437, }; // the descriptions for them @@ -88,16 +97,16 @@ static const wxChar* gs_encodingDescs[] = wxTRANSLATE( "West European (ISO-8859-1/Latin 1)" ), wxTRANSLATE( "Central European (ISO-8859-2/Latin 2)" ), wxTRANSLATE( "Esperanto (ISO-8859-3)" ), - wxTRANSLATE( "Baltic (ISO-8859-4)" ), + wxTRANSLATE( "Baltic (old) (ISO-8859-4)" ), wxTRANSLATE( "Cyrillic (Latin 5)" ), wxTRANSLATE( "Arabic (ISO-8859-6)" ), wxTRANSLATE( "Greek (ISO-8859-7)" ), wxTRANSLATE( "Hebrew (ISO-8859-8)" ), wxTRANSLATE( "Turkish (ISO-8859-9)" ), - wxTRANSLATE( "Baltic II (ISO-8859-10)" ), + wxTRANSLATE( "Nordic (ISO-8859-10)" ), wxTRANSLATE( "Thai (ISO-8859-11)" ), wxTRANSLATE( "ISO-8859-12" ), - wxTRANSLATE( "ISO-8859-13" ), + wxTRANSLATE( "Baltic (ISO-8859-13)" ), wxTRANSLATE( "ISO-8859-14" ), wxTRANSLATE( "West European new (ISO-8859-15/Latin 0)" ), wxTRANSLATE( "KOI8-R" ), @@ -109,6 +118,7 @@ static const wxChar* gs_encodingDescs[] = wxTRANSLATE( "Windows Hebrew (CP 1255)" ), wxTRANSLATE( "Windows Arabic (CP 1256)" ), wxTRANSLATE( "Windows Baltic (CP 1257)" ), + wxTRANSLATE( "Windows/DOS OEM (CP 437)" ), }; // and the internal names @@ -138,6 +148,7 @@ static const wxChar* gs_encodingNames[] = wxT( "windows1255" ), wxT( "windows1256" ), wxT( "windows1257" ), + wxT( "windows437" ), }; // ---------------------------------------------------------------------------- @@ -188,8 +199,13 @@ private: wxFontMapper::wxFontMapper() { +#if wxUSE_CONFIG m_config = NULL; +#endif // wxUSE_CONFIG + +#if wxUSE_GUI m_windowParent = NULL; +#endif // wxUSE_GUI } wxFontMapper::~wxFontMapper() @@ -200,6 +216,8 @@ wxFontMapper::~wxFontMapper() // customisation // ---------------------------------------------------------------------------- +#if wxUSE_CONFIG + /* static */ const wxChar *wxFontMapper::GetDefaultConfigPath() { return FONTMAPPER_ROOT_PATH; @@ -213,7 +231,6 @@ void wxFontMapper::SetConfigPath(const wxString& prefix) m_configRootPath = prefix; } - // ---------------------------------------------------------------------------- // get config object and path for it // ---------------------------------------------------------------------------- @@ -250,9 +267,11 @@ const wxString& wxFontMapper::GetConfigPath() return m_configRootPath; } +#endif bool wxFontMapper::ChangePath(const wxString& pathNew, wxString *pathOld) { +#if wxUSE_CONFIG wxConfigBase *config = GetConfig(); if ( !config ) return FALSE; @@ -273,11 +292,17 @@ bool wxFontMapper::ChangePath(const wxString& pathNew, wxString *pathOld) config->SetPath(path); return TRUE; +#else + return FALSE; +#endif } void wxFontMapper::RestorePath(const wxString& pathOld) { +#if wxUSE_CONFIG GetConfig()->SetPath(pathOld); +#else +#endif } // ---------------------------------------------------------------------------- @@ -290,8 +315,7 @@ wxString wxFontMapper::GetEncodingDescription(wxFontEncoding encoding) size_t count = WXSIZEOF(gs_encodingDescs); wxASSERT_MSG( count == WXSIZEOF(gs_encodings), - wxT("inconsitency detected - forgot to update one of " - "the arrays?") ); + wxT("inconsitency detected - forgot to update one of the arrays?") ); for ( size_t i = 0; i < count; i++ ) { @@ -313,8 +337,7 @@ wxString wxFontMapper::GetEncodingName(wxFontEncoding encoding) size_t count = WXSIZEOF(gs_encodingNames); wxASSERT_MSG( count == WXSIZEOF(gs_encodings), - wxT("inconsitency detected - forgot to update one of " - "the arrays?") ); + wxT("inconsistency detected - forgot to update one of the arrays?") ); for ( size_t i = 0; i < count; i++ ) { @@ -338,6 +361,7 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, // we're going to modify it, make a copy wxString cs = charset; +#if wxUSE_CONFIG // first try the user-defined settings wxString pathOld; if ( ChangePath(FONTMAPPER_CHARSET_PATH, &pathOld) ) @@ -354,8 +378,7 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, } else { - wxLogDebug(wxT("corrupted config data: invalid encoding %ld " - "for charset '%s' ignored"), + wxLogDebug(wxT("corrupted config data: invalid encoding %ld for charset '%s' ignored"), value, charset.c_str()); } } @@ -375,6 +398,7 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, RestorePath(pathOld); } +#endif // if didn't find it there, try to reckognise it ourselves if ( encoding == wxFONTENCODING_SYSTEM ) @@ -426,6 +450,7 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, //else: unknown } +#if wxUSE_GUI // if still no luck, ask the user - unless disabled if ( (encoding == wxFONTENCODING_SYSTEM) && interactive ) { @@ -438,16 +463,13 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, // the message wxString msg; - msg.Printf(_("The charset '%s' is unknown. You may select\n" - "another charset to replace it with or choose\n" - "[Cancel] if it cannot be replaced"), charset.c_str()); + msg.Printf(_("The charset '%s' is unknown. You may select\nanother charset to replace it with or choose\n[Cancel] if it cannot be replaced"), charset.c_str()); // the list of choices size_t count = WXSIZEOF(gs_encodingDescs); wxASSERT_MSG( count == WXSIZEOF(gs_encodings), - wxT("inconsitency detected - forgot to update one of " - "the arrays?") ); + wxT("inconsitency detected - forgot to update one of the arrays?") ); wxString *encodingNamesTranslated = new wxString[count]; @@ -473,7 +495,8 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, { encoding = gs_encodings[n]; - // save the result in the config now +#if wxUSE_CONFIG + // save the result in the config now if ( ChangePath(FONTMAPPER_CHARSET_PATH, &pathOld) ) { wxConfigBase *config = GetConfig(); @@ -481,15 +504,16 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, // remember the alt encoding for this charset if ( !config->Write(charset, (long)encoding) ) { - wxLogError(_("Failed to remember the encoding " - "for the charset '%s'."), charset.c_str()); + wxLogError(_("Failed to remember the encoding for the charset '%s'."), charset.c_str()); } RestorePath(pathOld); } +#endif // wxUSE_CONFIG } //else: cancelled } +#endif // wxUSE_GUI return encoding; } @@ -500,6 +524,8 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset, // correspond to which is used by GetFontForEncoding() function // ---------------------------------------------------------------------------- +#if wxUSE_GUI + bool wxFontMapper::TestAltEncoding(const wxString& configEntry, wxFontEncoding encReplacement, wxNativeEncodingInfo *info) @@ -507,6 +533,7 @@ bool wxFontMapper::TestAltEncoding(const wxString& configEntry, if ( wxGetNativeFontEncoding(encReplacement, info) && wxTestFontEncoding(*info) ) { +#if wxUSE_CONFIG // remember the mapping in the config wxFontMapperPathChanger path(this, FONTMAPPER_FONT_FROM_ENCODING_PATH); @@ -514,18 +541,48 @@ bool wxFontMapper::TestAltEncoding(const wxString& configEntry, { GetConfig()->Write(configEntry, info->ToString()); } - +#endif // wxUSE_CONFIG return TRUE; } return FALSE; } +#if wxUSE_GUI +class ReentrancyBlocker +{ +public: + ReentrancyBlocker(bool& b) : m_b(b) { m_b = TRUE; } + ~ReentrancyBlocker() { m_b = FALSE; } + +private: + bool& m_b; +}; +#endif + bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, wxNativeEncodingInfo *info, const wxString& facename, bool interactive) { +#if wxUSE_GUI + // we need a flag to prevent infinite recursion which happens, for + // example, when GetAltForEncoding() is called from an OnPaint() handler: + // in this case, wxYield() which is called from wxMessageBox() we use here + // will lead to another call of OnPaint() and hence to another call of + // GetAltForEncoding() - and it is impossible to catch this from the user + // code because we are called from wxFont ctor implicitly. + + // assume we're always called from the main thread, so that it is safe to + // use a static var + static bool s_inGetAltForEncoding = FALSE; + + if ( interactive && s_inGetAltForEncoding ) + return FALSE; + + ReentrancyBlocker blocker(s_inGetAltForEncoding); +#endif // wxUSE_GUI + wxCHECK_MSG( info, FALSE, wxT("bad pointer in GetAltForEncoding") ); info->facename = facename; @@ -553,6 +610,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, } configEntry += encName; +#if wxUSE_CONFIG // do we have a font spec for this encoding? wxString pathOld; if ( ChangePath(FONTMAPPER_FONT_FROM_ENCODING_PATH, &pathOld) ) @@ -582,12 +640,12 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, } else { - wxLogDebug(wxT("corrupted config data: string '%s' is not " - "a valid font encoding info"), fontinfo.c_str()); + wxLogDebug(wxT("corrupted config data: string '%s' is not a valid font encoding info"), fontinfo.c_str()); } } //else: there is no information in config about this encoding } +#endif // wxUSE_CONFIG // ask the user if ( interactive ) @@ -598,11 +656,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, // the message wxString msg; - msg.Printf(_("The encoding '%s' is unknown.\n" - "Would you like to select a font to be used for this " - "encoding\n" - "(otherwise the text in this encoding will not be " - "shown correctly)?"), + msg.Printf(_("The encoding '%s' is unknown.\nWould you like to select a font to be used for this encoding\n(otherwise the text in this encoding will not be shown correctly)?"), GetEncodingDescription(encoding).c_str()); wxWindow *parent = m_windowParent; @@ -624,13 +678,15 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, *info = retData.EncodingInfo(); info -> encoding = retData.GetEncoding(); - // remember this in the config +#if wxUSE_CONFIG + // remember this in the config if ( ChangePath(FONTMAPPER_FONT_FROM_ENCODING_PATH, &pathOld) ) { GetConfig()->Write(configEntry, info->ToString()); RestorePath(pathOld); } +#endif return TRUE; } @@ -640,7 +696,6 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, } //else: we're in non-interactive mode - // now try the default mappings: wxFontEncodingArray equiv = wxEncodingConverter::GetAllEquivalents(encoding); size_t count = equiv.GetCount(); @@ -653,8 +708,6 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, return FALSE; } - - bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, wxFontEncoding *alt_encoding, const wxString& facename, @@ -666,8 +719,6 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, return r; } - - bool wxFontMapper::IsEncodingAvailable(wxFontEncoding encoding, const wxString& facename) { @@ -681,3 +732,5 @@ bool wxFontMapper::IsEncodingAvailable(wxFontEncoding encoding, else return FALSE; } + +#endif // wxUSE_GUI diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index ef3ab1defc..3d94d675e1 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -284,29 +284,7 @@ void wxFrameBase::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) void wxFrameBase::OnMenuHighlight(wxMenuEvent& event) { #if wxUSE_STATUSBAR - if ( GetStatusBar() ) - { - // if no help string found, we will clear the status bar text - wxString helpString; - - int menuId = event.GetMenuId(); - if ( menuId != wxID_SEPARATOR && menuId != -2 /* wxID_TITLE */ ) - { - wxMenuBar *menuBar = GetMenuBar(); - if ( menuBar ) - { - // it's ok if we don't find the item because it might belong - // to the popup menu - wxMenuItem *item = menuBar->FindItem(menuId); - if ( item ) - helpString = item->GetHelp(); - } - } - - // set status text even if the string is empty - this will at least - // remove the string from the item which was previously selected - SetStatusText(helpString); - } + (void)ShowMenuHelp(GetStatusBar(), event.GetMenuId()); #endif // wxUSE_STATUSBAR } @@ -372,6 +350,34 @@ void wxFrameBase::SetStatusWidths(int n, const int widths_field[] ) PositionStatusBar(); } +bool wxFrameBase::ShowMenuHelp(wxStatusBar *statbar, int menuId) +{ + if ( !statbar ) + return FALSE; + + // if no help string found, we will clear the status bar text + wxString helpString; + + if ( menuId != wxID_SEPARATOR && menuId != -2 /* wxID_TITLE */ ) + { + wxMenuBar *menuBar = GetMenuBar(); + if ( menuBar ) + { + // it's ok if we don't find the item because it might belong + // to the popup menu + wxMenuItem *item = menuBar->FindItem(menuId); + if ( item ) + helpString = item->GetHelp(); + } + } + + // set status text even if the string is empty - this will at least + // remove the string from the item which was previously selected + statbar->SetStatusText(helpString); + + return !helpString.IsEmpty(); +} + #endif // wxUSE_STATUSBAR // ---------------------------------------------------------------------------- diff --git a/src/common/fs_inet.cpp b/src/common/fs_inet.cpp index d3b94f258d..3ebf0d5b10 100644 --- a/src/common/fs_inet.cpp +++ b/src/common/fs_inet.cpp @@ -94,8 +94,8 @@ bool wxInternetFSHandler::CanOpen(const wxString& location) wxURL url(p + wxT(":") + StripProtocolAnchor(location)); return (url.GetError() == wxURL_NOERR); } - else - return FALSE; + + return FALSE; } @@ -140,15 +140,14 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxStri // Load item from cache: s = new wxFileInputStream(info->GetTemp()); - if (s) - { - return new wxFSFile(s, - right, - info->GetMime(), - GetAnchor(location), - wxDateTime::Now()); - } - else return (wxFSFile*) NULL; + if (!s) + return (wxFSFile*) NULL; + + return new wxFSFile(s, + right, + info->GetMime(), + GetAnchor(location), + wxDateTime::Now()); } diff --git a/src/common/fs_mem.cpp b/src/common/fs_mem.cpp index bc089b0990..d1e3b30179 100644 --- a/src/common/fs_mem.cpp +++ b/src/common/fs_mem.cpp @@ -159,13 +159,13 @@ bool wxMemoryFSHandler::CheckHash(const wxString& filename) wxMemoryOutputStream mems; - if (image.Ok() && image.SaveFile(mems, type)) + if (image.Ok() && image.SaveFile(mems, (int)type)) m_Hash -> Put(filename, new MemFSHashObj(mems)); else { wxString s; s.Printf(_("Failed to store image '%s' to memory VFS!"), filename.c_str()); - printf("'%s'\n", s.c_str()); + wxPrintf(wxT("'%s'\n"), s.c_str()); wxLogError(s); } } diff --git a/src/common/fs_zip.cpp b/src/common/fs_zip.cpp index 438a20a2b2..706cd05352 100644 --- a/src/common/fs_zip.cpp +++ b/src/common/fs_zip.cpp @@ -85,7 +85,12 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l GetAnchor(location), wxDateTime(wxFileModificationTime(left))); } - else return NULL; + else + { + if (s) + delete s; + return NULL; + } } @@ -113,7 +118,7 @@ wxString wxZipFSHandler::FindFirst(const wxString& spec, int flags) } m_ZipFile = left; - m_Archive = (void*) unzOpen(m_ZipFile.fn_str()); + m_Archive = (void*) unzOpen(m_ZipFile.mb_str()); m_Pattern = right.AfterLast(wxT('/')); m_BaseDir = right.BeforeLast(wxT('/')); diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index e9db032f8e..1d5e801965 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -20,7 +20,9 @@ #pragma hdrstop #endif -#if wxUSE_SOCKETS +#include "wx/setup.h" + +#if wxUSE_SOCKETS && wxUSE_STREAMS #ifndef __MWERKS__ #include <memory.h> @@ -398,11 +400,23 @@ public: : wxSocketOutputStream(*sock), m_ftp(ftp_clt) {} virtual ~wxOutputFTPStream(void) { - if (LastError() != wxStream_NOERROR) - m_ftp->GetResult('2'); - else - m_ftp->Abort(); - delete m_o_socket; + if ( IsOk() ) + { + // close data connection first, this will generate "transfer + // completed" reply + delete m_o_socket; + + // read this reply + m_ftp->GetResult('2'); + } + else + { + // abort data connection first + m_ftp->Abort(); + + // and close it after + delete m_o_socket; + } } }; diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 472650c95c..7a1eae5c80 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -136,106 +136,95 @@ wxColourDatabase::~wxColourDatabase () // Colour database stuff void wxColourDatabase::Initialize () { - // Don't initialize for X: colours are found - // in FindColour below. - // Added: Not all - - struct cdef { - wxChar *name; - int r,g,b; - }; - cdef cc; - static cdef table[]={ - -// #ifdef __WXMSW__ - {wxT("AQUAMARINE"),112, 219, 147}, - {wxT("BLACK"),0, 0, 0}, - {wxT("BLUE"), 0, 0, 255}, - {wxT("BLUE VIOLET"), 159, 95, 159}, - {wxT("BROWN"), 165, 42, 42}, - {wxT("CADET BLUE"), 95, 159, 159}, - {wxT("CORAL"), 255, 127, 0}, - {wxT("CORNFLOWER BLUE"), 66, 66, 111}, - {wxT("CYAN"), 0, 255, 255}, - {wxT("DARK GREY"), 47, 47, 47}, // ? - - {wxT("DARK GREEN"), 47, 79, 47}, - {wxT("DARK OLIVE GREEN"), 79, 79, 47}, - {wxT("DARK ORCHID"), 153, 50, 204}, - {wxT("DARK SLATE BLUE"), 107, 35, 142}, - {wxT("DARK SLATE GREY"), 47, 79, 79}, - {wxT("DARK TURQUOISE"), 112, 147, 219}, - {wxT("DIM GREY"), 84, 84, 84}, - {wxT("FIREBRICK"), 142, 35, 35}, - {wxT("FOREST GREEN"), 35, 142, 35}, - {wxT("GOLD"), 204, 127, 50}, - {wxT("GOLDENROD"), 219, 219, 112}, - {wxT("GREY"), 128, 128, 128}, - {wxT("GREEN"), 0, 255, 0}, - {wxT("GREEN YELLOW"), 147, 219, 112}, - {wxT("INDIAN RED"), 79, 47, 47}, - {wxT("KHAKI"), 159, 159, 95}, - {wxT("LIGHT BLUE"), 191, 216, 216}, - {wxT("LIGHT GREY"), 192, 192, 192}, - {wxT("LIGHT STEEL BLUE"), 143, 143, 188}, - {wxT("LIME GREEN"), 50, 204, 50}, - {wxT("LIGHT MAGENTA"), 255, 0, 255}, - {wxT("MAGENTA"), 255, 0, 255}, - {wxT("MAROON"), 142, 35, 107}, - {wxT("MEDIUM AQUAMARINE"), 50, 204, 153}, - {wxT("MEDIUM GREY"), 100, 100, 100}, - {wxT("MEDIUM BLUE"), 50, 50, 204}, - {wxT("MEDIUM FOREST GREEN"), 107, 142, 35}, - {wxT("MEDIUM GOLDENROD"), 234, 234, 173}, - {wxT("MEDIUM ORCHID"), 147, 112, 219}, - {wxT("MEDIUM SEA GREEN"), 66, 111, 66}, - {wxT("MEDIUM SLATE BLUE"), 127, 0, 255}, - {wxT("MEDIUM SPRING GREEN"), 127, 255, 0}, - {wxT("MEDIUM TURQUOISE"), 112, 219, 219}, - {wxT("MEDIUM VIOLET RED"), 219, 112, 147}, - {wxT("MIDNIGHT BLUE"), 47, 47, 79}, - {wxT("NAVY"), 35, 35, 142}, - {wxT("ORANGE"), 204, 50, 50}, - {wxT("ORANGE RED"), 255, 0, 127}, - {wxT("ORCHID"), 219, 112, 219}, - {wxT("PALE GREEN"), 143, 188, 143}, - {wxT("PINK"), 188, 143, 234}, - {wxT("PLUM"), 234, 173, 234}, - {wxT("PURPLE"), 176, 0, 255}, - {wxT("RED"), 255, 0, 0}, - {wxT("SALMON"), 111, 66, 66}, - {wxT("SEA GREEN"), 35, 142, 107}, - {wxT("SIENNA"), 142, 107, 35}, - {wxT("SKY BLUE"), 50, 153, 204}, - {wxT("SLATE BLUE"), 0, 127, 255}, - {wxT("SPRING GREEN"), 0, 255, 127}, - {wxT("STEEL BLUE"), 35, 107, 142}, - {wxT("TAN"), 219, 147, 112}, - {wxT("THISTLE"), 216, 191, 216}, - {wxT("TURQUOISE"), 173, 234, 234}, - {wxT("VIOLET"), 79, 47, 79}, - {wxT("VIOLET RED"), 204, 50, 153}, - {wxT("WHEAT"), 216, 216, 191}, - {wxT("WHITE"), 255, 255, 255}, - {wxT("YELLOW"), 255, 255, 0}, - {wxT("YELLOW GREEN"), 153, 204, 50}, -// #endif - -#if defined(__WXGTK__) || defined(__X__) - {wxT("MEDIUM GOLDENROD"), 234, 234, 173}, - {wxT("MEDIUM FOREST GREEN"), 107, 142, 35}, - {wxT("LIGHT MAGENTA"), 255, 0, 255}, - {wxT("MEDIUM GREY"), 100, 100, 100}, -#endif - - {0,0,0,0} - }; - int i; - for (i=0;cc=table[i],cc.name!=0;i++) - { - Append(cc.name,new wxColour(cc.r,cc.g,cc.b)); - } - + static const struct wxColourDesc + { + const wxChar *name; + int r,g,b; + } + wxColourTable[] = + { + {wxT("AQUAMARINE"),112, 219, 147}, + {wxT("BLACK"),0, 0, 0}, + {wxT("BLUE"), 0, 0, 255}, + {wxT("BLUE VIOLET"), 159, 95, 159}, + {wxT("BROWN"), 165, 42, 42}, + {wxT("CADET BLUE"), 95, 159, 159}, + {wxT("CORAL"), 255, 127, 0}, + {wxT("CORNFLOWER BLUE"), 66, 66, 111}, + {wxT("CYAN"), 0, 255, 255}, + {wxT("DARK GREY"), 47, 47, 47}, // ? + + {wxT("DARK GREEN"), 47, 79, 47}, + {wxT("DARK OLIVE GREEN"), 79, 79, 47}, + {wxT("DARK ORCHID"), 153, 50, 204}, + {wxT("DARK SLATE BLUE"), 107, 35, 142}, + {wxT("DARK SLATE GREY"), 47, 79, 79}, + {wxT("DARK TURQUOISE"), 112, 147, 219}, + {wxT("DIM GREY"), 84, 84, 84}, + {wxT("FIREBRICK"), 142, 35, 35}, + {wxT("FOREST GREEN"), 35, 142, 35}, + {wxT("GOLD"), 204, 127, 50}, + {wxT("GOLDENROD"), 219, 219, 112}, + {wxT("GREY"), 128, 128, 128}, + {wxT("GREEN"), 0, 255, 0}, + {wxT("GREEN YELLOW"), 147, 219, 112}, + {wxT("INDIAN RED"), 79, 47, 47}, + {wxT("KHAKI"), 159, 159, 95}, + {wxT("LIGHT BLUE"), 191, 216, 216}, + {wxT("LIGHT GREY"), 192, 192, 192}, + {wxT("LIGHT STEEL BLUE"), 143, 143, 188}, + {wxT("LIME GREEN"), 50, 204, 50}, + {wxT("LIGHT MAGENTA"), 255, 0, 255}, + {wxT("MAGENTA"), 255, 0, 255}, + {wxT("MAROON"), 142, 35, 107}, + {wxT("MEDIUM AQUAMARINE"), 50, 204, 153}, + {wxT("MEDIUM GREY"), 100, 100, 100}, + {wxT("MEDIUM BLUE"), 50, 50, 204}, + {wxT("MEDIUM FOREST GREEN"), 107, 142, 35}, + {wxT("MEDIUM GOLDENROD"), 234, 234, 173}, + {wxT("MEDIUM ORCHID"), 147, 112, 219}, + {wxT("MEDIUM SEA GREEN"), 66, 111, 66}, + {wxT("MEDIUM SLATE BLUE"), 127, 0, 255}, + {wxT("MEDIUM SPRING GREEN"), 127, 255, 0}, + {wxT("MEDIUM TURQUOISE"), 112, 219, 219}, + {wxT("MEDIUM VIOLET RED"), 219, 112, 147}, + {wxT("MIDNIGHT BLUE"), 47, 47, 79}, + {wxT("NAVY"), 35, 35, 142}, + {wxT("ORANGE"), 204, 50, 50}, + {wxT("ORANGE RED"), 255, 0, 127}, + {wxT("ORCHID"), 219, 112, 219}, + {wxT("PALE GREEN"), 143, 188, 143}, + {wxT("PINK"), 188, 143, 234}, + {wxT("PLUM"), 234, 173, 234}, + {wxT("PURPLE"), 176, 0, 255}, + {wxT("RED"), 255, 0, 0}, + {wxT("SALMON"), 111, 66, 66}, + {wxT("SEA GREEN"), 35, 142, 107}, + {wxT("SIENNA"), 142, 107, 35}, + {wxT("SKY BLUE"), 50, 153, 204}, + {wxT("SLATE BLUE"), 0, 127, 255}, + {wxT("SPRING GREEN"), 0, 255, 127}, + {wxT("STEEL BLUE"), 35, 107, 142}, + {wxT("TAN"), 219, 147, 112}, + {wxT("THISTLE"), 216, 191, 216}, + {wxT("TURQUOISE"), 173, 234, 234}, + {wxT("VIOLET"), 79, 47, 79}, + {wxT("VIOLET RED"), 204, 50, 153}, + {wxT("WHEAT"), 216, 216, 191}, + {wxT("WHITE"), 255, 255, 255}, + {wxT("YELLOW"), 255, 255, 0}, + {wxT("YELLOW GREEN"), 153, 204, 50}, + {wxT("MEDIUM GOLDENROD"), 234, 234, 173}, + {wxT("MEDIUM FOREST GREEN"), 107, 142, 35}, + {wxT("LIGHT MAGENTA"), 255, 0, 255}, + {wxT("MEDIUM GREY"), 100, 100, 100}, + }; + + for ( size_t n = 0; n < WXSIZEOF(wxColourTable); n++ ) + { + const wxColourDesc& cc = wxColourTable[n]; + Append(cc.name, new wxColour(cc.r,cc.g,cc.b)); + } } /* @@ -249,45 +238,54 @@ void wxColourDatabase::Initialize () wxColour *wxColourDatabase::FindColour(const wxString& colour) { - // VZ: make the comparaison case insensitive - wxString str = colour; - str.MakeUpper(); + // VZ: make the comparaison case insensitive and also match both grey and + // gray + wxString colName = colour; + colName.MakeUpper(); + wxString colName2 = colName; + if ( !colName2.Replace(_T("GRAY"), _T("GREY")) ) + colName2.clear(); + + wxNode *node = First(); + while ( node ) + { + const wxChar *key = node->GetKeyString(); + if ( colName == key || colName2 == key ) + { + return (wxColour *)node->Data(); + } - wxNode *node = Find(str); - if (node) - return (wxColour *)node->Data(); + node = node->Next(); + } #ifdef __WXMSW__ - else return NULL; + return NULL; #endif #ifdef __WXPM__ - else return NULL; + return NULL; #endif // TODO for other implementations. This should really go into // platform-specific directories. #ifdef __WXMAC__ - else return NULL; + return NULL; #endif #ifdef __WXSTUBS__ - else return NULL; + return NULL; #endif #ifdef __WXGTK__ - else { - wxColour *col = new wxColour( colour ); + wxColour *col = new wxColour( colour ); - if (!(col->Ok())) { + if (!(col->Ok())) { delete col; return (wxColour *) NULL; - } - Append( colour, col ); - return col; } + Append( colour, col ); + return col; #endif #ifdef __X__ - else { XColor xcolour; #ifdef __WXMOTIF__ @@ -311,8 +309,7 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour) Append(colour, col); return col; - } -#endif +#endif // __X__ } wxString wxColourDatabase::FindName (const wxColour& colour) const @@ -595,34 +592,76 @@ void wxFontList::RemoveFont (wxFont * font) DeleteObject (font); } -wxFont *wxFontList:: - FindOrCreateFont (int PointSize, int FamilyOrFontId, int Style, int Weight, bool underline, const wxString& Face, wxFontEncoding encoding) +wxFont *wxFontList::FindOrCreateFont(int pointSize, + int family, + int style, + int weight, + bool underline, + const wxString& facename, + wxFontEncoding encoding) { - for (wxNode * node = First (); node; node = node->Next ()) + wxFont *font = (wxFont *)NULL; + wxNode *node; + for ( node = First(); node; node = node->Next() ) { - wxFont *each_font = (wxFont *) node->Data (); - if (each_font && - each_font->GetVisible() && - each_font->Ok() && - each_font->GetPointSize () == PointSize && - each_font->GetStyle () == Style && - each_font->GetWeight () == Weight && - each_font->GetUnderlined () == underline && + font = (wxFont *)node->Data(); + if ( font->GetVisible() && + font->Ok() && + font->GetPointSize () == pointSize && + font->GetStyle () == style && + font->GetWeight () == weight && + font->GetUnderlined () == underline ) + { + int fontFamily = font->GetFamily(); + #if defined(__WXGTK__) - (each_font->GetFamily() == FamilyOrFontId || - (each_font->GetFamily() == wxSWISS && FamilyOrFontId == wxDEFAULT)) && -#else - each_font->GetFamily() == FamilyOrFontId && -#endif - ((each_font->GetFaceName() == wxT("")) || each_font->GetFaceName() == Face) && - (encoding == wxFONTENCODING_DEFAULT || each_font->GetEncoding() == encoding)) - return each_font; + // under GTK the default family is wxSWISS, so looking for a font + // with wxDEFAULT family should return a wxSWISS one instead of + // creating a new one + bool same = (fontFamily == family) || + (fontFamily == wxSWISS && family == wxDEFAULT); +#else // !GTK + // VZ: but why elsewhere do we require an exact match? mystery... + bool same = fontFamily == family; +#endif // GTK/!GTK + + // empty facename matches anything at all: this is bad because + // depending on which fonts are already created, we might get back + // a different font if we create it with empty facename, but it is + // still better than never matching anything in the cache at all + // in this case + if ( same && !!facename ) + { + const wxString& fontFace = font->GetFaceName(); + + // empty facename matches everything + same = !fontFace || fontFace == facename; + } + + if ( same && (encoding != wxFONTENCODING_DEFAULT) ) + { + // have to match the encoding too + same = font->GetEncoding() == encoding; + } + + if ( same ) + { + return font; + } + } } - wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face, encoding); - font->SetVisible(TRUE); + if ( !node ) + { + // font not found, create the new one + font = new wxFont(pointSize, family, style, weight, + underline, facename, encoding); + + // and mark it as being cacheable + font->SetVisible(TRUE); + } - return font; + return font; } void wxBitmapList::AddBitmap(wxBitmap *bitmap) @@ -644,31 +683,12 @@ wxSize wxGetDisplaySize() wxResourceCache::~wxResourceCache () { - wxNode *node = First (); - while (node) { - wxGDIObject *item = (wxGDIObject *)node->Data(); - if (item->IsKindOf(CLASSINFO(wxBrush))) { - wxBrush *brush = (wxBrush *)item; - delete brush; - } - - if (item->IsKindOf(CLASSINFO(wxFont))) { - wxFont *font = (wxFont *)item; - delete font; - } - - if (item->IsKindOf(CLASSINFO(wxBitmap))) { - wxBitmap *bitmap = (wxBitmap *)item; - delete bitmap; - } + wxNode *node = First (); + while (node) { + wxObject *item = (wxObject *)node->Data(); + delete item; - if (item->IsKindOf(CLASSINFO(wxColour))) { - wxColour *colour = (wxColour *)item; - delete colour; + node = node->Next (); } - - wxNode *next = node->Next (); - node = next; - } } diff --git a/src/common/http.cpp b/src/common/http.cpp index 606bc340ec..90d5db12a8 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -20,7 +20,7 @@ #pragma hdrstop #endif -#if wxUSE_SOCKETS +#if wxUSE_SOCKETS && wxUSE_STREAMS #include <stdio.h> #include <stdlib.h> diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp index 45169259e1..600d800ff9 100644 --- a/src/common/imagbmp.cpp +++ b/src/common/imagbmp.cpp @@ -47,8 +47,123 @@ IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler) + #if wxUSE_STREAMS + +bool wxBMPHandler::SaveFile(wxImage *image, + wxOutputStream& stream, + bool verbose) +{ + wxCHECK_MSG( image, FALSE, _T("invalid pointer in wxBMPHandler::SaveFile") ); + + if (!image->Ok()) + { + if (verbose) wxLogError(_("BMP: Couldn't save invalid image.")); + return FALSE; + } + + unsigned width = image->GetWidth(); + unsigned row_width = width * 3 + + (((width % 4) == 0) ? 0 : (4 - (width * 3) % 4)); + // each row must be aligned to dwords + struct + { + // BitmapHeader: + wxUint16 magic; // format magic, always 'BM' + wxUint32 filesize; // total file size, inc. headers + wxUint32 reserved; // for future use + wxUint32 data_offset; // image data offset in the file + + // BitmapInfoHeader: + wxUint32 bih_size; // 2nd part's size + wxUint32 width, height; // bitmap's dimensions + wxUint16 planes; // num of planes + wxUint16 bpp; // bits per pixel + wxUint32 compression; // compression method + wxUint32 size_of_bmp; // size of the bitmap + wxUint32 h_res, v_res; // image resolution in dpi + wxUint32 num_clrs; // number of colors used + wxUint32 num_signif_clrs;// number of significant colors + } hdr; + wxUint32 hdr_size = 14/*BitmapHeader*/ + 40/*BitmapInfoHeader*/; + + hdr.magic = wxUINT16_SWAP_ON_BE(0x4D42/*'BM'*/); + hdr.filesize = wxUINT32_SWAP_ON_BE( + hdr_size + + row_width * image->GetHeight() + ); + hdr.reserved = 0; + hdr.data_offset = wxUINT32_SWAP_ON_BE(hdr_size); + + hdr.bih_size = wxUINT32_SWAP_ON_BE(hdr_size - 14); + hdr.width = wxUINT32_SWAP_ON_BE(image->GetWidth()); + hdr.height = wxUINT32_SWAP_ON_BE(image->GetHeight()); + hdr.planes = wxUINT16_SWAP_ON_BE(1); // always 1 plane + hdr.bpp = wxUINT16_SWAP_ON_BE(24); // always TrueColor + hdr.compression = 0; // RGB uncompressed + hdr.size_of_bmp = wxUINT32_SWAP_ON_BE(row_width * image->GetHeight()); + hdr.h_res = hdr.v_res = wxUINT32_SWAP_ON_BE(72); // 72dpi is standard + hdr.num_clrs = 0; // maximal possible = 2^24 + hdr.num_signif_clrs = 0; // all colors are significant + + if (// VS: looks ugly but compilers tend to do ugly things with structs, + // like aligning hdr.filesize's ofset to dword :( + // VZ: we should add padding then... + !stream.Write(&hdr.magic, 2) || + !stream.Write(&hdr.filesize, 4) || + !stream.Write(&hdr.reserved, 4) || + !stream.Write(&hdr.data_offset, 4) || + !stream.Write(&hdr.bih_size, 4) || + !stream.Write(&hdr.width, 4) || + !stream.Write(&hdr.height, 4) || + !stream.Write(&hdr.planes, 2) || + !stream.Write(&hdr.bpp, 2) || + !stream.Write(&hdr.compression, 4) || + !stream.Write(&hdr.size_of_bmp, 4) || + !stream.Write(&hdr.h_res, 4) || + !stream.Write(&hdr.v_res, 4) || + !stream.Write(&hdr.num_clrs, 4) || + !stream.Write(&hdr.num_signif_clrs, 4) + ) + { + if (verbose) + wxLogError(_("BMP: Couldn't write the file header.")); + return FALSE; + } + + wxUint8 *data = (wxUint8*) image->GetData(); + wxUint8 *buffer = new wxUint8[row_width]; + wxUint8 tmpvar; + memset(buffer, 0, row_width); + int y; unsigned x; + + for (y = image->GetHeight() -1 ; y >= 0; y--) + { + memcpy(buffer, data + y * 3 * width, 3 * width); + for (x = 0; x < width; x++) + { + tmpvar = buffer[3 * x + 0]; + buffer[3 * x + 0] = buffer[3 * x + 2]; + buffer[3 * x + 2] = tmpvar; + } + + if (!stream.Write(buffer, row_width)) + { + if (verbose) + wxLogError(_("BMP: Couldn't write data.")); + delete[] buffer; + return FALSE; + } + } + delete[] buffer; + + return TRUE; +} + + + + #ifndef BI_RGB #define BI_RGB 0 #define BI_RLE8 1 @@ -74,6 +189,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose } *cmap = NULL; off_t start_offset = stream.TellI(); + if (start_offset == wxInvalidOffset) start_offset = 0; image->Destroy(); diff --git a/src/common/image.cpp b/src/common/image.cpp index 5f61154db2..666a09736a 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -56,6 +56,7 @@ public: bool m_hasMask; unsigned char m_maskRed,m_maskGreen,m_maskBlue; bool m_ok; + bool m_static; }; wxImageRefData::wxImageRefData() @@ -68,11 +69,12 @@ wxImageRefData::wxImageRefData() m_maskGreen = 0; m_maskBlue = 0; m_hasMask = FALSE; + m_static = FALSE; } wxImageRefData::~wxImageRefData() { - if (m_data) + if (m_data && !m_static) free( m_data ); } @@ -93,6 +95,11 @@ wxImage::wxImage( int width, int height ) Create( width, height ); } +wxImage::wxImage( int width, int height, unsigned char* data, bool static_data ) +{ + Create( width, height, data, static_data ); +} + wxImage::wxImage( const wxString& name, long type ) { LoadFile( name, type ); @@ -146,11 +153,51 @@ void wxImage::Create( int width, int height ) } } +void wxImage::Create( int width, int height, unsigned char* data, bool static_data ) +{ + UnRef(); + + m_refData = new wxImageRefData(); + + M_IMGDATA->m_data = data; + if (M_IMGDATA->m_data) + { + M_IMGDATA->m_width = width; + M_IMGDATA->m_height = height; + M_IMGDATA->m_ok = TRUE; + M_IMGDATA->m_static = static_data; + } + else + { + UnRef(); + } +} + void wxImage::Destroy() { UnRef(); } +wxImage wxImage::Copy() const +{ + wxImage image; + + wxCHECK_MSG( Ok(), image, wxT("invalid image") ); + + image.Create( M_IMGDATA->m_width, M_IMGDATA->m_height ); + + char unsigned *data = image.GetData(); + + wxCHECK_MSG( data, image, wxT("unable to create image") ); + + if (M_IMGDATA->m_hasMask) + image.SetMaskColour( M_IMGDATA->m_maskRed, M_IMGDATA->m_maskGreen, M_IMGDATA->m_maskBlue ); + + memcpy( data, GetData(), M_IMGDATA->m_width*M_IMGDATA->m_height*3 ); + + return image; +} + wxImage wxImage::Scale( int width, int height ) const { wxImage image; @@ -190,6 +237,91 @@ wxImage wxImage::Scale( int width, int height ) const return image; } +wxImage wxImage::Rotate90( bool clockwise ) const +{ + wxImage image; + + wxCHECK_MSG( Ok(), image, wxT("invalid image") ); + + image.Create( M_IMGDATA->m_height, M_IMGDATA->m_width ); + + char unsigned *data = image.GetData(); + + wxCHECK_MSG( data, image, wxT("unable to create image") ); + + if (M_IMGDATA->m_hasMask) + image.SetMaskColour( M_IMGDATA->m_maskRed, M_IMGDATA->m_maskGreen, M_IMGDATA->m_maskBlue ); + + long height = M_IMGDATA->m_height; + long width = M_IMGDATA->m_width; + + char unsigned *source_data = M_IMGDATA->m_data; + char unsigned *target_data; + + for (long j = 0; j < height; j++) + { + for (long i = 0; i < width; i++) + { + if (clockwise) + target_data = data + (((i+1)*height) - j - 1)*3; + else + target_data = data + ((height*(width-1)) + j - (i*height))*3; + memcpy( target_data, source_data, 3 ); + source_data += 3; + } + } + + return image; +} + +wxImage wxImage::Mirror( bool horizontally ) const +{ + wxImage image; + + wxCHECK_MSG( Ok(), image, wxT("invalid image") ); + + image.Create( M_IMGDATA->m_width, M_IMGDATA->m_height ); + + char unsigned *data = image.GetData(); + + wxCHECK_MSG( data, image, wxT("unable to create image") ); + + if (M_IMGDATA->m_hasMask) + image.SetMaskColour( M_IMGDATA->m_maskRed, M_IMGDATA->m_maskGreen, M_IMGDATA->m_maskBlue ); + + long height = M_IMGDATA->m_height; + long width = M_IMGDATA->m_width; + + char unsigned *source_data = M_IMGDATA->m_data; + char unsigned *target_data; + + if (horizontally) + { + for (long j = 0; j < height; j++) + { + data += width*3; + target_data = data-3; + for (long i = 0; i < width; i++) + { + memcpy( target_data, source_data, 3 ); + source_data += 3; + target_data -= 3; + } + } + } + else + { + for (long i = 0; i < height; i++) + { + target_data = data + 3*width*(height-1-i); + memcpy( target_data, source_data, 3*width ); + source_data += 3*width; + } + } + + return image; +} + wxImage wxImage::GetSubImage( const wxRect &rect ) const { wxImage image; @@ -227,6 +359,59 @@ wxImage wxImage::GetSubImage( const wxRect &rect ) const return image; } +void wxImage::Paste( const wxImage &image, int x, int y ) +{ + wxCHECK_RET( Ok(), wxT("invalid image") ); + wxCHECK_RET( image.Ok(), wxT("invalid image") ); + + int xx = 0; + int yy = 0; + int width = image.GetWidth(); + int height = image.GetHeight(); + + if (x < 0) + { + xx = -x; + width += x; + } + if (y < 0) + { + yy = -y; + height += y; + } + + if ((x+xx)+width > M_IMGDATA->m_width) + width = M_IMGDATA->m_width - (x+xx); + if ((y+yy)+height > M_IMGDATA->m_height) + height = M_IMGDATA->m_height - (y+yy); + + if (width < 1) return; + if (height < 1) return; + + if ((!HasMask() && !image.HasMask()) || + ((HasMask() && image.HasMask() && + (GetMaskRed()==image.GetMaskRed()) && + (GetMaskGreen()==image.GetMaskGreen()) && + (GetMaskBlue()==image.GetMaskBlue())))) + { + width *= 3; + unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth(); + int source_step = image.GetWidth()*3; + + unsigned char* target_data = GetData() + (x+xx)*3 + (y+yy)*3*M_IMGDATA->m_width; + int target_step = M_IMGDATA->m_width*3; + for (int j = 0; j < height; j++) + { + memcpy( target_data, source_data, width ); + source_data += source_step; + target_data += target_step; + } + } + else + { + } +} + void wxImage::Replace( unsigned char r1, unsigned char g1, unsigned char b1, unsigned char r2, unsigned char g2, unsigned char b2 ) { @@ -266,7 +451,7 @@ void wxImage::SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned c M_IMGDATA->m_data[ pos+2 ] = b; } -unsigned char wxImage::GetRed( int x, int y ) +unsigned char wxImage::GetRed( int x, int y ) const { wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); @@ -280,7 +465,7 @@ unsigned char wxImage::GetRed( int x, int y ) return M_IMGDATA->m_data[pos]; } -unsigned char wxImage::GetGreen( int x, int y ) +unsigned char wxImage::GetGreen( int x, int y ) const { wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); @@ -294,7 +479,7 @@ unsigned char wxImage::GetGreen( int x, int y ) return M_IMGDATA->m_data[pos+1]; } -unsigned char wxImage::GetBlue( int x, int y ) +unsigned char wxImage::GetBlue( int x, int y ) const { wxCHECK_MSG( Ok(), 0, wxT("invalid image") ); @@ -340,6 +525,34 @@ void wxImage::SetData( char unsigned *data ) m_refData = newRefData; } +void wxImage::SetData( char unsigned *data, int new_width, int new_height ) +{ + wxImageRefData *newRefData = new wxImageRefData(); + + if (m_refData) + { + newRefData->m_width = new_width; + newRefData->m_height = new_height; + newRefData->m_data = data; + newRefData->m_ok = TRUE; + newRefData->m_maskRed = M_IMGDATA->m_maskRed; + newRefData->m_maskGreen = M_IMGDATA->m_maskGreen; + newRefData->m_maskBlue = M_IMGDATA->m_maskBlue; + newRefData->m_hasMask = M_IMGDATA->m_hasMask; + } + else + { + newRefData->m_width = new_width; + newRefData->m_height = new_height; + newRefData->m_data = data; + newRefData->m_ok = TRUE; + } + + UnRef(); + + m_refData = newRefData; +} + void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b ) { wxCHECK_RET( Ok(), wxT("invalid image") ); diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 3078d70528..5e3f56ce34 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -29,6 +29,9 @@ #include "wx/app.h" extern "C" { +#ifdef __WATCOMC__ + #define HAVE_BOOLEAN +#endif #include "jpeglib.h" } #include "wx/filefn.h" diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index 2bbfa1071a..ec1a1bc534 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -43,6 +43,14 @@ extern "C" IMPLEMENT_DYNAMIC_CLASS(wxTIFFHandler,wxImageHandler) +static tsize_t +_tiffNullProc(thandle_t WXUNUSED(handle), + tdata_t WXUNUSED(buf), + tsize_t WXUNUSED(size)) +{ + return (tsize_t) -1; +} + static tsize_t _tiffReadProc(thandle_t handle, tdata_t buf, tsize_t size) { @@ -60,7 +68,7 @@ _tiffWriteProc(thandle_t handle, tdata_t buf, tsize_t size) } static toff_t -_tiffSeekProc(thandle_t handle, toff_t off, int whence) +_tiffSeekIProc(thandle_t handle, toff_t off, int whence) { wxInputStream *stream = (wxInputStream*) handle; wxSeekMode mode; @@ -75,6 +83,22 @@ _tiffSeekProc(thandle_t handle, toff_t off, int whence) return (toff_t)stream->SeekI( (off_t)off, mode ); } +static toff_t +_tiffSeekOProc(thandle_t handle, toff_t off, int whence) +{ + wxOutputStream *stream = (wxOutputStream*) handle; + wxSeekMode mode; + switch (whence) + { + case SEEK_SET: mode = wxFromStart; break; + case SEEK_CUR: mode = wxFromCurrent; break; + case SEEK_END: mode = wxFromEnd; break; + default: mode = wxFromCurrent; break; + } + + return (toff_t)stream->SeekO( (off_t)off, mode ); +} + static int _tiffCloseProc(thandle_t WXUNUSED(handle)) { @@ -84,7 +108,7 @@ _tiffCloseProc(thandle_t WXUNUSED(handle)) static toff_t _tiffSizeProc(thandle_t handle) { - wxInputStream *stream = (wxInputStream*) handle; + wxStreamBase *stream = (wxStreamBase*) handle; return (toff_t) stream->GetSize(); } @@ -108,13 +132,24 @@ TIFFwxOpen(wxInputStream &stream, const char* name, const char* mode) { TIFF* tif = TIFFClientOpen(name, mode, (thandle_t) &stream, - _tiffReadProc, _tiffWriteProc, - _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, + _tiffReadProc, _tiffNullProc, + _tiffSeekIProc, _tiffCloseProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); return tif; } +TIFF* +TIFFwxOpen(wxOutputStream &stream, const char* name, const char* mode) +{ + TIFF* tif = TIFFClientOpen(name, mode, + (thandle_t) &stream, + _tiffNullProc, _tiffWriteProc, + _tiffSeekOProc, _tiffCloseProc, _tiffSizeProc, + _tiffMapProc, _tiffUnmapProc); + + return tif; +} bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index ) { @@ -155,6 +190,8 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos { if (verbose) wxLogError( _("TIFF: Couldn't allocate memory.") ); + + TIFFClose( tif ); return FALSE; } @@ -166,6 +203,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos wxLogError( _("TIFF: Couldn't allocate memory.") ); _TIFFfree( raster ); + TIFFClose( tif ); return FALSE; } @@ -177,6 +215,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos _TIFFfree( raster ); image->Destroy(); + TIFFClose( tif ); return FALSE; } @@ -242,9 +281,77 @@ int wxTIFFHandler::GetImageCount( wxInputStream& stream ) return dircount; } -bool wxTIFFHandler::SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose) ) +bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose ) { - return FALSE; + TIFF *tif = TIFFwxOpen( stream, "image", "w" ); + + if (!tif) + { + if (verbose) + wxLogError( _("TIFF: Error saving image.") ); + + return FALSE; + } + + TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32)image->GetWidth()); + TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32)image->GetHeight()); + TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); + TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3); + TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); + TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); + TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW); + + tsize_t linebytes = (tsize_t)image->GetWidth() * 3; + unsigned char *buf; + + if (TIFFScanlineSize(tif) > linebytes) + { + buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif)); + if (!buf) + { + if (verbose) + wxLogError( _("TIFF: Couldn't allocate memory.") ); + + TIFFClose( tif ); + + return FALSE; + } + } + else + { + buf = NULL; + } + + TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, + TIFFDefaultStripSize(tif, (uint32) -1)); + + unsigned char *ptr = image->GetData(); + for (int row = 0; row < image->GetHeight(); row++) + { + if (buf) + memcpy(buf, ptr, image->GetWidth()); + + if (TIFFWriteScanline(tif, buf ? buf : ptr, (uint32)row, 0) < 0) + { + if (verbose) + wxLogError( _("TIFF: Error writing image.") ); + + TIFFClose( tif ); + if (buf) + _TIFFfree(buf); + + return FALSE; + } + ptr += image->GetWidth()*3; + } + + (void) TIFFClose(tif); + + if (buf) + _TIFFfree(buf); + + return TRUE; } bool wxTIFFHandler::DoCanRead( wxInputStream& stream ) @@ -263,7 +370,3 @@ bool wxTIFFHandler::DoCanRead( wxInputStream& stream ) // wxUSE_LIBTIFF - - - - diff --git a/src/common/init.cpp b/src/common/init.cpp index 70c9dafcdb..390dced3de 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -35,7 +35,7 @@ // global vars // ---------------------------------------------------------------------------- -wxApp * WXDLLEXPORT wxTheApp = NULL; +WXDLLEXPORT wxApp *wxTheApp = NULL; wxAppInitializerFunction wxAppBase::m_appInitFn = (wxAppInitializerFunction)NULL; diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 69379ff601..272d7f3f63 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -103,17 +103,33 @@ const size_t32 MSGCATALOG_MAGIC_SW = 0xde120495; // global functions // ---------------------------------------------------------------------------- -// suppress further error messages about missing translations -// (if you don't have one catalog file, you wouldn't like to see the -// error message for each string in it, so normally it's given only -// once) -void wxSuppressTransErrors(); +#ifdef __WXDEBUG__ -// restore the logging -void wxRestoreTransErrors(); +// small class to suppress the translation erros until exit from current scope +class NoTransErr +{ +public: + NoTransErr() { ms_suppressCount++; } + ~NoTransErr() { ms_suppressCount--; } + + static bool Suppress() { return ms_suppressCount > 0; } + +private: + static size_t ms_suppressCount; +}; -// get the current state -bool wxIsLoggingTransErrors(); +size_t NoTransErr::ms_suppressCount = 0; + +#else // !Debug + +class NoTransErr +{ +public: + NoTransErr() { } + ~NoTransErr() { } +}; + +#endif // Debug/!Debug static wxLocale *wxSetLocale(wxLocale *pLocale); @@ -253,14 +269,6 @@ wxMsgCatalog::~wxMsgCatalog() wxDELETEA(m_pszName); } -// small class to suppress the translation erros until exit from current scope -class NoTransErr -{ -public: - NoTransErr() { wxSuppressTransErrors(); } - ~NoTransErr() { wxRestoreTransErrors(); } -}; - // return all directories to search for given prefix static wxString GetAllMsgCatalogSubdirs(const wxChar *prefix, const wxChar *lang) @@ -292,7 +300,7 @@ static wxString GetFullSearchPath(const wxChar *lang) // LC_PATH is a standard env var containing the search path for the .mo // files - const wxChar *pszLcPath = wxGetenv("LC_PATH"); + const wxChar *pszLcPath = wxGetenv(wxT("LC_PATH")); if ( pszLcPath != NULL ) searchPath << GetAllMsgCatalogSubdirs(pszLcPath, lang); @@ -617,29 +625,22 @@ const wxMB2WXbuf wxLocale::GetString(const wxChar *szOrigString, } if ( pszTrans == NULL ) { - if ( wxIsLoggingTransErrors() ) { - // suppress further error messages if we're not debugging: this avoids - // flooding the user with messages about each and every missing string if, - // for example, a whole catalog file is missing. - - // do it before calling LogWarning to prevent infinite recursion! #ifdef __WXDEBUG__ + if ( !NoTransErr::Suppress() ) { NoTransErr noTransErr; -#else // !debug - wxSuppressTransErrors(); -#endif // debug/!debug if ( szDomain != NULL ) { - wxLogWarning(_("string '%s' not found in domain '%s' for locale '%s'."), + wxLogDebug(_T("string '%s' not found in domain '%s' for locale '%s'."), szOrigString, szDomain, m_strLocale.c_str()); } else { - wxLogWarning(_("string '%s' not found in locale '%s'."), - szOrigString, m_strLocale.c_str()); + wxLogDebug(_T("string '%s' not found in locale '%s'."), + szOrigString, m_strLocale.c_str()); } } +#endif // __WXDEBUG__ return (wxMB2WXbuf)(szOrigString); } @@ -696,26 +697,6 @@ bool wxLocale::AddCatalog(const wxChar *szDomain) // global functions and variables // ---------------------------------------------------------------------------- -// translation errors logging -// -------------------------- - -static bool gs_bGiveTransErrors = TRUE; - -void wxSuppressTransErrors() -{ - gs_bGiveTransErrors = FALSE; -} - -void wxRestoreTransErrors() -{ - gs_bGiveTransErrors = TRUE; -} - -bool wxIsLoggingTransErrors() -{ - return gs_bGiveTransErrors; -} - // retrieve/change current locale // ------------------------------ diff --git a/src/common/list.cpp b/src/common/list.cpp index 971dca379c..0e326ee1f5 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -165,7 +165,6 @@ void wxListBase::DoCopy(const wxListBase& list) wxASSERT_MSG( !list.m_destroy, wxT("copying list which owns it's elements is a bad idea") ); - m_count = list.m_count; m_destroy = list.m_destroy; m_keyType = list.m_keyType; m_nodeFirst = @@ -204,6 +203,8 @@ void wxListBase::DoCopy(const wxListBase& list) break; } } + + wxASSERT_MSG( m_count == list.m_count, _T("logic error in wxList::DoCopy") ); } wxListBase::~wxListBase() diff --git a/src/common/log.cpp b/src/common/log.cpp index 0a44516706..e0bc9a779e 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -180,15 +180,15 @@ void wxLogVerbose(const wxChar *szFormat, ...) wxChar *p = s_szBuf; size_t len = WXSIZEOF(s_szBuf); - strncpy(s_szBuf, _T("("), len); + wxStrncpy(s_szBuf, _T("("), len); len -= 1; // strlen("(") p += 1; - strncat(p, mask, len); + wxStrncat(p, mask, len); size_t lenMask = wxStrlen(mask); len -= lenMask; p += lenMask; - strncat(p, _T(") "), len); + wxStrncat(p, _T(") "), len); len -= 2; p += 2; @@ -415,7 +415,8 @@ void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) // under Windows, programs usually don't have stderr at all, so show the // messages also under debugger - unless it's a console program #if defined(__WXMSW__) && wxUSE_GUI - OutputDebugString(str + wxT("\r\n")); + str += wxT("\r\n") ; + OutputDebugString(str.c_str()); #endif // MSW #if defined(__WXMAC__) && wxUSE_GUI debugstr(str + wxT("\r\n")); @@ -638,12 +639,10 @@ void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg) #if wxUSE_GUI || defined(__WXMSW__) // this message is intentionally not translated - it is for // developpers only - wxStrcat(szBuf, wxT("\nDo you want to stop the program?" - "\nYou can also choose [Cancel] to suppress " - "further warnings.")); + wxStrcat(szBuf, wxT("\nDo you want to stop the program?\nYou can also choose [Cancel] to suppress further warnings.")); #if wxUSE_GUI - switch ( wxMessageBox(szBuf, "Debug", + switch ( wxMessageBox(szBuf, wxT("Debug"), wxYES_NO | wxCANCEL | wxICON_STOP ) ) { case wxYES: Trap(); @@ -656,7 +655,7 @@ void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg) //case wxNO: nothing to do } #else // !GUI, but MSW - switch ( ::MessageBox(NULL, szBuf, "Debug", + switch ( ::MessageBox(NULL, szBuf, _T("Debug"), MB_YESNOCANCEL | MB_ICONSTOP ) ) { case IDYES: Trap(); diff --git a/src/common/memory.cpp b/src/common/memory.cpp index 9730edb82d..902a88a2f2 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -519,7 +519,7 @@ void wxDebugContext::SetStream(ostream *str, streambuf *buf) bool wxDebugContext::SetFile(const wxString& file) { - ofstream *str = new ofstream(file.fn_str()); + ofstream *str = new ofstream(file.mb_str()); if (str->bad()) { @@ -1026,7 +1026,7 @@ void operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */) wxDebugFree(pData, FALSE); } // New operator 21/11/1998 -void operator delete[](void* pData, char* /* fileName */, int /* lineNum */) +void operator delete[](void* pData, wxChar* /* fileName */, int /* lineNum */) { wxDebugFree(pData, TRUE); } @@ -1146,7 +1146,10 @@ void wxDebugFree(void * buf, bool WXUNUSED(isVect) ) // Trace: send output to the current debugging stream void wxTrace(const wxChar *fmt ...) { - va_list ap; +#if 1 + wxFAIL_MSG(wxT("wxTrace is now obsolete. Please use wxDebugXXX instead.")); +#else + va_list ap; static wxChar buffer[512]; va_start(ap, fmt); @@ -1174,11 +1177,15 @@ void wxTrace(const wxChar *fmt ...) #else fprintf(stderr, buffer); #endif +#endif } // Trace with level void wxTraceLevel(int level, const wxChar *fmt ...) { +#if 1 + wxFAIL_MSG(wxT("wxTrace is now obsolete. Please use wxDebugXXX instead.")); +#else if (wxDebugContext::GetLevel() < level) return; @@ -1188,7 +1195,7 @@ void wxTraceLevel(int level, const wxChar *fmt ...) va_start(ap, fmt); #ifdef __WXMSW__ - wvsprintf(buffer,fmt,ap) ; + wxWvsprintf(buffer,fmt,ap) ; #else vsprintf(buffer,fmt,ap) ; #endif @@ -1210,6 +1217,7 @@ void wxTraceLevel(int level, const wxChar *fmt ...) #else fprintf(stderr, buffer); #endif +#endif } #else // wxUSE_MEMORY_TRACING && defined(__WXDEBUG__) diff --git a/src/common/mimecmn.cpp b/src/common/mimecmn.cpp index 25a0eedb28..7a773543f0 100644 --- a/src/common/mimecmn.cpp +++ b/src/common/mimecmn.cpp @@ -158,8 +158,7 @@ wxString wxFileType::ExpandCommand(const wxString& command, const wxChar *pEnd = wxStrchr(pc, wxT('}')); if ( pEnd == NULL ) { wxString mimetype; - wxLogWarning(_("Unmatched '{' in an entry for " - "mime type %s."), + wxLogWarning(_("Unmatched '{' in an entry for mime type %s."), params.GetMimeType().c_str()); str << wxT("%{"); } @@ -190,8 +189,16 @@ wxString wxFileType::ExpandCommand(const wxString& command, } // metamail(1) man page states that if the mailcap entry doesn't have '%s' - // the program will accept the data on stdin: so give it to it! - if ( !hasFilename && !str.IsEmpty() ) { + // the program will accept the data on stdin so normally we should append + // "< %s" to the end of the command in such case, but not all commands + // behave like this, in particular a common test is 'test -n "$DISPLAY"' + // and appending "< %s" to this command makes the test fail... I don't + // know of the correct solution, try to guess what we have to do. + if ( !hasFilename && !str.IsEmpty() +#ifdef __UNIX__ + && !str.StartsWith(_T("test ")) +#endif // Unix + ) { str << wxT(" < '") << params.GetFileName() << wxT('\''); } diff --git a/src/common/object.cpp b/src/common/object.cpp index ab59919f01..b81454d2ab 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -48,6 +48,11 @@ wxClassInfo wxObject::sm_classwxObject((wxChar *) wxT("wxObject"), (wxChar *) NU wxClassInfo* wxClassInfo::sm_first = (wxClassInfo *) NULL; wxHashTable* wxClassInfo::sm_classTable = (wxHashTable*) NULL; +// These are here so we can avoid 'always true/false' warnings +// by referring to these instead of TRUE/FALSE +const bool wxTrue = TRUE; +const bool wxFalse = FALSE; + /* * wxWindows root object. */ @@ -129,7 +134,7 @@ void wxObject::operator delete (void * buf) // VC++ 6.0 #if defined(__VISUALC__) && (__VISUALC__ >= 1200) -void wxObject::operator delete(void* pData, char* /* fileName */, int /* lineNum */) +void wxObject::operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */) { ::operator delete(pData); } @@ -197,16 +202,6 @@ bool wxClassInfo::IsKindOf(wxClassInfo *info) const if (info == NULL) return FALSE; - // For some reason, when making/using a DLL, static data has to be included - // in both the DLL and the application. This can lead to duplicate - // wxClassInfo objects, so we have to test the name instead of the pointers. - // PROBABLY NO LONGER TRUE now I've done DLL creation right. - /* -#if WXMAKINGDLL -if (GetClassName() && info->GetClassName() && (wxStrcmp(GetClassName(), info->GetClassName()) == 0)) -return TRUE; -#else - */ if (this == info) return TRUE; @@ -243,9 +238,7 @@ void wxClassInfo::InitializeClasses() if (info->m_className) { wxASSERT_MSG( ++nClass < nMaxClasses, - _T("an infinite loop detected - have you used " - "IMPLEMENT_DYNAMIC_CLASS() twice (may be by " - "linking some object module(s) twice)?") ); + _T("an infinite loop detected - have you used IMPLEMENT_DYNAMIC_CLASS() twice (may be by linking some object module(s) twice)?") ); sm_classTable->Put(info->m_className, (wxObject *)info); } @@ -391,8 +384,3 @@ wxObjectRefData::wxObjectRefData(void) : m_count(1) wxObjectRefData::~wxObjectRefData() { } - -// These are here so we can avoid 'always true/false' warnings -// by referring to these instead of TRUE/FALSE -const bool wxTrue = TRUE; -const bool wxFalse = FALSE; diff --git a/src/common/paper.cpp b/src/common/paper.cpp index 653309aafa..d8775f2c62 100644 --- a/src/common/paper.cpp +++ b/src/common/paper.cpp @@ -93,53 +93,53 @@ wxPrintPaperDatabase::wxPrintPaperDatabase():wxList(wxKEY_STRING) void wxPrintPaperDatabase::CreateDatabase() { /* - AddPaperType(_("A4 210 x 297 mm"), 210, 297); - AddPaperType(_("A3 297 x 420 mm"), 297, 420); - AddPaperType(_("Letter 8 1/2 x 11 in"), 216, 279); - AddPaperType(_("Legal 8 1/2 x 14 in"), 216, 356); + AddPaperType(wxTRANSLATE("A4 210 x 297 mm"), 210, 297); + AddPaperType(wxTRANSLATE("A3 297 x 420 mm"), 297, 420); + AddPaperType(wxTRANSLATE("Letter 8 1/2 x 11 in"), 216, 279); + AddPaperType(wxTRANSLATE("Legal 8 1/2 x 14 in"), 216, 356); */ - WXADDPAPER(wxPAPER_LETTER, DMPAPER_LETTER, "Letter, 8 1/2 x 11 in", 2159, 2794); - WXADDPAPER(wxPAPER_LEGAL, DMPAPER_LEGAL, "Legal, 8 1/2 x 14 in", 2159, 3556); - WXADDPAPER(wxPAPER_A4, DMPAPER_A4, "A4 sheet, 210 x 297 mm", 2100, 2970); - WXADDPAPER(wxPAPER_CSHEET, DMPAPER_CSHEET, "C sheet, 17 x 22 in", 4318, 5588); - WXADDPAPER(wxPAPER_DSHEET, DMPAPER_DSHEET, "D sheet, 22 x 34 in", 5588, 8636); - WXADDPAPER(wxPAPER_ESHEET, DMPAPER_ESHEET, "E sheet, 34 x 44 in", 8636, 11176); - WXADDPAPER(wxPAPER_LETTERSMALL, DMPAPER_LETTERSMALL, "Letter Small, 8 1/2 x 11 in", 2159, 2794); - WXADDPAPER(wxPAPER_TABLOID, DMPAPER_TABLOID, "Tabloid, 11 x 17 in", 2794, 4318); - WXADDPAPER(wxPAPER_LEDGER, DMPAPER_LEDGER, "Ledger, 17 x 11 in", 4318, 2794); - WXADDPAPER(wxPAPER_STATEMENT, DMPAPER_STATEMENT, "Statement, 5 1/2 x 8 1/2 in", 1397, 2159); - WXADDPAPER(wxPAPER_EXECUTIVE, DMPAPER_EXECUTIVE, "Executive, 7 1/4 x 10 1/2 in", 1842, 2667); - WXADDPAPER(wxPAPER_A3, DMPAPER_A3, "A3 sheet, 297 x 420 mm", 2970, 4200); - WXADDPAPER(wxPAPER_A4SMALL, DMPAPER_A4SMALL, "A4 small sheet, 210 x 297 mm", 2100, 2970); - WXADDPAPER(wxPAPER_A5, DMPAPER_A5, "A5 sheet, 148 x 210 mm", 1480, 2100); - WXADDPAPER(wxPAPER_B4, DMPAPER_B4, "B4 sheet, 250 x 354 mm", 2500, 3540); - WXADDPAPER(wxPAPER_B5, DMPAPER_B5, "B5 sheet, 182 x 257 millimeter", 1820, 2570); - WXADDPAPER(wxPAPER_FOLIO, DMPAPER_FOLIO, "Folio, 8 1/2 x 13 in", 2159, 3302); - WXADDPAPER(wxPAPER_QUARTO, DMPAPER_QUARTO, "Quarto, 215 x 275 mm", 2150, 2750); - WXADDPAPER(wxPAPER_10X14, DMPAPER_10X14, "10 x 14 in", 2540, 3556); - WXADDPAPER(wxPAPER_11X17, DMPAPER_11X17, "11 x 17 in", 2794, 4318); - WXADDPAPER(wxPAPER_NOTE, DMPAPER_NOTE, "Note, 8 1/2 x 11 in", 2159, 2794); - WXADDPAPER(wxPAPER_ENV_9, DMPAPER_ENV_9, "#9 Envelope, 3 7/8 x 8 7/8 in", 984, 2254); - WXADDPAPER(wxPAPER_ENV_10, DMPAPER_ENV_10, "#10 Envelope, 4 1/8 x 9 1/2 in", 1048, 2413); - WXADDPAPER(wxPAPER_ENV_11, DMPAPER_ENV_11, "#11 Envelope, 4 1/2 x 10 3/8 in", 1143, 2635); - WXADDPAPER(wxPAPER_ENV_12, DMPAPER_ENV_12, "#12 Envelope, 4 3/4 x 11 in", 1206, 2794); - WXADDPAPER(wxPAPER_ENV_14, DMPAPER_ENV_14, "#14 Envelope, 5 x 11 1/2 in", 1270, 2921); - WXADDPAPER(wxPAPER_ENV_DL, DMPAPER_ENV_DL, "DL Envelope, 110 x 220 mm", 1100, 2200); - WXADDPAPER(wxPAPER_ENV_C5, DMPAPER_ENV_C5, "C5 Envelope, 162 x 229 mm", 1620, 2290); - WXADDPAPER(wxPAPER_ENV_C3, DMPAPER_ENV_C3, "C3 Envelope, 324 x 458 mm", 3240, 4580); - WXADDPAPER(wxPAPER_ENV_C4, DMPAPER_ENV_C4, "C4 Envelope, 229 x 324 mm", 2290, 3240); - WXADDPAPER(wxPAPER_ENV_C6, DMPAPER_ENV_C6, "C6 Envelope, 114 x 162 mm", 1140, 1620); - WXADDPAPER(wxPAPER_ENV_C65, DMPAPER_ENV_C65, "C65 Envelope, 114 x 229 mm", 1140, 2290); - WXADDPAPER(wxPAPER_ENV_B4, DMPAPER_ENV_B4, "B4 Envelope, 250 x 353 mm", 2500, 3530); - WXADDPAPER(wxPAPER_ENV_B5, DMPAPER_ENV_B5, "B5 Envelope, 176 x 250 mm", 1760, 2500); - WXADDPAPER(wxPAPER_ENV_B6, DMPAPER_ENV_B6, "B6 Envelope, 176 x 125 mm", 1760, 1250); - WXADDPAPER(wxPAPER_ENV_ITALY, DMPAPER_ENV_ITALY, "Italy Envelope, 110 x 230 mm", 1100, 2300); - WXADDPAPER(wxPAPER_ENV_MONARCH, DMPAPER_ENV_MONARCH, "Monarch Envelope, 3 7/8 x 7 1/2 in", 984, 1905); - WXADDPAPER(wxPAPER_ENV_PERSONAL, DMPAPER_ENV_PERSONAL, "6 3/4 Envelope, 3 5/8 x 6 1/2 in", 921, 1651); - WXADDPAPER(wxPAPER_FANFOLD_US, DMPAPER_FANFOLD_US, "US Std Fanfold, 14 7/8 x 11 in", 3778, 2794); - WXADDPAPER(wxPAPER_FANFOLD_STD_GERMAN, DMPAPER_FANFOLD_STD_GERMAN, "German Std Fanfold, 8 1/2 x 12 in", 2159, 3048); - WXADDPAPER(wxPAPER_FANFOLD_LGL_GERMAN, DMPAPER_FANFOLD_LGL_GERMAN, "German Legal Fanfold, 8 1/2 x 13 in", 2159, 3302); + WXADDPAPER(wxPAPER_LETTER, DMPAPER_LETTER, wxTRANSLATE("Letter, 8 1/2 x 11 in"), 2159, 2794); + WXADDPAPER(wxPAPER_LEGAL, DMPAPER_LEGAL, wxTRANSLATE("Legal, 8 1/2 x 14 in"), 2159, 3556); + WXADDPAPER(wxPAPER_A4, DMPAPER_A4, wxTRANSLATE("A4 sheet, 210 x 297 mm"), 2100, 2970); + WXADDPAPER(wxPAPER_CSHEET, DMPAPER_CSHEET, wxTRANSLATE("C sheet, 17 x 22 in"), 4318, 5588); + WXADDPAPER(wxPAPER_DSHEET, DMPAPER_DSHEET, wxTRANSLATE("D sheet, 22 x 34 in"), 5588, 8636); + WXADDPAPER(wxPAPER_ESHEET, DMPAPER_ESHEET, wxTRANSLATE("E sheet, 34 x 44 in"), 8636, 11176); + WXADDPAPER(wxPAPER_LETTERSMALL, DMPAPER_LETTERSMALL, wxTRANSLATE("Letter Small, 8 1/2 x 11 in"), 2159, 2794); + WXADDPAPER(wxPAPER_TABLOID, DMPAPER_TABLOID, wxTRANSLATE("Tabloid, 11 x 17 in"), 2794, 4318); + WXADDPAPER(wxPAPER_LEDGER, DMPAPER_LEDGER, wxTRANSLATE("Ledger, 17 x 11 in"), 4318, 2794); + WXADDPAPER(wxPAPER_STATEMENT, DMPAPER_STATEMENT, wxTRANSLATE("Statement, 5 1/2 x 8 1/2 in"), 1397, 2159); + WXADDPAPER(wxPAPER_EXECUTIVE, DMPAPER_EXECUTIVE, wxTRANSLATE("Executive, 7 1/4 x 10 1/2 in"), 1842, 2667); + WXADDPAPER(wxPAPER_A3, DMPAPER_A3, wxTRANSLATE("A3 sheet, 297 x 420 mm"), 2970, 4200); + WXADDPAPER(wxPAPER_A4SMALL, DMPAPER_A4SMALL, wxTRANSLATE("A4 small sheet, 210 x 297 mm"), 2100, 2970); + WXADDPAPER(wxPAPER_A5, DMPAPER_A5, wxTRANSLATE("A5 sheet, 148 x 210 mm"), 1480, 2100); + WXADDPAPER(wxPAPER_B4, DMPAPER_B4, wxTRANSLATE("B4 sheet, 250 x 354 mm"), 2500, 3540); + WXADDPAPER(wxPAPER_B5, DMPAPER_B5, wxTRANSLATE("B5 sheet, 182 x 257 millimeter"), 1820, 2570); + WXADDPAPER(wxPAPER_FOLIO, DMPAPER_FOLIO, wxTRANSLATE("Folio, 8 1/2 x 13 in"), 2159, 3302); + WXADDPAPER(wxPAPER_QUARTO, DMPAPER_QUARTO, wxTRANSLATE("Quarto, 215 x 275 mm"), 2150, 2750); + WXADDPAPER(wxPAPER_10X14, DMPAPER_10X14, wxTRANSLATE("10 x 14 in"), 2540, 3556); + WXADDPAPER(wxPAPER_11X17, DMPAPER_11X17, wxTRANSLATE("11 x 17 in"), 2794, 4318); + WXADDPAPER(wxPAPER_NOTE, DMPAPER_NOTE, wxTRANSLATE("Note, 8 1/2 x 11 in"), 2159, 2794); + WXADDPAPER(wxPAPER_ENV_9, DMPAPER_ENV_9, wxTRANSLATE("#9 Envelope, 3 7/8 x 8 7/8 in"), 984, 2254); + WXADDPAPER(wxPAPER_ENV_10, DMPAPER_ENV_10, wxTRANSLATE("#10 Envelope, 4 1/8 x 9 1/2 in"), 1048, 2413); + WXADDPAPER(wxPAPER_ENV_11, DMPAPER_ENV_11, wxTRANSLATE("#11 Envelope, 4 1/2 x 10 3/8 in"), 1143, 2635); + WXADDPAPER(wxPAPER_ENV_12, DMPAPER_ENV_12, wxTRANSLATE("#12 Envelope, 4 3/4 x 11 in"), 1206, 2794); + WXADDPAPER(wxPAPER_ENV_14, DMPAPER_ENV_14, wxTRANSLATE("#14 Envelope, 5 x 11 1/2 in"), 1270, 2921); + WXADDPAPER(wxPAPER_ENV_DL, DMPAPER_ENV_DL, wxTRANSLATE("DL Envelope, 110 x 220 mm"), 1100, 2200); + WXADDPAPER(wxPAPER_ENV_C5, DMPAPER_ENV_C5, wxTRANSLATE("C5 Envelope, 162 x 229 mm"), 1620, 2290); + WXADDPAPER(wxPAPER_ENV_C3, DMPAPER_ENV_C3, wxTRANSLATE("C3 Envelope, 324 x 458 mm"), 3240, 4580); + WXADDPAPER(wxPAPER_ENV_C4, DMPAPER_ENV_C4, wxTRANSLATE("C4 Envelope, 229 x 324 mm"), 2290, 3240); + WXADDPAPER(wxPAPER_ENV_C6, DMPAPER_ENV_C6, wxTRANSLATE("C6 Envelope, 114 x 162 mm"), 1140, 1620); + WXADDPAPER(wxPAPER_ENV_C65, DMPAPER_ENV_C65, wxTRANSLATE("C65 Envelope, 114 x 229 mm"), 1140, 2290); + WXADDPAPER(wxPAPER_ENV_B4, DMPAPER_ENV_B4, wxTRANSLATE("B4 Envelope, 250 x 353 mm"), 2500, 3530); + WXADDPAPER(wxPAPER_ENV_B5, DMPAPER_ENV_B5, wxTRANSLATE("B5 Envelope, 176 x 250 mm"), 1760, 2500); + WXADDPAPER(wxPAPER_ENV_B6, DMPAPER_ENV_B6, wxTRANSLATE("B6 Envelope, 176 x 125 mm"), 1760, 1250); + WXADDPAPER(wxPAPER_ENV_ITALY, DMPAPER_ENV_ITALY, wxTRANSLATE("Italy Envelope, 110 x 230 mm"), 1100, 2300); + WXADDPAPER(wxPAPER_ENV_MONARCH, DMPAPER_ENV_MONARCH, wxTRANSLATE("Monarch Envelope, 3 7/8 x 7 1/2 in"), 984, 1905); + WXADDPAPER(wxPAPER_ENV_PERSONAL, DMPAPER_ENV_PERSONAL, wxTRANSLATE("6 3/4 Envelope, 3 5/8 x 6 1/2 in"), 921, 1651); + WXADDPAPER(wxPAPER_FANFOLD_US, DMPAPER_FANFOLD_US, wxTRANSLATE("US Std Fanfold, 14 7/8 x 11 in"), 3778, 2794); + WXADDPAPER(wxPAPER_FANFOLD_STD_GERMAN, DMPAPER_FANFOLD_STD_GERMAN, wxTRANSLATE("German Std Fanfold, 8 1/2 x 12 in"), 2159, 3048); + WXADDPAPER(wxPAPER_FANFOLD_LGL_GERMAN, DMPAPER_FANFOLD_LGL_GERMAN, wxTRANSLATE("German Legal Fanfold, 8 1/2 x 13 in"), 2159, 3302); /* Another time! #ifdef __WIN95__ diff --git a/src/common/parser.y b/src/common/parser.y index 141a6280f4..591c10c551 100644 --- a/src/common/parser.y +++ b/src/common/parser.y @@ -156,10 +156,12 @@ void yyerror(char *s) * the UNIX flex expects a proper function. */ -/* Not sure if __SC__ is the appropriate thing - * to test - */ - +/* At least on alphaev6-dec-osf4.0e yywrap() must be #define'd */ +#if defined( __ALPHA__ ) && !defined( __VMS__ ) +#ifndef yywrap +#define yywrap() 1 +#endif +#else /* HH: Added test for __WX_SETUP_H__ for gnuwin builds * using configure */ #if !defined(__SC__) && !defined(__GNUWIN32__) @@ -175,3 +177,5 @@ int yywrap() { return 1; } #elif defined(__WX_SETUP_H__) int yywrap() { return 1; } #endif +#endif + diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 03182d5c25..a233f0f206 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -82,10 +82,12 @@ wxPrinterBase::wxPrinterBase(wxPrintDialogData *data) sm_abortIt = FALSE; if (data) m_printDialogData = (*data); + sm_lastError = wxPRINTER_NO_ERROR; } wxWindow *wxPrinterBase::sm_abortWindow = (wxWindow *) NULL; bool wxPrinterBase::sm_abortIt = FALSE; +wxPrinterError wxPrinterBase::sm_lastError = wxPRINTER_NO_ERROR; wxPrinterBase::~wxPrinterBase() { @@ -653,13 +655,13 @@ bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc) bool wxPrintPreviewBase::RenderPage(int pageNum) { + wxBusyCursor busy; + int canvasWidth, canvasHeight; if (!m_previewCanvas) { - wxFAIL_MSG(_T("wxPrintPreviewBase::RenderPage: must use " - "wxPrintPreviewBase::SetCanvas to let me " - "know about the canvas!")); + wxFAIL_MSG(_T("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!")); return FALSE; } diff --git a/src/common/process.cpp b/src/common/process.cpp index dd80b31466..5a3f23843a 100644 --- a/src/common/process.cpp +++ b/src/common/process.cpp @@ -36,14 +36,21 @@ void wxProcess::Init(wxEvtHandler *parent, int id, bool redirect) m_id = id; m_redirect = redirect; + +#if wxUSE_STREAMS m_inputStream = NULL; + m_errorStream = NULL; m_outputStream = NULL; +#endif // wxUSE_STREAMS } wxProcess::~wxProcess() { +#if wxUSE_STREAMS delete m_inputStream; + delete m_errorStream; delete m_outputStream; +#endif // wxUSE_STREAMS } void wxProcess::OnTerminate(int pid, int status) @@ -61,9 +68,15 @@ void wxProcess::Detach() SetNextHandler(NULL); } -void wxProcess::SetPipeStreams(wxInputStream *in_stream, wxOutputStream *out_stream) +#if wxUSE_STREAMS + +void wxProcess::SetPipeStreams(wxInputStream *inputSstream, + wxOutputStream *outputStream, + wxInputStream *errorStream) { - m_inputStream = in_stream; - m_outputStream = out_stream; + m_inputStream = inputSstream; + m_errorStream = errorStream; + m_outputStream = outputStream; } +#endif // wxUSE_STREAMS diff --git a/src/common/resource.cpp b/src/common/resource.cpp index 27305db69a..e80276a71e 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -23,7 +23,7 @@ #if wxUSE_WX_RESOURCES #ifdef __VISUALC__ - #pragma warning(disable:4706) // assignment within conditional expression +#pragma warning(disable:4706) // assignment within conditional expression #endif // VC++ #ifndef WX_PRECOMP @@ -118,7 +118,7 @@ void wxCleanUpResourceSystem() void wxLogWarning(char *msg) { - wxMessageBox(msg, _("Warning"), wxOK); + wxMessageBox(msg, _("Warning"), wxOK); } IMPLEMENT_DYNAMIC_CLASS(wxItemResource, wxObject) @@ -126,32 +126,32 @@ IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable) wxItemResource::wxItemResource() { - m_itemType = ""; - m_title = ""; - m_name = ""; - m_windowStyle = 0; - m_x = m_y = m_width = m_height = 0; - m_value1 = m_value2 = m_value3 = m_value5 = 0; - m_value4 = ""; - m_windowId = 0; - m_exStyle = 0; + m_itemType = ""; + m_title = ""; + m_name = ""; + m_windowStyle = 0; + m_x = m_y = m_width = m_height = 0; + m_value1 = m_value2 = m_value3 = m_value5 = 0; + m_value4 = ""; + m_windowId = 0; + m_exStyle = 0; } wxItemResource::~wxItemResource() { - wxNode *node = m_children.First(); - while (node) - { - wxItemResource *item = (wxItemResource *)node->Data(); - delete item; - delete node; - node = m_children.First(); - } + wxNode *node = m_children.First(); + while (node) + { + wxItemResource *item = (wxItemResource *)node->Data(); + delete item; + delete node; + node = m_children.First(); + } } /* - * Resource table - */ +* Resource table +*/ wxResourceTable::wxResourceTable():wxHashTable(wxKEY_STRING), identifiers(wxKEY_STRING) { @@ -159,3067 +159,3075 @@ wxResourceTable::wxResourceTable():wxHashTable(wxKEY_STRING), identifiers(wxKEY_ wxResourceTable::~wxResourceTable() { - ClearTable(); + ClearTable(); } wxItemResource *wxResourceTable::FindResource(const wxString& name) const { - wxItemResource *item = (wxItemResource *)Get(WXSTRINGCAST name); - return item; + wxItemResource *item = (wxItemResource *)Get(WXSTRINGCAST name); + return item; } void wxResourceTable::AddResource(wxItemResource *item) { - wxString name = item->GetName(); - if (name == wxT("")) - name = item->GetTitle(); - if (name == wxT("")) - name = wxT("no name"); - - // Delete existing resource, if any. - Delete(name); - - Put(name, item); + wxString name = item->GetName(); + if (name == wxT("")) + name = item->GetTitle(); + if (name == wxT("")) + name = wxT("no name"); + + // Delete existing resource, if any. + Delete(name); + + Put(name, item); } bool wxResourceTable::DeleteResource(const wxString& name) { - wxItemResource *item = (wxItemResource *)Delete(WXSTRINGCAST name); - if (item) - { - // See if any resource has this as its child; if so, delete from - // parent's child list. - BeginFind(); - wxNode *node = (wxNode *) NULL; - node = Next(); - while (node != NULL) + wxItemResource *item = (wxItemResource *)Delete(WXSTRINGCAST name); + if (item) { - wxItemResource *parent = (wxItemResource *)node->Data(); - if (parent->GetChildren().Member(item)) - { - parent->GetChildren().DeleteObject(item); - break; - } - node = Next(); + // See if any resource has this as its child; if so, delete from + // parent's child list. + BeginFind(); + wxNode *node = (wxNode *) NULL; + node = Next(); + while (node != NULL) + { + wxItemResource *parent = (wxItemResource *)node->Data(); + if (parent->GetChildren().Member(item)) + { + parent->GetChildren().DeleteObject(item); + break; + } + node = Next(); + } + + delete item; + return TRUE; } - - delete item; - return TRUE; - } - else - return FALSE; + else + return FALSE; } bool wxResourceTable::ParseResourceFile( wxInputStream *is ) { - wxExprDatabase db; - int len = is->StreamSize() ; - - bool eof = FALSE; - while ( is->TellI() + 10 < len) // it's a hack because the streams dont support EOF - { - wxResourceReadOneResource(is, db, &eof, this) ; - } - return wxResourceInterpretResources(*this, db); + wxExprDatabase db; + int len = is->StreamSize() ; + + bool eof = FALSE; + while ( is->TellI() + 10 < len) // it's a hack because the streams dont support EOF + { + wxResourceReadOneResource(is, db, &eof, this) ; + } + return wxResourceInterpretResources(*this, db); } bool wxResourceTable::ParseResourceFile(const wxString& filename) { - wxExprDatabase db; - + wxExprDatabase db; + #ifdef __WXMAC__ - FILE *fd = fopen(wxUnix2MacFilename(filename.fn_str()), "r"); + FILE *fd = fopen(wxUnix2MacFilename(filename.fn_str()), "r"); #else - FILE *fd = fopen(filename.fn_str(), "r"); + FILE *fd = wxFopen(filename, _T("r")); #endif - if (!fd) - return FALSE; - bool eof = FALSE; - while (wxResourceReadOneResource(fd, db, &eof, this) && !eof) - { - // Loop - } - fclose(fd); - return wxResourceInterpretResources(*this, db); + if (!fd) + return FALSE; + bool eof = FALSE; + while (wxResourceReadOneResource(fd, db, &eof, this) && !eof) + { + // Loop + } + fclose(fd); + return wxResourceInterpretResources(*this, db); } bool wxResourceTable::ParseResourceData(const wxString& data) { - wxExprDatabase db; - if (!db.ReadFromString(data)) - { - wxLogWarning(_("Ill-formed resource file syntax.")); - return FALSE; - } - - return wxResourceInterpretResources(*this, db); + wxExprDatabase db; + if (!db.ReadFromString(data)) + { + wxLogWarning(_("Ill-formed resource file syntax.")); + return FALSE; + } + + return wxResourceInterpretResources(*this, db); } bool wxResourceTable::RegisterResourceBitmapData(const wxString& name, char bits[], int width, int height) { - // Register pre-loaded bitmap data - wxItemResource *item = new wxItemResource; -// item->SetType(wxRESOURCE_TYPE_XBM_DATA); - item->SetType(wxT("wxXBMData")); - item->SetName(name); - item->SetValue1((long)bits); - item->SetValue2((long)width); - item->SetValue3((long)height); - AddResource(item); - return TRUE; + // Register pre-loaded bitmap data + wxItemResource *item = new wxItemResource; + // item->SetType(wxRESOURCE_TYPE_XBM_DATA); + item->SetType(wxT("wxXBMData")); + item->SetName(name); + item->SetValue1((long)bits); + item->SetValue2((long)width); + item->SetValue3((long)height); + AddResource(item); + return TRUE; } bool wxResourceTable::RegisterResourceBitmapData(const wxString& name, char **data) { - // Register pre-loaded bitmap data - wxItemResource *item = new wxItemResource; -// item->SetType(wxRESOURCE_TYPE_XPM_DATA); - item->SetType(wxT("wxXPMData")); - item->SetName(name); - item->SetValue1((long)data); - AddResource(item); - return TRUE; + // Register pre-loaded bitmap data + wxItemResource *item = new wxItemResource; + // item->SetType(wxRESOURCE_TYPE_XPM_DATA); + item->SetType(wxT("wxXPMData")); + item->SetName(name); + item->SetValue1((long)data); + AddResource(item); + return TRUE; } bool wxResourceTable::SaveResource(const wxString& WXUNUSED(filename)) { - return FALSE; + return FALSE; } void wxResourceTable::ClearTable() { - BeginFind(); - wxNode *node = Next(); - while (node) - { - wxNode *next = Next(); - wxItemResource *item = (wxItemResource *)node->Data(); - delete item; - delete node; - node = next; - } + BeginFind(); + wxNode *node = Next(); + while (node) + { + wxNode *next = Next(); + wxItemResource *item = (wxItemResource *)node->Data(); + delete item; + delete node; + node = next; + } } wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* childResource, const wxItemResource* parentResource) const { - int id = childResource->GetId(); - if ( id == 0 ) - id = -1; - - bool dlgUnits = ((parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0); - - wxControl *control = (wxControl *) NULL; - wxString itemType(childResource->GetType()); - - wxPoint pos; - wxSize size; - if (dlgUnits) - { - pos = parent->ConvertDialogToPixels(wxPoint(childResource->GetX(), childResource->GetY())); - size = parent->ConvertDialogToPixels(wxSize(childResource->GetWidth(), childResource->GetHeight())); - } - else - { - pos = wxPoint(childResource->GetX(), childResource->GetY()); - size = wxSize(childResource->GetWidth(), childResource->GetHeight()); - } - - if (itemType == wxString(wxT("wxButton")) || itemType == wxString(wxT("wxBitmapButton"))) - { + int id = childResource->GetId(); + if ( id == 0 ) + id = -1; + + bool dlgUnits = ((parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0); + + wxControl *control = (wxControl *) NULL; + wxString itemType(childResource->GetType()); + + wxPoint pos; + wxSize size; + if (dlgUnits) + { + pos = parent->ConvertDialogToPixels(wxPoint(childResource->GetX(), childResource->GetY())); + size = parent->ConvertDialogToPixels(wxSize(childResource->GetWidth(), childResource->GetHeight())); + } + else + { + pos = wxPoint(childResource->GetX(), childResource->GetY()); + size = wxSize(childResource->GetWidth(), childResource->GetHeight()); + } + + if (itemType == wxString(wxT("wxButton")) || itemType == wxString(wxT("wxBitmapButton"))) + { if (childResource->GetValue4() != wxT("")) { - // Bitmap button - wxBitmap bitmap = childResource->GetBitmap(); - if (!bitmap.Ok()) - { - bitmap = wxResourceCreateBitmap(childResource->GetValue4(), (wxResourceTable *)this); - ((wxItemResource*) childResource)->SetBitmap(bitmap); - } - if (bitmap.Ok()) - control = new wxBitmapButton(parent, id, bitmap, pos, size, - childResource->GetStyle() | wxBU_AUTODRAW, wxDefaultValidator, childResource->GetName()); + // Bitmap button + wxBitmap bitmap = childResource->GetBitmap(); + if (!bitmap.Ok()) + { + bitmap = wxResourceCreateBitmap(childResource->GetValue4(), (wxResourceTable *)this); + ((wxItemResource*) childResource)->SetBitmap(bitmap); + } + if (!bitmap.Ok()) + bitmap.LoadFile("cross_bmp", wxBITMAP_TYPE_BMP_RESOURCE); + control = new wxBitmapButton(parent, id, bitmap, pos, size, + childResource->GetStyle() | wxBU_AUTODRAW, wxDefaultValidator, childResource->GetName()); } else - // Normal, text button - control = new wxButton(parent, id, childResource->GetTitle(), pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - } - else if (itemType == wxString(wxT("wxMessage")) || itemType == wxString(wxT("wxStaticText")) || - itemType == wxString(wxT("wxStaticBitmap"))) - { + // Normal, text button + control = new wxButton(parent, id, childResource->GetTitle(), pos, size, + childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + } + else if (itemType == wxString(wxT("wxMessage")) || itemType == wxString(wxT("wxStaticText")) || + itemType == wxString(wxT("wxStaticBitmap"))) + { if (childResource->GetValue4() != wxT("") || itemType == wxString(wxT("wxStaticBitmap")) ) { - // Bitmap message - wxBitmap bitmap = childResource->GetBitmap(); - if (!bitmap.Ok()) - { - bitmap = wxResourceCreateBitmap(childResource->GetValue4(), (wxResourceTable *)this); - ((wxItemResource*) childResource)->SetBitmap(bitmap); - } + // Bitmap message + wxBitmap bitmap = childResource->GetBitmap(); + if (!bitmap.Ok()) + { + bitmap = wxResourceCreateBitmap(childResource->GetValue4(), (wxResourceTable *)this); + ((wxItemResource*) childResource)->SetBitmap(bitmap); + } #if wxUSE_BITMAP_MESSAGE #ifdef __WXMSW__ - // Use a default bitmap - if (!bitmap.Ok()) - bitmap.LoadFile("cross_bmp", wxBITMAP_TYPE_BMP_RESOURCE); + // Use a default bitmap + if (!bitmap.Ok()) + bitmap.LoadFile("cross_bmp", wxBITMAP_TYPE_BMP_RESOURCE); #endif - - if (bitmap.Ok()) - control = new wxStaticBitmap(parent, id, bitmap, pos, size, - childResource->GetStyle(), childResource->GetName()); + + if (bitmap.Ok()) + control = new wxStaticBitmap(parent, id, bitmap, pos, size, + childResource->GetStyle(), childResource->GetName()); #endif } else { - control = new wxStaticText(parent, id, childResource->GetTitle(), pos, size, - childResource->GetStyle(), childResource->GetName()); + control = new wxStaticText(parent, id, childResource->GetTitle(), pos, size, + childResource->GetStyle(), childResource->GetName()); } - } - else if (itemType == wxString(wxT("wxText")) || itemType == wxString(wxT("wxTextCtrl")) || itemType == wxString(wxT("wxMultiText"))) - { + } + else if (itemType == wxString(wxT("wxText")) || itemType == wxString(wxT("wxTextCtrl")) || itemType == wxString(wxT("wxMultiText"))) + { control = new wxTextCtrl(parent, id, childResource->GetValue4(), pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - } - else if (itemType == wxString(wxT("wxCheckBox"))) - { + childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + } + else if (itemType == wxString(wxT("wxCheckBox"))) + { control = new wxCheckBox(parent, id, childResource->GetTitle(), pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - + childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + ((wxCheckBox *)control)->SetValue((childResource->GetValue1() != 0)); - } + } #if wxUSE_GAUGE - else if (itemType == wxString(wxT("wxGauge"))) - { + else if (itemType == wxString(wxT("wxGauge"))) + { control = new wxGauge(parent, id, (int)childResource->GetValue2(), pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - + childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + ((wxGauge *)control)->SetValue((int)childResource->GetValue1()); - } + } #endif #if wxUSE_RADIOBTN - else if (itemType == wxString(wxT("wxRadioButton"))) - { + else if (itemType == wxString(wxT("wxRadioButton"))) + { control = new wxRadioButton(parent, id, childResource->GetTitle(), // (int)childResource->GetValue1(), - pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - } + pos, size, + childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + } #endif #if wxUSE_SCROLLBAR - else if (itemType == wxString(wxT("wxScrollBar"))) - { + else if (itemType == wxString(wxT("wxScrollBar"))) + { control = new wxScrollBar(parent, id, pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); -/* - ((wxScrollBar *)control)->SetValue((int)childResource->GetValue1()); - ((wxScrollBar *)control)->SetPageSize((int)childResource->GetValue2()); - ((wxScrollBar *)control)->SetObjectLength((int)childResource->GetValue3()); - ((wxScrollBar *)control)->SetViewLength((int)(long)childResource->GetValue5()); -*/ - ((wxScrollBar *)control)->SetScrollbar((int)childResource->GetValue1(),(int)childResource->GetValue2(), - (int)childResource->GetValue3(),(int)(long)childResource->GetValue5(),FALSE); - - } + childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + /* + ((wxScrollBar *)control)->SetValue((int)childResource->GetValue1()); + ((wxScrollBar *)control)->SetPageSize((int)childResource->GetValue2()); + ((wxScrollBar *)control)->SetObjectLength((int)childResource->GetValue3()); + ((wxScrollBar *)control)->SetViewLength((int)(long)childResource->GetValue5()); + */ + ((wxScrollBar *)control)->SetScrollbar((int)childResource->GetValue1(),(int)childResource->GetValue2(), + (int)childResource->GetValue3(),(int)(long)childResource->GetValue5(),FALSE); + + } #endif - else if (itemType == wxString(wxT("wxSlider"))) - { + else if (itemType == wxString(wxT("wxSlider"))) + { control = new wxSlider(parent, id, (int)childResource->GetValue1(), - (int)childResource->GetValue2(), (int)childResource->GetValue3(), pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - } - else if (itemType == wxString(wxT("wxGroupBox")) || itemType == wxString(wxT("wxStaticBox"))) - { + (int)childResource->GetValue2(), (int)childResource->GetValue3(), pos, size, + childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + } + else if (itemType == wxString(wxT("wxGroupBox")) || itemType == wxString(wxT("wxStaticBox"))) + { control = new wxStaticBox(parent, id, childResource->GetTitle(), pos, size, - childResource->GetStyle(), childResource->GetName()); - } - else if (itemType == wxString(wxT("wxListBox"))) - { + childResource->GetStyle(), childResource->GetName()); + } + else if (itemType == wxString(wxT("wxListBox"))) + { wxStringList& stringList = childResource->GetStringValues(); wxString *strings = (wxString *) NULL; int noStrings = 0; if (stringList.Number() > 0) { - noStrings = stringList.Number(); - strings = new wxString[noStrings]; - wxNode *node = stringList.First(); - int i = 0; - while (node) - { - strings[i] = (wxChar *)node->Data(); - i ++; - node = node->Next(); - } + noStrings = stringList.Number(); + strings = new wxString[noStrings]; + wxNode *node = stringList.First(); + int i = 0; + while (node) + { + strings[i] = (wxChar *)node->Data(); + i ++; + node = node->Next(); + } } control = new wxListBox(parent, id, pos, size, - noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - + noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + if (strings) - delete[] strings; - } - else if (itemType == wxString(wxT("wxChoice"))) - { + delete[] strings; + } + else if (itemType == wxString(wxT("wxChoice"))) + { wxStringList& stringList = childResource->GetStringValues(); wxString *strings = (wxString *) NULL; int noStrings = 0; if (stringList.Number() > 0) { - noStrings = stringList.Number(); - strings = new wxString[noStrings]; - wxNode *node = stringList.First(); - int i = 0; - while (node) - { - strings[i] = (wxChar *)node->Data(); - i ++; - node = node->Next(); - } + noStrings = stringList.Number(); + strings = new wxString[noStrings]; + wxNode *node = stringList.First(); + int i = 0; + while (node) + { + strings[i] = (wxChar *)node->Data(); + i ++; + node = node->Next(); + } } control = new wxChoice(parent, id, pos, size, - noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - + noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + if (strings) - delete[] strings; - } + delete[] strings; + } #if wxUSE_COMBOBOX - else if (itemType == wxString(wxT("wxComboBox"))) - { + else if (itemType == wxString(wxT("wxComboBox"))) + { wxStringList& stringList = childResource->GetStringValues(); wxString *strings = (wxString *) NULL; int noStrings = 0; if (stringList.Number() > 0) { - noStrings = stringList.Number(); - strings = new wxString[noStrings]; - wxNode *node = stringList.First(); - int i = 0; - while (node) - { - strings[i] = (wxChar *)node->Data(); - i ++; - node = node->Next(); - } + noStrings = stringList.Number(); + strings = new wxString[noStrings]; + wxNode *node = stringList.First(); + int i = 0; + while (node) + { + strings[i] = (wxChar *)node->Data(); + i ++; + node = node->Next(); + } } control = new wxComboBox(parent, id, childResource->GetValue4(), pos, size, - noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - + noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + if (strings) - delete[] strings; - } + delete[] strings; + } #endif - else if (itemType == wxString(wxT("wxRadioBox"))) - { + else if (itemType == wxString(wxT("wxRadioBox"))) + { wxStringList& stringList = childResource->GetStringValues(); wxString *strings = (wxString *) NULL; int noStrings = 0; if (stringList.Number() > 0) { - noStrings = stringList.Number(); - strings = new wxString[noStrings]; - wxNode *node = stringList.First(); - int i = 0; - while (node) - { - strings[i] = (wxChar *)node->Data(); - i ++; - node = node->Next(); - } + noStrings = stringList.Number(); + strings = new wxString[noStrings]; + wxNode *node = stringList.First(); + int i = 0; + while (node) + { + strings[i] = (wxChar *)node->Data(); + i ++; + node = node->Next(); + } } control = new wxRadioBox(parent, (wxWindowID) id, wxString(childResource->GetTitle()), pos, size, - noStrings, strings, (int)childResource->GetValue1(), childResource->GetStyle(), wxDefaultValidator, - childResource->GetName()); - + noStrings, strings, (int)childResource->GetValue1(), childResource->GetStyle(), wxDefaultValidator, + childResource->GetName()); + if (strings) - delete[] strings; - } - - if ((parentResource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) - { - // Don't set font; will be inherited from parent. - } - else - { - if (control && childResource->GetFont().Ok()) + delete[] strings; + } + + if ((parentResource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) { - control->SetFont(childResource->GetFont()); - + // Don't set font; will be inherited from parent. + } + else + { + if (control && childResource->GetFont().Ok()) + { + control->SetFont(childResource->GetFont()); + #ifdef __WXMSW__ - // Force the layout algorithm since the size changes the layout - if (control->IsKindOf(CLASSINFO(wxRadioBox))) - { - control->SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT); - } + // Force the layout algorithm since the size changes the layout + if (control->IsKindOf(CLASSINFO(wxRadioBox))) + { + control->SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT); + } #endif + } } - } - return control; + return control; } /* - * Interpret database as a series of resources - */ +* Interpret database as a series of resources +*/ bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db) { - wxNode *node = db.First(); - while (node) - { - wxExpr *clause = (wxExpr *)node->Data(); - wxString functor(clause->Functor()); - - wxItemResource *item = (wxItemResource *) NULL; - if (functor == wxT("dialog")) - item = wxResourceInterpretDialog(table, clause); - else if (functor == wxT("panel")) - item = wxResourceInterpretDialog(table, clause, TRUE); - else if (functor == wxT("menubar")) - item = wxResourceInterpretMenuBar(table, clause); - else if (functor == wxT("menu")) - item = wxResourceInterpretMenu(table, clause); - else if (functor == wxT("string")) - item = wxResourceInterpretString(table, clause); - else if (functor == wxT("bitmap")) - item = wxResourceInterpretBitmap(table, clause); - else if (functor == wxT("icon")) - item = wxResourceInterpretIcon(table, clause); - - if (item) + wxNode *node = db.First(); + while (node) { - // Remove any existing resource of same name - if (item->GetName() != wxT("")) - table.DeleteResource(item->GetName()); - table.AddResource(item); + wxExpr *clause = (wxExpr *)node->Data(); + wxString functor(clause->Functor()); + + wxItemResource *item = (wxItemResource *) NULL; + if (functor == wxT("dialog")) + item = wxResourceInterpretDialog(table, clause); + else if (functor == wxT("panel")) + item = wxResourceInterpretDialog(table, clause, TRUE); + else if (functor == wxT("menubar")) + item = wxResourceInterpretMenuBar(table, clause); + else if (functor == wxT("menu")) + item = wxResourceInterpretMenu(table, clause); + else if (functor == wxT("string")) + item = wxResourceInterpretString(table, clause); + else if (functor == wxT("bitmap")) + item = wxResourceInterpretBitmap(table, clause); + else if (functor == wxT("icon")) + item = wxResourceInterpretIcon(table, clause); + + if (item) + { + // Remove any existing resource of same name + if (item->GetName() != wxT("")) + table.DeleteResource(item->GetName()); + table.AddResource(item); + } + node = node->Next(); } - node = node->Next(); - } - return TRUE; + return TRUE; } static const wxChar *g_ValidControlClasses[] = { wxT("wxButton"), - wxT("wxBitmapButton"), - wxT("wxMessage"), - wxT("wxStaticText"), - wxT("wxStaticBitmap"), - wxT("wxText"), - wxT("wxTextCtrl"), - wxT("wxMultiText"), - wxT("wxListBox"), - wxT("wxRadioBox"), - wxT("wxRadioButton"), - wxT("wxCheckBox"), - wxT("wxBitmapCheckBox"), - wxT("wxGroupBox"), - wxT("wxStaticBox"), - wxT("wxSlider"), - wxT("wxGauge"), - wxT("wxScrollBar"), - wxT("wxChoice"), - wxT("wxComboBox") + wxT("wxBitmapButton"), + wxT("wxMessage"), + wxT("wxStaticText"), + wxT("wxStaticBitmap"), + wxT("wxText"), + wxT("wxTextCtrl"), + wxT("wxMultiText"), + wxT("wxListBox"), + wxT("wxRadioBox"), + wxT("wxRadioButton"), + wxT("wxCheckBox"), + wxT("wxBitmapCheckBox"), + wxT("wxGroupBox"), + wxT("wxStaticBox"), + wxT("wxSlider"), + wxT("wxGauge"), + wxT("wxScrollBar"), + wxT("wxChoice"), + wxT("wxComboBox") }; static bool wxIsValidControlClass(const wxString& c) { - for ( size_t i = 0; i < WXSIZEOF(g_ValidControlClasses); i++ ) - { - if ( c == g_ValidControlClasses[i] ) - return TRUE; - } - return FALSE; + for ( size_t i = 0; i < WXSIZEOF(g_ValidControlClasses); i++ ) + { + if ( c == g_ValidControlClasses[i] ) + return TRUE; + } + return FALSE; } wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel) { - wxItemResource *dialogItem = new wxItemResource; - if (isPanel) - dialogItem->SetType(wxT("wxPanel")); - else - dialogItem->SetType(wxT("wxDialog")); - wxString style = wxT(""); - wxString title = wxT(""); - wxString name = wxT(""); - wxString backColourHex = wxT(""); - wxString labelColourHex = wxT(""); - wxString buttonColourHex = wxT(""); - - long windowStyle = wxDEFAULT_DIALOG_STYLE; - if (isPanel) - windowStyle = 0; - - int x = 0; int y = 0; int width = -1; int height = -1; - int isModal = 0; - wxExpr *labelFontExpr = (wxExpr *) NULL; - wxExpr *buttonFontExpr = (wxExpr *) NULL; - wxExpr *fontExpr = (wxExpr *) NULL; - expr->GetAttributeValue(wxT("style"), style); - expr->GetAttributeValue(wxT("name"), name); - expr->GetAttributeValue(wxT("title"), title); - expr->GetAttributeValue(wxT("x"), x); - expr->GetAttributeValue(wxT("y"), y); - expr->GetAttributeValue(wxT("width"), width); - expr->GetAttributeValue(wxT("height"), height); - expr->GetAttributeValue(wxT("modal"), isModal); - expr->GetAttributeValue(wxT("label_font"), &labelFontExpr); - expr->GetAttributeValue(wxT("button_font"), &buttonFontExpr); - expr->GetAttributeValue(wxT("font"), &fontExpr); - expr->GetAttributeValue(wxT("background_colour"), backColourHex); - expr->GetAttributeValue(wxT("label_colour"), labelColourHex); - expr->GetAttributeValue(wxT("button_colour"), buttonColourHex); - - int useDialogUnits = 0; - expr->GetAttributeValue(wxT("use_dialog_units"), useDialogUnits); - if (useDialogUnits != 0) - dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_DIALOG_UNITS); - - int useDefaults = 0; - expr->GetAttributeValue(wxT("use_system_defaults"), useDefaults); - if (useDefaults != 0) - dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_USE_DEFAULTS); - - int id = 0; - expr->GetAttributeValue(wxT("id"), id); - dialogItem->SetId(id); - - if (style != wxT("")) - { - windowStyle = wxParseWindowStyle(style); - } - dialogItem->SetStyle(windowStyle); - dialogItem->SetValue1(isModal); - if (windowStyle & wxDIALOG_MODAL) // Uses style in wxWin 2 - dialogItem->SetValue1(TRUE); - - dialogItem->SetName(name); - dialogItem->SetTitle(title); - dialogItem->SetSize(x, y, width, height); - - if (backColourHex != wxT("")) - { - int r = 0; - int g = 0; - int b = 0; - r = wxHexToDec(backColourHex.Mid(0, 2)); - g = wxHexToDec(backColourHex.Mid(2, 2)); - b = wxHexToDec(backColourHex.Mid(4, 2)); - dialogItem->SetBackgroundColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); - } - if (labelColourHex != wxT("")) - { - int r = 0; - int g = 0; - int b = 0; - r = wxHexToDec(labelColourHex.Mid(0, 2)); - g = wxHexToDec(labelColourHex.Mid(2, 2)); - b = wxHexToDec(labelColourHex.Mid(4, 2)); - dialogItem->SetLabelColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); - } - if (buttonColourHex != wxT("")) - { - int r = 0; - int g = 0; - int b = 0; - r = wxHexToDec(buttonColourHex.Mid(0, 2)); - g = wxHexToDec(buttonColourHex.Mid(2, 2)); - b = wxHexToDec(buttonColourHex.Mid(4, 2)); - dialogItem->SetButtonColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); - } - - if (fontExpr) - dialogItem->SetFont(wxResourceInterpretFontSpec(fontExpr)); - else if (buttonFontExpr) - dialogItem->SetFont(wxResourceInterpretFontSpec(buttonFontExpr)); - else if (labelFontExpr) - dialogItem->SetFont(wxResourceInterpretFontSpec(labelFontExpr)); - - // Now parse all controls - wxExpr *controlExpr = expr->GetFirst(); - while (controlExpr) - { - if (controlExpr->Number() == 3) - { - wxString controlKeyword(controlExpr->Nth(1)->StringValue()); - if (controlKeyword != wxT("") && controlKeyword == wxT("control")) - { - // The value part: always a list. - wxExpr *listExpr = controlExpr->Nth(2); - if (listExpr->Type() == PrologList) + wxItemResource *dialogItem = new wxItemResource; + if (isPanel) + dialogItem->SetType(wxT("wxPanel")); + else + dialogItem->SetType(wxT("wxDialog")); + wxString style = wxT(""); + wxString title = wxT(""); + wxString name = wxT(""); + wxString backColourHex = wxT(""); + wxString labelColourHex = wxT(""); + wxString buttonColourHex = wxT(""); + + long windowStyle = wxDEFAULT_DIALOG_STYLE; + if (isPanel) + windowStyle = 0; + + int x = 0; int y = 0; int width = -1; int height = -1; + int isModal = 0; + wxExpr *labelFontExpr = (wxExpr *) NULL; + wxExpr *buttonFontExpr = (wxExpr *) NULL; + wxExpr *fontExpr = (wxExpr *) NULL; + expr->GetAttributeValue(wxT("style"), style); + expr->GetAttributeValue(wxT("name"), name); + expr->GetAttributeValue(wxT("title"), title); + expr->GetAttributeValue(wxT("x"), x); + expr->GetAttributeValue(wxT("y"), y); + expr->GetAttributeValue(wxT("width"), width); + expr->GetAttributeValue(wxT("height"), height); + expr->GetAttributeValue(wxT("modal"), isModal); + expr->GetAttributeValue(wxT("label_font"), &labelFontExpr); + expr->GetAttributeValue(wxT("button_font"), &buttonFontExpr); + expr->GetAttributeValue(wxT("font"), &fontExpr); + expr->GetAttributeValue(wxT("background_colour"), backColourHex); + expr->GetAttributeValue(wxT("label_colour"), labelColourHex); + expr->GetAttributeValue(wxT("button_colour"), buttonColourHex); + + int useDialogUnits = 0; + expr->GetAttributeValue(wxT("use_dialog_units"), useDialogUnits); + if (useDialogUnits != 0) + dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_DIALOG_UNITS); + + int useDefaults = 0; + expr->GetAttributeValue(wxT("use_system_defaults"), useDefaults); + if (useDefaults != 0) + dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_USE_DEFAULTS); + + int id = 0; + expr->GetAttributeValue(wxT("id"), id); + dialogItem->SetId(id); + + if (style != wxT("")) + { + windowStyle = wxParseWindowStyle(style); + } + dialogItem->SetStyle(windowStyle); + dialogItem->SetValue1(isModal); + if (windowStyle & wxDIALOG_MODAL) // Uses style in wxWin 2 + dialogItem->SetValue1(TRUE); + + dialogItem->SetName(name); + dialogItem->SetTitle(title); + dialogItem->SetSize(x, y, width, height); + + // Check for wxWin 1.68-style specifications + if (style.Find(wxT("VERTICAL_LABEL")) != -1) + dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_VERTICAL_LABEL); + else if (style.Find(wxT("HORIZONTAL_LABEL")) != -1) + dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_HORIZONTAL_LABEL); + + if (backColourHex != wxT("")) + { + int r = 0; + int g = 0; + int b = 0; + r = wxHexToDec(backColourHex.Mid(0, 2)); + g = wxHexToDec(backColourHex.Mid(2, 2)); + b = wxHexToDec(backColourHex.Mid(4, 2)); + dialogItem->SetBackgroundColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); + } + if (labelColourHex != wxT("")) + { + int r = 0; + int g = 0; + int b = 0; + r = wxHexToDec(labelColourHex.Mid(0, 2)); + g = wxHexToDec(labelColourHex.Mid(2, 2)); + b = wxHexToDec(labelColourHex.Mid(4, 2)); + dialogItem->SetLabelColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); + } + if (buttonColourHex != wxT("")) + { + int r = 0; + int g = 0; + int b = 0; + r = wxHexToDec(buttonColourHex.Mid(0, 2)); + g = wxHexToDec(buttonColourHex.Mid(2, 2)); + b = wxHexToDec(buttonColourHex.Mid(4, 2)); + dialogItem->SetButtonColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); + } + + if (fontExpr) + dialogItem->SetFont(wxResourceInterpretFontSpec(fontExpr)); + else if (buttonFontExpr) + dialogItem->SetFont(wxResourceInterpretFontSpec(buttonFontExpr)); + else if (labelFontExpr) + dialogItem->SetFont(wxResourceInterpretFontSpec(labelFontExpr)); + + // Now parse all controls + wxExpr *controlExpr = expr->GetFirst(); + while (controlExpr) + { + if (controlExpr->Number() == 3) { - wxItemResource *controlItem = wxResourceInterpretControl(table, listExpr); - if (controlItem) - { - dialogItem->GetChildren().Append(controlItem); - } + wxString controlKeyword(controlExpr->Nth(1)->StringValue()); + if (controlKeyword != wxT("") && controlKeyword == wxT("control")) + { + // The value part: always a list. + wxExpr *listExpr = controlExpr->Nth(2); + if (listExpr->Type() == PrologList) + { + wxItemResource *controlItem = wxResourceInterpretControl(table, listExpr); + if (controlItem) + { + dialogItem->GetChildren().Append(controlItem); + } + } + } } - } + controlExpr = controlExpr->GetNext(); } - controlExpr = controlExpr->GetNext(); - } - return dialogItem; + return dialogItem; } wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) { - wxItemResource *controlItem = new wxItemResource; - - // First, find the standard features of a control definition: - // [optional integer/string id], control name, title, style, name, x, y, width, height - - wxString controlType; - wxString style; - wxString title; - wxString name; - int id = 0; - long windowStyle = 0; - int x = 0; int y = 0; int width = -1; int height = -1; - int count = 0; - - wxExpr *expr1 = expr->Nth(0); - - if ( expr1->Type() == PrologString || expr1->Type() == PrologWord ) - { - if ( wxIsValidControlClass(expr1->StringValue()) ) - { - count = 1; - controlType = expr1->StringValue(); - } - else - { - wxString str(expr1->StringValue()); - id = wxResourceGetIdentifier(str, &table); - if (id == 0) + wxItemResource *controlItem = new wxItemResource; + + // First, find the standard features of a control definition: + // [optional integer/string id], control name, title, style, name, x, y, width, height + + wxString controlType; + wxString style; + wxString title; + wxString name; + int id = 0; + long windowStyle = 0; + int x = 0; int y = 0; int width = -1; int height = -1; + int count = 0; + + wxExpr *expr1 = expr->Nth(0); + + if ( expr1->Type() == PrologString || expr1->Type() == PrologWord ) + { + if ( wxIsValidControlClass(expr1->StringValue()) ) { - wxLogWarning(_("Could not resolve control class or id '%s'. " - "Use (non-zero) integer instead\n or provide #define " - "(see manual for caveats)"), - (const wxChar*) expr1->StringValue()); - delete controlItem; - return (wxItemResource *) NULL; + count = 1; + controlType = expr1->StringValue(); } - else - { - // Success - we have an id, so the 2nd element must be the control class. - controlType = expr->Nth(1)->StringValue(); - count = 2; - } - } - } - else if (expr1->Type() == PrologInteger) - { - id = (int)expr1->IntegerValue(); - // Success - we have an id, so the 2nd element must be the control class. - controlType = expr->Nth(1)->StringValue(); - count = 2; - } - - expr1 = expr->Nth(count); - count ++; - if ( expr1 ) - title = expr1->StringValue(); - - expr1 = expr->Nth(count); - count ++; - if (expr1) - { - style = expr1->StringValue(); - windowStyle = wxParseWindowStyle(style); - } - - expr1 = expr->Nth(count); - count ++; - if (expr1) - name = expr1->StringValue(); - - expr1 = expr->Nth(count); - count ++; - if (expr1) - x = (int)expr1->IntegerValue(); - - expr1 = expr->Nth(count); - count ++; - if (expr1) - y = (int)expr1->IntegerValue(); - - expr1 = expr->Nth(count); - count ++; - if (expr1) - width = (int)expr1->IntegerValue(); - - expr1 = expr->Nth(count); - count ++; - if (expr1) - height = (int)expr1->IntegerValue(); - - controlItem->SetStyle(windowStyle); - controlItem->SetName(name); - controlItem->SetTitle(title); - controlItem->SetSize(x, y, width, height); - controlItem->SetType(controlType); - controlItem->SetId(id); - - if (controlType == wxT("wxButton")) - { - // Check for bitmap resource name (in case loading old-style resource file) - if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) - { - wxString str(expr->Nth(count)->StringValue()); - count ++; - - if (str != wxT("")) + else { - controlItem->SetValue4(str); - controlItem->SetType(wxT("wxBitmapButton")); + wxString str(expr1->StringValue()); + id = wxResourceGetIdentifier(str, &table); + if (id == 0) + { + wxLogWarning(_("Could not resolve control class or id '%s'. Use (non-zero) integer instead\n or provide #define (see manual for caveats)"), + (const wxChar*) expr1->StringValue()); + delete controlItem; + return (wxItemResource *) NULL; + } + else + { + // Success - we have an id, so the 2nd element must be the control class. + controlType = expr->Nth(1)->StringValue(); + count = 2; + } } } - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - else if (controlType == wxT("wxBitmapButton")) - { - // Check for bitmap resource name - if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) + else if (expr1->Type() == PrologInteger) { - wxString str(expr->Nth(count)->StringValue()); - controlItem->SetValue4(str); - count ++; - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - else if (controlType == wxT("wxCheckBox")) - { - // Check for default value - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } -#if wxUSE_RADIOBTN - else if (controlType == wxT("wxRadioButton")) - { - // Check for default value - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + id = (int)expr1->IntegerValue(); + // Success - we have an id, so the 2nd element must be the control class. + controlType = expr->Nth(1)->StringValue(); + count = 2; } - } -#endif - else if (controlType == wxT("wxText") || controlType == wxT("wxTextCtrl") || controlType == wxT("wxMultiText")) - { - // Check for default value - if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) - { - wxString str(expr->Nth(count)->StringValue()); - controlItem->SetValue4(str); - count ++; - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } - else if (controlType == wxT("wxMessage") || controlType == wxT("wxStaticText")) - { - // Check for bitmap resource name (in case it's an old-style .wxr file) - if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) + + expr1 = expr->Nth(count); + count ++; + if ( expr1 ) + title = expr1->StringValue(); + + expr1 = expr->Nth(count); + count ++; + if (expr1) { - wxString str(expr->Nth(count)->StringValue()); - controlItem->SetValue4(str); - count ++; - controlItem->SetType(wxT("wxStaticText")); + style = expr1->StringValue(); + windowStyle = wxParseWindowStyle(style); } - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - else if (controlType == wxT("wxStaticBitmap")) - { - // Check for bitmap resource name - if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) + + expr1 = expr->Nth(count); + count ++; + if (expr1) + name = expr1->StringValue(); + + expr1 = expr->Nth(count); + count ++; + if (expr1) + x = (int)expr1->IntegerValue(); + + expr1 = expr->Nth(count); + count ++; + if (expr1) + y = (int)expr1->IntegerValue(); + + expr1 = expr->Nth(count); + count ++; + if (expr1) + width = (int)expr1->IntegerValue(); + + expr1 = expr->Nth(count); + count ++; + if (expr1) + height = (int)expr1->IntegerValue(); + + controlItem->SetStyle(windowStyle); + controlItem->SetName(name); + controlItem->SetTitle(title); + controlItem->SetSize(x, y, width, height); + controlItem->SetType(controlType); + controlItem->SetId(id); + + // Check for wxWin 1.68-style specifications + if (style.Find(wxT("VERTICAL_LABEL")) != -1) + controlItem->SetResourceStyle(controlItem->GetResourceStyle() | wxRESOURCE_VERTICAL_LABEL); + else if (style.Find(wxT("HORIZONTAL_LABEL")) != -1) + controlItem->SetResourceStyle(controlItem->GetResourceStyle() | wxRESOURCE_HORIZONTAL_LABEL); + + if (controlType == wxT("wxButton")) { - wxString str(expr->Nth(count)->StringValue()); - controlItem->SetValue4(str); - count ++; - } - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - else if (controlType == wxT("wxGroupBox") || controlType == wxT("wxStaticBox")) - { - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - else if (controlType == wxT("wxGauge")) - { - // Check for default value - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - - // Check for range - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue2(expr->Nth(count)->IntegerValue()); - count ++; - + // Check for bitmap resource name (in case loading old-style resource file) + if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) + { + wxString str(expr->Nth(count)->StringValue()); + count ++; + + if (str != wxT("")) + { + controlItem->SetValue4(str); + controlItem->SetType(wxT("wxBitmapButton")); + } + } if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + else if (controlType == wxT("wxBitmapButton")) + { + // Check for bitmap resource name + if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) { - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } - } - else if (controlType == wxT("wxSlider")) - { - // Check for default value - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - - // Check for min - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue2(expr->Nth(count)->IntegerValue()); - count ++; - - // Check for max + wxString str(expr->Nth(count)->StringValue()); + controlItem->SetValue4(str); + count ++; + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + } + else if (controlType == wxT("wxCheckBox")) + { + // Check for default value if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue3(expr->Nth(count)->IntegerValue()); - count ++; - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); - // do nothing - count ++; - + { + controlItem->SetValue1(expr->Nth(count)->IntegerValue()); + count ++; if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); } - } - } - } - } - else if (controlType == wxT("wxScrollBar")) - { - // DEFAULT VALUE - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - - // PAGE LENGTH - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue2(expr->Nth(count)->IntegerValue()); - count ++; - - // OBJECT LENGTH + } +#if wxUSE_RADIOBTN + else if (controlType == wxT("wxRadioButton")) + { + // Check for default value if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue3(expr->Nth(count)->IntegerValue()); - count ++; - - // VIEW LENGTH - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - controlItem->SetValue5(expr->Nth(count)->IntegerValue()); - } - } - } - } - else if (controlType == wxT("wxListBox")) - { - wxExpr *valueList = (wxExpr *) NULL; - - if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList)) - { - wxStringList stringList; - wxExpr *stringExpr = valueList->GetFirst(); - while (stringExpr) - { - stringList.Add(stringExpr->StringValue()); - stringExpr = stringExpr->GetNext(); - } - controlItem->SetStringValues(stringList); - count ++; -// This is now obsolete: it's in the window style. - // Check for wxSINGLE/wxMULTIPLE - wxExpr *mult = (wxExpr *) NULL; -/* - controlItem->SetValue1(wxLB_SINGLE); -*/ - if ((mult = expr->Nth(count)) && ((mult->Type() == PrologString)||(mult->Type() == PrologWord))) - { -/* - wxString m(mult->StringValue()); - if (m == "wxLB_MULTIPLE") - controlItem->SetValue1(wxLB_MULTIPLE); - else if (m == "wxLB_EXTENDED") - controlItem->SetValue1(wxLB_EXTENDED); -*/ - // Ignore the value - count ++; - } - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } - else if (controlType == wxT("wxChoice")) - { - wxExpr *valueList = (wxExpr *) NULL; - // Check for default value list - if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList)) - { - wxStringList stringList; - wxExpr *stringExpr = valueList->GetFirst(); - while (stringExpr) - { - stringList.Add(stringExpr->StringValue()); - stringExpr = stringExpr->GetNext(); - } - controlItem->SetStringValues(stringList); - - count ++; - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } -#if wxUSE_COMBOBOX - else if (controlType == wxT("wxComboBox")) - { - wxExpr *textValue = expr->Nth(count); - if (textValue && (textValue->Type() == PrologString || textValue->Type() == PrologWord)) - { - wxString str(textValue->StringValue()); - controlItem->SetValue4(str); - - count ++; - - wxExpr *valueList = (wxExpr *) NULL; - // Check for default value list - if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList)) - { - wxStringList stringList; - wxExpr *stringExpr = valueList->GetFirst(); - while (stringExpr) { - stringList.Add(stringExpr->StringValue()); - stringExpr = stringExpr->GetNext(); + controlItem->SetValue1(expr->Nth(count)->IntegerValue()); + count ++; + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + } +#endif + else if (controlType == wxT("wxText") || controlType == wxT("wxTextCtrl") || controlType == wxT("wxMultiText")) + { + // Check for default value + if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) + { + wxString str(expr->Nth(count)->StringValue()); + controlItem->SetValue4(str); + count ++; + + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + { + // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); + // Skip past the obsolete label font spec if there are two consecutive specs + if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) + count ++; + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + } + } + else if (controlType == wxT("wxMessage") || controlType == wxT("wxStaticText")) + { + // Check for bitmap resource name (in case it's an old-style .wxr file) + if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) + { + wxString str(expr->Nth(count)->StringValue()); + controlItem->SetValue4(str); + count ++; + controlItem->SetType(wxT("wxStaticText")); } - controlItem->SetStringValues(stringList); - - count ++; - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } - } + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + else if (controlType == wxT("wxStaticBitmap")) + { + // Check for bitmap resource name + if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) + { + wxString str(expr->Nth(count)->StringValue()); + controlItem->SetValue4(str); + count ++; + } + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + else if (controlType == wxT("wxGroupBox") || controlType == wxT("wxStaticBox")) + { + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + else if (controlType == wxT("wxGauge")) + { + // Check for default value + if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) + { + controlItem->SetValue1(expr->Nth(count)->IntegerValue()); + count ++; + + // Check for range + if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) + { + controlItem->SetValue2(expr->Nth(count)->IntegerValue()); + count ++; + + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + { + // Skip past the obsolete label font spec if there are two consecutive specs + if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) + count ++; + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + } + } + } + else if (controlType == wxT("wxSlider")) + { + // Check for default value + if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) + { + controlItem->SetValue1(expr->Nth(count)->IntegerValue()); + count ++; + + // Check for min + if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) + { + controlItem->SetValue2(expr->Nth(count)->IntegerValue()); + count ++; + + // Check for max + if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) + { + controlItem->SetValue3(expr->Nth(count)->IntegerValue()); + count ++; + + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + { + // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); + // do nothing + count ++; + + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + } + } + } + } + else if (controlType == wxT("wxScrollBar")) + { + // DEFAULT VALUE + if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) + { + controlItem->SetValue1(expr->Nth(count)->IntegerValue()); + count ++; + + // PAGE LENGTH + if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) + { + controlItem->SetValue2(expr->Nth(count)->IntegerValue()); + count ++; + + // OBJECT LENGTH + if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) + { + controlItem->SetValue3(expr->Nth(count)->IntegerValue()); + count ++; + + // VIEW LENGTH + if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) + controlItem->SetValue5(expr->Nth(count)->IntegerValue()); + } + } + } + } + else if (controlType == wxT("wxListBox")) + { + wxExpr *valueList = (wxExpr *) NULL; + + if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList)) + { + wxStringList stringList; + wxExpr *stringExpr = valueList->GetFirst(); + while (stringExpr) + { + stringList.Add(stringExpr->StringValue()); + stringExpr = stringExpr->GetNext(); + } + controlItem->SetStringValues(stringList); + count ++; + // This is now obsolete: it's in the window style. + // Check for wxSINGLE/wxMULTIPLE + wxExpr *mult = (wxExpr *) NULL; + /* + controlItem->SetValue1(wxLB_SINGLE); + */ + if ((mult = expr->Nth(count)) && ((mult->Type() == PrologString)||(mult->Type() == PrologWord))) + { + /* + wxString m(mult->StringValue()); + if (m == "wxLB_MULTIPLE") + controlItem->SetValue1(wxLB_MULTIPLE); + else if (m == "wxLB_EXTENDED") + controlItem->SetValue1(wxLB_EXTENDED); + */ + // Ignore the value + count ++; + } + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + { + // Skip past the obsolete label font spec if there are two consecutive specs + if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) + count ++; + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + } + } + else if (controlType == wxT("wxChoice")) + { + wxExpr *valueList = (wxExpr *) NULL; + // Check for default value list + if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList)) + { + wxStringList stringList; + wxExpr *stringExpr = valueList->GetFirst(); + while (stringExpr) + { + stringList.Add(stringExpr->StringValue()); + stringExpr = stringExpr->GetNext(); + } + controlItem->SetStringValues(stringList); + + count ++; + + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + { + // Skip past the obsolete label font spec if there are two consecutive specs + if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) + count ++; + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + } + } +#if wxUSE_COMBOBOX + else if (controlType == wxT("wxComboBox")) + { + wxExpr *textValue = expr->Nth(count); + if (textValue && (textValue->Type() == PrologString || textValue->Type() == PrologWord)) + { + wxString str(textValue->StringValue()); + controlItem->SetValue4(str); + + count ++; + + wxExpr *valueList = (wxExpr *) NULL; + // Check for default value list + if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList)) + { + wxStringList stringList; + wxExpr *stringExpr = valueList->GetFirst(); + while (stringExpr) + { + stringList.Add(stringExpr->StringValue()); + stringExpr = stringExpr->GetNext(); + } + controlItem->SetStringValues(stringList); + + count ++; + + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + { + // Skip past the obsolete label font spec if there are two consecutive specs + if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) + count ++; + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + } + } + } #endif #if 1 - else if (controlType == wxT("wxRadioBox")) - { - wxExpr *valueList = (wxExpr *) NULL; - // Check for default value list - if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList)) - { - wxStringList stringList; - wxExpr *stringExpr = valueList->GetFirst(); - while (stringExpr) - { - stringList.Add(stringExpr->StringValue()); - stringExpr = stringExpr->GetNext(); - } - controlItem->SetStringValues(stringList); - count ++; - - // majorDim (number of rows or cols) - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - } - else - controlItem->SetValue1(0); - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } + else if (controlType == wxT("wxRadioBox")) + { + wxExpr *valueList = (wxExpr *) NULL; + // Check for default value list + if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList)) + { + wxStringList stringList; + wxExpr *stringExpr = valueList->GetFirst(); + while (stringExpr) + { + stringList.Add(stringExpr->StringValue()); + stringExpr = stringExpr->GetNext(); + } + controlItem->SetStringValues(stringList); + count ++; + + // majorDim (number of rows or cols) + if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) + { + controlItem->SetValue1(expr->Nth(count)->IntegerValue()); + count ++; + } + else + controlItem->SetValue1(0); + + if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) + { + // Skip past the obsolete label font spec if there are two consecutive specs + if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) + count ++; + controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); + } + } + } #endif - else - { - delete controlItem; - return (wxItemResource *) NULL; - } - return controlItem; + else + { + delete controlItem; + return (wxItemResource *) NULL; + } + return controlItem; } // Forward declaration wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, wxExpr *expr); /* - * Interpet a menu item - */ +* Interpet a menu item +*/ wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, wxExpr *expr) { - wxItemResource *item = new wxItemResource; - - wxExpr *labelExpr = expr->Nth(0); - wxExpr *idExpr = expr->Nth(1); - wxExpr *helpExpr = expr->Nth(2); - wxExpr *checkableExpr = expr->Nth(3); - - // Further keywords/attributes to follow sometime... - if (expr->Number() == 0) - { -// item->SetType(wxRESOURCE_TYPE_SEPARATOR); - item->SetType(wxT("wxMenuSeparator")); - return item; - } - else - { -// item->SetType(wxTYPE_MENU); // Well, menu item, but doesn't matter. - item->SetType(wxT("wxMenu")); // Well, menu item, but doesn't matter. - if (labelExpr) - { - wxString str(labelExpr->StringValue()); - item->SetTitle(str); - } - if (idExpr) - { - int id = 0; - // If a string or word, must look up in identifier table. - if ((idExpr->Type() == PrologString) || (idExpr->Type() == PrologWord)) - { - wxString str(idExpr->StringValue()); - id = wxResourceGetIdentifier(str, &table); - if (id == 0) - { - wxLogWarning(_("Could not resolve menu id '%s'. " - "Use (non-zero) integer instead\n" - "or provide #define (see manual for caveats)"), - (const wxChar*) idExpr->StringValue()); - } - } - else if (idExpr->Type() == PrologInteger) - id = (int)idExpr->IntegerValue(); - item->SetValue1(id); - } - if (helpExpr) + wxItemResource *item = new wxItemResource; + + wxExpr *labelExpr = expr->Nth(0); + wxExpr *idExpr = expr->Nth(1); + wxExpr *helpExpr = expr->Nth(2); + wxExpr *checkableExpr = expr->Nth(3); + + // Further keywords/attributes to follow sometime... + if (expr->Number() == 0) { - wxString str(helpExpr->StringValue()); - item->SetValue4(str); + // item->SetType(wxRESOURCE_TYPE_SEPARATOR); + item->SetType(wxT("wxMenuSeparator")); + return item; } - if (checkableExpr) - item->SetValue2(checkableExpr->IntegerValue()); - - // Find the first expression that's a list, for submenu - wxExpr *subMenuExpr = expr->GetFirst(); - while (subMenuExpr && (subMenuExpr->Type() != PrologList)) - subMenuExpr = subMenuExpr->GetNext(); - - while (subMenuExpr) + else { - wxItemResource *child = wxResourceInterpretMenuItem(table, subMenuExpr); - item->GetChildren().Append(child); - subMenuExpr = subMenuExpr->GetNext(); + // item->SetType(wxTYPE_MENU); // Well, menu item, but doesn't matter. + item->SetType(wxT("wxMenu")); // Well, menu item, but doesn't matter. + if (labelExpr) + { + wxString str(labelExpr->StringValue()); + item->SetTitle(str); + } + if (idExpr) + { + int id = 0; + // If a string or word, must look up in identifier table. + if ((idExpr->Type() == PrologString) || (idExpr->Type() == PrologWord)) + { + wxString str(idExpr->StringValue()); + id = wxResourceGetIdentifier(str, &table); + if (id == 0) + { + wxLogWarning(_("Could not resolve menu id '%s'. Use (non-zero) integer instead\nor provide #define (see manual for caveats)"), + (const wxChar*) idExpr->StringValue()); + } + } + else if (idExpr->Type() == PrologInteger) + id = (int)idExpr->IntegerValue(); + item->SetValue1(id); + } + if (helpExpr) + { + wxString str(helpExpr->StringValue()); + item->SetValue4(str); + } + if (checkableExpr) + item->SetValue2(checkableExpr->IntegerValue()); + + // Find the first expression that's a list, for submenu + wxExpr *subMenuExpr = expr->GetFirst(); + while (subMenuExpr && (subMenuExpr->Type() != PrologList)) + subMenuExpr = subMenuExpr->GetNext(); + + while (subMenuExpr) + { + wxItemResource *child = wxResourceInterpretMenuItem(table, subMenuExpr); + item->GetChildren().Append(child); + subMenuExpr = subMenuExpr->GetNext(); + } } - } - return item; + return item; } /* - * Interpret a nested list as a menu - */ +* Interpret a nested list as a menu +*/ /* wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, wxExpr *expr) { - wxItemResource *menu = new wxItemResource; +wxItemResource *menu = new wxItemResource; // menu->SetType(wxTYPE_MENU); - menu->SetType("wxMenu"); - wxExpr *element = expr->GetFirst(); - while (element) - { - wxItemResource *item = wxResourceInterpretMenuItem(table, element); - if (item) - menu->GetChildren().Append(item); - element = element->GetNext(); - } - return menu; +menu->SetType("wxMenu"); +wxExpr *element = expr->GetFirst(); +while (element) +{ +wxItemResource *item = wxResourceInterpretMenuItem(table, element); +if (item) +menu->GetChildren().Append(item); +element = element->GetNext(); +} +return menu; } */ wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr) { - wxExpr *listExpr = (wxExpr *) NULL; - expr->GetAttributeValue(wxT("menu"), &listExpr); - if (!listExpr) - return (wxItemResource *) NULL; - - wxItemResource *menuResource = wxResourceInterpretMenuItem(table, listExpr); - - if (!menuResource) - return (wxItemResource *) NULL; - - wxString name; - if (expr->GetAttributeValue(wxT("name"), name)) - { - menuResource->SetName(name); - } - - return menuResource; + wxExpr *listExpr = (wxExpr *) NULL; + expr->GetAttributeValue(wxT("menu"), &listExpr); + if (!listExpr) + return (wxItemResource *) NULL; + + wxItemResource *menuResource = wxResourceInterpretMenuItem(table, listExpr); + + if (!menuResource) + return (wxItemResource *) NULL; + + wxString name; + if (expr->GetAttributeValue(wxT("name"), name)) + { + menuResource->SetName(name); + } + + return menuResource; } wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr) { - wxExpr *listExpr = (wxExpr *) NULL; - expr->GetAttributeValue(wxT("menu"), &listExpr); - if (!listExpr) - return (wxItemResource *) NULL; - - wxItemResource *resource = new wxItemResource; - resource->SetType(wxT("wxMenu")); -// resource->SetType(wxTYPE_MENU); - - wxExpr *element = listExpr->GetFirst(); - while (element) - { - wxItemResource *menuResource = wxResourceInterpretMenuItem(table, listExpr); - resource->GetChildren().Append(menuResource); - element = element->GetNext(); - } - - wxString name; - if (expr->GetAttributeValue(wxT("name"), name)) - { - resource->SetName(name); - } - - return resource; + wxExpr *listExpr = (wxExpr *) NULL; + expr->GetAttributeValue(wxT("menu"), &listExpr); + if (!listExpr) + return (wxItemResource *) NULL; + + wxItemResource *resource = new wxItemResource; + resource->SetType(wxT("wxMenu")); + // resource->SetType(wxTYPE_MENU); + + wxExpr *element = listExpr->GetFirst(); + while (element) + { + wxItemResource *menuResource = wxResourceInterpretMenuItem(table, listExpr); + resource->GetChildren().Append(menuResource); + element = element->GetNext(); + } + + wxString name; + if (expr->GetAttributeValue(wxT("name"), name)) + { + resource->SetName(name); + } + + return resource; } wxItemResource *wxResourceInterpretString(wxResourceTable& WXUNUSED(table), wxExpr *WXUNUSED(expr)) { - return (wxItemResource *) NULL; + return (wxItemResource *) NULL; } wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxExpr *expr) { - wxItemResource *bitmapItem = new wxItemResource; -// bitmapItem->SetType(wxTYPE_BITMAP); - bitmapItem->SetType(wxT("wxBitmap")); - wxString name; - if (expr->GetAttributeValue(wxT("name"), name)) - { - bitmapItem->SetName(name); - } - // Now parse all bitmap specifications - wxExpr *bitmapExpr = expr->GetFirst(); - while (bitmapExpr) - { - if (bitmapExpr->Number() == 3) - { - wxString bitmapKeyword(bitmapExpr->Nth(1)->StringValue()); - if (bitmapKeyword == wxT("bitmap") || bitmapKeyword == wxT("icon")) - { - // The value part: always a list. - wxExpr *listExpr = bitmapExpr->Nth(2); - if (listExpr->Type() == PrologList) + wxItemResource *bitmapItem = new wxItemResource; + // bitmapItem->SetType(wxTYPE_BITMAP); + bitmapItem->SetType(wxT("wxBitmap")); + wxString name; + if (expr->GetAttributeValue(wxT("name"), name)) + { + bitmapItem->SetName(name); + } + // Now parse all bitmap specifications + wxExpr *bitmapExpr = expr->GetFirst(); + while (bitmapExpr) + { + if (bitmapExpr->Number() == 3) { - wxItemResource *bitmapSpec = new wxItemResource; -// bitmapSpec->SetType(wxTYPE_BITMAP); - bitmapSpec->SetType(wxT("wxBitmap")); - - // List is of form: [filename, bitmaptype, platform, colours, xresolution, yresolution] - // where everything after 'filename' is optional. - wxExpr *nameExpr = listExpr->Nth(0); - wxExpr *typeExpr = listExpr->Nth(1); - wxExpr *platformExpr = listExpr->Nth(2); - wxExpr *coloursExpr = listExpr->Nth(3); - wxExpr *xresExpr = listExpr->Nth(4); - wxExpr *yresExpr = listExpr->Nth(5); - if (nameExpr && nameExpr->StringValue() != wxT("")) - { - bitmapSpec->SetName(nameExpr->StringValue()); - } - if (typeExpr && typeExpr->StringValue() != wxT("")) - { - bitmapSpec->SetValue1(wxParseWindowStyle(typeExpr->StringValue())); - } - else - bitmapSpec->SetValue1(0); - - if (platformExpr && platformExpr->StringValue() != wxT("")) - { - wxString plat(platformExpr->StringValue()); - if (plat == wxT("windows") || plat == wxT("WINDOWS")) - bitmapSpec->SetValue2(RESOURCE_PLATFORM_WINDOWS); - else if (plat == wxT("x") || plat == wxT("X")) - bitmapSpec->SetValue2(RESOURCE_PLATFORM_X); - else if (plat == wxT("mac") || plat == wxT("MAC")) - bitmapSpec->SetValue2(RESOURCE_PLATFORM_MAC); - else - bitmapSpec->SetValue2(RESOURCE_PLATFORM_ANY); - } - else - bitmapSpec->SetValue2(RESOURCE_PLATFORM_ANY); - - if (coloursExpr) - bitmapSpec->SetValue3(coloursExpr->IntegerValue()); - int xres = 0; - int yres = 0; - if (xresExpr) - xres = (int)xresExpr->IntegerValue(); - if (yresExpr) - yres = (int)yresExpr->IntegerValue(); - bitmapSpec->SetSize(0, 0, xres, yres); - - bitmapItem->GetChildren().Append(bitmapSpec); + wxString bitmapKeyword(bitmapExpr->Nth(1)->StringValue()); + if (bitmapKeyword == wxT("bitmap") || bitmapKeyword == wxT("icon")) + { + // The value part: always a list. + wxExpr *listExpr = bitmapExpr->Nth(2); + if (listExpr->Type() == PrologList) + { + wxItemResource *bitmapSpec = new wxItemResource; + // bitmapSpec->SetType(wxTYPE_BITMAP); + bitmapSpec->SetType(wxT("wxBitmap")); + + // List is of form: [filename, bitmaptype, platform, colours, xresolution, yresolution] + // where everything after 'filename' is optional. + wxExpr *nameExpr = listExpr->Nth(0); + wxExpr *typeExpr = listExpr->Nth(1); + wxExpr *platformExpr = listExpr->Nth(2); + wxExpr *coloursExpr = listExpr->Nth(3); + wxExpr *xresExpr = listExpr->Nth(4); + wxExpr *yresExpr = listExpr->Nth(5); + if (nameExpr && nameExpr->StringValue() != wxT("")) + { + bitmapSpec->SetName(nameExpr->StringValue()); + } + if (typeExpr && typeExpr->StringValue() != wxT("")) + { + bitmapSpec->SetValue1(wxParseWindowStyle(typeExpr->StringValue())); + } + else + bitmapSpec->SetValue1(0); + + if (platformExpr && platformExpr->StringValue() != wxT("")) + { + wxString plat(platformExpr->StringValue()); + if (plat == wxT("windows") || plat == wxT("WINDOWS")) + bitmapSpec->SetValue2(RESOURCE_PLATFORM_WINDOWS); + else if (plat == wxT("x") || plat == wxT("X")) + bitmapSpec->SetValue2(RESOURCE_PLATFORM_X); + else if (plat == wxT("mac") || plat == wxT("MAC")) + bitmapSpec->SetValue2(RESOURCE_PLATFORM_MAC); + else + bitmapSpec->SetValue2(RESOURCE_PLATFORM_ANY); + } + else + bitmapSpec->SetValue2(RESOURCE_PLATFORM_ANY); + + if (coloursExpr) + bitmapSpec->SetValue3(coloursExpr->IntegerValue()); + int xres = 0; + int yres = 0; + if (xresExpr) + xres = (int)xresExpr->IntegerValue(); + if (yresExpr) + yres = (int)yresExpr->IntegerValue(); + bitmapSpec->SetSize(0, 0, xres, yres); + + bitmapItem->GetChildren().Append(bitmapSpec); + } + } } - } + bitmapExpr = bitmapExpr->GetNext(); } - bitmapExpr = bitmapExpr->GetNext(); - } - - return bitmapItem; + + return bitmapItem; } wxItemResource *wxResourceInterpretIcon(wxResourceTable& table, wxExpr *expr) { - wxItemResource *item = wxResourceInterpretBitmap(table, expr); - if (item) - { -// item->SetType(wxTYPE_ICON); - item->SetType(wxT("wxIcon")); - return item; - } - else - return (wxItemResource *) NULL; + wxItemResource *item = wxResourceInterpretBitmap(table, expr); + if (item) + { + // item->SetType(wxTYPE_ICON); + item->SetType(wxT("wxIcon")); + return item; + } + else + return (wxItemResource *) NULL; } // Interpret list expression as a font wxFont wxResourceInterpretFontSpec(wxExpr *expr) { - if (expr->Type() != PrologList) - return wxNullFont; - - int point = 10; - int family = wxSWISS; - int style = wxNORMAL; - int weight = wxNORMAL; - int underline = 0; - wxString faceName(wxT("")); - - wxExpr *pointExpr = expr->Nth(0); - wxExpr *familyExpr = expr->Nth(1); - wxExpr *styleExpr = expr->Nth(2); - wxExpr *weightExpr = expr->Nth(3); - wxExpr *underlineExpr = expr->Nth(4); - wxExpr *faceNameExpr = expr->Nth(5); - if (pointExpr) - point = (int)pointExpr->IntegerValue(); - - wxString str; - if (familyExpr) - { - str = familyExpr->StringValue(); - family = (int)wxParseWindowStyle(str); - } - if (styleExpr) - { - str = styleExpr->StringValue(); - style = (int)wxParseWindowStyle(str); - } - if (weightExpr) - { - str = weightExpr->StringValue(); - weight = (int)wxParseWindowStyle(str); - } - if (underlineExpr) - underline = (int)underlineExpr->IntegerValue(); - if (faceNameExpr) - faceName = faceNameExpr->StringValue(); - - wxFont font(point, family, style, weight, (underline != 0), faceName); - return font; + if (expr->Type() != PrologList) + return wxNullFont; + + int point = 10; + int family = wxSWISS; + int style = wxNORMAL; + int weight = wxNORMAL; + int underline = 0; + wxString faceName(wxT("")); + + wxExpr *pointExpr = expr->Nth(0); + wxExpr *familyExpr = expr->Nth(1); + wxExpr *styleExpr = expr->Nth(2); + wxExpr *weightExpr = expr->Nth(3); + wxExpr *underlineExpr = expr->Nth(4); + wxExpr *faceNameExpr = expr->Nth(5); + if (pointExpr) + point = (int)pointExpr->IntegerValue(); + + wxString str; + if (familyExpr) + { + str = familyExpr->StringValue(); + family = (int)wxParseWindowStyle(str); + } + if (styleExpr) + { + str = styleExpr->StringValue(); + style = (int)wxParseWindowStyle(str); + } + if (weightExpr) + { + str = weightExpr->StringValue(); + weight = (int)wxParseWindowStyle(str); + } + if (underlineExpr) + underline = (int)underlineExpr->IntegerValue(); + if (faceNameExpr) + faceName = faceNameExpr->StringValue(); + + wxFont font(point, family, style, weight, (underline != 0), faceName); + return font; } // Separate file for the remainder of this, for BC++/Win16 #if !((defined(__BORLANDC__) || defined(__SC__)) && defined(__WIN16__)) /* - * (Re)allocate buffer for reading in from resource file - */ +* (Re)allocate buffer for reading in from resource file +*/ bool wxReallocateResourceBuffer() { - if (!wxResourceBuffer) - { - wxResourceBufferSize = 1000; - wxResourceBuffer = new char[wxResourceBufferSize]; + if (!wxResourceBuffer) + { + wxResourceBufferSize = 1000; + wxResourceBuffer = new char[wxResourceBufferSize]; + return TRUE; + } + if (wxResourceBuffer) + { + long newSize = wxResourceBufferSize + 1000; + char *tmp = new char[(int)newSize]; + strncpy(tmp, wxResourceBuffer, (int)wxResourceBufferCount); + delete[] wxResourceBuffer; + wxResourceBuffer = tmp; + wxResourceBufferSize = newSize; + } return TRUE; - } - if (wxResourceBuffer) - { - long newSize = wxResourceBufferSize + 1000; - char *tmp = new char[(int)newSize]; - strncpy(tmp, wxResourceBuffer, (int)wxResourceBufferCount); - delete[] wxResourceBuffer; - wxResourceBuffer = tmp; - wxResourceBufferSize = newSize; - } - return TRUE; } static bool wxEatWhiteSpace(FILE *fd) { - int ch = 0; - - while ((ch = getc(fd)) != EOF) - { - switch (ch) - { - case ' ': - case 0x0a: - case 0x0d: - case 0x09: + int ch = 0; + + while ((ch = getc(fd)) != EOF) + { + switch (ch) + { + case ' ': + case 0x0a: + case 0x0d: + case 0x09: break; - case '/': + case '/': { - int prev_ch = ch; - ch = getc(fd); - if (ch == EOF) - { - ungetc(prev_ch, fd); - return TRUE; - } - - if (ch == '*') - { - // Eat C comment - prev_ch = 0; - while ((ch = getc(fd)) != EOF) - { - if (ch == '/' && prev_ch == '*') - break; - prev_ch = ch; - } - } - else if (ch == '/') - { - // Eat C++ comment - static char buffer[255]; - fgets(buffer, 255, fd); - } - else - { - ungetc(prev_ch, fd); - ungetc(ch, fd); - return TRUE; - } + int prev_ch = ch; + ch = getc(fd); + if (ch == EOF) + { + ungetc(prev_ch, fd); + return TRUE; + } + + if (ch == '*') + { + // Eat C comment + prev_ch = 0; + while ((ch = getc(fd)) != EOF) + { + if (ch == '/' && prev_ch == '*') + break; + prev_ch = ch; + } + } + else if (ch == '/') + { + // Eat C++ comment + static char buffer[255]; + fgets(buffer, 255, fd); + } + else + { + ungetc(prev_ch, fd); + ungetc(ch, fd); + return TRUE; + } } break; - default: + default: ungetc(ch, fd); return TRUE; - - } - } - return FALSE; + + } + } + return FALSE; } static bool wxEatWhiteSpace(wxInputStream *is) { - int ch = is->GetC() ; - if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9)) - { - is->Ungetch(ch); - return TRUE; - } - - // Eat whitespace - while (ch == ' ' || ch == 10 || ch == 13 || ch == 9) - ch = is->GetC(); - // Check for comment - if (ch == '/') - { - ch = is->GetC(); - if (ch == '*') + int ch = is->GetC() ; + if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9)) + { + is->Ungetch(ch); + return TRUE; + } + + // Eat whitespace + while (ch == ' ' || ch == 10 || ch == 13 || ch == 9) + ch = is->GetC(); + // Check for comment + if (ch == '/') { - bool finished = FALSE; - while (!finished) - { ch = is->GetC(); - if (ch == EOF) - return FALSE; if (ch == '*') { - int newCh = is->GetC(); - if (newCh == '/') - finished = TRUE; - else - { - is->Ungetch(ch); - } + bool finished = FALSE; + while (!finished) + { + ch = is->GetC(); + if (ch == EOF) + return FALSE; + if (ch == '*') + { + int newCh = is->GetC(); + if (newCh == '/') + finished = TRUE; + else + { + is->Ungetch(ch); + } + } + } } - } + else // False alarm + return FALSE; } - else // False alarm - return FALSE; - } - else - is->Ungetch(ch); - return wxEatWhiteSpace(is); + else + is->Ungetch(ch); + return wxEatWhiteSpace(is); } bool wxGetResourceToken(FILE *fd) { - if (!wxResourceBuffer) - wxReallocateResourceBuffer(); - wxResourceBuffer[0] = 0; - wxEatWhiteSpace(fd); - - int ch = getc(fd); - if (ch == '"') - { - // Get string - wxResourceBufferCount = 0; - ch = getc(fd); - while (ch != '"') - { - int actualCh = ch; - if (ch == EOF) - { - wxResourceBuffer[wxResourceBufferCount] = 0; - return FALSE; - } - // Escaped characters - else if (ch == '\\') - { - int newCh = getc(fd); - if (newCh == '"') - actualCh = '"'; - else if (newCh == 10) - actualCh = 10; - else + if (!wxResourceBuffer) + wxReallocateResourceBuffer(); + wxResourceBuffer[0] = 0; + wxEatWhiteSpace(fd); + + int ch = getc(fd); + if (ch == '"') + { + // Get string + wxResourceBufferCount = 0; + ch = getc(fd); + while (ch != '"') { - ungetc(newCh, fd); + int actualCh = ch; + if (ch == EOF) + { + wxResourceBuffer[wxResourceBufferCount] = 0; + return FALSE; + } + // Escaped characters + else if (ch == '\\') + { + int newCh = getc(fd); + if (newCh == '"') + actualCh = '"'; + else if (newCh == 10) + actualCh = 10; + else + { + ungetc(newCh, fd); + } + } + + if (wxResourceBufferCount >= wxResourceBufferSize-1) + wxReallocateResourceBuffer(); + wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; + wxResourceBufferCount ++; + ch = getc(fd); } - } - - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; - wxResourceBufferCount ++; - ch = getc(fd); + wxResourceBuffer[wxResourceBufferCount] = 0; } - wxResourceBuffer[wxResourceBufferCount] = 0; - } - else - { - wxResourceBufferCount = 0; - // Any other token - while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) + else { - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)ch; - wxResourceBufferCount ++; - - ch = getc(fd); + wxResourceBufferCount = 0; + // Any other token + while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) + { + if (wxResourceBufferCount >= wxResourceBufferSize-1) + wxReallocateResourceBuffer(); + wxResourceBuffer[wxResourceBufferCount] = (char)ch; + wxResourceBufferCount ++; + + ch = getc(fd); + } + wxResourceBuffer[wxResourceBufferCount] = 0; + if (ch == EOF) + return FALSE; } - wxResourceBuffer[wxResourceBufferCount] = 0; - if (ch == EOF) - return FALSE; - } - return TRUE; + return TRUE; } bool wxGetResourceToken(wxInputStream *is) { - if (!wxResourceBuffer) - wxReallocateResourceBuffer(); - wxResourceBuffer[0] = 0; - wxEatWhiteSpace(is); - - int ch = is->GetC() ; - if (ch == '"') - { - // Get string - wxResourceBufferCount = 0; - ch = is->GetC(); - while (ch != '"') - { - int actualCh = ch; - if (ch == EOF) - { - wxResourceBuffer[wxResourceBufferCount] = 0; - return FALSE; - } - // Escaped characters - else if (ch == '\\') - { - int newCh = is->GetC(); - if (newCh == '"') - actualCh = '"'; - else if (newCh == 10) - actualCh = 10; - else if (newCh == 13) // mac - actualCh = 10; - else + if (!wxResourceBuffer) + wxReallocateResourceBuffer(); + wxResourceBuffer[0] = 0; + wxEatWhiteSpace(is); + + int ch = is->GetC() ; + if (ch == '"') + { + // Get string + wxResourceBufferCount = 0; + ch = is->GetC(); + while (ch != '"') { - is->Ungetch(newCh); + int actualCh = ch; + if (ch == EOF) + { + wxResourceBuffer[wxResourceBufferCount] = 0; + return FALSE; + } + // Escaped characters + else if (ch == '\\') + { + int newCh = is->GetC(); + if (newCh == '"') + actualCh = '"'; + else if (newCh == 10) + actualCh = 10; + else if (newCh == 13) // mac + actualCh = 10; + else + { + is->Ungetch(newCh); + } + } + + if (wxResourceBufferCount >= wxResourceBufferSize-1) + wxReallocateResourceBuffer(); + wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; + wxResourceBufferCount ++; + ch = is->GetC(); } - } - - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; - wxResourceBufferCount ++; - ch = is->GetC(); + wxResourceBuffer[wxResourceBufferCount] = 0; } - wxResourceBuffer[wxResourceBufferCount] = 0; - } - else - { - wxResourceBufferCount = 0; - // Any other token - while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) + else { - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)ch; - wxResourceBufferCount ++; - - ch = is->GetC(); + wxResourceBufferCount = 0; + // Any other token + while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) + { + if (wxResourceBufferCount >= wxResourceBufferSize-1) + wxReallocateResourceBuffer(); + wxResourceBuffer[wxResourceBufferCount] = (char)ch; + wxResourceBufferCount ++; + + ch = is->GetC(); + } + wxResourceBuffer[wxResourceBufferCount] = 0; + if (ch == EOF) + return FALSE; } - wxResourceBuffer[wxResourceBufferCount] = 0; - if (ch == EOF) - return FALSE; - } - return TRUE; + return TRUE; } /* - * Files are in form: - static char *name = "...."; - with possible comments. - */ +* Files are in form: +static char *name = "...."; +with possible comments. +*/ bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - // static or #define - if (!wxGetResourceToken(fd)) - { - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "#define") == 0) - { - wxGetResourceToken(fd); - wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - wxGetResourceToken(fd); - wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - if (wxIsdigit(value[0])) + if (!table) + table = wxDefaultResourceTable; + + // static or #define + if (!wxGetResourceToken(fd)) { - int val = (int)wxAtol(value); - wxResourceAddIdentifier(name, val, table); + *eof = TRUE; + return FALSE; } - else + + if (strcmp(wxResourceBuffer, "#define") == 0) { - wxLogWarning(_("#define %s must be an integer."), name); - delete[] name; - delete[] value; - return FALSE; + wxGetResourceToken(fd); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + wxGetResourceToken(fd); + wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + if (wxIsdigit(value[0])) + { + int val = (int)wxAtol(value); + wxResourceAddIdentifier(name, val, table); + } + else + { + wxLogWarning(_("#define %s must be an integer."), name); + delete[] name; + delete[] value; + return FALSE; + } + delete[] name; + delete[] value; + + return TRUE; } - delete[] name; - delete[] value; - - return TRUE; - } - else if (strcmp(wxResourceBuffer, "#include") == 0) - { - wxGetResourceToken(fd); - wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - wxChar *actualName = name; - if (name[0] == wxT('"')) - actualName = name + 1; - int len = wxStrlen(name); - if ((len > 0) && (name[len-1] == wxT('"'))) - name[len-1] = 0; - if (!wxResourceParseIncludeFile(actualName, table)) + else if (strcmp(wxResourceBuffer, "#include") == 0) { - wxLogWarning(_("Could not find resource include file %s."), actualName); + wxGetResourceToken(fd); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + wxChar *actualName = name; + if (name[0] == wxT('"')) + actualName = name + 1; + int len = wxStrlen(name); + if ((len > 0) && (name[len-1] == wxT('"'))) + name[len-1] = 0; + if (!wxResourceParseIncludeFile(actualName, table)) + { + wxLogWarning(_("Could not find resource include file %s."), actualName); + } + delete[] name; + return TRUE; } - delete[] name; - return TRUE; - } - else if (strcmp(wxResourceBuffer, "static") != 0) - { - wxChar buf[300]; - wxStrcpy(buf, _("Found ")); - wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30); - wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); - wxLogWarning(buf); - return FALSE; - } - - // char - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "char") != 0) - { - wxLogWarning(_("Expected 'char' whilst parsing resource.")); - return FALSE; - } - - // *name - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (wxResourceBuffer[0] != '*') - { - wxLogWarning(_("Expected '*' whilst parsing resource.")); - return FALSE; - } - wxChar nameBuf[100]; - wxMB2WX(nameBuf, wxResourceBuffer+1, 99); - nameBuf[99] = 0; - - // = - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "=") != 0) - { - wxLogWarning(_("Expected '=' whilst parsing resource.")); - return FALSE; - } - - // String - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - else - { - if (!db.ReadPrologFromString(wxResourceBuffer)) + else if (strcmp(wxResourceBuffer, "static") != 0) { - wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); - return FALSE; + wxChar buf[300]; + wxStrcpy(buf, _("Found ")); + wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30); + wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); + wxLogWarning(buf); + return FALSE; } - } - // Semicolon - if (!wxGetResourceToken(fd)) - { - *eof = TRUE; - } - return TRUE; + + // char + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (strcmp(wxResourceBuffer, "char") != 0) + { + wxLogWarning(_("Expected 'char' whilst parsing resource.")); + return FALSE; + } + + // *name + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (wxResourceBuffer[0] != '*') + { + wxLogWarning(_("Expected '*' whilst parsing resource.")); + return FALSE; + } + wxChar nameBuf[100]; + wxMB2WX(nameBuf, wxResourceBuffer+1, 99); + nameBuf[99] = 0; + + // = + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (strcmp(wxResourceBuffer, "=") != 0) + { + wxLogWarning(_("Expected '=' whilst parsing resource.")); + return FALSE; + } + + // String + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + else + { + if (!db.ReadPrologFromString(wxResourceBuffer)) + { + wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); + return FALSE; + } + } + // Semicolon + if (!wxGetResourceToken(fd)) + { + *eof = TRUE; + } + return TRUE; } bool wxResourceReadOneResource(wxInputStream *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - // static or #define - if (!wxGetResourceToken(fd)) - { - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "#define") == 0) - { - wxGetResourceToken(fd); - char *name = copystring(wxResourceBuffer); - wxGetResourceToken(fd); - char *value = copystring(wxResourceBuffer); - if (isalpha(value[0])) + if (!table) + table = wxDefaultResourceTable; + + // static or #define + if (!wxGetResourceToken(fd)) { - int val = (int)atol(value); - wxResourceAddIdentifier(name, val, table); + *eof = TRUE; + return FALSE; } - else + + if (strcmp(wxResourceBuffer, "#define") == 0) { - wxLogWarning(_("#define %s must be an integer."), name); - delete[] name; - delete[] value; - return FALSE; + wxGetResourceToken(fd); + wxChar *name = copystring(wxConvLibc.cMB2WX(wxResourceBuffer)); + wxGetResourceToken(fd); + wxChar *value = copystring(wxConvLibc.cMB2WX(wxResourceBuffer)); + if (wxIsalpha(value[0])) + { + int val = (int)wxAtol(value); + wxResourceAddIdentifier(name, val, table); + } + else + { + wxLogWarning(_("#define %s must be an integer."), name); + delete[] name; + delete[] value; + return FALSE; + } + delete[] name; + delete[] value; + + return TRUE; } - delete[] name; - delete[] value; - - return TRUE; - } - else if (strcmp(wxResourceBuffer, "#include") == 0) - { - wxGetResourceToken(fd); - char *name = copystring(wxResourceBuffer); - char *actualName = name; - if (name[0] == '"') - actualName = name + 1; - int len = strlen(name); - if ((len > 0) && (name[len-1] == '"')) - name[len-1] = 0; - if (!wxResourceParseIncludeFile(actualName, table)) + else if (strcmp(wxResourceBuffer, "#include") == 0) { - wxLogWarning(_("Could not find resource include file %s."), actualName); + wxGetResourceToken(fd); + wxChar *name = copystring(wxConvLibc.cMB2WX(wxResourceBuffer)); + wxChar *actualName = name; + if (name[0] == wxT('"')) + actualName = name + 1; + int len = wxStrlen(name); + if ((len > 0) && (name[len-1] == wxT('"'))) + name[len-1] = 0; + if (!wxResourceParseIncludeFile(actualName, table)) + { + wxLogWarning(_("Could not find resource include file %s."), actualName); + } + delete[] name; + return TRUE; } - delete[] name; - return TRUE; - } - else if (strcmp(wxResourceBuffer, "static") != 0) - { - char buf[300]; - strcpy(buf, _("Found ")); - strncat(buf, wxResourceBuffer, 30); - strcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); - wxLogWarning(buf); - return FALSE; - } - - // char - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "char") != 0) - { - wxLogWarning(_("Expected 'char' whilst parsing resource.")); - return FALSE; - } - - // *name - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (wxResourceBuffer[0] != '*') - { - wxLogWarning(_("Expected '*' whilst parsing resource.")); - return FALSE; - } - char nameBuf[100]; - strncpy(nameBuf, wxResourceBuffer+1, 99); - - // = - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "=") != 0) - { - wxLogWarning(_("Expected '=' whilst parsing resource.")); - return FALSE; - } - - // String - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - else - { - if (!db.ReadPrologFromString(wxResourceBuffer)) + else if (strcmp(wxResourceBuffer, "static") != 0) { - wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); - return FALSE; + wxChar buf[300]; + wxStrcpy(buf, _("Found ")); + wxStrncat(buf, wxConvLibc.cMB2WX(wxResourceBuffer), 30); + wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); + wxLogWarning(buf); + return FALSE; } - } - // Semicolon - if (!wxGetResourceToken(fd)) - { - *eof = TRUE; - } - return TRUE; + + // char + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (strcmp(wxResourceBuffer, "char") != 0) + { + wxLogWarning(_("Expected 'char' whilst parsing resource.")); + return FALSE; + } + + // *name + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (wxResourceBuffer[0] != '*') + { + wxLogWarning(_("Expected '*' whilst parsing resource.")); + return FALSE; + } + char nameBuf[100]; + strncpy(nameBuf, wxResourceBuffer+1, 99); + + // = + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (strcmp(wxResourceBuffer, "=") != 0) + { + wxLogWarning(_("Expected '=' whilst parsing resource.")); + return FALSE; + } + + // String + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + else + { + if (!db.ReadPrologFromString(wxResourceBuffer)) + { + wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); + return FALSE; + } + } + // Semicolon + if (!wxGetResourceToken(fd)) + { + *eof = TRUE; + } + return TRUE; } /* - * Parses string window style into integer window style - */ +* Parses string window style into integer window style +*/ /* - * Style flag parsing, e.g. - * "wxSYSTEM_MENU | wxBORDER" -> integer - */ +* Style flag parsing, e.g. +* "wxSYSTEM_MENU | wxBORDER" -> integer +*/ wxChar* wxResourceParseWord(wxChar*s, int *i) { - if (!s) - return (wxChar*) NULL; - - static wxChar buf[150]; - int len = wxStrlen(s); - int j = 0; - int ii = *i; - while ((ii < len) && (wxIsalpha(s[ii]) || (s[ii] == wxT('_')))) - { - buf[j] = s[ii]; - j ++; - ii ++; - } - buf[j] = 0; - - // Eat whitespace and conjunction characters - while ((ii < len) && - ((s[ii] == wxT(' ')) || (s[ii] == wxT('|')) || (s[ii] == wxT(',')))) - { - ii ++; - } - *i = ii; - if (j == 0) - return (wxChar*) NULL; - else - return buf; + if (!s) + return (wxChar*) NULL; + + static wxChar buf[150]; + int len = wxStrlen(s); + int j = 0; + int ii = *i; + while ((ii < len) && (wxIsalpha(s[ii]) || (s[ii] == wxT('_')))) + { + buf[j] = s[ii]; + j ++; + ii ++; + } + buf[j] = 0; + + // Eat whitespace and conjunction characters + while ((ii < len) && + ((s[ii] == wxT(' ')) || (s[ii] == wxT('|')) || (s[ii] == wxT(',')))) + { + ii ++; + } + *i = ii; + if (j == 0) + return (wxChar*) NULL; + else + return buf; } struct wxResourceBitListStruct { - wxChar *word; - long bits; + wxChar *word; + long bits; }; static wxResourceBitListStruct wxResourceBitListTable[] = { - /* wxListBox */ - { wxT("wxSINGLE"), wxLB_SINGLE }, - { wxT("wxMULTIPLE"), wxLB_MULTIPLE }, - { wxT("wxEXTENDED"), wxLB_EXTENDED }, - { wxT("wxLB_SINGLE"), wxLB_SINGLE }, - { wxT("wxLB_MULTIPLE"), wxLB_MULTIPLE }, - { wxT("wxLB_EXTENDED"), wxLB_EXTENDED }, - { wxT("wxLB_NEEDED_SB"), wxLB_NEEDED_SB }, - { wxT("wxLB_ALWAYS_SB"), wxLB_ALWAYS_SB }, - { wxT("wxLB_SORT"), wxLB_SORT }, - { wxT("wxLB_OWNERDRAW"), wxLB_OWNERDRAW }, - { wxT("wxLB_HSCROLL"), wxLB_HSCROLL }, - - /* wxComboxBox */ - { wxT("wxCB_SIMPLE"), wxCB_SIMPLE }, - { wxT("wxCB_DROPDOWN"), wxCB_DROPDOWN }, - { wxT("wxCB_READONLY"), wxCB_READONLY }, - { wxT("wxCB_SORT"), wxCB_SORT }, - - /* wxGauge */ - { wxT("wxGA_PROGRESSBAR"), wxGA_PROGRESSBAR }, - { wxT("wxGA_HORIZONTAL"), wxGA_HORIZONTAL }, - { wxT("wxGA_VERTICAL"), wxGA_VERTICAL }, - - /* wxTextCtrl */ - { wxT("wxPASSWORD"), wxPASSWORD}, - { wxT("wxPROCESS_ENTER"), wxPROCESS_ENTER}, - { wxT("wxTE_PASSWORD"), wxTE_PASSWORD}, - { wxT("wxTE_READONLY"), wxTE_READONLY}, - { wxT("wxTE_PROCESS_ENTER"), wxTE_PROCESS_ENTER}, - { wxT("wxTE_MULTILINE"), wxTE_MULTILINE}, - { wxT("wxTE_NO_VSCROLL"), wxTE_NO_VSCROLL}, - - /* wxRadioBox/wxRadioButton */ - { wxT("wxRB_GROUP"), wxRB_GROUP }, - { wxT("wxRA_SPECIFY_COLS"), wxRA_SPECIFY_COLS }, - { wxT("wxRA_SPECIFY_ROWS"), wxRA_SPECIFY_ROWS }, - { wxT("wxRA_HORIZONTAL"), wxRA_HORIZONTAL }, - { wxT("wxRA_VERTICAL"), wxRA_VERTICAL }, - - /* wxSlider */ - { wxT("wxSL_HORIZONTAL"), wxSL_HORIZONTAL }, - { wxT("wxSL_VERTICAL"), wxSL_VERTICAL }, - { wxT("wxSL_AUTOTICKS"), wxSL_AUTOTICKS }, - { wxT("wxSL_LABELS"), wxSL_LABELS }, - { wxT("wxSL_LEFT"), wxSL_LEFT }, - { wxT("wxSL_TOP"), wxSL_TOP }, - { wxT("wxSL_RIGHT"), wxSL_RIGHT }, - { wxT("wxSL_BOTTOM"), wxSL_BOTTOM }, - { wxT("wxSL_BOTH"), wxSL_BOTH }, - { wxT("wxSL_SELRANGE"), wxSL_SELRANGE }, - - /* wxScrollBar */ - { wxT("wxSB_HORIZONTAL"), wxSB_HORIZONTAL }, - { wxT("wxSB_VERTICAL"), wxSB_VERTICAL }, - - /* wxButton */ - { wxT("wxBU_AUTODRAW"), wxBU_AUTODRAW }, - { wxT("wxBU_NOAUTODRAW"), wxBU_NOAUTODRAW }, - - /* wxTreeCtrl */ - { wxT("wxTR_HAS_BUTTONS"), wxTR_HAS_BUTTONS }, - { wxT("wxTR_EDIT_LABELS"), wxTR_EDIT_LABELS }, - { wxT("wxTR_LINES_AT_ROOT"), wxTR_LINES_AT_ROOT }, - - /* wxListCtrl */ - { wxT("wxLC_ICON"), wxLC_ICON }, - { wxT("wxLC_SMALL_ICON"), wxLC_SMALL_ICON }, - { wxT("wxLC_LIST"), wxLC_LIST }, - { wxT("wxLC_REPORT"), wxLC_REPORT }, - { wxT("wxLC_ALIGN_TOP"), wxLC_ALIGN_TOP }, - { wxT("wxLC_ALIGN_LEFT"), wxLC_ALIGN_LEFT }, - { wxT("wxLC_AUTOARRANGE"), wxLC_AUTOARRANGE }, - { wxT("wxLC_USER_TEXT"), wxLC_USER_TEXT }, - { wxT("wxLC_EDIT_LABELS"), wxLC_EDIT_LABELS }, - { wxT("wxLC_NO_HEADER"), wxLC_NO_HEADER }, - { wxT("wxLC_NO_SORT_HEADER"), wxLC_NO_SORT_HEADER }, - { wxT("wxLC_SINGLE_SEL"), wxLC_SINGLE_SEL }, - { wxT("wxLC_SORT_ASCENDING"), wxLC_SORT_ASCENDING }, - { wxT("wxLC_SORT_DESCENDING"), wxLC_SORT_DESCENDING }, - - /* wxSpinButton */ - { wxT("wxSP_VERTICAL"), wxSP_VERTICAL}, - { wxT("wxSP_HORIZONTAL"), wxSP_HORIZONTAL}, - { wxT("wxSP_ARROW_KEYS"), wxSP_ARROW_KEYS}, - { wxT("wxSP_WRAP"), wxSP_WRAP}, - - /* wxSplitterWnd */ - { wxT("wxSP_NOBORDER"), wxSP_NOBORDER}, - { wxT("wxSP_3D"), wxSP_3D}, - { wxT("wxSP_BORDER"), wxSP_BORDER}, - - /* wxTabCtrl */ - { wxT("wxTC_MULTILINE"), wxTC_MULTILINE}, - { wxT("wxTC_RIGHTJUSTIFY"), wxTC_RIGHTJUSTIFY}, - { wxT("wxTC_FIXEDWIDTH"), wxTC_FIXEDWIDTH}, - { wxT("wxTC_OWNERDRAW"), wxTC_OWNERDRAW}, - - /* wxStatusBar95 */ - { wxT("wxST_SIZEGRIP"), wxST_SIZEGRIP}, - - /* wxControl */ - { wxT("wxFIXED_LENGTH"), wxFIXED_LENGTH}, - { wxT("wxALIGN_LEFT"), wxALIGN_LEFT}, - { wxT("wxALIGN_CENTER"), wxALIGN_CENTER}, - { wxT("wxALIGN_CENTRE"), wxALIGN_CENTRE}, - { wxT("wxALIGN_RIGHT"), wxALIGN_RIGHT}, - { wxT("wxCOLOURED"), wxCOLOURED}, - - /* wxToolBar */ - { wxT("wxTB_3DBUTTONS"), wxTB_3DBUTTONS}, - { wxT("wxTB_HORIZONTAL"), wxTB_HORIZONTAL}, - { wxT("wxTB_VERTICAL"), wxTB_VERTICAL}, - { wxT("wxTB_FLAT"), wxTB_FLAT}, - - /* wxDialog */ - { wxT("wxDIALOG_MODAL"), wxDIALOG_MODAL }, - - /* Generic */ - { wxT("wxVSCROLL"), wxVSCROLL }, - { wxT("wxHSCROLL"), wxHSCROLL }, - { wxT("wxCAPTION"), wxCAPTION }, - { wxT("wxSTAY_ON_TOP"), wxSTAY_ON_TOP}, - { wxT("wxICONIZE"), wxICONIZE}, - { wxT("wxMINIMIZE"), wxICONIZE}, - { wxT("wxMAXIMIZE"), wxMAXIMIZE}, - { wxT("wxSDI"), 0}, - { wxT("wxMDI_PARENT"), 0}, - { wxT("wxMDI_CHILD"), 0}, - { wxT("wxTHICK_FRAME"), wxTHICK_FRAME}, - { wxT("wxRESIZE_BORDER"), wxRESIZE_BORDER}, - { wxT("wxSYSTEM_MENU"), wxSYSTEM_MENU}, - { wxT("wxMINIMIZE_BOX"), wxMINIMIZE_BOX}, - { wxT("wxMAXIMIZE_BOX"), wxMAXIMIZE_BOX}, - { wxT("wxRESIZE_BOX"), wxRESIZE_BOX}, - { wxT("wxDEFAULT_FRAME_STYLE"), wxDEFAULT_FRAME_STYLE}, - { wxT("wxDEFAULT_FRAME"), wxDEFAULT_FRAME_STYLE}, - { wxT("wxDEFAULT_DIALOG_STYLE"), wxDEFAULT_DIALOG_STYLE}, - { wxT("wxBORDER"), wxBORDER}, - { wxT("wxRETAINED"), wxRETAINED}, - { wxT("wxNATIVE_IMPL"), 0}, - { wxT("wxEXTENDED_IMPL"), 0}, - { wxT("wxBACKINGSTORE"), wxBACKINGSTORE}, -// { wxT("wxFLAT"), wxFLAT}, -// { wxT("wxMOTIF_RESIZE"), wxMOTIF_RESIZE}, - { wxT("wxFIXED_LENGTH"), 0}, - { wxT("wxDOUBLE_BORDER"), wxDOUBLE_BORDER}, - { wxT("wxSUNKEN_BORDER"), wxSUNKEN_BORDER}, - { wxT("wxRAISED_BORDER"), wxRAISED_BORDER}, - { wxT("wxSIMPLE_BORDER"), wxSIMPLE_BORDER}, - { wxT("wxSTATIC_BORDER"), wxSTATIC_BORDER}, - { wxT("wxTRANSPARENT_WINDOW"), wxTRANSPARENT_WINDOW}, - { wxT("wxNO_BORDER"), wxNO_BORDER}, - { wxT("wxCLIP_CHILDREN"), wxCLIP_CHILDREN}, - { wxT("wxTAB_TRAVERSAL"), 0}, // Compatibility only - - { wxT("wxTINY_CAPTION_HORIZ"), wxTINY_CAPTION_HORIZ}, - { wxT("wxTINY_CAPTION_VERT"), wxTINY_CAPTION_VERT}, - - // Text font families - { wxT("wxDEFAULT"), wxDEFAULT}, - { wxT("wxDECORATIVE"), wxDECORATIVE}, - { wxT("wxROMAN"), wxROMAN}, - { wxT("wxSCRIPT"), wxSCRIPT}, - { wxT("wxSWISS"), wxSWISS}, - { wxT("wxMODERN"), wxMODERN}, - { wxT("wxTELETYPE"), wxTELETYPE}, - { wxT("wxVARIABLE"), wxVARIABLE}, - { wxT("wxFIXED"), wxFIXED}, - { wxT("wxNORMAL"), wxNORMAL}, - { wxT("wxLIGHT"), wxLIGHT}, - { wxT("wxBOLD"), wxBOLD}, - { wxT("wxITALIC"), wxITALIC}, - { wxT("wxSLANT"), wxSLANT}, - { wxT("wxSOLID"), wxSOLID}, - { wxT("wxDOT"), wxDOT}, - { wxT("wxLONG_DASH"), wxLONG_DASH}, - { wxT("wxSHORT_DASH"), wxSHORT_DASH}, - { wxT("wxDOT_DASH"), wxDOT_DASH}, - { wxT("wxUSER_DASH"), wxUSER_DASH}, - { wxT("wxTRANSPARENT"), wxTRANSPARENT}, - { wxT("wxSTIPPLE"), wxSTIPPLE}, - { wxT("wxBDIAGONAL_HATCH"), wxBDIAGONAL_HATCH}, - { wxT("wxCROSSDIAG_HATCH"), wxCROSSDIAG_HATCH}, - { wxT("wxFDIAGONAL_HATCH"), wxFDIAGONAL_HATCH}, - { wxT("wxCROSS_HATCH"), wxCROSS_HATCH}, - { wxT("wxHORIZONTAL_HATCH"), wxHORIZONTAL_HATCH}, - { wxT("wxVERTICAL_HATCH"), wxVERTICAL_HATCH}, - { wxT("wxJOIN_BEVEL"), wxJOIN_BEVEL}, - { wxT("wxJOIN_MITER"), wxJOIN_MITER}, - { wxT("wxJOIN_ROUND"), wxJOIN_ROUND}, - { wxT("wxCAP_ROUND"), wxCAP_ROUND}, - { wxT("wxCAP_PROJECTING"), wxCAP_PROJECTING}, - { wxT("wxCAP_BUTT"), wxCAP_BUTT}, - - // Logical ops - { wxT("wxCLEAR"), wxCLEAR}, - { wxT("wxXOR"), wxXOR}, - { wxT("wxINVERT"), wxINVERT}, - { wxT("wxOR_REVERSE"), wxOR_REVERSE}, - { wxT("wxAND_REVERSE"), wxAND_REVERSE}, - { wxT("wxCOPY"), wxCOPY}, - { wxT("wxAND"), wxAND}, - { wxT("wxAND_INVERT"), wxAND_INVERT}, - { wxT("wxNO_OP"), wxNO_OP}, - { wxT("wxNOR"), wxNOR}, - { wxT("wxEQUIV"), wxEQUIV}, - { wxT("wxSRC_INVERT"), wxSRC_INVERT}, - { wxT("wxOR_INVERT"), wxOR_INVERT}, - { wxT("wxNAND"), wxNAND}, - { wxT("wxOR"), wxOR}, - { wxT("wxSET"), wxSET}, - - { wxT("wxFLOOD_SURFACE"), wxFLOOD_SURFACE}, - { wxT("wxFLOOD_BORDER"), wxFLOOD_BORDER}, - { wxT("wxODDEVEN_RULE"), wxODDEVEN_RULE}, - { wxT("wxWINDING_RULE"), wxWINDING_RULE}, - { wxT("wxHORIZONTAL"), wxHORIZONTAL}, - { wxT("wxVERTICAL"), wxVERTICAL}, - { wxT("wxBOTH"), wxBOTH}, - { wxT("wxCENTER_FRAME"), wxCENTER_FRAME}, - { wxT("wxOK"), wxOK}, - { wxT("wxYES_NO"), wxYES_NO}, - { wxT("wxCANCEL"), wxCANCEL}, - { wxT("wxYES"), wxYES}, - { wxT("wxNO"), wxNO}, - { wxT("wxICON_EXCLAMATION"), wxICON_EXCLAMATION}, - { wxT("wxICON_HAND"), wxICON_HAND}, - { wxT("wxICON_QUESTION"), wxICON_QUESTION}, - { wxT("wxICON_INFORMATION"), wxICON_INFORMATION}, - { wxT("wxICON_STOP"), wxICON_STOP}, - { wxT("wxICON_ASTERISK"), wxICON_ASTERISK}, - { wxT("wxICON_MASK"), wxICON_MASK}, - { wxT("wxCENTRE"), wxCENTRE}, - { wxT("wxCENTER"), wxCENTRE}, - { wxT("wxUSER_COLOURS"), wxUSER_COLOURS}, - { wxT("wxVERTICAL_LABEL"), 0}, - { wxT("wxHORIZONTAL_LABEL"), 0}, - - // Bitmap types (not strictly styles) - { wxT("wxBITMAP_TYPE_XPM"), wxBITMAP_TYPE_XPM}, - { wxT("wxBITMAP_TYPE_XBM"), wxBITMAP_TYPE_XBM}, - { wxT("wxBITMAP_TYPE_BMP"), wxBITMAP_TYPE_BMP}, - { wxT("wxBITMAP_TYPE_RESOURCE"), wxBITMAP_TYPE_BMP_RESOURCE}, - { wxT("wxBITMAP_TYPE_BMP_RESOURCE"), wxBITMAP_TYPE_BMP_RESOURCE}, - { wxT("wxBITMAP_TYPE_GIF"), wxBITMAP_TYPE_GIF}, - { wxT("wxBITMAP_TYPE_TIF"), wxBITMAP_TYPE_TIF}, - { wxT("wxBITMAP_TYPE_ICO"), wxBITMAP_TYPE_ICO}, - { wxT("wxBITMAP_TYPE_ICO_RESOURCE"), wxBITMAP_TYPE_ICO_RESOURCE}, - { wxT("wxBITMAP_TYPE_CUR"), wxBITMAP_TYPE_CUR}, - { wxT("wxBITMAP_TYPE_CUR_RESOURCE"), wxBITMAP_TYPE_CUR_RESOURCE}, - { wxT("wxBITMAP_TYPE_XBM_DATA"), wxBITMAP_TYPE_XBM_DATA}, - { wxT("wxBITMAP_TYPE_XPM_DATA"), wxBITMAP_TYPE_XPM_DATA}, - { wxT("wxBITMAP_TYPE_ANY"), wxBITMAP_TYPE_ANY} + /* wxListBox */ + { wxT("wxSINGLE"), wxLB_SINGLE }, + { wxT("wxMULTIPLE"), wxLB_MULTIPLE }, + { wxT("wxEXTENDED"), wxLB_EXTENDED }, + { wxT("wxLB_SINGLE"), wxLB_SINGLE }, + { wxT("wxLB_MULTIPLE"), wxLB_MULTIPLE }, + { wxT("wxLB_EXTENDED"), wxLB_EXTENDED }, + { wxT("wxLB_NEEDED_SB"), wxLB_NEEDED_SB }, + { wxT("wxLB_ALWAYS_SB"), wxLB_ALWAYS_SB }, + { wxT("wxLB_SORT"), wxLB_SORT }, + { wxT("wxLB_OWNERDRAW"), wxLB_OWNERDRAW }, + { wxT("wxLB_HSCROLL"), wxLB_HSCROLL }, + + /* wxComboxBox */ + { wxT("wxCB_SIMPLE"), wxCB_SIMPLE }, + { wxT("wxCB_DROPDOWN"), wxCB_DROPDOWN }, + { wxT("wxCB_READONLY"), wxCB_READONLY }, + { wxT("wxCB_SORT"), wxCB_SORT }, + + /* wxGauge */ + { wxT("wxGA_PROGRESSBAR"), wxGA_PROGRESSBAR }, + { wxT("wxGA_HORIZONTAL"), wxGA_HORIZONTAL }, + { wxT("wxGA_VERTICAL"), wxGA_VERTICAL }, + + /* wxTextCtrl */ + { wxT("wxPASSWORD"), wxPASSWORD}, + { wxT("wxPROCESS_ENTER"), wxPROCESS_ENTER}, + { wxT("wxTE_PASSWORD"), wxTE_PASSWORD}, + { wxT("wxTE_READONLY"), wxTE_READONLY}, + { wxT("wxTE_PROCESS_ENTER"), wxTE_PROCESS_ENTER}, + { wxT("wxTE_MULTILINE"), wxTE_MULTILINE}, + { wxT("wxTE_NO_VSCROLL"), wxTE_NO_VSCROLL}, + + /* wxRadioBox/wxRadioButton */ + { wxT("wxRB_GROUP"), wxRB_GROUP }, + { wxT("wxRA_SPECIFY_COLS"), wxRA_SPECIFY_COLS }, + { wxT("wxRA_SPECIFY_ROWS"), wxRA_SPECIFY_ROWS }, + { wxT("wxRA_HORIZONTAL"), wxRA_HORIZONTAL }, + { wxT("wxRA_VERTICAL"), wxRA_VERTICAL }, + + /* wxSlider */ + { wxT("wxSL_HORIZONTAL"), wxSL_HORIZONTAL }, + { wxT("wxSL_VERTICAL"), wxSL_VERTICAL }, + { wxT("wxSL_AUTOTICKS"), wxSL_AUTOTICKS }, + { wxT("wxSL_LABELS"), wxSL_LABELS }, + { wxT("wxSL_LEFT"), wxSL_LEFT }, + { wxT("wxSL_TOP"), wxSL_TOP }, + { wxT("wxSL_RIGHT"), wxSL_RIGHT }, + { wxT("wxSL_BOTTOM"), wxSL_BOTTOM }, + { wxT("wxSL_BOTH"), wxSL_BOTH }, + { wxT("wxSL_SELRANGE"), wxSL_SELRANGE }, + + /* wxScrollBar */ + { wxT("wxSB_HORIZONTAL"), wxSB_HORIZONTAL }, + { wxT("wxSB_VERTICAL"), wxSB_VERTICAL }, + + /* wxButton */ + { wxT("wxBU_AUTODRAW"), wxBU_AUTODRAW }, + { wxT("wxBU_NOAUTODRAW"), wxBU_NOAUTODRAW }, + + /* wxTreeCtrl */ + { wxT("wxTR_HAS_BUTTONS"), wxTR_HAS_BUTTONS }, + { wxT("wxTR_EDIT_LABELS"), wxTR_EDIT_LABELS }, + { wxT("wxTR_LINES_AT_ROOT"), wxTR_LINES_AT_ROOT }, + + /* wxListCtrl */ + { wxT("wxLC_ICON"), wxLC_ICON }, + { wxT("wxLC_SMALL_ICON"), wxLC_SMALL_ICON }, + { wxT("wxLC_LIST"), wxLC_LIST }, + { wxT("wxLC_REPORT"), wxLC_REPORT }, + { wxT("wxLC_ALIGN_TOP"), wxLC_ALIGN_TOP }, + { wxT("wxLC_ALIGN_LEFT"), wxLC_ALIGN_LEFT }, + { wxT("wxLC_AUTOARRANGE"), wxLC_AUTOARRANGE }, + { wxT("wxLC_USER_TEXT"), wxLC_USER_TEXT }, + { wxT("wxLC_EDIT_LABELS"), wxLC_EDIT_LABELS }, + { wxT("wxLC_NO_HEADER"), wxLC_NO_HEADER }, + { wxT("wxLC_NO_SORT_HEADER"), wxLC_NO_SORT_HEADER }, + { wxT("wxLC_SINGLE_SEL"), wxLC_SINGLE_SEL }, + { wxT("wxLC_SORT_ASCENDING"), wxLC_SORT_ASCENDING }, + { wxT("wxLC_SORT_DESCENDING"), wxLC_SORT_DESCENDING }, + + /* wxSpinButton */ + { wxT("wxSP_VERTICAL"), wxSP_VERTICAL}, + { wxT("wxSP_HORIZONTAL"), wxSP_HORIZONTAL}, + { wxT("wxSP_ARROW_KEYS"), wxSP_ARROW_KEYS}, + { wxT("wxSP_WRAP"), wxSP_WRAP}, + + /* wxSplitterWnd */ + { wxT("wxSP_NOBORDER"), wxSP_NOBORDER}, + { wxT("wxSP_3D"), wxSP_3D}, + { wxT("wxSP_BORDER"), wxSP_BORDER}, + + /* wxTabCtrl */ + { wxT("wxTC_MULTILINE"), wxTC_MULTILINE}, + { wxT("wxTC_RIGHTJUSTIFY"), wxTC_RIGHTJUSTIFY}, + { wxT("wxTC_FIXEDWIDTH"), wxTC_FIXEDWIDTH}, + { wxT("wxTC_OWNERDRAW"), wxTC_OWNERDRAW}, + + /* wxStatusBar95 */ + { wxT("wxST_SIZEGRIP"), wxST_SIZEGRIP}, + + /* wxControl */ + { wxT("wxFIXED_LENGTH"), wxFIXED_LENGTH}, + { wxT("wxALIGN_LEFT"), wxALIGN_LEFT}, + { wxT("wxALIGN_CENTER"), wxALIGN_CENTER}, + { wxT("wxALIGN_CENTRE"), wxALIGN_CENTRE}, + { wxT("wxALIGN_RIGHT"), wxALIGN_RIGHT}, + { wxT("wxCOLOURED"), wxCOLOURED}, + + /* wxToolBar */ + { wxT("wxTB_3DBUTTONS"), wxTB_3DBUTTONS}, + { wxT("wxTB_HORIZONTAL"), wxTB_HORIZONTAL}, + { wxT("wxTB_VERTICAL"), wxTB_VERTICAL}, + { wxT("wxTB_FLAT"), wxTB_FLAT}, + + /* wxDialog */ + { wxT("wxDIALOG_MODAL"), wxDIALOG_MODAL }, + + /* Generic */ + { wxT("wxVSCROLL"), wxVSCROLL }, + { wxT("wxHSCROLL"), wxHSCROLL }, + { wxT("wxCAPTION"), wxCAPTION }, + { wxT("wxSTAY_ON_TOP"), wxSTAY_ON_TOP}, + { wxT("wxICONIZE"), wxICONIZE}, + { wxT("wxMINIMIZE"), wxICONIZE}, + { wxT("wxMAXIMIZE"), wxMAXIMIZE}, + { wxT("wxSDI"), 0}, + { wxT("wxMDI_PARENT"), 0}, + { wxT("wxMDI_CHILD"), 0}, + { wxT("wxTHICK_FRAME"), wxTHICK_FRAME}, + { wxT("wxRESIZE_BORDER"), wxRESIZE_BORDER}, + { wxT("wxSYSTEM_MENU"), wxSYSTEM_MENU}, + { wxT("wxMINIMIZE_BOX"), wxMINIMIZE_BOX}, + { wxT("wxMAXIMIZE_BOX"), wxMAXIMIZE_BOX}, + { wxT("wxRESIZE_BOX"), wxRESIZE_BOX}, + { wxT("wxDEFAULT_FRAME_STYLE"), wxDEFAULT_FRAME_STYLE}, + { wxT("wxDEFAULT_FRAME"), wxDEFAULT_FRAME_STYLE}, + { wxT("wxDEFAULT_DIALOG_STYLE"), wxDEFAULT_DIALOG_STYLE}, + { wxT("wxBORDER"), wxBORDER}, + { wxT("wxRETAINED"), wxRETAINED}, + { wxT("wxNATIVE_IMPL"), 0}, + { wxT("wxEXTENDED_IMPL"), 0}, + { wxT("wxBACKINGSTORE"), wxBACKINGSTORE}, + // { wxT("wxFLAT"), wxFLAT}, + // { wxT("wxMOTIF_RESIZE"), wxMOTIF_RESIZE}, + { wxT("wxFIXED_LENGTH"), 0}, + { wxT("wxDOUBLE_BORDER"), wxDOUBLE_BORDER}, + { wxT("wxSUNKEN_BORDER"), wxSUNKEN_BORDER}, + { wxT("wxRAISED_BORDER"), wxRAISED_BORDER}, + { wxT("wxSIMPLE_BORDER"), wxSIMPLE_BORDER}, + { wxT("wxSTATIC_BORDER"), wxSTATIC_BORDER}, + { wxT("wxTRANSPARENT_WINDOW"), wxTRANSPARENT_WINDOW}, + { wxT("wxNO_BORDER"), wxNO_BORDER}, + { wxT("wxCLIP_CHILDREN"), wxCLIP_CHILDREN}, + { wxT("wxTAB_TRAVERSAL"), 0}, // Compatibility only + + { wxT("wxTINY_CAPTION_HORIZ"), wxTINY_CAPTION_HORIZ}, + { wxT("wxTINY_CAPTION_VERT"), wxTINY_CAPTION_VERT}, + + // Text font families + { wxT("wxDEFAULT"), wxDEFAULT}, + { wxT("wxDECORATIVE"), wxDECORATIVE}, + { wxT("wxROMAN"), wxROMAN}, + { wxT("wxSCRIPT"), wxSCRIPT}, + { wxT("wxSWISS"), wxSWISS}, + { wxT("wxMODERN"), wxMODERN}, + { wxT("wxTELETYPE"), wxTELETYPE}, + { wxT("wxVARIABLE"), wxVARIABLE}, + { wxT("wxFIXED"), wxFIXED}, + { wxT("wxNORMAL"), wxNORMAL}, + { wxT("wxLIGHT"), wxLIGHT}, + { wxT("wxBOLD"), wxBOLD}, + { wxT("wxITALIC"), wxITALIC}, + { wxT("wxSLANT"), wxSLANT}, + { wxT("wxSOLID"), wxSOLID}, + { wxT("wxDOT"), wxDOT}, + { wxT("wxLONG_DASH"), wxLONG_DASH}, + { wxT("wxSHORT_DASH"), wxSHORT_DASH}, + { wxT("wxDOT_DASH"), wxDOT_DASH}, + { wxT("wxUSER_DASH"), wxUSER_DASH}, + { wxT("wxTRANSPARENT"), wxTRANSPARENT}, + { wxT("wxSTIPPLE"), wxSTIPPLE}, + { wxT("wxBDIAGONAL_HATCH"), wxBDIAGONAL_HATCH}, + { wxT("wxCROSSDIAG_HATCH"), wxCROSSDIAG_HATCH}, + { wxT("wxFDIAGONAL_HATCH"), wxFDIAGONAL_HATCH}, + { wxT("wxCROSS_HATCH"), wxCROSS_HATCH}, + { wxT("wxHORIZONTAL_HATCH"), wxHORIZONTAL_HATCH}, + { wxT("wxVERTICAL_HATCH"), wxVERTICAL_HATCH}, + { wxT("wxJOIN_BEVEL"), wxJOIN_BEVEL}, + { wxT("wxJOIN_MITER"), wxJOIN_MITER}, + { wxT("wxJOIN_ROUND"), wxJOIN_ROUND}, + { wxT("wxCAP_ROUND"), wxCAP_ROUND}, + { wxT("wxCAP_PROJECTING"), wxCAP_PROJECTING}, + { wxT("wxCAP_BUTT"), wxCAP_BUTT}, + + // Logical ops + { wxT("wxCLEAR"), wxCLEAR}, + { wxT("wxXOR"), wxXOR}, + { wxT("wxINVERT"), wxINVERT}, + { wxT("wxOR_REVERSE"), wxOR_REVERSE}, + { wxT("wxAND_REVERSE"), wxAND_REVERSE}, + { wxT("wxCOPY"), wxCOPY}, + { wxT("wxAND"), wxAND}, + { wxT("wxAND_INVERT"), wxAND_INVERT}, + { wxT("wxNO_OP"), wxNO_OP}, + { wxT("wxNOR"), wxNOR}, + { wxT("wxEQUIV"), wxEQUIV}, + { wxT("wxSRC_INVERT"), wxSRC_INVERT}, + { wxT("wxOR_INVERT"), wxOR_INVERT}, + { wxT("wxNAND"), wxNAND}, + { wxT("wxOR"), wxOR}, + { wxT("wxSET"), wxSET}, + + { wxT("wxFLOOD_SURFACE"), wxFLOOD_SURFACE}, + { wxT("wxFLOOD_BORDER"), wxFLOOD_BORDER}, + { wxT("wxODDEVEN_RULE"), wxODDEVEN_RULE}, + { wxT("wxWINDING_RULE"), wxWINDING_RULE}, + { wxT("wxHORIZONTAL"), wxHORIZONTAL}, + { wxT("wxVERTICAL"), wxVERTICAL}, + { wxT("wxBOTH"), wxBOTH}, + { wxT("wxCENTER_FRAME"), wxCENTER_FRAME}, + { wxT("wxOK"), wxOK}, + { wxT("wxYES_NO"), wxYES_NO}, + { wxT("wxCANCEL"), wxCANCEL}, + { wxT("wxYES"), wxYES}, + { wxT("wxNO"), wxNO}, + { wxT("wxICON_EXCLAMATION"), wxICON_EXCLAMATION}, + { wxT("wxICON_HAND"), wxICON_HAND}, + { wxT("wxICON_QUESTION"), wxICON_QUESTION}, + { wxT("wxICON_INFORMATION"), wxICON_INFORMATION}, + { wxT("wxICON_STOP"), wxICON_STOP}, + { wxT("wxICON_ASTERISK"), wxICON_ASTERISK}, + { wxT("wxICON_MASK"), wxICON_MASK}, + { wxT("wxCENTRE"), wxCENTRE}, + { wxT("wxCENTER"), wxCENTRE}, + { wxT("wxUSER_COLOURS"), wxUSER_COLOURS}, + { wxT("wxVERTICAL_LABEL"), 0}, + { wxT("wxHORIZONTAL_LABEL"), 0}, + + // Bitmap types (not strictly styles) + { wxT("wxBITMAP_TYPE_XPM"), wxBITMAP_TYPE_XPM}, + { wxT("wxBITMAP_TYPE_XBM"), wxBITMAP_TYPE_XBM}, + { wxT("wxBITMAP_TYPE_BMP"), wxBITMAP_TYPE_BMP}, + { wxT("wxBITMAP_TYPE_RESOURCE"), wxBITMAP_TYPE_BMP_RESOURCE}, + { wxT("wxBITMAP_TYPE_BMP_RESOURCE"), wxBITMAP_TYPE_BMP_RESOURCE}, + { wxT("wxBITMAP_TYPE_GIF"), wxBITMAP_TYPE_GIF}, + { wxT("wxBITMAP_TYPE_TIF"), wxBITMAP_TYPE_TIF}, + { wxT("wxBITMAP_TYPE_ICO"), wxBITMAP_TYPE_ICO}, + { wxT("wxBITMAP_TYPE_ICO_RESOURCE"), wxBITMAP_TYPE_ICO_RESOURCE}, + { wxT("wxBITMAP_TYPE_CUR"), wxBITMAP_TYPE_CUR}, + { wxT("wxBITMAP_TYPE_CUR_RESOURCE"), wxBITMAP_TYPE_CUR_RESOURCE}, + { wxT("wxBITMAP_TYPE_XBM_DATA"), wxBITMAP_TYPE_XBM_DATA}, + { wxT("wxBITMAP_TYPE_XPM_DATA"), wxBITMAP_TYPE_XPM_DATA}, + { wxT("wxBITMAP_TYPE_ANY"), wxBITMAP_TYPE_ANY} }; static int wxResourceBitListCount = (sizeof(wxResourceBitListTable)/sizeof(wxResourceBitListStruct)); long wxParseWindowStyle(const wxString& bitListString) { - int i = 0; - wxChar *word; - long bitList = 0; - word = wxResourceParseWord(WXSTRINGCAST bitListString, &i); - while (word != NULL) - { - bool found = FALSE; - int j; - for (j = 0; j < wxResourceBitListCount; j++) - if (wxStrcmp(wxResourceBitListTable[j].word, word) == 0) - { - bitList |= wxResourceBitListTable[j].bits; - found = TRUE; - break; - } - if (!found) - { - wxLogWarning(_("Unrecognized style %s whilst parsing resource."), word); - return 0; - } + int i = 0; + wxChar *word; + long bitList = 0; word = wxResourceParseWord(WXSTRINGCAST bitListString, &i); - } - return bitList; + while (word != NULL) + { + bool found = FALSE; + int j; + for (j = 0; j < wxResourceBitListCount; j++) + if (wxStrcmp(wxResourceBitListTable[j].word, word) == 0) + { + bitList |= wxResourceBitListTable[j].bits; + found = TRUE; + break; + } + if (!found) + { + wxLogWarning(_("Unrecognized style %s whilst parsing resource."), word); + return 0; + } + word = wxResourceParseWord(WXSTRINGCAST bitListString, &i); + } + return bitList; } /* - * Load a bitmap from a wxWindows resource, choosing an optimum - * depth and appropriate type. - */ +* Load a bitmap from a wxWindows resource, choosing an optimum +* depth and appropriate type. +*/ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *item = table->FindResource(resource); - if (item) - { - if ((item->GetType() == wxT("")) || (item->GetType() != wxT("wxBitmap"))) - { - wxLogWarning(_("%s not a bitmap resource specification."), (const wxChar*) resource); - return wxNullBitmap; - } - int thisDepth = wxDisplayDepth(); - long thisNoColours = (long)pow(2.0, (double)thisDepth); - - wxItemResource *optResource = (wxItemResource *) NULL; - - // Try to find optimum bitmap for this platform/colour depth - wxNode *node = item->GetChildren().First(); - while (node) + if (!table) + table = wxDefaultResourceTable; + + wxItemResource *item = table->FindResource(resource); + if (item) { - wxItemResource *child = (wxItemResource *)node->Data(); - int platform = (int)child->GetValue2(); - int noColours = (int)child->GetValue3(); -/* - char *name = child->GetName(); - int bitmapType = (int)child->GetValue1(); - int xRes = child->GetWidth(); - int yRes = child->GetHeight(); -*/ - - switch (platform) - { - case RESOURCE_PLATFORM_ANY: + if ((item->GetType() == wxT("")) || (item->GetType() != wxT("wxBitmap"))) { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours. - // If noColours is zero (unspecified), then assume this - // is the right one. - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; + wxLogWarning(_("%s not a bitmap resource specification."), (const wxChar*) resource); + return wxNullBitmap; } -#ifdef __WXMSW__ - case RESOURCE_PLATFORM_WINDOWS: + int thisDepth = wxDisplayDepth(); + long thisNoColours = (long)pow(2.0, (double)thisDepth); + + wxItemResource *optResource = (wxItemResource *) NULL; + + // Try to find optimum bitmap for this platform/colour depth + wxNode *node = item->GetChildren().First(); + while (node) { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours > 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } + wxItemResource *child = (wxItemResource *)node->Data(); + int platform = (int)child->GetValue2(); + int noColours = (int)child->GetValue3(); + /* + char *name = child->GetName(); + int bitmapType = (int)child->GetValue1(); + int xRes = child->GetWidth(); + int yRes = child->GetHeight(); + */ + + switch (platform) + { + case RESOURCE_PLATFORM_ANY: + { + if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) + optResource = child; + else + { + // Maximise the number of colours. + // If noColours is zero (unspecified), then assume this + // is the right one. + if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) + optResource = child; + } + break; + } +#ifdef __WXMSW__ + case RESOURCE_PLATFORM_WINDOWS: + { + if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) + optResource = child; + else + { + // Maximise the number of colours + if ((noColours > 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) + optResource = child; + } + break; + } #endif #ifdef __WXGTK__ - case RESOURCE_PLATFORM_X: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } + case RESOURCE_PLATFORM_X: + { + if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) + optResource = child; + else + { + // Maximise the number of colours + if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) + optResource = child; + } + break; + } #endif #ifdef wx_max - case RESOURCE_PLATFORM_MAC: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } + case RESOURCE_PLATFORM_MAC: + { + if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) + optResource = child; + else + { + // Maximise the number of colours + if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) + optResource = child; + } + break; + } #endif - default: - break; - } - node = node->Next(); - } - // If no matching resource, fail. - if (!optResource) - return wxNullBitmap; - - wxString name = optResource->GetName(); - int bitmapType = (int)optResource->GetValue1(); - switch (bitmapType) - { - case wxBITMAP_TYPE_XBM_DATA: - { -#ifdef __WXGTK__ - wxItemResource *item = table->FindResource(name); - if (!item) - { - wxLogWarning(_("Failed to find XBM resource %s.\n" - "Forgot to use wxResourceLoadBitmapData?"), (const wxChar*) name); - return wxNullBitmap; + default: + break; + } + node = node->Next(); } - return wxBitmap(item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()) ; + // If no matching resource, fail. + if (!optResource) + return wxNullBitmap; + + wxString name = optResource->GetName(); + int bitmapType = (int)optResource->GetValue1(); + switch (bitmapType) + { + case wxBITMAP_TYPE_XBM_DATA: + { +#ifdef __WXGTK__ + wxItemResource *item = table->FindResource(name); + if (!item) + { + wxLogWarning(_("Failed to find XBM resource %s.\n" + "Forgot to use wxResourceLoadBitmapData?"), (const wxChar*) name); + return wxNullBitmap; + } + return wxBitmap(item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()) ; #else - wxLogWarning(_("No XBM facility available!")); - break; + wxLogWarning(_("No XBM facility available!")); + break; #endif - } - case wxBITMAP_TYPE_XPM_DATA: - { + } + case wxBITMAP_TYPE_XPM_DATA: + { #if (defined(__WXGTK__)) || (defined(__WXMSW__) && wxUSE_XPM_IN_MSW) - wxItemResource *item = table->FindResource(name); - if (!item) - { - wxLogWarning(_("Failed to find XPM resource %s.\n" - "Forgot to use wxResourceLoadBitmapData?"), (const wxChar*) name); - return wxNullBitmap; - } - return wxBitmap((char **)item->GetValue1()); + wxItemResource *item = table->FindResource(name); + if (!item) + { + wxLogWarning(_("Failed to find XPM resource %s.\nForgot to use wxResourceLoadBitmapData?"), (const wxChar*) name); + return wxNullBitmap; + } + return wxBitmap((char **)item->GetValue1()); #else - wxLogWarning(_("No XPM facility available!")); - break; + wxLogWarning(_("No XPM facility available!")); + break; #endif - } - default: - { - return wxBitmap(name, bitmapType); - } - } + } + default: + { + return wxBitmap(name, bitmapType); + } + } #ifndef __WXGTK__ - return wxNullBitmap; + return wxNullBitmap; #endif } else { - wxLogWarning(_("Bitmap resource specification %s not found."), (const wxChar*) resource); - return wxNullBitmap; + wxLogWarning(_("Bitmap resource specification %s not found."), (const wxChar*) resource); + return wxNullBitmap; } } /* - * Load an icon from a wxWindows resource, choosing an optimum - * depth and appropriate type. - */ +* Load an icon from a wxWindows resource, choosing an optimum +* depth and appropriate type. +*/ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *item = table->FindResource(resource); - if (item) - { - if ((item->GetType() == wxT("")) || wxStrcmp(item->GetType(), wxT("wxIcon")) != 0) - { - wxLogWarning(_("%s not an icon resource specification."), (const wxChar*) resource); - return wxNullIcon; - } - int thisDepth = wxDisplayDepth(); - long thisNoColours = (long)pow(2.0, (double)thisDepth); - - wxItemResource *optResource = (wxItemResource *) NULL; - - // Try to find optimum icon for this platform/colour depth - wxNode *node = item->GetChildren().First(); - while (node) + if (!table) + table = wxDefaultResourceTable; + + wxItemResource *item = table->FindResource(resource); + if (item) { - wxItemResource *child = (wxItemResource *)node->Data(); - int platform = (int)child->GetValue2(); - int noColours = (int)child->GetValue3(); -/* - char *name = child->GetName(); - int bitmapType = (int)child->GetValue1(); - int xRes = child->GetWidth(); - int yRes = child->GetHeight(); -*/ - - switch (platform) - { - case RESOURCE_PLATFORM_ANY: + if ((item->GetType() == wxT("")) || wxStrcmp(item->GetType(), wxT("wxIcon")) != 0) { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours. - // If noColours is zero (unspecified), then assume this - // is the right one. - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; + wxLogWarning(_("%s not an icon resource specification."), (const wxChar*) resource); + return wxNullIcon; } -#ifdef __WXMSW__ - case RESOURCE_PLATFORM_WINDOWS: + int thisDepth = wxDisplayDepth(); + long thisNoColours = (long)pow(2.0, (double)thisDepth); + + wxItemResource *optResource = (wxItemResource *) NULL; + + // Try to find optimum icon for this platform/colour depth + wxNode *node = item->GetChildren().First(); + while (node) { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours > 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } + wxItemResource *child = (wxItemResource *)node->Data(); + int platform = (int)child->GetValue2(); + int noColours = (int)child->GetValue3(); + /* + char *name = child->GetName(); + int bitmapType = (int)child->GetValue1(); + int xRes = child->GetWidth(); + int yRes = child->GetHeight(); + */ + + switch (platform) + { + case RESOURCE_PLATFORM_ANY: + { + if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) + optResource = child; + else + { + // Maximise the number of colours. + // If noColours is zero (unspecified), then assume this + // is the right one. + if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) + optResource = child; + } + break; + } +#ifdef __WXMSW__ + case RESOURCE_PLATFORM_WINDOWS: + { + if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) + optResource = child; + else + { + // Maximise the number of colours + if ((noColours > 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) + optResource = child; + } + break; + } #endif #ifdef __WXGTK__ - case RESOURCE_PLATFORM_X: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } + case RESOURCE_PLATFORM_X: + { + if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) + optResource = child; + else + { + // Maximise the number of colours + if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) + optResource = child; + } + break; + } #endif #ifdef wx_max - case RESOURCE_PLATFORM_MAC: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } + case RESOURCE_PLATFORM_MAC: + { + if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) + optResource = child; + else + { + // Maximise the number of colours + if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) + optResource = child; + } + break; + } #endif - default: - break; - } - node = node->Next(); - } - // If no matching resource, fail. - if (!optResource) - return wxNullIcon; - - wxString name = optResource->GetName(); - int bitmapType = (int)optResource->GetValue1(); - switch (bitmapType) - { - case wxBITMAP_TYPE_XBM_DATA: - { -#ifdef __WXGTK__ - wxItemResource *item = table->FindResource(name); - if (!item) - { - wxLogWarning(_("Failed to find XBM resource %s.\n" - "Forgot to use wxResourceLoadIconData?"), (const wxChar*) name); - return wxNullIcon; + default: + break; + } + node = node->Next(); } - return wxIcon((const char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()); -#else - wxLogWarning(_("No XBM facility available!")); - break; -#endif - } - case wxBITMAP_TYPE_XPM_DATA: - { - // *** XPM ICON NOT YET IMPLEMENTED IN WXWINDOWS *** -/* -#if (defined(__WXGTK__)) || (defined(__WXMSW__) && wxUSE_XPM_IN_MSW) - wxItemResource *item = table->FindResource(name); - if (!item) + // If no matching resource, fail. + if (!optResource) + return wxNullIcon; + + wxString name = optResource->GetName(); + int bitmapType = (int)optResource->GetValue1(); + switch (bitmapType) { - char buf[400]; - sprintf(buf, _("Failed to find XPM resource %s.\nForgot to use wxResourceLoadIconData?"), name); - wxLogWarning(buf); - return NULL; - } - return wxIcon((char **)item->GetValue1()); + case wxBITMAP_TYPE_XBM_DATA: + { +#ifdef __WXGTK__ + wxItemResource *item = table->FindResource(name); + if (!item) + { + wxLogWarning(_("Failed to find XBM resource %s.\n" + "Forgot to use wxResourceLoadIconData?"), (const wxChar*) name); + return wxNullIcon; + } + return wxIcon((const char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()); #else - wxLogWarning(_("No XPM facility available!")); + wxLogWarning(_("No XBM facility available!")); + break; #endif -*/ - wxLogWarning(_("No XPM icon facility available!")); - break; - } - default: - { + } + case wxBITMAP_TYPE_XPM_DATA: + { + // *** XPM ICON NOT YET IMPLEMENTED IN WXWINDOWS *** + /* + #if (defined(__WXGTK__)) || (defined(__WXMSW__) && wxUSE_XPM_IN_MSW) + wxItemResource *item = table->FindResource(name); + if (!item) + { + char buf[400]; + sprintf(buf, _("Failed to find XPM resource %s.\nForgot to use wxResourceLoadIconData?"), name); + wxLogWarning(buf); + return NULL; + } + return wxIcon((char **)item->GetValue1()); + #else + wxLogWarning(_("No XPM facility available!")); + #endif + */ + wxLogWarning(_("No XPM icon facility available!")); + break; + } + default: + { #ifdef __WXGTK__ - wxLogWarning(_("Icon resource specification %s not found."), (const wxChar*) resource); + wxLogWarning(_("Icon resource specification %s not found."), (const wxChar*) resource); #else - return wxIcon(name, bitmapType); + return wxIcon(name, bitmapType); #endif - break; - } - } - return wxNullIcon; + break; + } + } + return wxNullIcon; } else { - wxLogWarning(_("Icon resource specification %s not found."), (const wxChar*) resource); - return wxNullIcon; + wxLogWarning(_("Icon resource specification %s not found."), (const wxChar*) resource); + return wxNullIcon; } } wxMenu *wxResourceCreateMenu(wxItemResource *item) { - wxMenu *menu = new wxMenu; - wxNode *node = item->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - if ((child->GetType() != wxT("")) && (child->GetType() == wxT("wxMenuSeparator"))) - menu->AppendSeparator(); - else if (child->GetChildren().Number() > 0) - { - wxMenu *subMenu = wxResourceCreateMenu(child); - if (subMenu) - menu->Append((int)child->GetValue1(), child->GetTitle(), subMenu, child->GetValue4()); - } - else + wxMenu *menu = new wxMenu; + wxNode *node = item->GetChildren().First(); + while (node) { - menu->Append((int)child->GetValue1(), child->GetTitle(), child->GetValue4(), (child->GetValue2() != 0)); + wxItemResource *child = (wxItemResource *)node->Data(); + if ((child->GetType() != wxT("")) && (child->GetType() == wxT("wxMenuSeparator"))) + menu->AppendSeparator(); + else if (child->GetChildren().Number() > 0) + { + wxMenu *subMenu = wxResourceCreateMenu(child); + if (subMenu) + menu->Append((int)child->GetValue1(), child->GetTitle(), subMenu, child->GetValue4()); + } + else + { + menu->Append((int)child->GetValue1(), child->GetTitle(), child->GetValue4(), (child->GetValue2() != 0)); + } + node = node->Next(); } - node = node->Next(); - } - return menu; + return menu; } wxMenuBar *wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *table, wxMenuBar *menuBar) { - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *menuResource = table->FindResource(resource); - if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu"))) - { - if (!menuBar) - menuBar = new wxMenuBar; - wxNode *node = menuResource->GetChildren().First(); - while (node) + if (!table) + table = wxDefaultResourceTable; + + wxItemResource *menuResource = table->FindResource(resource); + if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu"))) { - wxItemResource *child = (wxItemResource *)node->Data(); - wxMenu *menu = wxResourceCreateMenu(child); - if (menu) - menuBar->Append(menu, child->GetTitle()); - node = node->Next(); + if (!menuBar) + menuBar = new wxMenuBar; + wxNode *node = menuResource->GetChildren().First(); + while (node) + { + wxItemResource *child = (wxItemResource *)node->Data(); + wxMenu *menu = wxResourceCreateMenu(child); + if (menu) + menuBar->Append(menu, child->GetTitle()); + node = node->Next(); + } + return menuBar; } - return menuBar; - } - return (wxMenuBar *) NULL; + return (wxMenuBar *) NULL; } wxMenu *wxResourceCreateMenu(const wxString& resource, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *menuResource = table->FindResource(resource); - if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu"))) -// if (menuResource && (menuResource->GetType() == wxTYPE_MENU)) - return wxResourceCreateMenu(menuResource); - return (wxMenu *) NULL; + if (!table) + table = wxDefaultResourceTable; + + wxItemResource *menuResource = table->FindResource(resource); + if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu"))) + // if (menuResource && (menuResource->GetType() == wxTYPE_MENU)) + return wxResourceCreateMenu(menuResource); + return (wxMenu *) NULL; } // Global equivalents (so don't have to refer to default table explicitly) bool wxResourceParseData(const wxString& resource, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - return table->ParseResourceData(resource); + if (!table) + table = wxDefaultResourceTable; + + return table->ParseResourceData(resource); } bool wxResourceParseFile(const wxString& filename, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - return table->ParseResourceFile(filename); + if (!table) + table = wxDefaultResourceTable; + + return table->ParseResourceFile(filename); } // Register XBM/XPM data bool wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - return table->RegisterResourceBitmapData(name, bits, width, height); + if (!table) + table = wxDefaultResourceTable; + + return table->RegisterResourceBitmapData(name, bits, width, height); } bool wxResourceRegisterBitmapData(const wxString& name, char **data, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - return table->RegisterResourceBitmapData(name, data); + if (!table) + table = wxDefaultResourceTable; + + return table->RegisterResourceBitmapData(name, data); } void wxResourceClear(wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - table->ClearTable(); + if (!table) + table = wxDefaultResourceTable; + + table->ClearTable(); } /* - * Identifiers - */ +* Identifiers +*/ bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - table->identifiers.Put(name, (wxObject *)(long)value); - return TRUE; + if (!table) + table = wxDefaultResourceTable; + + table->identifiers.Put(name, (wxObject *)(long)value); + return TRUE; } int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - return (int)(long)table->identifiers.Get(name); + if (!table) + table = wxDefaultResourceTable; + + return (int)(long)table->identifiers.Get(name); } /* - * Parse #include file for #defines (only) - */ +* Parse #include file for #defines (only) +*/ bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - FILE *fd = fopen(f.fn_str(), "r"); - if (!fd) - { - return FALSE; - } - while (wxGetResourceToken(fd)) - { - if (strcmp(wxResourceBuffer, "#define") == 0) + if (!table) + table = wxDefaultResourceTable; + + FILE *fd = wxFopen(f, _T("r")); + if (!fd) { - wxGetResourceToken(fd); - wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - wxGetResourceToken(fd); - wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - if (wxIsdigit(value[0])) - { - int val = (int)wxAtol(value); - wxResourceAddIdentifier(name, val, table); - } - delete[] name; - delete[] value; + return FALSE; } - } - fclose(fd); - return TRUE; + while (wxGetResourceToken(fd)) + { + if (strcmp(wxResourceBuffer, "#define") == 0) + { + wxGetResourceToken(fd); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + wxGetResourceToken(fd); + wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + if (wxIsdigit(value[0])) + { + int val = (int)wxAtol(value); + wxResourceAddIdentifier(name, val, table); + } + delete[] name; + delete[] value; + } + } + fclose(fd); + return TRUE; } /* - * Reading strings as if they were .wxr files - */ +* Reading strings as if they were .wxr files +*/ static int getc_string(char *s) { - int ch = s[wxResourceStringPtr]; - if (ch == 0) - return EOF; - else - { - wxResourceStringPtr ++; - return ch; - } + int ch = s[wxResourceStringPtr]; + if (ch == 0) + return EOF; + else + { + wxResourceStringPtr ++; + return ch; + } } static int ungetc_string() { - wxResourceStringPtr --; - return 0; + wxResourceStringPtr --; + return 0; } bool wxEatWhiteSpaceString(char *s) { - int ch = 0; - - while ((ch = getc_string(s)) != EOF) - { - switch (ch) - { - case ' ': - case 0x0a: - case 0x0d: - case 0x09: + int ch = 0; + + while ((ch = getc_string(s)) != EOF) + { + switch (ch) + { + case ' ': + case 0x0a: + case 0x0d: + case 0x09: break; - case '/': + case '/': { - int prev_ch = ch; - ch = getc_string(s); - if (ch == EOF) - { - ungetc_string(); - return TRUE; - } - - if (ch == '*') - { - // Eat C comment - prev_ch = 0; - while ((ch = getc_string(s)) != EOF) - { - if (ch == '/' && prev_ch == '*') - break; - prev_ch = ch; - } - } - else - { - ungetc_string(); - ungetc_string(); - return TRUE; - } + int prev_ch = ch; + ch = getc_string(s); + if (ch == EOF) + { + ungetc_string(); + return TRUE; + } + + if (ch == '*') + { + // Eat C comment + prev_ch = 0; + while ((ch = getc_string(s)) != EOF) + { + if (ch == '/' && prev_ch == '*') + break; + prev_ch = ch; + } + } + else + { + ungetc_string(); + ungetc_string(); + return TRUE; + } } break; - default: + default: ungetc_string(); return TRUE; - - } - } - return FALSE; + + } + } + return FALSE; } bool wxGetResourceTokenString(char *s) { - if (!wxResourceBuffer) - wxReallocateResourceBuffer(); - wxResourceBuffer[0] = 0; - wxEatWhiteSpaceString(s); - - int ch = getc_string(s); - if (ch == '"') - { - // Get string - wxResourceBufferCount = 0; - ch = getc_string(s); - while (ch != '"') - { - int actualCh = ch; - if (ch == EOF) - { - wxResourceBuffer[wxResourceBufferCount] = 0; - return FALSE; - } - // Escaped characters - else if (ch == '\\') - { - int newCh = getc_string(s); - if (newCh == '"') - actualCh = '"'; - else if (newCh == 10) - actualCh = 10; - else + if (!wxResourceBuffer) + wxReallocateResourceBuffer(); + wxResourceBuffer[0] = 0; + wxEatWhiteSpaceString(s); + + int ch = getc_string(s); + if (ch == '"') + { + // Get string + wxResourceBufferCount = 0; + ch = getc_string(s); + while (ch != '"') { - ungetc_string(); + int actualCh = ch; + if (ch == EOF) + { + wxResourceBuffer[wxResourceBufferCount] = 0; + return FALSE; + } + // Escaped characters + else if (ch == '\\') + { + int newCh = getc_string(s); + if (newCh == '"') + actualCh = '"'; + else if (newCh == 10) + actualCh = 10; + else + { + ungetc_string(); + } + } + + if (wxResourceBufferCount >= wxResourceBufferSize-1) + wxReallocateResourceBuffer(); + wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; + wxResourceBufferCount ++; + ch = getc_string(s); } - } - - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; - wxResourceBufferCount ++; - ch = getc_string(s); + wxResourceBuffer[wxResourceBufferCount] = 0; } - wxResourceBuffer[wxResourceBufferCount] = 0; - } - else - { - wxResourceBufferCount = 0; - // Any other token - while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) + else { - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)ch; - wxResourceBufferCount ++; - - ch = getc_string(s); + wxResourceBufferCount = 0; + // Any other token + while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) + { + if (wxResourceBufferCount >= wxResourceBufferSize-1) + wxReallocateResourceBuffer(); + wxResourceBuffer[wxResourceBufferCount] = (char)ch; + wxResourceBufferCount ++; + + ch = getc_string(s); + } + wxResourceBuffer[wxResourceBufferCount] = 0; + if (ch == EOF) + return FALSE; } - wxResourceBuffer[wxResourceBufferCount] = 0; - if (ch == EOF) - return FALSE; - } - return TRUE; + return TRUE; } /* - * Files are in form: - static char *name = "...."; - with possible comments. - */ +* Files are in form: +static char *name = "...."; +with possible comments. +*/ bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - // static or #define - if (!wxGetResourceTokenString(s)) - { - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "#define") == 0) - { - wxGetResourceTokenString(s); - wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - wxGetResourceTokenString(s); - wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - if (wxIsdigit(value[0])) + if (!table) + table = wxDefaultResourceTable; + + // static or #define + if (!wxGetResourceTokenString(s)) { - int val = (int)wxAtol(value); - wxResourceAddIdentifier(name, val, table); + *eof = TRUE; + return FALSE; } - else + + if (strcmp(wxResourceBuffer, "#define") == 0) { - wxLogWarning(_("#define %s must be an integer."), name); - delete[] name; - delete[] value; - return FALSE; + wxGetResourceTokenString(s); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + wxGetResourceTokenString(s); + wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + if (wxIsdigit(value[0])) + { + int val = (int)wxAtol(value); + wxResourceAddIdentifier(name, val, table); + } + else + { + wxLogWarning(_("#define %s must be an integer."), name); + delete[] name; + delete[] value; + return FALSE; + } + delete[] name; + delete[] value; + + return TRUE; } - delete[] name; - delete[] value; - - return TRUE; - } -/* - else if (strcmp(wxResourceBuffer, "#include") == 0) - { + /* + else if (strcmp(wxResourceBuffer, "#include") == 0) + { wxGetResourceTokenString(s); char *name = copystring(wxResourceBuffer); char *actualName = name; if (name[0] == '"') - actualName = name + 1; + actualName = name + 1; int len = strlen(name); if ((len > 0) && (name[len-1] == '"')) - name[len-1] = 0; + name[len-1] = 0; if (!wxResourceParseIncludeFile(actualName, table)) { - char buf[400]; - sprintf(buf, _("Could not find resource include file %s."), actualName); - wxLogWarning(buf); + char buf[400]; + sprintf(buf, _("Could not find resource include file %s."), actualName); + wxLogWarning(buf); } delete[] name; return TRUE; - } -*/ - else if (strcmp(wxResourceBuffer, "static") != 0) - { - wxChar buf[300]; - wxStrcpy(buf, _("Found ")); - wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30); - wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); - wxLogWarning(buf); - return FALSE; - } - - // char - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "char") != 0) - { - wxLogWarning(_("Expected 'char' whilst parsing resource.")); - return FALSE; - } - - // *name - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (wxResourceBuffer[0] != '*') - { - wxLogWarning(_("Expected '*' whilst parsing resource.")); - return FALSE; - } - wxChar nameBuf[100]; - wxMB2WX(nameBuf, wxResourceBuffer+1, 99); - nameBuf[99] = 0; - - // = - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "=") != 0) - { - wxLogWarning(_("Expected '=' whilst parsing resource.")); - return FALSE; - } - - // String - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - else - { - if (!db.ReadPrologFromString(wxResourceBuffer)) + } + */ + else if (strcmp(wxResourceBuffer, "static") != 0) { - wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); - return FALSE; + wxChar buf[300]; + wxStrcpy(buf, _("Found ")); + wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30); + wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); + wxLogWarning(buf); + return FALSE; } - } - // Semicolon - if (!wxGetResourceTokenString(s)) - { - *eof = TRUE; - } - return TRUE; + + // char + if (!wxGetResourceTokenString(s)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (strcmp(wxResourceBuffer, "char") != 0) + { + wxLogWarning(_("Expected 'char' whilst parsing resource.")); + return FALSE; + } + + // *name + if (!wxGetResourceTokenString(s)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (wxResourceBuffer[0] != '*') + { + wxLogWarning(_("Expected '*' whilst parsing resource.")); + return FALSE; + } + wxChar nameBuf[100]; + wxMB2WX(nameBuf, wxResourceBuffer+1, 99); + nameBuf[99] = 0; + + // = + if (!wxGetResourceTokenString(s)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (strcmp(wxResourceBuffer, "=") != 0) + { + wxLogWarning(_("Expected '=' whilst parsing resource.")); + return FALSE; + } + + // String + if (!wxGetResourceTokenString(s)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + else + { + if (!db.ReadPrologFromString(wxResourceBuffer)) + { + wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); + return FALSE; + } + } + // Semicolon + if (!wxGetResourceTokenString(s)) + { + *eof = TRUE; + } + return TRUE; } bool wxResourceParseString(char *s, wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - if (!s) - return FALSE; - - // Turn backslashes into spaces - if (s) - { - int len = strlen(s); - int i; - for (i = 0; i < len; i++) - if (s[i] == 92 && s[i+1] == 13) - { - s[i] = ' '; - s[i+1] = ' '; - } - } - - wxExprDatabase db; - wxResourceStringPtr = 0; - - bool eof = FALSE; - while (wxResourceReadOneResourceString(s, db, &eof, table) && !eof) - { - // Loop - } - return wxResourceInterpretResources(*table, db); + if (!table) + table = wxDefaultResourceTable; + + if (!s) + return FALSE; + + // Turn backslashes into spaces + if (s) + { + int len = strlen(s); + int i; + for (i = 0; i < len; i++) + if (s[i] == 92 && s[i+1] == 13) + { + s[i] = ' '; + s[i+1] = ' '; + } + } + + wxExprDatabase db; + wxResourceStringPtr = 0; + + bool eof = FALSE; + while (wxResourceReadOneResourceString(s, db, &eof, table) && !eof) + { + // Loop + } + return wxResourceInterpretResources(*table, db); } /* - * resource loading facility - */ +* resource loading facility +*/ bool wxWindowBase::LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *resource = table->FindResource((const wxChar *)resourceName); -// if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX)) - if (!resource || (resource->GetType() == wxT("")) || - ! ((resource->GetType() == wxT("wxDialog")) || (resource->GetType() == wxT("wxPanel")))) - return FALSE; - - wxString title(resource->GetTitle()); - long theWindowStyle = resource->GetStyle(); - bool isModal = (resource->GetValue1() != 0); - int x = resource->GetX(); - int y = resource->GetY(); - int width = resource->GetWidth(); - int height = resource->GetHeight(); - wxString name = resource->GetName(); - - if (IsKindOf(CLASSINFO(wxDialog))) - { - wxDialog *dialogBox = (wxDialog *)this; - long modalStyle = isModal ? wxDIALOG_MODAL : 0; - if (!dialogBox->Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), theWindowStyle|modalStyle, name)) - return FALSE; - - // Only reset the client size if we know we're not going to do it again below. - if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == 0) - dialogBox->SetClientSize(width, height); - } - else if (IsKindOf(CLASSINFO(wxPanel))) - { - wxPanel* panel = (wxPanel *)this; - if (!panel->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle | wxTAB_TRAVERSAL, name)) - return FALSE; - } - else - { - if (!((wxWindow *)this)->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name)) - return FALSE; - } - - if ((resource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) - { - // No need to do this since it's done in wxPanel or wxDialog constructor. - // SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); - } - else - { - if (resource->GetFont().Ok()) - SetFont(resource->GetFont()); - if (resource->GetBackgroundColour().Ok()) - SetBackgroundColour(resource->GetBackgroundColour()); - } - - // Should have some kind of font at this point - if (!GetFont().Ok()) - SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); - if (!GetBackgroundColour().Ok()) - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); - - // Only when we've created the window and set the font can we set the correct size, - // if based on dialog units. - if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) - { - wxSize sz = ConvertDialogToPixels(wxSize(width, height)); - SetClientSize(sz.x, sz.y); - - wxPoint pt = ConvertDialogToPixels(wxPoint(x, y)); - Move(pt.x, pt.y); - } - - // Now create children - wxNode *node = resource->GetChildren().First(); - while (node) - { - wxItemResource *childResource = (wxItemResource *)node->Data(); - - (void) CreateItem(childResource, resource, table); - - node = node->Next(); - } - return TRUE; + if (!table) + table = wxDefaultResourceTable; + + wxItemResource *resource = table->FindResource((const wxChar *)resourceName); + // if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX)) + if (!resource || (resource->GetType() == wxT("")) || + ! ((resource->GetType() == wxT("wxDialog")) || (resource->GetType() == wxT("wxPanel")))) + return FALSE; + + wxString title(resource->GetTitle()); + long theWindowStyle = resource->GetStyle(); + bool isModal = (resource->GetValue1() != 0) ; + int x = resource->GetX(); + int y = resource->GetY(); + int width = resource->GetWidth(); + int height = resource->GetHeight(); + wxString name = resource->GetName(); + + if (IsKindOf(CLASSINFO(wxDialog))) + { + wxDialog *dialogBox = (wxDialog *)this; + long modalStyle = isModal ? wxDIALOG_MODAL : 0; + if (!dialogBox->Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), theWindowStyle|modalStyle, name)) + return FALSE; + + // Only reset the client size if we know we're not going to do it again below. + if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == 0) + dialogBox->SetClientSize(width, height); + } + else if (IsKindOf(CLASSINFO(wxPanel))) + { + wxPanel* panel = (wxPanel *)this; + if (!panel->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle | wxTAB_TRAVERSAL, name)) + return FALSE; + } + else + { + if (!((wxWindow *)this)->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name)) + return FALSE; + } + + if ((resource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) + { + // No need to do this since it's done in wxPanel or wxDialog constructor. + // SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); + } + else + { + if (resource->GetFont().Ok()) + SetFont(resource->GetFont()); + if (resource->GetBackgroundColour().Ok()) + SetBackgroundColour(resource->GetBackgroundColour()); + } + + // Should have some kind of font at this point + if (!GetFont().Ok()) + SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); + if (!GetBackgroundColour().Ok()) + SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); + + // Only when we've created the window and set the font can we set the correct size, + // if based on dialog units. + if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) + { + wxSize sz = ConvertDialogToPixels(wxSize(width, height)); + SetClientSize(sz.x, sz.y); + + wxPoint pt = ConvertDialogToPixels(wxPoint(x, y)); + Move(pt.x, pt.y); + } + + // Now create children + wxNode *node = resource->GetChildren().First(); + while (node) + { + wxItemResource *childResource = (wxItemResource *)node->Data(); + + (void) CreateItem(childResource, resource, table); + + node = node->Next(); + } + return TRUE; } wxControl *wxWindowBase::CreateItem(const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table) { - if (!table) - table = wxDefaultResourceTable; - return table->CreateItem((wxWindow *)this, resource, parentResource); + if (!table) + table = wxDefaultResourceTable; + return table->CreateItem((wxWindow *)this, resource, parentResource); } #ifdef __VISUALC__ - #pragma warning(default:4706) // assignment within conditional expression +#pragma warning(default:4706) // assignment within conditional expression #endif // VC++ #endif - // BC++/Win16 +// BC++/Win16 #endif // wxUSE_WX_RESOURCES diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 8131c0427a..7924cee54f 100644 --- a/src/common/sckaddr.cpp +++ b/src/common/sckaddr.cpp @@ -108,7 +108,7 @@ bool wxIPV4address::Hostname(const wxString& name) return FALSE; } - return (GAddress_INET_SetHostName(m_address, name.fn_str()) == GSOCK_NOERROR); + return (GAddress_INET_SetHostName(m_address, name.mb_str()) == GSOCK_NOERROR); } bool wxIPV4address::Hostname(unsigned long addr) @@ -118,7 +118,7 @@ bool wxIPV4address::Hostname(unsigned long addr) bool wxIPV4address::Service(const wxString& name) { - return (GAddress_INET_SetPortName(m_address, name.fn_str(), "tcp") == GSOCK_NOERROR); + return (GAddress_INET_SetPortName(m_address, name.mb_str(), "tcp") == GSOCK_NOERROR); } bool wxIPV4address::Service(unsigned short port) diff --git a/src/common/sckfile.cpp b/src/common/sckfile.cpp index 220f95294c..e48f33693f 100644 --- a/src/common/sckfile.cpp +++ b/src/common/sckfile.cpp @@ -23,6 +23,8 @@ #include "wx/defs.h" #endif +#if wxUSE_STREAMS + #include <stdio.h> #include "wx/wfstream.h" #include "wx/protocol/file.h" @@ -44,3 +46,5 @@ wxInputStream *wxFileProto::GetInputStream(const wxString& path) return new wxFileInputStream(path); } +#endif + diff --git a/src/common/sckipc.cpp b/src/common/sckipc.cpp index 16406abe08..3fea37e1ec 100644 --- a/src/common/sckipc.cpp +++ b/src/common/sckipc.cpp @@ -36,7 +36,7 @@ #include "wx/defs.h" #endif -#if wxUSE_SOCKETS && wxUSE_IPC +#if wxUSE_SOCKETS && wxUSE_IPC && wxUSE_STREAMS #include <stdlib.h> #include <stdio.h> @@ -200,28 +200,49 @@ wxConnectionBase *wxTCPClient::OnMakeConnection() wxTCPServer::wxTCPServer () : wxServerBase() { + m_server = NULL; } -bool wxTCPServer::Create(const wxString& server_name) +bool wxTCPServer::Create(const wxString& serverName) { - wxSocketServer *server; + // Destroy previous server, if any + if (m_server) + { + m_server->SetClientData(NULL); + m_server->Destroy(); + m_server = NULL; + } // wxIPV4address defaults to INADDR_ANY:0 wxIPV4address addr; - addr.Service(server_name); + addr.Service(serverName); - // Create a socket listening on specified port - server = new wxSocketServer(addr, SCKIPC_FLAGS); - server->SetEventHandler(*gs_handler, _SERVER_ONREQUEST_ID); - server->SetClientData(this); - server->SetNotify(wxSOCKET_CONNECTION_FLAG); - server->Notify(TRUE); + // Create a socket listening on the specified port + m_server = new wxSocketServer(addr, SCKIPC_FLAGS); + + if (!m_server->Ok()) + { + m_server->Destroy(); + m_server = NULL; + + return FALSE; + } + + m_server->SetEventHandler(*gs_handler, _SERVER_ONREQUEST_ID); + m_server->SetClientData(this); + m_server->SetNotify(wxSOCKET_CONNECTION_FLAG); + m_server->Notify(TRUE); return TRUE; } wxTCPServer::~wxTCPServer() { + if (m_server) + { + m_server->SetClientData(NULL); + m_server->Destroy(); + } } wxConnectionBase *wxTCPServer::OnAcceptConnection( const wxString& WXUNUSED(topic) ) @@ -284,7 +305,7 @@ bool wxTCPConnection::Execute(const wxChar *data, int size, wxIPCFormat format) m_codeco->Write8(format); if (size < 0) - size = strlen(data) + 1; // includes final NUL + size = wxStrlen(data) + 1; // includes final NUL m_codeco->Write32(size); m_sockstrm->Write(data, size); @@ -332,7 +353,7 @@ bool wxTCPConnection::Poke (const wxString& item, wxChar *data, int size, wxIPCF m_codeco->Write8(format); if (size < 0) - size = strlen(data) + 1; // includes final NUL + size = wxStrlen(data) + 1; // includes final NUL m_codeco->Write32(size); m_sockstrm->Write(data, size); @@ -388,7 +409,7 @@ bool wxTCPConnection::Advise (const wxString& item, m_codeco->Write8(format); if (size < 0) - size = strlen(data) + 1; // includes final NUL + size = wxStrlen(data) + 1; // includes final NUL m_codeco->Write32(size); m_sockstrm->Write(data, size); @@ -555,7 +576,7 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event) void wxTCPEventHandler::Server_OnRequest(wxSocketEvent &event) { wxSocketServer *server = (wxSocketServer *) event.GetSocket(); - wxTCPServer *ipcserv = (wxTCPServer *) event.GetClientData(); + wxTCPServer *ipcserv = (wxTCPServer *) server->GetClientData(); // This socket is being deleted; skip this event if (!ipcserv) diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 1acfd70e61..8659c70947 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -29,6 +29,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxSizerItem, wxObject); IMPLEMENT_ABSTRACT_CLASS(wxSizer, wxObject); +IMPLEMENT_ABSTRACT_CLASS(wxGridSizer, wxSizer); +IMPLEMENT_ABSTRACT_CLASS(wxFlexGridSizer, wxGridSizer); IMPLEMENT_ABSTRACT_CLASS(wxBoxSizer, wxSizer); IMPLEMENT_ABSTRACT_CLASS(wxStaticBoxSizer, wxBoxSizer); #if wxUSE_NOTEBOOK @@ -130,7 +132,7 @@ wxSize wxSizerItem::CalcMin() wxSize ret; if (IsSizer()) { - ret = m_sizer->CalcMin(); + ret = m_sizer->GetMinSize(); // if we have to preserve aspect ratio _AND_ this is // the first-time calculation, consider ret to be initial size if ((m_flag & wxSHAPED) && !m_ratio) SetRatio(ret); @@ -161,6 +163,8 @@ wxSize wxSizerItem::CalcMin() void wxSizerItem::SetDimension( wxPoint pos, wxSize size ) { + m_pos = pos; + if (m_flag & wxWEST) { pos.x += m_border; @@ -233,6 +237,8 @@ bool wxSizerItem::IsSpacer() wxSizer::wxSizer() { m_children.DeleteContents( TRUE ); + m_minSize.x = 0; + m_minSize.y = 0; } wxSizer::~wxSizer() @@ -295,7 +301,7 @@ bool wxSizer::Remove( wxWindow *window ) if (item->GetWindow() == window) { m_children.DeleteNode( node ); - return TRUE; + return TRUE; } node = node->Next(); } @@ -368,6 +374,415 @@ void wxSizer::SetDimension( int x, int y, int width, int height ) RecalcSizes(); } +wxSize wxSizer::GetMinSize() +{ + wxSize ret( CalcMin() ); + if (ret.x < m_minSize.x) ret.x = m_minSize.x; + if (ret.y < m_minSize.y) ret.y = m_minSize.y; + return ret; +} + +void wxSizer::DoSetMinSize( int width, int height ) +{ + m_minSize.x = width; + m_minSize.y = height; +} + +bool wxSizer::DoSetItemMinSize( wxWindow *window, int width, int height ) +{ + wxASSERT( window ); + + wxNode *node = m_children.First(); + while (node) + { + wxSizerItem *item = (wxSizerItem*)node->Data(); + if (item->GetWindow() == window) + { + item->SetInitSize( width, height ); + return TRUE; + } + node = node->Next(); + } + + node = m_children.First(); + while (node) + { + wxSizerItem *item = (wxSizerItem*)node->Data(); + if (item->GetSizer()) + { + /* It's a sizer, so lets search recursively. */ + if (item->GetSizer()->DoSetItemMinSize( window, width, height )) + { + /* A child sizer found the requested windw, exit. */ + return TRUE; + } + } + node = node->Next(); + } + + return FALSE; +} + +bool wxSizer::DoSetItemMinSize( wxSizer *sizer, int width, int height ) +{ + wxASSERT( sizer ); + + wxNode *node = m_children.First(); + while (node) + { + wxSizerItem *item = (wxSizerItem*)node->Data(); + if (item->GetSizer() == sizer) + { + item->GetSizer()->DoSetMinSize( width, height ); + return TRUE; + } + node = node->Next(); + } + + node = m_children.First(); + while (node) + { + wxSizerItem *item = (wxSizerItem*)node->Data(); + if (item->GetSizer()) + { + /* It's a sizer, so lets search recursively. */ + if (item->GetSizer()->DoSetItemMinSize( sizer, width, height )) + { + /* A child sizer found the requested windw, exit. */ + return TRUE; + } + } + node = node->Next(); + } + + return FALSE; +} + +bool wxSizer::DoSetItemMinSize( int pos, int width, int height ) +{ + wxNode *node = m_children.Nth( pos ); + if (!node) return FALSE; + + wxSizerItem *item = (wxSizerItem*) node->Data(); + if (item->GetSizer()) + { + /* Sizers contains the minimal size in them, if not calculated ... */ + item->GetSizer()->DoSetMinSize( width, height ); + } + else + { + /* ... whereas the minimal size of spacers and windows in stored + in the item */ + item->SetInitSize( width, height ); + } + + return TRUE; +} + +//--------------------------------------------------------------------------- +// wxGridSizer +//--------------------------------------------------------------------------- + +wxGridSizer::wxGridSizer( int rows, int cols, int vgap, int hgap ) +{ + m_rows = rows; + m_cols = cols; + m_vgap = vgap; + m_hgap = hgap; +} + +wxGridSizer::wxGridSizer( int cols, int vgap, int hgap ) +{ + m_rows = 0; + m_cols = cols; + m_vgap = vgap; + m_hgap = hgap; +} + +void wxGridSizer::RecalcSizes() +{ + if (m_children.GetCount() == 0) + return; + + int nitems = m_children.GetCount(); + int nrows = m_rows; + int ncols = m_cols; + + if (ncols > 0) + nrows = (nitems + ncols-1) / ncols; + else + ncols = (nitems + nrows-1) / nrows; + + wxSize sz( GetSize() ); + wxPoint pt( GetPosition() ); + + int w = (sz.x - (ncols - 1) * m_hgap) / ncols; + int h = (sz.y - (nrows - 1) * m_vgap) / nrows; + + int x = pt.x; + for (int c = 0; c < ncols; c++) + { + int y = pt.y; + for (int r = 0; r < nrows; r++) + { + int i = r * ncols + c; + if (i < nitems) + { + wxNode *node = m_children.Nth( i ); + wxASSERT( node ); + + SetItemBounds( (wxSizerItem*) node->Data(), x, y, w, h); + } + y = y + h + m_vgap; + } + x = x + w + m_hgap; + } +} + +wxSize wxGridSizer::CalcMin() +{ + if (m_children.GetCount() == 0) + return wxSize(10,10); + + int nitems = m_children.GetCount(); + int nrows = m_rows; + int ncols = m_cols; + + if (ncols > 0) + nrows = (nitems + ncols-1) / ncols; + else + ncols = (nitems + nrows-1) / nrows; + + /* Find the max width and height for any component */ + int w = 0; + int h = 0; + + wxNode *node = m_children.First(); + while (node) + { + wxSizerItem *item = (wxSizerItem*)node->Data(); + wxSize sz( item->CalcMin() ); + w = wxMax( w, sz.x ); + h = wxMax( h, sz.y ); + + node = node->Next(); + } + + return wxSize(ncols * w + (ncols-1) * m_hgap, + nrows * h + (nrows-1) * m_vgap); +} + +void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ) +{ + wxPoint pt( x,y ); + wxSize sz( item->CalcMin() ); + int flag = item->GetFlag(); + + if ((flag & wxEXPAND) || (flag & wxSHAPED)) + { + sz = wxSize(w, h); + } + else + { + if (flag & wxALIGN_CENTER_HORIZONTAL) + { + pt.x = x + (w - sz.x) / 2; + } + else if (flag & wxALIGN_RIGHT) + { + pt.x = x + (w - sz.x); + } + + if (flag & wxALIGN_CENTER_VERTICAL) + { + pt.y = y + (h - sz.y) / 2; + } + else if (flag & wxALIGN_BOTTOM) + { + pt.y = y + (h - sz.y); + } + } + + item->SetDimension(pt, sz); +} + +//--------------------------------------------------------------------------- +// wxFlexGridSizer +//--------------------------------------------------------------------------- + +wxFlexGridSizer::wxFlexGridSizer( int rows, int cols, int vgap, int hgap ) + : wxGridSizer( rows, cols, vgap, hgap ) +{ + m_rowHeights = (int*) NULL; + m_colWidths = (int*) NULL; +} + +wxFlexGridSizer::wxFlexGridSizer( int cols, int vgap, int hgap ) + : wxGridSizer( cols, vgap, hgap ) +{ + m_rowHeights = (int*) NULL; + m_colWidths = (int*) NULL; +} + +wxFlexGridSizer::~wxFlexGridSizer() +{ + if (m_rowHeights) + delete[] m_rowHeights; + if (m_colWidths) + delete[] m_colWidths; +} + +void wxFlexGridSizer::CreateArrays() +{ + if (m_rowHeights) + delete[] m_rowHeights; + if (m_colWidths) + delete[] m_colWidths; + + if (m_children.GetCount() == 0) + return; + + int nitems = m_children.GetCount(); + int nrows = m_rows; + int ncols = m_cols; + + if (ncols > 0) + nrows = (nitems + ncols-1) / ncols; + else + ncols = (nitems + nrows-1) / nrows; + + m_rowHeights = new int[nrows]; + m_colWidths = new int[ncols]; + + for (int col = 0; col < ncols; col++) + m_colWidths[ col ] = 0; + for (int row = 0; row < nrows; row++) + m_rowHeights[ row ] = 0; +} + +void wxFlexGridSizer::RecalcSizes() +{ + if (m_children.GetCount() == 0) + return; + + int nitems = m_children.GetCount(); + int nrows = m_rows; + int ncols = m_cols; + + if (ncols > 0) + nrows = (nitems + ncols-1) / ncols; + else + ncols = (nitems + nrows-1) / nrows; + + wxSize sz( GetSize() ); + wxSize minsz( CalcMin() ); + wxPoint pt( GetPosition() ); + int delta; + size_t idx; + + if ((m_growableRows.GetCount() > 0) && (sz.y > minsz.y)) + { + delta = (sz.y - minsz.y) / m_growableRows.GetCount(); + for (idx = 0; idx < m_growableRows.GetCount(); idx++) + m_rowHeights[ m_growableRows[idx] ] += delta; + } + + if ((m_growableCols.GetCount() > 0) && (sz.x > minsz.x)) + { + delta = (sz.x - minsz.x) / m_growableCols.GetCount(); + for (idx = 0; idx < m_growableCols.GetCount(); idx++) + m_colWidths[ m_growableCols[idx] ] += delta; + } + + sz = wxSize( pt.x + sz.x, pt.y + sz.y ); + + int x = pt.x; + for (int c = 0; c < ncols; c++) + { + int y = pt.y; + for (int r = 0; r < nrows; r++) + { + int i = r * ncols + c; + if (i < nitems) + { + wxNode *node = m_children.Nth( i ); + wxASSERT( node ); + + int w = wxMax( 0, wxMin( m_colWidths[c], sz.x - x ) ); + int h = wxMax( 0, wxMin( m_rowHeights[r], sz.y - y ) ); + + SetItemBounds( (wxSizerItem*) node->Data(), x, y, w, h); + } + y = y + m_rowHeights[r] + m_vgap; + } + x = x + m_colWidths[c] + m_hgap; + } +} + +wxSize wxFlexGridSizer::CalcMin() +{ + if (m_children.GetCount() == 0) + return wxSize(10,10); + + int nitems = m_children.GetCount(); + int nrows = m_rows; + int ncols = m_cols; + + if (ncols > 0) + nrows = (nitems + ncols-1) / ncols; + else + ncols = (nitems + nrows-1) / nrows; + + CreateArrays(); + + int col; + int row; + + int i = 0; + wxNode *node = m_children.First(); + while (node) + { + wxSizerItem *item = (wxSizerItem*)node->Data(); + wxSize sz( item->CalcMin() ); + row = i / ncols; + col = i % ncols; + m_rowHeights[ row ] = wxMax( sz.y, m_rowHeights[ row ] ); + m_colWidths[ col ] = wxMax( sz.x, m_colWidths[ col ] ); + + node = node->Next(); + i++; + } + + int width = 0; + for (col = 0; col < ncols; col++) + width += m_colWidths[ col ]; + + int height = 0; + for (row = 0; row < nrows; row++) + height += m_rowHeights[ row ]; + + return wxSize( width + (ncols-1) * m_hgap, + height + (nrows-1) * m_vgap); +} + +void wxFlexGridSizer::AddGrowableRow( size_t idx ) +{ + m_growableRows.Add( idx ); +} + +void wxFlexGridSizer::RemoveGrowableRow( size_t idx ) +{ +} + +void wxFlexGridSizer::AddGrowableCol( size_t idx ) +{ + m_growableCols.Add( idx ); +} + +void wxFlexGridSizer::RemoveGrowableCol( size_t idx ) +{ +} + //--------------------------------------------------------------------------- // wxBoxSizer //--------------------------------------------------------------------------- @@ -605,11 +1020,11 @@ wxSize wxNotebookSizer::CalcMin() if ((m_notebook->HasFlag(wxNB_RIGHT)) || (m_notebook->HasFlag(wxNB_LEFT))) { - borderX += 70; // improvements later.. + borderX += 90; // improvements later.. } else { - borderY += 35; // improvements later.. + borderY += 40; // improvements later.. } if (m_notebook->GetChildren().GetCount() == 0) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index d2b1144af8..997899e769 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -9,6 +9,14 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + #ifdef __GNUG__ #pragma implementation "strconv.h" #endif @@ -31,24 +39,21 @@ #include "wx/debug.h" #include "wx/strconv.h" -//---------------------------------------------------------------------------- -// wxConvCurrent -//---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +// globals +// ---------------------------------------------------------------------------- WXDLLEXPORT_DATA(wxMBConv *) wxConvCurrent = &wxConvLibc; -#if !wxUSE_WCHAR_T -//---------------------------------------------------------------------------- -// stand-ins in absence of wchar_t -//---------------------------------------------------------------------------- - -WXDLLEXPORT_DATA(wxMBConv) wxConvLibc, wxConvFile; +// ============================================================================ +// implementation +// ============================================================================ -#else +#if wxUSE_WCHAR_T -//---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // wxMBConv -//---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- WXDLLEXPORT_DATA(wxMBConv) wxConvLibc; @@ -64,33 +69,37 @@ size_t wxMBConv::WC2MB(char *buf, const wchar_t *psz, size_t n) const const wxWCharBuffer wxMBConv::cMB2WC(const char *psz) const { - if (psz) + if (psz) { size_t nLen = MB2WC((wchar_t *) NULL, psz, 0); + if (nLen == (size_t)-1) + return wxWCharBuffer((wchar_t *) NULL); wxWCharBuffer buf(nLen); MB2WC((wchar_t *)(const wchar_t *) buf, psz, nLen); return buf; - } - else + } + else return wxWCharBuffer((wchar_t *) NULL); } const wxCharBuffer wxMBConv::cWC2MB(const wchar_t *psz) const { - if (psz) + if (psz) { size_t nLen = WC2MB((char *) NULL, psz, 0); + if (nLen == (size_t)-1) + return wxCharBuffer((char *) NULL); wxCharBuffer buf(nLen); WC2MB((char *)(const char *) buf, psz, nLen); return buf; - } - else + } + else return wxCharBuffer((char *) NULL); } -//---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // standard file conversion -//---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- WXDLLEXPORT_DATA(wxMBConvFile) wxConvFile; @@ -105,11 +114,11 @@ size_t wxMBConvFile::WC2MB(char *buf, const wchar_t *psz, size_t n) const return wxWC2MB(buf, psz, n); } -#ifdef __WXGTK12__ - -//---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // standard gdk conversion -//---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- + +#ifdef __WXGTK12__ WXDLLEXPORT_DATA(wxMBConvGdk) wxConvGdk; @@ -138,6 +147,7 @@ size_t wxMBConvGdk::WC2MB(char *buf, const wchar_t *psz, size_t n) const } return len; } + #endif // GTK > 1.0 // ---------------------------------------------------------------------------- @@ -171,9 +181,9 @@ size_t wxMBConvUTF7::WC2MB(char * WXUNUSED(buf), return 0; } -//---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // UTF-8 -//---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- WXDLLEXPORT_DATA(wxMBConvUTF8) wxConvUTF8; @@ -249,122 +259,34 @@ size_t wxMBConvUTF8::WC2MB(char *buf, const wchar_t *psz, size_t n) const // specified character set // ---------------------------------------------------------------------------- -#ifndef WX_PRECOMP - #include "wx/dynarray.h" - #include "wx/filefn.h" - #include "wx/textfile.h" - #include "wx/tokenzr.h" - #include "wx/utils.h" -#endif +WXDLLEXPORT_DATA(wxCSConv) wxConvLocal((const wxChar *)NULL); + +#include "wx/encconv.h" +#include "wx/fontmap.h" class wxCharacterSet { public: - wxArrayString names; - wchar_t *data; -}; - -WX_DECLARE_OBJARRAY(wxCharacterSet, wxCSArray); -#include "wx/arrimpl.cpp" -WX_DEFINE_OBJARRAY(wxCSArray); - -static wxCSArray wxCharsets; - -static void wxLoadCharacterSets(void) -{ - static bool already_loaded = FALSE; - - if (already_loaded) return; - - already_loaded = TRUE; -#if defined(__UNIX__) && wxUSE_TEXTFILE - // search through files in /usr/share/i18n/charmaps - wxString fname; - for (fname = ::wxFindFirstFile(wxT("/usr/share/i18n/charmaps/*")); - !fname.IsEmpty(); - fname = ::wxFindNextFile()) { - wxTextFile cmap(fname); - if (cmap.Open()) { - wxCharacterSet *cset = new wxCharacterSet; - wxString comchar,escchar; - bool in_charset = FALSE; - - // wxFprintf(stderr,wxT("Loaded: %s\n"),fname.c_str()); - - wxString line; - for (line = cmap.GetFirstLine(); - !cmap.Eof(); - line = cmap.GetNextLine()) { - // wxFprintf(stderr,wxT("line contents: %s\n"),line.c_str()); - wxStringTokenizer token(line); - wxString cmd = token.GetNextToken(); - if (cmd == comchar) { - if (token.GetNextToken() == wxT("alias")) - cset->names.Add(token.GetNextToken()); - } - else if (cmd == wxT("<code_set_name>")) - cset->names.Add(token.GetNextToken()); - else if (cmd == wxT("<comment_char>")) - comchar = token.GetNextToken(); - else if (cmd == wxT("<escape_char>")) - escchar = token.GetNextToken(); - else if (cmd == wxT("<mb_cur_min>")) { - delete cset; - cset = (wxCharacterSet *) NULL; - break; // we don't support multibyte charsets ourselves (yet) - } - else if (cmd == wxT("CHARMAP")) { - cset->data = (wchar_t *)calloc(256, sizeof(wchar_t)); - in_charset = TRUE; - } - else if (cmd == wxT("END")) { - if (token.GetNextToken() == wxT("CHARMAP")) - in_charset = FALSE; - } - else if (in_charset) { - // format: <NUL> /x00 <U0000> NULL (NUL) - // <A> /x41 <U0041> LATIN CAPITAL LETTER A - wxString hex = token.GetNextToken(); - // skip whitespace (why doesn't wxStringTokenizer do this?) - while (wxIsEmpty(hex) && token.HasMoreTokens()) hex = token.GetNextToken(); - wxString uni = token.GetNextToken(); - // skip whitespace again - while (wxIsEmpty(uni) && token.HasMoreTokens()) uni = token.GetNextToken(); - if ((hex.Len() > 2) && (wxString(hex.GetChar(0)) == escchar) && (hex.GetChar(1) == wxT('x')) && - (uni.Left(2) == wxT("<U"))) { - hex.MakeUpper(); uni.MakeUpper(); - int pos = ::wxHexToDec(hex.Mid(2,2)); - if (pos>=0) { - unsigned long uni1 = ::wxHexToDec(uni.Mid(2,2)); - unsigned long uni2 = ::wxHexToDec(uni.Mid(4,2)); - cset->data[pos] = (uni1 << 16) | uni2; - // wxFprintf(stderr,wxT("char %02x mapped to %04x (%c)\n"),pos,cset->data[pos],cset->data[pos]); - } - } - } - } - if (cset) { - cset->names.Shrink(); - wxCharsets.Add(cset); - } - } + // temporarily just use wxEncodingConverter stuff, + // so that it works while a better implementation is built + wxFontEncoding enc; + wxEncodingConverter m2w, w2m; + wxCharacterSet(wxFontEncoding e) : enc(e) + { + m2w.Init(enc, wxFONTENCODING_UNICODE); + w2m.Init(wxFONTENCODING_UNICODE, enc); } -#endif - wxCharsets.Shrink(); -} +}; -static wxCharacterSet *wxFindCharacterSet(const wxChar *charset) +static wxCharacterSet *wxGetCharacterSet(const wxChar *name) { - if (!charset) return (wxCharacterSet *)NULL; - wxLoadCharacterSets(); - for (size_t n=0; n<wxCharsets.GetCount(); n++) - if (wxCharsets[n].names.Index(charset) != wxNOT_FOUND) - return &(wxCharsets[n]); - return (wxCharacterSet *)NULL; + wxFontEncoding enc = name ? wxTheFontMapper->CharsetToEncoding(name, FALSE) + : wxFONTENCODING_SYSTEM; + wxCharacterSet *cset = (enc != wxFONTENCODING_SYSTEM) ? new wxCharacterSet(enc) + : (wxCharacterSet *)NULL; + return cset; } -WXDLLEXPORT_DATA(wxCSConv) wxConvLocal((const wxChar *)NULL); - wxCSConv::wxCSConv(const wxChar *charset) { m_name = (wxChar *) NULL; @@ -376,31 +298,14 @@ wxCSConv::wxCSConv(const wxChar *charset) wxCSConv::~wxCSConv() { if (m_name) free(m_name); + if (m_cset) delete m_cset; } void wxCSConv::SetName(const wxChar *charset) { if (charset) { -#ifdef __UNIX__ - // first, convert the character set name to standard form - wxString codeset; - if (wxString(charset,3).CmpNoCase(wxT("ISO")) == 0) { - // make sure it's represented in the standard form: ISO_8859-1 - codeset = wxT("ISO_"); - charset += 3; - if ((*charset == wxT('-')) || (*charset == wxT('_'))) charset++; - if (wxStrlen(charset)>4) { - if (wxString(charset,4) == wxT("8859")) { - codeset << wxT("8859-"); - if (*charset == wxT('-')) charset++; - } - } - } - codeset << charset; - codeset.MakeUpper(); - m_name = wxStrdup(codeset.c_str()); + m_name = wxStrdup(charset); m_deferred = TRUE; -#endif } } @@ -410,12 +315,13 @@ void wxCSConv::LoadNow() if (m_deferred) { if (!m_name) { #ifdef __UNIX__ - wxChar *lang = wxGetenv(wxT("LANG")); + wxChar *lang = wxGetenv(wxT("LC_ALL")); + if (!lang) lang = wxGetenv(wxT("LANG")); wxChar *dot = lang ? wxStrchr(lang, wxT('.')) : (wxChar *)NULL; if (dot) SetName(dot+1); #endif } - m_cset = wxFindCharacterSet(m_name); + m_cset = wxGetCharacterSet(m_name); m_deferred = FALSE; } } @@ -425,8 +331,7 @@ size_t wxCSConv::MB2WC(wchar_t *buf, const char *psz, size_t n) const ((wxCSConv *)this)->LoadNow(); // discard constness if (buf) { if (m_cset) { - for (size_t c=0; c<n; c++) - buf[c] = m_cset->data[(unsigned char)(psz[c])]; + m_cset->m2w.Convert(psz, buf); } else { // latin-1 (direct) for (size_t c=0; c<n; c++) @@ -442,11 +347,7 @@ size_t wxCSConv::WC2MB(char *buf, const wchar_t *psz, size_t n) const ((wxCSConv *)this)->LoadNow(); // discard constness if (buf) { if (m_cset) { - for (size_t c=0; c<n; c++) { - size_t n; - for (n=0; (n<256) && (m_cset->data[n] != psz[c]); n++); - buf[c] = (n>0xff) ? '?' : n; - } + m_cset->w2m.Convert(psz, buf); } else { // latin-1 (direct) for (size_t c=0; c<n; c++) @@ -461,7 +362,14 @@ size_t wxCSConv::WC2MB(char *buf, const wchar_t *psz, size_t n) const #endif } -#endif - //wxUSE_WCHAR_T +#else // !wxUSE_WCHAR_T + +// ---------------------------------------------------------------------------- +// stand-ins in absence of wchar_t +// ---------------------------------------------------------------------------- + +WXDLLEXPORT_DATA(wxMBConv) wxConvLibc, wxConvFile; + +#endif // wxUSE_WCHAR_T diff --git a/src/common/string.cpp b/src/common/string.cpp index bd4dc94a62..b0ab44d21c 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -290,10 +290,12 @@ void wxString::InitWith(const wxChar *psz, size_t nPos, size_t nLength) { Init(); - if ( nLength == wxSTRING_MAXLEN ) - nLength = wxStrlen(psz + nPos); + // if the length is not given, assume the string to be NUL terminated + if ( nLength == wxSTRING_MAXLEN ) { + wxASSERT_MSG( nPos <= wxStrlen(psz), _T("index out of bounds") ); - wxASSERT_MSG( nPos + nLength <= wxStrlen(psz), _T("index out of bounds") ); + nLength = wxStrlen(psz + nPos); + } STATISTICS_ADD(InitialLength, nLength); @@ -341,15 +343,15 @@ wxString::wxString(const char *psz, wxMBConv& conv, size_t nLength) #if wxUSE_WCHAR_T // from wide string -wxString::wxString(const wchar_t *pwz) +wxString::wxString(const wchar_t *pwz, wxMBConv& conv) { // first get necessary size - size_t nLen = pwz ? wxWC2MB((char *) NULL, pwz, 0) : 0; + size_t nLen = pwz ? conv.WC2MB((char *) NULL, pwz, 0) : 0; // empty? if ( (nLen != 0) && (nLen != (size_t)-1) ) { AllocBuffer(nLen); - wxWC2MB(m_pchData, pwz, nLen); + conv.WC2MB(m_pchData, pwz, nLen); } else { Init(); @@ -774,6 +776,35 @@ wxString wxString::Mid(size_t nFirst, size_t nCount) const return dest; } +// check that the tring starts with prefix and return the rest of the string +// in the provided pointer if it is not NULL, otherwise return FALSE +bool wxString::StartsWith(const wxChar *prefix, wxString *rest) const +{ + wxASSERT_MSG( prefix, _T("invalid parameter in wxString::StartsWith") ); + + // first check if the beginning of the string matches the prefix: note + // that we don't have to check that we don't run out of this string as + // when we reach the terminating NUL, either prefix string ends too (and + // then it's ok) or we break out of the loop because there is no match + const wxChar *p = c_str(); + while ( *prefix ) + { + if ( *prefix++ != *p++ ) + { + // no match + return FALSE; + } + } + + if ( rest ) + { + // put the rest of the string into provided pointer + *rest = p; + } + + return TRUE; +} + // extract nCount last (rightmost) characters wxString wxString::Right(size_t nCount) const { @@ -1715,13 +1746,15 @@ wxString& wxString::erase(size_t nStart, size_t nLen) wxString& wxString::replace(size_t nStart, size_t nLen, const wxChar *sz) { - wxASSERT( nStart + nLen <= wxStrlen(sz) ); + wxASSERT_MSG( nStart + nLen <= Len(), + _T("index out of bounds in wxString::replace") ); wxString strTmp; + strTmp.Alloc(Len()); // micro optimisation to avoid multiple mem allocs + if ( nStart != 0 ) strTmp.append(c_str(), nStart); - strTmp += sz; - strTmp.append(c_str() + nStart + nLen); + strTmp << sz << c_str() + nStart + nLen; *this = strTmp; return *this; @@ -2095,6 +2128,9 @@ void wxArrayString::Sort(CompareFunction compareFunction) DoSort(); + // reset it to NULL so that Sort(bool) will work the next time + gs_compareFunction = NULL; + END_SORT(); } @@ -2119,3 +2155,17 @@ void wxArrayString::DoSort() qsort(m_pItems, m_nCount, sizeof(wxChar *), wxStringCompareFunction); } +bool wxArrayString::operator==(const wxArrayString& a) const +{ + if ( m_nCount != a.m_nCount ) + return FALSE; + + for ( size_t n = 0; n < m_nCount; n++ ) + { + if ( Item(n) != a[n] ) + return FALSE; + } + + return TRUE; +} + diff --git a/src/common/textfile.cpp b/src/common/textfile.cpp index 8ae8ee4eba..c4863f5bc3 100644 --- a/src/common/textfile.cpp +++ b/src/common/textfile.cpp @@ -67,10 +67,10 @@ const wxChar *wxTextFile::GetEOL(wxTextFileType type) wxFAIL_MSG(wxT("bad file type in wxTextFile::GetEOL.")); // fall through nevertheless - we must return something... - case wxTextFileType_None: return wxT(_T("")); - case wxTextFileType_Unix: return wxT(_T("\n")); - case wxTextFileType_Dos: return wxT(_T("\r\n")); - case wxTextFileType_Mac: return wxT(_T("\r")); + case wxTextFileType_None: return wxT(""); + case wxTextFileType_Unix: return wxT("\n"); + case wxTextFileType_Dos: return wxT("\r\n"); + case wxTextFileType_Mac: return wxT("\r"); } } @@ -286,7 +286,7 @@ bool wxTextFile::Read() char ch, chLast = '\0'; char buf[1024]; int n, nRead; - while ( !m_file.Eof() ) { + do { nRead = m_file.Read(buf, WXSIZEOF(buf)); if ( nRead == wxInvalidOffset ) { // read error (error message already given in wxFile::Read) @@ -329,7 +329,7 @@ bool wxTextFile::Read() } } } - } + } while ( nRead == WXSIZEOF(buf) ); // anything in the last line? if ( !str.IsEmpty() ) { diff --git a/src/common/timercmn.cpp b/src/common/timercmn.cpp index 67cec8530c..ecf4d66387 100644 --- a/src/common/timercmn.cpp +++ b/src/common/timercmn.cpp @@ -88,12 +88,6 @@ #endif #endif // HAVE_GETTIMEOFDAY -// ---------------------------------------------------------------------------- -// prototypes -// ---------------------------------------------------------------------------- - -wxLongLong wxGetLocalTimeMillis(); - // ============================================================================ // implementation // ============================================================================ @@ -274,7 +268,7 @@ wxLongLong wxGetLocalTimeMillis() (void)ftime(&tp); val *= tp.time; return (val + tp.millitm); -#else +#else // no gettimeofday() nor ftime() // We use wxGetLocalTime() to get the seconds since // 00:00:00 Jan 1st 1970 and then whatever is available // to get millisecond resolution. @@ -286,21 +280,38 @@ wxLongLong wxGetLocalTimeMillis() val *= wxGetLocalTime(); #if defined(__VISAGECPP__) + // If your platform/compiler needs to use two different functions + // to get ms resolution, please do NOT just shut off these warnings, + // drop me a line instead at <guille@iies.es> + #warning "Possible clock skew bug in wxGetLocalTimeMillis()!" + DATETIME dt; ::DosGetDateTime(&dt); val += (dt.hundredths*10); #elif defined (__WIN32__) -#warning "Possible clock skew bug in wxStopWatch!" + // If your platform/compiler needs to use two different functions + // to get ms resolution, please do NOT just shut off these warnings, + // drop me a line instead at <guille@iies.es> + #warning "Possible clock skew bug in wxGetLocalTimeMillis()!" + SYSTEMTIME st; ::GetLocalTime(&st); val += st.wMilliseconds; -#else -#if !defined(__VISUALC__) && !defined(__BORLANDC__) -#warning "wxStopWatch will be up to second resolution!" -#endif +#else // !Win32 + // If your platform/compiler does not support ms resolution please + // do NOT just shut off these warnings, drop me a line instead at + // <guille@iies.es> + + #if defined(__VISUALC__) + #pragma message("wxStopWatch will be up to second resolution!") + #elif defined(__BORLANDC__) + #pragma message "wxStopWatch will be up to second resolution!" + #else + #warning "wxStopWatch will be up to second resolution!" + #endif // compiler #endif return val; -#endif +#endif // time functions } diff --git a/src/common/txtstrm.cpp b/src/common/txtstrm.cpp index ae71ae5d21..8fd6ffaaaf 100644 --- a/src/common/txtstrm.cpp +++ b/src/common/txtstrm.cpp @@ -63,20 +63,20 @@ wxChar wxTextInputStream::NextNonSeparators() } -inline bool wxTextInputStream::EatEOL(const wxChar &c) +bool wxTextInputStream::EatEOL(const wxChar &c) { - if (c == wxT('\n')) return TRUE; // eat on UNIX + if (c == wxT('\n')) return TRUE; // eat on UNIX - if (c == wxT('\r')) // eat on both Mac and DOS + if (c == wxT('\r')) // eat on both Mac and DOS { - if (!m_input) return TRUE; - wxChar c2 = m_input.GetC(); + if (!m_input) return TRUE; + wxChar c2 = m_input.GetC(); - if (c2 != wxT('\n')) m_input.Ungetch( c2 ); // Don't eat on Mac - return TRUE; + if (c2 != wxT('\n')) m_input.Ungetch( c2 ); // Don't eat on Mac + return TRUE; } - return FALSE; + return FALSE; } void wxTextInputStream::SkipIfEndOfLine( wxChar c ) @@ -143,12 +143,16 @@ wxUint8 wxTextInputStream::Read8() double wxTextInputStream::ReadDouble() { - /* I only implemented a simple float parser */ - // VZ: what about using strtod()?? (TODO) + /* I only implemented a simple float parser + * VZ: what about using strtod()?? (TODO) + */ + double f; - int sign; + int theSign; + + if (!m_input) + return 0; - if (!m_input) return 0; int c = NextNonSeparators(); if (c==(wxChar)0) return 0; @@ -156,22 +160,22 @@ double wxTextInputStream::ReadDouble() if (! (c == wxT('.') || c == wxT(',') || c == wxT('-') || c == wxT('+') || isdigit(c)) ) { m_input.Ungetch(c); - return 0.0; + return 0; } if (c == wxT('-')) { - sign = -1; + theSign = -1; c = m_input.GetC(); } else if (c == wxT('+')) { - sign = 1; + theSign = 1; c = m_input.GetC(); } else { - sign = 1; + theSign = 1; } while (isdigit(c)) @@ -219,8 +223,7 @@ double wxTextInputStream::ReadDouble() m_input.Ungetch(c); } - f *= sign; - + f *= theSign; return f; } @@ -237,6 +240,7 @@ wxString wxTextInputStream::ReadLine() while ( !m_input.Eof() ) { c = m_input.GetC(); + if ( !m_input ) break; @@ -260,8 +264,15 @@ wxString wxTextInputStream::ReadWord() if ( !c ) return word; + word += c; + while ( !m_input.Eof() ) { + c = m_input.GetC(); + + if (!m_input) + break; + if (m_separators.Contains(c)) break; @@ -269,10 +280,6 @@ wxString wxTextInputStream::ReadWord() break; word += c; - - c = m_input.GetC(); - if (!m_input) - break; } return word; @@ -284,17 +291,19 @@ wxTextInputStream& wxTextInputStream::operator>>(wxString& word) return *this; } -wxTextInputStream& wxTextInputStream::operator>>(wxChar& c) +wxTextInputStream& wxTextInputStream::operator>>(char& c) { if (!m_input) { - c = (wxChar) 0; + c = 0; return *this; } c = m_input.GetC(); - if (EatEOL(c)) c=wxT('\n'); + if (EatEOL(c)) + c = '\n'; + return *this; } @@ -444,9 +453,14 @@ wxTextOutputStream& wxTextOutputStream::operator<<(const wxString& string) return *this; } -wxTextOutputStream& wxTextOutputStream::operator<<(wxChar c) +wxTextOutputStream& wxTextOutputStream::operator<<(char c) { - WriteString( wxString(c) ); + // these strange manipulations are needed in Unicode mode + char buf[2]; + buf[0] = c; + buf[1] = 0; + + WriteString( wxString(buf) ); return *this; } diff --git a/src/common/unzip.c b/src/common/unzip.c index c78982488c..d9b855ae5c 100644 --- a/src/common/unzip.c +++ b/src/common/unzip.c @@ -606,10 +606,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file, /* we check the magic */ if (err==UNZ_OK) + { if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) err=UNZ_ERRNO; else if (uMagic!=0x02014b50) err=UNZ_BADZIPFILE; + } if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK) err=UNZ_ERRNO; @@ -686,10 +688,13 @@ local int unzlocal_GetCurrentFileInfoInternal (file, uSizeRead = extraFieldBufferSize; if (lSeek!=0) + { if (fseek(s->file,lSeek,SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; + } + if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1) err=UNZ_ERRNO; @@ -711,10 +716,13 @@ local int unzlocal_GetCurrentFileInfoInternal (file, uSizeRead = commentBufferSize; if (lSeek!=0) + { if (fseek(s->file,lSeek,SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; + } + if ((file_info.size_file_comment>0) && (commentBufferSize>0)) if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1) err=UNZ_ERRNO; @@ -902,10 +910,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, if (err==UNZ_OK) + { if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) err=UNZ_ERRNO; else if (uMagic!=0x04034b50) err=UNZ_BADZIPFILE; + } if (unzlocal_getShort(s->file,&uData) != UNZ_OK) err=UNZ_ERRNO; @@ -1344,7 +1354,6 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) char *szComment; uLong uSizeBuf; { - int err=UNZ_OK; unz_s* s; uLong uReadThis ; if (file==NULL) diff --git a/src/common/url.cpp b/src/common/url.cpp index cce9ae5701..b6c54cca45 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -77,35 +77,40 @@ bool wxURL::ParseURL() { wxString last_url = m_url; - // If the URL was already parsed (so m_protocol != NULL), we pass this section. - if (!m_protocol) { - + // If the URL was already parsed (m_protocol != NULL), pass this section. + if (!m_protocol) + { // Clean up CleanData(); // Extract protocol name - if (!PrepProto(last_url)) { + if (!PrepProto(last_url)) + { m_error = wxURL_SNTXERR; return FALSE; } // Find and create the protocol object - if (!FetchProtocol()) { + if (!FetchProtocol()) + { m_error = wxURL_NOPROTO; return FALSE; } // Do we need a host name ? - if (m_protoinfo->m_needhost) { + if (m_protoinfo->m_needhost) + { // Extract it - if (!PrepHost(last_url)) { + if (!PrepHost(last_url)) + { m_error = wxURL_SNTXERR; return FALSE; } } // Extract full path - if (!PrepPath(last_url)) { + if (!PrepPath(last_url)) + { m_error = wxURL_NOPATH; return FALSE; } @@ -113,7 +118,8 @@ bool wxURL::ParseURL() // URL parse finished. #if wxUSE_SOCKETS - if (m_useProxy) { + if (m_useProxy) + { // We destroy the newly created protocol. CleanData(); @@ -192,7 +198,8 @@ bool wxURL::PrepHost(wxString& url) // Retrieve service number pos2 = temp_url.Find(wxT(':'), TRUE); - if (pos2 != -1 && pos2 < pos) { + if (pos2 != -1 && pos2 < pos) + { m_servname = temp_url(pos2+1, pos); if (!m_servname.IsNumber()) return FALSE; @@ -235,8 +242,10 @@ bool wxURL::FetchProtocol() { wxProtoInfo *info = ms_protocols; - while (info) { - if (m_protoname == info->m_protoname) { + while (info) + { + if (m_protoname == info->m_protoname) + { if (m_servname.IsNull()) m_servname = info->m_servname; @@ -257,13 +266,15 @@ wxInputStream *wxURL::GetInputStream() { wxInputStream *the_i_stream = NULL; - if (!m_protocol) { + if (!m_protocol) + { m_error = wxURL_NOPROTO; return NULL; } m_error = wxURL_NOERR; - if (m_user != wxT("")) { + if (m_user != wxT("")) + { m_protocol->SetUser(m_user); m_protocol->SetPassword(m_password); } @@ -272,8 +283,10 @@ wxInputStream *wxURL::GetInputStream() wxIPV4address addr; // m_protoinfo is NULL when we use a proxy - if (!m_useProxy && m_protoinfo->m_needhost) { - if (!addr.Hostname(m_hostname)) { + if (!m_useProxy && m_protoinfo->m_needhost) + { + if (!addr.Hostname(m_hostname)) + { m_error = wxURL_NOHOST; return NULL; } @@ -294,7 +307,8 @@ wxInputStream *wxURL::GetInputStream() else the_i_stream = m_protocol->GetInputStream(m_path); - if (!the_i_stream) { + if (!the_i_stream) + { m_error = wxURL_PROTOERR; return NULL; } @@ -384,23 +398,45 @@ void wxURL::SetProxy(const wxString& url_proxy) } #endif // wxUSE_SOCKETS -wxString wxURL::ConvertToValidURI(const wxString& uri) +wxString wxURL::ConvertToValidURI(const wxString& uri, const wxChar* delims) { wxString out_str; wxString hexa_code; size_t i; - for (i=0;i<uri.Len();i++) { + for (i = 0; i < uri.Len(); i++) + { wxChar c = uri.GetChar(i); if (c == wxT(' ')) - out_str += wxT('+'); - else { - if (!isalpha(c) && c != wxT('.') && c != wxT('+') && c != wxT('/')) { + { + // GRG, Apr/2000: changed to "%20" instead of '+' + + out_str += wxT("%20"); + } + else + { + // GRG, Apr/2000: modified according to the URI definition (RFC 2396) + // + // - Alphanumeric characters are never escaped + // - Unreserved marks are never escaped + // - Delimiters must be escaped if they appear within a component + // but not if they are used to separate components. Here we have + // no clear way to distinguish between these two cases, so they + // are escaped unless they are passed in the 'delims' parameter + // (allowed delimiters). + + static const wxChar marks[] = wxT("-_.!~*()'"); + + if ( !wxIsalnum(c) && !wxStrchr(marks, c) && !wxStrchr(delims, c) ) + { hexa_code.Printf(wxT("%%%02X"), c); out_str += hexa_code; - } else + } + else + { out_str += c; + } } } @@ -412,19 +448,23 @@ wxString wxURL::ConvertFromURI(const wxString& uri) wxString new_uri; size_t i = 0; - while (i<uri.Len()) { + while (i < uri.Len()) + { int code; - if (uri[i] == wxT('%')) { + if (uri[i] == wxT('%')) + { i++; if (uri[i] >= wxT('A') && uri[i] <= wxT('F')) code = (uri[i] - wxT('A') + 10) * 16; else code = (uri[i] - wxT('0')) * 16; + i++; if (uri[i] >= wxT('A') && uri[i] <= wxT('F')) code += (uri[i] - wxT('A')) + 10; else code += (uri[i] - wxT('0')); + i++; new_uri += (wxChar)code; continue; @@ -459,6 +499,7 @@ bool wxURLModule::OnInit() // set, but don't try to create this proxy right now because it will slow // down the program startup (especially if there is no DNS server // available, in which case it may take up to 1 minute) + if ( getenv("HTTP_PROXY") ) { wxURL::ms_useDefaultProxy = TRUE; diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 0eb8453bd6..5ddfb2442a 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -513,8 +513,8 @@ wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) else #endif // 0 { - wxLogDebug(wxT("Unrecognized accel key '%s', accel " - "string ignored."), current.c_str()); + wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."), + current.c_str()); } } } @@ -1025,7 +1025,7 @@ wxWindowDisabler::~wxWindowDisabler() { if ( !::SetForegroundWindow(GetHwndOf(m_winTop)) ) { - wxLogLastError("SetForegroundWindow"); + wxLogLastError(wxT("SetForegroundWindow")); } } #else @@ -1208,31 +1208,89 @@ wxString wxGetCurrentDir() // wxExecute // ---------------------------------------------------------------------------- -long wxExecute(const wxString& command, wxArrayString& output) +// this is a private function because it hasn't a clean interface: the first +// array is passed by reference, the second by pointer - instead we have 2 +// public versions of wxExecute() below +static long wxDoExecuteWithCapture(const wxString& command, + wxArrayString& output, + wxArrayString* error) { #ifdef __WIN16__ wxFAIL_MSG("Sorry, this version of wxExecute not implemented on WIN16."); + return 0; -#else +#else // !Win16 // create a wxProcess which will capture the output wxProcess *process = new wxProcess; process->Redirect(); long rc = wxExecute(command, TRUE /* sync */, process); + +#if wxUSE_STREAMS if ( rc != -1 ) { - wxInputStream& is = *process->GetInputStream(); - wxTextInputStream tis(is); - while ( !is.Eof() && is.IsOk() ) + wxInputStream* is = process->GetInputStream(); + wxCHECK_MSG( is, -1, _T("if wxExecute() succeded, stream can't be NULL") ); + wxTextInputStream tis(*is); + + wxTextInputStream *tes = NULL; + wxInputStream *es = NULL; + if ( error ) { - wxString line = tis.ReadLine(); - if ( is.LastError() ) - break; + es = process->GetErrorStream(); + + wxCHECK_MSG( es, -1, _T("stderr can't be NULL") ); + + tes = new wxTextInputStream(*es); + } + + bool cont; + do + { + cont = FALSE; + + if ( !is->Eof() && is->IsOk() ) + { + wxString line = tis.ReadLine(); + if ( is->LastError() ) + break; + + cont = TRUE; + + output.Add(line); + } + + if ( error && !es->Eof() && es->IsOk() ) + { + wxString line = tes->ReadLine(); + if ( es->LastError() ) + break; + + cont = TRUE; - output.Add(line); + error->Add(line); + } } + while ( cont ); + + delete tes; } +#endif // wxUSE_STREAMS + + delete process; return rc; -#endif +#endif // IO redirection supoprted +} + +long wxExecute(const wxString& command, wxArrayString& output) +{ + return wxDoExecuteWithCapture(command, output, NULL); +} + +long wxExecute(const wxString& command, + wxArrayString& output, + wxArrayString& error) +{ + return wxDoExecuteWithCapture(command, output, &error); } diff --git a/src/common/valgen.cpp b/src/common/valgen.cpp index 05134307bc..caadd90e80 100644 --- a/src/common/valgen.cpp +++ b/src/common/valgen.cpp @@ -46,8 +46,10 @@ #ifndef __WIN16__ #include "wx/spinbutt.h" +#if wxUSE_CHECKLISTBOX #include "wx/checklst.h" #endif +#endif #include "wx/valgen.h" @@ -212,30 +214,62 @@ bool wxGenericValidator::TransferToWindow(void) if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) ) { wxChoice* pControl = (wxChoice*) m_validatorWindow; - if (m_pInt) - { - pControl->SetSelection(*m_pInt) ; - return TRUE; - } + if (m_pInt) + { + pControl->SetSelection(*m_pInt) ; + return TRUE; + } + else if (m_pString) + { + if (pControl->FindString(* m_pString) > -1) + { + pControl->SetStringSelection(* m_pString); + } + return TRUE; + } } else #endif + if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) + { + wxComboBox* pControl = (wxComboBox*) m_validatorWindow; + if (m_pInt) + { + pControl->SetSelection(*m_pInt) ; + return TRUE; + } + else if (m_pString) + { + if (pControl->FindString(* m_pString) > -1) + { + pControl->SetStringSelection(* m_pString); + } + return TRUE; + } + } else if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) ) { wxStaticText* pControl = (wxStaticText*) m_validatorWindow; - if (m_pString) - { - pControl->SetLabel(*m_pString) ; - return TRUE; - } + if (m_pString) + { + pControl->SetLabel(*m_pString) ; + return TRUE; + } } else if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) ) { wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow; - if (m_pString) - { - pControl->SetValue(*m_pString) ; - return TRUE; - } + if (m_pString) + { + pControl->SetValue(*m_pString) ; + return TRUE; + } + else if (m_pInt) + { + wxString str; + str.Printf("%d", *m_pInt); + pControl->SetValue(str); + return TRUE; + } } else #if wxUSE_CHECKLISTBOX #ifndef __WIN16__ @@ -393,6 +427,11 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pString = pControl->GetValue() ; return TRUE; } + else if (m_pString) + { + *m_pString = pControl->GetStringSelection(); + return TRUE; + } } else #endif #if wxUSE_CHOICE @@ -404,8 +443,27 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pInt = pControl->GetSelection() ; return TRUE; } + else if (m_pString) + { + *m_pString = pControl->GetStringSelection(); + return TRUE; + } } else #endif + if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) + { + wxComboBox* pControl = (wxComboBox*) m_validatorWindow; + if (m_pInt) + { + *m_pInt = pControl->GetSelection() ; + return TRUE; + } + else if (m_pString) + { + *m_pString = pControl->GetStringSelection(); + return TRUE; + } + } else if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) ) { wxStaticText* pControl = (wxStaticText*) m_validatorWindow; @@ -423,6 +481,11 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pString = pControl->GetValue() ; return TRUE; } + else if (m_pInt) + { + *m_pInt = atoi(pControl->GetValue()); + return TRUE; + } } else #if wxUSE_CHECKLISTBOX #ifndef __WIN16__ diff --git a/src/common/valtext.cpp b/src/common/valtext.cpp index 27e3d04cd6..9e7599571b 100644 --- a/src/common/valtext.cpp +++ b/src/common/valtext.cpp @@ -98,7 +98,7 @@ static bool wxIsAlpha(const wxString& val) int i; for ( i = 0; i < (int)val.Length(); i++) { - if (!isalpha(val[i])) + if (!wxIsalpha(val[i])) return FALSE; } return TRUE; @@ -109,7 +109,7 @@ static bool wxIsAlphaNumeric(const wxString& val) int i; for ( i = 0; i < (int)val.Length(); i++) { - if (!isalnum(val[i])) + if (!wxIsalnum(val[i])) return FALSE; } return TRUE; @@ -276,9 +276,9 @@ void wxTextValidator::OnChar(wxKeyEvent& event) !(keyCode < WXK_SPACE || keyCode == WXK_DELETE || keyCode > WXK_START) && ( ((m_validatorStyle & wxFILTER_ASCII) && !isascii(keyCode)) || - ((m_validatorStyle & wxFILTER_ALPHA) && !isalpha(keyCode)) || - ((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !isalnum(keyCode)) || - ((m_validatorStyle & wxFILTER_NUMERIC) && !isdigit(keyCode) + ((m_validatorStyle & wxFILTER_ALPHA) && !wxIsalpha(keyCode)) || + ((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsalnum(keyCode)) || + ((m_validatorStyle & wxFILTER_NUMERIC) && !wxIsdigit(keyCode) && keyCode != '.' && keyCode != ',' && keyCode != '-') ) ) diff --git a/src/common/variant.cpp b/src/common/variant.cpp index 491cf8c470..26e623c1b5 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -38,11 +38,13 @@ #include "wx/string.h" #include "wx/variant.h" +#if wxUSE_TIMEDATE IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject) wxTime::tFormat wxTime::ms_Format = wxTime::wx12h; wxTime::tPrecision wxTime::ms_Precision = wxTime::wxStdMinSec; +#endif IMPLEMENT_ABSTRACT_CLASS(wxVariantData, wxObject) @@ -1350,8 +1352,8 @@ bool wxVariant::operator== (const wxString& value) const wxString thisValue; if (!Convert(&thisValue)) return FALSE; - else - return (value == thisValue); + + return value == thisValue; } bool wxVariant::operator!= (const wxString& value) const @@ -1448,8 +1450,8 @@ bool wxVariant::operator== (const wxTime& value) const wxTime thisValue; if (!Convert(&thisValue)) return FALSE; - else - return (value == thisValue); + + return value == thisValue; } bool wxVariant::operator!= (const wxTime& value) const @@ -1476,8 +1478,8 @@ bool wxVariant::operator== (const wxDate& value) const wxDate thisValue; if (!Convert(&thisValue)) return FALSE; - else - return (value == thisValue); + + return (value == thisValue); } bool wxVariant::operator!= (const wxDate& value) const @@ -1507,7 +1509,7 @@ bool wxVariant::operator== (void* value) const bool wxVariant::operator!= (void* value) const { - return (!((*this) == value)); + return (!((*this) == (void*) value)); } void wxVariant::operator= (void* value) @@ -1666,13 +1668,12 @@ bool wxVariant::GetBool() const wxString wxVariant::GetString() const { wxString value; - if (Convert(& value)) - return value; - else + if (!Convert(& value)) { wxFAIL_MSG(wxT("Could not convert to a string")); - return wxString(""); } + + return value; } // For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled @@ -1680,27 +1681,25 @@ wxString wxVariant::GetString() const wxTime wxVariant::GetTime() const { wxTime value; - if (Convert(& value)) - return value; - else + if (!Convert(& value)) { wxFAIL_MSG(wxT("Could not convert to a time")); - return wxTime(); } + + return value; } wxDate wxVariant::GetDate() const { wxDate value; - if (Convert(& value)) - return value; - else + if (!Convert(& value)) { wxFAIL_MSG(wxT("Could not convert to a date")); - return wxDate(); } + + return value; } -#endif +#endif // wxUSE_TIMEDATE void* wxVariant::GetVoidPtr() const { diff --git a/src/common/wfstream.cpp b/src/common/wfstream.cpp index 3e1970a3ff..b28617d537 100644 --- a/src/common/wfstream.cpp +++ b/src/common/wfstream.cpp @@ -5,7 +5,7 @@ // Modified by: // Created: 11/07/98 // RCS-ID: $Id$ -// Copyright: (c) Guilhem Lavaux +// Copyright: (c) Guilhem Lavaux // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -33,65 +33,66 @@ wxFileInputStream::wxFileInputStream(const wxString& fileName) : wxInputStream() { - m_file = new wxFile(fileName, wxFile::read); - m_file_destroy = TRUE; + m_file = new wxFile(fileName, wxFile::read); + m_file_destroy = TRUE; } wxFileInputStream::wxFileInputStream() : wxInputStream() { - m_file_destroy = FALSE; - m_file = NULL; + m_file_destroy = FALSE; + m_file = NULL; } wxFileInputStream::wxFileInputStream(wxFile& file) { - m_file = &file; - m_file_destroy = FALSE; + m_file = &file; + m_file_destroy = FALSE; } wxFileInputStream::wxFileInputStream(int fd) { - m_file = new wxFile(fd); - m_file_destroy = TRUE; + m_file = new wxFile(fd); + m_file_destroy = TRUE; } wxFileInputStream::~wxFileInputStream() { - if (m_file_destroy) - delete m_file; + if (m_file_destroy) + delete m_file; } size_t wxFileInputStream::GetSize() const { - return m_file->Length(); + return m_file->Length(); } size_t wxFileInputStream::OnSysRead(void *buffer, size_t size) { - off_t ret; + off_t ret; - ret = m_file->Read(buffer, size); + ret = m_file->Read(buffer, size); - m_lasterror = wxStream_NOERROR; - if (m_file->Eof()) - m_lasterror = wxStream_EOF; - if (ret == wxInvalidOffset) { - m_lasterror = wxStream_READ_ERR; - ret = 0; - } + m_lasterror = wxStream_NOERROR; + if (m_file->Eof()) + m_lasterror = wxStream_EOF; + if (ret == wxInvalidOffset) + { + m_lasterror = wxStream_READ_ERR; + ret = 0; + } - return ret; + return ret; } off_t wxFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode) { - return m_file->Seek(pos, mode); + return m_file->Seek(pos, mode); } off_t wxFileInputStream::OnSysTell() const { - return m_file->Tell(); + return m_file->Tell(); } // ---------------------------------------------------------------------------- @@ -100,74 +101,77 @@ off_t wxFileInputStream::OnSysTell() const wxFileOutputStream::wxFileOutputStream(const wxString& fileName) { - m_file = new wxFile(fileName, wxFile::write); - m_file_destroy = TRUE; + m_file = new wxFile(fileName, wxFile::write); + m_file_destroy = TRUE; } wxFileOutputStream::wxFileOutputStream(wxFile& file) { - m_file = &file; - m_file_destroy = FALSE; + m_file = &file; + m_file_destroy = FALSE; } wxFileOutputStream::wxFileOutputStream() : wxOutputStream() { - m_file_destroy = FALSE; - m_file = NULL; + m_file_destroy = FALSE; + m_file = NULL; } wxFileOutputStream::wxFileOutputStream(int fd) { - m_file = new wxFile(fd); - m_file_destroy = TRUE; + m_file = new wxFile(fd); + m_file_destroy = TRUE; } wxFileOutputStream::~wxFileOutputStream() { - if (m_file_destroy) { - Sync(); - delete m_file; - } + if (m_file_destroy) + { + Sync(); + delete m_file; + } } size_t wxFileOutputStream::OnSysWrite(const void *buffer, size_t size) { - size_t ret = m_file->Write(buffer, size); - if (m_file->Error()) - m_lasterror = wxStream_WRITE_ERR; - else - m_lasterror = wxStream_NOERROR; - return ret; + size_t ret = m_file->Write(buffer, size); + if (m_file->Error()) + m_lasterror = wxStream_WRITE_ERR; + else + m_lasterror = wxStream_NOERROR; + return ret; } off_t wxFileOutputStream::OnSysTell() const { - return m_file->Tell(); + return m_file->Tell(); } off_t wxFileOutputStream::OnSysSeek(off_t pos, wxSeekMode mode) { - return m_file->Seek(pos, mode); + return m_file->Seek(pos, mode); } void wxFileOutputStream::Sync() { - wxOutputStream::Sync(); - m_file->Flush(); + wxOutputStream::Sync(); + m_file->Flush(); } size_t wxFileOutputStream::GetSize() const { - return m_file->Length(); + return m_file->Length(); } // ---------------------------------------------------------------------------- // wxFileStream // ---------------------------------------------------------------------------- + wxFileStream::wxFileStream(const wxString& fileName) - : wxFileInputStream(fileName), wxFileOutputStream(*wxFileInputStream::m_file) + : wxFileInputStream(fileName) { + wxFileOutputStream::m_file = wxFileInputStream::m_file; } // ---------------------------------------------------------------------------- @@ -177,64 +181,65 @@ wxFileStream::wxFileStream(const wxString& fileName) wxFFileInputStream::wxFFileInputStream(const wxString& fileName) : wxInputStream() { - m_file = new wxFFile(fileName, "r"); - m_file_destroy = TRUE; + m_file = new wxFFile(fileName, "rb"); + m_file_destroy = TRUE; } wxFFileInputStream::wxFFileInputStream() : wxInputStream() { - m_file_destroy = FALSE; - m_file = NULL; + m_file_destroy = FALSE; + m_file = NULL; } wxFFileInputStream::wxFFileInputStream(wxFFile& file) { - m_file = &file; - m_file_destroy = FALSE; + m_file = &file; + m_file_destroy = FALSE; } wxFFileInputStream::wxFFileInputStream(FILE *file) { - m_file = new wxFFile(file); - m_file_destroy = TRUE; + m_file = new wxFFile(file); + m_file_destroy = TRUE; } wxFFileInputStream::~wxFFileInputStream() { - if (m_file_destroy) - delete m_file; + if (m_file_destroy) + delete m_file; } size_t wxFFileInputStream::GetSize() const { - return m_file->Length(); + return m_file->Length(); } size_t wxFFileInputStream::OnSysRead(void *buffer, size_t size) { - off_t ret; + off_t ret; - ret = m_file->Read(buffer, size); + ret = m_file->Read(buffer, size); - if (m_file->Eof()) - m_lasterror = wxStream_EOF; - if (ret == wxInvalidOffset) { - m_lasterror = wxStream_READ_ERR; - ret = 0; - } + if (m_file->Eof()) + m_lasterror = wxStream_EOF; + if (ret == wxInvalidOffset) + { + m_lasterror = wxStream_READ_ERR; + ret = 0; + } - return ret; + return ret; } off_t wxFFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode) { - return m_file->Seek(pos, mode); + return m_file->Seek(pos, mode); } off_t wxFFileInputStream::OnSysTell() const { - return m_file->Tell(); + return m_file->Tell(); } // ---------------------------------------------------------------------------- @@ -243,75 +248,79 @@ off_t wxFFileInputStream::OnSysTell() const wxFFileOutputStream::wxFFileOutputStream(const wxString& fileName) { - m_file = new wxFFile(fileName, "w+"); - m_file_destroy = TRUE; + m_file = new wxFFile(fileName, "w+b"); + m_file_destroy = TRUE; } wxFFileOutputStream::wxFFileOutputStream(wxFFile& file) { - m_file = &file; - m_file_destroy = FALSE; + m_file = &file; + m_file_destroy = FALSE; } wxFFileOutputStream::wxFFileOutputStream() : wxOutputStream() { - m_file_destroy = FALSE; - m_file = NULL; + m_file_destroy = FALSE; + m_file = NULL; } wxFFileOutputStream::wxFFileOutputStream(FILE *file) { - m_file = new wxFFile(file); - m_file_destroy = TRUE; + m_file = new wxFFile(file); + m_file_destroy = TRUE; } wxFFileOutputStream::~wxFFileOutputStream() { - if (m_file_destroy) { - Sync(); - delete m_file; - } + if (m_file_destroy) + { + Sync(); + delete m_file; + } } size_t wxFFileOutputStream::OnSysWrite(const void *buffer, size_t size) { - size_t ret = m_file->Write(buffer, size); - if (m_file->Error()) - m_lasterror = wxStream_WRITE_ERR; - else - m_lasterror = wxStream_NOERROR; - return ret; + size_t ret = m_file->Write(buffer, size); + if (m_file->Error()) + m_lasterror = wxStream_WRITE_ERR; + else + m_lasterror = wxStream_NOERROR; + return ret; } off_t wxFFileOutputStream::OnSysTell() const { - return m_file->Tell(); + return m_file->Tell(); } off_t wxFFileOutputStream::OnSysSeek(off_t pos, wxSeekMode mode) { - return m_file->Seek(pos, mode); + return m_file->Seek(pos, mode); } void wxFFileOutputStream::Sync() { - wxOutputStream::Sync(); - m_file->Flush(); + wxOutputStream::Sync(); + m_file->Flush(); } size_t wxFFileOutputStream::GetSize() const { - return m_file->Length(); + return m_file->Length(); } // ---------------------------------------------------------------------------- // wxFFileStream // ---------------------------------------------------------------------------- + wxFFileStream::wxFFileStream(const wxString& fileName) - : wxFFileInputStream(fileName), wxFFileOutputStream(*wxFFileInputStream::m_file) + : wxFFileInputStream(fileName) { + wxFFileOutputStream::m_file = wxFFileInputStream::m_file; } + #endif // wxUSE_STREAMS && wxUSE_FILE diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index b1862f8a2e..e40b8f23c4 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -125,12 +125,7 @@ void wxWindowBase::InitBase() m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOWTEXT); // GRG, changed Mar/2000 -#if defined(__VISAGECPP__) && __IBMCPP__ < 0x400 - // For now VisualAge 3.0 needs it this way - m_font = *wxSWISS_FONT; // and this? -#else m_font = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT); -#endif // no style bits m_exStyle = m_windowStyle = 0; @@ -321,13 +316,32 @@ bool wxWindowBase::DestroyChildren() // centre the window with respect to its parent in either (or both) directions void wxWindowBase::Centre(int direction) { + // the position/size of the parent window or of the entire screen + wxPoint posParent; int widthParent, heightParent; - wxWindow *parent = GetParent(); - if ( !parent ) + wxWindow *parent = NULL; + + if ( !(direction & wxCENTRE_ON_SCREEN) ) { - // no other choice - direction |= wxCENTRE_ON_SCREEN; + // find the parent to centre this window on: it should be the + // immediate parent for the controls but the top level parent for the + // top level windows (like dialogs) + parent = GetParent(); + if ( IsTopLevel() ) + { + while ( parent && !parent->IsTopLevel() ) + { + parent = parent->GetParent(); + } + } + + // did we find the parent? + if ( !parent ) + { + // no other choice + direction |= wxCENTRE_ON_SCREEN; + } } if ( direction & wxCENTRE_ON_SCREEN ) @@ -337,8 +351,19 @@ void wxWindowBase::Centre(int direction) } else { - // centre inside the parents rectangle - parent->GetClientSize(&widthParent, &heightParent); + if ( IsTopLevel() ) + { + // centre on the parent + parent->GetSize(&widthParent, &heightParent); + + // adjust to the parents position + posParent = parent->GetPosition(); + } + else + { + // centre inside the parents client rectangle + parent->GetClientSize(&widthParent, &heightParent); + } } int width, height; @@ -353,20 +378,8 @@ void wxWindowBase::Centre(int direction) if ( direction & wxVERTICAL ) yNew = (heightParent - height)/2; - // controls are always centered on their parent because it doesn't make - // sense to centre them on the screen - if ( !(direction & wxCENTRE_ON_SCREEN) || !IsTopLevel() ) - { - // the only chance to get this is to have a not top level window - // without parent which shouldn't happen - wxCHECK_RET( parent, wxT("this window must have a parent") ); - - // adjust to the parents client area origin - wxPoint posParent = parent->ClientToScreen(wxPoint(0, 0)); - - xNew += posParent.x; - yNew += posParent.y; - } + xNew += posParent.x; + yNew += posParent.y; // move the centre of this window to this position Move(xNew, yNew); @@ -491,6 +504,11 @@ void wxWindowBase::AddChild(wxWindowBase *child) { wxCHECK_RET( child, wxT("can't add a NULL child") ); + // this should never happen and it will lead to a crash later if it does + // because RemoveChild() will remove only one node from the children list + // and the other(s) one(s) will be left with dangling pointers in them + wxASSERT_MSG( !GetChildren().Find(child), _T("AddChild() called twice") ); + GetChildren().Append(child); child->SetParent(this); } @@ -1416,9 +1434,7 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event ) wxMessageBox(wxString::Format( _T( - " wxWindows Library (%s port)\n" - "Version %u.%u.%u, compiled at %s %s\n" - " Copyright (c) 1995-2000 wxWindows team" + " wxWindows Library (%s port)\nVersion %u.%u.%u, compiled at %s %s\n Copyright (c) 1995-2000 wxWindows team" ), port.c_str(), wxMAJOR_VERSION, diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index c2deb9b203..ea538f5fc0 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -354,6 +354,16 @@ WXDLLEXPORT FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *strea return freopen(wxConvFile.cWX2MB(path), wxConvLibc.cWX2MB(mode), stream); } +WXDLLEXPORT int wxRemove(const wxChar *path) +{ + return remove(wxConvFile.cWX2MB(path)); +} + +WXDLLEXPORT int wxRename(const wxChar *oldpath, const wxChar *newpath) +{ + return rename(wxConvFile.cWX2MB(oldpath), wxConvFile.cWX2MB(newpath)); +} + int WXDLLEXPORT wxPrintf(const wxChar *fmt, ...) { va_list argptr; diff --git a/src/common/wxexpr.cpp b/src/common/wxexpr.cpp index bbfce13288..2abeffce01 100644 --- a/src/common/wxexpr.cpp +++ b/src/common/wxexpr.cpp @@ -719,17 +719,17 @@ void wxExpr::WriteExpr(FILE* stream) // Write as any other subexpression case wxExprString: { fprintf( stream, "\"" ); - int i; + size_t i; const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.string); - int len = strlen(val); + size_t len = strlen(val); for (i = 0; i < len; i++) { char ch = val[i]; if (ch == '"' || ch == '\\') - fprintf( stream, "\\" ); - char tmp[2]; - tmp[0] = ch; - tmp[1] = 0; + fprintf( stream, "\\" ); + char tmp[2]; + tmp[0] = ch; + tmp[1] = 0; fprintf( stream, tmp ); } fprintf( stream, "\"" ); @@ -739,12 +739,12 @@ void wxExpr::WriteExpr(FILE* stream) // Write as any other subexpression { bool quote_it = FALSE; const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.word); - int len = strlen(val); - if ((len == 0) || (len > 0 && (val[0] > 64 && val[0] < 91))) + size_t len = strlen(val); + if ((len == 0) || (len > 0 && (val[(size_t) 0] > 64 && val[(size_t) 0] < 91))) quote_it = TRUE; else { - int i; + size_t i; for (i = 0; i < len; i++) if ((!isalpha(val[i])) && (!isdigit(val[i])) && (val[i] != '_')) @@ -754,7 +754,7 @@ void wxExpr::WriteExpr(FILE* stream) // Write as any other subexpression if (quote_it) fprintf( stream ,"'" ); - fprintf( stream, (const char*) val ); + fprintf( stream, val ); if (quote_it) fprintf( stream, "'" ); @@ -785,7 +785,7 @@ void wxExpr::WriteExpr(FILE* stream) // Write as any other subexpression expr->WriteExpr(stream); expr = expr->next; if (expr) - fprintf( stream, ", " ); + fprintf( stream, ", " ); } fprintf( stream, "]" ); } @@ -992,7 +992,7 @@ bool wxExprDatabase::Read(const wxString& filename) { noErrors = 0; - FILE *f = fopen(filename.fn_str(), "r"); + FILE *f = wxFopen(filename, _T("r")); if (f) { thewxExprDatabase = this; @@ -1024,7 +1024,7 @@ bool wxExprDatabase::ReadFromString(const wxString& buffer) bool wxExprDatabase::Write(const wxString& fileName) { - FILE *stream = fopen( fileName.fn_str(), "w+" ); + FILE *stream = wxFopen( fileName, _T("w+")); if (!stream) return FALSE; @@ -1130,7 +1130,7 @@ char *wxmake_word(char *str) char *wxmake_string(char *str) { wxChar *s, *t; - int len, i; + size_t len, i; const wxMB2WXbuf sbuf = wxConvLibc.cMB2WX(str); // str++; /* skip leading quote */ diff --git a/src/common/zipstrm.cpp b/src/common/zipstrm.cpp index 54cb0c8638..fb191d35c3 100644 --- a/src/common/zipstrm.cpp +++ b/src/common/zipstrm.cpp @@ -39,13 +39,13 @@ wxZipInputStream::wxZipInputStream(const wxString& archive, const wxString& file m_Pos = 0; m_Size = 0; - m_Archive = (void*) unzOpen(archive.fn_str()); + m_Archive = (void*) unzOpen(archive.mb_str()); if (m_Archive == NULL) { m_lasterror = wxStream_READ_ERR; return; } - if (unzLocateFile((unzFile)m_Archive, file.fn_str(), 0) != UNZ_OK) + if (unzLocateFile((unzFile)m_Archive, file.mb_str(), 0) != UNZ_OK) { m_lasterror = wxStream_READ_ERR; return; @@ -73,13 +73,32 @@ wxZipInputStream::~wxZipInputStream() } } +bool wxZipInputStream::Eof() const +{ + wxASSERT_MSG( m_Pos <= (off_t)m_Size, + _T("wxZipInputStream: invalid current position") ); + + return m_Pos >= (off_t)m_Size; +} size_t wxZipInputStream::OnSysRead(void *buffer, size_t bufsize) { - if (m_Pos + bufsize > m_Size) bufsize = m_Size - m_Pos; + wxASSERT_MSG( m_Pos <= (off_t)m_Size, + _T("wxZipInputStream: invalid current position") ); + + if ( m_Pos >= (off_t)m_Size ) + { + m_lasterror = wxStream_EOF; + return 0; + } + + if (m_Pos + bufsize > m_Size) + bufsize = m_Size - m_Pos; + unzReadCurrentFile((unzFile)m_Archive, buffer, bufsize); m_Pos += bufsize; + return bufsize; } diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp index 7ca4e3bac4..e0285c9db1 100644 --- a/src/common/zstream.cpp +++ b/src/common/zstream.cpp @@ -27,14 +27,14 @@ #include "wx/intl.h" #include "wx/log.h" -// When using configure, the path must be "zlib.h" I don't know -// what other ports (wxMac, wxMotif without configure) need here. -// If we are building with configure (defines __WX_SETUP_H__), -// we trust the zlib path is given as a -I option. -#if defined(__WXMSW__) && !defined(__WX_SETUP_H__) +// normally, the compiler options should contain -I../zlib, but it is +// apparently not the case for all MSW makefiles and so, unless we use +// configure (which defines __WX_SETUP_H__) or it is explicitly overridden by +// the user (who can define wxUSE_ZLIB_H_IN_PATH), we hardcode the path here +#if defined(__WXMSW__) && !defined(__WX_SETUP_H__) && !defined(wxUSE_ZLIB_H_IN_PATH) #include "../zlib/zlib.h" #else - #include "zlib.h" + #include <zlib.h> #endif #define ZSTREAM_BUFFER_SIZE 1024 @@ -85,7 +85,7 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size) while (m_inflate->avail_out > 0) { if (m_inflate->avail_in == 0) { - m_parent_i_stream->Read(m_z_buffer, m_z_size); + m_parent_i_stream->Read(m_z_buffer, wxMin(m_z_size, size)); m_inflate->next_in = m_z_buffer; m_inflate->avail_in = m_parent_i_stream->LastRead(); @@ -95,6 +95,13 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size) m_lasterror = m_parent_i_stream->LastError(); return 0; // failed to read anything } + + if ( m_inflate->avail_in == 0 ) + { + // EOF + m_lasterror = wxStream_EOF; + break; + } } err = inflate(m_inflate, Z_FINISH); if (err == Z_STREAM_END) diff --git a/src/files.lst b/src/files.lst index f6fc2a3323..14b8289f11 100644 --- a/src/files.lst +++ b/src/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 19:26, 2000/03/20 +# This file was automatically generated by tmake at 20:17, 2000/03/31 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BASE.T! ALL_SOURCES = \ common/init.cpp \ @@ -9,6 +9,7 @@ ALL_SOURCES = \ common/datstrm.cpp \ common/dynarray.cpp \ common/dynlib.cpp \ + common/encconv.cpp \ common/event.cpp \ common/extended.c \ common/ffile.cpp \ @@ -16,6 +17,7 @@ ALL_SOURCES = \ common/fileconf.cpp \ common/filefn.cpp \ common/filesys.cpp \ + common/fontmap.cpp \ common/fs_inet.cpp \ common/fs_mem.cpp \ common/fs_zip.cpp \ @@ -78,12 +80,16 @@ ALL_HEADERS = \ dir.h \ dynarray.h \ dynlib.h \ + encconv.h \ event.h \ ffile.h \ file.h \ fileconf.h \ filefn.h \ filesys.h \ + fontenc.h \ + fontmap.h \ + fontutil.h \ fs_inet.h \ fs_mem.h \ fs_zip.h \ @@ -145,6 +151,7 @@ BASE_OBJS = \ datstrm.o \ dynarray.o \ dynlib.o \ + encconv.o \ event.o \ extended.o \ ffile.o \ @@ -152,6 +159,7 @@ BASE_OBJS = \ fileconf.o \ filefn.o \ filesys.o \ + fontmap.o \ fs_inet.o \ fs_mem.o \ fs_zip.o \ @@ -201,6 +209,7 @@ BASE_DEPS = \ datstrm.d \ dynarray.d \ dynlib.d \ + encconv.d \ event.d \ extended.d \ ffile.d \ @@ -208,6 +217,7 @@ BASE_DEPS = \ fileconf.d \ filefn.d \ filesys.d \ + fontmap.d \ fs_inet.d \ fs_mem.d \ fs_zip.d \ @@ -264,6 +274,7 @@ BASE_DEPS = \ datstrm.d \ dynarray.d \ dynlib.d \ + encconv.d \ event.d \ extended.d \ ffile.d \ @@ -271,6 +282,7 @@ BASE_DEPS = \ fileconf.d \ filefn.d \ filesys.d \ + fontmap.d \ fs_inet.d \ fs_mem.d \ fs_zip.d \ diff --git a/src/generic/calctrl.cpp b/src/generic/calctrl.cpp index 34c346e4c7..f2ecd265a1 100644 --- a/src/generic/calctrl.cpp +++ b/src/generic/calctrl.cpp @@ -95,6 +95,7 @@ BEGIN_EVENT_TABLE(wxYearSpinCtrl, wxSpinCtrl) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxCalendarCtrl, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxCalendarEvent, wxCommandEvent) // ============================================================================ // implementation @@ -121,6 +122,7 @@ wxMonthComboBox::wxMonthComboBox(wxCalendarCtrl *cal) } SetSelection(m_cal->GetDate().GetMonth()); + SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT); } wxYearSpinCtrl::wxYearSpinCtrl(wxCalendarCtrl *cal) @@ -562,7 +564,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) RecalcGeometry(); #if DEBUG_PAINT - printf("--- starting to paint, selection: %s, week %u\n", + wxLogDebug("--- starting to paint, selection: %s, week %u\n", m_date.Format("%a %d-%m-%Y %H:%M:%S").c_str(), GetWeek(m_date)); #endif @@ -571,7 +573,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) if ( IsExposed(0, 0, 7*m_widthCol, m_heightRow) ) { #if DEBUG_PAINT - puts("painting the header"); + wxLogDebug("painting the header"); #endif dc.SetBackgroundMode(wxTRANSPARENT); @@ -601,7 +603,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) wxDateTime date = GetStartDate(); #if DEBUG_PAINT - printf("starting calendar from %s\n", + wxLogDebug("starting calendar from %s\n", date.Format("%a %d-%m-%Y %H:%M:%S").c_str()); #endif @@ -617,7 +619,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) } #if DEBUG_PAINT - printf("painting week %d at y = %d\n", nWeek, y); + wxLogDebug("painting week %d at y = %d\n", nWeek, y); #endif for ( size_t wd = 0; wd < 7; wd++ ) @@ -730,7 +732,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) } } #if DEBUG_PAINT - puts("+++ finished painting"); + wxLogDebug("+++ finished painting"); #endif } @@ -748,8 +750,17 @@ void wxCalendarCtrl::RefreshDate(const wxDateTime& date) rect.width = 7*m_widthCol; rect.height = m_heightRow; +#ifdef __WXMSW__ + // VZ: for some reason, the selected date seems to occupy more space under + // MSW - this is probably some bug in the font size calculations, but I + // don't know where exactly. This fix is ugly and leads to more + // refreshes than really needed, but without it the selected days + // leaves even more ugly underscores on screen. + rect.Inflate(0, 1); +#endif // MSW + #if DEBUG_PAINT - printf("*** refreshing week %d at (%d, %d)-(%d, %d)\n", + wxLogDebug("*** refreshing week %d at (%d, %d)-(%d, %d)\n", GetWeek(date), rect.x, rect.y, rect.x + rect.width, rect.y + rect.height); diff --git a/src/generic/caret.cpp b/src/generic/caret.cpp index 2620630941..3371a270cd 100644 --- a/src/generic/caret.cpp +++ b/src/generic/caret.cpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: generic/caret.h -// Purpose: generic wxCaret class +// Name: generic/caret.cpp +// Purpose: generic wxCaret class implementation // Author: Vadim Zeitlin (original code by Robert Roebling) // Modified by: // Created: 25.05.99 @@ -18,7 +18,7 @@ // ---------------------------------------------------------------------------- #ifdef __GNUG__ -#pragma implementation "caret.h" + #pragma implementation "caret.h" #endif // For compilers that support precompilation, includes "wx.h". @@ -46,6 +46,10 @@ static int gs_blinkTime = 500; // in milliseconds // implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// timer stuff +// ---------------------------------------------------------------------------- + wxCaretTimer::wxCaretTimer(wxCaret *caret) { m_caret = caret; @@ -53,14 +57,20 @@ wxCaretTimer::wxCaretTimer(wxCaret *caret) void wxCaretTimer::Notify() { - m_caret->Blink(); + m_caret->OnTimer(); +} + +void wxCaret::OnTimer() +{ + // don't blink the caret when we don't have the focus + if ( m_hasFocus ) + Blink(); } // ---------------------------------------------------------------------------- // wxCaret static functions and data // ---------------------------------------------------------------------------- - int wxCaretBase::GetBlinkTime() { return gs_blinkTime; @@ -77,6 +87,8 @@ void wxCaretBase::SetBlinkTime(int milliseconds) void wxCaret::InitGeneric() { + m_hasFocus = TRUE; + m_blinkedOut = FALSE; } wxCaret::~wxCaret() @@ -119,6 +131,32 @@ void wxCaret::DoMove() //else: will be shown at the correct location next time it blinks } +// ---------------------------------------------------------------------------- +// handling the focus +// ---------------------------------------------------------------------------- + +void wxCaret::OnSetFocus() +{ + m_hasFocus = TRUE; + + Refresh(); +} + +void wxCaret::OnKillFocus() +{ + m_hasFocus = FALSE; + + if ( IsVisible() ) + { + // the caret must be shown - otherwise, if it is hidden now, it will + // stay so until the focus doesn't return because it won't blink any + // more + m_blinkedOut = FALSE; + } + + Refresh(); +} + // ---------------------------------------------------------------------------- // drawing the caret // ---------------------------------------------------------------------------- @@ -127,14 +165,23 @@ void wxCaret::Blink() { m_blinkedOut = !m_blinkedOut; - wxClientDC dc(GetWindow()); + Refresh(); +} + +void wxCaret::Refresh() +{ if ( !m_blinkedOut ) { + wxClientDC dc(GetWindow()); DoDraw(&dc); } else { - // FIXME can't be less efficient than this... (+1 needed!) + // FIXME can't be less efficient than this... we probably should use + // backing store for the caret instead of leaving all the burden + // of correct refresh logic handling to the user code + + // NB: +1 is needed! wxRect rect(m_x, m_y, m_width + 1, m_height + 1); GetWindow()->Refresh(FALSE, &rect); } @@ -143,8 +190,18 @@ void wxCaret::Blink() void wxCaret::DoDraw(wxDC *dc) { dc->SetPen( *wxBLACK_PEN ); + + // VZ: Robert's code for I-shaped caret - this is nice but doesn't look + // at all the same as the MSW version and I don't know how to indicate + // that the window has focus or not with such caret +#if 0 dc->DrawLine( m_x, m_y, m_x+m_width, m_y ); dc->DrawLine( m_x, m_y+m_height, m_x+m_width, m_y+m_height ); dc->DrawLine( m_x+(m_width/2), m_y, m_x+(m_width/2), m_y+m_height ); // dc->DrawLine( m_x+(m_width/2)+1, m_y, m_x+(m_width/2)+1, m_y+m_height ); +#else // 1 + if ( m_hasFocus ) + dc->SetBrush( *wxBLACK_BRUSH ); + dc->DrawRectangle( m_x, m_y, m_width, m_height ); +#endif // 0/1 } diff --git a/src/generic/colrdlgg.cpp b/src/generic/colrdlgg.cpp index 4049e421fe..4cc5493335 100644 --- a/src/generic/colrdlgg.cpp +++ b/src/generic/colrdlgg.cpp @@ -121,8 +121,8 @@ wxGenericColourDialog::wxGenericColourDialog() colourSelection = 0; } -wxGenericColourDialog::wxGenericColourDialog(wxWindow *parent, wxColourData *data): - wxDialog(parent, -1, wxT("Colour"), wxPoint(0, 0), wxSize(900, 900), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL) +wxGenericColourDialog::wxGenericColourDialog(wxWindow *parent, + wxColourData *data) { whichKind = 1; colourSelection = 0; @@ -140,16 +140,21 @@ void wxGenericColourDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) bool wxGenericColourDialog::Create(wxWindow *parent, wxColourData *data) { - dialogParent = parent; + if ( !wxDialog::Create(parent, -1, wxT("Colour"), + wxPoint(0, 0), wxSize(900, 900), + wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL) ) + return FALSE; - if (data) - colourData = *data; + dialogParent = parent; - InitializeColours(); - CalculateMeasurements(); - CreateWidgets(); + if (data) + colourData = *data; - return TRUE; + InitializeColours(); + CalculateMeasurements(); + CreateWidgets(); + + return TRUE; } int wxGenericColourDialog::ShowModal() diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 96b05d4f7c..6b5c65a0e7 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -1005,7 +1005,10 @@ void wxPostScriptDC::SetFont( const wxFont& font ) fprintf( m_pstream, buffer ); fprintf( m_pstream, " findfont\n" ); - fprintf( m_pstream, "%f scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize() * 1000) / 1000.0F); + sprintf( buffer, "%f scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize() * 1000) / 1000.0F); + for (int i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf( m_pstream, buffer ); // this is a hack - we must scale font size (in pts) according to m_scaleY but // YLOG2DEVREL works with wxCoord type (int or longint). Se we first convert font size // to 1/1000th of pt and then back. @@ -1021,11 +1024,18 @@ void wxPostScriptDC::SetPen( const wxPen& pen ) m_pen = pen; - #ifdef __WXMSW__ - fprintf( m_pstream, "%d setlinewidth\n", XLOG2DEVREL(m_pen.GetWidth()) ); - #else - fprintf( m_pstream, "%d setlinewidth\n", XLOG2DEVREL(m_pen.GetWidth()) ); - #endif + { + char buffer[100]; + #ifdef __WXMSW__ + sprintf( buffer, "%f setlinewidth\n", XLOG2DEVREL(1000 * m_pen.GetWidth()) / 1000.0f ); + #else + sprintf( buffer, "%f setlinewidth\n", XLOG2DEVREL(1000 * m_pen.GetWidth()) / 1000.0f ); + #endif + for (int i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf( m_pstream, buffer ); + } + /* Line style - WRONG: 2nd arg is OFFSET @@ -1085,10 +1095,14 @@ void wxPostScriptDC::SetPen( const wxPen& pen ) double redPS = (double)(red) / 255.0; double bluePS = (double)(blue) / 255.0; double greenPS = (double)(green) / 255.0; - - fprintf( m_pstream, + + char buffer[100]; + sprintf( buffer, "%.8f %.8f %.8f setrgbcolor\n", redPS, greenPS, bluePS ); + for (int i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf( m_pstream, buffer ); m_currentRed = red; m_currentBlue = blue; @@ -1129,9 +1143,13 @@ void wxPostScriptDC::SetBrush( const wxBrush& brush ) double bluePS = (double)(blue) / 255.0; double greenPS = (double)(green) / 255.0; - fprintf( m_pstream, + char buffer[100]; + sprintf( buffer, "%.8f %.8f %.8f setrgbcolor\n", redPS, greenPS, bluePS ); + for (int i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf( m_pstream, buffer ); m_currentRed = red; m_currentBlue = blue; @@ -1175,9 +1193,13 @@ void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y ) double bluePS = (double)(blue) / 255.0; double greenPS = (double)(green) / 255.0; - fprintf( m_pstream, - "%.8f %.8f %.8f setrgbcolor\n", - redPS, greenPS, bluePS ); + char buffer[100]; + sprintf( buffer, + "%.8f %.8f %.8f setrgbcolor\n", + redPS, greenPS, bluePS ); + for (int i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf( m_pstream, buffer ); m_currentRed = red; m_currentBlue = blue; @@ -1228,17 +1250,21 @@ void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y ) if (m_font.GetUnderlined()) { wxCoord uy = (wxCoord)(y + size - m_underlinePosition); + char buffer[100]; - fprintf( m_pstream, + sprintf( buffer, "gsave\n" "%d %d moveto\n" - "%d setlinewidth\n" + "%f setlinewidth\n" "%d %d lineto\n" "stroke\n" "grestore\n", XLOG2DEV(x), YLOG2DEV(uy), - (wxCoord)m_underlineThickness, + m_underlineThickness, XLOG2DEV(x + text_w), YLOG2DEV(uy) ); + for (i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf( m_pstream, buffer ); } CalcBoundingBox( x, y ); @@ -1283,9 +1309,13 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord double bluePS = (double)(blue) / 255.0; double greenPS = (double)(green) / 255.0; - fprintf( m_pstream, - "%.8f %.8f %.8f setrgbcolor\n", - redPS, greenPS, bluePS ); + char buffer[100]; + sprintf( buffer, + "%.8f %.8f %.8f setrgbcolor\n", + redPS, greenPS, bluePS ); + for (int i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf( m_pstream, buffer ); m_currentRed = red; m_currentBlue = blue; @@ -1300,7 +1330,13 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord // FIXME only correct for 90 degrees fprintf(m_pstream, "%d %d moveto\n", XLOG2DEV((wxCoord)(x + size)), YLOG2DEV(by) ); - fprintf(m_pstream, "%.8f rotate\n", angle); + + char buffer[100]; + sprintf(buffer, "%.8f rotate\n", angle); + int i; + for (i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf(m_pstream, buffer); /* I don't know how to write char to a stream, so I use a mini string */ char tmpbuf[2]; @@ -1309,7 +1345,6 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord fprintf( m_pstream, "(" ); const wxWX2MBbuf textbuf = text.mb_str(); int len = strlen(textbuf); - int i; for (i = 0; i < len; i++) { int c = (unsigned char) textbuf[i]; @@ -1333,24 +1368,32 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord } fprintf( m_pstream, ") show\n" ); - fprintf( m_pstream, "%.8f rotate\n", -angle ); + + sprintf( buffer, "%.8f rotate\n", -angle ); + for (i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf( m_pstream, buffer ); if (m_font.GetUnderlined()) { wxCoord uy = (wxCoord)(y + size - m_underlinePosition); wxCoord w, h; + char buffer[100]; GetTextExtent(text, &w, &h); - fprintf( m_pstream, + sprintf( buffer, "gsave\n" "%d %d moveto\n" - "%ld setlinewidth\n" + "%f setlinewidth\n" "%d %d lineto\n" "stroke\n" "grestore\n", XLOG2DEV(x), YLOG2DEV(uy), - (long)m_underlineThickness, + m_underlineThickness, XLOG2DEV(x + w), YLOG2DEV(uy) ); + for (i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf( m_pstream, buffer ); } CalcBoundingBox( x, y ); @@ -1538,7 +1581,7 @@ bool wxPostScriptDC::StartDoc( const wxString& message ) if (!m_pstream) { - wxMessageBox( _("Cannot open file for PostScript printing!"), _("Error"), wxOK ); + wxLogError( _("Cannot open file for PostScript printing!")); m_ok = FALSE; return FALSE; } @@ -1755,7 +1798,12 @@ void wxPostScriptDC::StartPage() // fprintf( m_pstream, "90 rotate llx neg ury nef translate\n" ); } - fprintf( m_pstream, "%.8f %.8f scale\n", scale_x, scale_y ); + char buffer[100]; + sprintf( buffer, "%.8f %.8f scale\n", scale_x, scale_y ); + for (int i = 0; i < 100; i++) + if (buffer[i] == ',') buffer[i] = '.'; + fprintf( m_pstream, buffer ); + fprintf( m_pstream, "%d %d translate\n", translate_x, translate_y ); } @@ -2071,18 +2119,19 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, lastWidths[220] = lastWidths['U']; // Ü lastWidths[252] = lastWidths['u']; // ü lastWidths[223] = lastWidths[251]; // ß - } - /* JC: calculate UnderlineThickness/UnderlinePosition */ - { + /* JC: calculate UnderlineThickness/UnderlinePosition */ + // VS: dirty, but is there any better solution? double *pt; pt = (double*) &m_underlinePosition; - *pt = UnderlinePosition * fontToUse->GetPointSize() / 1000.0f; + *pt = YLOG2DEVREL(UnderlinePosition * fontToUse->GetPointSize()) / 1000.0f; pt = (double*) &m_underlineThickness; - *pt = UnderlineThickness * fontToUse->GetPointSize() / 1000.0f * m_scaleFactor; + *pt = YLOG2DEVREL(UnderlineThickness * fontToUse->GetPointSize()) / 1000.0f; + } + /* 3. now the font metrics are read in, calc size this / is done by adding the widths of the characters in the / string. they are given in 1/1000 of the size! */ diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp index ba118204be..a2c34d054d 100644 --- a/src/generic/dirdlgg.cpp +++ b/src/generic/dirdlgg.cpp @@ -38,6 +38,7 @@ #include "wx/icon.h" #include "wx/log.h" #include "wx/sizer.h" +#include "wx/tokenzr.h" #if wxUSE_STATLINE #include "wx/statline.h" @@ -170,18 +171,21 @@ wxDirCtrl::wxDirCtrl(void) m_showHidden = FALSE; } -wxDirCtrl::wxDirCtrl(wxWindow *parent, const wxWindowID id, const wxString &WXUNUSED(dir), - const wxPoint& pos, const wxSize& size, - const long style, const wxString& name ) - : - wxTreeCtrl( parent, id, pos, size, style, wxDefaultValidator, name ) +wxDirCtrl::wxDirCtrl(wxWindow *parent, + const wxWindowID id, + const wxString &WXUNUSED(dir), + const wxPoint& pos, + const wxSize& size, + const long style, + const wxString& name ) + : wxTreeCtrl( parent, id, pos, size, style, wxDefaultValidator, name ) { - #ifndef __WXMSW__ +#ifndef __WXMSW__ m_imageListNormal = new wxImageList(16, 16, TRUE); m_imageListNormal->Add(wxICON(icon1)); m_imageListNormal->Add(wxICON(icon2)); SetImageList(m_imageListNormal); - #endif +#endif // !MSW m_showHidden = FALSE; m_rootId = AddRoot( _("Sections") ); @@ -207,8 +211,8 @@ void wxDirCtrl::SetupSections() wxGetHomeDir(&home); ADD_SECTION(home, _("My Home") ) ADD_SECTION(wxT("/mnt"), _("Mounted Devices") ) - ADD_SECTION(wxT("/usr"), _("User") ) ADD_SECTION(wxT("/usr/local"), _("User Local") ) + ADD_SECTION(wxT("/usr"), _("User") ) ADD_SECTION(wxT("/var"), _("Variables") ) ADD_SECTION(wxT("/etc"), _("Etcetera") ) ADD_SECTION(wxT("/tmp"), _("Temporary") ) @@ -223,14 +227,15 @@ void wxDirCtrl::CreateItems(const wxTreeItemId &parent) // wxASSERT(m_paths.Count() == m_names.Count()); ? - for (unsigned int i=0; i<m_paths.Count(); i++) + size_t count = m_paths.GetCount(); + for ( size_t i=0; i<count; i++) { dir_item = new wxDirItemData(m_paths[i],m_names[i]); #ifdef __WXMSW__ id = AppendItem( parent, m_names[i], -1, -1, dir_item); #else id = AppendItem( parent, m_names[i], 0, -1, dir_item); - SetItemImage( id, 1, wxTreeItemIcon_Expanded ); + SetItemImage( id, 1, wxTreeItemIcon_Expanded ); #endif if (dir_item->m_hasSubDirs) SetItemHasChildren(id); } @@ -258,12 +263,12 @@ void wxDirCtrl::OnEndEditItem(wxTreeEvent &event) if ((event.GetLabel().IsEmpty()) || (event.GetLabel() == _(".")) || (event.GetLabel() == _("..")) || - (event.GetLabel().First( wxT("/") ) != wxNOT_FOUND)) + (event.GetLabel().First( wxT("/") ) != wxNOT_FOUND)) { wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); + dialog.ShowModal(); event.Veto(); - return; + return; } wxTreeItemId id = event.GetItem(); @@ -279,7 +284,7 @@ void wxDirCtrl::OnEndEditItem(wxTreeEvent &event) if (wxFileExists(new_name)) { wxMessageDialog dialog(this, _("File name exists already."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); + dialog.ShowModal(); event.Veto(); } @@ -290,7 +295,7 @@ void wxDirCtrl::OnEndEditItem(wxTreeEvent &event) else { wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); + dialog.ShowModal(); event.Veto(); } } @@ -373,11 +378,13 @@ BEGIN_EVENT_TABLE( wxDirDialog, wxDialog ) // EVT_CHECKBOX (ID_CHECK, wxDirDialog::OnCheck) END_EVENT_TABLE() -wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, - const wxString& defaultPath, long style, - const wxPoint& pos) : - wxDialog(parent, -1, message, pos, wxSize(300,300), - wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) +wxDirDialog::wxDirDialog(wxWindow *parent, + const wxString& message, + const wxString& defaultPath, + long style, + const wxPoint& pos) + : wxDialog(parent, -1, message, pos, wxSize(300,300), + wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { m_message = message; m_dialogStyle = style; @@ -390,8 +397,12 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); // 1) dir ctrl - m_dir = new wxDirCtrl( this, ID_DIRCTRL, "/", wxDefaultPosition, wxSize(200,200), - wxTR_HAS_BUTTONS | wxSUNKEN_BORDER | wxTR_EDIT_LABELS); + m_dir = new wxDirCtrl( this, ID_DIRCTRL, "/", + wxDefaultPosition, + wxSize(200,200), + wxTR_HAS_BUTTONS | + wxSUNKEN_BORDER | + wxTR_EDIT_LABELS ); topsizer->Add( m_dir, 1, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, 10 ); // 2) text ctrl @@ -428,6 +439,66 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, Centre( wxBOTH ); + if (m_path == wxT("~")) + wxGetHomeDir( &m_path ); + + // choose the directory corresponding to defaultPath in the tree + // VZ: using wxStringTokenizer is probably unsafe here (escaped slashes + // will not be processed correctly...) + wxStringTokenizer tk(m_path, wxFILE_SEP_PATH, wxTOKEN_STRTOK); + + wxString path; + + long cookie = 0; + // default to root dir + wxTreeItemId item = m_dir->GetFirstChild(m_dir->GetRootItem(), cookie); + + if (!m_path.IsEmpty() && (m_path != wxT("/")) && (m_dir->m_paths.Count() > 1)) + { + size_t count = m_dir->m_paths.GetCount(); + for ( size_t i=1; i<count; i++) + { + if (m_path.Find( m_dir->m_paths[i] ) == 0) + { + path = m_dir->m_paths[i]; + + for (size_t j = 0; j < i; j++) + item = m_dir->GetNextChild(m_dir->GetRootItem(), cookie); + + wxStringTokenizer tk2(path, wxFILE_SEP_PATH, wxTOKEN_STRTOK); + for (size_t h = 0; h < tk2.CountTokens(); h++) + tk.GetNextToken(); + + break; + } + } + } + while ( tk.HasMoreTokens() && item.IsOk() ) + { + path << wxFILE_SEP_PATH << tk.GetNextToken(); + + m_dir->Expand(item); + + wxTreeItemId child = m_dir->GetFirstChild(item, cookie); + while ( child.IsOk() ) + { + wxDirItemData *data = (wxDirItemData*)m_dir->GetItemData(child); + if ( data->m_path == path ) + break; + + child = m_dir->GetNextChild(item, cookie); + } + + item = child; + } + + if ( item.IsOk() ) + { + m_dir->Expand(item); + m_dir->SelectItem(item); + m_dir->EnsureVisible(item); + } + wxEndBusyCursor(); } @@ -514,24 +585,24 @@ void wxDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) ) { // try NewName0, NewName1 etc. int i = 0; - do { + do { new_name = wxT("NewName"); - wxString num; - num.Printf( wxT("%d"), i ); - new_name += num; + wxString num; + num.Printf( wxT("%d"), i ); + new_name += num; path = data->m_path; path += wxT("/"); path += new_name; - i++; - } while (wxFileExists(path)); + i++; + } while (wxFileExists(path)); } wxLogNull log; if (!wxMkdir(path)) { wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR ); - dialog.ShowModal(); + dialog.ShowModal(); return; } @@ -548,4 +619,4 @@ void wxDirDialog::OnCheck( wxCommandEvent& WXUNUSED(event) ) } */ -#endif +#endif // wxUSE_DIRDLG diff --git a/src/generic/dragimgg.cpp b/src/generic/dragimgg.cpp index dc79dc7d74..37071c5a03 100644 --- a/src/generic/dragimgg.cpp +++ b/src/generic/dragimgg.cpp @@ -68,11 +68,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxGenericDragImage, wxObject) // wxGenericDragImage ctors/dtor // ---------------------------------------------------------------------------- -wxGenericDragImage::wxGenericDragImage() -{ - Init(); -} - wxGenericDragImage::~wxGenericDragImage() { if (m_windowDC) @@ -88,6 +83,7 @@ void wxGenericDragImage::Init() m_windowDC = (wxDC*) NULL; m_window = (wxWindow*) NULL; m_fullScreen = FALSE; + m_pBackingBitmap = (wxBitmap*) NULL; } // Attributes @@ -97,6 +93,15 @@ void wxGenericDragImage::Init() // Operations //////////////////////////////////////////////////////////////////////////// +// Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect) +bool wxGenericDragImage::Create(const wxCursor& cursor, const wxPoint& hotspot) +{ + m_cursor = cursor; + m_hotspot = hotspot; + + return TRUE; +} + // Create a drag image from a bitmap and optional cursor bool wxGenericDragImage::Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& hotspot) { @@ -183,13 +188,15 @@ bool wxGenericDragImage::Create(const wxListCtrl& listCtrl, long id) } // Begin drag -bool wxGenericDragImage::BeginDrag(const wxPoint& WXUNUSED(hotspot), +bool wxGenericDragImage::BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen, wxRect* rect) { wxASSERT_MSG( (window != 0), wxT("Window must not be null in BeginDrag.")); + // The image should be offset by this amount + m_offset = hotspot; m_window = window; m_fullScreen = fullScreen; @@ -238,8 +245,10 @@ bool wxGenericDragImage::BeginDrag(const wxPoint& WXUNUSED(hotspot), } } - if (!m_backingBitmap.Ok() || (m_backingBitmap.GetWidth() < clientSize.x || m_backingBitmap.GetHeight() < clientSize.y)) - m_backingBitmap = wxBitmap(clientSize.x, clientSize.y); + wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap); + + if (!backing->Ok() || (backing->GetWidth() < clientSize.x || backing->GetHeight() < clientSize.y)) + (*backing) = wxBitmap(clientSize.x, clientSize.y); if (!m_fullScreen) m_windowDC = new wxClientDC(window); @@ -308,7 +317,7 @@ bool wxGenericDragImage::EndDrag() // is non-NULL, or in screen coordinates if NULL. bool wxGenericDragImage::Move(const wxPoint& pt) { - wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), "No window DC in wxGenericDragImage::Move()" ); + wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Move()") ); // Erase at old position, then show at the current position wxPoint oldPos = m_position; @@ -316,7 +325,7 @@ bool wxGenericDragImage::Move(const wxPoint& pt) bool eraseOldImage = (m_isDirty && m_isShown); if (m_isShown) - RedrawImage(oldPos, pt, eraseOldImage, TRUE); + RedrawImage(oldPos - m_offset, pt - m_offset, eraseOldImage, TRUE); m_position = pt; @@ -328,7 +337,7 @@ bool wxGenericDragImage::Move(const wxPoint& pt) bool wxGenericDragImage::Show() { - wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), "No window DC in wxGenericDragImage::Show()" ); + wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Show()") ); // Show at the current position @@ -337,12 +346,16 @@ bool wxGenericDragImage::Show() // This is where we restore the backing bitmap, in case // something has changed on the window. + wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap); wxMemoryDC memDC; - memDC.SelectObject(m_backingBitmap); - memDC.Blit(0, 0, m_boundingRect.width, m_boundingRect.height, m_windowDC, m_boundingRect.x, m_boundingRect.y); + memDC.SelectObject(* backing); + + UpdateBackingFromWindow(* m_windowDC, memDC, m_boundingRect, wxRect(0, 0, m_boundingRect.width, m_boundingRect.height)); + + //memDC.Blit(0, 0, m_boundingRect.width, m_boundingRect.height, m_windowDC, m_boundingRect.x, m_boundingRect.y); memDC.SelectObject(wxNullBitmap); - RedrawImage(m_position, m_position, FALSE, TRUE); + RedrawImage(m_position - m_offset, m_position - m_offset, FALSE, TRUE); } m_isShown = TRUE; @@ -351,15 +364,21 @@ bool wxGenericDragImage::Show() return TRUE; } +bool wxGenericDragImage::UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC, + const wxRect& sourceRect, const wxRect& destRect) const +{ + return destDC.Blit(destRect.x, destRect.y, destRect.width, destRect.height, & windowDC, sourceRect.x, sourceRect.y); +} + bool wxGenericDragImage::Hide() { - wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), "No window DC in wxGenericDragImage::Hide()" ); + wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Hide()") ); // Repair the old position if (m_isShown && m_isDirty) { - RedrawImage(m_position, m_position, TRUE, FALSE); + RedrawImage(m_position - m_offset, m_position - m_offset, TRUE, FALSE); } m_isShown = FALSE; @@ -375,7 +394,8 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, const wxPoint& newPo if (!m_windowDC) return FALSE; - if (!m_backingBitmap.Ok()) + wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap); + if (!backing->Ok()) return FALSE; wxRect oldRect(GetImageRect(oldPos)); @@ -413,7 +433,7 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, const wxPoint& newPo } wxMemoryDC memDC; - memDC.SelectObject(m_backingBitmap); + memDC.SelectObject(* backing); wxMemoryDC memDCTemp; memDCTemp.SelectObject(m_repairBitmap); @@ -429,12 +449,8 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, const wxPoint& newPo // If drawing, draw the image onto the mem DC if (drawNew) { - int x = newPos.x - fullRect.x; - int y = newPos.y - fullRect.y; - if (m_bitmap.Ok()) - memDCTemp.DrawBitmap(m_bitmap, x, y, (m_bitmap.GetMask() != 0)); - else if (m_icon.Ok()) - memDCTemp.DrawIcon(m_icon, x, y); + wxPoint pos(newPos.x - fullRect.x, newPos.y - fullRect.y) ; + DoDrawImage(memDCTemp, pos); } // Now blit to the window @@ -447,6 +463,24 @@ bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, const wxPoint& newPo return TRUE; } +// Override this if you are using a virtual image (drawing your own image) +bool wxGenericDragImage::DoDrawImage(wxDC& dc, const wxPoint& pos) const +{ + if (m_bitmap.Ok()) + { + dc.DrawBitmap(m_bitmap, pos.x, pos.y, (m_bitmap.GetMask() != 0)); + return TRUE; + } + else if (m_icon.Ok()) + { + dc.DrawIcon(m_icon, pos.x, pos.y); + return TRUE; + } + else + return FALSE; +} + +// Override this if you are using a virtual image (drawing your own image) wxRect wxGenericDragImage::GetImageRect(const wxPoint& pos) const { if (m_bitmap.Ok()) diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index ed7c974c9b..bc72174e98 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -557,7 +557,7 @@ void wxFileCtrl::Update() res = wxFileNameFromPath( f ); fd = new wxFileData( res, f ); wxString s = fd->GetName(); - if (m_showHidden || (s[0] != wxT('.'))) + if (m_showHidden || (s[0u] != wxT('.'))) { Add( fd, item ); item.m_itemId++; @@ -572,7 +572,7 @@ void wxFileCtrl::Update() res = wxFileNameFromPath( f ); fd = new wxFileData( res, f ); wxString s = fd->GetName(); - if (m_showHidden || (s[0] != wxT('.'))) + if (m_showHidden || (s[0u] != wxT('.'))) { Add( fd, item ); item.m_itemId++; @@ -582,9 +582,12 @@ void wxFileCtrl::Update() SortItems( ListCompare, 0 ); - SetColumnWidth( 1, wxLIST_AUTOSIZE ); - SetColumnWidth( 2, wxLIST_AUTOSIZE ); - SetColumnWidth( 3, wxLIST_AUTOSIZE ); + if (my_style & wxLC_REPORT) + { + SetColumnWidth( 1, wxLIST_AUTOSIZE ); + SetColumnWidth( 2, wxLIST_AUTOSIZE ); + SetColumnWidth( 3, wxLIST_AUTOSIZE ); + } } void wxFileCtrl::SetWild( const wxString &wild ) @@ -1023,7 +1026,7 @@ void wxFileDialog::HandleAction( const wxString &fn ) return; } - if (filename[0] == wxT('~')) + if (filename[0u] == wxT('~')) { filename.Remove( 0, 1 ); wxString tmp( wxGetUserHome() ); @@ -1045,7 +1048,7 @@ void wxFileDialog::HandleAction( const wxString &fn ) } if (dir != wxT("/")) dir += wxT("/"); - if (filename[0] != wxT('/')) + if (filename[0u] != wxT('/')) { dir += filename; filename = dir; diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 2a8075f226..1b31ef10db 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -21,7 +21,7 @@ #pragma implementation "grid.h" #endif -// For compilers that support precompilation, includes "wx/wx.h". +// For compilers that support precompilatixon, includes "wx/wx.h". #include "wx/wxprec.h" #include "wx/defs.h" @@ -71,7 +71,7 @@ // array classes // ---------------------------------------------------------------------------- -WX_DEFINE_ARRAY(wxGridCellAttr *, wxArrayAttrs); +WX_DEFINE_EXPORTED_ARRAY(wxGridCellAttr *, wxArrayAttrs); struct wxGridCellWithAttr { @@ -89,7 +89,7 @@ struct wxGridCellWithAttr wxGridCellAttr *attr; }; -WX_DECLARE_OBJARRAY(wxGridCellWithAttr, wxGridCellWithAttrArray); +WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellWithAttr, wxGridCellWithAttrArray); #include "wx/arrimpl.cpp" @@ -113,6 +113,7 @@ private: void OnPaint( wxPaintEvent& event ); void OnMouseEvent( wxMouseEvent& event ); void OnKeyDown( wxKeyEvent& event ); + void OnKeyUp( wxKeyEvent& ); DECLARE_DYNAMIC_CLASS(wxGridRowLabelWindow) DECLARE_EVENT_TABLE() @@ -132,6 +133,7 @@ private: void OnPaint( wxPaintEvent &event ); void OnMouseEvent( wxMouseEvent& event ); void OnKeyDown( wxKeyEvent& event ); + void OnKeyUp( wxKeyEvent& ); DECLARE_DYNAMIC_CLASS(wxGridColLabelWindow) DECLARE_EVENT_TABLE() @@ -150,6 +152,7 @@ private: void OnMouseEvent( wxMouseEvent& event ); void OnKeyDown( wxKeyEvent& event ); + void OnKeyUp( wxKeyEvent& ); void OnPaint( wxPaintEvent& event ); DECLARE_DYNAMIC_CLASS(wxGridCornerLabelWindow) @@ -182,6 +185,7 @@ private: void OnPaint( wxPaintEvent &event ); void OnMouseEvent( wxMouseEvent& event ); void OnKeyDown( wxKeyEvent& ); + void OnKeyUp( wxKeyEvent& ); void OnEraseBackground( wxEraseEvent& ); @@ -292,7 +296,7 @@ struct wxGridDataTypeInfo }; -WX_DEFINE_ARRAY(wxGridDataTypeInfo*, wxGridDataTypeInfoArray); +WX_DEFINE_EXPORTED_ARRAY(wxGridDataTypeInfo*, wxGridDataTypeInfoArray); class WXDLLEXPORT wxGridTypeRegistry @@ -467,6 +471,11 @@ void wxGridCellEditor::HandleReturn(wxKeyEvent& event) event.Skip(); } +bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event) +{ + // accept the simple key presses, not anything with Ctrl/Alt/Meta + return !event.HasModifiers(); +} void wxGridCellEditor::StartingKey(wxKeyEvent& event) { @@ -493,7 +502,7 @@ void wxGridCellTextEditor::Create(wxWindow* parent, m_control = new wxTextCtrl(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize #if defined(__WXMSW__) - , wxTE_MULTILINE | wxTE_NO_VSCROLL // necessary ??? + , wxTE_MULTILINE | wxTE_NO_VSCROLL | wxTE_AUTO_SCROLL #endif ); @@ -595,28 +604,117 @@ void wxGridCellTextEditor::DoReset(const wxString& startValue) Text()->SetInsertionPointEnd(); } +bool wxGridCellTextEditor::IsAcceptedKey(wxKeyEvent& event) +{ + if ( wxGridCellEditor::IsAcceptedKey(event) ) + { + int keycode = event.GetKeyCode(); + switch ( keycode ) + { + case WXK_NUMPAD0: + case WXK_NUMPAD1: + case WXK_NUMPAD2: + case WXK_NUMPAD3: + case WXK_NUMPAD4: + case WXK_NUMPAD5: + case WXK_NUMPAD6: + case WXK_NUMPAD7: + case WXK_NUMPAD8: + case WXK_NUMPAD9: + case WXK_MULTIPLY: + case WXK_NUMPAD_MULTIPLY: + case WXK_ADD: + case WXK_NUMPAD_ADD: + case WXK_SUBTRACT: + case WXK_NUMPAD_SUBTRACT: + case WXK_DECIMAL: + case WXK_NUMPAD_DECIMAL: + case WXK_DIVIDE: + case WXK_NUMPAD_DIVIDE: + return TRUE; + + default: + // accept 8 bit chars too if isprint() agrees + if ( (keycode < 255) && (isprint(keycode)) ) + return TRUE; + } + } + + return FALSE; +} + void wxGridCellTextEditor::StartingKey(wxKeyEvent& event) { - if ( !event.AltDown() && !event.MetaDown() && !event.ControlDown() ) - { - // insert the key in the control - int keycode = (int)event.KeyCode(); - if ( isprint(keycode) ) - { - // FIXME this is not going to work for non letters... - if ( !event.ShiftDown() ) - { - keycode = tolower(keycode); - } + // we don't check for !HasModifiers() because IsAcceptedKey() did it + + // insert the key in the control + wxChar ch; + int keycode = event.GetKeyCode(); + switch ( keycode ) + { + case WXK_NUMPAD0: + case WXK_NUMPAD1: + case WXK_NUMPAD2: + case WXK_NUMPAD3: + case WXK_NUMPAD4: + case WXK_NUMPAD5: + case WXK_NUMPAD6: + case WXK_NUMPAD7: + case WXK_NUMPAD8: + case WXK_NUMPAD9: + ch = _T('0') + keycode - WXK_NUMPAD0; + break; - Text()->AppendText((wxChar)keycode); + case WXK_MULTIPLY: + case WXK_NUMPAD_MULTIPLY: + ch = _T('*'); + break; - return; - } + case WXK_ADD: + case WXK_NUMPAD_ADD: + ch = _T('+'); + break; + case WXK_SUBTRACT: + case WXK_NUMPAD_SUBTRACT: + ch = _T('-'); + break; + + case WXK_DECIMAL: + case WXK_NUMPAD_DECIMAL: + ch = _T('.'); + break; + + case WXK_DIVIDE: + case WXK_NUMPAD_DIVIDE: + ch = _T('/'); + break; + + default: + if ( keycode < 256 && keycode >= 0 && isprint(keycode) ) + { + // FIXME this is not going to work for non letters... + if ( !event.ShiftDown() ) + { + keycode = tolower(keycode); + } + + ch = (wxChar)keycode; + } + else + { + ch = _T('\0'); + } } - event.Skip(); + if ( ch ) + { + Text()->AppendText(ch); + } + else + { + event.Skip(); + } } void wxGridCellTextEditor::HandleReturn( wxKeyEvent& @@ -648,8 +746,7 @@ void wxGridCellTextEditor::SetParameters(const wxString& params) long tmp; if ( !params.ToLong(&tmp) ) { - wxLogDebug(_T("Invalid wxGridCellTextEditor parameter string " - "'%s' ignored"), params.c_str()); + wxLogDebug(_T("Invalid wxGridCellTextEditor parameter string '%s' ignored"), params.c_str()); } else { @@ -714,6 +811,7 @@ void wxGridCellNumberEditor::BeginEdit(int row, int col, wxGrid* grid) if ( HasRange() ) { Spin()->SetValue((int)m_valueOld); + Spin()->SetFocus(); } else { @@ -742,7 +840,7 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col, if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_NUMBER)) grid->GetTable()->SetValueAsLong(row, col, value); else - grid->GetTable()->SetValue(row, col, wxString::Format("%ld", value)); + grid->GetTable()->SetValue(row, col, wxString::Format(wxT("%ld"), value)); } return changed; @@ -760,6 +858,40 @@ void wxGridCellNumberEditor::Reset() } } +bool wxGridCellNumberEditor::IsAcceptedKey(wxKeyEvent& event) +{ + if ( wxGridCellEditor::IsAcceptedKey(event) ) + { + int keycode = event.GetKeyCode(); + switch ( keycode ) + { + case WXK_NUMPAD0: + case WXK_NUMPAD1: + case WXK_NUMPAD2: + case WXK_NUMPAD3: + case WXK_NUMPAD4: + case WXK_NUMPAD5: + case WXK_NUMPAD6: + case WXK_NUMPAD7: + case WXK_NUMPAD8: + case WXK_NUMPAD9: + case WXK_ADD: + case WXK_NUMPAD_ADD: + case WXK_SUBTRACT: + case WXK_NUMPAD_SUBTRACT: + case WXK_UP: + case WXK_DOWN: + return TRUE; + + default: + if ( (keycode < 128) && isdigit(keycode) ) + return TRUE; + } + } + + return FALSE; +} + void wxGridCellNumberEditor::StartingKey(wxKeyEvent& event) { if ( !HasRange() ) @@ -801,8 +933,7 @@ void wxGridCellNumberEditor::SetParameters(const wxString& params) } } - wxLogDebug(_T("Invalid wxGridCellNumberEditor parameter string " - "'%s' ignored"), params.c_str()); + wxLogDebug(_T("Invalid wxGridCellNumberEditor parameter string '%s' ignored"), params.c_str()); } } @@ -810,6 +941,12 @@ void wxGridCellNumberEditor::SetParameters(const wxString& params) // wxGridCellFloatEditor // ---------------------------------------------------------------------------- +wxGridCellFloatEditor::wxGridCellFloatEditor(int width, int precision) +{ + m_width = width; + m_precision = precision; +} + void wxGridCellFloatEditor::Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) @@ -851,7 +988,7 @@ bool wxGridCellFloatEditor::EndEdit(int row, int col, if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_FLOAT)) grid->GetTable()->SetValueAsDouble(row, col, value); else - grid->GetTable()->SetValue(row, col, wxString::Format("%f", value)); + grid->GetTable()->SetValue(row, col, wxString::Format(wxT("%f"), value)); return TRUE; } @@ -881,6 +1018,91 @@ void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event) event.Skip(); } +void wxGridCellFloatEditor::SetParameters(const wxString& params) +{ + if ( !params ) + { + // reset to default + m_width = + m_precision = -1; + } + else + { + long tmp; + if ( params.BeforeFirst(_T(',')).ToLong(&tmp) ) + { + m_width = (int)tmp; + + if ( params.AfterFirst(_T(',')).ToLong(&tmp) ) + { + m_precision = (int)tmp; + + // skip the error message below + return; + } + } + + wxLogDebug(_T("Invalid wxGridCellFloatEditor parameter string '%s' ignored"), params.c_str()); + } +} + +wxString wxGridCellFloatEditor::GetString() const +{ + wxString fmt; + if ( m_width == -1 ) + { + // default width/precision + fmt = _T("%g"); + } + else if ( m_precision == -1 ) + { + // default precision + fmt.Printf(_T("%%%d.g"), m_width); + } + else + { + fmt.Printf(_T("%%%d.%dg"), m_width, m_precision); + } + + return wxString::Format(fmt, m_valueOld); +} + +bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event) +{ + if ( wxGridCellEditor::IsAcceptedKey(event) ) + { + int keycode = event.GetKeyCode(); + switch ( keycode ) + { + case WXK_NUMPAD0: + case WXK_NUMPAD1: + case WXK_NUMPAD2: + case WXK_NUMPAD3: + case WXK_NUMPAD4: + case WXK_NUMPAD5: + case WXK_NUMPAD6: + case WXK_NUMPAD7: + case WXK_NUMPAD8: + case WXK_NUMPAD9: + case WXK_ADD: + case WXK_NUMPAD_ADD: + case WXK_SUBTRACT: + case WXK_NUMPAD_SUBTRACT: + case WXK_DECIMAL: + case WXK_NUMPAD_DECIMAL: + return TRUE; + + default: + // additionally accept 'e' as in '1e+6' + if ( (keycode < 128) && + (isdigit(keycode) || tolower(keycode) == 'e') ) + return TRUE; + } + } + + return FALSE; +} + // ---------------------------------------------------------------------------- // wxGridCellBoolEditor // ---------------------------------------------------------------------------- @@ -999,12 +1221,35 @@ void wxGridCellBoolEditor::StartingClick() CBox()->SetValue(!CBox()->GetValue()); } +bool wxGridCellBoolEditor::IsAcceptedKey(wxKeyEvent& event) +{ + if ( wxGridCellEditor::IsAcceptedKey(event) ) + { + int keycode = event.GetKeyCode(); + switch ( keycode ) + { + case WXK_MULTIPLY: + case WXK_NUMPAD_MULTIPLY: + case WXK_ADD: + case WXK_NUMPAD_ADD: + case WXK_SUBTRACT: + case WXK_NUMPAD_SUBTRACT: + case WXK_SPACE: + case '+': + case '-': + return TRUE; + } + } + + return FALSE; +} + // ---------------------------------------------------------------------------- // wxGridCellChoiceEditor // ---------------------------------------------------------------------------- wxGridCellChoiceEditor::wxGridCellChoiceEditor(size_t count, - const wxChar* choices[], + const wxString choices[], bool allowOthers) : m_allowOthers(allowOthers) { @@ -1236,11 +1481,18 @@ wxSize wxGridCellStringRenderer::DoGetBestSize(wxGridCellAttr& attr, wxDC& dc, const wxString& text) { - wxCoord x, y; + wxCoord x = 0, y = 0, max_x = 0; dc.SetFont(attr.GetFont()); - dc.GetTextExtent(text, &x, &y); + wxStringTokenizer tk(text, _T('\n')); + while ( tk.HasMoreTokens() ) + { + dc.GetTextExtent(tk.GetNextToken(), &x, &y); + max_x = wxMax(max_x, x); + } + + y *= 1 + text.Freq(wxT('\n')); // multiply by the number of lines. - return wxSize(x, y); + return wxSize(max_x, y); } wxSize wxGridCellStringRenderer::GetBestSize(wxGrid& grid, @@ -1460,8 +1712,7 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params) if ( !ok ) { - wxLogDebug(_T("Invalid wxGridCellFloatRenderer parameter string " - "'%s ignored"), params.c_str()); + wxLogDebug(_T("Invalid wxGridCellFloatRenderer parameter string '%s ignored"), params.c_str()); } } } @@ -2247,35 +2498,17 @@ void wxGridTableBase::SetColAttr(wxGridCellAttr *attr, int col) } } -void wxGridTableBase::UpdateAttrRows( size_t pos, int numRows ) -{ - if ( m_attrProvider ) - { - m_attrProvider->UpdateAttrRows( pos, numRows ); - } -} - -void wxGridTableBase::UpdateAttrCols( size_t pos, int numCols ) -{ - if ( m_attrProvider ) - { - m_attrProvider->UpdateAttrCols( pos, numCols ); - } -} - bool wxGridTableBase::InsertRows( size_t WXUNUSED(pos), size_t WXUNUSED(numRows) ) { - wxFAIL_MSG( wxT("Called grid table class function InsertRows\n" - "but your derived table class does not override this function") ); + wxFAIL_MSG( wxT("Called grid table class function InsertRows\nbut your derived table class does not override this function") ); return FALSE; } bool wxGridTableBase::AppendRows( size_t WXUNUSED(numRows) ) { - wxFAIL_MSG( wxT("Called grid table class function AppendRows\n" - "but your derived table class does not override this function")); + wxFAIL_MSG( wxT("Called grid table class function AppendRows\nbut your derived table class does not override this function")); return FALSE; } @@ -2283,8 +2516,7 @@ bool wxGridTableBase::AppendRows( size_t WXUNUSED(numRows) ) bool wxGridTableBase::DeleteRows( size_t WXUNUSED(pos), size_t WXUNUSED(numRows) ) { - wxFAIL_MSG( wxT("Called grid table class function DeleteRows\n" - "but your derived table class does not override this function")); + wxFAIL_MSG( wxT("Called grid table class function DeleteRows\nbut your derived table class does not override this function")); return FALSE; } @@ -2292,16 +2524,14 @@ bool wxGridTableBase::DeleteRows( size_t WXUNUSED(pos), bool wxGridTableBase::InsertCols( size_t WXUNUSED(pos), size_t WXUNUSED(numCols) ) { - wxFAIL_MSG( wxT("Called grid table class function InsertCols\n" - "but your derived table class does not override this function")); + wxFAIL_MSG( wxT("Called grid table class function InsertCols\nbut your derived table class does not override this function")); return FALSE; } bool wxGridTableBase::AppendCols( size_t WXUNUSED(numCols) ) { - wxFAIL_MSG(wxT("Called grid table class function AppendCols\n" - "but your derived table class does not override this function")); + wxFAIL_MSG(wxT("Called grid table class function AppendCols\nbut your derived table class does not override this function")); return FALSE; } @@ -2309,8 +2539,7 @@ bool wxGridTableBase::AppendCols( size_t WXUNUSED(numCols) ) bool wxGridTableBase::DeleteCols( size_t WXUNUSED(pos), size_t WXUNUSED(numCols) ) { - wxFAIL_MSG( wxT("Called grid table class function DeleteCols\n" - "but your derived table class does not override this function")); + wxFAIL_MSG( wxT("Called grid table class function DeleteCols\nbut your derived table class does not override this function")); return FALSE; } @@ -2537,7 +2766,8 @@ bool wxGridStringTable::InsertRows( size_t pos, size_t numRows ) size_t row, col; size_t curNumRows = m_data.GetCount(); - size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : 0 ); + size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : + ( GetView() ? GetView()->GetNumberCols() : 0 ) ); if ( pos >= curNumRows ) { @@ -2555,7 +2785,6 @@ bool wxGridStringTable::InsertRows( size_t pos, size_t numRows ) { m_data.Insert( sa, row ); } - UpdateAttrRows( pos, numRows ); if ( GetView() ) { wxGridTableMessage msg( this, @@ -2574,7 +2803,8 @@ bool wxGridStringTable::AppendRows( size_t numRows ) size_t row, col; size_t curNumRows = m_data.GetCount(); - size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : 0 ); + size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : + ( GetView() ? GetView()->GetNumberCols() : 0 ) ); wxArrayString sa; if ( curNumCols > 0 ) @@ -2612,10 +2842,9 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows ) if ( pos >= curNumRows ) { wxString errmsg; - errmsg.Printf("Called wxGridStringTable::DeleteRows(pos=%d, N=%d)\n" - "Pos value is invalid for present table with %d rows", + errmsg.Printf(wxT("Called wxGridStringTable::DeleteRows(pos=%d, N=%d)\nPos value is invalid for present table with %d rows"), pos, numRows, curNumRows ); - wxFAIL_MSG( wxT(errmsg) ); + wxFAIL_MSG( errmsg ); return FALSE; } @@ -2635,7 +2864,6 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows ) m_data.Remove( pos ); } } - UpdateAttrRows( pos, -((int)numRows) ); if ( GetView() ) { wxGridTableMessage msg( this, @@ -2654,7 +2882,8 @@ bool wxGridStringTable::InsertCols( size_t pos, size_t numCols ) size_t row, col; size_t curNumRows = m_data.GetCount(); - size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : 0 ); + size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : + ( GetView() ? GetView()->GetNumberCols() : 0 ) ); if ( pos >= curNumCols ) { @@ -2668,7 +2897,6 @@ bool wxGridStringTable::InsertCols( size_t pos, size_t numCols ) m_data[row].Insert( wxEmptyString, col ); } } - UpdateAttrCols( pos, numCols ); if ( GetView() ) { wxGridTableMessage msg( this, @@ -2687,14 +2915,15 @@ bool wxGridStringTable::AppendCols( size_t numCols ) size_t row, n; size_t curNumRows = m_data.GetCount(); +#if 0 if ( !curNumRows ) { // TODO: something better than this ? // - wxFAIL_MSG( wxT("Unable to append cols to a grid table with no rows.\n" - "Call AppendRows() first") ); + wxFAIL_MSG( wxT("Unable to append cols to a grid table with no rows.\nCall AppendRows() first") ); return FALSE; } +#endif for ( row = 0; row < curNumRows; row++ ) { @@ -2721,15 +2950,15 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) size_t row, n; size_t curNumRows = m_data.GetCount(); - size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : 0 ); + size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : + ( GetView() ? GetView()->GetNumberCols() : 0 ) ); if ( pos >= curNumCols ) { wxString errmsg; - errmsg.Printf( "Called wxGridStringTable::DeleteCols(pos=%d, N=%d)...\n" - "Pos value is invalid for present table with %d cols", + errmsg.Printf( wxT("Called wxGridStringTable::DeleteCols(pos=%d, N=%d)...\nPos value is invalid for present table with %d cols"), pos, numCols, curNumCols ); - wxFAIL_MSG( wxT( errmsg ) ); + wxFAIL_MSG( errmsg ); return FALSE; } @@ -2752,7 +2981,6 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) } } } - UpdateAttrCols( pos, -((int)numCols) ); if ( GetView() ) { wxGridTableMessage msg( this, @@ -2835,6 +3063,7 @@ BEGIN_EVENT_TABLE( wxGridRowLabelWindow, wxWindow ) EVT_PAINT( wxGridRowLabelWindow::OnPaint ) EVT_MOUSE_EVENTS( wxGridRowLabelWindow::OnMouseEvent ) EVT_KEY_DOWN( wxGridRowLabelWindow::OnKeyDown ) + EVT_KEY_UP( wxGridRowLabelWindow::OnKeyUp ) END_EVENT_TABLE() wxGridRowLabelWindow::wxGridRowLabelWindow( wxGrid *parent, @@ -2878,6 +3107,11 @@ void wxGridRowLabelWindow::OnKeyDown( wxKeyEvent& event ) if ( !m_owner->ProcessEvent( event ) ) event.Skip(); } +void wxGridRowLabelWindow::OnKeyUp( wxKeyEvent& event ) +{ + if ( !m_owner->ProcessEvent( event ) ) event.Skip(); +} + ////////////////////////////////////////////////////////////////////// @@ -2888,6 +3122,7 @@ BEGIN_EVENT_TABLE( wxGridColLabelWindow, wxWindow ) EVT_PAINT( wxGridColLabelWindow::OnPaint ) EVT_MOUSE_EVENTS( wxGridColLabelWindow::OnMouseEvent ) EVT_KEY_DOWN( wxGridColLabelWindow::OnKeyDown ) + EVT_KEY_UP( wxGridColLabelWindow::OnKeyUp ) END_EVENT_TABLE() wxGridColLabelWindow::wxGridColLabelWindow( wxGrid *parent, @@ -2931,6 +3166,11 @@ void wxGridColLabelWindow::OnKeyDown( wxKeyEvent& event ) if ( !m_owner->ProcessEvent( event ) ) event.Skip(); } +void wxGridColLabelWindow::OnKeyUp( wxKeyEvent& event ) +{ + if ( !m_owner->ProcessEvent( event ) ) event.Skip(); +} + ////////////////////////////////////////////////////////////////////// @@ -2941,6 +3181,7 @@ BEGIN_EVENT_TABLE( wxGridCornerLabelWindow, wxWindow ) EVT_MOUSE_EVENTS( wxGridCornerLabelWindow::OnMouseEvent ) EVT_PAINT( wxGridCornerLabelWindow::OnPaint) EVT_KEY_DOWN( wxGridCornerLabelWindow::OnKeyDown ) + EVT_KEY_UP( wxGridCornerLabelWindow::OnKeyUp ) END_EVENT_TABLE() wxGridCornerLabelWindow::wxGridCornerLabelWindow( wxGrid *parent, @@ -2983,6 +3224,11 @@ void wxGridCornerLabelWindow::OnKeyDown( wxKeyEvent& event ) if ( !m_owner->ProcessEvent( event ) ) event.Skip(); } +void wxGridCornerLabelWindow::OnKeyUp( wxKeyEvent& event ) +{ + if ( !m_owner->ProcessEvent( event ) ) event.Skip(); +} + ////////////////////////////////////////////////////////////////////// @@ -2993,6 +3239,7 @@ BEGIN_EVENT_TABLE( wxGridWindow, wxPanel ) EVT_PAINT( wxGridWindow::OnPaint ) EVT_MOUSE_EVENTS( wxGridWindow::OnMouseEvent ) EVT_KEY_DOWN( wxGridWindow::OnKeyDown ) + EVT_KEY_UP( wxGridWindow::OnKeyUp ) EVT_ERASE_BACKGROUND( wxGridWindow::OnEraseBackground ) END_EVENT_TABLE() @@ -3043,7 +3290,7 @@ void wxGridWindow::OnMouseEvent( wxMouseEvent& event ) } -// This seems to be required for wxMotif otherwise the mouse +// This seems to be required for wxMotif/wxGTK otherwise the mouse // cursor must be in the cell edit control to get key events // void wxGridWindow::OnKeyDown( wxKeyEvent& event ) @@ -3051,6 +3298,10 @@ void wxGridWindow::OnKeyDown( wxKeyEvent& event ) if ( !m_owner->ProcessEvent( event ) ) event.Skip(); } +void wxGridWindow::OnKeyUp( wxKeyEvent& event ) +{ + if ( !m_owner->ProcessEvent( event ) ) event.Skip(); +} void wxGridWindow::OnEraseBackground( wxEraseEvent& WXUNUSED(event) ) { @@ -3066,6 +3317,7 @@ BEGIN_EVENT_TABLE( wxGrid, wxScrolledWindow ) EVT_PAINT( wxGrid::OnPaint ) EVT_SIZE( wxGrid::OnSize ) EVT_KEY_DOWN( wxGrid::OnKeyDown ) + EVT_KEY_UP( wxGrid::OnKeyUp ) EVT_ERASE_BACKGROUND( wxGrid::OnEraseBackground ) END_EVENT_TABLE() @@ -3171,23 +3423,20 @@ void wxGrid::Create() bool wxGrid::CreateGrid( int numRows, int numCols, wxGrid::wxGridSelectionModes selmode ) { - if ( m_created ) - { - wxFAIL_MSG( wxT("wxGrid::CreateGrid or wxGrid::SetTable called more than once") ); - return FALSE; - } - else - { - m_numRows = numRows; - m_numCols = numCols; + wxCHECK_MSG( !m_created, + FALSE, + wxT("wxGrid::CreateGrid or wxGrid::SetTable called more than once") ); + + m_numRows = numRows; + m_numCols = numCols; + + m_table = new wxGridStringTable( m_numRows, m_numCols ); + m_table->SetView( this ); + m_ownTable = TRUE; + m_selection = new wxGridSelection( this, selmode ); + Init(); + m_created = TRUE; - m_table = new wxGridStringTable( m_numRows, m_numCols ); - m_table->SetView( this ); - m_ownTable = TRUE; - Init(); - m_selection = new wxGridSelection( this, selmode ); - m_created = TRUE; - } return m_created; } @@ -3224,8 +3473,8 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership, m_table->SetView( this ); if (takeOwnership) m_ownTable = TRUE; - Init(); m_selection = new wxGridSelection( this, selmode ); + Init(); m_created = TRUE; } @@ -3235,12 +3484,6 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership, void wxGrid::Init() { - if ( m_numRows <= 0 ) - m_numRows = WXGRID_DEFAULT_NUMBER_ROWS; - - if ( m_numCols <= 0 ) - m_numCols = WXGRID_DEFAULT_NUMBER_COLS; - m_rowLabelWidth = WXGRID_DEFAULT_ROW_LABEL_WIDTH; m_colLabelHeight = WXGRID_DEFAULT_COL_LABEL_HEIGHT; @@ -3280,6 +3523,7 @@ void wxGrid::Init() m_gridLineColour = wxColour( 128, 128, 255 ); m_gridLinesEnabled = TRUE; + m_cellHighlightColour = m_gridLineColour; m_cursorMode = WXGRID_CURSOR_SELECT_CELL; m_winCapture = (wxWindow *)NULL; @@ -3396,10 +3640,10 @@ void wxGrid::CalcDimensions() int cw, ch; GetClientSize( &cw, &ch ); - if ( m_numRows > 0 && m_numCols > 0 ) + if ( m_numRows > 0 || m_numCols > 0 ) { - int right = GetColRight( m_numCols-1 ) + m_extraWidth; - int bottom = GetRowBottom( m_numRows-1 ) + m_extraHeight; + int right = m_numCols > 0 ? GetColRight( m_numCols-1 ) + m_extraWidth : 0; + int bottom = m_numRows > 0 ? GetRowBottom( m_numRows-1 ) + m_extraHeight : 0; // TODO: restore the scroll position that we had before sizing // @@ -3437,7 +3681,9 @@ void wxGrid::CalcWindowSizes() bool wxGrid::Redimension( wxGridTableMessage& msg ) { int i; + bool result = FALSE; +#if 0 // if we were using the default widths/heights so far, we must change them // now if ( m_colWidths.IsEmpty() ) @@ -3449,6 +3695,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { InitRowHeights(); } +#endif switch ( msg.GetId() ) { @@ -3456,71 +3703,99 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { size_t pos = msg.GetCommandInt(); int numRows = msg.GetCommandInt2(); - for ( i = 0; i < numRows; i++ ) - { - m_rowHeights.Insert( m_defaultRowHeight, pos ); - m_rowBottoms.Insert( 0, pos ); - } + m_numRows += numRows; - int bottom = 0; - if ( pos > 0 ) bottom = m_rowBottoms[pos-1]; + if ( !m_rowHeights.IsEmpty() ) + { + for ( i = 0; i < numRows; i++ ) + { + m_rowHeights.Insert( m_defaultRowHeight, pos ); + m_rowBottoms.Insert( 0, pos ); + } + + int bottom = 0; + if ( pos > 0 ) bottom = m_rowBottoms[pos-1]; - for ( i = pos; i < m_numRows; i++ ) + for ( i = pos; i < m_numRows; i++ ) + { + bottom += m_rowHeights[i]; + m_rowBottoms[i] = bottom; + } + } + if ( m_currentCellCoords == wxGridNoCellCoords ) + { + // if we have just inserted cols into an empty grid the current + // cell will be undefined... + // + SetCurrentCell( 0, 0 ); + } + m_selection->UpdateRows( pos, numRows ); + wxGridCellAttrProvider * attrProvider = m_table->GetAttrProvider(); + if (attrProvider) + attrProvider->UpdateAttrRows( pos, numRows ); + + if ( !GetBatchCount() ) { - bottom += m_rowHeights[i]; - m_rowBottoms[i] = bottom; + CalcDimensions(); + m_rowLabelWin->Refresh(); } - CalcDimensions(); } - return TRUE; + result = TRUE; + break; case wxGRIDTABLE_NOTIFY_ROWS_APPENDED: { int numRows = msg.GetCommandInt(); - for ( i = 0; i < numRows; i++ ) - { - m_rowHeights.Add( m_defaultRowHeight ); - m_rowBottoms.Add( 0 ); - } - int oldNumRows = m_numRows; m_numRows += numRows; - int bottom = 0; - if ( oldNumRows > 0 ) bottom = m_rowBottoms[oldNumRows-1]; + if ( !m_rowHeights.IsEmpty() ) + { + for ( i = 0; i < numRows; i++ ) + { + m_rowHeights.Add( m_defaultRowHeight ); + m_rowBottoms.Add( 0 ); + } - for ( i = oldNumRows; i < m_numRows; i++ ) + int bottom = 0; + if ( oldNumRows > 0 ) bottom = m_rowBottoms[oldNumRows-1]; + + for ( i = oldNumRows; i < m_numRows; i++ ) + { + bottom += m_rowHeights[i]; + m_rowBottoms[i] = bottom; + } + } + if ( m_currentCellCoords == wxGridNoCellCoords ) + { + // if we have just inserted cols into an empty grid the current + // cell will be undefined... + // + SetCurrentCell( 0, 0 ); + } + if ( !GetBatchCount() ) { - bottom += m_rowHeights[i]; - m_rowBottoms[i] = bottom; + CalcDimensions(); + m_rowLabelWin->Refresh(); } - CalcDimensions(); } - return TRUE; + result = TRUE; + break; case wxGRIDTABLE_NOTIFY_ROWS_DELETED: { size_t pos = msg.GetCommandInt(); int numRows = msg.GetCommandInt2(); - for ( i = 0; i < numRows; i++ ) - { - m_rowHeights.Remove( pos ); - m_rowBottoms.Remove( pos ); - } m_numRows -= numRows; - if ( !m_numRows ) + if ( !m_rowHeights.IsEmpty() ) { - m_numCols = 0; - m_colWidths.Clear(); - m_colRights.Clear(); - m_currentCellCoords = wxGridNoCellCoords; - } - else - { - if ( m_currentCellCoords.GetRow() >= m_numRows ) - m_currentCellCoords.Set( 0, 0 ); + for ( i = 0; i < numRows; i++ ) + { + m_rowHeights.Remove( pos ); + m_rowBottoms.Remove( pos ); + } int h = 0; for ( i = 0; i < m_numRows; i++ ) @@ -3529,82 +3804,131 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) m_rowBottoms[i] = h; } } - - CalcDimensions(); + if ( !m_numRows ) + { + m_currentCellCoords = wxGridNoCellCoords; + } + else + { + if ( m_currentCellCoords.GetRow() >= m_numRows ) + m_currentCellCoords.Set( 0, 0 ); + } + m_selection->UpdateRows( pos, -((int)numRows) ); + wxGridCellAttrProvider * attrProvider = m_table->GetAttrProvider(); + if (attrProvider) { + attrProvider->UpdateAttrRows( pos, -((int)numRows) ); + // No need to touch column attributes, unless we + // removed _all_ rows, in this case, we remove + // all column attributes. + // I hate to do this here, but the + // needed data is not available inside UpdateAttrRows. + if ( !GetNumberRows() ) + attrProvider->UpdateAttrCols( 0, -GetNumberCols() ); + } + if ( !GetBatchCount() ) + { + CalcDimensions(); + m_rowLabelWin->Refresh(); + } } - return TRUE; + result = TRUE; + break; case wxGRIDTABLE_NOTIFY_COLS_INSERTED: { size_t pos = msg.GetCommandInt(); int numCols = msg.GetCommandInt2(); - for ( i = 0; i < numCols; i++ ) - { - m_colWidths.Insert( m_defaultColWidth, pos ); - m_colRights.Insert( 0, pos ); - } m_numCols += numCols; - int right = 0; - if ( pos > 0 ) right = m_colRights[pos-1]; + if ( !m_colWidths.IsEmpty() ) + { + for ( i = 0; i < numCols; i++ ) + { + m_colWidths.Insert( m_defaultColWidth, pos ); + m_colRights.Insert( 0, pos ); + } + + int right = 0; + if ( pos > 0 ) right = m_colRights[pos-1]; - for ( i = pos; i < m_numCols; i++ ) + for ( i = pos; i < m_numCols; i++ ) + { + right += m_colWidths[i]; + m_colRights[i] = right; + } + } + if ( m_currentCellCoords == wxGridNoCellCoords ) { - right += m_colWidths[i]; - m_colRights[i] = right; + // if we have just inserted cols into an empty grid the current + // cell will be undefined... + // + SetCurrentCell( 0, 0 ); } - CalcDimensions(); + m_selection->UpdateCols( pos, numCols ); + wxGridCellAttrProvider * attrProvider = m_table->GetAttrProvider(); + if (attrProvider) + attrProvider->UpdateAttrCols( pos, numCols ); + if ( !GetBatchCount() ) + { + CalcDimensions(); + m_colLabelWin->Refresh(); + } + } - return TRUE; + result = TRUE; + break; case wxGRIDTABLE_NOTIFY_COLS_APPENDED: { int numCols = msg.GetCommandInt(); - for ( i = 0; i < numCols; i++ ) - { - m_colWidths.Add( m_defaultColWidth ); - m_colRights.Add( 0 ); - } - int oldNumCols = m_numCols; m_numCols += numCols; + if ( !m_colWidths.IsEmpty() ) + { + for ( i = 0; i < numCols; i++ ) + { + m_colWidths.Add( m_defaultColWidth ); + m_colRights.Add( 0 ); + } - int right = 0; - if ( oldNumCols > 0 ) right = m_colRights[oldNumCols-1]; + int right = 0; + if ( oldNumCols > 0 ) right = m_colRights[oldNumCols-1]; - for ( i = oldNumCols; i < m_numCols; i++ ) + for ( i = oldNumCols; i < m_numCols; i++ ) + { + right += m_colWidths[i]; + m_colRights[i] = right; + } + } + if ( m_currentCellCoords == wxGridNoCellCoords ) { - right += m_colWidths[i]; - m_colRights[i] = right; + // if we have just inserted cols into an empty grid the current + // cell will be undefined... + // + SetCurrentCell( 0, 0 ); + } + if ( !GetBatchCount() ) + { + CalcDimensions(); + m_colLabelWin->Refresh(); } - CalcDimensions(); } - return TRUE; + result = TRUE; + break; case wxGRIDTABLE_NOTIFY_COLS_DELETED: { size_t pos = msg.GetCommandInt(); int numCols = msg.GetCommandInt2(); - for ( i = 0; i < numCols; i++ ) - { - m_colWidths.Remove( pos ); - m_colRights.Remove( pos ); - } m_numCols -= numCols; - if ( !m_numCols ) - { -#if 0 // leave the row alone here so that AppendCols will work subsequently - m_numRows = 0; - m_rowHeights.Clear(); - m_rowBottoms.Clear(); -#endif - m_currentCellCoords = wxGridNoCellCoords; - } - else + if ( !m_colWidths.IsEmpty() ) { - if ( m_currentCellCoords.GetCol() >= m_numCols ) - m_currentCellCoords.Set( 0, 0 ); + for ( i = 0; i < numCols; i++ ) + { + m_colWidths.Remove( pos ); + m_colRights.Remove( pos ); + } int w = 0; for ( i = 0; i < m_numCols; i++ ) @@ -3613,16 +3937,48 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) m_colRights[i] = w; } } - CalcDimensions(); + if ( !m_numCols ) + { + m_currentCellCoords = wxGridNoCellCoords; + } + else + { + if ( m_currentCellCoords.GetCol() >= m_numCols ) + m_currentCellCoords.Set( 0, 0 ); + } + m_selection->UpdateCols( pos, -((int)numCols) ); + wxGridCellAttrProvider * attrProvider = m_table->GetAttrProvider(); + if (attrProvider) { + attrProvider->UpdateAttrCols( pos, -((int)numCols) ); + // No need to touch row attributes, unless we + // removed _all_ columns, in this case, we remove + // all row attributes. + // I hate to do this here, but the + // needed data is not available inside UpdateAttrCols. + if ( !GetNumberCols() ) + attrProvider->UpdateAttrRows( 0, -GetNumberRows() ); + } + if ( !GetBatchCount() ) + { + CalcDimensions(); + m_colLabelWin->Refresh(); + } + return TRUE; } - return TRUE; +#if 0 +// There is no path to this code !!!!!! + result = TRUE; + break; +#endif } - return FALSE; + if (result && !GetBatchCount() ) + m_gridWin->Refresh(); + return result; } -void wxGrid::CalcRowLabelsExposed( wxRegion& reg ) +void wxGrid::CalcRowLabelsExposed( const wxRegion& reg ) { wxRegionIterator iter( reg ); wxRect r; @@ -3671,7 +4027,7 @@ void wxGrid::CalcRowLabelsExposed( wxRegion& reg ) } -void wxGrid::CalcColLabelsExposed( wxRegion& reg ) +void wxGrid::CalcColLabelsExposed( const wxRegion& reg ) { wxRegionIterator iter( reg ); wxRect r; @@ -3720,7 +4076,7 @@ void wxGrid::CalcColLabelsExposed( wxRegion& reg ) } -void wxGrid::CalcCellsExposed( wxRegion& reg ) +void wxGrid::CalcCellsExposed( const wxRegion& reg ) { wxRegionIterator iter( reg ); wxRect r; @@ -4286,7 +4642,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event ) { // Hide the edit control, so it // won't interfer with drag-shrinking. - if ( IsCellEditControlEnabled() ) + if ( IsCellEditControlShown() ) { HideCellEditControl(); SaveEditControlValue(); @@ -4385,27 +4741,27 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event ) // ------------ Left button pressed // if ( event.LeftDown() && coords != wxGridNoCellCoords ) - { - if ( !event.ShiftDown() && !event.ControlDown() ) - ClearSelection(); - if ( event.ShiftDown() ) - { - m_selection->SelectBlock( m_currentCellCoords.GetRow(), - m_currentCellCoords.GetCol(), - coords.GetRow(), - coords.GetCol(), - event.ControlDown(), - event.ShiftDown(), - event.AltDown(), - event.MetaDown() ); - } - else if ( XToEdgeOfCol(x) < 0 && - YToEdgeOfRow(y) < 0 ) + { + if ( !SendEvent( wxEVT_GRID_CELL_LEFT_CLICK, + coords.GetRow(), + coords.GetCol(), + event ) ) { - if ( !SendEvent( wxEVT_GRID_CELL_LEFT_CLICK, - coords.GetRow(), - coords.GetCol(), - event ) ) + if ( !event.ControlDown() ) + ClearSelection(); + if ( event.ShiftDown() ) + { + m_selection->SelectBlock( m_currentCellCoords.GetRow(), + m_currentCellCoords.GetCol(), + coords.GetRow(), + coords.GetCol(), + event.ControlDown(), + event.ShiftDown(), + event.AltDown(), + event.MetaDown() ); + } + else if ( XToEdgeOfCol(x) < 0 && + YToEdgeOfRow(y) < 0 ) { DisableCellEditControl(); MakeCellVisible( coords ); @@ -4443,7 +4799,12 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event ) m_selectingKeyboard = coords; } else + { SetCurrentCell( coords ); + if ( m_selection->GetSelectionMode() + != wxGrid::wxGridSelectCells) + SelectBlock( coords, coords ); + } m_waitForSlowClick = TRUE; } } @@ -4749,40 +5110,12 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) if (IsCellEditControlEnabled()) DisableCellEditControl(); - bool ok = m_table->InsertRows( pos, numRows ); + return m_table->InsertRows( pos, numRows ); // the table will have sent the results of the insert row // operation to this view object as a grid table message - // - if ( ok ) - { - if ( m_numCols == 0 ) - { - m_table->AppendCols( WXGRID_DEFAULT_NUMBER_COLS ); - // - // TODO: perhaps instead of appending the default number of cols - // we should remember what the last non-zero number of cols was ? - // - } - - if ( m_currentCellCoords == wxGridNoCellCoords ) - { - // if we have just inserted cols into an empty grid the current - // cell will be undefined... - // - SetCurrentCell( 0, 0 ); - } - - m_selection->UpdateRows( pos, numRows ); - if ( !GetBatchCount() ) Refresh(); - } - - return ok; - } - else - { - return FALSE; } + return FALSE; } @@ -4796,26 +5129,9 @@ bool wxGrid::AppendRows( int numRows, bool WXUNUSED(updateLabels) ) return FALSE; } - if ( m_table && m_table->AppendRows( numRows ) ) - { - if ( m_currentCellCoords == wxGridNoCellCoords ) - { - // if we have just inserted cols into an empty grid the current - // cell will be undefined... - // - SetCurrentCell( 0, 0 ); - } - - // the table will have sent the results of the append row - // operation to this view object as a grid table message - // - if ( !GetBatchCount() ) Refresh(); - return TRUE; - } - else - { - return FALSE; - } + return ( m_table && m_table->AppendRows( numRows ) ); + // the table will have sent the results of the append row + // operation to this view object as a grid table message } @@ -4834,16 +5150,9 @@ bool wxGrid::DeleteRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) if (IsCellEditControlEnabled()) DisableCellEditControl(); - if (m_table->DeleteRows( pos, numRows )) - { - - // the table will have sent the results of the delete row - // operation to this view object as a grid table message - // - m_selection->UpdateRows( pos, -((int)numRows) ); - if ( !GetBatchCount() ) Refresh(); - return TRUE; - } + return (m_table->DeleteRows( pos, numRows )); + // the table will have sent the results of the delete row + // operation to this view object as a grid table message } return FALSE; } @@ -4864,31 +5173,11 @@ bool wxGrid::InsertCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) if (IsCellEditControlEnabled()) DisableCellEditControl(); - bool ok = m_table->InsertCols( pos, numCols ); - + return m_table->InsertCols( pos, numCols ); // the table will have sent the results of the insert col // operation to this view object as a grid table message - // - if ( ok ) - { - if ( m_currentCellCoords == wxGridNoCellCoords ) - { - // if we have just inserted cols into an empty grid the current - // cell will be undefined... - // - SetCurrentCell( 0, 0 ); - } - - m_selection->UpdateCols( pos, numCols ); - if ( !GetBatchCount() ) Refresh(); - } - - return ok; - } - else - { - return FALSE; } + return FALSE; } @@ -4902,26 +5191,9 @@ bool wxGrid::AppendCols( int numCols, bool WXUNUSED(updateLabels) ) return FALSE; } - if ( m_table && m_table->AppendCols( numCols ) ) - { - // the table will have sent the results of the append col - // operation to this view object as a grid table message - // - if ( m_currentCellCoords == wxGridNoCellCoords ) - { - // if we have just inserted cols into an empty grid the current - // cell will be undefined... - // - SetCurrentCell( 0, 0 ); - } - - if ( !GetBatchCount() ) Refresh(); - return TRUE; - } - else - { - return FALSE; - } + return ( m_table && m_table->AppendCols( numCols ) ); + // the table will have sent the results of the append col + // operation to this view object as a grid table message } @@ -4940,15 +5212,9 @@ bool wxGrid::DeleteCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) if (IsCellEditControlEnabled()) DisableCellEditControl(); - if ( m_table->DeleteCols( pos, numCols ) ) - { - // the table will have sent the results of the delete col - // operation to this view object as a grid table message - // - m_selection->UpdateCols( pos, -((int)numCols) ); - if ( !GetBatchCount() ) Refresh(); - return TRUE; - } + return ( m_table->DeleteCols( pos, numCols ) ); + // the table will have sent the results of the delete col + // operation to this view object as a grid table message } return FALSE; } @@ -4984,7 +5250,7 @@ bool wxGrid::SendEvent( const wxEventType type, } else if ( type == wxEVT_GRID_RANGE_SELECT ) { - // Right now, it should _never_ end up here! + // Right now, it should _never_ end up here! wxGridRangeSelectEvent gridEvt( GetId(), type, this, @@ -5047,7 +5313,7 @@ bool wxGrid::SendEvent( const wxEventType type, void wxGrid::OnPaint( wxPaintEvent& WXUNUSED(event) ) { - wxPaintDC dc( this ); + wxPaintDC dc(this); // needed to prevent zillions of paint events on MSW } @@ -5084,24 +5350,6 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) // try local handlers // - if ( !event.ShiftDown() && - m_selectingKeyboard != wxGridNoCellCoords ) - { - if ( m_selectingTopLeft != wxGridNoCellCoords && - m_selectingBottomRight != wxGridNoCellCoords ) - m_selection->SelectBlock( m_selectingTopLeft.GetRow(), - m_selectingTopLeft.GetCol(), - m_selectingBottomRight.GetRow(), - m_selectingBottomRight.GetCol(), - event.ControlDown(), - event.ShiftDown(), - event.AltDown(), - event.MetaDown() ); - m_selectingTopLeft = wxGridNoCellCoords; - m_selectingBottomRight = wxGridNoCellCoords; - m_selectingKeyboard = wxGridNoCellCoords; - } - switch ( event.KeyCode() ) { case WXK_UP: @@ -5155,7 +5403,16 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) } else { - MoveCursorDown( event.ShiftDown() ); + if ( GetGridCursorRow() < GetNumberRows()-1 ) + { + MoveCursorDown( event.ShiftDown() ); + } + else + { + // at the bottom of a column + HideCellEditControl(); + SaveEditControlValue(); + } } break; @@ -5165,9 +5422,31 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) case WXK_TAB: if (event.ShiftDown()) - MoveCursorLeft( FALSE ); + { + if ( GetGridCursorCol() > 0 ) + { + MoveCursorLeft( FALSE ); + } + else + { + // at left of grid + HideCellEditControl(); + SaveEditControlValue(); + } + } else - MoveCursorRight( FALSE ); + { + if ( GetGridCursorCol() < GetNumberCols()-1 ) + { + MoveCursorRight( FALSE ); + } + else + { + // at right of grid + HideCellEditControl(); + SaveEditControlValue(); + } + } break; case WXK_HOME: @@ -5221,26 +5500,28 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) // Otherwise fall through to default default: - // alphanumeric keys or F2 (special key just for this) enable - // the cell edit control - // On just Shift/Control I get values for event.KeyCode() - // that are outside the range where isalnum's behaviour is - // well defined, so do an additional sanity check. - if ( !(event.AltDown() || - event.MetaDown() || - event.ControlDown()) && - ((isalnum((int)event.KeyCode()) && - (event.KeyCode() < 256 && event.KeyCode() >= 0)) || - event.KeyCode() == WXK_F2) && - !IsCellEditControlEnabled() && - CanEnableCellControl() ) + // is it possible to edit the current cell at all? + if ( !IsCellEditControlEnabled() && CanEnableCellControl() ) { - EnableCellEditControl(); + // yes, now check whether the cells editor accepts the key int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); wxGridCellAttr* attr = GetCellAttr(row, col); wxGridCellEditor *editor = attr->GetEditor(this, row, col); - editor->StartingKey(event); + + // <F2> is special and will always start editing, for + // other keys - ask the editor itself + if ( (event.KeyCode() == WXK_F2 && !event.HasModifiers()) + || editor->IsAcceptedKey(event) ) + { + EnableCellEditControl(); + editor->StartingKey(event); + } + else + { + event.Skip(); + } + editor->DecRef(); attr->DecRef(); } @@ -5257,45 +5538,75 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) m_inOnKeyDown = FALSE; } +void wxGrid::OnKeyUp( wxKeyEvent& event ) +{ + // try local handlers + // + if ( event.KeyCode() == WXK_SHIFT ) + { + if ( m_selectingTopLeft != wxGridNoCellCoords && + m_selectingBottomRight != wxGridNoCellCoords ) + m_selection->SelectBlock( m_selectingTopLeft.GetRow(), + m_selectingTopLeft.GetCol(), + m_selectingBottomRight.GetRow(), + m_selectingBottomRight.GetCol(), + event.ControlDown(), + TRUE, + event.AltDown(), + event.MetaDown() ); + m_selectingTopLeft = wxGridNoCellCoords; + m_selectingBottomRight = wxGridNoCellCoords; + m_selectingKeyboard = wxGridNoCellCoords; + } +} + void wxGrid::OnEraseBackground(wxEraseEvent&) { } void wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) { + if ( SendEvent( wxEVT_GRID_SELECT_CELL, coords.GetRow(), coords.GetCol() ) ) + { + // the event has been intercepted - do nothing + return; + } + + wxClientDC dc(m_gridWin); + PrepareDC(dc); + if ( m_currentCellCoords != wxGridNoCellCoords ) { HideCellEditControl(); DisableCellEditControl(); - // Clear the old current cell highlight - wxRect r = BlockToDeviceRect(m_currentCellCoords, m_currentCellCoords); + if ( IsVisible( m_currentCellCoords ) ) + { + wxRect r; + r = BlockToDeviceRect(m_currentCellCoords, m_currentCellCoords); + if ( !m_gridLinesEnabled ) + { + r.x--; + r.y--; + r.width++; + r.height++; + } - // Otherwise refresh redraws the highlight! - m_currentCellCoords = coords; + CalcCellsExposed( r ); + + // Otherwise refresh redraws the highlight! + m_currentCellCoords = coords; - m_gridWin->Refresh( FALSE, &r ); + DrawGridCellArea(dc); + DrawAllGridLines( dc, r ); + } } m_currentCellCoords = coords; - wxClientDC dc(m_gridWin); - PrepareDC(dc); - wxGridCellAttr* attr = GetCellAttr(coords); DrawCellHighlight(dc, attr); attr->DecRef(); - -#if 0 - // SN: For my extended selection code, automatic - // deselection is definitely not a good idea. - if ( IsSelection() ) - { - wxRect r( SelectionToDeviceRect() ); - ClearSelection(); - if ( !GetBatchCount() ) m_gridWin->Refresh( FALSE, &r ); - } -#endif } @@ -5359,32 +5670,33 @@ void wxGrid::DrawGridCellArea( wxDC& dc ) void wxGrid::DrawGridSpace( wxDC& dc ) { - if ( m_numRows && m_numCols ) - { - int cw, ch; - m_gridWin->GetClientSize( &cw, &ch ); + int cw, ch; + m_gridWin->GetClientSize( &cw, &ch ); - int right, bottom; - CalcUnscrolledPosition( cw, ch, &right, &bottom ); + int right, bottom; + CalcUnscrolledPosition( cw, ch, &right, &bottom ); - if ( right > GetColRight(m_numCols-1) || - bottom > GetRowBottom(m_numRows-1) ) - { - int left, top; - CalcUnscrolledPosition( 0, 0, &left, &top ); + int rightCol = m_numCols > 0 ? GetColRight(m_numCols - 1) : 0; + int bottomRow = m_numRows > 0 ? GetRowBottom(m_numRows - 1) : 0 ; - dc.SetBrush( wxBrush(GetDefaultCellBackgroundColour(), wxSOLID) ); - dc.SetPen( *wxTRANSPARENT_PEN ); + if ( right > rightCol || bottom > bottomRow ) + { + int left, top; + CalcUnscrolledPosition( 0, 0, &left, &top ); - if ( right > GetColRight(m_numCols-1) ) - dc.DrawRectangle( GetColRight(m_numCols-1), top, - right - GetColRight(m_numCols-1), ch ); + dc.SetBrush( wxBrush(GetDefaultCellBackgroundColour(), wxSOLID) ); + dc.SetPen( *wxTRANSPARENT_PEN ); - if ( bottom > GetRowBottom(m_numRows-1) ) - dc.DrawRectangle( left, GetRowBottom(m_numRows-1), - cw, bottom - GetRowBottom(m_numRows-1) ); - } - } + if ( right > rightCol ) + { + dc.DrawRectangle( rightCol, top, right - rightCol, ch); + } + + if ( bottom > bottomRow ) + { + dc.DrawRectangle( left, bottomRow, cw, bottom - bottomRow); + } + } } @@ -5406,14 +5718,11 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords ) bool isCurrent = coords == m_currentCellCoords; - wxRect rect; - rect.x = GetColLeft(col); - rect.y = GetRowTop(row); - rect.width = GetColWidth(col) - 1; - rect.height = GetRowHeight(row) - 1; + wxRect rect = CellToRect( row, col ); // if the editor is shown, we should use it and not the renderer - if ( isCurrent && IsCellEditControlEnabled() ) + // Note: However, only if it is really _shown_, i.e. not hidden! + if ( isCurrent && IsCellEditControlShown() ) { wxGridCellEditor *editor = attr->GetEditor(this, row, col); editor->PaintBackground(rect, attr); @@ -5439,16 +5748,12 @@ void wxGrid::DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr ) if ( GetColWidth(col) <= 0 || GetRowHeight(row) <= 0 ) return; - wxRect rect; - rect.x = GetColLeft(col); - rect.y = GetRowTop(row); - rect.width = GetColWidth(col) - 1; - rect.height = GetRowHeight(row) - 1; + wxRect rect = CellToRect(row, col); // hmmm... what could we do here to show that the cell is disabled? // for now, I just draw a thinner border than for the other ones, but // it doesn't look really good - dc.SetPen(wxPen(m_gridLineColour, attr->IsReadOnly() ? 1 : 3, wxSOLID)); + dc.SetPen(wxPen(m_cellHighlightColour, attr->IsReadOnly() ? 1 : 3, wxSOLID)); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawRectangle(rect); @@ -5507,7 +5812,7 @@ void wxGrid::DrawHighlight(wxDC& dc) m_currentCellCoords.Set(0, 0); } - if ( IsCellEditControlEnabled() ) + if ( IsCellEditControlShown() ) { // don't show highlight when the edit control is shown return; @@ -5541,7 +5846,7 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED_GTK(reg) ) int top, bottom, left, right; -#ifndef __WXGTK__ +#if 0 //#ifndef __WXGTK__ if (reg.IsEmpty()) { int cw, ch; @@ -5612,7 +5917,7 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED_GTK(reg) ) void wxGrid::DrawRowLabels( wxDC& dc ) { - if ( !m_numRows || !m_numCols ) return; + if ( !m_numRows ) return; size_t i; size_t numLabels = m_rowLabelsExposed.GetCount(); @@ -5660,7 +5965,7 @@ void wxGrid::DrawRowLabel( wxDC& dc, int row ) void wxGrid::DrawColLabels( wxDC& dc ) { - if ( !m_numRows || !m_numCols ) return; + if ( !m_numCols ) return; size_t i; size_t numLabels = m_colLabelsExposed.GetCount(); @@ -5826,6 +6131,24 @@ void wxGrid::GetTextBoxSize( wxDC& dc, *height = h; } +// +// ------ Batch processing. +// +void wxGrid::EndBatch() +{ + if ( m_batchCount > 0 ) + { + m_batchCount--; + if ( !m_batchCount ) + { + CalcDimensions(); + m_rowLabelWin->Refresh(); + m_colLabelWin->Refresh(); + m_cornerLabelWin->Refresh(); + m_gridWin->Refresh(); + } + } +} // // ------ Edit control functions @@ -5905,6 +6228,32 @@ bool wxGrid::IsCellEditControlEnabled() const return m_cellEditCtrlEnabled ? !IsCurrentCellReadOnly() : FALSE; } +bool wxGrid::IsCellEditControlShown() const +{ + bool isShown = FALSE; + + if ( m_cellEditCtrlEnabled ) + { + int row = m_currentCellCoords.GetRow(); + int col = m_currentCellCoords.GetCol(); + wxGridCellAttr* attr = GetCellAttr(row, col); + wxGridCellEditor* editor = attr->GetEditor((wxGrid*) this, row, col); + attr->DecRef(); + + if ( editor ) + { + if ( editor->IsCreated() ) + { + isShown = editor->GetControl()->IsShown(); + } + + editor->DecRef(); + } + } + + return isShown; +} + void wxGrid::ShowCellEditControl() { if ( IsCellEditControlEnabled() ) @@ -5972,6 +6321,8 @@ void wxGrid::HideCellEditControl() editor->DecRef(); attr->DecRef(); m_gridWin->SetFocus(); + wxRect rect( CellToRect( row, col ) ); + m_gridWin->Refresh( FALSE, &rect ); } } @@ -6106,6 +6457,11 @@ wxRect wxGrid::CellToRect( int row, int col ) rect.height = GetRowHeight(row); } + // if grid lines are enabled, then the area of the cell is a bit smaller + if (m_gridLinesEnabled) { + rect.width -= 1; + rect.height -= 1; + } return rect; } @@ -6232,18 +6588,21 @@ void wxGrid::MakeCellVisible( int row, int col ) bool wxGrid::MoveCursorUp( bool expandSelection ) { if ( m_currentCellCoords != wxGridNoCellCoords && - m_currentCellCoords.GetRow() > 0 ) + m_currentCellCoords.GetRow() >= 0 ) { - if ( expandSelection ) + if ( expandSelection) { if ( m_selectingKeyboard == wxGridNoCellCoords ) m_selectingKeyboard = m_currentCellCoords; - m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() - 1 ); - MakeCellVisible( m_selectingKeyboard.GetRow(), - m_selectingKeyboard.GetCol() ); - SelectBlock( m_currentCellCoords, m_selectingKeyboard ); + if ( m_selectingKeyboard.GetRow() > 0 ) + { + m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() - 1 ); + MakeCellVisible( m_selectingKeyboard.GetRow(), + m_selectingKeyboard.GetCol() ); + SelectBlock( m_currentCellCoords, m_selectingKeyboard ); + } } - else + else if ( m_currentCellCoords.GetRow() > 0 ) { ClearSelection(); MakeCellVisible( m_currentCellCoords.GetRow() - 1, @@ -6251,6 +6610,8 @@ bool wxGrid::MoveCursorUp( bool expandSelection ) SetCurrentCell( m_currentCellCoords.GetRow() - 1, m_currentCellCoords.GetCol() ); } + else + return FALSE; return TRUE; } @@ -6261,18 +6622,21 @@ bool wxGrid::MoveCursorUp( bool expandSelection ) bool wxGrid::MoveCursorDown( bool expandSelection ) { if ( m_currentCellCoords != wxGridNoCellCoords && - m_currentCellCoords.GetRow() < m_numRows-1 ) + m_currentCellCoords.GetRow() < m_numRows ) { if ( expandSelection ) { if ( m_selectingKeyboard == wxGridNoCellCoords ) m_selectingKeyboard = m_currentCellCoords; - m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() + 1 ); - MakeCellVisible( m_selectingKeyboard.GetRow(), - m_selectingKeyboard.GetCol() ); - SelectBlock( m_currentCellCoords, m_selectingKeyboard ); + if ( m_selectingKeyboard.GetRow() < m_numRows-1 ) + { + m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() + 1 ); + MakeCellVisible( m_selectingKeyboard.GetRow(), + m_selectingKeyboard.GetCol() ); + SelectBlock( m_currentCellCoords, m_selectingKeyboard ); + } } - else + else if ( m_currentCellCoords.GetRow() < m_numRows - 1 ) { ClearSelection(); MakeCellVisible( m_currentCellCoords.GetRow() + 1, @@ -6280,6 +6644,8 @@ bool wxGrid::MoveCursorDown( bool expandSelection ) SetCurrentCell( m_currentCellCoords.GetRow() + 1, m_currentCellCoords.GetCol() ); } + else + return FALSE; return TRUE; } @@ -6290,18 +6656,21 @@ bool wxGrid::MoveCursorDown( bool expandSelection ) bool wxGrid::MoveCursorLeft( bool expandSelection ) { if ( m_currentCellCoords != wxGridNoCellCoords && - m_currentCellCoords.GetCol() > 0 ) + m_currentCellCoords.GetCol() >= 0 ) { if ( expandSelection ) { if ( m_selectingKeyboard == wxGridNoCellCoords ) m_selectingKeyboard = m_currentCellCoords; - m_selectingKeyboard.SetCol( m_selectingKeyboard.GetCol() - 1 ); - MakeCellVisible( m_selectingKeyboard.GetRow(), - m_selectingKeyboard.GetCol() ); - SelectBlock( m_currentCellCoords, m_selectingKeyboard ); + if ( m_selectingKeyboard.GetCol() > 0 ) + { + m_selectingKeyboard.SetCol( m_selectingKeyboard.GetCol() - 1 ); + MakeCellVisible( m_selectingKeyboard.GetRow(), + m_selectingKeyboard.GetCol() ); + SelectBlock( m_currentCellCoords, m_selectingKeyboard ); + } } - else + else if ( m_currentCellCoords.GetCol() > 0 ) { ClearSelection(); MakeCellVisible( m_currentCellCoords.GetRow(), @@ -6309,6 +6678,8 @@ bool wxGrid::MoveCursorLeft( bool expandSelection ) SetCurrentCell( m_currentCellCoords.GetRow(), m_currentCellCoords.GetCol() - 1 ); } + else + return FALSE; return TRUE; } @@ -6319,18 +6690,21 @@ bool wxGrid::MoveCursorLeft( bool expandSelection ) bool wxGrid::MoveCursorRight( bool expandSelection ) { if ( m_currentCellCoords != wxGridNoCellCoords && - m_currentCellCoords.GetCol() < m_numCols - 1 ) + m_currentCellCoords.GetCol() < m_numCols ) { if ( expandSelection ) { if ( m_selectingKeyboard == wxGridNoCellCoords ) m_selectingKeyboard = m_currentCellCoords; - m_selectingKeyboard.SetCol( m_selectingKeyboard.GetCol() + 1 ); - MakeCellVisible( m_selectingKeyboard.GetRow(), - m_selectingKeyboard.GetCol() ); - SelectBlock( m_currentCellCoords, m_selectingKeyboard ); + if ( m_selectingKeyboard.GetCol() < m_numCols - 1 ) + { + m_selectingKeyboard.SetCol( m_selectingKeyboard.GetCol() + 1 ); + MakeCellVisible( m_selectingKeyboard.GetRow(), + m_selectingKeyboard.GetCol() ); + SelectBlock( m_currentCellCoords, m_selectingKeyboard ); + } } - else + else if ( m_currentCellCoords.GetCol() < m_numCols - 1 ) { ClearSelection(); MakeCellVisible( m_currentCellCoords.GetRow(), @@ -6338,6 +6712,8 @@ bool wxGrid::MoveCursorRight( bool expandSelection ) SetCurrentCell( m_currentCellCoords.GetRow(), m_currentCellCoords.GetCol() + 1 ); } + else + return FALSE; return TRUE; } @@ -6880,6 +7256,21 @@ void wxGrid::SetGridLineColour( const wxColour& colour ) } } + +void wxGrid::SetCellHighlightColour( const wxColour& colour ) +{ + if ( m_cellHighlightColour != colour ) + { + m_cellHighlightColour = colour; + + wxClientDC dc( m_gridWin ); + PrepareDC( dc ); + wxGridCellAttr* attr = GetCellAttr(m_currentCellCoords); + DrawCellHighlight(dc, attr); + attr->DecRef(); + } +} + void wxGrid::EnableGridLines( bool enable ) { if ( enable != m_gridLinesEnabled ) @@ -7147,8 +7538,7 @@ wxGridCellAttr *wxGrid::GetOrCreateCellAttr(int row, int col) const if ( !LookupAttr(row, col, &attr) || !attr ) { wxASSERT_MSG( m_table, - _T("we may only be called if CanHaveAttributes() " - "returned TRUE and then m_table should be !NULL") ); + _T("we may only be called if CanHaveAttributes() returned TRUE and then m_table should be !NULL") ); attr = m_table->GetAttr(row, col); if ( !attr ) @@ -7536,6 +7926,10 @@ void wxGrid::AutoSizeColOrRow( int colOrRow, bool setAsMin, bool column ) // leave some space around text extentMax += 10; } + else + { + extentMax += 6; + } } if ( column ) @@ -7620,7 +8014,7 @@ void wxGrid::SetCellValue( int row, int col, const wxString& s ) { if ( m_table ) { - m_table->SetValue( row, col, s.c_str() ); + m_table->SetValue( row, col, s ); if ( !GetBatchCount() ) { wxClientDC dc( m_gridWin ); @@ -7630,7 +8024,10 @@ void wxGrid::SetCellValue( int row, int col, const wxString& s ) if ( m_currentCellCoords.GetRow() == row && m_currentCellCoords.GetCol() == col && - IsCellEditControlEnabled()) + IsCellEditControlShown()) + // Note: If we are using IsCellEditControlEnabled, + // this interacts badly with calling SetCellValue from + // an EVT_GRID_CELL_CHANGE handler. { HideCellEditControl(); ShowCellEditControl(); // will reread data from table @@ -7648,7 +8045,7 @@ void wxGrid::SelectRow( int row, bool addToSelected ) if ( IsSelection() && !addToSelected ) ClearSelection(); - m_selection->SelectRow( row ); + m_selection->SelectRow( row, FALSE, addToSelected ); } @@ -7657,7 +8054,7 @@ void wxGrid::SelectCol( int col, bool addToSelected ) if ( IsSelection() && !addToSelected ) ClearSelection(); - m_selection->SelectCol( col ); + m_selection->SelectCol( col, FALSE, addToSelected ); } @@ -7665,7 +8062,7 @@ void wxGrid::SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol ) { int temp; wxGridCellCoords updateTopLeft, updateBottomRight; - + if ( m_selection->GetSelectionMode() == wxGrid::wxGridSelectRows ) { leftCol = 0; @@ -7861,6 +8258,9 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft, int cw, ch; m_gridWin->GetClientSize( &cw, &ch ); + if (right < 0 || bottom < 0 || left > cw || top > ch) + return wxRect( 0, 0, 0, 0); + rect.SetLeft( wxMax(0, left) ); rect.SetTop( wxMax(0, top) ); rect.SetRight( wxMin(cw, right) ); diff --git a/src/generic/gridsel.cpp b/src/generic/gridsel.cpp index d3d2222a0d..f6e4b2ba71 100644 --- a/src/generic/gridsel.cpp +++ b/src/generic/gridsel.cpp @@ -517,12 +517,14 @@ void wxGridSelection::SelectCell( int row, int col, { if ( m_selectionMode == wxGrid::wxGridSelectRows ) { - SelectBlock(row, 0, row, m_grid->GetNumberCols() - 1 ); + SelectBlock(row, 0, row, m_grid->GetNumberCols() - 1, + ControlDown, ShiftDown, AltDown, MetaDown); return; } else if ( m_selectionMode == wxGrid::wxGridSelectColumns ) { - SelectBlock(0, col, m_grid->GetNumberRows() - 1, col ); + SelectBlock(0, col, m_grid->GetNumberRows() - 1, col, + ControlDown, ShiftDown, AltDown, MetaDown); return; } else if ( IsInSelection ( row, col ) ) @@ -538,14 +540,14 @@ void wxGridSelection::SelectCell( int row, int col, // Send event if (sendEvent) { - wxGridEvent gridEvt( m_grid->GetId(), - wxEVT_GRID_SELECT_CELL, - m_grid, - row, col, - -1, -1, - TRUE, - ControlDown, ShiftDown, - AltDown, MetaDown); + wxGridRangeSelectEvent gridEvt( m_grid->GetId(), + wxEVT_GRID_RANGE_SELECT, + m_grid, + wxGridCellCoords( row, col ), + wxGridCellCoords( row, col ), + TRUE, + ControlDown, ShiftDown, + AltDown, MetaDown); m_grid->GetEventHandler()->ProcessEvent(gridEvt); } } @@ -588,12 +590,14 @@ void wxGridSelection::ToggleCellSelection( int row, int col, ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r ); // Send event - wxGridEvent gridEvt( m_grid->GetId(), - wxEVT_GRID_SELECT_CELL, - m_grid, - row, col, -1, -1, FALSE, - ControlDown, ShiftDown, - AltDown, MetaDown ); + wxGridRangeSelectEvent gridEvt( m_grid->GetId(), + wxEVT_GRID_RANGE_SELECT, + m_grid, + wxGridCellCoords( row, col ), + wxGridCellCoords( row, col ), + FALSE, + ControlDown, ShiftDown, + AltDown, MetaDown ); m_grid->GetEventHandler()->ProcessEvent(gridEvt); return; } @@ -712,12 +716,14 @@ void wxGridSelection::ToggleCellSelection( int row, int col, wxGridCellCoords( row, col ) ); if ( !m_grid->GetBatchCount() ) ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r ); - wxGridEvent gridEvt( m_grid->GetId(), - wxEVT_GRID_SELECT_CELL, - m_grid, - row, col, -1, -1, FALSE, - ControlDown, ShiftDown, - AltDown, MetaDown ); + wxGridRangeSelectEvent gridEvt( m_grid->GetId(), + wxEVT_GRID_RANGE_SELECT, + m_grid, + wxGridCellCoords( row, col ), + wxGridCellCoords( row, col ), + FALSE, + ControlDown, ShiftDown, + AltDown, MetaDown ); m_grid->GetEventHandler()->ProcessEvent(gridEvt); break; } @@ -760,7 +766,6 @@ void wxGridSelection::ToggleCellSelection( int row, int col, void wxGridSelection::ClearSelection() { - // Should this send deselection events? size_t n; // deselect all invidiual cells and update the screen @@ -823,6 +828,19 @@ void wxGridSelection::ClearSelection() ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r ); } } + + // One deselection event, indicating deselection of _all_ cells. + // (No finer grained events for each of the smaller regions + // deselected above!) + wxGridRangeSelectEvent gridEvt( m_grid->GetId(), + wxEVT_GRID_RANGE_SELECT, + m_grid, + wxGridCellCoords( 0, 0 ), + wxGridCellCoords( m_grid->GetNumberRows() - 1, + m_grid->GetNumberCols() - 1 ), + FALSE ); + + m_grid->GetEventHandler()->ProcessEvent(gridEvt); } @@ -926,6 +944,10 @@ void wxGridSelection::UpdateRows( size_t pos, int numRows ) } } } + // No need to touch selected columns, unless we removed _all_ + // rows, in this case, we remove all columns from the selection. + if ( !m_grid->GetNumberRows() ) + m_colSelection.Clear(); } void wxGridSelection::UpdateCols( size_t pos, int numCols ) @@ -1028,6 +1050,11 @@ void wxGridSelection::UpdateCols( size_t pos, int numCols ) } } } + + // No need to touch selected rows, unless we removed _all_ + // columns, in this case, we remove all rows from the selection. + if ( !m_grid->GetNumberCols() ) + m_rowSelection.Clear(); } int wxGridSelection::BlockContain( int topRow1, int leftCol1, diff --git a/src/generic/helpext.cpp b/src/generic/helpext.cpp index 838d373f04..8f6276fb25 100644 --- a/src/generic/helpext.cpp +++ b/src/generic/helpext.cpp @@ -81,7 +81,7 @@ void wxExtHelpController::SetViewer(const wxString& viewer, long flags) } bool -wxExtHelpController::DisplayHelp(wxString const &relativeURL) +wxExtHelpController::DisplayHelp(const wxString &relativeURL) { wxBusyCursor b; // display a busy cursor @@ -89,7 +89,7 @@ wxExtHelpController::DisplayHelp(wxString const &relativeURL) #if defined(__WXMSW__) wxString url; url << m_MapFile << '\\' << relativeURL.BeforeFirst('#'); - bool bOk = (int)ShellExecute(NULL, "open", url, + bool bOk = (int)ShellExecute(NULL, wxT("open"), url.c_str(), NULL, NULL, SW_SHOWNORMAL ) > 32; if ( !bOk ) { diff --git a/src/generic/helphtml.cpp b/src/generic/helphtml.cpp index f8731d8d17..2005af7c14 100644 --- a/src/generic/helphtml.cpp +++ b/src/generic/helphtml.cpp @@ -166,7 +166,7 @@ wxHTMLHelpControllerBase::LoadFile(const wxString& ifile) m_MapList = new wxList; m_NumOfEntries = 0; - FILE *input = fopen(mapFile.fn_str(),"rt"); + FILE *input = wxFopen(mapFile.fn_str(),wxT("rt")); if(! input) return FALSE; do @@ -251,6 +251,16 @@ wxHTMLHelpControllerBase::DisplaySection(int sectionNo) return FALSE; } +bool wxHTMLHelpControllerBase::DisplaySection(const wxString& section) +{ + bool isFilename = (section.Find(wxT(".htm")) != -1); + + if (isFilename) + return DisplayHelp(section); + else + return KeywordSearch(section); +} + bool wxHTMLHelpControllerBase::DisplayBlock(long blockNo) { diff --git a/src/generic/helpwxht.cpp b/src/generic/helpwxht.cpp index 955dcd87e8..9218355067 100644 --- a/src/generic/helpwxht.cpp +++ b/src/generic/helpwxht.cpp @@ -19,15 +19,16 @@ # pragma hdrstop #endif -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifndef WX_PRECOMP -# include "wx/string.h" -# include "wx/utils.h" -# include "wx/list.h" -# include "wx/intl.h" -# include "wx/layout.h" -# include "wx/combobox.h" + #include "wx/string.h" + #include "wx/utils.h" + #include "wx/list.h" + #include "wx/intl.h" + #include "wx/layout.h" + #include "wx/combobox.h" + #include "wx/button.h" #endif #include "wx/helpbase.h" @@ -266,7 +267,7 @@ wxHelpControllerHtml::~wxHelpControllerHtml(void) #endif bool -wxHelpControllerHtml::DisplayHelp(wxString const &relativeURL) +wxHelpControllerHtml::DisplayHelp(const wxString &relativeURL) { wxBusyCursor b; // display a busy cursor diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 92d7369c70..12f621afce 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: imaglist.cpp +// Name: generic/imaglist.cpp // Purpose: // Author: Robert Roebling // Id: $id$ // Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -28,11 +28,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject) -wxImageList::wxImageList( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) ) +wxImageList::wxImageList( int width, int height, bool mask, int initialCount ) { - m_width = width; - m_height = height; - Create(); + (void)Create(width, height, mask, initialCount); } wxImageList::~wxImageList() @@ -44,6 +42,14 @@ int wxImageList::GetImageCount() const return m_images.Number(); } +bool wxImageList::Create( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) ) +{ + m_width = width; + m_height = height; + + return Create(); +} + bool wxImageList::Create() { m_images.DeleteContents( TRUE ); diff --git a/src/generic/laywin.cpp b/src/generic/laywin.cpp index 2c9afa2c7d..409814e682 100644 --- a/src/generic/laywin.cpp +++ b/src/generic/laywin.cpp @@ -41,9 +41,13 @@ BEGIN_EVENT_TABLE(wxSashLayoutWindow, wxSashWindow) EVT_QUERY_LAYOUT_INFO(wxSashLayoutWindow::OnQueryLayoutInfo) END_EVENT_TABLE() -wxSashLayoutWindow::wxSashLayoutWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, - const wxSize& size, long style, const wxString& name): - wxSashWindow(parent, id, pos, size, style, name) +bool wxSashLayoutWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, + const wxSize& size, long style, const wxString& name) +{ + return wxSashWindow::Create(parent, id, pos, size, style, name); +} + +void wxSashLayoutWindow::Init() { m_orientation = wxLAYOUT_HORIZONTAL; m_alignment = wxLAYOUT_TOP; @@ -153,7 +157,15 @@ void wxSashLayoutWindow::OnCalculateLayout(wxCalculateLayoutEvent& event) { // If not in query mode, resize the window. // TODO: add wxRect& form to wxWindow::SetSize + wxSize sz = GetSize(); + wxPoint pos = GetPosition(); SetSize(thisRect.x, thisRect.y, thisRect.width, thisRect.height); + + // Make sure the sash is erased when the window is resized + if ((pos.x != thisRect.x || pos.y != thisRect.y || sz.x != thisRect.width || sz.y != thisRect.height) && + (GetSashVisible(wxSASH_TOP) || GetSashVisible(wxSASH_RIGHT) || GetSashVisible(wxSASH_BOTTOM) || GetSashVisible(wxSASH_LEFT))) + Refresh(TRUE); + } event.SetRect(clientSize); @@ -242,11 +254,14 @@ bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow) { wxWindow* win = (wxWindow*) node->Data(); - event.SetId(win->GetId()); - event.SetEventObject(win); - event.SetFlags(0); // ?? + if (win != mainWindow) + { + event.SetId(win->GetId()); + event.SetEventObject(win); + event.SetFlags(0); // ?? - win->GetEventHandler()->ProcessEvent(event); + win->GetEventHandler()->ProcessEvent(event); + } node = node->Next(); } diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 693fd0e078..63e50fb380 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -23,6 +23,7 @@ #include "wx/app.h" #include "wx/listctrl.h" #include "wx/generic/imaglist.h" +#include "wx/dynarray.h" #ifndef wxUSE_GENERIC_LIST_EXTENSIONS #define wxUSE_GENERIC_LIST_EXTENSIONS 1 @@ -107,7 +108,7 @@ public: int GetImage() const; int GetWidth() const; int GetFormat() const; - + private: DECLARE_DYNAMIC_CLASS(wxListHeaderData); }; @@ -157,7 +158,7 @@ public: bool IsHilighted(); void AssignRect( wxRect &dest, int x, int y, int width, int height ); void AssignRect( wxRect &dest, const wxRect &source ); - + private: void SetAttributes(wxDC *dc, const wxListItemAttr *attr, @@ -167,6 +168,11 @@ private: DECLARE_DYNAMIC_CLASS(wxListLineData); }; + +WX_DECLARE_EXPORTED_OBJARRAY(wxListLineData, wxListLineDataArray); +#include "wx/arrimpl.cpp" +WX_DEFINE_OBJARRAY(wxListLineDataArray); + //----------------------------------------------------------------------------- // wxListHeaderWindow (internal) //----------------------------------------------------------------------------- @@ -178,22 +184,40 @@ protected: wxCursor *m_currentCursor; wxCursor *m_resizeCursor; bool m_isDragging; - int m_column; - int m_minX; - int m_currentX; + + // column being resized + int m_column; + + // divider line position in logical (unscrolled) coords + int m_currentX; + + // minimal position beyond which the divider line can't be dragged in + // logical coords + int m_minX; public: wxListHeaderWindow(); - ~wxListHeaderWindow(); - wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner, - const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = 0, const wxString &name = "wxlistctrlcolumntitles" ); + virtual ~wxListHeaderWindow(); + + wxListHeaderWindow( wxWindow *win, + wxWindowID id, + wxListMainWindow *owner, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxString &name = "wxlistctrlcolumntitles" ); + void DoDrawRect( wxDC *dc, int x, int y, int w, int h ); - void OnPaint( wxPaintEvent &event ); void DrawCurrent(); + void AdjustDC(wxDC& dc); + + void OnPaint( wxPaintEvent &event ); void OnMouse( wxMouseEvent &event ); void OnSetFocus( wxFocusEvent &event ); + // needs refresh + bool m_dirty; + private: DECLARE_DYNAMIC_CLASS(wxListHeaderWindow) DECLARE_EVENT_TABLE() @@ -250,7 +274,7 @@ class WXDLLEXPORT wxListMainWindow: public wxScrolledWindow { public: long m_mode; - wxList m_lines; + wxListLineDataArray m_lines; wxList m_columns; wxListLineData *m_current; wxListLineData *m_currentEdit; @@ -307,7 +331,7 @@ public: void OnKillFocus( wxFocusEvent &event ); void OnSize( wxSizeEvent &event ); void OnScroll(wxScrollWinEvent& event) ; - + void DrawImage( int index, wxDC *dc, int x, int y ); void GetImageSize( int index, int &width, int &height ); int GetIndexOfLine( const wxListLineData *line ); @@ -631,12 +655,12 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing ) if (lh < 15) lh = 15; lw += 4; lh += 3; - + m_bound_all.height = m_spacing+lh; if (lw > m_spacing) m_bound_all.width = lw; m_bound_label.width = lw; m_bound_label.height = lh; - + if (item->HasImage()) { int w = 0; @@ -644,8 +668,13 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing ) m_owner->GetImageSize( item->GetImage(), w, h ); m_bound_icon.width = w + 8; m_bound_icon.height = h + 8; + + if ( m_bound_icon.width > m_bound_all.width ) + m_bound_all.width = m_bound_icon.width; + if ( h + lh > m_bound_all.height - 4 ) + m_bound_all.height = h + lh + 4; } - + if (!item->HasText()) { m_bound_hilight.width = m_bound_icon.width; @@ -665,7 +694,7 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing ) if (node) { wxListItemData *item = (wxListItemData*)node->Data(); - + wxString s = item->GetText(); if (s.IsEmpty()) s = wxT("H"); wxCoord lw,lh; @@ -675,10 +704,10 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing ) lh += 3; m_bound_label.width = lw; m_bound_label.height = lh; - + m_bound_all.width = lw; m_bound_all.height = lh; - + if (item->HasImage()) { int w = 0; @@ -686,11 +715,11 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing ) m_owner->GetImageSize( item->GetImage(), w, h ); m_bound_icon.width = w; m_bound_icon.height = h; - + m_bound_all.width += 4 + w; if (h > m_bound_all.height) m_bound_all.height = h; } - + m_bound_hilight.width = m_bound_all.width; m_bound_hilight.height = m_bound_all.height; } @@ -711,7 +740,7 @@ void wxListLineData::CalculateSize( wxDC *dc, int spacing ) if (lh < 15) lh = 15; lw += 4; lh += 3; - + item->SetSize( item->GetWidth(), lh ); m_bound_all.width += lw; m_bound_all.height = lh; @@ -737,7 +766,8 @@ void wxListLineData::SetPosition( wxDC * WXUNUSED(dc), wxListItemData *item = (wxListItemData*)node->Data(); if (item->HasImage()) { - m_bound_icon.x = m_bound_all.x + 4 + (m_spacing/2) - (m_bound_icon.width/2); + m_bound_icon.x = m_bound_all.x + 4 + + (m_spacing - m_bound_icon.width)/2; m_bound_icon.y = m_bound_all.y + 4; } if (item->HasText()) @@ -1131,6 +1161,8 @@ wxListHeaderWindow::wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMain m_currentCursor = (wxCursor *) NULL; m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE ); m_isDragging = FALSE; + m_dirty = FALSE; + SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) ); } @@ -1162,64 +1194,75 @@ void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h ) dc->DrawLine( x+w-1, y, x+w-1, y+1 ); } +// shift the DC origin to match the position of the main window horz +// scrollbar: this allows us to always use logical coords +void wxListHeaderWindow::AdjustDC(wxDC& dc) +{ +#if wxUSE_GENERIC_LIST_EXTENSIONS + int xpix; + m_owner->GetScrollPixelsPerUnit( &xpix, NULL ); + + int x; + m_owner->GetViewStart( &x, NULL ); + + // account for the horz scrollbar offset + dc.SetDeviceOrigin( -x * xpix, 0 ); +#endif // wxUSE_GENERIC_LIST_EXTENSIONS +} + void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc( this ); PrepareDC( dc ); -#if wxUSE_GENERIC_LIST_EXTENSIONS - if ( m_owner->GetMode() & wxLC_REPORT ) - { - int x , y ; - int xpix , ypix ; + AdjustDC( dc ); - m_owner->GetScrollPixelsPerUnit( &xpix , &ypix ) ; - m_owner->ViewStart( &x, &y ) ; - dc.SetDeviceOrigin( -x * xpix, 0 ); - } -#endif dc.BeginDrawing(); dc.SetFont( GetFont() ); - int w = 0; - int h = 0; - int x = 0; - int y = 0; + // width and height of the entire header window + int w, h; GetClientSize( &w, &h ); +#if wxUSE_GENERIC_LIST_EXTENSIONS + m_owner->CalcUnscrolledPosition(w, 0, &w, NULL); +#endif // wxUSE_GENERIC_LIST_EXTENSIONS dc.SetBackgroundMode(wxTRANSPARENT); - dc.SetTextForeground( *wxBLACK ); // do *not* use the listctrl colour for headers - one day we will have a // function to set it separately + dc.SetTextForeground( *wxBLACK ); - x = 1; - y = 1; + int x = 1; // left of the header rect + const int y = 1; // top int numColumns = m_owner->GetColumnCount(); wxListItem item; for (int i = 0; i < numColumns; i++) { m_owner->GetColumn( i, item ); - int cw = item.m_width-2; -#if wxUSE_GENERIC_LIST_EXTENSIONS - if ((i+1 == numColumns) || ( dc.LogicalToDeviceX(x+item.m_width) > w-5)) - cw = dc.DeviceToLogicalX(w)-x-1; -#else - if ((i+1 == numColumns) || (x+item.m_width > w-5)) + int wCol = item.m_width; + int cw = wCol - 2; // the width of the rect to draw + + int xEnd = x + wCol; + + // VZ: no, draw it normally - this is better now as we allow resizing + // of the last column as well +#if 0 + // let the last column occupy all available space + if ( i == numColumns - 1 ) cw = w-x-1; -#endif +#endif // 0 + dc.SetPen( *wxWHITE_PEN ); DoDrawRect( &dc, x, y, cw, h-2 ); dc.SetClippingRegion( x, y, cw-5, h-4 ); dc.DrawText( item.m_text, x+4, y+3 ); dc.DestroyClippingRegion(); - x += item.m_width; -#if wxUSE_GENERIC_LIST_EXTENSIONS - if (dc.LogicalToDeviceX(x) > w+5) break; -#else - if (x > w+5) break; -#endif + x += wCol; + + if (xEnd > w+5) + break; } dc.EndDrawing(); } @@ -1228,11 +1271,11 @@ void wxListHeaderWindow::DrawCurrent() { int x1 = m_currentX; int y1 = 0; + ClientToScreen( &x1, &y1 ); + int x2 = m_currentX-1; int y2 = 0; - int dummy; - m_owner->GetClientSize( &dummy, &y2 ); - ClientToScreen( &x1, &y1 ); + m_owner->GetClientSize( NULL, &y2 ); m_owner->ClientToScreen( &x2, &y2 ); wxScreenDC dc; @@ -1240,6 +1283,8 @@ void wxListHeaderWindow::DrawCurrent() dc.SetPen( wxPen( *wxBLACK, 2, wxSOLID ) ); dc.SetBrush( *wxTRANSPARENT_BRUSH ); + AdjustDC(dc); + dc.DrawLine( x1, y1, x2, y2 ); dc.SetLogicalFunction( wxCOPY ); @@ -1250,82 +1295,114 @@ void wxListHeaderWindow::DrawCurrent() void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) { - wxCoord x = (wxCoord)event.GetX(); - wxCoord y = (wxCoord)event.GetY(); + // we want to work with logical coords +#if wxUSE_GENERIC_LIST_EXTENSIONS + int x, y; + m_owner->CalcUnscrolledPosition(event.GetX(), event.GetY(), &x, &y); +#else // !wxUSE_GENERIC_LIST_EXTENSIONS + int x = event.GetX(); + int y = event.GetY(); +#endif // wxUSE_GENERIC_LIST_EXTENSIONS + if (m_isDragging) { - DrawCurrent(); + // we don't draw the line beyond our window, but we allow dragging it + // there + int w = 0; + GetClientSize( &w, NULL ); +#if wxUSE_GENERIC_LIST_EXTENSIONS + m_owner->CalcUnscrolledPosition(w, 0, &w, NULL); +#endif // wxUSE_GENERIC_LIST_EXTENSIONS + w -= 6; + + // erase the line if it was drawn + if ( m_currentX < w ) + DrawCurrent(); + if (event.ButtonUp()) { ReleaseMouse(); m_isDragging = FALSE; - m_owner->SetColumnWidth( m_column, m_currentX-m_minX ); + m_dirty = TRUE; + m_owner->SetColumnWidth( m_column, m_currentX - m_minX ); } else { - int size_x = 0; - int dummy; - GetClientSize( &size_x, & dummy ); - if (x > m_minX+7) + if (x > m_minX + 7) m_currentX = x; else - m_currentX = m_minX+7; - if (m_currentX > size_x-7) m_currentX = size_x-7; - DrawCurrent(); - } - return; - } + m_currentX = m_minX + 7; - m_minX = 0; - bool hit_border = FALSE; - int xpos = 0; - for (int j = 0; j < m_owner->GetColumnCount(); j++) - { - xpos += m_owner->GetColumnWidth( j ); - m_column = j; - if ((abs(x-xpos) < 3) && (y < 22) && (m_column < m_owner->GetColumnCount()-1)) - { - hit_border = TRUE; - break; - } - if (x-xpos < 0) - { - break; + // draw in the new location + if ( m_currentX < w ) + DrawCurrent(); } - m_minX = xpos; } - - if (event.LeftDown()) + else // not dragging { - if (hit_border) - { - m_isDragging = TRUE; - m_currentX = x; - DrawCurrent(); - CaptureMouse(); - return; - } - else + m_minX = 0; + bool hit_border = FALSE; + + // end of the current column + int xpos = 0; + + // find the column where this event occured + int countCol = m_owner->GetColumnCount(); + for (int j = 0; j < countCol; j++) { - wxListEvent le( wxEVT_COMMAND_LIST_COL_CLICK, GetParent()->GetId() ); - le.SetEventObject( GetParent() ); - le.m_col = m_column; - GetParent()->GetEventHandler()->ProcessEvent( le ); - return; + xpos += m_owner->GetColumnWidth( j ); + m_column = j; + + if ( (abs(x-xpos) < 3) && (y < 22) ) + { + // near the column border + hit_border = TRUE; + break; + } + + if ( x < xpos ) + { + // inside the column + break; + } + + m_minX = xpos; } - } - if (event.Moving()) - { - if (hit_border) + if (event.LeftDown()) { - if (m_currentCursor == wxSTANDARD_CURSOR) SetCursor( * m_resizeCursor ); - m_currentCursor = m_resizeCursor; + if (hit_border) + { + m_isDragging = TRUE; + m_currentX = x; + DrawCurrent(); + CaptureMouse(); + } + else + { + wxWindow *parent = GetParent(); + wxListEvent le( wxEVT_COMMAND_LIST_COL_CLICK, parent->GetId() ); + le.SetEventObject( parent ); + le.m_col = m_column; + parent->GetEventHandler()->ProcessEvent( le ); + } } - else + else if (event.Moving()) { - if (m_currentCursor != wxSTANDARD_CURSOR) SetCursor( * wxSTANDARD_CURSOR ); - m_currentCursor = wxSTANDARD_CURSOR; + bool setCursor; + if (hit_border) + { + setCursor = m_currentCursor == wxSTANDARD_CURSOR; + m_currentCursor = m_resizeCursor; + } + else + { + setCursor = m_currentCursor != wxSTANDARD_CURSOR; + m_currentCursor = wxSTANDARD_CURSOR; + } + + if ( setCursor ) + SetCursor(*m_currentCursor); } } } @@ -1387,26 +1464,26 @@ void wxListTextCtrl::OnChar( wxKeyEvent &event ) { (*m_accept) = TRUE; (*m_res) = GetValue(); - + if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); if ((*m_accept) && ((*m_res) != m_startValue)) m_owner->OnRenameAccept(); - + return; } if (event.m_keyCode == WXK_ESCAPE) { (*m_accept) = FALSE; (*m_res) = ""; - + if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); - + return; } - + event.Skip(); } @@ -1439,7 +1516,6 @@ END_EVENT_TABLE() wxListMainWindow::wxListMainWindow() { m_mode = 0; - m_lines.DeleteContents( TRUE ); m_columns.DeleteContents( TRUE ); m_current = (wxListLineData *) NULL; m_visibleLines = 0; @@ -1468,7 +1544,6 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id, wxScrolledWindow( parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name ) { m_mode = style; - m_lines.DeleteContents( TRUE ); m_columns.DeleteContents( TRUE ); m_current = (wxListLineData *) NULL; m_dirty = TRUE; @@ -1522,7 +1597,7 @@ void wxListMainWindow::RefreshLine( wxListLineData *line ) if (m_dirty) return; if (!line) return; - + int x = 0; int y = 0; int w = 0; @@ -1551,32 +1626,24 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) if (m_mode & wxLC_REPORT) { int lineSpacing = 0; - wxListLineData *line = (wxListLineData*)m_lines.First()->Data(); + wxListLineData *line = &m_lines[0]; int dummy = 0; line->GetSize( dummy, lineSpacing ); lineSpacing += 1; int y_s = m_yScroll*GetScrollPos( wxVERTICAL ); - wxNode *node = m_lines.Nth( y_s / lineSpacing ); - for (int i = 0; i < m_visibleLines+2; i++) + size_t i_to = y_s / lineSpacing + m_visibleLines+2; + if (i_to >= m_lines.GetCount()) i_to = m_lines.GetCount(); + for (size_t i = y_s / lineSpacing; i < i_to; i++) { - if (!node) break; - - line = (wxListLineData*)node->Data(); - line->Draw( &dc ); - node = node->Next(); + m_lines[i].Draw( &dc ); } } else { - wxNode *node = m_lines.First(); - while (node) - { - wxListLineData *line = (wxListLineData*)node->Data(); - line->Draw( &dc ); - node = node->Next(); - } + for (size_t i = 0; i < m_lines.GetCount(); i++) + m_lines[i].Draw( &dc ); } if (m_current) m_current->DrawRubberBand( &dc, m_hasFocus ); @@ -1586,16 +1653,14 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) void wxListMainWindow::HilightAll( bool on ) { - wxNode *node = m_lines.First(); - while (node) + for (size_t i = 0; i < m_lines.GetCount(); i++) { - wxListLineData *line = (wxListLineData *)node->Data(); + wxListLineData *line = &m_lines[i]; if (line->IsHilighted() != on) { line->Hilight( on ); RefreshLine( line ); } - node = node->Next(); } } @@ -1638,10 +1703,10 @@ void wxListMainWindow::DeleteLine( wxListLineData *line ) void wxListMainWindow::EditLabel( long item ) { - wxNode *node = m_lines.Nth( (size_t)item ); - wxCHECK_RET( node, wxT("wrong index in wxListCtrl::Edit()") ); + wxCHECK_RET( ((size_t)item < m_lines.GetCount()), + wxT("wrong index in wxListCtrl::Edit()") ); - m_currentEdit = (wxListLineData*) node->Data(); + m_currentEdit = &m_lines[(size_t)item]; wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, GetParent()->GetId() ); le.SetEventObject( GetParent() ); @@ -1679,7 +1744,7 @@ void wxListMainWindow::OnRenameTimer() { wxCHECK_RET( m_current, wxT("invalid m_current") ); - Edit( m_lines.IndexOf( m_current ) ); + Edit( m_lines.Index( *m_current ) ); } void wxListMainWindow::OnRenameAccept() @@ -1715,15 +1780,13 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) /* Did we actually hit an item ? */ long hitResult = 0; - wxNode *node = m_lines.First(); wxListLineData *line = (wxListLineData *) NULL; - while (node) + for (size_t i = 0; i < m_lines.GetCount(); i++) { - line = (wxListLineData*)node->Data(); + line = &m_lines[i]; hitResult = line->IsHit( x, y ); if (hitResult) break; line = (wxListLineData *) NULL; - node = node->Next(); } if (event.Dragging()) @@ -1823,26 +1886,25 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) } else if (event.ShiftDown()) { + size_t j; + m_current = line; int numOfCurrent = -1; - node = m_lines.First(); - while (node) + for (j = 0; j < m_lines.GetCount(); j++) { - wxListLineData *test_line = (wxListLineData*)node->Data(); + wxListLineData *test_line = &m_lines[j]; numOfCurrent++; if (test_line == oldCurrent) break; - node = node->Next(); } int numOfLine = -1; - node = m_lines.First(); - while (node) + + for (j = 0; j < m_lines.GetCount(); j++) { - wxListLineData *test_line = (wxListLineData*)node->Data(); + wxListLineData *test_line = &m_lines[j]; numOfLine++; if (test_line == line) break; - node = node->Next(); } if (numOfLine < numOfCurrent) @@ -1852,13 +1914,11 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) numOfCurrent = i; } - wxNode *node = m_lines.Nth( numOfCurrent ); for (int i = 0; i <= numOfLine-numOfCurrent; i++) { - wxListLineData *test_line= (wxListLineData*)node->Data(); + wxListLineData *test_line= &m_lines[numOfCurrent + i]; test_line->Hilight(TRUE); RefreshLine( test_line ); - node = node->Next(); } } else @@ -1896,22 +1956,22 @@ void wxListMainWindow::MoveToFocus() int client_w = 0; int client_h = 0; GetClientSize( &client_w, &client_h ); - + int view_x = m_xScroll*GetScrollPos( wxHORIZONTAL ); int view_y = m_yScroll*GetScrollPos( wxVERTICAL ); if (m_mode & wxLC_REPORT) { - if (item_y-5 < view_y ) - Scroll( -1, (item_y-5)/m_yScroll ); - if (item_y+item_h+5 > view_y+client_h) + if (item_y-5 < view_y ) + Scroll( -1, (item_y-5)/m_yScroll ); + if (item_y+item_h+5 > view_y+client_h) Scroll( -1, (item_y+item_h-client_h+15)/m_yScroll ); } else { - if (item_x-view_x < 5) + if (item_x-view_x < 5) Scroll( (item_x-5)/m_xScroll, -1 ); - if (item_x+item_w-5 > view_x+client_w) + if (item_x+item_w-5 > view_x+client_w) Scroll( (item_x+item_w-client_w+15)/m_xScroll, -1 ); } } @@ -1953,10 +2013,15 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) wxWindow *parent = GetParent(); /* we send a list_key event up */ - wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() ); - le.m_code = (int)event.KeyCode(); - le.SetEventObject( parent ); - parent->GetEventHandler()->ProcessEvent( le ); + if ( m_current ) + { + wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() ); + le.m_itemIndex = GetIndexOfLine( m_current ); + m_current->GetItem( 0, le.m_item ); + le.m_code = (int)event.KeyCode(); + le.SetEventObject( parent ); + parent->GetEventHandler()->ProcessEvent( le ); + } /* we propagate the char event up */ wxKeyEvent ke( wxEVT_CHAR ); @@ -1991,72 +2056,83 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) { case WXK_UP: { - wxNode *node = m_lines.Member( m_current )->Previous(); - if (node) OnArrowChar( (wxListLineData*)node->Data(), event.ShiftDown() ); + int index = m_lines.Index(*m_current); + if (index != wxNOT_FOUND && index > 0) + OnArrowChar( &m_lines[index-1], event.ShiftDown() ); break; } case WXK_DOWN: { - wxNode *node = m_lines.Member( m_current )->Next(); - if (node) OnArrowChar( (wxListLineData*)node->Data(), event.ShiftDown() ); + int index = m_lines.Index(*m_current); + if (index != wxNOT_FOUND && (size_t)index < m_lines.GetCount()-1) + OnArrowChar( &m_lines[index+1], event.ShiftDown() ); break; } case WXK_END: { - wxNode *node = m_lines.Last(); - OnArrowChar( (wxListLineData*)node->Data(), event.ShiftDown() ); + if (!m_lines.IsEmpty()) + OnArrowChar( &m_lines.Last(), event.ShiftDown() ); break; } case WXK_HOME: { - wxNode *node = m_lines.First(); - OnArrowChar( (wxListLineData*)node->Data(), event.ShiftDown() ); + if (!m_lines.IsEmpty()) + OnArrowChar( &m_lines[0], event.ShiftDown() ); break; } case WXK_PRIOR: { int steps = 0; + int index = m_lines.Index(*m_current); if (m_mode & wxLC_REPORT) { steps = m_visibleLines-1; } else { - int pos = 0; - wxNode *node = m_lines.First(); - for (;;) { if (m_current == (wxListLineData*)node->Data()) break; pos++; node = node->Next(); } - steps = pos % m_visibleLines; + steps = index % m_visibleLines; + } + if (index != wxNOT_FOUND) + { + index -= steps; + if (index < 0) index = 0; + OnArrowChar( &m_lines[index], event.ShiftDown() ); } - wxNode *node = m_lines.Member( m_current ); - for (int i = 0; i < steps; i++) if (node->Previous()) node = node->Previous(); - if (node) OnArrowChar( (wxListLineData*)node->Data(), event.ShiftDown() ); break; } case WXK_NEXT: { int steps = 0; + int index = m_lines.Index(*m_current); if (m_mode & wxLC_REPORT) { steps = m_visibleLines-1; } else { - int pos = 0; wxNode *node = m_lines.First(); - for (;;) { if (m_current == (wxListLineData*)node->Data()) break; pos++; node = node->Next(); } - steps = m_visibleLines-(pos % m_visibleLines)-1; + steps = m_visibleLines-(index % m_visibleLines)-1; + } + + if (index != wxNOT_FOUND) + { + index += steps; + if ((size_t)index >= m_lines.GetCount()) + index = m_lines.GetCount()-1; + OnArrowChar( &m_lines[index], event.ShiftDown() ); } - wxNode *node = m_lines.Member( m_current ); - for (int i = 0; i < steps; i++) if (node->Next()) node = node->Next(); - if (node) OnArrowChar( (wxListLineData*)node->Data(), event.ShiftDown() ); break; } case WXK_LEFT: { if (!(m_mode & wxLC_REPORT)) { - wxNode *node = m_lines.Member( m_current ); - for (int i = 0; i <m_visibleLines; i++) if (node->Previous()) node = node->Previous(); - if (node) OnArrowChar( (wxListLineData*)node->Data(), event.ShiftDown() ); + int index = m_lines.Index(*m_current); + if (index != wxNOT_FOUND) + { + index -= m_visibleLines; + if (index < 0) index = 0; + OnArrowChar( &m_lines[index], event.ShiftDown() ); + } } break; } @@ -2064,9 +2140,14 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) { if (!(m_mode & wxLC_REPORT)) { - wxNode *node = m_lines.Member( m_current ); - for (int i = 0; i <m_visibleLines; i++) if (node->Next()) node = node->Next(); - if (node) OnArrowChar( (wxListLineData*)node->Data(), event.ShiftDown() ); + int index = m_lines.Index(*m_current); + if (index != wxNOT_FOUND) + { + index += m_visibleLines; + if ((size_t)index >= m_lines.GetCount()) + index = m_lines.GetCount()-1; + OnArrowChar( &m_lines[index], event.ShiftDown() ); + } } break; } @@ -2093,8 +2174,9 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) { wxListLineData *oldCurrent = m_current; m_current->ReverseHilight(); - wxNode *node = m_lines.Member( m_current )->Next(); - if (node) m_current = (wxListLineData*)node->Data(); + int index = m_lines.Index( *m_current ) + 1; + if ( (size_t)index < m_lines.GetCount() ) + m_current = &m_lines[index]; RefreshLine( oldCurrent ); RefreshLine( m_current ); UnfocusLine( oldCurrent ); @@ -2216,22 +2298,34 @@ int wxListMainWindow::GetTextLength( wxString &s ) int wxListMainWindow::GetIndexOfLine( const wxListLineData *line ) { - int i = 0; - wxNode *node = m_lines.First(); - while (node) - { - if (line == (wxListLineData*)node->Data()) return i; - i++; - node = node->Next(); - } - return -1; + int i = m_lines.Index(*line); + if (i == wxNOT_FOUND) return -1; + else return i; } void wxListMainWindow::SetImageList( wxImageList *imageList, int which ) { m_dirty = TRUE; - if (which == wxIMAGE_LIST_NORMAL) m_normal_image_list = imageList; - if (which == wxIMAGE_LIST_SMALL) m_small_image_list = imageList; + + // calc the spacing from the icon size + int width = 0, + height = 0; + if ((imageList) && (imageList->GetImageCount()) ) + { + imageList->GetSize(0, width, height); + } + + if (which == wxIMAGE_LIST_NORMAL) + { + m_normal_image_list = imageList; + m_normal_spacing = width + 8; + } + + if (which == wxIMAGE_LIST_SMALL) + { + m_small_image_list = imageList; + m_small_spacing = width + 14; + } } void wxListMainWindow::SetItemSpacing( int spacing, bool isSmall ) @@ -2249,7 +2343,7 @@ void wxListMainWindow::SetItemSpacing( int spacing, bool isSmall ) int wxListMainWindow::GetItemSpacing( bool isSmall ) { - if (isSmall) return m_small_spacing; else return m_normal_spacing; + return isSmall ? m_small_spacing : m_normal_spacing; } void wxListMainWindow::SetColumn( int col, wxListItem &item ) @@ -2262,28 +2356,35 @@ void wxListMainWindow::SetColumn( int col, wxListItem &item ) wxListHeaderData *column = (wxListHeaderData*)node->Data(); column->SetItem( item ); } - wxListCtrl *lc = (wxListCtrl*) GetParent(); - if (lc->m_headerWin) lc->m_headerWin->Refresh(); + + wxListHeaderWindow *headerWin = ((wxListCtrl*) GetParent())->m_headerWin; + if ( headerWin ) + headerWin->m_dirty = TRUE; } void wxListMainWindow::SetColumnWidth( int col, int width ) { - if (!(m_mode & wxLC_REPORT)) return; + wxCHECK_RET( m_mode & wxLC_REPORT, + _T("SetColumnWidth() can only be called in report mode.") ); m_dirty = TRUE; wxNode *node = (wxNode*) NULL; - if (width == wxLIST_AUTOSIZE_USEHEADER) width = 80; - if (width == wxLIST_AUTOSIZE) + if (width == wxLIST_AUTOSIZE_USEHEADER) + { + // TODO do use the header + width = 80; + } + else if (width == wxLIST_AUTOSIZE) { wxClientDC dc(this); dc.SetFont( GetFont() ); int max = 10; - node = m_lines.First(); - while (node) + + for (size_t i = 0; i < m_lines.GetCount(); i++) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[i]; wxNode *n = line->m_items.Nth( col ); if (n) { @@ -2304,7 +2405,6 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) } if (current > max) max = current; } - node = node->Next(); } width = max+10; } @@ -2316,21 +2416,20 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) column->SetWidth( width ); } - node = m_lines.First(); - while (node) + for (size_t i = 0; i < m_lines.GetCount(); i++) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[i]; wxNode *n = line->m_items.Nth( col ); if (n) { wxListItemData *item = (wxListItemData*)n->Data(); item->SetSize( width, -1 ); } - node = node->Next(); } - wxListCtrl *lc = (wxListCtrl*) GetParent(); - if (lc->m_headerWin) lc->m_headerWin->Refresh(); + wxListHeaderWindow *headerWin = ((wxListCtrl*) GetParent())->m_headerWin; + if ( headerWin ) + headerWin->m_dirty = TRUE; } void wxListMainWindow::GetColumn( int col, wxListItem &item ) @@ -2378,10 +2477,9 @@ int wxListMainWindow::GetCountPerPage() void wxListMainWindow::SetItem( wxListItem &item ) { m_dirty = TRUE; - wxNode *node = m_lines.Nth( (size_t)item.m_itemId ); - if (node) + if (item.m_itemId >= 0 && (size_t)item.m_itemId < m_lines.GetCount()) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[(size_t)item.m_itemId]; if (m_mode & wxLC_REPORT) item.m_width = GetColumnWidth( item.m_col )-3; line->SetItem( item.m_col, item ); } @@ -2395,10 +2493,9 @@ void wxListMainWindow::SetItemState( long item, long state, long stateMask ) if (stateMask & wxLIST_STATE_FOCUSED) { - wxNode *node = m_lines.Nth( (size_t)item ); - if (node) + if (item >= 0 && (size_t)item < m_lines.GetCount()) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[(size_t)item]; UnfocusLine( m_current ); m_current = line; FocusLine( m_current ); @@ -2412,10 +2509,9 @@ void wxListMainWindow::SetItemState( long item, long state, long stateMask ) bool on = (state & wxLIST_STATE_SELECTED) != 0; if (!on && (m_mode & wxLC_SINGLE_SEL)) return; - wxNode *node = m_lines.Nth( (size_t)item ); - if (node) + if (item >= 0 && (size_t)item < m_lines.GetCount()) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[(size_t)item]; if (m_mode & wxLC_SINGLE_SEL) { UnfocusLine( m_current ); @@ -2440,19 +2536,17 @@ int wxListMainWindow::GetItemState( long item, long stateMask ) int ret = wxLIST_STATE_DONTCARE; if (stateMask & wxLIST_STATE_FOCUSED) { - wxNode *node = m_lines.Nth( (size_t)item ); - if (node) + if (item >= 0 && (size_t)item < m_lines.GetCount()) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[(size_t)item]; if (line == m_current) ret |= wxLIST_STATE_FOCUSED; } } if (stateMask & wxLIST_STATE_SELECTED) { - wxNode *node = m_lines.Nth( (size_t)item ); - if (node) + if (item >= 0 && (size_t)item < m_lines.GetCount()) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[(size_t)item]; if (line->IsHilighted()) ret |= wxLIST_STATE_FOCUSED; } } @@ -2461,10 +2555,9 @@ int wxListMainWindow::GetItemState( long item, long stateMask ) void wxListMainWindow::GetItem( wxListItem &item ) { - wxNode *node = m_lines.Nth( (size_t)item.m_itemId ); - if (node) + if (item.m_itemId >= 0 && (size_t)item.m_itemId < m_lines.GetCount()) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[(size_t)item.m_itemId]; line->GetItem( item.m_col, item ); } else @@ -2478,16 +2571,14 @@ void wxListMainWindow::GetItem( wxListItem &item ) int wxListMainWindow::GetItemCount() { - return m_lines.Number(); + return m_lines.GetCount(); } void wxListMainWindow::GetItemRect( long index, wxRect &rect ) { - wxNode *node = m_lines.Nth( (size_t)index ); - if (node) + if (index >= 0 && (size_t)index < m_lines.GetCount()) { - wxListLineData *line = (wxListLineData*)node->Data(); - line->GetRect( rect ); + m_lines[(size_t)index].GetRect( rect ); } else { @@ -2500,12 +2591,10 @@ void wxListMainWindow::GetItemRect( long index, wxRect &rect ) bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos) { - wxNode *node = m_lines.Nth( (size_t)item ); - if (node) + if (item >= 0 && (size_t)item < m_lines.GetCount()) { wxRect rect; - wxListLineData *line = (wxListLineData*)node->Data(); - line->GetRect( rect ); + m_lines[(size_t)item].GetRect( rect ); pos.x = rect.x; pos.y = rect.y; } @@ -2520,12 +2609,9 @@ bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos) int wxListMainWindow::GetSelectedItemCount() { int ret = 0; - wxNode *node = m_lines.First(); - while (node) + for (size_t i = 0; i < m_lines.GetCount(); i++) { - wxListLineData *line = (wxListLineData*)node->Data(); - if (line->IsHilighted()) ret++; - node = node->Next(); + if (m_lines[i].IsHilighted()) ret++; } return ret; } @@ -2560,7 +2646,7 @@ long wxListMainWindow::GetMode() const void wxListMainWindow::CalculatePositions() { - if (!m_lines.First()) return; + if (m_lines.IsEmpty()) return; wxClientDC dc( this ); dc.SetFont( GetFont() ); @@ -2577,7 +2663,7 @@ void wxListMainWindow::CalculatePositions() int lineHeight = 0; int lineSpacing = 0; - wxListLineData *line = (wxListLineData*)m_lines.First()->Data(); + wxListLineData *line = &m_lines[0]; line->CalculateSize( &dc, iconSpacing ); int dummy = 0; line->GetSize( dummy, lineSpacing ); @@ -2590,7 +2676,7 @@ void wxListMainWindow::CalculatePositions() { int x = 4; int y = 1; - int entireHeight = m_lines.Number() * lineSpacing + 2; + int entireHeight = m_lines.GetCount() * lineSpacing + 2; int scroll_pos = GetScrollPos( wxVERTICAL ); #if wxUSE_GENERIC_LIST_EXTENSIONS int x_scroll_pos = GetScrollPos( wxHORIZONTAL ); @@ -2599,11 +2685,10 @@ void wxListMainWindow::CalculatePositions() #endif GetClientSize( &clientWidth, &clientHeight ); - wxNode* node = m_lines.First(); int entireWidth = 0 ; - while (node) + for (size_t j = 0; j < m_lines.GetCount(); j++) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[j]; line->CalculateSize( &dc, iconSpacing ); line->SetPosition( &dc, x, y, clientWidth ); int col_x = 2; @@ -2617,7 +2702,6 @@ void wxListMainWindow::CalculatePositions() line->SetPosition( &dc, x, y, col_x ); #endif y += lineSpacing; // one pixel blank line between items - node = node->Next(); } m_visibleLines = clientHeight / lineSpacing; #if wxUSE_GENERIC_LIST_EXTENSIONS @@ -2643,11 +2727,10 @@ void wxListMainWindow::CalculatePositions() int maxWidth = 0; m_visibleLines = 0; int m_currentVisibleLines = 0; - wxNode *node = m_lines.First(); - while (node) + for (size_t i = 0; i < m_lines.GetCount(); i++) { m_currentVisibleLines++; - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[i]; line->CalculateSize( &dc, iconSpacing ); line->SetPosition( &dc, x, y, clientWidth ); line->GetSize( lineWidth, lineHeight ); @@ -2663,8 +2746,7 @@ void wxListMainWindow::CalculatePositions() entireWidth += maxWidth+6; maxWidth = 0; } - node = node->Next(); - if (!node) entireWidth += maxWidth; + if (i == m_lines.GetCount()-1) entireWidth += maxWidth; if ((tries == 0) && (entireWidth > clientWidth)) { clientHeight -= 15; // scrollbar height @@ -2672,7 +2754,7 @@ void wxListMainWindow::CalculatePositions() m_currentVisibleLines = 0; break; } - if (!node) tries = 1; // everything fits, no second try required + if (i == m_lines.GetCount()-1) tries = 1; // everything fits, no second try required } } @@ -2681,17 +2763,19 @@ void wxListMainWindow::CalculatePositions() } } -void wxListMainWindow::RealizeChanges( void ) +void wxListMainWindow::RealizeChanges() { if (!m_current) { - wxNode *node = m_lines.First(); - if (node) m_current = (wxListLineData*)node->Data(); + if (!m_lines.IsEmpty()) + m_current = &m_lines[0]; } if (m_current) { FocusLine( m_current ); - if (m_mode & wxLC_SINGLE_SEL) m_current->Hilight( TRUE ); + // TODO: MSW doesn't automatically hilight the + // first item. + // if (m_mode & wxLC_SINGLE_SEL) m_current->Hilight( TRUE ); } } @@ -2715,10 +2799,9 @@ long wxListMainWindow::GetNextItem( long item, return -1; } - wxNode *node = m_lines.Nth( (size_t)ret ); - while (node) + for (size_t i = (size_t)ret; i < m_lines.GetCount(); i++) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[i]; if ((state & wxLIST_STATE_FOCUSED) && (line == m_current)) return ret; if ((state & wxLIST_STATE_SELECTED) && (line->IsHilighted())) @@ -2726,8 +2809,6 @@ long wxListMainWindow::GetNextItem( long item, if (!state) return ret; ret++; - - node = node->Next(); } return -1; @@ -2736,13 +2817,12 @@ long wxListMainWindow::GetNextItem( long item, void wxListMainWindow::DeleteItem( long index ) { m_dirty = TRUE; - wxNode *node = m_lines.Nth( (size_t)index ); - if (node) + if (index >= 0 && (size_t)index < m_lines.GetCount()) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[(size_t)index]; if (m_current == line) m_current = (wxListLineData *) NULL; DeleteLine( line ); - m_lines.DeleteNode( node ); + m_lines.RemoveAt( (size_t)index ); } } @@ -2775,7 +2855,7 @@ void wxListMainWindow::DeleteAllItems() void wxListMainWindow::DeleteEverything() { DeleteAllItems(); - + m_columns.Clear(); } @@ -2788,8 +2868,8 @@ void wxListMainWindow::EnsureVisible( long index ) wxListLineData *oldCurrent = m_current; m_current = (wxListLineData *) NULL; - wxNode *node = m_lines.Nth( (size_t)index ); - if (node) m_current = (wxListLineData*)node->Data(); + if (index >= 0 && (size_t)index < m_lines.GetCount()) + m_current = &m_lines[(size_t)index]; if (m_current) MoveToFocus(); m_current = oldCurrent; } @@ -2799,14 +2879,12 @@ long wxListMainWindow::FindItem(long start, const wxString& str, bool WXUNUSED(p long pos = start; wxString tmp = str; if (pos < 0) pos = 0; - wxNode *node = m_lines.Nth( (size_t)pos ); - while (node) + for (size_t i = pos; i < m_lines.GetCount(); i++) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[i]; wxString s = ""; line->GetText( 0, s ); if (s == tmp) return pos; - node = node->Next(); pos++; } return -1; @@ -2816,14 +2894,12 @@ long wxListMainWindow::FindItem(long start, long data) { long pos = start; if (pos < 0) pos = 0; - wxNode *node = m_lines.Nth( (size_t)pos ); - while (node) + for (size_t i = pos; i < m_lines.GetCount(); i++) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[i]; wxListItem item; line->GetItem( 0, item ); if (item.m_data == data) return pos; - node = node->Next(); pos++; } return -1; @@ -2833,18 +2909,16 @@ long wxListMainWindow::HitTest( int x, int y, int &flags ) { CalcUnscrolledPosition( x, y, &x, &y ); - wxNode *node = m_lines.First(); int count = 0; - while (node) + for (size_t i = 0; i < m_lines.GetCount(); i++) { - wxListLineData *line = (wxListLineData*)node->Data(); + wxListLineData *line = &m_lines[i]; long ret = line->IsHit( x, y ); if (ret & flags) { flags = (int)ret; return count; } - node = node->Next(); count++; } return -1; @@ -2872,14 +2946,13 @@ void wxListMainWindow::InsertItem( wxListItem &item ) } line->SetItem( 0, item ); - if ((item.m_itemId >= 0) && (item.m_itemId < (int)m_lines.GetCount())) + if ((item.m_itemId >= 0) && ((size_t)item.m_itemId < m_lines.GetCount())) { - wxNode *node = m_lines.Nth( (size_t)item.m_itemId ); - if (node) m_lines.Insert( node, line ); + m_lines.Insert( line, (size_t)item.m_itemId ); } else { - m_lines.Append( line ); + m_lines.Add( line ); } } @@ -2906,10 +2979,10 @@ void wxListMainWindow::InsertColumn( long col, wxListItem &item ) wxListCtrlCompare list_ctrl_compare_func_2; long list_ctrl_compare_data; -int LINKAGEMODE list_ctrl_compare_func_1( const void *arg1, const void *arg2 ) +int LINKAGEMODE list_ctrl_compare_func_1( wxListLineData **arg1, wxListLineData **arg2 ) { - wxListLineData *line1 = *((wxListLineData**)arg1); - wxListLineData *line2 = *((wxListLineData**)arg2); + wxListLineData *line1 = *arg1; + wxListLineData *line2 = *arg2; wxListItem item; line1->GetItem( 0, item ); long data1 = item.m_data; @@ -3078,10 +3151,10 @@ bool wxListCtrl::Create(wxWindow *parent, { style = style | wxLC_LIST; } - + bool ret = wxControl::Create( parent, id, pos, size, style, validator, name ); - - + + if (style & wxSUNKEN_BORDER) style -= wxSUNKEN_BORDER; @@ -3098,8 +3171,6 @@ bool wxListCtrl::Create(wxWindow *parent, m_headerWin = (wxListHeaderWindow *) NULL; } - SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_LISTBOX ) ); - return ret; } @@ -3558,24 +3629,22 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) ) m_mainWin->RealizeChanges(); m_mainWin->m_dirty = FALSE; m_mainWin->Refresh(); + + if ( m_headerWin && m_headerWin->m_dirty ) + { + m_headerWin->m_dirty = FALSE; + m_headerWin->Refresh(); + } } bool wxListCtrl::SetBackgroundColour( const wxColour &colour ) { - if ( !wxWindow::SetBackgroundColour( colour ) ) - return FALSE; - if (m_mainWin) { m_mainWin->SetBackgroundColour( colour ); m_mainWin->m_dirty = TRUE; } - if (m_headerWin) - { -// m_headerWin->SetBackgroundColour( colour ); - } - return TRUE; } diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index 240ed7169b..1790b09bf5 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -33,6 +33,7 @@ #ifndef WX_PRECOMP #include "wx/app.h" + #include "wx/button.h" #include "wx/intl.h" #include "wx/log.h" #include "wx/menu.h" @@ -42,10 +43,12 @@ #include "wx/textctrl.h" #include "wx/sizer.h" #include "wx/statbmp.h" + #include "wx/button.h" #endif // WX_PRECOMP #include "wx/file.h" #include "wx/textfile.h" +#include "wx/statline.h" #ifdef __WXMSW__ // for OutputDebugString() @@ -85,9 +88,15 @@ public: // event handlers void OnOk(wxCommandEvent& event); void OnDetails(wxCommandEvent& event); +#if wxUSE_FILE + void OnSave(wxCommandEvent& event); +#endif // wxUSE_FILE void OnListSelect(wxListEvent& event); private: + // create controls needed for the details display + void CreateDetailsControls(); + // the data for the listctrl wxArrayString m_messages; wxArrayInt m_severity; @@ -97,8 +106,15 @@ private: wxButton *m_btnDetails; bool m_showingDetails; - // the listctrl (not shown initially) + // the controls which are not shown initially (but only when details + // button is pressed) wxListCtrl *m_listctrl; +#if wxUSE_STATLINE + wxStaticLine *m_statline; +#endif // wxUSE_STATLINE +#if wxUSE_FILE + wxButton *m_btnSave; +#endif // wxUSE_FILE // the translated "Details" string static wxString ms_details; @@ -107,13 +123,30 @@ private: }; BEGIN_EVENT_TABLE(wxLogDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxLogDialog::OnOk) + EVT_BUTTON(wxID_CANCEL, wxLogDialog::OnOk) EVT_BUTTON(wxID_MORE, wxLogDialog::OnDetails) +#if wxUSE_FILE + EVT_BUTTON(wxID_SAVE, wxLogDialog::OnSave) +#endif // wxUSE_FILE EVT_LIST_ITEM_SELECTED(-1, wxLogDialog::OnListSelect) END_EVENT_TABLE() #endif // wxUSE_LOG_DIALOG +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +#if wxUSE_FILE + +// pass an uninitialized file object, the function will ask the user for the +// filename and try to open it, returns TRUE on success (file was opened), +// FALSE if file couldn't be opened/created and -1 if the file selection +// dialog was cancelled +static int OpenLogFile(wxFile& file, wxString *filename = NULL); + +#endif // wxUSE_FILE + // ---------------------------------------------------------------------------- // global variables // ---------------------------------------------------------------------------- @@ -174,13 +207,6 @@ void wxLogTextCtrl::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) wxLogGui::wxLogGui() { - // we must translate them here in the very beginning or we risk to have - // reentrancy problems when called from inside wxGetTranslation() leading - // to inifnite recursion - m_error = _("Error"); - m_warning = _("Warning"); - m_info = _("Information"); - Clear(); } @@ -203,26 +229,27 @@ void wxLogGui::Flush() // do it right now to block any new calls to Flush() while we're here m_bHasMessages = FALSE; - wxString title = wxTheApp->GetAppName(); - if ( !!title ) - { - title[0u] = wxToupper(title[0u]); - title += _T(' '); - } + wxString appName = wxTheApp->GetAppName(); + if ( !!appName ) + appName[0u] = wxToupper(appName[0u]); long style; + wxString titleFormat; if ( m_bErrors ) { - title += m_error; + titleFormat = _("%s Error"); style = wxICON_STOP; } else if ( m_bWarnings ) { - title += m_warning; + titleFormat = _("%s Warning"); style = wxICON_EXCLAMATION; } else { - title += m_info; + titleFormat = _("%s Information"); style = wxICON_INFORMATION; } + + wxString title; + title.Printf(titleFormat, appName.c_str()); // this is the best we can do here wxWindow *parent = wxTheApp->GetTopWindow(); @@ -404,8 +431,8 @@ private: Menu_Clear = wxID_CLEAR }; - // instead of closing just hide the window to be able to Show() it later - void DoClose() { Show(FALSE); } + // common part of OnClose() and OnCloseWindow() + void DoClose(); wxTextCtrl *m_pTextCtrl; wxLogWindow *m_log; @@ -455,6 +482,16 @@ wxLogFrame::wxLogFrame(wxFrame *pParent, wxLogWindow *log, const wxChar *szTitle m_log->OnFrameCreate(this); } +void wxLogFrame::DoClose() +{ + if ( m_log->OnFrameClose(this) ) + { + // instead of closing just hide the window to be able to Show() it + // later + Show(FALSE); + } +} + void wxLogFrame::OnClose(wxCommandEvent& WXUNUSED(event)) { DoClose(); @@ -468,62 +505,23 @@ void wxLogFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) #if wxUSE_FILE void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event)) { - // get the file name - // ----------------- - const wxChar *szFileName = wxSaveFileSelector(wxT("log"), wxT("txt"), wxT("log.txt")); - if ( szFileName == NULL ) { + wxString filename; + wxFile file; + int rc = OpenLogFile(file, &filename); + if ( rc == -1 ) + { // cancelled return; } - // open file - // --------- - wxFile file; - bool bOk = FALSE; - if ( wxFile::Exists(szFileName) ) { - bool bAppend = FALSE; - wxString strMsg; - strMsg.Printf(_("Append log to file '%s' " - "(choosing [No] will overwrite it)?"), szFileName); - switch ( wxMessageBox(strMsg, _("Question"), wxYES_NO | wxCANCEL) ) { - case wxYES: - bAppend = TRUE; - break; - - case wxNO: - bAppend = FALSE; - break; - - case wxCANCEL: - return; - - default: - wxFAIL_MSG(_("invalid message box return value")); - } - - if ( bAppend ) { - bOk = file.Open(szFileName, wxFile::write_append); - } - else { - bOk = file.Create(szFileName, TRUE /* overwrite */); - } - } - else { - bOk = file.Create(szFileName); - } + bool bOk = rc != 0; // retrieve text and save it // ------------------------- int nLines = m_pTextCtrl->GetNumberOfLines(); for ( int nLine = 0; bOk && nLine < nLines; nLine++ ) { bOk = file.Write(m_pTextCtrl->GetLineText(nLine) + - // we're not going to pull in the whole wxTextFile if all we need is this... -#if wxUSE_TEXTFILE - wxTextFile::GetEOL() -#else // !wxUSE_TEXTFILE - '\n' -#endif // wxUSE_TEXTFILE - ); + wxTextFile::GetEOL()); } if ( bOk ) @@ -533,7 +531,7 @@ void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event)) wxLogError(_("Can't save log contents to file.")); } else { - wxLogStatus(this, _("Log saved to the file '%s'."), szFileName); + wxLogStatus(this, _("Log saved to the file '%s'."), filename.c_str()); } } #endif // wxUSE_FILE @@ -643,6 +641,12 @@ void wxLogWindow::OnFrameCreate(wxFrame * WXUNUSED(frame)) { } +bool wxLogWindow::OnFrameClose(wxFrame * WXUNUSED(frame)) +{ + // allow to close + return TRUE; +} + void wxLogWindow::OnFrameDelete(wxFrame * WXUNUSED(frame)) { m_pLogFrame = (wxLogFrame *)NULL; @@ -672,12 +676,13 @@ wxLogDialog::wxLogDialog(wxWindow *parent, const wxArrayLong& times, const wxString& caption, long style) - : wxDialog(parent, -1, caption ) + : wxDialog(parent, -1, caption) { if ( ms_details.IsEmpty() ) { - // ensure that we won't try to call wxGetTranslation() twice - ms_details = _T("&Details"); + // ensure that we won't loop here if wxGetTranslation() + // happens to pop up a Log message while translating this :-) + ms_details = wxTRANSLATE("&Details"); ms_details = wxGetTranslation(ms_details); } @@ -703,6 +708,14 @@ wxLogDialog::wxLogDialog(wxWindow *parent, m_showingDetails = FALSE; // not initially m_listctrl = (wxListCtrl *)NULL; +#if wxUSE_STATLINE + m_statline = (wxStaticLine *)NULL; +#endif // wxUSE_STATLINE + +#if wxUSE_FILE + m_btnSave = (wxButton *)NULL; +#endif // wxUSE_FILE + // create the controls which are always shown and layout them: we use // sizers even though our window is not resizeable to calculate the size of // the dialog properly @@ -710,7 +723,10 @@ wxLogDialog::wxLogDialog(wxWindow *parent, wxBoxSizer *sizerButtons = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sizerAll = new wxBoxSizer(wxHORIZONTAL); - wxButton *btnOk = new wxButton(this, wxID_OK, _("OK")); + // this "Ok" button has wxID_CANCEL id - not very logical, but this allows + // to close the log dialog with <Esc> which wouldn't work otherwise (as it + // translates into click on cancel button) + wxButton *btnOk = new wxButton(this, wxID_CANCEL, _("OK")); sizerButtons->Add(btnOk, 0, wxCENTRE|wxBOTTOM, MARGIN/2); m_btnDetails = new wxButton(this, wxID_MORE, ms_details + _T(" >>")); sizerButtons->Add(m_btnDetails, 0, wxCENTRE|wxTOP, MARGIN/2 - 1); @@ -718,7 +734,7 @@ wxLogDialog::wxLogDialog(wxWindow *parent, #ifndef __WIN16__ wxIcon icon = wxTheApp->GetStdIcon((int)(style & wxICON_MASK)); sizerAll->Add(new wxStaticBitmap(this, -1, icon), 0, wxCENTRE); -#endif +#endif // !Win16 const wxString& message = messages.Last(); sizerAll->Add(CreateTextSizer(message), 0, wxCENTRE|wxLEFT|wxRIGHT, MARGIN); @@ -747,6 +763,118 @@ wxLogDialog::wxLogDialog(wxWindow *parent, Centre(); } +void wxLogDialog::CreateDetailsControls() +{ + // create the save button and separator line if possible +#if wxUSE_FILE + m_btnSave = new wxButton(this, wxID_SAVE, _("&Save...")); +#endif // wxUSE_FILE + +#if wxUSE_STATLINE + m_statline = new wxStaticLine(this, -1); +#endif // wxUSE_STATLINE + + // create the list ctrl now + m_listctrl = new wxListCtrl(this, -1, + wxDefaultPosition, wxDefaultSize, + wxSUNKEN_BORDER | + wxLC_REPORT | + wxLC_NO_HEADER | + wxLC_SINGLE_SEL); + + // no need to translate these strings as they're not shown to the + // user anyhow (we use wxLC_NO_HEADER style) + m_listctrl->InsertColumn(0, _T("Message")); + m_listctrl->InsertColumn(1, _T("Time")); + + // prepare the imagelist + static const int ICON_SIZE = 16; + wxImageList *imageList = new wxImageList(ICON_SIZE, ICON_SIZE); + + // order should be the same as in the switch below! + static const int icons[] = + { + wxICON_ERROR, + wxICON_EXCLAMATION, + wxICON_INFORMATION + }; + + bool loadedIcons = TRUE; + +#ifndef __WIN16__ + for ( size_t icon = 0; icon < WXSIZEOF(icons); icon++ ) + { + wxBitmap bmp = wxTheApp->GetStdIcon(icons[icon]); + + // This may very well fail if there are insufficient + // colours available. Degrade gracefully. + + if (!bmp.Ok()) + loadedIcons = FALSE; + else + imageList->Add(wxImage(bmp). + Rescale(ICON_SIZE, ICON_SIZE). + ConvertToBitmap()); + } + + m_listctrl->SetImageList(imageList, wxIMAGE_LIST_SMALL); +#endif // !Win16 + + // and fill it + wxString fmt = wxLog::GetTimestamp(); + if ( !fmt ) + { + // default format + fmt = _T("%c"); + } + + size_t count = m_messages.GetCount(); + for ( size_t n = 0; n < count; n++ ) + { + int image = -1; +#ifndef __WIN16__ + switch ( m_severity[n] ) + { + case wxLOG_Error: + image = 0; + break; + + case wxLOG_Warning: + image = 1; + break; + + default: + image = 2; + } +#endif // !Win16 + + if (!loadedIcons) + image = -1; + + if (image > -1) + m_listctrl->InsertItem(n, m_messages[n], image); + else + m_listctrl->InsertItem(n, m_messages[n]); + + m_listctrl->SetItem(n, 1, + wxDateTime((time_t)m_times[n]).Format(fmt)); + } + + // let the columns size themselves + m_listctrl->SetColumnWidth(0, wxLIST_AUTOSIZE); + m_listctrl->SetColumnWidth(1, wxLIST_AUTOSIZE); + + // get the approx height of the listctrl + wxFont font = GetFont(); + if ( !font.Ok() ) + font = *wxSWISS_FONT; + + int y; + GetTextExtent(_T("H"), (int*)NULL, &y, (int*)NULL, (int*)NULL, &font); + int height = wxMax(y*(count + 3), 100); + m_listctrl->SetSize(-1, height); +} + void wxLogDialog::OnListSelect(wxListEvent& event) { // we can't just disable the control because this looks ugly under Windows @@ -760,6 +888,48 @@ void wxLogDialog::OnOk(wxCommandEvent& WXUNUSED(event)) EndModal(wxID_OK); } +#if wxUSE_FILE + +void wxLogDialog::OnSave(wxCommandEvent& WXUNUSED(event)) +{ + wxFile file; + int rc = OpenLogFile(file); + if ( rc == -1 ) + { + // cancelled + return; + } + + bool ok = rc != 0; + + wxString fmt = wxLog::GetTimestamp(); + if ( !fmt ) + { + // default format + fmt = _T("%c"); + } + + size_t count = m_messages.GetCount(); + for ( size_t n = 0; ok && (n < count); n++ ) + { + wxString line; + line << wxDateTime((time_t)m_times[n]).Format(fmt) + << _T(": ") + << m_messages[n] + << wxTextFile::GetEOL(); + + ok = file.Write(line); + } + + if ( ok ) + ok = file.Close(); + + if ( !ok ) + wxLogError(_("Can't save log contents to file.")); +} + +#endif // wxUSE_FILE + void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event)) { wxSizer *sizer = GetSizer(); @@ -769,6 +939,14 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event)) m_btnDetails->SetLabel(ms_details + _T(">>")); sizer->Remove(m_listctrl); + +#if wxUSE_STATLINE + sizer->Remove(m_statline); +#endif // wxUSE_STATLINE + +#if wxUSE_FILE + sizer->Remove(m_btnSave); +#endif // wxUSE_FILE } else // show details now { @@ -776,91 +954,18 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event)) if ( !m_listctrl ) { - // create it now - m_listctrl = new wxListCtrl(this, -1, - wxDefaultPosition, wxDefaultSize, - wxSUNKEN_BORDER | - wxLC_REPORT | - wxLC_NO_HEADER | - wxLC_SINGLE_SEL); - // no need to translate these strings as they're not shown to the - // user anyhow (we use wxLC_NO_HEADER style) - m_listctrl->InsertColumn(0, _T("Message")); - m_listctrl->InsertColumn(1, _T("Time")); - - // prepare the imagelist - static const int ICON_SIZE = 16; - wxImageList *imageList = new wxImageList(ICON_SIZE, ICON_SIZE); - - // order should be the same as in the switch below! - static const int icons[] = - { - wxICON_ERROR, - wxICON_EXCLAMATION, - wxICON_INFORMATION - }; - -#ifndef __WIN16__ - for ( size_t icon = 0; icon < WXSIZEOF(icons); icon++ ) - { - wxBitmap bmp = wxTheApp->GetStdIcon(icons[icon]); - imageList->Add(wxImage(bmp). - Rescale(ICON_SIZE, ICON_SIZE). - ConvertToBitmap()); - } - - m_listctrl->SetImageList(imageList, wxIMAGE_LIST_SMALL); -#endif - - // and fill it - wxString fmt = wxLog::GetTimestamp(); - if ( !fmt ) - { - // default format - fmt = _T("%X"); - } - - size_t count = m_messages.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - int image = -1; -#ifndef __WIN16__ - switch ( m_severity[n] ) - { - case wxLOG_Error: - image = 0; - break; - - case wxLOG_Warning: - image = 1; - break; - - default: - image = 2; - } -#endif - - m_listctrl->InsertItem(n, m_messages[n], image); - m_listctrl->SetItem(n, 1, - wxDateTime((time_t)m_times[n]).Format(fmt)); - } - - // let the columns size themselves - m_listctrl->SetColumnWidth(0, wxLIST_AUTOSIZE); - m_listctrl->SetColumnWidth(1, wxLIST_AUTOSIZE); + CreateDetailsControls(); + } - // get the approx height of the listctrl - wxFont font = GetFont(); - if ( !font.Ok() ) - font = *wxSWISS_FONT; +#if wxUSE_STATLINE + sizer->Add(m_statline, 0, wxEXPAND | (wxALL & ~wxTOP), MARGIN); +#endif // wxUSE_STATLINE - int y; - GetTextExtent(_T("H"), (int*)NULL, &y, (int*)NULL, (int*)NULL, &font); - int height = wxMin(y*(count + 3), 100); - m_listctrl->SetSize(-1, height); - } + sizer->Add(m_listctrl, 1, wxEXPAND | (wxALL & ~wxTOP), MARGIN); - sizer->Add(m_listctrl, 1, wxEXPAND|(wxALL & ~wxTOP), MARGIN); +#if wxUSE_FILE + sizer->Add(m_btnSave, 0, wxALIGN_RIGHT | (wxALL & ~wxTOP), MARGIN); +#endif // wxUSE_FILE } m_showingDetails = !m_showingDetails; @@ -868,6 +973,13 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event)) // in any case, our size changed - update sizer->SetSizeHints(this); sizer->Fit(this); + +#ifdef __WXGTK__ + // VS: this is neccessary in order to force frame redraw under + // WindowMaker or fvwm2 (and probably other broken WMs). + // Otherwise, detailed list wouldn't be displayed. + Show(TRUE); +#endif // wxGTK } wxLogDialog::~wxLogDialog() @@ -879,3 +991,64 @@ wxLogDialog::~wxLogDialog() } #endif // wxUSE_LOG_DIALOG + +#if wxUSE_FILE + +// pass an uninitialized file object, the function will ask the user for the +// filename and try to open it, returns TRUE on success (file was opened), +// FALSE if file couldn't be opened/created and -1 if the file selection +// dialog was cancelled +static int OpenLogFile(wxFile& file, wxString *pFilename) +{ + // get the file name + // ----------------- + wxString filename = wxSaveFileSelector(wxT("log"), wxT("txt"), wxT("log.txt")); + if ( !filename ) { + // cancelled + return -1; + } + + // open file + // --------- + bool bOk = FALSE; + if ( wxFile::Exists(filename) ) { + bool bAppend = FALSE; + wxString strMsg; + strMsg.Printf(_("Append log to file '%s' (choosing [No] will overwrite it)?"), + filename.c_str()); + switch ( wxMessageBox(strMsg, _("Question"), + wxICON_QUESTION | wxYES_NO | wxCANCEL) ) { + case wxYES: + bAppend = TRUE; + break; + + case wxNO: + bAppend = FALSE; + break; + + case wxCANCEL: + return -1; + + default: + wxFAIL_MSG(_("invalid message box return value")); + } + + if ( bAppend ) { + bOk = file.Open(filename, wxFile::write_append); + } + else { + bOk = file.Create(filename, TRUE /* overwrite */); + } + } + else { + bOk = file.Create(filename); + } + + if ( pFilename ) + *pFilename = filename; + + return bOk; +} + +#endif // wxUSE_FILE + diff --git a/src/generic/notebook.cpp b/src/generic/notebook.cpp index 926f404c0e..97019ea950 100644 --- a/src/generic/notebook.cpp +++ b/src/generic/notebook.cpp @@ -592,12 +592,12 @@ void wxNotebook::ChangePage(int nOldSel, int nSel) wxRect clientRect = GetAvailableClientSize(); pPage->SetSize(clientRect.x, clientRect.y, clientRect.width, clientRect.height); + Refresh(); + pPage->Show(TRUE); pPage->Raise(); pPage->SetFocus(); - Refresh(); - m_nSelection = nSel; } diff --git a/src/generic/numdlgg.cpp b/src/generic/numdlgg.cpp index d40d36daad..96bbc485bf 100644 --- a/src/generic/numdlgg.cpp +++ b/src/generic/numdlgg.cpp @@ -45,7 +45,9 @@ #include "wx/statline.h" #endif +#if !defined(__WIN16__) && wxUSE_SPINCTRL #include "wx/spinctrl.h" +#endif // this is where wxGetNumberFromUser() is declared #include "wx/textdlg.h" @@ -129,7 +131,7 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent, wxString valStr; valStr.Printf(wxT("%lu"), m_value); m_spinctrl = new wxSpinCtrl(this, -1, valStr, wxDefaultPosition, wxSize( 140, -1 ) ); -#ifndef __WIN16__ +#if !defined(__WIN16__) && wxUSE_SPINCTRL m_spinctrl->SetRange((int)m_min, (int)m_max); #endif inputsizer->Add( m_spinctrl, 1, wxCENTER | wxLEFT | wxRIGHT, 10 ); diff --git a/src/generic/panelg.cpp b/src/generic/panelg.cpp index 9e8363baa9..346a2c82e6 100644 --- a/src/generic/panelg.cpp +++ b/src/generic/panelg.cpp @@ -36,6 +36,9 @@ #include "wx/log.h" #endif +#include "wx/toolbar.h" +#include "wx/statusbr.h" + #include "wx/generic/panelg.h" // ---------------------------------------------------------------------------- @@ -340,39 +343,58 @@ void wxPanel::OnFocus(wxFocusEvent& event) bool wxPanel::SetFocusToChild() { - if ( m_winLastFocused ) + return wxSetFocusToChild(this, &m_winLastFocused); +} + +// ---------------------------------------------------------------------------- +// SetFocusToChild(): this function is used by wxPanel but also by wxFrame in +// wxMSW, this is why it is outside of wxPanel class +// ---------------------------------------------------------------------------- + +bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) +{ + if ( *childLastFocused ) { // It might happen that the window got reparented or no longer accepts // the focus. - if ( (m_winLastFocused->GetParent() == this) && - m_winLastFocused->AcceptsFocus() ) + if ( (*childLastFocused)->GetParent() == win && + (*childLastFocused)->AcceptsFocus() ) { wxLogTrace(_T("focus"), _T("SetFocusToChild() => last child (0x%08x)."), - m_winLastFocused->GetHandle()); + (*childLastFocused)->GetHandle()); - m_winLastFocused->SetFocus(); + (*childLastFocused)->SetFocus(); return TRUE; } else { // it doesn't count as such any more - m_winLastFocused = (wxWindow *)NULL; + *childLastFocused = (wxWindow *)NULL; } } // set the focus to the first child who wants it - wxWindowList::Node *node = GetChildren().GetFirst(); + wxWindowList::Node *node = win->GetChildren().GetFirst(); while ( node ) { wxWindow *child = node->GetData(); - if ( child->AcceptsFocus() ) + + if ( child->AcceptsFocus() + && !child->IsTopLevel() +#if wxUSE_TOOLBAR + && !wxDynamicCast(child, wxToolBar) +#endif // wxUSE_TOOLBAR +#if wxUSE_STATUSBAR + && !wxDynamicCast(child, wxStatusBar) +#endif // wxUSE_STATUSBAR + ) { wxLogTrace(_T("focus"), _T("SetFocusToChild() => first child (0x%08x)."), child->GetHandle()); - m_winLastFocused = child; // should be redundant, but it is not + *childLastFocused = child; // should be redundant, but it is not child->SetFocus(); return TRUE; } diff --git a/src/generic/printps.cpp b/src/generic/printps.cpp index 0e994766b9..f819ed81ee 100644 --- a/src/generic/printps.cpp +++ b/src/generic/printps.cpp @@ -80,7 +80,10 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro sm_abortWindow = (wxWindow *) NULL; if (!printout) + { + sm_lastError = wxPRINTER_ERROR; return FALSE; + } printout->SetIsPreview(FALSE); @@ -96,7 +99,10 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage); if (maxPage == 0) + { + sm_lastError = wxPRINTER_ERROR; return FALSE; + } m_printDialogData.SetMinPage(minPage); m_printDialogData.SetMaxPage(maxPage); @@ -131,13 +137,14 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro } else { - dc = new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL); + dc = new wxPostScriptDC(GetPrintDialogData().GetPrintData()); } // May have pressed cancel. if (!dc || !dc->Ok()) { if (dc) delete dc; + sm_lastError = wxPRINTER_ERROR; return FALSE; } @@ -189,6 +196,8 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro printout->OnBeginPrinting(); + sm_lastError = wxPRINTER_NO_ERROR; + bool keepGoing = TRUE; int copyCount; @@ -197,11 +206,15 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage())) { wxEndBusyCursor(); - wxMessageBox(_("Could not start printing."), _("Print Error"), wxOK, parent); + wxLogError(_("Could not start printing.")); + sm_lastError = wxPRINTER_ERROR; break; } if (sm_abortIt) + { + sm_lastError = wxPRINTER_CANCELLED; break; + } int pn; for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn); @@ -210,6 +223,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro if (sm_abortIt) { keepGoing = FALSE; + sm_lastError = wxPRINTER_CANCELLED; break; } else @@ -225,6 +239,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro else { sm_abortIt = TRUE; + sm_lastError = wxPRINTER_CANCELLED; keepGoing = FALSE; } } @@ -240,7 +255,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro delete dc; - return TRUE; + return (sm_lastError == wxPRINTER_NO_ERROR); } wxDC* wxPostScriptPrinter::PrintDialog(wxWindow *parent) @@ -252,7 +267,14 @@ wxDC* wxPostScriptPrinter::PrintDialog(wxWindow *parent) { dc = dialog->GetPrintDC(); m_printDialogData = dialog->GetPrintDialogData(); + if (dc == NULL) + sm_lastError = wxPRINTER_ERROR; + else + sm_lastError = wxPRINTER_NO_ERROR; } + else + sm_lastError = wxPRINTER_CANCELLED; + dialog->Destroy(); return dc; diff --git a/src/generic/prop.cpp b/src/generic/prop.cpp index ad6d3b521e..7175580382 100644 --- a/src/generic/prop.cpp +++ b/src/generic/prop.cpp @@ -179,7 +179,7 @@ wxPropertyValue::wxPropertyValue(wxStringList *the_list) wxNode *node = the_list->First(); while (node) { - char *s = (char *)node->Data(); + wxChar *s = (wxChar *)node->Data(); Append(new wxPropertyValue(s)); node = node->Next(); } diff --git a/src/generic/propform.cpp b/src/generic/propform.cpp index e8f651083c..c403aad691 100644 --- a/src/generic/propform.cpp +++ b/src/generic/propform.cpp @@ -33,31 +33,31 @@ /* - * Property view - */ +* Property view +*/ IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormView, wxPropertyView) BEGIN_EVENT_TABLE(wxPropertyFormView, wxPropertyView) - EVT_BUTTON(wxID_OK, wxPropertyFormView::OnOk) - EVT_BUTTON(wxID_CANCEL, wxPropertyFormView::OnCancel) - EVT_BUTTON(wxID_HELP, wxPropertyFormView::OnHelp) - EVT_BUTTON(wxID_PROP_REVERT, wxPropertyFormView::OnRevert) - EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate) +EVT_BUTTON(wxID_OK, wxPropertyFormView::OnOk) +EVT_BUTTON(wxID_CANCEL, wxPropertyFormView::OnCancel) +EVT_BUTTON(wxID_HELP, wxPropertyFormView::OnHelp) +EVT_BUTTON(wxID_PROP_REVERT, wxPropertyFormView::OnRevert) +EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate) END_EVENT_TABLE() bool wxPropertyFormView::sm_dialogCancelled = FALSE; wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags) { - m_propertyWindow = propPanel; - m_managedWindow = NULL; - - m_windowCloseButton = NULL; - m_windowCancelButton = NULL; - m_windowHelpButton = NULL; - - m_detailedEditing = FALSE; + m_propertyWindow = propPanel; + m_managedWindow = NULL; + + m_windowCloseButton = NULL; + m_windowCancelButton = NULL; + m_windowHelpButton = NULL; + + m_detailedEditing = FALSE; } wxPropertyFormView::~wxPropertyFormView(void) @@ -66,125 +66,129 @@ wxPropertyFormView::~wxPropertyFormView(void) void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel) { - m_propertySheet = ps; - - AssociatePanel(panel); -// CreateControls(); -// UpdatePropertyList(); + m_propertySheet = ps; + + AssociatePanel(panel); + // CreateControls(); + // UpdatePropertyList(); } // Update this view of the viewed object, called e.g. by // the object itself. bool wxPropertyFormView::OnUpdateView(void) { - return TRUE; + return TRUE; } bool wxPropertyFormView::Check(void) { - if (!m_propertySheet) - return FALSE; + if (!m_propertySheet) + return FALSE; - wxNode *node = m_propertySheet->GetProperties().First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - wxPropertyValidator *validator = FindPropertyValidator(prop); - if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + wxNode *node = m_propertySheet->GetProperties().First(); + while (node) { - wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; - if (!formValidator->OnCheckValue(prop, this, m_propertyWindow)) - return FALSE; + wxProperty *prop = (wxProperty *)node->Data(); + wxPropertyValidator *validator = FindPropertyValidator(prop); + if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + { + wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; + if (!formValidator->OnCheckValue(prop, this, m_propertyWindow)) + return FALSE; + } + node = node->Next(); } - node = node->Next(); - } - return TRUE; + return TRUE; } bool wxPropertyFormView::TransferToPropertySheet(void) { - if (!m_propertySheet) - return FALSE; + if (!m_propertySheet) + return FALSE; - wxNode *node = m_propertySheet->GetProperties().First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - wxPropertyValidator *validator = FindPropertyValidator(prop); - if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + wxNode *node = m_propertySheet->GetProperties().First(); + while (node) { - wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; - formValidator->OnRetrieveValue(prop, this, m_propertyWindow); + wxProperty *prop = (wxProperty *)node->Data(); + wxPropertyValidator *validator = FindPropertyValidator(prop); + if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + { + wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; + formValidator->OnRetrieveValue(prop, this, m_propertyWindow); + } + node = node->Next(); } - node = node->Next(); - } - return TRUE; + return TRUE; } bool wxPropertyFormView::TransferToDialog(void) { - if (!m_propertySheet) - return FALSE; + if (!m_propertySheet) + return FALSE; - wxNode *node = m_propertySheet->GetProperties().First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - wxPropertyValidator *validator = FindPropertyValidator(prop); - if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + wxNode *node = m_propertySheet->GetProperties().First(); + while (node) { - wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; - formValidator->OnDisplayValue(prop, this, m_propertyWindow); + wxProperty *prop = (wxProperty *)node->Data(); + wxPropertyValidator *validator = FindPropertyValidator(prop); + if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + { + wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; + formValidator->OnDisplayValue(prop, this, m_propertyWindow); + } + node = node->Next(); } - node = node->Next(); - } - return TRUE; + return TRUE; } bool wxPropertyFormView::AssociateNames(void) { - if (!m_propertySheet || !m_propertyWindow) - return FALSE; - - wxNode *node = m_propertyWindow->GetChildren().First(); - while (node) - { - wxWindow *win = (wxWindow *)node->Data(); - if (win->GetName() != wxT("")) + if (!m_propertySheet || !m_propertyWindow) + return FALSE; + + wxNode *node = m_propertyWindow->GetChildren().First(); + while (node) { - wxProperty *prop = m_propertySheet->GetProperty(win->GetName()); - if (prop) - prop->SetWindow(win); + wxWindow *win = (wxWindow *)node->Data(); + if (win->GetName() != wxT("")) + { + wxProperty *prop = m_propertySheet->GetProperty(win->GetName()); + if (prop) + prop->SetWindow(win); + } + node = node->Next(); } - node = node->Next(); - } - return TRUE; + return TRUE; } bool wxPropertyFormView::OnClose(void) { - delete this; - return TRUE; + if (m_propertyWindow->IsKindOf(CLASSINFO(wxPropertyFormPanel))) + { + ((wxPropertyFormPanel*)m_propertyWindow)->SetView(NULL); + } + delete this; + return TRUE; } void wxPropertyFormView::OnOk(wxCommandEvent& WXUNUSED(event)) { - // Retrieve the value if any - if (!Check()) - return; - - sm_dialogCancelled = FALSE; - TransferToPropertySheet(); - - m_managedWindow->Close(TRUE); + // Retrieve the value if any + if (!Check()) + return; + + sm_dialogCancelled = FALSE; + TransferToPropertySheet(); + + m_managedWindow->Close(TRUE); } void wxPropertyFormView::OnCancel(wxCommandEvent& WXUNUSED(event)) { - sm_dialogCancelled = TRUE; - - m_managedWindow->Close(TRUE); + sm_dialogCancelled = TRUE; + + m_managedWindow->Close(TRUE); } void wxPropertyFormView::OnHelp(wxCommandEvent& WXUNUSED(event)) @@ -199,47 +203,47 @@ void wxPropertyFormView::OnUpdate(wxCommandEvent& WXUNUSED(event)) void wxPropertyFormView::OnRevert(wxCommandEvent& WXUNUSED(event)) { - TransferToDialog(); + TransferToDialog(); } void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event) { - if (!m_propertySheet) - return; - - if (win.GetName() == wxT("")) - return; - - if (wxStrcmp(win.GetName(), wxT("ok")) == 0) - OnOk(event); - else if (wxStrcmp(win.GetName(), wxT("cancel")) == 0) - OnCancel(event); - else if (wxStrcmp(win.GetName(), wxT("help")) == 0) - OnHelp(event); - else if (wxStrcmp(win.GetName(), wxT("update")) == 0) - OnUpdate(event); - else if (wxStrcmp(win.GetName(), wxT("revert")) == 0) - OnRevert(event); - else - { - // Find a validator to route the command to. - wxNode *node = m_propertySheet->GetProperties().First(); - while (node) + if (!m_propertySheet) + return; + + if (win.GetName() == wxT("")) + return; + + if (wxStrcmp(win.GetName(), wxT("ok")) == 0) + OnOk(event); + else if (wxStrcmp(win.GetName(), wxT("cancel")) == 0) + OnCancel(event); + else if (wxStrcmp(win.GetName(), wxT("help")) == 0) + OnHelp(event); + else if (wxStrcmp(win.GetName(), wxT("update")) == 0) + OnUpdate(event); + else if (wxStrcmp(win.GetName(), wxT("revert")) == 0) + OnRevert(event); + else { - wxProperty *prop = (wxProperty *)node->Data(); - if (prop->GetWindow() && (prop->GetWindow() == &win)) - { - wxPropertyValidator *validator = FindPropertyValidator(prop); - if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + // Find a validator to route the command to. + wxNode *node = m_propertySheet->GetProperties().First(); + while (node) { - wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; - formValidator->OnCommand(prop, this, m_propertyWindow, event); - return; + wxProperty *prop = (wxProperty *)node->Data(); + if (prop->GetWindow() && (prop->GetWindow() == &win)) + { + wxPropertyValidator *validator = FindPropertyValidator(prop); + if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + { + wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; + formValidator->OnCommand(prop, this, m_propertyWindow, event); + return; + } + } + node = node->Next(); } - } - node = node->Next(); } - } } // Extend event processing to call OnCommand @@ -258,152 +262,152 @@ bool wxPropertyFormView::ProcessEvent(wxEvent& event) void wxPropertyFormView::OnDoubleClick(wxControl *item) { - if (!m_propertySheet) - return; + if (!m_propertySheet) + return; - // Find a validator to route the command to. - wxNode *node = m_propertySheet->GetProperties().First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - if (prop->GetWindow() && ((wxControl *)prop->GetWindow() == item)) + // Find a validator to route the command to. + wxNode *node = m_propertySheet->GetProperties().First(); + while (node) { - wxPropertyValidator *validator = FindPropertyValidator(prop); - if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) - { - wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; - formValidator->OnDoubleClick(prop, this, m_propertyWindow); - return; - } + wxProperty *prop = (wxProperty *)node->Data(); + if (prop->GetWindow() && ((wxControl *)prop->GetWindow() == item)) + { + wxPropertyValidator *validator = FindPropertyValidator(prop); + if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + { + wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; + formValidator->OnDoubleClick(prop, this, m_propertyWindow); + return; + } + } + node = node->Next(); } - node = node->Next(); - } } /* - * Property form dialog box - */ - -IMPLEMENT_CLASS(wxPropertyFormDialog, wxDialog) +* Property form dialog box +*/ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormDialog, wxDialog) BEGIN_EVENT_TABLE(wxPropertyFormDialog, wxDialog) - EVT_CLOSE(wxPropertyFormDialog::OnCloseWindow) +EVT_CLOSE(wxPropertyFormDialog::OnCloseWindow) END_EVENT_TABLE() wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, - const wxPoint& pos, const wxSize& size, long style, const wxString& name): - wxDialog(parent, -1, title, pos, size, style, name) + const wxPoint& pos, const wxSize& size, long style, const wxString& name): +wxDialog(parent, -1, title, pos, size, style, name) { - m_view = v; - m_view->AssociatePanel(this); - m_view->SetManagedWindow(this); -// SetAutoLayout(TRUE); + m_view = v; + m_view->AssociatePanel(this); + m_view->SetManagedWindow(this); + // SetAutoLayout(TRUE); } void wxPropertyFormDialog::OnCloseWindow(wxCloseEvent& event) { - if (m_view) - { - m_view->OnClose(); - m_view = NULL; - this->Destroy(); - } - else - event.Veto(); + if (m_view) + { + m_view->OnClose(); + m_view = NULL; + this->Destroy(); + } + else + event.Veto(); } void wxPropertyFormDialog::OnDefaultAction(wxControl *item) { - m_view->OnDoubleClick(item); + m_view->OnDoubleClick(item); } void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event) { - if ( m_view ) - m_view->OnCommand(win, event); + if ( m_view ) + m_view->OnCommand(win, event); } // Extend event processing to search the view's event table bool wxPropertyFormDialog::ProcessEvent(wxEvent& event) { - if ( !m_view || ! m_view->ProcessEvent(event) ) - return wxEvtHandler::ProcessEvent(event); - else - return TRUE; + if ( !m_view || ! m_view->ProcessEvent(event) ) + return wxEvtHandler::ProcessEvent(event); + else + return TRUE; } /* - * Property form panel - */ - -IMPLEMENT_CLASS(wxPropertyFormPanel, wxPanel) +* Property form panel +*/ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormPanel, wxPanel) void wxPropertyFormPanel::OnDefaultAction(wxControl *item) { - m_view->OnDoubleClick(item); + m_view->OnDoubleClick(item); } void wxPropertyFormPanel::OnCommand(wxWindow& win, wxCommandEvent& event) { - m_view->OnCommand(win, event); + m_view->OnCommand(win, event); } // Extend event processing to search the view's event table bool wxPropertyFormPanel::ProcessEvent(wxEvent& event) { - if ( !m_view || ! m_view->ProcessEvent(event) ) - return wxEvtHandler::ProcessEvent(event); - else - return TRUE; + if ( !m_view || ! m_view->ProcessEvent(event) ) + return wxEvtHandler::ProcessEvent(event); + else + return TRUE; } /* - * Property frame - */ - -IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame) +* Property frame +*/ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormFrame, wxFrame) BEGIN_EVENT_TABLE(wxPropertyFormFrame, wxFrame) - EVT_CLOSE(wxPropertyFormFrame::OnCloseWindow) +EVT_CLOSE(wxPropertyFormFrame::OnCloseWindow) END_EVENT_TABLE() void wxPropertyFormFrame::OnCloseWindow(wxCloseEvent& event) { - if (m_view && m_view->OnClose()) - this->Destroy(); - else - event.Veto(); + if (m_view && m_view->OnClose()) + this->Destroy(); + else + event.Veto(); } wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView *v) { - return new wxPropertyFormPanel(v, parent); + return new wxPropertyFormPanel(v, parent); } bool wxPropertyFormFrame::Initialize(void) { - m_propertyPanel = OnCreatePanel(this, m_view); - if (m_propertyPanel) - { - m_view->AssociatePanel(m_propertyPanel); - m_view->SetManagedWindow(this); - return TRUE; - } - else - return FALSE; + m_propertyPanel = OnCreatePanel(this, m_view); + if (m_propertyPanel) + { + m_view->AssociatePanel(m_propertyPanel); + m_view->SetManagedWindow(this); + return TRUE; + } + else + return FALSE; } - /* - * Property form specific validator - */ - +/* +* Property form specific validator +*/ + IMPLEMENT_ABSTRACT_CLASS(wxPropertyFormValidator, wxPropertyValidator) /* - * Default validators - */ +* Default validators +*/ IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator) @@ -411,66 +415,66 @@ IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator) /// Real number form validator /// bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *parentWindow) + wxWindow *parentWindow) { - if (m_realMin == 0.0 && m_realMax == 0.0) - return TRUE; + if (m_realMin == 0.0 && m_realMax == 0.0) + return TRUE; + + // The item used for viewing the real number: should be a text item. + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + return FALSE; - // The item used for viewing the real number: should be a text item. - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - return FALSE; - - wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue()); - - float val = 0.0; - if (!StringToFloat(WXSTRINGCAST value, &val)) - { - wxChar buf[200]; - wxSprintf(buf, wxT("Value %s is not a valid real number!"), (const wxChar *)value); - wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - - if (val < m_realMin || val > m_realMax) - { - wxChar buf[200]; - wxSprintf(buf, wxT("Value must be a real number between %.2f and %.2f!"), m_realMin, m_realMax); - wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - return TRUE; + wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue()); + + float val = 0.0; + if (!StringToFloat(WXSTRINGCAST value, &val)) + { + wxChar buf[200]; + wxSprintf(buf, wxT("Value %s is not a valid real number!"), (const wxChar *)value); + wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + + if (val < m_realMin || val > m_realMax) + { + wxChar buf[200]; + wxSprintf(buf, wxT("Value must be a real number between %.2f and %.2f!"), m_realMin, m_realMax); + wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + return TRUE; } bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow) ) + wxWindow *WXUNUSED(parentWindow) ) { - // The item used for viewing the real number: should be a text item. - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - return FALSE; - - wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue()); - - if (value.Length() == 0) - return FALSE; + // The item used for viewing the real number: should be a text item. + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + return FALSE; - float f = (float)wxAtof((const wxChar *)value); - property->GetValue() = f; - return TRUE; + wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue()); + + if (value.Length() == 0) + return FALSE; + + float f = (float)wxAtof((const wxChar *)value); + property->GetValue() = f; + return TRUE; } bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow) ) + wxWindow *WXUNUSED(parentWindow) ) { - // The item used for viewing the real number: should be a text item. - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - return FALSE; - - wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow; - textItem->SetValue(FloatToString(property->GetValue().RealValue())); - return TRUE; + // The item used for viewing the real number: should be a text item. + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + return FALSE; + + wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow; + textItem->SetValue(FloatToString(property->GetValue().RealValue())); + return TRUE; } /// @@ -479,95 +483,95 @@ bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormVie IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator) bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *parentWindow) + wxWindow *parentWindow) { - if (m_integerMin == 0.0 && m_integerMax == 0.0) - return TRUE; + if (m_integerMin == 0.0 && m_integerMax == 0.0) + return TRUE; - // The item used for viewing the real number: should be a text item or a slider - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow) - return FALSE; - - long val = 0; - - if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue()); - - if (!StringToLong(WXSTRINGCAST value, &val)) + // The item used for viewing the real number: should be a text item or a slider + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow) + return FALSE; + + long val = 0; + + if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + { + wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue()); + + if (!StringToLong(WXSTRINGCAST value, &val)) + { + wxChar buf[200]; + wxSprintf(buf, wxT("Value %s is not a valid integer!"), (const wxChar *)value); + wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + } + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider))) { - wxChar buf[200]; - wxSprintf(buf, wxT("Value %s is not a valid integer!"), (const wxChar *)value); - wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; + val = (long)((wxSlider *)m_propertyWindow)->GetValue(); + } + else + return FALSE; + + if (val < m_integerMin || val > m_integerMax) + { + char buf[200]; + sprintf(buf, "Value must be an integer between %ld and %ld!", m_integerMin, m_integerMax); + wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; } - } - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider))) - { - val = (long)((wxSlider *)m_propertyWindow)->GetValue(); - } - else - return FALSE; - - if (val < m_integerMin || val > m_integerMax) - { - char buf[200]; - sprintf(buf, "Value must be an integer between %ld and %ld!", m_integerMin, m_integerMax); - wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - return TRUE; + return TRUE; } bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow)) + wxWindow *WXUNUSED(parentWindow)) { - // The item used for viewing the real number: should be a text item or a slider - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow) - return FALSE; - - if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue()); - - if (value.Length() == 0) - return FALSE; + // The item used for viewing the real number: should be a text item or a slider + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow) + return FALSE; - long i = wxAtol((const wxChar *)value); - property->GetValue() = i; - } - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider))) - { - property->GetValue() = (long)((wxSlider *)m_propertyWindow)->GetValue(); - } - else - return FALSE; + if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + { + wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue()); + + if (value.Length() == 0) + return FALSE; + + long i = wxAtol((const wxChar *)value); + property->GetValue() = i; + } + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider))) + { + property->GetValue() = (long)((wxSlider *)m_propertyWindow)->GetValue(); + } + else + return FALSE; - return TRUE; + return TRUE; } bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow)) + wxWindow *WXUNUSED(parentWindow)) { - // The item used for viewing the real number: should be a text item or a slider - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow) - return FALSE; - - if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow; - textItem->SetValue(LongToString(property->GetValue().IntegerValue())); - } - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider))) - { - ((wxSlider *)m_propertyWindow)->SetValue((int)property->GetValue().IntegerValue()); - } - else - return FALSE; - return TRUE; + // The item used for viewing the real number: should be a text item or a slider + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow) + return FALSE; + + if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + { + wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow; + textItem->SetValue(LongToString(property->GetValue().IntegerValue())); + } + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider))) + { + ((wxSlider *)m_propertyWindow)->SetValue((int)property->GetValue().IntegerValue()); + } + else + return FALSE; + return TRUE; } /// @@ -576,41 +580,41 @@ bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFor IMPLEMENT_DYNAMIC_CLASS(wxBoolFormValidator, wxPropertyFormValidator) bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow)) + wxWindow *WXUNUSED(parentWindow)) { - // The item used for viewing the boolean: should be a checkbox - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) - return FALSE; - - return TRUE; + // The item used for viewing the boolean: should be a checkbox + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) + return FALSE; + + return TRUE; } bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow) ) + wxWindow *WXUNUSED(parentWindow) ) { - // The item used for viewing the boolean: should be a checkbox. - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) - return FALSE; - - wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow; - - property->GetValue() = (bool)checkBox->GetValue(); - return TRUE; + // The item used for viewing the boolean: should be a checkbox. + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) + return FALSE; + + wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow; + + property->GetValue() = (bool)checkBox->GetValue(); + return TRUE; } bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow)) + wxWindow *WXUNUSED(parentWindow)) { - // The item used for viewing the boolean: should be a checkbox. - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) - return FALSE; - - wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow; - checkBox->SetValue((bool)property->GetValue().BoolValue()); - return TRUE; + // The item used for viewing the boolean: should be a checkbox. + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) + return FALSE; + + wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow; + checkBox->SetValue((bool)property->GetValue().BoolValue()); + return TRUE; } /// @@ -619,135 +623,135 @@ bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormVie IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator) wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags): - wxPropertyFormValidator(flags) +wxPropertyFormValidator(flags) { - m_strings = list; + m_strings = list; } bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *parentWindow ) + wxWindow *parentWindow ) { - if (!m_strings) - return TRUE; - - // The item used for viewing the string: should be a text item, choice item or listbox. - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow) - return FALSE; - if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; - if (!m_strings->Member(text->GetValue())) + if (!m_strings) + return TRUE; + + // The item used for viewing the string: should be a text item, choice item or listbox. + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow) + return FALSE; + if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) { - wxString s("Value "); - s += text->GetValue(); - s += " is not valid."; - wxMessageBox(s, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; + wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; + if (!m_strings->Member(text->GetValue())) + { + wxString s("Value "); + s += text->GetValue(); + s += " is not valid."; + wxMessageBox(s, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } } - } - else - { - // Any other item constrains the string value, - // so we don't have to check it. - } - return TRUE; + else + { + // Any other item constrains the string value, + // so we don't have to check it. + } + return TRUE; } bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow) ) -{ - // The item used for viewing the string: should be a text item, choice item or listbox. - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow) - return FALSE; - if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; - property->GetValue() = text->GetValue(); - } - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox))) - { - wxListBox *lbox = (wxListBox *)m_propertyWindow; - if (lbox->GetSelection() > -1) - property->GetValue() = lbox->GetStringSelection(); - } -/* - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox))) - { + wxWindow *WXUNUSED(parentWindow) ) +{ + // The item used for viewing the string: should be a text item, choice item or listbox. + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow) + return FALSE; + if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + { + wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; + property->GetValue() = text->GetValue(); + } + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox))) + { + wxListBox *lbox = (wxListBox *)m_propertyWindow; + if (lbox->GetSelection() > -1) + property->GetValue() = lbox->GetStringSelection(); + } + /* + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox))) + { wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow; int n = 0; if ((n = rbox->GetSelection()) > -1) - property->GetValue() = rbox->GetString(n); - } -*/ - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice))) - { - wxChoice *choice = (wxChoice *)m_propertyWindow; - if (choice->GetSelection() > -1) - property->GetValue() = choice->GetStringSelection(); - } - else - return FALSE; - return TRUE; + property->GetValue() = rbox->GetString(n); + } + */ + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice))) + { + wxChoice *choice = (wxChoice *)m_propertyWindow; + if (choice->GetSelection() > -1) + property->GetValue() = choice->GetStringSelection(); + } + else + return FALSE; + return TRUE; } bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow) ) -{ - // The item used for viewing the string: should be a text item, choice item or listbox. - wxWindow *m_propertyWindow = property->GetWindow(); - if (!m_propertyWindow) - return FALSE; - if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; - text->SetValue(property->GetValue().StringValue()); - } - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox))) - { - wxListBox *lbox = (wxListBox *)m_propertyWindow; - if (lbox->Number() == 0 && m_strings) + wxWindow *WXUNUSED(parentWindow) ) +{ + // The item used for viewing the string: should be a text item, choice item or listbox. + wxWindow *m_propertyWindow = property->GetWindow(); + if (!m_propertyWindow) + return FALSE; + if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) { - // Try to initialize the listbox from 'strings' - wxNode *node = m_strings->First(); - while (node) - { - char *s = (char *)node->Data(); - lbox->Append(s); - node = node->Next(); - } + wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; + text->SetValue(property->GetValue().StringValue()); } - lbox->SetStringSelection(property->GetValue().StringValue()); - } -/* - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox))) - { + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox))) + { + wxListBox *lbox = (wxListBox *)m_propertyWindow; + if (lbox->Number() == 0 && m_strings) + { + // Try to initialize the listbox from 'strings' + wxNode *node = m_strings->First(); + while (node) + { + char *s = (char *)node->Data(); + lbox->Append(s); + node = node->Next(); + } + } + lbox->SetStringSelection(property->GetValue().StringValue()); + } + /* + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox))) + { wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow; rbox->SetStringSelection(property->GetValue().StringValue()); - } -*/ - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice))) - { - wxChoice *choice = (wxChoice *)m_propertyWindow; -#ifndef __XVIEW__ - if (choice->Number() == 0 && m_strings) - { - // Try to initialize the choice item from 'strings' - // XView doesn't allow this kind of thing. - wxNode *node = m_strings->First(); - while (node) - { - char *s = (char *)node->Data(); - choice->Append(s); - node = node->Next(); - } } + */ + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice))) + { + wxChoice *choice = (wxChoice *)m_propertyWindow; +#ifndef __XVIEW__ + if (choice->Number() == 0 && m_strings) + { + // Try to initialize the choice item from 'strings' + // XView doesn't allow this kind of thing. + wxNode *node = m_strings->First(); + while (node) + { + char *s = (char *)node->Data(); + choice->Append(s); + node = node->Next(); + } + } #endif - choice->SetStringSelection(property->GetValue().StringValue()); - } - else - return FALSE; - return TRUE; + choice->SetStringSelection(property->GetValue().StringValue()); + } + else + return FALSE; + return TRUE; } diff --git a/src/generic/proplist.cpp b/src/generic/proplist.cpp index 60e51cadd6..d5f5dcd9c4 100644 --- a/src/generic/proplist.cpp +++ b/src/generic/proplist.cpp @@ -72,7 +72,7 @@ static wxBitmap *GetCrossBitmap(); // Property text edit control // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPropertyTextEdit, wxTextCtrl) +IMPLEMENT_DYNAMIC_CLASS(wxPropertyTextEdit, wxTextCtrl) wxPropertyTextEdit::wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, const wxWindowID id, const wxString& value, @@ -675,7 +675,7 @@ void wxPropertyListView::OnText(wxCommandEvent& event) // Property dialog box // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPropertyListDialog, wxDialog) +IMPLEMENT_DYNAMIC_CLASS(wxPropertyListDialog, wxDialog) BEGIN_EVENT_TABLE(wxPropertyListDialog, wxDialog) EVT_BUTTON(wxID_CANCEL, wxPropertyListDialog::OnCancel) @@ -735,7 +735,7 @@ bool wxPropertyListDialog::ProcessEvent(wxEvent& event) // Property panel // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPropertyListPanel, wxPanel) +IMPLEMENT_DYNAMIC_CLASS(wxPropertyListPanel, wxPanel) BEGIN_EVENT_TABLE(wxPropertyListPanel, wxPanel) EVT_SIZE(wxPropertyListPanel::OnSize) @@ -771,7 +771,7 @@ void wxPropertyListPanel::OnSize(wxSizeEvent& WXUNUSED(event)) // Property frame // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPropertyListFrame, wxFrame) +IMPLEMENT_DYNAMIC_CLASS(wxPropertyListFrame, wxFrame) BEGIN_EVENT_TABLE(wxPropertyListFrame, wxFrame) EVT_CLOSE(wxPropertyListFrame::OnCloseWindow) diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index 160dcb158b..a808264d02 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -45,28 +45,19 @@ BEGIN_EVENT_TABLE(wxSashWindow, wxWindow) EVT_MOUSE_EVENTS(wxSashWindow::OnMouseEvent) END_EVENT_TABLE() -wxSashWindow::wxSashWindow() +bool wxSashWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, + const wxSize& size, long style, const wxString& name) { - m_draggingEdge = wxSASH_NONE; - m_dragMode = wxSASH_DRAG_NONE; - m_oldX = 0; - m_oldY = 0; - m_firstX = 0; - m_firstY = 0; - m_borderSize = 3 ; - m_extraBorderSize = 0; - m_sashCursorWE = NULL; - m_sashCursorNS = NULL; + return wxWindow::Create(parent, id, pos, size, style, name); +} - m_minimumPaneSizeX = 0; - m_minimumPaneSizeY = 0; - m_maximumPaneSizeX = 10000; - m_maximumPaneSizeY = 10000; +wxSashWindow::~wxSashWindow() +{ + delete m_sashCursorWE; + delete m_sashCursorNS; } -wxSashWindow::wxSashWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, - const wxSize& size, long style, const wxString& name) - :wxWindow(parent, id, pos, size, style, name) +void wxSashWindow::Init() { m_draggingEdge = wxSASH_NONE; m_dragMode = wxSASH_DRAG_NONE; @@ -87,12 +78,6 @@ wxSashWindow::wxSashWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, InitColours(); } -wxSashWindow::~wxSashWindow() -{ - delete m_sashCursorWE; - delete m_sashCursorNS; -} - void wxSashWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); @@ -415,7 +400,7 @@ void wxSashWindow::DrawBorders(wxDC& dc) wxPen lightShadowPen(m_lightShadowColour, 1, wxSOLID); wxPen hilightPen(m_hilightColour, 1, wxSOLID); - if ( GetWindowStyleFlag() & wxSW_3D ) + if ( GetWindowStyleFlag() & wxSW_3DBORDER ) { dc.SetPen(mediumShadowPen); dc.DrawLine(0, 0, w-1, 0); @@ -480,7 +465,7 @@ void wxSashWindow::DrawSash(wxSashEdgePosition edge, wxDC& dc) dc.SetBrush(faceBrush); dc.DrawRectangle(sashPosition, 0, GetEdgeMargin(edge), h); - if (GetWindowStyleFlag() & wxSW_3D) + if (GetWindowStyleFlag() & wxSW_3DSASH) { if (edge == wxSASH_LEFT) { @@ -491,9 +476,9 @@ void wxSashWindow::DrawSash(wxSashEdgePosition edge, wxDC& dc) } else { - // Draw a light grey line on the right to indicate that the + // Draw a highlight line on the right to indicate that the // sash is raised - dc.SetPen(lightShadowPen); + dc.SetPen(hilightPen); dc.DrawLine(w - GetEdgeMargin(edge), 0, w - GetEdgeMargin(edge), h); } } @@ -510,13 +495,13 @@ void wxSashWindow::DrawSash(wxSashEdgePosition edge, wxDC& dc) dc.SetBrush(faceBrush); dc.DrawRectangle(0, sashPosition, w, GetEdgeMargin(edge)); - if (GetWindowStyleFlag() & wxSW_3D) + if (GetWindowStyleFlag() & wxSW_3DSASH) { if (edge == wxSASH_BOTTOM) { - // Draw a light grey line on the bottom to indicate that the + // Draw a highlight line on the bottom to indicate that the // sash is raised - dc.SetPen(lightShadowPen); + dc.SetPen(hilightPen); dc.DrawLine(0, h - GetEdgeMargin(edge), w, h - GetEdgeMargin(edge)); } else diff --git a/src/generic/scrolwin.cpp b/src/generic/scrolwin.cpp index 1a8af01547..f73c8875c8 100644 --- a/src/generic/scrolwin.cpp +++ b/src/generic/scrolwin.cpp @@ -534,10 +534,10 @@ void wxScrolledWindow::Scroll( int x_pos, int y_pos ) m_xScrollPosition = wxMin( m_xScrollLines-noPagePositions, m_xScrollPosition ); m_xScrollPosition = wxMax( 0, m_xScrollPosition ); - if (old_x == m_xScrollPosition) return; - - m_targetWindow->SetScrollPos( wxHORIZONTAL, m_xScrollPosition, TRUE ); - m_targetWindow->ScrollWindow( (old_x-m_xScrollPosition)*m_xScrollPixelsPerLine, 0 ); + if (old_x != m_xScrollPosition) { + m_targetWindow->SetScrollPos( wxHORIZONTAL, m_xScrollPosition, TRUE ); + m_targetWindow->ScrollWindow( (old_x-m_xScrollPosition)*m_xScrollPixelsPerLine, 0 ); + } } if ((y_pos != -1) && (m_yScrollPixelsPerLine)) { @@ -554,10 +554,10 @@ void wxScrolledWindow::Scroll( int x_pos, int y_pos ) m_yScrollPosition = wxMin( m_yScrollLines-noPagePositions, m_yScrollPosition ); m_yScrollPosition = wxMax( 0, m_yScrollPosition ); - if (old_y == m_yScrollPosition) return; - - m_targetWindow->SetScrollPos( wxVERTICAL, m_yScrollPosition, TRUE ); - m_targetWindow->ScrollWindow( 0, (old_y-m_yScrollPosition)*m_yScrollPixelsPerLine ); + if (old_y != m_yScrollPosition) { + m_targetWindow->SetScrollPos( wxVERTICAL, m_yScrollPosition, TRUE ); + m_targetWindow->ScrollWindow( 0, (old_y-m_yScrollPosition)*m_yScrollPixelsPerLine ); + } } #ifdef __WXMAC__ diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index 71eb3741c4..68a393a4a8 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -53,42 +53,36 @@ BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow) EVT_SPLITTER_UNSPLIT(-1, wxSplitterWindow::OnUnsplitEvent) END_EVENT_TABLE() -wxSplitterWindow::wxSplitterWindow() -{ - m_splitMode = wxSPLIT_VERTICAL; - m_permitUnsplitAlways = FALSE; - m_windowOne = (wxWindow *) NULL; - m_windowTwo = (wxWindow *) NULL; - m_dragMode = wxSPLIT_DRAG_NONE; - m_oldX = 0; - m_oldY = 0; - m_firstX = 0; - m_firstY = 0; - m_sashSize = 7; - m_borderSize = 2; - m_sashPosition = 0; - m_sashCursorWE = (wxCursor *) NULL; - m_sashCursorNS = (wxCursor *) NULL; - m_sashTrackerPen = (wxPen *) NULL; - m_lightShadowPen = (wxPen *) NULL; - m_mediumShadowPen = (wxPen *) NULL; - m_darkShadowPen = (wxPen *) NULL; - m_faceBrush = (wxBrush *) NULL; - m_facePen = (wxPen *) NULL; - m_hilightPen = (wxPen *) NULL; - m_minimumPaneSize = 0; - m_needUpdating = FALSE; -} - -wxSplitterWindow::wxSplitterWindow(wxWindow *parent, wxWindowID id, +bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) - : wxWindow(parent, id, pos, size, style, name) { - m_splitMode = wxSPLIT_VERTICAL; + if (!wxWindow::Create(parent, id, pos, size, style, name)) + return FALSE; + m_permitUnsplitAlways = (style & wxSP_PERMIT_UNSPLIT) != 0; + + if ( style & wxSP_3DSASH ) + m_sashSize = 7; + else + m_sashSize = 3; + + if ( style & wxSP_3DBORDER ) + m_borderSize = 2; + else if ( style & wxSP_BORDER ) + m_borderSize = 1; + else + m_borderSize = 0; + + return TRUE; +} + +void wxSplitterWindow::Init() +{ + m_splitMode = wxSPLIT_VERTICAL; + m_permitUnsplitAlways = TRUE; m_windowOne = (wxWindow *) NULL; m_windowTwo = (wxWindow *) NULL; m_dragMode = wxSPLIT_DRAG_NONE; @@ -110,28 +104,11 @@ wxSplitterWindow::wxSplitterWindow(wxWindow *parent, wxWindowID id, m_facePen = (wxPen *) NULL; m_hilightPen = (wxPen *) NULL; - if ( style & wxSP_3D ) - { - m_borderSize = 2; - m_sashSize = 7; - } - else if ( style & wxSP_BORDER ) - { - m_borderSize = 1; - m_sashSize = 3; - } - else - { - m_borderSize = 0; - m_sashSize = 3; - } + m_borderSize = 0; + m_sashSize = 3; - // Eventually, we'll respond to colour change messages InitColours(); - // For debugging purposes, to see the background. -// SetBackground(wxBLUE_BRUSH); - m_needUpdating = FALSE; } @@ -176,6 +153,8 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) SetCursor(wxCursor()); #endif + if (GetWindowStyle() & wxSP_NOSASH) + return; if (event.LeftDown()) { @@ -459,7 +438,7 @@ void wxSplitterWindow::DrawBorders(wxDC& dc) int w, h; GetClientSize(&w, &h); - if ( GetWindowStyleFlag() & wxSP_3D ) + if ( GetWindowStyleFlag() & wxSP_3DBORDER ) { dc.SetPen(*m_facePen); @@ -502,11 +481,13 @@ void wxSplitterWindow::DrawSash(wxDC& dc) { if ( m_sashPosition == 0 || !m_windowTwo) return; + if (GetWindowStyle() & wxSP_NOSASH) + return; int w, h; GetClientSize(&w, &h); - if ( GetWindowStyleFlag() & wxSP_3D ) + if ( GetWindowStyleFlag() & wxSP_3DSASH ) { if ( m_splitMode == wxSPLIT_VERTICAL ) { @@ -517,7 +498,7 @@ void wxSplitterWindow::DrawSash(wxDC& dc) dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetPen(*m_lightShadowPen); - int xShadow = m_borderSize ? m_borderSize - 1 : 0 ; + int xShadow = m_borderSize ? m_borderSize - 1 : 0 ; dc.DrawLine(m_sashPosition, xShadow , m_sashPosition, h-m_borderSize); dc.SetPen(*m_hilightPen); @@ -529,6 +510,18 @@ void wxSplitterWindow::DrawSash(wxDC& dc) dc.SetPen(*m_darkShadowPen); dc.DrawLine(m_sashPosition+m_sashSize-1, m_borderSize, m_sashPosition+m_sashSize-1, h-m_borderSize ); + + // Draw the top and bottom edges of the sash, if requested + if (GetWindowStyle() & wxSP_FULLSASH) + { + // Top + dc.SetPen(*m_hilightPen); + dc.DrawLine(m_sashPosition+1, m_borderSize, m_sashPosition+m_sashSize-1, m_borderSize); + + // Bottom + dc.SetPen(*m_darkShadowPen); + dc.DrawLine(m_sashPosition+1, h-m_borderSize-1, m_sashPosition+m_sashSize-1, h-m_borderSize-1); + } } else { @@ -549,6 +542,18 @@ void wxSplitterWindow::DrawSash(wxDC& dc) dc.SetPen(*m_darkShadowPen); dc.DrawLine(m_borderSize, m_sashPosition+m_sashSize-1, w-m_borderSize, m_sashPosition+m_sashSize-1); + + // Draw the left and right edges of the sash, if requested + if (GetWindowStyle() & wxSP_FULLSASH) + { + // Left + dc.SetPen(*m_hilightPen); + dc.DrawLine(m_borderSize, m_sashPosition, m_borderSize, m_sashPosition+m_sashSize); + + // Right + dc.SetPen(*m_darkShadowPen); + dc.DrawLine(w-m_borderSize-1, m_sashPosition+1, w-m_borderSize-1, m_sashPosition+m_sashSize-1); + } } } else @@ -558,19 +563,28 @@ void wxSplitterWindow::DrawSash(wxDC& dc) dc.SetPen(*wxBLACK_PEN); dc.SetBrush(*wxBLACK_BRUSH); int h1 = h-1; - if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER ) + int y1 = 0; + if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER ) h1 += 1; // Not sure why this is necessary... - dc.DrawRectangle(m_sashPosition, 0, m_sashSize, h1); + if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER) + { + y1 = 2; h1 -= 3; + } + dc.DrawRectangle(m_sashPosition, y1, m_sashSize, h1); } else { dc.SetPen(*wxBLACK_PEN); dc.SetBrush(*wxBLACK_BRUSH); int w1 = w-1; - if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER ) + int x1 = 0; + if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER ) w1 ++; - - dc.DrawRectangle(0, m_sashPosition, w1, m_sashSize); + if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER) + { + x1 = 2; w1 -= 3; + } + dc.DrawRectangle(x1, m_sashPosition, w1, m_sashSize); } } @@ -643,44 +657,42 @@ void wxSplitterWindow::SizeWindows() int w, h; GetClientSize(&w, &h); - if ( m_windowOne && !m_windowTwo ) + if ( GetWindow1() && !GetWindow2() ) { - m_windowOne->SetSize(m_borderSize, m_borderSize, w - 2*m_borderSize, h - 2*m_borderSize); + GetWindow1()->SetSize(GetBorderSize(), GetBorderSize(), w - 2*GetBorderSize(), h - 2*GetBorderSize()); } - else if ( m_windowOne && m_windowTwo ) + else if ( GetWindow1() && GetWindow2() ) { - if (m_splitMode == wxSPLIT_VERTICAL) + if (GetSplitMode() == wxSPLIT_VERTICAL) { - int x1 = m_borderSize; - int y1 = m_borderSize; - int w1 = m_sashPosition - m_borderSize; - int h1 = h - 2*m_borderSize; - - int x2 = m_sashPosition + m_sashSize; - int y2 = m_borderSize; - int w2 = w - 2*m_borderSize - m_sashSize - w1; - int h2 = h - 2*m_borderSize; - - m_windowOne->SetSize(x1, y1, w1, h1); - m_windowTwo->SetSize(x2, y2, w2, h2); - + int x1 = GetBorderSize(); + int y1 = GetBorderSize(); + int w1 = GetSashPosition() - GetBorderSize(); + int h1 = h - 2*GetBorderSize(); + + int x2 = GetSashPosition() + GetSashSize(); + int y2 = GetBorderSize(); + int w2 = w - 2*GetBorderSize() - GetSashSize() - w1; + int h2 = h - 2*GetBorderSize(); + + GetWindow1()->SetSize(x1, y1, w1, h1); + GetWindow2()->SetSize(x2, y2, w2, h2); } else { - m_windowOne->SetSize(m_borderSize, m_borderSize, - w - 2*m_borderSize, m_sashPosition - m_borderSize); - m_windowTwo->SetSize(m_borderSize, m_sashPosition + m_sashSize, - w - 2*m_borderSize, h - 2*m_borderSize - m_sashSize - (m_sashPosition - m_borderSize)); - + GetWindow1()->SetSize(GetBorderSize(), GetBorderSize(), + w - 2*GetBorderSize(), GetSashPosition() - GetBorderSize()); + GetWindow2()->SetSize(GetBorderSize(), GetSashPosition() + GetSashSize(), + w - 2*GetBorderSize(), h - 2*GetBorderSize() - GetSashSize() - (GetSashPosition() - GetBorderSize())); } } wxClientDC dc(this); - if ( m_borderSize > 0 ) + if ( GetBorderSize() > 0 ) DrawBorders(dc); DrawSash(dc); - m_needUpdating = FALSE; + SetNeedUpdating(FALSE); } // Set pane for unsplit window diff --git a/src/generic/treectrl.cpp b/src/generic/treectrl.cpp index b4bf898049..24be5cdf92 100644 --- a/src/generic/treectrl.cpp +++ b/src/generic/treectrl.cpp @@ -611,6 +611,7 @@ void wxTreeCtrl::Init() m_oldSelection = (wxGenericTreeItem *)NULL; m_renameTimer = new wxTreeRenameTimer( this ); + m_lastOnSame = FALSE; m_normalFont = wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ); m_boldFont = wxFont( m_normalFont.GetPointSize(), @@ -987,8 +988,7 @@ wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text, m_current->SetHilight( TRUE ); } - Refresh(); - AdjustMyScrollbars(); + m_dirty = TRUE; return m_anchor; } @@ -1126,6 +1126,8 @@ void wxTreeCtrl::Expand(const wxTreeItemId& itemId) { wxGenericTreeItem *item = itemId.m_pItem; + wxCHECK_RET( item, _T("invalid item in wxTreeCtrl::Expand") ); + if ( !item->HasPlus() ) return; @@ -1136,7 +1138,6 @@ void wxTreeCtrl::Expand(const wxTreeItemId& itemId) event.m_item = item; event.SetEventObject( this ); -// if ( ProcessEvent( event ) && event.m_code ) TODO: Was this a typo ? if ( ProcessEvent( event ) && !event.IsAllowed() ) { // cancelled by program @@ -1152,6 +1153,22 @@ void wxTreeCtrl::Expand(const wxTreeItemId& itemId) ProcessEvent( event ); } +void wxTreeCtrl::ExpandAll(const wxTreeItemId& item) +{ + Expand(item); + if ( IsExpanded(item) ) + { + long cookie; + wxTreeItemId child = GetFirstChild(item, cookie); + while ( child.IsOk() ) + { + ExpandAll(child); + + child = GetNextChild(item, cookie); + } + } +} + void wxTreeCtrl::Collapse(const wxTreeItemId& itemId) { wxGenericTreeItem *item = itemId.m_pItem; @@ -1391,14 +1408,19 @@ void wxTreeCtrl::FillArray(wxGenericTreeItem *item, wxArrayGenericTreeItems& children = item->GetChildren(); size_t count = children.GetCount(); for ( size_t n = 0; n < count; ++n ) - FillArray(children[n],array); + FillArray(children[n], array); } } size_t wxTreeCtrl::GetSelections(wxArrayTreeItemIds &array) const { array.Empty(); - FillArray(GetRootItem().m_pItem, array); + wxTreeItemId idRoot = GetRootItem(); + if ( idRoot.IsOk() ) + { + FillArray(idRoot.m_pItem, array); + } + //else: the tree is empty, so no selections return array.Count(); } @@ -1638,8 +1660,10 @@ void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) } dc.SetBackgroundMode(wxTRANSPARENT); - dc.DrawText( item->GetText(), image_w + item->GetX(), (wxCoord)item->GetY() - + ((total_h > text_h) ? (total_h - text_h)/2 : 0)); + int extraH = (total_h > text_h) ? (total_h - text_h)/2 : 0; + dc.DrawText( item->GetText(), + (wxCoord)(image_w + item->GetX()), + (wxCoord)(item->GetY() + extraH)); // restore normal font dc.SetFont( m_normalFont ); @@ -1866,7 +1890,7 @@ void wxTreeCtrl::OnChar( wxKeyEvent &event ) // + : Expand // - : Collaspe - // * : Toggle Expand/Collapse + // * : Expand all/Collapse all // ' ' | return : activate // up : go up (not last children!) // down : go down @@ -1884,6 +1908,16 @@ void wxTreeCtrl::OnChar( wxKeyEvent &event ) } break; + case '*': + case WXK_MULTIPLY: + if ( !IsExpanded(m_current) ) + { + // expand all + ExpandAll(m_current); + break; + } + //else: fall through to Collapse() it + case '-': case WXK_SUBTRACT: if (IsExpanded(m_current)) @@ -1892,11 +1926,6 @@ void wxTreeCtrl::OnChar( wxKeyEvent &event ) } break; - case '*': - case WXK_MULTIPLY: - Toggle(m_current); - break; - case ' ': case WXK_RETURN: { @@ -2144,7 +2173,8 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event ) // we process left mouse up event (enables in-place edit), right down // (pass to the user code), left dbl click (activate item) and // dragging/moving events for items drag-and-drop - if ( !(event.LeftUp() || + if ( !(event.LeftDown() || + event.LeftUp() || event.RightDown() || event.LeftDClick() || event.Dragging() || @@ -2163,8 +2193,6 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event ) int flags = 0; wxGenericTreeItem *item = m_anchor->HitTest( wxPoint(x,y), this, flags); - bool onButton = flags & wxTREE_HITTEST_ONITEMBUTTON; - if ( event.Dragging() && !m_isDragging ) { if (m_dragCount == 0) @@ -2275,14 +2303,24 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event ) nevent.SetEventObject(this); GetEventHandler()->ProcessEvent(nevent); } - else if ( event.LeftUp() && (item == m_current) && + else if ( event.LeftUp() && m_lastOnSame ) + { + if ( (item == m_current) && (flags & wxTREE_HITTEST_ONITEMLABEL) && HasFlag(wxTR_EDIT_LABELS) ) - { - m_renameTimer->Start( 100, TRUE ); + { + m_renameTimer->Start( 100, TRUE ); + } + + m_lastOnSame = FALSE; } else { + if ( event.LeftDown() ) + { + m_lastOnSame = item == m_current; + } + // how should the selection work for this event? bool is_multiple, extended_select, unselect_others; EventFlagsToSelType(GetWindowStyleFlag(), @@ -2290,7 +2328,7 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event ) event.ControlDown(), is_multiple, extended_select, unselect_others); - if ( onButton ) + if ( (flags & wxTREE_HITTEST_ONITEMBUTTON) && event.LeftDown() ) { Toggle( item ); if ( is_multiple ) @@ -2301,6 +2339,10 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event ) if ( event.LeftDClick() ) { + // double clicking should not start editing the item label + m_renameTimer->Stop(); + m_lastOnSame = FALSE; + wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); nevent.m_item = item; nevent.m_code = 0; diff --git a/src/generic/treelay.cpp b/src/generic/treelay.cpp index f75f813744..947d53e6ac 100644 --- a/src/generic/treelay.cpp +++ b/src/generic/treelay.cpp @@ -21,7 +21,7 @@ #endif #ifndef WX_PRECOMP -#include <wx/wx.h> +#include "wx/wx.h" #endif #if wxUSE_TREELAYOUT @@ -99,12 +99,12 @@ void wxTreeLayout::DrawBranches(wxDC& dc) void wxTreeLayout::DrawNode(long id, wxDC& dc) { - char buf[80]; + wxChar buf[80]; wxString name(GetNodeName(id)); - if (name != "") - sprintf(buf, "%s", (const char*) name); + if (name != wxT("")) + wxSprintf(buf, wxT("%s"), (const wxChar*) name); else - sprintf(buf, "<unnamed>"); + wxSprintf(buf, wxT("<unnamed>")); long x = 80; long y = 20; @@ -127,7 +127,7 @@ void wxTreeLayout::Initialize(void) void wxTreeLayout::GetNodeSize(long id, long *x, long *y, wxDC& dc) { wxString name(GetNodeName(id)); - if (name != "") + if (name != wxT("")) dc.GetTextExtent(name, x, y); else { @@ -283,7 +283,7 @@ long wxTreeLayoutStored::AddChild(const wxString& name, const wxString& parent) if (m_num < (m_maxNodes -1 )) { long i = -1; - if (parent != "") + if (parent != wxT("")) i = NameToId(parent); else m_parentNode = m_num; @@ -427,8 +427,6 @@ wxString wxTreeLayoutStored::HitTest(wxMouseEvent& event, wxDC& dc) int i; for (i = 0; i < m_maxNodes; i++) { - wxStoredNode* item = &m_nodes[i]; - long width, height; dc.GetTextExtent(m_nodes[i].m_name, &width, &height); diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index fdd9dc7a8c..cd776451c2 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -32,6 +32,7 @@ #include "wx/dynarray.h" #include "wx/intl.h" #include "wx/statbmp.h" + #include "wx/button.h" #endif //WX_PRECOMP #include "wx/statline.h" @@ -94,10 +95,24 @@ wxWizard::wxWizard(wxWindow *parent, int id, const wxString& title, const wxBitmap& bitmap, - const wxPoint& pos, - const wxSize& size) - : m_bitmap(bitmap) + const wxPoint& pos) + : m_posWizard(pos), m_bitmap(bitmap) { + // just create the dialog itself here, the controls will be created in + // DoCreateControls() called later when we know our final size + m_page = (wxWizardPage *)NULL; + m_btnPrev = m_btnNext = NULL; + m_statbmp = NULL; + + (void)wxDialog::Create(parent, id, title, pos); +} + +void wxWizard::DoCreateControls() +{ + // do nothing if the controls were already created + if ( WasCreated() ) + return; + // constants defining the dialog layout // ------------------------------------ @@ -122,38 +137,41 @@ wxWizard::wxWizard(wxWindow *parent, static const int DEFAULT_PAGE_WIDTH = 270; static const int DEFAULT_PAGE_HEIGHT = 290; - // init members - // ------------ - - m_page = (wxWizardPage *)NULL; - // create controls // --------------- wxSize sizeBtn = wxButton::GetDefaultSize(); - (void)wxDialog::Create(parent, id, title, pos, size); - // the global dialog layout is: a row of buttons at the bottom (aligned to // the right), the static line above them, the bitmap (if any) on the left // of the upper part of the dialog and the panel in the remaining space m_x = X_MARGIN; m_y = Y_MARGIN; - if ( bitmap.Ok() ) + + int defaultHeight; + if ( m_bitmap.Ok() ) { - m_statbmp = new wxStaticBitmap(this, -1, bitmap, wxPoint(m_x, m_y)); + m_statbmp = new wxStaticBitmap(this, -1, m_bitmap, wxPoint(m_x, m_y)); - m_x += bitmap.GetWidth() + BITMAP_X_MARGIN; - m_height = bitmap.GetHeight(); + m_x += m_bitmap.GetWidth() + BITMAP_X_MARGIN; + + defaultHeight = m_bitmap.GetHeight(); } else { m_statbmp = (wxStaticBitmap *)NULL; - m_height = DEFAULT_PAGE_HEIGHT; + defaultHeight = DEFAULT_PAGE_HEIGHT; } - m_width = DEFAULT_PAGE_WIDTH; + // use default size if none given and also make sure that the dialog is + // not less than the default size + m_height = m_sizePage.y == -1 ? defaultHeight : m_sizePage.y; + m_width = m_sizePage.x == -1 ? DEFAULT_PAGE_WIDTH : m_sizePage.x; + if ( m_height < defaultHeight ) + m_height = defaultHeight; + if ( m_width < DEFAULT_PAGE_WIDTH ) + m_width = DEFAULT_PAGE_WIDTH; int x = X_MARGIN; int y = m_y + m_height + BITMAP_Y_MARGIN; @@ -161,14 +179,14 @@ wxWizard::wxWizard(wxWindow *parent, #if wxUSE_STATLINE (void)new wxStaticLine(this, -1, wxPoint(x, y), wxSize(m_x + m_width - x, 2)); -#endif +#endif // wxUSE_STATLINE x = m_x + m_width - 3*sizeBtn.x - BUTTON_MARGIN; y += SEPARATOR_LINE_MARGIN; - m_btnPrev = new wxButton(this, -1, _("< &Back"), wxPoint(x, y), sizeBtn); + m_btnPrev = new wxButton(this, wxID_BACKWARD, _("< &Back"), wxPoint(x, y), sizeBtn); x += sizeBtn.x; - m_btnNext = new wxButton(this, -1, _("&Next >"), wxPoint(x, y), sizeBtn); + m_btnNext = new wxButton(this, wxID_FORWARD, _("&Next >"), wxPoint(x, y), sizeBtn); x += sizeBtn.x + BUTTON_MARGIN; (void)new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(x, y), sizeBtn); @@ -176,19 +194,24 @@ wxWizard::wxWizard(wxWindow *parent, // position and size the dialog // ---------------------------- - if ( size == wxDefaultSize ) - { - SetClientSize(m_x + m_width + X_MARGIN, - m_y + m_height + BITMAP_Y_MARGIN + - SEPARATOR_LINE_MARGIN + sizeBtn.y + Y_MARGIN); - } + SetClientSize(m_x + m_width + X_MARGIN, + m_y + m_height + BITMAP_Y_MARGIN + + SEPARATOR_LINE_MARGIN + sizeBtn.y + Y_MARGIN); - if ( pos == wxDefaultPosition ) + if ( m_posWizard == wxDefaultPosition ) { CentreOnScreen(); } } +void wxWizard::SetPageSize(const wxSize& size) +{ + // otherwise it will have no effect now as it's too late... + wxASSERT_MSG( !WasCreated(), _T("should be called before RunWizard()!") ); + + m_sizePage = size; +} + bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) { wxASSERT_MSG( page != m_page, wxT("this is useless") ); @@ -202,13 +225,6 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) if ( m_page ) { - // ask the current page first - if ( !m_page->TransferDataFromWindow() ) - { - // the page data is incorrect - return FALSE; - } - // send the event to the old page wxWizardEvent event(wxEVT_WIZARD_PAGE_CHANGING, GetId(), goingForward); if ( m_page->GetEventHandler()->ProcessEvent(event) && @@ -278,6 +294,8 @@ bool wxWizard::RunWizard(wxWizardPage *firstPage) { wxCHECK_MSG( firstPage, FALSE, wxT("can't run empty wizard") ); + DoCreateControls(); + // can't return FALSE here because there is no old page (void)ShowPage(firstPage, TRUE /* forward */); @@ -291,6 +309,10 @@ wxWizardPage *wxWizard::GetCurrentPage() const wxSize wxWizard::GetPageSize() const { + // make sure that the controls are created because otherwise m_width and + // m_height would be both still -1 + wxConstCast(this, wxWizard)->DoCreateControls(); + return wxSize(m_width, m_height); } @@ -315,6 +337,15 @@ void wxWizard::OnBackOrNext(wxCommandEvent& event) (event.GetEventObject() == m_btnPrev), wxT("unknown button") ); + // ask the current page first: notice that we do it before calling + // GetNext/Prev() because the data transfered from the controls of the page + // may change the value returned by these methods + if ( m_page && !m_page->TransferDataFromWindow() ) + { + // the page data is incorrect, don't do anything + return; + } + bool forward = event.GetEventObject() == m_btnNext; wxWizardPage *page; @@ -343,9 +374,9 @@ wxWizard *wxWizardBase::Create(wxWindow *parent, const wxString& title, const wxBitmap& bitmap, const wxPoint& pos, - const wxSize& size) + const wxSize& WXUNUSED(size)) { - return new wxWizard(parent, id, title, bitmap, pos, size); + return new wxWizard(parent, id, title, bitmap, pos); } // ---------------------------------------------------------------------------- diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 6369b7d3a7..7505f40b8a 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -96,7 +96,7 @@ bool wxYield() if (has_idle) { /* re-add idle handler (very low priority) */ - wxTheApp->m_idleTag = gtk_idle_add_priority( 500, wxapp_idle_callback, (gpointer) NULL ); + wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL ); } // disable log flushing from here because a call to wxYield() shouldn't @@ -179,7 +179,7 @@ void wxapp_install_idle_handler() to the main thread (and processing these in idle time). Very low priority. */ - wxTheApp->m_idleTag = gtk_idle_add_priority( 500, wxapp_idle_callback, (gpointer) NULL ); + wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL ); g_isIdle = FALSE; } @@ -250,7 +250,7 @@ wxApp::wxApp() m_topWindow = (wxWindow *) NULL; m_exitOnFrameDelete = TRUE; - m_idleTag = gtk_idle_add_priority( 500, wxapp_idle_callback, (gpointer) NULL ); + m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL ); #if wxUSE_THREADS m_wakeUpTimerTag = 0; @@ -415,7 +415,7 @@ bool wxApp::SendIdleEvents( wxWindow* win ) wxIdleEvent event; event.SetEventObject(win); - win->ProcessEvent(event); + win->GetEventHandler()->ProcessEvent(event); win->OnInternalIdle(); diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 38d20c606c..ed3595f860 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -20,6 +20,16 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> +extern void gdk_wx_draw_bitmap (GdkDrawable *drawable, + GdkGC *gc, + GdkDrawable *src, + gint xsrc, + gint ysrc, + gint xdest, + gint ydest, + gint width, + gint height); + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- @@ -100,14 +110,14 @@ bool wxMask::Create( const wxBitmap& bitmap, if (bpp == 15) { red = red & 0xf8; - blue = blue & 0xf8; green = green & 0xf8; + blue = blue & 0xf8; } if (bpp == 16) { red = red & 0xf8; - blue = blue & 0xfc; - green = green & 0xf8; + green = green & 0xfc; + blue = blue & 0xf8; } color.red = 0; @@ -180,7 +190,7 @@ bool wxMask::Create( const wxBitmap& bitmap ) GdkGC *gc = gdk_gc_new( m_bitmap ); - gdk_draw_bitmap( m_bitmap, gc, bitmap.GetBitmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight() ); + gdk_wx_draw_bitmap( m_bitmap, gc, bitmap.GetBitmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight() ); gdk_gc_unref( gc ); @@ -351,12 +361,12 @@ wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp ) return *this; } -bool wxBitmap::operator == ( const wxBitmap& bmp ) +bool wxBitmap::operator == ( const wxBitmap& bmp ) const { return m_refData == bmp.m_refData; } -bool wxBitmap::operator != ( const wxBitmap& bmp ) +bool wxBitmap::operator != ( const wxBitmap& bmp ) const { return m_refData != bmp.m_refData; } @@ -422,7 +432,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const else { GdkGC *gc = gdk_gc_new( ret.GetBitmap() ); - gdk_draw_bitmap( ret.GetBitmap(), gc, GetBitmap(), rect.x, rect.y, 0, 0, rect.width, rect.height ); + gdk_wx_draw_bitmap( ret.GetBitmap(), gc, GetBitmap(), rect.x, rect.y, 0, 0, rect.width, rect.height ); gdk_gc_destroy( gc ); } @@ -432,7 +442,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const mask->m_bitmap = gdk_pixmap_new( wxRootWindow->window, rect.width, rect.height, 1 ); GdkGC *gc = gdk_gc_new( mask->m_bitmap ); - gdk_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, 0, 0, rect.x, rect.y, rect.width, rect.height ); + gdk_wx_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, 0, 0, rect.x, rect.y, rect.width, rect.height ); gdk_gc_destroy( gc ); ret.SetMask( mask ); diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index 32ac3f8575..b056ecbcbd 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: bmpbuttn.cpp +// Name: gtk/bmpbuttn.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ // Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -43,12 +43,12 @@ extern bool g_blockEventsOnDrag; static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); event.SetEventObject(button); button->GetEventHandler()->ProcessEvent(event); @@ -63,7 +63,7 @@ static void gtk_bmpbutton_enter_callback( GtkWidget *WXUNUSED(widget), wxBitmapB if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - button->HasFocus(); + button->HasFocus(); } //----------------------------------------------------------------------------- @@ -75,7 +75,7 @@ static void gtk_bmpbutton_leave_callback( GtkWidget *WXUNUSED(widget), wxBitmapB if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - button->NotFocus(); + button->NotFocus(); } //----------------------------------------------------------------------------- @@ -87,7 +87,7 @@ static void gtk_bmpbutton_press_callback( GtkWidget *WXUNUSED(widget), wxBitmapB if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - button->StartSelect(); + button->StartSelect(); } //----------------------------------------------------------------------------- @@ -99,7 +99,7 @@ static void gtk_bmpbutton_release_callback( GtkWidget *WXUNUSED(widget), wxBitma if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - button->EndSelect(); + button->EndSelect(); } //----------------------------------------------------------------------------- @@ -113,29 +113,30 @@ wxBitmapButton::wxBitmapButton() } bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, - const wxPoint &pos, const wxSize &size, + const wxPoint &pos, const wxSize &size, long style, const wxValidator& validator, const wxString &name ) { m_needParent = TRUE; m_acceptsFocus = TRUE; - + + m_marginX = + m_marginY = 0; + if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { wxFAIL_MSG( wxT("wxBitmapButton creation failed") ); - return FALSE; + return FALSE; } m_bitmap = bitmap; m_disabled = bitmap; m_focus = bitmap; m_selected = bitmap; - - m_label = ""; - + m_widget = gtk_button_new(); -#if (GTK_MINOR_VERSION > 0) +#if (GTK_MINOR_VERSION > 0) if (style & wxNO_BORDER) gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE ); #endif @@ -147,45 +148,45 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi GdkBitmap *mask = (GdkBitmap *) NULL; if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); GtkWidget *pixmap = gtk_pixmap_new( m_bitmap.GetPixmap(), mask ); - + gtk_widget_show( pixmap ); gtk_container_add( GTK_CONTAINER(m_widget), pixmap ); - + int border = 10; if (style & wxNO_BORDER) border = 4; if (newSize.x == -1) newSize.x = m_bitmap.GetWidth()+border; if (newSize.y == -1) newSize.y = m_bitmap.GetHeight()+border; SetSize( newSize.x, newSize.y ); } - - gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", + + gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", GTK_SIGNAL_FUNC(gtk_bmpbutton_clicked_callback), (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(m_widget), "enter", + gtk_signal_connect( GTK_OBJECT(m_widget), "enter", GTK_SIGNAL_FUNC(gtk_bmpbutton_enter_callback), (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(m_widget), "leave", + gtk_signal_connect( GTK_OBJECT(m_widget), "leave", GTK_SIGNAL_FUNC(gtk_bmpbutton_leave_callback), (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(m_widget), "pressed", + gtk_signal_connect( GTK_OBJECT(m_widget), "pressed", GTK_SIGNAL_FUNC(gtk_bmpbutton_press_callback), (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(m_widget), "released", + gtk_signal_connect( GTK_OBJECT(m_widget), "released", GTK_SIGNAL_FUNC(gtk_bmpbutton_release_callback), (gpointer*)this ); - + m_parent->DoAddChild( this ); - + PostCreation(); - + SetBackgroundColour( parent->GetBackgroundColour() ); Show( TRUE ); - + return TRUE; } - + void wxBitmapButton::SetDefault() { GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); gtk_widget_grab_default( m_widget ); - + SetSize( m_x, m_y, m_width, m_height ); } @@ -212,37 +213,37 @@ void wxBitmapButton::SetBitmap() wxCHECK_RET( m_widget != NULL, wxT("invalid button") ); wxBitmap the_one; - - if (!m_isEnabled) + + if (!m_isEnabled) the_one = m_disabled; - else + else { - if (m_isSelected) - { - the_one = m_selected; - } - else - { - if (m_hasFocus) - the_one = m_focus; - else - the_one = m_bitmap; + if (m_isSelected) + { + the_one = m_selected; + } + else + { + if (m_hasFocus) + the_one = m_focus; + else + the_one = m_bitmap; } } if (!the_one.Ok()) the_one = m_bitmap; if (!the_one.Ok()) return; - + GtkButton *bin = GTK_BUTTON( m_widget ); GtkPixmap *g_pixmap = GTK_PIXMAP( bin->child ); - + GdkBitmap *mask = (GdkBitmap *) NULL; if (the_one.GetMask()) mask = the_one.GetMask()->GetBitmap(); - + gtk_pixmap_set( g_pixmap, the_one.GetPixmap(), mask ); } -void wxBitmapButton::SetBitmapDisabled( const wxBitmap& bitmap ) +void wxBitmapButton::SetBitmapDisabled( const wxBitmap& bitmap ) { wxCHECK_RET( m_widget != NULL, wxT("invalid button") ); @@ -252,7 +253,7 @@ void wxBitmapButton::SetBitmapDisabled( const wxBitmap& bitmap ) SetBitmap(); } -void wxBitmapButton::SetBitmapFocus( const wxBitmap& bitmap ) +void wxBitmapButton::SetBitmapFocus( const wxBitmap& bitmap ) { wxCHECK_RET( m_widget != NULL, wxT("invalid button") ); @@ -268,7 +269,7 @@ void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap ) if (!m_bitmap.Ok()) return; m_bitmap = bitmap; - + SetBitmap(); } @@ -315,5 +316,6 @@ void wxBitmapButton::EndSelect() m_isSelected = FALSE; SetBitmap(); } -#endif + +#endif // wxUSE_BMPBUTTON diff --git a/src/gtk/brush.cpp b/src/gtk/brush.cpp index b58261b95c..70a2790e4a 100644 --- a/src/gtk/brush.cpp +++ b/src/gtk/brush.cpp @@ -96,12 +96,12 @@ wxBrush& wxBrush::operator = ( const wxBrush& brush ) return *this; } -bool wxBrush::operator == ( const wxBrush& brush ) +bool wxBrush::operator == ( const wxBrush& brush ) const { return m_refData == brush.m_refData; } -bool wxBrush::operator != ( const wxBrush& brush ) +bool wxBrush::operator != ( const wxBrush& brush ) const { return m_refData != brush.m_refData; } diff --git a/src/gtk/colour.cpp b/src/gtk/colour.cpp index db73e73343..1d004de25f 100644 --- a/src/gtk/colour.cpp +++ b/src/gtk/colour.cpp @@ -33,7 +33,7 @@ class wxColourRefData: public wxObjectRefData GdkColormap *m_colormap; bool m_hasPixel; - friend wxColour; + friend class wxColour; }; wxColourRefData::wxColourRefData() @@ -133,7 +133,7 @@ bool wxColour::operator == ( const wxColour& col ) const bool wxColour::operator != ( const wxColour& col) const { - return m_refData != col.m_refData; + return !(*this == col); } void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue ) diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 40e9370a10..fe859bb2ee 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -577,6 +577,7 @@ void wxComboBox::OnChar( wxKeyEvent &event ) if ( FindString(value) == wxNOT_FOUND ) { Append(value); + SetStringSelection(value); // and generate the selected event for it wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, GetId() ); diff --git a/src/gtk/cursor.cpp b/src/gtk/cursor.cpp index 80f7c26d60..ff4b3bea6d 100644 --- a/src/gtk/cursor.cpp +++ b/src/gtk/cursor.cpp @@ -155,6 +155,16 @@ extern wxCursor g_globalCursor; static wxCursor gs_savedCursor; static int gs_busyCount = 0; +const wxCursor &wxBusyCursor::GetStoredCursor() +{ + return gs_savedCursor; +} + +const wxCursor wxBusyCursor::GetBusyCursor() +{ + return wxCursor(wxCURSOR_WATCH); +} + void wxEndBusyCursor() { if (--gs_busyCount > 0) diff --git a/src/gtk/data.cpp b/src/gtk/data.cpp index abf1e939c0..dc6b6523a8 100644 --- a/src/gtk/data.cpp +++ b/src/gtk/data.cpp @@ -54,12 +54,6 @@ bool g_isIdle = FALSE; /* Message Strings for Internationalization */ char **wx_msg_str = (char**)NULL; -/* Custom OS version, as optionally placed in wx.ini/.wxrc - * Currently this can be Win95, Windows, Win32s, WinNT. - * For some systems, you can't tell until run-time what services you - * have. See wxGetOsVersion, which uses this string if present. */ -char *wxOsVersion = (char *) NULL; - /* For printing several pages */ int wxPageNumber; diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index d96bfe8a6d..e8ab913f6f 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -68,7 +68,7 @@ static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } #include "gdk/gdkprivate.h" -void gdk_draw_bitmap (GdkDrawable *drawable, +void gdk_wx_draw_bitmap (GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, gint xsrc, @@ -122,7 +122,11 @@ enum wxPoolGCType wxTEXT_COLOUR, wxBG_COLOUR, wxPEN_COLOUR, - wxBRUSH_COLOUR + wxBRUSH_COLOUR, + wxTEXT_SCREEN, + wxBG_SCREEN, + wxPEN_SCREEN, + wxBRUSH_SCREEN }; struct wxGC @@ -267,6 +271,14 @@ void wxWindowDC::SetUpDC() wxASSERT_MSG( !m_penGC, wxT("GCs already created") ); + if (m_isScreenDC) + { + m_penGC = wxGetPoolGC( m_window, wxPEN_SCREEN ); + m_brushGC = wxGetPoolGC( m_window, wxBRUSH_SCREEN ); + m_textGC = wxGetPoolGC( m_window, wxTEXT_SCREEN ); + m_bgGC = wxGetPoolGC( m_window, wxBG_SCREEN ); + } + else if (m_isMemDC && (((wxMemoryDC*)this)->m_selected.GetDepth() == 1)) { m_penGC = wxGetPoolGC( m_window, wxPEN_MONO ); @@ -912,7 +924,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, /* Draw XPixmap or XBitmap, depending on what the wxBitmap contains. For drawing a mono-bitmap (XBitmap) we use the current text GC */ if (is_mono) - gdk_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 ); + gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 ); else gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 ); @@ -1098,7 +1110,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he drawing a mono-bitmap (XBitmap) we use the current text GC */ if (is_mono) - gdk_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), xsrc, ysrc, xx, yy, ww, hh ); + gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), xsrc, ysrc, xx, yy, ww, hh ); else gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), xsrc, ysrc, xx, yy, ww, hh ); @@ -1284,8 +1296,8 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, for ( wxCoord srcY = 0; srcY < h; srcY++ ) { // transform source coords to dest coords - double r = sqrt(srcX*srcX + srcY*srcY); - double angleOrig = atan2(srcY, srcX) - rad; + double r = sqrt((double)srcX*srcX + srcY*srcY); + double angleOrig = atan2((double)srcY, (double)srcX) - rad; wxCoord dstX = (wxCoord)(r*cos(angleOrig) + 0.5), dstY = (wxCoord)(r*sin(angleOrig) + 0.5); diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 33bceb74e8..25f2982814 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -126,7 +126,7 @@ gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *e so we do this directly after realization */ static gint -gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win ) +gtk_dialog_realized_callback( GtkWidget * WXUNUSED(widget), wxDialog *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -231,7 +231,6 @@ void wxDialog::Init() m_returnCode = 0; m_sizeSet = FALSE; m_modalShowing = FALSE; - m_isFrame = TRUE; } wxDialog::wxDialog( wxWindow *parent, @@ -293,7 +292,7 @@ bool wxDialog::Create( wxWindow *parent, if ((m_x != -1) || (m_y != -1)) gtk_widget_set_uposition( m_widget, m_x, m_y ); gtk_widget_set_usize( m_widget, m_width, m_height ); - + /* we cannot set MWM hints before the widget has been realized, so we do this directly after realization */ gtk_signal_connect( GTK_OBJECT(m_widget), "realize", @@ -315,14 +314,7 @@ bool wxDialog::Create( wxWindow *parent, wxDialog::~wxDialog() { - m_isBeingDeleted = TRUE; - - wxTopLevelWindows.DeleteObject( this ); - - if (wxTheApp->GetTopWindow() == this) - { - wxTheApp->SetTopWindow( (wxWindow*) NULL ); - } + CleanUp(); if ((wxTopLevelWindows.Number() == 0) && (wxTheApp->GetExitOnFrameDelete())) @@ -334,13 +326,12 @@ wxDialog::~wxDialog() void wxDialog::SetTitle( const wxString& title ) { m_title = title; - if (m_title.IsNull()) m_title = wxT(""); gtk_window_set_title( GTK_WINDOW(m_widget), m_title.mbc_str() ); } wxString wxDialog::GetTitle() const { - return (wxString&)m_title; + return m_title; } void wxDialog::OnApply( wxCommandEvent &WXUNUSED(event) ) @@ -372,7 +363,7 @@ void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) ) else { SetReturnCode(wxID_OK); - this->Show(FALSE); + Show(FALSE); } } } @@ -413,11 +404,31 @@ void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) bool wxDialog::Destroy() { - if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); + // schedule the dialog for the deletion + if ( !wxPendingDelete.Member(this) ) + { + wxPendingDelete.Append(this); + } + + // don't leave a dangling pointer as the app top window, we can be deleted + // any moment at all now! + CleanUp(); return TRUE; } +void wxDialog::CleanUp() +{ + m_isBeingDeleted = TRUE; + + if ( wxTheApp->GetTopWindow() == this ) + { + wxTheApp->SetTopWindow( (wxWindow*) NULL ); + } + + wxTopLevelWindows.DeleteObject( this ); +} + void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") ); @@ -457,7 +468,7 @@ void wxDialog::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width { wxFAIL_MSG( wxT("DoMoveWindow called for wxDialog") ); } - + void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") ); @@ -552,7 +563,7 @@ void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int heigh geom.min_height = m_minHeight; geom.max_width = m_maxWidth; geom.max_height = m_maxHeight; - gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), + gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), (GtkWidget*) NULL, &geom, (GdkWindowHints) flag ); @@ -620,6 +631,16 @@ int wxDialog::ShowModal() return GetReturnCode(); } + if ( !GetParent() ) + { + wxWindow *parent = wxTheApp->GetTopWindow(); + if ( parent && parent != this ) + { + m_parent = parent; + gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(parent->m_widget) ); + } + } + wxBusyCursorSuspender cs; // temporarily suppress the busy cursor Show( TRUE ); diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp index 272530603b..a041507bf0 100644 --- a/src/gtk/dnd.cpp +++ b/src/gtk/dnd.cpp @@ -500,11 +500,11 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget), wxDataFormat format( selection_data->target ); wxLogDebug( wxT("Drop source: format requested: %s"), format.GetId().c_str() ); - + drop_source->m_retValue = wxDragCancel; wxDataObject *data = drop_source->GetDataObject(); - + if (!data) { wxLogDebug( wxT("Drop source: no data object") ); @@ -562,7 +562,7 @@ static void source_drag_data_delete( GtkWidget *WXUNUSED(widget), GdkDragContext *WXUNUSED(context), wxDropSource *WXUNUSED(drop_source) ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); // printf( "Drag source: drag_data_delete\n" ); @@ -576,7 +576,7 @@ static void source_drag_begin( GtkWidget *WXUNUSED(widget), GdkDragContext *WXUNUSED(context), wxDropSource *WXUNUSED(drop_source) ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); // printf( "Drag source: drag_begin.\n" ); @@ -620,7 +620,10 @@ gtk_dnd_window_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigur // wxDropSource //--------------------------------------------------------------------------- -wxDropSource::wxDropSource( wxWindow *win, const wxIcon &icon ) +wxDropSource::wxDropSource(wxWindow *win, + const wxIcon &iconCopy, + const wxIcon &iconMove, + const wxIcon &iconNone) { m_waiting = TRUE; @@ -632,11 +635,14 @@ wxDropSource::wxDropSource( wxWindow *win, const wxIcon &icon ) m_retValue = wxDragCancel; - m_icon = icon; - if (wxNullIcon == icon) m_icon = wxIcon( page_xpm ); + SetIcons(iconCopy, iconMove, iconNone); } -wxDropSource::wxDropSource( wxDataObject& data, wxWindow *win, const wxIcon &icon ) +wxDropSource::wxDropSource(wxDataObject& data, + wxWindow *win, + const wxIcon &iconCopy, + const wxIcon &iconMove, + const wxIcon &iconNone) { m_waiting = TRUE; @@ -650,19 +656,47 @@ wxDropSource::wxDropSource( wxDataObject& data, wxWindow *win, const wxIcon &ico m_retValue = wxDragCancel; - m_icon = icon; - if (wxNullIcon == icon) m_icon = wxIcon( page_xpm ); + SetIcons(iconCopy, iconMove, iconNone); +} + +void wxDropSource::SetIcons(const wxIcon &iconCopy, + const wxIcon &iconMove, + const wxIcon &iconNone) +{ + m_iconCopy = iconCopy; + m_iconMove = iconMove; + m_iconNone = iconNone; + + if ( !m_iconCopy.Ok() ) + m_iconCopy = wxIcon(page_xpm); + if ( !m_iconMove.Ok() ) + m_iconMove = m_iconCopy; + if ( !m_iconNone.Ok() ) + m_iconNone = m_iconCopy; } wxDropSource::~wxDropSource() { } -void wxDropSource::PrepareIcon( int hot_x, int hot_y, GdkDragContext *context ) +void wxDropSource::PrepareIcon( int action, GdkDragContext *context ) { - GdkBitmap *mask = (GdkBitmap *) NULL; - if (m_icon.GetMask()) mask = m_icon.GetMask()->GetBitmap(); - GdkPixmap *pixmap = m_icon.GetPixmap(); + // get the right icon to display + wxIcon *icon = NULL; + if ( action & GDK_ACTION_MOVE ) + icon = &m_iconMove; + else if ( action & GDK_ACTION_COPY ) + icon = &m_iconCopy; + else + icon = &m_iconNone; + + GdkBitmap *mask; + if ( icon->GetMask() ) + mask = icon->GetMask()->GetBitmap(); + else + mask = (GdkBitmap *)NULL; + + GdkPixmap *pixmap = icon->GetPixmap(); gint width,height; gdk_window_get_size (pixmap, &width, &height); @@ -689,7 +723,7 @@ void wxDropSource::PrepareIcon( int hot_x, int hot_y, GdkDragContext *context ) if (mask) gtk_widget_shape_combine_mask (m_iconWindow, mask, 0, 0); - gtk_drag_set_icon_widget( context, m_iconWindow, hot_x, hot_y ); + gtk_drag_set_icon_widget( context, m_iconWindow, 0, 0 ); } wxDragResult wxDropSource::DoDragDrop( bool allowMove ) @@ -702,7 +736,8 @@ wxDragResult wxDropSource::DoDragDrop( bool allowMove ) if (m_data->GetFormatCount() == 0) return (wxDragResult) wxDragNone; - g_blockEventsOnDrag = TRUE; + // disabled for now + g_blockEventsOnDrag = FALSE; RegisterWindow(); @@ -746,22 +781,22 @@ wxDragResult wxDropSource::DoDragDrop( bool allowMove ) if (button_number) { GdkDragAction action = GDK_ACTION_COPY; - if (allowMove) action = (GdkDragAction)(GDK_ACTION_MOVE|GDK_ACTION_COPY); + if (allowMove) action = (GdkDragAction)(GDK_ACTION_MOVE|GDK_ACTION_COPY); GdkDragContext *context = gtk_drag_begin( m_widget, - target_list, - action, - button_number, /* number of mouse button which started drag */ - (GdkEvent*) &event ); + target_list, + action, + button_number, /* number of mouse button which started drag */ + (GdkEvent*) &event ); m_dragContext = context; - PrepareIcon( 0, 0, context ); + PrepareIcon( action, context ); while (m_waiting) gtk_main_iteration(); - - if (context->action == GDK_ACTION_COPY) + + if (context->action == GDK_ACTION_COPY) m_retValue = wxDragCopy; - if (context->action == GDK_ACTION_MOVE) + if (context->action == GDK_ACTION_MOVE) m_retValue = wxDragMove; } @@ -780,7 +815,7 @@ wxDragResult wxDropSource::DoDragDrop( bool allowMove ) void wxDropSource::RegisterWindow() { if (!m_widget) return; - + gtk_signal_connect( GTK_OBJECT(m_widget), "drag_data_get", GTK_SIGNAL_FUNC (source_drag_data_get), (gpointer) this); gtk_signal_connect (GTK_OBJECT(m_widget), "drag_data_delete", diff --git a/src/gtk/files.lst b/src/gtk/files.lst index 86cfa8625f..1a9155553a 100644 --- a/src/gtk/files.lst +++ b/src/gtk/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 15:55, 2000/03/14 +# This file was automatically generated by tmake at 20:17, 2000/03/31 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -167,6 +167,7 @@ ALL_SOURCES = \ gtk/gdiobj.cpp \ gtk/gsockgtk.c \ gtk/icon.cpp \ + gtk/joystick.cpp \ gtk/listbox.cpp \ gtk/main.cpp \ gtk/mdi.cpp \ @@ -289,6 +290,7 @@ ALL_HEADERS = \ filesys.h \ font.h \ fontdlg.h \ + fontenc.h \ fontenum.h \ fontmap.h \ fontutil.h \ @@ -860,6 +862,7 @@ GUIOBJS = \ gdiobj.o \ gsockgtk.o \ icon.o \ + joystick.o \ listbox.o \ main.o \ mdi.o \ @@ -920,6 +923,7 @@ GUIDEPS = \ gdiobj.d \ gsockgtk.d \ icon.d \ + joystick.d \ listbox.d \ main.d \ mdi.d \ diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 26a9ba0dcb..83010c18da 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -71,7 +71,7 @@ private: wxString m_faceName; wxFontEncoding m_encoding; - friend wxFont; + friend class wxFont; }; // ============================================================================ @@ -397,7 +397,7 @@ void wxFont::SetEncoding(wxFontEncoding encoding) static GdkFont *g_systemDefaultGuiFont = (GdkFont*) NULL; -static GdkFont *GtkGetDefaultGuiFont() +GdkFont *GtkGetDefaultGuiFont() { if (!g_systemDefaultGuiFont) { diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index f4e2970ad0..8773d721d2 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -216,7 +216,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *ev if (!win->m_hasVMT) return FALSE; - + #if (GTK_MINOR_VERSION > 0) int x = 0; int y = 0; @@ -243,7 +243,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *ev so we do this directly after realization */ static gint -gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win ) +gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -283,7 +283,7 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win ) func |= GDK_FUNC_RESIZE; decor |= GDK_DECOR_RESIZEH; } - + gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor); gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func); } @@ -394,7 +394,6 @@ void wxFrame::Init() m_menuBarDetached = FALSE; m_toolBarDetached = FALSE; m_insertInClientArea = TRUE; - m_isFrame = FALSE; } bool wxFrame::Create( wxWindow *parent, @@ -408,7 +407,6 @@ bool wxFrame::Create( wxWindow *parent, wxTopLevelWindows.Append( this ); m_needParent = FALSE; - m_isFrame = TRUE; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) @@ -475,7 +473,7 @@ bool wxFrame::Create( wxWindow *parent, if ((m_x != -1) || (m_y != -1)) gtk_widget_set_uposition( m_widget, m_x, m_y ); gtk_widget_set_usize( m_widget, m_width, m_height ); - + /* we cannot set MWM hints and icons before the widget has been realized, so we do this directly after realization */ gtk_signal_connect( GTK_OBJECT(m_widget), "realize", @@ -535,7 +533,7 @@ void wxFrame::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width) { wxFAIL_MSG( wxT("DoMoveWindow called for wxFrame") ); } - + void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); @@ -738,23 +736,22 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; - - /* set size hints */ - gint flag = 0; // GDK_HINT_POS; - if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE; - if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE; - GdkGeometry geom; - geom.min_width = m_minWidth; - geom.min_height = m_minHeight; - geom.max_width = m_maxWidth; - geom.max_height = m_maxHeight; - gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), - (GtkWidget*) NULL, - &geom, - (GdkWindowHints) flag ); if (m_mainWidget) { + /* set size hints */ + gint flag = 0; // GDK_HINT_POS; + if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE; + if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE; + GdkGeometry geom; + geom.min_width = m_minWidth; + geom.min_height = m_minHeight; + geom.max_width = m_maxWidth; + geom.max_height = m_maxHeight; + gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), + (GtkWidget*) NULL, + &geom, + (GdkWindowHints) flag ); /* I revert back to wxGTK's original behaviour. m_mainWidget holds the * menubar, the toolbar and the client area, which is represented by @@ -926,7 +923,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar ) gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget), GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this ); } - + gtk_container_remove( GTK_CONTAINER(m_mainWidget), m_frameMenuBar->m_widget ); gtk_widget_ref( m_frameMenuBar->m_widget ); gtk_widget_unparent( m_frameMenuBar->m_widget ); @@ -971,9 +968,6 @@ wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& na m_frameToolBar = wxFrameBase::CreateToolBar( style, id, name ); - if (m_frameToolBar) - GetChildren().DeleteObject( m_frameToolBar ); - m_insertInClientArea = TRUE; m_sizeSet = FALSE; diff --git a/src/gtk/joystick.cpp b/src/gtk/joystick.cpp index 810ebb4a59..372046b52f 100644 --- a/src/gtk/joystick.cpp +++ b/src/gtk/joystick.cpp @@ -355,5 +355,5 @@ bool wxJoystick::ReleaseCapture(void) m_polling = 0; return TRUE; } -#endif +#endif // wxUSE_JOYSTICK diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index 3fa7de98fd..b87d71f753 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -47,13 +47,13 @@ extern wxList wxPendingDelete; // "switch_page" //----------------------------------------------------------------------------- -static void +static void gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), GtkNotebookPage *page, - gint WXUNUSED(page_num), - wxMDIParentFrame *parent ) + gint WXUNUSED(page_num), + wxMDIParentFrame *parent ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); // send deactivate event to old child @@ -65,9 +65,9 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), event1.SetEventObject( child); child->GetEventHandler()->ProcessEvent( event1 ); } - + // send activate event to new child - + wxMDIClientWindow *client_window = parent->GetClientWindow(); if (!client_window) return; @@ -79,16 +79,16 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), { wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data(); if (child_frame->m_page == page) - { + { child = child_frame; - break; - } + break; + } node = node->Next(); } - + if (!child) return; - + wxActivateEvent event2( wxEVT_ACTIVATE, TRUE, child->GetId() ); event2.SetEventObject( child); child->GetEventHandler()->ProcessEvent( event2 ); @@ -100,33 +100,23 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame) -BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) -END_EVENT_TABLE() - -wxMDIParentFrame::wxMDIParentFrame() -{ - m_justInserted = FALSE; - m_clientWindow = (wxMDIClientWindow *) NULL; -} - -wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, - wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name ) +void wxMDIParentFrame::Init() { m_justInserted = FALSE; m_clientWindow = (wxMDIClientWindow *) NULL; - Create( parent, id, title, pos, size, style, name ); } wxMDIParentFrame::~wxMDIParentFrame() { } -bool wxMDIParentFrame::Create( wxWindow *parent, - wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name ) +bool wxMDIParentFrame::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name ) { wxFrame::Create( parent, id, title, pos, size, style, name ); @@ -150,8 +140,8 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height ) menu_bar->m_y = 0; menu_bar->m_width = m_width; menu_bar->m_height = wxMENU_HEIGHT; - gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), - menu_bar->m_widget, + gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), + menu_bar->m_widget, 0, 0, m_width, wxMENU_HEIGHT ); } @@ -179,31 +169,36 @@ void wxMDIParentFrame::OnInternalIdle() wxNode *node = m_clientWindow->GetChildren().First(); while (node) { - wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data(); - wxMenuBar *menu_bar = child_frame->m_menuBar; - if (child_frame->m_menuBar) + wxObject *child = node->Data(); + wxMDIChildFrame *child_frame = wxDynamicCast(child, wxMDIChildFrame); + if ( child_frame ) { - if (child_frame == active_child_frame) + wxMenuBar *menu_bar = child_frame->m_menuBar; + if ( menu_bar ) { - if (menu_bar->Show(TRUE)) - { - menu_bar->m_width = m_width; - menu_bar->m_height = wxMENU_HEIGHT; - gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), - menu_bar->m_widget, - 0, 0, m_width, wxMENU_HEIGHT ); - menu_bar->SetInvokingWindow( child_frame ); - } - visible_child_menu = TRUE; + if (child_frame == active_child_frame) + { + if (menu_bar->Show(TRUE)) + { + menu_bar->m_width = m_width; + menu_bar->m_height = wxMENU_HEIGHT; + gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), + menu_bar->m_widget, + 0, 0, m_width, wxMENU_HEIGHT ); + menu_bar->SetInvokingWindow( child_frame ); + } + visible_child_menu = TRUE; + } + else + { + if (menu_bar->Show(FALSE)) + { + menu_bar->UnsetInvokingWindow( child_frame ); + } + } } - else - { - if (menu_bar->Show(FALSE)) - { - menu_bar->UnsetInvokingWindow( child_frame ); - } - } } + node = node->Next(); } @@ -212,21 +207,21 @@ void wxMDIParentFrame::OnInternalIdle() (m_frameMenuBar->IsShown() == visible_child_menu)) { if (visible_child_menu) - { + { m_frameMenuBar->Show( FALSE ); - m_frameMenuBar->UnsetInvokingWindow( this ); - } - else - { + m_frameMenuBar->UnsetInvokingWindow( this ); + } + else + { m_frameMenuBar->Show( TRUE ); - m_frameMenuBar->SetInvokingWindow( this ); - - m_frameMenuBar->m_width = m_width; - m_frameMenuBar->m_height = wxMENU_HEIGHT; - gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), - m_frameMenuBar->m_widget, - 0, 0, m_width, wxMENU_HEIGHT ); - } + m_frameMenuBar->SetInvokingWindow( this ); + + m_frameMenuBar->m_width = m_width; + m_frameMenuBar->m_height = wxMENU_HEIGHT; + gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), + m_frameMenuBar->m_widget, + 0, 0, m_width, wxMENU_HEIGHT ); + } } } @@ -287,14 +282,6 @@ void wxMDIParentFrame::ActivatePrevious() gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) ); } -void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) ) -{ -} - -void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(event) ) -{ -} - //----------------------------------------------------------------------------- // wxMDIChildFrame //----------------------------------------------------------------------------- @@ -303,12 +290,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxFrame) BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) EVT_ACTIVATE(wxMDIChildFrame::OnActivate) + EVT_MENU_HIGHLIGHT_ALL(wxMDIChildFrame::OnMenuHighlight) END_EVENT_TABLE() wxMDIChildFrame::wxMDIChildFrame() { m_menuBar = (wxMenuBar *) NULL; m_page = (GtkNotebookPage *) NULL; + m_isFrame = TRUE; } wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, @@ -318,6 +307,7 @@ wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, { m_menuBar = (wxMenuBar *) NULL; m_page = (GtkNotebookPage *) NULL; + m_isFrame = TRUE; Create( parent, id, title, wxDefaultPosition, size, style, name ); } @@ -360,8 +350,8 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) m_menuBar->SetParent( mdi_frame ); /* insert the invisible menu bar into the _parent_ mdi frame */ - gtk_pizza_put( GTK_PIZZA(mdi_frame->m_mainWidget), - m_menuBar->m_widget, + gtk_pizza_put( GTK_PIZZA(mdi_frame->m_mainWidget), + m_menuBar->m_widget, 0, 0, mdi_frame->m_width, wxMENU_HEIGHT ); } } @@ -380,14 +370,39 @@ void wxMDIChildFrame::Activate() gtk_notebook_set_page( notebook, pageno ); #else // the only way I can see to do this under gtk+ 1.0.X would - // be to keep track of page numbers, start at first and + // be to keep track of page numbers, start at first and // do "next" enough times to get to this page number - messy // - J. Russell Smyth #endif } -void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) ) +void wxMDIChildFrame::OnActivate( wxActivateEvent& WXUNUSED(event) ) +{ +} + +void wxMDIChildFrame::OnMenuHighlight( wxMenuEvent& event ) { +#if wxUSE_STATUSBAR + wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->GetParent(); + if ( !ShowMenuHelp(mdi_frame->GetStatusBar(), event.GetMenuId()) ) + { + // we don't have any help text for this item, but may be the MDI frame + // does? + mdi_frame->OnMenuHighlight(event); + } +#endif // wxUSE_STATUSBAR +} + +void wxMDIChildFrame::SetTitle( const wxString &title ) +{ + if ( title == m_title ) + return; + + m_title = title; + + wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent(); + GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget); + gtk_notebook_set_tab_label_text(notebook, m_page->child, title.mbc_str()); } //----------------------------------------------------------------------------- @@ -464,7 +479,7 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) !CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("wxMDIClientWindow") )) { wxFAIL_MSG( wxT("wxMDIClientWindow creation failed") ); - return FALSE; + return FALSE; } m_widget = gtk_notebook_new(); diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 5c17e2c985..1149f81f86 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -35,6 +35,45 @@ extern bool g_isIdle; static wxString GetHotKey( const wxMenuItem& item ); #endif +//----------------------------------------------------------------------------- +// idle system +//----------------------------------------------------------------------------- + +static wxString wxReplaceUnderscore( const wxString& title ) +{ + const wxChar *pc; + + /* GTK 1.2 wants to have "_" instead of "&" for accelerators */ + wxString str; + for ( pc = title; *pc != wxT('\0'); pc++ ) + { + if (*pc == wxT('&')) + { +#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0) + str << wxT('_'); + } + else if (*pc == wxT('/')) + { + str << wxT('\\'); +#endif + } + else + { +#if __WXGTK12__ + if ( *pc == wxT('_') ) + { + // underscores must be doubled to prevent them from being + // interpreted as accelerator character prefix by GTK + str << *pc; + } +#endif // GTK+ 1.2 + + str << *pc; + } + } + return str; +} + //----------------------------------------------------------------------------- // wxMenuBar //----------------------------------------------------------------------------- @@ -221,36 +260,7 @@ bool wxMenuBar::Append( wxMenu *menu, const wxString &title ) bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title) { - const wxChar *pc; - - /* GTK 1.2 wants to have "_" instead of "&" for accelerators */ - wxString str; - for ( pc = title; *pc != wxT('\0'); pc++ ) - { - if (*pc == wxT('&')) - { -#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0) - str << wxT('_'); - } - else if (*pc == wxT('/')) - { - str << wxT('\\'); -#endif - } - else - { -#if __WXGTK12__ - if ( *pc == wxT('_') ) - { - // underscores must be doubled to prevent them from being - // interpreted as accelerator character prefix by GTK - str << *pc; - } -#endif // GTK+ 1.2 - - str << *pc; - } - } + wxString str( wxReplaceUnderscore( title ) ); /* this doesn't have much effect right now */ menu->SetTitle( str ); @@ -275,6 +285,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title) gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ /* in order to get the pointer to the item we need the item text _without_ underscores */ wxString tmp = wxT("<main>/"); + const wxChar *pc; for ( pc = str; *pc != wxT('\0'); pc++ ) { // contrary to the common sense, we must throw out _all_ underscores, @@ -379,7 +390,7 @@ wxMenu *wxMenuBar::Remove(size_t pos) static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString ) { - if (menu->GetTitle() == menuString) + if (wxMenuItem::GetLabelFromText(menu->GetTitle()) == wxMenuItem::GetLabelFromText(menuString)) { int res = menu->FindItem( itemString ); if (res != wxNOT_FOUND) @@ -472,7 +483,25 @@ wxString wxMenuBar::GetLabelTop( size_t pos ) const wxMenu* menu = node->GetData(); - return menu->GetTitle(); + wxString label; + wxString text( menu->GetTitle() ); +#if (GTK_MINOR_VERSION > 0) + for ( const wxChar *pc = text.c_str(); *pc; pc++ ) + { + if ( *pc == wxT('_') || *pc == wxT('&') ) + { + // '_' is the escape character for GTK+ and '&' is the one for + // wxWindows - skip both of them + continue; + } + + label += *pc; + } +#else // GTK+ 1.0 + label = text; +#endif // GTK+ 1.2/1.0 + + return label; } void wxMenuBar::SetLabelTop( size_t pos, const wxString& label ) @@ -483,7 +512,22 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label ) wxMenu* menu = node->GetData(); - menu->SetTitle( label ); + wxString str( wxReplaceUnderscore( label ) ); + + menu->SetTitle( str ); + + if (menu->m_owner) + { + GtkLabel *label = GTK_LABEL( GTK_BIN(menu->m_owner)->child ); + + /* set new text */ + gtk_label_set( label, str.mb_str()); + + /* reparse key accel */ + (void)gtk_label_parse_uline (GTK_LABEL(label), str.mb_str() ); + gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) ); + } + } //----------------------------------------------------------------------------- @@ -963,6 +1007,12 @@ bool wxMenu::DoInsert(size_t pos, wxMenuItem *item) if ( !GtkAppend(item) ) return FALSE; + if ( m_style & wxMENU_TEAROFF ) + { + // change the position as the first item is the tear-off marker + pos++; + } + GtkMenuShell *menu_shell = GTK_MENU_SHELL(m_factory->widget); gpointer data = g_list_last(menu_shell->children)->data; menu_shell->children = g_list_remove(menu_shell->children, data); diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 4fbff0c3df..3626e86c46 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -521,7 +521,7 @@ bool wxNotebook::DeletePage( int page ) if (!nb_page) return FALSE; /* GTK sets GtkNotebook.cur_page to NULL before sending - the switvh page event */ + the switch page event */ m_lastSelection = GetSelection(); nb_page->m_client->Destroy(); @@ -536,8 +536,12 @@ bool wxNotebook::RemovePage( int page ) { wxGtkNotebookPage* nb_page = GetNotebookPage(page); - if (!nb_page) return FALSE; + wxCHECK_MSG( nb_page, FALSE, _T("wxNotebook::RemovePage: invalid page") ); + gtk_widget_ref( nb_page->m_client->m_widget ); + gtk_widget_unrealize( nb_page->m_client->m_widget ); + gtk_widget_unparent( nb_page->m_client->m_widget ); + gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page ); m_pages.DeleteObject( nb_page ); diff --git a/src/gtk/pen.cpp b/src/gtk/pen.cpp index 90a54a25ee..8ac1097aa8 100644 --- a/src/gtk/pen.cpp +++ b/src/gtk/pen.cpp @@ -100,12 +100,12 @@ wxPen& wxPen::operator = ( const wxPen& pen ) return *this; } -bool wxPen::operator == ( const wxPen& pen ) +bool wxPen::operator == ( const wxPen& pen ) const { return m_refData == pen.m_refData; } -bool wxPen::operator != ( const wxPen& pen ) +bool wxPen::operator != ( const wxPen& pen ) const { return m_refData != pen.m_refData; } diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 10044f42a1..18867ec77d 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -114,14 +114,58 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_ return TRUE; } +static gint gtk_radiobutton_focus_in( GtkWidget *widget, + GdkEvent *WXUNUSED(event), + wxRadioBox *win ) +{ + if ( win->m_lostFocus ) + { + // no, we didn't really lose it + win->m_lostFocus = FALSE; + } + else if ( !win->m_hasFocus ) + { + win->m_hasFocus = TRUE; + + wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() ); + event.SetEventObject( win ); + + // never stop the signal emission, it seems to break the kbd handling + // inside the radiobox + (void)win->GetEventHandler()->ProcessEvent( event ); + } + + return FALSE; +} + +static gint gtk_radiobutton_focus_out( GtkWidget *widget, + GdkEvent *WXUNUSED(event), + wxRadioBox *win ) +{ + wxASSERT_MSG( win->m_hasFocus, _T("got focus out without any focus in?") ); + + // we might have lost the focus, but may be not - it may have just gone to + // another button in the same radiobox, so we'll check for it in the next + // idle iteration (leave m_hasFocus == TRUE for now) + win->m_lostFocus = TRUE; + + return FALSE; +} + //----------------------------------------------------------------------------- // wxRadioBox //----------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl) -wxRadioBox::wxRadioBox() +void wxRadioBox::Init() { + m_alreadySent = FALSE; + m_needParent = TRUE; + m_acceptsFocus = TRUE; + + m_hasFocus = + m_lostFocus = FALSE; } bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, @@ -130,10 +174,6 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, long style, const wxValidator& validator, const wxString &name ) { - m_alreadySent = FALSE; - m_needParent = TRUE; - m_acceptsFocus = TRUE; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { @@ -175,6 +215,12 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, gtk_signal_connect( GTK_OBJECT(m_radio), "clicked", GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); + gtk_signal_connect( GTK_OBJECT(m_radio), "focus_in_event", + GTK_SIGNAL_FUNC(gtk_radiobutton_focus_in), (gpointer)this ); + + gtk_signal_connect( GTK_OBJECT(m_radio), "focus_out_event", + GTK_SIGNAL_FUNC(gtk_radiobutton_focus_out), (gpointer)this ); + gtk_pizza_put( GTK_PIZZA(m_parent->m_wxwindow), GTK_WIDGET(m_radio), m_x+10, m_y+10+(i*24), 10, 10 ); @@ -665,4 +711,19 @@ bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window ) return FALSE; } -#endif +void wxRadioBox::OnInternalIdle() +{ + if ( m_lostFocus ) + { + m_hasFocus = FALSE; + m_lostFocus = FALSE; + + wxFocusEvent event( wxEVT_KILL_FOCUS, GetId() ); + event.SetEventObject( this ); + + (void)GetEventHandler()->ProcessEvent( event ); + } +} + +#endif // wxUSE_RADIOBOX + diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index fbb0a53ced..00f9c9821b 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -148,7 +148,7 @@ void wxRadioButton::SetLabel( const wxString& label ) void wxRadioButton::SetValue( bool val ) { wxCHECK_RET( m_widget != NULL, wxT("invalid radiobutton") ); - + if (val == GetValue()) return; @@ -162,8 +162,10 @@ void wxRadioButton::SetValue( bool val ) else { // should give an assert + // RL - No it shouldn't. A wxGenericValidator might try to set it + // as FALSE. Failing silently is probably TRTTD here. } - + gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); } diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 4a491823fa..0adcfd51b3 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -21,6 +21,8 @@ #include <gdk/gdkprivate.h> #include <gtk/gtk.h> +extern GdkFont *GtkGetDefaultGuiFont(); + /* #define wxSYS_COLOUR_SCROLLBAR 0 @@ -233,19 +235,8 @@ wxFont wxSystemSettings::GetSystemFont( int index ) { if (!g_systemFont) { - GdkFont *gdk_font = (GdkFont*) NULL; - GtkWidget *widget = gtk_button_new(); #if 0 - GtkStyle *def = gtk_rc_get_style( widget ); - if (def) - gdk_font = def->font; - else - { - def = gtk_widget_get_default_style(); - if (def) - gdk_font = def->font; - } -#endif + GdkFont *gdk_font = GtkGetDefaultGuiFont(); if (gdk_font) { GSList *font_list = ((GdkFontPrivate*)gdk_font)->names; @@ -254,12 +245,11 @@ wxFont wxSystemSettings::GetSystemFont( int index ) wxFontData font_data; g_systemFont = new wxFont( font_string, font_data ); } - else - { - g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); - } - gtk_widget_destroy( widget ); +#endif + + g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); + } return *g_systemFont; } diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index fba7a8b971..838a5d2549 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -73,6 +73,7 @@ static void gtk_slider_callback( GtkAdjustment *adjust, wxSlider *win ) wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() ); cevent.SetEventObject( win ); + cevent.SetInt( value ); win->GetEventHandler()->ProcessEvent( cevent ); } diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index d5efca072e..db68c07d70 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -222,7 +222,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event ) if (event.KeyCode() == WXK_RETURN) { wxWindow *top_frame = m_parent; - while (top_frame->GetParent() && !(top_frame->GetParent()->m_isFrame)) + while (top_frame->GetParent() && !(top_frame->GetParent()->IsTopLevel())) top_frame = top_frame->GetParent(); GtkWindow *window = GTK_WINDOW(top_frame->m_widget); diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 6e58b78a54..b85ed54228 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -33,6 +33,8 @@ #include "gdk/gdk.h" #include "gtk/gtk.h" +extern GdkFont *GtkGetDefaultGuiFont(); + // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -303,8 +305,9 @@ bool wxToolBar::Create( wxWindow *parent, GTK_TOOLBAR(m_toolbar)->tooltips->tip_window ) ); g_style->bg[GTK_STATE_NORMAL] = *m_bg; + gdk_font_unref( g_style->font ); + g_style->font = gdk_font_ref( GtkGetDefaultGuiFont() ); gtk_widget_set_style( GTK_TOOLBAR(m_toolbar)->tooltips->tip_window, g_style ); - m_parent->DoAddChild( this ); diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 0f8df9de99..92360ca742 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -337,6 +337,13 @@ void wxTextCtrl::SetValue( const wxString &value ) { gtk_entry_set_text( GTK_ENTRY(m_text), tmp.mbc_str() ); } + + // GRG, Jun/2000: Changed this after a lot of discussion in + // the lists. wxWindows 2.2 will have a set of flags to + // customize this behaviour. + SetInsertionPoint(0); + + m_modified = FALSE; } void wxTextCtrl::WriteText( const wxString &text ) @@ -614,7 +621,7 @@ bool wxTextCtrl::Enable( bool enable ) // nothing to do return FALSE; } - + if (m_windowStyle & wxTE_MULTILINE) { gtk_text_set_editable( GTK_TEXT(m_text), enable ); @@ -778,8 +785,9 @@ void wxTextCtrl::GetSelection(long* from, long* to) const if (!(GTK_EDITABLE(m_text)->has_selection)) { - if (from) *from = 0; - if (to) *to = 0; + long i = GetInsertionPoint(); + if (from) *from = i; + if (to) *to = i; return; } @@ -812,6 +820,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event ) { wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId); event.SetEventObject(this); + event.SetString(GetValue()); if (GetEventHandler()->ProcessEvent(event)) return; } diff --git a/src/gtk/tooltip.cpp b/src/gtk/tooltip.cpp index a80317beeb..109f4658a6 100644 --- a/src/gtk/tooltip.cpp +++ b/src/gtk/tooltip.cpp @@ -21,6 +21,8 @@ #include "gtk/gtk.h" #include "gdk/gdk.h" +extern GdkFont *GtkGetDefaultGuiFont(); + //----------------------------------------------------------------------------- // global data //----------------------------------------------------------------------------- @@ -72,7 +74,9 @@ void wxToolTip::Apply( wxWindow *win ) g_style->fg[GTK_STATE_NORMAL] = ss_fg; g_style->bg[GTK_STATE_NORMAL] = ss_bg; - + gdk_font_unref( g_style->font ); + g_style->font = gdk_font_ref( GtkGetDefaultGuiFont() ); + gtk_widget_set_style( ss_tooltips->tip_window, g_style ); #else gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg ); diff --git a/src/gtk/win_gtk.c b/src/gtk/win_gtk.c index e2b14c9404..923a12d157 100644 --- a/src/gtk/win_gtk.c +++ b/src/gtk/win_gtk.c @@ -81,8 +81,12 @@ static void gtk_pizza_expose_area (GtkPizza *pizza, gint y, gint width, gint height); +/* unused */ +#if 0 static void gtk_pizza_adjustment_changed (GtkAdjustment *adjustment, GtkPizza *pizza); +#endif + static GdkFilterReturn gtk_pizza_filter (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data); @@ -993,12 +997,12 @@ gtk_pizza_expose_predicate (Display *display, XEvent *xevent, XPointer arg) { - if ((xevent->type == Expose) || - ((xevent->xany.window == *(Window *)arg) && + if ((xevent->type == Expose) || + ((xevent->xany.window == *(Window *)arg) && (xevent->type == ConfigureNotify))) - return True; - else - return False; + return True; + else + return False; } /* This is the main routine to do the scrolling. Scrolling is @@ -1016,40 +1020,40 @@ gtk_pizza_expose_predicate (Display *display, void gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) { - GtkWidget *widget; - XEvent xevent; + GtkWidget *widget; + XEvent xevent; - gint x,y,w,h,border; + gint x,y,w,h,border; - widget = GTK_WIDGET (pizza); + widget = GTK_WIDGET (pizza); - pizza->xoffset += dx; - pizza->yoffset += dy; + pizza->xoffset += dx; + pizza->yoffset += dy; - if (!GTK_WIDGET_MAPPED (pizza)) + if (!GTK_WIDGET_MAPPED (pizza)) { - gtk_pizza_position_children (pizza); - return; + gtk_pizza_position_children (pizza); + return; } - gtk_pizza_adjust_allocations (pizza, -dx, -dy); + gtk_pizza_adjust_allocations (pizza, -dx, -dy); - if (pizza->shadow_type == GTK_MYSHADOW_NONE) - border = 0; - else - if (pizza->shadow_type == GTK_MYSHADOW_THIN) - border = 1; - else - border = 2; + if (pizza->shadow_type == GTK_MYSHADOW_NONE) + border = 0; + else + if (pizza->shadow_type == GTK_MYSHADOW_THIN) + border = 1; + else + border = 2; - x = 0; - y = 0; - w = widget->allocation.width - 2*border; - h = widget->allocation.height - 2*border; + x = 0; + y = 0; + w = widget->allocation.width - 2*border; + h = widget->allocation.height - 2*border; - if (dx > 0) + if (dx > 0) { - if (gravity_works) + if (gravity_works) { gdk_window_resize (pizza->bin_window, w + dx, @@ -1057,20 +1061,14 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) gdk_window_move (pizza->bin_window, x-dx, y); gdk_window_move_resize (pizza->bin_window, x, y, w, h ); } - else + else { /* FIXME */ } - - gtk_pizza_expose_area (pizza, - MAX ((gint)w - dx, 0), - 0, - MIN (dx, w), - h); } - else if (dx < 0) + else if (dx < 0) { - if (gravity_works) + if (gravity_works) { gdk_window_move_resize (pizza->bin_window, x + dx, @@ -1080,102 +1078,73 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) gdk_window_move (pizza->bin_window, x, y); gdk_window_resize (pizza->bin_window, w, h ); } - else + else { /* FIXME */ } - - gtk_pizza_expose_area (pizza, - 0, - 0, - MIN (-dx, w), - h); } - if (dy > 0) + if (dy > 0) { - if (gravity_works) + if (gravity_works) { gdk_window_resize (pizza->bin_window, w, h + dy); gdk_window_move (pizza->bin_window, x, y-dy); gdk_window_move_resize (pizza->bin_window, x, y, w, h ); } - else + else { /* FIXME */ } - - gtk_pizza_expose_area (pizza, - 0, - MAX ((gint)h - dy, 0), - w, - MIN (dy, h)); } - else if (dy < 0) + else if (dy < 0) { - if (gravity_works) + if (gravity_works) { gdk_window_move_resize (pizza->bin_window, x, y+dy, w, h - dy ); gdk_window_move (pizza->bin_window, x, y); gdk_window_resize (pizza->bin_window, w, h ); } - else + else { /* FIXME */ } - gtk_pizza_expose_area (pizza, - 0, - 0, - w, - MIN (-dy, (gint)h)); } - gtk_pizza_position_children (pizza); - - /* We have to make sure that all exposes from this scroll get - * processed before we scroll again, or the expose events will - * have invalid coordinates. - * - * We also do expose events for other windows, since otherwise - * their updating will fall behind the scrolling - * - * This also avoids a problem in pre-1.0 GTK where filters don't - * have access to configure events that were compressed. - */ - - gdk_flush(); - while (XCheckIfEvent(GDK_WINDOW_XDISPLAY (pizza->bin_window), - &xevent, - gtk_pizza_expose_predicate, - (XPointer)&GDK_WINDOW_XWINDOW (pizza->bin_window))) + gtk_pizza_position_children (pizza); + + gdk_flush(); + while (XCheckIfEvent(GDK_WINDOW_XDISPLAY (pizza->bin_window), + &xevent, + gtk_pizza_expose_predicate, + (XPointer)&GDK_WINDOW_XWINDOW (pizza->bin_window))) { - GdkEvent event; - GtkWidget *event_widget; + GdkEvent event; + GtkWidget *event_widget; - if ((xevent.xany.window == GDK_WINDOW_XWINDOW (pizza->bin_window)) && - (gtk_pizza_filter (&xevent, &event, pizza) == GDK_FILTER_REMOVE)) - continue; + if ((xevent.xany.window == GDK_WINDOW_XWINDOW (pizza->bin_window)) ) + gtk_pizza_filter (&xevent, &event, pizza); - if (xevent.type == Expose) + if (xevent.type == Expose) { - event.expose.window = gdk_window_lookup (xevent.xany.window); - gdk_window_get_user_data (event.expose.window, + event.expose.window = gdk_window_lookup (xevent.xany.window); + gdk_window_get_user_data (event.expose.window, (gpointer *)&event_widget); - if (event_widget) + if (event_widget) { - event.expose.type = GDK_EXPOSE; - event.expose.area.x = xevent.xexpose.x; - event.expose.area.y = xevent.xexpose.y; - event.expose.area.width = xevent.xexpose.width; - event.expose.area.height = xevent.xexpose.height; - event.expose.count = xevent.xexpose.count; - - gdk_window_ref (event.expose.window); - gtk_widget_event (event_widget, &event); - gdk_window_unref (event.expose.window); + event.expose.type = GDK_EXPOSE; + event.expose.area.x = xevent.xexpose.x; + event.expose.area.y = xevent.xexpose.y; + event.expose.area.width = xevent.xexpose.width; + event.expose.area.height = xevent.xexpose.height; + event.expose.count = xevent.xexpose.count; + + gdk_window_ref (event.expose.window); + gtk_widget_event (event_widget, &event); + gdk_window_unref (event.expose.window); } } } @@ -1206,25 +1175,17 @@ gtk_pizza_filter (GdkXEvent *gdk_xevent, if (!pizza->use_filter) return GDK_FILTER_CONTINUE; - switch (xevent->type) + switch (xevent->type) { case Expose: if (xevent->xexpose.serial == pizza->configure_serial) { - if (pizza->visibility == GDK_VISIBILITY_UNOBSCURED) - return GDK_FILTER_REMOVE; - else - { - xevent->xexpose.x += pizza->scroll_x; - xevent->xexpose.y += pizza->scroll_y; - - break; - } + xevent->xexpose.x += pizza->scroll_x; + xevent->xexpose.y += pizza->scroll_y; } break; case ConfigureNotify: - if ((xevent->xconfigure.x != 0) || (xevent->xconfigure.y != 0)) { pizza->configure_serial = xevent->xconfigure.serial; pizza->scroll_x = xevent->xconfigure.x; @@ -1278,8 +1239,6 @@ gtk_pizza_main_filter (GdkXEvent *gdk_xevent, } - - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 80384e2535..8f921839aa 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: window.cpp +// Name: gtk/window.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -30,6 +30,10 @@ #include "wx/tooltip.h" #endif +#if wxUSE_CARET + #include "wx/caret.h" +#endif // wxUSE_CARET + #include "wx/menu.h" #include "wx/statusbr.h" #include "wx/intl.h" @@ -298,6 +302,28 @@ extern bool g_isIdle; // local code (see below) //----------------------------------------------------------------------------- +// returns the child of win which currently has focus or NULL if not found +static wxWindow *FindFocusedChild(wxWindow *win) +{ + wxWindow *winFocus = wxWindow::FindFocus(); + if ( !winFocus ) + return (wxWindow *)NULL; + + if ( winFocus == win ) + return win; + + for ( wxWindowList::Node *node = win->GetChildren().GetFirst(); + node; + node = node->GetNext() ) + { + wxWindow *child = FindFocusedChild(node->GetData()); + if ( child ) + return child; + } + + return (wxWindow *)NULL; +} + static void draw_frame( GtkWidget *widget, wxWindow *win ) { if (!win->m_hasVMT) @@ -636,9 +662,6 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev } */ - if (!win->m_queuedFullRedraw) - { - win->GetUpdateRegion().Union( gdk_event->area.x, gdk_event->area.y, gdk_event->area.width, @@ -683,7 +706,6 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev gtk_widget_event (child->widget, (GdkEvent*) &child_event); } } - } return TRUE; } @@ -738,9 +760,6 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW GtkPizza *pizza = GTK_PIZZA (widget); - if (!win->m_queuedFullRedraw) - { - if (!(GTK_WIDGET_APP_PAINTABLE (widget)) && (pizza->clear_on_draw)) { @@ -777,7 +796,6 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW gtk_widget_draw (child->widget, &child_area /* (GdkRectangle*) NULL*/ ); } } - } } //----------------------------------------------------------------------------- @@ -839,7 +857,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e ret = ancestor->GetEventHandler()->ProcessEvent( command_event ); break; } - if (ancestor->m_isFrame) + if (ancestor->IsTopLevel()) break; ancestor = ancestor->GetParent(); } @@ -871,7 +889,12 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e /* win is a control: tab can be propagated up */ if ( (!ret) && ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) && +// VZ: testing for wxTE_PROCESS_TAB shouldn't be done here the control may +// have this style, yet choose not to process this particular TAB in which +// case TAB must still work as a navigational character +#if 0 (!win->HasFlag(wxTE_PROCESS_TAB)) && +#endif // 0 (win->GetParent()) && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) ) { @@ -1494,6 +1517,15 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED( gdk_im_begin(win->m_ic, win->m_wxwindow->window); #endif +#ifdef wxUSE_CARET + // caret needs to be informed about focus change + wxCaret *caret = win->GetCaret(); + if ( caret ) + { + caret->OnSetFocus(); + } +#endif // wxUSE_CARET + wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() ); event.SetEventObject( win ); @@ -1525,6 +1557,10 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED // g_sendActivateEvent to -1 g_sendActivateEvent = 0; + wxWindow *winFocus = FindFocusedChild(win); + if ( winFocus ) + win = winFocus; + g_focusWindow = (wxWindow *)NULL; /* @@ -1539,6 +1575,15 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED gdk_im_end(); #endif +#ifdef wxUSE_CARET + // caret needs to be informed about focus change + wxCaret *caret = win->GetCaret(); + if ( caret ) + { + caret->OnKillFocus(); + } +#endif // wxUSE_CARET + wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); event.SetEventObject( win ); @@ -2062,10 +2107,12 @@ void wxWindow::Init() m_acceptsFocus = FALSE; m_clipPaintRegion = FALSE; - m_queuedFullRedraw = FALSE; m_cursor = *wxSTANDARD_CURSOR; + m_delayedForegroundColour = FALSE; + m_delayedBackgroundColour = FALSE; + #ifdef HAVE_XIM m_ic = (GdkIC*) NULL; m_icattr = (GdkICAttr*) NULL; @@ -2403,24 +2450,6 @@ bool wxWindow::Destroy() void wxWindow::DoMoveWindow(int x, int y, int width, int height) { - if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window) - { - /* Normally, GTK will send expose events only for the regions - which actually got exposed. Sadly, wxMSW invalidates - the whole window so we have to do that, too. We could - simply add a complete refresh, but we would then get - the normal GTK expose events in surplus, so we shut - off the expose events and schedule a full redraw to - be done in OnInternalIdle, where we restore the handling - of expose events. */ - - m_queuedFullRedraw = TRUE; - - GdkEventMask mask = gdk_window_get_events( GTK_PIZZA(m_wxwindow)->bin_window ); - mask = (GdkEventMask)(mask & ~GDK_EXPOSURE_MASK); - gdk_window_set_events( GTK_PIZZA(m_wxwindow)->bin_window, mask ); - } - gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), m_widget, x, y, width, height ); } @@ -2568,33 +2597,6 @@ void wxWindow::OnInternalIdle() } UpdateWindowUI(); - - if (m_queuedFullRedraw) - { - /* See also wxWindow::DoMoveWindow for explanation of this code. What - we test here is if the requested size of the window is the same as - the actual size of window, in which case all expose events that resulted - from resizing the window have been sent (and discarded) and we can - now do our full redraw and switch on expose event handling again. */ - - bool child_already_resized = FALSE; - if (m_isFrame) - child_already_resized = gtk_pizza_child_resized( GTK_PIZZA(m_wxwindow->parent), m_wxwindow ); - else - child_already_resized = gtk_pizza_child_resized( GTK_PIZZA(m_widget->parent), m_widget ); - - if (child_already_resized) - { - m_queuedFullRedraw = FALSE; - m_updateRegion.Clear(); - m_updateRegion.Union( 0,0,m_width,m_height ); - gtk_widget_draw( m_wxwindow, (GdkRectangle*) NULL ); - - GdkEventMask mask = gdk_window_get_events( GTK_PIZZA(m_wxwindow)->bin_window ); - mask = (GdkEventMask)(mask | GDK_EXPOSURE_MASK); - gdk_window_set_events( GTK_PIZZA(m_wxwindow)->bin_window, mask ); - } - } } void wxWindow::DoGetSize( int *width, int *height ) const @@ -2986,7 +2988,16 @@ bool wxWindow::SetCursor( const wxCursor &cursor ) { wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); - return wxWindowBase::SetCursor( cursor ); + if (cursor == m_cursor) + return FALSE; + + if (g_isIdle) + wxapp_install_idle_handler(); + + if (cursor == wxNullCursor) + return wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ); + else + return wxWindowBase::SetCursor( cursor ); } void wxWindow::WarpPointer( int x, int y ) @@ -3253,6 +3264,21 @@ void wxWindow::SetWidgetStyle() style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor(); } + else + { + // Try to restore the gtk default style. This is still a little + // oversimplified for what is probably really needed here for controls + // other than buttons, but is better than not being able to (re)set a + // control's foreground colour to *wxBLACK -- RL + GtkStyle *def = gtk_rc_get_style( m_widget ); + + if (!def) + def = gtk_widget_get_default_style(); + + style->fg[GTK_STATE_NORMAL] = def->fg[GTK_STATE_NORMAL]; + style->fg[GTK_STATE_PRELIGHT] = def->fg[GTK_STATE_PRELIGHT]; + style->fg[GTK_STATE_ACTIVE] = def->fg[GTK_STATE_ACTIVE]; + } } if (m_backgroundColour.Ok()) @@ -3268,7 +3294,29 @@ void wxWindow::SetWidgetStyle() style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor(); style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); - } + } + else + { + // Try to restore the gtk default style. This is still a little + // oversimplified for what is probably really needed here for controls + // other than buttons, but is better than not being able to (re)set a + // control's background colour to default grey and means resetting a + // button to wxSYS_COLOUR_BTNFACE will restore its usual highlighting + // behavior -- RL + GtkStyle *def = gtk_rc_get_style( m_widget ); + + if (!def) + def = gtk_widget_get_default_style(); + + style->bg[GTK_STATE_NORMAL] = def->bg[GTK_STATE_NORMAL]; + style->base[GTK_STATE_NORMAL] = def->base[GTK_STATE_NORMAL]; + style->bg[GTK_STATE_PRELIGHT] = def->bg[GTK_STATE_PRELIGHT]; + style->base[GTK_STATE_PRELIGHT] = def->base[GTK_STATE_PRELIGHT]; + style->bg[GTK_STATE_ACTIVE] = def->bg[GTK_STATE_ACTIVE]; + style->base[GTK_STATE_ACTIVE] = def->base[GTK_STATE_ACTIVE]; + style->bg[GTK_STATE_INSENSITIVE] = def->bg[GTK_STATE_INSENSITIVE]; + style->base[GTK_STATE_INSENSITIVE] = def->base[GTK_STATE_INSENSITIVE]; + } } } diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 6369b7d3a7..7505f40b8a 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -96,7 +96,7 @@ bool wxYield() if (has_idle) { /* re-add idle handler (very low priority) */ - wxTheApp->m_idleTag = gtk_idle_add_priority( 500, wxapp_idle_callback, (gpointer) NULL ); + wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL ); } // disable log flushing from here because a call to wxYield() shouldn't @@ -179,7 +179,7 @@ void wxapp_install_idle_handler() to the main thread (and processing these in idle time). Very low priority. */ - wxTheApp->m_idleTag = gtk_idle_add_priority( 500, wxapp_idle_callback, (gpointer) NULL ); + wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL ); g_isIdle = FALSE; } @@ -250,7 +250,7 @@ wxApp::wxApp() m_topWindow = (wxWindow *) NULL; m_exitOnFrameDelete = TRUE; - m_idleTag = gtk_idle_add_priority( 500, wxapp_idle_callback, (gpointer) NULL ); + m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL ); #if wxUSE_THREADS m_wakeUpTimerTag = 0; @@ -415,7 +415,7 @@ bool wxApp::SendIdleEvents( wxWindow* win ) wxIdleEvent event; event.SetEventObject(win); - win->ProcessEvent(event); + win->GetEventHandler()->ProcessEvent(event); win->OnInternalIdle(); diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 38d20c606c..ed3595f860 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -20,6 +20,16 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> +extern void gdk_wx_draw_bitmap (GdkDrawable *drawable, + GdkGC *gc, + GdkDrawable *src, + gint xsrc, + gint ysrc, + gint xdest, + gint ydest, + gint width, + gint height); + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- @@ -100,14 +110,14 @@ bool wxMask::Create( const wxBitmap& bitmap, if (bpp == 15) { red = red & 0xf8; - blue = blue & 0xf8; green = green & 0xf8; + blue = blue & 0xf8; } if (bpp == 16) { red = red & 0xf8; - blue = blue & 0xfc; - green = green & 0xf8; + green = green & 0xfc; + blue = blue & 0xf8; } color.red = 0; @@ -180,7 +190,7 @@ bool wxMask::Create( const wxBitmap& bitmap ) GdkGC *gc = gdk_gc_new( m_bitmap ); - gdk_draw_bitmap( m_bitmap, gc, bitmap.GetBitmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight() ); + gdk_wx_draw_bitmap( m_bitmap, gc, bitmap.GetBitmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight() ); gdk_gc_unref( gc ); @@ -351,12 +361,12 @@ wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp ) return *this; } -bool wxBitmap::operator == ( const wxBitmap& bmp ) +bool wxBitmap::operator == ( const wxBitmap& bmp ) const { return m_refData == bmp.m_refData; } -bool wxBitmap::operator != ( const wxBitmap& bmp ) +bool wxBitmap::operator != ( const wxBitmap& bmp ) const { return m_refData != bmp.m_refData; } @@ -422,7 +432,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const else { GdkGC *gc = gdk_gc_new( ret.GetBitmap() ); - gdk_draw_bitmap( ret.GetBitmap(), gc, GetBitmap(), rect.x, rect.y, 0, 0, rect.width, rect.height ); + gdk_wx_draw_bitmap( ret.GetBitmap(), gc, GetBitmap(), rect.x, rect.y, 0, 0, rect.width, rect.height ); gdk_gc_destroy( gc ); } @@ -432,7 +442,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const mask->m_bitmap = gdk_pixmap_new( wxRootWindow->window, rect.width, rect.height, 1 ); GdkGC *gc = gdk_gc_new( mask->m_bitmap ); - gdk_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, 0, 0, rect.x, rect.y, rect.width, rect.height ); + gdk_wx_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, 0, 0, rect.x, rect.y, rect.width, rect.height ); gdk_gc_destroy( gc ); ret.SetMask( mask ); diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index 32ac3f8575..b056ecbcbd 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: bmpbuttn.cpp +// Name: gtk/bmpbuttn.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ // Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -43,12 +43,12 @@ extern bool g_blockEventsOnDrag; static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); event.SetEventObject(button); button->GetEventHandler()->ProcessEvent(event); @@ -63,7 +63,7 @@ static void gtk_bmpbutton_enter_callback( GtkWidget *WXUNUSED(widget), wxBitmapB if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - button->HasFocus(); + button->HasFocus(); } //----------------------------------------------------------------------------- @@ -75,7 +75,7 @@ static void gtk_bmpbutton_leave_callback( GtkWidget *WXUNUSED(widget), wxBitmapB if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - button->NotFocus(); + button->NotFocus(); } //----------------------------------------------------------------------------- @@ -87,7 +87,7 @@ static void gtk_bmpbutton_press_callback( GtkWidget *WXUNUSED(widget), wxBitmapB if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - button->StartSelect(); + button->StartSelect(); } //----------------------------------------------------------------------------- @@ -99,7 +99,7 @@ static void gtk_bmpbutton_release_callback( GtkWidget *WXUNUSED(widget), wxBitma if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - button->EndSelect(); + button->EndSelect(); } //----------------------------------------------------------------------------- @@ -113,29 +113,30 @@ wxBitmapButton::wxBitmapButton() } bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, - const wxPoint &pos, const wxSize &size, + const wxPoint &pos, const wxSize &size, long style, const wxValidator& validator, const wxString &name ) { m_needParent = TRUE; m_acceptsFocus = TRUE; - + + m_marginX = + m_marginY = 0; + if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { wxFAIL_MSG( wxT("wxBitmapButton creation failed") ); - return FALSE; + return FALSE; } m_bitmap = bitmap; m_disabled = bitmap; m_focus = bitmap; m_selected = bitmap; - - m_label = ""; - + m_widget = gtk_button_new(); -#if (GTK_MINOR_VERSION > 0) +#if (GTK_MINOR_VERSION > 0) if (style & wxNO_BORDER) gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE ); #endif @@ -147,45 +148,45 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi GdkBitmap *mask = (GdkBitmap *) NULL; if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); GtkWidget *pixmap = gtk_pixmap_new( m_bitmap.GetPixmap(), mask ); - + gtk_widget_show( pixmap ); gtk_container_add( GTK_CONTAINER(m_widget), pixmap ); - + int border = 10; if (style & wxNO_BORDER) border = 4; if (newSize.x == -1) newSize.x = m_bitmap.GetWidth()+border; if (newSize.y == -1) newSize.y = m_bitmap.GetHeight()+border; SetSize( newSize.x, newSize.y ); } - - gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", + + gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", GTK_SIGNAL_FUNC(gtk_bmpbutton_clicked_callback), (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(m_widget), "enter", + gtk_signal_connect( GTK_OBJECT(m_widget), "enter", GTK_SIGNAL_FUNC(gtk_bmpbutton_enter_callback), (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(m_widget), "leave", + gtk_signal_connect( GTK_OBJECT(m_widget), "leave", GTK_SIGNAL_FUNC(gtk_bmpbutton_leave_callback), (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(m_widget), "pressed", + gtk_signal_connect( GTK_OBJECT(m_widget), "pressed", GTK_SIGNAL_FUNC(gtk_bmpbutton_press_callback), (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(m_widget), "released", + gtk_signal_connect( GTK_OBJECT(m_widget), "released", GTK_SIGNAL_FUNC(gtk_bmpbutton_release_callback), (gpointer*)this ); - + m_parent->DoAddChild( this ); - + PostCreation(); - + SetBackgroundColour( parent->GetBackgroundColour() ); Show( TRUE ); - + return TRUE; } - + void wxBitmapButton::SetDefault() { GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); gtk_widget_grab_default( m_widget ); - + SetSize( m_x, m_y, m_width, m_height ); } @@ -212,37 +213,37 @@ void wxBitmapButton::SetBitmap() wxCHECK_RET( m_widget != NULL, wxT("invalid button") ); wxBitmap the_one; - - if (!m_isEnabled) + + if (!m_isEnabled) the_one = m_disabled; - else + else { - if (m_isSelected) - { - the_one = m_selected; - } - else - { - if (m_hasFocus) - the_one = m_focus; - else - the_one = m_bitmap; + if (m_isSelected) + { + the_one = m_selected; + } + else + { + if (m_hasFocus) + the_one = m_focus; + else + the_one = m_bitmap; } } if (!the_one.Ok()) the_one = m_bitmap; if (!the_one.Ok()) return; - + GtkButton *bin = GTK_BUTTON( m_widget ); GtkPixmap *g_pixmap = GTK_PIXMAP( bin->child ); - + GdkBitmap *mask = (GdkBitmap *) NULL; if (the_one.GetMask()) mask = the_one.GetMask()->GetBitmap(); - + gtk_pixmap_set( g_pixmap, the_one.GetPixmap(), mask ); } -void wxBitmapButton::SetBitmapDisabled( const wxBitmap& bitmap ) +void wxBitmapButton::SetBitmapDisabled( const wxBitmap& bitmap ) { wxCHECK_RET( m_widget != NULL, wxT("invalid button") ); @@ -252,7 +253,7 @@ void wxBitmapButton::SetBitmapDisabled( const wxBitmap& bitmap ) SetBitmap(); } -void wxBitmapButton::SetBitmapFocus( const wxBitmap& bitmap ) +void wxBitmapButton::SetBitmapFocus( const wxBitmap& bitmap ) { wxCHECK_RET( m_widget != NULL, wxT("invalid button") ); @@ -268,7 +269,7 @@ void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap ) if (!m_bitmap.Ok()) return; m_bitmap = bitmap; - + SetBitmap(); } @@ -315,5 +316,6 @@ void wxBitmapButton::EndSelect() m_isSelected = FALSE; SetBitmap(); } -#endif + +#endif // wxUSE_BMPBUTTON diff --git a/src/gtk1/brush.cpp b/src/gtk1/brush.cpp index b58261b95c..70a2790e4a 100644 --- a/src/gtk1/brush.cpp +++ b/src/gtk1/brush.cpp @@ -96,12 +96,12 @@ wxBrush& wxBrush::operator = ( const wxBrush& brush ) return *this; } -bool wxBrush::operator == ( const wxBrush& brush ) +bool wxBrush::operator == ( const wxBrush& brush ) const { return m_refData == brush.m_refData; } -bool wxBrush::operator != ( const wxBrush& brush ) +bool wxBrush::operator != ( const wxBrush& brush ) const { return m_refData != brush.m_refData; } diff --git a/src/gtk1/colour.cpp b/src/gtk1/colour.cpp index db73e73343..1d004de25f 100644 --- a/src/gtk1/colour.cpp +++ b/src/gtk1/colour.cpp @@ -33,7 +33,7 @@ class wxColourRefData: public wxObjectRefData GdkColormap *m_colormap; bool m_hasPixel; - friend wxColour; + friend class wxColour; }; wxColourRefData::wxColourRefData() @@ -133,7 +133,7 @@ bool wxColour::operator == ( const wxColour& col ) const bool wxColour::operator != ( const wxColour& col) const { - return m_refData != col.m_refData; + return !(*this == col); } void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue ) diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 40e9370a10..fe859bb2ee 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -577,6 +577,7 @@ void wxComboBox::OnChar( wxKeyEvent &event ) if ( FindString(value) == wxNOT_FOUND ) { Append(value); + SetStringSelection(value); // and generate the selected event for it wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, GetId() ); diff --git a/src/gtk1/cursor.cpp b/src/gtk1/cursor.cpp index 80f7c26d60..ff4b3bea6d 100644 --- a/src/gtk1/cursor.cpp +++ b/src/gtk1/cursor.cpp @@ -155,6 +155,16 @@ extern wxCursor g_globalCursor; static wxCursor gs_savedCursor; static int gs_busyCount = 0; +const wxCursor &wxBusyCursor::GetStoredCursor() +{ + return gs_savedCursor; +} + +const wxCursor wxBusyCursor::GetBusyCursor() +{ + return wxCursor(wxCURSOR_WATCH); +} + void wxEndBusyCursor() { if (--gs_busyCount > 0) diff --git a/src/gtk1/data.cpp b/src/gtk1/data.cpp index abf1e939c0..dc6b6523a8 100644 --- a/src/gtk1/data.cpp +++ b/src/gtk1/data.cpp @@ -54,12 +54,6 @@ bool g_isIdle = FALSE; /* Message Strings for Internationalization */ char **wx_msg_str = (char**)NULL; -/* Custom OS version, as optionally placed in wx.ini/.wxrc - * Currently this can be Win95, Windows, Win32s, WinNT. - * For some systems, you can't tell until run-time what services you - * have. See wxGetOsVersion, which uses this string if present. */ -char *wxOsVersion = (char *) NULL; - /* For printing several pages */ int wxPageNumber; diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index d96bfe8a6d..e8ab913f6f 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -68,7 +68,7 @@ static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } #include "gdk/gdkprivate.h" -void gdk_draw_bitmap (GdkDrawable *drawable, +void gdk_wx_draw_bitmap (GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, gint xsrc, @@ -122,7 +122,11 @@ enum wxPoolGCType wxTEXT_COLOUR, wxBG_COLOUR, wxPEN_COLOUR, - wxBRUSH_COLOUR + wxBRUSH_COLOUR, + wxTEXT_SCREEN, + wxBG_SCREEN, + wxPEN_SCREEN, + wxBRUSH_SCREEN }; struct wxGC @@ -267,6 +271,14 @@ void wxWindowDC::SetUpDC() wxASSERT_MSG( !m_penGC, wxT("GCs already created") ); + if (m_isScreenDC) + { + m_penGC = wxGetPoolGC( m_window, wxPEN_SCREEN ); + m_brushGC = wxGetPoolGC( m_window, wxBRUSH_SCREEN ); + m_textGC = wxGetPoolGC( m_window, wxTEXT_SCREEN ); + m_bgGC = wxGetPoolGC( m_window, wxBG_SCREEN ); + } + else if (m_isMemDC && (((wxMemoryDC*)this)->m_selected.GetDepth() == 1)) { m_penGC = wxGetPoolGC( m_window, wxPEN_MONO ); @@ -912,7 +924,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, /* Draw XPixmap or XBitmap, depending on what the wxBitmap contains. For drawing a mono-bitmap (XBitmap) we use the current text GC */ if (is_mono) - gdk_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 ); + gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 ); else gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 ); @@ -1098,7 +1110,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he drawing a mono-bitmap (XBitmap) we use the current text GC */ if (is_mono) - gdk_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), xsrc, ysrc, xx, yy, ww, hh ); + gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), xsrc, ysrc, xx, yy, ww, hh ); else gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), xsrc, ysrc, xx, yy, ww, hh ); @@ -1284,8 +1296,8 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, for ( wxCoord srcY = 0; srcY < h; srcY++ ) { // transform source coords to dest coords - double r = sqrt(srcX*srcX + srcY*srcY); - double angleOrig = atan2(srcY, srcX) - rad; + double r = sqrt((double)srcX*srcX + srcY*srcY); + double angleOrig = atan2((double)srcY, (double)srcX) - rad; wxCoord dstX = (wxCoord)(r*cos(angleOrig) + 0.5), dstY = (wxCoord)(r*sin(angleOrig) + 0.5); diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 33bceb74e8..25f2982814 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -126,7 +126,7 @@ gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *e so we do this directly after realization */ static gint -gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win ) +gtk_dialog_realized_callback( GtkWidget * WXUNUSED(widget), wxDialog *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -231,7 +231,6 @@ void wxDialog::Init() m_returnCode = 0; m_sizeSet = FALSE; m_modalShowing = FALSE; - m_isFrame = TRUE; } wxDialog::wxDialog( wxWindow *parent, @@ -293,7 +292,7 @@ bool wxDialog::Create( wxWindow *parent, if ((m_x != -1) || (m_y != -1)) gtk_widget_set_uposition( m_widget, m_x, m_y ); gtk_widget_set_usize( m_widget, m_width, m_height ); - + /* we cannot set MWM hints before the widget has been realized, so we do this directly after realization */ gtk_signal_connect( GTK_OBJECT(m_widget), "realize", @@ -315,14 +314,7 @@ bool wxDialog::Create( wxWindow *parent, wxDialog::~wxDialog() { - m_isBeingDeleted = TRUE; - - wxTopLevelWindows.DeleteObject( this ); - - if (wxTheApp->GetTopWindow() == this) - { - wxTheApp->SetTopWindow( (wxWindow*) NULL ); - } + CleanUp(); if ((wxTopLevelWindows.Number() == 0) && (wxTheApp->GetExitOnFrameDelete())) @@ -334,13 +326,12 @@ wxDialog::~wxDialog() void wxDialog::SetTitle( const wxString& title ) { m_title = title; - if (m_title.IsNull()) m_title = wxT(""); gtk_window_set_title( GTK_WINDOW(m_widget), m_title.mbc_str() ); } wxString wxDialog::GetTitle() const { - return (wxString&)m_title; + return m_title; } void wxDialog::OnApply( wxCommandEvent &WXUNUSED(event) ) @@ -372,7 +363,7 @@ void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) ) else { SetReturnCode(wxID_OK); - this->Show(FALSE); + Show(FALSE); } } } @@ -413,11 +404,31 @@ void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) bool wxDialog::Destroy() { - if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); + // schedule the dialog for the deletion + if ( !wxPendingDelete.Member(this) ) + { + wxPendingDelete.Append(this); + } + + // don't leave a dangling pointer as the app top window, we can be deleted + // any moment at all now! + CleanUp(); return TRUE; } +void wxDialog::CleanUp() +{ + m_isBeingDeleted = TRUE; + + if ( wxTheApp->GetTopWindow() == this ) + { + wxTheApp->SetTopWindow( (wxWindow*) NULL ); + } + + wxTopLevelWindows.DeleteObject( this ); +} + void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") ); @@ -457,7 +468,7 @@ void wxDialog::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width { wxFAIL_MSG( wxT("DoMoveWindow called for wxDialog") ); } - + void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") ); @@ -552,7 +563,7 @@ void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int heigh geom.min_height = m_minHeight; geom.max_width = m_maxWidth; geom.max_height = m_maxHeight; - gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), + gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), (GtkWidget*) NULL, &geom, (GdkWindowHints) flag ); @@ -620,6 +631,16 @@ int wxDialog::ShowModal() return GetReturnCode(); } + if ( !GetParent() ) + { + wxWindow *parent = wxTheApp->GetTopWindow(); + if ( parent && parent != this ) + { + m_parent = parent; + gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(parent->m_widget) ); + } + } + wxBusyCursorSuspender cs; // temporarily suppress the busy cursor Show( TRUE ); diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp index 272530603b..a041507bf0 100644 --- a/src/gtk1/dnd.cpp +++ b/src/gtk1/dnd.cpp @@ -500,11 +500,11 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget), wxDataFormat format( selection_data->target ); wxLogDebug( wxT("Drop source: format requested: %s"), format.GetId().c_str() ); - + drop_source->m_retValue = wxDragCancel; wxDataObject *data = drop_source->GetDataObject(); - + if (!data) { wxLogDebug( wxT("Drop source: no data object") ); @@ -562,7 +562,7 @@ static void source_drag_data_delete( GtkWidget *WXUNUSED(widget), GdkDragContext *WXUNUSED(context), wxDropSource *WXUNUSED(drop_source) ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); // printf( "Drag source: drag_data_delete\n" ); @@ -576,7 +576,7 @@ static void source_drag_begin( GtkWidget *WXUNUSED(widget), GdkDragContext *WXUNUSED(context), wxDropSource *WXUNUSED(drop_source) ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); // printf( "Drag source: drag_begin.\n" ); @@ -620,7 +620,10 @@ gtk_dnd_window_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigur // wxDropSource //--------------------------------------------------------------------------- -wxDropSource::wxDropSource( wxWindow *win, const wxIcon &icon ) +wxDropSource::wxDropSource(wxWindow *win, + const wxIcon &iconCopy, + const wxIcon &iconMove, + const wxIcon &iconNone) { m_waiting = TRUE; @@ -632,11 +635,14 @@ wxDropSource::wxDropSource( wxWindow *win, const wxIcon &icon ) m_retValue = wxDragCancel; - m_icon = icon; - if (wxNullIcon == icon) m_icon = wxIcon( page_xpm ); + SetIcons(iconCopy, iconMove, iconNone); } -wxDropSource::wxDropSource( wxDataObject& data, wxWindow *win, const wxIcon &icon ) +wxDropSource::wxDropSource(wxDataObject& data, + wxWindow *win, + const wxIcon &iconCopy, + const wxIcon &iconMove, + const wxIcon &iconNone) { m_waiting = TRUE; @@ -650,19 +656,47 @@ wxDropSource::wxDropSource( wxDataObject& data, wxWindow *win, const wxIcon &ico m_retValue = wxDragCancel; - m_icon = icon; - if (wxNullIcon == icon) m_icon = wxIcon( page_xpm ); + SetIcons(iconCopy, iconMove, iconNone); +} + +void wxDropSource::SetIcons(const wxIcon &iconCopy, + const wxIcon &iconMove, + const wxIcon &iconNone) +{ + m_iconCopy = iconCopy; + m_iconMove = iconMove; + m_iconNone = iconNone; + + if ( !m_iconCopy.Ok() ) + m_iconCopy = wxIcon(page_xpm); + if ( !m_iconMove.Ok() ) + m_iconMove = m_iconCopy; + if ( !m_iconNone.Ok() ) + m_iconNone = m_iconCopy; } wxDropSource::~wxDropSource() { } -void wxDropSource::PrepareIcon( int hot_x, int hot_y, GdkDragContext *context ) +void wxDropSource::PrepareIcon( int action, GdkDragContext *context ) { - GdkBitmap *mask = (GdkBitmap *) NULL; - if (m_icon.GetMask()) mask = m_icon.GetMask()->GetBitmap(); - GdkPixmap *pixmap = m_icon.GetPixmap(); + // get the right icon to display + wxIcon *icon = NULL; + if ( action & GDK_ACTION_MOVE ) + icon = &m_iconMove; + else if ( action & GDK_ACTION_COPY ) + icon = &m_iconCopy; + else + icon = &m_iconNone; + + GdkBitmap *mask; + if ( icon->GetMask() ) + mask = icon->GetMask()->GetBitmap(); + else + mask = (GdkBitmap *)NULL; + + GdkPixmap *pixmap = icon->GetPixmap(); gint width,height; gdk_window_get_size (pixmap, &width, &height); @@ -689,7 +723,7 @@ void wxDropSource::PrepareIcon( int hot_x, int hot_y, GdkDragContext *context ) if (mask) gtk_widget_shape_combine_mask (m_iconWindow, mask, 0, 0); - gtk_drag_set_icon_widget( context, m_iconWindow, hot_x, hot_y ); + gtk_drag_set_icon_widget( context, m_iconWindow, 0, 0 ); } wxDragResult wxDropSource::DoDragDrop( bool allowMove ) @@ -702,7 +736,8 @@ wxDragResult wxDropSource::DoDragDrop( bool allowMove ) if (m_data->GetFormatCount() == 0) return (wxDragResult) wxDragNone; - g_blockEventsOnDrag = TRUE; + // disabled for now + g_blockEventsOnDrag = FALSE; RegisterWindow(); @@ -746,22 +781,22 @@ wxDragResult wxDropSource::DoDragDrop( bool allowMove ) if (button_number) { GdkDragAction action = GDK_ACTION_COPY; - if (allowMove) action = (GdkDragAction)(GDK_ACTION_MOVE|GDK_ACTION_COPY); + if (allowMove) action = (GdkDragAction)(GDK_ACTION_MOVE|GDK_ACTION_COPY); GdkDragContext *context = gtk_drag_begin( m_widget, - target_list, - action, - button_number, /* number of mouse button which started drag */ - (GdkEvent*) &event ); + target_list, + action, + button_number, /* number of mouse button which started drag */ + (GdkEvent*) &event ); m_dragContext = context; - PrepareIcon( 0, 0, context ); + PrepareIcon( action, context ); while (m_waiting) gtk_main_iteration(); - - if (context->action == GDK_ACTION_COPY) + + if (context->action == GDK_ACTION_COPY) m_retValue = wxDragCopy; - if (context->action == GDK_ACTION_MOVE) + if (context->action == GDK_ACTION_MOVE) m_retValue = wxDragMove; } @@ -780,7 +815,7 @@ wxDragResult wxDropSource::DoDragDrop( bool allowMove ) void wxDropSource::RegisterWindow() { if (!m_widget) return; - + gtk_signal_connect( GTK_OBJECT(m_widget), "drag_data_get", GTK_SIGNAL_FUNC (source_drag_data_get), (gpointer) this); gtk_signal_connect (GTK_OBJECT(m_widget), "drag_data_delete", diff --git a/src/gtk1/files.lst b/src/gtk1/files.lst index 86cfa8625f..1a9155553a 100644 --- a/src/gtk1/files.lst +++ b/src/gtk1/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 15:55, 2000/03/14 +# This file was automatically generated by tmake at 20:17, 2000/03/31 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -167,6 +167,7 @@ ALL_SOURCES = \ gtk/gdiobj.cpp \ gtk/gsockgtk.c \ gtk/icon.cpp \ + gtk/joystick.cpp \ gtk/listbox.cpp \ gtk/main.cpp \ gtk/mdi.cpp \ @@ -289,6 +290,7 @@ ALL_HEADERS = \ filesys.h \ font.h \ fontdlg.h \ + fontenc.h \ fontenum.h \ fontmap.h \ fontutil.h \ @@ -860,6 +862,7 @@ GUIOBJS = \ gdiobj.o \ gsockgtk.o \ icon.o \ + joystick.o \ listbox.o \ main.o \ mdi.o \ @@ -920,6 +923,7 @@ GUIDEPS = \ gdiobj.d \ gsockgtk.d \ icon.d \ + joystick.d \ listbox.d \ main.d \ mdi.d \ diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 26a9ba0dcb..83010c18da 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -71,7 +71,7 @@ private: wxString m_faceName; wxFontEncoding m_encoding; - friend wxFont; + friend class wxFont; }; // ============================================================================ @@ -397,7 +397,7 @@ void wxFont::SetEncoding(wxFontEncoding encoding) static GdkFont *g_systemDefaultGuiFont = (GdkFont*) NULL; -static GdkFont *GtkGetDefaultGuiFont() +GdkFont *GtkGetDefaultGuiFont() { if (!g_systemDefaultGuiFont) { diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index f4e2970ad0..8773d721d2 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -216,7 +216,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *ev if (!win->m_hasVMT) return FALSE; - + #if (GTK_MINOR_VERSION > 0) int x = 0; int y = 0; @@ -243,7 +243,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *ev so we do this directly after realization */ static gint -gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win ) +gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -283,7 +283,7 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win ) func |= GDK_FUNC_RESIZE; decor |= GDK_DECOR_RESIZEH; } - + gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor); gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func); } @@ -394,7 +394,6 @@ void wxFrame::Init() m_menuBarDetached = FALSE; m_toolBarDetached = FALSE; m_insertInClientArea = TRUE; - m_isFrame = FALSE; } bool wxFrame::Create( wxWindow *parent, @@ -408,7 +407,6 @@ bool wxFrame::Create( wxWindow *parent, wxTopLevelWindows.Append( this ); m_needParent = FALSE; - m_isFrame = TRUE; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) @@ -475,7 +473,7 @@ bool wxFrame::Create( wxWindow *parent, if ((m_x != -1) || (m_y != -1)) gtk_widget_set_uposition( m_widget, m_x, m_y ); gtk_widget_set_usize( m_widget, m_width, m_height ); - + /* we cannot set MWM hints and icons before the widget has been realized, so we do this directly after realization */ gtk_signal_connect( GTK_OBJECT(m_widget), "realize", @@ -535,7 +533,7 @@ void wxFrame::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width) { wxFAIL_MSG( wxT("DoMoveWindow called for wxFrame") ); } - + void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); @@ -738,23 +736,22 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; - - /* set size hints */ - gint flag = 0; // GDK_HINT_POS; - if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE; - if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE; - GdkGeometry geom; - geom.min_width = m_minWidth; - geom.min_height = m_minHeight; - geom.max_width = m_maxWidth; - geom.max_height = m_maxHeight; - gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), - (GtkWidget*) NULL, - &geom, - (GdkWindowHints) flag ); if (m_mainWidget) { + /* set size hints */ + gint flag = 0; // GDK_HINT_POS; + if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE; + if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE; + GdkGeometry geom; + geom.min_width = m_minWidth; + geom.min_height = m_minHeight; + geom.max_width = m_maxWidth; + geom.max_height = m_maxHeight; + gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), + (GtkWidget*) NULL, + &geom, + (GdkWindowHints) flag ); /* I revert back to wxGTK's original behaviour. m_mainWidget holds the * menubar, the toolbar and the client area, which is represented by @@ -926,7 +923,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar ) gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget), GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this ); } - + gtk_container_remove( GTK_CONTAINER(m_mainWidget), m_frameMenuBar->m_widget ); gtk_widget_ref( m_frameMenuBar->m_widget ); gtk_widget_unparent( m_frameMenuBar->m_widget ); @@ -971,9 +968,6 @@ wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& na m_frameToolBar = wxFrameBase::CreateToolBar( style, id, name ); - if (m_frameToolBar) - GetChildren().DeleteObject( m_frameToolBar ); - m_insertInClientArea = TRUE; m_sizeSet = FALSE; diff --git a/src/gtk1/joystick.cpp b/src/gtk1/joystick.cpp index 810ebb4a59..372046b52f 100644 --- a/src/gtk1/joystick.cpp +++ b/src/gtk1/joystick.cpp @@ -355,5 +355,5 @@ bool wxJoystick::ReleaseCapture(void) m_polling = 0; return TRUE; } -#endif +#endif // wxUSE_JOYSTICK diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index 3fa7de98fd..b87d71f753 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -47,13 +47,13 @@ extern wxList wxPendingDelete; // "switch_page" //----------------------------------------------------------------------------- -static void +static void gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), GtkNotebookPage *page, - gint WXUNUSED(page_num), - wxMDIParentFrame *parent ) + gint WXUNUSED(page_num), + wxMDIParentFrame *parent ) { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); // send deactivate event to old child @@ -65,9 +65,9 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), event1.SetEventObject( child); child->GetEventHandler()->ProcessEvent( event1 ); } - + // send activate event to new child - + wxMDIClientWindow *client_window = parent->GetClientWindow(); if (!client_window) return; @@ -79,16 +79,16 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), { wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data(); if (child_frame->m_page == page) - { + { child = child_frame; - break; - } + break; + } node = node->Next(); } - + if (!child) return; - + wxActivateEvent event2( wxEVT_ACTIVATE, TRUE, child->GetId() ); event2.SetEventObject( child); child->GetEventHandler()->ProcessEvent( event2 ); @@ -100,33 +100,23 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame) -BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) -END_EVENT_TABLE() - -wxMDIParentFrame::wxMDIParentFrame() -{ - m_justInserted = FALSE; - m_clientWindow = (wxMDIClientWindow *) NULL; -} - -wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, - wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name ) +void wxMDIParentFrame::Init() { m_justInserted = FALSE; m_clientWindow = (wxMDIClientWindow *) NULL; - Create( parent, id, title, pos, size, style, name ); } wxMDIParentFrame::~wxMDIParentFrame() { } -bool wxMDIParentFrame::Create( wxWindow *parent, - wxWindowID id, const wxString& title, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name ) +bool wxMDIParentFrame::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name ) { wxFrame::Create( parent, id, title, pos, size, style, name ); @@ -150,8 +140,8 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height ) menu_bar->m_y = 0; menu_bar->m_width = m_width; menu_bar->m_height = wxMENU_HEIGHT; - gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), - menu_bar->m_widget, + gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), + menu_bar->m_widget, 0, 0, m_width, wxMENU_HEIGHT ); } @@ -179,31 +169,36 @@ void wxMDIParentFrame::OnInternalIdle() wxNode *node = m_clientWindow->GetChildren().First(); while (node) { - wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data(); - wxMenuBar *menu_bar = child_frame->m_menuBar; - if (child_frame->m_menuBar) + wxObject *child = node->Data(); + wxMDIChildFrame *child_frame = wxDynamicCast(child, wxMDIChildFrame); + if ( child_frame ) { - if (child_frame == active_child_frame) + wxMenuBar *menu_bar = child_frame->m_menuBar; + if ( menu_bar ) { - if (menu_bar->Show(TRUE)) - { - menu_bar->m_width = m_width; - menu_bar->m_height = wxMENU_HEIGHT; - gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), - menu_bar->m_widget, - 0, 0, m_width, wxMENU_HEIGHT ); - menu_bar->SetInvokingWindow( child_frame ); - } - visible_child_menu = TRUE; + if (child_frame == active_child_frame) + { + if (menu_bar->Show(TRUE)) + { + menu_bar->m_width = m_width; + menu_bar->m_height = wxMENU_HEIGHT; + gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), + menu_bar->m_widget, + 0, 0, m_width, wxMENU_HEIGHT ); + menu_bar->SetInvokingWindow( child_frame ); + } + visible_child_menu = TRUE; + } + else + { + if (menu_bar->Show(FALSE)) + { + menu_bar->UnsetInvokingWindow( child_frame ); + } + } } - else - { - if (menu_bar->Show(FALSE)) - { - menu_bar->UnsetInvokingWindow( child_frame ); - } - } } + node = node->Next(); } @@ -212,21 +207,21 @@ void wxMDIParentFrame::OnInternalIdle() (m_frameMenuBar->IsShown() == visible_child_menu)) { if (visible_child_menu) - { + { m_frameMenuBar->Show( FALSE ); - m_frameMenuBar->UnsetInvokingWindow( this ); - } - else - { + m_frameMenuBar->UnsetInvokingWindow( this ); + } + else + { m_frameMenuBar->Show( TRUE ); - m_frameMenuBar->SetInvokingWindow( this ); - - m_frameMenuBar->m_width = m_width; - m_frameMenuBar->m_height = wxMENU_HEIGHT; - gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), - m_frameMenuBar->m_widget, - 0, 0, m_width, wxMENU_HEIGHT ); - } + m_frameMenuBar->SetInvokingWindow( this ); + + m_frameMenuBar->m_width = m_width; + m_frameMenuBar->m_height = wxMENU_HEIGHT; + gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), + m_frameMenuBar->m_widget, + 0, 0, m_width, wxMENU_HEIGHT ); + } } } @@ -287,14 +282,6 @@ void wxMDIParentFrame::ActivatePrevious() gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) ); } -void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) ) -{ -} - -void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(event) ) -{ -} - //----------------------------------------------------------------------------- // wxMDIChildFrame //----------------------------------------------------------------------------- @@ -303,12 +290,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxFrame) BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) EVT_ACTIVATE(wxMDIChildFrame::OnActivate) + EVT_MENU_HIGHLIGHT_ALL(wxMDIChildFrame::OnMenuHighlight) END_EVENT_TABLE() wxMDIChildFrame::wxMDIChildFrame() { m_menuBar = (wxMenuBar *) NULL; m_page = (GtkNotebookPage *) NULL; + m_isFrame = TRUE; } wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, @@ -318,6 +307,7 @@ wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, { m_menuBar = (wxMenuBar *) NULL; m_page = (GtkNotebookPage *) NULL; + m_isFrame = TRUE; Create( parent, id, title, wxDefaultPosition, size, style, name ); } @@ -360,8 +350,8 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) m_menuBar->SetParent( mdi_frame ); /* insert the invisible menu bar into the _parent_ mdi frame */ - gtk_pizza_put( GTK_PIZZA(mdi_frame->m_mainWidget), - m_menuBar->m_widget, + gtk_pizza_put( GTK_PIZZA(mdi_frame->m_mainWidget), + m_menuBar->m_widget, 0, 0, mdi_frame->m_width, wxMENU_HEIGHT ); } } @@ -380,14 +370,39 @@ void wxMDIChildFrame::Activate() gtk_notebook_set_page( notebook, pageno ); #else // the only way I can see to do this under gtk+ 1.0.X would - // be to keep track of page numbers, start at first and + // be to keep track of page numbers, start at first and // do "next" enough times to get to this page number - messy // - J. Russell Smyth #endif } -void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) ) +void wxMDIChildFrame::OnActivate( wxActivateEvent& WXUNUSED(event) ) +{ +} + +void wxMDIChildFrame::OnMenuHighlight( wxMenuEvent& event ) { +#if wxUSE_STATUSBAR + wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->GetParent(); + if ( !ShowMenuHelp(mdi_frame->GetStatusBar(), event.GetMenuId()) ) + { + // we don't have any help text for this item, but may be the MDI frame + // does? + mdi_frame->OnMenuHighlight(event); + } +#endif // wxUSE_STATUSBAR +} + +void wxMDIChildFrame::SetTitle( const wxString &title ) +{ + if ( title == m_title ) + return; + + m_title = title; + + wxMDIParentFrame* parent = (wxMDIParentFrame*) GetParent(); + GtkNotebook* notebook = GTK_NOTEBOOK(parent->m_widget); + gtk_notebook_set_tab_label_text(notebook, m_page->child, title.mbc_str()); } //----------------------------------------------------------------------------- @@ -464,7 +479,7 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) !CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("wxMDIClientWindow") )) { wxFAIL_MSG( wxT("wxMDIClientWindow creation failed") ); - return FALSE; + return FALSE; } m_widget = gtk_notebook_new(); diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 5c17e2c985..1149f81f86 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -35,6 +35,45 @@ extern bool g_isIdle; static wxString GetHotKey( const wxMenuItem& item ); #endif +//----------------------------------------------------------------------------- +// idle system +//----------------------------------------------------------------------------- + +static wxString wxReplaceUnderscore( const wxString& title ) +{ + const wxChar *pc; + + /* GTK 1.2 wants to have "_" instead of "&" for accelerators */ + wxString str; + for ( pc = title; *pc != wxT('\0'); pc++ ) + { + if (*pc == wxT('&')) + { +#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0) + str << wxT('_'); + } + else if (*pc == wxT('/')) + { + str << wxT('\\'); +#endif + } + else + { +#if __WXGTK12__ + if ( *pc == wxT('_') ) + { + // underscores must be doubled to prevent them from being + // interpreted as accelerator character prefix by GTK + str << *pc; + } +#endif // GTK+ 1.2 + + str << *pc; + } + } + return str; +} + //----------------------------------------------------------------------------- // wxMenuBar //----------------------------------------------------------------------------- @@ -221,36 +260,7 @@ bool wxMenuBar::Append( wxMenu *menu, const wxString &title ) bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title) { - const wxChar *pc; - - /* GTK 1.2 wants to have "_" instead of "&" for accelerators */ - wxString str; - for ( pc = title; *pc != wxT('\0'); pc++ ) - { - if (*pc == wxT('&')) - { -#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0) - str << wxT('_'); - } - else if (*pc == wxT('/')) - { - str << wxT('\\'); -#endif - } - else - { -#if __WXGTK12__ - if ( *pc == wxT('_') ) - { - // underscores must be doubled to prevent them from being - // interpreted as accelerator character prefix by GTK - str << *pc; - } -#endif // GTK+ 1.2 - - str << *pc; - } - } + wxString str( wxReplaceUnderscore( title ) ); /* this doesn't have much effect right now */ menu->SetTitle( str ); @@ -275,6 +285,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title) gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ /* in order to get the pointer to the item we need the item text _without_ underscores */ wxString tmp = wxT("<main>/"); + const wxChar *pc; for ( pc = str; *pc != wxT('\0'); pc++ ) { // contrary to the common sense, we must throw out _all_ underscores, @@ -379,7 +390,7 @@ wxMenu *wxMenuBar::Remove(size_t pos) static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString ) { - if (menu->GetTitle() == menuString) + if (wxMenuItem::GetLabelFromText(menu->GetTitle()) == wxMenuItem::GetLabelFromText(menuString)) { int res = menu->FindItem( itemString ); if (res != wxNOT_FOUND) @@ -472,7 +483,25 @@ wxString wxMenuBar::GetLabelTop( size_t pos ) const wxMenu* menu = node->GetData(); - return menu->GetTitle(); + wxString label; + wxString text( menu->GetTitle() ); +#if (GTK_MINOR_VERSION > 0) + for ( const wxChar *pc = text.c_str(); *pc; pc++ ) + { + if ( *pc == wxT('_') || *pc == wxT('&') ) + { + // '_' is the escape character for GTK+ and '&' is the one for + // wxWindows - skip both of them + continue; + } + + label += *pc; + } +#else // GTK+ 1.0 + label = text; +#endif // GTK+ 1.2/1.0 + + return label; } void wxMenuBar::SetLabelTop( size_t pos, const wxString& label ) @@ -483,7 +512,22 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label ) wxMenu* menu = node->GetData(); - menu->SetTitle( label ); + wxString str( wxReplaceUnderscore( label ) ); + + menu->SetTitle( str ); + + if (menu->m_owner) + { + GtkLabel *label = GTK_LABEL( GTK_BIN(menu->m_owner)->child ); + + /* set new text */ + gtk_label_set( label, str.mb_str()); + + /* reparse key accel */ + (void)gtk_label_parse_uline (GTK_LABEL(label), str.mb_str() ); + gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) ); + } + } //----------------------------------------------------------------------------- @@ -963,6 +1007,12 @@ bool wxMenu::DoInsert(size_t pos, wxMenuItem *item) if ( !GtkAppend(item) ) return FALSE; + if ( m_style & wxMENU_TEAROFF ) + { + // change the position as the first item is the tear-off marker + pos++; + } + GtkMenuShell *menu_shell = GTK_MENU_SHELL(m_factory->widget); gpointer data = g_list_last(menu_shell->children)->data; menu_shell->children = g_list_remove(menu_shell->children, data); diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 4fbff0c3df..3626e86c46 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -521,7 +521,7 @@ bool wxNotebook::DeletePage( int page ) if (!nb_page) return FALSE; /* GTK sets GtkNotebook.cur_page to NULL before sending - the switvh page event */ + the switch page event */ m_lastSelection = GetSelection(); nb_page->m_client->Destroy(); @@ -536,8 +536,12 @@ bool wxNotebook::RemovePage( int page ) { wxGtkNotebookPage* nb_page = GetNotebookPage(page); - if (!nb_page) return FALSE; + wxCHECK_MSG( nb_page, FALSE, _T("wxNotebook::RemovePage: invalid page") ); + gtk_widget_ref( nb_page->m_client->m_widget ); + gtk_widget_unrealize( nb_page->m_client->m_widget ); + gtk_widget_unparent( nb_page->m_client->m_widget ); + gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page ); m_pages.DeleteObject( nb_page ); diff --git a/src/gtk1/pen.cpp b/src/gtk1/pen.cpp index 90a54a25ee..8ac1097aa8 100644 --- a/src/gtk1/pen.cpp +++ b/src/gtk1/pen.cpp @@ -100,12 +100,12 @@ wxPen& wxPen::operator = ( const wxPen& pen ) return *this; } -bool wxPen::operator == ( const wxPen& pen ) +bool wxPen::operator == ( const wxPen& pen ) const { return m_refData == pen.m_refData; } -bool wxPen::operator != ( const wxPen& pen ) +bool wxPen::operator != ( const wxPen& pen ) const { return m_refData != pen.m_refData; } diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 10044f42a1..18867ec77d 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -114,14 +114,58 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_ return TRUE; } +static gint gtk_radiobutton_focus_in( GtkWidget *widget, + GdkEvent *WXUNUSED(event), + wxRadioBox *win ) +{ + if ( win->m_lostFocus ) + { + // no, we didn't really lose it + win->m_lostFocus = FALSE; + } + else if ( !win->m_hasFocus ) + { + win->m_hasFocus = TRUE; + + wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() ); + event.SetEventObject( win ); + + // never stop the signal emission, it seems to break the kbd handling + // inside the radiobox + (void)win->GetEventHandler()->ProcessEvent( event ); + } + + return FALSE; +} + +static gint gtk_radiobutton_focus_out( GtkWidget *widget, + GdkEvent *WXUNUSED(event), + wxRadioBox *win ) +{ + wxASSERT_MSG( win->m_hasFocus, _T("got focus out without any focus in?") ); + + // we might have lost the focus, but may be not - it may have just gone to + // another button in the same radiobox, so we'll check for it in the next + // idle iteration (leave m_hasFocus == TRUE for now) + win->m_lostFocus = TRUE; + + return FALSE; +} + //----------------------------------------------------------------------------- // wxRadioBox //----------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl) -wxRadioBox::wxRadioBox() +void wxRadioBox::Init() { + m_alreadySent = FALSE; + m_needParent = TRUE; + m_acceptsFocus = TRUE; + + m_hasFocus = + m_lostFocus = FALSE; } bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, @@ -130,10 +174,6 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, long style, const wxValidator& validator, const wxString &name ) { - m_alreadySent = FALSE; - m_needParent = TRUE; - m_acceptsFocus = TRUE; - if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { @@ -175,6 +215,12 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, gtk_signal_connect( GTK_OBJECT(m_radio), "clicked", GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); + gtk_signal_connect( GTK_OBJECT(m_radio), "focus_in_event", + GTK_SIGNAL_FUNC(gtk_radiobutton_focus_in), (gpointer)this ); + + gtk_signal_connect( GTK_OBJECT(m_radio), "focus_out_event", + GTK_SIGNAL_FUNC(gtk_radiobutton_focus_out), (gpointer)this ); + gtk_pizza_put( GTK_PIZZA(m_parent->m_wxwindow), GTK_WIDGET(m_radio), m_x+10, m_y+10+(i*24), 10, 10 ); @@ -665,4 +711,19 @@ bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window ) return FALSE; } -#endif +void wxRadioBox::OnInternalIdle() +{ + if ( m_lostFocus ) + { + m_hasFocus = FALSE; + m_lostFocus = FALSE; + + wxFocusEvent event( wxEVT_KILL_FOCUS, GetId() ); + event.SetEventObject( this ); + + (void)GetEventHandler()->ProcessEvent( event ); + } +} + +#endif // wxUSE_RADIOBOX + diff --git a/src/gtk1/radiobut.cpp b/src/gtk1/radiobut.cpp index fbb0a53ced..00f9c9821b 100644 --- a/src/gtk1/radiobut.cpp +++ b/src/gtk1/radiobut.cpp @@ -148,7 +148,7 @@ void wxRadioButton::SetLabel( const wxString& label ) void wxRadioButton::SetValue( bool val ) { wxCHECK_RET( m_widget != NULL, wxT("invalid radiobutton") ); - + if (val == GetValue()) return; @@ -162,8 +162,10 @@ void wxRadioButton::SetValue( bool val ) else { // should give an assert + // RL - No it shouldn't. A wxGenericValidator might try to set it + // as FALSE. Failing silently is probably TRTTD here. } - + gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); } diff --git a/src/gtk1/settings.cpp b/src/gtk1/settings.cpp index 4a491823fa..0adcfd51b3 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -21,6 +21,8 @@ #include <gdk/gdkprivate.h> #include <gtk/gtk.h> +extern GdkFont *GtkGetDefaultGuiFont(); + /* #define wxSYS_COLOUR_SCROLLBAR 0 @@ -233,19 +235,8 @@ wxFont wxSystemSettings::GetSystemFont( int index ) { if (!g_systemFont) { - GdkFont *gdk_font = (GdkFont*) NULL; - GtkWidget *widget = gtk_button_new(); #if 0 - GtkStyle *def = gtk_rc_get_style( widget ); - if (def) - gdk_font = def->font; - else - { - def = gtk_widget_get_default_style(); - if (def) - gdk_font = def->font; - } -#endif + GdkFont *gdk_font = GtkGetDefaultGuiFont(); if (gdk_font) { GSList *font_list = ((GdkFontPrivate*)gdk_font)->names; @@ -254,12 +245,11 @@ wxFont wxSystemSettings::GetSystemFont( int index ) wxFontData font_data; g_systemFont = new wxFont( font_string, font_data ); } - else - { - g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); - } - gtk_widget_destroy( widget ); +#endif + + g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); + } return *g_systemFont; } diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index fba7a8b971..838a5d2549 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -73,6 +73,7 @@ static void gtk_slider_callback( GtkAdjustment *adjust, wxSlider *win ) wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() ); cevent.SetEventObject( win ); + cevent.SetInt( value ); win->GetEventHandler()->ProcessEvent( cevent ); } diff --git a/src/gtk1/spinctrl.cpp b/src/gtk1/spinctrl.cpp index d5efca072e..db68c07d70 100644 --- a/src/gtk1/spinctrl.cpp +++ b/src/gtk1/spinctrl.cpp @@ -222,7 +222,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event ) if (event.KeyCode() == WXK_RETURN) { wxWindow *top_frame = m_parent; - while (top_frame->GetParent() && !(top_frame->GetParent()->m_isFrame)) + while (top_frame->GetParent() && !(top_frame->GetParent()->IsTopLevel())) top_frame = top_frame->GetParent(); GtkWindow *window = GTK_WINDOW(top_frame->m_widget); diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 6e58b78a54..b85ed54228 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -33,6 +33,8 @@ #include "gdk/gdk.h" #include "gtk/gtk.h" +extern GdkFont *GtkGetDefaultGuiFont(); + // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -303,8 +305,9 @@ bool wxToolBar::Create( wxWindow *parent, GTK_TOOLBAR(m_toolbar)->tooltips->tip_window ) ); g_style->bg[GTK_STATE_NORMAL] = *m_bg; + gdk_font_unref( g_style->font ); + g_style->font = gdk_font_ref( GtkGetDefaultGuiFont() ); gtk_widget_set_style( GTK_TOOLBAR(m_toolbar)->tooltips->tip_window, g_style ); - m_parent->DoAddChild( this ); diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 0f8df9de99..92360ca742 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -337,6 +337,13 @@ void wxTextCtrl::SetValue( const wxString &value ) { gtk_entry_set_text( GTK_ENTRY(m_text), tmp.mbc_str() ); } + + // GRG, Jun/2000: Changed this after a lot of discussion in + // the lists. wxWindows 2.2 will have a set of flags to + // customize this behaviour. + SetInsertionPoint(0); + + m_modified = FALSE; } void wxTextCtrl::WriteText( const wxString &text ) @@ -614,7 +621,7 @@ bool wxTextCtrl::Enable( bool enable ) // nothing to do return FALSE; } - + if (m_windowStyle & wxTE_MULTILINE) { gtk_text_set_editable( GTK_TEXT(m_text), enable ); @@ -778,8 +785,9 @@ void wxTextCtrl::GetSelection(long* from, long* to) const if (!(GTK_EDITABLE(m_text)->has_selection)) { - if (from) *from = 0; - if (to) *to = 0; + long i = GetInsertionPoint(); + if (from) *from = i; + if (to) *to = i; return; } @@ -812,6 +820,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event ) { wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId); event.SetEventObject(this); + event.SetString(GetValue()); if (GetEventHandler()->ProcessEvent(event)) return; } diff --git a/src/gtk1/tooltip.cpp b/src/gtk1/tooltip.cpp index a80317beeb..109f4658a6 100644 --- a/src/gtk1/tooltip.cpp +++ b/src/gtk1/tooltip.cpp @@ -21,6 +21,8 @@ #include "gtk/gtk.h" #include "gdk/gdk.h" +extern GdkFont *GtkGetDefaultGuiFont(); + //----------------------------------------------------------------------------- // global data //----------------------------------------------------------------------------- @@ -72,7 +74,9 @@ void wxToolTip::Apply( wxWindow *win ) g_style->fg[GTK_STATE_NORMAL] = ss_fg; g_style->bg[GTK_STATE_NORMAL] = ss_bg; - + gdk_font_unref( g_style->font ); + g_style->font = gdk_font_ref( GtkGetDefaultGuiFont() ); + gtk_widget_set_style( ss_tooltips->tip_window, g_style ); #else gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg ); diff --git a/src/gtk1/win_gtk.c b/src/gtk1/win_gtk.c index e2b14c9404..923a12d157 100644 --- a/src/gtk1/win_gtk.c +++ b/src/gtk1/win_gtk.c @@ -81,8 +81,12 @@ static void gtk_pizza_expose_area (GtkPizza *pizza, gint y, gint width, gint height); +/* unused */ +#if 0 static void gtk_pizza_adjustment_changed (GtkAdjustment *adjustment, GtkPizza *pizza); +#endif + static GdkFilterReturn gtk_pizza_filter (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data); @@ -993,12 +997,12 @@ gtk_pizza_expose_predicate (Display *display, XEvent *xevent, XPointer arg) { - if ((xevent->type == Expose) || - ((xevent->xany.window == *(Window *)arg) && + if ((xevent->type == Expose) || + ((xevent->xany.window == *(Window *)arg) && (xevent->type == ConfigureNotify))) - return True; - else - return False; + return True; + else + return False; } /* This is the main routine to do the scrolling. Scrolling is @@ -1016,40 +1020,40 @@ gtk_pizza_expose_predicate (Display *display, void gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) { - GtkWidget *widget; - XEvent xevent; + GtkWidget *widget; + XEvent xevent; - gint x,y,w,h,border; + gint x,y,w,h,border; - widget = GTK_WIDGET (pizza); + widget = GTK_WIDGET (pizza); - pizza->xoffset += dx; - pizza->yoffset += dy; + pizza->xoffset += dx; + pizza->yoffset += dy; - if (!GTK_WIDGET_MAPPED (pizza)) + if (!GTK_WIDGET_MAPPED (pizza)) { - gtk_pizza_position_children (pizza); - return; + gtk_pizza_position_children (pizza); + return; } - gtk_pizza_adjust_allocations (pizza, -dx, -dy); + gtk_pizza_adjust_allocations (pizza, -dx, -dy); - if (pizza->shadow_type == GTK_MYSHADOW_NONE) - border = 0; - else - if (pizza->shadow_type == GTK_MYSHADOW_THIN) - border = 1; - else - border = 2; + if (pizza->shadow_type == GTK_MYSHADOW_NONE) + border = 0; + else + if (pizza->shadow_type == GTK_MYSHADOW_THIN) + border = 1; + else + border = 2; - x = 0; - y = 0; - w = widget->allocation.width - 2*border; - h = widget->allocation.height - 2*border; + x = 0; + y = 0; + w = widget->allocation.width - 2*border; + h = widget->allocation.height - 2*border; - if (dx > 0) + if (dx > 0) { - if (gravity_works) + if (gravity_works) { gdk_window_resize (pizza->bin_window, w + dx, @@ -1057,20 +1061,14 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) gdk_window_move (pizza->bin_window, x-dx, y); gdk_window_move_resize (pizza->bin_window, x, y, w, h ); } - else + else { /* FIXME */ } - - gtk_pizza_expose_area (pizza, - MAX ((gint)w - dx, 0), - 0, - MIN (dx, w), - h); } - else if (dx < 0) + else if (dx < 0) { - if (gravity_works) + if (gravity_works) { gdk_window_move_resize (pizza->bin_window, x + dx, @@ -1080,102 +1078,73 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy) gdk_window_move (pizza->bin_window, x, y); gdk_window_resize (pizza->bin_window, w, h ); } - else + else { /* FIXME */ } - - gtk_pizza_expose_area (pizza, - 0, - 0, - MIN (-dx, w), - h); } - if (dy > 0) + if (dy > 0) { - if (gravity_works) + if (gravity_works) { gdk_window_resize (pizza->bin_window, w, h + dy); gdk_window_move (pizza->bin_window, x, y-dy); gdk_window_move_resize (pizza->bin_window, x, y, w, h ); } - else + else { /* FIXME */ } - - gtk_pizza_expose_area (pizza, - 0, - MAX ((gint)h - dy, 0), - w, - MIN (dy, h)); } - else if (dy < 0) + else if (dy < 0) { - if (gravity_works) + if (gravity_works) { gdk_window_move_resize (pizza->bin_window, x, y+dy, w, h - dy ); gdk_window_move (pizza->bin_window, x, y); gdk_window_resize (pizza->bin_window, w, h ); } - else + else { /* FIXME */ } - gtk_pizza_expose_area (pizza, - 0, - 0, - w, - MIN (-dy, (gint)h)); } - gtk_pizza_position_children (pizza); - - /* We have to make sure that all exposes from this scroll get - * processed before we scroll again, or the expose events will - * have invalid coordinates. - * - * We also do expose events for other windows, since otherwise - * their updating will fall behind the scrolling - * - * This also avoids a problem in pre-1.0 GTK where filters don't - * have access to configure events that were compressed. - */ - - gdk_flush(); - while (XCheckIfEvent(GDK_WINDOW_XDISPLAY (pizza->bin_window), - &xevent, - gtk_pizza_expose_predicate, - (XPointer)&GDK_WINDOW_XWINDOW (pizza->bin_window))) + gtk_pizza_position_children (pizza); + + gdk_flush(); + while (XCheckIfEvent(GDK_WINDOW_XDISPLAY (pizza->bin_window), + &xevent, + gtk_pizza_expose_predicate, + (XPointer)&GDK_WINDOW_XWINDOW (pizza->bin_window))) { - GdkEvent event; - GtkWidget *event_widget; + GdkEvent event; + GtkWidget *event_widget; - if ((xevent.xany.window == GDK_WINDOW_XWINDOW (pizza->bin_window)) && - (gtk_pizza_filter (&xevent, &event, pizza) == GDK_FILTER_REMOVE)) - continue; + if ((xevent.xany.window == GDK_WINDOW_XWINDOW (pizza->bin_window)) ) + gtk_pizza_filter (&xevent, &event, pizza); - if (xevent.type == Expose) + if (xevent.type == Expose) { - event.expose.window = gdk_window_lookup (xevent.xany.window); - gdk_window_get_user_data (event.expose.window, + event.expose.window = gdk_window_lookup (xevent.xany.window); + gdk_window_get_user_data (event.expose.window, (gpointer *)&event_widget); - if (event_widget) + if (event_widget) { - event.expose.type = GDK_EXPOSE; - event.expose.area.x = xevent.xexpose.x; - event.expose.area.y = xevent.xexpose.y; - event.expose.area.width = xevent.xexpose.width; - event.expose.area.height = xevent.xexpose.height; - event.expose.count = xevent.xexpose.count; - - gdk_window_ref (event.expose.window); - gtk_widget_event (event_widget, &event); - gdk_window_unref (event.expose.window); + event.expose.type = GDK_EXPOSE; + event.expose.area.x = xevent.xexpose.x; + event.expose.area.y = xevent.xexpose.y; + event.expose.area.width = xevent.xexpose.width; + event.expose.area.height = xevent.xexpose.height; + event.expose.count = xevent.xexpose.count; + + gdk_window_ref (event.expose.window); + gtk_widget_event (event_widget, &event); + gdk_window_unref (event.expose.window); } } } @@ -1206,25 +1175,17 @@ gtk_pizza_filter (GdkXEvent *gdk_xevent, if (!pizza->use_filter) return GDK_FILTER_CONTINUE; - switch (xevent->type) + switch (xevent->type) { case Expose: if (xevent->xexpose.serial == pizza->configure_serial) { - if (pizza->visibility == GDK_VISIBILITY_UNOBSCURED) - return GDK_FILTER_REMOVE; - else - { - xevent->xexpose.x += pizza->scroll_x; - xevent->xexpose.y += pizza->scroll_y; - - break; - } + xevent->xexpose.x += pizza->scroll_x; + xevent->xexpose.y += pizza->scroll_y; } break; case ConfigureNotify: - if ((xevent->xconfigure.x != 0) || (xevent->xconfigure.y != 0)) { pizza->configure_serial = xevent->xconfigure.serial; pizza->scroll_x = xevent->xconfigure.x; @@ -1278,8 +1239,6 @@ gtk_pizza_main_filter (GdkXEvent *gdk_xevent, } - - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 80384e2535..8f921839aa 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: window.cpp +// Name: gtk/window.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -30,6 +30,10 @@ #include "wx/tooltip.h" #endif +#if wxUSE_CARET + #include "wx/caret.h" +#endif // wxUSE_CARET + #include "wx/menu.h" #include "wx/statusbr.h" #include "wx/intl.h" @@ -298,6 +302,28 @@ extern bool g_isIdle; // local code (see below) //----------------------------------------------------------------------------- +// returns the child of win which currently has focus or NULL if not found +static wxWindow *FindFocusedChild(wxWindow *win) +{ + wxWindow *winFocus = wxWindow::FindFocus(); + if ( !winFocus ) + return (wxWindow *)NULL; + + if ( winFocus == win ) + return win; + + for ( wxWindowList::Node *node = win->GetChildren().GetFirst(); + node; + node = node->GetNext() ) + { + wxWindow *child = FindFocusedChild(node->GetData()); + if ( child ) + return child; + } + + return (wxWindow *)NULL; +} + static void draw_frame( GtkWidget *widget, wxWindow *win ) { if (!win->m_hasVMT) @@ -636,9 +662,6 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev } */ - if (!win->m_queuedFullRedraw) - { - win->GetUpdateRegion().Union( gdk_event->area.x, gdk_event->area.y, gdk_event->area.width, @@ -683,7 +706,6 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev gtk_widget_event (child->widget, (GdkEvent*) &child_event); } } - } return TRUE; } @@ -738,9 +760,6 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW GtkPizza *pizza = GTK_PIZZA (widget); - if (!win->m_queuedFullRedraw) - { - if (!(GTK_WIDGET_APP_PAINTABLE (widget)) && (pizza->clear_on_draw)) { @@ -777,7 +796,6 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW gtk_widget_draw (child->widget, &child_area /* (GdkRectangle*) NULL*/ ); } } - } } //----------------------------------------------------------------------------- @@ -839,7 +857,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e ret = ancestor->GetEventHandler()->ProcessEvent( command_event ); break; } - if (ancestor->m_isFrame) + if (ancestor->IsTopLevel()) break; ancestor = ancestor->GetParent(); } @@ -871,7 +889,12 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e /* win is a control: tab can be propagated up */ if ( (!ret) && ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) && +// VZ: testing for wxTE_PROCESS_TAB shouldn't be done here the control may +// have this style, yet choose not to process this particular TAB in which +// case TAB must still work as a navigational character +#if 0 (!win->HasFlag(wxTE_PROCESS_TAB)) && +#endif // 0 (win->GetParent()) && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) ) { @@ -1494,6 +1517,15 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED( gdk_im_begin(win->m_ic, win->m_wxwindow->window); #endif +#ifdef wxUSE_CARET + // caret needs to be informed about focus change + wxCaret *caret = win->GetCaret(); + if ( caret ) + { + caret->OnSetFocus(); + } +#endif // wxUSE_CARET + wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() ); event.SetEventObject( win ); @@ -1525,6 +1557,10 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED // g_sendActivateEvent to -1 g_sendActivateEvent = 0; + wxWindow *winFocus = FindFocusedChild(win); + if ( winFocus ) + win = winFocus; + g_focusWindow = (wxWindow *)NULL; /* @@ -1539,6 +1575,15 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED gdk_im_end(); #endif +#ifdef wxUSE_CARET + // caret needs to be informed about focus change + wxCaret *caret = win->GetCaret(); + if ( caret ) + { + caret->OnKillFocus(); + } +#endif // wxUSE_CARET + wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); event.SetEventObject( win ); @@ -2062,10 +2107,12 @@ void wxWindow::Init() m_acceptsFocus = FALSE; m_clipPaintRegion = FALSE; - m_queuedFullRedraw = FALSE; m_cursor = *wxSTANDARD_CURSOR; + m_delayedForegroundColour = FALSE; + m_delayedBackgroundColour = FALSE; + #ifdef HAVE_XIM m_ic = (GdkIC*) NULL; m_icattr = (GdkICAttr*) NULL; @@ -2403,24 +2450,6 @@ bool wxWindow::Destroy() void wxWindow::DoMoveWindow(int x, int y, int width, int height) { - if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window) - { - /* Normally, GTK will send expose events only for the regions - which actually got exposed. Sadly, wxMSW invalidates - the whole window so we have to do that, too. We could - simply add a complete refresh, but we would then get - the normal GTK expose events in surplus, so we shut - off the expose events and schedule a full redraw to - be done in OnInternalIdle, where we restore the handling - of expose events. */ - - m_queuedFullRedraw = TRUE; - - GdkEventMask mask = gdk_window_get_events( GTK_PIZZA(m_wxwindow)->bin_window ); - mask = (GdkEventMask)(mask & ~GDK_EXPOSURE_MASK); - gdk_window_set_events( GTK_PIZZA(m_wxwindow)->bin_window, mask ); - } - gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), m_widget, x, y, width, height ); } @@ -2568,33 +2597,6 @@ void wxWindow::OnInternalIdle() } UpdateWindowUI(); - - if (m_queuedFullRedraw) - { - /* See also wxWindow::DoMoveWindow for explanation of this code. What - we test here is if the requested size of the window is the same as - the actual size of window, in which case all expose events that resulted - from resizing the window have been sent (and discarded) and we can - now do our full redraw and switch on expose event handling again. */ - - bool child_already_resized = FALSE; - if (m_isFrame) - child_already_resized = gtk_pizza_child_resized( GTK_PIZZA(m_wxwindow->parent), m_wxwindow ); - else - child_already_resized = gtk_pizza_child_resized( GTK_PIZZA(m_widget->parent), m_widget ); - - if (child_already_resized) - { - m_queuedFullRedraw = FALSE; - m_updateRegion.Clear(); - m_updateRegion.Union( 0,0,m_width,m_height ); - gtk_widget_draw( m_wxwindow, (GdkRectangle*) NULL ); - - GdkEventMask mask = gdk_window_get_events( GTK_PIZZA(m_wxwindow)->bin_window ); - mask = (GdkEventMask)(mask | GDK_EXPOSURE_MASK); - gdk_window_set_events( GTK_PIZZA(m_wxwindow)->bin_window, mask ); - } - } } void wxWindow::DoGetSize( int *width, int *height ) const @@ -2986,7 +2988,16 @@ bool wxWindow::SetCursor( const wxCursor &cursor ) { wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") ); - return wxWindowBase::SetCursor( cursor ); + if (cursor == m_cursor) + return FALSE; + + if (g_isIdle) + wxapp_install_idle_handler(); + + if (cursor == wxNullCursor) + return wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ); + else + return wxWindowBase::SetCursor( cursor ); } void wxWindow::WarpPointer( int x, int y ) @@ -3253,6 +3264,21 @@ void wxWindow::SetWidgetStyle() style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor(); } + else + { + // Try to restore the gtk default style. This is still a little + // oversimplified for what is probably really needed here for controls + // other than buttons, but is better than not being able to (re)set a + // control's foreground colour to *wxBLACK -- RL + GtkStyle *def = gtk_rc_get_style( m_widget ); + + if (!def) + def = gtk_widget_get_default_style(); + + style->fg[GTK_STATE_NORMAL] = def->fg[GTK_STATE_NORMAL]; + style->fg[GTK_STATE_PRELIGHT] = def->fg[GTK_STATE_PRELIGHT]; + style->fg[GTK_STATE_ACTIVE] = def->fg[GTK_STATE_ACTIVE]; + } } if (m_backgroundColour.Ok()) @@ -3268,7 +3294,29 @@ void wxWindow::SetWidgetStyle() style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor(); style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); - } + } + else + { + // Try to restore the gtk default style. This is still a little + // oversimplified for what is probably really needed here for controls + // other than buttons, but is better than not being able to (re)set a + // control's background colour to default grey and means resetting a + // button to wxSYS_COLOUR_BTNFACE will restore its usual highlighting + // behavior -- RL + GtkStyle *def = gtk_rc_get_style( m_widget ); + + if (!def) + def = gtk_widget_get_default_style(); + + style->bg[GTK_STATE_NORMAL] = def->bg[GTK_STATE_NORMAL]; + style->base[GTK_STATE_NORMAL] = def->base[GTK_STATE_NORMAL]; + style->bg[GTK_STATE_PRELIGHT] = def->bg[GTK_STATE_PRELIGHT]; + style->base[GTK_STATE_PRELIGHT] = def->base[GTK_STATE_PRELIGHT]; + style->bg[GTK_STATE_ACTIVE] = def->bg[GTK_STATE_ACTIVE]; + style->base[GTK_STATE_ACTIVE] = def->base[GTK_STATE_ACTIVE]; + style->bg[GTK_STATE_INSENSITIVE] = def->bg[GTK_STATE_INSENSITIVE]; + style->base[GTK_STATE_INSENSITIVE] = def->base[GTK_STATE_INSENSITIVE]; + } } } diff --git a/src/html/helpctrl.cpp b/src/html/helpctrl.cpp index af0ba923d8..c8287af50e 100644 --- a/src/html/helpctrl.cpp +++ b/src/html/helpctrl.cpp @@ -22,7 +22,7 @@ #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #include "wx/html/helpctrl.h" #include "wx/wx.h" @@ -30,12 +30,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxHelpControllerBase) -#if 0 -BEGIN_EVENT_TABLE(wxHtmlHelpController, wxEvtHandler) -EVT_CLOSE(wxHtmlHelpController::OnCloseFrame) -END_EVENT_TABLE() -#endif - wxHtmlHelpController::wxHtmlHelpController(int style) { m_helpFrame = NULL; @@ -47,7 +41,8 @@ wxHtmlHelpController::wxHtmlHelpController(int style) wxHtmlHelpController::~wxHtmlHelpController() { - WriteCustomization(m_Config, m_ConfigRoot); + if (m_Config) + WriteCustomization(m_Config, m_ConfigRoot); if (m_helpFrame) DestroyHelpWindow(); } @@ -121,7 +116,6 @@ void wxHtmlHelpController::CreateHelpWindow() m_helpFrame = CreateHelpFrame(&m_helpData); m_helpFrame->SetController(this); -// m_helpFrame->PushEventHandler(this); if (m_Config) m_helpFrame->UseConfig(m_Config, m_ConfigRoot); @@ -135,14 +129,14 @@ void wxHtmlHelpController::ReadCustomization(wxConfigBase* cfg, const wxString& { /* should not be called by the user; call UseConfig, and the controller * will do the rest */ - if (m_helpFrame) + if (m_helpFrame && cfg) m_helpFrame->ReadCustomization(cfg, path); } void wxHtmlHelpController::WriteCustomization(wxConfigBase* cfg, const wxString& path) { /* typically called by the controllers OnCloseFrame handler */ - if (m_helpFrame) + if (m_helpFrame && cfg) m_helpFrame->WriteCustomization(cfg, path); } diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index cb5eb0e862..e234941cb8 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -22,7 +22,7 @@ #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifndef WXPRECOMP #include "wx/wx.h" @@ -148,7 +148,122 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag) return TRUE; } else { // "PARAM" - if (m_Name == wxEmptyString && tag.GetParam(wxT("NAME")) == wxT("Name")) m_Name = tag.GetParam(wxT("VALUE")); + if (m_Name == wxEmptyString && tag.GetParam(wxT("NAME")) == wxT("Name")) + { + m_Name = tag.GetParam(wxT("VALUE")); + if (m_Name.Find(wxT('&')) != -1) + { + #define ESCSEQ(escape, subst) \ + { _T("&") _T(escape) _T(";"), _T("&") _T(escape) _T(" "), _T(subst) } + static wxChar* substitutions[][3] = + { + ESCSEQ("quot", "\""), + ESCSEQ("lt", "<"), + ESCSEQ("gt", ">"), + + ESCSEQ("nbsp", " "), + ESCSEQ("iexcl", "!"), + ESCSEQ("cent", "¢"), + + ESCSEQ("yen", " "), + ESCSEQ("brkbar", " "), + ESCSEQ("sect", " "), + ESCSEQ("uml", " "), + + ESCSEQ("copy", "(c)"), + ESCSEQ("ordf", " "), + ESCSEQ("laquo", " "), + ESCSEQ("not", " "), + + ESCSEQ("reg", "(r)"), + + ESCSEQ("deg", " "), + ESCSEQ("plusm", " "), + + ESCSEQ("acute", " "), + ESCSEQ("micro", " "), + ESCSEQ("para", " "), + + ESCSEQ("ordm", " "), + ESCSEQ("raquo", " "), + + ESCSEQ("iquest", " "), + ESCSEQ("Agrave", "À"), + + ESCSEQ("Acirc", "Â"), + ESCSEQ("Atilde", "Ã"), + ESCSEQ("Auml", "Ä"), + ESCSEQ("Aring", " "), + ESCSEQ("AElig", " "), + ESCSEQ("Ccedil", "ç"), + ESCSEQ("Egrave", "È"), + ESCSEQ("Eacute", "É"), + ESCSEQ("Ecirc", "Ê"), + ESCSEQ("Euml", "Ë"), + ESCSEQ("Igrave", "Ì"), + + ESCSEQ("Icirc", "Î"), + ESCSEQ("Iuml", "Ï"), + + ESCSEQ("Ntilde", "Ñ"), + ESCSEQ("Ograve", "Ò"), + + ESCSEQ("Ocirc", "Ô"), + ESCSEQ("Otilde", "Õ"), + ESCSEQ("Ouml", "Ö"), + + ESCSEQ("Oslash", " "), + ESCSEQ("Ugrave", "Ù"), + + ESCSEQ("Ucirc", " "), + ESCSEQ("Uuml", "Ü"), + + ESCSEQ("szlig", "§"), + ESCSEQ("agrave;","à"), + ESCSEQ("aacute", "á"), + ESCSEQ("acirc", "â"), + ESCSEQ("atilde", "ã"), + ESCSEQ("auml", "ä"), + ESCSEQ("aring", "a"), + ESCSEQ("aelig", "ae"), + ESCSEQ("ccedil", "ç"), + ESCSEQ("egrave", "è"), + ESCSEQ("eacute", "é"), + ESCSEQ("ecirc", "ê"), + ESCSEQ("euml", "ë"), + ESCSEQ("igrave", "ì"), + ESCSEQ("iacute", "í"), + ESCSEQ("icirc", " "), + ESCSEQ("iuml", "ï"), + ESCSEQ("eth", " "), + ESCSEQ("ntilde", "ñ"), + ESCSEQ("ograve", "ò"), + ESCSEQ("oacute", "ó"), + ESCSEQ("ocirc", "ô"), + ESCSEQ("otilde", "õ"), + ESCSEQ("ouml", "ö"), + ESCSEQ("divide", " "), + ESCSEQ("oslash", " "), + ESCSEQ("ugrave", "ù"), + ESCSEQ("uacute", "ú"), + ESCSEQ("ucirc", "û"), + ESCSEQ("uuml", "ü"), + + ESCSEQ("yuml", ""), + + /* this one should ALWAYS stay the last one!!! */ + ESCSEQ("amp", "&"), + + { NULL, NULL, NULL } + }; + + for (int i = 0; substitutions[i][0] != NULL; i++) + { + m_Name.Replace(substitutions[i][0], substitutions[i][2], TRUE); + m_Name.Replace(substitutions[i][1], substitutions[i][2], TRUE); + } + } + } if (tag.GetParam(wxT("NAME")) == wxT("Local")) m_Page = tag.GetParam(wxT("VALUE")); if (tag.GetParam(wxT("NAME")) == wxT("ID")) tag.ScanParam(wxT("VALUE"), wxT("%i"), &m_ID); return FALSE; @@ -235,7 +350,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c delete[] buf; } else - wxLogError(_("Cannot open contents file: %s"), contentsfile.mb_str()); + wxLogError(_("Cannot open contents file: %s"), contentsfile.c_str()); f = ( indexfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) ); if (f) { @@ -250,7 +365,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c delete[] buf; } else if (!indexfile.IsEmpty()) - wxLogError(_("Cannot open index file: %s"), indexfile.mb_str()); + wxLogError(_("Cannot open index file: %s"), indexfile.c_str()); return TRUE; } @@ -538,10 +653,10 @@ bool wxHtmlHelpData::AddBook(const wxString& book) fi = fsys.OpenFile(bookFull); if (fi == NULL) - { - wxLogError(_("Cannot open HTML help book: %s"), bookFull.mb_str()); - return FALSE; - } + { + wxLogError(_("Cannot open HTML help book: %s"), bookFull.c_str()); + return FALSE; + } fsys.ChangePathTo(bookFull); s = fi -> GetStream(); sz = s -> GetSize(); diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index b36d1c62e6..25052abfe8 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -23,7 +23,7 @@ #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifndef WXPRECOMP #include "wx/wx.h" #endif @@ -93,7 +93,7 @@ class wxHtmlHelpHashData : public wxObject wxHtmlHelpHashData(int index, wxTreeItemId id) : wxObject() { m_Index = index; m_Id = id;} ~wxHtmlHelpHashData() {} - + int m_Index; wxTreeItemId m_Id; }; @@ -114,7 +114,7 @@ class wxHtmlHelpHtmlWindow : public wxHtmlWindow m_Frame -> NotifyPageChanged(); } - private: + private: wxHtmlHelpFrame *m_Frame; }; @@ -178,7 +178,7 @@ void wxHtmlHelpFrame::Init(wxHtmlHelpData* data) m_NormalFonts = m_FixedFonts = NULL; m_NormalFace = m_FixedFace = wxEmptyString; m_FontSize = 1; - + #if wxUSE_PRINTING_ARCHITECTURE m_Printer = NULL; #endif @@ -216,8 +216,10 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti CreateStatusBar(); // toolbar? - if (style & wxHF_TOOLBAR) { - wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_DOCKABLE); + if (style & (wxHF_TOOLBAR | wxHF_FLATTOOLBAR)) { + wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | + wxTB_DOCKABLE | + (style & wxHF_FLATTOOLBAR ? wxTB_FLAT : 0)); toolBar->SetMargins( 2, 2 ); AddToolbarButtons(toolBar, style); toolBar -> Realize(); @@ -433,7 +435,7 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti m_SearchPage = notebook_page++; } m_HtmlWin -> Show(TRUE); - + RefreshLists(); // showtime @@ -471,46 +473,64 @@ wxHtmlHelpFrame::~wxHtmlHelpFrame() void wxHtmlHelpFrame::AddToolbarButtons(wxToolBar *toolBar, int style) { - toolBar -> AddTool(wxID_HTML_PANEL, wxBITMAP(wpanel), wxNullBitmap, + wxBitmap wpanelBitmap = wxBITMAP(wpanel); + wxBitmap wbackBitmap = wxBITMAP(wback); + wxBitmap wforwardBitmap = wxBITMAP(wforward); + wxBitmap wupnodeBitmap = wxBITMAP(wupnode); + wxBitmap wupBitmap = wxBITMAP(wup); + wxBitmap wdownBitmap = wxBITMAP(wdown); + wxBitmap wopenBitmap = wxBITMAP(wopen); + wxBitmap wprintBitmap = wxBITMAP(wprint); + wxBitmap woptionsBitmap = wxBITMAP(woptions); + + wxASSERT_MSG( (wpanelBitmap.Ok() && wbackBitmap.Ok() && + wforwardBitmap.Ok() && wupnodeBitmap.Ok() && + wupBitmap.Ok() && wdownBitmap.Ok() && + wopenBitmap.Ok() && wprintBitmap.Ok() && + woptionsBitmap.Ok()), + wxT("One or more HTML help frame toolbar bitmap could not be loaded.")) ; + + + toolBar -> AddTool(wxID_HTML_PANEL, wpanelBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Show/hide navigation panel")); toolBar -> AddSeparator(); - toolBar -> AddTool(wxID_HTML_BACK, wxBITMAP(wback), wxNullBitmap, + toolBar -> AddTool(wxID_HTML_BACK, wbackBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Go back")); - toolBar -> AddTool(wxID_HTML_FORWARD, wxBITMAP(wforward), wxNullBitmap, + toolBar -> AddTool(wxID_HTML_FORWARD, wforwardBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Go forward")); toolBar -> AddSeparator(); - toolBar -> AddTool(wxID_HTML_UPNODE, wxBITMAP(wupnode), wxNullBitmap, + toolBar -> AddTool(wxID_HTML_UPNODE, wupnodeBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Go one level up in document hierarchy")); - toolBar -> AddTool(wxID_HTML_UP, wxBITMAP(wup), wxNullBitmap, + toolBar -> AddTool(wxID_HTML_UP, wupBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Previous page")); - toolBar -> AddTool(wxID_HTML_DOWN, wxBITMAP(wdown), wxNullBitmap, + toolBar -> AddTool(wxID_HTML_DOWN, wdownBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Next page")); if ((style & wxHF_PRINT) || (style & wxHF_OPENFILES)) toolBar -> AddSeparator(); - + if (style & wxHF_OPENFILES) - toolBar -> AddTool(wxID_HTML_OPENFILE, wxBITMAP(wopen), wxNullBitmap, + toolBar -> AddTool(wxID_HTML_OPENFILE, wopenBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Open HTML document")); #if wxUSE_PRINTING_ARCHITECTURE if (style & wxHF_PRINT) - toolBar -> AddTool(wxID_HTML_PRINT, wxBITMAP(wprint), wxNullBitmap, + toolBar -> AddTool(wxID_HTML_PRINT, wprintBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Print this page")); #endif toolBar -> AddSeparator(); - toolBar -> AddTool(wxID_HTML_OPTIONS, wxBITMAP(woptions), wxNullBitmap, + toolBar -> AddTool(wxID_HTML_OPTIONS, woptionsBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Display options dialog")); } @@ -601,8 +621,8 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword) if (m_SearchChoice->GetSelection() != 0) book = m_SearchChoice->GetStringSelection(); - wxHtmlSearchStatus status(m_Data, keyword, - m_SearchCaseSensitive -> GetValue(), m_SearchWholeWords -> GetValue(), + wxHtmlSearchStatus status(m_Data, keyword, + m_SearchCaseSensitive -> GetValue(), m_SearchWholeWords -> GetValue(), book); wxProgressDialog progress(_("Searching..."), _("No matching page found yet"), @@ -625,7 +645,7 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword) m_SearchText -> SetFocus(); if (foundcnt) { wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(0); - if (it) + if (it) { m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); NotifyPageChanged(); @@ -642,7 +662,7 @@ void wxHtmlHelpFrame::CreateContents() return ; m_ContentsBox->Clear(); - + if (m_PagesHash) delete m_PagesHash; m_PagesHash = new wxHashTable(wxKEY_STRING, 2 * m_Data -> GetContentsCnt()); m_PagesHash -> DeleteContents(TRUE); @@ -665,7 +685,7 @@ void wxHtmlHelpFrame::CreateContents() roots[it -> m_Level + 1] = m_ContentsBox -> AppendItem( roots[it -> m_Level], it -> m_Name, IMG_Page, -1, new wxHtmlHelpTreeItemData(i)); - m_PagesHash -> Put(it -> m_Book -> GetBasePath() + it -> m_Page, + m_PagesHash -> Put(it -> m_Book -> GetBasePath() + it -> m_Page, new wxHtmlHelpHashData(i, roots[it -> m_Level + 1])); if (it -> m_Level == 0) { @@ -693,16 +713,16 @@ void wxHtmlHelpFrame::CreateIndex() m_IndexList->Clear(); int cnt = m_Data->GetIndexCnt(); - + wxString cnttext; if (cnt > INDEX_IS_SMALL) cnttext.Printf(_("%i of %i"), 0, cnt); else cnttext.Printf(_("%i of %i"), cnt, cnt); m_IndexCountInfo -> SetLabel(cnttext); if (cnt > INDEX_IS_SMALL) return; - + wxHtmlContentsItem* index = m_Data->GetIndex(); - for (int i = 0; i < cnt; i++) + for (int i = 0; i < cnt; i++) m_IndexList -> Append(index[i].m_Name, (char*)(index + i)); } @@ -753,7 +773,7 @@ void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path) int i; int cnt; wxString val, s; - + cnt = cfg -> Read(wxT("hcBookmarksCnt"), 0L); if (cnt != 0) { m_BookmarksNames.Clear(); @@ -762,7 +782,7 @@ void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path) m_Bookmarks -> Clear(); m_Bookmarks -> Append(_("(bookmarks)")); } - + for (i = 0; i < cnt; i++) { val.Printf(wxT("hcBookmark_%i"), i); s = cfg -> Read(val); @@ -801,12 +821,12 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path cfg -> Write(wxT("hcFixedFace"), m_FixedFace); cfg -> Write(wxT("hcNormalFace"), m_NormalFace); cfg -> Write(wxT("hcFontSize"), (long)m_FontSize); - + if (m_Bookmarks) { int i; int cnt = m_BookmarksNames.GetCount(); wxString val; - + cfg -> Write(wxT("hcBookmarksCnt"), (long)cnt); for (i = 0; i < cnt; i++) { val.Printf(wxT("hcBookmark_%i"), i); @@ -829,7 +849,7 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path static void SetFontsToHtmlWin(wxHtmlWindow *win, wxString scalf, wxString fixf, int size) { - static int f_sizes[5][7] = + static int f_sizes[5][7] = { { 6, 7, 9, 12, 14, 16, 19}, { 8, 9, 12, 14, 16, 19, 22}, @@ -859,30 +879,30 @@ class wxHtmlHelpFrameOptionsDialog : public wxDialog sizer = new wxBoxSizer(wxHORIZONTAL); sizer2 = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Normal font:")), wxVERTICAL); - sizer2 -> Add(NormalFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, - wxSize(200, 200), + sizer2 -> Add(NormalFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, + wxSize(200, 200), 0, NULL, wxCB_DROPDOWN | wxCB_READONLY), 1, wxEXPAND | wxLEFT | wxRIGHT, 10); sizer -> Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); sizer2 = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Fixed font:")), wxVERTICAL); - sizer2 -> Add(FixedFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, - wxSize(200, 200), - 0, NULL, wxCB_DROPDOWN | wxCB_READONLY), + sizer2 -> Add(FixedFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, + wxSize(200, 200), + 0, NULL, wxCB_DROPDOWN | wxCB_READONLY), 1, wxEXPAND | wxLEFT | wxRIGHT, 10); sizer -> Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); topsizer -> Add(sizer); - topsizer -> Add(RadioBox = new wxRadioBox(this, -1, _("Font size:"), - wxDefaultPosition, wxDefaultSize, 5, choices, 5), + topsizer -> Add(RadioBox = new wxRadioBox(this, -1, _("Font size:"), + wxDefaultPosition, wxDefaultSize, 5, choices, 5), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); - - topsizer -> Add(new wxStaticText(this, -1, _("Preview:")), + + topsizer -> Add(new wxStaticText(this, -1, _("Preview:")), 0, wxLEFT | wxTOP, 10); - topsizer -> Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150)), + topsizer -> Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150)), 1, wxEXPAND | wxLEFT|wxTOP|wxRIGHT, 10); sizer = new wxBoxSizer(wxHORIZONTAL); @@ -895,36 +915,38 @@ class wxHtmlHelpFrameOptionsDialog : public wxDialog topsizer -> Fit(this); Centre(wxBOTH); } - + void UpdateTestWin() { wxBusyCursor bcur; - SetFontsToHtmlWin(TestWin, + SetFontsToHtmlWin(TestWin, NormalFont -> GetStringSelection(), FixedFont -> GetStringSelection(), RadioBox -> GetSelection()); - TestWin -> SetPage(_("<html><body>" - "Normal face<br>(and <u>underlined</u>. <i>Italic face.</i> " - "<b>Bold face.</b> <b><i>Bold italic face.</i></b><br>" - "<font size=-2>font size -2</font><br>" - "<font size=-1>font size -1</font><br>" - "<font size=+0>font size +0</font><br>" - "<font size=+1>font size +1</font><br>" - "<font size=+2>font size +2</font><br>" - "<font size=+3>font size +3</font><br>" - "<font size=+4>font size +4</font><br>" - - "<p><tt>Fixed size face.<br> <b>bold</b> <i>italic</i> " - "<b><i>bold italic <u>underlined</u></i></b><br>" - "<font size=-2>font size -2</font><br>" - "<font size=-1>font size -1</font><br>" - "<font size=+0>font size +0</font><br>" - "<font size=+1>font size +1</font><br>" - "<font size=+2>font size +2</font><br>" - "<font size=+3>font size +3</font><br>" - "<font size=+4>font size +4</font></tt>" - "</body></html>")); + TestWin -> SetPage(_( +"<html><body>\ +Normal face<br>(and <u>underlined</u>. <i>Italic face.</i> \ +<b>Bold face.</b> <b><i>Bold italic face.</i></b><br>\ +<font size=-2>font size -2</font><br>\ +<font size=-1>font size -1</font><br>\ +<font size=+0>font size +0</font><br>\ +<font size=+1>font size +1</font><br>\ +<font size=+2>font size +2</font><br>\ +<font size=+3>font size +3</font><br>\ +<font size=+4>font size +4</font><br>\ +\ +<p><tt>Fixed size face.<br> <b>bold</b> <i>italic</i> \ +<b><i>bold italic <u>underlined</u></i></b><br>\ +<font size=-2>font size -2</font><br>\ +<font size=-1>font size -1</font><br>\ +<font size=+0>font size +0</font><br>\ +<font size=+1>font size +1</font><br>\ +<font size=+2>font size +2</font><br>\ +<font size=+3>font size +3</font><br>\ +<font size=+4>font size +4</font></tt>\ +</body></html>" + )); } void OnUpdate(wxCommandEvent& event) @@ -945,7 +967,7 @@ void wxHtmlHelpFrame::OptionsDialog() { wxHtmlHelpFrameOptionsDialog dlg(this); unsigned i; - + if (m_NormalFonts == NULL) { wxFontEnumerator enu; enu.EnumerateFacenames(); @@ -960,7 +982,7 @@ void wxHtmlHelpFrame::OptionsDialog() *m_FixedFonts = *enu.GetFacenames(); m_FixedFonts -> Sort(); } - + for (i = 0; i < m_NormalFonts -> GetCount(); i++) dlg.NormalFont -> Append((*m_NormalFonts)[i]); for (i = 0; i < m_FixedFonts -> GetCount(); i++) @@ -971,7 +993,7 @@ void wxHtmlHelpFrame::OptionsDialog() else dlg.FixedFont -> SetSelection(0); dlg.RadioBox -> SetSelection(m_FontSize); dlg.UpdateTestWin(); - + if (dlg.ShowModal() == wxID_OK) { m_NormalFace = dlg.NormalFont -> GetStringSelection(); m_FixedFace = dlg.FixedFont -> GetStringSelection(); @@ -1023,9 +1045,9 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) m_HtmlWin -> HistoryForward(); NotifyPageChanged(); break; - - case wxID_HTML_UP : - if (m_PagesHash) + + case wxID_HTML_UP : + if (m_PagesHash) { wxString an = m_HtmlWin -> GetOpenedAnchor(); wxHtmlHelpHashData *ha; @@ -1042,8 +1064,8 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) } break; - case wxID_HTML_UPNODE : - if (m_PagesHash) + case wxID_HTML_UPNODE : + if (m_PagesHash) { wxString an = m_HtmlWin -> GetOpenedAnchor(); wxHtmlHelpHashData *ha; @@ -1056,7 +1078,7 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) int level = m_Data -> GetContents()[ha -> m_Index].m_Level - 1; wxHtmlContentsItem *it; int ind = ha -> m_Index - 1; - + it = m_Data -> GetContents() + ind; while (ind >= 0 && it -> m_Level != level) ind--, it--; if (ind >= 0) @@ -1068,13 +1090,13 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) } break; - case wxID_HTML_DOWN : - if (m_PagesHash) + case wxID_HTML_DOWN : + if (m_PagesHash) { wxString an = m_HtmlWin -> GetOpenedAnchor(); wxString adr; wxHtmlHelpHashData *ha; - + if (an.IsEmpty()) adr = m_HtmlWin -> GetOpenedPage(); else adr = m_HtmlWin -> GetOpenedPage() + wxT("#") + an; @@ -1083,7 +1105,7 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) if (ha && ha -> m_Index < m_Data -> GetContentsCnt() - 1) { wxHtmlContentsItem *it = m_Data -> GetContents() + (ha -> m_Index + 1); - + while (it -> m_Book -> GetBasePath() + it -> m_Page == adr) it++; m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); NotifyPageChanged(); @@ -1111,12 +1133,12 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) case wxID_HTML_OPTIONS : OptionsDialog(); break; - - case wxID_HTML_BOOKMARKSADD : + + case wxID_HTML_BOOKMARKSADD : { wxString item; wxString url; - + item = m_HtmlWin -> GetOpenedPageTitle(); url = m_HtmlWin -> GetOpenedPage(); if (item == wxEmptyString) item = url.AfterLast(wxT('/')); @@ -1127,12 +1149,12 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) } } break; - - case wxID_HTML_BOOKMARKSREMOVE : + + case wxID_HTML_BOOKMARKSREMOVE : { wxString item; int pos; - + item = m_Bookmarks -> GetStringSelection(); pos = m_BookmarksNames.Index(item); if (pos != wxNOT_FOUND) { @@ -1146,7 +1168,7 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) #if wxUSE_PRINTING_ARCHITECTURE case wxID_HTML_PRINT : { - if (m_Printer == NULL) + if (m_Printer == NULL) m_Printer = new wxHtmlEasyPrinting(_("Help Printing"), this); if (!m_HtmlWin -> GetOpenedPage()) wxLogWarning(_("Cannot print empty page.")); @@ -1158,12 +1180,18 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) case wxID_HTML_OPENFILE : { - wxString s = wxFileSelector(_("Open HTML document"), wxEmptyString, wxEmptyString, wxEmptyString, - wxT("HTML files (*.htm)|*.htm|HTML files (*.html)|*.html|" - "Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|" - "HTML Help Project (*.hhp)|*.hhp|" - "All files (*.*)|*"), - wxOPEN | wxFILE_MUST_EXIST, this); + wxString s = wxFileSelector(_("Open HTML document"), + wxEmptyString, + wxEmptyString, + wxEmptyString, + _( +"HTML files (*.htm)|*.htm|HTML files (*.html)|*.html|\ +Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|\ +HTML Help Project (*.hhp)|*.hhp|\ +All files (*.*)|*" + ), + wxOPEN | wxFILE_MUST_EXIST, + this); if (!s.IsEmpty()) { wxString ext = s.Right(4).Lower(); @@ -1189,8 +1217,8 @@ void wxHtmlHelpFrame::OnContentsSel(wxTreeEvent& event) wxHtmlContentsItem *it; pg = (wxHtmlHelpTreeItemData*) m_ContentsBox -> GetItemData(event.GetItem()); - - if (pg && m_UpdateContents) + + if (pg && m_UpdateContents) { it = m_Data -> GetContents() + (pg -> m_Id); m_UpdateContents = FALSE; @@ -1213,7 +1241,7 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) { wxString sr = m_IndexText -> GetLineText(0); sr.MakeLower(); - if (sr == wxEmptyString) + if (sr == wxEmptyString) OnIndexAll(event); else { @@ -1221,7 +1249,7 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) const wxChar *cstr = sr.c_str(); wxChar mybuff[512], *ptr; bool first = TRUE; - + m_IndexList->Clear(); int cnt = m_Data->GetIndexCnt(); wxHtmlContentsItem* index = m_Data->GetIndex(); @@ -1230,9 +1258,10 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) for (int i = 0; i < cnt; i++) { wxStrncpy(mybuff, index[i].m_Name, 512); - mybuff[511] = 0; - for (ptr = mybuff; *ptr != 0; ptr++) - if (*ptr >= 'A' && *ptr <= 'Z') *ptr -= 'A' - 'a'; + mybuff[511] = _T('\0'); + for (ptr = mybuff; *ptr != 0; ptr++) + if (*ptr >= _T('A') && *ptr <= _T('Z')) + *ptr -= (wxChar)(_T('A') - _T('a')); if (wxStrstr(mybuff, cstr) != NULL) { m_IndexList -> Append(index[i].m_Name, (char*)(index + i)); displ++; @@ -1256,7 +1285,7 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event)) { wxBusyCursor bcur; - + m_IndexList->Clear(); int cnt = m_Data->GetIndexCnt(); bool first = TRUE; @@ -1280,7 +1309,7 @@ void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event)) void wxHtmlHelpFrame::OnSearchSel(wxCommandEvent& WXUNUSED(event)) { wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(m_SearchList -> GetSelection()); - if (it) + if (it) { m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); NotifyPageChanged(); @@ -1336,7 +1365,7 @@ BEGIN_EVENT_TABLE(wxHtmlHelpFrame, wxFrame) EVT_TEXT_ENTER(wxID_HTML_INDEXTEXT, wxHtmlHelpFrame::OnIndexFind) EVT_BUTTON(wxID_HTML_INDEXBUTTONALL, wxHtmlHelpFrame::OnIndexAll) EVT_COMBOBOX(wxID_HTML_BOOKMARKSLIST, wxHtmlHelpFrame::OnBookmarksSel) - EVT_CLOSE(wxHtmlHelpFrame::OnCloseWindow) + EVT_CLOSE(wxHtmlHelpFrame::OnCloseWindow) END_EVENT_TABLE() #endif diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index 0ca4bb2524..820fdd9cc0 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -14,7 +14,8 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML + +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop @@ -132,7 +133,7 @@ wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell() if (m_Word.Find(wxT('&')) != -1) { #define ESCSEQ(escape, subst) \ - { wxT("&"escape";"), wxT("&"escape" "), wxT(subst) } + { _T("&") _T(escape) _T(";"), _T("&") _T(escape) _T(" "), _T(subst) } static wxChar* substitutions[][3] = { ESCSEQ("quot", "\""), diff --git a/src/html/htmlfilt.cpp b/src/html/htmlfilt.cpp index 95f90552d1..639ea7272a 100644 --- a/src/html/htmlfilt.cpp +++ b/src/html/htmlfilt.cpp @@ -15,7 +15,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop @@ -143,7 +143,7 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const if (s == NULL) { - wxLogError(_("Cannot open HTML document: %s"), file.GetLocation().mb_str()); + wxLogError(_("Cannot open HTML document: %s"), file.GetLocation().c_str()); return wxEmptyString; } src = new char[s -> GetSize() + 1]; diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 4cec1c5cd1..7986e96101 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -15,7 +15,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop diff --git a/src/html/htmltag.cpp b/src/html/htmltag.cpp index 454ccafcaf..1cb4774643 100644 --- a/src/html/htmltag.cpp +++ b/src/html/htmltag.cpp @@ -59,7 +59,9 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source) tg = m_CacheSize++; m_Cache[tg].Key = stpos = pos++; dummy[0] = 0; i = 0; - while ((src[pos] != wxT('>')) && (src[pos] != wxT(' '))) { + while (src[pos] != wxT('>') && + src[pos] != wxT(' ') && src[pos] != wxT('\r') && + src[pos] != wxT('\n') && src[pos] != wxT('\t')) { dummy[i] = src[pos++]; if ((dummy[i] >= wxT('a')) && (dummy[i] <= wxT('z'))) dummy[i] -= (wxT('a') - wxT('A')); i++; @@ -128,7 +130,9 @@ wxHtmlTag::wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCac if (source[i] == '/') {m_Ending = TRUE; i++;} else m_Ending = FALSE; - while ((i < end_pos) && ((c = source[i++]) != ' ') && (c != '>')) { + while ((i < end_pos) && + ((c = source[i++]) != ' ' && c != '\r' && c != '\n' && c != '\t' && + c != '>')) { if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A'); m_Name += c; } @@ -136,6 +140,7 @@ wxHtmlTag::wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCac if (source[i-1] != '>') while ((i < end_pos) && ((c = source[i++]) != '>')) { if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A'); + if (c == '\r' || c == '\n' || c == '\t') c = ' '; // make future parsing a bit simpler m_Params += c; if (c == '"') { while ((i < end_pos) && ((c = source[i++]) != '"')) m_Params += c; diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index e8f244474f..e3663cf9be 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -15,7 +15,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop @@ -41,7 +41,7 @@ WX_DEFINE_OBJARRAY(HtmlHistoryArray) wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxString& name) : wxScrolledWindow(parent, id, pos, size, wxVSCROLL | wxHSCROLL, name) + long style, const wxString& name) : wxScrolledWindow(parent, id, pos, size, style | wxVSCROLL | wxHSCROLL, name) { m_tmpMouseMoved = FALSE; m_tmpLastLink = NULL; @@ -172,7 +172,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location) if (f == NULL) { wxString err; - wxLogError(_("Unable to open requested HTML document: %s"), location.mb_str()); + wxLogError(_("Unable to open requested HTML document: %s"), location.c_str()); m_tmpCanDrawLocks--; SetCursor(*wxSTANDARD_CURSOR); @@ -248,7 +248,7 @@ bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor) const wxHtmlCell *c = m_Cell -> Find(wxHTML_COND_ISANCHOR, &anchor); if (!c) { - wxLogWarning(_("HTML anchor %s does not exist."), anchor.mb_str()); + wxLogWarning(_("HTML anchor %s does not exist."), anchor.c_str()); return FALSE; } else { @@ -282,7 +282,7 @@ void wxHtmlWindow::CreateLayout() if (!m_Cell) return; - if (m_Style == wxHW_SCROLLBAR_NEVER) { + if (m_Style & wxHW_SCROLLBAR_NEVER) { SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell -> GetWidth() / wxHTML_SCROLL_STEP, 0); // always off GetClientSize(&ClientWidth, &ClientHeight); m_Cell -> Layout(ClientWidth); @@ -483,6 +483,7 @@ void wxHtmlWindow::OnSize(wxSizeEvent& event) { wxScrolledWindow::OnSize(event); CreateLayout(); + Refresh(); } diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index ed299f645d..82f3e09fce 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -26,7 +26,7 @@ #include "wx/wx.h" #endif -#if wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE +#if wxUSE_HTML && wxUSE_PRINTING_ARCHITECTURE && wxUSE_STREAMS #include "wx/print.h" #include "wx/printdlg.h" @@ -436,54 +436,54 @@ wxHtmlEasyPrinting::~wxHtmlEasyPrinting() -void wxHtmlEasyPrinting::PreviewFile(const wxString &htmlfile) +bool wxHtmlEasyPrinting::PreviewFile(const wxString &htmlfile) { wxHtmlPrintout *p1 = CreatePrintout(); p1 -> SetHtmlFile(htmlfile); wxHtmlPrintout *p2 = CreatePrintout(); p2 -> SetHtmlFile(htmlfile); - DoPreview(p1, p2); + return DoPreview(p1, p2); } -void wxHtmlEasyPrinting::PreviewText(const wxString &htmltext, const wxString &basepath) +bool wxHtmlEasyPrinting::PreviewText(const wxString &htmltext, const wxString &basepath) { wxHtmlPrintout *p1 = CreatePrintout(); p1 -> SetHtmlText(htmltext, basepath, TRUE); wxHtmlPrintout *p2 = CreatePrintout(); p2 -> SetHtmlText(htmltext, basepath, TRUE); - DoPreview(p1, p2); + return DoPreview(p1, p2); } -void wxHtmlEasyPrinting::PrintFile(const wxString &htmlfile) +bool wxHtmlEasyPrinting::PrintFile(const wxString &htmlfile) { wxHtmlPrintout *p = CreatePrintout(); p -> SetHtmlFile(htmlfile); - DoPrint(p); + return DoPrint(p); } -void wxHtmlEasyPrinting::PrintText(const wxString &htmltext, const wxString &basepath) +bool wxHtmlEasyPrinting::PrintText(const wxString &htmltext, const wxString &basepath) { wxHtmlPrintout *p = CreatePrintout(); p -> SetHtmlText(htmltext, basepath, TRUE); - DoPrint(p); + return DoPrint(p); } -void wxHtmlEasyPrinting::DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2) +bool wxHtmlEasyPrinting::DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2) { // Pass two printout objects: for preview, and possible printing. wxPrintDialogData printDialogData(*m_PrintData); wxPrintPreview *preview = new wxPrintPreview(printout1, printout2, &printDialogData); if (!preview -> Ok()) { delete preview; - wxMessageBox(_("There was a problem previewing.\nPerhaps your current printer is not set correctly?"), _("Previewing"), wxOK); + return FALSE; } else { @@ -493,20 +493,26 @@ void wxHtmlEasyPrinting::DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *pr frame -> Centre(wxBOTH); frame -> Initialize(); frame -> Show(TRUE); + return TRUE; } } -void wxHtmlEasyPrinting::DoPrint(wxHtmlPrintout *printout) +bool wxHtmlEasyPrinting::DoPrint(wxHtmlPrintout *printout) { wxPrintDialogData printDialogData(*m_PrintData); wxPrinter printer(&printDialogData); if (!printer.Print(m_Frame, printout, TRUE)) - wxMessageBox(_("There was a problem printing.\nPerhaps your current printer is not set correctly?"), _("Printing"), wxOK); + { + return FALSE; + } else + { (*m_PrintData) = printer.GetPrintDialogData().GetPrintData(); + return TRUE; + } } diff --git a/src/html/m_dflist.cpp b/src/html/m_dflist.cpp index fd13d8040a..3625e1adfb 100644 --- a/src/html/m_dflist.cpp +++ b/src/html/m_dflist.cpp @@ -15,7 +15,7 @@ #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop diff --git a/src/html/m_fonts.cpp b/src/html/m_fonts.cpp index 161cbd450c..4f7471622e 100644 --- a/src/html/m_fonts.cpp +++ b/src/html/m_fonts.cpp @@ -14,7 +14,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop diff --git a/src/html/m_hline.cpp b/src/html/m_hline.cpp index fdb5a1fa48..ba68587175 100644 --- a/src/html/m_hline.cpp +++ b/src/html/m_hline.cpp @@ -15,7 +15,7 @@ #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop #endif diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp index 06a78d6b82..09396542cb 100644 --- a/src/html/m_image.cpp +++ b/src/html/m_image.cpp @@ -14,7 +14,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop diff --git a/src/html/m_layout.cpp b/src/html/m_layout.cpp index df2615cf1d..08157beaba 100644 --- a/src/html/m_layout.cpp +++ b/src/html/m_layout.cpp @@ -14,7 +14,7 @@ #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop #endif diff --git a/src/html/m_links.cpp b/src/html/m_links.cpp index a20252dfd1..e21c9e2f69 100644 --- a/src/html/m_links.cpp +++ b/src/html/m_links.cpp @@ -14,7 +14,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop diff --git a/src/html/m_list.cpp b/src/html/m_list.cpp index 58425f35c2..3e4b9023e3 100644 --- a/src/html/m_list.cpp +++ b/src/html/m_list.cpp @@ -14,7 +14,7 @@ #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop diff --git a/src/html/m_meta.cpp b/src/html/m_meta.cpp index 7c0c379b88..bcb95e5840 100644 --- a/src/html/m_meta.cpp +++ b/src/html/m_meta.cpp @@ -15,7 +15,7 @@ #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop diff --git a/src/html/m_pre.cpp b/src/html/m_pre.cpp index b7f283a224..df51c4246a 100644 --- a/src/html/m_pre.cpp +++ b/src/html/m_pre.cpp @@ -14,7 +14,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop #endif diff --git a/src/html/m_tables.cpp b/src/html/m_tables.cpp index 24a2d5c151..a651ba407d 100644 --- a/src/html/m_tables.cpp +++ b/src/html/m_tables.cpp @@ -14,7 +14,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop #endif diff --git a/src/html/winpars.cpp b/src/html/winpars.cpp index f358cf14c5..ca7afc5fd5 100644 --- a/src/html/winpars.cpp +++ b/src/html/winpars.cpp @@ -15,7 +15,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop @@ -103,6 +103,13 @@ void wxHtmlWinParser::AddModule(wxHtmlTagsModule *module) +void wxHtmlWinParser::RemoveModule(wxHtmlTagsModule *module) +{ + m_Modules.DeleteObject(module); +} + + + void wxHtmlWinParser::SetFonts(wxString normal_face, wxString fixed_face, const int *sizes) { int i, j, k, l, m; @@ -355,7 +362,7 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc) wxCONVERT_SUBSTITUTE)) { // total failture :-( wxLogError(_("Failed to display HTML document in %s encoding"), - wxFontMapper::GetEncodingName(enc).mb_str()); + wxFontMapper::GetEncodingName(enc).c_str()); m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT; delete m_EncConv; m_EncConv = NULL; @@ -392,6 +399,7 @@ bool wxHtmlTagsModule::OnInit() void wxHtmlTagsModule::OnExit() { + wxHtmlWinParser::RemoveModule(this); } #endif diff --git a/src/jpeg/jpeg.dsp b/src/jpeg/JpegVC.dsp similarity index 100% rename from src/jpeg/jpeg.dsp rename to src/jpeg/JpegVC.dsp diff --git a/src/jpeg/jpeg.dsw b/src/jpeg/JpegVC.dsw similarity index 90% rename from src/jpeg/jpeg.dsw rename to src/jpeg/JpegVC.dsw index eb703255ee..31caaf9876 100644 --- a/src/jpeg/jpeg.dsw +++ b/src/jpeg/JpegVC.dsw @@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### -Project: "jpeg"=.\jpeg.dsp - Package Owner=<4> +Project: "jpeg"=.\JpegVC.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/src/jpeg/jconfig.h b/src/jpeg/jconfig.h index e3c94a1717..42d94427c6 100644 --- a/src/jpeg/jconfig.h +++ b/src/jpeg/jconfig.h @@ -56,6 +56,8 @@ /* #define INLINE __inline__ */ #if defined(__VISAGECPP__) && (__IBMCPP__ >= 400 || __IBMC__ >= 400) #define INLINE +#elif defined(__WATCOMC__) +#define INLINE #else #define INLINE inline #endif diff --git a/src/jpeg/makefile.wat b/src/jpeg/makefile.wat index d953e466f8..d1f309c5b3 100644 --- a/src/jpeg/makefile.wat +++ b/src/jpeg/makefile.wat @@ -1,41 +1,22 @@ -# Makefile for Independent JPEG Group's software +#!/binb/wmake.exe +# +# File: makefile.wat +# Author: Julian Smart +# Created: 1998 +# +# Makefile : Builds JPEG library for Watcom C++, WIN32 -# This makefile is suitable for Watcom C/C++ 10.0 on MS-DOS (using -# dos4g extender), OS/2, and Windows NT console mode. -# Thanks to Janos Haide, jhaide@btrvtech.com. +WXDIR = ..\.. +EXTRACPPFLAGS=-i=..\zlib -# Read installation instructions before saying "wmake" !! +!include $(WXDIR)\src\makewat.env -# Uncomment line for desired system -SYSTEM=DOS -#SYSTEM=OS2 -#SYSTEM=NT +WXLIB = $(WXDIR)\lib -# The name of your C compiler: -CC= wcl386 +LIBTARGET = $(WXLIB)\jpeg.lib -# You may need to adjust these cc options: -CFLAGS= -4r -ort -wx -zq -bt=$(SYSTEM) -# Caution: avoid -ol or -ox; these generate bad code with 10.0 or 10.0a. -# Generally, we recommend defining any configuration symbols in jconfig.h, -# NOT via -D switches here. - -# Link-time cc options: -!ifeq SYSTEM DOS -LDFLAGS= -zq -l=dos4g -!else ifeq SYSTEM OS2 -LDFLAGS= -zq -l=os2v2 -!else ifeq SYSTEM NT -LDFLAGS= -zq -l=nt -!endif - -# Put here the object file name for the correct system-dependent memory -# manager file. jmemnobs should work fine for dos4g or OS/2 environment. SYSDEPMEM= jmemnobs.obj -# End of configurable options. - - # source files: JPEG library proper LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c & jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c & @@ -87,147 +68,26 @@ DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj & jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj & jquant1.obj jquant2.obj jdmerge.obj # These objectfiles are included in libjpeg.lib -LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) +OBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) # object files for sample applications (excluding library files) COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj & rdswitch.obj cdjpeg.obj DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj & rdcolmap.obj cdjpeg.obj TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj +all: $(OBJECTS) $(LIBTARGET) +$(LIBTARGET) : $(OBJECTS) + %create tmp.lbc + @for %i in ( $(OBJECTS) ) do @%append tmp.lbc +%i + wlib /b /c /n /p=512 $^@ @tmp.lbc -all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe - -libjpeg.lib: $(LIBOBJECTS) - - del libjpeg.lib - * wlib -n libjpeg.lib $(LIBOBJECTS) - -cjpeg.exe: $(COBJECTS) libjpeg.lib - $(CC) $(LDFLAGS) $(COBJECTS) libjpeg.lib - -djpeg.exe: $(DOBJECTS) libjpeg.lib - $(CC) $(LDFLAGS) $(DOBJECTS) libjpeg.lib - -jpegtran.exe: $(TROBJECTS) libjpeg.lib - $(CC) $(LDFLAGS) $(TROBJECTS) libjpeg.lib - -rdjpgcom.exe: rdjpgcom.c - $(CC) $(CFLAGS) $(LDFLAGS) rdjpgcom.c - -wrjpgcom.exe: wrjpgcom.c - $(CC) $(CFLAGS) $(LDFLAGS) wrjpgcom.c - -.c.obj: - $(CC) $(CFLAGS) -c $< - -jconfig.h: jconfig.doc - echo You must prepare a system-dependent jconfig.h file. - echo Please read the installation directions in install.doc. - exit 1 - -clean: .SYMBOLIC - - del *.obj - - del libjpeg.lib - - del cjpeg.exe - - del djpeg.exe - - del jpegtran.exe - - del rdjpgcom.exe - - del wrjpgcom.exe - - del testout*.* - -test: cjpeg.exe djpeg.exe jpegtran.exe .SYMBOLIC - - del testout*.* - djpeg -dct int -ppm -outfile testout.ppm testorig.jpg - djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg - cjpeg -dct int -outfile testout.jpg testimg.ppm - djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg - cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm - jpegtran -outfile testoutt.jpg testprog.jpg -!ifeq SYSTEM DOS - fc /b testimg.ppm testout.ppm - fc /b testimg.bmp testout.bmp - fc /b testimg.jpg testout.jpg - fc /b testimg.ppm testoutp.ppm - fc /b testimgp.jpg testoutp.jpg - fc /b testorig.jpg testoutt.jpg -!else - echo n > n.tmp - comp testimg.ppm testout.ppm < n.tmp - comp testimg.bmp testout.bmp < n.tmp - comp testimg.jpg testout.jpg < n.tmp - comp testimg.ppm testoutp.ppm < n.tmp - comp testimgp.jpg testoutp.jpg < n.tmp - comp testorig.jpg testoutt.jpg < n.tmp - del n.tmp -!endif +clean: .SYMBOLIC + -erase *.obj + -erase $(LIBTARGET) + -erase *.pch + -erase *.err + -erase *.lbc +cleanall: clean -jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h -jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmarker.obj: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcmaster.obj: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h -jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jctrans.obj: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h -jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h -jdcoefct.obj: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h -jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmarker.obj: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h -jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jdtrans.obj: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jerror.obj: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h -jfdctflt.obj: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jfdctfst.obj: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jfdctint.obj: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctflt.obj: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h -jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jutils.obj: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -jmemmgr.obj: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -jmemmac.obj: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h -cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h -djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h -jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h -rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h -wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.h -cdjpeg.obj: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdcolmap.obj: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdswitch.obj: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h -rdppm.obj: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrppm.obj: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdgif.obj: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrgif.obj: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdtarga.obj: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrtarga.obj: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdbmp.obj: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrbmp.obj: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -rdrle.obj: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h -wrrle.obj: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h diff --git a/src/make.env.in b/src/make.env.in index e727bacff9..bff33e5385 100644 --- a/src/make.env.in +++ b/src/make.env.in @@ -12,7 +12,8 @@ # see comment near LDFLAGS at the end of file EXTRALIBS = @LDFLAGS@ @EXTRA_LIBS@ -LDLIBS = ${top_builddir}/lib/@WX_TARGET_LIBRARY@ $(EXTRALIBS) $(APPEXTRALIBS) +OPENGLLIBS = @OPENGL_LIBS@ +LDLIBS = $(APPEXTRALIBS) ${top_builddir}/lib/@WX_TARGET_LIBRARY@ $(EXTRALIBS) TOOLKIT = @TOOLKIT@ TOOLKITDIR = @TOOLKIT_DIR@ @@ -20,7 +21,7 @@ TOOLKITDIR = @TOOLKIT_DIR@ WXLIB = @WX_LIBRARY_NAME_STATIC@ WXSHLIB = @WX_LIBRARY_NAME_SHARED@ -EXTRADEFS="-DwxINSTALL_PREFIX=\"@prefix@\"" $(APPEXTRADEFS) +EXTRADEFS="-DwxINSTALL_PREFIX=\"@prefix@\"" ########################### VERSION ################################# @@ -69,8 +70,8 @@ DLLTOOL = @DLLTOOL@ # We *must* include CPPFLAGS in both of these, to make sure that all # header files get found. (KB) -CFLAGS = @TOOLKIT_DEF@ @CODE_GEN_FLAGS@ @WXDEBUG_DEFINE@ @CFLAGS@ @CPPFLAGS@ -CPPFLAGS = @TOOLKIT_DEF@ @CODE_GEN_FLAGS@ @WXDEBUG_DEFINE@ @CXXFLAGS@ @CPPFLAGS@ +CFLAGS = $(APPEXTRACFLAGS) $(APPEXTRACPPFLAGS) @TOOLKIT_DEF@ @CODE_GEN_FLAGS@ @WXDEBUG_DEFINE@ @CFLAGS@ @CPPFLAGS@ +CPPFLAGS = $(APPEXTRACXXFLAGS) $(APPEXTRACPPFLAGS) @TOOLKIT_DEF@ @CODE_GEN_FLAGS@ @WXDEBUG_DEFINE@ @CXXFLAGS@ @CPPFLAGS@ PICFLAGS = @PIC_FLAG@ # taking into account how SHARED_LD is defined, appending LDFLAGS to it diff --git a/src/makeb32.env b/src/makeb32.env index fec3d1afce..28da42ee5f 100644 --- a/src/makeb32.env +++ b/src/makeb32.env @@ -42,16 +42,16 @@ DLL=0 # !if "$(WXMAKINGDLL)" == "1" -DLL_FLAGS= -DWXMAKINGDLL=1 -D_WINDLL -WXLIB= $(WXLIBDIR)\wx200.lib +DLL_FLAGS= -DWXMAKINGDLL=1 -D_RTLDLL +WXLIB= $(WXLIBDIR)\wx220.lib !else LINK_FLAGS= /aa /c !if "$(WXUSINGDLL)" == "1" -DLL_FLAGS= -DWXUSINGDLL=1 -WXLIB= $(WXLIBDIR)\wx200.lib +DLL_FLAGS= -DWXUSINGDLL=1 -D_RTLDLL +WXLIB= $(WXLIBDIR)\wx220.lib !else DLL_FLAGS= WXLIB= $(WXLIBDIR)\wx32.lib @@ -60,7 +60,6 @@ WXLIB= $(WXLIBDIR)\wx32.lib !endif !if "$(WXBUILDDLL)" == "1" -DLL_FLAGS= $(DLL_FLAGS) -D_RTLDLL LINK_FLAGS= /Tpd /c $(EXTRALINKFLAGS) !endif diff --git a/src/makeg95.env b/src/makeg95.env index 79786db36c..72f8ce0e0b 100644 --- a/src/makeg95.env +++ b/src/makeg95.env @@ -18,7 +18,7 @@ MINGW32=1 MINGW32VERSION=2.95 # If building DLL, the version -WXVERSION=21_11 +WXVERSION=22_0 # Say yes if you have a "modern" linker that supports --shared option. # Note that you're probably going to wait forever for dlltool/gcc/etc diff --git a/src/makelib.env.in b/src/makelib.env.in index 7b6d8b1896..24d821b09c 100644 --- a/src/makelib.env.in +++ b/src/makelib.env.in @@ -3,13 +3,23 @@ # # Author: Ron Lee <ron@debian.org> # Created: 19/3/2000 +# $Id$ # -# To use, set the following vars before including it. +# To use, set the following vars before including it: +# +# top_srcdir +# top_builddir +# libsrc_dir # # TARGET_LIBNAME # LIBVERSION_CURRENT # LIBVERSION_REVISION # LIBVERSION_AGE +# HEADER_PATH +# HEADER_SUBDIR +# +# HEADERS +# OBJECTS # # either a shared or static lib will be built according to the # option given to configure. @@ -17,15 +27,19 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ +includedir = @includedir@ libdir = @libdir@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ -TARGETLIB_STATIC=$(TARGET_LIBNAME).a -TARGETLIB_SHARED=$(TARGET_LIBNAME).so.$(LIBVERSION_CURRENT).$(LIBVERSION_REVISION).$(LIBVERSION_AGE) -TARGETLIB_LINK1=$(TARGET_LIBNAME).so.$(LIBVERSION_CURRENT) -TARGETLIB_LINK2=$(TARGET_LIBNAME).so +TARGETLIB_STATIC = $(TARGET_LIBNAME).a +TARGETLIB_SHARED = $(TARGET_LIBNAME).so.$(LIBVERSION_CURRENT).$(LIBVERSION_REVISION).$(LIBVERSION_AGE) +TARGETLIB_LINK1 = $(TARGET_LIBNAME).so.$(LIBVERSION_CURRENT) +TARGETLIB_LINK2 = $(TARGET_LIBNAME).so + +TARGETLIB_SONAME = @WX_TARGET_LIBRARY_SONAME@ # Clears all default suffixes .SUFFIXES: .o .cpp .c .cxx @@ -39,10 +53,15 @@ TARGETLIB_LINK2=$(TARGET_LIBNAME).so .cxx.o : $(CC) -c $(CPPFLAGS) $(PICFLAGS) -o $@ $< +# the comment at the end of the next line is needed because otherwise autoconf +# would remove this line completely - it contains a built-in hack to remove +# any VPATH assignment not containing ':' +VPATH = @PATH_IFS@$(top_srcdir)/$(libsrc_dir) # ':' for autoconf + include $(top_builddir)/src/make.env -all: libtype_@WX_TARGET_LIBRARY_TYPE@ +all: libtype_@WX_TARGET_LIBRARY_TYPE@ libtype_so: CREATE_LINKS @@ -50,38 +69,58 @@ libtype_a: $(TARGETLIB_STATIC) $(TARGETLIB_SHARED): $(OBJECTS) - $(SHARED_LD) $@ $(OBJECTS) + @$(INSTALL) -d $(top_builddir)/lib + $(SHARED_LD) $(top_builddir)/lib/$@ $(TARGETLIB_SONAME) $(OBJECTS) CREATE_LINKS: $(TARGETLIB_SHARED) - @$(RM) $(TARGETLIB_LINK1) $(TARGETLIB_LINK2) - $(LN_S) $(TARGETLIB_SHARED) $(TARGETLIB_LINK1) - $(LN_S) $(TARGETLIB_SHARED) $(TARGETLIB_LINK2) + cd $(top_builddir)/lib \ + && $(RM) $(TARGETLIB_LINK1) $(TARGETLIB_LINK2) \ + && $(LN_S) $(TARGETLIB_SHARED) $(TARGETLIB_LINK1) \ + && $(LN_S) $(TARGETLIB_SHARED) $(TARGETLIB_LINK2) $(TARGETLIB_STATIC): $(OBJECTS) - ar $(AROPTIONS) $@ $(OBJECTS) - $(RANLIB) $@ + @$(INSTALL) -d $(top_builddir)/lib + ar $(AROPTIONS) $(top_builddir)/lib/$@ $(OBJECTS) + $(RANLIB) $(top_builddir)/lib/$@ -install: install_@WX_TARGET_LIBRARY_TYPE@ +install: install_@WX_TARGET_LIBRARY_TYPE@ install_headers install_so: - $(INSTALL_PROGRAM) $(TARGETLIB_SHARED) $(libdir)/$(TARGETLIB_SHARED) + $(INSTALL_PROGRAM) $(top_builddir)/lib/$(TARGETLIB_SHARED) $(libdir)/$(TARGETLIB_SHARED) @$(RM) $(libdir)/$(TARGETLIB_LINK1) $(libdir)/$(TARGETLIB_LINK2) cd $(libdir) \ && $(LN_S) $(TARGETLIB_SHARED) $(TARGETLIB_LINK1) \ && $(LN_S) $(TARGETLIB_SHARED) $(TARGETLIB_LINK2) install_a: - $(INSTALL_PROGRAM) $(TARGETLIB_STATIC) $(libdir)/$(TARGETLIB_STATIC) + $(INSTALL_PROGRAM) $(top_builddir)/lib/$(TARGETLIB_STATIC) $(libdir)/$(TARGETLIB_STATIC) + +install_headers: + $(INSTALL) -d $(includedir)/wx/$(HEADER_SUBDIR) + @for h in $(HEADERS); do \ + $(INSTALL_DATA) $(HEADER_PATH)/$(HEADER_SUBDIR)/$$h $(includedir)/wx/$(HEADER_SUBDIR)/$$h; \ + echo "installing $(includedir)/wx/$(HEADER_SUBDIR)/$$h"; \ + done uninstall: $(RM) $(libdir)/$(TARGETLIB_STATIC) $(RM) $(libdir)/$(TARGETLIB_SHARED) $(RM) $(libdir)/$(TARGETLIB_LINK1) $(RM) $(libdir)/$(TARGETLIB_LINK2) + @echo "removing headers" + @for h in $(HEADERS); do \ + $(RM) $(includedir)/wx/$(HEADER_SUBDIR)/$$h; \ + done + @if test -d $(includedir)/wx/$(HEADER_SUBDIR); then \ + rmdir $(includedir)/wx/$(HEADER_SUBDIR); \ + fi + @-rmdir $(includedir)/wx clean: - $(RM) $(OBJECTS) $(TARGETLIB_SHARED) $(TARGETLIB_LINK1) \ - $(TARGETLIB_LINK2) $(TARGETLIB_STATIC) core + $(RM) $(OBJECTS) $(top_builddir)/lib/$(TARGETLIB_SHARED) \ + $(top_builddir)/lib/$(TARGETLIB_LINK1) \ + $(top_builddir)/lib/$(TARGETLIB_LINK2) \ + $(top_builddir)/lib/$(TARGETLIB_STATIC) core .PHONY: all shared static clean install install_static install_shared uninstall diff --git a/src/makeprog.b32 b/src/makeprog.b32 index df95b0e0db..57d43f8396 100644 --- a/src/makeprog.b32 +++ b/src/makeprog.b32 @@ -13,7 +13,11 @@ WXDIR = $(WXWIN) !include $(WXDIR)\src\makeb32.env +!if "$(WXUSINGDLL)" == "1" +LIBS=$(WXLIB) $(EXTRALIBS) cw32mti import32 ole2w32 winpng zlib jpeg xpm tiff odbc32 +!else LIBS=$(WXLIB) $(EXTRALIBS) cw32mt import32 ole2w32 winpng zlib jpeg xpm tiff odbc32 +!endif # Note: you may need to remove some libraries for earlier versions of BC++, as below #LIBS=$(WXLIB) $(EXTRALIBS) cw32mt import32 ole2w32 winpng zlib xpm tiff @@ -30,7 +34,7 @@ OPT = -Od DEBUG_FLAGS = !endif -CPPFLAGS=$(DEBUG_FLAGS) $(EXTRACPPFLAGS) $(OPT) @$(CFG) +CPPFLAGS=$(CPPFLAGS) $(DEBUG_FLAGS) $(OPT) all: $(TARGET).exe $(EXTRATARGETS) diff --git a/src/makeprog.env.in b/src/makeprog.env.in index 8e64d3f9db..9ee384b814 100644 --- a/src/makeprog.env.in +++ b/src/makeprog.env.in @@ -10,13 +10,13 @@ RES_PROGRAM = $(PROGRAM)_resources.o RES_PROGRAM_OPT = @RESPROGRAM@ .c.o : - $(CCC) -c $(CFLAGS) -o $@ $< + $(CCC) -c $(CFLAGS) $(APPEXTRADEFS) -o $@ $< .cpp.o : - $(CC) -c $(CPPFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(APPEXTRADEFS) -o $@ $< .cxx.o : - $(CC) -c $(CPPFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(APPEXTRADEFS) -o $@ $< # the comment at the end of the next line is needed because otherwise autoconf # would remove this line completely - it contains a built-in hack to remove diff --git a/src/makeva.env b/src/makeva.env index 5809374bad..3c92b8ddc5 100644 --- a/src/makeva.env +++ b/src/makeva.env @@ -37,9 +37,9 @@ RC=rc #-------------------------------------------------------------------- # Normal application - - - wx.lib # -# wxWin as DLL Defined - Defined wx214.lib +# wxWin as DLL Defined - Defined wx22.lib # -# App using wxWin DLL - Defined - wx214.lib +# App using wxWin DLL - Defined - wx22.lib # # App built as one DLL Defined - - wx.lib # @@ -91,7 +91,7 @@ DLL=0 # wx200 (DLL release), wx200_d (DLL debug) !if "$(WXMAKINGDLL)" == "1" || "$(WXUSINGDLL)" == "1" -WXLIBNAME=wx214 +WXLIBNAME=wx22 !else WXLIBNAME=wx !endif diff --git a/src/makevc.env b/src/makevc.env index e611d32218..189d215d2e 100644 --- a/src/makevc.env +++ b/src/makevc.env @@ -8,7 +8,7 @@ # !include <ntwin32.mak> -WXVERSION=21_14 +WXVERSION=22_0 WIN95=1 !if "$(WIN95)" == "0" @@ -125,7 +125,7 @@ WXLIBNAME=$(NEW_WXLIBNAME) !if "$(FINAL)" == "1" D=Release !else -guilibsdll=msvcrtd.lib oldnames.lib kernel32.lib \ +guilibsdll= oldnames.lib kernel32.lib \ ws2_32.lib mswsock.lib advapi32.lib user32.lib \ gdi32.lib comdlg32.lib winspool.lib D=Debug diff --git a/src/makewat.env b/src/makewat.env index 11c5031607..6519f7472a 100644 --- a/src/makewat.env +++ b/src/makewat.env @@ -29,7 +29,7 @@ PRECOMP = /fh=$(WXDIR)\src\msw\watcom.pch !endif !ifeq WXDEBUG 1 -DEBUGFLAGS = /D__WXDEBUG__ +DEBUGFLAGS = /D__WXDEBUG__ /o1 DEBUGINFO = debug all !else DEBUGFLAGS = @@ -51,9 +51,9 @@ WATLIBDIR = $(WATCOMDIR)\lib386\nt MINDATA = MAXDATA = STACK = option stack=64k -LIBS = $(WXDIR)\lib\wx.lib $(WXDIR)\lib\zlib.lib $(WXDIR)\lib\png.lib $(WXDIR)\lib\xpm.lib & +LIBS = $(WXDIR)\lib\wx.lib $(WXDIR)\lib\zlib.lib $(WXDIR)\lib\png.lib $(WXDIR)\lib\tiff.lib $(WXDIR)\lib\jpeg.lib $(WXDIR)\lib\xpm.lib & $(WATLIBDIR)\comctl32.lib $(WATLIBDIR)\comdlg32.lib & - $(WATLIBDIR)\ole32.lib $(WATLIBDIR)\oleaut32.lib & + $(WATLIBDIR)\ole32.lib $(WATLIBDIR)\oleaut32.lib $(WATLIBDIR)\opengl32.lib & $(WATLIBDIR)\uuid.lib $(WXDIR)\lib\watcom\odbc32.lib IFLAGS = -i=$(WXINC) -i=$(WXDIR)\contrib\include -i=$(%watcom)\h;$(%watcom)\h\nt;$(WXDIR)\src\png;$(WXDIR)\src\zlib;$(WXDIR)\src\jpeg;$(WXDIR)\src\tiff;$(WXDIR)\include\wx\msw\gnuwin32 RESFLAGS1 = -r -bt=nt /i$(WXDIR)\include /i$(WXDIR)\contrib\include @@ -70,7 +70,7 @@ RESFLAGS2 = -R $(name) /i$(WXDIR)\include /i$(WXDIR)\contrib\include OPTFLAGS=/ox /5r # /d1 for line numbers only: anything else produces an enormous wx32.lib -CPPFLAGS = /bt=nt /w1 /DWIN32 /D__WIN32__ /D__WIN95__ /D__WINDOWS__ /zq $(OPTFLAGS) $(MODEL) $(PRECOMP) /d1 $(DEBUGFLAGS) /d__WXMSW__ $(EXTRACPPFLAGS) # /d__WATCOMC__ +CPPFLAGS = /bt=nt /w1 /DWIN32 /D__WIN32__ /D__WIN95__ /D__WINDOWS__ /zq $(OPTFLAGS) $(MODEL) $(PRECOMP) $(DEBUGFLAGS) /d__WXMSW__ $(EXTRACPPFLAGS) # /d__WATCOMC__ .cpp.obj: # $< # .AUTODEPEND *$(CCC) $(CPPFLAGS) $(IFLAGS) $< diff --git a/src/motif/choice.cpp b/src/motif/choice.cpp index 45a2430847..b805a5dabf 100644 --- a/src/motif/choice.cpp +++ b/src/motif/choice.cpp @@ -189,32 +189,37 @@ void wxChoice::Append(const wxString& item) for (i = 0; i < m_noStrings; i++) new_widgetList[i] = m_widgetList[i]; - new_widgetList[m_noStrings] = (WXWidget) w; + new_widgetList[m_noStrings] = (WXWidget) w; - if (m_widgetList) - delete[] m_widgetList; - m_widgetList = new_widgetList; + if (m_widgetList) + delete[] m_widgetList; + m_widgetList = new_widgetList; - char mnem = wxFindMnemonic ((char*) (const char*) item); - if (mnem != 0) - XtVaSetValues (w, XmNmnemonic, mnem, NULL); + char mnem = wxFindMnemonic ((char*) (const char*) item); + if (mnem != 0) + XtVaSetValues (w, XmNmnemonic, mnem, NULL); - XtAddCallback (w, XmNactivateCallback, (XtCallbackProc) wxChoiceCallback, (XtPointer) this); + XtAddCallback (w, XmNactivateCallback, (XtCallbackProc) wxChoiceCallback, (XtPointer) this); - if (m_noStrings == 0 && m_buttonWidget) - { - XtVaSetValues ((Widget) m_buttonWidget, XmNmenuHistory, w, NULL); - Widget label = XmOptionButtonGadget ((Widget) m_buttonWidget); - XmString text = XmStringCreateSimple ((char*) (const char*) item); - XtVaSetValues (label, - XmNlabelString, text, - NULL); - XmStringFree (text); - } - wxNode *node = m_stringList.Add (item); - XtVaSetValues (w, XmNuserData, node->Data (), NULL); + if (m_noStrings == 0 && m_buttonWidget) + { + XtVaSetValues ((Widget) m_buttonWidget, XmNmenuHistory, w, NULL); + Widget label = XmOptionButtonGadget ((Widget) m_buttonWidget); + XmString text = XmStringCreateSimple ((char*) (const char*) item); + XtVaSetValues (label, + XmNlabelString, text, + NULL); + XmStringFree (text); + } + wxNode *node = m_stringList.Add (item); + XtVaSetValues (w, XmNuserData, node->Data (), NULL); - m_noStrings ++; + if (m_noStrings == 0) + m_clientList.Append((wxObject*) NULL); + else + m_clientList.Insert( m_clientList.Item(m_noStrings-1), + (wxObject*) NULL ); + m_noStrings ++; } void wxChoice::Delete(int WXUNUSED(n)) @@ -243,6 +248,21 @@ void wxChoice::Clear() m_widgetList = (WXWidget*) NULL; if (m_buttonWidget) XtVaSetValues ((Widget) m_buttonWidget, XmNmenuHistory, (Widget) NULL, NULL); + + if ( HasClientObjectData() ) + { + // destroy the data (due to Robert's idea of using wxList<wxObject> + // and not wxList<wxClientData> we can't just say + // m_clientList.DeleteContents(TRUE) - this would crash! + wxNode *node = m_clientList.First(); + while ( node ) + { + delete (wxClientData *)node->Data(); + node = node->Next(); + } + } + m_clientList.Clear(); + m_noStrings = 0; } @@ -524,26 +544,40 @@ void wxChoice::DoSetFirstItem(int WXUNUSED(n)) wxFAIL_MSG( wxT("wxChoice::DoSetFirstItem not implemented") ); } -void wxChoice::DoSetItemClientData(int WXUNUSED(n), void* WXUNUSED(clientData)) +void wxChoice::DoSetItemClientData(int n, void* clientData) { - wxFAIL_MSG( wxT("wxChoice::DoSetItemClientData not implemented") ); + wxNode *node = m_clientList.Nth( n ); + wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientData") ); + + node->SetData( (wxObject*) clientData ); } -void* wxChoice::DoGetItemClientData(int WXUNUSED(n)) const +void* wxChoice::DoGetItemClientData(int n) const { - wxFAIL_MSG( wxT("wxChoice::DoGetItemClientData not implemented") ); - return (void*) NULL; + wxNode *node = m_clientList.Nth( n ); + wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetItemClientData") ); + + return node->Data(); } -void wxChoice::DoSetItemClientObject(int WXUNUSED(n), wxClientData* WXUNUSED(clientData)) +void wxChoice::DoSetItemClientObject(int n, wxClientData* clientData) { - wxFAIL_MSG( wxT("wxChoice::DoSetItemClientObject not implemented") ); + wxNode *node = m_clientList.Nth( n ); + wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") ); + + wxClientData *cd = (wxClientData*) node->Data(); + delete cd; + + node->SetData( (wxObject*) clientData ); } -wxClientData* wxChoice::DoGetItemClientObject(int WXUNUSED(n)) const +wxClientData* wxChoice::DoGetItemClientObject(int n) const { - wxFAIL_MSG( wxT("wxChoice::DoGetItemClientObject not implemented") ); - return (wxClientData*) NULL; + wxNode *node = m_clientList.Nth( n ); + wxCHECK_MSG( node, (wxClientData *)NULL, + wxT("invalid index in wxChoice::DoGetItemClientObject") ); + + return (wxClientData*) node->Data(); } void wxChoice::Select(int n) diff --git a/src/motif/combobox.cpp b/src/motif/combobox.cpp index 6794324428..d1c470999e 100644 --- a/src/motif/combobox.cpp +++ b/src/motif/combobox.cpp @@ -67,11 +67,6 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, XmNstaticList, ((style & wxCB_SIMPLE) == wxCB_SIMPLE), NULL); - XtAddCallback (buttonWidget, XmNselectionCallback, (XtCallbackProc) wxComboBoxCallback, - (XtPointer) this); - XtAddCallback (buttonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxComboBoxCallback, - (XtPointer) this); - int i; for (i = 0; i < n; i++) { @@ -91,6 +86,11 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, m_font = parent->GetFont(); ChangeFont(FALSE); + XtAddCallback (buttonWidget, XmNselectionCallback, (XtCallbackProc) wxComboBoxCallback, + (XtPointer) this); + XtAddCallback (buttonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxComboBoxCallback, + (XtPointer) this); + SetCanAddEventHandler(TRUE); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); @@ -151,6 +151,16 @@ void wxComboBox::Delete(int n) delete[] (char *)node->Data(); delete node; } + node = m_clientList.Nth( n ); + if (node) + { + if ( HasClientObjectData() ) + { + delete (wxClientData *)node->Data(); + } + delete node; + } + m_noStrings--; } @@ -158,6 +168,21 @@ void wxComboBox::Clear() { XmComboBoxDeleteAllItems((Widget) m_mainWidget); m_stringList.Clear(); + + if ( HasClientObjectData() ) + { + // destroy the data (due to Robert's idea of using wxList<wxObject> + // and not wxList<wxClientData> we can't just say + // m_clientList.DeleteContents(TRUE) - this would crash! + wxNode *node = m_clientList.First(); + while ( node ) + { + delete (wxClientData *)node->Data(); + node = node->Next(); + } + } + m_clientList.Clear(); + m_noStrings = 0; } void wxComboBox::SetSelection (int n) diff --git a/src/motif/control.cpp b/src/motif/control.cpp index 4a79908477..c31dec797f 100644 --- a/src/motif/control.cpp +++ b/src/motif/control.cpp @@ -67,7 +67,7 @@ wxControl::~wxControl() wxPanel *panel = wxDynamicCast(GetParent(), wxPanel); if (panel) { - if (panel->GetDefaultItem() == this) + if ( (wxControl *)panel->GetDefaultItem() == this) panel->SetDefaultItem((wxButton*) NULL); } } diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp index 81df528083..9fcfc8730a 100644 --- a/src/motif/dcclient.cpp +++ b/src/motif/dcclient.cpp @@ -323,7 +323,7 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCo wxCoord dx = xx1 - xxc; wxCoord dy = yy1 - yyc; - double radius = sqrt (dx * dx + dy * dy); + double radius = sqrt ((double)(dx * dx + dy * dy)); wxCoord r = (wxCoord) radius; double radius1, radius2; diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index a9a097e096..cfd12bece7 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -499,6 +499,20 @@ int wxDialog::ShowModal() XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event); wxTheApp->ProcessXEvent((WXEvent*) &event); + + if (XtAppPending( (XtAppContext) wxTheApp->GetAppContext() ) == 0) + { + if (!wxTheApp->ProcessIdle()) + { +#if wxUSE_THREADS + // leave the main loop to give other threads a chance to + // perform their GUI work + wxMutexGuiLeave(); + wxUsleep(20); + wxMutexGuiEnter(); +#endif + } + } } // Remove modal dialog flag from stack diff --git a/src/motif/files.lst b/src/motif/files.lst index 27980f1c4b..f36c786991 100644 --- a/src/motif/files.lst +++ b/src/motif/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 15:55, 2000/03/14 +# This file was automatically generated by tmake at 20:17, 2000/03/31 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MOTIF.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -287,6 +287,7 @@ ALL_HEADERS = \ filesys.h \ font.h \ fontdlg.h \ + fontenc.h \ fontenum.h \ fontmap.h \ fontutil.h \ diff --git a/src/motif/glcanvas.cpp b/src/motif/glcanvas.cpp index 1d5e2936a3..0c1f9780d2 100644 --- a/src/motif/glcanvas.cpp +++ b/src/motif/glcanvas.cpp @@ -7,7 +7,7 @@ // Created: 1995, 1999 // RCS-ID: $Id$ // Copyright: (c) Julian Smart, Wolfram Gloger -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -31,8 +31,8 @@ static int bitcount( unsigned long n ) { int bits; for (bits=0; n>0;) { - if(n & 1) bits++; - n = n >> 1; + if(n & 1) bits++; + n = n >> 1; } return bits; } @@ -44,10 +44,14 @@ static int bitcount( unsigned long n ) IMPLEMENT_CLASS(wxGLCanvas, wxScrolledWindow) -wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos, - const wxSize& size, long style, - const wxString& name, int *attrib_list, const wxPalette& palette): - wxScrolledWindow(parent, id, pos, size, style, name) +wxGLCanvas::wxGLCanvas(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + int *attrib_list, const wxPalette& palette) + : wxScrolledWindow(parent, id, pos, size, style, name) { XVisualInfo *vi, vi_templ; XWindowAttributes xwa; @@ -58,53 +62,53 @@ wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos, glx_cx = 0; // Check for the presence of the GLX extension if(!glXQueryExtension(display, NULL, NULL)) { - wxDebugMsg("wxGLCanvas: GLX extension is missing\n"); - return; + wxDebugMsg("wxGLCanvas: GLX extension is missing\n"); + return; } if(attrib_list) { - // Get an appropriate visual - vi = glXChooseVisual(display, DefaultScreen(display), attrib_list); - if(!vi) return; + // Get an appropriate visual + vi = glXChooseVisual(display, DefaultScreen(display), attrib_list); + if(!vi) return; - // Here we should make sure that vi is the same visual as the - // one used by the xwindow drawable in wxCanvas. However, - // there is currently no mechanism for this in wx_canvs.cc. + // Here we should make sure that vi is the same visual as the + // one used by the xwindow drawable in wxCanvas. However, + // there is currently no mechanism for this in wx_canvs.cc. } else { - // By default, we use the visual of xwindow - XGetWindowAttributes(display, (Window) GetXWindow(), &xwa); - vi_templ.visualid = XVisualIDFromVisual(xwa.visual); - vi = XGetVisualInfo(display, VisualIDMask, &vi_templ, &n); - if(!vi) return; - glXGetConfig(display, vi, GLX_USE_GL, &val); - if(!val) return; - // Basically, this is it. It should be possible to use vi - // in glXCreateContext() below. But this fails with Mesa. - // I notified the Mesa author about it; there may be a fix. + // By default, we use the visual of xwindow + XGetWindowAttributes(display, (Window) GetXWindow(), &xwa); + vi_templ.visualid = XVisualIDFromVisual(xwa.visual); + vi = XGetVisualInfo(display, VisualIDMask, &vi_templ, &n); + if(!vi) return; + glXGetConfig(display, vi, GLX_USE_GL, &val); + if(!val) return; + // Basically, this is it. It should be possible to use vi + // in glXCreateContext() below. But this fails with Mesa. + // I notified the Mesa author about it; there may be a fix. #ifdef OLD_MESA - // Construct an attribute list matching the visual - int a_list[32]; - n = 0; - if(vi->c_class==TrueColor || vi->c_class==DirectColor) { // RGBA visual - a_list[n++] = GLX_RGBA; - a_list[n++] = GLX_RED_SIZE; - a_list[n++] = bitcount(vi->red_mask); - a_list[n++] = GLX_GREEN_SIZE; - a_list[n++] = bitcount(vi->green_mask); - a_list[n++] = GLX_BLUE_SIZE; - a_list[n++] = bitcount(vi->blue_mask); - glXGetConfig(display, vi, GLX_ALPHA_SIZE, &val); - a_list[n++] = GLX_ALPHA_SIZE; - a_list[n++] = val; - } else { // Color index visual - glXGetConfig(display, vi, GLX_BUFFER_SIZE, &val); - a_list[n++] = GLX_BUFFER_SIZE; - a_list[n++] = val; - } - a_list[n] = None; - XFree(vi); - vi = glXChooseVisual(display, DefaultScreen(display), a_list); - if(!vi) return; + // Construct an attribute list matching the visual + int a_list[32]; + n = 0; + if(vi->c_class==TrueColor || vi->c_class==DirectColor) { // RGBA visual + a_list[n++] = GLX_RGBA; + a_list[n++] = GLX_RED_SIZE; + a_list[n++] = bitcount(vi->red_mask); + a_list[n++] = GLX_GREEN_SIZE; + a_list[n++] = bitcount(vi->green_mask); + a_list[n++] = GLX_BLUE_SIZE; + a_list[n++] = bitcount(vi->blue_mask); + glXGetConfig(display, vi, GLX_ALPHA_SIZE, &val); + a_list[n++] = GLX_ALPHA_SIZE; + a_list[n++] = val; + } else { // Color index visual + glXGetConfig(display, vi, GLX_BUFFER_SIZE, &val); + a_list[n++] = GLX_BUFFER_SIZE; + a_list[n++] = val; + } + a_list[n] = None; + XFree(vi); + vi = glXChooseVisual(display, DefaultScreen(display), a_list); + if(!vi) return; #endif /* OLD_MESA */ } @@ -138,28 +142,28 @@ void wxGLCanvas::SetColour(const char *col) { wxColour *the_colour = wxTheColourDatabase->FindColour(col); if(the_colour) { - GLboolean b; - glGetBooleanv(GL_RGBA_MODE, &b); - if(b) { - glColor3ub(the_colour->Red(), - the_colour->Green(), - the_colour->Blue()); - } else { - GLint pix = (GLint)the_colour->m_pixel; - if(pix == -1) { - XColor exact_def; - exact_def.red = (unsigned short)the_colour->Red() << 8; - exact_def.green = (unsigned short)the_colour->Green() << 8; - exact_def.blue = (unsigned short)the_colour->Blue() << 8; - exact_def.flags = DoRed | DoGreen | DoBlue; - if(!XAllocColor((Display*) GetXDisplay(), (Colormap) wxTheApp->GetMainColormap(GetXDisplay()), &exact_def)) { - wxDebugMsg("wxGLCanvas: cannot allocate color\n"); - return; - } - pix = the_colour->m_pixel = exact_def.pixel; - } - glIndexi(pix); - } + GLboolean b; + glGetBooleanv(GL_RGBA_MODE, &b); + if(b) { + glColor3ub(the_colour->Red(), + the_colour->Green(), + the_colour->Blue()); + } else { + GLint pix = (GLint)the_colour->m_pixel; + if(pix == -1) { + XColor exact_def; + exact_def.red = (unsigned short)the_colour->Red() << 8; + exact_def.green = (unsigned short)the_colour->Green() << 8; + exact_def.blue = (unsigned short)the_colour->Blue() << 8; + exact_def.flags = DoRed | DoGreen | DoBlue; + if(!XAllocColor((Display*) GetXDisplay(), (Colormap) wxTheApp->GetMainColormap(GetXDisplay()), &exact_def)) { + wxDebugMsg("wxGLCanvas: cannot allocate color\n"); + return; + } + pix = the_colour->m_pixel = exact_def.pixel; + } + glIndexi(pix); + } } } diff --git a/src/motif/slider.cpp b/src/motif/slider.cpp index 3fa3e0bfc1..369cecc720 100644 --- a/src/motif/slider.cpp +++ b/src/motif/slider.cpp @@ -300,6 +300,7 @@ void wxSliderCallback (Widget widget, XtPointer clientData, XmScaleCallbackStruc // Also send a wxCommandEvent for compatibility. wxCommandEvent event2(wxEVT_COMMAND_SLIDER_UPDATED, slider->GetId()); event2.SetEventObject(slider); + event2.SetInt( event.GetInt() ); slider->ProcessCommand(event2); break; } diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 2a8e53ebab..dd24fa4ac9 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -747,11 +747,16 @@ bool wxWindow::SetCursor(const wxCursor& cursor) return FALSE; } - wxASSERT_MSG( m_cursor.Ok(), - wxT("cursor must be valid after call to the base version")); + // wxASSERT_MSG( m_cursor.Ok(), + // wxT("cursor must be valid after call to the base version")); + wxCursor* cursor2 = NULL; + if (m_cursor.Ok()) + cursor2 = & m_cursor; + else + cursor2 = wxSTANDARD_CURSOR; WXDisplay *dpy = GetXDisplay(); - WXCursor x_cursor = m_cursor.GetXCursor(dpy); + WXCursor x_cursor = cursor2->GetXCursor(dpy); Widget w = (Widget) GetMainWidget(); Window win = XtWindow(w); diff --git a/src/motif/xmcombo/xmcombo.c b/src/motif/xmcombo/xmcombo.c index f612df4e95..bfabe8b116 100644 --- a/src/motif/xmcombo/xmcombo.c +++ b/src/motif/xmcombo/xmcombo.c @@ -116,8 +116,10 @@ #include <stdio.h> /* --- Systemspezifische Definitionen */ -#ifdef VMS +#if defined(VMS) #define strcasecmp(s1, s2) strcmp(s1, s2) +#elif defined(__EMX__) +#define strcasecmp stricmp #endif /* --- sonstiger Quark */ diff --git a/src/msw/accel.cpp b/src/msw/accel.cpp index e433443dd3..3f2cb37684 100644 --- a/src/msw/accel.cpp +++ b/src/msw/accel.cpp @@ -162,7 +162,6 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const { MSG *msg = (MSG *)wxmsg; - return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); } diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 8010fbf6dc..d994f7b343 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -122,7 +122,6 @@ // --------------------------------------------------------------------------- extern wxChar *wxBuffer; -extern wxChar *wxOsVersion; extern wxList *wxWinHandleList; extern wxList WXDLLEXPORT wxPendingDelete; extern void wxSetKeyboardHook(bool doIt); @@ -158,7 +157,9 @@ LRESULT WXDLLEXPORT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM); // FIXME wxUSE_ON_FATAL_EXCEPTION is only supported for VC++ now because it // needs compiler support for Win32 SEH. Others (especially Borland) // probably have it too, but I'm not sure about how it works -#ifndef __VISUALC__ +// JACS: get 'Cannot use __try in functions that require unwinding +// in Unicode mode, so disabling. +#if !defined(__VISUALC__) || defined(__WIN16__) || defined(UNICODE) #undef wxUSE_ON_FATAL_EXCEPTION #define wxUSE_ON_FATAL_EXCEPTION 0 #endif // VC++ @@ -175,17 +176,38 @@ LRESULT WXDLLEXPORT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM); // wxApp // --------------------------------------------------------------------------- - IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) +IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) - BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxApp::OnIdle) - EVT_END_SESSION(wxApp::OnEndSession) - EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession) - END_EVENT_TABLE() +BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) + EVT_IDLE(wxApp::OnIdle) + EVT_END_SESSION(wxApp::OnEndSession) + EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession) +END_EVENT_TABLE() //// Initialize bool wxApp::Initialize() { + // the first thing to do is to check if we're trying to run an Unicode + // program under Win9x - if so, abort right now as it has no chance to + // work +#if wxUSE_UNICODE + if ( wxGetOsVersion() != wxWINDOWS_NT ) + { + // note that we can use MessageBoxW() as it's implemented even under + // Win9x - OTOH, we can't use wxGetTranslation() because the file APIs + // used by wxLocale are not + ::MessageBox + ( + NULL, + _T("This program uses Unicode and requires Windows NT/2000.\nProgram aborted."), + _T("wxWindows Fatal Error"), + MB_ICONERROR | MB_OK + ); + + return FALSE; + } +#endif // wxUSE_UNICODE + // Some people may wish to use this, but // probably it shouldn't be here by default. #ifdef __WXDEBUG__ @@ -196,10 +218,6 @@ bool wxApp::Initialize() wxClassInfo::InitializeClasses(); -#if wxUSE_RESOURCES - wxGetResource(wxT("wxWindows"), wxT("OsVersion"), &wxOsVersion); -#endif - #if wxUSE_THREADS wxPendingEventsLocker = new wxCriticalSection; #endif @@ -319,7 +337,7 @@ bool wxApp::RegisterWindowClasses() if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(frame)"); + wxLogLastError(wxT("RegisterClass(frame)")); return FALSE; } @@ -330,7 +348,7 @@ bool wxApp::RegisterWindowClasses() if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(no redraw frame)"); + wxLogLastError(wxT("RegisterClass(no redraw frame)")); return FALSE; } @@ -342,7 +360,7 @@ bool wxApp::RegisterWindowClasses() if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(MDI parent)"); + wxLogLastError(wxT("RegisterClass(MDI parent)")); return FALSE; } @@ -353,7 +371,7 @@ bool wxApp::RegisterWindowClasses() if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(no redraw MDI parent frame)"); + wxLogLastError(wxT("RegisterClass(no redraw MDI parent frame)")); return FALSE; } @@ -365,7 +383,7 @@ bool wxApp::RegisterWindowClasses() if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(MDI child)"); + wxLogLastError(wxT("RegisterClass(MDI child)")); return FALSE; } @@ -376,7 +394,7 @@ bool wxApp::RegisterWindowClasses() if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(no redraw MDI child)"); + wxLogLastError(wxT("RegisterClass(no redraw MDI child)")); return FALSE; } @@ -388,7 +406,7 @@ bool wxApp::RegisterWindowClasses() if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(panel)"); + wxLogLastError(wxT("RegisterClass(panel)")); return FALSE; } @@ -399,7 +417,7 @@ bool wxApp::RegisterWindowClasses() if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(no redraw panel)"); + wxLogLastError(wxT("RegisterClass(no redraw panel)")); return FALSE; } @@ -410,7 +428,7 @@ bool wxApp::RegisterWindowClasses() if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(canvas)"); + wxLogLastError(wxT("RegisterClass(canvas)")); return FALSE; } @@ -419,7 +437,7 @@ bool wxApp::RegisterWindowClasses() wndclass.style = styleNoRedraw; if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(no redraw canvas)"); + wxLogLastError(wxT("RegisterClass(no redraw canvas)")); return FALSE; } @@ -615,12 +633,12 @@ void wxApp::CleanUp() // Entry point helpers, used by wxPython //---------------------------------------------------------------------- -int WXDLLEXPORT wxEntryStart( int WXUNUSED(argc), char** WXUNUSED(argv) ) +int WXDLLEXPORT wxEntryStart( int WXUNUSED(argc), char** WXUNUSED(argv) ) { return wxApp::Initialize(); } -int WXDLLEXPORT wxEntryInitGui() +int WXDLLEXPORT wxEntryInitGui() { wxTheApp->OnInitGui(); return 0; @@ -746,14 +764,10 @@ int wxEntry(WXHINSTANCE hInstance, __except ( gs_handleExceptions ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) { if ( wxTheApp ) + { + // give the user a chance to do something special about this wxTheApp->OnFatalException(); - - // using wxLog would be unsafe here - ::MessageBox(NULL, - _("Unrecoverable program error detected: " - " the application will terminate."), - _("Fatal Error"), - MB_APPLMODAL | MB_ICONSTOP | MB_OK); + } ::ExitProcess(3); // the same exit code as abort() @@ -866,7 +880,7 @@ bool wxApp::DoMessage() else if ( rc == -1 ) { // should never happen, but let's test for it nevertheless - wxLogLastError("GetMessage"); + wxLogLastError(wxT("GetMessage")); } else { @@ -1174,7 +1188,7 @@ int wxApp::GetComCtl32Version() // try to use DllGetVersion() if available in _headers_ #ifdef DLLVER_PLATFORM_WINDOWS // defined in shlwapi.h DLLGETVERSIONPROC pfnDllGetVersion = (DLLGETVERSIONPROC) - ::GetProcAddress(hModuleComCtl32, _T("DllGetVersion")); + ::GetProcAddress(hModuleComCtl32, "DllGetVersion"); if ( pfnDllGetVersion ) { DLLVERSIONINFO dvi; @@ -1203,11 +1217,7 @@ int wxApp::GetComCtl32Version() FARPROC theProc = ::GetProcAddress ( hModuleComCtl32, -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x520) "InitCommonControlsEx" -#else - _T("InitCommonControlsEx") -#endif ); if ( !theProc ) @@ -1222,11 +1232,7 @@ int wxApp::GetComCtl32Version() theProc = ::GetProcAddress ( hModuleComCtl32, -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x520) "InitializeFlatSB" -#else - _T("InitializeFlatSB") -#endif ); if ( !theProc ) { @@ -1315,7 +1321,7 @@ void wxWakeUpIdle() if ( !::PostMessage(GetHwndOf(topWindow), WM_NULL, 0, 0) ) { // should never happen - wxLogLastError("PostMessage(WM_NULL)"); + wxLogLastError(wxT("PostMessage(WM_NULL)")); } } } diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 33651b712f..b5bd43e892 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -86,7 +86,7 @@ void wxBitmapRefData::Free() { if ( !::DeleteObject((HBITMAP)m_hBitmap) ) { - wxLogLastError("DeleteObject(hbitmap)"); + wxLogLastError(wxT("DeleteObject(hbitmap)")); } } @@ -117,7 +117,7 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) ICONINFO iconInfo; if ( !::GetIconInfo(hicon, &iconInfo) ) { - wxLogLastError("GetIconInfo"); + wxLogLastError(wxT("GetIconInfo")); return FALSE; } @@ -269,7 +269,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) HBITMAP hbmp = ::CreateBitmap(width, height, 1, depth, data); if ( !hbmp ) { - wxLogLastError("CreateBitmap"); + wxLogLastError(wxT("CreateBitmap")); } if ( data != bits ) @@ -326,7 +326,7 @@ bool wxBitmap::Create(int w, int h, int d) hbmp = ::CreateBitmap(w, h, 1, d, NULL); if ( !hbmp ) { - wxLogLastError("CreateBitmap"); + wxLogLastError(wxT("CreateBitmap")); } } else @@ -335,7 +335,7 @@ bool wxBitmap::Create(int w, int h, int d) hbmp = ::CreateCompatibleBitmap(dc, w, h); if ( !hbmp ) { - wxLogLastError("CreateCompatibleBitmap"); + wxLogLastError(wxT("CreateCompatibleBitmap")); } GetBitmapData()->m_depth = wxDisplayDepth(); @@ -382,8 +382,7 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth) if ( !handler ) { - wxLogDebug(wxT("Failed to create bitmap: no bitmap handler for " - "type %d defined."), type); + wxLogDebug(wxT("Failed to create bitmap: no bitmap handler for type %d defined."), type); return FALSE; } @@ -653,7 +652,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) HDC destDC = ::CreateCompatibleDC(NULL); if ( !srcDC || !destDC ) { - wxLogLastError("CreateCompatibleDC"); + wxLogLastError(wxT("CreateCompatibleDC")); } bool ok = TRUE; @@ -661,7 +660,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) HGDIOBJ hbmpSrcOld = ::SelectObject(srcDC, GetHbitmapOf(bitmap)); if ( !hbmpSrcOld ) { - wxLogLastError("SelectObject"); + wxLogLastError(wxT("SelectObject")); ok = FALSE; } @@ -669,7 +668,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) HGDIOBJ hbmpDstOld = ::SelectObject(destDC, (HBITMAP)m_maskBitmap); if ( !hbmpDstOld ) { - wxLogLastError("SelectObject"); + wxLogLastError(wxT("SelectObject")); ok = FALSE; } @@ -683,7 +682,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) COLORREF col = GetPixel(srcDC, w, h); if ( col == CLR_INVALID ) { - wxLogLastError("GetPixel"); + wxLogLastError(wxT("GetPixel")); // doesn't make sense to continue ok = FALSE; @@ -843,13 +842,13 @@ extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) HDC hdcDst = ::CreateCompatibleDC(NULL); if ( !hdcSrc || !hdcDst ) { - wxLogLastError("CreateCompatibleDC"); + wxLogLastError(wxT("CreateCompatibleDC")); } HBITMAP hbmpInvMask = ::CreateBitmap(w, h, 1, 1, 0); if ( !hbmpInvMask ) { - wxLogLastError("CreateBitmap"); + wxLogLastError(wxT("CreateBitmap")); } ::SelectObject(hdcSrc, hbmpMask); @@ -858,7 +857,7 @@ extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) hdcSrc, 0, 0, NOTSRCCOPY) ) { - wxLogLastError("BitBlt"); + wxLogLastError(wxT("BitBlt")); } ::DeleteDC(hdcSrc); diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index 744c8a48b6..e5b40ea968 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -75,12 +75,25 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit if ( height == -1 && bitmap.Ok()) height = bitmap.GetHeight() + 2*m_marginY; + long msStyle = WS_VISIBLE | WS_TABSTOP | WS_CHILD | BS_OWNERDRAW ; + +#ifdef __WIN32__ + if(m_windowStyle & wxBU_LEFT) + msStyle |= BS_LEFT; + if(m_windowStyle & wxBU_RIGHT) + msStyle |= BS_RIGHT; + if(m_windowStyle & wxBU_TOP) + msStyle |= BS_TOP; + if(m_windowStyle & wxBU_BOTTOM) + msStyle |= BS_BOTTOM; +#endif + m_hWnd = (WXHWND)CreateWindowEx ( 0, wxT("BUTTON"), wxT(""), - WS_VISIBLE | WS_TABSTOP | WS_CHILD | BS_OWNERDRAW , + msStyle, 0, 0, 0, 0, GetWinHwnd(parent), (HMENU)m_windowId, @@ -103,6 +116,9 @@ void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap) m_buttonBitmap = bitmap; } +// VZ: should be at the very least less than wxDEFAULT_BUTTON_MARGIN +#define FOCUS_MARGIN 3 + bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) { #if defined(__WIN95__) @@ -144,8 +160,22 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) int height = lpDIS->rcItem.bottom - y; int wBmp = bitmap->GetWidth(); int hBmp = bitmap->GetHeight(); - int x1 = x + (width - wBmp) / 2; - int y1 = y + (height - hBmp) / 2; + + int x1,y1; + + if(m_windowStyle & wxBU_LEFT) + x1 = x + (FOCUS_MARGIN+1); + else if(m_windowStyle & wxBU_RIGHT) + x1 = x + (width - wBmp) - (FOCUS_MARGIN+1); + else + x1 = x + (width - wBmp) / 2; + + if(m_windowStyle & wxBU_TOP) + y1 = y + (FOCUS_MARGIN+1); + else if(m_windowStyle & wxBU_BOTTOM) + y1 = y + (height - hBmp) - (FOCUS_MARGIN+1); + else + y1 = y + (height - hBmp) / 2; if ( isSelected && autoDraw ) { @@ -308,9 +338,6 @@ void wxBitmapButton::DrawFace( WXHDC dc, int left, int top, int right, int botto #endif // defined(__WIN95__) -// VZ: should be at the very least less than wxDEFAULT_BUTTON_MARGIN -#define FOCUS_MARGIN 3 - void wxBitmapButton::DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ) { RECT rect; diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 64e3c798a2..d58fda1ac6 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -74,13 +74,25 @@ bool wxButton::Create(wxWindow *parent, m_backgroundColour = parent->GetBackgroundColour(); m_foregroundColour = parent->GetForegroundColour(); + long msStyle = WS_VISIBLE | WS_TABSTOP | WS_CHILD /* | WS_CLIPSIBLINGS */ ; + +#ifdef __WIN32__ + if(m_windowStyle & wxBU_LEFT) + msStyle |= BS_LEFT; + if(m_windowStyle & wxBU_RIGHT) + msStyle |= BS_RIGHT; + if(m_windowStyle & wxBU_TOP) + msStyle |= BS_TOP; + if(m_windowStyle & wxBU_BOTTOM) + msStyle |= BS_BOTTOM; +#endif m_hWnd = (WXHWND)CreateWindowEx ( MakeExtendedStyle(m_windowStyle), wxT("BUTTON"), label, - WS_VISIBLE | WS_TABSTOP | WS_CHILD, + msStyle, 0, 0, 0, 0, GetWinHwnd(parent), (HMENU)m_windowId, @@ -88,6 +100,17 @@ bool wxButton::Create(wxWindow *parent, NULL ); + if (m_hWnd == 0) + { + wxString msg; +#ifdef __WIN16__ + msg.Printf(wxT("CreateWindowEx failed")); +#else + msg.Printf(wxT("CreateWindowEx failed with error number %ld"), (long) GetLastError()); +#endif + wxFAIL_MSG(msg); + } + // Subclass again for purposes of dialog editing mode SubclassWin(m_hWnd); @@ -259,8 +282,11 @@ long wxButton::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) } else if ( nMsg == WM_LBUTTONDBLCLK ) { - // trick the base class into thinking that this was just a click - nMsg = WM_LBUTTONDOWN; + // emulate a click event to force an owner-drawn button to change its + // appearance - without this, it won't do it + (void)wxControl::MSWWindowProc(WM_LBUTTONDOWN, wParam, lParam); + + // and conitnue with processing the message normally as well } // let the base class do all real processing diff --git a/src/msw/caret.cpp b/src/msw/caret.cpp index cacc6801f5..daf68049e9 100644 --- a/src/msw/caret.cpp +++ b/src/msw/caret.cpp @@ -46,7 +46,9 @@ #ifdef __WIN16__ #define CALL_CARET_API(api, args) api args #else // Win32 - #define CALL_CARET_API(api, args) if ( !api args ) wxLogLastError(#api) + #define CALL_CARET_API(api, args) \ + if ( !api args ) \ + wxLogLastError(_T(#api)) #endif // Win16/32 // =========================================================================== @@ -63,7 +65,7 @@ int wxCaretBase::GetBlinkTime() int blinkTime = ::GetCaretBlinkTime(); if ( !blinkTime ) { - wxLogLastError("GetCaretBlinkTime"); + wxLogLastError(wxT("GetCaretBlinkTime")); } return blinkTime; diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index a92fc1b2d6..c838a433cb 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -31,6 +31,8 @@ #ifndef WX_PRECOMP #include "wx/checkbox.h" #include "wx/brush.h" + #include "wx/dcscreen.h" + #include "wx/settings.h" #endif #include "wx/msw/private.h" @@ -142,29 +144,39 @@ bool wxCheckBox::Create(wxWindow *parent, void wxCheckBox::SetLabel(const wxString& label) { - SetWindowText(GetHwnd(), label); + SetWindowText(GetHwnd(), label); } -#define CHECK_SIZE 13 - wxSize wxCheckBox::DoGetBestSize() const { - int wCheckbox, hCheckbox; + static int s_checkSize = 0; - wxString str = wxGetWindowText(GetHWND()) + " "; + if ( !s_checkSize ) + { + wxScreenDC dc; + dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); + // the height of a standard button in the dialog units is 8, + // translate this to pixels (as one dialog unit is precisely equal to + // 8 character heights, it's just the char height) + s_checkSize = dc.GetCharHeight(); + } + + wxString str = wxGetWindowText(GetHWND()); + + int wCheckbox, hCheckbox; if ( !str.IsEmpty() ) { GetTextExtent(str, &wCheckbox, &hCheckbox); - wCheckbox += CHECK_SIZE; + wCheckbox += s_checkSize + GetCharWidth(); - if ( hCheckbox < CHECK_SIZE ) - hCheckbox = CHECK_SIZE; + if ( hCheckbox < s_checkSize ) + hCheckbox = s_checkSize; } else { - wCheckbox = CHECK_SIZE; - hCheckbox = CHECK_SIZE; + wCheckbox = s_checkSize; + hCheckbox = s_checkSize; } return wxSize(wCheckbox, hCheckbox); @@ -184,7 +196,7 @@ bool wxCheckBox::GetValue() const #ifdef __WIN32__ return (SendMessage(GetHwnd(), BM_GETCHECK, 0, 0) == BST_CHECKED); #else - return ((0x003 & SendMessage(GetHwnd(), BM_GETCHECK, 0, 0)) == 0x003); + return ((0x001 & SendMessage(GetHwnd(), BM_GETCHECK, 0, 0)) == 0x001); #endif } diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index a6144b1da2..87f286d943 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -32,6 +32,7 @@ #include "wx/choice.h" #include "wx/utils.h" #include "wx/log.h" + #include "wx/brush.h" #include "wx/settings.h" #endif @@ -59,17 +60,17 @@ bool wxChoice::Create(wxWindow *parent, if ( !CreateControl(parent, id, pos, size, style, validator, name) ) return FALSE; - long msStyle = WS_CHILD | CBS_DROPDOWNLIST | WS_TABSTOP | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL; + long msStyle = WS_CHILD | CBS_DROPDOWNLIST | WS_TABSTOP | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL /* | WS_CLIPSIBLINGS */; if ( style & wxCB_SORT ) msStyle |= CBS_SORT; - // the experience shows that wxChoice vs. wxComboBox distinction confuses + // Experience shows that wxChoice vs. wxComboBox distinction confuses // quite a few people - try to help them wxASSERT_MSG( !(style & wxCB_DROPDOWN) && !(style & wxCB_READONLY) && !(style & wxCB_SIMPLE), - wxT("this style flag is ignored by wxChoice, you " - "probably want to use a wxComboBox") ); + _T("this style flag is ignored by wxChoice, you ") + _T("probably want to use a wxComboBox") ); if ( !MSWCreateControl(wxT("COMBOBOX"), msStyle) ) return FALSE; @@ -102,7 +103,7 @@ int wxChoice::DoAppend(const wxString& item) int n = (int)SendMessage(GetHwnd(), CB_ADDSTRING, 0, (LONG)item.c_str()); if ( n == CB_ERR ) { - wxLogLastError("SendMessage(CB_ADDSTRING)"); + wxLogLastError(wxT("SendMessage(CB_ADDSTRING)")); } return n; @@ -201,7 +202,7 @@ wxString wxChoice::GetString(int n) const if (len) { if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n, (LPARAM)str.GetWriteBuf(len)) == CB_ERR ) { - wxLogLastError("SendMessage(CB_GETLBTEXT)"); + wxLogLastError(wxT("SendMessage(CB_GETLBTEXT)")); } str.UngetWriteBuf(); } @@ -337,3 +338,36 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return TRUE; } +WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ +#if wxUSE_CTL3D + if ( m_useCtl3D ) + { + HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); + return (WXHBRUSH) hbrush; + } +#endif // wxUSE_CTL3D + + HDC hdc = (HDC)pDC; + if (GetParent()->GetTransparentBackground()) + SetBkMode(hdc, TRANSPARENT); + else + SetBkMode(hdc, OPAQUE); + + wxColour colBack = GetBackgroundColour(); + + if (!IsEnabled()) + colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + + ::SetBkColor(hdc, wxColourToRGB(colBack)); + ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); + + wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); + + return (WXHBRUSH)brush->GetResourceHandle(); +} + + diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index 37f71481b5..9a2d7b327c 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -472,7 +472,7 @@ void wxClipboard::Clear() #if wxUSE_OLE_CLIPBOARD if ( FAILED(OleSetClipboard(NULL)) ) { - wxLogLastError("OleSetClipboard(NULL)"); + wxLogLastError(wxT("OleSetClipboard(NULL)")); } #endif } @@ -482,7 +482,7 @@ bool wxClipboard::Flush() #if wxUSE_OLE_CLIPBOARD if ( FAILED(OleFlushClipboard()) ) { - wxLogLastError("OleFlushClipboard"); + wxLogLastError(wxT("OleFlushClipboard")); return FALSE; } @@ -823,6 +823,6 @@ bool wxClipboard::GetData( wxDataObject& data ) } #else - #error "Please turn wxUSE_CLIPBOARD on to compile this file." +// #error "Please turn wxUSE_CLIPBOARD on to compile this file." #endif // wxUSE_CLIPBOARD diff --git a/src/msw/colordlg.cpp b/src/msw/colordlg.cpp index 66e0a3ef73..3480911ad9 100644 --- a/src/msw/colordlg.cpp +++ b/src/msw/colordlg.cpp @@ -1,43 +1,51 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: colordlg.cpp +// Name: src/msw/colordlg.cpp // Purpose: wxColourDialog class // Author: Julian Smart // Modified by: // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + #ifdef __GNUG__ -#pragma implementation "colordlg.h" + #pragma implementation "colordlg.h" #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif #ifndef WX_PRECOMP -#include <stdio.h> -#include "wx/defs.h" -#include "wx/bitmap.h" -#include "wx/pen.h" -#include "wx/brush.h" -#include "wx/colour.h" -#include "wx/gdicmn.h" -#include "wx/utils.h" -#include "wx/frame.h" -#include "wx/dialog.h" -#include "wx/msgdlg.h" + #include <stdio.h> + #include "wx/defs.h" + #include "wx/bitmap.h" + #include "wx/pen.h" + #include "wx/brush.h" + #include "wx/colour.h" + #include "wx/gdicmn.h" + #include "wx/utils.h" + #include "wx/frame.h" + #include "wx/dialog.h" + #include "wx/msgdlg.h" #endif #include <windows.h> #if !defined(__WIN32__) || defined(__SALFORDC__) || defined(__WXWINE__) -#include <commdlg.h> + #include <commdlg.h> #endif #include "wx/msw/private.h" @@ -48,35 +56,59 @@ #include <stdlib.h> #include <string.h> -#define wxDIALOG_DEFAULT_X 300 -#define wxDIALOG_DEFAULT_Y 300 +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) -/* - * wxColourDialog - */ +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// colour dialog hook proc +// ---------------------------------------------------------------------------- + +UINT CALLBACK wxColourDialogHookProc(HWND hwnd, + UINT uiMsg, + WPARAM wParam, + LPARAM lParam) +{ + if ( uiMsg == WM_INITDIALOG ) + { + CHOOSECOLOR *pCC = (CHOOSECOLOR *)lParam; + wxColourDialog *dialog = (wxColourDialog *)pCC->lCustData; + + ::SetWindowText(hwnd, dialog->GetTitle()); + } + + return 0; +} + +// ---------------------------------------------------------------------------- +// wxColourDialog +// ---------------------------------------------------------------------------- -wxColourDialog::wxColourDialog(void) +wxColourDialog::wxColourDialog() { - m_dialogParent = NULL; } wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data) { - Create(parent, data); + Create(parent, data); } bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) { - m_dialogParent = parent; + m_parent = parent; + if (data) + m_colourData = *data; - if (data) - m_colourData = *data; - return TRUE; + return TRUE; } -int wxColourDialog::ShowModal(void) +int wxColourDialog::ShowModal() { CHOOSECOLOR chooseColorStruct; COLORREF custColours[16]; @@ -84,20 +116,23 @@ int wxColourDialog::ShowModal(void) int i; for (i = 0; i < 16; i++) - custColours[i] = RGB(m_colourData.custColours[i].Red(), m_colourData.custColours[i].Green(), m_colourData.custColours[i].Blue()); + custColours[i] = wxColourToRGB(m_colourData.custColours[i]); chooseColorStruct.lStructSize = sizeof(CHOOSECOLOR); - chooseColorStruct.hwndOwner = (HWND) (m_dialogParent ? (HWND) m_dialogParent->GetHWND() : (HWND) NULL); - chooseColorStruct.rgbResult = RGB(m_colourData.dataColour.Red(), m_colourData.dataColour.Green(), m_colourData.dataColour.Blue()); + if ( m_parent ) + chooseColorStruct.hwndOwner = GetHwndOf(m_parent); + chooseColorStruct.rgbResult = wxColourToRGB(m_colourData.dataColour); chooseColorStruct.lpCustColors = custColours; - chooseColorStruct.Flags = CC_RGBINIT; + chooseColorStruct.Flags = CC_RGBINIT | CC_ENABLEHOOK; + chooseColorStruct.lCustData = (LPARAM)this; + chooseColorStruct.lpfnHook = wxColourDialogHookProc; if (!m_colourData.GetChooseFull()) chooseColorStruct.Flags |= CC_PREVENTFULLOPEN; // Do the modal dialog - bool success = (ChooseColor(&(chooseColorStruct)) != 0); + bool success = ::ChooseColor(&(chooseColorStruct)) != 0; // Try to highlight the correct window (the parent) HWND hWndParent = 0; @@ -112,13 +147,56 @@ int wxColourDialog::ShowModal(void) // Restore values for (i = 0; i < 16; i++) { - m_colourData.custColours[i].Set(GetRValue(custColours[i]), GetGValue(custColours[i]), - GetBValue(custColours[i])); + wxRGBToColour(m_colourData.custColours[i], custColours[i]); } - m_colourData.dataColour.Set(GetRValue(chooseColorStruct.rgbResult), GetGValue(chooseColorStruct.rgbResult), - GetBValue(chooseColorStruct.rgbResult)); + wxRGBToColour(m_colourData.dataColour, chooseColorStruct.rgbResult); return success ? wxID_OK : wxID_CANCEL; } +// ---------------------------------------------------------------------------- +// title +// ---------------------------------------------------------------------------- + +void wxColourDialog::SetTitle(const wxString& title) +{ + m_title = title; +} + +wxString wxColourDialog::GetTitle() +{ + return m_title; +} + +// ---------------------------------------------------------------------------- +// position/size +// ---------------------------------------------------------------------------- + +void wxColourDialog::DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags)) +{ + // ignore - we can't change the size of this standard dialog + return; +} + +// NB: of course, both of these functions are completely bogus, but it's better +// than nothing +void wxColourDialog::DoGetSize(int *width, int *height) const +{ + // the standard dialog size + if ( width ) + *width = 225; + if ( height ) + *height = 324; +} + +void wxColourDialog::DoGetClientSize(int *width, int *height) const +{ + // the standard dialog size + if ( width ) + *width = 219; + if ( height ) + *height = 299; +} diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index f00c1297c9..8626a56849 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: combobox.cpp +// Name: msw/combobox.cpp // Purpose: wxComboBox class // Author: Julian Smart // Modified by: @@ -9,6 +9,14 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + #ifdef __GNUG__ #pragma implementation "combobox.h" #endif @@ -27,11 +35,164 @@ #endif #include "wx/combobox.h" +#include "wx/brush.h" #include "wx/clipbrd.h" #include "wx/msw/private.h" +#if wxUSE_TOOLTIPS + #ifndef __GNUWIN32_OLD__ + #include <commctrl.h> + #endif + #include "wx/tooltip.h" +#endif // wxUSE_TOOLTIPS + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) +// ---------------------------------------------------------------------------- +// function prototypes +// ---------------------------------------------------------------------------- + +LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, + UINT message, + WPARAM wParam, + LPARAM lParam); + +// --------------------------------------------------------------------------- +// global vars +// --------------------------------------------------------------------------- + +// the pointer to standard radio button wnd proc +static WXFARPROC gs_wndprocEdit = (WXFARPROC)NULL; + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wnd proc for subclassed edit control +// ---------------------------------------------------------------------------- + +LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, + UINT message, + WPARAM wParam, + LPARAM lParam) +{ + HWND hwndCombo = ::GetParent(hWnd); + wxWindow *win = wxFindWinFromHandle((WXHWND)hwndCombo); + + switch ( message ) + { + // forward some messages to the combobox + case WM_KEYUP: + case WM_KEYDOWN: + case WM_CHAR: + { + wxComboBox *combo = wxDynamicCast(win, wxComboBox); + wxCHECK_MSG( combo, 0, _T("should have combo as parent") ); + + if ( combo->MSWProcessEditMsg(message, wParam, lParam) ) + return 0; + } + break; + +#if 0 + case WM_GETDLGCODE: + { + wxCHECK_MSG( win, 0, _T("should have a parent") ); + + if ( win->GetWindowStyle() & wxPROCESS_ENTER ) + { + // need to return a custom dlg code or we'll never get it + return DLGC_WANTMESSAGE; + } + } + break; +#endif // 0 + + // deal with tooltips here +#if wxUSE_TOOLTIPS + case WM_NOTIFY: + { + wxCHECK_MSG( win, 0, _T("should have a parent") ); + + NMHDR* hdr = (NMHDR *)lParam; + if ( (int)hdr->code == TTN_NEEDTEXT ) + { + wxToolTip *tooltip = win->GetToolTip(); + if ( tooltip ) + { + TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam; + ttt->lpszText = (wxChar *)tooltip->GetTip().c_str(); + } + + // processed + return 0; + } + } + break; +#endif // wxUSE_TOOLTIPS + } + + return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam); +} + +WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ +#if wxUSE_CTL3D + if ( m_useCtl3D ) + { + HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); + return (WXHBRUSH) hbrush; + } +#endif // wxUSE_CTL3D + + HDC hdc = (HDC)pDC; + if (GetParent()->GetTransparentBackground()) + SetBkMode(hdc, TRANSPARENT); + else + SetBkMode(hdc, OPAQUE); + + wxColour colBack = GetBackgroundColour(); + + if (!IsEnabled()) + colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + + ::SetBkColor(hdc, wxColourToRGB(colBack)); + ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); + + wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); + + return (WXHBRUSH)brush->GetResourceHandle(); +} + +// ---------------------------------------------------------------------------- +// wxComboBox +// ---------------------------------------------------------------------------- + +bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam) +{ + switch ( msg ) + { + case WM_CHAR: + return HandleChar(wParam, lParam, TRUE /* isASCII */); + + case WM_KEYDOWN: + return HandleKeyDown(wParam, lParam); + + case WM_KEYUP: + return HandleKeyUp(wParam, lParam); + } + + return FALSE; +} + bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) { switch ( param ) @@ -62,6 +223,24 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return FALSE; } +WXHWND wxComboBox::GetEditHWND() const +{ + // this function should not be called for wxCB_READONLY controls, it is + // the callers responsability to check this + wxASSERT_MSG( !(GetWindowStyle() & wxCB_READONLY), + _T("read-only combobox doesn't have any edit control") ); + + POINT pt; + pt.x = pt.y = 4; + HWND hwndEdit = ::ChildWindowFromPoint(GetHwnd(), pt); + if ( !hwndEdit || hwndEdit == GetHwnd() ) + { + wxFAIL_MSG(_T("not read only combobox without edit control?")); + } + + return (WXHWND)hwndEdit; +} + bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, @@ -71,90 +250,61 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - SetName(name); -#if wxUSE_VALIDATORS - SetValidator(validator); -#endif // wxUSE_VALIDATORS - if (parent) parent->AddChild(this); -// SetBackgroundColour(parent->GetBackgroundColour()) ; - - // A choice/combobox normally has a white background (or other, depending - // on global settings) rather than inheriting the parent's background colour. - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); - - SetForegroundColour(parent->GetForegroundColour()) ; - - m_windowStyle = style; - - if ( id == -1 ) - m_windowId = (int)NewControlId(); - else - m_windowId = id; - - int x = pos.x; - int y = pos.y; - int width = size.x; - int height = size.y; - - long msStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE | - WS_VSCROLL | WS_HSCROLL | CBS_AUTOHSCROLL | CBS_NOINTEGRALHEIGHT; - - if (m_windowStyle & wxCB_READONLY) - msStyle |= CBS_DROPDOWNLIST; - else if (m_windowStyle & wxCB_SIMPLE) - msStyle |= CBS_SIMPLE; // A list (shown always) and edit control - else - msStyle |= CBS_DROPDOWN; - - if (m_windowStyle & wxCB_SORT) - msStyle |= CBS_SORT; - - bool want3D; - WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; - - // Even with extended styles, need to combine with WS_BORDER - // for them to look right. - if ( want3D || wxStyleHasBorder(m_windowStyle) ) - msStyle |= WS_BORDER; - - m_hWnd = (WXHWND)::CreateWindowEx(exStyle, wxT("COMBOBOX"), NULL, - msStyle, - 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, - wxGetInstance(), NULL); - - wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create combobox") ); - -/* -#if wxUSE_CTL3D - if (want3D) - { - Ctl3dSubclassCtl(wx_combo); - m_useCtl3D = TRUE; - } -#endif -*/ - - // Subclass again for purposes of dialog editing mode - SubclassWin(m_hWnd); - - SetFont(parent->GetFont()); - int i; - for (i = 0; i < n; i++) - { - Append(choices[i]); - } + // first create wxWin object + if ( !CreateControl(parent, id, pos, size, style, validator, name) ) + return FALSE; + + // get the right style + long msStyle = WS_TABSTOP | WS_VSCROLL | WS_HSCROLL | + CBS_AUTOHSCROLL | CBS_NOINTEGRALHEIGHT /* | WS_CLIPSIBLINGS */; + if ( style & wxCB_READONLY ) + msStyle |= CBS_DROPDOWNLIST; + else if ( style & wxCB_SIMPLE ) + msStyle |= CBS_SIMPLE; // A list (shown always) and edit control + else + msStyle |= CBS_DROPDOWN; + + if ( style & wxCB_SORT ) + msStyle |= CBS_SORT; + + // and now create the MSW control + if ( !MSWCreateControl(_T("COMBOBOX"), msStyle) ) + return FALSE; + + SetSize(pos.x, pos.y, size.x, size.y); + + // A choice/combobox normally has a white background (or other, depending + // on global settings) rather than inheriting the parent's background colour. + SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); + + for ( int i = 0; i < n; i++ ) + { + Append(choices[i]); + } - SetSelection(i); + if ( !value.IsEmpty() ) + { + SetValue(value); + } - SetSize(x, y, width, height); - if ( !value.IsEmpty() ) - { - SetValue(value); - } + // a (not read only) combobox is, in fact, 2 controls: the combobox itself + // and an edit control inside it and if we want to catch events from this + // edit control, we must subclass it as well + if ( !(style & wxCB_READONLY) ) + { + gs_wndprocEdit = (WXFARPROC)::SetWindowLong + ( + (HWND)GetEditHWND(), + GWL_WNDPROC, + (LPARAM)wxComboEditWndProc + ); + } - return TRUE; + return TRUE; } +// TODO: update and clear all this horrible mess (VZ) + void wxComboBox::SetValue(const wxString& value) { // If newlines are denoted by just 10, must stick 13 in front. @@ -329,6 +479,19 @@ void wxComboBox::SetSelection(long from, long to) void wxComboBox::DoMoveWindow(int x, int y, int width, int height) { + // here is why this is necessary: if the width is negative, the combobox + // window proc makes the window of the size width*height instead of + // interpreting height in the usual manner (meaning the height of the drop + // down list - usually the height specified in the call to MoveWindow() + // will not change the height of combo box per se) + // + // this behaviour is not documented anywhere, but this is just how it is + // here (NT 4.4) and, anyhow, the check shouldn't hurt - however without + // the check, constraints/sizers using combos may break the height + // constraint will have not at all the same value as expected + if ( width < 0 ) + return; + int cx, cy; wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); @@ -336,12 +499,10 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height) // default and also 10 items max (if we always use n, the list will never // have vertical scrollbar) int n = GetCount(); - if ( !n ) - n = 10; - else if ( n > 10 ) + if ( !n || (n > 10) ) n = 10; - height = n * EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); + height = (n + 1)* EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); wxControl::DoMoveWindow(x, y, width, height); } diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 1a8d53a18e..656d3f45c2 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -79,9 +79,11 @@ bool wxControl::MSWCreateControl(const wxChar *classname, const wxString& label, WXDWORD exstyle) { - // VZ: if someone could put a comment here explaining what exactly this is - // needed for, it would be nice... - bool want3D; + // want3D tells us whether or not the style specified a 3D border. + // If so, under WIN16 we can use Ctl3D to give it an appropriate style. + // Sometimes want3D is used to indicate that the non-extended style should have + // WS_BORDER. + bool want3D = TRUE; // if no extended style given, determine it ourselves if ( exstyle == (WXDWORD)-1 ) @@ -89,7 +91,7 @@ bool wxControl::MSWCreateControl(const wxChar *classname, exstyle = GetExStyle(style, &want3D); } - // all controls have these childs (wxWindows creates all controls visible + // all controls have these styles (wxWindows creates all controls visible // by default) style |= WS_CHILD | WS_VISIBLE; @@ -109,9 +111,8 @@ bool wxControl::MSWCreateControl(const wxChar *classname, if ( !m_hWnd ) { -#ifdef __WXDEBUG__ - wxLogError(wxT("Failed to create a control of class '%s'"), classname); -#endif // DEBUG + wxLogDebug(wxT("Failed to create a control of class '%s'"), classname); + wxFAIL_MSG(_T("something is very wrong")); return FALSE; } @@ -240,7 +241,8 @@ WXHBRUSH wxControl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, else SetBkMode(hdc, OPAQUE); - const wxColour& colBack = GetBackgroundColour(); + wxColour colBack = GetBackgroundColour(); + ::SetBkColor(hdc, wxColourToRGB(colBack)); ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); diff --git a/src/msw/curico.cpp b/src/msw/curico.cpp index 1629b21398..c8df51825e 100644 --- a/src/msw/curico.cpp +++ b/src/msw/curico.cpp @@ -99,7 +99,7 @@ HANDLE ReadIcon( wxChar *szFileName, int *W, int *H) nDirEntries = 0; // Open and read the .ICO file header and the first ICONFILERES - hFile = _lopen( wxFNCONV(szFileName), OF_READ); + hFile = _lopen( wxConvertWX2MB(szFileName), OF_READ); cbHead = _lread( hFile, (LPSTR)&iconFileHead, sizeof(ICONFILEHEADER)); cbRes = _lread( hFile, (LPSTR)&iconFileRes, sizeof(ICONFILERES)); ++nDirEntries; @@ -346,7 +346,7 @@ HANDLE ReadCur( wxChar *szFileName, LPPOINT lpptHotSpot, int *W, int *H) nDirEntries = 0; // Open and read the .ICO file header and the first ICONFILERES - hFile = _lopen( wxFNCONV(szFileName), OF_READ); + hFile = _lopen( wxConvertWX2MB(szFileName), OF_READ); cbHead = _lread( hFile, (LPSTR )&curFileHead, sizeof( CURFILEHEADER)); cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES)); ++nDirEntries; diff --git a/src/msw/data.cpp b/src/msw/data.cpp index 1b24fc3e3a..0a9c7286a2 100644 --- a/src/msw/data.cpp +++ b/src/msw/data.cpp @@ -37,20 +37,13 @@ wxWindowList wxTopLevelWindows; // List of windows pending deletion wxList WXDLLEXPORT wxPendingDelete; -// Custom OS version, as optionally placed in wx.ini/.wxrc -// Currently this can be Win95, Windows, Win32s, WinNT. -// For some systems, you can't tell until run-time what services you -// have. See wxGetOsVersion, which uses this string if present. -char *wxOsVersion = NULL; - int wxPageNumber; // GDI Object Lists -wxBrushList *wxTheBrushList = NULL; -wxPenList *wxThePenList = NULL; wxFontList *wxTheFontList = NULL; -wxBitmapList *wxTheBitmapList = NULL; - +wxPenList *wxThePenList = NULL; +wxBrushList *wxTheBrushList = NULL; +wxBitmapList *wxTheBitmapList = NULL; wxColourDatabase *wxTheColourDatabase = NULL; // Stock objects @@ -58,8 +51,8 @@ wxFont *wxNORMAL_FONT; wxFont *wxSMALL_FONT; wxFont *wxITALIC_FONT; wxFont *wxSWISS_FONT; -wxPen *wxRED_PEN; +wxPen *wxRED_PEN; wxPen *wxCYAN_PEN; wxPen *wxGREEN_PEN; wxPen *wxBLACK_PEN; @@ -95,14 +88,14 @@ wxCursor *wxCROSS_CURSOR = NULL; // 'Null' objects wxAcceleratorTable wxNullAcceleratorTable; -wxBitmap wxNullBitmap; -wxIcon wxNullIcon; -wxCursor wxNullCursor; -wxPen wxNullPen; -wxBrush wxNullBrush; +wxBitmap wxNullBitmap; +wxIcon wxNullIcon; +wxCursor wxNullCursor; +wxPen wxNullPen; +wxBrush wxNullBrush; wxPalette wxNullPalette; -wxFont wxNullFont; -wxColour wxNullColour; +wxFont wxNullFont; +wxColour wxNullColour; // Default window names const wxChar *wxControlNameStr = wxT("control"); diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 737f7235e6..b9d10eac95 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -82,10 +82,87 @@ static const int MM_METRIC = 10; // convert degrees to radians static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// instead of duplicating the same code which sets and then restores text +// colours in each wxDC method working with wxSTIPPLE_MASK_OPAQUE brushes, +// encapsulate this in a small helper class + +// wxColourChanger: changes the text colours in the ctor if required and +// restores them in the dtor +class wxColourChanger +{ +public: + wxColourChanger(wxDC& dc); + ~wxColourChanger(); + +private: + wxDC& m_dc; + + COLORREF m_colFgOld, m_colBgOld; + + bool m_changed; +}; + // =========================================================================== // implementation // =========================================================================== +// ---------------------------------------------------------------------------- +// wxColourChanger +// ---------------------------------------------------------------------------- + +wxColourChanger::wxColourChanger(wxDC& dc) : m_dc(dc) +{ + if ( dc.GetBrush().GetStyle() == wxSTIPPLE_MASK_OPAQUE ) + { + HDC hdc = GetHdcOf(dc); + m_colFgOld = ::GetTextColor(hdc); + m_colBgOld = ::GetBkColor(hdc); + + // note that Windows convention is opposite to wxWindows one, this is + // why text colour becomes the background one and vice versa + const wxColour& colFg = dc.GetTextForeground(); + if ( colFg.Ok() ) + { + ::SetBkColor(hdc, colFg.GetPixel()); + } + + const wxColour& colBg = dc.GetTextBackground(); + if ( colBg.Ok() ) + { + ::SetTextColor(hdc, colBg.GetPixel()); + } + + SetBkMode(hdc, + dc.GetBackgroundMode() == wxTRANSPARENT ? TRANSPARENT + : OPAQUE); + + // flag which telsl us to undo changes in the dtor + m_changed = TRUE; + } + else + { + // nothing done, nothing to undo + m_changed = FALSE; + } +} + +wxColourChanger::~wxColourChanger() +{ + if ( m_changed ) + { + // restore the colours we changed + HDC hdc = GetHdcOf(m_dc); + + ::SetBkMode(hdc, TRANSPARENT); + ::SetTextColor(hdc, m_colFgOld); + ::SetBkColor(hdc, m_colBgOld); + } +} + // --------------------------------------------------------------------------- // wxDC // --------------------------------------------------------------------------- @@ -303,7 +380,7 @@ void wxDC::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style) // * The point is outside the clipping region that is, it is not // visible on the device. // - wxLogLastError("ExtFloodFill"); + wxLogLastError(wxT("ExtFloodFill")); } CalcBoundingBox(x, y); @@ -311,31 +388,12 @@ void wxDC::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style) bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const { + wxCHECK_MSG( col, FALSE, _T("NULL colour parameter in wxDC::GetPixel") ); + // get the color of the pixel COLORREF pixelcolor = ::GetPixel(GetHdc(), XLOG2DEV(x), YLOG2DEV(y)); - // JACS: what was this for? -#if 0 - // get the color of the pen - COLORREF pencolor = 0x00ffffff; - if (m_pen.Ok()) - { - pencolor = m_pen.GetColour().GetPixel(); - } -#endif - - // return the color of the pixel - if( col ) - { - col->Set(GetRValue(pixelcolor), - GetGValue(pixelcolor), - GetBValue(pixelcolor)); - } - - // check, if color of the pixels is the same as the color of the current - // pen and return TRUE if it is, FALSE otherwise - // JACS, 24/02/2000: can't understand the reason for this, so returning TRUE instead. - // return pixelcolor == pencolor; + wxRGBToColour(*col, pixelcolor); return TRUE; } @@ -370,39 +428,23 @@ void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) CalcBoundingBox(x2, y2); } -void wxDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2, wxCoord xc, wxCoord yc) +// Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1) +// and ending at (x2, y2) +void wxDC::DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) { - COLORREF colFgOld = 0, - colBgOld = 0; + wxColourChanger cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling - if (m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) - { - colFgOld = ::GetTextColor(GetHdc()); - colBgOld = ::GetBkColor(GetHdc()); - - if (m_textForegroundColour.Ok()) - { //just the oposite from what is expected see help on pattern brush - // 1 in mask becomes bk color - ::SetBkColor(GetHdc(), m_textForegroundColour.GetPixel() ); - } - if (m_textBackgroundColour.Ok()) - { //just the oposite from what is expected - // 0 in mask becomes text color - ::SetTextColor(GetHdc(), m_textBackgroundColour.GetPixel() ); - } - - if (m_backgroundMode == wxTRANSPARENT) - SetBkMode(GetHdc(), TRANSPARENT); - else - SetBkMode(GetHdc(), OPAQUE); - } + double dx = xc - x1; + double dy = yc - y1; + double radius = (double)sqrt(dx*dx+dy*dy); + wxCoord r = (wxCoord)radius; - double dx = xc-x1; - double dy = yc-y1; - double radius = (double)sqrt(dx*dx+dy*dy) ;; - if (x1==x2 && x2==y2) + // treat the special case of full circle separately + if ( x1 == x2 && y1 == y2 ) { - DrawEllipse(xc,yc,(wxCoord)(radius*2.0),(wxCoord)(radius*2.0)); + DrawEllipse(xc - r, yc - r, 2*r, 2*r); return; } @@ -414,35 +456,27 @@ void wxDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2, wxCoord xc, wx wxCoord yyc = YLOG2DEV(yc); wxCoord ray = (wxCoord) sqrt(double((xxc-xx1)*(xxc-xx1)+(yyc-yy1)*(yyc-yy1))); - (void)MoveToEx(GetHdc(), (int) xx1, (int) yy1, NULL); wxCoord xxx1 = (wxCoord) (xxc-ray); wxCoord yyy1 = (wxCoord) (yyc-ray); wxCoord xxx2 = (wxCoord) (xxc+ray); wxCoord yyy2 = (wxCoord) (yyc+ray); - if (m_brush.Ok() && m_brush.GetStyle() !=wxTRANSPARENT) + + if ( m_brush.Ok() && m_brush.GetStyle() != wxTRANSPARENT ) { // Have to add 1 to bottom-right corner of rectangle // to make semi-circles look right (crooked line otherwise). // Unfortunately this is not a reliable method, depends // on the size of shape. // TODO: figure out why this happens! - Pie(GetHdc(),xxx1,yyy1,xxx2+1,yyy2+1, - xx1,yy1,xx2,yy2); + Pie(GetHdc(),xxx1,yyy1,xxx2+1,yyy2+1, xx1,yy1,xx2,yy2); } else - Arc(GetHdc(),xxx1,yyy1,xxx2,yyy2, - xx1,yy1,xx2,yy2); - - CalcBoundingBox((wxCoord)(xc-radius), (wxCoord)(yc-radius)); - CalcBoundingBox((wxCoord)(xc+radius), (wxCoord)(yc+radius)); - - if ( m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) { - // restore the colours we changed - ::SetBkMode(GetHdc(), TRANSPARENT); - ::SetTextColor(GetHdc(), colFgOld); - ::SetBkColor(GetHdc(), colBgOld); + Arc(GetHdc(),xxx1,yyy1,xxx2,yyy2, xx1,yy1,xx2,yy2); } + + CalcBoundingBox(xc - r, yc - r); + CalcBoundingBox(xc + r, yc + r); } void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, @@ -495,30 +529,7 @@ void wxDC::DoDrawPoint(wxCoord x, wxCoord y) void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle) { - COLORREF colFgOld = 0, - colBgOld = 0; - - if (m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) - { - colFgOld = ::GetTextColor(GetHdc()); - colBgOld = ::GetBkColor(GetHdc()); - - if (m_textForegroundColour.Ok()) - { //just the oposite from what is expected see help on pattern brush - // 1 in mask becomes bk color - ::SetBkColor(GetHdc(), m_textForegroundColour.GetPixel() ); - } - if (m_textBackgroundColour.Ok()) - { //just the oposite from what is expected - // 0 in mask becomes text color - ::SetTextColor(GetHdc(), m_textBackgroundColour.GetPixel() ); - } - - if (m_backgroundMode == wxTRANSPARENT) - SetBkMode(GetHdc(), TRANSPARENT); - else - SetBkMode(GetHdc(), OPAQUE); - } + wxColourChanger cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling // Do things less efficiently if we have offsets if (xoffset != 0 || yoffset != 0) @@ -547,14 +558,6 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffs (void)Polygon(GetHdc(), (POINT*) points, n); SetPolyFillMode(GetHdc(),prev); } - - if ( m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) - { - // restore the colours we changed - ::SetBkMode(GetHdc(), TRANSPARENT); - ::SetTextColor(GetHdc(), colFgOld); - ::SetBkColor(GetHdc(), colBgOld); - } } void wxDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) @@ -586,31 +589,7 @@ void wxDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { - COLORREF colFgOld = 0, - colBgOld = 0; - - if ( m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) - { - colFgOld = ::GetTextColor(GetHdc()); - colBgOld = ::GetBkColor(GetHdc()); - - if ( m_textForegroundColour.Ok() ) - { - // just the oposite from what is expected see help on pattern brush - // 1 in mask becomes bk color - ::SetBkColor(GetHdc(), m_textForegroundColour.GetPixel()); - } - - if ( m_textBackgroundColour.Ok() ) - { - // 0 in mask becomes text color - ::SetTextColor(GetHdc(), m_textBackgroundColour.GetPixel()); - } - - // VZ: IMHO this does strictly nothing here - SetBkMode(GetHdc(), m_backgroundMode == wxTRANSPARENT ? TRANSPARENT - : OPAQUE); - } + wxColourChanger cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling wxCoord x2 = x + width; wxCoord y2 = y + height; @@ -628,7 +607,7 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { // Windows draws the filled rectangles without outline (i.e. drawn with a // transparent pen) one pixel smaller in both directions and we want them - // to have the same size regardless of which pen is used - adjust + // to have the same size regardless of which pen is used - adjust // I wonder if this shouldn´t be done after the LOG2DEV() conversions. RR. if ( m_pen.GetStyle() == wxTRANSPARENT ) @@ -637,49 +616,17 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) y2++; } - (void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2)); + (void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2)); } CalcBoundingBox(x, y); CalcBoundingBox(x2, y2); - - if ( m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) - { - // restore the colours we changed - ::SetBkMode(GetHdc(), TRANSPARENT); - ::SetTextColor(GetHdc(), colFgOld); - ::SetBkColor(GetHdc(), colBgOld); - } } void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) { - COLORREF colFgOld = 0, - colBgOld = 0; - - if ( m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) - { - colFgOld = ::GetTextColor(GetHdc()); - colBgOld = ::GetBkColor(GetHdc()); - - if ( m_textForegroundColour.Ok() ) - { - // just the oposite from what is expected see help on pattern brush - // 1 in mask becomes bk color - ::SetBkColor(GetHdc(), m_textForegroundColour.GetPixel()); - } - - if ( m_textBackgroundColour.Ok() ) - { - // 0 in mask becomes text color - ::SetTextColor(GetHdc(), m_textBackgroundColour.GetPixel()); - } - - // VZ: IMHO this does strictly nothing here - SetBkMode(GetHdc(), m_backgroundMode == wxTRANSPARENT ? TRANSPARENT - : OPAQUE); - } + wxColourChanger cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling // Now, a negative radius value is interpreted to mean // 'the proportion of the smallest X or Y dimension' @@ -711,43 +658,11 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h CalcBoundingBox(x, y); CalcBoundingBox(x2, y2); - - if ( m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) - { - // restore the colours we changed - ::SetBkMode(GetHdc(), TRANSPARENT); - ::SetTextColor(GetHdc(), colFgOld); - ::SetBkColor(GetHdc(), colBgOld); - } } void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { - COLORREF colFgOld = 0, - colBgOld = 0; - - if ( m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) - { - colFgOld = ::GetTextColor(GetHdc()); - colBgOld = ::GetBkColor(GetHdc()); - - if ( m_textForegroundColour.Ok() ) - { - // just the oposite from what is expected see help on pattern brush - // 1 in mask becomes bk color - ::SetBkColor(GetHdc(), m_textForegroundColour.GetPixel()); - } - - if ( m_textBackgroundColour.Ok() ) - { - // 0 in mask becomes text color - ::SetTextColor(GetHdc(), m_textBackgroundColour.GetPixel()); - } - - // VZ: IMHO this does strictly nothing here - SetBkMode(GetHdc(), m_backgroundMode == wxTRANSPARENT ? TRANSPARENT - : OPAQUE); - } + wxColourChanger cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling wxCoord x2 = (x+width); wxCoord y2 = (y+height); @@ -756,47 +671,15 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) CalcBoundingBox(x, y); CalcBoundingBox(x2, y2); - - if ( m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) - { - // restore the colours we changed - ::SetBkMode(GetHdc(), TRANSPARENT); - ::SetTextColor(GetHdc(), colFgOld); - ::SetBkColor(GetHdc(), colBgOld); - } } // Chris Breeze 20/5/98: first implementation of DrawEllipticArc on Windows void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) { - COLORREF colFgOld = 0, - colBgOld = 0; - - if ( m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) - { - colFgOld = ::GetTextColor(GetHdc()); - colBgOld = ::GetBkColor(GetHdc()); + wxColourChanger cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling - if ( m_textForegroundColour.Ok() ) - { - // just the oposite from what is expected see help on pattern brush - // 1 in mask becomes bk color - ::SetBkColor(GetHdc(), m_textForegroundColour.GetPixel()); - } - - if ( m_textBackgroundColour.Ok() ) - { - // 0 in mask becomes text color - ::SetTextColor(GetHdc(), m_textBackgroundColour.GetPixel()); - } - - // VZ: IMHO this does strictly nothing here - SetBkMode(GetHdc(), m_backgroundMode == wxTRANSPARENT ? TRANSPARENT - : OPAQUE); - } - - wxCoord x2 = (x+w); - wxCoord y2 = (y+h); + wxCoord x2 = x + w; + wxCoord y2 = y + h; int rx1 = XLOG2DEV(x+w/2); int ry1 = YLOG2DEV(y+h/2); @@ -813,38 +696,36 @@ void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,d // draw pie with NULL_PEN first and then outline otherwise a line is // drawn from the start and end points to the centre - HPEN orig_pen = (HPEN) ::SelectObject(GetHdc(), (HPEN) ::GetStockObject(NULL_PEN)); + HPEN hpenOld = (HPEN) ::SelectObject(GetHdc(), (HPEN) ::GetStockObject(NULL_PEN)); if (m_signY > 0) { (void)Pie(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2)+1, YLOG2DEV(y2)+1, - rx1, ry1, rx2, ry2); + rx1, ry1, rx2, ry2); } else { (void)Pie(GetHdc(), XLOG2DEV(x), YLOG2DEV(y)-1, XLOG2DEV(x2)+1, YLOG2DEV(y2), - rx1, ry1-1, rx2, ry2-1); + rx1, ry1-1, rx2, ry2-1); } - ::SelectObject(GetHdc(), orig_pen); + + ::SelectObject(GetHdc(), hpenOld); + (void)Arc(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2), - rx1, ry1, rx2, ry2); + rx1, ry1, rx2, ry2); CalcBoundingBox(x, y); CalcBoundingBox(x2, y2); - - if ( m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE ) - { - // restore the colours we changed - ::SetBkMode(GetHdc(), TRANSPARENT); - ::SetTextColor(GetHdc(), colFgOld); - ::SetBkColor(GetHdc(), colBgOld); - } } void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) { wxCHECK_RET( icon.Ok(), wxT("invalid icon in DrawIcon") ); +#ifdef __WIN32__ + ::DrawIconEx(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon), icon.GetWidth(), icon.GetHeight(), 0, NULL, DI_NORMAL); +#else ::DrawIcon(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon)); +#endif CalcBoundingBox(x, y); CalcBoundingBox(x + icon.GetWidth(), y + icon.GetHeight()); @@ -958,7 +839,7 @@ void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) if ( ::TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), text.c_str(), text.length()) == 0 ) { - wxLogLastError("TextOut"); + wxLogLastError(wxT("TextOut")); } // restore the old parameters (text foreground colour may be left because @@ -991,7 +872,7 @@ void wxDC::DoDrawRotatedText(const wxString& text, LOGFONT lf; if ( ::GetObject(hfont, sizeof(lf), &lf) == 0 ) { - wxLogLastError("GetObject(hfont)"); + wxLogLastError(wxT("GetObject(hfont)")); } // GDI wants the angle in tenth of degree @@ -1002,7 +883,7 @@ void wxDC::DoDrawRotatedText(const wxString& text, hfont = ::CreateFontIndirect(&lf); if ( !hfont ) { - wxLogLastError("CreateFont"); + wxLogLastError(wxT("CreateFont")); } else { @@ -1578,14 +1459,14 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, if ( !::BitBlt(dc_buffer, 0, 0, (int)width, (int)height, GetHdc(), xdest, ydest, SRCCOPY) ) { - wxLogLastError("BitBlt"); + wxLogLastError(wxT("BitBlt")); } // copy src to buffer using selected raster op if ( !::BitBlt(dc_buffer, 0, 0, (int)width, (int)height, GetHdcOf(*source), xsrc, ysrc, dwRop) ) { - wxLogLastError("BitBlt"); + wxLogLastError(wxT("BitBlt")); } // set masked area in buffer to BLACK (pixel value 0) @@ -1594,7 +1475,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, if ( !::BitBlt(dc_buffer, 0, 0, (int)width, (int)height, dc_mask, xsrc, ysrc, SRCAND) ) { - wxLogLastError("BitBlt"); + wxLogLastError(wxT("BitBlt")); } // set unmasked area in dest to BLACK @@ -1603,7 +1484,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, if ( !::BitBlt(GetHdc(), xdest, ydest, (int)width, (int)height, dc_mask, xsrc, ysrc, SRCAND) ) { - wxLogLastError("BitBlt"); + wxLogLastError(wxT("BitBlt")); } ::SetBkColor(GetHdc(), prevBkCol); // restore colours to original values ::SetTextColor(GetHdc(), prevCol); @@ -1614,7 +1495,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, dc_buffer, 0, 0, SRCPAINT) != 0; if ( !success ) { - wxLogLastError("BitBlt"); + wxLogLastError(wxT("BitBlt")); } // tidy up temporary DCs and bitmap @@ -1632,7 +1513,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, GetHdcOf(*source), xsrc, ysrc, dwRop) != 0; if ( !success ) { - wxLogLastError("BitBlt"); + wxLogLastError(wxT("BitBlt")); } } ::SetTextColor(GetHdc(), old_textground); diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index ca1caadb27..483fd55376 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -110,7 +110,7 @@ wxWindowDC::~wxWindowDC() if ( !::ReleaseDC(GetWinHwnd(m_canvas), GetHdc()) ) { - wxLogLastError("ReleaseDC"); + wxLogLastError(wxT("ReleaseDC")); } m_hDC = 0; diff --git a/src/msw/dcmemory.cpp b/src/msw/dcmemory.cpp index a5f196584e..cb5a8a8abc 100644 --- a/src/msw/dcmemory.cpp +++ b/src/msw/dcmemory.cpp @@ -102,8 +102,7 @@ void wxMemoryDC::SelectObject(const wxBitmap& bitmap) // check for whether the bitmap is already selected into a device context wxCHECK_RET( !bitmap.GetSelectedInto() || (bitmap.GetSelectedInto() == this), - wxT("Bitmap is selected in another wxMemoryDC, delete the " - "first wxMemoryDC or use SelectObject(NULL)") ); + wxT("Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(NULL)") ); m_selectedBitmap = bitmap; WXHBITMAP hBmp = m_selectedBitmap.GetHBITMAP(); @@ -115,7 +114,7 @@ void wxMemoryDC::SelectObject(const wxBitmap& bitmap) if ( !hBmp ) { - wxLogLastError("SelectObject(memDC, bitmap)"); + wxLogLastError(wxT("SelectObject(memDC, bitmap)")); wxFAIL_MSG(wxT("Couldn't select a bitmap into wxMemoryDC")); } diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index c39d15dc3f..e8ccc8bac8 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -35,6 +35,8 @@ #include "wx/dcmemory.h" #endif +#if wxUSE_PRINTING_ARCHITECTURE + #include "wx/msw/private.h" #include "wx/dcprint.h" #include "math.h" @@ -456,7 +458,7 @@ void wxPrinterDC::DoDrawBitmap(const wxBitmap &bmp, bits, info, DIB_RGB_COLORS, SRCCOPY) == GDI_ERROR ) { - wxLogLastError("StretchDIBits"); + wxLogLastError(wxT("StretchDIBits")); } } @@ -538,7 +540,7 @@ bool wxPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest, if ( !::GetDIBits(display, GetHbitmapOf(bmp), 0, height, bits, info, DIB_RGB_COLORS) ) { - wxLogLastError("GetDIBits"); + wxLogLastError(wxT("GetDIBits")); success = FALSE; } @@ -554,7 +556,7 @@ bool wxPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest, SRCCOPY) != GDI_ERROR; if ( !success ) { - wxLogLastError("StretchDIBits"); + wxLogLastError(wxT("StretchDIBits")); } } @@ -593,3 +595,6 @@ bool wxPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest, return success; } + +#endif + // wxUSE_PRINTING_ARCHITECTURE diff --git a/src/msw/dde.cpp b/src/msw/dde.cpp index de0a404346..f3fba5f994 100644 --- a/src/msw/dde.cpp +++ b/src/msw/dde.cpp @@ -398,8 +398,7 @@ wxConnectionBase *wxDDEClient::MakeConnection(const wxString& WXUNUSED(host), (PCONVCONTEXT)NULL); if ( !hConv ) { - DDELogError(wxString::Format(_("Failed to create connection to " - "server '%s' on topic '%s'"), + DDELogError(wxString::Format(_("Failed to create connection to server '%s' on topic '%s'"), server.c_str(), topic.c_str())); } else @@ -761,7 +760,7 @@ _DDECallback(WORD wType, if (data) { if (user_size < 0) - user_size = wxStrlen(data) + 1; + user_size = wxStrlen((wxChar*)data) + 1; HDDEDATA handle = DdeCreateDataHandle(DDEIdInst, (LPBYTE)data, @@ -792,7 +791,7 @@ _DDECallback(WORD wType, connection->OnPoke(connection->m_topicName, item_name, - connection->m_bufPtr, + (wxChar*)connection->m_bufPtr, (int)len, (wxIPCFormat) wFmt); @@ -918,7 +917,7 @@ static HSZ DDEAtomFromString(const wxString& s) { wxASSERT_MSG( DDEIdInst, _T("DDE not initialized") ); - HSZ hsz = DdeCreateStringHandle(DDEIdInst, (char*) s.c_str(), DDE_CP); + HSZ hsz = DdeCreateStringHandle(DDEIdInst, (wxChar*) s.c_str(), DDE_CP); if ( !hsz ) { DDELogError(_("Failed to create DDE string")); diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 4a0102db14..23ea6b6d81 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -116,8 +116,7 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id, SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); SetName(name); - if (!parent) - wxTopLevelWindows.Append(this); + wxTopLevelWindows.Append(this); // windowFont = wxTheFontList->FindOrCreateFont(11, wxSWISS, wxNORMAL, wxNORMAL); @@ -174,7 +173,7 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id, if ( !hwnd ) { - wxLogError(_("Failed to create dialog.")); + wxFAIL_MSG(_("Failed to create dialog. You probably forgot to include wx/msw/wx.rc in your resources.")); return FALSE; } @@ -324,52 +323,62 @@ bool wxDialog::IsModalShowing() const void wxDialog::DoShowModal() { wxCHECK_RET( !IsModalShowing(), _T("DoShowModal() called twice") ); + wxCHECK_RET( IsModal(), _T("can't DoShowModal() modeless dialog") ); wxModalDialogs.Append(this); wxWindow *parent = GetParent(); - // remember where the focus was - if ( !m_oldFocus ) - { - m_oldFocus = parent; - } - if ( !m_oldFocus ) - { - m_oldFocus = wxTheApp->GetTopWindow(); - } + wxWindow* oldFocus = m_oldFocus; - // disable the parent window first - HWND hwndParent = parent ? GetHwndOf(parent) : (HWND)NULL; - if ( hwndParent ) - { - ::EnableWindow(hwndParent, FALSE); - } + // We have to remember the HWND because we need to check + // the HWND still exists (oldFocus can be garbage when the dialog + // exits, if it has been destroyed) + HWND hwndOldFocus = 0; + if (oldFocus) + hwndOldFocus = (HWND) oldFocus->GetHWND(); - // enter the modal loop - while ( IsModalShowing() ) + // inside this block, all app windows are disabled { + wxWindowDisabler wd(this); + + // remember where the focus was + if ( !oldFocus ) + { + oldFocus = parent; + if (parent) + hwndOldFocus = (HWND) parent->GetHWND(); + } + + // enter the modal loop + while ( IsModalShowing() ) + { #if wxUSE_THREADS - wxMutexGuiLeaveOrEnter(); + wxMutexGuiLeaveOrEnter(); #endif // wxUSE_THREADS - while ( !wxTheApp->Pending() && wxTheApp->ProcessIdle() ) - ; + while ( !wxTheApp->Pending() && wxTheApp->ProcessIdle() ) + ; - // a message came or no more idle processing to do - wxTheApp->DoMessage(); + // a message came or no more idle processing to do + wxTheApp->DoMessage(); + } } - // reenable the parent window if any - if ( hwndParent ) - { - ::EnableWindow(hwndParent, TRUE); - } +#ifdef __WIN32__ + if ( parent ) + ::SetActiveWindow(GetHwndOf(parent)); +#endif // __WIN32__ // and restore focus - if ( m_oldFocus && (m_oldFocus != this) ) + // Note that this code MUST NOT access the dialog object's data + // in case the object has been deleted (which will be the case + // for a modal dialog that has been destroyed before calling EndModal). + if ( oldFocus && (oldFocus != this) && ::IsWindow(hwndOldFocus)) { - m_oldFocus->SetFocus(); + // This is likely to prove that the object still exists + if (wxFindWinFromHandle((WXHWND) hwndOldFocus) == oldFocus) + oldFocus->SetFocus(); } } @@ -405,6 +414,17 @@ bool wxDialog::Show(bool show) { if ( show ) { + // modal dialog needs a parent window, so try to find one + if ( !GetParent() ) + { + wxWindow *parent = wxTheApp->GetTopWindow(); + if ( parent && parent != this && parent->IsShown() ) + { + // use it + m_parent = parent; + } + } + DoShowModal(); } else // end of modal dialog @@ -418,32 +438,16 @@ bool wxDialog::Show(bool show) return TRUE; } -// Replacement for Show(TRUE) for modal dialogs - returns return code +// a special version for Show(TRUE) for modal dialogs which returns return code int wxDialog::ShowModal() { - // modal dialog needs a parent window, so try to find one - if ( !GetParent() ) - { - wxWindow *parent = wxTheApp->GetTopWindow(); - if ( parent && parent != this ) - { - // use it - m_parent = parent; - } - } - - wxWindowDisabler *wd = (wxWindowDisabler *)NULL; - if ( !GetParent() ) + if ( !IsModal() ) { - // still no parent? make the dialog app modal by disabling all windows - wd = new wxWindowDisabler(this); + SetModal(TRUE); } - m_windowStyle |= wxDIALOG_MODAL; Show(TRUE); - delete wd; - return GetReturnCode(); } @@ -564,7 +568,7 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) SWP_NOSIZE ) ) { - wxLogLastError("SetWindowPos(SWP_NOACTIVATE)"); + wxLogLastError(wxT("SetWindowPos(SWP_NOACTIVATE)")); } } // fall through to process it normally as well diff --git a/src/msw/dialup.cpp b/src/msw/dialup.cpp index bd42877ed3..2fff5a9a22 100644 --- a/src/msw/dialup.cpp +++ b/src/msw/dialup.cpp @@ -102,7 +102,7 @@ typedef DWORD (APIENTRY * RASVALIDATEENTRYNAME)( LPCSTR, LPCSTR ); typedef DWORD (APIENTRY * RASCONNECTIONNOTIFICATION)( HRASCONN, HANDLE, DWORD ); - static const char gs_funcSuffix = 'A'; + static const wxChar gs_funcSuffix = _T('A'); #else // Unicode typedef DWORD (APIENTRY * RASDIAL)( LPRASDIALEXTENSIONS, LPCWSTR, LPRASDIALPARAMSW, DWORD, LPVOID, LPHRASCONN ); typedef DWORD (APIENTRY * RASENUMCONNECTIONS)( LPRASCONNW, LPDWORD, LPDWORD ); @@ -124,7 +124,7 @@ typedef DWORD (APIENTRY * RASVALIDATEENTRYNAME)( LPCWSTR, LPCWSTR ); typedef DWORD (APIENTRY * RASCONNECTIONNOTIFICATION)( HRASCONN, HANDLE, DWORD ); - static const char gs_funcSuffix = 'W'; + static const wxChar gs_funcSuffix = _T('W'); #endif // ASCII/Unicode // structure passed to the secondary thread @@ -347,9 +347,7 @@ wxDialUpManagerMSW::wxDialUpManagerMSW() ms_dllRas = wxDllLoader::LoadLibrary("RASAPI32"); if ( !ms_dllRas ) { - wxLogError(_("Dial up functions are unavailable because the " - "remote access service (RAS) is not installed " - "on this machine. Please install it.")); + wxLogError(_("Dial up functions are unavailable because the remote access service (RAS) is not installed on this machine. Please install it.")); } else { @@ -409,10 +407,12 @@ wxDialUpManagerMSW::wxDialUpManagerMSW() exit: if ( funcName ) { - wxLogError(_("The version of remote access service (RAS) " - "installed on this machine is too old, please " - "upgrade (the following required function is " - "missing: %s)."), funcName); + static const wxChar *msg = wxTRANSLATE( +"The version of remote access service (RAS) installed on this machine is too\ +old, please upgrade (the following required function is missing: %s)." + ); + + wxLogError(wxGetTranslation(msg), funcName); wxDllLoader::UnloadLibrary(ms_dllRas); ms_dllRas = 0; @@ -455,8 +455,8 @@ wxString wxDialUpManagerMSW::GetErrorString(DWORD error) default: { - wxLogSysError(dwRet, _("Failed to retrieve text of RAS " - "error message")); + wxLogSysError(dwRet, + _("Failed to retrieve text of RAS error message")); wxString msg; msg.Printf(_("unknown error (error code %08x)."), error); @@ -532,8 +532,7 @@ HRASCONN wxDialUpManagerMSW::FindActiveConnection() // connection) - the warning is really needed because this function // is used, for example, to select the connection to hang up and so // we may hang up the wrong connection here... - wxLogWarning(_("Several active dialup connections found, " - "choosing one randomly.")); + wxLogWarning(_("Several active dialup connections found, choosing one randomly.")); // fall through case 1: @@ -761,8 +760,7 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, entryName = wxGetSingleChoice ( _("Choose ISP to dial"), - _("Please choose which ISP do you want to " - "connect to"), + _("Please choose which ISP do you want to connect to"), count, strings ); @@ -780,7 +778,7 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, RASDIALPARAMS rasDialParams; rasDialParams.dwSize = sizeof(rasDialParams); - strncpy(rasDialParams.szEntryName, entryName, RAS_MaxEntryName); + wxStrncpy(rasDialParams.szEntryName, entryName, RAS_MaxEntryName); // do we have the username and password? if ( !username || !password ) @@ -802,8 +800,8 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, } else { - strncpy(rasDialParams.szUserName, username, UNLEN); - strncpy(rasDialParams.szPassword, password, PWLEN); + wxStrncpy(rasDialParams.szUserName, username, UNLEN); + wxStrncpy(rasDialParams.szPassword, password, PWLEN); } // default values for other fields @@ -966,9 +964,6 @@ bool wxDialUpManagerMSW::IsAlwaysOnline() const // there is some connection to the net, see of which type ms_isAlwaysOnline = (flags & INTERNET_CONNECTION_LAN != 0) || (flags & INTERNET_CONNECTION_PROXY != 0); - - wxLogMessage("InternetGetConnectedState() returned TRUE, " - "flags = %08x", flags); } else { @@ -1047,7 +1042,7 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds) dwSuspendCount = ResumeThread(m_hThread); if ( dwSuspendCount == (DWORD)-1 ) { - wxLogLastError("ResumeThread(RasThread)"); + wxLogLastError(wxT("ResumeThread(RasThread)")); ok = FALSE; } @@ -1075,7 +1070,7 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds) ); if ( !m_data.hEventRas ) { - wxLogLastError("CreateEvent(RasStatus)"); + wxLogLastError(wxT("CreateEvent(RasStatus)")); ok = FALSE; } @@ -1087,7 +1082,7 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds) m_data.hEventQuit = CreateEvent(NULL, FALSE, FALSE, NULL); if ( !m_data.hEventQuit ) { - wxLogLastError("CreateEvent(RasThreadQuit)"); + wxLogLastError(wxT("CreateEvent(RasThreadQuit)")); CleanUpThreadData(); @@ -1106,7 +1101,7 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds) (HMENU)NULL, wxGetInstance(), 0); if ( !ms_hwndRas ) { - wxLogLastError("CreateWindow(RasHiddenWindow)"); + wxLogLastError(wxT("CreateWindow(RasHiddenWindow)")); CleanUpThreadData(); @@ -1143,7 +1138,7 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds) if ( !m_hThread ) { - wxLogLastError("CreateThread(RasStatusThread)"); + wxLogLastError(wxT("CreateThread(RasStatusThread)")); CleanUpThreadData(); } @@ -1194,7 +1189,7 @@ void wxDialUpManagerMSW::DisableAutoCheckOnlineStatus() // we have running secondary thread, it's just enough to suspend it if ( SuspendThread(m_hThread) == (DWORD)-1 ) { - wxLogLastError("SuspendThread(RasThread)"); + wxLogLastError(wxT("SuspendThread(RasThread)")); } } else @@ -1252,7 +1247,7 @@ static DWORD wxRasMonitorThread(wxRasThreadData *data) break; case WAIT_FAILED: - wxLogLastError("WaitForMultipleObjects(RasMonitor)"); + wxLogLastError(wxT("WaitForMultipleObjects(RasMonitor)")); break; } } diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 5952c60152..7340494bae 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -109,7 +109,7 @@ static BOOL WriteDIB(LPTSTR szFile, HANDLE hdib) if (!hdib) return FALSE; - fh = OpenFile(wxFNCONV(szFile), &of, OF_CREATE | OF_READWRITE); + fh = OpenFile(wxConvertWX2MB(szFile), &of, OF_CREATE | OF_READWRITE); if (fh == -1) return FALSE; @@ -429,7 +429,7 @@ BOOL wxReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) /* Open the file and get a handle to it's BITMAPINFO */ - fh = OpenFile (wxFNCONV(lpFileName), &of, OF_READ); + fh = OpenFile (wxConvertWX2MB(lpFileName), &of, OF_READ); if (fh == -1) { wxLogError(_("Can't open file '%s'"), lpFileName); return (0); diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index f8de559fa2..fed0b69a8b 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -117,7 +117,7 @@ int wxDirDialog::ShowModal() if ( !ok ) { - wxLogLastError("SHGetPathFromIDList"); + wxLogLastError(wxT("SHGetPathFromIDList")); return wxID_CANCEL; } @@ -174,7 +174,7 @@ static void ItemListFree(LPITEMIDLIST pidl) } else { - wxLogLastError("SHGetMalloc"); + wxLogLastError(wxT("SHGetMalloc")); } } } diff --git a/src/msw/dragimag.cpp b/src/msw/dragimag.cpp index b5aca15c51..d60e69d885 100644 --- a/src/msw/dragimag.cpp +++ b/src/msw/dragimag.cpp @@ -324,7 +324,7 @@ bool wxDragImage::EndDrag() if ( !::ReleaseCapture() ) { - wxLogLastError("ReleaseCapture"); + wxLogLastError(wxT("ReleaseCapture")); } ::ShowCursor(TRUE); diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index b3f2a2999b..c81dfcdf52 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: filedlg.cpp +// Name: src/msw/filedlg.cpp // Purpose: wxFileDialog // Author: Julian Smart // Modified by: @@ -9,13 +9,20 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + #ifdef __GNUG__ #pragma implementation "filedlg.h" #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#include "wx/msw/private.h" #ifdef __BORLANDC__ #pragma hdrstop @@ -28,10 +35,11 @@ #include "wx/filedlg.h" #include "wx/intl.h" #include "wx/log.h" - -// #include "wx/msw/private.h" + #include "wx/app.h" #endif +#include "wx/msw/private.h" + #if !defined(__WIN32__) || defined(__SALFORDC__) || defined(__WXWINE__) #include <commdlg.h> #endif @@ -42,8 +50,34 @@ #include "wx/tokenzr.h" +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#ifdef __WIN32__ +# define wxMAXPATH 4096 +#else +# define wxMAXPATH 1024 +#endif + +# define wxMAXFILE 1024 + +# define wxMAXEXT 5 + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + IMPLEMENT_CLASS(wxFileDialog, wxDialog) +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + wxString wxFileSelector(const wxChar *title, const wxChar *defaultDir, const wxChar *defaultFileName, @@ -126,26 +160,6 @@ wxString wxFileSelector(const wxChar *title, return wxGetEmptyString(); } -# if __BORLANDC__ -# include <dir.h> // for MAXPATH etc. ( Borland 3.1 ) -# endif - -# ifndef MAXPATH -# define MAXPATH 400 -# endif - -# ifndef MAXDRIVE -# define MAXDRIVE 3 -# endif - -# ifndef MAXFILE -# define MAXFILE 9 -# endif - -# ifndef MAXEXT -# define MAXEXT 5 -# endif - wxString wxFileSelectorEx(const wxChar *title, const wxChar *defaultDir, @@ -206,9 +220,11 @@ int wxFileDialog::ShowModal() { HWND hWnd = 0; if (m_parent) hWnd = (HWND) m_parent->GetHWND(); + if (!hWnd && wxTheApp->GetTopWindow()) + hWnd = (HWND) wxTheApp->GetTopWindow()->GetHWND(); - static wxChar fileNameBuffer [ MAXPATH ]; // the file-name - wxChar titleBuffer [ MAXFILE+1+MAXEXT ]; // the file-name, without path + static wxChar fileNameBuffer [ wxMAXPATH ]; // the file-name + wxChar titleBuffer [ wxMAXFILE+1+wxMAXEXT ]; // the file-name, without path *fileNameBuffer = wxT('\0'); *titleBuffer = wxT('\0'); @@ -226,22 +242,23 @@ int wxFileDialog::ShowModal() OFN_ALLOWMULTISELECT; OPENFILENAME of; - memset(&of, 0, sizeof(OPENFILENAME)); - - of.lpstrCustomFilter = NULL; // system should not save custom filter - of.nMaxCustFilter = 0L; - - of.nFileOffset = 0; // 0-based pointer to filname in lpstFile - of.nFileExtension = 0; // 0-based pointer to extension in lpstrFile - of.lpstrDefExt = NULL; // no default extension - + wxZeroMemory(of); + + // the OPENFILENAME struct has been extended in newer version of + // comcdlg32.dll, but as we don't use the extended fields anyhow, set + // the struct size to the old value - otherwise, the programs compiled + // with new headers will not work with the old libraries +#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500) + of.lStructSize = sizeof(OPENFILENAME) - + (sizeof(void *) + 2*sizeof(DWORD)); +#else // old headers of.lStructSize = sizeof(OPENFILENAME); +#endif + of.hwndOwner = hWnd; of.lpstrTitle = WXSTRINGCAST m_message; - - of.lpstrFileTitle = titleBuffer; - of.nMaxFileTitle = MAXFILE + 1 + MAXEXT; // Windows 3.0 and 3.1 + of.nMaxFileTitle = wxMAXFILE + 1 + wxMAXEXT; // Windows 3.0 and 3.1 // Convert forward slashes to backslashes (file selector doesn't like // forward slashes) @@ -298,17 +315,39 @@ int wxFileDialog::ShowModal() //=== Setting defaultFileName >>========================================= - wxStrncpy( fileNameBuffer, (const wxChar *)m_fileName, MAXPATH-1 ); - fileNameBuffer[ MAXPATH-1 ] = wxT('\0'); + wxStrncpy( fileNameBuffer, (const wxChar *)m_fileName, wxMAXPATH-1 ); + fileNameBuffer[ wxMAXPATH-1 ] = wxT('\0'); of.lpstrFile = fileNameBuffer; // holds returned filename - of.nMaxFile = MAXPATH; + of.nMaxFile = wxMAXPATH; //== Execute FileDialog >>================================================= bool success = (m_dialogStyle & wxSAVE) ? (GetSaveFileName(&of) != 0) : (GetOpenFileName(&of) != 0); + DWORD errCode = CommDlgExtendedError(); + +#ifdef __WIN32__ + if (!success && (errCode == CDERR_STRUCTSIZE)) + { + // The struct size has changed so try a smaller or bigger size + + int oldStructSize = of.lStructSize; + of.lStructSize = oldStructSize - (sizeof(void *) + 2*sizeof(DWORD)); + success = (m_dialogStyle & wxSAVE) ? (GetSaveFileName(&of) != 0) + : (GetOpenFileName(&of) != 0); + errCode = CommDlgExtendedError(); + + if (!success && (errCode == CDERR_STRUCTSIZE)) + { + of.lStructSize = oldStructSize + (sizeof(void *) + 2*sizeof(DWORD)); + success = (m_dialogStyle & wxSAVE) ? (GetSaveFileName(&of) != 0) + : (GetOpenFileName(&of) != 0); + } + } +#endif + if ( success ) { m_fileNames.Empty(); @@ -379,8 +418,8 @@ int wxFileDialog::ShowModal() m_fileName = wxString(fileNameBuffer) + extension; int len = wxStrlen( fileNameBuffer ); - wxStrncpy( fileNameBuffer + len, extension, MAXPATH - len ); - fileNameBuffer[ MAXPATH -1 ] = wxT('\0'); + wxStrncpy( fileNameBuffer + len, extension, wxMAXPATH - len ); + fileNameBuffer[ wxMAXPATH -1 ] = wxT('\0'); } } diff --git a/src/msw/files.lst b/src/msw/files.lst index 797f7ee036..9f2dbf0ea6 100644 --- a/src/msw/files.lst +++ b/src/msw/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 17:48, 2000/03/09 +# This file was automatically generated by tmake at 20:17, 2000/03/31 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MSW.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -166,6 +166,7 @@ ALL_SOURCES = \ msw/gdiobj.cpp \ msw/glcanvas.cpp \ msw/gsocket.c \ + msw/gsockmsw.c \ msw/helpwin.cpp \ msw/icon.cpp \ msw/imaglist.cpp \ @@ -301,6 +302,7 @@ ALL_HEADERS = \ filesys.h \ font.h \ fontdlg.h \ + fontenc.h \ fontenum.h \ fontmap.h \ fontutil.h \ @@ -886,6 +888,7 @@ GUIOBJS = \ gdiobj.o \ glcanvas.o \ gsocket.o \ + gsockmsw.o \ helpwin.o \ icon.o \ imaglist.o \ @@ -981,6 +984,7 @@ GUIDEPS = \ gdiobj.d \ glcanvas.d \ gsocket.d \ + gsockmsw.d \ helpwin.d \ icon.d \ imaglist.d \ diff --git a/src/msw/font.cpp b/src/msw/font.cpp index e02b116efa..071d8b0bd9 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -143,7 +143,7 @@ wxFontRefData::~wxFontRefData() { if ( !::DeleteObject((HFONT) m_hFont) ) { - wxLogLastError("DeleteObject(font)"); + wxLogLastError(wxT("DeleteObject(font)")); } } } @@ -203,7 +203,7 @@ bool wxFont::RealizeResource() M_FONTDATA->m_faceName = lf.lfFaceName; if ( !M_FONTDATA->m_hFont ) { - wxLogLastError("CreateFont"); + wxLogLastError(wxT("CreateFont")); return FALSE; } @@ -217,7 +217,7 @@ bool wxFont::FreeResource(bool force) { if ( !::DeleteObject((HFONT) M_FONTDATA->m_hFont) ) { - wxLogLastError("DeleteObject(font)"); + wxLogLastError(wxT("DeleteObject(font)")); } M_FONTDATA->m_hFont = 0; @@ -228,6 +228,11 @@ bool wxFont::FreeResource(bool force) } WXHANDLE wxFont::GetResourceHandle() +{ + return GetHFONT(); +} + +WXHFONT wxFont::GetHFONT() const { if ( !M_FONTDATA ) return 0; diff --git a/src/msw/fontenum.cpp b/src/msw/fontenum.cpp index f91b00c91f..1747efcaaf 100644 --- a/src/msw/fontenum.cpp +++ b/src/msw/fontenum.cpp @@ -41,15 +41,21 @@ // private classes // ---------------------------------------------------------------------------- +// the helper class which calls ::EnumFontFamilies() and whose OnFont() is +// called from the callback passed to this function and, in its turn, calls the +// appropariate wxFontEnumerator method class wxFontEnumeratorHelper { public: wxFontEnumeratorHelper(wxFontEnumerator *fontEnum); // control what exactly are we enumerating + // we enumerate fonts with given enocding bool SetEncoding(wxFontEncoding encoding); - void SetFixedOnly(bool fixedOnly) - { m_fixedOnly = fixedOnly; } + // we enumerate fixed-width fonts + void SetFixedOnly(bool fixedOnly) { m_fixedOnly = fixedOnly; } + // we enumerate the encodings available in this family + void SetFamily(const wxString& family); // call to start enumeration void DoEnumerate(); @@ -67,8 +73,17 @@ private: // if not empty, enum only the fonts with this facename wxString m_facename; + // if not empty, enum only the fonts in this family + wxString m_family; + // if TRUE, enum only fixed fonts bool m_fixedOnly; + + // if TRUE, we enumerate the encodings, not fonts + bool m_enumEncodings; + + // the list of charsets we already found while enumerating charsets + wxArrayInt m_charsets; }; // ---------------------------------------------------------------------------- @@ -91,6 +106,13 @@ wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator *fontEnum) m_fontEnum = fontEnum; m_charset = -1; m_fixedOnly = FALSE; + m_enumEncodings = FALSE; +} + +void wxFontEnumeratorHelper::SetFamily(const wxString& family) +{ + m_enumEncodings = TRUE; + m_family = family; } bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding) @@ -111,7 +133,7 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding) } #if defined(__GNUWIN32__) - #if defined(__MINGW32__) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) + #if wxUSE_NORLANDER_HEADERS #define wxFONTENUMPROC int(*)(const LOGFONTA *, const TEXTMETRICA *, long unsigned int, LPARAM) #else #define wxFONTENUMPROC int(*)(ENUMLOGFONTEX *, NEWTEXTMETRICEX*, int, LPARAM) @@ -147,6 +169,25 @@ void wxFontEnumeratorHelper::DoEnumerate() bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf, const LPTEXTMETRIC tm) const { + if ( m_enumEncodings ) + { + // is this a new charset? + int cs = lf->lfCharSet; + if ( m_charsets.Index(cs) == wxNOT_FOUND ) + { + wxConstCast(this, wxFontEnumeratorHelper)->m_charsets.Add(cs); + + wxFontEncoding enc = wxGetFontEncFromCharSet(cs); + return m_fontEnum->OnFontEncoding(m_family, + wxFontMapper::GetEncodingName(enc)); + } + else + { + // continue enumeration + return TRUE; + } + } + if ( m_fixedOnly ) { // check that it's a fixed pitch font (there is *no* error here, the @@ -191,7 +232,9 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, bool wxFontEnumerator::EnumerateEncodings(const wxString& family) { - wxFAIL_MSG(wxT("TODO")); + wxFontEnumeratorHelper fe(this); + fe.SetFamily(family); + fe.DoEnumerate(); return TRUE; } diff --git a/src/msw/fontutil.cpp b/src/msw/fontutil.cpp index 04ad8a0548..a5b4de99d7 100644 --- a/src/msw/fontutil.cpp +++ b/src/msw/fontutil.cpp @@ -94,7 +94,7 @@ bool wxNativeEncodingInfo::FromString(const wxString& s) wxString wxNativeEncodingInfo::ToString() const { wxString s; - + s << (long)encoding << _T(';') << facename; if ( charset != ANSI_CHARSET ) { @@ -173,7 +173,7 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding, } info->encoding = encoding; - + return TRUE; } @@ -198,6 +198,69 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info) return TRUE; } +// ---------------------------------------------------------------------------- +// wxFontEncoding <-> CHARSET_XXX +// ---------------------------------------------------------------------------- + +wxFontEncoding wxGetFontEncFromCharSet(int cs) +{ + wxFontEncoding fontEncoding; + + switch ( cs ) + { + default: + // JACS: Silently using ANSI_CHARSET + // apparently works for Chinese Windows. Assume it works + // for all/most other languages. + //wxFAIL_MSG(wxT("unsupported charset")); + // fall through + + case ANSI_CHARSET: + fontEncoding = wxFONTENCODING_CP1252; + break; + +#ifdef __WIN32__ + case EASTEUROPE_CHARSET: + fontEncoding = wxFONTENCODING_CP1250; + break; + + case BALTIC_CHARSET: + fontEncoding = wxFONTENCODING_CP1257; + break; + + case RUSSIAN_CHARSET: + fontEncoding = wxFONTENCODING_CP1251; + break; + + case ARABIC_CHARSET: + fontEncoding = wxFONTENCODING_CP1256; + break; + + case GREEK_CHARSET: + fontEncoding = wxFONTENCODING_CP1253; + break; + + case HEBREW_CHARSET: + fontEncoding = wxFONTENCODING_CP1255; + break; + + case TURKISH_CHARSET: + fontEncoding = wxFONTENCODING_CP1254; + break; + + case THAI_CHARSET: + fontEncoding = wxFONTENCODING_CP437; + break; +#endif // Win32 + + case OEM_CHARSET: + fontEncoding = wxFONTENCODING_CP437; + break; + } + + return fontEncoding; +} + // ---------------------------------------------------------------------------- // wxFont <-> LOGFONT conversion // ---------------------------------------------------------------------------- @@ -410,59 +473,8 @@ wxFont wxCreateFontFromLogFont(const LOGFONT *logFont) #endif int fontPoints = (int) (((72.0*((double)height))/(double) ppInch) + 0.5); - wxFontEncoding fontEncoding; - switch ( logFont->lfCharSet ) - { - default: - wxFAIL_MSG(wxT("unsupported charset")); - // fall through - - case ANSI_CHARSET: - fontEncoding = wxFONTENCODING_CP1252; - break; - -#ifdef __WIN32__ - case EASTEUROPE_CHARSET: - fontEncoding = wxFONTENCODING_CP1250; - break; - - case BALTIC_CHARSET: - fontEncoding = wxFONTENCODING_CP1257; - break; - - case RUSSIAN_CHARSET: - fontEncoding = wxFONTENCODING_CP1251; - break; - - case ARABIC_CHARSET: - fontEncoding = wxFONTENCODING_CP1256; - break; - - case GREEK_CHARSET: - fontEncoding = wxFONTENCODING_CP1253; - break; - - case HEBREW_CHARSET: - fontEncoding = wxFONTENCODING_CP1255; - break; - - case TURKISH_CHARSET: - fontEncoding = wxFONTENCODING_CP1254; - break; - - case THAI_CHARSET: - fontEncoding = wxFONTENCODING_CP437; - break; -#endif - - case OEM_CHARSET: - fontEncoding = wxFONTENCODING_CP437; - break; - } - return wxFont(fontPoints, fontFamily, fontStyle, fontWeight, fontUnderline, fontFace, - fontEncoding); + wxGetFontEncFromCharSet(logFont->lfCharSet)); } - diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index ac077260fa..9a324b1042 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -38,6 +38,7 @@ #include "wx/settings.h" #include "wx/dcclient.h" #include "wx/mdi.h" + #include "wx/panel.h" #endif // WX_PRECOMP #include "wx/msw/private.h" @@ -106,9 +107,14 @@ void wxFrame::Init() m_fsStatusBarFields = 0; m_fsStatusBarHeight = 0; m_fsToolBarHeight = 0; -// m_fsMenu = 0; +// m_fsMenu = 0; m_fsIsMaximized = FALSE; m_fsIsShowing = FALSE; + + m_winLastFocused = (wxWindow *)NULL; + + // unlike (almost?) all other windows, frames are created hidden + m_isShown = FALSE; } bool wxFrame::Create(wxWindow *parent, @@ -148,13 +154,13 @@ bool wxFrame::Create(wxWindow *parent, if ((m_windowStyle & wxFRAME_FLOAT_ON_PARENT) == 0) parent = NULL; - if (!parent) - wxTopLevelWindows.Append(this); + wxTopLevelWindows.Append(this); MSWCreate(m_windowId, parent, wxFrameClassName, this, title, x, y, width, height, style); wxModelessWindows.Append(this); + return TRUE; } @@ -163,6 +169,9 @@ wxFrame::~wxFrame() m_isBeingDeleted = TRUE; wxTopLevelWindows.DeleteObject(this); + // the ~wxToolBar() code relies on the previous line to be executed before + // this one, i.e. the frame should remove itself from wxTopLevelWindows + // before destorying its toolbar DeleteAllBars(); if (wxTheApp && (wxTopLevelWindows.Number() == 0)) @@ -287,6 +296,10 @@ void wxFrame::DoShowWindow(int nShowCmd) bool wxFrame::Show(bool show) { + // don't use wxWindow version as we want to call DoShowWindow() + if ( !wxWindowBase::Show(show) ) + return FALSE; + DoShowWindow(show ? SW_SHOW : SW_HIDE); if ( show ) @@ -404,75 +417,57 @@ void wxFrame::PositionStatusBar() void wxFrame::DetachMenuBar() { - if (m_frameMenuBar) + if ( m_frameMenuBar ) { m_frameMenuBar->Detach(); m_frameMenuBar = NULL; } } -void wxFrame::SetMenuBar(wxMenuBar *menu_bar) +void wxFrame::SetMenuBar(wxMenuBar *menubar) { - if (!menu_bar) + if ( !menubar ) { DetachMenuBar(); - return; - } - m_frameMenuBar = NULL; - - // Can set a menubar several times. - // TODO: how to prevent a memory leak if you have a currently-unattached - // menubar? wxWindows assumes that the frame will delete the menu (otherwise - // there are problems for MDI). - if (menu_bar->GetHMenu()) - { - m_hMenu = menu_bar->GetHMenu(); + // actually remove the menu from the frame + m_hMenu = (WXHMENU)0; + InternalSetMenuBar(); } - else + else // set new non NULL menu bar { - menu_bar->Detach(); + m_frameMenuBar = NULL; - m_hMenu = menu_bar->Create(); + // Can set a menubar several times. + // TODO: how to prevent a memory leak if you have a currently-unattached + // menubar? wxWindows assumes that the frame will delete the menu (otherwise + // there are problems for MDI). + if ( menubar->GetHMenu() ) + { + m_hMenu = menubar->GetHMenu(); + } + else + { + menubar->Detach(); - if ( !m_hMenu ) - return; - } + m_hMenu = menubar->Create(); - InternalSetMenuBar(); + if ( !m_hMenu ) + return; + } - m_frameMenuBar = menu_bar; - menu_bar->Attach(this); + InternalSetMenuBar(); -#if 0 // Old code that assumes only one call of SetMenuBar per frame. - if (!menu_bar) - { - DetachMenuBar(); - return; + m_frameMenuBar = menubar; + menubar->Attach(this); } - - wxCHECK_RET( !menu_bar->GetFrame(), wxT("this menubar is already attached") ); - - if (m_frameMenuBar) - delete m_frameMenuBar; - - m_hMenu = menu_bar->Create(); - - if ( !m_hMenu ) - return; - - InternalSetMenuBar(); - - m_frameMenuBar = menu_bar; - menu_bar->Attach(this); -#endif } void wxFrame::InternalSetMenuBar() { if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) ) { - wxLogLastError("SetMenu"); + wxLogLastError(wxT("SetMenu")); } } @@ -504,8 +499,8 @@ bool wxFrame::ShowFullScreen(bool show, long style) m_fsIsShowing = TRUE; m_fsStyle = style; - wxToolBar *theToolBar = GetToolBar(); - wxStatusBar *theStatusBar = GetStatusBar(); + wxToolBar *theToolBar = GetToolBar(); + wxStatusBar *theStatusBar = GetStatusBar(); int dummyWidth; @@ -530,7 +525,7 @@ bool wxFrame::ShowFullScreen(bool show, long style) { m_fsStatusBarFields = theStatusBar->GetFieldsCount(); SetStatusBar((wxStatusBar*) NULL); - delete theStatusBar; + delete theStatusBar; } else m_fsStatusBarFields = 0; @@ -540,11 +535,11 @@ bool wxFrame::ShowFullScreen(bool show, long style) // save the 'normal' window style m_fsOldWindowStyle = GetWindowLong((HWND)GetHWND(), GWL_STYLE); - // save the old position, width & height, maximize state + // save the old position, width & height, maximize state m_fsOldSize = GetRect(); - m_fsIsMaximized = IsMaximized(); + m_fsIsMaximized = IsMaximized(); - // decide which window style flags to turn off + // decide which window style flags to turn off LONG newStyle = m_fsOldWindowStyle; LONG offFlags = 0; @@ -638,7 +633,7 @@ bool wxFrame::MSWCreate(int id, wxWindow *parent, const wxChar *wclass, wxWindow msflags |= WS_THICKFRAME; if (style & wxSYSTEM_MENU) msflags |= WS_SYSMENU; - if ((style & wxMINIMIZE) || (style & wxICONIZE)) + if ( style & wxMINIMIZE ) msflags |= WS_MINIMIZE; if (style & wxMAXIMIZE) msflags |= WS_MAXIMIZE; @@ -690,37 +685,32 @@ bool wxFrame::MSWCreate(int id, wxWindow *parent, const wxChar *wclass, wxWindow // subwindow found. void wxFrame::OnActivate(wxActivateEvent& event) { - if ( !event.GetActive() ) + if ( event.GetActive() ) { - event.Skip(); + // restore focus to the child which was last focused + wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd); - return; + wxSetFocusToChild(this, &m_winLastFocused); } - - wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd); - - for ( wxWindowList::Node *node = GetChildren().GetFirst(); - node; - node = node->GetNext() ) + else { - // FIXME all this is totally bogus - we need to do the same as wxPanel, - // but how to do it without duplicating the code? - - // restore focus - wxWindow *child = node->GetData(); - - if ( !child->IsTopLevel() -#if wxUSE_TOOLBAR - && !wxDynamicCast(child, wxToolBar) -#endif // wxUSE_TOOLBAR -#if wxUSE_STATUSBAR - && !wxDynamicCast(child, wxStatusBar) -#endif // wxUSE_STATUSBAR - ) + // remember the last focused child + m_winLastFocused = FindFocus(); + while ( m_winLastFocused ) { - child->SetFocus(); - break; + if ( GetChildren().Find(m_winLastFocused) ) + break; + + m_winLastFocused = m_winLastFocused->GetParent(); } + + wxLogTrace(_T("focus"), + _T("wxFrame %08x deactivated, last focused: %08x."), + m_hWnd, + m_winLastFocused ? GetHwndOf(m_winLastFocused) + : NULL); + + event.Skip(); } } @@ -962,7 +952,15 @@ bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) else { // don't give hints for separators (doesn't make sense) nor for the - // items opening popup menus (they don't have them anyhow) + // items opening popup menus (they don't have them anyhow) but do clear + // the status line - otherwise, we would be left with the help message + // for the previous item which doesn't apply any more + wxStatusBar *statbar = GetStatusBar(); + if ( statbar ) + { + statbar->SetStatusText(wxEmptyString); + } + return FALSE; } diff --git a/src/msw/gauge95.cpp b/src/msw/gauge95.cpp index c43b527cb6..4f1bff7201 100644 --- a/src/msw/gauge95.cpp +++ b/src/msw/gauge95.cpp @@ -1,16 +1,24 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: gauge95.cpp +// Name: src/msw/gauge95.cpp // Purpose: wxGauge95 class // Author: Julian Smart // Modified by: // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + #ifdef __GNUG__ -#pragma implementation "gauge95.h" + #pragma implementation "gauge95.h" #endif // For compilers that support precompilation, includes "wx.h". @@ -21,7 +29,7 @@ #endif #ifndef WX_PRECOMP -#include "wx/defs.h" + #include "wx/defs.h" #endif #if wxUSE_GAUGE && defined(__WIN95__) @@ -33,8 +41,37 @@ #include <commctrl.h> #endif +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// old commctrl.h (< 4.71) don't have those +#ifndef PBS_SMOOTH + #define PBS_SMOOTH 0x01 +#endif + +#ifndef PBS_VERTICAL + #define PBS_VERTICAL 0x04 +#endif + +#ifndef PBM_SETBARCOLOR + #define PBM_SETBARCOLOR (WM_USER+9) +#endif + +#ifndef PBM_SETBKCOLOR + #define PBM_SETBKCOLOR 0x2001 +#endif + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + IMPLEMENT_DYNAMIC_CLASS(wxGauge95, wxControl) +// ============================================================================ +// implementation +// ============================================================================ + bool wxGauge95::Create(wxWindow *parent, wxWindowID id, int range, const wxPoint& pos, @@ -52,8 +89,8 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id, m_rangeMax = range; m_gaugePos = 0; - SetBackgroundColour(parent->GetBackgroundColour()) ; - SetForegroundColour(parent->GetForegroundColour()) ; + SetBackgroundColour(parent->GetBackgroundColour()); + SetForegroundColour(parent->GetForegroundColour()); m_windowStyle = style; @@ -67,19 +104,11 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id, int width = size.x; int height = size.y; - long msFlags = WS_CHILD | WS_VISIBLE; - -#ifndef PBS_VERTICAL -#define PBS_VERTICAL 0x04 -#endif + long msFlags = WS_CHILD | WS_VISIBLE /* | WS_CLIPSIBLINGS */; if (m_windowStyle & wxGA_VERTICAL) msFlags |= PBS_VERTICAL; -#ifndef PBS_SMOOTH -#define PBS_SMOOTH 0x01 -#endif - if (m_windowStyle & wxGA_SMOOTH) msFlags |= PBS_SMOOTH; @@ -130,22 +159,22 @@ void wxGauge95::SetValue(int pos) SendMessage((HWND) GetHWND(), PBM_SETPOS, pos, 0); } -int wxGauge95::GetShadowWidth(void) const +int wxGauge95::GetShadowWidth() const { return 0; } -int wxGauge95::GetBezelFace(void) const +int wxGauge95::GetBezelFace() const { return 0; } -int wxGauge95::GetRange(void) const +int wxGauge95::GetRange() const { return m_rangeMax; } -int wxGauge95::GetValue(void) const +int wxGauge95::GetValue() const { return m_gaugePos; } @@ -155,7 +184,7 @@ bool wxGauge95::SetForegroundColour(const wxColour& col) if ( !wxControl::SetForegroundColour(col) ) return FALSE; - m_foregroundColour = col ; + SendMessage(GetHwnd(), PBM_SETBARCOLOR, 0, (LPARAM)wxColourToRGB(col)); return TRUE; } @@ -165,7 +194,7 @@ bool wxGauge95::SetBackgroundColour(const wxColour& col) if ( !wxControl::SetBackgroundColour(col) ) return FALSE; - m_backgroundColour = col ; + SendMessage(GetHwnd(), PBM_SETBKCOLOR, 0, (LPARAM)wxColourToRGB(col)); return TRUE; } diff --git a/src/msw/gaugemsw.cpp b/src/msw/gaugemsw.cpp index cb8c2b91d5..278fbfce57 100644 --- a/src/msw/gaugemsw.cpp +++ b/src/msw/gaugemsw.cpp @@ -104,7 +104,10 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id, int height = size.y; long msFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP; - msFlags |= ZYZGS_3D; + bool want3D; + WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); + if (want3D) + msFlags |= ZYZGS_3D; HWND wx_button = CreateWindowEx(MakeExtendedStyle(m_windowStyle), wxT("zYzGauge"), NULL, msFlags, @@ -129,6 +132,9 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id, SendMessage(GetHwnd(), ZYZG_SETFGCOLOR, 0, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue())); SendMessage(GetHwnd(), ZYZG_SETBKCOLOR, 0, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); + //SetBezelFace(1); + //SetShadowWidth(1); + SetFont(parent->GetFont()); if (width == -1) diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index bc4c53ec52..d880396fdb 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -330,7 +330,7 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, BITMAP bm; if ( !::GetObject(GetHbitmapOf(*bitmap), sizeof(BITMAP), (LPSTR) &bm) ) { - wxLogLastError("GetObject(HBITMAP)"); + wxLogLastError(wxT("GetObject(HBITMAP)")); } data->m_width = bm.bmWidth; @@ -419,9 +419,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon, if ( (desiredWidth != -1 && desiredWidth != size.x) || (desiredHeight != -1 && desiredHeight != size.y) ) { - wxLogDebug(_T("Returning FALSE from wxICOFileHandler::Load because " - "of the size mismatch: actual (%d, %d), " - "requested (%d, %d)"), + wxLogDebug(_T("Returning FALSE from wxICOFileHandler::Load because of the size mismatch: actual (%d, %d), requested (%d, %d)"), size.x, size.y, desiredWidth, desiredHeight); @@ -488,7 +486,7 @@ static wxSize GetHiconSize(HICON hicon) ICONINFO info; if ( !::GetIconInfo(hicon, &info) ) { - wxLogLastError("GetIconInfo"); + wxLogLastError(wxT("GetIconInfo")); } else { diff --git a/src/msw/glcanvas.cpp b/src/msw/glcanvas.cpp index f415d6030a..78c1a4bd2d 100644 --- a/src/msw/glcanvas.cpp +++ b/src/msw/glcanvas.cpp @@ -49,7 +49,7 @@ wxGLContext::wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette) m_hDC = win->GetHDC(); m_glContext = wglCreateContext((HDC) m_hDC); - wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); + wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") ); wglMakeCurrent((HDC) m_hDC, m_glContext); } @@ -65,7 +65,7 @@ wxGLContext::wxGLContext( m_hDC = win->GetHDC(); m_glContext = wglCreateContext((HDC) m_hDC); - wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); + wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") ); if( other != 0 ) wglShareLists( other->m_glContext, m_glContext ); @@ -179,7 +179,7 @@ wxGLCanvas::wxGLCanvas( wxWindow *parent, m_glContext = new wxGLContext(TRUE, this, palette, shared ); } -// Not very usefull for wxMSW, but this is to be wxGTK compliant +// Not very useful for wxMSW, but this is to be wxGTK compliant wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name, @@ -218,6 +218,17 @@ wxGLCanvas::~wxGLCanvas() bool wxGLCanvas::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { +/* Suggestion from Kelly Brock <kbrock@8cs.com> (not yet implemented): + +OpenGL corruption fix is simple assuming it doesn't screw anything else +up. Add the following line to the top of the create function: + wxSize parentSize = GetClientSize(); + All locations within the function that use 'size' are changed to +'parentSize'. + The above corrects the initial display corruption with the GeForce and +TNT2, not sure about other NVidia cards yet. +*/ + static bool registeredGLCanvasClass = FALSE; // We have to register a special window class because we need @@ -262,7 +273,7 @@ bool wxGLCanvas::Create(wxWindow *parent, wxWindowID id, if ( !RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(wxGLCanvasClass)"); + wxLogLastError(wxT("RegisterClass(wxGLCanvasClass)")); return FALSE; } @@ -282,9 +293,17 @@ bool wxGLCanvas::Create(wxWindow *parent, wxWindowID id, if ( style & wxTHICK_FRAME ) msflags |= WS_THICKFRAME; - msflags |= WS_CHILD | WS_VISIBLE; - if ( style & wxCLIP_CHILDREN ) - msflags |= WS_CLIPCHILDREN; +/* + A general rule with OpenGL and Win32 is that any window that will have a + HGLRC built for it must have two flags: WS_CLIPCHILDREN & WS_CLIPSIBLINGS. + You can find references about this within the knowledge base and most OpenGL + books that contain the wgl function descriptions. +*/ + + msflags |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS; +// if ( style & wxCLIP_CHILDREN ) +// msflags |= WS_CLIPCHILDREN; + msflags |= WS_CLIPCHILDREN; bool want3D; WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); @@ -340,13 +359,13 @@ void wxGLCanvas::SetupPixelFormat() // (HDC hDC) pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd); if (pixelFormat == 0) { - MessageBox(WindowFromDC((HDC) m_hDC), "ChoosePixelFormat failed.", "Error", + MessageBox(WindowFromDC((HDC) m_hDC), wxT("ChoosePixelFormat failed."), wxT("Error"), MB_ICONERROR | MB_OK); exit(1); } if (SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) != TRUE) { - MessageBox(WindowFromDC((HDC) m_hDC), "SetPixelFormat failed.", "Error", + MessageBox(WindowFromDC((HDC) m_hDC), wxT("SetPixelFormat failed."), wxT("Error"), MB_ICONERROR | MB_OK); exit(1); } diff --git a/src/msw/helpchm.cpp b/src/msw/helpchm.cpp new file mode 100644 index 0000000000..2fa6dd4495 --- /dev/null +++ b/src/msw/helpchm.cpp @@ -0,0 +1,152 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: helpchm.cpp +// Purpose: Help system: MS HTML Help implementation +// Author: Julian Smart +// Modified by: +// Created: 16/04/2000 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "helpchm.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/defs.h" +#endif + +#include "wx/filefn.h" + +#if wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) +#include "wx/msw/helpchm.h" + +// This is found in the HTML Help Workshop installation, +// along with htmlhelp.lib. +#include <htmlhelp.h> + +#include <time.h> + +#ifdef __WXMSW__ +#include "wx/msw/private.h" +#endif + +#include <string.h> + +static HWND GetSuitableHWND() +{ + if (wxTheApp->GetTopWindow()) + return (HWND) wxTheApp->GetTopWindow()->GetHWND(); + else + return GetDesktopWindow(); +} + +IMPLEMENT_DYNAMIC_CLASS(wxCHMHelpController, wxHelpControllerBase) + +bool wxCHMHelpController::Initialize(const wxString& filename) +{ + m_helpFile = filename; + return TRUE; +} + +bool wxCHMHelpController::LoadFile(const wxString& file) +{ + if (!file.IsEmpty()) + m_helpFile = file; + return TRUE; +} + +bool wxCHMHelpController::DisplayContents() +{ + if (m_helpFile.IsEmpty()) return FALSE; + + wxString str = GetValidFilename(m_helpFile); + + HtmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_HELP_FINDER, 0L); + return TRUE; +} + +// Use topic or HTML filename +bool wxCHMHelpController::DisplaySection(const wxString& section) +{ + if (m_helpFile.IsEmpty()) return FALSE; + + wxString str = GetValidFilename(m_helpFile); + + // Is this an HTML file or a keyword? + bool isFilename = (section.Find(wxT(".htm")) != -1); + + if (isFilename) + HtmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_DISPLAY_TOPIC, (DWORD) (const wxChar*) section); + else + KeywordSearch(section); + return TRUE; +} + +// Use context number +bool wxCHMHelpController::DisplaySection(int section) +{ + if (m_helpFile.IsEmpty()) return FALSE; + + wxString str = GetValidFilename(m_helpFile); + + HtmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_HELP_CONTEXT, (DWORD)section); + return TRUE; +} + +bool wxCHMHelpController::DisplayBlock(long block) +{ + return DisplaySection(block); +} + +bool wxCHMHelpController::KeywordSearch(const wxString& k) +{ + if (m_helpFile.IsEmpty()) return FALSE; + + wxString str = GetValidFilename(m_helpFile); + + HH_AKLINK link; + link.cbStruct = sizeof(HH_AKLINK) ; + link.fReserved = FALSE ; + link.pszKeywords = k.c_str() ; + link.pszUrl = NULL ; + link.pszMsgText = NULL ; + link.pszMsgTitle = NULL ; + link.pszWindow = NULL ; + link.fIndexOnFail = TRUE ; + + HtmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_KEYWORD_LOOKUP, (DWORD)& link); + return TRUE; +} + +bool wxCHMHelpController::Quit() +{ + HtmlHelp(GetSuitableHWND(), 0, HH_CLOSE_ALL, 0L); + return TRUE; +} + +// Append extension if necessary. +wxString wxCHMHelpController::GetValidFilename(const wxString& file) const +{ + wxString path, name, ext; + wxSplitPath(file, & path, & name, & ext); + + wxString fullName; + if (path.IsEmpty()) + fullName = name + wxT(".chm"); + else if (path.Last() == wxT('\\')) + fullName = path + name + wxT(".chm"); + else + fullName = path + wxT("\\") + name + wxT(".chm"); + return fullName; +} + +#endif // wxUSE_HELP diff --git a/src/msw/helpwin.cpp b/src/msw/helpwin.cpp index 66e868d54d..74d9160f7f 100644 --- a/src/msw/helpwin.cpp +++ b/src/msw/helpwin.cpp @@ -24,9 +24,11 @@ #include "wx/defs.h" #endif +#if wxUSE_HELP + +#include "wx/filefn.h" #include "wx/msw/helpwin.h" -#if wxUSE_HELP #include <time.h> #ifdef __WXMSW__ @@ -35,124 +37,91 @@ #include <string.h> -// MAX path length -#define _MAXPATHLEN 500 - -// MAX length of Help descriptor -#define _MAX_HELP_LEN 500 - -IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase) - -wxWinHelpController::wxWinHelpController(void) +static HWND GetSuitableHWND() { - m_helpFile = ""; + if (wxTheApp->GetTopWindow()) + return (HWND) wxTheApp->GetTopWindow()->GetHWND(); + else + return GetDesktopWindow(); } -wxWinHelpController::~wxWinHelpController(void) -{ -} +IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase) bool wxWinHelpController::Initialize(const wxString& filename) { - m_helpFile = filename; - return TRUE; + m_helpFile = filename; + return TRUE; } bool wxWinHelpController::LoadFile(const wxString& file) { - m_helpFile = file; - return TRUE; + if (!file.IsEmpty()) + m_helpFile = file; + return TRUE; } bool wxWinHelpController::DisplayContents(void) { - if (m_helpFile == wxT("")) return FALSE; - - wxString str = m_helpFile; - size_t len = str.Length(); - if (!(str[(size_t)(len-1)] == wxT('p') && str[(size_t)(len-2)] == wxT('l') && str[(size_t)(len-3)] == wxT('h') && str[(size_t)(len-4)] == wxT('.'))) - str += wxT(".hlp"); - - if (wxTheApp->GetTopWindow()) - { + if (m_helpFile.IsEmpty()) return FALSE; + + wxString str = GetValidFilename(m_helpFile); + #if defined(__WIN95__) - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_FINDER, 0L); + WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_FINDER, 0L); #else - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTENTS, 0L); + WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_CONTENTS, 0L); #endif - return TRUE; - } - return FALSE; + return TRUE; } bool wxWinHelpController::DisplaySection(int section) { // Use context number - if (m_helpFile == wxT("")) return FALSE; - - wxString str = m_helpFile; - size_t len = str.Length(); - if (!(str[(size_t)(len-1)] == wxT('p') && str[(size_t)(len-2)] == wxT('l') && str[(size_t)(len-3)] == wxT('h') && str[(size_t)(len-4)] == wxT('.'))) - str += wxT(".hlp"); + if (m_helpFile.IsEmpty()) return FALSE; + + wxString str = GetValidFilename(m_helpFile); - if (wxTheApp->GetTopWindow()) - { - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section); - return TRUE; - } - return FALSE; + WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section); + return TRUE; } bool wxWinHelpController::DisplayBlock(long block) { - // Use context number -- a very rough equivalent to block id! - if (m_helpFile == wxT("")) return FALSE; - - wxString str = m_helpFile; - size_t len = str.Length(); - if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.')) - str += wxT(".hlp"); - - if (wxTheApp->GetTopWindow()) - { - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block); - return TRUE; - } - return FALSE; + DisplaySection(block); + return TRUE; } bool wxWinHelpController::KeywordSearch(const wxString& k) { - if (m_helpFile == wxT("")) return FALSE; - - wxString str = m_helpFile; - size_t len = str.Length(); - if (!(str[(size_t)(len-1)] == wxT('p') && str[(size_t)(len-2)] == wxT('l') && str[(size_t)(len-3)] == wxT('h') && str[(size_t)(len-4)] == wxT('.'))) - str += wxT(".hlp"); - - if (wxTheApp->GetTopWindow()) - { - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k); - return TRUE; - } - return FALSE; + if (m_helpFile.IsEmpty()) return FALSE; + + wxString str = GetValidFilename(m_helpFile); + + WinHelp(GetSuitableHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k); + return TRUE; } // Can't close the help window explicitly in WinHelp bool wxWinHelpController::Quit(void) { - if (wxTheApp->GetTopWindow()) - { - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), 0, HELP_QUIT, 0L); + WinHelp(GetSuitableHWND(), 0, HELP_QUIT, 0L); return TRUE; - } - else - return FALSE; } -// Don't get notified of WinHelp quitting -void wxWinHelpController::OnQuit(void) +// Append extension if necessary. +wxString wxWinHelpController::GetValidFilename(const wxString& file) const { + wxString path, name, ext; + wxSplitPath(file, & path, & name, & ext); + + wxString fullName; + if (path.IsEmpty()) + fullName = name + wxT(".hlp"); + else if (path.Last() == wxT('\\')) + fullName = path + name + wxT(".hlp"); + else + fullName = path + wxT("\\") + name + wxT(".hlp"); + return fullName; } #endif // wxUSE_HELP diff --git a/src/msw/icon.cpp b/src/msw/icon.cpp index 80fb47d876..a7e1fcad9d 100644 --- a/src/msw/icon.cpp +++ b/src/msw/icon.cpp @@ -126,7 +126,7 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp) HICON hicon = ::CreateIconIndirect(&iconInfo); if ( !hicon ) { - wxLogLastError("CreateIconIndirect"); + wxLogLastError(wxT("CreateIconIndirect")); } else { diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index 380f211450..48bd3c57a2 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -100,7 +100,7 @@ bool wxImageList::Create(int width, int height, bool mask, int initial) initial, 1); if ( !m_hImageList ) { - wxLogLastError("ImageList_Create()"); + wxLogLastError(wxT("ImageList_Create()")); } return m_hImageList != 0; @@ -127,6 +127,14 @@ int wxImageList::GetImageCount() const return ImageList_GetImageCount(GetHImageList()); } +// Returns the size (same for all images) of the images in the list +bool wxImageList::GetSize(int WXUNUSED(index), int &width, int &height) const +{ + wxASSERT_MSG( m_hImageList, _T("invalid image list") ); + + return ImageList_GetIconSize(GetHImageList(), &width, &height) != 0; +} + // ---------------------------------------------------------------------------- // wxImageList operations // ---------------------------------------------------------------------------- @@ -200,7 +208,7 @@ bool wxImageList::Replace(int index, GetHbitmapOf(bitmap), hbmpMask) != 0; if ( !ok ) { - wxLogLastError("ImageList_Add()"); + wxLogLastError(wxT("ImageList_Add()")); } ::DeleteObject(hbmpMask); @@ -215,7 +223,7 @@ bool wxImageList::Replace(int i, const wxIcon& icon) bool ok = ImageList_ReplaceIcon(GetHImageList(), i, GetHiconOf(icon)) != 0; if ( !ok ) { - wxLogLastError("ImageList_ReplaceIcon()"); + wxLogLastError(wxT("ImageList_ReplaceIcon()")); } return ok; @@ -231,7 +239,7 @@ bool wxImageList::Remove(int index) bool ok = ImageList_Remove(GetHImageList(), index) != 0; if ( !ok ) { - wxLogLastError("ImageList_Remove()"); + wxLogLastError(wxT("ImageList_Remove()")); } return ok; @@ -295,7 +303,7 @@ bool wxImageList::Draw(int index, bool ok = ImageList_Draw(GetHImageList(), index, hDC, x, y, style) != 0; if ( !ok ) { - wxLogLastError("ImageList_Draw()"); + wxLogLastError(wxT("ImageList_Draw()")); } return ok; diff --git a/src/msw/iniconf.cpp b/src/msw/iniconf.cpp index cc177eab52..eca894e0db 100644 --- a/src/msw/iniconf.cpp +++ b/src/msw/iniconf.cpp @@ -28,6 +28,10 @@ #include "wx/utils.h" #endif //WX_PRECOMP +// Doesn't yet compile in Unicode mode + +#if wxUSE_CONFIG && !wxUSE_UNICODE + #include "wx/dynarray.h" #include "wx/log.h" #include "wx/config.h" @@ -79,19 +83,19 @@ wxIniConfig::wxIniConfig(const wxString& strAppName, m_strLocalFilename = localFilename; if (m_strLocalFilename.IsEmpty()) { - m_strLocalFilename = GetAppName() + ".ini"; + m_strLocalFilename = GetAppName() + wxT(".ini"); } // append the extension if none given and it's not an absolute file name // (otherwise we assume that they know what they're doing) if ( !wxIsPathSeparator(m_strLocalFilename[0u]) && - m_strLocalFilename.Find('.') == wxNOT_FOUND ) + m_strLocalFilename.Find(wxT('.')) == wxNOT_FOUND ) { - m_strLocalFilename << ".ini"; + m_strLocalFilename << wxT(".ini"); } // set root path - SetPath(""); + SetPath(wxT("")); } wxIniConfig::~wxIniConfig() @@ -380,7 +384,7 @@ bool wxIniConfig::Write(const wxString& szKey, const wxString& szValue) szValue, m_strLocalFilename) != 0; if ( !bOk ) - wxLogLastError("WritePrivateProfileString"); + wxLogLastError(wxT("WritePrivateProfileString")); return bOk; } @@ -424,7 +428,7 @@ bool wxIniConfig::DeleteEntry(const wxString& szKey, bool bGroupIfEmptyAlso) NULL, m_strLocalFilename) != 0; if ( !bOk ) - wxLogLastError("WritePrivateProfileString"); + wxLogLastError(wxT("WritePrivateProfileString")); return bOk; } @@ -439,7 +443,7 @@ bool wxIniConfig::DeleteGroup(const wxString& szKey) NULL, m_strLocalFilename) != 0; if ( !bOk ) - wxLogLastError("WritePrivateProfileString"); + wxLogLastError(wxT("WritePrivateProfileString")); return bOk; } @@ -458,11 +462,11 @@ bool wxIniConfig::DeleteAll() size_t nRc = GetWindowsDirectory(szBuf, WXSIZEOF(szBuf)); if ( nRc == 0 ) { - wxLogLastError("GetWindowsDirectory"); + wxLogLastError(wxT("GetWindowsDirectory")); } else if ( nRc > WXSIZEOF(szBuf) ) { - wxFAIL_MSG("buffer is too small for Windows directory."); + wxFAIL_MSG(wxT("buffer is too small for Windows directory.")); } wxString strFile = szBuf; @@ -487,3 +491,6 @@ bool wxIniConfig::RenameGroup(const wxString& oldName, const wxString& newName) // Not implemented return FALSE; } + +#endif + // wxUSE_CONFIG && wxUSE_UNICODE diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 067fc11d90..3594e49841 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -156,7 +156,7 @@ bool wxListBox::Create(wxWindow *parent, m_windowStyle = style; DWORD wstyle = WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | - LBS_NOTIFY | LBS_HASSTRINGS; + LBS_NOTIFY | LBS_HASSTRINGS /* | WS_CLIPSIBLINGS */; if (m_windowStyle & wxLB_MULTIPLE) wstyle |= LBS_MULTIPLESEL; else if (m_windowStyle & wxLB_EXTENDED) @@ -221,8 +221,6 @@ bool wxListBox::Create(wxWindow *parent, SetSize(x, y, width, height); - Show(TRUE); - return TRUE; } @@ -292,7 +290,12 @@ int wxListBox::DoAppend(const wxString& item) void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) { - ShowWindow(GetHwnd(), SW_HIDE); + // avoid flicker - but don't need to do this for a hidden listbox + bool hideAndShow = IsShown(); + if ( hideAndShow ) + { + ShowWindow(GetHwnd(), SW_HIDE); + } ListBox_ResetContent(GetHwnd()); @@ -333,7 +336,11 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) SetHorizontalExtent(); - ShowWindow(GetHwnd(), SW_SHOW); + if ( hideAndShow ) + { + // show the listbox back if we hid it + ShowWindow(GetHwnd(), SW_SHOW); + } } int wxListBox::FindString(const wxString& s) const @@ -467,9 +474,10 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const } else // single-selection listbox { - aSelections.Add(ListBox_GetCurSel(GetHwnd())); + if (ListBox_GetCurSel(GetHwnd()) > -1) + aSelections.Add(ListBox_GetCurSel(GetHwnd())); - return 1; + return aSelections.Count(); } } @@ -478,8 +486,7 @@ int wxListBox::GetSelection() const { wxCHECK_MSG( !HasMultipleSelection(), -1, - wxT("GetSelection() can't be used with multiple-selection " - "listboxes, use GetSelections() instead.") ); + wxT("GetSelection() can't be used with multiple-selection listboxes, use GetSelections() instead.") ); return ListBox_GetCurSel(GetHwnd()); } @@ -742,6 +749,11 @@ bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) wxCHECK( ((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), FALSE ); DRAWITEMSTRUCT *pStruct = (DRAWITEMSTRUCT *)item; + UINT itemID = pStruct->itemID; + + // the item may be -1 for an empty listbox + if ( itemID == (UINT)-1 ) + return FALSE; long data = ListBox_GetItemData(GetHwnd(), pStruct->itemID); @@ -752,7 +764,7 @@ bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) wxDC dc; dc.SetHDC((WXHDC)pStruct->hDC, FALSE); wxRect rect(wxPoint(pStruct->rcItem.left, pStruct->rcItem.top), - wxPoint(pStruct->rcItem.right, pStruct->rcItem.bottom)); + wxPoint(pStruct->rcItem.right, pStruct->rcItem.bottom)); return pItem->OnDrawItem(dc, rect, (wxOwnerDrawn::wxODAction)pStruct->itemAction, diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 2353ebb54d..2c4f6642de 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -209,8 +209,7 @@ bool wxListCtrl::DoCreateControl(int x, int y, int w, int h) if ( !m_hWnd ) { - wxLogError(_("Can't create list control window, check " - "that comctl32.dll is installed.")); + wxLogError(_("Can't create list control window, check that comctl32.dll is installed.")); return FALSE; } @@ -952,7 +951,7 @@ bool wxListCtrl::DeleteAllColumns() { if ( ListView_DeleteColumn(GetHwnd(), 0) == 0 ) { - wxLogLastError("ListView_DeleteColumn"); + wxLogLastError(wxT("ListView_DeleteColumn")); return FALSE; } @@ -1436,7 +1435,12 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) event.m_code = wxCharCodeMSWToWX(wVKey); } - event.m_item.m_data = GetItemData(lItem); + if ( lItem != -1 ) + { + // fill the other fields too + event.m_item.m_text = GetItemText(lItem); + event.m_item.m_data = GetItemData(lItem); + } } break; @@ -1458,6 +1462,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED; event.m_itemIndex = nmLV->iItem; + event.m_item.m_text = GetItemText(nmLV->iItem); event.m_item.m_data = GetItemData(nmLV->iItem); break; diff --git a/src/msw/makefile.b32 b/src/msw/makefile.b32 index a221c0d91d..eb6ddc589c 100644 --- a/src/msw/makefile.b32 +++ b/src/msw/makefile.b32 @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 15:55, 2000/03/14 +# This file was automatically generated by tmake at 09:26, 2000/06/19 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T! # @@ -51,12 +51,12 @@ PERIPH_CLEAN_TARGET=clean_ctl3d $(PERIPH_CLEAN_TARGET) !endif !if "$(USE_XPM_IN_MSW)" == "1" -PERIPH_LIBS=$(WXLIB)\xpm.lib $(PERIPH_LIBS) +PERIPH_LIBS=$(WXDIR)\lib\xpm.lib $(PERIPH_LIBS) PERIPH_TARGET=xpm $(PERIPH_TARGET) PERIPH_CLEAN_TARGET=clean_xpm $(PERIPH_CLEAN_TARGET) !endif -#PERIPH_LIBS=$(WXDIR)\lib\zlib.lib $(WXDIR)\lib\winpng.lib $(WXDIR)\lib\jpeg.lib $(PERIPH_LIBS) +#PERIPH_LIBS=$(WXDIR)\lib\zlib.lib $(WXDIR)\lib\winpng.lib $(WXDIR)\lib\jpeg.lib $(WXDIR)\lib\tiff.lib $(PERIPH_LIBS) PERIPH_LIBS= PERIPH_TARGET=zlib png jpeg tiff $(PERIPH_TARGET) PERIPH_CLEAN_TARGET=clean_zlib clean_png clean_jpeg clean_tiff $(PERIPH_CLEAN_TARGET) @@ -65,7 +65,7 @@ PERIPH_CLEAN_TARGET=clean_zlib clean_png clean_jpeg clean_tiff $(PERIPH_CLEAN_TA DUMMY=dummy !else DUMMY=dummydll -LIBS= cw32 import32 ole2w32 +LIBS= cw32mti import32 ole2w32 odbc32 xpm zlib winpng jpeg tiff !endif LIBTARGET=$(WXLIB) @@ -97,6 +97,7 @@ GENERICOBJS= $(MSWDIR)\busyinfo.obj \ $(MSWDIR)\scrolwin.obj \ $(MSWDIR)\splitter.obj \ $(MSWDIR)\statusbr.obj \ + $(MSWDIR)\tabg.obj \ $(MSWDIR)\tbarsmpl.obj \ $(MSWDIR)\textdlgg.obj \ $(MSWDIR)\tipdlg.obj \ @@ -218,6 +219,7 @@ COMMONOBJS = \ MSWOBJS = $(MSWDIR)\accel.obj \ $(MSWDIR)\app.obj \ + $(MSWDIR)\automtn.obj \ $(MSWDIR)\bitmap.obj \ $(MSWDIR)\bmpbuttn.obj \ $(MSWDIR)\brush.obj \ @@ -263,6 +265,7 @@ MSWOBJS = $(MSWDIR)\accel.obj \ $(MSWDIR)\glcanvas.obj \ $(MSWDIR)\gsocket.obj \ $(MSWDIR)\gsockmsw.obj \ + $(MSWDIR)\helpchm.obj \ $(MSWDIR)\helpwin.obj \ $(MSWDIR)\icon.obj \ $(MSWDIR)\imaglist.obj \ @@ -358,7 +361,7 @@ $(LIBTARGET): $(DUMMY).obj $(OBJECTS) $(LIBTARGET): $(DUMMY).obj $(OBJECTS) -erase $(LIBTARGET) -erase $(WXLIBDIR)\wx.dll - tlink32 $(LINK_FLAGS) /v @&&! + $(LINK) $(LINK_FLAGS) /L$(WXLIBDIR);$(BCCDIR)\lib;$(BCCDIR)\lib\psdk /v @&&! c0d32.obj $(OBJECTS) $(WXLIBDIR)\wx nul @@ -390,6 +393,8 @@ $(MSWDIR)\accel.obj: $(MSWDIR)\accel.$(SRCSUFF) $(MSWDIR)\app.obj: $(MSWDIR)\app.$(SRCSUFF) +$(MSWDIR)\automtn.obj: $(OLEDIR)\automtn.$(SRCSUFF) + $(MSWDIR)\bitmap.obj: $(MSWDIR)\bitmap.$(SRCSUFF) $(MSWDIR)\bmpbuttn.obj: $(MSWDIR)\bmpbuttn.$(SRCSUFF) @@ -480,6 +485,8 @@ $(MSWDIR)\gsocket.obj: $(MSWDIR)\gsocket.c $(MSWDIR)\gsockmsw.obj: $(MSWDIR)\gsockmsw.c +$(MSWDIR)\helpchm.obj: $(MSWDIR)\helpchm.$(SRCSUFF) + $(MSWDIR)\helpwin.obj: $(MSWDIR)\helpwin.$(SRCSUFF) $(MSWDIR)\icon.obj: $(MSWDIR)\icon.$(SRCSUFF) @@ -831,6 +838,8 @@ $(MSWDIR)\splitter.obj: $(GENDIR)\splitter.$(SRCSUFF) $(MSWDIR)\statusbr.obj: $(GENDIR)\statusbr.$(SRCSUFF) +$(MSWDIR)\tabg.obj: $(GENDIR)\tabg.$(SRCSUFF) + $(MSWDIR)\tbarsmpl.obj: $(GENDIR)\tbarsmpl.$(SRCSUFF) $(MSWDIR)\textdlgg.obj: $(GENDIR)\textdlgg.$(SRCSUFF) @@ -966,6 +975,7 @@ clean_tiff: $(CFG): makefile.b32 copy &&! +-Hc -H=$(WXDIR)\src\msw\wx32.csm -3 -d @@ -991,13 +1001,11 @@ $(DEBUG_FLAGS) $(WIN95FLAG) ! $(CFG) -#$(LNKCFG): makefile.b32 -# copy &&! -#-L$(WXLIBDIR);$(WXLIBDIR2);$(BCCDIR)\lib;$(BCCDIR)\lib\psdk -#! $(LNKCFG) - clean: $(PERIPH_CLEAN_TARGET) -erase $(LIBTARGET) + -erase $(WXLIBDIR)\wx.dll + -erase $(WXLIBDIR)\wx.tds + -erase $(WXLIBDIR)\wx.il? -erase *.obj -erase *.pch -erase *.csm diff --git a/src/msw/makefile.bcc b/src/msw/makefile.bcc index 456a7e3de2..f45b412eaf 100644 --- a/src/msw/makefile.bcc +++ b/src/msw/makefile.bcc @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 16:08, 2000/03/20 +# This file was automatically generated by tmake at 20:13, 2000/03/31 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T! # diff --git a/src/msw/makefile.dos b/src/msw/makefile.dos index afd69682d1..8d399e3d49 100644 --- a/src/msw/makefile.dos +++ b/src/msw/makefile.dos @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 15:55, 2000/03/14 +# This file was automatically generated by tmake at 20:13, 2000/03/31 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T! # diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95 index 27a9d79c74..5962ba7b64 100644 --- a/src/msw/makefile.g95 +++ b/src/msw/makefile.g95 @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 15:55, 2000/03/14 +# This file was automatically generated by tmake at 20:13, 2000/03/31 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T! # @@ -261,6 +261,7 @@ MSWOBJS = \ $(MSWDIR)/glcanvas.$(OBJSUFF) \ $(MSWDIR)/gsocket.$(OBJSUFF) \ $(MSWDIR)/gsockmsw.$(OBJSUFF) \ + $(MSWDIR)/helpchm.$(OBJSUFF) \ $(MSWDIR)/helpwin.$(OBJSUFF) \ $(MSWDIR)/icon.$(OBJSUFF) \ $(MSWDIR)/imaglist.$(OBJSUFF) \ @@ -403,25 +404,26 @@ JPEGOBJS = \ $(JPEGDIR)/jquant2.$(OBJSUFF) \ $(JPEGDIR)/jdmerge.$(OBJSUFF) -XPMOBJS = $(XPMDIR)/attrib.o\ - $(XPMDIR)/crbuffri.o\ - $(XPMDIR)/crdatfri.o\ +# NOTE: these filenames are case sensitive! +XPMOBJS = $(XPMDIR)/Attrib.o\ + $(XPMDIR)/CrBufFrI.o\ + $(XPMDIR)/CrDatFrI.o\ $(XPMDIR)/create.o\ - $(XPMDIR)/crifrbuf.o\ - $(XPMDIR)/crifrdat.o\ + $(XPMDIR)/CrIFrBuf.o\ + $(XPMDIR)/CrIFrDat.o\ $(XPMDIR)/data.o\ - $(XPMDIR)/image.o\ - $(XPMDIR)/info.o\ + $(XPMDIR)/Image.o\ + $(XPMDIR)/Info.o\ $(XPMDIR)/hashtab.o\ $(XPMDIR)/misc.o\ $(XPMDIR)/parse.o\ - $(XPMDIR)/rdftodat.o\ - $(XPMDIR)/rdftoi.o\ + $(XPMDIR)/RdFToDat.o\ + $(XPMDIR)/RdFToI.o\ $(XPMDIR)/rgb.o\ $(XPMDIR)/scan.o\ $(XPMDIR)/simx.o\ - $(XPMDIR)/wrffrdat.o\ - $(XPMDIR)/wrffri.o + $(XPMDIR)/WrFFrDat.o\ + $(XPMDIR)/WrFFrI.o TIFFOBJS = $(TIFFDIR)/tif_aux.o \ $(TIFFDIR)/tif_close.o \ diff --git a/src/msw/makefile.sc b/src/msw/makefile.sc index cf69648015..91fdd854c5 100644 --- a/src/msw/makefile.sc +++ b/src/msw/makefile.sc @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 15:55, 2000/03/14 +# This file was automatically generated by tmake at 20:13, 2000/03/31 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T! # Symantec C++ makefile for the msw objects diff --git a/src/msw/makefile.vc b/src/msw/makefile.vc index f3a5e7e367..1cb08d23b1 100644 --- a/src/msw/makefile.vc +++ b/src/msw/makefile.vc @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 11:20, 2000/03/17 +# This file was automatically generated by tmake at 10:46, 2000/04/27 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T! # File: makefile.vc @@ -104,6 +104,7 @@ GENERICOBJS= ..\generic\$D\busyinfo.obj \ ..\generic\$D\scrolwin.obj \ ..\generic\$D\splitter.obj \ ..\generic\$D\statusbr.obj \ + ..\generic\$D\tabg.obj \ ..\generic\$D\tbarsmpl.obj \ ..\generic\$D\textdlgg.obj \ ..\generic\$D\tipdlg.obj \ @@ -129,7 +130,6 @@ NONESSENTIALOBJS= ..\generic\$D\caret.obj \ ..\generic\$D\printps.obj \ ..\generic\$D\prntdlgg.obj \ ..\generic\$D\statline.obj \ - ..\generic\$D\tabg.obj \ ..\generic\$D\treectrl.obj COMMONOBJS = \ @@ -282,6 +282,7 @@ MSWOBJS = ..\msw\$D\accel.obj \ ..\msw\$D\glcanvas.obj \ ..\msw\$D\gsocket.obj \ ..\msw\$D\gsockmsw.obj \ + ..\msw\$D\helpchm.obj \ ..\msw\$D\helpwin.obj \ ..\msw\$D\icon.obj \ ..\msw\$D\imaglist.obj \ @@ -450,6 +451,10 @@ $(WXDIR)\lib\$(WXLIBNAME).dll: $(DUMMYOBJ) $(OBJECTS) $(LINKFLAGS) -out:$(WXDIR)\lib\$(WXLIBNAME).dll $(DUMMYOBJ) $(OBJECTS) $(guilibsdll) shell32.lib comctl32.lib ctl3d32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib odbc32.lib advapi32.lib winmm.lib $(GL_LIBS) $(WXDIR)\lib\png$(LIBEXT).lib $(WXDIR)\lib\zlib$(LIBEXT).lib $(WXDIR)\lib\xpm$(LIBEXT).lib $(WXDIR)\lib\jpeg$(LIBEXT).lib $(WXDIR)\lib\tiff$(LIBEXT).lib + delayimp.lib + /delayload:ws2_32.dll /delayload:advapi32.dll /delayload:user32.dll /delayload:gdi32.dll + /delayload:comdlg32.dll /delayload:shell32.dll /delayload:comctl32.dll /delayload:ole32.dll + /delayload:oleaut32.dll /delayload:rpcrt4.dll /delayload:winmm.dll /delayload:opengl32.dll << !endif @@ -467,7 +472,7 @@ $(CPPFLAGS) $(MAKEPRECOMP) /Fo$D\dummydll.obj /c /Tp dummydll.cpp << # Compile certain files with no optimization (some files cause a -# compiler crash for buggy versions of VC++, e.g. 4.0) +# compiler crash for buggy versions of VC++, e.g. 4.0). # Don't forget to put FINAL=1 on the command line. noopt: cl @<< @@ -655,7 +660,7 @@ clean: $(PERIPH_CLEAN_TARGET) # Making documents -docs: allhlp allhtml allpdfrtf +docs: allhlp allhtml allpdfrtf htb htmlhelp alldocs: docs hlp: wxhlp wxhlp: $(DOCDIR)/winhelp/wx.hlp @@ -664,8 +669,9 @@ rtf: $(DOCDIR)/winhelp/wx.rtf pdfrtf: $(DOCDIR)/pdf/wx.rtf refpdfrtf: $(DOCDIR)/pdf/techref.rtf html: wxhtml +htb: $(DOCDIR)\htb\wx.htb wxhtml: $(DOCDIR)\html\wx\wx.htm -htmlhelp: $(DOCDIR)\html\wx\wx.chm +htmlhelp: $(DOCDIR)\htmlhelp\wx.chm ps: wxps referencps wxps: $(WXDIR)\docs\ps\wx.ps referencps: $(WXDIR)\docs\ps\referenc.ps @@ -776,6 +782,7 @@ $(DOCDIR)/pdf/techref.rtf: $(DOCDIR)/latex/techref/techref.tex $(DOCDIR)\html\wx\wx.htm: $(DOCDIR)\latex\wx\classes.tex $(DOCDIR)\latex\wx\body.tex $(DOCDIR)/latex/wx/topics.tex $(DOCDIR)\latex\wx\manual.tex cd $(DOCDIR)\latex\wx -mkdir $(DOCDIR)\html\wx + copy *.gif $(DOCDIR)\html\wx -start $(WAITFLAG) tex2rtf $(DOCDIR)\latex\wx\manual.tex $(DOCDIR)\html\wx\wx.htm -twice -html -erase $(DOCDIR)\html\wx\*.con -erase $(DOCDIR)\html\wx\*.ref @@ -783,9 +790,11 @@ $(DOCDIR)\html\wx\wx.htm: $(DOCDIR)\latex\wx\classes.tex $(DOCDIR)\latex -erase $(DOCDIR)\latex\wx\*.ref cd $(THISDIR) -$(DOCDIR)\html\wx\wx.chm : $(DOCDIR)\html\wx\wx.htm $(DOCDIR)\html\wx\wx.hhp +$(DOCDIR)\htmlhelp\wx.chm : $(DOCDIR)\html\wx\wx.htm $(DOCDIR)\html\wx\wx.hhp cd $(DOCDIR)\html\wx -hhc wx.hhp + -mkdir ..\..\htmlhelp + move wx.chm ..\..\htmlhelp cd $(THISDIR) $(WXDIR)\docs\latex\wx\manual.dvi: $(DOCDIR)/latex/wx/body.tex $(DOCDIR)/latex/wx/manual.tex @@ -824,11 +833,12 @@ $(WXDIR)\docs\ps\referenc.ps: $(WXDIR)\docs\latex\wx\referenc.dvi # files, renamed to htb. # This can then be used with e.g. helpview. # Optionally, a cached version of the .hhp file can be generated with hhp2cached. -htb: +$(DOCDIR)\htb\wx.htb: $(DOCDIR)\html\wx\wx.htm cd $(WXDIR)\docs\html\wx -erase /Y wx.zip wx.htb zip32 wx.zip *.htm *.gif *.hhp *.hhc *.hhk - ren wx.zip wx.htb + -mkdir $(DOCDIR)\htb + move wx.zip $(DOCDIR)\htb\wx.htb cd $(THISDIR) # In order to force document reprocessing @@ -837,6 +847,13 @@ touchmanual: updatedocs: touchmanual alldocs +cleandocs: + -erase /Y $(DOCDIR)\html\wx\wx.htm + -erase /Y $(DOCDIR)\pdf\wx.rtf + -erase /Y $(DOCDIR)\latex\wx\wx.rtf + -erase /Y $(DOCDIR)\htmlhelp\wx.chm + -erase /Y $(DOCDIR)\htb\wx.htb + # Start Word, running the GeneratePDF macro. MakeManual.dot should be in the # Office StartUp folder, and PDFMaker should be installed. updatepdf: # touchmanual pdfrtf diff --git a/src/msw/makefile.wat b/src/msw/makefile.wat index b342d6efad..2a31747017 100644 --- a/src/msw/makefile.wat +++ b/src/msw/makefile.wat @@ -1,6 +1,6 @@ #!/binb/wmake.exe -# This file was automatically generated by tmake at 15:55, 2000/03/14 +# This file was automatically generated by tmake at 11:50, 2000/06/26 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T! # @@ -29,11 +29,13 @@ LIBTARGET = $(WXLIB)\wx.lib DUMMY=dummydll # ODBCLIB = ..\..\contrib\odbc\odbc32.lib -EXTRATARGETS = xpm png zlib -EXTRATARGETSCLEAN = clean_xpm clean_png clean_zlib +EXTRATARGETS = xpm png zlib jpeg tiff +EXTRATARGETSCLEAN = clean_xpm clean_png clean_zlib clean_jpeg clean_tiff GENDIR=$(WXDIR)\src\generic COMMDIR=$(WXDIR)\src\common XPMDIR=$(WXDIR)\src\xpm +JPEGDIR=$(WXDIR)\src\jpeg +TIFFDIR=$(WXDIR)\src\tiff MSWDIR=$(WXDIR)\src\msw OLEDIR=$(MSWDIR)\ole @@ -58,6 +60,7 @@ GENERICOBJS= busyinfo.obj & scrolwin.obj & splitter.obj & statusbr.obj & + tabg.obj & tbarsmpl.obj & textdlgg.obj & tipdlg.obj & @@ -83,7 +86,6 @@ NONESSENTIALOBJS= caret.obj & printps.obj & prntdlgg.obj & statline.obj & - tabg.obj & treectrl.obj COMMONOBJS = & @@ -133,6 +135,7 @@ COMMONOBJS = & imagbmp.obj & image.obj & imaggif.obj & + imagjpeg.obj & imagpcx.obj & imagpng.obj & imagpnm.obj & @@ -236,6 +239,7 @@ MSWOBJS = accel.obj & glcanvas.obj & gsocket.obj & gsockmsw.obj & + helpchm.obj & helpwin.obj & icon.obj & imaglist.obj & @@ -464,6 +468,9 @@ gsocket.obj: $(MSWDIR)\gsocket.c gsockmsw.obj: $(MSWDIR)\gsockmsw.c *$(CC) $(CPPFLAGS) $(IFLAGS) $< +helpchm.obj: $(MSWDIR)\helpchm.cpp + *$(CCC) $(CPPFLAGS) $(IFLAGS) $< + helpwin.obj: $(MSWDIR)\helpwin.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< @@ -769,6 +776,9 @@ image.obj: $(COMMDIR)\image.cpp imaggif.obj: $(COMMDIR)\imaggif.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< +imagjpeg.obj: $(COMMDIR)\imagjpeg.cpp + *$(CCC) $(CPPFLAGS) $(IFLAGS) $< + imagpcx.obj: $(COMMDIR)\imagpcx.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< @@ -1002,6 +1012,9 @@ splitter.obj: $(GENDIR)\splitter.cpp statusbr.obj: $(GENDIR)\statusbr.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< +tabg.obj: $(GENDIR)\tabg.cpp + *$(CCC) $(CPPFLAGS) $(IFLAGS) $< + tbarsmpl.obj: $(GENDIR)\tbarsmpl.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< @@ -1165,6 +1178,26 @@ clean_zlib: .SYMBOLIC wmake -f makefile.wat clean cd $(WXDIR)\src\msw +jpeg: .SYMBOLIC + cd $(WXDIR)\src\jpeg + wmake -f makefile.wat all + cd $(WXDIR)\src\msw + +clean_jpeg: .SYMBOLIC + cd $(WXDIR)\src\jpeg + wmake -f makefile.wat clean + cd $(WXDIR)\src\msw + +tiff: .SYMBOLIC + cd $(WXDIR)\src\tiff + wmake -f makefile.wat all + cd $(WXDIR)\src\msw + +clean_tiff: .SYMBOLIC + cd $(WXDIR)\src\tiff + wmake -f makefile.wat clean + cd $(WXDIR)\src\msw + MFTYPE=wat self : .SYMBOLIC $(WXDIR)\distrib\msw\tmake\filelist.txt $(WXDIR)\distrib\msw\tmake\$(MFTYPE).t cd $(WXDIR)\distrib\msw\tmake diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 399272c58b..7b551b6a4d 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -132,6 +132,10 @@ BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) END_EVENT_TABLE() +BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) + EVT_IDLE(wxMDIChildFrame::OnIdle) +END_EVENT_TABLE() + BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) EVT_SCROLL(wxMDIClientWindow::OnScroll) END_EVENT_TABLE() @@ -222,6 +226,9 @@ bool wxMDIParentFrame::Create(wxWindow *parent, wxModelessWindows.Append(this); + // unlike (almost?) all other windows, frames are created hidden + m_isShown = FALSE; + return TRUE; } @@ -559,8 +566,7 @@ bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) { // this shouldn't happen because it means that our messages are being // lost (they're not sent to the parent frame nor to the children) - wxFAIL_MSG(wxT("MDI parent frame is not active, " - "yet there is no active MDI child?")); + wxFAIL_MSG(wxT("MDI parent frame is not active, yet there is no active MDI child?")); } return FALSE; @@ -583,17 +589,20 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg) { MSG *pMsg = (MSG *)msg; + // first let the current child get it if ( m_currentChild && m_currentChild->GetHWND() && m_currentChild->MSWTranslateMessage(msg) ) { return TRUE; } - if ( m_acceleratorTable.Translate(this, msg) ) + // then try out accel table (will also check the menu accels) + if ( wxFrame::MSWTranslateMessage(msg) ) { return TRUE; } + // finally, check for MDI specific built in accel keys if ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN ) { if ( ::TranslateMDISysAccel(GetWinHwnd(GetClientWindow()), pMsg)) @@ -607,8 +616,9 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg) // wxMDIChildFrame // =========================================================================== -wxMDIChildFrame::wxMDIChildFrame() +void wxMDIChildFrame::Init() { + m_needsResize = TRUE; } bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, @@ -1136,7 +1146,7 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) (LPSTR)(LPCLIENTCREATESTRUCT)&ccs); if ( !m_hWnd ) { - wxLogLastError("CreateWindowEx(MDI client)"); + wxLogLastError(wxT("CreateWindowEx(MDI client)")); return FALSE; } @@ -1196,6 +1206,22 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF } } +void wxMDIChildFrame::OnIdle(wxIdleEvent& event) +{ + // MDI child frames get their WM_SIZE when they're constructed but at this + // moment they don't have any children yet so all child windows will be + // positioned incorrectly when they are added later - to fix this, we + // generate an artificial size event here + if ( m_needsResize ) + { + m_needsResize = FALSE; // avoid any possibility of recursion + + SendSizeEvent(); + } + + event.Skip(); +} + // --------------------------------------------------------------------------- // non member functions // --------------------------------------------------------------------------- @@ -1204,10 +1230,11 @@ static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow) { ::SendMessage(GetWinHwnd(win), WM_MDISETMENU, #ifdef __WIN32__ - (WPARAM)hmenuFrame, (LPARAM)hmenuWindow); + (WPARAM)hmenuFrame, (LPARAM)hmenuWindow #else - 0, MAKELPARAM(hmenuFrame, hmenuWindow)); + 0, MAKELPARAM(hmenuFrame, hmenuWindow) #endif + ); // update menu bar of the parent window wxWindow *parent = win->GetParent(); @@ -1236,18 +1263,18 @@ static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu) continue; } - if ( wxStripMenuCodes(wxString(buf)).IsSameAs(wxT("Help")) ) + if ( wxStripMenuCodes(wxString(buf)).IsSameAs(_("Help")) ) { success = TRUE; ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING, - (UINT)subMenu, wxT("&Window")); + (UINT)subMenu, _("&Window")); break; } } if ( !success ) { - ::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, wxT("&Window")); + ::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, _("&Window")); } } @@ -1271,7 +1298,7 @@ static void RemoveWindowMenu(wxWindow *win, WXHMENU menu) continue; } - if ( wxStripMenuCodes(wxString(buf)).IsSameAs(wxT("Window")) ) + if ( wxStripMenuCodes(wxString(buf)).IsSameAs(_("Window")) ) { success = TRUE; ::RemoveMenu(hmenu, i, MF_BYPOSITION); diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 783a2cd977..bf7b961b17 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -82,7 +82,7 @@ void wxMenu::Init() m_hMenu = (WXHMENU)CreatePopupMenu(); if ( !m_hMenu ) { - wxLogLastError("CreatePopupMenu"); + wxLogLastError(wxT("CreatePopupMenu")); } // if we have a title, insert it in the beginning of the menu @@ -103,7 +103,7 @@ wxMenu::~wxMenu() { if ( !::DestroyMenu(GetHmenu()) ) { - wxLogLastError("DestroyMenu"); + wxLogLastError(wxT("DestroyMenu")); } } @@ -135,35 +135,50 @@ int wxMenu::FindAccel(int id) const void wxMenu::UpdateAccel(wxMenuItem *item) { - // find the (new) accel for this item - wxAcceleratorEntry *accel = wxGetAccelFromString(item->GetText()); - if ( accel ) - accel->m_command = item->GetId(); - - // find the old one - int n = FindAccel(item->GetId()); - if ( n == wxNOT_FOUND ) + if ( item->IsSubMenu() ) { - // no old, add new if any - if ( accel ) - m_accels.Add(accel); - else - return; // skipping RebuildAccelTable() below + wxMenu *submenu = item->GetSubMenu(); + wxMenuItemList::Node *node = submenu->GetMenuItems().GetFirst(); + while ( node ) + { + UpdateAccel(node->GetData()); + + node = node->GetNext(); + } } - else + else if ( !item->IsSeparator() ) { - // replace old with new or just remove the old one if no new - delete m_accels[n]; + // find the (new) accel for this item + wxAcceleratorEntry *accel = wxGetAccelFromString(item->GetText()); if ( accel ) - m_accels[n] = accel; + accel->m_command = item->GetId(); + + // find the old one + int n = FindAccel(item->GetId()); + if ( n == wxNOT_FOUND ) + { + // no old, add new if any + if ( accel ) + m_accels.Add(accel); + else + return; // skipping RebuildAccelTable() below + } else - m_accels.Remove(n); - } + { + // replace old with new or just remove the old one if no new + delete m_accels[n]; + if ( accel ) + m_accels[n] = accel; + else + m_accels.Remove(n); + } - if ( IsAttached() ) - { - m_menuBar->RebuildAccelTable(); + if ( IsAttached() ) + { + m_menuBar->RebuildAccelTable(); + } } + //else: it is a separator, they can't have accels, nothing to do } #endif // wxUSE_ACCEL @@ -234,7 +249,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) if ( !ok ) { - wxLogLastError("Insert or AppendMenu"); + wxLogLastError(wxT("Insert or AppendMenu")); return FALSE; } @@ -308,7 +323,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) // remove the item from the menu if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) ) { - wxLogLastError("RemoveMenu"); + wxLogLastError(wxT("RemoveMenu")); } if ( IsAttached() ) @@ -361,7 +376,7 @@ void wxMenu::SetTitle(const wxString& label) (unsigned)idMenuTitle, m_title) || !::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) ) { - wxLogLastError("InsertMenu"); + wxLogLastError(wxT("InsertMenu")); } } } @@ -373,7 +388,7 @@ void wxMenu::SetTitle(const wxString& label) if ( !RemoveMenu(hMenu, 0, MF_BYPOSITION) || !RemoveMenu(hMenu, 0, MF_BYPOSITION) ) { - wxLogLastError("RemoveMenu"); + wxLogLastError(wxT("RemoveMenu")); } } else @@ -383,7 +398,7 @@ void wxMenu::SetTitle(const wxString& label) MF_BYPOSITION | MF_STRING, (unsigned)idMenuTitle, m_title) ) { - wxLogLastError("ModifyMenu"); + wxLogLastError(wxT("ModifyMenu")); } } } @@ -399,7 +414,7 @@ void wxMenu::SetTitle(const wxString& label) if ( !SetMenuItemInfo(hMenu, (unsigned)idMenuTitle, FALSE, &mii) ) { - wxLogLastError("SetMenuItemInfo"); + wxLogLastError(wxT("SetMenuItemInfo")); } } #endif // Win32 @@ -546,7 +561,7 @@ WXHMENU wxMenuBar::Create() if ( !m_hMenu ) { - wxLogLastError("CreateMenu"); + wxLogLastError(wxT("CreateMenu")); } else { @@ -557,7 +572,7 @@ WXHMENU wxMenuBar::Create() (UINT)m_menus[i]->GetHMenu(), m_titles[i]) ) { - wxLogLastError("AppendMenu"); + wxLogLastError(wxT("AppendMenu")); } } } @@ -618,7 +633,7 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label) if ( ::ModifyMenu(GetHmenu(), pos, MF_BYPOSITION | MF_STRING | flagsOld, id, label) == (int)0xFFFFFFFF ) { - wxLogLastError("ModifyMenu"); + wxLogLastError(wxT("ModifyMenu")); } Refresh(); @@ -648,14 +663,14 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) // can't use ModifyMenu() because it deletes the submenu it replaces if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) ) { - wxLogLastError("RemoveMenu"); + wxLogLastError(wxT("RemoveMenu")); } if ( !::InsertMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT)GetHmenuOf(menu), title) ) { - wxLogLastError("InsertMenu"); + wxLogLastError(wxT("InsertMenu")); } #if wxUSE_ACCEL @@ -687,7 +702,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT)GetHmenuOf(menu), title) ) { - wxLogLastError("InsertMenu"); + wxLogLastError(wxT("InsertMenu")); } #if wxUSE_ACCEL @@ -748,7 +763,7 @@ wxMenu *wxMenuBar::Remove(size_t pos) { if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) ) { - wxLogLastError("RemoveMenu"); + wxLogLastError(wxT("RemoveMenu")); } menu->Detach(); @@ -831,7 +846,7 @@ int wxMenuBar::FindMenuItem(const wxString& menuString, for ( size_t i = 0; i < count; i++ ) { wxString title = wxStripMenuCodes(m_titles[i]); - if ( menuString == title ) + if ( menuLabel == title ) return m_menus[i]->FindItem(itemString); } diff --git a/src/msw/menuitem.cpp b/src/msw/menuitem.cpp index f64f57eb17..e281013c2d 100644 --- a/src/msw/menuitem.cpp +++ b/src/msw/menuitem.cpp @@ -173,7 +173,7 @@ void wxMenuItem::Enable(bool enable) (enable ? MF_ENABLED : MF_GRAYED)); if ( rc == -1 ) { - wxLogLastError("EnableMenuItem"); + wxLogLastError(wxT("EnableMenuItem")); } wxMenuItemBase::Enable(enable); @@ -192,7 +192,7 @@ void wxMenuItem::Check(bool check) (check ? MF_CHECKED : MF_UNCHECKED)); if ( rc == -1 ) { - wxLogLastError("CheckMenuItem"); + wxLogLastError(wxT("CheckMenuItem")); } wxMenuItemBase::Check(check); @@ -218,7 +218,7 @@ void wxMenuItem::SetText(const wxString& text) UINT flagsOld = ::GetMenuState(hMenu, id, MF_BYCOMMAND); if ( flagsOld == 0xFFFFFFFF ) { - wxLogLastError("GetMenuState"); + wxLogLastError(wxT("GetMenuState")); } else { diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index f8bea1184f..ce2568c2c2 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -104,6 +104,9 @@ wxMetafile::~wxMetafile() bool wxMetafile::SetClipboard(int width, int height) { +#if !wxUSE_CLIPBOARD + return FALSE; +#else if (!m_refData) return FALSE; @@ -119,6 +122,7 @@ bool wxMetafile::SetClipboard(int width, int height) wxCloseClipboard(); return success; +#endif } bool wxMetafile::Play(wxDC *dc) @@ -375,12 +379,12 @@ bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, i p < (WORD *)&pMFHead ->checksum; ++p) pMFHead ->checksum ^= *p; - FILE *fd = fopen(filename.fn_str(), "rb"); + FILE *fd = wxFopen(filename.fn_str(), "rb"); if (!fd) return FALSE; wxChar tempFileBuf[256]; wxGetTempFileName(wxT("mf"), tempFileBuf); - FILE *fHandle = fopen(wxConvFile.cWX2MB(tempFileBuf), "wb"); + FILE *fHandle = wxFopen(wxConvFile.cWX2MB(tempFileBuf), "wb"); if (!fHandle) return FALSE; fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle); diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp index e78a77cac0..4ca0315ec2 100644 --- a/src/msw/mimetype.cpp +++ b/src/msw/mimetype.cpp @@ -117,7 +117,7 @@ wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const } } -#if wxUSE_DDE +#if wxUSE_IPC // look whether we must issue some DDE requests to the application // (and not just launch it) strKey += _T("\\DDEExec"); @@ -141,7 +141,7 @@ wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const << _T('#') << ddeCommand; } else -#endif // wxUSE_DDE +#endif // wxUSE_IPC if ( !foundFilename ) { // we didn't find any '%1' - the application doesn't know which // file to open (note that we only do it if there is no DDEExec @@ -227,27 +227,23 @@ bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const // suppress possible error messages wxLogNull nolog; wxRegKey key(wxRegKey::HKCR, wxT(".") + m_ext); - if ( key.Open() && key.QueryValue(wxT("Content Type"), *mimeType) ) { - return TRUE; - } - else { - return FALSE; - } + + return key.Open() && key.QueryValue(wxT("Content Type"), *mimeType); } bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const { wxString s; - - if (GetMimeType(&s)) + + if ( !GetMimeType(&s) ) { - mimeTypes.Clear(); - mimeTypes.Add(s); - return TRUE; - } - else return FALSE; + } + + mimeTypes.Clear(); + mimeTypes.Add(s); + return TRUE; } @@ -378,18 +374,16 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) } } - if ( knownExtension ) - { - wxFileType *fileType = new wxFileType; - fileType->m_impl->Init(wxEmptyString, ext); - - return fileType; - } - else + if ( !knownExtension ) { // unknown extension return NULL; } + + wxFileType *fileType = new wxFileType; + fileType->m_impl->Init(wxEmptyString, ext); + + return fileType; } // MIME type -> extension -> file type diff --git a/src/msw/nativdlg.cpp b/src/msw/nativdlg.cpp index ce9a5db6b8..9ce9195d15 100644 --- a/src/msw/nativdlg.cpp +++ b/src/msw/nativdlg.cpp @@ -239,7 +239,7 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) { win = new wxScrollBar; } -#if defined(__WIN95__) && !defined(__TWIN32__) +#if defined(__WIN95__) && !defined(__TWIN32__) && wxUSE_SPINBTN else if (str == wxT("MSCTLS_UPDOWN32")) { win = new wxSpinButton; diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index e29b9ab51e..9ea5f213aa 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -20,18 +20,19 @@ #pragma hdrstop #endif -#include "wx/log.h" - -#include <math.h> -#include <time.h> +#include "wx/defs.h" // Watcom C++ gives a linker error if this is compiled in. -#ifndef __WATCOMC__ +// With Borland C++, all samples crash if this is compiled in. +#if !defined(__WATCOMC__) && !(defined(__BORLANDC__) && (__BORLANDC__ < 0x520)) +#include "wx/log.h" #include "wx/msw/ole/automtn.h" - #include "wx/msw/private.h" +#include <math.h> +#include <time.h> + #include <wtypes.h> #include <unknwn.h> #include <ole2.h> @@ -650,7 +651,8 @@ bool ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant) } case VT_DATE: { - struct tm tmTemp; +#if wxUSE_TIMEDATE + struct tm tmTemp; if (!TmFromOleDate(oleVariant.date, tmTemp)) return FALSE; @@ -658,7 +660,9 @@ bool ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant) wxTime time(date, tmTemp.tm_hour, tmTemp.tm_min, tmTemp.tm_sec); variant = time; - break; +#endif + + break; } case VT_I4: { @@ -679,8 +683,12 @@ bool ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant) #else variant = (bool) (oleVariant.bool != 0); #endif +#else +#ifndef HAVE_BOOL // Can't use bool operator if no native bool type + variant = (long) (oleVariant.boolVal != 0); #else variant = (bool) (oleVariant.boolVal != 0); +#endif #endif break; } diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index 59ca12f9a4..950f343536 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -317,7 +317,7 @@ STDMETHODIMP wxIDataObject::GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) pmedium->hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, sizeof(METAFILEPICT)); if ( !pmedium->hGlobal ) { - wxLogLastError("GlobalAlloc"); + wxLogLastError(wxT("GlobalAlloc")); return E_OUTOFMEMORY; } pmedium->tymed = TYMED_MFPICT; @@ -341,7 +341,7 @@ STDMETHODIMP wxIDataObject::GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, size); if ( hGlobal == NULL ) { - wxLogLastError("GlobalAlloc"); + wxLogLastError(wxT("GlobalAlloc")); return E_OUTOFMEMORY; } @@ -457,7 +457,7 @@ STDMETHODIMP wxIDataObject::SetData(FORMATETC *pformatetc, // copy data void *pBuf = GlobalLock(pmedium->hGlobal); if ( pBuf == NULL ) { - wxLogLastError("GlobalLock"); + wxLogLastError(wxT("GlobalLock")); return E_OUTOFMEMORY; } @@ -691,37 +691,37 @@ void wxDataObject::SetAutoDelete() #ifdef __WXDEBUG__ -const char *wxDataObject::GetFormatName(wxDataFormat format) +const wxChar *wxDataObject::GetFormatName(wxDataFormat format) { // case 'xxx' is not a valid value for switch of enum 'wxDataFormat' #ifdef __VISUALC__ #pragma warning(disable:4063) #endif // VC++ - static char s_szBuf[256]; + static wxChar s_szBuf[256]; switch ( format ) { - case CF_TEXT: return "CF_TEXT"; - case CF_BITMAP: return "CF_BITMAP"; - case CF_METAFILEPICT: return "CF_METAFILEPICT"; - case CF_SYLK: return "CF_SYLK"; - case CF_DIF: return "CF_DIF"; - case CF_TIFF: return "CF_TIFF"; - case CF_OEMTEXT: return "CF_OEMTEXT"; - case CF_DIB: return "CF_DIB"; - case CF_PALETTE: return "CF_PALETTE"; - case CF_PENDATA: return "CF_PENDATA"; - case CF_RIFF: return "CF_RIFF"; - case CF_WAVE: return "CF_WAVE"; - case CF_UNICODETEXT: return "CF_UNICODETEXT"; - case CF_ENHMETAFILE: return "CF_ENHMETAFILE"; - case CF_HDROP: return "CF_HDROP"; - case CF_LOCALE: return "CF_LOCALE"; + case CF_TEXT: return wxT("CF_TEXT"); + case CF_BITMAP: return wxT("CF_BITMAP"); + case CF_METAFILEPICT: return wxT("CF_METAFILEPICT"); + case CF_SYLK: return wxT("CF_SYLK"); + case CF_DIF: return wxT("CF_DIF"); + case CF_TIFF: return wxT("CF_TIFF"); + case CF_OEMTEXT: return wxT("CF_OEMTEXT"); + case CF_DIB: return wxT("CF_DIB"); + case CF_PALETTE: return wxT("CF_PALETTE"); + case CF_PENDATA: return wxT("CF_PENDATA"); + case CF_RIFF: return wxT("CF_RIFF"); + case CF_WAVE: return wxT("CF_WAVE"); + case CF_UNICODETEXT: return wxT("CF_UNICODETEXT"); + case CF_ENHMETAFILE: return wxT("CF_ENHMETAFILE"); + case CF_HDROP: return wxT("CF_HDROP"); + case CF_LOCALE: return wxT("CF_LOCALE"); default: if ( !::GetClipboardFormatName(format, s_szBuf, WXSIZEOF(s_szBuf)) ) { // it must be a new predefined format we don't know the name of - sprintf(s_szBuf, "unknown CF (0x%04x)", format.GetFormatId()); + wxSprintf(s_szBuf, wxT("unknown CF (0x%04x)"), format.GetFormatId()); } return s_szBuf; @@ -792,7 +792,7 @@ bool wxBitmapDataObject2::SetData(size_t WXUNUSED(len), const void *pBuf) BITMAP bmp; if ( !GetObject(hbmp, sizeof(BITMAP), &bmp) ) { - wxLogLastError("GetObject(HBITMAP)"); + wxLogLastError(wxT("GetObject(HBITMAP)")); } wxBitmap bitmap(bmp.bmWidth, bmp.bmHeight, bmp.bmPlanes); @@ -827,7 +827,7 @@ size_t wxBitmapDataObject::GetDataSize(const wxDataFormat& format) const if ( !GetDIBits(hdc, (HBITMAP)m_bitmap.GetHBITMAP(), 0, 0, NULL, &bi, DIB_RGB_COLORS) ) { - wxLogLastError("GetDIBits(NULL)"); + wxLogLastError(wxT("GetDIBits(NULL)")); return 0; } @@ -860,7 +860,7 @@ bool wxBitmapDataObject::GetDataHere(const wxDataFormat& format, BITMAPINFO *pbi = (BITMAPINFO *)pBuf; if ( !GetDIBits(hdc, hbmp, 0, 0, NULL, pbi, DIB_RGB_COLORS) ) { - wxLogLastError("GetDIBits(NULL)"); + wxLogLastError(wxT("GetDIBits(NULL)")); return 0; } @@ -869,7 +869,7 @@ bool wxBitmapDataObject::GetDataHere(const wxDataFormat& format, if ( !GetDIBits(hdc, hbmp, 0, pbi->bmiHeader.biHeight, pbi + 1, pbi, DIB_RGB_COLORS) ) { - wxLogLastError("GetDIBits"); + wxLogLastError(wxT("GetDIBits")); return FALSE; } @@ -899,7 +899,7 @@ bool wxBitmapDataObject::SetData(const wxDataFormat& format, pbmi + 1, pbmi, DIB_RGB_COLORS); if ( !hbmp ) { - wxLogLastError("CreateDIBitmap"); + wxLogLastError(wxT("CreateDIBitmap")); } m_bitmap.SetWidth(pbmih->biWidth); @@ -913,7 +913,7 @@ bool wxBitmapDataObject::SetData(const wxDataFormat& format, BITMAP bmp; if ( !GetObject(hbmp, sizeof(BITMAP), &bmp) ) { - wxLogLastError("GetObject(HBITMAP)"); + wxLogLastError(wxT("GetObject(HBITMAP)")); } m_bitmap.SetWidth(bmp.bmWidth); @@ -963,8 +963,8 @@ bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *pData) m_filenames.Add(str); if ( len2 != len - 1 ) { - wxLogDebug(wxT("In wxFileDropTarget::OnDrop DragQueryFile returned" - " %d characters, %d expected."), len2, len - 1); + wxLogDebug(wxT("In wxFileDropTarget::OnDrop DragQueryFile returned\ + %d characters, %d expected."), len2, len - 1); } } @@ -1087,7 +1087,7 @@ size_t wxConvertBitmapToDIB(LPBITMAPINFO pbi, const wxBitmap& bitmap) HBITMAP hbmp = (HBITMAP)bitmap.GetHBITMAP(); if ( !GetObject(hbmp, sizeof(bm), &bm) ) { - wxLogLastError("GetObject(bitmap)"); + wxLogLastError(wxT("GetObject(bitmap)")); return 0; } @@ -1125,7 +1125,7 @@ size_t wxConvertBitmapToDIB(LPBITMAPINFO pbi, const wxBitmap& bitmap) ScreenHDC hdc; if ( !GetDIBits(hdc, hbmp, 0, bi.biHeight, NULL, pbi, DIB_RGB_COLORS) ) { - wxLogLastError("GetDIBits(NULL)"); + wxLogLastError(wxT("GetDIBits(NULL)")); return 0; } @@ -1140,7 +1140,7 @@ size_t wxConvertBitmapToDIB(LPBITMAPINFO pbi, const wxBitmap& bitmap) void *image = (char *)pbi + dwLen; if ( !GetDIBits(hdc, hbmp, 0, bi.biHeight, image, pbi, DIB_RGB_COLORS) ) { - wxLogLastError("GetDIBits"); + wxLogLastError(wxT("GetDIBits")); return 0; } @@ -1163,7 +1163,7 @@ wxBitmap wxConvertDIBToBitmap(const LPBITMAPINFO pbmi) image, pbmi, DIB_RGB_COLORS); if ( !hbmp ) { - wxLogLastError("CreateDIBitmap"); + wxLogLastError(wxT("CreateDIBitmap")); } wxBitmap bitmap(pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount); diff --git a/src/msw/ole/droptgt.cpp b/src/msw/ole/droptgt.cpp index c133b3d9b4..870929a2b4 100644 --- a/src/msw/ole/droptgt.cpp +++ b/src/msw/ole/droptgt.cpp @@ -161,7 +161,7 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource, // we need client coordinates to pass to wxWin functions if ( !ScreenToClient(m_hwnd, (POINT *)&pt) ) { - wxLogLastError("ScreenToClient"); + wxLogLastError(wxT("ScreenToClient")); } // give some visual feedback @@ -201,7 +201,7 @@ STDMETHODIMP wxIDropTarget::DragOver(DWORD grfKeyState, // we need client coordinates to pass to wxWin functions if ( !ScreenToClient(m_hwnd, (POINT *)&pt) ) { - wxLogLastError("ScreenToClient"); + wxLogLastError(wxT("ScreenToClient")); } *pdwEffect = ConvertDragResultToEffect( @@ -254,7 +254,7 @@ STDMETHODIMP wxIDropTarget::Drop(IDataObject *pIDataSource, // we need client coordinates to pass to wxWin functions if ( !ScreenToClient(m_hwnd, (POINT *)&pt) ) { - wxLogLastError("ScreenToClient"); + wxLogLastError(wxT("ScreenToClient")); } // first ask the drop target if it wants data @@ -381,11 +381,11 @@ bool wxDropTarget::GetData() rc = TRUE; } else { - wxLogLastError("IDataObject::SetData()"); + wxLogLastError(wxT("IDataObject::SetData()")); } } else { - wxLogLastError("IDataObject::GetData()"); + wxLogLastError(wxT("IDataObject::GetData()")); } return rc; diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp index 38519d4f9b..55e74c6c45 100644 --- a/src/msw/ole/oleutils.cpp +++ b/src/msw/ole/oleutils.cpp @@ -63,16 +63,16 @@ bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount) // ---------------------------------------------------------------------------- #if defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ > 1000) -const char *GetIidName(REFIID riid) +static wxString GetIidName(REFIID riid) { // an association between symbolic name and numeric value of an IID struct KNOWN_IID { const IID *pIid; - const char *szName; + const wxChar *szName; }; // construct the table containing all known interfaces - #define ADD_KNOWN_IID(name) { &IID_I##name, #name } + #define ADD_KNOWN_IID(name) { &IID_I##name, _T(#name) } static const KNOWN_IID aKnownIids[] = { ADD_KNOWN_IID(AdviseSink), @@ -166,24 +166,24 @@ const char *GetIidName(REFIID riid) } // unknown IID, just transform to string - static Uuid s_uuid; - s_uuid.Set(riid); - return s_uuid; + Uuid uuid(riid); + return wxString((const wxChar *)uuid); } -void wxLogQueryInterface(const char *szInterface, REFIID riid) +void wxLogQueryInterface(const wxChar *szInterface, REFIID riid) { - wxLogTrace("%s::QueryInterface (iid = %s)", szInterface, GetIidName(riid)); + wxLogTrace(wxT("%s::QueryInterface (iid = %s)"), + szInterface, GetIidName(riid).c_str()); } -void wxLogAddRef(const char *szInterface, ULONG cRef) +void wxLogAddRef(const wxChar *szInterface, ULONG cRef) { - wxLogTrace("After %s::AddRef: m_cRef = %d", szInterface, cRef + 1); + wxLogTrace(wxT("After %s::AddRef: m_cRef = %d"), szInterface, cRef + 1); } -void wxLogRelease(const char *szInterface, ULONG cRef) +void wxLogRelease(const wxChar *szInterface, ULONG cRef) { - wxLogTrace("After %s::Release: m_cRef = %d", szInterface, cRef - 1); + wxLogTrace(wxT("After %s::Release: m_cRef = %d"), szInterface, cRef - 1); } #elif defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ <= 1000) diff --git a/src/msw/ole/uuid.cpp b/src/msw/ole/uuid.cpp index cc912a6d1d..9436536733 100644 --- a/src/msw/ole/uuid.cpp +++ b/src/msw/ole/uuid.cpp @@ -165,8 +165,7 @@ void Uuid::UuidToCForm() if ( m_pszCForm == NULL ) m_pszCForm = new wxChar[UUID_CSTRLEN]; - wsprintf(m_pszCForm, wxT("0x%8.8X,0x%4.4X,0x%4.4X,0x%2.2X,0x2.2%X," - "0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X"), + wsprintf(m_pszCForm, wxT("0x%8.8X,0x%4.4X,0x%4.4X,0x%2.2X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X"), m_uuid.Data1, m_uuid.Data2, m_uuid.Data3, m_uuid.Data4[1], m_uuid.Data4[2], m_uuid.Data4[3], m_uuid.Data4[4], m_uuid.Data4[5], m_uuid.Data4[6], m_uuid.Data4[7], m_uuid.Data4[8]); diff --git a/src/msw/printdlg.cpp b/src/msw/printdlg.cpp index 17f7a55d2b..712b0d374a 100644 --- a/src/msw/printdlg.cpp +++ b/src/msw/printdlg.cpp @@ -28,6 +28,12 @@ #pragma hdrstop #endif +#if wxUSE_PRINTING_ARCHITECTURE + +#ifndef WX_PRECOMP + #include "wx/app.h" +#endif + #include "wx/printdlg.h" #include "wx/dcprint.h" @@ -106,7 +112,18 @@ int wxPrintDialog::ShowModal() { m_printDialogData.ConvertToNative(); - bool ret = (PrintDlg( (PRINTDLG *)m_printDialogData.GetNativeData() ) != 0); + PRINTDLG* p = (PRINTDLG *)m_printDialogData.GetNativeData() ; + if (m_dialogParent) + p->hwndOwner = (HWND) m_dialogParent->GetHWND(); + else if (wxTheApp->GetTopWindow()) + p->hwndOwner = (HWND) wxTheApp->GetTopWindow()->GetHWND(); + else + p->hwndOwner = 0; + + bool ret = (PrintDlg( p ) != 0); + + p->hwndOwner = 0; + if ( ret != FALSE && ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC) { wxPrinterDC *pdc = new wxPrinterDC((WXHDC) ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC); @@ -166,7 +183,16 @@ int wxPageSetupDialog::ShowModal() { #ifdef __WIN95__ m_pageSetupData.ConvertToNative(); - if (PageSetupDlg( (PAGESETUPDLG *)m_pageSetupData.GetNativeData() )) + PAGESETUPDLG *p = (PAGESETUPDLG *)m_pageSetupData.GetNativeData(); + if (m_dialogParent) + p->hwndOwner = (HWND) m_dialogParent->GetHWND(); + else if (wxTheApp->GetTopWindow()) + p->hwndOwner = (HWND) wxTheApp->GetTopWindow()->GetHWND(); + else + p->hwndOwner = 0; + BOOL retVal = PageSetupDlg( p ) ; + p->hwndOwner = 0; + if (retVal) { m_pageSetupData.ConvertFromNative(); return wxID_OK; @@ -182,3 +208,5 @@ int wxPageSetupDialog::ShowModal() #endif } +#endif + // wxUSE_PRINTING_ARCHITECTURE diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp index f46993f88a..49cf5218ff 100644 --- a/src/msw/printwin.cpp +++ b/src/msw/printwin.cpp @@ -30,6 +30,8 @@ #include "wx/defs.h" +#if wxUSE_PRINTING_ARCHITECTURE + #ifndef WX_PRECOMP #include "wx/window.h" #include "wx/msw/private.h" @@ -98,7 +100,10 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt sm_abortWindow = NULL; if (!printout) + { + sm_lastError = wxPRINTER_ERROR; return FALSE; + } printout->SetIsPreview(FALSE); @@ -113,7 +118,10 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage); if (maxPage == 0) + { + sm_lastError = wxPRINTER_ERROR; return FALSE; + } m_printDialogData.SetMinPage(minPage); m_printDialogData.SetMaxPage(maxPage); @@ -173,6 +181,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt if (logPPIPrinterX == 0 || logPPIPrinterY == 0) { delete dc; + sm_lastError = wxPRINTER_ERROR; return FALSE; } @@ -220,6 +229,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt { wxEndBusyCursor(); wxLogDebug(wxT("Could not create an abort dialog.")); + sm_lastError = wxPRINTER_ERROR; delete dc; } @@ -229,6 +239,8 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt printout->OnBeginPrinting(); + sm_lastError = wxPRINTER_NO_ERROR; + int copyCount; for ( copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); @@ -238,10 +250,14 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt { wxEndBusyCursor(); wxLogError(_("Could not start printing.")); + sm_lastError = wxPRINTER_ERROR; break; } if (sm_abortIt) + { + sm_lastError = wxPRINTER_CANCELLED; break; + } int pn; for ( pn = m_printDialogData.GetFromPage(); @@ -250,6 +266,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt { if ( sm_abortIt ) { + sm_lastError = wxPRINTER_CANCELLED; break; } @@ -258,7 +275,10 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt dc->EndPage(); if ( !cont ) + { + sm_lastError = wxPRINTER_CANCELLED; break; + } } printout->OnEndDocument(); @@ -277,7 +297,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt delete dc; - return TRUE; + return (sm_lastError == wxPRINTER_NO_ERROR); } wxDC* wxWindowsPrinter::PrintDialog(wxWindow *parent) @@ -291,7 +311,13 @@ wxDC* wxWindowsPrinter::PrintDialog(wxWindow *parent) { dc = dialog.GetPrintDC(); m_printDialogData = dialog.GetPrintDialogData(); + if (dc == NULL) + sm_lastError = wxPRINTER_ERROR; + else + sm_lastError = wxPRINTER_NO_ERROR; } + else + sm_lastError = wxPRINTER_CANCELLED; return dc; } @@ -419,3 +445,5 @@ LONG APIENTRY _EXPORT wxAbortProc(HDC WXUNUSED(hPr), int WXUNUSED(Code)) return (!wxPrinterBase::sm_abortIt); } +#endif + // wxUSE_PRINTING_ARCHITECTURE diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index e54fa2c71c..08a5e32134 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -32,6 +32,7 @@ #include "wx/bitmap.h" #include "wx/brush.h" #include "wx/radiobox.h" + #include "wx/settings.h" #include "wx/log.h" #endif @@ -125,6 +126,9 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id) { if ( cmd == BN_CLICKED ) { + if (id == GetId()) + return TRUE; + int selectedButton = -1; for ( int i = 0; i < m_noItems; i++ ) @@ -251,7 +255,7 @@ bool wxRadioBox::Create(wxWindow *parent, if ( !hwndBtn ) { - wxLogLastError("CreateWindow(radio btn)"); + wxLogLastError(wxT("CreateWindow(radio btn)")); return FALSE; } @@ -716,11 +720,12 @@ bool wxRadioBox::SetFont(const wxFont& font) WXHFONT hfont = wxFont(font).GetResourceHandle(); for ( int n = 0; n < m_noItems; n++ ) { - ::SendMessage((HWND)m_radioButtons[n], WM_SETFONT, (WPARAM)hfont, 0L); - } + HWND hwndBtn = (HWND)m_radioButtons[n]; + ::SendMessage(hwndBtn, WM_SETFONT, (WPARAM)hfont, 0L); - // this is needed because otherwise the buttons are not redrawn correctly - Refresh(); + // otherwise the buttons are not redrawn correctly + ::InvalidateRect(hwndBtn, NULL, FALSE /* don't erase bg */); + } return TRUE; } @@ -769,6 +774,39 @@ long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) return wxControl::MSWWindowProc(nMsg, wParam, lParam); } +WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ +#if wxUSE_CTL3D + if ( m_useCtl3D ) + { + HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); + return (WXHBRUSH) hbrush; + } +#endif // wxUSE_CTL3D + + HDC hdc = (HDC)pDC; + if (GetParent()->GetTransparentBackground()) + SetBkMode(hdc, TRANSPARENT); + else + SetBkMode(hdc, OPAQUE); + + wxColour colBack = GetBackgroundColour(); + + if (!IsEnabled()) + colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + + ::SetBkColor(hdc, wxColourToRGB(colBack)); + ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); + + wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); + + return (WXHBRUSH)brush->GetResourceHandle(); +} + + // --------------------------------------------------------------------------- // window proc for radio buttons // --------------------------------------------------------------------------- diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index 0f7b1dc92e..6a10d9168d 100644 --- a/src/msw/radiobut.cpp +++ b/src/msw/radiobut.cpp @@ -24,6 +24,7 @@ #include <stdio.h> #include "wx/setup.h" #include "wx/radiobut.h" +#include "wx/settings.h" #include "wx/brush.h" #endif @@ -78,7 +79,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, groupStyle = WS_GROUP; // long msStyle = groupStyle | RADIO_FLAGS; - long msStyle = groupStyle | BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE ; + long msStyle = groupStyle | BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE /* | WS_CLIPSIBLINGS */; bool want3D; WXDWORD exStyle = Determine3DEffects(0, &want3D) ; @@ -163,6 +164,37 @@ void wxRadioButton::Command (wxCommandEvent & event) ProcessCommand (event); } +WXHBRUSH wxRadioButton::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ +#if wxUSE_CTL3D + if ( m_useCtl3D ) + { + HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); + return (WXHBRUSH) hbrush; + } +#endif // wxUSE_CTL3D + + HDC hdc = (HDC)pDC; + if (GetParent()->GetTransparentBackground()) + SetBkMode(hdc, TRANSPARENT); + else + SetBkMode(hdc, OPAQUE); + + wxColour colBack = GetBackgroundColour(); + + if (!IsEnabled()) + colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + + ::SetBkColor(hdc, wxColourToRGB(colBack)); + ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); + + wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); + + return (WXHBRUSH)brush->GetResourceHandle(); +} // Not implemented #if 0 diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index e62511ca68..404fb0d2d2 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -27,6 +27,9 @@ #include "wx/event.h" #include "wx/app.h" #include "wx/log.h" + +#if wxUSE_CONFIG + #include "wx/config.h" #ifndef __WIN16__ @@ -577,3 +580,5 @@ bool wxRegConfig::DeleteAll() #endif // __WIN16__ +#endif + // wxUSE_CONFIG diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index 50da59b181..a761867e7d 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -573,7 +573,7 @@ bool wxRegKey::Copy(wxRegKey& keyDst) wxRegKey key(*this, strKey); wxString keyName; keyName << GetFullName(&keyDst) << REG_SEPARATOR << strKey; - ok = key.Copy((const char*) keyName); + ok = key.Copy((const wxChar*) keyName); if ( ok ) bCont = GetNextKey(strKey, lIndex); @@ -596,8 +596,7 @@ bool wxRegKey::Copy(wxRegKey& keyDst) } if ( !ok ) { - wxLogError(_("Failed to copy the contents of registry key '%s' to " - "'%s'."), GetFullName(this), GetFullName(&keyDst)); + wxLogError(_("Failed to copy the contents of registry key '%s' to '%s'."), GetFullName(this), GetFullName(&keyDst)); } return ok; @@ -621,9 +620,7 @@ bool wxRegKey::DeleteSelf() // key except HKCR (HKCR has some "deleteable" subkeys) if ( m_strKey.IsEmpty() || (m_hRootKey != HKCR && m_strKey.Find(REG_SEPARATOR) == wxNOT_FOUND) ) { - wxLogError(_("Registry key '%s' is needed for normal system operation,\n" - "deleting it will leave your system in unusable state:\n" - "operation aborted."), GetFullName(this)); + wxLogError(_("Registry key '%s' is needed for normal system operation,\ndeleting it will leave your system in unusable state:\noperation aborted."), GetFullName(this)); return FALSE; } @@ -709,12 +706,14 @@ bool wxRegKey::HasValue(const wxChar *szValue) const wxLogNull nolog; #ifdef __WIN32__ - if ( CONST_CAST Open() ) { - return RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, - NULL, NULL, NULL) == ERROR_SUCCESS; - } - else - return FALSE; + if ( !CONST_CAST Open() ) + return FALSE; + + LONG dwRet = ::RegQueryValueEx((HKEY) m_hKey, + WXSTRINGCAST szValue, + RESERVED, + NULL, NULL, NULL); + return dwRet == ERROR_SUCCESS; #else // WIN16 // only unnamed value exists return IsEmpty(szValue); @@ -751,10 +750,10 @@ bool wxRegKey::HasSubKey(const wxChar *szKey) const // this function should be silent, so suppress possible messages from Open() wxLogNull nolog; - if ( CONST_CAST Open() ) - return KeyExists(m_hKey, szKey); - else + if ( !CONST_CAST Open() ) return FALSE; + + return KeyExists(m_hKey, szKey); } wxRegKey::ValueType wxRegKey::GetValueType(const wxChar *szValue) const @@ -879,7 +878,7 @@ bool wxRegKey::SetValue(const wxChar *szValue, const wxString& strValue) #if defined( __WIN32__) && !defined(__TWIN32__) m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_SZ, (RegString)strValue.c_str(), - strValue.Len() + 1); + (strValue.Len() + 1)*sizeof(wxChar)); if ( m_dwLastError == ERROR_SUCCESS ) return TRUE; #else //WIN16 @@ -1018,8 +1017,13 @@ bool wxRegKey::IsNumericValue(const wxChar *szValue) const // ============================================================================ // implementation of global private functions // ============================================================================ + bool KeyExists(WXHKEY hRootKey, const wxChar *szKey) { + // don't close this key itself for the case of empty szKey! + if ( wxIsEmpty(szKey) ) + return TRUE; + HKEY hkeyDummy; if ( RegOpenKey( (HKEY) hRootKey, szKey, &hkeyDummy) == ERROR_SUCCESS ) { RegCloseKey(hkeyDummy); diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index e5667dd391..77cf291c9f 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -260,6 +260,7 @@ bool wxSlider95::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, GetEventHandler()->ProcessEvent(event); wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() ); + cevent.SetInt( newPos ); cevent.SetEventObject( this ); return GetEventHandler()->ProcessEvent( cevent ); diff --git a/src/msw/slidrmsw.cpp b/src/msw/slidrmsw.cpp index 7aa2ccfe03..4050e2c1a4 100644 --- a/src/msw/slidrmsw.cpp +++ b/src/msw/slidrmsw.cpp @@ -97,9 +97,6 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); - // Now create slider - m_windowId = (int)NewControlId(); - msStyle = 0; if (m_windowStyle & wxSL_VERTICAL) msStyle = SBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ; @@ -231,6 +228,7 @@ bool wxSliderMSW::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, GetEventHandler()->ProcessEvent(event); wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() ); + cevent.SetInt( newPos ); cevent.SetEventObject( this ); return GetEventHandler()->ProcessEvent( cevent ); diff --git a/src/msw/spinbutt.cpp b/src/msw/spinbutt.cpp index fe6e08b372..03428c16ee 100644 --- a/src/msw/spinbutt.cpp +++ b/src/msw/spinbutt.cpp @@ -106,7 +106,7 @@ bool wxSpinButton::Create(wxWindow *parent, y = 0; // translate the styles - DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP | + DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP | /* WS_CLIPSIBLINGS | */ UDS_NOTHOUSANDS | // never useful, sometimes harmful UDS_SETBUDDYINT; // it doesn't harm if we don't have buddy @@ -132,7 +132,7 @@ bool wxSpinButton::Create(wxWindow *parent, if ( !m_hWnd ) { - wxLogLastError("CreateUpDownControl"); + wxLogLastError(wxT("CreateUpDownControl")); return FALSE; } @@ -221,6 +221,9 @@ bool wxSpinButton::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam; #endif + if (lpnmud->hdr.hwndFrom != GetHwnd()) // make sure it is the right control + return FALSE; + wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP : wxEVT_SCROLL_LINEDOWN, m_windowId); diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index e8f8323ff3..9f2928f82a 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -69,6 +69,32 @@ static const int MARGIN_BETWEEN = 1; // implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// wnd proc for the buddy text ctrl +// ---------------------------------------------------------------------------- + +LRESULT APIENTRY _EXPORT wxBuddyTextWndProc(HWND hwnd, + UINT message, + WPARAM wParam, + LPARAM lParam) +{ + wxSpinCtrl *spin = (wxSpinCtrl *)::GetWindowLong(hwnd, GWL_USERDATA); + + // forward some messages (the key ones only so far) to the spin ctrl + switch ( message ) + { + case WM_CHAR: + case WM_DEADCHAR: + case WM_KEYUP: + case WM_KEYDOWN: + spin->MSWWindowProc(message, wParam, lParam); + break; + } + + return ::CallWindowProc(CASTWNDPROC spin->GetBuddyWndProc(), + hwnd, message, wParam, lParam); +} + // ---------------------------------------------------------------------------- // construction // ---------------------------------------------------------------------------- @@ -122,7 +148,7 @@ bool wxSpinCtrl::Create(wxWindow *parent, WS_EX_CLIENTEDGE, // sunken border _T("EDIT"), // window class NULL, // no window title - WS_CHILD | WS_BORDER, // style (will be shown later) + WS_CHILD | WS_BORDER /* | WS_CLIPSIBLINGS */, // style (will be shown later) pos.x, pos.y, // position 0, 0, // size (will be set later) GetHwndOf(parent), // parent @@ -133,11 +159,16 @@ bool wxSpinCtrl::Create(wxWindow *parent, if ( !m_hwndBuddy ) { - wxLogLastError("CreateWindow(buddy text window)"); + wxLogLastError(wxT("CreateWindow(buddy text window)")); return FALSE; } + // subclass the text ctrl to be able to intercept some events + m_oldBuddyWndProc = (WXFARPROC)::GetWindowLong((HWND)m_hwndBuddy, GWL_WNDPROC); + ::SetWindowLong((HWND)m_hwndBuddy, GWL_USERDATA, (LONG)this); + ::SetWindowLong((HWND)m_hwndBuddy, GWL_WNDPROC, (LONG)wxBuddyTextWndProc); + // should have the same font as the other controls SetFont(GetParent()->GetFont()); @@ -167,6 +198,13 @@ bool wxSpinCtrl::Create(wxWindow *parent, return TRUE; } +wxSpinCtrl::~wxSpinCtrl() +{ + // destroy the buddy window because this pointer which wxBuddyTextWndProc + // uses will not soon be valid any more + ::DestroyWindow((HWND)m_hwndBuddy); +} + // ---------------------------------------------------------------------------- // wxTextCtrl-like methods // ---------------------------------------------------------------------------- @@ -175,7 +213,7 @@ void wxSpinCtrl::SetValue(const wxString& text) { if ( !::SetWindowText((HWND)m_hwndBuddy, text.c_str()) ) { - wxLogLastError("SetWindowText(buddy)"); + wxLogLastError(wxT("SetWindowText(buddy)")); } } @@ -288,16 +326,41 @@ void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) if ( !::MoveWindow((HWND)m_hwndBuddy, x, y, widthText, height, TRUE) ) { - wxLogLastError("MoveWindow(buddy)"); + wxLogLastError(wxT("MoveWindow(buddy)")); } x += widthText + MARGIN_BETWEEN; if ( !::MoveWindow(GetHwnd(), x, y, widthBtn, height, TRUE) ) { - wxLogLastError("MoveWindow"); + wxLogLastError(wxT("MoveWindow")); } } +// get total size of the control +void wxSpinCtrl::DoGetSize(int *x, int *y) const +{ + RECT spinrect, textrect, ctrlrect; + GetWindowRect(GetHwnd(), &spinrect); + GetWindowRect((HWND)m_hwndBuddy, &textrect); + UnionRect(&ctrlrect,&textrect, &spinrect); + + if ( x ) + *x = ctrlrect.right - ctrlrect.left; + if ( y ) + *y = ctrlrect.bottom - ctrlrect.top; +} + +void wxSpinCtrl::DoGetPosition(int *x, int *y) const +{ + // hack: pretend that our HWND is the text control just for a moment + WXHWND hWnd = GetHWND(); + wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy; + + wxSpinButton::DoGetPosition(x, y); + + wxConstCast(this, wxSpinCtrl)->m_hWnd = hWnd; +} + #endif // __WIN95__ #endif diff --git a/src/msw/statbmp.cpp b/src/msw/statbmp.cpp index 7b939e5ec4..fd9dd5db30 100644 --- a/src/msw/statbmp.cpp +++ b/src/msw/statbmp.cpp @@ -120,7 +120,7 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id, classname, wxT(""), // NOT DISABLED!!! We want to move it in Dialog Editor. - winstyle | WS_CHILD | WS_VISIBLE, // | WS_DISABLED, + winstyle | WS_CHILD | WS_VISIBLE /* | WS_CLIPSIBLINGS */ , // | WS_DISABLED, 0, 0, 0, 0, (HWND)parent->GetHWND(), (HMENU)m_windowId, diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp index f0a8607c1d..4843ea05a6 100644 --- a/src/msw/statbr95.cpp +++ b/src/msw/statbr95.cpp @@ -71,6 +71,8 @@ LRESULT APIENTRY wxStatusBarProc(HWND hwnd, { switch (message) { case WM_COMMAND: + case WM_DRAWITEM: + case WM_MEASUREITEM: case WM_SIZE: case WM_MOVE: case WM_MOUSEMOVE: @@ -120,7 +122,7 @@ bool wxStatusBar95::Create(wxWindow *parent, m_windowId = id == -1 ? NewControlId() : id; - DWORD wstyle = WS_CHILD | WS_VISIBLE; + DWORD wstyle = WS_CHILD | WS_VISIBLE /* | WS_CLIPSIBLINGS */ ; // setting SBARS_SIZEGRIP is perfectly useless: it's always on by default // (at least in the version of comctl32.dll I'm using), and the only way to @@ -186,21 +188,21 @@ void wxStatusBar95::CopyFieldsWidth(const int widths[]) void wxStatusBar95::SetFieldsCount(int nFields, const int *widths) { - // this is Windows limitation - wxASSERT_MSG( (nFields > 0) && (nFields < 255), _T("too many fields") ); + // this is a Windows limitation + wxASSERT_MSG( (nFields > 0) && (nFields < 255), _T("too many fields") ); - m_nFields = nFields; + m_nFields = nFields; - CopyFieldsWidth(widths); - SetFieldsWidth(); + CopyFieldsWidth(widths); + SetFieldsWidth(); } void wxStatusBar95::SetStatusWidths(int n, const int widths[]) { - wxASSERT_MSG( n == m_nFields, _T("field number mismatch") ); + wxASSERT_MSG( n == m_nFields, _T("field number mismatch") ); - CopyFieldsWidth(widths); - SetFieldsWidth(); + CopyFieldsWidth(widths); + SetFieldsWidth(); } void wxStatusBar95::SetFieldsWidth() @@ -319,7 +321,7 @@ bool wxStatusBar95::GetFieldRect(int i, wxRect& rect) const RECT r; if ( !::SendMessage(GetHwnd(), SB_GETRECT, i, (LPARAM)&r) ) { - wxLogLastError("SendMessage(SB_GETRECT)"); + wxLogLastError(wxT("SendMessage(SB_GETRECT)")); } wxCopyRECTToRect(r, rect); diff --git a/src/msw/statline.cpp b/src/msw/statline.cpp index 75bc183dc8..605153f40d 100644 --- a/src/msw/statline.cpp +++ b/src/msw/statline.cpp @@ -34,6 +34,14 @@ #include "wx/msw/private.h" #include "wx/log.h" +#ifndef SS_SUNKEN + #define SS_SUNKEN 0x00001000L +#endif + +#ifndef SS_NOTIFY + #define SS_NOTIFY 0x00000100L +#endif + // ============================================================================ // implementation // ============================================================================ @@ -58,16 +66,12 @@ bool wxStaticLine::Create( wxWindow *parent, wxSize sizeReal = AdjustSize(size); -#ifndef WIN32 -#define SS_SUNKEN 0 -#endif - m_hWnd = (WXHWND)::CreateWindow ( wxT("STATIC"), wxT(""), - WS_VISIBLE | WS_CHILD | - SS_GRAYRECT | SS_SUNKEN, // | SS_ETCHEDFRAME, + WS_VISIBLE | WS_CHILD /* | WS_CLIPSIBLINGS */ | + SS_GRAYRECT | SS_SUNKEN | SS_NOTIFY, pos.x, pos.y, sizeReal.x, sizeReal.y, GetWinHwnd(parent), (HMENU)m_windowId, @@ -77,9 +81,8 @@ bool wxStaticLine::Create( wxWindow *parent, if ( !m_hWnd ) { -#ifdef __WXDEBUG__ wxLogDebug(wxT("Failed to create static control")); -#endif + return FALSE; } @@ -87,5 +90,6 @@ bool wxStaticLine::Create( wxWindow *parent, return TRUE; } -#endif + +#endif // wxUSE_STATLINE diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index b7e0f01365..82b2a21745 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -57,7 +57,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, m_windowStyle = style; - long msStyle = WS_CHILD|WS_VISIBLE; + long msStyle = WS_CHILD | WS_VISIBLE /* | WS_CLIPSIBLINGS */ ; if (m_windowStyle & wxALIGN_CENTRE) msStyle |= SS_CENTER; else if (m_windowStyle & wxALIGN_RIGHT) diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index fc4f1cb9ca..13235cea9d 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -182,8 +182,14 @@ bool wxTaskBarIcon::PopupMenu(wxMenu *menu) //, int x, int y); menu->UpdateUI(); + // Work around a WIN32 bug + ::SetForegroundWindow ((HWND) win->GetHWND ()); + rval = win->PopupMenu(menu, 0, 0); + // Work around a WIN32 bug + ::PostMessage ((HWND) win->GetHWND(),WM_NULL,0,0L); + win->PopEventHandler(FALSE); win->Destroy(); delete win; diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 2cc55c2797..2a1a5e7ce1 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -35,6 +35,7 @@ #include "wx/dynarray.h" #include "wx/settings.h" #include "wx/bitmap.h" + #include "wx/dcmemory.h" #endif #if wxUSE_TOOLBAR && defined(__WIN95__) && wxUSE_TOOLBAR_NATIVE @@ -60,6 +61,18 @@ #include "wx/msw/dib.h" #include "wx/app.h" // for GetComCtl32Version +// ---------------------------------------------------------------------------- +// conditional compilation +// ---------------------------------------------------------------------------- + +// wxWindows previously always considered that toolbar buttons have light grey +// (0xc0c0c0) background and so ignored any bitmap masks - however, this +// doesn't work with XPMs which then appear to have black background. To make +// this work, we must respect the bitmap masks - which we do now. This should +// be ok in any case, but to restore 100% compatible with the old version +// behaviour, you can set this to 0. +#define USE_BITMAP_MASKS 1 + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -95,6 +108,7 @@ // private function prototypes // ---------------------------------------------------------------------------- +// adjust toolbar bitmap colours static void wxMapBitmap(HBITMAP hBitmap, int width, int height); // ---------------------------------------------------------------------------- @@ -245,7 +259,18 @@ bool wxToolBar::Create(wxWindow *parent, wxToolBar::~wxToolBar() { - if (m_hBitmap) + // we must refresh the frame size when the toolbar is deleted but the frame + // is not - otherwise toolbar leaves a hole in the place it used to occupy + // + // NB: a frame is being deleted only if it is not any longer in + // wxTopLevelWindows list + wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); + if ( frame && wxTopLevelWindows.Find(frame) ) + { + frame->SendSizeEvent(); + } + + if ( m_hBitmap ) { ::DeleteObject((HBITMAP) m_hBitmap); } @@ -267,8 +292,32 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) { - // normally, we only delete one button, but we use several separators to - // cover the space used by one control sometimes (with old comctl32.dll) + // the main difficulty we have here is with the controls in the toolbars: + // as we (sometimes) use several separators to cover up the space used by + // them, the indices are not the same for us and the toolbar + + // first determine the position of the first button to delete: it may be + // different from pos if we use several separators to cover the space used + // by a control + wxToolBarToolsList::Node *node; + for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) + { + wxToolBarToolBase *tool2 = node->GetData(); + if ( tool2 == tool ) + { + // let node point to the next node in the list + node = node->GetNext(); + + break; + } + + if ( tool2->IsControl() ) + { + pos += ((wxToolBarTool *)tool2)->GetSeparatorsCount(); + } + } + + // now determine the number of buttons to delete and the area taken by them size_t nButtonsToDelete = 1; // get the size of the button we're going to delete @@ -287,11 +336,13 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) width *= nButtonsToDelete; } + // do delete all buttons + m_nButtons -= nButtonsToDelete; while ( nButtonsToDelete-- > 0 ) { if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, pos, 0) ) { - wxLogLastError("TB_DELETEBUTTON"); + wxLogLastError(wxT("TB_DELETEBUTTON")); return FALSE; } @@ -299,11 +350,9 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) tool->Detach(); - m_nButtons -= nButtonsToDelete; - - // reposition all the controls after this button - wxToolBarToolsList::Node *node = m_tools.Item(pos); - for ( node = node->GetNext(); node; node = node->GetNext() ) + // and finally reposition all the controls after this button (the toolbar + // takes care of all normal items) + for ( /* node -> first after deleted */ ; node; node = node->GetNext() ) { wxToolBarToolBase *tool2 = node->GetData(); if ( tool2->IsControl() ) @@ -339,7 +388,17 @@ bool wxToolBar::Realize() int totalBitmapWidth = (int)(m_defaultWidth * nTools); int totalBitmapHeight = (int)m_defaultHeight; - // Create a bitmap for all the tool bitmaps + // Create a bitmap and copy all the tool bitmaps to it +#if USE_BITMAP_MASKS + wxMemoryDC dcAllButtons; + wxBitmap bitmap(totalBitmapWidth, totalBitmapHeight); + dcAllButtons.SelectObject(bitmap); + dcAllButtons.SetBackground(*wxLIGHT_GREY_BRUSH); + dcAllButtons.Clear(); + + m_hBitmap = bitmap.GetHBITMAP(); + HBITMAP hBitmap = (HBITMAP)m_hBitmap; +#else // !USE_BITMAP_MASKS HBITMAP hBitmap = ::CreateCompatibleBitmap(ScreenHDC(), totalBitmapWidth, totalBitmapHeight); @@ -352,11 +411,11 @@ bool wxToolBar::Realize() m_hBitmap = (WXHBITMAP)hBitmap; - // Now blit all the tools onto this bitmap HDC memoryDC = ::CreateCompatibleDC(NULL); HBITMAP oldBitmap = (HBITMAP) ::SelectObject(memoryDC, hBitmap); HDC memoryDC2 = ::CreateCompatibleDC(NULL); +#endif // USE_BITMAP_MASKS/!USE_BITMAP_MASKS // the button position wxCoord x = 0; @@ -370,17 +429,23 @@ bool wxToolBar::Realize() wxToolBarToolBase *tool = node->GetData(); if ( tool->IsButton() ) { - HBITMAP hbmp = GetHbitmapOf(tool->GetBitmap1()); - if ( hbmp ) + const wxBitmap& bmp = tool->GetBitmap1(); + if ( bmp.Ok() ) { +#if USE_BITMAP_MASKS + // notice the last parameter: do use mask + dcAllButtons.DrawBitmap(tool->GetBitmap1(), x, 0, TRUE); +#else // !USE_BITMAP_MASKS + HBITMAP hbmp = GetHbitmapOf(bmp); HBITMAP oldBitmap2 = (HBITMAP)::SelectObject(memoryDC2, hbmp); if ( !BitBlt(memoryDC, x, 0, m_defaultWidth, m_defaultHeight, memoryDC2, 0, 0, SRCCOPY) ) { - wxLogLastError("BitBlt"); + wxLogLastError(wxT("BitBlt")); } ::SelectObject(memoryDC2, oldBitmap2); +#endif // USE_BITMAP_MASKS/!USE_BITMAP_MASKS } else { @@ -397,9 +462,16 @@ bool wxToolBar::Realize() node = node->GetNext(); } +#if USE_BITMAP_MASKS + dcAllButtons.SelectObject(wxNullBitmap); + + // don't delete this HBITMAP! + bitmap.SetHBITMAP(0); +#else // !USE_BITMAP_MASKS ::SelectObject(memoryDC, oldBitmap); ::DeleteDC(memoryDC); ::DeleteDC(memoryDC2); +#endif // USE_BITMAP_MASKS/!USE_BITMAP_MASKS // Map to system colours wxMapBitmap(hBitmap, totalBitmapWidth, totalBitmapHeight); @@ -446,7 +518,7 @@ bool wxToolBar::Realize() { if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, 0, 0) ) { - wxLogLastError("TB_DELETEBUTTON"); + wxLogLastError(wxT("TB_DELETEBUTTON")); } } @@ -518,7 +590,7 @@ bool wxToolBar::Realize() if ( !::SendMessage(GetHwnd(), TB_ADDBUTTONS, (WPARAM)i, (LPARAM)buttons) ) { - wxLogLastError("TB_ADDBUTTONS"); + wxLogLastError(wxT("TB_ADDBUTTONS")); } delete [] buttons; @@ -547,7 +619,7 @@ bool wxToolBar::Realize() if ( !SendMessage(GetHwnd(), TB_GETITEMRECT, index, (LPARAM)(LPRECT)&r) ) { - wxLogLastError("TB_GETITEMRECT"); + wxLogLastError(wxT("TB_GETITEMRECT")); } // TB_SETBUTTONINFO message is only supported by comctl32.dll 4.71+ @@ -566,7 +638,7 @@ bool wxToolBar::Realize() tool->GetId(), (LPARAM)&tbbi) ) { // the id is probably invalid? - wxLogLastError("TB_SETBUTTONINFO"); + wxLogLastError(wxT("TB_SETBUTTONINFO")); } } else @@ -580,7 +652,7 @@ bool wxToolBar::Realize() TBBUTTON tbb; wxZeroMemory(tbb); tbb.idCommand = 0; - tbb.fsState = TBSTATE_ENABLED | TBSTATE_HIDDEN; + tbb.fsState = TBSTATE_ENABLED; tbb.fsStyle = TBSTYLE_SEP; size_t nSeparators = size.x / widthSep; @@ -589,7 +661,7 @@ bool wxToolBar::Realize() if ( !SendMessage(GetHwnd(), TB_INSERTBUTTON, index, (LPARAM)&tbb) ) { - wxLogLastError("TB_INSERTBUTTON"); + wxLogLastError(wxT("TB_INSERTBUTTON")); } index++; @@ -707,6 +779,9 @@ bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl), } else { +#if wxUSE_UNICODE + ttText->lpszText = (wxChar *)help.c_str(); +#else // VZ: I don't know why it happens, but the versions of // comctl32.dll starting from 4.70 sometimes send TTN_NEEDTEXTW // even to ANSI programs (normally, this message is supposed @@ -733,6 +808,7 @@ bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl), dst[lenUnicode] = 0; delete [] pwz; +#endif } } @@ -816,15 +892,7 @@ void wxToolBar::UpdateSize() wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); if ( frame ) { - // don't change the size, we just need to generate a WM_SIZE - RECT r; - if ( !GetWindowRect(GetHwndOf(frame), &r) ) - { - wxLogLastError(_T("GetWindowRect")); - } - - (void)::SendMessage(GetHwndOf(frame), WM_SIZE, SIZE_RESTORED, - MAKELPARAM(r.right - r.left, r.bottom - r.top)); + frame->SendSizeEvent(); } } diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index e48ba50b35..82f29026b7 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -38,6 +38,8 @@ #include "wx/app.h" #endif +#include "wx/module.h" + #if wxUSE_CLIPBOARD #include "wx/clipbrd.h" #endif @@ -119,6 +121,9 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste) EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo) EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo) +#ifdef __WIN16__ + EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) +#endif END_EVENT_TABLE() @@ -154,12 +159,11 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, // translate wxWin style flags to MSW ones, checking for consistency while // doing it - long msStyle = ES_LEFT | WS_VISIBLE | WS_CHILD | WS_TABSTOP; + long msStyle = ES_LEFT | WS_VISIBLE | WS_CHILD | WS_TABSTOP /* | WS_CLIPSIBLINGS */ ; if ( m_windowStyle & wxTE_MULTILINE ) { wxASSERT_MSG( !(m_windowStyle & wxTE_PROCESS_ENTER), - wxT("wxTE_PROCESS_ENTER style is ignored for multiline " - "text controls (they always process it)") ); + wxT("wxTE_PROCESS_ENTER style is ignored for multiline text controls (they always process it)") ); msStyle |= ES_MULTILINE | ES_WANTRETURN; if ((m_windowStyle & wxTE_NO_VSCROLL) == 0) @@ -212,9 +216,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, // done) if ( !wxRichEditModule::Load() ) { - wxLogError(_("Impossible to create a rich edit control, " - "using simple text control instead. Please " - "reinstall riched32.dll")); + wxLogError(_("Impossible to create a rich edit control, using simple text control instead. Please reinstall riched32.dll")); s_errorGiven = TRUE; } @@ -356,10 +358,10 @@ void wxTextCtrl::AdoptAttributesFromHWND() void wxTextCtrl::SetupColours() { wxColour bkgndColour; - if (IsEditable() || (m_windowStyle & wxTE_MULTILINE)) +// if (IsEditable() || (m_windowStyle & wxTE_MULTILINE)) bkgndColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW); - else - bkgndColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); +// else +// bkgndColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); SetBackgroundColour(bkgndColour); SetForegroundColour(GetParent()->GetForegroundColour()); @@ -423,6 +425,14 @@ void wxTextCtrl::SetValue(const wxString& value) SetWindowText(GetHwnd(), valueDos.c_str()); + // for compatibility with the GTK and because it is more logical, we + // move the cursor to the end of the text after SetValue() + + // GRG, Jun/2000: Changed this back after a lot of discussion + // in the lists. wxWindows 2.2 will have a set of flags to + // customize this behaviour. + //SetInsertionPointEnd(); + AdjustSpaceLimit(); } } @@ -523,16 +533,8 @@ bool wxTextCtrl::CanPaste() const void wxTextCtrl::SetEditable(bool editable) { - bool isEditable = IsEditable(); - HWND hWnd = GetHwnd(); SendMessage(hWnd, EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L); - - if (editable != isEditable) - { - SetupColours(); - Refresh(); - } } void wxTextCtrl::SetInsertionPoint(long pos) @@ -811,24 +813,20 @@ int wxTextCtrl::GetLineLength(long lineNo) const wxString wxTextCtrl::GetLineText(long lineNo) const { - // TODO this should probably be optimized by using GetWriteBuf() - size_t len = (size_t)GetLineLength(lineNo) + 1; - if ( len < sizeof(WORD) ) - { - // there must be at least enough place for the length WORD in the - // buffer - len += sizeof(WORD); - } - char *buf = (char *)malloc(len); - *(WORD *)buf = len; - int noChars = (int)SendMessage(GetHwnd(), EM_GETLINE, lineNo, (LPARAM)buf); - buf[noChars] = 0; + // there must be at least enough place for the length WORD in the + // buffer + len += sizeof(WORD); - wxString str(buf); + wxString str; + wxChar *buf = str.GetWriteBuf(len); + + *(WORD *)buf = len; + len = (size_t)::SendMessage(GetHwnd(), EM_GETLINE, lineNo, (LPARAM)buf); + buf[len] = 0; - free(buf); + str.UngetWriteBuf(len); return str; } @@ -892,6 +890,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) { wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId); InitCommandEvent(event); + event.SetString(GetValue()); if ( GetEventHandler()->ProcessEvent(event) ) return; } @@ -954,6 +953,7 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) case EN_ERRSPACE: case EN_HSCROLL: case EN_VSCROLL: + return FALSE; default: return FALSE; } @@ -962,6 +962,71 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return TRUE; } +WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ +#if wxUSE_CTL3D + if ( m_useCtl3D ) + { + HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); + return (WXHBRUSH) hbrush; + } +#endif // wxUSE_CTL3D + + HDC hdc = (HDC)pDC; + if (GetParent()->GetTransparentBackground()) + SetBkMode(hdc, TRANSPARENT); + else + SetBkMode(hdc, OPAQUE); + + wxColour colBack = GetBackgroundColour(); + + if (!IsEnabled() && (GetWindowStyle() & wxTE_MULTILINE) == 0) + colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE); + + ::SetBkColor(hdc, wxColourToRGB(colBack)); + ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); + + wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); + + return (WXHBRUSH)brush->GetResourceHandle(); +} + +// In WIN16, need to override normal erasing because +// Ctl3D doesn't use the wxWindows background colour. +#ifdef __WIN16__ +void wxTextCtrl::OnEraseBackground(wxEraseEvent& event) +{ + wxColour col(m_backgroundColour); + +#if wxUSE_CTL3D + if (m_useCtl3D) + col = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW); +#endif + + RECT rect; + ::GetClientRect(GetHwnd(), &rect); + + COLORREF ref = PALETTERGB(col.Red(), + col.Green(), + col.Blue()); + HBRUSH hBrush = ::CreateSolidBrush(ref); + if ( !hBrush ) + wxLogLastError(wxT("CreateSolidBrush")); + + HDC hdc = (HDC)event.GetDC()->GetHDC(); + + int mode = ::SetMapMode(hdc, MM_TEXT); + + ::FillRect(hdc, &rect, hBrush); + ::DeleteObject(hBrush); + ::SetMapMode(hdc, mode); + +} +#endif + void wxTextCtrl::AdjustSpaceLimit() { #ifndef __WIN16__ @@ -1070,6 +1135,59 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event) event.Enable( CanRedo() ); } +// ---------------------------------------------------------------------------- +// colour setting for the rich edit controls +// ---------------------------------------------------------------------------- + +#if wxUSE_RICHEDIT + +// Watcom C++ doesn't define this +#ifndef SCF_ALL +#define SCF_ALL 0x0004 +#endif + +bool wxTextCtrl::SetBackgroundColour(const wxColour& colour) +{ + if ( !wxTextCtrlBase::SetBackgroundColour(colour) ) + { + // colour didn't really change + return FALSE; + } + + if ( IsRich() ) + { + // rich edit doesn't use WM_CTLCOLOR, hence we need to send + // EM_SETBKGNDCOLOR additionally + ::SendMessage(GetHwnd(), EM_SETBKGNDCOLOR, 0, wxColourToRGB(colour)); + } + + return TRUE; +} + +bool wxTextCtrl::SetForegroundColour(const wxColour& colour) +{ + if ( !wxTextCtrlBase::SetForegroundColour(colour) ) + { + // colour didn't really change + return FALSE; + } + + if ( IsRich() ) + { + // change the colour of everything + CHARFORMAT cf; + wxZeroMemory(cf); + cf.cbSize = sizeof(cf); + cf.dwMask = CFM_COLOR; + cf.crTextColor = wxColourToRGB(colour); + ::SendMessage(GetHwnd(), EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf); + } + + return TRUE; +} + +#endif // wxUSE_RICHEDIT + // ---------------------------------------------------------------------------- // wxRichEditModule // ---------------------------------------------------------------------------- diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 27b948f785..e701abb39b 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -242,7 +242,7 @@ public: { if ( !::CloseHandle(event) ) { - wxLogLastError("CloseHandle(event)"); + wxLogLastError(wxT("CloseHandle(event)")); } } } @@ -281,7 +281,7 @@ void wxCondition::Signal() // will be woken up. if ( !::SetEvent(m_internal->event) ) { - wxLogLastError("SetEvent"); + wxLogLastError(wxT("SetEvent")); } } @@ -351,7 +351,7 @@ public: { if ( !::CloseHandle(m_hThread) ) { - wxLogLastError("CloseHandle(thread)"); + wxLogLastError(wxT("CloseHandle(thread)")); } m_hThread = 0; @@ -390,31 +390,38 @@ private: DWORD wxThreadInternal::WinThreadStart(wxThread *thread) { - // first of all, check whether we hadn't been cancelled already + DWORD rc; + bool wasCancelled; + + // first of all, check whether we hadn't been cancelled already and don't + // start the user code at all then if ( thread->m_internal->GetState() == STATE_EXITED ) { - return (DWORD)-1; + rc = (DWORD)-1; + wasCancelled = TRUE; } - - // store the thread object in the TLS - if ( !::TlsSetValue(gs_tlsThisThread, thread) ) + else // do run thread { - wxLogSysError(_("Can not start thread: error writing TLS.")); + // store the thread object in the TLS + if ( !::TlsSetValue(gs_tlsThisThread, thread) ) + { + wxLogSysError(_("Can not start thread: error writing TLS.")); - return (DWORD)-1; - } + return (DWORD)-1; + } - DWORD rc = (DWORD)thread->Entry(); + rc = (DWORD)thread->Entry(); - // enter m_critsect before changing the thread state - thread->m_critsect.Enter(); - bool wasCancelled = thread->m_internal->GetState() == STATE_CANCELED; - thread->m_internal->SetState(STATE_EXITED); - thread->m_critsect.Leave(); + // enter m_critsect before changing the thread state + thread->m_critsect.Enter(); + wasCancelled = thread->m_internal->GetState() == STATE_CANCELED; + thread->m_internal->SetState(STATE_EXITED); + thread->m_critsect.Leave(); + } thread->OnExit(); - // if the thread was cancelled (from Delete()), then it the handle is still + // if the thread was cancelled (from Delete()), then its handle is still // needed there if ( thread->IsDetached() && !wasCancelled ) { @@ -522,7 +529,13 @@ bool wxThreadInternal::Resume() return FALSE; } - m_state = STATE_RUNNING; + // don't change the state from STATE_EXITED because it's special and means + // we are going to terminate without running any user code - if we did it, + // the codei n Delete() wouldn't work + if ( m_state != STATE_EXITED ) + { + m_state = STATE_RUNNING; + } return TRUE; } @@ -645,18 +658,12 @@ bool wxThread::SetConcurrency(size_t level) if ( hModKernel ) { pfnSetProcessAffinityMask = (SETPROCESSAFFINITYMASK) - ::GetProcAddress(hModKernel, -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x520) - "SetProcessAffinityMask"); -#else - _T("SetProcessAffinityMask")); -#endif + ::GetProcAddress(hModKernel, "SetProcessAffinityMask"); } // we've discovered a MT version of Win9x! wxASSERT_MSG( pfnSetProcessAffinityMask, - _T("this system has several CPUs but no " - "SetProcessAffinityMask function?") ); + _T("this system has several CPUs but no SetProcessAffinityMask function?") ); } if ( !pfnSetProcessAffinityMask ) @@ -759,29 +766,44 @@ wxThreadError wxThread::Delete(ExitCode *pRc) // Delete() is always safe to call, so consider all possible states - // has the thread started to run? - bool shouldResume = FALSE; + // we might need to resume the thread, but we might also not need to cancel + // it if it doesn't run yet + bool shouldResume = FALSE, + shouldCancel = TRUE, + isRunning = FALSE; + // check if the thread already started to run { wxCriticalSectionLocker lock(m_critsect); if ( m_internal->GetState() == STATE_NEW ) { - // WinThreadStart() will see it and terminate immediately + // WinThreadStart() will see it and terminate immediately, no need + // to cancel the thread - but we still need to resume it to let it + // run m_internal->SetState(STATE_EXITED); - shouldResume = TRUE; + Resume(); // it knows about STATE_EXITED special case + + shouldCancel = FALSE; + isRunning = TRUE; + + // shouldResume is correctly set to FALSE here + } + else + { + shouldResume = IsPaused(); } } - // is the thread paused? - if ( shouldResume || IsPaused() ) + // resume the thread if it is paused + if ( shouldResume ) Resume(); HANDLE hThread = m_internal->GetHandle(); // does is still run? - if ( IsRunning() ) + if ( isRunning || IsRunning() ) { if ( IsMain() ) { @@ -794,6 +816,7 @@ wxThreadError wxThread::Delete(ExitCode *pRc) } // ask the thread to terminate + if ( shouldCancel ) { wxCriticalSectionLocker lock(m_critsect); @@ -877,7 +900,7 @@ wxThreadError wxThread::Delete(ExitCode *pRc) if ( !::GetExitCodeThread(hThread, (LPDWORD)&rc) ) { - wxLogLastError("GetExitCodeThread"); + wxLogLastError(wxT("GetExitCodeThread")); rc = (ExitCode)-1; } @@ -886,7 +909,7 @@ wxThreadError wxThread::Delete(ExitCode *pRc) { // if the thread exits normally, this is done in WinThreadStart, but in // this case it would have been too early because - // MsgWaitForMultipleObject() would fail if the therad handle was + // MsgWaitForMultipleObject() would fail if the thread handle was // closed while we were waiting on it, so we must do it here delete this; } @@ -1020,9 +1043,7 @@ bool wxThreadModule::OnInit() // in normal circumstances it will only happen if all other // TLS_MINIMUM_AVAILABLE (>= 64) indices are already taken - in other // words, this should never happen - wxLogSysError(_("Thread module initialization failed: " - "impossible to allocate index in thread " - "local storage")); + wxLogSysError(_("Thread module initialization failed: impossible to allocate index in thread local storage")); return FALSE; } @@ -1034,8 +1055,7 @@ bool wxThreadModule::OnInit() ::TlsFree(gs_tlsThisThread); gs_tlsThisThread = 0xFFFFFFFF; - wxLogSysError(_("Thread module initialization failed: " - "can not store value in thread local storage")); + wxLogSysError(_("Thread module initialization failed: can not store value in thread local storage")); return FALSE; } @@ -1055,7 +1075,7 @@ void wxThreadModule::OnExit() { if ( !::TlsFree(gs_tlsThisThread) ) { - wxLogLastError("TlsFree failed."); + wxLogLastError(wxT("TlsFree failed.")); } if ( gs_critsectGui ) @@ -1160,7 +1180,7 @@ void WXDLLEXPORT wxWakeUpMainThread() if ( !::PostThreadMessage(gs_idMainThread, WM_NULL, 0, 0) ) { // should never happen - wxLogLastError("PostThreadMessage(WM_NULL)"); + wxLogLastError(wxT("PostThreadMessage(WM_NULL)")); } } diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index 128c77e852..7189cd9b47 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -32,7 +32,7 @@ #include "wx/tooltip.h" #include "wx/msw/private.h" -#if defined(__WIN95__) && (!defined(__GNUWIN32__) || defined(__MINGW32__)) +#if defined(__WIN95__) && (!defined(__GNUWIN32_OLD__) || defined(__MINGW32__)) #include <commctrl.h> #endif @@ -207,7 +207,7 @@ WXHWND wxToolTip::GetToolTipCtrl() if ( !ms_hwndTT ) { ms_hwndTT = (WXHWND)::CreateWindow(TOOLTIPS_CLASS, - (LPSTR)NULL, + (LPCTSTR)NULL, TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, @@ -303,25 +303,25 @@ void wxToolTip::Add(WXHWND hWnd) hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); if ( !hfont ) { - wxLogLastError("GetStockObject(DEFAULT_GUI_FONT)"); + wxLogLastError(wxT("GetStockObject(DEFAULT_GUI_FONT)")); } } HDC hdc = CreateCompatibleDC(NULL); if ( !hdc ) { - wxLogLastError("CreateCompatibleDC(NULL)"); + wxLogLastError(wxT("CreateCompatibleDC(NULL)")); } if ( !SelectObject(hdc, hfont) ) { - wxLogLastError("SelectObject(hfont)"); + wxLogLastError(wxT("SelectObject(hfont)")); } SIZE sz; if ( !GetTextExtentPoint(hdc, m_text, index, &sz) ) { - wxLogLastError("GetTextExtentPoint"); + wxLogLastError(wxT("GetTextExtentPoint")); } DeleteDC(hdc); @@ -374,6 +374,21 @@ void wxToolTip::SetWindow(wxWindow *win) Add((WXHWND)hwnd); } } + + // VZ: it's ugly to do it here, but I don't want any major changes right + // now, later we will probably want to have wxWindow::OnGotToolTip() or + // something like this where the derived class can do such things + // itself instead of wxToolTip "knowing" about them all + wxComboBox *combo = wxDynamicCast(control, wxComboBox); + if ( combo ) + { + WXHWND hwndComboEdit = combo->GetEditHWND(); + if ( hwndComboEdit ) + { + Add(hwndComboEdit); + } + //else: it's ok for a combo to be read only, of course + } } void wxToolTip::SetTip(const wxString& tip) diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 2d692a9a85..73e8d4d856 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -29,6 +29,9 @@ #include "wx/msw/private.h" +// Set this to 1 to be _absolutely_ sure that repainting will work for all comctl32.dll versions +#define wxUSE_COMCTL32_SAFELY 0 + // Mingw32 is a bit mental even though this is done in winundef #ifdef GetFirstChild #undef GetFirstChild @@ -112,7 +115,7 @@ static bool IsItemSelected(HWND hwndTV, HTREEITEM hItem) if ( !TreeView_GetItem(hwndTV, &tvi) ) { - wxLogLastError("TreeView_GetItem"); + wxLogLastError(wxT("TreeView_GetItem")); } return (tvi.state & TVIS_SELECTED) != 0; @@ -128,7 +131,7 @@ static void SelectItem(HWND hwndTV, HTREEITEM hItem, bool select = TRUE) if ( TreeView_SetItem(hwndTV, &tvi) == -1 ) { - wxLogLastError("TreeView_SetItem"); + wxLogLastError(wxT("TreeView_SetItem")); } } @@ -516,7 +519,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, return FALSE; DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP | - TVS_HASLINES | TVS_SHOWSELALWAYS; + TVS_HASLINES | TVS_SHOWSELALWAYS /* | WS_CLIPSIBLINGS */; if ( m_windowStyle & wxTR_HAS_BUTTONS ) wstyle |= TVS_HASBUTTONS; @@ -545,17 +548,23 @@ bool wxTreeCtrl::Create(wxWindow *parent, if ( !MSWCreateControl(WC_TREEVIEW, wstyle) ) return FALSE; -#if 0 +#if wxUSE_COMCTL32_SAFELY + wxWindow::SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); + wxWindow::SetForegroundColour(wxWindow::GetParent()->GetForegroundColour()); +#elif 1 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); + SetForegroundColour(wxWindow::GetParent()->GetForegroundColour()); #else // This works around a bug in the Windows tree control whereby for some versions // of comctrl32, setting any colour actually draws the background in black. // This will initialise the background to the system colour. + // THIS FIX NOW REVERTED since it caused problems on _other_ systems. + // Assume the user has an updated comctl32.dll. ::SendMessage(GetHwnd(), TVM_SETBKCOLOR, 0,-1); wxWindow::SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); + SetForegroundColour(wxWindow::GetParent()->GetForegroundColour()); #endif - SetForegroundColour(wxWindow::GetParent()->GetForegroundColour()); // VZ: this is some experimental code which may be used to get the // TVS_CHECKBOXES style functionality for comctl32.dll < 4.71. @@ -643,7 +652,7 @@ bool wxTreeCtrl::DoGetItem(wxTreeViewItem* tvItem) const { if ( !TreeView_GetItem(GetHwnd(), tvItem) ) { - wxLogLastError("TreeView_GetItem"); + wxLogLastError(wxT("TreeView_GetItem")); return FALSE; } @@ -655,7 +664,7 @@ void wxTreeCtrl::DoSetItem(wxTreeViewItem* tvItem) { if ( TreeView_SetItem(GetHwnd(), tvItem) == -1 ) { - wxLogLastError("TreeView_SetItem"); + wxLogLastError(wxT("TreeView_SetItem")); } } @@ -716,20 +725,24 @@ size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, bool wxTreeCtrl::SetBackgroundColour(const wxColour &colour) { +#if !wxUSE_COMCTL32_SAFELY if ( !wxWindowBase::SetBackgroundColour(colour) ) return FALSE; SendMessage(GetHwnd(), TVM_SETBKCOLOR, 0, colour.GetPixel()); +#endif return TRUE; } bool wxTreeCtrl::SetForegroundColour(const wxColour &colour) { +#if !wxUSE_COMCTL32_SAFELY if ( !wxWindowBase::SetForegroundColour(colour) ) return FALSE; SendMessage(GetHwnd(), TVM_SETTEXTCOLOR, 0, colour.GetPixel()); +#endif return TRUE; } @@ -1151,16 +1164,14 @@ wxTreeItemId wxTreeCtrl::GetFirstVisibleItem() const wxTreeItemId wxTreeCtrl::GetNextVisible(const wxTreeItemId& item) const { - wxASSERT_MSG( IsVisible(item), wxT("The item you call GetNextVisible() " - "for must be visible itself!")); + wxASSERT_MSG( IsVisible(item), wxT("The item you call GetNextVisible() for must be visible itself!")); return wxTreeItemId((WXHTREEITEM) TreeView_GetNextVisible(GetHwnd(), HITEM(item))); } wxTreeItemId wxTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const { - wxASSERT_MSG( IsVisible(item), wxT("The item you call GetPrevVisible() " - "for must be visible itself!")); + wxASSERT_MSG( IsVisible(item), wxT("The item you call GetPrevVisible() for must be visible itself!")); return wxTreeItemId((WXHTREEITEM) TreeView_GetPrevVisible(GetHwnd(), HITEM(item))); } @@ -1228,6 +1239,11 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent, mask |= TVIF_TEXT; tvIns.item.pszText = (wxChar *)text.c_str(); // cast is ok } + else + { + tvIns.item.pszText = NULL; + tvIns.item.cchTextMax = 0; + } if ( image != -1 ) { @@ -1258,7 +1274,7 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent, HTREEITEM id = (HTREEITEM) TreeView_InsertItem(GetHwnd(), &tvIns); if ( id == 0 ) { - wxLogLastError("TreeView_InsertItem"); + wxLogLastError(wxT("TreeView_InsertItem")); } if ( data != NULL ) @@ -1343,7 +1359,7 @@ void wxTreeCtrl::Delete(const wxTreeItemId& item) { if ( !TreeView_DeleteItem(GetHwnd(), HITEM(item)) ) { - wxLogLastError("TreeView_DeleteItem"); + wxLogLastError(wxT("TreeView_DeleteItem")); } } @@ -1366,7 +1382,7 @@ void wxTreeCtrl::DeleteChildren(const wxTreeItemId& item) { if ( !TreeView_DeleteItem(GetHwnd(), (HTREEITEM)children[n]) ) { - wxLogLastError("TreeView_DeleteItem"); + wxLogLastError(wxT("TreeView_DeleteItem")); } } } @@ -1375,7 +1391,7 @@ void wxTreeCtrl::DeleteAllItems() { if ( !TreeView_DeleteAllItems(GetHwnd()) ) { - wxLogLastError("TreeView_DeleteAllItems"); + wxLogLastError(wxT("TreeView_DeleteAllItems")); } } @@ -1500,7 +1516,7 @@ void wxTreeCtrl::SelectItem(const wxTreeItemId& item) { if ( !TreeView_SelectItem(GetHwnd(), HITEM(item)) ) { - wxLogLastError("TreeView_SelectItem"); + wxLogLastError(wxT("TreeView_SelectItem")); } else { @@ -1522,7 +1538,7 @@ void wxTreeCtrl::ScrollTo(const wxTreeItemId& item) { if ( !TreeView_SelectSetFirstVisible(GetHwnd(), HITEM(item)) ) { - wxLogLastError("TreeView_SelectSetFirstVisible"); + wxLogLastError(wxT("TreeView_SelectSetFirstVisible")); } } @@ -1924,25 +1940,6 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) switch ( hdr->code ) { - case NM_RCLICK: - { - if ( wxControl::MSWOnNotify(idCtrl, lParam, result) ) - return TRUE; - - TV_HITTESTINFO tvhti; - ::GetCursorPos(&(tvhti.pt)); - ::ScreenToClient(GetHwnd(),&(tvhti.pt)); - if ( TreeView_HitTest(GetHwnd(),&tvhti) ) - { - if( tvhti.flags & TVHT_ONITEM ) - { - event.m_item = (WXHTREEITEM) tvhti.hItem; - eventType = wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK; - } - } - } - break; - case TVN_BEGINDRAG: eventType = wxEVT_COMMAND_TREE_BEGIN_DRAG; // fall through @@ -2038,8 +2035,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) break; default: - wxLogDebug(wxT("unexpected code %d in TVN_ITEMEXPAND " - "message"), tv->action); + wxLogDebug(wxT("unexpected code %d in TVN_ITEMEXPAND message"), tv->action); } bool ing = ((int)hdr->code == TVN_ITEMEXPANDING); @@ -2091,7 +2087,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } break; -#if defined(_WIN32_IE) && _WIN32_IE >= 0x300 +#if defined(_WIN32_IE) && _WIN32_IE >= 0x300 && !wxUSE_COMCTL32_SAFELY case NM_CUSTOMDRAW: { LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW)lParam; @@ -2188,6 +2184,27 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) break; #endif // _WIN32_IE >= 0x300 + case NM_DBLCLK: + case NM_RCLICK: + { + TV_HITTESTINFO tvhti; + ::GetCursorPos(&tvhti.pt); + ::ScreenToClient(GetHwnd(), &tvhti.pt); + if ( TreeView_HitTest(GetHwnd(), &tvhti) ) + { + if ( tvhti.flags & TVHT_ONITEM ) + { + event.m_item = (WXHTREEITEM) tvhti.hItem; + eventType = (int)hdr->code == NM_DBLCLK + ? wxEVT_COMMAND_TREE_ITEM_ACTIVATED + : wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK; + } + + break; + } + } + // fall through + default: return wxControl::MSWOnNotify(idCtrl, lParam, result); } @@ -2200,6 +2217,14 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // post processing switch ( hdr->code ) { + case NM_DBLCLK: + // we translate NM_DBLCLK into ACTIVATED event, so don't interpret + // the return code of this event handler as the return value for + // NM_DBLCLK - otherwise, double clicking the item to toggle its + // expanded status would never work + *result = FALSE; + break; + case TVN_BEGINDRAG: case TVN_BEGINRDRAG: if ( event.IsAllowed() ) diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index f836d8dc4b..14346f1413 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -127,7 +127,7 @@ extern "C" { #endif # if defined(__WXDEBUG__) && wxUSE_GLOBAL_MEMORY_OPERATORS && wxUSE_DEBUG_NEW_ALWAYS -# define new new(__FILE__,__LINE__) +# define new new(__TFILE__,__LINE__) # endif #endif @@ -163,7 +163,7 @@ bool wxGetHostName(wxChar *buf, int maxSize) DWORD nSize = maxSize; if ( !::GetComputerName(buf, &nSize) ) { - wxLogLastError("GetComputerName"); + wxLogLastError(wxT("GetComputerName")); return FALSE; } @@ -450,7 +450,7 @@ bool wxDirExists(const wxString& dir) if ( h == INVALID_HANDLE_VALUE ) { - wxLogLastError("FindFirstFile"); + wxLogLastError(wxT("FindFirstFile")); return FALSE; } @@ -910,8 +910,6 @@ bool wxCheckForInterrupt(wxWindow *wnd) return TRUE; } -#endif // wxUSE_GUI - // MSW only: get user-defined resource from the .res file. // Returns NULL or newly-allocated memory, so use delete[] to clean up. @@ -1052,6 +1050,8 @@ WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd) #endif // Win16/32 } +#endif // wxUSE_GUI + #if 0 //------------------------------------------------------------------------ // wild character routines @@ -1209,7 +1209,7 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) return ((*str == '\0') && (*pattern == '\0')); }; -#endif +#endif // 0 #if 0 diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 453b7efc5d..e6287d9f28 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -108,7 +108,7 @@ public: #ifndef __WIN16__ if ( !::CloseHandle(hProcess) ) { - wxLogLastError("CloseHandle(hProcess)"); + wxLogLastError(wxT("CloseHandle(hProcess)")); } #endif } @@ -121,17 +121,20 @@ public: bool state; // set to FALSE when the process finishes }; +#if defined(__WIN32__) && wxUSE_STREAMS -#ifdef __WIN32__ // ---------------------------------------------------------------------------- // wxPipeStreams // ---------------------------------------------------------------------------- -class wxPipeInputStream: public wxInputStream { +class wxPipeInputStream: public wxInputStream +{ public: wxPipeInputStream(HANDLE hInput); ~wxPipeInputStream(); + virtual bool Eof() const; + protected: size_t OnSysRead(void *buffer, size_t len); @@ -139,7 +142,8 @@ protected: HANDLE m_hInput; }; -class wxPipeOutputStream: public wxOutputStream { +class wxPipeOutputStream: public wxOutputStream +{ public: wxPipeOutputStream(HANDLE hOutput); ~wxPipeOutputStream(); @@ -165,17 +169,55 @@ wxPipeInputStream::~wxPipeInputStream() ::CloseHandle(m_hInput); } -size_t wxPipeInputStream::OnSysRead(void *buffer, size_t len) +bool wxPipeInputStream::Eof() const { - DWORD bytesRead; + DWORD nAvailable; + + // function name is misleading, it works with anon pipes as well + DWORD rc = ::PeekNamedPipe + ( + m_hInput, // handle + NULL, 0, // ptr to buffer and its size + NULL, // [out] bytes read + &nAvailable, // [out] bytes available + NULL // [out] bytes left + ); + + if ( !rc ) + { + if ( ::GetLastError() != ERROR_BROKEN_PIPE ) + { + // unexpected error + wxLogLastError(_T("PeekNamedPipe")); + } + // don't try to continue reading from a pipe if an error occured or if + // it had been closed + return TRUE; + } + else + { + return nAvailable == 0; + } +} + +size_t wxPipeInputStream::OnSysRead(void *buffer, size_t len) +{ + // reading from a pipe may block if there is no more data, always check for + // EOF first m_lasterror = wxSTREAM_NOERROR; - if (! ::ReadFile(m_hInput, buffer, len, &bytesRead, NULL) ) { - if (GetLastError() == ERROR_BROKEN_PIPE) + if ( Eof() ) + return 0; + + DWORD bytesRead; + if ( !::ReadFile(m_hInput, buffer, len, &bytesRead, NULL) ) + { + if ( ::GetLastError() == ERROR_BROKEN_PIPE ) m_lasterror = wxSTREAM_EOF; else m_lasterror = wxSTREAM_READ_ERROR; } + return bytesRead; } @@ -198,12 +240,14 @@ size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len) DWORD bytesRead; m_lasterror = wxSTREAM_NOERROR; - if (! ::WriteFile(m_hOutput, buffer, len, &bytesRead, NULL) ) { - if (GetLastError() == ERROR_BROKEN_PIPE) + if ( !::WriteFile(m_hOutput, buffer, len, &bytesRead, NULL) ) + { + if ( ::GetLastError() == ERROR_BROKEN_PIPE ) m_lasterror = wxSTREAM_EOF; else m_lasterror = wxSTREAM_READ_ERROR; } + return bytesRead; } @@ -214,6 +258,7 @@ size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len) // ============================================================================ #ifdef __WIN32__ + static DWORD wxExecuteThread(wxExecuteData *data) { WaitForSingleObject(data->hProcess, INFINITE); @@ -221,7 +266,7 @@ static DWORD wxExecuteThread(wxExecuteData *data) // get the exit code if ( !GetExitCodeProcess(data->hProcess, &data->dwExitCode) ) { - wxLogLastError("GetExitCodeProcess"); + wxLogLastError(wxT("GetExitCodeProcess")); } wxASSERT_MSG( data->dwExitCode != STILL_ACTIVE, @@ -347,164 +392,148 @@ long wxExecute(const wxString& cmd, bool sync, wxProcess *handler) } #if defined(__WIN32__) && !defined(__TWIN32__) - // the old code is disabled because we really need a process handle - // if we want to execute it asynchronously or even just get its - // return code and for this we must use CreateProcess() and not - // ShellExecute() -#if 0 - // isolate command and arguments - wxString commandName; - bool insideQuotes = FALSE; - const char *pc; - for ( pc = command.c_str(); *pc != '\0'; pc++ ) - { - switch ( *pc ) - { - case ' ': - case '\t': - if ( !insideQuotes ) - break; - // fall through - - case '"': - insideQuotes = !insideQuotes; - // fall through - - default: - commandName += *pc; - continue; // skip the next break - } - // only reached for space not inside quotes - break; - } - wxString commandArgs = pc; - - wxWindow *winTop = wxTheApp->GetTopWindow(); - HWND hwndTop = (HWND)(winTop ? winTop->GetHWND() : 0); - - HANDLE result; -#ifdef __GNUWIN32__ - result = ShellExecute(hwndTop, - (const wchar_t)"open", - (const wchar_t)commandName, - (const wchar_t)commandArgs, - (const wchar_t)NULL, - SW_SHOWNORMAL); -#else // !GNUWIN32 - result = ShellExecute(hwndTop, "open", commandName, - commandArgs, NULL, SW_SHOWNORMAL); -#endif // GNUWIN32 - - if ( ((long)result) <= 32 ) - wxLogSysError(_("Can't execute command '%s'"), command.c_str()); - - return result; -#else // 1 - - HANDLE hpipeRead[2]; - HANDLE hpipeWrite[2]; - HANDLE hStdIn = INVALID_HANDLE_VALUE; - HANDLE hStdOut = INVALID_HANDLE_VALUE; - - // we need to inherit handles in the child process if we want to redirect - // its IO - BOOL inheritHandles = FALSE; + // the IO redirection is only supported with wxUSE_STREAMS + BOOL redirect = FALSE; +#if wxUSE_STREAMS + // the first elements are reading ends, the second are the writing ones + HANDLE hpipeStdin[2], + hpipeStdinWrite = INVALID_HANDLE_VALUE, + hpipeStdout[2], + hpipeStderr[2]; // open the pipes to which child process IO will be redirected if needed if ( handler && handler->IsRedirected() ) { + // default secutiry attributes SECURITY_ATTRIBUTES security; security.nLength = sizeof(security); security.lpSecurityDescriptor = NULL; security.bInheritHandle = TRUE; - if ( !::CreatePipe(&hpipeRead[0], &hpipeRead[1], &security, 0) ) + // create stdin pipe + if ( !::CreatePipe(&hpipeStdin[0], &hpipeStdin[1], &security, 0) ) { wxLogSysError(_("Can't create the inter-process read pipe")); - return 0; + // indicate failure in both cases + return sync ? -1 : 0; } - if ( !::CreatePipe(&hpipeWrite[0], &hpipeWrite[1], &security, 0) ) + // and a stdout one + if ( !::CreatePipe(&hpipeStdout[0], &hpipeStdout[1], &security, 0) ) { - ::CloseHandle(hpipeRead[0]); - ::CloseHandle(hpipeRead[1]); + ::CloseHandle(hpipeStdin[0]); + ::CloseHandle(hpipeStdin[1]); wxLogSysError(_("Can't create the inter-process write pipe")); - return 0; + return sync ? -1 : 0; } - // We need to save the old stdio handles to restore them after the call - // to CreateProcess - hStdIn = ::GetStdHandle(STD_INPUT_HANDLE); - hStdOut = ::GetStdHandle(STD_OUTPUT_HANDLE); - - if ( !::SetStdHandle(STD_INPUT_HANDLE, hpipeRead[0]) || - !::SetStdHandle(STD_OUTPUT_HANDLE, hpipeWrite[1]) ) - { - wxLogDebug(_T("Failed to change stdin/out handles")); - } + (void)::CreatePipe(&hpipeStderr[0], &hpipeStderr[1], &security, 0); - inheritHandles = TRUE; + redirect = TRUE; } +#endif // wxUSE_STREAMS // create the process STARTUPINFO si; wxZeroMemory(si); - si.cb = sizeof(si); - PROCESS_INFORMATION pi; - - if ( ::CreateProcess( - NULL, // application name (use only cmd line) - (wxChar *)command.c_str(), // full command line - NULL, // security attributes: defaults for both - NULL, // the process and its main thread - inheritHandles, // inherit handles if we need pipes - CREATE_DEFAULT_ERROR_MODE | - CREATE_SUSPENDED, // flags - NULL, // environment (use the same) - NULL, // current directory (use the same) - &si, // startup info (unused here) - &pi // process info - ) == 0 ) +#if wxUSE_STREAMS + if ( redirect ) { - if ( inheritHandles ) + // when the std IO is redirected, we don't show the (console) process + // window + si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + + si.hStdInput = hpipeStdin[0]; + si.hStdOutput = hpipeStdout[1]; + si.hStdError = hpipeStderr[1]; + + si.wShowWindow = SW_HIDE; + + // we must duplicate the handle to the write side of stdin pipe to make + // it non inheritable: indeed, we must close hpipeStdin[1] before + // launching the child process as otherwise this handle will be + // inherited by the child which will never close it and so the pipe + // will never be closed and the child will be left stuck in ReadFile() + if ( !::DuplicateHandle + ( + GetCurrentProcess(), + hpipeStdin[1], + GetCurrentProcess(), + &hpipeStdinWrite, + 0, // desired access: unused here + FALSE, // not inherited + DUPLICATE_SAME_ACCESS // same access as for src handle + ) ) { - ::CloseHandle(hpipeWrite[0]); - ::CloseHandle(hpipeWrite[1]); - ::CloseHandle(hpipeRead[0]); - ::CloseHandle(hpipeRead[1]); + wxLogLastError(_T("DuplicateHandle")); } - wxLogSysError(_("Execution of command '%s' failed"), command.c_str()); + ::CloseHandle(hpipeStdin[1]); + } +#endif // wxUSE_STREAMS - return 0; + PROCESS_INFORMATION pi; + DWORD dwFlags = CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED; + + bool ok = ::CreateProcess + ( + NULL, // application name (use only cmd line) + (wxChar *) + command.c_str(), // full command line + NULL, // security attributes: defaults for both + NULL, // the process and its main thread + redirect, // inherit handles if we use pipes + dwFlags, // process creation flags + NULL, // environment (use the same) + NULL, // current directory (use the same) + &si, // startup info (unused here) + &pi // process info + ) != 0; + +#if wxUSE_STREAMS + // we can close the pipe ends used by child anyhow + if ( redirect ) + { + ::CloseHandle(hpipeStdin[0]); + ::CloseHandle(hpipeStdout[1]); + ::CloseHandle(hpipeStderr[1]); } +#endif // wxUSE_STREAMS - // Restore the old stdio handles - if ( inheritHandles ) + if ( !ok ) { - if ( !::SetStdHandle(STD_INPUT_HANDLE, hStdIn) || - !::SetStdHandle(STD_OUTPUT_HANDLE, hStdOut) ) +#if wxUSE_STREAMS + // close the other handles too + if ( redirect ) { - wxLogDebug(_T("Failed to restore old stdin/out handles")); + ::CloseHandle(hpipeStdout[0]); + ::CloseHandle(hpipeStderr[0]); } +#endif // wxUSE_STREAMS - // they're still opened in child process - ::CloseHandle(hpipeWrite[1]); - ::CloseHandle(hpipeRead[0]); + wxLogSysError(_("Execution of command '%s' failed"), command.c_str()); + + return sync ? -1 : 0; + } +#if wxUSE_STREAMS + if ( redirect ) + { // We can now initialize the wxStreams - wxInputStream *inStream = new wxPipeInputStream(hpipeWrite[0]); - wxOutputStream *outStream = new wxPipeOutputStream(hpipeRead[1]); + wxInputStream *inStream = new wxPipeInputStream(hpipeStdout[0]), + *errStream = new wxPipeInputStream(hpipeStderr[0]); + wxOutputStream *outStream = new wxPipeOutputStream(hpipeStdinWrite); - handler->SetPipeStreams(inStream, outStream); + handler->SetPipeStreams(inStream, outStream, errStream); } +#endif // wxUSE_STREAMS // register the class for the hidden window used for the notifications if ( !gs_classForHiddenWindow ) @@ -519,7 +548,7 @@ long wxExecute(const wxString& cmd, bool sync, wxProcess *handler) if ( !::RegisterClass(&wndclass) ) { - wxLogLastError("RegisterClass(hidden window)"); + wxLogLastError(wxT("RegisterClass(hidden window)")); } } @@ -562,16 +591,16 @@ long wxExecute(const wxString& cmd, bool sync, wxProcess *handler) if ( ::ResumeThread(pi.hThread) == (DWORD)-1 ) { // ignore it - what can we do? - wxLogLastError("ResumeThread in wxExecute"); + wxLogLastError(wxT("ResumeThread in wxExecute")); } // close unneeded handle if ( !::CloseHandle(pi.hThread) ) - wxLogLastError("CloseHandle(hThread)"); + wxLogLastError(wxT("CloseHandle(hThread)")); if ( !hThread ) { - wxLogLastError("CreateThread in wxExecute"); + wxLogLastError(wxT("CreateThread in wxExecute")); DestroyWindow(hwnd); delete data; @@ -580,6 +609,8 @@ long wxExecute(const wxString& cmd, bool sync, wxProcess *handler) return pi.dwProcessId; } + ::CloseHandle(hThread); + #if wxUSE_IPC // second part of DDE hack: now establish the DDE conversation with the // just launched process @@ -624,7 +655,6 @@ long wxExecute(const wxString& cmd, bool sync, wxProcess *handler) // return the exit code return dwExitCode; -#endif // 0/1 #else // Win16 long instanceID = WinExec((LPCSTR) WXSTRINGCAST command, SW_SHOW); if (instanceID < 32) return(0); @@ -655,6 +685,8 @@ long wxExecute(char **argv, bool sync, wxProcess *handler) return wxExecute(command, sync, handler); } +#if wxUSE_GUI + // ---------------------------------------------------------------------------- // Metafile helpers // ---------------------------------------------------------------------------- @@ -688,3 +720,5 @@ extern void HIMETRICToPixel(LONG *x, LONG *y) *y *= iHeightPels; *y /= (iHeightMM * 100); } + +#endif // wxUSE_GUI diff --git a/src/msw/version.rc b/src/msw/version.rc new file mode 100644 index 0000000000..9a1a536efd --- /dev/null +++ b/src/msw/version.rc @@ -0,0 +1,47 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/msw/version.rc +// Purpose: contains version info resource for wxMSW DLL build +// Author: Vadim Zeitlin +// Modified by: +// Created: 09.07.00 +// RCS-ID: $Id$ +// Copyright: (c) 2000 Vadim Zeitlin +// Licence: wxWindows license +/////////////////////////////////////////////////////////////////////////////// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,2,0,0 + PRODUCTVERSION 2,2,0,0 + FILEFLAGSMASK 0x3fL +#ifdef __WXDEBUG__ + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "wxWindows cross-platform GUI framework\0" + VALUE "CompanyName", "wxWindows development team\0" + VALUE "FileDescription", "wxWindows for MSW\0" + VALUE "FileVersion", "2, 2, 0, 0\0" + VALUE "InternalName", "wxMSW\0" + VALUE "LegalCopyright", "Copyright © 1993,2000 wxWindows development team\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "wx220.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "wxMSW\0" + VALUE "ProductVersion", "2, 2, 0, 0\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/src/msw/window.cpp b/src/msw/window.cpp index a011dca8ab..635b50885c 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -50,7 +50,7 @@ #include <stdio.h> #endif -#if wxUSE_OWNER_DRAWN +#if wxUSE_OWNER_DRAWN #include "wx/ownerdrw.h" #endif @@ -98,6 +98,11 @@ #endif #endif +// This didn't appear in mingw until 2.95.2 +#ifndef SIF_TRACKPOS +#define SIF_TRACKPOS 16 +#endif + // --------------------------------------------------------------------------- // global variables // --------------------------------------------------------------------------- @@ -129,6 +134,9 @@ wxWindow *wxFindWinFromHandle(WXHWND hWnd); // mouse clicks static void TranslateKbdEventToMouse(wxWindow *win, int *x, int *y, WPARAM *flags); +// get the text metrics for the current font +static TEXTMETRIC wxGetTextMetrics(const wxWindow *win); + // --------------------------------------------------------------------------- // event tables // --------------------------------------------------------------------------- @@ -274,7 +282,7 @@ wxWindow::~wxWindow() //if (::IsWindow(GetHwnd())) { if ( !::DestroyWindow(GetHwnd()) ) - wxLogLastError("DestroyWindow"); + wxLogLastError(wxT("DestroyWindow")); } // remove hWnd <-> wxWindow association @@ -299,10 +307,12 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, DWORD msflags = 0; if ( style & wxBORDER ) msflags |= WS_BORDER; +/* Not appropriate for non-frame/dialog windows, and + may clash with other window styles. if ( style & wxTHICK_FRAME ) msflags |= WS_THICKFRAME; - - //msflags |= WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE; +*/ + //msflags |= WS_CHILD /* | WS_CLIPSIBLINGS */ | WS_VISIBLE; msflags |= WS_CHILD | WS_VISIBLE; if ( style & wxCLIP_CHILDREN ) msflags |= WS_CLIPCHILDREN; @@ -1087,8 +1097,14 @@ void wxWindow::DoGetSize(int *x, int *y) const { HWND hWnd = GetHwnd(); RECT rect; - GetWindowRect(hWnd, &rect); - +#ifdef __WIN16__ + ::GetWindowRect(hWnd, &rect); +#else + if ( !::GetWindowRect(hWnd, &rect) ) + { + wxLogLastError(_T("GetWindowRect")); + } +#endif if ( x ) *x = rect.right - rect.left; if ( y ) @@ -1185,7 +1201,7 @@ void wxWindow::DoMoveWindow(int x, int y, int width, int height) { if ( !::MoveWindow(GetHwnd(), x, y, width, height, TRUE) ) { - wxLogLastError("MoveWindow"); + wxLogLastError(wxT("MoveWindow")); } } @@ -1324,26 +1340,18 @@ void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) int wxWindow::GetCharHeight() const { - TEXTMETRIC lpTextMetric; - HWND hWnd = GetHwnd(); - HDC dc = ::GetDC(hWnd); - - GetTextMetrics(dc, &lpTextMetric); - ::ReleaseDC(hWnd, dc); - - return lpTextMetric.tmHeight; + return wxGetTextMetrics(this).tmHeight; } int wxWindow::GetCharWidth() const { - TEXTMETRIC lpTextMetric; - HWND hWnd = GetHwnd(); - HDC dc = ::GetDC(hWnd); - - GetTextMetrics(dc, &lpTextMetric); - ::ReleaseDC(hWnd, dc); - - return lpTextMetric.tmAveCharWidth; + // +1 is needed because Windows apparently adds it when calculating the + // dialog units size in pixels +#if wxDIALOG_UNIT_COMPATIBILITY + return wxGetTextMetrics(this).tmAveCharWidth ; +#else + return wxGetTextMetrics(this).tmAveCharWidth + 1; +#endif } void wxWindow::GetTextExtent(const wxString& string, @@ -1624,7 +1632,10 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) #endif // 0 if ( ::IsDialogMessage(GetHwnd(), msg) ) + { + // IsDialogMessage() did something... return TRUE; + } } #if wxUSE_TOOLTIPS @@ -2302,16 +2313,19 @@ bool wxWindow::MSWCreate(int id, if ( width > -1 ) width1 = width; if ( height > -1 ) height1 = height; - // Unfortunately this won't work in WIN16. Unless perhaps - // we define WS_EX_CONTROLPARENT ourselves? -#ifndef __WIN16__ + // unfortunately, setting WS_EX_CONTROLPARENT only for some windows in the + // hierarchy with several embedded panels (and not all of them) causes the + // program to hang during the next call to IsDialogMessage() due to the bug + // in this function (at least in Windows NT 4.0, it seems to work ok in + // Win2K) +#if 0 // if we have wxTAB_TRAVERSAL style, we want WS_EX_CONTROLPARENT or // IsDialogMessage() won't work for us if ( GetWindowStyleFlag() & wxTAB_TRAVERSAL ) { extendedStyle |= WS_EX_CONTROLPARENT; } -#endif +#endif // 0 HWND hParent = (HWND)NULL; if ( parent ) @@ -2328,8 +2342,7 @@ bool wxWindow::MSWCreate(int id, if ( m_hWnd == 0 ) { - wxLogError(_("Can't find dummy dialog template!\n" - "Check resource include path for finding wx.rc.")); + wxLogError(_("Can't find dummy dialog template!\nCheck resource include path for finding wx.rc.")); return FALSE; } @@ -2358,7 +2371,7 @@ bool wxWindow::MSWCreate(int id, { controlId = id; // all child windows should clip their siblings - // style |= WS_CLIPSIBLINGS; + // style |= /* WS_CLIPSIBLINGS */ ; } wxString className(wclass); @@ -2379,8 +2392,7 @@ bool wxWindow::MSWCreate(int id, if ( !m_hWnd ) { - wxLogError(_("Can't create window of class %s!\n" - "Possible Windows 3.x compatibility problem?"), + wxLogError(_("Can't create window of class %s!\nPossible Windows 3.x compatibility problem?"), wclass); return FALSE; @@ -2434,8 +2446,6 @@ bool wxWindow::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) if ( child->MSWOnNotify(idCtrl, lParam, result) ) { return TRUE; - - break; } node = node->GetNext(); @@ -2642,10 +2652,13 @@ bool wxWindow::HandleDropFiles(WXWPARAM wParam) DragQueryPoint(hFilesInfo, (LPPOINT) &dropPoint); // Get the total number of files dropped - WORD gwFilesDropped = (WORD)DragQueryFile ((HDROP)hFilesInfo, - (UINT)-1, - (LPSTR)0, - (UINT)0); + WORD gwFilesDropped = (WORD)::DragQueryFile + ( + (HDROP)hFilesInfo, + (UINT)-1, + (LPTSTR)0, + (UINT)0 + ); wxString *files = new wxString[gwFilesDropped]; int wIndex; @@ -2692,7 +2705,7 @@ bool wxWindow::HandleSetCursor(WXHWND hWnd, #ifdef __WIN32__ if ( !::GetCursorPos(&pt) ) { - wxLogLastError("GetCursorPos"); + wxLogLastError(wxT("GetCursorPos")); } #else // In WIN16 it doesn't return a value. @@ -2913,9 +2926,9 @@ bool wxWindow::HandlePaint() #ifdef __WIN32__ HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle if ( !hRegion ) - wxLogLastError("CreateRectRgn"); + wxLogLastError(wxT("CreateRectRgn")); if ( ::GetUpdateRgn(GetHwnd(), hRegion, FALSE) == ERROR ) - wxLogLastError("GetUpdateRgn"); + wxLogLastError(wxT("GetUpdateRgn")); m_updateRegion = wxRegion((WXHRGN) hRegion); #else @@ -2966,7 +2979,7 @@ void wxWindow::OnEraseBackground(wxEraseEvent& event) m_backgroundColour.Blue()); HBRUSH hBrush = ::CreateSolidBrush(ref); if ( !hBrush ) - wxLogLastError("CreateSolidBrush"); + wxLogLastError(wxT("CreateSolidBrush")); HDC hdc = (HDC)event.GetDC()->GetHDC(); @@ -3046,6 +3059,23 @@ bool wxWindow::HandleGetMinMaxInfo(void *mmInfo) return rc; } +// generate an artificial resize event +void wxWindow::SendSizeEvent() +{ + RECT r; +#ifdef __WIN16__ + ::GetWindowRect(GetHwnd(), &r); +#else + if ( !::GetWindowRect(GetHwnd(), &r) ) + { + wxLogLastError(_T("GetWindowRect")); + } +#endif + + (void)::PostMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED, + MAKELPARAM(r.right - r.left, r.bottom - r.top)); +} + // --------------------------------------------------------------------------- // command messages // --------------------------------------------------------------------------- @@ -3456,11 +3486,34 @@ bool wxWindow::MSWOnScroll(int orientation, WXWORD wParam, break; case SB_THUMBPOSITION: - event.m_eventType = wxEVT_SCROLLWIN_THUMBRELEASE; - break; - case SB_THUMBTRACK: - event.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK; +#ifdef __WIN32__ + // under Win32, the scrollbar range and position are 32 bit integers, + // but WM_[HV]SCROLL only carry the low 16 bits of them, so we must + // explicitly query the scrollbar for the correct position (this must + // be done only for these two SB_ events as they are the only one + // carrying the scrollbar position) + { + SCROLLINFO scrollInfo; + wxZeroMemory(scrollInfo); + scrollInfo.cbSize = sizeof(SCROLLINFO); + scrollInfo.fMask = SIF_TRACKPOS; + + if ( !::GetScrollInfo(GetHwnd(), + orientation == wxHORIZONTAL ? SB_HORZ + : SB_VERT, + &scrollInfo) ) + { + wxLogLastError(_T("GetScrollInfo")); + } + + event.SetPosition(scrollInfo.nTrackPos); + } +#endif // Win32 + + event.m_eventType = wParam == SB_THUMBPOSITION + ? wxEVT_SCROLLWIN_THUMBRELEASE + : wxEVT_SCROLLWIN_THUMBTRACK; break; default: @@ -3508,80 +3561,82 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font) // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead. int wxCharCodeMSWToWX(int keySym) { - int id = 0; + int id; switch (keySym) { - case VK_CANCEL: id = WXK_CANCEL; break; - case VK_BACK: id = WXK_BACK; break; - case VK_TAB: id = WXK_TAB; break; - case VK_CLEAR: id = WXK_CLEAR; break; - case VK_RETURN: id = WXK_RETURN; break; - case VK_SHIFT: id = WXK_SHIFT; break; - case VK_CONTROL: id = WXK_CONTROL; break; - case VK_MENU : id = WXK_MENU; break; - case VK_PAUSE: id = WXK_PAUSE; break; - case VK_SPACE: id = WXK_SPACE; break; - case VK_ESCAPE: id = WXK_ESCAPE; break; - case VK_PRIOR: id = WXK_PRIOR; break; - case VK_NEXT : id = WXK_NEXT; break; - case VK_END: id = WXK_END; break; - case VK_HOME : id = WXK_HOME; break; - case VK_LEFT : id = WXK_LEFT; break; - case VK_UP: id = WXK_UP; break; - case VK_RIGHT: id = WXK_RIGHT; break; - case VK_DOWN : id = WXK_DOWN; break; - case VK_SELECT: id = WXK_SELECT; break; - case VK_PRINT: id = WXK_PRINT; break; - case VK_EXECUTE: id = WXK_EXECUTE; break; - case VK_INSERT: id = WXK_INSERT; break; - case VK_DELETE: id = WXK_DELETE; break; - case VK_HELP : id = WXK_HELP; break; - case VK_NUMPAD0: id = WXK_NUMPAD0; break; - case VK_NUMPAD1: id = WXK_NUMPAD1; break; - case VK_NUMPAD2: id = WXK_NUMPAD2; break; - case VK_NUMPAD3: id = WXK_NUMPAD3; break; - case VK_NUMPAD4: id = WXK_NUMPAD4; break; - case VK_NUMPAD5: id = WXK_NUMPAD5; break; - case VK_NUMPAD6: id = WXK_NUMPAD6; break; - case VK_NUMPAD7: id = WXK_NUMPAD7; break; - case VK_NUMPAD8: id = WXK_NUMPAD8; break; - case VK_NUMPAD9: id = WXK_NUMPAD9; break; - case VK_MULTIPLY: id = WXK_MULTIPLY; break; - case VK_ADD: id = WXK_ADD; break; - case VK_SUBTRACT: id = WXK_SUBTRACT; break; - case VK_DECIMAL: id = WXK_DECIMAL; break; - case VK_DIVIDE: id = WXK_DIVIDE; break; - case VK_F1: id = WXK_F1; break; - case VK_F2: id = WXK_F2; break; - case VK_F3: id = WXK_F3; break; - case VK_F4: id = WXK_F4; break; - case VK_F5: id = WXK_F5; break; - case VK_F6: id = WXK_F6; break; - case VK_F7: id = WXK_F7; break; - case VK_F8: id = WXK_F8; break; - case VK_F9: id = WXK_F9; break; - case VK_F10: id = WXK_F10; break; - case VK_F11: id = WXK_F11; break; - case VK_F12: id = WXK_F12; break; - case VK_F13: id = WXK_F13; break; - case VK_F14: id = WXK_F14; break; - case VK_F15: id = WXK_F15; break; - case VK_F16: id = WXK_F16; break; - case VK_F17: id = WXK_F17; break; - case VK_F18: id = WXK_F18; break; - case VK_F19: id = WXK_F19; break; - case VK_F20: id = WXK_F20; break; - case VK_F21: id = WXK_F21; break; - case VK_F22: id = WXK_F22; break; - case VK_F23: id = WXK_F23; break; - case VK_F24: id = WXK_F24; break; - case VK_NUMLOCK: id = WXK_NUMLOCK; break; - case VK_SCROLL: id = WXK_SCROLL; break; - default: - { - return 0; - } + case VK_CANCEL: id = WXK_CANCEL; break; + case VK_BACK: id = WXK_BACK; break; + case VK_TAB: id = WXK_TAB; break; + case VK_CLEAR: id = WXK_CLEAR; break; + case VK_RETURN: id = WXK_RETURN; break; + case VK_SHIFT: id = WXK_SHIFT; break; + case VK_CONTROL: id = WXK_CONTROL; break; + case VK_MENU : id = WXK_MENU; break; + case VK_PAUSE: id = WXK_PAUSE; break; + case VK_SPACE: id = WXK_SPACE; break; + case VK_ESCAPE: id = WXK_ESCAPE; break; + case VK_PRIOR: id = WXK_PRIOR; break; + case VK_NEXT : id = WXK_NEXT; break; + case VK_END: id = WXK_END; break; + case VK_HOME : id = WXK_HOME; break; + case VK_LEFT : id = WXK_LEFT; break; + case VK_UP: id = WXK_UP; break; + case VK_RIGHT: id = WXK_RIGHT; break; + case VK_DOWN : id = WXK_DOWN; break; + case VK_SELECT: id = WXK_SELECT; break; + case VK_PRINT: id = WXK_PRINT; break; + case VK_EXECUTE: id = WXK_EXECUTE; break; + case VK_INSERT: id = WXK_INSERT; break; + case VK_DELETE: id = WXK_DELETE; break; + case VK_HELP : id = WXK_HELP; break; + case VK_NUMPAD0: id = WXK_NUMPAD0; break; + case VK_NUMPAD1: id = WXK_NUMPAD1; break; + case VK_NUMPAD2: id = WXK_NUMPAD2; break; + case VK_NUMPAD3: id = WXK_NUMPAD3; break; + case VK_NUMPAD4: id = WXK_NUMPAD4; break; + case VK_NUMPAD5: id = WXK_NUMPAD5; break; + case VK_NUMPAD6: id = WXK_NUMPAD6; break; + case VK_NUMPAD7: id = WXK_NUMPAD7; break; + case VK_NUMPAD8: id = WXK_NUMPAD8; break; + case VK_NUMPAD9: id = WXK_NUMPAD9; break; + case VK_MULTIPLY: id = WXK_MULTIPLY; break; + case 0xBB: // VK_OEM_PLUS + case VK_ADD: id = WXK_ADD; break; + case 0xBD: // VK_OEM_MINUS + case VK_SUBTRACT: id = WXK_SUBTRACT; break; + case 0xBE: // VK_OEM_PERIOD + case VK_DECIMAL: id = WXK_DECIMAL; break; + case VK_DIVIDE: id = WXK_DIVIDE; break; + case VK_F1: id = WXK_F1; break; + case VK_F2: id = WXK_F2; break; + case VK_F3: id = WXK_F3; break; + case VK_F4: id = WXK_F4; break; + case VK_F5: id = WXK_F5; break; + case VK_F6: id = WXK_F6; break; + case VK_F7: id = WXK_F7; break; + case VK_F8: id = WXK_F8; break; + case VK_F9: id = WXK_F9; break; + case VK_F10: id = WXK_F10; break; + case VK_F11: id = WXK_F11; break; + case VK_F12: id = WXK_F12; break; + case VK_F13: id = WXK_F13; break; + case VK_F14: id = WXK_F14; break; + case VK_F15: id = WXK_F15; break; + case VK_F16: id = WXK_F16; break; + case VK_F17: id = WXK_F17; break; + case VK_F18: id = WXK_F18; break; + case VK_F19: id = WXK_F19; break; + case VK_F20: id = WXK_F20; break; + case VK_F21: id = WXK_F21; break; + case VK_F22: id = WXK_F22; break; + case VK_F23: id = WXK_F23; break; + case VK_F24: id = WXK_F24; break; + case VK_NUMLOCK: id = WXK_NUMLOCK; break; + case VK_SCROLL: id = WXK_SCROLL; break; + default: + id = 0; } + return id; } @@ -4227,3 +4282,35 @@ static void TranslateKbdEventToMouse(wxWindow *win, int *x, int *y, WPARAM *flag win->ScreenToClient(x, y); } + +static TEXTMETRIC wxGetTextMetrics(const wxWindow *win) +{ + // prepare the DC + TEXTMETRIC tm; + HWND hwnd = GetHwndOf(win); + HDC hdc = ::GetDC(hwnd); + +#if !wxDIALOG_UNIT_COMPATIBILITY + // and select the current font into it + HFONT hfont = GetHfontOf(win->GetFont()); + if ( hfont ) + { + hfont = (HFONT)::SelectObject(hdc, hfont); + } +#endif + + // finally retrieve the text metrics from it + GetTextMetrics(hdc, &tm); + +#if !wxDIALOG_UNIT_COMPATIBILITY + // and clean up + if ( hfont ) + { + (void)::SelectObject(hdc, hfont); + } +#endif + + ::ReleaseDC(hwnd, hdc); + + return tm; +} diff --git a/src/msw/xpmhand.cpp b/src/msw/xpmhand.cpp index 064e9fc34a..1974d381f2 100644 --- a/src/msw/xpmhand.cpp +++ b/src/msw/xpmhand.cpp @@ -55,7 +55,7 @@ static void XpmToBitmap(wxBitmap *bitmap, BITMAP bm; if ( !::GetObject(GetHbitmapOf(*bitmap), sizeof(bm), (LPSTR) & bm) ) { - wxLogLastError("GetObject(bitmap)"); + wxLogLastError(wxT("GetObject(bitmap)")); } refData->m_width = bm.bmWidth; diff --git a/src/os2/accel.cpp b/src/os2/accel.cpp index 7be1c6acd3..1fdc45861f 100644 --- a/src/os2/accel.cpp +++ b/src/os2/accel.cpp @@ -16,6 +16,8 @@ #include <stdio.h> #include "wx/setup.h" #include "wx/window.h" +#include "wx/app.h" +#include "wx/frame.h" #endif #include "wx/os2/accel.h" @@ -42,59 +44,127 @@ protected: wxAcceleratorRefData::wxAcceleratorRefData() { - // TODO -/* - HACCEL m_hAccel; -*/ -} + m_ok = FALSE; + m_hAccel = 0; +} // end of wxAcceleratorRefData::wxAcceleratorRefData wxAcceleratorRefData::~wxAcceleratorRefData() { -/* - if (m_hAccel) - { - DestroyAcceleratorTable((HACCEL) m_hAccel); - } - m_hAccel = 0 ; -*/ -} + if (m_hAccel) + { + WinDestroyAccelTable((HACCEL) m_hAccel); + } + m_hAccel = 0 ; +} // end of wxAcceleratorRefData::~wxAcceleratorRefData wxAcceleratorTable::wxAcceleratorTable() { - m_refData = NULL; -} + m_refData = NULL; +} // end of wxAcceleratorTable::wxAcceleratorTable wxAcceleratorTable::~wxAcceleratorTable() { -} +} // end of wxAcceleratorTable::~wxAcceleratorTable // Load from .rc resource -wxAcceleratorTable::wxAcceleratorTable(const wxString& resource) +wxAcceleratorTable::wxAcceleratorTable( + const wxString& rResource +) { + HACCEL hAccel; + ULONG ulId; + m_refData = new wxAcceleratorRefData; -/* TODO: load acelerator from resource, if appropriate for your platform + ulId = atol((char*)rResource.c_str()); + hAccel = ::WinLoadAccelTable( vHabmain + ,NULL // resources always in .exe + ,(ULONG)ulId + ); + if (wxTheApp->GetTopWindow() != NULL) + { + // + // If we have accelerators the top window is the frame + // + wxFrame* pFrame = (wxFrame*)wxTheApp->GetTopWindow(); + + ::WinSetAccelTable( vHabmain + ,(HWND)pFrame->GetFrame() + ,hAccel + ); + } M_ACCELDATA->m_hAccel = hAccel; M_ACCELDATA->m_ok = (hAccel != 0); -*/ } -extern int wxCharCodeWXToOS2(int id, bool *isVirtual); +extern int wxCharCodeWXToOS2( + int nId +, bool* pbIsVirtual +); // Create from an array -wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[]) +wxAcceleratorTable::wxAcceleratorTable( + int n +, wxAcceleratorEntry vaEntries[] +) { - m_refData = new wxAcceleratorRefData; + int nAccelLength = ((sizeof(ACCEL) * n) + sizeof(ACCELTABLE)); + PACCELTABLE pArr; + int i; -/* TODO: create table from entries - */ -} + m_refData = new wxAcceleratorRefData; + pArr = (PACCELTABLE) new BYTE[nAccelLength]; + + for (i = 0; i < n; i++) + { + USHORT uVirt = AF_CHAR; + + if (vaEntries[i].GetFlags() & wxACCEL_ALT) + uVirt |= AF_ALT; + if (vaEntries[i].GetFlags() & wxACCEL_SHIFT) + uVirt |= AF_SHIFT; + if (vaEntries[i].GetFlags() & wxACCEL_CTRL) + uVirt |= AF_CONTROL; + + bool bIsVirtual; + USHORT uKey = wxCharCodeWXToOS2( vaEntries[i].GetKeyCode() + ,&bIsVirtual + ); + if (bIsVirtual) + uVirt = AF_CHAR | AF_VIRTUALKEY; + + USHORT uCmd = vaEntries[i].GetCommand(); + + pArr->aaccel[i].fs = uVirt; + pArr->aaccel[i].key = uKey; + pArr->aaccel[i].cmd = uCmd; + } + pArr->codepage = 437; // default to english Fix??? + pArr->cAccel = (USHORT)n; + M_ACCELDATA->m_hAccel = ::WinCreateAccelTable( vHabmain + ,pArr + ); + if (wxTheApp->GetTopWindow() != NULL) + { + // + // If we have accelerators the top window is the frame + // + wxFrame* pFrame = (wxFrame*)wxTheApp->GetTopWindow(); + + ::WinSetAccelTable( vHabmain + ,(HWND)pFrame->GetFrame() + ,M_ACCELDATA->m_hAccel + ); + } + + delete[] pArr; + M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0); +} // end of wxAcceleratorTable::wxAcceleratorTable bool wxAcceleratorTable::Ok() const { - // TODO - return FALSE; -} + return(M_ACCELDATA && (M_ACCELDATA->m_ok)); +} // end of wxAcceleratorTable::Ok void wxAcceleratorTable::SetHACCEL(WXHACCEL hAccel) { @@ -111,14 +181,17 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const return (WXHACCEL) M_ACCELDATA->m_hAccel; } -bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const +bool wxAcceleratorTable::Translate( + WXHWND hWnd +, WXMSG* pWxmsg +) const { - // TODO: -/* - MSG *msg = (MSG *)wxmsg; - - return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); -*/ - return FALSE; -} + PQMSG pMsg = (PQMSG)pWxmsg; + + return Ok() && ::WinTranslateAccel( vHabmain + ,(HWND)hWnd + ,GetHaccel() + ,pMsg + ); +} // end of wxAcceleratorTable::Translate diff --git a/src/os2/app.cpp b/src/os2/app.cpp index 4e41b7077f..4aa19bee52 100644 --- a/src/os2/app.cpp +++ b/src/os2/app.cpp @@ -63,7 +63,6 @@ // --------------------------------------------------------------------------- extern wxChar* wxBuffer; -extern wxChar* wxOsVersion; extern wxList* wxWinHandleList; extern wxList WXDLLEXPORT wxPendingDelete; extern wxCursor* g_globalCursor; @@ -136,10 +135,6 @@ bool wxApp::Initialize( wxClassInfo::InitializeClasses(); -#if wxUSE_RESOURCES - wxGetResource(wxT("wxWindows"), wxT("OsVersion"), &wxOsVersion); -#endif - #if wxUSE_THREADS wxPendingEventsLocker = new wxCriticalSection; #endif @@ -189,7 +184,7 @@ bool wxApp::RegisterWindowClasses( if (!::WinRegisterClass( vHab ,wxFrameClassName ,(PFNWP)wxWndProc - ,CS_SIZEREDRAW | CS_SYNCPAINT + ,CS_SIZEREDRAW | CS_MOVENOTIFY | CS_SYNCPAINT ,sizeof(ULONG) )) { @@ -215,7 +210,7 @@ bool wxApp::RegisterWindowClasses( if (!::WinRegisterClass( vHab ,wxMDIFrameClassName ,(PFNWP)wxWndProc - ,CS_SIZEREDRAW | CS_SYNCPAINT + ,CS_SIZEREDRAW | CS_MOVENOTIFY | CS_SYNCPAINT ,0 )) { @@ -555,7 +550,7 @@ bool wxApp::DoMessage() { BOOL bRc = ::WinGetMsg(vHabmain, &svCurrentMsg, HWND(NULL), 0, 0); - wxUsleep(1000); +// wxUsleep(1000); if (bRc == 0) { // got WM_QUIT @@ -703,8 +698,8 @@ bool wxApp::ProcessMessage( WXMSG* pWxmsg ) { - QMSG* vMsg = (PQMSG)pWxmsg; - HWND hWnd = vMsg->hwnd; + QMSG* pMsg = (PQMSG)pWxmsg; + HWND hWnd = pMsg->hwnd; wxWindow* pWndThis = wxFindWinFromHandle((WXHWND)hWnd); wxWindow* pWnd; @@ -713,7 +708,7 @@ bool wxApp::ProcessMessage( // We must relay WM_MOUSEMOVE events to the tooltip ctrl if we want it to // popup the tooltip bubbles // - if (pWndThis && (vMsg->msg == WM_MOUSEMOVE)) + if (pWndThis && (pMsg->msg == WM_MOUSEMOVE)) { wxToolTip* pToolTip = pWndThis->GetToolTip(); if (pToolTip) @@ -734,6 +729,18 @@ bool wxApp::ProcessMessage( pWndThis = wxFindWinFromHandle((WXHWND)hWnd); } + // + // Try translations first; find the youngest window with + // a translation table. + // +#if 0 + for (pWnd = pWndThis; pWnd; pWnd = pWnd->GetParent() ) + { + if (pMsg->msg == WM_CHAR) + if (pWnd->OS2TranslateMessage(pWxmsg)) + return TRUE; + } +#endif // // Anyone for a non-translation message? Try youngest descendants first. // diff --git a/src/os2/data.cpp b/src/os2/data.cpp index d899b9771a..d588b780f6 100644 --- a/src/os2/data.cpp +++ b/src/os2/data.cpp @@ -36,12 +36,6 @@ wxCursor *g_globalCursor = NULL; // Message Strings for Internationalization char **wx_msg_str = (char**)NULL; -// Custom OS version, as optionally placed in wx.ini/.wxrc -// Currently this can be Win95, Windows, Win32s, WinNT. -// For some systems, you can't tell until run-time what services you -// have. See wxGetOsVersion, which uses this string if present. -char *wxOsVersion = NULL; - int wxPageNumber; // GDI Object Lists diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index 05dbc01904..63a91c8b71 100644 --- a/src/os2/dc.cpp +++ b/src/os2/dc.cpp @@ -42,6 +42,18 @@ static const int VIEWPORT_EXTENT = 1000; static const int MM_POINTS = 9; static const int MM_METRIC = 10; +// usually this is defined in math.h +#ifndef M_PI + static const double M_PI = 3.14159265358979323846; +#endif // M_PI + +// --------------------------------------------------------------------------- +// private functions +// --------------------------------------------------------------------------- + +// convert degrees to radians +static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } + // =========================================================================== // implementation // =========================================================================== @@ -52,17 +64,17 @@ static const int MM_METRIC = 10; wxDC::wxDC(void) { - m_canvas = NULL; + m_pCanvas = NULL; - m_oldBitmap = 0; - m_oldPen = 0; - m_oldBrush = 0; - m_oldFont = 0; - m_oldPalette = 0; + m_hOldBitmap = 0; + m_hOldPen = 0; + m_hOldBrush = 0; + m_hOldFont = 0; + m_hOldPalette = 0; - m_bOwnsDC = FALSE; - m_hDC = 0; - m_hDCCount = 0; + m_bOwnsDC = FALSE; + m_hDC = 0; + m_nDCCount = 0; }; wxDC::~wxDC(void) @@ -77,52 +89,59 @@ void wxDC::SelectOldObjects(WXHDC dc) { if (dc) { - if (m_oldBitmap) + if (m_hOldBitmap) { // ::SelectObject((HDC) dc, (HBITMAP) m_oldBitmap); - if (m_selectedBitmap.Ok()) + if (m_vSelectedBitmap.Ok()) { - m_selectedBitmap.SetSelectedInto(NULL); + m_vSelectedBitmap.SetSelectedInto(NULL); } } - m_oldBitmap = 0; - if (m_oldPen) + m_hOldBitmap = 0; + if (m_hOldPen) { // ::SelectObject((HDC) dc, (HPEN) m_oldPen); } - m_oldPen = 0; - if (m_oldBrush) + m_hOldPen = 0; + if (m_hOldBrush) { // ::SelectObject((HDC) dc, (HBRUSH) m_oldBrush); } - m_oldBrush = 0; - if (m_oldFont) + m_hOldBrush = 0; + if (m_hOldFont) { // ::SelectObject((HDC) dc, (HFONT) m_oldFont); } - m_oldFont = 0; - if (m_oldPalette) + m_hOldFont = 0; + if (m_hOldPalette) { // ::SelectPalette((HDC) dc, (HPALETTE) m_oldPalette, TRUE); } - m_oldPalette = 0; + m_hOldPalette = 0; } - m_brush = wxNullBrush; - m_pen = wxNullPen; - m_palette = wxNullPalette; - m_font = wxNullFont; + m_brush = wxNullBrush; + m_pen = wxNullPen; + m_palette = wxNullPalette; + m_font = wxNullFont; m_backgroundBrush = wxNullBrush; - m_selectedBitmap = wxNullBitmap; + m_vSelectedBitmap = wxNullBitmap; } // --------------------------------------------------------------------------- // clipping // --------------------------------------------------------------------------- -void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region) -{ - // TODO +#define DO_SET_CLIPPING_BOX() \ +{ \ + RECT rect; \ + \ + GetClipBox(GetHdc(), &rect); \ + \ + m_clipX1 = (wxCoord) XDEV2LOG(rect.left); \ + m_clipY1 = (wxCoord) YDEV2LOG(rect.top); \ + m_clipX2 = (wxCoord) XDEV2LOG(rect.right); \ + m_clipY2 = (wxCoord) YDEV2LOG(rect.bottom); \ } void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y @@ -132,14 +151,9 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y // TODO } -void wxDC::DoClipping(WXHDC dc) +void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region) { - if (m_clipping && dc) - { -// TODO: -// IntersectClipRect((HDC) dc, XLOG2DEV(m_clipX1), YLOG2DEV(m_clipY1), -// XLOG2DEV(m_clipX2), YLOG2DEV(m_clipY2)); - } + // TODO } void wxDC::DestroyClippingRegion(void) @@ -213,6 +227,12 @@ void wxDC::DoDrawArc( wxCoord x1, wxCoord y1 // TODO } +void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, + wxCoord width, wxCoord height) +{ + // TODO +} + void wxDC::DoDrawPoint(wxCoord x, wxCoord y) { // TODO @@ -280,6 +300,11 @@ void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y) // TODO } +void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) +{ + // TODO +} + void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) @@ -345,9 +370,39 @@ void wxDC::SetPalette(const wxPalette& palette) // TODO } -void wxDC::SetFont(const wxFont& font) +void wxDC::SetFont( + const wxFont& rFont +) { - // TODO + // + // Set the old object temporarily, in case the assignment deletes an object + // that's not yet selected out. + // + if (m_hOldFont) + { +// ::SelectObject(GetHdc(), (HFONT) m_hOldFont); + m_hOldFont = 0; + } + + m_font = rFont; + + if (!rFont.Ok()) + { + if (m_hOldFont) +// ::SelectObject(GetHdc(), (HFONT) m_hOldFont); + m_hOldFont = 0; + } + + if (m_font.Ok() && m_font.GetResourceHandle()) + { + HFONT hFont = (HFONT)0; //::SelectObject(GetHdc(), (HFONT) m_font.GetResourceHandle()); + if (hFont == (HFONT) NULL) + { + wxLogDebug(wxT("::SelectObject failed in wxDC::SetFont.")); + } + if (!m_hOldFont) + m_hOldFont = (WXHFONT) hFont; + } } void wxDC::SetPen(const wxPen& pen) @@ -496,71 +551,43 @@ void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y ) wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const { - wxCoord new_x = x - m_deviceOriginX; - if (new_x > 0) - return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; - else - return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; -}; + return (wxCoord) (((x) - m_deviceOriginX)/(m_logicalScaleX*m_userScaleX*m_signX*m_scaleX) - m_logicalOriginX); +} wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const { - if (x > 0) - return (wxCoord)((double)(x) / m_scaleX + 0.5); - else - return (wxCoord)((double)(x) / m_scaleX - 0.5); -}; + return (wxCoord) ((x)/(m_logicalScaleX*m_userScaleX*m_signX*m_scaleX)); +} wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const { - wxCoord new_y = y - m_deviceOriginY; - if (new_y > 0) - return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; - else - return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; -}; + return (wxCoord) (((y) - m_deviceOriginY)/(m_logicalScaleY*m_userScaleY*m_signY*m_scaleY) - m_logicalOriginY); +} wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const { - if (y > 0) - return (wxCoord)((double)(y) / m_scaleY + 0.5); - else - return (wxCoord)((double)(y) / m_scaleY - 0.5); -}; + return (wxCoord) ((y)/(m_logicalScaleY*m_userScaleY*m_signY*m_scaleY)); +} wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const { - wxCoord new_x = x - m_logicalOriginX; - if (new_x > 0) - return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; - else - return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; -}; + return (wxCoord) ((x - m_logicalOriginX)*m_logicalScaleX*m_userScaleX*m_signX*m_scaleX + m_deviceOriginX); +} wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const { - if (x > 0) - return (wxCoord)((double)(x) * m_scaleX + 0.5); - else - return (wxCoord)((double)(x) * m_scaleX - 0.5); -}; + return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_signX*m_scaleX); +} wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const { - wxCoord new_y = y - m_logicalOriginY; - if (new_y > 0) - return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; - else - return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; -}; + return (wxCoord) ((y - m_logicalOriginY)*m_logicalScaleY*m_userScaleY*m_signY*m_scaleY + m_deviceOriginY); +} wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const { - if (y > 0) - return (wxCoord)((double)(y) * m_scaleY + 0.5); - else - return (wxCoord)((double)(y) * m_scaleY - 0.5); -}; + return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_signY*m_scaleY); +} // --------------------------------------------------------------------------- // bit blit diff --git a/src/os2/dcclient.cpp b/src/os2/dcclient.cpp index 9fa35aa9d7..cee1da7214 100644 --- a/src/os2/dcclient.cpp +++ b/src/os2/dcclient.cpp @@ -82,14 +82,14 @@ static RECT g_paintStruct; wxWindowDC::wxWindowDC() { - m_canvas = NULL; + m_pCanvas = NULL; } wxWindowDC::wxWindowDC(wxWindow *the_canvas) { - m_canvas = the_canvas; + m_pCanvas = the_canvas; m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(the_canvas) ); - m_hDCCount++; + m_nDCCount++; // // default under PM is that Window and Client DC's are the same // so we offer a separate Presentation Space to use for the @@ -103,12 +103,12 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas) ); ::GpiAssociate(m_hPS, NULLHANDLE); ::GpiAssociate(m_hPS, m_hDC); - SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID)); + SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID)); } wxWindowDC::~wxWindowDC() { - if (m_canvas && m_hDC) + if (m_pCanvas && m_hDC) { SelectOldObjects(m_hDC); @@ -123,7 +123,7 @@ wxWindowDC::~wxWindowDC() m_hDC = NULLHANDLE; } - m_hDCCount--; + m_nDCCount--; } // ---------------------------------------------------------------------------- @@ -132,12 +132,12 @@ wxWindowDC::~wxWindowDC() wxClientDC::wxClientDC() { - m_canvas = NULL; + m_pCanvas = NULL; } wxClientDC::wxClientDC(wxWindow *the_canvas) { - m_canvas = the_canvas; + m_pCanvas = the_canvas; // // default under PM is that Window and Client DC's are the same @@ -147,12 +147,12 @@ wxClientDC::wxClientDC(wxWindow *the_canvas) // // Default mode is BM_LEAVEALONE so we make no call Set the mix // - SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID)); + SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID)); } wxClientDC::~wxClientDC() { - if ( m_canvas && GetHdc() ) + if ( m_pCanvas && GetHdc() ) { SelectOldObjects(m_hDC); @@ -187,7 +187,7 @@ wxArrayDCInfo wxPaintDC::ms_cache; wxPaintDC::wxPaintDC() { - m_canvas = NULL; + m_pCanvas = NULL; m_hDC = 0; } @@ -204,7 +204,7 @@ wxPaintDC::wxPaintDC(wxWindow *canvas) } #endif // __WXDEBUG__ - m_canvas = canvas; + m_pCanvas = canvas; // do we have a DC for this window in the cache? wxPaintDCInfo *info = FindInCache(); @@ -215,10 +215,10 @@ wxPaintDC::wxPaintDC(wxWindow *canvas) } else // not in cache, create a new one { - m_hDC = (WXHDC)::WinBeginPaint(GetWinHwnd(m_canvas), NULLHANDLE, &g_paintStruct); - ms_cache.Add(new wxPaintDCInfo(m_canvas, this)); + m_hDC = (WXHDC)::WinBeginPaint(GetWinHwnd(m_pCanvas), NULLHANDLE, &g_paintStruct); + ms_cache.Add(new wxPaintDCInfo(m_pCanvas, this)); } - SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID)); + SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID)); } wxPaintDC::~wxPaintDC() @@ -252,7 +252,7 @@ wxPaintDCInfo *wxPaintDC::FindInCache(size_t *index) const for ( size_t n = 0; n < nCache; n++ ) { info = &ms_cache[n]; - if ( info->hwnd == m_canvas->GetHWND() ) + if ( info->hwnd == m_pCanvas->GetHWND() ) { if ( index ) *index = n; diff --git a/src/os2/dcmemory.cpp b/src/os2/dcmemory.cpp index 1ab4a99f27..9e6515d0bf 100644 --- a/src/os2/dcmemory.cpp +++ b/src/os2/dcmemory.cpp @@ -77,13 +77,13 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) void wxMemoryDC::DoGetSize( int *width, int *height ) const { - if (!m_selectedBitmap.Ok()) + if (!m_vSelectedBitmap.Ok()) { *width = 0; *height = 0; return; } - *width = m_selectedBitmap.GetWidth(); - *height = m_selectedBitmap.GetHeight(); + *width = m_vSelectedBitmap.GetWidth(); + *height = m_vSelectedBitmap.GetHeight(); }; diff --git a/src/os2/dir.cpp b/src/os2/dir.cpp index 0b66575785..2915cf69b6 100644 --- a/src/os2/dir.cpp +++ b/src/os2/dir.cpp @@ -36,8 +36,6 @@ #ifdef __EMX__ #include <dirent.h> -#else -#include <direct.h> #endif // ---------------------------------------------------------------------------- diff --git a/src/os2/font.cpp b/src/os2/font.cpp index db5ecb184a..b443496b6a 100644 --- a/src/os2/font.cpp +++ b/src/os2/font.cpp @@ -183,6 +183,9 @@ wxFont::~wxFont() // ---------------------------------------------------------------------------- // real implementation +// Boris' Kovalenko comments: +// Because OS/2 fonts are associated with PS we can not create the font +// here, but we may check that font definition is true // ---------------------------------------------------------------------------- bool wxFont::RealizeResource() @@ -196,7 +199,24 @@ bool wxFont::RealizeResource() return TRUE; } - int ff_family = 0; + HPS hps; + FATTRS fAttrs; + FACENAMEDESC fName; + LONG fLid; + + fAttrs.usRecordLength = sizeof(FATTRS); + fAttrs.fsFontUse = FATTR_FONTUSE_OUTLINE | // only outline fonts allowed + FATTR_FONTUSE_TRANSFORMABLE; // may be transformed + fAttrs.fsType = 0; + fAttrs.lMaxBaselineExt = fAttrs.lAveCharWidth = 0; + fAttrs.idRegistry = 0; + fAttrs.lMatch = 0; + + fName.usSize = sizeof(FACENAMEDESC); + fName.usWidthClass = FWIDTH_NORMAL; + fName.usReserved = 0; + fName.flOptions = 0; + wxString ff_face; // OS/2 combines the family with styles to give a facename @@ -204,42 +224,27 @@ bool wxFont::RealizeResource() switch ( M_FONTDATA->m_family ) { case wxSCRIPT: -// ff_family = FF_SCRIPT ; - ff_face = wxT("Script") ; - break ; - case wxDECORATIVE: -// ff_family = FF_DECORATIVE; - break; - case wxROMAN: -// ff_family = FF_ROMAN; ff_face = wxT("Times New Roman") ; break; case wxTELETYPE: case wxMODERN: -// ff_family = FF_MODERN; - ff_face = wxT("Courier New") ; + ff_face = wxT("Courier") ; break; case wxSWISS: -// ff_family = FF_SWISS; - ff_face = wxT("Arial") ; - break; - case wxDEFAULT: default: -// ff_family = FF_SWISS; - ff_face = wxT("Arial") ; + ff_face = wxT("Helvetica") ; } - BYTE ff_italic; switch ( M_FONTDATA->m_style ) { case wxITALIC: case wxSLANT: - ff_italic = 1; + fAttrs.fsSelection = FATTR_SEL_ITALIC; break; default: @@ -247,10 +252,9 @@ bool wxFont::RealizeResource() // fall through case wxNORMAL: - ff_italic = 0; + fAttrs.fsSelection = 0; } - int ff_weight = 0; switch ( M_FONTDATA->m_weight ) { default: @@ -258,68 +262,20 @@ bool wxFont::RealizeResource() // fall through case wxNORMAL: -// ff_weight = FW_NORMAL; + fName.usWeightClass = FWEIGHT_NORMAL; break; case wxLIGHT: -// ff_weight = FW_LIGHT; + fName.usWeightClass = FWEIGHT_LIGHT; break; case wxBOLD: -// ff_weight = FW_BOLD; + fName.usWeightClass = FWEIGHT_BOLD; break; } - - const wxChar* pzFace; - if ( M_FONTDATA->m_faceName.IsEmpty() ) - pzFace = ff_face; - else - pzFace = M_FONTDATA->m_faceName ; - -#if 0 - /* Always calculate fonts using the screen DC (is this the best strategy?) - * There may be confusion if a font is selected into a printer - * DC (say), because the height will be calculated very differently. - */ - // What sort of display is it? - int technology = ::GetDeviceCaps(dc, TECHNOLOGY); - - int nHeight; - - if (technology != DT_RASDISPLAY && technology != DT_RASPRINTER) - { - // Have to get screen DC Caps, because a metafile will return 0. - HDC dc2 = ::GetDC(NULL); - nHeight = M_FONTDATA->m_pointSize*GetDeviceCaps(dc2, LOGPIXELSY)/72; - ::ReleaseDC(NULL, dc2); - } - else - { - nHeight = M_FONTDATA->m_pointSize*GetDeviceCaps(dc, LOGPIXELSY)/72; - } -#endif // 0 - -#if 0 - // Have to get screen DC Caps, because a metafile will return 0. - HDC dc2 = ::GetDC(NULL); - ppInch = ::GetDeviceCaps(dc2, LOGPIXELSY); - ::ReleaseDC(NULL, dc2); -#endif // 0 - - // New behaviour: apparently ppInch varies according to Large/Small Fonts - // setting in Windows. This messes up fonts. So, set ppInch to a constant - // 96 dpi. - static const int ppInch = 96; - -#if wxFONT_SIZE_COMPATIBILITY - // Incorrect, but compatible with old wxWindows behaviour - int nHeight = (M_FONTDATA->m_pointSize*ppInch/72); -#else - // Correct for Windows compatibility - int nHeight = - (M_FONTDATA->m_pointSize*ppInch/72); -#endif - - BYTE ff_underline = M_FONTDATA->m_underlined; + + if( M_FONTDATA->m_underlined ) + fAttrs.fsSelection |= FATTR_SEL_UNDERSCORE; wxFontEncoding encoding = M_FONTDATA->m_encoding; if ( encoding == wxFONTENCODING_DEFAULT ) @@ -327,52 +283,51 @@ bool wxFont::RealizeResource() encoding = wxFont::GetDefaultEncoding(); } - DWORD charset; switch ( encoding ) { case wxFONTENCODING_ISO8859_1: case wxFONTENCODING_ISO8859_15: case wxFONTENCODING_CP1250: -// charset = ANSI_CHARSET; + fAttrs.usCodePage = 1250; break; case wxFONTENCODING_ISO8859_2: case wxFONTENCODING_CP1252: -// charset = EASTEUROPE_CHARSET; + fAttrs.usCodePage = 1252; break; case wxFONTENCODING_ISO8859_4: case wxFONTENCODING_ISO8859_10: -// charset = BALTIC_CHARSET; + fAttrs.usCodePage = 850; // what is baltic? break; case wxFONTENCODING_ISO8859_5: case wxFONTENCODING_CP1251: -// charset = RUSSIAN_CHARSET; + fAttrs.usCodePage = 1251; break; case wxFONTENCODING_ISO8859_6: -// charset = ARABIC_CHARSET; + fAttrs.usCodePage = 850; // what is arabic? break; case wxFONTENCODING_ISO8859_7: -// charset = GREEK_CHARSET; + fAttrs.usCodePage = 850; // what is greek break; case wxFONTENCODING_ISO8859_8: -// charset = HEBREW_CHARSET; + fAttrs.usCodePage = 850; // what is hebrew? break; case wxFONTENCODING_ISO8859_9: -// charset = TURKISH_CHARSET; + fAttrs.usCodePage = 857; break; case wxFONTENCODING_ISO8859_11: -// charset = THAI_CHARSET; + fAttrs.usCodePage = 850; // what is thai break; case wxFONTENCODING_CP437: -// charset = OEM_CHARSET; + fAttrs.usCodePage = 437; break; default: @@ -380,32 +335,58 @@ bool wxFont::RealizeResource() // fall through case wxFONTENCODING_SYSTEM: -// charset = ANSI_CHARSET; + fAttrs.usCodePage = 850; // what is ANSI? break; } -// TODO: -WXHFONT hFont = 0; -// HFONT hFont = ::CreateFont -// ( -// nHeight, // height -// 0, // width (choose best) -// 0, // escapement -// 0, // orientation -// ff_weight, // weight -// ff_italic, // italic? -// ff_underline, // underlined? -// 0, // strikeout? -// charset, // charset -// OUT_DEFAULT_PRECIS, // precision -// CLIP_DEFAULT_PRECIS, // clip precision -// PROOF_QUALITY, // quality of match -// DEFAULT_PITCH | // fixed or variable -// ff_family, // family id -// pzFace // face name -// ); - - M_FONTDATA->m_hFont = (WXHFONT)hFont; +// Now cheking + fLid = 1; + hps = ::WinGetPS( HWND_DESKTOP ); + + long numLids = ::GpiQueryNumberSetIds( hps ); + long gpiError; + + // First we should generate unique id + if( numLids ) + { + long Types[255]; + STR8 Names[255]; + long lIds[255]; + + if( !GpiQuerySetIds(hps, numLids, Types, Names, lIds) ) + { + ::WinReleasePS( hps ); + return 0; + } + + for(unsigned long LCNum = 0; LCNum < numLids; LCNum++) + if(lIds[LCNum] == fLid) + ++fLid; + if(fLid > 254) // wow, no id available! + { + ::WinReleasePS( hps ); + return 0; + } + } + + // now building facestring + if(::GpiQueryFaceString(hps, ff_face.c_str(), &fName, FACESIZE, fAttrs.szFacename) == GPI_ERROR) + { + ::WinReleasePS( hps ); + return 0; + } + + // now creating font + WXHFONT hFont = (WXHFONT)0; + + if(::GpiCreateLogFont(hps, NULL, fLid, &fAttrs) != GPI_ERROR) + M_FONTDATA->m_hFont = hFont = (WXHFONT)1; + + if( hFont ) + ::GpiDeleteSetId(hps, fLid); + + ::WinReleasePS( hps ); + if ( !hFont ) { wxLogLastError("CreateFont"); diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 31ce6652e5..f3faceb427 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -485,17 +485,63 @@ wxStatusBar* wxFrame::OnCreateStatusBar( ) { wxStatusBar* pStatusBar = NULL; + SWP vSwp; + ERRORID vError; + wxString sError; + HWND hWnd; pStatusBar = wxFrameBase::OnCreateStatusBar( nNumber ,lulStyle ,vId ,rName ); + // + // The default parent set for the Statusbar is m_hWnd which, of course, + // is the handle to the client window of the frame. We don't want that, + // so we have to set the parent to actually be the Frame. + // + hWnd = pStatusBar->GetHWND(); + if (!::WinSetParent(hWnd, m_hFrame, FALSE)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for statusbar. Error: %s\n", sError); + return NULL; + } + + // + // Also we need to reset it positioning to enable the SHOW attribute + // + if (!::WinQueryWindowPos((HWND)pStatusBar->GetHWND(), &vSwp)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error querying frame for statusbar position. Error: %s\n", sError); + return NULL; + } + if (!::WinSetWindowPos( (HWND)pStatusBar->GetHWND() + ,HWND_TOP + ,vSwp.cx + ,vSwp.cy + ,vSwp.x + ,vSwp.y + ,SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER + )) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting statusbar position. Error: %s\n", sError); + return NULL; + } return pStatusBar; } // end of wxFrame::OnCreateStatusBar void wxFrame::PositionStatusBar() { + SWP vSwp; + ERRORID vError; + wxString sError; + // // Native status bar positions itself // @@ -525,6 +571,27 @@ void wxFrame::PositionStatusBar() ,nWidth ,nStatbarHeight ); + if (!::WinQueryWindowPos(m_frameStatusBar->GetHWND(), &vSwp)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for submenu. Error: %s\n", sError); + return; + } + if (!::WinSetWindowPos( m_frameStatusBar->GetHWND() + ,HWND_TOP + ,nStatbarWidth + ,nStatbarHeight + ,vSwp.x + ,vSwp.y + ,SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER + )) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for submenu. Error: %s\n", sError); + return; + } } } // end of wxFrame::PositionStatusBar #endif // wxUSE_STATUSBAR @@ -817,7 +884,7 @@ bool wxFrame::OS2Create( if (ulStyle == wxDEFAULT_FRAME_STYLE) ulCreateFlags = FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU | - FCF_MINMAX | FCF_VERTSCROLL | FCF_HORZSCROLL | FCF_TASKLIST; + FCF_MINMAX | FCF_TASKLIST; else { if ((ulStyle & wxCAPTION) == wxCAPTION) @@ -825,6 +892,10 @@ bool wxFrame::OS2Create( else ulCreateFlags = FCF_NOMOVEWITHOWNER; + if ((ulStyle & wxVSCROLL) == wxVSCROLL) + ulCreateFlags |= FCF_VERTSCROLL; + if ((ulStyle & wxHSCROLL) == wxHSCROLL) + ulCreateFlags |= FCF_HORZSCROLL; if (ulStyle & wxMINIMIZE_BOX) ulCreateFlags |= FCF_MINBUTTON; if (ulStyle & wxMAXIMIZE_BOX) @@ -884,7 +955,7 @@ bool wxFrame::OS2Create( ,HWND_TOP // Sibling ,(ULONG)nId // ID ,(PVOID)&vFrameCtlData // Creation data - ,NULL // Window Pres Params + ,NULL // Window Pres Params )) == 0L) { return FALSE; @@ -917,7 +988,7 @@ bool wxFrame::OS2Create( ,nY ,nWidth ,nHeight - ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE + ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE | SWP_ZORDER )) return FALSE; @@ -1129,8 +1200,6 @@ bool wxFrame::OS2TranslateMessage( WXMSG* pMsg ) { - if (wxWindow::OS2TranslateMessage(pMsg)) - return TRUE; // // try the menu bar accels // @@ -1140,7 +1209,7 @@ bool wxFrame::OS2TranslateMessage( return FALSE; const wxAcceleratorTable& rAcceleratorTable = pMenuBar->GetAccelTable(); - return rAcceleratorTable.Translate(this, pMsg); + return rAcceleratorTable.Translate(m_hFrame, pMsg); } // end of wxFrame::OS2TranslateMessage // --------------------------------------------------------------------------- @@ -1195,6 +1264,13 @@ bool wxFrame::HandlePaint() } else { + HPS hPS; + RECTL vRect; + + hPS = WinBeginPaint(GetHwnd(), 0L, &vRect); + WinFillRect(hPS, &vRect, SYSCLR_WINDOW); + WinEndPaint(hPS); + return wxWindow::HandlePaint(); } } diff --git a/src/os2/gdiimage.cpp b/src/os2/gdiimage.cpp index d4357d6331..321e61e1c1 100644 --- a/src/os2/gdiimage.cpp +++ b/src/os2/gdiimage.cpp @@ -335,7 +335,9 @@ void wxGDIImage::CleanUpHandlers() wxNode* pNext = pNode->Next(); delete pHandler; +#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) delete pNode; +#endif pNode = pNext; } } diff --git a/src/os2/makefile.va b/src/os2/makefile.va index bbe82e3a5e..720dd9e935 100644 --- a/src/os2/makefile.va +++ b/src/os2/makefile.va @@ -989,20 +989,16 @@ $(WXDIR)\lib\wx.lib: \ !else -# Update the import library -$(WXDIR)\lib\wx214.lib: $(OBJECTS) - implib $(WXDIR)\lib\wx214.lib $(WXDIR)\lib\wx214.def - # Update the dynamic link library -$(WXDIR)\lib\wx214.dll: $(OBJECTS) +$(WXDIR)\lib\wx22.dll: $(OBJECTS) icc @<< /B" $(LINKFLAGS)" /Fe$@ $(LIBS) $(DUMMYOBJ) $(OBJECTS) - $(WXDIR)\lib\wx214.def + $(WXDIR)\lib\wx22.def << - implib $(WXDIR)\lib\wx214.lib $(WXDIR)\lib\wx214.def + implib $(WXDIR)\lib\wx22.lib $(WXDIR)\lib\wx22.def !endif @@ -1098,7 +1094,7 @@ clean: $(PERIPH_CLEAN_TARGET) clean_png clean_zlib clean_jpeg clean_xpm clean_t rd ..\os2\$D del $(LIBTARGET) !if "$(WXMAKINGDLL)" == "1" - erase /N ..\..\lib\wx214.lib + erase /N ..\..\lib\wx22.lib !endif cleanall: clean diff --git a/src/os2/mdi.cpp b/src/os2/mdi.cpp index b0142bab68..2c36bb8c0d 100644 --- a/src/os2/mdi.cpp +++ b/src/os2/mdi.cpp @@ -996,7 +996,7 @@ MRESULT wxMDIChildFrame::OS2DefWindowProc(WXUINT message, WXWPARAM wParam, WXLPA bool wxMDIChildFrame::OS2TranslateMessage(WXMSG* msg) { - return m_acceleratorTable.Translate(GetParent(), msg); + return m_acceleratorTable.Translate(GetParent()->GetHWND(), msg); } // --------------------------------------------------------------------------- diff --git a/src/os2/menu.cpp b/src/os2/menu.cpp index 24f4846a87..78293daafa 100644 --- a/src/os2/menu.cpp +++ b/src/os2/menu.cpp @@ -49,6 +49,15 @@ extern wxMenu* wxCurrentPopupMenu; // static const int idMenuTitle = -2; +// +// The unique ID for Menus +// +#ifdef __VISAGECPP__ +USHORT wxMenu::m_nextMenuId = 0; +#else +static USHORT wxMenu::m_nextMenuId = 0; +#endif + // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -73,7 +82,7 @@ static wxString TextToLabel(const wxString& rTitle) pc++; Title << wxT('&'); } - else + else Title << wxT('~'); } // else if (*pc == wxT('/')) @@ -113,7 +122,7 @@ void wxMenu::Init() // Create the menu (to be used as a submenu or a popup) // if ((m_hMenu = ::WinCreateWindow( HWND_DESKTOP - ,(const wxChar*)WC_MENU + ,WC_MENU ,"Menu" ,0L ,0L @@ -132,7 +141,7 @@ void wxMenu::Init() m_vMenuData.iPosition = 0; m_vMenuData.afStyle = MIS_SUBMENU | MIS_TEXT; m_vMenuData.afAttribute = (USHORT)0; - m_vMenuData.id = (USHORT)0; + m_vMenuData.id = m_nextMenuId++; m_vMenuData.hwndSubMenu = m_hMenu; m_vMenuData.hItem = NULLHANDLE; @@ -169,7 +178,9 @@ wxMenu::~wxMenu() // // Delete accels // +#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) WX_CLEAR_ARRAY(m_vAccels); +#endif #endif // wxUSE_ACCEL } // end of wxMenu::~wxMenu @@ -254,13 +265,24 @@ bool wxMenu::DoInsertOrAppend( { ERRORID vError; wxString sError; - MENUITEM vItem; - #if wxUSE_ACCEL UpdateAccel(pItem); #endif // wxUSE_ACCEL - memset(&vItem, '\0', sizeof(vItem)); + // + // rItem is the member MENUITEM for the menu items and the submenu's + // MENUITEM for submenus as required by ::MM_INSERTITEM message API + // + + wxMenu* pSubmenu = pItem->GetSubMenu(); + MENUITEM &rItem = (pSubmenu != NULL)?pSubmenu->m_vMenuData: + pItem->m_vMenuData; + if(pSubmenu != NULL) + { + wxASSERT_MSG(pSubmenu->GetHMenu(), wxT("invalid submenu")); + pSubmenu->SetParent(this); + rItem.afStyle |= MIS_SUBMENU | MIS_TEXT; + } // // If "Break" has just been called, insert a menu break before this item @@ -268,16 +290,10 @@ bool wxMenu::DoInsertOrAppend( // if (m_bDoBreak) { - vItem.afStyle |= MIS_BREAK; + rItem.afStyle |= MIS_BREAK; m_bDoBreak = FALSE; } - // - // Menu items that are being inserted into a submenu MUST have a - // MENUITEM structure separate from the parent menu so we must use - // a local vItem not the object's m_vMenuItem as that is the MENUITEM - // associated with the parent submenu. - // if (pItem->IsSeparator()) { vItem.afStyle |= MIS_SEPARATOR; @@ -314,7 +330,7 @@ bool wxMenu::DoInsertOrAppend( // item draws itself, pass pointer to it in data parameter // Will eventually need to set the image handle somewhere into vItem.hItem // - vItem.afStyle |= MIS_OWNERDRAW; + rItem.afStyle |= MIS_OWNERDRAW; pData = (BYTE*)pItem; // vItem.hItem = ???? } @@ -328,24 +344,22 @@ bool wxMenu::DoInsertOrAppend( pData = (char*)pItem->GetText().c_str(); } - APIRET rc; - - if (pSubmenu == NULL) + if (nPos == (size_t)-1) { - // - // -1 means append at end - // - if (nPos == (size_t)-1) - { - vItem.iPosition = MIT_END; - } - else - { - vItem.iPosition = nPos; - } + rItem.iPosition = MIT_END; + } + else + { + rItem.iPosition = nPos; } - rc = (APIRET)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&vItem, (MPARAM)pData); + APIRET rc; + + rc = (APIRET)::WinSendMsg( GetHmenu() + ,MM_INSERTITEM + ,(MPARAM)&rItem + ,(MPARAM)pData + ); if (rc == MIT_MEMERROR || rc == MIT_ERROR) { vError = ::WinGetLastError(vHabmain); @@ -665,7 +679,6 @@ WXHMENU wxMenuBar::Create() { MENUITEM vItem; HWND hFrame; - HWND hMenuBar = NULLHANDLE; if (m_hMenu != 0 ) return m_hMenu; @@ -682,39 +695,39 @@ WXHMENU wxMenuBar::Create() // // Create an empty menu and then fill it with insertions // - if (!wxWindow::OS2Create( hFrame - ,WC_MENU - ,"Menu" - ,MS_ACTIONBAR | WS_SYNCPAINT | WS_VISIBLE - ,0L - ,0L - ,0L - ,0L - ,hFrame - ,HWND_TOP - ,FID_MENU - ,(PVOID)NULL - ,(PVOID)NULL - )) + if ((m_hMenu = ::WinCreateWindow( hFrame + ,WC_MENU + ,(PSZ)NULL + ,MS_ACTIONBAR | WS_SYNCPAINT | WS_VISIBLE + ,0L + ,0L + ,0L + ,0L + ,hFrame + ,HWND_TOP + ,FID_MENU + ,NULL + ,NULL + )) == 0) { - wxLogLastError("CreateMenu"); + wxLogLastError("WinLoadMenu"); } else { size_t nCount = GetMenuCount(); - hMenuBar = GetHwnd(); for (size_t i = 0; i < nCount; i++) { APIRET rc; ERRORID vError; wxString sError; - MENUITEM vItem; + HWND hSubMenu; // // Set the parent and owner of the submenues to be the menubar, not the desktop // - if (!::WinSetParent(m_menus[i]->m_vMenuData.hwndSubMenu, hMenuBar, FALSE)) + hSubMenu = m_menus[i]->m_vMenuData.hwndSubMenu; + if (!::WinSetParent(m_menus[i]->m_vMenuData.hwndSubMenu, m_hMenu, FALSE)) { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); @@ -722,7 +735,7 @@ WXHMENU wxMenuBar::Create() return NULLHANDLE; } - if (!::WinSetOwner(m_menus[i]->m_vMenuData.hwndSubMenu, hMenuBar)) + if (!::WinSetOwner(m_menus[i]->m_vMenuData.hwndSubMenu, m_hMenu)) { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); @@ -732,7 +745,7 @@ WXHMENU wxMenuBar::Create() m_menus[i]->m_vMenuData.iPosition = i; - rc = (APIRET)::WinSendMsg(hMenuBar, MM_INSERTITEM, (MPARAM)&m_menus[i]->m_vMenuData, (MPARAM)m_titles[i].c_str()); + rc = (APIRET)::WinSendMsg(m_hMenu, MM_INSERTITEM, (MPARAM)&m_menus[i]->m_vMenuData, (MPARAM)m_titles[i].c_str()); if (rc == MIT_MEMERROR || rc == MIT_ERROR) { vError = ::WinGetLastError(vHabmain); @@ -742,7 +755,7 @@ WXHMENU wxMenuBar::Create() } } } - return hMenuBar; + return m_hMenu; } // end of wxMenuBar::Create // --------------------------------------------------------------------------- @@ -771,7 +784,7 @@ void wxMenuBar::EnableTop( wxLogLastError("LogLastError"); return; } - ::WinSendMsg((HWND)m_hMenu, MM_SETITEMATTR, MPFROM2SHORT(nId, TRUE), MPFROM2SHORT(uFlag, uFlag)); + ::WinSendMsg((HWND)m_hMenu, MM_SETITEMATTR, MPFROM2SHORT(nId, TRUE), MPFROM2SHORT(MIA_DISABLED, uFlag)); Refresh(); } // end of wxMenuBar::EnableTop @@ -852,7 +865,7 @@ wxMenu* wxMenuBar::Replace( m_titles[nPos] = Title; if (IsAttached()) { - ::WinSendMsg((HWND)m_hMenu, MM_DELETEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0); + ::WinSendMsg((HWND)m_hMenu, MM_REMOVEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0); ::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)Title.c_str()); #if wxUSE_ACCEL @@ -955,7 +968,7 @@ wxMenu* wxMenuBar::Remove( } if (IsAttached()) { - ::WinSendMsg((HWND)GetHmenu(), MM_DELETEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0); + ::WinSendMsg((HWND)GetHmenu(), MM_REMOVEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0); pMenu->Detach(); #if wxUSE_ACCEL @@ -1016,6 +1029,14 @@ void wxMenuBar::Attach( #if wxUSE_ACCEL RebuildAccelTable(); + // + // Ensure the accelerator table is set to the frame (not the client!) + // + if (!::WinSetAccelTable( vHabmain + ,(HWND)pFrame->GetFrame() + ,m_vAccelTable.GetHACCEL() + )) + wxLogLastError("WinSetAccelTable"); #endif // wxUSE_ACCEL } // end of wxMenuBar::Attach diff --git a/src/os2/menuitem.cpp b/src/os2/menuitem.cpp index af97aab35a..1d960c605b 100644 --- a/src/os2/menuitem.cpp +++ b/src/os2/menuitem.cpp @@ -155,6 +155,8 @@ wxMenuItem::wxMenuItem( m_text = TextToLabel(rText); m_isCheckable = bCheckable; m_help = rStrHelp; + memset(&m_vMenuData, '\0', sizeof(m_vMenuData)); + m_vMenuData.id= nId; } // end of wxMenuItem::wxMenuItem wxMenuItem::~wxMenuItem() @@ -233,13 +235,13 @@ void wxMenuItem::Enable( bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu) ,MM_SETITEMATTR ,MPFROM2SHORT(GetRealId(), TRUE) - ,MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED) + ,MPFROM2SHORT(MIA_DISABLED, FALSE) ); else bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu) ,MM_SETITEMATTR ,MPFROM2SHORT(GetRealId(), TRUE) - ,MPFROM2SHORT(MIA_DISABLED, FALSE) + ,MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED) ); if (!bOk) { @@ -271,7 +273,7 @@ void wxMenuItem::Check( ); if (!bOk) { - wxLogLastError("EnableMenuItem"); + wxLogLastError("CheckMenuItem"); } wxMenuItemBase::Check(bCheck); } // end of wxMenuItem::Check diff --git a/src/os2/metafile.cpp b/src/os2/metafile.cpp index 4cd1db8306..bb9fa9719d 100644 --- a/src/os2/metafile.cpp +++ b/src/os2/metafile.cpp @@ -269,8 +269,8 @@ void wxMetafileDC::SetMapMode(int mode) break; } } - m_windowExtX = 100; - m_windowExtY = 100; + m_nWindowExtX = 100; + m_nWindowExtY = 100; } #ifdef __WIN32__ diff --git a/src/os2/msgdlg.cpp b/src/os2/msgdlg.cpp index e1cf166e2a..8aaa2313cc 100644 --- a/src/os2/msgdlg.cpp +++ b/src/os2/msgdlg.cpp @@ -21,6 +21,7 @@ #include "wx/defs.h" #include "wx/utils.h" #include "wx/dialog.h" +#include "wx/app.h" #include "wx/msgdlg.h" #endif @@ -35,18 +36,105 @@ IMPLEMENT_CLASS(wxMessageDialog, wxDialog) -wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption, - long style, const wxPoint& pos) +wxMessageDialog::wxMessageDialog( + wxWindow* pParent +, const wxString& rsMessage +, const wxString& rsCaption +, long lStyle +, const wxPoint& pPos +) { - m_caption = caption; - m_message = message; - m_dialogStyle = style; - m_parent = parent; -} + m_sCaption = rsCaption; + m_sMessage = rsMessage; + m_lDialogStyle = lStyle; + m_pParent = NULL; // pParent; +} // end of wxMessageDialog::wxMessageDialog int wxMessageDialog::ShowModal() { - // TODO - return wxID_CANCEL; -} + HWND hWnd = 0; + ULONG ulStyle = MB_OK; + int nAns = wxOK; + + if (!wxTheApp->GetTopWindow()) + { + // + // when the message box is shown from wxApp::OnInit() (i.e. before the + // message loop is entered), this must be done or the next message box + // will never be shown - just try putting 2 calls to wxMessageBox() in + // OnInit() to see it + // + while (wxTheApp->Pending()) + wxTheApp->Dispatch(); + } + + if (m_pParent) + hWnd = (HWND) m_pParent->GetHWND(); + else + hWnd = HWND_DESKTOP; + if (m_lDialogStyle & wxYES_NO) + { + if (m_lDialogStyle & wxCANCEL) + ulStyle = MB_YESNOCANCEL; + else + ulStyle = MB_YESNO; + + if (m_lDialogStyle & wxNO_DEFAULT) + ulStyle |= MB_DEFBUTTON2; + } + + if (m_lDialogStyle & wxOK) + { + if (m_lDialogStyle & wxCANCEL) + ulStyle = MB_OKCANCEL; + else + ulStyle = MB_OK; + } + if (m_lDialogStyle & wxICON_EXCLAMATION) + ulStyle |= MB_ICONEXCLAMATION; + else if (m_lDialogStyle & wxICON_HAND) + ulStyle |= MB_ICONHAND; + else if (m_lDialogStyle & wxICON_INFORMATION) + ulStyle |= MB_ICONEXCLAMATION; + else if (m_lDialogStyle & wxICON_QUESTION) + ulStyle |= MB_ICONQUESTION; + + if (hWnd != HWND_DESKTOP) + ulStyle |= MB_APPLMODAL; + else + ulStyle |= MB_SYSTEMMODAL; + + // + // This little line of code is get message boxes under OS/2 to + // behve like the other ports. In OS/2 if the parent is a window + // it displays, clipped, in the window. This centers it on the + // desktop, like the other ports but still allows control over modality + // + hWnd = HWND_DESKTOP; + + ULONG ulAns = ::WinMessageBox( hWnd + ,hWnd + ,(PSZ)m_sMessage.c_str() + ,(PSZ)m_sCaption.c_str() + ,0L + ,ulStyle); + switch (ulAns) + { + case MBID_CANCEL: + nAns = wxID_CANCEL; + break; + case MBID_OK: + nAns = wxID_OK; + break; + case MBID_YES: + nAns = wxID_YES; + break; + case MBID_NO: + nAns = wxID_NO; + break; + default: + nAns = wxID_CANCEL; + } + return nAns; +} // end of wxMessageDialog::ShowModal diff --git a/src/os2/thread.cpp b/src/os2/thread.cpp index ac5b0d56ca..94de24c7cd 100644 --- a/src/os2/thread.cpp +++ b/src/os2/thread.cpp @@ -746,11 +746,15 @@ void wxThreadModule::OnExit() if (gs_pCritsectGui) { gs_pCritsectGui->Leave(); +#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) delete gs_pCritsectGui; +#endif gs_pCritsectGui = NULL; } +#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) wxDELETE(gs_pCritsectWaitingForGui); +#endif } // ---------------------------------------------------------------------------- diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index 31b8f70da6..9bfe35f46f 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -26,8 +26,6 @@ #include <ctype.h> #ifdef __EMX__ #include <dirent.h> -#else -#include <direct.h> #endif #include "wx/log.h" diff --git a/src/os2/utilsexc.cpp b/src/os2/utilsexc.cpp index 92187d9b61..f9f3885e16 100644 --- a/src/os2/utilsexc.cpp +++ b/src/os2/utilsexc.cpp @@ -35,8 +35,6 @@ #include <ctype.h> #ifdef __EMX__ #include <dirent.h> -#else -#include <direct.h> #endif #include <sys/stat.h> diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 6073949ccb..75900f1d95 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -1699,7 +1699,7 @@ bool wxWindow::OS2TranslateMessage( WXMSG* pMsg ) { - return m_acceleratorTable.Translate(this, pMsg); + return m_acceleratorTable.Translate(m_hWnd, pMsg); } // end of wxWindow::OS2TranslateMessage // --------------------------------------------------------------------------- @@ -1813,7 +1813,7 @@ MRESULT EXPENTRY wxWndProc( { if (pWnd) rc = pWnd->OS2WindowProc(ulMsg, wParam, lParam); - else + if (!rc) rc = ::WinDefWindowProc(hWnd, ulMsg, wParam, lParam); } return rc; @@ -1954,7 +1954,6 @@ MRESULT wxWindow::OS2WindowProc( bProcessed = HandleMouseEvent(uMsg, x, y, (WXUINT)wParam); } break; - case WM_SYSCOMMAND: bProcessed = HandleSysCommand(wParam, lParam); break; @@ -2154,7 +2153,7 @@ MRESULT wxWindow::OS2WindowProc( // wxFrame specific message case WM_MINMAXFRAME: - bProcessed = HandleGetMinMaxInfo((PSWP)lParam); + bProcessed = HandleGetMinMaxInfo((PSWP)wParam); break; case WM_SYSVALUECHANGED: @@ -2395,6 +2394,7 @@ bool wxWindow::OS2Create( wxLogError("Can't create window of class %s!. Error: %s\n", zClass, sError); return FALSE; } + ::WinSetWindowULong(m_hWnd, QWL_USER, (ULONG) this); wxWndHook = NULL; #ifdef __WXDEBUG__ diff --git a/src/png/png.dsp b/src/png/PngVC.dsp similarity index 92% rename from src/png/png.dsp rename to src/png/PngVC.dsp index dfa963dfdf..6c43ab7b18 100644 --- a/src/png/png.dsp +++ b/src/png/PngVC.dsp @@ -8,12 +8,12 @@ CFG=png - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE -!MESSAGE NMAKE /f "png.mak". +!MESSAGE NMAKE /f "PngVC.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "png.mak" CFG="png - Win32 Debug" +!MESSAGE NMAKE /f "PngVC.mak" CFG="png - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /YX /FD /GZ /c # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe diff --git a/src/tiff/tiff.dsw b/src/png/PngVC.dsw similarity index 90% rename from src/tiff/tiff.dsw rename to src/png/PngVC.dsw index 95529cb365..58c98b69e6 100644 --- a/src/tiff/tiff.dsw +++ b/src/png/PngVC.dsw @@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### -Project: "tiff"=.\tiff.dsp - Package Owner=<4> +Project: "png"=.\PngVC.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/src/stc/Makefile.in b/src/stc/Makefile.in index b1f75c4945..73170e98e2 100644 --- a/src/stc/Makefile.in +++ b/src/stc/Makefile.in @@ -5,12 +5,11 @@ # Version: $Id$ ############################################################################### -top_srcdir = @top_srcdir@ +top_srcdir = @top_srcdir@/.. top_builddir = ../../.. -this_dir = $(top_srcdir)/src/stc -scintilla_dir=$(this_dir)/scintilla -VPATH=$(this_dir)@PATH_IFS@$(scintilla_dir)/src # ':' for autoconf +scintilla_dir = $(top_srcdir)/contrib/src/stc/scintilla +libsrc_dir = contrib/src/stc@PATH_IFS@$(scintilla_dir)/src TARGET_LIBNAME=libstc @@ -18,23 +17,38 @@ LIBVERSION_CURRENT=1 LIBVERSION_REVISION=0 LIBVERSION_AGE=0 +HEADER_PATH=$(top_srcdir)/contrib/include/wx +HEADER_SUBDIR=stc + +HEADERS=stc.h + OBJECTS=PlatWX.o ScintillaWX.o stc.o \ - Accessor.o \ - AutoComplete.o \ + DocumentAccessor.o \ + LexCPP.o \ + LexHTML.o \ + LexOthers.o \ + LexPerl.o \ + LexPython.o \ + LexSQL.o \ + LexVB.o \ + UniConversion.o \ + WindowAccessor.o \ + AutoComplete.o \ CallTip.o \ - CellBuffer.o \ - ContractionState.o \ + CellBuffer.o \ + ContractionState.o \ Document.o \ - Editor.o \ + Editor.o \ Indicator.o \ - KeyMap.o \ + KeyMap.o \ KeyWords.o \ - LineMarker.o \ + LineMarker.o \ PropSet.o \ - ScintillaBase.o \ + ScintillaBase.o \ Style.o \ - ViewStyle.o - -APPEXTRADEFS=-D__WX__ -DSCI_LEXER -I$(scintilla_dir)/src -I$(scintilla_dir)/include -I$(top_srcdir)/include -I$(top_srcdir)/../include + ViewStyle.o \ + + +APPEXTRADEFS=-D__WX__ -DSCI_LEXER -I$(scintilla_dir)/src -I$(scintilla_dir)/include -I$(top_srcdir)/contrib/include include $(top_builddir)/src/makelib.env diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 0dbd3d5ea7..5045e6d506 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -4,12 +4,13 @@ // Robin Dunn <robin@aldunn.com> // The License.txt file describes the conditions under which this software may be distributed. +#include <ctype.h> #include "Platform.h" #include "wx/stc/stc.h" Point Point::FromLong(long lpoint) { - return Point(lpoint & 0xFFFF, lpoint >> 32); + return Point(lpoint & 0xFFFF, lpoint >> 16); } wxRect wxRectFromPRectangle(PRectangle prc) { @@ -105,14 +106,15 @@ Font::Font() { Font::~Font() { } -void Font::Create(const char *faceName, int size, bool bold, bool italic) { +void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) { Release(); id = new wxFont(size, wxDEFAULT, italic ? wxITALIC : wxNORMAL, bold ? wxBOLD : wxNORMAL, false, - faceName); + faceName, + wxFONTENCODING_DEFAULT); } @@ -167,7 +169,7 @@ void Surface::InitPixMap(int width, int height, Surface *surface_) { Release(); hdc = new wxMemoryDC(surface_->hdc); hdcOwned = true; - bitmap = new wxBitmap(width, height); + bitmap = new wxBitmap(width, height+1); ((wxMemoryDC*)hdc)->SelectObject(*bitmap); // **** ::SetTextAlign(hdc, TA_BASELINE); } @@ -181,13 +183,26 @@ void Surface::BrushColor(Colour back) { } void Surface::SetFont(Font &font_) { - hdc->SetFont(*font_.GetID()); + + // I think the following check is valid. + // It eliminates a crash for me. -- eric@sourcegear.com + + if (font_.GetID()) + { + hdc->SetFont(*font_.GetID()); + } } int Surface::LogPixelsY() { return hdc->GetPPI().y; } + +int Surface::DeviceHeightFont(int points) { + return points * LogPixelsY() / 72; +} + + void Surface::MoveTo(int x_, int y_) { x = x_; y = y_; @@ -232,7 +247,7 @@ void Surface::FillRectangle(PRectangle rc, Surface &surfacePattern) { void Surface::RoundedRectangle(PRectangle rc, Colour fore, Colour back) { PenColour(fore); BrushColor(back); - hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 8); + hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4); } void Surface::Ellipse(PRectangle rc, Colour fore, Colour back) { @@ -242,7 +257,8 @@ void Surface::Ellipse(PRectangle rc, Colour fore, Colour back) { } void Surface::Copy(PRectangle rc, Point from, Surface &surfaceSource) { - hdc->Blit(rc.left, rc.top, rc.Width(), rc.Height(), + wxRect r = wxRectFromPRectangle(rc); + hdc->Blit(r.x, r.y, r.width, r.height, surfaceSource.hdc, from.x, from.y, wxCOPY); } @@ -344,7 +360,11 @@ void Surface::SetClip(PRectangle rc) { hdc->SetClippingRegion(wxRectFromPRectangle(rc)); } - +void Surface::FlushCachedState() { + // TODO Is there anything we need to do here? eric@sourcegear.com + // TODO I had to add this method when I merged new Scintilla code + // TODO from Neil. +} Window::~Window() { } @@ -365,7 +385,8 @@ PRectangle Window::GetPosition() { } void Window::SetPosition(PRectangle rc) { - id->SetSize(rc.left, rc.top, rc.Width(), rc.Height()); + wxRect r = wxRectFromPRectangle(rc); + id->SetSize(r); } void Window::SetPositionRelative(PRectangle rc, Window) { @@ -386,7 +407,8 @@ void Window::InvalidateAll() { } void Window::InvalidateRectangle(PRectangle rc) { - id->Refresh(false, &wxRectFromPRectangle(rc)); + wxRect r = wxRectFromPRectangle(rc); + id->Refresh(false, &r); } void Window::SetFont(Font &font) { @@ -465,7 +487,12 @@ int ListBox::GetSelection() { } int ListBox::Find(const char *prefix) { - return ((wxListBox*)id)->FindString(prefix); + for (int x=0; x < ((wxListBox*)id)->Number(); x++) { + wxString text = ((wxListBox*)id)->GetString(x); + if (text.StartsWith(prefix)) + return x; + } + return -1; } void ListBox::GetValue(int n, char *value, int len) { diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index cd0064be5c..56ac221558 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -14,6 +14,8 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +#include <ctype.h> + #include "ScintillaWX.h" #include "wx/stc/stc.h" @@ -60,6 +62,29 @@ void wxSTCDropTarget::OnLeave() { } +class wxSTCCallTip : public wxWindow { +public: + wxSTCCallTip(wxWindow* parent, int ID, CallTip* ct) + : wxWindow(parent, ID) + { + m_ct = ct; + } + + void OnPaint(wxPaintEvent& evt) { + wxPaintDC dc(this); + Surface surfaceWindow; + surfaceWindow.Init(&dc); + m_ct->PaintCT(&surfaceWindow); + surfaceWindow.Release(); + } + + CallTip* m_ct; + DECLARE_EVENT_TABLE() +}; + +BEGIN_EVENT_TABLE(wxSTCCallTip, wxWindow) + EVT_PAINT(wxSTCCallTip::OnPaint) +END_EVENT_TABLE() //---------------------------------------------------------------------- // Constructor/Destructor @@ -193,9 +218,8 @@ void ScintillaWX::NotifyParent(SCNotification scn) { void ScintillaWX::Copy() { if (currentPos != anchor) { char* text = CopySelectionRange(); - textDO.SetText(text); wxTheClipboard->Open(); - wxTheClipboard->SetData(&textDO); + wxTheClipboard->SetData(new wxTextDataObject(text)); wxTheClipboard->Close(); } } @@ -236,7 +260,7 @@ bool ScintillaWX::CanPaste() { } void ScintillaWX::CreateCallTipWindow(PRectangle) { - ct.wCallTip = new wxWindow(wDraw.GetID(), -1); + ct.wCallTip = new wxSTCCallTip(wDraw.GetID(), -1, &ct); ct.wDraw = ct.wCallTip; } @@ -384,7 +408,10 @@ void ScintillaWX::DoButtonMove(Point pt) { void ScintillaWX::DoAddChar(char ch) { + //bool acActiveBeforeCharAdded = ac.Active(); AddChar(ch); + //if (acActiveBeforeCharAdded) + // AutoCompleteChanged(ch); } int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt) { @@ -401,6 +428,9 @@ void ScintillaWX::DoContextMenu(Point pt) { ContextMenu(pt); } +void ScintillaWX::DoOnListBox() { + AutoCompleteCompleted(); +} //---------------------------------------------------------------------- @@ -433,12 +463,13 @@ void ScintillaWX::DoDragLeave() { // Redraw all of text area. This paint will not be abandoned. void ScintillaWX::FullPaint() { paintState = painting; - rcPaint = GetTextRectangle(); - wxClientDC dc(wMain.GetID()); - Surface surfaceWindow; - surfaceWindow.Init(&dc); - Paint(&surfaceWindow, rcPaint); - surfaceWindow.Release(); +// rcPaint = GetTextRectangle(); +// wxClientDC dc(wMain.GetID()); +// Surface surfaceWindow; +// surfaceWindow.Init(&dc); +// Paint(&surfaceWindow, rcPaint); +// surfaceWindow.Release(); + wMain.GetID()->Refresh(FALSE); paintState = notPainting; } diff --git a/src/stc/ScintillaWX.h b/src/stc/ScintillaWX.h index 2d273fc99a..c2087c9682 100644 --- a/src/stc/ScintillaWX.h +++ b/src/stc/ScintillaWX.h @@ -126,6 +126,7 @@ public: void DoCommand(int ID); void DoContextMenu(Point pt); + void DoOnListBox(); // helpers @@ -139,7 +140,6 @@ private: bool capturedMouse; wxStyledTextCtrl* stc; - wxTextDataObject textDO; wxSTCDropTarget* dropTarget; wxDragResult dragResult; }; diff --git a/src/stc/StcVC.dsp b/src/stc/StcVC.dsp index 3b8fc6d9e7..5e77ef19e2 100644 --- a/src/stc/StcVC.dsp +++ b/src/stc/StcVC.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="StcVC" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# Microsoft Developer Studio Generated Build File, Format Version 5.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 @@ -22,11 +22,9 @@ CFG=StcVC - Win32 Debug !MESSAGE # Begin Project -# PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe -RSC=rc.exe !IF "$(CFG)" == "StcVC - Win32 Release" @@ -40,11 +38,12 @@ RSC=rc.exe # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" +RSC=rc.exe +# ADD BASE RSC /l 0x809 +# ADD RSC /l 0x809 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../include" /I "scintilla/include" /I "scintilla/src" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D "__WX__" /D "SCI_LEXER" /FD /c # SUBTRACT CPP /YX -# ADD BASE RSC /l 0x809 -# ADD RSC /l 0x809 BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -64,11 +63,12 @@ LIB32=link.exe -lib # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" +RSC=rc.exe +# ADD BASE RSC /l 0x809 +# ADD RSC /l 0x809 # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "../../../include" /I "../../include" /I "scintilla/include" /I "scintilla/src" /D "_DEBUG" /D DEBUG=1 /D "__WXDEBUG__" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D "__WX__" /D "SCI_LEXER" /FD /c # SUBTRACT CPP /YX -# ADD BASE RSC /l 0x809 -# ADD RSC /l 0x809 BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -179,6 +179,34 @@ SOURCE=.\scintilla\src\KeyWords.cxx # End Source File # Begin Source File +SOURCE=.\scintilla\src\LexCPP.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexHTML.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexOthers.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexPerl.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexPython.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexSQL.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexVB.cxx +# End Source File +# Begin Source File + SOURCE=.\scintilla\src\LineMarker.cxx # End Source File # Begin Source File diff --git a/src/stc/makefile.b32 b/src/stc/makefile.b32 index 3d52701553..6f5703b7dc 100644 --- a/src/stc/makefile.b32 +++ b/src/stc/makefile.b32 @@ -2,7 +2,7 @@ # File: makefile.b32 # Author: Julian Smart # Created: 1999 -# Updated: +# Updated: # Copyright: # # Makefile : Builds wxMMedia library for 32-bit BC++ @@ -21,25 +21,36 @@ STCEXTRACPPFLAGS=-D__WX__ -DSCI_LEXER -I$(SCINTILLA)/include -I$(S) LIBTARGET=$(WXDIR)\contrib\lib\stc.lib OBJECTS = \ - Accessor.obj \ + Accessor.obj \ AutoComplete.obj \ - CallTip.obj \ - CellBuffer.obj \ - ContractionState.obj\ - Document.obj \ + CallTip.obj \ + CellBuffer.obj \ + ContractionState.obj \ + Document.obj \ + DocumentAccessor.obj \ Editor.obj \ - Indicator.obj \ + Indicator.obj \ KeyMap.obj \ - KeyWords.obj \ - LineMarker.obj \ - PropSet.obj \ + KeyWords.obj \ + LexCPP.obj \ + LexHTML.obj \ + LexOthers.obj \ + LexPerl.obj \ + LexPython.obj \ + LexSQL.obj \ + LexVB.obj \ + LineMarker.obj \ + PropSet.obj \ ScintillaBase.obj \ Style.obj \ - ViewStyle.obj \ + UniConversion.obj \ + ViewStyle.obj \ + WindowAccessor.obj \ \ PlatWX.obj \ - ScintillaWX.obj \ - stc.obj \ + ScintillaWX.obj \ + stc.obj \ + !include $(WXDIR)\src\makelib.b32 diff --git a/src/stc/makefile.g95 b/src/stc/makefile.g95 index b6d802ecd9..640501e22a 100644 --- a/src/stc/makefile.g95 +++ b/src/stc/makefile.g95 @@ -25,6 +25,16 @@ OBJECTS = \ $(S)/ScintillaBase.$(OBJSUFF) \ $(S)/Style.$(OBJSUFF) \ $(S)/ViewStyle.$(OBJSUFF) \ + $(S)/LexCPP.$(OBJSUFF) \ + $(S)/LexHTML.$(OBJSUFF) \ + $(S)/LexOthers.$(OBJSUFF) \ + $(S)/LexPerl.$(OBJSUFF) \ + $(S)/LexPython.$(OBJSUFF) \ + $(S)/LexSQL.$(OBJSUFF) \ + $(S)/LexVB.$(OBJSUFF) \ + $(S)/DocumentAccessor.$(OBJSUFF)\ + $(S)/UniConversion.$(OBJSUFF) \ + $(S)/WindowAccessor.$(OBJSUFF) \ PlatWX.$(OBJSUFF) \ ScintillaWX.$(OBJSUFF) \ stc.$(OBJSUFF) diff --git a/src/stc/makefile.vc b/src/stc/makefile.vc index c1adeacff6..f7358c3e73 100644 --- a/src/stc/makefile.vc +++ b/src/stc/makefile.vc @@ -15,21 +15,30 @@ NOPCH=1 !include $(WXDIR)\src\makevc.env OBJECTS = \ - $(D)\Accessor.obj \ $(D)\AutoComplete.obj \ $(D)\CallTip.obj \ $(D)\CellBuffer.obj \ $(D)\ContractionState.obj\ $(D)\Document.obj \ + $(D)\DocumentAccessor.obj\ $(D)\Editor.obj \ $(D)\Indicator.obj \ $(D)\KeyMap.obj \ $(D)\KeyWords.obj \ + $(D)\LexCPP.obj \ + $(D)\LexHTML.obj \ + $(D)\LexOthers.obj \ + $(D)\LexPerl.obj \ + $(D)\LexPython.obj \ + $(D)\LexSQL.obj \ + $(D)\LexVB.obj \ $(D)\LineMarker.obj \ $(D)\PropSet.obj \ $(D)\ScintillaBase.obj \ $(D)\Style.obj \ + $(D)\UniConversion.obj \ $(D)\ViewStyle.obj \ + $(D)\WindowAccessor.obj \ \ $(D)\PlatWX.obj \ $(D)\ScintillaWX.obj \ diff --git a/src/stc/scintilla/README.txt b/src/stc/scintilla/README.txt index 705fb99652..409b44c3c2 100644 --- a/src/stc/scintilla/README.txt +++ b/src/stc/scintilla/README.txt @@ -3,5 +3,6 @@ scintilla/include directories from the Scintilla/SCiTE source distribution. All other code needed to implement Scintilla on top of wxWindows is located in the directory above this one. -The current version of the Scintilla code is somewhere between 1.22 -and 1.23, (from their CVS.) +The current version of the Scintilla code is 1.25+ (from their CVS on +5-19-2000). + diff --git a/src/stc/scintilla/include/Accessor.h b/src/stc/scintilla/include/Accessor.h index 1bba4af55e..b4b7e62ecf 100644 --- a/src/stc/scintilla/include/Accessor.h +++ b/src/stc/scintilla/include/Accessor.h @@ -3,26 +3,30 @@ // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. +enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8}; + +class Accessor; + +typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len); + +// Interface to data in a Scintilla class Accessor { protected: - // bufferSize is a trade off between time taken to copy the characters and SendMessage overhead + enum {extremePosition=0x7FFFFFFF}; + // bufferSize is a trade off between time taken to copy the characters and retrieval overhead // slopSize positions the buffer before the desired position in case there is some backtracking enum {bufferSize=4000, slopSize=bufferSize/8}; char buf[bufferSize+1]; - WindowID id; - PropSet &props; int startPos; int endPos; - int lenDoc; - int offset; // Optional but including an offset makes GCC generate better code - void Fill(int position); + int codePage; + + virtual bool InternalIsLeadByte(char ch)=0; + virtual void Fill(int position)=0; public: - Accessor(WindowID id_, PropSet &props_, int offset_=0) : - id(id_), props(props_), startPos(0x7FFFFFFF), endPos(0), - lenDoc(-1), offset(offset_) { - } + Accessor() : startPos(extremePosition), endPos(0), codePage(0) {} + virtual ~Accessor() {} char operator[](int position) { - position += offset; if (position < startPos || position >= endPos) { Fill(position); } @@ -30,7 +34,6 @@ public: } char SafeGetCharAt(int position, char chDefault=' ') { // Safe version of operator[], returning a defined value for invalid position - position += offset; if (position < startPos || position >= endPos) { Fill(position); if (position < startPos || position >= endPos) { @@ -40,37 +43,28 @@ public: } return buf[position - startPos]; } - char StyleAt(int position); - int GetLine(int position); - int LineStart(int line); - int LevelAt(int line); - int Length(); - void Flush() { - startPos = 0x7FFFFFFF; - lenDoc = -1; + bool IsLeadByte(char ch) { + return codePage && InternalIsLeadByte(ch); } - int GetLineState(int line); - int SetLineState(int line, int state); - PropSet &GetPropSet() { return props; } -}; + void SetCodePage(int codePage_) { codePage = codePage_; } -class StylingContext : public Accessor { - char styleBuf[bufferSize]; - int validLen; - char chFlags; - char chWhile; - unsigned int startSeg; -public: - StylingContext(WindowID id_, PropSet &props_, int offset_=0) : - Accessor(id_,props_,offset_), validLen(0), chFlags(0) {} - void StartAt(unsigned int start, char chMask=31); - void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; - void ColourSegment(unsigned int start, unsigned int end, int chAttr); - unsigned int GetStartSegment() { return startSeg; } - void StartSegment(unsigned int pos); - void ColourTo(unsigned int pos, int chAttr); - int GetLine(int position); - void SetLevel(int line, int level); - void Flush(); + virtual char StyleAt(int position)=0; + virtual int GetLine(int position)=0; + virtual int LineStart(int line)=0; + virtual int LevelAt(int line)=0; + virtual int Length()=0; + virtual void Flush()=0; + virtual int GetLineState(int line)=0; + virtual int SetLineState(int line, int state)=0; + virtual int GetPropertyInt(const char *key, int defaultValue=0)=0; + + // Style setting + virtual void StartAt(unsigned int start, char chMask=31)=0; + virtual void SetFlags(char chFlags_, char chWhile_)=0; + virtual unsigned int GetStartSegment()=0; + virtual void StartSegment(unsigned int pos)=0; + virtual void ColourTo(unsigned int pos, int chAttr)=0; + virtual void SetLevel(int line, int level)=0; + virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0; }; diff --git a/src/stc/scintilla/include/KeyWords.h b/src/stc/scintilla/include/KeyWords.h index 2cc03b788f..3159dcc1b4 100644 --- a/src/stc/scintilla/include/KeyWords.h +++ b/src/stc/scintilla/include/KeyWords.h @@ -3,6 +3,39 @@ // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. -void ColouriseDoc(int codePage, int startPos, int lengthDoc, int initStyle, - int language, WordList *keywordlists[], StylingContext &styler); +typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler); + +class LexerModule { + static LexerModule *base; + LexerModule *next; + int language; + LexerFunction fn; +public: + LexerModule(int language_, LexerFunction fn_); + static void Colourise(unsigned int startPos, int lengthDoc, int initStyle, + int language, WordList *keywordlists[], Accessor &styler); +}; + +inline bool iswordchar(char ch) { + return isalnum(ch) || ch == '.' || ch == '_'; +} + +inline bool iswordstart(char ch) { + return isalnum(ch) || ch == '_'; +} + +inline bool isoperator(char ch) { + if (isalnum(ch)) + return false; + // '.' left out as it is used to make up numbers + if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || + ch == '(' || ch == ')' || ch == '-' || ch == '+' || + ch == '=' || ch == '|' || ch == '{' || ch == '}' || + ch == '[' || ch == ']' || ch == ':' || ch == ';' || + ch == '<' || ch == '>' || ch == ',' || ch == '/' || + ch == '?' || ch == '!' || ch == '.' || ch == '~') + return true; + return false; +} diff --git a/src/stc/scintilla/include/Platform.h b/src/stc/scintilla/include/Platform.h index 3a5e9816dc..5a87c64feb 100644 --- a/src/stc/scintilla/include/Platform.h +++ b/src/stc/scintilla/include/Platform.h @@ -45,6 +45,7 @@ #pragma warning(disable: 4800 4244 4309) #endif #include <windows.h> +#include <commctrl.h> #include <richedit.h> #endif @@ -209,16 +210,19 @@ public: Font(); ~Font(); - void Create(const char *faceName, int size, bool bold=false, bool italic=false); + void Create(const char *faceName, int characterSet, int size, bool bold, bool italic); void Release(); FontID GetID() { return id; } + // Alias another font - caller guarantees not to Release + void SetID(FontID id_) { id = id_; } friend class Surface; }; // A surface abstracts a place to draw class Surface { private: + bool unicodeMode; #if PLAT_GTK GdkDrawable *drawable; GdkGC *gc; @@ -266,6 +270,7 @@ public: bool Initialised(); void PenColour(Colour fore); int LogPixelsY(); + int DeviceHeightFont(int points); void MoveTo(int x_, int y_); void LineTo(int x_, int y_); void Polygon(Point *pts, int npts, Colour fore, Colour back); @@ -290,6 +295,11 @@ public: int SetPalette(Palette *pal, bool inBackGround); void SetClip(PRectangle rc); + void FlushCachedState(); + + void SetUnicodeMode(bool unicodeMode_) { + unicodeMode=unicodeMode_; + } }; // Class to hide the details of window manipulation @@ -300,6 +310,7 @@ protected: WindowID id; public: Window() : id(0) {} + Window(const Window &source) : id(source.id) {} virtual ~Window(); Window &operator=(WindowID id_) { id = id_; diff --git a/src/stc/scintilla/include/PropSet.h b/src/stc/scintilla/include/PropSet.h index 31da01f954..bc1599f38a 100644 --- a/src/stc/scintilla/include/PropSet.h +++ b/src/stc/scintilla/include/PropSet.h @@ -75,7 +75,7 @@ public: else return 0; } - char operator[](int i) { + char operator[](int i) const { if (s) return s[i]; else @@ -95,7 +95,7 @@ public: } return *this; } - int value() { + int value() const { if (s) return atoi(s); else @@ -168,7 +168,7 @@ public: WordList(bool onlyLineEnds_ = false) : words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {} ~WordList() { Clear(); } - operator bool() { return list; } + operator bool() { return list ? true : false; } const char *operator[](int ind) { return words[ind]; } void Clear(); void Set(const char *s); diff --git a/src/stc/scintilla/include/SciLexer.h b/src/stc/scintilla/include/SciLexer.h index d6667e4e25..d869758f61 100644 --- a/src/stc/scintilla/include/SciLexer.h +++ b/src/stc/scintilla/include/SciLexer.h @@ -21,6 +21,8 @@ #define SCLEX_ERRORLIST 10 #define SCLEX_MAKEFILE 11 #define SCLEX_BATCH 12 +#define SCLEX_XCODE 13 +#define SCLEX_LATEX 14 // Lexical states for SCLEX_PYTHON #define SCE_P_DEFAULT 0 @@ -35,6 +37,8 @@ #define SCE_P_DEFNAME 9 #define SCE_P_OPERATOR 10 #define SCE_P_IDENTIFIER 11 +#define SCE_P_COMMENTBLOCK 12 +#define SCE_P_STRINGEOL 13 // Lexical states for SCLEX_CPP, SCLEX_VB #define SCE_C_DEFAULT 0 @@ -45,7 +49,7 @@ #define SCE_C_WORD 5 #define SCE_C_STRING 6 #define SCE_C_CHARACTER 7 -#define SCE_C_PUNTUATION 8 +#define SCE_C_UUID 8 #define SCE_C_PREPROCESSOR 9 #define SCE_C_OPERATOR 10 #define SCE_C_IDENTIFIER 11 @@ -63,49 +67,85 @@ #define SCE_H_OTHER 8 #define SCE_H_COMMENT 9 #define SCE_H_ENTITY 10 -// Embedded Javascript -#define SCE_HJ_START 11 -#define SCE_HJ_DEFAULT 12 -#define SCE_HJ_COMMENT 13 -#define SCE_HJ_COMMENTLINE 14 -#define SCE_HJ_COMMENTDOC 15 -#define SCE_HJ_NUMBER 16 -#define SCE_HJ_WORD 17 -#define SCE_HJ_KEYWORD 18 -#define SCE_HJ_DOUBLESTRING 19 -#define SCE_HJ_SINGLESTRING 20 -#define SCE_HJ_SYMBOLS 21 -#define SCE_HJ_STRINGEOL 28 // XML and ASP -#define SCE_H_TAGEND 22 -#define SCE_H_XMLSTART 23 -#define SCE_H_XMLEND 24 -#define SCE_H_SCRIPT 25 -#define SCE_H_ASP 26 -#define SCE_H_ASPAT 27 +#define SCE_H_TAGEND 11 +#define SCE_H_XMLSTART 12 +#define SCE_H_XMLEND 13 +#define SCE_H_SCRIPT 14 +#define SCE_H_ASP 15 +#define SCE_H_ASPAT 16 +// Embedded Javascript +#define SCE_HJ_START 40 +#define SCE_HJ_DEFAULT 41 +#define SCE_HJ_COMMENT 42 +#define SCE_HJ_COMMENTLINE 43 +#define SCE_HJ_COMMENTDOC 44 +#define SCE_HJ_NUMBER 45 +#define SCE_HJ_WORD 46 +#define SCE_HJ_KEYWORD 47 +#define SCE_HJ_DOUBLESTRING 48 +#define SCE_HJ_SINGLESTRING 49 +#define SCE_HJ_SYMBOLS 50 +#define SCE_HJ_STRINGEOL 51 +// ASP Javascript +#define SCE_HJA_START 55 +#define SCE_HJA_DEFAULT 56 +#define SCE_HJA_COMMENT 57 +#define SCE_HJA_COMMENTLINE 58 +#define SCE_HJA_COMMENTDOC 59 +#define SCE_HJA_NUMBER 60 +#define SCE_HJA_WORD 61 +#define SCE_HJA_KEYWORD 62 +#define SCE_HJA_DOUBLESTRING 63 +#define SCE_HJA_SINGLESTRING 64 +#define SCE_HJA_SYMBOLS 65 +#define SCE_HJA_STRINGEOL 66 // Embedded VBScript -#define SCE_HB_START 40 -#define SCE_HB_DEFAULT 41 -#define SCE_HB_COMMENTLINE 42 -#define SCE_HB_NUMBER 43 -#define SCE_HB_WORD 44 -#define SCE_HB_STRING 45 -#define SCE_HB_IDENTIFIER 46 -#define SCE_HB_STRINGEOL 47 +#define SCE_HB_START 70 +#define SCE_HB_DEFAULT 71 +#define SCE_HB_COMMENTLINE 72 +#define SCE_HB_NUMBER 73 +#define SCE_HB_WORD 74 +#define SCE_HB_STRING 75 +#define SCE_HB_IDENTIFIER 76 +#define SCE_HB_STRINGEOL 77 +// ASP VBScript +#define SCE_HBA_START 80 +#define SCE_HBA_DEFAULT 81 +#define SCE_HBA_COMMENTLINE 82 +#define SCE_HBA_NUMBER 83 +#define SCE_HBA_WORD 84 +#define SCE_HBA_STRING 85 +#define SCE_HBA_IDENTIFIER 86 +#define SCE_HBA_STRINGEOL 87 // Embedded Python -#define SCE_HP_START 50 -#define SCE_HP_DEFAULT 51 -#define SCE_HP_COMMENTLINE 52 -#define SCE_HP_NUMBER 53 -#define SCE_HP_STRING 54 -#define SCE_HP_CHARACTER 55 -#define SCE_HP_WORD 56 -#define SCE_HP_TRIPLE 57 -#define SCE_HP_TRIPLEDOUBLE 58 -#define SCE_HP_CLASSNAME 59 -#define SCE_HP_DEFNAME 60 -#define SCE_HP_OPERATOR 61 -#define SCE_HP_IDENTIFIER 62 +#define SCE_HP_START 90 +#define SCE_HP_DEFAULT 91 +#define SCE_HP_COMMENTLINE 92 +#define SCE_HP_NUMBER 93 +#define SCE_HP_STRING 94 +#define SCE_HP_CHARACTER 95 +#define SCE_HP_WORD 96 +#define SCE_HP_TRIPLE 97 +#define SCE_HP_TRIPLEDOUBLE 98 +#define SCE_HP_CLASSNAME 99 +#define SCE_HP_DEFNAME 100 +#define SCE_HP_OPERATOR 101 +#define SCE_HP_IDENTIFIER 102 +// ASP Python +#define SCE_HPA_START 105 +#define SCE_HPA_DEFAULT 106 +#define SCE_HPA_COMMENTLINE 107 +#define SCE_HPA_NUMBER 108 +#define SCE_HPA_STRING 109 +#define SCE_HPA_CHARACTER 110 +#define SCE_HPA_WORD 111 +#define SCE_HPA_TRIPLE 112 +#define SCE_HPA_TRIPLEDOUBLE 113 +#define SCE_HPA_CLASSNAME 114 +#define SCE_HPA_DEFNAME 115 +#define SCE_HPA_OPERATOR 116 +#define SCE_HPA_IDENTIFIER 117 // Lexical states for SCLEX_PERL #define SCE_PL_DEFAULT 0 @@ -131,4 +171,11 @@ #define SCE_PL_BACKTICKS 20 #define SCE_PL_DATASECTION 21 +// Lexical states for SCLEX_LATEX +#define SCE_L_DEFAULT 0 +#define SCE_L_COMMAND 1 +#define SCE_L_TAG 2 +#define SCE_L_MATH 3 +#define SCE_L_COMMENT 4 + #endif diff --git a/src/stc/scintilla/include/Scintilla.h b/src/stc/scintilla/include/Scintilla.h index 07572168dc..8e52ba59e2 100644 --- a/src/stc/scintilla/include/Scintilla.h +++ b/src/stc/scintilla/include/Scintilla.h @@ -89,7 +89,6 @@ extern "C" { #define SCI_GETVIEWWS SCI_START + 20 #define SCI_SETVIEWWS SCI_START + 21 -#define SCI_CHANGEPOSITION SCI_START + 22 #define SCI_GOTOLINE SCI_START + 24 #define SCI_GOTOPOS SCI_START + 25 #define SCI_SETANCHOR SCI_START + 26 @@ -107,6 +106,9 @@ extern "C" { #define SCI_STARTSTYLING SCI_START + 32 #define SCI_SETSTYLING SCI_START + 33 +// This is the same value as CP_UTF8 in Windows +#define SC_CP_UTF8 65001 + #define SCI_SETBUFFEREDDRAW SCI_START + 35 #define SCI_SETTABWIDTH SCI_START + 36 #define SCI_SETCODEPAGE SCI_START + 37 @@ -156,7 +158,11 @@ extern "C" { #define STYLE_BRACELIGHT 34 #define STYLE_BRACEBAD 35 #define STYLE_CONTROLCHAR 36 -#define STYLE_MAX 63 +#define STYLE_MAX 127 + +#define SC_CHARSET_ANSI 0 +#define SC_CHARSET_DEFAULT 1 +#define SC_CHARSET_RUSSIAN 204 #define SCI_STYLECLEARALL SCI_START + 50 #define SCI_STYLESETFORE SCI_START + 51 @@ -167,6 +173,8 @@ extern "C" { #define SCI_STYLESETFONT SCI_START + 56 #define SCI_STYLESETEOLFILLED SCI_START + 57 #define SCI_STYLERESETDEFAULT SCI_START + 58 +#define SCI_STYLESETUNDERLINE SCI_START + 59 +#define SCI_STYLESETCHARACTERSET SCI_START + 66 #define SCI_SETSELFORE SCI_START + 67 #define SCI_SETSELBACK SCI_START + 68 @@ -190,6 +198,8 @@ extern "C" { #define INDIC_PLAIN 0 #define INDIC_SQUIGGLE 1 #define INDIC_TT 2 +#define INDIC_DIAGONAL 3 +#define INDIC_STRIKE 4 #define INDIC0_MASK 32 #define INDIC1_MASK 64 @@ -213,6 +223,21 @@ extern "C" { #define SCI_AUTOCPOSSTART SCI_START + 103 #define SCI_AUTOCCOMPLETE SCI_START + 104 #define SCI_AUTOCSTOPS SCI_START + 105 +#define SCI_AUTOCSETSEPARATOR SCI_START + 106 +#define SCI_AUTOCGETSEPARATOR SCI_START + 107 +#define SCI_AUTOCSELECT SCI_START + 108 + +#define SCI_GETTABWIDTH SCI_START + 121 +#define SCI_SETINDENT SCI_START + 122 +#define SCI_GETINDENT SCI_START + 123 +#define SCI_SETUSETABS SCI_START + 124 +#define SCI_GETUSETABS SCI_START + 125 +#define SCI_SETLINEINDENTATION SCI_START + 126 +#define SCI_GETLINEINDENTATION SCI_START + 127 +#define SCI_GETLINEINDENTPOSITION SCI_START + 128 + +#define SCI_SETHSCROLLBAR SCI_START + 130 +#define SCI_GETHSCROLLBAR SCI_START + 131 #define SCI_CALLTIPSHOW SCI_START + 200 #define SCI_CALLTIPCANCEL SCI_START + 201 @@ -279,6 +304,13 @@ extern "C" { #define SCI_ZOOMOUT SCI_START + 334 #define SCI_DELWORDLEFT SCI_START + 335 #define SCI_DELWORDRIGHT SCI_START + 336 +#define SCI_LINECUT SCI_START + 337 +#define SCI_LINEDELETE SCI_START + 338 +#define SCI_LINETRANSPOSE SCI_START + 339 +#define SCI_LOWERCASE SCI_START + 340 +#define SCI_UPPERCASE SCI_START + 341 +#define SCI_LINESCROLLDOWN SCI_START + 342 +#define SCI_LINESCROLLUP SCI_START + 343 #define SCI_LINELENGTH SCI_START + 350 #define SCI_BRACEHIGHLIGHT SCI_START + 351 @@ -311,6 +343,14 @@ extern "C" { // OR this with CARET_SLOP to reposition whenever outside slop border #define SCI_SETCARETPOLICY SCI_START + 369 +#define SCI_LINESONSCREEN SCI_START + 370 +#define SCI_USEPOPUP SCI_START + 371 +#define SCI_SELECTIONISRECTANGLE SCI_START + 372 +#define SCI_SETZOOM SCI_START + 373 +#define SCI_GETZOOM SCI_START + 374 + +#define SCI_ADDREFDOC SCI_START + 375 +#define SCI_RELEASEDOC SCI_START + 376 // GTK+ Specific #define SCI_GRABFOCUS SCI_START + 400 @@ -342,8 +382,11 @@ typedef void (tMacroRecorder)(UINT iMessage, WPARAM wParam, LPARAM lParam, #define SC_PERFORMED_UNDO 0x20 #define SC_PERFORMED_REDO 0x40 #define SC_LASTSTEPINUNDOREDO 0x100 +#define SC_MOD_CHANGEMARKER 0x200 +#define SC_MOD_BEFOREINSERT 0x400 +#define SC_MOD_BEFOREDELETE 0x800 -#define SC_MODEVENTMASKALL 0x377 +#define SC_MODEVENTMASKALL 0xF77 struct SCNotification { NMHDR nmhdr; @@ -394,6 +437,8 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance); #ifdef INCLUDE_DEPRECATED_FEATURES +#define SCI_CHANGEPOSITION SCI_START + 22 + // Default style settings. These are deprecated and will be removed in a future version. #define SCI_SETFORE SCI_START + 60 #define SCI_SETBACK SCI_START + 61 diff --git a/src/stc/scintilla/include/WinDefs.h b/src/stc/scintilla/include/WinDefs.h index 0b125e7313..d1c25a595a 100644 --- a/src/stc/scintilla/include/WinDefs.h +++ b/src/stc/scintilla/include/WinDefs.h @@ -20,79 +20,34 @@ #define EM_CANPASTE (1074) #define EM_CANUNDO (198) #define EM_CHARFROMPOS (215) -#define EM_DISPLAYBAND (1075) #define EM_EMPTYUNDOBUFFER (205) #define EM_EXGETSEL (1076) -#define EM_EXLIMITTEXT (1077) #define EM_EXLINEFROMCHAR (1078) #define EM_EXSETSEL (1079) #define EM_FINDTEXT (1080) #define EM_FINDTEXTEX (1103) -#define EM_FINDWORDBREAK (1100) -#define EM_FMTLINES (200) #define EM_FORMATRANGE (1081) -#define EM_GETCHARFORMAT (1082) -#define EM_GETEVENTMASK (1083) #define EM_GETFIRSTVISIBLELINE (206) -#define EM_GETHANDLE (189) -#define EM_GETLIMITTEXT (213) #define EM_GETLINE (196) #define EM_GETLINECOUNT (186) #define EM_GETMARGINS (212) #define EM_GETMODIFY (184) -#define EM_GETIMECOLOR (1129) -#define EM_GETIMEOPTIONS (1131) -#define EM_GETOPTIONS (1102) -#define EM_GETOLEINTERFACE (1084) -#define EM_GETPARAFORMAT (1085) -#define EM_GETPASSWORDCHAR (210) -#define EM_GETPUNCTUATION (1125) #define EM_GETRECT (178) #define EM_GETSEL (176) #define EM_GETSELTEXT (1086) #define EM_GETTEXTRANGE (1099) -#define EM_GETTHUMB (190) -#define EM_GETWORDBREAKPROC (209) -#define EM_GETWORDBREAKPROCEX (1104) -#define EM_GETWORDWRAPMODE (1127) #define EM_HIDESELECTION (1087) -#define EM_LIMITTEXT (197) #define EM_LINEFROMCHAR (201) #define EM_LINEINDEX (187) #define EM_LINELENGTH (193) #define EM_LINESCROLL (182) -#define EM_PASTESPECIAL (1088) #define EM_POSFROMCHAR (214) #define EM_REPLACESEL (194) -#define EM_REQUESTRESIZE (1089) -#define EM_SCROLL (181) #define EM_SCROLLCARET (183) #define EM_SELECTIONTYPE (1090) -#define EM_SETBKGNDCOLOR (1091) -#define EM_SETCHARFORMAT (1092) -#define EM_SETEVENTMASK (1093) -#define EM_SETHANDLE (188) -#define EM_SETIMECOLOR (1128) -#define EM_SETIMEOPTIONS (1130) -#define EM_SETLIMITTEXT (197) #define EM_SETMARGINS (211) -#define EM_SETMODIFY (185) -#define EM_SETOLECALLBACK (1094) -#define EM_SETOPTIONS (1101) -#define EM_SETPARAFORMAT (1095) -#define EM_SETPASSWORDCHAR (204) -#define EM_SETPUNCTUATION (1124) #define EM_SETREADONLY (207) -#define EM_SETRECT (179) -#define EM_SETRECTNP (180) #define EM_SETSEL (177) -#define EM_SETTABSTOPS (203) -#define EM_SETTARGETDEVICE (1096) -#define EM_SETWORDBREAKPROC (208) -#define EM_SETWORDBREAKPROCEX (1105) -#define EM_SETWORDWRAPMODE (1126) -#define EM_STREAMIN (1097) -#define EM_STREAMOUT (1098) #define EM_UNDO (199) #define WM_NULL (0) @@ -132,6 +87,7 @@ #define VK_RETURN GDK_Return #define VK_ADD GDK_KP_Add #define VK_SUBTRACT GDK_KP_Subtract +#define VK_DIVIDE GDK_KP_Divide #endif #if PLAT_WX @@ -151,6 +107,8 @@ #define VK_RETURN WXK_RETURN #define VK_ADD WXK_ADD #define VK_SUBTRACT WXK_SUBTRACT +//TODO: +#define VK_DIVIDE WXK_DIVIDE // Are these needed any more #define LPSTR char * diff --git a/src/stc/scintilla/include/WindowAccessor.h b/src/stc/scintilla/include/WindowAccessor.h new file mode 100644 index 0000000000..89a542e82d --- /dev/null +++ b/src/stc/scintilla/include/WindowAccessor.h @@ -0,0 +1,47 @@ +// WindowAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +class WindowAccessor : public Accessor { + // Private so WindowAccessor objects can not be copied + WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {} + WindowAccessor &operator=(const WindowAccessor &) { return *this; } +protected: + WindowID id; + PropSet &props; + int lenDoc; + + char styleBuf[bufferSize]; + int validLen; + char chFlags; + char chWhile; + unsigned int startSeg; + + bool InternalIsLeadByte(char ch); + void Fill(int position); +public: + WindowAccessor(WindowID id_, PropSet &props_) : + Accessor(), id(id_), props(props_), + lenDoc(-1), validLen(0), chFlags(0) { + } + ~WindowAccessor(); + char StyleAt(int position); + int GetLine(int position); + int LineStart(int line); + int LevelAt(int line); + int Length(); + void Flush(); + int GetLineState(int line); + int SetLineState(int line, int state); + int GetPropertyInt(const char *key, int defaultValue=0) { + return props.GetInt(key, defaultValue); + } + + void StartAt(unsigned int start, char chMask=31); + void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; + unsigned int GetStartSegment() { return startSeg; } + void StartSegment(unsigned int pos); + void ColourTo(unsigned int pos, int chAttr); + void SetLevel(int line, int level); + int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); +}; diff --git a/src/stc/scintilla/src/AutoComplete.cxx b/src/stc/scintilla/src/AutoComplete.cxx index c3ec29c3c9..75e26fe283 100644 --- a/src/stc/scintilla/src/AutoComplete.cxx +++ b/src/stc/scintilla/src/AutoComplete.cxx @@ -15,6 +15,7 @@ AutoComplete::AutoComplete() { active = false; posStart = 0; strcpy(stopChars, ""); + separator = ' '; } AutoComplete::~AutoComplete() { @@ -44,6 +45,14 @@ bool AutoComplete::IsStopChar(char ch) { return ch && strchr(stopChars, ch); } +void AutoComplete::SetSeparator(char separator_) { + separator = separator_; +} + +char AutoComplete::GetSeparator() { + return separator; +} + int AutoComplete::SetList(const char *list) { int maxStrLen = 12; lb.Clear(); @@ -53,7 +62,7 @@ int AutoComplete::SetList(const char *list) { char *startword = words; int i = 0; for (; words && words[i]; i++) { - if (words[i] == ' ') { + if (words[i] == separator) { words[i] = '\0'; lb.Append(startword); maxStrLen = Platform::Maximum(maxStrLen, strlen(startword)); diff --git a/src/stc/scintilla/src/AutoComplete.h b/src/stc/scintilla/src/AutoComplete.h index 10216027bd..e4f8ade0d8 100644 --- a/src/stc/scintilla/src/AutoComplete.h +++ b/src/stc/scintilla/src/AutoComplete.h @@ -9,6 +9,7 @@ class AutoComplete { bool active; char stopChars[256]; + char separator; public: ListBox lb; int posStart; @@ -27,7 +28,11 @@ public: void SetStopChars(const char *stopChars_); bool IsStopChar(char ch); - // The list string contains a sequence of words separated by spaces + // The separator character is used when interpreting the list in SetList + void SetSeparator(char separator_); + char GetSeparator(); + + // The list string contains a sequence of words separated by the separator character int SetList(const char *list); void Show(); diff --git a/src/stc/scintilla/src/CallTip.cxx b/src/stc/scintilla/src/CallTip.cxx index ad6740208b..d22a963645 100644 --- a/src/stc/scintilla/src/CallTip.cxx +++ b/src/stc/scintilla/src/CallTip.cxx @@ -8,6 +8,7 @@ #include "Platform.h" +#include "Scintilla.h" #include "CallTip.h" CallTip::CallTip() { @@ -117,7 +118,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, Surface surfaceMeasure; surfaceMeasure.Init(); int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72; - font.Create(faceName, deviceHeight); + font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false); if (val) delete []val; val = new char[strlen(defn) + 1]; diff --git a/src/stc/scintilla/src/CallTip.h b/src/stc/scintilla/src/CallTip.h index cd5b093c84..cb5bc29032 100644 --- a/src/stc/scintilla/src/CallTip.h +++ b/src/stc/scintilla/src/CallTip.h @@ -6,13 +6,14 @@ #ifndef CALLTIP_H #define CALLTIP_H -const char callClassName[] = "CallTip"; - class CallTip { int startHighlight; int endHighlight; char *val; Font font; + // Private so CallTip objects can not be copied + CallTip(const CallTip &) {} + CallTip &operator=(const CallTip &) { return *this; } public: Window wCallTip; Window wDraw; diff --git a/src/stc/scintilla/src/CellBuffer.cxx b/src/stc/scintilla/src/CellBuffer.cxx index 777688511a..e6aa4a0134 100644 --- a/src/stc/scintilla/src/CellBuffer.cxx +++ b/src/stc/scintilla/src/CellBuffer.cxx @@ -191,11 +191,23 @@ void LineVector::InsertValue(int pos, int value) { } } lines++; - for (int i = lines + 1; i > pos; i--) { + for (int i = lines; i > pos; i--) { linesData[i] = linesData[i - 1]; } linesData[pos].startPosition = value; linesData[pos].handleSet = 0; + if (levels) { + for (int j = lines; j > pos; j--) { + levels[j] = levels[j - 1]; + } + if (pos == 0) { + levels[pos] = SC_FOLDLEVELBASE; + } else if (pos == (lines-1)) { // Last line will not be a folder + levels[pos] = SC_FOLDLEVELBASE; + } else { + levels[pos] = levels[pos-1]; + } + } } void LineVector::SetValue(int pos, int value) { @@ -221,6 +233,15 @@ void LineVector::Remove(int pos) { for (int i = pos; i < lines; i++) { linesData[i] = linesData[i + 1]; } + if (levels) { + // Level information merges back onto previous line + int posAbove = pos-1; + if (posAbove < 0) + posAbove = 0; + for (int j = posAbove; j < lines; j++) { + levels[j] = levels[j + 1]; + } + } lines--; } @@ -233,9 +254,8 @@ int LineVector::LineFromPosition(int pos) { return lines - 1; int lower = 0; int upper = lines; - int middle = 0; do { - middle = (upper + lower + 1) / 2; // Round high + int middle = (upper + lower + 1) / 2; // Round high if (pos < linesData[middle].startPosition) { upper = middle - 1; } else { @@ -316,12 +336,13 @@ Action::~Action() { Destroy(); } -void Action::Create(actionType at_, int position_, char *data_, int lenData_) { +void Action::Create(actionType at_, int position_, char *data_, int lenData_, bool mayCoalesce_) { delete []data; position = position_; at = at_; data = data_; lenData = lenData_; + mayCoalesce = mayCoalesce_; } void Action::Destroy() { @@ -336,39 +357,222 @@ void Action::Grab(Action *source) { at = source->at; data = source->data; lenData = source->lenData; - + mayCoalesce = source->mayCoalesce; + // Ownership of source data transferred to this source->position = 0; source->at = startAction; source->data = 0; source->lenData = 0; + source->mayCoalesce = true; +} + +// The undo history stores a sequence of user operations that represent the user's view of the +// commands executed on the text. +// Each user operation contains a sequence of text insertion and text deletion actions. +// All the user operations are stored in a list of individual actions with 'start' actions used +// as delimiters between user operations. +// Initially there is one start action in the history. +// As each action is performed, it is recorded in the history. The action may either become +// part of the current user operation or may start a new user operation. If it is to be part of the +// current operation, then it overwrites the current last action. If it is to be part of a new +// operation, it is appended after the current last action. +// After writing the new action, a new start action is appended at the end of the history. +// The decision of whether to start a new user operation is based upon two factors. If a +// compound operation has been explicitly started by calling BeginUndoAction and no matching +// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current +// operation. If there is no outstanding BeginUndoAction call then a new operation is started +// unless it looks as if the new action is caused by the user typing or deleting a stream of text. +// Sequences that look like typing or deletion are coalesced into a single user operation. + +UndoHistory::UndoHistory() { + + lenActions = 100; + actions = new Action[lenActions]; + maxAction = 0; + currentAction = 0; + undoSequenceDepth = 0; + savePoint = 0; + + actions[currentAction].Create(startAction); +} + +UndoHistory::~UndoHistory() { + delete []actions; + actions = 0; +} + +void UndoHistory::EnsureUndoRoom() { + //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, length, currentAction); + if (currentAction >= 2) { + // Have to test that there is room for 2 more actions in the array + // as two actions may be created by this function + if (currentAction >= (lenActions - 2)) { + // Run out of undo nodes so extend the array + int lenActionsNew = lenActions * 2; + Action *actionsNew = new Action[lenActionsNew]; + if (!actionsNew) + return; + for (int act = 0; act <= currentAction; act++) + actionsNew[act].Grab(&actions[act]); + delete []actions; + lenActions = lenActionsNew; + actions = actionsNew; + } + } +} + +void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData) { + EnsureUndoRoom(); + //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); + //Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at, + // actions[currentAction - 1].position, actions[currentAction - 1].lenData); + if (currentAction >= 1) { + if (0 == undoSequenceDepth) { + // Top level actions may not always be coalesced + Action &actPrevious = actions[currentAction - 1]; + // See if current action can be coalesced into previous action + // Will work if both are inserts or deletes and position is same + if (at != actPrevious.at) { + currentAction++; + } else if (currentAction == savePoint) { + currentAction++; + } else if ((at == removeAction) && + ((position + lengthData * 2) != actPrevious.position)) { + // Removals must be at same position to coalesce + currentAction++; + } else if ((at == insertAction) && + (position != (actPrevious.position + actPrevious.lenData*2))) { + // Insertions must be immediately after to coalesce + currentAction++; + } else { + //Platform::DebugPrintf("action coalesced\n"); + } + } else { + // Actions not at top level are always coalesced unless this is after return to top level + if (!actions[currentAction].mayCoalesce) + currentAction++; + } + } else { + currentAction++; + } + actions[currentAction].Create(at, position, data, lengthData); + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; +} + +void UndoHistory::BeginUndoAction() { + EnsureUndoRoom(); + if (undoSequenceDepth == 0) { + if (actions[currentAction].at != startAction) { + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; + } + actions[currentAction].mayCoalesce = false; + } + undoSequenceDepth++; +} + +void UndoHistory::EndUndoAction() { + EnsureUndoRoom(); + undoSequenceDepth--; + if (0 == undoSequenceDepth) { + if (actions[currentAction].at != startAction) { + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; + } + actions[currentAction].mayCoalesce = false; + } +} + +void UndoHistory::DropUndoSequence() { + undoSequenceDepth = 0; +} + +void UndoHistory::DeleteUndoHistory() { + for (int i = 1; i < maxAction; i++) + actions[i].Destroy(); + maxAction = 0; + currentAction = 0; + actions[currentAction].Create(startAction); + savePoint = 0; +} + +void UndoHistory::SetSavePoint() { + savePoint = currentAction; +} + +bool UndoHistory::IsSavePoint() const { + return savePoint == currentAction; +} + +bool UndoHistory::CanUndo() const { + return (currentAction > 0) && (maxAction > 0); +} + +int UndoHistory::StartUndo() { + // Drop any trailing startAction + if (actions[currentAction].at == startAction && currentAction > 0) + currentAction--; + + // Count the steps in this action + int act = currentAction; + while (actions[act].at != startAction && act > 0) { + act--; + } + return currentAction - act; +} + +const Action &UndoHistory::GetUndoStep() const { + return actions[currentAction]; +} + +void UndoHistory::CompletedUndoStep() { + currentAction--; +} + +bool UndoHistory::CanRedo() const { + return maxAction > currentAction; +} + +int UndoHistory::StartRedo() { + // Drop any leading startAction + if (actions[currentAction].at == startAction && currentAction < maxAction) + currentAction++; + + // Count the steps in this action + int act = currentAction; + while (actions[act].at != startAction && act < maxAction) { + act++; + } + return act - currentAction; +} + +const Action &UndoHistory::GetRedoStep() const { + return actions[currentAction]; +} + +void UndoHistory::CompletedRedoStep() { + currentAction++; } CellBuffer::CellBuffer(int initialLength) { body = new char[initialLength]; size = initialLength; length = 0; - part1len = 0; + part1len = 0; gaplen = initialLength; part2body = body + gaplen; readOnly = false; - - lenActions = 100; - actions = new Action[lenActions]; - maxAction = 0; - currentAction = 0; collectingUndo = undoCollectAutoStart; - undoSequenceDepth = 0; - savePoint = 0; - - actions[currentAction].Create(startAction); } CellBuffer::~CellBuffer() { delete []body; body = 0; - delete []actions; - actions = 0; } void CellBuffer::GapTo(int position) { @@ -486,7 +690,7 @@ const char *CellBuffer::InsertString(int position, char *s, int insertLength) { for (int i = 0; i < insertLength / 2; i++) { data[i] = s[i * 2]; } - AppendAction(insertAction, position, data, insertLength / 2); + uh.AppendAction(insertAction, position, data, insertLength / 2); } BasicInsertString(position, s, insertLength); @@ -504,7 +708,7 @@ void CellBuffer::InsertCharStyle(int position, char ch, char style) { bool CellBuffer::SetStyleAt(int position, char style, char mask) { char curVal = ByteAt(position*2 + 1); if ((curVal & mask) != style) { - SetByteAt(position*2 + 1, (curVal & ~mask) | style); + SetByteAt(position*2 + 1, static_cast<char>((curVal & ~mask) | style)); return true; } else { return false; @@ -517,7 +721,7 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mas while (lengthStyle--) { char curVal = ByteAt(bytePos); if ((curVal & mask) != style) { - SetByteAt(bytePos, (curVal & ~mask) | style); + SetByteAt(bytePos, static_cast<char>((curVal & ~mask) | style)); changed = true; } bytePos += 2; @@ -525,48 +729,6 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mas return changed; } -void CellBuffer::EnsureUndoRoom() { - //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, length, currentAction); - if (currentAction >= 2) { - // Have to test that there is room for 2 more actions in the array - // as two actions may be created by this function - if (currentAction >= (lenActions - 2)) { - // Run out of undo nodes so extend the array - int lenActionsNew = lenActions * 2; - Action *actionsNew = new Action[lenActionsNew]; - if (!actionsNew) - return; - for (int act = 0; act <= currentAction; act++) - actionsNew[act].Grab(&actions[act]); - delete []actions; - lenActions = lenActionsNew; - actions = actionsNew; - } - } -} - -void CellBuffer::AppendAction(actionType at, int position, char *data, int lengthData) { - EnsureUndoRoom(); - //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); - if (currentAction >= 2) { - // See if current action can be coalesced into previous action - // Will work if both are inserts or deletes and position is same or two different - if ((at != actions[currentAction - 1].at) || (abs(position - actions[currentAction - 1].position) > 2)) { - currentAction++; - } else if (currentAction == savePoint) { - currentAction++; - } - } else { - currentAction++; - } - actions[currentAction].Create(at, position, data, lengthData); - if ((collectingUndo == undoCollectAutoStart) && (0 == undoSequenceDepth)) { - currentAction++; - actions[currentAction].Create(startAction); - } - maxAction = currentAction; -} - const char *CellBuffer::DeleteChars(int position, int deleteLength) { // InsertString and DeleteChars are the bottleneck though which all changes occur char *data = 0; @@ -577,7 +739,7 @@ const char *CellBuffer::DeleteChars(int position, int deleteLength) { for (int i = 0; i < deleteLength / 2; i++) { data[i] = ByteAt(position + i * 2); } - AppendAction(removeAction, position, data, deleteLength / 2); + uh.AppendAction(removeAction, position, data, deleteLength / 2); } BasicDeleteChars(position, deleteLength); @@ -616,11 +778,11 @@ void CellBuffer::SetReadOnly(bool set) { } void CellBuffer::SetSavePoint() { - savePoint = currentAction; + uh.SetSavePoint(); } bool CellBuffer::IsSavePoint() { - return savePoint == currentAction; + return uh.IsSavePoint(); } int CellBuffer::AddMark(int line, int markerNum) { @@ -792,7 +954,7 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) { undoCollectionType CellBuffer::SetUndoCollection(undoCollectionType collectUndo) { collectingUndo = collectUndo; - undoSequenceDepth = 0; + uh.DropUndoSequence(); return collectingUndo; } @@ -800,69 +962,32 @@ bool CellBuffer::IsCollectingUndo() { return collectingUndo; } -void CellBuffer::AppendUndoStartAction() { - EnsureUndoRoom(); - // Finish any currently active undo sequence - undoSequenceDepth = 0; - if (actions[currentAction].at != startAction) { - undoSequenceDepth++; - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - } -} - void CellBuffer::BeginUndoAction() { - EnsureUndoRoom(); - if (undoSequenceDepth == 0) { - if (actions[currentAction].at != startAction) { - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - } - } - undoSequenceDepth++; + uh.BeginUndoAction(); } void CellBuffer::EndUndoAction() { - EnsureUndoRoom(); - undoSequenceDepth--; - if (0 == undoSequenceDepth) { - if (actions[currentAction].at != startAction) { - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - } - } + uh.EndUndoAction(); } void CellBuffer::DeleteUndoHistory() { - for (int i = 1; i < maxAction; i++) - actions[i].Destroy(); - maxAction = 0; - currentAction = 0; - savePoint = 0; + uh.DeleteUndoHistory(); } bool CellBuffer::CanUndo() { - return (!readOnly) && ((currentAction > 0) && (maxAction > 0)); + return (!readOnly) && (uh.CanUndo()); } int CellBuffer::StartUndo() { - // Drop any trailing startAction - if (actions[currentAction].at == startAction && currentAction > 0) - currentAction--; - - // Count the steps in this action - int act = currentAction; - while (actions[act].at != startAction && act > 0) { - act--; - } - return currentAction - act; + return uh.StartUndo(); +} + +const Action &CellBuffer::GetUndoStep() const { + return uh.GetUndoStep(); } -const Action &CellBuffer::UndoStep() { - const Action &actionStep = actions[currentAction]; +void CellBuffer::PerformUndoStep() { + const Action &actionStep = uh.GetUndoStep(); if (actionStep.at == insertAction) { BasicDeleteChars(actionStep.position, actionStep.lenData*2); } else if (actionStep.at == removeAction) { @@ -874,29 +999,23 @@ const Action &CellBuffer::UndoStep() { BasicInsertString(actionStep.position, styledData, actionStep.lenData*2); delete []styledData; } - currentAction--; - return actionStep; + uh.CompletedUndoStep(); } bool CellBuffer::CanRedo() { - return (!readOnly) && (maxAction > currentAction); + return (!readOnly) && (uh.CanRedo()); } int CellBuffer::StartRedo() { - // Drop any leading startAction - if (actions[currentAction].at == startAction && currentAction < maxAction) - currentAction++; - - // Count the steps in this action - int act = currentAction; - while (actions[act].at != startAction && act < maxAction) { - act++; - } - return act - currentAction; + return uh.StartRedo(); } -const Action &CellBuffer::RedoStep() { - const Action &actionStep = actions[currentAction]; +const Action &CellBuffer::GetRedoStep() const { + return uh.GetRedoStep(); +} + +void CellBuffer::PerformRedoStep() { + const Action &actionStep = uh.GetRedoStep(); if (actionStep.at == insertAction) { char *styledData = new char[actionStep.lenData * 2]; for (int i = 0; i < actionStep.lenData; i++) { @@ -908,8 +1027,7 @@ const Action &CellBuffer::RedoStep() { } else if (actionStep.at == removeAction) { BasicDeleteChars(actionStep.position, actionStep.lenData*2); } - currentAction++; - return actionStep; + uh.CompletedRedoStep(); } int CellBuffer::SetLineState(int line, int state) { diff --git a/src/stc/scintilla/src/CellBuffer.h b/src/stc/scintilla/src/CellBuffer.h index 5fbe2ea8a0..409a8749de 100644 --- a/src/stc/scintilla/src/CellBuffer.h +++ b/src/stc/scintilla/src/CellBuffer.h @@ -79,16 +79,55 @@ public: int position; char *data; int lenData; + bool mayCoalesce; Action(); ~Action(); - void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0); + void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0, bool mayCoalesce_=true); void Destroy(); void Grab(Action *source); }; enum undoCollectionType { undoCollectNone, undoCollectAutoStart, undoCollectManualStart }; +class UndoHistory { + Action *actions; + int lenActions; + int maxAction; + int currentAction; + int undoSequenceDepth; + int savePoint; + + void EnsureUndoRoom(); + +public: + UndoHistory(); + ~UndoHistory(); + + void AppendAction(actionType at, int position, char *data, int length); + + void BeginUndoAction(); + void EndUndoAction(); + void DropUndoSequence(); + void DeleteUndoHistory(); + + // The save point is a marker in the undo stack where the container has stated that + // the buffer was saved. Undo and redo can move over the save point. + void SetSavePoint(); + bool IsSavePoint() const; + + // To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is + // called that many times. Similarly for redo. + bool CanUndo() const; + int StartUndo(); + const Action &GetUndoStep() const; + void CompletedUndoStep(); + bool CanRedo() const; + int StartRedo(); + const Action &GetRedoStep() const; + void CompletedRedoStep(); +}; + // Holder for an expandable array of characters that supports undo and line markers // Based on article "Data Structures in a Bit-Mapped Text Editor" // by Wilfred J. Hansen, Byte January 1987, page 183 @@ -102,13 +141,8 @@ private: char *part2body; bool readOnly; - Action *actions; - int lenActions; - int maxAction; - int currentAction; undoCollectionType collectingUndo; - int undoSequenceDepth; - int savePoint; + UndoHistory uh; LineVector lv; @@ -117,9 +151,6 @@ private: void GapTo(int position); void RoomFor(int insertionLength); - void EnsureUndoRoom(); - void AppendAction(actionType at, int position, char *data, int length); - inline char ByteAt(int position); void SetByteAt(int position, char ch); @@ -143,7 +174,7 @@ public: // Setting styles for positions outside the range of the buffer is safe and has no effect. // True is returned if the style of a character changed. - bool SetStyleAt(int position, char style, char mask=(char)0xff); + bool SetStyleAt(int position, char style, char mask='\377'); bool SetStyleFor(int position, int length, char style, char mask); const char *DeleteChars(int position, int deleteLength); @@ -170,19 +201,20 @@ public: undoCollectionType SetUndoCollection(undoCollectionType collectUndo); bool IsCollectingUndo(); - void AppendUndoStartAction(); void BeginUndoAction(); void EndUndoAction(); void DeleteUndoHistory(); - // To perform an undo, StartUndo is called to retreive the number of steps, then UndoStep is + // To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is // called that many times. Similarly for redo. bool CanUndo(); int StartUndo(); - const Action &UndoStep(); + const Action &GetUndoStep() const; + void PerformUndoStep(); bool CanRedo(); int StartRedo(); - const Action &RedoStep(); + const Action &GetRedoStep() const; + void PerformRedoStep(); int SetLineState(int line, int state); int GetLineState(int line); diff --git a/src/stc/scintilla/src/ContractionState.cxx b/src/stc/scintilla/src/ContractionState.cxx index 6f41461eb1..4569489003 100644 --- a/src/stc/scintilla/src/ContractionState.cxx +++ b/src/stc/scintilla/src/ContractionState.cxx @@ -30,7 +30,6 @@ void ContractionState::MakeValid() const { if (!valid) { // Could be cleverer by keeping the index of the last still valid entry // rather than invalidating all. - int linePrev = -1; int lineDisplay = 0; for (int line=0; line<linesInDoc; line++) { lines[line].displayLine = lineDisplay; @@ -108,12 +107,12 @@ void ContractionState::InsertLines(int lineDoc, int lineCount) { return; } //Platform::DebugPrintf("InsertLine[%d] = %d\n", lineDoc); - if ((linesInDoc + 2) >= size) { - Grow(size + growSize); + if ((linesInDoc + lineCount + 2) >= size) { + Grow(linesInDoc + lineCount + growSize); } linesInDoc += lineCount; linesInDisplay += lineCount; - for (int i = linesInDoc + 1; i >= lineDoc + lineCount; i--) { + for (int i = linesInDoc; i >= lineDoc + lineCount; i--) { lines[i].visible = lines[i - lineCount].visible; lines[i].expanded = lines[i - lineCount].expanded; } @@ -130,16 +129,18 @@ void ContractionState::DeleteLines(int lineDoc, int lineCount) { linesInDisplay -= lineCount; return; } - int delta = 0; - for (int d=0;d<lineCount;d++) + int deltaDisplayed = 0; + for (int d=0;d<lineCount;d++) { if (lines[lineDoc+d].visible) - delta--; + deltaDisplayed--; + } for (int i = lineDoc; i < linesInDoc-lineCount; i++) { - lines[i].visible = lines[i + lineCount].visible; + if (i != 0) // Line zero is always visible + lines[i].visible = lines[i + lineCount].visible; lines[i].expanded = lines[i + lineCount].expanded; } linesInDoc -= lineCount; - linesInDisplay += delta; + linesInDisplay += deltaDisplayed; valid = false; } @@ -154,8 +155,12 @@ bool ContractionState::GetVisible(int lineDoc) const { } bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible) { + if (lineDocStart == 0) + lineDocStart++; + if (lineDocStart > lineDocEnd) + return false; if (size == 0) { - Grow(lineDocEnd + growSize); + Grow(linesInDoc + growSize); } // TODO: modify docLine members to mirror displayLine int delta = 0; @@ -191,7 +196,7 @@ bool ContractionState::GetExpanded(int lineDoc) const { bool ContractionState::SetExpanded(int lineDoc, bool expanded) { if (size == 0) { - Grow(lineDoc + growSize); + Grow(linesInDoc + growSize); } if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { if (lines[lineDoc].expanded != expanded) { diff --git a/src/stc/scintilla/src/Document.cxx b/src/stc/scintilla/src/Document.cxx index 7d832241fc..6614a7fc98 100644 --- a/src/stc/scintilla/src/Document.cxx +++ b/src/stc/scintilla/src/Document.cxx @@ -32,7 +32,10 @@ Document::Document() { } endStyled = 0; enteredCount = 0; + enteredReadOnlyCount = 0; tabInChars = 8; + indentInChars = 0; + useTabs = true; watchers = 0; lenWatchers = 0; } @@ -65,26 +68,54 @@ void Document::SetSavePoint() { NotifySavePoint(true); } -int Document::LineStart(int line) { - return cb.LineStart(line); +int Document::AddMark(int line, int markerNum) { + int prev = cb.AddMark(line, markerNum); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); + NotifyModified(mh); + return prev; } -int Document::LineFromPosition(int pos) { - return cb.LineFromPosition(pos); +void Document::DeleteMark(int line, int markerNum) { + cb.DeleteMark(line, markerNum); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); + NotifyModified(mh); } -int Document::LineEndPosition(int position) { - int line = LineFromPosition(position); +void Document::DeleteMarkFromHandle(int markerHandle) { + cb.DeleteMarkFromHandle(markerHandle); + DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); + NotifyModified(mh); +} + +void Document::DeleteAllMarks(int markerNum) { + cb.DeleteAllMarks(markerNum); + DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); + NotifyModified(mh); +} + +int Document::LineStart(int line) { + return cb.LineStart(line); +} + +int Document::LineEnd(int line) { if (line == LinesTotal() - 1) { - position = LineStart(line + 1); + return LineStart(line + 1); } else { - position = LineStart(line + 1) - 1; + int position = LineStart(line + 1) - 1; // When line terminator is CR+LF, may need to go back one more if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { position--; } + return position; } - return position; +} + +int Document::LineFromPosition(int pos) { + return cb.LineFromPosition(pos); +} + +int Document::LineEndPosition(int position) { + return LineEnd(LineFromPosition(position)); } int Document::VCHomePosition(int position) { @@ -124,7 +155,10 @@ int Document::GetLastChild(int lineParent, int level) { level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK; int maxLine = LinesTotal(); int lineMaxSubord = lineParent; - while ((lineMaxSubord < maxLine-1) && IsSubordinate(level, GetLevel(lineMaxSubord+1))) { + while (lineMaxSubord < maxLine-1) { + EnsureStyledTo(LineStart(lineMaxSubord+2)); + if (!IsSubordinate(level, GetLevel(lineMaxSubord+1))) + break; lineMaxSubord++; } if (lineMaxSubord > lineParent) { @@ -170,18 +204,23 @@ bool Document::IsCrLf(int pos) { bool Document::IsDBCS(int pos) { #if PLAT_WIN if (dbcsCodePage) { - // Anchor DBCS calculations at start of line because start of line can - // not be a DBCS trail byte. - int startLine = pos; - while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n') - startLine--; - while (startLine <= pos) { - if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) { + if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); + return ch >= 0x80; + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. + int startLine = pos; + while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n') + startLine--; + while (startLine <= pos) { + if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) { + startLine++; + if (startLine >= pos) + return true; + } startLine++; - if (startLine >= pos) - return true; } - startLine++; } } return false; @@ -190,6 +229,28 @@ bool Document::IsDBCS(int pos) { #endif } +int Document::LenChar(int pos) { + if (IsCrLf(pos)) { + return 2; + } else if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); + if (ch < 0x80) + return 1; + int len = 2; + if (ch >= (0x80+0x40+0x20)) + len = 3; + int lengthDoc = Length(); + if ((pos + len) > lengthDoc) + return lengthDoc-pos; + else + return len; + } else if (IsDBCS(pos)) { + return 2; + } else { + return 1; + } +} + // Normalise a position so that it is not halfway through a two byte character. // This can occur in two situations - // When lines are terminated with \r\n pairs which should be treated as one character. @@ -221,29 +282,41 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { #if PLAT_WIN if (dbcsCodePage) { - // Anchor DBCS calculations at start of line because start of line can - // not be a DBCS trail byte. - int startLine = pos; - while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n') - startLine--; - bool atLeadByte = false; - while (startLine < pos) { - if (atLeadByte) - atLeadByte = false; - else if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) - atLeadByte = true; - else - atLeadByte = false; - startLine++; - //Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-"); - } + if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); + while ((pos > 0) && (pos < Length()) && (ch >= 0x80) && (ch < (0x80 + 0x40))) { + // ch is a trail byte + if (moveDir > 0) + pos++; + else + pos--; + ch = static_cast<unsigned char>(cb.CharAt(pos)); + } + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. + int startLine = pos; + while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n') + startLine--; + bool atLeadByte = false; + while (startLine < pos) { + if (atLeadByte) + atLeadByte = false; + else if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) + atLeadByte = true; + else + atLeadByte = false; + startLine++; + //Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-"); + } - if (atLeadByte) { - // Position is between a lead byte and a trail byte - if (moveDir > 0) - return pos + 1; - else - return pos - 1; + if (atLeadByte) { + // Position is between a lead byte and a trail byte + if (moveDir > 0) + return pos + 1; + else + return pos - 1; + } } } #endif @@ -261,41 +334,60 @@ void Document::ModifiedAt(int pos) { // Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number void Document::DeleteChars(int pos, int len) { + if (cb.IsReadOnly() && enteredReadOnlyCount==0) { + enteredReadOnlyCount++; + NotifyModifyAttempt(); + enteredReadOnlyCount--; + } if (enteredCount == 0) { enteredCount++; - if (cb.IsReadOnly()) - NotifyModifyAttempt(); if (!cb.IsReadOnly()) { + NotifyModified( + DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, + pos, len, + 0, 0)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); const char *text = cb.DeleteChars(pos*2, len * 2); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); ModifiedAt(pos); - int modFlags = SC_MOD_DELETETEXT | SC_PERFORMED_USER; - DocModification mh(modFlags, pos, len, LinesTotal() - prevLinesTotal, text); - NotifyModified(mh); + NotifyModified( + DocModification( + SC_MOD_DELETETEXT | SC_PERFORMED_USER, + pos, len, + LinesTotal() - prevLinesTotal, text)); } enteredCount--; } } void Document::InsertStyledString(int position, char *s, int insertLength) { + if (cb.IsReadOnly() && enteredReadOnlyCount==0) { + enteredReadOnlyCount++; + NotifyModifyAttempt(); + enteredReadOnlyCount--; + } if (enteredCount == 0) { enteredCount++; - if (cb.IsReadOnly()) - NotifyModifyAttempt(); if (!cb.IsReadOnly()) { + NotifyModified( + DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, + position / 2, insertLength / 2, + 0, 0)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); const char *text = cb.InsertString(position, s, insertLength); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); ModifiedAt(position / 2); - - int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER; - DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text); - NotifyModified(mh); + NotifyModified( + DocModification( + SC_MOD_INSERTTEXT | SC_PERFORMED_USER, + position / 2, insertLength / 2, + LinesTotal() - prevLinesTotal, text)); } enteredCount--; } @@ -307,9 +399,18 @@ int Document::Undo() { enteredCount++; bool startSavePoint = cb.IsSavePoint(); int steps = cb.StartUndo(); + //Platform::DebugPrintf("Steps=%d\n", steps); for (int step=0; step<steps; step++) { int prevLinesTotal = LinesTotal(); - const Action &action = cb.UndoStep(); + const Action &action = cb.GetUndoStep(); + if (action.at == removeAction) { + NotifyModified(DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); + } else { + NotifyModified(DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); + } + cb.PerformUndoStep(); int cellPosition = action.position / 2; ModifiedAt(cellPosition); newPos = cellPosition; @@ -344,10 +445,17 @@ int Document::Redo() { int steps = cb.StartRedo(); for (int step=0; step<steps; step++) { int prevLinesTotal = LinesTotal(); - const Action &action = cb.RedoStep(); - int cellPosition = action.position / 2; - ModifiedAt(cellPosition); - newPos = cellPosition; + const Action &action = cb.GetRedoStep(); + if (action.at == insertAction) { + NotifyModified(DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); + } else { + NotifyModified(DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); + } + cb.PerformRedoStep(); + ModifiedAt(action.position / 2); + newPos = action.position / 2; int modFlags = SC_PERFORMED_REDO; if (action.at == insertAction) { @@ -358,7 +466,8 @@ int Document::Redo() { } if (step == steps-1) modFlags |= SC_LASTSTEPINUNDOREDO; - NotifyModified(DocModification(modFlags, cellPosition, action.lenData, + NotifyModified( + DocModification(modFlags, action.position / 2, action.lenData, LinesTotal() - prevLinesTotal, action.data)); } @@ -395,14 +504,13 @@ void Document::InsertString(int position, const char *s, int insertLength) { } } +void Document::ChangeChar(int pos, char ch) { + DeleteChars(pos, 1); + InsertChar(pos, ch); +} + void Document::DelChar(int pos) { - if (IsCrLf(pos)) { - DeleteChars(pos, 2); - } else if (IsDBCS(pos)) { - DeleteChars(pos, 2); - } else if (pos < Length()) { - DeleteChars(pos, 1); - } + DeleteChars(pos, LenChar(pos)); } int Document::DelCharBack(int pos) { @@ -411,6 +519,10 @@ int Document::DelCharBack(int pos) { } else if (IsCrLf(pos - 2)) { DeleteChars(pos - 2, 2); return pos - 2; + } else if (SC_CP_UTF8 == dbcsCodePage) { + int startChar = MovePositionOutsideChar(pos-1, -1, false); + DeleteChars(startChar, pos - startChar); + return startChar; } else if (IsDBCS(pos - 1)) { DeleteChars(pos - 2, 2); return pos - 2; @@ -420,28 +532,81 @@ int Document::DelCharBack(int pos) { } } -void Document::Indent(bool forwards, int lineBottom, int lineTop) { - if (forwards) { - // Indent by a tab - for (int line = lineBottom; line >= lineTop; line--) { - InsertChar(LineStart(line), '\t'); +static bool isindentchar(char ch) { + return (ch == ' ') || (ch == '\t'); +} + +static int NextTab(int pos, int tabSize) { + return ((pos / tabSize) + 1) * tabSize; +} + +static void CreateIndentation(char *linebuf, int length, int indent, int tabSize, bool insertSpaces) { + length--; // ensure space for \0 + if (!insertSpaces) { + while ((indent >= tabSize) && (length > 0)) { + *linebuf++ = '\t'; + indent -= tabSize; + length--; } - } else { - // Dedent - suck white space off the front of the line to dedent by equivalent of a tab - for (int line = lineBottom; line >= lineTop; line--) { - int ispc = 0; - while (ispc < tabInChars && cb.CharAt(LineStart(line) + ispc) == ' ') - ispc++; - int posStartLine = LineStart(line); - if (ispc == tabInChars) { - DeleteChars(posStartLine, ispc); - } else if (cb.CharAt(posStartLine + ispc) == '\t') { - DeleteChars(posStartLine, ispc + 1); - } else { // Hit a non-white - DeleteChars(posStartLine, ispc); - } + } + while ((indent > 0) && (length > 0)) { + *linebuf++ = ' '; + indent--; + length--; + } + *linebuf = '\0'; +} + +int Document::GetLineIndentation(int line) { + int indent = 0; + if ((line >= 0) && (line < LinesTotal())) { + int lineStart = LineStart(line); + int length = Length(); + for (int i=lineStart;i<length;i++) { + char ch = cb.CharAt(i); + if (ch == ' ') + indent++; + else if (ch == '\t') + indent = NextTab(indent, tabInChars); + else + return indent; } } + return indent; +} + +void Document::SetLineIndentation(int line, int indent) { + int indentOfLine = GetLineIndentation(line); + if (indent < 0) + indent = 0; + if (indent != indentOfLine) { + char linebuf[1000]; + CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs); + int thisLineStart = LineStart(line); + int indentPos = GetLineIndentPosition(line); + DeleteChars(thisLineStart, indentPos - thisLineStart); + InsertString(thisLineStart, linebuf); + } +} + +int Document::GetLineIndentPosition(int line) { + int pos = LineStart(line); + int length = Length(); + while ((pos < length) && isindentchar(cb.CharAt(pos))) { + pos++; + } + return pos; +} + +void Document::Indent(bool forwards, int lineBottom, int lineTop) { + // Dedent - suck white space off the front of the line to dedent by equivalent of a tab + for (int line = lineBottom; line >= lineTop; line--) { + int indentOfLine = GetLineIndentation(line); + if (forwards) + SetLineIndentation(line, indentOfLine + IndentSize()); + else + SetLineIndentation(line, indentOfLine - IndentSize()); + } } void Document::ConvertLineEnds(int eolModeSet) { @@ -485,6 +650,8 @@ void Document::ConvertLineEnds(int eolModeSet) { } bool Document::IsWordChar(unsigned char ch) { + if ((SC_CP_UTF8 == dbcsCodePage) && (ch >0x80)) + return true; return wordchars[ch]; } @@ -551,16 +718,14 @@ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitiv // Compute actual search ranges needed int lengthFind = strlen(s); - int endSearch = 0; + int endSearch = endPos; if (startPos <= endPos) { endSearch = endPos - lengthFind + 1; - } else { - endSearch = endPos; } //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); char firstChar = s[0]; if (!caseSensitive) - firstChar = toupper(firstChar); + firstChar = static_cast<char>(toupper(firstChar)); int pos = startPos; while (forward ? (pos < endSearch) : (pos >= endSearch)) { char ch = CharAt(pos); @@ -605,6 +770,25 @@ int Document::LinesTotal() { return cb.Lines(); } +void Document::ChangeCase(Range r, bool makeUpperCase) { + for (int pos=r.start; pos<r.end; pos++) { + char ch = CharAt(pos); + if (dbcsCodePage && IsDBCS(pos)) { + pos += LenChar(pos); + } else { + if (makeUpperCase) { + if (islower(ch)) { + ChangeChar(pos, static_cast<char>(toupper(ch))); + } + } else { + if (isupper(ch)) { + ChangeChar(pos, static_cast<char>(tolower(ch))); + } + } + } + } +} + void Document::SetWordChars(unsigned char *chars) { int ch; for (ch = 0; ch < 256; ch++) { @@ -671,6 +855,13 @@ void Document::SetStyles(int length, char *styles) { } } +bool Document::EnsureStyledTo(int pos) { + // Ask the watchers to style, and stop as soon as one responds. + for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) + watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos); + return pos <= GetEndStyled(); +} + bool Document::AddWatcher(DocWatcher *watcher, void *userData) { for (int i = 0; i < lenWatchers; i++) { if ((watchers[i].watcher == watcher) && diff --git a/src/stc/scintilla/src/Document.h b/src/stc/scintilla/src/Document.h index fba611c7f7..92e4ff14fe 100644 --- a/src/stc/scintilla/src/Document.h +++ b/src/stc/scintilla/src/Document.h @@ -74,9 +74,10 @@ private: CellBuffer cb; bool wordchars[256]; int stylingPos; - int stylingMask; + char stylingMask; int endStyled; int enteredCount; + int enteredReadOnlyCount; WatcherWithUserData *watchers; int lenWatchers; @@ -86,8 +87,11 @@ public: int stylingBitsMask; int eolMode; + // dbcsCodePage can also be SC_CP_UTF8 to enable UTF-8 mode int dbcsCodePage; int tabInChars; + int indentInChars; + bool useTabs; Document(); virtual ~Document(); @@ -98,6 +102,7 @@ public: int LineFromPosition(int pos); int ClampPositionIntoDocument(int pos); bool IsCrLf(int pos); + int LenChar(int pos); int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); // Gateways to modifying document @@ -111,11 +116,14 @@ public: undoCollectionType SetUndoCollection(undoCollectionType collectUndo) { return cb.SetUndoCollection(collectUndo); } - void AppendUndoStartAction() { cb.AppendUndoStartAction(); } void BeginUndoAction() { cb.BeginUndoAction(); } void EndUndoAction() { cb.EndUndoAction(); } void SetSavePoint(); bool IsSavePoint() { return cb.IsSavePoint(); } + + int GetLineIndentation(int line); + void SetLineIndentation(int line, int indent); + int GetLineIndentPosition(int line); void Indent(bool forwards, int lineBottom, int lineTop); void ConvertLineEnds(int eolModeSet); void SetReadOnly(bool set) { cb.SetReadOnly(set); } @@ -123,6 +131,7 @@ public: void InsertChar(int pos, char ch); void InsertString(int position, const char *s); void InsertString(int position, const char *s, int insertLength); + void ChangeChar(int pos, char ch); void DelChar(int pos); int DelCharBack(int pos); @@ -132,12 +141,13 @@ public: } char StyleAt(int position) { return cb.StyleAt(position); } int GetMark(int line) { return cb.GetMark(line); } - int AddMark(int line, int markerNum) { return cb.AddMark(line, markerNum); } - void DeleteMark(int line, int markerNum) { cb.DeleteMark(line, markerNum); } - void DeleteMarkFromHandle(int markerHandle) { cb.DeleteMarkFromHandle(markerHandle); } - void DeleteAllMarks(int markerNum) { cb.DeleteAllMarks(markerNum); } + int AddMark(int line, int markerNum); + void DeleteMark(int line, int markerNum); + void DeleteMarkFromHandle(int markerHandle); + void DeleteAllMarks(int markerNum); int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); } int LineStart(int line); + int LineEnd(int line); int LineEndPosition(int position); int VCHomePosition(int position); @@ -154,12 +164,15 @@ public: long FindText(WORD iMessage,WPARAM wParam,LPARAM lParam); int LinesTotal(); + void ChangeCase(Range r, bool makeUpperCase); + void SetWordChars(unsigned char *chars); void SetStylingBits(int bits); void StartStyling(int position, char mask); void SetStyleFor(int length, char style); void SetStyles(int length, char *styles); int GetEndStyled() { return endStyled; } + bool EnsureStyledTo(int pos); int SetLineState(int line, int state) { return cb.SetLineState(line, state); } int GetLineState(int line) { return cb.GetLineState(line); } @@ -175,10 +188,12 @@ private: bool IsWordChar(unsigned char ch); bool IsWordAt(int start, int end); void ModifiedAt(int pos); - + void NotifyModifyAttempt(); void NotifySavePoint(bool atSavePoint); void NotifyModified(DocModification mh); + + int IndentSize() { return indentInChars ? indentInChars : tabInChars; } }; // To optimise processing of document modifications by DocWatchers, a hint is passed indicating the @@ -205,6 +220,16 @@ public: line(0), foldLevelNow(0), foldLevelPrev(0) {} + + DocModification(int modificationType_, const Action &act, int linesAdded_=0) : + modificationType(modificationType_), + position(act.position / 2), + length(act.lenData), + linesAdded(linesAdded_), + text(act.data), + line(0), + foldLevelNow(0), + foldLevelPrev(0) {} }; // A class that wants to receive notifications from a Document must be derived from DocWatcher @@ -217,6 +242,7 @@ public: virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0; virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0; virtual void NotifyDeleted(Document *doc, void *userData) = 0; + virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0; }; #endif diff --git a/src/stc/scintilla/src/DocumentAccessor.cxx b/src/stc/scintilla/src/DocumentAccessor.cxx new file mode 100644 index 0000000000..d28840c166 --- /dev/null +++ b/src/stc/scintilla/src/DocumentAccessor.cxx @@ -0,0 +1,174 @@ +// SciTE - Scintilla based Text Editor +// Accessor.cxx - rapid easy access to contents of a Scintilla +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <ctype.h> +#include <stdio.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "SVector.h" +#include "Accessor.h" +#include "DocumentAccessor.h" +#include "CellBuffer.h" +#include "Scintilla.h" +#include "Document.h" + +DocumentAccessor::~DocumentAccessor() { +} + +bool DocumentAccessor::InternalIsLeadByte(char ch) { +#if PLAT_GTK + // TODO: support DBCS under GTK+ + return false; +#elif PLAT_WIN + if (SC_CP_UTF8 == codePage) + // For lexing, all characters >= 0x80 are treated the + // same so none is considered a lead byte. + return false; + else + return IsDBCSLeadByteEx(codePage, ch); +#elif PLAT_WX + return false; +#endif +} + +void DocumentAccessor::Fill(int position) { + if (lenDoc == -1) + lenDoc = pdoc->Length(); + startPos = position - slopSize; + if (startPos + bufferSize > lenDoc) + startPos = lenDoc - bufferSize; + if (startPos < 0) + startPos = 0; + endPos = startPos + bufferSize; + if (endPos > lenDoc) + endPos = lenDoc; + + pdoc->GetCharRange(buf, startPos, endPos-startPos); + buf[endPos-startPos] = '\0'; +} + +char DocumentAccessor::StyleAt(int position) { + return pdoc->StyleAt(position); +} + +int DocumentAccessor::GetLine(int position) { + return pdoc->LineFromPosition(position); +} + +int DocumentAccessor::LineStart(int line) { + return pdoc->LineStart(line); +} + +int DocumentAccessor::LevelAt(int line) { + return pdoc->GetLevel(line); +} + +int DocumentAccessor::Length() { + if (lenDoc == -1) + lenDoc = pdoc->Length(); + return lenDoc; +} + +int DocumentAccessor::GetLineState(int line) { + return pdoc->GetLineState(line); +} + +int DocumentAccessor::SetLineState(int line, int state) { + return pdoc->SetLineState(line, state); +} + +void DocumentAccessor::StartAt(unsigned int start, char chMask) { + pdoc->StartStyling(start, chMask); +} + +void DocumentAccessor::StartSegment(unsigned int pos) { + startSeg = pos; +} + +void DocumentAccessor::ColourTo(unsigned int pos, int chAttr) { + // Only perform styling if non empty range + if (pos != startSeg - 1) { + if (pos < startSeg) { + Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos); + } + + if (validLen + (pos - startSeg + 1) >= bufferSize) + Flush(); + if (validLen + (pos - startSeg + 1) >= bufferSize) { + // Too big for buffer so send directly + pdoc->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr)); + } else { + if (chAttr != chWhile) + chFlags = 0; + chAttr |= chFlags; + for (unsigned int i = startSeg; i <= pos; i++) { + styleBuf[validLen++] = static_cast<char>(chAttr); + } + } + } + startSeg = pos+1; +} + +void DocumentAccessor::SetLevel(int line, int level) { + pdoc->SetLevel(line, level); +} + +void DocumentAccessor::Flush() { + startPos = extremePosition; + lenDoc = -1; + if (validLen > 0) { + pdoc->SetStyles(validLen, styleBuf); + validLen = 0; + } +} + +int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { + int end = Length(); + int spaceFlags = 0; + + // Determines the indentation level of the current line and also checks for consistent + // indentation compared to the previous line. + // Indentation is judged consistent when the indentation whitespace of each line lines + // the same or the indentation of one line is a prefix of the other. + + int pos = LineStart(line); + char ch = (*this)[pos]; + int indent = 0; + bool inPrevPrefix = line > 0; + int posPrev = inPrevPrefix ? LineStart(line-1) : 0; + while ((ch == ' ' || ch == '\t') && (pos < end)) { + if (inPrevPrefix) { + char chPrev = (*this)[posPrev++]; + if (chPrev == ' ' || chPrev == '\t') { + if (chPrev != ch) + spaceFlags |= wsInconsistent; + } else { + inPrevPrefix = false; + } + } + if (ch == ' ') { + spaceFlags |= wsSpace; + indent++; + } else { // Tab + spaceFlags |= wsTab; + if (spaceFlags & wsSpace) + spaceFlags |= wsSpaceTab; + indent = (indent / 8 + 1) * 8; + } + ch = (*this)[++pos]; + } + + *flags = spaceFlags; + indent += SC_FOLDLEVELBASE; + // if completely empty line or the start of a comment... + if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) + return indent | SC_FOLDLEVELWHITEFLAG; + else + return indent; +} + diff --git a/src/stc/scintilla/src/DocumentAccessor.h b/src/stc/scintilla/src/DocumentAccessor.h new file mode 100644 index 0000000000..37a9db4149 --- /dev/null +++ b/src/stc/scintilla/src/DocumentAccessor.h @@ -0,0 +1,49 @@ +// DocumentAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +class Document; + +class DocumentAccessor : public Accessor { + // Private so DocumentAccessor objects can not be copied + DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {} + DocumentAccessor &operator=(const DocumentAccessor &) { return *this; } +protected: + Document *pdoc; + PropSet &props; + int lenDoc; + + char styleBuf[bufferSize]; + int validLen; + char chFlags; + char chWhile; + unsigned int startSeg; + + bool InternalIsLeadByte(char ch); + void Fill(int position); +public: + DocumentAccessor(Document *pdoc_, PropSet &props_) : + Accessor(), pdoc(pdoc_), props(props_), + lenDoc(-1), validLen(0), chFlags(0) { + } + ~DocumentAccessor(); + char StyleAt(int position); + int GetLine(int position); + int LineStart(int line); + int LevelAt(int line); + int Length(); + void Flush(); + int GetLineState(int line); + int SetLineState(int line, int state); + int GetPropertyInt(const char *key, int defaultValue=0) { + return props.GetInt(key, defaultValue); + } + + void StartAt(unsigned int start, char chMask=31); + void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; + unsigned int GetStartSegment() { return startSeg; } + void StartSegment(unsigned int pos); + void ColourTo(unsigned int pos, int chAttr); + void SetLevel(int line, int level); + int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); +}; diff --git a/src/stc/scintilla/src/Editor.cxx b/src/stc/scintilla/src/Editor.cxx index 6508c95b1f..ad8bab8c5f 100644 --- a/src/stc/scintilla/src/Editor.cxx +++ b/src/stc/scintilla/src/Editor.cxx @@ -69,6 +69,7 @@ Editor::Editor() { xOffset = 0; xCaretMargin = 50; + horizontalScrollBarVisible = true; currentPos = 0; anchor = 0; @@ -88,6 +89,8 @@ Editor::Editor() { modEventMask = SC_MODEVENTMASKALL; + displayPopupMenu = true; + pdoc = new Document(); pdoc ->AddRef(); pdoc->AddWatcher(this, 0); @@ -187,7 +190,7 @@ bool IsControlCharacter(char ch) { return ch >= 0 && ch < ' '; } -const char *ControlCharacterString(char ch) { +const char *ControlCharacterString(unsigned char ch) { const char *reps[] = { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", @@ -208,6 +211,7 @@ Point Editor::LocationFromPosition(unsigned int pos) { //Platform::DebugPrintf("line=%d\n", line); Surface surface; surface.Init(); + surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); Point pt; pt.y = (lineVisible - topLine) * vs.lineHeight; // + half a lineheight? unsigned int posLineStart = pdoc->LineStart(line); @@ -250,6 +254,7 @@ int Editor::PositionFromLocation(Point pt) { //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine); Surface surface; surface.Init(); + surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); unsigned int posLineStart = pdoc->LineStart(line); LineLayout ll; @@ -271,6 +276,7 @@ int Editor::PositionFromLineX(int line, int x) { //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine); Surface surface; surface.Init(); + surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); unsigned int posLineStart = pdoc->LineStart(line); LineLayout ll; @@ -483,7 +489,7 @@ void Editor::ScrollTo(int line) { } } -void Editor::ScrollText(int linesToMove) { +void Editor::ScrollText(int /* linesToMove */) { //Platform::DebugPrintf("Editor::ScrollText %d\n", linesToMove); Redraw(); } @@ -497,6 +503,19 @@ void Editor::HorizontalScrollTo(int xPos) { Redraw(); } +void Editor::MoveCaretInsideView() { + PRectangle rcClient = GetTextRectangle(); + Point pt = LocationFromPosition(currentPos); + if (pt.y < rcClient.top) { + MovePositionTo(PositionFromLocation( + Point(lastXChosen, rcClient.top))); + } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { + int yOfLastLineFullyDisplayed = rcClient.top + (LinesOnScreen()-1) * vs.lineHeight; + MovePositionTo(PositionFromLocation( + Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed))); + } +} + void Editor::EnsureCaretVisible(bool useMargin) { //Platform::DebugPrintf("EnsureCaretVisible %d\n", xOffset); PRectangle rcClient = GetTextRectangle(); @@ -631,7 +650,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { int line = cs.DocFromDisplay(visibleLine); int yposScreen = 0; - while (line < pdoc->LinesTotal() && yposScreen < rcMargin.bottom) { + while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) { int marks = pdoc->GetMark(line); if (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) { if (cs.GetExpanded(line)) { @@ -648,13 +667,12 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { char number[100]; number[0] = '\0'; sprintf(number, "%d", line + 1); - if (foldFlags & 8) + if (foldFlags & 64) sprintf(number, "%X", pdoc->GetLevel(line)); - int xpos = 0; PRectangle rcNumber=rcMarker; // Right justify int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, strlen(number)); - xpos = rcNumber.right - width - 3; + int xpos = rcNumber.right - width - 3; rcNumber.left = xpos; if ((visibleLine < cs.LinesDisplayed()) && cs.GetVisible(line)) { surface->DrawText(rcNumber, vs.styles[STYLE_LINENUMBER].font, @@ -718,8 +736,8 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou styleByte = pdoc->StyleAt(charInDoc); if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) { ll.chars[numCharsInLine] = chDoc; - ll.styles[numCharsInLine] = styleByte & styleMask; - ll.indicators[numCharsInLine] = styleByte & ~styleMask; + ll.styles[numCharsInLine] = static_cast<char>(styleByte & styleMask); + ll.indicators[numCharsInLine] = static_cast<char>(styleByte & ~styleMask); numCharsInLine++; } } @@ -853,7 +871,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int xStart, } else { rcSegment.left = ll.positions[startseg] + xStart; rcSegment.right = ll.positions[i + 1] + xStart; - // Only try do draw if really visible - enhances performance by not calling environment to + // Only try to draw if really visible - enhances performance by not calling environment to // draw strings that are completely past the right side of the window. if (rcSegment.left <= rcLine.right) { surface->DrawText(rcSegment, textFont, @@ -871,6 +889,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int xStart, } } } + if (vsDraw.styles[styleMain].underline) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + surface->FillRectangle(rcUL, textFore); + } } startseg = i + 1; } @@ -991,10 +1015,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { ypos += screenLinePaintFirst * vs.lineHeight; int yposScreen = screenLinePaintFirst * vs.lineHeight; - if (endPosPaint > pdoc->GetEndStyled()) { - // Notify container to do some more styling - NotifyStyleNeeded(endPosPaint); - } + // Ensure we are styled as far as we are painting. + pdoc->EnsureStyledTo(endPosPaint); + if (needUpdateUI) { NotifyUpdateUI(); needUpdateUI = false; @@ -1009,21 +1032,20 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { } if (paintState == paintAbandoned) { - // Either NotifyStyleNeeded or NotifyUpdateUI noticed that painting is needed + // Either styling or NotifyUpdateUI noticed that painting is needed // outside the current painting rectangle //Platform::DebugPrintf("Abandoning paint\n"); return; } //Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset); - Surface *surface = 0; if (rcArea.right > vs.fixedColumnWidth) { + Surface *surface = surfaceWindow; if (bufferedDraw) { surface = &pixmapLine; - } else { - surface = surfaceWindow; } + surface->SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); int visibleLine = topLine + screenLinePaintFirst; int line = cs.DocFromDisplay(visibleLine); @@ -1059,27 +1081,38 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { // Highlight the current braces if any if ((braces[0] >= posLineStart) && (braces[0] < posLineEnd)) - ll.styles[braces[0] - posLineStart] = bracesMatchStyle; + ll.styles[braces[0] - posLineStart] = + static_cast<char>(bracesMatchStyle); if ((braces[1] >= posLineStart) && (braces[1] < posLineEnd)) - ll.styles[braces[1] - posLineStart] = bracesMatchStyle; + ll.styles[braces[1] - posLineStart] = + static_cast<char>(bracesMatchStyle); // Draw the line if (cs.GetVisible(line)) DrawLine(surface, vs, line, xStart, rcLine, ll); - if (foldFlags & 2) { + bool expanded = cs.GetExpanded(line); + if ( (expanded && (foldFlags & 2)) || (!expanded && (foldFlags & 4)) ) { if (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) { PRectangle rcFoldLine = rcLine; rcFoldLine.bottom = rcFoldLine.top + 1; surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); } } + if ( (expanded && (foldFlags & 8)) || (!expanded && (foldFlags & 16)) ) { + if (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) { + PRectangle rcFoldLine = rcLine; + rcFoldLine.top = rcFoldLine.bottom - 1; + surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); + } + } // Draw the Caret if (line == lineCaret) { - int xposCaret = ll.positions[posCaret - posLineStart] + xStart; + int offset = Platform::Minimum(posCaret - posLineStart, LineLayout::maxLineLength); + int xposCaret = ll.positions[offset] + xStart; int widthOverstrikeCaret = - ll.positions[posCaret - posLineStart + 1] - ll.positions[posCaret - posLineStart]; + ll.positions[offset + 1] - ll.positions[offset]; if (posCaret == pdoc->Length()) // At end of document widthOverstrikeCaret = vs.aveCharWidth; if ((posCaret - posLineStart) >= ll.numCharsInLine) // At end of line @@ -1154,8 +1187,10 @@ long Editor::FormatRange(bool draw, FORMATRANGE *pfr) { Surface *surface = new Surface(); surface->Init(pfr->hdc); + surface->SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); Surface *surfaceMeasure = new Surface(); surfaceMeasure->Init(pfr->hdcTarget); + surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage); ViewStyle vsPrint(vs); @@ -1204,10 +1239,9 @@ long Editor::FormatRange(bool draw, FORMATRANGE *pfr) { if (linePrintLast < pdoc->LinesTotal()) endPosPrint = pdoc->LineStart(linePrintLast + 1); - if (endPosPrint > pdoc->GetEndStyled()) { - // Notify container to do some more styling - NotifyStyleNeeded(endPosPrint); - } + // Ensure we are styled to where we are formatting. + pdoc->EnsureStyledTo(endPosPrint); + int xStart = vsPrint.fixedColumnWidth + pfr->rc.left + lineNumberWidth; int ypos = pfr->rc.top; int line = linePrintStart; @@ -1228,20 +1262,27 @@ long Editor::FormatRange(bool draw, FORMATRANGE *pfr) { PRectangle rcNumber = rcLine; rcNumber.right = rcNumber.left + lineNumberWidth; // Right justify - rcNumber.left += lineNumberWidth - + rcNumber.left -= surface->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, number, strlen(number)); surface->DrawText(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font, ypos + vsPrint.maxAscent, number, strlen(number), vsPrint.styles[STYLE_LINENUMBER].fore.allocated, vsPrint.styles[STYLE_LINENUMBER].back.allocated); } + + // When printing, the hdc and hdcTarget may be the same, so + // changing the state of surfaceMeasure may change the underlying + // state of surface. Therefore, any cached state is discarded before + // using each surface. // Copy this line and its styles from the document into local arrays // and determine the x position at which each character starts. + surfaceMeasure->FlushCachedState(); LineLayout ll; LayoutLine(line, surfaceMeasure, vsPrint, ll); // Draw the line + surface->FlushCachedState(); DrawLine(surface, vsPrint, line, xStart, rcLine, ll); ypos += vsPrint.lineHeight; @@ -1255,6 +1296,10 @@ long Editor::FormatRange(bool draw, FORMATRANGE *pfr) { return endPosPrint; } +// Empty method is overridden on GTK+ to show / hide scrollbars +void Editor::ReconfigureScrollBars() { +} + void Editor::SetScrollBarsTo(PRectangle) { RefreshStyleData(); @@ -1280,6 +1325,13 @@ void Editor::SetScrollBars() { } void Editor::AddChar(char ch) { + char s[2]; + s[0] = ch; + s[1] = '\0'; + AddCharUTF(s, 1); +} + +void Editor::AddCharUTF(char *s, unsigned int len) { bool wasSelection = currentPos != anchor; ClearSelection(); if (inOverstrike && !wasSelection) { @@ -1289,11 +1341,11 @@ void Editor::AddChar(char ch) { } } } - pdoc->InsertChar(currentPos, ch); - SetEmptySelection(currentPos + 1); + pdoc->InsertString(currentPos, s, len); + SetEmptySelection(currentPos + len); EnsureCaretVisible(); SetLastXChosen(); - NotifyChar(ch); + NotifyChar(s[0]); } void Editor::ClearSelection() { @@ -1302,8 +1354,7 @@ void Editor::ClearSelection() { int lineStart = pdoc->LineFromPosition(SelectionStart()); int lineEnd = pdoc->LineFromPosition(SelectionEnd()); int startPos = SelectionStart(); - int line; - for (line=lineStart; line <= lineEnd; line++) { + for (int line=lineEnd; line >= lineStart; line--) { startPos = SelectionStart(line); unsigned int chars = SelectionEnd(line) - startPos; if (0 != chars) { @@ -1414,13 +1465,17 @@ void Editor::DelCharBack() { void Editor::NotifyFocus(bool) { } -void Editor::NotifyStyleNeeded(int endStyleNeeded) { +void Editor::NotifyStyleToNeeded(int endStyleNeeded) { SCNotification scn; scn.nmhdr.code = SCN_STYLENEEDED; scn.position = endStyleNeeded; NotifyParent(scn); } +void Editor::NotifyStyleNeeded(Document*, void *, int endStyleNeeded) { + NotifyStyleToNeeded(endStyleNeeded); +} + void Editor::NotifyChar(char ch) { SCNotification scn; scn.nmhdr.code = SCN_CHARADDED; @@ -1563,13 +1618,17 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { } } } + if (mh.modificationType & SC_MOD_BEFOREINSERT) { + NotifyNeedShown(mh.position, 0); + } else if (mh.modificationType & SC_MOD_BEFOREDELETE) { + NotifyNeedShown(mh.position, mh.length); + } if (mh.linesAdded != 0) { // Update contraction state for inserted and removed lines // lineOfPos should be calculated in context of state before modification, shouldn't it int lineOfPos = pdoc->LineFromPosition(mh.position); if (mh.linesAdded > 0) { - NotifyNeedShown(mh.position, mh.length); cs.InsertLines(lineOfPos, mh.linesAdded); } else { cs.DeleteLines(lineOfPos, -mh.linesAdded); @@ -1599,6 +1658,10 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { SetScrollBars(); } + if (mh.modificationType & SC_MOD_CHANGEMARKER) { + RedrawSelMargin(); + } + // If client wants to see this modification if (mh.modificationType & modEventMask) { if ((mh.modificationType & SC_MOD_CHANGESTYLE) == 0) { @@ -1619,7 +1682,7 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { } } -void Editor::NotifyDeleted(Document *document, void *userData) { +void Editor::NotifyDeleted(Document *, void *) { /* Do nothing */ } @@ -1677,6 +1740,11 @@ void Editor::NotifyMacroRecord(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_VCHOMEEXTEND: case SCI_DELWORDLEFT: case SCI_DELWORDRIGHT: + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: break; // Filter out all others (display changes, etc) @@ -1712,6 +1780,60 @@ void Editor::PageMove(int direction, bool extend) { } } +void Editor::ChangeCaseOfSelection(bool makeUpperCase) { + pdoc->BeginUndoAction(); + int startCurrent = currentPos; + int startAnchor = anchor; + if (selType == selRectangle) { + int lineStart = pdoc->LineFromPosition(SelectionStart()); + int lineEnd = pdoc->LineFromPosition(SelectionEnd()); + for (int line=lineEnd; line >= lineStart; line--) { + pdoc->ChangeCase( + Range(SelectionStart(line), SelectionEnd(line)), + makeUpperCase); + } + // Would be nicer to keep the rectangular selection but this is complex + selType = selStream; + SetSelection(startCurrent, startCurrent); + } else { + pdoc->ChangeCase(Range(SelectionStart(), SelectionEnd()), + makeUpperCase); + SetSelection(startCurrent, startAnchor); + } + pdoc->EndUndoAction(); +} + + +void Editor::LineTranspose() { + int line = pdoc->LineFromPosition(currentPos); + if (line > 0) { + int startPrev = pdoc->LineStart(line-1); + int endPrev = pdoc->LineEnd(line-1); + int start = pdoc->LineStart(line); + int end = pdoc->LineEnd(line); + int startNext = pdoc->LineStart(line+1); + if (end < pdoc->Length()) { + end = startNext; + char *thisLine = CopyRange(start, end); + pdoc->DeleteChars(start, end-start); + pdoc->InsertString(startPrev, thisLine, end-start); + MovePositionTo(startPrev+end-start); + delete []thisLine; + } else { + // Last line so line has no line end + char *thisLine = CopyRange(start, end); + char *prevEnd = CopyRange(endPrev, start); + pdoc->DeleteChars(endPrev, end-endPrev); + pdoc->InsertString(startPrev, thisLine, end-start); + pdoc->InsertString(startPrev + end-start, prevEnd, start-endPrev); + MovePositionTo(startPrev + end-endPrev); + delete []thisLine; + delete []prevEnd; + } + + } +} + int Editor::KeyCommand(UINT iMessage) { Point pt = LocationFromPosition(currentPos); @@ -1724,6 +1846,10 @@ int Editor::KeyCommand(UINT iMessage) { MovePositionTo(PositionFromLocation( Point(lastXChosen, pt.y + vs.lineHeight)), true); break; + case SCI_LINESCROLLDOWN: + ScrollTo(topLine + 1); + MoveCaretInsideView(); + break; case SCI_LINEUP: MovePositionTo(PositionFromLocation( Point(lastXChosen, pt.y - vs.lineHeight))); @@ -1732,6 +1858,10 @@ int Editor::KeyCommand(UINT iMessage) { MovePositionTo(PositionFromLocation( Point(lastXChosen, pt.y - vs.lineHeight)), true); break; + case SCI_LINESCROLLUP: + ScrollTo(topLine - 1); + MoveCaretInsideView(); + break; case SCI_CHARLEFT: if (SelectionEmpty()) { MovePositionTo(MovePositionSoVisible(currentPos - 1, -1)); @@ -1827,6 +1957,7 @@ int Editor::KeyCommand(UINT iMessage) { break; case SCI_DELETEBACK: DelCharBack(); + SetLastXChosen(); EnsureCaretVisible(); break; case SCI_TAB: @@ -1879,13 +2010,46 @@ int Editor::KeyCommand(UINT iMessage) { int startWord = pdoc->NextWordStart(currentPos, -1); pdoc->DeleteChars(startWord, currentPos - startWord); MovePositionTo(startWord); + SetLastXChosen(); } break; case SCI_DELWORDRIGHT: { int endWord = pdoc->NextWordStart(currentPos, 1); pdoc->DeleteChars(currentPos, endWord - currentPos); + MovePositionTo(currentPos); + } + break; + case SCI_LINECUT: { + int lineStart = pdoc->LineFromPosition(currentPos); + int lineEnd = pdoc->LineFromPosition(anchor); + if (lineStart > lineEnd) { + int t = lineEnd; + lineEnd = lineStart; + lineStart = t; + } + int start = pdoc->LineStart(lineStart); + int end = pdoc->LineStart(lineEnd+1); + SetSelection(start,end); + Cut(); + } + break; + case SCI_LINEDELETE: { + int line = pdoc->LineFromPosition(currentPos); + int start = pdoc->LineStart(line); + int end = pdoc->LineStart(line+1); + pdoc->DeleteChars(start, end-start); + MovePositionTo(start); } break; + case SCI_LINETRANSPOSE: + LineTranspose(); + break; + case SCI_LOWERCASE: + ChangeCaseOfSelection(false); + break; + case SCI_UPPERCASE: + ChangeCaseOfSelection(true); + break; } return 0; } @@ -2111,7 +2275,11 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul int positionWasInSelection = PositionInSelection(position); - if ((!inDragDrop) || !(0 == positionWasInSelection)) { + bool positionOnEdgeOfSelection = + (position == SelectionStart()) || (position == SelectionEnd()); + + if ((!inDragDrop) || !(0 == positionWasInSelection) || + (positionOnEdgeOfSelection && !moving)) { int selStart = SelectionStart(); int selEnd = SelectionEnd(); @@ -2510,12 +2678,13 @@ char BraceOpposite(char ch) { // TODO: should be able to extend styled region to find matching brace // TODO: may need to make DBCS safe // so should be moved into Document -int Editor::BraceMatch(int position, int maxReStyle) { +int Editor::BraceMatch(int position, int /*maxReStyle*/) { char chBrace = pdoc->CharAt(position); char chSeek = BraceOpposite(chBrace); - if (!chSeek) + if (chSeek == '\0') return - 1; - char styBrace = pdoc->StyleAt(position) & pdoc->stylingBitsMask; + char styBrace = static_cast<char>( + pdoc->StyleAt(position) & pdoc->stylingBitsMask); int direction = -1; if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<') direction = 1; @@ -2523,7 +2692,7 @@ int Editor::BraceMatch(int position, int maxReStyle) { position = position + direction; while ((position >= 0) && (position < pdoc->Length())) { char chAtPos = pdoc->CharAt(position); - char styAtPos = pdoc->StyleAt(position) & pdoc->stylingBitsMask; + char styAtPos = static_cast<char>(pdoc->StyleAt(position) & pdoc->stylingBitsMask); if ((position > pdoc->GetEndStyled()) || (styAtPos == styBrace)) { if (chAtPos == chBrace) depth++; @@ -2566,6 +2735,10 @@ void Editor::SetDocPointer(Document *document) { pdoc = document; } pdoc->AddRef(); + // Reset the contraction state to fully shown. + cs.Clear(); + cs.InsertLines(0, pdoc->LinesTotal()-1); + pdoc->AddWatcher(this, 0); Redraw(); SetScrollBars(); @@ -2628,6 +2801,11 @@ void Editor::EnsureLineVisible(int line) { } } +static bool ValidMargin(WPARAM wParam) { + return wParam < ViewStyle::margins; +} + + LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { //Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam); @@ -2680,6 +2858,7 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case WM_PASTE: Paste(); SetLastXChosen(); + EnsureCaretVisible(); break; case WM_CLEAR: @@ -2734,19 +2913,20 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { // EM_GETPUNCTUATION // EM_SETPUNCTUATION // EM_GETTHUMB + // EM_SETTARGETDEVICE // Not supported but should be: // EM_GETEVENTMASK // EM_SETEVENTMASK // For printing: // EM_DISPLAYBAND - // EM_SETTARGETDEVICE case EM_CANUNDO: return pdoc->CanUndo() ? TRUE : FALSE; case EM_UNDO: Undo(); + SetLastXChosen(); break; case EM_EMPTYUNDOBUFFER: @@ -2782,12 +2962,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case EM_GETMODIFY: return !pdoc->IsSavePoint(); - case EM_SETMODIFY: - // Not really supported now that there is the save point stuff - //pdoc->isModified = wParam; - //return pdoc->isModified; - return false; - case EM_GETRECT: if (lParam == 0) return 0; @@ -2851,22 +3025,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { return iChar; } - case EM_GETWORDBREAKPROC: - return 0; - - case EM_SETWORDBREAKPROC: - break; - - case EM_LIMITTEXT: - // wParam holds the number of characters control should be limited to - break; - - case EM_GETLIMITTEXT: - return 0xffffffff; - - case EM_GETOLEINTERFACE: - return 0; - case EM_LINEFROMCHAR: if (static_cast<int>(wParam) < 0) wParam = SelectionStart(); @@ -2936,9 +3094,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { pdoc->SetReadOnly(wParam); return TRUE; - case EM_SETRECT: - break; - case EM_CANPASTE: return 1; @@ -3061,7 +3216,8 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { #ifdef INCLUDE_DEPRECATED_FEATURES case SCI_APPENDUNDOSTARTACTION: - pdoc->AppendUndoStartAction(); + // Not just deprecated - now dead + //pdoc->AppendUndoStartAction(); return 0; #endif @@ -3189,11 +3345,11 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { break; case SCI_STARTSTYLING: - pdoc->StartStyling(wParam, lParam); + pdoc->StartStyling(wParam, static_cast<char>(lParam)); break; case SCI_SETSTYLING: - pdoc->SetStyleFor(wParam, lParam); + pdoc->SetStyleFor(wParam, static_cast<char>(lParam)); break; case SCI_SETSTYLINGEX: // Specify a complete styling buffer @@ -3221,6 +3377,44 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { InvalidateStyleRedraw(); break; + case SCI_GETTABWIDTH: + return pdoc->tabInChars; + + case SCI_SETINDENT: + pdoc->indentInChars = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETINDENT: + return pdoc->indentInChars; + + case SCI_SETUSETABS: + pdoc->useTabs = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETUSETABS: + return pdoc->useTabs; + + case SCI_SETLINEINDENTATION: + pdoc->SetLineIndentation(wParam, lParam); + break; + + case SCI_GETLINEINDENTATION: + return pdoc->GetLineIndentation(wParam); + + case SCI_GETLINEINDENTPOSITION: + return pdoc->GetLineIndentPosition(wParam); + + case SCI_SETHSCROLLBAR : + horizontalScrollBarVisible = wParam; + SetScrollBars(); + ReconfigureScrollBars(); + break; + + case SCI_GETHSCROLLBAR: + return horizontalScrollBarVisible; + case SCI_SETCODEPAGE: pdoc->dbcsCodePage = wParam; break; @@ -3260,18 +3454,15 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { break; case SCI_MARKERADD: { int markerID = pdoc->AddMark(wParam, lParam); - RedrawSelMargin(); return markerID; } case SCI_MARKERDELETE: pdoc->DeleteMark(wParam, lParam); - RedrawSelMargin(); break; case SCI_MARKERDELETEALL: pdoc->DeleteAllMarks(static_cast<int>(wParam)); - RedrawSelMargin(); break; case SCI_MARKERGET: @@ -3295,53 +3486,53 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { return -1; case SCI_SETMARGINTYPEN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].symbol = (lParam == SC_MARGIN_SYMBOL); InvalidateStyleRedraw(); } break; case SCI_GETMARGINTYPEN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].symbol ? SC_MARGIN_SYMBOL : SC_MARGIN_NUMBER; else return 0; case SCI_SETMARGINWIDTHN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].width = lParam; InvalidateStyleRedraw(); } break; case SCI_GETMARGINWIDTHN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].width; else return 0; case SCI_SETMARGINMASKN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].mask = lParam; InvalidateStyleRedraw(); } break; case SCI_GETMARGINMASKN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].mask; else return 0; case SCI_SETMARGINSENSITIVEN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].sensitive = lParam; InvalidateStyleRedraw(); } break; case SCI_GETMARGINSENSITIVEN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].sensitive ? 1 : 0; else return 0; @@ -3391,7 +3582,19 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { if (lParam == 0) return 0; if (wParam <= STYLE_MAX) { - strcpy(vs.styles[wParam].fontName, reinterpret_cast<char *>(lParam)); + vs.SetStyleFontName(wParam, reinterpret_cast<const char *>(lParam)); + InvalidateStyleRedraw(); + } + break; + case SCI_STYLESETUNDERLINE: + if (wParam <= STYLE_MAX) { + vs.styles[wParam].underline = lParam; + InvalidateStyleRedraw(); + } + break; + case SCI_STYLESETCHARACTERSET: + if (wParam <= STYLE_MAX) { + vs.styles[wParam].characterSet = lParam; InvalidateStyleRedraw(); } break; @@ -3400,7 +3603,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { vs.ResetDefaultStyle(); InvalidateStyleRedraw(); break; - case SCI_SETSTYLEBITS: pdoc->SetStylingBits(wParam); break; @@ -3485,14 +3687,20 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_SEARCHNEXT: case SCI_SEARCHPREV: return SearchText(iMessage, wParam, lParam); - break; case SCI_SETCARETPOLICY: caretPolicy = wParam; caretSlop = lParam; break; -#ifdef INCLUDE_DEPRECATED_FEATURES + case SCI_LINESONSCREEN: + return LinesOnScreen(); + + case SCI_USEPOPUP: + displayPopupMenu = wParam; + break; + + #ifdef INCLUDE_DEPRECATED_FEATURES case SCI_SETFORE: vs.styles[STYLE_DEFAULT].fore.desired = Colour(wParam); InvalidateStyleRedraw(); @@ -3612,6 +3820,13 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_ZOOMOUT: case SCI_DELWORDLEFT: case SCI_DELWORDRIGHT: + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: + case SCI_LINESCROLLDOWN: + case SCI_LINESCROLLUP: return KeyCommand(iMessage); case SCI_BRACEHIGHLIGHT: @@ -3635,6 +3850,14 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { Redraw(); break; + case SCI_SETZOOM: + vs.zoomLevel = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETZOOM: + return vs.zoomLevel; + case SCI_GETEDGECOLUMN: return theEdge; @@ -3666,6 +3889,14 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { SetDocPointer(reinterpret_cast<Document *>(lParam)); return 0; + case SCI_ADDREFDOC: + (reinterpret_cast<Document *>(lParam))->AddRef(); + break; + + case SCI_RELEASEDOC: + (reinterpret_cast<Document *>(lParam))->Release(); + break; + case SCI_SETMODEVENTMASK: modEventMask = wParam; return 0; @@ -3675,6 +3906,9 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { SetSelection(currentPos, anchor); // Ensure selection inside document return 0; + case SCI_SELECTIONISRECTANGLE: + return (selType == selRectangle) ? 1 : 0; + #ifdef MACRO_SUPPORT case SCI_STARTRECORD: recordingMacro = 1; diff --git a/src/stc/scintilla/src/Editor.h b/src/stc/scintilla/src/Editor.h index 4ff334767a..808a656be1 100644 --- a/src/stc/scintilla/src/Editor.h +++ b/src/stc/scintilla/src/Editor.h @@ -38,6 +38,9 @@ public: }; class Editor : public DocWatcher { + // Private so Editor objects can not be copied + Editor(const Editor &) : DocWatcher() {} + Editor &operator=(const Editor &) { return *this; } protected: // ScintillaBase subclass needs access to much of Editor // On GTK+, Scintilla is a container widget holding two scroll bars and a drawing area @@ -61,13 +64,14 @@ protected: // ScintillaBase subclass needs access to much of Editor int xOffset; // Horizontal scrolled amount in pixels int xCaretMargin; // Ensure this many pixels visible on both sides of caret + bool horizontalScrollBarVisible; Surface pixmapLine; Surface pixmapSelMargin; Surface pixmapSelPattern; // Intellimouse support - currently only implemented for Windows unsigned int ucWheelScrollLines; - short cWheelDelta; //wheel delta from roll + int cWheelDelta; //wheel delta from roll KeyMap kmap; @@ -116,6 +120,8 @@ protected: // ScintillaBase subclass needs access to much of Editor int searchAnchor; + int displayPopupMenu; + #ifdef MACRO_SUPPORT int recordingMacro; #endif @@ -169,6 +175,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void ScrollTo(int line); virtual void ScrollText(int linesToMove); void HorizontalScrollTo(int xPos); + void MoveCaretInsideView(); void EnsureCaretVisible(bool useMargin=true); void ShowCaretAtCurrentPosition(); void DropCaret(); @@ -184,10 +191,12 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void SetVerticalScrollPos() = 0; virtual void SetHorizontalScrollPos() = 0; virtual bool ModifyScrollBars(int nMax, int nPage) = 0; + virtual void ReconfigureScrollBars(); void SetScrollBarsTo(PRectangle rsClient); void SetScrollBars(); - virtual void AddChar(char ch); + void AddChar(char ch); + virtual void AddCharUTF(char *s, unsigned int len); void ClearSelection(); void ClearAll(); void Cut(); @@ -205,7 +214,7 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void NotifyChange() = 0; virtual void NotifyFocus(bool focus); virtual void NotifyParent(SCNotification scn) = 0; - virtual void NotifyStyleNeeded(int endStyleNeeded); + virtual void NotifyStyleToNeeded(int endStyleNeeded); void NotifyChar(char ch); void NotifySavePoint(bool isSavePoint); void NotifyModifyAttempt(); @@ -218,12 +227,16 @@ protected: // ScintillaBase subclass needs access to much of Editor void NotifySavePoint(Document *document, void *userData, bool atSavePoint); void NotifyModified(Document *document, DocModification mh, void *userData); void NotifyDeleted(Document *document, void *userData); + void NotifyStyleNeeded(Document *doc, void *userData, int endPos); + #ifdef MACRO_SUPPORT void NotifyMacroRecord(UINT iMessage, WPARAM wParam, LPARAM lParam); #endif void PageMove(int direction, bool extend=false); + void ChangeCaseOfSelection(bool makeUpperCase); + void LineTranspose(); virtual int KeyCommand(UINT iMessage); virtual int KeyDefault(int /* key */, int /*modifiers*/); int KeyDown(int key, bool shift, bool ctrl, bool alt); diff --git a/src/stc/scintilla/src/Indicator.cxx b/src/stc/scintilla/src/Indicator.cxx index fb6ad09157..05bdf66b53 100644 --- a/src/stc/scintilla/src/Indicator.cxx +++ b/src/stc/scintilla/src/Indicator.cxx @@ -37,6 +37,22 @@ void Indicator::Draw(Surface *surface, PRectangle &rc) { surface->MoveTo(x-3, ymid); surface->LineTo(x-3, ymid+2); } + } else if (style == INDIC_DIAGONAL) { + int x = rc.left; + while (x < rc.right) { + surface->MoveTo(x, rc.top+2); + int endX = x+3; + int endY = rc.top - 1; + if (endX > rc.right) { + endY += endX - rc.right; + endX = rc.right; + } + surface->LineTo(endX, endY); + x += 4; + } + } else if (style == INDIC_STRIKE) { + surface->MoveTo(rc.left, rc.top - 4); + surface->LineTo(rc.right, rc.top - 4); } else { // Either INDIC_PLAIN or unknown surface->MoveTo(rc.left, ymid); surface->LineTo(rc.right, ymid); diff --git a/src/stc/scintilla/src/KeyMap.cxx b/src/stc/scintilla/src/KeyMap.cxx index f339cd2750..3a6a31f974 100644 --- a/src/stc/scintilla/src/KeyMap.cxx +++ b/src/stc/scintilla/src/KeyMap.cxx @@ -61,51 +61,59 @@ UINT KeyMap::Find(int key, int modifiers) { } KeyToCommand KeyMap::MapDefault[] = { - VK_DOWN, SCI_NORM, SCI_LINEDOWN, - VK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND, - VK_UP, SCI_NORM, SCI_LINEUP, - VK_UP, SCI_SHIFT, SCI_LINEUPEXTEND, - VK_LEFT, SCI_NORM, SCI_CHARLEFT, - VK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND, - VK_LEFT, SCI_CTRL, SCI_WORDLEFT, - VK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND, - VK_RIGHT, SCI_NORM, SCI_CHARRIGHT, - VK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND, - VK_RIGHT, SCI_CTRL, SCI_WORDRIGHT, - VK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND, - VK_HOME, SCI_NORM, SCI_VCHOME, - VK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND, - VK_HOME, SCI_CTRL, SCI_DOCUMENTSTART, - VK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND, - VK_END, SCI_NORM, SCI_LINEEND, - VK_END, SCI_SHIFT, SCI_LINEENDEXTEND, - VK_END, SCI_CTRL, SCI_DOCUMENTEND, - VK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND, - VK_PRIOR, SCI_NORM, SCI_PAGEUP, - VK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND, - VK_NEXT, SCI_NORM, SCI_PAGEDOWN, - VK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND, - VK_DELETE, SCI_NORM, WM_CLEAR, - VK_DELETE, SCI_SHIFT, WM_CUT, - VK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT, - VK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE, - VK_INSERT, SCI_SHIFT, WM_PASTE, - VK_INSERT, SCI_CTRL, WM_COPY, - VK_ESCAPE, SCI_NORM, SCI_CANCEL, - VK_BACK, SCI_NORM, SCI_DELETEBACK, - VK_BACK, SCI_CTRL, SCI_DELWORDLEFT, - 'Z', SCI_CTRL, WM_UNDO, - 'Y', SCI_CTRL, SCI_REDO, - 'X', SCI_CTRL, WM_CUT, - 'C', SCI_CTRL, WM_COPY, - 'V', SCI_CTRL, WM_PASTE, - 'A', SCI_CTRL, SCI_SELECTALL, - VK_TAB, SCI_NORM, SCI_TAB, - VK_TAB, SCI_SHIFT, SCI_BACKTAB, - VK_RETURN, SCI_NORM, SCI_NEWLINE, - 'L', SCI_CTRL, SCI_FORMFEED, - VK_ADD, SCI_CTRL, SCI_ZOOMIN, - VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT, - 0,0,0, + {VK_DOWN, SCI_NORM, SCI_LINEDOWN}, + {VK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND}, + {VK_DOWN, SCI_CTRL, SCI_LINESCROLLDOWN}, + {VK_UP, SCI_NORM, SCI_LINEUP}, + {VK_UP, SCI_SHIFT, SCI_LINEUPEXTEND}, + {VK_UP, SCI_CTRL, SCI_LINESCROLLUP}, + {VK_LEFT, SCI_NORM, SCI_CHARLEFT}, + {VK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND}, + {VK_LEFT, SCI_CTRL, SCI_WORDLEFT}, + {VK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND}, + {VK_RIGHT, SCI_NORM, SCI_CHARRIGHT}, + {VK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND}, + {VK_RIGHT, SCI_CTRL, SCI_WORDRIGHT}, + {VK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND}, + {VK_HOME, SCI_NORM, SCI_VCHOME}, + {VK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND}, + {VK_HOME, SCI_CTRL, SCI_DOCUMENTSTART}, + {VK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, + {VK_END, SCI_NORM, SCI_LINEEND}, + {VK_END, SCI_SHIFT, SCI_LINEENDEXTEND}, + {VK_END, SCI_CTRL, SCI_DOCUMENTEND}, + {VK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, + {VK_PRIOR, SCI_NORM, SCI_PAGEUP}, + {VK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND}, + {VK_NEXT, SCI_NORM, SCI_PAGEDOWN}, + {VK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND}, + {VK_DELETE, SCI_NORM, WM_CLEAR}, + {VK_DELETE, SCI_SHIFT, WM_CUT}, + {VK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT}, + {VK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE}, + {VK_INSERT, SCI_SHIFT, WM_PASTE}, + {VK_INSERT, SCI_CTRL, WM_COPY}, + {VK_ESCAPE, SCI_NORM, SCI_CANCEL}, + {VK_BACK, SCI_NORM, SCI_DELETEBACK}, + {VK_BACK, SCI_CTRL, SCI_DELWORDLEFT}, + {'Z', SCI_CTRL, WM_UNDO}, + {'Y', SCI_CTRL, SCI_REDO}, + {'X', SCI_CTRL, WM_CUT}, + {'C', SCI_CTRL, WM_COPY}, + {'V', SCI_CTRL, WM_PASTE}, + {'A', SCI_CTRL, SCI_SELECTALL}, + {VK_TAB, SCI_NORM, SCI_TAB}, + {VK_TAB, SCI_SHIFT, SCI_BACKTAB}, + {VK_RETURN, SCI_NORM, SCI_NEWLINE}, + {VK_ADD, SCI_CTRL, SCI_ZOOMIN}, + {VK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT}, + {VK_DIVIDE, SCI_CTRL, SCI_SETZOOM}, + //'L', SCI_CTRL, SCI_FORMFEED, + {'L', SCI_CTRL, SCI_LINECUT}, + {'L', SCI_CSHIFT, SCI_LINEDELETE}, + {'T', SCI_CTRL, SCI_LINETRANSPOSE}, + {'U', SCI_CTRL, SCI_LOWERCASE}, + {'U', SCI_CSHIFT, SCI_UPPERCASE}, + {0,0,0}, }; diff --git a/src/stc/scintilla/src/KeyMap.h b/src/stc/scintilla/src/KeyMap.h index 814f3aa3b7..bc435e1970 100644 --- a/src/stc/scintilla/src/KeyMap.h +++ b/src/stc/scintilla/src/KeyMap.h @@ -11,6 +11,7 @@ #define SCI_CTRL LEFT_CTRL_PRESSED #define SCI_ALT LEFT_ALT_PRESSED #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT) +#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT) class KeyToCommand { public: diff --git a/src/stc/scintilla/src/KeyWords.cxx b/src/stc/scintilla/src/KeyWords.cxx index 20f6762470..113ba222df 100644 --- a/src/stc/scintilla/src/KeyWords.cxx +++ b/src/stc/scintilla/src/KeyWords.cxx @@ -17,2201 +17,29 @@ #include "Scintilla.h" #include "SciLexer.h" -inline bool IsLeadByte(int codePage, char ch) { -#if PLAT_GTK - // TODO: support DBCS under GTK+ - return false; -#elif PLAT_WIN - return codePage && IsDBCSLeadByteEx(codePage, ch); -#elif PLAT_WX - return false; -#endif -} - -inline bool iswordchar(char ch) { - return isalnum(ch) || ch == '.' || ch == '_'; -} - -inline bool iswordstart(char ch) { - return isalnum(ch) || ch == '_'; -} - -enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8}; - -static int IndentAmount(StylingContext &styler, int line, int *flags) { - int end = styler.Length(); - int spaceFlags = 0; - - // Determines the indentation level of the current line and also checks for consistent - // indentation compared to the previous line. - // Indentation is judged consistent when the indentation whitespace of each line lines - // the same or the indentation of one line is a prefix of the other. - - int pos = styler.LineStart(line); - char ch = styler[pos]; - int indent = 0; - bool inPrevPrefix = line > 0; - int posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0; - while ((ch == ' ' || ch == '\t') && (pos < end)) { - if (inPrevPrefix) { - char chPrev = styler[posPrev++]; - if (chPrev == ' ' || chPrev == '\t') { - if (chPrev != ch) - spaceFlags |= wsInconsistent; - } else { - inPrevPrefix = false; - } - } - if (ch == ' ') { - spaceFlags |= wsSpace; - indent++; - } else { // Tab - spaceFlags |= wsTab; - if (spaceFlags & wsSpace) - spaceFlags |= wsSpaceTab; - indent = (indent / 8 + 1) * 8; - } - ch = styler[++pos]; - } - - *flags = spaceFlags; - indent += SC_FOLDLEVELBASE; - if (isspace(ch)) // Completely empty line - return indent | SC_FOLDLEVELWHITEFLAG; - else - return indent; -} - -inline bool isoperator(char ch) { - if (isalnum(ch)) - return false; - // '.' left out as it is used to make up numbers - if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || - ch == '(' || ch == ')' || ch == '-' || ch == '+' || - ch == '=' || ch == '|' || ch == '{' || ch == '}' || - ch == '[' || ch == ']' || ch == ':' || ch == ';' || - ch == '<' || ch == '>' || ch == ',' || ch == '/' || - ch == '?' || ch == '!' || ch == '.' || ch == '~') - return true; - return false; -} - -static void classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_C_IDENTIFIER; - if (wordIsNumber) - chAttr = SCE_C_NUMBER; - else { - if (keywords.InList(s)) - chAttr = SCE_C_WORD; - } - styler.ColourSegment(start, end, chAttr); -} - -static void ColouriseCppDoc(int codePage, int startPos, int length, - int initStyle, WordList &keywords, StylingContext &styler) { - - bool fold = styler.GetPropSet().GetInt("fold"); - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - - int state = initStyle; - char chPrev = ' '; - char chNext = styler[startPos]; - int startSeg = startPos; - int lengthDoc = startPos + length; - int visChars = 0; - for (unsigned int i = startPos; i <= lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if ((fold) && ((ch == '\r' && chNext != '\n') || (ch == '\n'))) { - int lev = levelPrev; - if (visChars == 0) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - styler.SetLevel(lineCurrent, lev); - lineCurrent++; - visChars = 0; - levelPrev = levelCurrent; - } - if (!isspace(ch)) - visChars++; - - if (IsLeadByte(codePage, ch)) { // dbcs - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - i += 1; - continue; - } - - if (state == SCE_C_STRINGEOL) { - if (ch != '\r' && ch != '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_DEFAULT; - startSeg = i; - } - } - if (state == SCE_C_DEFAULT) { - if (iswordstart(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_WORD; - startSeg = i; - } else if (ch == '/' && chNext == '*') { - styler.ColourSegment(startSeg, i - 1, state); - if (styler.SafeGetCharAt(i + 2) == '*') - state = SCE_C_COMMENTDOC; - else - state = SCE_C_COMMENT; - startSeg = i; - } else if (ch == '/' && chNext == '/') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_COMMENTLINE; - startSeg = i; - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_STRING; - startSeg = i; - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_CHARACTER; - startSeg = i; - } else if (ch == '#') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_PREPROCESSOR; - startSeg = i; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - styler.ColourSegment(i, i, SCE_C_OPERATOR); - startSeg = i + 1; - if ((ch == '{') || (ch == '}')) { - levelCurrent += (ch == '{') ? 1 : -1; - } - } - } else if (state == SCE_C_WORD) { - if (!iswordchar(ch)) { - classifyWordCpp(startSeg, i - 1, keywords, styler); - state = SCE_C_DEFAULT; - startSeg = i; - if (ch == '/' && chNext == '*') { - if (styler.SafeGetCharAt(i + 2) == '*') - state = SCE_C_COMMENTDOC; - else - state = SCE_C_COMMENT; - } else if (ch == '/' && chNext == '/') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_C_STRING; - } else if (ch == '\'') { - state = SCE_C_CHARACTER; - } else if (ch == '#') { - state = SCE_C_PREPROCESSOR; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_C_OPERATOR); - startSeg = i + 1; - if ((ch == '{') || (ch == '}')) { - levelCurrent += (ch == '{') ? 1 : -1; - } - } - } - } else { - if (state == SCE_C_PREPROCESSOR) { - if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_DEFAULT; - startSeg = i; - } - } else if (state == SCE_C_COMMENT) { - if (ch == '/' && chPrev == '*' && ( - (i > startSeg + 2) || ((initStyle == SCE_C_COMMENT) && (startSeg == startPos)))) { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - startSeg = i + 1; - } - } else if (state == SCE_C_COMMENTDOC) { - if (ch == '/' && chPrev == '*' && ( - (i > startSeg + 3) || ((initStyle == SCE_C_COMMENTDOC) && (startSeg == startPos)))) { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - startSeg = i + 1; - } - } else if (state == SCE_C_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_DEFAULT; - startSeg = i; - } - } else if (state == SCE_C_STRING) { - if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_STRINGEOL; - startSeg = i; - } else if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } else if (state == SCE_C_CHARACTER) { - if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_STRINGEOL; - startSeg = i; - } else if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } - if (state == SCE_C_DEFAULT) { // One of the above succeeded - if (ch == '/' && chNext == '*') { - if (styler.SafeGetCharAt(i + 2) == '*') - state = SCE_C_COMMENTDOC; - else - state = SCE_C_COMMENT; - } else if (ch == '/' && chNext == '/') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_C_STRING; - } else if (ch == '\'') { - state = SCE_C_CHARACTER; - } else if (ch == '#') { - state = SCE_C_PREPROCESSOR; - } else if (iswordstart(ch)) { - state = SCE_C_WORD; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_C_OPERATOR); - startSeg = i + 1; - if ((ch == '{') || (ch == '}')) { - levelCurrent += (ch == '{') ? 1 : -1; - } - } - } - } - chPrev = ch; - } - if (startSeg < lengthDoc) - styler.ColourSegment(startSeg, lengthDoc - 1, state); - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - if (fold) { - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - //styler.SetLevel(lineCurrent, levelCurrent | flagsNext); - styler.SetLevel(lineCurrent, levelPrev | flagsNext); - - } -} - -inline bool isPerlOperator(char ch) { - if (isalnum(ch)) - return false; - // '.' left out as it is used to make up numbers - if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '\\' || - ch == '(' || ch == ')' || ch == '-' || ch == '+' || - ch == '=' || ch == '|' || ch == '{' || ch == '}' || - ch == '[' || ch == ']' || ch == ':' || ch == ';' || - ch == '<' || ch == '>' || ch == ',' || ch == '/' || - ch == '?' || ch == '!' || ch == '.' || ch == '~') - return true; - return false; -} - -static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_PL_IDENTIFIER; - if (wordIsNumber) - chAttr = SCE_PL_NUMBER; - else { - if (keywords.InList(s)) - chAttr = SCE_PL_WORD; - } - styler.ColourSegment(start, end, chAttr); - return chAttr; -} - -static bool isEndVar(char ch) { - return !isalnum(ch) && ch != '#' && ch != '$' && - ch != '_' && ch != '\''; -} - -static bool isMatch(StylingContext &styler, int lengthDoc, int pos, const char *val) { - if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) { - return false; - } - while (*val) { - if (*val != styler[pos++]) { - return false; - } - val++; - } - return true; -} - -static bool isOKQuote(char ch) { - if (isalnum(ch)) - return false; - if (isspace(ch)) - return false; - if (iscntrl(ch)) - return false; - return true; -} - -static char opposite(char ch) { - if (ch == '(') - return ')'; - if (ch == '[') - return ']'; - if (ch == '{') - return '}'; - if (ch == '<') - return '>'; - return ch; -} - -static void ColourisePerlDoc(int codePage, int startPos, int length, int initStyle, - WordList &keywords, StylingContext &styler) { - char sooked[100]; - int quotes = 0; - char quoteDown = 'd'; - char quoteUp = 'd'; - int quoteRep = 1; - int sookedpos = 0; - bool preferRE = true; - sooked[sookedpos] = '\0'; - int state = initStyle; - int lengthDoc = startPos + length; - // If in a long distance lexical state, seek to the beginning to find quote characters - if (state == SCE_PL_HERE || state == SCE_PL_REGEX || - state == SCE_PL_REGSUBST || state == SCE_PL_LONGQUOTE) { - while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) { - startPos--; - } - state = SCE_PL_DEFAULT; - } - styler.StartAt(startPos); - char chPrev = ' '; - char chNext = styler[startPos]; - int startSeg = startPos; - for (int i = startPos; i <= lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - char chNext2 = styler.SafeGetCharAt(i + 2); - - if (IsLeadByte(codePage, ch)) { // dbcs - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - i += 1; - continue; - } - - if (state == SCE_PL_DEFAULT) { - if (iswordstart(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - if (ch == 's' && !isalnum(chNext)) { - state = SCE_PL_REGSUBST; - quotes = 0; - quoteUp = '\0'; - quoteDown = '\0'; - quoteRep = 2; - startSeg = i; - } else if (ch == 'm' && !isalnum(chNext)) { - state = SCE_PL_REGEX; - quotes = 0; - quoteUp = '\0'; - quoteDown = '\0'; - quoteRep = 1; - startSeg = i; - } else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) { - state = SCE_PL_REGSUBST; - quotes = 0; - quoteUp = '\0'; - quoteDown = '\0'; - quoteRep = 2; - startSeg = i; - i++; - chNext = chNext2; - } else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) { - state = SCE_PL_LONGQUOTE; - startSeg = i; - i++; - chNext = chNext2; - quotes = 0; - quoteUp = '\0'; - quoteDown = '\0'; - quoteRep = 1; - } else { - state = SCE_PL_WORD; - startSeg = i; - preferRE = false; - } - } else if (ch == '#') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_COMMENTLINE; - startSeg = i; - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_STRING; - startSeg = i; - } else if (ch == '\'') { - if (chPrev == '&') { - // Archaic call - styler.ColourSegment(i, i, state); - startSeg = i + 1; - } else { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_CHARACTER; - startSeg = i; - } - } else if (ch == '`') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_BACKTICKS; - startSeg = i; - } else if (ch == '$') { - preferRE = false; - styler.ColourSegment(startSeg, i - 1, state); - if (isalnum(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { - state = SCE_PL_SCALAR; - startSeg = i; - } else if (chNext != '{' && chNext != '[') { - styler.ColourSegment(i - 1, i, SCE_PL_SCALAR); - i++; - startSeg = i + 1; - ch = ' '; - chNext = ' '; - } else { - styler.ColourSegment(i, i, SCE_PL_SCALAR); - startSeg = i + 1; - } - } else if (ch == '@') { - preferRE = false; - styler.ColourSegment(startSeg, i - 1, state); - if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { - state = SCE_PL_ARRAY; - startSeg = i; - } else if (chNext != '{' && chNext != '[') { - styler.ColourSegment(i - 1, i, SCE_PL_ARRAY); - i++; - startSeg = i + 1; - ch = ' '; - } else { - styler.ColourSegment(i, i, SCE_PL_ARRAY); - startSeg = i + 1; - } - } else if (ch == '%') { - preferRE = false; - styler.ColourSegment(startSeg, i - 1, state); - if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { - state = SCE_PL_HASH; - startSeg = i; - } else if (chNext != '{' && chNext != '[') { - styler.ColourSegment(i - 1, i, SCE_PL_HASH); - i++; - startSeg = i + 1; - ch = ' '; - } else { - styler.ColourSegment(i, i, SCE_PL_HASH); - startSeg = i + 1; - } - } else if (ch == '*') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_SYMBOLTABLE; - startSeg = i; - } else if (ch == '/' && preferRE) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_REGEX; - quoteUp = '/'; - quoteDown = '/'; - quotes = 1; - quoteRep = 1; - startSeg = i; - } else if (ch == '<' && chNext == '<') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_HERE; - startSeg = i; - i++; - ch = chNext; - chNext = chNext2; - quotes = 0; - sookedpos = 0; - sooked[sookedpos] = '\0'; - } else if (ch == '=' && isalpha(chNext)) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_POD; - startSeg = i; - quotes = 0; - sookedpos = 0; - sooked[sookedpos] = '\0'; - } else if (isPerlOperator(ch)) { - if (ch == ')' || ch == ']') - preferRE = false; - else - preferRE = true; - styler.ColourSegment(startSeg, i - 1, state); - styler.ColourSegment(i, i, SCE_PL_OPERATOR); - startSeg = i + 1; - } - } else if (state == SCE_PL_WORD) { - if (!iswordchar(ch) && ch != '\'') { // Archaic Perl has quotes inside names - if (isMatch(styler, lengthDoc, startSeg, "__DATA__")) { - styler.ColourSegment(startSeg, i, SCE_PL_DATASECTION); - state = SCE_PL_DATASECTION; - } else if (isMatch(styler, lengthDoc, startSeg, "__END__")) { - styler.ColourSegment(startSeg, i, SCE_PL_DATASECTION); - state = SCE_PL_DATASECTION; - } else { - if (classifyWordPerl(startSeg, i - 1, keywords, styler) == SCE_PL_WORD) - preferRE = true; - state = SCE_PL_DEFAULT; - startSeg = i; - if (ch == '#') { - state = SCE_PL_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_PL_STRING; - } else if (ch == '\'') { - state = SCE_PL_CHARACTER; - } else if (ch == '<' && chNext == '<') { - state = SCE_PL_HERE; - quotes = 0; - startSeg = i; - sookedpos = 0; - sooked[sookedpos] = '\0'; - } else if (isPerlOperator(ch)) { - if (ch == ')' || ch == ']') - preferRE = false; - else - preferRE = true; - styler.ColourSegment(startSeg, i, SCE_PL_OPERATOR); - state = SCE_PL_DEFAULT; - startSeg = i + 1; - } - } - } - } else { - if (state == SCE_PL_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_PL_DEFAULT; - startSeg = i; - } - } else if (state == SCE_PL_HERE) { - if (isalnum(ch) && quotes < 2) { - sooked[sookedpos++] = ch; - sooked[sookedpos] = '\0'; - if (quotes == 0) - quotes = 1; - } else { - quotes++; - } - - if (quotes > 1 && isMatch(styler, lengthDoc, i, sooked)) { - styler.ColourSegment(startSeg, i + sookedpos - 1, SCE_PL_HERE); - state = SCE_PL_DEFAULT; - i += sookedpos; - startSeg = i; - chNext = ' '; - } - } else if (state == SCE_PL_STRING) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i, state); - state = SCE_PL_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } else if (state == SCE_PL_CHARACTER) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i, state); - state = SCE_PL_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } else if (state == SCE_PL_BACKTICKS) { - if (ch == '`') { - styler.ColourSegment(startSeg, i, state); - state = SCE_PL_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } else if (state == SCE_PL_POD) { - if (ch == '=') { - if (isMatch(styler, lengthDoc, i, "=cut")) { - styler.ColourSegment(startSeg, i - 1 + 4, state); - i += 4; - startSeg = i; - state = SCE_PL_DEFAULT; - chNext = ' '; - ch = ' '; - } - } - } else if (state == SCE_PL_SCALAR) { - if (isEndVar(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - state = SCE_PL_DEFAULT; - } - } else if (state == SCE_PL_ARRAY) { - if (isEndVar(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - state = SCE_PL_DEFAULT; - } - } else if (state == SCE_PL_HASH) { - if (isEndVar(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - state = SCE_PL_DEFAULT; - } - } else if (state == SCE_PL_SYMBOLTABLE) { - if (isEndVar(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - state = SCE_PL_DEFAULT; - } - } else if (state == SCE_PL_REF) { - if (isEndVar(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - state = SCE_PL_DEFAULT; - } - } else if (state == SCE_PL_REGEX) { - if (!quoteUp && !isspace(ch)) { - quoteUp = ch; - quoteDown = opposite(ch); - quotes++; - } else { - if (ch == quoteDown && chPrev != '\\') { - quotes--; - if (quotes == 0) { - quoteRep--; - if (quoteUp == quoteDown) { - quotes++; - } - } - if (!isalpha(chNext)) { - if (quoteRep <= 0) { - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - state = SCE_PL_DEFAULT; - ch = ' '; - } - } - } else if (ch == quoteUp && chPrev != '\\') { - quotes++; - } else if (!isalpha(chNext)) { - if (quoteRep <= 0) { - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - state = SCE_PL_DEFAULT; - ch = ' '; - } - } - } - } else if (state == SCE_PL_REGSUBST) { - if (!quoteUp && !isspace(ch)) { - quoteUp = ch; - quoteDown = opposite(ch); - quotes++; - } else { - if (ch == quoteDown && chPrev != '\\') { - quotes--; - if (quotes == 0) { - quoteRep--; - } - if (!isalpha(chNext)) { - if (quoteRep <= 0) { - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - state = SCE_PL_DEFAULT; - ch = ' '; - } - } - if (quoteUp == quoteDown) { - quotes++; - } - } else if (ch == quoteUp && chPrev != '\\') { - quotes++; - } else if (!isalpha(chNext)) { - if (quoteRep <= 0) { - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - state = SCE_PL_DEFAULT; - ch = ' '; - } - } - } - } else if (state == SCE_PL_LONGQUOTE) { - if (!quoteDown && !isspace(ch)) { - quoteUp = ch; - quoteDown = opposite(quoteUp); - quotes++; - } else if (ch == quoteDown) { - quotes--; - if (quotes == 0) { - quoteRep--; - if (quoteRep <= 0) { - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - state = SCE_PL_DEFAULT; - ch = ' '; - } - if (quoteUp == quoteDown) { - quotes++; - } - } - } else if (ch == quoteUp) { - quotes++; - } - } - - if (state == SCE_PL_DEFAULT) { // One of the above succeeded - if (ch == '#') { - state = SCE_PL_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_PL_STRING; - } else if (ch == '\'') { - state = SCE_PL_CHARACTER; - } else if (iswordstart(ch)) { - state = SCE_PL_WORD; - preferRE = false; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_PL_OPERATOR); - startSeg = i + 1; - } - } - } - chPrev = ch; - } - if (startSeg < lengthDoc) - styler.ColourSegment(startSeg, lengthDoc, state); -} - - -static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); - s[i + 1] = '\0'; - } - char chAttr = SCE_C_DEFAULT; - if (wordIsNumber) - chAttr = SCE_C_NUMBER; - else { - if (keywords.InList(s)) { - chAttr = SCE_C_WORD; - if (strcmp(s, "rem") == 0) - chAttr = SCE_C_COMMENTLINE; - } - } - styler.ColourSegment(start, end, chAttr); - if (chAttr == SCE_C_COMMENTLINE) - return SCE_C_COMMENTLINE; - else - return SCE_C_DEFAULT; -} - -static void ColouriseVBDoc(int codePage, int startPos, int length, int initStyle, - WordList &keywords, StylingContext &styler) { - int state = initStyle; - char chNext = styler[startPos]; - int startSeg = startPos; - int lengthDoc = startPos + length; - for (int i = startPos; i < lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if (IsLeadByte(codePage, ch)) { // dbcs - chNext = styler.SafeGetCharAt(i + 2); - i += 1; - continue; - } - - if (state == SCE_C_DEFAULT) { - if (iswordstart(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_WORD; - startSeg = i; - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_COMMENTLINE; - startSeg = i; - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_STRING; - startSeg = i; - } - } else if (state == SCE_C_WORD) { - if (!iswordchar(ch)) { - state = classifyWordVB(startSeg, i - 1, keywords, styler); - if (state == SCE_C_DEFAULT) { - startSeg = i; - if (ch == '\'') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_C_STRING; - } - } - } - } else { - if (state == SCE_C_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_DEFAULT; - startSeg = i; - } - } else if (state == SCE_C_STRING) { - // VB doubles quotes to preserve them - if (ch == '\"') { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - startSeg = i; - } - } - if (state == SCE_C_DEFAULT) { // One of the above succeeded - if (ch == '\'') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_C_STRING; - } else if (iswordstart(ch)) { - state = SCE_C_WORD; - } - } - } - } - if (startSeg < lengthDoc) - styler.ColourSegment(startSeg, lengthDoc, state); -} - -static void classifyWordPy(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler, char *prevWord) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_P_IDENTIFIER; - if (0 == strcmp(prevWord, "class")) - chAttr = SCE_P_CLASSNAME; - else if (0 == strcmp(prevWord, "def")) - chAttr = SCE_P_DEFNAME; - else if (wordIsNumber) - chAttr = SCE_P_NUMBER; - else if (keywords.InList(s)) - chAttr = SCE_P_WORD; - styler.ColourSegment(start, end, chAttr); - strcpy(prevWord, s); -} - -static void ColourisePyDoc(int codePage, int startPos, int length, int initStyle, WordList &keywords, StylingContext &styler) { - //Platform::DebugPrintf("Python coloured\n"); - bool fold = styler.GetPropSet().GetInt("fold"); - int whingeLevel = styler.GetPropSet().GetInt("tab.timmy.whinge.level"); - char prevWord[200]; - prevWord[0] = '\0'; - if (length == 0) - return ; - int lineCurrent = styler.GetLine(startPos); - int spaceFlags = 0; - // TODO: Need to check previous line for indentation for both folding and bad indentation - int indentCurrent = IndentAmount(styler, lineCurrent, &spaceFlags); - - int state = initStyle & 31; - char chPrev = ' '; - char chPrev2 = ' '; - char chNext = styler[startPos]; - char chNext2 = styler[startPos]; - int startSeg = startPos; - int lengthDoc = startPos + length; - bool atStartLine = true; - for (int i = startPos; i <= lengthDoc; i++) { - - if (atStartLine) { - if (whingeLevel == 1) { - styler.SetFlags((spaceFlags & wsInconsistent) ? 64 : 0, state); - } else if (whingeLevel == 2) { - styler.SetFlags((spaceFlags & wsSpaceTab) ? 64 : 0, state); - } else if (whingeLevel == 3) { - styler.SetFlags((spaceFlags & wsSpace) ? 64 : 0, state); - } else if (whingeLevel == 4) { - styler.SetFlags((spaceFlags & wsTab) ? 64 : 0, state); - } - atStartLine = false; - } - - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - chNext2 = styler.SafeGetCharAt(i + 2); - - if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { - if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) { - // Perform colourisation of white space and triple quoted strings at end of each line to allow - // tab marking to work inside white space and triple quoted strings - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - } - - int lev = indentCurrent; - int indentNext = IndentAmount(styler, lineCurrent + 1, &spaceFlags); - if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - // Only non whitespace lines can be headers - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - } - indentCurrent = indentNext; - if (fold) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - atStartLine = true; - } - - if (IsLeadByte(codePage, ch)) { // dbcs - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - chPrev2 = ' '; - i += 1; - continue; - } - - if (state == SCE_P_DEFAULT) { - if (iswordstart(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_P_WORD; - startSeg = i; - } else if (ch == '#') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_P_COMMENTLINE; - startSeg = i; - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - if (chNext == '\"' && chNext2 == '\"') { - i += 2; - state = SCE_P_TRIPLEDOUBLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_P_STRING; - } - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i - 1, state); - startSeg = i; - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_P_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_P_CHARACTER; - } - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - styler.ColourSegment(i, i, SCE_P_OPERATOR); - startSeg = i + 1; - } - } else if (state == SCE_P_WORD) { - if (!iswordchar(ch)) { - classifyWordPy(startSeg, i - 1, keywords, styler, prevWord); - state = SCE_P_DEFAULT; - startSeg = i; - if (ch == '#') { - state = SCE_P_COMMENTLINE; - } else if (ch == '\"') { - if (chNext == '\"' && chNext2 == '\"') { - i += 2; - state = SCE_P_TRIPLEDOUBLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_P_STRING; - } - } else if (ch == '\'') { - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_P_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_P_CHARACTER; - } - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_P_OPERATOR); - startSeg = i + 1; - } - } - } else { - if (state == SCE_P_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_P_DEFAULT; - startSeg = i; - } - } else if (state == SCE_P_STRING) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\"') { - styler.ColourSegment(startSeg, i, state); - state = SCE_P_DEFAULT; - startSeg = i + 1; - } - } else if (state == SCE_P_CHARACTER) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i, state); - state = SCE_P_DEFAULT; - startSeg = i + 1; - } - } else if (state == SCE_P_TRIPLE) { - if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { - styler.ColourSegment(startSeg, i, state); - state = SCE_P_DEFAULT; - startSeg = i + 1; - } - } else if (state == SCE_P_TRIPLEDOUBLE) { - if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { - styler.ColourSegment(startSeg, i, state); - state = SCE_P_DEFAULT; - startSeg = i + 1; - } - } - } - chPrev2 = chPrev; - chPrev = ch; - } - if (startSeg <= lengthDoc) { - if (state == SCE_P_DEFAULT) { - styler.ColourSegment(startSeg, lengthDoc, state); - } else if (state == SCE_P_WORD) { - classifyWordPy(startSeg, lengthDoc, keywords, styler, prevWord); - } else if (state == SCE_P_COMMENTLINE) { - styler.ColourSegment(startSeg, lengthDoc, state); - } else if (state == SCE_P_STRING) { - styler.ColourSegment(startSeg, lengthDoc, state); - } else if (state == SCE_P_CHARACTER) { - styler.ColourSegment(startSeg, lengthDoc, state); - } else if (state == SCE_P_TRIPLE) { - styler.ColourSegment(startSeg, lengthDoc, state); - } else if (state == SCE_P_TRIPLEDOUBLE) { - styler.ColourSegment(startSeg, lengthDoc, state); - } - } -} - -static void ColouriseBatchLine(char *lineBuffer, int lengthLine, StylingContext &styler) { - if (0 == strncmp(lineBuffer, "REM", 3)) { - styler.ColourSegment(0, lengthLine - 1, 1); - } else if (0 == strncmp(lineBuffer, "rem", 3)) { - styler.ColourSegment(0, lengthLine - 1, 1); - } else if (0 == strncmp(lineBuffer, "SET", 3)) { - styler.ColourSegment(0, lengthLine - 1, 2); - } else if (0 == strncmp(lineBuffer, "set", 3)) { - styler.ColourSegment(0, lengthLine - 1, 2); - } else if (lineBuffer[0] == ':') { - styler.ColourSegment(0, lengthLine - 1, 3); - } else { - styler.ColourSegment(0, lengthLine - 1, 0); - } -} - -static void ColouriseBatchDoc(int startPos, int length, int, StylingContext &styler) { - char lineBuffer[1024]; - unsigned int linePos = 0; - for (int i = startPos; i < startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { - ColouriseBatchLine(lineBuffer, linePos, styler); - linePos = 0; - } - } - if (linePos > 0) - ColouriseBatchLine(lineBuffer, linePos, styler); -} - -enum { eScriptNone, eScriptJS, eScriptVBS, eScriptPython }; -static int segIsScriptingIndicator(StylingContext &styler, unsigned int start, unsigned int end, int prevValue) { - char s[100]; - s[0] = '\0'; - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); - s[i + 1] = '\0'; - } -Platform::DebugPrintf("Scripting indicator [%s]\n", s); - if (strstr(s, "vbs")) - return eScriptVBS; - if (strstr(s, "pyth")) - return eScriptPython; - if (strstr(s, "javas")) - return eScriptJS; - if (strstr(s, "jscr")) - return eScriptJS; - - return prevValue; -} - -static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.') || - (styler[start] == '-') || (styler[start] == '#'); - char chAttr = SCE_H_ATTRIBUTEUNKNOWN; - if (wordIsNumber) { - chAttr = SCE_H_NUMBER; - } else { - char s[100]; - s[0] = '\0'; - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); - s[i + 1] = '\0'; - } - if (keywords.InList(s)) - chAttr = SCE_H_ATTRIBUTE; - } - styler.ColourTo(end, chAttr); -} - -static int classifyTagHTML(unsigned int start, unsigned int end, - WordList &keywords, StylingContext &styler) { - char s[100]; - // Copy after the '<' - unsigned int i = 0; - for (int cPos=start; cPos <= end && i < 30; cPos++) { - char ch = styler[cPos]; - if (ch != '<') - s[i++] = tolower(ch); - } - s[i] = '\0'; - char chAttr = SCE_H_TAGUNKNOWN; - if (s[0] == '!' && s[1] == '-' && s[2] == '-') { //Comment - chAttr = SCE_H_COMMENT; - } else if (s[0] == '/') { // Closing tag - if (keywords.InList(s + 1)) - chAttr = SCE_H_TAG; - } else { - if (keywords.InList(s)) { - chAttr = SCE_H_TAG; - if (0 == strcmp(s, "script")) - chAttr = SCE_H_SCRIPT; - } - } - styler.ColourTo(end, chAttr); - return chAttr; -} - -static void classifyWordHTJS(unsigned int start, unsigned int end, - WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_HJ_WORD; - if (wordIsNumber) - chAttr = SCE_HJ_NUMBER; - else { - if (keywords.InList(s)) - chAttr = SCE_HJ_KEYWORD; - } - styler.ColourTo(end, chAttr); -} - -static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); - s[i + 1] = '\0'; - } - char chAttr = SCE_HB_IDENTIFIER; - if (wordIsNumber) - chAttr = SCE_HB_NUMBER; - else { - if (keywords.InList(s)) { - chAttr = SCE_HB_WORD; - if (strcmp(s, "rem") == 0) - chAttr = SCE_HB_COMMENTLINE; - } - } - styler.ColourTo(end, chAttr); - if (chAttr == SCE_HB_COMMENTLINE) - return SCE_HB_COMMENTLINE; - else - return SCE_HB_DEFAULT; -} - -static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler, char *prevWord) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_HP_IDENTIFIER; - if (0 == strcmp(prevWord, "class")) - chAttr = SCE_HP_CLASSNAME; - else if (0 == strcmp(prevWord, "def")) - chAttr = SCE_HP_DEFNAME; - else if (wordIsNumber) - chAttr = SCE_HP_NUMBER; - else if (keywords.InList(s)) - chAttr = SCE_HP_WORD; - styler.ColourTo(end, chAttr); - strcpy(prevWord, s); -} - -inline bool ishtmlwordchar(char ch) { - return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#'; -} - -static bool InTagState(int state) { - return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN || - state == SCE_H_SCRIPT || - state == SCE_H_ATTRIBUTE || state == SCE_H_ATTRIBUTEUNKNOWN || - state == SCE_H_NUMBER || state == SCE_H_OTHER || - state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING; -} - -static bool isLineEnd(char ch) { - return ch == '\r' || ch == '\n'; -} - -static void ColouriseHyperTextDoc(int codePage, int startPos, int length, - int initStyle, WordList &keywords, WordList &keywords2, WordList &keywords3, WordList &keywords4, - StylingContext &styler) { - - styler.StartAt(startPos, 63); - bool lastTagWasScript = false; - char prevWord[200]; - prevWord[0] = '\0'; - int scriptLanguage = eScriptJS; - int state = initStyle; - // If inside a tag, it may be a script tage, so reread from the start to ensure any language tas are seen - if (InTagState(state)) { - while ((startPos > 1) && (InTagState(styler.StyleAt(startPos - 1)))) { - startPos--; - } - state = SCE_H_DEFAULT; - } - styler.StartAt(startPos, 63); - - int lineState = eScriptVBS; - int lineCurrent = styler.GetLine(startPos); - if (lineCurrent > 0) - lineState = styler.GetLineState(lineCurrent); - int defaultScript = lineState &0xff; - int beforeASP = (lineState >> 8) &0xff; - int inASP = (lineState >> 16) &0xff; - - char chPrev = ' '; - char chPrev2 = ' '; - styler.StartSegment(startPos); - int lengthDoc = startPos + length; - for (int i = startPos; i <= lengthDoc; i++) { - char ch = styler[i]; - char chNext = styler.SafeGetCharAt(i + 1); - char chNext2 = styler.SafeGetCharAt(i + 2); - - if (IsLeadByte(codePage, ch)) { // dbcs - chPrev2 = ' '; - chPrev = ' '; - i += 1; - continue; - } - - if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { - // New line -> record any line state onto /next/ line - lineCurrent++; - styler.SetLineState(lineCurrent, - defaultScript | (beforeASP << 8) | (inASP << 16)); - } - - // Handle ASP even within other constructs as it is a preprocessor - if ((ch == '<') && (chNext == '%')) { - beforeASP = state; - styler.ColourTo(i - 1, state); - if (chNext2 == '@') { - styler.ColourTo(i + 2, SCE_H_ASP); - state = SCE_H_ASPAT; - i+=2; - } else { - if (defaultScript == eScriptVBS) - state = SCE_HB_START; - else if (defaultScript == eScriptPython) - state = SCE_HP_START; - else - state = SCE_HJ_START; - if (chNext2 == '=') { - styler.ColourTo(i + 2, SCE_H_ASP); - i+=2; - } else { - styler.ColourTo(i + 1, SCE_H_ASP); - i++; - } - } - inASP = 1; - continue; - } - if (inASP && (ch == '%') && (chNext == '>')) { - if (state == SCE_H_ASPAT) - defaultScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i-1, defaultScript); - // Bounce out of any ASP mode - styler.ColourTo(i - 1, state); - //if (state == SCE_H_ASPAT) - // styler.ColourTo(i+1, SCE_H_ASPAT); - //else - styler.ColourTo(i+1, SCE_H_ASP); - i++; - state = beforeASP; - beforeASP = SCE_H_DEFAULT; - inASP = 0; - continue; - } - - if (state == SCE_H_DEFAULT) { - if (ch == '<') { - styler.ColourTo(i - 1, state); - state = SCE_H_TAGUNKNOWN; - if (chNext == '?') { - styler.ColourTo(i + 1, SCE_H_XMLSTART); - i++; - ch = chNext; - } - } else if (ch == '&') { - styler.ColourTo(i - 1, SCE_H_DEFAULT); - state = SCE_H_ENTITY; - } - } else if (state == SCE_H_COMMENT) { - if ((ch == '>') && (chPrev == '-')) { - styler.ColourTo(i, state); - state = SCE_H_DEFAULT; - } - } else if (state == SCE_H_ENTITY) { - if (ch == ';') { - styler.ColourTo(i, state); - state = SCE_H_DEFAULT; - } - } else if (state == SCE_H_TAGUNKNOWN) { - if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') { - int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler); - lastTagWasScript = eClass == SCE_H_SCRIPT; - if (lastTagWasScript) { - scriptLanguage = eScriptJS; - eClass = SCE_H_TAG; - } - if (ch == '>') { - styler.ColourTo(i, SCE_H_TAG); - if (lastTagWasScript) { - if (scriptLanguage == eScriptVBS) - state = SCE_HB_START; - else if (scriptLanguage == eScriptPython) - state = SCE_HP_START; - else - state = SCE_HJ_START; - } else { - state = SCE_H_DEFAULT; - } - } else { - if (eClass == SCE_H_COMMENT) { - state = SCE_H_COMMENT; - } else { - state = SCE_H_OTHER; - } - } - } - } else if (state == SCE_H_ATTRIBUTE) { - if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') { - if (lastTagWasScript) - scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i-1, scriptLanguage); - classifyAttribHTML(styler.GetStartSegment(), i - 1, keywords, styler); - if (ch == '>') { - styler.ColourTo(i, SCE_H_TAG); - if (lastTagWasScript) { - if (scriptLanguage == eScriptVBS) - state = SCE_HB_START; - else if (scriptLanguage == eScriptPython) - state = SCE_HP_START; - else - state = SCE_HJ_START; - } else { - state = SCE_H_DEFAULT; - } - } else { - state = SCE_H_OTHER; - } - } - } else if (state == SCE_H_ASP) { - if ((ch == '>') && (chPrev == '%')) { - styler.ColourTo(i, state); - state = SCE_H_DEFAULT; - } - } else if (state == SCE_H_ASPAT) { - if ((ch == '>') && (chPrev == '%')) { - styler.ColourTo(i, state); - state = SCE_H_DEFAULT; - } - } else if (state == SCE_H_OTHER) { - if (ch == '>') { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_H_TAG); - if (lastTagWasScript) { - if (scriptLanguage == eScriptVBS) - state = SCE_HB_START; - else if (scriptLanguage == eScriptPython) - state = SCE_HP_START; - else - state = SCE_HJ_START; - } else { - state = SCE_H_DEFAULT; - } - } else if (ch == '\"') { - styler.ColourTo(i - 1, state); - state = SCE_H_DOUBLESTRING; - } else if (ch == '\'') { - styler.ColourTo(i - 1, state); - state = SCE_H_SINGLESTRING; - } else if (ch == '/' && chNext == '>') { - styler.ColourTo(i - 1, state); - styler.ColourTo(i + 1, SCE_H_TAGEND); - i++; - ch = chNext; - state = SCE_H_DEFAULT; - } else if (ch == '?' && chNext == '>') { - styler.ColourTo(i - 1, state); - styler.ColourTo(i + 1, SCE_H_XMLEND); - i++; - ch = chNext; - state = SCE_H_DEFAULT; - } else if (ishtmlwordchar(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_H_ATTRIBUTE; - } - } else if (state == SCE_H_DOUBLESTRING) { - if (ch == '\"') { - if (lastTagWasScript) - scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); - styler.ColourTo(i, SCE_H_DOUBLESTRING); - state = SCE_H_OTHER; - } - } else if (state == SCE_H_SINGLESTRING) { - if (ch == '\'') { - if (lastTagWasScript) - scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); - styler.ColourTo(i, SCE_H_SINGLESTRING); - state = SCE_H_OTHER; - } - } else if (state == SCE_HJ_DEFAULT || state == SCE_HJ_START) { - if (iswordstart(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_HJ_WORD; - } else if (ch == '/' && chNext == '*') { - styler.ColourTo(i - 1, state); - if (chNext2 == '*') - state = SCE_HJ_COMMENTDOC; - else - state = SCE_HJ_COMMENT; - } else if (ch == '/' && chNext == '/') { - styler.ColourTo(i - 1, state); - state = SCE_HJ_COMMENTLINE; - } else if (ch == '\"') { - styler.ColourTo(i - 1, state); - state = SCE_HJ_DOUBLESTRING; - } else if (ch == '\'') { - styler.ColourTo(i - 1, state); - state = SCE_HJ_SINGLESTRING; - } else if ((ch == '<') && (chNext == '/')) { - styler.ColourTo(i - 1, state); - state = SCE_H_TAGUNKNOWN; - } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && - styler.SafeGetCharAt(i + 3) == '-') { - styler.ColourTo(i - 1, state); - state = SCE_HJ_COMMENTLINE; - } else if (isoperator(ch)) { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_HJ_SYMBOLS); - state = SCE_HJ_DEFAULT; - } else if ((ch == ' ') || (ch == '\t')) { - if (state == SCE_HJ_START) { - styler.ColourTo(i - 1, state); - state = SCE_HJ_DEFAULT; - } - } - } else if (state == SCE_HJ_WORD) { - if (!iswordchar(ch)) { - classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler); - //styler.ColourTo(i - 1, eHTJSKeyword); - state = SCE_HJ_DEFAULT; - if (ch == '/' && chNext == '*') { - if (chNext2 == '*') - state = SCE_HJ_COMMENTDOC; - else - state = SCE_HJ_COMMENT; - } else if (ch == '/' && chNext == '/') { - state = SCE_HJ_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_HJ_DOUBLESTRING; - } else if (ch == '\'') { - state = SCE_HJ_SINGLESTRING; - } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_HJ_SYMBOLS); - state = SCE_HJ_DEFAULT; - } - } - } else if (state == SCE_HJ_COMMENT) { - if (ch == '/' && chPrev == '*') { - state = SCE_HJ_DEFAULT; - styler.ColourTo(i, SCE_HJ_COMMENT); - } else if ((ch == '<') && (chNext == '/')) { - styler.ColourTo(i - 1, state); - styler.ColourTo(i + 1, SCE_H_TAGEND); - i++; - ch = chNext; - state = SCE_H_DEFAULT; - } - } else if (state == SCE_HJ_COMMENTDOC) { - if (ch == '/' && chPrev == '*') { - state = SCE_HJ_DEFAULT; - styler.ColourTo(i, SCE_HJ_COMMENTDOC); - } else if ((ch == '<') && (chNext == '/')) { - styler.ColourTo(i - 1, state); - styler.ColourTo(i + 1, SCE_H_TAGEND); - i++; - ch = chNext; - state = SCE_H_DEFAULT; - } - } else if (state == SCE_HJ_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, SCE_HJ_COMMENTLINE); - state = SCE_HJ_DEFAULT; - } else if ((ch == '<') && (chNext == '/')) { - // Common to hide end script tag in comment - styler.ColourTo(i - 1, SCE_HJ_COMMENTLINE); - state = SCE_H_TAGUNKNOWN; - } - } else if (state == SCE_HJ_DOUBLESTRING) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - } - } else if (ch == '\"') { - styler.ColourTo(i, SCE_HJ_DOUBLESTRING); - state = SCE_HJ_DEFAULT; - i++; - ch = chNext; - } else if (isLineEnd(ch)) { - styler.ColourTo(i-1, state); - state = SCE_HJ_STRINGEOL; - } - } else if (state == SCE_HJ_SINGLESTRING) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - } - } else if (ch == '\'') { - styler.ColourTo(i, SCE_HJ_SINGLESTRING); - state = SCE_HJ_DEFAULT; - i++; - ch = chNext; - } else if (isLineEnd(ch)) { - styler.ColourTo(i-1, state); - state = SCE_HJ_STRINGEOL; - } - } else if (state == SCE_HJ_STRINGEOL) { - if (!isLineEnd(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_HJ_DEFAULT; - } - } else if (state == SCE_HB_DEFAULT || state == SCE_HB_START) { - if (iswordstart(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_HB_WORD; - } else if (ch == '\'') { - styler.ColourTo(i - 1, state); - state = SCE_HB_COMMENTLINE; - } else if (ch == '\"') { - styler.ColourTo(i - 1, state); - state = SCE_HB_STRING; - } else if ((ch == '<') && (chNext == '/')) { - styler.ColourTo(i - 1, state); - state = SCE_H_TAGUNKNOWN; - } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && - styler.SafeGetCharAt(i + 3) == '-') { - styler.ColourTo(i - 1, state); - state = SCE_HB_COMMENTLINE; - } else if (isoperator(ch)) { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_HB_DEFAULT); - state = SCE_HB_DEFAULT; - } else if ((ch == ' ') || (ch == '\t')) { - if (state == SCE_HB_START) { - styler.ColourTo(i - 1, state); - state = SCE_HB_DEFAULT; - } - } - } else if (state == SCE_HB_WORD) { - if (!iswordchar(ch)) { - state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler); - if (state == SCE_HB_DEFAULT) { - if (ch == '\"') { - state = SCE_HB_STRING; - } else if (ch == '\'') { - state = SCE_HB_COMMENTLINE; - } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_HB_DEFAULT); - state = SCE_HB_DEFAULT; - } - } - } - } else if (state == SCE_HB_STRING) { - if (ch == '\"') { - styler.ColourTo(i, state); - state = SCE_HB_DEFAULT; - i++; - ch = chNext; - } else if (ch == '\r' || ch == '\n') { - styler.ColourTo(i-1, state); - state = SCE_HB_STRINGEOL; - } - } else if (state == SCE_HB_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, state); - state = SCE_HB_DEFAULT; - } else if ((ch == '<') && (chNext == '/')) { - // Common to hide end script tag in comment - styler.ColourTo(i - 1, state); - state = SCE_H_TAGUNKNOWN; - } - } else if (state == SCE_HB_STRINGEOL) { - if (!isLineEnd(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_HB_DEFAULT; - } - } else if (state == SCE_HP_DEFAULT || state == SCE_HP_START) { - if (iswordstart(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_HP_WORD; - } else if ((ch == '<') && (chNext == '/')) { - styler.ColourTo(i - 1, state); - state = SCE_H_TAGUNKNOWN; - } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && - styler.SafeGetCharAt(i + 3) == '-') { - styler.ColourTo(i - 1, state); - state = SCE_HP_COMMENTLINE; - } else if (ch == '#') { - styler.ColourTo(i - 1, state); - state = SCE_HP_COMMENTLINE; - } else if (ch == '\"') { - styler.ColourTo(i - 1, state); - if (chNext == '\"' && chNext2 == '\"') { - i += 2; - state = SCE_HP_TRIPLEDOUBLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_HP_STRING; - } - } else if (ch == '\'') { - styler.ColourTo(i - 1, state); - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_HP_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_HP_CHARACTER; - } - } else if (isoperator(ch)) { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_HP_OPERATOR); - } else if ((ch == ' ') || (ch == '\t')) { - if (state == SCE_HP_START) { - styler.ColourTo(i - 1, state); - state = SCE_HP_DEFAULT; - } - } - } else if (state == SCE_HP_WORD) { - if (!iswordchar(ch)) { - classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord); - state = SCE_HP_DEFAULT; - if (ch == '#') { - state = SCE_HP_COMMENTLINE; - } else if (ch == '\"') { - if (chNext == '\"' && chNext2 == '\"') { - i += 2; - state = SCE_HP_TRIPLEDOUBLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_HP_STRING; - } - } else if (ch == '\'') { - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_HP_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } else { - state = SCE_HP_CHARACTER; - } - } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_HP_OPERATOR); - } - } - } else { - if (state == SCE_HP_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, state); - state = SCE_HP_DEFAULT; - } - } else if (state == SCE_HP_STRING) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\"') { - styler.ColourTo(i, state); - state = SCE_HP_DEFAULT; - } - } else if (state == SCE_HP_CHARACTER) { - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (ch == '\'') { - styler.ColourTo(i, state); - state = SCE_HP_DEFAULT; - } - } else if (state == SCE_HP_TRIPLE) { - if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { - styler.ColourTo(i, state); - state = SCE_HP_DEFAULT; - } - } else if (state == SCE_HP_TRIPLEDOUBLE) { - if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { - styler.ColourTo(i, state); - state = SCE_HP_DEFAULT; - } - } - } - if (state == SCE_HB_DEFAULT) { // One of the above succeeded - if (ch == '\"') { - state = SCE_HB_STRING; - } else if (ch == '\'') { - state = SCE_HB_COMMENTLINE; - } else if (iswordstart(ch)) { - state = SCE_HB_WORD; - } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_HB_DEFAULT); - } - } - if (state == SCE_HJ_DEFAULT) { // One of the above succeeded - if (ch == '/' && chNext == '*') { - if (styler.SafeGetCharAt(i + 2) == '*') - state = SCE_HJ_COMMENTDOC; - else - state = SCE_HJ_COMMENT; - } else if (ch == '/' && chNext == '/') { - state = SCE_HJ_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_HJ_DOUBLESTRING; - } else if (ch == '\'') { - state = SCE_HJ_SINGLESTRING; - } else if (iswordstart(ch)) { - state = SCE_HJ_WORD; - } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_HJ_SYMBOLS); - } - } - chPrev2 = chPrev; - chPrev = ch; - } - styler.ColourTo(lengthDoc - 1, state); -} - -static void ColourisePropsLine(char *lineBuffer, int lengthLine, StylingContext &styler) { - int i = 0; - while (isspace(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces - i++; - if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') { - styler.ColourSegment(0, lengthLine - 1, 1); - } else if (lineBuffer[i] == '[') { - styler.ColourSegment(0, lengthLine - 1, 2); - } else if (lineBuffer[i] == '@') { - styler.ColourSegment(0, i, 4); - if (lineBuffer[++i] == '=') - styler.ColourSegment(i, i, 3); - if (++i < lengthLine) - styler.ColourSegment(i, lengthLine - 1, 0); - } else { - while (lineBuffer[i] != '=' && (i < lengthLine)) // Search the '=' character - i++; - if (lineBuffer[i] == '=') { - styler.ColourSegment(0, i - 1, 0); - styler.ColourSegment(i, i, 3); - if (++i < lengthLine) - styler.ColourSegment(i, lengthLine - 1, 0); - } else - styler.ColourSegment(0, lengthLine - 1, 0); - } -} - -static void ColourisePropsDoc(int startPos, int length, int, StylingContext &styler) { - char lineBuffer[1024]; - unsigned int linePos = 0; - for (int i = startPos; i <= startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { - lineBuffer[linePos] = '\0'; - ColourisePropsLine(lineBuffer, linePos, styler); - linePos = 0; - } - } - if (linePos > 0) - ColourisePropsLine(lineBuffer, linePos, styler); -} - -static void ColouriseMakeLine(char *lineBuffer, int lengthLine, StylingContext &styler) { - int i = 0; - while (isspace(lineBuffer[i]) && (i < lengthLine)) - i++; - if (lineBuffer[i] == '#' || lineBuffer[i] == '!') { - styler.ColourSegment(0, lengthLine - 1, 1); - } else { - styler.ColourSegment(0, lengthLine - 1, 0); - } -} - -static void ColouriseMakeDoc(int startPos, int length, int, StylingContext &styler) { - char lineBuffer[1024]; - unsigned int linePos = 0; - for (int i = startPos; i <= startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { - ColouriseMakeLine(lineBuffer, linePos, styler); - linePos = 0; - } - } - if (linePos > 0) - ColouriseMakeLine(lineBuffer, linePos, styler); -} - -static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, StylingContext &styler) { - if (lineBuffer[0] == '>') { - // Command or return status - styler.ColourSegment(0, lengthLine - 1, 4); - } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) { - styler.ColourSegment(0, lengthLine - 1, 1); - } else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) { - // Borland error message - styler.ColourSegment(0, lengthLine - 1, 5); - } else if (0 == strncmp(lineBuffer, "Warning ", strlen("Warning "))) { - // Borland warning message - styler.ColourSegment(0, lengthLine - 1, 5); - } else { - // Look for <filename>:<line>:message - // Look for <filename>(line)message - // Look for <filename>(line,pos)message - int state = 0; - for (int i = 0; i < lengthLine; i++) { - if (state == 0 && lineBuffer[i] == ':' && isdigit(lineBuffer[i + 1])) { - state = 1; - } else if (state == 0 && lineBuffer[i] == '(') { - state = 10; - } else if (state == 1 && isdigit(lineBuffer[i])) { - state = 2; - } else if (state == 2 && lineBuffer[i] == ':') { - state = 3; - break; - } else if (state == 2 && !isdigit(lineBuffer[i])) { - state = 99; - } else if (state == 10 && isdigit(lineBuffer[i])) { - state = 11; - } else if (state == 11 && lineBuffer[i] == ',') { - state = 14; - } else if (state == 11 && lineBuffer[i] == ')') { - state = 12; - break; - } else if (state == 12 && lineBuffer[i] == ':') { - state = 13; - } else if (state == 14 && lineBuffer[i] == ')') { - state = 15; - break; - } else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) { - state = 99; - } - } - if (state == 3) { - styler.ColourSegment(0, lengthLine - 1, 2); - } else if ((state == 14) || (state == 15)) { - styler.ColourSegment(0, lengthLine - 1, 3); - } else { - styler.ColourSegment(0, lengthLine - 1, 0); - } - } -} - -static void ColouriseErrorListDoc(int startPos, int length, int, StylingContext &styler) { - char lineBuffer[1024]; - unsigned int linePos = 0; - for (int i = startPos; i <= startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { - ColouriseErrorListLine(lineBuffer, linePos, styler); - linePos = 0; - } - } - if (linePos > 0) - ColouriseErrorListLine(lineBuffer, linePos, styler); -} - -static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, StylingContext &styler) { - char s[100]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = toupper(styler[start + i]); - s[i + 1] = '\0'; - } - char chAttr = SCE_C_IDENTIFIER; - if (wordIsNumber) - chAttr = SCE_C_NUMBER; - else { - if (keywords.InList(s)) - chAttr = SCE_C_WORD; - } - styler.ColourSegment(start, end, chAttr); -} - -static void ColouriseSQLDoc(int codePage, int startPos, int length, - int initStyle, WordList &keywords, StylingContext &styler) { - - bool fold = styler.GetPropSet().GetInt("fold"); - int lineCurrent = styler.GetLine(startPos); - int spaceFlags = 0; - int indentCurrent = 0; - - int state = initStyle; - char chPrev = ' '; - char chNext = styler[startPos]; - int startSeg = startPos; - int lengthDoc = startPos + length; - bool prevCr = false; - for (int i = startPos; i <= lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { - indentCurrent = IndentAmount(styler, lineCurrent, &spaceFlags); - int lev = indentCurrent; - if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - // Only non whitespace lines can be headers - int indentNext = IndentAmount(styler, lineCurrent + 1, &spaceFlags); - if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - } - if (fold) { - styler.SetLevel(lineCurrent, lev); - } - } - - if (IsLeadByte(codePage, ch)) { // dbcs - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - i += 1; - continue; - } - - if (state == SCE_C_DEFAULT) { - if (iswordstart(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_WORD; - startSeg = i; - } else if (ch == '/' && chNext == '*') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_COMMENT; - startSeg = i; - } else if (ch == '-' && chNext == '-') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_COMMENTLINE; - startSeg = i; - } else if (ch == '\'') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_STRING; - startSeg = i; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i - 1, state); - styler.ColourSegment(i, i, SCE_C_OPERATOR); - startSeg = i + 1; - } - } else if (state == SCE_C_WORD) { - if (!iswordchar(ch)) { - classifyWordSQL(startSeg, i - 1, keywords, styler); - state = SCE_C_DEFAULT; - startSeg = i; - if (ch == '/' && chNext == '*') { - state = SCE_C_COMMENT; - } else if (ch == '-' && chNext == '-') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\'') { - state = SCE_C_STRING; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_C_OPERATOR); - startSeg = i + 1; - } - } - } else { - if (state == SCE_C_COMMENT) { - if (ch == '/' && chPrev == '*' && ( - (i > startSeg + 2) || ((initStyle == SCE_C_COMMENT) && (startSeg == startPos)))) { - state = SCE_C_DEFAULT; - styler.ColourSegment(startSeg, i, state); - startSeg = i + 1; - } - } else if (state == SCE_C_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - styler.ColourSegment(startSeg, i - 1, state); - state = SCE_C_DEFAULT; - startSeg = i; - } - } else if (state == SCE_C_STRING) { - if (ch == '\'') { - if ( chNext == '\'' ) { - i++; - } else { - styler.ColourSegment(startSeg, i, state); - state = SCE_C_DEFAULT; - i++; - startSeg = i; - } - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } - if (state == SCE_C_DEFAULT) { // One of the above succeeded - if (ch == '/' && chNext == '*') { - state = SCE_C_COMMENT; - } else if (ch == '-' && chNext == '-') { - state = SCE_C_COMMENTLINE; - } else if (ch == '\'') { - state = SCE_C_STRING; - } else if (iswordstart(ch)) { - state = SCE_C_WORD; - } else if (isoperator(ch)) { - styler.ColourSegment(startSeg, i, SCE_C_OPERATOR); - startSeg = i + 1; - } - } - } - chPrev = ch; - } - if (startSeg < lengthDoc) - styler.ColourSegment(startSeg, lengthDoc - 1, state); -} - -void ColouriseDoc(int codePage, int startPos, int lengthDoc, int initStyle, - int language, WordList *keywordlists[], StylingContext &styler) { - //Platform::DebugPrintf("ColouriseDoc <%s>\n", language); - if (language == SCLEX_PYTHON) { - // Python uses a different mask because bad indentation is marked by oring with 32 - styler.StartAt(startPos, 127); - ColourisePyDoc(codePage, startPos, lengthDoc, initStyle, *keywordlists[0], styler); - } else if (language == SCLEX_PERL) { - // Lexer for perl often has to backtrack to start of current style to determine - // which characters are being used as quotes, how deeply nested is the - // start position and what the termination string is for here documents - ColourisePerlDoc(codePage, startPos, lengthDoc, initStyle, *keywordlists[0], styler); - } else if ((language == SCLEX_HTML) || (language == SCLEX_XML)) { - // Lexer for HTML requires more lexical states (6 bits worth) than most lexers - ColouriseHyperTextDoc(codePage, startPos, lengthDoc, initStyle, - *keywordlists[0], *keywordlists[1], *keywordlists[2], *keywordlists[3], styler); - } else { - styler.StartAt(startPos); - if (language == SCLEX_CPP) { - ColouriseCppDoc(codePage, startPos, lengthDoc, initStyle, *keywordlists[0], styler); - } else if (language == SCLEX_SQL) { - ColouriseSQLDoc(codePage, startPos, lengthDoc, initStyle, *keywordlists[0], styler); - } else if (language == SCLEX_VB) { - ColouriseVBDoc(codePage, startPos, lengthDoc, initStyle, *keywordlists[0], styler); - } else if (language == SCLEX_PROPERTIES) { - ColourisePropsDoc(startPos, lengthDoc, initStyle, styler); - } else if (language == SCLEX_ERRORLIST) { - ColouriseErrorListDoc(startPos, lengthDoc, initStyle, styler); - } else if (language == SCLEX_MAKEFILE) { - ColouriseMakeDoc(startPos, lengthDoc, initStyle, styler); - } else if (language == SCLEX_BATCH) { - ColouriseBatchDoc(startPos, lengthDoc, initStyle, styler); - } else { - // Null language means all style bytes are 0 so just mark the end - no need to fill in. - styler.StartAt(startPos + lengthDoc - 1); - styler.ColourSegment(0, 0, 0); - } +LexerModule *LexerModule::base = 0; + +LexerModule::LexerModule(int language_, LexerFunction fn_) : + language(language_), fn(fn_) { + next = base; + base = this; +} + +void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle, + int language, WordList *keywordlists[], Accessor &styler) { + LexerModule *lm = base; + while (lm) { + if (lm->language == language) { + lm->fn(startPos, lengthDoc, initStyle, keywordlists, styler); + return; + } + lm = lm->next; + } + // Unknown language + // Null language means all style bytes are 0 so just mark the end - no need to fill in. + if (lengthDoc > 0) { + styler.StartAt(startPos + lengthDoc - 1); + styler.StartSegment(startPos + lengthDoc - 1); + styler.ColourTo(startPos + lengthDoc - 1, 0); } } diff --git a/src/stc/scintilla/src/LexCPP.cxx b/src/stc/scintilla/src/LexCPP.cxx new file mode 100644 index 0000000000..4f042bd61d --- /dev/null +++ b/src/stc/scintilla/src/LexCPP.cxx @@ -0,0 +1,258 @@ +// SciTE - Scintilla based Text Editor +// LexCPP.cxx - lexer for C++, C, Java, and Javascript +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + bool wordIsUUID = false; + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_C_IDENTIFIER; + if (wordIsNumber) + chAttr = SCE_C_NUMBER; + else { + if (keywords.InList(s)) { + chAttr = SCE_C_WORD; + wordIsUUID = strcmp(s, "uuid") == 0; + } + } + styler.ColourTo(end, chAttr); + return wordIsUUID; +} + +static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + + styler.StartAt(startPos); + + bool fold = styler.GetPropertyInt("fold"); + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + + int state = initStyle; + if (state == SCE_C_STRINGEOL) // Does not leak onto next line + state = SCE_C_DEFAULT; + char chPrev = ' '; + char chNext = styler[startPos]; + unsigned int lengthDoc = startPos + length; + int visChars = 0; + styler.StartSegment(startPos); + bool lastWordWasUUID = false; + for (unsigned int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { + // End of line + if (state == SCE_C_STRINGEOL) { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + } + if (fold) { + int lev = levelPrev; + if (visChars == 0) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((levelCurrent > levelPrev) && (visChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + styler.SetLevel(lineCurrent, lev); + lineCurrent++; + visChars = 0; + levelPrev = levelCurrent; + } + } + if (!isspace(ch)) + visChars++; + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + i += 1; + continue; + } + + if (state == SCE_C_DEFAULT) { + if (iswordstart(ch)) { + styler.ColourTo(i-1, state); + if (lastWordWasUUID) { + state = SCE_C_UUID; + lastWordWasUUID = false; + } else { + state = SCE_C_WORD; + } + } else if (ch == '/' && chNext == '*') { + styler.ColourTo(i-1, state); + if (styler.SafeGetCharAt(i + 2) == '*') + state = SCE_C_COMMENTDOC; + else + state = SCE_C_COMMENT; + } else if (ch == '/' && chNext == '/') { + styler.ColourTo(i-1, state); + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i-1, state); + state = SCE_C_STRING; + } else if (ch == '\'') { + styler.ColourTo(i-1, state); + state = SCE_C_CHARACTER; + } else if (ch == '#') { + styler.ColourTo(i-1, state); + state = SCE_C_PREPROCESSOR; + } else if (isoperator(ch)) { + styler.ColourTo(i-1, state); + styler.ColourTo(i, SCE_C_OPERATOR); + if ((ch == '{') || (ch == '}')) { + levelCurrent += (ch == '{') ? 1 : -1; + } + } + } else if (state == SCE_C_WORD) { + if (!iswordchar(ch)) { + lastWordWasUUID = classifyWordCpp(styler.GetStartSegment(), i - 1, keywords, styler); + state = SCE_C_DEFAULT; + if (ch == '/' && chNext == '*') { + if (styler.SafeGetCharAt(i + 2) == '*') + state = SCE_C_COMMENTDOC; + else + state = SCE_C_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_C_STRING; + } else if (ch == '\'') { + state = SCE_C_CHARACTER; + } else if (ch == '#') { + state = SCE_C_PREPROCESSOR; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_C_OPERATOR); + if ((ch == '{') || (ch == '}')) { + levelCurrent += (ch == '{') ? 1 : -1; + } + } + } + } else { + if (state == SCE_C_PREPROCESSOR) { + if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) { + styler.ColourTo(i-1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_COMMENT) { + if (ch == '/' && chPrev == '*') { + if (((i > styler.GetStartSegment() + 2) || ( + (initStyle == SCE_C_COMMENT) && + (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + } + } + } else if (state == SCE_C_COMMENTDOC) { + if (ch == '/' && chPrev == '*') { + if (((i > styler.GetStartSegment() + 2) || ( + (initStyle == SCE_C_COMMENTDOC) && + (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + } + } + } else if (state == SCE_C_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i-1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_STRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } else if (chNext == '\r' || chNext == '\n') { + styler.ColourTo(i-1, SCE_C_STRINGEOL); + state = SCE_C_STRINGEOL; + } + } else if (state == SCE_C_CHARACTER) { + if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { + styler.ColourTo(i-1, SCE_C_STRINGEOL); + state = SCE_C_STRINGEOL; + } else if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\'') { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (state == SCE_C_UUID) { + if (ch == '\r' || ch == '\n' || ch == ')') { + styler.ColourTo(i-1, state); + state = SCE_C_DEFAULT; + } + } + if (state == SCE_C_DEFAULT) { // One of the above succeeded + if (ch == '/' && chNext == '*') { + if (styler.SafeGetCharAt(i + 2) == '*') + state = SCE_C_COMMENTDOC; + else + state = SCE_C_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_C_STRING; + } else if (ch == '\'') { + state = SCE_C_CHARACTER; + } else if (ch == '#') { + state = SCE_C_PREPROCESSOR; + } else if (iswordstart(ch)) { + state = SCE_C_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_C_OPERATOR); + if ((ch == '{') || (ch == '}')) { + levelCurrent += (ch == '{') ? 1 : -1; + } + } + } + } + chPrev = ch; + } + styler.ColourTo(lengthDoc - 1, state); + + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + if (fold) { + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + //styler.SetLevel(lineCurrent, levelCurrent | flagsNext); + styler.SetLevel(lineCurrent, levelPrev | flagsNext); + + } +} + +LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc); diff --git a/src/stc/scintilla/src/LexHTML.cxx b/src/stc/scintilla/src/LexHTML.cxx new file mode 100644 index 0000000000..653aa4653f --- /dev/null +++ b/src/stc/scintilla/src/LexHTML.cxx @@ -0,0 +1,1139 @@ +// SciTE - Scintilla based Text Editor +// LexHTML.cxx - lexer for HTML +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +enum { eScriptNone, eScriptJS, eScriptVBS, eScriptPython }; +static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, int prevValue) { + char s[100]; + s[0] = '\0'; + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(tolower(styler[start + i])); + s[i + 1] = '\0'; + } +//Platform::DebugPrintf("Scripting indicator [%s]\n", s); + if (strstr(s, "vbs")) + return eScriptVBS; + if (strstr(s, "pyth")) + return eScriptPython; + if (strstr(s, "javas")) + return eScriptJS; + if (strstr(s, "jscr")) + return eScriptJS; + + return prevValue; +} + +static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.') || + (styler[start] == '-') || (styler[start] == '#'); + char chAttr = SCE_H_ATTRIBUTEUNKNOWN; + if (wordIsNumber) { + chAttr = SCE_H_NUMBER; + } else { + char s[100]; + s[0] = '\0'; + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(tolower(styler[start + i])); + s[i + 1] = '\0'; + } + if (keywords.InList(s)) + chAttr = SCE_H_ATTRIBUTE; + } + styler.ColourTo(end, chAttr); +} + +static int classifyTagHTML(unsigned int start, unsigned int end, + WordList &keywords, Accessor &styler) { + char s[100]; + // Copy after the '<' + unsigned int i = 0; + for (unsigned int cPos=start; cPos <= end && i < 30; cPos++) { + char ch = styler[cPos]; + if (ch != '<') + s[i++] = static_cast<char>(tolower(ch)); + } + s[i] = '\0'; + char chAttr = SCE_H_TAGUNKNOWN; + if (s[0] == '!' && s[1] == '-' && s[2] == '-') { //Comment + chAttr = SCE_H_COMMENT; + } else if (s[0] == '/') { // Closing tag + if (keywords.InList(s + 1)) + chAttr = SCE_H_TAG; + } else { + if (keywords.InList(s)) { + chAttr = SCE_H_TAG; + if (0 == strcmp(s, "script")) + chAttr = SCE_H_SCRIPT; + } + } + styler.ColourTo(end, chAttr); + return chAttr; +} + +static void classifyWordHTJS(unsigned int start, unsigned int end, + WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_HJ_WORD; + if (wordIsNumber) + chAttr = SCE_HJ_NUMBER; + else { + if (keywords.InList(s)) + chAttr = SCE_HJ_KEYWORD; + } + styler.ColourTo(end, chAttr); +} + +static void classifyWordHTJSA(unsigned int start, unsigned int end, + WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_HJA_WORD; + if (wordIsNumber) + chAttr = SCE_HJA_NUMBER; + else { + if (keywords.InList(s)) + chAttr = SCE_HJA_KEYWORD; + } + styler.ColourTo(end, chAttr); +} + +static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(tolower(styler[start + i])); + s[i + 1] = '\0'; + } + char chAttr = SCE_HB_IDENTIFIER; + if (wordIsNumber) + chAttr = SCE_HB_NUMBER; + else { + if (keywords.InList(s)) { + chAttr = SCE_HB_WORD; + if (strcmp(s, "rem") == 0) + chAttr = SCE_HB_COMMENTLINE; + } + } + styler.ColourTo(end, chAttr); + if (chAttr == SCE_HB_COMMENTLINE) + return SCE_HB_COMMENTLINE; + else + return SCE_HB_DEFAULT; +} + +static int classifyWordHTVBA(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(tolower(styler[start + i])); + s[i + 1] = '\0'; + } + char chAttr = SCE_HBA_IDENTIFIER; + if (wordIsNumber) + chAttr = SCE_HBA_NUMBER; + else { + if (keywords.InList(s)) { + chAttr = SCE_HBA_WORD; + if (strcmp(s, "rem") == 0) + chAttr = SCE_HBA_COMMENTLINE; + } + } + styler.ColourTo(end, chAttr); + if (chAttr == SCE_HBA_COMMENTLINE) + return SCE_HBA_COMMENTLINE; + else + return SCE_HBA_DEFAULT; +} + +static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_HP_IDENTIFIER; + if (0 == strcmp(prevWord, "class")) + chAttr = SCE_HP_CLASSNAME; + else if (0 == strcmp(prevWord, "def")) + chAttr = SCE_HP_DEFNAME; + else if (wordIsNumber) + chAttr = SCE_HP_NUMBER; + else if (keywords.InList(s)) + chAttr = SCE_HP_WORD; + styler.ColourTo(end, chAttr); + strcpy(prevWord, s); +} + +static void classifyWordHTPyA(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_HPA_IDENTIFIER; + if (0 == strcmp(prevWord, "class")) + chAttr = SCE_HPA_CLASSNAME; + else if (0 == strcmp(prevWord, "def")) + chAttr = SCE_HPA_DEFNAME; + else if (wordIsNumber) + chAttr = SCE_HPA_NUMBER; + else if (keywords.InList(s)) + chAttr = SCE_HPA_WORD; + styler.ColourTo(end, chAttr); + strcpy(prevWord, s); +} + +inline bool ishtmlwordchar(char ch) { + return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#'; +} + +static bool InTagState(int state) { + return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN || + state == SCE_H_SCRIPT || + state == SCE_H_ATTRIBUTE || state == SCE_H_ATTRIBUTEUNKNOWN || + state == SCE_H_NUMBER || state == SCE_H_OTHER || + state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING; +} + +static bool isLineEnd(char ch) { + return ch == '\r' || ch == '\n'; +} + +static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + WordList &keywords=*keywordlists[0]; + WordList &keywords2=*keywordlists[1]; + WordList &keywords3=*keywordlists[2]; + WordList &keywords4=*keywordlists[3]; + + // Lexer for HTML requires more lexical states (7 bits worth) than most lexers + styler.StartAt(startPos, 127); + bool lastTagWasScript = false; + char prevWord[200]; + prevWord[0] = '\0'; + int scriptLanguage = eScriptJS; + int state = initStyle; + // If inside a tag, it may be a script tage, so reread from the start to ensure any language tas are seen + if (InTagState(state)) { + while ((startPos > 1) && (InTagState(styler.StyleAt(startPos - 1)))) { + startPos--; + } + state = SCE_H_DEFAULT; + } + styler.StartAt(startPos, 127); + + int lineState = eScriptVBS; + int lineCurrent = styler.GetLine(startPos); + if (lineCurrent > 0) + lineState = styler.GetLineState(lineCurrent); + int defaultScript = lineState &0xff; + int beforeASP = (lineState >> 8) &0xff; + int inASP = (lineState >> 16) &0xff; + + char chPrev = ' '; + char chPrev2 = ' '; + styler.StartSegment(startPos); + int lengthDoc = startPos + length; + for (int i = startPos; i < lengthDoc; i++) { + char ch = styler[i]; + char chNext = styler.SafeGetCharAt(i + 1); + char chNext2 = styler.SafeGetCharAt(i + 2); + + if (styler.IsLeadByte(ch)) { + chPrev2 = ' '; + chPrev = ' '; + i += 1; + continue; + } + + if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { + // New line -> record any line state onto /next/ line + lineCurrent++; + styler.SetLineState(lineCurrent, + defaultScript | (beforeASP << 8) | (inASP << 16)); + } + + // Handle ASP even within other constructs as it is a preprocessor + if ((ch == '<') && (chNext == '%')) { + beforeASP = state; + styler.ColourTo(i - 1, state); + if (chNext2 == '@') { + styler.ColourTo(i + 2, SCE_H_ASP); + state = SCE_H_ASPAT; + i+=2; + } else { + if (defaultScript == eScriptVBS) + state = SCE_HBA_START; + else if (defaultScript == eScriptPython) + state = SCE_HPA_START; + else + state = SCE_HJA_START; + if (chNext2 == '=') { + styler.ColourTo(i + 2, SCE_H_ASP); + i+=2; + } else { + styler.ColourTo(i + 1, SCE_H_ASP); + i++; + } + } + inASP = 1; + continue; + } + if (inASP && (ch == '%') && (chNext == '>')) { + if (state == SCE_H_ASPAT) + defaultScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i-1, defaultScript); + // Bounce out of any ASP mode + if (state == SCE_HJA_WORD) { + classifyWordHTJSA(styler.GetStartSegment(), i - 1, keywords2, styler); + } else if (state == SCE_HBA_WORD) { + classifyWordHTVBA(styler.GetStartSegment(), i - 1, keywords3, styler); + } else if (state == SCE_HPA_WORD) { + classifyWordHTPyA(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord); + } else { + styler.ColourTo(i - 1, state); + } + //if (state == SCE_H_ASPAT) + // styler.ColourTo(i+1, SCE_H_ASPAT); + //else + styler.ColourTo(i+1, SCE_H_ASP); + i++; + state = beforeASP; + beforeASP = SCE_H_DEFAULT; + inASP = 0; + continue; + } + + if (state == SCE_H_DEFAULT) { + if (ch == '<') { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + if (chNext == '?') { + styler.ColourTo(i + 1, SCE_H_XMLSTART); + i++; + ch = chNext; + } + } else if (ch == '&') { + styler.ColourTo(i - 1, SCE_H_DEFAULT); + state = SCE_H_ENTITY; + } + } else if (state == SCE_H_COMMENT) { + if ((ch == '>') && (chPrev == '-')) { + styler.ColourTo(i, state); + state = SCE_H_DEFAULT; + } + } else if (state == SCE_H_ENTITY) { + if (ch == ';') { + styler.ColourTo(i, state); + state = SCE_H_DEFAULT; + } + } else if (state == SCE_H_TAGUNKNOWN) { + if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') { + int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler); + lastTagWasScript = eClass == SCE_H_SCRIPT; + if (lastTagWasScript) { + scriptLanguage = eScriptJS; + eClass = SCE_H_TAG; + } + if (ch == '>') { + styler.ColourTo(i, SCE_H_TAG); + if (lastTagWasScript) { + if (scriptLanguage == eScriptVBS) + state = SCE_HB_START; + else if (scriptLanguage == eScriptPython) + state = SCE_HP_START; + else + state = SCE_HJ_START; + } else { + state = SCE_H_DEFAULT; + } + } else { + if (eClass == SCE_H_COMMENT) { + state = SCE_H_COMMENT; + } else { + state = SCE_H_OTHER; + } + } + } + } else if (state == SCE_H_ATTRIBUTE) { + if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') { + if (lastTagWasScript) + scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i-1, scriptLanguage); + classifyAttribHTML(styler.GetStartSegment(), i - 1, keywords, styler); + if (ch == '>') { + styler.ColourTo(i, SCE_H_TAG); + if (lastTagWasScript) { + if (scriptLanguage == eScriptVBS) + state = SCE_HB_START; + else if (scriptLanguage == eScriptPython) + state = SCE_HP_START; + else + state = SCE_HJ_START; + } else { + state = SCE_H_DEFAULT; + } + } else { + state = SCE_H_OTHER; + } + } + } else if (state == SCE_H_ASP) { + if ((ch == '>') && (chPrev == '%')) { + styler.ColourTo(i, state); + state = SCE_H_DEFAULT; + } + } else if (state == SCE_H_ASPAT) { + if ((ch == '>') && (chPrev == '%')) { + styler.ColourTo(i, state); + state = SCE_H_DEFAULT; + } + } else if (state == SCE_H_OTHER) { + if (ch == '>') { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_H_TAG); + if (lastTagWasScript) { + if (scriptLanguage == eScriptVBS) + state = SCE_HB_START; + else if (scriptLanguage == eScriptPython) + state = SCE_HP_START; + else + state = SCE_HJ_START; + } else { + state = SCE_H_DEFAULT; + } + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_H_DOUBLESTRING; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_H_SINGLESTRING; + } else if (ch == '/' && chNext == '>') { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_TAGEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } else if (ch == '?' && chNext == '>') { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_XMLEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } else if (ishtmlwordchar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_H_ATTRIBUTE; + } + } else if (state == SCE_H_DOUBLESTRING) { + if (ch == '\"') { + if (lastTagWasScript) + scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); + styler.ColourTo(i, SCE_H_DOUBLESTRING); + state = SCE_H_OTHER; + } + } else if (state == SCE_H_SINGLESTRING) { + if (ch == '\'') { + if (lastTagWasScript) + scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); + styler.ColourTo(i, SCE_H_SINGLESTRING); + state = SCE_H_OTHER; + } + } else if (state == SCE_HJ_DEFAULT || state == SCE_HJ_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HJ_WORD; + } else if (ch == '/' && chNext == '*') { + styler.ColourTo(i - 1, state); + if (chNext2 == '*') + state = SCE_HJ_COMMENTDOC; + else + state = SCE_HJ_COMMENT; + } else if (ch == '/' && chNext == '/') { + styler.ColourTo(i - 1, state); + state = SCE_HJ_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_HJ_DOUBLESTRING; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_HJ_SINGLESTRING; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HJ_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HJ_SYMBOLS); + state = SCE_HJ_DEFAULT; + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HJ_START) { + styler.ColourTo(i - 1, state); + state = SCE_HJ_DEFAULT; + } + } + } else if (state == SCE_HJ_WORD) { + if (!iswordchar(ch)) { + classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler); + //styler.ColourTo(i - 1, eHTJSKeyword); + state = SCE_HJ_DEFAULT; + if (ch == '/' && chNext == '*') { + if (chNext2 == '*') + state = SCE_HJ_COMMENTDOC; + else + state = SCE_HJ_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_HJ_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_HJ_DOUBLESTRING; + } else if (ch == '\'') { + state = SCE_HJ_SINGLESTRING; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HJ_SYMBOLS); + state = SCE_HJ_DEFAULT; + } + } + } else if (state == SCE_HJ_COMMENT) { + if (ch == '/' && chPrev == '*') { + state = SCE_HJ_DEFAULT; + styler.ColourTo(i, SCE_HJ_COMMENT); + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_TAGEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } + } else if (state == SCE_HJ_COMMENTDOC) { + if (ch == '/' && chPrev == '*') { + state = SCE_HJ_DEFAULT; + styler.ColourTo(i, SCE_HJ_COMMENTDOC); + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_TAGEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } + } else if (state == SCE_HJ_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, SCE_HJ_COMMENTLINE); + state = SCE_HJ_DEFAULT; + } else if ((ch == '<') && (chNext == '/')) { + // Common to hide end script tag in comment + styler.ColourTo(i - 1, SCE_HJ_COMMENTLINE); + state = SCE_H_TAGUNKNOWN; + } + } else if (state == SCE_HJ_DOUBLESTRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + } + } else if (ch == '\"') { + styler.ColourTo(i, SCE_HJ_DOUBLESTRING); + state = SCE_HJ_DEFAULT; + i++; + ch = chNext; + } else if (isLineEnd(ch)) { + styler.ColourTo(i-1, state); + state = SCE_HJ_STRINGEOL; + } + } else if (state == SCE_HJ_SINGLESTRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + } + } else if (ch == '\'') { + styler.ColourTo(i, SCE_HJ_SINGLESTRING); + state = SCE_HJ_DEFAULT; + i++; + ch = chNext; + } else if (isLineEnd(ch)) { + styler.ColourTo(i-1, state); + state = SCE_HJ_STRINGEOL; + } + } else if (state == SCE_HJ_STRINGEOL) { + if (!isLineEnd(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HJ_DEFAULT; + } else if (!isLineEnd(chNext)) { + styler.ColourTo(i, state); + state = SCE_HJ_DEFAULT; + } + } else if (state == SCE_HJA_DEFAULT || state == SCE_HJA_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HJA_WORD; + } else if (ch == '/' && chNext == '*') { + styler.ColourTo(i - 1, state); + if (chNext2 == '*') + state = SCE_HJA_COMMENTDOC; + else + state = SCE_HJA_COMMENT; + } else if (ch == '/' && chNext == '/') { + styler.ColourTo(i - 1, state); + state = SCE_HJA_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_HJA_DOUBLESTRING; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_HJA_SINGLESTRING; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HJA_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HJA_SYMBOLS); + state = SCE_HJA_DEFAULT; + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HJA_START) { + styler.ColourTo(i - 1, state); + state = SCE_HJA_DEFAULT; + } + } + } else if (state == SCE_HJA_WORD) { + if (!iswordchar(ch)) { + classifyWordHTJSA(styler.GetStartSegment(), i - 1, keywords2, styler); + //styler.ColourTo(i - 1, eHTJSKeyword); + state = SCE_HJA_DEFAULT; + if (ch == '/' && chNext == '*') { + if (chNext2 == '*') + state = SCE_HJA_COMMENTDOC; + else + state = SCE_HJA_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_HJA_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_HJA_DOUBLESTRING; + } else if (ch == '\'') { + state = SCE_HJA_SINGLESTRING; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HJA_SYMBOLS); + state = SCE_HJA_DEFAULT; + } + } + } else if (state == SCE_HJA_COMMENT) { + if (ch == '/' && chPrev == '*') { + state = SCE_HJA_DEFAULT; + styler.ColourTo(i, SCE_HJA_COMMENT); + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_TAGEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } + } else if (state == SCE_HJA_COMMENTDOC) { + if (ch == '/' && chPrev == '*') { + state = SCE_HJA_DEFAULT; + styler.ColourTo(i, SCE_HJA_COMMENTDOC); + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i + 1, SCE_H_TAGEND); + i++; + ch = chNext; + state = SCE_H_DEFAULT; + } + } else if (state == SCE_HJA_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, SCE_HJA_COMMENTLINE); + state = SCE_HJA_DEFAULT; + } else if ((ch == '<') && (chNext == '/')) { + // Common to hide end script tag in comment + styler.ColourTo(i - 1, SCE_HJA_COMMENTLINE); + state = SCE_H_TAGUNKNOWN; + } + } else if (state == SCE_HJA_DOUBLESTRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + } + } else if (ch == '\"') { + styler.ColourTo(i, SCE_HJA_DOUBLESTRING); + state = SCE_HJA_DEFAULT; + i++; + ch = chNext; + } else if (isLineEnd(ch)) { + styler.ColourTo(i-1, state); + state = SCE_HJA_STRINGEOL; + } + } else if (state == SCE_HJA_SINGLESTRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + } + } else if (ch == '\'') { + styler.ColourTo(i, SCE_HJA_SINGLESTRING); + state = SCE_HJA_DEFAULT; + i++; + ch = chNext; + } else if (isLineEnd(ch)) { + styler.ColourTo(i-1, state); + state = SCE_HJA_STRINGEOL; + } + } else if (state == SCE_HJA_STRINGEOL) { + if (!isLineEnd(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HJA_DEFAULT; + } else if (!isLineEnd(chNext)) { + styler.ColourTo(i, state); + state = SCE_HJA_DEFAULT; + } + } else if (state == SCE_HB_DEFAULT || state == SCE_HB_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HB_WORD; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_HB_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_HB_STRING; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HB_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HB_DEFAULT); + state = SCE_HB_DEFAULT; + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HB_START) { + styler.ColourTo(i - 1, state); + state = SCE_HB_DEFAULT; + } + } + } else if (state == SCE_HB_WORD) { + if (!iswordchar(ch)) { + state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler); + if (state == SCE_HB_DEFAULT) { + if (ch == '\"') { + state = SCE_HB_STRING; + } else if (ch == '\'') { + state = SCE_HB_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HB_DEFAULT); + state = SCE_HB_DEFAULT; + } + } + } + } else if (state == SCE_HB_STRING) { + if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_HB_DEFAULT; + i++; + ch = chNext; + } else if (ch == '\r' || ch == '\n') { + styler.ColourTo(i-1, state); + state = SCE_HB_STRINGEOL; + } + } else if (state == SCE_HB_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_HB_DEFAULT; + } else if ((ch == '<') && (chNext == '/')) { + // Common to hide end script tag in comment + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } + } else if (state == SCE_HB_STRINGEOL) { + if (!isLineEnd(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HB_DEFAULT; + } else if (!isLineEnd(chNext)) { + styler.ColourTo(i, state); + state = SCE_HB_DEFAULT; + } + } else if (state == SCE_HBA_DEFAULT || state == SCE_HBA_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HBA_WORD; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_HBA_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_HBA_STRING; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HBA_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HBA_DEFAULT); + state = SCE_HBA_DEFAULT; + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HBA_START) { + styler.ColourTo(i - 1, state); + state = SCE_HBA_DEFAULT; + } + } + } else if (state == SCE_HBA_WORD) { + if (!iswordchar(ch)) { + state = classifyWordHTVBA(styler.GetStartSegment(), i - 1, keywords3, styler); + if (state == SCE_HBA_DEFAULT) { + if (ch == '\"') { + state = SCE_HBA_STRING; + } else if (ch == '\'') { + state = SCE_HBA_COMMENTLINE; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HBA_DEFAULT); + state = SCE_HBA_DEFAULT; + } + } + } + } else if (state == SCE_HBA_STRING) { + if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_HBA_DEFAULT; + i++; + ch = chNext; + } else if (ch == '\r' || ch == '\n') { + styler.ColourTo(i-1, state); + state = SCE_HBA_STRINGEOL; + } + } else if (state == SCE_HBA_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_HBA_DEFAULT; + } else if ((ch == '<') && (chNext == '/')) { + // Common to hide end script tag in comment + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } + } else if (state == SCE_HBA_STRINGEOL) { + if (!isLineEnd(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HBA_DEFAULT; + } else if (!isLineEnd(chNext)) { + styler.ColourTo(i, state); + state = SCE_HBA_DEFAULT; + } + } else if (state == SCE_HP_DEFAULT || state == SCE_HP_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HP_WORD; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HP_COMMENTLINE; + } else if (ch == '#') { + styler.ColourTo(i - 1, state); + state = SCE_HP_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_HP_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HP_STRING; + } + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_HP_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HP_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HP_OPERATOR); + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HP_START) { + styler.ColourTo(i - 1, state); + state = SCE_HP_DEFAULT; + } + } + } else if (state == SCE_HP_WORD) { + if (!iswordchar(ch)) { + classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord); + state = SCE_HP_DEFAULT; + if (ch == '#') { + state = SCE_HP_COMMENTLINE; + } else if (ch == '\"') { + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_HP_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HP_STRING; + } + } else if (ch == '\'') { + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_HP_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HP_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HP_OPERATOR); + } + } + } else if (state == SCE_HP_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_HP_DEFAULT; + } + } else if (state == SCE_HP_STRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_HP_DEFAULT; + } + } else if (state == SCE_HP_CHARACTER) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\'') { + styler.ColourTo(i, state); + state = SCE_HP_DEFAULT; + } + } else if (state == SCE_HP_TRIPLE) { + if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { + styler.ColourTo(i, state); + state = SCE_HP_DEFAULT; + } + } else if (state == SCE_HP_TRIPLEDOUBLE) { + if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { + styler.ColourTo(i, state); + state = SCE_HP_DEFAULT; + } + } else if (state == SCE_HPA_DEFAULT || state == SCE_HPA_START) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_HPA_WORD; + } else if ((ch == '<') && (chNext == '/')) { + styler.ColourTo(i - 1, state); + state = SCE_H_TAGUNKNOWN; + } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && + styler.SafeGetCharAt(i + 3) == '-') { + styler.ColourTo(i - 1, state); + state = SCE_HPA_COMMENTLINE; + } else if (ch == '#') { + styler.ColourTo(i - 1, state); + state = SCE_HPA_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_HPA_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HPA_STRING; + } + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_HPA_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HPA_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_HPA_OPERATOR); + } else if ((ch == ' ') || (ch == '\t')) { + if (state == SCE_HPA_START) { + styler.ColourTo(i - 1, state); + state = SCE_HPA_DEFAULT; + } + } + } else if (state == SCE_HPA_WORD) { + if (!iswordchar(ch)) { + classifyWordHTPyA(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord); + state = SCE_HPA_DEFAULT; + if (ch == '#') { + state = SCE_HPA_COMMENTLINE; + } else if (ch == '\"') { + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_HPA_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HPA_STRING; + } + } else if (ch == '\'') { + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_HPA_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_HPA_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HPA_OPERATOR); + } + } + } else if (state == SCE_HPA_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_HPA_DEFAULT; + } + } else if (state == SCE_HPA_STRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_HPA_DEFAULT; + } + } else if (state == SCE_HPA_CHARACTER) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\'') { + styler.ColourTo(i, state); + state = SCE_HPA_DEFAULT; + } + } else if (state == SCE_HPA_TRIPLE) { + if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { + styler.ColourTo(i, state); + state = SCE_HPA_DEFAULT; + } + } else if (state == SCE_HPA_TRIPLEDOUBLE) { + if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { + styler.ColourTo(i, state); + state = SCE_HPA_DEFAULT; + } + } + if (state == SCE_HB_DEFAULT) { // One of the above succeeded + if (ch == '\"') { + state = SCE_HB_STRING; + } else if (ch == '\'') { + state = SCE_HB_COMMENTLINE; + } else if (iswordstart(ch)) { + state = SCE_HB_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HB_DEFAULT); + } + } + if (state == SCE_HBA_DEFAULT) { // One of the above succeeded + if (ch == '\"') { + state = SCE_HBA_STRING; + } else if (ch == '\'') { + state = SCE_HBA_COMMENTLINE; + } else if (iswordstart(ch)) { + state = SCE_HBA_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HBA_DEFAULT); + } + } + if (state == SCE_HJ_DEFAULT) { // One of the above succeeded + if (ch == '/' && chNext == '*') { + if (styler.SafeGetCharAt(i + 2) == '*') + state = SCE_HJ_COMMENTDOC; + else + state = SCE_HJ_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_HJ_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_HJ_DOUBLESTRING; + } else if (ch == '\'') { + state = SCE_HJ_SINGLESTRING; + } else if (iswordstart(ch)) { + state = SCE_HJ_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HJ_SYMBOLS); + } + } + if (state == SCE_HJA_DEFAULT) { // One of the above succeeded + if (ch == '/' && chNext == '*') { + if (styler.SafeGetCharAt(i + 2) == '*') + state = SCE_HJA_COMMENTDOC; + else + state = SCE_HJA_COMMENT; + } else if (ch == '/' && chNext == '/') { + state = SCE_HJA_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_HJA_DOUBLESTRING; + } else if (ch == '\'') { + state = SCE_HJA_SINGLESTRING; + } else if (iswordstart(ch)) { + state = SCE_HJA_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_HJA_SYMBOLS); + } + } + chPrev2 = chPrev; + chPrev = ch; + } + styler.ColourTo(lengthDoc - 1, state); +} + +LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc); +LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc); diff --git a/src/stc/scintilla/src/LexOthers.cxx b/src/stc/scintilla/src/LexOthers.cxx new file mode 100644 index 0000000000..90f41e3bf3 --- /dev/null +++ b/src/stc/scintilla/src/LexOthers.cxx @@ -0,0 +1,304 @@ +// SciTE - Scintilla based Text Editor +// LexOthers.cxx - lexers for properties files, batch files, make files and error lists +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static void ColouriseBatchLine(char *lineBuffer, int endLine, Accessor &styler) { + if (0 == strncmp(lineBuffer, "REM", 3)) { + styler.ColourTo(endLine, 1); + } else if (0 == strncmp(lineBuffer, "rem", 3)) { + styler.ColourTo(endLine, 1); + } else if (0 == strncmp(lineBuffer, "SET", 3)) { + styler.ColourTo(endLine, 2); + } else if (0 == strncmp(lineBuffer, "set", 3)) { + styler.ColourTo(endLine, 2); + } else if (lineBuffer[0] == ':') { + styler.ColourTo(endLine, 3); + } else { + styler.ColourTo(endLine, 0); + } +} + +static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + unsigned int linePos = 0; + for (unsigned int i = startPos; i < startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { + ColouriseBatchLine(lineBuffer, i, styler); + linePos = 0; + } + } + if (linePos > 0) + ColouriseBatchLine(lineBuffer, startPos + length, styler); +} + +static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, Accessor &styler) { + int i = 0; + while (isspace(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces + i++; + if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') { + styler.ColourTo(endPos, 1); + } else if (lineBuffer[i] == '[') { + styler.ColourTo(endPos, 2); + } else if (lineBuffer[i] == '@') { + styler.ColourTo(startLine+i, 4); + if (lineBuffer[++i] == '=') + styler.ColourTo(startLine+i, 3); + styler.ColourTo(endPos, 0); + } else { + while (lineBuffer[i] != '=' && (i < lengthLine)) // Search the '=' character + i++; + if (lineBuffer[i] == '=') { + styler.ColourTo(startLine+i-1, 0); + styler.ColourTo(startLine+i, 3); + styler.ColourTo(endPos, 0); + } else { + styler.ColourTo(endPos, 0); + } + } +} + +static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + unsigned int linePos = 0; + int startLine = startPos; + for (unsigned int i = startPos; i <= startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if ((styler[i] == '\r' && styler.SafeGetCharAt(i+1) != '\n') || + styler[i] == '\n' || + (linePos >= sizeof(lineBuffer) - 1)) { + lineBuffer[linePos] = '\0'; + ColourisePropsLine(lineBuffer, linePos, startLine, i, styler); + linePos = 0; + startLine = i+1; + } + } + if (linePos > 0) + ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length, styler); +} + +static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) { + int i = 0; + while (isspace(lineBuffer[i]) && (i < lengthLine)) + i++; + if (lineBuffer[i] == '#' || lineBuffer[i] == '!') { + styler.ColourTo(endPos, 1); + } else { + styler.ColourTo(endPos, 0); + } +} + +static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + unsigned int linePos = 0; + for (unsigned int i = startPos; i <= startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { + ColouriseMakeLine(lineBuffer, linePos, i, styler); + linePos = 0; + } + } + if (linePos > 0) + ColouriseMakeLine(lineBuffer, linePos, startPos + length, styler); +} + +static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) { + if (lineBuffer[0] == '>') { + // Command or return status + styler.ColourTo(endPos, 4); + } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) { + styler.ColourTo(endPos, 1); + } else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) { + // Borland error message + styler.ColourTo(endPos, 5); + } else if (0 == strncmp(lineBuffer, "Warning ", strlen("Warning "))) { + // Borland warning message + styler.ColourTo(endPos, 5); + } else { + // Look for <filename>:<line>:message + // Look for <filename>(line)message + // Look for <filename>(line,pos)message + int state = 0; + for (int i = 0; i < lengthLine; i++) { + if (state == 0 && lineBuffer[i] == ':' && isdigit(lineBuffer[i + 1])) { + state = 1; + } else if (state == 0 && lineBuffer[i] == '(') { + state = 10; + } else if (state == 1 && isdigit(lineBuffer[i])) { + state = 2; + } else if (state == 2 && lineBuffer[i] == ':') { + state = 3; + break; + } else if (state == 2 && !isdigit(lineBuffer[i])) { + state = 99; + } else if (state == 10 && isdigit(lineBuffer[i])) { + state = 11; + } else if (state == 11 && lineBuffer[i] == ',') { + state = 14; + } else if (state == 11 && lineBuffer[i] == ')') { + state = 12; + } else if (state == 12 && lineBuffer[i] == ':') { + state = 13; + } else if (state == 14 && lineBuffer[i] == ')') { + state = 15; + break; + } else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) { + state = 99; + } + } + if (state == 3) { + styler.ColourTo(endPos, 2); + } else if ((state == 13) || (state == 14) || (state == 15)) { + styler.ColourTo(endPos, 3); + } else { + styler.ColourTo(endPos, 0); + } + } +} + +static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + unsigned int linePos = 0; + for (unsigned int i = startPos; i <= startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { + ColouriseErrorListLine(lineBuffer, linePos, i, styler); + linePos = 0; + } + } + if (linePos > 0) + ColouriseErrorListLine(lineBuffer, linePos, startPos + length, styler); +} + +static int isSpecial(char s) { + + return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') || + (s == '\"') || (s == '`') || (s == '^') || (s == '~'); +} + +static int isTag(int start, Accessor &styler) { + + char s[6]; + unsigned int i = 0, e=1; + while (i < 5 && e) { + s[i] = styler[start + i]; + i++; + e = styler[start + i] != '{'; + } + s[i] = '\0'; + return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0); +} + +static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle, + WordList *[], Accessor &styler) { + + styler.StartAt(startPos); + + int state = initStyle; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + int lengthDoc = startPos + length; + + for (int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + i++; + continue; + } + switch(state) { + case SCE_L_DEFAULT : + switch(ch) { + case '\\' : + styler.ColourTo(i - 1, state); + if (isSpecial(styler[i + 1])) { + styler.ColourTo(i + 1, SCE_L_COMMAND); + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + else { + if (isTag(i+1, styler)) + state = SCE_L_TAG; + else + state = SCE_L_COMMAND; + } + break; + case '$' : + styler.ColourTo(i - 1, state); + state = SCE_L_MATH; + if (chNext == '$') { + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case '%' : + styler.ColourTo(i - 1, state); + state = SCE_L_COMMENT; + break; + } + break; + case SCE_L_COMMAND : + if (chNext == '[' || chNext == '{' || chNext == '}' || + chNext == ' ' || chNext == '\r' || chNext == '\n') { + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case SCE_L_TAG : + if (ch == '}') { + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + } + break; + case SCE_L_MATH : + if (ch == '$') { + if (chNext == '$') { + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + styler.ColourTo(i, state); + state = SCE_L_DEFAULT; + } + break; + case SCE_L_COMMENT : + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_L_DEFAULT; + } + } + } + styler.ColourTo(lengthDoc, state); +} + +LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc); +LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc); +LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc); +LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc); +LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc); diff --git a/src/stc/scintilla/src/LexPerl.cxx b/src/stc/scintilla/src/LexPerl.cxx new file mode 100644 index 0000000000..3c9972e2d6 --- /dev/null +++ b/src/stc/scintilla/src/LexPerl.cxx @@ -0,0 +1,480 @@ +// SciTE - Scintilla based Text Editor +// LexPerl.cxx - lexer for subset of Perl +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +inline bool isPerlOperator(char ch) { + if (isalnum(ch)) + return false; + // '.' left out as it is used to make up numbers + if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '\\' || + ch == '(' || ch == ')' || ch == '-' || ch == '+' || + ch == '=' || ch == '|' || ch == '{' || ch == '}' || + ch == '[' || ch == ']' || ch == ':' || ch == ';' || + ch == '<' || ch == '>' || ch == ',' || ch == '/' || + ch == '?' || ch == '!' || ch == '.' || ch == '~') + return true; + return false; +} + +static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_PL_IDENTIFIER; + if (wordIsNumber) + chAttr = SCE_PL_NUMBER; + else { + if (keywords.InList(s)) + chAttr = SCE_PL_WORD; + } + styler.ColourTo(end, chAttr); + return chAttr; +} + +static bool isEndVar(char ch) { + return !isalnum(ch) && ch != '#' && ch != '$' && + ch != '_' && ch != '\''; +} + +static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) { + if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) { + return false; + } + while (*val) { + if (*val != styler[pos++]) { + return false; + } + val++; + } + return true; +} + +static char opposite(char ch) { + if (ch == '(') + return ')'; + if (ch == '[') + return ']'; + if (ch == '{') + return '}'; + if (ch == '<') + return '>'; + return ch; +} + +static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + // Lexer for perl often has to backtrack to start of current style to determine + // which characters are being used as quotes, how deeply nested is the + // start position and what the termination string is for here documents + + WordList &keywords = *keywordlists[0]; + + char sooked[100]; + int quotes = 0; + char quoteDown = 'd'; + char quoteUp = 'd'; + int quoteRep = 1; + int sookedpos = 0; + bool preferRE = true; + sooked[sookedpos] = '\0'; + int state = initStyle; + int lengthDoc = startPos + length; + // If in a long distance lexical state, seek to the beginning to find quote characters + if (state == SCE_PL_HERE || state == SCE_PL_REGEX || + state == SCE_PL_REGSUBST || state == SCE_PL_LONGQUOTE) { + while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) { + startPos--; + } + state = SCE_PL_DEFAULT; + } + styler.StartAt(startPos); + char chPrev = ' '; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + for (int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + char chNext2 = styler.SafeGetCharAt(i + 2); + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + i += 1; + continue; + } + + if (state == SCE_PL_DEFAULT) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + if (ch == 's' && !isalnum(chNext)) { + state = SCE_PL_REGSUBST; + quotes = 0; + quoteUp = '\0'; + quoteDown = '\0'; + quoteRep = 2; + } else if (ch == 'm' && !isalnum(chNext)) { + state = SCE_PL_REGEX; + quotes = 0; + quoteUp = '\0'; + quoteDown = '\0'; + quoteRep = 1; + } else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) { + state = SCE_PL_REGSUBST; + quotes = 0; + quoteUp = '\0'; + quoteDown = '\0'; + quoteRep = 2; + i++; + chNext = chNext2; + } else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) { + state = SCE_PL_LONGQUOTE; + i++; + chNext = chNext2; + quotes = 0; + quoteUp = '\0'; + quoteDown = '\0'; + quoteRep = 1; + } else { + state = SCE_PL_WORD; + preferRE = false; + } + } else if (ch == '#') { + styler.ColourTo(i - 1, state); + state = SCE_PL_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_PL_STRING; + } else if (ch == '\'') { + if (chPrev == '&') { + // Archaic call + styler.ColourTo(i, state); + } else { + styler.ColourTo(i - 1, state); + state = SCE_PL_CHARACTER; + } + } else if (ch == '`') { + styler.ColourTo(i - 1, state); + state = SCE_PL_BACKTICKS; + } else if (ch == '$') { + preferRE = false; + styler.ColourTo(i - 1, state); + if (isalnum(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { + state = SCE_PL_SCALAR; + } else if (chNext != '{' && chNext != '[') { + styler.ColourTo(i, SCE_PL_SCALAR); + i++; + ch = ' '; + chNext = ' '; + } else { + styler.ColourTo(i, SCE_PL_SCALAR); + } + } else if (ch == '@') { + preferRE = false; + styler.ColourTo(i - 1, state); + if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { + state = SCE_PL_ARRAY; + } else if (chNext != '{' && chNext != '[') { + styler.ColourTo(i, SCE_PL_ARRAY); + i++; + ch = ' '; + } else { + styler.ColourTo(i, SCE_PL_ARRAY); + } + } else if (ch == '%') { + preferRE = false; + styler.ColourTo(i - 1, state); + if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') { + state = SCE_PL_HASH; + } else if (chNext != '{' && chNext != '[') { + styler.ColourTo(i, SCE_PL_HASH); + i++; + ch = ' '; + } else { + styler.ColourTo(i, SCE_PL_HASH); + } + } else if (ch == '*') { + styler.ColourTo(i - 1, state); + state = SCE_PL_SYMBOLTABLE; + } else if (ch == '/' && preferRE) { + styler.ColourTo(i - 1, state); + state = SCE_PL_REGEX; + quoteUp = '/'; + quoteDown = '/'; + quotes = 1; + quoteRep = 1; + } else if (ch == '<' && chNext == '<') { + styler.ColourTo(i - 1, state); + state = SCE_PL_HERE; + i++; + ch = chNext; + chNext = chNext2; + quotes = 0; + sookedpos = 0; + sooked[sookedpos] = '\0'; + } else if (ch == '=' && isalpha(chNext)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_POD; + quotes = 0; + sookedpos = 0; + sooked[sookedpos] = '\0'; + } else if (isPerlOperator(ch)) { + if (ch == ')' || ch == ']') + preferRE = false; + else + preferRE = true; + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_PL_OPERATOR); + } + } else if (state == SCE_PL_WORD) { + if (!iswordchar(ch) && ch != '\'') { // Archaic Perl has quotes inside names + if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")) { + styler.ColourTo(i, SCE_PL_DATASECTION); + state = SCE_PL_DATASECTION; + } else if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__END__")) { + styler.ColourTo(i, SCE_PL_DATASECTION); + state = SCE_PL_DATASECTION; + } else { + if (classifyWordPerl(styler.GetStartSegment(), i - 1, keywords, styler) == SCE_PL_WORD) + preferRE = true; + state = SCE_PL_DEFAULT; + if (ch == '#') { + state = SCE_PL_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_PL_STRING; + } else if (ch == '\'') { + state = SCE_PL_CHARACTER; + } else if (ch == '<' && chNext == '<') { + state = SCE_PL_HERE; + quotes = 0; + sookedpos = 0; + sooked[sookedpos] = '\0'; + } else if (isPerlOperator(ch)) { + if (ch == ')' || ch == ']') + preferRE = false; + else + preferRE = true; + styler.ColourTo(i, SCE_PL_OPERATOR); + state = SCE_PL_DEFAULT; + } + } + } + } else { + if (state == SCE_PL_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_HERE) { + if (isalnum(ch) && quotes < 2) { + sooked[sookedpos++] = ch; + sooked[sookedpos] = '\0'; + if (quotes == 0) + quotes = 1; + } else { + quotes++; + } + if (quotes > 1 && isMatch(styler, lengthDoc, i, sooked) && (chPrev == '\n' || chPrev == '\r') ) { + styler.ColourTo(i + sookedpos - 1, SCE_PL_HERE); + i += sookedpos; + chNext = styler.SafeGetCharAt(i); + if (chNext == '\n' || chNext == '\r') { + state = SCE_PL_DEFAULT; + } + chNext = ' '; + } + } else if (state == SCE_PL_STRING) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (state == SCE_PL_CHARACTER) { + if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\'') { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (state == SCE_PL_BACKTICKS) { + if (ch == '`') { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (state == SCE_PL_POD) { + if (ch == '=') { + if (isMatch(styler, lengthDoc, i, "=cut")) { + styler.ColourTo(i - 1 + 4, state); + i += 4; + state = SCE_PL_DEFAULT; + chNext = ' '; + ch = ' '; + } + } + } else if (state == SCE_PL_SCALAR) { + if (isEndVar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_ARRAY) { + if (isEndVar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_HASH) { + if (isEndVar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_SYMBOLTABLE) { + if (isEndVar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_REF) { + if (isEndVar(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_PL_DEFAULT; + } + } else if (state == SCE_PL_REGEX) { + if (!quoteUp && !isspace(ch)) { + quoteUp = ch; + quoteDown = opposite(ch); + quotes++; + } else { + if (ch == quoteDown && chPrev != '\\') { + quotes--; + if (quotes == 0) { + quoteRep--; + if (quoteUp == quoteDown) { + quotes++; + } + } + if (!isalpha(chNext)) { + if (quoteRep <= 0) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } + } + } else if (ch == quoteUp && chPrev != '\\') { + quotes++; + } else if (!isalpha(chNext)) { + if (quoteRep <= 0) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } + } + } + } else if (state == SCE_PL_REGSUBST) { + if (!quoteUp && !isspace(ch)) { + quoteUp = ch; + quoteDown = opposite(ch); + quotes++; + } else { + if (ch == quoteDown && chPrev != '\\') { + quotes--; + if (quotes == 0) { + quoteRep--; + } + if (!isalpha(chNext)) { + if (quoteRep <= 0) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } + } + if (quoteUp == quoteDown) { + quotes++; + } + } else if (ch == quoteUp && chPrev != '\\') { + quotes++; + } else if (!isalpha(chNext)) { + if (quoteRep <= 0) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } + } + } + } else if (state == SCE_PL_LONGQUOTE) { + if (!quoteDown && !isspace(ch)) { + quoteUp = ch; + quoteDown = opposite(quoteUp); + quotes++; + } else if (ch == quoteDown) { + quotes--; + if (quotes == 0) { + quoteRep--; + if (quoteRep <= 0) { + styler.ColourTo(i, state); + state = SCE_PL_DEFAULT; + ch = ' '; + } + if (quoteUp == quoteDown) { + quotes++; + } + } + } else if (ch == quoteUp) { + quotes++; + } + } + + if (state == SCE_PL_DEFAULT) { // One of the above succeeded + if (ch == '#') { + state = SCE_PL_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_PL_STRING; + } else if (ch == '\'') { + state = SCE_PL_CHARACTER; + } else if (iswordstart(ch)) { + state = SCE_PL_WORD; + preferRE = false; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_PL_OPERATOR); + } + } + } + chPrev = ch; + } + styler.ColourTo(lengthDoc, state); +} + +LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc); diff --git a/src/stc/scintilla/src/LexPython.cxx b/src/stc/scintilla/src/LexPython.cxx new file mode 100644 index 0000000000..df8b7085bf --- /dev/null +++ b/src/stc/scintilla/src/LexPython.cxx @@ -0,0 +1,274 @@ +// SciTE - Scintilla based Text Editor +// LexPython.cxx - lexer for Python +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + s[i + 1] = '\0'; + } + char chAttr = SCE_P_IDENTIFIER; + if (0 == strcmp(prevWord, "class")) + chAttr = SCE_P_CLASSNAME; + else if (0 == strcmp(prevWord, "def")) + chAttr = SCE_P_DEFNAME; + else if (wordIsNumber) + chAttr = SCE_P_NUMBER; + else if (keywords.InList(s)) + chAttr = SCE_P_WORD; + styler.ColourTo(end, chAttr); + strcpy(prevWord, s); +} + +static bool IsPyComment(Accessor &styler, int pos, int len) { + return len>0 && styler[pos]=='#'; +} + +static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + int lengthDoc = startPos + length; + + // Backtrack to previous line in case need to fix its fold status or tab whinging + int lineCurrent = styler.GetLine(startPos); + if (startPos > 0) { + if (lineCurrent > 0) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); + if (startPos == 0) + initStyle = SCE_P_DEFAULT; + else + initStyle = styler.StyleAt(startPos-1); + } + } + + // Python uses a different mask because bad indentation is marked by oring with 32 + styler.StartAt(startPos, 127); + + WordList &keywords = *keywordlists[0]; + + bool fold = styler.GetPropertyInt("fold"); + int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level"); + char prevWord[200]; + prevWord[0] = '\0'; + if (length == 0) + return ; + int spaceFlags = 0; + + int state = initStyle & 31; + + int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); + if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) + indentCurrent |= SC_FOLDLEVELWHITEFLAG; + + char chPrev = ' '; + char chPrev2 = ' '; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + bool atStartLine = true; + for (int i = startPos; i < lengthDoc; i++) { + + if (atStartLine) { + char chBad = static_cast<char>(64); + char chGood = static_cast<char>(0); + char chFlags = chGood; + if (whingeLevel == 1) { + chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood; + } else if (whingeLevel == 2) { + chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood; + } else if (whingeLevel == 3) { + chFlags = (spaceFlags & wsSpace) ? chBad : chGood; + } else if (whingeLevel == 4) { + chFlags = (spaceFlags & wsTab) ? chBad : chGood; + } + styler.SetFlags(chFlags, static_cast<char>(state)); + atStartLine = false; + } + + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + char chNext2 = styler.SafeGetCharAt(i + 2); + + if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) { + if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) { + // Perform colourisation of white space and triple quoted strings at end of each line to allow + // tab marking to work inside white space and triple quoted strings + styler.ColourTo(i, state); + } + + int lev = indentCurrent; + int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsPyComment); + if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) + indentNext |= SC_FOLDLEVELWHITEFLAG; + if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { + // Only non whitespace lines can be headers + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { + // Line after is blank so check the next - maybe should continue further? + int spaceFlags2 = 0; + int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsPyComment); + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + } + } + indentCurrent = indentNext; + if (fold) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + atStartLine = true; + } + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + chPrev2 = ' '; + i += 1; + continue; + } + + if (state == SCE_P_STRINGEOL) { + if (ch != '\r' && ch != '\n') { + styler.ColourTo(i - 1, state); + state = SCE_P_DEFAULT; + } + } + if (state == SCE_P_DEFAULT) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_P_WORD; + } else if (ch == '#') { + styler.ColourTo(i - 1, state); + state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_P_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_P_STRING; + } + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_P_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_P_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_P_OPERATOR); + } + } else if (state == SCE_P_WORD) { + if (!iswordchar(ch)) { + ClassifyWordPy(styler.GetStartSegment(), i - 1, keywords, styler, prevWord); + state = SCE_P_DEFAULT; + if (ch == '#') { + state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE; + } else if (ch == '\"') { + if (chNext == '\"' && chNext2 == '\"') { + i += 2; + state = SCE_P_TRIPLEDOUBLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_P_STRING; + } + } else if (ch == '\'') { + if (chNext == '\'' && chNext2 == '\'') { + i += 2; + state = SCE_P_TRIPLE; + ch = ' '; + chPrev = ' '; + chNext = styler.SafeGetCharAt(i + 1); + } else { + state = SCE_P_CHARACTER; + } + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_P_OPERATOR); + } + } + } else { + if (state == SCE_P_COMMENTLINE || state == SCE_P_COMMENTBLOCK) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_P_DEFAULT; + } + } else if (state == SCE_P_STRING) { + if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { + styler.ColourTo(i - 1, state); + state = SCE_P_STRINGEOL; + } else if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_P_DEFAULT; + } + } else if (state == SCE_P_CHARACTER) { + if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { + styler.ColourTo(i - 1, state); + state = SCE_P_STRINGEOL; + } else if (ch == '\\') { + if (chNext == '\"' || chNext == '\'' || chNext == '\\') { + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } else if (ch == '\'') { + styler.ColourTo(i, state); + state = SCE_P_DEFAULT; + } + } else if (state == SCE_P_TRIPLE) { + if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { + styler.ColourTo(i, state); + state = SCE_P_DEFAULT; + } + } else if (state == SCE_P_TRIPLEDOUBLE) { + if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { + styler.ColourTo(i, state); + state = SCE_P_DEFAULT; + } + } + } + chPrev2 = chPrev; + chPrev = ch; + } + if (state == SCE_P_WORD) { + ClassifyWordPy(styler.GetStartSegment(), lengthDoc, keywords, styler, prevWord); + } else { + styler.ColourTo(lengthDoc, state); + } +} + +LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc); diff --git a/src/stc/scintilla/src/LexSQL.cxx b/src/stc/scintilla/src/LexSQL.cxx new file mode 100644 index 0000000000..facd0e6b7b --- /dev/null +++ b/src/stc/scintilla/src/LexSQL.cxx @@ -0,0 +1,156 @@ +// SciTE - Scintilla based Text Editor +// LexSQL.cxx - lexer for SQL +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(toupper(styler[start + i])); + s[i + 1] = '\0'; + } + char chAttr = SCE_C_IDENTIFIER; + if (wordIsNumber) + chAttr = SCE_C_NUMBER; + else { + if (keywords.InList(s)) + chAttr = SCE_C_WORD; + } + styler.ColourTo(end, chAttr); +} + +static void ColouriseSQLDoc(unsigned int startPos, int length, + int initStyle, WordList *keywordlists[], Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + + styler.StartAt(startPos); + + bool fold = styler.GetPropertyInt("fold"); + int lineCurrent = styler.GetLine(startPos); + int spaceFlags = 0; + + int state = initStyle; + char chPrev = ' '; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + unsigned int lengthDoc = startPos + length; + for (unsigned int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { + int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags); + int lev = indentCurrent; + if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { + // Only non whitespace lines can be headers + int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags); + if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + } + if (fold) { + styler.SetLevel(lineCurrent, lev); + } + } + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + i += 1; + continue; + } + + if (state == SCE_C_DEFAULT) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_C_WORD; + } else if (ch == '/' && chNext == '*') { + styler.ColourTo(i - 1, state); + state = SCE_C_COMMENT; + } else if (ch == '-' && chNext == '-') { + styler.ColourTo(i - 1, state); + state = SCE_C_COMMENTLINE; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_C_STRING; + } else if (isoperator(ch)) { + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_C_OPERATOR); + } + } else if (state == SCE_C_WORD) { + if (!iswordchar(ch)) { + classifyWordSQL(styler.GetStartSegment(), i - 1, keywords, styler); + state = SCE_C_DEFAULT; + if (ch == '/' && chNext == '*') { + state = SCE_C_COMMENT; + } else if (ch == '-' && chNext == '-') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\'') { + state = SCE_C_STRING; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_C_OPERATOR); + } + } + } else { + if (state == SCE_C_COMMENT) { + if (ch == '/' && chPrev == '*') { + if (((i > (styler.GetStartSegment() + 2)) || ((initStyle == SCE_C_COMMENT) && + (styler.GetStartSegment() == startPos)))) { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + } + } + } else if (state == SCE_C_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_STRING) { + if (ch == '\'') { + if ( chNext == '\'' ) { + i++; + } else { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + i++; + } + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } + if (state == SCE_C_DEFAULT) { // One of the above succeeded + if (ch == '/' && chNext == '*') { + state = SCE_C_COMMENT; + } else if (ch == '-' && chNext == '-') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\'') { + state = SCE_C_STRING; + } else if (iswordstart(ch)) { + state = SCE_C_WORD; + } else if (isoperator(ch)) { + styler.ColourTo(i, SCE_C_OPERATOR); + } + } + } + chPrev = ch; + } + styler.ColourTo(lengthDoc - 1, state); +} + +LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc); diff --git a/src/stc/scintilla/src/LexVB.cxx b/src/stc/scintilla/src/LexVB.cxx new file mode 100644 index 0000000000..acc3b0d548 --- /dev/null +++ b/src/stc/scintilla/src/LexVB.cxx @@ -0,0 +1,118 @@ +// SciTE - Scintilla based Text Editor +// LexVB.cxx - lexer for Visual Basic and VBScript +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + + char s[100]; + bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + s[i] = static_cast<char>(tolower(styler[start + i])); + s[i + 1] = '\0'; + } + char chAttr = SCE_C_DEFAULT; + if (wordIsNumber) + chAttr = SCE_C_NUMBER; + else { + if (keywords.InList(s)) { + chAttr = SCE_C_WORD; + if (strcmp(s, "rem") == 0) + chAttr = SCE_C_COMMENTLINE; + } + } + styler.ColourTo(end, chAttr); + if (chAttr == SCE_C_COMMENTLINE) + return SCE_C_COMMENTLINE; + else + return SCE_C_DEFAULT; +} + +static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + + styler.StartAt(startPos); + + int state = initStyle; + char chNext = styler[startPos]; + styler.StartSegment(startPos); + int lengthDoc = startPos + length; + for (int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + i += 1; + continue; + } + + if (state == SCE_C_DEFAULT) { + if (iswordstart(ch)) { + styler.ColourTo(i - 1, state); + state = SCE_C_WORD; + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + styler.ColourTo(i - 1, state); + state = SCE_C_STRING; + } + } else if (state == SCE_C_WORD) { + if (!iswordchar(ch)) { + state = classifyWordVB(styler.GetStartSegment(), i - 1, keywords, styler); + if (state == SCE_C_DEFAULT) { + if (ch == '\'') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_C_STRING; + } + } + } + } else { + if (state == SCE_C_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_STRING) { + // VB doubles quotes to preserve them + if (ch == '\"') { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + i++; + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + } + } + if (state == SCE_C_DEFAULT) { // One of the above succeeded + if (ch == '\'') { + state = SCE_C_COMMENTLINE; + } else if (ch == '\"') { + state = SCE_C_STRING; + } else if (iswordstart(ch)) { + state = SCE_C_WORD; + } + } + } + } + styler.ColourTo(lengthDoc, state); +} + +LexerModule lmVB(SCLEX_VB, ColouriseVBDoc); diff --git a/src/stc/scintilla/src/LineMarker.cxx b/src/stc/scintilla/src/LineMarker.cxx index 9afccb8227..f54978c3fc 100644 --- a/src/stc/scintilla/src/LineMarker.cxx +++ b/src/stc/scintilla/src/LineMarker.cxx @@ -51,20 +51,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) { } else if (markType == SC_MARK_PLUS) { int armSize = dimOn2-2; - Point xpts[] = { - Point(centreX - armSize, centreY), - Point(centreX, centreY), - Point(centreX, centreY - armSize), - Point(centreX, centreY - armSize), - Point(centreX, centreY), - Point(centreX + armSize, centreY), - Point(centreX + armSize, centreY), - Point(centreX, centreY), - Point(centreX, centreY + armSize), - Point(centreX, centreY + armSize), - Point(centreX, centreY), - Point(centreX - armSize, centreY), - }; Point pts[] = { Point(centreX - armSize, centreY - 1), Point(centreX - 1, centreY - 1), @@ -90,12 +76,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) { Point(centreX + armSize, centreY +1), Point(centreX - armSize, centreY + 1), }; - Point xpts[] = { - Point(centreX - armSize, centreY), - Point(centreX + armSize, centreY), - Point(centreX + armSize, centreY), - Point(centreX - armSize, centreY), - }; surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), fore.allocated, back.allocated); diff --git a/src/stc/scintilla/src/PropSet.cxx b/src/stc/scintilla/src/PropSet.cxx index 7e2a906a47..d3dbabaf3b 100644 --- a/src/stc/scintilla/src/PropSet.cxx +++ b/src/stc/scintilla/src/PropSet.cxx @@ -27,6 +27,7 @@ bool EqualCaseInsensitive(const char *a, const char *b) { // Get a line of input. If end of line escaped with '\\' then continue reading. static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) { bool continuation = true; + s[0] = '\0'; while ((len > 1) && lenData > 0) { char ch = *fpc; fpc++; @@ -38,7 +39,7 @@ static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) { fpc++; lenData--; } - *s++ = '\0'; + *s = '\0'; return true; } } else if ((ch == '\\') && (lenData > 0) && ((*fpc == '\r') || (*fpc == '\n'))) { @@ -46,6 +47,7 @@ static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) { } else { continuation = false; *s++ = ch; + *s = '\0'; len--; } } @@ -120,7 +122,7 @@ SString PropSet::Get(const char *key) { int PropSet::GetInt(const char *key, int defaultValue) { SString val = Get(key); if (val.length()) - return Get(key).value(); + return val.value(); else return defaultValue; } @@ -253,6 +255,9 @@ void PropSet::ReadFromMemory(const char *data, int len) { if (isalpha(linebuf[0])) Set(linebuf); } + // If there is a final line: + if (isalpha(linebuf[0])) + Set(linebuf); } } @@ -371,7 +376,7 @@ bool WordList::InList(const char *s) { for (int i = 0; words[i][0]; i++) len++; SortWordList(words, len); - for (int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++) + for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++) starts[k] = -1; for (int l = len - 1; l >= 0; l--) { unsigned char indexChar = words[l][0]; diff --git a/src/stc/scintilla/src/SVector.h b/src/stc/scintilla/src/SVector.h index 49fc376dda..550dd87ebd 100644 --- a/src/stc/scintilla/src/SVector.h +++ b/src/stc/scintilla/src/SVector.h @@ -30,7 +30,7 @@ class SVector { return; } size = newSize; - for (int i=0; i<len; i++) { + for (unsigned int i=0; i<len; i++) { newv[i] = v[i]; } delete []v; @@ -94,13 +94,13 @@ public: size = 0; len = 0; } - void SetLength(int newLen) { - if (newLen > len) { - if (newLen >= size) { - SizeTo(newLen); + void SetLength(unsigned int newLength) { + if (newLength > len) { + if (newLength >= size) { + SizeTo(newLength); } } - len = newLen; + len = newLength; } int Length() const { return len; diff --git a/src/stc/scintilla/src/ScintillaBase.cxx b/src/stc/scintilla/src/ScintillaBase.cxx index eb68904b79..87b84f7064 100644 --- a/src/stc/scintilla/src/ScintillaBase.cxx +++ b/src/stc/scintilla/src/ScintillaBase.cxx @@ -15,6 +15,8 @@ #include "SciLexer.h" #include "PropSet.h" #include "Accessor.h" +#include "WindowAccessor.h" +#include "DocumentAccessor.h" #include "KeyWords.h" #endif #include "ContractionState.h" @@ -50,11 +52,11 @@ void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) { ct.RefreshColourPalette(pal, want); } -void ScintillaBase::AddChar(char ch) { +void ScintillaBase::AddCharUTF(char *s, unsigned int len) { bool acActiveBeforeCharAdded = ac.Active(); - Editor::AddChar(ch); + Editor::AddCharUTF(s, len); if (acActiveBeforeCharAdded) - AutoCompleteChanged(ch); + AutoCompleteChanged(s[0]); } void ScintillaBase::Command(int cmdId) { @@ -276,20 +278,20 @@ void ScintillaBase::Colourise(int start, int end) { end = lengthDoc; int len = end - start; - PropSet props; - - StylingContext styler(wMain.GetID(), props); + //WindowAccessor styler(wMain.GetID(), props); + DocumentAccessor styler(pdoc, props); int styleStart = 0; if (start > 0) styleStart = styler.StyleAt(start - 1); - - ColouriseDoc(pdoc->dbcsCodePage, start, len, styleStart, lexLanguage, keyWordLists, styler); + styler.SetCodePage(pdoc->dbcsCodePage); + + LexerModule::Colourise(start, len, styleStart, lexLanguage, keyWordLists, styler); styler.Flush(); } #endif -void ScintillaBase::NotifyStyleNeeded(int endStyleNeeded) { +void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { #ifdef SCI_LEXER if (lexLanguage != SCLEX_CONTAINER) { int endStyled = Platform::SendScintilla(wMain.GetID(), SCI_GETENDSTYLED, 0, 0); @@ -299,7 +301,7 @@ void ScintillaBase::NotifyStyleNeeded(int endStyleNeeded) { return; } #endif - Editor::NotifyStyleNeeded(endStyleNeeded); + Editor::NotifyStyleToNeeded(endStyleNeeded); } LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { @@ -322,9 +324,20 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { AutoCompleteCompleted(); break; + case SCI_AUTOCSETSEPARATOR: + ac.SetSeparator(wParam); + break; + + case SCI_AUTOCGETSEPARATOR: + return ac.GetSeparator(); + case SCI_AUTOCSTOPS: ac.SetStopChars(reinterpret_cast<char *>(lParam)); break; + + case SCI_AUTOCSELECT: + ac.Select(reinterpret_cast<char *>(lParam)); + break; case SCI_CALLTIPSHOW: { AutoCompleteCancel(); @@ -377,6 +390,7 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_COLOURISE: Colourise(wParam, lParam); + Redraw(); break; case SCI_SETPROPERTY: @@ -385,7 +399,7 @@ LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { break; case SCI_SETKEYWORDS: - if ((wParam >= 0) && (wParam < numWordLists)) { + if (wParam < numWordLists) { keyWordLists[wParam]->Clear(); keyWordLists[wParam]->Set(reinterpret_cast<const char *>(lParam)); } diff --git a/src/stc/scintilla/src/ScintillaBase.h b/src/stc/scintilla/src/ScintillaBase.h index e9f8f28d03..6344b17a34 100644 --- a/src/stc/scintilla/src/ScintillaBase.h +++ b/src/stc/scintilla/src/ScintillaBase.h @@ -7,6 +7,9 @@ #define SCINTILLABASE_H class ScintillaBase : public Editor { + // Private so ScintillaBase objects can not be copied + ScintillaBase(const ScintillaBase &) : Editor() {} + ScintillaBase &operator=(const ScintillaBase &) { return *this; } protected: // Enumeration of commands and child windows enum { @@ -42,7 +45,7 @@ protected: virtual void RefreshColourPalette(Palette &pal, bool want); - virtual void AddChar(char ch); + virtual void AddCharUTF(char *s, unsigned int len); void Command(int cmdId); virtual int KeyCommand(UINT iMessage); @@ -59,7 +62,7 @@ protected: virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); - virtual void NotifyStyleNeeded(int endStyleNeeded); + virtual void NotifyStyleToNeeded(int endStyleNeeded); public: // Public so scintilla_send_message can use it virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam); diff --git a/src/stc/scintilla/src/Style.cxx b/src/stc/scintilla/src/Style.cxx index 56312314ff..7aa44c0eb9 100644 --- a/src/stc/scintilla/src/Style.cxx +++ b/src/stc/scintilla/src/Style.cxx @@ -7,49 +7,108 @@ #include "Platform.h" +#include "Scintilla.h" #include "Style.h" Style::Style() { - Clear(); + aliasOfDefaultFont = true; + Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), + Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT, + false, false, false, false); +} + +Style::Style(const Style &source) { + Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), + 0, 0, 0, + false, false, false, false); + fore.desired = source.fore.desired; + back.desired = source.back.desired; + characterSet = source.characterSet; + bold = source.bold; + italic = source.italic; + size = source.size; + eolFilled = source.eolFilled; + underline = source.underline; } Style::~Style() { - font.Release(); + if (aliasOfDefaultFont) + font.SetID(0); + else + font.Release(); + aliasOfDefaultFont = false; } Style &Style::operator=(const Style &source) { if (this == &source) return *this; - Clear(); + Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), + 0, 0, SC_CHARSET_DEFAULT, + false, false, false, false); fore.desired = source.fore.desired; back.desired = source.back.desired; + characterSet = source.characterSet; bold = source.bold; italic = source.italic; size = source.size; - strcpy(fontName, source.fontName); eolFilled = source.eolFilled; + underline = source.underline; return *this; } -void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_, - bool bold_, bool italic_, bool eolFilled_) { +void Style::Clear(Colour fore_, Colour back_, int size_, + const char *fontName_, int characterSet_, + bool bold_, bool italic_, bool eolFilled_, bool underline_) { fore.desired = fore_; back.desired = back_; + characterSet = characterSet_; bold = bold_; italic = italic_; size = size_; - strcpy(fontName, fontName_); + fontName = fontName_; eolFilled = eolFilled_; - font.Release(); + underline = underline_; + if (aliasOfDefaultFont) + font.SetID(0); + else + font.Release(); + aliasOfDefaultFont = false; } -void Style::Realise(Surface &surface, int zoomLevel) { +bool Style::EquivalentFontTo(const Style *other) const { + if (bold != other->bold || + italic != other->italic || + size != other->size || + characterSet != other->characterSet) + return false; + if (fontName == other->fontName) + return true; + if (!fontName) + return false; + if (!other->fontName) + return false; + return strcmp(fontName, other->fontName) == 0; +} + +void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) { int sizeZoomed = size + zoomLevel; if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1 sizeZoomed = 2; - - int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72; - font.Create(fontName, deviceHeight, bold, italic); + + if (aliasOfDefaultFont) + font.SetID(0); + else + font.Release(); + int deviceHeight = surface.DeviceHeightFont(sizeZoomed); + aliasOfDefaultFont = defaultStyle && + (EquivalentFontTo(defaultStyle) || !fontName); + if (aliasOfDefaultFont) { + font.SetID(defaultStyle->font.GetID()); + } else if (fontName) { + font.Create(fontName, characterSet, deviceHeight, bold, italic); + } else { + font.SetID(0); + } ascent = surface.Ascent(font); descent = surface.Descent(font); diff --git a/src/stc/scintilla/src/Style.h b/src/stc/scintilla/src/Style.h index 916b646315..dc643d08d2 100644 --- a/src/stc/scintilla/src/Style.h +++ b/src/stc/scintilla/src/Style.h @@ -10,11 +10,14 @@ class Style { public: ColourPair fore; ColourPair back; + bool aliasOfDefaultFont; bool bold; bool italic; int size; - char fontName[100]; + const char *fontName; + int characterSet; bool eolFilled; + bool underline; Font font; unsigned int lineHeight; @@ -25,13 +28,15 @@ public: unsigned int spaceWidth; Style(); + Style(const Style &source); ~Style(); Style &operator=(const Style &source); - void Clear(Colour fore_=Colour(0,0,0), Colour back_=Colour(0xff,0xff,0xff), - int size_=Platform::DefaultFontSize(), - const char *fontName_=Platform::DefaultFont(), - bool bold_=false, bool italic_=false, bool eolFilled_=false); - void Realise(Surface &surface, int zoomLevel); + void Clear(Colour fore_, Colour back_, + int size_, + const char *fontName_, int characterSet_, + bool bold_, bool italic_, bool eolFilled_, bool underline_); + bool EquivalentFontTo(const Style *other) const; + void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0); }; #endif diff --git a/src/stc/scintilla/src/UniConversion.cxx b/src/stc/scintilla/src/UniConversion.cxx new file mode 100644 index 0000000000..9306f307c2 --- /dev/null +++ b/src/stc/scintilla/src/UniConversion.cxx @@ -0,0 +1,77 @@ +// UniConversion.h - functions to handle UFT-8 and UCS-2 strings +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> + +#include "UniConversion.h" + +unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { + unsigned int len = 0; + for (unsigned int i = 0; i < tlen && uptr[i]; i++) { + unsigned int uch = uptr[i]; + if (uch < 0x80) + len++; + else if (uch < 0x800) + len+=2; + else + len +=3; + } + return len; +} + +void UTF8FromUCS2(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) { + int k = 0; + for (unsigned int i = 0; i < tlen && uptr[i]; i++) { + unsigned int uch = uptr[i]; + if (uch < 0x80) { + putf[k++] = static_cast<char>(uch); + } else if (uch < 0x800) { + putf[k++] = static_cast<char>(0xC0 | (uch >> 6)); + putf[k++] = static_cast<char>(0x80 | (uch & 0x3f)); + } else { + putf[k++] = static_cast<char>(0xE0 | (uch >> 12)); + putf[k++] = static_cast<char>(0x80 | ((uch >> 6) & 0x3f)); + putf[k++] = static_cast<char>(0x80 | (uch & 0x3f)); + } + } + putf[len] = '\0'; +} + +unsigned int UCS2Length(const char *s, unsigned int len) { + unsigned int ulen = 0; + for (unsigned int i=0;i<len;i++) { + unsigned char ch = static_cast<unsigned char>(s[i]); + if ((ch < 0x80) || (ch > (0x80 + 0x40))) + ulen++; + } + return ulen; +} + +unsigned int UCS2FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen) { +#ifdef USE_API + return ::MultiByteToWideChar(CP_UTF8, 0, s, len, tbuf, tlen); +#else + unsigned int ui=0; + const unsigned char *us = reinterpret_cast<const unsigned char *>(s); + unsigned int i=0; + while ((i<len) && (ui<tlen)) { + unsigned char ch = us[i++]; + if (ch < 0x80) { + tbuf[ui] = ch; + } else if (ch < 0x80 + 0x40 + 0x20) { + tbuf[ui] = static_cast<wchar_t>((ch & 0x1F) << 6); + ch = us[i++]; + tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + (ch & 0x7F)); + } else { + tbuf[ui] = static_cast<wchar_t>((ch & 0xF) << 12); + ch = us[i++]; + tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + ((ch & 0x7F) << 6)); + ch = us[i++]; + tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + (ch & 0x7F)); + } + ui++; + } + return ui; +#endif +} diff --git a/src/stc/scintilla/src/UniConversion.h b/src/stc/scintilla/src/UniConversion.h new file mode 100644 index 0000000000..cace497c48 --- /dev/null +++ b/src/stc/scintilla/src/UniConversion.h @@ -0,0 +1,9 @@ +// UniConversion.h - functions to handle UFT-8 and UCS-2 strings +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen); +void UTF8FromUCS2(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len); +unsigned int UCS2Length(const char *s, unsigned int len); +unsigned int UCS2FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen); + diff --git a/src/stc/scintilla/src/ViewStyle.cxx b/src/stc/scintilla/src/ViewStyle.cxx index 001ecdb319..580ecc71ff 100644 --- a/src/stc/scintilla/src/ViewStyle.cxx +++ b/src/stc/scintilla/src/ViewStyle.cxx @@ -17,14 +17,46 @@ MarginStyle::MarginStyle() : symbol(false), width(16), mask(0xffffffff), sensitive(false) { } +// A list of the fontnames - avoids wasting space in each style +FontNames::FontNames() { + max = 0; +} + +FontNames::~FontNames() { + Clear(); +} + +void FontNames::Clear() { + for (int i=0;i<max;i++) { + delete []names[i]; + } + max = 0; +} + +const char *FontNames::Save(const char *name) { + if (!name) + return 0; + for (int i=0;i<max;i++) { + if (strcmp(names[i], name) == 0) { + return names[i]; + } + } + names[max] = new char[strlen(name) + 1]; + strcpy(names[max], name); + max++; + return names[max-1]; +} + ViewStyle::ViewStyle() { Init(); } ViewStyle::ViewStyle(const ViewStyle &source) { Init(); - for (int sty=0;sty<=STYLE_MAX;sty++) { + for (unsigned int sty=0;sty<(sizeof(styles)/sizeof(styles[0]));sty++) { styles[sty] = source.styles[sty]; + // Can't just copy fontname as its lifetime is relative to its owning ViewStyle + styles[sty].fontName = fontNames.Save(source.styles[sty].fontName); } for (int mrk=0;mrk<=MARKER_MAX;mrk++) { markers[mrk] = source.markers[mrk]; @@ -59,6 +91,9 @@ ViewStyle::~ViewStyle() { } void ViewStyle::Init() { + fontNames.Clear(); + ResetDefaultStyle(); + indicators[0].style = INDIC_SQUIGGLE; indicators[0].fore = Colour(0, 0x7f, 0); indicators[1].style = INDIC_TT; @@ -136,14 +171,17 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) { void ViewStyle::Refresh(Surface &surface) { selbar.desired = Platform::Chrome(); selbarlight.desired = Platform::ChromeHighlight(); - maxAscent = 1; - maxDescent = 1; + styles[STYLE_DEFAULT].Realise(surface, zoomLevel); + maxAscent = styles[STYLE_DEFAULT].ascent; + maxDescent = styles[STYLE_DEFAULT].descent; for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) { - styles[i].Realise(surface, zoomLevel); - if (maxAscent < styles[i].ascent) - maxAscent = styles[i].ascent; - if (maxDescent < styles[i].descent) - maxDescent = styles[i].descent; + if (i != STYLE_DEFAULT) { + styles[i].Realise(surface, zoomLevel, &styles[STYLE_DEFAULT]); + if (maxAscent < styles[i].ascent) + maxAscent = styles[i].ascent; + if (maxDescent < styles[i].descent) + maxDescent = styles[i].descent; + } } lineHeight = maxAscent + maxDescent; @@ -162,22 +200,31 @@ void ViewStyle::Refresh(Surface &surface) { } void ViewStyle::ResetDefaultStyle() { - styles[STYLE_DEFAULT].Clear(); + styles[STYLE_DEFAULT].Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), + Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), + SC_CHARSET_DEFAULT, + false, false, false, false); } void ViewStyle::ClearStyles() { // Reset all styles to be like the default style - for (int i=0; i<=STYLE_MAX; i++) { + for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) { if (i != STYLE_DEFAULT) { styles[i].Clear( styles[STYLE_DEFAULT].fore.desired, styles[STYLE_DEFAULT].back.desired, styles[STYLE_DEFAULT].size, styles[STYLE_DEFAULT].fontName, + styles[STYLE_DEFAULT].characterSet, styles[STYLE_DEFAULT].bold, - styles[STYLE_DEFAULT].italic); + styles[STYLE_DEFAULT].italic, + styles[STYLE_DEFAULT].eolFilled, + styles[STYLE_DEFAULT].underline); } } styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); } +void ViewStyle::SetStyleFontName(int styleIndex, const char *name) { + styles[styleIndex].fontName = fontNames.Save(name); +} diff --git a/src/stc/scintilla/src/ViewStyle.h b/src/stc/scintilla/src/ViewStyle.h index 944872095a..4436e83ff4 100644 --- a/src/stc/scintilla/src/ViewStyle.h +++ b/src/stc/scintilla/src/ViewStyle.h @@ -15,8 +15,20 @@ public: MarginStyle(); }; +class FontNames { +private: + char *names[STYLE_MAX + 1]; + int max; +public: + FontNames(); + ~FontNames(); + void Clear(); + const char *Save(const char *name); +}; + class ViewStyle { public: + FontNames fontNames; Style styles[STYLE_MAX + 1]; LineMarker markers[MARKER_MAX + 1]; Indicator indicators[INDIC_MAX + 1]; @@ -54,6 +66,7 @@ public: void Refresh(Surface &surface); void ResetDefaultStyle(); void ClearStyles(); + void SetStyleFontName(int styleIndex, const char *name); }; #endif diff --git a/src/stc/scintilla/src/WindowAccessor.cxx b/src/stc/scintilla/src/WindowAccessor.cxx new file mode 100644 index 0000000000..059c877bda --- /dev/null +++ b/src/stc/scintilla/src/WindowAccessor.cxx @@ -0,0 +1,173 @@ +// SciTE - Scintilla based Text Editor +// Accessor.cxx - rapid easy access to contents of a Scintilla +// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <ctype.h> +#include <stdio.h> + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "WindowAccessor.h" +#include "Scintilla.h" + +WindowAccessor::~WindowAccessor() { +} + +bool WindowAccessor::InternalIsLeadByte(char ch) { +#if PLAT_GTK + // TODO: support DBCS under GTK+ + return false; +#elif PLAT_WIN + if (SC_CP_UTF8 == codePage) + // For lexing, all characters >= 0x80 are treated the + // same so none is considered a lead byte. + return false; + else + return IsDBCSLeadByteEx(codePage, ch); +#elif PLAT_WX + return false; +#endif +} + +void WindowAccessor::Fill(int position) { + if (lenDoc == -1) + lenDoc = Platform::SendScintilla(id, WM_GETTEXTLENGTH, 0, 0); + startPos = position - slopSize; + if (startPos + bufferSize > lenDoc) + startPos = lenDoc - bufferSize; + if (startPos < 0) + startPos = 0; + endPos = startPos + bufferSize; + if (endPos > lenDoc) + endPos = lenDoc; + + TEXTRANGE tr = {{startPos, endPos}, buf}; + Platform::SendScintilla(id, EM_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr)); +} + +char WindowAccessor::StyleAt(int position) { + return static_cast<char>(Platform::SendScintilla( + id, SCI_GETSTYLEAT, position, 0)); +} + +int WindowAccessor::GetLine(int position) { + return Platform::SendScintilla(id, EM_LINEFROMCHAR, position, 0); +} + +int WindowAccessor::LineStart(int line) { + return Platform::SendScintilla(id, EM_LINEINDEX, line, 0); +} + +int WindowAccessor::LevelAt(int line) { + return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0); +} + +int WindowAccessor::Length() { + if (lenDoc == -1) + lenDoc = Platform::SendScintilla(id, WM_GETTEXTLENGTH, 0, 0); + return lenDoc; +} + +int WindowAccessor::GetLineState(int line) { + return Platform::SendScintilla(id, SCI_GETLINESTATE, line); +} + +int WindowAccessor::SetLineState(int line, int state) { + return Platform::SendScintilla(id, SCI_SETLINESTATE, line, state); +} + +void WindowAccessor::StartAt(unsigned int start, char chMask) { + Platform::SendScintilla(id, SCI_STARTSTYLING, start, chMask); +} + +void WindowAccessor::StartSegment(unsigned int pos) { + startSeg = pos; +} + +void WindowAccessor::ColourTo(unsigned int pos, int chAttr) { + // Only perform styling if non empty range + if (pos != startSeg - 1) { + if (pos < startSeg) { + Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos); + } + + if (validLen + (pos - startSeg + 1) >= bufferSize) + Flush(); + if (validLen + (pos - startSeg + 1) >= bufferSize) { + // Too big for buffer so send directly + Platform::SendScintilla(id, SCI_SETSTYLING, pos - startSeg + 1, chAttr); + } else { + if (chAttr != chWhile) + chFlags = 0; + chAttr |= chFlags; + for (unsigned int i = startSeg; i <= pos; i++) { + styleBuf[validLen++] = static_cast<char>(chAttr); + } + } + } + startSeg = pos+1; +} + +void WindowAccessor::SetLevel(int line, int level) { + Platform::SendScintilla(id, SCI_SETFOLDLEVEL, line, level); +} + +void WindowAccessor::Flush() { + startPos = extremePosition; + lenDoc = -1; + if (validLen > 0) { + Platform::SendScintilla(id, SCI_SETSTYLINGEX, validLen, + reinterpret_cast<LPARAM>(styleBuf)); + validLen = 0; + } +} + +int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { + int end = Length(); + int spaceFlags = 0; + + // Determines the indentation level of the current line and also checks for consistent + // indentation compared to the previous line. + // Indentation is judged consistent when the indentation whitespace of each line lines + // the same or the indentation of one line is a prefix of the other. + + int pos = LineStart(line); + char ch = (*this)[pos]; + int indent = 0; + bool inPrevPrefix = line > 0; + int posPrev = inPrevPrefix ? LineStart(line-1) : 0; + while ((ch == ' ' || ch == '\t') && (pos < end)) { + if (inPrevPrefix) { + char chPrev = (*this)[posPrev++]; + if (chPrev == ' ' || chPrev == '\t') { + if (chPrev != ch) + spaceFlags |= wsInconsistent; + } else { + inPrevPrefix = false; + } + } + if (ch == ' ') { + spaceFlags |= wsSpace; + indent++; + } else { // Tab + spaceFlags |= wsTab; + if (spaceFlags & wsSpace) + spaceFlags |= wsSpaceTab; + indent = (indent / 8 + 1) * 8; + } + ch = (*this)[++pos]; + } + + *flags = spaceFlags; + indent += SC_FOLDLEVELBASE; + // if completely empty line or the start of a comment... + if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) + return indent | SC_FOLDLEVELWHITEFLAG; + else + return indent; +} + diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index e85c952886..aa7bf8dd98 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -5,7 +5,7 @@ // derive directly from the Scintilla classes, but instead // delegates most things to the real Scintilla class. // This allows the use of Scintilla without polluting the -// namespace with all the classes and itentifiers from Scintilla. +// namespace with all the classes and identifiers from Scintilla. // // Author: Robin Dunn // @@ -15,11 +15,53 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +#include <ctype.h> + #include "wx/stc/stc.h" #include "ScintillaWX.h" #include <wx/tokenzr.h> +// The following code forces a reference to all of the Scintilla lexers. +// If we don't do something like this, then the linker tends to "optimize" +// them away. (eric@sourcegear.com) + +int wxForceScintillaLexers(void) +{ + extern LexerModule lmCPP; + extern LexerModule lmHTML; + extern LexerModule lmXML; + extern LexerModule lmProps; + extern LexerModule lmErrorList; + extern LexerModule lmMake; + extern LexerModule lmBatch; + extern LexerModule lmPerl; + extern LexerModule lmPython; + extern LexerModule lmSQL; + extern LexerModule lmVB; + + if ( + &lmCPP + && &lmHTML + && &lmXML + && &lmProps + && &lmErrorList + && &lmMake + && &lmBatch + && &lmPerl + && &lmPython + && &lmSQL + && &lmVB + ) + { + return 1; + } + else + { + return 0; + } +} + //---------------------------------------------------------------------- const wxChar* wxSTCNameStr = "stcwindow"; @@ -33,13 +75,19 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp) EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp) EVT_CHAR (wxStyledTextCtrl::OnChar) + EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown) EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus) EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus) EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged) EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground) EVT_MENU_RANGE (-1, -1, wxStyledTextCtrl::OnMenu) + EVT_LISTBOX_DCLICK (-1, wxStyledTextCtrl::OnListBox) END_EVENT_TABLE() + +IMPLEMENT_CLASS(wxStyledTextCtrl, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent) + //---------------------------------------------------------------------- // Constructor and Destructor @@ -69,7 +117,7 @@ wxStyledTextCtrl::~wxStyledTextCtrl() { //---------------------------------------------------------------------- -inline long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) { +long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) { return m_swx->WndProc(msg, wp, lp); } @@ -81,9 +129,10 @@ inline long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) { wxString wxStyledTextCtrl::GetText() { wxString text; int len = GetTextLength(); - char* buff = text.GetWriteBuf(len); + char* buff = text.GetWriteBuf(len+1); SendMsg(WM_GETTEXT, len, (long)buff); + buff[len] = 0; text.UngetWriteBuf(); return text; } @@ -99,8 +148,9 @@ wxString wxStyledTextCtrl::GetLine(int line) { int len = GetLineLength(line); char* buff = text.GetWriteBuf(len+1); - *((WORD*)buff) = len+1; + *((WORD*)buff) = len; SendMsg(EM_GETLINE, line, (long)buff); + buff[len] = 0; text.UngetWriteBuf(); return text; } @@ -384,7 +434,7 @@ wxString wxStyledTextCtrl::GetCurrentLineText(int* linePos) { int len = GetLineLength(GetCurrentLine()); char* buff = text.GetWriteBuf(len+1); - int pos = SendMsg(SCI_GETCURLINE, len+1, (long)buff); + int pos = SendMsg(SCI_GETCURLINE, len, (long)buff); text.UngetWriteBuf(); if (linePos) @@ -410,7 +460,7 @@ int wxStyledTextCtrl::LineFromPoint(wxPoint pt) { wxPoint wxStyledTextCtrl::PointFromPosition(int pos) { Point pt; - SendMsg(EM_POSFROMCHAR, pos, (long)&pt); + SendMsg(EM_POSFROMCHAR, (long)&pt, pos); return wxPoint(pt.x, pt.y); } @@ -491,6 +541,27 @@ int wxStyledTextCtrl::GetSelectionType() { } +int wxStyledTextCtrl::GetLinesOnScreen() { + return SendMsg(SCI_LINESONSCREEN); +} + + +bool wxStyledTextCtrl::IsSelectionRectangle() { + return SendMsg(SCI_SELECTIONISRECTANGLE) != 0; +} + + +void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool use) { + SendMsg(SCI_SETHSCROLLBAR, use); +} + + +bool wxStyledTextCtrl::GetUseHorizontalScrollBar() { + return SendMsg(SCI_GETHSCROLLBAR) != 0; +} + + + //---------------------------------------------------------------------- @@ -598,6 +669,16 @@ void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) { } +void wxStyledTextCtrl::SetLineState(int line, int value) { + SendMsg(SCI_SETLINESTATE, line, value); +} + + +int wxStyledTextCtrl::GetLineState(int line) { + return SendMsg(SCI_GETLINESTATE, line); +} + + //---------------------------------------------------------------------- // Style Definition @@ -646,6 +727,7 @@ void wxStyledTextCtrl::StyleResetDefault() { // face:[facename] sets the font face name to use // size:[num] sets the font size in points // eol turns on eol filling +// underline turns on underlining // void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { @@ -663,6 +745,9 @@ void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { else if (option == "italic") StyleSetItalic(styleNum, true); + else if (option == "underline") + StyleSetUnderline(styleNum, true); + else if (option == "eol") StyleSetEOLFilled(styleNum, true); @@ -699,18 +784,21 @@ void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) { wxString faceName = font.GetFaceName(); bool bold = font.GetWeight() == wxBOLD; bool italic = font.GetStyle() != wxNORMAL; + bool under = font.GetUnderlined(); - StyleSetFontAttr(styleNum, size, faceName, bold, italic); + StyleSetFontAttr(styleNum, size, faceName, bold, italic, under); } void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size, const wxString& faceName, - bool bold, bool italic) { + bool bold, bool italic, + bool underline) { StyleSetSize(styleNum, size); StyleSetFaceName(styleNum, faceName); StyleSetBold(styleNum, bold); StyleSetItalic(styleNum, italic); + StyleSetUnderline(styleNum, underline); } @@ -739,6 +827,11 @@ void wxStyledTextCtrl::StyleSetEOLFilled(int styleNum, bool fillEOL) { } +void wxStyledTextCtrl::StyleSetUnderline(int styleNum, bool underline) { + SendMsg(SCI_STYLESETUNDERLINE, styleNum, underline); +} + + //---------------------------------------------------------------------- // Margins in the edit area @@ -829,7 +922,7 @@ void wxStyledTextCtrl::SetSelectionBackground(const wxColour& colour) { void wxStyledTextCtrl::SetCaretForeground(const wxColour& colour) { - SendMsg(SCI_SETCARETFORE, 0, wxColourAsLong(colour)); + SendMsg(SCI_SETCARETFORE, wxColourAsLong(colour)); } @@ -858,11 +951,41 @@ void wxStyledTextCtrl::SetTabWidth(int numChars) { } +void wxStyledTextCtrl::SetIndent(int numChars) { + SendMsg(SCI_SETINDENT, numChars); +} + + +void wxStyledTextCtrl::SetUseTabs(bool usetabs) { + SendMsg(SCI_SETUSETABS, usetabs); +} + + +void wxStyledTextCtrl::SetLineIndentation(int line, int indentation) { + SendMsg(SCI_SETLINEINDENTATION, line, indentation); +} + + +int wxStyledTextCtrl:: GetLineIndentation(int line) { + return SendMsg(SCI_GETLINEINDENTATION, line); +} + + +int wxStyledTextCtrl::GetLineIndentationPos(int line) { + return SendMsg(SCI_GETLINEINDENTPOSITION, line); +} + + void wxStyledTextCtrl::SetWordChars(const wxString& wordChars) { SendMsg(SCI_SETTABWIDTH, 0, (long)wordChars.c_str()); } +void wxStyledTextCtrl::SetUsePop(bool usepopup) { + SendMsg(SCI_USEPOPUP, usepopup); +} + + //---------------------------------------------------------------------- // Brace highlighting @@ -967,7 +1090,7 @@ int wxStyledTextCtrl::IndicatorGetStyle(int indicNum) { void wxStyledTextCtrl::IndicatorSetColour(int indicNum, const wxColour& colour) { - SendMsg(SCI_INDICSETSTYLE, indicNum, wxColourAsLong(colour)); + SendMsg(SCI_INDICSETFORE, indicNum, wxColourAsLong(colour)); } @@ -1006,6 +1129,21 @@ void wxStyledTextCtrl::AutoCompStopChars(const wxString& stopChars) { } +void wxStyledTextCtrl::AutoCompSetSeparator(char separator) { + SendMsg(SCI_AUTOCSETSEPARATOR, separator); +} + + +char wxStyledTextCtrl::AutoCompGetSeparator() { + return SendMsg(SCI_AUTOCGETSEPARATOR); +} + + +void wxStyledTextCtrl::AutoCompSelect(const wxString& stringtoselect) { + SendMsg(SCI_AUTOCSELECT, (long)stringtoselect.c_str()); +} + + //---------------------------------------------------------------------- // Call tips @@ -1129,8 +1267,8 @@ int wxStyledTextCtrl::GetFoldLevel(int line) { } -int wxStyledTextCtrl::GetLastChild(int line) { - return SendMsg(SCI_GETLASTCHILD, line); +int wxStyledTextCtrl::GetLastChild(int line, int level) { + return SendMsg(SCI_GETLASTCHILD, line, level); } @@ -1154,8 +1292,8 @@ bool wxStyledTextCtrl::GetLineVisible(int line) { } -void wxStyledTextCtrl::SetFoldExpanded(int line) { - SendMsg(SCI_SETFOLDEXPANDED, line); +void wxStyledTextCtrl::SetFoldExpanded(int line, bool expanded) { + SendMsg(SCI_SETFOLDEXPANDED, line, expanded); } @@ -1174,6 +1312,33 @@ void wxStyledTextCtrl::EnsureVisible(int line) { } +void wxStyledTextCtrl::SetFoldFlags(int flags) { + SendMsg(SCI_SETFOLDFLAGS, flags); +} + + +//---------------------------------------------------------------------- +// Zooming + +void wxStyledTextCtrl::ZoomIn() { + SendMsg(SCI_ZOOMIN); +} + + +void wxStyledTextCtrl::ZoomOut() { + SendMsg(SCI_ZOOMOUT); +} + + +void wxStyledTextCtrl::SetZoom(int zoom) { + SendMsg(SCI_SETZOOM, zoom); +} + + +int wxStyledTextCtrl::GetZoom() { + return SendMsg(SCI_GETZOOM); +} + //---------------------------------------------------------------------- // Long Lines @@ -1232,6 +1397,18 @@ void wxStyledTextCtrl::SetKeywords(int keywordSet, const wxString& keywordLi +//---------------------------------------------------------------------- +// Event mask for Modified Event + +void wxStyledTextCtrl::SetModEventMask(int mask) { + SendMsg(SCI_SETMODEVENTMASK, mask); +} + + +//int wxStyledTextCtrl::GetModEventMask() { +// return SendMsg(SCI_GETMODEVENTMASK); +//} + //---------------------------------------------------------------------- // Event handlers @@ -1278,20 +1455,23 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) { } void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { - int processed = 0; long key = evt.KeyCode(); if ((key > WXK_ESCAPE) && (key != WXK_DELETE) && (key < 255) && !evt.ControlDown() && !evt.AltDown()) { m_swx->DoAddChar(key); - processed = true; } else { - key = toupper(key); - processed = m_swx->DoKeyDown(key, evt.ShiftDown(), - evt.ControlDown(), evt.AltDown()); + evt.Skip(); } +} + +void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { + long key = evt.KeyCode(); + key = toupper(key); + int processed = m_swx->DoKeyDown(key, evt.ShiftDown(), + evt.ControlDown(), evt.AltDown()); if (! processed) evt.Skip(); } @@ -1319,9 +1499,15 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) { } +void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) { + m_swx->DoOnListBox(); +} + + //---------------------------------------------------------------------- // Turn notifications from Scintilla into events + void wxStyledTextCtrl::NotifyChange() { wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId()); GetEventHandler()->ProcessEvent(evt); @@ -1375,7 +1561,8 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetModifiers(scn.modifiers); if (eventType == wxEVT_STC_MODIFIED) { evt.SetModificationType(scn.modificationType); - evt.SetText(scn.text); + if (scn.text) + evt.SetText(wxString(scn.text, scn.length)); evt.SetLength(scn.length); evt.SetLinesAdded(scn.linesAdded); evt.SetLine(scn.line); diff --git a/src/tiff/tiff.dsp b/src/tiff/TiffVC.dsp similarity index 100% rename from src/tiff/tiff.dsp rename to src/tiff/TiffVC.dsp diff --git a/src/png/png.dsw b/src/tiff/TiffVC.dsw similarity index 90% rename from src/png/png.dsw rename to src/tiff/TiffVC.dsw index 81564033ad..8e9111524c 100644 --- a/src/png/png.dsw +++ b/src/tiff/TiffVC.dsw @@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### -Project: "png"=.\png.dsp - Package Owner=<4> +Project: "tiff"=.\TiffVC.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/src/tiff/makefile.wat b/src/tiff/makefile.wat new file mode 100644 index 0000000000..4f8d5cfc38 --- /dev/null +++ b/src/tiff/makefile.wat @@ -0,0 +1,141 @@ +#!/binb/wmake.exe +# +# File: makefile.wat +# Author: Julian Smart +# Created: 1998 +# +# Makefile : Builds TIFF library for Watcom C++, WIN32 +# This makefile has to rename files because apparently Watcom C++ +# can't deal with greater than 8.3 filenames (can't +# make tif_close.c, for example) + +WXDIR = ..\.. +EXTRACPPFLAGS=-i=..\zlib + +!include $(WXDIR)\src\makewat.env + +WXLIB = $(WXDIR)\lib + +LIBTARGET = $(WXLIB)\tiff.lib + +OBJECTS= & + _aux.obj & + close.obj & + codec.obj & + compress.obj & + dir.obj & + dirinfo.obj & + dirread.obj & + dirwrite.obj & + dumpmode.obj & + error.obj & + fax3.obj & + fax3sm.obj & + flush.obj & + getimage.obj & + jpeg.obj & + luv.obj & + lzw.obj & + next.obj & + open.obj & + packbits.obj & + pixarlog.obj & + predict.obj & + print.obj & + read.obj & + strip.obj & + swab.obj & + thunder.obj & + tile.obj & + version.obj & + warning.obj & + win32.obj & + write.obj & + zip.obj + +rename: .SYMBOLIC + copy tif_predict.h tif_pred.h + copy tif_aux.c _aux.c + copy tif_close.c close.c + copy tif_codec.c codec.c + copy tif_compress.c compress.c + copy tif_dir.c dir.c + copy tif_dirinfo.c dirinfo.c + copy tif_dirread.c dirread.c + copy tif_dirwrite.c dirwrite.c + copy tif_dumpmode.c dumpmode.c + copy tif_error.c error.c + copy tif_fax3.c fax3.c + copy tif_fax3sm.c fax3sm.c + copy tif_flush.c flush.c + copy tif_getimage.c getimage.c + copy tif_jpeg.c jpeg.c + copy tif_luv.c luv.c + copy tif_lzw.c lzw.c + copy tif_next.c next.c + copy tif_open.c open.c + copy tif_packbits.c packbits.c + copy tif_pixarlog.c pixarlog.c + copy tif_predict.c predict.c + copy tif_print.c print.c + copy tif_read.c read.c + copy tif_strip.c strip.c + copy tif_swab.c swab.c + copy tif_thunder.c thunder.c + copy tif_tile.c tile.c + copy tif_version.c version.c + copy tif_warning.c warning.c + copy tif_win32.c win32.c + copy tif_write.c write.c + copy tif_zip.c zip.c + +all: rename $(OBJECTS) $(LIBTARGET) + +$(LIBTARGET) : $(OBJECTS) + %create tmp.lbc + @for %i in ( $(OBJECTS) ) do @%append tmp.lbc +%i + wlib /b /c /n /p=512 $^@ @tmp.lbc + +clean: .SYMBOLIC + -erase *.obj + -erase $(LIBTARGET) + -erase *.pch + -erase *.err + -erase *.lbc + -erase tif_pred.h + -erase _aux.c + -erase close.c + -erase codec.c + -erase compress.c + -erase dir.c + -erase dirinfo.c + -erase dirread.c + -erase dirwrite.c + -erase dumpmode.c + -erase error.c + -erase fax3.c + -erase fax3sm.c + -erase flush.c + -erase getimage.c + -erase jpeg.c + -erase luv.c + -erase lzw.c + -erase next.c + -erase open.c + -erase packbits.c + -erase pixarlog.c + -erase predict.c + -erase print.c + -erase read.c + -erase strip.c + -erase swab.c + -erase thunder.c + -erase tile.c + -erase version.c + -erase warning.c + -erase win32.c + -erase write.c + -erase zip.c + +cleanall: clean + diff --git a/src/tiff/tif_lzw.c b/src/tiff/tif_lzw.c index e41314a6a3..d739e6f18d 100644 --- a/src/tiff/tif_lzw.c +++ b/src/tiff/tif_lzw.c @@ -36,7 +36,12 @@ * * The original Berkeley copyright notice appears below in its entirety. */ +/* Watcom C++ (or its make utility) doesn't like long filenames */ +#ifdef __WATCOMC__ +#include "tif_pred.h" +#else #include "tif_predict.h" +#endif #include <assert.h> #include <stdio.h> diff --git a/src/tiff/tif_pixarlog.c b/src/tiff/tif_pixarlog.c index 27f2a9d775..1cf49be837 100644 --- a/src/tiff/tif_pixarlog.c +++ b/src/tiff/tif_pixarlog.c @@ -84,7 +84,13 @@ * */ +/* Watcom C++ (or its make utility) doesn't like long filenames */ +#ifdef __WATCOMC__ +#include "tif_pred.h" +#else #include "tif_predict.h" +#endif + #include "zlib.h" #include "zutil.h" diff --git a/src/tiff/tif_predict.c b/src/tiff/tif_predict.c index 3dd7c98747..137a2fb3a4 100644 --- a/src/tiff/tif_predict.c +++ b/src/tiff/tif_predict.c @@ -30,7 +30,12 @@ * Predictor Tag Support (used by multiple codecs). */ #include "tiffiop.h" +/* Watcom C++ (or its make utility) doesn't like long filenames */ +#ifdef __WATCOMC__ +#include "tif_pred.h" +#else #include "tif_predict.h" +#endif #include <assert.h> diff --git a/src/tiff/tif_zip.c b/src/tiff/tif_zip.c index 89cfdbde18..38e98a96c8 100644 --- a/src/tiff/tif_zip.c +++ b/src/tiff/tif_zip.c @@ -46,7 +46,13 @@ * directory ftp://ftp.uu.net/pub/archiving/zip/doc. The library was * last found at ftp://ftp.uu.net/pub/archiving/zip/zlib/zlib-0.99.tar.gz. */ +/* Watcom C++ (or its make utility) doesn't like long filenames */ +#ifdef __WATCOMC__ +#include "tif_pred.h" +#else #include "tif_predict.h" +#endif + #include "zlib.h" #include <stdio.h> diff --git a/src/unix/dialup.cpp b/src/unix/dialup.cpp index 6641d377b4..f64e45fd90 100644 --- a/src/unix/dialup.cpp +++ b/src/unix/dialup.cpp @@ -1,4 +1,4 @@ -// -*- c++ -*- /////////////////////////////////////////////////////////////// +// -*- c++ -*- //////////////////////////////////////////////////////////////// // Name: unix/dialup.cpp // Purpose: Network related wxWindows classes and functions // Author: Karsten Ballüder @@ -7,7 +7,7 @@ // RCS-ID: $Id$ // Copyright: (c) Karsten Ballüder // Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// #include "wx/setup.h" @@ -28,7 +28,7 @@ #include "wx/filefn.h" #include "wx/utils.h" #include "wx/log.h" -#include "wx/file.h" +#include "wx/ffile.h" #include "wx/process.h" #include "wx/intl.h" #include "wx/app.h" @@ -96,7 +96,7 @@ public: const wxString& WXUNUSED(password), bool async); - /// Hang up the currently active dial up connection. + // Hang up the currently active dial up connection. virtual bool HangUp(); // returns TRUE if the computer is connected to the network: under Windows, @@ -105,17 +105,14 @@ public: virtual bool IsOnline() const { CheckStatus(); - return m_IsOnline > 0; + return m_IsOnline == Net_Connected; } - /// do we have a constant net connection? -- GUESS! - bool IsAlwaysOnline() const - { - ((wxDialUpManagerImpl *) this)->HangUp(); // brutal but necessary - return IsOnline(); - } - /// returns TRUE if (async) dialing is in progress - inline virtual bool IsDialing() const + // do we have a constant net connection? + virtual bool IsAlwaysOnline() const; + + // returns TRUE if (async) dialing is in progress + virtual bool IsDialing() const { return m_DialProcess != NULL; } // cancel dialing the number initiated with Dial(async = TRUE) @@ -130,7 +127,7 @@ public: // allows to forcefully set the online status - whatever our internal // algorithm may think about it. virtual void SetOnlineStatus(bool isOnline = TRUE) - { m_IsOnline = isOnline; } + { m_IsOnline = isOnline ? Net_Connected : Net_No; } // set misc wxDialUpManager options // -------------------------------- @@ -159,56 +156,87 @@ public: virtual void SetConnectCommand(const wxString &command, const wxString &hupcmd) { m_ConnectCommand = command; m_HangUpCommand = hupcmd; } +//private: -- Sun CC 4.2 objects to using NetConnection enum as the return +// type if it is declared private + + // the possible results of testing for Online() status + enum NetConnection + { + Net_Unknown = -1, // we couldn't learn anything + Net_No, // no network connection [currently] + Net_Connected // currently connected + }; + + // the possible net connection types + enum NetDeviceType + { + NetDevice_None = 0x0000, // no network devices (authoritative) + NetDevice_Unknown = 0x0001, // test doesn't work on this OS + NetDevice_Modem = 0x0002, // we have a modem + NetDevice_LAN = 0x0004 // a network card + }; + private: - /// -1: don´t know, 0 = no, 1 = yes - int m_IsOnline; + // the current status + NetConnection m_IsOnline; + + // the connection we have with the network card + NetConnection m_connCard; - /// Can we use ifconfig to list active devices? + // Can we use ifconfig to list active devices? int m_CanUseIfconfig; - /// The path to ifconfig + + // The path to ifconfig wxString m_IfconfigPath; - /// Can we use ping to find hosts? + // Can we use ping to find hosts? int m_CanUsePing; - /// The path to ping program + // The path to ping program wxString m_PingPath; - /// beacon host: + // beacon host: wxString m_BeaconHost; - /// beacon host portnumber for connect: + // beacon host portnumber for connect: int m_BeaconPort; - /// command to connect to network + // command to connect to network wxString m_ConnectCommand; - /// command to hang up + // command to hang up wxString m_HangUpCommand; - /// name of ISP + // name of ISP wxString m_ISPname; - /// a timer for regular testing + // a timer for regular testing class AutoCheckTimer *m_timer; friend class AutoCheckTimer; - /// a wxProcess for dialling in background + // a wxProcess for dialling in background class wxDialProcess *m_DialProcess; - /// pid of dial process + // pid of dial process int m_DialPId; friend class wxDialProcess; - /// determine status + // determine status void CheckStatus(bool fromAsync = FALSE) const; - /// real status check - void CheckStatusInternal(void); + // real status check + void CheckStatusInternal(); + + // check /proc/net (Linux only) for ppp/eth interfaces, returns the bit + // mask of NetDeviceType constants + int CheckProcNet(); + + // check output of ifconfig command for PPP/SLIP/PLIP devices, returns the + // bit mask of NetDeviceType constants + int CheckIfconfig(); + + // combines the 2 possible checks for determining the connection status + NetConnection CheckConnectAndPing(); - /// Check /proc/net (Linux only) - int CheckProcNet(void); - /// Check output of ifconfig command for PPP/SLIP/PLIP devices - int CheckIfconfig(void); - /// Ping a host: 1 on success, -1 if it cannot be used, 0 if unreachable - int CheckPing(void); - /// Check by connecting to host on given port. - int CheckConnect(void); + // pings a host + NetConnection CheckPing(); + // check by connecting to host on given port. + NetConnection CheckConnect(); }; @@ -241,7 +269,7 @@ public: { m_DupMan = dupman; } - void Disconnect(void) { m_DupMan = NULL; } + void Disconnect() { m_DupMan = NULL; } virtual void OnTerminate(int WXUNUSED(pid), int WXUNUSED(status)) { if(m_DupMan) @@ -257,12 +285,8 @@ private: wxDialUpManagerImpl::wxDialUpManagerImpl() { - /* The isOnline flag can have the following values internally: - 0 : not connected - 1 : connected - -1 : unknown/undefined status - */ - m_IsOnline = -1; + m_IsOnline = + m_connCard = Net_Unknown; m_DialProcess = NULL; m_timer = NULL; m_CanUseIfconfig = -1; // unknown @@ -300,7 +324,7 @@ wxDialUpManagerImpl::Dial(const wxString &isp, const wxString & WXUNUSED(password), bool async) { - if(m_IsOnline == 1) + if(m_IsOnline == Net_Connected) return FALSE; m_ISPname = isp; wxString cmd; @@ -326,10 +350,9 @@ wxDialUpManagerImpl::Dial(const wxString &isp, return wxExecute(cmd, /* sync */ TRUE) == 0; } -bool -wxDialUpManagerImpl::HangUp(void) +bool wxDialUpManagerImpl::HangUp() { - if(m_IsOnline == 0) + if(m_IsOnline == Net_No) return FALSE; if(IsDialing()) { @@ -345,16 +368,14 @@ wxDialUpManagerImpl::HangUp(void) } -bool -wxDialUpManagerImpl::CancelDialing() +bool wxDialUpManagerImpl::CancelDialing() { if(! IsDialing()) return FALSE; return kill(m_DialPId, SIGTERM) > 0; } -bool -wxDialUpManagerImpl::EnableAutoCheckOnlineStatus(size_t nSeconds) +bool wxDialUpManagerImpl::EnableAutoCheckOnlineStatus(size_t nSeconds) { DisableAutoCheckOnlineStatus(); m_timer = new AutoCheckTimer(this); @@ -367,8 +388,7 @@ wxDialUpManagerImpl::EnableAutoCheckOnlineStatus(size_t nSeconds) return rc; } -void -wxDialUpManagerImpl::DisableAutoCheckOnlineStatus() +void wxDialUpManagerImpl::DisableAutoCheckOnlineStatus() { if(m_timer != NULL) { @@ -379,8 +399,7 @@ wxDialUpManagerImpl::DisableAutoCheckOnlineStatus() } -void -wxDialUpManagerImpl::SetWellKnownHost(const wxString& hostname, int portno) +void wxDialUpManagerImpl::SetWellKnownHost(const wxString& hostname, int portno) { if(hostname.Length() == 0) { @@ -388,8 +407,8 @@ wxDialUpManagerImpl::SetWellKnownHost(const wxString& hostname, int portno) m_BeaconPort = 80; return; } - - /// does hostname contain a port number? + + // does hostname contain a port number? wxString port = hostname.After(wxT(':')); if(port.Length()) { @@ -404,60 +423,139 @@ wxDialUpManagerImpl::SetWellKnownHost(const wxString& hostname, int portno) } -void -wxDialUpManagerImpl::CheckStatus(bool fromAsync) const +void wxDialUpManagerImpl::CheckStatus(bool fromAsync) const { - // This function calls the CheckStatusInternal() helper function - // which is OS - specific and then sends the events. - - int oldIsOnline = m_IsOnline; - ( /* non-const */ (wxDialUpManagerImpl *)this)->CheckStatusInternal(); - - // now send the events as appropriate: - if(m_IsOnline != oldIsOnline // it changed - && ( m_IsOnline == 1 // and it is a defined status - || m_IsOnline == 0) - // only send events for well defined transitions - && ( oldIsOnline == 1 || oldIsOnline == 0) - ) - { - wxDialUpEvent event(m_IsOnline, ! fromAsync); - (void)wxTheApp->ProcessEvent(event); - } + // This function calls the CheckStatusInternal() helper function + // which is OS - specific and then sends the events. + + NetConnection oldIsOnline = m_IsOnline; + ( /* non-const */ (wxDialUpManagerImpl *)this)->CheckStatusInternal(); + + // now send the events as appropriate: i.e. if the status changed and + // if we're in defined state + if(m_IsOnline != oldIsOnline + && m_IsOnline != Net_Unknown + && oldIsOnline != Net_Unknown ) + { + wxDialUpEvent event(m_IsOnline == Net_Connected, ! fromAsync); + (void)wxTheApp->ProcessEvent(event); + } } /* - We have three methods that we can use: + We first try to find out if ppp interface is active. If it is, we assume + that we're online but don't have a permanent connection (this is false if a + networked machine uses modem to connect to somewhere else, but we can't do + anything in this case anyhow). + + If no ppp interface is detected, we check for eth interface. If it is + found, we check that we can, indeed, connect to an Internet host. The logic + here is that connection check should be fast enough in this case and we + don't want to give false positives in a (common) case of a machine on a LAN + which is not connected to the outside. + + If we didn't find either ppp or eth interfaces, we stop here and decide + that we're connected. However, if couldn't check for this, we try to ping a + remote host just in case. - 1. test via /sbin/ifconfig and grep for "sl", "ppp", "pl" - --> should be fast enough for regular polling - 2. test if we can reach the well known beacon host - --> too slow for polling - 3. check /proc/net/dev on linux?? - This method should be preferred, if possible. Need to do more - testing. + NB1: Checking for the interface presence can be done in 2 ways + a) reading /proc/net/dev under Linux + b) spawning ifconfig under any OS + The first method is faster but only works under Linux. + + NB2: pinging, actually, means that we first try to connect "manually" to + a port on remove machine and if it fails, we run ping. */ -void -wxDialUpManagerImpl::CheckStatusInternal(void) +void wxDialUpManagerImpl::CheckStatusInternal() { - m_IsOnline = -1; - - int testResult; - - testResult = CheckProcNet(); - if(testResult == -1) - testResult = CheckIfconfig(); - if(testResult == -1) - testResult = CheckConnect(); - if(testResult == -1) - testResult = CheckPing(); - m_IsOnline = testResult; + m_IsOnline = Net_Unknown; + + // first do quick checks to determine what kind of network devices do we + // have + int netDeviceType = CheckProcNet(); + if ( netDeviceType == NetDevice_Unknown ) + { + // nothing found, try ifconfig too + netDeviceType = CheckIfconfig(); + } + + switch ( netDeviceType ) + { + case NetDevice_None: + // no network devices, no connection + m_IsOnline = Net_No; + break; + + case NetDevice_LAN: + // we still do ping to confirm that we're connected but we only do + // it once and hope that the purpose of the network card (i.e. + // whether it used for connecting to the Internet or just to a + // LAN) won't change during the program lifetime + if ( m_connCard == Net_Unknown ) + { + m_connCard = CheckConnectAndPing(); + } + m_IsOnline = m_connCard; + break; + + case NetDevice_Unknown: + // try to ping just in case + m_IsOnline = CheckConnectAndPing(); + break; + + case NetDevice_LAN + NetDevice_Modem: + case NetDevice_Modem: + // assume we're connected + m_IsOnline = Net_Connected; + break; + + default: + wxFAIL_MSG(_T("Unexpected netDeviceType")); + } } -int -wxDialUpManagerImpl::CheckConnect(void) +bool wxDialUpManagerImpl::IsAlwaysOnline() const +{ + wxDialUpManagerImpl *self = wxConstCast(this, wxDialUpManagerImpl); + + int netDeviceType = self->CheckProcNet(); + if ( netDeviceType == NetDevice_Unknown ) + { + // nothing found, try ifconfig too + netDeviceType = self->CheckIfconfig(); + } + + if ( netDeviceType == NetDevice_Unknown ) + { + // this is the only thing we can do unfortunately... + self->HangUp(); + return IsOnline(); + } + else + { + // we are only permanently online if we have a network card + return (netDeviceType & NetDevice_LAN) != 0; + } +} + +wxDialUpManagerImpl::NetConnection wxDialUpManagerImpl::CheckConnectAndPing() +{ + NetConnection conn; + + // first try connecting - faster + conn = CheckConnect(); + if ( conn == Net_Unknown ) + { + // try pinging too + conn = CheckPing(); + } + + return conn; +} + +wxDialUpManagerImpl::NetConnection wxDialUpManagerImpl::CheckConnect() { // second method: try to connect to a well known host: // This can be used under Win 9x, too! @@ -465,7 +563,7 @@ wxDialUpManagerImpl::CheckConnect(void) struct sockaddr_in serv_addr; if((hp = gethostbyname(m_BeaconHost.mb_str())) == NULL) - return 0; // no DNS no net + return Net_No; // no DNS no net serv_addr.sin_family = hp->h_addrtype; memcpy(&serv_addr.sin_addr,hp->h_addr, hp->h_length); @@ -474,160 +572,180 @@ wxDialUpManagerImpl::CheckConnect(void) int sockfd; if( ( sockfd = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) { - return -1; // no info + return Net_Unknown; // no info } if( connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) >= 0) { close(sockfd); - return 1; // we cant connect, so we have a network! + return Net_Connected; // we can connect, so we have a network! + } + else // failed to connect + { + if(errno == ENETUNREACH) + return Net_No; // network is unreachable + else + return Net_Unknown; // connect failed, but don't know why } - //connected! - close(sockfd); - if(errno == ENETUNREACH) - return 0; // network is unreachable - // connect failed, but don't know why - return -1; } -int -wxDialUpManagerImpl::CheckProcNet(void) +int +wxDialUpManagerImpl::CheckProcNet() { - int rc = -1; + // assume that the test doesn't work + int netDevice = NetDevice_Unknown; #ifdef __LINUX__ - if (wxFileExists(_T("/proc/net/route"))) - { - // NOTE: cannot use wxFile::Length because file doesn't support - // seeking - FILE *f = fopen("/proc/net/route", "rt"); - if (f != NULL) - { - char output[256]; - - while (fgets(output, 256, f) != NULL) - { - if (strstr(output,"ppp") // ppp - || strstr(output,"sl") // slip - || strstr(output,"pl")) // plip - rc = 1; - } - if (rc == -1) rc = 0; - fclose(f); - } - } -#endif - - return rc; + if (wxFileExists(_T("/proc/net/route"))) + { + // cannot use wxFile::Length because file doesn't support seeking, so + // use stdio directly + FILE *f = fopen("/proc/net/route", "rt"); + if (f != NULL) + { + // now we know that we will find all devices we may have + netDevice = NetDevice_None; + + char output[256]; + + while (fgets(output, 256, f) != NULL) + { + if ( strstr(output, "eth") ) // network card + { + netDevice |= NetDevice_LAN; + } + else if (strstr(output,"ppp") // ppp + || strstr(output,"sl") // slip + || strstr(output,"pl")) // plip + { + netDevice |= NetDevice_Modem; + } + } + + fclose(f); + } + } +#endif // __LINUX__ + + return netDevice; } int -wxDialUpManagerImpl::CheckIfconfig(void) +wxDialUpManagerImpl::CheckIfconfig() { - int rc = -1; + // assume that the test doesn't work + int netDevice = NetDevice_Unknown; + + // first time check for ifconfig location + if ( m_CanUseIfconfig == -1 ) // unknown + { + static const wxChar *ifconfigLocations[] = + { + _T("/sbin"), // Linux, FreeBSD + _T("/usr/sbin"), // SunOS, Solaris, AIX, HP-UX + _T("/usr/etc"), // IRIX + }; + + for ( size_t n = 0; n < WXSIZEOF(ifconfigLocations); n++ ) + { + wxString path(ifconfigLocations[n]); + path << _T("/ifconfig"); + + if ( wxFileExists(path) ) + { + m_IfconfigPath = path; + break; + } + } + } - // First time check for ifconfig location. We only use the variant which - // does not take arguments, a la GNU. - if ( m_CanUseIfconfig == -1 ) // unknown - { - static const wxChar *ifconfigLocations[] = - { - _T("/sbin"), // Linux, FreeBSD - _T("/usr/sbin"), // SunOS, Solaris, AIX, HP-UX - _T("/usr/etc"), // IRIX - }; - - for ( size_t n = 0; n < WXSIZEOF(ifconfigLocations); n++ ) - { - wxString path(ifconfigLocations[n]); - path << _T("/ifconfig"); - - if ( wxFileExists(path) ) - { - m_IfconfigPath = path; - break; - } - } - } + if ( m_CanUseIfconfig != 0 ) // unknown or yes + { + wxLogNull ln; // suppress all error messages - wxLogNull ln; // suppress all error messages - // Let´s try the ifconfig method first, should be fastest: - if(m_CanUseIfconfig != 0) // unknown or yes - { - wxASSERT(m_IfconfigPath.length()); + wxASSERT_MSG( m_IfconfigPath.length(), + _T("can't use ifconfig if it wasn't found") ); - wxString tmpfile = wxGetTempFileName("_wxdialuptest"); - wxString cmd = "/bin/sh -c \'"; - cmd << m_IfconfigPath; + wxString tmpfile = wxGetTempFileName("_wxdialuptest"); + wxString cmd = "/bin/sh -c \'"; + cmd << m_IfconfigPath; #if defined(__SOLARIS__) || defined (__SUNOS__) - // need to add -a flag - cmd << " -a"; + // need to add -a flag + cmd << " -a"; #elif defined(__LINUX__) || defined(__SGI__) - // nothing to be added to ifconfig + // nothing to be added to ifconfig #elif defined(__FREEBSD__) - // add -l flag - cmd << " -l"; + // add -l flag + cmd << " -l"; #elif defined(__HPUX__) - // VZ: a wild guess (but without it, ifconfig fails completely) - cmd << _T(" ppp0"); + // VZ: a wild guess (but without it, ifconfig fails completely) + cmd << _T(" ppp0"); #else # pragma warning "No ifconfig information for this OS." - m_CanUseIfconfig = 0; - return -1; + m_CanUseIfconfig = 0; + return -1; #endif - cmd << " >" << tmpfile << '\''; - /* I tried to add an option to wxExecute() to not close stdout, - so we could let ifconfig write directly to the tmpfile, but - this does not work. That should be faster, as it doesn´t call - the shell first. I have no idea why. :-( (KB) */ - if(wxExecute(cmd,TRUE /* sync */) == 0) - { - m_CanUseIfconfig = 1; - wxFile file; - if( file.Open(tmpfile) ) - { - char *output = new char [file.Length()+1]; - output[file.Length()] = '\0'; - if(file.Read(output,file.Length()) == file.Length()) + cmd << " >" << tmpfile << '\''; + /* I tried to add an option to wxExecute() to not close stdout, + so we could let ifconfig write directly to the tmpfile, but + this does not work. That should be faster, as it doesn´t call + the shell first. I have no idea why. :-( (KB) */ + if ( wxExecute(cmd,TRUE /* sync */) == 0 ) + { + m_CanUseIfconfig = 1; + wxFFile file; + if( file.Open(tmpfile) ) { - // FIXME shouldn't we grep for "^ppp"? (VZ) + wxString output; + if ( file.ReadAll(&output) ) + { + // FIXME shouldn't we grep for "^ppp"? (VZ) + + bool hasModem = FALSE, + hasLAN = FALSE; #if defined(__SOLARIS__) || defined (__SUNOS__) - // dialup device under SunOS/Solaris - rc = strstr(output,"ipdptp") != (char *)NULL; + // dialup device under SunOS/Solaris + hasModem = strstr(output,"ipdptp") != (char *)NULL; + hasLAN = strstr(output, "hme") != (char *)NULL; #elif defined(__LINUX__) || defined (__FREEBSD__) - rc = strstr(output,"ppp") // ppp - || strstr(output,"sl") // slip - || strstr(output,"pl"); // plip + hasModem = strstr(output,"ppp") // ppp + || strstr(output,"sl") // slip + || strstr(output,"pl"); // plip + hasLAN = strstr(output, "eth") != NULL; #elif defined(__SGI__) // IRIX - rc = (int) strstr(output, "ppp"); // PPP + hasModem = strstr(output, "ppp") != NULL; // PPP #elif defined(__HPUX__) - // if could run ifconfig on interface, then it exists - rc = TRUE; + // if could run ifconfig on interface, then it exists + hasModem = TRUE; #endif + + netDevice = NetDevice_None; + if ( hasModem ) + netDevice |= NetDevice_Modem; + if ( hasLAN ) + netDevice |= NetDevice_LAN; + } + //else: error reading the file } - file.Close(); - delete [] output; - } - // else rc remains -1 as we don't know for sure - } - else // could not run ifconfig correctly - m_CanUseIfconfig = 0; // don´t try again - (void) wxRemoveFile(tmpfile); - } + //else: error opening the file + } + else // could not run ifconfig correctly + { + m_CanUseIfconfig = 0; // don´t try again + } - return rc; + (void) wxRemoveFile(tmpfile); + } + + return netDevice; } -int -wxDialUpManagerImpl::CheckPing(void) +wxDialUpManagerImpl::NetConnection wxDialUpManagerImpl::CheckPing() { - if(! m_CanUsePing) - return -1; - // First time check for ping location. We only use the variant // which does not take arguments, a la GNU. if(m_CanUsePing == -1) // unknown @@ -639,10 +757,15 @@ wxDialUpManagerImpl::CheckPing(void) if(! m_PingPath) { m_CanUsePing = 0; - return -1; } } + if(! m_CanUsePing) + { + // we didn't find ping + return Net_Unknown; + } + wxLogNull ln; // suppress all error messages wxASSERT(m_PingPath.length()); wxString cmd; @@ -656,18 +779,17 @@ wxDialUpManagerImpl::CheckPing(void) #else # pragma warning "No Ping information for this OS." m_CanUsePing = 0; - return -1; + return Net_Unknown; #endif cmd << m_BeaconHost; if(wxExecute(cmd, TRUE /* sync */) == 0) - return 1; + return Net_Connected; else - return 0; + return Net_No; } /* static */ -wxDialUpManager * -wxDialUpManager::Create(void) +wxDialUpManager *wxDialUpManager::Create() { return new wxDialUpManagerImpl; } diff --git a/src/unix/gsocket.c b/src/unix/gsocket.c index 9fa98f1f47..3aa289c473 100644 --- a/src/unix/gsocket.c +++ b/src/unix/gsocket.c @@ -351,7 +351,6 @@ GAddress *GSocket_GetPeer(GSocket *socket) */ GSocketError GSocket_SetServer(GSocket *sck) { - int type; int arg = 1; assert(sck != NULL); diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index e2a0e1d834..1b8cf25097 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -9,8 +9,16 @@ // Licence: wxWindows license (part of wxExtra library) ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "mimetype.h" +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#ifdef __GNUG__ + #pragma implementation "mimetype.h" #endif // for compilers that support precompilation, includes "wx.h". @@ -24,7 +32,7 @@ #include "wx/defs.h" #endif -#if (wxUSE_FILE && wxUSE_TEXTFILE) || defined(__WXMSW__) +#if wxUSE_FILE && wxUSE_TEXTFILE #ifndef WX_PRECOMP #include "wx/string.h" @@ -54,6 +62,22 @@ // in case we're compiling in non-GUI mode class WXDLLEXPORT wxIcon; +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// MIME code tracing mask +#define TRACE_MIME _T("mime") + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// there are some fields which we don't understand but for which we don't give +// warnings as we know that they're not important - this function is used to +// test for them +static bool IsKnownUnimportantField(const wxString& field); + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -876,15 +900,21 @@ wxFileTypeImpl::GetEntry(const wxFileType::MessageParameters& params) const // notice that an empty command would always succeed (it's ok) command = wxFileType::ExpandCommand(entry->GetTestCmd(), params); - if ( command.IsEmpty() || (wxSystem(command) == 0) ) { - // ok, passed - wxLogTrace(wxT("Test '%s' for mime type '%s' succeeded."), - command.c_str(), params.GetMimeType().c_str()); - break; - } - else { - wxLogTrace(wxT("Test '%s' for mime type '%s' failed."), - command.c_str(), params.GetMimeType().c_str()); + // suppress the command output + if ( !command.IsEmpty() ) + { + if ( wxSystem(command) == 0 ) { + // ok, passed + wxLogTrace(TRACE_MIME, + wxT("Test '%s' for mime type '%s' succeeded."), + command.c_str(), params.GetMimeType().c_str()); + break; + } + else { + wxLogTrace(TRACE_MIME, + wxT("Test '%s' for mime type '%s' failed."), + command.c_str(), params.GetMimeType().c_str()); + } } entry = entry->GetNext(); @@ -1189,7 +1219,8 @@ void wxMimeTypesManagerImpl::AddMailcapInfo(const wxString& strType, bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName) { - wxLogTrace(wxT("--- Parsing mime.types file '%s' ---"), strFileName.c_str()); + wxLogTrace(TRACE_MIME, wxT("--- Parsing mime.types file '%s' ---"), + strFileName.c_str()); wxTextFile file(strFileName); if ( !file.Open() ) @@ -1345,7 +1376,8 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName) bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName, bool fallback) { - wxLogTrace(wxT("--- Parsing mailcap file '%s' ---"), strFileName.c_str()); + wxLogTrace(TRACE_MIME, wxT("--- Parsing mailcap file '%s' ---"), + strFileName.c_str()); wxTextFile file(strFileName); if ( !file.Open() ) @@ -1495,10 +1527,7 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName, if ( !ok ) { - // we don't understand this field, but - // Netscape stores info in it, so don't warn - // about it - if ( curField.Left(16u) != "x-mozilla-flags=" ) + if ( !IsKnownUnimportantField(curField) ) { // don't flood the user with error // messages if we don't understand @@ -1638,6 +1667,29 @@ size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes) return mimetypes.GetCount(); } +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +static bool IsKnownUnimportantField(const wxString& fieldAll) +{ + static const wxChar *knownFields[] = + { + _T("x-mozilla-flags"), + _T("nametemplate"), + _T("textualnewlines"), + }; + + wxString field = fieldAll.BeforeFirst(_T('=')); + for ( size_t n = 0; n < WXSIZEOF(knownFields); n++ ) + { + if ( field.CmpNoCase(knownFields[n]) == 0 ) + return TRUE; + } + + return FALSE; +} + #endif // wxUSE_FILE && wxUSE_TEXTFILE diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 49067b4d82..dcd14f6e79 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -32,6 +32,12 @@ #include "wx/unix/execute.h" #endif +// SGI signal.h defines signal handler arguments differently depending on +// whether _LANGUAGE_C_PLUS_PLUS is set or not - do set it +#if defined(__SGI__) && !defined(_LANGUAGE_C_PLUS_PLUS) + #define _LANGUAGE_C_PLUS_PLUS 1 +#endif // SGI hack + #include <stdarg.h> #include <dirent.h> #include <string.h> @@ -397,7 +403,11 @@ long wxExecute(wxChar **argv, bool sync, wxProcess *process) { - wxCHECK_MSG( *argv, 0, wxT("can't exec empty command") ); + // for the sync execution, we return -1 to indicate failure, but for async + // cse we return 0 which is never a valid PID + long errorRetCode = sync ? -1 : 0; + + wxCHECK_MSG( *argv, errorRetCode, wxT("can't exec empty command") ); #if wxUSE_UNICODE int mb_argc = 0; @@ -432,18 +442,22 @@ long wxExecute(wxChar **argv, ARGS_CLEANUP; - return 0; + return errorRetCode; } #endif // wxUSE_GUI - int pipeIn[2]; - int pipeOut[2]; + // pipes for inter process communication + int pipeIn[2], // stdin + pipeOut[2], // stdout + pipeErr[2]; // stderr + pipeIn[0] = pipeIn[1] = - pipeOut[0] = pipeOut[1] = -1; + pipeOut[0] = pipeOut[1] = + pipeErr[0] = pipeErr[1] = -1; if ( process && process->IsRedirected() ) { - if ( pipe(pipeIn) == -1 || pipe(pipeOut) == -1 ) + if ( pipe(pipeIn) == -1 || pipe(pipeOut) == -1 || pipe(pipeErr) == -1 ) { #if wxUSE_GUI // free previously allocated resources @@ -456,7 +470,7 @@ long wxExecute(wxChar **argv, ARGS_CLEANUP; - return 0; + return errorRetCode; } } @@ -476,13 +490,15 @@ long wxExecute(wxChar **argv, close(pipeIn[1]); close(pipeOut[0]); close(pipeOut[1]); + close(pipeErr[0]); + close(pipeErr[1]); #endif // wxUSE_GUI wxLogSysError( _("Fork failed") ); ARGS_CLEANUP; - return 0; + return errorRetCode; } else if ( pid == 0 ) // we're in child { @@ -498,7 +514,7 @@ long wxExecute(wxChar **argv, { for ( int fd = 0; fd < FD_SETSIZE; fd++ ) { - if ( fd == pipeIn[0] || fd == pipeOut[1] + if ( fd == pipeIn[0] || fd == pipeOut[1] || fd == pipeErr[1] #if wxUSE_GUI || fd == end_proc_detect[1] #endif // wxUSE_GUI @@ -514,19 +530,19 @@ long wxExecute(wxChar **argv, } } - // redirect stdio and stdout - // (TODO: what about stderr?) + // redirect stdio, stdout and stderr if ( pipeIn[0] != -1 ) { if ( dup2(pipeIn[0], STDIN_FILENO) == -1 || - dup2(pipeOut[1], STDOUT_FILENO) == -1 ) + dup2(pipeOut[1], STDOUT_FILENO) == -1 || + dup2(pipeErr[1], STDERR_FILENO) == -1 ) { - wxLogSysError(_("Failed to redirect child process " - "input/output")); + wxLogSysError(_("Failed to redirect child process input/output")); } close(pipeIn[0]); close(pipeOut[1]); + close(pipeErr[1]); } execvp (*mb_argv, mb_argv); @@ -544,10 +560,13 @@ long wxExecute(wxChar **argv, // These two streams are relative to this process. wxOutputStream *outStream = new wxProcessFileOutputStream(pipeIn[1]); wxInputStream *inStream = new wxProcessFileInputStream(pipeOut[0]); + wxInputStream *errStream = new wxProcessFileInputStream(pipeErr[0]); + close(pipeIn[0]); // close reading side close(pipeOut[1]); // close writing side + close(pipeErr[1]); // close writing side - process->SetPipeStreams(inStream, outStream); + process->SetPipeStreams(inStream, outStream, errStream); } #if wxUSE_GUI @@ -603,12 +622,10 @@ long wxExecute(wxChar **argv, return exitcode; #endif // wxUSE_GUI } - - return 0; - - #undef ARGS_CLEANUP } +#undef ARGS_CLEANUP + // ---------------------------------------------------------------------------- // file and directory functions // ---------------------------------------------------------------------------- @@ -848,7 +865,7 @@ long wxGetFreeMemory() #include <signal.h> -static void wxFatalSignalHandler(int WXUNUSED(signal)) +static void wxFatalSignalHandler(wxTYPE_SA_HANDLER) { if ( wxTheApp ) { diff --git a/src/wxWin.icc b/src/wxWin.icc index 011b8eb501..2d60341ff1 100644 --- a/src/wxWin.icc +++ b/src/wxWin.icc @@ -16,6 +16,8 @@ option ProjectOptions = gen(arch, "pentium2"), lang(longlong, "yes"), gen(mangl perform { run before '-mkdir ' '..\\src\\common\\dbgos240' + run before 'copy ' '..\\src\common\\dosyacc.c ' '..\\src\\common\\y_tab.c' + run before 'copy ' '..\\src\common\\doslex.c ' '..\\src\\common\\lex_yy.c' } target type("lib") "..\\LIB\\wx40.lib" { diff --git a/src/wxvc.dsp b/src/wxvc.dsp index 039bfb973e..3f70598deb 100644 --- a/src/wxvc.dsp +++ b/src/wxvc.dsp @@ -552,6 +552,10 @@ SOURCE=.\generic\panelg.cpp # End Source File # Begin Source File +SOURCE=.\generic\plot.cpp +# End Source File +# Begin Source File + SOURCE=.\generic\progdlgg.cpp # End Source File # Begin Source File @@ -883,6 +887,10 @@ SOURCE=.\msw\gsockmsw.c # End Source File # Begin Source File +SOURCE=.\msw\helpchm.cpp +# End Source File +# Begin Source File + SOURCE=.\msw\helpwin.cpp # End Source File # Begin Source File diff --git a/src/wxvc.dsw b/src/wxvc.dsw index f23cbe7897..cca7eb869f 100644 --- a/src/wxvc.dsw +++ b/src/wxvc.dsw @@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### -Project: "jpeg"=.\jpeg\jpeg.dsp - Package Owner=<4> +Project: "jpeg"=.\jpeg\JpegVC.dsp - Package Owner=<4> Package=<5> {{{ @@ -15,7 +15,7 @@ Package=<4> ############################################################################### -Project: "png"=.\png\png.dsp - Package Owner=<4> +Project: "png"=.\png\PngVC.dsp - Package Owner=<4> Package=<5> {{{ @@ -27,7 +27,7 @@ Package=<4> ############################################################################### -Project: "tiff"=.\tiff\tiff.dsp - Package Owner=<4> +Project: "tiff"=.\tiff\TiffVC.dsp - Package Owner=<4> Package=<5> {{{ @@ -66,7 +66,7 @@ Package=<4> ############################################################################### -Project: "xpm"=.\xpm\xpm.dsp - Package Owner=<4> +Project: "xpm"=.\xpm\XpmVC.dsp - Package Owner=<4> Package=<5> {{{ @@ -78,7 +78,7 @@ Package=<4> ############################################################################### -Project: "zlib"=.\zlib\zlib.dsp - Package Owner=<4> +Project: "zlib"=.\zlib\ZlibVC.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/src/wxvc_dll.dsp b/src/wxvc_dll.dsp index add461b25a..e9d08a82d0 100644 --- a/src/wxvc_dll.dsp +++ b/src/wxvc_dll.dsp @@ -69,7 +69,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXMAKINGDLL=1 /Yu"wx/wxprec.h" /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXMAKINGDLL=1 /Yu"wx/wxprec.h" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x809 /d "_DEBUG" @@ -554,6 +554,10 @@ SOURCE=.\generic\panelg.cpp # End Source File # Begin Source File +SOURCE=.\generic\plot.cpp +# End Source File +# Begin Source File + SOURCE=.\generic\progdlgg.cpp # End Source File # Begin Source File @@ -885,6 +889,10 @@ SOURCE=.\msw\gsockmsw.c # End Source File # Begin Source File +SOURCE=.\msw\helpchm.cpp +# End Source File +# Begin Source File + SOURCE=.\msw\helpwin.cpp # End Source File # Begin Source File @@ -1416,7 +1424,7 @@ SOURCE=.\jpeg\jcapimin.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1433,7 +1441,7 @@ SOURCE=.\jpeg\jcapistd.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1450,7 +1458,7 @@ SOURCE=.\jpeg\jccoefct.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1467,7 +1475,7 @@ SOURCE=.\jpeg\jccolor.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1484,7 +1492,7 @@ SOURCE=.\jpeg\jcdctmgr.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1501,7 +1509,7 @@ SOURCE=.\jpeg\jchuff.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1518,7 +1526,7 @@ SOURCE=.\jpeg\jcinit.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1535,7 +1543,7 @@ SOURCE=.\jpeg\jcmainct.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1552,7 +1560,7 @@ SOURCE=.\jpeg\jcmarker.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1569,7 +1577,7 @@ SOURCE=.\jpeg\jcmaster.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1586,7 +1594,7 @@ SOURCE=.\jpeg\jcomapi.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1603,7 +1611,7 @@ SOURCE=.\jpeg\jcparam.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1620,7 +1628,7 @@ SOURCE=.\jpeg\jcphuff.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1637,7 +1645,7 @@ SOURCE=.\jpeg\jcprepct.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1654,7 +1662,7 @@ SOURCE=.\jpeg\jcsample.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1671,7 +1679,7 @@ SOURCE=.\jpeg\jctrans.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1688,7 +1696,7 @@ SOURCE=.\jpeg\jdapimin.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1705,7 +1713,7 @@ SOURCE=.\jpeg\jdapistd.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1722,7 +1730,7 @@ SOURCE=.\jpeg\jdatadst.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1739,7 +1747,7 @@ SOURCE=.\jpeg\jdatasrc.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1756,7 +1764,7 @@ SOURCE=.\jpeg\jdcoefct.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1773,7 +1781,7 @@ SOURCE=.\jpeg\jdcolor.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1790,7 +1798,7 @@ SOURCE=.\jpeg\jddctmgr.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1807,7 +1815,7 @@ SOURCE=.\jpeg\jdhuff.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1824,7 +1832,7 @@ SOURCE=.\jpeg\jdinput.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1841,7 +1849,7 @@ SOURCE=.\jpeg\jdmainct.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1858,7 +1866,7 @@ SOURCE=.\jpeg\jdmarker.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1875,7 +1883,7 @@ SOURCE=.\jpeg\jdmaster.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1892,7 +1900,7 @@ SOURCE=.\jpeg\jdmerge.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1909,7 +1917,7 @@ SOURCE=.\jpeg\jdphuff.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1926,7 +1934,7 @@ SOURCE=.\jpeg\jdpostct.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1943,7 +1951,7 @@ SOURCE=.\jpeg\jdsample.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1960,7 +1968,7 @@ SOURCE=.\jpeg\jdtrans.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1977,7 +1985,7 @@ SOURCE=.\jpeg\jerror.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -1994,7 +2002,7 @@ SOURCE=.\jpeg\jfdctflt.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2011,7 +2019,7 @@ SOURCE=.\jpeg\jfdctfst.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2028,7 +2036,7 @@ SOURCE=.\jpeg\jfdctint.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2045,7 +2053,7 @@ SOURCE=.\jpeg\jidctflt.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2062,7 +2070,7 @@ SOURCE=.\jpeg\jidctfst.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2079,7 +2087,7 @@ SOURCE=.\jpeg\jidctint.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2096,7 +2104,7 @@ SOURCE=.\jpeg\jidctred.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2113,7 +2121,7 @@ SOURCE=.\jpeg\jmemmgr.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2130,7 +2138,7 @@ SOURCE=.\jpeg\jmemnobs.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2147,7 +2155,7 @@ SOURCE=.\jpeg\jquant1.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2164,7 +2172,7 @@ SOURCE=.\jpeg\jquant2.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF @@ -2181,7 +2189,7 @@ SOURCE=.\jpeg\jutils.c !ELSEIF "$(CFG)" == "wxvc_dll - Win32 Debug" -# ADD CPP /I ".." +# ADD CPP /Zi /I ".." # SUBTRACT CPP /YX /Yc /Yu !ENDIF diff --git a/src/xpm/attrib.c b/src/xpm/Attrib.c similarity index 99% rename from src/xpm/attrib.c rename to src/xpm/Attrib.c index fce8eca394..dafaec219f 100644 --- a/src/xpm/attrib.c +++ b/src/xpm/Attrib.c @@ -141,7 +141,7 @@ XpmFreeExtensions(extensions, nextensions) char **sptr; if (extensions) { - for (i = 0, ext = extensions; i < nextensions; i++, ext++) { + for (i = 0, ext = extensions; i < (unsigned)nextensions; i++, ext++) { if (ext->name) XpmFree(ext->name); nlines = ext->nlines; diff --git a/src/xpm/crbuffri.c b/src/xpm/CrBufFrI.c similarity index 100% rename from src/xpm/crbuffri.c rename to src/xpm/CrBufFrI.c diff --git a/src/xpm/crdatfri.c b/src/xpm/CrDatFrI.c similarity index 100% rename from src/xpm/crdatfri.c rename to src/xpm/CrDatFrI.c diff --git a/src/xpm/crifrbuf.c b/src/xpm/CrIFrBuf.c similarity index 100% rename from src/xpm/crifrbuf.c rename to src/xpm/CrIFrBuf.c diff --git a/src/xpm/crifrdat.c b/src/xpm/CrIFrDat.c similarity index 100% rename from src/xpm/crifrdat.c rename to src/xpm/CrIFrDat.c diff --git a/src/xpm/image.c b/src/xpm/Image.c similarity index 100% rename from src/xpm/image.c rename to src/xpm/Image.c diff --git a/src/xpm/info.c b/src/xpm/Info.c similarity index 100% rename from src/xpm/info.c rename to src/xpm/Info.c diff --git a/src/xpm/rdftodat.c b/src/xpm/RdFToDat.c similarity index 100% rename from src/xpm/rdftodat.c rename to src/xpm/RdFToDat.c diff --git a/src/xpm/rdftoi.c b/src/xpm/RdFToI.c similarity index 100% rename from src/xpm/rdftoi.c rename to src/xpm/RdFToI.c diff --git a/src/xpm/wrffrdat.c b/src/xpm/WrFFrDat.c similarity index 100% rename from src/xpm/wrffrdat.c rename to src/xpm/WrFFrDat.c diff --git a/src/xpm/wrffri.c b/src/xpm/WrFFrI.c similarity index 100% rename from src/xpm/wrffri.c rename to src/xpm/WrFFrI.c diff --git a/src/xpm/xpmi.h b/src/xpm/XpmI.h similarity index 100% rename from src/xpm/xpmi.h rename to src/xpm/XpmI.h diff --git a/src/xpm/XpmVC.dsp b/src/xpm/XpmVC.dsp new file mode 100644 index 0000000000..3cd176618c --- /dev/null +++ b/src/xpm/XpmVC.dsp @@ -0,0 +1,186 @@ +# Microsoft Developer Studio Project File - Name="xpm" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=xpm - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "xpm.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "xpm.mak" CFG="xpm - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "xpm - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "xpm - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "xpm - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"..\..\lib\xpm.lib" + +!ELSEIF "$(CFG)" == "xpm - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "xpm___Win32_Debug" +# PROP BASE Intermediate_Dir "xpm___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"..\..\lib\xpmd.lib" + +!ENDIF + +# Begin Target + +# Name "xpm - Win32 Release" +# Name "xpm - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\attrib.c +# End Source File +# Begin Source File + +SOURCE=.\crbuffri.c +# End Source File +# Begin Source File + +SOURCE=.\crdatfri.c +# End Source File +# Begin Source File + +SOURCE=.\create.c +# End Source File +# Begin Source File + +SOURCE=.\crifrbuf.c +# End Source File +# Begin Source File + +SOURCE=.\crifrdat.c +# End Source File +# Begin Source File + +SOURCE=.\dataxpm.c +# End Source File +# Begin Source File + +SOURCE=.\hashtab.c +# End Source File +# Begin Source File + +SOURCE=.\imagexpm.c +# End Source File +# Begin Source File + +SOURCE=.\info.c +# End Source File +# Begin Source File + +SOURCE=.\misc.c +# End Source File +# Begin Source File + +SOURCE=.\parse.c +# End Source File +# Begin Source File + +SOURCE=.\rdftodat.c +# End Source File +# Begin Source File + +SOURCE=.\rdftoi.c +# End Source File +# Begin Source File + +SOURCE=.\rgb.c +# End Source File +# Begin Source File + +SOURCE=.\scan.c +# End Source File +# Begin Source File + +SOURCE=.\simx.c +# End Source File +# Begin Source File + +SOURCE=.\wrffrdat.c +# End Source File +# Begin Source File + +SOURCE=.\wrffri.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\rgbtab.h +# End Source File +# Begin Source File + +SOURCE=.\simx.h +# End Source File +# Begin Source File + +SOURCE=.\xpm.h +# End Source File +# Begin Source File + +SOURCE=.\xpmi.h +# End Source File +# End Group +# End Target +# End Project diff --git a/src/xpm/xpm.dsw b/src/xpm/XpmVC.dsw similarity index 90% rename from src/xpm/xpm.dsw rename to src/xpm/XpmVC.dsw index f87f390374..270daf62c1 100644 --- a/src/xpm/xpm.dsw +++ b/src/xpm/XpmVC.dsw @@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### -Project: "xpm"=.\xpm.dsp - Package Owner=<4> +Project: "xpm"=.\XpmVC.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/src/xpm/makefile.b32 b/src/xpm/makefile.b32 index 810c189353..c912cd6456 100644 --- a/src/xpm/makefile.b32 +++ b/src/xpm/makefile.b32 @@ -9,3 +9,10 @@ OBJECTS = attrib.obj crbuffri.obj crdatfri.obj create.obj crifrbuf.obj crifrdat. rdftodat.obj rdftoi.obj rgb.obj scan.obj simx.obj wrffrdat.obj wrffri.obj !include $(WXWIN)\src\makelib.b32 + +create.obj: create.c + bcc32 $(CPPFLAGS) -Od -P- -c create.c + +rgb.obj: rgb.c + bcc32 $(CPPFLAGS) -Od -P- -c rgb.c + diff --git a/src/xpm/scan.c b/src/xpm/scan.c index c4ee723280..8660ff99ed 100644 --- a/src/xpm/scan.c +++ b/src/xpm/scan.c @@ -506,7 +506,7 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes) return (XpmNoMemory); for (i = 0, i2 = mask, color = colors, xcolor = xcolors; - i < ncolors; i++, i2++, color++, xcolor++, pixels++) { + i < (unsigned)ncolors; i++, i2++, color++, xcolor++, pixels++) { if (!(s = color->string = (char *) XpmMalloc(cpp + 1))) { XpmFree(xcolors); @@ -549,7 +549,7 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes) } /* end 3.2 bc */ - for (i = 0, color = colors, xcolor = xcolors; i < ncolors; + for (i = 0, color = colors, xcolor = xcolors; i < (unsigned)ncolors; i++, color++, xcolor++) { /* look for related info from the attributes if any */ diff --git a/src/xpm/simx.c b/src/xpm/simx.c index 04714849bf..1b648a7ee4 100644 --- a/src/xpm/simx.c +++ b/src/xpm/simx.c @@ -38,7 +38,7 @@ #ifdef FOR_MSW -#include "xpmi.h" /* for XpmMalloc */ +#include "XpmI.h" /* for XpmMalloc */ /* * On DOS size_t is only 2 bytes, thus malloc(size_t s) can only malloc diff --git a/src/xpm/xpm.dsp b/src/xpm/xpm.dsp index 3cd176618c..07451438e5 100644 --- a/src/xpm/xpm.dsp +++ b/src/xpm/xpm.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c +# ADD CPP /nologo /MD /W3 /GX- /O1 /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" @@ -50,7 +50,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\lib\xpm.lib" +# ADD LIB32 /nologo !ELSEIF "$(CFG)" == "xpm - Win32 Debug" @@ -65,7 +65,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX- /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" @@ -74,7 +74,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\lib\xpmd.lib" +# ADD LIB32 /nologo !ENDIF diff --git a/src/zlib/zlib.dsp b/src/zlib/ZlibVC.dsp similarity index 100% rename from src/zlib/zlib.dsp rename to src/zlib/ZlibVC.dsp diff --git a/src/zlib/ZlibVC.dsw b/src/zlib/ZlibVC.dsw new file mode 100644 index 0000000000..de32c7cf3a --- /dev/null +++ b/src/zlib/ZlibVC.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "zlib"=.\ZlibVC.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/src/zlib/zlib.dsw b/src/zlib/zlib.dsw deleted file mode 100644 index fae86d6c51..0000000000 --- a/src/zlib/zlib.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "zlib"=.\zlib.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/utils/HelpGen/src/HelpGen.cpp b/utils/HelpGen/src/HelpGen.cpp index 97ee2dcf7a..ddbc120135 100644 --- a/utils/HelpGen/src/HelpGen.cpp +++ b/utils/HelpGen/src/HelpGen.cpp @@ -436,10 +436,10 @@ private: static void usage() { wxString prog = g_argv[0]; - wxString basename = prog.BeforeLast('/'); + wxString basename = prog.AfterLast('/'); #ifdef __WXMSW__ if ( !basename ) - basename = prog.BeforeLast('\\'); + basename = prog.AfterLast('\\'); #endif if ( !basename ) basename = prog; @@ -788,7 +788,7 @@ void HelpGenVisitor::VisitClass( spClass& cl ) // the file name is built from the class name by removing the leading "wx" // if any and converting it to the lower case - wxString filename = m_directoryOut; + wxString filename; if ( name(0, 2) == "wx" ) { filename << name.c_str() + 2; } @@ -798,6 +798,7 @@ void HelpGenVisitor::VisitClass( spClass& cl ) filename.MakeLower(); filename += ".tex"; + filename.Prepend(m_directoryOut); if ( !m_overwrite && wxFile::Exists(filename) ) { wxLogError("Won't overwrite existing file '%s' - please use '-f'.", @@ -1938,6 +1939,12 @@ static const char *GetCurrentTime(const char *timeFormat) /* $Log$ + Revision 1.11 2000/07/15 19:50:42 cvsuser + merged 2.2 branch + + Revision 1.10.2.2 2000/03/27 15:33:10 VZ + don't trasnform output dir name to lower case + Revision 1.10 2000/03/11 10:05:23 VS now compiles with wxBase diff --git a/utils/wxPython/demo/bitmaps/copy.bmp b/utils/Install/builder/bitmaps/copy.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/copy.bmp rename to utils/Install/builder/bitmaps/copy.bmp diff --git a/utils/Install/builder/bitmaps/copy.xpm b/utils/Install/builder/bitmaps/copy.xpm new file mode 100644 index 0000000000..47565c1cae --- /dev/null +++ b/utils/Install/builder/bitmaps/copy.xpm @@ -0,0 +1,25 @@ +/* XPM */ +static char *copy_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 4 1", +" c None", +". c Black", +"X c Gray100", +"o c #000080", +/* pixels */ +" ", +" ...... ", +" .XXXX.. ", +" .XXXX.X. ", +" .X..X.oooooo ", +" .XXXXXoXXXXoo ", +" .X....oXXXXoXo ", +" .XXXXXoX..Xoooo", +" .X....oXXXXXXXo", +" .XXXXXoX.....Xo", +" ......oXXXXXXXo", +" oX.....Xo", +" oXXXXXXXo", +" ooooooooo", +" " +}; diff --git a/utils/Install/builder/bitmaps/cut.bmp b/utils/Install/builder/bitmaps/cut.bmp new file mode 100644 index 0000000000000000000000000000000000000000..15554338a01bc4d8f0a501c32237e84200e64583 GIT binary patch literal 238 zcmZvU!3}^Q5Cqr6gr}Ba8OD(CvKJo2^+{<|WDB@(K8*2TclNjo+kV075Ef~cCTYMZ z2hQ$)mH}PlY>+FWlp?l4?H9GSB<Zv#8R^+8F{Gd*hV&x6^<?mEPOb*V-jQ$?oH06m Ls*2CTm$rNZbQeh3 literal 0 HcmV?d00001 diff --git a/utils/Install/builder/bitmaps/cut.xpm b/utils/Install/builder/bitmaps/cut.xpm new file mode 100644 index 0000000000..bfe7e95cea --- /dev/null +++ b/utils/Install/builder/bitmaps/cut.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *cut_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 3 1", +" c None", +". c Black", +"X c #000080", +/* pixels */ +" ", +" . . ", +" . . ", +" . . ", +" .. .. ", +" . . ", +" ... ", +" . ", +" X.X ", +" X XXX ", +" XXX X X ", +" X X X X ", +" X X X X ", +" X X XX ", +" XX " +}; diff --git a/utils/Install/builder/bitmaps/help.bmp b/utils/Install/builder/bitmaps/help.bmp new file mode 100644 index 0000000000000000000000000000000000000000..2d9e6922cac0fb0aefa32fd5bae9d460e13484b9 GIT binary patch literal 238 zcmZuq!3}^g2t1P}{g~(&&f(u(`VyZVjR87~E7Sw@p^<WTP{^@vCn9#rLd?WO3`k_) zaQ>qTFi~p=nI%+}YJ={H-mN0|?29BK#fUL#erbtT(lh^R?4vYy(d-6AGn1|j$rr}v KbDqI%Xjd+{i$y;G literal 0 HcmV?d00001 diff --git a/utils/Install/builder/bitmaps/help.xpm b/utils/Install/builder/bitmaps/help.xpm new file mode 100644 index 0000000000..50fdb4157e --- /dev/null +++ b/utils/Install/builder/bitmaps/help.xpm @@ -0,0 +1,25 @@ +/* XPM */ +static char *help_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 4 1", +" c None", +". c Black", +"X c Blue", +"o c #000080", +/* pixels */ +" ", +" ...... ", +" .XXXXX.. ", +" .XX...oX.. ", +" .X.. .X.. ", +" .X.. .XX.. ", +" .. .XX.. ", +" .XX.. ", +" .X.. ", +" .X.. ", +" .o.. ", +" .. ", +" .XX.. ", +" .XX.. ", +" ... " +}; diff --git a/utils/wxPython/demo/bitmaps/new.bmp b/utils/Install/builder/bitmaps/new.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/new.bmp rename to utils/Install/builder/bitmaps/new.bmp diff --git a/utils/Install/builder/bitmaps/new.xpm b/utils/Install/builder/bitmaps/new.xpm new file mode 100644 index 0000000000..754d2d20a2 --- /dev/null +++ b/utils/Install/builder/bitmaps/new.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *new_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 3 1", +" c None", +". c Black", +"X c Gray100", +/* pixels */ +" ", +" ........ ", +" .XXXXXX.. ", +" .XXXXXX.X. ", +" .XXXXXX.... ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" .XXXXXXXXX. ", +" ........... ", +" " +}; diff --git a/utils/Install/builder/bitmaps/open.bmp b/utils/Install/builder/bitmaps/open.bmp new file mode 100644 index 0000000000000000000000000000000000000000..bbf93fe03364e63f3e18a3507a0e85ab8ea2f87d GIT binary patch literal 238 zcmXv{u@M3>3=;=;U&0ua+_3>YyQsonW~6N3OvKTr2(k@|B{{YeKb~(CUb3rr5zpcQ zCn>O}mP9XDa6kd~GO1FGG0<95V`X5i$V8neN$dxz4&8XX3!AZr-;ApY^eS-9oTLj~ Y^Hcc9z2|$wrXTtLH=Rc2n(WoWFRhqJ00000 literal 0 HcmV?d00001 diff --git a/utils/Install/builder/bitmaps/open.xpm b/utils/Install/builder/bitmaps/open.xpm new file mode 100644 index 0000000000..54748e910d --- /dev/null +++ b/utils/Install/builder/bitmaps/open.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *open_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 5 1", +" c None", +". c Black", +"X c Yellow", +"o c Gray100", +"O c #bfbf00", +/* pixels */ +" ", +" ... ", +" . . .", +" ..", +" ... ...", +" .XoX....... ", +" .oXoXoXoXo. ", +" .XoXoXoXoX. ", +" .oXoX..........", +" .XoX.OOOOOOOOO.", +" .oo.OOOOOOOOO. ", +" .X.OOOOOOOOO. ", +" ..OOOOOOOOO. ", +" ........... ", +" " +}; diff --git a/utils/Install/builder/bitmaps/page.bmp b/utils/Install/builder/bitmaps/page.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3dbd4b05b4c2d1a4f046141d450caf34c1a3d470 GIT binary patch literal 714 zcmaJ<yK(|C3=}&akA_J>k)fu{chJ-2TT-iZmtVS?uc5roS;-EuD8k*^vaH9hj_d6X ziQgC358^U$kRpEdIqzx8X~Jz0i&xCtBKWwA%eHOw^mwIrw+KG&;&N&1L*Q{1Xmx8p zxBo0O*pac2@{B`!>-fgLdSDP(C2}M>_DcBv60g*0UKyHhy!Oc8UYD-XBeIyOWTry_ zTA4Yuua#<WV)ewm1Q&LQE^GWR8&?uYJ!S@V4|X|IBWGo+Q}yZ_3hJnzs=ESWFG&H+ zmHM1YisnS0Gs-+-nm(PEsm}UoqJLlh)YzRFW1fEU@2>Ixm?vFMcI3@F*>XSp02Lyo AJ^%m! literal 0 HcmV?d00001 diff --git a/utils/wxPython/demo/bitmaps/paste.bmp b/utils/Install/builder/bitmaps/paste.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/paste.bmp rename to utils/Install/builder/bitmaps/paste.bmp diff --git a/utils/Install/builder/bitmaps/preview.bmp b/utils/Install/builder/bitmaps/preview.bmp new file mode 100644 index 0000000000000000000000000000000000000000..da1f4dbc4be6c2dd8fb9d7cb71cc48a4a7c139ca GIT binary patch literal 238 zcmZvVu?@p83<Tdm0IGAw$Q<dji>pv2yNo4mlT?N_pr2ISnd1NHDM5O^cFcMc59&^> z)PfrwsOeYM05)2ipmU4fJIss+o(=cdQCu+!%TlZiKDH!a!aP2;C|UGpLD9M;zmsLJ XIp;lzIUm!ckI6HO{IjaYcZ_-fA4^nl literal 0 HcmV?d00001 diff --git a/utils/Install/builder/bitmaps/preview.xpm b/utils/Install/builder/bitmaps/preview.xpm new file mode 100644 index 0000000000..7e5e9cd06e --- /dev/null +++ b/utils/Install/builder/bitmaps/preview.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *paste_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 5 1", +" c Black", +". c None", +"X c Gray100", +"o c #808080", +"O c Cyan", +/* pixels */ +" .......", +" XXXXXXX ......", +" XXXXXXX . .....", +" XXXXXXX ....", +" XXXXXXXXXX ....", +" XXXXXXX ....", +" XXXXXX o..o ...", +" XXXXX oOO.oo ..", +" XXXXX .O..o. ..", +" XXXXX ....o. ..", +" XXXXX o..Ooo ..", +" XXXXXX o..o o..", +" XXXXXXX o .", +" XXXXXXXXXX . ", +" .. " +}; diff --git a/utils/Install/builder/bitmaps/print.bmp b/utils/Install/builder/bitmaps/print.bmp new file mode 100644 index 0000000000000000000000000000000000000000..00319b55bb23c3c69cc051144d80e5275747c53e GIT binary patch literal 238 zcmZur!3_d23^Ni^o@EUFY`~vgA|YX<`*bfpod|V<Vy9oy#7<f}>izM>j+f}Fx~Q7! zgtHKM7yg3|DAD^Sp<0YF#C}+nSj(MC$5#Ss27*aN<{l9d<nf^z@_A!K$q=d8y3Dc# Z*tBKJm=l;@q<LATpSNNQY_h}diXX1oK79ZH literal 0 HcmV?d00001 diff --git a/utils/Install/builder/bitmaps/print.xpm b/utils/Install/builder/bitmaps/print.xpm new file mode 100644 index 0000000000..3c2e2be781 --- /dev/null +++ b/utils/Install/builder/bitmaps/print.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *print_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 5 1", +" c None", +". c Black", +"X c Gray100", +"o c #808000", +"O c Yellow", +/* pixels */ +" ", +" ......... ", +" .XXXXXXXX. ", +" .X.....X. ", +" .XXXXXXXX. ", +" .X.....X.... ", +" .XXXXXXXX. . .", +" .......... . ..", +". . . .", +"............. .", +". ooo . . ", +". OOO ... ", +"............. . ", +" . . . ", +" ........... " +}; diff --git a/utils/Install/builder/bitmaps/save.bmp b/utils/Install/builder/bitmaps/save.bmp new file mode 100644 index 0000000000000000000000000000000000000000..56dd10b6e3f05d26ba5a9e4c9a502d6278926a59 GIT binary patch literal 238 zcmaKlu?>YV3`7rs<PygCB@!FZvr8)S%SbGiiC7^#J1yekyR*+qvLClPPV5I4IKx2` zD*Z#>q)3!X>4ws(){6V0MX5FKAjcylGXqN-n#XsS=YhW0WogZT{L^_i_GT%*k@+ph E1NJ~MtpET3 literal 0 HcmV?d00001 diff --git a/utils/Install/builder/bitmaps/save.xpm b/utils/Install/builder/bitmaps/save.xpm new file mode 100644 index 0000000000..01b18f9340 --- /dev/null +++ b/utils/Install/builder/bitmaps/save.xpm @@ -0,0 +1,25 @@ +/* XPM */ +static char *save_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 4 1", +" c None", +". c Black", +"X c #808000", +"o c #808080", +/* pixels */ +" ", +" .............. ", +" .X. . . ", +" .X. ... ", +" .X. .X. ", +" .X. .X. ", +" .X. .X. ", +" .X. .X. ", +" .XX........oX. ", +" .XXXXXXXXXXXX. ", +" .XX.........X. ", +" .XX...... .X. ", +" .XX...... .X. ", +" .XX...... .X. ", +" ............. " +}; diff --git a/utils/Install/builder/makefile b/utils/Install/builder/makefile new file mode 100644 index 0000000000..b718b54009 --- /dev/null +++ b/utils/Install/builder/makefile @@ -0,0 +1,23 @@ +# Purpose: makefile for toolbar example (Unix) +# Created: 2000-03-14 + +CC = gcc + +PROGRAM = wxib + +OBJECTS = $(PROGRAM).o + +# implementation + +.SUFFIXES: .o .cpp + +.cpp.o : + $(CC) -c `wx-config --cflags` -o $@ $< + +all: $(PROGRAM) + +$(PROGRAM): $(OBJECTS) + $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs` + +clean: + rm -f *.o $(PROGRAM) diff --git a/utils/Install/builder/makefile.b32 b/utils/Install/builder/makefile.b32 new file mode 100644 index 0000000000..2f78f08cc2 --- /dev/null +++ b/utils/Install/builder/makefile.b32 @@ -0,0 +1,10 @@ +# Purpose: makefile for toolbar example (BC++ 32bit) +# Created: 2000-03-14 + +WXDIR = $(WXWIN) + +TARGET=wxib +OBJECTS = $(TARGET).obj + +!include $(WXDIR)\src\makeprog.b32 + diff --git a/utils/Install/builder/makefile.bcc b/utils/Install/builder/makefile.bcc new file mode 100644 index 0000000000..a622b7c6aa --- /dev/null +++ b/utils/Install/builder/makefile.bcc @@ -0,0 +1,14 @@ +# Purpose: makefile for toolbar example (BC++ 16bit) +# Created: 2000-03-14 + +!if "$(WXWIN)" == "" +!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx +!endif + +WXDIR = $(WXWIN) + +TARGET=toolbar +OBJECTS=$(TARGET).obj + +!include $(WXDIR)\src\makeprog.bcc + diff --git a/utils/Install/builder/makefile.dos b/utils/Install/builder/makefile.dos new file mode 100644 index 0000000000..bb6f8d0c48 --- /dev/null +++ b/utils/Install/builder/makefile.dos @@ -0,0 +1,10 @@ +# Purpose: makefile for toolbar example (VC++ 1.5x) +# Created: 2000-03-14 + +WXDIR = $(WXWIN) + +TARGET=toolbar +OBJECTS=$(TARGET).obj + +!include $(WXDIR)\src\makeprog.msc + diff --git a/utils/Install/builder/makefile.g95 b/utils/Install/builder/makefile.g95 new file mode 100644 index 0000000000..25bcc5b88a --- /dev/null +++ b/utils/Install/builder/makefile.g95 @@ -0,0 +1,10 @@ +# Purpose: makefile for toolbar example (Cygwin/Mingw32) +# Created: #03.01.00 + +WXDIR = ../.. + +TARGET=toolbar +OBJECTS = $(TARGET).o + +include $(WXDIR)\src\makeprog.g95 + diff --git a/utils/Install/builder/makefile.sc b/utils/Install/builder/makefile.sc new file mode 100644 index 0000000000..6de8e6893c --- /dev/null +++ b/utils/Install/builder/makefile.sc @@ -0,0 +1,37 @@ +# Purpose: makefile for toolbar example (Symantec C++) +# Created: 2000-03-14 + +WXDIR = $(WXWIN) +WXLIB = $(WXDIR)\lib\wx.lib +INCDIR = $(WXDIR)\include +INCLUDE=$(INCDIR) +TARGET=toolbar + +include $(WXDIR)\src\makesc.env + +toolbar.exe: toolbar.obj $(DEFFILE) toolbar.res + *$(CC) $(LDFLAGS) -o$@ $** $(LIBS) + *$(RC) -k toolbar.res + +sc32.def: + echo EXETYPE NT > sc32.def + echo SUBSYSTEM WINDOWS >> sc32.def + +sc16.def: + echo NAME $(TARGET) > sc16.def + echo EXETYPE WINDOWS >> sc16.def + echo STUB 'WINSTUB.EXE' >> sc16.def + echo CODE PRELOAD MOVEABLE DISCARDABLE >> sc16.def + echo DATA PRELOAD MOVEABLE MULTIPLE >> sc16.def + echo HEAPSIZE 1024 >> sc16.def + echo STACKSIZE 8192 >> sc16.def + +clean: + -del *.obj + -del *.exe + -del *.res + -del *.map + -del *.rws + -del sc32.def + -del sc16.def + diff --git a/utils/Install/builder/makefile.sl b/utils/Install/builder/makefile.sl new file mode 100644 index 0000000000..216b087cf2 --- /dev/null +++ b/utils/Install/builder/makefile.sl @@ -0,0 +1,14 @@ +# Purpose: makefile for toolbar example (Salford C++) +# Created: 2000-03-14 + +PROGRAM = toolbar +OBJECTS = $(PROGRAM).obj + +include ..\..\src\makeprog.sl + +all: wx $(TARGET) + +wx: + cd $(WXDIR)\src\msw ^ mk32 -f makefile.sl all + cd $(WXDIR)\samples\toolbar + diff --git a/utils/Install/builder/makefile.twn b/utils/Install/builder/makefile.twn new file mode 100644 index 0000000000..fd89e57b4b --- /dev/null +++ b/utils/Install/builder/makefile.twn @@ -0,0 +1,35 @@ +# Purpose: makefile for toolbar example (TWIN) +# Created: 2000-03-14 + +WXDIR = ../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/maketwin.env + +OBJECTS = $(OBJDIR)/toolbar.$(OBJSUFF) $(OBJDIR)/toolbar.$(OBJSUFF) + +all: $(OBJDIR) toolbar$(GUISUFFIX)$(EXESUFF) + +wx: + +$(OBJDIR): + mkdir $(OBJDIR) + +toolbar$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB) + $(CC) $(LDFLAGS) -o toolbar$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS) + +$(OBJDIR)/toolbar.$(OBJSUFF): toolbar.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ toolbar.$(SRCSUFF) + +toolbar.c: toolbar.rc + $(RESCOMP) $(RCINPUTSWITCH) toolbar.rc $(RCOUTPUTSWITCH) toolbar.c $(RESFLAGS) + +$(OBJDIR)/toolbar.$(OBJSUFF): toolbar.c + $(CC) -c $(CPPFLAGS) -o $@ toolbar.c + +#$(OBJDIR)/toolbar.o: toolbar.rc +# $(RESCOMP) $(RCINPUTSWITCH) toolbar.rc $(RCOUTPUTSWITCH) $(OBJDIR)/toolbar.o $(RESFLAGS) + +clean: + rm -f $(OBJECTS) toolbar$(GUISUFFIX).exe core *.rsc *.res diff --git a/utils/Install/builder/makefile.unx b/utils/Install/builder/makefile.unx new file mode 100644 index 0000000000..91d51a0bd1 --- /dev/null +++ b/utils/Install/builder/makefile.unx @@ -0,0 +1,23 @@ +# Purpose: makefile for toolbar example (Unix) +# Created: 2000-03-14 + +CC = gcc + +PROGRAM = toolbar + +OBJECTS = $(PROGRAM).o + +# implementation + +.SUFFIXES: .o .cpp + +.cpp.o : + $(CC) -c `wx-config --cflags` -o $@ $< + +all: $(PROGRAM) + +$(PROGRAM): $(OBJECTS) + $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs` + +clean: + rm -f *.o $(PROGRAM) diff --git a/utils/Install/builder/makefile.vc b/utils/Install/builder/makefile.vc new file mode 100644 index 0000000000..5c17461960 --- /dev/null +++ b/utils/Install/builder/makefile.vc @@ -0,0 +1,11 @@ +# Purpose: makefile for toolbar example (VC++ 32bit) +# Created: 2000-03-14 + +# Set WXDIR for your system +WXDIR = $(WXWIN) + +PROGRAM=wxib +OBJECTS = $(PROGRAM).obj + +!include $(WXDIR)\src\makeprog.vc + diff --git a/utils/Install/builder/makefile.wat b/utils/Install/builder/makefile.wat new file mode 100644 index 0000000000..95c26443ed --- /dev/null +++ b/utils/Install/builder/makefile.wat @@ -0,0 +1,11 @@ +# Purpose: makefile for toolbar example (Watcom) +# Created: 2000-03-14 + +WXDIR = $(%WXWIN) + +PROGRAM = toolbar +OBJECTS = $(PROGRAM).obj + +!include $(WXDIR)\src\makeprog.wat + + diff --git a/utils/wxPython/demo/bitmaps/mondrian.ico b/utils/Install/builder/mondrian.ico similarity index 100% rename from utils/wxPython/demo/bitmaps/mondrian.ico rename to utils/Install/builder/mondrian.ico diff --git a/utils/Install/builder/mondrian.xpm b/utils/Install/builder/mondrian.xpm new file mode 100644 index 0000000000..409f27a843 --- /dev/null +++ b/utils/Install/builder/mondrian.xpm @@ -0,0 +1,44 @@ +/* XPM */ +static char *mondrian_xpm[] = { +/* columns rows colors chars-per-pixel */ +"32 32 6 1", +" c Black", +". c Blue", +"X c #00bf00", +"o c Red", +"O c Yellow", +"+ c Gray100", +/* pixels */ +" ", +" oooooo +++++++++++++++++++++++ ", +" oooooo +++++++++++++++++++++++ ", +" oooooo +++++++++++++++++++++++ ", +" oooooo +++++++++++++++++++++++ ", +" oooooo +++++++++++++++++++++++ ", +" oooooo +++++++++++++++++++++++ ", +" oooooo +++++++++++++++++++++++ ", +" ", +" ++++++ ++++++++++++++++++ .... ", +" ++++++ ++++++++++++++++++ .... ", +" ++++++ ++++++++++++++++++ .... ", +" ++++++ ++++++++++++++++++ .... ", +" ++++++ ++++++++++++++++++ .... ", +" ++++++ ++++++++++++++++++ ", +" ++++++ ++++++++++++++++++ ++++ ", +" ++++++ ++++++++++++++++++ ++++ ", +" ++++++ ++++++++++++++++++ ++++ ", +" ++++++ ++++++++++++++++++ ++++ ", +" ++++++ ++++++++++++++++++ ++++ ", +" ++++++ ++++++++++++++++++ ++++ ", +" ++++++ ++++++++++++++++++ ++++ ", +" ++++++ ++++++++++++++++++ ++++ ", +" ++++++ ++++++++++++++++++ ++++ ", +" ++++++ ++++ ", +" ++++++ OOOOOOOOOOOO XXXXX ++++ ", +" ++++++ OOOOOOOOOOOO XXXXX ++++ ", +" ++++++ OOOOOOOOOOOO XXXXX ++++ ", +" ++++++ OOOOOOOOOOOO XXXXX ++++ ", +" ++++++ OOOOOOOOOOOO XXXXX ++++ ", +" ++++++ OOOOOOOOOOOO XXXXX ++++ ", +" " +}; diff --git a/utils/Install/builder/wxib.cpp b/utils/Install/builder/wxib.cpp new file mode 100644 index 0000000000..73abbcaab9 --- /dev/null +++ b/utils/Install/builder/wxib.cpp @@ -0,0 +1,647 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wxib.cpp +// Purpose: wxInstall Builder +// Author: Julian Smart +// Author: Brian Smith +// Modified by: +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx/wx.h". +#include <wx/wxprec.h> + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include <wx/wx.h> +#endif + +#include <wx/toolbar.h> +#include <wx/log.h> +#include <wx/image.h> + +// define this to 1 to use wxToolBarSimple instead of the native one +#define USE_GENERIC_TBAR 0 + +#if USE_GENERIC_TBAR + #if !wxUSE_TOOLBAR_SIMPLE + #error wxToolBarSimple is not compiled in, set wxUSE_TOOLBAR_SIMPLE \ + to 1 in setup.h and recompile the library. + #else + #include <wx/tbarsmpl.h> + #endif +#endif // USE_GENERIC_TBAR + +// ---------------------------------------------------------------------------- +// resources +// ---------------------------------------------------------------------------- + +#if defined(__WXGTK__) || defined(__WXMOTIF__) + #include "mondrian.xpm" + #include "bitmaps/new.xpm" + #include "bitmaps/open.xpm" + #include "bitmaps/save.xpm" + #include "bitmaps/copy.xpm" + #include "bitmaps/cut.xpm" + #include "bitmaps/preview.xpm" // paste XPM + #include "bitmaps/print.xpm" + #include "bitmaps/help.xpm" +#endif // GTK or Motif + +char appName[] = "wxInstall Builder"; + +// ---------------------------------------------------------------------------- +// classes +// ---------------------------------------------------------------------------- + +// Define a new application +class MyApp : public wxApp +{ +public: + bool OnInit(); +}; + +// Define a new frame +class MyFrame: public wxFrame +{ +public: + MyFrame(wxFrame *parent, + wxWindowID id = -1, + const wxString& title = "wxInstall Builder", + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE); + + void RecreateToolbar(); + + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + + void OnNewScript(wxCommandEvent& event); + void OnOpenScript(wxCommandEvent& event); + void OnSaveScript(wxCommandEvent& event); + void OnNewProject(wxCommandEvent& event); + void OnOpenProject(wxCommandEvent& event); + void OnSaveProject(wxCommandEvent& event); + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + + void OnListBoxDoubleClick(wxCommandEvent& event); + +#if USE_GENERIC_TBAR + virtual wxToolBar *OnCreateToolBar(long style, + wxWindowID id, + const wxString& name ); +#endif // USE_GENERIC_TBAR + +private: + bool m_smallToolbar, + m_horzToolbar; + size_t m_rows; // 1 or 2 only + + wxTextCtrl* m_textWindow; + wxListBox* m_listBox; + + DECLARE_EVENT_TABLE() +}; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +const int ID_TOOLBAR = 500; + +enum +{ + ID_COMBO = 1000, + ID_LISTBOX, + wxID_NEW_SCRIPT, + wxID_SAVE_SCRIPT, + wxID_OPEN_SCRIPT, + wxID_NEW_PROJECT, + wxID_SAVE_PROJECT, + wxID_OPEN_PROJECT +}; + +// ---------------------------------------------------------------------------- +// event tables +// ---------------------------------------------------------------------------- + +// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar +// help button. + +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU(wxID_EXIT, MyFrame::OnQuit) + EVT_MENU(wxID_HELP, MyFrame::OnAbout) + + EVT_MENU(wxID_NEW_SCRIPT, MyFrame::OnNewScript) + EVT_MENU(wxID_OPEN_SCRIPT, MyFrame::OnOpenScript) + EVT_MENU(wxID_SAVE_SCRIPT, MyFrame::OnSaveScript) + EVT_MENU(wxID_NEW_PROJECT, MyFrame::OnNewProject) + EVT_MENU(wxID_OPEN_PROJECT, MyFrame::OnOpenProject) + EVT_MENU(wxID_SAVE_PROJECT, MyFrame::OnSaveProject) + + EVT_MENU(wxID_CUT, MyFrame::OnCut) + EVT_MENU(wxID_COPY, MyFrame::OnCopy) + EVT_MENU(wxID_PASTE, MyFrame::OnPaste) + + EVT_LISTBOX_DCLICK(ID_LISTBOX, MyFrame::OnListBoxDoubleClick) +END_EVENT_TABLE() + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// MyApp +// ---------------------------------------------------------------------------- + +IMPLEMENT_APP(MyApp) + +// The `main program' equivalent, creating the windows and returning the +// main frame +bool MyApp::OnInit() +{ + // Create the main frame window + MyFrame* frame = new MyFrame((wxFrame *) NULL, -1, + "wxInstall Builder", + wxPoint(100, 100), wxSize(450, 300)); + + frame->SetAutoLayout(TRUE); + + frame->Show(TRUE); + + frame->SetStatusText("Welcome to wxWindows Install Builder"); + + SetTopWindow(frame); + + return TRUE; +} + +void MyFrame::RecreateToolbar() +{ + // delete and recreate the toolbar + wxToolBarBase *toolBar = GetToolBar(); + delete toolBar; + + SetToolBar(NULL); + + long style = wxNO_BORDER | wxTB_FLAT | wxTB_DOCKABLE; + style |= m_horzToolbar ? wxTB_HORIZONTAL : wxTB_VERTICAL; + + toolBar = CreateToolBar(style, ID_TOOLBAR); + toolBar->SetMargins( 4, 4 ); + + // Set up toolbar + wxBitmap toolBarBitmaps[8]; + + toolBarBitmaps[0] = wxBITMAP(new); + toolBarBitmaps[1] = wxBITMAP(open); + toolBarBitmaps[2] = wxBITMAP(save); + toolBarBitmaps[3] = wxBITMAP(copy); + toolBarBitmaps[4] = wxBITMAP(cut); + toolBarBitmaps[5] = wxBITMAP(paste); + toolBarBitmaps[6] = wxBITMAP(print); + toolBarBitmaps[7] = wxBITMAP(help); + + if ( !m_smallToolbar ) + { + int w = 2*toolBarBitmaps[0].GetWidth(), + h = 2*toolBarBitmaps[0].GetHeight(); + for ( size_t n = 0; n < WXSIZEOF(toolBarBitmaps); n++ ) + { + toolBarBitmaps[n] = + wxImage(toolBarBitmaps[n]).Scale(w, h).ConvertToBitmap(); + } + + toolBar->SetToolBitmapSize(wxSize(w, h)); + } + +#ifdef __WXMSW__ + int width = 24; +#else + int width = 16; +#endif + + int currentX = 5; + + toolBar->AddTool(wxID_NEW_SCRIPT, toolBarBitmaps[0], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "New script"); + currentX += width + 5; + toolBar->AddTool(wxID_OPEN_SCRIPT, toolBarBitmaps[1], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open script"); + + // neither the generic nor Motif native toolbars really support this + currentX += width + 5; + toolBar->AddTool(wxID_SAVE_SCRIPT, toolBarBitmaps[2], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Save script"); + currentX += width + 5; + toolBar->AddTool(wxID_COPY, toolBarBitmaps[3], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Copy"); + currentX += width + 5; + toolBar->AddTool(wxID_CUT, toolBarBitmaps[4], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Cut"); + currentX += width + 5; + toolBar->AddTool(wxID_PASTE, toolBarBitmaps[5], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste"); + currentX += width + 5; + toolBar->AddSeparator(); + toolBar->AddTool(wxID_HELP, toolBarBitmaps[7], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Help button"); + + // after adding the buttons to the toolbar, must call Realize() to reflect + // the changes + toolBar->Realize(); + + toolBar->SetRows(m_horzToolbar ? m_rows : 10 / m_rows); +} + +// ---------------------------------------------------------------------------- +// MyFrame +// ---------------------------------------------------------------------------- + +// Define my frame constructor +MyFrame::MyFrame(wxFrame* parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style) + : wxFrame(parent, id, title, pos, size, style) +{ + m_listBox = new wxListBox(this, ID_LISTBOX, wxPoint(0,0), wxSize(-1, -1)); + + m_listBox->Append("loadwxr"); + m_listBox->Append("closeold"); + m_listBox->Append("mleview"); + m_listBox->Append("setbutton"); + m_listBox->Append("getcheck"); + m_listBox->Append("message"); + m_listBox->Append("disable"); + m_listBox->Append("settext"); + m_listBox->Append("gettext"); + m_listBox->Append("grabfile"); + m_listBox->Append("remove"); + m_listBox->Append("system"); + m_listBox->Append("startinst"); + + wxLayoutConstraints *b1 = new wxLayoutConstraints; + b1->left.SameAs (this, wxLeft, 0); + b1->top.SameAs (this, wxTop, 0); + b1->width.PercentOf (this, wxWidth, 20); + b1->bottom.SameAs (this, wxBottom, 0); + m_listBox->SetConstraints(b1); + + m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0,0), wxSize(-1, -1), wxTE_MULTILINE); + + m_textWindow->AppendText("; Script generated by wxInstall Builder\n"); + + wxLayoutConstraints *b2 = new wxLayoutConstraints; + b2->top.SameAs (this, wxTop, 0); + b2->left.SameAs (m_listBox, wxRight, 0); + b2->width.PercentOf (this, wxWidth, 80); + b2->bottom.SameAs (this, wxBottom, 0); + m_textWindow->SetConstraints(b2); + + m_smallToolbar = TRUE; + m_horzToolbar = TRUE; + m_rows = 1; + + // Give it a status line + CreateStatusBar(); + + // Give it an icon + SetIcon(wxICON(mondrian)); + + wxMenu *fileMenu = new wxMenu; + fileMenu->Append(wxID_NEW_SCRIPT, "&New Script", "New wxInstall Script" ); + fileMenu->Append(wxID_OPEN_SCRIPT, "&Open Script", "Open wxInstall Script" ); + fileMenu->Append(wxID_SAVE_SCRIPT, "&Save Script", "Save wxInstall Script" ); + fileMenu->AppendSeparator(); + /*fileMenu->Append(wxID_NEW_PROJECT, "N&ew Project", "New wxInstall Project" ); + fileMenu->Append(wxID_OPEN_PROJECT, "O&pen Project", "Open wxInstall Project" ); + fileMenu->Append(wxID_SAVE_PROJECT, "S&ave Project", "Save wxInstall Project" ); + fileMenu->AppendSeparator();*/ + fileMenu->Append(wxID_EXIT, "E&xit", "Quit wxInstall Builder" ); + + wxMenu *helpMenu = new wxMenu; + helpMenu->Append(wxID_HELP, "&About", "About wxInstall Builder"); + + wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE ); + + menuBar->Append(fileMenu, "&File"); + menuBar->Append(helpMenu, "&Help"); + + // Associate the menu bar with the frame + SetMenuBar(menuBar); + + // Create the toolbar + RecreateToolbar(); +} + +#if USE_GENERIC_TBAR + +wxToolBar* MyFrame::OnCreateToolBar(long style, + wxWindowID id, + const wxString& name) +{ + return (wxToolBar *)new wxToolBarSimple(this, id, + wxDefaultPosition, wxDefaultSize, + style, name); +} + +#endif // USE_GENERIC_TBAR + +void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) +{ + Close(TRUE); +} + +void MyFrame::OnCut(wxCommandEvent& WXUNUSED(event)) +{ + m_textWindow->Cut(); +} + +void MyFrame::OnCopy(wxCommandEvent& WXUNUSED(event)) +{ + m_textWindow->Copy(); +} + +void MyFrame::OnPaste(wxCommandEvent& WXUNUSED(event)) +{ + m_textWindow->Paste(); +} + +void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) +{ + (void)wxMessageBox("wxInstall Builder by Brian Smith", "About wxInstall Builder"); +} + +void MyFrame::OnNewScript(wxCommandEvent& event) +{ + m_textWindow->Clear(); + m_textWindow->AppendText("; Script generated by wxInstall Builder\n"); +} + +void MyFrame::OnOpenScript(wxCommandEvent& event) +{ + wxFileDialog dialog2(this, "Open Script", "", "", "*.ini", 0); + + if (dialog2.ShowModal() == wxID_OK) + m_textWindow->LoadFile(dialog2.GetPath()); +} + +void MyFrame::OnSaveScript(wxCommandEvent& event) +{ + wxFileDialog dialog2(this, "Save Script", "", "", "*.ini", 0); + + if (dialog2.ShowModal() == wxID_OK) + m_textWindow->SaveFile(dialog2.GetPath()); +} + +void MyFrame::OnNewProject(wxCommandEvent& event) +{ +} + +void MyFrame::OnOpenProject(wxCommandEvent& event) +{ +} + +void MyFrame::OnSaveProject(wxCommandEvent& event) +{ +} + +void MyFrame::OnListBoxDoubleClick( wxCommandEvent &event ) +{ + int item; + + item = m_listBox->GetSelection(); + + switch(item) + { + case 0: + { + wxFileDialog dialog2(this, "Choose wxr filename", "", "", "*.wxr", 0); + + if (dialog2.ShowModal() == wxID_OK) + { + char tempbuf[1024] = "DialogEd "; + wxString tmp = dialog2.GetFilename(); + + m_textWindow->WriteText("loadwxr,"); + m_textWindow->WriteText(tmp); + m_textWindow->WriteText("\n"); + + strcat(tempbuf, tmp); + wxExecute(tempbuf); + } + } + break; + case 1: + { + m_textWindow->WriteText("closeold\n"); + } + break; + case 2: + { + wxFileDialog dialog2(this, "Choose filename to view", "", "", "*.txt", 0); + + if (dialog2.ShowModal() == wxID_OK) + { + wxTextEntryDialog dialog3(this, + "Please enter name of the MLE widget", + appName, + "", + wxOK | wxCANCEL); + + if (dialog3.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("mleview,"); + m_textWindow->WriteText(dialog3.GetValue()); + m_textWindow->WriteText(","); + m_textWindow->WriteText(dialog2.GetFilename()); + m_textWindow->WriteText("\n"); + } + } + } + break; + case 3: + { + wxFileDialog dialog2(this, "Choose script to attach to button", "", "", "*.ini", 0); + + if (dialog2.ShowModal() == wxID_OK) + { + wxTextEntryDialog dialog3(this, + "Please enter ID of the button", + appName, + "", + wxOK | wxCANCEL); + + if (dialog3.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("setbutton,"); + m_textWindow->WriteText(dialog3.GetValue()); + m_textWindow->WriteText(","); + m_textWindow->WriteText(dialog2.GetFilename()); + m_textWindow->WriteText("\n"); + } + } + } + break; + case 4: + { + wxFileDialog dialog2(this, "Choose script to run if not checked", "", "", "*.ini", 0); + + if (dialog2.ShowModal() == wxID_OK) + { + wxTextEntryDialog dialog3(this, + "Please enter name of the checkbox widget", + appName, + "", + wxOK | wxCANCEL); + + if (dialog3.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("getcheck,"); + m_textWindow->WriteText(dialog3.GetValue()); + m_textWindow->WriteText(","); + m_textWindow->WriteText(dialog2.GetFilename()); + m_textWindow->WriteText("\n"); + } + } + } + break; + case 5: + { + wxTextEntryDialog dialog2(this, + "Please enter the message to display to the user", + appName, + "", + wxOK | wxCANCEL); + + if (dialog2.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("message,\""); + m_textWindow->WriteText(dialog2.GetValue()); + m_textWindow->WriteText("\"\n"); + } + } + break; + case 6: + { + wxTextEntryDialog dialog2(this, + "Please enter the widget name to disable", + appName, + "", + wxOK | wxCANCEL); + + if (dialog2.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("disable,"); + m_textWindow->WriteText(dialog2.GetValue()); + m_textWindow->WriteText("\n"); + } + } + break; + case 7: + { + wxTextEntryDialog dialog2(this, + "Please enter text widget name to set from", + appName, + "", + wxOK | wxCANCEL); + + if (dialog2.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("settext,"); + m_textWindow->WriteText(dialog2.GetValue()); + m_textWindow->WriteText("\n"); + } + } + break; + case 8: + { + wxTextEntryDialog dialog2(this, + "Please enter text widget name to get from", + appName, + "", + wxOK | wxCANCEL); + + if (dialog2.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("gettext,"); + m_textWindow->WriteText(dialog2.GetValue()); + m_textWindow->WriteText("\n"); + } + } + break; + case 9: + { + wxFileDialog dialog2(this, "Choose file to grab", "", "", "*", 0); + + if (dialog2.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("grabfile,"); + m_textWindow->WriteText(dialog2.GetFilename()); + m_textWindow->WriteText("\n"); + } + } + break; + case 10: + { + wxFileDialog dialog2(this, "Choose file to remove", "", "", "*", 0); + + if (dialog2.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("remove,"); + m_textWindow->WriteText(dialog2.GetFilename()); + m_textWindow->WriteText("\n"); + } + } + break; + case 11: + { + wxTextEntryDialog dialog2(this, + "Please enter the command to execute", + appName, + "", + wxOK | wxCANCEL); + + if (dialog2.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("system,"); + m_textWindow->WriteText(dialog2.GetValue()); + m_textWindow->WriteText("\n"); + } + } + break; + case 12: + { + wxFileDialog dialog2(this, "Choose script to run at installation completion", "", "", "*.ini", 0); + + if (dialog2.ShowModal() == wxID_OK) + { + wxTextEntryDialog dialog3(this, + "Please enter name of the gauge widget", + appName, + "", + wxOK | wxCANCEL); + + if (dialog3.ShowModal() == wxID_OK) + { + m_textWindow->WriteText("startinst,"); + m_textWindow->WriteText(dialog3.GetValue()); + m_textWindow->WriteText(","); + m_textWindow->WriteText(dialog2.GetFilename()); + m_textWindow->WriteText("\n"); + } + } + } + break; + } +} diff --git a/utils/Install/builder/wxib.def b/utils/Install/builder/wxib.def new file mode 100644 index 0000000000..897b9dacbb --- /dev/null +++ b/utils/Install/builder/wxib.def @@ -0,0 +1,8 @@ +NAME ToolTest +DESCRIPTION 'wxToolBar Sample' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 8192 diff --git a/utils/Install/builder/wxib.rc b/utils/Install/builder/wxib.rc new file mode 100644 index 0000000000..42bb7cb984 --- /dev/null +++ b/utils/Install/builder/wxib.rc @@ -0,0 +1,12 @@ +mondrian ICON "mondrian.ico" +#include "wx/msw/wx.rc" + +new BITMAP "bitmaps/new.bmp" +open BITMAP "bitmaps/open.bmp" +save BITMAP "bitmaps/save.bmp" +copy BITMAP "bitmaps/copy.bmp" +cut BITMAP "bitmaps/cut.bmp" +paste BITMAP "bitmaps/paste.bmp" +print BITMAP "bitmaps/print.bmp" +help BITMAP "bitmaps/help.bmp" + diff --git a/utils/Install/builder/wxibVC.dsp b/utils/Install/builder/wxibVC.dsp new file mode 100644 index 0000000000..0e8a413aaa --- /dev/null +++ b/utils/Install/builder/wxibVC.dsp @@ -0,0 +1,175 @@ +# Microsoft Developer Studio Project File - Name="wxibVC" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=wxibVC - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "wxibVC.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "wxibVC.mak" CFG="wxibVC - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "wxibVC - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "wxibVC - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "wxibVC - Win32 Debug DLL" (based on "Win32 (x86) Application") +!MESSAGE "wxibVC - Win32 Release DLL" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "wxibVC - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../include" /I "../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/wxib.exe" /libpath:"../../lib" /libpath:"../../contrib/lib" + +!ELSEIF "$(CFG)" == "wxibVC - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /I "../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"wxib.exe" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib" + +!ELSEIF "$(CFG)" == "wxibVC - Win32 Debug DLL" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DebugDLL" +# PROP BASE Intermediate_Dir "DebugDLL" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugDLL" +# PROP Intermediate_Dir "DebugDLL" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /I "../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /Yu"wx/wxprec.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxdlld.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/wxib.exe" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib" + +!ELSEIF "$(CFG)" == "wxibVC - Win32 Release DLL" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseDLL" +# PROP BASE Intermediate_Dir "ReleaseDLL" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseDLL" +# PROP Intermediate_Dir "ReleaseDLL" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../include" /I "../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxdll.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/wxib.exe" /libpath:"../../lib" /libpath:"../../contrib/lib" + +!ENDIF + +# Begin Target + +# Name "wxibVC - Win32 Release" +# Name "wxibVC - Win32 Debug" +# Name "wxibVC - Win32 Debug DLL" +# Name "wxibVC - Win32 Release DLL" +# Begin Source File + +SOURCE=.\wxib.cpp + +!IF "$(CFG)" == "wxibVC - Win32 Release" + +!ELSEIF "$(CFG)" == "wxibVC - Win32 Debug" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "wxibVC - Win32 Debug DLL" + +# SUBTRACT BASE CPP /YX /Yc /Yu +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "wxibVC - Win32 Release DLL" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\wxib.rc +# ADD BASE RSC /l 0x809 +# ADD RSC /l 0x809 /i "../../include" /i "../../contrib/include" +# End Source File +# End Target +# End Project diff --git a/utils/Install/builder/wxibvc.dsw b/utils/Install/builder/wxibvc.dsw new file mode 100644 index 0000000000..1716e9dd7a --- /dev/null +++ b/utils/Install/builder/wxibvc.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 5.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "wxibVC"=.\wxibVC.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/utils/Install/incace/acestruc.h b/utils/Install/incace/acestruc.h new file mode 100644 index 0000000000..1a6b488a20 --- /dev/null +++ b/utils/Install/incace/acestruc.h @@ -0,0 +1,151 @@ +#ifndef __acestruc_h +#define __acestruc_h + +#include "declare.h" +#include "portable.h" + +#define acesign_len 7 +#define bytes_before_acesign 7 +#define acever 10 + +struct tech +{ + UCHAR TYPE; + UCHAR QUAL; + USHORT PARM; +}; + +typedef struct tacehead +{ + USHORT HEAD_CRC; + USHORT HEAD_SIZE; + UCHAR HEAD_TYPE; + USHORT HEAD_FLAGS; + ULONG ADDSIZE; + UCHAR other[2048]; + +} thead; + +typedef struct tacemhead +{ + USHORT HEAD_CRC; + USHORT HEAD_SIZE; + UCHAR HEAD_TYPE; + USHORT HEAD_FLAGS; + + UCHAR ACESIGN[acesign_len]; + UCHAR VER_MOD; + UCHAR VER_CR; + UCHAR HOST_CR; + UCHAR VOL_NUM; + ULONG TIME_CR; + USHORT RES1; + USHORT RES2; + ULONG RES; + UCHAR AV_SIZE; + UCHAR AV[256]; + USHORT COMM_SIZE; + UCHAR COMM[2048]; + +} tmhead; + +#ifndef PATH_MAX + #define PATH_MAX 512 +#endif + +typedef struct tacefhead +{ + USHORT HEAD_CRC; + USHORT HEAD_SIZE; + UCHAR HEAD_TYPE; + USHORT HEAD_FLAGS; + + ULONG PSIZE; + ULONG SIZE; + ULONG FTIME; + ULONG ATTR; + ULONG CRC32; + struct tech TECH; + USHORT RESERVED; + USHORT FNAME_SIZE; + UCHAR FNAME[PATH_MAX]; + USHORT COMM_SIZE; + UCHAR COMM[2048]; + +} tfhead; + +#define mhead (*t_mhead) +#define fhead (*t_fhead) +#define rhead (*t_rhead) +#define tmpmhead (*t_tmpmhead) +#define tmpfhead (*t_tmpfhead) +#define tmprhead (*t_tmprhead) + +#define mhead_size h_mhead_size(mhead) +#define fhead_size h_fhead_size(fhead) +#define rhead_size ((INT)&rhead.REC_CRC-(INT)&head.HEAD_TYPE+sizeof(rhead.REC_CRC)) + +#define h_mhead_size(phead) ((INT)mhead.AV-(INT)&head.HEAD_TYPE+ \ + (phead).AV_SIZE+ \ + ((phead).HEAD_FLAGS&ACE_COMM? \ + sizeof((phead).COMM_SIZE)+H_MCOMM_SIZE(phead):0)) + + +#define h_fhead_size(phead) ((INT)fhead.FNAME-(INT)&head.HEAD_TYPE+ \ + (phead).FNAME_SIZE+ \ + ((phead).HEAD_FLAGS&ACE_COMM? \ + sizeof((phead).COMM_SIZE)+H_FCOMM_SIZE(phead):0)) + + +//main-comment-definitions +#define H_MCOMM_SIZE(head) (BUF2WORD((UCHAR*)&(head).AV+(head).AV_SIZE)) +#define MCOMM_SIZE H_MCOMM_SIZE(mhead) +#define H_MCOMM(head) ((UCHAR*)&(head).AV+(head).AV_SIZE+sizeof((head).COMM_SIZE)) +#define MCOMM H_MCOMM(mhead) + + +//file-comment-definitions +#define H_FCOMM_SIZE(head) (BUF2WORD((UCHAR*)&(head).FNAME+(head).FNAME_SIZE)) +#define FCOMM_SIZE H_FCOMM_SIZE(fhead) +#define H_FCOMM(head) ((UCHAR*)&(head).FNAME+(head).FNAME_SIZE+sizeof((head).COMM_SIZE)) +#define FCOMM H_FCOMM(fhead) + +// +#define calc_head_crc getcrc16(CRC_MASK, (CHAR*)&head.HEAD_TYPE, head.HEAD_SIZE) +#define GET_ADDSIZE ((head.HEAD_FLAGS & ACE_ADDSIZE) ? head.ADDSIZE : 0) + +//archive-header-flags +#define ACE_LIM256 1024 +#define ACE_MULT_VOL 2048 +#define ACE_AV 4096 +#define ACE_RECOV 8192 +#define ACE_LOCK 16384 +#define ACE_SOLID 32768 + +//file-header-flags +#define ACE_ADDSIZE 1 +#define ACE_PASSW 16384 +#define ACE_SP_BEF 4096 +#define ACE_SP_AFTER 8192 +#define ACE_COMM 2 + +//block types +#define MAIN_BLK 0 +#define FILE_BLK 1 +#define REC_BLK 2 + +//known compression types +#define TYPE_STORE 0 +#define TYPE_LZW1 1 + +//structure for archive handling +struct tadat +{ + INT sol, + vol, + vol_num; + ULONG time_cr; +}; + + +#endif /* __acestruc_h */ diff --git a/utils/Install/incace/attribs.h b/utils/Install/incace/attribs.h new file mode 100644 index 0000000000..dbc82ffb5b --- /dev/null +++ b/utils/Install/incace/attribs.h @@ -0,0 +1,33 @@ +#ifndef __attribs_h +#define __attribs_h + + +#ifndef _A_SUBDIR + #define _A_SUBDIR 0x10 // MS-DOS directory constant +#endif + +#ifndef S_IEXEC + #ifdef S_IEXECUTE + #define S_IEXEC S_IEXECUTE + #else + #define S_IEXEC 0 + #endif +#endif + +#ifndef S_IDELETE + #define S_IDELETE 0 +#endif + +#ifndef S_IRGRP + #define S_IRGRP 0 + #define S_IWGRP 0 +#endif + +#ifndef S_IROTH + #define S_IROTH 0 + #define S_IWOTH 0 +#endif + + +#endif /* __attribs_h */ + diff --git a/utils/Install/incace/declare.h b/utils/Install/incace/declare.h new file mode 100644 index 0000000000..4c14a28dcd --- /dev/null +++ b/utils/Install/incace/declare.h @@ -0,0 +1,38 @@ +/******************************************************/ +/* */ +/* declare.h: declaration-symbols (UCHAR, ULONG, ...) */ +/* */ +/******************************************************/ + +#ifndef __declare_h +#define __declare_h + +#if defined(__CYGWIN__) +#include <Windows32/Base.h> +#endif + +#if !defined(OS2_H_INCLUDED) && !defined(__CYGWIN__) +#ifdef AMIGA + +#include <exec/types.h> + +#else /* AMIGA */ +typedef unsigned short USHORT; +typedef short SHORT ; +typedef unsigned short UWORD ; +typedef short WORD ; +typedef unsigned long ULONG ; +typedef long LONG ; +#endif /* !AMIGA */ + +typedef unsigned char UCHAR ; +typedef char CHAR ; +typedef unsigned UINT ; +typedef int INT ; +#else +typedef unsigned short UWORD ; +#endif + + +#endif /* __declare_h */ + diff --git a/utils/Install/incace/globals.h b/utils/Install/incace/globals.h new file mode 100644 index 0000000000..f6b03660ec --- /dev/null +++ b/utils/Install/incace/globals.h @@ -0,0 +1,90 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Global variable definitions */ +/* */ +/* ------------------------------------------------------------------------ */ + +#ifndef __globals_h +#define __globals_h + +#include "acestruc.h" +#include "unace.h" + +//-------- Ace sign +extern const char *acesign; + +//-------- Version string for program +extern const char *version; + +//-------- header buffer and pointers +extern thead head; + +extern tmhead *t_mhead; +extern tfhead *t_fhead; + +//-------- buffers +extern ULONG *buf_rd ; +extern CHAR *buf ; +extern CHAR *buf_wr ; +extern UCHAR *readbuf; + +//-------- decompressor variables +extern +SHORT rpos , + dcpr_do , + dcpr_do_max , + blocksize , + dcpr_dic , + dcpr_oldnum , + bits_rd , + dcpr_frst_file; +extern +USHORT dcpr_code_mn[1 << maxwd_mn], + dcpr_code_lg[1 << maxwd_lg]; +extern +UCHAR dcpr_wd_mn[maxcode + 2], + dcpr_wd_lg[maxcode + 2], + wd_svwd[svwd_cnt]; +extern +ULONG dcpr_dpos , + cpr_dpos2 , + dcpr_dicsiz , + dcpr_dican , + dcpr_size , + dcpr_olddist[4], + code_rd ; +extern +CHAR *dcpr_text ; + +//-------- quicksort +extern USHORT sort_org[maxcode + 2]; +extern UCHAR sort_freq[(maxcode + 2) * 2]; + +//-------- file handling +extern CHAR aname[PATH_MAX]; +extern +INT archan, + wrhan; +#if !defined(__EMX__) && !defined(__OS2__) +extern FILE *farchan; +#endif + +extern LONG skipsize; + +//-------- structures for archive handling +extern struct tadat adat; + +//-------- flags +extern +INT f_err , + f_ovrall , + f_allvol_pr, + f_curpas , + f_criterr ; + +int pipeit(char *format, ...); +void error(char *format, ...); +int confirm(char *format, ...); + +#endif /* __globals_h */ + diff --git a/utils/Install/incace/os.h b/utils/Install/incace/os.h new file mode 100644 index 0000000000..a5f3d0de79 --- /dev/null +++ b/utils/Install/incace/os.h @@ -0,0 +1,26 @@ +#ifndef __os_h +#define __os_h + + +#if defined(AMIGA) + #define DIRSEP '/' + #define HI_LO_BYTE_ORDER +#endif + +#if defined(DOS) || defined(WINNT) || defined(WIN16) + #define DIRSEP '\\' + #define LO_HI_BYTE_ORDER +#endif + +#if defined(OS2) || defined(__EMX__) + #define DIRSEP '\\' + #define LO_HI_BYTE_ORDER +#endif + +#if defined(UNIX) + #define DIRSEP '/' + #define HI_LO_BYTE_ORDER +#endif + + +#endif /* __os_h */ diff --git a/utils/Install/incace/portable.h b/utils/Install/incace/portable.h new file mode 100644 index 0000000000..0488adf3d6 --- /dev/null +++ b/utils/Install/incace/portable.h @@ -0,0 +1,101 @@ +/****************************************************************/ +/* */ +/* A collection of routines used in making ACE portable for */ +/* different computers */ +/* */ +/****************************************************************/ + +#ifndef __portable_h +#define __portable_h + +#include "os.h" + +#ifdef HI_LO_BYTE_ORDER + +/* All kinds of inplace swap routines, to reverse from LOHI to HILO byte order */ + +#ifdef AMIGA + +#if __SASC && __VERSION__>=6 && __REVISION__>=58 + +#define WORDswap(n) (*(n) = __builtin_rol(*(n), 8, 1)) +#define LONGswap(n) ( WORDswap(&((WORD *)(n))[0]),\ + WORDswap(&((WORD *)(n))[1]),\ + *(n) = __builtin_rol(*(n), 16, 2) ) +#else /* __SASC */ + +#define EORSWAP + +#endif /* !__SASC */ + +#endif /* AMIGA */ + + +#ifdef EORSWAP + +/* With some compilers and processors these work faster then the + * regular swap below, for example on a Amiga 68040 using SAS C 6.58. + * But using builtin rotates works even faster, see above. + */ + +#define WORDswap(n) (((BYTE*)(n))[0] ^= ((BYTE*)(n))[1],\ + ((BYTE*)(n))[1] ^= ((BYTE*)(n))[0],\ + ((BYTE*)(n))[0] ^= ((BYTE*)(n))[1]) +#define LONGswap(n) (((BYTE*)(n))[0] ^= ((BYTE*)(n))[3],\ + ((BYTE*)(n))[3] ^= ((BYTE*)(n))[0],\ + ((BYTE*)(n))[0] ^= ((BYTE*)(n))[3],\ + ((BYTE*)(n))[1] ^= ((BYTE*)(n))[2],\ + ((BYTE*)(n))[2] ^= ((BYTE*)(n))[1],\ + ((BYTE*)(n))[1] ^= ((BYTE*)(n))[2]) +#endif /* EORSWAP */ + +#ifndef WORDswap + +/* If not yet defined use the standard swaps */ + +#define WORDswap(n) (*(n) = (*(n) << 8) | (*(n) >> 8)) +#define LONGswap(n) ( WORDswap(&((WORD *)(n))[0]),\ + WORDswap(&((WORD *)(n))[1]),\ + *(n) = (*(n) >> 16) | (*(n) << 16) ) +#endif /* WORDSWAP */ + +#endif /* HI_LO_BYTE_ORDER */ + + +/* GENERIC: Convert to LONG or WORD from BYTE-Pointer-to-LOHI-byte-order data, + * without worrying if the bytes are word alined in memory. + * p is a pointer to char. + */ + +#ifdef HI_LO_BYTE_ORDER + +#define BUFP2WORD(p) ((UWORD)*(p)++ | ((*(p)++)<<8)) +#define BUFP2LONG(p) ((ULONG)*(p)++ | ((*(p)++)<<8) | ((*(p)++)<<16) | ((*(p)++)<<24)) + +#define BUF2WORD(p) ((UWORD)*(p) | (*((p)+1)<<8)) +#define BUF2LONG(p) ((ULONG)*(p) | (*((p)+1)<<8) | (*((p)+2)<<16) | (*((p)+3)<<24)) + +#else /* HI_LO_BYTE_ORDER */ + +#define BUFP2WORD(p) *(UWORD*)((p+=2)-2) +#define BUFP2LONG(p) *(ULONG*)((p+=4)-4) + +#define BUF2WORD(p) (*(UWORD*)p) +#define BUF2LONG(p) (*(ULONG*)p) + +#endif /* !HI_LO_BYTE_ORDER */ + +/* Timestamp macros */ + +#define get_tx(m,d,h,n) (((ULONG)m<<21)+((ULONG)d<<16)+((ULONG)h<<11)+(n<<5)) +#define get_tstamp(y,m,d,h,n,s) ((((ULONG)(y-1980))<<25)+get_tx(m,d,h,n)+(s/2)) + +#define ts_year(ts) ((UINT)((ts >> 25) & 0x7f) + 1980) +#define ts_month(ts) ((UINT)(ts >> 21) & 0x0f) // 1..12 means Jan..Dec +#define ts_day(ts) ((UINT)(ts >> 16) & 0x1f) // 1..31 means 1st..31st +#define ts_hour(ts) ((UINT)(ts >> 11) & 0x1f) +#define ts_min(ts) ((UINT)(ts >> 5) & 0x3f) +#define ts_sec(ts) ((UINT)((ts & 0x1f) * 2)) + + +#endif /* __portable_h */ diff --git a/utils/Install/incace/uac_comm.h b/utils/Install/incace/uac_comm.h new file mode 100644 index 0000000000..04bfdcef56 --- /dev/null +++ b/utils/Install/incace/uac_comm.h @@ -0,0 +1,14 @@ +#ifndef __uac_comm_h +#define __uac_comm_h + + +#include "declare.h" + +extern INT comm_cpr_size; +extern CHAR *comm; + +void comment_out(CHAR *top); + + +#endif /* __uac_comm_h */ + diff --git a/utils/Install/incace/uac_crc.h b/utils/Install/incace/uac_crc.h new file mode 100644 index 0000000000..566a80845a --- /dev/null +++ b/utils/Install/incace/uac_crc.h @@ -0,0 +1,20 @@ +#ifndef __uac_crc_h +#define __uac_crc_h + + +#include "declare.h" + +#define CRC_MASK 0xFFFFFFFFL +#define CRCPOLY 0xEDB88320L + + +extern ULONG crctable[256]; +extern ULONG rd_crc; + + +ULONG getcrc(ULONG crc, UCHAR * addr, INT len); +void make_crctable(void); + + +#endif /* __uac_crc_h */ + diff --git a/utils/Install/incace/uac_crt.h b/utils/Install/incace/uac_crt.h new file mode 100644 index 0000000000..38614d1895 --- /dev/null +++ b/utils/Install/incace/uac_crt.h @@ -0,0 +1,12 @@ +#ifndef __uac_crt_h +#define __uac_crt_h + + +#include "acestruc.h" + +CHAR *ace_fname(CHAR * s, thead * head, INT nopath); +INT create_dest_file(CHAR * file, INT a); + + +#endif /* __uac_crt_h */ + diff --git a/utils/Install/incace/uac_dcpr.h b/utils/Install/incace/uac_dcpr.h new file mode 100644 index 0000000000..92795d056f --- /dev/null +++ b/utils/Install/incace/uac_dcpr.h @@ -0,0 +1,14 @@ +#ifndef __uac_dcpr_h +#define __uac_dcpr_h + +#include "declare.h" + +INT calc_dectabs(void); +void dcpr_comm(INT comm_size); +INT read_wd(UINT maxwd, USHORT * code, UCHAR * wd, INT max_el); +void dcpr_init(void); +INT dcpr_adds_blk(CHAR * buf, UINT len); +void dcpr_init_file(void); + +#endif /* __uac_dcpr_h */ + diff --git a/utils/Install/incace/uac_sys.h b/utils/Install/incace/uac_sys.h new file mode 100644 index 0000000000..ac283f1831 --- /dev/null +++ b/utils/Install/incace/uac_sys.h @@ -0,0 +1,18 @@ +#ifndef __uac_sys_h +#define __uac_sys_h + + +#include "declare.h" + +#define upcase(ch) ((in(ch,'a','z'))?(ch-32):(ch)) + +void memset16(USHORT * dest, SHORT val, INT len); +INT cancel(void); +INT wrask(CHAR * s); +#if !defined(__MINGW32__) +void beep(void); +#endif +void set_handler(void); + + +#endif diff --git a/utils/Install/incace/unace.h b/utils/Install/incace/unace.h new file mode 100644 index 0000000000..3e85277771 --- /dev/null +++ b/utils/Install/incace/unace.h @@ -0,0 +1,66 @@ +#ifndef __unace_h +#define __unace_h + + +#include "declare.h" + + +//--------- functions + +INT read_adds_blk(CHAR * buffer, INT len); + + +//--------- buffers: increase sizes when possible to speed up the program + +#define size_rdb 1024 +#define size_wrb 2048 +#define size_buf 1024 + +#define size_headrdb (sizeof(head)-20) // (some bytes less esp. for Amiga) + + +//--------- (de-)compressor constants + +#define maxdic 22 +#define maxwd_mn 11 +#define maxwd_lg 11 +#define maxwd_svwd 7 +#define maxlength 259 +#define maxdis2 255 +#define maxdis3 8191 +#define maxcode (255+4+maxdic) +#define svwd_cnt 15 +#define max_cd_mn (256+4+(maxdic+1)-1) +#define max_cd_lg (256-1) + +//--------- flags + +#define ERR_MEM 1 +#define ERR_FILES 2 +#define ERR_FOUND 3 +#define ERR_FULL 4 +#define ERR_OPEN 5 +#define ERR_READ 6 +#define ERR_WRITE 7 +#define ERR_CLINE 8 +#define ERR_CRC 9 +#define ERR_OTHER 10 +#define ERR_USER 255 + +//--------- system things + +#define flush fflush(stdout); + +#define in(v1,v2,v3) ((((long)v1)>=(v2)) && (((long)v1)<=(v3))) + +#define delay_len 500 + +//-------- file creation + +#define fileexists(name) (!access(name, 0)) + + +//-------- eof + +#endif /* __unace_h */ + diff --git a/utils/Install/inczip/consts.h b/utils/Install/inczip/consts.h new file mode 100644 index 0000000000..f418a6c8fe --- /dev/null +++ b/utils/Install/inczip/consts.h @@ -0,0 +1,46 @@ +/*--------------------------------------------------------------------------- + + consts.h + + This file contains global, initialized variables that never change. It is + included by unzip.c and windll/windll.c. + + ---------------------------------------------------------------------------*/ + + +/* And'ing with mask_bits[n] masks the lower n bits */ +ZCONST ush near mask_bits[] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; + +ZCONST char Far VersionDate[] = VERSION_DATE; /* now defined in version.h */ + +#ifndef SFX + ZCONST char Far EndSigMsg[] = + "\nnote: didn't find end-of-central-dir signature at end of central dir.\n"; +#endif + +ZCONST char Far CentSigMsg[] = + "error: expected central file header signature not found (file #%u).\n"; +ZCONST char Far SeekMsg[] = + "error [%s]: attempt to seek before beginning of zipfile\n%s"; +ZCONST char Far FilenameNotMatched[] = "caution: filename not matched: %s\n"; +ZCONST char Far ExclFilenameNotMatched[] = + "caution: excluded filename not matched: %s\n"; + +#ifdef VMS + ZCONST char Far ReportMsg[] = "\ + (please check that you have transferred or created the zipfile in the\n\ + appropriate BINARY mode--this includes ftp, Kermit, AND unzip'd zipfiles)\n"; +#else + ZCONST char Far ReportMsg[] = "\ + (please check that you have transferred or created the zipfile in the\n\ + appropriate BINARY mode and that you have compiled UnZip properly)\n"; +#endif + +#ifndef SFX + ZCONST char Far Zipnfo[] = "zipinfo"; + ZCONST char Far CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n"; +#endif diff --git a/utils/Install/inczip/crypt.h b/utils/Install/inczip/crypt.h new file mode 100644 index 0000000000..d462f2d7ba --- /dev/null +++ b/utils/Install/inczip/crypt.h @@ -0,0 +1,24 @@ +/* + crypt.h (dummy version) by Info-ZIP. Last revised: 15 Aug 98 + + This is a non-functional version of Info-ZIP's crypt.h encryption/ + decryption header file for Zip, ZipCloak, UnZip and fUnZip. This + file is not copyrighted and may be distributed without restriction. + See the "WHERE" file for sites from which to obtain the full crypt + sources (zcrypt28.zip or later). + */ + +#ifndef __crypt_h /* don't include more than once */ +#define __crypt_h + +#ifdef CRYPT +# undef CRYPT +#endif +#define CRYPT 0 /* dummy version */ + +#define zencode +#define zdecode + +#define zfwrite fwrite + +#endif /* !__crypt_h */ diff --git a/utils/Install/inczip/ebcdic.h b/utils/Install/inczip/ebcdic.h new file mode 100644 index 0000000000..db2e976b7f --- /dev/null +++ b/utils/Install/inczip/ebcdic.h @@ -0,0 +1,272 @@ +/*--------------------------------------------------------------------------- + + ebcdic.h + + The CECP 1047 (Extended de-facto EBCDIC) <-> ISO 8859-1 conversion tables, + from ftp://aix1.segi.ulg.ac.be/pub/docs/iso8859/iso8859.networking + + NOTES: + <Paul_von_Behren@stortek.com> (OS/390 port 12/97) + These table no longer represent the standard mappings (for example in the + OS/390 iconv utility). In order to follow current standards I remapped + ebcdic x0a to ascii x15 and + ebcdic x85 to ascii x25 (and vice-versa) + Without these changes, newlines in auto-convert text files appeared + as literal \045. + I'm not sure what effect this remap would have on the MVS and CMS ports, so + I ifdef'd these changes. Hopefully these ifdef's can be removed when the + MVS/CMS folks test the new mappings. + + Christian Spieler <spieler@ikp.tu-darmstadt.de>, 27-Apr-1998 + The problem mentioned by Paul von Behren was already observed previously + on VM/CMS, during the preparation of the CMS&MVS port of UnZip 5.20 in + 1996. At that point, the ebcdic tables were not changed since they seemed + to be an adopted standard (to my knowledge, these tables are still used + as presented in mainfraime KERMIT). Instead, the "end-of-line" conversion + feature of Zip's and UnZip's "text-translation" mode was used to force + correct mappings between ASCII and EBCDIC newline markers. + Before interchanging the ASCII mappings of the EBCDIC control characters + "NL" 0x25 and "LF" 0x15 according to the OS/390 setting, we have to + make sure that EBCDIC 0x15 is never used as line termination. + + ---------------------------------------------------------------------------*/ + +#ifndef __ebcdic_h /* prevent multiple inclusions */ +#define __ebcdic_h + + +#ifndef ZCONST +# define ZCONST const +#endif + +#ifdef EBCDIC +#ifndef MTS /* MTS uses a slightly "special" EBCDIC code page */ + +ZCONST uch ebcdic[] = { + 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, /* 00 - 07 */ +#ifdef OS390 + 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */ +#else + 0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */ +#endif + 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, /* 10 - 17 */ + 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */ + 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, /* 20 - 27 */ + 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, /* 28 - 2F */ + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* 30 - 37 */ + 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, /* 38 - 3F */ + 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 40 - 47 */ + 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, /* 48 - 4F */ + 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, /* 50 - 57 */ + 0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D, /* 58 - 5F */ + 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60 - 67 */ + 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* 68 - 6F */ + 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, /* 70 - 77 */ + 0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07, /* 78 - 7F */ +#ifdef OS390 + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17, /* 80 - 87 */ +#else + 0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17, /* 80 - 87 */ +#endif + 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x09, 0x0A, 0x1B, /* 88 - 8F */ + 0x30, 0x31, 0x1A, 0x33, 0x34, 0x35, 0x36, 0x08, /* 90 - 97 */ + 0x38, 0x39, 0x3A, 0x3B, 0x04, 0x14, 0x3E, 0xFF, /* 98 - 9F */ + 0x41, 0xAA, 0x4A, 0xB1, 0x9F, 0xB2, 0x6A, 0xB5, /* A0 - A7 */ + 0xBB, 0xB4, 0x9A, 0x8A, 0xB0, 0xCA, 0xAF, 0xBC, /* A8 - AF */ + 0x90, 0x8F, 0xEA, 0xFA, 0xBE, 0xA0, 0xB6, 0xB3, /* B0 - B7 */ + 0x9D, 0xDA, 0x9B, 0x8B, 0xB7, 0xB8, 0xB9, 0xAB, /* B8 - BF */ + 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9E, 0x68, /* C0 - C7 */ + 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* C8 - CF */ + 0xAC, 0x69, 0xED, 0xEE, 0xEB, 0xEF, 0xEC, 0xBF, /* D0 - D7 */ + 0x80, 0xFD, 0xFE, 0xFB, 0xFC, 0xBA, 0xAE, 0x59, /* D8 - DF */ + 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9C, 0x48, /* E0 - E7 */ + 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* E8 - EF */ + 0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, /* F0 - F7 */ + 0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF /* F8 - FF */ +}; + +#if (defined(ZIP) || CRYPT) +ZCONST uch ascii[] = { + 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, /* 00 - 07 */ + 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */ +#ifdef OS390 + 0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, /* 10 - 17 */ +#else + 0x10, 0x11, 0x12, 0x13, 0x9D, 0x85, 0x08, 0x87, /* 10 - 17 */ +#endif + 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */ +#ifdef OS390 + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, /* 20 - 27 */ +#else + 0x80, 0x81, 0x82, 0x83, 0x84, 0x0A, 0x17, 0x1B, /* 20 - 27 */ +#endif + 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, /* 28 - 2F */ + 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30 - 37 */ + 0x98, 0x99, 0x9A, 0x9B, 0x14, 0x15, 0x9E, 0x1A, /* 38 - 3F */ + 0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, /* 40 - 47 */ + 0xE7, 0xF1, 0xA2, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, /* 48 - 4F */ + 0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, /* 50 - 57 */ + 0xEC, 0xDF, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E, /* 58 - 5F */ + 0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, /* 60 - 67 */ + 0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, /* 68 - 6F */ + 0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, /* 70 - 77 */ + 0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, /* 78 - 7F */ + 0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80 - 87 */ + 0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1, /* 88 - 8F */ + 0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, /* 90 - 97 */ + 0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4, /* 98 - 9F */ + 0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* A0 - A7 */ + 0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0x5B, 0xDE, 0xAE, /* A8 - AF */ + 0xAC, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, /* B0 - B7 */ + 0xBD, 0xBE, 0xDD, 0xA8, 0xAF, 0x5D, 0xB4, 0xD7, /* B8 - BF */ + 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* C0 - C7 */ + 0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5, /* C8 - CF */ + 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, /* D0 - D7 */ + 0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF, /* D8 - DF */ + 0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* E0 - E7 */ + 0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5, /* E8 - EF */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* F0 - F7 */ + 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F /* F8 - FF */ +}; +#endif /* ZIP || CRYPT */ + +#else /* MTS */ + +/* + * This is the MTS ASCII->EBCDIC translation table. It provides a 1-1 + * translation from ISO 8859/1 8-bit ASCII to IBM Code Page 37 EBCDIC. + */ + +ZCONST uch ebcdic[] = { + 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, /* 00 - 07 */ + 0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */ + 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, /* 10 - 17 */ + 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */ + 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, /* 20 - 27 */ + 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, /* 28 - 2F */ + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* 30 - 37 */ + 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, /* 38 - 3F */ + 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 40 - 47 */ + 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, /* 48 - 4F */ + 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, /* 50 - 57 */ + 0xE7, 0xE8, 0xE9, 0xBA, 0xE0, 0xBB, 0xB0, 0x6D, /* 58 - 5F */ + 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60 - 67 */ + 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* 68 - 6F */ + 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, /* 70 - 77 */ + 0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07, /* 78 - 7F */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17, /* 80 - 87 */ + 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x09, 0x0A, 0x1B, /* 88 - 8F */ + 0x30, 0x31, 0x1A, 0x33, 0x34, 0x35, 0x36, 0x08, /* 90 - 97 */ + 0x38, 0x39, 0x3A, 0x3B, 0x04, 0x14, 0x3E, 0xFF, /* 98 - 9F */ + 0x41, 0xAA, 0x4A, 0xB1, 0x9F, 0xB2, 0x6A, 0xB5, /* A0 - A7 */ + 0xBD, 0xB4, 0x9A, 0x8A, 0x5F, 0xCA, 0xAF, 0xBC, /* A8 - AF */ + 0x90, 0x8F, 0xEA, 0xFA, 0xBE, 0xA0, 0xB6, 0xB3, /* B0 - B7 */ + 0x9D, 0xDA, 0x9B, 0x8B, 0xB7, 0xB8, 0xB9, 0xAB, /* B8 - BF */ + 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9E, 0x68, /* C0 - C7 */ + 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* C8 - CF */ + 0xAC, 0x69, 0xED, 0xEE, 0xEB, 0xEF, 0xEC, 0xBF, /* D0 - D7 */ + 0x80, 0xFD, 0xFE, 0xFB, 0xFC, 0xAD, 0xAE, 0x59, /* D8 - DF */ + 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9C, 0x48, /* E0 - E7 */ + 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* E8 - EF */ + 0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, /* F0 - F7 */ + 0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF /* F8 - FF */ +}; + +#if (defined(ZIP) || CRYPT) +ZCONST uch ascii[] = { + 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, /* 00 - 07 */ + 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */ + 0x10, 0x11, 0x12, 0x13, 0x9D, 0x85, 0x08, 0x87, /* 10 - 17 */ + 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x0A, 0x17, 0x1B, /* 20 - 27 */ + 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, /* 28 - 2F */ + 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30 - 37 */ + 0x98, 0x99, 0x9A, 0x9B, 0x14, 0x15, 0x9E, 0x1A, /* 38 - 3F */ + 0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, /* 40 - 47 */ + 0xE7, 0xF1, 0xA2, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, /* 48 - 4F */ + 0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, /* 50 - 57 */ + 0xEC, 0xDF, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAC, /* 58 - 5F */ + 0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, /* 60 - 67 */ + 0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, /* 68 - 6F */ + 0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, /* 70 - 77 */ + 0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, /* 78 - 7F */ + 0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80 - 87 */ + 0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1, /* 88 - 8F */ + 0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, /* 90 - 97 */ + 0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4, /* 98 - 9F */ + 0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* A0 - A7 */ + 0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0xDD, 0xDE, 0xAE, /* A8 - AF */ + 0x5E, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, /* B0 - B7 */ + 0xBD, 0xBE, 0x5B, 0x5D, 0xAF, 0xA8, 0xB4, 0xD7, /* B8 - BF */ + 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* C0 - C7 */ + 0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5, /* C8 - CF */ + 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, /* D0 - D7 */ + 0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF, /* D8 - DF */ + 0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* E0 - E7 */ + 0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5, /* E8 - EF */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* F0 - F7 */ + 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F /* F8 - FF */ +}; +#endif /* ZIP || CRYPT */ + +#endif /* ?MTS */ +#endif /* EBCDIC */ + +/*--------------------------------------------------------------------------- + + The following conversion tables translate between IBM PC CP 850 + (OEM codepage) and the "Western Europe & America" Windows codepage 1252. + The Windows codepage 1252 contains the ISO 8859-1 "Latin 1" codepage, + with some additional printable characters in the range (0x80 - 0x9F), + that is reserved to control codes in the ISO 8859-1 character table. + + The ISO <--> OEM conversion tables were constructed with the help + of the WIN32 (Win16?) API's OemToAnsi() and AnsiToOem() conversion + functions and have been checked against the CP850 and LATIN1 tables + provided in the MS-Kermit 3.14 distribution. + + ---------------------------------------------------------------------------*/ + +#ifdef IZ_ISO2OEM_ARRAY +ZCONST uch Far iso2oem[] = { + 0x3F, 0x3F, 0x27, 0x9F, 0x22, 0x2E, 0xC5, 0xCE, /* 80 - 87 */ + 0x5E, 0x25, 0x53, 0x3C, 0x4F, 0x3F, 0x3F, 0x3F, /* 88 - 8F */ + 0x3F, 0x27, 0x27, 0x22, 0x22, 0x07, 0x2D, 0x2D, /* 90 - 97 */ + 0x7E, 0x54, 0x73, 0x3E, 0x6F, 0x3F, 0x3F, 0x59, /* 98 - 9F */ + 0xFF, 0xAD, 0xBD, 0x9C, 0xCF, 0xBE, 0xDD, 0xF5, /* A0 - A7 */ + 0xF9, 0xB8, 0xA6, 0xAE, 0xAA, 0xF0, 0xA9, 0xEE, /* A8 - AF */ + 0xF8, 0xF1, 0xFD, 0xFC, 0xEF, 0xE6, 0xF4, 0xFA, /* B0 - B7 */ + 0xF7, 0xFB, 0xA7, 0xAF, 0xAC, 0xAB, 0xF3, 0xA8, /* B8 - BF */ + 0xB7, 0xB5, 0xB6, 0xC7, 0x8E, 0x8F, 0x92, 0x80, /* C0 - C7 */ + 0xD4, 0x90, 0xD2, 0xD3, 0xDE, 0xD6, 0xD7, 0xD8, /* C8 - CF */ + 0xD1, 0xA5, 0xE3, 0xE0, 0xE2, 0xE5, 0x99, 0x9E, /* D0 - D7 */ + 0x9D, 0xEB, 0xE9, 0xEA, 0x9A, 0xED, 0xE8, 0xE1, /* D8 - DF */ + 0x85, 0xA0, 0x83, 0xC6, 0x84, 0x86, 0x91, 0x87, /* E0 - E7 */ + 0x8A, 0x82, 0x88, 0x89, 0x8D, 0xA1, 0x8C, 0x8B, /* E8 - EF */ + 0xD0, 0xA4, 0x95, 0xA2, 0x93, 0xE4, 0x94, 0xF6, /* F0 - F7 */ + 0x9B, 0x97, 0xA3, 0x96, 0x81, 0xEC, 0xE7, 0x98 /* F8 - FF */ +}; +#endif /* IZ_ISO2OEM_ARRAY */ + +#ifdef IZ_OEM2ISO_ARRAY +ZCONST uch Far oem2iso[] = { + 0xC7, 0xFC, 0xE9, 0xE2, 0xE4, 0xE0, 0xE5, 0xE7, /* 80 - 87 */ + 0xEA, 0xEB, 0xE8, 0xEF, 0xEE, 0xEC, 0xC4, 0xC5, /* 88 - 8F */ + 0xC9, 0xE6, 0xC6, 0xF4, 0xF6, 0xF2, 0xFB, 0xF9, /* 90 - 97 */ + 0xFF, 0xD6, 0xDC, 0xF8, 0xA3, 0xD8, 0xD7, 0x83, /* 98 - 9F */ + 0xE1, 0xED, 0xF3, 0xFA, 0xF1, 0xD1, 0xAA, 0xBA, /* A0 - A7 */ + 0xBF, 0xAE, 0xAC, 0xBD, 0xBC, 0xA1, 0xAB, 0xBB, /* A8 - AF */ + 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xC1, 0xC2, 0xC0, /* B0 - B7 */ + 0xA9, 0xA6, 0xA6, 0x2B, 0x2B, 0xA2, 0xA5, 0x2B, /* B8 - BF */ + 0x2B, 0x2D, 0x2D, 0x2B, 0x2D, 0x2B, 0xE3, 0xC3, /* C0 - C7 */ + 0x2B, 0x2B, 0x2D, 0x2D, 0xA6, 0x2D, 0x2B, 0xA4, /* C8 - CF */ + 0xF0, 0xD0, 0xCA, 0xCB, 0xC8, 0x69, 0xCD, 0xCE, /* D0 - D7 */ + 0xCF, 0x2B, 0x2B, 0xA6, 0x5F, 0xA6, 0xCC, 0xAF, /* D8 - DF */ + 0xD3, 0xDF, 0xD4, 0xD2, 0xF5, 0xD5, 0xB5, 0xFE, /* E0 - E7 */ + 0xDE, 0xDA, 0xDB, 0xD9, 0xFD, 0xDD, 0xAF, 0xB4, /* E8 - EF */ + 0xAD, 0xB1, 0x3D, 0xBE, 0xB6, 0xA7, 0xF7, 0xB8, /* F0 - F7 */ + 0xB0, 0xA8, 0xB7, 0xB9, 0xB3, 0xB2, 0xA6, 0xA0 /* F8 - FF */ +}; +#endif /* IZ_OEM2ISO_ARRAY */ + +#endif /* __ebcdic_h */ diff --git a/utils/Install/inczip/globals.h b/utils/Install/inczip/globals.h new file mode 100644 index 0000000000..49439cffe7 --- /dev/null +++ b/utils/Install/inczip/globals.h @@ -0,0 +1,395 @@ +/*--------------------------------------------------------------------------- + + globals.h + + There is usually no need to include this file since unzip.h includes it. + + This header file is used by all of the UnZip source files. It contains + a struct definition that is used to "house" all of the global variables. + This is done to allow for multithreaded environments (OS/2, NT, Win95, + Unix) to call UnZip through an API without a semaphore. REENTRANT should + be defined for all platforms that require this. + + GLOBAL CONSTRUCTOR AND DESTRUCTOR (API WRITERS READ THIS!!!) + ------------------------------------------------------------ + + No, it's not C++, but it's as close as we can get with K&R. + + The main() of each process that uses these globals must include the + CONSTRUCTGLOBALS; statement. This will malloc enough memory for the + structure and initialize any variables that require it. This must + also be done by any API function that jumps into the middle of the + code. + + The DESTROYGLOBALS; statement should be inserted before EVERY "EXIT(n)". + Naturally, it also needs to be put before any API returns as well. + In fact, it's much more important in API functions since the process + will NOT end, and therefore the memory WON'T automatically be freed + by the operating system. + + USING VARIABLES FROM THE STRUCTURE + ---------------------------------- + + All global variables must now be prefixed with `G.' which is either a + global struct (in which case it should be the only global variable) or + a macro for the value of a local pointer variable that is passed from + function to function. Yes, this is a pain. But it's the only way to + allow full reentrancy. + + ADDING VARIABLES TO THE STRUCTURE + --------------------------------- + + If you make the inclusion of any variables conditional, be sure to only + check macros that are GUARANTEED to be included in every module. + For instance, newzip and pwdarg are needed only if CRYPT is TRUE, + but this is defined after unzip.h has been read. If you are not careful, + some modules will expect your variable to be part of this struct while + others won't. This will cause BIG problems. (Inexplicable crashes at + strange times, car fires, etc.) When in doubt, always include it! + + Note also that UnZipSFX needs a few variables that UnZip doesn't. However, + it also includes some object files from UnZip. If we were to conditionally + include the extra variables that UnZipSFX needs, the object files from + UnZip would not mesh with the UnZipSFX object files. Result: we just + include the UnZipSFX variables every time. (It's only an extra 4 bytes + so who cares!) + + ADDING FUNCTIONS + ---------------- + + To support this new global struct, all functions must now conditionally + pass the globals pointer (pG) to each other. This is supported by 5 macros: + __GPRO, __GPRO__, __G, __G__ and __GDEF. A function that needs no other + parameters would look like this: + + int extract_or_test_files(__G) + __GDEF + { + ... stuff ... + } + + A function with other parameters would look like: + + int memextract(__G__ tgt, tgtsize, src, srcsize) + __GDEF + uch *tgt, *src; + ulg tgtsize, srcsize; + { + ... stuff ... + } + + In the Function Prototypes section of unzpriv.h, you should use __GPRO and + __GPRO__ instead: + + int uz_opts OF((__GPRO__ int *pargc, char ***pargv)); + int process_zipfiles OF((__GPRO)); + + Note that there is NO comma after __G__ or __GPRO__ and no semi-colon after + __GDEF. I wish there was another way but I don't think there is. + + + TESTING THE CODE + ----------------- + + Whether your platform requires reentrancy or not, you should always try + building with REENTRANT defined if any functions have been added. It is + pretty easy to forget a __G__ or a __GDEF and this mistake will only show + up if REENTRANT is defined. All platforms should run with REENTRANT + defined. Platforms that can't take advantage of it will just be paying + a performance penalty needlessly. + + SIGNAL MADNESS + -------------- + + This whole pointer passing scheme falls apart when it comes to SIGNALs. + I handle this situation 2 ways right now. If you define USETHREADID, + UnZip will include a 64-entry table. Each entry can hold a global + pointer and thread ID for one thread. This should allow up to 64 + threads to access UnZip simultaneously. Calling DESTROYGLOBALS() + will free the global struct and zero the table entry. If somebody + forgets to call DESTROYGLOBALS(), this table will eventually fill up + and UnZip will exit with an error message. A good way to test your + code to make sure you didn't forget a DESTROYGLOBALS() is to change + THREADID_ENTRIES to 3 or 4 in globals.c, making the table real small. + Then make a small test program that calls your API a dozen times. + + Those platforms that don't have threads still need to be able to compile + with REENTRANT defined to test and see if new code is correctly written + to work either way. For these platforms, I simply keep a global pointer + called GG that points to the Globals structure. Good enough for testing. + + I believe that NT has thread level storage. This could probably be used + to store a global pointer for the sake of the signal handler more cleanly + than my table approach. + + ---------------------------------------------------------------------------*/ + +#ifndef __globals_h +#define __globals_h + +#ifdef USE_ZLIB +# include "zlib.h" +#endif + + +/*************/ +/* Globals */ +/*************/ + +typedef struct Globals { +#ifdef DLL + zvoid *callerglobs; /* pointer to structure of pass-through global vars */ +#endif + + /* command options of general use */ + UzpOpts UzO; /* command options of general use */ + +#ifndef FUNZIP + /* command options specific to the high level command line interface */ +#ifdef MORE + int M_flag; /* -M: built-in "more" function */ +#endif + + /* internal flags and general globals */ +#ifdef MORE + int height; /* check for SIGWINCH, etc., eventually... */ +#endif /* (take line-wrapping into account?) */ +#if (defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME)) + int tz_is_valid; /* indicates that timezone info can be used */ +#endif +#ifdef WINDLL + int prompt_always; /* prompt to overwrite if TRUE */ +#endif + int noargs; /* did true command line have *any* arguments? */ + unsigned filespecs; /* number of real file specifications to be matched */ + unsigned xfilespecs; /* number of excluded filespecs to be matched */ + int process_all_files; + int create_dirs; /* used by main(), mapname(), checkdir() */ + int extract_flag; + int newzip; /* reset in extract.c; used in crypt.c */ + LONGINT real_ecrec_offset; + LONGINT expect_ecrec_offset; + long csize; /* used by decompr. (NEXTBYTE): must be signed */ + long ucsize; /* used by unReduce(), explode() */ + long used_csize; /* used by extract_or_test_member(), explode() */ + +#ifdef DLL + int fValidate; /* true if only validating an archive */ + int filenotfound; + int redirect_data; /* redirect data to memory buffer */ + int redirect_text; /* redirect text output to buffer */ +# ifndef NO_SLIDE_REDIR + int redirect_slide; /* redirect decompression area to mem buffer */ + unsigned _wsize; +# endif + unsigned redirect_size; /* size of redirected output buffer */ + uch *redirect_buffer; /* pointer to head of allocated buffer */ + uch *redirect_pointer; /* pointer past end of written data */ +# ifndef NO_SLIDE_REDIR + uch *redirect_sldptr; /* head of decompression slide buffer */ +# endif +# ifdef OS2DLL + cbList(processExternally); /* call-back list */ +# endif +#endif /* DLL */ + + char **pfnames; + char **pxnames; + char sig[4]; + char answerbuf[10]; + min_info info[DIR_BLKSIZ]; + min_info *pInfo; +#endif /* !FUNZIP */ + union work area; /* see unzpriv.h for definition of work */ + +#ifndef FUNZIP +# if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB)) + ZCONST ulg near *crc_32_tab; +# else + ZCONST ulg Far *crc_32_tab; +# endif +#endif + ulg crc32val; /* CRC shift reg. (was static in funzip) */ + +#ifdef FUNZIP + FILE *in; /* file descriptor of compressed stream */ +#endif + uch *inbuf; /* input buffer (any size is OK) */ + uch *inptr; /* pointer into input buffer */ + int incnt; + +#ifndef FUNZIP + ulg bitbuf; + int bits_left; /* unreduce and unshrink only */ + int zipeof; + char *argv0; /* used for NT and EXE_EXTENSION */ + char *wildzipfn; + char *zipfn; /* GRR: WINDLL: must nuke any malloc'd zipfn... */ +#ifdef USE_STRM_INPUT + FILE *zipfd; /* zipfile file descriptor */ +#else + int zipfd; /* zipfile file handle */ +#endif + LONGINT ziplen; + LONGINT cur_zipfile_bufstart; /* extract_or_test, readbuf, ReadByte */ + LONGINT extra_bytes; /* used in unzip.c, misc.c */ + uch *extra_field; /* Unix, VMS, Mac, OS/2, Acorn, ... */ + uch *hold; + + local_file_hdr lrec; /* used in unzip.c, extract.c */ + cdir_file_hdr crec; /* used in unzip.c, extract.c, misc.c */ + ecdir_rec ecrec; /* used in unzip.c, extract.c */ + struct stat statbuf; /* used by main, mapname, check_for_newer */ + + int mem_mode; + uch *outbufptr; /* extract.c static */ + ulg outsize; /* extract.c static */ + int reported_backslash; /* extract.c static */ + int disk_full; + int newfile; + + int didCRlast; /* fileio static */ + ulg numlines; /* fileio static: number of lines printed */ + int sol; /* fileio static: at start of line */ + int no_ecrec; /* process static */ +#ifdef SYMLINKS + int symlnk; +#endif +#ifdef NOVELL_BUG_FAILSAFE + int dne; /* true if stat() says file doesn't exist */ +#endif + + FILE *outfile; + uch *outbuf; + uch *realbuf; + +#ifndef VMS /* if SMALL_MEM, outbuf2 is initialized in */ + uch *outbuf2; /* process_zipfiles() (never changes); */ +#endif /* else malloc'd ONLY if unshrink and -a */ +#endif /* !FUNZIP */ + uch *outptr; + ulg outcnt; /* number of chars stored in outbuf */ +#ifndef FUNZIP + char filename[FILNAMSIZ]; /* also used by NT for temporary SFX path */ + +#ifdef CMS_MVS + char *tempfn; /* temp file used; erase on close */ +#endif + + char *key; /* crypt static: decryption password or NULL */ + int nopwd; /* crypt static */ +#endif /* !FUNZIP */ + ulg keys[3]; /* crypt static: keys defining pseudo-random sequence */ + +#if (!defined(DOS_FLX_H68_OS2_W32) && !defined(AMIGA) && !defined(RISCOS)) +#if (!defined(MACOS) && !defined(ATARI) && !defined(VMS)) + int echofd; /* ttyio static: file descriptor whose echo is off */ +#endif /* !(MACOS || ATARI || VMS) */ +#endif /* !(DOS_FLX_H68_OS2_W32 || AMIGA || RISCOS) */ + + unsigned hufts; /* track memory usage */ + +#ifdef USE_ZLIB + int inflInit; /* inflate static: zlib inflate() initialized */ + z_stream dstrm; /* inflate global: decompression stream */ +#else + struct huft *fixed_tl; /* inflate static */ + struct huft *fixed_td; /* inflate static */ + int fixed_bl, fixed_bd; /* inflate static */ + unsigned wp; /* inflate static: current position in slide */ + ulg bb; /* inflate static: bit buffer */ + unsigned bk; /* inflate static: bits in bit buffer */ +#endif /* ?USE_ZLIB */ + +#ifndef FUNZIP +#ifdef SMALL_MEM + char rgchBigBuffer[512]; + char rgchSmallBuffer[96]; + char rgchSmallBuffer2[160]; /* boosted to 160 for local3[] in unzip.c */ +#endif + + MsgFn *message; + InputFn *input; + PauseFn *mpause; + PasswdFn *decr_passwd; + StatCBFn *statreportcb; +#ifdef WINDLL + LPUSERFUNCTIONS lpUserFunctions; +#endif + + int incnt_leftover; /* so improved NEXTBYTE does not waste input */ + uch *inptr_leftover; + +#ifdef VMS_TEXT_CONV + int VMS_line_state; /* so native VMS variable-length text files are */ + int VMS_line_length; /* readable on other platforms */ + int VMS_line_pad; +#endif +#endif /* !FUNZIP */ + +#ifdef SYSTEM_SPECIFIC_GLOBALS + SYSTEM_SPECIFIC_GLOBALS +#endif + +} Uz_Globs; /* end of struct Globals */ + + +/***************************************************************************/ + + +#ifdef FUNZIP +# if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB)) + extern ZCONST ulg near crc_32_tab[256]; +# else + extern ZCONST ulg Far *crc_32_tab; +# endif +# define CRC_32_TAB crc_32_tab +#else +# define CRC_32_TAB G.crc_32_tab +#endif + + +Uz_Globs *globalsCtor OF((void)); + +/* pseudo constant sigs; they are initialized at runtime so unzip executable + * won't look like a zipfile + */ +extern char local_hdr_sig[4]; +extern char central_hdr_sig[4]; +extern char end_central_sig[4]; +/* extern char extd_local_sig[4]; NOT USED YET */ + +#ifdef REENTRANT +# define G (*(Uz_Globs *)pG) +# define __G pG +# define __G__ pG, +# define __GPRO Uz_Globs *pG +# define __GPRO__ Uz_Globs *pG, +# define __GDEF Uz_Globs *pG; +# ifdef USETHREADID + extern int lastScan; + void deregisterGlobalPointer OF((__GPRO)); + Uz_Globs *getGlobalPointer OF((void)); +# define GETGLOBALS() Uz_Globs *pG = getGlobalPointer(); +# define DESTROYGLOBALS() {free_G_buffers(pG); deregisterGlobalPointer(pG);} +# else + extern Uz_Globs *GG; +# define GETGLOBALS() Uz_Globs *pG = GG; +# define DESTROYGLOBALS() {free_G_buffers(pG); free(pG);} +# endif /* ?USETHREADID */ +# define CONSTRUCTGLOBALS() Uz_Globs *pG = globalsCtor() +#else /* !REENTRANT */ + extern Uz_Globs G; +# define __G +# define __G__ +# define __GPRO void +# define __GPRO__ +# define __GDEF +# define GETGLOBALS() +# define CONSTRUCTGLOBALS() globalsCtor() +# define DESTROYGLOBALS() +#endif /* ?REENTRANT */ + +#define uO G.UzO + +#endif /* __globals_h */ diff --git a/utils/Install/inczip/inflate.h b/utils/Install/inczip/inflate.h new file mode 100644 index 0000000000..f1d774b793 --- /dev/null +++ b/utils/Install/inczip/inflate.h @@ -0,0 +1,24 @@ +/* inflate.h for UnZip -- put in the public domain by Mark Adler + version c14f, 23 November 1995 */ + + +/* You can do whatever you like with this source file, though I would + prefer that if you modify it and redistribute it that you include + comments to that effect with your name and the date. Thank you. + + History: + vers date who what + ---- --------- -------------- ------------------------------------ + c14 12 Mar 93 M. Adler made inflate.c standalone with the + introduction of inflate.h. + c14d 28 Aug 93 G. Roelofs replaced flush/FlushOutput with new version + c14e 29 Sep 93 G. Roelofs moved everything into unzip.h; added crypt.h + c14f 23 Nov 95 G. Roelofs added UNZIP_INTERNAL to accommodate newly + split unzip.h + */ + +#define UNZIP_INTERNAL +#include "unzip.h" /* provides slide[], typedefs and macros */ +#ifdef FUNZIP +# include "crypt.h" /* provides NEXTBYTE macro for crypt version of funzip */ +#endif diff --git a/utils/Install/inczip/nt.h b/utils/Install/inczip/nt.h new file mode 100644 index 0000000000..0109c2b678 --- /dev/null +++ b/utils/Install/inczip/nt.h @@ -0,0 +1,28 @@ +/* nt.h: central header for EF_NTSD "SD" extra field */ + +#ifndef _NT_H +#define _NT_H + +#define NTSD_BUFFERSIZE (1024) /* threshold to cause malloc() */ +#define OVERRIDE_BACKUP 1 /* we have SeBackupPrivilege on remote */ +#define OVERRIDE_RESTORE 2 /* we have SeRestorePrivilege on remote */ +#define OVERRIDE_SACL 4 /* we have SeSystemSecurityPrivilege on remote */ + +typedef struct { + BOOL bValid; /* are our contents valid? */ + BOOL bProcessDefer; /* process deferred entry yet? */ + BOOL bUsePrivileges; /* use privilege overrides? */ + DWORD dwFileSystemFlags; /* describes target file system */ + BOOL bRemote; /* is volume remote? */ + DWORD dwRemotePrivileges; /* relevant only on remote volumes */ + DWORD dwFileAttributes; + char RootPath[MAX_PATH+1]; /* path to network / filesystem */ +} VOLUMECAPS, *PVOLUMECAPS, *LPVOLUMECAPS; + +BOOL SecuritySet(char *resource, PVOLUMECAPS VolumeCaps, uch *securitydata); +BOOL GetVolumeCaps(char *rootpath, char *name, PVOLUMECAPS VolumeCaps); +BOOL ValidateSecurity(uch *securitydata); +BOOL ProcessDefer(PDWORD dwDirectoryCount, PDWORD dwBytesProcessed, + PDWORD dwDirectoryFail, PDWORD dwBytesFail); + +#endif /* _NT_H */ diff --git a/utils/Install/inczip/os2acl.h b/utils/Install/inczip/os2acl.h new file mode 100644 index 0000000000..49e7977230 --- /dev/null +++ b/utils/Install/inczip/os2acl.h @@ -0,0 +1,32 @@ +/* os2acl.h + * + * Author: Kai Uwe Rommel <rommel@ars.de> + * Created: Fri Mar 29 1996 + */ + +/* $Id$ */ + +/* + * $Log$ + * Revision 1.2 2000/07/15 19:50:44 cvsuser + * merged 2.2 branch + * + * Revision 1.1.2.1 2000/04/11 12:38:05 BS + * Added wxInstall a self extracting installation program using wxWindows. + * + * Revision 1.1 1996/03/30 09:35:00 rommel + * Initial revision + * + */ + +#ifndef _OS2ACL_H +#define _OS2ACL_H + +#define ACL_BUFFERSIZE 4096 + +int acl_get(char *server, const char *resource, char *buffer); +int acl_set(char *server, const char *resource, char *buffer); + +#endif /* _OS2ACL_H */ + +/* end of os2acl.h */ diff --git a/utils/Install/inczip/os2cfg.h b/utils/Install/inczip/os2cfg.h new file mode 100644 index 0000000000..0a5bf491ce --- /dev/null +++ b/utils/Install/inczip/os2cfg.h @@ -0,0 +1,136 @@ +/*--------------------------------------------------------------------------- + OS/2 specific configuration section: + ---------------------------------------------------------------------------*/ + +#ifndef __os2cfg_h +#define __os2cfg_h + +#ifdef MSDOS +# include <dos.h> /* for REGS macro (TC) or _dos_setftime (MSC) */ +# ifdef __TURBOC__ /* includes Power C */ +# include <sys/timeb.h> /* for structure ftime */ +# ifndef __BORLANDC__ /* there appears to be a bug (?) in Borland's */ +# include <mem.h> /* MEM.H related to __STDC__ and far poin- */ +# endif /* ters. (dpk) [mem.h included for memcpy] */ +# endif +#endif /* MSDOS */ + +#ifdef __IBMC__ +# define S_IFMT 0xF000 +# define timezone _timezone /* (underscore names work with */ +# define tzset _tzset /* all versions of C Set) */ +# define PIPE_ERROR (errno == EERRSET || errno == EOS2ERR) +#endif /* __IBMC__ */ + +#ifdef __WATCOMC__ +# ifdef __386__ +# ifndef WATCOMC_386 +# define WATCOMC_386 +# endif +# define __32BIT__ +# undef far +# define far +# undef near +# define near + +/* Get asm routines to link properly without using "__cdecl": */ +# ifndef USE_ZLIB +# pragma aux crc32 "_*" parm caller [] value [eax] modify [eax] +# pragma aux get_crc_table "_*" parm caller [] value [eax] \ + modify [eax ecx edx] +# endif /* !USE_ZLIB */ +# else /* !__386__ */ +# ifndef USE_ZLIB +# pragma aux crc32 "_*" parm caller [] value [ax dx] \ + modify [ax cx dx bx] +# pragma aux get_crc_table "_*" parm caller [] value [ax] \ + modify [ax cx dx bx] +# endif /* !USE_ZLIB */ +# endif /* ?__386__ */ + +# ifndef EPIPE +# define EPIPE -1 +# endif +# define PIPE_ERROR (errno == EPIPE) +#endif /* __WATCOMC__ */ + +#ifdef __EMX__ +# ifndef __32BIT__ +# define __32BIT__ +# endif +# define far +#endif + +#ifndef __32BIT__ +# define __16BIT__ +#endif + +#ifdef MSDOS +# undef MSDOS +#endif + +#if defined(M_I86CM) || defined(M_I86LM) +# define MED_MEM +#endif +#if (defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)) +# define MED_MEM +#endif +#ifdef __16BIT__ +# ifndef MED_MEM +# define SMALL_MEM +# endif +#endif + +#ifdef __16BIT__ +# if defined(MSC) || defined(__WATCOMC__) +# include <malloc.h> +# define nearmalloc _nmalloc +# define nearfree _nfree +# endif +# if defined(__TURBOC__) && defined(DYNALLOC_CRCTAB) +# if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__) +# undef DYNALLOC_CRCTAB +# endif +# endif +# ifndef nearmalloc +# define nearmalloc malloc +# define nearfree free +# endif +#endif + +/* TIMESTAMP is now supported on OS/2, so enable it by default */ +#if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP)) +# define TIMESTAMP +#endif + +/* check that TZ environment variable is defined before using UTC times */ +#if (!defined(NO_IZ_CHECK_TZ) && !defined(IZ_CHECK_TZ)) +# define IZ_CHECK_TZ +#endif + +#ifndef OS2_EAS +# define OS2_EAS /* for -l and -v listings (list.c) */ +#endif + +#ifdef isupper +# undef isupper +#endif +#ifdef tolower +# undef tolower +#endif +#define isupper(x) IsUpperNLS((unsigned char)(x)) +#define tolower(x) ToLowerNLS((unsigned char)(x)) +#define USETHREADID + +/* handlers for OEM <--> ANSI string conversions */ +#ifndef _OS2_ISO_ANSI + /* use home-brewed conversion functions; internal charset is OEM */ +# ifdef CRTL_CP_IS_ISO +# undef CRTL_CP_IS_ISO +# endif +# ifndef CRTL_CP_IS_OEM +# define CRTL_CP_IS_OEM +# endif +#endif + +#endif /* !__os2cfg_h */ diff --git a/utils/Install/inczip/os2data.h b/utils/Install/inczip/os2data.h new file mode 100644 index 0000000000..726baa99d3 --- /dev/null +++ b/utils/Install/inczip/os2data.h @@ -0,0 +1,139 @@ +/*--------------------------------------------------------------------------- + + os2data.h + + OS/2-specific structures and data to be included in the global data struc- + ture. + + ---------------------------------------------------------------------------*/ + + +#define MAXNAMLEN 256 +#define MAXPATHLEN 256 +#define MAXLEN 256 /* temporary buffer length */ +#define IBUF_LEN 4096 /* input buffer length */ + +#define INCL_NOPM +#define INCL_DOSNLS +#define INCL_DOSPROCESS +#define INCL_DOSDEVICES +#define INCL_DOSDEVIOCTL +#define INCL_DOSERRORS +#define INCL_DOSMISC + +#if (defined(OS2DLL) && !defined(DLL)) +# undef OS2DLL +#endif + +#ifdef OS2DLL +# define INCL_REXXSAA +# include <rexxsaa.h> +#endif + +#include <os2.h> + + +struct direct +{ + ino_t d_ino; /* a bit of a farce */ + int d_reclen; /* more farce */ + int d_namlen; /* length of d_name */ + char d_name[MAXNAMLEN + 1]; /* null terminated */ + /* nonstandard fields */ + long d_size; /* size in bytes */ + unsigned d_mode; /* MS-DOS or OS/2 file attributes */ + unsigned d_time; + unsigned d_date; +}; + +/* The fields d_size and d_mode are extensions by me (Kai Uwe Rommel). The + * find_first and find_next calls deliver these data without any extra cost. + * If these data are needed, the fields save a lot of extra calls to stat() + * (each stat() again performs a find_first call !). + */ + +struct _dircontents +{ + char *_d_entry; + long _d_size; + unsigned _d_mode, _d_time, _d_date; + struct _dircontents *_d_next; +}; + +typedef struct _dirdesc +{ + int dd_id; /* uniquely identify each open directory */ + long dd_loc; /* where we are in directory entry is this */ + struct _dircontents *dd_contents; /* pointer to contents of dir */ + struct _dircontents *dd_cp; /* pointer to current position */ +} +DIR; + + +struct os2Global { + +#ifndef SFX + HDIR hdir; +#ifdef __32BIT__ + ULONG count; + FILEFINDBUF3 find; +#else + USHORT count; + FILEFINDBUF find; +#endif +#endif /* !SFX */ + + int created_dir; /* used by mapname(), checkdir() */ + int renamed_fullpath; /* ditto */ + int fnlen; /* ditto */ +#ifdef __32BIT__ + ULONG nLabelDrive; /* ditto */ +#else + USHORT nLabelDrive; +#endif + int longnameEA; /* checkdir(), close_outfile() */ + char *lastpathcomp; /* ditto */ + + struct direct dp; + int lower; + USHORT nLastDrive, nResult; + + DIR *dir; + char *dirname, *wildname, matchname[FILNAMSIZ]; + int firstcall, have_dirname, dirnamelen; + + int rootlen; /* length of rootpath */ + char *rootpath; /* user's "extract-to" directory */ + char *buildpathHPFS; /* full path (so far) to extracted file, */ + char *buildpathFAT; /* both HPFS/EA (main) and FAT versions */ + char *endHPFS; /* corresponding pointers to end of */ + char *endFAT; /* buildpath ('\0') */ + +#ifdef OS2DLL + char buffer[IBUF_LEN]; + char output_var[MAXLEN]; + char getvar_buf[MAXLEN]; + int getvar_len; + + int output_idx; + int stem_len; + int putchar_idx; + int rexx_error; + char *rexx_mes; + + SHVBLOCK request; +#endif +}; + + +#define SYSTEM_SPECIFIC_GLOBALS struct os2Global os2; +#define SYSTEM_SPECIFIC_CTOR os2GlobalsCtor + +#ifdef OS2DLL +# ifdef API_DOC +# define SYSTEM_API_BRIEF REXXBrief +# define SYSTEM_API_DETAILS REXXDetails + extern char *REXXBrief; + extern APIDocStruct REXXDetails[]; +# endif +#endif diff --git a/utils/Install/inczip/rsxntwin.h b/utils/Install/inczip/rsxntwin.h new file mode 100644 index 0000000000..c6dd09a22f --- /dev/null +++ b/utils/Install/inczip/rsxntwin.h @@ -0,0 +1,155 @@ +/* rsxntwin.h + * + * fills some gaps in the rsxnt 1.3 win32 header files (<windows.h>) that are + * required for compiling Info-ZIP sources for Win NT / Win 95 + */ + +#ifdef __RSXNT__ +#if !defined (_RSXNTWIN_H) +#define _RSXNTWIN_H + +#ifdef TFUNCT /* TFUNCT is undefined when MSSDK headers are used */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define PASCAL __stdcall + +#define ANYSIZE_ARRAY 1 + +#ifndef TIME_ZONE_ID_UNKNOWN +# define TIME_ZONE_ID_UNKNOWN 0 +#endif + +#define FILE_ATTRIBUTE_HIDDEN 0x00000002 +#define FILE_ATTRIBUTE_SYSTEM 0x00000004 + +#define FILE_SHARE_DELETE 0x00000004 + +#define FILE_PERSISTENT_ACLS 0x00000008 + +#define HFILE_ERROR ((HFILE)-1) + +#define FS_PERSISTENT_ACLS FILE_PERSISTENT_ACLS + + +BOOL WINAPI DosDateTimeToFileTime(WORD, WORD, LPFILETIME); + + +#ifndef SetVolumeLabel +#define SetVolumeLabel TFUNCT(SetVolumeLabel) +#endif +BOOL WINAPI SetVolumeLabel(LPCTSTR, LPCTSTR); + + +#ifndef GetDriveType +#define GetDriveType TFUNCT(GetDriveType) +#endif +DWORD GetDriveType(LPCTSTR); + +#define DRIVE_UNKNOWN 0 +#define DRIVE_REMOVABLE 2 +#define DRIVE_FIXED 3 +#define DRIVE_REMOTE 4 +#define DRIVE_CDROM 5 +#define DRIVE_RAMDISK 6 + +#ifndef SearchPath +#define SearchPath TFUNCT(SearchPath) +#endif +BOOL WINAPI SearchPath(LPCTSTR, LPCTSTR, LPCTSTR, UINT, LPTSTR, LPTSTR *); + +#define ERROR_SUCCESS 0 +#define ERROR_INSUFFICIENT_BUFFER 122 + +LONG WINAPI InterlockedExchange(LPLONG, LONG); + +#define ACCESS_SYSTEM_SECURITY 0x01000000L + +typedef PVOID PSECURITY_DESCRIPTOR; +typedef PVOID PSID; +typedef struct _ACL { + BYTE AclRevision; + BYTE Sbz1; + WORD AclSize; + WORD AceCount; + WORD Sbz2; +} ACL; +typedef ACL *PACL; + +typedef struct _LUID { + DWORD LowPart; + LONG HighPart; +} LUID, *PLUID; + +typedef struct _LUID_AND_ATTRIBUTES { + LUID Luid; + DWORD Attributes; + } LUID_AND_ATTRIBUTES, * PLUID_AND_ATTRIBUTES; + +typedef struct _TOKEN_PRIVILEGES { + DWORD PrivilegeCount; + LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; +} TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES; + +#define TOKEN_QUERY 0x0008 +#define TOKEN_ADJUST_PRIVILEGES 0x0020 + +BOOL WINAPI OpenProcessToken(HANDLE, DWORD, PHANDLE); +BOOL WINAPI AdjustTokenPrivileges(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, + PTOKEN_PRIVILEGES, PDWORD); + +#ifndef LookupPrivilegeValue +#define LookupPrivilegeValue TFUNCT(LookupPrivilegeValue) +#endif +BOOL WINAPI LookupPrivilegeValue(LPCTSTR, LPCTSTR, PLUID); + +typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION; +#define OWNER_SECURITY_INFORMATION 0x00000001L +#define GROUP_SECURITY_INFORMATION 0x00000002L +#define DACL_SECURITY_INFORMATION 0x00000004L +#define SACL_SECURITY_INFORMATION 0x00000008L + +typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL; +#define SE_DACL_PRESENT 0x0004 +#define SE_SACL_PRESENT 0x0010 + +#define SE_PRIVILEGE_ENABLED 0x00000002L + +#define SE_SECURITY_NAME TEXT("SeSecurityPrivilege") +#define SE_BACKUP_NAME TEXT("SeBackupPrivilege") +#define SE_RESTORE_NAME TEXT("SeRestorePrivilege") + +BOOL WINAPI GetKernelObjectSecurity(HANDLE, SECURITY_INFORMATION, + PSECURITY_DESCRIPTOR, DWORD, LPDWORD); +BOOL WINAPI SetKernelObjectSecurity(HANDLE, SECURITY_INFORMATION, + PSECURITY_DESCRIPTOR); +BOOL WINAPI IsValidSid(PSID); +BOOL WINAPI IsValidAcl(PACL); +BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR); +BOOL WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR); +DWORD WINAPI GetSecurityDescriptorLength(PSECURITY_DESCRIPTOR); +BOOL WINAPI GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR, + PSECURITY_DESCRIPTOR_CONTROL, LPDWORD); +BOOL WINAPI SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR, + SECURITY_DESCRIPTOR_CONTROL, SECURITY_DESCRIPTOR_CONTROL); +BOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR, + LPBOOL, PACL *, LPBOOL); +BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR, BOOL, PACL, BOOL); +BOOL WINAPI GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR, + LPBOOL, PACL *, LPBOOL); +BOOL WINAPI SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR, BOOL, PACL, BOOL); +BOOL WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR, PSID *, LPBOOL); +BOOL WINAPI SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR, PSID, BOOL); +BOOL WINAPI GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR, PSID *, LPBOOL); +BOOL WINAPI SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR, PSID, BOOL); +VOID WINAPI InitializeCriticalSection(); + +#ifdef __cplusplus +} +#endif + +#endif /* TFUNCT */ +#endif /* !defined (_RSXNTWIN_H) */ +#endif /* __RSXNT__ */ diff --git a/utils/Install/inczip/tables.h b/utils/Install/inczip/tables.h new file mode 100644 index 0000000000..0f4ecc316a --- /dev/null +++ b/utils/Install/inczip/tables.h @@ -0,0 +1,81 @@ +/*--------------------------------------------------------------------------- + + tables.h + + This file contains only the 32-bit CRC table used in fUnZip; + it is in a separate file because it is rather big and ugly and + gets in the way during editing. + This file can be included in no more than ONE source file per + executable, of course. + + ---------------------------------------------------------------------------*/ + +#ifndef __tables_h /* prevent multiple inclusions */ +#define __tables_h + +#ifdef FUNZIP +#if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB)) + +/* Table of CRC-32's of all single-byte values (made by makecrc.c) */ +ZCONST ulg near crc_32_tab[256] = { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL +}; + +#else /* USE_ZLIB && !USE_OWN_CRCTAB */ + +ZCONST uLongf *crc_32_tab = NULL; + +#endif /* ?(!USE_ZLIB || USE_OWN_CRCTAB) */ +#endif /* FUNZIP */ +#endif /* __tables_h */ diff --git a/utils/Install/inczip/ttyio.h b/utils/Install/inczip/ttyio.h new file mode 100644 index 0000000000..685e7ace66 --- /dev/null +++ b/utils/Install/inczip/ttyio.h @@ -0,0 +1,186 @@ +/* + ttyio.h + */ + +#ifndef __ttyio_h /* don't include more than once */ +#define __ttyio_h + +#ifndef __crypt_h +# include "crypt.h" /* ensure that encryption header file has been seen */ +#endif + +#if (CRYPT || (defined(UNZIP) && !defined(FUNZIP))) +/* + * Non-echo keyboard/console input support is needed and enabled. + */ + +#ifndef __G /* UnZip only, for now (DLL stuff) */ +# define __G +# define __G__ +# define __GDEF +# define __GPRO void +# define __GPRO__ +#endif + +#ifndef ZCONST /* UnZip only (until have configure script like Zip) */ +# define ZCONST const +#endif + +#if (defined(MSDOS) || defined(OS2) || defined(WIN32)) +# ifndef DOS_OS2_W32 +# define DOS_OS2_W32 +# endif +#endif + +#if (defined(DOS_OS2_W32) || defined(__human68k__)) +# ifndef DOS_H68_OS2_W32 +# define DOS_H68_OS2_W32 +# endif +#endif + +#if (defined(DOS_OS2_W32) || defined(FLEXOS)) +# ifndef DOS_FLX_OS2_W32 +# define DOS_FLX_OS2_W32 +# endif +#endif + +#if (defined(DOS_H68_OS2_W32) || defined(FLEXOS)) +# ifndef DOS_FLX_H68_OS2_W32 +# define DOS_FLX_H68_OS2_W32 +# endif +#endif + +#if (defined(VM_CMS) || defined(MVS)) +# ifndef CMS_MVS +# define CMS_MVS +# endif +#endif + + +/* Function prototypes */ + +/* The following systems supply a `non-echo' character input function "getch()" + * (or an alias) and do not need the echoff() / echon() function pair. + */ +#ifdef AMIGA +# define echoff(f) +# define echon() +# define getch() Agetch() +# define HAVE_WORKING_GETCH +#endif /* AMIGA */ + +#ifdef ATARI +# define echoff(f) +# define echon() +# include <osbind.h> +# define getch() (Cnecin() & 0x000000ff) +# define HAVE_WORKING_GETCH +#endif + +#ifdef MACOS +# define echoff(f) +# define echon() +# define getch() macgetch() +# define HAVE_WORKING_GETCH +#endif + +#ifdef QDOS +# define echoff(f) +# define echon() +# define HAVE_WORKING_GETCH +#endif + +#ifdef RISCOS +# define echoff(f) +# define echon() +# define getch() SWI_OS_ReadC() +# define HAVE_WORKING_GETCH +#endif + +#ifdef DOS_H68_OS2_W32 +# define echoff(f) +# define echon() +# ifdef WIN32 +# ifndef getch +# define getch() getch_win32() +# endif +# else /* !WIN32 */ +# ifdef __EMX__ +# ifndef getch +# define getch() _read_kbd(0, 1, 0) +# endif +# else /* !__EMX__ */ +# ifdef __GO32__ +# include <pc.h> +# define getch() getkey() +# else /* !__GO32__ */ +# include <conio.h> +# endif /* ?__GO32__ */ +# endif /* ?__EMX__ */ +# endif /* ?WIN32 */ +# define HAVE_WORKING_GETCH +#endif /* DOS_H68_OS2_W32 */ + +#ifdef FLEXOS +# define echoff(f) +# define echon() +# define getch() getchar() /* not correct, but may not be on a console */ +# define HAVE_WORKING_GETCH +#endif + +/* For VM/CMS and MVS, we do not (yet) have any support to switch terminal + * input echo on and off. The following "fake" definitions allow inclusion + * of crypt support and UnZip's "pause prompting" features, but without + * any echo suppression. + */ +#ifdef CMS_MVS +# define echoff(f) +# define echon() +#endif + +/* VMS has a single echo() function in ttyio.c to toggle terminal + * input echo on and off. + */ +#ifdef VMS +# define echoff(f) echo(0) +# define echon() echo(1) + int echo OF((int)); +#endif + +/* For all other systems, ttyio.c supplies the two functions Echoff() and + * Echon() for suppressing and (re)enabling console input echo. + */ +#ifndef echoff +# define echoff(f) Echoff(__G__ f) +# define echon() Echon(__G) + void Echoff OF((__GPRO__ int f)); + void Echon OF((__GPRO)); +#endif + +/* this stuff is used by MORE and also now by the ctrl-S code; fileio.c only */ +#if (defined(UNZIP) && !defined(FUNZIP)) +# ifdef HAVE_WORKING_GETCH +# define FGETCH(f) getch() +# endif +# ifndef FGETCH + /* default for all systems where no getch()-like function is available */ + int zgetch OF((__GPRO__ int f)); +# define FGETCH(f) zgetch(__G__ f) +# endif +#endif /* UNZIP && !FUNZIP */ + +#if (CRYPT && !defined(WINDLL)) + char *getp OF((__GPRO__ ZCONST char *m, char *p, int n)); +#endif + +#else /* !(CRYPT || (UNZIP && !FUNZIP)) */ + +/* + * No need for non-echo keyboard/console input; provide dummy definitions. + */ +#define echoff(f) +#define echon() + +#endif /* ?(CRYPT || (UNZIP && !FUNZIP)) */ + +#endif /* !__ttyio_h */ diff --git a/utils/Install/inczip/unzip.h b/utils/Install/inczip/unzip.h new file mode 100644 index 0000000000..5aa56a4160 --- /dev/null +++ b/utils/Install/inczip/unzip.h @@ -0,0 +1,548 @@ +/*--------------------------------------------------------------------------- + + unzip.h (new) + + This header file contains the public macros and typedefs required by + both the UnZip sources and by any application using the UnZip API. If + UNZIP_INTERNAL is defined, it includes unzpriv.h (containing includes, + prototypes and extern variables used by the actual UnZip sources). + + ---------------------------------------------------------------------------*/ + + +#ifndef __unzip_h /* prevent multiple inclusions */ +#define __unzip_h + +/*--------------------------------------------------------------------------- + Predefined, machine-specific macros. + ---------------------------------------------------------------------------*/ + +#ifdef __GO32__ /* MS-DOS extender: NOT Unix */ +# ifdef unix +# undef unix +# endif +# ifdef __unix +# undef __unix +# endif +# ifdef __unix__ +# undef __unix__ +# endif +#endif + +#if ((defined(__convex__) || defined(__convexc__)) && !defined(CONVEX)) +# define CONVEX +#endif + +#if (defined(unix) || defined(__unix) || defined(__unix__)) +# ifndef UNIX +# define UNIX +# endif +#endif /* unix || __unix || __unix__ */ +#if (defined(M_XENIX) || defined(COHERENT) || defined(__hpux)) +# ifndef UNIX +# define UNIX +# endif +#endif /* M_XENIX || COHERENT || __hpux */ +#if (defined(CONVEX) || defined(MINIX) || defined(_AIX) || defined(__QNX__)) +# ifndef UNIX +# define UNIX +# endif +#endif /* CONVEX || MINIX || _AIX || __QNX__ */ + +#if (defined(VM_CMS) || defined(MVS)) +# define CMS_MVS +#endif + +#if (defined(__OS2__) && !defined(OS2)) +# define OS2 +#endif + +#if (defined(__TANDEM) && !defined(TANDEM)) +# define TANDEM +#endif + +#if (defined(__VMS) && !defined(VMS)) +# define VMS +#endif + +#if ((defined(__WIN32__) || defined(_WIN32)) && !defined(WIN32)) +# define WIN32 +#endif +#if ((defined(__WINNT__) || defined(__WINNT)) && !defined(WIN32)) +# define WIN32 +#endif + +#ifdef __COMPILER_KCC__ +# include <c-env.h> +# ifdef SYS_T20 +# define TOPS20 +# endif +#endif /* __COMPILER_KCC__ */ + +/* Borland C does not define __TURBOC__ if compiling for a 32-bit platform */ +#ifdef __BORLANDC__ +# ifndef __TURBOC__ +# define __TURBOC__ +# endif +# if (!defined(__MSDOS__) && !defined(OS2) && !defined(WIN32)) +# define __MSDOS__ +# endif +#endif + +/* define MSDOS for Turbo C (unless OS/2) and Power C as well as Microsoft C */ +#ifdef __POWERC +# define __TURBOC__ +# define MSDOS +#endif /* __POWERC */ + +#if (defined(__MSDOS__) && !defined(MSDOS)) /* just to make sure */ +# define MSDOS +#endif + +/* RSXNTDJ (at least up to v1.3) compiles for WIN32 (RSXNT) using a derivate + of the EMX environment, but defines MSDOS and __GO32__. ARG !!! */ +#if (defined(MSDOS) && defined(WIN32)) +# undef MSDOS /* WIN32 is >>>not<<< MSDOS */ +#endif +#if (defined(__GO32__) && defined(__EMX__) && defined(__RSXNT__)) +# undef __GO32__ +#endif + +#if (defined(linux) && !defined(LINUX)) +# define LINUX +#endif + +#ifdef __riscos +# define RISCOS +#endif + +#if (defined(THINK_C) || defined(MPW)) +# define MACOS +#endif +#if (defined(__MWERKS__) && defined(macintosh)) +# define MACOS +#endif + +/* use prototypes and ANSI libraries if __STDC__, or Microsoft or Borland C, or + * Silicon Graphics, or Convex?, or IBM C Set/2, or GNU gcc/emx, or Watcom C, + * or Macintosh, or Windows NT, or Sequent, or Atari or IBM RS/6000. + */ +#if (defined(__STDC__) || defined(MSDOS) || defined(WIN32) || defined(__EMX__)) +# ifndef PROTO +# define PROTO +# endif +# ifndef MODERN +# define MODERN +# endif +#endif +#if (defined(__IBMC__) || defined(__BORLANDC__) || defined(__WATCOMC__)) +# ifndef PROTO +# define PROTO +# endif +# ifndef MODERN +# define MODERN +# endif +#endif +#if (defined(MACOS) || defined(ATARI_ST) || defined(RISCOS)) +# ifndef PROTO +# define PROTO +# endif +# ifndef MODERN +# define MODERN +# endif +#endif +/* Sequent running Dynix/ptx: non-modern compiler */ +#if (defined(_AIX) || defined(sgi) || (defined(_SEQUENT_) && !defined(PTX))) +# ifndef PROTO +# define PROTO +# endif +# ifndef MODERN +# define MODERN +# endif +#endif +#if (defined(CMS_MVS) || defined(__BEOS__)) /* || defined(CONVEX) */ +# ifndef PROTO +# define PROTO +# endif +# ifndef MODERN +# define MODERN +# endif +#endif + +/* turn off prototypes if requested */ +#if (defined(NOPROTO) && defined(PROTO)) +# undef PROTO +#endif + +/* used to remove arguments in function prototypes for non-ANSI C */ +#ifdef PROTO +# define OF(a) a +#else +# define OF(a) () +#endif + +/* enable the "const" keyword only if MODERN and if not otherwise instructed */ +#ifdef MODERN +# if (!defined(ZCONST) && (defined(USE_CONST) || !defined(NO_CONST))) +# define ZCONST const +# endif +#endif + +#ifndef ZCONST +# define ZCONST +#endif + + +/*--------------------------------------------------------------------------- + Grab system-specific public include headers. + ---------------------------------------------------------------------------*/ + +#ifdef POCKET_UNZIP /* WinCE port */ +# include "wince/punzip.h" /* must appear before windows.h */ +#endif + +#ifdef WINDLL +# include <windows.h> +# include "windll/structs.h" +#endif + +/*--------------------------------------------------------------------------- + Grab system-dependent definition of EXPENTRY for prototypes below. + ---------------------------------------------------------------------------*/ + +#if 0 +#if (defined(OS2) && !defined(FUNZIP)) +# ifdef UNZIP_INTERNAL +# define INCL_NOPM +# define INCL_DOSNLS +# define INCL_DOSPROCESS +# define INCL_DOSDEVICES +# define INCL_DOSDEVIOCTL +# define INCL_DOSERRORS +# define INCL_DOSMISC +# ifdef OS2DLL +# define INCL_REXXSAA +# include <rexxsaa.h> +# endif +# endif /* UNZIP_INTERNAL */ +# include <os2.h> +# define UZ_EXP EXPENTRY +#endif /* OS2 && !FUNZIP */ +#endif /* 0 */ + +#if (defined(OS2) && !defined(FUNZIP)) +# if (defined(__IBMC__) || defined(__WATCOMC__)) +# define UZ_EXP _System /* compiler keyword */ +# else +# define UZ_EXP +# endif +#endif /* OS2 && !FUNZIP */ + +#if (defined(WINDLL) || defined(USE_UNZIP_LIB)) +# ifndef EXPENTRY +# define UZ_EXP WINAPI +# else +# define UZ_EXP EXPENTRY +# endif +#endif + +#ifndef UZ_EXP +# define UZ_EXP +#endif + + +/*--------------------------------------------------------------------------- + Public typedefs. + ---------------------------------------------------------------------------*/ + +#ifndef _IZ_TYPES_DEFINED +#ifdef MODERN + typedef void zvoid; +#else /* !MODERN */ +# ifndef AOS_VS /* mostly modern? */ +# ifndef VAXC /* not fully modern, but has knows 'void' */ +# define void int +# endif /* !VAXC */ +# endif /* !AOS_VS */ + typedef char zvoid; +#endif /* ?MODERN */ +typedef unsigned char uch; /* code assumes unsigned bytes; these type- */ +typedef unsigned short ush; /* defs replace byte/UWORD/ULONG (which are */ +typedef unsigned long ulg; /* predefined on some systems) & match zip */ +#define _IZ_TYPES_DEFINED +#endif /* !_IZ_TYPES_DEFINED */ + +/* InputFn is not yet used and is likely to change: */ +#ifdef PROTO + typedef int (UZ_EXP MsgFn) (zvoid *pG, uch *buf, ulg size, int flag); + typedef int (UZ_EXP InputFn) (zvoid *pG, uch *buf, int *size, int flag); + typedef void (UZ_EXP PauseFn) (zvoid *pG, ZCONST char *prompt, int flag); + typedef int (UZ_EXP PasswdFn) (zvoid *pG, int *rcnt, char *pwbuf, + int size, ZCONST char *zfn, + ZCONST char *efn); + typedef int (UZ_EXP StatCBFn) (zvoid *pG, int fnflag, ZCONST char *zfn, + ZCONST char *efn, ZCONST zvoid *details); + typedef void (UZ_EXP UsrIniFn) (void); +#else /* !PROTO */ + typedef int (UZ_EXP MsgFn) (); + typedef int (UZ_EXP InputFn) (); + typedef void (UZ_EXP PauseFn) (); + typedef int (UZ_EXP PasswdFn) (); + typedef int (UZ_EXP StatCBFn) (); + typedef void (UZ_EXP UsrIniFn) (); +#endif /* ?PROTO */ + +typedef struct _UzpBuffer { /* rxstr */ + ulg strlength; /* length of string */ + char *strptr; /* pointer to string */ +} UzpBuffer; + +typedef struct _UzpInit { + ulg structlen; /* length of the struct being passed */ + + /* GRR: can we assume that each of these is a 32-bit pointer? if not, + * does it matter? add "far" keyword to make sure? */ + MsgFn *msgfn; + InputFn *inputfn; + PauseFn *pausefn; + UsrIniFn *userfn; /* user init function to be called after */ + /* globals constructed and initialized */ + + /* pointer to program's environment area or something? */ + /* hooks for performance testing? */ + /* hooks for extra unzip -v output? (detect CPU or other hardware?) */ + /* anything else? let me (Greg) know... */ +} UzpInit; + +typedef struct _UzpCB { + ulg structlen; /* length of the struct being passed */ + /* GRR: can we assume that each of these is a 32-bit pointer? if not, + * does it matter? add "far" keyword to make sure? */ + MsgFn *msgfn; + InputFn *inputfn; + PauseFn *pausefn; + PasswdFn *passwdfn; + StatCBFn *statrepfn; +} UzpCB; + +/* the collection of general UnZip option flags and option arguments */ +typedef struct _UzpOpts { +#ifndef FUNZIP + char *exdir; /* pointer to extraction root directory (-d option) */ + char *pwdarg; /* pointer to command-line password (-P option) */ + int zipinfo_mode; /* behave like ZipInfo or like normal UnZip? */ + int aflag; /* -a: do ASCII-EBCDIC and/or end-of-line translation */ +#ifdef VMS + int bflag; /* -b: force fixed record format for binary files */ +#endif +#ifdef UNIXBACKUP + int B_flag; /* -B: back up existing files by renaming to *~ first */ +#endif + int cflag; /* -c: output to stdout */ + int C_flag; /* -C: match filenames case-insensitively */ +#ifdef MACOS + int E_flag; /* -E: [MacOS] show Mac extra field during restoring */ +#endif + int fflag; /* -f: "freshen" (extract only newer files) */ +#if (defined(RISCOS) || defined(ACORN_FTYPE_NFS)) + int acorn_nfs_ext; /* -F: RISC OS types & NFS filetype extensions */ +#endif + int hflag; /* -h: header line (zipinfo) */ +#ifdef MACOS + int i_flag; /* -i: [MacOS] ignore filenames stored in Mac e.f. */ +#endif +#ifdef RISCOS + int scanimage; /* -I: scan image files */ +#endif + int jflag; /* -j: junk pathnames (unzip) */ +#if (defined(__BEOS__) || defined(MACOS)) + int J_flag; /* -J: ignore BeOS/MacOS extra field info (unzip) */ +#endif + int lflag; /* -12slmv: listing format (zipinfo) */ + int L_flag; /* -L: convert filenames from some OSes to lowercase */ + int overwrite_none; /* -n: never overwrite files (no prompting) */ +#ifdef AMIGA + int N_flag; /* -N: restore comments as AmigaDOS filenotes */ +#endif + int overwrite_all; /* -o: OK to overwrite files without prompting */ +#endif /* !FUNZIP */ + int qflag; /* -q: produce a lot less output */ +#ifndef FUNZIP +#if (defined(MSDOS) || defined(FLEXOS) || defined(OS2) || defined(WIN32)) + int sflag; /* -s: convert spaces in filenames to underscores */ +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WIN32)) + int volflag; /* -$: extract volume labels */ +#endif + int tflag; /* -t: test (unzip) or totals line (zipinfo) */ + int T_flag; /* -T: timestamps (unzip) or dec. time fmt (zipinfo) */ + int uflag; /* -u: "update" (extract only newer/brand-new files) */ + int vflag; /* -v: (verbosely) list directory */ + int V_flag; /* -V: don't strip VMS version numbers */ +#if (defined(TANDEM) || defined(UNIX) || defined(VMS) || defined(__BEOS__)) + int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */ +#endif +#if (defined(OS2) || defined(WIN32)) + int X_flag; /* -X: restore owner/protection or UID/GID or ACLs */ +#endif + int zflag; /* -z: display the zipfile comment (only, for unzip) */ +#endif /* !FUNZIP */ +} UzpOpts; + +/* intended to be a private struct: */ +typedef struct _ver { + uch major; /* e.g., integer 5 */ + uch minor; /* e.g., 2 */ + uch patchlevel; /* e.g., 0 */ + uch not_used; +} _version_type; + +typedef struct _UzpVer { + ulg structlen; /* length of the struct being passed */ + ulg flag; /* bit 0: is_beta bit 1: uses_zlib */ + char *betalevel; /* e.g., "g BETA" or "" */ + char *date; /* e.g., "4 Sep 95" (beta) or "4 September 1995" */ + char *zlib_version; /* e.g., "0.95" or NULL */ + _version_type unzip; + _version_type zipinfo; + _version_type os2dll; + _version_type windll; +} UzpVer; + +/* for Visual BASIC access to Windows DLLs: */ +typedef struct _UzpVer2 { + ulg structlen; /* length of the struct being passed */ + ulg flag; /* bit 0: is_beta bit 1: uses_zlib */ + char betalevel[10]; /* e.g., "g BETA" or "" */ + char date[20]; /* e.g., "4 Sep 95" (beta) or "4 September 1995" */ + char zlib_version[10]; /* e.g., "0.95" or NULL */ + _version_type unzip; + _version_type zipinfo; + _version_type os2dll; + _version_type windll; +} UzpVer2; + +typedef struct central_directory_file_header { /* CENTRAL */ + uch version_made_by[2]; + uch version_needed_to_extract[2]; + ush general_purpose_bit_flag; + ush compression_method; + ulg last_mod_dos_datetime; + ulg crc32; + ulg csize; + ulg ucsize; + ush filename_length; + ush extra_field_length; + ush file_comment_length; + ush disk_number_start; + ush internal_file_attributes; + ulg external_file_attributes; + ulg relative_offset_local_header; +} cdir_file_hdr; + + +#define UZPINIT_LEN sizeof(UzpInit) +#define UZPVER_LEN sizeof(UzpVer) +#define cbList(func) int (* UZ_EXP func)(char *filename, cdir_file_hdr *crec) + + +/*--------------------------------------------------------------------------- + Return (and exit) values of the public UnZip API functions. + ---------------------------------------------------------------------------*/ + +/* external return codes */ +#define PK_OK 0 /* no error */ +#define PK_COOL 0 /* no error */ +#define PK_GNARLY 0 /* no error */ +#define PK_WARN 1 /* warning error */ +#define PK_ERR 2 /* error in zipfile */ +#define PK_BADERR 3 /* severe error in zipfile */ +#define PK_MEM 4 /* insufficient memory (during initialization) */ +#define PK_MEM2 5 /* insufficient memory (password failure) */ +#define PK_MEM3 6 /* insufficient memory (file decompression) */ +#define PK_MEM4 7 /* insufficient memory (memory decompression) */ +#define PK_MEM5 8 /* insufficient memory (not yet used) */ +#define PK_NOZIP 9 /* zipfile not found */ +#define PK_PARAM 10 /* bad or illegal parameters specified */ +#define PK_FIND 11 /* no files found */ +#define PK_DISK 50 /* disk full */ +#define PK_EOF 51 /* unexpected EOF */ + +#define IZ_CTRLC 80 /* user hit ^C to terminate */ +#define IZ_UNSUP 81 /* no files found: all unsup. compr/encrypt. */ +#define IZ_BADPWD 82 /* no files found: all had bad password */ + +/* internal and DLL-only return codes */ +#define IZ_DIR 76 /* potential zipfile is a directory */ +#define IZ_CREATED_DIR 77 /* directory created: set time and permissions */ +#define IZ_VOL_LABEL 78 /* volume label, but can't set on hard disk */ +#define IZ_EF_TRUNC 79 /* local extra field truncated (PKZIP'd) */ + +/* return codes of password fetches (negative = user abort; positive = error) */ +#define IZ_PW_ENTERED 0 /* got some password string; use/try it */ +#define IZ_PW_CANCEL -1 /* no password available (for this entry) */ +#define IZ_PW_CANCELALL -2 /* no password, skip any further pwd. request */ +#define IZ_PW_ERROR 5 /* = PK_MEM2 : failure (no mem, no tty, ...) */ + +/* flag values for status callback function */ +#define UZ_ST_START_EXTRACT 1 +#define UZ_ST_IN_PROGRESS 2 +#define UZ_ST_FINISH_MEMBER 3 + +/* return values of status callback function */ +#define UZ_ST_CONTINUE 0 +#define UZ_ST_BREAK 1 + + +/*--------------------------------------------------------------------------- + Prototypes for public UnZip API (DLL) functions. + ---------------------------------------------------------------------------*/ + +#define UzpMatch match + +int UZ_EXP UzpMain OF((int argc, char **argv)); +int UZ_EXP UzpAltMain OF((int argc, char **argv, UzpInit *init)); +UzpVer * UZ_EXP UzpVersion OF((void)); +void UZ_EXP UzpFreeMemBuffer OF((UzpBuffer *retstr)); +#ifndef WINDLL +int UZ_EXP UzpUnzipToMemory OF((char *zip, char *file, UzpOpts *optflgs, + UzpCB *UsrFunc, UzpBuffer *retstr)); +#endif +#ifndef WINDLL + int UZ_EXP UzpGrep OF((char *archive, char *file, + char *pattern, int cmd, int SkipBin, + UzpCB *UsrFunc)); +#endif +#ifdef OS2 +int UZ_EXP UzpFileTree OF((char *name, cbList(callBack), + char *cpInclude[], char *cpExclude[])); +#endif + +void UZ_EXP UzpVersion2 OF((UzpVer2 *version)); +int UZ_EXP UzpValidate OF((char *archive, int AllCodes)); + + +/* default I/O functions (can be swapped out via UzpAltMain() entry point): */ + +int UZ_EXP UzpMessagePrnt OF((zvoid *pG, uch *buf, ulg size, int flag)); +int UZ_EXP UzpMessageNull OF((zvoid *pG, uch *buf, ulg size, int flag)); +int UZ_EXP UzpInput OF((zvoid *pG, uch *buf, int *size, int flag)); +void UZ_EXP UzpMorePause OF((zvoid *pG, ZCONST char *prompt, int flag)); +int UZ_EXP UzpPassword OF((zvoid *pG, int *rcnt, char *pwbuf, + int size, ZCONST char *zfn, + ZCONST char *efn)); + + +/*--------------------------------------------------------------------------- + Remaining private stuff for UnZip compilation. + ---------------------------------------------------------------------------*/ + +#ifdef UNZIP_INTERNAL +# include "unzpriv.h" +#endif + +int pipeit(char *format, ...); +int pipeit2(char *format, int flag, ...); +int confirm(char *format, ...); + +#endif /* !__unzip_h */ diff --git a/utils/Install/inczip/unzpriv.h b/utils/Install/inczip/unzpriv.h new file mode 100644 index 0000000000..e4108c5281 --- /dev/null +++ b/utils/Install/inczip/unzpriv.h @@ -0,0 +1,2384 @@ +/*--------------------------------------------------------------------------- + + unzpriv.h + + This header file contains private (internal) macros, typedefs, prototypes + and global-variable declarations used by all of the UnZip source files. + In a prior life it was part of the main unzip.h header, but now it is only + included by that header if UNZIP_INTERNAL is defined. + + ---------------------------------------------------------------------------*/ + + + +#ifndef __unzpriv_h /* prevent multiple inclusions */ +#define __unzpriv_h + +/* First thing: Signal all following code that we compile UnZip utilities! */ +#ifndef UNZIP +# define UNZIP +#endif + +/* GRR 960204: MORE defined here in preparation for removal altogether */ +#ifndef MORE +# define MORE +#endif + +/* fUnZip should never need to be reentrant */ +#ifdef FUNZIP +# ifdef REENTRANT +# undef REENTRANT +# endif +# ifdef DLL +# undef DLL +# endif +#endif + +#if (defined(DLL) && !defined(REENTRANT)) +# define REENTRANT +#endif + +#if (!defined(DYNAMIC_CRC_TABLE) && !defined(FUNZIP)) +# define DYNAMIC_CRC_TABLE +#endif + +#if (defined(DYNAMIC_CRC_TABLE) && !defined(REENTRANT)) +# ifndef DYNALLOC_CRCTAB +# define DYNALLOC_CRCTAB +# endif +#endif + +/*--------------------------------------------------------------------------- + OS-dependent configuration for UnZip internals + ---------------------------------------------------------------------------*/ + +/* bad or (occasionally?) missing stddef.h: */ +#if (defined(M_XENIX) || defined(DNIX)) +# define NO_STDDEF_H +#endif + +#if (defined(M_XENIX) && !defined(M_UNIX)) /* SCO Xenix only, not SCO Unix */ +# define SCO_XENIX +# define NO_LIMITS_H /* no limits.h, but MODERN defined */ +# define NO_UID_GID /* no uid_t/gid_t */ +# define size_t int +#endif + +#ifdef realix /* Modcomp Real/IX, real-time SysV.3 variant */ +# define SYSV +# define NO_UID_GID /* no uid_t/gid_t */ +#endif + +#if (defined(_AIX) && !defined(_ALL_SOURCE)) +# define _ALL_SOURCE +#endif + +#if defined(apollo) /* defines __STDC__ */ +# define NO_STDLIB_H +#endif + +#ifdef DNIX +# define SYSV +# define SHORT_NAMES /* 14-char limitation on path components */ +/* # define FILENAME_MAX 14 */ +# define FILENAME_MAX NAME_MAX /* GRR: experiment */ +#endif + +#if (defined(SYSTEM_FIVE) || defined(__SYSTEM_FIVE)) +# ifndef SYSV +# define SYSV +# endif +#endif /* SYSTEM_FIVE || __SYSTEM_FIVE */ +#if (defined(M_SYSV) || defined(M_SYS5)) +# ifndef SYSV +# define SYSV +# endif +#endif /* M_SYSV || M_SYS5 */ +/* __SVR4 and __svr4__ catch Solaris on at least some combos of compiler+OS */ +#if (defined(__SVR4) || defined(__svr4__) || defined(sgi) || defined(__hpux)) +# ifndef SYSV +# define SYSV +# endif +#endif /* __SVR4 || __svr4__ || sgi || __hpux */ +#if (defined(LINUX) || defined(__QNX__)) +# ifndef SYSV +# define SYSV +# endif +#endif /* LINUX || __QNX__ */ + +#if (defined(ultrix) || defined(__ultrix) || defined(bsd4_2)) +# if (!defined(BSD) && !defined(SYSV)) +# define BSD +# endif +#endif /* ultrix || __ultrix || bsd4_2 */ +#if (defined(sun) || defined(pyr) || defined(CONVEX)) +# if (!defined(BSD) && !defined(SYSV)) +# define BSD +# endif +#endif /* sun || pyr || CONVEX */ + +#ifdef pyr /* Pyramid: has BSD and AT&T "universes" */ +# ifdef BSD +# define pyr_bsd +# define USE_STRINGS_H /* instead of more common string.h */ +# define ZMEM /* ZMEM now uses bcopy/bzero: not in AT&T universe */ +# endif /* (AT&T memcpy claimed to be very slow, though) */ +# define DECLARE_ERRNO +#endif /* pyr */ + +/* stat() bug for Borland, VAX C (also GNU?), and Atari ST MiNT on TOS + * filesystems: returns 0 for wildcards! (returns 0xffffffff on Minix + * filesystem or `U:' drive under Atari MiNT.) Watcom C was previously + * included on this list; it would be good to know what version the problem + * was fixed at, if it did exist. Watcom 10.6 has a separate stat() problem: + * it fails on "." when the current directory is a root. This is covered by + * giving it a separate definition of SSTAT in OS-specific header files. */ +#if (defined(__TURBOC__) || defined(VMS) || defined(__MINT__)) +# define WILD_STAT_BUG +#endif + +#ifdef WILD_STAT_BUG +# define SSTAT(path,pbuf) (iswild(path) || stat(path,pbuf)) +#else +# define SSTAT stat +#endif + +#ifdef REGULUS /* returns the inode number on success(!)...argh argh argh */ +# define stat(p,s) zstat((p),(s)) +#endif + +#define STRNICMP zstrnicmp + +/*--------------------------------------------------------------------------- + OS-dependent includes + ---------------------------------------------------------------------------*/ + +#ifdef EFT +# define LONGINT off_t /* Amdahl UTS nonsense ("extended file types") */ +#else +# define LONGINT long +#endif + +#ifdef MODERN +# ifndef NO_STDDEF_H +# include <stddef.h> +# endif +# ifndef NO_STDLIB_H +# include <stdlib.h> /* standard library prototypes, malloc(), etc. */ +# endif + typedef size_t extent; +#else /* !MODERN */ +# ifndef AOS_VS /* mostly modern? */ + LONGINT lseek(); +# ifdef VAXC /* not fully modern, but does have stdlib.h and void */ +# include <stdlib.h> +# else + char *malloc(); +# endif /* ?VAXC */ +# endif /* !AOS_VS */ + typedef unsigned int extent; +#endif /* ?MODERN */ + + +#ifndef MINIX /* Minix needs it after all the other includes (?) */ +# include <stdio.h> +#endif +#include <ctype.h> /* skip for VMS, to use tolower() function? */ +#include <errno.h> /* used in mapname() */ +#ifdef USE_STRINGS_H +# include <strings.h> /* strcpy, strcmp, memcpy, index/rindex, etc. */ +#else +# include <string.h> /* strcpy, strcmp, memcpy, strchr/strrchr, etc. */ +#endif +#if (defined(MODERN) && !defined(NO_LIMITS_H)) +# include <limits.h> /* GRR: EXPERIMENTAL! (can be deleted) */ +#endif + +/* this include must be down here for SysV.4, for some reason... */ +#include <signal.h> /* used in unzip.c, fileio.c */ + + +/*--------------------------------------------------------------------------- + API (DLL) section: + ---------------------------------------------------------------------------*/ + +#ifdef DLL +# define MAIN UZ_EXP UzpMain /* was UzpUnzip */ +# ifdef OS2DLL +# undef Info +# define REDIRECTC(c) varputchar(__G__ c) +# define REDIRECTPRINT(buf,size) varmessage(__G__ buf, size) +# define FINISH_REDIRECT() finish_REXX_redirect(__G) +# else +# define REDIRECTC(c) +# define REDIRECTPRINT(buf,size) 0 +# define FINISH_REDIRECT() close_redirect(__G) +# endif +#endif + +/*--------------------------------------------------------------------------- + Acorn RISCOS section: + ---------------------------------------------------------------------------*/ + +#ifdef RISCOS +# include "acorn/riscos.h" +#endif + +/*--------------------------------------------------------------------------- + Amiga section: + ---------------------------------------------------------------------------*/ + +#ifdef AMIGA +# include "amiga/amiga.h" +#endif + +/*--------------------------------------------------------------------------- + AOS/VS section (somewhat similar to Unix, apparently): + ---------------------------------------------------------------------------*/ + +#ifdef AOS_VS +# ifdef FILEIO_C +# include "aosvs/aosvs.h" +# endif +#endif + +/*--------------------------------------------------------------------------- + Atari ST section: + ---------------------------------------------------------------------------*/ + +#ifdef ATARI +# include <time.h> +# include <stat.h> +# include <fcntl.h> +# include <limits.h> +# define SYMLINKS +# define EXE_EXTENSION ".tos" +# ifndef DATE_FORMAT +# define DATE_FORMAT DF_DMY +# endif +# define DIR_END '/' +# define INT_SPRINTF +# define timezone _timezone +# define lenEOL 2 +# define PutNativeEOL {*q++ = native(CR); *q++ = native(LF);} +# undef SHORT_NAMES +# if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP)) +# define TIMESTAMP +# endif +#endif + +/*--------------------------------------------------------------------------- + BeOS section: + ---------------------------------------------------------------------------*/ + +#ifdef __BEOS__ +# include <sys/types.h> /* [cjh]: This is pretty much a generic */ +# include <sys/stat.h> /* POSIX 1003.1 system; see beos/ for */ +# include <fcntl.h> /* extra code to deal with our extra file */ +# include <sys/param.h> /* attributes. */ +# include <unistd.h> +# include <utime.h> +# define DIRENT +# include <time.h> +# ifndef DATE_FORMAT +# define DATE_FORMAT DF_MDY /* GRR: customize with locale.h somehow? */ +# endif +# define lenEOL 1 +# define PutNativeEOL *q++ = native(LF); +# define SCREENLINES screenlines() +# define USE_EF_UT_TIME +# define SET_DIR_ATTRIB +# if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP)) +# define TIMESTAMP +# endif +# define RESTORE_UIDGID +# define NO_GMTIME /* maybe DR10 will have timezones... */ +# define INT_SPRINTF +# define SYMLINKS +# define MAIN main_stub /* now that we're using a wrapper... */ +#endif + +/*--------------------------------------------------------------------------- + Human68k/X68000 section: + ---------------------------------------------------------------------------*/ + +#ifdef __human68k__ /* DO NOT DEFINE DOS_OS2 HERE! If Human68k is so much */ +# include <time.h> /* like MS-DOS and/or OS/2, create DOS_H68_OS2 macro. */ +# include <fcntl.h> +# include <io.h> +# include <conio.h> +# include <jctype.h> +# include <sys/stat.h> +# ifndef DATE_FORMAT +# define DATE_FORMAT DF_YMD /* Japanese standard */ +# endif + /* GRR: these EOL macros are guesses */ +# define lenEOL 2 +# define PutNativeEOL {*q++ = native(CR); *q++ = native(LF);} +# define EXE_EXTENSION ".exe" /* just a guess... */ +#endif + +/*--------------------------------------------------------------------------- + Mac section: + ---------------------------------------------------------------------------*/ + +#ifdef MACOS +# include "maccfg.h" +#endif /* MACOS */ + +/*--------------------------------------------------------------------------- + MS-DOS, OS/2, FLEXOS section: + ---------------------------------------------------------------------------*/ + +#ifdef WINDLL +# define MSWIN +# ifdef MORE +# undef MORE +# endif +# ifdef OS2_EAS +# undef OS2_EAS +# endif +#endif + +#if (defined(_MSC_VER) || (defined(M_I86) && !defined(__WATCOMC__))) +# ifndef MSC +# define MSC /* This should work for older MSC, too! */ +# endif +#endif + +#if (defined(MSDOS) || defined(OS2) || defined(FLEXOS)) +# include <sys/types.h> /* off_t, time_t, dev_t, ... */ +# include <sys/stat.h> +# include <io.h> /* lseek(), open(), setftime(), dup(), creat() */ +# include <time.h> /* localtime() */ +# include <fcntl.h> /* O_BINARY for open() w/o CR/LF translation */ + +# ifdef OS2 /* defined for all OS/2 compilers */ +# include "os2/os2cfg.h" +# else +# ifdef FLEXOS +# include "flexos/flxcfg.h" +# else +# include "msdos/doscfg.h" +# endif +# endif + +# if (defined(_MSC_VER) && (_MSC_VER == 700) && !defined(GRR)) + /* + * ARGH. MSC 7.0 libraries think times are based on 1899 Dec 31 00:00, not + * 1970 Jan 1 00:00. So we have to diddle time_t's appropriately: add or + * subtract 70 years' worth of seconds; i.e., number of days times 86400; + * i.e., (70*365 regular days + 17 leap days + 1 1899 day) * 86400 == + * (25550 + 17 + 1) * 86400 == 2209075200 seconds. We know time_t is an + * unsigned long (ulg) on the only system with this bug. + */ +# define TIMET_TO_NATIVE(x) (x) += (ulg)2209075200L; +# define NATIVE_TO_TIMET(x) (x) -= (ulg)2209075200L; +# endif +# if (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0450)) +# define timezone _timezone +# endif +# if (defined(__GO32__) || defined(FLEXOS)) +# define DIR_END '/' +# else +# define DIR_END '\\' /* OS uses '\\' as directory separator */ +# define DIR_END2 '/' /* also check for '/' (RTL may convert) */ +# endif +# ifndef WIN32 +# ifdef DATE_FORMAT +# undef DATE_FORMAT +# endif +# define DATE_FORMAT dateformat() +# endif +# define lenEOL 2 +# define PutNativeEOL {*q++ = native(CR); *q++ = native(LF);} +# define USE_EF_UT_TIME +#endif /* MSDOS || OS2 || FLEXOS */ + +/*--------------------------------------------------------------------------- + MTS section (piggybacks UNIX, I think): + ---------------------------------------------------------------------------*/ + +#ifdef MTS +# include <sys/types.h> /* off_t, time_t, dev_t, ... */ +# include <sys/stat.h> +# include <sys/file.h> /* MTS uses this instead of fcntl.h */ +# include <timeb.h> +# include <time.h> +# include <unix.h> /* some important non-ANSI routines */ +# define mkdir(s,n) (-1) /* no "make directory" capability */ +# define EBCDIC /* set EBCDIC conversion on */ +# define NO_STRNICMP /* unzip's is as good the one in MTS */ +# define USE_FWRITE +# define close_outfile() fclose(G.outfile) /* can't set time on files */ +# define umask(n) /* don't have umask() on MTS */ +# define FOPWT "w" /* open file for writing in TEXT mode */ +# ifndef DATE_FORMAT +# define DATE_FORMAT DF_MDY +# endif +# define lenEOL 1 +# define PutNativeEOL *q++ = native(LF); +#endif /* MTS */ + + /*--------------------------------------------------------------------------- + QDOS section + ---------------------------------------------------------------------------*/ + +#ifdef QDOS +# define DIRENT +# include <fcntl.h> +# include <unistd.h> +# include <sys/stat.h> +# include <time.h> +# include "qdos/izqdos.h" +# ifndef DATE_FORMAT +# define DATE_FORMAT DF_MDY +# endif +# define lenEOL 1 +# define PutNativeEOL *q++ = native(LF); +# define DIR_END '_' +# define RETURN QReturn +# undef PATH_MAX +# define PATH_MAX 36 +# if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP)) +# define TIMESTAMP +# endif +#endif + +/*--------------------------------------------------------------------------- + Tandem NSK section: + ---------------------------------------------------------------------------*/ + +#ifdef TANDEM +# include "tandem.h" +# include <fcntl.h> + /* use a single LF delimiter so that writes to 101 text files work */ +# define PutNativeEOL *q++ = native(LF); +# define lenEOL 1 +# ifndef DATE_FORMAT +# define DATE_FORMAT DF_DMY +# endif +# define USE_EF_UT_TIME +# define RESTORE_UIDGID +#endif + +/*--------------------------------------------------------------------------- + TOPS-20 section: + ---------------------------------------------------------------------------*/ + +#ifdef TOPS20 +# include <sys/types.h> /* off_t, time_t, dev_t, ... */ +# include <sys/stat.h> +# include <sys/param.h> +# include <sys/time.h> +# include <sys/timeb.h> +# include <sys/file.h> +# include <timex.h> +# include <monsym.h> /* get amazing monsym() macro */ + extern int open(), close(), read(); + extern int stat(), unlink(), jsys(), fcntl(); + extern long lseek(), dup(), creat(); +# define strchr index /* GRR: necessary? */ +# define strrchr rindex +# define REALLY_SHORT_SYMS +# define NO_MKDIR +# define DIR_BEG '<' +# define DIR_END '>' +# define DIR_EXT ".directory" +# ifndef DATE_FORMAT +# define DATE_FORMAT DF_MDY +# endif +# define EXE_EXTENSION ".exe" /* just a guess... */ +#endif /* TOPS20 */ + +/*--------------------------------------------------------------------------- + Unix section: + ---------------------------------------------------------------------------*/ + +#ifdef UNIX +# include <sys/types.h> /* off_t, time_t, dev_t, ... */ +# include <sys/stat.h> + +# ifndef COHERENT +# include <fcntl.h> /* O_BINARY for open() w/o CR/LF translation */ +# else /* COHERENT */ +# ifdef _I386 +# include <fcntl.h> /* Coherent 4.0.x, Mark Williams C */ +# else +# include <sys/fcntl.h> /* Coherent 3.10, Mark Williams C */ +# endif +# define SHORT_SYMS +# ifndef __COHERENT__ /* Coherent 4.2 has tzset() */ +# define tzset settz +# endif +# endif /* ?COHERENT */ + +# ifndef NO_PARAM_H +# ifdef NGROUPS_MAX +# undef NGROUPS_MAX /* SCO bug: defined again in <sys/param.h> */ +# endif +# ifdef BSD +# define TEMP_BSD /* may be defined again in <sys/param.h> */ +# undef BSD +# endif +# include <sys/param.h> /* conflict with <sys/types.h>, some systems? */ +# ifdef TEMP_BSD +# undef TEMP_BSD +# ifndef BSD +# define BSD +# endif +# endif +# endif /* !NO_PARAM_H */ + +# ifdef __osf__ +# define DIRENT +# ifdef BSD +# undef BSD +# endif +# endif /* __osf__ */ + +# ifdef BSD +# include <sys/time.h> +# include <sys/timeb.h> +# ifdef _AIX +# include <time.h> +# endif +# else +# include <time.h> + struct tm *gmtime(), *localtime(); +# endif + +# if (defined(BSD4_4) || (defined(SYSV) && defined(MODERN))) +# include <unistd.h> /* this includes utime.h on SGIs */ +# if (defined(BSD4_4) || defined(linux)) +# include <utime.h> +# define GOT_UTIMBUF +# endif +# endif + +# if (defined(V7) || defined(pyr_bsd)) +# define strchr index +# define strrchr rindex +# endif +# ifdef V7 +# define O_RDONLY 0 +# define O_WRONLY 1 +# define O_RDWR 2 +# endif + +# ifdef MINIX +# include <stdio.h> +# endif +# ifndef DATE_FORMAT +# define DATE_FORMAT DF_MDY /* GRR: customize with locale.h somehow? */ +# endif +# define lenEOL 1 +# ifdef EBCDIC +# define PutNativeEOL *q++ = '\n'; +# else +# define PutNativeEOL *q++ = native(LF); +# endif +# define SCREENLINES screenlines() +# define USE_EF_UT_TIME +# define SET_DIR_ATTRIB +# if (!defined(TIMESTAMP) && !defined(NOTIMESTAMP)) /* GRR 970513 */ +# define TIMESTAMP +# endif +# define RESTORE_UIDGID +#endif /* UNIX */ + +/*--------------------------------------------------------------------------- + VM/CMS and MVS section: + ---------------------------------------------------------------------------*/ + +#ifdef CMS_MVS +# include "vmmvs.h" +# define CLOSE_INFILE() close_infile(__G) +#endif + +/*--------------------------------------------------------------------------- + VMS section: + ---------------------------------------------------------------------------*/ + +#ifdef VMS +# include <types.h> /* GRR: experimenting... */ +# include <stat.h> +# include <time.h> /* the usual non-BSD time functions */ +# include <file.h> /* same things as fcntl.h has */ +# include <unixio.h> +# include <rms.h> +# define _MAX_PATH (NAM$C_MAXRSS+1) /* to define FILNAMSIZ below */ +# ifdef RETURN_CODES /* VMS interprets standard PK return codes incorrectly */ +# define RETURN(ret) return_VMS(__G__ (ret)) /* verbose version */ +# define EXIT(ret) return_VMS(__G__ (ret)) +# else +# define RETURN return_VMS /* quiet version */ +# define EXIT return_VMS +# endif +# ifdef VMSCLI +# define USAGE(ret) VMSCLI_usage(__G__ (ret)) +# endif +# define DIR_BEG '[' +# define DIR_END ']' +# define DIR_EXT ".dir" +# ifndef DATE_FORMAT +# define DATE_FORMAT DF_MDY +# endif +# define lenEOL 1 +# define PutNativeEOL *q++ = native(LF); +# define SCREENLINES screenlines() +# if (defined(__VMS_VERSION) && !defined(VMS_VERSION)) +# define VMS_VERSION __VMS_VERSION +# endif +# if (defined(__VMS_VER) && !defined(__CRTL_VER)) +# define __CRTL_VER __VMS_VER +# endif +# if ((!defined(__CRTL_VER)) || (__CRTL_VER < 70000000)) +# define NO_GMTIME /* gmtime() of earlier VMS C RTLs is broken */ +# else +# if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME)) +# define USE_EF_UT_TIME +# endif +# endif +# if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP)) +# define TIMESTAMP +# endif +# define RESTORE_UIDGID +#endif /* VMS */ + +/*--------------------------------------------------------------------------- + Win32 (Windows 95/NT) section: + ---------------------------------------------------------------------------*/ + +#if (defined(WIN32) && !defined(POCKET_UNZIP)) +# include "w32cfg.h" +#endif + + + + + +/*************/ +/* Defines */ +/*************/ + +#define UNZIP_VERSION 20 /* compatible with PKUNZIP 2.0 */ +#define VMS_UNZIP_VERSION 42 /* if OS-needed-to-extract is VMS: can do */ + +#if (defined(MSDOS) || defined(OS2)) +# define DOS_OS2 +#endif + +#if (defined(OS2) || defined(WIN32)) +# define OS2_W32 +#endif + +#if (defined(DOS_OS2) || defined(WIN32)) +# define DOS_OS2_W32 +# define DOS_W32_OS2 /* historical: don't use */ +#endif + +#if (defined(DOS_OS2_W32) || defined(__human68k__)) +# define DOS_H68_OS2_W32 +#endif + +#if (defined(DOS_OS2) || defined(FLEXOS)) +# define DOS_FLX_OS2 +#endif + +#if (defined(DOS_OS2_W32) || defined(FLEXOS)) +# define DOS_FLX_OS2_W32 +#endif + +#if (defined(DOS_H68_OS2_W32) || defined(FLEXOS)) +# define DOS_FLX_H68_OS2_W32 +#endif + +#if (defined(TOPS20) || defined(VMS)) +# define T20_VMS +#endif + +#if (defined(MSDOS) || defined(T20_VMS)) +# define DOS_T20_VMS +#endif + +/* clean up with a few defaults */ +#ifndef DIR_END +# define DIR_END '/' /* last char before program name or filename */ +#endif +#ifndef DATE_FORMAT +# define DATE_FORMAT DF_MDY /* defaults to US convention */ +#endif +#ifndef CLOSE_INFILE +# define CLOSE_INFILE() close(G.zipfd) +#endif +#ifndef RETURN +# define RETURN return /* only used in main() */ +#endif +#ifndef EXIT +# define EXIT exit +#endif +#ifndef USAGE +# define USAGE(ret) usage(__G__ (ret)) /* used in unzip.c, zipinfo.c */ +#endif +#ifndef TIMET_TO_NATIVE /* everybody but MSC 7.0 and Macintosh */ +# define TIMET_TO_NATIVE(x) +# define NATIVE_TO_TIMET(x) +#endif + +#if (defined(DOS_FLX_OS2_W32) || defined(UNIX) || defined(RISCOS)) +# ifndef HAVE_UNLINK +# define HAVE_UNLINK +# endif +#endif +#if (defined(AOS_VS) || defined(ATARI) || defined(__BEOS__)) /* GRR: others? */ +# ifndef HAVE_UNLINK +# define HAVE_UNLINK +# endif +#endif + +/* OS-specific exceptions to the "ANSI <--> INT_SPRINTF" rule */ + +#if (!defined(PCHAR_SPRINTF) && !defined(INT_SPRINTF)) +# if (defined(SYSV) || defined(CONVEX) || defined(NeXT) || defined(BSD4_4)) +# define INT_SPRINTF /* sprintf() returns int: SysVish/Posix */ +# endif +# if (defined(DOS_FLX_OS2_W32) || defined(VMS) || defined(AMIGA)) +# define INT_SPRINTF /* sprintf() returns int: ANSI */ +# endif +# if (defined(ultrix) || defined(__ultrix)) /* Ultrix 4.3 and newer */ +# if (defined(POSIX) || defined(__POSIX)) +# define INT_SPRINTF /* sprintf() returns int: ANSI/Posix */ +# endif +# ifdef __GNUC__ +# define PCHAR_SPRINTF /* undetermined actual return value */ +# endif +# endif +# if (defined(__osf__) || defined(_AIX) || defined(CMS_MVS)) +# define INT_SPRINTF /* sprintf() returns int: ANSI/Posix */ +# endif +# if defined(sun) +# define PCHAR_SPRINTF /* sprintf() returns char *: SunOS cc *and* gcc */ +# endif +#endif + +/* defaults that we hope will take care of most machines in the future */ + +#if (!defined(PCHAR_SPRINTF) && !defined(INT_SPRINTF)) +# ifdef __STDC__ +# define INT_SPRINTF /* sprintf() returns int: ANSI */ +# endif +# ifndef INT_SPRINTF +# define PCHAR_SPRINTF /* sprintf() returns char *: BSDish */ +# endif +#endif + +#define MSG_STDERR(f) (f & 1) /* bit 0: 0 = stdout, 1 = stderr */ +#define MSG_INFO(f) ((f & 6) == 0) /* bits 1 and 2: 0 = info */ +#define MSG_WARN(f) ((f & 6) == 2) /* bits 1 and 2: 1 = warning */ +#define MSG_ERROR(f) ((f & 6) == 4) /* bits 1 and 2: 2 = error */ +#define MSG_FATAL(f) ((f & 6) == 6) /* bits 1 and 2: (3 = fatal error) */ +#define MSG_ZFN(f) (f & 0x0008) /* bit 3: 1 = print zipfile name */ +#define MSG_FN(f) (f & 0x0010) /* bit 4: 1 = print filename */ +#define MSG_LNEWLN(f) (f & 0x0020) /* bit 5: 1 = leading newline if !SOL */ +#define MSG_TNEWLN(f) (f & 0x0040) /* bit 6: 1 = trailing newline if !SOL */ +#define MSG_MNEWLN(f) (f & 0x0080) /* bit 7: 1 = trailing NL for prompts */ +/* the following are subject to change */ +#define MSG_NO_WGUI(f) (f & 0x0100) /* bit 8: 1 = skip if Windows GUI */ +#define MSG_NO_AGUI(f) (f & 0x0200) /* bit 9: 1 = skip if Acorn GUI */ +#define MSG_NO_DLL2(f) (f & 0x0400) /* bit 10: 1 = skip if OS/2 DLL */ +#define MSG_NO_NDLL(f) (f & 0x0800) /* bit 11: 1 = skip if WIN32 DLL */ +#define MSG_NO_WDLL(f) (f & 0x1000) /* bit 12: 1 = skip if Windows DLL */ + +#if (defined(MORE) && !defined(SCREENLINES)) +# ifdef DOS_FLX_OS2_W32 +# define SCREENLINES 25 /* can be (should be) a function instead */ +# else +# define SCREENLINES 24 /* VT-100s are assumed to be minimal hardware */ +# endif +#endif + +#define DIR_BLKSIZ 64 /* number of directory entries per block + * (should fit in 4096 bytes, usually) */ +#ifndef WSIZE +# define WSIZE 0x8000 /* window size--must be a power of two, and */ +#endif /* at least 32K for zip's deflate method */ + +#ifndef INBUFSIZ +# if (defined(MED_MEM) || defined(SMALL_MEM)) +# define INBUFSIZ 2048 /* works for MS-DOS small model */ +# else +# define INBUFSIZ 8192 /* larger buffers for real OSes */ +# endif +#endif + +#ifndef __16BIT__ +# define nearmalloc malloc +# define nearfree free +# if (!defined(__IBMC__) || !defined(OS2)) +# ifndef near +# define near +# endif +# ifndef far +# define far +# endif +# endif +#endif + +#if (defined(DYNALLOC_CRCTAB) && !defined(DYNAMIC_CRC_TABLE)) +# undef DYNALLOC_CRCTAB +#endif + +#if (defined(DYNALLOC_CRCTAB) && defined(REENTRANT)) +# undef DYNALLOC_CRCTAB /* not safe with reentrant code */ +#endif + +#if (defined(USE_ZLIB) && !defined(USE_OWN_CRCTAB)) +# ifdef DYNALLOC_CRCTAB +# undef DYNALLOC_CRCTAB +# endif +#endif + +#if (defined(USE_ZLIB) && defined(ASM_CRC)) +# undef ASM_CRC +#endif + +/* Logic for case of small memory, length of EOL > 1: if OUTBUFSIZ == 2048, + * OUTBUFSIZ>>1 == 1024 and OUTBUFSIZ>>7 == 16; therefore rawbuf is 1008 bytes + * and transbuf 1040 bytes. Have room for 32 extra EOL chars; 1008/32 == 31.5 + * chars/line, smaller than estimated 35-70 characters per line for C source + * and normal text. Hence difference is sufficient for most "average" files. + * (Argument scales for larger OUTBUFSIZ.) + */ +#ifdef SMALL_MEM /* i.e., 16-bit OSes: MS-DOS, OS/2 1.x, etc. */ +# define LoadFarString(x) fLoadFarString(__G__ (x)) +# define LoadFarStringSmall(x) fLoadFarStringSmall(__G__ (x)) +# define LoadFarStringSmall2(x) fLoadFarStringSmall2(__G__ (x)) +# if (defined(_MSC_VER) && (_MSC_VER >= 600)) +# define zfstrcpy(dest, src) _fstrcpy((dest), (src)) +# endif +# ifndef Far +# define Far far /* __far only works for MSC 6.00, not 6.0a or Borland */ +# endif +# define OUTBUFSIZ INBUFSIZ +# if (lenEOL == 1) +# define RAWBUFSIZ (OUTBUFSIZ>>1) +# else +# define RAWBUFSIZ ((OUTBUFSIZ>>1) - (OUTBUFSIZ>>7)) +# endif +# define TRANSBUFSIZ (OUTBUFSIZ-RAWBUFSIZ) + typedef short shrint; /* short/int or "shrink int" (unshrink) */ +#else +# define zfstrcpy(dest, src) strcpy((dest), (src)) +# ifdef QDOS +# define LoadFarString(x) Qstrfix(x) /* fix up _ for '.' */ +# define LoadFarStringSmall(x) Qstrfix(x) +# define LoadFarStringSmall2(x) Qstrfix(x) +# else +# define LoadFarString(x) x +# define LoadFarStringSmall(x) x +# define LoadFarStringSmall2(x) x +# endif +# ifdef MED_MEM +# define OUTBUFSIZ 0xFF80 /* can't malloc arrays of 0xFFE8 or more */ +# define TRANSBUFSIZ 0xFF80 + typedef short shrint; +# else +# define OUTBUFSIZ (lenEOL*WSIZE) /* more efficient text conversion */ +# define TRANSBUFSIZ (lenEOL*OUTBUFSIZ) +# ifdef AMIGA + typedef short shrint; +# else + typedef int shrint; /* for efficiency/speed, we hope... */ +# endif +# endif /* ?MED_MEM */ +# define RAWBUFSIZ OUTBUFSIZ +#endif /* ?SMALL_MEM */ + +#ifndef Far +# define Far +#endif + +#ifndef MAIN +# define MAIN main +#endif + +#ifdef SFX /* disable some unused features for SFX executables */ +# ifndef NO_ZIPINFO +# define NO_ZIPINFO +# endif +# ifdef TIMESTAMP +# undef TIMESTAMP +# endif +#endif + +/* user may have defined both by accident... NOTIMESTAMP takes precedence */ +#if (defined(TIMESTAMP) && defined(NOTIMESTAMP)) +# undef TIMESTAMP +#endif + +#if (!defined(COPYRIGHT_CLEAN) && !defined(USE_SMITH_CODE)) +# define COPYRIGHT_CLEAN +#endif + +#if (!defined(LZW_CLEAN) && !defined(USE_UNSHRINK)) +# define LZW_CLEAN +#endif + +#ifndef O_BINARY +# define O_BINARY 0 +#endif + +#ifndef PIPE_ERROR +# define PIPE_ERROR (errno == EPIPE) +#endif + +/* File operations--use "b" for binary if allowed or fixed length 512 on VMS */ +#ifdef VMS +# define FOPR "r","ctx=stm" +# define FOPM "r+","ctx=stm","rfm=fix","mrs=512" +# define FOPW "w","ctx=stm","rfm=fix","mrs=512" +#endif /* VMS */ + +#ifdef CMS_MVS +/* Binary files must be RECFM=F,LRECL=1 for ftell() to get correct pos */ +/* ...unless byteseek is used. Let's try that for a while. */ +# define FOPR "rb,byteseek" +# define FOPM "r+b,byteseek" +# define FOPW "wb,recfm=v,lrecl=32760" +# ifdef MVS +# define FOPWT "w,lrecl=133" +# else +# define FOPWT "w" +# endif +#endif /* CMS_MVS */ + +#ifdef TOPS20 /* TOPS-20 MODERN? You kidding? */ +# define FOPW "w8" +#endif /* TOPS20 */ + +/* Defaults when nothing special has been defined previously. */ +#ifdef MODERN +# ifndef FOPR +# define FOPR "rb" +# endif +# ifndef FOPM +# define FOPM "r+b" +# endif +# ifndef FOPW +# define FOPW "wb" +# endif +# ifndef FOPWT +# define FOPWT "wt" +# endif +#else /* !MODERN */ +# ifndef FOPR +# define FOPR "r" +# endif +# ifndef FOPM +# define FOPM "r+" +# endif +# ifndef FOPW +# define FOPW "w" +# endif +# ifndef FOPWT +# define FOPWT "w" +# endif +#endif /* ?MODERN */ + +/* + * If <limits.h> exists on most systems, should include that, since it may + * define some or all of the following: NAME_MAX, PATH_MAX, _POSIX_NAME_MAX, + * _POSIX_PATH_MAX. + */ +#ifdef DOS_FLX_OS2 +# include <limits.h> +#endif + +#ifndef PATH_MAX +# ifdef MAXPATHLEN +# define PATH_MAX MAXPATHLEN /* in <sys/param.h> on some systems */ +# else +# ifdef _MAX_PATH +# define PATH_MAX _MAX_PATH +# else +# if FILENAME_MAX > 255 +# define PATH_MAX FILENAME_MAX /* used like PATH_MAX on some systems */ +# else +# define PATH_MAX 1024 +# endif +# endif /* ?_MAX_PATH */ +# endif /* ?MAXPATHLEN */ +#endif /* !PATH_MAX */ + +#define FILNAMSIZ PATH_MAX + +#ifdef SHORT_SYMS /* Mark Williams C, ...? */ +# define extract_or_test_files xtr_or_tst_files +# define extract_or_test_member xtr_or_tst_member +#endif + +#ifdef REALLY_SHORT_SYMS /* TOPS-20 linker: first 6 chars */ +# define process_cdir_file_hdr XXpcdfh +# define process_local_file_hdr XXplfh +# define extract_or_test_files XXxotf /* necessary? */ +# define extract_or_test_member XXxotm /* necessary? */ +# define check_for_newer XXcfn +# define overwrite_all XXoa +# define process_all_files XXpaf +# define extra_field XXef +# define explode_lit8 XXel8 +# define explode_lit4 XXel4 +# define explode_nolit8 XXnl8 +# define explode_nolit4 XXnl4 +# define cpdist8 XXcpdist8 +# define inflate_codes XXic +# define inflate_stored XXis +# define inflate_fixed XXif +# define inflate_dynamic XXid +# define inflate_block XXib +# define maxcodemax XXmax +#endif + +#ifndef S_TIME_T_MAX /* max value of signed (>= 32-bit) time_t */ +# define S_TIME_T_MAX ((time_t)(ulg)0x7fffffffL) +#endif +#ifndef U_TIME_T_MAX /* max value of unsigned (>= 32-bit) time_t */ +# define U_TIME_T_MAX ((time_t)(ulg)0xffffffffL) +#endif +#ifdef DOSTIME_MINIMUM /* min DOSTIME value (1980-01-01) */ +# undef DOSTIME_MINIMUM +#endif +#define DOSTIME_MINIMUM ((ulg)0x00210000L) +#ifdef DOSTIME_2038_01_18 /* approximate DOSTIME equivalent of */ +# undef DOSTIME_2038_01_18 /* the signed-32-bit time_t limit */ +#endif +#define DOSTIME_2038_01_18 ((ulg)0x74320000L) + +#ifdef QDOS +# define ZSUFX "_zip" +# define ALT_ZSUFX ".zip" +#else +# ifdef RISCOS +# define ZSUFX "/zip" +# else +# define ZSUFX ".zip" +# endif +# define ALT_ZSUFX ".ZIP" /* Unix-only so far (only case-sensitive fs) */ +#endif + +#define CENTRAL_HDR_SIG "\001\002" /* the infamous "PK" signature bytes, */ +#define LOCAL_HDR_SIG "\003\004" /* sans "PK" (so unzip executable not */ +#define END_CENTRAL_SIG "\005\006" /* mistaken for zipfile itself) */ +#define EXTD_LOCAL_SIG "\007\010" /* [ASCII "\113" == EBCDIC "\080" ??] */ + +/* choice of activities for do_string() */ +#define SKIP 0 /* skip header block */ +#define DISPLAY 1 /* display archive comment (ASCII) */ +#define DISPL_8 5 /* display file comment (ext. ASCII) */ +#define DS_FN 2 /* read filename (ext. ASCII) */ +#define EXTRA_FIELD 3 /* copy extra field into buffer */ +#define DS_EF 3 +#ifdef AMIGA +# define FILENOTE 4 +#endif + +#define DOES_NOT_EXIST -1 /* return values for check_for_newer() */ +#define EXISTS_AND_OLDER 0 +#define EXISTS_AND_NEWER 1 + +#define ROOT 0 /* checkdir() extract-to path: called once */ +#define INIT 1 /* allocate buildpath: called once per member */ +#define APPEND_DIR 2 /* append a dir comp.: many times per member */ +#define APPEND_NAME 3 /* append actual filename: once per member */ +#define GETPATH 4 /* retrieve the complete path and free it */ +#define END 5 /* free root path prior to exiting program */ + +/* version_made_by codes (central dir): make sure these */ +/* are not defined on their respective systems!! */ +#define FS_FAT_ 0 /* filesystem used by MS-DOS, OS/2, Win32 */ +#define AMIGA_ 1 +#define VMS_ 2 +#define UNIX_ 3 +#define VM_CMS_ 4 +#define ATARI_ 5 /* what if it's a minix filesystem? [cjh] */ +#define FS_HPFS_ 6 /* filesystem used by OS/2 (and NT 3.x) */ +#define MAC_ 7 /* HFS filesystem used by MacOS */ +#define Z_SYSTEM_ 8 +#define CPM_ 9 +#define TOPS20_ 10 +#define FS_NTFS_ 11 /* filesystem used by Windows NT */ +#define QDOS_ 12 +#define ACORN_ 13 /* Archimedes Acorn RISC OS */ +#define FS_VFAT_ 14 /* filesystem used by Windows 95, NT */ +#define MVS_ 15 +#define BEOS_ 16 /* hybrid POSIX/database filesystem */ +#define TANDEM_ 17 /* Tandem/NSK */ +#define NUM_HOSTS 18 /* index of last system + 1 */ + +#define STORED 0 /* compression methods */ +#define SHRUNK 1 +#define REDUCED1 2 +#define REDUCED2 3 +#define REDUCED3 4 +#define REDUCED4 5 +#define IMPLODED 6 +#define TOKENIZED 7 +#define DEFLATED 8 +#define ENHDEFLATED 9 +#define DCLIMPLODED 10 +#define NUM_METHODS 11 /* index of last method + 1 */ +/* don't forget to update list_files(), extract.c and zipinfo.c appropriately + * if NUM_METHODS changes */ + +/* (the PK-class error codes are public and have been moved into unzip.h) */ + +#define DF_MDY 0 /* date format 10/26/91 (USA only) */ +#define DF_DMY 1 /* date format 26/10/91 (most of the world) */ +#define DF_YMD 2 /* date format 91/10/26 (a few countries) */ + +/*--------------------------------------------------------------------------- + Extra-field block ID values and offset info. + ---------------------------------------------------------------------------*/ +/* extra-field ID values, all little-endian: */ +#define EF_AV 0x0007 /* PKWARE's authenticity verification */ +#define EF_OS2 0x0009 /* OS/2 extended attributes */ +#define EF_PKW32 0x000a /* PKWARE's Win95/98/WinNT filetimes */ +#define EF_PKVMS 0x000c /* PKWARE's VMS */ +#define EF_PKUNIX 0x000d /* PKWARE's Unix */ +#define EF_IZVMS 0x4d49 /* Info-ZIP's VMS ("IM") */ +#define EF_IZUNIX 0x5855 /* Info-ZIP's old Unix[1] ("UX") */ +#define EF_IZUNIX2 0x7855 /* Info-ZIP's new Unix[2] ("Ux") */ +#define EF_TIME 0x5455 /* universal timestamp ("UT") */ +#define EF_MAC3 0x334d /* Info-ZIP's new Macintosh (= "M3") */ +#define EF_JLMAC 0x07c8 /* Johnny Lee's old Macintosh (= 1992) */ +#define EF_ZIPIT 0x2605 /* Thomas Brown's Macintosh (ZipIt) */ +#define EF_ZIPIT2 0x2705 /* T. Brown's Mac (ZipIt) v 1.3.8 and newer ? */ +#define EF_VMCMS 0x4704 /* Info-ZIP's VM/CMS ("\004G") */ +#define EF_MVS 0x470f /* Info-ZIP's MVS ("\017G") */ +#define EF_ACL 0x4c41 /* (OS/2) access control list ("AL") */ +#define EF_NTSD 0x4453 /* NT security descriptor ("SD") */ +#define EF_BEOS 0x6542 /* BeOS ("Be") */ +#define EF_QDOS 0xfb4a /* SMS/QDOS ("J\373") */ +#define EF_AOSVS 0x5356 /* AOS/VS ("VS") */ +#define EF_SPARK 0x4341 /* David Pilling's Acorn/SparkFS ("AC") */ +#define EF_MD5 0x4b46 /* Fred Kantor's MD5 ("FK") */ +#define EF_ASIUNIX 0x756e /* ASi's Unix ("nu") */ + +#define EB_HEADSIZE 4 /* length of extra field block header */ +#define EB_ID 0 /* offset of block ID in header */ +#define EB_LEN 2 /* offset of data length field in header */ +#define EB_UCSIZE_P 0 /* offset of ucsize field in compr. data */ +#define EB_CMPRHEADLEN 6 /* lenght of compression header */ + +#define EB_UX_MINLEN 8 /* minimal "UX" field contains atime, mtime */ +#define EB_UX_FULLSIZE 12 /* full "UX" field (atime, mtime, uid, gid) */ +#define EB_UX_ATIME 0 /* offset of atime in "UX" extra field data */ +#define EB_UX_MTIME 4 /* offset of mtime in "UX" extra field data */ +#define EB_UX_UID 8 /* byte offset of UID in "UX" field data */ +#define EB_UX_GID 10 /* byte offset of GID in "UX" field data */ + +#define EB_UX2_MINLEN 4 /* minimal "Ux" field contains UID/GID */ +#define EB_UX2_UID 0 /* byte offset of UID in "Ux" field data */ +#define EB_UX2_GID 2 /* byte offset of GID in "Ux" field data */ +#define EB_UX2_VALID (1 << 8) /* UID/GID present */ + +#define EB_UT_MINLEN 1 /* minimal UT field contains Flags byte */ +#define EB_UT_FLAGS 0 /* byte offset of Flags field */ +#define EB_UT_TIME1 1 /* byte offset of 1st time value */ +#define EB_UT_FL_MTIME (1 << 0) /* mtime present */ +#define EB_UT_FL_ATIME (1 << 1) /* atime present */ +#define EB_UT_FL_CTIME (1 << 2) /* ctime present */ + +#define EB_FLGS_OFFS 4 /* offset of flags area in generic compressed + extra field blocks (OS2, NT, and others) */ +#define EB_OS2_HLEN 4 /* size of OS2/ACL compressed data header */ +#define EB_BEOS_HLEN 5 /* length of BeOS e.f attribute header */ +#define EB_BE_FL_UNCMPR 0x01 /* "BeOS attributes uncompressed" bit flag */ +#define EB_MAC3_HLEN 14 /* length of Mac3 attribute block header */ +#define EB_M3_FL_DATFRK 0x01 /* "this entry is data fork" flag */ +#define EB_M3_FL_UNCMPR 0x04 /* "Mac3 attributes uncompressed" bit flag */ +#define EB_M3_FL_TIME64 0x08 /* "Mac3 time fields are 64 bit wide" flag */ +#define EB_M3_FL_NOUTC 0x10 /* "Mac3 timezone offset fields missing" flag */ + +#define EB_NTSD_C_LEN 4 /* length of central NT security data */ +#define EB_NTSD_L_LEN 5 /* length of minimal local NT security data */ +#define EB_NTSD_VERSION 4 /* offset of NTSD version byte */ +#define EB_NTSD_MAX_VER (0) /* maximum version # we know how to handle */ + +#define EB_ASI_CRC32 0 /* offset of ASI Unix field's crc32 checksum */ +#define EB_ASI_MODE 4 /* offset of ASI Unix permission mode field */ + +/*--------------------------------------------------------------------------- + True sizes of the various headers, as defined by PKWARE--so it is not + likely that these will ever change. But if they do, make sure both these + defines AND the typedefs below get updated accordingly. + ---------------------------------------------------------------------------*/ +#define LREC_SIZE 26 /* lengths of local file headers, central */ +#define CREC_SIZE 42 /* directory headers, and the end-of- */ +#define ECREC_SIZE 18 /* central-dir record, respectively */ + +#define MAX_BITS 13 /* used in unshrink() */ +#define HSIZE (1 << MAX_BITS) /* size of global work area */ + +#define LF 10 /* '\n' on ASCII machines; must be 10 due to EBCDIC */ +#define CR 13 /* '\r' on ASCII machines; must be 13 due to EBCDIC */ +#define CTRLZ 26 /* DOS & OS/2 EOF marker (used in fileio.c, vms.c) */ + +#ifdef EBCDIC +# define foreign(c) ascii[(uch)(c)] +# define native(c) ebcdic[(uch)(c)] +# define NATIVE "EBCDIC" +# define NOANSIFILT +#endif + +#if (defined(CRAY) && defined(ZMEM)) +# undef ZMEM +#endif + +#ifdef ZMEM +# undef ZMEM +# define memcmp(b1,b2,len) bcmp(b2,b1,len) +# define memcpy(dest,src,len) bcopy(src,dest,len) +# define memzero bzero +#else +# define memzero(dest,len) memset(dest,0,len) +#endif + +#ifdef VMS +# define ENV_UNZIP "UNZIP_OPTS" /* names of environment variables */ +# define ENV_ZIPINFO "ZIPINFO_OPTS" +#endif /* VMS */ +#ifdef RISCOS +# define ENV_UNZIP "Unzip$Options" +# define ENV_ZIPINFO "Zipinfo$Options" +# define ENV_UNZIPEXTS "Unzip$Exts" +#endif /* RISCOS */ +#ifndef ENV_UNZIP +# define ENV_UNZIP "UNZIP" /* the standard names */ +# define ENV_ZIPINFO "ZIPINFO" +#endif +#define ENV_UNZIP2 "UNZIPOPT" /* alternate names, for zip compat. */ +#define ENV_ZIPINFO2 "ZIPINFOOPT" + +#if (!defined(QQ) && !defined(NOQQ)) +# define QQ +#endif + +#ifdef QQ /* Newtware version: no file */ +# define QCOND (!uO.qflag) /* comments with -vq or -vqq */ +#else /* Bill Davidsen version: no way to */ +# define QCOND (longhdr) /* kill file comments when listing */ +#endif + +#ifdef OLD_QQ +# define QCOND2 (uO.qflag < 2) +#else +# define QCOND2 (!uO.qflag) +#endif + +#ifndef TRUE +# define TRUE 1 /* sort of obvious */ +#endif +#ifndef FALSE +# define FALSE 0 +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 +# define SEEK_CUR 1 +# define SEEK_END 2 +#endif + +#if (defined(UNIX) && defined(S_IFLNK) && !defined(MTS)) +# define SYMLINKS +# ifndef S_ISLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# endif +#endif /* UNIX && S_IFLNK && !MTS */ + +#ifndef S_ISDIR +# ifdef CMS_MVS +# define S_ISDIR(m) (FALSE) +# else +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# endif +#endif + +#ifndef IS_VOLID +# define IS_VOLID(m) ((m) & 0x08) +#endif + + + + + +/**************/ +/* Typedefs */ +/**************/ + +#ifdef NO_UID_GID +# ifdef UID_USHORT + typedef unsigned short uid_t; /* TI SysV.3 */ + typedef unsigned short gid_t; +# else + typedef unsigned int uid_t; /* SCO Xenix */ + typedef unsigned int gid_t; +# endif +#endif + +#if (defined(WIN32) || defined(sgi) || defined(GOT_UTIMBUF) || defined(ATARI)) + typedef struct utimbuf ztimbuf; +#else + typedef struct ztimbuf { + time_t actime; /* new access time */ + time_t modtime; /* new modification time */ + } ztimbuf; +#endif + +typedef struct iztimes { + time_t atime; /* new access time */ + time_t mtime; /* new modification time */ + time_t ctime; /* used for creation time; NOT same as st_ctime */ +} iztimes; + +#ifdef SET_DIR_ATTRIB + typedef struct dirtime { /* temporary struct for holding directory info */ + struct dirtime *next; /* until can be sorted and set at end */ + char *fn; /* filename of directory */ + union { + iztimes t3; /* mtime, atime, ctime */ + ztimbuf t2; /* modtime, actime */ + } u; + unsigned perms; /* same as min_info.file_attr */ + int have_uidgid; /* flag */ + ush uidgid[2]; + } dirtime; +#endif /* SET_DIR_ATTRIB */ + +typedef struct min_info { + long offset; + ulg crc; /* crc (needed if extended header) */ + ulg compr_size; /* compressed size (needed if extended header) */ + ulg uncompr_size; /* uncompressed size (needed if extended header) */ + int hostnum; + unsigned file_attr; /* local flavor, as used by creat(), chmod()... */ + unsigned encrypted : 1; /* file encrypted: decrypt before uncompressing */ + unsigned ExtLocHdr : 1; /* use time instead of CRC for decrypt check */ + unsigned textfile : 1; /* file is text (according to zip) */ + unsigned textmode : 1; /* file is to be extracted as text */ + unsigned lcflag : 1; /* convert filename to lowercase */ + unsigned vollabel : 1; /* "file" is an MS-DOS volume (disk) label */ +} min_info; + +typedef struct VMStimbuf { + char *revdate; /* (both roughly correspond to Unix modtime/st_mtime) */ + char *credate; +} VMStimbuf; + +/*--------------------------------------------------------------------------- + Zipfile work area declarations. + ---------------------------------------------------------------------------*/ + +#ifdef MALLOC_WORK + union work { + struct { /* unshrink(): */ + shrint *Parent; /* (8193 * sizeof(shrint)) */ + uch *value; + uch *Stack; + } shrink; + uch *Slide; /* explode(), inflate(), unreduce() */ + }; +#else /* !MALLOC_WORK */ + union work { + struct { /* unshrink(): */ + shrint Parent[HSIZE]; /* (8192 * sizeof(shrint)) == 16KB minimum */ + uch value[HSIZE]; /* 8KB */ + uch Stack[HSIZE]; /* 8KB */ + } shrink; /* total = 32KB minimum; 80KB on Cray/Alpha */ + uch Slide[WSIZE]; /* explode(), inflate(), unreduce() */ + }; +#endif /* ?MALLOC_WORK */ + +#define slide G.area.Slide + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) +# define redirSlide G.redirect_sldptr +#else +# define redirSlide G.area.Slide +#endif + +/*--------------------------------------------------------------------------- + Zipfile layout declarations. If these headers ever change, make sure the + xxREC_SIZE defines (above) change with them! + ---------------------------------------------------------------------------*/ + + typedef uch local_byte_hdr[ LREC_SIZE ]; +# define L_VERSION_NEEDED_TO_EXTRACT_0 0 +# define L_VERSION_NEEDED_TO_EXTRACT_1 1 +# define L_GENERAL_PURPOSE_BIT_FLAG 2 +# define L_COMPRESSION_METHOD 4 +# define L_LAST_MOD_DOS_DATETIME 6 +# define L_CRC32 10 +# define L_COMPRESSED_SIZE 14 +# define L_UNCOMPRESSED_SIZE 18 +# define L_FILENAME_LENGTH 22 +# define L_EXTRA_FIELD_LENGTH 24 + + typedef uch cdir_byte_hdr[ CREC_SIZE ]; +# define C_VERSION_MADE_BY_0 0 +# define C_VERSION_MADE_BY_1 1 +# define C_VERSION_NEEDED_TO_EXTRACT_0 2 +# define C_VERSION_NEEDED_TO_EXTRACT_1 3 +# define C_GENERAL_PURPOSE_BIT_FLAG 4 +# define C_COMPRESSION_METHOD 6 +# define C_LAST_MOD_DOS_DATETIME 8 +# define C_CRC32 12 +# define C_COMPRESSED_SIZE 16 +# define C_UNCOMPRESSED_SIZE 20 +# define C_FILENAME_LENGTH 24 +# define C_EXTRA_FIELD_LENGTH 26 +# define C_FILE_COMMENT_LENGTH 28 +# define C_DISK_NUMBER_START 30 +# define C_INTERNAL_FILE_ATTRIBUTES 32 +# define C_EXTERNAL_FILE_ATTRIBUTES 34 +# define C_RELATIVE_OFFSET_LOCAL_HEADER 38 + + typedef uch ec_byte_rec[ ECREC_SIZE+4 ]; +/* define SIGNATURE 0 space-holder only */ +# define NUMBER_THIS_DISK 4 +# define NUM_DISK_WITH_START_CENTRAL_DIR 6 +# define NUM_ENTRIES_CENTRL_DIR_THS_DISK 8 +# define TOTAL_ENTRIES_CENTRAL_DIR 10 +# define SIZE_CENTRAL_DIRECTORY 12 +# define OFFSET_START_CENTRAL_DIRECTORY 16 +# define ZIPFILE_COMMENT_LENGTH 20 + + + typedef struct local_file_header { /* LOCAL */ + uch version_needed_to_extract[2]; + ush general_purpose_bit_flag; + ush compression_method; + ulg last_mod_dos_datetime; + ulg crc32; + ulg csize; + ulg ucsize; + ush filename_length; + ush extra_field_length; + } local_file_hdr; + +#if 0 + typedef struct central_directory_file_header { /* CENTRAL */ + uch version_made_by[2]; + uch version_needed_to_extract[2]; + ush general_purpose_bit_flag; + ush compression_method; + ulg last_mod_dos_datetime; + ulg crc32; + ulg csize; + ulg ucsize; + ush filename_length; + ush extra_field_length; + ush file_comment_length; + ush disk_number_start; + ush internal_file_attributes; + ulg external_file_attributes; + ulg relative_offset_local_header; + } cdir_file_hdr; +#endif /* 0 */ + + typedef struct end_central_dir_record { /* END CENTRAL */ + ush number_this_disk; + ush num_disk_start_cdir; + ush num_entries_centrl_dir_ths_disk; + ush total_entries_central_dir; + ulg size_central_directory; + ulg offset_start_central_directory; + ush zipfile_comment_length; + } ecdir_rec; + + +/* Huffman code lookup table entry--this entry is four bytes for machines + that have 16-bit pointers (e.g. PC's in the small or medium model). + Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16 + means that v is a literal, 16 < e < 32 means that v is a pointer to + the next table, which codes e - 16 bits, and lastly e == 99 indicates + an unused code. If a code with e == 99 is looked up, this implies an + error in the data. */ + +struct huft { + uch e; /* number of extra bits or operation */ + uch b; /* number of bits in this code or subcode */ + union { + ush n; /* literal, length base, or distance base */ + struct huft *t; /* pointer to next level of table */ + } v; +}; + + +typedef struct _APIDocStruct { + char *compare; + char *function; + char *syntax; + char *purpose; +} APIDocStruct; + + + + +/*************/ +/* Globals */ +/*************/ + +#if (defined(OS2) && !defined(FUNZIP)) +# include "os2/os2data.h" +#endif + +#include "globals.h" + + + +/*************************/ +/* Function Prototypes */ +/*************************/ + +/*--------------------------------------------------------------------------- + Functions in unzip.c (initialization routines): + ---------------------------------------------------------------------------*/ + +#ifndef WINDLL + int MAIN OF((int argc, char **argv)); + int unzip OF((__GPRO__ int argc, char **argv)); + int uz_opts OF((__GPRO__ int *pargc, char ***pargv)); + int usage OF((__GPRO__ int error)); +#endif /* !WINDLL */ + +/*--------------------------------------------------------------------------- + Functions in process.c (main driver routines): + ---------------------------------------------------------------------------*/ + +int process_zipfiles OF((__GPRO)); +void free_G_buffers OF((__GPRO)); +/* static int do_seekable OF((__GPRO__ int lastchance)); */ +/* static int find_ecrec OF((__GPRO__ long searchlen)); */ +int uz_end_central OF((__GPRO)); +int process_cdir_file_hdr OF((__GPRO)); +int get_cdir_ent OF((__GPRO)); +int process_local_file_hdr OF((__GPRO)); +unsigned ef_scan_for_izux OF((uch *ef_buf, unsigned ef_len, int ef_is_c, + ulg dos_mdatetime, + iztimes *z_utim, ush *z_uidgid)); + +#ifndef SFX + +/*--------------------------------------------------------------------------- + Functions in zipinfo.c (`zipinfo-style' listing routines): + ---------------------------------------------------------------------------*/ + +#ifndef NO_ZIPINFO +#ifndef WINDLL + int zi_opts OF((__GPRO__ int *pargc, char ***pargv)); +#endif +int zi_end_central OF((__GPRO)); +int zipinfo OF((__GPRO)); +/* static int zi_long OF((__GPRO__ ulg *pEndprev)); */ +/* static int zi_short OF((__GPRO)); */ +/* static char *zi_time OF((__GPRO__ ZCONST ulg *datetimez, + ZCONST time_t *modtimez, char *d_t_str));*/ +#endif /* !NO_ZIPINFO */ + +/*--------------------------------------------------------------------------- + Functions in list.c (generic zipfile-listing routines): + ---------------------------------------------------------------------------*/ + +int list_files OF((__GPRO)); +#ifdef TIMESTAMP + int get_time_stamp OF((__GPRO__ time_t *last_modtime, + unsigned *nmember)); +#endif +int ratio OF((ulg uc, ulg c)); +void fnprint OF((__GPRO)); + +#endif /* !SFX */ + +/*--------------------------------------------------------------------------- + Functions in fileio.c: + ---------------------------------------------------------------------------*/ + +int open_input_file OF((__GPRO)); +int open_outfile OF((__GPRO)); /* also vms.c */ +void undefer_input OF((__GPRO)); +void defer_leftover_input OF((__GPRO)); +unsigned readbuf OF((__GPRO__ char *buf, register unsigned len)); +int readbyte OF((__GPRO)); +int fillinbuf OF((__GPRO)); +#ifdef FUNZIP + int flush OF((__GPRO__ ulg size)); /* actually funzip.c */ +#else + int flush OF((__GPRO__ uch *buf, ulg size, int unshrink)); +#endif +/* static int disk_error OF((__GPRO)); */ +void handler OF((int signal)); +time_t dos_to_unix_time OF((ulg dos_datetime)); +int check_for_newer OF((__GPRO__ char *filename)); /* os2,vmcms,vms */ +int do_string OF((__GPRO__ unsigned int len, int option)); +ush makeword OF((ZCONST uch *b)); +ulg makelong OF((ZCONST uch *sig)); +#if (!defined(STR_TO_ISO) || defined(NEED_STR2ISO)) + char *str2iso OF((char *dst, ZCONST char *src)); +#endif +#if (!defined(STR_TO_OEM) || defined(NEED_STR2OEM)) + char *str2oem OF((char *dst, ZCONST char *src)); +#endif +int zstrnicmp OF((register ZCONST char *s1, + register ZCONST char *s2, + register unsigned n)); +#ifdef REGULUS + int zstat OF((char *p, struct stat *s)); +#endif +#ifdef ZMEM /* MUST be ifdef'd because of conflicts with the standard def. */ + zvoid *memset OF((register zvoid *, register int, register unsigned int)); + int memcmp OF((register ZCONST zvoid*, register ZCONST zvoid *, + register unsigned int)); + zvoid *memcpy OF((register zvoid *, register ZCONST zvoid *, + register unsigned int)); +#endif +#ifdef SMALL_MEM + char *fLoadFarString OF((__GPRO__ const char Far *sz)); + char *fLoadFarStringSmall OF((__GPRO__ const char Far *sz)); + char *fLoadFarStringSmall2 OF((__GPRO__ const char Far *sz)); + #ifndef zfstrcpy + char Far * Far zfstrcpy OF((char Far *s1, const char Far *s2)); + #endif +#endif + + +/*--------------------------------------------------------------------------- + Functions in extract.c: + ---------------------------------------------------------------------------*/ + +int extract_or_test_files OF((__GPRO)); +/* static int store_info OF((void)); */ +/* static int extract_or_test_member OF((__GPRO)); */ +/* static int TestExtraField OF((__GPRO__ uch *ef, unsigned ef_len)); */ +/* static int test_OS2 OF((__GPRO__ uch *eb, unsigned eb_size)); */ +/* static int test_NT OF((__GPRO__ uch *eb, unsigned eb_size)); */ +int memextract OF((__GPRO__ uch *tgt, ulg tgtsize, + uch *src, ulg srcsize)); +int memflush OF((__GPRO__ uch *rawbuf, ulg size)); +char *fnfilter OF((ZCONST char *raw, uch *space)); + +/*--------------------------------------------------------------------------- + Decompression functions: + ---------------------------------------------------------------------------*/ + +#if (!defined(SFX) && !defined(FUNZIP)) +int explode OF((__GPRO)); /* explode.c */ +#endif +int huft_free OF((struct huft *t)); /* inflate.c */ +int huft_build OF((__GPRO__ ZCONST unsigned *b, unsigned n, + unsigned s, ZCONST ush *d, ZCONST ush *e, + struct huft **t, int *m)); +#ifdef USE_ZLIB + int UZinflate OF((__GPRO)); /* inflate.c */ +# define inflate_free(x) inflateEnd(&((Uz_Globs *)(&G))->dstrm) +#else + int inflate OF((__GPRO)); /* inflate.c */ + int inflate_free OF((__GPRO)); /* inflate.c */ +#endif /* ?USE_ZLIB */ +#if (!defined(SFX) && !defined(FUNZIP)) +void unreduce OF((__GPRO)); /* unreduce.c */ +/* static void LoadFollowers OF((__GPRO__ f_array *follower, uch *Slen)); + * unreduce.c */ +int unshrink OF((__GPRO)); /* unshrink.c */ +/* static void partial_clear OF((__GPRO)); * unshrink.c */ +#endif /* !SFX && !FUNZIP */ + +/*--------------------------------------------------------------------------- + Internal API functions (only included in DLL versions): + ---------------------------------------------------------------------------*/ + +#ifdef DLL + void setFileNotFound OF((__GPRO)); /* api.c */ + int unzipToMemory OF((__GPRO__ char *zip, char *file, + UzpBuffer *retstr)); /* api.c */ + int redirect_outfile OF((__GPRO)); /* api.c */ + int writeToMemory OF((__GPRO__ uch *rawbuf, ulg size)); + int close_redirect OF((__GPRO)); /* api.c */ + /* this obsolescent entry point kept for compatibility: */ + int UzpUnzip OF((int argc, char **argv));/* use UzpMain */ +#ifdef OS2DLL + int varmessage OF((__GPRO__ uch *buf, ulg size)); + int varputchar OF((__GPRO__ int c)); /* rexxapi.c */ + int finish_REXX_redirect OF((__GPRO)); /* rexxapi.c */ +#endif +#ifdef API_DOC + void APIhelp OF((__GPRO__ int argc, char **argv)); +#endif /* apihelp.c */ +#endif /* DLL */ + +/*--------------------------------------------------------------------------- + Acorn RISC OS-only functions: + ---------------------------------------------------------------------------*/ + +#ifdef RISCOS + int isRISCOSexfield OF((void *extra_field)); /* acorn.c */ + void setRISCOSexfield OF((char *path, void *extra_field)); /* acorn.c */ + void printRISCOSexfield OF((int isdir, void *extra_field)); /* acorn.c */ +#endif + +/*--------------------------------------------------------------------------- + Human68K-only functions: + ---------------------------------------------------------------------------*/ + +#ifdef __human68k__ + void InitTwentyOne OF((void)); +#endif + +/*--------------------------------------------------------------------------- + Macintosh-only functions: + ---------------------------------------------------------------------------*/ + +#ifdef MACOS + void screenOpen OF((char *)); /* macscreen.c */ + void screenControl OF((char *, int)); /* macscreen.c */ + void screenDump OF((char *, long)); /* macscreen.c */ + void screenUpdate OF((WindowPtr)); /* macscreen.c */ + void screenClose OF((void)); /* macscreen.c */ + int macgetch OF((void)); /* macscreen.c */ + + int macmkdir OF((char *)); /* mac.c */ + short macopen OF((char *, short)); /* mac.c */ + short maccreat OF((char *)); /* mac.c */ + short macread OF((short, char *, unsigned)); /* mac.c */ + long macwrite OF((short, char *, unsigned)); /* mac.c */ + short macclose OF((short)); /* mac.c */ + long maclseek OF((short, long, short)); /* mac.c */ + char *macfgets OF((char *, int, FILE *)); /* mac.c */ + int macfprintf OF((FILE *, char *, ...)); /* mac.c */ + int macprintf OF((char *, ...)); /* mac.c */ +#endif + +/*--------------------------------------------------------------------------- + MSDOS-only functions: + ---------------------------------------------------------------------------*/ + +#if (defined(MSDOS) && (defined(__GO32__) || defined(__EMX__))) + unsigned _dos_getcountryinfo(void *); /* msdos.c */ +#if (!defined(__DJGPP__) || (__DJGPP__ < 2)) + unsigned _dos_setftime(int, unsigned short, unsigned short); /* msdos.c */ + unsigned _dos_setfileattr(char *, unsigned); /* msdos.c */ + unsigned _dos_creat(char *, unsigned, int *); /* msdos.c */ + void _dos_getdrive(unsigned *); /* msdos.c */ + unsigned _dos_close(int); /* msdos.c */ +#endif /* !__DJGPP__ || (__DJGPP__ < 2) */ +#endif + +/*--------------------------------------------------------------------------- + OS/2-only functions: + ---------------------------------------------------------------------------*/ + +#ifdef OS2 /* GetFileTime conflicts with something in Win32 header files */ +#if (defined(REENTRANT) && defined(USETHREADID)) + ulg GetThreadId OF((void)); +#endif + int GetCountryInfo OF((void)); /* os2.c */ + long GetFileTime OF((ZCONST char *name)); /* os2.c */ +/* static void SetPathAttrTimes OF((__GPRO__ int flags, int dir)); os2.c */ +/* static int SetEAs OF((__GPRO__ const char *path, + void *eablock)); os2.c */ +/* static int SetACL OF((__GPRO__ const char *path, + void *eablock)); os2.c */ +/* static int IsFileNameValid OF((const char *name)); os2.c */ +/* static void map2fat OF((char *pathcomp, char **pEndFAT)); os2.c */ +/* static int SetLongNameEA OF((char *name, char *longname)); os2.c */ +/* static void InitNLS OF((void)); os2.c */ + int IsUpperNLS OF((int nChr)); /* os2.c */ + int ToLowerNLS OF((int nChr)); /* os2.c */ + void DebugMalloc OF((void)); /* os2.c */ +#endif + +/*--------------------------------------------------------------------------- + QDOS-only functions: + ---------------------------------------------------------------------------*/ + +#ifdef QDOS + int QMatch (uch, uch); + void QFilename (__GPRO__ char *); + char *Qstrfix (char *); + int QReturn (int zip_error); +#endif + +/*--------------------------------------------------------------------------- + TOPS20-only functions: + ---------------------------------------------------------------------------*/ + +#ifdef TOPS20 + int upper OF((char *s)); /* tops20.c */ + int enquote OF((char *s)); /* tops20.c */ + int dequote OF((char *s)); /* tops20.c */ + int fnlegal OF(()); /* error if prototyped? */ /* tops20.c */ +#endif + +/*--------------------------------------------------------------------------- + VM/CMS- and MVS-only functions: + ---------------------------------------------------------------------------*/ + +#ifdef CMS_MVS + extent getVMMVSexfield OF((char *type, uch *ef_block, unsigned datalen)); + FILE *vmmvs_open_infile OF((__GPRO)); /* vmmvs.c */ + void close_infile OF((__GPRO)); /* vmmvs.c */ +#endif + +/*--------------------------------------------------------------------------- + VMS-only functions: + ---------------------------------------------------------------------------*/ + +#ifdef VMS + int check_format OF((__GPRO)); /* vms.c */ +/* int open_outfile OF((__GPRO)); * (see fileio.c) vms.c */ +/* int flush OF((__GPRO__ uch *rawbuf, unsigned size, + int final_flag)); * (see fileio.c) vms.c */ +#ifdef RETURN_CODES + void return_VMS OF((__GPRO__ int zip_error)); /* vms.c */ +#else + void return_VMS OF((int zip_error)); /* vms.c */ +#endif +#ifdef VMSCLI + ulg vms_unzip_cmdline OF((int *, char ***)); /* cmdline.c */ + int VMSCLI_usage OF((__GPRO__ int error)); /* cmdline.c */ +#endif +#endif + +/*--------------------------------------------------------------------------- + WIN32-only functions: + ---------------------------------------------------------------------------*/ + +#ifdef WIN32 + int IsWinNT OF((void)); /* win32.c */ +#ifdef NTSD_EAS + void process_defer_NT OF((__GPRO)); /* win32.c */ + int test_NTSD OF((__GPRO__ uch *eb, unsigned eb_size, + uch *eb_ucptr, ulg eb_ucsize)); /* win32.c */ +# define TEST_NTSD test_NTSD +#endif +#ifdef W32_STAT_BANDAID + int zstat_win32 OF((__W32STAT_GLOBALS__ + const char *path, struct stat *buf)); /* win32.c */ +#endif +#endif + +/*--------------------------------------------------------------------------- + Miscellaneous/shared functions: + ---------------------------------------------------------------------------*/ + +Uz_Globs *globalsCtor OF((void)); /* globals.c */ + +void envargs OF((__GPRO__ int *Pargc, char ***Pargv, + ZCONST char *envstr, ZCONST char *envstr2)); + /* envargs.c */ +void mksargs OF((int *argcp, char ***argvp)); /* envargs.c */ + +int match OF((ZCONST char *s, ZCONST char *p, + int ic)); /* match.c */ +int iswild OF((ZCONST char *p)); /* match.c */ + +#ifdef DYNALLOC_CRCTAB + void free_crc_table OF((void)); /* crctab.c */ +#endif +#ifndef USE_ZLIB + ZCONST ulg near *get_crc_table OF((void)); /* funzip.c, crctab.c */ + ulg crc32 OF((ulg crc, ZCONST uch *buf, extent len)); +#endif /* !USE_ZLIB */ /* assembler source or crc32.c */ + +int dateformat OF((void)); /* currently, only msdos.c */ +#ifndef WINDLL + void version OF((__GPRO)); /* local */ +#endif +int mapattr OF((__GPRO)); /* local */ +int mapname OF((__GPRO__ int renamed)); /* local */ +int checkdir OF((__GPRO__ char *pathcomp, int flag)); /* local */ +char *do_wild OF((__GPRO__ char *wildzipfn)); /* local */ +char *GetLoadPath OF((__GPRO)); /* local */ +#if (defined(MORE) && (defined(UNIX) || defined(VMS) || defined(__BEOS__))) + int screenlines OF((void)); /* local */ +#endif +#ifndef MTS /* macro in MTS */ + void close_outfile OF((__GPRO)); /* local */ +#endif +#ifdef SET_DIR_ATTRIB + int set_direc_attribs OF((__GPRO__ dirtime *d)); /* local */ +#endif +#ifdef TIMESTAMP +# ifdef WIN32 + int stamp_file OF((__GPRO__ + ZCONST char *fname, time_t modtime)); /* local */ +# else + int stamp_file OF((ZCONST char *fname, time_t modtime)); /* local */ +# endif +#endif +#ifdef SYSTEM_SPECIFIC_CTOR + void SYSTEM_SPECIFIC_CTOR OF((__GPRO)); /* local */ +#endif + + + + + +/************/ +/* Macros */ +/************/ + +#ifndef MAX +# define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif +#ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + +#ifdef DEBUG +# define Trace(x) fprintf x +#else +# define Trace(x) +#endif + +#ifdef DEBUG_TIME +# define TTrace(x) fprintf x +#else +# define TTrace(x) +#endif + +#ifdef NO_DEBUG_IN_MACROS +# define MTrace(x) +#else +# define MTrace(x) Trace(x) +#endif + +#if (defined(UNIX) || defined(T20_VMS)) /* generally old systems */ +# define ToLower(x) ((char)(isupper((int)x)? tolower((int)x) : x)) +#else +# define ToLower tolower /* assumed "smart"; used in match() */ +#endif + +#ifdef USE_STRM_INPUT + /* ``Replace'' the unbuffered UNIX style I/O function with similar + * standard C functions from <stdio.h>. + */ +# define read(fd,buf,n) fread((buf),1,(n),(FILE *)(fd)) +# define lseek(fd,o,w) fseek((FILE *)(fd),(o),(w)) +# define close(fd) fclose((FILE *)(fd)) +#endif /* USE_STRM_INPUT */ + +/* The return value of the Info() "macro function" is never checked in + * UnZip. Otherwise, to get the same behaviour as for (*G.message)(), the + * Info() definition for "FUNZIP" would have to be corrected: + * #define Info(buf,flag,sprf_arg) \ + * (fprintf((flag)&1? stderr : stdout, \ + * (char *)(sprintf sprf_arg, (buf))) == EOF) + */ +#ifndef Info /* may already have been defined for redirection */ +# ifdef FUNZIP +# define Info(buf,flag,sprf_arg) \ + fprintf((flag)&1? stderr : stdout, (char *)(sprintf sprf_arg, (buf))) +# else +# ifdef INT_SPRINTF /* optimized version for "int sprintf()" flavour */ +# define Info(buf,flag,sprf_arg) \ + (*G.message)((zvoid *)&G, (uch *)(buf), (ulg)sprintf sprf_arg, (flag)) +# else /* generic version, does not use sprintf() return value */ +# define Info(buf,flag,sprf_arg) \ + (*G.message)((zvoid *)&G, (uch *)(buf), \ + (ulg)(sprintf sprf_arg, strlen((char *)(buf))), (flag)) +# endif +# endif +#endif /* !Info */ + +#undef Info +#define Info(buf,flag,sprf_arg) (0) + +/* The following macros wrappers around the fnfilter function are used many + * times to prepare archive entry names or name components for displaying + * listings and (warning/error) messages. They use sections in the upper half + * of 'slide' as buffer, since their output is normally fed through the + * Info() macro with 'slide' (the start of this area) as message buffer. + */ +#define FnFilter1(fname) fnfilter((fname), slide + (WSIZE>>1)) +#define FnFilter2(fname) fnfilter((fname), slide + ((WSIZE>>1) + (WSIZE>>2))) + +#ifndef FUNZIP /* used only in inflate.c */ +# define MESSAGE(str,len,flag) (*G.message)((zvoid *)&G,(str),(len),(flag)) +#endif + +#if 0 /* Optimization: use the (const) result of crc32(0L,NULL,0) */ +# define CRCVAL_INITIAL crc32(0L, NULL, 0) +#else +# define CRCVAL_INITIAL 0L +#endif + +#ifndef TEST_NTSD /* "NTSD valid?" checking function */ +# define TEST_NTSD NULL /* ... is not available */ +#endif + +/* + * Seek to the block boundary of the block which includes abs_offset, + * then read block into input buffer and set pointers appropriately. + * If block is already in the buffer, just set the pointers. This macro + * is used by uz_end_central (process.c), zi_end_central (zipinfo.c) and + * do_string (fileio.c). A slightly modified version is embedded within + * extract_or_test_files (extract.c). readbyte() and readbuf() (fileio.c) + * are compatible. NOTE THAT abs_offset is intended to be the "proper off- + * set" (i.e., if there were no extra bytes prepended); cur_zipfile_bufstart + * contains the corrected offset. + * + * Since ZLSEEK is never used during decompression, it is safe to use the + * slide[] buffer for the error message. + * + * The awkward "%cbs_offset" construct is provided for the obnoxious Solaris + * compiler, which wants to do macro substitution inside strings. + */ + +#ifndef ZLSEEK +# ifdef USE_STRM_INPUT +# define _ZLS_RELOAD(abs_offset) {\ + MTrace((stderr, "ZLSEEK: %cbs_offset = %ld, G.extra_bytes = %ld\n",\ + 'a', (abs_offset), G.extra_bytes));\ + fseek(G.zipfd,(LONGINT)bufstart,SEEK_SET);\ + G.cur_zipfile_bufstart = ftell(G.zipfd);\ + MTrace((stderr,\ + " request = %ld, (abs+extra) = %ld, inbuf_offset = %ld\n",\ + request, ((abs_offset)+G.extra_bytes), inbuf_offset));\ + MTrace((stderr, " bufstart = %ld, cur_zipfile_bufstart = %ld\n",\ + bufstart, G.cur_zipfile_bufstart));\ + if ((G.incnt = fread((char *)G.inbuf,1,INBUFSIZ,G.zipfd)) <= 0)\ + return(PK_EOF);\ + G.inptr = G.inbuf + (int)inbuf_offset;\ + G.incnt -= (int)inbuf_offset;\ + } +# else /* !USE_STRM_INPUT */ +# define _ZLS_RELOAD(abs_offset) {\ + MTrace((stderr, "ZLSEEK: %cbs_offset = %ld, G.extra_bytes = %ld\n",\ + 'a', (abs_offset), G.extra_bytes));\ + G.cur_zipfile_bufstart = lseek(G.zipfd,(LONGINT)bufstart,SEEK_SET);\ + MTrace((stderr,\ + " request = %ld, (abs+extra) = %ld, inbuf_offset = %ld\n",\ + request, ((abs_offset)+G.extra_bytes), inbuf_offset));\ + MTrace((stderr, " bufstart = %ld, cur_zipfile_bufstart = %ld\n",\ + bufstart, G.cur_zipfile_bufstart));\ + if ((G.incnt = read(G.zipfd,(char *)G.inbuf,INBUFSIZ)) <= 0)\ + return(PK_EOF);\ + G.inptr = G.inbuf + (int)inbuf_offset;\ + G.incnt -= (int)inbuf_offset;\ + } +# endif /* ?USE_STRM_INPUT */ + +# define ZLSEEK(abs_offset) {\ + LONGINT request = (abs_offset) + G.extra_bytes;\ + LONGINT inbuf_offset = request % INBUFSIZ;\ + LONGINT bufstart = request - inbuf_offset;\ +\ + if (request < 0) {\ + Info(slide, 1, ((char *)slide, LoadFarStringSmall(SeekMsg),\ + G.zipfn, LoadFarString(ReportMsg)));\ + return(PK_BADERR);\ + } else if (bufstart != G.cur_zipfile_bufstart)\ + _ZLS_RELOAD(abs_offset)\ + else {\ + G.incnt += (G.inptr-G.inbuf) - (int)inbuf_offset;\ + G.inptr = G.inbuf + (int)inbuf_offset;\ + }\ + } +#endif /* !ZLSEEK */ + +#define SKIP_(length) if(length&&((error=do_string(__G__ length,SKIP))!=0))\ + {error_in_archive=error; if(error>1) return error;} + +/* + * Skip a variable-length field, and report any errors. Used in zipinfo.c + * and unzip.c in several functions. + * + * macro SKIP_(length) + * ush length; + * { + * if (length && ((error = do_string(length, SKIP)) != 0)) { + * error_in_archive = error; /-* might be warning *-/ + * if (error > 1) /-* fatal *-/ + * return (error); + * } + * } + * + */ + + +#ifdef FUNZIP +# define FLUSH(w) flush(__G__ (ulg)(w)) +# define NEXTBYTE getc(G.in) /* redefined in crypt.h if full version */ +#else +# define FLUSH(w) if (G.mem_mode) memflush(__G__ redirSlide,(ulg)(w)); \ + else flush(__G__ redirSlide,(ulg)(w),0) +# define NEXTBYTE (--G.incnt >= 0 ? (int)(*G.inptr++) : readbyte(__G)) +#endif + + +#define READBITS(nbits,zdest) {if(nbits>G.bits_left) {int temp; G.zipeof=1;\ + while (G.bits_left<=8*(int)(sizeof(G.bitbuf)-1) && (temp=NEXTBYTE)!=EOF) {\ + G.bitbuf|=(ulg)temp<<G.bits_left; G.bits_left+=8; G.zipeof=0;}}\ + zdest=(shrint)((ush)G.bitbuf&mask_bits[nbits]);G.bitbuf>>=nbits;\ + G.bits_left-=nbits;} + +/* + * macro READBITS(nbits,zdest) * only used by unreduce and unshrink * + * { + * if (nbits > G.bits_left) { * fill G.bitbuf, 8*sizeof(ulg) bits * + * int temp; + * + * G.zipeof = 1; + * while (G.bits_left <= 8*(int)(sizeof(G.bitbuf)-1) && + * (temp = NEXTBYTE) != EOF) { + * G.bitbuf |= (ulg)temp << G.bits_left; + * G.bits_left += 8; + * G.zipeof = 0; + * } + * } + * zdest = (shrint)((ush)G.bitbuf & mask_bits[nbits]); + * G.bitbuf >>= nbits; + * G.bits_left -= nbits; + * } + * + */ + + +/* GRR: should change name to STRLOWER and use StringLower if possible */ + +/* + * Copy the zero-terminated string in str1 into str2, converting any + * uppercase letters to lowercase as we go. str2 gets zero-terminated + * as well, of course. str1 and str2 may be the same character array. + */ +#ifdef __human68k__ +# define TOLOWER(str1, str2) \ + { \ + char *p=(str1), *q=(str2); \ + uch c; \ + while ((c = *p++) != '\0') { \ + if (iskanji(c)) { \ + if (*p == '\0') \ + break; \ + *q++ = c; \ + *q++ = *p++; \ + } else \ + *q++ = isupper(c) ? tolower(c) : c; \ + } \ + *q = '\0'; \ + } +#else +# define TOLOWER(str1, str2) \ + { \ + char *p, *q; \ + p = (str1) - 1; \ + q = (str2); \ + while (*++p) \ + *q++ = (char)(isupper((int)(*p))? tolower((int)(*p)) : *p); \ + *q = '\0'; \ + } +#endif +/* + * NOTES: This macro makes no assumptions about the characteristics of + * the tolower() function or macro (beyond its existence), nor does it + * make assumptions about the structure of the character set (i.e., it + * should work on EBCDIC machines, too). The fact that either or both + * of isupper() and tolower() may be macros has been taken into account; + * watch out for "side effects" (in the C sense) when modifying this + * macro. + */ + +#ifndef foreign +# define foreign(c) (c) +#endif + +#ifndef native +# define native(c) (c) +# define A_TO_N(str1) +#else +# ifndef NATIVE +# define NATIVE "native chars" +# endif +# define A_TO_N(str1) {register uch *p;\ + for (p=(uch *)(str1); *p; p++) *p=native(*p);} +#endif +/* + * Translate the zero-terminated string in str1 from ASCII to the native + * character set. The translation is performed in-place and uses the + * "native" macro to translate each character. + * + * NOTE: Using the "native" macro means that is it the only part of unzip + * which knows which translation table (if any) is actually in use to + * produce the native character set. This makes adding new character set + * translation tables easy, insofar as all that is needed is an appropriate + * "native" macro definition and the translation table itself. Currently, + * the only non-ASCII native character set implemented is EBCDIC, but this + * may not always be so. + */ + + +/* default setup for internal codepage: assume ISO 8859-1 compatibility!! */ +#if (!defined(NATIVE) && !defined(CRTL_CP_IS_ISO) && !defined(CRTL_CP_IS_OEM)) +# define CRTL_CP_IS_ISO +#endif + + +/* Translate "extended ASCII" chars (OEM coding for DOS and OS/2; else + * ISO-8859-1 [ISO Latin 1, Win Ansi,...]) into the internal "native" + * code page. As with A_TO_N(), conversion is done in place. + */ +#ifndef _ISO_INTERN +# ifdef CRTL_CP_IS_OEM +# ifndef IZ_ISO2OEM_ARRAY +# define IZ_ISO2OEM_ARRAY +# endif +# define _ISO_INTERN(str1) {register uch *p;\ + for (p=(uch *)(str1); *p; p++)\ + *p = native((*p & 0x80) ? iso2oem[*p & 0x7f] : *p);} +# else +# define _ISO_INTERN(str1) A_TO_N(str1) +# endif +#endif + +#ifndef _OEM_INTERN +# ifdef CRTL_CP_IS_OEM +# define _OEM_INTERN(str1) A_TO_N(str1) +# else +# ifndef IZ_OEM2ISO_ARRAY +# define IZ_OEM2ISO_ARRAY +# endif +# define _OEM_INTERN(str1) {register uch *p;\ + for (p=(uch *)(str1); *p; p++)\ + *p = native((*p & 0x80) ? oem2iso[*p & 0x7f] : *p);} +# endif +#endif + +#ifndef STR_TO_ISO +# ifdef CRTL_CP_IS_ISO +# define STR_TO_ISO strcpy +# else +# define STR_TO_ISO str2iso +# define NEED_STR2ISO +# endif +#endif + +#ifndef STR_TO_OEM +# ifdef CRTL_CP_IS_OEM +# define STR_TO_OEM strcpy +# else +# define STR_TO_OEM str2oem +# define NEED_STR2OEM +# endif +#endif + +#if (!defined(INTERN_TO_ISO) && !defined(ASCII2ISO)) +# ifdef CRTL_CP_IS_OEM + /* know: "ASCII" is "OEM" */ +# define ASCII2ISO(c) (((c) & 0x80) ? oem2iso[(c) & 0x7f] : (c)) +# if (defined(NEED_STR2ISO) && !defined(CRYP_USES_OEM2ISO)) +# define CRYP_USES_OEM2ISO +# endif +# else + /* assume: "ASCII" is "ISO-ANSI" */ +# define ASCII2ISO(c) (c) +# endif +#endif + +#if (!defined(INTERN_TO_OEM) && !defined(ASCII2OEM)) +# ifdef CRTL_CP_IS_OEM + /* know: "ASCII" is "OEM" */ +# define ASCII2OEM(c) (c) +# else + /* assume: "ASCII" is "ISO-ANSI" */ +# define ASCII2OEM(c) (((c) & 0x80) ? iso2oem[(c) & 0x7f] : (c)) +# if (defined(NEED_STR2OEM) && !defined(CRYP_USES_ISO2OEM)) +# define CRYP_USES_ISO2OEM +# endif +# endif +#endif + +/* codepage conversion setup for testp() in crypt.c */ +#ifdef CRTL_CP_IS_ISO +# ifndef STR_TO_CP2 +# define STR_TO_CP2 STR_TO_OEM +# endif +#else +# ifdef CRTL_CP_IS_OEM +# ifndef STR_TO_CP2 +# define STR_TO_CP2 STR_TO_ISO +# endif +# else /* native internal CP is neither ISO nor OEM */ +# ifndef STR_TO_CP1 +# define STR_TO_CP1 STR_TO_ISO +# endif +# ifndef STR_TO_CP2 +# define STR_TO_CP2 STR_TO_OEM +# endif +# endif +#endif + + +/* Convert filename (and file comment string) into "internal" charset. + * This macro assumes that Zip entry filenames are coded in OEM (IBM DOS) + * codepage when made on + * -> DOS (this includes 16-bit Windows 3.1) (FS_FAT_) + * -> OS/2 (FS_HPFS_) + * -> Win95/WinNT with Nico Mak's WinZip (FS_NTFS_ && hostver == "5.0") + * + * All other ports are assumed to code zip entry filenames in ISO 8859-1. + */ +#ifndef Ext_ASCII_TO_Native +# define Ext_ASCII_TO_Native(string, hostnum, hostver) \ + if ((hostnum) == FS_FAT_ || (hostnum) == FS_HPFS_ || \ + ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \ + _OEM_INTERN((string)); \ + } else { \ + _ISO_INTERN((string)); \ + } +#endif + + + +/**********************/ +/* Global constants */ +/**********************/ + + extern ZCONST ush near mask_bits[]; + extern ZCONST char *fnames[2]; + +#ifdef EBCDIC + extern ZCONST uch ebcdic[]; +#endif +#ifdef IZ_ISO2OEM_ARRAY + extern ZCONST uch Far iso2oem[]; +#endif +#ifdef IZ_OEM2ISO_ARRAY + extern ZCONST uch Far oem2iso[]; +#endif + + extern ZCONST char Far VersionDate[]; + extern ZCONST char Far CentSigMsg[]; + extern ZCONST char Far EndSigMsg[]; + extern ZCONST char Far SeekMsg[]; + extern ZCONST char Far FilenameNotMatched[]; + extern ZCONST char Far ExclFilenameNotMatched[]; + extern ZCONST char Far ReportMsg[]; + +#ifndef SFX + extern ZCONST char Far CompiledWith[]; +#endif /* !SFX */ + + + +/***********************************/ +/* Global (shared?) RTL variables */ +/***********************************/ + +#ifdef DECLARE_ERRNO + extern int errno; +#endif + + +#endif /* !__unzpriv_h */ diff --git a/utils/Install/inczip/version.h b/utils/Install/inczip/version.h new file mode 100644 index 0000000000..763cc13078 --- /dev/null +++ b/utils/Install/inczip/version.h @@ -0,0 +1,44 @@ +/* + version.h (for UnZip) by Info-ZIP. + + This header file is not copyrighted and may be distributed without + restriction. (That's a little geek humor, heh heh.) + */ + +#ifndef __version_h /* don't include more than once */ +#define __version_h + +#ifdef BETA +# undef BETA /* define BETA for internal beta releases */ +#endif + +#ifdef BETA +# define BETALEVEL "d BETA" +# define VERSION_DATE "27 November 98" /* internal beta version */ +#else +# define BETALEVEL "" +# define VERSION_DATE "28 November 1998" /* official release version */ +# define RELEASE +#endif + +#define UZ_MAJORVER 5 /* UnZip */ +#define UZ_MINORVER 4 + +#define ZI_MAJORVER 2 /* ZipInfo */ +#define ZI_MINORVER 3 + +#define PATCHLEVEL 0 + + +/* these are obsolete but remain for backward compatibility: */ +#define D2_MAJORVER UZ_MAJORVER /* DLL for OS/2 */ +#define D2_MINORVER UZ_MINORVER +#define D2_PATCHLEVEL PATCHLEVEL + +#define DW_MAJORVER UZ_MAJORVER /* DLL for MS Windows */ +#define DW_MINORVER UZ_MINORVER +#define DW_PATCHLEVEL PATCHLEVEL + +#define WIN_VERSION_DATE VERSION_DATE + +#endif /* !__version_h */ diff --git a/utils/Install/inczip/w32cfg.h b/utils/Install/inczip/w32cfg.h new file mode 100644 index 0000000000..18a8e3f85c --- /dev/null +++ b/utils/Install/inczip/w32cfg.h @@ -0,0 +1,222 @@ +/*--------------------------------------------------------------------------- + Win32 specific configuration section: + ---------------------------------------------------------------------------*/ + +#ifndef __w32cfg_h +#define __w32cfg_h + +#if (defined(__CYGWIN__) && !defined(__CYGWIN32__)) +# define __CYGWIN32__ /* new versions of CygWin may not define this */ +#endif + +#include <sys/types.h> /* off_t, time_t, dev_t, ... */ +#include <sys/stat.h> +#include <io.h> /* read(), open(), etc. */ +#include <time.h> +#if (defined(__RSXNT__) || defined(__EMX__)) && !defined(tzset) +# define tzset _tzset +#endif +#ifdef __MINGW32__ + extern void _tzset(void); /* this is missing in <time.h> */ +# ifndef tzset +# define tzset _tzset +# endif +#endif +#include <memory.h> +#if (!defined(__RSXNT__) && !defined(__CYGWIN32__)) +# include <direct.h> /* mkdir() */ +#endif +#include <fcntl.h> +#ifdef __CYGWIN32__ +# include <unistd.h> + extern int setmode(int, int); /* this is missing in <fcntl.h> */ +#endif +#if (defined(MSC) || defined(__WATCOMC__) || defined(__MINGW32__)) +# include <sys/utime.h> +#else +# include <utime.h> +#endif + +#if defined(FILEIO_C) +# ifndef __CYGWIN32__ +# include <conio.h> +# endif +# include <windows.h> +# ifdef __RSXNT__ +# include "win32/rsxntwin.h" +# endif +#endif +#if (defined(ENVARGS_C) || defined(EXTRACT_C) || defined(UNZIP_C) || \ + defined(ZCRYPT_INTERNAL)) +# include <windows.h> +# ifdef __RSXNT__ +# include "win32/rsxntwin.h" +# endif +#endif +#if (defined(__CYGWIN32__) || defined(__MINGW32__)) + /* the following definitions are missing in their <windows.h> */ +# ifndef AnsiToOem +# define AnsiToOem CharToOemA +# endif +# ifndef OemToAnsi +# define OemToAnsi OemToCharA +# endif +#endif + +#define DIR_END '\\' /* OS uses '\\' as directory separator */ +#define DIR_END2 '/' /* also check for '/' (RTL may convert) */ +#ifndef DATE_FORMAT +# define DATE_FORMAT DF_MDY +#endif +#define lenEOL 2 +#define PutNativeEOL {*q++ = native(CR); *q++ = native(LF);} + +#if (defined(__RSXNT__) && !defined(HAVE_MKTIME)) +# define HAVE_MKTIME /* use mktime() in time conversion routines */ +#endif +#if (defined(__CYGWIN32__) && defined(HAVE_MKTIME)) +# undef HAVE_MKTIME /* Cygnus' mktime() implementation is buggy */ +#endif +#if (!defined(NT_TZBUG_WORKAROUND) && !defined(NO_NT_TZBUG_WORKAROUND)) +# define NT_TZBUG_WORKAROUND +#endif +#if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME)) +# define USE_EF_UT_TIME +#endif +#if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP)) +# define TIMESTAMP +#endif +#if (!defined(NO_NTSD_EAS) && !defined(NTSD_EAS)) +# define NTSD_EAS /* enable NTSD support unless explicitly suppressed */ +#endif + +/* handlers for OEM <--> ANSI string conversions */ +#ifdef __RSXNT__ + /* RSXNT uses OEM coded strings in functions supplied by C RTL */ +# ifdef CRTL_CP_IS_ISO +# undef CRTL_CP_IS_ISO +# endif +# ifndef CRTL_CP_IS_OEM +# define CRTL_CP_IS_OEM +# endif +#else + /* "real" native WIN32 compilers use ANSI coded strings in C RTL calls */ +# ifndef CRTL_CP_IS_ISO +# define CRTL_CP_IS_ISO +# endif +# ifdef CRTL_CP_IS_OEM +# undef CRTL_CP_IS_OEM +# endif +#endif + +#ifdef CRTL_CP_IS_ISO + /* C RTL's file system support assumes ANSI coded strings */ +# define ISO_TO_INTERN(src, dst) {if ((src) != (dst)) strcpy((dst), (src));} +# define OEM_TO_INTERN(src, dst) OemToAnsi(src, dst) +# define INTERN_TO_ISO(src, dst) {if ((src) != (dst)) strcpy((dst), (src));} +# define INTERN_TO_OEM(src, dst) AnsiToOem(src, dst) +#endif /* CRTL_CP_IS_ISO */ +#ifdef CRTL_CP_IS_OEM + /* C RTL's file system support assumes OEM coded strings */ +# define ISO_TO_INTERN(src, dst) AnsiToOem(src, dst) +# define OEM_TO_INTERN(src, dst) {if ((src) != (dst)) strcpy((dst), (src));} +# define INTERN_TO_ISO(src, dst) OemToAnsi(src, dst) +# define INTERN_TO_OEM(src, dst) {if ((src) != (dst)) strcpy((dst), (src));} +#endif /* CRTL_CP_IS_OEM */ +#define _OEM_INTERN(str1) OEM_TO_INTERN(str1, str1) +#define _ISO_INTERN(str1) ISO_TO_INTERN(str1, str1) +#ifndef WINDLL + /* Despite best intentions, for the command-line version UzpPassword() + * could return either character set, depending on whether running under + * Win95 (DOS-session) or WinNT (native WinNT command interpreter)! */ +# define STR_TO_CP2(dst, src) (AnsiToOem(src, dst), dst) +# define STR_TO_CP3(dst, src) (OemToAnsi(src, dst), dst) +#else + /* The WINDLL front end is known to supply ISO/ANSI-coded passwords! */ +# define STR_TO_CP2(dst, src) (AnsiToOem(src, dst), dst) +#endif +/* dummy defines to disable these functions, they are not needed */ +#define STR_TO_OEM +#define STR_TO_ISO + +/* Static variables that we have to add to Uz_Globs: */ +#define SYSTEM_SPECIFIC_GLOBALS \ + int created_dir, renamed_fullpath, fnlen;\ + unsigned nLabelDrive;\ + char lastRootPath[4];\ + int lastVolOldFAT, lastVolLocTim;\ + char *rootpath, *buildpathHPFS, *buildpathFAT, *endHPFS, *endFAT;\ + char *dirname, *wildname, matchname[FILNAMSIZ];\ + int rootlen, have_dirname, dirnamelen, notfirstcall;\ + zvoid *wild_dir; + +/* created_dir, renamed_fullpath, fnlen, and nLabelDrive are used by */ +/* both mapname() and checkdir(). */ +/* lastRootPath and lastVolOldFAT are used by IsVolumeOldFAT(). */ +/* rootlen, rootpath, buildpathHPFS, buildpathFAT, endHPFS, and endFAT */ +/* are used by checkdir(). */ +/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */ +/* and notfirstcall are used by do_wild(). */ + +#if (defined(_MSC_VER) && !defined(MSC)) +# define MSC +#endif + +/* This replacement for C-RTL-supplied getch() (or similar) functionality + * avoids leaving unabsorbed LFs in the keyboard buffer under Windows95, + * and supports the <ALT>+[0]<digit><digit><digit> feature. + */ +int getch_win32 OF((void)); + +/* This patch of stat() is useful for at least two compilers. It is */ +/* difficult to take a stat() of a root directory under Windows95, so */ +/* zstat_win32() detects that case and fills in suitable values. */ +#ifndef __RSXNT__ +# ifndef W32_STATROOT_FIX +# define W32_STATROOT_FIX +# endif +#endif /* !__RSXNT__ */ + +#if (defined(NT_TZBUG_WORKAROUND) || defined(W32_STATROOT_FIX)) +# define W32_STAT_BANDAID +# if (defined(NT_TZBUG_WORKAROUND) && defined(REENTRANT)) +# define __W32STAT_GLOBALS__ Uz_Globs *pG, +# define __W32STAT_G__ pG, +# else +# define __W32STAT_GLOBALS__ +# define __W32STAT_G__ +# endif +# undef SSTAT +# ifdef WILD_STAT_BUG +# define SSTAT(path, pbuf) (iswild(path) || zstat_win32(__W32STAT_G__ path, pbuf)) +# else +# define SSTAT(path, pbuf) zstat_win32(__W32STAT_G__ path, pbuf) +# endif +#endif + +#ifdef __WATCOMC__ +# ifdef __386__ +# ifndef WATCOMC_386 +# define WATCOMC_386 +# endif +# define __32BIT__ +# undef far +# define far +# undef near +# define near + +/* Get asm routines to link properly without using "__cdecl": */ +# ifndef USE_ZLIB +# pragma aux crc32 "_*" parm caller [] value [eax] modify [eax] +# pragma aux get_crc_table "_*" parm caller [] value [eax] \ + modify [eax ecx edx] +# endif /* !USE_ZLIB */ +# endif /* __386__ */ + +# ifndef EPIPE +# define EPIPE -1 +# endif +# define PIPE_ERROR (errno == EPIPE) +#endif /* __WATCOMC__ */ + +#endif /* !__w32cfg_h */ diff --git a/utils/Install/inczip/zip.h b/utils/Install/inczip/zip.h new file mode 100644 index 0000000000..5c079467f7 --- /dev/null +++ b/utils/Install/inczip/zip.h @@ -0,0 +1,15 @@ +/* This is a dummy zip.h to allow the source files shared with Zip (crypt.c, + crc32.c, crctab.c, ttyio.c) to compile for UnZip. */ + +#ifndef __zip_h /* don't include more than once */ +#define __zip_h + +#define UNZIP_INTERNAL +#include "unzip.h" + +#define local static + +#define ZE_MEM PK_MEM +#define ziperr(c, h) return + +#endif /* !__zip_h */ diff --git a/utils/Install/install.c b/utils/Install/install.c new file mode 100644 index 0000000000..1c29ce6a36 --- /dev/null +++ b/utils/Install/install.c @@ -0,0 +1,1081 @@ +/* + * install.c (c) 1998,1999 Brian Smith + * parts by Daniele Vistalli + */ + +#include <stdio.h> +#include <stddef.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <fcntl.h> +#if defined(__OS2__) || defined(__EMX__) || defined(WINNT) || defined(WIN32) +#include <process.h> +#endif +#include <sys/types.h> +#include "install.h" +#include "instsup.h" + +#if !defined(__EMX__) && !defined(__OS2__) && !defined(WIN32) && !defined(WINNT) +#define stricmp strcasecmp +#endif + +/* My Global variables ;) unusually many due to multiple dialogs */ +char tempPath[MAX_PATH]; +int installstate = NONE; +int installstage = 0; +int current_file=0, success=0; +unsigned long int acepos=0, aceoffset=0; +int pixels=0; +char confirmstring[1024]; +/* I know I am being excessive but... better safe than sorry ;) */ +char *configsys[8196]; +int configfilecount=-1; +int files = 0, files_deleted=0, packagesize=0, packagesselected[20]; +/* Global flags often set by the user */ +int driveselected, packagechosen, express = 1, driverstatus = -1, no_update = 0; +int licensechecked = 0, custom = 0, checkforupdate = 1, downloadsite = 0; +int usescitech = 1, usecurrent = 0, checking = 0, checkerror = 0, newerver = 0; +char sddfilename[256] = "", sddversion[256] = "", sdddate[256] = ""; +char sddurl[4][256] = { "", "", "", "" }; + +/* So these are accessible to REXX */ +int drivelist[26]; +FILE *self; + +/* These get loaded in loadheader */ +char *INSTALLER_APPLICATION; +char *INSTALLER_VERSION; +char *INSTALLER_TITLE; +char *INSTALLER_PATH; +char *INSTALLER_FOLDER; +char *INSTALLER_PROGRAM; +char *INSTALLER_SHADOW; +char *INSTALLER_OBJECT; +char *INSTALLER_SETS; +char *INSTALLER_SYSVAR; +char *INSTALLER_SYSLINE; +char *INSTALLER_PACKAGES[20]; +char *INSTALLER_CONFIRM_WPS; +char *INSTALLER_CONFIRM_CONFIGSYS; +char *INSTALLER_CONFIRM_OVERWRITE; +int INSTALLER_PACKAGE_COUNT; + +/* Will have to seperate this stuff to platform specifics... */ + +/* Config.Sys -- Note the drive letter gets replaced with the boot drive letter + It is just a place holder. (For the next 3 entries) */ +char csfile[] = "C:\\CONFIG.SYS"; +/* Backup Config.Sys filename */ +char bufile[] = "C:\\CONFIG.SDD"; +/* Installation Log Database -- Used for uninstallation and aborting */ +#if defined(__OS2__) || defined(__EMX__) || defined(WINNT) || defined(WIN32) +char instlog[] = "C:\\DBINST.LOG"; +#else +char instlog[] = "~/dbinst.log"; +#endif +char installdir[400]; + +char bootdrive[2] = "C"; +char winpath[400] = "C:\\OS2\\MDOS\\WINOS2"; +char winjpath[400] = "C:\\OS2\\MDOS\\WINJOS2"; +char wintpath[400] = "C:\\OS2\\MDOS\\WINTOS2"; +char winhpath[400] = "C:\\OS2\\MDOS\\WINHOS2"; +char browsedir[400] = "C:\\"; +char installdir2[400] = ""; +char empty_string[] = ""; +char currentcf[400] = ""; + +#ifdef ENABLE_LOGGING +FILE *logfile; +#endif + +/* Function prototypes */ +int installer_unpack(char *filename, int operation); +void resetglobals(void); + +typedef struct _replacements { + char *replacestring, *replacevar; +} Replacements; + +/* The variables in this array must be static buffers */ +Replacements InstRep[] = { + { "%INSTALLPATH%", installdir }, + { "%BOOTDRIVE%", bootdrive }, + { "%ANYSTRING%", empty_string }, + { "%WINPATH%", winpath }, + { "%WINJPATH%", winjpath }, + { "%WINTPATH%", wintpath }, + { "%WINHPATH%", winhpath }, + { "%USERPATH%", installdir2 }, + { "%VERSION%", "1.0" }, /* This may be depricated */ + { "%WEB_VER%", sddversion }, + { "%WEB_DATE%", sdddate }, + { "%WEB_LOCATION1%", sddurl[0] }, + { "%WEB_LOCATION2%", sddurl[1] }, + { "%WEB_LOCATION3%", sddurl[2] }, + { "%WEB_LOCATION4%", sddurl[3] }, + { "%PRI%", "SVGA" } +}; +int replacemax = 16; + +/* In str1, str2 gets replaced by str3 */ +char *replacestr(char *str1, char *str2, char *str3) +{ + char bigbuffer[4096]; + int z, x=0, len1 = strlen(str1), len2 = strlen(str2), len3 = strlen(str3); + + for(z=0;z<len1;z++) + { + if(len2 > 0 && strncmp(&str1[z], str2, len2)==0) + { + int i; + for(i=0;i<len3;i++) + { + bigbuffer[x] = str3[i]; + x++; + } + z=z+(len2-1); + } else { + bigbuffer[x] = str1[z]; + x++; + } + } + bigbuffer[x] = 0; + return (char *)strdup(bigbuffer); +} + +/* This function parses a string and replaces all the text in the + * Replacement array with the current dynamic text */ +char *replaceem(char *orig) +{ + char *tmp1 = NULL, *tmp2 = (char *)strdup(orig); + int z; + + for(z=0;z<replacemax;z++) + { + tmp1 = replacestr(tmp2, InstRep[z].replacestring, InstRep[z].replacevar); + free(tmp2); + tmp2 = tmp1; + tmp1 = NULL; + } + return tmp2; +} + +/* + * Find the offset withing the executable of the ace data for use. + */ +int aceseek_entry(int num) +{ + long headerstart; + char headerbuf[20], packageconfig[100]; + int z, start = 0, entry = 0, packageoffset=0; + /* Decode DBSOFT-ACE - small memleak but + * install should not be running for very long. :) */ + sprintf(headerbuf, "%s%d", decode("EEECFDEPEGFECNEBEDEF"), num); + if((headerstart = findtext(headerbuf)) < 0) + { + mesg("Could not find ACE header in executable."); + exit(2); + } + + fseek(self, headerstart+strlen(headerbuf), SEEK_SET); + fread(packageconfig, 1, 100, self); + + for(z=0;z<100;z++) + { + if(packageconfig[z] == '-' || packageconfig[z] == '*') + { + char cur = packageconfig[z]; + packageconfig[z] = 0; + switch(entry) + { + case 0: + current_file = 0; + files = atoi(&packageconfig[start]); + break; + case 1: + packagesize = atoi(&packageconfig[start]); + break; + } + start = z+1; + if(cur == '*') + { + packageoffset = z + 1; + z = 100; + } + entry++; + } + } + aceoffset=headerstart+strlen(headerbuf)+packageoffset; + fseek(self, aceoffset, SEEK_SET); + return TRUE; +} + +/* + * Reads the embedded .cfg data from the executable and place it in the global + * INSTALL_* variables for use. + */ +int loadheader(void) +{ + char *buffer; + long headerstart; + int z, start=0, entry=0; + + buffer = malloc(8096*4); + + /* Decode DBSOFT-HEADER */ + if((headerstart = findtext(decode("EEECFDEPEGFECNEIEFEBEEEFFC"))) < 0) + { + mesg("Could not find Selfinstaller header in executable."); + exit(2); + } + fseek(self, headerstart+13, SEEK_SET); + + fread(buffer, 1, 8096*4, self); + for(z=0;z<8096*4;z++) + { + if(buffer[z] == '-' || buffer[z] == '*') + { + char cur = buffer[z]; + buffer[z] = 0; + switch(entry) + { + case 0: + INSTALLER_APPLICATION = (char *)strdup(&buffer[start]); + break; + case 1: + INSTALLER_VERSION = (char *)strdup(&buffer[start]); + break; + case 2: + INSTALLER_TITLE = (char *)strdup(&buffer[start]); + break; + case 3: + INSTALLER_PATH = (char *)strdup(&buffer[start]); + break; + case 4: + INSTALLER_FOLDER = (char *)strdup(&buffer[start]); + break; + case 5: + INSTALLER_PROGRAM = (char *)strdup(&buffer[start]); + break; + case 6: + INSTALLER_SHADOW = (char *)strdup(&buffer[start]); + break; + case 7: + INSTALLER_OBJECT = (char *)strdup(&buffer[start]); + break; + case 8: + INSTALLER_SETS = (char *)strdup(&buffer[start]); + break; + case 9: + INSTALLER_SYSVAR = (char *)strdup(&buffer[start]); + break; + case 10: + INSTALLER_SYSLINE = (char *)strdup(&buffer[start]); + break; + case 11: + INSTALLER_CONFIRM_WPS = (char *)strdup(&buffer[start]); + break; + case 12: + INSTALLER_CONFIRM_CONFIGSYS = (char *)strdup(&buffer[start]); + break; + case 13: + INSTALLER_CONFIRM_OVERWRITE = (char *)strdup(&buffer[start]); + break; + case 14: + INSTALLER_PACKAGE_COUNT = atoi(&buffer[start]); + break; + default: + INSTALLER_PACKAGES[entry-15] = malloc((z-start)+1); + strcpy(INSTALLER_PACKAGES[entry-15], &buffer[start]); + break; + } + start = z+1; + if(cur == '*') + { + free(buffer); + return TRUE; + } + + entry++; + } + } + free(buffer); + return FALSE; +} + +/* + * Functions to work on an ace file embedded within the archive in an + * abstract manner. + */ +int aceread(void *buf, size_t count) +{ + unsigned long curpos = ftell(self); + size_t readit; + + if(count > (packagesize-(curpos-aceoffset))) + readit = (packagesize-(curpos-aceoffset)); + else + readit = count; + + return fread(buf, 1, readit, self); +} + +off_t acelseek(off_t offset, int whence) +{ + switch(whence) + { + case SEEK_SET: + fseek(self, aceoffset+offset, SEEK_SET); + break; + case SEEK_CUR: + fseek(self, offset, SEEK_CUR); + break; + } + acepos = ftell(self); + return acepos-aceoffset; +} + +int aceopen(const char *path, int flags) +{ + fseek(self, aceoffset, SEEK_SET); + return 1; +} + +int aceclose(int fd) +{ + fseek(self, aceoffset, SEEK_SET); + return 0; +} + +int acesize(void) +{ + return packagesize; +} + +int acetell(int fd) +{ + return ftell(self)-aceoffset; +} + +/* + * Read the generated log file and remove any files installed. + */ +void delete_files(void) +{ + char tmpbuf[8196], *fileptr; + FILE *tmplf; + int linenum=0, found=-1, z; + + files_deleted=1; + + if((tmplf=fopen(instlog, "rb"))==NULL) + return; + + while(!feof(tmplf)) + { + fgets(tmpbuf, 8196, tmplf); + linenum++; + if(tmpbuf[0]=='[' && (char *)strstr(tmpbuf, INSTALLER_APPLICATION) != NULL && !feof(tmplf)) + { + fgets(tmpbuf, 8196, tmplf); + linenum++; + if((char *)strstr(tmpbuf, "<Version>") != NULL && (char *)strstr(tmpbuf, INSTALLER_VERSION) != NULL) + found=linenum; + } + } + if(found != -1) + { + rewind(tmplf); + for (z=0;z<found;z++) + fgets(tmpbuf, 8196, tmplf); + while(!feof(tmplf)) + { + fgets(tmpbuf, 8196, tmplf); + if((char *)strstr(tmpbuf, "<FileInst>") != NULL) + { + fileptr = (char *)strchr(tmpbuf, ',')+1; + /* Remove trailing CRLFs */ + if(fileptr[strlen(fileptr)-1] == '\r' || fileptr[strlen(fileptr)-1] == '\n') + fileptr[strlen(fileptr)-1]=0; + if(fileptr[strlen(fileptr)-1] == '\r' || fileptr[strlen(fileptr)-1] == '\n') + fileptr[strlen(fileptr)-1]=0; + remove(fileptr); + current_file--; +#if 0 + sendmessage(0, 1); +#endif + } + if((char *)strstr(tmpbuf, "<End>") != NULL) + { + fclose(tmplf); + return; + } + } + } + fclose(tmplf); + return; +} + +/* + * Reads a config file into memory for editing with updatesys, updateset, etc. + */ +int readconfigfile(char *filename) +{ + char tmpbuf[8196]; + FILE *tmpcs; + + /* Reset this value when restarting */ + configfilecount = -1; + + if((tmpcs=fopen(filename, "rb"))==NULL) + { + strcpy(currentcf, empty_string); + return 1; + } + else + strcpy(currentcf, filename); + + while(!feof(tmpcs)) + { + configfilecount++; + fgets(tmpbuf, 8196, tmpcs); + configsys[configfilecount] = malloc(strlen(tmpbuf)+1); + strcpy(configsys[configfilecount], tmpbuf); + stripcrlf(configsys[configfilecount]); + } + + fclose(tmpcs); + return 0; +} + +/* + * Write the updated config file to disk and backup the original. + */ +int writeconfigfile(char *filename, char *backup) +{ + FILE *tmpcs; + int i; + + if(backup) + { + remove(backup); + rename(filename, backup); + } + else + remove(filename); + + if((tmpcs=fopen(filename, "wb"))==NULL) + return 1; + + for(i=0;i<configfilecount;i++) + { + if(configsys[i]) + { + fwrite(configsys[i], 1, strlen(configsys[i]), tmpcs); + /* Add the CRLF that got stripped in the reading stage. */ + fwrite("\r\n", 1, 2, tmpcs); + free(configsys[i]); + } + } + + fclose(tmpcs); + return 0; +} +/* + * Adds or replaces a SET variable based on the flags (CONFIG.SYS) + */ +void updateset(char *setname, char *newvalue, int flag) +{ + char *cmpbuf1, *cmpbuf2, *tmpptr, *tmpptr2, *nv; + int i, z, t; + + nv=replaceem(newvalue); + + cmpbuf1=malloc(strlen(setname)+2); + strcpy(cmpbuf1, setname); + strcat(cmpbuf1, "="); + for(i=0;i<configfilecount;i++) + { + if(strlen(cmpbuf1) <= strlen(configsys[i])) + { + tmpptr=(char *)strdup(configsys[i]); +#if defined(__EMX__) || defined(__OS2__) || defined(WIN32) || defined(WINNT) + strupr(tmpptr); +#endif + if((tmpptr2=(char*)strstr(tmpptr, "SET "))!=NULL) + { + tmpptr2 += 4; + cmpbuf2=malloc(strlen(tmpptr2)+1); + /* Remove any spaces from the string */ + z=0; + for (t=0;t<strlen(tmpptr2) && z < strlen(cmpbuf1);t++) + { + if(tmpptr2[t] != ' ') + { + cmpbuf2[z]=tmpptr2[t]; + z++; + } + } + cmpbuf2[z]=0; + if(stricmp(cmpbuf1, cmpbuf2) == 0) + { + /* Ok we found the entry, and if UPDATE_ALWAYS change it to the + new entry, otherwise exit */ + if(flag == UPDATE_ALWAYS) + { +#ifdef ENABLE_LOGGING + fprintf(logfile, "<CFRemLine>,%s,%s\r\n", currentcf, configsys[i]); +#endif + free(configsys[i]); + configsys[i] = malloc(strlen(setname)+strlen(nv)+6); + strcpy(configsys[i], "SET "); + strcat(configsys[i], setname); + strcat(configsys[i], "="); + strcat(configsys[i], nv); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<CFAddLine>,%s,%s\r\n", currentcf, configsys[i]); +#endif + free(cmpbuf1);free(cmpbuf2);free(tmpptr); + } + return; + } + free(cmpbuf2); + } + free(tmpptr); + } + } + /* Couldn't find the line so we'll add it */ + configsys[configfilecount]=malloc(strlen(cmpbuf1)+strlen(nv)+6); + strcpy(configsys[configfilecount], "SET "); + strcat(configsys[configfilecount], setname); + strcat(configsys[configfilecount], "="); + strcat(configsys[configfilecount], nv); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<CFAddLine>,%s,%s\r\n", currentcf, configsys[configfilecount]); +#endif + configfilecount++; + free(cmpbuf1); +} + +/* + * Adds an entry to a system variable (CONFIG.SYS) + */ +void updatesys(char *sysname, char *newvalue) +{ + char *cmpbuf1, *cmpbuf2, *tmpptr, *tmpptr2, *capbuf1, *capbuf2, *nv, *brian; + int i, z, t; + + nv=replaceem(newvalue); + + cmpbuf1=malloc(strlen(sysname)+2); + strcpy(cmpbuf1, sysname); + strcat(cmpbuf1, "="); + for(i=0;i<configfilecount;i++) + { + if(strlen(cmpbuf1) <= strlen(configsys[i])) + { + cmpbuf2=malloc(strlen(configsys[i])+1); + /* Remove any spaces from the string */ + z=0; + for (t=0;t<strlen(configsys[i]) && z < strlen(cmpbuf1);t++) + { + if(configsys[i][t] != ' ') + { + cmpbuf2[z]=configsys[i][t]; + z++; + } + } + cmpbuf2[z]=0; + if(stricmp(cmpbuf1, cmpbuf2) == 0) + { + /* Do a case insensitive comparison but preserve the case */ + tmpptr = &configsys[i][t]; + capbuf1=malloc(strlen(tmpptr)+1); + capbuf2=malloc(strlen(nv)+1); + strcpy(capbuf1, tmpptr); + strcpy(capbuf2, nv); +#if defined(__EMX__) || defined(__OS2__) || defined(WINNT) || defined(WIN32) + strupr(capbuf1); + strupr(capbuf2); +#endif + /* Ok, we found the line, and it doesn't have an entry so we'll add it */ + if((tmpptr2=(char *)strstr(capbuf1, capbuf2)) == NULL) + { +#ifdef ENABLE_LOGGING + fprintf(logfile, "<CFRemLine>,%s,%s\r\n", currentcf, configsys[i]); +#endif + brian = configsys[i]; + configsys[i] = malloc(strlen(configsys[i])+strlen(nv)+4); + strcpy(configsys[i], brian); + free(brian); + /* Remove any trailing CRLFs */ + if(configsys[i][strlen(configsys[i])-1]!=';') + strcat(configsys[i], ";"); + strcat(configsys[i], nv); + strcat(configsys[i], ";"); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<CFAddLine>,%s,%s\r\n", currentcf, configsys[i]); +#endif + } + free(cmpbuf1);free(cmpbuf2);free(capbuf1);free(capbuf2); + return; + } + free(cmpbuf2); + } + } + /* Couldn't find the line so we'll add it */ + configsys[configfilecount]=malloc(strlen(cmpbuf1)+strlen(nv)+3); + strcpy(configsys[configfilecount], cmpbuf1); + strcat(configsys[configfilecount], nv); + strcat(configsys[configfilecount], ";"); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<CFAddLine>,%s,%s", currentcf, configsys[configfilecount]); +#endif + configfilecount++; + free(cmpbuf1); + if(nv) + free(nv); +} + +/* + * Removes a line from a config file. + */ +void removeline(char *text) +{ + int z; + for(z=0;z<configfilecount;z++) + { + if(stricmp(configsys[z], text) == 0) + { + int t; + +#ifdef ENABLE_LOGGING + fprintf(logfile, "<CFRemLine>,%s,%s\r\n", currentcf, configsys[z]); +#endif + free(configsys[z]); + for(t=z;t<(configfilecount-1);t++) + configsys[t] = configsys[t+1]; + configfilecount--; + } + } +} + + +/* + * The Window peocedure for the confirmation dialog. + */ +#if 0 +MRESULT EXPENTRY ConfirmDlgProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) +{ + SWP winpos; + + switch (msg) + { + case WM_INITDLG: + WinSetWindowText(hWnd, INSTALLER_TITLE); + WinEnableWindow(WinWindowFromID(mainhwnd, I_Cancel), FALSE); + WinSetDlgItemText(hWnd, I_Confirm, confirmstring); + WinQueryWindowPos(mainhwnd, &winpos); + WinSetWindowPos(hWnd, HWND_TOP, winpos.x+30, winpos.y+30, 0, 0, SWP_MOVE | SWP_ZORDER); + break; + case WM_COMMAND: + WinEnableWindow(WinWindowFromID(mainhwnd, I_Cancel), TRUE); + switch ( SHORT1FROMMP(mp1) ) + { + case I_Ja: + WinDismissDlg(hWnd, 0); + break; + case I_Alle: + WinDismissDlg(hWnd, 1); + break; + case I_Nein: + WinDismissDlg(hWnd, 2); + break; + case I_Halt: + success=2; + installstate=ABORTED; + WinDismissDlg(hWnd, 3); + break; + } + break; + default : + return(WinDefDlgProc(hWnd, msg, mp1, mp2)); + } + return(0L); +} +#endif +/* + * Display a confirmation dialog with the options: YES NO ALL CANCEL + * Returns: 0 for YES, 1 for ALL, 2 for NO and 3 for CANCEL + */ +int confirm(char *format, ...) { + va_list args; + + /* if no confirmation, return 1, meaning overwrite all */ + if (stricmp(INSTALLER_CONFIRM_OVERWRITE, "no") == 0) + return 1; + + va_start(args, format); + vsprintf(confirmstring, format, args); + va_end(args); + + /* Do something here in wxwindows */ + return 1; +} + +/* + * A function to grab a file from an embedded archive and extract it to the TEMP directory. + */ +void grabfile(char *filename) +{ + no_update = 1; + settempdir(); + remove(filename); + aceseek_entry(0); + resetglobals(); + installer_unpack(filename, 2); + no_update = 0; +} + +/* + * This thread runs along side the main thread allowing the user to cancel the process. + */ +void install_thread(void *param) +{ + char tmpinstallpath[1024]; + int k, j, installcount=0, installed=0; + + if(INSTALLER_PACKAGE_COUNT == 2) + packagesselected[1] = TRUE; + + installstate = INSTALLING; + +#ifdef ENABLE_LOGGING + if((logfile=fopen(instlog, "ab"))==NULL) + { + error("Log file \"%s\" open failed! Installation aborted!", instlog); + exit(1); + } + + fprintf(logfile, "[%s]\r\n<Version>,%s\r\n<Start>\r\n", INSTALLER_APPLICATION, INSTALLER_VERSION); +#endif + + /* Create nested subdirectories if necessary. */ + strcpy(tmpinstallpath, installdir); + for(k=3;k<strlen(installdir);k++) + { + if(tmpinstallpath[k] == '\\') + { + tmpinstallpath[k] = 0; +#if defined(__EMX__) || defined(__CYGWIN__) || defined(UNIX) + if (!mkdir(tmpinstallpath, 0)) +#else + if (!mkdir(tmpinstallpath)) +#endif +#ifdef ENABLE_LOGGING + fprintf(logfile, "<NewDir>,%s\r\n", tmpinstallpath); +#else + ; +#endif + tmpinstallpath[k] = '\\'; + } + } + +#if defined(__EMX__) || defined(__CYGWIN__) || defined(UNIX) + if (!mkdir(installdir, 0)) +#else + if (!mkdir(installdir)) +#endif +#ifdef ENABLE_LOGGING + fprintf(logfile, "<NewDir>,%s\r\n", installdir); +#else + ; +#endif + + /*if(strlen(installdir) > 0 && installdir[0] > 'a'-1 && installdir[0] < 'z'+1) + installdir[0]=installdir[0] - ('a'-'A'); + if(strlen(installdir)>2 && installdir[1]==':' && installdir[2]=='\\') + DosSetDefaultDisk((int)(installdir[0]-'A'+1));*/ + + setdrivedir(installdir); + + /* Unpack files to destination directory */ + for(j=1;j<INSTALLER_PACKAGE_COUNT;j++) + { + if(packagesselected[j] == TRUE) + installcount++; + } + if(installcount == 0) + { + mesg("No packages selected for installation!"); + } + else + { + for(j=1;j<INSTALLER_PACKAGE_COUNT;j++) + { + if(packagesselected[j] == TRUE) + { +#if 0 + char statustext[512]; +#endif + aceseek_entry(j); + resetglobals(); +#if 0 + sprintf(statustext,"Copying Files for %s %d/%d, Press \"Exit Installation\" to Abort.", INSTALLER_PACKAGES[j], installed+1, installcount); + WinSetDlgItemText(mainhwnd, I_Info3, statustext); +#endif + /* filename parameter when null is all files */ + installer_unpack(NULL, 2); + installed++; + } + } + } + + if(success==1) + { + error("Error unpacking files, Installer may be corrupt!"); + } + + if(success==2) + { + error("User aborted installation!"); + } + + if(installstate != ABORTED) + installstate = COMPLETED; + +#if 0 + sendmessage(0, 2); +#endif +} + +/* + * Use the information from the .cfg file which is embedded in the EXE to update the + * CONFIG.SYS settings. + */ +void configsys_update(void) +{ + char *arg1, *arg2, *arg3; + char temp[5000]; + int z, argn=0; + + if(readconfigfile(csfile)) + return; + + /* Update Miscellaneous lines */ + if(strlen(INSTALLER_SYSLINE)>0) + { + char *tmpptr = &temp[0]; + int len; + + strcpy(temp, INSTALLER_SYSLINE); + temp[4999] = 0; + len = strlen(temp); + + for(z=0;z<len;z++) + { + if(temp[z]==',') + { + char *tmpptr2; + + temp[z] = 0; + tmpptr2 = replaceem(tmpptr); + tmpptr = &temp[z+1]; + removeline(tmpptr2); + configsys[configfilecount] = tmpptr2; +#ifdef ENABLE_LOGGING + fprintf(logfile, "<CFAddLine>,%s,%s\r\n", currentcf, tmpptr2); +#endif + configfilecount++; + } + } + if(tmpptr && *tmpptr) + { + char *tmpptr2; + + tmpptr2 = replaceem(tmpptr); + removeline(tmpptr2); + configsys[configfilecount] = tmpptr2; +#ifdef ENABLE_LOGGING + fprintf(logfile, "<CFAddLine>,%s,%s\r\n", currentcf, tmpptr2); +#endif + configfilecount++; + } + + } + /* Update SET variables */ + if(strlen(INSTALLER_SETS)>0) + { + strcpy(temp, INSTALLER_SETS); + argn=0; + arg1=&temp[0]; + arg2=arg3=NULL; + for(z=0;z<strlen(INSTALLER_SETS);z++) + { + if(temp[z]==',') + { + argn++; + temp[z]=0; + switch(argn) + { + case 1: + arg2=&temp[z+1]; + break; + case 2: + arg3=&temp[z+1]; + break; + case 3: + argn=0; + updateset(arg1, arg2, (int)(arg3[0]-'0')); + arg1=&temp[z+1]; + arg2=arg3=NULL; + break; + } + } + } + if(arg3) + updateset(arg1, arg2, (int)arg3-'0'); + } + /* Update system variables */ + if(strlen(INSTALLER_SYSVAR)>0) + { + strcpy(temp, INSTALLER_SYSVAR); + argn=0; + arg1=&temp[0]; + arg2=NULL; + for(z=0;z<strlen(INSTALLER_SYSVAR);z++) + { + if(temp[z]==',') + { + argn++; + temp[z]=0; + switch(argn) + { + case 1: + arg2=&temp[z+1]; + break; + case 2: + argn=0; + updatesys(arg1, arg2); + arg1=&temp[z+1]; + arg2=NULL; + break; + } + } + } + if(arg2) + updatesys(arg1, arg2); + } + + writeconfigfile(csfile, bufile); +} + +/* + * Reads a line from a file and returns it in raw. + */ +void getline(FILE *f, char *raw) +{ + memset(raw, 0, 256); + fgets(raw, 255, f); + stripcrlf(raw); +} + +/* + * Removes a character from a buffer by advancing the buffer to the left. + */ +void removechar(char *buffer, int thisone, int len) +{ + int x; + + for(x=thisone;x<len;x++) + buffer[x] = buffer[x+1]; +} + +/* + * Breaks up a line in raw into it's components. + */ +void parseline(char *raw, char comment, char delimiter, char quotes, char *entry, char *entrydata, char *entrydata2) +{ + char in[256]; + int z, len, in_quotes = 0, entrynum=0, last = 0; + + strcpy(entry, empty_string); + strcpy(entrydata, empty_string); + strcpy(entrydata2, empty_string); + strcpy(in, raw); + + if(in[strlen(in)-1] == '\n') + in[strlen(in)-1] = 0; + + if(in[0] != comment) + { + len=strlen(in); + for(z=0;z<len;z++) + { + if(!in_quotes && in[z] == delimiter) + { + in[z] = 0; + /* Strip any other delimiters */ + z++; + while(in[z] == delimiter && z < len) + z++; + if(!entrynum) + strcpy(entry, in); + else + { + strcpy(entrydata, &in[last]); + strcpy(entrydata2, &in[z]); + } + last = z; + if(entrynum) + return; + entrynum++; + } + if(in[z] == quotes) + { + removechar(in, z, len); + z--; + len--; + if(in_quotes) + in_quotes = 0; + else + in_quotes = 1; + } + } + if(!entrynum) + strcpy(entry, in); + else + strcpy(entrydata, &in[last]); + } +} + +/* + * Reads a line from the file and splits it up into it's components. + */ +int getparseline(FILE *f, char comment, char delimiter, char quotes, char *raw, char *entry, char *entrydata, char *entrydata2) +{ + getline(f, raw); + parseline(raw, comment, delimiter, quotes, entry, entrydata, entrydata2); + return strlen(raw); +} + + +void install_init(char *installername) +{ + if((self = fopen(installername, "rb")) == NULL) + { + mesg("Could not open SFX archive for reading!"); + exit(1); + } + if(loadheader() == FALSE) + { + mesg("Could not load all required variables!"); + exit(3); + } + + strcpy(installdir, INSTALLER_PATH); +} + + diff --git a/utils/Install/install.h b/utils/Install/install.h new file mode 100644 index 0000000000..bdd7206f57 --- /dev/null +++ b/utils/Install/install.h @@ -0,0 +1,116 @@ +#ifdef __cplusplus +extern "C" { +#endif + +#define I_DialogBeta 329 +#define I_Dialog1 330 +#define I_Dialog2 331 +#define I_Dialog3 332 +#define I_Dialog4 333 +#define I_Dialog5 334 +#define I_Dialog6 335 +#define I_Dialog7 336 +#define I_Dialog8 337 +#define I_Dialog9 338 +#define I_Dialog10 339 +#define I_Dialog11 340 +#define I_Dialog12 341 + +#define I_Cancel 258 +#define I_Icon 261 +#define I_Logo 262 +#define I_Ja 265 +#define I_Nein 266 +#define I_Halt 267 +#define I_Alle 268 +#define I_Karte 269 +#define I_Confirm 270 +#define I_BMPWin 271 +#define I_Dest 300 +#define I_Text 301 +#define I_OK 304 +#define I_Cancel2 305 +#define I_Logo16 306 + +#define NONE 0 +#define INSTALLING 1 +#define ABORTED 2 +#define COMPLETED 3 + +#define UPDATE_ALWAYS 1 +#define UPDATE_NONEXIST 2 + +#define DLG_PACKAGESTOINSTALL 305 +#define PACKAGES 306 +#define PB_SELECTALL 308 +#define PB_DESELECTALL 309 +#define DLG_SELECTINSTALLATIONDRIVE 311 +#define PB_OK 313 +#define PB_CANCEL 314 +#define DRIVELIST 312 +#define I_LOGO1 316 +#define I_LOGO2 317 +#define I_LOGO3 318 +#define I_LOGO4 319 +#define I_LOGO5 320 +#define I_LOGO6 321 +#define I_LOGO7 322 +#define I_LOGO8 323 +#define I_LOGOBETA 324 + +/* These are static */ +#define I_Status 348 +#define I_Welcome 349 + +/* Keep these in order... so we can loop */ +#define I_INFOBOX 355 +#define I_Info1 356 +#define I_Info2 357 +#define I_Info3 358 +#define I_README 359 +#define I_Licence 360 +#define I_Agree 361 +#define I_Updates1 362 +#define I_Updates2 363 +#define I_Updates4 364 +#define I_Updates3 365 +#define I_Dirs 366 +#define I_InstallDir 367 +#define I_Drives 368 +#define I_Percent 369 +#define I_Back 370 +#define I_Next 371 +#define I_Progress 372 +#define I_Grid 373 +#define I_MAX 374 + +#define FILEICON 3800 +#define FOLDERICON 3810 + +#define THREAD_STACK_SIZE 32768 + +#ifndef MAX_PATH +#define MAX_PATH 1024 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +/* #define ENABLE_LOGGING */ + + +void grabfile(char *filename); +void readme(void *param); +void install_thread(void *param); +void install_init(char *installername); +int getparseline(FILE *f, char comment, char delimiter, char quotes, char *raw, char *entry, char *entrydata, char *entrydata2); + +#ifdef __cplusplus +} +#endif + diff --git a/utils/Install/instsup.cpp b/utils/Install/instsup.cpp new file mode 100644 index 0000000000..c0767697cb --- /dev/null +++ b/utils/Install/instsup.cpp @@ -0,0 +1,717 @@ +/* + * instsup.c (c) 1999,2000 Brian Smith + */ + +#include "wx/wxprec.h" + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include <stdio.h> +#include <stddef.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <fcntl.h> +#if defined(__OS2__) || defined(__EMX__) || defined(WIN32) || defined(WINNT) +#include <process.h> +#endif +#include <sys/types.h> +#ifdef WIN32 +#include <shlobj.h> +#endif +#include "install.h" +#include "instsup.h" + +extern char *INSTALLER_TITLE; +extern char *INSTALLER_PROGRAM; +extern char *INSTALLER_FOLDER; +extern char *INSTALLER_SHADOW; +extern char *INSTALLER_OBJECT; +extern char tempPath[], installdir[], csfile[], bufile[], bootdrive[], instlog[], installdir2[]; +extern int installstate, success; + +extern FILE *self; + +#ifdef __cplusplus +extern "C" { +#endif + +char *replaceem(char *orig); + +int sendmessage(int destination, int messid) +{ +#if 0 + /* Update percentage bar */ + if(messid == 1) + { + wxMutexGuiEnter(); + + updatepercent(); + + wxMutexGuiLeave(); + } + if(messid == 2) + { + extern wxCondition *InstCond; + + InstCond->Broadcast(); + } + +#endif + return 0; +} + +void DoGUI(void) +{ + updatepercent(); + wxYield(); +} +/* This should return the current color depth */ +unsigned long color_depth(void) +{ +#if __OS2__ + HDC hdc = WinOpenWindowDC(HWND_DESKTOP); + LONG colors; + + DevQueryCaps(hdc, CAPS_COLORS, 1, &colors); + DevCloseDC(hdc); + return colors; +#endif + return 0; +} + +/* + * Call the reboot vector. + */ +void sysreboot(void) +{ +#if __OS2__ +#define SYSFUNC 0xD5 +#define REBOOT 0xAB +#define REBOOTDEV "\\DEV\\DOS$" + + APIRET rc; + HFILE hREBOOT; + ULONG ulAction; + + rc = DosOpen(REBOOTDEV, + &hREBOOT, + &ulAction, + 0L, + FILE_NORMAL, + FILE_OPEN, + OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE, + 0L); + if (rc == 0) + { + DosDevIOCtl(hREBOOT, + SYSFUNC, + REBOOT, + NULL, + 0L, + NULL, + NULL, + 0L, + NULL); + DosClose(hREBOOT); + } +#endif +} + +/* + * Display an informational dialog box to the user with the given text. + */ +int mesg(char *format, ...) { + va_list args; + char outbuf[4096]; + + va_start(args, format); + vsprintf(outbuf, format, args); + va_end(args); + + wxMessageBox(outbuf, INSTALLER_TITLE, + wxOK | wxICON_EXCLAMATION, NULL); + + return strlen(outbuf); +} + +int checktext(char *text, char *buffer, int buflen) +{ + int z, len = strlen(text); + + for(z=0;z<(buflen-len);z++) + { + if(memcmp(text, &buffer[z], len) == 0) + return z; + } + return -1; + +} + +/* + * Returns the offset withing the executable to the specified text. + */ +long findtext(char *text) +{ + char buffer[512]; + int offset; + unsigned long curpos = 0; + + fseek(self, 0, SEEK_SET); + fread(buffer, 1, 512, self); + if((offset = checktext(text, buffer, 512)) > -1) + return offset; + while(!feof(self)) + { + memcpy(buffer, &buffer[256], 256); + fread(&buffer[256], 1, 256, self); + curpos += 256; + if((offset = checktext(text, buffer, 512)) > -1) + return offset+curpos; + + } + return -1; +} + +/* We encode archive search text so we don't get confused + * by the string table - I was using LXLite to take care + * of this problem on OS/2 but in portable code this may + * not be an option. */ +char *decode(char *input) +{ + char *result; + int i = 0; + + result = (char *)malloc(strlen(input) / 2 + 1); + + while (input[0] && input[1]) + { + result[i] = ((input[0] - 0x41) << 4) | (input[1] - 0x41); + input += 2; + i++; + } + result[i] = '\0'; + + return result; +} + +/* + * Removes any carriage returns or line feeds from the buffer. + */ +void stripcrlf(char *buffer) +{ + int z, len = strlen(buffer); + + for(z=0;z<len;z++) + { + if(buffer[z] == '\r' || buffer[z] == '\n') + { + buffer[z] = 0; + return; + } + } +} + +/* + * Returns the space free on a given drive... where 0 is A: in MB + */ +unsigned long drivefree(int drive) +{ +#if __OS2__ + ULONG aulFSInfoBuf[40] = {0}; + APIRET rc = NO_ERROR; + double bytesFree; + + DosError(FERR_DISABLEHARDERR); + rc = DosQueryFSInfo(drive, + FSIL_ALLOC, + (PVOID)aulFSInfoBuf, + sizeof(aulFSInfoBuf)); + + DosError(FERR_ENABLEHARDERR); + if (rc != NO_ERROR) + return 0; + + bytesFree = (double)aulFSInfoBuf[3] * (double)aulFSInfoBuf[1] * (USHORT)aulFSInfoBuf[4]; + return (unsigned long)(bytesFree / (1024.0 * 1024.0)); +#endif + return 0; +} + + +/* + * Display a fatal error message and set the abort flag in case we are in a secondary thread. + */ +void error(char *format, ...) { + va_list args; + char errstring[1024]; + + va_start(args, format); + vsprintf(errstring, format, args); + va_end(args); + + if(installstate != ABORTED) + { + success=1; + installstate=ABORTED; + } + wxMessageBox(errstring, INSTALLER_TITLE, + wxOK | wxICON_EXCLAMATION, NULL); +} + +void setdrivedir(char *drivedir) +{ + wxSetWorkingDirectory(drivedir); +} + +/* + * Make the TEMP directory the current directory, or the root directory of the boot drive. + */ +void settempdir(void) +{ +#if defined(__EMX__) || defined(__OS2__) || defined(WIN32) || defined(WINNT) + /* Windows or OS/2 */ + char *envdir = getenv("TMP"); + int len; + + if (!envdir) + envdir = getenv("TEMP"); + if (!envdir) + envdir = replaceem("%BOOTDRIVE%:\\"); + strcpy(tempPath,envdir); + len = strlen(tempPath); + if (len > 3 && tempPath[len-1] == '\\') + tempPath[len-1] = 0; + strupr(tempPath); + setdrivedir(tempPath); +#else + /* Unix */ + setdrivedir("/tmp"); +#endif +} + +void getbootdrive(void) +{ + /* On windows I don't think you can boot from anything + except C: drive. So I am not going to do anything here. */ +} + +void PM_backslash(char *s) +{ + unsigned int pos = strlen(s); + if (s[pos-1] != '\\') { + s[pos] = '\\'; + s[pos+1] = '\0'; + } +} + +/* + * Makes a folder on the desktop. + */ +void MakeFolder(char Title[], char Icon[], char dest[], char id[], char setup[]) +{ +#ifdef __OS2__ + char szArg[200]; + + memset(szArg,0,sizeof(szArg)); + + if ((Icon != NULL) && (strlen(Icon) != 0)) + { + strcat(szArg,"ICONFILE="); + strcat(szArg,Icon); + } + + if ((id != NULL) && (strlen(id) != 0)) + { + strcat(szArg,";OBJECTID="); + strcat(szArg,id); + } + + if ((setup != NULL) && (strlen(setup) != 0)) + { + strcat(szArg,";"); + strcat(szArg,setup); + } + + WinCreateObject("WPFolder",Title,szArg,dest,CO_REPLACEIFEXISTS); +#elif defined(WIN32) + char startpath[MAX_PATH]; + LPITEMIDLIST pidl; + + if(!SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS, &pidl)) + { + SHGetPathFromIDList(pidl, startpath); + + if(startpath[strlen(startpath)-1] != '\\') + strcat(startpath, "\\"); + strcat(startpath, Title); + CreateDirectory(startpath, NULL); + } +#else + /* Unix? */ +#endif +} + +#ifdef WIN32 +HRESULT CreateLink(LPCSTR lpszPathObj, + LPSTR lpszPathLink, LPSTR lpszDesc) +{ + HRESULT hres; + IShellLink* psl; + + // Get a pointer to the IShellLink interface. + hres = CoCreateInstance(CLSID_ShellLink, NULL, + CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl); + if (SUCCEEDED(hres)) { + IPersistFile* ppf; + + // Set the path to the shortcut target, and add the + // description. + psl->SetPath(lpszPathObj); + + psl->SetDescription(lpszDesc); + + // Query IShellLink for the IPersistFile interface for saving the + // shortcut in persistent storage. + hres = psl->QueryInterface(IID_IPersistFile, + (void **)&ppf); + + if (SUCCEEDED(hres)) { + WCHAR wsz[MAX_PATH]; + + // Ensure that the string is ANSI. + MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, + wsz, MAX_PATH); + + + // Save the link by calling IPersistFile::Save. + hres = ppf->Save(wsz, TRUE); + ppf->Release(); + } + psl->Release(); + } + return hres; +} +#endif + +/* + * Makes a Program object on the desktop. + */ +void MakeProgram(char Title[], char Program[], char Icon[], char dest[], char id[], char setup[]) +{ +#ifdef __OS2__ + char szArg[200]; + + memset(szArg,0,sizeof(szArg)); + + strcat(szArg,"EXENAME="); + strcat(szArg,Program); + + if ((Icon != NULL) && (strlen(Icon) != 0)) + { + strcat(szArg,";ICONFILE="); + strcat(szArg,Icon); + } + + if ((id != NULL) && (strlen(id) != 0)) + { + strcat(szArg,";OBJECTID="); + strcat(szArg,id); + } + + if ((setup != NULL) && (strlen(setup) != 0)) + { + strcat(szArg,";"); + strcat(szArg,setup); + } + + WinCreateObject("WPProgram",Title,szArg,dest,CO_REPLACEIFEXISTS); +#elif defined(WIN32) + char startpath[MAX_PATH]; + LPITEMIDLIST pidl; + + if(!SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS, &pidl)) + { + SHGetPathFromIDList(pidl, startpath); + + if(startpath[strlen(startpath)-1] != '\\') + strcat(startpath, "\\"); + strcat(startpath, dest); + strcat(startpath, "\\"); + strcat(startpath, Title); + strcat(startpath, ".lnk"); + + CoInitialize(NULL); + CreateLink(Program, startpath, Title); + CoUninitialize(); + } + + +#else + /* Unix? */ +#endif +} +/* + * Makes a user defined object on the desktop. + */ +void MakeObject(char Title[], char oclass[], char dest[], char id[], char setup[]) +{ +#ifdef __OS2__ + char szArg[200]; + + memset(szArg,0,sizeof(szArg)); + + if ((oclass == NULL) || (strlen(oclass) == 0)) + return; + + if ((id != NULL) && (strlen(id) != 0)) + { + strcat(szArg,"OBJECTID="); + strcat(szArg,id); + } + + if ((setup != NULL) && (strlen(setup) != 0)) + { + if ((id != NULL) && (strlen(id) != 0)) + strcat(szArg,";"); + strcat(szArg,setup); + } + + WinCreateObject(oclass,Title,szArg,dest,CO_REPLACEIFEXISTS); +#elif defined(WIN32) + /* Not sure if there is an equivilent on Windows */ +#else + /* Unix? */ +#endif +} +/* + * Makes a shadow on the desktop. + */ +void MakeShadow(char Title[], char reference[], char dest[], char id[]) +{ +#ifdef __OS2__ + char szArg[400]; + + memset(szArg,0,sizeof(szArg)); + + strcpy(szArg,"SHADOWID="); + strcat(szArg,reference); + if ((id != NULL) && (strlen(id) != 0)) + { + strcat(szArg,";OBJECTID="); + strcat(szArg,id); + } + strcat(szArg,";"); + WinCreateObject("WPShadow",Title,szArg,dest,CO_REPLACEIFEXISTS); +#elif defined(WIN32) + /* Nothing like this on Windows9x anyway */ +#else + /* Unix? */ +#endif +} + +/* This creates program objects on the desktop, it was originally designed + * for the OS/2 Workplace Shell so it may be somewhat different in use on + * other platforms. + */ +void create_wps_objects(void) +{ + char *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; + char temp[5000]; + char zerotext[2] = ""; + int z, argn, len; + + /* No distinction for the moment... this may change.. */ + strcpy(installdir2, installdir); + + /* Create Folder Objects */ + if(strlen(INSTALLER_FOLDER)>0) + { + strcpy(temp, replaceem(INSTALLER_FOLDER)); + argn=0; + arg1=&temp[0]; + arg2=arg3=arg4=arg5=&zerotext[0]; + len = strlen(temp); + for(z=0;z<len;z++) + { + if(temp[z]==',') + { + argn++; + temp[z]=0; + switch(argn) + { + case 1: + arg2=&temp[z+1]; + break; + case 2: + arg3=&temp[z+1]; + break; + case 3: + arg4=&temp[z+1]; + break; + case 4: + arg5=&temp[z+1]; + break; + case 5: + argn=0; + MakeFolder(arg1, arg2, arg3, arg4, arg5); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<WPSFolderAdd>,%s,%s,%s,%s,%s\r\n", arg1, arg2,arg3,arg4,arg5); +#endif + arg1=&temp[z+1]; + arg2=arg3=arg4=arg5=&zerotext[0]; + break; + } + } + } + MakeFolder(arg1, arg2, arg3, arg4, arg5); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<WPSFolderAdd>,%s,%s,%s,%s,%s\r\n", arg1, arg2,arg3,arg4,arg5); +#endif + } + + /* Create Program Objects */ + if(strlen(INSTALLER_PROGRAM)>0) + { + strcpy(temp, replaceem(INSTALLER_PROGRAM)); + argn=0; + arg1=&temp[0]; + arg2=arg3=arg4=arg5=arg6=&zerotext[0]; + len = strlen(temp); + for(z=0;z<len;z++) + { + if(temp[z]==',') + { + argn++; + temp[z]=0; + switch(argn) + { + case 1: + arg2=&temp[z+1]; + break; + case 2: + arg3=&temp[z+1]; + break; + case 3: + arg4=&temp[z+1]; + break; + case 4: + arg5=&temp[z+1]; + break; + case 5: + arg6=&temp[z+1]; + break; + case 6: + argn=0; + MakeProgram(arg1, arg2, arg3, arg4, arg5, arg6); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<WPSProgramAdd>,%s,%s,%s,%s,%s,%s\r\n", arg1,arg2,arg3,arg4,arg5,arg6); +#endif + arg1=&temp[z+1]; + arg2=arg3=arg4=arg5=arg6=&zerotext[0]; + break; + } + } + } + MakeProgram(arg1, arg2, arg3, arg4, arg5, arg6); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<WPSProgramAdd>,%s,%s,%s,%s,%s,%s\r\n", arg1, arg2,arg3,arg4,arg5,arg6); +#endif + } + + /* Create Shadow Objects */ + if(strlen(INSTALLER_SHADOW)>0) + { + strcpy(temp, replaceem(INSTALLER_SHADOW)); + argn=0; + arg1=&temp[0]; + arg2=arg3=arg4=&zerotext[0]; + len = strlen(temp); + for(z=0;z<len;z++) + { + if(temp[z]==',') + { + argn++; + temp[z]=0; + switch(argn) + { + case 1: + arg2=&temp[z+1]; + break; + case 2: + arg3=&temp[z+1]; + break; + case 3: + arg4=&temp[z+1]; + break; + case 4: + argn=0; + MakeShadow(arg1, arg2, arg3, arg4); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<WPSShadowAdd>,%s,%s,%s,%s\r\n", arg1,arg2,arg3,arg4); +#endif + arg1=&temp[z+1]; + arg2=arg3=arg4=&zerotext[0]; + break; + } + } + } + MakeShadow(arg1, arg2, arg3, arg4); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<WPSShadowAdd>,%s,%s,%s,%s\r\n", arg1,arg2,arg3,arg4); +#endif + } + + /* Create Generic Objects */ + if(strlen(INSTALLER_OBJECT)>0) + { + strcpy(temp, replaceem(INSTALLER_OBJECT)); + argn=0; + arg1=&temp[0]; + arg2=arg3=arg4=arg5=&zerotext[0]; + len = strlen(temp); + for(z=0;z<len;z++) + { + if(temp[z]==',') + { + argn++; + temp[z]=0; + switch(argn) + { + case 1: + arg2=&temp[z+1]; + break; + case 2: + arg3=&temp[z+1]; + break; + case 3: + arg4=&temp[z+1]; + break; + case 4: + arg5=&temp[z+1]; + break; + case 5: + argn=0; + MakeObject(arg1, arg2, arg3, arg4, arg5); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<WPSObjectAdd>,%s,%s,%s,%s,%s\r\n", arg1,arg2,arg3,arg4,arg5); +#endif + arg1=&temp[z+1]; + arg2=arg3=arg4=arg5=&zerotext[0]; + break; + } + } + } + MakeObject(arg1, arg2, arg3, arg4, arg5); +#ifdef ENABLE_LOGGING + fprintf(logfile, "<WPSObjectAdd>,%s,%s,%s,%s,%s\r\n", arg1, arg2,arg3,arg4,arg5); +#endif + } +} + + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/utils/Install/instsup.h b/utils/Install/instsup.h new file mode 100644 index 0000000000..b2e1c1d27d --- /dev/null +++ b/utils/Install/instsup.h @@ -0,0 +1,26 @@ +#ifdef __cplusplus +extern "C" { +#endif +void create_wps_objects(void); +unsigned long color_depth(void); +void sysreboot(void); +int mesg(char *format, ...); +int checktext(char *text, char *buffer, int buflen); +long findtext(char *text); +char *decode(char *input); +void viewfile(char *filename); +void stripcrlf(char *buffer); +unsigned long drivefree(int drive); +void error(char *format, ...); +void setdrivedir(char *drivedir); +void settempdir(void); +void getbootdrive(void); +int cmdrun(char *progname); +void PM_backslash(char *s); +int sendmessage(int destination, int messid); +void DoGUI(void); +#ifdef __cplusplus +} +#endif +int parse_ini(char *filename); +void updatepercent(void); \ No newline at end of file diff --git a/utils/Install/packace/globals.c b/utils/Install/packace/globals.c new file mode 100644 index 0000000000..b28c4f22c0 --- /dev/null +++ b/utils/Install/packace/globals.c @@ -0,0 +1,134 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Global variable declarations */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include "os.h" + +#include "acestruc.h" +#include "unace.h" + +#include <string.h> +#include <stdio.h> + +//-------- Ace sign +const char *acesign = "**ACE**"; + +//-------- Version string for program +const char *version="UNACE v1.1 public version\n"; + +#ifdef AMIGA +//-------- Version string for VERSION program +static char *_version="$VER: Unace Amiga 1.1 "__AMIGADATE__"\n\n"; +#endif + +//-------- header buffer and pointers +thead head; + +tmhead *t_mhead = (tmhead *) & head; +tfhead *t_fhead = (tfhead *) & head; + +//-------- buffers +ULONG *buf_rd =0; +CHAR *buf =0; +CHAR *buf_wr =0; +UCHAR *readbuf =0; + +//-------- decompressor variables +SHORT rpos =0, + dcpr_do =0, + dcpr_do_max =0, + blocksize =0, + dcpr_dic =0, + dcpr_oldnum =0, + bits_rd =0, + dcpr_frst_file =0; +USHORT dcpr_code_mn[1 << maxwd_mn], + dcpr_code_lg[1 << maxwd_lg]; +UCHAR dcpr_wd_mn[maxcode + 2], + dcpr_wd_lg[maxcode + 2], + wd_svwd[svwd_cnt]; +ULONG dcpr_dpos =0, + cpr_dpos2 =0, + dcpr_dicsiz =0, + dcpr_dican =0, + dcpr_size =0, + dcpr_olddist[4]={0,0,0,0}, + code_rd =0; + +CHAR *dcpr_text =0; + +//-------- quicksort +USHORT sort_org[maxcode + 2]; +UCHAR sort_freq[(maxcode + 2) * 2]; + +//-------- file handling +CHAR aname[PATH_MAX]; +INT archan, + wrhan; +#if !defined(__EMX__) && !defined(__OS2__) +FILE *farchan = NULL; +#endif +LONG skipsize=0; + +//-------- structures for archive handling +struct tadat adat; + +//-------- flags +INT f_err =0, + f_ovrall =0, + f_allvol_pr=0, + f_curpas =0, + f_criterr =0; + + +void resetglobals(void) +{ + t_mhead = (tmhead *) & head; + t_fhead = (tfhead *) & head; + + buf_rd =0; + buf =0; + buf_wr =0; + readbuf =0; + + rpos =0; + dcpr_do =0; + dcpr_do_max =0; + blocksize =0; + dcpr_dic =0; + dcpr_oldnum =0; + bits_rd =0; + dcpr_frst_file =0; + + memset(&dcpr_code_mn, 0, sizeof(dcpr_code_mn)); + memset(&dcpr_code_lg, 0, sizeof(dcpr_code_lg)); + memset(&dcpr_wd_mn, 0, sizeof(dcpr_wd_mn)); + memset(&dcpr_wd_lg, 0, sizeof(dcpr_wd_lg)); + memset(&wd_svwd, 0, sizeof(wd_svwd)); + dcpr_dpos =0; + cpr_dpos2 =0; + dcpr_dicsiz =0; + dcpr_dican =0; + dcpr_size =0; + + memset(&dcpr_olddist, 0, sizeof(dcpr_olddist)); + + code_rd =0; + dcpr_text =0; + + memset(&sort_org, 0, sizeof(sort_org)); + memset(&sort_freq, 0, sizeof(sort_freq)); + + archan=0; + wrhan=0; + skipsize=0; + + f_err =0; + f_ovrall =0; + f_allvol_pr=0; + f_curpas =0; + f_criterr =0; + +} diff --git a/utils/Install/packace/makefile b/utils/Install/packace/makefile new file mode 100644 index 0000000000..837e7878d0 --- /dev/null +++ b/utils/Install/packace/makefile @@ -0,0 +1,46 @@ +# Installer Makefile + +CC = gcc +RM = rm -f +RC = rc +MAKE = make + +DEFS = +LIBS = + +CFLAGS = -O -g -I../incace -Wall +LDFLAGS = + + +OBJECTS = globals.o packinst.o uac_comm.o uac_crc.o \ + uac_crt.o uac_dcpr.o uac_sys.o unace.o + +SOURCES = globals.c ../packinst/packinst.c uac_comm.c \ + uac_crc.c uac_crt.c uac_dcpr.c uac_sys.c unace.c + +all: packinst + +$(OBJECTS): + $(CC) $(CFLAGS) -c $< + +Include: ../incace/Makefile Makefile +# cd include +# $(MAKE) -f Makefile all + +packinst: $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -o packinst $(OBJECTS) + +clean: + $(RM) $(OBJECTS) packinst *~ + +globals.o: globals.c ../incace/globals.h ../incace/acestruc.h ../incace/unace.h +packinst.o: ../packinst/packinst.c +uac_comm.o: uac_comm.c ../incace/globals.h ../incace/uac_dcpr.h ../incace/uac_comm.h +uac_crc.o: uac_crc.c ../incace/uac_crc.h +uac_crt.o: uac_crt.c ../incace/os.h ../incace/attribs.h ../incace/globals.h ../incace/uac_crt.h ../incace/uac_sys.h +uac_dcpr.o: uac_dcpr.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h +uac_sys.o: uac_sys.c ../incace/os.h ../incace/globals.h ../incace/uac_sys.h +unace.o: unace.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h ../incace/uac_crt.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h + diff --git a/utils/Install/packace/makefile.b32 b/utils/Install/packace/makefile.b32 new file mode 100644 index 0000000000..d2cece68fc --- /dev/null +++ b/utils/Install/packace/makefile.b32 @@ -0,0 +1,41 @@ +# Common settings for Borland 32-bit compilation (makefile.b32 files) + +LINK=ilink32 + +OPT = -O2 +LDFLAGS = -lxncd -l-P +CPPFLAGS = /I"..\incace" /DWIN32 +LINKFLAGS=/aa -L$(BCCDIR)\lib\psdk + +DUMMY=dummy + +SRCSUFF = cpp +OBJSUFF = obj + +TARGET = packinst +OBJECTS = globals.obj uac_comm.obj uac_crc.obj uac_crt.obj uac_dcpr.obj uac_sys.obj unace.obj packinst.obj + +all: $(TARGET).exe + +packinst.exe: $(OBJECTS) + bcc32 $(LDFLAGS) -epackinst.exe @&&| +$(OBJECTS) +| + +.$(SRCSUFF).obj: + bcc32 $(CPPFLAGS) -c {$< } + +packinst.obj: ..\packinst\packinst.c + bcc32 $(CPPFLAGS) -P- -c ..\packinst\packinst.c + +.c.obj: + bcc32 $(CPPFLAGS) -P- -c {$< } + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws + -erase *.tds + -erase *.il? diff --git a/utils/Install/packace/makefile.g95 b/utils/Install/packace/makefile.g95 new file mode 100644 index 0000000000..a89a5ddfee --- /dev/null +++ b/utils/Install/packace/makefile.g95 @@ -0,0 +1,46 @@ +# Installer Makefile + +CC = gcc +RM = rm -f +RC = rc +MAKE = make + +DEFS = +LIBS = + +CFLAGS = -mno-cygwin -O -g -I../incace -Wall -DWIN32 +LDFLAGS = -mno-cygwin + + +OBJECTS = globals.o packinst.o uac_comm.o uac_crc.o \ + uac_crt.o uac_dcpr.o uac_sys.o unace.o + +SOURCES = globals.c ../packinst/packinst.c uac_comm.c \ + uac_crc.c uac_crt.c uac_dcpr.c uac_sys.c unace.c + +all: packinst + +$(OBJECTS): + $(CC) $(CFLAGS) -c $< + +Include: ../incace/Makefile Makefile +# cd include +# $(MAKE) -f Makefile all + +packinst: $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -o packinst $(OBJECTS) + +clean: + $(RM) $(OBJECTS) packinst *~ + +globals.o: globals.c ../incace/globals.h ../incace/acestruc.h ../incace/unace.h +packinst.o: ../packinst/packinst.c +uac_comm.o: uac_comm.c ../incace/globals.h ../incace/uac_dcpr.h ../incace/uac_comm.h +uac_crc.o: uac_crc.c ../incace/uac_crc.h +uac_crt.o: uac_crt.c ../incace/os.h ../incace/attribs.h ../incace/globals.h ../incace/uac_crt.h ../incace/uac_sys.h +uac_dcpr.o: uac_dcpr.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h +uac_sys.o: uac_sys.c ../incace/os.h ../incace/globals.h ../incace/uac_sys.h +unace.o: unace.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h ../incace/uac_crt.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h + diff --git a/utils/Install/packace/makefile.gcc b/utils/Install/packace/makefile.gcc new file mode 100644 index 0000000000..837e7878d0 --- /dev/null +++ b/utils/Install/packace/makefile.gcc @@ -0,0 +1,46 @@ +# Installer Makefile + +CC = gcc +RM = rm -f +RC = rc +MAKE = make + +DEFS = +LIBS = + +CFLAGS = -O -g -I../incace -Wall +LDFLAGS = + + +OBJECTS = globals.o packinst.o uac_comm.o uac_crc.o \ + uac_crt.o uac_dcpr.o uac_sys.o unace.o + +SOURCES = globals.c ../packinst/packinst.c uac_comm.c \ + uac_crc.c uac_crt.c uac_dcpr.c uac_sys.c unace.c + +all: packinst + +$(OBJECTS): + $(CC) $(CFLAGS) -c $< + +Include: ../incace/Makefile Makefile +# cd include +# $(MAKE) -f Makefile all + +packinst: $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -o packinst $(OBJECTS) + +clean: + $(RM) $(OBJECTS) packinst *~ + +globals.o: globals.c ../incace/globals.h ../incace/acestruc.h ../incace/unace.h +packinst.o: ../packinst/packinst.c +uac_comm.o: uac_comm.c ../incace/globals.h ../incace/uac_dcpr.h ../incace/uac_comm.h +uac_crc.o: uac_crc.c ../incace/uac_crc.h +uac_crt.o: uac_crt.c ../incace/os.h ../incace/attribs.h ../incace/globals.h ../incace/uac_crt.h ../incace/uac_sys.h +uac_dcpr.o: uac_dcpr.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h +uac_sys.o: uac_sys.c ../incace/os.h ../incace/globals.h ../incace/uac_sys.h +unace.o: unace.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h ../incace/uac_crt.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h + diff --git a/utils/Install/packace/uac_comm.c b/utils/Install/packace/uac_comm.c new file mode 100644 index 0000000000..d050cf4e4c --- /dev/null +++ b/utils/Install/packace/uac_comm.c @@ -0,0 +1,51 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Decompresses and outputs comment if present. */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include <stdio.h> // printf() + +#include "globals.h" +#include "uac_dcpr.h" +#include "uac_comm.h" + +INT comm_cpr_size=0; +CHAR *comm; + +void comment_out(CHAR *top) // outputs comment if present +{ + INT i; + + if (head.HEAD_FLAGS & ACE_COMM) + { // comment present? + if (head.HEAD_TYPE == MAIN_BLK) + { // get begin and size of comment data + comm = (CHAR *)MCOMM; + comm_cpr_size = MCOMM_SIZE; + } + else + { + comm = (CHAR *)FCOMM; + comm_cpr_size = FCOMM_SIZE; + } // limit comment size if too big + i = sizeof(head) - (INT)(comm - (CHAR*) &head); + if (comm_cpr_size > i) + comm_cpr_size = i; + dcpr_comm(i); // decompress comment + +#ifdef AMIGA + { + char *p=comm; + while (*p) + { + if (*p==0x0D) + *p=0x0A; // Replace ms-dos line termination + p++; + } + } +#endif + + pipeit("%s\n\n%s\n\n", top, comm); // output comment + } +} diff --git a/utils/Install/packace/uac_crc.c b/utils/Install/packace/uac_crc.c new file mode 100644 index 0000000000..3d9335ec72 --- /dev/null +++ b/utils/Install/packace/uac_crc.c @@ -0,0 +1,36 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* CRC-calculation routines. */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include "uac_crc.h" + + +ULONG crctable[256]; +ULONG rd_crc=0; + + +void make_crctable(void) // initializes CRC table +{ + ULONG r, + i, + j; + + for (i = 0; i <= 255; i++) + { + for (r = i, j = 8; j; j--) + r = (r & 1) ? (r >> 1) ^ CRCPOLY : (r >> 1); + crctable[i] = r; + } +} + +// Updates crc from addr till addr+len-1 +// +ULONG getcrc(ULONG crc, UCHAR * addr, INT len) +{ + while (len--) + crc = crctable[(unsigned char) crc ^ (*addr++)] ^ (crc >> 8); + return (crc); +} + diff --git a/utils/Install/packace/uac_crt.c b/utils/Install/packace/uac_crt.c new file mode 100644 index 0000000000..9e20fcd162 --- /dev/null +++ b/utils/Install/packace/uac_crt.c @@ -0,0 +1,149 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Creates/Replaces files or directories. */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include "os.h" + +#include <stdlib.h> +#include <fcntl.h> // AMIGA: open() +#include <stdio.h> // pipeit() remove() +#include <string.h> // strncpy() +#include <sys/types.h> +#include <sys/stat.h> // struct stat +#include <string.h> + + +#if defined(DOS) || defined(WINNT) || defined(WIN16) + #include <io.h> // access() +#endif +#if defined(__IBMC__) + #include <direct.h> +#endif + +#define DIRSEP '\\' + +#include "attribs.h" +#include "globals.h" +#include "uac_crt.h" +#include "uac_sys.h" + +/* gets file name from header + */ +CHAR *ace_fname(CHAR * s, thead * head, INT nopath) +{ + INT i; + char *cp; + + strncpy(s, (CHAR *)(*(tfhead *) head).FNAME, i = (*(tfhead *) head).FNAME_SIZE); + s[i] = 0; + + if (nopath) + { + cp=strrchr(s, '\\'); + if (cp) + memmove(s, cp+1, strlen(cp)); + } + + return s; +} + +void check_ext_dir(CHAR * f) // checks/creates path of file +{ + CHAR *cp, + d[PATH_MAX]; + INT i; + + d[0] = 0; + + for (;;) + { + if ((cp = (CHAR *) strchr(&f[strlen(d) + 1], DIRSEP))!=NULL) + { + i = cp - f; + strncpy(d, f, i); + d[i] = 0; + } + else + return; + + if (!fileexists(d)) +#if (defined(__OS2__) && !defined(__EMX__)) || (defined(WINNT) && !defined(__CYGWIN__)) + if (mkdir(d)) +#else + if (mkdir(d, 0)) +#endif + { + f_err = ERR_WRITE; + pipeit("\n Error while creating directory.\n"); + } + } +} + +INT ovr_delete(CHAR * n) // deletes directory or file +{ + if (remove(n) && rmdir(n)) + { + pipeit("\n Could not delete file or directory. Access denied.\n"); + return (1); + } + return (0); +} + +INT create_dest_file(CHAR * file, INT a) // creates file or directory +{ + INT han, + i = 0, + ex = fileexists(file); + struct stat st; + + check_ext_dir(file); + if (f_err) + return (-1); + if (a & _A_SUBDIR) + { // create dir or file? + if (ex) + stat(file, &st); +#if (defined(__OS2__) && !defined(__EMX__)) || (!defined(__CYGWIN__) && defined(WINNT)) + if ((!ex && mkdir(file)) || (ex && (st.st_mode & S_IFDIR))) +#else + if ((!ex && mkdir(file, 0)) || (ex && (st.st_mode & S_IFDIR))) +#endif + { + pipeit("\n Could not create directory.\n"); + return (-1); + } +#ifdef DOS + _dos_setfileattr(file, a); // set directory attributes +#endif + return (-1); + } + else + { + if (ex) + { // does the file already exist + if (!f_ovrall) + { + i = wrask("Overwrite existing file?"); // prompt for overwrite + f_ovrall = (i == 1); + if (i == 3) + f_err = ERR_USER; + } + if ((i && !f_ovrall) || ovr_delete(file)) + return (-1); // delete? + } +#if defined(__OS2_) || defined(__EMX__) || defined(WIN32) + if ((han = open(file, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, + S_IREAD | S_IWRITE | S_IEXEC | S_IDELETE | + S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH )) < 0) +#else + if ((han = open(file, O_WRONLY | O_TRUNC | O_CREAT, + S_IREAD | S_IWRITE | S_IEXEC | S_IDELETE | + S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH )) < 0) +#endif + pipeit("\n Could not create destination file.\n"); + return (han); + } +} + diff --git a/utils/Install/packace/uac_dcpr.c b/utils/Install/packace/uac_dcpr.c new file mode 100644 index 0000000000..9f1a29b9b3 --- /dev/null +++ b/utils/Install/packace/uac_dcpr.c @@ -0,0 +1,553 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* These are the decompression algorithms. */ +/* Don't change here anything (apart from memory allocation perhaps). */ +/* Any changes will very likely cause bugs! */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include "os.h" + +#if defined(AMIGA) + #include <string.h> // mem*() +#endif +#if defined(DOS) || defined(WIN16) || defined(WINNT) || defined(OS2) || defined(UNIX) +#if !defined(__CYGWIN__) + #include <mem.h> // mem*() +#endif +#endif + +#include <stdio.h> // pipeit() +#include <stdlib.h> // malloc() +#include <string.h> + +#include "globals.h" +#include "portable.h" +#include "uac_comm.h" +#include "uac_crc.h" +#include "uac_dcpr.h" +#include "uac_sys.h" +#ifdef CRYPT + #include "unace_ps.h" +#endif /* CRYPT */ + + +//------------------------------ QUICKSORT ---------------------------------// +#define xchg_def(v1,v2) {INT dummy;\ + dummy=v1; \ + v1=v2; \ + v2=dummy;} + +void sortrange(INT left, INT right) +{ + INT zl = left, + zr = right, + hyphen; + + hyphen = sort_freq[right]; + + //divides by hyphen the given range into 2 parts + do + { + while (sort_freq[zl] > hyphen) + zl++; + while (sort_freq[zr] < hyphen) + zr--; + //found a too small (left side) and + //a too big (right side) element-->exchange them + if (zl <= zr) + { + xchg_def(sort_freq[zl], sort_freq[zr]); + xchg_def(sort_org[zl], sort_org[zr]); + zl++; + zr--; + } + } + while (zl < zr); + + //sort partial ranges - when very small, sort directly + if (left < zr) + { + if (left < zr - 1) + sortrange(left, zr); + else if (sort_freq[left] < sort_freq[zr]) + { + xchg_def(sort_freq[left], sort_freq[zr]); + xchg_def(sort_org[left], sort_org[zr]); + } + } + + if (right > zl) + { + if (zl < right - 1) + sortrange(zl, right); + else if (sort_freq[zl] < sort_freq[right]) + { + xchg_def(sort_freq[zl], sort_freq[right]); + xchg_def(sort_org[zl], sort_org[right]); + } + } +} + +void quicksort(INT n) +{ + INT i; + + for (i = n + 1; i--;) + sort_org[i] = i; + sortrange(0, n); +} + +//------------------------------ read bits ---------------------------------// +void readdat(void) +{ + UINT i; + + i = (size_rdb - 2) << 2; + rpos -= size_rdb - 2; + buf_rd[0] = buf_rd[size_rdb - 2]; + buf_rd[1] = buf_rd[size_rdb - 1]; + read_adds_blk((CHAR *) & buf_rd[2], i); +#ifdef HI_LO_BYTE_ORDER + { + ULONG *p; + i>>=2; // count LONGs not BYTEs + p=&buf_rd[2]; + while (i--) + { + LONGswap(p); + p++; + } + } +#endif +} + +#define addbits(bits) \ +{ \ + rpos+=(bits_rd+=bits)>>5; \ + bits_rd&=31; \ + if (rpos==(size_rdb-2)) readdat(); \ + code_rd=(buf_rd[rpos] << bits_rd) \ + +((buf_rd[rpos+1] >> (32-bits_rd))&(!bits_rd-1)); \ + } + + +//---------------------- COMMENT DECOMPRESSION -----------------------------// + +#define comm_cpr_hf(a,b) (a+b) + +void dcpr_comm_init(void) +{ + INT i; + + i = comm_cpr_size > size_rdb * sizeof(LONG) ? size_rdb * sizeof(LONG) : comm_cpr_size; + if (!f_err) + memcpy(buf_rd, comm, i); +#ifdef HI_LO_BYTE_ORDER + { + ULONG *p; + i>>=2; // count LONGs not BYTEs + p=buf_rd; + while (i--) + { + LONGswap(p); + p++; + } + } +#endif + code_rd = buf_rd[0]; + rpos = bits_rd = 0; +} + +void dcpr_comm(INT comm_size) +{ + SHORT hash[comm_cpr_hf(255, 255) + 1]; + INT dpos = 0, + c, + pos = 0, + len, + hs; + + memset(&hash, 0, sizeof(hash)); + if (comm_cpr_size) + { + dcpr_comm_init(); + len = code_rd >> (32 - 15); + addbits(15); + if (len >= comm_size) + len = comm_size - 1; + if (read_wd(maxwd_mn, dcpr_code_mn, dcpr_wd_mn, max_cd_mn)) + do + { + if (dpos > 1) + { + pos = hash[hs = comm_cpr_hf(comm[dpos - 1], comm[dpos - 2])]; + hash[hs] = dpos; + } + addbits(dcpr_wd_mn[(c = dcpr_code_mn[code_rd >> (32 - maxwd_mn)])]); + if (rpos == size_rdb - 3) + rpos = 0; + if (c > 255) + { + c -= 256; + c += 2; + while (c--) + comm[dpos++] = comm[pos++]; + } + else + { + comm[dpos++] = c; + } + } + while (dpos < len); + comm[len] = 0; + } +} + +//------------------------- LZW1 DECOMPRESSION -----------------------------// +void wrchar(CHAR ch) +{ + dcpr_do++; + + dcpr_text[dcpr_dpos] = ch; + dcpr_dpos++; + dcpr_dpos &= dcpr_dican; +} + +void copystr(LONG d, INT l) +{ + INT mpos; + + dcpr_do += l; + + mpos = dcpr_dpos - d; + mpos &= dcpr_dican; + + if ((mpos >= dcpr_dicsiz - maxlength) || (dcpr_dpos >= dcpr_dicsiz - maxlength)) + { + while (l--) + { + dcpr_text[dcpr_dpos] = dcpr_text[mpos]; + dcpr_dpos++; + dcpr_dpos &= dcpr_dican; + mpos++; + mpos &= dcpr_dican; + } + } + else + { + while (l--) + dcpr_text[dcpr_dpos++] = dcpr_text[mpos++]; + dcpr_dpos &= dcpr_dican; + } +} + +void decompress(void) +{ + INT c, + lg, + i, + k; + ULONG dist; + + while (dcpr_do < dcpr_do_max) + { + if (!blocksize) + if (!calc_dectabs()) + return; + + addbits(dcpr_wd_mn[(c = dcpr_code_mn[code_rd >> (32 - maxwd_mn)])]); + blocksize--; + if (c > 255) + { + if (c > 259) + { + if ((c -= 260) > 1) + { + dist = (code_rd >> (33 - c)) + (1L << (c - 1)); + addbits(c - 1); + } + else + dist = c; + dcpr_olddist[(dcpr_oldnum = (dcpr_oldnum + 1) & 3)] = dist; + i = 2; + if (dist > maxdis2) + { + i++; + if (dist > maxdis3) + i++; + } + } + else + { + dist = dcpr_olddist[(dcpr_oldnum - (c &= 255)) & 3]; + for (k = c + 1; k--;) + dcpr_olddist[(dcpr_oldnum - k) & 3] = dcpr_olddist[(dcpr_oldnum - k + 1) & 3]; + dcpr_olddist[dcpr_oldnum] = dist; + i = 2; + if (c > 1) + i++; + } + addbits(dcpr_wd_lg[(lg = dcpr_code_lg[code_rd >> (32 - maxwd_lg)])]); + dist++; + lg += i; + copystr(dist, lg); + } + else + wrchar(c); + } +} + +//-------------------------- HUFFMAN ROUTINES ------------------------------// +INT makecode(UINT maxwd, UINT size1_t, UCHAR * wd, USHORT * code) +{ + UINT maxc, + size2_t, + l, + c, + i, + max_make_code; + + memcpy(&sort_freq, wd, (size1_t + 1) * sizeof(CHAR)); + if (size1_t) + quicksort(size1_t); + else + sort_org[0] = 0; + sort_freq[size1_t + 1] = size2_t = c = 0; + while (sort_freq[size2_t]) + size2_t++; + if (size2_t < 2) + { + i = sort_org[0]; + wd[i] = 1; + size2_t += (size2_t == 0); + } + size2_t--; + + max_make_code = 1 << maxwd; + for (i = size2_t + 1; i-- && c < max_make_code;) + { + maxc = 1 << (maxwd - sort_freq[i]); + l = sort_org[i]; + if (c + maxc > max_make_code) + { + dcpr_do = dcpr_do_max; + return (0); + } + memset16(&code[c], l, maxc); + c += maxc; + } + return (1); +} + +INT read_wd(UINT maxwd, USHORT * code, UCHAR * wd, INT max_el) +{ + UINT c, + i, + j, + num_el, + l, + uplim, + lolim; + + memset(wd, 0, max_el * sizeof(CHAR)); + memset(code, 0, (1 << maxwd) * sizeof(SHORT)); + + num_el = code_rd >> (32 - 9); + addbits(9); + if (num_el > max_el) + num_el = max_el; + + lolim = code_rd >> (32 - 4); + addbits(4); + uplim = code_rd >> (32 - 4); + addbits(4); + + for (i = -1; ++i <= uplim;) + { + wd_svwd[i] = code_rd >> (32 - 3); + addbits(3); + } + if (!makecode(maxwd_svwd, uplim, wd_svwd, code)) + return (0); + j = 0; + while (j <= num_el) + { + c = code[code_rd >> (32 - maxwd_svwd)]; + addbits(wd_svwd[c]); + if (c < uplim) + wd[j++] = c; + else + { + l = (code_rd >> 28) + 4; + addbits(4); + while (l-- && j <= num_el) + wd[j++] = 0; + } + } + if (uplim) + for (i = 0; ++i <= num_el;) + wd[i] = (wd[i] + wd[i - 1]) % uplim; + for (i = -1; ++i <= num_el;) + if (wd[i]) + wd[i] += lolim; + + return (makecode(maxwd, num_el, wd, code)); + +} + +INT calc_dectabs(void) +{ + if (!read_wd(maxwd_mn, dcpr_code_mn, dcpr_wd_mn, max_cd_mn) + || !read_wd(maxwd_lg, dcpr_code_lg, dcpr_wd_lg, max_cd_lg)) + return (0); + + blocksize = code_rd >> (32 - 15); + addbits(15); + + return (1); +} + +//---------------------------- BLOCK ROUTINES ------------------------------// +INT decompress_blk(CHAR * buf, UINT len) +{ + LONG old_pos = dcpr_dpos; + INT i; + + dcpr_do = 0; + if ((dcpr_do_max = len - maxlength) > dcpr_size) + dcpr_do_max = dcpr_size; + if ((LONG) dcpr_size > 0 && dcpr_do_max) + { + decompress(); + if (old_pos + dcpr_do > dcpr_dicsiz) + { + i = dcpr_dicsiz - old_pos; + memcpy(buf, &dcpr_text[old_pos], i); + memcpy(&buf[i], dcpr_text, dcpr_do - i); + } + else + memcpy(buf, &dcpr_text[old_pos], dcpr_do); + } + dcpr_size -= dcpr_do; + return (dcpr_do); +} + +INT unstore(CHAR * buf, UINT len) +{ + UINT rd = 0, + i, + pos = 0; + +#ifdef CRYPT + len = crypt_len(len - 8); /* because of decryption */ +#endif /* CRYPT */ + + while ((i = read_adds_blk((CHAR *) buf_rd, (INT) ((i = ((len > dcpr_size) ? dcpr_size : len)) > size_rdb ? size_rdb : i))) != 0) + { + rd += i; + len -= i; + memcpy(&buf[pos], buf_rd, i); + pos += i; + } + dcpr_size -= rd; + for (i = 0; i < rd; i++) + { + dcpr_text[dcpr_dpos] = buf[i]; + dcpr_dpos++; + dcpr_dpos &= dcpr_dican; + } + return (INT)rd; +} + +INT dcpr_adds_blk(CHAR * buf, UINT len) +{ + INT r; + + switch (fhead.TECH.TYPE) + { + case TYPE_STORE: + r = unstore(buf, len); + break; + case TYPE_LZW1: + r = decompress_blk(buf, len); + break; + default: + pipeit("\nFile compressed with unknown method. Decompression not possible.\n"); + f_err = ERR_OTHER; + r = 0; + } + rd_crc = getcrc(rd_crc, (UCHAR *)buf, r); + return r; +} + + +//----------------------------- INIT ROUTINES ------------------------------// +void dcpr_init(void) +{ + dcpr_frst_file = 1; + + dcpr_dic = 20; + while ((dcpr_text = malloc(dcpr_dicsiz = (LONG) 1 << dcpr_dic))==NULL) + dcpr_dic--; + dcpr_dican = dcpr_dicsiz - 1; +} + +void dcpr_init_file(void) +{ + UINT i; + +#ifdef CRYPT + + reset_cryptkey(); + +#else /* CRYPT */ + + if (head.HEAD_FLAGS & ACE_PASSW) + { + pipeit("\nFound passworded file. Decryption not supported.\n"); + f_err = ERR_OTHER; + return; + } + +#endif /* CRYPT */ + + rd_crc = CRC_MASK; + dcpr_size = fhead.SIZE; + if (fhead.TECH.TYPE == TYPE_LZW1) + { + if ((fhead.TECH.PARM & 15) + 10 > dcpr_dic) + { + pipeit("\nNot enough memory or dictionary of archive too large.\n"); + f_err = ERR_MEM; + return; + } + + i = size_rdb * sizeof(LONG); + read_adds_blk((CHAR *) buf_rd, i); +#ifdef HI_LO_BYTE_ORDER + { + ULONG *p; + i>>=2; // count LONGs not BYTEs + p=buf_rd; + while (i--) + { + LONGswap(p); + p++; + } + } +#endif + code_rd = buf_rd[0]; + bits_rd = rpos = 0; + + blocksize = 0; + } + if (!adat.sol || dcpr_frst_file) + dcpr_dpos = 0; + + dcpr_oldnum = 0; + memset(&dcpr_olddist, 0, sizeof(dcpr_olddist)); + + dcpr_frst_file = 0; +} + diff --git a/utils/Install/packace/uac_sys.c b/utils/Install/packace/uac_sys.c new file mode 100644 index 0000000000..2a261f3d57 --- /dev/null +++ b/utils/Install/packace/uac_sys.c @@ -0,0 +1,105 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Some basic things. */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include "os.h" + +#include <signal.h> // signal() +#include <stdio.h> // fprintf() fflush() getch() putc() + +#if defined(DOS) || defined(WINNT) || defined(WIN16) +#if !defined(__CYGWIN__) + #include <conio.h> // getch() +#endif +#endif +#if defined(DOS) + #include <dos.h> // delay() sound() +#endif + +#include "globals.h" +#include "uac_sys.h" + + +void memset16(USHORT * dest, SHORT val, INT len) // fills short-array with +{ // value + while (len--) + *(dest++) = val; +} + +INT cancel(void) // checks whether to interrupt the program +{ +#ifdef DOS + while (kbhit()) + { + if (getch() == 27) + f_err = ERR_USER; + } +#endif + return (f_err); +} + +INT wrask(CHAR * s) // prompt-routine +{ + CHAR ch = 0; + + fprintf(stderr, "\n %s (Yes,Always,No,Cancel) ", s); + fflush(stderr); + do + { + /*ch = getch(); + ch = upcase(ch);*/ + } + while (ch != 'Y' && ch != 'A' && ch != 'N' && ch != 'C' && ch != 27); + fprintf(stderr, "%s", ch == 'Y' ? "Yes" : (ch == 'A' ? "Always" : (ch == 'N' ? "No" : "Cancel"))); + fflush(stderr); + return (ch == 'Y' ? 0 : (ch == 'A' ? 1 : (ch == 'N' ? 2 : 3))); +} + +void beep(void) // makes some noise +{ +#ifdef DOS + sound(800); + delay(250); + nosound(); +#endif +#ifdef AMIGA + putc(0x07, stderr); +#endif +} + +void my_signalhandler(INT sig_number) // sets f_err if ctrl+c or ctrl+brk +{ + f_err = ERR_USER; + pipeit("\nUser break\n"); +} + +#ifdef DOS // handles hardware errors +#ifdef __BORLANDC__ +INT harderrhandler(UINT deverr, UINT errc, UINT * devhdr) +#else +INT __far harderrhandler(UINT deverr, UINT errc, UINT * devhdr) +#endif +{ + f_criterr = 'A' + deverr & 0xff; + f_err = ERR_OTHER; + return (0x3); +} +#endif + +void set_handler(void) // initializes handlers +{ +#if defined(DOS) && !defined(__BORLANDC__) + signal(SIGBREAK, my_signalhandler); // set ctrl-break/-c handlers +#endif + signal(SIGINT, my_signalhandler); +#if defined(DOS) && !defined(__CONSOLE__) // set hardware error handler +#ifdef __BORLANDC__ + harderr(harderrhandler); +#else + _harderr(harderrhandler); +#endif +#endif +} + diff --git a/utils/Install/packace/unace.c b/utils/Install/packace/unace.c new file mode 100644 index 0000000000..e38a88d756 --- /dev/null +++ b/utils/Install/packace/unace.c @@ -0,0 +1,584 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Main file of public UNACE. */ +/* */ +/* ------------------------------------------------------------------------ */ + + +//--------------- include general files ------------------------------------// +#include <ctype.h> // tolower() +#include <fcntl.h> // open() +#include <stdio.h> // printf() sprintf() remove() +#include <stdlib.h> // malloc() +#include <string.h> // str*() +#include <sys/types.h> +#include <sys/stat.h> // S_I* AMIGA: fstat() + +#define DIRSEP '\\' + +#if (!defined(__EMX__) && !defined(__OS2__) && !defined(WINNT) && !defined(WIN32)) || defined(__CYGWIN__) +#include <sys/errno.h> +#endif + + +//--------------- include unace specific header files ----------------------// +#include "os.h" + +#include "globals.h" +#include "portable.h" +#include "uac_comm.h" +#include "uac_crc.h" +#include "uac_crt.h" +#include "uac_dcpr.h" +#include "uac_sys.h" + +#ifdef CRYPT + #include "unace_ps.h" +#endif /* CRYPT */ +int files=0; + +//--------------- BEGIN OF UNACE ROUTINES ----------------------------------// + +int pipeit(char *format, ...) { + /* Do nothing ... perhaps pipe this somewhere in the future */ + return 0; +} + +void init_unace(void) // initializes unace +{ + buf_rd =malloc(size_rdb * sizeof(ULONG)); // Allocate buffers: increase + buf =malloc(size_buf); // sizes when possible to speed + buf_wr =malloc(size_wrb); // up the program + readbuf=malloc(size_headrdb); + + if (buf_rd ==NULL || + buf ==NULL || + buf_wr ==NULL || + readbuf==NULL ) + f_err = ERR_MEM; + + make_crctable(); // initialize CRC table + dcpr_init(); // initialize decompression + + set_handler(); // ctrl+break etc. +} + +void done_unace(void) +{ + if (buf_rd ) free(buf_rd ); + if (buf ) free(buf ); + if (buf_wr ) free(buf_wr ); + if (readbuf ) free(readbuf ); + if (dcpr_text) free(dcpr_text); +} + +INT read_header(INT print_err) // reads any header from archive +{ + USHORT rd, + head_size, + crc_ok; + LONG crc; + UCHAR *tp=readbuf; + + lseek(archan, skipsize, SEEK_CUR); // skip ADDSIZE block + + if (read(archan, &head, 4)<4) + return (0); // read CRC and header size + +#ifdef HI_LO_BYTE_ORDER + WORDswap(&head.HEAD_CRC); + WORDswap(&head.HEAD_SIZE); +#endif + // read size_headrdb bytes into + head_size = head.HEAD_SIZE; // header structure + rd = (head_size > size_headrdb) ? size_headrdb : head_size; + if (read(archan, readbuf, rd) < rd) + return (0); + head_size -= rd; + crc = getcrc(CRC_MASK, readbuf, rd); + + while (head_size) // skip rest of header + { + rd = (head_size > size_buf) ? size_buf : head_size; + if (read(archan, buf, rd) < rd) + return (0); + head_size -= rd; + crc = getcrc(crc, (UCHAR *)buf, rd); + } + + head.HEAD_TYPE =*tp++; // generic buffer to head conversion + head.HEAD_FLAGS=BUFP2WORD(tp); + + if (head.HEAD_FLAGS & ACE_ADDSIZE) + skipsize = head.ADDSIZE = BUF2LONG(tp); // get ADDSIZE + else + skipsize = 0; + + // check header CRC + if (!(crc_ok = head.HEAD_CRC == (crc & 0xffff)) && print_err) + pipeit("\nError: archive is broken\n"); + else + switch (head.HEAD_TYPE) // specific buffer to head conversion + { + case MAIN_BLK: + memcpy(mhead.ACESIGN, tp, acesign_len); tp+=acesign_len; + mhead.VER_MOD=*tp++; + mhead.VER_CR =*tp++; + mhead.HOST_CR=*tp++; + mhead.VOL_NUM=*tp++; + mhead.TIME_CR=BUFP2LONG(tp); + mhead.RES1 =BUFP2WORD(tp); + mhead.RES2 =BUFP2WORD(tp); + mhead.RES =BUFP2LONG(tp); + mhead.AV_SIZE=*tp++; + memcpy(mhead.AV, tp, rd-(USHORT)(tp-readbuf)); + break; + case FILE_BLK: + fhead.PSIZE =BUFP2LONG(tp); + fhead.SIZE =BUFP2LONG(tp); + fhead.FTIME =BUFP2LONG(tp); + fhead.ATTR =BUFP2LONG(tp); + fhead.CRC32 =BUFP2LONG(tp); + fhead.TECH.TYPE =*tp++; + fhead.TECH.QUAL =*tp++; + fhead.TECH.PARM =BUFP2WORD(tp); + fhead.RESERVED =BUFP2WORD(tp); + fhead.FNAME_SIZE=BUFP2WORD(tp); + memcpy(fhead.FNAME, tp, rd-(USHORT)(tp-readbuf)); + break; + // default: (REC_BLK and future things): + // do nothing 'cause isn't needed for extraction + } + + return (crc_ok); +} +// maximum SFX module size +#define max_sfx_size 65536 // (needed by read_arc_head) + +INT read_arc_head(void) // searches for the archive header and reads it +{ + INT i, + flags, + buf_pos = 0; + LONG arc_head_pos, + old_fpos, + fpos = 0; + struct stat st; + + fstat(archan, &st); + + memset(buf, 0, size_buf); + +#if !defined(__EMX__) && !defined(__OS2__) + while (ftell(farchan)<st.st_size && fpos < max_sfx_size) +#else + while (tell(archan)<st.st_size && fpos < max_sfx_size) +#endif + { + old_fpos = fpos; + fpos += read(archan, &buf[buf_pos], size_buf - buf_pos); + + for (i = 0; i < size_buf; i++) // look for the acesign + { + if (!memcmp(acesign, &buf[i], acesign_len)) + { + // seek to the probable begin + // of the archive + arc_head_pos = old_fpos + i - buf_pos - bytes_before_acesign; + lseek(archan, arc_head_pos, SEEK_SET); + if (read_header(0)) // try to read archive header + { + flags = mhead.HEAD_FLAGS; + adat.sol = (flags & ACE_SOLID) > 0; + adat.vol = (flags & ACE_MULT_VOL) > 0; + adat.vol_num = mhead.VOL_NUM; + adat.time_cr = mhead.TIME_CR; + return (1); + } + } + } + // was no archive header, + // continue search + lseek(archan, fpos, SEEK_SET); + memcpy(buf, &buf[size_buf - 512], 512); + buf_pos = 512; // keep 512 old bytes + } + return (0); +} + +INT open_archive(INT print_err) // opens archive (or volume) +{ + CHAR av_str[80]; + + +#if defined(__OS2_) || defined(__EMX__) || defined(WIN32) + archan = open(aname, O_RDONLY | O_BINARY); // open file +#else + archan = open(aname, O_RDONLY); // open file +#endif +#if !defined(__EMX__) && !defined(__OS2__) + farchan = fdopen(archan, "rb"); +#endif + if (archan == -1) + { + pipeit("\nError opening file %s", aname); + return (0); + } + if (!read_arc_head()) // read archive header + { + if (print_err) + pipeit("\nInvalid archive file: %s\n", aname); +#if !defined(__EMX__) && !defined(__OS2__) + fclose(farchan); +#endif + close(archan); + return (0); + } + + pipeit("\nProcessing archive: %s\n\n", aname); + if (head.HEAD_FLAGS & ACE_AV) + { + pipeit("Authenticity Verification:"); // print the AV + sprintf(av_str, "\ncreated on %d.%d.%d by ", + ts_day(adat.time_cr), ts_month(adat.time_cr), ts_year(adat.time_cr)); + pipeit(av_str); + strncpy(av_str, (char *)mhead.AV, mhead.AV_SIZE); + av_str[mhead.AV_SIZE] = 0; + pipeit("%s\n\n", av_str); + } + comment_out("Main comment:"); // print main comment + return (1); +} + +void get_next_volname(void) // get file name of next volume +{ + CHAR *cp; + INT num; + + if ((cp = (CHAR *) strrchr(aname, '.')) == NULL || !*(cp + 1)) + num = -1; + else + { + cp++; + num = (*(cp + 1) - '0') * 10 + *(cp + 2) - '0'; + if (!in(num, 0, 99)) + num = -1; + if (in(*cp, '0', '9')) + num += (*cp - '0') * 100; + } + num++; + + if (num < 100) + *cp = 'C'; + else + *cp = num / 100 + '0'; + *(cp + 1) = (num / 10) % 10 + '0'; + *(cp + 2) = num % 10 + '0'; +} + +INT proc_vol(void) // opens volume +{ + INT i; + CHAR s[80]; + + if (!fileexists(aname) || !f_allvol_pr) + { + do + { + sprintf(s, "Ready to process %s?", aname); +#if !defined(__MINGW32__) + beep(); +#else + beep(500,500); +#endif + i = wrask(s); // ask whether ready or not + f_allvol_pr = (i == 1); // "Always" --> process all volumes + if (i >= 2) + { + f_err = ERR_FOUND; + return (0); + } + } + while (!fileexists(aname)); + } + + if (!open_archive(1)) // open volume + { + pipeit("\nError while opening archive. File not found or archive broken.\n"); + f_err = ERR_OPEN; + return (0); + } + + return (1); +} + +INT proc_next_vol(void) // opens next volume to process +{ +#if !defined(__EMX__) && !defined(__OS2__) + fclose(farchan); +#endif + close(archan); // close handle + get_next_volname(); // get file name of next volume + + if (!proc_vol()) // try to open volume, read archive header + return 0; + if (!read_header(1)) // read 2nd header + { + f_err=ERR_READ; + return 0; + } + return 1; +} + +INT read_adds_blk(CHAR * buffer, INT len) // reads part of ADD_SIZE block +{ + INT rd = 0, + l = len; + LONG i; + +#ifdef CRYPT + char *cbuffer=buffer; + + if (head.HEAD_TYPE == FILE_BLK && (head.HEAD_FLAGS & ACE_PASSW)) + len = crypt_len(len); +#endif /* CRYPT */ + while (!f_err && len && skipsize) + { + i = (skipsize > len) ? len : skipsize; + skipsize -= i; + + /* How do I check error condition when comping -mno-cygwin? */ +#if !defined(__MINGW32__) + errno = 0; +#endif + rd += read(archan, buffer, i); +#if !defined(__MINGW32__) + if (errno) + { + pipeit("\nRead error\n"); + f_err = ERR_READ; + } +#endif + + buffer += i; + len -= i; + + if (!skipsize) // if block is continued on next volume + if (head.HEAD_FLAGS & ACE_SP_AFTER && !proc_next_vol()) + break; + } +#ifdef CRYPT + if (head.HEAD_TYPE == FILE_BLK && (head.HEAD_FLAGS & ACE_PASSW)) + decrypt(cbuffer, rd); +#endif /* CRYPT */ + + return (rd > l ? l : rd); +} + +void crc_print(void) // checks CRC, prints message +{ + INT crc_not_ok = rd_crc != fhead.CRC32; /* check CRC of file */ + + if (!f_err) // print message + { + pipeit(crc_not_ok ? " CRC-check error" : " CRC OK"); + flush; + } +} + +void analyze_file(void) // analyzes one file (for solid archives) +{ + pipeit("\n Analyzing"); + flush; + while (!cancel() && (dcpr_adds_blk(buf_wr, size_wrb))) // decompress only + ; + crc_print(); +} + +void extract_file(void) // extracts one file +{ + INT rd; + + pipeit("\n Extracting"); + flush; // decompress block + while (!cancel() && (rd = dcpr_adds_blk(buf_wr, size_wrb))) + { + if (write(wrhan, buf_wr, rd) != rd) // write block + { + pipeit("\nWrite error\n"); + f_err = ERR_WRITE; + } + } + crc_print(); +} + +/* extracts or tests all files of the archive + */ +void extract_files(int nopath, int test) +{ + CHAR file[PATH_MAX]; + + while (!cancel() && read_header(1)) + { + if (head.HEAD_TYPE == FILE_BLK) + { + comment_out("File comment:"); // show file comment + ace_fname(file, &head, nopath); // get file name + pipeit("\n%s", file); + flush; + dcpr_init_file(); // initialize decompression of file + if (!f_err) + { + if (test || + (wrhan = create_dest_file(file, (INT) fhead.ATTR))<0) + { + if (test || adat.sol) + analyze_file(); // analyze file + } + else + { + extract_file(); // extract it +#ifdef DOS // set file time + _dos_setftime(wrhan, (USHORT) (fhead.FTIME >> 16), (USHORT) fhead.FTIME); +#endif + close(wrhan); +#ifdef DOS // set file attributes + _dos_setfileattr(file, (UINT) fhead.ATTR); +#endif +#ifdef AMIGA + { // set file date and time + struct DateTime dt; + char Date[9], Time[9]; + ULONG tstamp=fhead.FTIME; + + sprintf(Date, "%02d-%02d-%02d", ts_year(tstamp)-1900, ts_month(tstamp), ts_day(tstamp)); + sprintf(Time, "%02d:%02d:%02d", ts_hour(tstamp), ts_min(tstamp), ts_sec(tstamp)); + + dt.dat_Format = FORMAT_INT; + dt.dat_Flags = 0; + dt.dat_StrDate= Date; + dt.dat_StrTime= Time; + + if (StrToDate(&dt)) + SetFileDate(file, &dt.dat_Stamp); + } +#endif + if (f_err) + remove(file); + } + } + } + } +} + +unsigned percentage(ULONG p, ULONG d) +{ + return (unsigned)( d ? (d/2+p*100)/d : 100 ); +} + +void list_files(int verbose) +{ + ULONG size =0, + psize=0, + tpsize; + CHAR file[PATH_MAX]; + + pipeit("Date |Time |Packed |Size |Ratio|File\n"); + + while (!cancel() && read_header(1)) + { + if (head.HEAD_TYPE == FILE_BLK) + { + ULONG ti=fhead.FTIME; + ace_fname(file, &head, verbose ? 0 : 1); // get file name + + size += fhead.SIZE; + psize += + tpsize = fhead.PSIZE; + files++; + + while (head.HEAD_FLAGS & ACE_SP_AFTER) + { + skipsize=0; + if (!proc_next_vol()) + break; + psize += fhead.PSIZE; + tpsize+= fhead.PSIZE; + } + if (!f_err) + pipeit("%02u.%02u.%02u|%02u:%02u|%c%c%9lu|%9lu|%4u%%|%c%s\n", + ts_day (ti), ts_month(ti), ts_year(ti)%100, + ts_hour(ti), ts_min (ti), + fhead.HEAD_FLAGS & ACE_SP_BEF ? '<' : ' ', + fhead.HEAD_FLAGS & ACE_SP_AFTER ? '>' : ' ', + tpsize, fhead.SIZE, percentage(tpsize, fhead.SIZE), + fhead.HEAD_FLAGS & ACE_PASSW ? '*' : ' ', + file + ); + } + } + if (!f_err) + { + pipeit("\n %9lu|%9lu|%4u%%| %u file%s", + psize, + size, + percentage(psize, size), + files, + (char*)(files == 1 ? "" : "s") + ); + } +} + +void showhelp(void) +{ + pipeit("\n" + "Usage: UNACE <command> <archive[.ace]>\n" + "\n" + "Where <command> is one of:\n" + "\n" + " e Extract files\n" + " l List archive\n" + " t Test archive integrity\n" + " v List archive (verbose)\n" + " x Extract files with full path" + ); +} + +int include_unpack(char *bleah) // processes the archive +{ + CHAR *s; + + strcpy(aname, bleah); + + init_unace(); // initialize unace + + if (!(s = (CHAR *) strrchr(aname, DIRSEP))) + s = aname; + if (!strrchr(s, '.')) + strcat(aname, ".ACE"); + + if (open_archive(1)) // open archive to process + { + if (adat.vol_num) + pipeit("\nFirst volume of archive required!\n"); + else + list_files (0 ); + +#if !defined(__EMX__) && !defined(__OS2__) + fclose(farchan); +#endif + close(archan); + if (f_err) + { + pipeit("\nError occurred\n"); + if (f_criterr) + pipeit("Critical error on drive %c\n", f_criterr); + } + } + else + f_err = ERR_CLINE; + + done_unace(); + return (f_err); +} + diff --git a/utils/Install/packzip/api.c b/utils/Install/packzip/api.c new file mode 100644 index 0000000000..5a4e73abf8 --- /dev/null +++ b/utils/Install/packzip/api.c @@ -0,0 +1,601 @@ +/*--------------------------------------------------------------------------- + + api.c + + This module supplies an UnZip engine for use directly from C/C++ + programs. The functions are: + + UzpVer *UzpVersion(void); + void UzpVersion2(UzpVer2 *version) + int UzpMain(int argc, char *argv[]); + int UzpAltMain(int argc, char *argv[], UzpInit *init); + int UzpValidate(char *archive, int AllCodes); + void UzpFreeMemBuffer(UzpBuffer *retstr); + int UzpUnzipToMemory(char *zip, char *file, UzpOpts *optflgs, + UzpCB *UsrFuncts, UzpBuffer *retstr); + + non-WINDLL only (a special WINDLL variant is defined in windll/windll.c): + int UzpGrep(char *archive, char *file, char *pattern, int cmd, int SkipBin, + UzpCB *UsrFuncts); + + OS/2 only (for now): + int UzpFileTree(char *name, cbList(callBack), char *cpInclude[], + char *cpExclude[]); + + You must define `DLL' in order to include the API extensions. + + ---------------------------------------------------------------------------*/ + + +#ifdef OS2 +# define INCL_DOSMEMMGR +# include <os2.h> +#endif +#include <setjmp.h> + +#define UNZIP_INTERNAL +#include "unzip.h" +#include "version.h" +#ifdef WINDLL +# include "windll/windll.h" +#endif + +#ifdef DLL /* This source file supplies DLL-only interface code. */ + +jmp_buf dll_error_return; + +/*--------------------------------------------------------------------------- + Documented API entry points + ---------------------------------------------------------------------------*/ + + +UzpVer * UZ_EXP UzpVersion() /* should be pointer to const struct */ +{ + static UzpVer version; /* doesn't change between calls */ + + + version.structlen = UZPVER_LEN; + +#ifdef BETA + version.flag = 1; +#else + version.flag = 0; +#endif + version.betalevel = BETALEVEL; + version.date = VERSION_DATE; + +#ifdef ZLIB_VERSION + version.zlib_version = ZLIB_VERSION; + version.flag |= 2; +#else + version.zlib_version = NULL; +#endif + + /* someday each of these may have a separate patchlevel: */ + version.unzip.major = UZ_MAJORVER; + version.unzip.minor = UZ_MINORVER; + version.unzip.patchlevel = PATCHLEVEL; + + version.zipinfo.major = ZI_MAJORVER; + version.zipinfo.minor = ZI_MINORVER; + version.zipinfo.patchlevel = PATCHLEVEL; + + /* these are retained for backward compatibility only: */ + version.os2dll.major = UZ_MAJORVER; + version.os2dll.minor = UZ_MINORVER; + version.os2dll.patchlevel = PATCHLEVEL; + + version.windll.major = UZ_MAJORVER; + version.windll.minor = UZ_MINORVER; + version.windll.patchlevel = PATCHLEVEL; + + return &version; +} + +void UZ_EXP UzpVersion2(UzpVer2 *version) +{ + + version->structlen = UZPVER_LEN; + +#ifdef BETA + version->flag = 1; +#else + version->flag = 0; +#endif + strcpy(version->betalevel, BETALEVEL); + strcpy(version->date, VERSION_DATE); + +#ifdef ZLIB_VERSION + strcpy(version->zlib_version, ZLIB_VERSION); + version->flag |= 2; +#else + version->zlib_version[0] = '\0'; +#endif + + /* someday each of these may have a separate patchlevel: */ + version->unzip.major = UZ_MAJORVER; + version->unzip.minor = UZ_MINORVER; + version->unzip.patchlevel = PATCHLEVEL; + + version->zipinfo.major = ZI_MAJORVER; + version->zipinfo.minor = ZI_MINORVER; + version->zipinfo.patchlevel = PATCHLEVEL; + + /* these are retained for backward compatibility only: */ + version->os2dll.major = UZ_MAJORVER; + version->os2dll.minor = UZ_MINORVER; + version->os2dll.patchlevel = PATCHLEVEL; + + version->windll.major = UZ_MAJORVER; + version->windll.minor = UZ_MINORVER; + version->windll.patchlevel = PATCHLEVEL; +} + + + + + +#ifndef WINDLL + +int UZ_EXP UzpAltMain(int argc, char *argv[], UzpInit *init) +{ + int r, (*dummyfn)(); + + + CONSTRUCTGLOBALS(); + + if (init->structlen >= (sizeof(ulg) + sizeof(dummyfn)) && init->msgfn) + G.message = init->msgfn; + + if (init->structlen >= (sizeof(ulg) + 2*sizeof(dummyfn)) && init->inputfn) + G.input = init->inputfn; + + if (init->structlen >= (sizeof(ulg) + 3*sizeof(dummyfn)) && init->pausefn) + G.mpause = init->pausefn; + + if (init->structlen >= (sizeof(ulg) + 4*sizeof(dummyfn)) && init->userfn) + (*init->userfn)(); /* allow void* arg? */ + + r = unzip(__G__ argc, argv); + DESTROYGLOBALS() + RETURN(r); +} + +#endif /* !WINDLL */ + + + + +#ifndef __16BIT__ + +void UZ_EXP UzpFreeMemBuffer(UzpBuffer *retstr) +{ + if (retstr->strptr != NULL) { + free(retstr->strptr); + retstr->strptr = NULL; + } +} + + + + +#ifndef WINDLL + +static int UzpDLL_Init OF((zvoid *pG, UzpCB *UsrFuncts)); + +static int UzpDLL_Init(pG, UsrFuncts) +zvoid *pG; +UzpCB *UsrFuncts; +{ + int (*dummyfn)(); + + if (UsrFuncts->structlen >= (sizeof(ulg) + sizeof(dummyfn)) && + UsrFuncts->msgfn) + ((Uz_Globs *)pG)->message = UsrFuncts->msgfn; + else + return FALSE; + + if (UsrFuncts->structlen >= (sizeof(ulg) + 2*sizeof(dummyfn)) && + UsrFuncts->inputfn) + ((Uz_Globs *)pG)->input = UsrFuncts->inputfn; + + if (UsrFuncts->structlen >= (sizeof(ulg) + 3*sizeof(dummyfn)) && + UsrFuncts->pausefn) + ((Uz_Globs *)pG)->mpause = UsrFuncts->pausefn; + + if (UsrFuncts->structlen >= (sizeof(ulg) + 4*sizeof(dummyfn)) && + UsrFuncts->passwdfn) + ((Uz_Globs *)pG)->decr_passwd = UsrFuncts->passwdfn; + + if (UsrFuncts->structlen >= (sizeof(ulg) + 5*sizeof(dummyfn)) && + UsrFuncts->statrepfn) + ((Uz_Globs *)pG)->statreportcb = UsrFuncts->statrepfn; + + return TRUE; +} + + +int UZ_EXP UzpUnzipToMemory(char *zip, char *file, UzpOpts *optflgs, + UzpCB *UsrFuncts, UzpBuffer *retstr) +{ + int r; +#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO)) + char *intern_zip, *intern_file; +#endif + + CONSTRUCTGLOBALS(); +#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO)) + intern_zip = (char *)malloc(strlen(zip)+1); + if (intern_zip == NULL) { + DESTROYGLOBALS() + return PK_MEM; + } + intern_file = (char *)malloc(strlen(file)+1); + if (intern_file == NULL) { + DESTROYGLOBALS() + free(intern_zip); + return PK_MEM; + } + ISO_TO_INTERN(zip, intern_zip); + ISO_TO_INTERN(file, intern_file); +# define zip intern_zip +# define file intern_file +#endif + /* Copy those options that are meaningful for UzpUnzipToMemory, instead of + * a simple "memcpy(G.UzO, optflgs, sizeof(UzpOpts));" + */ + uO.pwdarg = optflgs->pwdarg; + uO.aflag = optflgs->aflag; + uO.C_flag = optflgs->C_flag; + uO.qflag = optflgs->qflag; /* currently, overridden in unzipToMemory */ + + if (!UzpDLL_Init((zvoid *)&G, UsrFuncts)) { + DESTROYGLOBALS(); + return PK_BADERR; + } + G.redirect_data = 1; + + r = (unzipToMemory(__G__ zip, file, retstr) <= PK_WARN); + + DESTROYGLOBALS() +#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO)) +# undef file +# undef zip + free(intern_file); + free(intern_zip); +#endif + if (!r && retstr->strlength) { + free(retstr->strptr); + retstr->strptr = NULL; + } + return r; +} +#endif /* !WINDLL */ +#endif /* !__16BIT__ */ + + + + + +#ifdef OS2DLL + +int UZ_EXP UzpFileTree(char *name, cbList(callBack), char *cpInclude[], + char *cpExclude[]) +{ + int r; + + CONSTRUCTGLOBALS(); + uO.qflag = 2; + uO.vflag = 1; + uO.C_flag = 1; + G.wildzipfn = name; + G.process_all_files = TRUE; + if (cpInclude) { + char **ptr = cpInclude; + + while (*ptr != NULL) ptr++; + G.filespecs = ptr - cpInclude; + G.pfnames = cpInclude, G.process_all_files = FALSE; + } + if (cpExclude) { + char **ptr = cpExclude; + + while (*ptr != NULL) ptr++; + G.xfilespecs = ptr - cpExclude; + G.pxnames = cpExclude, G.process_all_files = FALSE; + } + + G.processExternally = callBack; + r = process_zipfiles(__G)==0; + DESTROYGLOBALS() + return r; +} + +#endif /* OS2DLL */ + + + + +/*--------------------------------------------------------------------------- + Helper functions + ---------------------------------------------------------------------------*/ + + +void setFileNotFound(__G) + __GDEF +{ + G.filenotfound++; +} + + + +int unzipToMemory(__GPRO__ char *zip, char *file, UzpBuffer *retstr) +{ + int r; + char *incname[2]; + + G.process_all_files = FALSE; + G.extract_flag = TRUE; + uO.qflag = 2; + G.wildzipfn = zip; + + G.pfnames = incname; + incname[0] = file; + incname[1] = NULL; + G.filespecs = 1; + + r = process_zipfiles(__G); + if (retstr) { + retstr->strptr = (char *)G.redirect_buffer; + retstr->strlength = G.redirect_size; + } + return r; /* returns `PK_???' error values */ +} + + + +int redirect_outfile(__G) + __GDEF +{ + if (G.redirect_size != 0 || G.redirect_buffer != NULL) + return FALSE; + +#ifndef NO_SLIDE_REDIR + G.redirect_slide = !G.pInfo->textmode; +#endif + G.redirect_size = (G.pInfo->textmode ? + G.lrec.ucsize * lenEOL : G.lrec.ucsize); +#ifdef OS2 + DosAllocMem((void **)&G.redirect_buffer, G.redirect_size+1, + PAG_READ|PAG_WRITE|PAG_COMMIT); + G.redirect_pointer = G.redirect_buffer; +#else +#ifdef __16BIT__ + if ((ulg)((extent)G.redirect_size) != G.redirect_size) + return FALSE; +#endif + G.redirect_pointer = G.redirect_buffer = malloc(G.redirect_size+1); +#endif + if (!G.redirect_buffer) + return FALSE; + G.redirect_pointer[G.redirect_size] = '\0'; + return TRUE; +} + + + +int writeToMemory(__GPRO__ uch *rawbuf, ulg size) +{ + if (rawbuf != G.redirect_pointer) + memcpy(G.redirect_pointer,rawbuf,size); + G.redirect_pointer += size; + return 0; +} + + + + +int close_redirect(__G) + __GDEF +{ + if (G.pInfo->textmode) { + *G.redirect_pointer = '\0'; + G.redirect_size = G.redirect_pointer - G.redirect_buffer; + if ((G.redirect_buffer = + realloc(G.redirect_buffer, G.redirect_size + 1)) == NULL) { + G.redirect_size = 0; + return EOF; + } + } + return 0; +} + + + + +#ifndef __16BIT__ +#ifndef WINDLL + +/* Purpose: Determine if file in archive contains the string szSearch + + Parameters: archive = archive name + file = file contained in the archive. This cannot be + a wild card to be meaningful + pattern = string to search for + cmd = 0 - case-insensitive search + 1 - case-sensitve search + 2 - case-insensitive, whole words only + 3 - case-sensitive, whole words only + SkipBin = if true, skip any files that have control + characters other than CR, LF, or tab in the first + 100 characters. + + Returns: TRUE if a match is found + FALSE if no match is found + -1 on error + + Comments: This does not pretend to be as useful as the standard + Unix grep, which returns the strings associated with a + particular pattern, nor does it search past the first + matching occurrence of the pattern. + */ + +int UZ_EXP UzpGrep(char *archive, char *file, char *pattern, int cmd, + int SkipBin, UzpCB *UsrFuncts) +{ + int retcode = FALSE, compare; + ulg i, j, patternLen, buflen; + char * sz, *p; + UzpOpts flgopts; + UzpBuffer retstr; + + memzero(&flgopts, sizeof(UzpOpts)); /* no special options */ + + if (!UzpUnzipToMemory(archive, file, &flgopts, UsrFuncts, &retstr)) { + return -1; /* not enough memory, file not found, or other error */ + } + + if (SkipBin) { + if (retstr.strlength < 100) + buflen = retstr.strlength; + else + buflen = 100; + for (i = 0; i < buflen; i++) { + if (iscntrl(retstr.strptr[i])) { + if ((retstr.strptr[i] != 0x0A) && + (retstr.strptr[i] != 0x0D) && + (retstr.strptr[i] != 0x09)) + { + /* OK, we now think we have a binary file of some sort */ + free(retstr.strptr); + return FALSE; + } + } + } + } + + patternLen = strlen(pattern); + + if (retstr.strlength < patternLen) { + free(retstr.strptr); + return FALSE; + } + + sz = malloc(patternLen + 3); /* add two in case doing whole words only */ + if (cmd > 1) { + strcpy(sz, " "); + strcat(sz, pattern); + strcat(sz, " "); + } else + strcpy(sz, pattern); + + if ((cmd == 0) || (cmd == 2)) { + for (i = 0; i < strlen(sz); i++) + sz[i] = toupper(sz[i]); + for (i = 0; i < retstr.strlength; i++) + retstr.strptr[i] = toupper(retstr.strptr[i]); + } + + for (i = 0; i < (retstr.strlength - patternLen); i++) { + p = &retstr.strptr[i]; + compare = TRUE; + for (j = 0; j < patternLen; j++) { + /* We cannot do strncmp here, as we may be dealing with a + * "binary" file, such as a word processing file, or perhaps + * even a true executable of some sort. */ + if (p[j] != sz[j]) { + compare = FALSE; + break; + } + } + if (compare == TRUE) { + retcode = TRUE; + break; + } + } + + free(sz); + free(retstr.strptr); + + return retcode; +} +#endif /* !WINDLL */ +#endif /* !__16BIT__ */ + + + + +int UZ_EXP UzpValidate(char *archive, int AllCodes) +{ + int retcode; + CONSTRUCTGLOBALS(); + + uO.jflag = 1; + uO.tflag = 1; + uO.overwrite_none = 0; + G.extract_flag = (!uO.zipinfo_mode && + !uO.cflag && !uO.tflag && !uO.vflag && !uO.zflag +#ifdef TIMESTAMP + && !uO.T_flag +#endif + ); + + uO.qflag = 2; /* turn off all messages */ + G.fValidate = TRUE; + G.pfnames = (char **)&fnames[0]; /* assign default filename vector */ +#ifdef WINDLL + Wiz_NoPrinting(TRUE); +#endif + + if (archive == NULL) { /* something is screwed up: no filename */ + DESTROYGLOBALS(); + return PK_NOZIP; + } + + G.wildzipfn = (char *)malloc(FILNAMSIZ + 1); + strcpy(G.wildzipfn, archive); +#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO)) + _ISO_INTERN(G.wildzipfn); +#endif + + G.process_all_files = TRUE; /* for speed */ + + retcode = setjmp(dll_error_return); + + if (retcode) { +#ifdef WINDLL + Wiz_NoPrinting(FALSE); +#endif + free(G.wildzipfn); + DESTROYGLOBALS(); + return PK_BADERR; + } + + retcode = process_zipfiles(__G); + + free(G.wildzipfn); +#ifdef WINDLL + Wiz_NoPrinting(FALSE); +#endif + DESTROYGLOBALS(); + + /* PK_WARN == 1 and PK_FIND == 11. When we are just looking at an + archive, we should still be able to see the files inside it, + even if we can't decode them for some reason. + + We also still want to be able to get at files even if there is + something odd about the zip archive, hence allow PK_WARN, + PK_FIND, IZ_UNSUP as well as PK_ERR + */ + + if (AllCodes) + return retcode; + + if ((retcode == PK_OK) || (retcode == PK_WARN) || (retcode == PK_ERR) || + (retcode == IZ_UNSUP) || (retcode == PK_FIND)) + return TRUE; + else + return FALSE; +} + +#endif /* DLL */ diff --git a/utils/Install/packzip/apihelp.c b/utils/Install/packzip/apihelp.c new file mode 100644 index 0000000000..1a0d682cdd --- /dev/null +++ b/utils/Install/packzip/apihelp.c @@ -0,0 +1,147 @@ +/* apihelp.c */ + +#ifdef API_DOC + +#define UNZIP_INTERNAL +#include "unzip.h" +#include "version.h" + + +APIDocStruct APIDoc[] = { + { + "UZPVERSION" , "UzpVersion" , + "UzpVer *UzpVersion(void);", + "Get version numbers of the API and the underlying UnZip code.\n\n" + "\t\tThis is used for comparing the version numbers of the run-time\n" + "\t\tDLL code with those expected from the unzip.h at compile time.\n" + "\t\tIf the version numbers do not match, there may be compatibility\n" + "\t\tproblems with further use of the DLL.\n\n" + " Example:\t/* Check the major version number of the DLL code. */\n" + "\t\tUzpVer *pVersion;\n" + "\t\tpVersion = UzpVersion();\n" + "\t\tif (pVersion->unzip.major != UZ_MAJORVER)\n" + "\t\t fprintf(stderr, \"error: using wrong version of DLL\\n\");\n\n" + "\t\tSee unzip.h for details and unzipstb.c for an example.\n" + }, + + { + "UZPMAIN" , "UzpMain" , + "int UzpMain(int argc, char *argv[]);", + "Provide a direct entry point to the command line interface.\n\n" + "\t\tThis is used by the UnZip stub but you can use it in your\n" + "\t\town program as well. Output is sent to stdout.\n" + "\t\t0 on return indicates success.\n\n" + " Example:\t/* Extract 'test.zip' silently, junking paths. */\n" + "\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n" + "\t\tint argc = 3;\n" + "\t\tif (UzpMain(argc,argv))\n" + "\t\t printf(\"error: unzip failed\\n\");\n\n" + "\t\tSee unzip.h for details.\n" + }, + + { + "UZPALTMAIN" , "UzpAltMain" , + "int UzpAltMain(int argc, char *argv[], UzpInit *init);", + "Provide a direct entry point to the command line interface,\n" + "optionally installing replacement I/O handler functions.\n\n" + "\t\tAs with UzpMain(), output is sent to stdout by default.\n" + "\t\t`InputFn *inputfn' is not yet implemented. 0 on return\n" + "\t\tindicates success.\n\n" + " Example:\t/* Replace normal output and `more' functions. */\n" + "\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n" + "\t\tint argc = 3;\n" + "\t\tUzpInit init = { 16, MyMessageFn, NULL, MyPauseFn };\n" + "\t\tif (UzpAltMain(argc,argv,&init))\n" + "\t\t printf(\"error: unzip failed\\n\");\n\n" + "\t\tSee unzip.h for details.\n" + }, + + { + "UZPUNZIPTOMEMORY", "UzpUnzipToMemory", + "int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);", + "Pass the name of the zip file and the name of the file\n" + "\t\tyou wish to extract. UzpUnzipToMemory will create a\n" + "\t\tbuffer and return it in *retstr; 0 on return indicates\n" + "\t\tfailure.\n\n" + "\t\tSee unzip.h for details.\n" + }, + + { + "UZPFILETREE", "UzpFileTree", + "int UzpFileTree(char *name, cbList(callBack),\n" + "\t\t\tchar *cpInclude[], char *cpExclude[]);", + "Pass the name of the zip file, a callback function, an\n" + "\t\tinclude and exclude file list. UzpFileTree calls the\n" + "\t\tcallback for each valid file found in the zip file.\n" + "\t\t0 on return indicates failure.\n\n" + "\t\tSee unzip.h for details.\n" + }, + + { 0 } +}; + + +static int function_help OF((__GPRO__ APIDocStruct *doc, char *fname)); + + + +static int function_help(__G__ doc, fname) + __GDEF + APIDocStruct *doc; + char *fname; +{ + strcpy(slide, fname); + /* strupr(slide); non-standard */ + while (doc->compare && STRNICMP(doc->compare,slide,strlen(fname))) + doc++; + if (!doc->compare) + return 0; + else + Info(slide, 0, ((char *)slide, + " Function:\t%s\n\n Syntax:\t%s\n\n Purpose:\t%s", + doc->function, doc->syntax, doc->purpose)); + + return 1; +} + + + +void APIhelp(__G__ argc, argv) + __GDEF + int argc; + char **argv; +{ + if (argc > 1) { + struct APIDocStruct *doc; + + if (function_help(__G__ APIDoc, argv[1])) + return; +#ifdef SYSTEM_API_DETAILS + if (function_help(__G__ SYSTEM_API_DETAILS, argv[1])) + return; +#endif + Info(slide, 0, ((char *)slide, + "%s is not a documented command.\n\n", argv[1])); + } + + Info(slide, 0, ((char *)slide, "\ +This API provides a number of external C and REXX functions for handling\n\ +zipfiles in OS/2. Programmers are encouraged to expand this API.\n\ +\n\ +C functions: -- See unzip.h for details\n\ + UzpVer *UzpVersion(void);\n\ + int UzpMain(int argc, char *argv[]);\n\ + int UzpAltMain(int argc, char *argv[], UzpInit *init);\n\ + int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);\n\ + int UzpFileTree(char *name, cbList(callBack),\n\ + char *cpInclude[], char *cpExclude[]);\n\n")); + +#ifdef SYSTEM_API_BRIEF + Info(slide, 0, ((char *)slide, SYSTEM_API_BRIEF)); +#endif + + Info(slide, 0, ((char *)slide, + "\nFor more information, type 'unzip -A <function-name>'\n")); +} + +#endif /* API_DOC */ diff --git a/utils/Install/packzip/crc32.c b/utils/Install/packzip/crc32.c new file mode 100644 index 0000000000..cd05536108 --- /dev/null +++ b/utils/Install/packzip/crc32.c @@ -0,0 +1,56 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* $Id$ */ + +#define __CRC32_C /* identifies this source module */ + +#include "zip.h" + +#ifndef USE_ZLIB +#ifndef ASM_CRC + +#ifndef ZCONST +# define ZCONST const +#endif + +#ifdef CRC32 +# undef CRC32 +#endif +#define CRC32(c, b) (crc_table[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8)) +#define DO1(buf) crc = CRC32(crc, *buf++) +#define DO2(buf) DO1(buf); DO1(buf) +#define DO4(buf) DO2(buf); DO2(buf) +#define DO8(buf) DO4(buf); DO4(buf) + +/* ========================================================================= */ +ulg crc32(crc, buf, len) + register ulg crc; /* crc shift register */ + register ZCONST uch *buf; /* pointer to bytes to pump through */ + extent len; /* number of bytes in buf[] */ +/* Run a set of bytes through the crc shift register. If buf is a NULL + pointer, then initialize the crc shift register contents instead. + Return the current crc in either case. */ +{ + register ZCONST ulg near *crc_table; + + if (buf == NULL) return 0L; + + crc_table = get_crc_table(); + + crc = crc ^ 0xffffffffL; +#ifndef NO_UNROLLED_LOOPS + while (len >= 8) { + DO8(buf); + len -= 8; + } +#endif + if (len) do { + DO1(buf); + } while (--len); + return crc ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */ +} +#endif /* !ASM_CRC */ +#endif /* !USE_ZLIB */ diff --git a/utils/Install/packzip/crc_i386.S b/utils/Install/packzip/crc_i386.S new file mode 100644 index 0000000000..5d0867f0e1 --- /dev/null +++ b/utils/Install/packzip/crc_i386.S @@ -0,0 +1,230 @@ +/* + * crc_i386.S, optimized CRC calculation function for Zip and UnZip, not + * copyrighted by Paul Kienitz and Christian Spieler. Last revised 12 Oct 97. + * + * GRR 961110: incorporated Scott Field optimizations from win32/crc_i386.asm + * => overall 6% speedup in "unzip -tq" on 9MB zipfile (486-66) + * + * SPC 970402: revised for Rodney Brown's optimizations (32-bit-wide + * aligned reads for most of the data from buffer), can be + * disabled by defining the macro NO_32_BIT_LOADS + * + * SPC 971012: added Rodney Brown's additional tweaks for 32-bit-optimized + * CPUs (like the Pentium Pro, Pentium II, and probably some + * Pentium clones). This optimization is controlled by the + * preprocessor switch "__686" and is disabled by default. + * (This default is based on the assumption that most users + * do not yet work on a Pentium Pro or Pentium II machine ...) + * + * FLAT memory model assumed. Calling interface: + * - args are pushed onto the stack from right to left, + * - return value is given in the EAX register, + * - all other registers (with exception of EFLAGS) are preserved. (With + * GNU C 2.7.x, %edx and %ecx are `scratch' registers, but preserving + * them nevertheless adds only 4 single byte instructions.) + * + * This source generates the function + * ulg crc32(ulg crc, ZCONST uch *buf, ulg len). + * + * The loop unrolling can be disabled by defining the macro NO_UNROLLED_LOOPS. + * This results in shorter code at the expense of reduced performance. + */ + +/* This file is NOT used in conjunction with zlib. */ +#ifndef USE_ZLIB + +/* Preprocess with -DNO_UNDERLINE if your C compiler does not prefix + * external symbols with an underline character '_'. + */ +#if defined(NO_UNDERLINE) || defined(__ELF__) +# define _crc32 crc32 +# define _get_crc_table get_crc_table +#endif +/* Use 16-byte alignment if your assembler supports it. Warning: gas + * uses a log(x) parameter (.align 4 means 16-byte alignment). On SVR4 + * the parameter is a number of bytes. + */ +#ifndef ALIGNMENT +# define ALIGNMENT .align 4,0x90 +#endif + +#if defined(i386) || defined(_i386) || defined(_I386) || defined(__i386) + +/* This version is for 386 Unix, OS/2, MSDOS in 32 bit mode (gcc & gas). + * Warning: it uses the AT&T syntax: mov source,dest + * This file is only optional. If you want to use the C version, + * remove -DASM_CRC from CFLAGS in Makefile and set OBJA to an empty string. + */ + + .file "crc_i386.S" + +#if defined(NO_STD_STACKFRAME) && defined(USE_STD_STACKFRAME) +# undef USE_STACKFRAME +#else + /* The default is to use standard stack frame entry, because it + * results in smaller code! + */ +# ifndef USE_STD_STACKFRAME +# define USE_STD_STACKFRAME +# endif +#endif + +#ifdef USE_STD_STACKFRAME +# define _STD_ENTRY pushl %ebp ; movl %esp,%ebp +# define arg1 8(%ebp) +# define arg2 12(%ebp) +# define arg3 16(%ebp) +# define _STD_LEAVE popl %ebp +#else /* !USE_STD_STACKFRAME */ +# define _STD_ENTRY +# define arg1 24(%esp) +# define arg2 28(%esp) +# define arg3 32(%esp) +# define _STD_LEAVE +#endif /* ?USE_STD_STACKFRAME */ + +/* + * These two (three) macros make up the loop body of the CRC32 cruncher. + * registers modified: + * eax : crc value "c" + * esi : pointer to next data byte (or lword) "buf++" + * registers read: + * edi : pointer to base of crc_table array + * scratch registers: + * ebx : index into crc_table array + * (requires upper three bytes = 0 when __686 is undefined) + */ +#ifndef __686 /* optimize for 386, 486, Pentium */ +#define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\ + movb %al, %bl ;/* tmp = c & 0xFF */\ + shrl $8, %eax ;/* c = (c >> 8) */\ + xorl (%edi, %ebx, 4), %eax ;/* c ^= table[tmp] */ +#else /* __686 : optimize for Pentium Pro and compatible CPUs */ +#define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\ + movzbl %al, %ebx ;/* tmp = c & 0xFF */\ + shrl $8, %eax ;/* c = (c >> 8) */\ + xorl (%edi, %ebx, 4), %eax ;/* c ^=table[tmp] */ +#endif /* ?__686 */ + +#define Do_CRC_byte /* c = (c >> 8) ^ table[(c^*buf++)&0xFF] */\ + xorb (%esi), %al ;/* c ^= *buf */\ + incl %esi ;/* buf++ */\ + Do_CRC + +#ifndef NO_32_BIT_LOADS +#define Do_CRC_lword \ + xorl (%esi), %eax ;/* c ^= *(ulg *)buf */\ + addl $4, %esi ;/* ((ulg *)buf)++ */\ + Do_CRC \ + Do_CRC \ + Do_CRC \ + Do_CRC +#endif /* !NO_32_BIT_LOADS */ + + + .text + + .globl _crc32 + +_crc32: /* ulg crc32(ulg crc, uch *buf, extent len) */ + _STD_ENTRY + pushl %edi + pushl %esi + pushl %ebx + pushl %edx + pushl %ecx + + movl arg2, %esi /* 2nd arg: uch *buf */ + subl %eax, %eax /* > if (!buf) */ + testl %esi, %esi /* > return 0; */ + jz .L_fine /* > else { */ + call _get_crc_table + movl %eax, %edi + movl arg1, %eax /* 1st arg: ulg crc */ +#ifndef __686 + subl %ebx, %ebx /* ebx=0; bl usable as dword */ +#endif + movl arg3, %ecx /* 3rd arg: extent len */ + notl %eax /* > c = ~crc; */ + +#ifndef NO_UNROLLED_LOOPS +# ifndef NO_32_BIT_LOADS + testl %ecx, %ecx + jz .L_bail + /* Assert now have positive length */ +.L_align_loop: + testl $3, %esi /* Align buf on lword boundary */ + jz .L_aligned_now + Do_CRC_byte + decl %ecx + jnz .L_align_loop +.L_aligned_now: +# endif /* !NO_32_BIT_LOADS */ + movl %ecx, %edx /* save len in edx */ + andl $7, %edx /* edx = len % 8 */ + shrl $3, %ecx /* ecx = len / 8 */ + jz .L_No_Eights +/* align loop head at start of 486 internal cache line !! */ + ALIGNMENT +.L_Next_Eight: +# ifndef NO_32_BIT_LOADS + /* Do_CRC_lword */ + xorl (%esi), %eax ;/* c ^= *(ulg *)buf */ + addl $4, %esi ;/* ((ulg *)buf)++ */ + Do_CRC + Do_CRC + Do_CRC + Do_CRC + /* Do_CRC_lword */ + xorl (%esi), %eax ;/* c ^= *(ulg *)buf */ + addl $4, %esi ;/* ((ulg *)buf)++ */ + Do_CRC + Do_CRC + Do_CRC + Do_CRC +# else /* NO_32_BIT_LOADS */ + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte +# endif /* ?NO_32_BIT_LOADS */ + decl %ecx + jnz .L_Next_Eight + +.L_No_Eights: + movl %edx, %ecx +#endif /* NO_UNROLLED_LOOPS */ + +#ifndef NO_JECXZ_SUPPORT + jecxz .L_bail /* > if (len) */ +#else + testl %ecx, %ecx /* > if (len) */ + jz .L_bail +#endif +/* align loop head at start of 486 internal cache line !! */ + ALIGNMENT +.L_loupe: /* > do { */ + Do_CRC_byte /* c = CRC32(c, *buf++); */ + decl %ecx /* > } while (--len); */ + jnz .L_loupe + +.L_bail: /* > } */ + notl %eax /* > return ~c; */ +.L_fine: + popl %ecx + popl %edx + popl %ebx + popl %esi + popl %edi + _STD_LEAVE + ret + +#else + error: this asm version is for 386 only +#endif /* i386 || _i386 || _I386 || __i386 */ + +#endif /* !USE_ZLIB */ diff --git a/utils/Install/packzip/crc_i386.asm b/utils/Install/packzip/crc_i386.asm new file mode 100644 index 0000000000..ea29282286 --- /dev/null +++ b/utils/Install/packzip/crc_i386.asm @@ -0,0 +1,229 @@ +; crc_i386.asm, optimized CRC calculation function for Zip and UnZip, not +; copyrighted by Paul Kienitz and Christian Spieler. Last revised 25 Mar 98. +; +; Revised 06-Oct-96, Scott Field (sfield@microsoft.com) +; fixed to assemble with masm by not using .model directive which makes +; assumptions about segment alignment. Also, +; avoid using loop, and j[e]cxz where possible. Use mov + inc, rather +; than lodsb, and other misc. changes resulting in the following performance +; increases: +; +; unrolled loops NO_UNROLLED_LOOPS +; *8 >8 <8 *8 >8 <8 +; +; +54% +42% +35% +82% +52% +25% +; +; first item in each table is input buffer length, even multiple of 8 +; second item in each table is input buffer length, > 8 +; third item in each table is input buffer length, < 8 +; +; Revised 02-Apr-97, Chr. Spieler, based on Rodney Brown (rdb@cmutual.com.au) +; Incorporated Rodney Brown's 32-bit-reads optimization as found in the +; UNIX AS source crc_i386.S. This new code can be disabled by defining +; the macro symbol NO_32_BIT_LOADS. +; +; Revised 12-Oct-97, Chr. Spieler, based on Rodney Brown (rdb@cmutual.com.au) +; Incorporated Rodney Brown's additional tweaks for 32-bit-optimized CPUs +; (like the Pentium Pro, Pentium II, and probably some Pentium clones). +; This optimization is controlled by the macro symbol __686 and is disabled +; by default. (This default is based on the assumption that most users +; do not yet work on a Pentium Pro or Pentium II machine ...) +; +; FLAT memory model assumed. +; +; The loop unrolling can be disabled by defining the macro NO_UNROLLED_LOOPS. +; This results in shorter code at the expense of reduced performance. +; +; Revised 25-Mar-98, Cosmin Truta (cosmint@cs.ubbcluj.ro) +; Working without .model directive caused tasm32 version 5.0 to produce +; bad object code. The optimized alignments can be optionally disabled +; by defining NO_ALIGN, thus allowing to use .model flat. There is no need +; to define this macro if using other version of tasm. +; +;============================================================================== +; +; Do NOT assemble this source if external crc32 routine from zlib gets used. +; + IFNDEF USE_ZLIB +; + .386p + name crc_i386 + + IFDEF NO_ALIGN + .model flat + ENDIF + +extrn _get_crc_table:near ; ZCONST ulg near *get_crc_table(void); + +; + IFNDEF NO_STD_STACKFRAME + ; Use a `standard' stack frame setup on routine entry and exit. + ; Actually, this option is set as default, because it results + ; in smaller code !! +STD_ENTRY MACRO + push ebp + mov ebp,esp + ENDM + + Arg1 EQU 08H[ebp] + Arg2 EQU 0CH[ebp] + Arg3 EQU 10H[ebp] + +STD_LEAVE MACRO + pop ebp + ENDM + + ELSE ; NO_STD_STACKFRAME + +STD_ENTRY MACRO + ENDM + + Arg1 EQU 18H[esp] + Arg2 EQU 1CH[esp] + Arg3 EQU 20H[esp] + +STD_LEAVE MACRO + ENDM + + ENDIF ; ?NO_STD_STACKFRAME + +; These two (three) macros make up the loop body of the CRC32 cruncher. +; registers modified: +; eax : crc value "c" +; esi : pointer to next data byte (or dword) "buf++" +; registers read: +; edi : pointer to base of crc_table array +; scratch registers: +; ebx : index into crc_table array +; (requires upper three bytes = 0 when __686 is undefined) + IFNDEF __686 ; optimize for 386, 486, Pentium +Do_CRC MACRO + mov bl,al ; tmp = c & 0xFF + shr eax,8 ; c = (c >> 8) + xor eax,[edi+ebx*4] ; ^ table[tmp] + ENDM + ELSE ; __686 : optimize for Pentium Pro, Pentium II and compatible CPUs +Do_CRC MACRO + movzx ebx,al ; tmp = c & 0xFF + shr eax,8 ; c = (c >> 8) + xor eax,[edi+ebx*4] ; ^ table[tmp] + ENDM + ENDIF ; ?__686 +Do_CRC_byte MACRO + xor al, byte ptr [esi] ; c ^= *buf + inc esi ; buf++ + Do_CRC ; c = (c >> 8) ^ table[c & 0xFF] + ENDM + IFNDEF NO_32_BIT_LOADS +Do_CRC_dword MACRO + xor eax, dword ptr [esi] ; c ^= *(ulg *)buf + add esi, 4 ; ((ulg *)buf)++ + Do_CRC + Do_CRC + Do_CRC + Do_CRC + ENDM + ENDIF ; !NO_32_BIT_LOADS + + IFNDEF NO_ALIGN +_TEXT segment use32 para public 'CODE' + ELSE +_TEXT segment use32 + ENDIF + assume CS: _TEXT + + public _crc32 +_crc32 proc near ; ulg crc32(ulg crc, ZCONST uch *buf, extent len) + STD_ENTRY + push edi + push esi + push ebx + push edx + push ecx + + mov esi,Arg2 ; 2nd arg: uch *buf + sub eax,eax ;> if (!buf) + test esi,esi ;> return 0; + jz fine ;> else { + + call _get_crc_table + mov edi,eax + mov eax,Arg1 ; 1st arg: ulg crc + IFNDEF __686 + sub ebx,ebx ; ebx=0; make bl usable as a dword + ENDIF + mov ecx,Arg3 ; 3rd arg: extent len + not eax ;> c = ~crc; + + IFNDEF NO_UNROLLED_LOOPS + IFNDEF NO_32_BIT_LOADS + test ecx,ecx + je bail +align_loop: + test esi,3 ; align buf pointer on next + jz SHORT aligned_now ; dword boundary + Do_CRC_byte + dec ecx + jnz align_loop +aligned_now: + ENDIF ; !NO_32_BIT_LOADS + mov edx,ecx ; save len in edx + and edx,000000007H ; edx = len % 8 + shr ecx,3 ; ecx = len / 8 + jz SHORT No_Eights + IFNDEF NO_ALIGN +; align loop head at start of 486 internal cache line !! + align 16 + ENDIF +Next_Eight: + IFNDEF NO_32_BIT_LOADS + Do_CRC_dword + Do_CRC_dword + ELSE ; NO_32_BIT_LOADS + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + ENDIF ; ?NO_32_BIT_LOADS + dec ecx + jnz Next_Eight +No_Eights: + mov ecx,edx + + ENDIF ; NO_UNROLLED_LOOPS + IFNDEF NO_JECXZ_SUPPORT + jecxz bail ;> if (len) + ELSE + test ecx,ecx ;> if (len) + jz SHORT bail + ENDIF + IFNDEF NO_ALIGN +; align loop head at start of 486 internal cache line !! + align 16 + ENDIF +loupe: ;> do { + Do_CRC_byte ; c = CRC32(c, *buf++); + dec ecx ;> } while (--len); + jnz loupe + +bail: ;> } + not eax ;> return ~c; +fine: + pop ecx + pop edx + pop ebx + pop esi + pop edi + STD_LEAVE + ret +_crc32 endp + +_TEXT ends +; + ENDIF ; !USE_ZLIB +; +end diff --git a/utils/Install/packzip/crc_i386.c b/utils/Install/packzip/crc_i386.c new file mode 100644 index 0000000000..72e2c6b9dc --- /dev/null +++ b/utils/Install/packzip/crc_i386.c @@ -0,0 +1,215 @@ +/* crc_i386.c -- Microsoft 32-bit C/C++ adaptation of crc_i386.asm + * Created by Rodney Brown from crc_i386.asm, modified by Chr. Spieler. + * Last revised: 22-Mai-1998 + * + * Original coded (in crc_i386.asm) and put into the public domain + * by Paul Kienitz and Christian Spieler. + * + * Revised 06-Oct-96, Scott Field (sfield@microsoft.com) + * fixed to assemble with masm by not using .model directive which makes + * assumptions about segment alignment. Also, + * avoid using loop, and j[e]cxz where possible. Use mov + inc, rather + * than lodsb, and other misc. changes resulting in the following performance + * increases: + * + * unrolled loops NO_UNROLLED_LOOPS + * *8 >8 <8 *8 >8 <8 + * + * +54% +42% +35% +82% +52% +25% + * + * first item in each table is input buffer length, even multiple of 8 + * second item in each table is input buffer length, > 8 + * third item in each table is input buffer length, < 8 + * + * Revised 02-Apr-97, Chr. Spieler, based on Rodney Brown (rdb@cmutual.com.au) + * Incorporated Rodney Brown's 32-bit-reads optimization as found in the + * UNIX AS source crc_i386.S. This new code can be disabled by defining + * the macro symbol NO_32_BIT_LOADS. + * + * Revised 12-Oct-97, Chr. Spieler, based on Rodney Brown (rdb@cmutual.com.au) + * Incorporated Rodney Brown's additional tweaks for 32-bit-optimized CPUs + * (like the Pentium Pro, Pentium II, and probably some Pentium clones). + * This optimization is controlled by the macro symbol __686 and is disabled + * by default. (This default is based on the assumption that most users + * do not yet work on a Pentium Pro or Pentium II machine ...) + * + * Revised 16-Nov-97, Chr. Spieler: Made code compatible with Borland C++ + * 32-bit, removed unneeded kludge for potentially unknown movzx mnemonic, + * confirmed correct working with MS VC++ (32-bit). + * + * Revised 22-Mai-98, Peter Kunath, Chr. Spieler : The 16-Nov-97 revision broke + * MSVC 5.0. Inside preprocessor macros, each instruction is enclosed in its + * own __asm {...} construct. For MSVC, a "#pragma warning" was added to + * shut up the "no return value" warning message. + * + * FLAT memory model assumed. + * + * The loop unrolling can be disabled by defining the macro NO_UNROLLED_LOOPS. + * This results in shorter code at the expense of reduced performance. + * + */ + +#include "zip.h" + +#ifndef USE_ZLIB + +#ifndef ZCONST +# define ZCONST const +#endif + +/* Select wether the following inline-assember code is supported. */ +#if (defined(_MSC_VER) && _MSC_VER >= 700) +#if (defined(_M_IX86) && _M_IX86 >= 300) +# define MSC_INLINE_ASM_32BIT_SUPPORT + /* Disable warning for no return value, typical of asm functions */ +# pragma warning( disable : 4035 ) +#endif +#endif + +#if (defined(__BORLANDC__) && __BORLANDC__ >= 452) +# define MSC_INLINE_ASM_32BIT_SUPPORT +#endif + +#ifdef MSC_INLINE_ASM_32BIT_SUPPORT +/* This code is intended for Microsoft C/C++ (32-bit) compatible compilers. */ + +/* + * These two (three) macros make up the loop body of the CRC32 cruncher. + * registers modified: + * eax : crc value "c" + * esi : pointer to next data byte (or dword) "buf++" + * registers read: + * edi : pointer to base of crc_table array + * scratch registers: + * ebx : index into crc_table array + * (requires upper three bytes = 0 when __686 is undefined) + */ +#ifndef __686 +#define Do_CRC { \ + __asm { mov bl, al }; \ + __asm { shr eax, 8 }; \ + __asm { xor eax, [edi+ebx*4] }; } +#else /* __686 */ +#define Do_CRC { \ + __asm { movzx ebx, al }; \ + __asm { shr eax, 8 }; \ + __asm { xor eax, [edi+ebx*4] }; } +#endif /* ?__686 */ + +#define Do_CRC_byte { \ + __asm { xor al, byte ptr [esi] }; \ + __asm { inc esi }; \ + Do_CRC; } + +#ifndef NO_32_BIT_LOADS +#define Do_CRC_dword { \ + __asm { xor eax, dword ptr [esi] }; \ + __asm { add esi, 4 }; \ + Do_CRC; \ + Do_CRC; \ + Do_CRC; \ + Do_CRC; } +#endif /* !NO_32_BIT_LOADS */ + +/* ========================================================================= */ +ulg crc32(crc, buf, len) + ulg crc; /* crc shift register */ + ZCONST uch *buf; /* pointer to bytes to pump through */ + extent len; /* number of bytes in buf[] */ +/* Run a set of bytes through the crc shift register. If buf is a NULL + pointer, then initialize the crc shift register contents instead. + Return the current crc in either case. */ +{ + __asm { + push edx + push ecx + + mov esi,buf ;/* 2nd arg: uch *buf */ + sub eax,eax ;/*> if (!buf) */ + test esi,esi ;/*> return 0; */ + jz fine ;/*> else { */ + + call get_crc_table + mov edi,eax + mov eax,crc ;/* 1st arg: ulg crc */ +#ifndef __686 + sub ebx,ebx ;/* ebx=0; => bl usable as a dword */ +#endif + mov ecx,len ;/* 3rd arg: extent len */ + not eax ;/*> c = ~crc; */ + +#ifndef NO_UNROLLED_LOOPS +# ifndef NO_32_BIT_LOADS + test ecx,ecx + je bail +align_loop: + test esi,3 ;/* align buf pointer on next */ + jz aligned_now ;/* dword boundary */ + } + Do_CRC_byte ; + __asm { + dec ecx + jnz align_loop +aligned_now: +# endif /* !NO_32_BIT_LOADS */ + mov edx,ecx ;/* save len in edx */ + and edx,000000007H ;/* edx = len % 8 */ + shr ecx,3 ;/* ecx = len / 8 */ + jz No_Eights +; align loop head at start of 486 internal cache line !! + align 16 +Next_Eight: + } +# ifndef NO_32_BIT_LOADS + Do_CRC_dword ; + Do_CRC_dword ; +# else /* NO_32_BIT_LOADS */ + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; +# endif /* ?NO_32_BIT_LOADS */ + __asm { + dec ecx + jnz Next_Eight +No_Eights: + mov ecx,edx + +#endif /* NO_UNROLLED_LOOPS */ +#ifndef NO_JECXZ_SUPPORT + jecxz bail ;/*> if (len) */ +#else + test ecx,ecx ;/*> if (len) */ + jz bail +#endif +; align loop head at start of 486 internal cache line !! + align 16 +loupe: ;/*> do { */ + } + Do_CRC_byte ;/* c = CRC32(c, *buf++); */ + __asm { + dec ecx ;/*> } while (--len); */ + jnz loupe + +bail: ;/*> } */ + not eax ;/*> return ~c; */ +fine: + pop ecx + pop edx + } +#ifdef NEED_RETURN + return _EAX; +#endif +} +#endif /* MSC_INLINE_ASM_32BIT_SUPPORT */ +#if (defined(_MSC_VER) && _MSC_VER >= 700) +#if (defined(_M_IX86) && _M_IX86 >= 300) + /* Reenable missing return value warning */ +# pragma warning( default : 4035 ) +#endif +#endif +#endif /* !USE_ZLIB */ diff --git a/utils/Install/packzip/crc_lcc.asm b/utils/Install/packzip/crc_lcc.asm new file mode 100644 index 0000000000..b3288a833e --- /dev/null +++ b/utils/Install/packzip/crc_lcc.asm @@ -0,0 +1,108 @@ +; crc_lcc.asm, optimized CRC calculation function for Zip and UnZip, not +; copyrighted by Paul Kienitz and Christian Spieler. Last revised 25 Mar 98. +; +; The code in this file has been copied verbatim from crc_i386.{asm|S}; +; only the assembler syntax and metacommands have been adapted to +; the habits of the free LCC-Win32 C compiler package. +; This version of the code uses the "optimized for i686" variant of +; crc_i386.{asm|S}. +; +; For more information (and a revision log), look into the original +; source files. +; + .text + .file "crc32.c" + .text + .type _crc32,function +_crc32: + pushl %ebp + movl %esp,%ebp + pushl %ecx + pushl %ebx + pushl %esi + pushl %edi + .line 34 + .line 37 + movl 12(%ebp),%esi + subl %eax,%eax + testl %esi,%esi + jz _$3 + .line 39 + call _get_crc_table + movl %eax,%edi + .line 41 + movl 8(%ebp),%eax + movl 16(%ebp),%ecx + notl %eax + testl %ecx,%ecx + jz _$4 +_$5: + testl $3,%esi + jz _$6 + xorb (%esi),%al + incl %esi + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + decl %ecx + jnz _$5 +_$6: + movl %ecx,%edx + andl $7,%edx + shrl $3,%ecx + jz _$8 +_$7: + xorl (%esi),%eax + addl $4,%esi + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + xorl (%esi),%eax + addl $4,%esi + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + decl %ecx + jnz _$7 +_$8: + movl %edx,%ecx + jecxz _$4 +_$9: + xorb (%esi),%al + incl %esi + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + decl %ecx + jnz _$9 +_$4: + xorl $0xffffffff,%eax +_$3: + .line 52 + popl %edi + popl %esi + popl %ebx + leave + ret +_$34: + .size _crc32,_$34-_crc32 + .globl _crc32 + .extern _get_crc_table diff --git a/utils/Install/packzip/crctab.c b/utils/Install/packzip/crctab.c new file mode 100644 index 0000000000..2f80aa2cfa --- /dev/null +++ b/utils/Install/packzip/crctab.c @@ -0,0 +1,219 @@ +/* crctab.c -- supply the CRC table needed for CRC-32 calculations. + * Copyright (C) 1995 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* $Id$ */ + +/* + Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The table is simply the CRC of all possible eight bit values. This is all + the information needed to generate CRC's on data a byte at a time for all + combinations of CRC register values and incoming bytes. +*/ + +#define __CRCTAB_C /* identifies this source module */ + +#include "zip.h" + +#if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB)) + +#ifndef ZCONST +# define ZCONST const +#endif + +#ifdef DYNAMIC_CRC_TABLE + +/* ========================================================================= + * Make the crc table. This function is needed only if you want to compute + * the table dynamically. + */ + +local void make_crc_table OF((void)); + +#if (defined(DYNALLOC_CRCTAB) && defined(REENTRANT)) + error: Dynamic allocation of CRC table not safe with reentrant code. +#endif /* DYNALLOC_CRCTAB && REENTRANT */ + +#ifdef DYNALLOC_CRCTAB + local ulg near *crc_table = NULL; +# if 0 /* not used, since sizeof("near *") <= sizeof(int) */ + /* Use this section when access to a "local int" is faster than access to + a "local pointer" (e.g.: i86 16bit code with far pointers). */ + local int crc_table_empty = 1; +# define CRC_TABLE_IS_EMPTY (crc_table_empty != 0) +# define MARK_CRCTAB_FILLED crc_table_empty = 0 +# define MARK_CRCTAB_EMPTY crc_table_empty = 1 +# else + /* Use this section on systems where the size of pointers and ints is + equal (e.g.: all 32bit systems). */ +# define CRC_TABLE_IS_EMPTY (crc_table == NULL) +# define MARK_CRCTAB_FILLED crc_table = crctab_p +# define MARK_CRCTAB_EMPTY crc_table = NULL +# endif +#else /* !DYNALLOC_CRCTAB */ + local ulg near crc_table[256]; + local int crc_table_empty = 1; +# define CRC_TABLE_IS_EMPTY (crc_table_empty != 0) +# define MARK_CRCTAB_FILLED crc_table_empty = 0 +#endif /* ?DYNALLOC_CRCTAB */ + + +local void make_crc_table() +{ + ulg c; /* crc shift register */ + int n; /* counter for all possible eight bit values */ + int k; /* byte being shifted into crc apparatus */ +#ifdef DYNALLOC_CRCTAB + ulg near *crctab_p; /* temporary pointer to allocated crc_table area */ +#else /* !DYNALLOC_CRCTAB */ +# define crctab_p crc_table +#endif /* DYNALLOC_CRCTAB */ + +#ifdef COMPUTE_XOR_PATTERN + /* This piece of code has been left here to explain how the XOR pattern + * used in the creation of the crc_table values can be recomputed. + * For production versions of this function, it is more efficient to + * supply the resultant pattern at compile time. + */ + ulg xor; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static uch p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* make exclusive-or pattern from polynomial (0xedb88320L) */ + xor = 0L; + for (i = 0; i < sizeof(p)/sizeof(uch); i++) + xor |= 1L << (31 - p[i]); +#else +# define xor 0xedb88320L +#endif + +#ifdef DYNALLOC_CRCTAB + crctab_p = (ulg near *) nearmalloc (256*sizeof(ulg)); + if (crctab_p == NULL) { + ziperr(ZE_MEM, "crc_table allocation"); + } +#endif /* DYNALLOC_CRCTAB */ + + for (n = 0; n < 256; n++) { + c = (ulg)n; + for (k = 8; k; k--) + c = c & 1 ? xor ^ (c >> 1) : c >> 1; + crctab_p[n] = c; + } + MARK_CRCTAB_FILLED; +} + +#else /* !DYNAMIC_CRC_TABLE */ + +#ifdef DYNALLOC_CRCTAB + error: Inconsistent flags, DYNALLOC_CRCTAB without DYNAMIC_CRC_TABLE. +#endif + +/* ======================================================================== + * Table of CRC-32's of all single-byte values (made by make_crc_table) + */ +local ZCONST ulg near crc_table[256] = { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL +}; +#endif /* ?DYNAMIC_CRC_TABLE */ + +/* use "OF((void))" here to work around a Borland TC++ 1.0 problem */ +#ifdef USE_ZLIB +ZCONST uLongf *get_crc_table OF((void)) +#else +ZCONST ulg near *get_crc_table OF((void)) +#endif +{ +#ifdef DYNAMIC_CRC_TABLE + if (CRC_TABLE_IS_EMPTY) + make_crc_table(); +#endif +#ifdef USE_ZLIB + return (ZCONST uLongf *)crc_table; +#else + return (ZCONST ulg near *)crc_table; +#endif +} + +#ifdef DYNALLOC_CRCTAB +void free_crc_table() +{ + if (!CRC_TABLE_IS_EMPTY) + { + nearfree((ulg near *)crc_table); + MARK_CRCTAB_EMPTY; + } +} +#endif + +#endif /* !USE_ZLIB || USE_OWN_CRCTAB */ diff --git a/utils/Install/packzip/crypt.c b/utils/Install/packzip/crypt.c new file mode 100644 index 0000000000..0dbe227f81 --- /dev/null +++ b/utils/Install/packzip/crypt.c @@ -0,0 +1,12 @@ +/* + crypt.c (dummy version) by Info-ZIP. Last revised: 15 Aug 98 + + This is a non-functional version of Info-ZIP's crypt.c encryption/ + decryption code for Zip, ZipCloak, UnZip and fUnZip. This file is + not copyrighted and may be distributed freely. :-) See the "WHERE" + file for sites from which to obtain the full encryption/decryption + sources (zcrypt28.zip or later). + */ + +/* something "externally visible" to shut up compiler/linker warnings */ +int zcr_dummy; diff --git a/utils/Install/packzip/envargs.c b/utils/Install/packzip/envargs.c new file mode 100644 index 0000000000..76a41e8997 --- /dev/null +++ b/utils/Install/packzip/envargs.c @@ -0,0 +1,314 @@ +/*----------------------------------------------------------------* + | envargs - add default options from environment to command line + |---------------------------------------------------------------- + | Author: Bill Davidsen, original 10/13/91, revised 23 Oct 1991. + | This program is in the public domain. + |---------------------------------------------------------------- + | Minor program notes: + | 1. Yes, the indirection is a tad complex + | 2. Parentheses were added where not needed in some cases + | to make the action of the code less obscure. + |---------------------------------------------------------------- + | UnZip notes: 24 May 92 ("v1.4"): + | 1. #include "unzip.h" for prototypes (24 May 92) + | 2. changed ch to type char (24 May 92) + | 3. added an ifdef to avoid Borland warnings (24 May 92) + | 4. included Rich Wales' mksargs() routine (for MS-DOS, maybe + | OS/2? NT?) (4 Dec 93) + | 5. added alternate-variable string envstr2 (21 Apr 94) + | 6. added support for quoted arguments (6 Jul 96) + *----------------------------------------------------------------*/ + + +#define ENVARGS_C +#define UNZIP_INTERNAL +#include "unzip.h" + +#ifdef __EMX__ /* emx isspace() returns TRUE on extended ASCII !! */ +# define ISspace(c) ((c) & 0x80 ? 0 : isspace((unsigned)c)) +#else +# define ISspace(c) isspace((unsigned)c) +#endif /* ?__EMX__ */ + +static int count_args OF((ZCONST char *)); +static void mem_err OF((__GPRO)); + +static ZCONST char Far NoMemArguments[] = + "envargs: cannot get memory for arguments"; + + +void envargs(__G__ Pargc, Pargv, envstr, envstr2) + __GDEF + int *Pargc; + char ***Pargv; + ZCONST char *envstr, *envstr2; +{ +#ifndef RISCOS + char *getenv(); +#endif + char *envptr; /* value returned by getenv */ + char *bufptr; /* copy of env info */ + int argc = 0; /* internal arg count */ + register int ch; /* spare temp value */ + char **argv; /* internal arg vector */ + char **argvect; /* copy of vector address */ + + /* see if anything in the environment */ + if ((envptr = getenv(envstr)) != (char *)NULL) /* usual var */ + while (ISspace(*envptr)) /* must discard leading spaces */ + envptr++; + if (envptr == (char *)NULL || *envptr == '\0') + if ((envptr = getenv(envstr2)) != (char *)NULL) /* alternate var */ + while (ISspace(*envptr)) + envptr++; + if (envptr == (char *)NULL || *envptr == '\0') + return; + + bufptr = malloc(1 + strlen(envptr)); + if (bufptr == (char *)NULL) + mem_err(__G); +#if (defined(WIN32) || defined(WINDLL)) +# ifdef WIN32 + if (IsWinNT()) { + /* SPC: don't know codepage of 'real' WinNT console */ + strcpy(bufptr, envptr); + } else { + /* Win95 environment is DOS and uses OEM character coding */ + OEM_TO_INTERN(envptr, bufptr); + } +# else /* !WIN32 */ + /* DOS environment uses OEM codepage */ + OEM_TO_INTERN(envptr, bufptr); +# endif +#else /* !(WIN32 || WINDLL) */ + strcpy(bufptr, envptr); +#endif /* ?(WIN32 || WINDLL) */ + + /* count the args so we can allocate room for them */ + argc = count_args(bufptr); + /* allocate a vector large enough for all args */ + argv = (char **)malloc((argc + *Pargc + 1) * sizeof(char *)); + if (argv == (char **)NULL) { + free(bufptr); + mem_err(__G); + } + argvect = argv; + + /* copy the program name first, that's always true */ + *(argv++) = *((*Pargv)++); + + /* copy the environment args next, may be changed */ + do { +#if defined(AMIGA) || defined(UNIX) + if (*bufptr == '"') { + char *argstart = ++bufptr; + + *(argv++) = argstart; + for (ch = *bufptr; ch != '\0' && ch != '\"'; ch = *(++bufptr)) + if (ch == '\\' && bufptr[1] != '\0') + ++bufptr; /* skip char after backslash */ + if (ch != '\0') + *(bufptr++) = '\0'; /* overwrite trailing " */ + + /* remove escape characters */ + while ((argstart = strchr(argstart, '\\')) != (char *)NULL) { + strcpy(argstart, argstart + 1); + if (*argstart) + ++argstart; + } + } else { + *(argv++) = bufptr; + while ((ch = *bufptr) != '\0' && !ISspace(ch)) + ++bufptr; + if (ch != '\0') + *(bufptr++) = '\0'; + } +#else +#ifdef DOS_FLX_OS2_W32 + /* we do not support backslash-quoting of quotes in quoted + * strings under DOS_OS2_W32, because backslashes are directory + * separators and double quotes are illegal in filenames */ + if (*bufptr == '"') { + *(argv++) = ++bufptr; + while ((ch = *bufptr) != '\0' && ch != '\"') + ++bufptr; + if (ch != '\0') + *(bufptr++) = '\0'; + } else { + *(argv++) = bufptr; + while ((ch = *bufptr) != '\0' && !ISspace(ch)) + ++bufptr; + if (ch != '\0') + *(bufptr++) = '\0'; + } +#else + *(argv++) = bufptr; + while ((ch = *bufptr) != '\0' && !ISspace(ch)) + ++bufptr; + if (ch != '\0') + *(bufptr++) = '\0'; +#endif /* ?DOS_FLX_OS2_W32 */ +#endif /* ?(AMIGA || UNIX) */ + while ((ch = *bufptr) != '\0' && ISspace(ch)) + ++bufptr; + } while (ch); + + /* now save old argc and copy in the old args */ + argc += *Pargc; + while (--(*Pargc)) + *(argv++) = *((*Pargv)++); + + /* finally, add a NULL after the last arg, like Unix */ + *argv = (char *)NULL; + + /* save the values and return */ + *Pargv = argvect; + *Pargc = argc; +} + + + +static int count_args(s) + ZCONST char *s; +{ + int count = 0; + char ch; + + do { + /* count and skip args */ + ++count; +#if defined(AMIGA) || defined(UNIX) + if (*s == '\"') { + for (ch = *(++s); ch != '\0' && ch != '\"'; ch = *(++s)) + if (ch == '\\' && s[1] != '\0') + ++s; + if (*s) + ++s; /* trailing quote */ + } else +#else +#ifdef DOS_FLX_OS2_W32 + if (*s == '\"') { + ++s; /* leading quote */ + while ((ch = *s) != '\0' && ch != '\"') + ++s; + if (*s) + ++s; /* trailing quote */ + } else +#endif /* DOS_FLX_OS2_W32 */ +#endif /* ?(AMIGA || UNIX) */ + while ((ch = *s) != '\0' && !ISspace(ch)) /* note else-clauses above */ + ++s; + while ((ch = *s) != '\0' && ISspace(ch)) + ++s; + } while (ch); + + return count; +} + + + +static void mem_err(__G) + __GDEF +{ + perror(LoadFarString(NoMemArguments)); + DESTROYGLOBALS() + EXIT(PK_MEM); +} + + + +#ifdef TEST + +main(argc, argv) + int argc; + char **argv; +{ + int i; + + pipeit("Orig argv: %p\n", argv); + dump_args(argc, argv); + envargs(__G__ &argc, &argv, "ENVTEST"); + pipeit(" New argv: %p\n", argv); + dump_args(argc, argv); +} + + + +dump_args(argc, argv) + int argc; + char *argv[]; +{ + int i; + + pipeit("\nDump %d args:\n", argc); + for (i = 0; i < argc; ++i) + pipeit("%3d %s\n", i, argv[i]); +} + +#endif /* TEST */ + + + +#ifdef MSDOS /* DOS_OS2? DOS_OS2_W32? */ + +/* + * void mksargs(int *argcp, char ***argvp) + * + * Substitutes the extended command line argument list produced by + * the MKS Korn Shell in place of the command line info from DOS. + * + * The MKS shell gets around DOS's 128-byte limit on the length of + * a command line by passing the "real" command line in the envi- + * ronment. The "real" arguments are flagged by prepending a tilde + * (~) to each one. + * + * This "mksargs" routine creates a new argument list by scanning + * the environment from the beginning, looking for strings begin- + * ning with a tilde character. The new list replaces the original + * "argv" (pointed to by "argvp"), and the number of arguments + * in the new list replaces the original "argc" (pointed to by + * "argcp"). + * + * Rich Wales + */ +void mksargs(argcp, argvp) + int *argcp; + char ***argvp; +{ +#ifndef MSC /* declared differently in MSC 7.0 headers, at least */ +#ifndef __WATCOMC__ + extern char **environ; /* environment */ +#endif +#endif + char **envp; /* pointer into environment */ + char **newargv; /* new argument list */ + char **argp; /* pointer into new arg list */ + int newargc; /* new argument count */ + + /* sanity check */ + if (environ == NULL || argcp == NULL || argvp == NULL || *argvp == NULL) + return; + + /* find out how many environment arguments there are */ + for (envp = environ, newargc = 0; *envp != NULL && (*envp)[0] == '~'; + envp++, newargc++) + ; + if (newargc == 0) + return; /* no environment arguments */ + + /* set up new argument list */ + newargv = (char **) malloc(sizeof(char **) * (newargc+1)); + if (newargv == NULL) + return; /* malloc failed */ + + for (argp = newargv, envp = environ; *envp != NULL && (*envp)[0] == '~'; + *argp++ = &(*envp++)[1]) + ; + *argp = NULL; /* null-terminate the list */ + + /* substitute new argument list in place of old one */ + *argcp = newargc; + *argvp = newargv; +} + +#endif /* MSDOS */ diff --git a/utils/Install/packzip/explode.c b/utils/Install/packzip/explode.c new file mode 100644 index 0000000000..c1a8f80032 --- /dev/null +++ b/utils/Install/packzip/explode.c @@ -0,0 +1,871 @@ +/* explode.c -- put in the public domain by Mark Adler + version c15, 6 July 1996 */ + + +/* You can do whatever you like with this source file, though I would + prefer that if you modify it and redistribute it that you include + comments to that effect with your name and the date. Thank you. + + History: + vers date who what + ---- --------- -------------- ------------------------------------ + c1 30 Mar 92 M. Adler explode that uses huft_build from inflate + (this gives over a 70% speed improvement + over the original unimplode.c, which + decoded a bit at a time) + c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k. + c3 10 Apr 92 M. Adler added a little memory tracking if DEBUG + c4 11 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy() + c5 21 Apr 92 M. Adler added the WSIZE #define to allow reducing + the 32K window size for specialized + applications. + c6 31 May 92 M. Adler added typecasts to eliminate some warnings + c7 27 Jun 92 G. Roelofs added more typecasts. + c8 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch. + c9 19 Jul 93 J. Bush added more typecasts (to return values); + made l[256] array static for Amiga. + c10 8 Oct 93 G. Roelofs added used_csize for diagnostics; added + buf and unshrink arguments to flush(); + undef'd various macros at end for Turbo C; + removed NEXTBYTE macro (now in unzip.h) + and bytebuf variable (not used); changed + memset() to memzero(). + c11 9 Jan 94 M. Adler fixed incorrect used_csize calculation. + c12 9 Apr 94 G. Roelofs fixed split comments on preprocessor lines + to avoid bug in Encore compiler. + c13 25 Aug 94 M. Adler fixed distance-length comment (orig c9 fix) + c14 22 Nov 95 S. Maxwell removed unnecessary "static" on auto array + c15 6 Jul 96 W. Haidinger added ulg typecasts to flush() calls. + c16 8 Feb 98 C. Spieler added ZCONST modifiers to const tables + and #ifdef DEBUG around debugging code. + c16b 25 Mar 98 C. Spieler modified DLL code for slide redirection. + */ + + +/* + Explode imploded (PKZIP method 6 compressed) data. This compression + method searches for as much of the current string of bytes (up to a length + of ~320) in the previous 4K or 8K bytes. If it doesn't find any matches + (of at least length 2 or 3), it codes the next byte. Otherwise, it codes + the length of the matched string and its distance backwards from the + current position. Single bytes ("literals") are preceded by a one (a + single bit) and are either uncoded (the eight bits go directly into the + compressed stream for a total of nine bits) or Huffman coded with a + supplied literal code tree. If literals are coded, then the minimum match + length is three, otherwise it is two. + + There are therefore four kinds of imploded streams: 8K search with coded + literals (min match = 3), 4K search with coded literals (min match = 3), + 8K with uncoded literals (min match = 2), and 4K with uncoded literals + (min match = 2). The kind of stream is identified in two bits of a + general purpose bit flag that is outside of the compressed stream. + + Distance-length pairs for matched strings are preceded by a zero bit (to + distinguish them from literals) and are always coded. The distance comes + first and is either the low six (4K) or low seven (8K) bits of the + distance (uncoded), followed by the high six bits of the distance coded. + Then the length is six bits coded (0..63 + min match length), and if the + maximum such length is coded, then it's followed by another eight bits + (uncoded) to be added to the coded length. This gives a match length + range of 2..320 or 3..321 bytes. + + The literal, length, and distance codes are all represented in a slightly + compressed form themselves. What is sent are the lengths of the codes for + each value, which is sufficient to construct the codes. Each byte of the + code representation is the code length (the low four bits representing + 1..16), and the number of values sequentially with that length (the high + four bits also representing 1..16). There are 256 literal code values (if + literals are coded), 64 length code values, and 64 distance code values, + in that order at the beginning of the compressed stream. Each set of code + values is preceded (redundantly) with a byte indicating how many bytes are + in the code description that follows, in the range 1..256. + + The codes themselves are decoded using tables made by huft_build() from + the bit lengths. That routine and its comments are in the inflate.c + module. + */ + +#define UNZIP_INTERNAL +#include "unzip.h" /* must supply slide[] (uch) array and NEXTBYTE macro */ + +#ifndef WSIZE +# define WSIZE 0x8000 /* window size--must be a power of two, and */ +#endif /* at least 8K for zip's implode method */ + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) +# define wsize G._wsize +#else +# define wsize WSIZE +#endif + +/* routines here */ +static int get_tree OF((__GPRO__ unsigned *l, unsigned n)); +static int explode_lit8 OF((__GPRO__ struct huft *tb, struct huft *tl, + struct huft *td, int bb, int bl, int bd)); +static int explode_lit4 OF((__GPRO__ struct huft *tb, struct huft *tl, + struct huft *td, int bb, int bl, int bd)); +static int explode_nolit8 OF((__GPRO__ struct huft *tl, struct huft *td, + int bl, int bd)); +static int explode_nolit4 OF((__GPRO__ struct huft *tl, struct huft *td, + int bl, int bd)); +int explode OF((__GPRO)); + + +/* The implode algorithm uses a sliding 4K or 8K byte window on the + uncompressed stream to find repeated byte strings. This is implemented + here as a circular buffer. The index is updated simply by incrementing + and then and'ing with 0x0fff (4K-1) or 0x1fff (8K-1). Here, the 32K + buffer of inflate is used, and it works just as well to always have + a 32K circular buffer, so the index is anded with 0x7fff. This is + done to allow the window to also be used as the output buffer. */ +/* This must be supplied in an external module useable like "uch slide[8192];" + or "uch *slide;", where the latter would be malloc'ed. In unzip, slide[] + is actually a 32K area for use by inflate, which uses a 32K sliding window. + */ + + +/* Tables for length and distance */ +static ZCONST ush cplen2[] = + {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65}; +static ZCONST ush cplen3[] = + {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66}; +static ZCONST ush extra[] = + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8}; +static ZCONST ush cpdist4[] = + {1, 65, 129, 193, 257, 321, 385, 449, 513, 577, 641, 705, + 769, 833, 897, 961, 1025, 1089, 1153, 1217, 1281, 1345, 1409, 1473, + 1537, 1601, 1665, 1729, 1793, 1857, 1921, 1985, 2049, 2113, 2177, + 2241, 2305, 2369, 2433, 2497, 2561, 2625, 2689, 2753, 2817, 2881, + 2945, 3009, 3073, 3137, 3201, 3265, 3329, 3393, 3457, 3521, 3585, + 3649, 3713, 3777, 3841, 3905, 3969, 4033}; +static ZCONST ush cpdist8[] = + {1, 129, 257, 385, 513, 641, 769, 897, 1025, 1153, 1281, + 1409, 1537, 1665, 1793, 1921, 2049, 2177, 2305, 2433, 2561, 2689, + 2817, 2945, 3073, 3201, 3329, 3457, 3585, 3713, 3841, 3969, 4097, + 4225, 4353, 4481, 4609, 4737, 4865, 4993, 5121, 5249, 5377, 5505, + 5633, 5761, 5889, 6017, 6145, 6273, 6401, 6529, 6657, 6785, 6913, + 7041, 7169, 7297, 7425, 7553, 7681, 7809, 7937, 8065}; + + +/* Macros for inflate() bit peeking and grabbing. + The usage is: + + NEEDBITS(j) + x = b & mask_bits[j]; + DUMPBITS(j) + + where NEEDBITS makes sure that b has at least j bits in it, and + DUMPBITS removes the bits from b. The macros use the variable k + for the number of bits in b. Normally, b and k are register + variables for speed. + */ + +#define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE)<<k;k+=8;}} +#define DUMPBITS(n) {b>>=(n);k-=(n);} + + + +static int get_tree(__G__ l, n) + __GDEF +unsigned *l; /* bit lengths */ +unsigned n; /* number expected */ +/* Get the bit lengths for a code representation from the compressed + stream. If get_tree() returns 4, then there is an error in the data. + Otherwise zero is returned. */ +{ + unsigned i; /* bytes remaining in list */ + unsigned k; /* lengths entered */ + unsigned j; /* number of codes */ + unsigned b; /* bit length for those codes */ + + + /* get bit lengths */ + i = NEXTBYTE + 1; /* length/count pairs to read */ + k = 0; /* next code */ + do { + b = ((j = NEXTBYTE) & 0xf) + 1; /* bits in code (1..16) */ + j = ((j & 0xf0) >> 4) + 1; /* codes with those bits (1..16) */ + if (k + j > n) + return 4; /* don't overflow l[] */ + do { + l[k++] = b; + } while (--j); + } while (--i); + return k != n ? 4 : 0; /* should have read n of them */ +} + + + +static int explode_lit8(__G__ tb, tl, td, bb, bl, bd) + __GDEF +struct huft *tb, *tl, *td; /* literal, length, and distance tables */ +int bb, bl, bd; /* number of bits decoded by those */ +/* Decompress the imploded data using coded literals and an 8K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned mb, ml, md; /* masks for bb, bl, and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + mb = mask_bits[bb]; /* precompute masks for speed */ + ml = mask_bits[bl]; + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--decode it */ + { + DUMPBITS(1) + s--; + NEEDBITS((unsigned)bb) /* get coded literal */ + if ((e = (t = tb + ((~(unsigned)b) & mb))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + redirSlide[w++] = (uch)t->v.n; + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(7) /* get distance low bits */ + d = (unsigned)b & 0x7f; + DUMPBITS(7) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { + /* &= w/ wsize not needed and wrong if redirect */ + if (d >= wsize) + return 1; + n -= (e = (e = wsize - (d > w ? d : w)) > n ? n : e); + } else +#endif + n -= (e = (e = wsize - ((d &= wsize-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memzero(redirSlide + w, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(__G__ redirSlide, (ulg)w, 0); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + G.used_csize = G.lrec.csize - G.csize - G.incnt - (k >> 3); + return 5; + } + return 0; +} + + + +static int explode_lit4(__G__ tb, tl, td, bb, bl, bd) + __GDEF +struct huft *tb, *tl, *td; /* literal, length, and distance tables */ +int bb, bl, bd; /* number of bits decoded by those */ +/* Decompress the imploded data using coded literals and a 4K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned mb, ml, md; /* masks for bb, bl, and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + mb = mask_bits[bb]; /* precompute masks for speed */ + ml = mask_bits[bl]; + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--decode it */ + { + DUMPBITS(1) + s--; + NEEDBITS((unsigned)bb) /* get coded literal */ + if ((e = (t = tb + ((~(unsigned)b) & mb))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + redirSlide[w++] = (uch)t->v.n; + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(6) /* get distance low bits */ + d = (unsigned)b & 0x3f; + DUMPBITS(6) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { + /* &= w/ wsize not needed and wrong if redirect */ + if (d >= wsize) + return 1; + n -= (e = (e = wsize - (d > w ? d : w)) > n ? n : e); + } else +#endif + n -= (e = (e = wsize - ((d &= wsize-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memzero(redirSlide + w, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(__G__ redirSlide, (ulg)w, 0); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + G.used_csize = G.lrec.csize - G.csize - G.incnt - (k >> 3); + return 5; + } + return 0; +} + + + +static int explode_nolit8(__G__ tl, td, bl, bd) + __GDEF +struct huft *tl, *td; /* length and distance decoder tables */ +int bl, bd; /* number of bits decoded by tl[] and td[] */ +/* Decompress the imploded data using uncoded literals and an 8K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--get eight bits */ + { + DUMPBITS(1) + s--; + NEEDBITS(8) + redirSlide[w++] = (uch)b; + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + DUMPBITS(8) + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(7) /* get distance low bits */ + d = (unsigned)b & 0x7f; + DUMPBITS(7) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { + /* &= w/ wsize not needed and wrong if redirect */ + if (d >= wsize) + return 1; + n -= (e = (e = wsize - (d > w ? d : w)) > n ? n : e); + } else +#endif + n -= (e = (e = wsize - ((d &= wsize-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memzero(redirSlide + w, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(__G__ redirSlide, (ulg)w, 0); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + G.used_csize = G.lrec.csize - G.csize - G.incnt - (k >> 3); + return 5; + } + return 0; +} + + + +static int explode_nolit4(__G__ tl, td, bl, bd) + __GDEF +struct huft *tl, *td; /* length and distance decoder tables */ +int bl, bd; /* number of bits decoded by tl[] and td[] */ +/* Decompress the imploded data using uncoded literals and a 4K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--get eight bits */ + { + DUMPBITS(1) + s--; + NEEDBITS(8) + redirSlide[w++] = (uch)b; + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + DUMPBITS(8) + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(6) /* get distance low bits */ + d = (unsigned)b & 0x3f; + DUMPBITS(6) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { + /* &= w/ wsize not needed and wrong if redirect */ + if (d >= wsize) + return 1; + n -= (e = (e = wsize - (d > w ? d : w)) > n ? n : e); + } else +#endif + n -= (e = (e = wsize - ((d &= wsize-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memzero(redirSlide + w, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(__G__ redirSlide, (ulg)w, 0); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + G.used_csize = G.lrec.csize - G.csize - G.incnt - (k >> 3); + return 5; + } + return 0; +} + + + +int explode(__G) + __GDEF +/* Explode an imploded compressed stream. Based on the general purpose + bit flag, decide on coded or uncoded literals, and an 8K or 4K sliding + window. Construct the literal (if any), length, and distance codes and + the tables needed to decode them (using huft_build() from inflate.c), + and call the appropriate routine for the type of data in the remainder + of the stream. The four routines are nearly identical, differing only + in whether the literal is decoded or simply read in, and in how many + bits are read in, uncoded, for the low distance bits. */ +{ + unsigned r; /* return codes */ + struct huft *tb; /* literal code table */ + struct huft *tl; /* length code table */ + struct huft *td; /* distance code table */ + int bb; /* bits for tb */ + int bl; /* bits for tl */ + int bd; /* bits for td */ + unsigned l[256]; /* bit lengths for codes */ + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) + wsize = G.redirect_size, redirSlide = G.redirect_buffer; + else + wsize = WSIZE, redirSlide = slide; +#endif + + /* Tune base table sizes. Note: I thought that to truly optimize speed, + I would have to select different bl, bd, and bb values for different + compressed file sizes. I was surprised to find out that the values of + 7, 7, and 9 worked best over a very wide range of sizes, except that + bd = 8 worked marginally better for large compressed sizes. */ + bl = 7; + bd = (G.csize + G.incnt) > 200000L ? 8 : 7; + + + /* With literal tree--minimum match length is 3 */ +#ifdef DEBUG + G.hufts = 0; /* initialize huft's malloc'ed */ +#endif + if (G.lrec.general_purpose_bit_flag & 4) + { + bb = 9; /* base table size for literals */ + if ((r = get_tree(__G__ l, 256)) != 0) + return (int)r; + if ((r = huft_build(__G__ l, 256, 256, NULL, NULL, &tb, &bb)) != 0) + { + if (r == 1) + huft_free(tb); + return (int)r; + } + if ((r = get_tree(__G__ l, 64)) != 0) + return (int)r; + if ((r = huft_build(__G__ l, 64, 0, cplen3, extra, &tl, &bl)) != 0) + { + if (r == 1) + huft_free(tl); + huft_free(tb); + return (int)r; + } + if ((r = get_tree(__G__ l, 64)) != 0) + return (int)r; + if (G.lrec.general_purpose_bit_flag & 2) /* true if 8K */ + { + if ((r = huft_build(__G__ l, 64, 0, cpdist8, extra, &td, &bd)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + huft_free(tb); + return (int)r; + } + r = explode_lit8(__G__ tb, tl, td, bb, bl, bd); + } + else /* else 4K */ + { + if ((r = huft_build(__G__ l, 64, 0, cpdist4, extra, &td, &bd)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + huft_free(tb); + return (int)r; + } + r = explode_lit4(__G__ tb, tl, td, bb, bl, bd); + } + huft_free(td); + huft_free(tl); + huft_free(tb); + } + else + + + /* No literal tree--minimum match length is 2 */ + { + if ((r = get_tree(__G__ l, 64)) != 0) + return (int)r; + if ((r = huft_build(__G__ l, 64, 0, cplen2, extra, &tl, &bl)) != 0) + { + if (r == 1) + huft_free(tl); + return (int)r; + } + if ((r = get_tree(__G__ l, 64)) != 0) + return (int)r; + if (G.lrec.general_purpose_bit_flag & 2) /* true if 8K */ + { + if ((r = huft_build(__G__ l, 64, 0, cpdist8, extra, &td, &bd)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + return (int)r; + } + r = explode_nolit8(__G__ tl, td, bl, bd); + } + else /* else 4K */ + { + if ((r = huft_build(__G__ l, 64, 0, cpdist4, extra, &td, &bd)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + return (int)r; + } + r = explode_nolit4(__G__ tl, td, bl, bd); + } + huft_free(td); + huft_free(tl); + } + Trace((stderr, "<%u > ", G.hufts)); + return (int)r; +} + +/* so explode.c and inflate.c can be compiled together into one object: */ +#undef NEXTBYTE +#undef NEEDBITS +#undef DUMPBITS diff --git a/utils/Install/packzip/extract.c b/utils/Install/packzip/extract.c new file mode 100644 index 0000000000..5fd2577c31 --- /dev/null +++ b/utils/Install/packzip/extract.c @@ -0,0 +1,1985 @@ +/*--------------------------------------------------------------------------- + + extract.c + + This file contains the high-level routines ("driver routines") for extrac- + ting and testing zipfile members. It calls the low-level routines in files + explode.c, inflate.c, unreduce.c and unshrink.c. + + Contains: extract_or_test_files() + store_info() + extract_or_test_member() + TestExtraField() + test_compr_eb() + memextract() + memflush() + fnfilter() + + ---------------------------------------------------------------------------*/ + + +#define EXTRACT_C +#define UNZIP_INTERNAL +#include "unzip.h" +#include "crypt.h" +#ifdef WINDLL +# ifdef POCKET_UNZIP +# include "wince/intrface.h" +# else +# include "windll/windll.h" +# endif +#endif + +#define GRRDUMP(buf,len) { \ + int i, j; \ + \ + for (j = 0; j < (len)/16; ++j) { \ + pipeit(" "); \ + for (i = 0; i < 16; ++i) \ + pipeit("%02x ", (uch)(buf)[i+(j<<4)]); \ + pipeit("\n "); \ + for (i = 0; i < 16; ++i) { \ + char c = (char)(buf)[i+(j<<4)]; \ + \ + if (c == '\n') \ + pipeit("\\n "); \ + else if (c == '\r') \ + pipeit("\\r "); \ + else \ + pipeit(" %c ", c); \ + } \ + pipeit("\n"); \ + } \ + if ((len) % 16) { \ + pipeit(" "); \ + for (i = j<<4; i < (len); ++i) \ + pipeit("%02x ", (uch)(buf)[i]); \ + pipeit("\n "); \ + for (i = j<<4; i < (len); ++i) { \ + char c = (char)(buf)[i]; \ + \ + if (c == '\n') \ + pipeit("\\n "); \ + else if (c == '\r') \ + pipeit("\\r "); \ + else \ + pipeit(" %c ", c); \ + } \ + pipeit("\n"); \ + } \ +} + +static int store_info OF((__GPRO)); +static int extract_or_test_member OF((__GPRO)); +#ifndef SFX + static int TestExtraField OF((__GPRO__ uch *ef, unsigned ef_len)); + static int test_compr_eb OF((__GPRO__ uch *eb, unsigned eb_size, + unsigned compr_offset, + int (*test_uc_ebdata)(__GPRO__ uch *eb, unsigned eb_size, + uch *eb_ucptr, ulg eb_ucsize))); +#endif +#ifdef SET_DIR_ATTRIB + static int dircomp OF((ZCONST zvoid *a, ZCONST zvoid *b)); +#endif + + + +/*******************************/ +/* Strings used in extract.c */ +/*******************************/ + +static ZCONST char Far VersionMsg[] = + " skipping: %-22s need %s compat. v%u.%u (can do v%u.%u)\n"; +static ZCONST char Far ComprMsgNum[] = + " skipping: %-22s unsupported compression method %u\n"; +#ifndef SFX + static ZCONST char Far ComprMsgName[] = + " skipping: %-22s `%s' method not supported\n"; + static ZCONST char Far CmprNone[] = "store"; + static ZCONST char Far CmprShrink[] = "shrink"; + static ZCONST char Far CmprReduce[] = "reduce"; + static ZCONST char Far CmprImplode[] = "implode"; + static ZCONST char Far CmprTokenize[] = "tokenize"; + static ZCONST char Far CmprDeflate[] = "deflate"; + static ZCONST char Far CmprEnDeflate[] = "enhanced deflate"; + static ZCONST char Far CmprDCLImplode[] = "DCL implode"; + static ZCONST char Far *ComprNames[NUM_METHODS] = { + CmprNone, CmprShrink, CmprReduce, CmprReduce, CmprReduce, CmprReduce, + CmprImplode, CmprTokenize, CmprDeflate, CmprEnDeflate, CmprDCLImplode + }; +#endif /* !SFX */ +static ZCONST char Far FilNamMsg[] = + "%s: bad filename length (%s)\n"; +static ZCONST char Far ExtFieldMsg[] = + "%s: bad extra field length (%s)\n"; +static ZCONST char Far OffsetMsg[] = + "file #%u: bad zipfile offset (%s): %ld\n"; +static ZCONST char Far ExtractMsg[] = + "%8sing: %-22s %s%s"; +#ifndef SFX + static ZCONST char Far LengthMsg[] = + "%s %s: %ld bytes required to uncompress to %lu bytes;\n %s\ + supposed to require %lu bytes%s%s%s\n"; +#endif + +static ZCONST char Far BadFileCommLength[] = "%s: bad file comment length\n"; +static ZCONST char Far LocalHdrSig[] = "local header sig"; +static ZCONST char Far BadLocalHdr[] = "file #%u: bad local header\n"; +static ZCONST char Far AttemptRecompensate[] = + " (attempting to re-compensate)\n"; +#ifndef SFX + static ZCONST char Far BackslashPathSep[] = + "warning: %s appears to use backslashes as path separators\n"; +#endif +static ZCONST char Far SkipVolumeLabel[] = + " skipping: %-22s %svolume label\n"; + +#ifdef SET_DIR_ATTRIB /* messages of code for setting directory attributes */ + static ZCONST char Far DirlistEntryNoMem[] = + "warning: cannot alloc memory for dir times/permissions/UID/GID\n"; + static ZCONST char Far DirlistSortNoMem[] = + "warning: cannot alloc memory to sort dir times/perms/etc.\n"; + static ZCONST char Far DirlistSetAttrFailed[] = + "warning: set times/attribs failed for %s\n"; +#endif + +#ifndef WINDLL + static ZCONST char Far ReplaceQuery[] = + "replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: "; + static ZCONST char Far AssumeNone[] = " NULL\n(assuming [N]one)\n"; + static ZCONST char Far NewNameQuery[] = "new name: "; + static ZCONST char Far InvalidResponse[] = "error: invalid response [%c]\n"; +#endif /* !WINDLL */ + +static ZCONST char Far ErrorInArchive[] = + "At least one %serror was detected in %s.\n"; +static ZCONST char Far ZeroFilesTested[] = + "Caution: zero files tested in %s.\n"; + +#ifndef VMS + static ZCONST char Far VMSFormatQuery[] = + "\n%s: stored in VMS format. Extract anyway? (y/n) "; +#endif + +#if CRYPT + static ZCONST char Far SkipCannotGetPasswd[] = + " skipping: %-22s unable to get password\n"; + static ZCONST char Far SkipIncorrectPasswd[] = + " skipping: %-22s incorrect password\n"; + static ZCONST char Far FilesSkipBadPasswd[] = + "%u file%s skipped because of incorrect password.\n"; + static ZCONST char Far MaybeBadPasswd[] = + " (may instead be incorrect password)\n"; +#else + static ZCONST char Far SkipEncrypted[] = + " skipping: %-22s encrypted (not supported)\n"; +#endif + +static ZCONST char Far NoErrInCompData[] = + "No errors detected in compressed data of %s.\n"; +static ZCONST char Far NoErrInTestedFiles[] = + "No errors detected in %s for the %u file%s tested.\n"; +static ZCONST char Far FilesSkipped[] = + "%u file%s skipped because of unsupported compression or encoding.\n"; + +static ZCONST char Far ErrUnzipFile[] = " error: %s%s %s\n"; +static ZCONST char Far ErrUnzipNoFile[] = "\n error: %s%s\n"; +static ZCONST char Far NotEnoughMem[] = "not enough memory to "; +static ZCONST char Far InvalidComprData[] = "invalid compressed data to "; +static ZCONST char Far Inflate[] = "inflate"; + +#ifndef SFX + static ZCONST char Far Explode[] = "explode"; +#ifndef LZW_CLEAN + static ZCONST char Far Unshrink[] = "unshrink"; +#endif +#endif + +#if (!defined(DELETE_IF_FULL) || !defined(HAVE_UNLINK)) + static ZCONST char Far FileTruncated[] = + "warning: %s is probably truncated\n"; +#endif + +static ZCONST char Far FileUnknownCompMethod[] = + "%s: unknown compression method\n"; +static ZCONST char Far BadCRC[] = " bad CRC %08lx (should be %08lx)\n"; + + /* TruncEAs[] also used in OS/2 mapname(), close_outfile() */ +char ZCONST Far TruncEAs[] = " compressed EA data missing (%d bytes)%s"; +char ZCONST Far TruncNTSD[] = + " compressed WinNT security data missing (%d bytes)%s"; + +#ifndef SFX + static ZCONST char Far InconsistEFlength[] = "bad extra-field entry:\n \ + EF block length (%u bytes) exceeds remaining EF data (%u bytes)\n"; + static ZCONST char Far InvalidComprDataEAs[] = + " invalid compressed data for EAs\n"; +# if (defined(WIN32) && defined(NTSD_EAS)) + static ZCONST char Far InvalidSecurityEAs[] = + " EAs fail security check\n"; +# endif + static ZCONST char Far UnsuppNTSDVersEAs[] = + " unsupported NTSD EAs version %d\n"; + static ZCONST char Far BadCRC_EAs[] = " bad CRC for extended attributes\n"; + static ZCONST char Far UnknComprMethodEAs[] = + " unknown compression method for EAs (%u)\n"; + static ZCONST char Far NotEnoughMemEAs[] = + " out of memory while inflating EAs\n"; + static ZCONST char Far UnknErrorEAs[] = + " unknown error on extended attributes\n"; +#endif /* !SFX */ + +static ZCONST char Far UnsupportedExtraField[] = + "\nerror: unsupported extra-field compression type (%u)--skipping\n"; +static ZCONST char Far BadExtraFieldCRC[] = + "error [%s]: bad extra-field CRC %08lx (should be %08lx)\n"; + + + + + +/**************************************/ +/* Function extract_or_test_files() */ +/**************************************/ + +int extract_or_test_files(__G) /* return PK-type error code */ + __GDEF +{ + uch *cd_inptr; + unsigned i, j, filnum=0, blknum=0; + int cd_incnt, renamed, query; + int error, error_in_archive=PK_COOL, *fn_matched=NULL, *xn_matched=NULL; +#ifdef WINDLL + int done_once = 0; +#else + extent len; +#endif + unsigned members_remaining, num_skipped=0, num_bad_pwd=0; + long cd_bufstart, bufstart, inbuf_offset, request; + LONGINT old_extra_bytes = 0L; +#ifdef SET_DIR_ATTRIB + unsigned num_dirs=0; + dirtime *dirlist=(dirtime *)NULL, **sorted_dirlist=(dirtime **)NULL; +#endif + + +/*--------------------------------------------------------------------------- + The basic idea of this function is as follows. Since the central di- + rectory lies at the end of the zipfile and the member files lie at the + beginning or middle or wherever, it is not very desirable to simply + read a central directory entry, jump to the member and extract it, and + then jump back to the central directory. In the case of a large zipfile + this would lead to a whole lot of disk-grinding, especially if each mem- + ber file is small. Instead, we read from the central directory the per- + tinent information for a block of files, then go extract/test the whole + block. Thus this routine contains two small(er) loops within a very + large outer loop: the first of the small ones reads a block of files + from the central directory; the second extracts or tests each file; and + the outer one loops over blocks. There's some file-pointer positioning + stuff in between, but that's about it. Btw, it's because of this jump- + ing around that we can afford to be lenient if an error occurs in one of + the member files: we should still be able to go find the other members, + since we know the offset of each from the beginning of the zipfile. + ---------------------------------------------------------------------------*/ + + G.pInfo = G.info; + members_remaining = (unsigned)G.ecrec.total_entries_central_dir; + +#if CRYPT + G.newzip = TRUE; +#endif +#ifndef SFX + G.reported_backslash = FALSE; +#endif + + /* malloc space for check on unmatched filespecs (OK if one or both NULL) */ + if (G.filespecs > 0 && + (fn_matched=(int *)malloc(G.filespecs*sizeof(int))) != (int *)NULL) + for (i = 0; i < G.filespecs; ++i) + fn_matched[i] = FALSE; + if (G.xfilespecs > 0 && + (xn_matched=(int *)malloc(G.xfilespecs*sizeof(int))) != (int *)NULL) + for (i = 0; i < G.xfilespecs; ++i) + xn_matched[i] = FALSE; + +/*--------------------------------------------------------------------------- + Begin main loop over blocks of member files. We know the entire central + directory is on this disk: we would not have any of this information un- + less the end-of-central-directory record was on this disk, and we would + not have gotten to this routine unless this is also the disk on which + the central directory starts. In practice, this had better be the ONLY + disk in the archive, but we'll add multi-disk support soon. + ---------------------------------------------------------------------------*/ + + while (members_remaining) { + j = 0; +#ifdef AMIGA + memzero(G.filenotes, DIR_BLKSIZ * sizeof(char *)); +#endif + + /* + * Loop through files in central directory, storing offsets, file + * attributes, case-conversion and text-conversion flags until block + * size is reached. + */ + + while (members_remaining && (j < DIR_BLKSIZ)) { + --members_remaining; + G.pInfo = &G.info[j]; + + if (readbuf(__G__ G.sig, 4) == 0) { + error_in_archive = PK_EOF; + members_remaining = 0; /* ...so no more left to do */ + break; + } + if (strncmp(G.sig, central_hdr_sig, 4)) { /* just to make sure */ + Info(slide, 0x401, ((char *)slide, LoadFarString(CentSigMsg), + j + blknum*DIR_BLKSIZ + 1)); + Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg))); + error_in_archive = PK_BADERR; + members_remaining = 0; /* ...so no more left to do */ + break; + } + /* process_cdir_file_hdr() sets pInfo->hostnum, pInfo->lcflag */ + if ((error = process_cdir_file_hdr(__G)) != PK_COOL) { + error_in_archive = error; /* only PK_EOF defined */ + members_remaining = 0; /* ...so no more left to do */ + break; + } + if ((error = do_string(__G__ G.crec.filename_length, DS_FN)) != + PK_COOL) + { + if (error > error_in_archive) + error_in_archive = error; + if (error > PK_WARN) { /* fatal: no more left to do */ + Info(slide, 0x401, ((char *)slide, LoadFarString(FilNamMsg), + FnFilter1(G.filename), "central")); + members_remaining = 0; + break; + } + } + if ((error = do_string(__G__ G.crec.extra_field_length, + EXTRA_FIELD)) != 0) + { + if (error > error_in_archive) + error_in_archive = error; + if (error > PK_WARN) { /* fatal */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(ExtFieldMsg), + FnFilter1(G.filename), "central")); + members_remaining = 0; + break; + } + } +#ifdef AMIGA + G.filenote_slot = j; + if ((error = do_string(__G__ G.crec.file_comment_length, + uO.N_flag ? FILENOTE : SKIP)) != PK_COOL) +#else + if ((error = do_string(__G__ G.crec.file_comment_length, SKIP)) + != PK_COOL) +#endif + { + if (error > error_in_archive) + error_in_archive = error; + if (error > PK_WARN) { /* fatal */ + Info(slide, 0x421, ((char *)slide, + LoadFarString(BadFileCommLength), + FnFilter1(G.filename))); + members_remaining = 0; + break; + } + } + if (G.process_all_files) { + if (store_info(__G)) + ++j; /* file is OK; info[] stored; continue with next */ + else + ++num_skipped; + } else { + int do_this_file; + + if (G.filespecs == 0) + do_this_file = TRUE; + else { /* check if this entry matches an `include' argument */ + do_this_file = FALSE; + for (i = 0; i < G.filespecs; i++) + if (match(G.filename, G.pfnames[i], uO.C_flag)) { + do_this_file = TRUE; /* ^-- ignore case or not? */ + if (fn_matched) + fn_matched[i] = TRUE; + break; /* found match, so stop looping */ + } + } + if (do_this_file) { /* check if this is an excluded file */ + for (i = 0; i < G.xfilespecs; i++) + if (match(G.filename, G.pxnames[i], uO.C_flag)) { + do_this_file = FALSE; /* ^-- ignore case or not? */ + if (xn_matched) + xn_matched[i] = TRUE; + break; + } + } + if (do_this_file) { + if (store_info(__G)) + ++j; /* file is OK */ + else + ++num_skipped; /* unsupp. compression or encryption */ + } + } /* end if (process_all_files) */ + + + } /* end while-loop (adding files to current block) */ + + /* save position in central directory so can come back later */ + cd_bufstart = G.cur_zipfile_bufstart; + cd_inptr = G.inptr; + cd_incnt = G.incnt; + + /*----------------------------------------------------------------------- + Second loop: process files in current block, extracting or testing + each one. + -----------------------------------------------------------------------*/ + + for (i = 0; i < j; ++i) { + filnum++; /* filnum = i + blknum*DIR_BLKSIZ + 1; */ + G.pInfo = &G.info[i]; +#ifdef NOVELL_BUG_FAILSAFE + G.dne = FALSE; /* assume file exists until stat() says otherwise */ +#endif + + /* if the target position is not within the current input buffer + * (either haven't yet read far enough, or (maybe) skipping back- + * ward), skip to the target position and reset readbuf(). */ + + /* ZLSEEK(pInfo->offset): */ + request = G.pInfo->offset + G.extra_bytes; + inbuf_offset = request % INBUFSIZ; + bufstart = request - inbuf_offset; + + Trace((stderr, "\ndebug: request = %ld, inbuf_offset = %ld\n", + request, inbuf_offset)); + Trace((stderr, + "debug: bufstart = %ld, cur_zipfile_bufstart = %ld\n", + bufstart, G.cur_zipfile_bufstart)); + if (request < 0) { + Info(slide, 0x401, ((char *)slide, LoadFarStringSmall(SeekMsg), + G.zipfn, LoadFarString(ReportMsg))); + error_in_archive = PK_ERR; + if (filnum == 1 && G.extra_bytes != 0L) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(AttemptRecompensate))); + old_extra_bytes = G.extra_bytes; + G.extra_bytes = 0L; + request = G.pInfo->offset; /* could also check if != 0 */ + inbuf_offset = request % INBUFSIZ; + bufstart = request - inbuf_offset; + Trace((stderr, "debug: request = %ld, inbuf_offset = %ld\n", + request, inbuf_offset)); + Trace((stderr, + "debug: bufstart = %ld, cur_zipfile_bufstart = %ld\n", + bufstart, G.cur_zipfile_bufstart)); + } else { + error_in_archive = PK_BADERR; + continue; /* this one hosed; try next */ + } + } + /* try again */ + if (request < 0) { + Trace((stderr, "debug: recompensated request still < 0\n")); + Info(slide, 0x401, ((char *)slide, LoadFarStringSmall(SeekMsg), + G.zipfn, LoadFarString(ReportMsg))); + error_in_archive = PK_BADERR; + continue; + } else if (bufstart != G.cur_zipfile_bufstart) { + Trace((stderr, "debug: bufstart != cur_zipfile_bufstart\n")); +#ifdef USE_STRM_INPUT + fseek((FILE *)G.zipfd,(LONGINT)bufstart,SEEK_SET); + G.cur_zipfile_bufstart = ftell((FILE *)G.zipfd); +#else /* !USE_STRM_INPUT */ + G.cur_zipfile_bufstart = + lseek(G.zipfd,(LONGINT)bufstart,SEEK_SET); +#endif /* ?USE_STRM_INPUT */ + if ((G.incnt = read(G.zipfd,(char *)G.inbuf,INBUFSIZ)) <= 0) + { + Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg), + filnum, "lseek", bufstart)); + error_in_archive = PK_BADERR; + continue; /* can still do next file */ + } + G.inptr = G.inbuf + (int)inbuf_offset; + G.incnt -= (int)inbuf_offset; + } else { + G.incnt += (int)(G.inptr-G.inbuf) - (int)inbuf_offset; + G.inptr = G.inbuf + (int)inbuf_offset; + } + + /* should be in proper position now, so check for sig */ + if (readbuf(__G__ G.sig, 4) == 0) { /* bad offset */ + Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg), + filnum, "EOF", request)); + error_in_archive = PK_BADERR; + continue; /* but can still try next one */ + } + if (strncmp(G.sig, local_hdr_sig, 4)) { + Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg), + filnum, LoadFarStringSmall(LocalHdrSig), request)); + /* + GRRDUMP(G.sig, 4) + GRRDUMP(local_hdr_sig, 4) + */ + error_in_archive = PK_ERR; + if ((filnum == 1 && G.extra_bytes != 0L) || + (G.extra_bytes == 0L && old_extra_bytes != 0L)) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(AttemptRecompensate))); + if (G.extra_bytes) { + old_extra_bytes = G.extra_bytes; + G.extra_bytes = 0L; + } else + G.extra_bytes = old_extra_bytes; /* third attempt */ + ZLSEEK(G.pInfo->offset) + if (readbuf(__G__ G.sig, 4) == 0) { /* bad offset */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(OffsetMsg), filnum, "EOF", request)); + error_in_archive = PK_BADERR; + continue; /* but can still try next one */ + } + if (strncmp(G.sig, local_hdr_sig, 4)) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(OffsetMsg), filnum, + LoadFarStringSmall(LocalHdrSig), request)); + error_in_archive = PK_BADERR; + continue; + } + } else + continue; /* this one hosed; try next */ + } + if ((error = process_local_file_hdr(__G)) != PK_COOL) { + Info(slide, 0x421, ((char *)slide, LoadFarString(BadLocalHdr), + filnum)); + error_in_archive = error; /* only PK_EOF defined */ + continue; /* can still try next one */ + } + if ((error = do_string(__G__ G.lrec.filename_length, DS_FN)) != + PK_COOL) + { + if (error > error_in_archive) + error_in_archive = error; + if (error > PK_WARN) { + Info(slide, 0x401, ((char *)slide, LoadFarString(FilNamMsg), + FnFilter1(G.filename), "local")); + continue; /* go on to next one */ + } + } + if (G.extra_field != (uch *)NULL) { + free(G.extra_field); + G.extra_field = (uch *)NULL; + } + if ((error = + do_string(__G__ G.lrec.extra_field_length, EXTRA_FIELD)) != 0) + { + if (error > error_in_archive) + error_in_archive = error; + if (error > PK_WARN) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(ExtFieldMsg), + FnFilter1(G.filename), "local")); + continue; /* go on */ + } + } + +#if CRYPT + if (G.pInfo->encrypted && + (error = decrypt(__G__ uO.pwdarg)) != PK_COOL) { + if (error == PK_WARN) { + if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) + Info(slide, 0x401, ((char *)slide, + LoadFarString(SkipIncorrectPasswd), + FnFilter1(G.filename))); + ++num_bad_pwd; + } else { /* (error > PK_WARN) */ + if (error > error_in_archive) + error_in_archive = error; + Info(slide, 0x401, ((char *)slide, + LoadFarString(SkipCannotGetPasswd), + FnFilter1(G.filename))); + } + continue; /* go on to next file */ + } +#endif /* CRYPT */ + + /* + * just about to extract file: if extracting to disk, check if + * already exists, and if so, take appropriate action according to + * fflag/uflag/overwrite_all/etc. (we couldn't do this in upper + * loop because we don't store the possibly renamed filename[] in + * info[]) + */ +#ifdef DLL + if (!uO.tflag && !uO.cflag && !G.redirect_data) +#else + if (!uO.tflag && !uO.cflag) +#endif + { + renamed = FALSE; /* user hasn't renamed output file yet */ + +startover: + query = FALSE; + /* for files from DOS FAT, check for use of backslash instead + * of slash as directory separator (bug in some zipper(s); so + * far, not a problem in HPFS, NTFS or VFAT systems) + */ +#ifndef SFX + if (G.pInfo->hostnum == FS_FAT_ && !strchr(G.filename, '/')) { + char *p=G.filename-1; + + while (*++p) { + if (*p == '\\') { + if (!G.reported_backslash) { + Info(slide, 0x21, ((char *)slide, + LoadFarString(BackslashPathSep), G.zipfn)); + G.reported_backslash = TRUE; + if (!error_in_archive) + error_in_archive = PK_WARN; + } + *p = '/'; + } + } + } +#endif /* !SFX */ + + /* mapname can create dirs if not freshening or if renamed */ + if ((error = mapname(__G__ renamed)) > PK_WARN) { + if (error == IZ_CREATED_DIR) { +#ifdef SET_DIR_ATTRIB + dirtime *d_entry; + + d_entry = (dirtime *)malloc(sizeof(dirtime)); + if (d_entry == (dirtime *)NULL) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(DirlistEntryNoMem))); + } else { + unsigned eb_izux_flg; + + d_entry->next = dirlist; + dirlist = d_entry; + dirlist->fn = + (char *)malloc(strlen(G.filename) + 1); + if (dirlist->fn == (char *)NULL) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(DirlistEntryNoMem))); + dirlist = d_entry->next; + free(d_entry); + if (!error_in_archive) + error_in_archive = PK_WARN; + continue; + } + strcpy(dirlist->fn, G.filename); + dirlist->perms = G.pInfo->file_attr; +#ifdef USE_EF_UT_TIME + eb_izux_flg = G.extra_field? ef_scan_for_izux( + G.extra_field, G.lrec.extra_field_length, 0, + G.lrec.last_mod_dos_datetime, +#ifdef IZ_CHECK_TZ + (G.tz_is_valid ? &(dirlist->u.t3) : NULL), +#else + &(dirlist->u.t3), +#endif + dirlist->uidgid) + : 0; +#else /* !USE_EF_UT_TIME */ + eb_izux_flg = 0; +#endif /* ?USE_EF_UT_TIME */ + if (eb_izux_flg & EB_UT_FL_MTIME) { + TTrace((stderr, + "\nextract: Unix dir e.f. modtime = %ld\n", + dirlist->u.t3.mtime)); + } else { + dirlist->u.t3.mtime = dos_to_unix_time( + G.lrec.last_mod_dos_datetime); + } + if (eb_izux_flg & EB_UT_FL_ATIME) { + TTrace((stderr, + "\nextract: Unix dir e.f. actime = %ld\n", + dirlist->u.t3.atime)); + } else { + dirlist->u.t3.atime = + dirlist->u.t3.mtime; + } + dirlist->have_uidgid = + (uO.X_flag && (eb_izux_flg & EB_UX2_VALID)); + ++num_dirs; + } +#endif /* SET_DIR_ATTRIB */ + } else if (error == IZ_VOL_LABEL) { +#ifdef DOS_OS2_W32 + Info(slide, 0x401, ((char *)slide, + LoadFarString(SkipVolumeLabel), + FnFilter1(G.filename), + uO.volflag? "hard disk " : "")); +#else + Info(slide, 1, ((char *)slide, + LoadFarString(SkipVolumeLabel), + FnFilter1(G.filename), "")); +#endif + /* if (!error_in_archive) + error_in_archive = PK_WARN; */ + } else if (error > PK_ERR && error_in_archive < PK_ERR) + error_in_archive = PK_ERR; + Trace((stderr, "mapname(%s) returns error = %d\n", + FnFilter1(G.filename), error)); + continue; /* go on to next file */ + } + +#ifdef QDOS + QFilename(__G__ G.filename); +#endif + switch (check_for_newer(__G__ G.filename)) { + case DOES_NOT_EXIST: +#ifdef NOVELL_BUG_FAILSAFE + G.dne = TRUE; /* stat() says file DOES NOT EXIST */ +#endif + /* if freshening, don't skip if just renamed */ + if (uO.fflag && !renamed) + continue; /* freshen (no new files): skip */ + break; + case EXISTS_AND_OLDER: + if (uO.overwrite_none) { +#ifdef WINDLL + char szStr[FILNAMSIZ+40]; /* add. space for text */ + + if ((!G.prompt_always) || (done_once)) { + sprintf(szStr, + "Target file exists.\nSkipping %s\n", + FnFilter1(G.filename)); + win_fprintf((zvoid *)&G, stdout, + strlen(szStr), szStr); + } else { + query = TRUE; + break; + } +#endif /* WINDLL */ + continue; /* never overwrite: skip file */ + } +#ifdef UNIXBACKUP + if (!uO.overwrite_all && !uO.B_flag) +#else + if (!uO.overwrite_all) +#endif + query = TRUE; + break; + case EXISTS_AND_NEWER: /* (or equal) */ + if (uO.overwrite_none || (uO.uflag && !renamed)) { +#ifdef WINDLL + char szStr[FILNAMSIZ+40]; /* add. space for text */ + + if ((!G.prompt_always) || (done_once)) { + sprintf(szStr, + "Target file newer.\nSkipping %s\n", + FnFilter1(G.filename)); + win_fprintf((zvoid *)&G, stdout, + strlen(szStr), szStr); + } else { + query = TRUE; + break; + } +#endif /* WINDLL */ + continue; /* skip if update/freshen & orig name */ + } +#ifdef UNIXBACKUP + if (!uO.overwrite_all && !uO.B_flag) +#else + if (!uO.overwrite_all) +#endif + query = TRUE; + break; + } + if (query) { +#ifdef WINDLL + switch (G.lpUserFunctions->replace != NULL ? + (*G.lpUserFunctions->replace)(G.filename) : + IDM_REPLACE_NONE) { + case IDM_REPLACE_RENAME: + _ISO_INTERN(G.filename); + renamed = TRUE; + goto startover; + case IDM_REPLACE_YES: + break; + case IDM_REPLACE_ALL: + uO.overwrite_all = TRUE; + uO.overwrite_none = FALSE; /* just to make sure */ + break; + case IDM_REPLACE_NONE: + uO.overwrite_none = TRUE; + uO.overwrite_all = FALSE; /* make sure */ + done_once = TRUE; + /* FALL THROUGH, skip */ + case IDM_REPLACE_NO: + { + char szStr[FILNAMSIZ+40]; + + sprintf(szStr, + "Target file newer.\nSkipping %s\n", + FnFilter1(G.filename)); + win_fprintf((zvoid *)&G, stdout, + strlen(szStr), szStr); + } + continue; + } +#else /* !WINDLL */ +reprompt: + Info(slide, 0x81, ((char *)slide, + LoadFarString(ReplaceQuery), + FnFilter1(G.filename))); + if (fgets(G.answerbuf, 9, stdin) == (char *)NULL) { + Info(slide, 1, ((char *)slide, + LoadFarString(AssumeNone))); + *G.answerbuf = 'N'; + if (!error_in_archive) + error_in_archive = 1; /* not extracted: warning */ + } + switch (*G.answerbuf) { + case 'A': /* dangerous option: force caps */ + uO.overwrite_all = TRUE; + uO.overwrite_none = FALSE; /* just to make sure */ + break; + case 'r': + case 'R': + do { + Info(slide, 0x81, ((char *)slide, + LoadFarString(NewNameQuery))); + fgets(G.filename, FILNAMSIZ, stdin); + /* usually get \n here: better check for it */ + len = strlen(G.filename); + if (G.filename[len-1] == '\n') + G.filename[--len] = '\0'; + } while (len == 0); +#ifdef WIN32 /* WIN32 fgets( ... , stdin) returns OEM coded strings */ + _OEM_INTERN(G.filename); +#endif + renamed = TRUE; + goto startover; /* sorry for a goto */ + case 'y': + case 'Y': + break; + case 'N': + uO.overwrite_none = TRUE; + uO.overwrite_all = FALSE; /* make sure */ + /* FALL THROUGH, skip */ + case 'n': + continue; /* skip file */ + default: + Info(slide, 1, ((char *)slide, + LoadFarString(InvalidResponse), *G.answerbuf)); + goto reprompt; /* yet another goto? */ + } /* end switch (*answerbuf) */ +#endif /* ?WINDLL */ + } /* end if (query) */ + } /* end if (extracting to disk) */ + +#ifdef DLL + if ((G.statreportcb != NULL) && + (*G.statreportcb)(__G__ UZ_ST_START_EXTRACT, G.zipfn, + G.filename, NULL)) { + if (fn_matched) + free((zvoid *)fn_matched); + if (xn_matched) + free((zvoid *)xn_matched); + return IZ_CTRLC; /* cancel operation by user request */ + } +#endif +#ifdef MACOS /* MacOS is no preemptive OS, thus call event-handling by hand */ + UserStop(); +#endif +#ifdef AMIGA + G.filenote_slot = i; +#endif + G.disk_full = 0; + if ((error = extract_or_test_member(__G)) != PK_COOL) { + if (error > error_in_archive) + error_in_archive = error; /* ...and keep going */ +#ifdef DLL + if (G.disk_full > 1 || error_in_archive == IZ_CTRLC) { +#else + if (G.disk_full > 1) { +#endif + if (fn_matched) + free((zvoid *)fn_matched); + if (xn_matched) + free((zvoid *)xn_matched); + return error_in_archive; /* (unless disk full) */ + } + } +#ifdef DLL + if ((G.statreportcb != NULL) && + (*G.statreportcb)(__G__ UZ_ST_FINISH_MEMBER, G.zipfn, + G.filename, (zvoid *)&G.lrec.ucsize)) { + if (fn_matched) + free((zvoid *)fn_matched); + if (xn_matched) + free((zvoid *)xn_matched); + return IZ_CTRLC; /* cancel operation by user request */ + } +#endif +#ifdef MACOS /* MacOS is no preemptive OS, thus call event-handling by hand */ + UserStop(); +#endif + } /* end for-loop (i: files in current block) */ + + + /* + * Jump back to where we were in the central directory, then go and do + * the next batch of files. + */ + +#ifdef USE_STRM_INPUT + fseek((FILE *)G.zipfd, (LONGINT)cd_bufstart, SEEK_SET); + G.cur_zipfile_bufstart = ftell((FILE *)G.zipfd); +#else /* !USE_STRM_INPUT */ + G.cur_zipfile_bufstart = lseek(G.zipfd,(LONGINT)cd_bufstart,SEEK_SET); +#endif /* ?USE_STRM_INPUT */ + read(G.zipfd, (char *)G.inbuf, INBUFSIZ); /* been here before... */ + G.inptr = cd_inptr; + G.incnt = cd_incnt; + ++blknum; + +#ifdef TEST + pipeit("\ncd_bufstart = %ld (%.8lXh)\n", cd_bufstart, cd_bufstart); + pipeit("cur_zipfile_bufstart = %ld (%.8lXh)\n", cur_zipfile_bufstart, + cur_zipfile_bufstart); + pipeit("inptr-inbuf = %d\n", G.inptr-G.inbuf); + pipeit("incnt = %d\n\n", G.incnt); +#endif + + } /* end while-loop (blocks of files in central directory) */ + +/*--------------------------------------------------------------------------- + Go back through saved list of directories, sort and set times/perms/UIDs + and GIDs from the deepest level on up. + ---------------------------------------------------------------------------*/ + +#ifdef SET_DIR_ATTRIB + if (num_dirs > 0) { + sorted_dirlist = (dirtime **)malloc(num_dirs*sizeof(dirtime *)); + if (sorted_dirlist == (dirtime **)NULL) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(DirlistSortNoMem))); + while (dirlist != (dirtime *)NULL) { + dirtime *d = dirlist; + + dirlist = dirlist->next; + free(d); + } + } else { + if (num_dirs == 1) + sorted_dirlist[0] = dirlist; + else { + for (i = 0; i < num_dirs; ++i) { + sorted_dirlist[i] = dirlist; + dirlist = dirlist->next; + } + qsort((char *)sorted_dirlist, num_dirs, sizeof(dirtime *), + dircomp); + } + + Trace((stderr, "setting directory times/perms/attributes\n")); + for (i = 0; i < num_dirs; ++i) { + dirtime *d = sorted_dirlist[i]; + + Trace((stderr, "dir = %s\n", d->fn)); + if ((error = set_direc_attribs(__G__ d)) != PK_OK) { + Info(slide, 0x201, ((char *)slide, + LoadFarString(DirlistSetAttrFailed), d->fn)); + if (!error_in_archive) + error_in_archive = error; + } + free(d->fn); + free(d); + } + free(sorted_dirlist); + } + } +#endif /* SET_DIR_ATTRIB */ + +#if (defined(WIN32) && defined(NTSD_EAS)) + process_defer_NT(__G); /* process any deferred items for this .zip file */ +#endif + +/*--------------------------------------------------------------------------- + Check for unmatched filespecs on command line and print warning if any + found. Free allocated memory. + ---------------------------------------------------------------------------*/ + + if (fn_matched) { + for (i = 0; i < G.filespecs; ++i) + if (!fn_matched[i]) { +#ifdef DLL + if (!G.redirect_data && !G.redirect_text) + Info(slide, 0x401, ((char *)slide, + LoadFarString(FilenameNotMatched), G.pfnames[i])); + else + setFileNotFound(__G); +#else + Info(slide, 1, ((char *)slide, + LoadFarString(FilenameNotMatched), G.pfnames[i])); +#endif + if (error_in_archive <= PK_WARN) + error_in_archive = PK_FIND; /* some files not found */ + } + free((zvoid *)fn_matched); + } + if (xn_matched) { + for (i = 0; i < G.xfilespecs; ++i) + if (!xn_matched[i]) + Info(slide, 0x401, ((char *)slide, + LoadFarString(ExclFilenameNotMatched), G.pxnames[i])); + free((zvoid *)xn_matched); + } + +/*--------------------------------------------------------------------------- + Double-check that we're back at the end-of-central-directory record, and + print quick summary of results, if we were just testing the archive. We + send the summary to stdout so that people doing the testing in the back- + ground and redirecting to a file can just do a "tail" on the output file. + ---------------------------------------------------------------------------*/ + +#ifndef SFX + if (readbuf(__G__ G.sig, 4) == 0) + error_in_archive = PK_EOF; + if (strncmp(G.sig, end_central_sig, 4)) { /* just to make sure */ + Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg))); + Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg))); + if (!error_in_archive) /* don't overwrite stronger error */ + error_in_archive = PK_WARN; + } +#endif /* !SFX */ + if (uO.tflag) { + unsigned num = filnum - num_bad_pwd; + + if (uO.qflag < 2) { /* GRR 930710: was (uO.qflag == 1) */ + if (error_in_archive) + Info(slide, 0, ((char *)slide, LoadFarString(ErrorInArchive), + (error_in_archive == 1)? "warning-" : "", G.zipfn)); + else if (num == 0) + Info(slide, 0, ((char *)slide, LoadFarString(ZeroFilesTested), + G.zipfn)); + else if (G.process_all_files && (num_skipped+num_bad_pwd == 0)) + Info(slide, 0, ((char *)slide, LoadFarString(NoErrInCompData), + G.zipfn)); + else + Info(slide, 0, ((char *)slide, LoadFarString(NoErrInTestedFiles) + , G.zipfn, num, (num==1)? "":"s")); + if (num_skipped > 0) + Info(slide, 0, ((char *)slide, LoadFarString(FilesSkipped), + num_skipped, (num_skipped==1)? "":"s")); +#if CRYPT + if (num_bad_pwd > 0) + Info(slide, 0, ((char *)slide, LoadFarString(FilesSkipBadPasswd) + , num_bad_pwd, (num_bad_pwd==1)? "":"s")); +#endif /* CRYPT */ + } else if ((uO.qflag == 0) && !error_in_archive && (num == 0)) + Info(slide, 0, ((char *)slide, LoadFarString(ZeroFilesTested), + G.zipfn)); + } + + /* give warning if files not tested or extracted (first condition can still + * happen if zipfile is empty and no files specified on command line) */ + + if ((filnum == 0) && error_in_archive <= PK_WARN) { + if (num_skipped > 0) + error_in_archive = IZ_UNSUP; /* unsupport. compression/encryption */ + else + error_in_archive = PK_FIND; /* no files found at all */ + } +#if CRYPT + else if ((filnum == num_bad_pwd) && error_in_archive <= PK_WARN) + error_in_archive = IZ_BADPWD; /* bad passwd => all files skipped */ +#endif + else if ((num_skipped > 0) && error_in_archive <= PK_WARN) + error_in_archive = IZ_UNSUP; /* was PK_WARN; Jean-loup complained */ +#if CRYPT + else if ((num_bad_pwd > 0) && !error_in_archive) + error_in_archive = PK_WARN; +#endif + + return error_in_archive; + +} /* end function extract_or_test_files() */ + + + + + +/***************************/ +/* Function store_info() */ +/***************************/ + +static int store_info(__G) /* return 0 if skipping, 1 if OK */ + __GDEF +{ +#ifdef SFX +# define UNKN_COMPR \ + (G.crec.compression_method!=STORED && G.crec.compression_method!=DEFLATED) +#else +# ifdef COPYRIGHT_CLEAN /* no reduced files */ +# define UNKN_RED (G.crec.compression_method >= REDUCED1 && \ + G.crec.compression_method <= REDUCED4) +# else +# define UNKN_RED FALSE /* reducing not unknown */ +# endif +# ifdef LZW_CLEAN /* no shrunk files */ +# define UNKN_SHR (G.crec.compression_method == SHRUNK) +# else +# define UNKN_SHR FALSE /* unshrinking not unknown */ +# endif +# define UNKN_COMPR (UNKN_RED || UNKN_SHR || \ + G.crec.compression_method==TOKENIZED || G.crec.compression_method>DEFLATED) +#endif + +/*--------------------------------------------------------------------------- + Check central directory info for version/compatibility requirements. + ---------------------------------------------------------------------------*/ + + G.pInfo->encrypted = G.crec.general_purpose_bit_flag & 1; /* bit field */ + G.pInfo->ExtLocHdr = (G.crec.general_purpose_bit_flag & 8) == 8; /* bit */ + G.pInfo->textfile = G.crec.internal_file_attributes & 1; /* bit field */ + G.pInfo->crc = G.crec.crc32; + G.pInfo->compr_size = G.crec.csize; + G.pInfo->uncompr_size = G.crec.ucsize; + + switch (uO.aflag) { + case 0: + G.pInfo->textmode = FALSE; /* bit field */ + break; + case 1: + G.pInfo->textmode = G.pInfo->textfile; /* auto-convert mode */ + break; + default: /* case 2: */ + G.pInfo->textmode = TRUE; + break; + } + + if (G.crec.version_needed_to_extract[1] == VMS_) { + if (G.crec.version_needed_to_extract[0] > VMS_UNZIP_VERSION) { + if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) + Info(slide, 0x401, ((char *)slide, LoadFarString(VersionMsg), + FnFilter1(G.filename), "VMS", + G.crec.version_needed_to_extract[0] / 10, + G.crec.version_needed_to_extract[0] % 10, + VMS_UNZIP_VERSION / 10, VMS_UNZIP_VERSION % 10)); + return 0; + } +#ifndef VMS /* won't be able to use extra field, but still have data */ + else if (!uO.tflag && !uO.overwrite_all) { /* if -o, extract anyway */ + Info(slide, 0x481, ((char *)slide, LoadFarString(VMSFormatQuery), + FnFilter1(G.filename))); + fgets(G.answerbuf, 9, stdin); + if ((*G.answerbuf != 'y') && (*G.answerbuf != 'Y')) + return 0; + } +#endif /* !VMS */ + /* usual file type: don't need VMS to extract */ + } else if (G.crec.version_needed_to_extract[0] > UNZIP_VERSION) { + if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) + Info(slide, 0x401, ((char *)slide, LoadFarString(VersionMsg), + FnFilter1(G.filename), "PK", + G.crec.version_needed_to_extract[0] / 10, + G.crec.version_needed_to_extract[0] % 10, + UNZIP_VERSION / 10, UNZIP_VERSION % 10)); + return 0; + } + + if UNKN_COMPR { + if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) { +#ifndef SFX + if (G.crec.compression_method < NUM_METHODS) + Info(slide, 0x401, ((char *)slide, LoadFarString(ComprMsgName), + FnFilter1(G.filename), + LoadFarStringSmall(ComprNames[G.crec.compression_method]))); + else +#endif + Info(slide, 0x401, ((char *)slide, LoadFarString(ComprMsgNum), + FnFilter1(G.filename), + G.crec.compression_method)); + } + return 0; + } +#if (!CRYPT) + if (G.pInfo->encrypted) { + if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) + Info(slide, 0x401, ((char *)slide, LoadFarString(SkipEncrypted), + FnFilter1(G.filename))); + return 0; + } +#endif /* !CRYPT */ + + /* map whatever file attributes we have into the local format */ + mapattr(__G); /* GRR: worry about return value later */ + + G.pInfo->offset = (long)G.crec.relative_offset_local_header; + return 1; + +} /* end function store_info() */ + + + + + +/***************************************/ +/* Function extract_or_test_member() */ +/***************************************/ + +static int extract_or_test_member(__G) /* return PK-type error code */ + __GDEF +{ + char *nul="[empty] ", *txt="[text] ", *bin="[binary]"; +#ifdef CMS_MVS + char *ebc="[ebcdic]"; +#endif + register int b; + int r, error=PK_COOL; +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + ulg wsize; +#else +# define wsize WSIZE +#endif + + +/*--------------------------------------------------------------------------- + Initialize variables, buffers, etc. + ---------------------------------------------------------------------------*/ + + G.bits_left = 0; + G.bitbuf = 0L; /* unreduce and unshrink only */ + G.zipeof = 0; + G.newfile = TRUE; + G.crc32val = CRCVAL_INITIAL; + +#ifdef SYMLINKS + /* if file came from Unix and is a symbolic link and we are extracting + * to disk, prepare to restore the link */ + if (S_ISLNK(G.pInfo->file_attr) && + (G.pInfo->hostnum == UNIX_ || G.pInfo->hostnum == ATARI_ || + G.pInfo->hostnum == BEOS_) && + !uO.tflag && !uO.cflag && (G.lrec.ucsize > 0)) + G.symlnk = TRUE; + else + G.symlnk = FALSE; +#endif /* SYMLINKS */ + + if (uO.tflag) { + if (!uO.qflag) + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), "test", + FnFilter1(G.filename), "", "")); + } else { +#ifdef DLL + if (uO.cflag && !G.redirect_data) +#else + if (uO.cflag) +#endif + { +#if (defined(OS2) && defined(__IBMC__) && (__IBMC__ >= 200)) + G.outfile = freopen("", "wb", stdout); /* VAC++ ignores setmode */ +#else + G.outfile = stdout; +#endif +#ifdef DOS_FLX_H68_OS2_W32 +#if (defined(__HIGHC__) && !defined(FLEXOS)) + setmode(G.outfile, _BINARY); +#else /* !(defined(__HIGHC__) && !defined(FLEXOS)) */ + setmode(fileno(G.outfile), O_BINARY); +#endif /* ?(defined(__HIGHC__) && !defined(FLEXOS)) */ +# define NEWLINE "\r\n" +#else /* !DOS_FLX_H68_OS2_W32 */ +# define NEWLINE "\n" +#endif /* ?DOS_FLX_H68_OS2_W32 */ +#ifdef VMS + if (open_outfile(__G)) /* VMS: required even for stdout! */ + return PK_DISK; +#endif + } else if (open_outfile(__G)) + return PK_DISK; + } + +/*--------------------------------------------------------------------------- + Unpack the file. + ---------------------------------------------------------------------------*/ + + defer_leftover_input(__G); /* so NEXTBYTE bounds check will work */ + switch (G.lrec.compression_method) { + case STORED: + if (!uO.tflag && QCOND2) { +#ifdef SYMLINKS + if (G.symlnk) /* can also be deflated, but rarer... */ + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + "link", FnFilter1(G.filename), "", "")); + else +#endif /* SYMLINKS */ + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + "extract", FnFilter1(G.filename), + (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)? + "" : (G.lrec.ucsize == 0L? nul : (G.pInfo->textfile? txt : + bin)), uO.cflag? NEWLINE : "")); + } +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { + wsize = G.redirect_size; redirSlide = G.redirect_buffer; + } else { + wsize = WSIZE; redirSlide = slide; + } +#endif + G.outptr = redirSlide; + G.outcnt = 0L; + while ((b = NEXTBYTE) != EOF && !G.disk_full) { + *G.outptr++ = (uch)b; + if (++G.outcnt == wsize) { + flush(__G__ redirSlide, G.outcnt, 0); + G.outptr = redirSlide; + G.outcnt = 0L; + } + } + if (G.outcnt) /* flush final (partial) buffer */ + flush(__G__ redirSlide, G.outcnt, 0); + break; + +#ifndef SFX +#ifndef LZW_CLEAN + case SHRUNK: + if (!uO.tflag && QCOND2) { + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + LoadFarStringSmall(Unshrink), FnFilter1(G.filename), + (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)? + "" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : "")); + } + if ((r = unshrink(__G)) != PK_COOL) { + if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)) + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipFile), + LoadFarString(NotEnoughMem), + LoadFarStringSmall2(Unshrink), + FnFilter1(G.filename))); + else + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipNoFile), + LoadFarString(NotEnoughMem), + LoadFarStringSmall2(Unshrink))); + error = r; + } + break; +#endif /* !LZW_CLEAN */ + +#ifndef COPYRIGHT_CLEAN + case REDUCED1: + case REDUCED2: + case REDUCED3: + case REDUCED4: + if (!uO.tflag && QCOND2) { + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + "unreduc", FnFilter1(G.filename), + (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)? + "" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : "")); + } + unreduce(__G); + break; +#endif /* !COPYRIGHT_CLEAN */ + + case IMPLODED: + if (!uO.tflag && QCOND2) { + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + "explod", FnFilter1(G.filename), + (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)? + "" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : "")); + } + if (((r = explode(__G)) != 0) && (r != 5)) { /* treat 5 specially */ + if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)) + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipFile), r == 3? + LoadFarString(NotEnoughMem) : + LoadFarString(InvalidComprData), + LoadFarStringSmall2(Explode), + FnFilter1(G.filename))); + else + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipNoFile), r == 3? + LoadFarString(NotEnoughMem) : + LoadFarString(InvalidComprData), + LoadFarStringSmall2(Explode))); + error = (r == 3)? PK_MEM3 : PK_ERR; + } + if (r == 5) { + int warning = ((ulg)G.used_csize <= G.lrec.csize); + + if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)) + Info(slide, 0x401, ((char *)slide, LoadFarString(LengthMsg), + "", warning? "warning" : "error", G.used_csize, + G.lrec.ucsize, warning? " " : "", G.lrec.csize, + " [", FnFilter1(G.filename), "]")); + else + Info(slide, 0x401, ((char *)slide, LoadFarString(LengthMsg), + "\n", warning? "warning" : "error", G.used_csize, + G.lrec.ucsize, warning? " ":"", G.lrec.csize, + "", "", ".")); + error = warning? PK_WARN : PK_ERR; + } + break; +#endif /* !SFX */ + + case DEFLATED: + if (!uO.tflag && QCOND2) { + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + "inflat", FnFilter1(G.filename), + (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)? + "" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : "")); + } +#ifndef USE_ZLIB /* zlib's function is called inflate(), too */ +# define UZinflate inflate +#endif + if ((r = UZinflate(__G)) != 0) { + if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)) + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipFile), r == 3? + LoadFarString(NotEnoughMem) : + LoadFarString(InvalidComprData), + LoadFarStringSmall2(Inflate), + FnFilter1(G.filename))); + else + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipNoFile), r == 3? + LoadFarString(NotEnoughMem) : + LoadFarString(InvalidComprData), + LoadFarStringSmall2(Inflate))); + error = (r == 3)? PK_MEM3 : PK_ERR; + } + break; + + default: /* should never get to this point */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(FileUnknownCompMethod), FnFilter1(G.filename))); + /* close and delete file before return? */ + undefer_input(__G); + return PK_WARN; + + } /* end switch (compression method) */ + +/*--------------------------------------------------------------------------- + Close the file and set its date and time (not necessarily in that order), + and make sure the CRC checked out OK. Logical-AND the CRC for 64-bit + machines (redundant on 32-bit machines). + ---------------------------------------------------------------------------*/ + +#ifdef VMS /* VMS: required even for stdout! (final flush) */ + if (!uO.tflag) /* don't close NULL file */ + close_outfile(__G); +#else +#ifdef DLL + if (!uO.tflag && (!uO.cflag || G.redirect_data)) { + if (G.redirect_data) + FINISH_REDIRECT(); + else + close_outfile(__G); + } +#else + if (!uO.tflag && !uO.cflag) /* don't close NULL file or stdout */ + close_outfile(__G); +#endif +#endif /* VMS */ + + /* GRR: CONVERT close_outfile() TO NON-VOID: CHECK FOR ERRORS! */ + + + if (G.disk_full) { /* set by flush() */ + if (G.disk_full > 1) { +#if (defined(DELETE_IF_FULL) && defined(HAVE_UNLINK)) + /* delete the incomplete file if we can */ + if (unlink(G.filename) != 0) + Trace((stderr, "extract.c: could not delete %s\n", + FnFilter1(G.filename))); +#else + /* warn user about the incomplete file */ + Info(slide, 0x421, ((char *)slide, LoadFarString(FileTruncated), + FnFilter1(G.filename))); +#endif + error = PK_DISK; + } else { + error = PK_WARN; + } + } + + if (error > PK_WARN) {/* don't print redundant CRC error if error already */ + undefer_input(__G); + return error; + } + if (G.crc32val != G.lrec.crc32) { + /* if quiet enough, we haven't output the filename yet: do it */ + if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)) + Info(slide, 0x401, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + Info(slide, 0x401, ((char *)slide, LoadFarString(BadCRC), G.crc32val, + G.lrec.crc32)); +#if CRYPT + if (G.pInfo->encrypted) + Info(slide, 0x401, ((char *)slide, LoadFarString(MaybeBadPasswd))); +#endif + error = PK_ERR; + } else if (uO.tflag) { +#ifndef SFX + if (G.extra_field) { + if ((r = TestExtraField(__G__ G.extra_field, + G.lrec.extra_field_length)) > error) + error = r; + } else +#endif /* !SFX */ + if (!uO.qflag) + Info(slide, 0, ((char *)slide, " OK\n")); + } else { + if (QCOND2 && !error) /* GRR: is stdout reset to text mode yet? */ + Info(slide, 0, ((char *)slide, "\n")); + } + + undefer_input(__G); + return error; + +} /* end function extract_or_test_member() */ + + + + + +#ifndef SFX + +/*******************************/ +/* Function TestExtraField() */ +/*******************************/ + +static int TestExtraField(__G__ ef, ef_len) + __GDEF + uch *ef; + unsigned ef_len; +{ + ush ebID; + unsigned ebLen; + unsigned eb_cmpr_offs = 0; + int r; + + /* we know the regular compressed file data tested out OK, or else we + * wouldn't be here ==> print filename if any extra-field errors found + */ + while (ef_len >= EB_HEADSIZE) { + ebID = makeword(ef); + ebLen = (unsigned)makeword(ef+EB_LEN); + + if (ebLen > (ef_len - EB_HEADSIZE)) { + /* Discovered some extra field inconsistency! */ + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + Info(slide, 1, ((char *)slide, LoadFarString(InconsistEFlength), + ebLen, (ef_len - EB_HEADSIZE))); + return PK_ERR; + } + + switch (ebID) { + case EF_OS2: + case EF_ACL: + case EF_MAC3: + case EF_BEOS: + switch (ebID) { + case EF_OS2: + case EF_ACL: + eb_cmpr_offs = EB_OS2_HLEN; + break; + case EF_MAC3: + if (ebLen >= EB_MAC3_HLEN && + (makeword(ef+(EB_HEADSIZE+EB_FLGS_OFFS)) + & EB_M3_FL_UNCMPR) && + (makelong(ef+EB_HEADSIZE) == ebLen - EB_MAC3_HLEN)) + eb_cmpr_offs = 0; + else + eb_cmpr_offs = EB_MAC3_HLEN; + break; + case EF_BEOS: + if (ebLen >= EB_BEOS_HLEN && + (*(ef+(EB_HEADSIZE+EB_FLGS_OFFS)) & EB_BE_FL_UNCMPR) && + (makelong(ef+EB_HEADSIZE) == ebLen - EB_BEOS_HLEN)) + eb_cmpr_offs = 0; + else + eb_cmpr_offs = EB_BEOS_HLEN; + break; + } + if ((r = test_compr_eb(__G__ ef, ebLen, eb_cmpr_offs, NULL)) + != PK_OK) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + switch (r) { + case IZ_EF_TRUNC: + Info(slide, 1, ((char *)slide, + LoadFarString(TruncEAs), + ebLen-(eb_cmpr_offs+EB_CMPRHEADLEN), "\n")); + break; + case PK_ERR: + Info(slide, 1, ((char *)slide, + LoadFarString(InvalidComprDataEAs))); + break; + case PK_MEM3: + case PK_MEM4: + Info(slide, 1, ((char *)slide, + LoadFarString(NotEnoughMemEAs))); + break; + default: + if ((r & 0xff) != PK_ERR) + Info(slide, 1, ((char *)slide, + LoadFarString(UnknErrorEAs))); + else { + ush m = (ush)(r >> 8); + if (m == DEFLATED) /* GRR KLUDGE! */ + Info(slide, 1, ((char *)slide, + LoadFarString(BadCRC_EAs))); + else + Info(slide, 1, ((char *)slide, + LoadFarString(UnknComprMethodEAs), m)); + } + break; + } + return r; + } + break; + + case EF_NTSD: + Trace((stderr, "ebID: %i / ebLen: %u\n", ebID, ebLen)); + r = ebLen < EB_NTSD_L_LEN ? IZ_EF_TRUNC : + ((ef[EB_HEADSIZE+EB_NTSD_VERSION] > EB_NTSD_MAX_VER) ? + (PK_WARN | 0x4000) : + test_compr_eb(__G__ ef, ebLen, EB_NTSD_L_LEN, TEST_NTSD)); + if (r != PK_OK) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + switch (r) { + case IZ_EF_TRUNC: + Info(slide, 1, ((char *)slide, + LoadFarString(TruncNTSD), + ebLen-(EB_NTSD_L_LEN+EB_CMPRHEADLEN), "\n")); + break; +#if (defined(WIN32) && defined(NTSD_EAS)) + case PK_WARN: + Info(slide, 1, ((char *)slide, + LoadFarString(InvalidSecurityEAs))); + break; +#endif + case PK_ERR: + Info(slide, 1, ((char *)slide, + LoadFarString(InvalidComprDataEAs))); + break; + case PK_MEM3: + case PK_MEM4: + Info(slide, 1, ((char *)slide, + LoadFarString(NotEnoughMemEAs))); + break; + case (PK_WARN | 0x4000): + Info(slide, 1, ((char *)slide, + LoadFarString(UnsuppNTSDVersEAs), + (int)ef[EB_HEADSIZE+EB_NTSD_VERSION])); + r = PK_WARN; + break; + default: + if ((r & 0xff) != PK_ERR) + Info(slide, 1, ((char *)slide, + LoadFarString(UnknErrorEAs))); + else { + ush m = (ush)(r >> 8); + if (m == DEFLATED) /* GRR KLUDGE! */ + Info(slide, 1, ((char *)slide, + LoadFarString(BadCRC_EAs))); + else + Info(slide, 1, ((char *)slide, + LoadFarString(UnknComprMethodEAs), m)); + } + break; + } + return r; + } + break; + case EF_PKVMS: + case EF_PKW32: + case EF_PKUNIX: + case EF_ASIUNIX: + case EF_IZVMS: + case EF_IZUNIX: + case EF_VMCMS: + case EF_MVS: + case EF_SPARK: + case EF_AV: + default: + break; + } + ef_len -= (ebLen + EB_HEADSIZE); + ef += (ebLen + EB_HEADSIZE); + } + + if (!uO.qflag) + Info(slide, 0, ((char *)slide, " OK\n")); + + return PK_COOL; + +} /* end function TestExtraField() */ + + + + + +/******************************/ +/* Function test_compr_eb() */ +/******************************/ + +#ifdef PROTO +static int test_compr_eb( + __GPRO__ + uch *eb, + unsigned eb_size, + unsigned compr_offset, + int (*test_uc_ebdata)(__GPRO__ uch *eb, unsigned eb_size, + uch *eb_ucptr, ulg eb_ucsize)) +#else /* !PROTO */ +static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata) + __GDEF + uch *eb; + unsigned eb_size; + unsigned compr_offset; + int (*test_uc_ebdata)(); +#endif /* ?PROTO */ +{ + ulg eb_ucsize; + uch *eb_ucptr; + int r; + + if (compr_offset < 4) /* field is not compressed: */ + return PK_OK; /* do nothing and signal OK */ + + if ((eb_size < (EB_UCSIZE_P + 4)) || + ((eb_ucsize = makelong(eb+(EB_HEADSIZE+EB_UCSIZE_P))) > 0L && + eb_size <= (compr_offset + EB_CMPRHEADLEN))) + return IZ_EF_TRUNC; /* no compressed data! */ + + if ((eb_ucptr = (uch *)malloc((extent)eb_ucsize)) == (uch *)NULL) + return PK_MEM4; + + r = memextract(__G__ eb_ucptr, eb_ucsize, + eb + (EB_HEADSIZE + compr_offset), + (ulg)(eb_size - compr_offset)); + + if (r == PK_OK && test_uc_ebdata != NULL) + r = (*test_uc_ebdata)(__G__ eb, eb_size, eb_ucptr, eb_ucsize); + + free(eb_ucptr); + return r; + +} /* end function test_compr_eb() */ + +#endif /* !SFX */ + + + + + +/***************************/ +/* Function memextract() */ +/***************************/ + +int memextract(__G__ tgt, tgtsize, src, srcsize) /* extract compressed */ + __GDEF /* extra field block; */ + uch *tgt, *src; /* return PK-type error */ + ulg tgtsize, srcsize; /* level */ +{ + long old_csize=G.csize; + uch *old_inptr=G.inptr; + int old_incnt=G.incnt; + int r, error=PK_OK; + ush method; + ulg extra_field_crc; + + + method = makeword(src); + extra_field_crc = makelong(src+2); + + /* compressed extra field exists completely in memory at this location: */ + G.inptr = src + 2 + 4; /* method and extra_field_crc */ + G.incnt = (int)(G.csize = (long)(srcsize - (2 + 4))); + G.mem_mode = TRUE; + G.outbufptr = tgt; + G.outsize = tgtsize; + + switch (method) { + case STORED: + memcpy((char *)tgt, (char *)G.inptr, (extent)G.incnt); + G.outcnt = G.csize; /* for CRC calculation */ + break; + case DEFLATED: + G.outcnt = 0L; + if ((r = UZinflate(__G)) != 0) { + if (!uO.tflag) + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipNoFile), r == 3? + LoadFarString(NotEnoughMem) : + LoadFarString(InvalidComprData), + LoadFarStringSmall2(Inflate))); + error = (r == 3)? PK_MEM3 : PK_ERR; + } + if (G.outcnt == 0L) /* inflate's final FLUSH sets outcnt */ + break; + break; + default: + if (uO.tflag) + error = PK_ERR | ((int)method << 8); + else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(UnsupportedExtraField), method)); + error = PK_ERR; /* GRR: should be passed on up via SetEAs() */ + } + break; + } + + G.inptr = old_inptr; + G.incnt = old_incnt; + G.csize = old_csize; + G.mem_mode = FALSE; + + if (!error) { + register ulg crcval = crc32(CRCVAL_INITIAL, tgt, (extent)G.outcnt); + + if (crcval != extra_field_crc) { + if (uO.tflag) + error = PK_ERR | (DEFLATED << 8); /* kludge for now */ + else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(BadExtraFieldCRC), G.zipfn, crcval, + extra_field_crc)); + error = PK_ERR; + } + } + } + return error; + +} /* end function memextract() */ + + + + + +/*************************/ +/* Function memflush() */ +/*************************/ + +int memflush(__G__ rawbuf, size) + __GDEF + uch *rawbuf; + ulg size; +{ + if (size > G.outsize) + return 50; /* more data than output buffer can hold */ + + memcpy((char *)G.outbufptr, (char *)rawbuf, (extent)size); + G.outbufptr += (unsigned int)size; + G.outsize -= size; + G.outcnt += size; + + return 0; + +} /* end function memflush() */ + + + + + +/*************************/ +/* Function fnfilter() */ /* here instead of in list.c for SFX */ +/*************************/ + +char *fnfilter(raw, space) /* convert name to safely printable form */ + ZCONST char *raw; + uch *space; +{ +#ifndef NATIVE /* ASCII: filter ANSI escape codes, etc. */ + uch *r=(uch *)raw, *s=space; + + while (*r) { +#ifdef QDOS + if (qlflag & 2) { + if (*r == '/' || *r == '.') { + ++r; + *s++ = '_'; + continue; + } + } else +#endif + if (*r < 32) + *s++ = '^', *s++ = (uch)(64 + *r++); + else + *s++ = *r++; + } + *s = 0; + +#ifdef WINDLL + INTERN_TO_ISO((char *)space, (char *)space); /* translate to ANSI */ +#else +#ifdef WIN32 + /* Win9x console always uses OEM character coding, and + WinNT console is set to OEM charset by default, too */ + INTERN_TO_OEM((char *)space, (char *)space); +#endif /* WIN32 */ +#endif /* ?WINDLL */ + + return (char *)space; + +#else /* NATIVE: EBCDIC or whatever */ + return (char *)raw; +#endif + +} /* end function fnfilter() */ + + + + + +#ifdef SET_DIR_ATTRIB +/* must sort saved directories so can set perms from bottom up */ + +/************************/ +/* Function dircomp() */ +/************************/ + +static int dircomp(a, b) /* used by qsort(); swiped from Zip */ + ZCONST zvoid *a, *b; +{ + /* order is significant: this sorts in reverse order (deepest first) */ + return strcmp((*(dirtime **)b)->fn, (*(dirtime **)a)->fn); + /* return namecmp((*(dirtime **)b)->fn, (*(dirtime **)a)->fn); */ +} + + + +#if 0 /* not used in Unix, but maybe for future OSes? */ + +/************************/ +/* Function namecmp() */ +/************************/ + +static int namecmp(s1, s2) /* [not] used by dircomp(); swiped from Zip */ + ZCONST char *s1, *s2; +{ + int d; + + for (;;) { + d = (int)(uch)case_map(*s1) + - (int)(uch)case_map(*s2); + + if (d || *s1 == 0 || *s2 == 0) + return d; + + s1++; + s2++; + } +} + +#endif /* 0 */ +#endif /* SET_DIR_ATTRIB */ diff --git a/utils/Install/packzip/fileio.c b/utils/Install/packzip/fileio.c new file mode 100644 index 0000000000..602bfaf058 --- /dev/null +++ b/utils/Install/packzip/fileio.c @@ -0,0 +1,2153 @@ +/*--------------------------------------------------------------------------- + + fileio.c + + This file contains routines for doing direct but relatively generic input/ + output, file-related sorts of things, plus some miscellaneous stuff. Most + of the stuff has to do with opening, closing, reading and/or writing files. + + Contains: open_input_file() + open_outfile() (non-VMS, non-AOS/VS, non-CMS_MVS) + undefer_input() + defer_leftover_input() + readbuf() + readbyte() + fillinbuf() + flush() (non-VMS) + disk_error() (non-VMS) + UzpMessagePrnt() + UzpMessageNull() (DLL only) + UzpInput() + UzpMorePause() + UzpPassword() (non-WINDLL) + handler() + dos_to_unix_time() (non-VMS, non-VM/CMS, non-MVS) + check_for_newer() (non-VMS, non-OS/2, non-VM/CMS, non-MVS) + do_string() + makeword() + makelong() + str2iso() (CRYPT && NEED_STR2ISO, only) + str2oem() (CRYPT && NEED_STR2OEM, only) + memset() (ZMEM only) + memcpy() (ZMEM only) + zstrnicmp() + zstat() (REGULUS only) + fLoadFarString() (SMALL_MEM only) + fLoadFarStringSmall() (SMALL_MEM only) + fLoadFarStringSmall2() (SMALL_MEM only) + zfstrcpy() (SMALL_MEM only) + + ---------------------------------------------------------------------------*/ + + +#define FILEIO_C +#define UNZIP_INTERNAL +#include "unzip.h" +#ifdef WINDLL +# include "windll/windll.h" +# include <setjmp.h> +#endif +#include "crypt.h" +#include "ttyio.h" + +/* setup of codepage conversion for decryption passwords */ +#if CRYPT +# if (defined(CRYP_USES_ISO2OEM) && !defined(IZ_ISO2OEM_ARRAY)) +# define IZ_ISO2OEM_ARRAY /* pull in iso2oem[] table */ +# endif +# if (defined(CRYP_USES_OEM2ISO) && !defined(IZ_OEM2ISO_ARRAY)) +# define IZ_OEM2ISO_ARRAY /* pull in oem2iso[] table */ +# endif +#endif +#include "ebcdic.h" /* definition/initialization of ebcdic[] */ + + +/* + Note: Under Windows, the maximum size of the buffer that can be used + with any of the *printf calls is 16,384, so win_fprintf was used to + feed the fprintf clone no more than 16K chunks at a time. This should + be valid for anything up to 64K (and probably beyond, assuming your + buffers are that big). +*/ +#ifdef WINDLL +# define WriteError(buf,len,strm) \ + (win_fprintf(pG, strm, (extent)len, (char far *)buf) != (int)(len)) +#else /* !WINDLL */ +# ifdef USE_FWRITE +# define WriteError(buf,len,strm) \ + ((extent)fwrite((char *)(buf),1,(extent)(len),strm) != (extent)(len)) +# else +# define WriteError(buf,len,strm) \ + ((extent)write(fileno(strm),(char *)(buf),(extent)(len)) != (extent)(len)) +# endif +#endif /* ?WINDLL */ + +static int disk_error OF((__GPRO)); + + +/****************************/ +/* Strings used in fileio.c */ +/****************************/ + +#if (defined(UNIX) || defined(DOS_FLX_OS2_W32) || defined(__BEOS__)) + static ZCONST char Far CannotDeleteOldFile[] = + "error: cannot delete old %s\n"; +#ifdef UNIXBACKUP + static ZCONST char Far CannotRenameOldFile[] = + "error: cannot rename old %s\n"; + static ZCONST char Far BackupSuffix[] = "~"; +#endif +#endif /* UNIX || DOS_FLX_OS2_W32 || __BEOS__ */ + +static ZCONST char Far CannotOpenZipfile[] = + "error: cannot open zipfile [ %s ]\n"; +#if (!defined(VMS) && !defined(AOS_VS) && !defined(CMS_MVS) && !defined(MACOS)) + static ZCONST char Far CannotCreateFile[] = "error: cannot create %s\n"; +#endif +#ifdef NOVELL_BUG_FAILSAFE + static ZCONST char Far NovellBug[] = + "error: %s: stat() says does not exist, but fopen() found anyway\n"; +#endif +static ZCONST char Far ReadError[] = "error: zipfile read error\n"; +static ZCONST char Far FilenameTooLongTrunc[] = + "warning: filename too long--truncating.\n"; +static ZCONST char Far ExtraFieldTooLong[] = + "warning: extra field too long (%d). Ignoring...\n"; + +#ifdef WINDLL + static ZCONST char Far DiskFullQuery[] = + "%s: write error (disk full?).\n"; +#else + static ZCONST char Far DiskFullQuery[] = + "%s: write error (disk full?). Continue? (y/n/^C) "; + static ZCONST char Far ZipfileCorrupt[] = + "error: zipfile probably corrupt (%s)\n"; +# ifdef SYMLINKS + static ZCONST char Far FileIsSymLink[] = + "%s exists and is a symbolic link%s.\n"; +# endif +# ifdef MORE + static ZCONST char Far MorePrompt[] = "--More--(%lu)"; +# endif + static ZCONST char Far QuitPrompt[] = + "--- Press `Q' to quit, or any other key to continue ---"; + static ZCONST char Far HidePrompt[] = /* "\r \r"; */ + "\r \r"; +# if CRYPT +# ifdef MACOS + /* SPC: are names on MacOS REALLY so much longer than elsewhere ??? */ + static ZCONST char Far PasswPrompt[] = "[%s]\n %s password: "; +# else + static ZCONST char Far PasswPrompt[] = "[%s] %s password: "; +# endif + static ZCONST char Far PasswPrompt2[] = "Enter password: "; + static ZCONST char Far PasswRetry[] = "password incorrect--reenter: "; +# endif /* CRYPT */ +#endif /* !WINDLL */ + + + + + +/******************************/ +/* Function open_input_file() */ +/******************************/ + +int open_input_file(__G) /* return 1 if open failed */ + __GDEF +{ + /* + * open the zipfile for reading and in BINARY mode to prevent cr/lf + * translation, which would corrupt the bitstreams + */ + +#if (defined(UNIX) || defined(TOPS20) || defined(AOS_VS) || defined(__BEOS__)) + G.zipfd = open(G.zipfn, O_RDONLY); +#else /* !(UNIX || TOPS20 || AOS_VS || __BEOS__) */ +#ifdef VMS + G.zipfd = open(G.zipfn, O_RDONLY, 0, "ctx=stm"); +#else /* !VMS */ +#ifdef MACOS + G.zipfd = open(G.zipfn, 0); +#else /* !MACOS */ +#ifdef RISCOS + G.zipfd = fopen(G.zipfn, "rb"); +#else /* !RISCOS */ +#ifdef CMS_MVS + G.zipfd = vmmvs_open_infile(__G); +#else /* !CMS_MVS */ + G.zipfd = open(G.zipfn, O_RDONLY | O_BINARY); +#endif /* ?CMS_MVS */ +#endif /* ?RISCOS */ +#endif /* ?MACOS */ +#endif /* ?VMS */ +#endif /* ?(UNIX || TOPS20 || AOS_VS || __BEOS__) */ + +#ifdef USE_STRM_INPUT + if (G.zipfd == NULL) +#else + /* if (G.zipfd < 0) */ /* no good for Windows CE port */ + if (G.zipfd == -1) +#endif + { + Info(slide, 0x401, ((char *)slide, LoadFarString(CannotOpenZipfile), + G.zipfn)); + return 1; + } + return 0; + +} /* end function open_input_file() */ + + + + +#if (!defined(VMS) && !defined(AOS_VS) && !defined(CMS_MVS) && !defined(MACOS)) + +/***************************/ +/* Function open_outfile() */ +/***************************/ + +int open_outfile(__G) /* return 1 if fail */ + __GDEF +{ +#ifdef DLL + if (G.redirect_data) + return (redirect_outfile(__G) == FALSE); +#endif +#ifdef QDOS + QFilename(__G__ G.filename); +#endif +#if (defined(DOS_FLX_OS2_W32) || defined(UNIX) || defined(__BEOS__)) +#ifdef BORLAND_STAT_BUG + /* Borland 5.0's stat() barfs if the filename has no extension and the + * file doesn't exist. */ + if (access(G.filename, 0) == -1) { + FILE *tmp = fopen(G.filename, "wb+"); + + /* file doesn't exist, so create a dummy file to keep stat() from + * failing (will be over-written anyway) */ + fputc('0', tmp); /* just to have something in the file */ + fclose(tmp); + } +#endif /* BORLAND_STAT_BUG */ +#ifdef SYMLINKS + if (SSTAT(G.filename, &G.statbuf) == 0 || lstat(G.filename,&G.statbuf) == 0) +#else + if (SSTAT(G.filename, &G.statbuf) == 0) +#endif /* ?SYMLINKS */ + { + Trace((stderr, "open_outfile: stat(%s) returns 0: file exists\n", + FnFilter1(G.filename))); +#ifdef UNIXBACKUP + if (uO.B_flag) { /* do backup */ + char *tname; + int blen, flen, tlen; + + blen = strlen(BackupSuffix); + flen = strlen(G.filename); + tlen = flen + blen + 1; + if (tlen >= FILNAMSIZ) { /* in case name is too long, truncate */ + tname = (char *)malloc(FILNAMSIZ); + if (tname == NULL) + return 1; /* in case we run out of space */ + tlen = FILNAMSIZ - 1 - blen; + strcpy(tname, G.filename); /* make backup name */ + tname[tlen] = '\0'; + } else { + tname = (char *)malloc(tlen); + if (tname == NULL) + return 1; /* in case we run out of space */ + strcpy(tname, G.filename); /* make backup name */ + } + strcpy(tname+flen, BackupSuffix); + + /* GRR: should check if backup file exists, apply -n/-o to that */ + if (rename(G.filename, tname) < 0) { /* move file */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotRenameOldFile), FnFilter1(G.filename))); + free(tname); + return 1; + } + free(tname); + } else +#endif /* UNIXBACKUP */ +#ifdef DOS_FLX_OS2_W32 + if (!(G.statbuf.st_mode & S_IWRITE)) { + Trace((stderr, "open_outfile: existing file %s is read-only\n", + FnFilter1(G.filename))); + chmod(G.filename, S_IREAD | S_IWRITE); + Trace((stderr, "open_outfile: %s now writable\n", + FnFilter1(G.filename))); + } +#endif /* DOS_FLX_OS2_W32 */ + if (unlink(G.filename) != 0) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotDeleteOldFile), FnFilter1(G.filename))); + return 1; + } + Trace((stderr, "open_outfile: %s now deleted\n", + FnFilter1(G.filename))); + } +#endif /* DOS_FLX_OS2_W32 || UNIX || __BEOS__ */ +#ifdef RISCOS + if (SWI_OS_File_7(G.filename,0xDEADDEAD,0xDEADDEAD,G.lrec.ucsize)!=NULL) { + Info(slide, 1, ((char *)slide, LoadFarString(CannotCreateFile), + FnFilter1(G.filename))); + return 1; + } +#endif /* RISCOS */ +#ifdef TOPS20 + char *tfilnam; + + if ((tfilnam = (char *)malloc(2*strlen(G.filename)+1)) == (char *)NULL) + return 1; + strcpy(tfilnam, G.filename); + upper(tfilnam); + enquote(tfilnam); + if ((G.outfile = fopen(tfilnam, FOPW)) == (FILE *)NULL) { + Info(slide, 1, ((char *)slide, LoadFarString(CannotCreateFile), + tfilnam)); + free(tfilnam); + return 1; + } + free(tfilnam); +#else /* !TOPS20 */ +#ifdef MTS + if (uO.aflag) + G.outfile = fopen(G.filename, FOPWT); + else + G.outfile = fopen(G.filename, FOPW); + if (G.outfile == (FILE *)NULL) { + Info(slide, 1, ((char *)slide, LoadFarString(CannotCreateFile), + FnFilter1(G.filename))); + return 1; + } +#else /* !MTS */ +#ifdef TANDEM + if (SSTAT(G.filename, &G.statbuf) == 0) { + Trace((stderr, "open_outfile: stat(%s) returns 0 (file exists)\n", + FnFilter1(G.filename))); + if (unlink(G.filename) != 0) { + Trace((stderr, "open_outfile: existing file %s is read-only\n", + FnFilter1(G.filename))); + chmod(G.filename, S_IRUSR | S_IWUSR); + Trace((stderr, "open_outfile: %s now writable\n", + FnFilter1(G.filename))); + if (unlink(G.filename) != 0) + return 1; + } + Trace((stderr, "open_outfile: %s now deleted\n", + FnFilter1(G.filename))); + } + if (G.pInfo->textmode) + G.outfile = fopen(G.filename, FOPWT); + else + G.outfile = fopen(G.filename, FOPW); + if (G.outfile == (FILE *)NULL) { + Info(slide, 1, ((char *)slide, LoadFarString(CannotCreateFile), + FnFilter1(G.filename))); + return 1; + } +#else /* !TANDEM */ +#ifdef DEBUG + Info(slide, 1, ((char *)slide, + "open_outfile: doing fopen(%s) for reading\n", FnFilter1(G.filename))); + if ((G.outfile = fopen(G.filename, FOPR)) == (FILE *)NULL) + Info(slide, 1, ((char *)slide, + "open_outfile: fopen(%s) for reading failed: does not exist\n", + FnFilter1(G.filename))); + else { + Info(slide, 1, ((char *)slide, + "open_outfile: fopen(%s) for reading succeeded: file exists\n", + FnFilter1(G.filename))); + fclose(G.outfile); + } +#endif /* DEBUG */ +#ifdef NOVELL_BUG_FAILSAFE + if (G.dne && ((G.outfile = fopen(G.filename, FOPR)) != (FILE *)NULL)) { + Info(slide, 0x401, ((char *)slide, LoadFarString(NovellBug), + FnFilter1(G.filename))); + fclose(G.outfile); + return 1; /* with "./" fix in checkdir(), should never reach here */ + } +#endif /* NOVELL_BUG_FAILSAFE */ + Trace((stderr, "open_outfile: doing fopen(%s) for writing\n", + FnFilter1(G.filename))); + if ((G.outfile = fopen(G.filename, FOPW)) == (FILE *)NULL) { + Info(slide, 0x401, ((char *)slide, LoadFarString(CannotCreateFile), + FnFilter1(G.filename))); + return 1; + } + Trace((stderr, "open_outfile: fopen(%s) for writing succeeded\n", + FnFilter1(G.filename))); +#endif /* !TANDEM */ +#endif /* !MTS */ +#endif /* !TOPS20 */ + +#ifdef USE_FWRITE +#ifdef DOS_OS2_W32 + /* 16-bit MSC: buffer size must be strictly LESS than 32K (WSIZE): bogus */ + setbuf(G.outfile, (char *)NULL); /* make output unbuffered */ +#else /* !DOS_OS2_W32 */ +#ifndef RISCOS +#ifdef _IOFBF /* make output fully buffered (works just about like write()) */ + setvbuf(G.outfile, (char *)slide, _IOFBF, WSIZE); +#else + setbuf(G.outfile, (char *)slide); +#endif +#endif /* !RISCOS */ +#endif /* ?DOS_OS2_W32 */ +#endif /* USE_FWRITE */ + return 0; + +} /* end function open_outfile() */ + +#endif /* !VMS && !AOS_VS && !CMS_MVS && !MACOS */ + + + + + +/* + * These functions allow NEXTBYTE to function without needing two bounds + * checks. Call defer_leftover_input() if you ever have filled G.inbuf + * by some means other than readbyte(), and you then want to start using + * NEXTBYTE. When going back to processing bytes without NEXTBYTE, call + * undefer_input(). For example, extract_or_test_member brackets its + * central section that does the decompression with these two functions. + * If you need to check the number of bytes remaining in the current + * file while using NEXTBYTE, check (G.csize + G.incnt), not G.csize. + */ + +/****************************/ +/* function undefer_input() */ +/****************************/ + +void undefer_input(__G) + __GDEF +{ + if (G.incnt > 0) + G.csize += G.incnt; + if (G.incnt_leftover > 0) { + /* We know that "(G.csize < MAXINT)" so we can cast G.csize to int: + * This condition was checked when G.incnt_leftover was set > 0 in + * defer_leftover_input(), and it is NOT allowed to touch G.csize + * before calling undefer_input() when (G.incnt_leftover > 0) + * (single exception: see read_byte()'s "G.csize <= 0" handling) !! + */ + G.incnt = G.incnt_leftover + (int)G.csize; + G.inptr = G.inptr_leftover - (int)G.csize; + G.incnt_leftover = 0; + } else if (G.incnt < 0) + G.incnt = 0; +} /* end function undefer_input() */ + + + + + +/***********************************/ +/* function defer_leftover_input() */ +/***********************************/ + +void defer_leftover_input(__G) + __GDEF +{ + if ((long)G.incnt > G.csize) { + /* (G.csize < MAXINT), we can safely cast it to int !! */ + if (G.csize < 0L) + G.csize = 0L; + G.inptr_leftover = G.inptr + (int)G.csize; + G.incnt_leftover = G.incnt - (int)G.csize; + G.incnt = (int)G.csize; + } else + G.incnt_leftover = 0; + G.csize -= G.incnt; +} /* end function defer_leftover_input() */ + + + + + +/**********************/ +/* Function readbuf() */ +/**********************/ + +unsigned readbuf(__G__ buf, size) /* return number of bytes read into buf */ + __GDEF + char *buf; + register unsigned size; +{ + register unsigned count; + unsigned n; + + n = size; + while (size) { + if (G.incnt <= 0) { + if ((G.incnt = read(G.zipfd, (char *)G.inbuf, INBUFSIZ)) == 0) + return (n-size); + else if (G.incnt < 0) { + /* another hack, but no real harm copying same thing twice */ + (*G.message)((zvoid *)&G, + (uch *)LoadFarString(ReadError), /* CANNOT use slide */ + (ulg)strlen(LoadFarString(ReadError)), 0x401); + return 0; /* discarding some data; better than lock-up */ + } + /* buffer ALWAYS starts on a block boundary: */ + G.cur_zipfile_bufstart += INBUFSIZ; + G.inptr = G.inbuf; + } + count = MIN(size, (unsigned)G.incnt); + memcpy(buf, G.inptr, count); + buf += count; + G.inptr += count; + G.incnt -= count; + size -= count; + } + return n; + +} /* end function readbuf() */ + + + + + +/***********************/ +/* Function readbyte() */ +/***********************/ + +int readbyte(__G) /* refill inbuf and return a byte if available, else EOF */ + __GDEF +{ + if (G.mem_mode) + return EOF; + if (G.csize <= 0) { + G.csize--; /* for tests done after exploding */ + G.incnt = 0; + return EOF; + } + if (G.incnt <= 0) { + if ((G.incnt = read(G.zipfd, (char *)G.inbuf, INBUFSIZ)) == 0) { + G.incnt = 0; /* do not allow negative value to affect stuff */ + return EOF; + } else if (G.incnt < 0) { /* "fail" (abort, retry, ...) returns this */ + /* another hack, but no real harm copying same thing twice */ + (*G.message)((zvoid *)&G, + (uch *)LoadFarString(ReadError), + (ulg)strlen(LoadFarString(ReadError)), 0x401); + echon(); +#ifdef WINDLL + longjmp(dll_error_return, 1); +#else + DESTROYGLOBALS() + EXIT(PK_BADERR); /* totally bailing; better than lock-up */ +#endif + } + G.cur_zipfile_bufstart += INBUFSIZ; /* always starts on block bndry */ + G.inptr = G.inbuf; + defer_leftover_input(__G); /* decrements G.csize */ + } + +#if CRYPT + if (G.pInfo->encrypted) { + uch *p; + int n; + + /* This was previously set to decrypt one byte beyond G.csize, when + * incnt reached that far. GRR said, "but it's required: why?" This + * was a bug in fillinbuf() -- was it also a bug here? + */ + for (n = G.incnt, p = G.inptr; n--; p++) + zdecode(*p); + } +#endif /* CRYPT */ + + --G.incnt; + return *G.inptr++; + +} /* end function readbyte() */ + + + + + +#ifdef USE_ZLIB + +/************************/ +/* Function fillinbuf() */ +/************************/ + +int fillinbuf(__G) /* like readbyte() except returns number of bytes in inbuf */ + __GDEF +{ + if (G.mem_mode || + (G.incnt = read(G.zipfd, (char *)G.inbuf, INBUFSIZ)) <= 0) + return 0; + G.cur_zipfile_bufstart += INBUFSIZ; /* always starts on a block boundary */ + G.inptr = G.inbuf; + defer_leftover_input(__G); /* decrements G.csize */ + +#if CRYPT + if (G.pInfo->encrypted) { + uch *p; + int n; + + for (n = G.incnt, p = G.inptr; n--; p++) + zdecode(*p); + } +#endif /* CRYPT */ + + return G.incnt; + +} /* end function fillinbuf() */ + +#endif /* USE_ZLIB */ + + + + + +#ifndef VMS /* for VMS use code in vms.c */ + +/********************/ +/* Function flush() */ /* returns PK error codes: */ +/********************/ /* if cflag => always 0; PK_DISK if write error */ + +int flush(__G__ rawbuf, size, unshrink) + __GDEF + uch *rawbuf; + ulg size; + int unshrink; +{ + register uch *p, *q; + uch *transbuf; +#if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV)) + ulg transbufsiz; +#endif + /* static int didCRlast = FALSE; moved to globals.h */ + + +/*--------------------------------------------------------------------------- + Compute the CRC first; if testing or if disk is full, that's it. + ---------------------------------------------------------------------------*/ + + G.crc32val = crc32(G.crc32val, rawbuf, (extent)size); + +#ifdef DLL + if ((G.statreportcb != NULL) && + (*G.statreportcb)(__G__ UZ_ST_IN_PROGRESS, G.zipfn, G.filename, NULL)) + return IZ_CTRLC; /* cancel operation by user request */ +#endif + + if (uO.tflag || size == 0L) /* testing or nothing to write: all done */ + return PK_OK; + + if (G.disk_full) + return PK_DISK; /* disk already full: ignore rest of file */ + +/*--------------------------------------------------------------------------- + Write the bytes rawbuf[0..size-1] to the output device, first converting + end-of-lines and ASCII/EBCDIC as needed. If SMALL_MEM or MED_MEM are NOT + defined, outbuf is assumed to be at least as large as rawbuf and is not + necessarily checked for overflow. + ---------------------------------------------------------------------------*/ + + if (!G.pInfo->textmode) { /* write raw binary data */ + /* GRR: note that for standard MS-DOS compilers, size argument to + * fwrite() can never be more than 65534, so WriteError macro will + * have to be rewritten if size can ever be that large. For now, + * never more than 32K. Also note that write() returns an int, which + * doesn't necessarily limit size to 32767 bytes if write() is used + * on 16-bit systems but does make it more of a pain; however, because + * at least MSC 5.1 has a lousy implementation of fwrite() (as does + * DEC Ultrix cc), write() is used anyway. + */ +#ifdef DLL + if (G.redirect_data) + writeToMemory(__G__ rawbuf, size); + else +#endif + if (!uO.cflag && WriteError(rawbuf, size, G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, rawbuf, size, 0)) + return 0; + } else { /* textmode: aflag is true */ + if (unshrink) { + /* rawbuf = outbuf */ + transbuf = G.outbuf2; +#if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV)) + transbufsiz = TRANSBUFSIZ; +#endif + } else { + /* rawbuf = slide */ + transbuf = G.outbuf; +#if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV)) + transbufsiz = OUTBUFSIZ; + Trace((stderr, "\ntransbufsiz = OUTBUFSIZ = %u\n", OUTBUFSIZ)); +#endif + } + if (G.newfile) { +#ifdef VMS_TEXT_CONV + /* GRR: really want to check if -aa (or -aaa?) was given... */ + if (rawbuf[1]) { /* first line is more than 255 chars long */ + Trace((stderr, + "\nfirst line of VMS `text' too long; switching to normal extraction\n")); + G.VMS_line_state = -1; /* -1: don't treat as VMS text */ + } else + G.VMS_line_state = 0; /* 0: ready to read line length */ +#endif + G.didCRlast = FALSE; /* no previous buffers written */ + G.newfile = FALSE; + } + +#ifdef VMS_TEXT_CONV + if (G.pInfo->hostnum == VMS_ && G.extra_field && G.VMS_line_state >= 0) + { + /* GRR: really want to check for actual VMS extra field, and + * ideally for variable-length record format */ +/* + printf("\n>>>>>> GRR: file is VMS text and has an extra field\n"); + */ + + p = rawbuf; + q = transbuf; + while(p < rawbuf+(unsigned)size) { + switch (G.VMS_line_state) { + + /* 0: ready to read line length */ + case 0: + G.VMS_line_length = 0; + G.VMS_line_pad = 0; + if (p == rawbuf+(unsigned)size-1) { /* last char */ + G.VMS_line_length = (int)((uch)(*p++)); + G.VMS_line_state = 1; + } else { + G.VMS_line_length = makeword(p); + p += 2; + G.VMS_line_state = 2; + } + if (G.VMS_line_length & 1) /* odd */ + G.VMS_line_pad = 1; + break; + + /* 1: read one byte of length, need second */ + case 1: + G.VMS_line_length += ((int)((uch)(*p++)) << 8); + G.VMS_line_state = 2; + break; + + /* 2: ready to read VMS_line_length chars */ + case 2: + if (G.VMS_line_length < rawbuf+(unsigned)size-p) { + if (G.VMS_line_length >= + transbuf+(unsigned)transbufsiz-q) + { + int outroom = transbuf+(unsigned)transbufsiz-q; + +/* GRR: need to change this to *q++ = native(*p++); loop or something */ + memcpy(q, p, outroom); +#ifdef DLL + if (G.redirect_data) + writeToMemory(__G__ transbuf, + (unsigned)outroom); + else +#endif + if (!uO.cflag && WriteError(transbuf, + (unsigned)outroom, G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, + transbuf, (ulg)outroom, 0)) + return 0; + q = transbuf; + p += outroom; + G.VMS_line_length -= outroom; + /* fall through to normal case */ + } +/* GRR: need to change this to *q++ = native(*p++); loop or something */ + memcpy(q, p, G.VMS_line_length); + q += G.VMS_line_length; + p += G.VMS_line_length; + G.VMS_line_length = 0; /* necessary?? */ + G.VMS_line_state = 3; + + } else { /* remaining input is less than full line */ + int remaining = rawbuf+(unsigned)size-p; + + if (remaining < + transbuf+(unsigned)transbufsiz-q) + { + int outroom = transbuf+(unsigned)transbufsiz-q; + +/* GRR: need to change this to *q++ = native(*p++); loop or something */ + memcpy(q, p, outroom); +#ifdef DLL + if (G.redirect_data) + writeToMemory(__G__ transbuf, + (unsigned)(outroom)); + else +#endif + if (!uO.cflag && WriteError(transbuf, + (unsigned)outroom, G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, + transbuf, (ulg)outroom, 0)) + return 0; + q = transbuf; + p += outroom; + remaining -= outroom; + } +/* GRR: need to change this to *q++ = native(*p++); loop or something */ + memcpy(q, p, remaining); + q += remaining; + p += remaining; + G.VMS_line_length -= remaining; + /* no change in G.VMS_line_state */ + } + break; + + /* 3: ready to PutNativeEOL */ + case 3: + if (q > transbuf+(unsigned)transbufsiz-lenEOL) { +#ifdef DLL + if (G.redirect_data) + writeToMemory(__G__ transbuf, + (unsigned)(q-transbuf)); + else +#endif + if (!uO.cflag && + WriteError(transbuf, (unsigned)(q-transbuf), + G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, + transbuf, (ulg)(q-transbuf), 0)) + return 0; + q = transbuf; + } + PutNativeEOL + if (G.VMS_line_pad) + if (p < rawbuf+(unsigned)size) { + ++p; + G.VMS_line_state = 0; + } else + G.VMS_line_state = 4; + else + G.VMS_line_state = 0; + break; + + /* 4: ready to read pad byte */ + case 4: + ++p; + G.VMS_line_state = 0; + break; + } + } /* end while */ + + } else +#endif /* VMS_TEXT_CONV */ + + /*----------------------------------------------------------------------- + Algorithm: CR/LF => native; lone CR => native; lone LF => native. + This routine is only for non-raw-VMS, non-raw-VM/CMS files (i.e., + stream-oriented files, not record-oriented). + -----------------------------------------------------------------------*/ + + /* else not VMS text */ { + p = rawbuf; + if (*p == LF && G.didCRlast) + ++p; + G.didCRlast = FALSE; + for (q = transbuf; p < rawbuf+(unsigned)size; ++p) { + if (*p == CR) { /* lone CR or CR/LF: EOL either way */ + PutNativeEOL + if (p == rawbuf+(unsigned)size-1) /* last char in buffer */ + G.didCRlast = TRUE; + else if (p[1] == LF) /* get rid of accompanying LF */ + ++p; + } else if (*p == LF) /* lone LF */ + PutNativeEOL + else +#ifndef DOS_FLX_OS2_W32 + if (*p != CTRLZ) /* lose all ^Z's */ +#endif + *q++ = native(*p); + +#if (defined(SMALL_MEM) || defined(MED_MEM)) +# if (lenEOL == 1) /* don't check unshrink: both buffers small but equal */ + if (!unshrink) +# endif + /* check for danger of buffer overflow and flush */ + if (q > transbuf+(unsigned)transbufsiz-lenEOL) { + Trace((stderr, + "p - rawbuf = %u q-transbuf = %u size = %lu\n", + (unsigned)(p-rawbuf), (unsigned)(q-transbuf), size)); + if (!uO.cflag && WriteError(transbuf, + (unsigned)(q-transbuf), G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, + transbuf, (ulg)(q-transbuf), 0)) + return 0; + q = transbuf; + continue; + } +#endif /* SMALL_MEM || MED_MEM */ + } + } + + /*----------------------------------------------------------------------- + Done translating: write whatever we've got to file (or screen). + -----------------------------------------------------------------------*/ + + Trace((stderr, "p - rawbuf = %u q-transbuf = %u size = %lu\n", + (unsigned)(p-rawbuf), (unsigned)(q-transbuf), size)); + if (q > transbuf) { +#ifdef DLL + if (G.redirect_data) + writeToMemory(__G__ transbuf, (unsigned)(q-transbuf)); + else +#endif + if (!uO.cflag && WriteError(transbuf, (unsigned)(q-transbuf), + G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, transbuf, + (ulg)(q-transbuf), 0)) + return 0; + } + } + + return 0; + +} /* end function flush() */ + + + + + +/*************************/ +/* Function disk_error() */ +/*************************/ + +static int disk_error(__G) + __GDEF +{ + /* OK to use slide[] here because this file is finished regardless */ + Info(slide, 0x4a1, ((char *)slide, LoadFarString(DiskFullQuery), + FnFilter1(G.filename))); + +#ifndef WINDLL + fgets(G.answerbuf, 9, stdin); + if (*G.answerbuf == 'y') /* stop writing to this file */ + G.disk_full = 1; /* (outfile bad?), but new OK */ + else +#endif + G.disk_full = 2; /* no: exit program */ + + return PK_DISK; + +} /* end function disk_error() */ + +#endif /* !VMS */ + + + + + +/*****************************/ +/* Function UzpMessagePrnt() */ +/*****************************/ + +int UZ_EXP UzpMessagePrnt(pG, buf, size, flag) + zvoid *pG; /* globals struct: always passed */ + uch *buf; /* preformatted string to be printed */ + ulg size; /* length of string (may include nulls) */ + int flag; /* flag bits */ +{ + /* IMPORTANT NOTE: + * The name of the first parameter of UzpMessagePrnt(), which passes + * the "Uz_Globs" address, >>> MUST <<< be identical to the string + * expansion of the __G__ macro in the REENTRANT case (see globals.h). + * This name identity is mandatory for the LoadFarString() macro + * (in the SMALL_MEM case) !!! + */ + int error; + uch *q=buf, *endbuf=buf+(unsigned)size; +#ifdef MORE + uch *p=buf-1; +#endif + FILE *outfp; + + +/*--------------------------------------------------------------------------- + These tests are here to allow fine-tuning of UnZip's output messages, + but none of them will do anything without setting the appropriate bit + in the flag argument of every Info() statement which is to be turned + *off*. That is, all messages are currently turned on for all ports. + To turn off *all* messages, use the UzpMessageNull() function instead + of this one. + ---------------------------------------------------------------------------*/ + +#if (defined(OS2) && defined(DLL)) + if (MSG_NO_DLL2(flag)) /* if OS/2 DLL bit is set, do NOT print this msg */ + return 0; +#endif +#ifdef WINDLL + if (MSG_NO_WDLL(flag)) + return 0; +#endif +#ifdef WINDLL + if (MSG_NO_WGUI(flag)) + return 0; +#endif +/* +#ifdef ACORN_GUI + if (MSG_NO_AGUI(flag)) + return 0; +#endif + */ +#ifdef DLL /* don't display message if data is redirected */ + if (((Uz_Globs *)pG)->redirect_data && + !((Uz_Globs *)pG)->redirect_text) + return 0; +#endif + + if (MSG_STDERR(flag) && !((Uz_Globs *)pG)->UzO.tflag) + outfp = (FILE *)stderr; + else + outfp = (FILE *)stdout; + +#ifdef QUERY_TRNEWLN + /* some systems require termination of query prompts with '\n' to force + * immediate display */ + if (MSG_MNEWLN(flag)) { /* assumes writable buffer (e.g., slide[]) */ + *endbuf++ = '\n'; /* with room for one more char at end of buf */ + ++size; /* (safe assumption: only used for four */ + } /* short queries in extract.c and fileio.c) */ +#endif + + if (MSG_TNEWLN(flag)) { /* again assumes writable buffer: fragile... */ + if ((!size && !((Uz_Globs *)pG)->sol) || + (size && (endbuf[-1] != '\n'))) + { + *endbuf++ = '\n'; + ++size; + } + } + +#ifdef MORE + /* room for --More-- and one line of overlap: */ + ((Uz_Globs *)pG)->height = SCREENLINES - 2; +#endif + + if (MSG_LNEWLN(flag) && !((Uz_Globs *)pG)->sol) { + /* not at start of line: want newline */ +#ifdef OS2DLL + if (!((Uz_Globs *)pG)->redirect_text) { +#endif + putc('\n', outfp); + fflush(outfp); +#ifdef MORE + if (((Uz_Globs *)pG)->M_flag) + { + ++((Uz_Globs *)pG)->numlines; + if (((Uz_Globs *)pG)->numlines % + ((Uz_Globs *)pG)->height == 0L) /* GRR: fix */ + (*((Uz_Globs *)pG)->mpause)((zvoid *)pG, + LoadFarString(MorePrompt), 1); + } +#endif /* MORE */ + if (MSG_STDERR(flag) && ((Uz_Globs *)pG)->UzO.tflag && + !isatty(1) && isatty(2)) + { + /* error output from testing redirected: also send to stderr */ + putc('\n', stderr); + fflush(stderr); + } +#ifdef OS2DLL + } else + REDIRECTC('\n'); +#endif + ((Uz_Globs *)pG)->sol = TRUE; + } + + /* put zipfile name, filename and/or error/warning keywords here */ + +#ifdef MORE + if (((Uz_Globs *)pG)->M_flag +#ifdef OS2DLL + && !((Uz_Globs *)pG)->redirect_text +#endif + ) + { + while (++p < endbuf) { + if (*p == '\n') { + ++((Uz_Globs *)pG)->numlines; + if (((Uz_Globs *)pG)->numlines % + ((Uz_Globs *)pG)->height == 0L) /* GRR: fix */ + { + if ((error = WriteError(q, p-q+1, outfp)) != 0) + return error; + fflush(outfp); + ((Uz_Globs *)pG)->sol = TRUE; + q = p + 1; + (*((Uz_Globs *)pG)->mpause)((zvoid *)pG, + LoadFarString(MorePrompt), 1); + } + } + } /* end while */ + size = (ulg)(p - q); /* remaining text */ + } +#endif /* MORE */ + + if (size) { +#ifdef OS2DLL + if (!((Uz_Globs *)pG)->redirect_text) { +#endif + if ((error = WriteError(q, size, outfp)) != 0) + return error; + fflush(outfp); + if (MSG_STDERR(flag) && ((Uz_Globs *)pG)->UzO.tflag && + !isatty(1) && isatty(2)) + { + /* error output from testing redirected: also send to stderr */ + if ((error = WriteError(q, size, stderr)) != 0) + return error; + fflush(stderr); + } +#ifdef OS2DLL + } else { /* GRR: this is ugly: hide with macro */ + if ((error = REDIRECTPRINT(q, size)) != 0) + return error; + } +#endif + ((Uz_Globs *)pG)->sol = (endbuf[-1] == '\n'); + } + return 0; + +} /* end function UzpMessagePrnt() */ + + + + + +#ifdef DLL + +/*****************************/ +/* Function UzpMessageNull() */ /* convenience routine for no output at all */ +/*****************************/ + +int UZ_EXP UzpMessageNull(pG, buf, size, flag) + zvoid *pG; /* globals struct: always passed */ + uch *buf; /* preformatted string to be printed */ + ulg size; /* length of string (may include nulls) */ + int flag; /* flag bits */ +{ + return 0; + +} /* end function UzpMessageNull() */ + +#endif /* DLL */ + + + + + +/***********************/ +/* Function UzpInput() */ /* GRR: this is a placeholder for now */ +/***********************/ + +int UZ_EXP UzpInput(pG, buf, size, flag) + zvoid *pG; /* globals struct: always passed */ + uch *buf; /* preformatted string to be printed */ + int *size; /* (address of) size of buf and of returned string */ + int flag; /* flag bits (bit 0: no echo) */ +{ + /* tell picky compilers to shut up about "unused variable" warnings */ + pG = pG; buf = buf; flag = flag; + + *size = 0; + return 0; + +} /* end function UzpInput() */ + + + + + +#if (!defined(WINDLL) && !defined(MACOS)) + +/***************************/ +/* Function UzpMorePause() */ +/***************************/ + +void UZ_EXP UzpMorePause(pG, prompt, flag) + zvoid *pG; /* globals struct: always passed */ + ZCONST char *prompt; /* "--More--" prompt */ + int flag; /* 0 = any char OK; 1 = accept only '\n', ' ', q */ + { +#if 0 + uch c; + +/*--------------------------------------------------------------------------- + Print a prompt and wait for the user to press a key, then erase prompt + if possible. + ---------------------------------------------------------------------------*/ + + if (!((Uz_Globs *)pG)->sol) + fprintf(stderr, "\n"); + /* numlines may or may not be used: */ + fprintf(stderr, prompt, ((Uz_Globs *)pG)->numlines); + fflush(stderr); + if (flag & 1) { + do { + c = (uch)FGETCH(0); + } while (c != '\r' && c != '\n' && c != ' ' && c != 'q' && c != 'Q'); + } else + c = (uch)FGETCH(0); + + /* newline was not echoed, so cover up prompt line */ + fprintf(stderr, LoadFarString(HidePrompt)); + fflush(stderr); + + if (ToLower(c) == 'q') { + DESTROYGLOBALS() + EXIT(PK_COOL); + } + + ((Uz_Globs *)pG)->sol = TRUE; + +#endif +} /* end function UzpMorePause() */ + +#endif /* !WINDLL && !MACOS */ + + + + +#ifndef WINDLL + +/**************************/ +/* Function UzpPassword() */ +/**************************/ + +int UZ_EXP UzpPassword (pG, rcnt, pwbuf, size, zfn, efn) + zvoid *pG; /* pointer to UnZip's internal global vars */ + int *rcnt; /* retry counter */ + char *pwbuf; /* buffer for password */ + int size; /* size of password buffer */ + ZCONST char *zfn; /* name of zip archive */ + ZCONST char *efn; /* name of archive entry being processed */ + { +#if CRYPT + int r = IZ_PW_ENTERED; + char *m; + char *prompt; + +#ifndef REENTRANT + /* tell picky compilers to shut up about "unused variable" warnings */ + pG = pG; +#endif + + if (*rcnt == 0) { /* First call for current entry */ + *rcnt = 2; + if ((prompt = (char *)malloc(2*FILNAMSIZ + 15)) != (char *)NULL) { + sprintf(prompt, LoadFarString(PasswPrompt), + FnFilter1(zfn), FnFilter2(efn)); + m = prompt; + } else + m = (char *)LoadFarString(PasswPrompt2); + } else { /* Retry call, previous password was wrong */ + (*rcnt)--; + prompt = NULL; + m = (char *)LoadFarString(PasswRetry); + } + + m = getp(__G__ m, pwbuf, size); + if (prompt != (char *)NULL) { + free(prompt); + } + if (m == (char *)NULL) { + r = IZ_PW_ERROR; + } + else if (*pwbuf == '\0') { + r = IZ_PW_CANCELALL; + } + return r; + +#else /* !CRYPT */ + /* tell picky compilers to shut up about "unused variable" warnings */ + pG = pG; rcnt = rcnt; pwbuf = pwbuf; size = size; zfn = zfn; efn = efn; + + return IZ_PW_ERROR; /* internal error; function should never get called */ +#endif /* ?CRYPT */ + +} /* end function UzpPassword() */ + + + + + +/**********************/ +/* Function handler() */ +/**********************/ + +void handler(signal) /* upon interrupt, turn on echo and exit cleanly */ + int signal; +{ + GETGLOBALS(); + +#if !(defined(SIGBUS) || defined(SIGSEGV)) /* add a newline if not at */ + (*G.message)((zvoid *)&G, slide, 0L, 0x41); /* start of line (to stderr; */ +#endif /* slide[] should be safe) */ + + echon(); + +#ifdef SIGBUS + if (signal == SIGBUS) { + Info(slide, 0x421, ((char *)slide, LoadFarString(ZipfileCorrupt), + "bus error")); + DESTROYGLOBALS() + EXIT(PK_BADERR); + } +#endif /* SIGBUS */ + +#ifdef SIGSEGV + if (signal == SIGSEGV) { + Info(slide, 0x421, ((char *)slide, LoadFarString(ZipfileCorrupt), + "segmentation violation")); + DESTROYGLOBALS() + EXIT(PK_BADERR); + } +#endif /* SIGSEGV */ + + /* probably ctrl-C */ + DESTROYGLOBALS() +#if defined(AMIGA) && defined(__SASC) + _abort(); +#endif + EXIT(IZ_CTRLC); /* was EXIT(0), then EXIT(PK_ERR) */ +} + +#endif /* !WINDLL */ + + + + +#if (!defined(VMS) && !defined(CMS_MVS)) +#if (!defined(OS2) || defined(TIMESTAMP)) + +#if (!defined(HAVE_MKTIME) || defined(AMIGA) || defined(WIN32)) +/* also used in amiga/filedate.c and win32/win32.c */ +ZCONST ush ydays[] = + { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; +#endif + +/*******************************/ +/* Function dos_to_unix_time() */ /* used for freshening/updating/timestamps */ +/*******************************/ + +time_t dos_to_unix_time(dosdatetime) + ulg dosdatetime; +{ + time_t m_time; + +#ifdef HAVE_MKTIME + + ZCONST time_t now = time(NULL); + struct tm *tm; +# define YRBASE 1900 + + tm = localtime(&now); + tm->tm_isdst = -1; /* let mktime determine if DST is in effect */ + + /* dissect date */ + tm->tm_year = ((int)(dosdatetime >> 25) & 0x7f) + (1980 - YRBASE); + tm->tm_mon = ((int)(dosdatetime >> 21) & 0x0f) - 1; + tm->tm_mday = ((int)(dosdatetime >> 16) & 0x1f); + + /* dissect time */ + tm->tm_hour = (int)((unsigned)dosdatetime >> 11) & 0x1f; + tm->tm_min = (int)((unsigned)dosdatetime >> 5) & 0x3f; + tm->tm_sec = (int)((unsigned)dosdatetime << 1) & 0x3e; + + m_time = mktime(tm); + NATIVE_TO_TIMET(m_time) /* NOP unless MSC 7.0 or Macintosh */ + TTrace((stderr, " final m_time = %lu\n", (ulg)m_time)); + +#else /* !HAVE_MKTIME */ + + int yr, mo, dy, hh, mm, ss; +#ifdef TOPS20 +# define YRBASE 1900 + struct tmx *tmx; + char temp[20]; +#else /* !TOPS20 */ +# define YRBASE 1970 + int leap; + unsigned days; + struct tm *tm; +#if (!defined(MACOS) && !defined(RISCOS) && !defined(QDOS) && !defined(TANDEM)) +#ifdef WIN32 + TIME_ZONE_INFORMATION tzinfo; + DWORD res; +#else /* ! WIN32 */ +#ifndef BSD4_4 /* GRR: change to !defined(MODERN) ? */ +#if (defined(BSD) || defined(MTS) || defined(__GO32__)) + struct timeb tbp; +#else /* !(BSD || MTS || __GO32__) */ +#ifdef DECLARE_TIMEZONE + extern time_t timezone; +#endif +#endif /* ?(BSD || MTS || __GO32__) */ +#endif /* !BSD4_4 */ +#endif /* ?WIN32 */ +#endif /* !MACOS && !RISCOS && !QDOS && !TANDEM */ +#endif /* ?TOPS20 */ + + + /* dissect date */ + yr = ((int)(dosdatetime >> 25) & 0x7f) + (1980 - YRBASE); + mo = ((int)(dosdatetime >> 21) & 0x0f) - 1; + dy = ((int)(dosdatetime >> 16) & 0x1f) - 1; + + /* dissect time */ + hh = (int)((unsigned)dosdatetime >> 11) & 0x1f; + mm = (int)((unsigned)dosdatetime >> 5) & 0x3f; + ss = (int)((unsigned)dosdatetime & 0x1f) * 2; + +#ifdef TOPS20 + tmx = (struct tmx *)malloc(sizeof(struct tmx)); + sprintf (temp, "%02d/%02d/%02d %02d:%02d:%02d", mo+1, dy+1, yr, hh, mm, ss); + time_parse(temp, tmx, (char *)0); + m_time = time_make(tmx); + free(tmx); + +#else /* !TOPS20 */ + +/*--------------------------------------------------------------------------- + Calculate the number of seconds since the epoch, usually 1 January 1970. + ---------------------------------------------------------------------------*/ + + /* leap = # of leap yrs from YRBASE up to but not including current year */ + leap = ((yr + YRBASE - 1) / 4); /* leap year base factor */ + + /* calculate days from BASE to this year and add expired days this year */ + days = (yr * 365) + (leap - 492) + ydays[mo]; + + /* if year is a leap year and month is after February, add another day */ + if ((mo > 1) && ((yr+YRBASE)%4 == 0) && ((yr+YRBASE) != 2100)) + ++days; /* OK through 2199 */ + + /* convert date & time to seconds relative to 00:00:00, 01/01/YRBASE */ + m_time = (time_t)((unsigned long)(days + dy) * 86400L + + (unsigned long)hh * 3600L + + (unsigned long)(mm * 60 + ss)); + /* - 1; MS-DOS times always rounded up to nearest even second */ + TTrace((stderr, "dos_to_unix_time:\n")); + TTrace((stderr, " m_time before timezone = %lu\n", (ulg)m_time)); + +/*--------------------------------------------------------------------------- + Adjust for local standard timezone offset. + ---------------------------------------------------------------------------*/ + +#if (!defined(MACOS) && !defined(RISCOS) && !defined(QDOS) && !defined(TANDEM)) +#ifdef WIN32 + /* account for timezone differences */ + res = GetTimeZoneInformation(&tzinfo); + if (res != TIME_ZONE_ID_UNKNOWN) + { + m_time += 60*(tzinfo.Bias); +#else /* !WIN32 */ +#if (defined(BSD) || defined(MTS) || defined(__GO32__)) +#ifdef BSD4_4 + if ( (dosdatetime >= DOSTIME_2038_01_18) && + (m_time < (time_t)0x70000000L) ) + m_time = U_TIME_T_MAX; /* saturate in case of (unsigned) overflow */ + if (m_time < (time_t)0L) /* a converted DOS time cannot be negative */ + m_time = S_TIME_T_MAX; /* -> saturate at max signed time_t value */ + if ((tm = localtime(&m_time)) != (struct tm *)NULL) + m_time -= tm->tm_gmtoff; /* sec. EAST of GMT: subtr. */ +#else /* !(BSD4_4 */ + ftime(&tbp); /* get `timezone' */ + m_time += tbp.timezone * 60L; /* seconds WEST of GMT: add */ +#endif /* ?(BSD4_4 || __EMX__) */ +#else /* !(BSD || MTS || __GO32__) */ + /* tzset was already called at start of process_zipfiles() */ + /* tzset(); */ /* set `timezone' variable */ +#ifndef __BEOS__ /* BeOS DR8 has no timezones... */ + m_time += timezone; /* seconds WEST of GMT: add */ +#endif +#endif /* ?(BSD || MTS || __GO32__) */ +#endif /* ?WIN32 */ + TTrace((stderr, " m_time after timezone = %lu\n", (ulg)m_time)); + +/*--------------------------------------------------------------------------- + Adjust for local daylight savings (summer) time. + ---------------------------------------------------------------------------*/ + +#ifndef BSD4_4 /* (DST already added to tm_gmtoff, so skip tm_isdst) */ + if ( (dosdatetime >= DOSTIME_2038_01_18) && + (m_time < (time_t)0x70000000L) ) + m_time = U_TIME_T_MAX; /* saturate in case of (unsigned) overflow */ + if (m_time < (time_t)0L) /* a converted DOS time cannot be negative */ + m_time = S_TIME_T_MAX; /* -> saturate at max signed time_t value */ + TIMET_TO_NATIVE(m_time) /* NOP unless MSC 7.0 or Macintosh */ + if (((tm = localtime((time_t *)&m_time)) != NULL) && tm->tm_isdst) +#ifdef WIN32 + m_time += 60L * tzinfo.DaylightBias; /* adjust with DST bias */ + else + m_time += 60L * tzinfo.StandardBias; /* add StdBias (normally 0) */ +#else + m_time -= 60L * 60L; /* adjust for daylight savings time */ +#endif + NATIVE_TO_TIMET(m_time) /* NOP unless MSC 7.0 or Macintosh */ + TTrace((stderr, " m_time after DST = %lu\n", (ulg)m_time)); +#endif /* !BSD4_4 */ +#ifdef WIN32 + } +#endif +#endif /* !MACOS && !RISCOS && !QDOS && !TANDEM */ +#endif /* ?TOPS20 */ + +#endif /* ?HAVE_MKTIME */ + + if ( (dosdatetime >= DOSTIME_2038_01_18) && + (m_time < (time_t)0x70000000L) ) + m_time = U_TIME_T_MAX; /* saturate in case of (unsigned) overflow */ + if (m_time < (time_t)0L) /* a converted DOS time cannot be negative */ + m_time = S_TIME_T_MAX; /* -> saturate at max signed time_t value */ + + return m_time; + +} /* end function dos_to_unix_time() */ + +#endif /* !OS2 || TIMESTAMP */ +#endif /* !VMS && !CMS_MVS */ + + + +#if (!defined(VMS) && !defined(OS2) && !defined(CMS_MVS)) + +/******************************/ +/* Function check_for_newer() */ /* used for overwriting/freshening/updating */ +/******************************/ + +int check_for_newer(__G__ filename) /* return 1 if existing file is newer */ + __GDEF /* or equal; 0 if older; -1 if doesn't */ + char *filename; /* exist yet */ +{ + time_t existing, archive; +#ifdef USE_EF_UT_TIME + iztimes z_utime; +#endif +#ifdef AOS_VS + long dyy, dmm, ddd, dhh, dmin, dss; + + + dyy = (lrec.last_mod_dos_datetime >> 25) + 1980; + dmm = (lrec.last_mod_dos_datetime >> 21) & 0x0f; + ddd = (lrec.last_mod_dos_datetime >> 16) & 0x1f; + dhh = (lrec.last_mod_dos_datetime >> 11) & 0x1f; + dmin = (lrec.last_mod_dos_datetime >> 5) & 0x3f; + dss = (lrec.last_mod_dos_datetime & 0x1f) * 2; + + /* under AOS/VS, file times can only be set at creation time, + * with the info in a special DG format. Make sure we can create + * it here - we delete it later & re-create it, whether or not + * it exists now. + */ + if (!zvs_create(filename, (((ulg)dgdate(dmm, ddd, dyy)) << 16) | + (dhh*1800L + dmin*30L + dss/2L), -1L, -1L, (char *) -1, -1, -1, -1)) + return DOES_NOT_EXIST; +#endif /* AOS_VS */ + + Trace((stderr, "check_for_newer: doing stat(%s)\n", FnFilter1(filename))); + if (SSTAT(filename, &G.statbuf)) { + Trace((stderr, + "check_for_newer: stat(%s) returns %d: file does not exist\n", + FnFilter1(filename), SSTAT(filename, &G.statbuf))); +#ifdef SYMLINKS + Trace((stderr, "check_for_newer: doing lstat(%s)\n", + FnFilter1(filename))); + /* GRR OPTION: could instead do this test ONLY if G.symlnk is true */ + if (lstat(filename, &G.statbuf) == 0) { + Trace((stderr, + "check_for_newer: lstat(%s) returns 0: symlink does exist\n", + FnFilter1(filename))); + if (QCOND2 && !uO.overwrite_all) + Info(slide, 0, ((char *)slide, LoadFarString(FileIsSymLink), + FnFilter1(filename), " with no real file")); + return EXISTS_AND_OLDER; /* symlink dates are meaningless */ + } +#endif /* SYMLINKS */ + return DOES_NOT_EXIST; + } + Trace((stderr, "check_for_newer: stat(%s) returns 0: file exists\n", + FnFilter1(filename))); + +#ifdef SYMLINKS + /* GRR OPTION: could instead do this test ONLY if G.symlnk is true */ + if (lstat(filename, &G.statbuf) == 0 && S_ISLNK(G.statbuf.st_mode)) { + Trace((stderr, "check_for_newer: %s is a symbolic link\n", + FnFilter1(filename))); + if (QCOND2 && !uO.overwrite_all) + Info(slide, 0, ((char *)slide, LoadFarString(FileIsSymLink), + FnFilter1(filename), "")); + return EXISTS_AND_OLDER; /* symlink dates are meaningless */ + } +#endif /* SYMLINKS */ + + NATIVE_TO_TIMET(G.statbuf.st_mtime) /* NOP unless MSC 7.0 or Macintosh */ + +#ifdef USE_EF_UT_TIME + /* The `Unix extra field mtime' should be used for comparison with the + * time stamp of the existing file >>>ONLY<<< when the EF info is also + * used to set the modification time of the extracted file. + */ + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0, + G.lrec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME)) + { + TTrace((stderr, "check_for_newer: using Unix extra field mtime\n")); + existing = G.statbuf.st_mtime; + archive = z_utime.mtime; + } else { + /* round up existing filetime to nearest 2 seconds for comparison, + * but saturate in case of arithmetic overflow + */ + existing = ((G.statbuf.st_mtime & 1) && + (G.statbuf.st_mtime + 1 > G.statbuf.st_mtime)) ? + G.statbuf.st_mtime + 1 : G.statbuf.st_mtime; + archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime); + } +#else /* !USE_EF_UT_TIME */ + /* round up existing filetime to nearest 2 seconds for comparison, + * but saturate in case of arithmetic overflow + */ + existing = ((G.statbuf.st_mtime & 1) && + (G.statbuf.st_mtime + 1 > G.statbuf.st_mtime)) ? + G.statbuf.st_mtime + 1 : G.statbuf.st_mtime; + archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime); +#endif /* ?USE_EF_UT_TIME */ + + TTrace((stderr, "check_for_newer: existing %lu, archive %lu, e-a %ld\n", + (ulg)existing, (ulg)archive, (long)(existing-archive))); + + return (existing >= archive); + +} /* end function check_for_newer() */ + +#endif /* !VMS && !OS2 && !CMS_MVS */ + + + + + +/************************/ +/* Function do_string() */ +/************************/ + +int do_string(__G__ len, option) /* return PK-type error code */ + __GDEF + unsigned int len; /* without prototype, ush converted to this */ + int option; +{ + long comment_bytes_left, block_length; + int error=PK_OK; + ush extra_len; +#ifdef AMIGA + char tmp_fnote[2 * AMIGA_FILENOTELEN]; /* extra room for squozen chars */ +#endif + + +/*--------------------------------------------------------------------------- + This function processes arbitrary-length (well, usually) strings. Four + options are allowed: SKIP, wherein the string is skipped (pretty logical, + eh?); DISPLAY, wherein the string is printed to standard output after un- + dergoing any necessary or unnecessary character conversions; DS_FN, + wherein the string is put into the filename[] array after undergoing ap- + propriate conversions (including case-conversion, if that is indicated: + see the global variable pInfo->lcflag); and EXTRA_FIELD, wherein the + `string' is assumed to be an extra field and is copied to the (freshly + malloced) buffer G.extra_field. The third option should be OK since + filename is dimensioned at 1025, but we check anyway. + + The string, by the way, is assumed to start at the current file-pointer + position; its length is given by len. So start off by checking length + of string: if zero, we're already done. + ---------------------------------------------------------------------------*/ + + if (!len) + return PK_COOL; + + switch (option) { + + /* + * First case: print string on standard output. First set loop vari- + * ables, then loop through the comment in chunks of OUTBUFSIZ bytes, + * converting formats and printing as we go. The second half of the + * loop conditional was added because the file might be truncated, in + * which case comment_bytes_left will remain at some non-zero value for + * all time. outbuf and slide are used as scratch buffers because they + * are available (we should be either before or in between any file pro- + * cessing). + */ + + case DISPLAY: + case DISPL_8: + comment_bytes_left = len; + block_length = OUTBUFSIZ; /* for the while statement, first time */ + while (comment_bytes_left > 0 && block_length > 0) { + register uch *p = G.outbuf; + register uch *q = G.outbuf; + + if ((block_length = readbuf(__G__ (char *)G.outbuf, + (unsigned) MIN((long)OUTBUFSIZ, comment_bytes_left))) == 0) + return PK_EOF; + comment_bytes_left -= block_length; + + /* this is why we allocated an extra byte for outbuf: terminate + * with zero (ASCIIZ) */ + G.outbuf[(unsigned)block_length] = '\0'; + + /* remove all ASCII carriage returns from comment before printing + * (since used before A_TO_N(), check for CR instead of '\r') + */ + while (*p) { + while (*p == CR) + ++p; + *q++ = *p++; + } + /* could check whether (p - outbuf) == block_length here */ + *q = '\0'; + + if (option == DISPL_8) { + /* translate the text coded in the entry's host-dependent + "extended ASCII" charset into the compiler's (system's) + internal text code page */ + Ext_ASCII_TO_Native((char *)G.outbuf, G.pInfo->hostnum, + G.crec.version_made_by[0]); +#ifdef WINDLL + /* translate to ANSI (RTL internal codepage may be OEM) */ + INTERN_TO_ISO((char *)G.outbuf, (char *)G.outbuf); +#else /* !WINDLL */ +#ifdef WIN32 + /* Win9x console always uses OEM character coding, and + WinNT console is set to OEM charset by default, too */ + INTERN_TO_OEM((char *)G.outbuf, (char *)G.outbuf); +#endif /* WIN32 */ +#endif /* ?WINDLL */ + } else { + A_TO_N(G.outbuf); /* translate string to native */ + } + +#ifdef WINDLL + /* ran out of local mem -- had to cheat */ + win_fprintf((zvoid *)&G, stdout, len, (char *)G.outbuf); + win_fprintf((zvoid *)&G, stdout, 2, (char *)"\n\n"); +#else /* !WINDLL */ +#ifdef NOANSIFILT /* GRR: can ANSI be used with EBCDIC? */ + (*G.message)((zvoid *)&G, G.outbuf, (ulg)(q-G.outbuf), 0); +#else /* ASCII, filter out ANSI escape sequences and handle ^S (pause) */ + p = G.outbuf - 1; + q = slide; + while (*++p) { + int pause = FALSE; + + if (*p == 0x1B) { /* ASCII escape char */ + *q++ = '^'; + *q++ = '['; + } else if (*p == 0x13) { /* ASCII ^S (pause) */ + pause = TRUE; + if (p[1] == LF) /* ASCII LF */ + *q++ = *++p; + else if (p[1] == CR && p[2] == LF) { /* ASCII CR LF */ + *q++ = *++p; + *q++ = *++p; + } + } else + *q++ = *p; + if ((unsigned)(q-slide) > WSIZE-3 || pause) { /* flush */ + (*G.message)((zvoid *)&G, slide, (ulg)(q-slide), 0); + q = slide; + if (pause && G.extract_flag) /* don't pause for list/test */ + (*G.mpause)((zvoid *)&G, LoadFarString(QuitPrompt), 0); + } + } + (*G.message)((zvoid *)&G, slide, (ulg)(q-slide), 0); +#endif /* ?NOANSIFILT */ +#endif /* ?WINDLL */ + } + /* add '\n' if not at start of line */ + (*G.message)((zvoid *)&G, slide, 0L, 0x40); + break; + + /* + * Second case: read string into filename[] array. The filename should + * never ever be longer than FILNAMSIZ-1 (1024), but for now we'll check, + * just to be sure. + */ + + case DS_FN: + extra_len = 0; + if (len >= FILNAMSIZ) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(FilenameTooLongTrunc))); + error = PK_WARN; + extra_len = (ush)(len - FILNAMSIZ + 1); + len = FILNAMSIZ - 1; + } + if (readbuf(__G__ G.filename, len) == 0) + return PK_EOF; + G.filename[len] = '\0'; /* terminate w/zero: ASCIIZ */ + + /* translate the Zip entry filename coded in host-dependent "extended + ASCII" into the compiler's (system's) internal text code page */ + Ext_ASCII_TO_Native(G.filename, G.pInfo->hostnum, + G.crec.version_made_by[0]); + + if (G.pInfo->lcflag) /* replace with lowercase filename */ + TOLOWER(G.filename, G.filename); + + if (G.pInfo->vollabel && len > 8 && G.filename[8] == '.') { + char *p = G.filename+8; + while (*p++) + p[-1] = *p; /* disk label, and 8th char is dot: remove dot */ + } + + if (!extra_len) /* we're done here */ + break; + + /* + * We truncated the filename, so print what's left and then fall + * through to the SKIP routine. + */ + Info(slide, 0x401, ((char *)slide, "[ %s ]\n", FnFilter1(G.filename))); + len = extra_len; + /* FALL THROUGH... */ + + /* + * Third case: skip string, adjusting readbuf's internal variables + * as necessary (and possibly skipping to and reading a new block of + * data). + */ + + case SKIP: + /* cur_zipfile_bufstart already takes account of extra_bytes, so don't + * correct for it twice: */ + ZLSEEK(G.cur_zipfile_bufstart - G.extra_bytes + + (G.inptr-G.inbuf) + len) + break; + + /* + * Fourth case: assume we're at the start of an "extra field"; malloc + * storage for it and read data into the allocated space. + */ + + case EXTRA_FIELD: + if (G.extra_field != (uch *)NULL) + free(G.extra_field); + if ((G.extra_field = (uch *)malloc(len)) == (uch *)NULL) { + Info(slide, 0x401, ((char *)slide, LoadFarString(ExtraFieldTooLong), + len)); + /* cur_zipfile_bufstart already takes account of extra_bytes, + * so don't correct for it twice: */ + ZLSEEK(G.cur_zipfile_bufstart - G.extra_bytes + + (G.inptr-G.inbuf) + len) + } else + if (readbuf(__G__ (char *)G.extra_field, len) == 0) + return PK_EOF; + break; + +#ifdef AMIGA + /* + * Fifth case, for the Amiga only: take the comment that would ordinarily + * be skipped over, and turn it into a 79 character string that will be + * attached to the file as a "filenote" after it is extracted. + */ + + case FILENOTE: + if ((extra_len = readbuf(__G__ tmp_fnote, (unsigned) + MIN(len, 2 * AMIGA_FILENOTELEN - 1))) == 0) + return PK_EOF; + if ((len -= extra_len) > 0) /* treat remainder as in case SKIP: */ + ZLSEEK(G.cur_zipfile_bufstart - G.extra_bytes + + (G.inptr - G.inbuf) + len) + /* convert multi-line text into single line with no ctl-chars: */ + tmp_fnote[extra_len] = '\0'; + while ((short int) --extra_len >= 0) + if ((unsigned) tmp_fnote[extra_len] < ' ') + if (tmp_fnote[extra_len+1] == ' ') /* no excess */ + strcpy(tmp_fnote+extra_len, tmp_fnote+extra_len+1); + else + tmp_fnote[extra_len] = ' '; + tmp_fnote[AMIGA_FILENOTELEN - 1] = '\0'; + if (G.filenotes[G.filenote_slot]) + free(G.filenotes[G.filenote_slot]); /* should not happen */ + G.filenotes[G.filenote_slot] = NULL; + if (tmp_fnote[0]) { + if (!(G.filenotes[G.filenote_slot] = malloc(strlen(tmp_fnote)+1))) + return PK_MEM; + strcpy(G.filenotes[G.filenote_slot], tmp_fnote); + } + break; +#endif /* AMIGA */ + + } /* end switch (option) */ + + return error; + +} /* end function do_string() */ + + + + + +/***********************/ +/* Function makeword() */ +/***********************/ + +ush makeword(b) + ZCONST uch *b; +{ + /* + * Convert Intel style 'short' integer to non-Intel non-16-bit + * host format. This routine also takes care of byte-ordering. + */ + return (ush)((b[1] << 8) | b[0]); +} + + + + + +/***********************/ +/* Function makelong() */ +/***********************/ + +ulg makelong(sig) + ZCONST uch *sig; +{ + /* + * Convert intel style 'long' variable to non-Intel non-16-bit + * host format. This routine also takes care of byte-ordering. + */ + return (((ulg)sig[3]) << 24) + + (((ulg)sig[2]) << 16) + + (((ulg)sig[1]) << 8) + + ((ulg)sig[0]); +} + + + +#if CRYPT + +#ifdef NEED_STR2ISO +/**********************/ +/* Function str2iso() */ +/**********************/ + +char *str2iso(dst, src) + char *dst; /* destination buffer */ + register ZCONST char *src; /* source string */ +{ +#ifdef INTERN_TO_ISO + INTERN_TO_ISO(src, dst); +#else + register uch c; + register char *dstp = dst; + + do { + c = (uch)foreign(*src++); + *dstp++ = (char)ASCII2ISO(c); + } while (c != '\0'); +#endif + + return dst; +} +#endif /* NEED_STR2ISO */ + + +#ifdef NEED_STR2OEM +/**********************/ +/* Function str2oem() */ +/**********************/ + +char *str2oem(dst, src) + char *dst; /* destination buffer */ + register ZCONST char *src; /* source string */ +{ +#ifdef INTERN_TO_OEM + INTERN_TO_OEM(src, dst); +#else + register uch c; + register char *dstp = dst; + + do { + c = (uch)foreign(*src++); + *dstp++ = (char)ASCII2OEM(c); + } while (c != '\0'); +#endif + + return dst; +} +#endif /* NEED_STR2OEM */ + +#endif /* CRYPT */ + + +#ifdef ZMEM /* memset/memcmp/memcpy for systems without either them or */ + /* bzero/bcmp/bcopy */ + /* (no known systems as of 960211) */ + +/*********************/ +/* Function memset() */ +/*********************/ + +zvoid *memset(buf, init, len) + register zvoid *buf; /* buffer location */ + register int init; /* initializer character */ + register unsigned int len; /* length of the buffer */ +{ + zvoid *start; + + start = buf; + while (len--) + *((char *)buf++) = (char)init; + return start; +} + + + +/*********************/ +/* Function memcmp() */ +/*********************/ + +int memcmp(b1, b2, len) + register ZCONST zvoid *b1; + register ZCONST zvoid *b2; + register unsigned int len; +{ + register int c; + + if (len > 0) do { + if ((c = (int)(*((ZCONST unsigned char *)b1)++) - + (int)(*((ZCONST unsigned char *)b2)++)) != 0) + return c; + } while (--len > 0) + return 0; +} + + + +/*********************/ +/* Function memcpy() */ +/*********************/ + +zvoid *memcpy(dst, src, len) + register zvoid *dst; + register ZCONST zvoid *src; + register unsigned int len; +{ + zvoid *start; + + start = dst; + while (len-- > 0) + *((char *)dst)++ = *((ZCONST char *)src)++; + return start; +} + +#endif /* ZMEM */ + + + + + +/************************/ +/* Function zstrnicmp() */ +/************************/ + +int zstrnicmp(s1, s2, n) + register ZCONST char *s1, *s2; + register unsigned n; +{ + for (; n > 0; --n, ++s1, ++s2) { + + if (ToLower(*s1) != ToLower(*s2)) + /* test includes early termination of one string */ + return (ToLower(*s1) < ToLower(*s2))? -1 : 1; + + if (*s1 == '\0') /* both strings terminate early */ + return 0; + } + return 0; +} + + + + + +#ifdef REGULUS /* returns the inode number on success(!)...argh argh argh */ +# undef stat + +/********************/ +/* Function zstat() */ +/********************/ + +int zstat(p, s) + char *p; + struct stat *s; +{ + return (stat(p,s) >= 0? 0 : (-1)); +} + +#endif /* REGULUS */ + + + + + +#ifdef SMALL_MEM + +/*******************************/ +/* Function fLoadFarString() */ /* (and friends...) */ +/*******************************/ + +char *fLoadFarString(__GPRO__ const char Far *sz) +{ + (void)zfstrcpy(G.rgchBigBuffer, sz); + return G.rgchBigBuffer; +} + +char *fLoadFarStringSmall(__GPRO__ const char Far *sz) +{ + (void)zfstrcpy(G.rgchSmallBuffer, sz); + return G.rgchSmallBuffer; +} + +char *fLoadFarStringSmall2(__GPRO__ const char Far *sz) +{ + (void)zfstrcpy(G.rgchSmallBuffer2, sz); + return G.rgchSmallBuffer2; +} + + + + +#if (!defined(_MSC_VER) || (_MSC_VER < 600)) +/*************************/ +/* Function zfstrcpy() */ /* portable clone of _fstrcpy() */ +/*************************/ + +char Far * Far zfstrcpy(char Far *s1, const char Far *s2) +{ + char Far *p = s1; + + while ((*s1++ = *s2++) != '\0'); + return p; +} +#endif /* !_MSC_VER || (_MSC_VER < 600) */ + +#endif /* SMALL_MEM */ diff --git a/utils/Install/packzip/funzip.c b/utils/Install/packzip/funzip.c new file mode 100644 index 0000000000..e83ae424d2 --- /dev/null +++ b/utils/Install/packzip/funzip.c @@ -0,0 +1,468 @@ +/* funzip.c -- put in the public domain by Mark Adler */ + +#define VERSION "3.93 of 21 November 1998" + + +/* You can do whatever you like with this source file, though I would + prefer that if you modify it and redistribute it that you include + comments to that effect with your name and the date. Thank you. + + History: + vers date who what + ---- --------- -------------- ------------------------------------ + 1.0 13 Aug 92 M. Adler really simple unzip filter. + 1.1 13 Aug 92 M. Adler cleaned up somewhat, give help if + stdin not redirected, warn if more + zip file entries after the first. + 1.2 15 Aug 92 M. Adler added check of lengths for stored + entries, added more help. + 1.3 16 Aug 92 M. Adler removed redundant #define's, added + decryption. + 1.4 27 Aug 92 G. Roelofs added exit(0). + 1.5 1 Sep 92 K. U. Rommel changed read/write modes for OS/2. + 1.6 6 Sep 92 G. Roelofs modified to use dummy crypt.c and + crypt.h instead of -DCRYPT. + 1.7 23 Sep 92 G. Roelofs changed to use DOS_OS2; included + crypt.c under MS-DOS. + 1.8 9 Oct 92 M. Adler improved inflation error msgs. + 1.9 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch; + renamed inflate_entry() to inflate(); + adapted to use new, in-place zdecode. + 2.0 22 Oct 92 M. Adler allow filename argument, prompt for + passwords and don't echo, still allow + command-line password entry, but as an + option. + 2.1 23 Oct 92 J-l. Gailly fixed crypt/store bug, + G. Roelofs removed crypt.c under MS-DOS, fixed + decryption check to compare single byte. + 2.2 28 Oct 92 G. Roelofs removed declaration of key. + 2.3 14 Dec 92 M. Adler replaced fseek (fails on stdin for SCO + Unix V.3.2.4). added quietflg for + inflate.c. + 3.0 11 May 93 M. Adler added gzip support + 3.1 9 Jul 93 K. U. Rommel fixed OS/2 pipe bug (PIPE_ERROR) + 3.2 4 Sep 93 G. Roelofs moved crc_32_tab[] to tables.h; used FOPx + from unzip.h; nuked OUTB macro and outbuf; + replaced flush(); inlined FlushOutput(); + renamed decrypt to encrypted + 3.3 29 Sep 93 G. Roelofs replaced ReadByte() with NEXTBYTE macro; + revised (restored?) flush(); added FUNZIP + 3.4 21 Oct 93 G. Roelofs renamed quietflg to qflag; changed outcnt, + H. Gessau second updcrc() arg and flush() arg to ulg; + added inflate_free(); added "g =" to null + getc(in) to avoid compiler warnings + 3.5 31 Oct 93 H. Gessau changed DOS_OS2 to DOS_NT_OS2 + 3.6 6 Dec 93 H. Gessau added "near" to mask_bits[] + 3.7 9 Dec 93 G. Roelofs added extent typecasts to fwrite() checks + 3.8 28 Jan 94 GRR/JlG initialized g variable in main() for gcc + 3.81 22 Feb 94 M. Hanning-Lee corrected usage message + 3.82 27 Feb 94 G. Roelofs added some typecasts to avoid warnings + 3.83 22 Jul 94 G. Roelofs changed fprintf to macro for DLLs + - 2 Aug 94 - public release with UnZip 5.11 + - 28 Aug 94 - public release with UnZip 5.12 + 3.84 1 Oct 94 K. U. Rommel changes for Metaware High C + 3.85 29 Oct 94 G. Roelofs changed fprintf macro to Info + 3.86 7 May 95 K. Davis RISCOS patches; + P. Kienitz Amiga patches + 3.87 12 Aug 95 G. Roelofs inflate_free(), DESTROYGLOBALS fixes + 3.88 4 Sep 95 C. Spieler reordered macro to work around MSC 5.1 bug + 3.89 22 Nov 95 PK/CS ifdef'd out updcrc() for ASM_CRC + 3.9 17 Dec 95 G. Roelofs modified for USE_ZLIB (new fillinbuf()) + - 30 Apr 96 - public release with UnZip 5.2 + 3.91 17 Aug 96 G. Roelofs main() -> return int (Peter Seebach) + 3.92 13 Apr 97 G. Roelofs minor cosmetic fixes to messages + - 22 Apr 97 - public release with UnZip 5.3 + - 31 May 97 - public release with UnZip 5.31 + 3.93 20 Sep 97 G. Roelofs minor cosmetic fixes to messages + - 3 Nov 97 - public release with UnZip 5.32 + - 28 Nov 98 - public release with UnZip 5.4 + */ + + +/* + + All funzip does is take a zipfile from stdin and decompress the + first entry to stdout. The entry has to be either deflated or + stored. If the entry is encrypted, then the decryption password + must be supplied on the command line as the first argument. + + funzip needs to be linked with inflate.o and crypt.o compiled from + the unzip source. If decryption is desired, the full version of + crypt.c (and crypt.h) from zcrypt21.zip or later must be used. + + */ + +#define FUNZIP +#define UNZIP_INTERNAL +#include "unzip.h" +#include "crypt.h" +#include "ttyio.h" + +#ifdef EBCDIC +# undef EBCDIC /* don't need ebcdic[] */ +#endif +#include "tables.h" /* crc_32_tab[] */ + +#ifndef USE_ZLIB /* zlib's function is called inflate(), too */ +# define UZinflate inflate +#endif + +/* PKZIP header definitions */ +#define ZIPMAG 0x4b50 /* two-byte zip lead-in */ +#define LOCREM 0x0403 /* remaining two bytes in zip signature */ +#define LOCSIG 0x04034b50L /* full signature */ +#define LOCFLG 4 /* offset of bit flag */ +#define CRPFLG 1 /* bit for encrypted entry */ +#define EXTFLG 8 /* bit for extended local header */ +#define LOCHOW 6 /* offset of compression method */ +#define LOCTIM 8 /* file mod time (for decryption) */ +#define LOCCRC 12 /* offset of crc */ +#define LOCSIZ 16 /* offset of compressed size */ +#define LOCLEN 20 /* offset of uncompressed length */ +#define LOCFIL 24 /* offset of file name field length */ +#define LOCEXT 26 /* offset of extra field length */ +#define LOCHDR 28 /* size of local header, including LOCREM */ +#define EXTHDR 16 /* size of extended local header, inc sig */ + +/* GZIP header definitions */ +#define GZPMAG 0x8b1f /* two-byte gzip lead-in */ +#define GZPHOW 0 /* offset of method number */ +#define GZPFLG 1 /* offset of gzip flags */ +#define GZPMUL 2 /* bit for multiple-part gzip file */ +#define GZPISX 4 /* bit for extra field present */ +#define GZPISF 8 /* bit for filename present */ +#define GZPISC 16 /* bit for comment present */ +#define GZPISE 32 /* bit for encryption */ +#define GZPTIM 2 /* offset of Unix file modification time */ +#define GZPEXF 6 /* offset of extra flags */ +#define GZPCOS 7 /* offset of operating system compressed on */ +#define GZPHDR 8 /* length of minimal gzip header */ + +/* Macros for getting two-byte and four-byte header values */ +#define SH(p) ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8)) +#define LG(p) ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16)) + +/* Function prototypes */ +void err OF((int, char *)); +int main OF((int, char **)); + +/* Globals */ +FILE *out; /* output file (*in moved to G struct) */ +ulg outsiz; /* total bytes written to out */ +int encrypted; /* flag to turn on decryption */ + +/* Masks for inflate.c */ +ZCONST ush near mask_bits[] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; + + +#ifdef USE_ZLIB + +int fillinbuf(__G) +__GDEF +/* Fill input buffer for pull-model inflate() in zlib. Return the number of + * bytes in inbuf. */ +{ +/* GRR: check return value from fread(): same as read()? check errno? */ + if ((G.incnt = fread((char *)G.inbuf, 1, INBUFSIZ, G.in)) <= 0) + return 0; + G.inptr = G.inbuf; + +#if CRYPT + if (encrypted) { + uch *p; + int n; + + for (n = G.incnt, p = G.inptr; n--; p++) + zdecode(*p); + } +#endif /* CRYPT */ + + return G.incnt; + +} + +#endif /* USE_ZLIB */ + + +#if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB)) +#ifdef USE_ZLIB +ZCONST uLongf *get_crc_table() +{ + return (ZCONST uLongf *)crc_32_tab; +} +#else /* !USE_ZLIB */ +ZCONST ulg near *get_crc_table() +{ + return crc_32_tab; +} +#endif /* ?USE_ZLIB */ +#endif /* !USE_ZLIB || USE_OWN_CRCTAB */ + + +void err(n, m) +int n; +char *m; +/* Exit on error with a message and a code */ +{ + Info(slide, 1, ((char *)slide, "funzip error: %s\n", m)); + DESTROYGLOBALS() + EXIT(n); +} + + +int flush(w) /* used by inflate.c (FLUSH macro) */ +ulg w; /* number of bytes to flush */ +{ + G.crc32val = crc32(G.crc32val, slide, (extent)w); + if (fwrite((char *)slide,1,(extent)w,out) != (extent)w && !PIPE_ERROR) + err(9, "out of space on stdout"); + outsiz += w; + return 0; +} + + +int main(argc, argv) +int argc; +char **argv; +/* Given a zipfile on stdin, decompress the first entry to stdout. */ +{ + ush n; + uch h[LOCHDR]; /* first local header (GZPHDR < LOCHDR) */ + int g = 0; /* true if gzip format */ +#if CRYPT + char *s = " [-password]"; + char *p; /* password */ +#else /* !CRYPT */ + char *s = ""; +#endif /* ?CRYPT */ + CONSTRUCTGLOBALS(); + + /* skip executable name */ + argc--; + argv++; + +#if CRYPT + /* get the command line password, if any */ + p = (char *)NULL; + if (argc && **argv == '-') + { + argc--; + p = 1 + *argv++; + } +#endif /* CRYPT */ + +#ifdef MALLOC_WORK + G.area.Slide = (uch *)calloc(8193, sizeof(short)+sizeof(char)+sizeof(char)); +#endif + + /* if no file argument and stdin not redirected, give the user help */ + if (argc == 0 && isatty(0)) + { + Info(slide, 1, ((char *)slide, "fUnZip (filter UnZip), version %s\n", + VERSION)); + Info(slide, 1, ((char *)slide, "usage: ... | funzip%s | ...\n", s)); + Info(slide, 1, ((char *)slide, " ... | funzip%s > outfile\n", s)); + Info(slide, 1, ((char *)slide, " funzip%s infile.zip > outfile\n",s)); + Info(slide, 1, ((char *)slide, " funzip%s infile.gz > outfile\n", s)); + Info(slide, 1, ((char *)slide, "Extracts to stdout the gzip file or first\ + zip entry of stdin or the given file.\n")); + DESTROYGLOBALS() + EXIT(3); + } + + /* prepare to be a binary filter */ + if (argc) + { + if ((G.in = fopen(*argv, FOPR)) == (FILE *)NULL) + err(2, "cannot find input file"); + } + else + { +#ifdef DOS_FLX_H68_OS2_W32 +#if (defined(__HIGHC__) && !defined(FLEXOS)) + setmode(stdin, _BINARY); +#else + setmode(0, O_BINARY); /* some buggy C libraries require BOTH setmode() */ +#endif /* call AND the fdopen() in binary mode :-( */ +#endif /* DOS_FLX_H68_OS2_W32 */ + +#ifdef RISCOS + G.in = stdin; +#else + if ((G.in = fdopen(0, FOPR)) == (FILE *)NULL) + err(2, "cannot find stdin"); +#endif + } + +#ifdef DOS_FLX_H68_OS2_W32 +#if (defined(__HIGHC__) && !defined(FLEXOS)) + setmode(stdout, _BINARY); +#else + setmode(1, O_BINARY); +#endif +#endif /* DOS_FLX_H68_OS2_W32 */ + +#ifdef RISCOS + out = stdout; +#else + if ((out = fdopen(1, FOPW)) == (FILE *)NULL) + err(2, "cannot write to stdout"); +#endif + + /* read local header, check validity, and skip name and extra fields */ + n = getc(G.in); n |= getc(G.in) << 8; + if (n == ZIPMAG) + { + if (fread((char *)h, 1, LOCHDR, G.in) != LOCHDR || SH(h) != LOCREM) + err(3, "invalid zipfile"); + if (SH(h + LOCHOW) != STORED && SH(h + LOCHOW) != DEFLATED) + err(3, "first entry not deflated or stored--cannot unpack"); + for (n = SH(h + LOCFIL); n--; ) g = getc(G.in); + for (n = SH(h + LOCEXT); n--; ) g = getc(G.in); + g = 0; + encrypted = h[LOCFLG] & CRPFLG; + } + else if (n == GZPMAG) + { + if (fread((char *)h, 1, GZPHDR, G.in) != GZPHDR) + err(3, "invalid gzip file"); + if (h[GZPHOW] != DEFLATED) + err(3, "gzip file not deflated"); + if (h[GZPFLG] & GZPMUL) + err(3, "cannot handle multi-part gzip files"); + if (h[GZPFLG] & GZPISX) + { + n = getc(G.in); n |= getc(G.in) << 8; + while (n--) g = getc(G.in); + } + if (h[GZPFLG] & GZPISF) + while ((g = getc(G.in)) != 0 && g != EOF) ; + if (h[GZPFLG] & GZPISC) + while ((g = getc(G.in)) != 0 && g != EOF) ; + g = 1; + encrypted = h[GZPFLG] & GZPISE; + } + else + err(3, "input not a zip or gzip file"); + + /* if entry encrypted, decrypt and validate encryption header */ + if (encrypted) +#if CRYPT + { + ush i, e; + + if (p == (char *)NULL) { + if ((p = (char *)malloc(IZ_PWLEN+1)) == (char *)NULL) + err(1, "out of memory"); + else if ((p = getp("Enter password: ", p, IZ_PWLEN+1)) == (char *)NULL) + err(1, "no tty to prompt for password"); + } +#if (defined(USE_ZLIB) && !defined(USE_OWN_CRCTAB)) + /* initialize crc_32_tab pointer for decryption */ + CRC_32_TAB = (ZCONST ulg Far *)get_crc_table(); +#endif + init_keys(p); + for (i = 0; i < RAND_HEAD_LEN; i++) + e = NEXTBYTE; + if (e != (ush)(h[LOCFLG] & EXTFLG ? h[LOCTIM + 1] : h[LOCCRC + 3])) + err(3, "incorrect password for first entry"); + } +#else /* !CRYPT */ + err(3, "cannot decrypt entry (need to recompile with full crypt.c)"); +#endif /* ?CRYPT */ + + /* prepare output buffer and crc */ + G.outptr = slide; + G.outcnt = 0L; + outsiz = 0L; + G.crc32val = CRCVAL_INITIAL; + + /* decompress */ + if (g || h[LOCHOW]) + { /* deflated entry */ + int r; + +#ifdef USE_ZLIB + /* need to allocate and prepare input buffer */ + if ((G.inbuf = (uch *)malloc(INBUFSIZ)) == (uch *)NULL) + err(1, "out of memory"); +#endif /* USE_ZLIB */ + if ((r = UZinflate(__G)) != 0) { + if (r == 3) + err(1, "out of memory"); + else + err(4, "invalid compressed data--format violated"); + } + inflate_free(__G); + } + else + { /* stored entry */ + register ulg n; + + n = LG(h + LOCLEN); +#if CRYPT + if (n != LG(h + LOCSIZ) - (encrypted ? RAND_HEAD_LEN : 0)) { +#else + if (n != LG(h + LOCSIZ)) { +#endif + Info(slide, 1, ((char *)slide, "len %ld, siz %ld\n", n, LG(h + LOCSIZ))); + err(4, "invalid compressed data--length mismatch"); + } + while (n--) { + ush c = getc(G.in); +#if CRYPT + if (encrypted) + zdecode(c); +#endif + *G.outptr++ = (uch)c; + if (++G.outcnt == WSIZE) /* do FlushOutput() */ + { + G.crc32val = crc32(G.crc32val, slide, (extent)G.outcnt); + if (fwrite((char *)slide, 1,(extent)G.outcnt,out) != (extent)G.outcnt + && !PIPE_ERROR) + err(9, "out of space on stdout"); + outsiz += G.outcnt; + G.outptr = slide; + G.outcnt = 0L; + } + } + } + if (G.outcnt) /* flush one last time; no need to reset G.outptr/outcnt */ + { + G.crc32val = crc32(G.crc32val, slide, (extent)G.outcnt); + if (fwrite((char *)slide, 1,(extent)G.outcnt,out) != (extent)G.outcnt + && !PIPE_ERROR) + err(9, "out of space on stdout"); + outsiz += G.outcnt; + } + fflush(out); + + /* if extended header, get it */ + if (g) + { + if (fread((char *)h + LOCCRC, 1, 8, G.in) != 8) + err(3, "gzip file ended prematurely"); + } + else + if ((h[LOCFLG] & EXTFLG) && + fread((char *)h + LOCCRC - 4, 1, EXTHDR, G.in) != EXTHDR) + err(3, "zipfile ended prematurely"); + + /* validate decompression */ + if (LG(h + LOCCRC) != G.crc32val) + err(4, "invalid compressed data--crc error"); + if (LG((g ? (h + LOCSIZ) : (h + LOCLEN))) != outsiz) + err(4, "invalid compressed data--length error"); + + /* check if there are more entries */ + if (!g && fread((char *)h, 1, 4, G.in) == 4 && LG(h) == LOCSIG) + Info(slide, 1, ((char *)slide, + "funzip warning: zipfile has more than one entry--rest ignored\n")); + + DESTROYGLOBALS() + RETURN (0); +} diff --git a/utils/Install/packzip/globals.c b/utils/Install/packzip/globals.c new file mode 100644 index 0000000000..d795090b98 --- /dev/null +++ b/utils/Install/packzip/globals.c @@ -0,0 +1,204 @@ +/*--------------------------------------------------------------------------- + + globals.c + + Routines to allocate and initialize globals, with or without threads. + + Contents: registerGlobalPointer() + deregisterGlobalPointer() + getGlobalPointer() + globalsCtor() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" + +#ifndef FUNZIP +/* initialization of sigs is completed at runtime so unzip(sfx) executable + * won't look like a zipfile + */ +char central_hdr_sig[4] = {0, 0, 0x01, 0x02}; +char local_hdr_sig[4] = {0, 0, 0x03, 0x04}; +char end_central_sig[4] = {0, 0, 0x05, 0x06}; +/* extern char extd_local_sig[4] = {0, 0, 0x07, 0x08}; NOT USED YET */ + +ZCONST char *fnames[2] = {"*", NULL}; /* default filenames vector */ +#endif + + +#ifndef REENTRANT + Uz_Globs G; +#else /* REENTRANT */ + +# ifndef USETHREADID + Uz_Globs *GG; +# else /* USETHREADID */ +# define THREADID_ENTRIES 0x40 + + int lastScan; + Uz_Globs *threadPtrTable[THREADID_ENTRIES]; + ulg threadIdTable [THREADID_ENTRIES] = { + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* Make sure there are */ + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* THREADID_ENTRIES 0s */ + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 + }; + + static ZCONST char Far TooManyThreads[] = + "error: more than %d simultaneous threads.\n\ + Some threads are probably not calling DESTROYTHREAD()\n"; + static ZCONST char Far EntryNotFound[] = + "error: couldn't find global pointer in table.\n\ + Maybe somebody accidentally called DESTROYTHREAD() twice.\n"; + static ZCONST char Far GlobalPointerMismatch[] = + "error: global pointer in table does not match pointer passed as\ + parameter\n"; + +static void registerGlobalPointer OF((__GPRO)); + + + +static void registerGlobalPointer(__G) + __GDEF +{ + int scan=0; + ulg tid = GetThreadId(); + + while (threadIdTable[scan] && scan < THREADID_ENTRIES) + scan++; + + if (scan == THREADID_ENTRIES) { + ZCONST char *tooMany = LoadFarString(TooManyThreads); + Info(slide, 0x421, ((char *)slide, tooMany, THREADID_ENTRIES)); + free(pG); + EXIT(PK_MEM); /* essentially memory error before we've started */ + } + + threadIdTable [scan] = tid; + threadPtrTable[scan] = pG; + lastScan = scan; +} + + + +void deregisterGlobalPointer(__G) + __GDEF +{ + int scan=0; + ulg tid = GetThreadId(); + + + while (threadIdTable[scan] != tid && scan < THREADID_ENTRIES) + scan++; + +/*--------------------------------------------------------------------------- + There are two things we can do if we can't find the entry: ignore it or + scream. The most likely reason for it not to be here is the user calling + this routine twice. Since this could cause BIG problems if any globals + are accessed after the first call, we'd better scream. + ---------------------------------------------------------------------------*/ + + if (scan == THREADID_ENTRIES || threadPtrTable[scan] != pG) { + ZCONST char *noEntry; + if (scan == THREADID_ENTRIES) + noEntry = LoadFarString(EntryNotFound); + else + noEntry = LoadFarString(GlobalPointerMismatch); + Info(slide, 0x421, ((char *)slide, noEntry)); + EXIT(PK_WARN); /* programming error, but after we're all done */ + } + + threadIdTable [scan] = 0; + lastScan = scan; + free(threadPtrTable[scan]); +} + + + +Uz_Globs *getGlobalPointer() +{ + int scan=0; + ulg tid = GetThreadId(); + + while (threadIdTable[scan] != tid && scan < THREADID_ENTRIES) + scan++; + +/*--------------------------------------------------------------------------- + There are two things we can do if we can't find the entry: ignore it or + scream. The most likely reason for it not to be here is the user calling + this routine twice. Since this could cause BIG problems if any globals + are accessed after the first call, we'd better scream. + ---------------------------------------------------------------------------*/ + + if (scan == THREADID_ENTRIES) { + ZCONST char *noEntry = LoadFarString(EntryNotFound); + fprintf(stderr, noEntry); /* can't use Info w/o a global pointer */ + EXIT(PK_ERR); /* programming error while still working */ + } + + return threadPtrTable[scan]; +} + +# endif /* ?USETHREADID */ +#endif /* ?REENTRANT */ + + + +Uz_Globs *globalsCtor() +{ +#ifdef REENTRANT + Uz_Globs *pG = (Uz_Globs *)malloc(sizeof(Uz_Globs)); + + if (!pG) + return (Uz_Globs *)NULL; +#endif /* REENTRANT */ + + /* for REENTRANT version, G is defined as (*pG) */ + + memzero(&G, sizeof(Uz_Globs)); + +#ifndef FUNZIP +#ifdef CMS_MVS + uO.aflag=1; + uO.C_flag=1; +#endif + + uO.lflag=(-1); + G.wildzipfn = ""; + G.pfnames = (char **)fnames; + G.pxnames = (char **)&fnames[1]; + G.pInfo = G.info; + G.sol = TRUE; /* at start of line */ + + G.message = UzpMessagePrnt; + G.input = UzpInput; /* not used by anyone at the moment... */ +#if defined(WINDLL) || defined(MACOS) + G.mpause = NULL; /* has scrollbars: no need for pausing */ +#else + G.mpause = UzpMorePause; +#endif + G.decr_passwd = UzpPassword; +#endif /* !FUNZIP */ + +#if (!defined(DOS_FLX_H68_OS2_W32) && !defined(AMIGA) && !defined(RISCOS)) +#if (!defined(MACOS) && !defined(ATARI) && !defined(VMS)) + G.echofd = -1; +#endif /* !(MACOS || ATARI || VMS) */ +#endif /* !(DOS_FLX_H68_OS2_W32 || AMIGA || RISCOS) */ + +#ifdef SYSTEM_SPECIFIC_CTOR + SYSTEM_SPECIFIC_CTOR(__G); +#endif + +#ifdef REENTRANT +#ifdef USETHREADID + registerGlobalPointer(__G); +#else + GG = &G; +#endif /* ?USETHREADID */ +#endif /* REENTRANT */ + + return &G; +} diff --git a/utils/Install/packzip/inflate.c b/utils/Install/packzip/inflate.c new file mode 100644 index 0000000000..29877300d2 --- /dev/null +++ b/utils/Install/packzip/inflate.c @@ -0,0 +1,1305 @@ +/* inflate.c -- put in the public domain by Mark Adler + version c16b, 29 March 1998 */ + + +/* You can do whatever you like with this source file, though I would + prefer that if you modify it and redistribute it that you include + comments to that effect with your name and the date. Thank you. + + History: + vers date who what + ---- --------- -------------- ------------------------------------ + a ~~ Feb 92 M. Adler used full (large, one-step) lookup table + b1 21 Mar 92 M. Adler first version with partial lookup tables + b2 21 Mar 92 M. Adler fixed bug in fixed-code blocks + b3 22 Mar 92 M. Adler sped up match copies, cleaned up some + b4 25 Mar 92 M. Adler added prototypes; removed window[] (now + is the responsibility of unzip.h--also + changed name to slide[]), so needs diffs + for unzip.c and unzip.h (this allows + compiling in the small model on MSDOS); + fixed cast of q in huft_build(); + b5 26 Mar 92 M. Adler got rid of unintended macro recursion. + b6 27 Mar 92 M. Adler got rid of nextbyte() routine. fixed + bug in inflate_fixed(). + c1 30 Mar 92 M. Adler removed lbits, dbits environment variables. + changed BMAX to 16 for explode. Removed + OUTB usage, and replaced it with flush()-- + this was a 20% speed improvement! Added + an explode.c (to replace unimplod.c) that + uses the huft routines here. Removed + register union. + c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k. + c3 10 Apr 92 M. Adler reduced memory of code tables made by + huft_build significantly (factor of two to + three). + c4 15 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy(). + worked around a Turbo C optimization bug. + c5 21 Apr 92 M. Adler added the WSIZE #define to allow reducing + the 32K window size for specialized + applications. + c6 31 May 92 M. Adler added some typecasts to eliminate warnings + c7 27 Jun 92 G. Roelofs added some more typecasts (444: MSC bug). + c8 5 Oct 92 J-l. Gailly added ifdef'd code to deal with PKZIP bug. + c9 9 Oct 92 M. Adler removed a memory error message (~line 416). + c10 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch, + removed old inflate, renamed inflate_entry + to inflate, added Mark's fix to a comment. + c10.5 14 Dec 92 M. Adler fix up error messages for incomplete trees. + c11 2 Jan 93 M. Adler fixed bug in detection of incomplete + tables, and removed assumption that EOB is + the longest code (bad assumption). + c12 3 Jan 93 M. Adler make tables for fixed blocks only once. + c13 5 Jan 93 M. Adler allow all zero length codes (pkzip 2.04c + outputs one zero length code for an empty + distance tree). + c14 12 Mar 93 M. Adler made inflate.c standalone with the + introduction of inflate.h. + c14b 16 Jul 93 G. Roelofs added (unsigned) typecast to w at 470. + c14c 19 Jul 93 J. Bush changed v[N_MAX], l[288], ll[28x+3x] arrays + to static for Amiga. + c14d 13 Aug 93 J-l. Gailly de-complicatified Mark's c[*p++]++ thing. + c14e 8 Oct 93 G. Roelofs changed memset() to memzero(). + c14f 22 Oct 93 G. Roelofs renamed quietflg to qflag; made Trace() + conditional; added inflate_free(). + c14g 28 Oct 93 G. Roelofs changed l/(lx+1) macro to pointer (Cray bug) + c14h 7 Dec 93 C. Ghisler huft_build() optimizations. + c14i 9 Jan 94 A. Verheijen set fixed_t{d,l} to NULL after freeing; + G. Roelofs check NEXTBYTE macro for EOF. + c14j 23 Jan 94 G. Roelofs removed Ghisler "optimizations"; ifdef'd + EOF check. + c14k 27 Feb 94 G. Roelofs added some typecasts to avoid warnings. + c14l 9 Apr 94 G. Roelofs fixed split comments on preprocessor lines + to avoid bug in Encore compiler. + c14m 7 Jul 94 P. Kienitz modified to allow assembler version of + inflate_codes() (define ASM_INFLATECODES) + c14n 22 Jul 94 G. Roelofs changed fprintf to macro for DLL versions + c14o 23 Aug 94 C. Spieler added a newline to a debug statement; + G. Roelofs added another typecast to avoid MSC warning + c14p 4 Oct 94 G. Roelofs added (voidp *) cast to free() argument + c14q 30 Oct 94 G. Roelofs changed fprintf macro to MESSAGE() + c14r 1 Nov 94 G. Roelofs fixed possible redefinition of CHECK_EOF + c14s 7 May 95 S. Maxwell OS/2 DLL globals stuff incorporated; + P. Kienitz "fixed" ASM_INFLATECODES macro/prototype + c14t 18 Aug 95 G. Roelofs added UZinflate() to use zlib functions; + changed voidp to zvoid; moved huft_build() + and huft_free() to end of file + c14u 1 Oct 95 G. Roelofs moved G into definition of MESSAGE macro + c14v 8 Nov 95 P. Kienitz changed ASM_INFLATECODES to use a regular + call with __G__ instead of a macro + c15 3 Aug 96 M. Adler fixed bomb-bug on random input data (Adobe) + c15b 24 Aug 96 M. Adler more fixes for random input data + c15c 28 Mar 97 G. Roelofs changed USE_ZLIB fatal exit code from + PK_MEM2 to PK_MEM3 + c16 20 Apr 97 J. Altman added memzero(v[]) in huft_build() + c16b 29 Mar 98 C. Spieler modified DLL code for slide redirection + */ + + +/* + Inflate deflated (PKZIP's method 8 compressed) data. The compression + method searches for as much of the current string of bytes (up to a + length of 258) in the previous 32K bytes. If it doesn't find any + matches (of at least length 3), it codes the next byte. Otherwise, it + codes the length of the matched string and its distance backwards from + the current position. There is a single Huffman code that codes both + single bytes (called "literals") and match lengths. A second Huffman + code codes the distance information, which follows a length code. Each + length or distance code actually represents a base value and a number + of "extra" (sometimes zero) bits to get to add to the base value. At + the end of each deflated block is a special end-of-block (EOB) literal/ + length code. The decoding process is basically: get a literal/length + code; if EOB then done; if a literal, emit the decoded byte; if a + length then get the distance and emit the referred-to bytes from the + sliding window of previously emitted data. + + There are (currently) three kinds of inflate blocks: stored, fixed, and + dynamic. The compressor outputs a chunk of data at a time and decides + which method to use on a chunk-by-chunk basis. A chunk might typically + be 32K to 64K, uncompressed. If the chunk is uncompressible, then the + "stored" method is used. In this case, the bytes are simply stored as + is, eight bits per byte, with none of the above coding. The bytes are + preceded by a count, since there is no longer an EOB code. + + If the data are compressible, then either the fixed or dynamic methods + are used. In the dynamic method, the compressed data are preceded by + an encoding of the literal/length and distance Huffman codes that are + to be used to decode this block. The representation is itself Huffman + coded, and so is preceded by a description of that code. These code + descriptions take up a little space, and so for small blocks, there is + a predefined set of codes, called the fixed codes. The fixed method is + used if the block ends up smaller that way (usually for quite small + chunks); otherwise the dynamic method is used. In the latter case, the + codes are customized to the probabilities in the current block and so + can code it much better than the pre-determined fixed codes can. + + The Huffman codes themselves are decoded using a multi-level table + lookup, in order to maximize the speed of decoding plus the speed of + building the decoding tables. See the comments below that precede the + lbits and dbits tuning parameters. + + GRR: return values(?) + 0 OK + 1 incomplete table + 2 bad input + 3 not enough memory + */ + + +/* + Notes beyond the 1.93a appnote.txt: + + 1. Distance pointers never point before the beginning of the output + stream. + 2. Distance pointers can point back across blocks, up to 32k away. + 3. There is an implied maximum of 7 bits for the bit length table and + 15 bits for the actual data. + 4. If only one code exists, then it is encoded using one bit. (Zero + would be more efficient, but perhaps a little confusing.) If two + codes exist, they are coded using one bit each (0 and 1). + 5. There is no way of sending zero distance codes--a dummy must be + sent if there are none. (History: a pre 2.0 version of PKZIP would + store blocks with no distance codes, but this was discovered to be + too harsh a criterion.) Valid only for 1.93a. 2.04c does allow + zero distance codes, which is sent as one code of zero bits in + length. + 6. There are up to 286 literal/length codes. Code 256 represents the + end-of-block. Note however that the static length tree defines + 288 codes just to fill out the Huffman codes. Codes 286 and 287 + cannot be used though, since there is no length base or extra bits + defined for them. Similarily, there are up to 30 distance codes. + However, static trees define 32 codes (all 5 bits) to fill out the + Huffman codes, but the last two had better not show up in the data. + 7. Unzip can check dynamic Huffman blocks for complete code sets. + The exception is that a single code would not be complete (see #4). + 8. The five bits following the block type is really the number of + literal codes sent minus 257. + 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits + (1+6+6). Therefore, to output three times the length, you output + three codes (1+1+1), whereas to output four times the same length, + you only need two codes (1+3). Hmm. + 10. In the tree reconstruction algorithm, Code = Code + Increment + only if BitLength(i) is not zero. (Pretty obvious.) + 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) + 12. Note: length code 284 can represent 227-258, but length code 285 + really is 258. The last length deserves its own, short code + since it gets used a lot in very redundant files. The length + 258 is special since 258 - 3 (the min match length) is 255. + 13. The literal/length and distance code bit lengths are read as a + single stream of lengths. It is possible (and advantageous) for + a repeat code (16, 17, or 18) to go across the boundary between + the two sets of lengths. + */ + + +#define PKZIP_BUG_WORKAROUND /* PKZIP 1.93a problem--live with it */ + +/* + inflate.h must supply the uch slide[WSIZE] array, the zvoid typedef + (void if (void *) is accepted, else char) and the NEXTBYTE, + FLUSH() and memzero macros. If the window size is not 32K, it + should also define WSIZE. If INFMOD is defined, it can include + compiled functions to support the NEXTBYTE and/or FLUSH() macros. + There are defaults for NEXTBYTE and FLUSH() below for use as + examples of what those functions need to do. Normally, you would + also want FLUSH() to compute a crc on the data. inflate.h also + needs to provide these typedefs: + + typedef unsigned char uch; + typedef unsigned short ush; + typedef unsigned long ulg; + + This module uses the external functions malloc() and free() (and + probably memset() or bzero() in the memzero() macro). Their + prototypes are normally found in <string.h> and <stdlib.h>. + */ + +/* #define DEBUG */ +#define INFMOD /* tell inflate.h to include code to be compiled */ +#include "inflate.h" + + +#ifndef WSIZE /* default is 32K */ +# define WSIZE 0x8000 /* window size--must be a power of two, and at least */ +#endif /* 32K for zip's deflate method */ + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) +# define wsize G._wsize /* wsize is a variable */ +#else +# define wsize WSIZE /* wsize is a constant */ +#endif + + +#ifndef NEXTBYTE /* default is to simply get a byte from stdin */ +# define NEXTBYTE getchar() +#endif + +#ifndef MESSAGE /* only used twice, for fixed strings--NOT general-purpose */ +# define MESSAGE(str,len,flag) pipeit((char *)(str)) +#endif + +#ifndef FLUSH /* default is to simply write the buffer to stdout */ +# define FLUSH(n) fwrite(redirSlide, 1, n, stdout) /* return value not used */ +#endif +/* Warning: the fwrite above might not work on 16-bit compilers, since + 0x8000 might be interpreted as -32,768 by the library function. */ + +#ifndef Trace +# ifdef DEBUG +# define Trace(x) fprintf x +# else +# define Trace(x) +# endif +#endif + + +/*---------------------------------------------------------------------------*/ +#ifdef USE_ZLIB + + +/* + GRR: return values for both original inflate() and UZinflate() + 0 OK + 1 incomplete table(?) + 2 bad input + 3 not enough memory + */ + +/**************************/ +/* Function UZinflate() */ +/**************************/ + +int UZinflate(__G) /* decompress an inflated entry using the zlib routines */ + __GDEF +{ + int err=Z_OK; + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) + wsize = G.redirect_size, redirSlide = G.redirect_buffer; + else + wsize = WSIZE, redirSlide = slide; +#endif + + G.dstrm.next_out = redirSlide; + G.dstrm.avail_out = wsize; + + G.dstrm.next_in = G.inptr; + G.dstrm.avail_in = G.incnt; + + if (!G.inflInit) { + unsigned i; + int windowBits; + + /* only need to test this stuff once */ + if (zlib_version[0] != ZLIB_VERSION[0]) { + Info(slide, 0x21, ((char *)slide, + "error: incompatible zlib version (expected %s, found %s)\n", + ZLIB_VERSION, zlib_version)); + return 3; + } else if (strcmp(zlib_version, ZLIB_VERSION) != 0) + Info(slide, 0x21, ((char *)slide, + "warning: different zlib version (expected %s, using %s)\n", + ZLIB_VERSION, zlib_version)); + + /* windowBits = log2(wsize) */ + for (i = ((unsigned)wsize * 2 - 1), windowBits = 0; + !(i & 1); i >>= 1, ++windowBits); + if ((unsigned)windowBits > (unsigned)15) + windowBits = 15; + else if (windowBits < 8) + windowBits = 8; + + G.dstrm.zalloc = (alloc_func)Z_NULL; + G.dstrm.zfree = (free_func)Z_NULL; + + Trace((stderr, "initializing inflate()\n")); + err = inflateInit2(&G.dstrm, -windowBits); + + if (err == Z_MEM_ERROR) + return 3; + else if (err != Z_OK) + Trace((stderr, "oops! (inflateInit2() err = %d)\n", err)); + G.inflInit = 1; + } + +#ifdef FUNZIP + while (err != Z_STREAM_END) { +#else /* !FUNZIP */ + while (G.csize > 0) { + Trace((stderr, "first loop: G.csize = %ld\n", G.csize)); +#endif /* ?FUNZIP */ + while (G.dstrm.avail_out > 0) { + err = inflate(&G.dstrm, Z_PARTIAL_FLUSH); + + if (err == Z_DATA_ERROR) + return 2; + else if (err == Z_MEM_ERROR) + return 3; + else if (err != Z_OK && err != Z_STREAM_END) + Trace((stderr, "oops! (inflate(first loop) err = %d)\n", err)); + +#ifdef FUNZIP + if (err == Z_STREAM_END) /* "END-of-entry-condition" ? */ +#else /* !FUNZIP */ + if (G.csize <= 0L) /* "END-of-entry-condition" ? */ +#endif /* ?FUNZIP */ + break; + + if (G.dstrm.avail_in <= 0) { + if (fillinbuf(__G) == 0) + return 2; /* no "END-condition" yet, but no more data */ + + G.dstrm.next_in = G.inptr; + G.dstrm.avail_in = G.incnt; + } + Trace((stderr, " avail_in = %d\n", G.dstrm.avail_in)); + } + FLUSH(wsize - G.dstrm.avail_out); /* flush slide[] */ + Trace((stderr, "inside loop: flushing %ld bytes (ptr diff = %ld)\n", + (long)(wsize - G.dstrm.avail_out), + (long)(G.dstrm.next_out-(Bytef *)redirSlide))); + G.dstrm.next_out = redirSlide; + G.dstrm.avail_out = wsize; + } + + /* no more input, so loop until we have all output */ + Trace((stderr, "beginning final loop: err = %d\n", err)); + while (err != Z_STREAM_END) { + err = inflate(&G.dstrm, Z_PARTIAL_FLUSH); + if (err == Z_DATA_ERROR) + return 2; + else if (err == Z_MEM_ERROR) + return 3; + else if (err == Z_BUF_ERROR) { /* DEBUG */ + Trace((stderr, "zlib inflate() did not detect stream end (%s, %s)\n" + , G.zipfn, G.filename)); + break; + } else if (err != Z_OK && err != Z_STREAM_END) { + Trace((stderr, "oops! (inflate(final loop) err = %d)\n", err)); + DESTROYGLOBALS() + EXIT(PK_MEM3); + } + FLUSH(wsize - G.dstrm.avail_out); /* final flush of slide[] */ + Trace((stderr, "final loop: flushing %ld bytes (ptr diff = %ld)\n", + (long)(wsize - G.dstrm.avail_out), + (long)(G.dstrm.next_out-(Bytef *)redirSlide))); + G.dstrm.next_out = redirSlide; + G.dstrm.avail_out = wsize; + } + Trace((stderr, "total in = %ld, total out = %ld\n", G.dstrm.total_in, + G.dstrm.total_out)); + + G.inptr = (uch *)G.dstrm.next_in; + G.incnt = (G.inbuf + INBUFSIZ) - G.inptr; /* reset for other routines */ + + err = inflateReset(&G.dstrm); + if (err != Z_OK) + Trace((stderr, "oops! (inflateReset() err = %d)\n", err)); + + return 0; +} + + +/*---------------------------------------------------------------------------*/ +#else /* !USE_ZLIB */ + + +/* Function prototypes */ +#ifndef OF +# ifdef __STDC__ +# define OF(a) a +# else +# define OF(a) () +# endif +#endif /* !OF */ +int inflate_codes OF((__GPRO__ struct huft *tl, struct huft *td, + int bl, int bd)); +static int inflate_stored OF((__GPRO)); +static int inflate_fixed OF((__GPRO)); +static int inflate_dynamic OF((__GPRO)); +static int inflate_block OF((__GPRO__ int *e)); + + +/* The inflate algorithm uses a sliding 32K byte window on the uncompressed + stream to find repeated byte strings. This is implemented here as a + circular buffer. The index is updated simply by incrementing and then + and'ing with 0x7fff (32K-1). */ +/* It is left to other modules to supply the 32K area. It is assumed + to be usable as if it were declared "uch slide[32768];" or as just + "uch *slide;" and then malloc'ed in the latter case. The definition + must be in unzip.h, included above. */ + + +/* unsigned wp; moved to globals.h */ /* current position in slide */ + + +/* Tables for deflate from PKZIP's appnote.txt. */ +static ZCONST unsigned border[] = { /* Order of the bit length code lengths */ + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; +static ZCONST ush cplens[] = { /* Copy lengths for literal codes 257..285 */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + /* note: see note #13 above about the 258 in this list. */ +static ZCONST ush cplext[] = { /* Extra bits for literal codes 257..285 */ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */ +static ZCONST ush cpdist[] = { /* Copy offsets for distance codes 0..29 */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577}; +static ZCONST ush cpdext[] = { /* Extra bits for distance codes */ + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, + 12, 12, 13, 13}; + + +/* moved to consts.h (included in unzip.c), resp. funzip.c */ +#if 0 +/* And'ing with mask_bits[n] masks the lower n bits */ +ZCONST ush near mask_bits[] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; +#endif /* 0 */ + + +/* Macros for inflate() bit peeking and grabbing. + The usage is: + + NEEDBITS(j) + x = b & mask_bits[j]; + DUMPBITS(j) + + where NEEDBITS makes sure that b has at least j bits in it, and + DUMPBITS removes the bits from b. The macros use the variable k + for the number of bits in b. Normally, b and k are register + variables for speed and are initialized at the begining of a + routine that uses these macros from a global bit buffer and count. + + In order to not ask for more bits than there are in the compressed + stream, the Huffman tables are constructed to only ask for just + enough bits to make up the end-of-block code (value 256). Then no + bytes need to be "returned" to the buffer at the end of the last + block. See the huft_build() routine. + */ + +/* These have been moved to globals.h */ +#if 0 +ulg bb; /* bit buffer */ +unsigned bk; /* bits in bit buffer */ +#endif + +#ifndef CHECK_EOF +# define CHECK_EOF /* default as of 5.13/5.2 */ +#endif + +#ifndef CHECK_EOF +# define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE)<<k;k+=8;}} +#else +# define NEEDBITS(n) {while(k<(n)){int c=NEXTBYTE;if(c==EOF)return 1;\ + b|=((ulg)c)<<k;k+=8;}} +#endif /* Piet Plomp: change "return 1" to "break" */ + +#define DUMPBITS(n) {b>>=(n);k-=(n);} + + +/* + Huffman code decoding is performed using a multi-level table lookup. + The fastest way to decode is to simply build a lookup table whose + size is determined by the longest code. However, the time it takes + to build this table can also be a factor if the data being decoded + are not very long. The most common codes are necessarily the + shortest codes, so those codes dominate the decoding time, and hence + the speed. The idea is you can have a shorter table that decodes the + shorter, more probable codes, and then point to subsidiary tables for + the longer codes. The time it costs to decode the longer codes is + then traded against the time it takes to make longer tables. + + This results of this trade are in the variables lbits and dbits + below. lbits is the number of bits the first level table for literal/ + length codes can decode in one step, and dbits is the same thing for + the distance codes. Subsequent tables are also less than or equal to + those sizes. These values may be adjusted either when all of the + codes are shorter than that, in which case the longest code length in + bits is used, or when the shortest code is *longer* than the requested + table size, in which case the length of the shortest code in bits is + used. + + There are two different values for the two tables, since they code a + different number of possibilities each. The literal/length table + codes 286 possible values, or in a flat code, a little over eight + bits. The distance table codes 30 possible values, or a little less + than five bits, flat. The optimum values for speed end up being + about one bit more than those, so lbits is 8+1 and dbits is 5+1. + The optimum values may differ though from machine to machine, and + possibly even between compilers. Your mileage may vary. + */ + + +static ZCONST int lbits = 9; /* bits in base literal/length lookup table */ +static ZCONST int dbits = 6; /* bits in base distance lookup table */ + + +#ifndef ASM_INFLATECODES + +int inflate_codes(__G__ tl, td, bl, bd) + __GDEF +struct huft *tl, *td; /* literal/length and distance decoder tables */ +int bl, bd; /* number of bits decoded by tl[] and td[] */ +/* inflate (decompress) the codes in a deflated (compressed) block. + Return an error code or zero if it all goes ok. */ +{ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + + /* make local copies of globals */ + b = G.bb; /* initialize bit buffer */ + k = G.bk; + w = G.wp; /* initialize window position */ + + + /* inflate the coded data */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + while (1) /* do until end of block */ + { + NEEDBITS((unsigned)bl) + if ((e = (t = tl + ((unsigned)b & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + if (e == 16) /* then it's a literal */ + { + redirSlide[w++] = (uch)t->v.n; + if (w == wsize) + { + FLUSH(w); + w = 0; + } + } + else /* it's an EOB or a length */ + { + /* exit if end of block */ + if (e == 15) + break; + + /* get length of block to copy */ + NEEDBITS(e) + n = t->v.n + ((unsigned)b & mask_bits[e]); + DUMPBITS(e); + + /* decode distance of block to copy */ + NEEDBITS((unsigned)bd) + if ((e = (t = td + ((unsigned)b & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + NEEDBITS(e) + d = w - t->v.n - ((unsigned)b & mask_bits[e]); + DUMPBITS(e) + + /* do the copy */ + do { +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) {/* &= w/ wsize unnecessary & wrong if redirect */ + if (d >= wsize) + return 1; /* invalid compressed data */ + n -= (e = (e = wsize - (d > w ? d : w)) > n ? n : e); + } + else +#endif + n -= (e = (e = wsize - ((d &= wsize-1) > w ? d : w)) > n ? n : e); +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slowly to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == wsize) + { + FLUSH(w); + w = 0; + } + } while (n); + } + } + + + /* restore the globals from the locals */ + G.wp = w; /* restore global window pointer */ + G.bb = b; /* restore global bit buffer */ + G.bk = k; + + + /* done */ + return 0; +} + +#endif /* ASM_INFLATECODES */ + + + +static int inflate_stored(__G) + __GDEF +/* "decompress" an inflated type 0 (stored) block. */ +{ + unsigned n; /* number of bytes in block */ + unsigned w; /* current window position */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + + /* make local copies of globals */ + Trace((stderr, "\nstored block")); + b = G.bb; /* initialize bit buffer */ + k = G.bk; + w = G.wp; /* initialize window position */ + + + /* go to byte boundary */ + n = k & 7; + DUMPBITS(n); + + + /* get the length and its complement */ + NEEDBITS(16) + n = ((unsigned)b & 0xffff); + DUMPBITS(16) + NEEDBITS(16) + if (n != (unsigned)((~b) & 0xffff)) + return 1; /* error in compressed data */ + DUMPBITS(16) + + + /* read and output the compressed data */ + while (n--) + { + NEEDBITS(8) + redirSlide[w++] = (uch)b; + if (w == wsize) + { + FLUSH(w); + w = 0; + } + DUMPBITS(8) + } + + + /* restore the globals from the locals */ + G.wp = w; /* restore global window pointer */ + G.bb = b; /* restore global bit buffer */ + G.bk = k; + return 0; +} + + +/* Globals for literal tables (built once) */ +/* Moved to globals.h */ +#if 0 +struct huft *fixed_tl = (struct huft *)NULL; +struct huft *fixed_td; +int fixed_bl, fixed_bd; +#endif + +static int inflate_fixed(__G) + __GDEF +/* decompress an inflated type 1 (fixed Huffman codes) block. We should + either replace this with a custom decoder, or at least precompute the + Huffman tables. */ +{ + /* if first time, set up tables for fixed blocks */ + Trace((stderr, "\nliteral block")); + if (G.fixed_tl == (struct huft *)NULL) + { + int i; /* temporary variable */ + unsigned l[288]; /* length list for huft_build */ + + /* literal table */ + for (i = 0; i < 144; i++) + l[i] = 8; + for (; i < 256; i++) + l[i] = 9; + for (; i < 280; i++) + l[i] = 7; + for (; i < 288; i++) /* make a complete, but wrong code set */ + l[i] = 8; + G.fixed_bl = 7; + if ((i = huft_build(__G__ l, 288, 257, cplens, cplext, + &G.fixed_tl, &G.fixed_bl)) != 0) + { + G.fixed_tl = (struct huft *)NULL; + return i; + } + + /* distance table */ + for (i = 0; i < 30; i++) /* make an incomplete code set */ + l[i] = 5; + G.fixed_bd = 5; + if ((i = huft_build(__G__ l, 30, 0, cpdist, cpdext, + &G.fixed_td, &G.fixed_bd)) > 1) + { + huft_free(G.fixed_tl); + G.fixed_tl = (struct huft *)NULL; + return i; + } + } + + /* decompress until an end-of-block code */ + return inflate_codes(__G__ G.fixed_tl, G.fixed_td, + G.fixed_bl, G.fixed_bd) != 0; +} + + + +static int inflate_dynamic(__G) + __GDEF +/* decompress an inflated type 2 (dynamic Huffman codes) block. */ +{ + int i; /* temporary variables */ + unsigned j; + unsigned l; /* last length */ + unsigned m; /* mask for bit lengths table */ + unsigned n; /* number of lengths to get */ + struct huft *tl; /* literal/length code table */ + struct huft *td; /* distance code table */ + int bl; /* lookup bits for tl */ + int bd; /* lookup bits for td */ + unsigned nb; /* number of bit length codes */ + unsigned nl; /* number of literal/length codes */ + unsigned nd; /* number of distance codes */ +#ifdef PKZIP_BUG_WORKAROUND + unsigned ll[288+32]; /* literal/length and distance code lengths */ +#else + unsigned ll[286+30]; /* literal/length and distance code lengths */ +#endif + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + + /* make local bit buffer */ + Trace((stderr, "\ndynamic block")); + b = G.bb; + k = G.bk; + + + /* read in table lengths */ + NEEDBITS(5) + nl = 257 + ((unsigned)b & 0x1f); /* number of literal/length codes */ + DUMPBITS(5) + NEEDBITS(5) + nd = 1 + ((unsigned)b & 0x1f); /* number of distance codes */ + DUMPBITS(5) + NEEDBITS(4) + nb = 4 + ((unsigned)b & 0xf); /* number of bit length codes */ + DUMPBITS(4) +#ifdef PKZIP_BUG_WORKAROUND + if (nl > 288 || nd > 32) +#else + if (nl > 286 || nd > 30) +#endif + return 1; /* bad lengths */ + + + /* read in bit-length-code lengths */ + for (j = 0; j < nb; j++) + { + NEEDBITS(3) + ll[border[j]] = (unsigned)b & 7; + DUMPBITS(3) + } + for (; j < 19; j++) + ll[border[j]] = 0; + + + /* build decoding table for trees--single level, 7 bit lookup */ + bl = 7; + i = huft_build(__G__ ll, 19, 19, NULL, NULL, &tl, &bl); + if (bl == 0) /* no bit lengths */ + i = 1; + if (i) + { + if (i == 1) + huft_free(tl); + return i; /* incomplete code set */ + } + + + /* read in literal and distance code lengths */ + n = nl + nd; + m = mask_bits[bl]; + i = l = 0; + while ((unsigned)i < n) + { + NEEDBITS((unsigned)bl) + j = (td = tl + ((unsigned)b & m))->b; + DUMPBITS(j) + j = td->v.n; + if (j < 16) /* length of code in bits (0..15) */ + ll[i++] = l = j; /* save last length in l */ + else if (j == 16) /* repeat last length 3 to 6 times */ + { + NEEDBITS(2) + j = 3 + ((unsigned)b & 3); + DUMPBITS(2) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = l; + } + else if (j == 17) /* 3 to 10 zero length codes */ + { + NEEDBITS(3) + j = 3 + ((unsigned)b & 7); + DUMPBITS(3) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = 0; + l = 0; + } + else /* j == 18: 11 to 138 zero length codes */ + { + NEEDBITS(7) + j = 11 + ((unsigned)b & 0x7f); + DUMPBITS(7) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = 0; + l = 0; + } + } + + + /* free decoding table for trees */ + huft_free(tl); + + + /* restore the global bit buffer */ + G.bb = b; + G.bk = k; + + + /* build the decoding tables for literal/length and distance codes */ + bl = lbits; + i = huft_build(__G__ ll, nl, 257, cplens, cplext, &tl, &bl); + if (bl == 0) /* no literals or lengths */ + i = 1; + if (i) + { + if (i == 1) { + if (!uO.qflag) + MESSAGE((uch *)"(incomplete l-tree) ", 21L, 1); + huft_free(tl); + } + return i; /* incomplete code set */ + } + bd = dbits; + i = huft_build(__G__ ll + nl, nd, 0, cpdist, cpdext, &td, &bd); + if (bd == 0 && nl > 257) /* lengths but no distances */ + { + if (!uO.qflag) + MESSAGE((uch *)"(incomplete d-tree) ", 21L, 1); + huft_free(tl); + return 1; + } + if (i == 1) { +#ifdef PKZIP_BUG_WORKAROUND + i = 0; +#else + if (!uO.qflag) + MESSAGE((uch *)"(incomplete d-tree) ", 21L, 1); + huft_free(td); +#endif + } + if (i) + { + huft_free(tl); + return i; + } + + + /* decompress until an end-of-block code */ + if (inflate_codes(__G__ tl, td, bl, bd)) + return 1; + + + /* free the decoding tables, return */ + huft_free(tl); + huft_free(td); + return 0; +} + + + +static int inflate_block(__G__ e) + __GDEF + int *e; /* last block flag */ +/* decompress an inflated block */ +{ + unsigned t; /* block type */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + + /* make local bit buffer */ + b = G.bb; + k = G.bk; + + + /* read in last block bit */ + NEEDBITS(1) + *e = (int)b & 1; + DUMPBITS(1) + + + /* read in block type */ + NEEDBITS(2) + t = (unsigned)b & 3; + DUMPBITS(2) + + + /* restore the global bit buffer */ + G.bb = b; + G.bk = k; + + + /* inflate that block type */ + if (t == 2) + return inflate_dynamic(__G); + if (t == 0) + return inflate_stored(__G); + if (t == 1) + return inflate_fixed(__G); + + + /* bad block type */ + return 2; +} + + + +int inflate(__G) + __GDEF +/* decompress an inflated entry */ +{ + int e; /* last block flag */ + int r; /* result code */ +#ifdef DEBUG + unsigned h = 0; /* maximum struct huft's malloc'ed */ +#endif + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) + wsize = G.redirect_size, redirSlide = G.redirect_buffer; + else + wsize = WSIZE, redirSlide = slide; /* how they're #defined if !DLL */ +#endif + + /* initialize window, bit buffer */ + G.wp = 0; + G.bk = 0; + G.bb = 0; + + + /* decompress until the last block */ + do { +#ifdef DEBUG + G.hufts = 0; +#endif + if ((r = inflate_block(__G__ &e)) != 0) + return r; +#ifdef DEBUG + if (G.hufts > h) + h = G.hufts; +#endif + } while (!e); + + + /* flush out redirSlide */ + FLUSH(G.wp); + + + /* return success */ + Trace((stderr, "\n%u bytes in Huffman tables (%d/entry)\n", + h * sizeof(struct huft), sizeof(struct huft))); + return 0; +} + + + +int inflate_free(__G) + __GDEF +{ + if (G.fixed_tl != (struct huft *)NULL) + { + huft_free(G.fixed_td); + huft_free(G.fixed_tl); + G.fixed_td = G.fixed_tl = (struct huft *)NULL; + } + return 0; +} + +#endif /* ?USE_ZLIB */ + + +/* + * GRR: moved huft_build() and huft_free() down here; used by explode() + * and fUnZip regardless of whether USE_ZLIB defined or not + */ + + +/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ +#define BMAX 16 /* maximum bit length of any code (16 for explode) */ +#define N_MAX 288 /* maximum number of codes in any set */ + + +int huft_build(__G__ b, n, s, d, e, t, m) + __GDEF + ZCONST unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ + unsigned n; /* number of codes (assumed <= N_MAX) */ + unsigned s; /* number of simple-valued codes (0..s-1) */ + ZCONST ush *d; /* list of base values for non-simple codes */ + ZCONST ush *e; /* list of extra bits for non-simple codes */ + struct huft **t; /* result: starting table */ + int *m; /* maximum lookup bits, returns actual */ +/* Given a list of code lengths and a maximum table size, make a set of + tables to decode that set of codes. Return zero on success, one if + the given code set is incomplete (the tables are still built in this + case), two if the input is invalid (all zero length codes or an + oversubscribed set of lengths), and three if not enough memory. + The code with value 256 is special, and the tables are constructed + so that no bits beyond that code are fetched when that code is + decoded. */ +{ + unsigned a; /* counter for codes of length k */ + unsigned c[BMAX+1]; /* bit length count table */ + unsigned el; /* length of EOB code (value 256) */ + unsigned f; /* i repeats in table every f entries */ + int g; /* maximum code length */ + int h; /* table level */ + register unsigned i; /* counter, current code */ + register unsigned j; /* counter */ + register int k; /* number of bits in current code */ + int lx[BMAX+1]; /* memory for l[-1..BMAX-1] */ + int *l = lx+1; /* stack of bits per table */ + register unsigned *p; /* pointer into c[], b[], or v[] */ + register struct huft *q; /* points to current table */ + struct huft r; /* table entry for structure assignment */ + struct huft *u[BMAX]; /* table stack */ + unsigned v[N_MAX]; /* values in order of bit length */ + register int w; /* bits before this table == (l * h) */ + unsigned x[BMAX+1]; /* bit offsets, then code stack */ + unsigned *xp; /* pointer into x */ + int y; /* number of dummy codes added */ + unsigned z; /* number of entries in current table */ + + + /* Generate counts for each bit length */ + el = n > 256 ? b[256] : BMAX; /* set length of EOB code, if any */ + memzero((char *)c, sizeof(c)); + p = (unsigned *)b; i = n; + do { + c[*p]++; p++; /* assume all entries <= BMAX */ + } while (--i); + if (c[0] == n) /* null input--all zero length codes */ + { + *t = (struct huft *)NULL; + *m = 0; + return 0; + } + + + /* Find minimum and maximum length, bound *m by those */ + for (j = 1; j <= BMAX; j++) + if (c[j]) + break; + k = j; /* minimum code length */ + if ((unsigned)*m < j) + *m = j; + for (i = BMAX; i; i--) + if (c[i]) + break; + g = i; /* maximum code length */ + if ((unsigned)*m > i) + *m = i; + + + /* Adjust last length count to fill out codes, if needed */ + for (y = 1 << j; j < i; j++, y <<= 1) + if ((y -= c[j]) < 0) + return 2; /* bad input: more codes than bits */ + if ((y -= c[i]) < 0) + return 2; + c[i] += y; + + + /* Generate starting offsets into the value table for each length */ + x[1] = j = 0; + p = c + 1; xp = x + 2; + while (--i) { /* note that i == g from above */ + *xp++ = (j += *p++); + } + + + /* Make a table of values in order of bit lengths */ + memzero((char *)v, sizeof(v)); + p = (unsigned *)b; i = 0; + do { + if ((j = *p++) != 0) + v[x[j]++] = i; + } while (++i < n); + n = x[g]; /* set n to length of v */ + + + /* Generate the Huffman codes and for each, make the table entries */ + x[0] = i = 0; /* first Huffman code is zero */ + p = v; /* grab values in bit order */ + h = -1; /* no tables yet--level -1 */ + w = l[-1] = 0; /* no bits decoded yet */ + u[0] = (struct huft *)NULL; /* just to keep compilers happy */ + q = (struct huft *)NULL; /* ditto */ + z = 0; /* ditto */ + + /* go through the bit lengths (k already is bits in shortest code) */ + for (; k <= g; k++) + { + a = c[k]; + while (a--) + { + /* here i is the Huffman code of length k bits for value *p */ + /* make tables up to required level */ + while (k > w + l[h]) + { + w += l[h++]; /* add bits already decoded */ + + /* compute minimum size table less than or equal to *m bits */ + z = (z = g - w) > (unsigned)*m ? *m : z; /* upper limit */ + if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ + { /* too few codes for k-w bit table */ + f -= a + 1; /* deduct codes from patterns left */ + xp = c + k; + while (++j < z) /* try smaller tables up to z bits */ + { + if ((f <<= 1) <= *++xp) + break; /* enough codes to use up j bits */ + f -= *xp; /* else deduct codes from patterns */ + } + } + if ((unsigned)w + j > el && (unsigned)w < el) + j = el - w; /* make EOB code end at table */ + z = 1 << j; /* table entries for j-bit table */ + l[h] = j; /* set table size in stack */ + + /* allocate and link in new table */ + if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) == + (struct huft *)NULL) + { + if (h) + huft_free(u[0]); + return 3; /* not enough memory */ + } +#ifdef DEBUG + G.hufts += z + 1; /* track memory usage */ +#endif + *t = q + 1; /* link to list for huft_free() */ + *(t = &(q->v.t)) = (struct huft *)NULL; + u[h] = ++q; /* table starts after link */ + + /* connect to last table, if there is one */ + if (h) + { + x[h] = i; /* save pattern for backing up */ + r.b = (uch)l[h-1]; /* bits to dump before this table */ + r.e = (uch)(16 + j); /* bits in this table */ + r.v.t = q; /* pointer to this table */ + j = (i & ((1 << w) - 1)) >> (w - l[h-1]); + u[h-1][j] = r; /* connect to last table */ + } + } + + /* set up table entry in r */ + r.b = (uch)(k - w); + if (p >= v + n) + r.e = 99; /* out of values--invalid code */ + else if (*p < s) + { + r.e = (uch)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ + r.v.n = (ush)*p++; /* simple code is just the value */ + } + else + { + r.e = (uch)e[*p - s]; /* non-simple--look up in lists */ + r.v.n = d[*p++ - s]; + } + + /* fill code-like entries with r */ + f = 1 << (k - w); + for (j = i >> w; j < z; j += f) + q[j] = r; + + /* backwards increment the k-bit code i */ + for (j = 1 << (k - 1); i & j; j >>= 1) + i ^= j; + i ^= j; + + /* backup over finished tables */ + while ((i & ((1 << w) - 1)) != x[h]) + w -= l[--h]; /* don't need to update q */ + } + } + + + /* return actual size of base table */ + *m = l[0]; + + + /* Return true (1) if we were given an incomplete table */ + return y != 0 && g != 1; +} + + + +int huft_free(t) +struct huft *t; /* table to free */ +/* Free the malloc'ed tables built by huft_build(), which makes a linked + list of the tables it made, with the links in a dummy first entry of + each table. */ +{ + register struct huft *p, *q; + + + /* Go through linked list, freeing from the malloced (t[-1]) address. */ + p = t; + while (p != (struct huft *)NULL) + { + q = (--p)->v.t; + free((zvoid *)p); + p = q; + } + return 0; +} diff --git a/utils/Install/packzip/list.c b/utils/Install/packzip/list.c new file mode 100644 index 0000000000..60fa4dc044 --- /dev/null +++ b/utils/Install/packzip/list.c @@ -0,0 +1,649 @@ +/*--------------------------------------------------------------------------- + + list.c + + This file contains the non-ZipInfo-specific listing routines for UnZip. + + Contains: list_files() + get_time_stamp() [optional feature] + ratio() + fnprint() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" +#ifdef WINDLL +# ifdef POCKET_UNZIP +# include "wince/intrface.h" +# else +# include "windll/windll.h" +# endif +#endif + + +#ifdef TIMESTAMP + static int fn_is_dir OF((__GPRO)); +#endif + +#ifndef WINDLL + static ZCONST char Far CompFactorStr[] = "%c%d%%"; + static ZCONST char Far CompFactor100[] = "100%%"; + +#ifdef OS2_EAS + static ZCONST char Far HeadersS[] = + " Length EAs ACLs Date Time Name"; + static ZCONST char Far HeadersS1[] = + " -------- --- ---- ---- ---- ----"; +#else + static ZCONST char Far HeadersS[] = " Length Date Time Name"; + static ZCONST char Far HeadersS1[] = " -------- ---- ---- ----"; +#endif + + static ZCONST char Far HeadersL[] = + " Length Method Size Ratio Date Time CRC-32 Name"; + static ZCONST char Far HeadersL1[] = + "-------- ------ ------- ----- ---- ---- ------ ----"; + static ZCONST char Far *Headers[][2] = + { {HeadersS, HeadersS1}, {HeadersL, HeadersL1} }; + + static ZCONST char Far CaseConversion[] = + "%s (\"^\" ==> case\n%s conversion)\n"; + static ZCONST char Far LongHdrStats[] = + "%8lu %-7s%8lu %4s %02u-%02u-%02u %02u:%02u %08lx %c"; + static ZCONST char Far LongFileTrailer[] = + "-------- ------- --- \ + -------\n%8lu %8lu %4s %u file%s\n"; +#ifdef OS2_EAS + static ZCONST char Far ShortHdrStats[] = + "%9lu %6lu %6lu %02u-%02u-%02u %02u:%02u %c"; + static ZCONST char Far ShortFileTrailer[] = " -------- ----- ----- \ + -------\n%9lu %6lu %6lu %u file%s\n"; + static ZCONST char Far OS2ExtAttrTrailer[] = + "%ld file%s %ld bytes of OS/2 extended attributes attached.\n"; + static ZCONST char Far OS2ACLTrailer[] = + "%ld file%s %ld bytes of access control lists attached.\n"; +#else + static ZCONST char Far ShortHdrStats[] = + "%9lu %02u-%02u-%02u %02u:%02u %c"; + static ZCONST char Far ShortFileTrailer[] = + " -------- -------\n%9lu %u file%s\n"; +#endif /* ?OS2_EAS */ +#endif /* !WINDLL */ + + + + + +/*************************/ +/* Function list_files() */ +/*************************/ + +int list_files(__G) /* return PK-type error code */ + __GDEF +{ + int do_this_file=FALSE, cfactor, error, error_in_archive=PK_COOL; +#ifndef WINDLL + char sgn, cfactorstr[10]; + int longhdr=(uO.vflag>1); +#endif + int date_format; + unsigned j, methnum, members=0; +#ifdef USE_EF_UT_TIME + iztimes z_utime; + struct tm *t; +#endif + unsigned yr, mo, dy, hh, mm; + ulg csiz, tot_csize=0L, tot_ucsize=0L; +#ifdef OS2_EAS + ulg ea_size, tot_easize=0L, tot_eafiles=0L; + ulg acl_size, tot_aclsize=0L, tot_aclfiles=0L; +#endif + min_info info; + char methbuf[8]; + static ZCONST char dtype[]="NXFS"; /* see zi_short() */ + static ZCONST char Far method[NUM_METHODS+1][8] = + {"Stored", "Shrunk", "Reduce1", "Reduce2", "Reduce3", "Reduce4", + "Implode", "Token", "Defl:#", "EnhDefl", "ImplDCL", "Unk:###"}; + +extern int files; + + +/*--------------------------------------------------------------------------- + Unlike extract_or_test_files(), this routine confines itself to the cen- + tral directory. Thus its structure is somewhat simpler, since we can do + just a single loop through the entire directory, listing files as we go. + + So to start off, print the heading line and then begin main loop through + the central directory. The results will look vaguely like the following: + + Length Method Size Ratio Date Time CRC-32 Name ("^" ==> case +-------- ------ ------- ----- ---- ---- ------ ---- conversion) + 44004 Implode 13041 71% 11-02-89 19:34 8b4207f7 Makefile.UNIX + 3438 Shrunk 2209 36% 09-15-90 14:07 a2394fd8 ^dos-file.ext + 16717 Defl:X 5252 69% 11-03-97 06:40 1ce0f189 WHERE +-------- ------- --- ------- + 64159 20502 68% 3 files + ---------------------------------------------------------------------------*/ + + + G.pInfo = &info; + date_format = DATE_FORMAT; + + files = 0; + +#ifndef WINDLL + if (uO.qflag < 2) { + if (uO.L_flag) + Info(slide, 0, ((char *)slide, LoadFarString(CaseConversion), + LoadFarStringSmall(Headers[longhdr][0]), + LoadFarStringSmall2(Headers[longhdr][1]))); + else + Info(slide, 0, ((char *)slide, "%s\n%s\n", + LoadFarString(Headers[longhdr][0]), + LoadFarStringSmall(Headers[longhdr][1]))); + } +#endif /* !WINDLL */ + + for (j = 0; j++ < (unsigned)G.ecrec.total_entries_central_dir;) { + + if (readbuf(__G__ G.sig, 4) == 0) + return PK_EOF; + if (strncmp(G.sig, central_hdr_sig, 4)) { /* just to make sure */ + Info(slide, 0x401, ((char *)slide, LoadFarString(CentSigMsg), j)); + Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg))); + return PK_BADERR; /* sig not found */ + } + /* process_cdir_file_hdr() sets pInfo->hostnum, pInfo->lcflag, ...: */ + if ((error = process_cdir_file_hdr(__G)) != PK_COOL) + return error; /* only PK_EOF defined */ + + /* + * We could DISPLAY the filename instead of storing (and possibly trun- + * cating, in the case of a very long name) and printing it, but that + * has the disadvantage of not allowing case conversion--and it's nice + * to be able to see in the listing precisely how you have to type each + * filename in order for unzip to consider it a match. Speaking of + * which, if member names were specified on the command line, check in + * with match() to see if the current file is one of them, and make a + * note of it if it is. + */ + + if ((error = do_string(__G__ G.crec.filename_length, DS_FN)) != + PK_COOL) /* ^--(uses pInfo->lcflag) */ + { + error_in_archive = error; + if (error > PK_WARN) /* fatal: can't continue */ + return error; + } + if (G.extra_field != (uch *)NULL) { + free(G.extra_field); + G.extra_field = (uch *)NULL; + } + if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD)) + != 0) + { + error_in_archive = error; + if (error > PK_WARN) /* fatal */ + return error; + } + if (!G.process_all_files) { /* check if specified on command line */ + unsigned i; + + do_this_file = FALSE; + for (i = 0; i < G.filespecs; i++) + if (match(G.filename, G.pfnames[i], uO.C_flag)) { + do_this_file = TRUE; + break; /* found match, so stop looping */ + } + if (do_this_file) { /* check if this is an excluded file */ + for (i = 0; i < G.xfilespecs; i++) + if (match(G.filename, G.pxnames[i], uO.C_flag)) { + do_this_file = FALSE; /* ^-- ignore case in match */ + break; + } + } + } + /* + * If current file was specified on command line, or if no names were + * specified, do the listing for this file. Otherwise, get rid of the + * file comment and go back for the next file. + */ + + if (G.process_all_files || do_this_file) { + +#ifdef OS2DLL + /* this is used by UzpFileTree() to allow easy processing of lists + * of zip directory contents */ + if (G.processExternally) { + if ((G.processExternally)(G.filename, &G.crec)) + break; + ++members; + } else { +#endif +#ifdef OS2_EAS + { + uch *ef_ptr = G.extra_field; + int ef_size, ef_len = G.crec.extra_field_length; + ea_size = acl_size = 0; + + while (ef_len >= EB_HEADSIZE) { + ef_size = makeword(&ef_ptr[EB_LEN]); + switch (makeword(&ef_ptr[EB_ID])) { + case EF_OS2: + ea_size = makelong(&ef_ptr[EB_HEADSIZE]); + break; + case EF_ACL: + acl_size = makelong(&ef_ptr[EB_HEADSIZE]); + break; + } + ef_ptr += (ef_size + EB_HEADSIZE); + ef_len -= (ef_size + EB_HEADSIZE); + } + } +#endif +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.crec.extra_field_length, 1, + G.crec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME)) + { + TIMET_TO_NATIVE(z_utime.mtime) /* NOP unless MSC 7.0, Mac */ + t = localtime(&(z_utime.mtime)); + } else + t = (struct tm *)NULL; + if (t != (struct tm *)NULL) { + mo = (unsigned)(t->tm_mon + 1); + dy = (unsigned)(t->tm_mday); + yr = (unsigned)(t->tm_year % 100); + hh = (unsigned)(t->tm_hour); + mm = (unsigned)(t->tm_min); + } else +#endif /* USE_EF_UT_TIME */ + { + yr = ((((unsigned)(G.crec.last_mod_dos_datetime >> 25) & 0x7f) + + 80) % (unsigned)100); + mo = ((unsigned)(G.crec.last_mod_dos_datetime >> 21) & 0x0f); + dy = ((unsigned)(G.crec.last_mod_dos_datetime >> 16) & 0x1f); + hh = (((unsigned)G.crec.last_mod_dos_datetime >> 11) & 0x1f); + mm = (((unsigned)G.crec.last_mod_dos_datetime >> 5) & 0x3f); + } + /* permute date so it displays according to nat'l convention + * ('methnum' is not yet set, it is used as temporary buffer) */ + switch (date_format) { + case DF_YMD: + methnum = (unsigned)mo; + mo = yr; yr = dy; dy = (ush)methnum; + break; + case DF_DMY: + methnum = (unsigned)mo; + mo = dy; dy = (ush)methnum; + } + + csiz = G.crec.csize; + if (G.crec.general_purpose_bit_flag & 1) + csiz -= 12; /* if encrypted, don't count encryption header */ + if ((cfactor = ratio(G.crec.ucsize, csiz)) < 0) { +#ifndef WINDLL + sgn = '-'; +#endif + cfactor = (-cfactor + 5) / 10; + } else { +#ifndef WINDLL + sgn = ' '; +#endif + cfactor = (cfactor + 5) / 10; + } + + methnum = MIN(G.crec.compression_method, NUM_METHODS); + zfstrcpy(methbuf, method[methnum]); + if (methnum == DEFLATED) { + methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3]; + } else if (methnum >= NUM_METHODS) { + sprintf(&methbuf[4], "%03u", G.crec.compression_method); + } + +#if 0 /* GRR/Euro: add this? */ +#if defined(DOS_FLX_OS2_W32) || defined(UNIX) + for (p = G.filename; *p; ++p) + if (!isprint(*p)) + *p = '?'; /* change non-printable chars to '?' */ +#endif /* DOS_FLX_OS2_W32 || UNIX */ +#endif /* 0 */ + +#ifdef WINDLL + /* send data to application for formatting and printing */ + (*G.lpUserFunctions->SendApplicationMessage)(G.crec.ucsize, csiz, + (ush)cfactor, mo, dy, yr, hh, mm, + (char)(G.pInfo->lcflag ? '^' : ' '), + (LPSTR)fnfilter(G.filename, slide), (LPSTR)methbuf, G.crec.crc32, + (char)((G.crec.general_purpose_bit_flag & 1) ? 'E' : ' ')); +#else /* !WINDLL */ + if (cfactor == 100) + sprintf(cfactorstr, LoadFarString(CompFactor100)); + else + sprintf(cfactorstr, LoadFarString(CompFactorStr), sgn, cfactor); + if (longhdr) + Info(slide, 0, ((char *)slide, LoadFarString(LongHdrStats), + G.crec.ucsize, methbuf, csiz, cfactorstr, mo, dy, + yr, hh, mm, G.crec.crc32, (G.pInfo->lcflag? '^':' '))); + else +#ifdef OS2_EAS + Info(slide, 0, ((char *)slide, LoadFarString(ShortHdrStats), + G.crec.ucsize, ea_size, acl_size, + mo, dy, yr, hh, mm, (G.pInfo->lcflag? '^':' '))); +#else + Info(slide, 0, ((char *)slide, LoadFarString(ShortHdrStats), + G.crec.ucsize, + mo, dy, yr, hh, mm, (G.pInfo->lcflag? '^':' '))); +#endif + /* fnprint(__G);*/ + files++; +#endif /* ?WINDLL */ + + if ((error = do_string(__G__ G.crec.file_comment_length, + QCOND? DISPL_8 : SKIP)) != 0) + { + error_in_archive = error; /* might be just warning */ + if (error > PK_WARN) /* fatal */ + return error; + } + tot_ucsize += G.crec.ucsize; + tot_csize += csiz; + ++members; +#ifdef OS2_EAS + if (ea_size) { + tot_easize += ea_size; + ++tot_eafiles; + } + if (acl_size) { + tot_aclsize += acl_size; + ++tot_aclfiles; + } +#endif +#ifdef OS2DLL + } /* end of "if (G.processExternally) {...} else {..." */ +#endif + } else { /* not listing this file */ + SKIP_(G.crec.file_comment_length) + } + } /* end for-loop (j: files in central directory) */ + +/*--------------------------------------------------------------------------- + Print footer line and totals (compressed size, uncompressed size, number + of members in zipfile). + ---------------------------------------------------------------------------*/ + + if (uO.qflag < 2 +#ifdef OS2DLL + && !G.processExternally +#endif + ) { + if ((cfactor = ratio(tot_ucsize, tot_csize)) < 0) { +#ifndef WINDLL + sgn = '-'; +#endif + cfactor = (-cfactor + 5) / 10; + } else { +#ifndef WINDLL + sgn = ' '; +#endif + cfactor = (cfactor + 5) / 10; + } +#ifdef WINDLL + /* pass the totals back to the calling application */ + G.lpUserFunctions->TotalSizeComp = tot_csize; + G.lpUserFunctions->TotalSize = tot_ucsize; + G.lpUserFunctions->CompFactor = cfactor; + G.lpUserFunctions->NumMembers = members; + +#else /* !WINDLL */ + if (cfactor == 100) + sprintf(cfactorstr, LoadFarString(CompFactor100)); + else + sprintf(cfactorstr, LoadFarString(CompFactorStr), sgn, cfactor); + if (longhdr) { + Info(slide, 0, ((char *)slide, LoadFarString(LongFileTrailer), + tot_ucsize, tot_csize, cfactorstr, members, members==1? "":"s")); +#ifdef OS2_EAS + if (tot_easize || tot_aclsize) + Info(slide, 0, ((char *)slide, "\n")); + if (tot_eafiles && tot_easize) + Info(slide, 0, ((char *)slide, LoadFarString(OS2ExtAttrTrailer), + tot_eafiles, tot_eafiles == 1? " has" : "s have a total of", + tot_easize)); + if (tot_aclfiles && tot_aclsize) + Info(slide, 0, ((char *)slide, LoadFarString(OS2ACLTrailer), + tot_aclfiles, tot_aclfiles == 1? " has" : "s have a total of", + tot_aclsize)); +#endif /* OS2_EAS */ + } else +#ifdef OS2_EAS + Info(slide, 0, ((char *)slide, LoadFarString(ShortFileTrailer), + tot_ucsize, tot_easize, tot_aclsize, members, members == 1? + "" : "s")); +#else + Info(slide, 0, ((char *)slide, LoadFarString(ShortFileTrailer), + tot_ucsize, members, members == 1? "" : "s")); +#endif /* OS2_EAS */ +#endif /* ?WINDLL */ + } + +/*--------------------------------------------------------------------------- + Double check that we're back at the end-of-central-directory record. + ---------------------------------------------------------------------------*/ + + if (readbuf(__G__ G.sig, 4) == 0) /* disk error? */ + return PK_EOF; + if (strncmp(G.sig, end_central_sig, 4)) { /* just to make sure again */ + Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg))); + error_in_archive = PK_WARN; /* didn't find sig */ + } + if (members == 0 && error_in_archive <= PK_WARN) + error_in_archive = PK_FIND; + + return error_in_archive; + +} /* end function list_files() */ + + + + + +#ifdef TIMESTAMP + +/************************/ +/* Function fn_is_dir() */ +/************************/ + +static int fn_is_dir(__G) /* returns TRUE if G.filename is directory */ + __GDEF +{ + extent fn_len = strlen(G.filename); + register char endc; + + return fn_len > 0 && + ((endc = G.filename[fn_len-1]) == '/' || + (G.pInfo->hostnum == FS_FAT_ && !strchr(G.filename, '/') && + endc == '\\')); +} + + + + + +/*****************************/ +/* Function get_time_stamp() */ +/*****************************/ + +int get_time_stamp(__G__ last_modtime, nmember) /* return PK-type error code */ + __GDEF + time_t *last_modtime; + unsigned *nmember; +{ + int do_this_file=FALSE, error, error_in_archive=PK_COOL; + unsigned j; +#ifdef USE_EF_UT_TIME + iztimes z_utime; +#endif + min_info info; + + +/*--------------------------------------------------------------------------- + Unlike extract_or_test_files() but like list_files(), this function works + on information in the central directory alone. Thus we have a single, + large loop through the entire directory, searching for the latest time + stamp. + ---------------------------------------------------------------------------*/ + + *last_modtime = 0L; /* assuming no zipfile data older than 1970 */ + *nmember = 0; + G.pInfo = &info; + + for (j = 0; j++ < (unsigned)G.ecrec.total_entries_central_dir;) { + + if (readbuf(__G__ G.sig, 4) == 0) + return PK_EOF; + if (strncmp(G.sig, central_hdr_sig, 4)) { /* just to make sure */ + Info(slide, 0x401, ((char *)slide, LoadFarString(CentSigMsg), j)); + Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg))); + return PK_BADERR; + } + /* process_cdir_file_hdr() sets pInfo->lcflag: */ + if ((error = process_cdir_file_hdr(__G)) != PK_COOL) + return error; /* only PK_EOF defined */ + if ((error = do_string(__G__ G.crec.filename_length, DS_FN)) != PK_OK) + { /* ^-- (uses pInfo->lcflag) */ + error_in_archive = error; + if (error > PK_WARN) /* fatal: can't continue */ + return error; + } + if (G.extra_field != (uch *)NULL) { + free(G.extra_field); + G.extra_field = (uch *)NULL; + } + if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD)) + != 0) + { + error_in_archive = error; + if (error > PK_WARN) /* fatal */ + return error; + } + if (!G.process_all_files) { /* check if specified on command line */ + unsigned i; + + do_this_file = FALSE; + for (i = 0; i < G.filespecs; i++) + if (match(G.filename, G.pfnames[i], uO.C_flag)) { + do_this_file = TRUE; + break; /* found match, so stop looping */ + } + if (do_this_file) { /* check if this is an excluded file */ + for (i = 0; i < G.xfilespecs; i++) + if (match(G.filename, G.pxnames[i], uO.C_flag)) { + do_this_file = FALSE; /* ^-- ignore case in match */ + break; + } + } + } + + /* If current file was specified on command line, or if no names were + * specified, check the time for this file. Either way, get rid of the + * file comment and go back for the next file. + * Directory entries are always ignored, to stay compatible with both + * Zip and PKZIP. + */ + if ((G.process_all_files || do_this_file) && !fn_is_dir(__G)) { +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.crec.extra_field_length, 1, + G.crec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME)) + { + if (*last_modtime < z_utime.mtime) + *last_modtime = z_utime.mtime; + } else +#endif /* USE_EF_UT_TIME */ + { + time_t modtime = dos_to_unix_time(G.crec.last_mod_dos_datetime); + + if (*last_modtime < modtime) + *last_modtime = modtime; + } + ++*nmember; + } + SKIP_(G.crec.file_comment_length) + + } /* end for-loop (j: files in central directory) */ + +/*--------------------------------------------------------------------------- + Double check that we're back at the end-of-central-directory record. + ---------------------------------------------------------------------------*/ + + if (readbuf(__G__ G.sig, 4) == 0) + return PK_EOF; + if (strncmp(G.sig, end_central_sig, 4)) { /* just to make sure again */ + Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg))); + error_in_archive = PK_WARN; + } + if (*nmember == 0 && error_in_archive <= PK_WARN) + error_in_archive = PK_FIND; + + return error_in_archive; + +} /* end function get_time_stamp() */ + +#endif /* TIMESTAMP */ + + + + + +/********************/ +/* Function ratio() */ /* also used by ZipInfo routines */ +/********************/ + +int ratio(uc, c) + ulg uc, c; +{ + ulg denom; + + if (uc == 0) + return 0; + if (uc > 2000000L) { /* risk signed overflow if multiply numerator */ + denom = uc / 1000L; + return ((uc >= c) ? + (int) ((uc-c + (denom>>1)) / denom) : + -((int) ((c-uc + (denom>>1)) / denom))); + } else { /* ^^^^^^^^ rounding */ + denom = uc; + return ((uc >= c) ? + (int) ((1000L*(uc-c) + (denom>>1)) / denom) : + -((int) ((1000L*(c-uc) + (denom>>1)) / denom))); + } /* ^^^^^^^^ rounding */ +} + + + + + +/************************/ +/* Function fnprint() */ /* also used by ZipInfo routines */ +/************************/ + +void fnprint(__G) /* print filename (after filtering) and newline */ + __GDEF +{ + char *name = fnfilter(G.filename, slide); + + (*G.message)((zvoid *)&G, (uch *)name, (ulg)strlen(name), 0); + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + +} /* end function fnprint() */ diff --git a/utils/Install/packzip/makefile b/utils/Install/packzip/makefile new file mode 100644 index 0000000000..e5b1b70ec4 --- /dev/null +++ b/utils/Install/packzip/makefile @@ -0,0 +1,146 @@ +#============================================================================== +# Makefile for UnZip, UnZipSFX and fUnZip: Unix and MS-DOS ("real" makes only) +# Version: 5.4 19 November 1998 +#============================================================================== + + +# INSTRUCTIONS (such as they are): +# +# "make sunos" -- makes UnZip in current directory on a generic SunOS 4.x Sun +# "make list" -- lists all supported systems (targets) +# "make help" -- provides pointers on what targets to try if problems occur +# "make wombat" -- chokes and dies if you haven't added the specifics for your +# Wombat 68000 (or whatever) to the systems list +# +# CF are flags for the C compiler. LF are flags for the loader. LF2 are more +# flags for the loader, if they need to be at the end of the line instead of at +# the beginning (for example, some libraries). FL and FL2 are the corre- +# sponding flags for fUnZip. LOCAL_UNZIP is an environment variable that can +# be used to add default C flags to your compile without editing the Makefile +# (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C). +# +# Some versions of make do not define the macro "$(MAKE)"; this is rare, but +# if things don't work, try using "make" instead of "$(MAKE)" in your system's +# makerule. Or try adding the following line to your .login file: +# setenv MAKE "make" +# (That never works--makes that are too stupid to define MAKE are also too +# stupid to look in the environment--but try it anyway for kicks. :-) ) +# +# Memcpy and memset are provided for those systems that don't have them; they +# are in fileio.c and will be used if -DZMEM is included in CF. These days +# almost all systems have them. +# +# Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila- +# tion does not always imply a working program. + + +##################### +# MACRO DEFINITIONS # +##################### + +# Defaults most systems use (use LOCAL_UNZIP in environment to add flags, +# such as -DDOSWILD). + +# UnZip flags +CC = cc# try using "gcc" target rather than changing this (CC and LD +LD = $(CC)# must match, else "unresolved symbol: ___main" is possible) +AS = as +LOC = $(LOCAL_UNZIP) +AF = $(LOC) +CF = -O -I. -I.. -I../inczip $(LOC) +LF = -o packinst +LF2 = -s + +# general-purpose stuff +#CP = cp +CP = ln +LN = ln +RM = rm -f +CHMOD = chmod +BINPERMS = 755 +MANPERMS = 644 +STRIP = strip +E = +O = .o +M = unix +SHELL = /bin/sh + +# defaults for crc32 stuff and system dependent headers +CRC32 = crc32 + +# object files +OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O +OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O +OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O +OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O packinst$O +#OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O install$O wxmain$O instsup$O +UNZIP_H = ../inczip/unzip.h ../inczip/unzpriv.h ../inczip/globals.h + +# installation +# (probably can change next two to `install' and `install -d' if you have it) +INSTALL = cp +INSTALL_D = mkdir -p + +############################################### +# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES # +############################################### + +# this is for GNU make; comment out and notify zip-bugs if it causes errors +.SUFFIXES: .c .o .obj .pic.o + +# yes, we should be able to use the $O macro to combine these two, but it +# fails on some brain-damaged makes (e.g., AIX's)...no big deal +.c.o: + $(CC) -c $(CF) $*.c + +.c.obj: + $(CC) -c $(CF) $*.c + +.c.pic.o: + $(CC) -c $(CF) -o $@ $*.c + +all: sfx + + +# EDIT HERE FOR PARALLEL MAKES on Sequent (and others?)--screws up MS-DOS +# make utilities if default: change "unzip$E:" to "unzip$E:&" + +sfx$E: $(OBJS) # add `&' for parallel makes + $(LD) $(LF) $(OBJS) + +crc32$O: crc32.c $(UNZIP_H) ../inczip/zip.h +crctab$O: crctab.c $(UNZIP_H) ../inczip/zip.h +crypt$O: crypt.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +envargs$O: envargs.c $(UNZIP_H) +explode$O: explode.c $(UNZIP_H) +extract$O: extract.c $(UNZIP_H) ../inczip/crypt.h +fileio$O: fileio.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/ebcdic.h +funzip$O: funzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/tables.h +globals$O: globals.c $(UNZIP_H) +inflate$O: inflate.c ../inczip/inflate.h $(UNZIP_H) +list$O: list.c $(UNZIP_H) +match$O: match.c $(UNZIP_H) +process$O: process.c $(UNZIP_H) +ttyio$O: ttyio.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +unreduce$O: unreduce.c $(UNZIP_H) +unshrink$O: unshrink.c $(UNZIP_H) +unzip$O: unzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/version.h ../inczip/consts.h +zipinfo$O: zipinfo.c $(UNZIP_H) + +unix$O: unix.c $(UNZIP_H) ../inczip/version.h # Unix only + $(CC) -c $(CF) unix.c + +packinst$O: ../packinst/packinst.c + $(CC) -c $(CF) ../packinst/packinst.c + +#install$O: ../install.c +# $(CC) -c $(CF) ../install.c +# +#unix$O: ../wxmain.cpp +# $(CC) -c $(CF) ../wxmain.cpp +# +#unix$O: ../instsup.cpp +# $(CC) -c $(CF) ../instsup.cpp + + + diff --git a/utils/Install/packzip/makefile.b32 b/utils/Install/packzip/makefile.b32 new file mode 100644 index 0000000000..7734f0f7b3 --- /dev/null +++ b/utils/Install/packzip/makefile.b32 @@ -0,0 +1,118 @@ +# Makefile for UnZip(SFX) and fUnZip for Borland C++ for Windows 95/NT +# Version: 5.4 and later Alvin Koh, Jim Knoble, Christian Spieler, etc. +# Adapted from the MS-DOS makefile by E-Yen Tan +# +# Last revised: 24 Nov 98 +# +# + + +# Optional nonstandard preprocessor flags (as -DCHECK_EOF or -DDOS_WILD) +# should be added to the environment via "set LOCAL_UNZIP=-DFOO" or added +# to the declaration of LOC here: +LOC = $(LOCAL_UNZIP) + +# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. +CPU_TYP = 4 + +# (De)Select inclusion of optimized assembler CRC32 routine: +USE_ASMCRC = 0 + +# If you have bcc32i, you should define: +# CC = bcc32i +# This compiler generates a faster code. +CC = bcc32 +AS = tasm32 + +!if $(USE_ASMCRC) +ASMFLG = -DASM_CRC +ASMOBJS = crc_i386.obj +!else +ASMFLG = +ASMOBJS = +!endif + +!if $(UNCLEAN) +DIRT = -DUSE_SMITH_CODE -DUSE_UNSHRINK +!else +DIRT = +!endif + +# compiler flags + +ASCPUFLAG = __$(CPU_TYP)86 +!if $(CPU_TYP) != 0 +CC_CPUFLG = -$(CPU_TYP) +!endif +ASFLAGS = -ml -m2 -w0 -D$(ASCPUFLAG) $(LOC) +CFLAGS = -O2 -w- $(CC_CPUFLG) -ff- -k- -P-.C -I. -I.. -I..\inczip -DWIN32 $(ASMFLG) $(LOC) $(DIRT) +LDFLAGS = -lxncd -l-P # for bcc +UNFLAGS = $(CFLAGS) + +# implicit rules + +.asm.obj: + $(AS) $(ASFLAGS) $< + +.c.obj: + $(CC) -c $(UNFLAGS) {$< } + +# list macros + +OBJU1 = unzip.obj crc32.obj crctab.obj crypt.obj envargs.obj explode.obj +OBJU2 = extract.obj fileio.obj globals.obj inflate.obj list.obj match.obj +OBJU3 = process.obj ttyio.obj unreduce.obj unshrink.obj zipinfo.obj +OBJUS = win32.obj nt.obj $(ASMOBJS) packinst.obj +OBJU = $(OBJU1) $(OBJU2) $(OBJU3) $(OBJUS) + +UNZIP_H = ..\inczip\unzip.h ..\inczip\unzpriv.h ..\inczip\globals.h ..\inczip\w32cfg.h + +# explicit rules + +all: packinst.exe + +packinst.exe: $(OBJU) + $(CC) $(LDFLAGS) -epackinst.exe @&&| +$(OBJU) +| + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws + -erase *.tds + -erase *.il? + +# individual file dependencies + +crc32.obj: crc32.c $(UNZIP_H) ..\inczip\zip.h +crctab.obj: crctab.c $(UNZIP_H) ..\inczip\zip.h +crypt.obj: crypt.c $(UNZIP_H) ..\inczip\zip.h ..\inczip\crypt.h ..\inczip\ttyio.h +envargs.obj: envargs.c $(UNZIP_H) +explode.obj: explode.c $(UNZIP_H) +extract.obj: extract.c $(UNZIP_H) ..\inczip\crypt.h +fileio.obj: fileio.c $(UNZIP_H) ..\inczip\crypt.h ..\inczip\ttyio.h ..\inczip\ebcdic.h +globals.obj: globals.c $(UNZIP_H) +inflate.obj: inflate.c ..\inczip\inflate.h $(UNZIP_H) +list.obj: list.c $(UNZIP_H) +match.obj: match.c $(UNZIP_H) +process.obj: process.c $(UNZIP_H) +ttyio.obj: ttyio.c $(UNZIP_H) ..\inczip\zip.h ..\inczip\crypt.h ..\inczip\ttyio.h +unreduce.obj: unreduce.c $(UNZIP_H) +unshrink.obj: unshrink.c $(UNZIP_H) +unzip.obj: unzip.c $(UNZIP_H) ..\inczip\crypt.h ..\inczip\version.h ..\inczip\consts.h +zipinfo.obj: zipinfo.c $(UNZIP_H) + +crc_i386.obj: crc_i386.asm + $(AS) $(ASFLAGS) crc_i386.asm, $*.obj ; + +win32.obj: win32.c $(UNZIP_H) + $(CC) -c $(UNFLAGS) win32.c + +packinst.obj: ..\packinst\packinst.c $(UNZIP_H) + $(CC) -c $(UNFLAGS) ..\packinst\packinst.c + +nt.obj: nt.c $(UNZIP_H) + $(CC) -c $(UNFLAGS) nt.c diff --git a/utils/Install/packzip/makefile.g95 b/utils/Install/packzip/makefile.g95 new file mode 100644 index 0000000000..fdd6be493b --- /dev/null +++ b/utils/Install/packzip/makefile.g95 @@ -0,0 +1,158 @@ +# Makefile for UnZip, fUnZip and UnZipSFX for native Win32-Intel ports of gcc. +# Currently supported implementations: Cygnus/Win32 and MinGW32. +# +# First version: Cosmin Truta <cosmint@cs.ubbcluj.ro>, Dec 1997. +# Last revision: Christian Spieler, 29-Apr-1998 +# +# To use, do "make -f win32/makefile.gcc". + + +### Optional section + +# Optional nonstandard preprocessor flags (as -DUSE_ZLIB or -DUSE_SMITH_CODE) +# should be added to the environment via "set LOCAL_UNZIP=-DFOO" or added +# to the declaration of LOCFLAGS here: +LOCFLAGS = $(LOCAL_UNZIP) + + +### Compiler-specific section + +# ------------ GNU C ------------ +CC = gcc + +#AS = as +AS = $(CC) + +#LD = ld +LD = $(CC) + +# Quiet +CC_QUIET_OPT = +AS_QUIET_OPT = $(CC_QUIET_OPT) +LD_QUIET_OPT = $(CC_QUIET_OPT) + +# Warnings +CC_WARN_OPT = -Wall +AS_WARN_OPT = $(CC_WARN_OPT) +LD_WARN_OPT = + +# Debug version +CC_DEBUG_OPT = -g +AS_DEBUG_OPT = $(CC_DEBUG_OPT) +LD_DEBUG_OPT = $(CC_DEBUG_OPT) + +# Release version +CC_RELEASE_OPT = +AS_RELEASE_OPT = +LD_RELEASE_OPT = -s + +# Smallest code +CC_SIZE_OPT = -O1 + +# Fastest code +CC_SPEED_OPT = -O2 + +# Output object file name +CC_OUT_OPT = -o + +# Other specific options +#CC_SPECIFIC_OPT = -c -DASM_CRC -DWIN32 -mno-cygwin +CC_SPECIFIC_OPT = -c -DWIN32 -mno-cygwin -I../inczip +AS_SPECIFIC_OPT = -c +LD_SPECIFIC_OPT = -mno-cygwin -o $@ + +# Libraries for the debug & release version +LD_RELEASE_LIBS = -luser32 -ladvapi32 +LD_DEBUG_LIBS = $(LD_RELEASE_LIBS) + + +### System-specific section + +# Suffixes +OBJ = .o +EXE = .exe + +.SUFFIXES: .c .S $(OBJ) $(EXE) + +# Commands +RM = rm -f + + +### General section + +CFLAGS = $(CC_SPECIFIC_OPT) $(CC_QUIET_OPT) $(CC_WARN_OPT) $(LOCFLAGS) \ + $(CC_OUT_OPT) $@ +ASFLAGS = $(AS_SPECIFIC_OPT) $(AS_QUIET_OPT) $(AS_WARN_OPT) $(LOCFLAGS) +LDFLAGS = $(LD_SPECIFIC_OPT) $(LD_QUIET_OPT) $(LD_WARN_OPT) + +# To build with debug info, use 'make DEBUG=1'. +ifdef DEBUG +CVER = $(CC_DEBUG_OPT) +ASVER = $(AS_DEBUG_OPT) +LDVER = $(LD_DEBUG_OPT) +GENFLAGS = +FFLAGS = -DFUNZIP +SFXFLAGS = -DSFX +LDLIBS = $(LD_DEBUG_LIBS) +else +CVER = $(CC_RELEASE_OPT) +ASVER = $(AS_RELEASE_OPT) +LDVER = $(LD_RELEASE_OPT) +GENFLAGS = $(CC_SPEED_OPT) +FFLAGS = $(CC_SPEED_OPT) -DFUNZIP +SFXFLAGS = $(CC_SIZE_OPT) -DSFX +LDLIBS = $(LD_RELEASE_LIBS) +endif + +# Object files +OBJA = crc_i386$(OBJ) packinst$(OBJ) +OBJS1 = unzip$(OBJ) crc32$(OBJ) crctab$(OBJ) crypt$(OBJ) envargs$(OBJ) +OBJS2 = explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ) inflate$(OBJ) +OBJS3 = list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ) unreduce$(OBJ) +OBJS4 = unshrink$(OBJ) zipinfo$(OBJ) win32$(OBJ) nt$(OBJ) +OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJA) + +UNZIP_H = ../inczip/unzip.h ../inczip/unzpriv.h ../inczip/globals.h ../inczip/w32cfg.h + + +# Default target is all the executables +unzips: packinst$(EXE) + +packinst$(EXE): $(OBJS) + $(LD) $(LDFLAGS) $(LDVER) $(OBJS) $(LDLIBS) + +# How to compile sources +.c$(OBJ): + $(CC) $(CFLAGS) $(CVER) $(GENFLAGS) $< +.S$(OBJ): + $(AS) $(ASFLAGS) $(ASVER) $(GENFLAGS) $< + +# Dependencies +crc32$(OBJ): crc32.c $(UNZIP_H) ../inczip/zip.h +crctab$(OBJ): crctab.c $(UNZIP_H) ../inczip/zip.h +crypt$(OBJ): crypt.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +envargs$(OBJ): envargs.c $(UNZIP_H) +explode$(OBJ): explode.c $(UNZIP_H) +extract$(OBJ): extract.c $(UNZIP_H) ../inczip/crypt.h +fileio$(OBJ): fileio.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/ebcdic.h +funzip$(OBJ): funzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/tables.h +globals$(OBJ): globals.c $(UNZIP_H) +inflate$(OBJ): inflate.c ../inczip/inflate.h $(UNZIP_H) +list$(OBJ): list.c $(UNZIP_H) +match$(OBJ): match.c $(UNZIP_H) +process$(OBJ): process.c $(UNZIP_H) +ttyio$(OBJ): ttyio.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +unreduce$(OBJ): unreduce.c $(UNZIP_H) +unshrink$(OBJ): unshrink.c $(UNZIP_H) +unzip$(OBJ): unzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/version.h ../inczip/consts.h +zipinfo$(OBJ): zipinfo.c $(UNZIP_H) +crc_i386$(OBJ): crc_i386.S +win32$(OBJ): win32.c $(UNZIP_H) ../inczip/nt.h +nt$(OBJ): nt.c ../inczip/nt.h + +packinst$(OBJ): ../packinst/packinst.c + $(CC) $(CFLAGS) $(CVER) $(GENFLAGS) $< + +clean: + $(RM) *$(OBJ) + $(RM) *$(EXE) diff --git a/utils/Install/packzip/makefile.gcc b/utils/Install/packzip/makefile.gcc new file mode 100644 index 0000000000..e5b1b70ec4 --- /dev/null +++ b/utils/Install/packzip/makefile.gcc @@ -0,0 +1,146 @@ +#============================================================================== +# Makefile for UnZip, UnZipSFX and fUnZip: Unix and MS-DOS ("real" makes only) +# Version: 5.4 19 November 1998 +#============================================================================== + + +# INSTRUCTIONS (such as they are): +# +# "make sunos" -- makes UnZip in current directory on a generic SunOS 4.x Sun +# "make list" -- lists all supported systems (targets) +# "make help" -- provides pointers on what targets to try if problems occur +# "make wombat" -- chokes and dies if you haven't added the specifics for your +# Wombat 68000 (or whatever) to the systems list +# +# CF are flags for the C compiler. LF are flags for the loader. LF2 are more +# flags for the loader, if they need to be at the end of the line instead of at +# the beginning (for example, some libraries). FL and FL2 are the corre- +# sponding flags for fUnZip. LOCAL_UNZIP is an environment variable that can +# be used to add default C flags to your compile without editing the Makefile +# (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C). +# +# Some versions of make do not define the macro "$(MAKE)"; this is rare, but +# if things don't work, try using "make" instead of "$(MAKE)" in your system's +# makerule. Or try adding the following line to your .login file: +# setenv MAKE "make" +# (That never works--makes that are too stupid to define MAKE are also too +# stupid to look in the environment--but try it anyway for kicks. :-) ) +# +# Memcpy and memset are provided for those systems that don't have them; they +# are in fileio.c and will be used if -DZMEM is included in CF. These days +# almost all systems have them. +# +# Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila- +# tion does not always imply a working program. + + +##################### +# MACRO DEFINITIONS # +##################### + +# Defaults most systems use (use LOCAL_UNZIP in environment to add flags, +# such as -DDOSWILD). + +# UnZip flags +CC = cc# try using "gcc" target rather than changing this (CC and LD +LD = $(CC)# must match, else "unresolved symbol: ___main" is possible) +AS = as +LOC = $(LOCAL_UNZIP) +AF = $(LOC) +CF = -O -I. -I.. -I../inczip $(LOC) +LF = -o packinst +LF2 = -s + +# general-purpose stuff +#CP = cp +CP = ln +LN = ln +RM = rm -f +CHMOD = chmod +BINPERMS = 755 +MANPERMS = 644 +STRIP = strip +E = +O = .o +M = unix +SHELL = /bin/sh + +# defaults for crc32 stuff and system dependent headers +CRC32 = crc32 + +# object files +OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O +OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O +OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O +OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O packinst$O +#OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O install$O wxmain$O instsup$O +UNZIP_H = ../inczip/unzip.h ../inczip/unzpriv.h ../inczip/globals.h + +# installation +# (probably can change next two to `install' and `install -d' if you have it) +INSTALL = cp +INSTALL_D = mkdir -p + +############################################### +# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES # +############################################### + +# this is for GNU make; comment out and notify zip-bugs if it causes errors +.SUFFIXES: .c .o .obj .pic.o + +# yes, we should be able to use the $O macro to combine these two, but it +# fails on some brain-damaged makes (e.g., AIX's)...no big deal +.c.o: + $(CC) -c $(CF) $*.c + +.c.obj: + $(CC) -c $(CF) $*.c + +.c.pic.o: + $(CC) -c $(CF) -o $@ $*.c + +all: sfx + + +# EDIT HERE FOR PARALLEL MAKES on Sequent (and others?)--screws up MS-DOS +# make utilities if default: change "unzip$E:" to "unzip$E:&" + +sfx$E: $(OBJS) # add `&' for parallel makes + $(LD) $(LF) $(OBJS) + +crc32$O: crc32.c $(UNZIP_H) ../inczip/zip.h +crctab$O: crctab.c $(UNZIP_H) ../inczip/zip.h +crypt$O: crypt.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +envargs$O: envargs.c $(UNZIP_H) +explode$O: explode.c $(UNZIP_H) +extract$O: extract.c $(UNZIP_H) ../inczip/crypt.h +fileio$O: fileio.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/ebcdic.h +funzip$O: funzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/tables.h +globals$O: globals.c $(UNZIP_H) +inflate$O: inflate.c ../inczip/inflate.h $(UNZIP_H) +list$O: list.c $(UNZIP_H) +match$O: match.c $(UNZIP_H) +process$O: process.c $(UNZIP_H) +ttyio$O: ttyio.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +unreduce$O: unreduce.c $(UNZIP_H) +unshrink$O: unshrink.c $(UNZIP_H) +unzip$O: unzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/version.h ../inczip/consts.h +zipinfo$O: zipinfo.c $(UNZIP_H) + +unix$O: unix.c $(UNZIP_H) ../inczip/version.h # Unix only + $(CC) -c $(CF) unix.c + +packinst$O: ../packinst/packinst.c + $(CC) -c $(CF) ../packinst/packinst.c + +#install$O: ../install.c +# $(CC) -c $(CF) ../install.c +# +#unix$O: ../wxmain.cpp +# $(CC) -c $(CF) ../wxmain.cpp +# +#unix$O: ../instsup.cpp +# $(CC) -c $(CF) ../instsup.cpp + + + diff --git a/utils/Install/packzip/makefile.os2 b/utils/Install/packzip/makefile.os2 new file mode 100644 index 0000000000..6778bd50ab --- /dev/null +++ b/utils/Install/packzip/makefile.os2 @@ -0,0 +1,670 @@ +# Makefile for UnZip, UnZipSFX and fUnZip 24 November 1998 +# +# supported compilers: +# - Microsoft C, version 6.00 or higher, for use under OS/2 1.x (16-bit) +# - Watcom C/C++, version 9.0+, for use under OS/2 1.x or 2.x+ (16/32-bit) +# - emx+gcc, version 0.9c or higher, for use under OS/2 2.x+ (32-bit) +# - IBM C Set++, for use under OS/2 2.x+ (32-bit) +# - Borland C++, for use under OS/2 2.x+ (32-bit) +# - Metaware High C/C++, for use under OS/2 2.x+ (32-bit) +# +# supported cross-compilers: +# - Microsoft C, version 6.0 or 7.0, for use under DOS (16-bit) +# - Watcom C/C++, version 9.0+, for use under DOS/Win95/NT (16/32-bit) +# - GNU gcc (emx), version 0.9c or higher, for use under DOS/Win95/NT (32-bit) +# +# supported assemblers: +# - Microsoft MASM 6.00 with Microsoft C +# - Watcom WASM with Watcom C/C++ +# - GNU as with GNU gcc + +# To use MASM 5.x instead of MASM 6.00: +# - set AS="masm -t -Ml" +# - set ASEOL=";" + +# To use, enter "{d,n}make -f os2/makefile.os2" (this makefile depends on its +# name being "makefile.os2", and it must be in the os2 subdirectory). + +# Notes on Microsoft C 6.00 compilation for OS/2: +# +# The resulting programs can be used under OS/2 protected mode only, not +# under DOS. A larger stack has to be used for OS/2 because system calls +# use more stack than under DOS; 8k is recommended by Microsoft. + +# Notes on IBM C Set++, Watcom C/C++, Borland C++ or emx+gcc compilation: +# +# The resulting programs can be used under protected mode of OS/2 2.x or +# higher only, not under OS/2 1.x and not under DOS. +# +# The NFLAGS macro is used to work around an optimization bug in the IBM +# C++ Set compiler; this is fixed by CSD #4, so NFLAGS="" can be used for +# all targets below. + +# Notes on Watcom C/C++ compilation for DOS with the PMODE/W extender: +# +# You need to add the following section to your \watcom\binb\wlsystem.lnk +# file and also need to copy pmodew.exe to the same directory: +# +# system begin pmodew +# option osname='PMODE/W' +# libpath %WATCOM%\lib386 +# libpath %WATCOM%\lib386\dos +# op stub=pmodew.exe +# format os2 le +# end +# +# PMODE/W 1.16 or higher is required. See also msdos/README for important +# notes about PMODE/W bugs. + +default: + @echo "Enter `$(MAKE) -f os2/makefile.os2 target' from the main" + @echo "UnZip directory, where target is one of:" + @echo " msc mscdebug mscdos ibm ibmdyn ibmdebug ibmprof" + @echo " ibmdll ibmdyndll ibmdebugdll ibmprofdll" + @echo " metaware borland gcc gccdyn gccdebug gccdos gccwin32" + @echo " watcom watcom16 watcomdos watcom16dos pmodew watcomwin32" + +# MS C 6.00 for OS/2, 16-bit (should figure out way to split unzip/funzip +# compiles so former is always large model and latter always small model...) +msc: + $(MAKE) -f os2/makefile.os2 all \ + CC="cl -nologo -AL -Ocegit -Gs -I. $(FP)" \ + CFLAGS="-G2 -Zp1 -W3 -DOS2 -DMSC -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="ml -nologo -c -Zm -Cp" \ + ASFLAGS="-D__LARGE__ -D__286" \ + LDFLAGS="-F 2000 -Lp -Fe" \ + LDFLAGS2="-link /noe" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i86" \ + CRC32F="crc_i86" \ + CRC32X="crc_i86" \ + DEF="os2\unzip.def" + +# MS C 6.00 for OS/2, debug version +mscdebug: + $(MAKE) -f os2/makefile.os2 all \ + CC="cl -nologo -AL -Zi -Od -I. $(FP)" \ + CFLAGS="-G2 -Zp1 -W3 -DOS2 -DMSC -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="ml -nologo -c -Zim -Cp" \ + ASFLAGS="-D__LARGE__ -D__286" \ + LDFLAGS="-F 2000 -Lp -Fe" \ + LDFLAGS2="-link /noe" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i86" \ + CRC32F="crc_i86" \ + CRC32X="crc_i86" \ + DEF="os2\unzip.def" + +# cross-compilation for MS-DOS with MS C 6.00 (same comment as above...formerly; +# now unzip is medium model again, with [almost] all strings in far memory) +mscdos: + $(MAKE) -f os2/makefile.os2 all \ + CC="cl -nologo -AM -Oaict -Gs -I. $(FP)" \ + CFLAGS="-Zp1 -W3 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="ml -nologo -c -Zm -Cp" \ + ASFLAGS="-D__MEDIUM__" \ + LDFLAGS="-F 0C00 -Lr -Fe" \ + LDFLAGS2="-link /noe /exe" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i86" \ + CRC32F="crc_i86" \ + CRC32X="crc_i86" \ + OBJU2="msdos.obj" \ + OBJX2="msdos_.obj" \ + OSDEP_H="msdos/doscfg.h" + +# IBM C Set, statically linked runtime +ibm: + $(MAKE) -f os2/makefile.os2 all \ + CC="icc -Q -O -Gs -I." \ + CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-B/ST:0x50000 -Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DEF="os2\unzip.def" + +# IBM C Set, dynamically linked runtime +ibmdyn: + $(MAKE) -f os2/makefile.os2 all \ + CC="icc -Q -O -Gs -Gd -I." \ + CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-B/ST:0x50000 -Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DEF="os2\unzip.def" + +# IBM C Set, debug version +ibmdebug: + $(MAKE) -f os2/makefile.os2 all \ + CC="icc -Q -Ti -I." \ + CFLAGS="-Sm -Sp1 -D__DEBUG_ALLOC__ -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-B/ST:0x50000 -Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DEF="os2\unzip.def" + +# IBM C Set, profiling version for PROFIT +ibmprof: + $(MAKE) -f os2/makefile.os2 all \ + CC="icc -Q -O -Gs -Gh -Ti -I." \ + CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-B/ST:0x50000 -Fe" \ + LDFLAGS2="cppopa3.obj" \ + OUT="-Fo" \ + OBJ=".obj" \ + DEF="os2\unzip.def" + +# IBM C Set, statically linked runtime +ibmdll: + $(MAKE) -f os2/makefile.os2 dll \ + CC="icc -Q -O -Gs -I." \ + CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \ + LDFLAGS="-Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DLLDEF="os2\rexxapi.def" \ + STUBDEF="os2\stub.def" \ + DEF="os2\unzip.def" \ + APILIB="REXX.lib" + +# IBM C Set, dynamically linked runtime +ibmdyndll: + $(MAKE) -f os2/makefile.os2 dll \ + CC="icc -Q -O -Gs -Gd -I." \ + CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \ + LDFLAGS="-Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DLLDEF="os2\rexxapi.def" \ + STUBDEF="os2\stub.def" \ + DEF="os2\unzip.def" \ + APILIB="REXX.lib" + +# IBM C Set, debug version +ibmdebugdll: + $(MAKE) -f os2/makefile.os2 dll \ + CC="icc -Q -Ti -I." \ + CFLAGS="-Sm -Sp1 -D__DEBUG_ALLOC__ -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \ + LDFLAGS="-Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DLLDEF="os2\rexxapi.def" \ + STUBDEF="os2\stub.def" \ + DEF="os2\unzip.def" \ + APILIB="REXX.lib" + +# IBM C Set, profiling version for PROFIT +ibmprofdll: + $(MAKE) -f os2/makefile.os2 dll \ + CC="icc -Q -O -Gs -Gh -Ti -I." \ + CFLAGS="-Gm -Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \ + LDFLAGS="-Fe" \ + LDFLAGS2="profit.obj" \ + OUT="-Fo" \ + OBJ=".obj" \ + DLLDEF="os2\rexxapi.def" \ + STUBDEF="os2\stub.def" \ + DEF="os2\unzip.def" \ + APILIB="REXX.lib" + +# Watcom C/386 9.0 or higher +watcom: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl386 -bt=os2v2 -zq -Ox -s -I." \ + CFLAGS="-Zp1 -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=os2v2 -zq -3 -mf" \ + ASFLAGS="" \ + LDFLAGS="-k0x50000 -x -l=os2v2 -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i386" \ + CRC32F="crc_i386" \ + CRC32X="crc_i386" \ + DEF="" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# Watcom C/286 9.0 or higher +watcom16: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl -bt=os2 -zq -ml -Ox -s -I." \ + CFLAGS="-Zp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=os2 -zq -2 -ml" \ + ASFLAGS="" \ + LDFLAGS="-k0x2000 -x -l=os2 -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i86" \ + CRC32F="crc_i86" \ + CRC32X="crc_i86" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# Watcom C/386 9.0 or higher, crosscompilation for DOS, DOS4GW extender +watcomdos: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl386 -bt=dos4g -zq -Ox -s -I." \ + CFLAGS="-Zp1 -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=dos4g -zq -3 -mf" \ + ASFLAGS="" \ + LDFLAGS="-k0x50000 -x -l=dos4g -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i386" \ + CRC32F="crc_i386" \ + CRC32X="crc_i386" \ + OBJU2="msdos.obj" \ + OBJX2="msdos_.obj" \ + OSDEP_H="msdos/doscfg.h" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# Watcom C/386 9.0 or higher, crosscompilation for DOS, PMODE/W extender +pmodew: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl386 -bt=dos4g -zq -Ox -s -I." \ + CFLAGS="-Zp1 -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=dos4g -zq -3 -mf" \ + ASFLAGS="" \ + LDFLAGS="-k0x50000 -x -l=pmodew -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i386" \ + CRC32F="crc_i386" \ + CRC32X="crc_i386" \ + OBJU2="msdos.obj" \ + OBJX2="msdos_.obj" \ + OSDEP_H="msdos/doscfg.h" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# Watcom C/286 9.0 or higher, crosscompilation for DOS +watcom16dos: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl -bt=dos -zq -ml -Ox -s -I." \ + CFLAGS="-Zp1 -DMSDOS $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=dos -0 -mm" \ + ASFLAGS="-D__MEDIUM__" \ + LDFLAGS="-k0xC00 -x -l=dos -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + OBJU2="msdos.obj" \ + OBJX2="msdos_.obj" \ + OSDEP_H="msdos/doscfg.h" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# Watcom C/386 9.0 or higher, crosscompilation for Win95/NT +watcomwin32: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl386 -bt=NT -zq -Ox -s -I." \ + CFLAGS="-Zp1 -DWIN32 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=NT -zq -3 -mf" \ + ASFLAGS="" \ + LDFLAGS="-k0x50000 -x -l=NT -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + OBJU2="win32.obj nt.obj" \ + OBJX2="win32_.obj nt_.obj" \ + CRC32="crc_i386" \ + CRC32F="crc_i386" \ + CRC32X="crc_i386" \ + DEF="" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# MetaWare High C/C++ 3.2 +metaware: + $(MAKE) -f os2/makefile.os2 all \ + CC="hc -O2 -I." \ + CFLAGS="-D__32BIT__ -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-o " \ + LDFLAGS2="" \ + OUT="-o ./" \ + OBJ=".obj" \ + DEF="-Hdef=os2\unzip.def" + +# Borland C++ +borland: + $(MAKE) -f os2/makefile.os2 all \ + CC="bcc -O -I. -Ios2" \ + CFLAGS="-w- -D__cdecl -D__32BIT__ -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-e" \ + LDFLAGS2="" \ + OUT="-o" \ + OBJ=".obj" \ + DEF="-sDos2\unzip.def" + +# emx, gcc, OMF format, statically linked C runtime +gcc: + $(MAKE) -f os2/makefile.os2 all \ + CC="gcc -Zomf -O -I." \ + CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="gcc -Zomf" \ + ASFLAGS="-Di386" \ + LDFLAGS="-o ./" \ + LDFLAGS2="-Zsmall-conv -Zstack 320 -Zsys -s" \ + OUT="-o" \ + OBJ=".obj" \ + CRC32="crc_gcc" \ + CRC32F="crc_gcc" \ + CRC32X="crc_gcc" \ + DEF="os2/unzip.def" + +# emx, gcc, OMF format, dynamically linked C runtime +gccdyn: + $(MAKE) -f os2/makefile.os2 all \ + CC="gcc -Zomf -O -I." \ + CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="gcc -Zomf" \ + ASFLAGS="-Di386" \ + LDFLAGS="-o ./" \ + LDFLAGS2="-Zstack 320 -Zcrtdll -s" \ + OUT="-o" \ + OBJ=".obj" \ + CRC32="crc_gcc" \ + CRC32F="crc_gcc" \ + CRC32X="crc_gcc" \ + DEF="os2/unzip.def" + +# emx, gcc, a.out format, with debug info for gdb +gccdebug: + $(MAKE) -f os2/makefile.os2 all \ + CC="gcc -g -I." \ + CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="gcc -g" \ + ASFLAGS="-Di386" \ + LDFLAGS="-o ./" \ + LDFLAGS2="-Zsmall-conv" \ + OUT="-o" \ + OBJ=".o" \ + CRC32="crc_gcc" \ + CRC32F="crc_gcc" \ + CRC32X="crc_gcc" + +# emx, gcc, a.out format, cross-compilation for MS-DOS +gccdos: + $(MAKE) -f os2/makefile.os2 all \ + CC="gcc -O -I." \ + CFLAGS="-Wall -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="gcc" \ + ASFLAGS="-Di386" \ + LDFLAGS="-o ./" \ + LDFLAGS2="-Zsmall-conv -s" \ + OUT="-o" \ + OBJ=".o" \ + CRC32="crc_gcc" \ + CRC32F="crc_gcc" \ + CRC32X="crc_gcc" \ + OBJU2="msdos.o" \ + OBJX2="msdos_.o" \ + OSDEP_H="msdos/doscfg.h" + +# emx, gcc, RSXNT, cross-compilation for Win32, statically linked C runtime +gccwin32: + $(MAKE) -f os2/makefile.os2 all \ + CC="gcc -Zwin32 -O2 -I." \ + CFLAGS="-Wall -DWIN32 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="gcc" \ + ASFLAGS="-Di386" \ + LDFLAGS="-Zsys -o ./" \ + LDFLAGS2="-ladvapi32 -Zsmall-conv -s" \ + OUT="-o" \ + OBJ=".o" \ + CRC32="crc_gcc" \ + CRC32F="crc_gcc" \ + CRC32X="crc_gcc" \ + OBJU2="win32.o nt.o" \ + OBJX2="win32_.o nt_.o" \ + OBJF2="win32f.o" \ + OSDEP_H="win32/w32cfg.h" + +# variables + +# LOCAL_UNZIP = -DREENTRANT + +# default settings for target dependent macros: +DIRSEP = / +AS_DIRSEP = / + +OSDEP_H = os2/os2data.h os2/os2cfg.h +CRC32 = crc32 +CRC32F = crc32f +CRC32X = crc32_ + +OBJU = unzip$(OBJ) $(CRC32)$(OBJ) crctab$(OBJ) crypt$(OBJ) envargs$(OBJ) \ + explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ) \ + inflate$(OBJ) list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ) \ + unreduce$(OBJ) unshrink$(OBJ) zipinfo$(OBJ) +OBJU2 = os2$(OBJ) os2acl$(OBJ) +OBJX = unzipsf_$(OBJ) $(CRC32X)$(OBJ) crctab_$(OBJ) crypt_$(OBJ) \ + extract_$(OBJ) fileio_$(OBJ) globals_$(OBJ) inflate_$(OBJ) \ + match_$(OBJ) process_$(OBJ) ttyio_$(OBJ) +OBJX2 = os2_$(OBJ) os2acl_$(OBJ) +OBJDLL= api$(OBJ) apihelp$(OBJ) rexxhelp$(OBJ) rexxapi$(OBJ) +OBJF = funzip$(OBJ) $(CRC32F)$(OBJ) cryptf$(OBJ) inflatef$(OBJ) \ + globalsf$(OBJ) ttyiof$(OBJ) +OBJF2 = + +UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H) + +# rules + +.SUFFIXES: .c .asm $(OBJ) + +.c$(OBJ): + $(CC) -c $(CFLAGS) $(DLLFLAG) $< + +.asm$(OBJ): + $(AS) $(ASFLAGS) $< $(ASEOL) + +# targets + +all: unzip.exe funzip.exe unzipsfx.exe +dll: unzip32.dll unzip.stb funzip.exe unzipsfx.exe + +unzip.exe: $(OBJU) $(OBJU2) + $(CC) $(LDFLAGS)$@ $(DEF) $(OBJU) $(OBJU2) $(LDFLAGS2) + +funzip.exe: $(OBJF) $(OBJF2) + $(CC) $(LDFLAGS)$@ $(DEF) $(OBJF) $(OBJF2) $(LDFLAGS2) + +unzipsfx.exe: $(OBJX) $(OBJX2) + $(CC) $(LDFLAGS)$@ $(DEF) $(OBJX) $(OBJX2) $(LDFLAGS2) + +unzip32.dll: $(DLLDEF) $(OBJU) $(OBJU2) $(OBJDLL) + $(CC) $(DLLFLAG) $(LDFLAGS)$@ $(DLLDEF) $(OBJU) $(OBJDLL) $(OBJU2) $(APILIB) $(LDFLAGS2) + +unzip.stb: unzipstb$(OBJ) $(STUBDEF) + $(CC) $(LDFLAGS)$@ $(STUBDEF) unzipstb$(OBJ) $(LDFLAGS2) + copy unzip.stb unzip.exe + +# dependencies + +apihelp$(OBJ): apihelp.c $(UNZIP_H) version.h +crc32$(OBJ): crc32.c $(UNZIP_H) zip.h +crctab$(OBJ): crctab.c $(UNZIP_H) zip.h +envargs$(OBJ): envargs.c $(UNZIP_H) +explode$(OBJ): explode.c $(UNZIP_H) +extract$(OBJ): extract.c $(UNZIP_H) crypt.h +fileio$(OBJ): fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h +globals$(OBJ): globals.c $(UNZIP_H) +inflate$(OBJ): inflate.c $(UNZIP_H) +list$(OBJ): list.c $(UNZIP_H) +match$(OBJ): match.c $(UNZIP_H) +process$(OBJ): process.c $(UNZIP_H) +ttyio$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h +unreduce$(OBJ): unreduce.c $(UNZIP_H) +unshrink$(OBJ): unshrink.c $(UNZIP_H) +unzip$(OBJ): unzip.c $(UNZIP_H) crypt.h version.h consts.h +api$(OBJ): api.c $(UNZIP_H) version.h +zipinfo$(OBJ): zipinfo.c $(UNZIP_H) + +funzip$(OBJ): funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h # funzip only + $(CC) -c $(CFLAGS) funzip.c + +unzipstb$(OBJ): unzipstb.c # DLL version + $(CC) -c $(CFLAGS) unzipstb.c + +msdos$(OBJ): msdos/msdos.c $(UNZIP_H) version.h # DOS only + $(CC) -c $(CFLAGS) msdos$(DIRSEP)msdos.c + +msdos_$(OBJ): msdos/msdos.c $(UNZIP_H) # DOS unzipsfx + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ msdos$(DIRSEP)msdos.c + +win32$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h version.h # Win32 only + $(CC) -c $(CFLAGS) win32$(DIRSEP)win32.c + +nt$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h # Win32 only + $(CC) -c $(CFLAGS) win32$(DIRSEP)nt.c + +win32_$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h # Win32 unzipsfx + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ win32$(DIRSEP)win32.c + +nt_$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h # Win32 unzipsfx + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ win32$(DIRSEP)nt.c + +win32f$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h # Win32 funzip + $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ win32$(DIRSEP)win32.c + +os2$(OBJ): os2/os2.c $(UNZIP_H) version.h # OS/2 only + $(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)os2.c + +os2_$(OBJ): os2/os2.c $(UNZIP_H) # OS/2 unzipsfx + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ os2$(DIRSEP)os2.c + +os2acl$(OBJ): os2/os2acl.c $(UNZIP_H) version.h # OS/2 only + $(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)os2acl.c + +os2acl_$(OBJ): os2/os2acl.c $(UNZIP_H) version.h # OS/2 unzipsfx + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ os2$(DIRSEP)os2acl.c + +rexxhelp$(OBJ): os2/rexxhelp.c # OS/2 DLL only + $(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)rexxhelp.c + +rexxapi$(OBJ): os2/rexxapi.c # OS/2 DLL only + $(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)rexxapi.c + +crc_i86$(OBJ): msdos/crc_i86.asm # 16bit only + $(AS) $(ASFLAGS) msdos$(AS_DIRSEP)crc_i86.asm $(ASEOL) + +crc_i386$(OBJ): win32/crc_i386.asm # 32bit, MASM + $(AS) $(ASFLAGS) win32$(AS_DIRSEP)crc_i386.asm $(ASEOL) + +crc_gcc$(OBJ): crc_i386.S # 32bit, GNU AS + $(AS) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S + +# NFLAGS are solely used as work-around for optimization bug in IBM C++ Set +crypt$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h + $(CC) -c $(CFLAGS) $(DLLFLAG) $(NFLAGS) crypt.c + +cryptf$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h # funzip only + $(CC) -c $(CFLAGS) $(NFLAGS) -DFUNZIP $(OUT)$@ crypt.c + +crc32f$(OBJ): crc32.c $(UNZIP_H) zip.h # funzip only + $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ crc32.c + +globalsf$(OBJ): globals.c $(UNZIP_H) # funzip only + $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ globals.c + +inflatef$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h # funzip only + $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ inflate.c + +ttyiof$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h # funzip only + $(CC) -c $(CFLAGS) $(NFLAGS) -DFUNZIP $(OUT)$@ ttyio.c + +crc32_$(OBJ): crc32.c $(UNZIP_H) zip.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crc32.c + +crctab_$(OBJ): crctab.c $(UNZIP_H) zip.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crctab.c + +crypt_$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crypt.c + +extract_$(OBJ): extract.c $(UNZIP_H) crypt.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ extract.c + +fileio_$(OBJ): fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ fileio.c + +globals_$(OBJ): globals.c $(UNZIP_H) # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ globals.c + +inflate_$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ inflate.c + +match_$(OBJ): match.c $(UNZIP_H) # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ match.c + +process_$(OBJ): process.c $(UNZIP_H) # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ process.c + +ttyio_$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ ttyio.c + +unzipsf_$(OBJ): unzip.c $(UNZIP_H) crypt.h version.h consts.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ unzip.c diff --git a/utils/Install/packzip/match.c b/utils/Install/packzip/match.c new file mode 100644 index 0000000000..77355d4400 --- /dev/null +++ b/utils/Install/packzip/match.c @@ -0,0 +1,294 @@ +/*--------------------------------------------------------------------------- + + match.c + + The match() routine recursively compares a string to a "pattern" (regular + expression), returning TRUE if a match is found or FALSE if not. This + version is specifically for use with unzip.c: as did the previous match() + routines from SEA and J. Kercheval, it leaves the case (upper, lower, or + mixed) of the string alone, but converts any uppercase characters in the + pattern to lowercase if indicated by the global var pInfo->lcflag (which + is to say, string is assumed to have been converted to lowercase already, + if such was necessary). + + GRR: reversed order of text, pattern in matche() (now same as match()); + added ignore_case/ic flags, Case() macro. + + PaulK: replaced matche() with recmatch() from Zip, modified to have an + ignore_case argument; replaced test frame with simpler one. + + --------------------------------------------------------------------------- + + Copyright on recmatch() from Zip's util.c (although recmatch() was almost + certainly written by Mark Adler...ask me how I can tell :-) ): + + Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly, + Kai Uwe Rommel and Igor Mandrichenko. + + Permission is granted to any individual or institution to use, copy, + or redistribute this software so long as all of the original files are + included unmodified, that it is not sold for profit, and that this copy- + right notice is retained. + + --------------------------------------------------------------------------- + + Match the pattern (wildcard) against the string (fixed): + + match(string, pattern, ignore_case); + + returns TRUE if string matches pattern, FALSE otherwise. In the pattern: + + `*' matches any sequence of characters (zero or more) + `?' matches any single character + [SET] matches any character in the specified set, + [!SET] or [^SET] matches any character not in the specified set. + + A set is composed of characters or ranges; a range looks like ``character + hyphen character'' (as in 0-9 or A-Z). [0-9a-zA-Z_] is the minimal set of + characters allowed in the [..] pattern construct. Other characters are + allowed (i.e., 8-bit characters) if your system will support them. + + To suppress the special syntactic significance of any of ``[]*?!^-\'', in- + side or outside a [..] construct, and match the character exactly, precede + it with a ``\'' (backslash). + + Note that "*.*" and "*." are treated specially under MS-DOS if DOSWILD is + defined. See the DOSWILD section below for an explanation. Note also + that with VMSWILD defined, '%' is used instead of '?', and sets (ranges) + are delimited by () instead of []. + + ---------------------------------------------------------------------------*/ + + + +/* define ToLower() in here (for Unix, define ToLower to be macro (using + * isupper()); otherwise just use tolower() */ +#define UNZIP_INTERNAL +#include "unzip.h" + +#if 0 /* this is not useful until it matches Amiga names insensitively */ +#ifdef AMIGA /* some other platforms might also want to use this */ +# define ANSI_CHARSET /* MOVE INTO UNZIP.H EVENTUALLY */ +#endif +#endif /* 0 */ + +#ifdef ANSI_CHARSET +# ifdef ToLower +# undef ToLower +# endif + /* uppercase letters are values 41 thru 5A, C0 thru D6, and D8 thru DE */ +# define IsUpper(c) (c>=0xC0 ? c<=0xDE && c!=0xD7 : c>=0x41 && c<=0x5A) +# define ToLower(c) (IsUpper((uch) c) ? (unsigned) c | 0x20 : (unsigned) c) +#endif +#define Case(x) (ic? ToLower(x) : (x)) + +#ifdef VMSWILD +# define WILDCHAR '%' +# define BEG_RANGE '(' +# define END_RANGE ')' +#else +# define WILDCHAR '?' +# define BEG_RANGE '[' +# define END_RANGE ']' +#endif + +#if 0 /* GRR: add this to unzip.h someday... */ +#if !(defined(MSDOS) && defined(DOSWILD)) +#define match(s,p,ic) (recmatch((ZCONST uch *)p,(ZCONST uch *)s,ic) == 1) +int recmatch OF((ZCONST uch *pattern, ZCONST uch *string, int ignore_case)); +#endif +#endif /* 0 */ +static int recmatch OF((ZCONST uch *pattern, ZCONST uch *string, + int ignore_case)); + + + +/* match() is a shell to recmatch() to return only Boolean values. */ + +int match(string, pattern, ignore_case) + ZCONST char *string, *pattern; + int ignore_case; +{ +#if (defined(MSDOS) && defined(DOSWILD)) + char *dospattern; + int j = strlen(pattern); + +/*--------------------------------------------------------------------------- + Optional MS-DOS preprocessing section: compare last three chars of the + wildcard to "*.*" and translate to "*" if found; else compare the last + two characters to "*." and, if found, scan the non-wild string for dots. + If in the latter case a dot is found, return failure; else translate the + "*." to "*". In either case, continue with the normal (Unix-like) match + procedure after translation. (If not enough memory, default to normal + match.) This causes "a*.*" and "a*." to behave as MS-DOS users expect. + ---------------------------------------------------------------------------*/ + + if ((dospattern = (char *)malloc(j+1)) != NULL) { + strcpy(dospattern, pattern); + if (!strcmp(dospattern+j-3, "*.*")) { + dospattern[j-2] = '\0'; /* nuke the ".*" */ + } else if (!strcmp(dospattern+j-2, "*.")) { + char *p = strchr(string, '.'); + + if (p) { /* found a dot: match fails */ + free(dospattern); + return 0; + } + dospattern[j-1] = '\0'; /* nuke the end "." */ + } + j = recmatch((uch *)dospattern, (uch *)string, ignore_case); + free(dospattern); + return j == 1; + } else +#endif /* MSDOS && DOSWILD */ + return recmatch((uch *)pattern, (uch *)string, ignore_case) == 1; +} + + + +static int recmatch(p, s, ic) + ZCONST uch *p; /* sh pattern to match */ + ZCONST uch *s; /* string to which to match it */ + int ic; /* true for case insensitivity */ +/* Recursively compare the sh pattern p with the string s and return 1 if + * they match, and 0 or 2 if they don't or if there is a syntax error in the + * pattern. This routine recurses on itself no more deeply than the number + * of characters in the pattern. */ +{ + unsigned int c; /* pattern char or start of range in [-] loop */ + + /* Get first character, the pattern for new recmatch calls follows */ + c = *p++; + + /* If that was the end of the pattern, match if string empty too */ + if (c == 0) + return *s == 0; + + /* '?' (or '%') matches any character (but not an empty string) */ + if (c == WILDCHAR) + return *s ? recmatch(p, s + 1, ic) : 0; + + /* '*' matches any number of characters, including zero */ +#ifdef AMIGA + if (c == '#' && *p == '?') /* "#?" is Amiga-ese for "*" */ + c = '*', p++; +#endif /* AMIGA */ + if (c == '*') { + if (*p == 0) + return 1; + for (; *s; s++) + if ((c = recmatch(p, s, ic)) != 0) + return (int)c; + return 2; /* 2 means give up--match will return false */ + } + + /* Parse and process the list of characters and ranges in brackets */ + if (c == BEG_RANGE) { + int e; /* flag true if next char to be taken literally */ + ZCONST uch *q; /* pointer to end of [-] group */ + int r; /* flag true to match anything but the range */ + + if (*s == 0) /* need a character to match */ + return 0; + p += (r = (*p == '!' || *p == '^')); /* see if reverse */ + for (q = p, e = 0; *q; q++) /* find closing bracket */ + if (e) + e = 0; + else + if (*q == '\\') /* GRR: change to ^ for MS-DOS, OS/2? */ + e = 1; + else if (*q == END_RANGE) + break; + if (*q != END_RANGE) /* nothing matches if bad syntax */ + return 0; + for (c = 0, e = *p == '-'; p < q; p++) { /* go through the list */ + if (e == 0 && *p == '\\') /* set escape flag if \ */ + e = 1; + else if (e == 0 && *p == '-') /* set start of range if - */ + c = *(p-1); + else { + unsigned int cc = Case(*s); + + if (*(p+1) != '-') + for (c = c ? c : *p; c <= *p; c++) /* compare range */ + if ((unsigned)Case(c) == cc) /* typecast for MSC bug */ + return r ? 0 : recmatch(q + 1, s + 1, ic); + c = e = 0; /* clear range, escape flags */ + } + } + return r ? recmatch(q + 1, s + 1, ic) : 0; /* bracket match failed */ + } + + /* if escape ('\'), just compare next character */ + if (c == '\\' && (c = *p++) == 0) /* if \ at end, then syntax error */ + return 0; + + /* just a character--compare it */ +#ifdef QDOS + return QMatch(Case((uch)c), Case(*s)) ? recmatch(p, ++s, ic) : 0; +#else + return Case((uch)c) == Case(*s) ? recmatch(p, ++s, ic) : 0; +#endif + +} /* end function recmatch() */ + + + + + +int iswild(p) /* originally only used for stat()-bug workaround in */ + ZCONST char *p; /* VAX C, Turbo/Borland C, Watcom C, Atari MiNT libs; */ +{ /* now used in process_zipfiles() as well */ + for (; *p; ++p) + if (*p == '\\' && *(p+1)) + ++p; +#ifdef VMS + else if (*p == '%' || *p == '*') +#else /* !VMS */ +#ifdef AMIGA + else if (*p == '?' || *p == '*' || (*p=='#' && p[1]=='?') || *p == '[') +#else /* !AMIGA */ + else if (*p == '?' || *p == '*' || *p == '[') +#endif /* ?AMIGA */ +#endif /* ?VMS */ +#ifdef QDOS + return (int)p; +#else + return TRUE; +#endif + + return FALSE; + +} /* end function iswild() */ + + + + + +#ifdef TEST_MATCH + +#define put(s) {fputs(s,stdout); fflush(stdout);} + +void main() +{ + char pat[256], str[256]; + + for (;;) { + put("Pattern (return to exit): "); + gets(pat); + if (!pat[0]) + break; + for (;;) { + put("String (return for new pattern): "); + gets(str); + if (!str[0]) + break; + pipeit("Case sensitive: %s insensitive: %s\n", + match(str, pat, 0) ? "YES" : "NO", + match(str, pat, 1) ? "YES" : "NO"); + } + } + EXIT(0); +} + +#endif /* TEST_MATCH */ diff --git a/utils/Install/packzip/nt.c b/utils/Install/packzip/nt.c new file mode 100644 index 0000000000..ab4cea3a9f --- /dev/null +++ b/utils/Install/packzip/nt.c @@ -0,0 +1,659 @@ +/* + + Copyright (c) 1996 Scott Field + + Module Name: + + nt.c + + Abstract: + + This module implements WinNT security descriptor operations for the + Win32 Info-ZIP project. Operation such as setting file security, + using/querying local and remote privileges, and queuing of operations + is performed here. The contents of this module are only relevant + when the code is running on Windows NT, and the target volume supports + persistent Acl storage. + + User privileges that allow accessing certain privileged aspects of the + security descriptor (such as the Sacl) are only used if the user specified + to do so. + + Author: + + Scott Field (sfield@microsoft.com) + + Last revised: 18 Jan 97 + + */ + +#define WIN32_LEAN_AND_MEAN +#define UNZIP_INTERNAL +#include "unzip.h" +#include <windows.h> +#ifdef __RSXNT__ +# include "rsxntwin.h" +#endif +#include "nt.h" + + +#ifdef NTSD_EAS /* This file is only needed for NTSD handling */ + +/* Borland C++ does not define FILE_SHARE_DELETE. Others also? */ +#ifndef FILE_SHARE_DELETE +# define FILE_SHARE_DELETE 0x00000004 +#endif + + +/* private prototypes */ + +static BOOL Initialize(VOID); +#if 0 /* currently unused */ +static BOOL Shutdown(VOID); +#endif +static BOOL DeferSet(char *resource, PVOLUMECAPS VolumeCaps, uch *buffer); +static VOID GetRemotePrivilegesSet(CHAR *FileName, PDWORD dwRemotePrivileges); +static VOID InitLocalPrivileges(VOID); + + +BOOL bInitialized = FALSE; /* module level stuff initialized? */ +HANDLE hInitMutex = NULL; /* prevent multiple initialization */ + +BOOL g_bRestorePrivilege = FALSE; /* for local set file security override */ +BOOL g_bSaclPrivilege = FALSE; /* for local set sacl operations, only when + restore privilege not present */ + +/* our single cached volume capabilities structure that describes the last + volume root we encountered. A single entry like this works well in the + zip/unzip scenario for a number of reasons: + 1. typically one extraction path during unzip. + 2. typically process one volume at a time during zip, and then move + on to the next. + 3. no cleanup code required and no memory leaks. + 4. simple code. + + This approach should be reworked to a linked list approach if we expect to + be called by many threads which are processing a variety of input/output + volumes, since lock contention and stale data may become a bottleneck. */ + +VOLUMECAPS g_VolumeCaps; +CRITICAL_SECTION VolumeCapsLock; + + +/* our deferred set structure linked list element, used for making a copy + of input data which is used at a later time to process the original input + at a time when it makes more sense. eg, applying security to newly created + directories, after all files have been placed in such directories. */ + +CRITICAL_SECTION SetDeferLock; + +typedef struct _DEFERRED_SET { + struct _DEFERRED_SET *Next; + uch *buffer; /* must point to DWORD aligned block */ + PVOLUMECAPS VolumeCaps; + char *resource; +} DEFERRED_SET, *PDEFERRED_SET, *LPDEFERRED_SET; + +PDEFERRED_SET pSetHead = NULL; +PDEFERRED_SET pSetTail; + +static BOOL Initialize(VOID) +{ + HANDLE hMutex; + HANDLE hOldMutex; + + if(bInitialized) return TRUE; + + hMutex = CreateMutex(NULL, TRUE, NULL); + if(hMutex == NULL) return FALSE; + + hOldMutex = (HANDLE)InterlockedExchange((LPLONG)&hInitMutex, (LONG)hMutex); + + if(hOldMutex != NULL) { + /* somebody setup the mutex already */ + InterlockedExchange((LPLONG)&hInitMutex, (LONG)hOldMutex); + + CloseHandle(hMutex); /* close new, un-needed mutex */ + + /* wait for initialization to complete and return status */ + WaitForSingleObject(hOldMutex, INFINITE); + ReleaseMutex(hOldMutex); + + return bInitialized; + } + + /* initialize module level resources */ + + InitializeCriticalSection( &SetDeferLock ); + + InitializeCriticalSection( &VolumeCapsLock ); + memset(&g_VolumeCaps, 0, sizeof(VOLUMECAPS)); + + InitLocalPrivileges(); + + bInitialized = TRUE; + + ReleaseMutex(hMutex); /* release correct mutex */ + + return TRUE; +} + +#if 0 /* currently not used ! */ +static BOOL Shutdown(VOID) +{ + /* really need to free critical sections, disable enabled privilges, etc, + but doing so brings up possibility of race conditions if those resources + are about to be used. The easiest way to handle this is let these + resources be freed when the process terminates... */ + + return TRUE; +} +#endif /* never */ + + +static BOOL DeferSet(char *resource, PVOLUMECAPS VolumeCaps, uch *buffer) +{ + PDEFERRED_SET psd; + DWORD cbDeferSet; + DWORD cbResource; + DWORD cbBuffer; + + if(!bInitialized) if(!Initialize()) return FALSE; + + cbResource = lstrlenA(resource) + 1; + cbBuffer = GetSecurityDescriptorLength((PSECURITY_DESCRIPTOR)buffer); + cbDeferSet = sizeof(DEFERRED_SET) + cbBuffer + sizeof(VOLUMECAPS) + + cbResource; + + psd = (PDEFERRED_SET)HeapAlloc(GetProcessHeap(), 0, cbDeferSet); + if(psd == NULL) return FALSE; + + psd->Next = NULL; + psd->buffer = (uch *)(psd+1); + psd->VolumeCaps = (PVOLUMECAPS)((char *)psd->buffer + cbBuffer); + psd->resource = (char *)((char *)psd->VolumeCaps + sizeof(VOLUMECAPS)); + + memcpy(psd->buffer, buffer, cbBuffer); + memcpy(psd->VolumeCaps, VolumeCaps, sizeof(VOLUMECAPS)); + psd->VolumeCaps->bProcessDefer = TRUE; + memcpy(psd->resource, resource, cbResource); + + /* take defer lock */ + EnterCriticalSection( &SetDeferLock ); + + /* add element at tail of list */ + + if(pSetHead == NULL) { + pSetHead = psd; + } else { + pSetTail->Next = psd; + } + + pSetTail = psd; + + /* release defer lock */ + LeaveCriticalSection( &SetDeferLock ); + + return TRUE; +} + +BOOL ProcessDefer(PDWORD dwDirectoryCount, PDWORD dwBytesProcessed, + PDWORD dwDirectoryFail, PDWORD dwBytesFail) +{ + PDEFERRED_SET This; + PDEFERRED_SET Next; + + *dwDirectoryCount = 0; + *dwBytesProcessed = 0; + + *dwDirectoryFail = 0; + *dwBytesFail = 0; + + if(!bInitialized) return TRUE; /* nothing to do */ + + EnterCriticalSection( &SetDeferLock ); + + This = pSetHead; + + while(This) { + + if(SecuritySet(This->resource, This->VolumeCaps, This->buffer)) { + (*dwDirectoryCount)++; + *dwBytesProcessed += + GetSecurityDescriptorLength((PSECURITY_DESCRIPTOR)This->buffer); + } else { + (*dwDirectoryFail)++; + *dwBytesFail += + GetSecurityDescriptorLength((PSECURITY_DESCRIPTOR)This->buffer); + } + + Next = This->Next; + HeapFree(GetProcessHeap(), 0, This); + This = Next; + } + + pSetHead = NULL; + + LeaveCriticalSection( &SetDeferLock ); + + return TRUE; +} + +BOOL ValidateSecurity(uch *securitydata) +{ + PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR)securitydata; + PACL pAcl; + PSID pSid; + BOOL bAclPresent; + BOOL bDefaulted; + + if(!IsWinNT()) return TRUE; /* don't do anything if not on WinNT */ + + if(!IsValidSecurityDescriptor(sd)) return FALSE; + + /* verify Dacl integrity */ + + if(!GetSecurityDescriptorDacl(sd, &bAclPresent, &pAcl, &bDefaulted)) + return FALSE; + + if(bAclPresent) { + if(!IsValidAcl(pAcl)) return FALSE; + } + + /* verify Sacl integrity */ + + if(!GetSecurityDescriptorSacl(sd, &bAclPresent, &pAcl, &bDefaulted)) + return FALSE; + + if(bAclPresent) { + if(!IsValidAcl(pAcl)) return FALSE; + } + + /* verify owner integrity */ + + if(!GetSecurityDescriptorOwner(sd, &pSid, &bDefaulted)) + return FALSE; + + if(pSid != NULL) { + if(!IsValidSid(pSid)) return FALSE; + } + + /* verify group integrity */ + + if(!GetSecurityDescriptorGroup(sd, &pSid, &bDefaulted)) + return FALSE; + + if(pSid != NULL) { + if(!IsValidSid(pSid)) return FALSE; + } + + return TRUE; +} + +static VOID GetRemotePrivilegesSet(char *FileName, PDWORD dwRemotePrivileges) +{ + HANDLE hFile; + + *dwRemotePrivileges = 0; + + /* see if we have the SeRestorePrivilege */ + + hFile = CreateFileA( + FileName, + ACCESS_SYSTEM_SECURITY | WRITE_DAC | WRITE_OWNER | READ_CONTROL, + FILE_SHARE_READ | FILE_SHARE_DELETE, /* no sd updating allowed here */ + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + NULL + ); + + if(hFile != INVALID_HANDLE_VALUE) { + /* no remote way to determine SeRestorePrivilege -- just try a + read/write to simulate it */ + SECURITY_INFORMATION si = DACL_SECURITY_INFORMATION | + SACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION; + PSECURITY_DESCRIPTOR sd; + DWORD cbBuf = 0; + + GetKernelObjectSecurity(hFile, si, NULL, cbBuf, &cbBuf); + + if(ERROR_INSUFFICIENT_BUFFER == GetLastError()) { + if((sd = HeapAlloc(GetProcessHeap(), 0, cbBuf)) != NULL) { + if(GetKernelObjectSecurity(hFile, si, sd, cbBuf, &cbBuf)) { + if(SetKernelObjectSecurity(hFile, si, sd)) + *dwRemotePrivileges |= OVERRIDE_RESTORE; + } + HeapFree(GetProcessHeap(), 0, sd); + } + } + + CloseHandle(hFile); + } else { + + /* see if we have the SeSecurityPrivilege */ + /* note we don't need this if we have SeRestorePrivilege */ + + hFile = CreateFileA( + FileName, + ACCESS_SYSTEM_SECURITY, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, /* max */ + NULL, + OPEN_EXISTING, + 0, + NULL + ); + + if(hFile != INVALID_HANDLE_VALUE) { + CloseHandle(hFile); + *dwRemotePrivileges |= OVERRIDE_SACL; + } + } +} + + +BOOL GetVolumeCaps( + char *rootpath, /* filepath, or NULL */ + char *name, /* filename associated with rootpath */ + PVOLUMECAPS VolumeCaps /* result structure describing capabilities */ + ) +{ + char TempRootPath[MAX_PATH + 1]; + DWORD cchTempRootPath = 0; + BOOL bSuccess = TRUE; /* assume success until told otherwise */ + + if(!bInitialized) if(!Initialize()) return FALSE; + + /* process the input path to produce a consistent path suitable for + compare operations and also suitable for certain picky Win32 API + that don't like forward slashes */ + + if(rootpath != NULL && rootpath[0] != '\0') { + DWORD i; + + cchTempRootPath = lstrlen(rootpath); + if(cchTempRootPath > MAX_PATH) return FALSE; + + /* copy input, converting forward slashes to back slashes as we go */ + + for(i = 0 ; i <= cchTempRootPath ; i++) { + if(rootpath[i] == '/') TempRootPath[i] = '\\'; + else TempRootPath[i] = rootpath[i]; + } + + /* check for UNC and Null terminate or append trailing \ as + appropriate */ + + /* possible valid UNCs we are passed follow: + \\machine\foo\bar (path is \\machine\foo\) + \\machine\foo (path is \\machine\foo\) + \\machine\foo\ + \\.\c$\ (FIXFIX: Win32API doesn't like this - GetComputerName()) + LATERLATER: handling mounted DFS drives in the future will require + slightly different logic which isn't available today. + This is required because directories can point at + different servers which have differing capabilities. + */ + + if(TempRootPath[0] == '\\' && TempRootPath[1] == '\\') { + DWORD slash = 0; + + for(i = 2 ; i < cchTempRootPath ; i++) { + if(TempRootPath[i] == '\\') { + slash++; + + if(slash == 2) { + i++; + TempRootPath[i] = '\0'; + cchTempRootPath = i; + break; + } + } + } + + /* if there was only one slash found, just tack another onto the + end */ + + if(slash == 1 && TempRootPath[cchTempRootPath] != '\\') { + TempRootPath[cchTempRootPath] = TempRootPath[0]; /* '\' */ + TempRootPath[cchTempRootPath+1] = '\0'; + cchTempRootPath++; + } + + } else { + + if(TempRootPath[1] == ':') { + + /* drive letter specified, truncate to root */ + TempRootPath[2] = '\\'; + TempRootPath[3] = '\0'; + cchTempRootPath = 3; + } else { + + /* must be file on current drive */ + TempRootPath[0] = '\0'; + cchTempRootPath = 0; + } + + } + + } /* if path != NULL */ + + /* grab lock protecting cached entry */ + EnterCriticalSection( &VolumeCapsLock ); + + if(!g_VolumeCaps.bValid || + lstrcmpi(g_VolumeCaps.RootPath, TempRootPath) != 0) + { + + /* no match found, build up new entry */ + + DWORD dwFileSystemFlags; + DWORD dwRemotePrivileges = 0; + BOOL bRemote = FALSE; + + /* release lock during expensive operations */ + LeaveCriticalSection( &VolumeCapsLock ); + + bSuccess = GetVolumeInformation( + (TempRootPath[0] == '\0') ? NULL : TempRootPath, + NULL, 0, + NULL, NULL, + &dwFileSystemFlags, + NULL, 0); + + + /* only if target volume supports Acls, and we were told to use + privileges do we need to go out and test for the remote case */ + + if(bSuccess && (dwFileSystemFlags & FS_PERSISTENT_ACLS) && + VolumeCaps->bUsePrivileges) + { + if(GetDriveType( (TempRootPath[0] == '\0') ? NULL : TempRootPath ) + == DRIVE_REMOTE) + { + bRemote = TRUE; + + /* make a determination about our remote capabilities */ + + GetRemotePrivilegesSet(name, &dwRemotePrivileges); + } + } + + /* always take the lock again, since we release it below */ + EnterCriticalSection( &VolumeCapsLock ); + + /* replace the existing data if successful */ + if(bSuccess) { + + lstrcpynA(g_VolumeCaps.RootPath, TempRootPath, cchTempRootPath+1); + g_VolumeCaps.bProcessDefer = FALSE; + g_VolumeCaps.dwFileSystemFlags = dwFileSystemFlags; + g_VolumeCaps.bRemote = bRemote; + g_VolumeCaps.dwRemotePrivileges = dwRemotePrivileges; + g_VolumeCaps.bValid = TRUE; + } + } + + if(bSuccess) { + /* copy input elements */ + g_VolumeCaps.bUsePrivileges = VolumeCaps->bUsePrivileges; + g_VolumeCaps.dwFileAttributes = VolumeCaps->dwFileAttributes; + + /* give caller results */ + memcpy(VolumeCaps, &g_VolumeCaps, sizeof(VOLUMECAPS)); + } else { + g_VolumeCaps.bValid = FALSE; + } + + LeaveCriticalSection( &VolumeCapsLock ); /* release lock */ + + return bSuccess; +} + + +BOOL SecuritySet(char *resource, PVOLUMECAPS VolumeCaps, uch *securitydata) +{ + HANDLE hFile; + DWORD dwDesiredAccess = 0; + DWORD dwFlags = 0; + PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR)securitydata; + SECURITY_DESCRIPTOR_CONTROL sdc; + SECURITY_INFORMATION RequestedInfo = 0; + DWORD dwRev; + BOOL bRestorePrivilege = FALSE; + BOOL bSaclPrivilege = FALSE; + BOOL bSuccess; + + if(!bInitialized) if(!Initialize()) return FALSE; + + /* defer directory processing */ + + if(VolumeCaps->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + if(!VolumeCaps->bProcessDefer) { + return DeferSet(resource, VolumeCaps, securitydata); + } else { + /* opening a directory requires FILE_FLAG_BACKUP_SEMANTICS */ + dwFlags |= FILE_FLAG_BACKUP_SEMANTICS; + } + } + + /* evaluate the input security desriptor and act accordingly */ + + if(!IsValidSecurityDescriptor(sd)) + return FALSE; + + if(!GetSecurityDescriptorControl(sd, &sdc, &dwRev)) + return FALSE; + + /* setup privilege usage based on if told we can use privileges, and if so, + what privileges we have */ + + if(VolumeCaps->bUsePrivileges) { + if(VolumeCaps->bRemote) { + /* use remotely determined privileges */ + if(VolumeCaps->dwRemotePrivileges & OVERRIDE_RESTORE) + bRestorePrivilege = TRUE; + + if(VolumeCaps->dwRemotePrivileges & OVERRIDE_SACL) + bSaclPrivilege = TRUE; + + } else { + /* use local privileges */ + bRestorePrivilege = g_bRestorePrivilege; + bSaclPrivilege = g_bSaclPrivilege; + } + } + + + /* if a Dacl is present write Dacl out */ + /* if we have SeRestorePrivilege, write owner and group info out */ + + if(sdc & SE_DACL_PRESENT) { + dwDesiredAccess |= WRITE_DAC; + RequestedInfo |= DACL_SECURITY_INFORMATION; + + if(bRestorePrivilege) { + dwDesiredAccess |= WRITE_OWNER; + RequestedInfo |= (OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION); + } + } + + /* if a Sacl is present and we have either SeRestorePrivilege or + SeSystemSecurityPrivilege try to write Sacl out */ + + if((sdc & SE_SACL_PRESENT) && (bRestorePrivilege || bSaclPrivilege)) { + dwDesiredAccess |= ACCESS_SYSTEM_SECURITY; + RequestedInfo |= SACL_SECURITY_INFORMATION; + } + + if(RequestedInfo == 0) /* nothing to do */ + return FALSE; + + if(bRestorePrivilege) + dwFlags |= FILE_FLAG_BACKUP_SEMANTICS; + + hFile = CreateFileA( + resource, + dwDesiredAccess, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,/* max sharing */ + NULL, + OPEN_EXISTING, + dwFlags, + NULL + ); + + if(hFile == INVALID_HANDLE_VALUE) + return FALSE; + + bSuccess = SetKernelObjectSecurity(hFile, RequestedInfo, sd); + + CloseHandle(hFile); + + return bSuccess; +} + +static VOID InitLocalPrivileges(VOID) +{ + HANDLE hToken; + TOKEN_PRIVILEGES tp; + + /* try to enable some interesting privileges that give us the ability + to get some security information that we normally cannot. + + note that enabling privileges is only relevant on the local machine; + when accessing files that are on a remote machine, any privileges + that are present on the remote machine get enabled by default. */ + + if(!OpenProcessToken(GetCurrentProcess(), + TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &hToken)) + return; + + tp.PrivilegeCount = 1; + tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + + if(LookupPrivilegeValue(NULL, SE_RESTORE_NAME, &tp.Privileges[0].Luid)) { + + /* try to enable SeRestorePrivilege; if this succeeds, we can write + all aspects of the security descriptor */ + + if(AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL) && + GetLastError() == ERROR_SUCCESS) g_bRestorePrivilege = TRUE; + + } + + /* try to enable SeSystemSecurityPrivilege, if SeRestorePrivilege not + present; if this succeeds, we can write the Sacl */ + + if(!g_bRestorePrivilege && + LookupPrivilegeValue(NULL, SE_SECURITY_NAME, &tp.Privileges[0].Luid)) { + + if(AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL) && + GetLastError() == ERROR_SUCCESS) g_bSaclPrivilege = TRUE; + } + + CloseHandle(hToken); +} +#endif /* NTSD_EAS */ diff --git a/utils/Install/packzip/os2.c b/utils/Install/packzip/os2.c new file mode 100644 index 0000000000..a9a962796c --- /dev/null +++ b/utils/Install/packzip/os2.c @@ -0,0 +1,2187 @@ +/*--------------------------------------------------------------------------- + + os2.c + + OS/2-specific routines for use with Info-ZIP's UnZip 5.1 and later. + + This file contains the OS/2 versions of the file name/attribute/time/etc + code. Most or all of the routines which make direct use of OS/2 system + calls (i.e., the non-lowercase routines) are Kai Uwe Rommel's. The read- + dir() suite was written by Michael Rendell and ported to OS/2 by Kai Uwe; + it is in the public domain. + + Contains: GetCountryInfo() + GetFileTime() + SetFileTime() (TIMESTAMP only) + stamp_file() (TIMESTAMP only) + Utime2DosDateTime() + SetPathAttrTimes() + SetEAs() + GetLoadPath() + opendir() + closedir() + readdir() + [ seekdir() ] not used + [ telldir() ] not used + free_dircontents() + getdirent() + IsFileSystemFAT() + do_wild() + mapattr() + mapname() + checkdir() + isfloppy() + IsFileNameValid() + map2fat() + SetLongNameEA() + close_outfile() + check_for_newer() + dateformat() + version() + InitNLS() + IsUpperNLS() + ToLowerNLS() + StringLower() + DebugMalloc() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" +#include "os2acl.h" + +extern ZCONST char Far TruncEAs[]; + +/* local prototypes */ + +#ifdef TIMESTAMP + static int SetFileTime(ZCONST char *name, ulg stamp); +#endif +#if defined(USE_EF_UT_TIME) || defined(TIMESTAMP) + static ulg Utime2DosDateTime OF((time_t uxtime)); +#endif +static int getOS2filetimes OF((__GPRO__ + ulg *pM_dt, ulg *pA_dt, ulg *pC_dt)); +static void SetPathAttrTimes OF((__GPRO__ int flags, int dir)); +static int SetEAs OF((__GPRO__ const char *path, + void *ef_block)); +static int SetACL OF((__GPRO__ const char *path, + void *ef_block)); +static int EvalExtraFields OF((__GPRO__ const char *path, + void *extra_field, unsigned ef_len)); +static int isfloppy OF((int nDrive)); +static int IsFileNameValid OF((const char *name)); +static void map2fat OF((char *pathcomp, char **pEndFAT)); +static int SetLongNameEA OF((char *name, char *longname)); +static void InitNLS OF((void)); + + +/*****************************/ +/* Strings used in os2.c */ +/*****************************/ + +#ifndef SFX + static char Far CantAllocateWildcard[] = + "warning: cannot allocate wildcard buffers\n"; +#endif +static char Far Creating[] = " creating: %-22s "; +static char Far ConversionFailed[] = "mapname: conversion of %s failed\n"; +static char Far Labelling[] = "labelling %c: %-22s\n"; +static char Far ErrSetVolLabel[] = "mapname: error setting volume label\n"; +static char Far PathTooLong[] = "checkdir error: path too long: %s\n"; +static char Far CantCreateDir[] = "checkdir error: cannot create %s\n\ + unable to process %s.\n"; +static char Far DirIsntDirectory[] = + "checkdir error: %s exists but is not directory\n\ + unable to process %s.\n"; +static char Far PathTooLongTrunc[] = + "checkdir warning: path too long; truncating\n %s\n\ + -> %s\n"; +#if (!defined(SFX) || defined(SFX_EXDIR)) + static char Far CantCreateExtractDir[] = + "checkdir: cannot create extraction directory: %s\n"; +#endif + +#ifndef __EMX__ +# if (_MSC_VER >= 600) || defined(__IBMC__) +# include <direct.h> /* have special MSC/IBM C mkdir prototype */ +# else /* own prototype because dir.h conflicts? */ + int mkdir(const char *path); +# endif +# define MKDIR(path,mode) mkdir(path) +#else +# define MKDIR(path,mode) mkdir(path,mode) +#endif + + +#ifdef __32BIT__ + +USHORT DosDevIOCtl32(PVOID pData, USHORT cbData, PVOID pParms, USHORT cbParms, + USHORT usFunction, USHORT usCategory, HFILE hDevice) +{ + ULONG ulParmLengthInOut = cbParms, ulDataLengthInOut = cbData; + return (USHORT) DosDevIOCtl(hDevice, usCategory, usFunction, + pParms, cbParms, &ulParmLengthInOut, + pData, cbData, &ulDataLengthInOut); +} + +# define DosDevIOCtl DosDevIOCtl32 +#else +# define DosDevIOCtl DosDevIOCtl2 +#endif + + +typedef struct +{ + ush nID; + ush nSize; + ulg lSize; +} +EFHEADER, *PEFHEADER; + + +#ifdef __32BIT__ + +#define DosFindFirst(p1, p2, p3, p4, p5, p6) \ + DosFindFirst(p1, p2, p3, p4, p5, p6, 1) + +#else + +typedef struct +{ + ULONG oNextEntryOffset; + BYTE fEA; + BYTE cbName; + USHORT cbValue; + CHAR szName[1]; +} +FEA2, *PFEA2; + +typedef struct +{ + ULONG cbList; + FEA2 list[1]; +} +FEA2LIST, *PFEA2LIST; + +#define DosQueryCurrentDisk DosQCurDisk +#define DosQueryFSAttach(p1, p2, p3, p4, p5) \ + DosQFSAttach(p1, p2, p3, p4, p5, 0) +#define DosEnumAttribute(p1, p2, p3, p4, p5, p6, p7) \ + DosEnumAttribute(p1, p2, p3, p4, p5, p6, p7, 0) +#define DosFindFirst(p1, p2, p3, p4, p5, p6) \ + DosFindFirst(p1, p2, p3, p4, p5, p6, 0) +#define DosMapCase DosCaseMap +#define DosSetPathInfo(p1, p2, p3, p4, p5) \ + DosSetPathInfo(p1, p2, p3, p4, p5, 0) +#define DosQueryPathInfo(p1, p2, p3, p4) \ + DosQPathInfo(p1, p2, p3, p4, 0) +#define DosQueryFileInfo DosQFileInfo +#define DosMapCase DosCaseMap +#define DosQueryCtryInfo DosGetCtryInfo + +#endif /* !__32BIT__ */ + + + + + +/* + * @(#) dir.h 1.4 87/11/06 Public Domain. + */ + +#define A_RONLY 0x01 +#define A_HIDDEN 0x02 +#define A_SYSTEM 0x04 +#define A_LABEL 0x08 +#define A_DIR 0x10 +#define A_ARCHIVE 0x20 + + +const int attributes = A_DIR | A_HIDDEN | A_SYSTEM; + + +extern DIR *opendir(__GPRO__ ZCONST char *); +extern struct direct *readdir(__GPRO__ DIR *); +extern void seekdir(DIR *, long); +extern long telldir(DIR *); +extern void closedir(DIR *); +#define rewinddir(dirp) seekdir(dirp, 0L) + +int IsFileSystemFAT(__GPRO__ ZCONST char *dir); +char *StringLower(char *szArg); + + + + +/* + * @(#)dir.c 1.4 87/11/06 Public Domain. + */ + + +#ifndef S_IFMT +# define S_IFMT 0xF000 +#endif + + +#ifndef SFX + static char *getdirent(__GPRO__ ZCONST char *); + static void free_dircontents(struct _dircontents *); +#endif /* !SFX */ + + + + +int GetCountryInfo(void) +{ + COUNTRYINFO ctryi; + COUNTRYCODE ctryc; +#ifdef __32BIT__ + ULONG cbInfo; +#else + USHORT cbInfo; +#endif + + ctryc.country = ctryc.codepage = 0; + + if ( DosQueryCtryInfo(sizeof(ctryi), &ctryc, &ctryi, &cbInfo) != NO_ERROR ) + return 0; + + return ctryi.fsDateFmt; +} + + +long GetFileTime(ZCONST char *name) +{ +#ifdef __32BIT__ + FILESTATUS3 fs; +#else + FILESTATUS fs; +#endif + USHORT nDate, nTime; + + if ( DosQueryPathInfo((PSZ) name, 1, (PBYTE) &fs, sizeof(fs)) ) + return -1; + + nDate = * (USHORT *) &fs.fdateLastWrite; + nTime = * (USHORT *) &fs.ftimeLastWrite; + + return ((ULONG) nDate) << 16 | nTime; +} + + +#ifdef TIMESTAMP + +static int SetFileTime(ZCONST char *name, ulg stamp) /* swiped from Zip */ +{ + FILESTATUS fs; + USHORT fd, ft; + + if (DosQueryPathInfo((PSZ) name, FIL_STANDARD, (PBYTE) &fs, sizeof(fs))) + return -1; + + fd = (USHORT) (stamp >> 16); + ft = (USHORT) stamp; + fs.fdateLastWrite = fs.fdateCreation = * (FDATE *) &fd; + fs.ftimeLastWrite = fs.ftimeCreation = * (FTIME *) &ft; + + if (DosSetPathInfo((PSZ) name, FIL_STANDARD, (PBYTE) &fs, sizeof(fs), 0)) + return -1; + + return 0; +} + + +int stamp_file(ZCONST char *fname, time_t modtime) +{ + return SetFileTime(fname, Utime2DosDateTime(modtime)); +} + +#endif /* TIMESTAMP */ + + +/* The following DOS date/time structures are machine-dependent as they + * assume "little-endian" byte order. For OS/2-specific code, which + * is run on x86 CPUs (or emulators?), this assumption is valid; but + * care should be taken when using this code as template for other ports. + */ +typedef union { + ULONG timevalue; /* combined value, useful for comparisons */ + struct { + FTIME ft; /* system file time record: + * USHORT twosecs : 5 + * USHORT minutes : 6; + * USHORT hours : 5; */ + FDATE fd; /* system file date record: + * USHORT day : 5 + * USHORT month : 4; + * USHORT year : 7; */ + } _fdt; +} F_DATE_TIME, *PF_DATE_TIME; + + +#if defined(USE_EF_UT_TIME) || defined(TIMESTAMP) + +static ulg Utime2DosDateTime(uxtime) + time_t uxtime; +{ + F_DATE_TIME dosfiletime; + struct tm *t; + + /* round up to even seconds */ + /* round up (down if "up" overflows) to even seconds */ + if (((ulg)uxtime) & 1) + uxtime = (uxtime + 1 > uxtime) ? uxtime + 1 : uxtime - 1; + + t = localtime(&(uxtime)); + if (t == (struct tm *)NULL) { + /* time conversion error; use current time instead, hoping + that localtime() does not reject it as well! */ + time_t now = time(NULL); + t = localtime(&now); + } + if (t->tm_year < 80) { + dosfiletime._fdt.ft.twosecs = 0; + dosfiletime._fdt.ft.minutes = 0; + dosfiletime._fdt.ft.hours = 0; + dosfiletime._fdt.fd.day = 1; + dosfiletime._fdt.fd.month = 1; + dosfiletime._fdt.fd.year = 0; + } else { + dosfiletime._fdt.ft.twosecs = t->tm_sec >> 1; + dosfiletime._fdt.ft.minutes = t->tm_min; + dosfiletime._fdt.ft.hours = t->tm_hour; + dosfiletime._fdt.fd.day = t->tm_mday; + dosfiletime._fdt.fd.month = t->tm_mon + 1; + dosfiletime._fdt.fd.year = t->tm_year - 80; + } + return dosfiletime.timevalue; + +} /* end function Utime2DosDateTime() */ + +#endif /* USE_EF_UT_TIME || TIMESTAMP */ + + +static int getOS2filetimes(__GPRO__ ulg *pM_dt, ulg *pA_dt, ulg *pC_dt) +{ +#ifdef USE_EF_UT_TIME + unsigned eb_izux_flg; + iztimes z_utime; +#endif + + /* Copy and/or convert time and date variables, if necessary; */ + /* return a flag indicating which time stamps are available. */ +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + ((eb_izux_flg = ef_scan_for_izux(G.extra_field, + G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime, + &z_utime, NULL)) & EB_UT_FL_MTIME)) + { + TTrace((stderr, "getOS2filetimes: UT e.f. modif. time = %lu\n", + z_utime.mtime)); + *pM_dt = Utime2DosDateTime(z_utime.mtime); + if (eb_izux_flg & EB_UT_FL_ATIME) { + TTrace((stderr, "getOS2filetimes: UT e.f. access time = %lu\n", + z_utime.atime)); + *pA_dt = Utime2DosDateTime(z_utime.atime); + } + if (eb_izux_flg & EB_UT_FL_CTIME) { + TTrace((stderr, "getOS2filetimes: UT e.f. creation time = %lu\n", + z_utime.ctime)); + *pC_dt = Utime2DosDateTime(z_utime.ctime); + } else { + /* no creation time value supplied, set it to modification time */ + *pC_dt = *pM_dt; + eb_izux_flg |= EB_UT_FL_CTIME; + } + return (int)eb_izux_flg; + } +#endif /* USE_EF_UT_TIME */ + *pC_dt = *pM_dt = G.lrec.last_mod_dos_datetime; + TTrace((stderr, "\ngetOS2filetimes: DOS dir modific./creation time = %lu\n", + *pM_dt)); + return (EB_UT_FL_MTIME | EB_UT_FL_CTIME); +} + + +static void SetPathAttrTimes(__GPRO__ int flags, int dir) +{ + HFILE hFile; +#ifdef __32BIT__ + ULONG nAction; +#else + USHORT nAction; +#endif + FILESTATUS fs; + USHORT nLength; + char szName[CCHMAXPATH]; + ulg Mod_dt, Acc_dt, Cre_dt; + int gotTimes; + + strcpy(szName, G.filename); + nLength = strlen(szName); + if (szName[nLength - 1] == '/') + szName[nLength - 1] = 0; + + if (dir) + { + if ( DosQueryPathInfo(szName, FIL_STANDARD, (PBYTE) &fs, sizeof(fs)) ) + return; + } + else + { + /* for regular files, open them and operate on the file handle, to + work around certain network operating system bugs ... */ + + if ( DosOpen(szName, &hFile, &nAction, 0, 0, + OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW, + OPEN_SHARE_DENYREADWRITE | OPEN_ACCESS_READWRITE, 0) ) + return; + + if ( DosQueryFileInfo(hFile, FIL_STANDARD, (PBYTE) &fs, sizeof(fs)) ) + return; + } + + /* set date/time stamps */ + gotTimes = getOS2filetimes(__G__ &Mod_dt, &Acc_dt, &Cre_dt); + if (gotTimes & EB_UT_FL_MTIME) { + fs.fdateLastWrite = ((F_DATE_TIME *)&Mod_dt)->_fdt.fd; + fs.ftimeLastWrite = ((F_DATE_TIME *)&Mod_dt)->_fdt.ft; + } + if (gotTimes & EB_UT_FL_ATIME) { + fs.fdateLastAccess = ((F_DATE_TIME *)&Acc_dt)->_fdt.fd; + fs.ftimeLastAccess = ((F_DATE_TIME *)&Acc_dt)->_fdt.ft; + } + if (gotTimes & EB_UT_FL_CTIME) { + fs.fdateCreation = ((F_DATE_TIME *)&Cre_dt)->_fdt.fd; + fs.ftimeCreation = ((F_DATE_TIME *)&Cre_dt)->_fdt.ft; + } + + if ( flags != -1 ) + fs.attrFile = flags; /* hidden, system, archive, read-only */ + + if (dir) + { + DosSetPathInfo(szName, FIL_STANDARD, (PBYTE) &fs, sizeof(fs), 0); + } + else + { + DosSetFileInfo(hFile, FIL_STANDARD, (PBYTE) &fs, sizeof(fs)); + DosClose(hFile); + } +} + + +typedef struct +{ + ULONG cbList; /* length of value + 22 */ +#ifdef __32BIT__ + ULONG oNext; +#endif + BYTE fEA; /* 0 */ + BYTE cbName; /* length of ".LONGNAME" = 9 */ + USHORT cbValue; /* length of value + 4 */ + BYTE szName[10]; /* ".LONGNAME" */ + USHORT eaType; /* 0xFFFD for length-preceded ASCII */ + USHORT eaSize; /* length of value */ + BYTE szValue[CCHMAXPATH]; +} +FEALST; + + +static int SetEAs(__GPRO__ const char *path, void *ef_block) +{ /* returns almost-PK errors */ + EFHEADER *pEAblock = (PEFHEADER) ef_block; +#ifdef __32BIT__ + EAOP2 eaop; + PFEA2LIST pFEA2list; +#else + EAOP eaop; + PFEALIST pFEAlist; + PFEA pFEA; + PFEA2LIST pFEA2list; + PFEA2 pFEA2; + ULONG nLength2; +#endif + USHORT nLength; + char szName[CCHMAXPATH]; + int error; + + if ( ef_block == NULL || pEAblock -> nID != EF_OS2 ) + return PK_OK; /* not an OS/2 extra field: assume OK */ + + if ( pEAblock->nSize < 4 || (pEAblock->lSize > 0L && pEAblock->nSize <= 10) ) + return IZ_EF_TRUNC; /* no compressed data! */ + + strcpy(szName, path); + nLength = strlen(szName); + if (szName[nLength - 1] == '/') + szName[nLength - 1] = 0; + + if ( (pFEA2list = (PFEA2LIST) malloc((size_t) pEAblock -> lSize)) == NULL ) + return PK_MEM4; + + if ( (error = memextract(__G__ (uch *)pFEA2list, pEAblock->lSize, + (uch *)(pEAblock+1), (ulg)(pEAblock->nSize - 4))) != PK_OK ) + { + free(pFEA2list); + return error; + } + +#ifdef __32BIT__ + eaop.fpGEA2List = NULL; + eaop.fpFEA2List = pFEA2list; +#else + pFEAlist = (PVOID) pFEA2list; + pFEA2 = pFEA2list -> list; + pFEA = pFEAlist -> list; + + do + { + nLength2 = pFEA2 -> oNextEntryOffset; + nLength = sizeof(FEA) + pFEA2 -> cbName + 1 + pFEA2 -> cbValue; + + memcpy(pFEA, (PCH) pFEA2 + sizeof(pFEA2 -> oNextEntryOffset), nLength); + + pFEA2 = (PFEA2) ((PCH) pFEA2 + nLength2); + pFEA = (PFEA) ((PCH) pFEA + nLength); + } + while ( nLength2 != 0 ); + + pFEAlist -> cbList = (PCH) pFEA - (PCH) pFEAlist; + + eaop.fpGEAList = NULL; + eaop.fpFEAList = pFEAlist; +#endif + + eaop.oError = 0; + DosSetPathInfo(szName, FIL_QUERYEASIZE, (PBYTE) &eaop, sizeof(eaop), 0); + + if (!uO.tflag && QCOND2) + Info(slide, 0, ((char *)slide, " (%ld bytes EAs)", pFEA2list -> cbList)); + + free(pFEA2list); + return PK_COOL; +} + + +static int SetACL(__GPRO__ const char *path, void *ef_block) +{ /* returns almost-PK errors */ + EFHEADER *pACLblock = (PEFHEADER) ef_block; + char *szACL; + int error; + + if ( ef_block == NULL || pACLblock -> nID != EF_ACL ) + return PK_OK; /* not an OS/2 extra field: assume OK */ + + if (pACLblock->nSize < 4 || (pACLblock->lSize > 0L && pACLblock->nSize <= 10)) + return IZ_EF_TRUNC; /* no compressed data! */ + + if ( (szACL = malloc((size_t) pACLblock -> lSize)) == NULL ) + return PK_MEM4; + + if ( (error = memextract(__G__ (uch *)szACL, pACLblock->lSize, + (uch *)(pACLblock+1), (ulg)(pACLblock->nSize - 4))) != PK_OK ) + { + free(szACL); + return error; + } + + if (acl_set(NULL, path, szACL) == 0) + if (!uO.tflag && QCOND2) + Info(slide, 0, ((char *)slide, " (%ld bytes ACL)", strlen(szACL))); + + free(szACL); + return PK_COOL; +} + + +#ifdef SFX + +char *GetLoadPath(__GPRO) +{ +#ifdef __32BIT__ /* generic for 32-bit API */ + PTIB pptib; + PPIB pppib; + char *szPath; + + DosGetInfoBlocks(&pptib, &pppib); + szPath = pppib -> pib_pchenv; +#else /* 16-bit, note: requires large data model */ + SEL selEnv; + USHORT offCmd; + char *szPath; + + DosGetEnv(&selEnv, &offCmd); + szPath = MAKEP(selEnv, 0); +#endif + + while (*szPath) /* find end of process environment */ + szPath = strchr(szPath, 0) + 1; + + return szPath + 1; /* .exe file name follows environment */ + +} /* end function GetLoadPath() */ + + + + + +#else /* !SFX */ + +DIR *opendir(__GPRO__ const char *name) +{ + struct stat statb; + DIR *dirp; + char c; + char *s; + struct _dircontents *dp; + char nbuf[MAXPATHLEN + 1]; + int len; + + strcpy(nbuf, name); + if ((len = strlen(nbuf)) == 0) + return NULL; + + if ( ((c = nbuf[len - 1]) == '\\' || c == '/') && (len > 1) ) + { + nbuf[len - 1] = 0; + --len; + + if ( nbuf[len - 1] == ':' ) + { + strcpy(nbuf+len, "\\."); + len += 2; + } + } + else + if ( nbuf[len - 1] == ':' ) + { + strcpy(nbuf+len, "."); + ++len; + } + + /* GRR: Borland and Watcom C return non-zero on wildcards... < 0 ? */ + if (stat(nbuf, &statb) < 0 || (statb.st_mode & S_IFMT) != S_IFDIR) + { + Trace((stderr, "opendir: stat(%s) returns negative or not directory\n", + nbuf)); + return NULL; + } + + if ( (dirp = malloc(sizeof(DIR))) == NULL ) + return NULL; + + if ( nbuf[len - 1] == '.' && (len == 1 || nbuf[len - 2] != '.') ) + strcpy(nbuf+len-1, "*"); + else + if ( ((c = nbuf[len - 1]) == '\\' || c == '/') && (len == 1) ) + strcpy(nbuf+len, "*"); + else + strcpy(nbuf+len, "\\*"); + + /* len is no longer correct (but no longer needed) */ + Trace((stderr, "opendir: nbuf = [%s]\n", nbuf)); + + dirp -> dd_loc = 0; + dirp -> dd_contents = dirp -> dd_cp = NULL; + + if ((s = getdirent(__G__ nbuf)) == NULL) + return dirp; + + do + { + if (((dp = malloc(sizeof(struct _dircontents))) == NULL) || + ((dp -> _d_entry = malloc(strlen(s) + 1)) == NULL) ) + { + if (dp) + free(dp); + free_dircontents(dirp -> dd_contents); + + return NULL; + } + + if (dirp -> dd_contents) + { + dirp -> dd_cp -> _d_next = dp; + dirp -> dd_cp = dirp -> dd_cp -> _d_next; + } + else + dirp -> dd_contents = dirp -> dd_cp = dp; + + strcpy(dp -> _d_entry, s); + dp -> _d_next = NULL; + + dp -> _d_size = G.os2.find.cbFile; + dp -> _d_mode = G.os2.find.attrFile; + dp -> _d_time = *(unsigned *) &(G.os2.find.ftimeLastWrite); + dp -> _d_date = *(unsigned *) &(G.os2.find.fdateLastWrite); + } + while ((s = getdirent(__G__ NULL)) != NULL); + + dirp -> dd_cp = dirp -> dd_contents; + + return dirp; +} + + +void closedir(DIR * dirp) +{ + free_dircontents(dirp -> dd_contents); + free(dirp); +} + + +struct direct *readdir(__GPRO__ DIR * dirp) +{ + /* moved to os2data.h so it can be global */ + /* static struct direct dp; */ + + if (dirp -> dd_cp == NULL) + return NULL; + + G.os2.dp.d_namlen = G.os2.dp.d_reclen = + strlen(strcpy(G.os2.dp.d_name, dirp -> dd_cp -> _d_entry)); + + G.os2.dp.d_ino = 0; + + G.os2.dp.d_size = dirp -> dd_cp -> _d_size; + G.os2.dp.d_mode = dirp -> dd_cp -> _d_mode; + G.os2.dp.d_time = dirp -> dd_cp -> _d_time; + G.os2.dp.d_date = dirp -> dd_cp -> _d_date; + + dirp -> dd_cp = dirp -> dd_cp -> _d_next; + dirp -> dd_loc++; + + return &G.os2.dp; +} + + + +#if 0 /* not used in unzip; retained for possibly future use */ + +void seekdir(DIR * dirp, long off) +{ + long i = off; + struct _dircontents *dp; + + if (off >= 0) + { + for (dp = dirp -> dd_contents; --i >= 0 && dp; dp = dp -> _d_next); + + dirp -> dd_loc = off - (i + 1); + dirp -> dd_cp = dp; + } +} + + +long telldir(DIR * dirp) +{ + return dirp -> dd_loc; +} + +#endif /* 0 */ + + + +static void free_dircontents(struct _dircontents * dp) +{ + struct _dircontents *odp; + + while (dp) + { + if (dp -> _d_entry) + free(dp -> _d_entry); + + dp = (odp = dp) -> _d_next; + free(odp); + } +} + + +static char *getdirent(__GPRO__ ZCONST char *dir) +{ + int done; + /* moved to os2data.h so it can be global */ + /* static int lower; */ + + if (dir != NULL) + { /* get first entry */ + G.os2.hdir = HDIR_SYSTEM; + G.os2.count = 1; + done = DosFindFirst((PSZ) dir, &G.os2.hdir, attributes, + &G.os2.find, sizeof(G.os2.find), &G.os2.count); + G.os2.lower = IsFileSystemFAT(__G__ dir); + } + else /* get next entry */ + done = DosFindNext(G.os2.hdir, + &G.os2.find, sizeof(G.os2.find), &G.os2.count); + + if (done == 0) + { + if ( G.os2.lower ) + StringLower(G.os2.find.achName); + return G.os2.find.achName; + } + else + { + DosFindClose(G.os2.hdir); + return NULL; + } +} + + + +int IsFileSystemFAT(__GPRO__ ZCONST char *dir) /* FAT / HPFS detection */ +{ + /* moved to os2data.h so they can be global */ + /* static USHORT nLastDrive=(USHORT)(-1), nResult; */ + ULONG lMap; + BYTE bData[64]; + char bName[3]; +#ifdef __32BIT__ + ULONG nDrive, cbData; + PFSQBUFFER2 pData = (PFSQBUFFER2) bData; +#else + USHORT nDrive, cbData; + PFSQBUFFER pData = (PFSQBUFFER) bData; +#endif + + /* We separate FAT and HPFS+other file systems here. + at the moment I consider other systems to be similar to HPFS, + i.e. support long file names and case sensitive */ + + if ( isalpha(dir[0]) && (dir[1] == ':') ) + nDrive = toupper(dir[0]) - '@'; + else + DosQueryCurrentDisk(&nDrive, &lMap); + + if ( nDrive == G.os2.nLastDrive ) + return G.os2.nResult; + + bName[0] = (char) (nDrive + '@'); + bName[1] = ':'; + bName[2] = 0; + + G.os2.nLastDrive = nDrive; + cbData = sizeof(bData); + + if ( !DosQueryFSAttach(bName, 0, FSAIL_QUERYNAME, (PVOID) pData, &cbData) ) + G.os2.nResult = !strcmp((char *) (pData -> szFSDName) + pData -> cbName, + "FAT"); + else + G.os2.nResult = FALSE; + + /* End of this ugly code */ + return G.os2.nResult; +} /* end function IsFileSystemFAT() */ + + + + + +/************************/ +/* Function do_wild() */ +/************************/ + +char *do_wild(__G__ wildspec) + __GDEF + char *wildspec; /* only used first time on a given dir */ +{ + /* moved to os2data.h so they can be global */ +#if 0 + static DIR *dir = NULL; + static char *dirname, *wildname, matchname[FILNAMSIZ]; + static int firstcall=TRUE, have_dirname, dirnamelen; +#endif + char *fnamestart; + struct direct *file; + + + /* Even when we're just returning wildspec, we *always* do so in + * matchname[]--calling routine is allowed to append four characters + * to the returned string, and wildspec may be a pointer to argv[]. + */ + if (G.os2.firstcall) { /* first call: must initialize everything */ + G.os2.firstcall = FALSE; + + if (!iswild(wildspec)) { + strcpy(G.os2.matchname, wildspec); + G.os2.have_dirname = FALSE; + G.os2.dir = NULL; + return G.os2.matchname; + } + + /* break the wildspec into a directory part and a wildcard filename */ + if ((G.os2.wildname = strrchr(wildspec, '/')) == NULL && + (G.os2.wildname = strrchr(wildspec, ':')) == NULL) { + G.os2.dirname = "."; + G.os2.dirnamelen = 1; + G.os2.have_dirname = FALSE; + G.os2.wildname = wildspec; + } else { + ++G.os2.wildname; /* point at character after '/' or ':' */ + G.os2.dirnamelen = G.os2.wildname - wildspec; + if ((G.os2.dirname = (char *)malloc(G.os2.dirnamelen+1)) == NULL) { + Info(slide, 1, ((char *)slide, + LoadFarString(CantAllocateWildcard))); + strcpy(G.os2.matchname, wildspec); + return G.os2.matchname; /* but maybe filespec was not a wildcard */ + } + strncpy(G.os2.dirname, wildspec, G.os2.dirnamelen); + G.os2.dirname[G.os2.dirnamelen] = '\0'; /* terminate for strcpy below */ + G.os2.have_dirname = TRUE; + } + Trace((stderr, "do_wild: dirname = [%s]\n", G.os2.dirname)); + + if ((G.os2.dir = opendir(__G__ G.os2.dirname)) != NULL) { + if (G.os2.have_dirname) { + strcpy(G.os2.matchname, G.os2.dirname); + fnamestart = G.os2.matchname + G.os2.dirnamelen; + } else + fnamestart = G.os2.matchname; + while ((file = readdir(__G__ G.os2.dir)) != NULL) { + Trace((stderr, "do_wild: readdir returns %s\n", file->d_name)); + strcpy(fnamestart, file->d_name); + if (strrchr(fnamestart, '.') == (char *)NULL) + strcat(fnamestart, "."); + if (match(fnamestart, G.os2.wildname, 1) && /* 1 == ignore case */ + /* skip "." and ".." directory entries */ + strcmp(fnamestart, ".") && strcmp(fnamestart, "..")) { + Trace((stderr, "do_wild: match() succeeds\n")); + /* remove trailing dot */ + fnamestart += strlen(fnamestart) - 1; + if (*fnamestart == '.') + *fnamestart = '\0'; + return G.os2.matchname; + } + } + /* if we get to here directory is exhausted, so close it */ + closedir(G.os2.dir); + G.os2.dir = NULL; + } +#ifdef DEBUG + else { + Trace((stderr, "do_wild: opendir(%s) returns NULL\n", G.os2.dirname)); + } +#endif /* DEBUG */ + + /* return the raw wildspec in case that works (e.g., directory not + * searchable, but filespec was not wild and file is readable) */ + strcpy(G.os2.matchname, wildspec); + return G.os2.matchname; + } + + /* last time through, might have failed opendir but returned raw wildspec */ + if (G.os2.dir == NULL) { + G.os2.firstcall = TRUE; /* nothing left to try--reset for new wildspec */ + if (G.os2.have_dirname) + free(G.os2.dirname); + return (char *)NULL; + } + + /* If we've gotten this far, we've read and matched at least one entry + * successfully (in a previous call), so dirname has been copied into + * matchname already. + */ + if (G.os2.have_dirname) { + /* strcpy(G.os2.matchname, G.os2.dirname); */ + fnamestart = G.os2.matchname + G.os2.dirnamelen; + } else + fnamestart = G.os2.matchname; + while ((file = readdir(__G__ G.os2.dir)) != NULL) { + Trace((stderr, "do_wild: readdir returns %s\n", file->d_name)); + strcpy(fnamestart, file->d_name); + if (strrchr(fnamestart, '.') == (char *)NULL) + strcat(fnamestart, "."); + if (match(fnamestart, G.os2.wildname, 1)) { /* 1 == ignore case */ + Trace((stderr, "do_wild: match() succeeds\n")); + /* remove trailing dot */ + fnamestart += strlen(fnamestart) - 1; + if (*fnamestart == '.') + *fnamestart = '\0'; + return G.os2.matchname; + } + } + + closedir(G.os2.dir); /* have read at least one dir entry; nothing left */ + G.os2.dir = NULL; + G.os2.firstcall = TRUE; /* reset for new wildspec */ + if (G.os2.have_dirname) + free(G.os2.dirname); + return (char *)NULL; + +} /* end function do_wild() */ + +#endif /* !SFX */ + + +/* scan extra fields for something we happen to know */ + +static int EvalExtraFields(__GPRO__ const char *path, + void *extra_field, unsigned ef_len) +{ + char *ef_ptr = extra_field; + PEFHEADER pEFblock; + int rc = PK_OK; + + while (ef_len >= sizeof(EFHEADER)) + { + pEFblock = (PEFHEADER) ef_ptr; + + if (pEFblock -> nSize > (ef_len - EB_HEADSIZE)) + return PK_ERR; /* claimed EFblock length exceeds EF size! */ + + switch (pEFblock -> nID) + { + case EF_OS2: + rc = SetEAs(__G__ path, ef_ptr); + break; + case EF_ACL: + rc = (uO.X_flag) ? SetACL(__G__ path, ef_ptr) : PK_OK; + break; +#if 0 + case EF_IZUNIX: + case EF_PKUNIX: + /* handled elsewhere */ + break; +#endif + default: + TTrace((stderr,"EvalExtraFields: unknown extra field block, ID=%d\n", + pEFblock -> nID)); + break; + } + + ef_ptr += (pEFblock -> nSize + EB_HEADSIZE); + ef_len -= (pEFblock -> nSize + EB_HEADSIZE); + + if (rc != PK_OK) + break; + } + + return rc; +} + + + +/************************/ +/* Function mapattr() */ +/************************/ + +int mapattr(__G) + __GDEF +{ + /* set archive bit (file is not backed up): */ + G.pInfo->file_attr = (unsigned)(G.crec.external_file_attributes | 32) & 0xff; + return 0; +} + + + + + +/************************/ +/* Function mapname() */ +/************************/ + +/* + * There are presently two possibilities in OS/2: the output filesystem is + * FAT, or it is HPFS. If the former, we need to map to FAT, obviously, but + * we *also* must map to HPFS and store that version of the name in extended + * attributes. Either way, we need to map to HPFS, so the main mapname + * routine does that. In the case that the output file system is FAT, an + * extra filename-mapping routine is called in checkdir(). While it should + * be possible to determine the filesystem immediately upon entry to mapname(), + * it is conceivable that the DOS APPEND utility could be added to OS/2 some- + * day, allowing a FAT directory to be APPENDed to an HPFS drive/path. There- + * fore we simply check the filesystem at each path component. + * + * Note that when alternative IFSes become available/popular, everything will + * become immensely more complicated. For example, a Minix filesystem would + * have limited filename lengths like FAT but no extended attributes in which + * to store the longer versions of the names. A BSD Unix filesystem would + * support paths of length 1024 bytes or more, but it is not clear that FAT + * EAs would allow such long .LONGNAME fields or that OS/2 would properly + * restore such fields when moving files from FAT to the new filesystem. + * + * GRR: some or all of the following chars should be checked in either + * mapname (HPFS) or map2fat (FAT), depending: ,=^+'"[]<>|\t& + */ + /* return 0 if no error, 1 if caution (filename */ +int mapname(__G__ renamed) /* truncated), 2 if warning (skip file because */ + __GDEF /* dir doesn't exist), 3 if error (skip file), */ + int renamed; /* or 10 if out of memory (skip file) */ +{ /* [also IZ_VOL_LABEL, IZ_CREATED_DIR] */ + char pathcomp[FILNAMSIZ]; /* path-component buffer */ + char *pp, *cp=(char *)NULL; /* character pointers */ + char *lastsemi=(char *)NULL; /* pointer to last semi-colon in pathcomp */ + int quote = FALSE; /* flag: next char is literal */ + int error = 0; + register unsigned workch; /* hold the character being tested */ + + +/*--------------------------------------------------------------------------- + Initialize various pointers and counters and stuff. + ---------------------------------------------------------------------------*/ + + /* can create path as long as not just freshening, or if user told us */ + G.create_dirs = (!uO.fflag || renamed); + + G.os2.created_dir = FALSE; /* not yet */ + G.os2.renamed_fullpath = FALSE; + G.os2.fnlen = strlen(G.filename); + +/* GRR: for VMS, convert to internal format now or later? or never? */ + if (renamed) { + cp = G.filename - 1; /* point to beginning of renamed name... */ + while (*++cp) + if (*cp == '\\') /* convert backslashes to forward */ + *cp = '/'; + cp = G.filename; + /* use temporary rootpath if user gave full pathname */ + if (G.filename[0] == '/') { + G.os2.renamed_fullpath = TRUE; + pathcomp[0] = '/'; /* copy the '/' and terminate */ + pathcomp[1] = '\0'; + ++cp; + } else if (isalpha(G.filename[0]) && G.filename[1] == ':') { + G.os2.renamed_fullpath = TRUE; + pp = pathcomp; + *pp++ = *cp++; /* copy the "d:" (+ '/', possibly) */ + *pp++ = *cp++; + if (*cp == '/') + *pp++ = *cp++; /* otherwise add "./"? */ + *pp = '\0'; + } + } + + /* pathcomp is ignored unless renamed_fullpath is TRUE: */ + if ((error = checkdir(__G__ pathcomp, INIT)) != 0) /* init path buffer */ + return error; /* ...unless no mem or vol label on hard disk */ + + *pathcomp = '\0'; /* initialize translation buffer */ + pp = pathcomp; /* point to translation buffer */ + if (!renamed) { /* cp already set if renamed */ + if (uO.jflag) /* junking directories */ +/* GRR: watch out for VMS version... */ + cp = (char *)strrchr(G.filename, '/'); + if (cp == (char *)NULL) /* no '/' or not junking dirs */ + cp = G.filename; /* point to internal zipfile-member pathname */ + else + ++cp; /* point to start of last component of path */ + } + +/*--------------------------------------------------------------------------- + Begin main loop through characters in filename. + ---------------------------------------------------------------------------*/ + + while ((workch = (uch)*cp++) != 0) { + + if (quote) { /* if character quoted, */ + *pp++ = (char)workch; /* include it literally */ + quote = FALSE; + } else + switch (workch) { + case '/': /* can assume -j flag not given */ + *pp = '\0'; + if ((error = checkdir(__G__ pathcomp, APPEND_DIR)) > 1) + return error; + pp = pathcomp; /* reset conversion buffer for next piece */ + lastsemi = (char *)NULL; /* leave directory semi-colons alone */ + break; + + case ':': + *pp++ = '_'; /* drive names not stored in zipfile, */ + break; /* so no colons allowed */ + + case ';': /* start of VMS version? */ + lastsemi = pp; /* remove VMS version later... */ + *pp++ = ';'; /* but keep semicolon for now */ + break; + + case '\026': /* control-V quote for special chars */ + quote = TRUE; /* set flag for next character */ + break; + + case ' ': /* keep spaces unless specifically */ + if (uO.sflag) /* requested to change to underscore */ + *pp++ = '_'; + else + *pp++ = ' '; + break; + + default: + /* allow ASCII 255 and European characters in filenames: */ + if (isprint(workch) || workch >= 127) + *pp++ = (char)workch; + } /* end switch */ + + } /* end while loop */ + + *pp = '\0'; /* done with pathcomp: terminate it */ + + /* if not saving them, remove VMS version numbers (appended "###") */ + if (!uO.V_flag && lastsemi) { + pp = lastsemi + 1; /* semi-colon was kept: expect #s after */ + while (isdigit((uch)(*pp))) + ++pp; + if (*pp == '\0') /* only digits between ';' and end: nuke */ + *lastsemi = '\0'; + } + +/*--------------------------------------------------------------------------- + Report if directory was created (and no file to create: filename ended + in '/'), check name to be sure it exists, and combine path and name be- + fore exiting. + ---------------------------------------------------------------------------*/ + + if (G.filename[G.os2.fnlen-1] == '/') { + checkdir(__G__ G.filename, GETPATH); + if (G.os2.created_dir) { + if (!uO.qflag) + Info(slide, 0, ((char *)slide, LoadFarString(Creating), + G.filename)); + if (G.extra_field) { /* zipfile extra field has extended attribs */ + int err = EvalExtraFields(__G__ G.filename, G.extra_field, + G.lrec.extra_field_length); + + if (err == IZ_EF_TRUNC) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", G.filename)); + Info(slide, 1, ((char *)slide, LoadFarString(TruncEAs), + makeword(G.extra_field+2)-10, "\n")); + } else if (!uO.qflag) + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + } else if (!uO.qflag) + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + + /* set date/time stamps */ + SetPathAttrTimes(__G__ G.pInfo->file_attr & ~A_ARCHIVE, 1); + + return IZ_CREATED_DIR; /* dir time already set */ + + } else if (G.extra_field && uO.overwrite_all) { + /* overwrite EAs of existing directory since user requested it */ + int err = EvalExtraFields(__G__ G.filename, G.extra_field, + G.lrec.extra_field_length); + + if (err == IZ_EF_TRUNC) { + Info(slide, 0x421, ((char *)slide, "%-22s ", G.filename)); + Info(slide, 0x401, ((char *)slide, LoadFarString(TruncEAs), + makeword(G.extra_field+2)-10, "\n")); + } + + /* set date/time stamps (dirs only have creation times) */ + SetPathAttrTimes(__G__ G.pInfo->file_attr & ~A_ARCHIVE, 1); + } + return 2; /* dir existed already; don't look for data to extract */ + } + + if (*pathcomp == '\0') { + Info(slide, 1, ((char *)slide, LoadFarString(ConversionFailed), + G.filename)); + return 3; + } + + checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */ + checkdir(__G__ G.filename, GETPATH); + Trace((stderr, "mapname returns with filename = [%s] (error = %d)\n\n", + G.filename, error)); + + if (G.pInfo->vollabel) { /* set the volume label now */ + VOLUMELABEL FSInfoBuf; +/* GRR: "VOLUMELABEL" defined for IBM C and emx, but haven't checked MSC... */ + + strcpy(FSInfoBuf.szVolLabel, G.filename); + FSInfoBuf.cch = (BYTE)strlen(FSInfoBuf.szVolLabel); + + if (!uO.qflag) + Info(slide, 0, ((char *)slide, LoadFarString(Labelling), + (char)(G.os2.nLabelDrive + 'a' - 1), G.filename)); + if (DosSetFSInfo(G.os2.nLabelDrive, FSIL_VOLSER, (PBYTE)&FSInfoBuf, + sizeof(VOLUMELABEL))) + { + Info(slide, 1, ((char *)slide, LoadFarString(ErrSetVolLabel))); + return 3; + } + return 2; /* success: skip the "extraction" quietly */ + } + + return error; + +} /* end function mapname() */ + + + + + +/***********************/ +/* Function checkdir() */ +/***********************/ + +int checkdir(__G__ pathcomp, flag) + __GDEF + char *pathcomp; + int flag; +/* + * returns: 1 - (on APPEND_NAME) truncated filename + * 2 - path doesn't exist, not allowed to create + * 3 - path doesn't exist, tried to create and failed; or + * path exists and is not a directory, but is supposed to be + * 4 - path is too long + * 10 - can't allocate memory for filename buffers + */ +{ + /* moved to os2data.h so they can be global */ +#if 0 + static int rootlen = 0; /* length of rootpath */ + static char *rootpath; /* user's "extract-to" directory */ + static char *buildpathHPFS; /* full path (so far) to extracted file, */ + static char *buildpathFAT; /* both HPFS/EA (main) and FAT versions */ + static char *endHPFS; /* corresponding pointers to end of */ + static char *endFAT; /* buildpath ('\0') */ +#endif + +# define FN_MASK 7 +# define FUNCTION (flag & FN_MASK) + + + +/*--------------------------------------------------------------------------- + APPEND_DIR: append the path component to the path being built and check + for its existence. If doesn't exist and we are creating directories, do + so for this one; else signal success or error as appropriate. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_DIR) { + char *p = pathcomp; + int longdirEA, too_long=FALSE; + + Trace((stderr, "appending dir segment [%s]\n", pathcomp)); + while ((*G.os2.endHPFS = *p++) != '\0') /* copy to HPFS filename */ + ++G.os2.endHPFS; + if (IsFileNameValid(G.os2.buildpathHPFS)) { + longdirEA = FALSE; + p = pathcomp; + while ((*G.os2.endFAT = *p++) != '\0') /* copy to FAT filename, too */ + ++G.os2.endFAT; + } else { + longdirEA = TRUE; +/* GRR: check error return? */ + map2fat(pathcomp, &G.os2.endFAT); /* map, put in FAT fn, update endFAT */ + } + + /* GRR: could do better check, see if overrunning buffer as we go: + * check endHPFS-G.os2.buildpathHPFS after each append, set warning variable + * if within 20 of FILNAMSIZ; then if var set, do careful check when + * appending. Clear variable when begin new path. */ + + /* next check: need to append '/', at least one-char name, '\0' */ + if ((G.os2.endHPFS-G.os2.buildpathHPFS) > FILNAMSIZ-3) + too_long = TRUE; /* check if extracting dir? */ +#ifdef MSC /* MSC 6.00 bug: stat(non-existent-dir) == 0 [exists!] */ + if (GetFileTime(G.os2.buildpathFAT) == -1 || stat(G.os2.buildpathFAT, &G.statbuf)) +#else + if (stat(G.os2.buildpathFAT, &G.statbuf)) /* path doesn't exist */ +#endif + { + if (!G.create_dirs) { /* told not to create (freshening) */ + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return 2; /* path doesn't exist: nothing to do */ + } + if (too_long) { /* GRR: should allow FAT extraction w/o EAs */ + Info(slide, 1, ((char *)slide, LoadFarString(PathTooLong), + G.os2.buildpathHPFS)); + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return 4; /* no room for filenames: fatal */ + } + if (MKDIR(G.os2.buildpathFAT, 0777) == -1) { /* create the directory */ + Info(slide, 1, ((char *)slide, LoadFarString(CantCreateDir), + G.os2.buildpathFAT, G.filename)); + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return 3; /* path didn't exist, tried to create, failed */ + } + G.os2.created_dir = TRUE; + /* only set EA if creating directory */ +/* GRR: need trailing '/' before function call? */ + if (longdirEA) { +#ifdef DEBUG + int e = +#endif + SetLongNameEA(G.os2.buildpathFAT, pathcomp); + Trace((stderr, "APPEND_DIR: SetLongNameEA() returns %d\n", e)); + } + } else if (!S_ISDIR(G.statbuf.st_mode)) { + Info(slide, 1, ((char *)slide, LoadFarString(DirIsntDirectory), + G.os2.buildpathFAT, G.filename)); + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return 3; /* path existed but wasn't dir */ + } + if (too_long) { + Info(slide, 1, ((char *)slide, LoadFarString(PathTooLong), + G.os2.buildpathHPFS)); + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return 4; /* no room for filenames: fatal */ + } + *G.os2.endHPFS++ = '/'; + *G.os2.endFAT++ = '/'; + *G.os2.endHPFS = *G.os2.endFAT = '\0'; + Trace((stderr, "buildpathHPFS now = [%s]\n", G.os2.buildpathHPFS)); + Trace((stderr, "buildpathFAT now = [%s]\n", G.os2.buildpathFAT)); + return 0; + + } /* end if (FUNCTION == APPEND_DIR) */ + +/*--------------------------------------------------------------------------- + GETPATH: copy full FAT path to the string pointed at by pathcomp (want + filename to reflect name used on disk, not EAs; if full path is HPFS, + buildpathFAT and buildpathHPFS will be identical). Also free both paths. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == GETPATH) { + Trace((stderr, "getting and freeing FAT path [%s]\n", G.os2.buildpathFAT)); + Trace((stderr, "freeing HPFS path [%s]\n", G.os2.buildpathHPFS)); + strcpy(pathcomp, G.os2.buildpathFAT); + free(G.os2.buildpathFAT); + free(G.os2.buildpathHPFS); + G.os2.buildpathHPFS = G.os2.buildpathFAT = G.os2.endHPFS = G.os2.endFAT = (char *)NULL; + return 0; + } + +/*--------------------------------------------------------------------------- + APPEND_NAME: assume the path component is the filename; append it and + return without checking for existence. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_NAME) { + char *p = pathcomp; + int error = 0; + + Trace((stderr, "appending filename [%s]\n", pathcomp)); + while ((*G.os2.endHPFS = *p++) != '\0') { /* copy to HPFS filename */ + ++G.os2.endHPFS; + if ((G.os2.endHPFS-G.os2.buildpathHPFS) >= FILNAMSIZ) { + *--G.os2.endHPFS = '\0'; + Info(slide, 1, ((char *)slide, LoadFarString(PathTooLongTrunc), + G.filename, G.os2.buildpathHPFS)); + error = 1; /* filename truncated */ + } + } + +/* GRR: how can longnameEA ever be set before this point??? we don't want + * to save the original name to EAs if user renamed it, do we? + * + * if (!G.os2.longnameEA && ((G.os2.longnameEA = !IsFileNameValid(name)) != 0)) + */ + if (G.pInfo->vollabel || IsFileNameValid(G.os2.buildpathHPFS)) { + G.os2.longnameEA = FALSE; + p = pathcomp; + while ((*G.os2.endFAT = *p++) != '\0') /* copy to FAT filename, too */ + ++G.os2.endFAT; + } else { + G.os2.longnameEA = TRUE; + if ((G.os2.lastpathcomp = (char *)malloc(strlen(pathcomp)+1)) == + (char *)NULL) + { + Info(slide, 1, ((char *)slide, + "checkdir warning: cannot save longname EA: out of memory\n")); + G.os2.longnameEA = FALSE; + error = 1; /* can't set .LONGNAME extended attribute */ + } else /* used and freed in close_outfile() */ + strcpy(G.os2.lastpathcomp, pathcomp); + map2fat(pathcomp, &G.os2.endFAT); /* map, put in FAT fn, update endFAT */ + } + Trace((stderr, "buildpathHPFS: %s\nbuildpathFAT: %s\n", + G.os2.buildpathHPFS, G.os2.buildpathFAT)); + + return error; /* could check for existence, prompt for new name... */ + + } /* end if (FUNCTION == APPEND_NAME) */ + +/*--------------------------------------------------------------------------- + INIT: allocate and initialize buffer space for the file currently being + extracted. If file was renamed with an absolute path, don't prepend the + extract-to path. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == INIT) { + Trace((stderr, "initializing buildpathHPFS and buildpathFAT to ")); + if ((G.os2.buildpathHPFS = (char *)malloc(G.os2.fnlen+G.os2.rootlen+1)) == (char *)NULL) + return 10; + if ((G.os2.buildpathFAT = (char *)malloc(G.os2.fnlen+G.os2.rootlen+1)) == (char *)NULL) { + free(G.os2.buildpathHPFS); + return 10; + } + if (G.pInfo->vollabel) { /* use root or renamed path, but don't store */ +/* GRR: for network drives, do strchr() and return IZ_VOL_LABEL if not [1] */ + if (G.os2.renamed_fullpath && pathcomp[1] == ':') + *G.os2.buildpathHPFS = (char)ToLower(*pathcomp); + else if (!G.os2.renamed_fullpath && G.os2.rootlen > 1 && G.os2.rootpath[1] == ':') + *G.os2.buildpathHPFS = (char)ToLower(*G.os2.rootpath); + else { + ULONG lMap; + DosQueryCurrentDisk(&G.os2.nLabelDrive, &lMap); + *G.os2.buildpathHPFS = (char)(G.os2.nLabelDrive - 1 + 'a'); + } + G.os2.nLabelDrive = *G.os2.buildpathHPFS - 'a' + 1; /* save for mapname() */ + if (uO.volflag == 0 || *G.os2.buildpathHPFS < 'a' || /* no labels/bogus? */ + (uO.volflag == 1 && !isfloppy(G.os2.nLabelDrive))) { /* -$: no fixed */ + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return IZ_VOL_LABEL; /* skipping with message */ + } + *G.os2.buildpathHPFS = '\0'; + } else if (G.os2.renamed_fullpath) /* pathcomp = valid data */ + strcpy(G.os2.buildpathHPFS, pathcomp); + else if (G.os2.rootlen > 0) + strcpy(G.os2.buildpathHPFS, G.os2.rootpath); + else + *G.os2.buildpathHPFS = '\0'; + G.os2.endHPFS = G.os2.buildpathHPFS; + G.os2.endFAT = G.os2.buildpathFAT; + while ((*G.os2.endFAT = *G.os2.endHPFS) != '\0') { + ++G.os2.endFAT; + ++G.os2.endHPFS; + } + Trace((stderr, "[%s]\n", G.os2.buildpathHPFS)); + return 0; + } + +/*--------------------------------------------------------------------------- + ROOT: if appropriate, store the path in rootpath and create it if neces- + sary; else assume it's a zipfile member and return. This path segment + gets used in extracting all members from every zipfile specified on the + command line. Note that under OS/2 and MS-DOS, if a candidate extract-to + directory specification includes a drive letter (leading "x:"), it is + treated just as if it had a trailing '/'--that is, one directory level + will be created if the path doesn't exist, unless this is otherwise pro- + hibited (e.g., freshening). + ---------------------------------------------------------------------------*/ + +#if (!defined(SFX) || defined(SFX_EXDIR)) + if (FUNCTION == ROOT) { + Trace((stderr, "initializing root path to [%s]\n", pathcomp)); + if (pathcomp == (char *)NULL) { + G.os2.rootlen = 0; + return 0; + } + if ((G.os2.rootlen = strlen(pathcomp)) > 0) { + int had_trailing_pathsep=FALSE, has_drive=FALSE, xtra=2; + + if (isalpha(pathcomp[0]) && pathcomp[1] == ':') + has_drive = TRUE; /* drive designator */ + if (pathcomp[G.os2.rootlen-1] == '/') { + pathcomp[--G.os2.rootlen] = '\0'; + had_trailing_pathsep = TRUE; + } + if (has_drive && (G.os2.rootlen == 2)) { + if (!had_trailing_pathsep) /* i.e., original wasn't "x:/" */ + xtra = 3; /* room for '.' + '/' + 0 at end of "x:" */ + } else if (G.os2.rootlen > 0) { /* need not check "x:." and "x:/" */ +#ifdef MSC /* MSC 6.00 bug: stat(non-existent-dir) == 0 [exists!] */ + if (GetFileTime(pathcomp) == -1 || + SSTAT(pathcomp, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode)) +#else + if (SSTAT(pathcomp, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode)) +#endif + { /* path does not exist */ + if (!G.create_dirs /* || iswild(pathcomp) */ + ) { + G.os2.rootlen = 0; + return 2; /* treat as stored file */ + } + /* create directory (could add loop here to scan pathcomp + * and create more than one level, but really necessary?) */ + if (MKDIR(pathcomp, 0777) == -1) { + Info(slide, 1, ((char *)slide, + LoadFarString(CantCreateExtractDir), pathcomp)); + G.os2.rootlen = 0; /* path didn't exist, tried to create, */ + return 3; /* failed: file exists, or need 2+ levels */ + } + } + } + if ((G.os2.rootpath = (char *)malloc(G.os2.rootlen+xtra)) == (char *)NULL) { + G.os2.rootlen = 0; + return 10; + } + strcpy(G.os2.rootpath, pathcomp); + if (xtra == 3) /* had just "x:", make "x:." */ + G.os2.rootpath[G.os2.rootlen++] = '.'; + G.os2.rootpath[G.os2.rootlen++] = '/'; + G.os2.rootpath[G.os2.rootlen] = '\0'; + Trace((stderr, "rootpath now = [%s]\n", G.os2.rootpath)); + } + return 0; + } +#endif /* !SFX || SFX_EXDIR */ + +/*--------------------------------------------------------------------------- + END: free rootpath, immediately prior to program exit. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == END) { + Trace((stderr, "freeing rootpath\n")); + if (G.os2.rootlen > 0) { + free(G.os2.rootpath); + G.os2.rootlen = 0; + } + return 0; + } + + return 99; /* should never reach */ + +} /* end function checkdir() */ + + + + + +/***********************/ +/* Function isfloppy() */ /* more precisely, is it removable? */ +/***********************/ + +static int isfloppy(nDrive) + int nDrive; /* 1 == A:, 2 == B:, etc. */ +{ + uch ParmList[1] = {0}; + uch DataArea[1] = {0}; + char Name[3]; + HFILE handle; +#ifdef __32BIT__ + ULONG rc; + ULONG action; +#else + USHORT rc; + USHORT action; +#endif + + + Name[0] = (char) (nDrive + 'A' - 1); + Name[1] = ':'; + Name[2] = 0; + + rc = DosOpen(Name, &handle, &action, 0L, FILE_NORMAL, FILE_OPEN, + OPEN_FLAGS_DASD | OPEN_FLAGS_FAIL_ON_ERROR | + OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0L); + + if (rc == ERROR_NOT_READY) /* must be removable */ + return TRUE; + else if (rc) { /* other error: do default a/b heuristic instead */ + Trace((stderr, "error in DosOpen(DASD): guessing...\n", rc)); + return (nDrive == 1 || nDrive == 2)? TRUE : FALSE; + } + + rc = DosDevIOCtl(DataArea, sizeof(DataArea), ParmList, sizeof(ParmList), + DSK_BLOCKREMOVABLE, IOCTL_DISK, handle); + DosClose(handle); + + if (rc) { /* again, just check for a/b */ + Trace((stderr, "error in DosDevIOCtl category IOCTL_DISK, function " + "DSK_BLOCKREMOVABLE\n (rc = 0x%04x): guessing...\n", rc)); + return (nDrive == 1 || nDrive == 2)? TRUE : FALSE; + } else { + return DataArea[0] ? FALSE : TRUE; + } +} /* end function isfloppy() */ + + + + + +static int IsFileNameValid(const char *name) +{ + HFILE hf; +#ifdef __32BIT__ + ULONG uAction; +#else + USHORT uAction; +#endif + + switch( DosOpen((PSZ) name, &hf, &uAction, 0, 0, FILE_OPEN, + OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0) ) + { + case ERROR_INVALID_NAME: + case ERROR_FILENAME_EXCED_RANGE: + return FALSE; + case NO_ERROR: + DosClose(hf); + default: + return TRUE; + } +} + + + + + +/**********************/ +/* Function map2fat() */ +/**********************/ + +static void map2fat(pathcomp, pEndFAT) + char *pathcomp, **pEndFAT; +{ + char *ppc = pathcomp; /* variable pointer to pathcomp */ + char *pEnd = *pEndFAT; /* variable pointer to buildpathFAT */ + char *pBegin = *pEndFAT; /* constant pointer to start of this comp. */ + char *last_dot = (char *)NULL; /* last dot not converted to underscore */ + int dotname = FALSE; /* flag: path component begins with dot */ + /* ("." and ".." don't count) */ + register unsigned workch; /* hold the character being tested */ + + + /* Only need check those characters which are legal in HPFS but not + * in FAT: to get here, must already have passed through mapname. + * (GRR: oops, small bug--if char was quoted, no longer have any + * knowledge of that.) Also must truncate path component to ensure + * 8.3 compliance... + */ + while ((workch = (uch)*ppc++) != 0) { + switch (workch) { + case '[': /* add '"' '+' ',' '=' ?? */ + case ']': + *pEnd++ = '_'; /* convert brackets to underscores */ + break; + + case '.': + if (pEnd == *pEndFAT) { /* nothing appended yet... */ + if (*ppc == '\0') /* don't bother appending a */ + break; /* "./" component to the path */ + else if (*ppc == '.' && ppc[1] == '\0') { /* "../" */ + *pEnd++ = '.'; /* add first dot, unchanged... */ + ++ppc; /* skip second dot, since it will */ + } else { /* be "added" at end of if-block */ + *pEnd++ = '_'; /* FAT doesn't allow null filename */ + dotname = TRUE; /* bodies, so map .exrc -> _.exrc */ + } /* (extra '_' now, "dot" below) */ + } else if (dotname) { /* found a second dot, but still */ + dotname = FALSE; /* have extra leading underscore: */ + *pEnd = '\0'; /* remove it by shifting chars */ + pEnd = *pEndFAT + 1; /* left one space (e.g., .p1.p2: */ + while (pEnd[1]) { /* __p1 -> _p1_p2 -> _p1.p2 when */ + *pEnd = pEnd[1]; /* finished) [opt.: since first */ + ++pEnd; /* two chars are same, can start */ + } /* shifting at second position] */ + } + last_dot = pEnd; /* point at last dot so far... */ + *pEnd++ = '_'; /* convert dot to underscore for now */ + break; + + default: + *pEnd++ = (char)workch; + + } /* end switch */ + } /* end while loop */ + + *pEnd = '\0'; /* terminate buildpathFAT */ + + /* NOTE: keep in mind that pEnd points to the end of the path + * component, and *pEndFAT still points to the *beginning* of it... + * Also note that the algorithm does not try to get too fancy: + * if there are no dots already, the name either gets truncated + * at 8 characters or the last underscore is converted to a dot + * (only if more characters are saved that way). In no case is + * a dot inserted between existing characters. + */ + if (last_dot == (char *)NULL) { /* no dots: check for underscores... */ + char *plu = strrchr(pBegin, '_'); /* pointer to last underscore */ + + if (plu == (char *)NULL) { /* no dots, no underscores: truncate at 8 */ + *pEndFAT += 8; /* chars (could insert '.' and keep 11...) */ + if (*pEndFAT > pEnd) + *pEndFAT = pEnd; /* oops...didn't have 8 chars to truncate */ + else + **pEndFAT = '\0'; + } else if (MIN(plu - pBegin, 8) + MIN(pEnd - plu - 1, 3) > 8) { + last_dot = plu; /* be lazy: drop through to next if-block */ + } else if ((pEnd - *pEndFAT) > 8) { + *pEndFAT += 8; /* more fits into just basename than if */ + **pEndFAT = '\0'; /* convert last underscore to dot */ + } else + *pEndFAT = pEnd; /* whole thing fits into 8 chars or less */ + } + + if (last_dot != (char *)NULL) { /* one dot (or two, in the case of */ + *last_dot = '.'; /* "..") is OK: put it back in */ + + if ((last_dot - pBegin) > 8) { + char *p, *q; + int i; + + p = last_dot; + q = last_dot = pBegin + 8; + for (i = 0; (i < 4) && *p; ++i) /* too many chars in basename: */ + *q++ = *p++; /* shift ".ext" left and */ + *q = '\0'; /* truncate/terminate it */ + *pEndFAT = q; + } else if ((pEnd - last_dot) > 4) { /* too many chars in extension */ + *pEndFAT = last_dot + 4; + **pEndFAT = '\0'; + } else + *pEndFAT = pEnd; /* filename is fine; point at terminating zero */ + + if ((last_dot - pBegin) > 0 && last_dot[-1] == ' ') + last_dot[-1] = '_'; /* NO blank in front of '.'! */ + } +} /* end function map2fat() */ + + + + + +static int SetLongNameEA(char *name, char *longname) +{ + EAOP eaop; + FEALST fealst; + + eaop.fpFEAList = (PFEALIST) &fealst; + eaop.fpGEAList = NULL; + eaop.oError = 0; + + strcpy((char *) fealst.szName, ".LONGNAME"); + strcpy((char *) fealst.szValue, longname); + + fealst.cbList = sizeof(fealst) - CCHMAXPATH + strlen((char *) fealst.szValue); + fealst.cbName = (BYTE) strlen((char *) fealst.szName); + fealst.cbValue = sizeof(USHORT) * 2 + strlen((char *) fealst.szValue); + +#ifdef __32BIT__ + fealst.oNext = 0; +#endif + fealst.fEA = 0; + fealst.eaType = 0xFFFD; + fealst.eaSize = strlen((char *) fealst.szValue); + + return DosSetPathInfo(name, FIL_QUERYEASIZE, + (PBYTE) &eaop, sizeof(eaop), 0); +} + + + + + +/****************************/ +/* Function close_outfile() */ +/****************************/ + + /* GRR: need to return error level!! */ + +void close_outfile(__G) /* only for extracted files, not directories */ + __GDEF +{ + fclose(G.outfile); + + /* set extra fields, both stored-in-zipfile and .LONGNAME flavors */ + if (G.extra_field) { /* zipfile extra field may have extended attribs */ + int err = EvalExtraFields(__G__ G.filename, G.extra_field, + G.lrec.extra_field_length); + + if (err == IZ_EF_TRUNC) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", G.filename)); + Info(slide, 1, ((char *)slide, LoadFarString(TruncEAs), + makeword(G.extra_field+2)-10, uO.qflag? "\n" : "")); + } + } + + if (G.os2.longnameEA) { +#ifdef DEBUG + int e = +#endif + SetLongNameEA(G.filename, G.os2.lastpathcomp); + Trace((stderr, "close_outfile: SetLongNameEA() returns %d\n", e)); + free(G.os2.lastpathcomp); + } + + /* set date/time and permissions */ + SetPathAttrTimes(__G__ G.pInfo->file_attr, 0); + +} /* end function close_outfile() */ + + + + + +/******************************/ +/* Function check_for_newer() */ +/******************************/ + +int check_for_newer(__G__ filename) /* return 1 if existing file newer or equal; */ + __GDEF + char *filename; /* 0 if older; -1 if doesn't exist yet */ +{ + ulg existing, archive; +#ifdef USE_EF_UT_TIME + iztimes z_utime; +#endif + + if ((existing = (ulg)GetFileTime(filename)) == (ulg)-1) + return DOES_NOT_EXIST; + +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0, + G.lrec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME)) + { + TTrace((stderr, "check_for_newer: using Unix extra field mtime\n")); + archive = Utime2DosDateTime(z_utime.mtime); + } else { + archive = G.lrec.last_mod_dos_datetime; + } +#else /* !USE_EF_UT_TIME */ + archive = G.lrec.last_mod_dos_datetime; +#endif /* ?USE_EF_UT_TIME */ + + return (existing >= archive); +} /* end function check_for_newer() */ + + + + + +#ifndef SFX + +/*************************/ +/* Function dateformat() */ +/*************************/ + +int dateformat() +{ +/*----------------------------------------------------------------------------- + For those operating systems which support it, this function returns a value + which tells how national convention says that numeric dates are displayed. + Return values are DF_YMD, DF_DMY and DF_MDY. + -----------------------------------------------------------------------------*/ + + switch (GetCountryInfo()) { + case 0: + return DF_MDY; + case 1: + return DF_DMY; + case 2: + return DF_YMD; + } + return DF_MDY; /* default if error */ + +} /* end function dateformat() */ + + + + + +/************************/ +/* Function version() */ +/************************/ + +void version(__G) + __GDEF +{ + int len; +#if defined(__IBMC__) || defined(__WATCOMC__) || defined(_MSC_VER) + char buf[80]; +#endif + + len = sprintf((char *)slide, LoadFarString(CompiledWith), + +#if defined(__GNUC__) +# ifdef __EMX__ /* __EMX__ is defined as "1" only (sigh) */ + "emx+gcc ", __VERSION__, +# else + "gcc/2 ", __VERSION__, +# endif +#elif defined(__IBMC__) + "IBM ", +# if (__IBMC__ < 200) + (sprintf(buf, "C Set/2 %d.%02d", __IBMC__/100,__IBMC__%100), buf), +# elif (__IBMC__ < 300) + (sprintf(buf, "C Set++ %d.%02d", __IBMC__/100,__IBMC__%100), buf), +# else + (sprintf(buf, "Visual Age C++ %d.%02d", __IBMC__/100,__IBMC__%100), buf), +# endif +#elif defined(__WATCOMC__) + "Watcom C", (sprintf(buf, " (__WATCOMC__ = %d)", __WATCOMC__), buf), +#elif defined(__TURBOC__) +# ifdef __BORLANDC__ + "Borland C++", +# if (__BORLANDC__ < 0x0460) + " 1.0", +# elif (__BORLANDC__ == 0x0460) + " 1.5", /* from Kai Uwe: three less than DOS */ +# else + " 2.0", /* (__BORLANDC__ == 0x0500)? */ +# endif +# else + "Turbo C", /* these are probably irrelevant */ +# if (__TURBOC__ >= 661) + "++ 1.0 or later", +# elif (__TURBOC__ == 661) + " 3.0?", +# elif (__TURBOC__ == 397) + " 2.0", +# else + " 1.0 or 1.5?", +# endif +# endif +#elif defined(MSC) + "Microsoft C ", +# ifdef _MSC_VER + (sprintf(buf, "%d.%02d", _MSC_VER/100, _MSC_VER%100), buf), +# else + "5.1 or earlier", +# endif +#else + "unknown compiler", "", +#endif /* ?compilers */ + + "OS/2", + +/* GRR: does IBM C/2 identify itself as IBM rather than Microsoft? */ +#if (defined(MSC) || (defined(__WATCOMC__) && !defined(__386__))) +# if defined(M_I86HM) || defined(__HUGE__) + " (16-bit, huge)", +# elif defined(M_I86LM) || defined(__LARGE__) + " (16-bit, large)", +# elif defined(M_I86MM) || defined(__MEDIUM__) + " (16-bit, medium)", +# elif defined(M_I86CM) || defined(__COMPACT__) + " (16-bit, compact)", +# elif defined(M_I86SM) || defined(__SMALL__) + " (16-bit, small)", +# elif defined(M_I86TM) || defined(__TINY__) + " (16-bit, tiny)", +# else + " (16-bit)", +# endif +#else + " 2.x/3.x (32-bit)", +#endif + +#ifdef __DATE__ + " on ", __DATE__ +#else + "", "" +#endif + ); + + (*G.message)((zvoid *)&G, slide, (ulg)len, 0); + /* MSC can't handle huge macro expansions */ + + /* temporary debugging code for Borland compilers only */ + /* __TCPLUSPLUS__, __BCPLUSPLUS__ not defined for v1.5 */ +#if (defined(__TURBOC__) && defined(DEBUG)) + Info(slide, 0, ((char *)slide, "\t(__TURBOC__ = 0x%04x = %d)\n", __TURBOC__, + __TURBOC__)); +#ifdef __BORLANDC__ + Info(slide, 0, ((char *)slide, "\t(__BORLANDC__ = 0x%04x)\n",__BORLANDC__)); +#else + Info(slide, 0, ((char *)slide, "\tdebug(__BORLANDC__ not defined)\n")); +#endif +#endif /* __TURBOC__ && DEBUG */ + +} /* end function version() */ + +#endif /* !SFX */ + + + +/* This table can be static because it is pseudo-constant */ +static unsigned char cUpperCase[256], cLowerCase[256]; +static BOOL bInitialized=FALSE; + +/* Initialize the tables of upper- and lowercase characters, including + handling of country-dependent characters. */ + +static void InitNLS(void) +{ + unsigned nCnt, nU; + COUNTRYCODE cc; + + if (bInitialized == FALSE) { + bInitialized = TRUE; + + for ( nCnt = 0; nCnt < 256; nCnt++ ) + cUpperCase[nCnt] = cLowerCase[nCnt] = (unsigned char) nCnt; + + cc.country = cc.codepage = 0; + DosMapCase(sizeof(cUpperCase), &cc, (PCHAR) cUpperCase); + + for ( nCnt = 0; nCnt < 256; nCnt++ ) { + nU = cUpperCase[nCnt]; + if (nU != nCnt && cLowerCase[nU] == (unsigned char) nU) + cLowerCase[nU] = (unsigned char) nCnt; + } + + for ( nCnt = 'A'; nCnt <= 'Z'; nCnt++ ) + cLowerCase[nCnt] = (unsigned char) (nCnt - 'A' + 'a'); + } +} + + +int IsUpperNLS(int nChr) +{ + return (cUpperCase[nChr] == (unsigned char) nChr); +} + + +int ToLowerNLS(int nChr) +{ + return cLowerCase[nChr]; +} + + +char *StringLower(char *szArg) +{ + unsigned char *szPtr; + + for ( szPtr = (unsigned char *) szArg; *szPtr; szPtr++ ) + *szPtr = cLowerCase[*szPtr]; + return szArg; +} + + +#if defined(__IBMC__) && defined(__DEBUG_ALLOC__) +void DebugMalloc(void) +{ + _dump_allocated(0); /* print out debug malloc memory statistics */ +} +#endif + + +#if defined(REENTRANT) && defined(USETHREADID) +ulg GetThreadId(void) +{ + PTIB pptib; /* Address of a pointer to the + Thread Information Block */ + PPIB pppib; /* Address of a pointer to the + Process Information Block */ + + DosGetInfoBlocks(&pptib, &pppib); + return pptib->tib_ptib2->tib2_ultid; +} +#endif /* defined(REENTRANT) && defined(USETHREADID) */ + + +void os2GlobalsCtor(__GPRO) +{ + G.os2.nLastDrive = (USHORT)(-1); + G.os2.firstcall = TRUE; + +#ifdef OS2DLL + G.os2.rexx_mes = "0"; +#endif + + InitNLS(); +} diff --git a/utils/Install/packzip/os2acl.c b/utils/Install/packzip/os2acl.c new file mode 100644 index 0000000000..fbcc81cf58 --- /dev/null +++ b/utils/Install/packzip/os2acl.c @@ -0,0 +1,384 @@ +/* os2acl.c - access to OS/2 (LAN Server) ACLs + * + * Author: Kai Uwe Rommel <rommel@ars.de> + * Created: Mon Aug 08 1994 + * + * This code is in the public domain. + */ + +/* + * supported 32-bit compilers: + * - emx+gcc + * - IBM C Set++ 2.1 or newer + * - Watcom C/C++ 10.0 or newer + * + * supported 16-bit compilers: + * - MS C 6.00A + * - Watcom C/C++ 10.0 or newer + * + * supported OS/2 LAN environments: + * - IBM LAN Server/Requester 3.0, 4.0 and 5.0 (Warp Server) + * - IBM Peer 1.0 (Warp Connect) + */ + +#ifdef KUR + static char *rcsid = + "$Id$"; + static char *rcsrev = "$Revision$"; +#endif + +/* + * $Log$ + * Revision 1.2 2000/07/15 19:50:45 cvsuser + * merged 2.2 branch + * + * Revision 1.1.2.1 2000/04/11 12:38:06 BS + * Added wxInstall a self extracting installation program using wxWindows. + * + * Revision 1.3 1996/04/03 19:18:27 rommel + * minor fixes + * + * Revision 1.2 1996/03/30 22:03:52 rommel + * avoid frequent dynamic allocation for every call + * streamlined code + * + * Revision 1.1 1996/03/30 09:35:00 rommel + * Initial revision + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <malloc.h> + +#define INCL_NOPM +#define INCL_DOS +#define INCL_DOSERRORS +#include <os2.h> + +#include "os2/os2acl.h" + +#define UNLEN 20 + +#if defined(__WATCOMC__) && defined(__386__) && !defined(__32BIT__) +#define __32BIT__ +#endif + +#ifdef __32BIT__ +typedef ULONG U_INT; +#ifdef __EMX__ +#define PSTR16 _far16ptr +#define PTR16(x) _emx_32to16(x) +#else /* other 32-bit */ +#define PSTR16 PCHAR16 +#define PTR16(x) ((PCHAR16)(x)) +#endif +#else /* 16-bit */ +typedef USHORT U_INT; +#define PSTR16 PSZ +#define PTR16(x) (x) +#endif + +typedef struct access_list +{ + char acl_ugname[UNLEN+1]; + char acl_pad; + USHORT acl_access; +} +ACCLIST; + +typedef struct access_info +{ + PSTR16 acc_resource_name; + USHORT acc_attr; + USHORT acc_count; +} +ACCINFO; + +static ACCINFO *ai; +static char *path, *data; + +#ifdef __32BIT__ + +#ifdef __EMX__ + +static USHORT (APIENTRY *_NetAccessGetInfo)(PSZ pszServer, PSZ pszResource, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer, PUSHORT pcbTotalAvail); +static USHORT (APIENTRY *_NetAccessSetInfo)(PSZ pszServer, PSZ pszResource, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer, USHORT sParmNum); +static USHORT (APIENTRY *_NetAccessAdd)(PSZ pszServer, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer); + +USHORT NetAccessGetInfo(PSZ pszServer, PSZ pszResource, USHORT sLevel, + PVOID pbBuffer, USHORT cbBuffer, PUSHORT pcbTotalAvail) +{ + return (USHORT) + (_THUNK_PROLOG (4+4+2+4+2+4); + _THUNK_FLAT (pszServer); + _THUNK_FLAT (pszResource); + _THUNK_SHORT (sLevel); + _THUNK_FLAT (pbBuffer); + _THUNK_SHORT (cbBuffer); + _THUNK_FLAT (pcbTotalAvail); + _THUNK_CALLI (_emx_32to16(_NetAccessGetInfo))); +} + +USHORT NetAccessSetInfo(PSZ pszServer, PSZ pszResource, USHORT sLevel, + PVOID pbBuffer, USHORT cbBuffer, USHORT sParmNum) +{ + return (USHORT) + (_THUNK_PROLOG (4+4+2+4+2+2); + _THUNK_FLAT (pszServer); + _THUNK_FLAT (pszResource); + _THUNK_SHORT (sLevel); + _THUNK_FLAT (pbBuffer); + _THUNK_SHORT (cbBuffer); + _THUNK_SHORT (sParmNum); + _THUNK_CALLI (_emx_32to16(_NetAccessSetInfo))); +} + +USHORT NetAccessAdd(PSZ pszServer, USHORT sLevel, + PVOID pbBuffer, USHORT cbBuffer) +{ + return (USHORT) + (_THUNK_PROLOG (4+2+4+2); + _THUNK_FLAT (pszServer); + _THUNK_SHORT (sLevel); + _THUNK_FLAT (pbBuffer); + _THUNK_SHORT (cbBuffer); + _THUNK_CALLI (_emx_32to16(_NetAccessAdd))); +} + +#else /* other 32-bit */ + +APIRET16 (* APIENTRY16 NetAccessGetInfo)(PCHAR16 pszServer, PCHAR16 pszResource, + USHORT sLevel, PVOID16 pbBuffer, USHORT cbBuffer, PVOID16 pcbTotalAvail); +APIRET16 (* APIENTRY16 NetAccessSetInfo)(PCHAR16 pszServer, PCHAR16 pszResource, + USHORT sLevel, PVOID16 pbBuffer, USHORT cbBuffer, USHORT sParmNum); +APIRET16 (* APIENTRY16 NetAccessAdd)(PCHAR16 pszServer, + USHORT sLevel, PVOID16 pbBuffer, USHORT cbBuffer); + +#define _NetAccessGetInfo NetAccessGetInfo +#define _NetAccessSetInfo NetAccessSetInfo +#define _NetAccessAdd NetAccessAdd + +#if !defined(__IBMC__) || !defined(__TILED__) +#define _tmalloc malloc +#define _tfree free +#endif + +#endif +#else /* 16-bit */ + +USHORT (APIENTRY *NetAccessGetInfo)(PSZ pszServer, PSZ pszResource, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer, PUSHORT pcbTotalAvail); +USHORT (APIENTRY *NetAccessSetInfo)(PSZ pszServer, PSZ pszResource, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer, USHORT sParmNum); +USHORT (APIENTRY *NetAccessAdd)(PSZ pszServer, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer); + +#define _NetAccessGetInfo NetAccessGetInfo +#define _NetAccessSetInfo NetAccessSetInfo +#define _NetAccessAdd NetAccessAdd + +#define _tmalloc malloc +#define _tfree free + +#define DosQueryProcAddr(handle, ord, name, funcptr) \ + DosGetProcAddr(handle, name, funcptr) +#define DosQueryCurrentDir DosQCurDir +#define DosQueryCurrentDisk DosQCurDisk + +#endif + + +static BOOL acl_init(void) +{ + static BOOL initialized, netapi_avail; + HMODULE netapi; + char buf[256]; + + if (initialized) + return netapi_avail; + + initialized = TRUE; + + if (DosLoadModule(buf, sizeof(buf), "NETAPI", &netapi)) + return FALSE; + + if (DosQueryProcAddr(netapi, 0, "NETACCESSGETINFO", (PFN *) &_NetAccessGetInfo) || + DosQueryProcAddr(netapi, 0, "NETACCESSSETINFO", (PFN *) &_NetAccessSetInfo) || + DosQueryProcAddr(netapi, 0, "NETACCESSADD", (PFN *) &_NetAccessAdd)) + return FALSE; + +#if defined(__WATCOMC__) && defined(__386__) + NetAccessGetInfo = (PVOID) (ULONG) (PVOID16) NetAccessGetInfo; + NetAccessSetInfo = (PVOID) (ULONG) (PVOID16) NetAccessSetInfo; + NetAccessAdd = (PVOID) (ULONG) (PVOID16) NetAccessAdd; +#endif + + if ((path = _tmalloc(CCHMAXPATH)) == NULL) + return FALSE; + if ((data = _tmalloc(ACL_BUFFERSIZE)) == NULL) + return FALSE; + if ((ai = _tmalloc(sizeof(ACCINFO))) == NULL) + return -1; + + netapi_avail = TRUE; + + return netapi_avail; +} + +static void acl_mkpath(char *buffer, const char *source) +{ + char *ptr; + static char cwd[CCHMAXPATH]; + static U_INT cwdlen; + U_INT cdrive; + ULONG drivemap; + + if (isalpha(source[0]) && source[1] == ':') + buffer[0] = 0; /* fully qualified names */ + else + { + if (cwd[0] == 0) + { + DosQueryCurrentDisk(&cdrive, &drivemap); + cwd[0] = (char)(cdrive + '@'); + cwd[1] = ':'; + cwd[2] = '\\'; + cwdlen = sizeof(cwd) - 3; + DosQueryCurrentDir(0, cwd + 3, &cwdlen); + cwdlen = strlen(cwd); + } + + if (source[0] == '/' || source[0] == '\\') + { + if (source[1] == '/' || source[1] == '\\') + buffer[0] = 0; /* UNC names */ + else + { + strncpy(buffer, cwd, 2); + buffer[2] = 0; + } + } + else + { + strcpy(buffer, cwd); + if (cwd[cwdlen - 1] != '\\' && cwd[cwdlen - 1] != '/') + strcat(buffer, "/"); + } + } + + strcat(buffer, source); + + for (ptr = buffer; *ptr; ptr++) + if (*ptr == '/') + *ptr = '\\'; + + if (ptr[-1] == '\\') + ptr[-1] = 0; + + strupr(buffer); +} + +static int acl_bin2text(char *data, char *text) +{ + ACCINFO *ai; + ACCLIST *al; + U_INT cnt, offs; + + ai = (ACCINFO *) data; + al = (ACCLIST *) (data + sizeof(ACCINFO)); + + offs = sprintf(text, "ACL1:%X,%d\n", + ai -> acc_attr, ai -> acc_count); + + for (cnt = 0; cnt < ai -> acc_count; cnt++) + offs += sprintf(text + offs, "%s,%X\n", + al[cnt].acl_ugname, al[cnt].acl_access); + + return strlen(text); +} + +int acl_get(char *server, const char *resource, char *buffer) +{ + USHORT datalen; + PSZ srv = NULL; + int rc; + + if (!acl_init()) + return -1; + + if (server) + srv = server; + + acl_mkpath(path, resource); + datalen = 0; + + rc = NetAccessGetInfo(srv, path, 1, data, ACL_BUFFERSIZE, &datalen); + + if (rc == 0) + acl_bin2text(data, buffer); + + return rc; +} + +static int acl_text2bin(char *data, char *text, char *path) +{ + ACCINFO *ai; + ACCLIST *al; + char *ptr, *ptr2; + U_INT cnt; + + ai = (ACCINFO *) data; + ai -> acc_resource_name = PTR16(path); + + if (sscanf(text, "ACL1:%hX,%hd", + &ai -> acc_attr, &ai -> acc_count) != 2) + return ERROR_INVALID_PARAMETER; + + al = (ACCLIST *) (data + sizeof(ACCINFO)); + ptr = strchr(text, '\n') + 1; + + for (cnt = 0; cnt < ai -> acc_count; cnt++) + { + ptr2 = strchr(ptr, ','); + strncpy(al[cnt].acl_ugname, ptr, ptr2 - ptr); + al[cnt].acl_ugname[ptr2 - ptr] = 0; + sscanf(ptr2 + 1, "%hx", &al[cnt].acl_access); + ptr = strchr(ptr, '\n') + 1; + } + + return sizeof(ACCINFO) + ai -> acc_count * sizeof(ACCLIST); +} + +int acl_set(char *server, const char *resource, char *buffer) +{ + USHORT datalen; + PSZ srv = NULL; + + if (!acl_init()) + return -1; + + if (server) + srv = server; + + acl_mkpath(path, resource); + + ai -> acc_resource_name = PTR16(path); + ai -> acc_attr = 0; + ai -> acc_count = 0; + + NetAccessAdd(srv, 1, ai, sizeof(ACCINFO)); + /* Ignore any errors, most probably because ACL already exists. */ + /* In any such case, try updating the existing ACL. */ + + datalen = acl_text2bin(data, buffer, path); + + return NetAccessSetInfo(srv, path, 1, data, datalen, 0); +} + +/* end of os2acl.c */ diff --git a/utils/Install/packzip/process.c b/utils/Install/packzip/process.c new file mode 100644 index 0000000000..3fa023c904 --- /dev/null +++ b/utils/Install/packzip/process.c @@ -0,0 +1,1383 @@ +/*--------------------------------------------------------------------------- + + process.c + + This file contains the top-level routines for processing multiple zipfiles. + + Contains: process_zipfiles() + free_G_buffers() + do_seekable() + find_ecrec() + uz_end_central() + process_cdir_file_hdr() + get_cdir_ent() + process_local_file_hdr() + ef_scan_for_izux() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" +#ifdef WINDLL +# ifdef POCKET_UNZIP +# include "wince/intrface.h" +# else +# include "windll/windll.h" +# endif +#endif + +static int do_seekable OF((__GPRO__ int lastchance)); +static int find_ecrec OF((__GPRO__ long searchlen)); + +int files = 0; + +static ZCONST char Far CannotAllocateBuffers[] = + "error: cannot allocate unzip buffers\n"; + +#ifdef SFX + static ZCONST char Far CannotFindMyself[] = + "unzipsfx: cannot find myself! [%s]\n"; + +#else /* !SFX */ + /* process_zipfiles() strings */ +# if (defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME)) + static ZCONST char Far WarnInvalidTZ[] = + "Warning: TZ environment variable not found, cannot use UTC times!!\n"; +# endif + static ZCONST char Far FilesProcessOK[] = + "%d archive%s successfully processed.\n"; + static ZCONST char Far ArchiveWarning[] = + "%d archive%s had warnings but no fatal errors.\n"; + static ZCONST char Far ArchiveFatalError[] = + "%d archive%s had fatal errors.\n"; + static ZCONST char Far FileHadNoZipfileDir[] = + "%d file%s had no zipfile directory.\n"; + static ZCONST char Far ZipfileWasDir[] = "1 \"zipfile\" was a directory.\n"; + static ZCONST char Far ManyZipfilesWereDir[] = + "%d \"zipfiles\" were directories.\n"; + static ZCONST char Far NoZipfileFound[] = "No zipfiles found.\n"; + + /* do_seekable() strings */ +# ifdef UNIX + static ZCONST char Far CannotFindZipfileDirMsg[] = + "%s: cannot find zipfile directory in one of %s or\n\ + %s%s.zip, and cannot find %s, period.\n"; + static ZCONST char Far CannotFindEitherZipfile[] = + "%s: cannot find %s, %s.zip or %s.\n"; /* ", so there" removed 970918 */ +# else /* !UNIX */ +# ifndef AMIGA + static ZCONST char Far CannotFindWildcardMatch[] = + "%s: cannot find any matches for wildcard specification \"%s\".\n"; +# endif /* !AMIGA */ + static ZCONST char Far CannotFindZipfileDirMsg[] = + "%s: cannot find zipfile directory in %s,\n\ + %sand cannot find %s, period.\n"; + static ZCONST char Far CannotFindEitherZipfile[] = + "%s: cannot find either %s or %s.\n"; /* ", so there" removed 970918 */ +# endif /* ?UNIX */ + extern ZCONST char Far Zipnfo[]; /* in unzip.c */ +#ifndef WINDLL + static ZCONST char Far Unzip[] = "unzip"; +#else + static ZCONST char Far Unzip[] = "UnZip DLL"; +#endif + static ZCONST char Far MaybeExe[] = + "note: %s may be a plain executable, not an archive\n"; + static ZCONST char Far CentDirNotInZipMsg[] = "\n\ + [%s]:\n\ + Zipfile is disk %u of a multi-disk archive, and this is not the disk on\n\ + which the central zipfile directory begins (disk %u).\n"; + static ZCONST char Far EndCentDirBogus[] = + "\nwarning [%s]: end-of-central-directory record claims this\n\ + is disk %u but that the central directory starts on disk %u; this is a\n\ + contradiction. Attempting to process anyway.\n"; +# ifdef NO_MULTIPART + static ZCONST char Far NoMultiDiskArcSupport[] = + "\nerror [%s]: zipfile is part of multi-disk archive\n\ + (sorry, not yet supported).\n"; + static ZCONST char Far MaybePakBug[] = "warning [%s]:\ + zipfile claims to be 2nd disk of a 2-part archive;\n\ + attempting to process anyway. If no further errors occur, this archive\n\ + was probably created by PAK v2.51 or earlier. This bug was reported to\n\ + NoGate in March 1991 and was supposed to have been fixed by mid-1991; as\n\ + of mid-1992 it still hadn't been. (If further errors do occur, archive\n\ + was probably created by PKZIP 2.04c or later; UnZip does not yet support\n\ + multi-part archives.)\n"; +# else + static ZCONST char Far MaybePakBug[] = "warning [%s]:\ + zipfile claims to be last disk of a multi-part archive;\n\ + attempting to process anyway, assuming all parts have been concatenated\n\ + together in order. Expect \"errors\" and warnings...true multi-part support\ +\n doesn't exist yet (coming soon).\n"; +# endif + static ZCONST char Far ExtraBytesAtStart[] = + "warning [%s]: %ld extra byte%s at beginning or within zipfile\n\ + (attempting to process anyway)\n"; +#endif /* ?SFX */ + +static ZCONST char Far MissingBytes[] = + "error [%s]: missing %ld bytes in zipfile\n\ + (attempting to process anyway)\n"; +static ZCONST char Far NullCentDirOffset[] = + "error [%s]: NULL central directory offset\n\ + (attempting to process anyway)\n"; +static ZCONST char Far ZipfileEmpty[] = "warning [%s]: zipfile is empty\n"; +static ZCONST char Far CentDirStartNotFound[] = + "error [%s]: start of central directory not found;\n\ + zipfile corrupt.\n%s"; +#ifndef SFX + static ZCONST char Far CentDirTooLong[] = + "error [%s]: reported length of central directory is\n\ + %ld bytes too long (Atari STZip zipfile? J.H.Holm ZIPSPLIT 1.1\n\ + zipfile?). Compensating...\n"; + static ZCONST char Far CentDirEndSigNotFound[] = "\ + End-of-central-directory signature not found. Either this file is not\n\ + a zipfile, or it constitutes one disk of a multi-part archive. In the\n\ + latter case the central directory and zipfile comment will be found on\n\ + the last disk(s) of this archive.\n"; +#else /* SFX */ + static ZCONST char Far CentDirEndSigNotFound[] = + " End-of-central-directory signature not found.\n"; +#endif /* ?SFX */ +static ZCONST char Far ZipfileCommTrunc1[] = + "\ncaution: zipfile comment truncated\n"; + + + + +/*******************************/ +/* Function process_zipfiles() */ +/*******************************/ + +int process_zipfiles(__G) /* return PK-type error code */ + __GDEF +{ +#ifndef SFX + char *lastzipfn = (char *)NULL; + int NumWinFiles, NumLoseFiles, NumWarnFiles; + int NumMissDirs, NumMissFiles; +#endif + int error=0, error_in_archive=0; + + +/*--------------------------------------------------------------------------- + Start by allocating buffers and (re)constructing the various PK signature + strings. + ---------------------------------------------------------------------------*/ + + G.inbuf = (uch *)malloc(INBUFSIZ + 4); /* 4 extra for hold[] (below) */ + G.outbuf = (uch *)malloc(OUTBUFSIZ + 1); /* 1 extra for string term. */ + + if ((G.inbuf == (uch *)NULL) || (G.outbuf == (uch *)NULL)) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotAllocateBuffers))); + return(PK_MEM); + } + G.hold = G.inbuf + INBUFSIZ; /* to check for boundary-spanning sigs */ +#ifndef VMS /* VMS uses its own buffer scheme for textmode flush(). */ +#ifdef SMALL_MEM + G.outbuf2 = G.outbuf+RAWBUFSIZ; /* never changes */ +#endif +#endif /* !VMS */ + +#if 0 /* CRC_32_TAB has been NULLified by CONSTRUCTGLOBALS !!!! */ + /* allocate the CRC table only later when we know we have a zipfile */ + CRC_32_TAB = NULL; +#endif /* 0 */ + + /* finish up initialization of magic signature strings */ + local_hdr_sig[0] /* = extd_local_sig[0] */ = 0x50; /* ASCII 'P', */ + central_hdr_sig[0] = end_central_sig[0] = 0x50; /* not EBCDIC */ + + local_hdr_sig[1] /* = extd_local_sig[1] */ = 0x4B; /* ASCII 'K', */ + central_hdr_sig[1] = end_central_sig[1] = 0x4B; /* not EBCDIC */ + +/*--------------------------------------------------------------------------- + Make sure timezone info is set correctly; localtime() returns GMT on + some OSes (e.g., Solaris 2.x) if this isn't done first. The ifdefs were + initially copied from dos_to_unix_time() in fileio.c. probably, they are + still too strict; any listed OS that supplies tzset(), regardless of + whether the function does anything, should be removed from the ifdefs. + ---------------------------------------------------------------------------*/ + +#if (defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME)) +# ifndef VALID_TIMEZONE +# define VALID_TIMEZONE(tmp) \ + (((tmp = getenv("TZ")) != NULL) && (*tmp != '\0')) +# endif + { + char *p; + G.tz_is_valid = VALID_TIMEZONE(p); +# ifndef SFX + if (!G.tz_is_valid) { + Info(slide, 0x401, ((char *)slide, LoadFarString(WarnInvalidTZ))); + error_in_archive = error = PK_WARN; + } +# endif /* !SFX */ + } +#endif /* IZ_CHECK_TZ && USE_EF_UT_TIME */ + +/* For systems that do not have tzset() but supply this function using another + name (_tzset() or something similar), an appropiate "#define tzset ..." + should be added to the system specifc configuration section. */ +#if (!defined(T20_VMS) && !defined(MACOS) && !defined(RISCOS) && !defined(QDOS)) +#if (!defined(BSD) && !defined(MTS) && !defined(CMS_MVS) && !defined(TANDEM)) + tzset(); +#endif +#endif + +/*--------------------------------------------------------------------------- + Match (possible) wildcard zipfile specification with existing files and + attempt to process each. If no hits, try again after appending ".zip" + suffix. If still no luck, give up. + ---------------------------------------------------------------------------*/ + +#ifdef SFX + if ((error = do_seekable(__G__ 0)) == PK_NOZIP) { +#ifdef EXE_EXTENSION + int len=strlen(G.argv0); + + /* append .exe if appropriate; also .sfx? */ + if ( (G.zipfn = (char *)malloc(len+sizeof(EXE_EXTENSION))) != + (char *)NULL ) { + strcpy(G.zipfn, G.argv0); + strcpy(G.zipfn+len, EXE_EXTENSION); + error = do_seekable(__G__ 0); + free(G.zipfn); + G.zipfn = G.argv0; /* for "cannot find myself" message only */ + } +#endif /* EXE_EXTENSION */ +#ifdef WIN32 + G.zipfn = G.argv0; /* for "cannot find myself" message only */ +#endif + } + if (error) { + if (error == IZ_DIR) + error_in_archive = PK_NOZIP; + else + error_in_archive = error; + if (error == PK_NOZIP) + Info(slide, 1, ((char *)slide, LoadFarString(CannotFindMyself), + G.zipfn)); + } + +#else /* !SFX */ + NumWinFiles = NumLoseFiles = NumWarnFiles = 0; + files = NumMissDirs = NumMissFiles = 0; + + while ((G.zipfn = do_wild(__G__ G.wildzipfn)) != (char *)NULL) { + Trace((stderr, "do_wild( %s ) returns %s\n", G.wildzipfn, G.zipfn)); + + lastzipfn = G.zipfn; + + /* print a blank line between the output of different zipfiles */ + if (!uO.qflag && error != PK_NOZIP && error != IZ_DIR +#ifdef TIMESTAMP + && (!uO.T_flag || uO.zipinfo_mode) +#endif + && (NumWinFiles+NumLoseFiles+NumWarnFiles+NumMissFiles) > 0) + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + + if ((error = do_seekable(__G__ 0)) == PK_WARN) + ++NumWarnFiles; + else if (error == IZ_DIR) + ++NumMissDirs; + else if (error == PK_NOZIP) + ++NumMissFiles; + else if (error) + ++NumLoseFiles; + else + ++NumWinFiles; + + if(!uO.vflag) + files = NumWinFiles; + + if (error != IZ_DIR && error > error_in_archive) + error_in_archive = error; + Trace((stderr, "do_seekable(0) returns %d\n", error)); +#ifdef WINDLL + if (error == IZ_CTRLC) { + free_G_buffers(__G); + return error; + } +#endif + + } /* end while-loop (wildcard zipfiles) */ + + if ((NumWinFiles + NumWarnFiles + NumLoseFiles) == 0 && + (NumMissDirs + NumMissFiles) == 1 && lastzipfn != (char *)NULL) + { + NumMissDirs = NumMissFiles = 0; + if (error_in_archive == PK_NOZIP) + error_in_archive = PK_COOL; + +#if (!defined(UNIX) && !defined(AMIGA)) /* filenames with wildcard characters */ + if (iswild(G.wildzipfn)) + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotFindWildcardMatch), uO.zipinfo_mode? + LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip), + G.wildzipfn)); + else +#endif + { + char *p = lastzipfn + strlen(lastzipfn); + + G.zipfn = lastzipfn; + strcpy(p, ZSUFX); + +#if defined(UNIX) || defined(QDOS) + /* only Unix has case-sensitive filesystems */ + /* Well FlexOS (sometimes) also has them, but support is per media */ + /* and a pig to code for, so treat as case insensitive for now */ + /* we do this under QDOS to check for .zip as well as _zip */ + if ((error = do_seekable(__G__ 0)) == PK_NOZIP || error == IZ_DIR) { + if (error == IZ_DIR) + ++NumMissDirs; + strcpy(p, ALT_ZSUFX); + error = do_seekable(__G__ 1); + } +#else + error = do_seekable(__G__ 1); +#endif + if (error == PK_WARN) /* GRR: make this a switch/case stmt ... */ + ++NumWarnFiles; + else if (error == IZ_DIR) + ++NumMissDirs; + else if (error == PK_NOZIP) + /* increment again => bug: "1 file had no zipfile directory." */ + /* ++NumMissFiles */ ; + else if (error) + ++NumLoseFiles; + else + ++NumWinFiles; + + if (error > error_in_archive) + error_in_archive = error; + Trace((stderr, "do_seekable(1) returns %d\n", error)); +#ifdef WINDLL + if (error == IZ_CTRLC) { + free_G_buffers(__G); + return error; + } +#endif + } + } +#endif /* ?SFX */ + +/*--------------------------------------------------------------------------- + Print summary of all zipfiles, assuming zipfile spec was a wildcard (no + need for a summary if just one zipfile). + ---------------------------------------------------------------------------*/ + +#ifndef SFX + if (iswild(G.wildzipfn) && uO.qflag < 3 +#ifdef TIMESTAMP + && !(uO.T_flag && uO.qflag && !uO.zipinfo_mode) +#endif + ) + { + if ((NumMissFiles + NumLoseFiles + NumWarnFiles > 0 || NumWinFiles != 1) +#ifdef TIMESTAMP + && !(uO.T_flag && !uO.zipinfo_mode) +#endif + && !(uO.tflag && uO.qflag > 1)) + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0x401); + if ((NumWinFiles > 1) || (NumWinFiles == 1 && + NumMissDirs + NumMissFiles + NumLoseFiles + NumWarnFiles > 0)) + Info(slide, 0x401, ((char *)slide, LoadFarString(FilesProcessOK), + NumWinFiles, (NumWinFiles == 1)? " was" : "s were")); + if (NumWarnFiles > 0) + Info(slide, 0x401, ((char *)slide, LoadFarString(ArchiveWarning), + NumWarnFiles, (NumWarnFiles == 1)? "" : "s")); + if (NumLoseFiles > 0) + Info(slide, 0x401, ((char *)slide, LoadFarString(ArchiveFatalError), + NumLoseFiles, (NumLoseFiles == 1)? "" : "s")); + if (NumMissFiles > 0) + Info(slide, 0x401, ((char *)slide, + LoadFarString(FileHadNoZipfileDir), NumMissFiles, + (NumMissFiles == 1)? "" : "s")); + if (NumMissDirs == 1) + Info(slide, 0x401, ((char *)slide, LoadFarString(ZipfileWasDir))); + else if (NumMissDirs > 0) + Info(slide, 0x401, ((char *)slide, + LoadFarString(ManyZipfilesWereDir), NumMissDirs)); + if (NumWinFiles + NumLoseFiles + NumWarnFiles == 0) + Info(slide, 0x401, ((char *)slide, LoadFarString(NoZipfileFound))); + } +#endif /* !SFX */ + + /* free allocated memory */ + free_G_buffers(__G); + + return error_in_archive; + +} /* end function process_zipfiles() */ + + + + + +/*****************************/ +/* Function free_G_buffers() */ +/*****************************/ + +void free_G_buffers(__G) /* releases all memory allocated in global vars */ + __GDEF +{ + inflate_free(__G); + checkdir(__G__ (char *)NULL, END); + +#ifdef DYNALLOC_CRCTAB + if (CRC_32_TAB) { + free_crc_table(); + CRC_32_TAB = NULL; + } +#endif + + if (G.key != (char *)NULL) { + free(G.key); + G.key = (char *)NULL; + } + +#if (!defined(VMS) && !defined(SMALL_MEM)) + /* VMS uses its own buffer scheme for textmode flush() */ + if (G.outbuf2) { + free(G.outbuf2); /* malloc'd ONLY if unshrink and -a */ + G.outbuf2 = (uch *)NULL; + } +#endif + + if (G.outbuf) + free(G.outbuf); + if (G.inbuf) + free(G.inbuf); + G.inbuf = G.outbuf = (uch *)NULL; + +#ifdef MALLOC_WORK + if (G.area.Slide) { + free(G.area.Slide); + G.area.Slide = (uch *)NULL; + } +#endif + +} /* end function free_G_buffers() */ + + + + + +/**************************/ +/* Function do_seekable() */ +/**************************/ + +static int do_seekable(__G__ lastchance) /* return PK-type error code */ + __GDEF + int lastchance; +{ +#ifndef SFX + /* static int no_ecrec = FALSE; SKM: moved to globals.h */ + int maybe_exe=FALSE; + int too_weird_to_continue=FALSE; +#ifdef TIMESTAMP + time_t uxstamp; + unsigned nmember = 0; +#endif +#endif + int error=0, error_in_archive; + + +/*--------------------------------------------------------------------------- + Open the zipfile for reading in BINARY mode to prevent CR/LF translation, + which would corrupt the bit streams. + ---------------------------------------------------------------------------*/ + + if (SSTAT(G.zipfn, &G.statbuf) || + (error = S_ISDIR(G.statbuf.st_mode)) != 0) + { +#ifndef SFX + if (lastchance) { +#if defined(UNIX) || defined(QDOS) + if (G.no_ecrec) + Info(slide, 1, ((char *)slide, + LoadFarString(CannotFindZipfileDirMsg), uO.zipinfo_mode? + LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip), + G.wildzipfn, uO.zipinfo_mode? " " : "", G.wildzipfn, + G.zipfn)); + else + Info(slide, 1, ((char *)slide, + LoadFarString(CannotFindEitherZipfile), uO.zipinfo_mode? + LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip), + G.wildzipfn, G.wildzipfn, G.zipfn)); +#else /* !UNIX */ + if (G.no_ecrec) + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotFindZipfileDirMsg), uO.zipinfo_mode? + LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip), + G.wildzipfn, uO.zipinfo_mode? " " : "", G.zipfn)); + else + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotFindEitherZipfile), uO.zipinfo_mode? + LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip), + G.wildzipfn, G.zipfn)); +#endif /* ?UNIX */ + } +#endif /* !SFX */ + return error? IZ_DIR : PK_NOZIP; + } + G.ziplen = G.statbuf.st_size; + +#ifndef SFX +#if defined(UNIX) || defined(DOS_OS2_W32) + if (G.statbuf.st_mode & S_IEXEC) /* no extension on Unix exes: might */ + maybe_exe = TRUE; /* find unzip, not unzip.zip; etc. */ +#endif +#endif /* !SFX */ + +#ifdef VMS + if (check_format(__G)) /* check for variable-length format */ + return PK_ERR; +#endif + + if (open_input_file(__G)) /* this should never happen, given */ + return PK_NOZIP; /* the stat() test above, but... */ + +/*--------------------------------------------------------------------------- + Find and process the end-of-central-directory header. UnZip need only + check last 65557 bytes of zipfile: comment may be up to 65535, end-of- + central-directory record is 18 bytes, and signature itself is 4 bytes; + add some to allow for appended garbage. Since ZipInfo is often used as + a debugging tool, search the whole zipfile if zipinfo_mode is true. + ---------------------------------------------------------------------------*/ + + /* initialize the CRC table pointer (once) */ + if (CRC_32_TAB == NULL) { + if ((CRC_32_TAB = get_crc_table()) == NULL) + return PK_MEM; + } + +#if (!defined(SFX) || defined(SFX_EXDIR)) + /* check out if specified extraction root directory exists */ + if (uO.exdir != (char *)NULL && G.extract_flag) { + G.create_dirs = !uO.fflag; + if ((error = checkdir(__G__ uO.exdir, ROOT)) > 2) + return error; /* out of memory, or file in way */ + } +#endif /* !SFX || SFX_EXDIR */ + + G.cur_zipfile_bufstart = 0; + G.inptr = G.inbuf; + +#if (!defined(WINDLL) && !defined(SFX)) +#ifdef TIMESTAMP + if (!uO.zipinfo_mode && !uO.qflag && !uO.T_flag) +#else + if (!uO.zipinfo_mode && !uO.qflag) +#endif +#ifdef WIN32 /* Win32 console may require codepage conversion for G.zipfn */ + Info(slide, 0, ((char *)slide, "Archive: %s\n", FnFilter1(G.zipfn))); +#else + Info(slide, 0, ((char *)slide, "Archive: %s\n", G.zipfn)); +#endif +#endif /* !WINDLL && !SFX */ + + if (( +#ifndef NO_ZIPINFO + uO.zipinfo_mode && + ((error_in_archive = find_ecrec(__G__ G.ziplen)) != 0 || + (error_in_archive = zi_end_central(__G)) > PK_WARN)) + || (!uO.zipinfo_mode && +#endif + ((error_in_archive = find_ecrec(__G__ MIN(G.ziplen,66000L))) != 0 || + (error_in_archive = uz_end_central(__G)) > PK_WARN))) + { + CLOSE_INFILE(); + +#ifdef SFX + ++lastchance; /* avoid picky compiler warnings */ + return error_in_archive; +#else + if (maybe_exe) + Info(slide, 0x401, ((char *)slide, LoadFarString(MaybeExe), + G.zipfn)); + if (lastchance) + return error_in_archive; + else { + G.no_ecrec = TRUE; /* assume we found wrong file: e.g., */ + return PK_NOZIP; /* unzip instead of unzip.zip */ + } +#endif /* ?SFX */ + } + + if ((uO.zflag > 0) && !uO.zipinfo_mode) { /* unzip: zflag = comment ONLY */ + CLOSE_INFILE(); + return error_in_archive; + } + +/*--------------------------------------------------------------------------- + Test the end-of-central-directory info for incompatibilities (multi-disk + archives) or inconsistencies (missing or extra bytes in zipfile). + ---------------------------------------------------------------------------*/ + +#ifdef NO_MULTIPART + error = !uO.zipinfo_mode && (G.ecrec.number_this_disk == 1) && + (G.ecrec.num_disk_start_cdir == 1); +#else + error = !uO.zipinfo_mode && (G.ecrec.number_this_disk != 0); +#endif + +#ifndef SFX + if (uO.zipinfo_mode && + G.ecrec.number_this_disk != G.ecrec.num_disk_start_cdir) + { + if (G.ecrec.number_this_disk > G.ecrec.num_disk_start_cdir) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(CentDirNotInZipMsg), G.zipfn, + G.ecrec.number_this_disk, G.ecrec.num_disk_start_cdir)); + error_in_archive = PK_FIND; + too_weird_to_continue = TRUE; + } else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(EndCentDirBogus), G.zipfn, + G.ecrec.number_this_disk, G.ecrec.num_disk_start_cdir)); + error_in_archive = PK_WARN; + } +#ifdef NO_MULTIPART /* concatenation of multiple parts works in some cases */ + } else if (!uO.zipinfo_mode && !error && G.ecrec.number_this_disk != 0) { + Info(slide, 0x401, ((char *)slide, LoadFarString(NoMultiDiskArcSupport), + G.zipfn)); + error_in_archive = PK_FIND; + too_weird_to_continue = TRUE; +#endif + } + + if (!too_weird_to_continue) { /* (relatively) normal zipfile: go for it */ + if (error) { + Info(slide, 0x401, ((char *)slide, LoadFarString(MaybePakBug), + G.zipfn)); + error_in_archive = PK_WARN; + } +#endif /* !SFX */ + if ((G.extra_bytes = G.real_ecrec_offset-G.expect_ecrec_offset) < + (LONGINT)0) + { + Info(slide, 0x401, ((char *)slide, LoadFarString(MissingBytes), + G.zipfn, (long)(-G.extra_bytes))); + error_in_archive = PK_ERR; + } else if (G.extra_bytes > 0) { + if ((G.ecrec.offset_start_central_directory == 0) && + (G.ecrec.size_central_directory != 0)) /* zip 1.5 -go bug */ + { + Info(slide, 0x401, ((char *)slide, + LoadFarString(NullCentDirOffset), G.zipfn)); + G.ecrec.offset_start_central_directory = G.extra_bytes; + G.extra_bytes = 0; + error_in_archive = PK_ERR; + } +#ifndef SFX + else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(ExtraBytesAtStart), G.zipfn, + (long)G.extra_bytes, (G.extra_bytes == 1)? "":"s")); + error_in_archive = PK_WARN; + } +#endif /* !SFX */ + } + + /*----------------------------------------------------------------------- + Check for empty zipfile and exit now if so. + -----------------------------------------------------------------------*/ + + if (G.expect_ecrec_offset==0L && G.ecrec.size_central_directory==0) { + if (uO.zipinfo_mode) + Info(slide, 0, ((char *)slide, "%sEmpty zipfile.\n", + uO.lflag>9? "\n " : "")); + else + Info(slide, 0x401, ((char *)slide, LoadFarString(ZipfileEmpty), + G.zipfn)); + CLOSE_INFILE(); + return (error_in_archive > PK_WARN)? error_in_archive : PK_WARN; + } + + /*----------------------------------------------------------------------- + Compensate for missing or extra bytes, and seek to where the start + of central directory should be. If header not found, uncompensate + and try again (necessary for at least some Atari archives created + with STZip, as well as archives created by J.H. Holm's ZIPSPLIT 1.1). + -----------------------------------------------------------------------*/ + + ZLSEEK( G.ecrec.offset_start_central_directory ) +#ifdef OLD_SEEK_TEST + if (readbuf(G.sig, 4) == 0) { + CLOSE_INFILE(); + return PK_ERR; /* file may be locked, or possibly disk error(?) */ + } + if (strncmp(G.sig, central_hdr_sig, 4)) +#else + if ((readbuf(__G__ G.sig, 4) == 0) || + strncmp(G.sig, central_hdr_sig, 4)) +#endif + { +#ifndef SFX + long tmp = G.extra_bytes; +#endif + + G.extra_bytes = 0; + ZLSEEK( G.ecrec.offset_start_central_directory ) + if ((readbuf(__G__ G.sig, 4) == 0) || + strncmp(G.sig, central_hdr_sig, 4)) + { + Info(slide, 0x401, ((char *)slide, + LoadFarString(CentDirStartNotFound), G.zipfn, + LoadFarStringSmall(ReportMsg))); + CLOSE_INFILE(); + return PK_BADERR; + } +#ifndef SFX + Info(slide, 0x401, ((char *)slide, LoadFarString(CentDirTooLong), + G.zipfn, -tmp)); +#endif + error_in_archive = PK_ERR; + } + + /*----------------------------------------------------------------------- + Seek to the start of the central directory one last time, since we + have just read the first entry's signature bytes; then list, extract + or test member files as instructed, and close the zipfile. + -----------------------------------------------------------------------*/ + + Trace((stderr, "about to extract/list files (error = %d)\n", + error_in_archive)); + + ZLSEEK( G.ecrec.offset_start_central_directory ) + +#ifdef DLL + /* G.fValidate is used only to look at an archive to see if + it appears to be a valid archive. There is no interest + in what the archive contains, nor in validating that the + entries in the archive are in good condition. This is + currently used only in the Windows DLLs for purposes of + checking archives within an archive to determine whether + or not to display the inner archives. + */ + if (!G.fValidate) +#endif + { +#ifndef NO_ZIPINFO + if (uO.zipinfo_mode) + error = zipinfo(__G); /* ZIPINFO 'EM */ + else +#endif +#ifndef SFX +#ifdef TIMESTAMP + if (uO.T_flag) + error = get_time_stamp(__G__ &uxstamp, &nmember); + else +#endif + if (uO.vflag && !uO.tflag && !uO.cflag) + error = list_files(__G); /* LIST 'EM */ + else +#endif /* !SFX */ + error = extract_or_test_files(__G); /* EXTRACT OR TEST 'EM */ + + Trace((stderr, "done with extract/list files (error = %d)\n", + error)); + } + + if (error > error_in_archive) /* don't overwrite stronger error */ + error_in_archive = error; /* with (for example) a warning */ +#ifndef SFX + } /* end if (!too_weird_to_continue) */ +#endif + + CLOSE_INFILE(); + +#ifdef TIMESTAMP + if (uO.T_flag && !uO.zipinfo_mode && (nmember > 0)) { +# ifdef WIN32 + if (stamp_file(__G__ G.zipfn, uxstamp)) { /* TIME-STAMP 'EM */ +# else + if (stamp_file(G.zipfn, uxstamp)) { /* TIME-STAMP 'EM */ +# endif + Info(slide, 0x201, ((char *)slide, + "warning: cannot set time for %s\n", G.zipfn)); + if (error_in_archive < PK_WARN) + error_in_archive = PK_WARN; + } + } +#endif + return error_in_archive; + +} /* end function do_seekable() */ + + + + + +/*************************/ +/* Function find_ecrec() */ +/*************************/ + +static int find_ecrec(__G__ searchlen) /* return PK-class error */ + __GDEF + long searchlen; +{ + int i, numblks, found=FALSE; + LONGINT tail_len; + ec_byte_rec byterec; + + +/*--------------------------------------------------------------------------- + Treat case of short zipfile separately. + ---------------------------------------------------------------------------*/ + + if (G.ziplen <= INBUFSIZ) { + lseek(G.zipfd, 0L, SEEK_SET); + if ((G.incnt = read(G.zipfd,(char *)G.inbuf,(unsigned int)G.ziplen)) + == (int)G.ziplen) + + /* 'P' must be at least 22 bytes from end of zipfile */ + for (G.inptr = G.inbuf+(int)G.ziplen-22; G.inptr >= G.inbuf; + --G.inptr) + if ((native(*G.inptr) == 'P') && + !strncmp((char *)G.inptr, end_central_sig, 4)) { + G.incnt -= (int)(G.inptr - G.inbuf); + found = TRUE; + break; + } + +/*--------------------------------------------------------------------------- + Zipfile is longer than INBUFSIZ: may need to loop. Start with short + block at end of zipfile (if not TOO short). + ---------------------------------------------------------------------------*/ + + } else { + if ((tail_len = G.ziplen % INBUFSIZ) > ECREC_SIZE) { +#ifdef USE_STRM_INPUT + fseek((FILE *)G.zipfd, G.ziplen-tail_len, SEEK_SET); + G.cur_zipfile_bufstart = ftell((FILE *)G.zipfd); +#else /* !USE_STRM_INPUT */ + G.cur_zipfile_bufstart = lseek(G.zipfd, G.ziplen-tail_len, + SEEK_SET); +#endif /* ?USE_STRM_INPUT */ + if ((G.incnt = read(G.zipfd, (char *)G.inbuf, + (unsigned int)tail_len)) != (int)tail_len) + goto fail; /* it's expedient... */ + + /* 'P' must be at least 22 bytes from end of zipfile */ + for (G.inptr = G.inbuf+(int)tail_len-22; G.inptr >= G.inbuf; + --G.inptr) + if ((native(*G.inptr) == 'P') && + !strncmp((char *)G.inptr, end_central_sig, 4)) { + G.incnt -= (int)(G.inptr - G.inbuf); + found = TRUE; + break; + } + /* sig may span block boundary: */ + strncpy((char *)G.hold, (char *)G.inbuf, 3); + } else + G.cur_zipfile_bufstart = G.ziplen - tail_len; + + /*----------------------------------------------------------------------- + Loop through blocks of zipfile data, starting at the end and going + toward the beginning. In general, need not check whole zipfile for + signature, but may want to do so if testing. + -----------------------------------------------------------------------*/ + + numblks = (int)((searchlen - tail_len + (INBUFSIZ-1)) / INBUFSIZ); + /* ==amount= ==done== ==rounding== =blksiz= */ + + for (i = 1; !found && (i <= numblks); ++i) { + G.cur_zipfile_bufstart -= INBUFSIZ; + lseek(G.zipfd, G.cur_zipfile_bufstart, SEEK_SET); + if ((G.incnt = read(G.zipfd,(char *)G.inbuf,INBUFSIZ)) + != INBUFSIZ) + break; /* fall through and fail */ + + for (G.inptr = G.inbuf+INBUFSIZ-1; G.inptr >= G.inbuf; + --G.inptr) + if ((native(*G.inptr) == 'P') && + !strncmp((char *)G.inptr, end_central_sig, 4)) { + G.incnt -= (int)(G.inptr - G.inbuf); + found = TRUE; + break; + } + /* sig may span block boundary: */ + strncpy((char *)G.hold, (char *)G.inbuf, 3); + } + } /* end if (ziplen > INBUFSIZ) */ + +/*--------------------------------------------------------------------------- + Searched through whole region where signature should be without finding + it. Print informational message and die a horrible death. + ---------------------------------------------------------------------------*/ + +fail: + if (!found) { + if (uO.qflag || uO.zipinfo_mode) + Info(slide, 0x401, ((char *)slide, "[%s]\n", G.zipfn)); + Info(slide, 0x401, ((char *)slide, + LoadFarString(CentDirEndSigNotFound))); + return PK_ERR; /* failed */ + } + +/*--------------------------------------------------------------------------- + Found the signature, so get the end-central data before returning. Do + any necessary machine-type conversions (byte ordering, structure padding + compensation) by reading data into character array and copying to struct. + ---------------------------------------------------------------------------*/ + + G.real_ecrec_offset = G.cur_zipfile_bufstart + (G.inptr-G.inbuf); +#ifdef TEST + pipeit("\n found end-of-central-dir signature at offset %ld (%.8lXh)\n", + G.real_ecrec_offset, G.real_ecrec_offset); + pipeit(" from beginning of file; offset %d (%.4Xh) within block\n", + G.inptr-G.inbuf, G.inptr-G.inbuf); +#endif + + if (readbuf(__G__ (char *)byterec, ECREC_SIZE+4) == 0) + return PK_EOF; + + G.ecrec.number_this_disk = + makeword(&byterec[NUMBER_THIS_DISK]); + G.ecrec.num_disk_start_cdir = + makeword(&byterec[NUM_DISK_WITH_START_CENTRAL_DIR]); + G.ecrec.num_entries_centrl_dir_ths_disk = + makeword(&byterec[NUM_ENTRIES_CENTRL_DIR_THS_DISK]); + G.ecrec.total_entries_central_dir = + makeword(&byterec[TOTAL_ENTRIES_CENTRAL_DIR]); + G.ecrec.size_central_directory = + makelong(&byterec[SIZE_CENTRAL_DIRECTORY]); + G.ecrec.offset_start_central_directory = + makelong(&byterec[OFFSET_START_CENTRAL_DIRECTORY]); + G.ecrec.zipfile_comment_length = + makeword(&byterec[ZIPFILE_COMMENT_LENGTH]); + + G.expect_ecrec_offset = G.ecrec.offset_start_central_directory + + G.ecrec.size_central_directory; + return PK_COOL; + +} /* end function find_ecrec() */ + + + + + +/*****************************/ +/* Function uz_end_central() */ +/*****************************/ + +int uz_end_central(__G) /* return PK-type error code */ + __GDEF +{ + int error = PK_COOL; + + +/*--------------------------------------------------------------------------- + Get the zipfile comment (up to 64KB long), if any, and print it out. + Then position the file pointer to the beginning of the central directory + and fill buffer. + ---------------------------------------------------------------------------*/ + +#ifdef WINDLL + /* for comment button: */ + if ((!G.fValidate) && (G.lpUserFunctions != NULL)) + G.lpUserFunctions->cchComment = G.ecrec.zipfile_comment_length; + if (G.ecrec.zipfile_comment_length && (uO.zflag > 0)) +#else /* !WINDLL */ + if (G.ecrec.zipfile_comment_length && (uO.zflag > 0 || + (uO.zflag == 0 && +#ifdef TIMESTAMP + !uO.T_flag && +#endif + !uO.qflag))) +#endif /* ?WINDLL */ + { + if (do_string(__G__ G.ecrec.zipfile_comment_length, DISPLAY)) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(ZipfileCommTrunc1))); + error = PK_WARN; + } + } + return error; + +} /* end function uz_end_central() */ + + + + + +/************************************/ +/* Function process_cdir_file_hdr() */ +/************************************/ + +int process_cdir_file_hdr(__G) /* return PK-type error code */ + __GDEF +{ + int error; + + +/*--------------------------------------------------------------------------- + Get central directory info, save host and method numbers, and set flag + for lowercase conversion of filename, depending on the OS from which the + file is coming. + ---------------------------------------------------------------------------*/ + + if ((error = get_cdir_ent(__G)) != 0) + return error; + + G.pInfo->hostnum = MIN(G.crec.version_made_by[1], NUM_HOSTS); +/* extnum = MIN(crec.version_needed_to_extract[1], NUM_HOSTS); */ + + G.pInfo->lcflag = 0; + if (uO.L_flag) /* user specified case-conversion */ + switch (G.pInfo->hostnum) { + case FS_FAT_: /* PKZIP and zip -k store in uppercase */ + case CPM_: /* like MS-DOS, right? */ + case VM_CMS_: /* all caps? */ + case MVS_: /* all caps? */ + case TANDEM_: + case TOPS20_: + case VMS_: /* our Zip uses lowercase, but ASi's doesn't */ + /* case Z_SYSTEM_: ? */ + /* case QDOS_: ? */ + G.pInfo->lcflag = 1; /* convert filename to lowercase */ + break; + + default: /* AMIGA_, FS_HPFS_, FS_NTFS_, MAC_, UNIX_, ATARI_, */ + break; /* FS_VFAT_, BEOS_ (Z_SYSTEM_): no conversion */ + } + + /* do Amigas (AMIGA_) also have volume labels? */ + if (IS_VOLID(G.crec.external_file_attributes) && + (G.pInfo->hostnum == FS_FAT_ || G.pInfo->hostnum == FS_HPFS_ || + G.pInfo->hostnum == FS_NTFS_ || G.pInfo->hostnum == ATARI_)) + { + G.pInfo->vollabel = TRUE; + G.pInfo->lcflag = 0; /* preserve case of volume labels */ + } else + G.pInfo->vollabel = FALSE; + + return PK_COOL; + +} /* end function process_cdir_file_hdr() */ + + + + + +/***************************/ +/* Function get_cdir_ent() */ +/***************************/ + +int get_cdir_ent(__G) /* return PK-type error code */ + __GDEF +{ + cdir_byte_hdr byterec; + + +/*--------------------------------------------------------------------------- + Read the next central directory entry and do any necessary machine-type + conversions (byte ordering, structure padding compensation--do so by + copying the data from the array into which it was read (byterec) to the + usable struct (crec)). + ---------------------------------------------------------------------------*/ + + if (readbuf(__G__ (char *)byterec, CREC_SIZE) == 0) + return PK_EOF; + + G.crec.version_made_by[0] = byterec[C_VERSION_MADE_BY_0]; + G.crec.version_made_by[1] = byterec[C_VERSION_MADE_BY_1]; + G.crec.version_needed_to_extract[0] = + byterec[C_VERSION_NEEDED_TO_EXTRACT_0]; + G.crec.version_needed_to_extract[1] = + byterec[C_VERSION_NEEDED_TO_EXTRACT_1]; + + G.crec.general_purpose_bit_flag = + makeword(&byterec[C_GENERAL_PURPOSE_BIT_FLAG]); + G.crec.compression_method = + makeword(&byterec[C_COMPRESSION_METHOD]); + G.crec.last_mod_dos_datetime = + makelong(&byterec[C_LAST_MOD_DOS_DATETIME]); + G.crec.crc32 = + makelong(&byterec[C_CRC32]); + G.crec.csize = + makelong(&byterec[C_COMPRESSED_SIZE]); + G.crec.ucsize = + makelong(&byterec[C_UNCOMPRESSED_SIZE]); + G.crec.filename_length = + makeword(&byterec[C_FILENAME_LENGTH]); + G.crec.extra_field_length = + makeword(&byterec[C_EXTRA_FIELD_LENGTH]); + G.crec.file_comment_length = + makeword(&byterec[C_FILE_COMMENT_LENGTH]); + G.crec.disk_number_start = + makeword(&byterec[C_DISK_NUMBER_START]); + G.crec.internal_file_attributes = + makeword(&byterec[C_INTERNAL_FILE_ATTRIBUTES]); + G.crec.external_file_attributes = + makelong(&byterec[C_EXTERNAL_FILE_ATTRIBUTES]); /* LONG, not word! */ + G.crec.relative_offset_local_header = + makelong(&byterec[C_RELATIVE_OFFSET_LOCAL_HEADER]); + + return PK_COOL; + +} /* end function get_cdir_ent() */ + + + + + +/*************************************/ +/* Function process_local_file_hdr() */ +/*************************************/ + +int process_local_file_hdr(__G) /* return PK-type error code */ + __GDEF +{ + local_byte_hdr byterec; + + +/*--------------------------------------------------------------------------- + Read the next local file header and do any necessary machine-type con- + versions (byte ordering, structure padding compensation--do so by copy- + ing the data from the array into which it was read (byterec) to the + usable struct (lrec)). + ---------------------------------------------------------------------------*/ + + if (readbuf(__G__ (char *)byterec, LREC_SIZE) == 0) + return PK_EOF; + + G.lrec.version_needed_to_extract[0] = + byterec[L_VERSION_NEEDED_TO_EXTRACT_0]; + G.lrec.version_needed_to_extract[1] = + byterec[L_VERSION_NEEDED_TO_EXTRACT_1]; + + G.lrec.general_purpose_bit_flag = + makeword(&byterec[L_GENERAL_PURPOSE_BIT_FLAG]); + G.lrec.compression_method = makeword(&byterec[L_COMPRESSION_METHOD]); + G.lrec.last_mod_dos_datetime = makelong(&byterec[L_LAST_MOD_DOS_DATETIME]); + G.lrec.crc32 = makelong(&byterec[L_CRC32]); + G.lrec.csize = makelong(&byterec[L_COMPRESSED_SIZE]); + G.lrec.ucsize = makelong(&byterec[L_UNCOMPRESSED_SIZE]); + G.lrec.filename_length = makeword(&byterec[L_FILENAME_LENGTH]); + G.lrec.extra_field_length = makeword(&byterec[L_EXTRA_FIELD_LENGTH]); + + G.csize = (long) G.lrec.csize; + G.ucsize = (long) G.lrec.ucsize; + + if ((G.lrec.general_purpose_bit_flag & 8) != 0) { + /* can't trust local header, use central directory: */ + G.lrec.crc32 = G.pInfo->crc; + G.csize = (long)(G.lrec.csize = G.pInfo->compr_size); + G.ucsize = (long)(G.lrec.ucsize = G.pInfo->uncompr_size); + } + + return PK_COOL; + +} /* end function process_local_file_hdr() */ + + +#ifdef USE_EF_UT_TIME + +/*******************************/ +/* Function ef_scan_for_izux() */ +/*******************************/ + +unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime, + z_utim, z_uidgid) + uch *ef_buf; /* buffer containing extra field */ + unsigned ef_len; /* total length of extra field */ + int ef_is_c; /* flag indicating "is central extra field" */ + ulg dos_mdatetime; /* last_mod_file_date_time in DOS format */ + iztimes *z_utim; /* return storage: atime, mtime, ctime */ + ush *z_uidgid; /* return storage: uid and gid */ +{ + unsigned flags = 0; + unsigned eb_id; + unsigned eb_len; + int have_new_type_eb = FALSE; + int ut_zip_unzip_compatible = FALSE; + +/*--------------------------------------------------------------------------- + This function scans the extra field for EF_TIME, EF_IZUNIX2, EF_IZUNIX, or + EF_PKUNIX blocks containing Unix-style time_t (GMT) values for the entry's + access, creation, and modification time. + If a valid block is found, the time stamps are copied to the iztimes + structure (provided the z_utim pointer is not NULL). + If a IZUNIX2 block is found or the IZUNIX block contains UID/GID fields, + and the z_uidgid array pointer is valid (!= NULL), the owner info is + transfered as well. + The presence of an EF_TIME or EF_IZUNIX2 block results in ignoring all + data from probably present obsolete EF_IZUNIX blocks. + If multiple blocks of the same type are found, only the information from + the last block is used. + The return value is a combination of the EF_TIME Flags field with an + additional flag bit indicating the presence of valid UID/GID info, + or 0 in case of failure. + ---------------------------------------------------------------------------*/ + + if (ef_len == 0 || ef_buf == NULL || (z_utim == 0 && z_uidgid == NULL)) + return 0; + + TTrace((stderr,"\nef_scan_for_izux: scanning extra field of length %u\n", + ef_len)); + + while (ef_len >= EB_HEADSIZE) { + eb_id = makeword(EB_ID + ef_buf); + eb_len = makeword(EB_LEN + ef_buf); + + if (eb_len > (ef_len - EB_HEADSIZE)) { + /* discovered some extra field inconsistency! */ + TTrace((stderr, + "ef_scan_for_izux: block length %u > rest ef_size %u\n", eb_len, + ef_len - EB_HEADSIZE)); + break; + } + + switch (eb_id) { + case EF_TIME: + flags &= ~0x0ff; /* ignore previous IZUNIX or EF_TIME fields */ + have_new_type_eb = TRUE; + if ( eb_len >= EB_UT_MINLEN && z_utim != NULL) { + unsigned eb_idx = EB_UT_TIME1; + TTrace((stderr,"ef_scan_for_izux: found TIME extra field\n")); + flags |= (ef_buf[EB_HEADSIZE+EB_UT_FLAGS] & 0x0ff); + if ((flags & EB_UT_FL_MTIME)) { + if ((eb_idx+4) <= eb_len) { + z_utim->mtime = makelong((EB_HEADSIZE+eb_idx) + ef_buf); + eb_idx += 4; + TTrace((stderr," UT e.f. modification time = %ld\n", + z_utim->mtime)); + + if ((ulg)(z_utim->mtime) & (ulg)(0x80000000L)) { + ut_zip_unzip_compatible = + ((time_t)0x80000000L < (time_t)0L) + ? (dos_mdatetime == DOSTIME_MINIMUM) + : (dos_mdatetime >= DOSTIME_2038_01_18); + if (!ut_zip_unzip_compatible) { + /* UnZip interpretes mtime differently than Zip; + without modtime: ignore complete UT field */ + flags &= ~0x0ff; /* no time_t times available */ + TTrace((stderr, + " UT modtime range error; ignore e.f.!\n")); + break; /* stop scanning this field */ + } + } else { + /* cannot determine, safe assumption is FALSE */ + ut_zip_unzip_compatible = FALSE; + } + } else { + flags &= ~EB_UT_FL_MTIME; + TTrace((stderr," UT e.f. truncated; no modtime\n")); + } + } + if (ef_is_c) { + break; /* central version of TIME field ends here */ + } + + if (flags & EB_UT_FL_ATIME) { + if ((eb_idx+4) <= eb_len) { + z_utim->atime = makelong((EB_HEADSIZE+eb_idx) + ef_buf); + eb_idx += 4; + TTrace((stderr," UT e.f. access time = %ld\n", + z_utim->atime)); + if (((ulg)(z_utim->atime) & (ulg)(0x80000000L)) && + !ut_zip_unzip_compatible) { + flags &= ~EB_UT_FL_ATIME; + TTrace((stderr, + " UT access time range error: skip time!\n")); + } + } else { + flags &= ~EB_UT_FL_ATIME; + } + } + if (flags & EB_UT_FL_CTIME) { + if ((eb_idx+4) <= eb_len) { + z_utim->ctime = makelong((EB_HEADSIZE+eb_idx) + ef_buf); + TTrace((stderr," UT e.f. creation time = %ld\n", + z_utim->ctime)); + if (((ulg)(z_utim->ctime) & (ulg)(0x80000000L)) && + !ut_zip_unzip_compatible) { + flags &= ~EB_UT_FL_CTIME; + TTrace((stderr, + " UT creation time range error: skip time!\n")); + } + } else { + flags &= ~EB_UT_FL_CTIME; + } + } + } + break; + + case EF_IZUNIX2: + if (!have_new_type_eb) { + flags &= ~0x0ff; /* ignore any previous IZUNIX field */ + have_new_type_eb = TRUE; + } + if (eb_len >= EB_UX2_MINLEN && z_uidgid != NULL) { + z_uidgid[0] = makeword((EB_HEADSIZE+EB_UX2_UID) + ef_buf); + z_uidgid[1] = makeword((EB_HEADSIZE+EB_UX2_GID) + ef_buf); + flags |= EB_UX2_VALID; /* signal success */ + } + break; + + case EF_IZUNIX: + case EF_PKUNIX: /* PKUNIX e.f. layout is identical to IZUNIX */ + if (eb_len >= EB_UX_MINLEN) { + TTrace((stderr,"ef_scan_for_izux: found %s extra field\n", + (eb_id == EF_IZUNIX ? "IZUNIX" : "PKUNIX"))); + if (have_new_type_eb) { + break; /* Ignore IZUNIX extra field block ! */ + } + if (z_utim != NULL) { + z_utim->atime = makelong((EB_HEADSIZE+EB_UX_ATIME)+ef_buf); + z_utim->mtime = makelong((EB_HEADSIZE+EB_UX_MTIME)+ef_buf); + TTrace((stderr," Unix EF actime = %ld\n", z_utim->atime)); + TTrace((stderr," Unix EF modtime = %ld\n", z_utim->mtime)); + flags |= (EB_UT_FL_MTIME | EB_UT_FL_ATIME); + if ((ulg)(z_utim->mtime) & (ulg)(0x80000000L)) { + ut_zip_unzip_compatible = + ((time_t)0x80000000L < (time_t)0L) + ? (dos_mdatetime == DOSTIME_MINIMUM) + : (dos_mdatetime >= DOSTIME_2038_01_18); + if (!ut_zip_unzip_compatible) { + /* UnZip interpretes mtime differently than Zip; + without modtime: ignore complete UT field */ + flags &= ~0x0ff; /* no time_t times available */ + TTrace((stderr, + " UX modtime range error: ignore e.f.!\n")); + } + } else { + /* cannot determine, safe assumption is FALSE */ + ut_zip_unzip_compatible = FALSE; + } + if ((ulg)(z_utim->atime) & (ulg)(0x80000000L) && + !ut_zip_unzip_compatible && (flags & 0x0ff)) { + /* atime not in range of UnZip's time_t */ + flags &= ~EB_UT_FL_ATIME; + TTrace((stderr, + " UX access time range error: skip time!\n")); + } + } + if (eb_len >= EB_UX_FULLSIZE && z_uidgid != NULL) { + z_uidgid[0] = makeword((EB_HEADSIZE+EB_UX_UID) + ef_buf); + z_uidgid[1] = makeword((EB_HEADSIZE+EB_UX_GID) + ef_buf); + flags |= EB_UX2_VALID; + } + } + break; + + default: + break; + } + + /* Skip this extra field block */ + ef_buf += (eb_len + EB_HEADSIZE); + ef_len -= (eb_len + EB_HEADSIZE); + } + + return flags; +} + +#endif /* USE_EF_UT_TIME */ diff --git a/utils/Install/packzip/rexxapi.c b/utils/Install/packzip/rexxapi.c new file mode 100644 index 0000000000..43b4ddde3e --- /dev/null +++ b/utils/Install/packzip/rexxapi.c @@ -0,0 +1,886 @@ +/********************************************************************** +* REXXAPI.C * +* * +* This program adds a ZIP engine directly to the REXX language. * +* The functions are: * +* UZDropFuncs -- Makes all functions in this package * +* unknown to REXX. * +* UZLoadFuncs -- Makes all functions in this package * +* known to REXX so REXX programs may * +* call them. * +* UZFileTree -- Searches for files matching a given * +* filespec, including files in * +* subdirectories. * +* UZUnZip -- Unzip command-line entry point. * +* This is functionally equivalent to * +* using Unzip as an external program. * +* UZUnZipToVar -- Unzip one file to a variable * +* UZUnZipToStem -- Unzip files to a variable array * +* UZVer -- Returns the Unzip version number * +* * +**********************************************************************/ +/* Include files */ + +#ifdef OS2DLL + +#define INCL_DOS +#define INCL_DOSMEMMGR +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> + +#define UNZIP_INTERNAL +#include "../unzip.h" +#include "../version.h" + + +/*********************************************************************/ +/* Various definitions used by various functions. */ +/*********************************************************************/ + +RexxFunctionHandler UZDropFuncs; +RexxFunctionHandler UZLoadFuncs; +RexxFunctionHandler UZFileTree; +RexxFunctionHandler UZUnZip; +RexxFunctionHandler UZUnZipToVar; +RexxFunctionHandler UZUnZipToStem; +RexxFunctionHandler UZVer; +RexxFunctionHandler UZAPIVer; + + +int SetOutputVar(__GPRO__ const char *name); +int SetOutputVarStem(__GPRO__ const char *name); +int SetOutputVarLength(__GPRO); +int WriteToVariable(__GPRO__ const char *name, char *buffer, int len); +int PrintToSubVariable(__GPRO__ int idx, const char *format,...); +int PrintToVariable(__GPRO__ const char *name, const char *format,...); +int _PrintToVariable(__GPRO__ const char *name, const char *format, va_list arg_ptr); +int TextSetNext(__GPRO__ char *format, int len, int all); + +#define EZRXSTRING(r,p) {(r).strptr=(PCH)p;(r).strlength=(ULONG)strlen((r).strptr);} + + +/*********************************************************************/ +/* RxFncTable */ +/* Array of names of the UNZIPAPI functions. */ +/* This list is used for registration and deregistration. */ +/*********************************************************************/ + +static PSZ RxFncTable[] = + { + "UZDropFuncs", + "UZLoadFuncs", + "UZFileSearch", + "UZFileTree", + "UZUnZip", + "UZUnZipToVar", + "UZUnZipToStem", + "UZVer", + }; + +/*********************************************************************/ +/* Numeric Error Return Strings */ +/*********************************************************************/ + +#define NO_UTIL_ERROR "0" /* No error whatsoever */ +#define ERROR_NOMEM "2" /* Insufficient memory */ + +/*********************************************************************/ +/* Numeric Return calls */ +/*********************************************************************/ + +#define INVALID_ROUTINE 40 /* Raise Rexx error */ +#define VALID_ROUTINE 0 /* Successful completion */ + +/*********************************************************************/ +/* Some useful macros */ +/*********************************************************************/ + +#define BUILDRXSTRING(t, s) { \ + strcpy((t)->strptr,(s));\ + (t)->strlength = strlen((s)); \ +} + + +/*********************************************************************/ +/**************** UNZIPAPI Supporting Functions ********************/ +/**************** UNZIPAPI Supporting Functions ********************/ +/**************** UNZIPAPI Supporting Functions ********************/ +/*********************************************************************/ + + +int RexxReturn(__GPRO__ int nodefault, RXSTRING *retstr) +{ + int ret = G.os2.rexx_error; + if (G.filenotfound) + G.os2.rexx_mes = "file not found"; + if (*G.os2.rexx_mes != '0') { + if (retstr->strlength > 255) { + DosFreeMem(retstr->strptr); + retstr->strptr = NULL; + } + } else if (nodefault) + goto noBuild; + BUILDRXSTRING(retstr, G.os2.rexx_mes); + noBuild: + DESTROYGLOBALS(); + return ret; +} + +/* Get a variable from REXX, return 0 if OK */ +int GetVariable(__GPRO__ const char *name) +{ + G.os2.request.shvnext = NULL; + EZRXSTRING(G.os2.request.shvname, name); + G.os2.request.shvnamelen = G.os2.request.shvname.strlength; + G.os2.request.shvvalue.strptr = G.os2.buffer; + G.os2.request.shvvalue.strlength = IBUF_LEN; + G.os2.request.shvvaluelen = IBUF_LEN; + G.os2.request.shvcode = RXSHV_SYFET; + G.os2.request.shvret = 0; + switch (RexxVariablePool(&G.os2.request)) { + case RXSHV_MEMFL: + G.os2.rexx_mes = ERROR_NOMEM; + break; + case RXSHV_BADN: + case RXSHV_NEWV: + G.os2.request.shvvaluelen = 0; + case RXSHV_OK: + *(G.os2.buffer+G.os2.request.shvvaluelen) = 0; + return G.os2.request.shvvaluelen; + } + return 0; +} + + +/* Get REXX compound variable */ +/* Stem must exist in G.os2.getvar_buf w/ length in G.os2.getvar_len */ +int GetVariableIndex(__GPRO__ int index) +{ + sprintf(G.os2.getvar_buf+G.os2.getvar_len,"%d",index); + return GetVariable(__G__ G.os2.getvar_buf); +} + + +/* Transfer REXX array to standard C string array */ +/* Returns number of elements */ +/* User is responsible for calling KillStringArray */ + +int CompoundToStringArray(__GPRO__ char ***pointer, const char *name) +{ + int count; + int total; + char **trav; + + G.os2.getvar_len = strlen(name); + memcpy(G.os2.getvar_buf,name,G.os2.getvar_len+1); + if (*(G.os2.getvar_buf+G.os2.getvar_len-1) != '.') + *(G.os2.getvar_buf+G.os2.getvar_len++) = '.', *(G.os2.getvar_buf+G.os2.getvar_len) = 0; + + if (GetVariableIndex(__G__ 0)) + return 0; + + total = atoi(G.os2.buffer); + *pointer = (char **)malloc((total+1)<<2); + trav = *pointer; + for (count = 1; count <= total; count++) { + GetVariableIndex(__G__ count); + trav[count-1] = (char *)malloc(strlen(G.os2.buffer)+1); + strcpy(trav[count-1],G.os2.buffer); + } + trav[count-1] = NULL; + return total; +} + + +/* Kill string array created by CompoundToStringArray */ + +void KillStringArray(char **pointer) +{ + char **trav=pointer; + while (*trav != NULL) { + free(*trav); + trav++; + } + free(pointer); +} + + +/************************************************************************* +* Function: UZDropFuncs * +* * +* Syntax: call UZDropFuncs * +* * +* Return: NO_UTIL_ERROR - Successful. * +*************************************************************************/ + +ULONG UZDropFuncs(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + INT entries; /* Num of entries */ + INT j; /* Counter */ + + if (numargs != 0) /* no arguments for this */ + return INVALID_ROUTINE; /* raise an error */ + + retstr->strlength = 0; /* return a null string result*/ + + entries = sizeof(RxFncTable)/sizeof(PSZ); + + for (j = 0; j < entries; j++) + RexxDeregisterFunction(RxFncTable[j]); + + return VALID_ROUTINE; /* no error on call */ +} + + +/************************************************************************* +* Function: UZFileTree * +* * +* Syntax: call UZFileTree zipfile, stem[, include-filespec] * +* [, exclude-filespec][, options] * +* * +* Params: zipfile - Name of zip file to search. * +* stem - Name of stem var to store results in. * +* include - Filespec to search for (may include * and ?). * +* exclude - Filespec to exclude (may include * and ?). * +* options - Either of the following: * +* 'F' - Give file statistics. * +* Length Date Time Name * +* 'Z' - Give zip statistics, too. * +* Length Method Size Ratio Date Time CRC-32 Name* +* Default is to return only filenames * +* * +* Return: NO_UTIL_ERROR - Successful. * +* ERROR_NOMEM - Out of memory. * +*************************************************************************/ + +ULONG UZFileTree(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + /* validate arguments */ + char *incname[2]; + char *excname[2]; + CONSTRUCTGLOBALS(); + + if (numargs < 2 || numargs > 5 || + !RXVALIDSTRING(args[0]) || + !RXVALIDSTRING(args[1]) || + args[0].strlength > 255) { + DESTROYGLOBALS(); + return INVALID_ROUTINE; /* Invalid call to routine */ + } + /* initialize data area */ + SetOutputVarStem(__G__ args[1].strptr); + G.wildzipfn = args[0].strptr; + G.process_all_files = TRUE; + + uO.lflag = 1; + uO.zipinfo_mode = TRUE; + uO.C_flag = 1; + G.extract_flag = FALSE; + uO.qflag = 2; + + if (numargs >= 3 && /* check third option */ + !RXNULLSTRING(args[2]) && + args[2].strlength > 0) { /* a zero length string isn't */ + if (!(G.filespecs = CompoundToStringArray(__G__ &G.pfnames,args[2].strptr))) { + G.pfnames = incname; + incname[0] = args[2].strptr; + incname[1] = NULL; + G.filespecs = 1; + } + G.process_all_files = FALSE; + } + + if (numargs >= 4 && /* check third option */ + !RXNULLSTRING(args[3]) && + args[3].strlength > 0) { /* a zero length string isn't */ + if (!(G.xfilespecs = CompoundToStringArray(__G__ &G.pxnames,args[3].strptr))) { + G.pxnames = excname; + excname[0] = args[3].strptr; + excname[1] = NULL; + G.xfilespecs = 1; + } + G.process_all_files = FALSE; + } + + if (numargs == 5 && /* check third option */ + !RXNULLSTRING(args[4]) && + args[4].strlength > 0) { /* a zero length string isn't */ + int first = *args[4].strptr & 0x5f; + + if (first == 'Z') + uO.vflag = 2, uO.lflag = 0, uO.zipinfo_mode = FALSE; + else if (first == 'F') + uO.vflag = 1, uO.lflag = 0, uO.zipinfo_mode = FALSE; + } + + process_zipfiles(__G); + SetOutputVarLength(__G); + if (G.filespecs > 0 && G.pfnames != incname) + KillStringArray(G.pfnames); + if (G.xfilespecs > 0 && G.pxnames != excname) + KillStringArray(G.pxnames); + return RexxReturn(__G__ 0,retstr); /* no error on call */ +} + + +/************************************************************************* +* Function: UZUnZipToVar * +* * +* Syntax: call UZUnZipToVar zipfile, filespec [, stem] * +* * +* Params: zipfile - Name of zip file to search. * +* filespec - File to extract * +* stem - If you specify a stem variable, the file will be * +* extracted to the variable, one line per index * +* In this case, 0 will be returned * +* * +* Return: Extracted file * +* ERROR_NOMEM - Out of memory. * +*************************************************************************/ + +ULONG UZUnZipToVar(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + CONSTRUCTGLOBALS(); + UzpBuffer *ub = (UzpBuffer *)retstr; + /* validate arguments */ + if (numargs < 2 || numargs > 3 || + !RXVALIDSTRING(args[0]) || + !RXVALIDSTRING(args[1]) || + args[0].strlength == 0 || + args[1].strlength == 0) { + DESTROYGLOBALS(); + return INVALID_ROUTINE; /* Invalid call to routine */ + } + + uO.C_flag = 1; + G.redirect_data=1; + if (numargs == 3) { + if (!RXVALIDSTRING(args[2]) || + RXNULLSTRING(args[1]) || + args[2].strlength == 0) { + DESTROYGLOBALS(); + return INVALID_ROUTINE; /* Invalid call to routine */ + } + SetOutputVarStem(__G__ args[2].strptr); + G.redirect_text = 0; + G.redirect_data++; + } + unzipToMemory(__G__ args[0].strptr, args[1].strptr, + G.redirect_data==1 ? ub : NULL); + return RexxReturn(__G__ G.redirect_data==1,retstr); +} + + +/************************************************************************* +* Function: UZUnZipToStem * +* * +* Syntax: call UZUnZipToStem zipfile, stem[, include-filespec] * +* [, exclude-filespec][, mode] * +* * +* Params: zipfile - Name of zip file to search. * +* stem - Name of stem var to store files in. * +* include - Filespec to search for (may include * and ?). * +* exclude - Filespec to exclude (may include * and ?). * +* mode - Specifies 'F'lat or 'T'ree mode. Umm, this is * +* hard to explain so I'll give an example, too. * +* Assuming a file unzip.zip containing: * +* unzip.c * +* unshrink.c * +* extract.c * +* os2/makefile.os2 * +* os2/os2.c * +* os2/dll/dll.def * +* os2/dll/unzipapi.c * +* * +* -- In flat mode, each file is stored in * +* stem.fullname i.e. stem."os2/dll/unzipapi.c" * +* A list of files is created in stem.<index> * +* * +* Flat mode returns: * +* stem.0 = 7 * +* stem.1 = unzip.c * +* stem.2 = unshrink.c * +* stem.3 = extract.c * +* stem.4 = os2/makefile.os2 * +* stem.5 = os2/os2.c * +* stem.6 = os2/dll/dll.def * +* stem.7 = os2/dll/unzipapi.c * +* * +* And the following contain the contents of the * +* various programs: * +* stem.unzip.c * +* stem.unshrink.c * +* stem.extract.c * +* stem.os2/makefile.os2 * +* stem.os2/os2.c * +* stem.os2/dll/dll.def * +* stem.os2/dll/unzipapi.c * +* * +* -- In tree mode, slashes are converted to periods* +* in the pathname thus the above file would have* +* been stored in stem.os2.dll.unzipapi.c * +* The index would then be stored in stem.OS2. * +* DLL.<index>. * +* * +* NOTE: All path names are converted to uppercase * +* * +* Tree mode returns: * +* stem.0 = 4 * +* stem.1 = unzip.c * +* stem.2 = unshrink.c * +* stem.3 = extract.c * +* stem.4 = OS2/ * +* * +* stem.OS2.0 = 3 * +* stem.OS2.1 = makefile.os2 * +* stem.OS2.2 = os2.c * +* stem.OS2.3 = DLL/ * +* * +* stem.OS2.DLL.0 = 2 * +* stem.OS2.DLL.1 = def * +* stem.OS2.DLL.2 = unzipapi.c * +* * +* And the following contain the contents of the * +* various programs: * +* stem.unzip.c * +* stem.unshrink.c * +* stem.extract.c * +* stem.OS2.makefile.os2 * +* stem.OS2.os2.c * +* stem.OS2.DLL.dll.def * +* stem.OS2.DLL.unzipapi.c * +* * +* * +* Return: NO_UTIL_ERROR - Successful. * +* ERROR_NOMEM - Out of memory. * +*************************************************************************/ + +ULONG UZUnZipToStem(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + char *incname[2]; + char *excname[2]; + CONSTRUCTGLOBALS(); + /* validate arguments */ + if (numargs < 2 || numargs > 5 || + !RXVALIDSTRING(args[0]) || + !RXVALIDSTRING(args[1]) || + args[0].strlength > 255) { + DESTROYGLOBALS(); + return INVALID_ROUTINE; /* Invalid call to routine */ + } + /* initialize data area */ + G.wildzipfn = args[0].strptr; + G.process_all_files = TRUE; + + uO.C_flag = 1; + G.extract_flag = TRUE; + SetOutputVarStem(__G__ args[1].strptr); + G.redirect_data = 3; + G.redirect_text = 0; + + if (numargs >= 3 && /* check third option */ + !RXNULLSTRING(args[2]) && + args[2].strlength > 0) { /* a zero length string isn't */ + if (!(G.filespecs = CompoundToStringArray(__G__ &G.pfnames,args[2].strptr))) { + G.pfnames = incname; + incname[0] = args[2].strptr; + incname[1] = NULL; + G.filespecs = 1; + } + G.process_all_files = FALSE; + } + + if (numargs >= 4 && /* check third option */ + !RXNULLSTRING(args[3]) && + args[3].strlength > 0) { /* a zero length string isn't */ + if (!(G.xfilespecs = CompoundToStringArray(__G__ &G.pxnames,args[3].strptr))) { + G.pxnames = excname; + excname[0] = args[3].strptr; + excname[1] = NULL; + G.xfilespecs = 1; + } + G.process_all_files = FALSE; + } + + if (numargs == 5 && /* check third option */ + !RXNULLSTRING(args[4]) && + (*args[4].strptr & 0x5f) == 'T') { + G.redirect_data++; + G.os2.request.shvnext = NULL; + EZRXSTRING(G.os2.request.shvname, args[4].strptr); + G.os2.request.shvnamelen = G.os2.request.shvname.strlength; + G.os2.request.shvcode = RXSHV_SYDRO; + G.os2.request.shvret = 0; + RexxVariablePool(&G.os2.request); + } + + + uO.qflag = 2; + + process_zipfiles(__G); + if (G.filespecs > 0 && G.pfnames != incname) + KillStringArray(G.pfnames); + if (G.xfilespecs > 0 && G.pxnames != excname) + KillStringArray(G.pxnames); + if (G.redirect_data == 3) + SetOutputVarLength(__G); + return RexxReturn(__G__ 0,retstr); /* no error on call */ +} + + +/************************************************************************* +* Function: UZLoadFuncs * +* * +* Syntax: call UZLoadFuncs [option] * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +ULONG UZLoadFuncs(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + INT entries; /* Num of entries */ + INT j; /* Counter */ + + retstr->strlength = 0; /* set return value */ + /* check arguments */ + if (numargs > 0) + return INVALID_ROUTINE; + + entries = sizeof(RxFncTable)/sizeof(PSZ); + + for (j = 0; j < entries; j++) { + RexxRegisterFunctionDll(RxFncTable[j], + "UNZIP32", RxFncTable[j]); + } + return VALID_ROUTINE; +} + + + +/************************************************************************* +* Function: UZVer * +* * +* Syntax: call UZVer * +* * +* Return: Version of Unzip * +*************************************************************************/ + +ULONG UZVer(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + if (numargs > 1) /* validate arg count */ + return INVALID_ROUTINE; + + if (numargs == 0 || (*args[0].strptr & 0x5f) != 'L') + /* strcpy( retstr->strptr, UZ_VERNUM ); "5.13a BETA" */ + sprintf( retstr->strptr, "%d.%d%d%s", UZ_MAJORVER, UZ_MINORVER, + PATCHLEVEL, BETALEVEL ); + else + /* strcpy( retstr->strptr, UZ_VERSION ); UZ_VERNUM" of 26 Sep 94" */ + sprintf( retstr->strptr, "%d.%d%d%s of %s", UZ_MAJORVER, UZ_MINORVER, + PATCHLEVEL, BETALEVEL, VERSION_DATE ); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; +} + + +/************************************************************************* +* Function: UZUnZip * +* * +* Syntax: call UZUnZip * +* * +* Return: Unzip return code * +*************************************************************************/ + +ULONG UZUnZip(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + char *argv[30]; + char *scan; + int argc=0; + int idx; + CONSTRUCTGLOBALS(); + + if (numargs < 1 || numargs > 2 || + args[0].strlength > 255) { + DESTROYGLOBALS(); + return INVALID_ROUTINE; /* Invalid call to routine */ + } + /* initialize data area */ + if (numargs == 2) + SetOutputVarStem(__G__ args[1].strptr); + + scan = args[0].strptr; + argv[argc++] = ""; /* D:\\SOURCECODE\\UNZIP51S\\UNZIP.COM"; */ + while (*scan == ' ') + scan++; + argv[argc++] = scan; + while ( (scan = strchr(scan,' ')) != NULL) { + *scan++ = 0; + while (*scan == ' ') + scan++; + argv[argc++] = scan; + } + if (*argv[argc-1] == 0) + argc--; + argv[argc] = 0; + + /* GRR: should resetMainFlags() be called in here somewhere? */ + + sprintf(retstr->strptr, "%d", unzip(__G__ argc, argv)); /* a.k.a. MAIN() */ + if (numargs == 2) + SetOutputVarLength(__G); + retstr->strlength = strlen(retstr->strptr); + return RexxReturn(__G__ 1,retstr); +} + +int varmessage(__GPRO__ uch *buf, ulg size) +{ + if (size > 0) + memcpy(G.os2.buffer+G.os2.putchar_idx,buf,size); + G.os2.putchar_idx = TextSetNext(__G__ G.os2.buffer, size+G.os2.putchar_idx,0); + return 0; +} + +int varputchar(__GPRO__ int c) +{ + G.os2.buffer[G.os2.putchar_idx++] = c; + if (c == '\n') { + G.os2.buffer[G.os2.putchar_idx] = 0; + if (G.os2.output_var[0]) + G.os2.putchar_idx = TextSetNext(__G__ G.os2.buffer, G.os2.putchar_idx,0); + else { + G.os2.buffer[--G.os2.putchar_idx] = 0; + puts(G.os2.buffer); + G.os2.putchar_idx = 0; + } + } + return 1; +} + + + +int SetOutputVarStem(__GPRO__ const char *name) +{ + int len=strlen(name); + G.redirect_text=1; + G.os2.output_idx = 0; + strcpy(G.os2.output_var, name); + if (len) { + strupr(G.os2.output_var); /* uppercase the name */ + if (*(G.os2.output_var+len-1) != '.') { + *(G.os2.output_var+len) = '.'; + len++; + *(G.os2.output_var+len) = 0; + } + WriteToVariable(__G__ G.os2.output_var,"",0); + } + G.os2.stem_len = len; + return G.os2.stem_len; +} + +int SetOutputVar(__GPRO__ const char *name) +{ + int len=strlen(name); + G.redirect_text=1; + G.os2.output_idx = 0; + strcpy(G.os2.output_var, name); + strupr(G.os2.output_var); /* uppercase the name */ + if (*(name+len-1) == '.') + G.os2.stem_len = len; + else + G.os2.stem_len = 0; + return G.os2.stem_len; +} + +int SetOutputVarLength(__GPRO) +{ + if (G.os2.stem_len > 0) { + if (G.os2.putchar_idx) + TextSetNext(__G__ G.os2.buffer,G.os2.putchar_idx,1); + return PrintToSubVariable(__G__ 0,"%d",G.os2.output_idx); + } + return 0; +} + +int PrintToVariable(__GPRO__ const char *name, const char *format,...) +{ + va_list arg_ptr; + int ret; + + va_start(arg_ptr, format); + ret = _PrintToVariable(__G__ name, format, arg_ptr); + va_end(arg_ptr); + return ret; +} + +int WriteToVariable(__GPRO__ const char *name, char *buffer, int len) +{ + G.os2.request.shvnext = NULL; + EZRXSTRING(G.os2.request.shvname, name); + G.os2.request.shvnamelen = G.os2.request.shvname.strlength; + G.os2.request.shvvalue.strptr = buffer; + G.os2.request.shvvalue.strlength = len; + G.os2.request.shvvaluelen = len; + G.os2.request.shvcode = RXSHV_SET; + G.os2.request.shvret = 0; + switch (RexxVariablePool(&G.os2.request)) { + case RXSHV_BADN: + G.os2.rexx_error = INVALID_ROUTINE; + break; + case RXSHV_MEMFL: + G.os2.rexx_mes = ERROR_NOMEM; + break; + case RXSHV_OK: + return 0; + } + return INVALID_ROUTINE; /* error on non-zero */ +} + +int _PrintToVariable(__GPRO__ const char *name, const char *format, va_list arg_ptr) +{ + int ret = vsprintf(G.os2.buffer, format, arg_ptr); + WriteToVariable(__G__ name, G.os2.buffer, strlen(G.os2.buffer)); + return ret; +} + +int PrintToSubVariable(__GPRO__ int idx, const char *format, ...) +{ + va_list arg_ptr; + int ret; + + if (G.os2.stem_len == 0) + return INVALID_ROUTINE; /* error on non-zero */ + sprintf(G.os2.output_var+G.os2.stem_len,"%d",idx); + + va_start(arg_ptr, format); + ret = _PrintToVariable(__G__ G.os2.output_var, format, arg_ptr); + va_end(arg_ptr); + return ret; +} + + +int WriteToNextVariable(__GPRO__ char *buffer, int len) +{ + if (G.os2.stem_len > 0) { + G.os2.output_idx++; + sprintf(G.os2.output_var+G.os2.stem_len,"%d",G.os2.output_idx); + } + return WriteToVariable(__G__ G.os2.output_var, buffer, len); +} + + +int TextSetNext(__GPRO__ char *buffer, int len, int all) +{ + char *scan = buffer, *next, *base=buffer; + int remaining=len; + int ret; + + while ((next = strchr(scan,'\n')) != NULL && remaining > 0) { + if (next > scan && *(next-1) == 0xd) + *(next-1) = 0; + else + *next = 0; + if (WriteToNextVariable(__G__ scan,strlen(scan))) + return 0; + next++; + remaining -= (next-scan); + scan = next; + } + if (remaining > 0) + if (all) { + *(scan+remaining) = 0; + WriteToNextVariable(__G__ scan,remaining); + } else { + memcpy(buffer,scan,remaining); + return remaining; + } + + return 0; +} + +int finish_REXX_redirect(__GPRO) +{ + char *scan, *ptr; + int idx=0, first=1, offset; + + if (!G.redirect_size) + return 0; + switch(G.redirect_data) { + case 1: + break; + case 2: + TextSetNext(__G__ G.redirect_buffer, G.redirect_size, 1); + SetOutputVarLength(__G); + DosFreeMem(G.redirect_buffer); + G.redirect_buffer = NULL; + G.redirect_size = 0; + break; + case 3: + WriteToNextVariable(__G__ G.filename,strlen(G.filename)); + sprintf(G.os2.output_var+G.os2.stem_len,G.filename); + WriteToVariable(__G__ G.os2.output_var, G.redirect_buffer, G.redirect_size); + DosFreeMem(G.redirect_buffer); + G.redirect_buffer = NULL; + G.redirect_size = 0; + break; + case 4: + if ((scan = strrchr(G.filename,'/')) != NULL) { + idx = *scan; + *scan = 0; + strupr(G.filename); + *scan = idx; + } + scan = G.os2.output_var+G.os2.stem_len; + strcpy(scan,G.filename); + while ((scan = strchr(scan,'/')) != NULL) + *scan = '.'; + WriteToVariable(__G__ G.os2.output_var, G.redirect_buffer, G.redirect_size); + DosFreeMem(G.redirect_buffer); + G.redirect_buffer = NULL; + G.redirect_size = 0; + strcpy(G.os2.getvar_buf, G.os2.output_var); + do { + if ((scan = strrchr(G.filename,'/')) == NULL) + offset = 0; + else + offset = scan-G.filename+1; + if (first || !GetVariable(__G__ G.os2.output_var)) { + ptr = G.os2.getvar_buf+offset+G.os2.stem_len; + *ptr = '0'; + *(ptr+1) = 0; + if (!GetVariable(__G__ G.os2.getvar_buf)) + idx = 1; + else + idx = atoi(G.os2.buffer)+1; + PrintToVariable(__G__ G.os2.getvar_buf,"%d",idx); + sprintf(ptr,"%d",idx); + if (!first) { + PrintToVariable(__G__ G.os2.output_var,"%d",idx); + idx = strlen(G.filename); + *(G.filename+idx) = '/'; + *(G.filename+idx+1) = 0; + } + WriteToVariable(__G__ G.os2.getvar_buf,G.filename+offset,strlen(G.filename+offset)); + first=0; + } + if (offset) { + *(G.os2.output_var+G.os2.stem_len+offset-1) = 0; + *scan = 0; + } + } while (offset); + break; + } + return 0; +} + +#endif /* OS2DLL */ diff --git a/utils/Install/packzip/rexxapi.def b/utils/Install/packzip/rexxapi.def new file mode 100644 index 0000000000..813964abe8 --- /dev/null +++ b/utils/Install/packzip/rexxapi.def @@ -0,0 +1,18 @@ +LIBRARY UNZIP32 INITINSTANCE LONGNAMES +PROTMODE +DESCRIPTION 'Info-ZIP UnZip API - Copyright Scott Maxwell 1994, Info-ZIP 1995-1997' +DATA MULTIPLE NONSHARED +EXPORTS + UzpVersion @1 + UzpUnzipToMemory @2 + UzpFileTree @3 + UzpMain @4 + UzpAltMain @5 + UzpVersion2 @6 + UZDROPFUNCS = UZDropFuncs @2000 + UZLOADFUNCS = UZLoadFuncs @2001 + UZFILETREE = UZFileTree @2002 + UZUNZIPTOVAR = UZUnZipToVar @2003 + UZUNZIPTOSTEM = UZUnZipToStem @2004 + UZVER = UZVer @2005 + UZUNZIP = UZUnZip @2007 diff --git a/utils/Install/packzip/rexxhelp.c b/utils/Install/packzip/rexxhelp.c new file mode 100644 index 0000000000..20a72597a8 --- /dev/null +++ b/utils/Install/packzip/rexxhelp.c @@ -0,0 +1,178 @@ +/* rexxhelp.c */ + +#if defined(API_DOC) && defined(OS2DLL) + +#define UNZIP_INTERNAL +#include "../unzip.h" +#include "../version.h" + +APIDocStruct REXXDetails[] = { + { "UZDROPFUNCS" , "UZDropFuncs" , + "call UZDropFuncs", + "Use this function to drop all the loaded UnZip functions.\n" +"\t\tOnce this function is processed by a REXX program, the\n" +"\t\tUnZip functions are not accessible in any OS/2 sessions.\n" }, + + { "UZLOADFUNCS" , "UZLoadFuncs" , + "call UZLoadFuncs", + "Use this function to make all of the UnZip functions\n" +" in this package available to all OS/2 sessions.\n\n" +" Example: call RxFuncAdd 'UZLoadFuncs', 'UNZIPAPI', 'UZLoadFuncs'\n" +" call UZLoadFuncs\n" }, + + { "UZFILETREE" , "UZFileTree" , + "rc = UZFileTree(zipfile, stem, [include], [exclude], [options])\n\n" +" zipfile - Name of ZIP file to search\n" +" stem - Name of the stem variable for results\n" +" Note: stem.0 contains the number of files found.\n" +" include - Optional stem variable specifying a list of files (including\n" +" wildcards) to include. stem.0 must indicate number of items.\n" +" exclude - Optional stem variable specifying a list of files (including\n" +" wildcards) to exclude. stem.0 must indicate number of items.\n" +" NOTE: If lists are not needed, filespec strings may be passed.\n" +" options - One of the following:\n" +" 'O' - Give file names only. This is the default.\n" +" 'F' - Give file statistics in the form:\n" +" Length Date Time Name\n" +" 'Z' - Also give ZIP statistics in the form:\n" +" Length Method Size Ratio Date Time CRC-32 Name", + "Finds all files in the specified ZIP with the specified\n" +" filespec and places their descriptions in a stem variable.\n\n" +" rc: Return codes\n" +" 0 Successful\n" +" 2 Error. Not enough memory.\n\n" +" Examples:\n" +" /* Return a list of all .NDX files in pcboard.qwk */\n" +" rc = UZFileTree('pcboard.qwk', 'stem.', '*.ndx')\n\n" +" /* Return a list of all files except *.NDX and *.DAT */\n" +" exc.0 = 2; exc.1 = '*.ndx'; exc.2 = '*.dat'\n" +" rc = UZFileTree('pcboard.qwk', 'stem.',,'exc.')\n" }, + + { "UZUNZIP" , "UZUnZip" , + "rc = UZUnZip('parameters', [stem])\n\n" +" parameters - The entire list of parameters you would use from\n" +" the command-line\n" +" stem - The name of an optional stem variable where any\n" +" output should be redirected.\n" +" NOTE: If a stem is not specified, all output will\n" +" go to the console.", + "Provide a direct entry point to the command line interface.\n\n" +" rc: UnZip return code\n\n" +" Examples: /* Test the archive 'unzip51s.zip' and return output in stem.*/\n" +" rc = UZUnZip('-t unzip51s.zip','stem.')\n" +" /* Extract the archive, display output on screen */\n" +" call UZUnZip 'doom.zip'\n" +" /* Extract all .NDX files from the archive */\n" +" call UZUnZip 'pcboard.qwk *.ndx','stem.'\n" }, + + { "UZUNZIPTOVAR" , "UZUnZipToVar" , + "rc = UZUnZipToVar('zipfile', 'filename', [stem])\n\n" +" zipfile - Name of ZIP file to search\n" +" filename - Name of file to extract from zipfile\n" +" stem - Optional stem variable to extract the file to.\n" +" If you specify a stem variable, the file will be extracted\n" +" to the variable, one line per index, stem.0 containing a\n" +" line count. In this case, 0 will be returned in rc.\n" +" If NO stem variable is specified, the entire file will be\n" +" extracted to rc.", + "Unzip one file to a variable.\n\n" +" rc: If no stem variable is specified, rc contains the contents of\n" +" the extracted file if successful or an error-code if not.\n" +" If a stem variable IS specified, rc contains 0 if successful.\n"}, + + /* GRR: "include" and "exclude" used to be identified as stem variables + * (Daniel H bug report) + */ + { "UZUNZIPTOSTEM", "UZUnZipToStem", + "rc = UZUnZipToStem(zipfile, stem, [include], [exclude], [mode])\n" +" zipfile - Name of ZIP file to search\n" +" stem - Stem variable used to store the extracted files\n" +" include - Optional string variable specifying a list of files (including\n" +" wildcards) to include. stem.0 must indicate number of items.\n" +" exclude - Optional string variable specifying a list of files (including\n" +" wildcards) to exclude. stem.0 must indicate number of items.\n" +" NOTE: If lists are not needed, filespec strings may be passed.\n" +" mode - Optional mode parameter specifies either 'F'lat (the default)\n" +" or 'T'ree mode.\n" +" -- In flat mode, each file is stored in stem.fullname i.e.\n" +" stem.os2/dll/unzipapi.c. A list of files is created in\n" +" stem.<index>\n" +" -- In tree mode, slashes are converted to periods in the\n" +" pathname thus the above file would have been stored in\n" +" stem.OS2.DLL.unzipapi.c and an index stored for each\n" +" directory, i.e. stem.OS2.DLL.<index> = \"unzipapi.c\",\n" +" stem.OS2.<index> = \"DLL/\", stem.<index> = \"OS2/\"", + "Unzip files to a stem variable.\n\n" +" Example: Assuming a file unzip.zip containing:\n" +" unzip.c, unshrink.c, extract.c,\n" +" os2/makefile.os2, os2/os2.c\n" +" os2/dll/dll.def, os2/dll/unzipapi.c\n\n" +" rc = UZUnZipToStem('unzip.zip', 'stem.')\n" +" Returns: stem.0 = 7\n" +" stem.1 = unzip.c\n" +" stem.2 = unshrink.c\n" +" stem.3 = extract.c\n" +" stem.4 = os2/makefile.os2\n" +" stem.5 = os2/os2.c\n" +" stem.6 = os2/dll/dll.def\n" +" stem.7 = os2/dll/unzipapi.c\n" +" And the following contain the contents of the\n" +" various files:\n" +" stem.unzip.c\n" +" stem.unshrink.c\n" +" stem.extract.c\n" +" stem.os2/makefile.os2\n" +" stem.os2/os2.c\n" +" stem.os2/dll/dll.def\n" +" stem.os2/dll/unzipapi.c\n\n" +" rc = UZUnZipToStem('unzip.zip', 'stem.',,,'TREE')\n" +" Returns: stem.0 = 4\n" +" stem.1 = unzip.c\n" +" stem.2 = unshrink.c\n" +" stem.3 = extract.c\n" +" stem.4 = OS2/\n" +" stem.OS2.0 = 3\n" +" stem.OS2.1 = makefile.os2\n" +" stem.OS2.2 = os2.c\n" +" stem.OS2.3 = DLL/\n" +" stem.OS2.DLL.0 = 2\n" +" stem.OS2.DLL.1 = def\n" +" stem.OS2.DLL.2 = unzipapi.c\n" +"\n" +" And the following contain the contents of the\n" +" various programs:\n" +" stem.unzip.c\n" +" stem.unshrink.c\n" +" stem.extract.c\n" +" stem.OS2.makefile.os2\n" +" stem.OS2.os2.c\n" +" stem.OS2.DLL.dll.def\n" +" stem.OS2.DLL.unzipapi.c\n" }, + + { "UZVER" , "UZVer" , + "rc = UZVer([option])\n\n" +" rc String containing UnZip version info in the form 'x.xx'\n" +" If option is 'L' then info is in the form 'x.xx of <date>", + "Returns the version number of UnZip\n" }, + + { "UZAPIVER" , "UZAPIVer" , + "rc = UZAPIVer([option])\n\n" +" rc String containing API version info in the form 'x.xx'\n" +" If option is 'L' then info is in the form 'x.xx of <date>", + "Returns the version number of the API\n" }, + { 0 } +}; + +char *REXXBrief = "\ +REXX functions:\n\ + UZDropFuncs -- Makes all functions in this package unknown to REXX\n\ + UZLoadFuncs -- Makes all functions in this package known to REXX\n\ + UZFileTree -- Searches for files matching a given filespec\n\ + UZUnZip -- UnZip command-line entry point\n\ + UZUnZipToVar -- Unzip one file to a variable\n\ + UZUnZipToStem -- Unzip files to a variable array\n\ + UZVer -- Returns the UnZip version number\n\ + UZAPIVer -- Returns the API version number\n"; + + +#endif /* API_DOC && OS2DLL */ diff --git a/utils/Install/packzip/stub.def b/utils/Install/packzip/stub.def new file mode 100644 index 0000000000..f3852f109e --- /dev/null +++ b/utils/Install/packzip/stub.def @@ -0,0 +1,6 @@ +DESCRIPTION 'The world-famous Info-ZIP unarchiving utilities' +STACKSIZE 0x50000 +IMPORTS + UNZIP32.UzpVersion + UNZIP32.UzpMain + UNZIP32.UzpVersion2 diff --git a/utils/Install/packzip/ttyio.c b/utils/Install/packzip/ttyio.c new file mode 100644 index 0000000000..c755d1c5a3 --- /dev/null +++ b/utils/Install/packzip/ttyio.c @@ -0,0 +1,625 @@ +/*--------------------------------------------------------------------------- + + ttyio.c + + This file contains routines for doing console input/output, including code + for non-echoing input. It is used by the encryption/decryption code but + does not contain any restricted code itself. This file is shared between + Info-ZIP's Zip and UnZip. + + Contains: echo() (VMS only) + Echon() (Unix only) + Echoff() (Unix only) + screenlines() (Unix only) + zgetch() (Unix and non-Unix versions) + getp() ("PC," Unix/Atari/Be, VMS/VMCMS/MVS) + + ---------------------------------------------------------------------------*/ + +#define __TTYIO_C /* identifies this source module */ + +#include "zip.h" +#include "crypt.h" + +#if (CRYPT || (defined(UNZIP) && !defined(FUNZIP))) +/* Non-echo console/keyboard input is needed for (en/de)cryption's password + * entry, and for UnZip(SFX)'s MORE and Pause features. + * (The corresponding #endif is found at the end of this module.) + */ + +#include "ttyio.h" + +#ifndef PUTC +# define PUTC putc +#endif + +#ifdef ZIP +# ifdef GLOBAL /* used in Amiga system headers, maybe others too */ +# undef GLOBAL +# endif +# define GLOBAL(g) g +#else +# define GLOBAL(g) G.g +#endif + +#ifdef __BEOS__ /* why yes, we do */ +# define HAVE_TERMIOS_H +#endif + +#ifdef _POSIX_VERSION +# ifndef USE_POSIX_TERMIOS +# define USE_POSIX_TERMIOS /* use POSIX style termio (termios) */ +# endif +# ifndef HAVE_TERMIOS_H +# define HAVE_TERMIOS_H /* POSIX termios.h */ +# endif +#endif /* _POSIX_VERSION */ + +#ifdef UNZIP /* Zip handles this with the unix/configure script */ +# ifndef _POSIX_VERSION +# if (defined(SYSV) || defined(CRAY)) && !defined(__MINT__) +# ifndef USE_SYSV_TERMIO +# define USE_SYSV_TERMIO +# endif +# ifdef COHERENT +# ifndef HAVE_TERMIO_H +# define HAVE_TERMIO_H +# endif +# ifdef HAVE_SYS_TERMIO_H +# undef HAVE_SYS_TERMIO_H +# endif +# else /* !COHERENT */ +# ifdef HAVE_TERMIO_H +# undef HAVE_TERMIO_H +# endif +# ifndef HAVE_SYS_TERMIO_H +# define HAVE_SYS_TERMIO_H +# endif +# endif /* ?COHERENT */ +# endif /* (SYSV || CRAY) && !__MINT__ */ +# endif /* !_POSIX_VERSION */ +# if !(defined(BSD4_4) || defined(SYSV) || defined(__convexc__)) +# ifndef NO_FCNTL_H +# define NO_FCNTL_H +# endif +# endif /* !(BSD4_4 || SYSV || __convexc__) */ +#endif /* UNZIP */ + +#ifdef HAVE_TERMIOS_H +# ifndef USE_POSIX_TERMIOS +# define USE_POSIX_TERMIOS +# endif +#endif + +#if (defined(HAVE_TERMIO_H) || defined(HAVE_SYS_TERMIO_H)) +# ifndef USE_SYSV_TERMIO +# define USE_SYSV_TERMIO +# endif +#endif + +#if (defined(UNZIP) && !defined(FUNZIP) && defined(UNIX) && defined(MORE)) +# include <sys/ioctl.h> +# define GOT_IOCTL_H + /* int ioctl OF((int, int, zvoid *)); GRR: may need for some systems */ +#endif + +#ifndef HAVE_WORKING_GETCH + /* include system support for switching of console echo */ +# ifdef VMS +# include <descrip.h> +# include <iodef.h> +# include <ttdef.h> +# include <starlet.h> +# include <ssdef.h> +# else /* !VMS */ +# ifdef HAVE_TERMIOS_H +# include <termios.h> +# define sgttyb termios +# define sg_flags c_lflag +# define GTTY(f, s) tcgetattr(f, (zvoid *) s) +# define STTY(f, s) tcsetattr(f, TCSAFLUSH, (zvoid *) s) +# else /* !HAVE_TERMIOS_H */ +# ifdef USE_SYSV_TERMIO /* Amdahl, Cray, all SysV? */ +# ifdef HAVE_TERMIO_H +# include <termio.h> +# endif +# ifdef HAVE_SYS_TERMIO_H +# include <sys/termio.h> +# endif +# ifdef NEED_PTEM +# include <sys/stream.h> +# include <sys/ptem.h> +# endif +# define sgttyb termio +# define sg_flags c_lflag +# define GTTY(f,s) ioctl(f,TCGETA,(zvoid *)s) +# define STTY(f,s) ioctl(f,TCSETAW,(zvoid *)s) +# else /* !USE_SYSV_TERMIO */ +# ifndef CMS_MVS +# if (!defined(MINIX) && !defined(GOT_IOCTL_H)) +# include <sys/ioctl.h> +# endif +# include <sgtty.h> +# define GTTY gtty +# define STTY stty +# ifdef UNZIP + /* + * XXX : Are these declarations needed at all ???? + */ + /* + * GRR: let's find out... Hmmm, appears not... + int gtty OF((int, struct sgttyb *)); + int stty OF((int, struct sgttyb *)); + */ +# endif +# endif /* !CMS_MVS */ +# endif /* ?USE_SYSV_TERMIO */ +# endif /* ?HAVE_TERMIOS_H */ +# ifndef NO_FCNTL_H +# ifndef UNZIP +# include <fcntl.h> +# endif +# else + char *ttyname OF((int)); +# endif +# endif /* ?VMS */ +#endif /* !HAVE_WORKING_GETCH */ + + + +#ifndef HAVE_WORKING_GETCH +#ifdef VMS + +/* + * Turn keyboard echoing on or off (VMS). Loosely based on VMSmunch.c + * and hence on Joe Meadows' file.c code. + */ +int echo(opt) + int opt; +{ + /* + * For VMS v5.x: + * IO$_SENSEMODE/SETMODE info: Programming, Vol. 7A, System Programming, + * I/O User's: Part I, sec. 8.4.1.1, 8.4.3, 8.4.5, 8.6 + * sys$assign(), sys$qio() info: Programming, Vol. 4B, System Services, + * System Services Reference Manual, pp. sys-23, sys-379 + * fixed-length descriptor info: Programming, Vol. 3, System Services, + * Intro to System Routines, sec. 2.9.2 + * Greg Roelofs, 15 Aug 91 + */ + + /* SKM: make global? */ + static struct dsc$descriptor_s DevDesc = + {11, DSC$K_DTYPE_T, DSC$K_CLASS_S, "SYS$COMMAND"}; + /* {dsc$w_length, dsc$b_dtype, dsc$b_class, dsc$a_pointer}; */ + static short DevChan, iosb[4]; + static long status; + static unsigned long oldmode[2], newmode[2]; /* each = 8 bytes */ + + + /* assign a channel to standard input */ + status = sys$assign(&DevDesc, &DevChan, 0, 0); + if (!(status & 1)) + return status; + + /* use sys$qio and the IO$_SENSEMODE function to determine the current + * tty status (for password reading, could use IO$_READVBLK function + * instead, but echo on/off will be more general) + */ + status = sys$qiow(0, DevChan, IO$_SENSEMODE, &iosb, 0, 0, + oldmode, 8, 0, 0, 0, 0); + if (!(status & 1)) + return status; + status = iosb[0]; + if (!(status & 1)) + return status; + + /* copy old mode into new-mode buffer, then modify to be either NOECHO or + * ECHO (depending on function argument opt) + */ + newmode[0] = oldmode[0]; + newmode[1] = oldmode[1]; + if (opt == 0) /* off */ + newmode[1] |= TT$M_NOECHO; /* set NOECHO bit */ + else + newmode[1] &= ~((unsigned long) TT$M_NOECHO); /* clear NOECHO bit */ + + /* use the IO$_SETMODE function to change the tty status */ + status = sys$qiow(0, DevChan, IO$_SETMODE, &iosb, 0, 0, + newmode, 8, 0, 0, 0, 0); + if (!(status & 1)) + return status; + status = iosb[0]; + if (!(status & 1)) + return status; + + /* deassign the sys$input channel by way of clean-up */ + status = sys$dassgn(DevChan); + if (!(status & 1)) + return status; + + return SS$_NORMAL; /* we be happy */ + +} /* end function echo() */ + + +#else /* !VMS: basically Unix */ + + +/* For VM/CMS and MVS, non-echo terminal input is not (yet?) supported. */ +#ifndef CMS_MVS + +#ifdef ZIP /* moved to globals.h for UnZip */ + static int echofd=(-1); /* file descriptor whose echo is off */ +#endif + +/* + * Turn echo off for file descriptor f. Assumes that f is a tty device. + */ +void Echoff(__G__ f) + __GDEF + int f; /* file descriptor for which to turn echo off */ +{ + struct sgttyb sg; /* tty device structure */ + + GLOBAL(echofd) = f; + GTTY(f, &sg); /* get settings */ + sg.sg_flags &= ~ECHO; /* turn echo off */ + STTY(f, &sg); +} + +/* + * Turn echo back on for file descriptor echofd. + */ +void Echon(__G) + __GDEF +{ + struct sgttyb sg; /* tty device structure */ + + if (GLOBAL(echofd) != -1) { + GTTY(GLOBAL(echofd), &sg); /* get settings */ + sg.sg_flags |= ECHO; /* turn echo on */ + STTY(GLOBAL(echofd), &sg); + GLOBAL(echofd) = -1; + } +} + +#endif /* !CMS_MVS */ +#endif /* ?VMS */ + + +#if (defined(UNZIP) && !defined(FUNZIP)) + +#if (defined(UNIX) || defined(__BEOS__)) +#ifdef MORE + +/* + * Get the number of lines on the output terminal. SCO Unix apparently + * defines TIOCGWINSZ but doesn't support it (!M_UNIX). + * + * GRR: will need to know width of terminal someday, too, to account for + * line-wrapping. + */ + +#if (defined(TIOCGWINSZ) && !defined(M_UNIX)) + +int screenlines() +{ + struct winsize wsz; +#ifdef DEBUG_WINSZ + static int firsttime = TRUE; +#endif + + /* see termio(4) under, e.g., SunOS */ + if (ioctl(1, TIOCGWINSZ, &wsz) == 0) { +#ifdef DEBUG_WINSZ + if (firsttime) { + firsttime = FALSE; + fprintf(stderr, "ttyio.c screenlines(): ws_row = %d\n", + wsz.ws_row); + } +#endif + /* number of columns = ws_col */ + return (wsz.ws_row > 0)? wsz.ws_row : 24; /* number of rows */ + + } else { /* this happens when piping to more(1), for example */ +#ifdef DEBUG_WINSZ + if (firsttime) { + firsttime = FALSE; + fprintf(stderr, + "ttyio.c screenlines(): ioctl(TIOCGWINSZ) failed\n")); + } +#endif + return 24; /* VT-100 assumed to be minimal hardware */ + } +} + +#else /* !TIOCGWINSZ: service not available, fall back to semi-bogus method */ + +int screenlines() +{ + char *envptr, *getenv(); + int n; + + /* GRR: this is overly simplistic, but don't have access to stty/gtty + * system anymore + */ + envptr = getenv("LINES"); + if (envptr == (char *)NULL || (n = atoi(envptr)) < 5) + return 24; /* VT-100 assumed to be minimal hardware */ + else + return n; +} + +#endif /* ?(TIOCGWINSZ && !M_UNIX) */ +#endif /* MORE */ + + +/* + * Get a character from the given file descriptor without echo or newline. + */ +int zgetch(__G__ f) + __GDEF + int f; /* file descriptor from which to read */ +{ +#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)) + char oldmin, oldtim; +#endif + char c; + struct sgttyb sg; /* tty device structure */ + + GTTY(f, &sg); /* get settings */ +#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)) + oldmin = sg.c_cc[VMIN]; /* save old values */ + oldtim = sg.c_cc[VTIME]; + sg.c_cc[VMIN] = 1; /* need only one char to return read() */ + sg.c_cc[VTIME] = 0; /* no timeout */ + sg.sg_flags &= ~ICANON; /* canonical mode off */ +#else + sg.sg_flags |= CBREAK; /* cbreak mode on */ +#endif + sg.sg_flags &= ~ECHO; /* turn echo off, too */ + STTY(f, &sg); /* set cbreak mode */ + GLOBAL(echofd) = f; /* in case ^C hit (not perfect: still CBREAK) */ + + read(f, &c, 1); /* read our character */ + +#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)) + sg.c_cc[VMIN] = oldmin; /* restore old values */ + sg.c_cc[VTIME] = oldtim; + sg.sg_flags |= ICANON; /* canonical mode on */ +#else + sg.sg_flags &= ~CBREAK; /* cbreak mode off */ +#endif + sg.sg_flags |= ECHO; /* turn echo on */ + STTY(f, &sg); /* restore canonical mode */ + GLOBAL(echofd) = -1; + + return (int)c; +} + + +#else /* !UNIX && !__BEOS__ */ + + +int zgetch(__G__ f) + __GDEF + int f; /* file descriptor from which to read (must be open already) */ +{ + char c, c2; + +/*--------------------------------------------------------------------------- + Get a character from the given file descriptor without echo; can't fake + CBREAK mode (i.e., newline required), but can get rid of all chars up to + and including newline. + ---------------------------------------------------------------------------*/ + + echoff(f); + read(f, &c, 1); + if (c != '\n') + do { + read(f, &c2, 1); /* throw away all other chars up thru newline */ + } while (c2 != '\n'); + echon(); + return (int)c; +} + +#endif /* ?(UNIX || __BEOS__) */ + +#endif /* UNZIP && !FUNZIP */ +#endif /* !HAVE_WORKING_GETCH */ + + +#if CRYPT /* getp() is only used with full encryption */ + +/* + * Simple compile-time check for source compatibility between + * zcrypt and ttyio: + */ +#if (!defined(CR_MAJORVER) || (CR_MAJORVER < 2) || (CR_MINORVER < 7)) + error: This Info-ZIP tool requires zcrypt 2.7 or later. +#endif + +/* + * Get a password of length n-1 or less into *p using the prompt *m. + * The entered password is not echoed. + */ + +#ifdef HAVE_WORKING_GETCH +/* + * For the AMIGA, getch() is defined as Agetch(), which is in + * amiga/filedate.c; SAS/C 6.x provides a getch(), but since Agetch() + * uses the infrastructure that is already in place in filedate.c, it is + * smaller. With this function, echoff() and echon() are not needed. + * + * For the MAC, a non-echo macgetch() function is defined in the MacOS + * specific sources which uses the event handling mechanism of the + * desktop window manager to get a character from the keyboard. + * + * For the other systems in this section, a non-echo getch() function + * is either contained the C runtime library (conio package), or getch() + * is defined as an alias for a similar system specific RTL function. + */ + +#ifndef WINDLL /* WINDLL does not support a console interface */ +#ifndef QDOS /* QDOS supplies a variant of this function */ + +/* This is the getp() function for all systems (with TTY type user interface) + * that supply a working `non-echo' getch() function for "raw" console input. + */ +char *getp(__G__ m, p, n) + __GDEF + ZCONST char *m; /* prompt for password */ + char *p; /* return value: line input */ + int n; /* bytes available in p[] */ +{ + char c; /* one-byte buffer for read() to use */ + int i; /* number of characters input */ + char *w; /* warning on retry */ + + /* get password */ + w = ""; + do { + fputs(w, stderr); /* warning if back again */ + fputs(m, stderr); /* display prompt and flush */ + fflush(stderr); + i = 0; + do { /* read line, keeping first n characters */ + if ((c = (char)getch()) == '\r') + c = '\n'; /* until user hits CR */ + if (c == 8 || c == 127) { + if (i > 0) i--; /* the `backspace' and `del' keys works */ + } + else if (i < n) + p[i++] = c; /* truncate past n */ + } while (c != '\n'); + PUTC('\n', stderr); fflush(stderr); + w = "(line too long--try again)\n"; + } while (p[i-1] != '\n'); + p[i-1] = 0; /* terminate at newline */ + + return p; /* return pointer to password */ + +} /* end function getp() */ + +#endif /* !QDOS */ +#endif /* !WINDLL */ + + +#else /* !HAVE_WORKING_GETCH */ + + +#if (defined(UNIX) || defined(__MINT__) || defined(__BEOS__)) + +#ifndef _PATH_TTY +# ifdef __MINT__ +# define _PATH_TTY ttyname(2) +# else +# define _PATH_TTY "/dev/tty" +# endif +#endif + +char *getp(__G__ m, p, n) + __GDEF + ZCONST char *m; /* prompt for password */ + char *p; /* return value: line input */ + int n; /* bytes available in p[] */ +{ + char c; /* one-byte buffer for read() to use */ + int i; /* number of characters input */ + char *w; /* warning on retry */ + int f; /* file descriptor for tty device */ + +#ifdef PASSWD_FROM_STDIN + /* Read from stdin. This is unsafe if the password is stored on disk. */ + f = 0; +#else + /* turn off echo on tty */ + + if ((f = open(_PATH_TTY, 0)) == -1) + return NULL; +#endif + /* get password */ + w = ""; + do { + fputs(w, stderr); /* warning if back again */ + fputs(m, stderr); /* prompt */ + fflush(stderr); + i = 0; + echoff(f); + do { /* read line, keeping n */ + read(f, &c, 1); + if (i < n) + p[i++] = c; + } while (c != '\n'); + echon(); + PUTC('\n', stderr); fflush(stderr); + w = "(line too long--try again)\n"; + } while (p[i-1] != '\n'); + p[i-1] = 0; /* terminate at newline */ + +#ifndef PASSWD_FROM_STDIN + close(f); +#endif + + return p; /* return pointer to password */ + +} /* end function getp() */ + +#endif /* UNIX || __MINT__ || __BEOS__ */ + + + +#if (defined(VMS) || defined(CMS_MVS)) + +char *getp(__G__ m, p, n) + __GDEF + ZCONST char *m; /* prompt for password */ + char *p; /* return value: line input */ + int n; /* bytes available in p[] */ +{ + char c; /* one-byte buffer for read() to use */ + int i; /* number of characters input */ + char *w; /* warning on retry */ + FILE *f; /* file structure for SYS$COMMAND device */ + +#ifdef PASSWD_FROM_STDIN + f = stdin; +#else + if ((f = fopen(ctermid(NULL), "r")) == NULL) + return NULL; +#endif + + /* get password */ + fflush(stdout); + w = ""; + do { + if (*w) /* bug: VMS apparently adds \n to NULL fputs */ + fputs(w, stderr); /* warning if back again */ + fputs(m, stderr); /* prompt */ + fflush(stderr); + i = 0; + echoff(f); + do { /* read line, keeping n */ + if ((c = (char)getc(f)) == '\r') + c = '\n'; + if (i < n) + p[i++] = c; + } while (c != '\n'); + echon(); + PUTC('\n', stderr); fflush(stderr); + w = "(line too long--try again)\n"; + } while (p[i-1] != '\n'); + p[i-1] = 0; /* terminate at newline */ +#ifndef PASSWD_FROM_STDIN + fclose(f); +#endif + + return p; /* return pointer to password */ + +} /* end function getp() */ + +#endif /* VMS || CMS_MVS */ +#endif /* ?HAVE_WORKING_GETCH */ +#endif /* CRYPT */ +#endif /* CRYPT || (UNZIP && !FUNZIP) */ diff --git a/utils/Install/packzip/unix.c b/utils/Install/packzip/unix.c new file mode 100644 index 0000000000..c9eaaabafc --- /dev/null +++ b/utils/Install/packzip/unix.c @@ -0,0 +1,1424 @@ +/*--------------------------------------------------------------------------- + + unix.c + + Unix-specific routines for use with Info-ZIP's UnZip 5.3 and later. + + Contains: readdir() + do_wild() <-- generic enough to put in fileio.c? + mapattr() + mapname() + checkdir() + mkdir() + close_outfile() + set_direc_attribs() + stamp_file() + version() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" + +#ifdef SCO_XENIX +# define SYSNDIR +#else /* SCO Unix, AIX, DNIX, TI SysV, Coherent 4.x, ... */ +# if defined(__convexc__) || defined(SYSV) || defined(CRAY) || defined(BSD4_4) +# define DIRENT +# endif +#endif +#if defined(_AIX) +# define DIRENT +#endif +#ifdef COHERENT +# if defined(_I386) || (defined(__COHERENT__) && (__COHERENT__ >= 0x420)) +# define DIRENT +# endif +#endif + +/* GRR: may need to uncomment this: */ +#if 0 +#if defined(_POSIX_VERSION) +# define DIRENT +#endif +#endif + +#ifdef DIRENT +# include <dirent.h> +#else +# ifdef SYSV +# ifdef SYSNDIR +# include <sys/ndir.h> +# else +# include <ndir.h> +# endif +# else /* !SYSV */ +# ifndef NO_SYSDIR +# include <sys/dir.h> +# endif +# endif /* ?SYSV */ +# ifndef dirent +# define dirent direct +# endif +#endif /* ?DIRENT */ + +#ifdef ACORN_FTYPE_NFS +/* Acorn bits for NFS filetyping */ +typedef struct { + uch ID[2]; + uch size[2]; + uch ID_2[4]; + uch loadaddr[4]; + uch execaddr[4]; + uch attr[4]; +} RO_extra_block; + +static int isRISCOSexfield OF((uch *extra_field)); +#endif /* ACORN_FTYPE_NFS */ + +static int created_dir; /* used in mapname(), checkdir() */ +static int renamed_fullpath; /* ditto */ + + +#ifndef SFX +#ifdef NO_DIR /* for AT&T 3B1 */ + +#define opendir(path) fopen(path,"r") +#define closedir(dir) fclose(dir) +typedef FILE DIR; + +/* + * Apparently originally by Rich Salz. + * Cleaned up and modified by James W. Birdsall. + */ +struct dirent *readdir(dirp) + DIR *dirp; +{ + static struct dirent entry; + + if (dirp == NULL) + return NULL; + + for (;;) + if (fread(&entry, sizeof (struct dirent), 1, dirp) == 0) + return (struct dirent *)NULL; + else if (entry.d_ino) + return &entry; + +} /* end function readdir() */ + +#endif /* NO_DIR */ + + +/**********************/ +/* Function do_wild() */ /* for porting: dir separator; match(ignore_case) */ +/**********************/ + +char *do_wild(__G__ wildspec) + __GDEF + char *wildspec; /* only used first time on a given dir */ +{ + static DIR *dir = (DIR *)NULL; + static char *dirname, *wildname, matchname[FILNAMSIZ]; + static int firstcall=TRUE, have_dirname, dirnamelen; + struct dirent *file; + + + /* Even when we're just returning wildspec, we *always* do so in + * matchname[]--calling routine is allowed to append four characters + * to the returned string, and wildspec may be a pointer to argv[]. + */ + if (firstcall) { /* first call: must initialize everything */ + firstcall = FALSE; + + if (!iswild(wildspec)) { + strcpy(matchname, wildspec); + have_dirname = FALSE; + dir = NULL; + return matchname; + } + + /* break the wildspec into a directory part and a wildcard filename */ + if ((wildname = strrchr(wildspec, '/')) == (char *)NULL) { + dirname = "."; + dirnamelen = 1; + have_dirname = FALSE; + wildname = wildspec; + } else { + ++wildname; /* point at character after '/' */ + dirnamelen = wildname - wildspec; + if ((dirname = (char *)malloc(dirnamelen+1)) == (char *)NULL) { + Info(slide, 0x201, ((char *)slide, + "warning: cannot allocate wildcard buffers\n")); + strcpy(matchname, wildspec); + return matchname; /* but maybe filespec was not a wildcard */ + } + strncpy(dirname, wildspec, dirnamelen); + dirname[dirnamelen] = '\0'; /* terminate for strcpy below */ + have_dirname = TRUE; + } + + if ((dir = opendir(dirname)) != (DIR *)NULL) { + while ((file = readdir(dir)) != (struct dirent *)NULL) { + Trace((stderr, "do_wild: readdir returns %s\n", file->d_name)); + if (file->d_name[0] == '.' && wildname[0] != '.') + continue; /* Unix: '*' and '?' do not match leading dot */ + if (match(file->d_name, wildname, 0) && /* 0 == case sens. */ + /* skip "." and ".." directory entries */ + strcmp(file->d_name, ".") && strcmp(file->d_name, "..")) { + Trace((stderr, "do_wild: match() succeeds\n")); + if (have_dirname) { + strcpy(matchname, dirname); + strcpy(matchname+dirnamelen, file->d_name); + } else + strcpy(matchname, file->d_name); + return matchname; + } + } + /* if we get to here directory is exhausted, so close it */ + closedir(dir); + dir = (DIR *)NULL; + } + + /* return the raw wildspec in case that works (e.g., directory not + * searchable, but filespec was not wild and file is readable) */ + strcpy(matchname, wildspec); + return matchname; + } + + /* last time through, might have failed opendir but returned raw wildspec */ + if (dir == (DIR *)NULL) { + firstcall = TRUE; /* nothing left to try--reset for new wildspec */ + if (have_dirname) + free(dirname); + return (char *)NULL; + } + + /* If we've gotten this far, we've read and matched at least one entry + * successfully (in a previous call), so dirname has been copied into + * matchname already. + */ + while ((file = readdir(dir)) != (struct dirent *)NULL) { + Trace((stderr, "do_wild: readdir returns %s\n", file->d_name)); + if (file->d_name[0] == '.' && wildname[0] != '.') + continue; /* Unix: '*' and '?' do not match leading dot */ + if (match(file->d_name, wildname, 0)) { /* 0 == don't ignore case */ + Trace((stderr, "do_wild: match() succeeds\n")); + if (have_dirname) { + /* strcpy(matchname, dirname); */ + strcpy(matchname+dirnamelen, file->d_name); + } else + strcpy(matchname, file->d_name); + return matchname; + } + } + + closedir(dir); /* have read at least one dir entry; nothing left */ + dir = (DIR *)NULL; + firstcall = TRUE; /* reset for new wildspec */ + if (have_dirname) + free(dirname); + return (char *)NULL; + +} /* end function do_wild() */ + +#endif /* !SFX */ + + + + + +/**********************/ +/* Function mapattr() */ +/**********************/ + +int mapattr(__G) + __GDEF +{ + ulg tmp = G.crec.external_file_attributes; + + G.pInfo->file_attr = 0; + /* initialized to 0 for check in "default" branch below... */ + + switch (G.pInfo->hostnum) { + case AMIGA_: + tmp = (unsigned)(tmp>>17 & 7); /* Amiga RWE bits */ + G.pInfo->file_attr = (unsigned)(tmp<<6 | tmp<<3 | tmp); + break; + case UNIX_: + case VMS_: + case ACORN_: + case ATARI_: + case BEOS_: + case QDOS_: + case TANDEM_: + G.pInfo->file_attr = (unsigned)(tmp >> 16); + if (G.pInfo->file_attr != 0 || !G.extra_field) { + return 0; + } else { + /* Some (non-Info-ZIP) implementations of Zip for Unix and + * VMS (and probably others ??) leave 0 in the upper 16-bit + * part of the external_file_attributes field. Instead, they + * store file permission attributes in some extra field. + * As a work-around, we search for the presence of one of + * these extra fields and fall back to the MSDOS compatible + * part of external_file_attributes if one of the known + * e.f. types has been detected. + * Later, we might implement extraction of the permission + * bits from the VMS extra field. But for now, the work-around + * should be sufficient to provide "readable" extracted files. + * (For ASI Unix e.f., an experimental remap from the e.f. + * mode value IS already provided!) + */ + ush ebID; + unsigned ebLen; + uch *ef = G.extra_field; + unsigned ef_len = G.crec.extra_field_length; + int r = FALSE; + + while (!r && ef_len >= EB_HEADSIZE) { + ebID = makeword(ef); + ebLen = (unsigned)makeword(ef+EB_LEN); + if (ebLen > (ef_len - EB_HEADSIZE)) + /* discoverd some e.f. inconsistency! */ + break; + switch (ebID) { + case EF_ASIUNIX: + if (ebLen >= (EB_ASI_MODE+2)) { + G.pInfo->file_attr = + (unsigned)makeword(ef+(EB_HEADSIZE+EB_ASI_MODE)); + /* force stop of loop: */ + ef_len = (ebLen + EB_HEADSIZE); + break; + } + /* else: fall through! */ + case EF_PKVMS: + /* "found nondecypherable e.f. with perm. attr" */ + r = TRUE; + default: + break; + } + ef_len -= (ebLen + EB_HEADSIZE); + ef += (ebLen + EB_HEADSIZE); + } + if (!r) + return 0; + } + /* fall through! */ + /* all remaining cases: expand MSDOS read-only bit into write perms */ + case FS_FAT_: + /* PKWARE's PKZip for Unix marks entries as FS_FAT_, but stores the + * Unix attributes in the upper 16 bits of the external attributes + * field, just like Info-ZIP's Zip for Unix. We try to use that + * value, after a check for consistency with the MSDOS attribute + * bits (see below). + */ + G.pInfo->file_attr = (unsigned)(tmp >> 16); + /* fall through! */ + case FS_HPFS_: + case FS_NTFS_: + case MAC_: + case TOPS20_: + default: + /* read-only bit --> write perms; subdir bit --> dir exec bit */ + tmp = !(tmp & 1) << 1 | (tmp & 0x10) >> 4; + if ((G.pInfo->file_attr & 0700) == (unsigned)(0400 | tmp<<6)) + /* keep previous G.pInfo->file_attr setting, when its "owner" + * part appears to be consistent with DOS attribute flags! + */ + return 0; + G.pInfo->file_attr = (unsigned)(0444 | tmp<<6 | tmp<<3 | tmp); + break; + } /* end switch (host-OS-created-by) */ + + /* for originating systems with no concept of "group," "other," "system": */ + umask( (int)(tmp=umask(0)) ); /* apply mask to expanded r/w(/x) perms */ + G.pInfo->file_attr &= ~tmp; + + return 0; + +} /* end function mapattr() */ + + + + + +/************************/ +/* Function mapname() */ +/************************/ + /* return 0 if no error, 1 if caution (filename */ +int mapname(__G__ renamed) /* truncated), 2 if warning (skip file because */ + __GDEF /* dir doesn't exist), 3 if error (skip file), */ + int renamed; /* or 10 if out of memory (skip file) */ +{ /* [also IZ_VOL_LABEL, IZ_CREATED_DIR] */ + char pathcomp[FILNAMSIZ]; /* path-component buffer */ + char *pp, *cp=(char *)NULL; /* character pointers */ + char *lastsemi=(char *)NULL; /* pointer to last semi-colon in pathcomp */ +#ifdef ACORN_FTYPE_NFS + char *lastcomma=(char *)NULL; /* pointer to last comma in pathcomp */ +#endif + int quote = FALSE; /* flags */ + int error = 0; + register unsigned workch; /* hold the character being tested */ + + +/*--------------------------------------------------------------------------- + Initialize various pointers and counters and stuff. + ---------------------------------------------------------------------------*/ + + if (G.pInfo->vollabel) + return IZ_VOL_LABEL; /* can't set disk volume labels in Unix */ + + /* can create path as long as not just freshening, or if user told us */ + G.create_dirs = (!uO.fflag || renamed); + + created_dir = FALSE; /* not yet */ + + /* user gave full pathname: don't prepend rootpath */ + renamed_fullpath = (renamed && (*G.filename == '/')); + + if (checkdir(__G__ (char *)NULL, INIT) == 10) + return 10; /* initialize path buffer, unless no memory */ + + *pathcomp = '\0'; /* initialize translation buffer */ + pp = pathcomp; /* point to translation buffer */ + if (uO.jflag) /* junking directories */ + cp = (char *)strrchr(G.filename, '/'); + if (cp == (char *)NULL) /* no '/' or not junking dirs */ + cp = G.filename; /* point to internal zipfile-member pathname */ + else + ++cp; /* point to start of last component of path */ + +/*--------------------------------------------------------------------------- + Begin main loop through characters in filename. + ---------------------------------------------------------------------------*/ + + while ((workch = (uch)*cp++) != 0) { + + if (quote) { /* if character quoted, */ + *pp++ = (char)workch; /* include it literally */ + quote = FALSE; + } else + switch (workch) { + case '/': /* can assume -j flag not given */ + *pp = '\0'; + if ((error = checkdir(__G__ pathcomp, APPEND_DIR)) > 1) + return error; + pp = pathcomp; /* reset conversion buffer for next piece */ + lastsemi = (char *)NULL; /* leave directory semi-colons alone */ + break; + + case ';': /* VMS version (or DEC-20 attrib?) */ + lastsemi = pp; + *pp++ = ';'; /* keep for now; remove VMS ";##" */ + break; /* later, if requested */ + +#ifdef ACORN_FTYPE_NFS + case ',': /* NFS filetype extension */ + lastcomma = pp; + *pp++ = ','; /* keep for now; may need to remove */ + break; /* later, if requested */ +#endif + + case '\026': /* control-V quote for special chars */ + quote = TRUE; /* set flag for next character */ + break; + +#ifdef MTS + case ' ': /* change spaces to underscore under */ + *pp++ = '_'; /* MTS; leave as spaces under Unix */ + break; +#endif + + default: + /* allow European characters in filenames: */ + if (isprint(workch) || (128 <= workch && workch <= 254)) + *pp++ = (char)workch; + } /* end switch */ + + } /* end while loop */ + + *pp = '\0'; /* done with pathcomp: terminate it */ + + /* if not saving them, remove VMS version numbers (appended ";###") */ + if (!uO.V_flag && lastsemi) { + pp = lastsemi + 1; + while (isdigit((uch)(*pp))) + ++pp; + if (*pp == '\0') /* only digits between ';' and end: nuke */ + *lastsemi = '\0'; + } + +#ifdef ACORN_FTYPE_NFS + /* translate Acorn filetype information if asked to do so */ + if (uO.acorn_nfs_ext && isRISCOSexfield(G.extra_field)) { + /* file *must* have a RISC OS extra field */ + int ft = (int)makelong(((RO_extra_block *)G.extra_field)->loadaddr); + /*32-bit*/ + if (lastcomma) { + pp = lastcomma + 1; + while (isxdigit((uch)(*pp))) ++pp; + if (pp == lastcomma+4 && *pp == '\0') *lastcomma='\0'; /* nuke */ + } + if ((ft & 1<<31)==0) ft=0x000FFD00; + sprintf(pathcomp+strlen(pathcomp), ",%03x", ft>>8 & 0xFFF); + } +#endif /* ACORN_FTYPE_NFS */ + +/*--------------------------------------------------------------------------- + Report if directory was created (and no file to create: filename ended + in '/'), check name to be sure it exists, and combine path and name be- + fore exiting. + ---------------------------------------------------------------------------*/ + + if (G.filename[strlen(G.filename) - 1] == '/') { + checkdir(__G__ G.filename, GETPATH); + if (created_dir) { + if (QCOND2) { + Info(slide, 0, ((char *)slide, " creating: %s\n", + G.filename)); + } +#ifndef NO_CHMOD + /* set approx. dir perms (make sure can still read/write in dir) */ + if (chmod(G.filename, (0xffff & G.pInfo->file_attr) | 0700)) + perror("chmod (directory attributes) error"); +#endif + return IZ_CREATED_DIR; /* set dir time (note trailing '/') */ + } + return 2; /* dir existed already; don't look for data to extract */ + } + + if (*pathcomp == '\0') { + Info(slide, 1, ((char *)slide, "mapname: conversion of %s failed\n", + G.filename)); + return 3; + } + + checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */ + checkdir(__G__ G.filename, GETPATH); + + return error; + +} /* end function mapname() */ + + + + +#if 0 /*========== NOTES ==========*/ + + extract-to dir: a:path/ + buildpath: path1/path2/ ... (NULL-terminated) + pathcomp: filename + + mapname(): + loop over chars in zipfile member name + checkdir(path component, COMPONENT | CREATEDIR) --> map as required? + (d:/tmp/unzip/) (disk:[tmp.unzip.) + (d:/tmp/unzip/jj/) (disk:[tmp.unzip.jj.) + (d:/tmp/unzip/jj/temp/) (disk:[tmp.unzip.jj.temp.) + finally add filename itself and check for existence? (could use with rename) + (d:/tmp/unzip/jj/temp/msg.outdir) (disk:[tmp.unzip.jj.temp]msg.outdir) + checkdir(name, GETPATH) --> copy path to name and free space + +#endif /* 0 */ + + + + +/***********************/ +/* Function checkdir() */ +/***********************/ + +int checkdir(__G__ pathcomp, flag) + __GDEF + char *pathcomp; + int flag; +/* + * returns: 1 - (on APPEND_NAME) truncated filename + * 2 - path doesn't exist, not allowed to create + * 3 - path doesn't exist, tried to create and failed; or + * path exists and is not a directory, but is supposed to be + * 4 - path is too long + * 10 - can't allocate memory for filename buffers + */ +{ + static int rootlen = 0; /* length of rootpath */ + static char *rootpath; /* user's "extract-to" directory */ + static char *buildpath; /* full path (so far) to extracted file */ + static char *end; /* pointer to end of buildpath ('\0') */ + +# define FN_MASK 7 +# define FUNCTION (flag & FN_MASK) + + + +/*--------------------------------------------------------------------------- + APPEND_DIR: append the path component to the path being built and check + for its existence. If doesn't exist and we are creating directories, do + so for this one; else signal success or error as appropriate. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_DIR) { + int too_long = FALSE; +#ifdef SHORT_NAMES + char *old_end = end; +#endif + + Trace((stderr, "appending dir segment [%s]\n", pathcomp)); + while ((*end = *pathcomp++) != '\0') + ++end; +#ifdef SHORT_NAMES /* path components restricted to 14 chars, typically */ + if ((end-old_end) > FILENAME_MAX) /* GRR: proper constant? */ + *(end = old_end + FILENAME_MAX) = '\0'; +#endif + + /* GRR: could do better check, see if overrunning buffer as we go: + * check end-buildpath after each append, set warning variable if + * within 20 of FILNAMSIZ; then if var set, do careful check when + * appending. Clear variable when begin new path. */ + + if ((end-buildpath) > FILNAMSIZ-3) /* need '/', one-char name, '\0' */ + too_long = TRUE; /* check if extracting directory? */ + if (stat(buildpath, &G.statbuf)) { /* path doesn't exist */ + if (!G.create_dirs) { /* told not to create (freshening) */ + free(buildpath); + return 2; /* path doesn't exist: nothing to do */ + } + if (too_long) { + Info(slide, 1, ((char *)slide, + "checkdir error: path too long: %s\n", buildpath)); + free(buildpath); + return 4; /* no room for filenames: fatal */ + } + if (mkdir(buildpath, 0777) == -1) { /* create the directory */ + Info(slide, 1, ((char *)slide, + "checkdir error: cannot create %s\n\ + unable to process %s.\n", buildpath, G.filename)); + free(buildpath); + return 3; /* path didn't exist, tried to create, failed */ + } + created_dir = TRUE; + } else if (!S_ISDIR(G.statbuf.st_mode)) { + Info(slide, 1, ((char *)slide, + "checkdir error: %s exists but is not directory\n\ + unable to process %s.\n", buildpath, G.filename)); + free(buildpath); + return 3; /* path existed but wasn't dir */ + } + if (too_long) { + Info(slide, 1, ((char *)slide, + "checkdir error: path too long: %s\n", buildpath)); + free(buildpath); + return 4; /* no room for filenames: fatal */ + } + *end++ = '/'; + *end = '\0'; + Trace((stderr, "buildpath now = [%s]\n", buildpath)); + return 0; + + } /* end if (FUNCTION == APPEND_DIR) */ + +/*--------------------------------------------------------------------------- + GETPATH: copy full path to the string pointed at by pathcomp, and free + buildpath. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == GETPATH) { + strcpy(pathcomp, buildpath); + Trace((stderr, "getting and freeing path [%s]\n", pathcomp)); + free(buildpath); + buildpath = end = (char *)NULL; + return 0; + } + +/*--------------------------------------------------------------------------- + APPEND_NAME: assume the path component is the filename; append it and + return without checking for existence. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_NAME) { +#ifdef SHORT_NAMES + char *old_end = end; +#endif + + Trace((stderr, "appending filename [%s]\n", pathcomp)); + while ((*end = *pathcomp++) != '\0') { + ++end; +#ifdef SHORT_NAMES /* truncate name at 14 characters, typically */ + if ((end-old_end) > FILENAME_MAX) /* GRR: proper constant? */ + *(end = old_end + FILENAME_MAX) = '\0'; +#endif + if ((end-buildpath) >= FILNAMSIZ) { + *--end = '\0'; + Info(slide, 0x201, ((char *)slide, + "checkdir warning: path too long; truncating\n\ + %s\n -> %s\n", G.filename, buildpath)); + return 1; /* filename truncated */ + } + } + Trace((stderr, "buildpath now = [%s]\n", buildpath)); + return 0; /* could check for existence here, prompt for new name... */ + } + +/*--------------------------------------------------------------------------- + INIT: allocate and initialize buffer space for the file currently being + extracted. If file was renamed with an absolute path, don't prepend the + extract-to path. + ---------------------------------------------------------------------------*/ + +/* GRR: for VMS and TOPS-20, add up to 13 to strlen */ + + if (FUNCTION == INIT) { + Trace((stderr, "initializing buildpath to ")); +#ifdef ACORN_FTYPE_NFS + if ((buildpath = (char *)malloc(strlen(G.filename)+rootlen+ + (uO.acorn_nfs_ext ? 5 : 1))) +#else + if ((buildpath = (char *)malloc(strlen(G.filename)+rootlen+1)) +#endif + == (char *)NULL) + return 10; + if ((rootlen > 0) && !renamed_fullpath) { + strcpy(buildpath, rootpath); + end = buildpath + rootlen; + } else { + *buildpath = '\0'; + end = buildpath; + } + Trace((stderr, "[%s]\n", buildpath)); + return 0; + } + +/*--------------------------------------------------------------------------- + ROOT: if appropriate, store the path in rootpath and create it if neces- + sary; else assume it's a zipfile member and return. This path segment + gets used in extracting all members from every zipfile specified on the + command line. + ---------------------------------------------------------------------------*/ + +#if (!defined(SFX) || defined(SFX_EXDIR)) + if (FUNCTION == ROOT) { + Trace((stderr, "initializing root path to [%s]\n", pathcomp)); + if (pathcomp == (char *)NULL) { + rootlen = 0; + return 0; + } + if ((rootlen = strlen(pathcomp)) > 0) { + if (pathcomp[rootlen-1] == '/') { + pathcomp[--rootlen] = '\0'; + } + if (rootlen > 0 && (stat(pathcomp, &G.statbuf) || + !S_ISDIR(G.statbuf.st_mode))) /* path does not exist */ + { + if (!G.create_dirs /* || iswild(pathcomp) */ ) { + rootlen = 0; + return 2; /* skip (or treat as stored file) */ + } + /* create the directory (could add loop here to scan pathcomp + * and create more than one level, but why really necessary?) */ + if (mkdir(pathcomp, 0777) == -1) { + Info(slide, 1, ((char *)slide, + "checkdir: cannot create extraction directory: %s\n", + pathcomp)); + rootlen = 0; /* path didn't exist, tried to create, and */ + return 3; /* failed: file exists, or 2+ levels required */ + } + } + if ((rootpath = (char *)malloc(rootlen+2)) == (char *)NULL) { + rootlen = 0; + return 10; + } + strcpy(rootpath, pathcomp); + rootpath[rootlen++] = '/'; + rootpath[rootlen] = '\0'; + Trace((stderr, "rootpath now = [%s]\n", rootpath)); + } + return 0; + } +#endif /* !SFX || SFX_EXDIR */ + +/*--------------------------------------------------------------------------- + END: free rootpath, immediately prior to program exit. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == END) { + Trace((stderr, "freeing rootpath\n")); + if (rootlen > 0) { + free(rootpath); + rootlen = 0; + } + return 0; + } + + return 99; /* should never reach */ + +} /* end function checkdir() */ + + + + + +#ifdef NO_MKDIR + +/********************/ +/* Function mkdir() */ +/********************/ + +int mkdir(path, mode) + char *path; + int mode; /* ignored */ +/* + * returns: 0 - successful + * -1 - failed (errno not set, however) + */ +{ + char command[FILNAMSIZ+40]; /* buffer for system() call */ + + /* GRR 930416: added single quotes around path to avoid bug with + * creating directories with ampersands in name; not yet tested */ + sprintf(command, "IFS=\" \t\n\" /bin/mkdir '%s' 2>/dev/null", path); + if (system(command)) + return -1; + return 0; +} + +#endif /* NO_MKDIR */ + + + + + +#if 0 +#ifdef MORE + +/**************************/ +/* Function screenlines() */ +/**************************/ + +int screenlines() +{ + char *envptr, *getenv(); + int n; + + /* GRR: this is overly simplistic; should use winsize struct and + * appropriate TIOCGWINSZ ioctl(), assuming exists on enough systems + */ + envptr = getenv("LINES"); + if (envptr == (char *)NULL || (n = atoi(envptr)) < 5) + return 24; /* VT-100 assumed to be minimal hardware */ + else + return n; +} + +#endif /* MORE */ +#endif /* 0 */ + + + + + +#ifndef MTS + +/****************************/ +/* Function close_outfile() */ +/****************************/ + +void close_outfile(__G) /* GRR: change to return PK-style warning level */ + __GDEF +{ + iztimes zt; + ush z_uidgid[2]; + unsigned eb_izux_flg; + +/*--------------------------------------------------------------------------- + If symbolic links are supported, allocate a storage area, put the uncom- + pressed "data" in it, and create the link. Since we know it's a symbolic + link to start with, we shouldn't have to worry about overflowing unsigned + ints with unsigned longs. + ---------------------------------------------------------------------------*/ + +#ifdef SYMLINKS + if (G.symlnk) { + unsigned ucsize = (unsigned)G.lrec.ucsize; + char *linktarget = (char *)malloc((unsigned)G.lrec.ucsize+1); + + fclose(G.outfile); /* close "data" file... */ + G.outfile = fopen(G.filename, FOPR); /* ...and reopen for reading */ + if (!linktarget || fread(linktarget, 1, ucsize, G.outfile) != + (int)ucsize) + { + Info(slide, 0x201, ((char *)slide, + "warning: symbolic link (%s) failed\n", G.filename)); + if (linktarget) + free(linktarget); + fclose(G.outfile); + return; + } + fclose(G.outfile); /* close "data" file for good... */ + unlink(G.filename); /* ...and delete it */ + linktarget[ucsize] = '\0'; + if (QCOND2) + Info(slide, 0, ((char *)slide, "-> %s ", linktarget)); + if (symlink(linktarget, G.filename)) /* create the real link */ + perror("symlink error"); + free(linktarget); + return; /* can't set time on symlinks */ + } +#endif /* SYMLINKS */ + + fclose(G.outfile); +#ifdef QLZIP + if (G.extra_field) { + static void qlfix OF((__GPRO__ uch *ef_ptr, unsigned ef_len)); + + qlfix(__G__ G.extra_field, G.lrec.extra_field_length); + } +#endif + +/*--------------------------------------------------------------------------- + Convert from MSDOS-format local time and date to Unix-format 32-bit GMT + time: adjust base year from 1980 to 1970, do usual conversions from + yy/mm/dd hh:mm:ss to elapsed seconds, and account for timezone and day- + light savings time differences. If we have a Unix extra field, however, + we're laughing: both mtime and atime are ours. On the other hand, we + then have to check for restoration of UID/GID. + ---------------------------------------------------------------------------*/ + + eb_izux_flg = (G.extra_field ? ef_scan_for_izux(G.extra_field, + G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime, +#ifdef IZ_CHECK_TZ + (G.tz_is_valid ? &zt : NULL), +#else + &zt, +#endif + z_uidgid) : 0); + if (eb_izux_flg & EB_UT_FL_MTIME) { + TTrace((stderr, "\nclose_outfile: Unix e.f. modif. time = %ld\n", + zt.mtime)); + } else { + zt.mtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime); + } + if (eb_izux_flg & EB_UT_FL_ATIME) { + TTrace((stderr, "close_outfile: Unix e.f. access time = %ld\n", + zt.atime)); + } else { + zt.atime = zt.mtime; + TTrace((stderr, "\nclose_outfile: modification/access times = %ld\n", + zt.mtime)); + } + + /* if -X option was specified and we have UID/GID info, restore it */ + if (uO.X_flag && eb_izux_flg & EB_UX2_VALID) { + TTrace((stderr, "close_outfile: restoring Unix UID/GID info\n")); + if (chown(G.filename, (uid_t)z_uidgid[0], (gid_t)z_uidgid[1])) + { + if (uO.qflag) + Info(slide, 0x201, ((char *)slide, + "warning: cannot set UID %d and/or GID %d for %s\n", + z_uidgid[0], z_uidgid[1], G.filename)); + else + Info(slide, 0x201, ((char *)slide, + " (warning) cannot set UID %d and/or GID %d", + z_uidgid[0], z_uidgid[1])); + } + } + + /* set the file's access and modification times */ + if (utime(G.filename, (ztimbuf *)&zt)) { +#ifdef AOS_VS + if (uO.qflag) + Info(slide, 0x201, ((char *)slide, "... cannot set time for %s\n", + G.filename)); + else + Info(slide, 0x201, ((char *)slide, "... cannot set time")); +#else + if (uO.qflag) + Info(slide, 0x201, ((char *)slide, + "warning: cannot set times for %s\n", G.filename)); + else + Info(slide, 0x201, ((char *)slide, + " (warning) cannot set times")); +#endif /* ?AOS_VS */ + } + +/*--------------------------------------------------------------------------- + Change the file permissions from default ones to those stored in the + zipfile. + ---------------------------------------------------------------------------*/ + +#ifndef NO_CHMOD + if (chmod(G.filename, 0xffff & G.pInfo->file_attr)) + perror("chmod (file attributes) error"); +#endif + +} /* end function close_outfile() */ + +#endif /* !MTS */ + + + + +#ifdef SET_DIR_ATTRIB +/* messages of code for setting directory attributes */ +static char Far DirlistUidGidFailed[] = + "warning: cannot set UID %d and/or GID %d for %s\n"; +static char Far DirlistUtimeFailed[] = + "warning: cannot set modification, access times for %s\n"; +# ifndef NO_CHMOD + static char Far DirlistChmodFailed[] = + "warning: cannot set permissions for %s\n"; +# endif + + +int set_direc_attribs(__G__ d) + __GDEF + dirtime *d; +{ + int errval = PK_OK; + + if (d->have_uidgid && + chown(d->fn, (uid_t)d->uidgid[0], (gid_t)d->uidgid[1])) + { + Info(slide, 0x201, ((char *)slide, + LoadFarString(DirlistUidGidFailed), + d->uidgid[0], d->uidgid[1], d->fn)); + if (!errval) + errval = PK_WARN; + } + if (utime(d->fn, &d->u.t2)) { + Info(slide, 0x201, ((char *)slide, + LoadFarString(DirlistUtimeFailed), d->fn)); + if (!errval) + errval = PK_WARN; + } +#ifndef NO_CHMOD + if (chmod(d->fn, 0xffff & d->perms)) { + Info(slide, 0x201, ((char *)slide, + LoadFarString(DirlistChmodFailed), d->fn)); + /* perror("chmod (file attributes) error"); */ + if (!errval) + errval = PK_WARN; + } +#endif /* !NO_CHMOD */ + return errval; +} /* end function set_directory_attributes() */ + +#endif /* SET_DIR_ATTRIB */ + + + + +#ifdef TIMESTAMP + +/***************************/ +/* Function stamp_file() */ +/***************************/ + +int stamp_file(fname, modtime) + ZCONST char *fname; + time_t modtime; +{ + ztimbuf tp; + + tp.modtime = tp.actime = modtime; + return (utime(fname, &tp)); + +} /* end function stamp_file() */ + +#endif /* TIMESTAMP */ + + + + +#ifndef SFX + +/************************/ +/* Function version() */ +/************************/ + +void version(__G) + __GDEF +{ +#if defined(CRAY) || defined(NX_CURRENT_COMPILER_RELEASE) || defined(NetBSD) + char buf1[40]; +#if defined(CRAY) || defined(NX_CURRENT_COMPILER_RELEASE) + char buf2[40]; +#endif +#endif + + /* Pyramid, NeXT have problems with huge macro expansion, too: no Info() */ + sprintf((char *)slide, LoadFarString(CompiledWith), + +#ifdef __GNUC__ +# ifdef NX_CURRENT_COMPILER_RELEASE + (sprintf(buf1, "NeXT DevKit %d.%02d ", NX_CURRENT_COMPILER_RELEASE/100, + NX_CURRENT_COMPILER_RELEASE%100), buf1), + (strlen(__VERSION__) > 8)? "(gcc)" : + (sprintf(buf2, "(gcc %s)", __VERSION__), buf2), +# else + "gcc ", __VERSION__, +# endif +#else +# if defined(CRAY) && defined(_RELEASE) + "cc ", (sprintf(buf1, "version %d", _RELEASE), buf1), +# else +# ifdef __VERSION__ + "cc ", __VERSION__, +# else + "cc", "", +# endif +# endif +#endif + + "Unix", + +#if defined(sgi) || defined(__sgi) + " (Silicon Graphics IRIX)", +#else +#ifdef sun +# ifdef sparc +# ifdef __SVR4 + " (Sun SPARC/Solaris)", +# else /* may or may not be SunOS */ + " (Sun SPARC)", +# endif +# else +# if defined(sun386) || defined(i386) + " (Sun 386i)", +# else +# if defined(mc68020) || defined(__mc68020__) + " (Sun 3)", +# else /* mc68010 or mc68000: Sun 2 or earlier */ + " (Sun 2)", +# endif +# endif +# endif +#else +#ifdef __hpux + " (HP/UX)", +#else +#ifdef __osf__ + " (DEC OSF/1)", +#else +#ifdef _AIX + " (IBM AIX)", +#else +#ifdef aiws + " (IBM RT/AIX)", +#else +#if defined(CRAY) || defined(cray) +# ifdef _UNICOS + (sprintf(buf2, " (Cray UNICOS release %d)", _UNICOS), buf2), +# else + " (Cray UNICOS)", +# endif +#else +#if defined(uts) || defined(UTS) + " (Amdahl UTS)", +#else +#ifdef NeXT +# ifdef mc68000 + " (NeXTStep/black)", +# else + " (NeXTStep for Intel)", +# endif +#else /* the next dozen or so are somewhat order-dependent */ +#ifdef LINUX +# ifdef __ELF__ + " (Linux ELF)", +# else + " (Linux a.out)", +# endif +#else +#ifdef MINIX + " (Minix)", +#else +#ifdef M_UNIX + " (SCO Unix)", +#else +#ifdef M_XENIX + " (SCO Xenix)", +#else +#ifdef __NetBSD__ +# ifdef NetBSD0_8 + (sprintf(buf1, " (NetBSD 0.8%c)", (char)(NetBSD0_8 - 1 + 'A')), buf1), +# else +# ifdef NetBSD0_9 + (sprintf(buf1, " (NetBSD 0.9%c)", (char)(NetBSD0_9 - 1 + 'A')), buf1), +# else +# ifdef NetBSD1_0 + (sprintf(buf1, " (NetBSD 1.0%c)", (char)(NetBSD1_0 - 1 + 'A')), buf1), +# else + (BSD4_4 == 0.5)? " (NetBSD before 0.9)" : " (NetBSD 1.1 or later)", +# endif +# endif +# endif +#else +#ifdef __FreeBSD__ + (BSD4_4 == 0.5)? " (FreeBSD 1.x)" : " (FreeBSD 2.0 or later)", +#else +#ifdef __bsdi__ + (BSD4_4 == 0.5)? " (BSD/386 1.0)" : " (BSD/386 1.1 or later)", +#else +#ifdef __386BSD__ + (BSD4_4 == 1)? " (386BSD, post-4.4 release)" : " (386BSD)", +#else +#if defined(i486) || defined(__i486) || defined(__i486__) + " (Intel 486)", +#else +#if defined(i386) || defined(__i386) || defined(__i386__) + " (Intel 386)", +#else +#ifdef pyr + " (Pyramid)", +#else +#ifdef ultrix +# ifdef mips + " (DEC/MIPS)", +# else +# ifdef vax + " (DEC/VAX)", +# else /* __alpha? */ + " (DEC/Alpha)", +# endif +# endif +#else +#ifdef gould + " (Gould)", +#else +#ifdef MTS + " (MTS)", +#else +#ifdef __convexc__ + " (Convex)", +#else +#ifdef __QNX__ + " (QNX 4)", +#else +#ifdef __QNXNTO__ + " (QNX Neutrino)", +#else +#ifdef Lynx + " (LynxOS)", +#else + "", +#endif /* Lynx */ +#endif /* QNX Neutrino */ +#endif /* QNX 4 */ +#endif /* Convex */ +#endif /* MTS */ +#endif /* Gould */ +#endif /* DEC */ +#endif /* Pyramid */ +#endif /* 386 */ +#endif /* 486 */ +#endif /* 386BSD */ +#endif /* BSDI BSD/386 */ +#endif /* NetBSD */ +#endif /* FreeBSD */ +#endif /* SCO Xenix */ +#endif /* SCO Unix */ +#endif /* Minix */ +#endif /* Linux */ +#endif /* NeXT */ +#endif /* Amdahl */ +#endif /* Cray */ +#endif /* RT/AIX */ +#endif /* AIX */ +#endif /* OSF/1 */ +#endif /* HP/UX */ +#endif /* Sun */ +#endif /* SGI */ + +#ifdef __DATE__ + " on ", __DATE__ +#else + "", "" +#endif + ); + + (*G.message)((zvoid *)&G, slide, (ulg)strlen((char *)slide), 0); + +} /* end function version() */ + +#endif /* !SFX */ + + + + +#ifdef QLZIP + +struct qdirect { + long d_length __attribute__ ((packed)); /* file length */ + unsigned char d_access __attribute__ ((packed)); /* file access type */ + unsigned char d_type __attribute__ ((packed)); /* file type */ + long d_datalen __attribute__ ((packed)); /* data length */ + long d_reserved __attribute__ ((packed));/* Unused */ + short d_szname __attribute__ ((packed)); /* size of name */ + char d_name[36] __attribute__ ((packed));/* name area */ + long d_update __attribute__ ((packed)); /* last update */ + long d_refdate __attribute__ ((packed)); + long d_backup __attribute__ ((packed)); /* EOD */ +}; + +#define LONGID "QDOS02" +#define EXTRALEN (sizeof(struct qdirect) + 8) +#define JBLONGID "QZHD" +#define JBEXTRALEN (sizeof(jbextra) - 4 * sizeof(char)) + +typedef struct { + char eb_header[4] __attribute__ ((packed)); /* place_holder */ + char longid[8] __attribute__ ((packed)); + struct qdirect header __attribute__ ((packed)); +} qdosextra; + +typedef struct { + char eb_header[4]; /* place_holder */ + char longid[4]; + struct qdirect header; +} jbextra; + + + +/* The following two functions SH() and LG() convert big-endian short + * and long numbers into native byte order. They are some kind of + * counterpart to the generic UnZip's makeword() and makelong() functions. + */ +static ush SH(ush val) +{ + uch swapbuf[2]; + + swapbuf[1] = (uch)(val & 0xff); + swapbuf[0] = (uch)(val >> 8); + return (*(ush *)swapbuf); +} + + + +static ulg LG(ulg val) +{ + /* convert the big-endian unsigned long number `val' to the machine + * dependant representation + */ + ush swapbuf[2]; + + swapbuf[1] = SH((ush)(val & 0xffff)); + swapbuf[0] = SH((ush)(val >> 16)); + return (*(ulg *)swapbuf); +} + + + +static void qlfix(__G__ ef_ptr, ef_len) + __GDEF + uch *ef_ptr; + unsigned ef_len; +{ + while (ef_len >= EB_HEADSIZE) + { + unsigned eb_id = makeword(EB_ID + ef_ptr); + unsigned eb_len = makeword(EB_LEN + ef_ptr); + + if (eb_len > (ef_len - EB_HEADSIZE)) { + /* discovered some extra field inconsistency! */ + Trace((stderr, + "qlfix: block length %u > rest ef_size %u\n", eb_len, + ef_len - EB_HEADSIZE)); + break; + } + + switch (eb_id) { + case EF_QDOS: + { + struct _ntc_ + { + long id; + long dlen; + } ntc; + long dlen = 0; + + qdosextra *extra = (qdosextra *)ef_ptr; + jbextra *jbp = (jbextra *)ef_ptr; + + if (!strncmp(extra->longid, LONGID, strlen(LONGID))) + { + if (eb_len != EXTRALEN) + if (uO.qflag) + Info(slide, 0x201, ((char *)slide, + "warning: invalid length in Qdos field for %s\n", + G.filename)); + else + Info(slide, 0x201, ((char *)slide, + "warning: invalid length in Qdos field")); + + if (extra->header.d_type) + { + dlen = extra->header.d_datalen; + } + } + + if (!strncmp(jbp->longid, JBLONGID, strlen(JBLONGID))) + { + if (eb_len != JBEXTRALEN) + if (uO.qflag) + Info(slide, 0x201, ((char *)slide, + "warning: invalid length in QZ field for %s\n", + G.filename)); + else + Info(slide, 0x201, ((char *)slide, + "warning: invalid length in QZ field")); + if(jbp->header.d_type) + { + dlen = jbp->header.d_datalen; + } + } + + if ((long)LG(dlen) > 0) + { + G.outfile = fopen(G.filename,"r+"); + fseek(G.outfile, -8, SEEK_END); + fread(&ntc, 8, 1, G.outfile); + if(ntc.id != *(long *)"XTcc") + { + ntc.id = *(long *)"XTcc"; + ntc.dlen = dlen; + fwrite (&ntc, 8, 1, G.outfile); + } + Info(slide, 0x201, ((char *)slide, "QData = %d", LG(dlen))); + fclose(G.outfile); + } + return; /* finished, cancel further extra field scanning */ + } + + default: + Trace((stderr,"qlfix: unknown extra field block, ID=%d\n", + eb_id)); + } + + /* Skip this extra field block */ + ef_ptr += (eb_len + EB_HEADSIZE); + ef_len -= (eb_len + EB_HEADSIZE); + } +} +#endif /* QLZIP */ + + + + +#ifdef ACORN_FTYPE_NFS + +/* Acorn bits for NFS filetyping */ + +static int isRISCOSexfield(uch *extra_field) +{ + if (extra_field != NULL) { + RO_extra_block *block = (RO_extra_block *)extra_field; + return ( + makeword(block->ID) == EF_SPARK && + (makeword(block->size) == 24 || makeword(block->size) == 20) && + makelong(block->ID_2) == 0x30435241 /* ARC0 */); + } + return FALSE; +} +#endif /* ACORN_FTYPE_NFS */ diff --git a/utils/Install/packzip/unreduce.c b/utils/Install/packzip/unreduce.c new file mode 100644 index 0000000000..4cfb3fec6f --- /dev/null +++ b/utils/Install/packzip/unreduce.c @@ -0,0 +1,230 @@ +/*--------------------------------------------------------------------------- + + unreduce.c + + The Reducing algorithm is actually a combination of two distinct algorithms. + The first algorithm compresses repeated byte sequences, and the second al- + gorithm takes the compressed stream from the first algorithm and applies a + probabilistic compression method. + + * Copyright 1989 Samuel H. Smith; All rights reserved + * + * Do not distribute modified versions without my permission. + * Do not remove or alter this notice or any other copyright notice. + * If you use this in your own program you must distribute source code. + * Do not use any of this in a commercial product. + + See the accompanying file "COPYING" in UnZip source and binary distributions + for further information. This code is NOT used unless USE_SMITH_CODE is + explicitly defined (==> COPYRIGHT_CLEAN is not defined). + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" /* defines COPYRIGHT_CLEAN by default */ + + +#ifndef COPYRIGHT_CLEAN + +/**************************************/ +/* UnReduce Defines, Typedefs, etc. */ +/**************************************/ + +#define DLE 144 + +typedef uch f_array[64]; /* for followers[256][64] */ + + + +/******************************/ +/* UnReduce Local Functions */ +/******************************/ + +static void LoadFollowers OF((__GPRO__ f_array *followers, uch *Slen)); + + + +/*******************************/ +/* UnReduce Global Constants */ +/*******************************/ + +static ZCONST shrint L_table[] = +{0, 0x7f, 0x3f, 0x1f, 0x0f}; + +static ZCONST shrint D_shift[] = +{0, 0x07, 0x06, 0x05, 0x04}; +static ZCONST shrint D_mask[] = +{0, 0x01, 0x03, 0x07, 0x0f}; + +static ZCONST shrint B_table[] = +{8, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8}; + + + + + +/*************************/ +/* Function unreduce() */ +/*************************/ + +void unreduce(__G) /* expand probabilistically reduced data */ + __GDEF +{ + register int lchar = 0; + shrint nchar; + shrint ExState = 0; + shrint V = 0; + shrint Len = 0; + long s = G.ucsize; /* number of bytes left to decompress */ + unsigned w = 0; /* position in output window slide[] */ + unsigned u = 1; /* true if slide[] unflushed */ + uch Slen[256]; + + f_array *followers = (f_array *)(slide + 0x4000); + int factor = G.lrec.compression_method - 1; + + LoadFollowers(__G__ followers, Slen); + + while (s > 0 /* && (!zipeof) */) { + if (Slen[lchar] == 0) + READBITS(8, nchar) /* ; */ + else { + READBITS(1, nchar) /* ; */ + if (nchar != 0) + READBITS(8, nchar) /* ; */ + else { + shrint follower; + int bitsneeded = B_table[Slen[lchar]]; + + READBITS(bitsneeded, follower) /* ; */ + nchar = followers[lchar][follower]; + } + } + /* expand the resulting byte */ + switch (ExState) { + + case 0: + if (nchar != DLE) { + s--; + slide[w++] = (uch)nchar; + if (w == 0x4000) { + flush(__G__ slide, (ulg)w, 0); + w = u = 0; + } + } + else + ExState = 1; + break; + + case 1: + if (nchar != 0) { + V = nchar; + Len = V & L_table[factor]; + if (Len == L_table[factor]) + ExState = 2; + else + ExState = 3; + } else { + s--; + slide[w++] = DLE; + if (w == 0x4000) + { + flush(__G__ slide, (ulg)w, 0); + w = u = 0; + } + ExState = 0; + } + break; + + case 2:{ + Len += nchar; + ExState = 3; + } + break; + + case 3:{ + register unsigned e; + register unsigned n = Len + 3; + register unsigned d = w - ((((V >> D_shift[factor]) & + D_mask[factor]) << 8) + nchar + 1); + + s -= n; + do { + n -= (e = (e = 0x4000 - ((d &= 0x3fff) > w ? d : w)) > n ? + n : e); + if (u && w <= d) + { + memzero(slide + w, e); + w += e; + d += e; + } + else + if (w - d < e) /* (assume unsigned comparison) */ + do { /* slow to avoid memcpy() overlap */ + slide[w++] = slide[d++]; + } while (--e); + else + { + memcpy(slide + w, slide + d, e); + w += e; + d += e; + } + if (w == 0x4000) + { + flush(__G__ slide, (ulg)w, 0); + w = u = 0; + } + } while (n); + + ExState = 0; + } + break; + } + + /* store character for next iteration */ + lchar = nchar; + } + + /* flush out slide */ + flush(__G__ slide, (ulg)w, 0); +} + + + + + +/******************************/ +/* Function LoadFollowers() */ +/******************************/ + +static void LoadFollowers(__G__ followers, Slen) + __GDEF + f_array *followers; + uch *Slen; +{ + register int x; + register int i; + + for (x = 255; x >= 0; x--) { + READBITS(6, Slen[x]) /* ; */ + for (i = 0; (uch)i < Slen[x]; i++) + READBITS(8, followers[x][i]) /* ; */ + } +} + +#endif /* !COPYRIGHT_CLEAN */ diff --git a/utils/Install/packzip/unshrink.c b/utils/Install/packzip/unshrink.c new file mode 100644 index 0000000000..287b4baf54 --- /dev/null +++ b/utils/Install/packzip/unshrink.c @@ -0,0 +1,301 @@ +/*--------------------------------------------------------------------------- + + unshrink.c version 1.21 23 Nov 95 + + + NOTE: This code may or may not infringe on the so-called "Welch + patent" owned by Unisys. (From reading the patent, it appears + that a pure LZW decompressor is *not* covered, but this claim has + not been tested in court, and Unisys is reported to believe other- + wise.) It is therefore the responsibility of the user to acquire + whatever license(s) may be required for legal use of this code. + + THE INFO-ZIP GROUP DISCLAIMS ALL LIABILITY FOR USE OF THIS CODE + IN VIOLATION OF APPLICABLE PATENT LAW. + + + Shrinking is basically a dynamic LZW algorithm with allowed code sizes of + up to 13 bits; in addition, there is provision for partial clearing of + leaf nodes. PKWARE uses the special code 256 (decimal) to indicate a + change in code size or a partial clear of the code tree: 256,1 for the + former and 256,2 for the latter. [Note that partial clearing can "orphan" + nodes: the parent-to-be can be cleared before its new child is added, + but the child is added anyway (as an orphan, as though the parent still + existed). When the tree fills up to the point where the parent node is + reused, the orphan is effectively "adopted." Versions prior to 1.05 were + affected more due to greater use of pointers (to children and siblings + as well as parents).] + + This replacement version of unshrink.c was written from scratch. It is + based only on the algorithms described in Mark Nelson's _The Data Compres- + sion Book_ and in Terry Welch's original paper in the June 1984 issue of + IEEE _Computer_; no existing source code, including any in Nelson's book, + was used. + + Memory requirements have been reduced in this version and are now no more + than the original Sam Smith code. This is still larger than any of the + other algorithms: at a minimum, 8K+8K+16K (stack+values+parents) assuming + 16-bit short ints, and this does not even include the output buffer (the + other algorithms leave the uncompressed data in the work area, typically + called slide[]). For machines with a 64KB data space this is a problem, + particularly when text conversion is required and line endings have more + than one character. UnZip's solution is to use two roughly equal halves + of outbuf for the ASCII conversion in such a case; the "unshrink" argument + to flush() signals that this is the case. + + For large-memory machines, a second outbuf is allocated for translations, + but only if unshrinking and only if translations are required. + + | binary mode | text mode + --------------------------------------------------- + big mem | big outbuf | big outbuf + big outbuf2 <- malloc'd here + small mem | small outbuf | half + half small outbuf + + Copyright 1994, 1995 Greg Roelofs. See the accompanying file "COPYING" + in UnZip 5.20 (or later) source or binary distributions. + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" /* defines LZW_CLEAN by default */ + + +#ifndef LZW_CLEAN + +static void partial_clear OF((__GPRO)); + +#ifdef DEBUG +# define OUTDBG(c) \ + if ((c)<32 || (c)>=127) pipeit("\\x%02x",(c)); else { } +#else +# define OUTDBG(c) +#endif + +/* HSIZE is defined as 2^13 (8192) in unzip.h */ +#define BOGUSCODE 256 +#define FLAG_BITS parent /* upper bits of parent[] used as flag bits */ +#define CODE_MASK (HSIZE - 1) /* 0x1fff (lower bits are parent's index) */ +#define FREE_CODE HSIZE /* 0x2000 (code is unused or was cleared) */ +#define HAS_CHILD (HSIZE << 1) /* 0x4000 (code has a child--do not clear) */ + +#define parent G.area.shrink.Parent +#define Value G.area.shrink.value /* "value" conflicts with Pyramid ioctl.h */ +#define stack G.area.shrink.Stack + + +/***********************/ +/* Function unshrink() */ +/***********************/ + +int unshrink(__G) + __GDEF +{ + int offset = (HSIZE - 1); + uch *stacktop = stack + offset; + register uch *newstr; + int codesize=9, len, KwKwK, error; + shrint code, oldcode, freecode, curcode; + shrint lastfreecode; + unsigned int outbufsiz; +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + /* Normally realbuf and outbuf will be the same. However, if the data + * are redirected to a large memory buffer, realbuf will point to the + * new location while outbuf will remain pointing to the malloc'd + * memory buffer. */ + uch *realbuf = G.outbuf; +#else +# define realbuf G.outbuf +#endif + + +/*--------------------------------------------------------------------------- + Initialize various variables. + ---------------------------------------------------------------------------*/ + + lastfreecode = BOGUSCODE; + +#ifndef VMS /* VMS uses its own buffer scheme for textmode flush(). */ +#ifndef SMALL_MEM + /* non-memory-limited machines: allocate second (large) buffer for + * textmode conversion in flush(), but only if needed */ + if (G.pInfo->textmode && !G.outbuf2 && + (G.outbuf2 = (uch *)malloc(TRANSBUFSIZ)) == (uch *)NULL) + return PK_MEM3; +#endif +#endif /* !VMS */ + + for (code = 0; code < BOGUSCODE; ++code) { + Value[code] = (uch)code; + parent[code] = BOGUSCODE; + } + for (code = BOGUSCODE+1; code < HSIZE; ++code) + parent[code] = FREE_CODE; + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { /* use normal outbuf unless we're a DLL routine */ + realbuf = G.redirect_buffer; + outbufsiz = G.redirect_size; + } else +#endif +#ifdef DLL + if (G.pInfo->textmode && !G.redirect_data) +#else + if (G.pInfo->textmode) +#endif + outbufsiz = RAWBUFSIZ; + else + outbufsiz = OUTBUFSIZ; + G.outptr = realbuf; + G.outcnt = 0L; + +/*--------------------------------------------------------------------------- + Get and output first code, then loop over remaining ones. + ---------------------------------------------------------------------------*/ + + READBITS(codesize, oldcode) + if (!G.zipeof) { + *G.outptr++ = (uch)oldcode; + OUTDBG((uch)oldcode) + ++G.outcnt; + } + + do { + READBITS(codesize, code) + if (G.zipeof) + break; + if (code == BOGUSCODE) { /* possible to have consecutive escapes? */ + READBITS(codesize, code) + if (code == 1) { + ++codesize; + Trace((stderr, " (codesize now %d bits)\n", codesize)); + } else if (code == 2) { + Trace((stderr, " (partial clear code)\n")); + partial_clear(__G); /* clear leafs (nodes with no children) */ + Trace((stderr, " (done with partial clear)\n")); + lastfreecode = BOGUSCODE; /* reset start of free-node search */ + } + continue; + } + + /*----------------------------------------------------------------------- + Translate code: traverse tree from leaf back to root. + -----------------------------------------------------------------------*/ + + newstr = stacktop; + curcode = code; + + if (parent[curcode] == FREE_CODE) { + /* or (FLAG_BITS[curcode] & FREE_CODE)? */ + KwKwK = TRUE; + Trace((stderr, " (found a KwKwK code %d; oldcode = %d)\n", code, + oldcode)); + --newstr; /* last character will be same as first character */ + curcode = oldcode; + } else + KwKwK = FALSE; + + do { + *newstr-- = Value[curcode]; + curcode = (shrint)(parent[curcode] & CODE_MASK); + } while (curcode != BOGUSCODE); + + len = (int)(stacktop - newstr++); + if (KwKwK) + *stacktop = *newstr; + + /*----------------------------------------------------------------------- + Write expanded string in reverse order to output buffer. + -----------------------------------------------------------------------*/ + + Trace((stderr, "code %4d; oldcode %4d; char %3d (%c); string [", code, + oldcode, (int)(*newstr), (*newstr<32 || *newstr>=127)? ' ':*newstr)); + + { + register uch *p; + + for (p = newstr; p < newstr+len; ++p) { + *G.outptr++ = *p; + OUTDBG(*p) + if (++G.outcnt == outbufsiz) { + Trace((stderr, "doing flush(), outcnt = %lu\n", G.outcnt)); + if ((error = flush(__G__ realbuf, G.outcnt, TRUE)) != 0) + pipeit("unshrink: flush() error (%d)\n", + error); + Trace((stderr, "done with flush()\n")); + G.outptr = realbuf; + G.outcnt = 0L; + } + } + } + + /*----------------------------------------------------------------------- + Add new leaf (first character of newstr) to tree as child of oldcode. + -----------------------------------------------------------------------*/ + + /* search for freecode */ + freecode = (shrint)(lastfreecode + 1); + /* add if-test before loop for speed? */ + while (parent[freecode] != FREE_CODE) + ++freecode; + lastfreecode = freecode; + Trace((stderr, "]; newcode %d\n", freecode)); + + Value[freecode] = *newstr; + parent[freecode] = oldcode; + oldcode = code; + + } while (!G.zipeof); + +/*--------------------------------------------------------------------------- + Flush any remaining data and return to sender... + ---------------------------------------------------------------------------*/ + + if (G.outcnt > 0L) { + Trace((stderr, "doing final flush(), outcnt = %lu\n", G.outcnt)); + if ((error = flush(__G__ realbuf, G.outcnt, TRUE)) != 0) + pipeit("unshrink: flush() error (%d)\n", error); + Trace((stderr, "done with flush()\n")); + } + + return PK_OK; + +} /* end function unshrink() */ + + + + + +/****************************/ +/* Function partial_clear() */ /* no longer recursive... */ +/****************************/ + +static void partial_clear(__G) + __GDEF +{ + register shrint code; + + /* clear all nodes which have no children (i.e., leaf nodes only) */ + + /* first loop: mark each parent as such */ + for (code = BOGUSCODE+1; code < HSIZE; ++code) { + register shrint cparent = (shrint)(parent[code] & CODE_MASK); + + if (cparent > BOGUSCODE && cparent != FREE_CODE) + FLAG_BITS[cparent] |= HAS_CHILD; /* set parent's child-bit */ + } + + /* second loop: clear all nodes *not* marked as parents; reset flag bits */ + for (code = BOGUSCODE+1; code < HSIZE; ++code) { + if (FLAG_BITS[code] & HAS_CHILD) /* just clear child-bit */ + FLAG_BITS[code] &= ~HAS_CHILD; + else { /* leaf: lose it */ + Trace((stderr, "%d\n", code)); + parent[code] = FREE_CODE; + } + } + + return; +} + +#endif /* !LZW_CLEAN */ diff --git a/utils/Install/packzip/unzip.c b/utils/Install/packzip/unzip.c new file mode 100644 index 0000000000..feada08bfc --- /dev/null +++ b/utils/Install/packzip/unzip.c @@ -0,0 +1,1744 @@ +/*--------------------------------------------------------------------------- + + unzip.c + + UnZip - a zipfile extraction utility. See below for make instructions, or + read the comments in Makefile and the various Contents files for more de- + tailed explanations. To report a bug, send a *complete* description to + Zip-Bugs@lists.wku.edu; include machine type, operating system and ver- + sion, compiler and version, and reasonably detailed error messages or prob- + lem report. To join Info-ZIP, see the instructions in README. + + UnZip 5.x is a greatly expanded and partially rewritten successor to 4.x, + which in turn was almost a complete rewrite of version 3.x. For a detailed + revision history, see UnzpHist.zip at quest.jpl.nasa.gov. For a list of + the many (near infinite) contributors, see "CONTRIBS" in the UnZip source + distribution. + + --------------------------------------------------------------------------- + + [from original zipinfo.c] + + This program reads great gobs of totally nifty information, including the + central directory stuff, from ZIP archives ("zipfiles" for short). It + started as just a testbed for fooling with zipfiles, but at this point it + is actually a useful utility. It also became the basis for the rewrite of + UnZip (3.16 -> 4.0), using the central directory for processing rather than + the individual (local) file headers. + + As of ZipInfo v2.0 and UnZip v5.1, the two programs are combined into one. + If the executable is named "unzip" (or "unzip.exe", depending), it behaves + like UnZip by default; if it is named "zipinfo" or "ii", it behaves like + ZipInfo. The ZipInfo behavior may also be triggered by use of unzip's -Z + option; for example, "unzip -Z [zipinfo_options] archive.zip". + + Another dandy product from your buddies at Newtware! + + Author: Greg Roelofs, newt@pobox.com, http://pobox.com/~newt/ + 23 August 1990 -> April 1997 + + --------------------------------------------------------------------------- + + Version: unzip5??.{tar.Z | tar.gz | zip} for Unix, VMS, OS/2, MS-DOS, Amiga, + Atari, Windows 3.x/95/NT/CE, Macintosh, Human68K, Acorn RISC OS, + BeOS, SMS/QDOS, VM/CMS, MVS, AOS/VS and TOPS-20. Decryption + requires sources in zcrypt28.zip. See the accompanying "WHERE" + file in the main source distribution for ftp, uucp, BBS and mail- + server sites, or see http://www.cdrom.com/pub/infozip/UnZip.html . + + Copyrights: see accompanying file "COPYING" in UnZip source distribution. + (This software is free but NOT IN THE PUBLIC DOMAIN. There + are some restrictions on commercial use.) + + ---------------------------------------------------------------------------*/ + + + +#define UNZIP_C +#define UNZIP_INTERNAL +#include "unzip.h" /* includes, typedefs, macros, prototypes, etc. */ +#include "crypt.h" +#include "version.h" + +#ifndef WINDLL /* The WINDLL port uses windll/windll.c instead... */ + +/*******************/ +/* Local Functions */ +/*******************/ + +#ifndef SFX +static void show_version_info OF((__GPRO)); +#endif + + +/*************/ +/* Constants */ +/*************/ + +#include "consts.h" /* all constant global variables are in here */ + /* (non-constant globals were moved to globals.c) */ + +/* constant local variables: */ + +#ifndef SFX + static ZCONST char Far EnvUnZip[] = ENV_UNZIP; + static ZCONST char Far EnvUnZip2[] = ENV_UNZIP2; + static ZCONST char Far EnvZipInfo[] = ENV_ZIPINFO; + static ZCONST char Far EnvZipInfo2[] = ENV_ZIPINFO2; +#ifdef RISCOS + static ZCONST char Far EnvUnZipExts[] = ENV_UNZIPEXTS; +#endif /* RISCOS */ +#endif + +#if (!defined(SFX) || defined(SFX_EXDIR)) + static ZCONST char Far NotExtracting[] = + "caution: not extracting; -d ignored\n"; + static ZCONST char Far MustGiveExdir[] = + "error: must specify directory to which to extract with -d option\n"; + static ZCONST char Far OnlyOneExdir[] = + "error: -d option used more than once (only one exdir allowed)\n"; +#endif + +#if CRYPT + static ZCONST char Far MustGivePasswd[] = + "error: must give decryption password with -P option\n"; +#endif + +#ifndef SFX + static ZCONST char Far Zfirst[] = + "error: -Z must be first option for ZipInfo mode (check UNZIP variable?)\n"; +#endif +static ZCONST char Far InvalidOptionsMsg[] = "error:\ + -fn or any combination of -c, -l, -p, -t, -u and -v options invalid\n"; +static ZCONST char Far IgnoreOOptionMsg[] = + "caution: both -n and -o specified; ignoring -o\n"; + +/* usage() strings */ +#ifndef SFX +#ifdef VMS + static ZCONST char Far Example3[] = "vms.c"; + static ZCONST char Far Example2[] = " unzip\ + \"-V\" foo \"Bar\" => must quote uppercase options and filenames in VMS\n"; +#else /* !VMS */ + static ZCONST char Far Example3[] = "ReadMe"; +#ifdef RISCOS + static ZCONST char Far Example2[] = +" unzip foo -d RAM:$ => extract all files from foo into RAMDisc\n"; +#else /* !RISCOS */ +#if (defined(OS2) || (defined(DOS_FLX_OS2_W32) && defined(MORE))) + static ZCONST char Far Example2[] = + ""; /* no room: too many local3[] items */ +#else /* !OS2 */ +#ifdef MACOS + static ZCONST char Far Example2[] = ""; /* not needed */ +#else /* !MACOS */ + static ZCONST char Far Example2[] = " \ + unzip -p foo | more => send contents of foo.zip via pipe into program more\n"; +#endif /* ?MACOS */ +#endif /* ?OS2 */ +#endif /* ?RISCOS */ +#endif /* ?VMS */ + +/* local1[]: command options */ +#if (defined(DLL) && defined(API_DOC)) + static ZCONST char Far local1[] = + " -A print extended help for API functions"; +#else /* !(DLL && API_DOC) */ + static ZCONST char Far local1[] = ""; +#endif /* ?(DLL && API_DOC) */ + +/* local2[] and local3[]: modifier options */ +#ifdef DOS_FLX_OS2_W32 +#ifdef FLEXOS + static ZCONST char Far local2[] = ""; +#else + static ZCONST char Far local2[] = + " -$ label removables (-$$ => fixed disks)"; +#endif +#ifdef OS2 +#ifdef MORE + static ZCONST char Far local3[] = "\ + -X restore ACLs if supported -s spaces in filenames => '_'\n\ + -M pipe through \"more\" pager\n"; +#else + static ZCONST char Far local3[] = " \ + -X restore ACLs if supported -s spaces in filenames => '_'\n\n"; +#endif /* ?MORE */ +#else /* !OS2 */ +#ifdef WIN32 +#ifdef MORE + static ZCONST char Far local3[] = "\ + -X restore ACLs (-XX => use privileges) -s spaces in filenames => '_'\n\ + -M pipe through \"more\" pager\n"; +#else + static ZCONST char Far local3[] = " \ + -X restore ACLs (-XX => use privileges) -s spaces in filenames => '_'\n\n"; +#endif /* ?MORE */ +#else /* !WIN32 */ +#ifdef MORE + static ZCONST char Far local3[] = " -\ +M pipe through \"more\" pager -s spaces in filenames => '_'\n\n"; +#else + static ZCONST char Far local3[] = "\ + -s spaces in filenames => '_'\n"; +#endif +#endif /* ?WIN32 */ +#endif /* ?OS2 || ?WIN32 */ +#else /* !DOS_FLX_OS2_W32 */ +#ifdef VMS + static ZCONST char Far local2[] = "\"-X\" restore owner/protection info"; +#ifdef MORE + static ZCONST char Far local3[] = " \ + \"-M\" pipe through \"more\" pager\n"; +#else + static ZCONST char Far local3[] = "\n"; +#endif +#else /* !VMS */ +#if (defined(__BEOS__) || defined(TANDEM) || defined(UNIX)) + static ZCONST char Far local2[] = " -X restore UID/GID info"; +#ifdef MORE + static ZCONST char Far local3[] = "\ + -M pipe through \"more\" pager\n"; +#else + static ZCONST char Far local3[] = "\n"; +#endif +#else /* !(__BEOS__ || TANDEM || UNIX) */ +#ifdef AMIGA + static ZCONST char Far local2[] = " -N restore comments as filenotes"; +#ifdef MORE + static ZCONST char Far local3[] = "\ + -M pipe through \"more\" pager\n"; +#else + static ZCONST char Far local3[] = "\n"; +#endif +#else /* !AMIGA */ +#ifdef MACOS + static ZCONST char Far local2[] = " -E show Mac info during extraction"; + static ZCONST char Far local3[] = " \ + -i ignore filenames in mac extra info -J junk (ignore) Mac extra info\n\n"; +#else /* !MACOS */ +#ifdef MORE + static ZCONST char Far local2[] = " -M pipe through \"more\" pager"; + static ZCONST char Far local3[] = "\n"; +#else + static ZCONST char Far local2[] = ""; /* Atari, Mac, CMS/MVS etc. */ + static ZCONST char Far local3[] = ""; +#endif +#endif /* ?MACOS */ +#endif /* ?AMIGA */ +#endif /* ?(__BEOS__ || TANDEM || UNIX) */ +#endif /* ?VMS */ +#endif /* ?DOS_FLX_OS2_W32 */ +#endif /* !SFX */ + +#ifndef NO_ZIPINFO +#ifdef VMS + static ZCONST char Far ZipInfoExample[] = "* or % (e.g., \"*font-%.zip\")"; +#else + static ZCONST char Far ZipInfoExample[] = "*, ?, [] (e.g., \"[a-j]*.zip\")"; +#endif + +static ZCONST char Far ZipInfoUsageLine1[] = "\ +ZipInfo %d.%d%d%s of %s, by Greg Roelofs and the Info-ZIP group.\n\ +\n\ +List name, date/time, attribute, size, compression method, etc., about files\n\ +in list (excluding those in xlist) contained in the specified .zip archive(s).\ +\n\"file[.zip]\" may be a wildcard name containing %s.\n\n\ + usage: zipinfo [-12smlvChMtTz] file[.zip] [list...] [-x xlist...]\n\ + or: unzip %s-Z%s [-12smlvChMtTz] file[.zip] [list...] [-x xlist...]\n"; + +static ZCONST char Far ZipInfoUsageLine2[] = "\nmain\ + listing-format options: -s short Unix \"ls -l\" format (def.)\n\ + -1 filenames ONLY, one per line -m medium Unix \"ls -l\" format\n\ + -2 just filenames but allow -h/-t/-z -l long Unix \"ls -l\" format\n\ + -v verbose, multi-page format\n"; + +static ZCONST char Far ZipInfoUsageLine3[] = "miscellaneous options:\n\ + -h print header line -t print totals for listed files or for all\n\ + -z print zipfile comment %c-T%c print file times in sortable decimal format\ +\n %c-C%c be case-insensitive %s\ + -x exclude filenames that follow from listing\n"; +#ifdef MORE +#ifdef VMS + static ZCONST char Far ZipInfoUsageLine4[] = + " \"-M\" page output through built-in \"more\"\n"; +#else + static ZCONST char Far ZipInfoUsageLine4[] = + " -M page output through built-in \"more\"\n"; +#endif +#else /* !MORE */ + static ZCONST char Far ZipInfoUsageLine4[] = ""; +#endif /* ?MORE */ +#endif /* !NO_ZIPINFO */ + +#ifdef BETA +# ifdef VMSCLI + /* BetaVersion[] is also used in vms/cmdline.c: do not make it static */ + ZCONST char Far BetaVersion[] = "%s\ + THIS IS STILL A BETA VERSION OF UNZIP%s -- DO NOT DISTRIBUTE.\n\n"; +# else + static ZCONST char Far BetaVersion[] = "%s\ + THIS IS STILL A BETA VERSION OF UNZIP%s -- DO NOT DISTRIBUTE.\n\n"; +# endif +#endif + +#ifdef SFX +# ifdef VMSCLI + /* UnzipSFXBanner[] is also used in vms/cmdline.c: do not make it static */ + ZCONST char Far UnzipSFXBanner[] = +# else + static ZCONST char Far UnzipSFXBanner[] = +# endif + "UnZipSFX %d.%d%d%s of %s, by Info-ZIP (Zip-Bugs@lists.wku.edu).\n"; +# ifdef SFX_EXDIR + static ZCONST char Far UnzipSFXOpts[] = + "Valid options are -tfupcz and -d <exdir>; modifiers are -abjnoqCL%sV%s.\n"; +# else + static ZCONST char Far UnzipSFXOpts[] = + "Valid options are -tfupcz; modifiers are -abjnoqCL%sV%s.\n"; +# endif +#else /* !SFX */ + static ZCONST char Far CompileOptions[] = + "UnZip special compilation options:\n"; + static ZCONST char Far CompileOptFormat[] = "\t%s\n"; + static ZCONST char Far EnvOptions[] = + "\nUnZip and ZipInfo environment options:\n"; + static ZCONST char Far EnvOptFormat[] = "%16s: %s\n"; + static ZCONST char Far None[] = "[none]"; +# ifdef ACORN_FTYPE_NFS + static ZCONST char Far AcornFtypeNFS[] = "ACORN_FTYPE_NFS"; +# endif +# ifdef ASM_CRC + static ZCONST char Far AsmCRC[] = "ASM_CRC"; +# endif +# ifdef ASM_INFLATECODES + static ZCONST char Far AsmInflateCodes[] = "ASM_INFLATECODES"; +# endif +# ifdef CHECK_VERSIONS + static ZCONST char Far Check_Versions[] = "CHECK_VERSIONS"; +# endif +# ifdef COPYRIGHT_CLEAN + static ZCONST char Far Copyright_Clean[] = + "COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)"; +# endif +# ifdef DEBUG + static ZCONST char Far UDebug[] = "DEBUG"; +# endif +# ifdef DEBUG_TIME + static ZCONST char Far DebugTime[] = "DEBUG_TIME"; +# endif +# ifdef DLL + static ZCONST char Far Dll[] = "DLL"; +# endif +# ifdef DOSWILD + static ZCONST char Far DosWild[] = "DOSWILD"; +# endif +# ifdef LZW_CLEAN + static ZCONST char Far LZW_Clean[] = + "LZW_CLEAN (PKZIP/Zip 1.x unshrinking method not supported)"; +# endif +# ifndef MORE + static ZCONST char Far No_More[] = "NO_MORE"; +# endif +# ifdef NO_ZIPINFO + static ZCONST char Far No_ZipInfo[] = "NO_ZIPINFO"; +# endif +# ifdef NTSD_EAS + static ZCONST char Far NTSDExtAttrib[] = "NTSD_EAS"; +# endif +# ifdef OS2_EAS + static ZCONST char Far OS2ExtAttrib[] = "OS2_EAS"; +# endif +# ifdef QLZIP + static ZCONST char Far SMSExFldOnUnix[] = "QLZIP"; +# endif +# ifdef REENTRANT + static ZCONST char Far Reentrant[] = "REENTRANT"; +# endif +# ifdef REGARGS + static ZCONST char Far RegArgs[] = "REGARGS"; +# endif +# ifdef RETURN_CODES + static ZCONST char Far Return_Codes[] = "RETURN_CODES"; +# endif +# ifdef SET_DIR_ATTRIB + static ZCONST char Far SetDirAttrib[] = "SET_DIR_ATTRIB"; +# endif +# ifdef TIMESTAMP + static ZCONST char Far TimeStamp[] = "TIMESTAMP"; +# endif +# ifdef UNIXBACKUP + static ZCONST char Far UnixBackup[] = "UNIXBACKUP"; +# endif +# ifdef USE_EF_UT_TIME + static ZCONST char Far Use_EF_UT_time[] = "USE_EF_UT_TIME"; +# endif +# ifndef LZW_CLEAN + static ZCONST char Far Use_Unshrink[] = + "USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)"; +# endif +# ifndef COPYRIGHT_CLEAN + static ZCONST char Far Use_Smith_Code[] = + "USE_SMITH_CODE (PKZIP 0.9x unreducing method supported)"; +# endif +# ifdef USE_VFAT + static ZCONST char Far Use_VFAT_support[] = "USE_VFAT"; +# endif +# ifdef USE_ZLIB + static ZCONST char Far UseZlib[] = + "USE_ZLIB (compiled with version %s; using version %s)"; +# endif +# ifdef VMS_TEXT_CONV + static ZCONST char Far VmsTextConv[] = "VMS_TEXT_CONV"; +# endif +# ifdef VMSCLI + static ZCONST char Far VmsCLI[] = "VMSCLI"; +# endif +# ifdef VMSWILD + static ZCONST char Far VmsWild[] = "VMSWILD"; +# endif +# if CRYPT +# ifdef PASSWD_FROM_STDIN + static ZCONST char Far PasswdStdin[] = "PASSWD_FROM_STDIN"; +# endif + static ZCONST char Far Decryption[] = + "\t[decryption, version %d.%d%s of %s]\n"; + static ZCONST char Far CryptDate[] = CR_VERSION_DATE; +# endif +# ifndef __RSXNT__ +# ifdef __EMX__ + static ZCONST char Far EnvEMX[] = "EMX"; + static ZCONST char Far EnvEMXOPT[] = "EMXOPT"; +# endif +# if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2))) + static ZCONST char Far EnvGO32[] = "GO32"; + static ZCONST char Far EnvGO32TMP[] = "GO32TMP"; +# endif +# endif /* !__RSXNT__ */ + +#ifdef VMS +/* UnzipUsageLine1[] is also used in vms/cmdline.c: do not make it static */ + ZCONST char Far UnzipUsageLine1[] = "\ +UnZip %d.%d%d%s of %s, by Info-ZIP. For more details see: unzip -v.\n\n"; +#ifdef COPYRIGHT_CLEAN + static ZCONST char Far UnzipUsageLine1v[] = "\ +UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\ +bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.\ +\n\n"; +#else + static ZCONST char Far UnzipUsageLine1v[] = "\ +UnZip %d.%d%d%s of %s, by Info-ZIP. UnReduce (c) 1989 by S. H. Smith.\n\ +Send bug reports to authors at Zip-Bugs@lists.wku.edu; see README for details.\ +\n\n"; +#endif /* ?COPYRIGHT_CLEAN */ +#else /* !VMS */ +#ifdef COPYRIGHT_CLEAN + static ZCONST char Far UnzipUsageLine1[] = "\ +UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\ +bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.\ +\n\n"; +#else + static ZCONST char Far UnzipUsageLine1[] = "\ +UnZip %d.%d%d%s of %s, by Info-ZIP. UnReduce (c) 1989 by S. H. Smith.\n\ +Send bug reports to authors at Zip-Bugs@lists.wku.edu; see README for details.\ +\n\n"; +#endif /* ?COPYRIGHT_CLEAN */ +#define UnzipUsageLine1v UnzipUsageLine1 +#endif /* ?VMS */ + +static ZCONST char Far UnzipUsageLine2v[] = "\ +Latest sources and executables are at ftp://ftp.cdrom.com/pub/infozip/ , as of\ +\nabove date; see http://www.cdrom.com/pub/infozip/UnZip.html for other sites.\ +\n\n"; + +#ifdef MACOS +static ZCONST char Far UnzipUsageLine2[] = "\ +Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-d exdir]\n \ + Default action is to extract files in list, to exdir;\n\ + file[.zip] may be a wildcard. %s\n"; +#else /* !MACOS */ +#ifdef VM_CMS +static ZCONST char Far UnzipUsageLine2[] = "\ +Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d fm]\n \ + Default action is to extract files in list, except those in xlist, to disk fm;\n\ + file[.zip] may be a wildcard. %s\n"; +#else /* !VM_CMS */ +static ZCONST char Far UnzipUsageLine2[] = "\ +Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]\n \ + Default action is to extract files in list, except those in xlist, to exdir;\n\ + file[.zip] may be a wildcard. %s\n"; +#endif /* ?VM_CMS */ +#endif /* ?MACOS */ + +#ifdef NO_ZIPINFO +# define ZIPINFO_MODE_OPTION "" + static ZCONST char Far ZipInfoMode[] = + "(ZipInfo mode is disabled in this version.)"; +#else +# define ZIPINFO_MODE_OPTION "[-Z] " +# ifdef VMS + static ZCONST char Far ZipInfoMode[] = + "\"-Z\" => ZipInfo mode (`unzip \"-Z\"' for usage)."; +# else + static ZCONST char Far ZipInfoMode[] = + "-Z => ZipInfo mode (\"unzip -Z\" for usage)."; +# endif +#endif /* ?NO_ZIPINFO */ + +#ifdef VMS + static ZCONST char Far VMSusageLine2b[] = "\ +=> define foreign command symbol in LOGIN.COM: $ unzip :== $dev:[dir]unzip.exe\ +\n"; +#endif + +#ifdef MACOS +static ZCONST char Far UnzipUsageLine3[] = "\n\ + -d extract files into exdir -l list files (short format)\n\ + -f freshen existing files, create none -t test compressed archive data\n\ + -u update files, create if necessary -z display archive comment\n\ +%s\n"; +#else /* !MACOS */ +#ifdef VM_CMS +static ZCONST char Far UnzipUsageLine3[] = "\n\ + -p extract files to pipe, no messages -l list files (short format)\n\ + -f freshen existing files, create none -t test compressed archive data\n\ + -u update files, create if necessary -z display archive comment\n\ + -x exclude files that follow (in xlist) -d extract files onto disk fm\n\ +%s\n"; +#else /* !VM_CMS */ +static ZCONST char Far UnzipUsageLine3[] = "\n\ + -p extract files to pipe, no messages -l list files (short format)\n\ + -f freshen existing files, create none -t test compressed archive data\n\ + -u update files, create if necessary -z display archive comment\n\ + -x exclude files that follow (in xlist) -d extract files into exdir\n\ +%s\n"; +#endif /* ?VM_CMS */ +#endif /* ?MACOS */ + +static ZCONST char Far UnzipUsageLine4[] = "\ +modifiers: -q quiet mode (-qq => quieter)\n\ + -n never overwrite existing files -a auto-convert any text files\n\ + -o overwrite files WITHOUT prompting -aa treat ALL files as text\n \ + -j junk paths (do not make directories) -v be verbose/print version info\n\ + %c-C%c match filenames case-insensitively %c-L%c make (some) names \ +lowercase\n %-42s %c-V%c retain VMS version numbers\n%s"; + +static ZCONST char Far UnzipUsageLine5[] = "\ +Examples (see unzip.doc for more info):\n\ + unzip data1 -x joe => extract all files except joe from zipfile data1.zip\n\ +%s\ + unzip -fo foo %-6s => quietly replace existing %s if archive file newer\n"; +#endif /* ?SFX */ + + + + + +/*****************************/ +/* main() / UzpMain() stub */ +/*****************************/ + +int include_unpack(char *aname) /* return PK-type error code (except under VMS) */ +{ + int r, argc = 3; + char *argv[4]; + + argv[0] = "install.exe"; + argv[1] = "-v"; + argv[2] = aname; + argv[3] = NULL; + + CONSTRUCTGLOBALS(); + r = unzip(__G__ argc, argv); + DESTROYGLOBALS() + RETURN(r); +} + +void resetglobals(void) { } + +int pipeit(char *format, ...) +{ + return 0; +} + +int confirm(char *format, ...) +{ + return 1; +} + + + +/*******************************/ +/* Primary UnZip entry point */ +/*******************************/ + +int unzip(__G__ argc, argv) + __GDEF + int argc; + char *argv[]; +{ +#ifndef NO_ZIPINFO + char *p; +#endif +#ifdef DOS_FLX_H68_OS2_W32 + int i; +#endif + int retcode, error=FALSE; + +#if (defined(__IBMC__) && defined(__DEBUG_ALLOC__)) + extern void DebugMalloc(void); + + atexit(DebugMalloc); +#endif + +#ifdef MALLOC_WORK + G.area.Slide =(uch *)calloc(8193, sizeof(shrint)+sizeof(uch)+sizeof(uch)); + G.area.shrink.Parent = (shrint *)G.area.Slide; + G.area.shrink.value = G.area.Slide + (sizeof(shrint)*(HSIZE+1)); + G.area.shrink.Stack = G.area.Slide + + (sizeof(shrint) + sizeof(uch))*(HSIZE+1); +#endif + +/*--------------------------------------------------------------------------- + Macintosh initialization code. + ---------------------------------------------------------------------------*/ + +#ifdef MACOS + { + int a; + + for (a = 0; a < 4; ++a) + G.rghCursor[a] = GetCursor(a+128); + G.giCursor = 0; + } +#endif + +/*--------------------------------------------------------------------------- + Human68K initialization code. + ---------------------------------------------------------------------------*/ + +#ifdef __human68k__ + InitTwentyOne(); +#endif + +/*--------------------------------------------------------------------------- + Acorn RISC OS initialization code. + ---------------------------------------------------------------------------*/ + +#ifdef RISCOS + set_prefix(); +#endif + +/*--------------------------------------------------------------------------- + Set signal handler for restoring echo, warn of zipfile corruption, etc. + ---------------------------------------------------------------------------*/ + +#ifdef SIGINT + signal(SIGINT, handler); +#endif +#ifdef SIGTERM /* some systems really have no SIGTERM */ + signal(SIGTERM, handler); +#endif +#ifdef SIGBUS + signal(SIGBUS, handler); +#endif +#ifdef SIGSEGV + signal(SIGSEGV, handler); +#endif + +#if (defined(WIN32) && defined(__RSXNT__)) + for (i = 0 ; i < argc; i++) { + _ISO_INTERN(argv[i]); + } +#endif + +/*--------------------------------------------------------------------------- + First figure out if we're running in UnZip mode or ZipInfo mode, and put + the appropriate environment-variable options into the queue. Then rip + through any command-line options lurking about... + ---------------------------------------------------------------------------*/ + +#ifdef SFX + G.argv0 = argv[0]; +#if (defined(OS2) || defined(WIN32)) + G.zipfn = GetLoadPath(__G);/* non-MSC NT puts path into G.filename[] */ +#else + G.zipfn = G.argv0; +#endif + +#ifdef VMSCLI + { + ulg status = vms_unzip_cmdline(&argc, &argv); + if (!(status & 1)) + return status; + } +#endif /* VMSCLI */ + + uO.zipinfo_mode = FALSE; + error = uz_opts(__G__ &argc, &argv); /* UnZipSFX call only */ + +#else /* !SFX */ + +#ifdef RISCOS + /* get the extensions to swap from environment */ + getRISCOSexts(ENV_UNZIPEXTS); +#endif + +#ifdef MSDOS + /* extract MKS extended argument list from environment (before envargs!) */ + mksargs(&argc, &argv); +#endif + +#ifdef VMSCLI + { + ulg status = vms_unzip_cmdline(&argc, &argv); + if (!(status & 1)) + return status; + } +#endif /* VMSCLI */ + + G.noargs = (argc == 1); /* no options, no zipfile, no anything */ + +#ifndef NO_ZIPINFO + for (p = argv[0] + strlen(argv[0]); p >= argv[0]; --p) { + if (*p == DIR_END +#ifdef DIR_END2 + || *p == DIR_END2 +#endif + ) + break; + } + ++p; + + if (STRNICMP(p, LoadFarStringSmall(Zipnfo), 7) == 0 || + STRNICMP(p, "ii", 2) == 0 || + (argc > 1 && strncmp(argv[1], "-Z", 2) == 0)) + { + uO.zipinfo_mode = TRUE; + envargs(__G__ &argc, &argv, LoadFarStringSmall(EnvZipInfo), + LoadFarStringSmall2(EnvZipInfo2)); + error = zi_opts(__G__ &argc, &argv); + } else +#endif /* NO_ZIPINFO */ + { + uO.zipinfo_mode = FALSE; + envargs(__G__ &argc, &argv, LoadFarStringSmall(EnvUnZip), + LoadFarStringSmall2(EnvUnZip2)); + error = uz_opts(__G__ &argc, &argv); + } + +#endif /* ?SFX */ + + if ((argc < 0) || error) + return error; + +/*--------------------------------------------------------------------------- + Now get the zipfile name from the command line and then process any re- + maining options and file specifications. + ---------------------------------------------------------------------------*/ + +#ifdef DOS_FLX_H68_OS2_W32 + /* convert MSDOS-style directory separators to Unix-style ones for + * user's convenience (include zipfile name itself) + */ +#ifdef SFX + for (G.pfnames = argv, i = argc; i > 0; --i) { +#else + /* argc does not include the zipfile specification */ + for (G.pfnames = argv, i = argc+1; i > 0; --i) { +#endif + char *q; + + for (q = *G.pfnames; *q; ++q) + if (*q == '\\') + *q = '/'; + ++G.pfnames; + } +#endif /* DOS_FLX_H68_OS2_W32 */ + +#ifndef SFX + G.wildzipfn = *argv++; +#endif + +#if (defined(SFX) && !defined(SFX_EXDIR)) /* only check for -x */ + + G.filespecs = argc; + G.xfilespecs = 0; + + if (argc > 0) { + char **pp = argv-1; + + G.pfnames = argv; + while (*++pp) + if (strcmp(*pp, "-x") == 0) { + if (pp > argv) { + *pp = 0; /* terminate G.pfnames */ + G.filespecs = pp - G.pfnames; + } else { + G.pfnames = (char **)fnames; /* defaults */ + G.filespecs = 0; + } + G.pxnames = pp + 1; /* excluded-names ptr: _after_ -x */ + G.xfilespecs = argc - G.filespecs - 1; + break; /* skip rest of args */ + } + G.process_all_files = FALSE; + } else + G.process_all_files = TRUE; /* for speed */ + +#else /* !SFX || SFX_EXDIR */ /* check for -x or -d */ + + G.filespecs = argc; + G.xfilespecs = 0; + + if (argc > 0) { + int in_files=FALSE, in_xfiles=FALSE; + char **pp = argv-1; + + G.process_all_files = FALSE; + G.pfnames = argv; + while (*++pp) { + Trace((stderr, "pp - argv = %d\n", pp-argv)); +#ifdef CMS_MVS + if (!uO.exdir && STRNICMP(*pp, "-d", 2) == 0) { +#else + if (!uO.exdir && strncmp(*pp, "-d", 2) == 0) { +#endif + int firstarg = (pp == argv); + + uO.exdir = (*pp) + 2; + if (in_files) { /* ... zipfile ... -d exdir ... */ + *pp = (char *)NULL; /* terminate G.pfnames */ + G.filespecs = pp - G.pfnames; + in_files = FALSE; + } else if (in_xfiles) { + *pp = (char *)NULL; /* terminate G.pxnames */ + G.xfilespecs = pp - G.pxnames; + /* "... -x xlist -d exdir": nothing left */ + } + /* first check for "-dexdir", then for "-d exdir" */ + if (*uO.exdir == '\0') { + if (*++pp) + uO.exdir = *pp; + else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGiveExdir))); + return(PK_PARAM); /* don't extract here by accident */ + } + } + if (firstarg) { /* ... zipfile -d exdir ... */ + if (pp[1]) { + G.pfnames = pp + 1; /* argv+2 */ + G.filespecs = argc - (G.pfnames-argv); /* for now... */ + } else { + G.process_all_files = TRUE; + G.pfnames = (char **)fnames; /* GRR: necessary? */ + G.filespecs = 0; /* GRR: necessary? */ + break; + } + } + } else if (!in_xfiles) { + if (strcmp(*pp, "-x") == 0) { + in_xfiles = TRUE; + if (pp == G.pfnames) { + G.pfnames = (char **)fnames; /* defaults */ + G.filespecs = 0; + } else if (in_files) { + *pp = 0; /* terminate G.pfnames */ + G.filespecs = pp - G.pfnames; /* adjust count */ + in_files = FALSE; + } + G.pxnames = pp + 1; /* excluded-names ptr starts after -x */ + G.xfilespecs = argc - (G.pxnames-argv); /* anything left */ + } else + in_files = TRUE; + } + } + } else + G.process_all_files = TRUE; /* for speed */ + + if (uO.exdir != (char *)NULL && !G.extract_flag) /* -d ignored */ + Info(slide, 0x401, ((char *)slide, LoadFarString(NotExtracting))); +#endif /* ?(SFX && !SFX_EXDIR) */ + +/*--------------------------------------------------------------------------- + Okey dokey, we have everything we need to get started. Let's roll. + ---------------------------------------------------------------------------*/ + + retcode = process_zipfiles(__G); + return(retcode); + +} /* end main()/unzip() */ + + + + + +/**********************/ +/* Function uz_opts() */ +/**********************/ + +int uz_opts(__G__ pargc, pargv) + __GDEF + int *pargc; + char ***pargv; +{ + char **argv, *s; + int argc, c, error=FALSE, negative=0; + + + argc = *pargc; + argv = *pargv; + + while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) { + s = *argv + 1; + while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */ +#ifdef CMS_MVS + switch (tolower(c)) +#else + switch (c) +#endif + { + case ('-'): + ++negative; + break; + case ('a'): + if (negative) { + uO.aflag = MAX(uO.aflag-negative,0); + negative = 0; + } else + ++uO.aflag; + break; +#if (defined(DLL) && defined(API_DOC)) + case ('A'): /* extended help for API */ + APIhelp(__G__ argc, argv); + *pargc = -1; /* signal to exit successfully */ + return 0; +#endif + case ('b'): + if (negative) { +#ifdef VMS + uO.bflag = MAX(uO.bflag-negative,0); +#endif + negative = 0; /* do nothing: "-b" is default */ + } else { +#ifdef VMS + if (uO.aflag == 0) + ++uO.bflag; +#endif + uO.aflag = 0; + } + break; +#ifdef UNIXBACKUP + case ('B'): /* -B: back up existing files */ + if (negative) + uO.B_flag = FALSE, negative = 0; + else + uO.B_flag = TRUE; + break; +#endif + case ('c'): + if (negative) { + uO.cflag = FALSE, negative = 0; +#ifdef NATIVE + uO.aflag = 0; +#endif + } else { + uO.cflag = TRUE; +#ifdef NATIVE + uO.aflag = 2; /* so you can read it on the screen */ +#endif +#ifdef DLL + if (G.redirect_text) + G.redirect_data = 2; +#endif + } + break; +#ifndef CMS_MVS + case ('C'): /* -C: match filenames case-insensitively */ + if (negative) + uO.C_flag = FALSE, negative = 0; + else + uO.C_flag = TRUE; + break; +#endif /* !CMS_MVS */ +#if (!defined(SFX) || defined(SFX_EXDIR)) + case ('d'): + if (negative) { /* negative not allowed with -d exdir */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGiveExdir))); + return(PK_PARAM); /* don't extract here by accident */ + } + if (uO.exdir != (char *)NULL) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(OnlyOneExdir))); + return(PK_PARAM); /* GRR: stupid restriction? */ + } else { + /* first check for "-dexdir", then for "-d exdir" */ + uO.exdir = s; + if (*uO.exdir == '\0') { + if (argc > 1) { + --argc; + uO.exdir = *++argv; + if (*uO.exdir == '-') { + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGiveExdir))); + return(PK_PARAM); + } + /* else uO.exdir points at extraction dir */ + } else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGiveExdir))); + return(PK_PARAM); + } + } + /* uO.exdir now points at extraction dir (-dexdir or + * -d exdir); point s at end of exdir to avoid mis- + * interpretation of exdir characters as more options + */ + if (*s != 0) + while (*++s != 0) + ; + } + break; +#endif /* !SFX || SFX_EXDIR */ + case ('e'): /* just ignore -e, -x options (extract) */ + break; +#ifdef MACOS + case ('E'): /* -E [MacOS] display Mac e.f. when restoring */ + if( negative ) { + uO.E_flag = FALSE, negative = 0; + } else { + uO.E_flag = TRUE; + } + break; +#endif /* MACOS */ + case ('f'): /* "freshen" (extract only newer files) */ + if (negative) + uO.fflag = uO.uflag = FALSE, negative = 0; + else + uO.fflag = uO.uflag = TRUE; + break; +#if (defined(RISCOS) || defined(ACORN_FTYPE_NFS)) + case ('F'): /* Acorn filetype & NFS extension handling */ + if (negative) + uO.acorn_nfs_ext = FALSE, negative = 0; + else + uO.acorn_nfs_ext = TRUE; + break; +#endif /* RISCOS || ACORN_FTYPE_NFS */ + case ('h'): /* just print help message and quit */ + *pargc = -1; + return USAGE(PK_OK); +#ifdef MACOS + case ('i'): /* -i [MacOS] ignore filenames stored in Mac ef */ + if( negative ) { + uO.i_flag = FALSE, negative = 0; + } else { + uO.i_flag = TRUE; + } + break; +#endif /* MACOS */ + case ('j'): /* junk pathnames/directory structure */ + if (negative) + uO.jflag = FALSE, negative = 0; + else + uO.jflag = TRUE; + break; +#if (defined(__BEOS__) || defined(MACOS)) + case ('J'): /* Junk BeOS or MacOS file attributes */ + if( negative ) { + uO.J_flag = FALSE, negative = 0; + } else { + uO.J_flag = TRUE; + } + break; +#endif /* __BEOS__ || MACOS */ +#ifndef SFX + case ('l'): + if (negative) { + uO.vflag = MAX(uO.vflag-negative,0); + negative = 0; + } else + ++uO.vflag; + break; +#endif /* !SFX */ +#ifndef CMS_MVS + case ('L'): /* convert (some) filenames to lowercase */ + if (negative) + uO.L_flag = FALSE, negative = 0; + else + uO.L_flag = TRUE; + break; +#endif /* !CMS_MVS */ +#ifdef MORE +#ifdef CMS_MVS + case ('m'): +#endif + case ('M'): /* send all screen output through "more" fn. */ +/* GRR: eventually check for numerical argument => height */ + if (negative) + G.M_flag = FALSE, negative = 0; + else + G.M_flag = TRUE; + break; +#endif /* MORE */ + case ('n'): /* don't overwrite any files */ + if (negative) + uO.overwrite_none = FALSE, negative = 0; + else + uO.overwrite_none = TRUE; + break; +#ifdef AMIGA + case ('N'): /* restore comments as filenotes */ + if (negative) + uO.N_flag = FALSE, negative = 0; + else + uO.N_flag = TRUE; + break; +#endif /* AMIGA */ + case ('o'): /* OK to overwrite files without prompting */ + if (negative) { + uO.overwrite_all = MAX(uO.overwrite_all-negative,0); + negative = 0; + } else + ++uO.overwrite_all; + break; + case ('p'): /* pipes: extract to stdout, no messages */ + if (negative) { + uO.cflag = FALSE; + uO.qflag = MAX(uO.qflag-999,0); + negative = 0; + } else { + uO.cflag = TRUE; + uO.qflag += 999; + } + break; +#if CRYPT + /* GRR: yes, this is highly insecure, but dozens of people + * have pestered us for this, so here we go... */ + case ('P'): + if (negative) { /* negative not allowed with -P passwd */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGivePasswd))); + return(PK_PARAM); /* don't extract here by accident */ + } + if (uO.pwdarg != (char *)NULL) { +/* + GRR: eventually support multiple passwords? + Info(slide, 0x401, ((char *)slide, + LoadFarString(OnlyOnePasswd))); + return(PK_PARAM); + */ + } else { + /* first check for "-Ppasswd", then for "-P passwd" */ + uO.pwdarg = s; + if (*uO.pwdarg == '\0') { + if (argc > 1) { + --argc; + uO.pwdarg = *++argv; + if (*uO.pwdarg == '-') { + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGivePasswd))); + return(PK_PARAM); + } + /* else pwdarg points at decryption password */ + } else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGivePasswd))); + return(PK_PARAM); + } + } + /* pwdarg now points at decryption password (-Ppasswd or + * -P passwd); point s at end of passwd to avoid mis- + * interpretation of passwd characters as more options + */ + if (*s != 0) + while (*++s != 0) + ; + } + break; +#endif /* CRYPT */ + case ('q'): /* quiet: fewer comments/messages */ + if (negative) { + uO.qflag = MAX(uO.qflag-negative,0); + negative = 0; + } else + ++uO.qflag; + break; +#ifdef QDOS + case ('Q'): /* QDOS flags */ + qlflag ^= strtol(s, &s, 10); + break; /* we XOR this as we can config qlflags */ +#endif +#ifdef DOS_FLX_OS2_W32 + case ('s'): /* spaces in filenames: allow by default */ + if (negative) + uO.sflag = FALSE, negative = 0; + else + uO.sflag = TRUE; + break; +#endif /* DOS_FLX_OS2_W32 */ + case ('t'): + if (negative) + uO.tflag = FALSE, negative = 0; + else + uO.tflag = TRUE; + break; +#ifdef TIMESTAMP + case ('T'): + if (negative) + uO.T_flag = FALSE, negative = 0; + else + uO.T_flag = TRUE; + break; +#endif + case ('u'): /* update (extract only new and newer files) */ + if (negative) + uO.uflag = FALSE, negative = 0; + else + uO.uflag = TRUE; + break; +#ifndef CMS_MVS + case ('U'): /* obsolete; to be removed in version 6.0 */ + if (negative) + uO.L_flag = TRUE, negative = 0; + else + uO.L_flag = FALSE; + break; +#endif /* !CMS_MVS */ +#ifndef SFX + case ('v'): /* verbose */ + if (negative) { + uO.vflag = MAX(uO.vflag-negative,0); + negative = 0; + } else if (uO.vflag) + ++uO.vflag; + else + uO.vflag = 2; + break; +#endif /* !SFX */ +#ifndef CMS_MVS + case ('V'): /* Version (retain VMS/DEC-20 file versions) */ + if (negative) + uO.V_flag = FALSE, negative = 0; + else + uO.V_flag = TRUE; + break; +#endif /* !CMS_MVS */ + case ('x'): /* extract: default */ +#ifdef SFX + /* when 'x' is the only option in this argument, and the + * next arg is not an option, assume this initiates an + * exclusion list (-x xlist): terminate option-scanning + * and leave uz_opts with argv still pointing to "-x"; + * the xlist is processed later + */ + if (s - argv[0] == 2 && *s == '\0' && + argc > 1 && argv[1][0] != '-') { + /* break out of nested loops without "++argv;--argc" */ + goto opts_done; + } +#endif /* SFX */ + break; +#if (defined(RESTORE_UIDGID) || defined(OS2_W32)) + case ('X'): /* restore owner/protection info (need privs?) */ + if (negative) { + uO.X_flag = MAX(uO.X_flag-negative,0); + negative = 0; + } else + ++uO.X_flag; + break; +#endif /* RESTORE_UIDGID || OS2_W32 */ + case ('z'): /* display only the archive comment */ + if (negative) { + uO.zflag = MAX(uO.zflag-negative,0); + negative = 0; + } else + ++uO.zflag; + break; +#ifndef SFX + case ('Z'): /* should have been first option (ZipInfo) */ + Info(slide, 0x401, ((char *)slide, LoadFarString(Zfirst))); + error = TRUE; + break; +#endif /* !SFX */ +#ifdef DOS_OS2_W32 + case ('$'): + if (negative) { + uO.volflag = MAX(uO.volflag-negative,0); + negative = 0; + } else + ++uO.volflag; + break; +#endif /* DOS_OS2_W32 */ + default: + error = TRUE; + break; + + } /* end switch */ + } /* end while (not end of argument string) */ + } /* end while (not done with switches) */ + +/*--------------------------------------------------------------------------- + Check for nonsensical combinations of options. + ---------------------------------------------------------------------------*/ + +#ifdef SFX +opts_done: /* yes, very ugly...but only used by UnZipSFX with -x xlist */ +#endif + + if ((uO.cflag && uO.tflag) || (uO.cflag && uO.uflag) || + (uO.tflag && uO.uflag) || (uO.fflag && uO.overwrite_none)) + { + Info(slide, 0x401, ((char *)slide, LoadFarString(InvalidOptionsMsg))); + error = TRUE; + } + if (uO.aflag > 2) + uO.aflag = 2; +#ifdef VMS + if (uO.bflag > 2) + uO.bflag = 2; +#endif + if (uO.overwrite_all && uO.overwrite_none) { + Info(slide, 0x401, ((char *)slide, LoadFarString(IgnoreOOptionMsg))); + uO.overwrite_all = FALSE; + } +#ifdef MORE + if (G.M_flag && !isatty(1)) /* stdout redirected: "more" func. useless */ + G.M_flag = 0; +#endif + +#ifdef SFX + if (error) +#else + if ((argc-- == 0) || error) +#endif + { + *pargc = argc; + *pargv = argv; +#ifndef SFX + if (uO.vflag >= 2 && argc == -1) { /* "unzip -v" */ + show_version_info(__G); + return PK_OK; + } + if (!G.noargs && !error) + error = PK_PARAM; /* had options (not -h or -v) but no zipfile */ +#endif /* !SFX */ + return USAGE(error); + } + +#ifdef SFX + /* print our banner unless we're being fairly quiet */ + if (uO.qflag < 2) + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner), + UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, + LoadFarStringSmall(VersionDate))); +#ifdef BETA + /* always print the beta warning: no unauthorized distribution!! */ + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(BetaVersion), "\n", + "SFX")); +#endif +#endif /* SFX */ + + if (uO.cflag || uO.tflag || uO.vflag || uO.zflag +#ifdef TIMESTAMP + || uO.T_flag +#endif + ) + G.extract_flag = FALSE; + else + G.extract_flag = TRUE; + + *pargc = argc; + *pargv = argv; + return PK_OK; + +} /* end function uz_opts() */ + + + + +/********************/ +/* Function usage() */ +/********************/ + +#ifdef SFX +# ifdef VMS +# define LOCAL "X. Quote uppercase options" +# endif +# ifdef UNIX +# define LOCAL "X" +# endif +# ifdef DOS_OS2_W32 +# define LOCAL "s$" +# endif +# ifdef FLEXOS +# define LOCAL "s" +# endif +# ifdef AMIGA +# define LOCAL "N" +# endif + /* Default for all other systems: */ +# ifndef LOCAL +# define LOCAL "" +# endif + +# ifdef MORE +# define SFXOPT1 "M" +# else +# define SFXOPT1 "" +# endif + +int usage(__G__ error) /* return PK-type error code */ + __GDEF + int error; +{ + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner), + UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, + LoadFarStringSmall(VersionDate))); + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXOpts), + SFXOPT1, LOCAL)); +#ifdef BETA + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(BetaVersion), "\n", + "SFX")); +#endif + + if (error) + return PK_PARAM; + else + return PK_COOL; /* just wanted usage screen: no error */ + +} /* end function usage() */ + + + + + +#else /* !SFX */ +# ifdef VMS +# define QUOT '\"' +# define QUOTS "\"" +# else +# define QUOT ' ' +# define QUOTS "" +# endif + +int usage(__G__ error) /* return PK-type error code */ + __GDEF + int error; +{ + int flag = (error? 1 : 0); + + +/*--------------------------------------------------------------------------- + Print either ZipInfo usage or UnZip usage, depending on incantation. + (Strings must be no longer than 512 bytes for Turbo C, apparently.) + ---------------------------------------------------------------------------*/ + + if (uO.zipinfo_mode) { + +#ifndef NO_ZIPINFO + + Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine1), + ZI_MAJORVER, ZI_MINORVER, PATCHLEVEL, BETALEVEL, + LoadFarStringSmall(VersionDate), + LoadFarStringSmall2(ZipInfoExample), QUOTS,QUOTS)); + Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine2))); + Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine3), + QUOT,QUOT, QUOT,QUOT, LoadFarStringSmall(ZipInfoUsageLine4))); +#ifdef VMS + Info(slide, flag, ((char *)slide, "\nRemember that non-lowercase\ + filespecs must be quoted in VMS (e.g., \"Makefile\").\n")); +#endif + +#endif /* !NO_ZIPINFO */ + + } else { /* UnZip mode */ + + Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine1), + UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, + LoadFarStringSmall(VersionDate))); +#ifdef BETA + Info(slide, flag, ((char *)slide, LoadFarString(BetaVersion), "", "")); +#endif + + Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine2), + ZIPINFO_MODE_OPTION, LoadFarStringSmall(ZipInfoMode))); +#ifdef VMS + if (!error) /* maybe no command-line tail found; show extra help */ + Info(slide, flag, ((char *)slide, LoadFarString(VMSusageLine2b))); +#endif + + Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine3), + LoadFarStringSmall(local1))); + + Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine4), + QUOT,QUOT, QUOT,QUOT, LoadFarStringSmall(local2), QUOT,QUOT, + LoadFarStringSmall2(local3))); + + /* This is extra work for SMALL_MEM, but it will work since + * LoadFarStringSmall2 uses the same buffer. Remember, this + * is a hack. */ + Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine5), + LoadFarStringSmall(Example2), LoadFarStringSmall2(Example3), + LoadFarStringSmall2(Example3))); + + } /* end if (uO.zipinfo_mode) */ + + if (error) + return PK_PARAM; + else + return PK_COOL; /* just wanted usage screen: no error */ + +} /* end function usage() */ + +#endif /* ?SFX */ + + + + +#ifndef SFX + +/********************************/ +/* Function show_version_info() */ +/********************************/ + +static void show_version_info(__G) + __GDEF +{ + if (uO.qflag > 3) /* "unzip -vqqqq" */ + Info(slide, 0, ((char *)slide, "%d\n", + (UZ_MAJORVER*100 + UZ_MINORVER*10 + PATCHLEVEL))); + else { + char *envptr, *getenv(); + int numopts = 0; + + Info(slide, 0, ((char *)slide, LoadFarString(UnzipUsageLine1v), + UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, + LoadFarStringSmall(VersionDate))); + Info(slide, 0, ((char *)slide, + LoadFarString(UnzipUsageLine2v))); + version(__G); + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptions))); +#ifdef ACORN_FTYPE_NFS + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(AcornFtypeNFS))); + ++numopts; +#endif +#ifdef ASM_CRC + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(AsmCRC))); + ++numopts; +#endif +#ifdef ASM_INFLATECODES + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(AsmInflateCodes))); + ++numopts; +#endif +#ifdef CHECK_VERSIONS + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Check_Versions))); + ++numopts; +#endif +#ifdef COPYRIGHT_CLEAN + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Copyright_Clean))); + ++numopts; +#endif +#ifdef DEBUG + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(UDebug))); + ++numopts; +#endif +#ifdef DEBUG_TIME + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(DebugTime))); + ++numopts; +#endif +#ifdef DLL + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Dll))); + ++numopts; +#endif +#ifdef DOSWILD + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(DosWild))); + ++numopts; +#endif +#ifdef LZW_CLEAN + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(LZW_Clean))); + ++numopts; +#endif +#ifndef MORE + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(No_More))); + ++numopts; +#endif +#ifdef NO_ZIPINFO + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(No_ZipInfo))); + ++numopts; +#endif +#ifdef NTSD_EAS + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(NTSDExtAttrib))); + ++numopts; +#endif +#ifdef OS2_EAS + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(OS2ExtAttrib))); + ++numopts; +#endif +#ifdef QLZIP + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(SMSExFldOnUnix))); + ++numopts; +#endif +#ifdef REENTRANT + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Reentrant))); + ++numopts; +#endif +#ifdef REGARGS + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(RegArgs))); + ++numopts; +#endif +#ifdef RETURN_CODES + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Return_Codes))); + ++numopts; +#endif +#ifdef SET_DIR_ATTRIB + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(SetDirAttrib))); + ++numopts; +#endif +#ifdef TIMESTAMP + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(TimeStamp))); + ++numopts; +#endif +#ifdef UNIXBACKUP + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(UnixBackup))); + ++numopts; +#endif +#ifdef USE_EF_UT_TIME + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Use_EF_UT_time))); + ++numopts; +#endif +#ifndef COPYRIGHT_CLEAN + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Use_Smith_Code))); + ++numopts; +#endif +#ifndef LZW_CLEAN + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Use_Unshrink))); + ++numopts; +#endif +#ifdef USE_VFAT + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Use_VFAT_support))); + ++numopts; +#endif +#ifdef USE_ZLIB + sprintf((char *)(slide+256), LoadFarStringSmall(UseZlib), + ZLIB_VERSION, zlib_version); + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + (char *)(slide+256))); + ++numopts; +#endif +#ifdef VMS_TEXT_CONV + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(VmsTextConv))); + ++numopts; +#endif +#ifdef VMSCLI + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(VmsCLI))); + ++numopts; +#endif +#ifdef VMSWILD + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(VmsWild))); + ++numopts; +#endif +#if CRYPT +# ifdef PASSWD_FROM_STDIN + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(PasswdStdin))); +# endif + Info(slide, 0, ((char *)slide, LoadFarString(Decryption), + CR_MAJORVER, CR_MINORVER, CR_BETA_VER, + LoadFarStringSmall(CryptDate))); + ++numopts; +#endif /* CRYPT */ + if (numopts == 0) + Info(slide, 0, ((char *)slide, + LoadFarString(CompileOptFormat), + LoadFarStringSmall(None))); + + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptions))); + envptr = getenv(LoadFarStringSmall(EnvUnZip)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvUnZip), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); + envptr = getenv(LoadFarStringSmall(EnvUnZip2)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvUnZip2), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); + envptr = getenv(LoadFarStringSmall(EnvZipInfo)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvZipInfo), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); + envptr = getenv(LoadFarStringSmall(EnvZipInfo2)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvZipInfo2), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); +#ifndef __RSXNT__ +#ifdef __EMX__ + envptr = getenv(LoadFarStringSmall(EnvEMX)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvEMX), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); + envptr = getenv(LoadFarStringSmall(EnvEMXOPT)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvEMXOPT), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); +#endif /* __EMX__ */ +#if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2))) + envptr = getenv(LoadFarStringSmall(EnvGO32)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvGO32), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); + envptr = getenv(LoadFarStringSmall(EnvGO32TMP)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvGO32TMP), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); +#endif /* __GO32__ && !(__DJGPP__ >= 2) */ +#endif /* !__RSXNT__ */ +#ifdef RISCOS + envptr = getenv(LoadFarStringSmall(EnvUnZipExts)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvUnZipExts), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); +#endif /* RISCOS */ + } +} /* end function show_version() */ + +#endif /* !SFX */ +#endif /* !WINDLL */ diff --git a/utils/Install/packzip/unzip.def b/utils/Install/packzip/unzip.def new file mode 100644 index 0000000000..e57dd829c7 --- /dev/null +++ b/utils/Install/packzip/unzip.def @@ -0,0 +1,4 @@ +NAME WINDOWCOMPAT NEWFILES +DESCRIPTION 'The world-famous Info-ZIP unarchiving utilities' +; SEGMENTS +; _MSGSEG32 CLASS 'CODE' diff --git a/utils/Install/packzip/unzipstb.c b/utils/Install/packzip/unzipstb.c new file mode 100644 index 0000000000..6ca238a89f --- /dev/null +++ b/utils/Install/packzip/unzipstb.c @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------------- + + unzipstb.c + + Simple stub function for UnZip DLL (or shared library, whatever); does + exactly the same thing as normal UnZip, except for additional printf()s + of various version numbers, solely as a demonstration of what can/should + be checked when using the DLL. (If major version numbers ever differ, + assume program is incompatible with DLL--especially if DLL version is + older. This is not likely to be a problem with *this* simple program, + but most user programs will be much more complex.) + + ---------------------------------------------------------------------------*/ + +#include <stdio.h> +#include "unzip.h" +#include "version.h" + +int main(int argc, char *argv[]) +{ + static UzpVer *pVersion; /* no pervert jokes, please... */ + + pVersion = UzpVersion(); + + printf("UnZip stub: checking version numbers (DLL is dated %s)\n", + pVersion->date); + printf(" UnZip versions: expecting %d.%d%d, using %d.%d%d%s\n", + UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, pVersion->unzip.major, + pVersion->unzip.minor, pVersion->unzip.patchlevel, pVersion->betalevel); + printf(" ZipInfo versions: expecting %d.%d%d, using %d.%d%d\n", + ZI_MAJORVER, ZI_MINORVER, PATCHLEVEL, pVersion->zipinfo.major, + pVersion->zipinfo.minor, pVersion->zipinfo.patchlevel); + +/* + D2_M*VER and os2dll.* are obsolete, though retained for compatibility: + + printf(" OS2 DLL versions: expecting %d.%d%d, using %d.%d%d\n", + D2_MAJORVER, D2_MINORVER, PATCHLEVEL, pVersion->os2dll.major, + pVersion->os2dll.minor, pVersion->os2dll.patchlevel); + */ + + if (pVersion->flag & 2) + printf(" using zlib version %s\n", pVersion->zlib_version); + printf("\n"); + + /* call the actual UnZip routine (string-arguments version) */ + return UzpMain(argc, argv); +} diff --git a/utils/Install/packzip/win32.c b/utils/Install/packzip/win32.c new file mode 100644 index 0000000000..f50ee5f9dd --- /dev/null +++ b/utils/Install/packzip/win32.c @@ -0,0 +1,2390 @@ +/*--------------------------------------------------------------------------- + + win32.c + + 32-bit Windows-specific (NT/95) routines for use with Info-ZIP's UnZip 5.3 + and later. + + Contains: GetLoadPath() + Opendir() + Readdir() + Closedir() + process_defer_NT() process any deferred items + SetSD() set security descriptor on file + EvalExtraFields() evaluate and process and extra field NOW + IsWinNT() indicate type of WIN32 platform + test_NTSD() test integrity of NT security data + utime2FileTime() + FStampIsLocTime() + FileTime2utime() + VFatFileTime2utime() + UTCtime2Localtime() + NTtzbugWorkaround() + getNTfiletime() + close_outfile() + stamp_file() + isfloppy() + NTQueryVolInfo() + IsVolumeOldFAT() + do_wild() + mapattr() + mapname() + map2fat() + checkdir() + version() + zstat_win32() + getch_win32() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" +#include <windows.h> /* must be AFTER unzip.h to avoid struct G problems */ +#ifdef __RSXNT__ +# include "rsxntwin.h" +#endif +#include "nt.h" + +#ifndef FUNZIP /* most of this file is not used with fUnZip */ + +#if (defined(__GO32__) || defined(__EMX__) || defined(__CYGWIN32__)) +# define MKDIR(path,mode) mkdir(path,mode) +#else +# define MKDIR(path,mode) mkdir(path) +#endif + +#ifdef HAVE_WORKING_DIRENT_H +# undef HAVE_WORKING_DIRENT_H +#endif +/* The emxrtl dirent support of (__GO32__ || __EMX__) converts to lowercase! */ +#if defined(__CYGWIN32__) +# define HAVE_WORKING_DIRENT_H +#endif + +#ifndef SFX +# ifdef HAVE_WORKING_DIRENT_H +# include <dirent.h> /* use readdir() */ +# define zdirent dirent +# define zDIR DIR +# define Opendir opendir +# define Readdir readdir +# define Closedir closedir +# else /* !HAVE_WORKING_DIRENT_H */ + typedef struct zdirent { + char reserved [21]; + char ff_attrib; + short ff_ftime; + short ff_fdate; + long size; + char d_name[MAX_PATH]; + int d_first; + HANDLE d_hFindFile; + } zDIR; + + static zDIR *Opendir (const char *n); + static struct zdirent *Readdir (zDIR *d); + static void Closedir (zDIR *d); +# endif /* ?HAVE_WORKING_DIRENT_H */ +#endif /* !SFX */ + + +/* Function prototypes */ +#ifdef NTSD_EAS + static int SetSD(__GPRO__ char *path, PVOLUMECAPS VolumeCaps, + uch *eb_ptr, unsigned eb_len); + static int EvalExtraFields(__GPRO__ char *path, uch *ef_ptr, + unsigned ef_len); +#endif + +#if (defined(USE_EF_UT_TIME) || defined(NT_TZBUG_WORKAROUND) || \ + defined(TIMESTAMP)) + static void utime2FileTime(time_t ut, FILETIME *pft); + static int FStampIsLocTime(__GPRO__ const char *path); +#endif /* USE_EF_UT_TIME || NT_TZBUG_WORKAROUND || TIMESTAMP */ +#ifdef NT_TZBUG_WORKAROUND + static int FileTime2utime(const FILETIME *pft, time_t *ut); +#ifdef W32_STAT_BANDAID + static int VFatFileTime2utime(const FILETIME *pft, time_t *ut); +#endif + static time_t UTCtime2Localtime(time_t utctime); + static void NTtzbugWorkaround(time_t ut, FILETIME *pft); +#endif /* NT_TZBUG_WORKAROUND */ + +static int getNTfiletime (__GPRO__ FILETIME *pModFT, FILETIME *pAccFT, + FILETIME *pCreFT); +static int isfloppy (int nDrive); +static int NTQueryVolInfo (__GPRO__ const char *name); +static int IsVolumeOldFAT (__GPRO__ const char *name); +static void map2fat (char *pathcomp, char **pEndFAT); + + +#ifdef __MINGW32__ + int _CRT_glob = 0; /* suppress command line globbing by C RTL */ +#endif + +/* static int created_dir; */ /* used by mapname(), checkdir() */ +/* static int renamed_fullpath; */ /* ditto */ +/* static int fnlen; */ /* ditto */ +/* static unsigned nLabelDrive; */ /* ditto */ + +extern char Far TruncNTSD[]; /* in extract.c */ + + + +#ifdef SFX + +/**************************/ +/* Function GetLoadPath() */ +/**************************/ + +char *GetLoadPath(__GPRO) +{ +#ifdef MSC + extern char *_pgmptr; + return _pgmptr; + +#else /* use generic API call */ + + GetModuleFileName(NULL, G.filename, FILNAMSIZ-1); + _ISO_INTERN(G.filename); /* translate to codepage of C rtl's stdio */ + return G.filename; +#endif + +} /* end function GetLoadPath() */ + + + + + +#else /* !SFX */ + +#ifndef HAVE_WORKING_DIRENT_H + +/**********************/ /* Borrowed from ZIP 2.0 sources */ +/* Function Opendir() */ /* Difference: no special handling for */ +/**********************/ /* hidden or system files. */ + +static zDIR *Opendir(n) + const char *n; /* directory to open */ +{ + zDIR *d; /* malloc'd return value */ + char *p; /* malloc'd temporary string */ + WIN32_FIND_DATA fd; + extent len = strlen(n); + + /* Start searching for files in directory n */ + + if ((d = (zDIR *)malloc(sizeof(zDIR))) == NULL || + (p = malloc(strlen(n) + 5)) == NULL) + { + if (d != (zDIR *)NULL) + free((void *)d); + return (zDIR *)NULL; + } + INTERN_TO_ISO(n, p); + if (len > 0) { + if (p[len-1] == ':') + p[len++] = '.'; /* x: => x:. */ + else if (p[len-1] == '/' || p[len-1] == '\\') + --len; /* foo/ => foo */ + } + strcpy(p+len, "/*"); + + if (INVALID_HANDLE_VALUE == (d->d_hFindFile = FindFirstFile(p, &fd))) { + free((zvoid *)d); + free((zvoid *)p); + return NULL; + } + strcpy(d->d_name, fd.cFileName); + + free((zvoid *)p); + d->d_first = 1; + return d; + +} /* end of function Opendir() */ + + + + +/**********************/ /* Borrowed from ZIP 2.0 sources */ +/* Function Readdir() */ /* Difference: no special handling for */ +/**********************/ /* hidden or system files. */ + +static struct zdirent *Readdir(d) + zDIR *d; /* directory stream from which to read */ +{ + /* Return pointer to first or next directory entry, or NULL if end. */ + + if ( d->d_first ) + d->d_first = 0; + else + { + WIN32_FIND_DATA fd; + + if ( !FindNextFile(d->d_hFindFile, &fd) ) + return NULL; + + ISO_TO_INTERN(fd.cFileName, d->d_name); + } + return (struct zdirent *)d; + +} /* end of function Readdir() */ + + + + +/***********************/ +/* Function Closedir() */ /* Borrowed from ZIP 2.0 sources */ +/***********************/ + +static void Closedir(d) + zDIR *d; /* directory stream to close */ +{ + FindClose(d->d_hFindFile); + free(d); +} + +#endif /* !HAVE_WORKING_DIRENT_H */ +#endif /* ?SFX */ + + + + +#ifdef NTSD_EAS + +/*********************************/ +/* Function process_defer_NT() */ +/*********************************/ + +void process_defer_NT(__G) + __GDEF +{ + /* process deferred items */ + + DWORD dir, bytes; + DWORD dirfail, bytesfail; + + ProcessDefer(&dir, &bytes, &dirfail, &bytesfail); + + if (!uO.tflag && (uO.qflag < 2)) { + if (dir) + Info(slide, 0, ((char *)slide, + " updated: %lu directory entries with %lu bytes security", + (ulg)dir, (ulg)bytes)); + if (dirfail) + Info(slide, 0, ((char *)slide, + " failed: %lu directory entries with %lu bytes security", + (ulg)dirfail, (ulg)bytesfail)); + } +} + + + +/**********************/ +/* Function SetSD() */ /* return almost-PK errors */ +/**********************/ + +static int SetSD(__G__ path, VolumeCaps, eb_ptr, eb_len) + __GDEF + char *path; + PVOLUMECAPS VolumeCaps; + uch *eb_ptr; + unsigned eb_len; +{ + ulg ntsd_ucSize; + uch *security_data; + int error; + + if (eb_ptr == NULL || eb_len < EB_NTSD_L_LEN) + return PK_OK; /* not a valid NTSD extra field: assume OK */ + + /* check if we know how to handle this version */ + if (*(eb_ptr + (EB_HEADSIZE+EB_NTSD_VERSION)) > (uch)EB_NTSD_MAX_VER) + return PK_OK; + + ntsd_ucSize = makelong(eb_ptr + (EB_HEADSIZE+EB_UCSIZE_P)); + if (ntsd_ucSize > 0L && eb_len <= (EB_NTSD_L_LEN + EB_CMPRHEADLEN)) + return IZ_EF_TRUNC; /* no compressed data! */ + + /* allocate storage for uncompressed data */ + security_data = (uch *)malloc((extent)ntsd_ucSize); + if (security_data == (uch *)NULL) + return PK_MEM4; + + error = memextract(__G__ security_data, ntsd_ucSize, + (eb_ptr + (EB_HEADSIZE+EB_NTSD_L_LEN)), (ulg)(eb_len - EB_NTSD_L_LEN)); + + if (error == PK_OK) { + if (SecuritySet(path, VolumeCaps, security_data)) { + error = PK_COOL; + if (!uO.tflag && (uO.qflag < 2) && + (!(VolumeCaps->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))) + Info(slide, 0, ((char *)slide, " (%ld bytes security)", + ntsd_ucSize)); + } + } + + free(security_data); + return error; +} + + + + +/********************************/ /* scan extra fields for something */ +/* Function EvalExtraFields() */ /* we happen to know */ +/********************************/ + +static int EvalExtraFields(__G__ path, ef_ptr, ef_len) + __GDEF + char *path; + uch *ef_ptr; + unsigned ef_len; +{ + int rc = PK_OK; + + if (!uO.X_flag) + return PK_OK; /* user said don't process ACLs; for now, no other + extra block types are handled here */ + + while (ef_len >= EB_HEADSIZE) + { + unsigned eb_id = makeword(EB_ID + ef_ptr); + unsigned eb_len = makeword(EB_LEN + ef_ptr); + + if (eb_len > (ef_len - EB_HEADSIZE)) { + /* discovered some extra field inconsistency! */ + Trace((stderr, + "EvalExtraFields: block length %u > rest ef_size %u\n", eb_len, + ef_len - EB_HEADSIZE)); + break; + } + + switch (eb_id) + { + /* process security descriptor extra data if: + Caller is WinNT AND + Target local/remote drive supports acls AND + Target file is not a directory (else we defer processing + until later) + */ + case EF_NTSD: + if (IsWinNT()) { + VOLUMECAPS VolumeCaps; + + /* provide useful input */ + VolumeCaps.dwFileAttributes = G.pInfo->file_attr; + VolumeCaps.bUsePrivileges = (uO.X_flag > 1); + + /* check target volume capabilities - just fall through + * and try if fail */ + if (GetVolumeCaps(G.rootpath, path, &VolumeCaps) && + !(VolumeCaps.dwFileSystemFlags & FS_PERSISTENT_ACLS)) + { + rc = PK_OK; + break; + } + rc = SetSD(__G__ path, &VolumeCaps, ef_ptr, eb_len); + } else + rc = PK_OK; + break; + +#if 0 + /* perhaps later we can add support for unzipping OS/2 EAs to NT */ + case EF_OS2: + rc = SetEAs(__G__ path, ef_ptr); + break; + + case EF_PKUNIX: + case EF_IZUNIX: + case EF_IZUNIX2: + case EF_TIME: + break; /* handled elsewhere */ +#else /* ! 0 */ +#ifdef DEBUG + case EF_AV: + case EF_OS2: + case EF_PKVMS: + case EF_PKW32: + case EF_PKUNIX: + case EF_IZVMS: + case EF_IZUNIX: + case EF_IZUNIX2: + case EF_TIME: + case EF_MAC3: + case EF_JLMAC: + case EF_ZIPIT: + case EF_VMCMS: + case EF_MVS: + case EF_ACL: + case EF_BEOS: + case EF_QDOS: + case EF_AOSVS: + case EF_SPARK: + case EF_MD5: + case EF_ASIUNIX: + break; /* shut up for other known e.f. blocks */ +#endif /* DEBUG */ +#endif /* ? 0 */ + + default: + Trace((stderr, + "EvalExtraFields: unknown extra field block, ID=%u\n", + eb_id)); + break; + } + + ef_ptr += (eb_len + EB_HEADSIZE); + ef_len -= (eb_len + EB_HEADSIZE); + + if (rc != PK_OK) + break; + } + + return rc; +} + + + + +#ifndef SFX + +/**************************/ +/* Function test_NTSD() */ /* returns PK_WARN when NTSD data is invalid */ +/**************************/ + +#ifdef __BORLANDC__ +/* Turn off warning about not using all parameters for this function only */ +#pragma argsused +#endif +int test_NTSD(__G__ eb, eb_size, eb_ucptr, eb_ucsize) + __GDEF + uch *eb; + unsigned eb_size; + uch *eb_ucptr; + ulg eb_ucsize; +{ + int r = PK_OK; + + if (!ValidateSecurity(eb_ucptr)) + r = PK_WARN; + return r; + +} /* end function test_NTSD() */ + +#endif /* !SFX */ +#endif /* NTSD_EAS */ + + + + +/**********************/ +/* Function IsWinNT() */ +/**********************/ + +int IsWinNT(void) /* returns TRUE if real NT, FALSE if Win95 or Win32s */ +{ + static DWORD g_PlatformId = 0xFFFFFFFF; /* saved platform indicator */ + + if (g_PlatformId == 0xFFFFFFFF) { + /* note: GetVersionEx() doesn't exist on WinNT 3.1 */ + if (GetVersion() < 0x80000000) + g_PlatformId = TRUE; + else + g_PlatformId = FALSE; + } + return (int)g_PlatformId; +} + + +/* DEBUG_TIME insertion: */ +#ifdef DEBUG_TIME +static int show_NTFileTime(FILE *hdo, char *TTmsg, int isloc, FILETIME *pft); + +static int show_NTFileTime(FILE *hdo, char *TTmsg, int isloc, FILETIME *pft) +{ + SYSTEMTIME w32tm; + int rval; + + rval = FileTimeToSystemTime(pft, &w32tm); + if (!rval) { + fprintf(hdo, "%s\n %08lX,%08lX (%s) -> Conversion failed !!!\n", + TTmsg, (ulg)(pft->dwHighDateTime), (ulg)(pft->dwLowDateTime), + (isloc ? "local" : "UTC")); + } else { + fprintf(hdo, "%s\n %08lx,%08lx -> %04u-%02u-%02u, %02u:%02u:%02u %s\n", + TTmsg, (ulg)(pft->dwHighDateTime), (ulg)(pft->dwLowDateTime), + w32tm.wYear, w32tm.wMonth, w32tm.wDay, w32tm.wHour, + w32tm.wMinute, w32tm.wSecond, (isloc ? "local" : "UTC")); + } + return rval; +} +#define FTTrace(x) show_NTFileTime x +#else +#define FTTrace(x) +#endif /* DEBUG_TIME */ +/* end of TIME_DEBUG insertion */ + +#if (defined(USE_EF_UT_TIME) || defined(NT_TZBUG_WORKAROUND) || \ + defined(TIMESTAMP)) + +#if ((defined(__GNUC__) || defined(ULONG_LONG_MAX)) && !defined(HAVE_INT64)) + typedef long long LLONG64; + typedef unsigned long long ULLNG64; +# define HAVE_INT64 +#endif +#if (defined(__WATCOMC__) && (__WATCOMC__ >= 1100) && !defined(HAVE_INT64)) + typedef __int64 LLONG64; + typedef unsigned __int64 ULLNG64; +# define HAVE_INT64 +#endif +#if (defined(_MSC_VER) && (_MSC_VER >= 1100) && !defined(HAVE_INT64)) + typedef __int64 LLONG64; + typedef unsigned __int64 ULLNG64; +# define HAVE_INT64 +#endif + +/*****************************/ +/* Function utime2FileTime() */ /* convert Unix time_t format into the */ +/*****************************/ /* form used by SetFileTime() in NT/95 */ + +#define UNIX_TIME_ZERO_HI 0x019DB1DEUL +#define UNIX_TIME_ZERO_LO 0xD53E8000UL +#define NT_QUANTA_PER_UNIX 10000000L + +static void utime2FileTime(time_t ut, FILETIME *pft) +{ +#ifdef HAVE_INT64 + ULLNG64 NTtime; + + /* NT_QUANTA_PER_UNIX is small enough so that "ut * NT_QUANTA_PER_UNIX" + * cannot overflow in 64-bit signed calculation, regardless wether "ut" + * is signed or unsigned. */ + NTtime = ((LLONG64)ut * NT_QUANTA_PER_UNIX) + + ((ULLNG64)UNIX_TIME_ZERO_LO + ((ULLNG64)UNIX_TIME_ZERO_HI << 32)); + pft->dwLowDateTime = (DWORD)NTtime; + pft->dwHighDateTime = (DWORD)(NTtime >> 32); + +#else /* !HAVE_INT64 (64-bit integer arithmetics may not be supported) */ + unsigned int b1, b2, carry = 0; + unsigned long r0, r1, r2, r3; + long r4; /* signed, to catch environments with signed time_t */ + + b1 = ut & 0xFFFF; + b2 = (ut >> 16) & 0xFFFF; /* if ut is over 32 bits, too bad */ + r1 = b1 * (NT_QUANTA_PER_UNIX & 0xFFFF); + r2 = b1 * (NT_QUANTA_PER_UNIX >> 16); + r3 = b2 * (NT_QUANTA_PER_UNIX & 0xFFFF); + r4 = b2 * (NT_QUANTA_PER_UNIX >> 16); + r0 = (r1 + (r2 << 16)) & 0xFFFFFFFFL; + if (r0 < r1) + carry++; + r1 = r0; + r0 = (r0 + (r3 << 16)) & 0xFFFFFFFFL; + if (r0 < r1) + carry++; + pft->dwLowDateTime = r0 + UNIX_TIME_ZERO_LO; + if (pft->dwLowDateTime < r0) + carry++; + pft->dwHighDateTime = r4 + (r2 >> 16) + (r3 >> 16) + + UNIX_TIME_ZERO_HI + carry; +#endif /* ?HAVE_INT64 */ + +} /* end function utime2FileTime() */ + + + +/******************************/ +/* Function FStampIsLocTime() */ +/******************************/ + +static int FStampIsLocTime(__GPRO__ const char *path) +{ + return (NTQueryVolInfo(__G__ path) ? G.lastVolLocTim : FALSE); +} + +#endif /* USE_EF_UT_TIME || NT_TZBUG_WORKAROUND || TIMESTAMP */ + + + +#ifndef NT_TZBUG_WORKAROUND +# define UTIME_BOUNDCHECK_1(utimval) \ + if (fs_uses_loctime) { \ + utime_dosmin = dos_to_unix_time(DOSTIME_MINIMUM); \ + if ((ulg)utimval < (ulg)utime_dosmin) \ + utimval = utime_dosmin; \ + } +# define UTIME_BOUNDCHECK_N(utimval) \ + if (fs_uses_loctime && ((ulg)utimval < (ulg)utime_dosmin)) \ + utimval = utime_dosmin; +# define NT_TZBUG_PRECOMPENSATE(ut, pft) + +#else /* NT_TZBUG_WORKAROUND */ +# define UNIX_TIME_UMAX_HI 0x0236485EUL +# define UNIX_TIME_UMAX_LO 0xD4A5E980UL +# define UNIX_TIME_SMIN_HI 0x0151669EUL +# define UNIX_TIME_SMIN_LO 0xD53E8000UL +# define UNIX_TIME_SMAX_HI 0x01E9FD1EUL +# define UNIX_TIME_SMAX_LO 0xD4A5E980UL +# define UTIME_1980_JAN_01_00_00 315532800L +# define UTIME_BOUNDCHECK_1(utimval) +# define UTIME_BOUNDCHECK_N(utimval) +# define NT_TZBUG_PRECOMPENSATE(ut, pft) \ + if (fs_uses_loctime) NTtzbugWorkaround(ut, pft); + + /* nonzero if `y' is a leap year, else zero */ +# define leap(y) (((y)%4 == 0 && (y)%100 != 0) || (y)%400 == 0) + /* number of leap years from 1970 to `y' (not including `y' itself) */ +# define nleap(y) (((y)-1969)/4 - ((y)-1901)/100 + ((y)-1601)/400) + +extern ZCONST ush ydays[]; /* defined in fileio.c */ + +/*****************************/ +/* Function FileTime2utime() */ +/*****************************/ + +static int FileTime2utime(const FILETIME *pft, time_t *ut) +{ +#ifdef HAVE_INT64 + ULLNG64 NTtime; + + NTtime = ((ULLNG64)pft->dwLowDateTime + + ((ULLNG64)pft->dwHighDateTime << 32)); + + /* underflow and overflow handling */ +#ifdef CHECK_UTIME_SIGNED_UNSIGNED + if ((time_t)0x80000000L < (time_t)0L) + { + if (NTtime < ((ULLNG64)UNIX_TIME_SMIN_LO + + ((ULLNG64)UNIX_TIME_SMIN_HI << 32))) { + *ut = (time_t)LONG_MIN; + return FALSE; + } + if (NTtime > ((ULLNG64)UNIX_TIME_SMAX_LO + + ((ULLNG64)UNIX_TIME_SMAX_HI << 32))) { + *ut = (time_t)LONG_MAX; + return FALSE; + } + } + else +#endif /* CHECK_UTIME_SIGNED_UNSIGNED */ + { + if (NTtime < ((ULLNG64)UNIX_TIME_ZERO_LO + + ((ULLNG64)UNIX_TIME_ZERO_HI << 32))) { + *ut = (time_t)0; + return FALSE; + } + if (NTtime > ((ULLNG64)UNIX_TIME_UMAX_LO + + ((ULLNG64)UNIX_TIME_UMAX_HI << 32))) { + *ut = (time_t)ULONG_MAX; + return FALSE; + } + } + + NTtime -= ((ULLNG64)UNIX_TIME_ZERO_LO + + ((ULLNG64)UNIX_TIME_ZERO_HI << 32)); + *ut = (time_t)(NTtime / (unsigned long)NT_QUANTA_PER_UNIX); + return TRUE; +#else /* !HAVE_INT64 (64-bit integer arithmetics may not be supported) */ + time_t days; + SYSTEMTIME w32tm; + + /* underflow and overflow handling */ +#ifdef CHECK_UTIME_SIGNED_UNSIGNED + if ((time_t)0x80000000L < (time_t)0L) + { + if ((pft->dwHighDateTime < UNIX_TIME_SMIN_HI) || + ((pft->dwHighDateTime == UNIX_TIME_SMIN_HI) && + (pft->dwLowDateTime < UNIX_TIME_SMIN_LO))) { + *ut = (time_t)LONG_MIN; + return FALSE; + if ((pft->dwHighDateTime > UNIX_TIME_SMAX_HI) || + ((pft->dwHighDateTime == UNIX_TIME_SMAX_HI) && + (pft->dwLowDateTime > UNIX_TIME_SMAX_LO))) { + *ut = (time_t)LONG_MAX; + return FALSE; + } + } + else +#endif /* CHECK_UTIME_SIGNED_UNSIGNED */ + { + if ((pft->dwHighDateTime < UNIX_TIME_ZERO_HI) || + ((pft->dwHighDateTime == UNIX_TIME_ZERO_HI) && + (pft->dwLowDateTime < UNIX_TIME_ZERO_LO))) { + *ut = (time_t)0; + return FALSE; + } + if ((pft->dwHighDateTime > UNIX_TIME_UMAX_HI) || + ((pft->dwHighDateTime == UNIX_TIME_UMAX_HI) && + (pft->dwLowDateTime > UNIX_TIME_UMAX_LO))) { + *ut = (time_t)ULONG_MAX; + return FALSE; + } + } + + FileTimeToSystemTime(pft, &w32tm); + + /* set `days' to the number of days into the year */ + days = w32tm.wDay - 1 + ydays[w32tm.wMonth-1] + + (w32tm.wMonth > 2 && leap (w32tm.wYear)); + + /* now set `days' to the number of days since 1 Jan 1970 */ + days += 365 * (time_t)(w32tm.wYear - 1970) + + (time_t)(nleap(w32tm.wYear)); + + *ut = (time_t)(86400L * days + 3600L * (time_t)w32tm.wHour + + (time_t)(60 * w32tm.wMinute + w32tm.wSecond)); + return TRUE; +#endif /* ?HAVE_INT64 */ +} /* end function FileTime2utime() */ + + + +#ifdef W32_STAT_BANDAID +/*********************************/ +/* Function VFatFileTime2utime() */ +/*********************************/ + +static int VFatFileTime2utime(const FILETIME *pft, time_t *ut) +{ + FILETIME lft; +#ifndef HAVE_MKTIME + WORD wDOSDate, wDOSTime; +#else + SYSTEMTIME w32tm; + struct tm ltm; +#endif + + FileTimeToLocalFileTime(pft, &lft); + FTTrace((stdout, "VFatFT2utime, feed for mktime()", 1, &lft)); +#ifndef HAVE_MKTIME + /* This version of the FILETIME-to-UNIXTIME conversion function + * uses DOS-DATE-TIME format as intermediate stage. For modification + * and access times, this is no problem. But, the extra fine resolution + * of the VFAT-stored creation time gets lost. + */ + FileTimeToDosDateTime(&lft, &wDOSDate, &wDOSTime); + TTrace((stdout,"DosDateTime is %04u-%02u-%02u %02u:%02u:%02u\n", + (unsigned)((wDOSDate>>9)&0x7f)+1980,(unsigned)((wDOSDate>>5)&0x0f), + (unsigned)(wDOSDate&0x1f),(unsigned)((wDOSTime>>11)&0x1f), + (unsigned)((wDOSTime>>5)&0x3f),(unsigned)((wDOSTime<<1)&0x3e))); + *ut = dos_to_unix_time(((ulg)wDOSDate << 16) | (ulg)wDOSTime); + + /* a cheap error check: dos_to_unix_time() only returns an odd time + * when clipping at maximum time_t value. DOS_DATE_TIME values have + * a resolution of 2 seconds and are therefore even numbers. + */ + return (((*ut)&1) == (time_t)0); +#else /* HAVE_MKTIME */ + FileTimeToSystemTime(&lft, &w32tm); + /* underflow and overflow handling */ + /* TODO: The range checks are not accurate, the actual limits may + * be off by one daylight-saving-time shift (typically 1 hour), + * depending on the current state of "is_dst". + */ +#ifdef CHECK_UTIME_SIGNED_UNSIGNED + if ((time_t)0x80000000L < (time_t)0L) + { + if ((pft->dwHighDateTime < UNIX_TIME_SMIN_HI) || + ((pft->dwHighDateTime == UNIX_TIME_SMIN_HI) && + (pft->dwLowDateTime < UNIX_TIME_SMIN_LO))) { + *ut = (time_t)LONG_MIN; + return FALSE; + if ((pft->dwHighDateTime > UNIX_TIME_SMAX_HI) || + ((pft->dwHighDateTime == UNIX_TIME_SMAX_HI) && + (pft->dwLowDateTime > UNIX_TIME_SMAX_LO))) { + *ut = (time_t)LONG_MAX; + return FALSE; + } + } + else +#endif /* CHECK_UTIME_SIGNED_UNSIGNED */ + { + if ((pft->dwHighDateTime < UNIX_TIME_ZERO_HI) || + ((pft->dwHighDateTime == UNIX_TIME_ZERO_HI) && + (pft->dwLowDateTime < UNIX_TIME_ZERO_LO))) { + *ut = (time_t)0; + return FALSE; + } + if ((pft->dwHighDateTime > UNIX_TIME_UMAX_HI) || + ((pft->dwHighDateTime == UNIX_TIME_UMAX_HI) && + (pft->dwLowDateTime > UNIX_TIME_UMAX_LO))) { + *ut = (time_t)ULONG_MAX; + return FALSE; + } + } + ltm.tm_year = w32tm.wYear - 1900; + ltm.tm_mon = w32tm.wMonth - 1; + ltm.tm_mday = w32tm.wDay; + ltm.tm_hour = w32tm.wHour; + ltm.tm_min = w32tm.wMinute; + ltm.tm_sec = w32tm.wSecond; + ltm.tm_isdst = -1; /* let mktime determine if DST is in effect */ + *ut = mktime(<m); + + /* a cheap error check: mktime returns "(time_t)-1L" on conversion errors. + * Normally, we would have to apply a consistency check because "-1" + * could also be a valid time. But, it is quite unlikely to read back odd + * time numbers from file systems that store time stamps in DOS format. + * (The only known exception is creation time on VFAT partitions.) + */ + return (*ut != (time_t)-1L); +#endif /* ?HAVE_MKTIME */ + +} /* end function VFatFileTime2utime() */ +#endif /* W32_STAT_BANDAID */ + + + +/********************************/ +/* Function UTCtime2Localtime() */ /* borrowed from Zip's mkgmtime() */ +/********************************/ + +static time_t UTCtime2Localtime(time_t utctime) +{ + time_t utc = utctime; + struct tm *tm; + unsigned years, months, days, hours, minutes, seconds; + + +#ifdef __BORLANDC__ /* Borland C++ 5.x crashes when trying to reference tm */ + if (utc < UTIME_1980_JAN_01_00_00) + utc = UTIME_1980_JAN_01_00_00; +#endif + tm = localtime(&utc); + if (tm == (struct tm *)NULL) + /* localtime() did not accept given utc time value; as an emergency + exit, the unconverted utctime value is returned */ + return utctime; + + years = tm->tm_year + 1900; /* year - 1900 -> year */ + months = tm->tm_mon; /* 0..11 */ + days = tm->tm_mday - 1; /* 1..31 -> 0..30 */ + hours = tm->tm_hour; /* 0..23 */ + minutes = tm->tm_min; /* 0..59 */ + seconds = tm->tm_sec; /* 0..61 in ANSI C */ + + /* set `days' to the number of days into the year */ + days += ydays[months] + (months > 1 && leap(years)); + + /* now set `days' to the number of days since 1 Jan 1970 */ + days += 365 * (years - 1970) + nleap(years); + + return (time_t)(86400L * (ulg)days + 3600L * (ulg)hours + + (ulg)(60 * minutes + seconds)); + +} /* end function UTCtime2Localtime() */ + + + +/********************************/ +/* Function NTtzbugWorkaround() */ +/********************************/ + +static void NTtzbugWorkaround(time_t ut, FILETIME *pft) +{ + FILETIME C_RTL_locft, NTAPI_locft; + time_t ux_loctime = UTCtime2Localtime(ut); + + /* This routine is only used when the target file system stores time- + * stamps as local time in MSDOS format. Thus we make sure that the + * resulting timestamp is within the range of MSDOS date-time values. */ + if (ux_loctime < UTIME_1980_JAN_01_00_00) + ux_loctime = UTIME_1980_JAN_01_00_00; + + utime2FileTime(ux_loctime, &C_RTL_locft); + if (!FileTimeToLocalFileTime(pft, &NTAPI_locft)) + return; + else { + long time_shift_l, time_shift_h; + int carry = 0; + + time_shift_l = C_RTL_locft.dwLowDateTime - NTAPI_locft.dwLowDateTime; + if (C_RTL_locft.dwLowDateTime < NTAPI_locft.dwLowDateTime) + carry--; + time_shift_h = C_RTL_locft.dwHighDateTime - NTAPI_locft.dwHighDateTime; + pft->dwLowDateTime += time_shift_l; + if (pft->dwLowDateTime < (ulg)time_shift_l) + carry++; + pft->dwHighDateTime += time_shift_h + carry; + TTrace((stdout, "FileTime shift: %08lx:%08lx\n", + time_shift_h+carry,time_shift_l)); + } +} /* end function NTtzbugWorkaround() */ + +#endif /* ?NT_TZBUG_WORKAROUND */ + + + +/****************************/ /* Get the file time in a format that */ +/* Function getNTfiletime() */ /* can be used by SetFileTime() in NT */ +/****************************/ + +static int getNTfiletime(__G__ pModFT, pAccFT, pCreFT) + __GDEF + FILETIME *pModFT; + FILETIME *pAccFT; + FILETIME *pCreFT; +{ +#ifdef NT_TZBUG_WORKAROUND + time_t ux_modtime; +#else /* !NT_TZBUG_WORKAROUND */ + FILETIME locft; /* 64-bit value made up of two 32-bit [low & high] */ + WORD wDOSDate; /* for converting from DOS date to Windows NT */ + WORD wDOSTime; +#endif /* ?NT_TZBUG_WORKAROUND */ +#ifdef USE_EF_UT_TIME + unsigned eb_izux_flg; + iztimes z_utime; /* struct for Unix-style actime & modtime, + creatime */ +#endif +#if (defined(USE_EF_UT_TIME) && !defined(NT_TZBUG_WORKAROUND)) + time_t utime_dosmin; +# endif +#if (defined(USE_EF_UT_TIME) || defined(NT_TZBUG_WORKAROUND)) + int fs_uses_loctime = FStampIsLocTime(__G__ G.filename); +#endif + + /* Copy and/or convert time and date variables, if necessary; + * return a flag indicating which time stamps are available. */ +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + ((eb_izux_flg = ef_scan_for_izux(G.extra_field, + G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime, + &z_utime, NULL)) & EB_UT_FL_MTIME)) + { + TTrace((stderr, "getNTfiletime: Unix e.f. modif. time = %lu\n", + z_utime.mtime)); + UTIME_BOUNDCHECK_1(z_utime.mtime) + utime2FileTime(z_utime.mtime, pModFT); + NT_TZBUG_PRECOMPENSATE(z_utime.mtime, pModFT) + if (eb_izux_flg & EB_UT_FL_ATIME) { + UTIME_BOUNDCHECK_N(z_utime.atime) + utime2FileTime(z_utime.atime, pAccFT); + NT_TZBUG_PRECOMPENSATE(z_utime.atime, pAccFT) + } + if (eb_izux_flg & EB_UT_FL_CTIME) { + UTIME_BOUNDCHECK_N(z_utime.ctime) + utime2FileTime(z_utime.ctime, pCreFT); + NT_TZBUG_PRECOMPENSATE(z_utime.ctime, pCreFT) + } + return (int)eb_izux_flg; + } +#endif /* USE_EF_UT_TIME */ +#ifdef NT_TZBUG_WORKAROUND + ux_modtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime); + utime2FileTime(ux_modtime, pModFT); + NT_TZBUG_PRECOMPENSATE(ux_modtime, pModFT) +#else /* !NT_TZBUG_WORKAROUND */ + + wDOSTime = (WORD)(G.lrec.last_mod_dos_datetime); + wDOSDate = (WORD)(G.lrec.last_mod_dos_datetime >> 16); + + /* The DosDateTimeToFileTime() function converts a DOS date/time + * into a 64-bit Windows NT file time */ + if (!DosDateTimeToFileTime(wDOSDate, wDOSTime, &locft)) + { + Info(slide, 0, ((char *)slide, "DosDateTime failed: %d\n", + (int)GetLastError())); + return 0; + } + if (!LocalFileTimeToFileTime(&locft, pModFT)) + { + Info(slide, 0, ((char *)slide, "LocalFileTime failed: %d\n", + (int)GetLastError())); + *pModFT = locft; + } +#endif /* ?NT_TZBUG_WORKAROUND */ + *pAccFT = *pModFT; + return (EB_UT_FL_MTIME | EB_UT_FL_ATIME); + +} /* end function getNTfiletime() */ + + + + +/****************************/ +/* Function close_outfile() */ +/****************************/ + +void close_outfile(__G) + __GDEF +{ + FILETIME Modft; /* File time type defined in NT, `last modified' time */ + FILETIME Accft; /* NT file time type, `last access' time */ + FILETIME Creft; /* NT file time type, `file creation' time */ + HANDLE hFile; /* File handle defined in NT */ + int gotTime; +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_name = (char *)alloca(strlen(G.filename) + 1); + + INTERN_TO_ISO(G.filename, ansi_name); +# define Ansi_Fname ansi_name +#else +# define Ansi_Fname G.filename +#endif + + /* Close the file and then re-open it using the Win32 + * CreateFile call, so that the file can be created + * with GENERIC_WRITE access, otherwise the SetFileTime + * call will fail. */ + fclose(G.outfile); + + /* don't set the time stamp and attributes on standard output */ + if (uO.cflag) + return; + + gotTime = getNTfiletime(__G__ &Modft, &Accft, &Creft); + + /* open a handle to the file before processing extra fields; + we do this in case new security on file prevents us from updating + time stamps */ + hFile = CreateFile(Ansi_Fname, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + /* sfield@microsoft.com: set attributes before time in case we decide to + support other filetime members later. This also allows us to apply + attributes before the security is changed, which may prevent this + from succeeding otherwise. Also, since most files don't have + any interesting attributes, only change them if something other than + FILE_ATTRIBUTE_ARCHIVE appears in the attributes. This works well + as an optimization because FILE_ATTRIBUTE_ARCHIVE gets applied to the + file anyway, when it's created new. */ + if((G.pInfo->file_attr & 0x7F) & ~FILE_ATTRIBUTE_ARCHIVE) { + if (!SetFileAttributes(Ansi_Fname, G.pInfo->file_attr & 0x7F)) + Info(slide, 1, ((char *)slide, + "\nwarning (%d): could not set file attributes\n", + (int)GetLastError())); + } + +#ifdef NTSD_EAS + /* set extra fields, both stored-in-zipfile and .LONGNAME flavors */ + if (G.extra_field) { /* zipfile extra field may have extended attribs */ + int err = EvalExtraFields(__G__ G.filename, G.extra_field, + G.lrec.extra_field_length); + + if (err == IZ_EF_TRUNC) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + Info(slide, 1, ((char *)slide, LoadFarString(TruncNTSD), + makeword(G.extra_field+2)-10, uO.qflag? "\n":"")); + } + } +#endif /* NTSD_EAS */ + + if ( hFile == INVALID_HANDLE_VALUE ) + Info(slide, 1, ((char *)slide, + "\nCreateFile error %d when trying set file time\n", + (int)GetLastError())); + else { + if (gotTime) { + FILETIME *pModft = (gotTime & EB_UT_FL_MTIME) ? &Modft : NULL; + FILETIME *pAccft = (gotTime & EB_UT_FL_ATIME) ? &Accft : NULL; + FILETIME *pCreft = (gotTime & EB_UT_FL_CTIME) ? &Creft : NULL; + + if (!SetFileTime(hFile, pCreft, pAccft, pModft)) + Info(slide, 0, ((char *)slide, "\nSetFileTime failed: %d\n", + (int)GetLastError())); + } + CloseHandle(hFile); + } + + return; + +#undef Ansi_Fname + +} /* end function close_outfile() */ + + + + +#ifdef TIMESTAMP + +/*************************/ +/* Function stamp_file() */ +/*************************/ + +int stamp_file(__GPRO__ ZCONST char *fname, time_t modtime) +{ + FILETIME Modft; /* File time type defined in NT, `last modified' time */ + HANDLE hFile; /* File handle defined in NT */ + int errstat = 0; /* return status: 0 == "OK", -1 == "Failure" */ +#ifndef NT_TZBUG_WORKAROUND + time_t utime_dosmin; /* internal variable for UTIME_BOUNDCHECK_1 */ +#endif + int fs_uses_loctime = FStampIsLocTime(__G__ fname); +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_name = (char *)alloca(strlen(fname) + 1); + + INTERN_TO_ISO(fname, ansi_name); +# define Ansi_Fname ansi_name +#else +# define Ansi_Fname fname +#endif + + /* open a handle to the file to prepare setting the mod-time stamp */ + hFile = CreateFile(Ansi_Fname, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if ( hFile == INVALID_HANDLE_VALUE ) { + errstat = -1; + } else { + /* convert time_t modtime into WIN32 native 64bit format */ + UTIME_BOUNDCHECK_1(modtime) + utime2FileTime(modtime, &Modft); + NT_TZBUG_PRECOMPENSATE(modtime, &Modft) + /* set Access and Modification times of the file to modtime */ + if (!SetFileTime(hFile, NULL, &Modft, &Modft)) { + errstat = -1; + } + CloseHandle(hFile); + } + + return errstat; + +#undef Ansi_Fname +} /* end function stamp_file() */ + +#endif /* TIMESTAMP */ + + + + +/***********************/ +/* Function isfloppy() */ /* more precisely, is it removable? */ +/***********************/ + +static int isfloppy(int nDrive) /* 1 == A:, 2 == B:, etc. */ +{ + char rootPathName[4]; + + rootPathName[0] = (char)('A' + nDrive - 1); /* build the root path */ + rootPathName[1] = ':'; /* name, e.g. "A:/" */ + rootPathName[2] = '/'; + rootPathName[3] = '\0'; + + return (GetDriveType(rootPathName) == DRIVE_REMOVABLE); + +} /* end function isfloppy() */ + + + + +/*****************************/ +/* Function NTQueryVolInfo() */ +/*****************************/ + +/* + * Note: 8.3 limits on filenames apply only to old-style FAT filesystems. + * More recent versions of Windows (Windows NT 3.5 / Windows 4.0) + * can support long filenames (LFN) on FAT filesystems. Check the + * filesystem maximum component length field to detect LFN support. + */ + +static int NTQueryVolInfo(__GPRO__ const char *name) +{ + /* static char lastRootPath[4] = ""; */ + /* static int lastVolOldFAT; */ + /* static int lastVolLocTim; */ + char *tmp0; + char tmp1[MAX_PATH], tmp2[MAX_PATH]; + unsigned volSerNo, maxCompLen, fileSysFlags; +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_name = (char *)alloca(strlen(name) + 1); + + INTERN_TO_ISO(name, ansi_name); + name = ansi_name; +#endif + + if ((!strncmp(name, "//", 2) || !strncmp(name,"\\\\", 2)) && + (name[2] != '\0' && name[2] != '/' && name[2] != '\\')) { + /* GetFullPathname() and GetVolumeInformation() do not work + * on UNC names. For now, we return "error". + * **FIXME**: check if UNC name is mapped to a drive letter + * and use mapped drive for volume info query. + */ + return FALSE; + } + if (isalpha((uch)name[0]) && (name[1] == ':')) + tmp0 = (char *)name; + else + { + if (!GetFullPathName(name, MAX_PATH, tmp1, &tmp0)) + return FALSE; + tmp0 = &tmp1[0]; + } + if (strncmp(G.lastRootPath, tmp0, 2) != 0) { + /* For speed, we skip repeated queries for the same device */ + strncpy(G.lastRootPath, tmp0, 2); /* Build the root path name, */ + G.lastRootPath[2] = '/'; /* e.g. "A:/" */ + G.lastRootPath[3] = '\0'; + + if (!GetVolumeInformation((LPCTSTR)G.lastRootPath, + (LPTSTR)tmp1, (DWORD)MAX_PATH, + (LPDWORD)&volSerNo, (LPDWORD)&maxCompLen, + (LPDWORD)&fileSysFlags, (LPTSTR)tmp2, (DWORD)MAX_PATH)) { + G.lastRootPath[0] = '\0'; + return FALSE; + } + + /* LFNs are available if the component length is > 12 */ + G.lastVolOldFAT = (maxCompLen <= 12); +/* G.lastVolOldFAT = !strncmp(strupr(tmp2), "FAT", 3); old version */ + + /* Volumes in (V)FAT and (OS/2) HPFS format store file timestamps in + * local time! + */ + G.lastVolLocTim = !strncmp(strupr(tmp2), "VFAT", 4) || + !strncmp(tmp2, "HPFS", 4) || + !strncmp(tmp2, "FAT", 3); + } + + return TRUE; + +} /* end function NTQueryVolInfo() */ + + + + +/*****************************/ +/* Function IsVolumeOldFAT() */ +/*****************************/ + +static int IsVolumeOldFAT(__GPRO__ const char *name) +{ + return (NTQueryVolInfo(__G__ name) ? G.lastVolOldFAT : FALSE); +} + + + + +#ifndef SFX + +/************************/ +/* Function do_wild() */ /* identical to OS/2 version */ +/************************/ + +char *do_wild(__G__ wildspec) + __GDEF + char *wildspec; /* only used first time on a given dir */ +{ + /* static zDIR *wild_dir = NULL; */ + /* static char *dirname, *wildname, matchname[FILNAMSIZ]; */ + /* static int firstcall=TRUE, have_dirname, dirnamelen; */ + char *fnamestart; + struct zdirent *file; + + /* Even when we're just returning wildspec, we *always* do so in + * matchname[]--calling routine is allowed to append four characters + * to the returned string, and wildspec may be a pointer to argv[]. + */ + if (!G.notfirstcall) { /* first call: must initialize everything */ + G.notfirstcall = TRUE; + + if (!iswild(wildspec)) { + strcpy(G.matchname, wildspec); + G.have_dirname = FALSE; + G.wild_dir = NULL; + return G.matchname; + } + + /* break the wildspec into a directory part and a wildcard filename */ + if ((G.wildname = strrchr(wildspec, '/')) == NULL && + (G.wildname = strrchr(wildspec, ':')) == NULL) { + G.dirname = "."; + G.dirnamelen = 1; + G.have_dirname = FALSE; + G.wildname = wildspec; + } else { + ++G.wildname; /* point at character after '/' or ':' */ + G.dirnamelen = G.wildname - wildspec; + if ((G.dirname = (char *)malloc(G.dirnamelen+1)) == NULL) { + Info(slide, 1, ((char *)slide, + "warning: cannot allocate wildcard buffers\n")); + strcpy(G.matchname, wildspec); + return G.matchname; /* but maybe filespec was not a wildcard */ + } + strncpy(G.dirname, wildspec, G.dirnamelen); + G.dirname[G.dirnamelen] = '\0'; /* terminate for strcpy below */ + G.have_dirname = TRUE; + } + Trace((stderr, "do_wild: dirname = [%s]\n", G.dirname)); + + if ((G.wild_dir = (zvoid *)Opendir(G.dirname)) != NULL) { + if (G.have_dirname) { + strcpy(G.matchname, G.dirname); + fnamestart = G.matchname + G.dirnamelen; + } else + fnamestart = G.matchname; + while ((file = Readdir((zDIR *)G.wild_dir)) != NULL) { + Trace((stderr, "do_wild: Readdir returns %s\n", file->d_name)); + strcpy(fnamestart, file->d_name); + if (strrchr(fnamestart, '.') == (char *)NULL) + strcat(fnamestart, "."); + if (match(fnamestart, G.wildname, 1) && /* 1 == ignore case */ + /* skip "." and ".." directory entries */ + strcmp(fnamestart, ".") && strcmp(fnamestart, "..")) { + Trace((stderr, "do_wild: match() succeeds\n")); + /* remove trailing dot */ + fnamestart += strlen(fnamestart) - 1; + if (*fnamestart == '.') + *fnamestart = '\0'; + return G.matchname; + } + } + /* if we get to here directory is exhausted, so close it */ + Closedir((zDIR *)G.wild_dir); + G.wild_dir = NULL; + } + Trace((stderr, "do_wild: Opendir(%s) returns NULL\n", G.dirname)); + + /* return the raw wildspec in case that works (e.g., directory not + * searchable, but filespec was not wild and file is readable) */ + strcpy(G.matchname, wildspec); + return G.matchname; + } + + /* last time through, might have failed opendir but returned raw wildspec */ + if (G.wild_dir == NULL) { + G.notfirstcall = FALSE; /* reset for new wildspec */ + if (G.have_dirname) + free(G.dirname); + return (char *)NULL; + } + + /* If we've gotten this far, we've read and matched at least one entry + * successfully (in a previous call), so dirname has been copied into + * matchname already. + */ + if (G.have_dirname) { + /* strcpy(G.matchname, G.dirname); */ + fnamestart = G.matchname + G.dirnamelen; + } else + fnamestart = G.matchname; + while ((file = Readdir((zDIR *)G.wild_dir)) != NULL) { + Trace((stderr, "do_wild: readdir returns %s\n", file->d_name)); + strcpy(fnamestart, file->d_name); + if (strrchr(fnamestart, '.') == (char *)NULL) + strcat(fnamestart, "."); + if (match(fnamestart, G.wildname, 1)) { /* 1 == ignore case */ + Trace((stderr, "do_wild: match() succeeds\n")); + /* remove trailing dot */ + fnamestart += strlen(fnamestart) - 1; + if (*fnamestart == '.') + *fnamestart = '\0'; + return G.matchname; + } + } + + Closedir((zDIR *)G.wild_dir); /* at least one entry read; nothing left */ + G.wild_dir = NULL; + G.notfirstcall = FALSE; /* reset for new wildspec */ + if (G.have_dirname) + free(G.dirname); + return (char *)NULL; + +} /* end function do_wild() */ + +#endif /* !SFX */ + + + +/**********************/ +/* Function mapattr() */ +/**********************/ + +/* Identical to MS-DOS, OS/2 versions. However, NT has a lot of extra + * permission stuff, so this function should probably be extended in the + * future. */ + +int mapattr(__G) + __GDEF +{ + /* set archive bit for file entries (file is not backed up): */ + G.pInfo->file_attr = ((unsigned)G.crec.external_file_attributes | + (G.crec.external_file_attributes & FILE_ATTRIBUTE_DIRECTORY ? + 0 : FILE_ATTRIBUTE_ARCHIVE)) & 0xff; + return 0; + +} /* end function mapattr() */ + + + + +/************************/ +/* Function mapname() */ +/************************/ + /* return 0 if no error, 1 if caution (filename */ +int mapname(__G__ renamed) /* truncated), 2 if warning (skip file because */ + __GDEF /* dir doesn't exist), 3 if error (skip file), */ + int renamed; /* or 10 if out of memory (skip file) */ +{ /* [also IZ_VOL_LABEL, IZ_CREATED_DIR] */ + char pathcomp[FILNAMSIZ]; /* path-component buffer */ + char *pp, *cp=NULL; /* character pointers */ + char *lastsemi = NULL; /* pointer to last semi-colon in pathcomp */ + int error; + register unsigned workch; /* hold the character being tested */ + + +/*--------------------------------------------------------------------------- + Initialize various pointers and counters and stuff. + ---------------------------------------------------------------------------*/ + + /* can create path as long as not just freshening, or if user told us */ + G.create_dirs = (!uO.fflag || renamed); + + G.created_dir = FALSE; /* not yet */ + G.renamed_fullpath = FALSE; + G.fnlen = strlen(G.filename); + + if (renamed) { + cp = G.filename - 1; /* point to beginning of renamed name... */ + while (*++cp) + if (*cp == '\\') /* convert backslashes to forward */ + *cp = '/'; + cp = G.filename; + /* use temporary rootpath if user gave full pathname */ + if (G.filename[0] == '/') { + G.renamed_fullpath = TRUE; + pathcomp[0] = '/'; /* copy the '/' and terminate */ + pathcomp[1] = '\0'; + ++cp; + } else if (isalpha((uch)G.filename[0]) && G.filename[1] == ':') { + G.renamed_fullpath = TRUE; + pp = pathcomp; + *pp++ = *cp++; /* copy the "d:" (+ '/', possibly) */ + *pp++ = *cp++; + if (*cp == '/') + *pp++ = *cp++; /* otherwise add "./"? */ + *pp = '\0'; + } + } + + /* pathcomp is ignored unless renamed_fullpath is TRUE: */ + if ((error = checkdir(__G__ pathcomp, INIT)) != 0) /* init path buffer */ + return error; /* ...unless no mem or vol label on hard disk */ + + *pathcomp = '\0'; /* initialize translation buffer */ + pp = pathcomp; /* point to translation buffer */ + if (!renamed) { /* cp already set if renamed */ + if (uO.jflag) /* junking directories */ + cp = (char *)strrchr(G.filename, '/'); + if (cp == NULL) /* no '/' or not junking dirs */ + cp = G.filename; /* point to internal zipfile-member pathname */ + else + ++cp; /* point to start of last component of path */ + } + +/*--------------------------------------------------------------------------- + Begin main loop through characters in filename. + ---------------------------------------------------------------------------*/ + + while ((workch = (uch)*cp++) != 0) { + + switch (workch) { + case '/': /* can assume -j flag not given */ + *pp = '\0'; + if ((error = checkdir(__G__ pathcomp, APPEND_DIR)) > 1) + return error; + pp = pathcomp; /* reset conversion buffer for next piece */ + lastsemi = NULL; /* leave directory semi-colons alone */ + break; + + case ':': /* drive names not stored in zipfile, */ + case '<': /* so no colons allowed */ + case '>': /* no redirection symbols allowed either */ + case '|': /* no pipe signs allowed */ + case '"': /* no double quotes allowed */ + case '?': /* no wildcards allowed */ + case '*': + *pp++ = '_'; /* these rules apply equally to FAT and NTFS */ + break; + case ';': /* start of VMS version? */ + lastsemi = pp; /* remove VMS version later... */ + *pp++ = ';'; /* but keep semicolon for now */ + break; + + case ' ': /* keep spaces unless specifically */ + /* NT cannot create filenames with spaces on FAT volumes */ + if (uO.sflag || IsVolumeOldFAT(__G__ G.filename)) + *pp++ = '_'; + else + *pp++ = ' '; + break; + + default: + /* allow European characters in filenames: */ + if (isprint(workch) || workch >= 127) + *pp++ = (char)workch; + } /* end switch */ + } /* end while loop */ + + *pp = '\0'; /* done with pathcomp: terminate it */ + + /* if not saving them, remove VMS version numbers (appended "###") */ + if (!uO.V_flag && lastsemi) { + pp = lastsemi + 1; /* semi-colon was kept: expect #'s after */ + while (isdigit((uch)(*pp))) + ++pp; + if (*pp == '\0') /* only digits between ';' and end: nuke */ + *lastsemi = '\0'; + } + +/*--------------------------------------------------------------------------- + Report if directory was created (and no file to create: filename ended + in '/'), check name to be sure it exists, and combine path and name be- + fore exiting. + ---------------------------------------------------------------------------*/ + + if (G.filename[G.fnlen-1] == '/') { + checkdir(__G__ G.filename, GETPATH); + if (G.created_dir) { +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_name = (char *)alloca(strlen(G.filename) + 1); + + INTERN_TO_ISO(G.filename, ansi_name); +# define Ansi_Fname ansi_name +#else +# define Ansi_Fname G.filename +#endif + if (QCOND2) { + Info(slide, 0, ((char *)slide, " creating: %-22s\n", + FnFilter1(G.filename))); + } + + /* set file attributes: + The default for newly created directories is "DIR attribute + flags set", so there is no need to change attributes unless + one of the DOS style attribute flags is set. The readonly + attribute need not be masked, since it does not prevent + modifications in the new directory. */ + if(G.pInfo->file_attr & (0x7F & ~FILE_ATTRIBUTE_DIRECTORY)) { + if (!SetFileAttributes(Ansi_Fname, G.pInfo->file_attr & 0x7F)) + Info(slide, 1, ((char *)slide, + "\nwarning (%d): could not set file attributes for %s\n", + (int)GetLastError(), G.filename)); + } + +#ifdef NTSD_EAS + /* set extra fields, both stored-in-zipfile and .LONGNAME flavors */ + if (G.extra_field) { /* zipfile e.f. may have extended attribs */ + int err = EvalExtraFields(__G__ G.filename, G.extra_field, + G.lrec.extra_field_length); + + if (err == IZ_EF_TRUNC) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + Info(slide, 1, ((char *)slide, LoadFarString(TruncNTSD), + makeword(G.extra_field+2)-10, uO.qflag? "\n":"")); + } + } +#endif /* NTSD_EAS */ + return IZ_CREATED_DIR; /* set dir time (note trailing '/') */ + } + return 2; /* dir existed already; don't look for data to extract */ + } + + if (*pathcomp == '\0') { + Info(slide, 1, ((char *)slide, "mapname: conversion of %s failed\n", + FnFilter1(G.filename))); + return 3; + } + + checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */ + checkdir(__G__ G.filename, GETPATH); + Trace((stderr, "mapname returns with filename = [%s] (error = %d)\n\n", + FnFilter1(G.filename), error)); + + if (G.pInfo->vollabel) { /* set the volume label now */ + char drive[4]; +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_name = (char *)alloca(strlen(G.filename) + 1); + INTERN_TO_ISO(G.filename, ansi_name); +# define Ansi_Fname ansi_name +#else +# define Ansi_Fname G.filename +#endif + + /* Build a drive string, e.g. "b:" */ + drive[0] = (char)('a' + G.nLabelDrive - 1); + strcpy(drive + 1, ":\\"); + if (QCOND2) + Info(slide, 0, ((char *)slide, "labelling %s %-22s\n", drive, + FnFilter1(G.filename))); + if (!SetVolumeLabel(drive, Ansi_Fname)) { + Info(slide, 1, ((char *)slide, + "mapname: error setting volume label\n")); + return 3; + } + return 2; /* success: skip the "extraction" quietly */ +#undef Ansi_Fname + } + + return error; + +} /* end function mapname() */ + + + + +/**********************/ +/* Function map2fat() */ /* Not quite identical to OS/2 version */ +/**********************/ + +static void map2fat(pathcomp, pEndFAT) + char *pathcomp, **pEndFAT; +{ + char *ppc = pathcomp; /* variable pointer to pathcomp */ + char *pEnd = *pEndFAT; /* variable pointer to buildpathFAT */ + char *pBegin = *pEndFAT; /* constant pointer to start of this comp. */ + char *last_dot = NULL; /* last dot not converted to underscore */ + int dotname = FALSE; /* flag: path component begins with dot */ + /* ("." and ".." don't count) */ + register unsigned workch; /* hold the character being tested */ + + + /* Only need check those characters which are legal in NTFS but not + * in FAT: to get here, must already have passed through mapname. + * Also must truncate path component to ensure 8.3 compliance. + */ + while ((workch = (uch)*ppc++) != 0) { + switch (workch) { + case '[': + case ']': + case '+': + case ',': + case ';': + case '=': + *pEnd++ = '_'; /* convert brackets to underscores */ + break; + + case '.': + if (pEnd == *pEndFAT) { /* nothing appended yet... */ + if (*ppc == '\0') /* don't bother appending a */ + break; /* "./" component to the path */ + else if (*ppc == '.' && ppc[1] == '\0') { /* "../" */ + *pEnd++ = '.'; /* add first dot, unchanged... */ + ++ppc; /* skip second dot, since it will */ + } else { /* be "added" at end of if-block */ + *pEnd++ = '_'; /* FAT doesn't allow null filename */ + dotname = TRUE; /* bodies, so map .exrc -> _.exrc */ + } /* (extra '_' now, "dot" below) */ + } else if (dotname) { /* found a second dot, but still */ + dotname = FALSE; /* have extra leading underscore: */ + *pEnd = '\0'; /* remove it by shifting chars */ + pEnd = *pEndFAT + 1; /* left one space (e.g., .p1.p2: */ + while (pEnd[1]) { /* __p1 -> _p1_p2 -> _p1.p2 when */ + *pEnd = pEnd[1]; /* finished) [opt.: since first */ + ++pEnd; /* two chars are same, can start */ + } /* shifting at second position] */ + } + last_dot = pEnd; /* point at last dot so far... */ + *pEnd++ = '_'; /* convert dot to underscore for now */ + break; + + default: + *pEnd++ = (char)workch; + + } /* end switch */ + } /* end while loop */ + + *pEnd = '\0'; /* terminate buildpathFAT */ + + /* NOTE: keep in mind that pEnd points to the end of the path + * component, and *pEndFAT still points to the *beginning* of it... + * Also note that the algorithm does not try to get too fancy: + * if there are no dots already, the name either gets truncated + * at 8 characters or the last underscore is converted to a dot + * (only if more characters are saved that way). In no case is + * a dot inserted between existing characters. + */ + if (last_dot == NULL) { /* no dots: check for underscores... */ + char *plu = strrchr(pBegin, '_'); /* pointer to last underscore */ + + if (plu == NULL) { /* no dots, no underscores: truncate at 8 chars */ + *pEndFAT += 8; /* (or could insert '.' and keep 11...?) */ + if (*pEndFAT > pEnd) + *pEndFAT = pEnd; /* oops...didn't have 8 chars to truncate */ + else + **pEndFAT = '\0'; + } else if (MIN(plu - pBegin, 8) + MIN(pEnd - plu - 1, 3) > 8) { + last_dot = plu; /* be lazy: drop through to next if-blk */ + } else if ((pEnd - *pEndFAT) > 8) { + *pEndFAT += 8; /* more fits into just basename than if */ + **pEndFAT = '\0'; /* convert last underscore to dot */ + } else + *pEndFAT = pEnd; /* whole thing fits into 8 chars or less */ + } + + if (last_dot != NULL) { /* one dot (or two, in the case of */ + *last_dot = '.'; /* "..") is OK: put it back in */ + + if ((last_dot - pBegin) > 8) { + char *p, *q; + int i; + + p = last_dot; + q = last_dot = pBegin + 8; + for (i = 0; (i < 4) && *p; ++i) /* too many chars in basename: */ + *q++ = *p++; /* shift .ext left and trun- */ + *q = '\0'; /* cate/terminate it */ + *pEndFAT = q; + } else if ((pEnd - last_dot) > 4) { /* too many chars in extension */ + *pEndFAT = last_dot + 4; + **pEndFAT = '\0'; + } else + *pEndFAT = pEnd; /* filename is fine; point at terminating zero */ + + if ((last_dot - pBegin) > 0 && last_dot[-1] == ' ') + last_dot[-1] = '_'; /* NO blank in front of '.'! */ + } +} /* end function map2fat() */ + + + + +/***********************/ /* Borrowed from os2.c for UnZip 5.1. */ +/* Function checkdir() */ /* Difference: no EA stuff */ +/***********************/ /* HPFS stuff works on NTFS too */ + +int checkdir(__G__ pathcomp, flag) + __GDEF + char *pathcomp; + int flag; +/* + * returns: 1 - (on APPEND_NAME) truncated filename + * 2 - path doesn't exist, not allowed to create + * 3 - path doesn't exist, tried to create and failed; or + * path exists and is not a directory, but is supposed to be + * 4 - path is too long + * 10 - can't allocate memory for filename buffers + */ +{ + /* static int rootlen = 0; */ /* length of rootpath */ + /* static char *rootpath; */ /* user's "extract-to" directory */ + /* static char *buildpathHPFS; */ /* full path (so far) to extracted file, */ + /* static char *buildpathFAT; */ /* both HPFS/EA (main) and FAT versions */ + /* static char *endHPFS; */ /* corresponding pointers to end of */ + /* static char *endFAT; */ /* buildpath ('\0') */ + +# define FN_MASK 7 +# define FUNCTION (flag & FN_MASK) + + + +/*--------------------------------------------------------------------------- + APPEND_DIR: append the path component to the path being built and check + for its existence. If doesn't exist and we are creating directories, do + so for this one; else signal success or error as appropriate. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_DIR) { + char *p = pathcomp; + int too_long=FALSE; + + Trace((stderr, "appending dir segment [%s]\n", pathcomp)); + while ((*G.endHPFS = *p++) != '\0') /* copy to HPFS filename */ + ++G.endHPFS; + if (!IsVolumeOldFAT(__G__ G.buildpathHPFS)) { + p = pathcomp; + while ((*G.endFAT = *p++) != '\0') /* copy to FAT filename, too */ + ++G.endFAT; + } else + map2fat(pathcomp, &G.endFAT); /* map into FAT fn, update endFAT */ + + /* GRR: could do better check, see if overrunning buffer as we go: + * check endHPFS-buildpathHPFS after each append, set warning variable + * if within 20 of FILNAMSIZ; then if var set, do careful check when + * appending. Clear variable when begin new path. */ + + /* next check: need to append '/', at least one-char name, '\0' */ + if ((G.endHPFS-G.buildpathHPFS) > FILNAMSIZ-3) + too_long = TRUE; /* check if extracting dir? */ +#ifdef FIX_STAT_BUG + /* Borland C++ 5.0 does not handle a call to stat() well if the + * directory does not exist (it tends to crash in strange places.) + * This is apparently a problem only when compiling for GUI rather + * than console. The code below attempts to work around this problem. + */ + if (access(G.buildpathFAT, 0) != 0) { + if (!G.create_dirs) { /* told not to create (freshening) */ + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 2; /* path doesn't exist: nothing to do */ + } + if (too_long) { /* GRR: should allow FAT extraction w/o EAs */ + Info(slide, 1, ((char *)slide, + "checkdir error: path too long: %s\n", + FnFilter1(G.buildpathHPFS))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 4; /* no room for filenames: fatal */ + } + if (MKDIR(G.buildpathFAT, 0777) == -1) { /* create the directory */ + Info(slide, 1, ((char *)slide, + "checkdir error: cannot create %s\n\ + unable to process %s.\n", + FnFilter2(G.buildpathFAT), FnFilter1(G.filename))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 3; /* path didn't exist, tried to create, failed */ + } + G.created_dir = TRUE; + } +#endif /* FIX_STAT_BUG */ + if (SSTAT(G.buildpathFAT, &G.statbuf)) /* path doesn't exist */ + { + if (!G.create_dirs) { /* told not to create (freshening) */ + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 2; /* path doesn't exist: nothing to do */ + } + if (too_long) { /* GRR: should allow FAT extraction w/o EAs */ + Info(slide, 1, ((char *)slide, + "checkdir error: path too long: %s\n", + FnFilter1(G.buildpathHPFS))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 4; /* no room for filenames: fatal */ + } + if (MKDIR(G.buildpathFAT, 0777) == -1) { /* create the directory */ + Info(slide, 1, ((char *)slide, + "checkdir error: cannot create %s\n\ + unable to process %s.\n", + FnFilter2(G.buildpathFAT), FnFilter1(G.filename))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 3; /* path didn't exist, tried to create, failed */ + } + G.created_dir = TRUE; + } else if (!S_ISDIR(G.statbuf.st_mode)) { + Info(slide, 1, ((char *)slide, + "checkdir error: %s exists but is not directory\n \ + unable to process %s.\n", + FnFilter2(G.buildpathFAT), FnFilter1(G.filename))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 3; /* path existed but wasn't dir */ + } + if (too_long) { + Info(slide, 1, ((char *)slide, + "checkdir error: path too long: %s\n", + FnFilter1(G.buildpathHPFS))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 4; /* no room for filenames: fatal */ + } + *G.endHPFS++ = '/'; + *G.endFAT++ = '/'; + *G.endHPFS = *G.endFAT = '\0'; + Trace((stderr, "buildpathHPFS now = [%s]\nbuildpathFAT now = [%s]\n", + FnFilter1(G.buildpathHPFS), FnFilter2(G.buildpathFAT))); + return 0; + + } /* end if (FUNCTION == APPEND_DIR) */ + +/*--------------------------------------------------------------------------- + GETPATH: copy full FAT path to the string pointed at by pathcomp (want + filename to reflect name used on disk, not EAs; if full path is HPFS, + buildpathFAT and buildpathHPFS will be identical). Also free both paths. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == GETPATH) { + Trace((stderr, "getting and freeing FAT path [%s]\n", + FnFilter1(G.buildpathFAT))); + Trace((stderr, "freeing HPFS path [%s]\n", + FnFilter1(G.buildpathHPFS))); + strcpy(pathcomp, G.buildpathFAT); + free(G.buildpathFAT); + free(G.buildpathHPFS); + G.buildpathHPFS = G.buildpathFAT = G.endHPFS = G.endFAT = NULL; + return 0; + } + +/*--------------------------------------------------------------------------- + APPEND_NAME: assume the path component is the filename; append it and + return without checking for existence. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_NAME) { + char *p = pathcomp; + int error = 0; + + Trace((stderr, "appending filename [%s]\n", FnFilter1(pathcomp))); + while ((*G.endHPFS = *p++) != '\0') { /* copy to HPFS filename */ + ++G.endHPFS; + if ((G.endHPFS-G.buildpathHPFS) >= FILNAMSIZ) { + *--G.endHPFS = '\0'; + Info(slide, 1, ((char *)slide, + "checkdir warning: path too long; truncating\n \ + %s\n -> %s\n", + FnFilter1(G.filename), FnFilter2(G.buildpathHPFS))); + error = 1; /* filename truncated */ + } + } + + if ( G.pInfo->vollabel || !IsVolumeOldFAT(__G__ G.buildpathHPFS)) { + p = pathcomp; + while ((*G.endFAT = *p++) != '\0') /* copy to FAT filename, too */ + ++G.endFAT; + } else + map2fat(pathcomp, &G.endFAT); /* map into FAT fn, update endFAT */ + Trace((stderr, "buildpathHPFS: %s\nbuildpathFAT: %s\n", + FnFilter1(G.buildpathHPFS), FnFilter2(G.buildpathFAT))); + + return error; /* could check for existence, prompt for new name... */ + + } /* end if (FUNCTION == APPEND_NAME) */ + +/*--------------------------------------------------------------------------- + INIT: allocate and initialize buffer space for the file currently being + extracted. If file was renamed with an absolute path, don't prepend the + extract-to path. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == INIT) { + Trace((stderr, "initializing buildpathHPFS and buildpathFAT to ")); + if ((G.buildpathHPFS = (char *)malloc(G.fnlen+G.rootlen+1)) == NULL) + return 10; + if ((G.buildpathFAT = (char *)malloc(G.fnlen+G.rootlen+1)) == NULL) { + free(G.buildpathHPFS); + return 10; + } + if (G.pInfo->vollabel) { /* use root or renamed path, but don't store */ +/* GRR: for network drives, do strchr() and return IZ_VOL_LABEL if not [1] */ + if (G.renamed_fullpath && pathcomp[1] == ':') + *G.buildpathHPFS = (char)ToLower(*pathcomp); + else if (!G.renamed_fullpath && G.rootlen > 1 && + G.rootpath[1] == ':') + *G.buildpathHPFS = (char)ToLower(*G.rootpath); + else { + char tmpN[MAX_PATH], *tmpP; + if (GetFullPathName(".", MAX_PATH, tmpN, &tmpP) > MAX_PATH) + { /* by definition of MAX_PATH we should never get here */ + Info(slide, 1, ((char *)slide, + "checkdir warning: current dir path too long\n")); + return 1; /* can't get drive letter */ + } + G.nLabelDrive = *tmpN - 'a' + 1; + *G.buildpathHPFS = (char)(G.nLabelDrive - 1 + 'a'); + } + G.nLabelDrive = *G.buildpathHPFS - 'a' + 1; /* save for mapname() */ + if (uO.volflag == 0 || *G.buildpathHPFS < 'a' /* no labels/bogus? */ + || (uO.volflag == 1 && !isfloppy(G.nLabelDrive))) { /* !fixed */ + free(G.buildpathHPFS); + free(G.buildpathFAT); + return IZ_VOL_LABEL; /* skipping with message */ + } + *G.buildpathHPFS = '\0'; + } else if (G.renamed_fullpath) /* pathcomp = valid data */ + strcpy(G.buildpathHPFS, pathcomp); + else if (G.rootlen > 0) + strcpy(G.buildpathHPFS, G.rootpath); + else + *G.buildpathHPFS = '\0'; + G.endHPFS = G.buildpathHPFS; + G.endFAT = G.buildpathFAT; + while ((*G.endFAT = *G.endHPFS) != '\0') { + ++G.endFAT; + ++G.endHPFS; + } + Trace((stderr, "[%s]\n", FnFilter1(G.buildpathHPFS))); + return 0; + } + +/*--------------------------------------------------------------------------- + ROOT: if appropriate, store the path in rootpath and create it if neces- + sary; else assume it's a zipfile member and return. This path segment + gets used in extracting all members from every zipfile specified on the + command line. Note that under OS/2 and MS-DOS, if a candidate extract-to + directory specification includes a drive letter (leading "x:"), it is + treated just as if it had a trailing '/'--that is, one directory level + will be created if the path doesn't exist, unless this is otherwise pro- + hibited (e.g., freshening). + ---------------------------------------------------------------------------*/ + +#if (!defined(SFX) || defined(SFX_EXDIR)) + if (FUNCTION == ROOT) { + Trace((stderr, "initializing root path to [%s]\n", + FnFilter1(pathcomp))); + if (pathcomp == NULL) { + G.rootlen = 0; + return 0; + } + if ((G.rootlen = strlen(pathcomp)) > 0) { + int had_trailing_pathsep=FALSE, has_drive=FALSE, xtra=2; + + if (isalpha((uch)pathcomp[0]) && pathcomp[1] == ':') + has_drive = TRUE; /* drive designator */ + if (pathcomp[G.rootlen-1] == '/' || pathcomp[G.rootlen-1] == '\\') { + pathcomp[--G.rootlen] = '\0'; + had_trailing_pathsep = TRUE; + } + if (has_drive && (G.rootlen == 2)) { + if (!had_trailing_pathsep) /* i.e., original wasn't "x:/" */ + xtra = 3; /* room for '.' + '/' + 0 at end of "x:" */ + } else if (G.rootlen > 0) { /* need not check "x:." and "x:/" */ + if (SSTAT(pathcomp, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode)) + { + /* path does not exist */ + if (!G.create_dirs /* || iswild(pathcomp) */ ) { + G.rootlen = 0; + return 2; /* treat as stored file */ + } + /* create directory (could add loop here to scan pathcomp + * and create more than one level, but really necessary?) */ + if (MKDIR(pathcomp, 0777) == -1) { + Info(slide, 1, ((char *)slide, + "checkdir: cannot create extraction directory: %s\n", + FnFilter1(pathcomp))); + G.rootlen = 0; /* path didn't exist, tried to create, */ + return 3; /* failed: file exists, or need 2+ levels */ + } + } + } + if ((G.rootpath = (char *)malloc(G.rootlen+xtra)) == NULL) { + G.rootlen = 0; + return 10; + } + strcpy(G.rootpath, pathcomp); + if (xtra == 3) /* had just "x:", make "x:." */ + G.rootpath[G.rootlen++] = '.'; + G.rootpath[G.rootlen++] = '/'; + G.rootpath[G.rootlen] = '\0'; + Trace((stderr, "rootpath now = [%s]\n", FnFilter1(G.rootpath))); + } + return 0; + } +#endif /* !SFX || SFX_EXDIR */ + +/*--------------------------------------------------------------------------- + END: free rootpath, immediately prior to program exit. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == END) { + Trace((stderr, "freeing rootpath\n")); + if (G.rootlen > 0) { + free(G.rootpath); + G.rootlen = 0; + } + return 0; + } + + return 99; /* should never reach */ + +} /* end function checkdir() */ + + + + + +#ifndef SFX +#ifndef WINDLL + +/************************/ +/* Function version() */ +/************************/ + +void version(__G) + __GDEF +{ + int len; +#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__DJGPP__)) + char buf[80]; +#if (defined(_MSC_VER) && (_MSC_VER > 900)) + char buf2[80]; +#endif +#endif + + len = sprintf((char *)slide, CompiledWith, + +#if defined(_MSC_VER) /* MSC == VC++, but what about SDK compiler? */ + (sprintf(buf, "Microsoft C %d.%02d ", _MSC_VER/100, _MSC_VER%100), buf), +# if (_MSC_VER == 800) + "(Visual C++ v1.1)", +# elif (_MSC_VER == 850) + "(Windows NT v3.5 SDK)", +# elif (_MSC_VER == 900) + "(Visual C++ v2.x)", +# elif (_MSC_VER > 900) + (sprintf(buf2, "(Visual C++ %d.%d)", _MSC_VER/100 - 6, _MSC_VER%100/10), + buf2), +# else + "(bad version)", +# endif +#elif defined(__WATCOMC__) +# if (__WATCOMC__ % 10 > 0) + (sprintf(buf, "Watcom C/C++ %d.%02d", __WATCOMC__ / 100, + __WATCOMC__ % 100), buf), "", +# else + (sprintf(buf, "Watcom C/C++ %d.%d", __WATCOMC__ / 100, + (__WATCOMC__ % 100) / 10), buf), "", +# endif +#elif defined(__BORLANDC__) + "Borland C++", +# if (__BORLANDC__ < 0x0200) + " 1.0", +# elif (__BORLANDC__ == 0x0200) + " 2.0", +# elif (__BORLANDC__ == 0x0400) + " 3.0", +# elif (__BORLANDC__ == 0x0410) /* __BCPLUSPLUS__ = 0x0310 */ + " 3.1", +# elif (__BORLANDC__ == 0x0452) /* __BCPLUSPLUS__ = 0x0320 */ + " 4.0 or 4.02", +# elif (__BORLANDC__ == 0x0460) /* __BCPLUSPLUS__ = 0x0340 */ + " 4.5", +# elif (__BORLANDC__ == 0x0500) /* __BCPLUSPLUS__ = 0x0340 */ + " 5.0", +# elif (__BORLANDC__ == 0x0520) /* __BCPLUSPLUS__ = 0x0520 */ + " 5.2 (C++ Builder)", /* GRR: assume this will stay sync'd? */ +# else + " later than 5.2", +# endif +#elif defined(__LCC__) + "LCC-Win32", "", +#elif defined(__GNUC__) +# if defined(__RSXNT__) +# if (defined(__DJGPP__) && !defined(__EMX__)) + (sprintf(buf, "rsxnt(djgpp v%d.%02d) / gcc ", + __DJGPP__, __DJGPP_MINOR__), buf), +# elif defined(__DJGPP__) + (sprintf(buf, "rsxnt(emx+djgpp v%d.%02d) / gcc ", + __DJGPP__, __DJGPP_MINOR__), buf), +# elif (defined(__GO32__) && !defined(__EMX__)) + "rsxnt(djgpp v1.x) / gcc ", +# elif defined(__GO32__) + "rsxnt(emx + djgpp v1.x) / gcc ", +# elif defined(__EMX__) + "rsxnt(emx)+gcc ", +# else + "rsxnt(unknown) / gcc ", +# endif +# elif defined(__CYGWIN32__) + "cygnus win32 / gcc ", +# elif defined(__MINGW32__) + "mingw32 / gcc ", +# else + "gcc ", +# endif + __VERSION__, +#else /* !_MSC_VER, !__WATCOMC__, !__BORLANDC__, !__LCC__, !__GNUC__ */ + "unknown compiler (SDK?)", "", +#endif /* ?compilers */ + + "Windows 95 / Windows NT", "\n(32-bit)", + +#ifdef __DATE__ + " on ", __DATE__ +#else + "", "" +#endif + ); + + (*G.message)((zvoid *)&G, slide, (ulg)len, 0); + + return; + +} /* end function version() */ + +#endif /* !WINDLL */ +#endif /* !SFX */ + + + +#ifdef W32_STAT_BANDAID + +/* All currently known variants of WIN32 operating systems (Windows 95/98, + * WinNT 3.x, 4.0, 5.0) have a nasty bug in the OS kernel concerning + * conversions between UTC and local time: In the time conversion functions + * of the Win32 API, the timezone offset (including seasonal daylight saving + * shift) between UTC and local time evaluation is erratically based on the + * current system time. The correct evaluation must determine the offset + * value as it {was/is/will be} for the actual time to be converted. + * + * Some versions of MS C runtime lib's stat() returns utc time-stamps so + * that localtime(timestamp) corresponds to the (potentially false) local + * time shown by the OS' system programs (Explorer, command shell dir, etc.) + * The RSXNT port follows the same strategy, but fails to recognize the + * access-time attribute. + * + * For the NTFS file system (and other filesystems that store time-stamps + * as UTC values), this results in st_mtime (, st_{c|a}time) fields which + * are not stable but vary according to the seasonal change of "daylight + * saving time in effect / not in effect". + * + * Other C runtime libs (CygWin, or the CRT DLLs supplied with Win95/NT + * return the unix-time equivalent of the UTC FILETIME values as got back + * from the Win32 API call. This time, return values from NTFS are correct + * whereas utimes from files on (V)FAT volumes vary according to the DST + * switches. + * + * To achieve timestamp consistency of UTC (UT extra field) values in + * Zip archives, the Info-ZIP programs require work-around code for + * proper time handling in stat() (and other time handling routines). + */ +/* stat() functions under Windows95 tend to fail for root directories. * + * Watcom and Borland, at least, are affected by this bug. Watcom made * + * a partial fix for 11.0 but still missed some cases. This substitute * + * detects the case and fills in reasonable values. Otherwise we get * + * effects like failure to extract to a root dir because it's not found. */ + +int zstat_win32(__W32STAT_GLOBALS__ const char *path, struct stat *buf) +{ + if (!stat(path, buf)) + { +#ifdef NT_TZBUG_WORKAROUND + /* stat was successful, now redo the time-stamp fetches */ + int fs_uses_loctime = FStampIsLocTime(__G__ path); + HANDLE h; + FILETIME Modft, Accft, Creft; +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_path = (char *)alloca(strlen(path) + 1); + + INTERN_TO_ISO(path, ansi_path); +# define Ansi_Path ansi_path +#else +# define Ansi_Path path +#endif + + TTrace((stdout, "stat(%s) finds modtime %08lx\n", path, buf->st_mtime)); + h = CreateFile(Ansi_Path, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (h != INVALID_HANDLE_VALUE) { + BOOL ftOK = GetFileTime(h, &Creft, &Accft, &Modft); + CloseHandle(h); + + if (ftOK) { + FTTrace((stdout, "GetFileTime returned Modft", 0, &Modft)); + FTTrace((stdout, "GetFileTime returned Creft", 0, &Creft)); + if (!fs_uses_loctime) { + /* On a filesystem that stores UTC timestamps, we refill + * the time fields of the struct stat buffer by directly + * using the UTC values as returned by the Win32 + * GetFileTime() API call. + */ + FileTime2utime(&Modft, &(buf->st_mtime)); + if (Accft.dwLowDateTime != 0 || Accft.dwHighDateTime != 0) + FileTime2utime(&Accft, &(buf->st_atime)); + else + buf->st_atime = buf->st_mtime; + if (Creft.dwLowDateTime != 0 || Creft.dwHighDateTime != 0) + FileTime2utime(&Creft, &(buf->st_ctime)); + else + buf->st_ctime = buf->st_mtime; + TTrace((stdout,"NTFS, recalculated modtime %08lx\n", + buf->st_mtime)); + } else { + /* On VFAT and FAT-like filesystems, the FILETIME values + * are converted back to the stable local time before + * converting them to UTC unix time-stamps. + */ + VFatFileTime2utime(&Modft, &(buf->st_mtime)); + if (Accft.dwLowDateTime != 0 || Accft.dwHighDateTime != 0) + VFatFileTime2utime(&Accft, &(buf->st_atime)); + else + buf->st_atime = buf->st_mtime; + if (Creft.dwLowDateTime != 0 || Creft.dwHighDateTime != 0) + VFatFileTime2utime(&Creft, &(buf->st_ctime)); + else + buf->st_ctime = buf->st_mtime; + TTrace((stdout, "VFAT, recalculated modtime %08lx\n", + buf->st_mtime)); + } + } + } +# undef Ansi_Path +#endif /* NT_TZBUG_WORKAROUND */ + return 0; + } +#ifdef W32_STATROOT_FIX + else + { + DWORD flags; +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_path = (char *)alloca(strlen(path) + 1); + + INTERN_TO_ISO(path, ansi_path); +# define Ansi_Path ansi_path +#else +# define Ansi_Path path +#endif + + flags = GetFileAttributes(Ansi_Path); + if (flags != 0xFFFFFFFF && flags & FILE_ATTRIBUTE_DIRECTORY) { + Trace((stderr, "\nstat(\"%s\",...) failed on existing directory\n", + path)); + memset(buf, 0, sizeof(struct stat)); + buf->st_atime = buf->st_ctime = buf->st_mtime = + dos_to_unix_time(DOSTIME_MINIMUM); /* 1-1-80 */ + buf->st_mode = S_IFDIR | S_IREAD | + ((flags & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE); + return 0; + } /* assumes: stat() won't fail on non-dirs without good reason */ +# undef Ansi_Path + } +#endif /* W32_STATROOT_FIX */ + return -1; +} + +#endif /* W32_STAT_BANDAID */ + +#endif /* !FUNZIP */ + + + +#ifndef WINDLL +/* This replacement getch() function was originally created for Watcom C + * and then additionally used with CYGWIN. Since UnZip 5.4, all other Win32 + * ports apply this replacement rather that their supplied getch() (or + * alike) function. There are problems with unabsorbed LF characters left + * over in the keyboard buffer under Win95 (and 98) when ENTER was pressed. + * (Under Win95, ENTER returns two(!!) characters: CR-LF.) This problem + * does not appear when run on a WinNT console prompt! + */ + +/* Watcom 10.6's getch() does not handle Alt+<digit><digit><digit>. */ +/* Note that if PASSWD_FROM_STDIN is defined, the file containing */ +/* the password must have a carriage return after the word, not a */ +/* Unix-style newline (linefeed only). This discards linefeeds. */ + +int getch_win32(void) +{ + HANDLE stin; + DWORD rc; + unsigned char buf[2]; + int ret = -1; + DWORD odemode = ~(DWORD)0; + +# ifdef PASSWD_FROM_STDIN + stin = GetStdHandle(STD_INPUT_HANDLE); +# else + stin = CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + if (stin == INVALID_HANDLE_VALUE) + return -1; +# endif + if (GetConsoleMode(stin, &odemode)) + SetConsoleMode(stin, ENABLE_PROCESSED_INPUT); /* raw except ^C noticed */ + if (ReadFile(stin, &buf, 1, &rc, NULL) && rc == 1) + ret = buf[0]; + /* when the user hits return we get CR LF. We discard the LF, not the CR, + * because when we call this for the first time after a previous input + * such as the one for "replace foo? [y]es, ..." the LF may still be in + * the input stream before whatever the user types at our prompt. */ + if (ret == '\n') + if (ReadFile(stin, &buf, 1, &rc, NULL) && rc == 1) + ret = buf[0]; + if (odemode != ~(DWORD)0) + SetConsoleMode(stin, odemode); +# ifndef PASSWD_FROM_STDIN + CloseHandle(stin); +# endif + return ret; +} +#endif /* !WINDLL */ diff --git a/utils/Install/packzip/zipinfo.c b/utils/Install/packzip/zipinfo.c new file mode 100644 index 0000000000..c244c1e92f --- /dev/null +++ b/utils/Install/packzip/zipinfo.c @@ -0,0 +1,1912 @@ +/*--------------------------------------------------------------------------- + + zipinfo.c Greg Roelofs et al. + + This file contains all of the ZipInfo-specific listing routines for UnZip. + + Contains: zi_opts() + zi_end_central() + zipinfo() + zi_long() + zi_short() + zi_time() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" + + +#ifndef NO_ZIPINFO /* strings use up too much space in small-memory systems */ + +/* Define OS-specific attributes for use on ALL platforms--the S_xxxx + * versions of these are defined differently (or not defined) by different + * compilers and operating systems. */ + +#define UNX_IFMT 0170000 /* Unix file type mask */ +#define UNX_IFDIR 0040000 /* Unix directory */ +#define UNX_IFREG 0100000 /* Unix regular file */ +#define UNX_IFSOCK 0140000 /* Unix socket (BSD, not SysV or Amiga) */ +#define UNX_IFLNK 0120000 /* Unix symbolic link (not SysV, Amiga) */ +#define UNX_IFBLK 0060000 /* Unix block special (not Amiga) */ +#define UNX_IFCHR 0020000 /* Unix character special (not Amiga) */ +#define UNX_IFIFO 0010000 /* Unix fifo (BCC, not MSC or Amiga) */ +#define UNX_ISUID 04000 /* Unix set user id on execution */ +#define UNX_ISGID 02000 /* Unix set group id on execution */ +#define UNX_ISVTX 01000 /* Unix directory permissions control */ +#define UNX_ENFMT UNX_ISGID /* Unix record locking enforcement flag */ +#define UNX_IRWXU 00700 /* Unix read, write, execute: owner */ +#define UNX_IRUSR 00400 /* Unix read permission: owner */ +#define UNX_IWUSR 00200 /* Unix write permission: owner */ +#define UNX_IXUSR 00100 /* Unix execute permission: owner */ +#define UNX_IRWXG 00070 /* Unix read, write, execute: group */ +#define UNX_IRGRP 00040 /* Unix read permission: group */ +#define UNX_IWGRP 00020 /* Unix write permission: group */ +#define UNX_IXGRP 00010 /* Unix execute permission: group */ +#define UNX_IRWXO 00007 /* Unix read, write, execute: other */ +#define UNX_IROTH 00004 /* Unix read permission: other */ +#define UNX_IWOTH 00002 /* Unix write permission: other */ +#define UNX_IXOTH 00001 /* Unix execute permission: other */ + +#define VMS_IRUSR UNX_IRUSR /* VMS read/owner */ +#define VMS_IWUSR UNX_IWUSR /* VMS write/owner */ +#define VMS_IXUSR UNX_IXUSR /* VMS execute/owner */ +#define VMS_IRGRP UNX_IRGRP /* VMS read/group */ +#define VMS_IWGRP UNX_IWGRP /* VMS write/group */ +#define VMS_IXGRP UNX_IXGRP /* VMS execute/group */ +#define VMS_IROTH UNX_IROTH /* VMS read/other */ +#define VMS_IWOTH UNX_IWOTH /* VMS write/other */ +#define VMS_IXOTH UNX_IXOTH /* VMS execute/other */ + +#define AMI_IFMT 06000 /* Amiga file type mask */ +#define AMI_IFDIR 04000 /* Amiga directory */ +#define AMI_IFREG 02000 /* Amiga regular file */ +#define AMI_IHIDDEN 00200 /* to be supported in AmigaDOS 3.x */ +#define AMI_ISCRIPT 00100 /* executable script (text command file) */ +#define AMI_IPURE 00040 /* allow loading into resident memory */ +#define AMI_IARCHIVE 00020 /* not modified since bit was last set */ +#define AMI_IREAD 00010 /* can be opened for reading */ +#define AMI_IWRITE 00004 /* can be opened for writing */ +#define AMI_IEXECUTE 00002 /* executable image, a loadable runfile */ +#define AMI_IDELETE 00001 /* can be deleted */ + +#define LFLAG 3 /* short "ls -l" type listing */ + +static int zi_long OF((__GPRO__ ulg *pEndprev)); +static int zi_short OF((__GPRO)); +static void zi_showMacTypeCreator + OF((__GPRO__ uch *ebfield)); +static char *zi_time OF((__GPRO__ ZCONST ulg *datetimez, + ZCONST time_t *modtimez, char *d_t_str)); + + +/**********************************************/ +/* Strings used in zipinfo.c (ZipInfo half) */ +/**********************************************/ + +static char nullStr[] = ""; + +static ZCONST char Far LongHeader[] = "Archive: %s %ld bytes %d file%s\n"; +static ZCONST char Far ShortHeader[] = "Archive: %s %ld %d\n"; +static ZCONST char Far EndCentDirRec[] = "\nEnd-of-central-directory record:\n"; +static ZCONST char Far LineSeparators[] = "-------------------------------\n\n"; +static ZCONST char Far ActOffsetCentDir[] = "\ + Actual offset of end-of-central-dir record: %9ld (%.8lXh)\n\ + Expected offset of end-of-central-dir record: %9ld (%.8lXh)\n\ + (based on the length of the central directory and its expected offset)\n\n"; +static ZCONST char Far SinglePartArchive1[] = "\ + This zipfile constitutes the sole disk of a single-part archive; its\n\ + central directory contains %u %s. The central directory is %lu\n\ + (%.8lXh) bytes long, and its (expected) offset in bytes from the\n"; +static ZCONST char Far SinglePartArchive2[] = "\ + beginning of the zipfile is %lu (%.8lXh).\n\n"; +static ZCONST char Far MultiPartArchive1[] = "\ + This zipfile constitutes disk %u of a multi-part archive. The central\n\ + directory starts on disk %u; %u of its entries %s contained within\n"; +static ZCONST char Far MultiPartArchive2[] = "\ + this zipfile, out of a total of %u %s. The entire central\n\ + directory is %lu (%.8lXh) bytes long, and its offset in bytes from\n"; +static ZCONST char Far MultiPartArchive3[] = "\ + the beginning of the zipfile in which it begins is %lu (%.8lXh).\n\n"; +static ZCONST char Far NoZipfileComment[] = " There is no zipfile comment.\n"; +static ZCONST char Far ZipfileCommentDesc[] = + " The zipfile comment is %u bytes long and contains the following text:\n\n"; +static ZCONST char Far ZipfileCommBegin[] = + "======================== zipfile comment begins ==========================\n"; +static ZCONST char Far ZipfileCommEnd[] = + "========================= zipfile comment ends ===========================\n"; +static ZCONST char Far ZipfileCommTrunc2[] = "\n The zipfile comment is truncated.\n"; +static ZCONST char Far ZipfileCommTruncMsg[] = + "\ncaution: zipfile comment truncated\n"; + +static ZCONST char Far CentralDirEntry[] = + "\nCentral directory entry #%d:\n---------------------------\n\n"; +static ZCONST char Far ZipfileStats[] = + "%d file%s, %lu bytes uncompressed, %lu bytes compressed: %s%d.%d%%\n"; + +/* zi_long() strings */ +static ZCONST char Far OS_FAT[] = "MS-DOS, OS/2 or NT FAT"; +static ZCONST char Far OS_Amiga[] = "Amiga"; +static ZCONST char Far OS_VMS[] = "VMS"; +static ZCONST char Far OS_Unix[] = "Unix"; +static ZCONST char Far OS_VMCMS[] = "VM/CMS"; +static ZCONST char Far OS_AtariST[] = "Atari ST"; +static ZCONST char Far OS_HPFS[] = "OS/2 or NT HPFS"; +static ZCONST char Far OS_Macintosh[] = "Macintosh HFS"; +static ZCONST char Far OS_ZSystem[] = "Z-System"; +static ZCONST char Far OS_CPM[] = "CP/M"; +static ZCONST char Far OS_TOPS20[] = "TOPS-20"; +static ZCONST char Far OS_NTFS[] = "NTFS"; +static ZCONST char Far OS_QDOS[] = "SMS/QDOS"; +static ZCONST char Far OS_Acorn[] = "Acorn RISC OS"; +static ZCONST char Far OS_MVS[] = "MVS"; +static ZCONST char Far OS_VFAT[] = "Win32 VFAT"; +static ZCONST char Far OS_BeOS[] = "BeOS"; +static ZCONST char Far OS_Tandem[] = "Tandem NSK"; + +static ZCONST char Far MthdNone[] = "none (stored)"; +static ZCONST char Far MthdShrunk[] = "shrunk"; +static ZCONST char Far MthdRedF1[] = "reduced (factor 1)"; +static ZCONST char Far MthdRedF2[] = "reduced (factor 2)"; +static ZCONST char Far MthdRedF3[] = "reduced (factor 3)"; +static ZCONST char Far MthdRedF4[] = "reduced (factor 4)"; +static ZCONST char Far MthdImplode[] = "imploded"; +static ZCONST char Far MthdToken[] = "tokenized"; +static ZCONST char Far MthdDeflate[] = "deflated"; +static ZCONST char Far MthdEnDeflate[] = "deflated (enhanced)"; +static ZCONST char Far MthdDCLImplode[] = "imploded (PK DCL)"; + +static ZCONST char Far DeflNorm[] = "normal"; +static ZCONST char Far DeflMax[] = "maximum"; +static ZCONST char Far DeflFast[] = "fast"; +static ZCONST char Far DeflSFast[] = "superfast"; + +static ZCONST char Far ExtraBytesPreceding[] = + " There are an extra %ld bytes preceding this file.\n\n"; + +static ZCONST char Far UnknownNo[] = "unknown (%d)"; + +static ZCONST char Far LocalHeaderOffset[] = + "\n offset of local header from start of archive: %lu (%.8lXh) bytes\n"; +static ZCONST char Far HostOS[] = + " file system or operating system of origin: %s\n"; +static ZCONST char Far EncodeSWVer[] = + " version of encoding software: %d.%d\n"; +static ZCONST char Far MinOSCompReq[] = + " minimum file system compatibility required: %s\n"; +static ZCONST char Far MinSWVerReq[] = + " minimum software version required to extract: %d.%d\n"; +static ZCONST char Far CompressMethod[] = + " compression method: %s\n"; +static ZCONST char Far SlideWindowSizeImplode[] = + " size of sliding dictionary (implosion): %cK\n"; +static ZCONST char Far ShannonFanoTrees[] = + " number of Shannon-Fano trees (implosion): %c\n"; +static ZCONST char Far CompressSubtype[] = + " compression sub-type (deflation): %s\n"; +static ZCONST char Far FileSecurity[] = + " file security status: %sencrypted\n"; +static ZCONST char Far ExtendedLocalHdr[] = + " extended local header: %s\n"; +static ZCONST char Far FileModDate[] = + " file last modified on (DOS date/time): %s\n"; +#ifdef USE_EF_UT_TIME + static ZCONST char Far UT_FileModDate[] = + " file last modified on (UT extra field modtime): %s %s\n"; + static ZCONST char Far LocalTime[] = "local"; +#ifndef NO_GMTIME + static ZCONST char Far GMTime[] = "UTC"; +#endif +#endif /* USE_EF_UT_TIME */ +static ZCONST char Far CRC32Value[] = + " 32-bit CRC value (hex): %.8lx\n"; +static ZCONST char Far CompressedFileSize[] = + " compressed size: %lu bytes\n"; +static ZCONST char Far UncompressedFileSize[] = + " uncompressed size: %lu bytes\n"; +static ZCONST char Far FilenameLength[] = + " length of filename: %u characters\n"; +static ZCONST char Far ExtraFieldLength[] = + " length of extra field: %u bytes\n"; +static ZCONST char Far FileCommentLength[] = + " length of file comment: %u characters\n"; +static ZCONST char Far FileDiskNum[] = + " disk number on which file begins: disk %u\n"; +static ZCONST char Far ApparentFileType[] = + " apparent file type: %s\n"; +static ZCONST char Far VMSFileAttributes[] = + " VMS file attributes (%06o octal): %s\n"; +static ZCONST char Far AmigaFileAttributes[] = + " Amiga file attributes (%06o octal): %s\n"; +static ZCONST char Far UnixFileAttributes[] = + " Unix file attributes (%06o octal): %s\n"; +static ZCONST char Far NonMSDOSFileAttributes[] = + " non-MSDOS external file attributes: %06lX hex\n"; +static ZCONST char Far MSDOSFileAttributes[] = + " MS-DOS file attributes (%02X hex): none\n"; +static ZCONST char Far MSDOSFileAttributesRO[] = + " MS-DOS file attributes (%02X hex): read-only\n"; +static ZCONST char Far MSDOSFileAttributesAlpha[] = + " MS-DOS file attributes (%02X hex): %s%s%s%s%s%s\n"; + + +static ZCONST char Far ExtraFieldTrunc[] = "\n\ + error: EF data block (type 0x%04x) size %u exceeds remaining extra field\n\ + space %u; block length has been truncated.\n"; +static ZCONST char Far ExtraFields[] = "\n\ + The central-directory extra field contains:"; +static ZCONST char Far ExtraFieldType[] = "\n\ + - A subfield with ID 0x%04x (%s) and %u data bytes"; +static ZCONST char Far efAV[] = "PKWARE AV"; +static ZCONST char Far efOS2[] = "OS/2"; +static ZCONST char Far efPKVMS[] = "PKWARE VMS"; +static ZCONST char Far efPKWin32[] = "PKWARE Win32"; +static ZCONST char Far efPKUnix[] = "PKWARE Unix"; +static ZCONST char Far efIZVMS[] = "Info-ZIP VMS"; +static ZCONST char Far efIZUnix[] = "old Info-ZIP Unix/OS2/NT"; +static ZCONST char Far efIZUnix2[] = "Unix UID/GID"; +static ZCONST char Far efTime[] = "universal time"; +static ZCONST char Far efJLMac[] = "old Info-ZIP Macintosh"; +static ZCONST char Far efMac3[] = "new Info-ZIP Macintosh"; +static ZCONST char Far efZipIt[] = "ZipIt Macintosh"; +static ZCONST char Far efZipIt2[] = "ZipIt Macintosh (short)"; +static ZCONST char Far efVMCMS[] = "VM/CMS"; +static ZCONST char Far efMVS[] = "MVS"; +static ZCONST char Far efACL[] = "OS/2 ACL"; +static ZCONST char Far efNTSD[] = "Security Descriptor"; +static ZCONST char Far efBeOS[] = "BeOS"; +static ZCONST char Far efQDOS[] = "SMS/QDOS"; +static ZCONST char Far efAOSVS[] = "AOS/VS"; +static ZCONST char Far efSpark[] = "Acorn SparkFS"; +static ZCONST char Far efMD5[] = "Fred Kantor MD5"; +static ZCONST char Far efASiUnix[] = "ASi Unix"; +static ZCONST char Far efUnknown[] = "unknown"; + +static ZCONST char Far OS2EAs[] = ".\n\ + The local extra field has %lu bytes of OS/2 extended attributes.\n\ + (May not match OS/2 \"dir\" amount due to storage method)"; +static ZCONST char Far izVMSdata[] = ". The extra\n\ + field is %s and has %lu bytes of VMS %s information%s"; +static ZCONST char Far izVMSstored[] = "stored"; +static ZCONST char Far izVMSrleenc[] = "run-length encoded"; +static ZCONST char Far izVMSdeflat[] = "deflated"; +static ZCONST char Far izVMScunknw[] = "compressed(?)"; +static ZCONST char Far *izVMScomp[4] = + {izVMSstored, izVMSrleenc, izVMSdeflat, izVMScunknw}; +static ZCONST char Far ACLdata[] = ".\n\ + The local extra field has %lu bytes of access control list information"; +static ZCONST char Far NTSDData[] = ".\n\ + The local extra field has %lu bytes of NT security descriptor data"; +static ZCONST char Far UTdata[] = ".\n\ + The local extra field has UTC/GMT %s time%s"; +static ZCONST char Far UTmodification[] = "modification"; +static ZCONST char Far UTaccess[] = "access"; +static ZCONST char Far UTcreation[] = "creation"; +static ZCONST char Far ZipItFname[] = ".\n\ + The Mac long filename is %s.\n"; +static ZCONST char Far Mac3data[] = ".\n\ + The local extra field has %lu bytes of %scompressed Macintosh\n\ + finder attributes"; + /* MacOSdata[] is used by EF_MAC3, EF_ZIPIT, EF_ZIPIT2 and EF_JLEE e. f. */ +static ZCONST char Far MacOSdata[] = ".\n\ + The associated file has type code `%c%c%c%c' and creator code `%c%c%c%c'"; +static ZCONST char Far MacOSdata1[] = ".\n\ + The associated file has type code `0x%lx' and creator code `0x%lx'"; +static ZCONST char Far MacOSJLEEflags[] = "\n File is marked as %s"; +static ZCONST char Far MacOS_RF[] = "Resource-fork"; +static ZCONST char Far MacOS_DF[] = "Data-fork"; +static ZCONST char Far MacOSMAC3flags[] = ".\n\ + File is marked as %s, File Dates are in %d Bit"; +static ZCONST char Far BeOSdata[] = ".\n\ + The local extra field has %lu bytes of %scompressed BeOS file attributes"; + /* The associated file has type code `%c%c%c%c' and creator code `%c%c%c%c'" */ +static ZCONST char Far QDOSdata[] = ".\n\ + The QDOS extra field subtype is `%c%c%c%c'"; +static ZCONST char Far AOSVSdata[] = ".\n\ + The AOS/VS extra field revision is %d.%d"; +static ZCONST char Far MD5data[] = ".\n\ + The 128-bit MD5 signature is %s"; +#ifdef CMS_MVS + static ZCONST char Far VmMvsExtraField[] = ".\n\ + The stored file open mode (FLDATA TYPE) is \"%s\""; + static ZCONST char Far VmMvsInvalid[] = "[invalid]"; +#endif /* CMS_MVS */ + +static ZCONST char Far First20[] = ". The first\n 20 are: "; +static ZCONST char Far ColonIndent[] = ":\n "; +static ZCONST char Far efFormat[] = " %02x"; + +static ZCONST char Far lExtraFieldType[] = "\n\ + There %s a local extra field with ID 0x%04x (%s) and\n\ + %u data bytes (%s).\n"; +static ZCONST char Far efIZuid[] = + "GMT modification/access times and Unix UID/GID"; +static ZCONST char Far efIZnouid[] = "GMT modification/access times only"; + + +static ZCONST char Far NoFileComment[] = "\n There is no file comment.\n"; +static ZCONST char Far FileCommBegin[] = "\n\ +------------------------- file comment begins ----------------------------\n"; +static ZCONST char Far FileCommEnd[] = "\ +-------------------------- file comment ends -----------------------------\n"; + +/* zi_time() strings */ +static ZCONST char Far BogusFmt[] = "%03d"; +static ZCONST char Far DMYHMTime[] = "%2u-%s-%02u %02u:%02u"; +static ZCONST char Far YMDHMSTime[] = "%u %s %u %02u:%02u:%02u"; +static ZCONST char Far DecimalTime[] = "%04u%02u%02u.%02u%02u%02u"; +static ZCONST char Far YMDHMSTimeError[] = "???? ??? ?? ??:??:??"; + + + + + +#ifndef WINDLL + +/************************/ +/* Function zi_opts() */ +/************************/ + +int zi_opts(__G__ pargc, pargv) + int *pargc; + char ***pargv; + __GDEF +{ + char **argv, *s; + int argc, c, error=FALSE, negative=0; + int hflag_slmv=TRUE, hflag_2=FALSE; /* diff options => diff defaults */ + int tflag_slm=TRUE, tflag_2v=FALSE; + int explicit_h=FALSE, explicit_t=FALSE; + + +#ifdef MACOS + uO.lflag = LFLAG; /* reset default on each call */ +#endif + G.extract_flag = FALSE; /* zipinfo does not extract to disk */ + argc = *pargc; + argv = *pargv; + + while (--argc > 0 && (*++argv)[0] == '-') { + s = argv[0] + 1; + while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */ + switch (c) { + case '-': + ++negative; + break; + case '1': /* shortest listing: JUST filenames */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 1; + break; + case '2': /* just filenames, plus headers if specified */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 2; + break; +#ifndef CMS_MVS + case ('C'): /* -C: match filenames case-insensitively */ + if (negative) + uO.C_flag = FALSE, negative = 0; + else + uO.C_flag = TRUE; + break; +#endif /* !CMS_MVS */ + case 'h': /* header line */ + if (negative) + hflag_2 = hflag_slmv = FALSE, negative = 0; + else { + hflag_2 = hflag_slmv = explicit_h = TRUE; + if (uO.lflag == -1) + uO.lflag = 0; + } + break; + case 'l': /* longer form of "ls -l" type listing */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 5; + break; + case 'm': /* medium form of "ls -l" type listing */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 4; + break; +#ifdef MORE + case 'M': /* send output through built-in "more" */ + if (negative) + G.M_flag = FALSE, negative = 0; + else + G.M_flag = TRUE; + break; +#endif + case 's': /* default: shorter "ls -l" type listing */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 3; + break; + case 't': /* totals line */ + if (negative) + tflag_2v = tflag_slm = FALSE, negative = 0; + else { + tflag_2v = tflag_slm = explicit_t = TRUE; + if (uO.lflag == -1) + uO.lflag = 0; + } + break; + case ('T'): /* use (sortable) decimal time format */ + if (negative) + uO.T_flag = FALSE, negative = 0; + else + uO.T_flag = TRUE; + break; + case 'v': /* turbo-verbose listing */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 10; + break; + case 'z': /* print zipfile comment */ + if (negative) + uO.zflag = negative = 0; + else + uO.zflag = 1; + break; + case 'Z': /* ZipInfo mode: ignore */ + break; + default: + error = TRUE; + break; + } + } + } + if ((argc-- == 0) || error) { + *pargc = argc; + *pargv = argv; + return USAGE(error); + } + +#ifdef MORE + if (G.M_flag && !isatty(1)) /* stdout redirected: "more" func useless */ + G.M_flag = 0; +#endif + + /* if no listing options given (or all negated), or if only -h/-t given + * with individual files specified, use default listing format */ + if ((uO.lflag < 0) || ((argc > 0) && (uO.lflag == 0))) + uO.lflag = LFLAG; + + /* set header and totals flags to default or specified values */ + switch (uO.lflag) { + case 0: /* 0: can only occur if either -t or -h explicitly given; */ + case 2: /* therefore set both flags equal to normally false value */ + uO.hflag = hflag_2; + uO.tflag = tflag_2v; + break; + case 1: /* only filenames, *always* */ + uO.hflag = FALSE; + uO.tflag = FALSE; + uO.zflag = FALSE; + break; + case 3: + case 4: + case 5: + uO.hflag = ((argc > 0) && !explicit_h)? FALSE : hflag_slmv; + uO.tflag = ((argc > 0) && !explicit_t)? FALSE : tflag_slm; + break; + case 10: + uO.hflag = hflag_slmv; + uO.tflag = tflag_2v; + break; + } + + *pargc = argc; + *pargv = argv; + return 0; + +} /* end function zi_opts() */ + +#endif /* !WINDLL */ + + + + + +/*******************************/ +/* Function zi_end_central() */ +/*******************************/ + +int zi_end_central(__G) /* return PK-type error code */ + __GDEF +{ + int error = PK_COOL; + + +/*--------------------------------------------------------------------------- + Print out various interesting things about the zipfile. + ---------------------------------------------------------------------------*/ + + /* header fits on one line, for anything up to 10GB and 10000 files: */ + if (uO.hflag) + Info(slide, 0, ((char *)slide, ((int)strlen(G.zipfn) < 39)? + LoadFarString(LongHeader) : LoadFarString(ShortHeader), G.zipfn, + (long)G.ziplen, G.ecrec.total_entries_central_dir, + (G.ecrec.total_entries_central_dir==1)? + nullStr : "s")); + + /* verbose format */ + if (uO.lflag > 9) { + Info(slide, 0, ((char *)slide, LoadFarString(EndCentDirRec))); + Info(slide, 0, ((char *)slide, LoadFarString(LineSeparators))); + + Info(slide, 0, ((char *)slide, LoadFarString(ActOffsetCentDir), + (long)G.real_ecrec_offset, (long)G.real_ecrec_offset, + (long)G.expect_ecrec_offset, (long)G.expect_ecrec_offset)); + + if (G.ecrec.number_this_disk == 0) { + Info(slide, 0, ((char *)slide, LoadFarString(SinglePartArchive1), + G.ecrec.total_entries_central_dir, + (G.ecrec.total_entries_central_dir == 1)? "entry" : "entries", + G.ecrec.size_central_directory, + G.ecrec.size_central_directory)); + Info(slide, 0, ((char *)slide, LoadFarString(SinglePartArchive2), + G.ecrec.offset_start_central_directory, + G.ecrec.offset_start_central_directory)); + } else { + Info(slide, 0, ((char *)slide, LoadFarString(MultiPartArchive1), + G.ecrec.number_this_disk + 1, + G.ecrec.num_disk_start_cdir + 1, + G.ecrec.num_entries_centrl_dir_ths_disk, + (G.ecrec.num_entries_centrl_dir_ths_disk == 1)? "is" : "are")); + Info(slide, 0, ((char *)slide, LoadFarString(MultiPartArchive2), + G.ecrec.total_entries_central_dir, + (G.ecrec.total_entries_central_dir == 1) ? "entry" : "entries", + G.ecrec.size_central_directory, + G.ecrec.size_central_directory)); + Info(slide, 0, ((char *)slide, LoadFarString(MultiPartArchive3), + G.ecrec.offset_start_central_directory, + G.ecrec.offset_start_central_directory)); + } + + /*----------------------------------------------------------------------- + Get the zipfile comment, if any, and print it out. (Comment may be + up to 64KB long. May the fleas of a thousand camels infest the arm- + pits of anyone who actually takes advantage of this fact.) + -----------------------------------------------------------------------*/ + + if (!G.ecrec.zipfile_comment_length) + Info(slide, 0, ((char *)slide, LoadFarString(NoZipfileComment))); + else { + Info(slide, 0, ((char *)slide, LoadFarString(ZipfileCommentDesc), + G.ecrec.zipfile_comment_length)); + Info(slide, 0, ((char *)slide, LoadFarString(ZipfileCommBegin))); + if (do_string(__G__ G.ecrec.zipfile_comment_length, DISPLAY)) + error = PK_WARN; + Info(slide, 0, ((char *)slide, LoadFarString(ZipfileCommEnd))); + if (error) + Info(slide, 0, ((char *)slide, + LoadFarString(ZipfileCommTrunc2))); + } /* endif (comment exists) */ + + /* non-verbose mode: print zipfile comment only if requested */ + } else if (uO.zflag && G.ecrec.zipfile_comment_length) { + if (do_string(__G__ G.ecrec.zipfile_comment_length, DISPLAY)) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(ZipfileCommTruncMsg))); + error = PK_WARN; + } + } /* endif (verbose) */ + + return error; + +} /* end function zi_end_central() */ + + + + + +/************************/ +/* Function zipinfo() */ +/************************/ + +int zipinfo(__G) /* return PK-type error code */ + __GDEF +{ + int do_this_file=FALSE, error, error_in_archive=PK_COOL; + int *fn_matched=NULL, *xn_matched=NULL; + unsigned j, members=0; + ulg tot_csize=0L, tot_ucsize=0L; + ulg endprev; /* buffers end of previous entry for zi_long()'s check + * of extra bytes */ + + +/*--------------------------------------------------------------------------- + Malloc space for check on unmatched filespecs (no big deal if one or both + are NULL). + ---------------------------------------------------------------------------*/ + + if (G.filespecs > 0 && + (fn_matched=(int *)malloc(G.filespecs*sizeof(int))) != NULL) + for (j = 0; j < G.filespecs; ++j) + fn_matched[j] = FALSE; + + if (G.xfilespecs > 0 && + (xn_matched=(int *)malloc(G.xfilespecs*sizeof(int))) != NULL) + for (j = 0; j < G.xfilespecs; ++j) + xn_matched[j] = FALSE; + +/*--------------------------------------------------------------------------- + Set file pointer to start of central directory, then loop through cen- + tral directory entries. Check that directory-entry signature bytes are + actually there (just a precaution), then process the entry. We know + the entire central directory is on this disk: we wouldn't have any of + this information unless the end-of-central-directory record was on this + disk, and we wouldn't have gotten to this routine unless this is also + the disk on which the central directory starts. In practice, this had + better be the *only* disk in the archive, but maybe someday we'll add + multi-disk support. + ---------------------------------------------------------------------------*/ + + uO.L_flag = FALSE; /* zipinfo mode: never convert name to lowercase */ + G.pInfo = G.info; /* (re-)initialize, (just to make sure) */ + G.pInfo->textmode = 0; /* so one can read on screen (is this ever used?) */ + + /* reset endprev for new zipfile; account for multi-part archives (?) */ + endprev = (G.crec.relative_offset_local_header == 4L)? 4L : 0L; + + + for (j = 0; j++ < (unsigned)G.ecrec.total_entries_central_dir;) { + if (readbuf(__G__ G.sig, 4) == 0) + return PK_EOF; + if (strncmp(G.sig, central_hdr_sig, 4)) { /* just to make sure */ + Info(slide, 0x401, ((char *)slide, LoadFarString(CentSigMsg), j)); + return PK_BADERR; /* sig not found */ + } + /* process_cdir_file_hdr() sets pInfo->hostnum, pInfo->lcflag, ...: */ + if ((error = process_cdir_file_hdr(__G)) != PK_COOL) + return error; /* only PK_EOF defined */ + + if ((error = do_string(__G__ G.crec.filename_length, DS_FN)) != + PK_COOL) + { + error_in_archive = error; /* might be warning */ + if (error > PK_WARN) /* fatal */ + return error; + } + + if (!G.process_all_files) { /* check if specified on command line */ + unsigned i; + + do_this_file = FALSE; + for (i = 0; i < G.filespecs; i++) + if (match(G.filename, G.pfnames[i], uO.C_flag)) { + do_this_file = TRUE; + if (fn_matched) + fn_matched[i] = TRUE; + break; /* found match, so stop looping */ + } + if (do_this_file) { /* check if this is an excluded file */ + for (i = 0; i < G.xfilespecs; i++) + if (match(G.filename, G.pxnames[i], uO.C_flag)) { + do_this_file = FALSE; /* ^-- ignore case in match */ + if (xn_matched) + xn_matched[i] = TRUE; + break; + } + } + } + + /*----------------------------------------------------------------------- + If current file was specified on command line, or if no names were + specified, do the listing for this file. Otherwise, get rid of the + file comment and go back for the next file. + -----------------------------------------------------------------------*/ + + if (G.process_all_files || do_this_file) { + + switch (uO.lflag) { + case 1: + case 2: + fnprint(__G); + SKIP_(G.crec.extra_field_length) + SKIP_(G.crec.file_comment_length) + break; + + case 3: + case 4: + case 5: + if ((error = zi_short(__G)) != PK_COOL) { + error_in_archive = error; /* might be warning */ + if (error > PK_WARN) /* fatal */ + return error; + } + break; + + case 10: + Info(slide, 0, ((char *)slide, + LoadFarString(CentralDirEntry), j)); + if ((error = zi_long(__G__ &endprev)) != PK_COOL) { + error_in_archive = error; /* might be warning */ + if (error > PK_WARN) /* fatal */ + return error; + } + break; + + default: + SKIP_(G.crec.extra_field_length) + SKIP_(G.crec.file_comment_length) + break; + + } /* end switch (lflag) */ + + tot_csize += G.crec.csize; + tot_ucsize += G.crec.ucsize; + if (G.crec.general_purpose_bit_flag & 1) + tot_csize -= 12; /* don't count encryption header */ + ++members; + +#ifdef DLL + if ((G.statreportcb != NULL) && + (*G.statreportcb)(__G__ UZ_ST_FINISH_MEMBER, G.zipfn, + G.filename, NULL)) { + if (fn_matched) + free((zvoid *)fn_matched); + if (xn_matched) + free((zvoid *)xn_matched); + return IZ_CTRLC; /* cancel operation by user request */ + } +#endif +#ifdef MACOS /* MacOS is no preemptive OS, thus call event-handling by hand */ + UserStop(); +#endif + + } else { /* not listing this file */ + SKIP_(G.crec.extra_field_length) + SKIP_(G.crec.file_comment_length) + + } /* end if (list member?) */ + + } /* end for-loop (j: member files) */ + +/*--------------------------------------------------------------------------- + Check that we actually found requested files; if so, print totals. + ---------------------------------------------------------------------------*/ + + if (uO.tflag) { + char *sgn = ""; + int cfactor = ratio(tot_ucsize, tot_csize); + + if (cfactor < 0) { + sgn = "-"; + cfactor = -cfactor; + } + Info(slide, 0, ((char *)slide, LoadFarString(ZipfileStats), + members, (members==1)? nullStr:"s", tot_ucsize, + tot_csize, sgn, cfactor/10, cfactor%10)); + } + +/*--------------------------------------------------------------------------- + Check for unmatched filespecs on command line and print warning if any + found. + ---------------------------------------------------------------------------*/ + + if (fn_matched) { + for (j = 0; j < G.filespecs; ++j) + if (!fn_matched[j]) + Info(slide, 0x401, ((char *)slide, + LoadFarString(FilenameNotMatched), G.pfnames[j])); + free((zvoid *)fn_matched); + } + if (xn_matched) { + for (j = 0; j < G.xfilespecs; ++j) + if (!xn_matched[j]) + Info(slide, 0x401, ((char *)slide, + LoadFarString(ExclFilenameNotMatched), G.pxnames[j])); + free((zvoid *)xn_matched); + } + +/*--------------------------------------------------------------------------- + Double check that we're back at the end-of-central-directory record. + ---------------------------------------------------------------------------*/ + + if (readbuf(__G__ G.sig, 4) == 0) /* disk error? */ + return PK_EOF; + if (strncmp(G.sig, end_central_sig, 4)) { /* just to make sure again */ + Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg))); + error_in_archive = PK_WARN; /* didn't find sig */ + } + if (members == 0 && error_in_archive <= PK_WARN) + error_in_archive = PK_FIND; + + if (uO.lflag >= 10) + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + + return error_in_archive; + +} /* end function zipinfo() */ + + + + + +/************************/ +/* Function zi_long() */ +/************************/ + +static int zi_long(__G__ pEndprev) /* return PK-type error code */ + __GDEF + ulg *pEndprev; /* for zi_long() check of extra bytes */ +{ +#ifdef USE_EF_UT_TIME + iztimes z_utime; +#endif + int error, error_in_archive=PK_COOL; + ush hostnum, hostver, extnum, extver, methnum, xattr; + char workspace[12], attribs[22]; + ZCONST char *varmsg_str; + char unkn[16]; + static ZCONST char Far *os[NUM_HOSTS] = { + OS_FAT, OS_Amiga, OS_VMS, OS_Unix, OS_VMCMS, OS_AtariST, OS_HPFS, + OS_Macintosh, OS_ZSystem, OS_CPM, OS_TOPS20, OS_NTFS, OS_QDOS, + OS_Acorn, OS_VFAT, OS_MVS, OS_BeOS, OS_Tandem + }; + static ZCONST char Far *method[NUM_METHODS] = { + MthdNone, MthdShrunk, MthdRedF1, MthdRedF2, MthdRedF3, MthdRedF4, + MthdImplode, MthdToken, MthdDeflate, MthdEnDeflate, MthdDCLImplode + }; + static ZCONST char Far *dtypelng[4] = { + DeflNorm, DeflMax, DeflFast, DeflSFast + }; + + +/*--------------------------------------------------------------------------- + Check whether there's any extra space inside the zipfile. If *pEndprev is + zero, it's probably a signal that OS/2 extra fields are involved (with + unknown compressed size). We won't worry about prepended junk here... + ---------------------------------------------------------------------------*/ + + if (G.crec.relative_offset_local_header != *pEndprev && *pEndprev > 0L) { + /* GRR DEBUG + Info(slide, 0, ((char *)slide, + " [crec.relative_offset_local_header = %lu, endprev = %lu]\n", + G.crec.relative_offset_local_header, *pEndprev)); + */ + Info(slide, 0, ((char *)slide, LoadFarString(ExtraBytesPreceding), + (long)G.crec.relative_offset_local_header - (long)(*pEndprev))); + } + + /* calculate endprev for next time around (problem: extra fields may + * differ in length between local and central-directory records) */ + *pEndprev = G.crec.relative_offset_local_header + 4L + LREC_SIZE + + G.crec.filename_length + G.crec.extra_field_length + + G.crec.file_comment_length + G.crec.csize; + +/*--------------------------------------------------------------------------- + Read the extra field, if any. It may be used to get UNIX style modtime. + ---------------------------------------------------------------------------*/ + + if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD)) != 0) + { + if (G.extra_field != NULL) { + free(G.extra_field); + G.extra_field = NULL; + } + error_in_archive = error; + /* The premature return in case of a "fatal" error (PK_EOF) is + * delayed until we analyze the extra field contents. + * This allows us to display all the other info that has been + * successfully read in. + */ + } + +/*--------------------------------------------------------------------------- + Print out various interesting things about the compressed file. + ---------------------------------------------------------------------------*/ + + hostnum = (ush)(G.pInfo->hostnum); + hostver = G.crec.version_made_by[0]; + extnum = (ush)MIN(G.crec.version_needed_to_extract[1], NUM_HOSTS); + extver = G.crec.version_needed_to_extract[0]; + methnum = (ush)MIN(G.crec.compression_method, NUM_METHODS); + + (*G.message)((zvoid *)&G, (uch *)" ", 2L, 0); fnprint(__G); + + Info(slide, 0, ((char *)slide, LoadFarString(LocalHeaderOffset), + G.crec.relative_offset_local_header, + G.crec.relative_offset_local_header)); + + if (hostnum >= NUM_HOSTS) { + sprintf(unkn, LoadFarString(UnknownNo), + (int)G.crec.version_made_by[1]); + varmsg_str = unkn; + } else { + varmsg_str = LoadFarStringSmall(os[hostnum]); + } + Info(slide, 0, ((char *)slide, LoadFarString(HostOS), varmsg_str)); + Info(slide, 0, ((char *)slide, LoadFarString(EncodeSWVer), hostver/10, + hostver%10)); + + if (extnum >= NUM_HOSTS) { + sprintf(unkn, LoadFarString(UnknownNo), + (int)G.crec.version_needed_to_extract[1]); + varmsg_str = unkn; + } else { + varmsg_str = LoadFarStringSmall(os[extnum]); + } + Info(slide, 0, ((char *)slide, LoadFarString(MinOSCompReq), varmsg_str)); + Info(slide, 0, ((char *)slide, LoadFarString(MinSWVerReq), extver/10, + extver%10)); + + if (methnum >= NUM_METHODS) { + sprintf(unkn, LoadFarString(UnknownNo), G.crec.compression_method); + varmsg_str = unkn; + } else { + varmsg_str = LoadFarStringSmall(method[methnum]); + } + Info(slide, 0, ((char *)slide, LoadFarString(CompressMethod), varmsg_str)); + if (methnum == IMPLODED) { + Info(slide, 0, ((char *)slide, LoadFarString(SlideWindowSizeImplode), + (G.crec.general_purpose_bit_flag & 2)? '8' : '4')); + Info(slide, 0, ((char *)slide, LoadFarString(ShannonFanoTrees), + (G.crec.general_purpose_bit_flag & 4)? '3' : '2')); + } else if (methnum == DEFLATED) { + ush dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3); + + Info(slide, 0, ((char *)slide, LoadFarString(CompressSubtype), + LoadFarStringSmall(dtypelng[dnum]))); + } + + Info(slide, 0, ((char *)slide, LoadFarString(FileSecurity), + (G.crec.general_purpose_bit_flag & 1) ? nullStr : "not ")); + Info(slide, 0, ((char *)slide, LoadFarString(ExtendedLocalHdr), + (G.crec.general_purpose_bit_flag & 8) ? "yes" : "no")); + /* print upper 3 bits for amusement? */ + + /* For printing of date & time, a "char d_t_buf[21]" is required. + * To save stack space, we reuse the "char attribs[22]" buffer which + * is not used yet. + */ +# define d_t_buf attribs + + zi_time(__G__ &G.crec.last_mod_dos_datetime, NULL, d_t_buf); + Info(slide, 0, ((char *)slide, LoadFarString(FileModDate), d_t_buf)); +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.crec.extra_field_length, 1, + G.crec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME)) + { + TIMET_TO_NATIVE(z_utime.mtime) /* NOP unless MSC 7.0 or Macintosh */ + d_t_buf[0] = (char)0; /* signal "show local time" */ + zi_time(__G__ &G.crec.last_mod_dos_datetime, &(z_utime.mtime), d_t_buf); + Info(slide, 0, ((char *)slide, LoadFarString(UT_FileModDate), + d_t_buf, LoadFarStringSmall(LocalTime))); +#ifndef NO_GMTIME + d_t_buf[0] = (char)1; /* signal "show UTC (GMT) time" */ + zi_time(__G__ &G.crec.last_mod_dos_datetime, &(z_utime.mtime), d_t_buf); + Info(slide, 0, ((char *)slide, LoadFarString(UT_FileModDate), + d_t_buf, LoadFarStringSmall(GMTime))); +#endif /* !NO_GMTIME */ + } +#endif /* USE_EF_UT_TIME */ + + Info(slide, 0, ((char *)slide, LoadFarString(CRC32Value), G.crec.crc32)); + Info(slide, 0, ((char *)slide, LoadFarString(CompressedFileSize), + G.crec.csize)); + Info(slide, 0, ((char *)slide, LoadFarString(UncompressedFileSize), + G.crec.ucsize)); + Info(slide, 0, ((char *)slide, LoadFarString(FilenameLength), + G.crec.filename_length)); + Info(slide, 0, ((char *)slide, LoadFarString(ExtraFieldLength), + G.crec.extra_field_length)); + Info(slide, 0, ((char *)slide, LoadFarString(FileCommentLength), + G.crec.file_comment_length)); + Info(slide, 0, ((char *)slide, LoadFarString(FileDiskNum), + G.crec.disk_number_start + 1)); + Info(slide, 0, ((char *)slide, LoadFarString(ApparentFileType), + (G.crec.internal_file_attributes & 1)? "text" + : (G.crec.internal_file_attributes & 2)? "ebcdic" + : "binary")); /* changed to accept EBCDIC */ +#ifdef ATARI + printf(" external file attributes (hex): %.8lx\n", + G.crec.external_file_attributes); +#endif + xattr = (ush)((G.crec.external_file_attributes >> 16) & 0xFFFF); + if (hostnum == VMS_) { + char *p=attribs, *q=attribs+1; + int i, j, k; + + for (k = 0; k < 12; ++k) + workspace[k] = 0; + if (xattr & VMS_IRUSR) + workspace[0] = 'R'; + if (xattr & VMS_IWUSR) { + workspace[1] = 'W'; + workspace[3] = 'D'; + } + if (xattr & VMS_IXUSR) + workspace[2] = 'E'; + if (xattr & VMS_IRGRP) + workspace[4] = 'R'; + if (xattr & VMS_IWGRP) { + workspace[5] = 'W'; + workspace[7] = 'D'; + } + if (xattr & VMS_IXGRP) + workspace[6] = 'E'; + if (xattr & VMS_IROTH) + workspace[8] = 'R'; + if (xattr & VMS_IWOTH) { + workspace[9] = 'W'; + workspace[11] = 'D'; + } + if (xattr & VMS_IXOTH) + workspace[10] = 'E'; + + *p++ = '('; + for (k = j = 0; j < 3; ++j) { /* loop over groups of permissions */ + for (i = 0; i < 4; ++i, ++k) /* loop over perms within a group */ + if (workspace[k]) + *p++ = workspace[k]; + *p++ = ','; /* group separator */ + if (j == 0) + while ((*p++ = *q++) != ',') + ; /* system, owner perms are same */ + } + *p-- = 0; + *p = ')'; /* overwrite last comma */ + Info(slide, 0, ((char *)slide, LoadFarString(VMSFileAttributes), xattr, + attribs)); + + } else if (hostnum == AMIGA_) { + switch (xattr & AMI_IFMT) { + case AMI_IFDIR: attribs[0] = 'd'; break; + case AMI_IFREG: attribs[0] = '-'; break; + default: attribs[0] = '?'; break; + } + attribs[1] = (xattr & AMI_IHIDDEN)? 'h' : '-'; + attribs[2] = (xattr & AMI_ISCRIPT)? 's' : '-'; + attribs[3] = (xattr & AMI_IPURE)? 'p' : '-'; + attribs[4] = (xattr & AMI_IARCHIVE)? 'a' : '-'; + attribs[5] = (xattr & AMI_IREAD)? 'r' : '-'; + attribs[6] = (xattr & AMI_IWRITE)? 'w' : '-'; + attribs[7] = (xattr & AMI_IEXECUTE)? 'e' : '-'; + attribs[8] = (xattr & AMI_IDELETE)? 'd' : '-'; + attribs[9] = 0; /* better dlm the string */ + Info(slide, 0, ((char *)slide, LoadFarString(AmigaFileAttributes), + xattr, attribs)); + + } else if ((hostnum != FS_FAT_) && (hostnum != FS_HPFS_) && + (hostnum != FS_NTFS_) && (hostnum != FS_VFAT_) && + (hostnum != ACORN_) && + (hostnum != VM_CMS_) && (hostnum != MVS_)) + { /* assume Unix-like */ + switch ((unsigned)(xattr & UNX_IFMT)) { + case (unsigned)UNX_IFDIR: attribs[0] = 'd'; break; + case (unsigned)UNX_IFREG: attribs[0] = '-'; break; + case (unsigned)UNX_IFLNK: attribs[0] = 'l'; break; + case (unsigned)UNX_IFBLK: attribs[0] = 'b'; break; + case (unsigned)UNX_IFCHR: attribs[0] = 'c'; break; + case (unsigned)UNX_IFIFO: attribs[0] = 'p'; break; + case (unsigned)UNX_IFSOCK: attribs[0] = 's'; break; + default: attribs[0] = '?'; break; + } + attribs[1] = (xattr & UNX_IRUSR)? 'r' : '-'; + attribs[4] = (xattr & UNX_IRGRP)? 'r' : '-'; + attribs[7] = (xattr & UNX_IROTH)? 'r' : '-'; + + attribs[2] = (xattr & UNX_IWUSR)? 'w' : '-'; + attribs[5] = (xattr & UNX_IWGRP)? 'w' : '-'; + attribs[8] = (xattr & UNX_IWOTH)? 'w' : '-'; + + if (xattr & UNX_IXUSR) + attribs[3] = (xattr & UNX_ISUID)? 's' : 'x'; + else + attribs[3] = (xattr & UNX_ISUID)? 'S' : '-'; /* S = undefined */ + if (xattr & UNX_IXGRP) + attribs[6] = (xattr & UNX_ISGID)? 's' : 'x'; /* == UNX_ENFMT */ + else + attribs[6] = (xattr & UNX_ISGID)? 'l' : '-'; + if (xattr & UNX_IXOTH) + attribs[9] = (xattr & UNX_ISVTX)? 't' : 'x'; /* "sticky bit" */ + else + attribs[9] = (xattr & UNX_ISVTX)? 'T' : '-'; /* T = undefined */ + attribs[10] = 0; + + Info(slide, 0, ((char *)slide, LoadFarString(UnixFileAttributes), xattr, + attribs)); + + } else { + Info(slide, 0, ((char *)slide, LoadFarString(NonMSDOSFileAttributes), + G.crec.external_file_attributes >> 8)); + + } /* endif (hostnum: external attributes format) */ + + if ((xattr=(ush)(G.crec.external_file_attributes & 0xFF)) == 0) + Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributes), + xattr)); + else if (xattr == 1) + Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributesRO), + xattr)); + else + Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributesAlpha), + xattr, (xattr&1)? "rdo " : nullStr, + (xattr&2)? "hid " : nullStr, + (xattr&4)? "sys " : nullStr, + (xattr&8)? "lab " : nullStr, + (xattr&16)? "dir " : nullStr, + (xattr&32)? "arc" : nullStr)); + +/*--------------------------------------------------------------------------- + Analyze the extra field, if any, and print the file comment, if any (the + filename has already been printed, above). That finishes up this file + entry... + ---------------------------------------------------------------------------*/ + + if (G.crec.extra_field_length > 0) { + uch *ef_ptr = G.extra_field; + ush ef_len = G.crec.extra_field_length; + ush eb_id, eb_datalen; + ZCONST char Far *ef_fieldname; + + if (error_in_archive > PK_WARN) /* fatal: can't continue */ + /* delayed "fatal error" return from extra field reading */ + return error; + if (G.extra_field == (uch *)NULL) + return PK_ERR; /* not consistent with crec length */ + + Info(slide, 0, ((char *)slide, LoadFarString(ExtraFields))); + + while (ef_len >= EB_HEADSIZE) { + eb_id = makeword(&ef_ptr[EB_ID]); + eb_datalen = makeword(&ef_ptr[EB_LEN]); + ef_ptr += EB_HEADSIZE; + ef_len -= EB_HEADSIZE; + + if (eb_datalen > (ush)ef_len) { + Info(slide, 0x421, ((char *)slide, + LoadFarString(ExtraFieldTrunc), eb_id, eb_datalen, ef_len)); + eb_datalen = ef_len; + } + + switch (eb_id) { + case EF_AV: + ef_fieldname = efAV; + break; + case EF_OS2: + ef_fieldname = efOS2; + break; + case EF_ACL: + ef_fieldname = efACL; + break; + case EF_NTSD: + ef_fieldname = efNTSD; + break; + case EF_PKVMS: + ef_fieldname = efPKVMS; + break; + case EF_IZVMS: + ef_fieldname = efIZVMS; + break; + case EF_PKW32: + ef_fieldname = efPKWin32; + break; + case EF_PKUNIX: + ef_fieldname = efPKUnix; + break; + case EF_IZUNIX: + ef_fieldname = efIZUnix; + if (G.crec.version_made_by[1] == UNIX_ && *pEndprev > 0L) + *pEndprev += 4L; /* also have UID/GID in local copy */ + break; + case EF_IZUNIX2: + ef_fieldname = efIZUnix2; + if (*pEndprev > 0L) + *pEndprev += 4L; /* 4 byte UID/GID in local copy */ + break; + case EF_TIME: + ef_fieldname = efTime; + break; + case EF_MAC3: + ef_fieldname = efMac3; + break; + case EF_JLMAC: + ef_fieldname = efJLMac; + break; + case EF_ZIPIT: + ef_fieldname = efZipIt; + break; + case EF_ZIPIT2: + ef_fieldname = efZipIt2; + break; + case EF_VMCMS: + ef_fieldname = efVMCMS; + break; + case EF_MVS: + ef_fieldname = efMVS; + break; + case EF_BEOS: + ef_fieldname = efBeOS; + break; + case EF_QDOS: + ef_fieldname = efQDOS; + break; + case EF_AOSVS: + ef_fieldname = efAOSVS; + break; + case EF_SPARK: /* from RISC OS */ + ef_fieldname = efSpark; + break; + case EF_MD5: + ef_fieldname = efMD5; + break; + case EF_ASIUNIX: + ef_fieldname = efASiUnix; + break; + default: + ef_fieldname = efUnknown; + break; + } + Info(slide, 0, ((char *)slide, LoadFarString(ExtraFieldType), + eb_id, LoadFarStringSmall(ef_fieldname), eb_datalen)); + + /* additional, field-specific information: */ + switch (eb_id) { + case EF_OS2: + case EF_ACL: + if (eb_datalen >= EB_OS2_HLEN) { + if (eb_id == EF_OS2) + ef_fieldname = OS2EAs; + else + ef_fieldname = ACLdata; + Info(slide, 0, ((char *)slide, + LoadFarString(ef_fieldname), makelong(ef_ptr))); + *pEndprev = 0L; /* no clue about csize of local */ + } + break; + case EF_NTSD: + if (eb_datalen >= EB_NTSD_C_LEN) { + Info(slide, 0, ((char *)slide, LoadFarString(NTSDData), + makelong(ef_ptr))); + *pEndprev = 0L; /* no clue about csize of local */ + } + break; + case EF_IZVMS: + if (eb_datalen >= 8) { + char *p, q[8]; + int compr = makeword(ef_ptr+4) & 7; + + *q = '\0'; + if (compr > 3) + compr = 3; + if (strncmp((char *)ef_ptr, "VFAB", 4) == 0) + p = "FAB"; + else if (strncmp((char *)ef_ptr, "VALL", 4) == 0) + p = "XABALL"; + else if (strncmp((char *)ef_ptr, "VFHC", 4) == 0) + p = "XABFHC"; + else if (strncmp((char *)ef_ptr, "VDAT", 4) == 0) + p = "XABDAT"; + else if (strncmp((char *)ef_ptr, "VRDT", 4) == 0) + p = "XABRDT"; + else if (strncmp((char *)ef_ptr, "VPRO", 4) == 0) + p = "XABPRO"; + else if (strncmp((char *)ef_ptr, "VKEY", 4) == 0) + p = "XABKEY"; + else if (strncmp((char *)ef_ptr, "VMSV", 4) == 0) { + p = "version"; + if (eb_datalen >= 16) { + q[0] = ' '; + q[1] = '('; + strncpy(q+2, (char *)ef_ptr+12, 4); + q[6] = ')'; + q[7] = '\0'; + } + } else + p = "version"; + Info(slide, 0, ((char *)slide, LoadFarString(izVMSdata), + LoadFarStringSmall(izVMScomp[compr]), + makeword(ef_ptr+6), p, q)); + } + break; + case EF_TIME: + if (eb_datalen >= 1) { + char types[80]; + int num = 0, len; + + *types = '\0'; + if (*ef_ptr & 1) { + strcpy(types, LoadFarString(UTmodification)); + ++num; + } + if (*ef_ptr & 2) { + len = strlen(types); + if (num) + types[len++] = '/'; + strcpy(types+len, LoadFarString(UTaccess)); + ++num; + if (*pEndprev > 0L) + *pEndprev += 4L; + } + if (*ef_ptr & 4) { + len = strlen(types); + if (num) + types[len++] = '/'; + strcpy(types+len, LoadFarString(UTcreation)); + ++num; + if (*pEndprev > 0L) + *pEndprev += 4L; + } + if (num > 0) + Info(slide, 0, ((char *)slide, + LoadFarString(UTdata), types, + num == 1? nullStr : "s")); + } + break; + case EF_MAC3: + if (eb_datalen >= EB_MAC3_HLEN) { + ulg eb_uc = makelong(ef_ptr); + unsigned mac3_flgs = makeword(ef_ptr+EB_FLGS_OFFS); + unsigned eb_is_uc = mac3_flgs & EB_M3_FL_UNCMPR; + + Info(slide, 0, ((char *)slide, LoadFarString(Mac3data), + eb_uc, eb_is_uc ? "un" : nullStr)); + if (eb_is_uc) { + if (*pEndprev > 0L) + *pEndprev += makelong(ef_ptr); + } else { + *pEndprev = 0L; /* no clue about csize of local */ + } + + Info(slide, 0, ((char *)slide, + LoadFarString(MacOSMAC3flags), + LoadFarStringSmall(mac3_flgs & EB_M3_FL_DATFRK ? + MacOS_DF : MacOS_RF), + (mac3_flgs & EB_M3_FL_TIME64 ? 64 : 32))); + zi_showMacTypeCreator(__G__ &ef_ptr[6]); + } + break; + case EF_ZIPIT2: + if (eb_datalen >= 5 && + strncmp((char *)ef_ptr, "ZPIT", 4) == 0) { + + if (eb_datalen >= 12) { + zi_showMacTypeCreator(__G__ &ef_ptr[4]); + } + } + + case EF_ZIPIT: + if (eb_datalen >= 5 && + strncmp((char *)ef_ptr, "ZPIT", 4) == 0) { + unsigned fnlen = ef_ptr[4]; + + if (eb_datalen >= fnlen + (5 + 8)) { + uch nullchar = ef_ptr[fnlen+5]; + + ef_ptr[fnlen+5] = '\0'; /* terminate filename */ + Info(slide, 0, ((char *)slide, + LoadFarString(ZipItFname), (char *)ef_ptr+5)); + ef_ptr[fnlen+5] = nullchar; + zi_showMacTypeCreator(__G__ &ef_ptr[fnlen+5]); + } + } + break; + case EF_JLMAC: + if (eb_datalen >= 40 && + strncmp((char *)ef_ptr, "JLEE", 4) == 0) + { + zi_showMacTypeCreator(__G__ &ef_ptr[4]); + + Info(slide, 0, ((char *)slide, + LoadFarString(MacOSJLEEflags), + LoadFarStringSmall(ef_ptr[31] & 1 ? + MacOS_DF : MacOS_RF))); + } + break; +#ifdef CMS_MVS + case EF_VMCMS: + case EF_MVS: + { + char type[100]; + + Info(slide, 0, ((char *)slide, + LoadFarString(VmMvsExtraField), + (getVMMVSexfield(type, ef_ptr-EB_HEADSIZE, + (unsigned)eb_datalen) > 0)? + type : LoadFarStringSmall(VmMvsInvalid))); + } + break; +#endif /* CMS_MVS */ + case EF_BEOS: + if (eb_datalen >= EB_BEOS_HLEN) { + ulg eb_uc = makelong(ef_ptr); + unsigned eb_is_uc = + *(ef_ptr+EB_FLGS_OFFS) & EB_BE_FL_UNCMPR; + + Info(slide, 0, ((char *)slide, LoadFarString(BeOSdata), + eb_uc, eb_is_uc ? "un" : nullStr)); + if (eb_is_uc) { + if (*pEndprev > 0L) + *pEndprev += makelong(ef_ptr); + } else { + *pEndprev = 0L; /* no clue about csize of local */ + } + } + break; + case EF_QDOS: + if (eb_datalen >= 4) { + Info(slide, 0, ((char *)slide, LoadFarString(QDOSdata), + ef_ptr[0], ef_ptr[1], ef_ptr[2], ef_ptr[3])); + } + break; + case EF_AOSVS: + if (eb_datalen >= 5) { + Info(slide, 0, ((char *)slide, LoadFarString(AOSVSdata), + ((int)(uch)ef_ptr[4])/10, ((int)(uch)ef_ptr[4])%10)); + } + break; + case EF_MD5: + if (eb_datalen >= 19) { + char md5[33]; + int i; + + for (i = 0; i < 16; ++i) + sprintf(&md5[i<<1], "%02x", ef_ptr[15-i]); + md5[32] = '\0'; + Info(slide, 0, ((char *)slide, LoadFarString(MD5data), + md5)); + break; + } /* else: fall through !! */ + default: + if (eb_datalen > 0) { + ush i, n; + + if (eb_datalen <= 24) { + Info(slide, 0, ((char *)slide, + LoadFarString(ColonIndent))); + n = eb_datalen; + } else { + Info(slide, 0, ((char *)slide, + LoadFarString(First20))); + n = 20; + } + for (i = 0; i < n; ++i) + Info(slide, 0, ((char *)slide, + LoadFarString(efFormat), ef_ptr[i])); + } + break; + } + (*G.message)((zvoid *)&G, (uch *)".", 1L, 0); + + ef_ptr += eb_datalen; + ef_len -= eb_datalen; + } + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + } + + /* high bit == Unix/OS2/NT GMT times (mtime, atime); next bit == UID/GID */ + if ((xattr = (ush)((G.crec.external_file_attributes & 0xC000) >> 12)) & 8) + { + if (hostnum == UNIX_ || hostnum == FS_HPFS_ || hostnum == FS_NTFS_) + { + Info(slide, 0, ((char *)slide, LoadFarString(lExtraFieldType), + "is", EF_IZUNIX, LoadFarStringSmall(efIZUnix), + (unsigned)(xattr&12), (xattr&4)? efIZuid : efIZnouid)); + if (*pEndprev > 0L) + *pEndprev += (ulg)(xattr&12); + } + else if (hostnum == FS_FAT_ && !(xattr&4)) + Info(slide, 0, ((char *)slide, LoadFarString(lExtraFieldType), + "may be", EF_IZUNIX, LoadFarStringSmall(efIZUnix), 8, + efIZnouid)); + } + + if (!G.crec.file_comment_length) + Info(slide, 0, ((char *)slide, LoadFarString(NoFileComment))); + else { + Info(slide, 0, ((char *)slide, LoadFarString(FileCommBegin))); + if ((error = do_string(__G__ G.crec.file_comment_length, DISPL_8)) != + PK_COOL) + { + error_in_archive = error; /* might be warning */ + if (error > PK_WARN) /* fatal */ + return error; + } + Info(slide, 0, ((char *)slide, LoadFarString(FileCommEnd))); + } + + return error_in_archive; + +} /* end function zi_long() */ + + + + + +/*************************/ +/* Function zi_short() */ +/*************************/ + +static int zi_short(__G) /* return PK-type error code */ + __GDEF +{ +#ifdef USE_EF_UT_TIME + iztimes z_utime; + time_t *z_modtim; +#endif + int k, error, error_in_archive=PK_COOL; + ush methnum, hostnum, hostver, xattr; + char *p, workspace[12], attribs[16]; + char methbuf[5]; + static ZCONST char dtype[5]="NXFS"; /* normal, maximum, fast, superfast */ + static ZCONST char Far os[NUM_HOSTS+1][4] = { + "fat", "ami", "vms", "unx", "cms", "atr", "hpf", "mac", "zzz", + "cpm", "t20", "ntf", "qds", "aco", "vft", "mvs", "be ", "nsk", + "???" + }; + static ZCONST char Far method[NUM_METHODS+1][5] = { + "stor", "shrk", "re:1", "re:2", "re:3", "re:4", "i#:#", "tokn", + "def#", "edef", "dcli", "u###" + }; + + +/*--------------------------------------------------------------------------- + Print out various interesting things about the compressed file. + ---------------------------------------------------------------------------*/ + + methnum = (ush)MIN(G.crec.compression_method, NUM_METHODS); + hostnum = (ush)(G.pInfo->hostnum); + hostver = G.crec.version_made_by[0]; +/* + extnum = MIN(G.crec.version_needed_to_extract[1], NUM_HOSTS); + extver = G.crec.version_needed_to_extract[0]; + */ + + zfstrcpy(methbuf, method[methnum]); + if (methnum == IMPLODED) { + methbuf[1] = (char)((G.crec.general_purpose_bit_flag & 2)? '8' : '4'); + methbuf[3] = (char)((G.crec.general_purpose_bit_flag & 4)? '3' : '2'); + } else if (methnum == DEFLATED) { + ush dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3); + methbuf[3] = dtype[dnum]; + } else if (methnum >= NUM_METHODS) { /* unknown */ + sprintf(&methbuf[1], "%03u", G.crec.compression_method); + } + + for (k = 0; k < 15; ++k) + attribs[k] = ' '; + attribs[15] = 0; + + xattr = (ush)((G.crec.external_file_attributes >> 16) & 0xFFFF); + switch (hostnum) { + case VMS_: + { int i, j; + + for (k = 0; k < 12; ++k) + workspace[k] = 0; + if (xattr & VMS_IRUSR) + workspace[0] = 'R'; + if (xattr & VMS_IWUSR) { + workspace[1] = 'W'; + workspace[3] = 'D'; + } + if (xattr & VMS_IXUSR) + workspace[2] = 'E'; + if (xattr & VMS_IRGRP) + workspace[4] = 'R'; + if (xattr & VMS_IWGRP) { + workspace[5] = 'W'; + workspace[7] = 'D'; + } + if (xattr & VMS_IXGRP) + workspace[6] = 'E'; + if (xattr & VMS_IROTH) + workspace[8] = 'R'; + if (xattr & VMS_IWOTH) { + workspace[9] = 'W'; + workspace[11] = 'D'; + } + if (xattr & VMS_IXOTH) + workspace[10] = 'E'; + + p = attribs; + for (k = j = 0; j < 3; ++j) { /* groups of permissions */ + for (i = 0; i < 4; ++i, ++k) /* perms within a group */ + if (workspace[k]) + *p++ = workspace[k]; + *p++ = ','; /* group separator */ + } + *--p = ' '; /* overwrite last comma */ + if ((p - attribs) < 12) + sprintf(&attribs[12], "%d.%d", hostver/10, hostver%10); + } + break; + + case FS_FAT_: + case FS_HPFS_: + case FS_NTFS_: + case VM_CMS_: + case FS_VFAT_: + case MVS_: + case ACORN_: + xattr = (ush)(G.crec.external_file_attributes & 0xFF); + sprintf(attribs, ".r.-... %d.%d", hostver/10, hostver%10); + attribs[2] = (xattr & 0x01)? '-' : 'w'; + attribs[5] = (xattr & 0x02)? 'h' : '-'; + attribs[6] = (xattr & 0x04)? 's' : '-'; + attribs[4] = (xattr & 0x20)? 'a' : '-'; + if (xattr & 0x10) { + attribs[0] = 'd'; + attribs[3] = 'x'; + } else + attribs[0] = '-'; + if (IS_VOLID(xattr)) + attribs[0] = 'V'; + else if ((p = strrchr(G.filename, '.')) != (char *)NULL) { + ++p; + if (STRNICMP(p, "com", 3) == 0 || STRNICMP(p, "exe", 3) == 0 || + STRNICMP(p, "btm", 3) == 0 || STRNICMP(p, "cmd", 3) == 0 || + STRNICMP(p, "bat", 3) == 0) + attribs[3] = 'x'; + } + break; + + case AMIGA_: + switch (xattr & AMI_IFMT) { + case AMI_IFDIR: attribs[0] = 'd'; break; + case AMI_IFREG: attribs[0] = '-'; break; + default: attribs[0] = '?'; break; + } + attribs[1] = (xattr & AMI_IHIDDEN)? 'h' : '-'; + attribs[2] = (xattr & AMI_ISCRIPT)? 's' : '-'; + attribs[3] = (xattr & AMI_IPURE)? 'p' : '-'; + attribs[4] = (xattr & AMI_IARCHIVE)? 'a' : '-'; + attribs[5] = (xattr & AMI_IREAD)? 'r' : '-'; + attribs[6] = (xattr & AMI_IWRITE)? 'w' : '-'; + attribs[7] = (xattr & AMI_IEXECUTE)? 'e' : '-'; + attribs[8] = (xattr & AMI_IDELETE)? 'd' : '-'; + sprintf(&attribs[12], "%d.%d", hostver/10, hostver%10); + break; + + default: /* assume Unix-like */ + switch ((unsigned)(xattr & UNX_IFMT)) { + case (unsigned)UNX_IFDIR: attribs[0] = 'd'; break; + case (unsigned)UNX_IFREG: attribs[0] = '-'; break; + case (unsigned)UNX_IFLNK: attribs[0] = 'l'; break; + case (unsigned)UNX_IFBLK: attribs[0] = 'b'; break; + case (unsigned)UNX_IFCHR: attribs[0] = 'c'; break; + case (unsigned)UNX_IFIFO: attribs[0] = 'p'; break; + case (unsigned)UNX_IFSOCK: attribs[0] = 's'; break; + default: attribs[0] = '?'; break; + } + attribs[1] = (xattr & UNX_IRUSR)? 'r' : '-'; + attribs[4] = (xattr & UNX_IRGRP)? 'r' : '-'; + attribs[7] = (xattr & UNX_IROTH)? 'r' : '-'; + attribs[2] = (xattr & UNX_IWUSR)? 'w' : '-'; + attribs[5] = (xattr & UNX_IWGRP)? 'w' : '-'; + attribs[8] = (xattr & UNX_IWOTH)? 'w' : '-'; + + if (xattr & UNX_IXUSR) + attribs[3] = (xattr & UNX_ISUID)? 's' : 'x'; + else + attribs[3] = (xattr & UNX_ISUID)? 'S' : '-'; /* S==undefined */ + if (xattr & UNX_IXGRP) + attribs[6] = (xattr & UNX_ISGID)? 's' : 'x'; /* == UNX_ENFMT */ + else + /* attribs[6] = (xattr & UNX_ISGID)? 'l' : '-'; real 4.3BSD */ + attribs[6] = (xattr & UNX_ISGID)? 'S' : '-'; /* SunOS 4.1.x */ + if (xattr & UNX_IXOTH) + attribs[9] = (xattr & UNX_ISVTX)? 't' : 'x'; /* "sticky bit" */ + else + attribs[9] = (xattr & UNX_ISVTX)? 'T' : '-'; /* T==undefined */ + + sprintf(&attribs[12], "%d.%d", hostver/10, hostver%10); + break; + + } /* end switch (hostnum: external attributes format) */ + + Info(slide, 0, ((char *)slide, "%s %s %8lu ", attribs, + LoadFarStringSmall(os[hostnum]), G.crec.ucsize)); + Info(slide, 0, ((char *)slide, "%c", + (G.crec.general_purpose_bit_flag & 1)? + ((G.crec.internal_file_attributes & 1)? 'T' : 'B') : /* encrypted */ + ((G.crec.internal_file_attributes & 1)? 't' : 'b'))); /* plaintext */ + k = (G.crec.extra_field_length || + /* a local-only "UX" (old Unix/OS2/NT GMT times "IZUNIX") e.f.? */ + ((G.crec.external_file_attributes & 0x8000) && + (hostnum == UNIX_ || hostnum == FS_HPFS_ || hostnum == FS_NTFS_))); + Info(slide, 0, ((char *)slide, "%c", k? + ((G.crec.general_purpose_bit_flag & 8)? 'X' : 'x') : /* extra field */ + ((G.crec.general_purpose_bit_flag & 8)? 'l' : '-'))); /* no extra field */ + /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ extended local header or not */ + + if (uO.lflag == 4) { + ulg csiz = G.crec.csize; + + if (G.crec.general_purpose_bit_flag & 1) + csiz -= 12; /* if encrypted, don't count encryption header */ + Info(slide, 0, ((char *)slide, "%3d%%", + (ratio(G.crec.ucsize,csiz)+5)/10)); + } else if (uO.lflag == 5) + Info(slide, 0, ((char *)slide, " %8lu", G.crec.csize)); + + /* Read the extra field, if any. The extra field info may be used + * in the file modification time section, below. + */ + if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD)) != 0) + { + if (G.extra_field != NULL) { + free(G.extra_field); + G.extra_field = NULL; + } + error_in_archive = error; + /* We do not return prematurely in case of a "fatal" error (PK_EOF). + * This does not hurt here, because we do not need to read from the + * zipfile again before the end of this function. + */ + } + + /* For printing of date & time, a "char d_t_buf[16]" is required. + * To save stack space, we reuse the "char attribs[16]" buffer whose + * content is no longer needed. + */ +# define d_t_buf attribs +#ifdef USE_EF_UT_TIME + z_modtim = G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.crec.extra_field_length, 1, + G.crec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME) + ? &z_utime.mtime : NULL; + TIMET_TO_NATIVE(z_utime.mtime) /* NOP unless MSC 7.0 or Macintosh */ + d_t_buf[0] = (char)0; /* signal "show local time" */ +#else +# define z_modtim NULL +#endif + Info(slide, 0, ((char *)slide, " %s %s ", methbuf, + zi_time(__G__ &G.crec.last_mod_dos_datetime, z_modtim, d_t_buf))); + fnprint(__G); + +/*--------------------------------------------------------------------------- + Skip the file comment, if any (the filename has already been printed, + above). That finishes up this file entry... + ---------------------------------------------------------------------------*/ + + SKIP_(G.crec.file_comment_length) + + return error_in_archive; + +} /* end function zi_short() */ + + + + + +/**************************************/ +/* Function zi_showMacTypeCreator() */ +/**************************************/ + +static void zi_showMacTypeCreator(__G__ ebfield) + __GDEF + uch *ebfield; +{ + /* not every Type / Creator character is printable */ + if (isprint(ebfield[0]) && isprint(ebfield[1]) && + isprint(ebfield[2]) && isprint(ebfield[3]) && + isprint(ebfield[4]) && isprint(ebfield[5]) && + isprint(ebfield[6]) && isprint(ebfield[7])) { + Info(slide, 0, ((char *)slide, LoadFarString(MacOSdata), + ebfield[0], ebfield[1], ebfield[2], ebfield[3], + ebfield[4], ebfield[5], ebfield[6], ebfield[7])); + } else { + Info(slide, 0, ((char *)slide, LoadFarString(MacOSdata1), + (((ulg)ebfield[0]) << 24) + + (((ulg)ebfield[1]) << 16) + + (((ulg)ebfield[2]) << 8) + + ((ulg)ebfield[3]), + (((ulg)ebfield[4]) << 24) + + (((ulg)ebfield[5]) << 16) + + (((ulg)ebfield[6]) << 8) + + ((ulg)ebfield[7]))); + } +} /* end function zi_showMacTypeCreator() */ + + + + + +/************************/ +/* Function zi_time() */ +/************************/ + +static char *zi_time(__G__ datetimez, modtimez, d_t_str) + __GDEF + ZCONST ulg *datetimez; + ZCONST time_t *modtimez; + char *d_t_str; +{ + unsigned yr, mo, dy, hh, mm, ss; + char monthbuf[4]; + ZCONST char *monthstr; + static ZCONST char Far month[12][4] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; +#ifdef USE_EF_UT_TIME + struct tm *t; +#endif + + + +/*--------------------------------------------------------------------------- + Convert the file-modification date and time info to a string of the form + "1991 Feb 23 17:15:00", "23-Feb-91 17:15" or "19910223.171500", depending + on values of lflag and T_flag. If using Unix-time extra fields, convert + to local time or not, depending on value of first character in d_t_str[]. + ---------------------------------------------------------------------------*/ + +#ifdef USE_EF_UT_TIME + if (modtimez != NULL) { +#ifndef NO_GMTIME + /* check for our secret message from above... */ + t = (d_t_str[0] == (char)1)? gmtime(modtimez) : localtime(modtimez); +#else + t = localtime(modtimez); +#endif + if (uO.lflag > 9 && t == (struct tm *)NULL) + /* time conversion error in verbose listing format, + * return string with '?' instead of data + */ + return (strcpy(d_t_str, LoadFarString(YMDHMSTimeError))); + } else + t = (struct tm *)NULL; + if (t != (struct tm *)NULL) { + mo = (unsigned)(t->tm_mon + 1); + dy = (unsigned)(t->tm_mday); + yr = (unsigned)(t->tm_year); + + hh = (unsigned)(t->tm_hour); + mm = (unsigned)(t->tm_min); + ss = (unsigned)(t->tm_sec); + } else +#endif /* USE_EF_UT_TIME */ + { + yr = ((unsigned)(*datetimez >> 25) & 0x7f) + 80; + mo = ((unsigned)(*datetimez >> 21) & 0x0f); + dy = ((unsigned)(*datetimez >> 16) & 0x1f); + + hh = (((unsigned)*datetimez >> 11) & 0x1f); + mm = (((unsigned)*datetimez >> 5) & 0x3f); + ss = (((unsigned)*datetimez << 1) & 0x3e); + } + + if (mo == 0 || mo > 12) { + sprintf(monthbuf, LoadFarString(BogusFmt), mo); + monthstr = monthbuf; + } else + monthstr = LoadFarStringSmall(month[mo-1]); + + if (uO.lflag > 9) /* verbose listing format */ + sprintf(d_t_str, LoadFarString(YMDHMSTime), yr+1900, monthstr, dy, hh, + mm, ss); + else if (uO.T_flag) + sprintf(d_t_str, LoadFarString(DecimalTime), yr+1900, mo, dy, hh, mm, + ss); + else /* was: if ((uO.lflag >= 3) && (uO.lflag <= 5)) */ + sprintf(d_t_str, LoadFarString(DMYHMTime), dy, monthstr, yr%100, hh, + mm); + + return d_t_str; + +} /* end function zi_time() */ + +#endif /* !NO_ZIPINFO */ diff --git a/utils/Install/script/finished.ini b/utils/Install/script/finished.ini new file mode 100644 index 0000000000..3c52d33bcc --- /dev/null +++ b/utils/Install/script/finished.ini @@ -0,0 +1,9 @@ +# Sample ini file for the last page +# +closeold +grabfile,install.bmp +loadwxr,finished.wxr +setbutton,101,exit +setbutton,103,exit +disable,button3 +remove,install.bmp \ No newline at end of file diff --git a/utils/Install/script/finished.wxr b/utils/Install/script/finished.wxr new file mode 100644 index 0000000000..5d4e4b5dcd --- /dev/null +++ b/utils/Install/script/finished.wxr @@ -0,0 +1,25 @@ +static char *dialog1 = "dialog(name = 'dialog1',\ + style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\ + title = 'Installing wxInstall 0.1',\ + id = 100,\ + x = 10, y = 10, width = 264, height = 179,\ + background_colour = 'D4D0C8',\ + use_dialog_units = 1,\ + use_system_defaults = 0,\ + font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg'],\ + control = [101, wxButton, 'Exit Installer', '0', 'button2', 5, 160, 60, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [102, wxButton, '<< Back', 'wxNO_BORDER', 'button3', 165, 160, 44, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [103, wxButton, 'Finish', '0', 'button4', 209, 160, 44, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [104, wxStaticBitmap, '', 'wxNO_BORDER', 'static5', 9, 8, 60, 144, 'bitmap9',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [105, wxStaticText, 'wxInstall Installation finished.', '0', 'statictext10', 81, 12, 164, 10, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [6006, wxStaticText, 'Thanks for trying wxInstall. Press finish to exit.', '0', 'statictext6', 80, 42, 168, 6, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']])."; + +static char *bitmap9 = "bitmap(name = 'bitmap9',\ + bitmap = ['install.bmp', wxBITMAP_TYPE_BMP, 'ANY'])."; + diff --git a/utils/Install/script/install.bmp b/utils/Install/script/install.bmp new file mode 100644 index 0000000000000000000000000000000000000000..b394773c37223ee9764a9162ebf0de10367fa667 GIT binary patch literal 14418 zcmeI0O^)L>5QRCmR@u>ZW7cMC23bbdbe4gw)@pz(+JJq4M%ot`AlZABE94S6L?5h? zSH&MuBB`IO$%ZZ2<fm8lij>%He*abI_9qTM<Mjt#+fPD#5{2&Y-hVRZ-+%j8yuZJT z`~5CHK0d^1wGwx{KJZ$t@c9GB`^qEpX?7qxkR8YlWCyYX*@5gpb|5>D9mo!32eJd% zf$TtbAUlv9$PP?6P#h-)gxy6`E`^F_zf;Q~sGQ`c4CT|`unM3yJ!II!h}=u5W<x+W zs#OwgHbjVG1kiC9MDMdJNTrdQgf^p0SCBOzDYvSUf7NyGvV#wPLDm&X)bjHb!UZvr zXz25gX%(uX2hBmKARYwdmqGmgN3S4mzO3s}MEC`9=B}+ud@lF}ktQP-M;o6DT|vUU zF^8Jy{B{Ki@`g%k*13Y%Bur?9k~CRU;Yo?W4z@s=DH<Rf%!wFOG>_lpkGkrwP1Hb@ z4aydSXtF)lKu}fBTCM>jfQ}|yd*IGTLVBH4gT37H_pWZ1@eAa2q6SboJj&RjNEL|f zgidrFX|J(j2Gf7d;YJZ5Gz4T&AX?xFL_;AWM4d(miXni;7I<pKj4p7uVr&WWak&G9 zw<c!NMH5?^qcE*dbsQZs>;xi}>falNV+NlI0kZ^RgqZn|Mwpok8ALPlAd47g4&)Ha zOhX;wm?_9ZI%XVl2;Dl#YtzPxt8eGnP8@ViEi<Cjn%g-ezD~NhdM9O6uyyIRcz6S( z>I+4~3y_`*ZER&&MAFm4K61L~+EyJ0lV3Q5p9A_Sg=e0FnvjVj9u(0z@a4^$RiTeo zsV#%pDl?o8KH{KphLM&VUq~xOVyn2D-hk}d7S9}{-?k@wW1w_wK-%Y;9*AsNiOr79 zY3Ox@E^36-6`i@{-Fe9TLjxJ16K@VUrI7iX1|k>Uh_ei)3pblnl6fW+4F=$kTZxYp zX~@vPTJ9=3YJ@OuMkvZ4tgS})zY>hs5HV1SF_cL~-RP(JM;Z)KaJXEA;p8joHUIk% zQ}P>qxgG3jgs6}UwF)oy?~>1ih^RC|3<U&I$7XdR2sT2x9dK<zsKOkUjxC1J?ui?2 zHmpJwcFZY`IOt#kd#E%6<H{6bA%kq645QleIdDw4M&UW+Y8lmzAf)7w%f&Gh+XRPP zFIK046Jr|^hg>dKtHT9KLxnEo_6aIZN0Crc3IBpn+dh#>mk$f2p!HrOtkUUdp#;P` zcB|s@F;hESrCcInGy<hJ>l>2cjMUN9(K`WSRL)-kb@kC1B^cw_dH==p%?c%$4Lf$; z%dc;~j$W)u2G<87zx49a8KoH11<1ooKOb#fia{~Y^5OC_$cKfJ3_=4k%!h@N40Ik| z<Y|}>38k3p<#v|4(`Mis><*u%g4$Yckk6|;ZB(eEnj?k;4GdY0TcWzY-Mo1K83-K% z0AG;K?eYqQLc4WyhZ&V(C?7&@fQC$&(m_6~a(zQ>IV3GY!6ld*^3f`<m_hRx<O2+$ z(WINnAfF56LMn3^gRsh6hC;g;6+FZ!^GOc?+-NmWqr3MUrl&&S3>~QG^v%;%%IVkw zMDC{Z8K_{-G|7aBcAUV}-02)6188T4W|R^PjnF3ZiAF3m#@L;L-TMG%r4gn>x-*8- zOgFGQ(@IIE8`zz3Zb{!<^*tk)Af<#(ckS-XGBVC=U4I0T-=g<}$}%w|@mmr<guyL9 z?9OTtqM?NdLG@ApdTDc`V<H!83U}i-wFQVp@jG2*u?ZE2;ACy61qf3JaT!9QW4|O) Xe{R`<>_B!PJCGg74rB-ZzXSgP_-C-$ literal 0 HcmV?d00001 diff --git a/utils/Install/script/install.xpm b/utils/Install/script/install.xpm new file mode 100644 index 0000000000..cd2938912f --- /dev/null +++ b/utils/Install/script/install.xpm @@ -0,0 +1,292 @@ +/* XPM */ +static char * inst[] = { +/* width height ncolors chars_per_pixel */ +"100 275 10 1", +/* colors */ +" c #AE3E4A", +"! c #C2C2C2", +"# c #828282", +"$ c #FEFEFE", +"% c #020202", +"& c #020282", +"' c #0202FE", +"( c #FE0202", +") c #02FE02", +"* c #028202", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" $$$$ ", +" $$$$$!!!!$$ ", +" $$$$!!!!!!!!!!!$$ ", +" $$$$$!!!!!!!!!!!!!!!!!$$ ", +" $$ $$$$$!!!!!!!!!!!!!!!!!!!!!!!!$$ ", +" $$!!$$% $$$$$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$$ ", +" $$!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$$ ", +" $$!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$$ ", +" $!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$$ ", +" $$!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$$ ", +" $!$!!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$% ", +" $!!$$!!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#% ", +" $!!!!$$!!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!###% ", +" $!!!!!!$$!!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!!!!!!!#####% ", +" $!!!!!!!!$$!!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!!!#######% ", +" $!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!#########% ", +" $!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!$!!!!!!!!!!!!!!!!!###########% ", +" $!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!#############% ", +" $!!!##!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!$$!!!!!!!!!###############% ", +" $!!!#'##!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!$$!!!!!#################% ", +" $!!!#&&'##!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!$$!###################% ", +" $!!!#''&&'##!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!%###################% ", +" $!!!#'&''&&'##!!!!!!!!!!!$$!!!!!!!!!!!!!!#%###################% ", +" $!!!#''&&'''&'##!!!!!!!!!!!$$!!!!!!!!!!###%###################% ", +" $!!!#&&'''&''&&&##!!!!!!!!!!!$$!!!!!!#####%###################% ", +" $!!!#''&&''&&'''&'##!!!!!!!!!!!$$!!#######%###################% ", +" $!!!#&&''&&'''&&''&&##!!!!!!!!!!!#########%###################% ", +" $!!!#&'&&''&&'''&&''&'##!!!!!!!!!#########%###################% ", +" $!!!#&&''&&''&&&''&'''&&##!!!!!!!#########%###################% ", +" $!!!#''&&&'&##''&'''&&''&'##!!!!!#########%###################% ", +" $!!!#&&&'&&'####''&&''&&''&&##!!!#########%###################% ", +" $!!!#&'&&''&######''&'''&&''&$!!!#########%###################% ", +" $!!!#&&''&&'#!######''&&''&''$!!!#########%##################% ", +" $!!!#&'&&&'&#!!!#####&''&'''&$!!!#########%#################%% ", +" $!!!#&&&'&&'#!!%!!####&&''&&'$!!!#########%################%#% ", +" $!!!#&'&&''&#!!!%%!!##''&&''&$!!!#########%###############%##% ", +" $!!!#&&&'&&&#!&&!!!%!#&&''&&'$!!!#########%##############%###% ", +" $!!!#&&&&&'&#!&&&&!!!#''&&''&$!!!#########%#############%####% ", +" $!!!#&&&'&&&#!!!&&&&!#&&'&&&'$!!!#########%############%#####% ", +" $!!!#&'&&&&&##!!!!&&!#'&&&''&$!!!#########%###########%######% ", +" $!!!#&&&'&&&'&##!!!!!#&&''&&'$!!!#########%##########%#######% ", +" $!!!#&&&&&'&&&&&##!!!#''&&''&$!!!#########%#########%########% ", +" $!!!$$&&'&&&'&&&'&##!#&&'&&&'$!!!#########%########%#########% ", +" $!!!!!$$&&&&&&'&&&&&##'&&&''&$!!!#########%#######%##########% ", +" $!!!!!!!$$&&&&&&'&&&'&&&''&&'$!!!#########%######%###########% ", +" $!!!!!!!!!$$&&&&&&'&&&&&&&'&&$!!!#########%#####%############% ", +" $#!!!!!!!!!!$$&&'&&&'&&&'&&&'$!!!#########%####%###########%% ", +" %%#!!!!!!!!!!!$$&&&&&&'&&&&&&$!!!#########%###%##########%% ", +" %##!!!!!!!!!!!$$&&'&&&'&&&'$!!!#########%##%#########%% ", +" %%##!!!!!!!!!!!$$&&&&&&'&&$!!!#########%#%########%% ", +" %%##!!!!!!!!!!!$$&&'&&&'$!!!#########%%#######%% ", +" $$!!%%##!!!!!!!!!!!$$&&&&&$!!!#########%######%% ", +" $$!!!!!!%%##!!!!!!!!!!!$$&&'$!!!#########%####%%$ ", +" $$!!!!!!!!!!%%##!!!!!!!!!!!$$&$!!!#########%##%%#%%$$ ", +" $$!!!!!!!!!!!!$#%%##!!!!!!!!!!!&$!!!#########%%%#####%!$$ ", +" $$!!!!!!!!!!!!!$####%%##!!!!!!))!!!!!!#########%########%!!$$ ", +" $$!!!!!!!!!!!!!!$#######%%##!!!!**!!!!!!#########%#########%!!!$$ ", +" $!$$!!!!!!!!!!!!$!!!!!####%%##!!!!!!!!!!#########%#########%!!!!!$$ ", +" $!!!$$!!!!!!!!!!$!!!!!!!!###%%##!!!!!!!!#########%#########%!!!!!!!$$ ", +" $!!!!!$$!!!!!!!!$!!!!!!!!!!###%%##!!!!!!#########%#########%!!!!!!!!!$$ ", +" $!!!!!!!$$!!!!!!$!!!!!!!!!!!!###%%##!!!!########%%#########%!!!!!!!!!!!$% ", +" $!!!!!!!!!$$!!!!!$!!!!!!!!!!!!!###%%##!!######%%##########%!!!!!!!!!!###% ", +" $!!!!!!!!!!!$$!!!%$!!!!!!!!!!!!!####%%######%%############%!!!!!!!!#####% ", +" $!!!))!!!!!!!!$!!!%$!!!!!!!!!!!!!!####%%##%%#############%!!!!!!!#######% ", +" $!!!))!!!!!!!!$!!!!%$$!!!!!!!!!!!!!#####%%##############%!!!!!!!!#######% ", +" $!!!**!!!!!!!!!$$!!!%%$$!!!!!!!!!!!!##################%%!!!!!!!#########% ", +" $!!!!!!!!!!!!!!!!$$!!!%%$$$!!!!!!!!!!###############%%!!!!!!!###########% ", +" $!!!!!!!!!!!!!!!!!!$$!!!%%%$$$$$!!!!!!###########%%%!!!!!!!#############% ", +" $!!!!!!!!!!!!!!!!!!!!$$!!!!%%%%%$$$$$$######%%%%%!!!!!!!!###########%%##% ", +" $!!!!!!!!!!!!!!!!!!!!!!$$!!!!!!!%%%%%%%%%%%%!!!!!!!!!!!###########%%%%##% ", +" $!!!!!!!!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!!!!!#############%%#%##% ", +" $#!!!!!!!!!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!!!!!###############%%#%##% ", +" %%##!!!!!!!!!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!!!!!#################%%%%##% ", +" %%##!!!!!!!!!!!!!!!!!!!!!!!!!$$!!!!!!!!!!!!!!###################%#%%##% ", +" %%##!!!!!!!!!!!!!!!##!!!!!!!!$$!!!!!!!!!!#####################%%%%##% ", +" %%##!!!!!!!!!!!!!$$##!!!!!!!!$$!!!!!!!######################%%####% ", +" %%##!!!!!!!!!!!!!$$##!!!!!!!!$$!!!#############################%% ", +" %%##!!!!!!!!!!!!!$$##!!!!!!!!$#############################%% ", +" %%#!!!!!!!!!!!!!!$$##!!!!!!!###########################%% ", +" %##!!!!!!!!!!!!!!$$##!!!!!#########################%% ", +" %%##!!!!!!!!!!!!!!$$!!!!!#######################%% ", +" %%##!!!!!!!!!!!!!!!!!!!#####################%% ", +" %%##!!!!!!!!!!!!!!!!!###################%% ", +" %%##!!!!!!!!!!!!!!!#################%% ", +" %%##!!!!!!!!!!!!!###############%% ", +" %%##!!!!!!!!!!!#############%% ", +" %%##!!!!!!!!!###########%% ", +" %%##!!!!!!!#########%% ", +" %%##!!!!!#######%% ", +" %%##!!!#####%% ", +" %%##!####% ", +" %%###%% ", +" %%% ", +" ", +" ", +" ", +" ", +" ", +" $$ ", +" $$$$$$ $$ ", +" $$!!(($$$$ $$$$$$ ", +" $$!!!!!!(($$$$ $$!!(($$$$ ", +" $$!!!!!!!!!!(($$$$ $$!!!!!!(($$$$ ", +" $$!!!!!!!!!$$!!!(($$$ $!!!!!!!!!!(($$$$ ", +" $$!!###!!!!!$##$!!!!(($$$ $$!!!!!!!!$$!!!(($$$$ ", +" $!!#######!!!!$$!!!!!!!!!#% $$!!##!!!!!$##$!!!!(($$$$ ", +" %##!!######$$!!!!!!!!!!!##% $!!######!!!!$$!!!!!!!!!!#% ", +" %%##!!%#$$$$$$!!!!!!!!#%% %##!!######!!!!!!!!!!!!!##% ", +" %%##$$%!!($$$$!!!!##% %%##!###%%##!!!!!!!!!##%% ", +" $$!!!!!!(($$$$##%% %%#!!%%##!#!!!!!!##%% ", +" $$!!!!!!!!!!(($$$$ %##!!%%##!!!!##%% ", +" $$!!!!!!!!!$$!!!(($$$$ %%##%%!!!!##%% ", +" $$!!###!!!!!$##$!!!!(($$$ %%##!!%##% ", +" $!!#######!!!!$$!!!!!!!!!!% %%##%% ", +" %##!!#######!!!!!!!!!!!!!#% $$ %% ", +" %%##!!###%%##!!!!!!!!!##% $$$$$$ ", +" %%##!!%##!!#!!!!!!##%% $$!!(($$$$ ", +" %%##!!%##%!!!!##%% $$!!!!!!(($$$ ", +" %%##%%!!!!##%% $$!!!!!!!!!!(($$$ ", +" %%##!!%##% $$!!!!!!!!!$$!!!($$$$ ", +" %%##%% $$!!###!!!!!$##$!!!(($$$$ ", +" %% $!!#######!!!!$$!!!!!!!!!#% ", +" %##!!#######!!!!!!!!!!!!##% ", +" %%##!!###%%##!!!!!!!!##%% ", +" %%##!!%##!!#!!!!!##%% ", +" %%##!!%##%!!!!#%% ", +" %%##%%!!!!##% ", +" %%##!!%##% ", +" %%##%% ", +" %% ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/utils/Install/script/license.txt b/utils/Install/script/license.txt new file mode 100644 index 0000000000..f26969ed51 --- /dev/null +++ b/utils/Install/script/license.txt @@ -0,0 +1,26 @@ +wxWindows Library Licence, Version 3 +==================================== + +Copyright (C) 1998 Julian Smart, Robert Roebling [, ...] + +Everyone is permitted to copy and distribute verbatim copies of this licence document, but changing it is not allowed. + +WXWINDOWS LIBRARY LICENCE + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public Licence as published by the Free Software Foundation; either version 2 of the Licence, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public Licence for more details. + +You should have received a copy of the GNU Library General Public Licence along with this software, usually in a file named COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +EXCEPTION NOTICE + +1. As a special exception, the copyright holders of this library give permission for additional uses of the text contained in this release of the library as licenced under the wxWindows Library Licence, applying either version 3 of the Licence, or (at your option) any later version of the Licence as published by the copyright holders of version 3 of the Licence document. + +2. The exception is that you may use, copy, link, modify and distribute under the user's own terms, binary object code versions of works based on the Library. + +3. If you copy code from files distributed under the terms of the GNU General Public Licence or the GNU Library General Public Licence into a copy of this library, as this licence permits, the exception does not apply to the code that you add in this way. To avoid misleading anyone as to the status of such modified files, you must delete this exception notice from such code and/or adjust the licensing conditions notice accordingly. + +4. If you write modifications of your own for this library, it is your choice whether to permit this exception to apply to your modifications. If you do not wish that, you must delete the exception notice from such code and/or adjust the licensing conditions notice accordingly. diff --git a/utils/Install/script/nocheck.ini b/utils/Install/script/nocheck.ini new file mode 100644 index 0000000000..7223ff2551 --- /dev/null +++ b/utils/Install/script/nocheck.ini @@ -0,0 +1,5 @@ +# ini file that gets called when the license isn't checked. +# +message,"Please accept the license or exit." +setbutton,101,exit +setbutton,103,page2.ini diff --git a/utils/Install/script/page1.ini b/utils/Install/script/page1.ini new file mode 100644 index 0000000000..af901086e1 --- /dev/null +++ b/utils/Install/script/page1.ini @@ -0,0 +1,12 @@ +# Sample ini file for page one +# +closeold +grabfile,install.bmp +loadwxr,page1.wxr +setbutton,101,exit +setbutton,103,page2.ini +disable,button3 +grabfile,license.txt +mleview,textctrl11,license.txt +remove,license.txt +remove,install.bmp \ No newline at end of file diff --git a/utils/Install/script/page1.wxr b/utils/Install/script/page1.wxr new file mode 100644 index 0000000000..5d0fb778eb --- /dev/null +++ b/utils/Install/script/page1.wxr @@ -0,0 +1,27 @@ +static char *dialog1 = "dialog(name = 'dialog1',\ + style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\ + title = 'Installing wxInstall 0.1',\ + id = 100,\ + x = 10, y = 10, width = 264, height = 179,\ + background_colour = 'D4D0C8',\ + use_dialog_units = 1,\ + use_system_defaults = 0,\ + font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg'],\ + control = [101, wxButton, 'Exit Installer', '0', 'button2', 5, 160, 60, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [102, wxButton, '<< Back', 'wxNO_BORDER', 'button3', 165, 160, 44, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [103, wxButton, 'Next >>', '0', 'button4', 209, 160, 44, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [104, wxStaticBitmap, '', 'wxNO_BORDER', 'static5', 9, 8, 60, 144, 'bitmap9',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [105, wxStaticText, 'Welcome to wxInstall 0.1', '0', 'statictext10', 81, 12, 164, 10, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [106, wxTextCtrl, '', 'wxTE_READONLY | wxTE_MULTILINE', 'textctrl11', 80, 32, 168, 99, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [6001, wxCheckBox, 'I accept the terms of this license.', '0', 'checkbox1', 84, 140, 157, 10, 0,\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']])."; + +static char *bitmap9 = "bitmap(name = 'bitmap9',\ + bitmap = ['install.bmp', wxBITMAP_TYPE_BMP, 'ANY'])."; + diff --git a/utils/Install/script/page2.ini b/utils/Install/script/page2.ini new file mode 100644 index 0000000000..63012d61e2 --- /dev/null +++ b/utils/Install/script/page2.ini @@ -0,0 +1,11 @@ +# Sample ini file for page two +# +getcheck,checkbox1,nocheck.ini +closeold +grabfile,install.bmp +loadwxr,page2.wxr +settext,textctrl1 +setbutton,101,exit +setbutton,102,page1.ini +setbutton,103,page3.ini +remove,install.bmp \ No newline at end of file diff --git a/utils/Install/script/page2.wxr b/utils/Install/script/page2.wxr new file mode 100644 index 0000000000..6d3003e0a8 --- /dev/null +++ b/utils/Install/script/page2.wxr @@ -0,0 +1,27 @@ +static char *dialog1 = "dialog(name = 'dialog1',\ + style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\ + title = 'Installing wxInstall 0.1',\ + id = 100,\ + x = 10, y = 10, width = 264, height = 179,\ + background_colour = 'D4D0C8',\ + use_dialog_units = 1,\ + use_system_defaults = 0,\ + font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg'],\ + control = [101, wxButton, 'Exit Installer', '0', 'button2', 5, 160, 60, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [102, wxButton, '<< Back', 'wxNO_BORDER', 'button3', 165, 160, 44, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [103, wxButton, 'Next >>', '0', 'button4', 209, 160, 44, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [104, wxStaticBitmap, '', 'wxNO_BORDER', 'static5', 9, 8, 60, 144, 'bitmap9',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [105, wxStaticText, 'Choose installation directory', '0', 'statictext10', 81, 12, 164, 10, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [106, wxTextCtrl, '', 'wxTE_READONLY | wxTE_MULTILINE', 'textctrl11', 80, 48, 168, 99, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [6002, wxTextCtrl, '', '0', 'textctrl1', 80, 28, 168, 13, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']])."; + +static char *bitmap9 = "bitmap(name = 'bitmap9',\ + bitmap = ['install.bmp', wxBITMAP_TYPE_BMP, 'ANY'])."; + diff --git a/utils/Install/script/page3.ini b/utils/Install/script/page3.ini new file mode 100644 index 0000000000..24ba2fe411 --- /dev/null +++ b/utils/Install/script/page3.ini @@ -0,0 +1,11 @@ +# Sample ini file for page three +# +gettext,textctrl1 +closeold +grabfile,install.bmp +loadwxr,page3.wxr +setbutton,101,exit +setbutton,102,page2.ini +setbutton,103,page4.ini +setbutton,6004,readme.ini +remove,install.bmp \ No newline at end of file diff --git a/utils/Install/script/page3.wxr b/utils/Install/script/page3.wxr new file mode 100644 index 0000000000..aeb885fecc --- /dev/null +++ b/utils/Install/script/page3.wxr @@ -0,0 +1,29 @@ +static char *dialog1 = "dialog(name = 'dialog1',\ + style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\ + title = 'Installing wxInstall 0.1',\ + id = 100,\ + x = 10, y = 10, width = 264, height = 179,\ + background_colour = 'D4D0C8',\ + use_dialog_units = 1,\ + use_system_defaults = 0,\ + font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg'],\ + control = [101, wxButton, 'Exit Installer', '0', 'button2', 5, 160, 60, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [102, wxButton, '<< Back', 'wxNO_BORDER', 'button3', 165, 160, 44, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [103, wxButton, 'Start', '0', 'button4', 209, 160, 44, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [104, wxStaticBitmap, '', 'wxNO_BORDER', 'static5', 9, 8, 60, 144, 'bitmap9',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [105, wxStaticText, 'Ready to begin installation.', '0', 'statictext10', 81, 12, 164, 10, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [6002, wxStaticText, 'Thanks for trying wxInstall. Feel free to contact me at', '0', 'statictext2', 80, 27, 172, 10, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],\ + control = [6003, wxStaticText, 'dbsoft@technologist.com with comments questions or bug reports.', '0', 'statictext3', 80, 36, 181, 6, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [6004, wxButton, 'View Readme', '0', 'button5', 84, 81, 162, 15, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']])."; + +static char *bitmap9 = "bitmap(name = 'bitmap9',\ + bitmap = ['install.bmp', wxBITMAP_TYPE_BMP, 'ANY'])."; + diff --git a/utils/Install/script/page4.ini b/utils/Install/script/page4.ini new file mode 100644 index 0000000000..61417dc75b --- /dev/null +++ b/utils/Install/script/page4.ini @@ -0,0 +1,11 @@ +# Sample ini file for page four +# +remove,readme.txt +closeold +grabfile,install.bmp +loadwxr,page4.wxr +setbutton,101,exit +disable,button3 +disable,button4 +remove,install.bmp +startinst,gauge5,finished.ini \ No newline at end of file diff --git a/utils/Install/script/page4.wxr b/utils/Install/script/page4.wxr new file mode 100644 index 0000000000..c7b59f3d7f --- /dev/null +++ b/utils/Install/script/page4.wxr @@ -0,0 +1,25 @@ +static char *dialog1 = "dialog(name = 'dialog1',\ + style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\ + title = 'Installing wxInstall 0.1',\ + id = 100,\ + x = 10, y = 10, width = 264, height = 179,\ + background_colour = 'D4D0C8',\ + use_dialog_units = 1,\ + use_system_defaults = 0,\ + font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg'],\ + control = [101, wxButton, 'Exit Installer', '0', 'button2', 5, 160, 60, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [102, wxButton, '<< Back', 'wxNO_BORDER', 'button3', 165, 160, 44, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [103, wxButton, 'Next >>', '0', 'button4', 209, 160, 44, 14, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [104, wxStaticBitmap, '', 'wxNO_BORDER', 'static5', 9, 8, 60, 144, 'bitmap9',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [105, wxStaticText, 'Please wait while installing wxInstall...', '0', 'statictext10', 81, 12, 164, 10, '',\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']],\ + control = [6005, wxGauge, '', 'wxGA_HORIZONTAL', 'gauge5', 85, 58, 157, 15, 0, 100,\ + [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Shell Dlg']])."; + +static char *bitmap9 = "bitmap(name = 'bitmap9',\ + bitmap = ['install.bmp', wxBITMAP_TYPE_BMP, 'ANY'])."; + diff --git a/utils/Install/script/readme.ini b/utils/Install/script/readme.ini new file mode 100644 index 0000000000..9dfde93ed7 --- /dev/null +++ b/utils/Install/script/readme.ini @@ -0,0 +1,8 @@ +# Sample ini file for the readme +# +grabfile,readme.txt +system,"notepad readme.txt" +setbutton,101,exit +setbutton,102,page2.ini +setbutton,103,page4.ini +setbutton,6004,readme.ini diff --git a/utils/Install/script/readme.txt b/utils/Install/script/readme.txt new file mode 100644 index 0000000000..6e836c83c5 --- /dev/null +++ b/utils/Install/script/readme.txt @@ -0,0 +1,25 @@ +Ok, this is the first release of wxInstall, my wxWindows port of my +OS/2 installation program. Everything is under the wxWindows license +except for the Infozip code. + +Current Status: + +Archive support: ACE and ZIP. + +Tested platforms: Windows 2000, FreeBSD 4.0 (GTK) + +Todo: + +I need to write a directory browser, since the wxDirCtrl won't work. +I need to add Project support to the wxInstall builder. +Add platform specific code for modifying the startup environment. +--- There is some code for OS/2 (currently unsupported) and Windows --- + +Bugs: + +XPM's crash the installer on Windows. +ZIP archives crash on Windows. + +Thanks! + +You can reach me at dbsoft@technologist.com \ No newline at end of file diff --git a/utils/Install/script/wxinst.cfg b/utils/Install/script/wxinst.cfg new file mode 100644 index 0000000000..0196b54403 --- /dev/null +++ b/utils/Install/script/wxinst.cfg @@ -0,0 +1,62 @@ +# Name of the application being installed +# +INSTALLER_APPLICATION=wxInstall +# +# Version of the application being installed +# +INSTALLER_VERSION=0.1 +# +# What the installer says in the title bar +# +INSTALLER_TITLE=wxInstall Installer +# +# Default install path +# +INSTALLER_PATH=c:\wxInstall +# +# Bitmap Width to avoid sizing problems +# +INSTALLER_BITMAP_WIDTH=100 +# +# Bitmap Height to avoid sizing problems +# +INSTALLER_BITMAP_HEIGHT=275 +# +# Make WPS Program: Title ,Program name, Icon, Destination, ID, setup +# +INSTALLER_PROGRAM=wxInstall,%USERPATH%\wxib.exe,,wxInstall,,,DialogEd,%USERPATH%\dialoged.exe,,wxInstall,, +# +# Make WPS Folder: Folder title, Icon, Destination, ID, setup +# +INSTALLER_FOLDER=wxInstall,,,, +# +# Make WPS Folder: Shadow title, Reference, Destination +# +INSTALLER_SHADOW= +# +# Make a generic object: Title, Class, Destination, ID, setup +# +INSTALLER_OBJECT= +# +# Add SETs to the CONFIG.SYS: Variable, Value, flag +# flag = 1 if the installer should overwrite existing SETs +# flag = 2 if the installer should only create it if it is nonexistant +# +INSTALLER_SETS= +# +# Add System Variables (LIBPATH, PATH, ETC): SysVariable, Value +# +INSTALLER_SYSVAR=LIBPATH,%INSTALLPATH% +# +# Adds a line to the Config.Sys replacing an expandables. +# +INSTALLER_SYSLINE= +# +# Number of packages included in this self extractor. +# +INSTALLER_PACKAGE_COUNT=2 +# +# List of packages. +# +INSTALLER_PACKAGE=misc.ace,Misc. Files +INSTALLER_PACKAGE=wxinst.ace,wxInstall version 0.1 diff --git a/utils/Install/sfxace/globals.c b/utils/Install/sfxace/globals.c new file mode 100644 index 0000000000..fdba0e5509 --- /dev/null +++ b/utils/Install/sfxace/globals.c @@ -0,0 +1,137 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Global variable declarations */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include "os.h" + +#if defined(__CYGWIN__) +#include <Windows32/Base.h> +#endif +#include "acestruc.h" +#include "unace.h" +#include <string.h> +#include <stdio.h> + +//-------- Ace sign +const char *acesign = "**ACE**"; + +//-------- Version string for program +const char *version="UNACE v1.1 public version\n"; + +#ifdef AMIGA +//-------- Version string for VERSION program +static char *_version="$VER: Unace Amiga 1.1 "__AMIGADATE__"\n\n"; +#endif + +//-------- header buffer and pointers +thead head; + +tmhead *t_mhead = (tmhead *) & head; +tfhead *t_fhead = (tfhead *) & head; + +//-------- buffers +ULONG *buf_rd =0; +CHAR *buf =0; +CHAR *buf_wr =0; +UCHAR *readbuf =0; + +//-------- decompressor variables +SHORT rpos =0, + dcpr_do =0, + dcpr_do_max =0, + blocksize =0, + dcpr_dic =0, + dcpr_oldnum =0, + bits_rd =0, + dcpr_frst_file =0; +USHORT dcpr_code_mn[1 << maxwd_mn], + dcpr_code_lg[1 << maxwd_lg]; +UCHAR dcpr_wd_mn[maxcode + 2], + dcpr_wd_lg[maxcode + 2], + wd_svwd[svwd_cnt]; +ULONG dcpr_dpos =0, + cpr_dpos2 =0, + dcpr_dicsiz =0, + dcpr_dican =0, + dcpr_size =0, + dcpr_olddist[4]={0,0,0,0}, + code_rd =0; + +CHAR *dcpr_text =0; + +//-------- quicksort +USHORT sort_org[maxcode + 2]; +UCHAR sort_freq[(maxcode + 2) * 2]; + +//-------- file handling +CHAR aname[PATH_MAX]; +INT archan, + wrhan; +#if !defined(__EMX__) && !defined(__OS2__) +FILE *farchan = NULL; +#endif + +LONG skipsize=0; + +//-------- structures for archive handling +struct tadat adat; + +//-------- flags +INT f_err =0, + f_ovrall =0, + f_allvol_pr=0, + f_curpas =0, + f_criterr =0; + + +void resetglobals(void) +{ + t_mhead = (tmhead *) & head; + t_fhead = (tfhead *) & head; + + buf_rd =0; + buf =0; + buf_wr =0; + readbuf =0; + + rpos =0; + dcpr_do =0; + dcpr_do_max =0; + blocksize =0; + dcpr_dic =0; + dcpr_oldnum =0; + bits_rd =0; + dcpr_frst_file =0; + + memset(&dcpr_code_mn, 0, sizeof(dcpr_code_mn)); + memset(&dcpr_code_lg, 0, sizeof(dcpr_code_lg)); + memset(&dcpr_wd_mn, 0, sizeof(dcpr_wd_mn)); + memset(&dcpr_wd_lg, 0, sizeof(dcpr_wd_lg)); + memset(&wd_svwd, 0, sizeof(wd_svwd)); + dcpr_dpos =0; + cpr_dpos2 =0; + dcpr_dicsiz =0; + dcpr_dican =0; + dcpr_size =0; + + memset(&dcpr_olddist, 0, sizeof(dcpr_olddist)); + + code_rd =0; + dcpr_text =0; + + memset(&sort_org, 0, sizeof(sort_org)); + memset(&sort_freq, 0, sizeof(sort_freq)); + + archan=0; + wrhan=0; + skipsize=0; + + f_err =0; + f_ovrall =0; + f_allvol_pr=0; + f_curpas =0; + f_criterr =0; + +} diff --git a/utils/Install/sfxace/install.PRJ b/utils/Install/sfxace/install.PRJ new file mode 100644 index 0000000000..73d30d6ad9 --- /dev/null +++ b/utils/Install/sfxace/install.PRJ @@ -0,0 +1,50 @@ +[Project ID] +Signature=UE Proj: v.1 +[Files] +0=C:\Program Files\wx2\samples\Install\install.c +1=C:\Program Files\wx2\samples\Install\install.h +2=C:\Program Files\wx2\samples\Install\instsup.c +3=C:\Program Files\wx2\samples\Install\makefile +4=C:\Program Files\wx2\samples\Install\wxmain.cpp +[Open Files] +Open File0=C:\Program Files\wx2\samples\Install\makefile +Open File Pos0=2487 +Open File Line0=1545 +Open File Window Pos0=0,1,0,0,-4,-23,22,22,646,423 +Open File1=C:\Program Files\wx2\samples\Install\wxmain.cpp +Open File Pos1=2953 +Open File Line1=0 +Open File Window Pos1=0,1,0,0,-4,-23,110,110,734,511 +Open File2=C:\Program Files\wx2\samples\Install\install.c +Open File Pos2=9875 +Open File Line2=9111 +Open File Window Pos2=0,1,0,0,-4,-23,176,176,800,577 +Open File3=C:\insttmp\winbitchx.cfg +Open File Pos3=229 +Open File Line3=0 +Open File Window Pos3=0,1,0,0,-4,-23,0,0,612,364 +Open File4=C:\Program Files\wx2\samples\Install\instsup.cpp +Open File Pos4=2 +Open File Line4=0 +Open File Window Pos4=0,1,0,0,-4,-23,154,154,788,507 +Open File5=C:\Program Files\wx2\samples\controls\controls.cpp +Open File Pos5=34608 +Open File Line5=34168 +Open File Window Pos5=2,3,0,0,-4,-23,88,88,722,437 +Open File6= +Open File Pos6=203 +Open File Line6=0 +Open File Window Pos6=0,1,0,0,-4,-23,154,154,788,502 +Open File7=C:\Program Files\wx2\src\makeg95.env +Open File Pos7=357 +Open File Line7=0 +Open File Window Pos7=0,1,0,0,-4,-23,0,0,634,348 +Open File8=c:\error.log +Open File Pos8=0 +Open File Line8=0 +Active File Index=5 +Open File Window Pos8=2,3,0,0,-4,-23,22,22,656,370 +Open File9= +Active File Display Mode=3 +[File View] +Current Select=Open Files\ diff --git a/utils/Install/sfxace/install.def b/utils/Install/sfxace/install.def new file mode 100644 index 0000000000..40e70d64c5 --- /dev/null +++ b/utils/Install/sfxace/install.def @@ -0,0 +1,3 @@ +NAME INSTALL WINDOWAPI +DESCRIPTION "Self extracting Installer (C)'99-00 Brian Smith" +STACKSIZE 51200 diff --git a/utils/Install/sfxace/install.rc b/utils/Install/sfxace/install.rc new file mode 100644 index 0000000000..82bdf07561 --- /dev/null +++ b/utils/Install/sfxace/install.rc @@ -0,0 +1,2 @@ +#include "wx/msw/wx.rc" + diff --git a/utils/Install/sfxace/makefile b/utils/Install/sfxace/makefile new file mode 100644 index 0000000000..429b74e760 --- /dev/null +++ b/utils/Install/sfxace/makefile @@ -0,0 +1,47 @@ +# Installer Makefile + +CC = gcc +RM = rm -f +RC = windres + + +DEFS = +LIBS = -lwx_gtk -lpng -ljpeg -lstdc++ -lgcc -lc_r -lgtk -lgdk -lgmodule -lglib -lXext -lX11 -lm -lgthread + +CFLAGS = -g -I.. -I../incace -I/usr/local//include -I/usr/X11R6/include -I/usr/local/lib/glib/include -DSTRICT -D__WXGTK__ -DGTK_NO_CHECK_CASTS -D_REENTRANT -D_IODBC_ -Wall +LDFLAGS = -L/usr/local/lib -L/usr/X11R6/lib -L/usr + +OBJECTS = globals.o install.o uac_comm.o uac_crc.o instsup.o \ + uac_crt.o uac_dcpr.o uac_sys.o unace.o wxmain.o + +SOURCES = globals.c ../install.c uac_comm.c uac_crc.c ../instsup.cpp \ + uac_crt.c uac_dcpr.c uac_sys.c unace.c ../wxmain.cpp + +all: sfx + +$(OBJECTS): + $(CC) $(CFLAGS) -c $< + +packinst: packinst/Makefile Makefile + @cd packinst + $(MAKE) -f Makefile all + +sfx: $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -o sfx $(OBJECTS) $(LIBS) + +clean: + $(RM) $(OBJECTS) install sfx *~ + +globals.o: globals.c ../incace/globals.h ../incace/acestruc.h ../incace/unace.h +install.o: ../install.c ../install.h ../instsup.h +instsup.o: ../instsup.cpp +uac_comm.o: uac_comm.c ../incace/globals.h ../incace/uac_dcpr.h ../incace/uac_comm.h +uac_crc.o: uac_crc.c ../incace/uac_crc.h +uac_crt.o: uac_crt.c ../incace/os.h ../incace/attribs.h ../incace/globals.h ../incace/uac_crt.h ../incace/uac_sys.h +uac_dcpr.o: uac_dcpr.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h +uac_sys.o: uac_sys.c ../incace/os.h ../incace/globals.h ../incace/uac_sys.h +unace.o: unace.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h ../incace/uac_crt.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h +wxmain.o: ../wxmain.cpp + diff --git a/utils/Install/sfxace/makefile.b32 b/utils/Install/sfxace/makefile.b32 new file mode 100644 index 0000000000..f324d3be90 --- /dev/null +++ b/utils/Install/sfxace/makefile.b32 @@ -0,0 +1,76 @@ +# +# File: makefile.b32 +# Author: Julian Smart +# Created: 1999 +# Updated: +# Copyright: +# +# Makefile : Builds sample for 32-bit BC++ + +WXDIR = $(WXWIN) + +EXTRACPPFLAGS = /I"..\incace" /I".." +TARGET=sfx +OBJECTS = wxmain.obj instsup.obj install.obj globals.obj uac_comm.obj uac_crc.obj uac_crt.obj uac_dcpr.obj uac_sys.obj unace.obj + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makeb32.env + +LIBS=$(WXLIB) $(EXTRALIBS) cw32mt import32 ole2w32 winpng zlib jpeg xpm tiff odbc32 + +# Note: you may need to remove some libraries for earlier versions of BC++, as below +#LIBS=$(WXLIB) $(EXTRALIBS) cw32mt import32 ole2w32 winpng zlib xpm tiff + +!if "$(FINAL)" == "0" +#LINKFLAGS=/v /c /Tpe $(LNKCFG) $(EXTRALINKFLAGS) +LINKFLAGS=/v /c /aa -L$(WXLIBDIR);$(WXLIBDIR2);$(BCCDIR)\lib;$(BCCDIR)\lib\psdk $(EXTRALINKFLAGS) +OPT = -Od +DEBUG_FLAGS= -v +!else +#LINKFLAGS=/Tpe +$(LNKCFG) $(EXTRALINKFLAGS) +LINKFLAGS=/aa -L$(WXLIBDIR);$(WXLIBDIR2);$(BCCDIR)\lib;$(BCCDIR)\lib\psdk $(EXTRALINKFLAGS) +OPT = -O2 +DEBUG_FLAGS = +!endif + +CPPFLAGS=$(DEBUG_FLAGS) $(EXTRACPPFLAGS) $(OPT) @$(CFG) + +all: $(TARGET).exe $(EXTRATARGETS) + +$(TARGET).exe: $(OBJECTS) $(TARGET).res + $(LINK) $(LINKFLAGS) @&&! +c0w32.obj $(OBJECTS) +$(TARGET) +nul +$(LIBS) + +$(TARGET).res +! + +.$(SRCSUFF).obj: + bcc32 $(CPPFLAGS) -c {$< } + +install.obj: ..\install.c + bcc32 $(CPPFLAGS) -P- -c ..\install.c + +wxmain.obj: ..\wxmain.cpp + bcc32 $(CPPFLAGS) -P- -c ..\wxmain.cpp + +instsup.obj: ..\instsup.cpp + bcc32 $(CPPFLAGS) -P- -c ..\instsup.cpp + +.c.obj: + bcc32 $(CPPFLAGS) -P- -c {$< } + +$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc + brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include /i$(WXDIR)\contrib\include $(TARGET) + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws + -erase *.tds + -erase *.il? + diff --git a/utils/Install/sfxace/makefile.g95 b/utils/Install/sfxace/makefile.g95 new file mode 100644 index 0000000000..2853f46219 --- /dev/null +++ b/utils/Install/sfxace/makefile.g95 @@ -0,0 +1,53 @@ +# Installer Makefile + +CC = gcc +RM = rm -f +RC = windres + + +DEFS = +LIBS = ../../../lib/libwx.a -lpng -ljpeg -lzlib -lxpm -lstdc++ -lgcc -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lole32 -loleaut32 -luuid -lodbc32 -lwsock32 + +#CFLAGS = -I./include -mno-cygwin -D_X86_=1 -DWIN32 -D_WIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -I../../include -I../../src/png -I../../src/jpeg -I../../src/zlib -I../../include/wx/msw/gnuwin32 -DSTRICT -D__WXMSW__ -D__WINDOWS__ -D__WXDEBUG__ -Wall -fno-pcc-struct-return -O2 -fno-rtti -fno-exceptions +#LDFLAGS = -mno-cygwin -Wl,--subsystem,windows -mwindows -L../../lib +CFLAGS = -g -I../incace -I.. -D_X86_=1 -DWIN32 -D_WIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -I../../../include -I../../../src/png -I../../../src/jpeg -I../../../src/zlib -I../../../include/wx/msw/gnuwin32 -DSTRICT -D__WXMSW__ -D__WINDOWS__ -D__WXDEBUG__ -Wall -fno-pcc-struct-return -O2 -fno-rtti -fno-exceptions +LDFLAGS = -Wl,--subsystem,windows -mwindows -L../../../lib + +OBJECTS = globals.o install.o uac_comm.o uac_crc.o instsup.o \ + uac_crt.o uac_dcpr.o uac_sys.o unace.o wxmain.o instres.o + +SOURCES = globals.c ../install.c uac_comm.c uac_crc.c ../instsup.cpp \ + uac_crt.c uac_dcpr.c uac_sys.c unace.c ../wxmain.cpp + +#all: sfx.exe packinst +all: sfx.exe + +$(OBJECTS): + $(CC) $(CFLAGS) -c $< + +packinst: packinst/Makefile Makefile + @cd packinst + $(MAKE) -f Makefile all + +sfx.exe: $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -o sfx.exe $(OBJECTS) $(LIBS) + +clean: + $(RM) $(OBJECTS) install.exe install.res sfx.exe + +instres.o: install.rc + $(RC) install.rc instres.o --include-dir ../../../include + +globals.o: globals.c ../incace/globals.h ../incace/acestruc.h ../incace/unace.h +install.o: ../install.c ../install.h ../instsup.h +instsup.o: ../instsup.cpp +uac_comm.o: uac_comm.c ../incace/globals.h ../incace/uac_dcpr.h ../incace/uac_comm.h +uac_crc.o: uac_crc.c ../incace/uac_crc.h +uac_crt.o: uac_crt.c ../incace/os.h ../incace/attribs.h ../incace/globals.h ../incace/uac_crt.h ../incace/uac_sys.h +uac_dcpr.o: uac_dcpr.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h +uac_sys.o: uac_sys.c ../incace/os.h ../incace/globals.h ../incace/uac_sys.h +unace.o: unace.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h ../incace/uac_crt.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h +wxmain.o: ../wxmain.cpp + diff --git a/utils/Install/sfxace/makefile.gcc b/utils/Install/sfxace/makefile.gcc new file mode 100644 index 0000000000..429b74e760 --- /dev/null +++ b/utils/Install/sfxace/makefile.gcc @@ -0,0 +1,47 @@ +# Installer Makefile + +CC = gcc +RM = rm -f +RC = windres + + +DEFS = +LIBS = -lwx_gtk -lpng -ljpeg -lstdc++ -lgcc -lc_r -lgtk -lgdk -lgmodule -lglib -lXext -lX11 -lm -lgthread + +CFLAGS = -g -I.. -I../incace -I/usr/local//include -I/usr/X11R6/include -I/usr/local/lib/glib/include -DSTRICT -D__WXGTK__ -DGTK_NO_CHECK_CASTS -D_REENTRANT -D_IODBC_ -Wall +LDFLAGS = -L/usr/local/lib -L/usr/X11R6/lib -L/usr + +OBJECTS = globals.o install.o uac_comm.o uac_crc.o instsup.o \ + uac_crt.o uac_dcpr.o uac_sys.o unace.o wxmain.o + +SOURCES = globals.c ../install.c uac_comm.c uac_crc.c ../instsup.cpp \ + uac_crt.c uac_dcpr.c uac_sys.c unace.c ../wxmain.cpp + +all: sfx + +$(OBJECTS): + $(CC) $(CFLAGS) -c $< + +packinst: packinst/Makefile Makefile + @cd packinst + $(MAKE) -f Makefile all + +sfx: $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -o sfx $(OBJECTS) $(LIBS) + +clean: + $(RM) $(OBJECTS) install sfx *~ + +globals.o: globals.c ../incace/globals.h ../incace/acestruc.h ../incace/unace.h +install.o: ../install.c ../install.h ../instsup.h +instsup.o: ../instsup.cpp +uac_comm.o: uac_comm.c ../incace/globals.h ../incace/uac_dcpr.h ../incace/uac_comm.h +uac_crc.o: uac_crc.c ../incace/uac_crc.h +uac_crt.o: uac_crt.c ../incace/os.h ../incace/attribs.h ../incace/globals.h ../incace/uac_crt.h ../incace/uac_sys.h +uac_dcpr.o: uac_dcpr.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h +uac_sys.o: uac_sys.c ../incace/os.h ../incace/globals.h ../incace/uac_sys.h +unace.o: unace.c ../incace/os.h ../incace/globals.h ../incace/portable.h ../incace/uac_comm.h ../incace/uac_crc.h ../incace/uac_crt.h \ + ../incace/uac_dcpr.h ../incace/uac_sys.h +wxmain.o: ../wxmain.cpp + diff --git a/utils/Install/sfxace/sfx.RES b/utils/Install/sfxace/sfx.RES new file mode 100644 index 0000000000000000000000000000000000000000..09bcebd7887a75a6a5d6fa5fb08771241e46bbfb GIT binary patch literal 13744 zcmeHNO^jT{5w16H?6>}rXN@9^1z|=U5XVJ9(JBUJY%gA0F}AVS;pgH-kRKEWhM#B_ zZ2VqGBqL=d!_iWN$=}5%q~u`9Nc%)0#fO#5DdGg9L<*eZL5{>YjHmN`)!j31o@Zxm zyvBmiyEU(?yQ;dos;jzQ&xnXr0LEBAb)eh^Yzkn^DtS~Mll}6L9FSe|1fE-Eo9xDO z3iwvk_R4gRcVc`^(Ibg0y6RnWtGprKci04;_XE7_?U1rhW*}{^>=`0;Q0BSBipk2H zlAp`Z@b@y-^t3!9Ps(9=PJRqRuA>I<W9`8h*D@Yh697tfJdr=6WfEXaQT6jEX3x3r z1@<s>vquh+NlSMAY<NTN2Guk2Eav*0G?eCdrMoe&C*?(X3ZGBQ54H8Tr5Vs2237&j zPEfx9{1rT(m6vpthp}dsKMqj-030uX;u)287!oWMtu69<jI|a0FF?Yx&=RHZ0wtxs zi2g+W0E#_mpMwmM`vSjL0<0GZ%6P`k>tvPOgSHBw1_<z{#XT(2|1@?Q{f1$+s3}4y zwM5Eokt(4h5(7*}f{y^FP`~}KgIQ~A8axX?hZW3WbZM20Av7an($JWM5Mbtk=>jmi zLbrytlz{&9lrevS*erZJe3)-xQj-8<*6aS+j{UM99<~>shhXWgx|{6G2lr0_+O0s( z)G{q&KPxJW_9-Y+);=XEt-O8g)L^4jWc@5Rgh*vf<f(a)9e+jen6gjeY-c~|NPiV& zsMcC#=ot1m@lRu_mrOVAm`?k__|nBw)k_yHR4;z?*{O^CTll;W#L>=v(vhBg<X1VA zN4dE|`_ur#?XwNm+Ks;h@bt$4wv4t@A?HV-GG*-qCEYkXxjAMZi9_fv_W`~K_%>ie z0yEV_!nd)z-bceH00sgQYyy-3s{trEwOtc>0@TpH2?6jRlK|2fE?2cCX~X?GAn0B} z0HPL%VM5x;o+ZQlXrD&n?TBu>b+#g-Z4~BgR8+34jn>MV8)%~mjJFf;Ius9oDO5!M zQ<HEkks>^O%)vM!bQXMj5w0Ju2YU;UDbUnamh+%H4xrMh{IW4)Rm8d2w4v{daGQ(2 zG3Mj9V)L)n7FcH+``Vv^g|-4~w$Mh1221$T!-#d$h<3YV2jC&ZKVL@Ms+hCYDrL*s zYDME-)Wo?0PpM!}Z2yPI{6?6lk_45hq)?f!6}H||D{Q-~R+!pWE9`u&R=BrV3+^f= zK@rBAzZX33SzgMZtR+fTZv*vqIdc}lTf!zxl*Zk15_ift86R9<?c9GywKI8twKH+F z+L3m(8?@tY*osY<+Ovyi6wfotTB6WaHNfz=$L#5l`qT{U^tfBYXgjUS*~tcuterNj z)cM4a8YPHNsYtmAX8`UX2n!O1p+sSrV0)$n*4f5BPp41vQU+y_e@MAPec1n|9V0GP zq2sa}0i&R;JNL5b%*~nh+*}OTtTyfJ%B-`EeWX!-of-HjgR&@-vU6p0+_RZFGg6<K zkG9e3oQ)z~an?p6cU)K8OCWI;FbTL5P-;TGU8vWzkV)xFND`brodyRF))3}q0sDZz zkB#^S$SX+vQk#k=Kx=>sU>tA<;8wsoz^X)~kRo`_0>P%gxn;DC_QRK$L-ZrwXd6X2 z8;xO!Oso3uTjO8AkAhYy2~K>PNX)D@PQr!DY1Aq;OXn}P$_tm<w;%cNg9k4!9DU&P zkKQF5=~O>FVoVQyYT~~iF)?rp519B}!go!4xEvpAmls}bm(IV~qRepN)s$oCSQwLI zBZEh*>O&j80l(1gkz#ug5*XBjEK@ukpQ+<-VyjUmWoO4?eYA}p#o082_p+Vh%V-;o z<!rP@*|IiTi<gso&{_f104wsYbP$p}#7(#gfW_C#iOtt=bjeac`X$OJFX~De-ivrO z3KGyXW1F)vZyN^4<(4X=ZL|-!5&MykALv<Ww2ju}Y_wKaowX5T$%@;^>vjVw!CMGh zhY|^^smv{;atyI80<-}Jcok{z36n&hAwX8KYp<d#rMrH6*hZ+GHBFrDgcOhfqz@QP z(9|oa&$cCK>pNFp(9qg)He#IH0blZEw2jv0Y{b|;80*S6(neAjc{!2bzmpPnQVB2L zDPi{*pb01gH#oO=1Mq2A;tNfUDt=)jo<kLvX)NQ!S`9x!xN;EU8DvewdJG8sFvz9? zxOdq!nRt&b%h_l@^6zPQk+;%l8?DRPh%X+4HX?rAeiWs6@u>^~+gLtMMb1?uAiQ3Y zkT6z}>EgKjs4ynSf}+H&*CZ}(9e`uNkN)x(GFK}|y;79f@iD25A(x1nNH=n&T}8Yq z4+7fwdep_c5#wKH+`{BU*^C2Z4mLar8?J`^BG@lXt^~MUkOWB0LlZS4Q^H+Sxm{l7 zefANYNBi-|TSi+(+h~2xM#Ey=3fRca<;!}Qn_Ncw5%0!%d*^Svm%DRVE1%%?qXOmO zr4A6N8nfropbzl?N1O)F@RHado+KK}`H3nZku*)gf)K(ef)iUG_(T;z%#{f7FIyTp zJl9{!;bs7jN&|SK0ld-h;vxD3an}&Z7-o`4!w-2vZQVwLa#$2^MUfJ~30-L^0g?8i z5|JP#-dQ})N2^hfw8P<$5V76UV-j<U`;Vj%+v=iyw0gLTfk5A{^85I_WpMrT=llff zDt~dYy{H69UB?Gv@kn%j=u@1>J_ndT(OEo)XA3wPz^w~Zb&$Xoc7wo94OGrz4cpM} z>zk7}-b29x-8*93?4a{+BmiKrE}#uab&FJyA25Gr9?g6@Y~t)m0SQJXEK#_jNy9uo zN^Ne>9G{s@40+gjyqCzvz72XOz6+T*zY#hlk08I}_fP&iB1l9TjD5_cE0rQXZ&Qy7 za(-nU=H~bnmE0?sd9Th&T_$un_5-Bh*-S|qjV&4U?3ri~KkM-`@@u7w>X!Z;Sx5X# zRJZaR{!T+I?&uTj1<OF{vuEkMTeRlcVL9Sw#`p<#hyO`i$!;0m5%ycx--24g`CxSR zlXQY&mEGdVvO(l_BDxg!k;CDRT^ZQ#*n7BV=L|TWXLn2JvD*>*><;g<TZTTn;u&^j z=#B1{l<3-suxvSFpZ+uaj;~>#hb`+Xc|Xbe2H$n*A5qi#h<@`0zB2gfD^>Uk{RMC8 zg1m!%!<!R80{<bT^i@E!r2b@Z^=I1IJMz3=@%?tc-o5s3ik9=MLe8)31=-E<D?!Nw zFrv=2SY?Tx-?(w(re27PHf}z7^5mNveZ%v>SU^GQV6$SN*rY+xqi7%=xL!UsfngA@ z3&>9?$t7iAw?XyfDT9wqb>OEAtN7-E0<<4h+qkK*8C|SvH%2551ceocgFt0^oCNG% z3eVGn+{vqN1{b>hc$}Zs**0Xpy4?PH#$|B5dHqnG5aSETmBHa}63ysayZamt6>;`b zYRdw9y58Q|l&DW+&!(sep9A>wX}L3sqP;I>&#DMAN`T&Z#apuMc{K?}WAc8*J3VIU zOMRD-KdZu=PZc3`@LlSg9PnClK<;rAp96M~Gco7N<baxj^>RQEI0l;odfexL9``xl zHR2$*@>@0s)Uo*Ca=;$$azHb$DW5^mw>hliZvjVmXNIWqxJhi1*h>*X@RiR2@58FD z^eKLuu>(G3%jn#%nDeJq%5*c&C^v2Q@W+os@hal-AluNWW2g2xB7J4*<BfW^n;~E~ z_qr!wcZR@r_X(6+N?roGK@8kUi0TlAFQDlyDiPgXI8wKJ!4AOvH}-mhPi{vk{kzw% z1iC+wsiFTfWr!gj>EDL#1-m2=tUD_pu-(|e=tk~X@+*!k9@*jWc?9f89eX(PM$q?h zbTaqs^<OWZm#>L!U%Xs_4~*WMhE|w=X&%NOHKb*@Jd6b=?&6(?H;8a?>M?F2za#j1 ziZjRKq#-SN^z6~P{T&j|BM;h_K)-|(<KX*4-c=0uC%#MVL$58P{b`l_1g}rKLCW73 z@%MoI?cV`pkM@^<hwwazx3d}dzP1g$Gx!}Gf7j>aOaFT+f0k9y6^K3S<QnfYc$dLD z4a`XYF|jM|GwQh#<w~x*p6iaj=^xa<S4}@>usbHWL$GJL+qdIRjyv_?-mYZ-;J)My zDZ%eczkkt`D+?m{mxTrUz$dDD$F|(QY}E0R0@eoKUGS{)t;I^WQ5=Z&;}BpJwAA_p zsXiO7UHP)>+^%`&0r=+NN^izGdlR>pbyz1>%=vr3^0e-suHDn2SJ&&`@M_4=Z7eIm zg8bd_3|4s%_0el(47>&4ZTbP~zKo+nu;n^z3M1Kq^-bsNznVHuo3edwy0Me>Db!!W z|8dlJqJw?Yq}ho!^0WTZ6q{`wk9yRvztXQ`!vY~aNKU`qr&-&l(LLwq01DDiPlG`V ze%{CVxO#T})cGWoLm%qvd<tg(@8w4O($_}sS-sGAy&g0A&FVdCk4DB$-hNl3_s53n zoxdyJeN}p=?)`pmx!ujj4cqT4pclLEuESTppns@6-29jFgW>kzZw~l-?dAR8%eP0y z_cMDiyEn6YwvpM(gR$Z|?C}NtM(yF|toF#-)yW(lm!7~W|Nj%0U}5Z9jr-IPK<hXS z>hiYM>!(jg1lvv;+pdww)8pmS%DI}jw3OcMS-iX-d=1WFjTBDT8NE~I4d|Y_9?&~< PPVc(HPCYqSqxb&-^+!7H literal 0 HcmV?d00001 diff --git a/utils/Install/sfxace/sfx.rc b/utils/Install/sfxace/sfx.rc new file mode 100644 index 0000000000..82bdf07561 --- /dev/null +++ b/utils/Install/sfxace/sfx.rc @@ -0,0 +1,2 @@ +#include "wx/msw/wx.rc" + diff --git a/utils/Install/sfxace/uac_comm.c b/utils/Install/sfxace/uac_comm.c new file mode 100644 index 0000000000..bcea08f4c8 --- /dev/null +++ b/utils/Install/sfxace/uac_comm.c @@ -0,0 +1,51 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Decompresses and outputs comment if present. */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include <stdio.h> // printf() + +#include "globals.h" +#include "uac_dcpr.h" +#include "uac_comm.h" + +INT comm_cpr_size=0; +CHAR *comm; + +void comment_out(CHAR *top) // outputs comment if present +{ + INT i; + + if (head.HEAD_FLAGS & ACE_COMM) + { // comment present? + if (head.HEAD_TYPE == MAIN_BLK) + { // get begin and size of comment data + comm = (CHAR*)MCOMM; + comm_cpr_size = MCOMM_SIZE; + } + else + { + comm = (CHAR*)FCOMM; + comm_cpr_size = FCOMM_SIZE; + } // limit comment size if too big + i = sizeof(head) - (INT)(comm - (CHAR*) &head); + if (comm_cpr_size > i) + comm_cpr_size = i; + dcpr_comm(i); // decompress comment + +#ifdef AMIGA + { + char *p=comm; + while (*p) + { + if (*p==0x0D) + *p=0x0A; // Replace ms-dos line termination + p++; + } + } +#endif + + pipeit("%s\n\n%s\n\n", top, comm); // output comment + } +} diff --git a/utils/Install/sfxace/uac_crc.c b/utils/Install/sfxace/uac_crc.c new file mode 100644 index 0000000000..3d9335ec72 --- /dev/null +++ b/utils/Install/sfxace/uac_crc.c @@ -0,0 +1,36 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* CRC-calculation routines. */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include "uac_crc.h" + + +ULONG crctable[256]; +ULONG rd_crc=0; + + +void make_crctable(void) // initializes CRC table +{ + ULONG r, + i, + j; + + for (i = 0; i <= 255; i++) + { + for (r = i, j = 8; j; j--) + r = (r & 1) ? (r >> 1) ^ CRCPOLY : (r >> 1); + crctable[i] = r; + } +} + +// Updates crc from addr till addr+len-1 +// +ULONG getcrc(ULONG crc, UCHAR * addr, INT len) +{ + while (len--) + crc = crctable[(unsigned char) crc ^ (*addr++)] ^ (crc >> 8); + return (crc); +} + diff --git a/utils/Install/sfxace/uac_crt.c b/utils/Install/sfxace/uac_crt.c new file mode 100644 index 0000000000..6a6acdb792 --- /dev/null +++ b/utils/Install/sfxace/uac_crt.c @@ -0,0 +1,303 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Creates/Replaces files or directories. */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include "os.h" + +#ifdef __EMX__ +#include <sys/types.h> +#include <sys/dirent.h> +#include <stdlib.h> +#endif +#include <fcntl.h> +#include <stdio.h> // printf() remove() +#include <string.h> // strncpy() +#include <sys/types.h> +#include <sys/stat.h> // struct stat +#include <time.h> +#include "install.h" + +#if defined(DOS) || defined(WINNT) || defined(WIN16) + #include <io.h> // access() +#endif +#if defined(__CYGWIN__) +#include <Windows32/Base.h> +#endif + +#include "attribs.h" +#include "globals.h" +#include "uac_crt.h" +#include "uac_sys.h" + +#ifdef ENABLE_LOGGING +extern FILE *logfile; +#endif +extern char installdir[400]; + +/* Undocumented functions */ +#if defined(__OS2__) || defined(__EMX__) +APIRET APIENTRY DosReplaceModule(PSZ pszOldModule,PSZ pszNewModule,PSZ pszBackupModule); +#endif + + +/* gets file name from header + */ +CHAR *ace_fname(CHAR * s, thead * head, INT nopath) +{ + INT i; + char *cp; + + strncpy(s, (CHAR*)(*(tfhead *) head).FNAME, i = (*(tfhead *) head).FNAME_SIZE); + s[i] = 0; + + if (nopath) + { + cp=strrchr(s, '\\'); + if (cp) + memmove(s, cp+1, strlen(cp)); + } +#ifdef __UNIX__ + else + { // by current OS seperator + cp=s; + while ((cp=strchr(cp, '\\'))!=NULL) + *cp++='/'; + } +#endif + + return s; +} + +void check_ext_dir(CHAR * f) // checks/creates path of file +{ + char d[1024]; + char buffer[1024]; + int z, flag = 0, len = strlen(f); + + strcpy(buffer, f); + for(z=len;z>-1;z--) + { + if(buffer[z] == '\\') + { + buffer[z+1] = 0; + flag = 1; + z = -1; + } + } + if(!flag) + return; + for(z=0;z<strlen(buffer);z++) + { + if(buffer[z] == '\\') + { + if(!(z == 2 && buffer[1] == ':')) + { + strcpy(d, buffer); + d[z] = 0; + if (!fileexists(d)) + { +#if (defined(__OS2__) && !defined(__EMX__)) || (defined(WINNT) && !defined(__CYGWIN__)) + if (mkdir(d)) +#else + if (mkdir(d, 0)) +#endif + + { +#if 0 + f_err = ERR_WRITE; + error("Error while creating directory \"%s\".", d); + } + else +#else + } +#endif + { +#ifdef ENABLE_LOGGING + if(logfile) + { + if(strlen(d) > 1 && d[1] == ':') + fprintf(logfile, "<NewDir>,%s\r\n", d); + else + { + if(installdir[strlen(installdir)-1] == '\\') + fprintf(logfile, "<NewDir>,%s%s\r\n", installdir, d); + else + fprintf(logfile, "<NewDir>,%s\\%s\r\n", installdir, d); + } + } +#endif + } + } + } + } + + } +} + +INT ovr_delete(CHAR * n) // deletes directory or file +{ + if (remove(n) && rmdir(n)) + { +#if defined(__OS2__) || defined(__EMX__) + DosReplaceModule(n, NULL, NULL); +#endif + if (remove(n) && rmdir(n)) + { + error("Could not delete file or directory: \"%s\" Access denied.", n); + return (1); + } + } + return (0); +} + +INT create_dest_file(CHAR * file, INT a) // creates file or directory +{ + INT han, + i = 0, + ex = fileexists(file); + struct stat st; + extern int no_update; + + check_ext_dir(file); + if (f_err) + return (-1); + if (a & _A_SUBDIR) + { // create dir or file? + if (ex) + { + stat(file, &st); + } + +#if (defined(__OS2__) && !defined(__EMX__)) || (!defined(__CYGWIN__) && defined(WINNT)) + if ((!ex && mkdir(file)) || (ex && (st.st_mode & S_IFDIR))) +#else + if ((!ex && mkdir(file, 0)) || (ex && (st.st_mode & S_IFDIR))) +#endif + { + error("Could not create directory %s."); + return (-1); + } + else + { /* I wonder why it never gets here... :/ BS */ +#ifdef ENABLE_LOGGIN + if(logfile) + fprintf(logfile, "<NewDir>,%s\\%s\r\n", installdir, file); +#endif + } + +#ifdef DOS + _dos_setfileattr(file, a); // set directory attributes +#endif + return (-1); + } + else + { + if (ex) + { // does the file already exist +#if defined(__OS2_) || defined(__EMX__) + static int sddall = 0; + FILESTATUS3 fileinfo; + + f_ovrall = 1; + + DosQueryPathInfo(file, FIL_STANDARD, &fileinfo, sizeof(FILESTATUS3)); + if(!sddall) + { + FDATE fdate; + FTIME ftime; + struct tm tc, tc2; + time_t tt, tt2; + + *((USHORT*)&fdate) = (USHORT)(fhead.FTIME >> 16); + *((USHORT*)&ftime) = (USHORT)fhead.FTIME; + + tc.tm_year = fileinfo.fdateLastWrite.year + 80; + tc.tm_mon = fileinfo.fdateLastWrite.month - 1; + tc.tm_mday = fileinfo.fdateLastWrite.day; + tc.tm_hour = fileinfo.ftimeLastWrite.hours; + tc.tm_min = fileinfo.ftimeLastWrite.minutes; + tc.tm_sec = fileinfo.ftimeLastWrite.twosecs * 2; + + tc2.tm_year = fdate.year + 80; + tc2.tm_mon = fdate.month - 1; + tc2.tm_mday = fdate.day; + tc2.tm_hour = ftime.hours; + tc2.tm_min = ftime.minutes; + tc2.tm_sec = ftime.twosecs * 2; + + if((tt = mktime(&tc)) == -1 || (tt2 = mktime(&tc2)) == -1 || tt > tt2) + { + + if(file[1] == ':') + i = confirm("File \"%s\" has a newer modification time. Overwrite?", file); // prompt for overwrite + else + { + if(installdir[strlen(installdir)-1] == '\\') + i = confirm("File \"%s%s\" has a newer modification time. Overwrite?", installdir, file); // prompt for overwrite + else + i = confirm("File \"%s\\%s\" has a newer modification time. Overwrite?", installdir, file); // prompt for overwrite + } + if(i == 1) + { + sddall = 1; + i = 0; + } + if (i == 3) + f_err = ERR_USER; + if(i) + return -1; + } + } + fileinfo.attrFile = FILE_NORMAL; + DosSetPathInfo(file, FIL_STANDARD, (PVOID)&fileinfo, sizeof(FILESTATUS3), 0); +#endif + if (!f_ovrall) + { + if(installdir[strlen(installdir)-1] == '\\') + i = confirm("Overwrite file \"%s%s\"?", installdir, file); // prompt for overwrite + else + i = confirm("Overwrite file \"%s\\%s\"?", installdir, file); // prompt for overwrite + f_ovrall = (i == 1); + if (i == 3) + f_err = ERR_USER; + } + if ((i && !f_ovrall) || ovr_delete(file)) + return (-1); // delete? + } +#if defined(__OS2_) || defined(__EMX__) || defined(WIN32) + if ((han = open(file, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, + S_IREAD | S_IWRITE | S_IEXEC | S_IDELETE | + S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH )) < 0) +#else + if ((han = open(file, O_WRONLY | O_TRUNC | O_CREAT, + S_IREAD | S_IWRITE | S_IEXEC | S_IDELETE | + S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH )) < 0) +#endif + error("Could not create destination file \"%s\".", file); + else + { +#ifdef ENABLE_LOGGING + if(logfile) + { + if(!no_update) + { + if(strlen(file) > 1 && file[1] == ':') + fprintf(logfile, "<FileInst>,%s\r\n", file); + else + { + if(installdir[strlen(installdir)-1] == '\\') + fprintf(logfile, "<FileInst>,%s%s\r\n", installdir, file); + else + fprintf(logfile, "<FileInst>,%s\\%s\r\n", installdir, file); + } + } + } +#endif + } + + return (han); + } +} + diff --git a/utils/Install/sfxace/uac_dcpr.c b/utils/Install/sfxace/uac_dcpr.c new file mode 100644 index 0000000000..d6703428ca --- /dev/null +++ b/utils/Install/sfxace/uac_dcpr.c @@ -0,0 +1,554 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* These are the decompression algorithms. */ +/* Don't change here anything (apart from memory allocation perhaps). */ +/* Any changes will very likely cause bugs! */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include "os.h" + +#if defined(AMIGA) + #include <string.h> // mem*() +#endif +#if defined(DOS) || defined(WIN16) || defined(WINNT) || defined(OS2) || defined(UNIX) +#if !defined(__CYGWIN__) + #include <mem.h> // mem*() +#endif +#endif + +#include <stdio.h> // printf() +#include <stdlib.h> // malloc() +#include <string.h> + + +#include "globals.h" +#include "portable.h" +#include "uac_comm.h" +#include "uac_crc.h" +#include "uac_dcpr.h" +#include "uac_sys.h" +#ifdef CRYPT + #include "unace_ps.h" +#endif /* CRYPT */ + + +//------------------------------ QUICKSORT ---------------------------------// +#define xchg_def(v1,v2) {INT dummy;\ + dummy=v1; \ + v1=v2; \ + v2=dummy;} + +void sortrange(INT left, INT right) +{ + INT zl = left, + zr = right, + hyphen; + + hyphen = sort_freq[right]; + + //divides by hyphen the given range into 2 parts + do + { + while (sort_freq[zl] > hyphen) + zl++; + while (sort_freq[zr] < hyphen) + zr--; + //found a too small (left side) and + //a too big (right side) element-->exchange them + if (zl <= zr) + { + xchg_def(sort_freq[zl], sort_freq[zr]); + xchg_def(sort_org[zl], sort_org[zr]); + zl++; + zr--; + } + } + while (zl < zr); + + //sort partial ranges - when very small, sort directly + if (left < zr) + { + if (left < zr - 1) + sortrange(left, zr); + else if (sort_freq[left] < sort_freq[zr]) + { + xchg_def(sort_freq[left], sort_freq[zr]); + xchg_def(sort_org[left], sort_org[zr]); + } + } + + if (right > zl) + { + if (zl < right - 1) + sortrange(zl, right); + else if (sort_freq[zl] < sort_freq[right]) + { + xchg_def(sort_freq[zl], sort_freq[right]); + xchg_def(sort_org[zl], sort_org[right]); + } + } +} + +void quicksort(INT n) +{ + INT i; + + for (i = n + 1; i--;) + sort_org[i] = i; + sortrange(0, n); +} + +//------------------------------ read bits ---------------------------------// +void readdat(void) +{ + UINT i; + + i = (size_rdb - 2) << 2; + rpos -= size_rdb - 2; + buf_rd[0] = buf_rd[size_rdb - 2]; + buf_rd[1] = buf_rd[size_rdb - 1]; + read_adds_blk((CHAR *) & buf_rd[2], i); +#ifdef HI_LO_BYTE_ORDER + { + ULONG *p; + i>>=2; // count LONGs not BYTEs + p=&buf_rd[2]; + while (i--) + { + LONGswap(p); + p++; + } + } +#endif +} + +#define addbits(bits) \ +{ \ + rpos+=(bits_rd+=bits)>>5; \ + bits_rd&=31; \ + if (rpos==(size_rdb-2)) readdat(); \ + code_rd=(buf_rd[rpos] << bits_rd) \ + +((buf_rd[rpos+1] >> (32-bits_rd))&(!bits_rd-1)); \ + } + + +//---------------------- COMMENT DECOMPRESSION -----------------------------// + +#define comm_cpr_hf(a,b) (a+b) + +void dcpr_comm_init(void) +{ + INT i; + + i = comm_cpr_size > size_rdb * sizeof(LONG) ? size_rdb * sizeof(LONG) : comm_cpr_size; + if (!f_err) + memcpy(buf_rd, comm, i); +#ifdef HI_LO_BYTE_ORDER + { + ULONG *p; + i>>=2; // count LONGs not BYTEs + p=buf_rd; + while (i--) + { + LONGswap(p); + p++; + } + } +#endif + code_rd = buf_rd[0]; + rpos = bits_rd = 0; +} + +void dcpr_comm(INT comm_size) +{ + SHORT hash[comm_cpr_hf(255, 255) + 1]; + INT dpos = 0, + c, + pos = 0, + len, + hs; + + memset(&hash, 0, sizeof(hash)); + if (comm_cpr_size) + { + dcpr_comm_init(); + len = code_rd >> (32 - 15); + addbits(15); + if (len >= comm_size) + len = comm_size - 1; + if (read_wd(maxwd_mn, dcpr_code_mn, dcpr_wd_mn, max_cd_mn)) + do + { + if (dpos > 1) + { + pos = hash[hs = comm_cpr_hf(comm[dpos - 1], comm[dpos - 2])]; + hash[hs] = dpos; + } + addbits(dcpr_wd_mn[(c = dcpr_code_mn[code_rd >> (32 - maxwd_mn)])]); + if (rpos == size_rdb - 3) + rpos = 0; + if (c > 255) + { + c -= 256; + c += 2; + while (c--) + comm[dpos++] = comm[pos++]; + } + else + { + comm[dpos++] = c; + } + } + while (dpos < len); + comm[len] = 0; + } +} + +//------------------------- LZW1 DECOMPRESSION -----------------------------// +void wrchar(CHAR ch) +{ + dcpr_do++; + + dcpr_text[dcpr_dpos] = ch; + dcpr_dpos++; + dcpr_dpos &= dcpr_dican; +} + +void copystr(LONG d, INT l) +{ + INT mpos; + + dcpr_do += l; + + mpos = dcpr_dpos - d; + mpos &= dcpr_dican; + + if ((mpos >= dcpr_dicsiz - maxlength) || (dcpr_dpos >= dcpr_dicsiz - maxlength)) + { + while (l--) + { + dcpr_text[dcpr_dpos] = dcpr_text[mpos]; + dcpr_dpos++; + dcpr_dpos &= dcpr_dican; + mpos++; + mpos &= dcpr_dican; + } + } + else + { + while (l--) + dcpr_text[dcpr_dpos++] = dcpr_text[mpos++]; + dcpr_dpos &= dcpr_dican; + } +} + +void decompress(void) +{ + INT c, + lg, + i, + k; + ULONG dist; + + while (dcpr_do < dcpr_do_max) + { + if (!blocksize) + if (!calc_dectabs()) + return; + + addbits(dcpr_wd_mn[(c = dcpr_code_mn[code_rd >> (32 - maxwd_mn)])]); + blocksize--; + if (c > 255) + { + if (c > 259) + { + if ((c -= 260) > 1) + { + dist = (code_rd >> (33 - c)) + (1L << (c - 1)); + addbits(c - 1); + } + else + dist = c; + dcpr_olddist[(dcpr_oldnum = (dcpr_oldnum + 1) & 3)] = dist; + i = 2; + if (dist > maxdis2) + { + i++; + if (dist > maxdis3) + i++; + } + } + else + { + dist = dcpr_olddist[(dcpr_oldnum - (c &= 255)) & 3]; + for (k = c + 1; k--;) + dcpr_olddist[(dcpr_oldnum - k) & 3] = dcpr_olddist[(dcpr_oldnum - k + 1) & 3]; + dcpr_olddist[dcpr_oldnum] = dist; + i = 2; + if (c > 1) + i++; + } + addbits(dcpr_wd_lg[(lg = dcpr_code_lg[code_rd >> (32 - maxwd_lg)])]); + dist++; + lg += i; + copystr(dist, lg); + } + else + wrchar(c); + } +} + +//-------------------------- HUFFMAN ROUTINES ------------------------------// +INT makecode(UINT maxwd, UINT size1_t, UCHAR * wd, USHORT * code) +{ + UINT maxc, + size2_t, + l, + c, + i, + max_make_code; + + memcpy(&sort_freq, wd, (size1_t + 1) * sizeof(CHAR)); + if (size1_t) + quicksort(size1_t); + else + sort_org[0] = 0; + sort_freq[size1_t + 1] = size2_t = c = 0; + while (sort_freq[size2_t]) + size2_t++; + if (size2_t < 2) + { + i = sort_org[0]; + wd[i] = 1; + size2_t += (size2_t == 0); + } + size2_t--; + + max_make_code = 1 << maxwd; + for (i = size2_t + 1; i-- && c < max_make_code;) + { + maxc = 1 << (maxwd - sort_freq[i]); + l = sort_org[i]; + if (c + maxc > max_make_code) + { + dcpr_do = dcpr_do_max; + return (0); + } + memset16(&code[c], l, maxc); + c += maxc; + } + return (1); +} + +INT read_wd(UINT maxwd, USHORT * code, UCHAR * wd, INT max_el) +{ + UINT c, + i, + j, + num_el, + l, + uplim, + lolim; + + memset(wd, 0, max_el * sizeof(CHAR)); + memset(code, 0, (1 << maxwd) * sizeof(SHORT)); + + num_el = code_rd >> (32 - 9); + addbits(9); + if (num_el > max_el) + num_el = max_el; + + lolim = code_rd >> (32 - 4); + addbits(4); + uplim = code_rd >> (32 - 4); + addbits(4); + + for (i = -1; ++i <= uplim;) + { + wd_svwd[i] = code_rd >> (32 - 3); + addbits(3); + } + if (!makecode(maxwd_svwd, uplim, wd_svwd, code)) + return (0); + j = 0; + while (j <= num_el) + { + c = code[code_rd >> (32 - maxwd_svwd)]; + addbits(wd_svwd[c]); + if (c < uplim) + wd[j++] = c; + else + { + l = (code_rd >> 28) + 4; + addbits(4); + while (l-- && j <= num_el) + wd[j++] = 0; + } + } + if (uplim) + for (i = 0; ++i <= num_el;) + wd[i] = (wd[i] + wd[i - 1]) % uplim; + for (i = -1; ++i <= num_el;) + if (wd[i]) + wd[i] += lolim; + + return (makecode(maxwd, num_el, wd, code)); + +} + +INT calc_dectabs(void) +{ + if (!read_wd(maxwd_mn, dcpr_code_mn, dcpr_wd_mn, max_cd_mn) + || !read_wd(maxwd_lg, dcpr_code_lg, dcpr_wd_lg, max_cd_lg)) + return (0); + + blocksize = code_rd >> (32 - 15); + addbits(15); + + return (1); +} + +//---------------------------- BLOCK ROUTINES ------------------------------// +INT decompress_blk(CHAR * buf, UINT len) +{ + LONG old_pos = dcpr_dpos; + INT i; + + dcpr_do = 0; + if ((dcpr_do_max = len - maxlength) > dcpr_size) + dcpr_do_max = dcpr_size; + if ((LONG) dcpr_size > 0 && dcpr_do_max) + { + decompress(); + if (old_pos + dcpr_do > dcpr_dicsiz) + { + i = dcpr_dicsiz - old_pos; + memcpy(buf, &dcpr_text[old_pos], i); + memcpy(&buf[i], dcpr_text, dcpr_do - i); + } + else + memcpy(buf, &dcpr_text[old_pos], dcpr_do); + } + dcpr_size -= dcpr_do; + return (dcpr_do); +} + +INT unstore(CHAR * buf, UINT len) +{ + UINT rd = 0, + i, + pos = 0; + +#ifdef CRYPT + len = crypt_len(len - 8); /* because of decryption */ +#endif /* CRYPT */ + + while ((i = read_adds_blk((CHAR *) buf_rd, (INT) ((i = ((len > dcpr_size) ? dcpr_size : len)) > size_rdb ? size_rdb : i))) != 0) + { + rd += i; + len -= i; + memcpy(&buf[pos], buf_rd, i); + pos += i; + } + dcpr_size -= rd; + for (i = 0; i < rd; i++) + { + dcpr_text[dcpr_dpos] = buf[i]; + dcpr_dpos++; + dcpr_dpos &= dcpr_dican; + } + return (INT)rd; +} + +INT dcpr_adds_blk(CHAR * buf, UINT len) +{ + INT r; + + switch (fhead.TECH.TYPE) + { + case TYPE_STORE: + r = unstore(buf, len); + break; + case TYPE_LZW1: + r = decompress_blk(buf, len); + break; + default: + error("\nFile compressed with unknown method. Decompression not possible.\n"); + f_err = ERR_OTHER; + r = 0; + } + rd_crc = getcrc(rd_crc, (UCHAR*)buf, r); + return r; +} + + +//----------------------------- INIT ROUTINES ------------------------------// +void dcpr_init(void) +{ + dcpr_frst_file = 1; + + dcpr_dic = 20; + while ((dcpr_text = malloc(dcpr_dicsiz = (LONG) 1 << dcpr_dic))==NULL) + dcpr_dic--; + dcpr_dican = dcpr_dicsiz - 1; +} + +void dcpr_init_file(void) +{ + UINT i; + +#ifdef CRYPT + + reset_cryptkey(); + +#else /* CRYPT */ + + if (head.HEAD_FLAGS & ACE_PASSW) + { + error("\nFound passworded file. Decryption not supported.\n"); + f_err = ERR_OTHER; + return; + } + +#endif /* CRYPT */ + + rd_crc = CRC_MASK; + dcpr_size = fhead.SIZE; + if (fhead.TECH.TYPE == TYPE_LZW1) + { + if ((fhead.TECH.PARM & 15) + 10 > dcpr_dic) + { + error("\nNot enough memory or dictionary of archive too large.\n"); + f_err = ERR_MEM; + return; + } + + i = size_rdb * sizeof(LONG); + read_adds_blk((CHAR *) buf_rd, i); +#ifdef HI_LO_BYTE_ORDER + { + ULONG *p; + i>>=2; // count LONGs not BYTEs + p=buf_rd; + while (i--) + { + LONGswap(p); + p++; + } + } +#endif + code_rd = buf_rd[0]; + bits_rd = rpos = 0; + + blocksize = 0; + } + if (!adat.sol || dcpr_frst_file) + dcpr_dpos = 0; + + dcpr_oldnum = 0; + memset(&dcpr_olddist, 0, sizeof(dcpr_olddist)); + + dcpr_frst_file = 0; +} + diff --git a/utils/Install/sfxace/uac_sys.c b/utils/Install/sfxace/uac_sys.c new file mode 100644 index 0000000000..d31e961ea1 --- /dev/null +++ b/utils/Install/sfxace/uac_sys.c @@ -0,0 +1,96 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Some basic things. */ +/* */ +/* ------------------------------------------------------------------------ */ + +#include "os.h" + +#include <signal.h> // signal() +#include <stdio.h> // fprintf() fflush() getch() putc() + +#include "globals.h" +#include "uac_sys.h" + + +void memset16(USHORT * dest, SHORT val, INT len) // fills short-array with +{ // value + while (len--) + *(dest++) = val; +} + +INT cancel(void) // checks whether to interrupt the program +{ +#ifdef DOS + while (kbhit()) + { + if (getch() == 27) + f_err = ERR_USER; + } +#endif + return (f_err); +} + +/*INT wrask(CHAR * s) // prompt-routine +{ + INT ch; + + fprintf(stderr, "\n %s (Yes,Always,No,Cancel) ", s); + fflush(stderr); + do + { + ch = getch(); + ch = upcase(ch); + } + while (ch != 'Y' && ch != 'A' && ch != 'N' && ch != 'C' && ch != 27); + fprintf(stderr, "%s", ch == 'Y' ? "Yes" : (ch == 'A' ? "Always" : (ch == 'N' ? "No" : "Cancel"))); + fflush(stderr); + return (ch == 'Y' ? 0 : (ch == 'A' ? 1 : (ch == 'N' ? 2 : 3))); +} */ + +void beep(void) // makes some noise +{ +#ifdef DOS + sound(800); + delay(250); + nosound(); +#endif +#ifdef AMIGA + putc(0x07, stderr); +#endif +} + +void my_signalhandler(INT sig_number) // sets f_err if ctrl+c or ctrl+brk +{ + f_err = ERR_USER; + error("\nUser break\n"); +} + +#ifdef DOS // handles hardware errors +#ifdef __BORLANDC__ +INT harderrhandler(UINT deverr, UINT errc, UINT * devhdr) +#else +INT __far harderrhandler(UINT deverr, UINT errc, UINT * devhdr) +#endif +{ + f_criterr = 'A' + deverr & 0xff; + f_err = ERR_OTHER; + return (0x3); +} +#endif + +void set_handler(void) // initializes handlers +{ +#if defined(DOS) && !defined(__BORLANDC__) + signal(SIGBREAK, my_signalhandler); // set ctrl-break/-c handlers +#endif + signal(SIGINT, my_signalhandler); +#if defined(DOS) && !defined(__CONSOLE__) // set hardware error handler +#ifdef __BORLANDC__ + harderr(harderrhandler); +#else + _harderr(harderrhandler); +#endif +#endif +} + diff --git a/utils/Install/sfxace/unace.c b/utils/Install/sfxace/unace.c new file mode 100644 index 0000000000..f08bdf58ac --- /dev/null +++ b/utils/Install/sfxace/unace.c @@ -0,0 +1,555 @@ +/* ------------------------------------------------------------------------ */ +/* */ +/* Main file of public UNACE. */ +/* */ +/* ------------------------------------------------------------------------ */ + + +#define INCL_WIN /* Window Manager Functions */ +#define INCL_DOS +#define INCL_BASE + + +//--------------- include general files ------------------------------------// +#include <ctype.h> // tolower() +#include <fcntl.h> // open() +#include <stdio.h> // printf() sprintf() remove() +#include <stdlib.h> // malloc() +#include <string.h> // str*() +#include <sys/types.h> +#include <sys/stat.h> // S_I* AMIGA: fstat() +#if (!defined(__EMX__) && !defined(__OS2__) && !defined(WINNT) && !defined(WIN32)) || defined(__CYGWIN__) +#include <sys/errno.h> +#endif + +#if !defined(__EMX__) && !defined(__OS2__) && !defined(WIN32) && !defined(WINNT) +#define stricmp strcasecmp +#endif + +#include "install.h" +#include "instsup.h" +extern int installstate; + +off_t acelseek(off_t offset, int whence); +int aceread(void *buf, size_t count); +int aceopen(const char *path, int flags); +int aceclose(int fd); +int acesize(void); +int acetell(int fd); +char *replacestr(char *str1, char *str2, char *str3); + +//--------------- include unace specific header files ----------------------// +#include "os.h" + +#include "globals.h" +#include "portable.h" +#include "uac_comm.h" +#include "uac_crc.h" +#include "uac_crt.h" +#include "uac_dcpr.h" +#include "uac_sys.h" + +#ifdef CRYPT + #include "unace_ps.h" +#endif /* CRYPT */ + + + + +//--------------- BEGIN OF UNACE ROUTINES ----------------------------------// + +int pipeit(char *format, ...) +{ + /* Do nothing ... perhaps pipe this somewhere in the future */ + return 0; +} + +void init_unace(void) // initializes unace +{ + buf_rd =malloc(size_rdb * sizeof(ULONG)); // Allocate buffers: increase + buf =malloc(size_buf); // sizes when possible to speed + buf_wr =malloc(size_wrb); // up the program + readbuf=malloc(size_headrdb); + + if (buf_rd ==NULL || + buf ==NULL || + buf_wr ==NULL || + readbuf==NULL ) + f_err = ERR_MEM; + + make_crctable(); // initialize CRC table + dcpr_init(); // initialize decompression + + set_handler(); // ctrl+break etc. +} + +void done_unace(void) +{ + if (buf_rd ) free(buf_rd ); + if (buf ) free(buf ); + if (buf_wr ) free(buf_wr ); + if (readbuf ) free(readbuf ); + if (dcpr_text) free(dcpr_text); +} + +INT read_header(INT print_err) // reads any header from archive +{ + USHORT rd, + head_size, + crc_ok; + LONG crc; + UCHAR *tp=readbuf; + + acelseek(skipsize, SEEK_CUR); // skip ADDSIZE block + + if (aceread(&head, 4)<4) + return (0); // read CRC and header size + +#ifdef HI_LO_BYTE_ORDER + WORDswap(&head.HEAD_CRC); + WORDswap(&head.HEAD_SIZE); +#endif + // read size_headrdb bytes into + head_size = head.HEAD_SIZE; // header structure + rd = (head_size > size_headrdb) ? size_headrdb : head_size; + if (aceread(readbuf, rd) < rd) + return (0); + head_size -= rd; + crc = getcrc(CRC_MASK, readbuf, rd); + + while (head_size) // skip rest of header + { + rd = (head_size > size_buf) ? size_buf : head_size; + if (aceread(buf, rd) < rd) + return (0); + head_size -= rd; + crc = getcrc(crc, (UCHAR*)buf, rd); + } + + head.HEAD_TYPE =*tp++; // generic buffer to head conversion + head.HEAD_FLAGS=BUFP2WORD(tp); + + if (head.HEAD_FLAGS & ACE_ADDSIZE) + skipsize = head.ADDSIZE = BUF2LONG(tp); // get ADDSIZE + else + skipsize = 0; + + // check header CRC + if (!(crc_ok = head.HEAD_CRC == (crc & 0xffff)) && print_err) + pipeit("\nError: archive is broken\n"); + else + switch (head.HEAD_TYPE) // specific buffer to head conversion + { + case MAIN_BLK: + memcpy(mhead.ACESIGN, tp, acesign_len); tp+=acesign_len; + mhead.VER_MOD=*tp++; + mhead.VER_CR =*tp++; + mhead.HOST_CR=*tp++; + mhead.VOL_NUM=*tp++; + mhead.TIME_CR=BUFP2LONG(tp); + mhead.RES1 =BUFP2WORD(tp); + mhead.RES2 =BUFP2WORD(tp); + mhead.RES =BUFP2LONG(tp); + mhead.AV_SIZE=*tp++; + memcpy(mhead.AV, tp, rd-(USHORT)(tp-readbuf)); + break; + case FILE_BLK: + fhead.PSIZE =BUFP2LONG(tp); + fhead.SIZE =BUFP2LONG(tp); + fhead.FTIME =BUFP2LONG(tp); + fhead.ATTR =BUFP2LONG(tp); + fhead.CRC32 =BUFP2LONG(tp); + fhead.TECH.TYPE =*tp++; + fhead.TECH.QUAL =*tp++; + fhead.TECH.PARM =BUFP2WORD(tp); + fhead.RESERVED =BUFP2WORD(tp); + fhead.FNAME_SIZE=BUFP2WORD(tp); + memcpy(fhead.FNAME, tp, rd-(USHORT)(tp-readbuf)); + break; + // default: (REC_BLK and future things): + // do nothing 'cause isn't needed for extraction + } + + return (crc_ok); +} +// maximum SFX module size +#define max_sfx_size 65536 // (needed by read_arc_head) + +INT read_arc_head(void) // searches for the archive header and reads it +{ + INT i, + flags, + buf_pos = 0; + LONG arc_head_pos, + old_fpos, + fpos = 0; + struct stat st; + + fstat(archan, &st); + + memset(buf, 0, size_buf); + + while (acetell(archan)<acesize() && fpos < max_sfx_size) + { + old_fpos = fpos; + fpos += aceread(&buf[buf_pos], size_buf - buf_pos); + + for (i = 0; i < size_buf; i++) // look for the acesign + { + if (!memcmp(acesign, &buf[i], acesign_len)) + { + // seek to the probable begin + // of the archive + arc_head_pos = old_fpos + i - buf_pos - bytes_before_acesign; + acelseek(arc_head_pos, SEEK_SET); + if (read_header(0)) // try to read archive header + { + flags = mhead.HEAD_FLAGS; + adat.sol = (flags & ACE_SOLID) > 0; + adat.vol = (flags & ACE_MULT_VOL) > 0; + adat.vol_num = mhead.VOL_NUM; + adat.time_cr = mhead.TIME_CR; + return (1); + } + } + } + // was no archive header, + // continue search + acelseek(fpos, SEEK_SET); + memcpy(buf, &buf[size_buf - 512], 512); + buf_pos = 512; // keep 512 old bytes + } + return (0); +} + +INT open_archive(INT print_err) // opens archive (or volume) +{ + CHAR av_str[80]; + +#if defined(__OS2_) || defined(__EMX__) || defined(WIN32) + archan = aceopen(aname, O_RDONLY | O_BINARY); // open file +#else + archan = aceopen(aname, O_RDONLY); // open file +#endif +#if !defined(__EMX__) && !defined(__OS2__) + farchan = fdopen(archan, "rb"); +#endif + + if (archan == -1) + { + error("\nError opening file %s", aname); + return (0); + } + if (!read_arc_head()) // read archive header + { + error("Invalid embedded archive file."); +#if !defined(__EMX__) && !defined(__OS2__) + fclose(farchan); +#endif + aceclose(archan); + return (0); + } + + pipeit("\nProcessing archive: %s\n\n", aname); + if (head.HEAD_FLAGS & ACE_AV) + { + pipeit("Authenticity Verification:"); // print the AV + sprintf(av_str, "\ncreated on %d.%d.%d by ", + ts_day(adat.time_cr), ts_month(adat.time_cr), ts_year(adat.time_cr)); + pipeit(av_str); + strncpy(av_str, (CHAR*)mhead.AV, mhead.AV_SIZE); + av_str[mhead.AV_SIZE] = 0; + pipeit("%s\n\n", av_str); + } + comment_out("Main comment:"); // print main comment + return (1); +} + +void get_next_volname(void) // get file name of next volume +{ + CHAR *cp; + INT num; + + if ((cp = (CHAR *) strrchr(aname, '.')) == NULL || !*(cp + 1)) + num = -1; + else + { + cp++; + num = (*(cp + 1) - '0') * 10 + *(cp + 2) - '0'; + if (!in(num, 0, 99)) + num = -1; + if (in(*cp, '0', '9')) + num += (*cp - '0') * 100; + } + num++; + + if (num < 100) + *cp = 'C'; + else + *cp = num / 100 + '0'; + *(cp + 1) = (num / 10) % 10 + '0'; + *(cp + 2) = num % 10 + '0'; +} + +INT proc_vol(void) // opens volume +{ + INT i; + CHAR s[80]; + + if (!fileexists(aname) || !f_allvol_pr) + { + do + { + sprintf(s, "Ready to process %s?", aname); +#if defined(__MINGW32__) + beep(500,500); +#else + beep(); +#endif + i = confirm(s); // ask whether ready or not + f_allvol_pr = (i == 1); // "Always" --> process all volumes + if (i >= 2) + { + f_err = ERR_FOUND; + return (0); + } + } + while (!fileexists(aname)); + } + + if (!open_archive(1)) // open volume + { + pipeit("\nError while opening archive. File not found or archive broken.\n"); + f_err = ERR_OPEN; + return (0); + } + + return (1); +} + +INT proc_next_vol(void) // opens next volume to process +{ +#if !defined(__EMX__) && !defined(__OS2__) + fclose(farchan); +#endif + aceclose(archan); // close handle + get_next_volname(); // get file name of next volume + + if (!proc_vol()) // try to open volume, read archive header + return 0; + if (!read_header(1)) // read 2nd header + { + f_err=ERR_READ; + return 0; + } + return 1; +} + +INT read_adds_blk(CHAR * buffer, INT len) // reads part of ADD_SIZE block +{ + INT rd = 0, + l = len; + LONG i; + +#ifdef CRYPT + char *cbuffer=buffer; + + if (head.HEAD_TYPE == FILE_BLK && (head.HEAD_FLAGS & ACE_PASSW)) + len = crypt_len(len); +#endif /* CRYPT */ + while (!f_err && len && skipsize) + { + i = (skipsize > len) ? len : skipsize; + skipsize -= i; + + /* How do I test failure when compiling -mno-cygwin? */ +#if !defined(__MINGW32__) + errno = 0; +#endif + rd += aceread(buffer, i); +#if !defined(__MINGW32__) + if (errno) + { + error("\nRead error\n"); + f_err = ERR_READ; + } +#endif + + buffer += i; + len -= i; + + if (!skipsize) // if block is continued on next volume + if (head.HEAD_FLAGS & ACE_SP_AFTER && !proc_next_vol()) + break; + } +#ifdef CRYPT + if (head.HEAD_TYPE == FILE_BLK && (head.HEAD_FLAGS & ACE_PASSW)) + decrypt(cbuffer, rd); +#endif /* CRYPT */ + + return (rd > l ? l : rd); +} + +void crc_print(void) // checks CRC, prints message +{ + INT crc_not_ok = rd_crc != fhead.CRC32; /* check CRC of file */ + + if(crc_not_ok && installstate != ABORTED) + error("CRC error reading archive!"); +} + +void analyze_file(void) // analyzes one file (for solid archives) +{ + pipeit("\n Analyzing"); + flush; + while (!cancel() && (dcpr_adds_blk(buf_wr, size_wrb))) // decompress only + ; + crc_print(); +} + +void extract_file(void) // extracts one file +{ + INT rd; + + pipeit("\n Extracting"); + flush; // decompress block + while (!cancel() && (rd = dcpr_adds_blk(buf_wr, size_wrb))) + { + if (write(wrhan, buf_wr, rd) != rd) // write block + { + error("\nWrite error\n"); + f_err = ERR_WRITE; + } + } + crc_print(); +} + + +/* extracts or tests all files of the archive + */ +void extract_files(int nopath, int test, char *getfilename) +{ + CHAR file[PATH_MAX]; + char *tmpfile; + extern unsigned current_file; + extern char installdir2[]; + + while (!cancel() && read_header(1)) + { + if (head.HEAD_TYPE == FILE_BLK) + { + if(installstate == ABORTED) + return; + current_file++; + if(installstate == INSTALLING) + DoGUI(); + + comment_out("File comment:"); // show file comment + ace_fname(file, &head, nopath); // get file name + + /* We allow expansion of "userdir" to the selected directory by the user */ + tmpfile = replacestr(file, "USERDIR", installdir2); + strcpy(file, tmpfile); + free(tmpfile); + + if(!getfilename || (getfilename && stricmp(getfilename, file) == 0)) + { + pipeit("\n%s", file); + flush; + dcpr_init_file(); // initialize decompression of file + if (!f_err) + { + if (test || + (wrhan = create_dest_file(file, (INT) fhead.ATTR))<0) + { + if (test || adat.sol) + analyze_file(); // analyze file + } + else + { + extract_file(); // extract it +#ifdef DOS // set file time + _dos_setftime(wrhan, (USHORT) (fhead.FTIME >> 16), (USHORT) fhead.FTIME); +#endif + close(wrhan); +#if defined(__OS2__) || defined(__EMX__) + { + FILESTATUS3 fileinfo; + + DosQueryPathInfo(file, FIL_STANDARD, &fileinfo, sizeof(FILESTATUS3)); + *((USHORT*)&fileinfo.fdateCreation) = (USHORT)(fhead.FTIME >> 16); + *((USHORT*)&fileinfo.ftimeCreation) = (USHORT)fhead.FTIME; + *((USHORT*)&fileinfo.fdateLastAccess) = (USHORT)(fhead.FTIME >> 16); + *((USHORT*)&fileinfo.ftimeLastAccess) = (USHORT)fhead.FTIME; + *((USHORT*)&fileinfo.fdateLastWrite) = (USHORT)(fhead.FTIME >> 16); + *((USHORT*)&fileinfo.ftimeLastWrite) = (USHORT)fhead.FTIME; + DosSetPathInfo(file, FIL_STANDARD, (PVOID)&fileinfo, sizeof(FILESTATUS3), 0); + } +#endif +#ifdef DOS // set file attributes + _dos_setfileattr(file, (UINT) fhead.ATTR); +#endif +#ifdef AMIGA + { // set file date and time + struct DateTime dt; + char Date[9], Time[9]; + ULONG tstamp=fhead.FTIME; + + sprintf(Date, "%02d-%02d-%02d", ts_year(tstamp)-1900, ts_month(tstamp), ts_day(tstamp)); + sprintf(Time, "%02d:%02d:%02d", ts_hour(tstamp), ts_min(tstamp), ts_sec(tstamp)); + + dt.dat_Format = FORMAT_INT; + dt.dat_Flags = 0; + dt.dat_StrDate= Date; + dt.dat_StrTime= Time; + + if (StrToDate(&dt)) + SetFileDate(file, &dt.dat_Stamp); + } +#endif + if (f_err) + remove(file); + } + } + } + } + } +} + +unsigned percentage(ULONG p, ULONG d) +{ + return (unsigned)( d ? (d/2+p*100)/d : 100 ); +} + +int installer_unpack(CHAR * filename, int operation) // processes the archive +{ + init_unace(); // initialize unace + strcpy(aname, "installer"); // get archive name + + if(filename) + f_ovrall=1; + + if (open_archive(1)) // open archive to process + { + if (adat.vol_num) + pipeit("\nFirst volume of archive required!\n"); + else + { + if(operation == 2) + extract_files(0, 0, filename); + } +#if !defined(__EMX__) && !defined(__OS2__) + fclose(farchan); +#endif + aceclose(archan); + if (f_err) + { + pipeit("\nError occurred\n"); + if (f_criterr) + pipeit("Critical error on drive %c\n", f_criterr); + } + } + + done_unace(); + return 0; +} diff --git a/utils/Install/sfxzip/api.c b/utils/Install/sfxzip/api.c new file mode 100644 index 0000000000..5a4e73abf8 --- /dev/null +++ b/utils/Install/sfxzip/api.c @@ -0,0 +1,601 @@ +/*--------------------------------------------------------------------------- + + api.c + + This module supplies an UnZip engine for use directly from C/C++ + programs. The functions are: + + UzpVer *UzpVersion(void); + void UzpVersion2(UzpVer2 *version) + int UzpMain(int argc, char *argv[]); + int UzpAltMain(int argc, char *argv[], UzpInit *init); + int UzpValidate(char *archive, int AllCodes); + void UzpFreeMemBuffer(UzpBuffer *retstr); + int UzpUnzipToMemory(char *zip, char *file, UzpOpts *optflgs, + UzpCB *UsrFuncts, UzpBuffer *retstr); + + non-WINDLL only (a special WINDLL variant is defined in windll/windll.c): + int UzpGrep(char *archive, char *file, char *pattern, int cmd, int SkipBin, + UzpCB *UsrFuncts); + + OS/2 only (for now): + int UzpFileTree(char *name, cbList(callBack), char *cpInclude[], + char *cpExclude[]); + + You must define `DLL' in order to include the API extensions. + + ---------------------------------------------------------------------------*/ + + +#ifdef OS2 +# define INCL_DOSMEMMGR +# include <os2.h> +#endif +#include <setjmp.h> + +#define UNZIP_INTERNAL +#include "unzip.h" +#include "version.h" +#ifdef WINDLL +# include "windll/windll.h" +#endif + +#ifdef DLL /* This source file supplies DLL-only interface code. */ + +jmp_buf dll_error_return; + +/*--------------------------------------------------------------------------- + Documented API entry points + ---------------------------------------------------------------------------*/ + + +UzpVer * UZ_EXP UzpVersion() /* should be pointer to const struct */ +{ + static UzpVer version; /* doesn't change between calls */ + + + version.structlen = UZPVER_LEN; + +#ifdef BETA + version.flag = 1; +#else + version.flag = 0; +#endif + version.betalevel = BETALEVEL; + version.date = VERSION_DATE; + +#ifdef ZLIB_VERSION + version.zlib_version = ZLIB_VERSION; + version.flag |= 2; +#else + version.zlib_version = NULL; +#endif + + /* someday each of these may have a separate patchlevel: */ + version.unzip.major = UZ_MAJORVER; + version.unzip.minor = UZ_MINORVER; + version.unzip.patchlevel = PATCHLEVEL; + + version.zipinfo.major = ZI_MAJORVER; + version.zipinfo.minor = ZI_MINORVER; + version.zipinfo.patchlevel = PATCHLEVEL; + + /* these are retained for backward compatibility only: */ + version.os2dll.major = UZ_MAJORVER; + version.os2dll.minor = UZ_MINORVER; + version.os2dll.patchlevel = PATCHLEVEL; + + version.windll.major = UZ_MAJORVER; + version.windll.minor = UZ_MINORVER; + version.windll.patchlevel = PATCHLEVEL; + + return &version; +} + +void UZ_EXP UzpVersion2(UzpVer2 *version) +{ + + version->structlen = UZPVER_LEN; + +#ifdef BETA + version->flag = 1; +#else + version->flag = 0; +#endif + strcpy(version->betalevel, BETALEVEL); + strcpy(version->date, VERSION_DATE); + +#ifdef ZLIB_VERSION + strcpy(version->zlib_version, ZLIB_VERSION); + version->flag |= 2; +#else + version->zlib_version[0] = '\0'; +#endif + + /* someday each of these may have a separate patchlevel: */ + version->unzip.major = UZ_MAJORVER; + version->unzip.minor = UZ_MINORVER; + version->unzip.patchlevel = PATCHLEVEL; + + version->zipinfo.major = ZI_MAJORVER; + version->zipinfo.minor = ZI_MINORVER; + version->zipinfo.patchlevel = PATCHLEVEL; + + /* these are retained for backward compatibility only: */ + version->os2dll.major = UZ_MAJORVER; + version->os2dll.minor = UZ_MINORVER; + version->os2dll.patchlevel = PATCHLEVEL; + + version->windll.major = UZ_MAJORVER; + version->windll.minor = UZ_MINORVER; + version->windll.patchlevel = PATCHLEVEL; +} + + + + + +#ifndef WINDLL + +int UZ_EXP UzpAltMain(int argc, char *argv[], UzpInit *init) +{ + int r, (*dummyfn)(); + + + CONSTRUCTGLOBALS(); + + if (init->structlen >= (sizeof(ulg) + sizeof(dummyfn)) && init->msgfn) + G.message = init->msgfn; + + if (init->structlen >= (sizeof(ulg) + 2*sizeof(dummyfn)) && init->inputfn) + G.input = init->inputfn; + + if (init->structlen >= (sizeof(ulg) + 3*sizeof(dummyfn)) && init->pausefn) + G.mpause = init->pausefn; + + if (init->structlen >= (sizeof(ulg) + 4*sizeof(dummyfn)) && init->userfn) + (*init->userfn)(); /* allow void* arg? */ + + r = unzip(__G__ argc, argv); + DESTROYGLOBALS() + RETURN(r); +} + +#endif /* !WINDLL */ + + + + +#ifndef __16BIT__ + +void UZ_EXP UzpFreeMemBuffer(UzpBuffer *retstr) +{ + if (retstr->strptr != NULL) { + free(retstr->strptr); + retstr->strptr = NULL; + } +} + + + + +#ifndef WINDLL + +static int UzpDLL_Init OF((zvoid *pG, UzpCB *UsrFuncts)); + +static int UzpDLL_Init(pG, UsrFuncts) +zvoid *pG; +UzpCB *UsrFuncts; +{ + int (*dummyfn)(); + + if (UsrFuncts->structlen >= (sizeof(ulg) + sizeof(dummyfn)) && + UsrFuncts->msgfn) + ((Uz_Globs *)pG)->message = UsrFuncts->msgfn; + else + return FALSE; + + if (UsrFuncts->structlen >= (sizeof(ulg) + 2*sizeof(dummyfn)) && + UsrFuncts->inputfn) + ((Uz_Globs *)pG)->input = UsrFuncts->inputfn; + + if (UsrFuncts->structlen >= (sizeof(ulg) + 3*sizeof(dummyfn)) && + UsrFuncts->pausefn) + ((Uz_Globs *)pG)->mpause = UsrFuncts->pausefn; + + if (UsrFuncts->structlen >= (sizeof(ulg) + 4*sizeof(dummyfn)) && + UsrFuncts->passwdfn) + ((Uz_Globs *)pG)->decr_passwd = UsrFuncts->passwdfn; + + if (UsrFuncts->structlen >= (sizeof(ulg) + 5*sizeof(dummyfn)) && + UsrFuncts->statrepfn) + ((Uz_Globs *)pG)->statreportcb = UsrFuncts->statrepfn; + + return TRUE; +} + + +int UZ_EXP UzpUnzipToMemory(char *zip, char *file, UzpOpts *optflgs, + UzpCB *UsrFuncts, UzpBuffer *retstr) +{ + int r; +#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO)) + char *intern_zip, *intern_file; +#endif + + CONSTRUCTGLOBALS(); +#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO)) + intern_zip = (char *)malloc(strlen(zip)+1); + if (intern_zip == NULL) { + DESTROYGLOBALS() + return PK_MEM; + } + intern_file = (char *)malloc(strlen(file)+1); + if (intern_file == NULL) { + DESTROYGLOBALS() + free(intern_zip); + return PK_MEM; + } + ISO_TO_INTERN(zip, intern_zip); + ISO_TO_INTERN(file, intern_file); +# define zip intern_zip +# define file intern_file +#endif + /* Copy those options that are meaningful for UzpUnzipToMemory, instead of + * a simple "memcpy(G.UzO, optflgs, sizeof(UzpOpts));" + */ + uO.pwdarg = optflgs->pwdarg; + uO.aflag = optflgs->aflag; + uO.C_flag = optflgs->C_flag; + uO.qflag = optflgs->qflag; /* currently, overridden in unzipToMemory */ + + if (!UzpDLL_Init((zvoid *)&G, UsrFuncts)) { + DESTROYGLOBALS(); + return PK_BADERR; + } + G.redirect_data = 1; + + r = (unzipToMemory(__G__ zip, file, retstr) <= PK_WARN); + + DESTROYGLOBALS() +#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO)) +# undef file +# undef zip + free(intern_file); + free(intern_zip); +#endif + if (!r && retstr->strlength) { + free(retstr->strptr); + retstr->strptr = NULL; + } + return r; +} +#endif /* !WINDLL */ +#endif /* !__16BIT__ */ + + + + + +#ifdef OS2DLL + +int UZ_EXP UzpFileTree(char *name, cbList(callBack), char *cpInclude[], + char *cpExclude[]) +{ + int r; + + CONSTRUCTGLOBALS(); + uO.qflag = 2; + uO.vflag = 1; + uO.C_flag = 1; + G.wildzipfn = name; + G.process_all_files = TRUE; + if (cpInclude) { + char **ptr = cpInclude; + + while (*ptr != NULL) ptr++; + G.filespecs = ptr - cpInclude; + G.pfnames = cpInclude, G.process_all_files = FALSE; + } + if (cpExclude) { + char **ptr = cpExclude; + + while (*ptr != NULL) ptr++; + G.xfilespecs = ptr - cpExclude; + G.pxnames = cpExclude, G.process_all_files = FALSE; + } + + G.processExternally = callBack; + r = process_zipfiles(__G)==0; + DESTROYGLOBALS() + return r; +} + +#endif /* OS2DLL */ + + + + +/*--------------------------------------------------------------------------- + Helper functions + ---------------------------------------------------------------------------*/ + + +void setFileNotFound(__G) + __GDEF +{ + G.filenotfound++; +} + + + +int unzipToMemory(__GPRO__ char *zip, char *file, UzpBuffer *retstr) +{ + int r; + char *incname[2]; + + G.process_all_files = FALSE; + G.extract_flag = TRUE; + uO.qflag = 2; + G.wildzipfn = zip; + + G.pfnames = incname; + incname[0] = file; + incname[1] = NULL; + G.filespecs = 1; + + r = process_zipfiles(__G); + if (retstr) { + retstr->strptr = (char *)G.redirect_buffer; + retstr->strlength = G.redirect_size; + } + return r; /* returns `PK_???' error values */ +} + + + +int redirect_outfile(__G) + __GDEF +{ + if (G.redirect_size != 0 || G.redirect_buffer != NULL) + return FALSE; + +#ifndef NO_SLIDE_REDIR + G.redirect_slide = !G.pInfo->textmode; +#endif + G.redirect_size = (G.pInfo->textmode ? + G.lrec.ucsize * lenEOL : G.lrec.ucsize); +#ifdef OS2 + DosAllocMem((void **)&G.redirect_buffer, G.redirect_size+1, + PAG_READ|PAG_WRITE|PAG_COMMIT); + G.redirect_pointer = G.redirect_buffer; +#else +#ifdef __16BIT__ + if ((ulg)((extent)G.redirect_size) != G.redirect_size) + return FALSE; +#endif + G.redirect_pointer = G.redirect_buffer = malloc(G.redirect_size+1); +#endif + if (!G.redirect_buffer) + return FALSE; + G.redirect_pointer[G.redirect_size] = '\0'; + return TRUE; +} + + + +int writeToMemory(__GPRO__ uch *rawbuf, ulg size) +{ + if (rawbuf != G.redirect_pointer) + memcpy(G.redirect_pointer,rawbuf,size); + G.redirect_pointer += size; + return 0; +} + + + + +int close_redirect(__G) + __GDEF +{ + if (G.pInfo->textmode) { + *G.redirect_pointer = '\0'; + G.redirect_size = G.redirect_pointer - G.redirect_buffer; + if ((G.redirect_buffer = + realloc(G.redirect_buffer, G.redirect_size + 1)) == NULL) { + G.redirect_size = 0; + return EOF; + } + } + return 0; +} + + + + +#ifndef __16BIT__ +#ifndef WINDLL + +/* Purpose: Determine if file in archive contains the string szSearch + + Parameters: archive = archive name + file = file contained in the archive. This cannot be + a wild card to be meaningful + pattern = string to search for + cmd = 0 - case-insensitive search + 1 - case-sensitve search + 2 - case-insensitive, whole words only + 3 - case-sensitive, whole words only + SkipBin = if true, skip any files that have control + characters other than CR, LF, or tab in the first + 100 characters. + + Returns: TRUE if a match is found + FALSE if no match is found + -1 on error + + Comments: This does not pretend to be as useful as the standard + Unix grep, which returns the strings associated with a + particular pattern, nor does it search past the first + matching occurrence of the pattern. + */ + +int UZ_EXP UzpGrep(char *archive, char *file, char *pattern, int cmd, + int SkipBin, UzpCB *UsrFuncts) +{ + int retcode = FALSE, compare; + ulg i, j, patternLen, buflen; + char * sz, *p; + UzpOpts flgopts; + UzpBuffer retstr; + + memzero(&flgopts, sizeof(UzpOpts)); /* no special options */ + + if (!UzpUnzipToMemory(archive, file, &flgopts, UsrFuncts, &retstr)) { + return -1; /* not enough memory, file not found, or other error */ + } + + if (SkipBin) { + if (retstr.strlength < 100) + buflen = retstr.strlength; + else + buflen = 100; + for (i = 0; i < buflen; i++) { + if (iscntrl(retstr.strptr[i])) { + if ((retstr.strptr[i] != 0x0A) && + (retstr.strptr[i] != 0x0D) && + (retstr.strptr[i] != 0x09)) + { + /* OK, we now think we have a binary file of some sort */ + free(retstr.strptr); + return FALSE; + } + } + } + } + + patternLen = strlen(pattern); + + if (retstr.strlength < patternLen) { + free(retstr.strptr); + return FALSE; + } + + sz = malloc(patternLen + 3); /* add two in case doing whole words only */ + if (cmd > 1) { + strcpy(sz, " "); + strcat(sz, pattern); + strcat(sz, " "); + } else + strcpy(sz, pattern); + + if ((cmd == 0) || (cmd == 2)) { + for (i = 0; i < strlen(sz); i++) + sz[i] = toupper(sz[i]); + for (i = 0; i < retstr.strlength; i++) + retstr.strptr[i] = toupper(retstr.strptr[i]); + } + + for (i = 0; i < (retstr.strlength - patternLen); i++) { + p = &retstr.strptr[i]; + compare = TRUE; + for (j = 0; j < patternLen; j++) { + /* We cannot do strncmp here, as we may be dealing with a + * "binary" file, such as a word processing file, or perhaps + * even a true executable of some sort. */ + if (p[j] != sz[j]) { + compare = FALSE; + break; + } + } + if (compare == TRUE) { + retcode = TRUE; + break; + } + } + + free(sz); + free(retstr.strptr); + + return retcode; +} +#endif /* !WINDLL */ +#endif /* !__16BIT__ */ + + + + +int UZ_EXP UzpValidate(char *archive, int AllCodes) +{ + int retcode; + CONSTRUCTGLOBALS(); + + uO.jflag = 1; + uO.tflag = 1; + uO.overwrite_none = 0; + G.extract_flag = (!uO.zipinfo_mode && + !uO.cflag && !uO.tflag && !uO.vflag && !uO.zflag +#ifdef TIMESTAMP + && !uO.T_flag +#endif + ); + + uO.qflag = 2; /* turn off all messages */ + G.fValidate = TRUE; + G.pfnames = (char **)&fnames[0]; /* assign default filename vector */ +#ifdef WINDLL + Wiz_NoPrinting(TRUE); +#endif + + if (archive == NULL) { /* something is screwed up: no filename */ + DESTROYGLOBALS(); + return PK_NOZIP; + } + + G.wildzipfn = (char *)malloc(FILNAMSIZ + 1); + strcpy(G.wildzipfn, archive); +#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO)) + _ISO_INTERN(G.wildzipfn); +#endif + + G.process_all_files = TRUE; /* for speed */ + + retcode = setjmp(dll_error_return); + + if (retcode) { +#ifdef WINDLL + Wiz_NoPrinting(FALSE); +#endif + free(G.wildzipfn); + DESTROYGLOBALS(); + return PK_BADERR; + } + + retcode = process_zipfiles(__G); + + free(G.wildzipfn); +#ifdef WINDLL + Wiz_NoPrinting(FALSE); +#endif + DESTROYGLOBALS(); + + /* PK_WARN == 1 and PK_FIND == 11. When we are just looking at an + archive, we should still be able to see the files inside it, + even if we can't decode them for some reason. + + We also still want to be able to get at files even if there is + something odd about the zip archive, hence allow PK_WARN, + PK_FIND, IZ_UNSUP as well as PK_ERR + */ + + if (AllCodes) + return retcode; + + if ((retcode == PK_OK) || (retcode == PK_WARN) || (retcode == PK_ERR) || + (retcode == IZ_UNSUP) || (retcode == PK_FIND)) + return TRUE; + else + return FALSE; +} + +#endif /* DLL */ diff --git a/utils/Install/sfxzip/apihelp.c b/utils/Install/sfxzip/apihelp.c new file mode 100644 index 0000000000..1a0d682cdd --- /dev/null +++ b/utils/Install/sfxzip/apihelp.c @@ -0,0 +1,147 @@ +/* apihelp.c */ + +#ifdef API_DOC + +#define UNZIP_INTERNAL +#include "unzip.h" +#include "version.h" + + +APIDocStruct APIDoc[] = { + { + "UZPVERSION" , "UzpVersion" , + "UzpVer *UzpVersion(void);", + "Get version numbers of the API and the underlying UnZip code.\n\n" + "\t\tThis is used for comparing the version numbers of the run-time\n" + "\t\tDLL code with those expected from the unzip.h at compile time.\n" + "\t\tIf the version numbers do not match, there may be compatibility\n" + "\t\tproblems with further use of the DLL.\n\n" + " Example:\t/* Check the major version number of the DLL code. */\n" + "\t\tUzpVer *pVersion;\n" + "\t\tpVersion = UzpVersion();\n" + "\t\tif (pVersion->unzip.major != UZ_MAJORVER)\n" + "\t\t fprintf(stderr, \"error: using wrong version of DLL\\n\");\n\n" + "\t\tSee unzip.h for details and unzipstb.c for an example.\n" + }, + + { + "UZPMAIN" , "UzpMain" , + "int UzpMain(int argc, char *argv[]);", + "Provide a direct entry point to the command line interface.\n\n" + "\t\tThis is used by the UnZip stub but you can use it in your\n" + "\t\town program as well. Output is sent to stdout.\n" + "\t\t0 on return indicates success.\n\n" + " Example:\t/* Extract 'test.zip' silently, junking paths. */\n" + "\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n" + "\t\tint argc = 3;\n" + "\t\tif (UzpMain(argc,argv))\n" + "\t\t printf(\"error: unzip failed\\n\");\n\n" + "\t\tSee unzip.h for details.\n" + }, + + { + "UZPALTMAIN" , "UzpAltMain" , + "int UzpAltMain(int argc, char *argv[], UzpInit *init);", + "Provide a direct entry point to the command line interface,\n" + "optionally installing replacement I/O handler functions.\n\n" + "\t\tAs with UzpMain(), output is sent to stdout by default.\n" + "\t\t`InputFn *inputfn' is not yet implemented. 0 on return\n" + "\t\tindicates success.\n\n" + " Example:\t/* Replace normal output and `more' functions. */\n" + "\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n" + "\t\tint argc = 3;\n" + "\t\tUzpInit init = { 16, MyMessageFn, NULL, MyPauseFn };\n" + "\t\tif (UzpAltMain(argc,argv,&init))\n" + "\t\t printf(\"error: unzip failed\\n\");\n\n" + "\t\tSee unzip.h for details.\n" + }, + + { + "UZPUNZIPTOMEMORY", "UzpUnzipToMemory", + "int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);", + "Pass the name of the zip file and the name of the file\n" + "\t\tyou wish to extract. UzpUnzipToMemory will create a\n" + "\t\tbuffer and return it in *retstr; 0 on return indicates\n" + "\t\tfailure.\n\n" + "\t\tSee unzip.h for details.\n" + }, + + { + "UZPFILETREE", "UzpFileTree", + "int UzpFileTree(char *name, cbList(callBack),\n" + "\t\t\tchar *cpInclude[], char *cpExclude[]);", + "Pass the name of the zip file, a callback function, an\n" + "\t\tinclude and exclude file list. UzpFileTree calls the\n" + "\t\tcallback for each valid file found in the zip file.\n" + "\t\t0 on return indicates failure.\n\n" + "\t\tSee unzip.h for details.\n" + }, + + { 0 } +}; + + +static int function_help OF((__GPRO__ APIDocStruct *doc, char *fname)); + + + +static int function_help(__G__ doc, fname) + __GDEF + APIDocStruct *doc; + char *fname; +{ + strcpy(slide, fname); + /* strupr(slide); non-standard */ + while (doc->compare && STRNICMP(doc->compare,slide,strlen(fname))) + doc++; + if (!doc->compare) + return 0; + else + Info(slide, 0, ((char *)slide, + " Function:\t%s\n\n Syntax:\t%s\n\n Purpose:\t%s", + doc->function, doc->syntax, doc->purpose)); + + return 1; +} + + + +void APIhelp(__G__ argc, argv) + __GDEF + int argc; + char **argv; +{ + if (argc > 1) { + struct APIDocStruct *doc; + + if (function_help(__G__ APIDoc, argv[1])) + return; +#ifdef SYSTEM_API_DETAILS + if (function_help(__G__ SYSTEM_API_DETAILS, argv[1])) + return; +#endif + Info(slide, 0, ((char *)slide, + "%s is not a documented command.\n\n", argv[1])); + } + + Info(slide, 0, ((char *)slide, "\ +This API provides a number of external C and REXX functions for handling\n\ +zipfiles in OS/2. Programmers are encouraged to expand this API.\n\ +\n\ +C functions: -- See unzip.h for details\n\ + UzpVer *UzpVersion(void);\n\ + int UzpMain(int argc, char *argv[]);\n\ + int UzpAltMain(int argc, char *argv[], UzpInit *init);\n\ + int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);\n\ + int UzpFileTree(char *name, cbList(callBack),\n\ + char *cpInclude[], char *cpExclude[]);\n\n")); + +#ifdef SYSTEM_API_BRIEF + Info(slide, 0, ((char *)slide, SYSTEM_API_BRIEF)); +#endif + + Info(slide, 0, ((char *)slide, + "\nFor more information, type 'unzip -A <function-name>'\n")); +} + +#endif /* API_DOC */ diff --git a/utils/Install/sfxzip/crc32.c b/utils/Install/sfxzip/crc32.c new file mode 100644 index 0000000000..cd05536108 --- /dev/null +++ b/utils/Install/sfxzip/crc32.c @@ -0,0 +1,56 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* $Id$ */ + +#define __CRC32_C /* identifies this source module */ + +#include "zip.h" + +#ifndef USE_ZLIB +#ifndef ASM_CRC + +#ifndef ZCONST +# define ZCONST const +#endif + +#ifdef CRC32 +# undef CRC32 +#endif +#define CRC32(c, b) (crc_table[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8)) +#define DO1(buf) crc = CRC32(crc, *buf++) +#define DO2(buf) DO1(buf); DO1(buf) +#define DO4(buf) DO2(buf); DO2(buf) +#define DO8(buf) DO4(buf); DO4(buf) + +/* ========================================================================= */ +ulg crc32(crc, buf, len) + register ulg crc; /* crc shift register */ + register ZCONST uch *buf; /* pointer to bytes to pump through */ + extent len; /* number of bytes in buf[] */ +/* Run a set of bytes through the crc shift register. If buf is a NULL + pointer, then initialize the crc shift register contents instead. + Return the current crc in either case. */ +{ + register ZCONST ulg near *crc_table; + + if (buf == NULL) return 0L; + + crc_table = get_crc_table(); + + crc = crc ^ 0xffffffffL; +#ifndef NO_UNROLLED_LOOPS + while (len >= 8) { + DO8(buf); + len -= 8; + } +#endif + if (len) do { + DO1(buf); + } while (--len); + return crc ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */ +} +#endif /* !ASM_CRC */ +#endif /* !USE_ZLIB */ diff --git a/utils/Install/sfxzip/crc_i386.S b/utils/Install/sfxzip/crc_i386.S new file mode 100644 index 0000000000..5d0867f0e1 --- /dev/null +++ b/utils/Install/sfxzip/crc_i386.S @@ -0,0 +1,230 @@ +/* + * crc_i386.S, optimized CRC calculation function for Zip and UnZip, not + * copyrighted by Paul Kienitz and Christian Spieler. Last revised 12 Oct 97. + * + * GRR 961110: incorporated Scott Field optimizations from win32/crc_i386.asm + * => overall 6% speedup in "unzip -tq" on 9MB zipfile (486-66) + * + * SPC 970402: revised for Rodney Brown's optimizations (32-bit-wide + * aligned reads for most of the data from buffer), can be + * disabled by defining the macro NO_32_BIT_LOADS + * + * SPC 971012: added Rodney Brown's additional tweaks for 32-bit-optimized + * CPUs (like the Pentium Pro, Pentium II, and probably some + * Pentium clones). This optimization is controlled by the + * preprocessor switch "__686" and is disabled by default. + * (This default is based on the assumption that most users + * do not yet work on a Pentium Pro or Pentium II machine ...) + * + * FLAT memory model assumed. Calling interface: + * - args are pushed onto the stack from right to left, + * - return value is given in the EAX register, + * - all other registers (with exception of EFLAGS) are preserved. (With + * GNU C 2.7.x, %edx and %ecx are `scratch' registers, but preserving + * them nevertheless adds only 4 single byte instructions.) + * + * This source generates the function + * ulg crc32(ulg crc, ZCONST uch *buf, ulg len). + * + * The loop unrolling can be disabled by defining the macro NO_UNROLLED_LOOPS. + * This results in shorter code at the expense of reduced performance. + */ + +/* This file is NOT used in conjunction with zlib. */ +#ifndef USE_ZLIB + +/* Preprocess with -DNO_UNDERLINE if your C compiler does not prefix + * external symbols with an underline character '_'. + */ +#if defined(NO_UNDERLINE) || defined(__ELF__) +# define _crc32 crc32 +# define _get_crc_table get_crc_table +#endif +/* Use 16-byte alignment if your assembler supports it. Warning: gas + * uses a log(x) parameter (.align 4 means 16-byte alignment). On SVR4 + * the parameter is a number of bytes. + */ +#ifndef ALIGNMENT +# define ALIGNMENT .align 4,0x90 +#endif + +#if defined(i386) || defined(_i386) || defined(_I386) || defined(__i386) + +/* This version is for 386 Unix, OS/2, MSDOS in 32 bit mode (gcc & gas). + * Warning: it uses the AT&T syntax: mov source,dest + * This file is only optional. If you want to use the C version, + * remove -DASM_CRC from CFLAGS in Makefile and set OBJA to an empty string. + */ + + .file "crc_i386.S" + +#if defined(NO_STD_STACKFRAME) && defined(USE_STD_STACKFRAME) +# undef USE_STACKFRAME +#else + /* The default is to use standard stack frame entry, because it + * results in smaller code! + */ +# ifndef USE_STD_STACKFRAME +# define USE_STD_STACKFRAME +# endif +#endif + +#ifdef USE_STD_STACKFRAME +# define _STD_ENTRY pushl %ebp ; movl %esp,%ebp +# define arg1 8(%ebp) +# define arg2 12(%ebp) +# define arg3 16(%ebp) +# define _STD_LEAVE popl %ebp +#else /* !USE_STD_STACKFRAME */ +# define _STD_ENTRY +# define arg1 24(%esp) +# define arg2 28(%esp) +# define arg3 32(%esp) +# define _STD_LEAVE +#endif /* ?USE_STD_STACKFRAME */ + +/* + * These two (three) macros make up the loop body of the CRC32 cruncher. + * registers modified: + * eax : crc value "c" + * esi : pointer to next data byte (or lword) "buf++" + * registers read: + * edi : pointer to base of crc_table array + * scratch registers: + * ebx : index into crc_table array + * (requires upper three bytes = 0 when __686 is undefined) + */ +#ifndef __686 /* optimize for 386, 486, Pentium */ +#define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\ + movb %al, %bl ;/* tmp = c & 0xFF */\ + shrl $8, %eax ;/* c = (c >> 8) */\ + xorl (%edi, %ebx, 4), %eax ;/* c ^= table[tmp] */ +#else /* __686 : optimize for Pentium Pro and compatible CPUs */ +#define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\ + movzbl %al, %ebx ;/* tmp = c & 0xFF */\ + shrl $8, %eax ;/* c = (c >> 8) */\ + xorl (%edi, %ebx, 4), %eax ;/* c ^=table[tmp] */ +#endif /* ?__686 */ + +#define Do_CRC_byte /* c = (c >> 8) ^ table[(c^*buf++)&0xFF] */\ + xorb (%esi), %al ;/* c ^= *buf */\ + incl %esi ;/* buf++ */\ + Do_CRC + +#ifndef NO_32_BIT_LOADS +#define Do_CRC_lword \ + xorl (%esi), %eax ;/* c ^= *(ulg *)buf */\ + addl $4, %esi ;/* ((ulg *)buf)++ */\ + Do_CRC \ + Do_CRC \ + Do_CRC \ + Do_CRC +#endif /* !NO_32_BIT_LOADS */ + + + .text + + .globl _crc32 + +_crc32: /* ulg crc32(ulg crc, uch *buf, extent len) */ + _STD_ENTRY + pushl %edi + pushl %esi + pushl %ebx + pushl %edx + pushl %ecx + + movl arg2, %esi /* 2nd arg: uch *buf */ + subl %eax, %eax /* > if (!buf) */ + testl %esi, %esi /* > return 0; */ + jz .L_fine /* > else { */ + call _get_crc_table + movl %eax, %edi + movl arg1, %eax /* 1st arg: ulg crc */ +#ifndef __686 + subl %ebx, %ebx /* ebx=0; bl usable as dword */ +#endif + movl arg3, %ecx /* 3rd arg: extent len */ + notl %eax /* > c = ~crc; */ + +#ifndef NO_UNROLLED_LOOPS +# ifndef NO_32_BIT_LOADS + testl %ecx, %ecx + jz .L_bail + /* Assert now have positive length */ +.L_align_loop: + testl $3, %esi /* Align buf on lword boundary */ + jz .L_aligned_now + Do_CRC_byte + decl %ecx + jnz .L_align_loop +.L_aligned_now: +# endif /* !NO_32_BIT_LOADS */ + movl %ecx, %edx /* save len in edx */ + andl $7, %edx /* edx = len % 8 */ + shrl $3, %ecx /* ecx = len / 8 */ + jz .L_No_Eights +/* align loop head at start of 486 internal cache line !! */ + ALIGNMENT +.L_Next_Eight: +# ifndef NO_32_BIT_LOADS + /* Do_CRC_lword */ + xorl (%esi), %eax ;/* c ^= *(ulg *)buf */ + addl $4, %esi ;/* ((ulg *)buf)++ */ + Do_CRC + Do_CRC + Do_CRC + Do_CRC + /* Do_CRC_lword */ + xorl (%esi), %eax ;/* c ^= *(ulg *)buf */ + addl $4, %esi ;/* ((ulg *)buf)++ */ + Do_CRC + Do_CRC + Do_CRC + Do_CRC +# else /* NO_32_BIT_LOADS */ + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte +# endif /* ?NO_32_BIT_LOADS */ + decl %ecx + jnz .L_Next_Eight + +.L_No_Eights: + movl %edx, %ecx +#endif /* NO_UNROLLED_LOOPS */ + +#ifndef NO_JECXZ_SUPPORT + jecxz .L_bail /* > if (len) */ +#else + testl %ecx, %ecx /* > if (len) */ + jz .L_bail +#endif +/* align loop head at start of 486 internal cache line !! */ + ALIGNMENT +.L_loupe: /* > do { */ + Do_CRC_byte /* c = CRC32(c, *buf++); */ + decl %ecx /* > } while (--len); */ + jnz .L_loupe + +.L_bail: /* > } */ + notl %eax /* > return ~c; */ +.L_fine: + popl %ecx + popl %edx + popl %ebx + popl %esi + popl %edi + _STD_LEAVE + ret + +#else + error: this asm version is for 386 only +#endif /* i386 || _i386 || _I386 || __i386 */ + +#endif /* !USE_ZLIB */ diff --git a/utils/Install/sfxzip/crc_i386.asm b/utils/Install/sfxzip/crc_i386.asm new file mode 100644 index 0000000000..ea29282286 --- /dev/null +++ b/utils/Install/sfxzip/crc_i386.asm @@ -0,0 +1,229 @@ +; crc_i386.asm, optimized CRC calculation function for Zip and UnZip, not +; copyrighted by Paul Kienitz and Christian Spieler. Last revised 25 Mar 98. +; +; Revised 06-Oct-96, Scott Field (sfield@microsoft.com) +; fixed to assemble with masm by not using .model directive which makes +; assumptions about segment alignment. Also, +; avoid using loop, and j[e]cxz where possible. Use mov + inc, rather +; than lodsb, and other misc. changes resulting in the following performance +; increases: +; +; unrolled loops NO_UNROLLED_LOOPS +; *8 >8 <8 *8 >8 <8 +; +; +54% +42% +35% +82% +52% +25% +; +; first item in each table is input buffer length, even multiple of 8 +; second item in each table is input buffer length, > 8 +; third item in each table is input buffer length, < 8 +; +; Revised 02-Apr-97, Chr. Spieler, based on Rodney Brown (rdb@cmutual.com.au) +; Incorporated Rodney Brown's 32-bit-reads optimization as found in the +; UNIX AS source crc_i386.S. This new code can be disabled by defining +; the macro symbol NO_32_BIT_LOADS. +; +; Revised 12-Oct-97, Chr. Spieler, based on Rodney Brown (rdb@cmutual.com.au) +; Incorporated Rodney Brown's additional tweaks for 32-bit-optimized CPUs +; (like the Pentium Pro, Pentium II, and probably some Pentium clones). +; This optimization is controlled by the macro symbol __686 and is disabled +; by default. (This default is based on the assumption that most users +; do not yet work on a Pentium Pro or Pentium II machine ...) +; +; FLAT memory model assumed. +; +; The loop unrolling can be disabled by defining the macro NO_UNROLLED_LOOPS. +; This results in shorter code at the expense of reduced performance. +; +; Revised 25-Mar-98, Cosmin Truta (cosmint@cs.ubbcluj.ro) +; Working without .model directive caused tasm32 version 5.0 to produce +; bad object code. The optimized alignments can be optionally disabled +; by defining NO_ALIGN, thus allowing to use .model flat. There is no need +; to define this macro if using other version of tasm. +; +;============================================================================== +; +; Do NOT assemble this source if external crc32 routine from zlib gets used. +; + IFNDEF USE_ZLIB +; + .386p + name crc_i386 + + IFDEF NO_ALIGN + .model flat + ENDIF + +extrn _get_crc_table:near ; ZCONST ulg near *get_crc_table(void); + +; + IFNDEF NO_STD_STACKFRAME + ; Use a `standard' stack frame setup on routine entry and exit. + ; Actually, this option is set as default, because it results + ; in smaller code !! +STD_ENTRY MACRO + push ebp + mov ebp,esp + ENDM + + Arg1 EQU 08H[ebp] + Arg2 EQU 0CH[ebp] + Arg3 EQU 10H[ebp] + +STD_LEAVE MACRO + pop ebp + ENDM + + ELSE ; NO_STD_STACKFRAME + +STD_ENTRY MACRO + ENDM + + Arg1 EQU 18H[esp] + Arg2 EQU 1CH[esp] + Arg3 EQU 20H[esp] + +STD_LEAVE MACRO + ENDM + + ENDIF ; ?NO_STD_STACKFRAME + +; These two (three) macros make up the loop body of the CRC32 cruncher. +; registers modified: +; eax : crc value "c" +; esi : pointer to next data byte (or dword) "buf++" +; registers read: +; edi : pointer to base of crc_table array +; scratch registers: +; ebx : index into crc_table array +; (requires upper three bytes = 0 when __686 is undefined) + IFNDEF __686 ; optimize for 386, 486, Pentium +Do_CRC MACRO + mov bl,al ; tmp = c & 0xFF + shr eax,8 ; c = (c >> 8) + xor eax,[edi+ebx*4] ; ^ table[tmp] + ENDM + ELSE ; __686 : optimize for Pentium Pro, Pentium II and compatible CPUs +Do_CRC MACRO + movzx ebx,al ; tmp = c & 0xFF + shr eax,8 ; c = (c >> 8) + xor eax,[edi+ebx*4] ; ^ table[tmp] + ENDM + ENDIF ; ?__686 +Do_CRC_byte MACRO + xor al, byte ptr [esi] ; c ^= *buf + inc esi ; buf++ + Do_CRC ; c = (c >> 8) ^ table[c & 0xFF] + ENDM + IFNDEF NO_32_BIT_LOADS +Do_CRC_dword MACRO + xor eax, dword ptr [esi] ; c ^= *(ulg *)buf + add esi, 4 ; ((ulg *)buf)++ + Do_CRC + Do_CRC + Do_CRC + Do_CRC + ENDM + ENDIF ; !NO_32_BIT_LOADS + + IFNDEF NO_ALIGN +_TEXT segment use32 para public 'CODE' + ELSE +_TEXT segment use32 + ENDIF + assume CS: _TEXT + + public _crc32 +_crc32 proc near ; ulg crc32(ulg crc, ZCONST uch *buf, extent len) + STD_ENTRY + push edi + push esi + push ebx + push edx + push ecx + + mov esi,Arg2 ; 2nd arg: uch *buf + sub eax,eax ;> if (!buf) + test esi,esi ;> return 0; + jz fine ;> else { + + call _get_crc_table + mov edi,eax + mov eax,Arg1 ; 1st arg: ulg crc + IFNDEF __686 + sub ebx,ebx ; ebx=0; make bl usable as a dword + ENDIF + mov ecx,Arg3 ; 3rd arg: extent len + not eax ;> c = ~crc; + + IFNDEF NO_UNROLLED_LOOPS + IFNDEF NO_32_BIT_LOADS + test ecx,ecx + je bail +align_loop: + test esi,3 ; align buf pointer on next + jz SHORT aligned_now ; dword boundary + Do_CRC_byte + dec ecx + jnz align_loop +aligned_now: + ENDIF ; !NO_32_BIT_LOADS + mov edx,ecx ; save len in edx + and edx,000000007H ; edx = len % 8 + shr ecx,3 ; ecx = len / 8 + jz SHORT No_Eights + IFNDEF NO_ALIGN +; align loop head at start of 486 internal cache line !! + align 16 + ENDIF +Next_Eight: + IFNDEF NO_32_BIT_LOADS + Do_CRC_dword + Do_CRC_dword + ELSE ; NO_32_BIT_LOADS + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + Do_CRC_byte + ENDIF ; ?NO_32_BIT_LOADS + dec ecx + jnz Next_Eight +No_Eights: + mov ecx,edx + + ENDIF ; NO_UNROLLED_LOOPS + IFNDEF NO_JECXZ_SUPPORT + jecxz bail ;> if (len) + ELSE + test ecx,ecx ;> if (len) + jz SHORT bail + ENDIF + IFNDEF NO_ALIGN +; align loop head at start of 486 internal cache line !! + align 16 + ENDIF +loupe: ;> do { + Do_CRC_byte ; c = CRC32(c, *buf++); + dec ecx ;> } while (--len); + jnz loupe + +bail: ;> } + not eax ;> return ~c; +fine: + pop ecx + pop edx + pop ebx + pop esi + pop edi + STD_LEAVE + ret +_crc32 endp + +_TEXT ends +; + ENDIF ; !USE_ZLIB +; +end diff --git a/utils/Install/sfxzip/crc_i386.c b/utils/Install/sfxzip/crc_i386.c new file mode 100644 index 0000000000..72e2c6b9dc --- /dev/null +++ b/utils/Install/sfxzip/crc_i386.c @@ -0,0 +1,215 @@ +/* crc_i386.c -- Microsoft 32-bit C/C++ adaptation of crc_i386.asm + * Created by Rodney Brown from crc_i386.asm, modified by Chr. Spieler. + * Last revised: 22-Mai-1998 + * + * Original coded (in crc_i386.asm) and put into the public domain + * by Paul Kienitz and Christian Spieler. + * + * Revised 06-Oct-96, Scott Field (sfield@microsoft.com) + * fixed to assemble with masm by not using .model directive which makes + * assumptions about segment alignment. Also, + * avoid using loop, and j[e]cxz where possible. Use mov + inc, rather + * than lodsb, and other misc. changes resulting in the following performance + * increases: + * + * unrolled loops NO_UNROLLED_LOOPS + * *8 >8 <8 *8 >8 <8 + * + * +54% +42% +35% +82% +52% +25% + * + * first item in each table is input buffer length, even multiple of 8 + * second item in each table is input buffer length, > 8 + * third item in each table is input buffer length, < 8 + * + * Revised 02-Apr-97, Chr. Spieler, based on Rodney Brown (rdb@cmutual.com.au) + * Incorporated Rodney Brown's 32-bit-reads optimization as found in the + * UNIX AS source crc_i386.S. This new code can be disabled by defining + * the macro symbol NO_32_BIT_LOADS. + * + * Revised 12-Oct-97, Chr. Spieler, based on Rodney Brown (rdb@cmutual.com.au) + * Incorporated Rodney Brown's additional tweaks for 32-bit-optimized CPUs + * (like the Pentium Pro, Pentium II, and probably some Pentium clones). + * This optimization is controlled by the macro symbol __686 and is disabled + * by default. (This default is based on the assumption that most users + * do not yet work on a Pentium Pro or Pentium II machine ...) + * + * Revised 16-Nov-97, Chr. Spieler: Made code compatible with Borland C++ + * 32-bit, removed unneeded kludge for potentially unknown movzx mnemonic, + * confirmed correct working with MS VC++ (32-bit). + * + * Revised 22-Mai-98, Peter Kunath, Chr. Spieler : The 16-Nov-97 revision broke + * MSVC 5.0. Inside preprocessor macros, each instruction is enclosed in its + * own __asm {...} construct. For MSVC, a "#pragma warning" was added to + * shut up the "no return value" warning message. + * + * FLAT memory model assumed. + * + * The loop unrolling can be disabled by defining the macro NO_UNROLLED_LOOPS. + * This results in shorter code at the expense of reduced performance. + * + */ + +#include "zip.h" + +#ifndef USE_ZLIB + +#ifndef ZCONST +# define ZCONST const +#endif + +/* Select wether the following inline-assember code is supported. */ +#if (defined(_MSC_VER) && _MSC_VER >= 700) +#if (defined(_M_IX86) && _M_IX86 >= 300) +# define MSC_INLINE_ASM_32BIT_SUPPORT + /* Disable warning for no return value, typical of asm functions */ +# pragma warning( disable : 4035 ) +#endif +#endif + +#if (defined(__BORLANDC__) && __BORLANDC__ >= 452) +# define MSC_INLINE_ASM_32BIT_SUPPORT +#endif + +#ifdef MSC_INLINE_ASM_32BIT_SUPPORT +/* This code is intended for Microsoft C/C++ (32-bit) compatible compilers. */ + +/* + * These two (three) macros make up the loop body of the CRC32 cruncher. + * registers modified: + * eax : crc value "c" + * esi : pointer to next data byte (or dword) "buf++" + * registers read: + * edi : pointer to base of crc_table array + * scratch registers: + * ebx : index into crc_table array + * (requires upper three bytes = 0 when __686 is undefined) + */ +#ifndef __686 +#define Do_CRC { \ + __asm { mov bl, al }; \ + __asm { shr eax, 8 }; \ + __asm { xor eax, [edi+ebx*4] }; } +#else /* __686 */ +#define Do_CRC { \ + __asm { movzx ebx, al }; \ + __asm { shr eax, 8 }; \ + __asm { xor eax, [edi+ebx*4] }; } +#endif /* ?__686 */ + +#define Do_CRC_byte { \ + __asm { xor al, byte ptr [esi] }; \ + __asm { inc esi }; \ + Do_CRC; } + +#ifndef NO_32_BIT_LOADS +#define Do_CRC_dword { \ + __asm { xor eax, dword ptr [esi] }; \ + __asm { add esi, 4 }; \ + Do_CRC; \ + Do_CRC; \ + Do_CRC; \ + Do_CRC; } +#endif /* !NO_32_BIT_LOADS */ + +/* ========================================================================= */ +ulg crc32(crc, buf, len) + ulg crc; /* crc shift register */ + ZCONST uch *buf; /* pointer to bytes to pump through */ + extent len; /* number of bytes in buf[] */ +/* Run a set of bytes through the crc shift register. If buf is a NULL + pointer, then initialize the crc shift register contents instead. + Return the current crc in either case. */ +{ + __asm { + push edx + push ecx + + mov esi,buf ;/* 2nd arg: uch *buf */ + sub eax,eax ;/*> if (!buf) */ + test esi,esi ;/*> return 0; */ + jz fine ;/*> else { */ + + call get_crc_table + mov edi,eax + mov eax,crc ;/* 1st arg: ulg crc */ +#ifndef __686 + sub ebx,ebx ;/* ebx=0; => bl usable as a dword */ +#endif + mov ecx,len ;/* 3rd arg: extent len */ + not eax ;/*> c = ~crc; */ + +#ifndef NO_UNROLLED_LOOPS +# ifndef NO_32_BIT_LOADS + test ecx,ecx + je bail +align_loop: + test esi,3 ;/* align buf pointer on next */ + jz aligned_now ;/* dword boundary */ + } + Do_CRC_byte ; + __asm { + dec ecx + jnz align_loop +aligned_now: +# endif /* !NO_32_BIT_LOADS */ + mov edx,ecx ;/* save len in edx */ + and edx,000000007H ;/* edx = len % 8 */ + shr ecx,3 ;/* ecx = len / 8 */ + jz No_Eights +; align loop head at start of 486 internal cache line !! + align 16 +Next_Eight: + } +# ifndef NO_32_BIT_LOADS + Do_CRC_dword ; + Do_CRC_dword ; +# else /* NO_32_BIT_LOADS */ + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; + Do_CRC_byte ; +# endif /* ?NO_32_BIT_LOADS */ + __asm { + dec ecx + jnz Next_Eight +No_Eights: + mov ecx,edx + +#endif /* NO_UNROLLED_LOOPS */ +#ifndef NO_JECXZ_SUPPORT + jecxz bail ;/*> if (len) */ +#else + test ecx,ecx ;/*> if (len) */ + jz bail +#endif +; align loop head at start of 486 internal cache line !! + align 16 +loupe: ;/*> do { */ + } + Do_CRC_byte ;/* c = CRC32(c, *buf++); */ + __asm { + dec ecx ;/*> } while (--len); */ + jnz loupe + +bail: ;/*> } */ + not eax ;/*> return ~c; */ +fine: + pop ecx + pop edx + } +#ifdef NEED_RETURN + return _EAX; +#endif +} +#endif /* MSC_INLINE_ASM_32BIT_SUPPORT */ +#if (defined(_MSC_VER) && _MSC_VER >= 700) +#if (defined(_M_IX86) && _M_IX86 >= 300) + /* Reenable missing return value warning */ +# pragma warning( default : 4035 ) +#endif +#endif +#endif /* !USE_ZLIB */ diff --git a/utils/Install/sfxzip/crc_lcc.asm b/utils/Install/sfxzip/crc_lcc.asm new file mode 100644 index 0000000000..b3288a833e --- /dev/null +++ b/utils/Install/sfxzip/crc_lcc.asm @@ -0,0 +1,108 @@ +; crc_lcc.asm, optimized CRC calculation function for Zip and UnZip, not +; copyrighted by Paul Kienitz and Christian Spieler. Last revised 25 Mar 98. +; +; The code in this file has been copied verbatim from crc_i386.{asm|S}; +; only the assembler syntax and metacommands have been adapted to +; the habits of the free LCC-Win32 C compiler package. +; This version of the code uses the "optimized for i686" variant of +; crc_i386.{asm|S}. +; +; For more information (and a revision log), look into the original +; source files. +; + .text + .file "crc32.c" + .text + .type _crc32,function +_crc32: + pushl %ebp + movl %esp,%ebp + pushl %ecx + pushl %ebx + pushl %esi + pushl %edi + .line 34 + .line 37 + movl 12(%ebp),%esi + subl %eax,%eax + testl %esi,%esi + jz _$3 + .line 39 + call _get_crc_table + movl %eax,%edi + .line 41 + movl 8(%ebp),%eax + movl 16(%ebp),%ecx + notl %eax + testl %ecx,%ecx + jz _$4 +_$5: + testl $3,%esi + jz _$6 + xorb (%esi),%al + incl %esi + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + decl %ecx + jnz _$5 +_$6: + movl %ecx,%edx + andl $7,%edx + shrl $3,%ecx + jz _$8 +_$7: + xorl (%esi),%eax + addl $4,%esi + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + xorl (%esi),%eax + addl $4,%esi + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + decl %ecx + jnz _$7 +_$8: + movl %edx,%ecx + jecxz _$4 +_$9: + xorb (%esi),%al + incl %esi + movzbl %al,%ebx + shrl $8,%eax + xorl (%edi,%ebx,4),%eax + decl %ecx + jnz _$9 +_$4: + xorl $0xffffffff,%eax +_$3: + .line 52 + popl %edi + popl %esi + popl %ebx + leave + ret +_$34: + .size _crc32,_$34-_crc32 + .globl _crc32 + .extern _get_crc_table diff --git a/utils/Install/sfxzip/crctab.c b/utils/Install/sfxzip/crctab.c new file mode 100644 index 0000000000..2f80aa2cfa --- /dev/null +++ b/utils/Install/sfxzip/crctab.c @@ -0,0 +1,219 @@ +/* crctab.c -- supply the CRC table needed for CRC-32 calculations. + * Copyright (C) 1995 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* $Id$ */ + +/* + Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The table is simply the CRC of all possible eight bit values. This is all + the information needed to generate CRC's on data a byte at a time for all + combinations of CRC register values and incoming bytes. +*/ + +#define __CRCTAB_C /* identifies this source module */ + +#include "zip.h" + +#if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB)) + +#ifndef ZCONST +# define ZCONST const +#endif + +#ifdef DYNAMIC_CRC_TABLE + +/* ========================================================================= + * Make the crc table. This function is needed only if you want to compute + * the table dynamically. + */ + +local void make_crc_table OF((void)); + +#if (defined(DYNALLOC_CRCTAB) && defined(REENTRANT)) + error: Dynamic allocation of CRC table not safe with reentrant code. +#endif /* DYNALLOC_CRCTAB && REENTRANT */ + +#ifdef DYNALLOC_CRCTAB + local ulg near *crc_table = NULL; +# if 0 /* not used, since sizeof("near *") <= sizeof(int) */ + /* Use this section when access to a "local int" is faster than access to + a "local pointer" (e.g.: i86 16bit code with far pointers). */ + local int crc_table_empty = 1; +# define CRC_TABLE_IS_EMPTY (crc_table_empty != 0) +# define MARK_CRCTAB_FILLED crc_table_empty = 0 +# define MARK_CRCTAB_EMPTY crc_table_empty = 1 +# else + /* Use this section on systems where the size of pointers and ints is + equal (e.g.: all 32bit systems). */ +# define CRC_TABLE_IS_EMPTY (crc_table == NULL) +# define MARK_CRCTAB_FILLED crc_table = crctab_p +# define MARK_CRCTAB_EMPTY crc_table = NULL +# endif +#else /* !DYNALLOC_CRCTAB */ + local ulg near crc_table[256]; + local int crc_table_empty = 1; +# define CRC_TABLE_IS_EMPTY (crc_table_empty != 0) +# define MARK_CRCTAB_FILLED crc_table_empty = 0 +#endif /* ?DYNALLOC_CRCTAB */ + + +local void make_crc_table() +{ + ulg c; /* crc shift register */ + int n; /* counter for all possible eight bit values */ + int k; /* byte being shifted into crc apparatus */ +#ifdef DYNALLOC_CRCTAB + ulg near *crctab_p; /* temporary pointer to allocated crc_table area */ +#else /* !DYNALLOC_CRCTAB */ +# define crctab_p crc_table +#endif /* DYNALLOC_CRCTAB */ + +#ifdef COMPUTE_XOR_PATTERN + /* This piece of code has been left here to explain how the XOR pattern + * used in the creation of the crc_table values can be recomputed. + * For production versions of this function, it is more efficient to + * supply the resultant pattern at compile time. + */ + ulg xor; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static uch p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* make exclusive-or pattern from polynomial (0xedb88320L) */ + xor = 0L; + for (i = 0; i < sizeof(p)/sizeof(uch); i++) + xor |= 1L << (31 - p[i]); +#else +# define xor 0xedb88320L +#endif + +#ifdef DYNALLOC_CRCTAB + crctab_p = (ulg near *) nearmalloc (256*sizeof(ulg)); + if (crctab_p == NULL) { + ziperr(ZE_MEM, "crc_table allocation"); + } +#endif /* DYNALLOC_CRCTAB */ + + for (n = 0; n < 256; n++) { + c = (ulg)n; + for (k = 8; k; k--) + c = c & 1 ? xor ^ (c >> 1) : c >> 1; + crctab_p[n] = c; + } + MARK_CRCTAB_FILLED; +} + +#else /* !DYNAMIC_CRC_TABLE */ + +#ifdef DYNALLOC_CRCTAB + error: Inconsistent flags, DYNALLOC_CRCTAB without DYNAMIC_CRC_TABLE. +#endif + +/* ======================================================================== + * Table of CRC-32's of all single-byte values (made by make_crc_table) + */ +local ZCONST ulg near crc_table[256] = { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL +}; +#endif /* ?DYNAMIC_CRC_TABLE */ + +/* use "OF((void))" here to work around a Borland TC++ 1.0 problem */ +#ifdef USE_ZLIB +ZCONST uLongf *get_crc_table OF((void)) +#else +ZCONST ulg near *get_crc_table OF((void)) +#endif +{ +#ifdef DYNAMIC_CRC_TABLE + if (CRC_TABLE_IS_EMPTY) + make_crc_table(); +#endif +#ifdef USE_ZLIB + return (ZCONST uLongf *)crc_table; +#else + return (ZCONST ulg near *)crc_table; +#endif +} + +#ifdef DYNALLOC_CRCTAB +void free_crc_table() +{ + if (!CRC_TABLE_IS_EMPTY) + { + nearfree((ulg near *)crc_table); + MARK_CRCTAB_EMPTY; + } +} +#endif + +#endif /* !USE_ZLIB || USE_OWN_CRCTAB */ diff --git a/utils/Install/sfxzip/crypt.c b/utils/Install/sfxzip/crypt.c new file mode 100644 index 0000000000..0dbe227f81 --- /dev/null +++ b/utils/Install/sfxzip/crypt.c @@ -0,0 +1,12 @@ +/* + crypt.c (dummy version) by Info-ZIP. Last revised: 15 Aug 98 + + This is a non-functional version of Info-ZIP's crypt.c encryption/ + decryption code for Zip, ZipCloak, UnZip and fUnZip. This file is + not copyrighted and may be distributed freely. :-) See the "WHERE" + file for sites from which to obtain the full encryption/decryption + sources (zcrypt28.zip or later). + */ + +/* something "externally visible" to shut up compiler/linker warnings */ +int zcr_dummy; diff --git a/utils/Install/sfxzip/envargs.c b/utils/Install/sfxzip/envargs.c new file mode 100644 index 0000000000..76a41e8997 --- /dev/null +++ b/utils/Install/sfxzip/envargs.c @@ -0,0 +1,314 @@ +/*----------------------------------------------------------------* + | envargs - add default options from environment to command line + |---------------------------------------------------------------- + | Author: Bill Davidsen, original 10/13/91, revised 23 Oct 1991. + | This program is in the public domain. + |---------------------------------------------------------------- + | Minor program notes: + | 1. Yes, the indirection is a tad complex + | 2. Parentheses were added where not needed in some cases + | to make the action of the code less obscure. + |---------------------------------------------------------------- + | UnZip notes: 24 May 92 ("v1.4"): + | 1. #include "unzip.h" for prototypes (24 May 92) + | 2. changed ch to type char (24 May 92) + | 3. added an ifdef to avoid Borland warnings (24 May 92) + | 4. included Rich Wales' mksargs() routine (for MS-DOS, maybe + | OS/2? NT?) (4 Dec 93) + | 5. added alternate-variable string envstr2 (21 Apr 94) + | 6. added support for quoted arguments (6 Jul 96) + *----------------------------------------------------------------*/ + + +#define ENVARGS_C +#define UNZIP_INTERNAL +#include "unzip.h" + +#ifdef __EMX__ /* emx isspace() returns TRUE on extended ASCII !! */ +# define ISspace(c) ((c) & 0x80 ? 0 : isspace((unsigned)c)) +#else +# define ISspace(c) isspace((unsigned)c) +#endif /* ?__EMX__ */ + +static int count_args OF((ZCONST char *)); +static void mem_err OF((__GPRO)); + +static ZCONST char Far NoMemArguments[] = + "envargs: cannot get memory for arguments"; + + +void envargs(__G__ Pargc, Pargv, envstr, envstr2) + __GDEF + int *Pargc; + char ***Pargv; + ZCONST char *envstr, *envstr2; +{ +#ifndef RISCOS + char *getenv(); +#endif + char *envptr; /* value returned by getenv */ + char *bufptr; /* copy of env info */ + int argc = 0; /* internal arg count */ + register int ch; /* spare temp value */ + char **argv; /* internal arg vector */ + char **argvect; /* copy of vector address */ + + /* see if anything in the environment */ + if ((envptr = getenv(envstr)) != (char *)NULL) /* usual var */ + while (ISspace(*envptr)) /* must discard leading spaces */ + envptr++; + if (envptr == (char *)NULL || *envptr == '\0') + if ((envptr = getenv(envstr2)) != (char *)NULL) /* alternate var */ + while (ISspace(*envptr)) + envptr++; + if (envptr == (char *)NULL || *envptr == '\0') + return; + + bufptr = malloc(1 + strlen(envptr)); + if (bufptr == (char *)NULL) + mem_err(__G); +#if (defined(WIN32) || defined(WINDLL)) +# ifdef WIN32 + if (IsWinNT()) { + /* SPC: don't know codepage of 'real' WinNT console */ + strcpy(bufptr, envptr); + } else { + /* Win95 environment is DOS and uses OEM character coding */ + OEM_TO_INTERN(envptr, bufptr); + } +# else /* !WIN32 */ + /* DOS environment uses OEM codepage */ + OEM_TO_INTERN(envptr, bufptr); +# endif +#else /* !(WIN32 || WINDLL) */ + strcpy(bufptr, envptr); +#endif /* ?(WIN32 || WINDLL) */ + + /* count the args so we can allocate room for them */ + argc = count_args(bufptr); + /* allocate a vector large enough for all args */ + argv = (char **)malloc((argc + *Pargc + 1) * sizeof(char *)); + if (argv == (char **)NULL) { + free(bufptr); + mem_err(__G); + } + argvect = argv; + + /* copy the program name first, that's always true */ + *(argv++) = *((*Pargv)++); + + /* copy the environment args next, may be changed */ + do { +#if defined(AMIGA) || defined(UNIX) + if (*bufptr == '"') { + char *argstart = ++bufptr; + + *(argv++) = argstart; + for (ch = *bufptr; ch != '\0' && ch != '\"'; ch = *(++bufptr)) + if (ch == '\\' && bufptr[1] != '\0') + ++bufptr; /* skip char after backslash */ + if (ch != '\0') + *(bufptr++) = '\0'; /* overwrite trailing " */ + + /* remove escape characters */ + while ((argstart = strchr(argstart, '\\')) != (char *)NULL) { + strcpy(argstart, argstart + 1); + if (*argstart) + ++argstart; + } + } else { + *(argv++) = bufptr; + while ((ch = *bufptr) != '\0' && !ISspace(ch)) + ++bufptr; + if (ch != '\0') + *(bufptr++) = '\0'; + } +#else +#ifdef DOS_FLX_OS2_W32 + /* we do not support backslash-quoting of quotes in quoted + * strings under DOS_OS2_W32, because backslashes are directory + * separators and double quotes are illegal in filenames */ + if (*bufptr == '"') { + *(argv++) = ++bufptr; + while ((ch = *bufptr) != '\0' && ch != '\"') + ++bufptr; + if (ch != '\0') + *(bufptr++) = '\0'; + } else { + *(argv++) = bufptr; + while ((ch = *bufptr) != '\0' && !ISspace(ch)) + ++bufptr; + if (ch != '\0') + *(bufptr++) = '\0'; + } +#else + *(argv++) = bufptr; + while ((ch = *bufptr) != '\0' && !ISspace(ch)) + ++bufptr; + if (ch != '\0') + *(bufptr++) = '\0'; +#endif /* ?DOS_FLX_OS2_W32 */ +#endif /* ?(AMIGA || UNIX) */ + while ((ch = *bufptr) != '\0' && ISspace(ch)) + ++bufptr; + } while (ch); + + /* now save old argc and copy in the old args */ + argc += *Pargc; + while (--(*Pargc)) + *(argv++) = *((*Pargv)++); + + /* finally, add a NULL after the last arg, like Unix */ + *argv = (char *)NULL; + + /* save the values and return */ + *Pargv = argvect; + *Pargc = argc; +} + + + +static int count_args(s) + ZCONST char *s; +{ + int count = 0; + char ch; + + do { + /* count and skip args */ + ++count; +#if defined(AMIGA) || defined(UNIX) + if (*s == '\"') { + for (ch = *(++s); ch != '\0' && ch != '\"'; ch = *(++s)) + if (ch == '\\' && s[1] != '\0') + ++s; + if (*s) + ++s; /* trailing quote */ + } else +#else +#ifdef DOS_FLX_OS2_W32 + if (*s == '\"') { + ++s; /* leading quote */ + while ((ch = *s) != '\0' && ch != '\"') + ++s; + if (*s) + ++s; /* trailing quote */ + } else +#endif /* DOS_FLX_OS2_W32 */ +#endif /* ?(AMIGA || UNIX) */ + while ((ch = *s) != '\0' && !ISspace(ch)) /* note else-clauses above */ + ++s; + while ((ch = *s) != '\0' && ISspace(ch)) + ++s; + } while (ch); + + return count; +} + + + +static void mem_err(__G) + __GDEF +{ + perror(LoadFarString(NoMemArguments)); + DESTROYGLOBALS() + EXIT(PK_MEM); +} + + + +#ifdef TEST + +main(argc, argv) + int argc; + char **argv; +{ + int i; + + pipeit("Orig argv: %p\n", argv); + dump_args(argc, argv); + envargs(__G__ &argc, &argv, "ENVTEST"); + pipeit(" New argv: %p\n", argv); + dump_args(argc, argv); +} + + + +dump_args(argc, argv) + int argc; + char *argv[]; +{ + int i; + + pipeit("\nDump %d args:\n", argc); + for (i = 0; i < argc; ++i) + pipeit("%3d %s\n", i, argv[i]); +} + +#endif /* TEST */ + + + +#ifdef MSDOS /* DOS_OS2? DOS_OS2_W32? */ + +/* + * void mksargs(int *argcp, char ***argvp) + * + * Substitutes the extended command line argument list produced by + * the MKS Korn Shell in place of the command line info from DOS. + * + * The MKS shell gets around DOS's 128-byte limit on the length of + * a command line by passing the "real" command line in the envi- + * ronment. The "real" arguments are flagged by prepending a tilde + * (~) to each one. + * + * This "mksargs" routine creates a new argument list by scanning + * the environment from the beginning, looking for strings begin- + * ning with a tilde character. The new list replaces the original + * "argv" (pointed to by "argvp"), and the number of arguments + * in the new list replaces the original "argc" (pointed to by + * "argcp"). + * + * Rich Wales + */ +void mksargs(argcp, argvp) + int *argcp; + char ***argvp; +{ +#ifndef MSC /* declared differently in MSC 7.0 headers, at least */ +#ifndef __WATCOMC__ + extern char **environ; /* environment */ +#endif +#endif + char **envp; /* pointer into environment */ + char **newargv; /* new argument list */ + char **argp; /* pointer into new arg list */ + int newargc; /* new argument count */ + + /* sanity check */ + if (environ == NULL || argcp == NULL || argvp == NULL || *argvp == NULL) + return; + + /* find out how many environment arguments there are */ + for (envp = environ, newargc = 0; *envp != NULL && (*envp)[0] == '~'; + envp++, newargc++) + ; + if (newargc == 0) + return; /* no environment arguments */ + + /* set up new argument list */ + newargv = (char **) malloc(sizeof(char **) * (newargc+1)); + if (newargv == NULL) + return; /* malloc failed */ + + for (argp = newargv, envp = environ; *envp != NULL && (*envp)[0] == '~'; + *argp++ = &(*envp++)[1]) + ; + *argp = NULL; /* null-terminate the list */ + + /* substitute new argument list in place of old one */ + *argcp = newargc; + *argvp = newargv; +} + +#endif /* MSDOS */ diff --git a/utils/Install/sfxzip/explode.c b/utils/Install/sfxzip/explode.c new file mode 100644 index 0000000000..c1a8f80032 --- /dev/null +++ b/utils/Install/sfxzip/explode.c @@ -0,0 +1,871 @@ +/* explode.c -- put in the public domain by Mark Adler + version c15, 6 July 1996 */ + + +/* You can do whatever you like with this source file, though I would + prefer that if you modify it and redistribute it that you include + comments to that effect with your name and the date. Thank you. + + History: + vers date who what + ---- --------- -------------- ------------------------------------ + c1 30 Mar 92 M. Adler explode that uses huft_build from inflate + (this gives over a 70% speed improvement + over the original unimplode.c, which + decoded a bit at a time) + c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k. + c3 10 Apr 92 M. Adler added a little memory tracking if DEBUG + c4 11 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy() + c5 21 Apr 92 M. Adler added the WSIZE #define to allow reducing + the 32K window size for specialized + applications. + c6 31 May 92 M. Adler added typecasts to eliminate some warnings + c7 27 Jun 92 G. Roelofs added more typecasts. + c8 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch. + c9 19 Jul 93 J. Bush added more typecasts (to return values); + made l[256] array static for Amiga. + c10 8 Oct 93 G. Roelofs added used_csize for diagnostics; added + buf and unshrink arguments to flush(); + undef'd various macros at end for Turbo C; + removed NEXTBYTE macro (now in unzip.h) + and bytebuf variable (not used); changed + memset() to memzero(). + c11 9 Jan 94 M. Adler fixed incorrect used_csize calculation. + c12 9 Apr 94 G. Roelofs fixed split comments on preprocessor lines + to avoid bug in Encore compiler. + c13 25 Aug 94 M. Adler fixed distance-length comment (orig c9 fix) + c14 22 Nov 95 S. Maxwell removed unnecessary "static" on auto array + c15 6 Jul 96 W. Haidinger added ulg typecasts to flush() calls. + c16 8 Feb 98 C. Spieler added ZCONST modifiers to const tables + and #ifdef DEBUG around debugging code. + c16b 25 Mar 98 C. Spieler modified DLL code for slide redirection. + */ + + +/* + Explode imploded (PKZIP method 6 compressed) data. This compression + method searches for as much of the current string of bytes (up to a length + of ~320) in the previous 4K or 8K bytes. If it doesn't find any matches + (of at least length 2 or 3), it codes the next byte. Otherwise, it codes + the length of the matched string and its distance backwards from the + current position. Single bytes ("literals") are preceded by a one (a + single bit) and are either uncoded (the eight bits go directly into the + compressed stream for a total of nine bits) or Huffman coded with a + supplied literal code tree. If literals are coded, then the minimum match + length is three, otherwise it is two. + + There are therefore four kinds of imploded streams: 8K search with coded + literals (min match = 3), 4K search with coded literals (min match = 3), + 8K with uncoded literals (min match = 2), and 4K with uncoded literals + (min match = 2). The kind of stream is identified in two bits of a + general purpose bit flag that is outside of the compressed stream. + + Distance-length pairs for matched strings are preceded by a zero bit (to + distinguish them from literals) and are always coded. The distance comes + first and is either the low six (4K) or low seven (8K) bits of the + distance (uncoded), followed by the high six bits of the distance coded. + Then the length is six bits coded (0..63 + min match length), and if the + maximum such length is coded, then it's followed by another eight bits + (uncoded) to be added to the coded length. This gives a match length + range of 2..320 or 3..321 bytes. + + The literal, length, and distance codes are all represented in a slightly + compressed form themselves. What is sent are the lengths of the codes for + each value, which is sufficient to construct the codes. Each byte of the + code representation is the code length (the low four bits representing + 1..16), and the number of values sequentially with that length (the high + four bits also representing 1..16). There are 256 literal code values (if + literals are coded), 64 length code values, and 64 distance code values, + in that order at the beginning of the compressed stream. Each set of code + values is preceded (redundantly) with a byte indicating how many bytes are + in the code description that follows, in the range 1..256. + + The codes themselves are decoded using tables made by huft_build() from + the bit lengths. That routine and its comments are in the inflate.c + module. + */ + +#define UNZIP_INTERNAL +#include "unzip.h" /* must supply slide[] (uch) array and NEXTBYTE macro */ + +#ifndef WSIZE +# define WSIZE 0x8000 /* window size--must be a power of two, and */ +#endif /* at least 8K for zip's implode method */ + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) +# define wsize G._wsize +#else +# define wsize WSIZE +#endif + +/* routines here */ +static int get_tree OF((__GPRO__ unsigned *l, unsigned n)); +static int explode_lit8 OF((__GPRO__ struct huft *tb, struct huft *tl, + struct huft *td, int bb, int bl, int bd)); +static int explode_lit4 OF((__GPRO__ struct huft *tb, struct huft *tl, + struct huft *td, int bb, int bl, int bd)); +static int explode_nolit8 OF((__GPRO__ struct huft *tl, struct huft *td, + int bl, int bd)); +static int explode_nolit4 OF((__GPRO__ struct huft *tl, struct huft *td, + int bl, int bd)); +int explode OF((__GPRO)); + + +/* The implode algorithm uses a sliding 4K or 8K byte window on the + uncompressed stream to find repeated byte strings. This is implemented + here as a circular buffer. The index is updated simply by incrementing + and then and'ing with 0x0fff (4K-1) or 0x1fff (8K-1). Here, the 32K + buffer of inflate is used, and it works just as well to always have + a 32K circular buffer, so the index is anded with 0x7fff. This is + done to allow the window to also be used as the output buffer. */ +/* This must be supplied in an external module useable like "uch slide[8192];" + or "uch *slide;", where the latter would be malloc'ed. In unzip, slide[] + is actually a 32K area for use by inflate, which uses a 32K sliding window. + */ + + +/* Tables for length and distance */ +static ZCONST ush cplen2[] = + {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65}; +static ZCONST ush cplen3[] = + {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66}; +static ZCONST ush extra[] = + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8}; +static ZCONST ush cpdist4[] = + {1, 65, 129, 193, 257, 321, 385, 449, 513, 577, 641, 705, + 769, 833, 897, 961, 1025, 1089, 1153, 1217, 1281, 1345, 1409, 1473, + 1537, 1601, 1665, 1729, 1793, 1857, 1921, 1985, 2049, 2113, 2177, + 2241, 2305, 2369, 2433, 2497, 2561, 2625, 2689, 2753, 2817, 2881, + 2945, 3009, 3073, 3137, 3201, 3265, 3329, 3393, 3457, 3521, 3585, + 3649, 3713, 3777, 3841, 3905, 3969, 4033}; +static ZCONST ush cpdist8[] = + {1, 129, 257, 385, 513, 641, 769, 897, 1025, 1153, 1281, + 1409, 1537, 1665, 1793, 1921, 2049, 2177, 2305, 2433, 2561, 2689, + 2817, 2945, 3073, 3201, 3329, 3457, 3585, 3713, 3841, 3969, 4097, + 4225, 4353, 4481, 4609, 4737, 4865, 4993, 5121, 5249, 5377, 5505, + 5633, 5761, 5889, 6017, 6145, 6273, 6401, 6529, 6657, 6785, 6913, + 7041, 7169, 7297, 7425, 7553, 7681, 7809, 7937, 8065}; + + +/* Macros for inflate() bit peeking and grabbing. + The usage is: + + NEEDBITS(j) + x = b & mask_bits[j]; + DUMPBITS(j) + + where NEEDBITS makes sure that b has at least j bits in it, and + DUMPBITS removes the bits from b. The macros use the variable k + for the number of bits in b. Normally, b and k are register + variables for speed. + */ + +#define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE)<<k;k+=8;}} +#define DUMPBITS(n) {b>>=(n);k-=(n);} + + + +static int get_tree(__G__ l, n) + __GDEF +unsigned *l; /* bit lengths */ +unsigned n; /* number expected */ +/* Get the bit lengths for a code representation from the compressed + stream. If get_tree() returns 4, then there is an error in the data. + Otherwise zero is returned. */ +{ + unsigned i; /* bytes remaining in list */ + unsigned k; /* lengths entered */ + unsigned j; /* number of codes */ + unsigned b; /* bit length for those codes */ + + + /* get bit lengths */ + i = NEXTBYTE + 1; /* length/count pairs to read */ + k = 0; /* next code */ + do { + b = ((j = NEXTBYTE) & 0xf) + 1; /* bits in code (1..16) */ + j = ((j & 0xf0) >> 4) + 1; /* codes with those bits (1..16) */ + if (k + j > n) + return 4; /* don't overflow l[] */ + do { + l[k++] = b; + } while (--j); + } while (--i); + return k != n ? 4 : 0; /* should have read n of them */ +} + + + +static int explode_lit8(__G__ tb, tl, td, bb, bl, bd) + __GDEF +struct huft *tb, *tl, *td; /* literal, length, and distance tables */ +int bb, bl, bd; /* number of bits decoded by those */ +/* Decompress the imploded data using coded literals and an 8K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned mb, ml, md; /* masks for bb, bl, and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + mb = mask_bits[bb]; /* precompute masks for speed */ + ml = mask_bits[bl]; + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--decode it */ + { + DUMPBITS(1) + s--; + NEEDBITS((unsigned)bb) /* get coded literal */ + if ((e = (t = tb + ((~(unsigned)b) & mb))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + redirSlide[w++] = (uch)t->v.n; + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(7) /* get distance low bits */ + d = (unsigned)b & 0x7f; + DUMPBITS(7) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { + /* &= w/ wsize not needed and wrong if redirect */ + if (d >= wsize) + return 1; + n -= (e = (e = wsize - (d > w ? d : w)) > n ? n : e); + } else +#endif + n -= (e = (e = wsize - ((d &= wsize-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memzero(redirSlide + w, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(__G__ redirSlide, (ulg)w, 0); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + G.used_csize = G.lrec.csize - G.csize - G.incnt - (k >> 3); + return 5; + } + return 0; +} + + + +static int explode_lit4(__G__ tb, tl, td, bb, bl, bd) + __GDEF +struct huft *tb, *tl, *td; /* literal, length, and distance tables */ +int bb, bl, bd; /* number of bits decoded by those */ +/* Decompress the imploded data using coded literals and a 4K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned mb, ml, md; /* masks for bb, bl, and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + mb = mask_bits[bb]; /* precompute masks for speed */ + ml = mask_bits[bl]; + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--decode it */ + { + DUMPBITS(1) + s--; + NEEDBITS((unsigned)bb) /* get coded literal */ + if ((e = (t = tb + ((~(unsigned)b) & mb))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + redirSlide[w++] = (uch)t->v.n; + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(6) /* get distance low bits */ + d = (unsigned)b & 0x3f; + DUMPBITS(6) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { + /* &= w/ wsize not needed and wrong if redirect */ + if (d >= wsize) + return 1; + n -= (e = (e = wsize - (d > w ? d : w)) > n ? n : e); + } else +#endif + n -= (e = (e = wsize - ((d &= wsize-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memzero(redirSlide + w, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(__G__ redirSlide, (ulg)w, 0); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + G.used_csize = G.lrec.csize - G.csize - G.incnt - (k >> 3); + return 5; + } + return 0; +} + + + +static int explode_nolit8(__G__ tl, td, bl, bd) + __GDEF +struct huft *tl, *td; /* length and distance decoder tables */ +int bl, bd; /* number of bits decoded by tl[] and td[] */ +/* Decompress the imploded data using uncoded literals and an 8K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--get eight bits */ + { + DUMPBITS(1) + s--; + NEEDBITS(8) + redirSlide[w++] = (uch)b; + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + DUMPBITS(8) + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(7) /* get distance low bits */ + d = (unsigned)b & 0x7f; + DUMPBITS(7) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { + /* &= w/ wsize not needed and wrong if redirect */ + if (d >= wsize) + return 1; + n -= (e = (e = wsize - (d > w ? d : w)) > n ? n : e); + } else +#endif + n -= (e = (e = wsize - ((d &= wsize-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memzero(redirSlide + w, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(__G__ redirSlide, (ulg)w, 0); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + G.used_csize = G.lrec.csize - G.csize - G.incnt - (k >> 3); + return 5; + } + return 0; +} + + + +static int explode_nolit4(__G__ tl, td, bl, bd) + __GDEF +struct huft *tl, *td; /* length and distance decoder tables */ +int bl, bd; /* number of bits decoded by tl[] and td[] */ +/* Decompress the imploded data using uncoded literals and a 4K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--get eight bits */ + { + DUMPBITS(1) + s--; + NEEDBITS(8) + redirSlide[w++] = (uch)b; + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + DUMPBITS(8) + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(6) /* get distance low bits */ + d = (unsigned)b & 0x3f; + DUMPBITS(6) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { + /* &= w/ wsize not needed and wrong if redirect */ + if (d >= wsize) + return 1; + n -= (e = (e = wsize - (d > w ? d : w)) > n ? n : e); + } else +#endif + n -= (e = (e = wsize - ((d &= wsize-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memzero(redirSlide + w, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == wsize) + { + flush(__G__ redirSlide, (ulg)w, 0); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(__G__ redirSlide, (ulg)w, 0); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + G.used_csize = G.lrec.csize - G.csize - G.incnt - (k >> 3); + return 5; + } + return 0; +} + + + +int explode(__G) + __GDEF +/* Explode an imploded compressed stream. Based on the general purpose + bit flag, decide on coded or uncoded literals, and an 8K or 4K sliding + window. Construct the literal (if any), length, and distance codes and + the tables needed to decode them (using huft_build() from inflate.c), + and call the appropriate routine for the type of data in the remainder + of the stream. The four routines are nearly identical, differing only + in whether the literal is decoded or simply read in, and in how many + bits are read in, uncoded, for the low distance bits. */ +{ + unsigned r; /* return codes */ + struct huft *tb; /* literal code table */ + struct huft *tl; /* length code table */ + struct huft *td; /* distance code table */ + int bb; /* bits for tb */ + int bl; /* bits for tl */ + int bd; /* bits for td */ + unsigned l[256]; /* bit lengths for codes */ + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) + wsize = G.redirect_size, redirSlide = G.redirect_buffer; + else + wsize = WSIZE, redirSlide = slide; +#endif + + /* Tune base table sizes. Note: I thought that to truly optimize speed, + I would have to select different bl, bd, and bb values for different + compressed file sizes. I was surprised to find out that the values of + 7, 7, and 9 worked best over a very wide range of sizes, except that + bd = 8 worked marginally better for large compressed sizes. */ + bl = 7; + bd = (G.csize + G.incnt) > 200000L ? 8 : 7; + + + /* With literal tree--minimum match length is 3 */ +#ifdef DEBUG + G.hufts = 0; /* initialize huft's malloc'ed */ +#endif + if (G.lrec.general_purpose_bit_flag & 4) + { + bb = 9; /* base table size for literals */ + if ((r = get_tree(__G__ l, 256)) != 0) + return (int)r; + if ((r = huft_build(__G__ l, 256, 256, NULL, NULL, &tb, &bb)) != 0) + { + if (r == 1) + huft_free(tb); + return (int)r; + } + if ((r = get_tree(__G__ l, 64)) != 0) + return (int)r; + if ((r = huft_build(__G__ l, 64, 0, cplen3, extra, &tl, &bl)) != 0) + { + if (r == 1) + huft_free(tl); + huft_free(tb); + return (int)r; + } + if ((r = get_tree(__G__ l, 64)) != 0) + return (int)r; + if (G.lrec.general_purpose_bit_flag & 2) /* true if 8K */ + { + if ((r = huft_build(__G__ l, 64, 0, cpdist8, extra, &td, &bd)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + huft_free(tb); + return (int)r; + } + r = explode_lit8(__G__ tb, tl, td, bb, bl, bd); + } + else /* else 4K */ + { + if ((r = huft_build(__G__ l, 64, 0, cpdist4, extra, &td, &bd)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + huft_free(tb); + return (int)r; + } + r = explode_lit4(__G__ tb, tl, td, bb, bl, bd); + } + huft_free(td); + huft_free(tl); + huft_free(tb); + } + else + + + /* No literal tree--minimum match length is 2 */ + { + if ((r = get_tree(__G__ l, 64)) != 0) + return (int)r; + if ((r = huft_build(__G__ l, 64, 0, cplen2, extra, &tl, &bl)) != 0) + { + if (r == 1) + huft_free(tl); + return (int)r; + } + if ((r = get_tree(__G__ l, 64)) != 0) + return (int)r; + if (G.lrec.general_purpose_bit_flag & 2) /* true if 8K */ + { + if ((r = huft_build(__G__ l, 64, 0, cpdist8, extra, &td, &bd)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + return (int)r; + } + r = explode_nolit8(__G__ tl, td, bl, bd); + } + else /* else 4K */ + { + if ((r = huft_build(__G__ l, 64, 0, cpdist4, extra, &td, &bd)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + return (int)r; + } + r = explode_nolit4(__G__ tl, td, bl, bd); + } + huft_free(td); + huft_free(tl); + } + Trace((stderr, "<%u > ", G.hufts)); + return (int)r; +} + +/* so explode.c and inflate.c can be compiled together into one object: */ +#undef NEXTBYTE +#undef NEEDBITS +#undef DUMPBITS diff --git a/utils/Install/sfxzip/extract.c b/utils/Install/sfxzip/extract.c new file mode 100644 index 0000000000..bd142dcae5 --- /dev/null +++ b/utils/Install/sfxzip/extract.c @@ -0,0 +1,1993 @@ +/*--------------------------------------------------------------------------- + + extract.c + + This file contains the high-level routines ("driver routines") for extrac- + ting and testing zipfile members. It calls the low-level routines in files + explode.c, inflate.c, unreduce.c and unshrink.c. + + Contains: extract_or_test_files() + store_info() + extract_or_test_member() + TestExtraField() + test_compr_eb() + memextract() + memflush() + fnfilter() + + ---------------------------------------------------------------------------*/ + + +#define EXTRACT_C +#define UNZIP_INTERNAL +#include "unzip.h" +#include "crypt.h" +#ifdef WINDLL +# ifdef POCKET_UNZIP +# include "wince/intrface.h" +# else +# include "windll/windll.h" +# endif +#endif + +off_t acelseek(off_t offset, int whence); +int aceread(void *buf, size_t count); +int aceopen(const char *path, int flags); +int aceclose(int fd); +int acesize(void); +int acetell(int fd); +char *replacestr(char *str1, char *str2, char *str3); + +#define GRRDUMP(buf,len) { \ + int i, j; \ + \ + for (j = 0; j < (len)/16; ++j) { \ + pipeit(" "); \ + for (i = 0; i < 16; ++i) \ + pipeit("%02x ", (uch)(buf)[i+(j<<4)]); \ + pipeit("\n "); \ + for (i = 0; i < 16; ++i) { \ + char c = (char)(buf)[i+(j<<4)]; \ + \ + if (c == '\n') \ + pipeit("\\n "); \ + else if (c == '\r') \ + pipeit("\\r "); \ + else \ + pipeit(" %c ", c); \ + } \ + pipeit("\n"); \ + } \ + if ((len) % 16) { \ + pipeit(" "); \ + for (i = j<<4; i < (len); ++i) \ + pipeit("%02x ", (uch)(buf)[i]); \ + pipeit("\n "); \ + for (i = j<<4; i < (len); ++i) { \ + char c = (char)(buf)[i]; \ + \ + if (c == '\n') \ + pipeit("\\n "); \ + else if (c == '\r') \ + pipeit("\\r "); \ + else \ + pipeit(" %c ", c); \ + } \ + pipeit("\n"); \ + } \ +} + +static int store_info OF((__GPRO)); +static int extract_or_test_member OF((__GPRO)); +#ifndef SFX + static int TestExtraField OF((__GPRO__ uch *ef, unsigned ef_len)); + static int test_compr_eb OF((__GPRO__ uch *eb, unsigned eb_size, + unsigned compr_offset, + int (*test_uc_ebdata)(__GPRO__ uch *eb, unsigned eb_size, + uch *eb_ucptr, ulg eb_ucsize))); +#endif +#ifdef SET_DIR_ATTRIB + static int dircomp OF((ZCONST zvoid *a, ZCONST zvoid *b)); +#endif + + + +/*******************************/ +/* Strings used in extract.c */ +/*******************************/ + +static ZCONST char Far VersionMsg[] = + " skipping: %-22s need %s compat. v%u.%u (can do v%u.%u)\n"; +static ZCONST char Far ComprMsgNum[] = + " skipping: %-22s unsupported compression method %u\n"; +#ifndef SFX + static ZCONST char Far ComprMsgName[] = + " skipping: %-22s `%s' method not supported\n"; + static ZCONST char Far CmprNone[] = "store"; + static ZCONST char Far CmprShrink[] = "shrink"; + static ZCONST char Far CmprReduce[] = "reduce"; + static ZCONST char Far CmprImplode[] = "implode"; + static ZCONST char Far CmprTokenize[] = "tokenize"; + static ZCONST char Far CmprDeflate[] = "deflate"; + static ZCONST char Far CmprEnDeflate[] = "enhanced deflate"; + static ZCONST char Far CmprDCLImplode[] = "DCL implode"; + static ZCONST char Far *ComprNames[NUM_METHODS] = { + CmprNone, CmprShrink, CmprReduce, CmprReduce, CmprReduce, CmprReduce, + CmprImplode, CmprTokenize, CmprDeflate, CmprEnDeflate, CmprDCLImplode + }; +#endif /* !SFX */ +static ZCONST char Far FilNamMsg[] = + "%s: bad filename length (%s)\n"; +static ZCONST char Far ExtFieldMsg[] = + "%s: bad extra field length (%s)\n"; +static ZCONST char Far OffsetMsg[] = + "file #%u: bad zipfile offset (%s): %ld\n"; +static ZCONST char Far ExtractMsg[] = + "%8sing: %-22s %s%s"; +#ifndef SFX + static ZCONST char Far LengthMsg[] = + "%s %s: %ld bytes required to uncompress to %lu bytes;\n %s\ + supposed to require %lu bytes%s%s%s\n"; +#endif + +static ZCONST char Far BadFileCommLength[] = "%s: bad file comment length\n"; +static ZCONST char Far LocalHdrSig[] = "local header sig"; +static ZCONST char Far BadLocalHdr[] = "file #%u: bad local header\n"; +static ZCONST char Far AttemptRecompensate[] = + " (attempting to re-compensate)\n"; +#ifndef SFX + static ZCONST char Far BackslashPathSep[] = + "warning: %s appears to use backslashes as path separators\n"; +#endif +static ZCONST char Far SkipVolumeLabel[] = + " skipping: %-22s %svolume label\n"; + +#ifdef SET_DIR_ATTRIB /* messages of code for setting directory attributes */ + static ZCONST char Far DirlistEntryNoMem[] = + "warning: cannot alloc memory for dir times/permissions/UID/GID\n"; + static ZCONST char Far DirlistSortNoMem[] = + "warning: cannot alloc memory to sort dir times/perms/etc.\n"; + static ZCONST char Far DirlistSetAttrFailed[] = + "warning: set times/attribs failed for %s\n"; +#endif + +#ifndef WINDLL + static ZCONST char Far ReplaceQuery[] = + "replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: "; + static ZCONST char Far AssumeNone[] = " NULL\n(assuming [N]one)\n"; + static ZCONST char Far NewNameQuery[] = "new name: "; + static ZCONST char Far InvalidResponse[] = "error: invalid response [%c]\n"; +#endif /* !WINDLL */ + +static ZCONST char Far ErrorInArchive[] = + "At least one %serror was detected in %s.\n"; +static ZCONST char Far ZeroFilesTested[] = + "Caution: zero files tested in %s.\n"; + +#ifndef VMS + static ZCONST char Far VMSFormatQuery[] = + "\n%s: stored in VMS format. Extract anyway? (y/n) "; +#endif + +#if CRYPT + static ZCONST char Far SkipCannotGetPasswd[] = + " skipping: %-22s unable to get password\n"; + static ZCONST char Far SkipIncorrectPasswd[] = + " skipping: %-22s incorrect password\n"; + static ZCONST char Far FilesSkipBadPasswd[] = + "%u file%s skipped because of incorrect password.\n"; + static ZCONST char Far MaybeBadPasswd[] = + " (may instead be incorrect password)\n"; +#else + static ZCONST char Far SkipEncrypted[] = + " skipping: %-22s encrypted (not supported)\n"; +#endif + +static ZCONST char Far NoErrInCompData[] = + "No errors detected in compressed data of %s.\n"; +static ZCONST char Far NoErrInTestedFiles[] = + "No errors detected in %s for the %u file%s tested.\n"; +static ZCONST char Far FilesSkipped[] = + "%u file%s skipped because of unsupported compression or encoding.\n"; + +static ZCONST char Far ErrUnzipFile[] = " error: %s%s %s\n"; +static ZCONST char Far ErrUnzipNoFile[] = "\n error: %s%s\n"; +static ZCONST char Far NotEnoughMem[] = "not enough memory to "; +static ZCONST char Far InvalidComprData[] = "invalid compressed data to "; +static ZCONST char Far Inflate[] = "inflate"; + +#ifndef SFX + static ZCONST char Far Explode[] = "explode"; +#ifndef LZW_CLEAN + static ZCONST char Far Unshrink[] = "unshrink"; +#endif +#endif + +#if (!defined(DELETE_IF_FULL) || !defined(HAVE_UNLINK)) + static ZCONST char Far FileTruncated[] = + "warning: %s is probably truncated\n"; +#endif + +static ZCONST char Far FileUnknownCompMethod[] = + "%s: unknown compression method\n"; +static ZCONST char Far BadCRC[] = " bad CRC %08lx (should be %08lx)\n"; + + /* TruncEAs[] also used in OS/2 mapname(), close_outfile() */ +char ZCONST Far TruncEAs[] = " compressed EA data missing (%d bytes)%s"; +char ZCONST Far TruncNTSD[] = + " compressed WinNT security data missing (%d bytes)%s"; + +#ifndef SFX + static ZCONST char Far InconsistEFlength[] = "bad extra-field entry:\n \ + EF block length (%u bytes) exceeds remaining EF data (%u bytes)\n"; + static ZCONST char Far InvalidComprDataEAs[] = + " invalid compressed data for EAs\n"; +# if (defined(WIN32) && defined(NTSD_EAS)) + static ZCONST char Far InvalidSecurityEAs[] = + " EAs fail security check\n"; +# endif + static ZCONST char Far UnsuppNTSDVersEAs[] = + " unsupported NTSD EAs version %d\n"; + static ZCONST char Far BadCRC_EAs[] = " bad CRC for extended attributes\n"; + static ZCONST char Far UnknComprMethodEAs[] = + " unknown compression method for EAs (%u)\n"; + static ZCONST char Far NotEnoughMemEAs[] = + " out of memory while inflating EAs\n"; + static ZCONST char Far UnknErrorEAs[] = + " unknown error on extended attributes\n"; +#endif /* !SFX */ + +static ZCONST char Far UnsupportedExtraField[] = + "\nerror: unsupported extra-field compression type (%u)--skipping\n"; +static ZCONST char Far BadExtraFieldCRC[] = + "error [%s]: bad extra-field CRC %08lx (should be %08lx)\n"; + + + + + +/**************************************/ +/* Function extract_or_test_files() */ +/**************************************/ + +int extract_or_test_files(__G) /* return PK-type error code */ + __GDEF +{ + uch *cd_inptr; + unsigned i, j, filnum=0, blknum=0; + int cd_incnt, renamed, query; + int error, error_in_archive=PK_COOL, *fn_matched=NULL, *xn_matched=NULL; +#ifdef WINDLL + int done_once = 0; +#else + extent len; +#endif + unsigned members_remaining, num_skipped=0, num_bad_pwd=0; + long cd_bufstart, bufstart, inbuf_offset, request; + LONGINT old_extra_bytes = 0L; +#ifdef SET_DIR_ATTRIB + unsigned num_dirs=0; + dirtime *dirlist=(dirtime *)NULL, **sorted_dirlist=(dirtime **)NULL; +#endif + + +/*--------------------------------------------------------------------------- + The basic idea of this function is as follows. Since the central di- + rectory lies at the end of the zipfile and the member files lie at the + beginning or middle or wherever, it is not very desirable to simply + read a central directory entry, jump to the member and extract it, and + then jump back to the central directory. In the case of a large zipfile + this would lead to a whole lot of disk-grinding, especially if each mem- + ber file is small. Instead, we read from the central directory the per- + tinent information for a block of files, then go extract/test the whole + block. Thus this routine contains two small(er) loops within a very + large outer loop: the first of the small ones reads a block of files + from the central directory; the second extracts or tests each file; and + the outer one loops over blocks. There's some file-pointer positioning + stuff in between, but that's about it. Btw, it's because of this jump- + ing around that we can afford to be lenient if an error occurs in one of + the member files: we should still be able to go find the other members, + since we know the offset of each from the beginning of the zipfile. + ---------------------------------------------------------------------------*/ + + G.pInfo = G.info; + members_remaining = (unsigned)G.ecrec.total_entries_central_dir; + +#if CRYPT + G.newzip = TRUE; +#endif +#ifndef SFX + G.reported_backslash = FALSE; +#endif + + /* malloc space for check on unmatched filespecs (OK if one or both NULL) */ + if (G.filespecs > 0 && + (fn_matched=(int *)malloc(G.filespecs*sizeof(int))) != (int *)NULL) + for (i = 0; i < G.filespecs; ++i) + fn_matched[i] = FALSE; + if (G.xfilespecs > 0 && + (xn_matched=(int *)malloc(G.xfilespecs*sizeof(int))) != (int *)NULL) + for (i = 0; i < G.xfilespecs; ++i) + xn_matched[i] = FALSE; + +/*--------------------------------------------------------------------------- + Begin main loop over blocks of member files. We know the entire central + directory is on this disk: we would not have any of this information un- + less the end-of-central-directory record was on this disk, and we would + not have gotten to this routine unless this is also the disk on which + the central directory starts. In practice, this had better be the ONLY + disk in the archive, but we'll add multi-disk support soon. + ---------------------------------------------------------------------------*/ + + while (members_remaining) { + j = 0; +#ifdef AMIGA + memzero(G.filenotes, DIR_BLKSIZ * sizeof(char *)); +#endif + + /* + * Loop through files in central directory, storing offsets, file + * attributes, case-conversion and text-conversion flags until block + * size is reached. + */ + + while (members_remaining && (j < DIR_BLKSIZ)) { + --members_remaining; + G.pInfo = &G.info[j]; + + if (readbuf(__G__ G.sig, 4) == 0) { + error_in_archive = PK_EOF; + members_remaining = 0; /* ...so no more left to do */ + break; + } + if (strncmp(G.sig, central_hdr_sig, 4)) { /* just to make sure */ + Info(slide, 0x401, ((char *)slide, LoadFarString(CentSigMsg), + j + blknum*DIR_BLKSIZ + 1)); + Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg))); + error_in_archive = PK_BADERR; + members_remaining = 0; /* ...so no more left to do */ + break; + } + /* process_cdir_file_hdr() sets pInfo->hostnum, pInfo->lcflag */ + if ((error = process_cdir_file_hdr(__G)) != PK_COOL) { + error_in_archive = error; /* only PK_EOF defined */ + members_remaining = 0; /* ...so no more left to do */ + break; + } + if ((error = do_string(__G__ G.crec.filename_length, DS_FN)) != + PK_COOL) + { + if (error > error_in_archive) + error_in_archive = error; + if (error > PK_WARN) { /* fatal: no more left to do */ + Info(slide, 0x401, ((char *)slide, LoadFarString(FilNamMsg), + FnFilter1(G.filename), "central")); + members_remaining = 0; + break; + } + } + if ((error = do_string(__G__ G.crec.extra_field_length, + EXTRA_FIELD)) != 0) + { + if (error > error_in_archive) + error_in_archive = error; + if (error > PK_WARN) { /* fatal */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(ExtFieldMsg), + FnFilter1(G.filename), "central")); + members_remaining = 0; + break; + } + } +#ifdef AMIGA + G.filenote_slot = j; + if ((error = do_string(__G__ G.crec.file_comment_length, + uO.N_flag ? FILENOTE : SKIP)) != PK_COOL) +#else + if ((error = do_string(__G__ G.crec.file_comment_length, SKIP)) + != PK_COOL) +#endif + { + if (error > error_in_archive) + error_in_archive = error; + if (error > PK_WARN) { /* fatal */ + Info(slide, 0x421, ((char *)slide, + LoadFarString(BadFileCommLength), + FnFilter1(G.filename))); + members_remaining = 0; + break; + } + } + if (G.process_all_files) { + if (store_info(__G)) + ++j; /* file is OK; info[] stored; continue with next */ + else + ++num_skipped; + } else { + int do_this_file; + + if (G.filespecs == 0) + do_this_file = TRUE; + else { /* check if this entry matches an `include' argument */ + do_this_file = FALSE; + for (i = 0; i < G.filespecs; i++) + if (match(G.filename, G.pfnames[i], uO.C_flag)) { + do_this_file = TRUE; /* ^-- ignore case or not? */ + if (fn_matched) + fn_matched[i] = TRUE; + break; /* found match, so stop looping */ + } + } + if (do_this_file) { /* check if this is an excluded file */ + for (i = 0; i < G.xfilespecs; i++) + if (match(G.filename, G.pxnames[i], uO.C_flag)) { + do_this_file = FALSE; /* ^-- ignore case or not? */ + if (xn_matched) + xn_matched[i] = TRUE; + break; + } + } + if (do_this_file) { + if (store_info(__G)) + ++j; /* file is OK */ + else + ++num_skipped; /* unsupp. compression or encryption */ + } + } /* end if (process_all_files) */ + + + } /* end while-loop (adding files to current block) */ + + /* save position in central directory so can come back later */ + cd_bufstart = G.cur_zipfile_bufstart; + cd_inptr = G.inptr; + cd_incnt = G.incnt; + + /*----------------------------------------------------------------------- + Second loop: process files in current block, extracting or testing + each one. + -----------------------------------------------------------------------*/ + + for (i = 0; i < j; ++i) { + filnum++; /* filnum = i + blknum*DIR_BLKSIZ + 1; */ + G.pInfo = &G.info[i]; +#ifdef NOVELL_BUG_FAILSAFE + G.dne = FALSE; /* assume file exists until stat() says otherwise */ +#endif + + /* if the target position is not within the current input buffer + * (either haven't yet read far enough, or (maybe) skipping back- + * ward), skip to the target position and reset readbuf(). */ + + /* ZLSEEK(pInfo->offset): */ + request = G.pInfo->offset + G.extra_bytes; + inbuf_offset = request % INBUFSIZ; + bufstart = request - inbuf_offset; + + Trace((stderr, "\ndebug: request = %ld, inbuf_offset = %ld\n", + request, inbuf_offset)); + Trace((stderr, + "debug: bufstart = %ld, cur_zipfile_bufstart = %ld\n", + bufstart, G.cur_zipfile_bufstart)); + if (request < 0) { + Info(slide, 0x401, ((char *)slide, LoadFarStringSmall(SeekMsg), + G.zipfn, LoadFarString(ReportMsg))); + error_in_archive = PK_ERR; + if (filnum == 1 && G.extra_bytes != 0L) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(AttemptRecompensate))); + old_extra_bytes = G.extra_bytes; + G.extra_bytes = 0L; + request = G.pInfo->offset; /* could also check if != 0 */ + inbuf_offset = request % INBUFSIZ; + bufstart = request - inbuf_offset; + Trace((stderr, "debug: request = %ld, inbuf_offset = %ld\n", + request, inbuf_offset)); + Trace((stderr, + "debug: bufstart = %ld, cur_zipfile_bufstart = %ld\n", + bufstart, G.cur_zipfile_bufstart)); + } else { + error_in_archive = PK_BADERR; + continue; /* this one hosed; try next */ + } + } + /* try again */ + if (request < 0) { + Trace((stderr, "debug: recompensated request still < 0\n")); + Info(slide, 0x401, ((char *)slide, LoadFarStringSmall(SeekMsg), + G.zipfn, LoadFarString(ReportMsg))); + error_in_archive = PK_BADERR; + continue; + } else if (bufstart != G.cur_zipfile_bufstart) { + Trace((stderr, "debug: bufstart != cur_zipfile_bufstart\n")); +#ifdef USE_STRM_INPUT + fseek((FILE *)G.zipfd,(LONGINT)bufstart,SEEK_SET); + G.cur_zipfile_bufstart = ftell((FILE *)G.zipfd); +#else /* !USE_STRM_INPUT */ + G.cur_zipfile_bufstart = + acelseek((LONGINT)bufstart,SEEK_SET); +#endif /* ?USE_STRM_INPUT */ + if ((G.incnt = aceread((char *)G.inbuf,INBUFSIZ)) <= 0) + { + Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg), + filnum, "lseek", bufstart)); + error_in_archive = PK_BADERR; + continue; /* can still do next file */ + } + G.inptr = G.inbuf + (int)inbuf_offset; + G.incnt -= (int)inbuf_offset; + } else { + G.incnt += (int)(G.inptr-G.inbuf) - (int)inbuf_offset; + G.inptr = G.inbuf + (int)inbuf_offset; + } + + /* should be in proper position now, so check for sig */ + if (readbuf(__G__ G.sig, 4) == 0) { /* bad offset */ + Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg), + filnum, "EOF", request)); + error_in_archive = PK_BADERR; + continue; /* but can still try next one */ + } + if (strncmp(G.sig, local_hdr_sig, 4)) { + Info(slide, 0x401, ((char *)slide, LoadFarString(OffsetMsg), + filnum, LoadFarStringSmall(LocalHdrSig), request)); + /* + GRRDUMP(G.sig, 4) + GRRDUMP(local_hdr_sig, 4) + */ + error_in_archive = PK_ERR; + if ((filnum == 1 && G.extra_bytes != 0L) || + (G.extra_bytes == 0L && old_extra_bytes != 0L)) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(AttemptRecompensate))); + if (G.extra_bytes) { + old_extra_bytes = G.extra_bytes; + G.extra_bytes = 0L; + } else + G.extra_bytes = old_extra_bytes; /* third attempt */ + ZLSEEK(G.pInfo->offset) + if (readbuf(__G__ G.sig, 4) == 0) { /* bad offset */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(OffsetMsg), filnum, "EOF", request)); + error_in_archive = PK_BADERR; + continue; /* but can still try next one */ + } + if (strncmp(G.sig, local_hdr_sig, 4)) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(OffsetMsg), filnum, + LoadFarStringSmall(LocalHdrSig), request)); + error_in_archive = PK_BADERR; + continue; + } + } else + continue; /* this one hosed; try next */ + } + if ((error = process_local_file_hdr(__G)) != PK_COOL) { + Info(slide, 0x421, ((char *)slide, LoadFarString(BadLocalHdr), + filnum)); + error_in_archive = error; /* only PK_EOF defined */ + continue; /* can still try next one */ + } + if ((error = do_string(__G__ G.lrec.filename_length, DS_FN)) != + PK_COOL) + { + if (error > error_in_archive) + error_in_archive = error; + if (error > PK_WARN) { + Info(slide, 0x401, ((char *)slide, LoadFarString(FilNamMsg), + FnFilter1(G.filename), "local")); + continue; /* go on to next one */ + } + } + if (G.extra_field != (uch *)NULL) { + free(G.extra_field); + G.extra_field = (uch *)NULL; + } + if ((error = + do_string(__G__ G.lrec.extra_field_length, EXTRA_FIELD)) != 0) + { + if (error > error_in_archive) + error_in_archive = error; + if (error > PK_WARN) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(ExtFieldMsg), + FnFilter1(G.filename), "local")); + continue; /* go on */ + } + } + +#if CRYPT + if (G.pInfo->encrypted && + (error = decrypt(__G__ uO.pwdarg)) != PK_COOL) { + if (error == PK_WARN) { + if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) + Info(slide, 0x401, ((char *)slide, + LoadFarString(SkipIncorrectPasswd), + FnFilter1(G.filename))); + ++num_bad_pwd; + } else { /* (error > PK_WARN) */ + if (error > error_in_archive) + error_in_archive = error; + Info(slide, 0x401, ((char *)slide, + LoadFarString(SkipCannotGetPasswd), + FnFilter1(G.filename))); + } + continue; /* go on to next file */ + } +#endif /* CRYPT */ + + /* + * just about to extract file: if extracting to disk, check if + * already exists, and if so, take appropriate action according to + * fflag/uflag/overwrite_all/etc. (we couldn't do this in upper + * loop because we don't store the possibly renamed filename[] in + * info[]) + */ +#ifdef DLL + if (!uO.tflag && !uO.cflag && !G.redirect_data) +#else + if (!uO.tflag && !uO.cflag) +#endif + { + renamed = FALSE; /* user hasn't renamed output file yet */ + +startover: + query = FALSE; + /* for files from DOS FAT, check for use of backslash instead + * of slash as directory separator (bug in some zipper(s); so + * far, not a problem in HPFS, NTFS or VFAT systems) + */ +#ifndef SFX + if (G.pInfo->hostnum == FS_FAT_ && !strchr(G.filename, '/')) { + char *p=G.filename-1; + + while (*++p) { + if (*p == '\\') { + if (!G.reported_backslash) { + Info(slide, 0x21, ((char *)slide, + LoadFarString(BackslashPathSep), G.zipfn)); + G.reported_backslash = TRUE; + if (!error_in_archive) + error_in_archive = PK_WARN; + } + *p = '/'; + } + } + } +#endif /* !SFX */ + + /* mapname can create dirs if not freshening or if renamed */ + if ((error = mapname(__G__ renamed)) > PK_WARN) { + if (error == IZ_CREATED_DIR) { +#ifdef SET_DIR_ATTRIB + dirtime *d_entry; + + d_entry = (dirtime *)malloc(sizeof(dirtime)); + if (d_entry == (dirtime *)NULL) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(DirlistEntryNoMem))); + } else { + unsigned eb_izux_flg; + + d_entry->next = dirlist; + dirlist = d_entry; + dirlist->fn = + (char *)malloc(strlen(G.filename) + 1); + if (dirlist->fn == (char *)NULL) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(DirlistEntryNoMem))); + dirlist = d_entry->next; + free(d_entry); + if (!error_in_archive) + error_in_archive = PK_WARN; + continue; + } + strcpy(dirlist->fn, G.filename); + dirlist->perms = G.pInfo->file_attr; +#ifdef USE_EF_UT_TIME + eb_izux_flg = G.extra_field? ef_scan_for_izux( + G.extra_field, G.lrec.extra_field_length, 0, + G.lrec.last_mod_dos_datetime, +#ifdef IZ_CHECK_TZ + (G.tz_is_valid ? &(dirlist->u.t3) : NULL), +#else + &(dirlist->u.t3), +#endif + dirlist->uidgid) + : 0; +#else /* !USE_EF_UT_TIME */ + eb_izux_flg = 0; +#endif /* ?USE_EF_UT_TIME */ + if (eb_izux_flg & EB_UT_FL_MTIME) { + TTrace((stderr, + "\nextract: Unix dir e.f. modtime = %ld\n", + dirlist->u.t3.mtime)); + } else { + dirlist->u.t3.mtime = dos_to_unix_time( + G.lrec.last_mod_dos_datetime); + } + if (eb_izux_flg & EB_UT_FL_ATIME) { + TTrace((stderr, + "\nextract: Unix dir e.f. actime = %ld\n", + dirlist->u.t3.atime)); + } else { + dirlist->u.t3.atime = + dirlist->u.t3.mtime; + } + dirlist->have_uidgid = + (uO.X_flag && (eb_izux_flg & EB_UX2_VALID)); + ++num_dirs; + } +#endif /* SET_DIR_ATTRIB */ + } else if (error == IZ_VOL_LABEL) { +#ifdef DOS_OS2_W32 + Info(slide, 0x401, ((char *)slide, + LoadFarString(SkipVolumeLabel), + FnFilter1(G.filename), + uO.volflag? "hard disk " : "")); +#else + Info(slide, 1, ((char *)slide, + LoadFarString(SkipVolumeLabel), + FnFilter1(G.filename), "")); +#endif + /* if (!error_in_archive) + error_in_archive = PK_WARN; */ + } else if (error > PK_ERR && error_in_archive < PK_ERR) + error_in_archive = PK_ERR; + Trace((stderr, "mapname(%s) returns error = %d\n", + FnFilter1(G.filename), error)); + continue; /* go on to next file */ + } + +#ifdef QDOS + QFilename(__G__ G.filename); +#endif + switch (check_for_newer(__G__ G.filename)) { + case DOES_NOT_EXIST: +#ifdef NOVELL_BUG_FAILSAFE + G.dne = TRUE; /* stat() says file DOES NOT EXIST */ +#endif + /* if freshening, don't skip if just renamed */ + if (uO.fflag && !renamed) + continue; /* freshen (no new files): skip */ + break; + case EXISTS_AND_OLDER: + if (uO.overwrite_none) { +#ifdef WINDLL + char szStr[FILNAMSIZ+40]; /* add. space for text */ + + if ((!G.prompt_always) || (done_once)) { + sprintf(szStr, + "Target file exists.\nSkipping %s\n", + FnFilter1(G.filename)); + win_fprintf((zvoid *)&G, stdout, + strlen(szStr), szStr); + } else { + query = TRUE; + break; + } +#endif /* WINDLL */ + continue; /* never overwrite: skip file */ + } +#ifdef UNIXBACKUP + if (!uO.overwrite_all && !uO.B_flag) +#else + if (!uO.overwrite_all) +#endif + query = TRUE; + break; + case EXISTS_AND_NEWER: /* (or equal) */ + if (uO.overwrite_none || (uO.uflag && !renamed)) { +#ifdef WINDLL + char szStr[FILNAMSIZ+40]; /* add. space for text */ + + if ((!G.prompt_always) || (done_once)) { + sprintf(szStr, + "Target file newer.\nSkipping %s\n", + FnFilter1(G.filename)); + win_fprintf((zvoid *)&G, stdout, + strlen(szStr), szStr); + } else { + query = TRUE; + break; + } +#endif /* WINDLL */ + continue; /* skip if update/freshen & orig name */ + } +#ifdef UNIXBACKUP + if (!uO.overwrite_all && !uO.B_flag) +#else + if (!uO.overwrite_all) +#endif + query = TRUE; + break; + } + if (query) { +#ifdef WINDLL + switch (G.lpUserFunctions->replace != NULL ? + (*G.lpUserFunctions->replace)(G.filename) : + IDM_REPLACE_NONE) { + case IDM_REPLACE_RENAME: + _ISO_INTERN(G.filename); + renamed = TRUE; + goto startover; + case IDM_REPLACE_YES: + break; + case IDM_REPLACE_ALL: + uO.overwrite_all = TRUE; + uO.overwrite_none = FALSE; /* just to make sure */ + break; + case IDM_REPLACE_NONE: + uO.overwrite_none = TRUE; + uO.overwrite_all = FALSE; /* make sure */ + done_once = TRUE; + /* FALL THROUGH, skip */ + case IDM_REPLACE_NO: + { + char szStr[FILNAMSIZ+40]; + + sprintf(szStr, + "Target file newer.\nSkipping %s\n", + FnFilter1(G.filename)); + win_fprintf((zvoid *)&G, stdout, + strlen(szStr), szStr); + } + continue; + } +#else /* !WINDLL */ +reprompt: + Info(slide, 0x81, ((char *)slide, + LoadFarString(ReplaceQuery), + FnFilter1(G.filename))); + if (fgets(G.answerbuf, 9, stdin) == (char *)NULL) { + Info(slide, 1, ((char *)slide, + LoadFarString(AssumeNone))); + *G.answerbuf = 'N'; + if (!error_in_archive) + error_in_archive = 1; /* not extracted: warning */ + } + switch (*G.answerbuf) { + case 'A': /* dangerous option: force caps */ + uO.overwrite_all = TRUE; + uO.overwrite_none = FALSE; /* just to make sure */ + break; + case 'r': + case 'R': + do { + Info(slide, 0x81, ((char *)slide, + LoadFarString(NewNameQuery))); + fgets(G.filename, FILNAMSIZ, stdin); + /* usually get \n here: better check for it */ + len = strlen(G.filename); + if (G.filename[len-1] == '\n') + G.filename[--len] = '\0'; + } while (len == 0); +#ifdef WIN32 /* WIN32 fgets( ... , stdin) returns OEM coded strings */ + _OEM_INTERN(G.filename); +#endif + renamed = TRUE; + goto startover; /* sorry for a goto */ + case 'y': + case 'Y': + break; + case 'N': + uO.overwrite_none = TRUE; + uO.overwrite_all = FALSE; /* make sure */ + /* FALL THROUGH, skip */ + case 'n': + continue; /* skip file */ + default: + Info(slide, 1, ((char *)slide, + LoadFarString(InvalidResponse), *G.answerbuf)); + goto reprompt; /* yet another goto? */ + } /* end switch (*answerbuf) */ +#endif /* ?WINDLL */ + } /* end if (query) */ + } /* end if (extracting to disk) */ + +#ifdef DLL + if ((G.statreportcb != NULL) && + (*G.statreportcb)(__G__ UZ_ST_START_EXTRACT, G.zipfn, + G.filename, NULL)) { + if (fn_matched) + free((zvoid *)fn_matched); + if (xn_matched) + free((zvoid *)xn_matched); + return IZ_CTRLC; /* cancel operation by user request */ + } +#endif +#ifdef MACOS /* MacOS is no preemptive OS, thus call event-handling by hand */ + UserStop(); +#endif +#ifdef AMIGA + G.filenote_slot = i; +#endif + G.disk_full = 0; + if ((error = extract_or_test_member(__G)) != PK_COOL) { + if (error > error_in_archive) + error_in_archive = error; /* ...and keep going */ +#ifdef DLL + if (G.disk_full > 1 || error_in_archive == IZ_CTRLC) { +#else + if (G.disk_full > 1) { +#endif + if (fn_matched) + free((zvoid *)fn_matched); + if (xn_matched) + free((zvoid *)xn_matched); + return error_in_archive; /* (unless disk full) */ + } + } +#ifdef DLL + if ((G.statreportcb != NULL) && + (*G.statreportcb)(__G__ UZ_ST_FINISH_MEMBER, G.zipfn, + G.filename, (zvoid *)&G.lrec.ucsize)) { + if (fn_matched) + free((zvoid *)fn_matched); + if (xn_matched) + free((zvoid *)xn_matched); + return IZ_CTRLC; /* cancel operation by user request */ + } +#endif +#ifdef MACOS /* MacOS is no preemptive OS, thus call event-handling by hand */ + UserStop(); +#endif + } /* end for-loop (i: files in current block) */ + + + /* + * Jump back to where we were in the central directory, then go and do + * the next batch of files. + */ + +#ifdef USE_STRM_INPUT + fseek((FILE *)G.zipfd, (LONGINT)cd_bufstart, SEEK_SET); + G.cur_zipfile_bufstart = ftell((FILE *)G.zipfd); +#else /* !USE_STRM_INPUT */ + G.cur_zipfile_bufstart = acelseek((LONGINT)cd_bufstart,SEEK_SET); +#endif /* ?USE_STRM_INPUT */ + aceread((char *)G.inbuf, INBUFSIZ); /* been here before... */ + G.inptr = cd_inptr; + G.incnt = cd_incnt; + ++blknum; + +#ifdef TEST + pipeit("\ncd_bufstart = %ld (%.8lXh)\n", cd_bufstart, cd_bufstart); + pipeit("cur_zipfile_bufstart = %ld (%.8lXh)\n", cur_zipfile_bufstart, + cur_zipfile_bufstart); + pipeit("inptr-inbuf = %d\n", G.inptr-G.inbuf); + pipeit("incnt = %d\n\n", G.incnt); +#endif + + } /* end while-loop (blocks of files in central directory) */ + +/*--------------------------------------------------------------------------- + Go back through saved list of directories, sort and set times/perms/UIDs + and GIDs from the deepest level on up. + ---------------------------------------------------------------------------*/ + +#ifdef SET_DIR_ATTRIB + if (num_dirs > 0) { + sorted_dirlist = (dirtime **)malloc(num_dirs*sizeof(dirtime *)); + if (sorted_dirlist == (dirtime **)NULL) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(DirlistSortNoMem))); + while (dirlist != (dirtime *)NULL) { + dirtime *d = dirlist; + + dirlist = dirlist->next; + free(d); + } + } else { + if (num_dirs == 1) + sorted_dirlist[0] = dirlist; + else { + for (i = 0; i < num_dirs; ++i) { + sorted_dirlist[i] = dirlist; + dirlist = dirlist->next; + } + qsort((char *)sorted_dirlist, num_dirs, sizeof(dirtime *), + dircomp); + } + + Trace((stderr, "setting directory times/perms/attributes\n")); + for (i = 0; i < num_dirs; ++i) { + dirtime *d = sorted_dirlist[i]; + + Trace((stderr, "dir = %s\n", d->fn)); + if ((error = set_direc_attribs(__G__ d)) != PK_OK) { + Info(slide, 0x201, ((char *)slide, + LoadFarString(DirlistSetAttrFailed), d->fn)); + if (!error_in_archive) + error_in_archive = error; + } + free(d->fn); + free(d); + } + free(sorted_dirlist); + } + } +#endif /* SET_DIR_ATTRIB */ + +#if (defined(WIN32) && defined(NTSD_EAS)) + process_defer_NT(__G); /* process any deferred items for this .zip file */ +#endif + +/*--------------------------------------------------------------------------- + Check for unmatched filespecs on command line and print warning if any + found. Free allocated memory. + ---------------------------------------------------------------------------*/ + + if (fn_matched) { + for (i = 0; i < G.filespecs; ++i) + if (!fn_matched[i]) { +#ifdef DLL + if (!G.redirect_data && !G.redirect_text) + Info(slide, 0x401, ((char *)slide, + LoadFarString(FilenameNotMatched), G.pfnames[i])); + else + setFileNotFound(__G); +#else + Info(slide, 1, ((char *)slide, + LoadFarString(FilenameNotMatched), G.pfnames[i])); +#endif + if (error_in_archive <= PK_WARN) + error_in_archive = PK_FIND; /* some files not found */ + } + free((zvoid *)fn_matched); + } + if (xn_matched) { + for (i = 0; i < G.xfilespecs; ++i) + if (!xn_matched[i]) + Info(slide, 0x401, ((char *)slide, + LoadFarString(ExclFilenameNotMatched), G.pxnames[i])); + free((zvoid *)xn_matched); + } + +/*--------------------------------------------------------------------------- + Double-check that we're back at the end-of-central-directory record, and + print quick summary of results, if we were just testing the archive. We + send the summary to stdout so that people doing the testing in the back- + ground and redirecting to a file can just do a "tail" on the output file. + ---------------------------------------------------------------------------*/ + +#ifndef SFX + if (readbuf(__G__ G.sig, 4) == 0) + error_in_archive = PK_EOF; + if (strncmp(G.sig, end_central_sig, 4)) { /* just to make sure */ + Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg))); + Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg))); + if (!error_in_archive) /* don't overwrite stronger error */ + error_in_archive = PK_WARN; + } +#endif /* !SFX */ + if (uO.tflag) { + unsigned num = filnum - num_bad_pwd; + + if (uO.qflag < 2) { /* GRR 930710: was (uO.qflag == 1) */ + if (error_in_archive) + Info(slide, 0, ((char *)slide, LoadFarString(ErrorInArchive), + (error_in_archive == 1)? "warning-" : "", G.zipfn)); + else if (num == 0) + Info(slide, 0, ((char *)slide, LoadFarString(ZeroFilesTested), + G.zipfn)); + else if (G.process_all_files && (num_skipped+num_bad_pwd == 0)) + Info(slide, 0, ((char *)slide, LoadFarString(NoErrInCompData), + G.zipfn)); + else + Info(slide, 0, ((char *)slide, LoadFarString(NoErrInTestedFiles) + , G.zipfn, num, (num==1)? "":"s")); + if (num_skipped > 0) + Info(slide, 0, ((char *)slide, LoadFarString(FilesSkipped), + num_skipped, (num_skipped==1)? "":"s")); +#if CRYPT + if (num_bad_pwd > 0) + Info(slide, 0, ((char *)slide, LoadFarString(FilesSkipBadPasswd) + , num_bad_pwd, (num_bad_pwd==1)? "":"s")); +#endif /* CRYPT */ + } else if ((uO.qflag == 0) && !error_in_archive && (num == 0)) + Info(slide, 0, ((char *)slide, LoadFarString(ZeroFilesTested), + G.zipfn)); + } + + /* give warning if files not tested or extracted (first condition can still + * happen if zipfile is empty and no files specified on command line) */ + + if ((filnum == 0) && error_in_archive <= PK_WARN) { + if (num_skipped > 0) + error_in_archive = IZ_UNSUP; /* unsupport. compression/encryption */ + else + error_in_archive = PK_FIND; /* no files found at all */ + } +#if CRYPT + else if ((filnum == num_bad_pwd) && error_in_archive <= PK_WARN) + error_in_archive = IZ_BADPWD; /* bad passwd => all files skipped */ +#endif + else if ((num_skipped > 0) && error_in_archive <= PK_WARN) + error_in_archive = IZ_UNSUP; /* was PK_WARN; Jean-loup complained */ +#if CRYPT + else if ((num_bad_pwd > 0) && !error_in_archive) + error_in_archive = PK_WARN; +#endif + + return error_in_archive; + +} /* end function extract_or_test_files() */ + + + + + +/***************************/ +/* Function store_info() */ +/***************************/ + +static int store_info(__G) /* return 0 if skipping, 1 if OK */ + __GDEF +{ +#ifdef SFX +# define UNKN_COMPR \ + (G.crec.compression_method!=STORED && G.crec.compression_method!=DEFLATED) +#else +# ifdef COPYRIGHT_CLEAN /* no reduced files */ +# define UNKN_RED (G.crec.compression_method >= REDUCED1 && \ + G.crec.compression_method <= REDUCED4) +# else +# define UNKN_RED FALSE /* reducing not unknown */ +# endif +# ifdef LZW_CLEAN /* no shrunk files */ +# define UNKN_SHR (G.crec.compression_method == SHRUNK) +# else +# define UNKN_SHR FALSE /* unshrinking not unknown */ +# endif +# define UNKN_COMPR (UNKN_RED || UNKN_SHR || \ + G.crec.compression_method==TOKENIZED || G.crec.compression_method>DEFLATED) +#endif + +/*--------------------------------------------------------------------------- + Check central directory info for version/compatibility requirements. + ---------------------------------------------------------------------------*/ + + G.pInfo->encrypted = G.crec.general_purpose_bit_flag & 1; /* bit field */ + G.pInfo->ExtLocHdr = (G.crec.general_purpose_bit_flag & 8) == 8; /* bit */ + G.pInfo->textfile = G.crec.internal_file_attributes & 1; /* bit field */ + G.pInfo->crc = G.crec.crc32; + G.pInfo->compr_size = G.crec.csize; + G.pInfo->uncompr_size = G.crec.ucsize; + + switch (uO.aflag) { + case 0: + G.pInfo->textmode = FALSE; /* bit field */ + break; + case 1: + G.pInfo->textmode = G.pInfo->textfile; /* auto-convert mode */ + break; + default: /* case 2: */ + G.pInfo->textmode = TRUE; + break; + } + + if (G.crec.version_needed_to_extract[1] == VMS_) { + if (G.crec.version_needed_to_extract[0] > VMS_UNZIP_VERSION) { + if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) + Info(slide, 0x401, ((char *)slide, LoadFarString(VersionMsg), + FnFilter1(G.filename), "VMS", + G.crec.version_needed_to_extract[0] / 10, + G.crec.version_needed_to_extract[0] % 10, + VMS_UNZIP_VERSION / 10, VMS_UNZIP_VERSION % 10)); + return 0; + } +#ifndef VMS /* won't be able to use extra field, but still have data */ + else if (!uO.tflag && !uO.overwrite_all) { /* if -o, extract anyway */ + Info(slide, 0x481, ((char *)slide, LoadFarString(VMSFormatQuery), + FnFilter1(G.filename))); + fgets(G.answerbuf, 9, stdin); + if ((*G.answerbuf != 'y') && (*G.answerbuf != 'Y')) + return 0; + } +#endif /* !VMS */ + /* usual file type: don't need VMS to extract */ + } else if (G.crec.version_needed_to_extract[0] > UNZIP_VERSION) { + if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) + Info(slide, 0x401, ((char *)slide, LoadFarString(VersionMsg), + FnFilter1(G.filename), "PK", + G.crec.version_needed_to_extract[0] / 10, + G.crec.version_needed_to_extract[0] % 10, + UNZIP_VERSION / 10, UNZIP_VERSION % 10)); + return 0; + } + + if UNKN_COMPR { + if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) { +#ifndef SFX + if (G.crec.compression_method < NUM_METHODS) + Info(slide, 0x401, ((char *)slide, LoadFarString(ComprMsgName), + FnFilter1(G.filename), + LoadFarStringSmall(ComprNames[G.crec.compression_method]))); + else +#endif + Info(slide, 0x401, ((char *)slide, LoadFarString(ComprMsgNum), + FnFilter1(G.filename), + G.crec.compression_method)); + } + return 0; + } +#if (!CRYPT) + if (G.pInfo->encrypted) { + if (!((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2))) + Info(slide, 0x401, ((char *)slide, LoadFarString(SkipEncrypted), + FnFilter1(G.filename))); + return 0; + } +#endif /* !CRYPT */ + + /* map whatever file attributes we have into the local format */ + mapattr(__G); /* GRR: worry about return value later */ + + G.pInfo->offset = (long)G.crec.relative_offset_local_header; + return 1; + +} /* end function store_info() */ + + + + + +/***************************************/ +/* Function extract_or_test_member() */ +/***************************************/ + +static int extract_or_test_member(__G) /* return PK-type error code */ + __GDEF +{ + char *nul="[empty] ", *txt="[text] ", *bin="[binary]"; +#ifdef CMS_MVS + char *ebc="[ebcdic]"; +#endif + register int b; + int r, error=PK_COOL; +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + ulg wsize; +#else +# define wsize WSIZE +#endif + + +/*--------------------------------------------------------------------------- + Initialize variables, buffers, etc. + ---------------------------------------------------------------------------*/ + + G.bits_left = 0; + G.bitbuf = 0L; /* unreduce and unshrink only */ + G.zipeof = 0; + G.newfile = TRUE; + G.crc32val = CRCVAL_INITIAL; + +#ifdef SYMLINKS + /* if file came from Unix and is a symbolic link and we are extracting + * to disk, prepare to restore the link */ + if (S_ISLNK(G.pInfo->file_attr) && + (G.pInfo->hostnum == UNIX_ || G.pInfo->hostnum == ATARI_ || + G.pInfo->hostnum == BEOS_) && + !uO.tflag && !uO.cflag && (G.lrec.ucsize > 0)) + G.symlnk = TRUE; + else + G.symlnk = FALSE; +#endif /* SYMLINKS */ + + if (uO.tflag) { + if (!uO.qflag) + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), "test", + FnFilter1(G.filename), "", "")); + } else { +#ifdef DLL + if (uO.cflag && !G.redirect_data) +#else + if (uO.cflag) +#endif + { +#if (defined(OS2) && defined(__IBMC__) && (__IBMC__ >= 200)) + G.outfile = freopen("", "wb", stdout); /* VAC++ ignores setmode */ +#else + G.outfile = stdout; +#endif +#ifdef DOS_FLX_H68_OS2_W32 +#if (defined(__HIGHC__) && !defined(FLEXOS)) + setmode(G.outfile, _BINARY); +#else /* !(defined(__HIGHC__) && !defined(FLEXOS)) */ + setmode(fileno(G.outfile), O_BINARY); +#endif /* ?(defined(__HIGHC__) && !defined(FLEXOS)) */ +# define NEWLINE "\r\n" +#else /* !DOS_FLX_H68_OS2_W32 */ +# define NEWLINE "\n" +#endif /* ?DOS_FLX_H68_OS2_W32 */ +#ifdef VMS + if (open_outfile(__G)) /* VMS: required even for stdout! */ + return PK_DISK; +#endif + } else if (open_outfile(__G)) + return PK_DISK; + } + +/*--------------------------------------------------------------------------- + Unpack the file. + ---------------------------------------------------------------------------*/ + + defer_leftover_input(__G); /* so NEXTBYTE bounds check will work */ + switch (G.lrec.compression_method) { + case STORED: + if (!uO.tflag && QCOND2) { +#ifdef SYMLINKS + if (G.symlnk) /* can also be deflated, but rarer... */ + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + "link", FnFilter1(G.filename), "", "")); + else +#endif /* SYMLINKS */ + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + "extract", FnFilter1(G.filename), + (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)? + "" : (G.lrec.ucsize == 0L? nul : (G.pInfo->textfile? txt : + bin)), uO.cflag? NEWLINE : "")); + } +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { + wsize = G.redirect_size; redirSlide = G.redirect_buffer; + } else { + wsize = WSIZE; redirSlide = slide; + } +#endif + G.outptr = redirSlide; + G.outcnt = 0L; + while ((b = NEXTBYTE) != EOF && !G.disk_full) { + *G.outptr++ = (uch)b; + if (++G.outcnt == wsize) { + flush(__G__ redirSlide, G.outcnt, 0); + G.outptr = redirSlide; + G.outcnt = 0L; + } + } + if (G.outcnt) /* flush final (partial) buffer */ + flush(__G__ redirSlide, G.outcnt, 0); + break; + +#ifndef SFX +#ifndef LZW_CLEAN + case SHRUNK: + if (!uO.tflag && QCOND2) { + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + LoadFarStringSmall(Unshrink), FnFilter1(G.filename), + (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)? + "" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : "")); + } + if ((r = unshrink(__G)) != PK_COOL) { + if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)) + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipFile), + LoadFarString(NotEnoughMem), + LoadFarStringSmall2(Unshrink), + FnFilter1(G.filename))); + else + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipNoFile), + LoadFarString(NotEnoughMem), + LoadFarStringSmall2(Unshrink))); + error = r; + } + break; +#endif /* !LZW_CLEAN */ + +#ifndef COPYRIGHT_CLEAN + case REDUCED1: + case REDUCED2: + case REDUCED3: + case REDUCED4: + if (!uO.tflag && QCOND2) { + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + "unreduc", FnFilter1(G.filename), + (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)? + "" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : "")); + } + unreduce(__G); + break; +#endif /* !COPYRIGHT_CLEAN */ + + case IMPLODED: + if (!uO.tflag && QCOND2) { + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + "explod", FnFilter1(G.filename), + (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)? + "" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : "")); + } + if (((r = explode(__G)) != 0) && (r != 5)) { /* treat 5 specially */ + if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)) + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipFile), r == 3? + LoadFarString(NotEnoughMem) : + LoadFarString(InvalidComprData), + LoadFarStringSmall2(Explode), + FnFilter1(G.filename))); + else + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipNoFile), r == 3? + LoadFarString(NotEnoughMem) : + LoadFarString(InvalidComprData), + LoadFarStringSmall2(Explode))); + error = (r == 3)? PK_MEM3 : PK_ERR; + } + if (r == 5) { + int warning = ((ulg)G.used_csize <= G.lrec.csize); + + if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)) + Info(slide, 0x401, ((char *)slide, LoadFarString(LengthMsg), + "", warning? "warning" : "error", G.used_csize, + G.lrec.ucsize, warning? " " : "", G.lrec.csize, + " [", FnFilter1(G.filename), "]")); + else + Info(slide, 0x401, ((char *)slide, LoadFarString(LengthMsg), + "\n", warning? "warning" : "error", G.used_csize, + G.lrec.ucsize, warning? " ":"", G.lrec.csize, + "", "", ".")); + error = warning? PK_WARN : PK_ERR; + } + break; +#endif /* !SFX */ + + case DEFLATED: + if (!uO.tflag && QCOND2) { + Info(slide, 0, ((char *)slide, LoadFarString(ExtractMsg), + "inflat", FnFilter1(G.filename), + (uO.aflag != 1 /* && G.pInfo->textfile==G.pInfo->textmode */)? + "" : (G.pInfo->textfile? txt : bin), uO.cflag? NEWLINE : "")); + } +#ifndef USE_ZLIB /* zlib's function is called inflate(), too */ +# define UZinflate inflate +#endif + if ((r = UZinflate(__G)) != 0) { + if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)) + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipFile), r == 3? + LoadFarString(NotEnoughMem) : + LoadFarString(InvalidComprData), + LoadFarStringSmall2(Inflate), + FnFilter1(G.filename))); + else + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipNoFile), r == 3? + LoadFarString(NotEnoughMem) : + LoadFarString(InvalidComprData), + LoadFarStringSmall2(Inflate))); + error = (r == 3)? PK_MEM3 : PK_ERR; + } + break; + + default: /* should never get to this point */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(FileUnknownCompMethod), FnFilter1(G.filename))); + /* close and delete file before return? */ + undefer_input(__G); + return PK_WARN; + + } /* end switch (compression method) */ + +/*--------------------------------------------------------------------------- + Close the file and set its date and time (not necessarily in that order), + and make sure the CRC checked out OK. Logical-AND the CRC for 64-bit + machines (redundant on 32-bit machines). + ---------------------------------------------------------------------------*/ + +#ifdef VMS /* VMS: required even for stdout! (final flush) */ + if (!uO.tflag) /* don't close NULL file */ + close_outfile(__G); +#else +#ifdef DLL + if (!uO.tflag && (!uO.cflag || G.redirect_data)) { + if (G.redirect_data) + FINISH_REDIRECT(); + else + close_outfile(__G); + } +#else + if (!uO.tflag && !uO.cflag) /* don't close NULL file or stdout */ + close_outfile(__G); +#endif +#endif /* VMS */ + + /* GRR: CONVERT close_outfile() TO NON-VOID: CHECK FOR ERRORS! */ + + + if (G.disk_full) { /* set by flush() */ + if (G.disk_full > 1) { +#if (defined(DELETE_IF_FULL) && defined(HAVE_UNLINK)) + /* delete the incomplete file if we can */ + if (unlink(G.filename) != 0) + Trace((stderr, "extract.c: could not delete %s\n", + FnFilter1(G.filename))); +#else + /* warn user about the incomplete file */ + Info(slide, 0x421, ((char *)slide, LoadFarString(FileTruncated), + FnFilter1(G.filename))); +#endif + error = PK_DISK; + } else { + error = PK_WARN; + } + } + + if (error > PK_WARN) {/* don't print redundant CRC error if error already */ + undefer_input(__G); + return error; + } + if (G.crc32val != G.lrec.crc32) { + /* if quiet enough, we haven't output the filename yet: do it */ + if ((uO.tflag && uO.qflag) || (!uO.tflag && !QCOND2)) + Info(slide, 0x401, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + Info(slide, 0x401, ((char *)slide, LoadFarString(BadCRC), G.crc32val, + G.lrec.crc32)); +#if CRYPT + if (G.pInfo->encrypted) + Info(slide, 0x401, ((char *)slide, LoadFarString(MaybeBadPasswd))); +#endif + error = PK_ERR; + } else if (uO.tflag) { +#ifndef SFX + if (G.extra_field) { + if ((r = TestExtraField(__G__ G.extra_field, + G.lrec.extra_field_length)) > error) + error = r; + } else +#endif /* !SFX */ + if (!uO.qflag) + Info(slide, 0, ((char *)slide, " OK\n")); + } else { + if (QCOND2 && !error) /* GRR: is stdout reset to text mode yet? */ + Info(slide, 0, ((char *)slide, "\n")); + } + + undefer_input(__G); + return error; + +} /* end function extract_or_test_member() */ + + + + + +#ifndef SFX + +/*******************************/ +/* Function TestExtraField() */ +/*******************************/ + +static int TestExtraField(__G__ ef, ef_len) + __GDEF + uch *ef; + unsigned ef_len; +{ + ush ebID; + unsigned ebLen; + unsigned eb_cmpr_offs = 0; + int r; + + /* we know the regular compressed file data tested out OK, or else we + * wouldn't be here ==> print filename if any extra-field errors found + */ + while (ef_len >= EB_HEADSIZE) { + ebID = makeword(ef); + ebLen = (unsigned)makeword(ef+EB_LEN); + + if (ebLen > (ef_len - EB_HEADSIZE)) { + /* Discovered some extra field inconsistency! */ + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + Info(slide, 1, ((char *)slide, LoadFarString(InconsistEFlength), + ebLen, (ef_len - EB_HEADSIZE))); + return PK_ERR; + } + + switch (ebID) { + case EF_OS2: + case EF_ACL: + case EF_MAC3: + case EF_BEOS: + switch (ebID) { + case EF_OS2: + case EF_ACL: + eb_cmpr_offs = EB_OS2_HLEN; + break; + case EF_MAC3: + if (ebLen >= EB_MAC3_HLEN && + (makeword(ef+(EB_HEADSIZE+EB_FLGS_OFFS)) + & EB_M3_FL_UNCMPR) && + (makelong(ef+EB_HEADSIZE) == ebLen - EB_MAC3_HLEN)) + eb_cmpr_offs = 0; + else + eb_cmpr_offs = EB_MAC3_HLEN; + break; + case EF_BEOS: + if (ebLen >= EB_BEOS_HLEN && + (*(ef+(EB_HEADSIZE+EB_FLGS_OFFS)) & EB_BE_FL_UNCMPR) && + (makelong(ef+EB_HEADSIZE) == ebLen - EB_BEOS_HLEN)) + eb_cmpr_offs = 0; + else + eb_cmpr_offs = EB_BEOS_HLEN; + break; + } + if ((r = test_compr_eb(__G__ ef, ebLen, eb_cmpr_offs, NULL)) + != PK_OK) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + switch (r) { + case IZ_EF_TRUNC: + Info(slide, 1, ((char *)slide, + LoadFarString(TruncEAs), + ebLen-(eb_cmpr_offs+EB_CMPRHEADLEN), "\n")); + break; + case PK_ERR: + Info(slide, 1, ((char *)slide, + LoadFarString(InvalidComprDataEAs))); + break; + case PK_MEM3: + case PK_MEM4: + Info(slide, 1, ((char *)slide, + LoadFarString(NotEnoughMemEAs))); + break; + default: + if ((r & 0xff) != PK_ERR) + Info(slide, 1, ((char *)slide, + LoadFarString(UnknErrorEAs))); + else { + ush m = (ush)(r >> 8); + if (m == DEFLATED) /* GRR KLUDGE! */ + Info(slide, 1, ((char *)slide, + LoadFarString(BadCRC_EAs))); + else + Info(slide, 1, ((char *)slide, + LoadFarString(UnknComprMethodEAs), m)); + } + break; + } + return r; + } + break; + + case EF_NTSD: + Trace((stderr, "ebID: %i / ebLen: %u\n", ebID, ebLen)); + r = ebLen < EB_NTSD_L_LEN ? IZ_EF_TRUNC : + ((ef[EB_HEADSIZE+EB_NTSD_VERSION] > EB_NTSD_MAX_VER) ? + (PK_WARN | 0x4000) : + test_compr_eb(__G__ ef, ebLen, EB_NTSD_L_LEN, TEST_NTSD)); + if (r != PK_OK) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + switch (r) { + case IZ_EF_TRUNC: + Info(slide, 1, ((char *)slide, + LoadFarString(TruncNTSD), + ebLen-(EB_NTSD_L_LEN+EB_CMPRHEADLEN), "\n")); + break; +#if (defined(WIN32) && defined(NTSD_EAS)) + case PK_WARN: + Info(slide, 1, ((char *)slide, + LoadFarString(InvalidSecurityEAs))); + break; +#endif + case PK_ERR: + Info(slide, 1, ((char *)slide, + LoadFarString(InvalidComprDataEAs))); + break; + case PK_MEM3: + case PK_MEM4: + Info(slide, 1, ((char *)slide, + LoadFarString(NotEnoughMemEAs))); + break; + case (PK_WARN | 0x4000): + Info(slide, 1, ((char *)slide, + LoadFarString(UnsuppNTSDVersEAs), + (int)ef[EB_HEADSIZE+EB_NTSD_VERSION])); + r = PK_WARN; + break; + default: + if ((r & 0xff) != PK_ERR) + Info(slide, 1, ((char *)slide, + LoadFarString(UnknErrorEAs))); + else { + ush m = (ush)(r >> 8); + if (m == DEFLATED) /* GRR KLUDGE! */ + Info(slide, 1, ((char *)slide, + LoadFarString(BadCRC_EAs))); + else + Info(slide, 1, ((char *)slide, + LoadFarString(UnknComprMethodEAs), m)); + } + break; + } + return r; + } + break; + case EF_PKVMS: + case EF_PKW32: + case EF_PKUNIX: + case EF_ASIUNIX: + case EF_IZVMS: + case EF_IZUNIX: + case EF_VMCMS: + case EF_MVS: + case EF_SPARK: + case EF_AV: + default: + break; + } + ef_len -= (ebLen + EB_HEADSIZE); + ef += (ebLen + EB_HEADSIZE); + } + + if (!uO.qflag) + Info(slide, 0, ((char *)slide, " OK\n")); + + return PK_COOL; + +} /* end function TestExtraField() */ + + + + + +/******************************/ +/* Function test_compr_eb() */ +/******************************/ + +#ifdef PROTO +static int test_compr_eb( + __GPRO__ + uch *eb, + unsigned eb_size, + unsigned compr_offset, + int (*test_uc_ebdata)(__GPRO__ uch *eb, unsigned eb_size, + uch *eb_ucptr, ulg eb_ucsize)) +#else /* !PROTO */ +static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata) + __GDEF + uch *eb; + unsigned eb_size; + unsigned compr_offset; + int (*test_uc_ebdata)(); +#endif /* ?PROTO */ +{ + ulg eb_ucsize; + uch *eb_ucptr; + int r; + + if (compr_offset < 4) /* field is not compressed: */ + return PK_OK; /* do nothing and signal OK */ + + if ((eb_size < (EB_UCSIZE_P + 4)) || + ((eb_ucsize = makelong(eb+(EB_HEADSIZE+EB_UCSIZE_P))) > 0L && + eb_size <= (compr_offset + EB_CMPRHEADLEN))) + return IZ_EF_TRUNC; /* no compressed data! */ + + if ((eb_ucptr = (uch *)malloc((extent)eb_ucsize)) == (uch *)NULL) + return PK_MEM4; + + r = memextract(__G__ eb_ucptr, eb_ucsize, + eb + (EB_HEADSIZE + compr_offset), + (ulg)(eb_size - compr_offset)); + + if (r == PK_OK && test_uc_ebdata != NULL) + r = (*test_uc_ebdata)(__G__ eb, eb_size, eb_ucptr, eb_ucsize); + + free(eb_ucptr); + return r; + +} /* end function test_compr_eb() */ + +#endif /* !SFX */ + + + + + +/***************************/ +/* Function memextract() */ +/***************************/ + +int memextract(__G__ tgt, tgtsize, src, srcsize) /* extract compressed */ + __GDEF /* extra field block; */ + uch *tgt, *src; /* return PK-type error */ + ulg tgtsize, srcsize; /* level */ +{ + long old_csize=G.csize; + uch *old_inptr=G.inptr; + int old_incnt=G.incnt; + int r, error=PK_OK; + ush method; + ulg extra_field_crc; + + + method = makeword(src); + extra_field_crc = makelong(src+2); + + /* compressed extra field exists completely in memory at this location: */ + G.inptr = src + 2 + 4; /* method and extra_field_crc */ + G.incnt = (int)(G.csize = (long)(srcsize - (2 + 4))); + G.mem_mode = TRUE; + G.outbufptr = tgt; + G.outsize = tgtsize; + + switch (method) { + case STORED: + memcpy((char *)tgt, (char *)G.inptr, (extent)G.incnt); + G.outcnt = G.csize; /* for CRC calculation */ + break; + case DEFLATED: + G.outcnt = 0L; + if ((r = UZinflate(__G)) != 0) { + if (!uO.tflag) + Info(slide, 0x401, ((char *)slide, + LoadFarStringSmall(ErrUnzipNoFile), r == 3? + LoadFarString(NotEnoughMem) : + LoadFarString(InvalidComprData), + LoadFarStringSmall2(Inflate))); + error = (r == 3)? PK_MEM3 : PK_ERR; + } + if (G.outcnt == 0L) /* inflate's final FLUSH sets outcnt */ + break; + break; + default: + if (uO.tflag) + error = PK_ERR | ((int)method << 8); + else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(UnsupportedExtraField), method)); + error = PK_ERR; /* GRR: should be passed on up via SetEAs() */ + } + break; + } + + G.inptr = old_inptr; + G.incnt = old_incnt; + G.csize = old_csize; + G.mem_mode = FALSE; + + if (!error) { + register ulg crcval = crc32(CRCVAL_INITIAL, tgt, (extent)G.outcnt); + + if (crcval != extra_field_crc) { + if (uO.tflag) + error = PK_ERR | (DEFLATED << 8); /* kludge for now */ + else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(BadExtraFieldCRC), G.zipfn, crcval, + extra_field_crc)); + error = PK_ERR; + } + } + } + return error; + +} /* end function memextract() */ + + + + + +/*************************/ +/* Function memflush() */ +/*************************/ + +int memflush(__G__ rawbuf, size) + __GDEF + uch *rawbuf; + ulg size; +{ + if (size > G.outsize) + return 50; /* more data than output buffer can hold */ + + memcpy((char *)G.outbufptr, (char *)rawbuf, (extent)size); + G.outbufptr += (unsigned int)size; + G.outsize -= size; + G.outcnt += size; + + return 0; + +} /* end function memflush() */ + + + + + +/*************************/ +/* Function fnfilter() */ /* here instead of in list.c for SFX */ +/*************************/ + +char *fnfilter(raw, space) /* convert name to safely printable form */ + ZCONST char *raw; + uch *space; +{ +#ifndef NATIVE /* ASCII: filter ANSI escape codes, etc. */ + uch *r=(uch *)raw, *s=space; + + while (*r) { +#ifdef QDOS + if (qlflag & 2) { + if (*r == '/' || *r == '.') { + ++r; + *s++ = '_'; + continue; + } + } else +#endif + if (*r < 32) + *s++ = '^', *s++ = (uch)(64 + *r++); + else + *s++ = *r++; + } + *s = 0; + +#ifdef WINDLL + INTERN_TO_ISO((char *)space, (char *)space); /* translate to ANSI */ +#else +#ifdef WIN32 + /* Win9x console always uses OEM character coding, and + WinNT console is set to OEM charset by default, too */ + INTERN_TO_OEM((char *)space, (char *)space); +#endif /* WIN32 */ +#endif /* ?WINDLL */ + + return (char *)space; + +#else /* NATIVE: EBCDIC or whatever */ + return (char *)raw; +#endif + +} /* end function fnfilter() */ + + + + + +#ifdef SET_DIR_ATTRIB +/* must sort saved directories so can set perms from bottom up */ + +/************************/ +/* Function dircomp() */ +/************************/ + +static int dircomp(a, b) /* used by qsort(); swiped from Zip */ + ZCONST zvoid *a, *b; +{ + /* order is significant: this sorts in reverse order (deepest first) */ + return strcmp((*(dirtime **)b)->fn, (*(dirtime **)a)->fn); + /* return namecmp((*(dirtime **)b)->fn, (*(dirtime **)a)->fn); */ +} + + + +#if 0 /* not used in Unix, but maybe for future OSes? */ + +/************************/ +/* Function namecmp() */ +/************************/ + +static int namecmp(s1, s2) /* [not] used by dircomp(); swiped from Zip */ + ZCONST char *s1, *s2; +{ + int d; + + for (;;) { + d = (int)(uch)case_map(*s1) + - (int)(uch)case_map(*s2); + + if (d || *s1 == 0 || *s2 == 0) + return d; + + s1++; + s2++; + } +} + +#endif /* 0 */ +#endif /* SET_DIR_ATTRIB */ diff --git a/utils/Install/sfxzip/fileio.c b/utils/Install/sfxzip/fileio.c new file mode 100644 index 0000000000..9ee4ed3a92 --- /dev/null +++ b/utils/Install/sfxzip/fileio.c @@ -0,0 +1,2161 @@ +/*--------------------------------------------------------------------------- + + fileio.c + + This file contains routines for doing direct but relatively generic input/ + output, file-related sorts of things, plus some miscellaneous stuff. Most + of the stuff has to do with opening, closing, reading and/or writing files. + + Contains: open_input_file() + open_outfile() (non-VMS, non-AOS/VS, non-CMS_MVS) + undefer_input() + defer_leftover_input() + readbuf() + readbyte() + fillinbuf() + flush() (non-VMS) + disk_error() (non-VMS) + UzpMessagePrnt() + UzpMessageNull() (DLL only) + UzpInput() + UzpMorePause() + UzpPassword() (non-WINDLL) + handler() + dos_to_unix_time() (non-VMS, non-VM/CMS, non-MVS) + check_for_newer() (non-VMS, non-OS/2, non-VM/CMS, non-MVS) + do_string() + makeword() + makelong() + str2iso() (CRYPT && NEED_STR2ISO, only) + str2oem() (CRYPT && NEED_STR2OEM, only) + memset() (ZMEM only) + memcpy() (ZMEM only) + zstrnicmp() + zstat() (REGULUS only) + fLoadFarString() (SMALL_MEM only) + fLoadFarStringSmall() (SMALL_MEM only) + fLoadFarStringSmall2() (SMALL_MEM only) + zfstrcpy() (SMALL_MEM only) + + ---------------------------------------------------------------------------*/ + + +#define FILEIO_C +#define UNZIP_INTERNAL +#include "unzip.h" +#ifdef WINDLL +# include "windll/windll.h" +# include <setjmp.h> +#endif +#include "crypt.h" +#include "ttyio.h" + +off_t acelseek(off_t offset, int whence); +int aceread(void *buf, size_t count); +int aceopen(const char *path, int flags); +int aceclose(int fd); +int acesize(void); +int acetell(int fd); +char *replacestr(char *str1, char *str2, char *str3); + +/* setup of codepage conversion for decryption passwords */ +#if CRYPT +# if (defined(CRYP_USES_ISO2OEM) && !defined(IZ_ISO2OEM_ARRAY)) +# define IZ_ISO2OEM_ARRAY /* pull in iso2oem[] table */ +# endif +# if (defined(CRYP_USES_OEM2ISO) && !defined(IZ_OEM2ISO_ARRAY)) +# define IZ_OEM2ISO_ARRAY /* pull in oem2iso[] table */ +# endif +#endif +#include "ebcdic.h" /* definition/initialization of ebcdic[] */ + + +/* + Note: Under Windows, the maximum size of the buffer that can be used + with any of the *printf calls is 16,384, so win_fprintf was used to + feed the fprintf clone no more than 16K chunks at a time. This should + be valid for anything up to 64K (and probably beyond, assuming your + buffers are that big). +*/ +#ifdef WINDLL +# define WriteError(buf,len,strm) \ + (win_fprintf(pG, strm, (extent)len, (char far *)buf) != (int)(len)) +#else /* !WINDLL */ +# ifdef USE_FWRITE +# define WriteError(buf,len,strm) \ + ((extent)fwrite((char *)(buf),1,(extent)(len),strm) != (extent)(len)) +# else +# define WriteError(buf,len,strm) \ + ((extent)write(fileno(strm),(char *)(buf),(extent)(len)) != (extent)(len)) +# endif +#endif /* ?WINDLL */ + +static int disk_error OF((__GPRO)); + + +/****************************/ +/* Strings used in fileio.c */ +/****************************/ + +#if (defined(UNIX) || defined(DOS_FLX_OS2_W32) || defined(__BEOS__)) + static ZCONST char Far CannotDeleteOldFile[] = + "error: cannot delete old %s\n"; +#ifdef UNIXBACKUP + static ZCONST char Far CannotRenameOldFile[] = + "error: cannot rename old %s\n"; + static ZCONST char Far BackupSuffix[] = "~"; +#endif +#endif /* UNIX || DOS_FLX_OS2_W32 || __BEOS__ */ + +static ZCONST char Far CannotOpenZipfile[] = + "error: cannot open zipfile [ %s ]\n"; +#if (!defined(VMS) && !defined(AOS_VS) && !defined(CMS_MVS) && !defined(MACOS)) + static ZCONST char Far CannotCreateFile[] = "error: cannot create %s\n"; +#endif +#ifdef NOVELL_BUG_FAILSAFE + static ZCONST char Far NovellBug[] = + "error: %s: stat() says does not exist, but fopen() found anyway\n"; +#endif +static ZCONST char Far ReadError[] = "error: zipfile read error\n"; +static ZCONST char Far FilenameTooLongTrunc[] = + "warning: filename too long--truncating.\n"; +static ZCONST char Far ExtraFieldTooLong[] = + "warning: extra field too long (%d). Ignoring...\n"; + +#ifdef WINDLL + static ZCONST char Far DiskFullQuery[] = + "%s: write error (disk full?).\n"; +#else + static ZCONST char Far DiskFullQuery[] = + "%s: write error (disk full?). Continue? (y/n/^C) "; + static ZCONST char Far ZipfileCorrupt[] = + "error: zipfile probably corrupt (%s)\n"; +# ifdef SYMLINKS + static ZCONST char Far FileIsSymLink[] = + "%s exists and is a symbolic link%s.\n"; +# endif +# ifdef MORE + static ZCONST char Far MorePrompt[] = "--More--(%lu)"; +# endif + static ZCONST char Far QuitPrompt[] = + "--- Press `Q' to quit, or any other key to continue ---"; + static ZCONST char Far HidePrompt[] = /* "\r \r"; */ + "\r \r"; +# if CRYPT +# ifdef MACOS + /* SPC: are names on MacOS REALLY so much longer than elsewhere ??? */ + static ZCONST char Far PasswPrompt[] = "[%s]\n %s password: "; +# else + static ZCONST char Far PasswPrompt[] = "[%s] %s password: "; +# endif + static ZCONST char Far PasswPrompt2[] = "Enter password: "; + static ZCONST char Far PasswRetry[] = "password incorrect--reenter: "; +# endif /* CRYPT */ +#endif /* !WINDLL */ + + + + + +/******************************/ +/* Function open_input_file() */ +/******************************/ + +int open_input_file(__G) /* return 1 if open failed */ + __GDEF +{ + /* + * open the zipfile for reading and in BINARY mode to prevent cr/lf + * translation, which would corrupt the bitstreams + */ + +#if (defined(UNIX) || defined(TOPS20) || defined(AOS_VS) || defined(__BEOS__)) + G.zipfd = aceopen(G.zipfn, O_RDONLY); +#else /* !(UNIX || TOPS20 || AOS_VS || __BEOS__) */ +#ifdef VMS + G.zipfd = open(G.zipfn, O_RDONLY, 0, "ctx=stm"); +#else /* !VMS */ +#ifdef MACOS + G.zipfd = aceopen(G.zipfn, 0); +#else /* !MACOS */ +#ifdef RISCOS + G.zipfd = fopen(G.zipfn, "rb"); +#else /* !RISCOS */ +#ifdef CMS_MVS + G.zipfd = vmmvs_open_infile(__G); +#else /* !CMS_MVS */ + G.zipfd = aceopen(G.zipfn, O_RDONLY | O_BINARY); +#endif /* ?CMS_MVS */ +#endif /* ?RISCOS */ +#endif /* ?MACOS */ +#endif /* ?VMS */ +#endif /* ?(UNIX || TOPS20 || AOS_VS || __BEOS__) */ + +#ifdef USE_STRM_INPUT + if (G.zipfd == NULL) +#else + /* if (G.zipfd < 0) */ /* no good for Windows CE port */ + if (G.zipfd == -1) +#endif + { + Info(slide, 0x401, ((char *)slide, LoadFarString(CannotOpenZipfile), + G.zipfn)); + return 1; + } + return 0; + +} /* end function open_input_file() */ + + + + +#if (!defined(VMS) && !defined(AOS_VS) && !defined(CMS_MVS) && !defined(MACOS)) + +/***************************/ +/* Function open_outfile() */ +/***************************/ + +int open_outfile(__G) /* return 1 if fail */ + __GDEF +{ +#ifdef DLL + if (G.redirect_data) + return (redirect_outfile(__G) == FALSE); +#endif +#ifdef QDOS + QFilename(__G__ G.filename); +#endif +#if (defined(DOS_FLX_OS2_W32) || defined(UNIX) || defined(__BEOS__)) +#ifdef BORLAND_STAT_BUG + /* Borland 5.0's stat() barfs if the filename has no extension and the + * file doesn't exist. */ + if (access(G.filename, 0) == -1) { + FILE *tmp = fopen(G.filename, "wb+"); + + /* file doesn't exist, so create a dummy file to keep stat() from + * failing (will be over-written anyway) */ + fputc('0', tmp); /* just to have something in the file */ + fclose(tmp); + } +#endif /* BORLAND_STAT_BUG */ +#ifdef SYMLINKS + if (SSTAT(G.filename, &G.statbuf) == 0 || lstat(G.filename,&G.statbuf) == 0) +#else + if (SSTAT(G.filename, &G.statbuf) == 0) +#endif /* ?SYMLINKS */ + { + Trace((stderr, "open_outfile: stat(%s) returns 0: file exists\n", + FnFilter1(G.filename))); +#ifdef UNIXBACKUP + if (uO.B_flag) { /* do backup */ + char *tname; + int blen, flen, tlen; + + blen = strlen(BackupSuffix); + flen = strlen(G.filename); + tlen = flen + blen + 1; + if (tlen >= FILNAMSIZ) { /* in case name is too long, truncate */ + tname = (char *)malloc(FILNAMSIZ); + if (tname == NULL) + return 1; /* in case we run out of space */ + tlen = FILNAMSIZ - 1 - blen; + strcpy(tname, G.filename); /* make backup name */ + tname[tlen] = '\0'; + } else { + tname = (char *)malloc(tlen); + if (tname == NULL) + return 1; /* in case we run out of space */ + strcpy(tname, G.filename); /* make backup name */ + } + strcpy(tname+flen, BackupSuffix); + + /* GRR: should check if backup file exists, apply -n/-o to that */ + if (rename(G.filename, tname) < 0) { /* move file */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotRenameOldFile), FnFilter1(G.filename))); + free(tname); + return 1; + } + free(tname); + } else +#endif /* UNIXBACKUP */ +#ifdef DOS_FLX_OS2_W32 + if (!(G.statbuf.st_mode & S_IWRITE)) { + Trace((stderr, "open_outfile: existing file %s is read-only\n", + FnFilter1(G.filename))); + chmod(G.filename, S_IREAD | S_IWRITE); + Trace((stderr, "open_outfile: %s now writable\n", + FnFilter1(G.filename))); + } +#endif /* DOS_FLX_OS2_W32 */ + if (unlink(G.filename) != 0) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotDeleteOldFile), FnFilter1(G.filename))); + return 1; + } + Trace((stderr, "open_outfile: %s now deleted\n", + FnFilter1(G.filename))); + } +#endif /* DOS_FLX_OS2_W32 || UNIX || __BEOS__ */ +#ifdef RISCOS + if (SWI_OS_File_7(G.filename,0xDEADDEAD,0xDEADDEAD,G.lrec.ucsize)!=NULL) { + Info(slide, 1, ((char *)slide, LoadFarString(CannotCreateFile), + FnFilter1(G.filename))); + return 1; + } +#endif /* RISCOS */ +#ifdef TOPS20 + char *tfilnam; + + if ((tfilnam = (char *)malloc(2*strlen(G.filename)+1)) == (char *)NULL) + return 1; + strcpy(tfilnam, G.filename); + upper(tfilnam); + enquote(tfilnam); + if ((G.outfile = fopen(tfilnam, FOPW)) == (FILE *)NULL) { + Info(slide, 1, ((char *)slide, LoadFarString(CannotCreateFile), + tfilnam)); + free(tfilnam); + return 1; + } + free(tfilnam); +#else /* !TOPS20 */ +#ifdef MTS + if (uO.aflag) + G.outfile = fopen(G.filename, FOPWT); + else + G.outfile = fopen(G.filename, FOPW); + if (G.outfile == (FILE *)NULL) { + Info(slide, 1, ((char *)slide, LoadFarString(CannotCreateFile), + FnFilter1(G.filename))); + return 1; + } +#else /* !MTS */ +#ifdef TANDEM + if (SSTAT(G.filename, &G.statbuf) == 0) { + Trace((stderr, "open_outfile: stat(%s) returns 0 (file exists)\n", + FnFilter1(G.filename))); + if (unlink(G.filename) != 0) { + Trace((stderr, "open_outfile: existing file %s is read-only\n", + FnFilter1(G.filename))); + chmod(G.filename, S_IRUSR | S_IWUSR); + Trace((stderr, "open_outfile: %s now writable\n", + FnFilter1(G.filename))); + if (unlink(G.filename) != 0) + return 1; + } + Trace((stderr, "open_outfile: %s now deleted\n", + FnFilter1(G.filename))); + } + if (G.pInfo->textmode) + G.outfile = fopen(G.filename, FOPWT); + else + G.outfile = fopen(G.filename, FOPW); + if (G.outfile == (FILE *)NULL) { + Info(slide, 1, ((char *)slide, LoadFarString(CannotCreateFile), + FnFilter1(G.filename))); + return 1; + } +#else /* !TANDEM */ +#ifdef DEBUG + Info(slide, 1, ((char *)slide, + "open_outfile: doing fopen(%s) for reading\n", FnFilter1(G.filename))); + if ((G.outfile = fopen(G.filename, FOPR)) == (FILE *)NULL) + Info(slide, 1, ((char *)slide, + "open_outfile: fopen(%s) for reading failed: does not exist\n", + FnFilter1(G.filename))); + else { + Info(slide, 1, ((char *)slide, + "open_outfile: fopen(%s) for reading succeeded: file exists\n", + FnFilter1(G.filename))); + fclose(G.outfile); + } +#endif /* DEBUG */ +#ifdef NOVELL_BUG_FAILSAFE + if (G.dne && ((G.outfile = fopen(G.filename, FOPR)) != (FILE *)NULL)) { + Info(slide, 0x401, ((char *)slide, LoadFarString(NovellBug), + FnFilter1(G.filename))); + fclose(G.outfile); + return 1; /* with "./" fix in checkdir(), should never reach here */ + } +#endif /* NOVELL_BUG_FAILSAFE */ + Trace((stderr, "open_outfile: doing fopen(%s) for writing\n", + FnFilter1(G.filename))); + if ((G.outfile = fopen(G.filename, FOPW)) == (FILE *)NULL) { + Info(slide, 0x401, ((char *)slide, LoadFarString(CannotCreateFile), + FnFilter1(G.filename))); + return 1; + } + Trace((stderr, "open_outfile: fopen(%s) for writing succeeded\n", + FnFilter1(G.filename))); +#endif /* !TANDEM */ +#endif /* !MTS */ +#endif /* !TOPS20 */ + +#ifdef USE_FWRITE +#ifdef DOS_OS2_W32 + /* 16-bit MSC: buffer size must be strictly LESS than 32K (WSIZE): bogus */ + setbuf(G.outfile, (char *)NULL); /* make output unbuffered */ +#else /* !DOS_OS2_W32 */ +#ifndef RISCOS +#ifdef _IOFBF /* make output fully buffered (works just about like write()) */ + setvbuf(G.outfile, (char *)slide, _IOFBF, WSIZE); +#else + setbuf(G.outfile, (char *)slide); +#endif +#endif /* !RISCOS */ +#endif /* ?DOS_OS2_W32 */ +#endif /* USE_FWRITE */ + return 0; + +} /* end function open_outfile() */ + +#endif /* !VMS && !AOS_VS && !CMS_MVS && !MACOS */ + + + + + +/* + * These functions allow NEXTBYTE to function without needing two bounds + * checks. Call defer_leftover_input() if you ever have filled G.inbuf + * by some means other than readbyte(), and you then want to start using + * NEXTBYTE. When going back to processing bytes without NEXTBYTE, call + * undefer_input(). For example, extract_or_test_member brackets its + * central section that does the decompression with these two functions. + * If you need to check the number of bytes remaining in the current + * file while using NEXTBYTE, check (G.csize + G.incnt), not G.csize. + */ + +/****************************/ +/* function undefer_input() */ +/****************************/ + +void undefer_input(__G) + __GDEF +{ + if (G.incnt > 0) + G.csize += G.incnt; + if (G.incnt_leftover > 0) { + /* We know that "(G.csize < MAXINT)" so we can cast G.csize to int: + * This condition was checked when G.incnt_leftover was set > 0 in + * defer_leftover_input(), and it is NOT allowed to touch G.csize + * before calling undefer_input() when (G.incnt_leftover > 0) + * (single exception: see read_byte()'s "G.csize <= 0" handling) !! + */ + G.incnt = G.incnt_leftover + (int)G.csize; + G.inptr = G.inptr_leftover - (int)G.csize; + G.incnt_leftover = 0; + } else if (G.incnt < 0) + G.incnt = 0; +} /* end function undefer_input() */ + + + + + +/***********************************/ +/* function defer_leftover_input() */ +/***********************************/ + +void defer_leftover_input(__G) + __GDEF +{ + if ((long)G.incnt > G.csize) { + /* (G.csize < MAXINT), we can safely cast it to int !! */ + if (G.csize < 0L) + G.csize = 0L; + G.inptr_leftover = G.inptr + (int)G.csize; + G.incnt_leftover = G.incnt - (int)G.csize; + G.incnt = (int)G.csize; + } else + G.incnt_leftover = 0; + G.csize -= G.incnt; +} /* end function defer_leftover_input() */ + + + + + +/**********************/ +/* Function readbuf() */ +/**********************/ + +unsigned readbuf(__G__ buf, size) /* return number of bytes read into buf */ + __GDEF + char *buf; + register unsigned size; +{ + register unsigned count; + unsigned n; + + n = size; + while (size) { + if (G.incnt <= 0) { + if ((G.incnt = aceread((char *)G.inbuf, INBUFSIZ)) == 0) + return (n-size); + else if (G.incnt < 0) { + /* another hack, but no real harm copying same thing twice */ + (*G.message)((zvoid *)&G, + (uch *)LoadFarString(ReadError), /* CANNOT use slide */ + (ulg)strlen(LoadFarString(ReadError)), 0x401); + return 0; /* discarding some data; better than lock-up */ + } + /* buffer ALWAYS starts on a block boundary: */ + G.cur_zipfile_bufstart += INBUFSIZ; + G.inptr = G.inbuf; + } + count = MIN(size, (unsigned)G.incnt); + memcpy(buf, G.inptr, count); + buf += count; + G.inptr += count; + G.incnt -= count; + size -= count; + } + return n; + +} /* end function readbuf() */ + + + + + +/***********************/ +/* Function readbyte() */ +/***********************/ + +int readbyte(__G) /* refill inbuf and return a byte if available, else EOF */ + __GDEF +{ + if (G.mem_mode) + return EOF; + if (G.csize <= 0) { + G.csize--; /* for tests done after exploding */ + G.incnt = 0; + return EOF; + } + if (G.incnt <= 0) { + if ((G.incnt = aceread((char *)G.inbuf, INBUFSIZ)) == 0) { + G.incnt = 0; /* do not allow negative value to affect stuff */ + return EOF; + } else if (G.incnt < 0) { /* "fail" (abort, retry, ...) returns this */ + /* another hack, but no real harm copying same thing twice */ + (*G.message)((zvoid *)&G, + (uch *)LoadFarString(ReadError), + (ulg)strlen(LoadFarString(ReadError)), 0x401); + echon(); +#ifdef WINDLL + longjmp(dll_error_return, 1); +#else + DESTROYGLOBALS() + EXIT(PK_BADERR); /* totally bailing; better than lock-up */ +#endif + } + G.cur_zipfile_bufstart += INBUFSIZ; /* always starts on block bndry */ + G.inptr = G.inbuf; + defer_leftover_input(__G); /* decrements G.csize */ + } + +#if CRYPT + if (G.pInfo->encrypted) { + uch *p; + int n; + + /* This was previously set to decrypt one byte beyond G.csize, when + * incnt reached that far. GRR said, "but it's required: why?" This + * was a bug in fillinbuf() -- was it also a bug here? + */ + for (n = G.incnt, p = G.inptr; n--; p++) + zdecode(*p); + } +#endif /* CRYPT */ + + --G.incnt; + return *G.inptr++; + +} /* end function readbyte() */ + + + + + +#ifdef USE_ZLIB + +/************************/ +/* Function fillinbuf() */ +/************************/ + +int fillinbuf(__G) /* like readbyte() except returns number of bytes in inbuf */ + __GDEF +{ + if (G.mem_mode || + (G.incnt = aceread((char *)G.inbuf, INBUFSIZ)) <= 0) + return 0; + G.cur_zipfile_bufstart += INBUFSIZ; /* always starts on a block boundary */ + G.inptr = G.inbuf; + defer_leftover_input(__G); /* decrements G.csize */ + +#if CRYPT + if (G.pInfo->encrypted) { + uch *p; + int n; + + for (n = G.incnt, p = G.inptr; n--; p++) + zdecode(*p); + } +#endif /* CRYPT */ + + return G.incnt; + +} /* end function fillinbuf() */ + +#endif /* USE_ZLIB */ + + + + + +#ifndef VMS /* for VMS use code in vms.c */ + +/********************/ +/* Function flush() */ /* returns PK error codes: */ +/********************/ /* if cflag => always 0; PK_DISK if write error */ + +int flush(__G__ rawbuf, size, unshrink) + __GDEF + uch *rawbuf; + ulg size; + int unshrink; +{ + register uch *p, *q; + uch *transbuf; +#if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV)) + ulg transbufsiz; +#endif + /* static int didCRlast = FALSE; moved to globals.h */ + + +/*--------------------------------------------------------------------------- + Compute the CRC first; if testing or if disk is full, that's it. + ---------------------------------------------------------------------------*/ + + G.crc32val = crc32(G.crc32val, rawbuf, (extent)size); + +#ifdef DLL + if ((G.statreportcb != NULL) && + (*G.statreportcb)(__G__ UZ_ST_IN_PROGRESS, G.zipfn, G.filename, NULL)) + return IZ_CTRLC; /* cancel operation by user request */ +#endif + + if (uO.tflag || size == 0L) /* testing or nothing to write: all done */ + return PK_OK; + + if (G.disk_full) + return PK_DISK; /* disk already full: ignore rest of file */ + +/*--------------------------------------------------------------------------- + Write the bytes rawbuf[0..size-1] to the output device, first converting + end-of-lines and ASCII/EBCDIC as needed. If SMALL_MEM or MED_MEM are NOT + defined, outbuf is assumed to be at least as large as rawbuf and is not + necessarily checked for overflow. + ---------------------------------------------------------------------------*/ + + if (!G.pInfo->textmode) { /* write raw binary data */ + /* GRR: note that for standard MS-DOS compilers, size argument to + * fwrite() can never be more than 65534, so WriteError macro will + * have to be rewritten if size can ever be that large. For now, + * never more than 32K. Also note that write() returns an int, which + * doesn't necessarily limit size to 32767 bytes if write() is used + * on 16-bit systems but does make it more of a pain; however, because + * at least MSC 5.1 has a lousy implementation of fwrite() (as does + * DEC Ultrix cc), write() is used anyway. + */ +#ifdef DLL + if (G.redirect_data) + writeToMemory(__G__ rawbuf, size); + else +#endif + if (!uO.cflag && WriteError(rawbuf, size, G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, rawbuf, size, 0)) + return 0; + } else { /* textmode: aflag is true */ + if (unshrink) { + /* rawbuf = outbuf */ + transbuf = G.outbuf2; +#if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV)) + transbufsiz = TRANSBUFSIZ; +#endif + } else { + /* rawbuf = slide */ + transbuf = G.outbuf; +#if (defined(SMALL_MEM) || defined(MED_MEM) || defined(VMS_TEXT_CONV)) + transbufsiz = OUTBUFSIZ; + Trace((stderr, "\ntransbufsiz = OUTBUFSIZ = %u\n", OUTBUFSIZ)); +#endif + } + if (G.newfile) { +#ifdef VMS_TEXT_CONV + /* GRR: really want to check if -aa (or -aaa?) was given... */ + if (rawbuf[1]) { /* first line is more than 255 chars long */ + Trace((stderr, + "\nfirst line of VMS `text' too long; switching to normal extraction\n")); + G.VMS_line_state = -1; /* -1: don't treat as VMS text */ + } else + G.VMS_line_state = 0; /* 0: ready to read line length */ +#endif + G.didCRlast = FALSE; /* no previous buffers written */ + G.newfile = FALSE; + } + +#ifdef VMS_TEXT_CONV + if (G.pInfo->hostnum == VMS_ && G.extra_field && G.VMS_line_state >= 0) + { + /* GRR: really want to check for actual VMS extra field, and + * ideally for variable-length record format */ +/* + printf("\n>>>>>> GRR: file is VMS text and has an extra field\n"); + */ + + p = rawbuf; + q = transbuf; + while(p < rawbuf+(unsigned)size) { + switch (G.VMS_line_state) { + + /* 0: ready to read line length */ + case 0: + G.VMS_line_length = 0; + G.VMS_line_pad = 0; + if (p == rawbuf+(unsigned)size-1) { /* last char */ + G.VMS_line_length = (int)((uch)(*p++)); + G.VMS_line_state = 1; + } else { + G.VMS_line_length = makeword(p); + p += 2; + G.VMS_line_state = 2; + } + if (G.VMS_line_length & 1) /* odd */ + G.VMS_line_pad = 1; + break; + + /* 1: read one byte of length, need second */ + case 1: + G.VMS_line_length += ((int)((uch)(*p++)) << 8); + G.VMS_line_state = 2; + break; + + /* 2: ready to read VMS_line_length chars */ + case 2: + if (G.VMS_line_length < rawbuf+(unsigned)size-p) { + if (G.VMS_line_length >= + transbuf+(unsigned)transbufsiz-q) + { + int outroom = transbuf+(unsigned)transbufsiz-q; + +/* GRR: need to change this to *q++ = native(*p++); loop or something */ + memcpy(q, p, outroom); +#ifdef DLL + if (G.redirect_data) + writeToMemory(__G__ transbuf, + (unsigned)outroom); + else +#endif + if (!uO.cflag && WriteError(transbuf, + (unsigned)outroom, G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, + transbuf, (ulg)outroom, 0)) + return 0; + q = transbuf; + p += outroom; + G.VMS_line_length -= outroom; + /* fall through to normal case */ + } +/* GRR: need to change this to *q++ = native(*p++); loop or something */ + memcpy(q, p, G.VMS_line_length); + q += G.VMS_line_length; + p += G.VMS_line_length; + G.VMS_line_length = 0; /* necessary?? */ + G.VMS_line_state = 3; + + } else { /* remaining input is less than full line */ + int remaining = rawbuf+(unsigned)size-p; + + if (remaining < + transbuf+(unsigned)transbufsiz-q) + { + int outroom = transbuf+(unsigned)transbufsiz-q; + +/* GRR: need to change this to *q++ = native(*p++); loop or something */ + memcpy(q, p, outroom); +#ifdef DLL + if (G.redirect_data) + writeToMemory(__G__ transbuf, + (unsigned)(outroom)); + else +#endif + if (!uO.cflag && WriteError(transbuf, + (unsigned)outroom, G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, + transbuf, (ulg)outroom, 0)) + return 0; + q = transbuf; + p += outroom; + remaining -= outroom; + } +/* GRR: need to change this to *q++ = native(*p++); loop or something */ + memcpy(q, p, remaining); + q += remaining; + p += remaining; + G.VMS_line_length -= remaining; + /* no change in G.VMS_line_state */ + } + break; + + /* 3: ready to PutNativeEOL */ + case 3: + if (q > transbuf+(unsigned)transbufsiz-lenEOL) { +#ifdef DLL + if (G.redirect_data) + writeToMemory(__G__ transbuf, + (unsigned)(q-transbuf)); + else +#endif + if (!uO.cflag && + WriteError(transbuf, (unsigned)(q-transbuf), + G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, + transbuf, (ulg)(q-transbuf), 0)) + return 0; + q = transbuf; + } + PutNativeEOL + if (G.VMS_line_pad) + if (p < rawbuf+(unsigned)size) { + ++p; + G.VMS_line_state = 0; + } else + G.VMS_line_state = 4; + else + G.VMS_line_state = 0; + break; + + /* 4: ready to read pad byte */ + case 4: + ++p; + G.VMS_line_state = 0; + break; + } + } /* end while */ + + } else +#endif /* VMS_TEXT_CONV */ + + /*----------------------------------------------------------------------- + Algorithm: CR/LF => native; lone CR => native; lone LF => native. + This routine is only for non-raw-VMS, non-raw-VM/CMS files (i.e., + stream-oriented files, not record-oriented). + -----------------------------------------------------------------------*/ + + /* else not VMS text */ { + p = rawbuf; + if (*p == LF && G.didCRlast) + ++p; + G.didCRlast = FALSE; + for (q = transbuf; p < rawbuf+(unsigned)size; ++p) { + if (*p == CR) { /* lone CR or CR/LF: EOL either way */ + PutNativeEOL + if (p == rawbuf+(unsigned)size-1) /* last char in buffer */ + G.didCRlast = TRUE; + else if (p[1] == LF) /* get rid of accompanying LF */ + ++p; + } else if (*p == LF) /* lone LF */ + PutNativeEOL + else +#ifndef DOS_FLX_OS2_W32 + if (*p != CTRLZ) /* lose all ^Z's */ +#endif + *q++ = native(*p); + +#if (defined(SMALL_MEM) || defined(MED_MEM)) +# if (lenEOL == 1) /* don't check unshrink: both buffers small but equal */ + if (!unshrink) +# endif + /* check for danger of buffer overflow and flush */ + if (q > transbuf+(unsigned)transbufsiz-lenEOL) { + Trace((stderr, + "p - rawbuf = %u q-transbuf = %u size = %lu\n", + (unsigned)(p-rawbuf), (unsigned)(q-transbuf), size)); + if (!uO.cflag && WriteError(transbuf, + (unsigned)(q-transbuf), G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, + transbuf, (ulg)(q-transbuf), 0)) + return 0; + q = transbuf; + continue; + } +#endif /* SMALL_MEM || MED_MEM */ + } + } + + /*----------------------------------------------------------------------- + Done translating: write whatever we've got to file (or screen). + -----------------------------------------------------------------------*/ + + Trace((stderr, "p - rawbuf = %u q-transbuf = %u size = %lu\n", + (unsigned)(p-rawbuf), (unsigned)(q-transbuf), size)); + if (q > transbuf) { +#ifdef DLL + if (G.redirect_data) + writeToMemory(__G__ transbuf, (unsigned)(q-transbuf)); + else +#endif + if (!uO.cflag && WriteError(transbuf, (unsigned)(q-transbuf), + G.outfile)) + return disk_error(__G); + else if (uO.cflag && (*G.message)((zvoid *)&G, transbuf, + (ulg)(q-transbuf), 0)) + return 0; + } + } + + return 0; + +} /* end function flush() */ + + + + + +/*************************/ +/* Function disk_error() */ +/*************************/ + +static int disk_error(__G) + __GDEF +{ + /* OK to use slide[] here because this file is finished regardless */ + Info(slide, 0x4a1, ((char *)slide, LoadFarString(DiskFullQuery), + FnFilter1(G.filename))); + +#ifndef WINDLL + fgets(G.answerbuf, 9, stdin); + if (*G.answerbuf == 'y') /* stop writing to this file */ + G.disk_full = 1; /* (outfile bad?), but new OK */ + else +#endif + G.disk_full = 2; /* no: exit program */ + + return PK_DISK; + +} /* end function disk_error() */ + +#endif /* !VMS */ + + + + + +/*****************************/ +/* Function UzpMessagePrnt() */ +/*****************************/ + +int UZ_EXP UzpMessagePrnt(pG, buf, size, flag) + zvoid *pG; /* globals struct: always passed */ + uch *buf; /* preformatted string to be printed */ + ulg size; /* length of string (may include nulls) */ + int flag; /* flag bits */ +{ + /* IMPORTANT NOTE: + * The name of the first parameter of UzpMessagePrnt(), which passes + * the "Uz_Globs" address, >>> MUST <<< be identical to the string + * expansion of the __G__ macro in the REENTRANT case (see globals.h). + * This name identity is mandatory for the LoadFarString() macro + * (in the SMALL_MEM case) !!! + */ + int error; + uch *q=buf, *endbuf=buf+(unsigned)size; +#ifdef MORE + uch *p=buf-1; +#endif + FILE *outfp; + + +/*--------------------------------------------------------------------------- + These tests are here to allow fine-tuning of UnZip's output messages, + but none of them will do anything without setting the appropriate bit + in the flag argument of every Info() statement which is to be turned + *off*. That is, all messages are currently turned on for all ports. + To turn off *all* messages, use the UzpMessageNull() function instead + of this one. + ---------------------------------------------------------------------------*/ + +#if (defined(OS2) && defined(DLL)) + if (MSG_NO_DLL2(flag)) /* if OS/2 DLL bit is set, do NOT print this msg */ + return 0; +#endif +#ifdef WINDLL + if (MSG_NO_WDLL(flag)) + return 0; +#endif +#ifdef WINDLL + if (MSG_NO_WGUI(flag)) + return 0; +#endif +/* +#ifdef ACORN_GUI + if (MSG_NO_AGUI(flag)) + return 0; +#endif + */ +#ifdef DLL /* don't display message if data is redirected */ + if (((Uz_Globs *)pG)->redirect_data && + !((Uz_Globs *)pG)->redirect_text) + return 0; +#endif + + if (MSG_STDERR(flag) && !((Uz_Globs *)pG)->UzO.tflag) + outfp = (FILE *)stderr; + else + outfp = (FILE *)stdout; + +#ifdef QUERY_TRNEWLN + /* some systems require termination of query prompts with '\n' to force + * immediate display */ + if (MSG_MNEWLN(flag)) { /* assumes writable buffer (e.g., slide[]) */ + *endbuf++ = '\n'; /* with room for one more char at end of buf */ + ++size; /* (safe assumption: only used for four */ + } /* short queries in extract.c and fileio.c) */ +#endif + + if (MSG_TNEWLN(flag)) { /* again assumes writable buffer: fragile... */ + if ((!size && !((Uz_Globs *)pG)->sol) || + (size && (endbuf[-1] != '\n'))) + { + *endbuf++ = '\n'; + ++size; + } + } + +#ifdef MORE + /* room for --More-- and one line of overlap: */ + ((Uz_Globs *)pG)->height = SCREENLINES - 2; +#endif + + if (MSG_LNEWLN(flag) && !((Uz_Globs *)pG)->sol) { + /* not at start of line: want newline */ +#ifdef OS2DLL + if (!((Uz_Globs *)pG)->redirect_text) { +#endif + putc('\n', outfp); + fflush(outfp); +#ifdef MORE + if (((Uz_Globs *)pG)->M_flag) + { + ++((Uz_Globs *)pG)->numlines; + if (((Uz_Globs *)pG)->numlines % + ((Uz_Globs *)pG)->height == 0L) /* GRR: fix */ + (*((Uz_Globs *)pG)->mpause)((zvoid *)pG, + LoadFarString(MorePrompt), 1); + } +#endif /* MORE */ + if (MSG_STDERR(flag) && ((Uz_Globs *)pG)->UzO.tflag && + !isatty(1) && isatty(2)) + { + /* error output from testing redirected: also send to stderr */ + putc('\n', stderr); + fflush(stderr); + } +#ifdef OS2DLL + } else + REDIRECTC('\n'); +#endif + ((Uz_Globs *)pG)->sol = TRUE; + } + + /* put zipfile name, filename and/or error/warning keywords here */ + +#ifdef MORE + if (((Uz_Globs *)pG)->M_flag +#ifdef OS2DLL + && !((Uz_Globs *)pG)->redirect_text +#endif + ) + { + while (++p < endbuf) { + if (*p == '\n') { + ++((Uz_Globs *)pG)->numlines; + if (((Uz_Globs *)pG)->numlines % + ((Uz_Globs *)pG)->height == 0L) /* GRR: fix */ + { + if ((error = WriteError(q, p-q+1, outfp)) != 0) + return error; + fflush(outfp); + ((Uz_Globs *)pG)->sol = TRUE; + q = p + 1; + (*((Uz_Globs *)pG)->mpause)((zvoid *)pG, + LoadFarString(MorePrompt), 1); + } + } + } /* end while */ + size = (ulg)(p - q); /* remaining text */ + } +#endif /* MORE */ + + if (size) { +#ifdef OS2DLL + if (!((Uz_Globs *)pG)->redirect_text) { +#endif + if ((error = WriteError(q, size, outfp)) != 0) + return error; + fflush(outfp); + if (MSG_STDERR(flag) && ((Uz_Globs *)pG)->UzO.tflag && + !isatty(1) && isatty(2)) + { + /* error output from testing redirected: also send to stderr */ + if ((error = WriteError(q, size, stderr)) != 0) + return error; + fflush(stderr); + } +#ifdef OS2DLL + } else { /* GRR: this is ugly: hide with macro */ + if ((error = REDIRECTPRINT(q, size)) != 0) + return error; + } +#endif + ((Uz_Globs *)pG)->sol = (endbuf[-1] == '\n'); + } + return 0; + +} /* end function UzpMessagePrnt() */ + + + + + +#ifdef DLL + +/*****************************/ +/* Function UzpMessageNull() */ /* convenience routine for no output at all */ +/*****************************/ + +int UZ_EXP UzpMessageNull(pG, buf, size, flag) + zvoid *pG; /* globals struct: always passed */ + uch *buf; /* preformatted string to be printed */ + ulg size; /* length of string (may include nulls) */ + int flag; /* flag bits */ +{ + return 0; + +} /* end function UzpMessageNull() */ + +#endif /* DLL */ + + + + + +/***********************/ +/* Function UzpInput() */ /* GRR: this is a placeholder for now */ +/***********************/ + +int UZ_EXP UzpInput(pG, buf, size, flag) + zvoid *pG; /* globals struct: always passed */ + uch *buf; /* preformatted string to be printed */ + int *size; /* (address of) size of buf and of returned string */ + int flag; /* flag bits (bit 0: no echo) */ +{ + /* tell picky compilers to shut up about "unused variable" warnings */ + pG = pG; buf = buf; flag = flag; + + *size = 0; + return 0; + +} /* end function UzpInput() */ + + + + + +#if (!defined(WINDLL) && !defined(MACOS)) + +/***************************/ +/* Function UzpMorePause() */ +/***************************/ + +void UZ_EXP UzpMorePause(pG, prompt, flag) + zvoid *pG; /* globals struct: always passed */ + ZCONST char *prompt; /* "--More--" prompt */ + int flag; /* 0 = any char OK; 1 = accept only '\n', ' ', q */ + { +#if 0 + uch c; + +/*--------------------------------------------------------------------------- + Print a prompt and wait for the user to press a key, then erase prompt + if possible. + ---------------------------------------------------------------------------*/ + + if (!((Uz_Globs *)pG)->sol) + fprintf(stderr, "\n"); + /* numlines may or may not be used: */ + fprintf(stderr, prompt, ((Uz_Globs *)pG)->numlines); + fflush(stderr); + if (flag & 1) { + do { + c = (uch)FGETCH(0); + } while (c != '\r' && c != '\n' && c != ' ' && c != 'q' && c != 'Q'); + } else + c = (uch)FGETCH(0); + + /* newline was not echoed, so cover up prompt line */ + fprintf(stderr, LoadFarString(HidePrompt)); + fflush(stderr); + + if (ToLower(c) == 'q') { + DESTROYGLOBALS() + EXIT(PK_COOL); + } + + ((Uz_Globs *)pG)->sol = TRUE; + +#endif +} /* end function UzpMorePause() */ + +#endif /* !WINDLL && !MACOS */ + + + + +#ifndef WINDLL + +/**************************/ +/* Function UzpPassword() */ +/**************************/ + +int UZ_EXP UzpPassword (pG, rcnt, pwbuf, size, zfn, efn) + zvoid *pG; /* pointer to UnZip's internal global vars */ + int *rcnt; /* retry counter */ + char *pwbuf; /* buffer for password */ + int size; /* size of password buffer */ + ZCONST char *zfn; /* name of zip archive */ + ZCONST char *efn; /* name of archive entry being processed */ + { +#if CRYPT + int r = IZ_PW_ENTERED; + char *m; + char *prompt; + +#ifndef REENTRANT + /* tell picky compilers to shut up about "unused variable" warnings */ + pG = pG; +#endif + + if (*rcnt == 0) { /* First call for current entry */ + *rcnt = 2; + if ((prompt = (char *)malloc(2*FILNAMSIZ + 15)) != (char *)NULL) { + sprintf(prompt, LoadFarString(PasswPrompt), + FnFilter1(zfn), FnFilter2(efn)); + m = prompt; + } else + m = (char *)LoadFarString(PasswPrompt2); + } else { /* Retry call, previous password was wrong */ + (*rcnt)--; + prompt = NULL; + m = (char *)LoadFarString(PasswRetry); + } + + m = getp(__G__ m, pwbuf, size); + if (prompt != (char *)NULL) { + free(prompt); + } + if (m == (char *)NULL) { + r = IZ_PW_ERROR; + } + else if (*pwbuf == '\0') { + r = IZ_PW_CANCELALL; + } + return r; + +#else /* !CRYPT */ + /* tell picky compilers to shut up about "unused variable" warnings */ + pG = pG; rcnt = rcnt; pwbuf = pwbuf; size = size; zfn = zfn; efn = efn; + + return IZ_PW_ERROR; /* internal error; function should never get called */ +#endif /* ?CRYPT */ + +} /* end function UzpPassword() */ + + + + + +/**********************/ +/* Function handler() */ +/**********************/ + +void handler(signal) /* upon interrupt, turn on echo and exit cleanly */ + int signal; +{ + GETGLOBALS(); + +#if !(defined(SIGBUS) || defined(SIGSEGV)) /* add a newline if not at */ + (*G.message)((zvoid *)&G, slide, 0L, 0x41); /* start of line (to stderr; */ +#endif /* slide[] should be safe) */ + + echon(); + +#ifdef SIGBUS + if (signal == SIGBUS) { + Info(slide, 0x421, ((char *)slide, LoadFarString(ZipfileCorrupt), + "bus error")); + DESTROYGLOBALS() + EXIT(PK_BADERR); + } +#endif /* SIGBUS */ + +#ifdef SIGSEGV + if (signal == SIGSEGV) { + Info(slide, 0x421, ((char *)slide, LoadFarString(ZipfileCorrupt), + "segmentation violation")); + DESTROYGLOBALS() + EXIT(PK_BADERR); + } +#endif /* SIGSEGV */ + + /* probably ctrl-C */ + DESTROYGLOBALS() +#if defined(AMIGA) && defined(__SASC) + _abort(); +#endif + EXIT(IZ_CTRLC); /* was EXIT(0), then EXIT(PK_ERR) */ +} + +#endif /* !WINDLL */ + + + + +#if (!defined(VMS) && !defined(CMS_MVS)) +#if (!defined(OS2) || defined(TIMESTAMP)) + +#if (!defined(HAVE_MKTIME) || defined(AMIGA) || defined(WIN32)) +/* also used in amiga/filedate.c and win32/win32.c */ +ZCONST ush ydays[] = + { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; +#endif + +/*******************************/ +/* Function dos_to_unix_time() */ /* used for freshening/updating/timestamps */ +/*******************************/ + +time_t dos_to_unix_time(dosdatetime) + ulg dosdatetime; +{ + time_t m_time; + +#ifdef HAVE_MKTIME + + ZCONST time_t now = time(NULL); + struct tm *tm; +# define YRBASE 1900 + + tm = localtime(&now); + tm->tm_isdst = -1; /* let mktime determine if DST is in effect */ + + /* dissect date */ + tm->tm_year = ((int)(dosdatetime >> 25) & 0x7f) + (1980 - YRBASE); + tm->tm_mon = ((int)(dosdatetime >> 21) & 0x0f) - 1; + tm->tm_mday = ((int)(dosdatetime >> 16) & 0x1f); + + /* dissect time */ + tm->tm_hour = (int)((unsigned)dosdatetime >> 11) & 0x1f; + tm->tm_min = (int)((unsigned)dosdatetime >> 5) & 0x3f; + tm->tm_sec = (int)((unsigned)dosdatetime << 1) & 0x3e; + + m_time = mktime(tm); + NATIVE_TO_TIMET(m_time) /* NOP unless MSC 7.0 or Macintosh */ + TTrace((stderr, " final m_time = %lu\n", (ulg)m_time)); + +#else /* !HAVE_MKTIME */ + + int yr, mo, dy, hh, mm, ss; +#ifdef TOPS20 +# define YRBASE 1900 + struct tmx *tmx; + char temp[20]; +#else /* !TOPS20 */ +# define YRBASE 1970 + int leap; + unsigned days; + struct tm *tm; +#if (!defined(MACOS) && !defined(RISCOS) && !defined(QDOS) && !defined(TANDEM)) +#ifdef WIN32 + TIME_ZONE_INFORMATION tzinfo; + DWORD res; +#else /* ! WIN32 */ +#ifndef BSD4_4 /* GRR: change to !defined(MODERN) ? */ +#if (defined(BSD) || defined(MTS) || defined(__GO32__)) + struct timeb tbp; +#else /* !(BSD || MTS || __GO32__) */ +#ifdef DECLARE_TIMEZONE + extern time_t timezone; +#endif +#endif /* ?(BSD || MTS || __GO32__) */ +#endif /* !BSD4_4 */ +#endif /* ?WIN32 */ +#endif /* !MACOS && !RISCOS && !QDOS && !TANDEM */ +#endif /* ?TOPS20 */ + + + /* dissect date */ + yr = ((int)(dosdatetime >> 25) & 0x7f) + (1980 - YRBASE); + mo = ((int)(dosdatetime >> 21) & 0x0f) - 1; + dy = ((int)(dosdatetime >> 16) & 0x1f) - 1; + + /* dissect time */ + hh = (int)((unsigned)dosdatetime >> 11) & 0x1f; + mm = (int)((unsigned)dosdatetime >> 5) & 0x3f; + ss = (int)((unsigned)dosdatetime & 0x1f) * 2; + +#ifdef TOPS20 + tmx = (struct tmx *)malloc(sizeof(struct tmx)); + sprintf (temp, "%02d/%02d/%02d %02d:%02d:%02d", mo+1, dy+1, yr, hh, mm, ss); + time_parse(temp, tmx, (char *)0); + m_time = time_make(tmx); + free(tmx); + +#else /* !TOPS20 */ + +/*--------------------------------------------------------------------------- + Calculate the number of seconds since the epoch, usually 1 January 1970. + ---------------------------------------------------------------------------*/ + + /* leap = # of leap yrs from YRBASE up to but not including current year */ + leap = ((yr + YRBASE - 1) / 4); /* leap year base factor */ + + /* calculate days from BASE to this year and add expired days this year */ + days = (yr * 365) + (leap - 492) + ydays[mo]; + + /* if year is a leap year and month is after February, add another day */ + if ((mo > 1) && ((yr+YRBASE)%4 == 0) && ((yr+YRBASE) != 2100)) + ++days; /* OK through 2199 */ + + /* convert date & time to seconds relative to 00:00:00, 01/01/YRBASE */ + m_time = (time_t)((unsigned long)(days + dy) * 86400L + + (unsigned long)hh * 3600L + + (unsigned long)(mm * 60 + ss)); + /* - 1; MS-DOS times always rounded up to nearest even second */ + TTrace((stderr, "dos_to_unix_time:\n")); + TTrace((stderr, " m_time before timezone = %lu\n", (ulg)m_time)); + +/*--------------------------------------------------------------------------- + Adjust for local standard timezone offset. + ---------------------------------------------------------------------------*/ + +#if (!defined(MACOS) && !defined(RISCOS) && !defined(QDOS) && !defined(TANDEM)) +#ifdef WIN32 + /* account for timezone differences */ + res = GetTimeZoneInformation(&tzinfo); + if (res != TIME_ZONE_ID_UNKNOWN) + { + m_time += 60*(tzinfo.Bias); +#else /* !WIN32 */ +#if (defined(BSD) || defined(MTS) || defined(__GO32__)) +#ifdef BSD4_4 + if ( (dosdatetime >= DOSTIME_2038_01_18) && + (m_time < (time_t)0x70000000L) ) + m_time = U_TIME_T_MAX; /* saturate in case of (unsigned) overflow */ + if (m_time < (time_t)0L) /* a converted DOS time cannot be negative */ + m_time = S_TIME_T_MAX; /* -> saturate at max signed time_t value */ + if ((tm = localtime(&m_time)) != (struct tm *)NULL) + m_time -= tm->tm_gmtoff; /* sec. EAST of GMT: subtr. */ +#else /* !(BSD4_4 */ + ftime(&tbp); /* get `timezone' */ + m_time += tbp.timezone * 60L; /* seconds WEST of GMT: add */ +#endif /* ?(BSD4_4 || __EMX__) */ +#else /* !(BSD || MTS || __GO32__) */ + /* tzset was already called at start of process_zipfiles() */ + /* tzset(); */ /* set `timezone' variable */ +#ifndef __BEOS__ /* BeOS DR8 has no timezones... */ + m_time += timezone; /* seconds WEST of GMT: add */ +#endif +#endif /* ?(BSD || MTS || __GO32__) */ +#endif /* ?WIN32 */ + TTrace((stderr, " m_time after timezone = %lu\n", (ulg)m_time)); + +/*--------------------------------------------------------------------------- + Adjust for local daylight savings (summer) time. + ---------------------------------------------------------------------------*/ + +#ifndef BSD4_4 /* (DST already added to tm_gmtoff, so skip tm_isdst) */ + if ( (dosdatetime >= DOSTIME_2038_01_18) && + (m_time < (time_t)0x70000000L) ) + m_time = U_TIME_T_MAX; /* saturate in case of (unsigned) overflow */ + if (m_time < (time_t)0L) /* a converted DOS time cannot be negative */ + m_time = S_TIME_T_MAX; /* -> saturate at max signed time_t value */ + TIMET_TO_NATIVE(m_time) /* NOP unless MSC 7.0 or Macintosh */ + if (((tm = localtime((time_t *)&m_time)) != NULL) && tm->tm_isdst) +#ifdef WIN32 + m_time += 60L * tzinfo.DaylightBias; /* adjust with DST bias */ + else + m_time += 60L * tzinfo.StandardBias; /* add StdBias (normally 0) */ +#else + m_time -= 60L * 60L; /* adjust for daylight savings time */ +#endif + NATIVE_TO_TIMET(m_time) /* NOP unless MSC 7.0 or Macintosh */ + TTrace((stderr, " m_time after DST = %lu\n", (ulg)m_time)); +#endif /* !BSD4_4 */ +#ifdef WIN32 + } +#endif +#endif /* !MACOS && !RISCOS && !QDOS && !TANDEM */ +#endif /* ?TOPS20 */ + +#endif /* ?HAVE_MKTIME */ + + if ( (dosdatetime >= DOSTIME_2038_01_18) && + (m_time < (time_t)0x70000000L) ) + m_time = U_TIME_T_MAX; /* saturate in case of (unsigned) overflow */ + if (m_time < (time_t)0L) /* a converted DOS time cannot be negative */ + m_time = S_TIME_T_MAX; /* -> saturate at max signed time_t value */ + + return m_time; + +} /* end function dos_to_unix_time() */ + +#endif /* !OS2 || TIMESTAMP */ +#endif /* !VMS && !CMS_MVS */ + + + +#if (!defined(VMS) && !defined(OS2) && !defined(CMS_MVS)) + +/******************************/ +/* Function check_for_newer() */ /* used for overwriting/freshening/updating */ +/******************************/ + +int check_for_newer(__G__ filename) /* return 1 if existing file is newer */ + __GDEF /* or equal; 0 if older; -1 if doesn't */ + char *filename; /* exist yet */ +{ + time_t existing, archive; +#ifdef USE_EF_UT_TIME + iztimes z_utime; +#endif +#ifdef AOS_VS + long dyy, dmm, ddd, dhh, dmin, dss; + + + dyy = (lrec.last_mod_dos_datetime >> 25) + 1980; + dmm = (lrec.last_mod_dos_datetime >> 21) & 0x0f; + ddd = (lrec.last_mod_dos_datetime >> 16) & 0x1f; + dhh = (lrec.last_mod_dos_datetime >> 11) & 0x1f; + dmin = (lrec.last_mod_dos_datetime >> 5) & 0x3f; + dss = (lrec.last_mod_dos_datetime & 0x1f) * 2; + + /* under AOS/VS, file times can only be set at creation time, + * with the info in a special DG format. Make sure we can create + * it here - we delete it later & re-create it, whether or not + * it exists now. + */ + if (!zvs_create(filename, (((ulg)dgdate(dmm, ddd, dyy)) << 16) | + (dhh*1800L + dmin*30L + dss/2L), -1L, -1L, (char *) -1, -1, -1, -1)) + return DOES_NOT_EXIST; +#endif /* AOS_VS */ + + Trace((stderr, "check_for_newer: doing stat(%s)\n", FnFilter1(filename))); + if (SSTAT(filename, &G.statbuf)) { + Trace((stderr, + "check_for_newer: stat(%s) returns %d: file does not exist\n", + FnFilter1(filename), SSTAT(filename, &G.statbuf))); +#ifdef SYMLINKS + Trace((stderr, "check_for_newer: doing lstat(%s)\n", + FnFilter1(filename))); + /* GRR OPTION: could instead do this test ONLY if G.symlnk is true */ + if (lstat(filename, &G.statbuf) == 0) { + Trace((stderr, + "check_for_newer: lstat(%s) returns 0: symlink does exist\n", + FnFilter1(filename))); + if (QCOND2 && !uO.overwrite_all) + Info(slide, 0, ((char *)slide, LoadFarString(FileIsSymLink), + FnFilter1(filename), " with no real file")); + return EXISTS_AND_OLDER; /* symlink dates are meaningless */ + } +#endif /* SYMLINKS */ + return DOES_NOT_EXIST; + } + Trace((stderr, "check_for_newer: stat(%s) returns 0: file exists\n", + FnFilter1(filename))); + +#ifdef SYMLINKS + /* GRR OPTION: could instead do this test ONLY if G.symlnk is true */ + if (lstat(filename, &G.statbuf) == 0 && S_ISLNK(G.statbuf.st_mode)) { + Trace((stderr, "check_for_newer: %s is a symbolic link\n", + FnFilter1(filename))); + if (QCOND2 && !uO.overwrite_all) + Info(slide, 0, ((char *)slide, LoadFarString(FileIsSymLink), + FnFilter1(filename), "")); + return EXISTS_AND_OLDER; /* symlink dates are meaningless */ + } +#endif /* SYMLINKS */ + + NATIVE_TO_TIMET(G.statbuf.st_mtime) /* NOP unless MSC 7.0 or Macintosh */ + +#ifdef USE_EF_UT_TIME + /* The `Unix extra field mtime' should be used for comparison with the + * time stamp of the existing file >>>ONLY<<< when the EF info is also + * used to set the modification time of the extracted file. + */ + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0, + G.lrec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME)) + { + TTrace((stderr, "check_for_newer: using Unix extra field mtime\n")); + existing = G.statbuf.st_mtime; + archive = z_utime.mtime; + } else { + /* round up existing filetime to nearest 2 seconds for comparison, + * but saturate in case of arithmetic overflow + */ + existing = ((G.statbuf.st_mtime & 1) && + (G.statbuf.st_mtime + 1 > G.statbuf.st_mtime)) ? + G.statbuf.st_mtime + 1 : G.statbuf.st_mtime; + archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime); + } +#else /* !USE_EF_UT_TIME */ + /* round up existing filetime to nearest 2 seconds for comparison, + * but saturate in case of arithmetic overflow + */ + existing = ((G.statbuf.st_mtime & 1) && + (G.statbuf.st_mtime + 1 > G.statbuf.st_mtime)) ? + G.statbuf.st_mtime + 1 : G.statbuf.st_mtime; + archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime); +#endif /* ?USE_EF_UT_TIME */ + + TTrace((stderr, "check_for_newer: existing %lu, archive %lu, e-a %ld\n", + (ulg)existing, (ulg)archive, (long)(existing-archive))); + + return (existing >= archive); + +} /* end function check_for_newer() */ + +#endif /* !VMS && !OS2 && !CMS_MVS */ + + + + + +/************************/ +/* Function do_string() */ +/************************/ + +int do_string(__G__ len, option) /* return PK-type error code */ + __GDEF + unsigned int len; /* without prototype, ush converted to this */ + int option; +{ + long comment_bytes_left, block_length; + int error=PK_OK; + ush extra_len; +#ifdef AMIGA + char tmp_fnote[2 * AMIGA_FILENOTELEN]; /* extra room for squozen chars */ +#endif + + +/*--------------------------------------------------------------------------- + This function processes arbitrary-length (well, usually) strings. Four + options are allowed: SKIP, wherein the string is skipped (pretty logical, + eh?); DISPLAY, wherein the string is printed to standard output after un- + dergoing any necessary or unnecessary character conversions; DS_FN, + wherein the string is put into the filename[] array after undergoing ap- + propriate conversions (including case-conversion, if that is indicated: + see the global variable pInfo->lcflag); and EXTRA_FIELD, wherein the + `string' is assumed to be an extra field and is copied to the (freshly + malloced) buffer G.extra_field. The third option should be OK since + filename is dimensioned at 1025, but we check anyway. + + The string, by the way, is assumed to start at the current file-pointer + position; its length is given by len. So start off by checking length + of string: if zero, we're already done. + ---------------------------------------------------------------------------*/ + + if (!len) + return PK_COOL; + + switch (option) { + + /* + * First case: print string on standard output. First set loop vari- + * ables, then loop through the comment in chunks of OUTBUFSIZ bytes, + * converting formats and printing as we go. The second half of the + * loop conditional was added because the file might be truncated, in + * which case comment_bytes_left will remain at some non-zero value for + * all time. outbuf and slide are used as scratch buffers because they + * are available (we should be either before or in between any file pro- + * cessing). + */ + + case DISPLAY: + case DISPL_8: + comment_bytes_left = len; + block_length = OUTBUFSIZ; /* for the while statement, first time */ + while (comment_bytes_left > 0 && block_length > 0) { + register uch *p = G.outbuf; + register uch *q = G.outbuf; + + if ((block_length = readbuf(__G__ (char *)G.outbuf, + (unsigned) MIN((long)OUTBUFSIZ, comment_bytes_left))) == 0) + return PK_EOF; + comment_bytes_left -= block_length; + + /* this is why we allocated an extra byte for outbuf: terminate + * with zero (ASCIIZ) */ + G.outbuf[(unsigned)block_length] = '\0'; + + /* remove all ASCII carriage returns from comment before printing + * (since used before A_TO_N(), check for CR instead of '\r') + */ + while (*p) { + while (*p == CR) + ++p; + *q++ = *p++; + } + /* could check whether (p - outbuf) == block_length here */ + *q = '\0'; + + if (option == DISPL_8) { + /* translate the text coded in the entry's host-dependent + "extended ASCII" charset into the compiler's (system's) + internal text code page */ + Ext_ASCII_TO_Native((char *)G.outbuf, G.pInfo->hostnum, + G.crec.version_made_by[0]); +#ifdef WINDLL + /* translate to ANSI (RTL internal codepage may be OEM) */ + INTERN_TO_ISO((char *)G.outbuf, (char *)G.outbuf); +#else /* !WINDLL */ +#ifdef WIN32 + /* Win9x console always uses OEM character coding, and + WinNT console is set to OEM charset by default, too */ + INTERN_TO_OEM((char *)G.outbuf, (char *)G.outbuf); +#endif /* WIN32 */ +#endif /* ?WINDLL */ + } else { + A_TO_N(G.outbuf); /* translate string to native */ + } + +#ifdef WINDLL + /* ran out of local mem -- had to cheat */ + win_fprintf((zvoid *)&G, stdout, len, (char *)G.outbuf); + win_fprintf((zvoid *)&G, stdout, 2, (char *)"\n\n"); +#else /* !WINDLL */ +#ifdef NOANSIFILT /* GRR: can ANSI be used with EBCDIC? */ + (*G.message)((zvoid *)&G, G.outbuf, (ulg)(q-G.outbuf), 0); +#else /* ASCII, filter out ANSI escape sequences and handle ^S (pause) */ + p = G.outbuf - 1; + q = slide; + while (*++p) { + int pause = FALSE; + + if (*p == 0x1B) { /* ASCII escape char */ + *q++ = '^'; + *q++ = '['; + } else if (*p == 0x13) { /* ASCII ^S (pause) */ + pause = TRUE; + if (p[1] == LF) /* ASCII LF */ + *q++ = *++p; + else if (p[1] == CR && p[2] == LF) { /* ASCII CR LF */ + *q++ = *++p; + *q++ = *++p; + } + } else + *q++ = *p; + if ((unsigned)(q-slide) > WSIZE-3 || pause) { /* flush */ + (*G.message)((zvoid *)&G, slide, (ulg)(q-slide), 0); + q = slide; + if (pause && G.extract_flag) /* don't pause for list/test */ + (*G.mpause)((zvoid *)&G, LoadFarString(QuitPrompt), 0); + } + } + (*G.message)((zvoid *)&G, slide, (ulg)(q-slide), 0); +#endif /* ?NOANSIFILT */ +#endif /* ?WINDLL */ + } + /* add '\n' if not at start of line */ + (*G.message)((zvoid *)&G, slide, 0L, 0x40); + break; + + /* + * Second case: read string into filename[] array. The filename should + * never ever be longer than FILNAMSIZ-1 (1024), but for now we'll check, + * just to be sure. + */ + + case DS_FN: + extra_len = 0; + if (len >= FILNAMSIZ) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(FilenameTooLongTrunc))); + error = PK_WARN; + extra_len = (ush)(len - FILNAMSIZ + 1); + len = FILNAMSIZ - 1; + } + if (readbuf(__G__ G.filename, len) == 0) + return PK_EOF; + G.filename[len] = '\0'; /* terminate w/zero: ASCIIZ */ + + /* translate the Zip entry filename coded in host-dependent "extended + ASCII" into the compiler's (system's) internal text code page */ + Ext_ASCII_TO_Native(G.filename, G.pInfo->hostnum, + G.crec.version_made_by[0]); + + if (G.pInfo->lcflag) /* replace with lowercase filename */ + TOLOWER(G.filename, G.filename); + + if (G.pInfo->vollabel && len > 8 && G.filename[8] == '.') { + char *p = G.filename+8; + while (*p++) + p[-1] = *p; /* disk label, and 8th char is dot: remove dot */ + } + + if (!extra_len) /* we're done here */ + break; + + /* + * We truncated the filename, so print what's left and then fall + * through to the SKIP routine. + */ + Info(slide, 0x401, ((char *)slide, "[ %s ]\n", FnFilter1(G.filename))); + len = extra_len; + /* FALL THROUGH... */ + + /* + * Third case: skip string, adjusting readbuf's internal variables + * as necessary (and possibly skipping to and reading a new block of + * data). + */ + + case SKIP: + /* cur_zipfile_bufstart already takes account of extra_bytes, so don't + * correct for it twice: */ + ZLSEEK(G.cur_zipfile_bufstart - G.extra_bytes + + (G.inptr-G.inbuf) + len) + break; + + /* + * Fourth case: assume we're at the start of an "extra field"; malloc + * storage for it and read data into the allocated space. + */ + + case EXTRA_FIELD: + if (G.extra_field != (uch *)NULL) + free(G.extra_field); + if ((G.extra_field = (uch *)malloc(len)) == (uch *)NULL) { + Info(slide, 0x401, ((char *)slide, LoadFarString(ExtraFieldTooLong), + len)); + /* cur_zipfile_bufstart already takes account of extra_bytes, + * so don't correct for it twice: */ + ZLSEEK(G.cur_zipfile_bufstart - G.extra_bytes + + (G.inptr-G.inbuf) + len) + } else + if (readbuf(__G__ (char *)G.extra_field, len) == 0) + return PK_EOF; + break; + +#ifdef AMIGA + /* + * Fifth case, for the Amiga only: take the comment that would ordinarily + * be skipped over, and turn it into a 79 character string that will be + * attached to the file as a "filenote" after it is extracted. + */ + + case FILENOTE: + if ((extra_len = readbuf(__G__ tmp_fnote, (unsigned) + MIN(len, 2 * AMIGA_FILENOTELEN - 1))) == 0) + return PK_EOF; + if ((len -= extra_len) > 0) /* treat remainder as in case SKIP: */ + ZLSEEK(G.cur_zipfile_bufstart - G.extra_bytes + + (G.inptr - G.inbuf) + len) + /* convert multi-line text into single line with no ctl-chars: */ + tmp_fnote[extra_len] = '\0'; + while ((short int) --extra_len >= 0) + if ((unsigned) tmp_fnote[extra_len] < ' ') + if (tmp_fnote[extra_len+1] == ' ') /* no excess */ + strcpy(tmp_fnote+extra_len, tmp_fnote+extra_len+1); + else + tmp_fnote[extra_len] = ' '; + tmp_fnote[AMIGA_FILENOTELEN - 1] = '\0'; + if (G.filenotes[G.filenote_slot]) + free(G.filenotes[G.filenote_slot]); /* should not happen */ + G.filenotes[G.filenote_slot] = NULL; + if (tmp_fnote[0]) { + if (!(G.filenotes[G.filenote_slot] = malloc(strlen(tmp_fnote)+1))) + return PK_MEM; + strcpy(G.filenotes[G.filenote_slot], tmp_fnote); + } + break; +#endif /* AMIGA */ + + } /* end switch (option) */ + + return error; + +} /* end function do_string() */ + + + + + +/***********************/ +/* Function makeword() */ +/***********************/ + +ush makeword(b) + ZCONST uch *b; +{ + /* + * Convert Intel style 'short' integer to non-Intel non-16-bit + * host format. This routine also takes care of byte-ordering. + */ + return (ush)((b[1] << 8) | b[0]); +} + + + + + +/***********************/ +/* Function makelong() */ +/***********************/ + +ulg makelong(sig) + ZCONST uch *sig; +{ + /* + * Convert intel style 'long' variable to non-Intel non-16-bit + * host format. This routine also takes care of byte-ordering. + */ + return (((ulg)sig[3]) << 24) + + (((ulg)sig[2]) << 16) + + (((ulg)sig[1]) << 8) + + ((ulg)sig[0]); +} + + + +#if CRYPT + +#ifdef NEED_STR2ISO +/**********************/ +/* Function str2iso() */ +/**********************/ + +char *str2iso(dst, src) + char *dst; /* destination buffer */ + register ZCONST char *src; /* source string */ +{ +#ifdef INTERN_TO_ISO + INTERN_TO_ISO(src, dst); +#else + register uch c; + register char *dstp = dst; + + do { + c = (uch)foreign(*src++); + *dstp++ = (char)ASCII2ISO(c); + } while (c != '\0'); +#endif + + return dst; +} +#endif /* NEED_STR2ISO */ + + +#ifdef NEED_STR2OEM +/**********************/ +/* Function str2oem() */ +/**********************/ + +char *str2oem(dst, src) + char *dst; /* destination buffer */ + register ZCONST char *src; /* source string */ +{ +#ifdef INTERN_TO_OEM + INTERN_TO_OEM(src, dst); +#else + register uch c; + register char *dstp = dst; + + do { + c = (uch)foreign(*src++); + *dstp++ = (char)ASCII2OEM(c); + } while (c != '\0'); +#endif + + return dst; +} +#endif /* NEED_STR2OEM */ + +#endif /* CRYPT */ + + +#ifdef ZMEM /* memset/memcmp/memcpy for systems without either them or */ + /* bzero/bcmp/bcopy */ + /* (no known systems as of 960211) */ + +/*********************/ +/* Function memset() */ +/*********************/ + +zvoid *memset(buf, init, len) + register zvoid *buf; /* buffer location */ + register int init; /* initializer character */ + register unsigned int len; /* length of the buffer */ +{ + zvoid *start; + + start = buf; + while (len--) + *((char *)buf++) = (char)init; + return start; +} + + + +/*********************/ +/* Function memcmp() */ +/*********************/ + +int memcmp(b1, b2, len) + register ZCONST zvoid *b1; + register ZCONST zvoid *b2; + register unsigned int len; +{ + register int c; + + if (len > 0) do { + if ((c = (int)(*((ZCONST unsigned char *)b1)++) - + (int)(*((ZCONST unsigned char *)b2)++)) != 0) + return c; + } while (--len > 0) + return 0; +} + + + +/*********************/ +/* Function memcpy() */ +/*********************/ + +zvoid *memcpy(dst, src, len) + register zvoid *dst; + register ZCONST zvoid *src; + register unsigned int len; +{ + zvoid *start; + + start = dst; + while (len-- > 0) + *((char *)dst)++ = *((ZCONST char *)src)++; + return start; +} + +#endif /* ZMEM */ + + + + + +/************************/ +/* Function zstrnicmp() */ +/************************/ + +int zstrnicmp(s1, s2, n) + register ZCONST char *s1, *s2; + register unsigned n; +{ + for (; n > 0; --n, ++s1, ++s2) { + + if (ToLower(*s1) != ToLower(*s2)) + /* test includes early termination of one string */ + return (ToLower(*s1) < ToLower(*s2))? -1 : 1; + + if (*s1 == '\0') /* both strings terminate early */ + return 0; + } + return 0; +} + + + + + +#ifdef REGULUS /* returns the inode number on success(!)...argh argh argh */ +# undef stat + +/********************/ +/* Function zstat() */ +/********************/ + +int zstat(p, s) + char *p; + struct stat *s; +{ + return (stat(p,s) >= 0? 0 : (-1)); +} + +#endif /* REGULUS */ + + + + + +#ifdef SMALL_MEM + +/*******************************/ +/* Function fLoadFarString() */ /* (and friends...) */ +/*******************************/ + +char *fLoadFarString(__GPRO__ const char Far *sz) +{ + (void)zfstrcpy(G.rgchBigBuffer, sz); + return G.rgchBigBuffer; +} + +char *fLoadFarStringSmall(__GPRO__ const char Far *sz) +{ + (void)zfstrcpy(G.rgchSmallBuffer, sz); + return G.rgchSmallBuffer; +} + +char *fLoadFarStringSmall2(__GPRO__ const char Far *sz) +{ + (void)zfstrcpy(G.rgchSmallBuffer2, sz); + return G.rgchSmallBuffer2; +} + + + + +#if (!defined(_MSC_VER) || (_MSC_VER < 600)) +/*************************/ +/* Function zfstrcpy() */ /* portable clone of _fstrcpy() */ +/*************************/ + +char Far * Far zfstrcpy(char Far *s1, const char Far *s2) +{ + char Far *p = s1; + + while ((*s1++ = *s2++) != '\0'); + return p; +} +#endif /* !_MSC_VER || (_MSC_VER < 600) */ + +#endif /* SMALL_MEM */ diff --git a/utils/Install/sfxzip/funzip.c b/utils/Install/sfxzip/funzip.c new file mode 100644 index 0000000000..e83ae424d2 --- /dev/null +++ b/utils/Install/sfxzip/funzip.c @@ -0,0 +1,468 @@ +/* funzip.c -- put in the public domain by Mark Adler */ + +#define VERSION "3.93 of 21 November 1998" + + +/* You can do whatever you like with this source file, though I would + prefer that if you modify it and redistribute it that you include + comments to that effect with your name and the date. Thank you. + + History: + vers date who what + ---- --------- -------------- ------------------------------------ + 1.0 13 Aug 92 M. Adler really simple unzip filter. + 1.1 13 Aug 92 M. Adler cleaned up somewhat, give help if + stdin not redirected, warn if more + zip file entries after the first. + 1.2 15 Aug 92 M. Adler added check of lengths for stored + entries, added more help. + 1.3 16 Aug 92 M. Adler removed redundant #define's, added + decryption. + 1.4 27 Aug 92 G. Roelofs added exit(0). + 1.5 1 Sep 92 K. U. Rommel changed read/write modes for OS/2. + 1.6 6 Sep 92 G. Roelofs modified to use dummy crypt.c and + crypt.h instead of -DCRYPT. + 1.7 23 Sep 92 G. Roelofs changed to use DOS_OS2; included + crypt.c under MS-DOS. + 1.8 9 Oct 92 M. Adler improved inflation error msgs. + 1.9 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch; + renamed inflate_entry() to inflate(); + adapted to use new, in-place zdecode. + 2.0 22 Oct 92 M. Adler allow filename argument, prompt for + passwords and don't echo, still allow + command-line password entry, but as an + option. + 2.1 23 Oct 92 J-l. Gailly fixed crypt/store bug, + G. Roelofs removed crypt.c under MS-DOS, fixed + decryption check to compare single byte. + 2.2 28 Oct 92 G. Roelofs removed declaration of key. + 2.3 14 Dec 92 M. Adler replaced fseek (fails on stdin for SCO + Unix V.3.2.4). added quietflg for + inflate.c. + 3.0 11 May 93 M. Adler added gzip support + 3.1 9 Jul 93 K. U. Rommel fixed OS/2 pipe bug (PIPE_ERROR) + 3.2 4 Sep 93 G. Roelofs moved crc_32_tab[] to tables.h; used FOPx + from unzip.h; nuked OUTB macro and outbuf; + replaced flush(); inlined FlushOutput(); + renamed decrypt to encrypted + 3.3 29 Sep 93 G. Roelofs replaced ReadByte() with NEXTBYTE macro; + revised (restored?) flush(); added FUNZIP + 3.4 21 Oct 93 G. Roelofs renamed quietflg to qflag; changed outcnt, + H. Gessau second updcrc() arg and flush() arg to ulg; + added inflate_free(); added "g =" to null + getc(in) to avoid compiler warnings + 3.5 31 Oct 93 H. Gessau changed DOS_OS2 to DOS_NT_OS2 + 3.6 6 Dec 93 H. Gessau added "near" to mask_bits[] + 3.7 9 Dec 93 G. Roelofs added extent typecasts to fwrite() checks + 3.8 28 Jan 94 GRR/JlG initialized g variable in main() for gcc + 3.81 22 Feb 94 M. Hanning-Lee corrected usage message + 3.82 27 Feb 94 G. Roelofs added some typecasts to avoid warnings + 3.83 22 Jul 94 G. Roelofs changed fprintf to macro for DLLs + - 2 Aug 94 - public release with UnZip 5.11 + - 28 Aug 94 - public release with UnZip 5.12 + 3.84 1 Oct 94 K. U. Rommel changes for Metaware High C + 3.85 29 Oct 94 G. Roelofs changed fprintf macro to Info + 3.86 7 May 95 K. Davis RISCOS patches; + P. Kienitz Amiga patches + 3.87 12 Aug 95 G. Roelofs inflate_free(), DESTROYGLOBALS fixes + 3.88 4 Sep 95 C. Spieler reordered macro to work around MSC 5.1 bug + 3.89 22 Nov 95 PK/CS ifdef'd out updcrc() for ASM_CRC + 3.9 17 Dec 95 G. Roelofs modified for USE_ZLIB (new fillinbuf()) + - 30 Apr 96 - public release with UnZip 5.2 + 3.91 17 Aug 96 G. Roelofs main() -> return int (Peter Seebach) + 3.92 13 Apr 97 G. Roelofs minor cosmetic fixes to messages + - 22 Apr 97 - public release with UnZip 5.3 + - 31 May 97 - public release with UnZip 5.31 + 3.93 20 Sep 97 G. Roelofs minor cosmetic fixes to messages + - 3 Nov 97 - public release with UnZip 5.32 + - 28 Nov 98 - public release with UnZip 5.4 + */ + + +/* + + All funzip does is take a zipfile from stdin and decompress the + first entry to stdout. The entry has to be either deflated or + stored. If the entry is encrypted, then the decryption password + must be supplied on the command line as the first argument. + + funzip needs to be linked with inflate.o and crypt.o compiled from + the unzip source. If decryption is desired, the full version of + crypt.c (and crypt.h) from zcrypt21.zip or later must be used. + + */ + +#define FUNZIP +#define UNZIP_INTERNAL +#include "unzip.h" +#include "crypt.h" +#include "ttyio.h" + +#ifdef EBCDIC +# undef EBCDIC /* don't need ebcdic[] */ +#endif +#include "tables.h" /* crc_32_tab[] */ + +#ifndef USE_ZLIB /* zlib's function is called inflate(), too */ +# define UZinflate inflate +#endif + +/* PKZIP header definitions */ +#define ZIPMAG 0x4b50 /* two-byte zip lead-in */ +#define LOCREM 0x0403 /* remaining two bytes in zip signature */ +#define LOCSIG 0x04034b50L /* full signature */ +#define LOCFLG 4 /* offset of bit flag */ +#define CRPFLG 1 /* bit for encrypted entry */ +#define EXTFLG 8 /* bit for extended local header */ +#define LOCHOW 6 /* offset of compression method */ +#define LOCTIM 8 /* file mod time (for decryption) */ +#define LOCCRC 12 /* offset of crc */ +#define LOCSIZ 16 /* offset of compressed size */ +#define LOCLEN 20 /* offset of uncompressed length */ +#define LOCFIL 24 /* offset of file name field length */ +#define LOCEXT 26 /* offset of extra field length */ +#define LOCHDR 28 /* size of local header, including LOCREM */ +#define EXTHDR 16 /* size of extended local header, inc sig */ + +/* GZIP header definitions */ +#define GZPMAG 0x8b1f /* two-byte gzip lead-in */ +#define GZPHOW 0 /* offset of method number */ +#define GZPFLG 1 /* offset of gzip flags */ +#define GZPMUL 2 /* bit for multiple-part gzip file */ +#define GZPISX 4 /* bit for extra field present */ +#define GZPISF 8 /* bit for filename present */ +#define GZPISC 16 /* bit for comment present */ +#define GZPISE 32 /* bit for encryption */ +#define GZPTIM 2 /* offset of Unix file modification time */ +#define GZPEXF 6 /* offset of extra flags */ +#define GZPCOS 7 /* offset of operating system compressed on */ +#define GZPHDR 8 /* length of minimal gzip header */ + +/* Macros for getting two-byte and four-byte header values */ +#define SH(p) ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8)) +#define LG(p) ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16)) + +/* Function prototypes */ +void err OF((int, char *)); +int main OF((int, char **)); + +/* Globals */ +FILE *out; /* output file (*in moved to G struct) */ +ulg outsiz; /* total bytes written to out */ +int encrypted; /* flag to turn on decryption */ + +/* Masks for inflate.c */ +ZCONST ush near mask_bits[] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; + + +#ifdef USE_ZLIB + +int fillinbuf(__G) +__GDEF +/* Fill input buffer for pull-model inflate() in zlib. Return the number of + * bytes in inbuf. */ +{ +/* GRR: check return value from fread(): same as read()? check errno? */ + if ((G.incnt = fread((char *)G.inbuf, 1, INBUFSIZ, G.in)) <= 0) + return 0; + G.inptr = G.inbuf; + +#if CRYPT + if (encrypted) { + uch *p; + int n; + + for (n = G.incnt, p = G.inptr; n--; p++) + zdecode(*p); + } +#endif /* CRYPT */ + + return G.incnt; + +} + +#endif /* USE_ZLIB */ + + +#if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB)) +#ifdef USE_ZLIB +ZCONST uLongf *get_crc_table() +{ + return (ZCONST uLongf *)crc_32_tab; +} +#else /* !USE_ZLIB */ +ZCONST ulg near *get_crc_table() +{ + return crc_32_tab; +} +#endif /* ?USE_ZLIB */ +#endif /* !USE_ZLIB || USE_OWN_CRCTAB */ + + +void err(n, m) +int n; +char *m; +/* Exit on error with a message and a code */ +{ + Info(slide, 1, ((char *)slide, "funzip error: %s\n", m)); + DESTROYGLOBALS() + EXIT(n); +} + + +int flush(w) /* used by inflate.c (FLUSH macro) */ +ulg w; /* number of bytes to flush */ +{ + G.crc32val = crc32(G.crc32val, slide, (extent)w); + if (fwrite((char *)slide,1,(extent)w,out) != (extent)w && !PIPE_ERROR) + err(9, "out of space on stdout"); + outsiz += w; + return 0; +} + + +int main(argc, argv) +int argc; +char **argv; +/* Given a zipfile on stdin, decompress the first entry to stdout. */ +{ + ush n; + uch h[LOCHDR]; /* first local header (GZPHDR < LOCHDR) */ + int g = 0; /* true if gzip format */ +#if CRYPT + char *s = " [-password]"; + char *p; /* password */ +#else /* !CRYPT */ + char *s = ""; +#endif /* ?CRYPT */ + CONSTRUCTGLOBALS(); + + /* skip executable name */ + argc--; + argv++; + +#if CRYPT + /* get the command line password, if any */ + p = (char *)NULL; + if (argc && **argv == '-') + { + argc--; + p = 1 + *argv++; + } +#endif /* CRYPT */ + +#ifdef MALLOC_WORK + G.area.Slide = (uch *)calloc(8193, sizeof(short)+sizeof(char)+sizeof(char)); +#endif + + /* if no file argument and stdin not redirected, give the user help */ + if (argc == 0 && isatty(0)) + { + Info(slide, 1, ((char *)slide, "fUnZip (filter UnZip), version %s\n", + VERSION)); + Info(slide, 1, ((char *)slide, "usage: ... | funzip%s | ...\n", s)); + Info(slide, 1, ((char *)slide, " ... | funzip%s > outfile\n", s)); + Info(slide, 1, ((char *)slide, " funzip%s infile.zip > outfile\n",s)); + Info(slide, 1, ((char *)slide, " funzip%s infile.gz > outfile\n", s)); + Info(slide, 1, ((char *)slide, "Extracts to stdout the gzip file or first\ + zip entry of stdin or the given file.\n")); + DESTROYGLOBALS() + EXIT(3); + } + + /* prepare to be a binary filter */ + if (argc) + { + if ((G.in = fopen(*argv, FOPR)) == (FILE *)NULL) + err(2, "cannot find input file"); + } + else + { +#ifdef DOS_FLX_H68_OS2_W32 +#if (defined(__HIGHC__) && !defined(FLEXOS)) + setmode(stdin, _BINARY); +#else + setmode(0, O_BINARY); /* some buggy C libraries require BOTH setmode() */ +#endif /* call AND the fdopen() in binary mode :-( */ +#endif /* DOS_FLX_H68_OS2_W32 */ + +#ifdef RISCOS + G.in = stdin; +#else + if ((G.in = fdopen(0, FOPR)) == (FILE *)NULL) + err(2, "cannot find stdin"); +#endif + } + +#ifdef DOS_FLX_H68_OS2_W32 +#if (defined(__HIGHC__) && !defined(FLEXOS)) + setmode(stdout, _BINARY); +#else + setmode(1, O_BINARY); +#endif +#endif /* DOS_FLX_H68_OS2_W32 */ + +#ifdef RISCOS + out = stdout; +#else + if ((out = fdopen(1, FOPW)) == (FILE *)NULL) + err(2, "cannot write to stdout"); +#endif + + /* read local header, check validity, and skip name and extra fields */ + n = getc(G.in); n |= getc(G.in) << 8; + if (n == ZIPMAG) + { + if (fread((char *)h, 1, LOCHDR, G.in) != LOCHDR || SH(h) != LOCREM) + err(3, "invalid zipfile"); + if (SH(h + LOCHOW) != STORED && SH(h + LOCHOW) != DEFLATED) + err(3, "first entry not deflated or stored--cannot unpack"); + for (n = SH(h + LOCFIL); n--; ) g = getc(G.in); + for (n = SH(h + LOCEXT); n--; ) g = getc(G.in); + g = 0; + encrypted = h[LOCFLG] & CRPFLG; + } + else if (n == GZPMAG) + { + if (fread((char *)h, 1, GZPHDR, G.in) != GZPHDR) + err(3, "invalid gzip file"); + if (h[GZPHOW] != DEFLATED) + err(3, "gzip file not deflated"); + if (h[GZPFLG] & GZPMUL) + err(3, "cannot handle multi-part gzip files"); + if (h[GZPFLG] & GZPISX) + { + n = getc(G.in); n |= getc(G.in) << 8; + while (n--) g = getc(G.in); + } + if (h[GZPFLG] & GZPISF) + while ((g = getc(G.in)) != 0 && g != EOF) ; + if (h[GZPFLG] & GZPISC) + while ((g = getc(G.in)) != 0 && g != EOF) ; + g = 1; + encrypted = h[GZPFLG] & GZPISE; + } + else + err(3, "input not a zip or gzip file"); + + /* if entry encrypted, decrypt and validate encryption header */ + if (encrypted) +#if CRYPT + { + ush i, e; + + if (p == (char *)NULL) { + if ((p = (char *)malloc(IZ_PWLEN+1)) == (char *)NULL) + err(1, "out of memory"); + else if ((p = getp("Enter password: ", p, IZ_PWLEN+1)) == (char *)NULL) + err(1, "no tty to prompt for password"); + } +#if (defined(USE_ZLIB) && !defined(USE_OWN_CRCTAB)) + /* initialize crc_32_tab pointer for decryption */ + CRC_32_TAB = (ZCONST ulg Far *)get_crc_table(); +#endif + init_keys(p); + for (i = 0; i < RAND_HEAD_LEN; i++) + e = NEXTBYTE; + if (e != (ush)(h[LOCFLG] & EXTFLG ? h[LOCTIM + 1] : h[LOCCRC + 3])) + err(3, "incorrect password for first entry"); + } +#else /* !CRYPT */ + err(3, "cannot decrypt entry (need to recompile with full crypt.c)"); +#endif /* ?CRYPT */ + + /* prepare output buffer and crc */ + G.outptr = slide; + G.outcnt = 0L; + outsiz = 0L; + G.crc32val = CRCVAL_INITIAL; + + /* decompress */ + if (g || h[LOCHOW]) + { /* deflated entry */ + int r; + +#ifdef USE_ZLIB + /* need to allocate and prepare input buffer */ + if ((G.inbuf = (uch *)malloc(INBUFSIZ)) == (uch *)NULL) + err(1, "out of memory"); +#endif /* USE_ZLIB */ + if ((r = UZinflate(__G)) != 0) { + if (r == 3) + err(1, "out of memory"); + else + err(4, "invalid compressed data--format violated"); + } + inflate_free(__G); + } + else + { /* stored entry */ + register ulg n; + + n = LG(h + LOCLEN); +#if CRYPT + if (n != LG(h + LOCSIZ) - (encrypted ? RAND_HEAD_LEN : 0)) { +#else + if (n != LG(h + LOCSIZ)) { +#endif + Info(slide, 1, ((char *)slide, "len %ld, siz %ld\n", n, LG(h + LOCSIZ))); + err(4, "invalid compressed data--length mismatch"); + } + while (n--) { + ush c = getc(G.in); +#if CRYPT + if (encrypted) + zdecode(c); +#endif + *G.outptr++ = (uch)c; + if (++G.outcnt == WSIZE) /* do FlushOutput() */ + { + G.crc32val = crc32(G.crc32val, slide, (extent)G.outcnt); + if (fwrite((char *)slide, 1,(extent)G.outcnt,out) != (extent)G.outcnt + && !PIPE_ERROR) + err(9, "out of space on stdout"); + outsiz += G.outcnt; + G.outptr = slide; + G.outcnt = 0L; + } + } + } + if (G.outcnt) /* flush one last time; no need to reset G.outptr/outcnt */ + { + G.crc32val = crc32(G.crc32val, slide, (extent)G.outcnt); + if (fwrite((char *)slide, 1,(extent)G.outcnt,out) != (extent)G.outcnt + && !PIPE_ERROR) + err(9, "out of space on stdout"); + outsiz += G.outcnt; + } + fflush(out); + + /* if extended header, get it */ + if (g) + { + if (fread((char *)h + LOCCRC, 1, 8, G.in) != 8) + err(3, "gzip file ended prematurely"); + } + else + if ((h[LOCFLG] & EXTFLG) && + fread((char *)h + LOCCRC - 4, 1, EXTHDR, G.in) != EXTHDR) + err(3, "zipfile ended prematurely"); + + /* validate decompression */ + if (LG(h + LOCCRC) != G.crc32val) + err(4, "invalid compressed data--crc error"); + if (LG((g ? (h + LOCSIZ) : (h + LOCLEN))) != outsiz) + err(4, "invalid compressed data--length error"); + + /* check if there are more entries */ + if (!g && fread((char *)h, 1, 4, G.in) == 4 && LG(h) == LOCSIG) + Info(slide, 1, ((char *)slide, + "funzip warning: zipfile has more than one entry--rest ignored\n")); + + DESTROYGLOBALS() + RETURN (0); +} diff --git a/utils/Install/sfxzip/globals.c b/utils/Install/sfxzip/globals.c new file mode 100644 index 0000000000..d795090b98 --- /dev/null +++ b/utils/Install/sfxzip/globals.c @@ -0,0 +1,204 @@ +/*--------------------------------------------------------------------------- + + globals.c + + Routines to allocate and initialize globals, with or without threads. + + Contents: registerGlobalPointer() + deregisterGlobalPointer() + getGlobalPointer() + globalsCtor() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" + +#ifndef FUNZIP +/* initialization of sigs is completed at runtime so unzip(sfx) executable + * won't look like a zipfile + */ +char central_hdr_sig[4] = {0, 0, 0x01, 0x02}; +char local_hdr_sig[4] = {0, 0, 0x03, 0x04}; +char end_central_sig[4] = {0, 0, 0x05, 0x06}; +/* extern char extd_local_sig[4] = {0, 0, 0x07, 0x08}; NOT USED YET */ + +ZCONST char *fnames[2] = {"*", NULL}; /* default filenames vector */ +#endif + + +#ifndef REENTRANT + Uz_Globs G; +#else /* REENTRANT */ + +# ifndef USETHREADID + Uz_Globs *GG; +# else /* USETHREADID */ +# define THREADID_ENTRIES 0x40 + + int lastScan; + Uz_Globs *threadPtrTable[THREADID_ENTRIES]; + ulg threadIdTable [THREADID_ENTRIES] = { + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* Make sure there are */ + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* THREADID_ENTRIES 0s */ + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 + }; + + static ZCONST char Far TooManyThreads[] = + "error: more than %d simultaneous threads.\n\ + Some threads are probably not calling DESTROYTHREAD()\n"; + static ZCONST char Far EntryNotFound[] = + "error: couldn't find global pointer in table.\n\ + Maybe somebody accidentally called DESTROYTHREAD() twice.\n"; + static ZCONST char Far GlobalPointerMismatch[] = + "error: global pointer in table does not match pointer passed as\ + parameter\n"; + +static void registerGlobalPointer OF((__GPRO)); + + + +static void registerGlobalPointer(__G) + __GDEF +{ + int scan=0; + ulg tid = GetThreadId(); + + while (threadIdTable[scan] && scan < THREADID_ENTRIES) + scan++; + + if (scan == THREADID_ENTRIES) { + ZCONST char *tooMany = LoadFarString(TooManyThreads); + Info(slide, 0x421, ((char *)slide, tooMany, THREADID_ENTRIES)); + free(pG); + EXIT(PK_MEM); /* essentially memory error before we've started */ + } + + threadIdTable [scan] = tid; + threadPtrTable[scan] = pG; + lastScan = scan; +} + + + +void deregisterGlobalPointer(__G) + __GDEF +{ + int scan=0; + ulg tid = GetThreadId(); + + + while (threadIdTable[scan] != tid && scan < THREADID_ENTRIES) + scan++; + +/*--------------------------------------------------------------------------- + There are two things we can do if we can't find the entry: ignore it or + scream. The most likely reason for it not to be here is the user calling + this routine twice. Since this could cause BIG problems if any globals + are accessed after the first call, we'd better scream. + ---------------------------------------------------------------------------*/ + + if (scan == THREADID_ENTRIES || threadPtrTable[scan] != pG) { + ZCONST char *noEntry; + if (scan == THREADID_ENTRIES) + noEntry = LoadFarString(EntryNotFound); + else + noEntry = LoadFarString(GlobalPointerMismatch); + Info(slide, 0x421, ((char *)slide, noEntry)); + EXIT(PK_WARN); /* programming error, but after we're all done */ + } + + threadIdTable [scan] = 0; + lastScan = scan; + free(threadPtrTable[scan]); +} + + + +Uz_Globs *getGlobalPointer() +{ + int scan=0; + ulg tid = GetThreadId(); + + while (threadIdTable[scan] != tid && scan < THREADID_ENTRIES) + scan++; + +/*--------------------------------------------------------------------------- + There are two things we can do if we can't find the entry: ignore it or + scream. The most likely reason for it not to be here is the user calling + this routine twice. Since this could cause BIG problems if any globals + are accessed after the first call, we'd better scream. + ---------------------------------------------------------------------------*/ + + if (scan == THREADID_ENTRIES) { + ZCONST char *noEntry = LoadFarString(EntryNotFound); + fprintf(stderr, noEntry); /* can't use Info w/o a global pointer */ + EXIT(PK_ERR); /* programming error while still working */ + } + + return threadPtrTable[scan]; +} + +# endif /* ?USETHREADID */ +#endif /* ?REENTRANT */ + + + +Uz_Globs *globalsCtor() +{ +#ifdef REENTRANT + Uz_Globs *pG = (Uz_Globs *)malloc(sizeof(Uz_Globs)); + + if (!pG) + return (Uz_Globs *)NULL; +#endif /* REENTRANT */ + + /* for REENTRANT version, G is defined as (*pG) */ + + memzero(&G, sizeof(Uz_Globs)); + +#ifndef FUNZIP +#ifdef CMS_MVS + uO.aflag=1; + uO.C_flag=1; +#endif + + uO.lflag=(-1); + G.wildzipfn = ""; + G.pfnames = (char **)fnames; + G.pxnames = (char **)&fnames[1]; + G.pInfo = G.info; + G.sol = TRUE; /* at start of line */ + + G.message = UzpMessagePrnt; + G.input = UzpInput; /* not used by anyone at the moment... */ +#if defined(WINDLL) || defined(MACOS) + G.mpause = NULL; /* has scrollbars: no need for pausing */ +#else + G.mpause = UzpMorePause; +#endif + G.decr_passwd = UzpPassword; +#endif /* !FUNZIP */ + +#if (!defined(DOS_FLX_H68_OS2_W32) && !defined(AMIGA) && !defined(RISCOS)) +#if (!defined(MACOS) && !defined(ATARI) && !defined(VMS)) + G.echofd = -1; +#endif /* !(MACOS || ATARI || VMS) */ +#endif /* !(DOS_FLX_H68_OS2_W32 || AMIGA || RISCOS) */ + +#ifdef SYSTEM_SPECIFIC_CTOR + SYSTEM_SPECIFIC_CTOR(__G); +#endif + +#ifdef REENTRANT +#ifdef USETHREADID + registerGlobalPointer(__G); +#else + GG = &G; +#endif /* ?USETHREADID */ +#endif /* REENTRANT */ + + return &G; +} diff --git a/utils/Install/sfxzip/inflate.c b/utils/Install/sfxzip/inflate.c new file mode 100644 index 0000000000..29877300d2 --- /dev/null +++ b/utils/Install/sfxzip/inflate.c @@ -0,0 +1,1305 @@ +/* inflate.c -- put in the public domain by Mark Adler + version c16b, 29 March 1998 */ + + +/* You can do whatever you like with this source file, though I would + prefer that if you modify it and redistribute it that you include + comments to that effect with your name and the date. Thank you. + + History: + vers date who what + ---- --------- -------------- ------------------------------------ + a ~~ Feb 92 M. Adler used full (large, one-step) lookup table + b1 21 Mar 92 M. Adler first version with partial lookup tables + b2 21 Mar 92 M. Adler fixed bug in fixed-code blocks + b3 22 Mar 92 M. Adler sped up match copies, cleaned up some + b4 25 Mar 92 M. Adler added prototypes; removed window[] (now + is the responsibility of unzip.h--also + changed name to slide[]), so needs diffs + for unzip.c and unzip.h (this allows + compiling in the small model on MSDOS); + fixed cast of q in huft_build(); + b5 26 Mar 92 M. Adler got rid of unintended macro recursion. + b6 27 Mar 92 M. Adler got rid of nextbyte() routine. fixed + bug in inflate_fixed(). + c1 30 Mar 92 M. Adler removed lbits, dbits environment variables. + changed BMAX to 16 for explode. Removed + OUTB usage, and replaced it with flush()-- + this was a 20% speed improvement! Added + an explode.c (to replace unimplod.c) that + uses the huft routines here. Removed + register union. + c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k. + c3 10 Apr 92 M. Adler reduced memory of code tables made by + huft_build significantly (factor of two to + three). + c4 15 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy(). + worked around a Turbo C optimization bug. + c5 21 Apr 92 M. Adler added the WSIZE #define to allow reducing + the 32K window size for specialized + applications. + c6 31 May 92 M. Adler added some typecasts to eliminate warnings + c7 27 Jun 92 G. Roelofs added some more typecasts (444: MSC bug). + c8 5 Oct 92 J-l. Gailly added ifdef'd code to deal with PKZIP bug. + c9 9 Oct 92 M. Adler removed a memory error message (~line 416). + c10 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch, + removed old inflate, renamed inflate_entry + to inflate, added Mark's fix to a comment. + c10.5 14 Dec 92 M. Adler fix up error messages for incomplete trees. + c11 2 Jan 93 M. Adler fixed bug in detection of incomplete + tables, and removed assumption that EOB is + the longest code (bad assumption). + c12 3 Jan 93 M. Adler make tables for fixed blocks only once. + c13 5 Jan 93 M. Adler allow all zero length codes (pkzip 2.04c + outputs one zero length code for an empty + distance tree). + c14 12 Mar 93 M. Adler made inflate.c standalone with the + introduction of inflate.h. + c14b 16 Jul 93 G. Roelofs added (unsigned) typecast to w at 470. + c14c 19 Jul 93 J. Bush changed v[N_MAX], l[288], ll[28x+3x] arrays + to static for Amiga. + c14d 13 Aug 93 J-l. Gailly de-complicatified Mark's c[*p++]++ thing. + c14e 8 Oct 93 G. Roelofs changed memset() to memzero(). + c14f 22 Oct 93 G. Roelofs renamed quietflg to qflag; made Trace() + conditional; added inflate_free(). + c14g 28 Oct 93 G. Roelofs changed l/(lx+1) macro to pointer (Cray bug) + c14h 7 Dec 93 C. Ghisler huft_build() optimizations. + c14i 9 Jan 94 A. Verheijen set fixed_t{d,l} to NULL after freeing; + G. Roelofs check NEXTBYTE macro for EOF. + c14j 23 Jan 94 G. Roelofs removed Ghisler "optimizations"; ifdef'd + EOF check. + c14k 27 Feb 94 G. Roelofs added some typecasts to avoid warnings. + c14l 9 Apr 94 G. Roelofs fixed split comments on preprocessor lines + to avoid bug in Encore compiler. + c14m 7 Jul 94 P. Kienitz modified to allow assembler version of + inflate_codes() (define ASM_INFLATECODES) + c14n 22 Jul 94 G. Roelofs changed fprintf to macro for DLL versions + c14o 23 Aug 94 C. Spieler added a newline to a debug statement; + G. Roelofs added another typecast to avoid MSC warning + c14p 4 Oct 94 G. Roelofs added (voidp *) cast to free() argument + c14q 30 Oct 94 G. Roelofs changed fprintf macro to MESSAGE() + c14r 1 Nov 94 G. Roelofs fixed possible redefinition of CHECK_EOF + c14s 7 May 95 S. Maxwell OS/2 DLL globals stuff incorporated; + P. Kienitz "fixed" ASM_INFLATECODES macro/prototype + c14t 18 Aug 95 G. Roelofs added UZinflate() to use zlib functions; + changed voidp to zvoid; moved huft_build() + and huft_free() to end of file + c14u 1 Oct 95 G. Roelofs moved G into definition of MESSAGE macro + c14v 8 Nov 95 P. Kienitz changed ASM_INFLATECODES to use a regular + call with __G__ instead of a macro + c15 3 Aug 96 M. Adler fixed bomb-bug on random input data (Adobe) + c15b 24 Aug 96 M. Adler more fixes for random input data + c15c 28 Mar 97 G. Roelofs changed USE_ZLIB fatal exit code from + PK_MEM2 to PK_MEM3 + c16 20 Apr 97 J. Altman added memzero(v[]) in huft_build() + c16b 29 Mar 98 C. Spieler modified DLL code for slide redirection + */ + + +/* + Inflate deflated (PKZIP's method 8 compressed) data. The compression + method searches for as much of the current string of bytes (up to a + length of 258) in the previous 32K bytes. If it doesn't find any + matches (of at least length 3), it codes the next byte. Otherwise, it + codes the length of the matched string and its distance backwards from + the current position. There is a single Huffman code that codes both + single bytes (called "literals") and match lengths. A second Huffman + code codes the distance information, which follows a length code. Each + length or distance code actually represents a base value and a number + of "extra" (sometimes zero) bits to get to add to the base value. At + the end of each deflated block is a special end-of-block (EOB) literal/ + length code. The decoding process is basically: get a literal/length + code; if EOB then done; if a literal, emit the decoded byte; if a + length then get the distance and emit the referred-to bytes from the + sliding window of previously emitted data. + + There are (currently) three kinds of inflate blocks: stored, fixed, and + dynamic. The compressor outputs a chunk of data at a time and decides + which method to use on a chunk-by-chunk basis. A chunk might typically + be 32K to 64K, uncompressed. If the chunk is uncompressible, then the + "stored" method is used. In this case, the bytes are simply stored as + is, eight bits per byte, with none of the above coding. The bytes are + preceded by a count, since there is no longer an EOB code. + + If the data are compressible, then either the fixed or dynamic methods + are used. In the dynamic method, the compressed data are preceded by + an encoding of the literal/length and distance Huffman codes that are + to be used to decode this block. The representation is itself Huffman + coded, and so is preceded by a description of that code. These code + descriptions take up a little space, and so for small blocks, there is + a predefined set of codes, called the fixed codes. The fixed method is + used if the block ends up smaller that way (usually for quite small + chunks); otherwise the dynamic method is used. In the latter case, the + codes are customized to the probabilities in the current block and so + can code it much better than the pre-determined fixed codes can. + + The Huffman codes themselves are decoded using a multi-level table + lookup, in order to maximize the speed of decoding plus the speed of + building the decoding tables. See the comments below that precede the + lbits and dbits tuning parameters. + + GRR: return values(?) + 0 OK + 1 incomplete table + 2 bad input + 3 not enough memory + */ + + +/* + Notes beyond the 1.93a appnote.txt: + + 1. Distance pointers never point before the beginning of the output + stream. + 2. Distance pointers can point back across blocks, up to 32k away. + 3. There is an implied maximum of 7 bits for the bit length table and + 15 bits for the actual data. + 4. If only one code exists, then it is encoded using one bit. (Zero + would be more efficient, but perhaps a little confusing.) If two + codes exist, they are coded using one bit each (0 and 1). + 5. There is no way of sending zero distance codes--a dummy must be + sent if there are none. (History: a pre 2.0 version of PKZIP would + store blocks with no distance codes, but this was discovered to be + too harsh a criterion.) Valid only for 1.93a. 2.04c does allow + zero distance codes, which is sent as one code of zero bits in + length. + 6. There are up to 286 literal/length codes. Code 256 represents the + end-of-block. Note however that the static length tree defines + 288 codes just to fill out the Huffman codes. Codes 286 and 287 + cannot be used though, since there is no length base or extra bits + defined for them. Similarily, there are up to 30 distance codes. + However, static trees define 32 codes (all 5 bits) to fill out the + Huffman codes, but the last two had better not show up in the data. + 7. Unzip can check dynamic Huffman blocks for complete code sets. + The exception is that a single code would not be complete (see #4). + 8. The five bits following the block type is really the number of + literal codes sent minus 257. + 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits + (1+6+6). Therefore, to output three times the length, you output + three codes (1+1+1), whereas to output four times the same length, + you only need two codes (1+3). Hmm. + 10. In the tree reconstruction algorithm, Code = Code + Increment + only if BitLength(i) is not zero. (Pretty obvious.) + 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) + 12. Note: length code 284 can represent 227-258, but length code 285 + really is 258. The last length deserves its own, short code + since it gets used a lot in very redundant files. The length + 258 is special since 258 - 3 (the min match length) is 255. + 13. The literal/length and distance code bit lengths are read as a + single stream of lengths. It is possible (and advantageous) for + a repeat code (16, 17, or 18) to go across the boundary between + the two sets of lengths. + */ + + +#define PKZIP_BUG_WORKAROUND /* PKZIP 1.93a problem--live with it */ + +/* + inflate.h must supply the uch slide[WSIZE] array, the zvoid typedef + (void if (void *) is accepted, else char) and the NEXTBYTE, + FLUSH() and memzero macros. If the window size is not 32K, it + should also define WSIZE. If INFMOD is defined, it can include + compiled functions to support the NEXTBYTE and/or FLUSH() macros. + There are defaults for NEXTBYTE and FLUSH() below for use as + examples of what those functions need to do. Normally, you would + also want FLUSH() to compute a crc on the data. inflate.h also + needs to provide these typedefs: + + typedef unsigned char uch; + typedef unsigned short ush; + typedef unsigned long ulg; + + This module uses the external functions malloc() and free() (and + probably memset() or bzero() in the memzero() macro). Their + prototypes are normally found in <string.h> and <stdlib.h>. + */ + +/* #define DEBUG */ +#define INFMOD /* tell inflate.h to include code to be compiled */ +#include "inflate.h" + + +#ifndef WSIZE /* default is 32K */ +# define WSIZE 0x8000 /* window size--must be a power of two, and at least */ +#endif /* 32K for zip's deflate method */ + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) +# define wsize G._wsize /* wsize is a variable */ +#else +# define wsize WSIZE /* wsize is a constant */ +#endif + + +#ifndef NEXTBYTE /* default is to simply get a byte from stdin */ +# define NEXTBYTE getchar() +#endif + +#ifndef MESSAGE /* only used twice, for fixed strings--NOT general-purpose */ +# define MESSAGE(str,len,flag) pipeit((char *)(str)) +#endif + +#ifndef FLUSH /* default is to simply write the buffer to stdout */ +# define FLUSH(n) fwrite(redirSlide, 1, n, stdout) /* return value not used */ +#endif +/* Warning: the fwrite above might not work on 16-bit compilers, since + 0x8000 might be interpreted as -32,768 by the library function. */ + +#ifndef Trace +# ifdef DEBUG +# define Trace(x) fprintf x +# else +# define Trace(x) +# endif +#endif + + +/*---------------------------------------------------------------------------*/ +#ifdef USE_ZLIB + + +/* + GRR: return values for both original inflate() and UZinflate() + 0 OK + 1 incomplete table(?) + 2 bad input + 3 not enough memory + */ + +/**************************/ +/* Function UZinflate() */ +/**************************/ + +int UZinflate(__G) /* decompress an inflated entry using the zlib routines */ + __GDEF +{ + int err=Z_OK; + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) + wsize = G.redirect_size, redirSlide = G.redirect_buffer; + else + wsize = WSIZE, redirSlide = slide; +#endif + + G.dstrm.next_out = redirSlide; + G.dstrm.avail_out = wsize; + + G.dstrm.next_in = G.inptr; + G.dstrm.avail_in = G.incnt; + + if (!G.inflInit) { + unsigned i; + int windowBits; + + /* only need to test this stuff once */ + if (zlib_version[0] != ZLIB_VERSION[0]) { + Info(slide, 0x21, ((char *)slide, + "error: incompatible zlib version (expected %s, found %s)\n", + ZLIB_VERSION, zlib_version)); + return 3; + } else if (strcmp(zlib_version, ZLIB_VERSION) != 0) + Info(slide, 0x21, ((char *)slide, + "warning: different zlib version (expected %s, using %s)\n", + ZLIB_VERSION, zlib_version)); + + /* windowBits = log2(wsize) */ + for (i = ((unsigned)wsize * 2 - 1), windowBits = 0; + !(i & 1); i >>= 1, ++windowBits); + if ((unsigned)windowBits > (unsigned)15) + windowBits = 15; + else if (windowBits < 8) + windowBits = 8; + + G.dstrm.zalloc = (alloc_func)Z_NULL; + G.dstrm.zfree = (free_func)Z_NULL; + + Trace((stderr, "initializing inflate()\n")); + err = inflateInit2(&G.dstrm, -windowBits); + + if (err == Z_MEM_ERROR) + return 3; + else if (err != Z_OK) + Trace((stderr, "oops! (inflateInit2() err = %d)\n", err)); + G.inflInit = 1; + } + +#ifdef FUNZIP + while (err != Z_STREAM_END) { +#else /* !FUNZIP */ + while (G.csize > 0) { + Trace((stderr, "first loop: G.csize = %ld\n", G.csize)); +#endif /* ?FUNZIP */ + while (G.dstrm.avail_out > 0) { + err = inflate(&G.dstrm, Z_PARTIAL_FLUSH); + + if (err == Z_DATA_ERROR) + return 2; + else if (err == Z_MEM_ERROR) + return 3; + else if (err != Z_OK && err != Z_STREAM_END) + Trace((stderr, "oops! (inflate(first loop) err = %d)\n", err)); + +#ifdef FUNZIP + if (err == Z_STREAM_END) /* "END-of-entry-condition" ? */ +#else /* !FUNZIP */ + if (G.csize <= 0L) /* "END-of-entry-condition" ? */ +#endif /* ?FUNZIP */ + break; + + if (G.dstrm.avail_in <= 0) { + if (fillinbuf(__G) == 0) + return 2; /* no "END-condition" yet, but no more data */ + + G.dstrm.next_in = G.inptr; + G.dstrm.avail_in = G.incnt; + } + Trace((stderr, " avail_in = %d\n", G.dstrm.avail_in)); + } + FLUSH(wsize - G.dstrm.avail_out); /* flush slide[] */ + Trace((stderr, "inside loop: flushing %ld bytes (ptr diff = %ld)\n", + (long)(wsize - G.dstrm.avail_out), + (long)(G.dstrm.next_out-(Bytef *)redirSlide))); + G.dstrm.next_out = redirSlide; + G.dstrm.avail_out = wsize; + } + + /* no more input, so loop until we have all output */ + Trace((stderr, "beginning final loop: err = %d\n", err)); + while (err != Z_STREAM_END) { + err = inflate(&G.dstrm, Z_PARTIAL_FLUSH); + if (err == Z_DATA_ERROR) + return 2; + else if (err == Z_MEM_ERROR) + return 3; + else if (err == Z_BUF_ERROR) { /* DEBUG */ + Trace((stderr, "zlib inflate() did not detect stream end (%s, %s)\n" + , G.zipfn, G.filename)); + break; + } else if (err != Z_OK && err != Z_STREAM_END) { + Trace((stderr, "oops! (inflate(final loop) err = %d)\n", err)); + DESTROYGLOBALS() + EXIT(PK_MEM3); + } + FLUSH(wsize - G.dstrm.avail_out); /* final flush of slide[] */ + Trace((stderr, "final loop: flushing %ld bytes (ptr diff = %ld)\n", + (long)(wsize - G.dstrm.avail_out), + (long)(G.dstrm.next_out-(Bytef *)redirSlide))); + G.dstrm.next_out = redirSlide; + G.dstrm.avail_out = wsize; + } + Trace((stderr, "total in = %ld, total out = %ld\n", G.dstrm.total_in, + G.dstrm.total_out)); + + G.inptr = (uch *)G.dstrm.next_in; + G.incnt = (G.inbuf + INBUFSIZ) - G.inptr; /* reset for other routines */ + + err = inflateReset(&G.dstrm); + if (err != Z_OK) + Trace((stderr, "oops! (inflateReset() err = %d)\n", err)); + + return 0; +} + + +/*---------------------------------------------------------------------------*/ +#else /* !USE_ZLIB */ + + +/* Function prototypes */ +#ifndef OF +# ifdef __STDC__ +# define OF(a) a +# else +# define OF(a) () +# endif +#endif /* !OF */ +int inflate_codes OF((__GPRO__ struct huft *tl, struct huft *td, + int bl, int bd)); +static int inflate_stored OF((__GPRO)); +static int inflate_fixed OF((__GPRO)); +static int inflate_dynamic OF((__GPRO)); +static int inflate_block OF((__GPRO__ int *e)); + + +/* The inflate algorithm uses a sliding 32K byte window on the uncompressed + stream to find repeated byte strings. This is implemented here as a + circular buffer. The index is updated simply by incrementing and then + and'ing with 0x7fff (32K-1). */ +/* It is left to other modules to supply the 32K area. It is assumed + to be usable as if it were declared "uch slide[32768];" or as just + "uch *slide;" and then malloc'ed in the latter case. The definition + must be in unzip.h, included above. */ + + +/* unsigned wp; moved to globals.h */ /* current position in slide */ + + +/* Tables for deflate from PKZIP's appnote.txt. */ +static ZCONST unsigned border[] = { /* Order of the bit length code lengths */ + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; +static ZCONST ush cplens[] = { /* Copy lengths for literal codes 257..285 */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + /* note: see note #13 above about the 258 in this list. */ +static ZCONST ush cplext[] = { /* Extra bits for literal codes 257..285 */ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */ +static ZCONST ush cpdist[] = { /* Copy offsets for distance codes 0..29 */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577}; +static ZCONST ush cpdext[] = { /* Extra bits for distance codes */ + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, + 12, 12, 13, 13}; + + +/* moved to consts.h (included in unzip.c), resp. funzip.c */ +#if 0 +/* And'ing with mask_bits[n] masks the lower n bits */ +ZCONST ush near mask_bits[] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; +#endif /* 0 */ + + +/* Macros for inflate() bit peeking and grabbing. + The usage is: + + NEEDBITS(j) + x = b & mask_bits[j]; + DUMPBITS(j) + + where NEEDBITS makes sure that b has at least j bits in it, and + DUMPBITS removes the bits from b. The macros use the variable k + for the number of bits in b. Normally, b and k are register + variables for speed and are initialized at the begining of a + routine that uses these macros from a global bit buffer and count. + + In order to not ask for more bits than there are in the compressed + stream, the Huffman tables are constructed to only ask for just + enough bits to make up the end-of-block code (value 256). Then no + bytes need to be "returned" to the buffer at the end of the last + block. See the huft_build() routine. + */ + +/* These have been moved to globals.h */ +#if 0 +ulg bb; /* bit buffer */ +unsigned bk; /* bits in bit buffer */ +#endif + +#ifndef CHECK_EOF +# define CHECK_EOF /* default as of 5.13/5.2 */ +#endif + +#ifndef CHECK_EOF +# define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE)<<k;k+=8;}} +#else +# define NEEDBITS(n) {while(k<(n)){int c=NEXTBYTE;if(c==EOF)return 1;\ + b|=((ulg)c)<<k;k+=8;}} +#endif /* Piet Plomp: change "return 1" to "break" */ + +#define DUMPBITS(n) {b>>=(n);k-=(n);} + + +/* + Huffman code decoding is performed using a multi-level table lookup. + The fastest way to decode is to simply build a lookup table whose + size is determined by the longest code. However, the time it takes + to build this table can also be a factor if the data being decoded + are not very long. The most common codes are necessarily the + shortest codes, so those codes dominate the decoding time, and hence + the speed. The idea is you can have a shorter table that decodes the + shorter, more probable codes, and then point to subsidiary tables for + the longer codes. The time it costs to decode the longer codes is + then traded against the time it takes to make longer tables. + + This results of this trade are in the variables lbits and dbits + below. lbits is the number of bits the first level table for literal/ + length codes can decode in one step, and dbits is the same thing for + the distance codes. Subsequent tables are also less than or equal to + those sizes. These values may be adjusted either when all of the + codes are shorter than that, in which case the longest code length in + bits is used, or when the shortest code is *longer* than the requested + table size, in which case the length of the shortest code in bits is + used. + + There are two different values for the two tables, since they code a + different number of possibilities each. The literal/length table + codes 286 possible values, or in a flat code, a little over eight + bits. The distance table codes 30 possible values, or a little less + than five bits, flat. The optimum values for speed end up being + about one bit more than those, so lbits is 8+1 and dbits is 5+1. + The optimum values may differ though from machine to machine, and + possibly even between compilers. Your mileage may vary. + */ + + +static ZCONST int lbits = 9; /* bits in base literal/length lookup table */ +static ZCONST int dbits = 6; /* bits in base distance lookup table */ + + +#ifndef ASM_INFLATECODES + +int inflate_codes(__G__ tl, td, bl, bd) + __GDEF +struct huft *tl, *td; /* literal/length and distance decoder tables */ +int bl, bd; /* number of bits decoded by tl[] and td[] */ +/* inflate (decompress) the codes in a deflated (compressed) block. + Return an error code or zero if it all goes ok. */ +{ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + + /* make local copies of globals */ + b = G.bb; /* initialize bit buffer */ + k = G.bk; + w = G.wp; /* initialize window position */ + + + /* inflate the coded data */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + while (1) /* do until end of block */ + { + NEEDBITS((unsigned)bl) + if ((e = (t = tl + ((unsigned)b & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + if (e == 16) /* then it's a literal */ + { + redirSlide[w++] = (uch)t->v.n; + if (w == wsize) + { + FLUSH(w); + w = 0; + } + } + else /* it's an EOB or a length */ + { + /* exit if end of block */ + if (e == 15) + break; + + /* get length of block to copy */ + NEEDBITS(e) + n = t->v.n + ((unsigned)b & mask_bits[e]); + DUMPBITS(e); + + /* decode distance of block to copy */ + NEEDBITS((unsigned)bd) + if ((e = (t = td + ((unsigned)b & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + NEEDBITS(e) + d = w - t->v.n - ((unsigned)b & mask_bits[e]); + DUMPBITS(e) + + /* do the copy */ + do { +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) {/* &= w/ wsize unnecessary & wrong if redirect */ + if (d >= wsize) + return 1; /* invalid compressed data */ + n -= (e = (e = wsize - (d > w ? d : w)) > n ? n : e); + } + else +#endif + n -= (e = (e = wsize - ((d &= wsize-1) > w ? d : w)) > n ? n : e); +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slowly to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == wsize) + { + FLUSH(w); + w = 0; + } + } while (n); + } + } + + + /* restore the globals from the locals */ + G.wp = w; /* restore global window pointer */ + G.bb = b; /* restore global bit buffer */ + G.bk = k; + + + /* done */ + return 0; +} + +#endif /* ASM_INFLATECODES */ + + + +static int inflate_stored(__G) + __GDEF +/* "decompress" an inflated type 0 (stored) block. */ +{ + unsigned n; /* number of bytes in block */ + unsigned w; /* current window position */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + + /* make local copies of globals */ + Trace((stderr, "\nstored block")); + b = G.bb; /* initialize bit buffer */ + k = G.bk; + w = G.wp; /* initialize window position */ + + + /* go to byte boundary */ + n = k & 7; + DUMPBITS(n); + + + /* get the length and its complement */ + NEEDBITS(16) + n = ((unsigned)b & 0xffff); + DUMPBITS(16) + NEEDBITS(16) + if (n != (unsigned)((~b) & 0xffff)) + return 1; /* error in compressed data */ + DUMPBITS(16) + + + /* read and output the compressed data */ + while (n--) + { + NEEDBITS(8) + redirSlide[w++] = (uch)b; + if (w == wsize) + { + FLUSH(w); + w = 0; + } + DUMPBITS(8) + } + + + /* restore the globals from the locals */ + G.wp = w; /* restore global window pointer */ + G.bb = b; /* restore global bit buffer */ + G.bk = k; + return 0; +} + + +/* Globals for literal tables (built once) */ +/* Moved to globals.h */ +#if 0 +struct huft *fixed_tl = (struct huft *)NULL; +struct huft *fixed_td; +int fixed_bl, fixed_bd; +#endif + +static int inflate_fixed(__G) + __GDEF +/* decompress an inflated type 1 (fixed Huffman codes) block. We should + either replace this with a custom decoder, or at least precompute the + Huffman tables. */ +{ + /* if first time, set up tables for fixed blocks */ + Trace((stderr, "\nliteral block")); + if (G.fixed_tl == (struct huft *)NULL) + { + int i; /* temporary variable */ + unsigned l[288]; /* length list for huft_build */ + + /* literal table */ + for (i = 0; i < 144; i++) + l[i] = 8; + for (; i < 256; i++) + l[i] = 9; + for (; i < 280; i++) + l[i] = 7; + for (; i < 288; i++) /* make a complete, but wrong code set */ + l[i] = 8; + G.fixed_bl = 7; + if ((i = huft_build(__G__ l, 288, 257, cplens, cplext, + &G.fixed_tl, &G.fixed_bl)) != 0) + { + G.fixed_tl = (struct huft *)NULL; + return i; + } + + /* distance table */ + for (i = 0; i < 30; i++) /* make an incomplete code set */ + l[i] = 5; + G.fixed_bd = 5; + if ((i = huft_build(__G__ l, 30, 0, cpdist, cpdext, + &G.fixed_td, &G.fixed_bd)) > 1) + { + huft_free(G.fixed_tl); + G.fixed_tl = (struct huft *)NULL; + return i; + } + } + + /* decompress until an end-of-block code */ + return inflate_codes(__G__ G.fixed_tl, G.fixed_td, + G.fixed_bl, G.fixed_bd) != 0; +} + + + +static int inflate_dynamic(__G) + __GDEF +/* decompress an inflated type 2 (dynamic Huffman codes) block. */ +{ + int i; /* temporary variables */ + unsigned j; + unsigned l; /* last length */ + unsigned m; /* mask for bit lengths table */ + unsigned n; /* number of lengths to get */ + struct huft *tl; /* literal/length code table */ + struct huft *td; /* distance code table */ + int bl; /* lookup bits for tl */ + int bd; /* lookup bits for td */ + unsigned nb; /* number of bit length codes */ + unsigned nl; /* number of literal/length codes */ + unsigned nd; /* number of distance codes */ +#ifdef PKZIP_BUG_WORKAROUND + unsigned ll[288+32]; /* literal/length and distance code lengths */ +#else + unsigned ll[286+30]; /* literal/length and distance code lengths */ +#endif + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + + /* make local bit buffer */ + Trace((stderr, "\ndynamic block")); + b = G.bb; + k = G.bk; + + + /* read in table lengths */ + NEEDBITS(5) + nl = 257 + ((unsigned)b & 0x1f); /* number of literal/length codes */ + DUMPBITS(5) + NEEDBITS(5) + nd = 1 + ((unsigned)b & 0x1f); /* number of distance codes */ + DUMPBITS(5) + NEEDBITS(4) + nb = 4 + ((unsigned)b & 0xf); /* number of bit length codes */ + DUMPBITS(4) +#ifdef PKZIP_BUG_WORKAROUND + if (nl > 288 || nd > 32) +#else + if (nl > 286 || nd > 30) +#endif + return 1; /* bad lengths */ + + + /* read in bit-length-code lengths */ + for (j = 0; j < nb; j++) + { + NEEDBITS(3) + ll[border[j]] = (unsigned)b & 7; + DUMPBITS(3) + } + for (; j < 19; j++) + ll[border[j]] = 0; + + + /* build decoding table for trees--single level, 7 bit lookup */ + bl = 7; + i = huft_build(__G__ ll, 19, 19, NULL, NULL, &tl, &bl); + if (bl == 0) /* no bit lengths */ + i = 1; + if (i) + { + if (i == 1) + huft_free(tl); + return i; /* incomplete code set */ + } + + + /* read in literal and distance code lengths */ + n = nl + nd; + m = mask_bits[bl]; + i = l = 0; + while ((unsigned)i < n) + { + NEEDBITS((unsigned)bl) + j = (td = tl + ((unsigned)b & m))->b; + DUMPBITS(j) + j = td->v.n; + if (j < 16) /* length of code in bits (0..15) */ + ll[i++] = l = j; /* save last length in l */ + else if (j == 16) /* repeat last length 3 to 6 times */ + { + NEEDBITS(2) + j = 3 + ((unsigned)b & 3); + DUMPBITS(2) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = l; + } + else if (j == 17) /* 3 to 10 zero length codes */ + { + NEEDBITS(3) + j = 3 + ((unsigned)b & 7); + DUMPBITS(3) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = 0; + l = 0; + } + else /* j == 18: 11 to 138 zero length codes */ + { + NEEDBITS(7) + j = 11 + ((unsigned)b & 0x7f); + DUMPBITS(7) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = 0; + l = 0; + } + } + + + /* free decoding table for trees */ + huft_free(tl); + + + /* restore the global bit buffer */ + G.bb = b; + G.bk = k; + + + /* build the decoding tables for literal/length and distance codes */ + bl = lbits; + i = huft_build(__G__ ll, nl, 257, cplens, cplext, &tl, &bl); + if (bl == 0) /* no literals or lengths */ + i = 1; + if (i) + { + if (i == 1) { + if (!uO.qflag) + MESSAGE((uch *)"(incomplete l-tree) ", 21L, 1); + huft_free(tl); + } + return i; /* incomplete code set */ + } + bd = dbits; + i = huft_build(__G__ ll + nl, nd, 0, cpdist, cpdext, &td, &bd); + if (bd == 0 && nl > 257) /* lengths but no distances */ + { + if (!uO.qflag) + MESSAGE((uch *)"(incomplete d-tree) ", 21L, 1); + huft_free(tl); + return 1; + } + if (i == 1) { +#ifdef PKZIP_BUG_WORKAROUND + i = 0; +#else + if (!uO.qflag) + MESSAGE((uch *)"(incomplete d-tree) ", 21L, 1); + huft_free(td); +#endif + } + if (i) + { + huft_free(tl); + return i; + } + + + /* decompress until an end-of-block code */ + if (inflate_codes(__G__ tl, td, bl, bd)) + return 1; + + + /* free the decoding tables, return */ + huft_free(tl); + huft_free(td); + return 0; +} + + + +static int inflate_block(__G__ e) + __GDEF + int *e; /* last block flag */ +/* decompress an inflated block */ +{ + unsigned t; /* block type */ + register ulg b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + + + /* make local bit buffer */ + b = G.bb; + k = G.bk; + + + /* read in last block bit */ + NEEDBITS(1) + *e = (int)b & 1; + DUMPBITS(1) + + + /* read in block type */ + NEEDBITS(2) + t = (unsigned)b & 3; + DUMPBITS(2) + + + /* restore the global bit buffer */ + G.bb = b; + G.bk = k; + + + /* inflate that block type */ + if (t == 2) + return inflate_dynamic(__G); + if (t == 0) + return inflate_stored(__G); + if (t == 1) + return inflate_fixed(__G); + + + /* bad block type */ + return 2; +} + + + +int inflate(__G) + __GDEF +/* decompress an inflated entry */ +{ + int e; /* last block flag */ + int r; /* result code */ +#ifdef DEBUG + unsigned h = 0; /* maximum struct huft's malloc'ed */ +#endif + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) + wsize = G.redirect_size, redirSlide = G.redirect_buffer; + else + wsize = WSIZE, redirSlide = slide; /* how they're #defined if !DLL */ +#endif + + /* initialize window, bit buffer */ + G.wp = 0; + G.bk = 0; + G.bb = 0; + + + /* decompress until the last block */ + do { +#ifdef DEBUG + G.hufts = 0; +#endif + if ((r = inflate_block(__G__ &e)) != 0) + return r; +#ifdef DEBUG + if (G.hufts > h) + h = G.hufts; +#endif + } while (!e); + + + /* flush out redirSlide */ + FLUSH(G.wp); + + + /* return success */ + Trace((stderr, "\n%u bytes in Huffman tables (%d/entry)\n", + h * sizeof(struct huft), sizeof(struct huft))); + return 0; +} + + + +int inflate_free(__G) + __GDEF +{ + if (G.fixed_tl != (struct huft *)NULL) + { + huft_free(G.fixed_td); + huft_free(G.fixed_tl); + G.fixed_td = G.fixed_tl = (struct huft *)NULL; + } + return 0; +} + +#endif /* ?USE_ZLIB */ + + +/* + * GRR: moved huft_build() and huft_free() down here; used by explode() + * and fUnZip regardless of whether USE_ZLIB defined or not + */ + + +/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ +#define BMAX 16 /* maximum bit length of any code (16 for explode) */ +#define N_MAX 288 /* maximum number of codes in any set */ + + +int huft_build(__G__ b, n, s, d, e, t, m) + __GDEF + ZCONST unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ + unsigned n; /* number of codes (assumed <= N_MAX) */ + unsigned s; /* number of simple-valued codes (0..s-1) */ + ZCONST ush *d; /* list of base values for non-simple codes */ + ZCONST ush *e; /* list of extra bits for non-simple codes */ + struct huft **t; /* result: starting table */ + int *m; /* maximum lookup bits, returns actual */ +/* Given a list of code lengths and a maximum table size, make a set of + tables to decode that set of codes. Return zero on success, one if + the given code set is incomplete (the tables are still built in this + case), two if the input is invalid (all zero length codes or an + oversubscribed set of lengths), and three if not enough memory. + The code with value 256 is special, and the tables are constructed + so that no bits beyond that code are fetched when that code is + decoded. */ +{ + unsigned a; /* counter for codes of length k */ + unsigned c[BMAX+1]; /* bit length count table */ + unsigned el; /* length of EOB code (value 256) */ + unsigned f; /* i repeats in table every f entries */ + int g; /* maximum code length */ + int h; /* table level */ + register unsigned i; /* counter, current code */ + register unsigned j; /* counter */ + register int k; /* number of bits in current code */ + int lx[BMAX+1]; /* memory for l[-1..BMAX-1] */ + int *l = lx+1; /* stack of bits per table */ + register unsigned *p; /* pointer into c[], b[], or v[] */ + register struct huft *q; /* points to current table */ + struct huft r; /* table entry for structure assignment */ + struct huft *u[BMAX]; /* table stack */ + unsigned v[N_MAX]; /* values in order of bit length */ + register int w; /* bits before this table == (l * h) */ + unsigned x[BMAX+1]; /* bit offsets, then code stack */ + unsigned *xp; /* pointer into x */ + int y; /* number of dummy codes added */ + unsigned z; /* number of entries in current table */ + + + /* Generate counts for each bit length */ + el = n > 256 ? b[256] : BMAX; /* set length of EOB code, if any */ + memzero((char *)c, sizeof(c)); + p = (unsigned *)b; i = n; + do { + c[*p]++; p++; /* assume all entries <= BMAX */ + } while (--i); + if (c[0] == n) /* null input--all zero length codes */ + { + *t = (struct huft *)NULL; + *m = 0; + return 0; + } + + + /* Find minimum and maximum length, bound *m by those */ + for (j = 1; j <= BMAX; j++) + if (c[j]) + break; + k = j; /* minimum code length */ + if ((unsigned)*m < j) + *m = j; + for (i = BMAX; i; i--) + if (c[i]) + break; + g = i; /* maximum code length */ + if ((unsigned)*m > i) + *m = i; + + + /* Adjust last length count to fill out codes, if needed */ + for (y = 1 << j; j < i; j++, y <<= 1) + if ((y -= c[j]) < 0) + return 2; /* bad input: more codes than bits */ + if ((y -= c[i]) < 0) + return 2; + c[i] += y; + + + /* Generate starting offsets into the value table for each length */ + x[1] = j = 0; + p = c + 1; xp = x + 2; + while (--i) { /* note that i == g from above */ + *xp++ = (j += *p++); + } + + + /* Make a table of values in order of bit lengths */ + memzero((char *)v, sizeof(v)); + p = (unsigned *)b; i = 0; + do { + if ((j = *p++) != 0) + v[x[j]++] = i; + } while (++i < n); + n = x[g]; /* set n to length of v */ + + + /* Generate the Huffman codes and for each, make the table entries */ + x[0] = i = 0; /* first Huffman code is zero */ + p = v; /* grab values in bit order */ + h = -1; /* no tables yet--level -1 */ + w = l[-1] = 0; /* no bits decoded yet */ + u[0] = (struct huft *)NULL; /* just to keep compilers happy */ + q = (struct huft *)NULL; /* ditto */ + z = 0; /* ditto */ + + /* go through the bit lengths (k already is bits in shortest code) */ + for (; k <= g; k++) + { + a = c[k]; + while (a--) + { + /* here i is the Huffman code of length k bits for value *p */ + /* make tables up to required level */ + while (k > w + l[h]) + { + w += l[h++]; /* add bits already decoded */ + + /* compute minimum size table less than or equal to *m bits */ + z = (z = g - w) > (unsigned)*m ? *m : z; /* upper limit */ + if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ + { /* too few codes for k-w bit table */ + f -= a + 1; /* deduct codes from patterns left */ + xp = c + k; + while (++j < z) /* try smaller tables up to z bits */ + { + if ((f <<= 1) <= *++xp) + break; /* enough codes to use up j bits */ + f -= *xp; /* else deduct codes from patterns */ + } + } + if ((unsigned)w + j > el && (unsigned)w < el) + j = el - w; /* make EOB code end at table */ + z = 1 << j; /* table entries for j-bit table */ + l[h] = j; /* set table size in stack */ + + /* allocate and link in new table */ + if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) == + (struct huft *)NULL) + { + if (h) + huft_free(u[0]); + return 3; /* not enough memory */ + } +#ifdef DEBUG + G.hufts += z + 1; /* track memory usage */ +#endif + *t = q + 1; /* link to list for huft_free() */ + *(t = &(q->v.t)) = (struct huft *)NULL; + u[h] = ++q; /* table starts after link */ + + /* connect to last table, if there is one */ + if (h) + { + x[h] = i; /* save pattern for backing up */ + r.b = (uch)l[h-1]; /* bits to dump before this table */ + r.e = (uch)(16 + j); /* bits in this table */ + r.v.t = q; /* pointer to this table */ + j = (i & ((1 << w) - 1)) >> (w - l[h-1]); + u[h-1][j] = r; /* connect to last table */ + } + } + + /* set up table entry in r */ + r.b = (uch)(k - w); + if (p >= v + n) + r.e = 99; /* out of values--invalid code */ + else if (*p < s) + { + r.e = (uch)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ + r.v.n = (ush)*p++; /* simple code is just the value */ + } + else + { + r.e = (uch)e[*p - s]; /* non-simple--look up in lists */ + r.v.n = d[*p++ - s]; + } + + /* fill code-like entries with r */ + f = 1 << (k - w); + for (j = i >> w; j < z; j += f) + q[j] = r; + + /* backwards increment the k-bit code i */ + for (j = 1 << (k - 1); i & j; j >>= 1) + i ^= j; + i ^= j; + + /* backup over finished tables */ + while ((i & ((1 << w) - 1)) != x[h]) + w -= l[--h]; /* don't need to update q */ + } + } + + + /* return actual size of base table */ + *m = l[0]; + + + /* Return true (1) if we were given an incomplete table */ + return y != 0 && g != 1; +} + + + +int huft_free(t) +struct huft *t; /* table to free */ +/* Free the malloc'ed tables built by huft_build(), which makes a linked + list of the tables it made, with the links in a dummy first entry of + each table. */ +{ + register struct huft *p, *q; + + + /* Go through linked list, freeing from the malloced (t[-1]) address. */ + p = t; + while (p != (struct huft *)NULL) + { + q = (--p)->v.t; + free((zvoid *)p); + p = q; + } + return 0; +} diff --git a/utils/Install/sfxzip/list.c b/utils/Install/sfxzip/list.c new file mode 100644 index 0000000000..e5ea1ef6fe --- /dev/null +++ b/utils/Install/sfxzip/list.c @@ -0,0 +1,644 @@ +/*--------------------------------------------------------------------------- + + list.c + + This file contains the non-ZipInfo-specific listing routines for UnZip. + + Contains: list_files() + get_time_stamp() [optional feature] + ratio() + fnprint() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" +#ifdef WINDLL +# ifdef POCKET_UNZIP +# include "wince/intrface.h" +# else +# include "windll/windll.h" +# endif +#endif + + +#ifdef TIMESTAMP + static int fn_is_dir OF((__GPRO)); +#endif + +#ifndef WINDLL + static ZCONST char Far CompFactorStr[] = "%c%d%%"; + static ZCONST char Far CompFactor100[] = "100%%"; + +#ifdef OS2_EAS + static ZCONST char Far HeadersS[] = + " Length EAs ACLs Date Time Name"; + static ZCONST char Far HeadersS1[] = + " -------- --- ---- ---- ---- ----"; +#else + static ZCONST char Far HeadersS[] = " Length Date Time Name"; + static ZCONST char Far HeadersS1[] = " -------- ---- ---- ----"; +#endif + + static ZCONST char Far HeadersL[] = + " Length Method Size Ratio Date Time CRC-32 Name"; + static ZCONST char Far HeadersL1[] = + "-------- ------ ------- ----- ---- ---- ------ ----"; + static ZCONST char Far *Headers[][2] = + { {HeadersS, HeadersS1}, {HeadersL, HeadersL1} }; + + static ZCONST char Far CaseConversion[] = + "%s (\"^\" ==> case\n%s conversion)\n"; + static ZCONST char Far LongHdrStats[] = + "%8lu %-7s%8lu %4s %02u-%02u-%02u %02u:%02u %08lx %c"; + static ZCONST char Far LongFileTrailer[] = + "-------- ------- --- \ + -------\n%8lu %8lu %4s %u file%s\n"; +#ifdef OS2_EAS + static ZCONST char Far ShortHdrStats[] = + "%9lu %6lu %6lu %02u-%02u-%02u %02u:%02u %c"; + static ZCONST char Far ShortFileTrailer[] = " -------- ----- ----- \ + -------\n%9lu %6lu %6lu %u file%s\n"; + static ZCONST char Far OS2ExtAttrTrailer[] = + "%ld file%s %ld bytes of OS/2 extended attributes attached.\n"; + static ZCONST char Far OS2ACLTrailer[] = + "%ld file%s %ld bytes of access control lists attached.\n"; +#else + static ZCONST char Far ShortHdrStats[] = + "%9lu %02u-%02u-%02u %02u:%02u %c"; + static ZCONST char Far ShortFileTrailer[] = + " -------- -------\n%9lu %u file%s\n"; +#endif /* ?OS2_EAS */ +#endif /* !WINDLL */ + + + + + +/*************************/ +/* Function list_files() */ +/*************************/ + +int list_files(__G) /* return PK-type error code */ + __GDEF +{ + int do_this_file=FALSE, cfactor, error, error_in_archive=PK_COOL; +#ifndef WINDLL + char sgn, cfactorstr[10]; + int longhdr=(uO.vflag>1); +#endif + int date_format; + unsigned j, methnum, members=0; +#ifdef USE_EF_UT_TIME + iztimes z_utime; + struct tm *t; +#endif + unsigned yr, mo, dy, hh, mm; + ulg csiz, tot_csize=0L, tot_ucsize=0L; +#ifdef OS2_EAS + ulg ea_size, tot_easize=0L, tot_eafiles=0L; + ulg acl_size, tot_aclsize=0L, tot_aclfiles=0L; +#endif + min_info info; + char methbuf[8]; + static ZCONST char dtype[]="NXFS"; /* see zi_short() */ + static ZCONST char Far method[NUM_METHODS+1][8] = + {"Stored", "Shrunk", "Reduce1", "Reduce2", "Reduce3", "Reduce4", + "Implode", "Token", "Defl:#", "EnhDefl", "ImplDCL", "Unk:###"}; + + +/*--------------------------------------------------------------------------- + Unlike extract_or_test_files(), this routine confines itself to the cen- + tral directory. Thus its structure is somewhat simpler, since we can do + just a single loop through the entire directory, listing files as we go. + + So to start off, print the heading line and then begin main loop through + the central directory. The results will look vaguely like the following: + + Length Method Size Ratio Date Time CRC-32 Name ("^" ==> case +-------- ------ ------- ----- ---- ---- ------ ---- conversion) + 44004 Implode 13041 71% 11-02-89 19:34 8b4207f7 Makefile.UNIX + 3438 Shrunk 2209 36% 09-15-90 14:07 a2394fd8 ^dos-file.ext + 16717 Defl:X 5252 69% 11-03-97 06:40 1ce0f189 WHERE +-------- ------- --- ------- + 64159 20502 68% 3 files + ---------------------------------------------------------------------------*/ + + + G.pInfo = &info; + date_format = DATE_FORMAT; + +#ifndef WINDLL + if (uO.qflag < 2) { + if (uO.L_flag) + Info(slide, 0, ((char *)slide, LoadFarString(CaseConversion), + LoadFarStringSmall(Headers[longhdr][0]), + LoadFarStringSmall2(Headers[longhdr][1]))); + else + Info(slide, 0, ((char *)slide, "%s\n%s\n", + LoadFarString(Headers[longhdr][0]), + LoadFarStringSmall(Headers[longhdr][1]))); + } +#endif /* !WINDLL */ + + for (j = 0; j++ < (unsigned)G.ecrec.total_entries_central_dir;) { + + if (readbuf(__G__ G.sig, 4) == 0) + return PK_EOF; + if (strncmp(G.sig, central_hdr_sig, 4)) { /* just to make sure */ + Info(slide, 0x401, ((char *)slide, LoadFarString(CentSigMsg), j)); + Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg))); + return PK_BADERR; /* sig not found */ + } + /* process_cdir_file_hdr() sets pInfo->hostnum, pInfo->lcflag, ...: */ + if ((error = process_cdir_file_hdr(__G)) != PK_COOL) + return error; /* only PK_EOF defined */ + + /* + * We could DISPLAY the filename instead of storing (and possibly trun- + * cating, in the case of a very long name) and printing it, but that + * has the disadvantage of not allowing case conversion--and it's nice + * to be able to see in the listing precisely how you have to type each + * filename in order for unzip to consider it a match. Speaking of + * which, if member names were specified on the command line, check in + * with match() to see if the current file is one of them, and make a + * note of it if it is. + */ + + if ((error = do_string(__G__ G.crec.filename_length, DS_FN)) != + PK_COOL) /* ^--(uses pInfo->lcflag) */ + { + error_in_archive = error; + if (error > PK_WARN) /* fatal: can't continue */ + return error; + } + if (G.extra_field != (uch *)NULL) { + free(G.extra_field); + G.extra_field = (uch *)NULL; + } + if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD)) + != 0) + { + error_in_archive = error; + if (error > PK_WARN) /* fatal */ + return error; + } + if (!G.process_all_files) { /* check if specified on command line */ + unsigned i; + + do_this_file = FALSE; + for (i = 0; i < G.filespecs; i++) + if (match(G.filename, G.pfnames[i], uO.C_flag)) { + do_this_file = TRUE; + break; /* found match, so stop looping */ + } + if (do_this_file) { /* check if this is an excluded file */ + for (i = 0; i < G.xfilespecs; i++) + if (match(G.filename, G.pxnames[i], uO.C_flag)) { + do_this_file = FALSE; /* ^-- ignore case in match */ + break; + } + } + } + /* + * If current file was specified on command line, or if no names were + * specified, do the listing for this file. Otherwise, get rid of the + * file comment and go back for the next file. + */ + + if (G.process_all_files || do_this_file) { + +#ifdef OS2DLL + /* this is used by UzpFileTree() to allow easy processing of lists + * of zip directory contents */ + if (G.processExternally) { + if ((G.processExternally)(G.filename, &G.crec)) + break; + ++members; + } else { +#endif +#ifdef OS2_EAS + { + uch *ef_ptr = G.extra_field; + int ef_size, ef_len = G.crec.extra_field_length; + ea_size = acl_size = 0; + + while (ef_len >= EB_HEADSIZE) { + ef_size = makeword(&ef_ptr[EB_LEN]); + switch (makeword(&ef_ptr[EB_ID])) { + case EF_OS2: + ea_size = makelong(&ef_ptr[EB_HEADSIZE]); + break; + case EF_ACL: + acl_size = makelong(&ef_ptr[EB_HEADSIZE]); + break; + } + ef_ptr += (ef_size + EB_HEADSIZE); + ef_len -= (ef_size + EB_HEADSIZE); + } + } +#endif +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.crec.extra_field_length, 1, + G.crec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME)) + { + TIMET_TO_NATIVE(z_utime.mtime) /* NOP unless MSC 7.0, Mac */ + t = localtime(&(z_utime.mtime)); + } else + t = (struct tm *)NULL; + if (t != (struct tm *)NULL) { + mo = (unsigned)(t->tm_mon + 1); + dy = (unsigned)(t->tm_mday); + yr = (unsigned)(t->tm_year % 100); + hh = (unsigned)(t->tm_hour); + mm = (unsigned)(t->tm_min); + } else +#endif /* USE_EF_UT_TIME */ + { + yr = ((((unsigned)(G.crec.last_mod_dos_datetime >> 25) & 0x7f) + + 80) % (unsigned)100); + mo = ((unsigned)(G.crec.last_mod_dos_datetime >> 21) & 0x0f); + dy = ((unsigned)(G.crec.last_mod_dos_datetime >> 16) & 0x1f); + hh = (((unsigned)G.crec.last_mod_dos_datetime >> 11) & 0x1f); + mm = (((unsigned)G.crec.last_mod_dos_datetime >> 5) & 0x3f); + } + /* permute date so it displays according to nat'l convention + * ('methnum' is not yet set, it is used as temporary buffer) */ + switch (date_format) { + case DF_YMD: + methnum = (unsigned)mo; + mo = yr; yr = dy; dy = (ush)methnum; + break; + case DF_DMY: + methnum = (unsigned)mo; + mo = dy; dy = (ush)methnum; + } + + csiz = G.crec.csize; + if (G.crec.general_purpose_bit_flag & 1) + csiz -= 12; /* if encrypted, don't count encryption header */ + if ((cfactor = ratio(G.crec.ucsize, csiz)) < 0) { +#ifndef WINDLL + sgn = '-'; +#endif + cfactor = (-cfactor + 5) / 10; + } else { +#ifndef WINDLL + sgn = ' '; +#endif + cfactor = (cfactor + 5) / 10; + } + + methnum = MIN(G.crec.compression_method, NUM_METHODS); + zfstrcpy(methbuf, method[methnum]); + if (methnum == DEFLATED) { + methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3]; + } else if (methnum >= NUM_METHODS) { + sprintf(&methbuf[4], "%03u", G.crec.compression_method); + } + +#if 0 /* GRR/Euro: add this? */ +#if defined(DOS_FLX_OS2_W32) || defined(UNIX) + for (p = G.filename; *p; ++p) + if (!isprint(*p)) + *p = '?'; /* change non-printable chars to '?' */ +#endif /* DOS_FLX_OS2_W32 || UNIX */ +#endif /* 0 */ + +#ifdef WINDLL + /* send data to application for formatting and printing */ + (*G.lpUserFunctions->SendApplicationMessage)(G.crec.ucsize, csiz, + (ush)cfactor, mo, dy, yr, hh, mm, + (char)(G.pInfo->lcflag ? '^' : ' '), + (LPSTR)fnfilter(G.filename, slide), (LPSTR)methbuf, G.crec.crc32, + (char)((G.crec.general_purpose_bit_flag & 1) ? 'E' : ' ')); +#else /* !WINDLL */ + if (cfactor == 100) + sprintf(cfactorstr, LoadFarString(CompFactor100)); + else + sprintf(cfactorstr, LoadFarString(CompFactorStr), sgn, cfactor); + if (longhdr) + Info(slide, 0, ((char *)slide, LoadFarString(LongHdrStats), + G.crec.ucsize, methbuf, csiz, cfactorstr, mo, dy, + yr, hh, mm, G.crec.crc32, (G.pInfo->lcflag? '^':' '))); + else +#ifdef OS2_EAS + Info(slide, 0, ((char *)slide, LoadFarString(ShortHdrStats), + G.crec.ucsize, ea_size, acl_size, + mo, dy, yr, hh, mm, (G.pInfo->lcflag? '^':' '))); +#else + Info(slide, 0, ((char *)slide, LoadFarString(ShortHdrStats), + G.crec.ucsize, + mo, dy, yr, hh, mm, (G.pInfo->lcflag? '^':' '))); +#endif + /* fnprint(__G);*/ +#endif /* ?WINDLL */ + + if ((error = do_string(__G__ G.crec.file_comment_length, + QCOND? DISPL_8 : SKIP)) != 0) + { + error_in_archive = error; /* might be just warning */ + if (error > PK_WARN) /* fatal */ + return error; + } + tot_ucsize += G.crec.ucsize; + tot_csize += csiz; + ++members; +#ifdef OS2_EAS + if (ea_size) { + tot_easize += ea_size; + ++tot_eafiles; + } + if (acl_size) { + tot_aclsize += acl_size; + ++tot_aclfiles; + } +#endif +#ifdef OS2DLL + } /* end of "if (G.processExternally) {...} else {..." */ +#endif + } else { /* not listing this file */ + SKIP_(G.crec.file_comment_length) + } + } /* end for-loop (j: files in central directory) */ + +/*--------------------------------------------------------------------------- + Print footer line and totals (compressed size, uncompressed size, number + of members in zipfile). + ---------------------------------------------------------------------------*/ + + if (uO.qflag < 2 +#ifdef OS2DLL + && !G.processExternally +#endif + ) { + if ((cfactor = ratio(tot_ucsize, tot_csize)) < 0) { +#ifndef WINDLL + sgn = '-'; +#endif + cfactor = (-cfactor + 5) / 10; + } else { +#ifndef WINDLL + sgn = ' '; +#endif + cfactor = (cfactor + 5) / 10; + } +#ifdef WINDLL + /* pass the totals back to the calling application */ + G.lpUserFunctions->TotalSizeComp = tot_csize; + G.lpUserFunctions->TotalSize = tot_ucsize; + G.lpUserFunctions->CompFactor = cfactor; + G.lpUserFunctions->NumMembers = members; + +#else /* !WINDLL */ + if (cfactor == 100) + sprintf(cfactorstr, LoadFarString(CompFactor100)); + else + sprintf(cfactorstr, LoadFarString(CompFactorStr), sgn, cfactor); + if (longhdr) { + Info(slide, 0, ((char *)slide, LoadFarString(LongFileTrailer), + tot_ucsize, tot_csize, cfactorstr, members, members==1? "":"s")); +#ifdef OS2_EAS + if (tot_easize || tot_aclsize) + Info(slide, 0, ((char *)slide, "\n")); + if (tot_eafiles && tot_easize) + Info(slide, 0, ((char *)slide, LoadFarString(OS2ExtAttrTrailer), + tot_eafiles, tot_eafiles == 1? " has" : "s have a total of", + tot_easize)); + if (tot_aclfiles && tot_aclsize) + Info(slide, 0, ((char *)slide, LoadFarString(OS2ACLTrailer), + tot_aclfiles, tot_aclfiles == 1? " has" : "s have a total of", + tot_aclsize)); +#endif /* OS2_EAS */ + } else +#ifdef OS2_EAS + Info(slide, 0, ((char *)slide, LoadFarString(ShortFileTrailer), + tot_ucsize, tot_easize, tot_aclsize, members, members == 1? + "" : "s")); +#else + Info(slide, 0, ((char *)slide, LoadFarString(ShortFileTrailer), + tot_ucsize, members, members == 1? "" : "s")); +#endif /* OS2_EAS */ +#endif /* ?WINDLL */ + } + +/*--------------------------------------------------------------------------- + Double check that we're back at the end-of-central-directory record. + ---------------------------------------------------------------------------*/ + + if (readbuf(__G__ G.sig, 4) == 0) /* disk error? */ + return PK_EOF; + if (strncmp(G.sig, end_central_sig, 4)) { /* just to make sure again */ + Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg))); + error_in_archive = PK_WARN; /* didn't find sig */ + } + if (members == 0 && error_in_archive <= PK_WARN) + error_in_archive = PK_FIND; + + return error_in_archive; + +} /* end function list_files() */ + + + + + +#ifdef TIMESTAMP + +/************************/ +/* Function fn_is_dir() */ +/************************/ + +static int fn_is_dir(__G) /* returns TRUE if G.filename is directory */ + __GDEF +{ + extent fn_len = strlen(G.filename); + register char endc; + + return fn_len > 0 && + ((endc = G.filename[fn_len-1]) == '/' || + (G.pInfo->hostnum == FS_FAT_ && !strchr(G.filename, '/') && + endc == '\\')); +} + + + + + +/*****************************/ +/* Function get_time_stamp() */ +/*****************************/ + +int get_time_stamp(__G__ last_modtime, nmember) /* return PK-type error code */ + __GDEF + time_t *last_modtime; + unsigned *nmember; +{ + int do_this_file=FALSE, error, error_in_archive=PK_COOL; + unsigned j; +#ifdef USE_EF_UT_TIME + iztimes z_utime; +#endif + min_info info; + + +/*--------------------------------------------------------------------------- + Unlike extract_or_test_files() but like list_files(), this function works + on information in the central directory alone. Thus we have a single, + large loop through the entire directory, searching for the latest time + stamp. + ---------------------------------------------------------------------------*/ + + *last_modtime = 0L; /* assuming no zipfile data older than 1970 */ + *nmember = 0; + G.pInfo = &info; + + for (j = 0; j++ < (unsigned)G.ecrec.total_entries_central_dir;) { + + if (readbuf(__G__ G.sig, 4) == 0) + return PK_EOF; + if (strncmp(G.sig, central_hdr_sig, 4)) { /* just to make sure */ + Info(slide, 0x401, ((char *)slide, LoadFarString(CentSigMsg), j)); + Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg))); + return PK_BADERR; + } + /* process_cdir_file_hdr() sets pInfo->lcflag: */ + if ((error = process_cdir_file_hdr(__G)) != PK_COOL) + return error; /* only PK_EOF defined */ + if ((error = do_string(__G__ G.crec.filename_length, DS_FN)) != PK_OK) + { /* ^-- (uses pInfo->lcflag) */ + error_in_archive = error; + if (error > PK_WARN) /* fatal: can't continue */ + return error; + } + if (G.extra_field != (uch *)NULL) { + free(G.extra_field); + G.extra_field = (uch *)NULL; + } + if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD)) + != 0) + { + error_in_archive = error; + if (error > PK_WARN) /* fatal */ + return error; + } + if (!G.process_all_files) { /* check if specified on command line */ + unsigned i; + + do_this_file = FALSE; + for (i = 0; i < G.filespecs; i++) + if (match(G.filename, G.pfnames[i], uO.C_flag)) { + do_this_file = TRUE; + break; /* found match, so stop looping */ + } + if (do_this_file) { /* check if this is an excluded file */ + for (i = 0; i < G.xfilespecs; i++) + if (match(G.filename, G.pxnames[i], uO.C_flag)) { + do_this_file = FALSE; /* ^-- ignore case in match */ + break; + } + } + } + + /* If current file was specified on command line, or if no names were + * specified, check the time for this file. Either way, get rid of the + * file comment and go back for the next file. + * Directory entries are always ignored, to stay compatible with both + * Zip and PKZIP. + */ + if ((G.process_all_files || do_this_file) && !fn_is_dir(__G)) { +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.crec.extra_field_length, 1, + G.crec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME)) + { + if (*last_modtime < z_utime.mtime) + *last_modtime = z_utime.mtime; + } else +#endif /* USE_EF_UT_TIME */ + { + time_t modtime = dos_to_unix_time(G.crec.last_mod_dos_datetime); + + if (*last_modtime < modtime) + *last_modtime = modtime; + } + ++*nmember; + } + SKIP_(G.crec.file_comment_length) + + } /* end for-loop (j: files in central directory) */ + +/*--------------------------------------------------------------------------- + Double check that we're back at the end-of-central-directory record. + ---------------------------------------------------------------------------*/ + + if (readbuf(__G__ G.sig, 4) == 0) + return PK_EOF; + if (strncmp(G.sig, end_central_sig, 4)) { /* just to make sure again */ + Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg))); + error_in_archive = PK_WARN; + } + if (*nmember == 0 && error_in_archive <= PK_WARN) + error_in_archive = PK_FIND; + + return error_in_archive; + +} /* end function get_time_stamp() */ + +#endif /* TIMESTAMP */ + + + + + +/********************/ +/* Function ratio() */ /* also used by ZipInfo routines */ +/********************/ + +int ratio(uc, c) + ulg uc, c; +{ + ulg denom; + + if (uc == 0) + return 0; + if (uc > 2000000L) { /* risk signed overflow if multiply numerator */ + denom = uc / 1000L; + return ((uc >= c) ? + (int) ((uc-c + (denom>>1)) / denom) : + -((int) ((c-uc + (denom>>1)) / denom))); + } else { /* ^^^^^^^^ rounding */ + denom = uc; + return ((uc >= c) ? + (int) ((1000L*(uc-c) + (denom>>1)) / denom) : + -((int) ((1000L*(c-uc) + (denom>>1)) / denom))); + } /* ^^^^^^^^ rounding */ +} + + + + + +/************************/ +/* Function fnprint() */ /* also used by ZipInfo routines */ +/************************/ + +void fnprint(__G) /* print filename (after filtering) and newline */ + __GDEF +{ + char *name = fnfilter(G.filename, slide); + + (*G.message)((zvoid *)&G, (uch *)name, (ulg)strlen(name), 0); + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + +} /* end function fnprint() */ diff --git a/utils/Install/sfxzip/makefile b/utils/Install/sfxzip/makefile new file mode 100644 index 0000000000..92be40b56a --- /dev/null +++ b/utils/Install/sfxzip/makefile @@ -0,0 +1,142 @@ +#============================================================================== +# Makefile for UnZip, UnZipSFX and fUnZip: Unix and MS-DOS ("real" makes only) +# Version: 5.4 19 November 1998 +#============================================================================== + + +# INSTRUCTIONS (such as they are): +# +# "make sunos" -- makes UnZip in current directory on a generic SunOS 4.x Sun +# "make list" -- lists all supported systems (targets) +# "make help" -- provides pointers on what targets to try if problems occur +# "make wombat" -- chokes and dies if you haven't added the specifics for your +# Wombat 68000 (or whatever) to the systems list +# +# CF are flags for the C compiler. LF are flags for the loader. LF2 are more +# flags for the loader, if they need to be at the end of the line instead of at +# the beginning (for example, some libraries). FL and FL2 are the corre- +# sponding flags for fUnZip. LOCAL_UNZIP is an environment variable that can +# be used to add default C flags to your compile without editing the Makefile +# (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C). +# +# Some versions of make do not define the macro "$(MAKE)"; this is rare, but +# if things don't work, try using "make" instead of "$(MAKE)" in your system's +# makerule. Or try adding the following line to your .login file: +# setenv MAKE "make" +# (That never works--makes that are too stupid to define MAKE are also too +# stupid to look in the environment--but try it anyway for kicks. :-) ) +# +# Memcpy and memset are provided for those systems that don't have them; they +# are in fileio.c and will be used if -DZMEM is included in CF. These days +# almost all systems have them. +# +# Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila- +# tion does not always imply a working program. + + +##################### +# MACRO DEFINITIONS # +##################### + +# Defaults most systems use (use LOCAL_UNZIP in environment to add flags, +# such as -DDOSWILD). + +# UnZip flags +CC = cc# try using "gcc" target rather than changing this (CC and LD +LD = $(CC)# must match, else "unresolved symbol: ___main" is possible) +AS = as +LOC = $(LOCAL_UNZIP) +AF = $(LOC) +CF = -O -g -I. -I.. -I../inczip $(LOC) -I/usr/local//include -I/usr/X11R6/include -I/usr/local/lib/glib/include -DSTRICT -D__WXGTK__ -DGTK_NO_CHECK_CASTS -D_REENTRANT -D_IODBC_ -Wall +LF = -o sfx -L/usr/local/lib -L/usr/X11R6/lib -L/usr -lwx_gtk -lpng -ljpeg -lstdc++ -lgcc -lc_r -lgtk -lgdk -lgmodule -lglib -lXext -lX11 -lm -lgthread +LF2 = -s + +# general-purpose stuff +#CP = cp +CP = ln +LN = ln +RM = rm -f +CHMOD = chmod +BINPERMS = 755 +MANPERMS = 644 +STRIP = strip +E = +O = .o +M = unix +SHELL = /bin/sh + +# defaults for crc32 stuff and system dependent headers +CRC32 = crc32 + +# object files +OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O +OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O +OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O +OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O install$O wxmain$O instsup$O +UNZIP_H = ../inczip/unzip.h ../inczip/unzpriv.h ../inczip/globals.h + +# installation +# (probably can change next two to `install' and `install -d' if you have it) +INSTALL = cp +INSTALL_D = mkdir -p + +############################################### +# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES # +############################################### + +# this is for GNU make; comment out and notify zip-bugs if it causes errors +.SUFFIXES: .c .o .obj .pic.o + +# yes, we should be able to use the $O macro to combine these two, but it +# fails on some brain-damaged makes (e.g., AIX's)...no big deal +.c.o: + $(CC) -c $(CF) $*.c + +.c.obj: + $(CC) -c $(CF) $*.c + +.c.pic.o: + $(CC) -c $(CF) -o $@ $*.c + +all: sfx + + +# EDIT HERE FOR PARALLEL MAKES on Sequent (and others?)--screws up MS-DOS +# make utilities if default: change "unzip$E:" to "unzip$E:&" + +sfx$E: $(OBJS) # add `&' for parallel makes + $(LD) $(LF) $(OBJS) + +crc32$O: crc32.c $(UNZIP_H) ../inczip/zip.h +crctab$O: crctab.c $(UNZIP_H) ../inczip/zip.h +crypt$O: crypt.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +envargs$O: envargs.c $(UNZIP_H) +explode$O: explode.c $(UNZIP_H) +extract$O: extract.c $(UNZIP_H) ../inczip/crypt.h +fileio$O: fileio.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/ebcdic.h +funzip$O: funzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/tables.h +globals$O: globals.c $(UNZIP_H) +inflate$O: inflate.c ../inczip/inflate.h $(UNZIP_H) +list$O: list.c $(UNZIP_H) +match$O: match.c $(UNZIP_H) +process$O: process.c $(UNZIP_H) +ttyio$O: ttyio.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +unreduce$O: unreduce.c $(UNZIP_H) +unshrink$O: unshrink.c $(UNZIP_H) +unzip$O: unzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/version.h ../inczip/consts.h +zipinfo$O: zipinfo.c $(UNZIP_H) + +unix$O: unix.c $(UNZIP_H) ../inczip/version.h # Unix only + $(CC) -c $(CF) unix.c + +install$O: ../install.c + $(CC) -c $(CF) ../install.c + +wxmain$O: ../wxmain.cpp + $(CC) -c $(CF) ../wxmain.cpp + +instsup$O: ../instsup.cpp + $(CC) -c $(CF) ../instsup.cpp + + + diff --git a/utils/Install/sfxzip/makefile.b32 b/utils/Install/sfxzip/makefile.b32 new file mode 100644 index 0000000000..ce4e11187e --- /dev/null +++ b/utils/Install/sfxzip/makefile.b32 @@ -0,0 +1,135 @@ +# Makefile for UnZip(SFX) and fUnZip for Borland C++ for Windows 95/NT +# Version: 5.4 and later Alvin Koh, Jim Knoble, Christian Spieler, etc. +# Adapted from the MS-DOS makefile by E-Yen Tan +# +# Last revised: 24 Nov 98 +# +# + + +# Optional nonstandard preprocessor flags (as -DCHECK_EOF or -DDOS_WILD) +# should be added to the environment via "set LOCAL_UNZIP=-DFOO" or added +# to the declaration of LOC here: +LOC = $(LOCAL_UNZIP) + +# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. +CPU_TYP = 4 + +# (De)Select inclusion of optimized assembler CRC32 routine: +USE_ASMCRC = 0 + +# If you have bcc32i, you should define: +# CC = bcc32i +# This compiler generates a faster code. +CC = bcc32 +AS = tasm32 + +!if $(USE_ASMCRC) +ASMFLG = -DASM_CRC +ASMOBJS = crc_i386.obj +!else +ASMFLG = +ASMOBJS = +!endif + +!if $(UNCLEAN) +DIRT = -DUSE_SMITH_CODE -DUSE_UNSHRINK +!else +DIRT = +!endif + +# compiler flags + +ASCPUFLAG = __$(CPU_TYP)86 +!if $(CPU_TYP) != 0 +CC_CPUFLG = -$(CPU_TYP) +!endif +ASFLAGS = -ml -m2 -w0 -D$(ASCPUFLAG) $(LOC) +CFLAGS = -Od -w- $(CC_CPUFLG) -ff- -k- -P-.C -I. -I.. -I../inczip -I../../../include $(ASMFLG) $(LOC) $(DIRT) -v -D__WXMSW__ -DWXDEBUG=1 -D__WXDEBUG__ -DUSE_DEFINE -DWIN32 -D__WIN95__ -D__WINDOWS__ -I$(WXDIR)\include +LDFLAGS = -L$(WXWIN)\lib -aa -c # for bcc +LINK = ilink32 +LIBS = wx32 cw32mt import32 ole2w32 winpng zlib jpeg xpm tiff + +UNFLAGS = $(CFLAGS) + +# implicit rules + +.asm.obj: + $(AS) $(ASFLAGS) $< + +.c.obj: + $(CC) -c $(UNFLAGS) {$< } + +# list macros + +OBJU1 = unzip.obj crc32.obj crctab.obj crypt.obj envargs.obj explode.obj +OBJU2 = extract.obj fileio.obj globals.obj inflate.obj list.obj match.obj +OBJU3 = process.obj ttyio.obj unreduce.obj unshrink.obj zipinfo.obj +OBJUS = win32.obj nt.obj install.obj wxmain.obj instsup.obj $(ASMOBJS) +OBJU = $(OBJU1) $(OBJU2) $(OBJU3) $(OBJUS) + +UNZIP_H = ../inczip/unzip.h ../inczip/unzpriv.h ../inczip/globals.h ../inczip/w32cfg.h + +# explicit rules + +all: sfx.exe + +sfx.exe: $(OBJU) sfx.res + $(LINK) $(LDFLAGS) @&&! +c0w32.obj $(OBJU) +sfx.exe +nul +$(LIBS) + +sfx.res +! + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws + -erase *.tds + -erase *.il? + +# individual file dependencies + +crc32.obj: crc32.c $(UNZIP_H) ../inczip/zip.h +crctab.obj: crctab.c $(UNZIP_H) ../inczip/zip.h +crypt.obj: crypt.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +envargs.obj: envargs.c $(UNZIP_H) +explode.obj: explode.c $(UNZIP_H) +extract.obj: extract.c $(UNZIP_H) ../inczip/crypt.h +fileio.obj: fileio.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/ebcdic.h +globals.obj: globals.c $(UNZIP_H) +inflate.obj: inflate.c ../inczip/inflate.h $(UNZIP_H) +list.obj: list.c $(UNZIP_H) +match.obj: match.c $(UNZIP_H) +process.obj: process.c $(UNZIP_H) +ttyio.obj: ttyio.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +unreduce.obj: unreduce.c $(UNZIP_H) +unshrink.obj: unshrink.c $(UNZIP_H) +unzip.obj: unzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/version.h ../inczip/consts.h +zipinfo.obj: zipinfo.c $(UNZIP_H) + +#crc_i386.obj: win32/crc_i386.asm +# $(AS) $(ASFLAGS) win32\crc_i386.asm, $*.obj ; + +win32.obj: win32.c $(UNZIP_H) + $(CC) -c $(UNFLAGS) win32.c + +nt.obj: nt.c $(UNZIP_H) + $(CC) -c $(UNFLAGS) nt.c + +install.obj: ../install.c $(UNZIP_H) + $(CC) -c $(UNFLAGS) ../install.c + +wxmain.obj: ../wxmain.cpp $(UNZIP_H) + $(CC) -P- -c $(UNFLAGS) ../wxmain.cpp + +instsup.obj: ../instsup.cpp $(UNZIP_H) + $(CC) -P- -c $(UNFLAGS) ../instsup.cpp + +sfx.res : sfx.rc $(WXWIN)\include\wx\msw\wx.rc + brc32 -r /i$(BCCDIR)\include /i$(WXWIN)\include /i$(WXWIN)\contrib\include sfx diff --git a/utils/Install/sfxzip/makefile.g95 b/utils/Install/sfxzip/makefile.g95 new file mode 100644 index 0000000000..3049513be8 --- /dev/null +++ b/utils/Install/sfxzip/makefile.g95 @@ -0,0 +1,164 @@ +# Makefile for UnZip, fUnZip and UnZipSFX for native Win32-Intel ports of gcc. +# Currently supported implementations: Cygnus/Win32 and MinGW32. +# +# First version: Cosmin Truta <cosmint@cs.ubbcluj.ro>, Dec 1997. +# Last revision: Christian Spieler, 29-Apr-1998 +# +# To use, do "make -f win32/makefile.gcc". + + +### Optional section + +# Optional nonstandard preprocessor flags (as -DUSE_ZLIB or -DUSE_SMITH_CODE) +# should be added to the environment via "set LOCAL_UNZIP=-DFOO" or added +# to the declaration of LOCFLAGS here: +LOCFLAGS = $(LOCAL_UNZIP) + + +### Compiler-specific section + +# ------------ GNU C ------------ +CC = gcc + +#AS = as +AS = $(CC) + +#LD = ld +LD = $(CC) + +# Quiet +CC_QUIET_OPT = +AS_QUIET_OPT = $(CC_QUIET_OPT) +LD_QUIET_OPT = $(CC_QUIET_OPT) + +# Warnings +CC_WARN_OPT = -Wall +AS_WARN_OPT = $(CC_WARN_OPT) +LD_WARN_OPT = + +# Debug version +CC_DEBUG_OPT = -g +AS_DEBUG_OPT = $(CC_DEBUG_OPT) +LD_DEBUG_OPT = $(CC_DEBUG_OPT) + +# Release version +CC_RELEASE_OPT = +AS_RELEASE_OPT = +#LD_RELEASE_OPT = -s + +# Smallest code +CC_SIZE_OPT = -O1 + +# Fastest code +CC_SPEED_OPT = -O2 + +# Output object file name +CC_OUT_OPT = -o + +# Other specific options +#CC_SPECIFIC_OPT = -c -DASM_CRC -DWIN32 -mno-cygwin +CC_SPECIFIC_OPT = -c -DWIN32 -I../inczip -g -I.. -D_X86_=1 -DWIN32 -D_WIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -I../../../include -I../../../src/png -I../../../src/jpeg -I../../../src/zlib -I../../../include/wx/msw/gnuwin32 -DSTRICT -D__WXMSW__ -D__WINDOWS__ -D__WXDEBUG__ -Wall -fno-pcc-struct-return -O2 -fno-rtti -fno-exceptions +AS_SPECIFIC_OPT = -c +LD_SPECIFIC_OPT = -Wl,--subsystem,windows -mwindows -L../../../lib -o $@ + +# Libraries for the debug & release version +LD_RELEASE_LIBS = ../../../lib/libwx.a -lpng -ljpeg -lzlib -lxpm -lstdc++ -lgcc -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lole32 -loleaut32 -luuid -lodbc32 -lwsock32 +LD_DEBUG_LIBS = $(LD_RELEASE_LIBS) + + +### System-specific section + +# Suffixes +OBJ = .o +EXE = .exe + +.SUFFIXES: .c .S $(OBJ) $(EXE) + +# Commands +RM = rm -f + + +### General section + +CFLAGS = $(CC_SPECIFIC_OPT) $(CC_QUIET_OPT) $(CC_WARN_OPT) $(LOCFLAGS) \ + $(CC_OUT_OPT) $@ +ASFLAGS = $(AS_SPECIFIC_OPT) $(AS_QUIET_OPT) $(AS_WARN_OPT) $(LOCFLAGS) +LDFLAGS = $(LD_SPECIFIC_OPT) $(LD_QUIET_OPT) $(LD_WARN_OPT) + +# To build with debug info, use 'make DEBUG=1'. +ifdef DEBUG +CVER = $(CC_DEBUG_OPT) +ASVER = $(AS_DEBUG_OPT) +LDVER = $(LD_DEBUG_OPT) +GENFLAGS = +FFLAGS = -DFUNZIP +SFXFLAGS = -DSFX +LDLIBS = $(LD_DEBUG_LIBS) +else +CVER = $(CC_RELEASE_OPT) +ASVER = $(AS_RELEASE_OPT) +LDVER = $(LD_RELEASE_OPT) +GENFLAGS = $(CC_SPEED_OPT) +FFLAGS = $(CC_SPEED_OPT) -DFUNZIP +SFXFLAGS = $(CC_SIZE_OPT) -DSFX +LDLIBS = $(LD_RELEASE_LIBS) +endif + +# Object files +OBJA = crc_i386$(OBJ) install$(OBJ) wxmain$(OBJ) instsup$(OBJ) +OBJS1 = unzip$(OBJ) crc32$(OBJ) crctab$(OBJ) crypt$(OBJ) envargs$(OBJ) +OBJS2 = explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ) inflate$(OBJ) +OBJS3 = list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ) unreduce$(OBJ) +OBJS4 = unshrink$(OBJ) zipinfo$(OBJ) win32$(OBJ) nt$(OBJ) +OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJA) + +UNZIP_H = ../inczip/unzip.h ../inczip/unzpriv.h ../inczip/globals.h ../inczip/w32cfg.h + + +# Default target is all the executables +unzips: sfx$(EXE) + +sfx$(EXE): $(OBJS) + $(LD) $(LDFLAGS) $(LDVER) $(OBJS) $(LDLIBS) + +# How to compile sources +.c$(OBJ): + $(CC) $(CFLAGS) $(CVER) $(GENFLAGS) $< +.S$(OBJ): + $(AS) $(ASFLAGS) $(ASVER) $(GENFLAGS) $< + +# Dependencies +crc32$(OBJ): crc32.c $(UNZIP_H) ../inczip/zip.h +crctab$(OBJ): crctab.c $(UNZIP_H) ../inczip/zip.h +crypt$(OBJ): crypt.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +envargs$(OBJ): envargs.c $(UNZIP_H) +explode$(OBJ): explode.c $(UNZIP_H) +extract$(OBJ): extract.c $(UNZIP_H) ../inczip/crypt.h +fileio$(OBJ): fileio.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/ebcdic.h +funzip$(OBJ): funzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/tables.h +globals$(OBJ): globals.c $(UNZIP_H) +inflate$(OBJ): inflate.c ../inczip/inflate.h $(UNZIP_H) +list$(OBJ): list.c $(UNZIP_H) +match$(OBJ): match.c $(UNZIP_H) +process$(OBJ): process.c $(UNZIP_H) +ttyio$(OBJ): ttyio.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +unreduce$(OBJ): unreduce.c $(UNZIP_H) +unshrink$(OBJ): unshrink.c $(UNZIP_H) +unzip$(OBJ): unzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/version.h ../inczip/consts.h +zipinfo$(OBJ): zipinfo.c $(UNZIP_H) +crc_i386$(OBJ): crc_i386.S +win32$(OBJ): win32.c $(UNZIP_H) ../inczip/nt.h +nt$(OBJ): nt.c ../inczip/nt.h + +install$(OBJ): ../install.c + $(CC) $(CFLAGS) $(CVER) $(GENFLAGS) $< + +wxmain$(OBJ): ../wxmain.cpp + $(CC) $(CFLAGS) $(CVER) $(GENFLAGS) $< + +instsup$(OBJ): ../instsup.cpp + $(CC) $(CFLAGS) $(CVER) $(GENFLAGS) $< + +clean: + $(RM) *$(OBJ) + $(RM) *$(EXE) diff --git a/utils/Install/sfxzip/makefile.gcc b/utils/Install/sfxzip/makefile.gcc new file mode 100644 index 0000000000..92be40b56a --- /dev/null +++ b/utils/Install/sfxzip/makefile.gcc @@ -0,0 +1,142 @@ +#============================================================================== +# Makefile for UnZip, UnZipSFX and fUnZip: Unix and MS-DOS ("real" makes only) +# Version: 5.4 19 November 1998 +#============================================================================== + + +# INSTRUCTIONS (such as they are): +# +# "make sunos" -- makes UnZip in current directory on a generic SunOS 4.x Sun +# "make list" -- lists all supported systems (targets) +# "make help" -- provides pointers on what targets to try if problems occur +# "make wombat" -- chokes and dies if you haven't added the specifics for your +# Wombat 68000 (or whatever) to the systems list +# +# CF are flags for the C compiler. LF are flags for the loader. LF2 are more +# flags for the loader, if they need to be at the end of the line instead of at +# the beginning (for example, some libraries). FL and FL2 are the corre- +# sponding flags for fUnZip. LOCAL_UNZIP is an environment variable that can +# be used to add default C flags to your compile without editing the Makefile +# (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C). +# +# Some versions of make do not define the macro "$(MAKE)"; this is rare, but +# if things don't work, try using "make" instead of "$(MAKE)" in your system's +# makerule. Or try adding the following line to your .login file: +# setenv MAKE "make" +# (That never works--makes that are too stupid to define MAKE are also too +# stupid to look in the environment--but try it anyway for kicks. :-) ) +# +# Memcpy and memset are provided for those systems that don't have them; they +# are in fileio.c and will be used if -DZMEM is included in CF. These days +# almost all systems have them. +# +# Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila- +# tion does not always imply a working program. + + +##################### +# MACRO DEFINITIONS # +##################### + +# Defaults most systems use (use LOCAL_UNZIP in environment to add flags, +# such as -DDOSWILD). + +# UnZip flags +CC = cc# try using "gcc" target rather than changing this (CC and LD +LD = $(CC)# must match, else "unresolved symbol: ___main" is possible) +AS = as +LOC = $(LOCAL_UNZIP) +AF = $(LOC) +CF = -O -g -I. -I.. -I../inczip $(LOC) -I/usr/local//include -I/usr/X11R6/include -I/usr/local/lib/glib/include -DSTRICT -D__WXGTK__ -DGTK_NO_CHECK_CASTS -D_REENTRANT -D_IODBC_ -Wall +LF = -o sfx -L/usr/local/lib -L/usr/X11R6/lib -L/usr -lwx_gtk -lpng -ljpeg -lstdc++ -lgcc -lc_r -lgtk -lgdk -lgmodule -lglib -lXext -lX11 -lm -lgthread +LF2 = -s + +# general-purpose stuff +#CP = cp +CP = ln +LN = ln +RM = rm -f +CHMOD = chmod +BINPERMS = 755 +MANPERMS = 644 +STRIP = strip +E = +O = .o +M = unix +SHELL = /bin/sh + +# defaults for crc32 stuff and system dependent headers +CRC32 = crc32 + +# object files +OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O +OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O +OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O +OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O install$O wxmain$O instsup$O +UNZIP_H = ../inczip/unzip.h ../inczip/unzpriv.h ../inczip/globals.h + +# installation +# (probably can change next two to `install' and `install -d' if you have it) +INSTALL = cp +INSTALL_D = mkdir -p + +############################################### +# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES # +############################################### + +# this is for GNU make; comment out and notify zip-bugs if it causes errors +.SUFFIXES: .c .o .obj .pic.o + +# yes, we should be able to use the $O macro to combine these two, but it +# fails on some brain-damaged makes (e.g., AIX's)...no big deal +.c.o: + $(CC) -c $(CF) $*.c + +.c.obj: + $(CC) -c $(CF) $*.c + +.c.pic.o: + $(CC) -c $(CF) -o $@ $*.c + +all: sfx + + +# EDIT HERE FOR PARALLEL MAKES on Sequent (and others?)--screws up MS-DOS +# make utilities if default: change "unzip$E:" to "unzip$E:&" + +sfx$E: $(OBJS) # add `&' for parallel makes + $(LD) $(LF) $(OBJS) + +crc32$O: crc32.c $(UNZIP_H) ../inczip/zip.h +crctab$O: crctab.c $(UNZIP_H) ../inczip/zip.h +crypt$O: crypt.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +envargs$O: envargs.c $(UNZIP_H) +explode$O: explode.c $(UNZIP_H) +extract$O: extract.c $(UNZIP_H) ../inczip/crypt.h +fileio$O: fileio.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/ebcdic.h +funzip$O: funzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/ttyio.h ../inczip/tables.h +globals$O: globals.c $(UNZIP_H) +inflate$O: inflate.c ../inczip/inflate.h $(UNZIP_H) +list$O: list.c $(UNZIP_H) +match$O: match.c $(UNZIP_H) +process$O: process.c $(UNZIP_H) +ttyio$O: ttyio.c $(UNZIP_H) ../inczip/zip.h ../inczip/crypt.h ../inczip/ttyio.h +unreduce$O: unreduce.c $(UNZIP_H) +unshrink$O: unshrink.c $(UNZIP_H) +unzip$O: unzip.c $(UNZIP_H) ../inczip/crypt.h ../inczip/version.h ../inczip/consts.h +zipinfo$O: zipinfo.c $(UNZIP_H) + +unix$O: unix.c $(UNZIP_H) ../inczip/version.h # Unix only + $(CC) -c $(CF) unix.c + +install$O: ../install.c + $(CC) -c $(CF) ../install.c + +wxmain$O: ../wxmain.cpp + $(CC) -c $(CF) ../wxmain.cpp + +instsup$O: ../instsup.cpp + $(CC) -c $(CF) ../instsup.cpp + + + diff --git a/utils/Install/sfxzip/makefile.os2 b/utils/Install/sfxzip/makefile.os2 new file mode 100644 index 0000000000..6778bd50ab --- /dev/null +++ b/utils/Install/sfxzip/makefile.os2 @@ -0,0 +1,670 @@ +# Makefile for UnZip, UnZipSFX and fUnZip 24 November 1998 +# +# supported compilers: +# - Microsoft C, version 6.00 or higher, for use under OS/2 1.x (16-bit) +# - Watcom C/C++, version 9.0+, for use under OS/2 1.x or 2.x+ (16/32-bit) +# - emx+gcc, version 0.9c or higher, for use under OS/2 2.x+ (32-bit) +# - IBM C Set++, for use under OS/2 2.x+ (32-bit) +# - Borland C++, for use under OS/2 2.x+ (32-bit) +# - Metaware High C/C++, for use under OS/2 2.x+ (32-bit) +# +# supported cross-compilers: +# - Microsoft C, version 6.0 or 7.0, for use under DOS (16-bit) +# - Watcom C/C++, version 9.0+, for use under DOS/Win95/NT (16/32-bit) +# - GNU gcc (emx), version 0.9c or higher, for use under DOS/Win95/NT (32-bit) +# +# supported assemblers: +# - Microsoft MASM 6.00 with Microsoft C +# - Watcom WASM with Watcom C/C++ +# - GNU as with GNU gcc + +# To use MASM 5.x instead of MASM 6.00: +# - set AS="masm -t -Ml" +# - set ASEOL=";" + +# To use, enter "{d,n}make -f os2/makefile.os2" (this makefile depends on its +# name being "makefile.os2", and it must be in the os2 subdirectory). + +# Notes on Microsoft C 6.00 compilation for OS/2: +# +# The resulting programs can be used under OS/2 protected mode only, not +# under DOS. A larger stack has to be used for OS/2 because system calls +# use more stack than under DOS; 8k is recommended by Microsoft. + +# Notes on IBM C Set++, Watcom C/C++, Borland C++ or emx+gcc compilation: +# +# The resulting programs can be used under protected mode of OS/2 2.x or +# higher only, not under OS/2 1.x and not under DOS. +# +# The NFLAGS macro is used to work around an optimization bug in the IBM +# C++ Set compiler; this is fixed by CSD #4, so NFLAGS="" can be used for +# all targets below. + +# Notes on Watcom C/C++ compilation for DOS with the PMODE/W extender: +# +# You need to add the following section to your \watcom\binb\wlsystem.lnk +# file and also need to copy pmodew.exe to the same directory: +# +# system begin pmodew +# option osname='PMODE/W' +# libpath %WATCOM%\lib386 +# libpath %WATCOM%\lib386\dos +# op stub=pmodew.exe +# format os2 le +# end +# +# PMODE/W 1.16 or higher is required. See also msdos/README for important +# notes about PMODE/W bugs. + +default: + @echo "Enter `$(MAKE) -f os2/makefile.os2 target' from the main" + @echo "UnZip directory, where target is one of:" + @echo " msc mscdebug mscdos ibm ibmdyn ibmdebug ibmprof" + @echo " ibmdll ibmdyndll ibmdebugdll ibmprofdll" + @echo " metaware borland gcc gccdyn gccdebug gccdos gccwin32" + @echo " watcom watcom16 watcomdos watcom16dos pmodew watcomwin32" + +# MS C 6.00 for OS/2, 16-bit (should figure out way to split unzip/funzip +# compiles so former is always large model and latter always small model...) +msc: + $(MAKE) -f os2/makefile.os2 all \ + CC="cl -nologo -AL -Ocegit -Gs -I. $(FP)" \ + CFLAGS="-G2 -Zp1 -W3 -DOS2 -DMSC -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="ml -nologo -c -Zm -Cp" \ + ASFLAGS="-D__LARGE__ -D__286" \ + LDFLAGS="-F 2000 -Lp -Fe" \ + LDFLAGS2="-link /noe" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i86" \ + CRC32F="crc_i86" \ + CRC32X="crc_i86" \ + DEF="os2\unzip.def" + +# MS C 6.00 for OS/2, debug version +mscdebug: + $(MAKE) -f os2/makefile.os2 all \ + CC="cl -nologo -AL -Zi -Od -I. $(FP)" \ + CFLAGS="-G2 -Zp1 -W3 -DOS2 -DMSC -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="ml -nologo -c -Zim -Cp" \ + ASFLAGS="-D__LARGE__ -D__286" \ + LDFLAGS="-F 2000 -Lp -Fe" \ + LDFLAGS2="-link /noe" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i86" \ + CRC32F="crc_i86" \ + CRC32X="crc_i86" \ + DEF="os2\unzip.def" + +# cross-compilation for MS-DOS with MS C 6.00 (same comment as above...formerly; +# now unzip is medium model again, with [almost] all strings in far memory) +mscdos: + $(MAKE) -f os2/makefile.os2 all \ + CC="cl -nologo -AM -Oaict -Gs -I. $(FP)" \ + CFLAGS="-Zp1 -W3 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="ml -nologo -c -Zm -Cp" \ + ASFLAGS="-D__MEDIUM__" \ + LDFLAGS="-F 0C00 -Lr -Fe" \ + LDFLAGS2="-link /noe /exe" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i86" \ + CRC32F="crc_i86" \ + CRC32X="crc_i86" \ + OBJU2="msdos.obj" \ + OBJX2="msdos_.obj" \ + OSDEP_H="msdos/doscfg.h" + +# IBM C Set, statically linked runtime +ibm: + $(MAKE) -f os2/makefile.os2 all \ + CC="icc -Q -O -Gs -I." \ + CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-B/ST:0x50000 -Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DEF="os2\unzip.def" + +# IBM C Set, dynamically linked runtime +ibmdyn: + $(MAKE) -f os2/makefile.os2 all \ + CC="icc -Q -O -Gs -Gd -I." \ + CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-B/ST:0x50000 -Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DEF="os2\unzip.def" + +# IBM C Set, debug version +ibmdebug: + $(MAKE) -f os2/makefile.os2 all \ + CC="icc -Q -Ti -I." \ + CFLAGS="-Sm -Sp1 -D__DEBUG_ALLOC__ -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-B/ST:0x50000 -Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DEF="os2\unzip.def" + +# IBM C Set, profiling version for PROFIT +ibmprof: + $(MAKE) -f os2/makefile.os2 all \ + CC="icc -Q -O -Gs -Gh -Ti -I." \ + CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-B/ST:0x50000 -Fe" \ + LDFLAGS2="cppopa3.obj" \ + OUT="-Fo" \ + OBJ=".obj" \ + DEF="os2\unzip.def" + +# IBM C Set, statically linked runtime +ibmdll: + $(MAKE) -f os2/makefile.os2 dll \ + CC="icc -Q -O -Gs -I." \ + CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \ + LDFLAGS="-Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DLLDEF="os2\rexxapi.def" \ + STUBDEF="os2\stub.def" \ + DEF="os2\unzip.def" \ + APILIB="REXX.lib" + +# IBM C Set, dynamically linked runtime +ibmdyndll: + $(MAKE) -f os2/makefile.os2 dll \ + CC="icc -Q -O -Gs -Gd -I." \ + CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \ + LDFLAGS="-Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DLLDEF="os2\rexxapi.def" \ + STUBDEF="os2\stub.def" \ + DEF="os2\unzip.def" \ + APILIB="REXX.lib" + +# IBM C Set, debug version +ibmdebugdll: + $(MAKE) -f os2/makefile.os2 dll \ + CC="icc -Q -Ti -I." \ + CFLAGS="-Sm -Sp1 -D__DEBUG_ALLOC__ -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \ + LDFLAGS="-Fe" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + DLLDEF="os2\rexxapi.def" \ + STUBDEF="os2\stub.def" \ + DEF="os2\unzip.def" \ + APILIB="REXX.lib" + +# IBM C Set, profiling version for PROFIT +ibmprofdll: + $(MAKE) -f os2/makefile.os2 dll \ + CC="icc -Q -O -Gs -Gh -Ti -I." \ + CFLAGS="-Gm -Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \ + LDFLAGS="-Fe" \ + LDFLAGS2="profit.obj" \ + OUT="-Fo" \ + OBJ=".obj" \ + DLLDEF="os2\rexxapi.def" \ + STUBDEF="os2\stub.def" \ + DEF="os2\unzip.def" \ + APILIB="REXX.lib" + +# Watcom C/386 9.0 or higher +watcom: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl386 -bt=os2v2 -zq -Ox -s -I." \ + CFLAGS="-Zp1 -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=os2v2 -zq -3 -mf" \ + ASFLAGS="" \ + LDFLAGS="-k0x50000 -x -l=os2v2 -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i386" \ + CRC32F="crc_i386" \ + CRC32X="crc_i386" \ + DEF="" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# Watcom C/286 9.0 or higher +watcom16: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl -bt=os2 -zq -ml -Ox -s -I." \ + CFLAGS="-Zp1 -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=os2 -zq -2 -ml" \ + ASFLAGS="" \ + LDFLAGS="-k0x2000 -x -l=os2 -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i86" \ + CRC32F="crc_i86" \ + CRC32X="crc_i86" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# Watcom C/386 9.0 or higher, crosscompilation for DOS, DOS4GW extender +watcomdos: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl386 -bt=dos4g -zq -Ox -s -I." \ + CFLAGS="-Zp1 -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=dos4g -zq -3 -mf" \ + ASFLAGS="" \ + LDFLAGS="-k0x50000 -x -l=dos4g -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i386" \ + CRC32F="crc_i386" \ + CRC32X="crc_i386" \ + OBJU2="msdos.obj" \ + OBJX2="msdos_.obj" \ + OSDEP_H="msdos/doscfg.h" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# Watcom C/386 9.0 or higher, crosscompilation for DOS, PMODE/W extender +pmodew: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl386 -bt=dos4g -zq -Ox -s -I." \ + CFLAGS="-Zp1 -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=dos4g -zq -3 -mf" \ + ASFLAGS="" \ + LDFLAGS="-k0x50000 -x -l=pmodew -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + CRC32="crc_i386" \ + CRC32F="crc_i386" \ + CRC32X="crc_i386" \ + OBJU2="msdos.obj" \ + OBJX2="msdos_.obj" \ + OSDEP_H="msdos/doscfg.h" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# Watcom C/286 9.0 or higher, crosscompilation for DOS +watcom16dos: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl -bt=dos -zq -ml -Ox -s -I." \ + CFLAGS="-Zp1 -DMSDOS $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=dos -0 -mm" \ + ASFLAGS="-D__MEDIUM__" \ + LDFLAGS="-k0xC00 -x -l=dos -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + OBJU2="msdos.obj" \ + OBJX2="msdos_.obj" \ + OSDEP_H="msdos/doscfg.h" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# Watcom C/386 9.0 or higher, crosscompilation for Win95/NT +watcomwin32: + $(MAKE) -f os2/makefile.os2 all \ + CC="wcl386 -bt=NT -zq -Ox -s -I." \ + CFLAGS="-Zp1 -DWIN32 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="wasm -bt=NT -zq -3 -mf" \ + ASFLAGS="" \ + LDFLAGS="-k0x50000 -x -l=NT -Fe=" \ + LDFLAGS2="" \ + OUT="-Fo" \ + OBJ=".obj" \ + OBJU2="win32.obj nt.obj" \ + OBJX2="win32_.obj nt_.obj" \ + CRC32="crc_i386" \ + CRC32F="crc_i386" \ + CRC32X="crc_i386" \ + DEF="" \ + DIRSEP="\\" \ + AS_DIRSEP="\\" + +# MetaWare High C/C++ 3.2 +metaware: + $(MAKE) -f os2/makefile.os2 all \ + CC="hc -O2 -I." \ + CFLAGS="-D__32BIT__ -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-o " \ + LDFLAGS2="" \ + OUT="-o ./" \ + OBJ=".obj" \ + DEF="-Hdef=os2\unzip.def" + +# Borland C++ +borland: + $(MAKE) -f os2/makefile.os2 all \ + CC="bcc -O -I. -Ios2" \ + CFLAGS="-w- -D__cdecl -D__32BIT__ -DOS2 $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + LDFLAGS="-e" \ + LDFLAGS2="" \ + OUT="-o" \ + OBJ=".obj" \ + DEF="-sDos2\unzip.def" + +# emx, gcc, OMF format, statically linked C runtime +gcc: + $(MAKE) -f os2/makefile.os2 all \ + CC="gcc -Zomf -O -I." \ + CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="gcc -Zomf" \ + ASFLAGS="-Di386" \ + LDFLAGS="-o ./" \ + LDFLAGS2="-Zsmall-conv -Zstack 320 -Zsys -s" \ + OUT="-o" \ + OBJ=".obj" \ + CRC32="crc_gcc" \ + CRC32F="crc_gcc" \ + CRC32X="crc_gcc" \ + DEF="os2/unzip.def" + +# emx, gcc, OMF format, dynamically linked C runtime +gccdyn: + $(MAKE) -f os2/makefile.os2 all \ + CC="gcc -Zomf -O -I." \ + CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="gcc -Zomf" \ + ASFLAGS="-Di386" \ + LDFLAGS="-o ./" \ + LDFLAGS2="-Zstack 320 -Zcrtdll -s" \ + OUT="-o" \ + OBJ=".obj" \ + CRC32="crc_gcc" \ + CRC32F="crc_gcc" \ + CRC32X="crc_gcc" \ + DEF="os2/unzip.def" + +# emx, gcc, a.out format, with debug info for gdb +gccdebug: + $(MAKE) -f os2/makefile.os2 all \ + CC="gcc -g -I." \ + CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="gcc -g" \ + ASFLAGS="-Di386" \ + LDFLAGS="-o ./" \ + LDFLAGS2="-Zsmall-conv" \ + OUT="-o" \ + OBJ=".o" \ + CRC32="crc_gcc" \ + CRC32F="crc_gcc" \ + CRC32X="crc_gcc" + +# emx, gcc, a.out format, cross-compilation for MS-DOS +gccdos: + $(MAKE) -f os2/makefile.os2 all \ + CC="gcc -O -I." \ + CFLAGS="-Wall -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="gcc" \ + ASFLAGS="-Di386" \ + LDFLAGS="-o ./" \ + LDFLAGS2="-Zsmall-conv -s" \ + OUT="-o" \ + OBJ=".o" \ + CRC32="crc_gcc" \ + CRC32F="crc_gcc" \ + CRC32X="crc_gcc" \ + OBJU2="msdos.o" \ + OBJX2="msdos_.o" \ + OSDEP_H="msdos/doscfg.h" + +# emx, gcc, RSXNT, cross-compilation for Win32, statically linked C runtime +gccwin32: + $(MAKE) -f os2/makefile.os2 all \ + CC="gcc -Zwin32 -O2 -I." \ + CFLAGS="-Wall -DWIN32 -DASM_CRC $(LOCAL_UNZIP)" \ + NFLAGS="" \ + DLLFLAG="" \ + AS="gcc" \ + ASFLAGS="-Di386" \ + LDFLAGS="-Zsys -o ./" \ + LDFLAGS2="-ladvapi32 -Zsmall-conv -s" \ + OUT="-o" \ + OBJ=".o" \ + CRC32="crc_gcc" \ + CRC32F="crc_gcc" \ + CRC32X="crc_gcc" \ + OBJU2="win32.o nt.o" \ + OBJX2="win32_.o nt_.o" \ + OBJF2="win32f.o" \ + OSDEP_H="win32/w32cfg.h" + +# variables + +# LOCAL_UNZIP = -DREENTRANT + +# default settings for target dependent macros: +DIRSEP = / +AS_DIRSEP = / + +OSDEP_H = os2/os2data.h os2/os2cfg.h +CRC32 = crc32 +CRC32F = crc32f +CRC32X = crc32_ + +OBJU = unzip$(OBJ) $(CRC32)$(OBJ) crctab$(OBJ) crypt$(OBJ) envargs$(OBJ) \ + explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ) \ + inflate$(OBJ) list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ) \ + unreduce$(OBJ) unshrink$(OBJ) zipinfo$(OBJ) +OBJU2 = os2$(OBJ) os2acl$(OBJ) +OBJX = unzipsf_$(OBJ) $(CRC32X)$(OBJ) crctab_$(OBJ) crypt_$(OBJ) \ + extract_$(OBJ) fileio_$(OBJ) globals_$(OBJ) inflate_$(OBJ) \ + match_$(OBJ) process_$(OBJ) ttyio_$(OBJ) +OBJX2 = os2_$(OBJ) os2acl_$(OBJ) +OBJDLL= api$(OBJ) apihelp$(OBJ) rexxhelp$(OBJ) rexxapi$(OBJ) +OBJF = funzip$(OBJ) $(CRC32F)$(OBJ) cryptf$(OBJ) inflatef$(OBJ) \ + globalsf$(OBJ) ttyiof$(OBJ) +OBJF2 = + +UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H) + +# rules + +.SUFFIXES: .c .asm $(OBJ) + +.c$(OBJ): + $(CC) -c $(CFLAGS) $(DLLFLAG) $< + +.asm$(OBJ): + $(AS) $(ASFLAGS) $< $(ASEOL) + +# targets + +all: unzip.exe funzip.exe unzipsfx.exe +dll: unzip32.dll unzip.stb funzip.exe unzipsfx.exe + +unzip.exe: $(OBJU) $(OBJU2) + $(CC) $(LDFLAGS)$@ $(DEF) $(OBJU) $(OBJU2) $(LDFLAGS2) + +funzip.exe: $(OBJF) $(OBJF2) + $(CC) $(LDFLAGS)$@ $(DEF) $(OBJF) $(OBJF2) $(LDFLAGS2) + +unzipsfx.exe: $(OBJX) $(OBJX2) + $(CC) $(LDFLAGS)$@ $(DEF) $(OBJX) $(OBJX2) $(LDFLAGS2) + +unzip32.dll: $(DLLDEF) $(OBJU) $(OBJU2) $(OBJDLL) + $(CC) $(DLLFLAG) $(LDFLAGS)$@ $(DLLDEF) $(OBJU) $(OBJDLL) $(OBJU2) $(APILIB) $(LDFLAGS2) + +unzip.stb: unzipstb$(OBJ) $(STUBDEF) + $(CC) $(LDFLAGS)$@ $(STUBDEF) unzipstb$(OBJ) $(LDFLAGS2) + copy unzip.stb unzip.exe + +# dependencies + +apihelp$(OBJ): apihelp.c $(UNZIP_H) version.h +crc32$(OBJ): crc32.c $(UNZIP_H) zip.h +crctab$(OBJ): crctab.c $(UNZIP_H) zip.h +envargs$(OBJ): envargs.c $(UNZIP_H) +explode$(OBJ): explode.c $(UNZIP_H) +extract$(OBJ): extract.c $(UNZIP_H) crypt.h +fileio$(OBJ): fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h +globals$(OBJ): globals.c $(UNZIP_H) +inflate$(OBJ): inflate.c $(UNZIP_H) +list$(OBJ): list.c $(UNZIP_H) +match$(OBJ): match.c $(UNZIP_H) +process$(OBJ): process.c $(UNZIP_H) +ttyio$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h +unreduce$(OBJ): unreduce.c $(UNZIP_H) +unshrink$(OBJ): unshrink.c $(UNZIP_H) +unzip$(OBJ): unzip.c $(UNZIP_H) crypt.h version.h consts.h +api$(OBJ): api.c $(UNZIP_H) version.h +zipinfo$(OBJ): zipinfo.c $(UNZIP_H) + +funzip$(OBJ): funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h # funzip only + $(CC) -c $(CFLAGS) funzip.c + +unzipstb$(OBJ): unzipstb.c # DLL version + $(CC) -c $(CFLAGS) unzipstb.c + +msdos$(OBJ): msdos/msdos.c $(UNZIP_H) version.h # DOS only + $(CC) -c $(CFLAGS) msdos$(DIRSEP)msdos.c + +msdos_$(OBJ): msdos/msdos.c $(UNZIP_H) # DOS unzipsfx + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ msdos$(DIRSEP)msdos.c + +win32$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h version.h # Win32 only + $(CC) -c $(CFLAGS) win32$(DIRSEP)win32.c + +nt$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h # Win32 only + $(CC) -c $(CFLAGS) win32$(DIRSEP)nt.c + +win32_$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h # Win32 unzipsfx + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ win32$(DIRSEP)win32.c + +nt_$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h # Win32 unzipsfx + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ win32$(DIRSEP)nt.c + +win32f$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h # Win32 funzip + $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ win32$(DIRSEP)win32.c + +os2$(OBJ): os2/os2.c $(UNZIP_H) version.h # OS/2 only + $(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)os2.c + +os2_$(OBJ): os2/os2.c $(UNZIP_H) # OS/2 unzipsfx + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ os2$(DIRSEP)os2.c + +os2acl$(OBJ): os2/os2acl.c $(UNZIP_H) version.h # OS/2 only + $(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)os2acl.c + +os2acl_$(OBJ): os2/os2acl.c $(UNZIP_H) version.h # OS/2 unzipsfx + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ os2$(DIRSEP)os2acl.c + +rexxhelp$(OBJ): os2/rexxhelp.c # OS/2 DLL only + $(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)rexxhelp.c + +rexxapi$(OBJ): os2/rexxapi.c # OS/2 DLL only + $(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)rexxapi.c + +crc_i86$(OBJ): msdos/crc_i86.asm # 16bit only + $(AS) $(ASFLAGS) msdos$(AS_DIRSEP)crc_i86.asm $(ASEOL) + +crc_i386$(OBJ): win32/crc_i386.asm # 32bit, MASM + $(AS) $(ASFLAGS) win32$(AS_DIRSEP)crc_i386.asm $(ASEOL) + +crc_gcc$(OBJ): crc_i386.S # 32bit, GNU AS + $(AS) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S + +# NFLAGS are solely used as work-around for optimization bug in IBM C++ Set +crypt$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h + $(CC) -c $(CFLAGS) $(DLLFLAG) $(NFLAGS) crypt.c + +cryptf$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h # funzip only + $(CC) -c $(CFLAGS) $(NFLAGS) -DFUNZIP $(OUT)$@ crypt.c + +crc32f$(OBJ): crc32.c $(UNZIP_H) zip.h # funzip only + $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ crc32.c + +globalsf$(OBJ): globals.c $(UNZIP_H) # funzip only + $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ globals.c + +inflatef$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h # funzip only + $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ inflate.c + +ttyiof$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h # funzip only + $(CC) -c $(CFLAGS) $(NFLAGS) -DFUNZIP $(OUT)$@ ttyio.c + +crc32_$(OBJ): crc32.c $(UNZIP_H) zip.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crc32.c + +crctab_$(OBJ): crctab.c $(UNZIP_H) zip.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crctab.c + +crypt_$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crypt.c + +extract_$(OBJ): extract.c $(UNZIP_H) crypt.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ extract.c + +fileio_$(OBJ): fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ fileio.c + +globals_$(OBJ): globals.c $(UNZIP_H) # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ globals.c + +inflate_$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ inflate.c + +match_$(OBJ): match.c $(UNZIP_H) # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ match.c + +process_$(OBJ): process.c $(UNZIP_H) # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ process.c + +ttyio_$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ ttyio.c + +unzipsf_$(OBJ): unzip.c $(UNZIP_H) crypt.h version.h consts.h # unzipsfx only + $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ unzip.c diff --git a/utils/Install/sfxzip/match.c b/utils/Install/sfxzip/match.c new file mode 100644 index 0000000000..77355d4400 --- /dev/null +++ b/utils/Install/sfxzip/match.c @@ -0,0 +1,294 @@ +/*--------------------------------------------------------------------------- + + match.c + + The match() routine recursively compares a string to a "pattern" (regular + expression), returning TRUE if a match is found or FALSE if not. This + version is specifically for use with unzip.c: as did the previous match() + routines from SEA and J. Kercheval, it leaves the case (upper, lower, or + mixed) of the string alone, but converts any uppercase characters in the + pattern to lowercase if indicated by the global var pInfo->lcflag (which + is to say, string is assumed to have been converted to lowercase already, + if such was necessary). + + GRR: reversed order of text, pattern in matche() (now same as match()); + added ignore_case/ic flags, Case() macro. + + PaulK: replaced matche() with recmatch() from Zip, modified to have an + ignore_case argument; replaced test frame with simpler one. + + --------------------------------------------------------------------------- + + Copyright on recmatch() from Zip's util.c (although recmatch() was almost + certainly written by Mark Adler...ask me how I can tell :-) ): + + Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly, + Kai Uwe Rommel and Igor Mandrichenko. + + Permission is granted to any individual or institution to use, copy, + or redistribute this software so long as all of the original files are + included unmodified, that it is not sold for profit, and that this copy- + right notice is retained. + + --------------------------------------------------------------------------- + + Match the pattern (wildcard) against the string (fixed): + + match(string, pattern, ignore_case); + + returns TRUE if string matches pattern, FALSE otherwise. In the pattern: + + `*' matches any sequence of characters (zero or more) + `?' matches any single character + [SET] matches any character in the specified set, + [!SET] or [^SET] matches any character not in the specified set. + + A set is composed of characters or ranges; a range looks like ``character + hyphen character'' (as in 0-9 or A-Z). [0-9a-zA-Z_] is the minimal set of + characters allowed in the [..] pattern construct. Other characters are + allowed (i.e., 8-bit characters) if your system will support them. + + To suppress the special syntactic significance of any of ``[]*?!^-\'', in- + side or outside a [..] construct, and match the character exactly, precede + it with a ``\'' (backslash). + + Note that "*.*" and "*." are treated specially under MS-DOS if DOSWILD is + defined. See the DOSWILD section below for an explanation. Note also + that with VMSWILD defined, '%' is used instead of '?', and sets (ranges) + are delimited by () instead of []. + + ---------------------------------------------------------------------------*/ + + + +/* define ToLower() in here (for Unix, define ToLower to be macro (using + * isupper()); otherwise just use tolower() */ +#define UNZIP_INTERNAL +#include "unzip.h" + +#if 0 /* this is not useful until it matches Amiga names insensitively */ +#ifdef AMIGA /* some other platforms might also want to use this */ +# define ANSI_CHARSET /* MOVE INTO UNZIP.H EVENTUALLY */ +#endif +#endif /* 0 */ + +#ifdef ANSI_CHARSET +# ifdef ToLower +# undef ToLower +# endif + /* uppercase letters are values 41 thru 5A, C0 thru D6, and D8 thru DE */ +# define IsUpper(c) (c>=0xC0 ? c<=0xDE && c!=0xD7 : c>=0x41 && c<=0x5A) +# define ToLower(c) (IsUpper((uch) c) ? (unsigned) c | 0x20 : (unsigned) c) +#endif +#define Case(x) (ic? ToLower(x) : (x)) + +#ifdef VMSWILD +# define WILDCHAR '%' +# define BEG_RANGE '(' +# define END_RANGE ')' +#else +# define WILDCHAR '?' +# define BEG_RANGE '[' +# define END_RANGE ']' +#endif + +#if 0 /* GRR: add this to unzip.h someday... */ +#if !(defined(MSDOS) && defined(DOSWILD)) +#define match(s,p,ic) (recmatch((ZCONST uch *)p,(ZCONST uch *)s,ic) == 1) +int recmatch OF((ZCONST uch *pattern, ZCONST uch *string, int ignore_case)); +#endif +#endif /* 0 */ +static int recmatch OF((ZCONST uch *pattern, ZCONST uch *string, + int ignore_case)); + + + +/* match() is a shell to recmatch() to return only Boolean values. */ + +int match(string, pattern, ignore_case) + ZCONST char *string, *pattern; + int ignore_case; +{ +#if (defined(MSDOS) && defined(DOSWILD)) + char *dospattern; + int j = strlen(pattern); + +/*--------------------------------------------------------------------------- + Optional MS-DOS preprocessing section: compare last three chars of the + wildcard to "*.*" and translate to "*" if found; else compare the last + two characters to "*." and, if found, scan the non-wild string for dots. + If in the latter case a dot is found, return failure; else translate the + "*." to "*". In either case, continue with the normal (Unix-like) match + procedure after translation. (If not enough memory, default to normal + match.) This causes "a*.*" and "a*." to behave as MS-DOS users expect. + ---------------------------------------------------------------------------*/ + + if ((dospattern = (char *)malloc(j+1)) != NULL) { + strcpy(dospattern, pattern); + if (!strcmp(dospattern+j-3, "*.*")) { + dospattern[j-2] = '\0'; /* nuke the ".*" */ + } else if (!strcmp(dospattern+j-2, "*.")) { + char *p = strchr(string, '.'); + + if (p) { /* found a dot: match fails */ + free(dospattern); + return 0; + } + dospattern[j-1] = '\0'; /* nuke the end "." */ + } + j = recmatch((uch *)dospattern, (uch *)string, ignore_case); + free(dospattern); + return j == 1; + } else +#endif /* MSDOS && DOSWILD */ + return recmatch((uch *)pattern, (uch *)string, ignore_case) == 1; +} + + + +static int recmatch(p, s, ic) + ZCONST uch *p; /* sh pattern to match */ + ZCONST uch *s; /* string to which to match it */ + int ic; /* true for case insensitivity */ +/* Recursively compare the sh pattern p with the string s and return 1 if + * they match, and 0 or 2 if they don't or if there is a syntax error in the + * pattern. This routine recurses on itself no more deeply than the number + * of characters in the pattern. */ +{ + unsigned int c; /* pattern char or start of range in [-] loop */ + + /* Get first character, the pattern for new recmatch calls follows */ + c = *p++; + + /* If that was the end of the pattern, match if string empty too */ + if (c == 0) + return *s == 0; + + /* '?' (or '%') matches any character (but not an empty string) */ + if (c == WILDCHAR) + return *s ? recmatch(p, s + 1, ic) : 0; + + /* '*' matches any number of characters, including zero */ +#ifdef AMIGA + if (c == '#' && *p == '?') /* "#?" is Amiga-ese for "*" */ + c = '*', p++; +#endif /* AMIGA */ + if (c == '*') { + if (*p == 0) + return 1; + for (; *s; s++) + if ((c = recmatch(p, s, ic)) != 0) + return (int)c; + return 2; /* 2 means give up--match will return false */ + } + + /* Parse and process the list of characters and ranges in brackets */ + if (c == BEG_RANGE) { + int e; /* flag true if next char to be taken literally */ + ZCONST uch *q; /* pointer to end of [-] group */ + int r; /* flag true to match anything but the range */ + + if (*s == 0) /* need a character to match */ + return 0; + p += (r = (*p == '!' || *p == '^')); /* see if reverse */ + for (q = p, e = 0; *q; q++) /* find closing bracket */ + if (e) + e = 0; + else + if (*q == '\\') /* GRR: change to ^ for MS-DOS, OS/2? */ + e = 1; + else if (*q == END_RANGE) + break; + if (*q != END_RANGE) /* nothing matches if bad syntax */ + return 0; + for (c = 0, e = *p == '-'; p < q; p++) { /* go through the list */ + if (e == 0 && *p == '\\') /* set escape flag if \ */ + e = 1; + else if (e == 0 && *p == '-') /* set start of range if - */ + c = *(p-1); + else { + unsigned int cc = Case(*s); + + if (*(p+1) != '-') + for (c = c ? c : *p; c <= *p; c++) /* compare range */ + if ((unsigned)Case(c) == cc) /* typecast for MSC bug */ + return r ? 0 : recmatch(q + 1, s + 1, ic); + c = e = 0; /* clear range, escape flags */ + } + } + return r ? recmatch(q + 1, s + 1, ic) : 0; /* bracket match failed */ + } + + /* if escape ('\'), just compare next character */ + if (c == '\\' && (c = *p++) == 0) /* if \ at end, then syntax error */ + return 0; + + /* just a character--compare it */ +#ifdef QDOS + return QMatch(Case((uch)c), Case(*s)) ? recmatch(p, ++s, ic) : 0; +#else + return Case((uch)c) == Case(*s) ? recmatch(p, ++s, ic) : 0; +#endif + +} /* end function recmatch() */ + + + + + +int iswild(p) /* originally only used for stat()-bug workaround in */ + ZCONST char *p; /* VAX C, Turbo/Borland C, Watcom C, Atari MiNT libs; */ +{ /* now used in process_zipfiles() as well */ + for (; *p; ++p) + if (*p == '\\' && *(p+1)) + ++p; +#ifdef VMS + else if (*p == '%' || *p == '*') +#else /* !VMS */ +#ifdef AMIGA + else if (*p == '?' || *p == '*' || (*p=='#' && p[1]=='?') || *p == '[') +#else /* !AMIGA */ + else if (*p == '?' || *p == '*' || *p == '[') +#endif /* ?AMIGA */ +#endif /* ?VMS */ +#ifdef QDOS + return (int)p; +#else + return TRUE; +#endif + + return FALSE; + +} /* end function iswild() */ + + + + + +#ifdef TEST_MATCH + +#define put(s) {fputs(s,stdout); fflush(stdout);} + +void main() +{ + char pat[256], str[256]; + + for (;;) { + put("Pattern (return to exit): "); + gets(pat); + if (!pat[0]) + break; + for (;;) { + put("String (return for new pattern): "); + gets(str); + if (!str[0]) + break; + pipeit("Case sensitive: %s insensitive: %s\n", + match(str, pat, 0) ? "YES" : "NO", + match(str, pat, 1) ? "YES" : "NO"); + } + } + EXIT(0); +} + +#endif /* TEST_MATCH */ diff --git a/utils/Install/sfxzip/nt.c b/utils/Install/sfxzip/nt.c new file mode 100644 index 0000000000..ab4cea3a9f --- /dev/null +++ b/utils/Install/sfxzip/nt.c @@ -0,0 +1,659 @@ +/* + + Copyright (c) 1996 Scott Field + + Module Name: + + nt.c + + Abstract: + + This module implements WinNT security descriptor operations for the + Win32 Info-ZIP project. Operation such as setting file security, + using/querying local and remote privileges, and queuing of operations + is performed here. The contents of this module are only relevant + when the code is running on Windows NT, and the target volume supports + persistent Acl storage. + + User privileges that allow accessing certain privileged aspects of the + security descriptor (such as the Sacl) are only used if the user specified + to do so. + + Author: + + Scott Field (sfield@microsoft.com) + + Last revised: 18 Jan 97 + + */ + +#define WIN32_LEAN_AND_MEAN +#define UNZIP_INTERNAL +#include "unzip.h" +#include <windows.h> +#ifdef __RSXNT__ +# include "rsxntwin.h" +#endif +#include "nt.h" + + +#ifdef NTSD_EAS /* This file is only needed for NTSD handling */ + +/* Borland C++ does not define FILE_SHARE_DELETE. Others also? */ +#ifndef FILE_SHARE_DELETE +# define FILE_SHARE_DELETE 0x00000004 +#endif + + +/* private prototypes */ + +static BOOL Initialize(VOID); +#if 0 /* currently unused */ +static BOOL Shutdown(VOID); +#endif +static BOOL DeferSet(char *resource, PVOLUMECAPS VolumeCaps, uch *buffer); +static VOID GetRemotePrivilegesSet(CHAR *FileName, PDWORD dwRemotePrivileges); +static VOID InitLocalPrivileges(VOID); + + +BOOL bInitialized = FALSE; /* module level stuff initialized? */ +HANDLE hInitMutex = NULL; /* prevent multiple initialization */ + +BOOL g_bRestorePrivilege = FALSE; /* for local set file security override */ +BOOL g_bSaclPrivilege = FALSE; /* for local set sacl operations, only when + restore privilege not present */ + +/* our single cached volume capabilities structure that describes the last + volume root we encountered. A single entry like this works well in the + zip/unzip scenario for a number of reasons: + 1. typically one extraction path during unzip. + 2. typically process one volume at a time during zip, and then move + on to the next. + 3. no cleanup code required and no memory leaks. + 4. simple code. + + This approach should be reworked to a linked list approach if we expect to + be called by many threads which are processing a variety of input/output + volumes, since lock contention and stale data may become a bottleneck. */ + +VOLUMECAPS g_VolumeCaps; +CRITICAL_SECTION VolumeCapsLock; + + +/* our deferred set structure linked list element, used for making a copy + of input data which is used at a later time to process the original input + at a time when it makes more sense. eg, applying security to newly created + directories, after all files have been placed in such directories. */ + +CRITICAL_SECTION SetDeferLock; + +typedef struct _DEFERRED_SET { + struct _DEFERRED_SET *Next; + uch *buffer; /* must point to DWORD aligned block */ + PVOLUMECAPS VolumeCaps; + char *resource; +} DEFERRED_SET, *PDEFERRED_SET, *LPDEFERRED_SET; + +PDEFERRED_SET pSetHead = NULL; +PDEFERRED_SET pSetTail; + +static BOOL Initialize(VOID) +{ + HANDLE hMutex; + HANDLE hOldMutex; + + if(bInitialized) return TRUE; + + hMutex = CreateMutex(NULL, TRUE, NULL); + if(hMutex == NULL) return FALSE; + + hOldMutex = (HANDLE)InterlockedExchange((LPLONG)&hInitMutex, (LONG)hMutex); + + if(hOldMutex != NULL) { + /* somebody setup the mutex already */ + InterlockedExchange((LPLONG)&hInitMutex, (LONG)hOldMutex); + + CloseHandle(hMutex); /* close new, un-needed mutex */ + + /* wait for initialization to complete and return status */ + WaitForSingleObject(hOldMutex, INFINITE); + ReleaseMutex(hOldMutex); + + return bInitialized; + } + + /* initialize module level resources */ + + InitializeCriticalSection( &SetDeferLock ); + + InitializeCriticalSection( &VolumeCapsLock ); + memset(&g_VolumeCaps, 0, sizeof(VOLUMECAPS)); + + InitLocalPrivileges(); + + bInitialized = TRUE; + + ReleaseMutex(hMutex); /* release correct mutex */ + + return TRUE; +} + +#if 0 /* currently not used ! */ +static BOOL Shutdown(VOID) +{ + /* really need to free critical sections, disable enabled privilges, etc, + but doing so brings up possibility of race conditions if those resources + are about to be used. The easiest way to handle this is let these + resources be freed when the process terminates... */ + + return TRUE; +} +#endif /* never */ + + +static BOOL DeferSet(char *resource, PVOLUMECAPS VolumeCaps, uch *buffer) +{ + PDEFERRED_SET psd; + DWORD cbDeferSet; + DWORD cbResource; + DWORD cbBuffer; + + if(!bInitialized) if(!Initialize()) return FALSE; + + cbResource = lstrlenA(resource) + 1; + cbBuffer = GetSecurityDescriptorLength((PSECURITY_DESCRIPTOR)buffer); + cbDeferSet = sizeof(DEFERRED_SET) + cbBuffer + sizeof(VOLUMECAPS) + + cbResource; + + psd = (PDEFERRED_SET)HeapAlloc(GetProcessHeap(), 0, cbDeferSet); + if(psd == NULL) return FALSE; + + psd->Next = NULL; + psd->buffer = (uch *)(psd+1); + psd->VolumeCaps = (PVOLUMECAPS)((char *)psd->buffer + cbBuffer); + psd->resource = (char *)((char *)psd->VolumeCaps + sizeof(VOLUMECAPS)); + + memcpy(psd->buffer, buffer, cbBuffer); + memcpy(psd->VolumeCaps, VolumeCaps, sizeof(VOLUMECAPS)); + psd->VolumeCaps->bProcessDefer = TRUE; + memcpy(psd->resource, resource, cbResource); + + /* take defer lock */ + EnterCriticalSection( &SetDeferLock ); + + /* add element at tail of list */ + + if(pSetHead == NULL) { + pSetHead = psd; + } else { + pSetTail->Next = psd; + } + + pSetTail = psd; + + /* release defer lock */ + LeaveCriticalSection( &SetDeferLock ); + + return TRUE; +} + +BOOL ProcessDefer(PDWORD dwDirectoryCount, PDWORD dwBytesProcessed, + PDWORD dwDirectoryFail, PDWORD dwBytesFail) +{ + PDEFERRED_SET This; + PDEFERRED_SET Next; + + *dwDirectoryCount = 0; + *dwBytesProcessed = 0; + + *dwDirectoryFail = 0; + *dwBytesFail = 0; + + if(!bInitialized) return TRUE; /* nothing to do */ + + EnterCriticalSection( &SetDeferLock ); + + This = pSetHead; + + while(This) { + + if(SecuritySet(This->resource, This->VolumeCaps, This->buffer)) { + (*dwDirectoryCount)++; + *dwBytesProcessed += + GetSecurityDescriptorLength((PSECURITY_DESCRIPTOR)This->buffer); + } else { + (*dwDirectoryFail)++; + *dwBytesFail += + GetSecurityDescriptorLength((PSECURITY_DESCRIPTOR)This->buffer); + } + + Next = This->Next; + HeapFree(GetProcessHeap(), 0, This); + This = Next; + } + + pSetHead = NULL; + + LeaveCriticalSection( &SetDeferLock ); + + return TRUE; +} + +BOOL ValidateSecurity(uch *securitydata) +{ + PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR)securitydata; + PACL pAcl; + PSID pSid; + BOOL bAclPresent; + BOOL bDefaulted; + + if(!IsWinNT()) return TRUE; /* don't do anything if not on WinNT */ + + if(!IsValidSecurityDescriptor(sd)) return FALSE; + + /* verify Dacl integrity */ + + if(!GetSecurityDescriptorDacl(sd, &bAclPresent, &pAcl, &bDefaulted)) + return FALSE; + + if(bAclPresent) { + if(!IsValidAcl(pAcl)) return FALSE; + } + + /* verify Sacl integrity */ + + if(!GetSecurityDescriptorSacl(sd, &bAclPresent, &pAcl, &bDefaulted)) + return FALSE; + + if(bAclPresent) { + if(!IsValidAcl(pAcl)) return FALSE; + } + + /* verify owner integrity */ + + if(!GetSecurityDescriptorOwner(sd, &pSid, &bDefaulted)) + return FALSE; + + if(pSid != NULL) { + if(!IsValidSid(pSid)) return FALSE; + } + + /* verify group integrity */ + + if(!GetSecurityDescriptorGroup(sd, &pSid, &bDefaulted)) + return FALSE; + + if(pSid != NULL) { + if(!IsValidSid(pSid)) return FALSE; + } + + return TRUE; +} + +static VOID GetRemotePrivilegesSet(char *FileName, PDWORD dwRemotePrivileges) +{ + HANDLE hFile; + + *dwRemotePrivileges = 0; + + /* see if we have the SeRestorePrivilege */ + + hFile = CreateFileA( + FileName, + ACCESS_SYSTEM_SECURITY | WRITE_DAC | WRITE_OWNER | READ_CONTROL, + FILE_SHARE_READ | FILE_SHARE_DELETE, /* no sd updating allowed here */ + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + NULL + ); + + if(hFile != INVALID_HANDLE_VALUE) { + /* no remote way to determine SeRestorePrivilege -- just try a + read/write to simulate it */ + SECURITY_INFORMATION si = DACL_SECURITY_INFORMATION | + SACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION; + PSECURITY_DESCRIPTOR sd; + DWORD cbBuf = 0; + + GetKernelObjectSecurity(hFile, si, NULL, cbBuf, &cbBuf); + + if(ERROR_INSUFFICIENT_BUFFER == GetLastError()) { + if((sd = HeapAlloc(GetProcessHeap(), 0, cbBuf)) != NULL) { + if(GetKernelObjectSecurity(hFile, si, sd, cbBuf, &cbBuf)) { + if(SetKernelObjectSecurity(hFile, si, sd)) + *dwRemotePrivileges |= OVERRIDE_RESTORE; + } + HeapFree(GetProcessHeap(), 0, sd); + } + } + + CloseHandle(hFile); + } else { + + /* see if we have the SeSecurityPrivilege */ + /* note we don't need this if we have SeRestorePrivilege */ + + hFile = CreateFileA( + FileName, + ACCESS_SYSTEM_SECURITY, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, /* max */ + NULL, + OPEN_EXISTING, + 0, + NULL + ); + + if(hFile != INVALID_HANDLE_VALUE) { + CloseHandle(hFile); + *dwRemotePrivileges |= OVERRIDE_SACL; + } + } +} + + +BOOL GetVolumeCaps( + char *rootpath, /* filepath, or NULL */ + char *name, /* filename associated with rootpath */ + PVOLUMECAPS VolumeCaps /* result structure describing capabilities */ + ) +{ + char TempRootPath[MAX_PATH + 1]; + DWORD cchTempRootPath = 0; + BOOL bSuccess = TRUE; /* assume success until told otherwise */ + + if(!bInitialized) if(!Initialize()) return FALSE; + + /* process the input path to produce a consistent path suitable for + compare operations and also suitable for certain picky Win32 API + that don't like forward slashes */ + + if(rootpath != NULL && rootpath[0] != '\0') { + DWORD i; + + cchTempRootPath = lstrlen(rootpath); + if(cchTempRootPath > MAX_PATH) return FALSE; + + /* copy input, converting forward slashes to back slashes as we go */ + + for(i = 0 ; i <= cchTempRootPath ; i++) { + if(rootpath[i] == '/') TempRootPath[i] = '\\'; + else TempRootPath[i] = rootpath[i]; + } + + /* check for UNC and Null terminate or append trailing \ as + appropriate */ + + /* possible valid UNCs we are passed follow: + \\machine\foo\bar (path is \\machine\foo\) + \\machine\foo (path is \\machine\foo\) + \\machine\foo\ + \\.\c$\ (FIXFIX: Win32API doesn't like this - GetComputerName()) + LATERLATER: handling mounted DFS drives in the future will require + slightly different logic which isn't available today. + This is required because directories can point at + different servers which have differing capabilities. + */ + + if(TempRootPath[0] == '\\' && TempRootPath[1] == '\\') { + DWORD slash = 0; + + for(i = 2 ; i < cchTempRootPath ; i++) { + if(TempRootPath[i] == '\\') { + slash++; + + if(slash == 2) { + i++; + TempRootPath[i] = '\0'; + cchTempRootPath = i; + break; + } + } + } + + /* if there was only one slash found, just tack another onto the + end */ + + if(slash == 1 && TempRootPath[cchTempRootPath] != '\\') { + TempRootPath[cchTempRootPath] = TempRootPath[0]; /* '\' */ + TempRootPath[cchTempRootPath+1] = '\0'; + cchTempRootPath++; + } + + } else { + + if(TempRootPath[1] == ':') { + + /* drive letter specified, truncate to root */ + TempRootPath[2] = '\\'; + TempRootPath[3] = '\0'; + cchTempRootPath = 3; + } else { + + /* must be file on current drive */ + TempRootPath[0] = '\0'; + cchTempRootPath = 0; + } + + } + + } /* if path != NULL */ + + /* grab lock protecting cached entry */ + EnterCriticalSection( &VolumeCapsLock ); + + if(!g_VolumeCaps.bValid || + lstrcmpi(g_VolumeCaps.RootPath, TempRootPath) != 0) + { + + /* no match found, build up new entry */ + + DWORD dwFileSystemFlags; + DWORD dwRemotePrivileges = 0; + BOOL bRemote = FALSE; + + /* release lock during expensive operations */ + LeaveCriticalSection( &VolumeCapsLock ); + + bSuccess = GetVolumeInformation( + (TempRootPath[0] == '\0') ? NULL : TempRootPath, + NULL, 0, + NULL, NULL, + &dwFileSystemFlags, + NULL, 0); + + + /* only if target volume supports Acls, and we were told to use + privileges do we need to go out and test for the remote case */ + + if(bSuccess && (dwFileSystemFlags & FS_PERSISTENT_ACLS) && + VolumeCaps->bUsePrivileges) + { + if(GetDriveType( (TempRootPath[0] == '\0') ? NULL : TempRootPath ) + == DRIVE_REMOTE) + { + bRemote = TRUE; + + /* make a determination about our remote capabilities */ + + GetRemotePrivilegesSet(name, &dwRemotePrivileges); + } + } + + /* always take the lock again, since we release it below */ + EnterCriticalSection( &VolumeCapsLock ); + + /* replace the existing data if successful */ + if(bSuccess) { + + lstrcpynA(g_VolumeCaps.RootPath, TempRootPath, cchTempRootPath+1); + g_VolumeCaps.bProcessDefer = FALSE; + g_VolumeCaps.dwFileSystemFlags = dwFileSystemFlags; + g_VolumeCaps.bRemote = bRemote; + g_VolumeCaps.dwRemotePrivileges = dwRemotePrivileges; + g_VolumeCaps.bValid = TRUE; + } + } + + if(bSuccess) { + /* copy input elements */ + g_VolumeCaps.bUsePrivileges = VolumeCaps->bUsePrivileges; + g_VolumeCaps.dwFileAttributes = VolumeCaps->dwFileAttributes; + + /* give caller results */ + memcpy(VolumeCaps, &g_VolumeCaps, sizeof(VOLUMECAPS)); + } else { + g_VolumeCaps.bValid = FALSE; + } + + LeaveCriticalSection( &VolumeCapsLock ); /* release lock */ + + return bSuccess; +} + + +BOOL SecuritySet(char *resource, PVOLUMECAPS VolumeCaps, uch *securitydata) +{ + HANDLE hFile; + DWORD dwDesiredAccess = 0; + DWORD dwFlags = 0; + PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR)securitydata; + SECURITY_DESCRIPTOR_CONTROL sdc; + SECURITY_INFORMATION RequestedInfo = 0; + DWORD dwRev; + BOOL bRestorePrivilege = FALSE; + BOOL bSaclPrivilege = FALSE; + BOOL bSuccess; + + if(!bInitialized) if(!Initialize()) return FALSE; + + /* defer directory processing */ + + if(VolumeCaps->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + if(!VolumeCaps->bProcessDefer) { + return DeferSet(resource, VolumeCaps, securitydata); + } else { + /* opening a directory requires FILE_FLAG_BACKUP_SEMANTICS */ + dwFlags |= FILE_FLAG_BACKUP_SEMANTICS; + } + } + + /* evaluate the input security desriptor and act accordingly */ + + if(!IsValidSecurityDescriptor(sd)) + return FALSE; + + if(!GetSecurityDescriptorControl(sd, &sdc, &dwRev)) + return FALSE; + + /* setup privilege usage based on if told we can use privileges, and if so, + what privileges we have */ + + if(VolumeCaps->bUsePrivileges) { + if(VolumeCaps->bRemote) { + /* use remotely determined privileges */ + if(VolumeCaps->dwRemotePrivileges & OVERRIDE_RESTORE) + bRestorePrivilege = TRUE; + + if(VolumeCaps->dwRemotePrivileges & OVERRIDE_SACL) + bSaclPrivilege = TRUE; + + } else { + /* use local privileges */ + bRestorePrivilege = g_bRestorePrivilege; + bSaclPrivilege = g_bSaclPrivilege; + } + } + + + /* if a Dacl is present write Dacl out */ + /* if we have SeRestorePrivilege, write owner and group info out */ + + if(sdc & SE_DACL_PRESENT) { + dwDesiredAccess |= WRITE_DAC; + RequestedInfo |= DACL_SECURITY_INFORMATION; + + if(bRestorePrivilege) { + dwDesiredAccess |= WRITE_OWNER; + RequestedInfo |= (OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION); + } + } + + /* if a Sacl is present and we have either SeRestorePrivilege or + SeSystemSecurityPrivilege try to write Sacl out */ + + if((sdc & SE_SACL_PRESENT) && (bRestorePrivilege || bSaclPrivilege)) { + dwDesiredAccess |= ACCESS_SYSTEM_SECURITY; + RequestedInfo |= SACL_SECURITY_INFORMATION; + } + + if(RequestedInfo == 0) /* nothing to do */ + return FALSE; + + if(bRestorePrivilege) + dwFlags |= FILE_FLAG_BACKUP_SEMANTICS; + + hFile = CreateFileA( + resource, + dwDesiredAccess, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,/* max sharing */ + NULL, + OPEN_EXISTING, + dwFlags, + NULL + ); + + if(hFile == INVALID_HANDLE_VALUE) + return FALSE; + + bSuccess = SetKernelObjectSecurity(hFile, RequestedInfo, sd); + + CloseHandle(hFile); + + return bSuccess; +} + +static VOID InitLocalPrivileges(VOID) +{ + HANDLE hToken; + TOKEN_PRIVILEGES tp; + + /* try to enable some interesting privileges that give us the ability + to get some security information that we normally cannot. + + note that enabling privileges is only relevant on the local machine; + when accessing files that are on a remote machine, any privileges + that are present on the remote machine get enabled by default. */ + + if(!OpenProcessToken(GetCurrentProcess(), + TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &hToken)) + return; + + tp.PrivilegeCount = 1; + tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + + if(LookupPrivilegeValue(NULL, SE_RESTORE_NAME, &tp.Privileges[0].Luid)) { + + /* try to enable SeRestorePrivilege; if this succeeds, we can write + all aspects of the security descriptor */ + + if(AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL) && + GetLastError() == ERROR_SUCCESS) g_bRestorePrivilege = TRUE; + + } + + /* try to enable SeSystemSecurityPrivilege, if SeRestorePrivilege not + present; if this succeeds, we can write the Sacl */ + + if(!g_bRestorePrivilege && + LookupPrivilegeValue(NULL, SE_SECURITY_NAME, &tp.Privileges[0].Luid)) { + + if(AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL) && + GetLastError() == ERROR_SUCCESS) g_bSaclPrivilege = TRUE; + } + + CloseHandle(hToken); +} +#endif /* NTSD_EAS */ diff --git a/utils/Install/sfxzip/os2.c b/utils/Install/sfxzip/os2.c new file mode 100644 index 0000000000..a9a962796c --- /dev/null +++ b/utils/Install/sfxzip/os2.c @@ -0,0 +1,2187 @@ +/*--------------------------------------------------------------------------- + + os2.c + + OS/2-specific routines for use with Info-ZIP's UnZip 5.1 and later. + + This file contains the OS/2 versions of the file name/attribute/time/etc + code. Most or all of the routines which make direct use of OS/2 system + calls (i.e., the non-lowercase routines) are Kai Uwe Rommel's. The read- + dir() suite was written by Michael Rendell and ported to OS/2 by Kai Uwe; + it is in the public domain. + + Contains: GetCountryInfo() + GetFileTime() + SetFileTime() (TIMESTAMP only) + stamp_file() (TIMESTAMP only) + Utime2DosDateTime() + SetPathAttrTimes() + SetEAs() + GetLoadPath() + opendir() + closedir() + readdir() + [ seekdir() ] not used + [ telldir() ] not used + free_dircontents() + getdirent() + IsFileSystemFAT() + do_wild() + mapattr() + mapname() + checkdir() + isfloppy() + IsFileNameValid() + map2fat() + SetLongNameEA() + close_outfile() + check_for_newer() + dateformat() + version() + InitNLS() + IsUpperNLS() + ToLowerNLS() + StringLower() + DebugMalloc() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" +#include "os2acl.h" + +extern ZCONST char Far TruncEAs[]; + +/* local prototypes */ + +#ifdef TIMESTAMP + static int SetFileTime(ZCONST char *name, ulg stamp); +#endif +#if defined(USE_EF_UT_TIME) || defined(TIMESTAMP) + static ulg Utime2DosDateTime OF((time_t uxtime)); +#endif +static int getOS2filetimes OF((__GPRO__ + ulg *pM_dt, ulg *pA_dt, ulg *pC_dt)); +static void SetPathAttrTimes OF((__GPRO__ int flags, int dir)); +static int SetEAs OF((__GPRO__ const char *path, + void *ef_block)); +static int SetACL OF((__GPRO__ const char *path, + void *ef_block)); +static int EvalExtraFields OF((__GPRO__ const char *path, + void *extra_field, unsigned ef_len)); +static int isfloppy OF((int nDrive)); +static int IsFileNameValid OF((const char *name)); +static void map2fat OF((char *pathcomp, char **pEndFAT)); +static int SetLongNameEA OF((char *name, char *longname)); +static void InitNLS OF((void)); + + +/*****************************/ +/* Strings used in os2.c */ +/*****************************/ + +#ifndef SFX + static char Far CantAllocateWildcard[] = + "warning: cannot allocate wildcard buffers\n"; +#endif +static char Far Creating[] = " creating: %-22s "; +static char Far ConversionFailed[] = "mapname: conversion of %s failed\n"; +static char Far Labelling[] = "labelling %c: %-22s\n"; +static char Far ErrSetVolLabel[] = "mapname: error setting volume label\n"; +static char Far PathTooLong[] = "checkdir error: path too long: %s\n"; +static char Far CantCreateDir[] = "checkdir error: cannot create %s\n\ + unable to process %s.\n"; +static char Far DirIsntDirectory[] = + "checkdir error: %s exists but is not directory\n\ + unable to process %s.\n"; +static char Far PathTooLongTrunc[] = + "checkdir warning: path too long; truncating\n %s\n\ + -> %s\n"; +#if (!defined(SFX) || defined(SFX_EXDIR)) + static char Far CantCreateExtractDir[] = + "checkdir: cannot create extraction directory: %s\n"; +#endif + +#ifndef __EMX__ +# if (_MSC_VER >= 600) || defined(__IBMC__) +# include <direct.h> /* have special MSC/IBM C mkdir prototype */ +# else /* own prototype because dir.h conflicts? */ + int mkdir(const char *path); +# endif +# define MKDIR(path,mode) mkdir(path) +#else +# define MKDIR(path,mode) mkdir(path,mode) +#endif + + +#ifdef __32BIT__ + +USHORT DosDevIOCtl32(PVOID pData, USHORT cbData, PVOID pParms, USHORT cbParms, + USHORT usFunction, USHORT usCategory, HFILE hDevice) +{ + ULONG ulParmLengthInOut = cbParms, ulDataLengthInOut = cbData; + return (USHORT) DosDevIOCtl(hDevice, usCategory, usFunction, + pParms, cbParms, &ulParmLengthInOut, + pData, cbData, &ulDataLengthInOut); +} + +# define DosDevIOCtl DosDevIOCtl32 +#else +# define DosDevIOCtl DosDevIOCtl2 +#endif + + +typedef struct +{ + ush nID; + ush nSize; + ulg lSize; +} +EFHEADER, *PEFHEADER; + + +#ifdef __32BIT__ + +#define DosFindFirst(p1, p2, p3, p4, p5, p6) \ + DosFindFirst(p1, p2, p3, p4, p5, p6, 1) + +#else + +typedef struct +{ + ULONG oNextEntryOffset; + BYTE fEA; + BYTE cbName; + USHORT cbValue; + CHAR szName[1]; +} +FEA2, *PFEA2; + +typedef struct +{ + ULONG cbList; + FEA2 list[1]; +} +FEA2LIST, *PFEA2LIST; + +#define DosQueryCurrentDisk DosQCurDisk +#define DosQueryFSAttach(p1, p2, p3, p4, p5) \ + DosQFSAttach(p1, p2, p3, p4, p5, 0) +#define DosEnumAttribute(p1, p2, p3, p4, p5, p6, p7) \ + DosEnumAttribute(p1, p2, p3, p4, p5, p6, p7, 0) +#define DosFindFirst(p1, p2, p3, p4, p5, p6) \ + DosFindFirst(p1, p2, p3, p4, p5, p6, 0) +#define DosMapCase DosCaseMap +#define DosSetPathInfo(p1, p2, p3, p4, p5) \ + DosSetPathInfo(p1, p2, p3, p4, p5, 0) +#define DosQueryPathInfo(p1, p2, p3, p4) \ + DosQPathInfo(p1, p2, p3, p4, 0) +#define DosQueryFileInfo DosQFileInfo +#define DosMapCase DosCaseMap +#define DosQueryCtryInfo DosGetCtryInfo + +#endif /* !__32BIT__ */ + + + + + +/* + * @(#) dir.h 1.4 87/11/06 Public Domain. + */ + +#define A_RONLY 0x01 +#define A_HIDDEN 0x02 +#define A_SYSTEM 0x04 +#define A_LABEL 0x08 +#define A_DIR 0x10 +#define A_ARCHIVE 0x20 + + +const int attributes = A_DIR | A_HIDDEN | A_SYSTEM; + + +extern DIR *opendir(__GPRO__ ZCONST char *); +extern struct direct *readdir(__GPRO__ DIR *); +extern void seekdir(DIR *, long); +extern long telldir(DIR *); +extern void closedir(DIR *); +#define rewinddir(dirp) seekdir(dirp, 0L) + +int IsFileSystemFAT(__GPRO__ ZCONST char *dir); +char *StringLower(char *szArg); + + + + +/* + * @(#)dir.c 1.4 87/11/06 Public Domain. + */ + + +#ifndef S_IFMT +# define S_IFMT 0xF000 +#endif + + +#ifndef SFX + static char *getdirent(__GPRO__ ZCONST char *); + static void free_dircontents(struct _dircontents *); +#endif /* !SFX */ + + + + +int GetCountryInfo(void) +{ + COUNTRYINFO ctryi; + COUNTRYCODE ctryc; +#ifdef __32BIT__ + ULONG cbInfo; +#else + USHORT cbInfo; +#endif + + ctryc.country = ctryc.codepage = 0; + + if ( DosQueryCtryInfo(sizeof(ctryi), &ctryc, &ctryi, &cbInfo) != NO_ERROR ) + return 0; + + return ctryi.fsDateFmt; +} + + +long GetFileTime(ZCONST char *name) +{ +#ifdef __32BIT__ + FILESTATUS3 fs; +#else + FILESTATUS fs; +#endif + USHORT nDate, nTime; + + if ( DosQueryPathInfo((PSZ) name, 1, (PBYTE) &fs, sizeof(fs)) ) + return -1; + + nDate = * (USHORT *) &fs.fdateLastWrite; + nTime = * (USHORT *) &fs.ftimeLastWrite; + + return ((ULONG) nDate) << 16 | nTime; +} + + +#ifdef TIMESTAMP + +static int SetFileTime(ZCONST char *name, ulg stamp) /* swiped from Zip */ +{ + FILESTATUS fs; + USHORT fd, ft; + + if (DosQueryPathInfo((PSZ) name, FIL_STANDARD, (PBYTE) &fs, sizeof(fs))) + return -1; + + fd = (USHORT) (stamp >> 16); + ft = (USHORT) stamp; + fs.fdateLastWrite = fs.fdateCreation = * (FDATE *) &fd; + fs.ftimeLastWrite = fs.ftimeCreation = * (FTIME *) &ft; + + if (DosSetPathInfo((PSZ) name, FIL_STANDARD, (PBYTE) &fs, sizeof(fs), 0)) + return -1; + + return 0; +} + + +int stamp_file(ZCONST char *fname, time_t modtime) +{ + return SetFileTime(fname, Utime2DosDateTime(modtime)); +} + +#endif /* TIMESTAMP */ + + +/* The following DOS date/time structures are machine-dependent as they + * assume "little-endian" byte order. For OS/2-specific code, which + * is run on x86 CPUs (or emulators?), this assumption is valid; but + * care should be taken when using this code as template for other ports. + */ +typedef union { + ULONG timevalue; /* combined value, useful for comparisons */ + struct { + FTIME ft; /* system file time record: + * USHORT twosecs : 5 + * USHORT minutes : 6; + * USHORT hours : 5; */ + FDATE fd; /* system file date record: + * USHORT day : 5 + * USHORT month : 4; + * USHORT year : 7; */ + } _fdt; +} F_DATE_TIME, *PF_DATE_TIME; + + +#if defined(USE_EF_UT_TIME) || defined(TIMESTAMP) + +static ulg Utime2DosDateTime(uxtime) + time_t uxtime; +{ + F_DATE_TIME dosfiletime; + struct tm *t; + + /* round up to even seconds */ + /* round up (down if "up" overflows) to even seconds */ + if (((ulg)uxtime) & 1) + uxtime = (uxtime + 1 > uxtime) ? uxtime + 1 : uxtime - 1; + + t = localtime(&(uxtime)); + if (t == (struct tm *)NULL) { + /* time conversion error; use current time instead, hoping + that localtime() does not reject it as well! */ + time_t now = time(NULL); + t = localtime(&now); + } + if (t->tm_year < 80) { + dosfiletime._fdt.ft.twosecs = 0; + dosfiletime._fdt.ft.minutes = 0; + dosfiletime._fdt.ft.hours = 0; + dosfiletime._fdt.fd.day = 1; + dosfiletime._fdt.fd.month = 1; + dosfiletime._fdt.fd.year = 0; + } else { + dosfiletime._fdt.ft.twosecs = t->tm_sec >> 1; + dosfiletime._fdt.ft.minutes = t->tm_min; + dosfiletime._fdt.ft.hours = t->tm_hour; + dosfiletime._fdt.fd.day = t->tm_mday; + dosfiletime._fdt.fd.month = t->tm_mon + 1; + dosfiletime._fdt.fd.year = t->tm_year - 80; + } + return dosfiletime.timevalue; + +} /* end function Utime2DosDateTime() */ + +#endif /* USE_EF_UT_TIME || TIMESTAMP */ + + +static int getOS2filetimes(__GPRO__ ulg *pM_dt, ulg *pA_dt, ulg *pC_dt) +{ +#ifdef USE_EF_UT_TIME + unsigned eb_izux_flg; + iztimes z_utime; +#endif + + /* Copy and/or convert time and date variables, if necessary; */ + /* return a flag indicating which time stamps are available. */ +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + ((eb_izux_flg = ef_scan_for_izux(G.extra_field, + G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime, + &z_utime, NULL)) & EB_UT_FL_MTIME)) + { + TTrace((stderr, "getOS2filetimes: UT e.f. modif. time = %lu\n", + z_utime.mtime)); + *pM_dt = Utime2DosDateTime(z_utime.mtime); + if (eb_izux_flg & EB_UT_FL_ATIME) { + TTrace((stderr, "getOS2filetimes: UT e.f. access time = %lu\n", + z_utime.atime)); + *pA_dt = Utime2DosDateTime(z_utime.atime); + } + if (eb_izux_flg & EB_UT_FL_CTIME) { + TTrace((stderr, "getOS2filetimes: UT e.f. creation time = %lu\n", + z_utime.ctime)); + *pC_dt = Utime2DosDateTime(z_utime.ctime); + } else { + /* no creation time value supplied, set it to modification time */ + *pC_dt = *pM_dt; + eb_izux_flg |= EB_UT_FL_CTIME; + } + return (int)eb_izux_flg; + } +#endif /* USE_EF_UT_TIME */ + *pC_dt = *pM_dt = G.lrec.last_mod_dos_datetime; + TTrace((stderr, "\ngetOS2filetimes: DOS dir modific./creation time = %lu\n", + *pM_dt)); + return (EB_UT_FL_MTIME | EB_UT_FL_CTIME); +} + + +static void SetPathAttrTimes(__GPRO__ int flags, int dir) +{ + HFILE hFile; +#ifdef __32BIT__ + ULONG nAction; +#else + USHORT nAction; +#endif + FILESTATUS fs; + USHORT nLength; + char szName[CCHMAXPATH]; + ulg Mod_dt, Acc_dt, Cre_dt; + int gotTimes; + + strcpy(szName, G.filename); + nLength = strlen(szName); + if (szName[nLength - 1] == '/') + szName[nLength - 1] = 0; + + if (dir) + { + if ( DosQueryPathInfo(szName, FIL_STANDARD, (PBYTE) &fs, sizeof(fs)) ) + return; + } + else + { + /* for regular files, open them and operate on the file handle, to + work around certain network operating system bugs ... */ + + if ( DosOpen(szName, &hFile, &nAction, 0, 0, + OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW, + OPEN_SHARE_DENYREADWRITE | OPEN_ACCESS_READWRITE, 0) ) + return; + + if ( DosQueryFileInfo(hFile, FIL_STANDARD, (PBYTE) &fs, sizeof(fs)) ) + return; + } + + /* set date/time stamps */ + gotTimes = getOS2filetimes(__G__ &Mod_dt, &Acc_dt, &Cre_dt); + if (gotTimes & EB_UT_FL_MTIME) { + fs.fdateLastWrite = ((F_DATE_TIME *)&Mod_dt)->_fdt.fd; + fs.ftimeLastWrite = ((F_DATE_TIME *)&Mod_dt)->_fdt.ft; + } + if (gotTimes & EB_UT_FL_ATIME) { + fs.fdateLastAccess = ((F_DATE_TIME *)&Acc_dt)->_fdt.fd; + fs.ftimeLastAccess = ((F_DATE_TIME *)&Acc_dt)->_fdt.ft; + } + if (gotTimes & EB_UT_FL_CTIME) { + fs.fdateCreation = ((F_DATE_TIME *)&Cre_dt)->_fdt.fd; + fs.ftimeCreation = ((F_DATE_TIME *)&Cre_dt)->_fdt.ft; + } + + if ( flags != -1 ) + fs.attrFile = flags; /* hidden, system, archive, read-only */ + + if (dir) + { + DosSetPathInfo(szName, FIL_STANDARD, (PBYTE) &fs, sizeof(fs), 0); + } + else + { + DosSetFileInfo(hFile, FIL_STANDARD, (PBYTE) &fs, sizeof(fs)); + DosClose(hFile); + } +} + + +typedef struct +{ + ULONG cbList; /* length of value + 22 */ +#ifdef __32BIT__ + ULONG oNext; +#endif + BYTE fEA; /* 0 */ + BYTE cbName; /* length of ".LONGNAME" = 9 */ + USHORT cbValue; /* length of value + 4 */ + BYTE szName[10]; /* ".LONGNAME" */ + USHORT eaType; /* 0xFFFD for length-preceded ASCII */ + USHORT eaSize; /* length of value */ + BYTE szValue[CCHMAXPATH]; +} +FEALST; + + +static int SetEAs(__GPRO__ const char *path, void *ef_block) +{ /* returns almost-PK errors */ + EFHEADER *pEAblock = (PEFHEADER) ef_block; +#ifdef __32BIT__ + EAOP2 eaop; + PFEA2LIST pFEA2list; +#else + EAOP eaop; + PFEALIST pFEAlist; + PFEA pFEA; + PFEA2LIST pFEA2list; + PFEA2 pFEA2; + ULONG nLength2; +#endif + USHORT nLength; + char szName[CCHMAXPATH]; + int error; + + if ( ef_block == NULL || pEAblock -> nID != EF_OS2 ) + return PK_OK; /* not an OS/2 extra field: assume OK */ + + if ( pEAblock->nSize < 4 || (pEAblock->lSize > 0L && pEAblock->nSize <= 10) ) + return IZ_EF_TRUNC; /* no compressed data! */ + + strcpy(szName, path); + nLength = strlen(szName); + if (szName[nLength - 1] == '/') + szName[nLength - 1] = 0; + + if ( (pFEA2list = (PFEA2LIST) malloc((size_t) pEAblock -> lSize)) == NULL ) + return PK_MEM4; + + if ( (error = memextract(__G__ (uch *)pFEA2list, pEAblock->lSize, + (uch *)(pEAblock+1), (ulg)(pEAblock->nSize - 4))) != PK_OK ) + { + free(pFEA2list); + return error; + } + +#ifdef __32BIT__ + eaop.fpGEA2List = NULL; + eaop.fpFEA2List = pFEA2list; +#else + pFEAlist = (PVOID) pFEA2list; + pFEA2 = pFEA2list -> list; + pFEA = pFEAlist -> list; + + do + { + nLength2 = pFEA2 -> oNextEntryOffset; + nLength = sizeof(FEA) + pFEA2 -> cbName + 1 + pFEA2 -> cbValue; + + memcpy(pFEA, (PCH) pFEA2 + sizeof(pFEA2 -> oNextEntryOffset), nLength); + + pFEA2 = (PFEA2) ((PCH) pFEA2 + nLength2); + pFEA = (PFEA) ((PCH) pFEA + nLength); + } + while ( nLength2 != 0 ); + + pFEAlist -> cbList = (PCH) pFEA - (PCH) pFEAlist; + + eaop.fpGEAList = NULL; + eaop.fpFEAList = pFEAlist; +#endif + + eaop.oError = 0; + DosSetPathInfo(szName, FIL_QUERYEASIZE, (PBYTE) &eaop, sizeof(eaop), 0); + + if (!uO.tflag && QCOND2) + Info(slide, 0, ((char *)slide, " (%ld bytes EAs)", pFEA2list -> cbList)); + + free(pFEA2list); + return PK_COOL; +} + + +static int SetACL(__GPRO__ const char *path, void *ef_block) +{ /* returns almost-PK errors */ + EFHEADER *pACLblock = (PEFHEADER) ef_block; + char *szACL; + int error; + + if ( ef_block == NULL || pACLblock -> nID != EF_ACL ) + return PK_OK; /* not an OS/2 extra field: assume OK */ + + if (pACLblock->nSize < 4 || (pACLblock->lSize > 0L && pACLblock->nSize <= 10)) + return IZ_EF_TRUNC; /* no compressed data! */ + + if ( (szACL = malloc((size_t) pACLblock -> lSize)) == NULL ) + return PK_MEM4; + + if ( (error = memextract(__G__ (uch *)szACL, pACLblock->lSize, + (uch *)(pACLblock+1), (ulg)(pACLblock->nSize - 4))) != PK_OK ) + { + free(szACL); + return error; + } + + if (acl_set(NULL, path, szACL) == 0) + if (!uO.tflag && QCOND2) + Info(slide, 0, ((char *)slide, " (%ld bytes ACL)", strlen(szACL))); + + free(szACL); + return PK_COOL; +} + + +#ifdef SFX + +char *GetLoadPath(__GPRO) +{ +#ifdef __32BIT__ /* generic for 32-bit API */ + PTIB pptib; + PPIB pppib; + char *szPath; + + DosGetInfoBlocks(&pptib, &pppib); + szPath = pppib -> pib_pchenv; +#else /* 16-bit, note: requires large data model */ + SEL selEnv; + USHORT offCmd; + char *szPath; + + DosGetEnv(&selEnv, &offCmd); + szPath = MAKEP(selEnv, 0); +#endif + + while (*szPath) /* find end of process environment */ + szPath = strchr(szPath, 0) + 1; + + return szPath + 1; /* .exe file name follows environment */ + +} /* end function GetLoadPath() */ + + + + + +#else /* !SFX */ + +DIR *opendir(__GPRO__ const char *name) +{ + struct stat statb; + DIR *dirp; + char c; + char *s; + struct _dircontents *dp; + char nbuf[MAXPATHLEN + 1]; + int len; + + strcpy(nbuf, name); + if ((len = strlen(nbuf)) == 0) + return NULL; + + if ( ((c = nbuf[len - 1]) == '\\' || c == '/') && (len > 1) ) + { + nbuf[len - 1] = 0; + --len; + + if ( nbuf[len - 1] == ':' ) + { + strcpy(nbuf+len, "\\."); + len += 2; + } + } + else + if ( nbuf[len - 1] == ':' ) + { + strcpy(nbuf+len, "."); + ++len; + } + + /* GRR: Borland and Watcom C return non-zero on wildcards... < 0 ? */ + if (stat(nbuf, &statb) < 0 || (statb.st_mode & S_IFMT) != S_IFDIR) + { + Trace((stderr, "opendir: stat(%s) returns negative or not directory\n", + nbuf)); + return NULL; + } + + if ( (dirp = malloc(sizeof(DIR))) == NULL ) + return NULL; + + if ( nbuf[len - 1] == '.' && (len == 1 || nbuf[len - 2] != '.') ) + strcpy(nbuf+len-1, "*"); + else + if ( ((c = nbuf[len - 1]) == '\\' || c == '/') && (len == 1) ) + strcpy(nbuf+len, "*"); + else + strcpy(nbuf+len, "\\*"); + + /* len is no longer correct (but no longer needed) */ + Trace((stderr, "opendir: nbuf = [%s]\n", nbuf)); + + dirp -> dd_loc = 0; + dirp -> dd_contents = dirp -> dd_cp = NULL; + + if ((s = getdirent(__G__ nbuf)) == NULL) + return dirp; + + do + { + if (((dp = malloc(sizeof(struct _dircontents))) == NULL) || + ((dp -> _d_entry = malloc(strlen(s) + 1)) == NULL) ) + { + if (dp) + free(dp); + free_dircontents(dirp -> dd_contents); + + return NULL; + } + + if (dirp -> dd_contents) + { + dirp -> dd_cp -> _d_next = dp; + dirp -> dd_cp = dirp -> dd_cp -> _d_next; + } + else + dirp -> dd_contents = dirp -> dd_cp = dp; + + strcpy(dp -> _d_entry, s); + dp -> _d_next = NULL; + + dp -> _d_size = G.os2.find.cbFile; + dp -> _d_mode = G.os2.find.attrFile; + dp -> _d_time = *(unsigned *) &(G.os2.find.ftimeLastWrite); + dp -> _d_date = *(unsigned *) &(G.os2.find.fdateLastWrite); + } + while ((s = getdirent(__G__ NULL)) != NULL); + + dirp -> dd_cp = dirp -> dd_contents; + + return dirp; +} + + +void closedir(DIR * dirp) +{ + free_dircontents(dirp -> dd_contents); + free(dirp); +} + + +struct direct *readdir(__GPRO__ DIR * dirp) +{ + /* moved to os2data.h so it can be global */ + /* static struct direct dp; */ + + if (dirp -> dd_cp == NULL) + return NULL; + + G.os2.dp.d_namlen = G.os2.dp.d_reclen = + strlen(strcpy(G.os2.dp.d_name, dirp -> dd_cp -> _d_entry)); + + G.os2.dp.d_ino = 0; + + G.os2.dp.d_size = dirp -> dd_cp -> _d_size; + G.os2.dp.d_mode = dirp -> dd_cp -> _d_mode; + G.os2.dp.d_time = dirp -> dd_cp -> _d_time; + G.os2.dp.d_date = dirp -> dd_cp -> _d_date; + + dirp -> dd_cp = dirp -> dd_cp -> _d_next; + dirp -> dd_loc++; + + return &G.os2.dp; +} + + + +#if 0 /* not used in unzip; retained for possibly future use */ + +void seekdir(DIR * dirp, long off) +{ + long i = off; + struct _dircontents *dp; + + if (off >= 0) + { + for (dp = dirp -> dd_contents; --i >= 0 && dp; dp = dp -> _d_next); + + dirp -> dd_loc = off - (i + 1); + dirp -> dd_cp = dp; + } +} + + +long telldir(DIR * dirp) +{ + return dirp -> dd_loc; +} + +#endif /* 0 */ + + + +static void free_dircontents(struct _dircontents * dp) +{ + struct _dircontents *odp; + + while (dp) + { + if (dp -> _d_entry) + free(dp -> _d_entry); + + dp = (odp = dp) -> _d_next; + free(odp); + } +} + + +static char *getdirent(__GPRO__ ZCONST char *dir) +{ + int done; + /* moved to os2data.h so it can be global */ + /* static int lower; */ + + if (dir != NULL) + { /* get first entry */ + G.os2.hdir = HDIR_SYSTEM; + G.os2.count = 1; + done = DosFindFirst((PSZ) dir, &G.os2.hdir, attributes, + &G.os2.find, sizeof(G.os2.find), &G.os2.count); + G.os2.lower = IsFileSystemFAT(__G__ dir); + } + else /* get next entry */ + done = DosFindNext(G.os2.hdir, + &G.os2.find, sizeof(G.os2.find), &G.os2.count); + + if (done == 0) + { + if ( G.os2.lower ) + StringLower(G.os2.find.achName); + return G.os2.find.achName; + } + else + { + DosFindClose(G.os2.hdir); + return NULL; + } +} + + + +int IsFileSystemFAT(__GPRO__ ZCONST char *dir) /* FAT / HPFS detection */ +{ + /* moved to os2data.h so they can be global */ + /* static USHORT nLastDrive=(USHORT)(-1), nResult; */ + ULONG lMap; + BYTE bData[64]; + char bName[3]; +#ifdef __32BIT__ + ULONG nDrive, cbData; + PFSQBUFFER2 pData = (PFSQBUFFER2) bData; +#else + USHORT nDrive, cbData; + PFSQBUFFER pData = (PFSQBUFFER) bData; +#endif + + /* We separate FAT and HPFS+other file systems here. + at the moment I consider other systems to be similar to HPFS, + i.e. support long file names and case sensitive */ + + if ( isalpha(dir[0]) && (dir[1] == ':') ) + nDrive = toupper(dir[0]) - '@'; + else + DosQueryCurrentDisk(&nDrive, &lMap); + + if ( nDrive == G.os2.nLastDrive ) + return G.os2.nResult; + + bName[0] = (char) (nDrive + '@'); + bName[1] = ':'; + bName[2] = 0; + + G.os2.nLastDrive = nDrive; + cbData = sizeof(bData); + + if ( !DosQueryFSAttach(bName, 0, FSAIL_QUERYNAME, (PVOID) pData, &cbData) ) + G.os2.nResult = !strcmp((char *) (pData -> szFSDName) + pData -> cbName, + "FAT"); + else + G.os2.nResult = FALSE; + + /* End of this ugly code */ + return G.os2.nResult; +} /* end function IsFileSystemFAT() */ + + + + + +/************************/ +/* Function do_wild() */ +/************************/ + +char *do_wild(__G__ wildspec) + __GDEF + char *wildspec; /* only used first time on a given dir */ +{ + /* moved to os2data.h so they can be global */ +#if 0 + static DIR *dir = NULL; + static char *dirname, *wildname, matchname[FILNAMSIZ]; + static int firstcall=TRUE, have_dirname, dirnamelen; +#endif + char *fnamestart; + struct direct *file; + + + /* Even when we're just returning wildspec, we *always* do so in + * matchname[]--calling routine is allowed to append four characters + * to the returned string, and wildspec may be a pointer to argv[]. + */ + if (G.os2.firstcall) { /* first call: must initialize everything */ + G.os2.firstcall = FALSE; + + if (!iswild(wildspec)) { + strcpy(G.os2.matchname, wildspec); + G.os2.have_dirname = FALSE; + G.os2.dir = NULL; + return G.os2.matchname; + } + + /* break the wildspec into a directory part and a wildcard filename */ + if ((G.os2.wildname = strrchr(wildspec, '/')) == NULL && + (G.os2.wildname = strrchr(wildspec, ':')) == NULL) { + G.os2.dirname = "."; + G.os2.dirnamelen = 1; + G.os2.have_dirname = FALSE; + G.os2.wildname = wildspec; + } else { + ++G.os2.wildname; /* point at character after '/' or ':' */ + G.os2.dirnamelen = G.os2.wildname - wildspec; + if ((G.os2.dirname = (char *)malloc(G.os2.dirnamelen+1)) == NULL) { + Info(slide, 1, ((char *)slide, + LoadFarString(CantAllocateWildcard))); + strcpy(G.os2.matchname, wildspec); + return G.os2.matchname; /* but maybe filespec was not a wildcard */ + } + strncpy(G.os2.dirname, wildspec, G.os2.dirnamelen); + G.os2.dirname[G.os2.dirnamelen] = '\0'; /* terminate for strcpy below */ + G.os2.have_dirname = TRUE; + } + Trace((stderr, "do_wild: dirname = [%s]\n", G.os2.dirname)); + + if ((G.os2.dir = opendir(__G__ G.os2.dirname)) != NULL) { + if (G.os2.have_dirname) { + strcpy(G.os2.matchname, G.os2.dirname); + fnamestart = G.os2.matchname + G.os2.dirnamelen; + } else + fnamestart = G.os2.matchname; + while ((file = readdir(__G__ G.os2.dir)) != NULL) { + Trace((stderr, "do_wild: readdir returns %s\n", file->d_name)); + strcpy(fnamestart, file->d_name); + if (strrchr(fnamestart, '.') == (char *)NULL) + strcat(fnamestart, "."); + if (match(fnamestart, G.os2.wildname, 1) && /* 1 == ignore case */ + /* skip "." and ".." directory entries */ + strcmp(fnamestart, ".") && strcmp(fnamestart, "..")) { + Trace((stderr, "do_wild: match() succeeds\n")); + /* remove trailing dot */ + fnamestart += strlen(fnamestart) - 1; + if (*fnamestart == '.') + *fnamestart = '\0'; + return G.os2.matchname; + } + } + /* if we get to here directory is exhausted, so close it */ + closedir(G.os2.dir); + G.os2.dir = NULL; + } +#ifdef DEBUG + else { + Trace((stderr, "do_wild: opendir(%s) returns NULL\n", G.os2.dirname)); + } +#endif /* DEBUG */ + + /* return the raw wildspec in case that works (e.g., directory not + * searchable, but filespec was not wild and file is readable) */ + strcpy(G.os2.matchname, wildspec); + return G.os2.matchname; + } + + /* last time through, might have failed opendir but returned raw wildspec */ + if (G.os2.dir == NULL) { + G.os2.firstcall = TRUE; /* nothing left to try--reset for new wildspec */ + if (G.os2.have_dirname) + free(G.os2.dirname); + return (char *)NULL; + } + + /* If we've gotten this far, we've read and matched at least one entry + * successfully (in a previous call), so dirname has been copied into + * matchname already. + */ + if (G.os2.have_dirname) { + /* strcpy(G.os2.matchname, G.os2.dirname); */ + fnamestart = G.os2.matchname + G.os2.dirnamelen; + } else + fnamestart = G.os2.matchname; + while ((file = readdir(__G__ G.os2.dir)) != NULL) { + Trace((stderr, "do_wild: readdir returns %s\n", file->d_name)); + strcpy(fnamestart, file->d_name); + if (strrchr(fnamestart, '.') == (char *)NULL) + strcat(fnamestart, "."); + if (match(fnamestart, G.os2.wildname, 1)) { /* 1 == ignore case */ + Trace((stderr, "do_wild: match() succeeds\n")); + /* remove trailing dot */ + fnamestart += strlen(fnamestart) - 1; + if (*fnamestart == '.') + *fnamestart = '\0'; + return G.os2.matchname; + } + } + + closedir(G.os2.dir); /* have read at least one dir entry; nothing left */ + G.os2.dir = NULL; + G.os2.firstcall = TRUE; /* reset for new wildspec */ + if (G.os2.have_dirname) + free(G.os2.dirname); + return (char *)NULL; + +} /* end function do_wild() */ + +#endif /* !SFX */ + + +/* scan extra fields for something we happen to know */ + +static int EvalExtraFields(__GPRO__ const char *path, + void *extra_field, unsigned ef_len) +{ + char *ef_ptr = extra_field; + PEFHEADER pEFblock; + int rc = PK_OK; + + while (ef_len >= sizeof(EFHEADER)) + { + pEFblock = (PEFHEADER) ef_ptr; + + if (pEFblock -> nSize > (ef_len - EB_HEADSIZE)) + return PK_ERR; /* claimed EFblock length exceeds EF size! */ + + switch (pEFblock -> nID) + { + case EF_OS2: + rc = SetEAs(__G__ path, ef_ptr); + break; + case EF_ACL: + rc = (uO.X_flag) ? SetACL(__G__ path, ef_ptr) : PK_OK; + break; +#if 0 + case EF_IZUNIX: + case EF_PKUNIX: + /* handled elsewhere */ + break; +#endif + default: + TTrace((stderr,"EvalExtraFields: unknown extra field block, ID=%d\n", + pEFblock -> nID)); + break; + } + + ef_ptr += (pEFblock -> nSize + EB_HEADSIZE); + ef_len -= (pEFblock -> nSize + EB_HEADSIZE); + + if (rc != PK_OK) + break; + } + + return rc; +} + + + +/************************/ +/* Function mapattr() */ +/************************/ + +int mapattr(__G) + __GDEF +{ + /* set archive bit (file is not backed up): */ + G.pInfo->file_attr = (unsigned)(G.crec.external_file_attributes | 32) & 0xff; + return 0; +} + + + + + +/************************/ +/* Function mapname() */ +/************************/ + +/* + * There are presently two possibilities in OS/2: the output filesystem is + * FAT, or it is HPFS. If the former, we need to map to FAT, obviously, but + * we *also* must map to HPFS and store that version of the name in extended + * attributes. Either way, we need to map to HPFS, so the main mapname + * routine does that. In the case that the output file system is FAT, an + * extra filename-mapping routine is called in checkdir(). While it should + * be possible to determine the filesystem immediately upon entry to mapname(), + * it is conceivable that the DOS APPEND utility could be added to OS/2 some- + * day, allowing a FAT directory to be APPENDed to an HPFS drive/path. There- + * fore we simply check the filesystem at each path component. + * + * Note that when alternative IFSes become available/popular, everything will + * become immensely more complicated. For example, a Minix filesystem would + * have limited filename lengths like FAT but no extended attributes in which + * to store the longer versions of the names. A BSD Unix filesystem would + * support paths of length 1024 bytes or more, but it is not clear that FAT + * EAs would allow such long .LONGNAME fields or that OS/2 would properly + * restore such fields when moving files from FAT to the new filesystem. + * + * GRR: some or all of the following chars should be checked in either + * mapname (HPFS) or map2fat (FAT), depending: ,=^+'"[]<>|\t& + */ + /* return 0 if no error, 1 if caution (filename */ +int mapname(__G__ renamed) /* truncated), 2 if warning (skip file because */ + __GDEF /* dir doesn't exist), 3 if error (skip file), */ + int renamed; /* or 10 if out of memory (skip file) */ +{ /* [also IZ_VOL_LABEL, IZ_CREATED_DIR] */ + char pathcomp[FILNAMSIZ]; /* path-component buffer */ + char *pp, *cp=(char *)NULL; /* character pointers */ + char *lastsemi=(char *)NULL; /* pointer to last semi-colon in pathcomp */ + int quote = FALSE; /* flag: next char is literal */ + int error = 0; + register unsigned workch; /* hold the character being tested */ + + +/*--------------------------------------------------------------------------- + Initialize various pointers and counters and stuff. + ---------------------------------------------------------------------------*/ + + /* can create path as long as not just freshening, or if user told us */ + G.create_dirs = (!uO.fflag || renamed); + + G.os2.created_dir = FALSE; /* not yet */ + G.os2.renamed_fullpath = FALSE; + G.os2.fnlen = strlen(G.filename); + +/* GRR: for VMS, convert to internal format now or later? or never? */ + if (renamed) { + cp = G.filename - 1; /* point to beginning of renamed name... */ + while (*++cp) + if (*cp == '\\') /* convert backslashes to forward */ + *cp = '/'; + cp = G.filename; + /* use temporary rootpath if user gave full pathname */ + if (G.filename[0] == '/') { + G.os2.renamed_fullpath = TRUE; + pathcomp[0] = '/'; /* copy the '/' and terminate */ + pathcomp[1] = '\0'; + ++cp; + } else if (isalpha(G.filename[0]) && G.filename[1] == ':') { + G.os2.renamed_fullpath = TRUE; + pp = pathcomp; + *pp++ = *cp++; /* copy the "d:" (+ '/', possibly) */ + *pp++ = *cp++; + if (*cp == '/') + *pp++ = *cp++; /* otherwise add "./"? */ + *pp = '\0'; + } + } + + /* pathcomp is ignored unless renamed_fullpath is TRUE: */ + if ((error = checkdir(__G__ pathcomp, INIT)) != 0) /* init path buffer */ + return error; /* ...unless no mem or vol label on hard disk */ + + *pathcomp = '\0'; /* initialize translation buffer */ + pp = pathcomp; /* point to translation buffer */ + if (!renamed) { /* cp already set if renamed */ + if (uO.jflag) /* junking directories */ +/* GRR: watch out for VMS version... */ + cp = (char *)strrchr(G.filename, '/'); + if (cp == (char *)NULL) /* no '/' or not junking dirs */ + cp = G.filename; /* point to internal zipfile-member pathname */ + else + ++cp; /* point to start of last component of path */ + } + +/*--------------------------------------------------------------------------- + Begin main loop through characters in filename. + ---------------------------------------------------------------------------*/ + + while ((workch = (uch)*cp++) != 0) { + + if (quote) { /* if character quoted, */ + *pp++ = (char)workch; /* include it literally */ + quote = FALSE; + } else + switch (workch) { + case '/': /* can assume -j flag not given */ + *pp = '\0'; + if ((error = checkdir(__G__ pathcomp, APPEND_DIR)) > 1) + return error; + pp = pathcomp; /* reset conversion buffer for next piece */ + lastsemi = (char *)NULL; /* leave directory semi-colons alone */ + break; + + case ':': + *pp++ = '_'; /* drive names not stored in zipfile, */ + break; /* so no colons allowed */ + + case ';': /* start of VMS version? */ + lastsemi = pp; /* remove VMS version later... */ + *pp++ = ';'; /* but keep semicolon for now */ + break; + + case '\026': /* control-V quote for special chars */ + quote = TRUE; /* set flag for next character */ + break; + + case ' ': /* keep spaces unless specifically */ + if (uO.sflag) /* requested to change to underscore */ + *pp++ = '_'; + else + *pp++ = ' '; + break; + + default: + /* allow ASCII 255 and European characters in filenames: */ + if (isprint(workch) || workch >= 127) + *pp++ = (char)workch; + } /* end switch */ + + } /* end while loop */ + + *pp = '\0'; /* done with pathcomp: terminate it */ + + /* if not saving them, remove VMS version numbers (appended "###") */ + if (!uO.V_flag && lastsemi) { + pp = lastsemi + 1; /* semi-colon was kept: expect #s after */ + while (isdigit((uch)(*pp))) + ++pp; + if (*pp == '\0') /* only digits between ';' and end: nuke */ + *lastsemi = '\0'; + } + +/*--------------------------------------------------------------------------- + Report if directory was created (and no file to create: filename ended + in '/'), check name to be sure it exists, and combine path and name be- + fore exiting. + ---------------------------------------------------------------------------*/ + + if (G.filename[G.os2.fnlen-1] == '/') { + checkdir(__G__ G.filename, GETPATH); + if (G.os2.created_dir) { + if (!uO.qflag) + Info(slide, 0, ((char *)slide, LoadFarString(Creating), + G.filename)); + if (G.extra_field) { /* zipfile extra field has extended attribs */ + int err = EvalExtraFields(__G__ G.filename, G.extra_field, + G.lrec.extra_field_length); + + if (err == IZ_EF_TRUNC) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", G.filename)); + Info(slide, 1, ((char *)slide, LoadFarString(TruncEAs), + makeword(G.extra_field+2)-10, "\n")); + } else if (!uO.qflag) + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + } else if (!uO.qflag) + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + + /* set date/time stamps */ + SetPathAttrTimes(__G__ G.pInfo->file_attr & ~A_ARCHIVE, 1); + + return IZ_CREATED_DIR; /* dir time already set */ + + } else if (G.extra_field && uO.overwrite_all) { + /* overwrite EAs of existing directory since user requested it */ + int err = EvalExtraFields(__G__ G.filename, G.extra_field, + G.lrec.extra_field_length); + + if (err == IZ_EF_TRUNC) { + Info(slide, 0x421, ((char *)slide, "%-22s ", G.filename)); + Info(slide, 0x401, ((char *)slide, LoadFarString(TruncEAs), + makeword(G.extra_field+2)-10, "\n")); + } + + /* set date/time stamps (dirs only have creation times) */ + SetPathAttrTimes(__G__ G.pInfo->file_attr & ~A_ARCHIVE, 1); + } + return 2; /* dir existed already; don't look for data to extract */ + } + + if (*pathcomp == '\0') { + Info(slide, 1, ((char *)slide, LoadFarString(ConversionFailed), + G.filename)); + return 3; + } + + checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */ + checkdir(__G__ G.filename, GETPATH); + Trace((stderr, "mapname returns with filename = [%s] (error = %d)\n\n", + G.filename, error)); + + if (G.pInfo->vollabel) { /* set the volume label now */ + VOLUMELABEL FSInfoBuf; +/* GRR: "VOLUMELABEL" defined for IBM C and emx, but haven't checked MSC... */ + + strcpy(FSInfoBuf.szVolLabel, G.filename); + FSInfoBuf.cch = (BYTE)strlen(FSInfoBuf.szVolLabel); + + if (!uO.qflag) + Info(slide, 0, ((char *)slide, LoadFarString(Labelling), + (char)(G.os2.nLabelDrive + 'a' - 1), G.filename)); + if (DosSetFSInfo(G.os2.nLabelDrive, FSIL_VOLSER, (PBYTE)&FSInfoBuf, + sizeof(VOLUMELABEL))) + { + Info(slide, 1, ((char *)slide, LoadFarString(ErrSetVolLabel))); + return 3; + } + return 2; /* success: skip the "extraction" quietly */ + } + + return error; + +} /* end function mapname() */ + + + + + +/***********************/ +/* Function checkdir() */ +/***********************/ + +int checkdir(__G__ pathcomp, flag) + __GDEF + char *pathcomp; + int flag; +/* + * returns: 1 - (on APPEND_NAME) truncated filename + * 2 - path doesn't exist, not allowed to create + * 3 - path doesn't exist, tried to create and failed; or + * path exists and is not a directory, but is supposed to be + * 4 - path is too long + * 10 - can't allocate memory for filename buffers + */ +{ + /* moved to os2data.h so they can be global */ +#if 0 + static int rootlen = 0; /* length of rootpath */ + static char *rootpath; /* user's "extract-to" directory */ + static char *buildpathHPFS; /* full path (so far) to extracted file, */ + static char *buildpathFAT; /* both HPFS/EA (main) and FAT versions */ + static char *endHPFS; /* corresponding pointers to end of */ + static char *endFAT; /* buildpath ('\0') */ +#endif + +# define FN_MASK 7 +# define FUNCTION (flag & FN_MASK) + + + +/*--------------------------------------------------------------------------- + APPEND_DIR: append the path component to the path being built and check + for its existence. If doesn't exist and we are creating directories, do + so for this one; else signal success or error as appropriate. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_DIR) { + char *p = pathcomp; + int longdirEA, too_long=FALSE; + + Trace((stderr, "appending dir segment [%s]\n", pathcomp)); + while ((*G.os2.endHPFS = *p++) != '\0') /* copy to HPFS filename */ + ++G.os2.endHPFS; + if (IsFileNameValid(G.os2.buildpathHPFS)) { + longdirEA = FALSE; + p = pathcomp; + while ((*G.os2.endFAT = *p++) != '\0') /* copy to FAT filename, too */ + ++G.os2.endFAT; + } else { + longdirEA = TRUE; +/* GRR: check error return? */ + map2fat(pathcomp, &G.os2.endFAT); /* map, put in FAT fn, update endFAT */ + } + + /* GRR: could do better check, see if overrunning buffer as we go: + * check endHPFS-G.os2.buildpathHPFS after each append, set warning variable + * if within 20 of FILNAMSIZ; then if var set, do careful check when + * appending. Clear variable when begin new path. */ + + /* next check: need to append '/', at least one-char name, '\0' */ + if ((G.os2.endHPFS-G.os2.buildpathHPFS) > FILNAMSIZ-3) + too_long = TRUE; /* check if extracting dir? */ +#ifdef MSC /* MSC 6.00 bug: stat(non-existent-dir) == 0 [exists!] */ + if (GetFileTime(G.os2.buildpathFAT) == -1 || stat(G.os2.buildpathFAT, &G.statbuf)) +#else + if (stat(G.os2.buildpathFAT, &G.statbuf)) /* path doesn't exist */ +#endif + { + if (!G.create_dirs) { /* told not to create (freshening) */ + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return 2; /* path doesn't exist: nothing to do */ + } + if (too_long) { /* GRR: should allow FAT extraction w/o EAs */ + Info(slide, 1, ((char *)slide, LoadFarString(PathTooLong), + G.os2.buildpathHPFS)); + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return 4; /* no room for filenames: fatal */ + } + if (MKDIR(G.os2.buildpathFAT, 0777) == -1) { /* create the directory */ + Info(slide, 1, ((char *)slide, LoadFarString(CantCreateDir), + G.os2.buildpathFAT, G.filename)); + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return 3; /* path didn't exist, tried to create, failed */ + } + G.os2.created_dir = TRUE; + /* only set EA if creating directory */ +/* GRR: need trailing '/' before function call? */ + if (longdirEA) { +#ifdef DEBUG + int e = +#endif + SetLongNameEA(G.os2.buildpathFAT, pathcomp); + Trace((stderr, "APPEND_DIR: SetLongNameEA() returns %d\n", e)); + } + } else if (!S_ISDIR(G.statbuf.st_mode)) { + Info(slide, 1, ((char *)slide, LoadFarString(DirIsntDirectory), + G.os2.buildpathFAT, G.filename)); + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return 3; /* path existed but wasn't dir */ + } + if (too_long) { + Info(slide, 1, ((char *)slide, LoadFarString(PathTooLong), + G.os2.buildpathHPFS)); + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return 4; /* no room for filenames: fatal */ + } + *G.os2.endHPFS++ = '/'; + *G.os2.endFAT++ = '/'; + *G.os2.endHPFS = *G.os2.endFAT = '\0'; + Trace((stderr, "buildpathHPFS now = [%s]\n", G.os2.buildpathHPFS)); + Trace((stderr, "buildpathFAT now = [%s]\n", G.os2.buildpathFAT)); + return 0; + + } /* end if (FUNCTION == APPEND_DIR) */ + +/*--------------------------------------------------------------------------- + GETPATH: copy full FAT path to the string pointed at by pathcomp (want + filename to reflect name used on disk, not EAs; if full path is HPFS, + buildpathFAT and buildpathHPFS will be identical). Also free both paths. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == GETPATH) { + Trace((stderr, "getting and freeing FAT path [%s]\n", G.os2.buildpathFAT)); + Trace((stderr, "freeing HPFS path [%s]\n", G.os2.buildpathHPFS)); + strcpy(pathcomp, G.os2.buildpathFAT); + free(G.os2.buildpathFAT); + free(G.os2.buildpathHPFS); + G.os2.buildpathHPFS = G.os2.buildpathFAT = G.os2.endHPFS = G.os2.endFAT = (char *)NULL; + return 0; + } + +/*--------------------------------------------------------------------------- + APPEND_NAME: assume the path component is the filename; append it and + return without checking for existence. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_NAME) { + char *p = pathcomp; + int error = 0; + + Trace((stderr, "appending filename [%s]\n", pathcomp)); + while ((*G.os2.endHPFS = *p++) != '\0') { /* copy to HPFS filename */ + ++G.os2.endHPFS; + if ((G.os2.endHPFS-G.os2.buildpathHPFS) >= FILNAMSIZ) { + *--G.os2.endHPFS = '\0'; + Info(slide, 1, ((char *)slide, LoadFarString(PathTooLongTrunc), + G.filename, G.os2.buildpathHPFS)); + error = 1; /* filename truncated */ + } + } + +/* GRR: how can longnameEA ever be set before this point??? we don't want + * to save the original name to EAs if user renamed it, do we? + * + * if (!G.os2.longnameEA && ((G.os2.longnameEA = !IsFileNameValid(name)) != 0)) + */ + if (G.pInfo->vollabel || IsFileNameValid(G.os2.buildpathHPFS)) { + G.os2.longnameEA = FALSE; + p = pathcomp; + while ((*G.os2.endFAT = *p++) != '\0') /* copy to FAT filename, too */ + ++G.os2.endFAT; + } else { + G.os2.longnameEA = TRUE; + if ((G.os2.lastpathcomp = (char *)malloc(strlen(pathcomp)+1)) == + (char *)NULL) + { + Info(slide, 1, ((char *)slide, + "checkdir warning: cannot save longname EA: out of memory\n")); + G.os2.longnameEA = FALSE; + error = 1; /* can't set .LONGNAME extended attribute */ + } else /* used and freed in close_outfile() */ + strcpy(G.os2.lastpathcomp, pathcomp); + map2fat(pathcomp, &G.os2.endFAT); /* map, put in FAT fn, update endFAT */ + } + Trace((stderr, "buildpathHPFS: %s\nbuildpathFAT: %s\n", + G.os2.buildpathHPFS, G.os2.buildpathFAT)); + + return error; /* could check for existence, prompt for new name... */ + + } /* end if (FUNCTION == APPEND_NAME) */ + +/*--------------------------------------------------------------------------- + INIT: allocate and initialize buffer space for the file currently being + extracted. If file was renamed with an absolute path, don't prepend the + extract-to path. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == INIT) { + Trace((stderr, "initializing buildpathHPFS and buildpathFAT to ")); + if ((G.os2.buildpathHPFS = (char *)malloc(G.os2.fnlen+G.os2.rootlen+1)) == (char *)NULL) + return 10; + if ((G.os2.buildpathFAT = (char *)malloc(G.os2.fnlen+G.os2.rootlen+1)) == (char *)NULL) { + free(G.os2.buildpathHPFS); + return 10; + } + if (G.pInfo->vollabel) { /* use root or renamed path, but don't store */ +/* GRR: for network drives, do strchr() and return IZ_VOL_LABEL if not [1] */ + if (G.os2.renamed_fullpath && pathcomp[1] == ':') + *G.os2.buildpathHPFS = (char)ToLower(*pathcomp); + else if (!G.os2.renamed_fullpath && G.os2.rootlen > 1 && G.os2.rootpath[1] == ':') + *G.os2.buildpathHPFS = (char)ToLower(*G.os2.rootpath); + else { + ULONG lMap; + DosQueryCurrentDisk(&G.os2.nLabelDrive, &lMap); + *G.os2.buildpathHPFS = (char)(G.os2.nLabelDrive - 1 + 'a'); + } + G.os2.nLabelDrive = *G.os2.buildpathHPFS - 'a' + 1; /* save for mapname() */ + if (uO.volflag == 0 || *G.os2.buildpathHPFS < 'a' || /* no labels/bogus? */ + (uO.volflag == 1 && !isfloppy(G.os2.nLabelDrive))) { /* -$: no fixed */ + free(G.os2.buildpathHPFS); + free(G.os2.buildpathFAT); + return IZ_VOL_LABEL; /* skipping with message */ + } + *G.os2.buildpathHPFS = '\0'; + } else if (G.os2.renamed_fullpath) /* pathcomp = valid data */ + strcpy(G.os2.buildpathHPFS, pathcomp); + else if (G.os2.rootlen > 0) + strcpy(G.os2.buildpathHPFS, G.os2.rootpath); + else + *G.os2.buildpathHPFS = '\0'; + G.os2.endHPFS = G.os2.buildpathHPFS; + G.os2.endFAT = G.os2.buildpathFAT; + while ((*G.os2.endFAT = *G.os2.endHPFS) != '\0') { + ++G.os2.endFAT; + ++G.os2.endHPFS; + } + Trace((stderr, "[%s]\n", G.os2.buildpathHPFS)); + return 0; + } + +/*--------------------------------------------------------------------------- + ROOT: if appropriate, store the path in rootpath and create it if neces- + sary; else assume it's a zipfile member and return. This path segment + gets used in extracting all members from every zipfile specified on the + command line. Note that under OS/2 and MS-DOS, if a candidate extract-to + directory specification includes a drive letter (leading "x:"), it is + treated just as if it had a trailing '/'--that is, one directory level + will be created if the path doesn't exist, unless this is otherwise pro- + hibited (e.g., freshening). + ---------------------------------------------------------------------------*/ + +#if (!defined(SFX) || defined(SFX_EXDIR)) + if (FUNCTION == ROOT) { + Trace((stderr, "initializing root path to [%s]\n", pathcomp)); + if (pathcomp == (char *)NULL) { + G.os2.rootlen = 0; + return 0; + } + if ((G.os2.rootlen = strlen(pathcomp)) > 0) { + int had_trailing_pathsep=FALSE, has_drive=FALSE, xtra=2; + + if (isalpha(pathcomp[0]) && pathcomp[1] == ':') + has_drive = TRUE; /* drive designator */ + if (pathcomp[G.os2.rootlen-1] == '/') { + pathcomp[--G.os2.rootlen] = '\0'; + had_trailing_pathsep = TRUE; + } + if (has_drive && (G.os2.rootlen == 2)) { + if (!had_trailing_pathsep) /* i.e., original wasn't "x:/" */ + xtra = 3; /* room for '.' + '/' + 0 at end of "x:" */ + } else if (G.os2.rootlen > 0) { /* need not check "x:." and "x:/" */ +#ifdef MSC /* MSC 6.00 bug: stat(non-existent-dir) == 0 [exists!] */ + if (GetFileTime(pathcomp) == -1 || + SSTAT(pathcomp, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode)) +#else + if (SSTAT(pathcomp, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode)) +#endif + { /* path does not exist */ + if (!G.create_dirs /* || iswild(pathcomp) */ + ) { + G.os2.rootlen = 0; + return 2; /* treat as stored file */ + } + /* create directory (could add loop here to scan pathcomp + * and create more than one level, but really necessary?) */ + if (MKDIR(pathcomp, 0777) == -1) { + Info(slide, 1, ((char *)slide, + LoadFarString(CantCreateExtractDir), pathcomp)); + G.os2.rootlen = 0; /* path didn't exist, tried to create, */ + return 3; /* failed: file exists, or need 2+ levels */ + } + } + } + if ((G.os2.rootpath = (char *)malloc(G.os2.rootlen+xtra)) == (char *)NULL) { + G.os2.rootlen = 0; + return 10; + } + strcpy(G.os2.rootpath, pathcomp); + if (xtra == 3) /* had just "x:", make "x:." */ + G.os2.rootpath[G.os2.rootlen++] = '.'; + G.os2.rootpath[G.os2.rootlen++] = '/'; + G.os2.rootpath[G.os2.rootlen] = '\0'; + Trace((stderr, "rootpath now = [%s]\n", G.os2.rootpath)); + } + return 0; + } +#endif /* !SFX || SFX_EXDIR */ + +/*--------------------------------------------------------------------------- + END: free rootpath, immediately prior to program exit. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == END) { + Trace((stderr, "freeing rootpath\n")); + if (G.os2.rootlen > 0) { + free(G.os2.rootpath); + G.os2.rootlen = 0; + } + return 0; + } + + return 99; /* should never reach */ + +} /* end function checkdir() */ + + + + + +/***********************/ +/* Function isfloppy() */ /* more precisely, is it removable? */ +/***********************/ + +static int isfloppy(nDrive) + int nDrive; /* 1 == A:, 2 == B:, etc. */ +{ + uch ParmList[1] = {0}; + uch DataArea[1] = {0}; + char Name[3]; + HFILE handle; +#ifdef __32BIT__ + ULONG rc; + ULONG action; +#else + USHORT rc; + USHORT action; +#endif + + + Name[0] = (char) (nDrive + 'A' - 1); + Name[1] = ':'; + Name[2] = 0; + + rc = DosOpen(Name, &handle, &action, 0L, FILE_NORMAL, FILE_OPEN, + OPEN_FLAGS_DASD | OPEN_FLAGS_FAIL_ON_ERROR | + OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0L); + + if (rc == ERROR_NOT_READY) /* must be removable */ + return TRUE; + else if (rc) { /* other error: do default a/b heuristic instead */ + Trace((stderr, "error in DosOpen(DASD): guessing...\n", rc)); + return (nDrive == 1 || nDrive == 2)? TRUE : FALSE; + } + + rc = DosDevIOCtl(DataArea, sizeof(DataArea), ParmList, sizeof(ParmList), + DSK_BLOCKREMOVABLE, IOCTL_DISK, handle); + DosClose(handle); + + if (rc) { /* again, just check for a/b */ + Trace((stderr, "error in DosDevIOCtl category IOCTL_DISK, function " + "DSK_BLOCKREMOVABLE\n (rc = 0x%04x): guessing...\n", rc)); + return (nDrive == 1 || nDrive == 2)? TRUE : FALSE; + } else { + return DataArea[0] ? FALSE : TRUE; + } +} /* end function isfloppy() */ + + + + + +static int IsFileNameValid(const char *name) +{ + HFILE hf; +#ifdef __32BIT__ + ULONG uAction; +#else + USHORT uAction; +#endif + + switch( DosOpen((PSZ) name, &hf, &uAction, 0, 0, FILE_OPEN, + OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0) ) + { + case ERROR_INVALID_NAME: + case ERROR_FILENAME_EXCED_RANGE: + return FALSE; + case NO_ERROR: + DosClose(hf); + default: + return TRUE; + } +} + + + + + +/**********************/ +/* Function map2fat() */ +/**********************/ + +static void map2fat(pathcomp, pEndFAT) + char *pathcomp, **pEndFAT; +{ + char *ppc = pathcomp; /* variable pointer to pathcomp */ + char *pEnd = *pEndFAT; /* variable pointer to buildpathFAT */ + char *pBegin = *pEndFAT; /* constant pointer to start of this comp. */ + char *last_dot = (char *)NULL; /* last dot not converted to underscore */ + int dotname = FALSE; /* flag: path component begins with dot */ + /* ("." and ".." don't count) */ + register unsigned workch; /* hold the character being tested */ + + + /* Only need check those characters which are legal in HPFS but not + * in FAT: to get here, must already have passed through mapname. + * (GRR: oops, small bug--if char was quoted, no longer have any + * knowledge of that.) Also must truncate path component to ensure + * 8.3 compliance... + */ + while ((workch = (uch)*ppc++) != 0) { + switch (workch) { + case '[': /* add '"' '+' ',' '=' ?? */ + case ']': + *pEnd++ = '_'; /* convert brackets to underscores */ + break; + + case '.': + if (pEnd == *pEndFAT) { /* nothing appended yet... */ + if (*ppc == '\0') /* don't bother appending a */ + break; /* "./" component to the path */ + else if (*ppc == '.' && ppc[1] == '\0') { /* "../" */ + *pEnd++ = '.'; /* add first dot, unchanged... */ + ++ppc; /* skip second dot, since it will */ + } else { /* be "added" at end of if-block */ + *pEnd++ = '_'; /* FAT doesn't allow null filename */ + dotname = TRUE; /* bodies, so map .exrc -> _.exrc */ + } /* (extra '_' now, "dot" below) */ + } else if (dotname) { /* found a second dot, but still */ + dotname = FALSE; /* have extra leading underscore: */ + *pEnd = '\0'; /* remove it by shifting chars */ + pEnd = *pEndFAT + 1; /* left one space (e.g., .p1.p2: */ + while (pEnd[1]) { /* __p1 -> _p1_p2 -> _p1.p2 when */ + *pEnd = pEnd[1]; /* finished) [opt.: since first */ + ++pEnd; /* two chars are same, can start */ + } /* shifting at second position] */ + } + last_dot = pEnd; /* point at last dot so far... */ + *pEnd++ = '_'; /* convert dot to underscore for now */ + break; + + default: + *pEnd++ = (char)workch; + + } /* end switch */ + } /* end while loop */ + + *pEnd = '\0'; /* terminate buildpathFAT */ + + /* NOTE: keep in mind that pEnd points to the end of the path + * component, and *pEndFAT still points to the *beginning* of it... + * Also note that the algorithm does not try to get too fancy: + * if there are no dots already, the name either gets truncated + * at 8 characters or the last underscore is converted to a dot + * (only if more characters are saved that way). In no case is + * a dot inserted between existing characters. + */ + if (last_dot == (char *)NULL) { /* no dots: check for underscores... */ + char *plu = strrchr(pBegin, '_'); /* pointer to last underscore */ + + if (plu == (char *)NULL) { /* no dots, no underscores: truncate at 8 */ + *pEndFAT += 8; /* chars (could insert '.' and keep 11...) */ + if (*pEndFAT > pEnd) + *pEndFAT = pEnd; /* oops...didn't have 8 chars to truncate */ + else + **pEndFAT = '\0'; + } else if (MIN(plu - pBegin, 8) + MIN(pEnd - plu - 1, 3) > 8) { + last_dot = plu; /* be lazy: drop through to next if-block */ + } else if ((pEnd - *pEndFAT) > 8) { + *pEndFAT += 8; /* more fits into just basename than if */ + **pEndFAT = '\0'; /* convert last underscore to dot */ + } else + *pEndFAT = pEnd; /* whole thing fits into 8 chars or less */ + } + + if (last_dot != (char *)NULL) { /* one dot (or two, in the case of */ + *last_dot = '.'; /* "..") is OK: put it back in */ + + if ((last_dot - pBegin) > 8) { + char *p, *q; + int i; + + p = last_dot; + q = last_dot = pBegin + 8; + for (i = 0; (i < 4) && *p; ++i) /* too many chars in basename: */ + *q++ = *p++; /* shift ".ext" left and */ + *q = '\0'; /* truncate/terminate it */ + *pEndFAT = q; + } else if ((pEnd - last_dot) > 4) { /* too many chars in extension */ + *pEndFAT = last_dot + 4; + **pEndFAT = '\0'; + } else + *pEndFAT = pEnd; /* filename is fine; point at terminating zero */ + + if ((last_dot - pBegin) > 0 && last_dot[-1] == ' ') + last_dot[-1] = '_'; /* NO blank in front of '.'! */ + } +} /* end function map2fat() */ + + + + + +static int SetLongNameEA(char *name, char *longname) +{ + EAOP eaop; + FEALST fealst; + + eaop.fpFEAList = (PFEALIST) &fealst; + eaop.fpGEAList = NULL; + eaop.oError = 0; + + strcpy((char *) fealst.szName, ".LONGNAME"); + strcpy((char *) fealst.szValue, longname); + + fealst.cbList = sizeof(fealst) - CCHMAXPATH + strlen((char *) fealst.szValue); + fealst.cbName = (BYTE) strlen((char *) fealst.szName); + fealst.cbValue = sizeof(USHORT) * 2 + strlen((char *) fealst.szValue); + +#ifdef __32BIT__ + fealst.oNext = 0; +#endif + fealst.fEA = 0; + fealst.eaType = 0xFFFD; + fealst.eaSize = strlen((char *) fealst.szValue); + + return DosSetPathInfo(name, FIL_QUERYEASIZE, + (PBYTE) &eaop, sizeof(eaop), 0); +} + + + + + +/****************************/ +/* Function close_outfile() */ +/****************************/ + + /* GRR: need to return error level!! */ + +void close_outfile(__G) /* only for extracted files, not directories */ + __GDEF +{ + fclose(G.outfile); + + /* set extra fields, both stored-in-zipfile and .LONGNAME flavors */ + if (G.extra_field) { /* zipfile extra field may have extended attribs */ + int err = EvalExtraFields(__G__ G.filename, G.extra_field, + G.lrec.extra_field_length); + + if (err == IZ_EF_TRUNC) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", G.filename)); + Info(slide, 1, ((char *)slide, LoadFarString(TruncEAs), + makeword(G.extra_field+2)-10, uO.qflag? "\n" : "")); + } + } + + if (G.os2.longnameEA) { +#ifdef DEBUG + int e = +#endif + SetLongNameEA(G.filename, G.os2.lastpathcomp); + Trace((stderr, "close_outfile: SetLongNameEA() returns %d\n", e)); + free(G.os2.lastpathcomp); + } + + /* set date/time and permissions */ + SetPathAttrTimes(__G__ G.pInfo->file_attr, 0); + +} /* end function close_outfile() */ + + + + + +/******************************/ +/* Function check_for_newer() */ +/******************************/ + +int check_for_newer(__G__ filename) /* return 1 if existing file newer or equal; */ + __GDEF + char *filename; /* 0 if older; -1 if doesn't exist yet */ +{ + ulg existing, archive; +#ifdef USE_EF_UT_TIME + iztimes z_utime; +#endif + + if ((existing = (ulg)GetFileTime(filename)) == (ulg)-1) + return DOES_NOT_EXIST; + +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0, + G.lrec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME)) + { + TTrace((stderr, "check_for_newer: using Unix extra field mtime\n")); + archive = Utime2DosDateTime(z_utime.mtime); + } else { + archive = G.lrec.last_mod_dos_datetime; + } +#else /* !USE_EF_UT_TIME */ + archive = G.lrec.last_mod_dos_datetime; +#endif /* ?USE_EF_UT_TIME */ + + return (existing >= archive); +} /* end function check_for_newer() */ + + + + + +#ifndef SFX + +/*************************/ +/* Function dateformat() */ +/*************************/ + +int dateformat() +{ +/*----------------------------------------------------------------------------- + For those operating systems which support it, this function returns a value + which tells how national convention says that numeric dates are displayed. + Return values are DF_YMD, DF_DMY and DF_MDY. + -----------------------------------------------------------------------------*/ + + switch (GetCountryInfo()) { + case 0: + return DF_MDY; + case 1: + return DF_DMY; + case 2: + return DF_YMD; + } + return DF_MDY; /* default if error */ + +} /* end function dateformat() */ + + + + + +/************************/ +/* Function version() */ +/************************/ + +void version(__G) + __GDEF +{ + int len; +#if defined(__IBMC__) || defined(__WATCOMC__) || defined(_MSC_VER) + char buf[80]; +#endif + + len = sprintf((char *)slide, LoadFarString(CompiledWith), + +#if defined(__GNUC__) +# ifdef __EMX__ /* __EMX__ is defined as "1" only (sigh) */ + "emx+gcc ", __VERSION__, +# else + "gcc/2 ", __VERSION__, +# endif +#elif defined(__IBMC__) + "IBM ", +# if (__IBMC__ < 200) + (sprintf(buf, "C Set/2 %d.%02d", __IBMC__/100,__IBMC__%100), buf), +# elif (__IBMC__ < 300) + (sprintf(buf, "C Set++ %d.%02d", __IBMC__/100,__IBMC__%100), buf), +# else + (sprintf(buf, "Visual Age C++ %d.%02d", __IBMC__/100,__IBMC__%100), buf), +# endif +#elif defined(__WATCOMC__) + "Watcom C", (sprintf(buf, " (__WATCOMC__ = %d)", __WATCOMC__), buf), +#elif defined(__TURBOC__) +# ifdef __BORLANDC__ + "Borland C++", +# if (__BORLANDC__ < 0x0460) + " 1.0", +# elif (__BORLANDC__ == 0x0460) + " 1.5", /* from Kai Uwe: three less than DOS */ +# else + " 2.0", /* (__BORLANDC__ == 0x0500)? */ +# endif +# else + "Turbo C", /* these are probably irrelevant */ +# if (__TURBOC__ >= 661) + "++ 1.0 or later", +# elif (__TURBOC__ == 661) + " 3.0?", +# elif (__TURBOC__ == 397) + " 2.0", +# else + " 1.0 or 1.5?", +# endif +# endif +#elif defined(MSC) + "Microsoft C ", +# ifdef _MSC_VER + (sprintf(buf, "%d.%02d", _MSC_VER/100, _MSC_VER%100), buf), +# else + "5.1 or earlier", +# endif +#else + "unknown compiler", "", +#endif /* ?compilers */ + + "OS/2", + +/* GRR: does IBM C/2 identify itself as IBM rather than Microsoft? */ +#if (defined(MSC) || (defined(__WATCOMC__) && !defined(__386__))) +# if defined(M_I86HM) || defined(__HUGE__) + " (16-bit, huge)", +# elif defined(M_I86LM) || defined(__LARGE__) + " (16-bit, large)", +# elif defined(M_I86MM) || defined(__MEDIUM__) + " (16-bit, medium)", +# elif defined(M_I86CM) || defined(__COMPACT__) + " (16-bit, compact)", +# elif defined(M_I86SM) || defined(__SMALL__) + " (16-bit, small)", +# elif defined(M_I86TM) || defined(__TINY__) + " (16-bit, tiny)", +# else + " (16-bit)", +# endif +#else + " 2.x/3.x (32-bit)", +#endif + +#ifdef __DATE__ + " on ", __DATE__ +#else + "", "" +#endif + ); + + (*G.message)((zvoid *)&G, slide, (ulg)len, 0); + /* MSC can't handle huge macro expansions */ + + /* temporary debugging code for Borland compilers only */ + /* __TCPLUSPLUS__, __BCPLUSPLUS__ not defined for v1.5 */ +#if (defined(__TURBOC__) && defined(DEBUG)) + Info(slide, 0, ((char *)slide, "\t(__TURBOC__ = 0x%04x = %d)\n", __TURBOC__, + __TURBOC__)); +#ifdef __BORLANDC__ + Info(slide, 0, ((char *)slide, "\t(__BORLANDC__ = 0x%04x)\n",__BORLANDC__)); +#else + Info(slide, 0, ((char *)slide, "\tdebug(__BORLANDC__ not defined)\n")); +#endif +#endif /* __TURBOC__ && DEBUG */ + +} /* end function version() */ + +#endif /* !SFX */ + + + +/* This table can be static because it is pseudo-constant */ +static unsigned char cUpperCase[256], cLowerCase[256]; +static BOOL bInitialized=FALSE; + +/* Initialize the tables of upper- and lowercase characters, including + handling of country-dependent characters. */ + +static void InitNLS(void) +{ + unsigned nCnt, nU; + COUNTRYCODE cc; + + if (bInitialized == FALSE) { + bInitialized = TRUE; + + for ( nCnt = 0; nCnt < 256; nCnt++ ) + cUpperCase[nCnt] = cLowerCase[nCnt] = (unsigned char) nCnt; + + cc.country = cc.codepage = 0; + DosMapCase(sizeof(cUpperCase), &cc, (PCHAR) cUpperCase); + + for ( nCnt = 0; nCnt < 256; nCnt++ ) { + nU = cUpperCase[nCnt]; + if (nU != nCnt && cLowerCase[nU] == (unsigned char) nU) + cLowerCase[nU] = (unsigned char) nCnt; + } + + for ( nCnt = 'A'; nCnt <= 'Z'; nCnt++ ) + cLowerCase[nCnt] = (unsigned char) (nCnt - 'A' + 'a'); + } +} + + +int IsUpperNLS(int nChr) +{ + return (cUpperCase[nChr] == (unsigned char) nChr); +} + + +int ToLowerNLS(int nChr) +{ + return cLowerCase[nChr]; +} + + +char *StringLower(char *szArg) +{ + unsigned char *szPtr; + + for ( szPtr = (unsigned char *) szArg; *szPtr; szPtr++ ) + *szPtr = cLowerCase[*szPtr]; + return szArg; +} + + +#if defined(__IBMC__) && defined(__DEBUG_ALLOC__) +void DebugMalloc(void) +{ + _dump_allocated(0); /* print out debug malloc memory statistics */ +} +#endif + + +#if defined(REENTRANT) && defined(USETHREADID) +ulg GetThreadId(void) +{ + PTIB pptib; /* Address of a pointer to the + Thread Information Block */ + PPIB pppib; /* Address of a pointer to the + Process Information Block */ + + DosGetInfoBlocks(&pptib, &pppib); + return pptib->tib_ptib2->tib2_ultid; +} +#endif /* defined(REENTRANT) && defined(USETHREADID) */ + + +void os2GlobalsCtor(__GPRO) +{ + G.os2.nLastDrive = (USHORT)(-1); + G.os2.firstcall = TRUE; + +#ifdef OS2DLL + G.os2.rexx_mes = "0"; +#endif + + InitNLS(); +} diff --git a/utils/Install/sfxzip/os2acl.c b/utils/Install/sfxzip/os2acl.c new file mode 100644 index 0000000000..a9f03f78c4 --- /dev/null +++ b/utils/Install/sfxzip/os2acl.c @@ -0,0 +1,384 @@ +/* os2acl.c - access to OS/2 (LAN Server) ACLs + * + * Author: Kai Uwe Rommel <rommel@ars.de> + * Created: Mon Aug 08 1994 + * + * This code is in the public domain. + */ + +/* + * supported 32-bit compilers: + * - emx+gcc + * - IBM C Set++ 2.1 or newer + * - Watcom C/C++ 10.0 or newer + * + * supported 16-bit compilers: + * - MS C 6.00A + * - Watcom C/C++ 10.0 or newer + * + * supported OS/2 LAN environments: + * - IBM LAN Server/Requester 3.0, 4.0 and 5.0 (Warp Server) + * - IBM Peer 1.0 (Warp Connect) + */ + +#ifdef KUR + static char *rcsid = + "$Id$"; + static char *rcsrev = "$Revision$"; +#endif + +/* + * $Log$ + * Revision 1.2 2000/07/15 19:50:50 cvsuser + * merged 2.2 branch + * + * Revision 1.1.2.1 2000/04/11 12:38:06 BS + * Added wxInstall a self extracting installation program using wxWindows. + * + * Revision 1.3 1996/04/03 19:18:27 rommel + * minor fixes + * + * Revision 1.2 1996/03/30 22:03:52 rommel + * avoid frequent dynamic allocation for every call + * streamlined code + * + * Revision 1.1 1996/03/30 09:35:00 rommel + * Initial revision + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <malloc.h> + +#define INCL_NOPM +#define INCL_DOS +#define INCL_DOSERRORS +#include <os2.h> + +#include "os2/os2acl.h" + +#define UNLEN 20 + +#if defined(__WATCOMC__) && defined(__386__) && !defined(__32BIT__) +#define __32BIT__ +#endif + +#ifdef __32BIT__ +typedef ULONG U_INT; +#ifdef __EMX__ +#define PSTR16 _far16ptr +#define PTR16(x) _emx_32to16(x) +#else /* other 32-bit */ +#define PSTR16 PCHAR16 +#define PTR16(x) ((PCHAR16)(x)) +#endif +#else /* 16-bit */ +typedef USHORT U_INT; +#define PSTR16 PSZ +#define PTR16(x) (x) +#endif + +typedef struct access_list +{ + char acl_ugname[UNLEN+1]; + char acl_pad; + USHORT acl_access; +} +ACCLIST; + +typedef struct access_info +{ + PSTR16 acc_resource_name; + USHORT acc_attr; + USHORT acc_count; +} +ACCINFO; + +static ACCINFO *ai; +static char *path, *data; + +#ifdef __32BIT__ + +#ifdef __EMX__ + +static USHORT (APIENTRY *_NetAccessGetInfo)(PSZ pszServer, PSZ pszResource, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer, PUSHORT pcbTotalAvail); +static USHORT (APIENTRY *_NetAccessSetInfo)(PSZ pszServer, PSZ pszResource, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer, USHORT sParmNum); +static USHORT (APIENTRY *_NetAccessAdd)(PSZ pszServer, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer); + +USHORT NetAccessGetInfo(PSZ pszServer, PSZ pszResource, USHORT sLevel, + PVOID pbBuffer, USHORT cbBuffer, PUSHORT pcbTotalAvail) +{ + return (USHORT) + (_THUNK_PROLOG (4+4+2+4+2+4); + _THUNK_FLAT (pszServer); + _THUNK_FLAT (pszResource); + _THUNK_SHORT (sLevel); + _THUNK_FLAT (pbBuffer); + _THUNK_SHORT (cbBuffer); + _THUNK_FLAT (pcbTotalAvail); + _THUNK_CALLI (_emx_32to16(_NetAccessGetInfo))); +} + +USHORT NetAccessSetInfo(PSZ pszServer, PSZ pszResource, USHORT sLevel, + PVOID pbBuffer, USHORT cbBuffer, USHORT sParmNum) +{ + return (USHORT) + (_THUNK_PROLOG (4+4+2+4+2+2); + _THUNK_FLAT (pszServer); + _THUNK_FLAT (pszResource); + _THUNK_SHORT (sLevel); + _THUNK_FLAT (pbBuffer); + _THUNK_SHORT (cbBuffer); + _THUNK_SHORT (sParmNum); + _THUNK_CALLI (_emx_32to16(_NetAccessSetInfo))); +} + +USHORT NetAccessAdd(PSZ pszServer, USHORT sLevel, + PVOID pbBuffer, USHORT cbBuffer) +{ + return (USHORT) + (_THUNK_PROLOG (4+2+4+2); + _THUNK_FLAT (pszServer); + _THUNK_SHORT (sLevel); + _THUNK_FLAT (pbBuffer); + _THUNK_SHORT (cbBuffer); + _THUNK_CALLI (_emx_32to16(_NetAccessAdd))); +} + +#else /* other 32-bit */ + +APIRET16 (* APIENTRY16 NetAccessGetInfo)(PCHAR16 pszServer, PCHAR16 pszResource, + USHORT sLevel, PVOID16 pbBuffer, USHORT cbBuffer, PVOID16 pcbTotalAvail); +APIRET16 (* APIENTRY16 NetAccessSetInfo)(PCHAR16 pszServer, PCHAR16 pszResource, + USHORT sLevel, PVOID16 pbBuffer, USHORT cbBuffer, USHORT sParmNum); +APIRET16 (* APIENTRY16 NetAccessAdd)(PCHAR16 pszServer, + USHORT sLevel, PVOID16 pbBuffer, USHORT cbBuffer); + +#define _NetAccessGetInfo NetAccessGetInfo +#define _NetAccessSetInfo NetAccessSetInfo +#define _NetAccessAdd NetAccessAdd + +#if !defined(__IBMC__) || !defined(__TILED__) +#define _tmalloc malloc +#define _tfree free +#endif + +#endif +#else /* 16-bit */ + +USHORT (APIENTRY *NetAccessGetInfo)(PSZ pszServer, PSZ pszResource, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer, PUSHORT pcbTotalAvail); +USHORT (APIENTRY *NetAccessSetInfo)(PSZ pszServer, PSZ pszResource, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer, USHORT sParmNum); +USHORT (APIENTRY *NetAccessAdd)(PSZ pszServer, + USHORT sLevel, PVOID pbBuffer, USHORT cbBuffer); + +#define _NetAccessGetInfo NetAccessGetInfo +#define _NetAccessSetInfo NetAccessSetInfo +#define _NetAccessAdd NetAccessAdd + +#define _tmalloc malloc +#define _tfree free + +#define DosQueryProcAddr(handle, ord, name, funcptr) \ + DosGetProcAddr(handle, name, funcptr) +#define DosQueryCurrentDir DosQCurDir +#define DosQueryCurrentDisk DosQCurDisk + +#endif + + +static BOOL acl_init(void) +{ + static BOOL initialized, netapi_avail; + HMODULE netapi; + char buf[256]; + + if (initialized) + return netapi_avail; + + initialized = TRUE; + + if (DosLoadModule(buf, sizeof(buf), "NETAPI", &netapi)) + return FALSE; + + if (DosQueryProcAddr(netapi, 0, "NETACCESSGETINFO", (PFN *) &_NetAccessGetInfo) || + DosQueryProcAddr(netapi, 0, "NETACCESSSETINFO", (PFN *) &_NetAccessSetInfo) || + DosQueryProcAddr(netapi, 0, "NETACCESSADD", (PFN *) &_NetAccessAdd)) + return FALSE; + +#if defined(__WATCOMC__) && defined(__386__) + NetAccessGetInfo = (PVOID) (ULONG) (PVOID16) NetAccessGetInfo; + NetAccessSetInfo = (PVOID) (ULONG) (PVOID16) NetAccessSetInfo; + NetAccessAdd = (PVOID) (ULONG) (PVOID16) NetAccessAdd; +#endif + + if ((path = _tmalloc(CCHMAXPATH)) == NULL) + return FALSE; + if ((data = _tmalloc(ACL_BUFFERSIZE)) == NULL) + return FALSE; + if ((ai = _tmalloc(sizeof(ACCINFO))) == NULL) + return -1; + + netapi_avail = TRUE; + + return netapi_avail; +} + +static void acl_mkpath(char *buffer, const char *source) +{ + char *ptr; + static char cwd[CCHMAXPATH]; + static U_INT cwdlen; + U_INT cdrive; + ULONG drivemap; + + if (isalpha(source[0]) && source[1] == ':') + buffer[0] = 0; /* fully qualified names */ + else + { + if (cwd[0] == 0) + { + DosQueryCurrentDisk(&cdrive, &drivemap); + cwd[0] = (char)(cdrive + '@'); + cwd[1] = ':'; + cwd[2] = '\\'; + cwdlen = sizeof(cwd) - 3; + DosQueryCurrentDir(0, cwd + 3, &cwdlen); + cwdlen = strlen(cwd); + } + + if (source[0] == '/' || source[0] == '\\') + { + if (source[1] == '/' || source[1] == '\\') + buffer[0] = 0; /* UNC names */ + else + { + strncpy(buffer, cwd, 2); + buffer[2] = 0; + } + } + else + { + strcpy(buffer, cwd); + if (cwd[cwdlen - 1] != '\\' && cwd[cwdlen - 1] != '/') + strcat(buffer, "/"); + } + } + + strcat(buffer, source); + + for (ptr = buffer; *ptr; ptr++) + if (*ptr == '/') + *ptr = '\\'; + + if (ptr[-1] == '\\') + ptr[-1] = 0; + + strupr(buffer); +} + +static int acl_bin2text(char *data, char *text) +{ + ACCINFO *ai; + ACCLIST *al; + U_INT cnt, offs; + + ai = (ACCINFO *) data; + al = (ACCLIST *) (data + sizeof(ACCINFO)); + + offs = sprintf(text, "ACL1:%X,%d\n", + ai -> acc_attr, ai -> acc_count); + + for (cnt = 0; cnt < ai -> acc_count; cnt++) + offs += sprintf(text + offs, "%s,%X\n", + al[cnt].acl_ugname, al[cnt].acl_access); + + return strlen(text); +} + +int acl_get(char *server, const char *resource, char *buffer) +{ + USHORT datalen; + PSZ srv = NULL; + int rc; + + if (!acl_init()) + return -1; + + if (server) + srv = server; + + acl_mkpath(path, resource); + datalen = 0; + + rc = NetAccessGetInfo(srv, path, 1, data, ACL_BUFFERSIZE, &datalen); + + if (rc == 0) + acl_bin2text(data, buffer); + + return rc; +} + +static int acl_text2bin(char *data, char *text, char *path) +{ + ACCINFO *ai; + ACCLIST *al; + char *ptr, *ptr2; + U_INT cnt; + + ai = (ACCINFO *) data; + ai -> acc_resource_name = PTR16(path); + + if (sscanf(text, "ACL1:%hX,%hd", + &ai -> acc_attr, &ai -> acc_count) != 2) + return ERROR_INVALID_PARAMETER; + + al = (ACCLIST *) (data + sizeof(ACCINFO)); + ptr = strchr(text, '\n') + 1; + + for (cnt = 0; cnt < ai -> acc_count; cnt++) + { + ptr2 = strchr(ptr, ','); + strncpy(al[cnt].acl_ugname, ptr, ptr2 - ptr); + al[cnt].acl_ugname[ptr2 - ptr] = 0; + sscanf(ptr2 + 1, "%hx", &al[cnt].acl_access); + ptr = strchr(ptr, '\n') + 1; + } + + return sizeof(ACCINFO) + ai -> acc_count * sizeof(ACCLIST); +} + +int acl_set(char *server, const char *resource, char *buffer) +{ + USHORT datalen; + PSZ srv = NULL; + + if (!acl_init()) + return -1; + + if (server) + srv = server; + + acl_mkpath(path, resource); + + ai -> acc_resource_name = PTR16(path); + ai -> acc_attr = 0; + ai -> acc_count = 0; + + NetAccessAdd(srv, 1, ai, sizeof(ACCINFO)); + /* Ignore any errors, most probably because ACL already exists. */ + /* In any such case, try updating the existing ACL. */ + + datalen = acl_text2bin(data, buffer, path); + + return NetAccessSetInfo(srv, path, 1, data, datalen, 0); +} + +/* end of os2acl.c */ diff --git a/utils/Install/sfxzip/process.c b/utils/Install/sfxzip/process.c new file mode 100644 index 0000000000..73be25466a --- /dev/null +++ b/utils/Install/sfxzip/process.c @@ -0,0 +1,1400 @@ +/*--------------------------------------------------------------------------- + + process.c + + This file contains the top-level routines for processing multiple zipfiles. + + Contains: process_zipfiles() + free_G_buffers() + do_seekable() + find_ecrec() + uz_end_central() + process_cdir_file_hdr() + get_cdir_ent() + process_local_file_hdr() + ef_scan_for_izux() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" +#ifdef WINDLL +# ifdef POCKET_UNZIP +# include "wince/intrface.h" +# else +# include "windll/windll.h" +# endif +#endif + +#include "install.h" +#include "instsup.h" +extern int installstate; + +off_t acelseek(off_t offset, int whence); +int aceread(void *buf, size_t count); +int aceopen(const char *path, int flags); +int aceclose(int fd); +int acesize(void); +int acetell(int fd); +char *replacestr(char *str1, char *str2, char *str3); + +static int do_seekable OF((__GPRO__ int lastchance)); +static int find_ecrec OF((__GPRO__ long searchlen)); + +static ZCONST char Far CannotAllocateBuffers[] = + "error: cannot allocate unzip buffers\n"; + +#ifdef SFX + static ZCONST char Far CannotFindMyself[] = + "unzipsfx: cannot find myself! [%s]\n"; + +#else /* !SFX */ + /* process_zipfiles() strings */ +# if (defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME)) + static ZCONST char Far WarnInvalidTZ[] = + "Warning: TZ environment variable not found, cannot use UTC times!!\n"; +# endif + static ZCONST char Far FilesProcessOK[] = + "%d archive%s successfully processed.\n"; + static ZCONST char Far ArchiveWarning[] = + "%d archive%s had warnings but no fatal errors.\n"; + static ZCONST char Far ArchiveFatalError[] = + "%d archive%s had fatal errors.\n"; + static ZCONST char Far FileHadNoZipfileDir[] = + "%d file%s had no zipfile directory.\n"; + static ZCONST char Far ZipfileWasDir[] = "1 \"zipfile\" was a directory.\n"; + static ZCONST char Far ManyZipfilesWereDir[] = + "%d \"zipfiles\" were directories.\n"; + static ZCONST char Far NoZipfileFound[] = "No zipfiles found.\n"; + + /* do_seekable() strings */ +# ifdef UNIX + static ZCONST char Far CannotFindZipfileDirMsg[] = + "%s: cannot find zipfile directory in one of %s or\n\ + %s%s.zip, and cannot find %s, period.\n"; + static ZCONST char Far CannotFindEitherZipfile[] = + "%s: cannot find %s, %s.zip or %s.\n"; /* ", so there" removed 970918 */ +# else /* !UNIX */ +# ifndef AMIGA + static ZCONST char Far CannotFindWildcardMatch[] = + "%s: cannot find any matches for wildcard specification \"%s\".\n"; +# endif /* !AMIGA */ + static ZCONST char Far CannotFindZipfileDirMsg[] = + "%s: cannot find zipfile directory in %s,\n\ + %sand cannot find %s, period.\n"; + static ZCONST char Far CannotFindEitherZipfile[] = + "%s: cannot find either %s or %s.\n"; /* ", so there" removed 970918 */ +# endif /* ?UNIX */ + extern ZCONST char Far Zipnfo[]; /* in unzip.c */ +#ifndef WINDLL + static ZCONST char Far Unzip[] = "unzip"; +#else + static ZCONST char Far Unzip[] = "UnZip DLL"; +#endif + static ZCONST char Far MaybeExe[] = + "note: %s may be a plain executable, not an archive\n"; + static ZCONST char Far CentDirNotInZipMsg[] = "\n\ + [%s]:\n\ + Zipfile is disk %u of a multi-disk archive, and this is not the disk on\n\ + which the central zipfile directory begins (disk %u).\n"; + static ZCONST char Far EndCentDirBogus[] = + "\nwarning [%s]: end-of-central-directory record claims this\n\ + is disk %u but that the central directory starts on disk %u; this is a\n\ + contradiction. Attempting to process anyway.\n"; +# ifdef NO_MULTIPART + static ZCONST char Far NoMultiDiskArcSupport[] = + "\nerror [%s]: zipfile is part of multi-disk archive\n\ + (sorry, not yet supported).\n"; + static ZCONST char Far MaybePakBug[] = "warning [%s]:\ + zipfile claims to be 2nd disk of a 2-part archive;\n\ + attempting to process anyway. If no further errors occur, this archive\n\ + was probably created by PAK v2.51 or earlier. This bug was reported to\n\ + NoGate in March 1991 and was supposed to have been fixed by mid-1991; as\n\ + of mid-1992 it still hadn't been. (If further errors do occur, archive\n\ + was probably created by PKZIP 2.04c or later; UnZip does not yet support\n\ + multi-part archives.)\n"; +# else + static ZCONST char Far MaybePakBug[] = "warning [%s]:\ + zipfile claims to be last disk of a multi-part archive;\n\ + attempting to process anyway, assuming all parts have been concatenated\n\ + together in order. Expect \"errors\" and warnings...true multi-part support\ +\n doesn't exist yet (coming soon).\n"; +# endif + static ZCONST char Far ExtraBytesAtStart[] = + "warning [%s]: %ld extra byte%s at beginning or within zipfile\n\ + (attempting to process anyway)\n"; +#endif /* ?SFX */ + +static ZCONST char Far MissingBytes[] = + "error [%s]: missing %ld bytes in zipfile\n\ + (attempting to process anyway)\n"; +static ZCONST char Far NullCentDirOffset[] = + "error [%s]: NULL central directory offset\n\ + (attempting to process anyway)\n"; +static ZCONST char Far ZipfileEmpty[] = "warning [%s]: zipfile is empty\n"; +static ZCONST char Far CentDirStartNotFound[] = + "error [%s]: start of central directory not found;\n\ + zipfile corrupt.\n%s"; +#ifndef SFX + static ZCONST char Far CentDirTooLong[] = + "error [%s]: reported length of central directory is\n\ + %ld bytes too long (Atari STZip zipfile? J.H.Holm ZIPSPLIT 1.1\n\ + zipfile?). Compensating...\n"; + static ZCONST char Far CentDirEndSigNotFound[] = "\ + End-of-central-directory signature not found. Either this file is not\n\ + a zipfile, or it constitutes one disk of a multi-part archive. In the\n\ + latter case the central directory and zipfile comment will be found on\n\ + the last disk(s) of this archive.\n"; +#else /* SFX */ + static ZCONST char Far CentDirEndSigNotFound[] = + " End-of-central-directory signature not found.\n"; +#endif /* ?SFX */ +static ZCONST char Far ZipfileCommTrunc1[] = + "\ncaution: zipfile comment truncated\n"; + + + + +/*******************************/ +/* Function process_zipfiles() */ +/*******************************/ + +int process_zipfiles(__G) /* return PK-type error code */ + __GDEF +{ +#ifndef SFX + char *lastzipfn = (char *)NULL; + int NumWinFiles, NumLoseFiles, NumWarnFiles; + int NumMissDirs, NumMissFiles; +#endif + int error=0, error_in_archive=0; + extern unsigned current_file; + extern char installdir2[]; + + +/*--------------------------------------------------------------------------- + Start by allocating buffers and (re)constructing the various PK signature + strings. + ---------------------------------------------------------------------------*/ + + G.inbuf = (uch *)malloc(INBUFSIZ + 4); /* 4 extra for hold[] (below) */ + G.outbuf = (uch *)malloc(OUTBUFSIZ + 1); /* 1 extra for string term. */ + + if ((G.inbuf == (uch *)NULL) || (G.outbuf == (uch *)NULL)) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotAllocateBuffers))); + return(PK_MEM); + } + G.hold = G.inbuf + INBUFSIZ; /* to check for boundary-spanning sigs */ +#ifndef VMS /* VMS uses its own buffer scheme for textmode flush(). */ +#ifdef SMALL_MEM + G.outbuf2 = G.outbuf+RAWBUFSIZ; /* never changes */ +#endif +#endif /* !VMS */ + +#if 0 /* CRC_32_TAB has been NULLified by CONSTRUCTGLOBALS !!!! */ + /* allocate the CRC table only later when we know we have a zipfile */ + CRC_32_TAB = NULL; +#endif /* 0 */ + + /* finish up initialization of magic signature strings */ + local_hdr_sig[0] /* = extd_local_sig[0] */ = 0x50; /* ASCII 'P', */ + central_hdr_sig[0] = end_central_sig[0] = 0x50; /* not EBCDIC */ + + local_hdr_sig[1] /* = extd_local_sig[1] */ = 0x4B; /* ASCII 'K', */ + central_hdr_sig[1] = end_central_sig[1] = 0x4B; /* not EBCDIC */ + +/*--------------------------------------------------------------------------- + Make sure timezone info is set correctly; localtime() returns GMT on + some OSes (e.g., Solaris 2.x) if this isn't done first. The ifdefs were + initially copied from dos_to_unix_time() in fileio.c. probably, they are + still too strict; any listed OS that supplies tzset(), regardless of + whether the function does anything, should be removed from the ifdefs. + ---------------------------------------------------------------------------*/ + +#if (defined(IZ_CHECK_TZ) && defined(USE_EF_UT_TIME)) +# ifndef VALID_TIMEZONE +# define VALID_TIMEZONE(tmp) \ + (((tmp = getenv("TZ")) != NULL) && (*tmp != '\0')) +# endif + { + char *p; + G.tz_is_valid = VALID_TIMEZONE(p); +# ifndef SFX + if (!G.tz_is_valid) { + Info(slide, 0x401, ((char *)slide, LoadFarString(WarnInvalidTZ))); + error_in_archive = error = PK_WARN; + } +# endif /* !SFX */ + } +#endif /* IZ_CHECK_TZ && USE_EF_UT_TIME */ + +/* For systems that do not have tzset() but supply this function using another + name (_tzset() or something similar), an appropiate "#define tzset ..." + should be added to the system specifc configuration section. */ +#if (!defined(T20_VMS) && !defined(MACOS) && !defined(RISCOS) && !defined(QDOS)) +#if (!defined(BSD) && !defined(MTS) && !defined(CMS_MVS) && !defined(TANDEM)) + tzset(); +#endif +#endif + +/*--------------------------------------------------------------------------- + Match (possible) wildcard zipfile specification with existing files and + attempt to process each. If no hits, try again after appending ".zip" + suffix. If still no luck, give up. + ---------------------------------------------------------------------------*/ + +#ifdef SFX + if ((error = do_seekable(__G__ 0)) == PK_NOZIP) { +#ifdef EXE_EXTENSION + int len=strlen(G.argv0); + + /* append .exe if appropriate; also .sfx? */ + if ( (G.zipfn = (char *)malloc(len+sizeof(EXE_EXTENSION))) != + (char *)NULL ) { + strcpy(G.zipfn, G.argv0); + strcpy(G.zipfn+len, EXE_EXTENSION); + error = do_seekable(__G__ 0); + free(G.zipfn); + G.zipfn = G.argv0; /* for "cannot find myself" message only */ + } +#endif /* EXE_EXTENSION */ +#ifdef WIN32 + G.zipfn = G.argv0; /* for "cannot find myself" message only */ +#endif + } + if (error) { + if (error == IZ_DIR) + error_in_archive = PK_NOZIP; + else + error_in_archive = error; + if (error == PK_NOZIP) + Info(slide, 1, ((char *)slide, LoadFarString(CannotFindMyself), + G.zipfn)); + } + +#else /* !SFX */ + NumWinFiles = NumLoseFiles = NumWarnFiles = 0; + current_file = NumMissDirs = NumMissFiles = 0; + + while ((G.zipfn = do_wild(__G__ G.wildzipfn)) != (char *)NULL) { + Trace((stderr, "do_wild( %s ) returns %s\n", G.wildzipfn, G.zipfn)); + + lastzipfn = G.zipfn; + + /* print a blank line between the output of different zipfiles */ + if (!uO.qflag && error != PK_NOZIP && error != IZ_DIR +#ifdef TIMESTAMP + && (!uO.T_flag || uO.zipinfo_mode) +#endif + && (NumWinFiles+NumLoseFiles+NumWarnFiles+NumMissFiles) > 0) + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + + if ((error = do_seekable(__G__ 0)) == PK_WARN) + ++NumWarnFiles; + else if (error == IZ_DIR) + ++NumMissDirs; + else if (error == PK_NOZIP) + ++NumMissFiles; + else if (error) + ++NumLoseFiles; + else + ++NumWinFiles; + + current_file = NumWinFiles; + + if(installstate == INSTALLING) + DoGUI(); + + if (error != IZ_DIR && error > error_in_archive) + error_in_archive = error; + Trace((stderr, "do_seekable(0) returns %d\n", error)); +#ifdef WINDLL + if (error == IZ_CTRLC) { + free_G_buffers(__G); + return error; + } +#endif + + } /* end while-loop (wildcard zipfiles) */ + + if ((NumWinFiles + NumWarnFiles + NumLoseFiles) == 0 && + (NumMissDirs + NumMissFiles) == 1 && lastzipfn != (char *)NULL) + { + NumMissDirs = NumMissFiles = 0; + if (error_in_archive == PK_NOZIP) + error_in_archive = PK_COOL; + +#if (!defined(UNIX) && !defined(AMIGA)) /* filenames with wildcard characters */ + if (iswild(G.wildzipfn)) + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotFindWildcardMatch), uO.zipinfo_mode? + LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip), + G.wildzipfn)); + else +#endif + { + char *p = lastzipfn + strlen(lastzipfn); + + G.zipfn = lastzipfn; + strcpy(p, ZSUFX); + +#if defined(UNIX) || defined(QDOS) + /* only Unix has case-sensitive filesystems */ + /* Well FlexOS (sometimes) also has them, but support is per media */ + /* and a pig to code for, so treat as case insensitive for now */ + /* we do this under QDOS to check for .zip as well as _zip */ + if ((error = do_seekable(__G__ 0)) == PK_NOZIP || error == IZ_DIR) { + if (error == IZ_DIR) + ++NumMissDirs; + strcpy(p, ALT_ZSUFX); + error = do_seekable(__G__ 1); + } +#else + error = do_seekable(__G__ 1); +#endif + if (error == PK_WARN) /* GRR: make this a switch/case stmt ... */ + ++NumWarnFiles; + else if (error == IZ_DIR) + ++NumMissDirs; + else if (error == PK_NOZIP) + /* increment again => bug: "1 file had no zipfile directory." */ + /* ++NumMissFiles */ ; + else if (error) + ++NumLoseFiles; + else + ++NumWinFiles; + + if (error > error_in_archive) + error_in_archive = error; + Trace((stderr, "do_seekable(1) returns %d\n", error)); +#ifdef WINDLL + if (error == IZ_CTRLC) { + free_G_buffers(__G); + return error; + } +#endif + } + } +#endif /* ?SFX */ + +/*--------------------------------------------------------------------------- + Print summary of all zipfiles, assuming zipfile spec was a wildcard (no + need for a summary if just one zipfile). + ---------------------------------------------------------------------------*/ + +#ifndef SFX + if (iswild(G.wildzipfn) && uO.qflag < 3 +#ifdef TIMESTAMP + && !(uO.T_flag && uO.qflag && !uO.zipinfo_mode) +#endif + ) + { + if ((NumMissFiles + NumLoseFiles + NumWarnFiles > 0 || NumWinFiles != 1) +#ifdef TIMESTAMP + && !(uO.T_flag && !uO.zipinfo_mode) +#endif + && !(uO.tflag && uO.qflag > 1)) + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0x401); + if ((NumWinFiles > 1) || (NumWinFiles == 1 && + NumMissDirs + NumMissFiles + NumLoseFiles + NumWarnFiles > 0)) + Info(slide, 0x401, ((char *)slide, LoadFarString(FilesProcessOK), + NumWinFiles, (NumWinFiles == 1)? " was" : "s were")); + if (NumWarnFiles > 0) + Info(slide, 0x401, ((char *)slide, LoadFarString(ArchiveWarning), + NumWarnFiles, (NumWarnFiles == 1)? "" : "s")); + if (NumLoseFiles > 0) + Info(slide, 0x401, ((char *)slide, LoadFarString(ArchiveFatalError), + NumLoseFiles, (NumLoseFiles == 1)? "" : "s")); + if (NumMissFiles > 0) + Info(slide, 0x401, ((char *)slide, + LoadFarString(FileHadNoZipfileDir), NumMissFiles, + (NumMissFiles == 1)? "" : "s")); + if (NumMissDirs == 1) + Info(slide, 0x401, ((char *)slide, LoadFarString(ZipfileWasDir))); + else if (NumMissDirs > 0) + Info(slide, 0x401, ((char *)slide, + LoadFarString(ManyZipfilesWereDir), NumMissDirs)); + if (NumWinFiles + NumLoseFiles + NumWarnFiles == 0) + Info(slide, 0x401, ((char *)slide, LoadFarString(NoZipfileFound))); + } +#endif /* !SFX */ + + /* free allocated memory */ + free_G_buffers(__G); + + return error_in_archive; + +} /* end function process_zipfiles() */ + + + + + +/*****************************/ +/* Function free_G_buffers() */ +/*****************************/ + +void free_G_buffers(__G) /* releases all memory allocated in global vars */ + __GDEF +{ + inflate_free(__G); + checkdir(__G__ (char *)NULL, END); + +#ifdef DYNALLOC_CRCTAB + if (CRC_32_TAB) { + free_crc_table(); + CRC_32_TAB = NULL; + } +#endif + + if (G.key != (char *)NULL) { + free(G.key); + G.key = (char *)NULL; + } + +#if (!defined(VMS) && !defined(SMALL_MEM)) + /* VMS uses its own buffer scheme for textmode flush() */ + if (G.outbuf2) { + free(G.outbuf2); /* malloc'd ONLY if unshrink and -a */ + G.outbuf2 = (uch *)NULL; + } +#endif + + if (G.outbuf) + free(G.outbuf); + if (G.inbuf) + free(G.inbuf); + G.inbuf = G.outbuf = (uch *)NULL; + +#ifdef MALLOC_WORK + if (G.area.Slide) { + free(G.area.Slide); + G.area.Slide = (uch *)NULL; + } +#endif + +} /* end function free_G_buffers() */ + + + + + +/**************************/ +/* Function do_seekable() */ +/**************************/ + +static int do_seekable(__G__ lastchance) /* return PK-type error code */ + __GDEF + int lastchance; +{ +#ifndef SFX + /* static int no_ecrec = FALSE; SKM: moved to globals.h */ + int maybe_exe=FALSE; + int too_weird_to_continue=FALSE; +#ifdef TIMESTAMP + time_t uxstamp; + unsigned nmember = 0; +#endif +#endif + int error=0, error_in_archive; + + +/*--------------------------------------------------------------------------- + Open the zipfile for reading in BINARY mode to prevent CR/LF translation, + which would corrupt the bit streams. + ---------------------------------------------------------------------------*/ + +#if 0 + if (SSTAT(G.zipfn, &G.statbuf) || + (error = S_ISDIR(G.statbuf.st_mode)) != 0) + { +#ifndef SFX + if (lastchance) { +#if defined(UNIX) || defined(QDOS) + if (G.no_ecrec) + Info(slide, 1, ((char *)slide, + LoadFarString(CannotFindZipfileDirMsg), uO.zipinfo_mode? + LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip), + G.wildzipfn, uO.zipinfo_mode? " " : "", G.wildzipfn, + G.zipfn)); + else + Info(slide, 1, ((char *)slide, + LoadFarString(CannotFindEitherZipfile), uO.zipinfo_mode? + LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip), + G.wildzipfn, G.wildzipfn, G.zipfn)); +#else /* !UNIX */ + if (G.no_ecrec) + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotFindZipfileDirMsg), uO.zipinfo_mode? + LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip), + G.wildzipfn, uO.zipinfo_mode? " " : "", G.zipfn)); + else + Info(slide, 0x401, ((char *)slide, + LoadFarString(CannotFindEitherZipfile), uO.zipinfo_mode? + LoadFarStringSmall(Zipnfo) : LoadFarStringSmall(Unzip), + G.wildzipfn, G.zipfn)); +#endif /* ?UNIX */ + } +#endif /* !SFX */ + return error? IZ_DIR : PK_NOZIP; + } + G.ziplen = G.statbuf.st_size; +#endif + G.ziplen = acesize(); + +#ifndef SFX +#if defined(UNIX) || defined(DOS_OS2_W32) + if (G.statbuf.st_mode & S_IEXEC) /* no extension on Unix exes: might */ + maybe_exe = TRUE; /* find unzip, not unzip.zip; etc. */ +#endif +#endif /* !SFX */ + +#ifdef VMS + if (check_format(__G)) /* check for variable-length format */ + return PK_ERR; +#endif + + if (open_input_file(__G)) /* this should never happen, given */ + return PK_NOZIP; /* the stat() test above, but... */ + +/*--------------------------------------------------------------------------- + Find and process the end-of-central-directory header. UnZip need only + check last 65557 bytes of zipfile: comment may be up to 65535, end-of- + central-directory record is 18 bytes, and signature itself is 4 bytes; + add some to allow for appended garbage. Since ZipInfo is often used as + a debugging tool, search the whole zipfile if zipinfo_mode is true. + ---------------------------------------------------------------------------*/ + + /* initialize the CRC table pointer (once) */ + if (CRC_32_TAB == NULL) { + if ((CRC_32_TAB = get_crc_table()) == NULL) + return PK_MEM; + } + +#if (!defined(SFX) || defined(SFX_EXDIR)) + /* check out if specified extraction root directory exists */ + if (uO.exdir != (char *)NULL && G.extract_flag) { + G.create_dirs = !uO.fflag; + if ((error = checkdir(__G__ uO.exdir, ROOT)) > 2) + return error; /* out of memory, or file in way */ + } +#endif /* !SFX || SFX_EXDIR */ + + G.cur_zipfile_bufstart = 0; + G.inptr = G.inbuf; + +#if (!defined(WINDLL) && !defined(SFX)) +#ifdef TIMESTAMP + if (!uO.zipinfo_mode && !uO.qflag && !uO.T_flag) +#else + if (!uO.zipinfo_mode && !uO.qflag) +#endif +#ifdef WIN32 /* Win32 console may require codepage conversion for G.zipfn */ + Info(slide, 0, ((char *)slide, "Archive: %s\n", FnFilter1(G.zipfn))); +#else + Info(slide, 0, ((char *)slide, "Archive: %s\n", G.zipfn)); +#endif +#endif /* !WINDLL && !SFX */ + + if (( +#ifndef NO_ZIPINFO + uO.zipinfo_mode && + ((error_in_archive = find_ecrec(__G__ G.ziplen)) != 0 || + (error_in_archive = zi_end_central(__G)) > PK_WARN)) + || (!uO.zipinfo_mode && +#endif + ((error_in_archive = find_ecrec(__G__ MIN(G.ziplen,66000L))) != 0 || + (error_in_archive = uz_end_central(__G)) > PK_WARN))) + { + CLOSE_INFILE(); + +#ifdef SFX + ++lastchance; /* avoid picky compiler warnings */ + return error_in_archive; +#else + if (maybe_exe) + Info(slide, 0x401, ((char *)slide, LoadFarString(MaybeExe), + G.zipfn)); + if (lastchance) + return error_in_archive; + else { + G.no_ecrec = TRUE; /* assume we found wrong file: e.g., */ + return PK_NOZIP; /* unzip instead of unzip.zip */ + } +#endif /* ?SFX */ + } + + if ((uO.zflag > 0) && !uO.zipinfo_mode) { /* unzip: zflag = comment ONLY */ + CLOSE_INFILE(); + return error_in_archive; + } + +/*--------------------------------------------------------------------------- + Test the end-of-central-directory info for incompatibilities (multi-disk + archives) or inconsistencies (missing or extra bytes in zipfile). + ---------------------------------------------------------------------------*/ + +#ifdef NO_MULTIPART + error = !uO.zipinfo_mode && (G.ecrec.number_this_disk == 1) && + (G.ecrec.num_disk_start_cdir == 1); +#else + error = !uO.zipinfo_mode && (G.ecrec.number_this_disk != 0); +#endif + +#ifndef SFX + if (uO.zipinfo_mode && + G.ecrec.number_this_disk != G.ecrec.num_disk_start_cdir) + { + if (G.ecrec.number_this_disk > G.ecrec.num_disk_start_cdir) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(CentDirNotInZipMsg), G.zipfn, + G.ecrec.number_this_disk, G.ecrec.num_disk_start_cdir)); + error_in_archive = PK_FIND; + too_weird_to_continue = TRUE; + } else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(EndCentDirBogus), G.zipfn, + G.ecrec.number_this_disk, G.ecrec.num_disk_start_cdir)); + error_in_archive = PK_WARN; + } +#ifdef NO_MULTIPART /* concatenation of multiple parts works in some cases */ + } else if (!uO.zipinfo_mode && !error && G.ecrec.number_this_disk != 0) { + Info(slide, 0x401, ((char *)slide, LoadFarString(NoMultiDiskArcSupport), + G.zipfn)); + error_in_archive = PK_FIND; + too_weird_to_continue = TRUE; +#endif + } + + if (!too_weird_to_continue) { /* (relatively) normal zipfile: go for it */ + if (error) { + Info(slide, 0x401, ((char *)slide, LoadFarString(MaybePakBug), + G.zipfn)); + error_in_archive = PK_WARN; + } +#endif /* !SFX */ + if ((G.extra_bytes = G.real_ecrec_offset-G.expect_ecrec_offset) < + (LONGINT)0) + { + Info(slide, 0x401, ((char *)slide, LoadFarString(MissingBytes), + G.zipfn, (long)(-G.extra_bytes))); + error_in_archive = PK_ERR; + } else if (G.extra_bytes > 0) { + if ((G.ecrec.offset_start_central_directory == 0) && + (G.ecrec.size_central_directory != 0)) /* zip 1.5 -go bug */ + { + Info(slide, 0x401, ((char *)slide, + LoadFarString(NullCentDirOffset), G.zipfn)); + G.ecrec.offset_start_central_directory = G.extra_bytes; + G.extra_bytes = 0; + error_in_archive = PK_ERR; + } +#ifndef SFX + else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(ExtraBytesAtStart), G.zipfn, + (long)G.extra_bytes, (G.extra_bytes == 1)? "":"s")); + error_in_archive = PK_WARN; + } +#endif /* !SFX */ + } + + /*----------------------------------------------------------------------- + Check for empty zipfile and exit now if so. + -----------------------------------------------------------------------*/ + + if (G.expect_ecrec_offset==0L && G.ecrec.size_central_directory==0) { + if (uO.zipinfo_mode) + Info(slide, 0, ((char *)slide, "%sEmpty zipfile.\n", + uO.lflag>9? "\n " : "")); + else + Info(slide, 0x401, ((char *)slide, LoadFarString(ZipfileEmpty), + G.zipfn)); + CLOSE_INFILE(); + return (error_in_archive > PK_WARN)? error_in_archive : PK_WARN; + } + + /*----------------------------------------------------------------------- + Compensate for missing or extra bytes, and seek to where the start + of central directory should be. If header not found, uncompensate + and try again (necessary for at least some Atari archives created + with STZip, as well as archives created by J.H. Holm's ZIPSPLIT 1.1). + -----------------------------------------------------------------------*/ + + ZLSEEK( G.ecrec.offset_start_central_directory ) +#ifdef OLD_SEEK_TEST + if (readbuf(G.sig, 4) == 0) { + CLOSE_INFILE(); + return PK_ERR; /* file may be locked, or possibly disk error(?) */ + } + if (strncmp(G.sig, central_hdr_sig, 4)) +#else + if ((readbuf(__G__ G.sig, 4) == 0) || + strncmp(G.sig, central_hdr_sig, 4)) +#endif + { +#ifndef SFX + long tmp = G.extra_bytes; +#endif + + G.extra_bytes = 0; + ZLSEEK( G.ecrec.offset_start_central_directory ) + if ((readbuf(__G__ G.sig, 4) == 0) || + strncmp(G.sig, central_hdr_sig, 4)) + { + Info(slide, 0x401, ((char *)slide, + LoadFarString(CentDirStartNotFound), G.zipfn, + LoadFarStringSmall(ReportMsg))); + CLOSE_INFILE(); + return PK_BADERR; + } +#ifndef SFX + Info(slide, 0x401, ((char *)slide, LoadFarString(CentDirTooLong), + G.zipfn, -tmp)); +#endif + error_in_archive = PK_ERR; + } + + /*----------------------------------------------------------------------- + Seek to the start of the central directory one last time, since we + have just read the first entry's signature bytes; then list, extract + or test member files as instructed, and close the zipfile. + -----------------------------------------------------------------------*/ + + Trace((stderr, "about to extract/list files (error = %d)\n", + error_in_archive)); + + ZLSEEK( G.ecrec.offset_start_central_directory ) + +#ifdef DLL + /* G.fValidate is used only to look at an archive to see if + it appears to be a valid archive. There is no interest + in what the archive contains, nor in validating that the + entries in the archive are in good condition. This is + currently used only in the Windows DLLs for purposes of + checking archives within an archive to determine whether + or not to display the inner archives. + */ + if (!G.fValidate) +#endif + { +#ifndef NO_ZIPINFO + if (uO.zipinfo_mode) + error = zipinfo(__G); /* ZIPINFO 'EM */ + else +#endif +#ifndef SFX +#ifdef TIMESTAMP + if (uO.T_flag) + error = get_time_stamp(__G__ &uxstamp, &nmember); + else +#endif + if (uO.vflag && !uO.tflag && !uO.cflag) + error = list_files(__G); /* LIST 'EM */ + else +#endif /* !SFX */ + error = extract_or_test_files(__G); /* EXTRACT OR TEST 'EM */ + + Trace((stderr, "done with extract/list files (error = %d)\n", + error)); + } + + if (error > error_in_archive) /* don't overwrite stronger error */ + error_in_archive = error; /* with (for example) a warning */ +#ifndef SFX + } /* end if (!too_weird_to_continue) */ +#endif + + CLOSE_INFILE(); + +#ifdef TIMESTAMP + if (uO.T_flag && !uO.zipinfo_mode && (nmember > 0)) { +# ifdef WIN32 + if (stamp_file(__G__ G.zipfn, uxstamp)) { /* TIME-STAMP 'EM */ +# else + if (stamp_file(G.zipfn, uxstamp)) { /* TIME-STAMP 'EM */ +# endif + Info(slide, 0x201, ((char *)slide, + "warning: cannot set time for %s\n", G.zipfn)); + if (error_in_archive < PK_WARN) + error_in_archive = PK_WARN; + } + } +#endif + return error_in_archive; + +} /* end function do_seekable() */ + + + + + +/*************************/ +/* Function find_ecrec() */ +/*************************/ + +static int find_ecrec(__G__ searchlen) /* return PK-class error */ + __GDEF + long searchlen; +{ + int i, numblks, found=FALSE; + LONGINT tail_len; + ec_byte_rec byterec; + + +/*--------------------------------------------------------------------------- + Treat case of short zipfile separately. + ---------------------------------------------------------------------------*/ + + if (G.ziplen <= INBUFSIZ) { + acelseek(0L, SEEK_SET); + if ((G.incnt = aceread((char *)G.inbuf,(unsigned int)G.ziplen)) + == (int)G.ziplen) + + /* 'P' must be at least 22 bytes from end of zipfile */ + for (G.inptr = G.inbuf+(int)G.ziplen-22; G.inptr >= G.inbuf; + --G.inptr) + if ((native(*G.inptr) == 'P') && + !strncmp((char *)G.inptr, end_central_sig, 4)) { + G.incnt -= (int)(G.inptr - G.inbuf); + found = TRUE; + break; + } + +/*--------------------------------------------------------------------------- + Zipfile is longer than INBUFSIZ: may need to loop. Start with short + block at end of zipfile (if not TOO short). + ---------------------------------------------------------------------------*/ + + } else { + if ((tail_len = G.ziplen % INBUFSIZ) > ECREC_SIZE) { +#ifdef USE_STRM_INPUT + fseek((FILE *)G.zipfd, G.ziplen-tail_len, SEEK_SET); + G.cur_zipfile_bufstart = ftell((FILE *)G.zipfd); +#else /* !USE_STRM_INPUT */ + G.cur_zipfile_bufstart = acelseek(G.ziplen-tail_len, + SEEK_SET); +#endif /* ?USE_STRM_INPUT */ + if ((G.incnt = aceread((char *)G.inbuf, + (unsigned int)tail_len)) != (int)tail_len) + goto fail; /* it's expedient... */ + + /* 'P' must be at least 22 bytes from end of zipfile */ + for (G.inptr = G.inbuf+(int)tail_len-22; G.inptr >= G.inbuf; + --G.inptr) + if ((native(*G.inptr) == 'P') && + !strncmp((char *)G.inptr, end_central_sig, 4)) { + G.incnt -= (int)(G.inptr - G.inbuf); + found = TRUE; + break; + } + /* sig may span block boundary: */ + strncpy((char *)G.hold, (char *)G.inbuf, 3); + } else + G.cur_zipfile_bufstart = G.ziplen - tail_len; + + /*----------------------------------------------------------------------- + Loop through blocks of zipfile data, starting at the end and going + toward the beginning. In general, need not check whole zipfile for + signature, but may want to do so if testing. + -----------------------------------------------------------------------*/ + + numblks = (int)((searchlen - tail_len + (INBUFSIZ-1)) / INBUFSIZ); + /* ==amount= ==done== ==rounding== =blksiz= */ + + for (i = 1; !found && (i <= numblks); ++i) { + G.cur_zipfile_bufstart -= INBUFSIZ; + acelseek(G.cur_zipfile_bufstart, SEEK_SET); + if ((G.incnt = aceread((char *)G.inbuf,INBUFSIZ)) + != INBUFSIZ) + break; /* fall through and fail */ + + for (G.inptr = G.inbuf+INBUFSIZ-1; G.inptr >= G.inbuf; + --G.inptr) + if ((native(*G.inptr) == 'P') && + !strncmp((char *)G.inptr, end_central_sig, 4)) { + G.incnt -= (int)(G.inptr - G.inbuf); + found = TRUE; + break; + } + /* sig may span block boundary: */ + strncpy((char *)G.hold, (char *)G.inbuf, 3); + } + } /* end if (ziplen > INBUFSIZ) */ + +/*--------------------------------------------------------------------------- + Searched through whole region where signature should be without finding + it. Print informational message and die a horrible death. + ---------------------------------------------------------------------------*/ + +fail: + if (!found) { + if (uO.qflag || uO.zipinfo_mode) + Info(slide, 0x401, ((char *)slide, "[%s]\n", G.zipfn)); + Info(slide, 0x401, ((char *)slide, + LoadFarString(CentDirEndSigNotFound))); + return PK_ERR; /* failed */ + } + +/*--------------------------------------------------------------------------- + Found the signature, so get the end-central data before returning. Do + any necessary machine-type conversions (byte ordering, structure padding + compensation) by reading data into character array and copying to struct. + ---------------------------------------------------------------------------*/ + + G.real_ecrec_offset = G.cur_zipfile_bufstart + (G.inptr-G.inbuf); +#ifdef TEST + pipeit("\n found end-of-central-dir signature at offset %ld (%.8lXh)\n", + G.real_ecrec_offset, G.real_ecrec_offset); + pipeit(" from beginning of file; offset %d (%.4Xh) within block\n", + G.inptr-G.inbuf, G.inptr-G.inbuf); +#endif + + if (readbuf(__G__ (char *)byterec, ECREC_SIZE+4) == 0) + return PK_EOF; + + G.ecrec.number_this_disk = + makeword(&byterec[NUMBER_THIS_DISK]); + G.ecrec.num_disk_start_cdir = + makeword(&byterec[NUM_DISK_WITH_START_CENTRAL_DIR]); + G.ecrec.num_entries_centrl_dir_ths_disk = + makeword(&byterec[NUM_ENTRIES_CENTRL_DIR_THS_DISK]); + G.ecrec.total_entries_central_dir = + makeword(&byterec[TOTAL_ENTRIES_CENTRAL_DIR]); + G.ecrec.size_central_directory = + makelong(&byterec[SIZE_CENTRAL_DIRECTORY]); + G.ecrec.offset_start_central_directory = + makelong(&byterec[OFFSET_START_CENTRAL_DIRECTORY]); + G.ecrec.zipfile_comment_length = + makeword(&byterec[ZIPFILE_COMMENT_LENGTH]); + + G.expect_ecrec_offset = G.ecrec.offset_start_central_directory + + G.ecrec.size_central_directory; + return PK_COOL; + +} /* end function find_ecrec() */ + + + + + +/*****************************/ +/* Function uz_end_central() */ +/*****************************/ + +int uz_end_central(__G) /* return PK-type error code */ + __GDEF +{ + int error = PK_COOL; + + +/*--------------------------------------------------------------------------- + Get the zipfile comment (up to 64KB long), if any, and print it out. + Then position the file pointer to the beginning of the central directory + and fill buffer. + ---------------------------------------------------------------------------*/ + +#ifdef WINDLL + /* for comment button: */ + if ((!G.fValidate) && (G.lpUserFunctions != NULL)) + G.lpUserFunctions->cchComment = G.ecrec.zipfile_comment_length; + if (G.ecrec.zipfile_comment_length && (uO.zflag > 0)) +#else /* !WINDLL */ + if (G.ecrec.zipfile_comment_length && (uO.zflag > 0 || + (uO.zflag == 0 && +#ifdef TIMESTAMP + !uO.T_flag && +#endif + !uO.qflag))) +#endif /* ?WINDLL */ + { + if (do_string(__G__ G.ecrec.zipfile_comment_length, DISPLAY)) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(ZipfileCommTrunc1))); + error = PK_WARN; + } + } + return error; + +} /* end function uz_end_central() */ + + + + + +/************************************/ +/* Function process_cdir_file_hdr() */ +/************************************/ + +int process_cdir_file_hdr(__G) /* return PK-type error code */ + __GDEF +{ + int error; + + +/*--------------------------------------------------------------------------- + Get central directory info, save host and method numbers, and set flag + for lowercase conversion of filename, depending on the OS from which the + file is coming. + ---------------------------------------------------------------------------*/ + + if ((error = get_cdir_ent(__G)) != 0) + return error; + + G.pInfo->hostnum = MIN(G.crec.version_made_by[1], NUM_HOSTS); +/* extnum = MIN(crec.version_needed_to_extract[1], NUM_HOSTS); */ + + G.pInfo->lcflag = 0; + if (uO.L_flag) /* user specified case-conversion */ + switch (G.pInfo->hostnum) { + case FS_FAT_: /* PKZIP and zip -k store in uppercase */ + case CPM_: /* like MS-DOS, right? */ + case VM_CMS_: /* all caps? */ + case MVS_: /* all caps? */ + case TANDEM_: + case TOPS20_: + case VMS_: /* our Zip uses lowercase, but ASi's doesn't */ + /* case Z_SYSTEM_: ? */ + /* case QDOS_: ? */ + G.pInfo->lcflag = 1; /* convert filename to lowercase */ + break; + + default: /* AMIGA_, FS_HPFS_, FS_NTFS_, MAC_, UNIX_, ATARI_, */ + break; /* FS_VFAT_, BEOS_ (Z_SYSTEM_): no conversion */ + } + + /* do Amigas (AMIGA_) also have volume labels? */ + if (IS_VOLID(G.crec.external_file_attributes) && + (G.pInfo->hostnum == FS_FAT_ || G.pInfo->hostnum == FS_HPFS_ || + G.pInfo->hostnum == FS_NTFS_ || G.pInfo->hostnum == ATARI_)) + { + G.pInfo->vollabel = TRUE; + G.pInfo->lcflag = 0; /* preserve case of volume labels */ + } else + G.pInfo->vollabel = FALSE; + + return PK_COOL; + +} /* end function process_cdir_file_hdr() */ + + + + + +/***************************/ +/* Function get_cdir_ent() */ +/***************************/ + +int get_cdir_ent(__G) /* return PK-type error code */ + __GDEF +{ + cdir_byte_hdr byterec; + + +/*--------------------------------------------------------------------------- + Read the next central directory entry and do any necessary machine-type + conversions (byte ordering, structure padding compensation--do so by + copying the data from the array into which it was read (byterec) to the + usable struct (crec)). + ---------------------------------------------------------------------------*/ + + if (readbuf(__G__ (char *)byterec, CREC_SIZE) == 0) + return PK_EOF; + + G.crec.version_made_by[0] = byterec[C_VERSION_MADE_BY_0]; + G.crec.version_made_by[1] = byterec[C_VERSION_MADE_BY_1]; + G.crec.version_needed_to_extract[0] = + byterec[C_VERSION_NEEDED_TO_EXTRACT_0]; + G.crec.version_needed_to_extract[1] = + byterec[C_VERSION_NEEDED_TO_EXTRACT_1]; + + G.crec.general_purpose_bit_flag = + makeword(&byterec[C_GENERAL_PURPOSE_BIT_FLAG]); + G.crec.compression_method = + makeword(&byterec[C_COMPRESSION_METHOD]); + G.crec.last_mod_dos_datetime = + makelong(&byterec[C_LAST_MOD_DOS_DATETIME]); + G.crec.crc32 = + makelong(&byterec[C_CRC32]); + G.crec.csize = + makelong(&byterec[C_COMPRESSED_SIZE]); + G.crec.ucsize = + makelong(&byterec[C_UNCOMPRESSED_SIZE]); + G.crec.filename_length = + makeword(&byterec[C_FILENAME_LENGTH]); + G.crec.extra_field_length = + makeword(&byterec[C_EXTRA_FIELD_LENGTH]); + G.crec.file_comment_length = + makeword(&byterec[C_FILE_COMMENT_LENGTH]); + G.crec.disk_number_start = + makeword(&byterec[C_DISK_NUMBER_START]); + G.crec.internal_file_attributes = + makeword(&byterec[C_INTERNAL_FILE_ATTRIBUTES]); + G.crec.external_file_attributes = + makelong(&byterec[C_EXTERNAL_FILE_ATTRIBUTES]); /* LONG, not word! */ + G.crec.relative_offset_local_header = + makelong(&byterec[C_RELATIVE_OFFSET_LOCAL_HEADER]); + + return PK_COOL; + +} /* end function get_cdir_ent() */ + + + + + +/*************************************/ +/* Function process_local_file_hdr() */ +/*************************************/ + +int process_local_file_hdr(__G) /* return PK-type error code */ + __GDEF +{ + local_byte_hdr byterec; + + +/*--------------------------------------------------------------------------- + Read the next local file header and do any necessary machine-type con- + versions (byte ordering, structure padding compensation--do so by copy- + ing the data from the array into which it was read (byterec) to the + usable struct (lrec)). + ---------------------------------------------------------------------------*/ + + if (readbuf(__G__ (char *)byterec, LREC_SIZE) == 0) + return PK_EOF; + + G.lrec.version_needed_to_extract[0] = + byterec[L_VERSION_NEEDED_TO_EXTRACT_0]; + G.lrec.version_needed_to_extract[1] = + byterec[L_VERSION_NEEDED_TO_EXTRACT_1]; + + G.lrec.general_purpose_bit_flag = + makeword(&byterec[L_GENERAL_PURPOSE_BIT_FLAG]); + G.lrec.compression_method = makeword(&byterec[L_COMPRESSION_METHOD]); + G.lrec.last_mod_dos_datetime = makelong(&byterec[L_LAST_MOD_DOS_DATETIME]); + G.lrec.crc32 = makelong(&byterec[L_CRC32]); + G.lrec.csize = makelong(&byterec[L_COMPRESSED_SIZE]); + G.lrec.ucsize = makelong(&byterec[L_UNCOMPRESSED_SIZE]); + G.lrec.filename_length = makeword(&byterec[L_FILENAME_LENGTH]); + G.lrec.extra_field_length = makeword(&byterec[L_EXTRA_FIELD_LENGTH]); + + G.csize = (long) G.lrec.csize; + G.ucsize = (long) G.lrec.ucsize; + + if ((G.lrec.general_purpose_bit_flag & 8) != 0) { + /* can't trust local header, use central directory: */ + G.lrec.crc32 = G.pInfo->crc; + G.csize = (long)(G.lrec.csize = G.pInfo->compr_size); + G.ucsize = (long)(G.lrec.ucsize = G.pInfo->uncompr_size); + } + + return PK_COOL; + +} /* end function process_local_file_hdr() */ + + +#ifdef USE_EF_UT_TIME + +/*******************************/ +/* Function ef_scan_for_izux() */ +/*******************************/ + +unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime, + z_utim, z_uidgid) + uch *ef_buf; /* buffer containing extra field */ + unsigned ef_len; /* total length of extra field */ + int ef_is_c; /* flag indicating "is central extra field" */ + ulg dos_mdatetime; /* last_mod_file_date_time in DOS format */ + iztimes *z_utim; /* return storage: atime, mtime, ctime */ + ush *z_uidgid; /* return storage: uid and gid */ +{ + unsigned flags = 0; + unsigned eb_id; + unsigned eb_len; + int have_new_type_eb = FALSE; + int ut_zip_unzip_compatible = FALSE; + +/*--------------------------------------------------------------------------- + This function scans the extra field for EF_TIME, EF_IZUNIX2, EF_IZUNIX, or + EF_PKUNIX blocks containing Unix-style time_t (GMT) values for the entry's + access, creation, and modification time. + If a valid block is found, the time stamps are copied to the iztimes + structure (provided the z_utim pointer is not NULL). + If a IZUNIX2 block is found or the IZUNIX block contains UID/GID fields, + and the z_uidgid array pointer is valid (!= NULL), the owner info is + transfered as well. + The presence of an EF_TIME or EF_IZUNIX2 block results in ignoring all + data from probably present obsolete EF_IZUNIX blocks. + If multiple blocks of the same type are found, only the information from + the last block is used. + The return value is a combination of the EF_TIME Flags field with an + additional flag bit indicating the presence of valid UID/GID info, + or 0 in case of failure. + ---------------------------------------------------------------------------*/ + + if (ef_len == 0 || ef_buf == NULL || (z_utim == 0 && z_uidgid == NULL)) + return 0; + + TTrace((stderr,"\nef_scan_for_izux: scanning extra field of length %u\n", + ef_len)); + + while (ef_len >= EB_HEADSIZE) { + eb_id = makeword(EB_ID + ef_buf); + eb_len = makeword(EB_LEN + ef_buf); + + if (eb_len > (ef_len - EB_HEADSIZE)) { + /* discovered some extra field inconsistency! */ + TTrace((stderr, + "ef_scan_for_izux: block length %u > rest ef_size %u\n", eb_len, + ef_len - EB_HEADSIZE)); + break; + } + + switch (eb_id) { + case EF_TIME: + flags &= ~0x0ff; /* ignore previous IZUNIX or EF_TIME fields */ + have_new_type_eb = TRUE; + if ( eb_len >= EB_UT_MINLEN && z_utim != NULL) { + unsigned eb_idx = EB_UT_TIME1; + TTrace((stderr,"ef_scan_for_izux: found TIME extra field\n")); + flags |= (ef_buf[EB_HEADSIZE+EB_UT_FLAGS] & 0x0ff); + if ((flags & EB_UT_FL_MTIME)) { + if ((eb_idx+4) <= eb_len) { + z_utim->mtime = makelong((EB_HEADSIZE+eb_idx) + ef_buf); + eb_idx += 4; + TTrace((stderr," UT e.f. modification time = %ld\n", + z_utim->mtime)); + + if ((ulg)(z_utim->mtime) & (ulg)(0x80000000L)) { + ut_zip_unzip_compatible = + ((time_t)0x80000000L < (time_t)0L) + ? (dos_mdatetime == DOSTIME_MINIMUM) + : (dos_mdatetime >= DOSTIME_2038_01_18); + if (!ut_zip_unzip_compatible) { + /* UnZip interpretes mtime differently than Zip; + without modtime: ignore complete UT field */ + flags &= ~0x0ff; /* no time_t times available */ + TTrace((stderr, + " UT modtime range error; ignore e.f.!\n")); + break; /* stop scanning this field */ + } + } else { + /* cannot determine, safe assumption is FALSE */ + ut_zip_unzip_compatible = FALSE; + } + } else { + flags &= ~EB_UT_FL_MTIME; + TTrace((stderr," UT e.f. truncated; no modtime\n")); + } + } + if (ef_is_c) { + break; /* central version of TIME field ends here */ + } + + if (flags & EB_UT_FL_ATIME) { + if ((eb_idx+4) <= eb_len) { + z_utim->atime = makelong((EB_HEADSIZE+eb_idx) + ef_buf); + eb_idx += 4; + TTrace((stderr," UT e.f. access time = %ld\n", + z_utim->atime)); + if (((ulg)(z_utim->atime) & (ulg)(0x80000000L)) && + !ut_zip_unzip_compatible) { + flags &= ~EB_UT_FL_ATIME; + TTrace((stderr, + " UT access time range error: skip time!\n")); + } + } else { + flags &= ~EB_UT_FL_ATIME; + } + } + if (flags & EB_UT_FL_CTIME) { + if ((eb_idx+4) <= eb_len) { + z_utim->ctime = makelong((EB_HEADSIZE+eb_idx) + ef_buf); + TTrace((stderr," UT e.f. creation time = %ld\n", + z_utim->ctime)); + if (((ulg)(z_utim->ctime) & (ulg)(0x80000000L)) && + !ut_zip_unzip_compatible) { + flags &= ~EB_UT_FL_CTIME; + TTrace((stderr, + " UT creation time range error: skip time!\n")); + } + } else { + flags &= ~EB_UT_FL_CTIME; + } + } + } + break; + + case EF_IZUNIX2: + if (!have_new_type_eb) { + flags &= ~0x0ff; /* ignore any previous IZUNIX field */ + have_new_type_eb = TRUE; + } + if (eb_len >= EB_UX2_MINLEN && z_uidgid != NULL) { + z_uidgid[0] = makeword((EB_HEADSIZE+EB_UX2_UID) + ef_buf); + z_uidgid[1] = makeword((EB_HEADSIZE+EB_UX2_GID) + ef_buf); + flags |= EB_UX2_VALID; /* signal success */ + } + break; + + case EF_IZUNIX: + case EF_PKUNIX: /* PKUNIX e.f. layout is identical to IZUNIX */ + if (eb_len >= EB_UX_MINLEN) { + TTrace((stderr,"ef_scan_for_izux: found %s extra field\n", + (eb_id == EF_IZUNIX ? "IZUNIX" : "PKUNIX"))); + if (have_new_type_eb) { + break; /* Ignore IZUNIX extra field block ! */ + } + if (z_utim != NULL) { + z_utim->atime = makelong((EB_HEADSIZE+EB_UX_ATIME)+ef_buf); + z_utim->mtime = makelong((EB_HEADSIZE+EB_UX_MTIME)+ef_buf); + TTrace((stderr," Unix EF actime = %ld\n", z_utim->atime)); + TTrace((stderr," Unix EF modtime = %ld\n", z_utim->mtime)); + flags |= (EB_UT_FL_MTIME | EB_UT_FL_ATIME); + if ((ulg)(z_utim->mtime) & (ulg)(0x80000000L)) { + ut_zip_unzip_compatible = + ((time_t)0x80000000L < (time_t)0L) + ? (dos_mdatetime == DOSTIME_MINIMUM) + : (dos_mdatetime >= DOSTIME_2038_01_18); + if (!ut_zip_unzip_compatible) { + /* UnZip interpretes mtime differently than Zip; + without modtime: ignore complete UT field */ + flags &= ~0x0ff; /* no time_t times available */ + TTrace((stderr, + " UX modtime range error: ignore e.f.!\n")); + } + } else { + /* cannot determine, safe assumption is FALSE */ + ut_zip_unzip_compatible = FALSE; + } + if ((ulg)(z_utim->atime) & (ulg)(0x80000000L) && + !ut_zip_unzip_compatible && (flags & 0x0ff)) { + /* atime not in range of UnZip's time_t */ + flags &= ~EB_UT_FL_ATIME; + TTrace((stderr, + " UX access time range error: skip time!\n")); + } + } + if (eb_len >= EB_UX_FULLSIZE && z_uidgid != NULL) { + z_uidgid[0] = makeword((EB_HEADSIZE+EB_UX_UID) + ef_buf); + z_uidgid[1] = makeword((EB_HEADSIZE+EB_UX_GID) + ef_buf); + flags |= EB_UX2_VALID; + } + } + break; + + default: + break; + } + + /* Skip this extra field block */ + ef_buf += (eb_len + EB_HEADSIZE); + ef_len -= (eb_len + EB_HEADSIZE); + } + + return flags; +} + +#endif /* USE_EF_UT_TIME */ diff --git a/utils/Install/sfxzip/rexxapi.c b/utils/Install/sfxzip/rexxapi.c new file mode 100644 index 0000000000..43b4ddde3e --- /dev/null +++ b/utils/Install/sfxzip/rexxapi.c @@ -0,0 +1,886 @@ +/********************************************************************** +* REXXAPI.C * +* * +* This program adds a ZIP engine directly to the REXX language. * +* The functions are: * +* UZDropFuncs -- Makes all functions in this package * +* unknown to REXX. * +* UZLoadFuncs -- Makes all functions in this package * +* known to REXX so REXX programs may * +* call them. * +* UZFileTree -- Searches for files matching a given * +* filespec, including files in * +* subdirectories. * +* UZUnZip -- Unzip command-line entry point. * +* This is functionally equivalent to * +* using Unzip as an external program. * +* UZUnZipToVar -- Unzip one file to a variable * +* UZUnZipToStem -- Unzip files to a variable array * +* UZVer -- Returns the Unzip version number * +* * +**********************************************************************/ +/* Include files */ + +#ifdef OS2DLL + +#define INCL_DOS +#define INCL_DOSMEMMGR +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> + +#define UNZIP_INTERNAL +#include "../unzip.h" +#include "../version.h" + + +/*********************************************************************/ +/* Various definitions used by various functions. */ +/*********************************************************************/ + +RexxFunctionHandler UZDropFuncs; +RexxFunctionHandler UZLoadFuncs; +RexxFunctionHandler UZFileTree; +RexxFunctionHandler UZUnZip; +RexxFunctionHandler UZUnZipToVar; +RexxFunctionHandler UZUnZipToStem; +RexxFunctionHandler UZVer; +RexxFunctionHandler UZAPIVer; + + +int SetOutputVar(__GPRO__ const char *name); +int SetOutputVarStem(__GPRO__ const char *name); +int SetOutputVarLength(__GPRO); +int WriteToVariable(__GPRO__ const char *name, char *buffer, int len); +int PrintToSubVariable(__GPRO__ int idx, const char *format,...); +int PrintToVariable(__GPRO__ const char *name, const char *format,...); +int _PrintToVariable(__GPRO__ const char *name, const char *format, va_list arg_ptr); +int TextSetNext(__GPRO__ char *format, int len, int all); + +#define EZRXSTRING(r,p) {(r).strptr=(PCH)p;(r).strlength=(ULONG)strlen((r).strptr);} + + +/*********************************************************************/ +/* RxFncTable */ +/* Array of names of the UNZIPAPI functions. */ +/* This list is used for registration and deregistration. */ +/*********************************************************************/ + +static PSZ RxFncTable[] = + { + "UZDropFuncs", + "UZLoadFuncs", + "UZFileSearch", + "UZFileTree", + "UZUnZip", + "UZUnZipToVar", + "UZUnZipToStem", + "UZVer", + }; + +/*********************************************************************/ +/* Numeric Error Return Strings */ +/*********************************************************************/ + +#define NO_UTIL_ERROR "0" /* No error whatsoever */ +#define ERROR_NOMEM "2" /* Insufficient memory */ + +/*********************************************************************/ +/* Numeric Return calls */ +/*********************************************************************/ + +#define INVALID_ROUTINE 40 /* Raise Rexx error */ +#define VALID_ROUTINE 0 /* Successful completion */ + +/*********************************************************************/ +/* Some useful macros */ +/*********************************************************************/ + +#define BUILDRXSTRING(t, s) { \ + strcpy((t)->strptr,(s));\ + (t)->strlength = strlen((s)); \ +} + + +/*********************************************************************/ +/**************** UNZIPAPI Supporting Functions ********************/ +/**************** UNZIPAPI Supporting Functions ********************/ +/**************** UNZIPAPI Supporting Functions ********************/ +/*********************************************************************/ + + +int RexxReturn(__GPRO__ int nodefault, RXSTRING *retstr) +{ + int ret = G.os2.rexx_error; + if (G.filenotfound) + G.os2.rexx_mes = "file not found"; + if (*G.os2.rexx_mes != '0') { + if (retstr->strlength > 255) { + DosFreeMem(retstr->strptr); + retstr->strptr = NULL; + } + } else if (nodefault) + goto noBuild; + BUILDRXSTRING(retstr, G.os2.rexx_mes); + noBuild: + DESTROYGLOBALS(); + return ret; +} + +/* Get a variable from REXX, return 0 if OK */ +int GetVariable(__GPRO__ const char *name) +{ + G.os2.request.shvnext = NULL; + EZRXSTRING(G.os2.request.shvname, name); + G.os2.request.shvnamelen = G.os2.request.shvname.strlength; + G.os2.request.shvvalue.strptr = G.os2.buffer; + G.os2.request.shvvalue.strlength = IBUF_LEN; + G.os2.request.shvvaluelen = IBUF_LEN; + G.os2.request.shvcode = RXSHV_SYFET; + G.os2.request.shvret = 0; + switch (RexxVariablePool(&G.os2.request)) { + case RXSHV_MEMFL: + G.os2.rexx_mes = ERROR_NOMEM; + break; + case RXSHV_BADN: + case RXSHV_NEWV: + G.os2.request.shvvaluelen = 0; + case RXSHV_OK: + *(G.os2.buffer+G.os2.request.shvvaluelen) = 0; + return G.os2.request.shvvaluelen; + } + return 0; +} + + +/* Get REXX compound variable */ +/* Stem must exist in G.os2.getvar_buf w/ length in G.os2.getvar_len */ +int GetVariableIndex(__GPRO__ int index) +{ + sprintf(G.os2.getvar_buf+G.os2.getvar_len,"%d",index); + return GetVariable(__G__ G.os2.getvar_buf); +} + + +/* Transfer REXX array to standard C string array */ +/* Returns number of elements */ +/* User is responsible for calling KillStringArray */ + +int CompoundToStringArray(__GPRO__ char ***pointer, const char *name) +{ + int count; + int total; + char **trav; + + G.os2.getvar_len = strlen(name); + memcpy(G.os2.getvar_buf,name,G.os2.getvar_len+1); + if (*(G.os2.getvar_buf+G.os2.getvar_len-1) != '.') + *(G.os2.getvar_buf+G.os2.getvar_len++) = '.', *(G.os2.getvar_buf+G.os2.getvar_len) = 0; + + if (GetVariableIndex(__G__ 0)) + return 0; + + total = atoi(G.os2.buffer); + *pointer = (char **)malloc((total+1)<<2); + trav = *pointer; + for (count = 1; count <= total; count++) { + GetVariableIndex(__G__ count); + trav[count-1] = (char *)malloc(strlen(G.os2.buffer)+1); + strcpy(trav[count-1],G.os2.buffer); + } + trav[count-1] = NULL; + return total; +} + + +/* Kill string array created by CompoundToStringArray */ + +void KillStringArray(char **pointer) +{ + char **trav=pointer; + while (*trav != NULL) { + free(*trav); + trav++; + } + free(pointer); +} + + +/************************************************************************* +* Function: UZDropFuncs * +* * +* Syntax: call UZDropFuncs * +* * +* Return: NO_UTIL_ERROR - Successful. * +*************************************************************************/ + +ULONG UZDropFuncs(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + INT entries; /* Num of entries */ + INT j; /* Counter */ + + if (numargs != 0) /* no arguments for this */ + return INVALID_ROUTINE; /* raise an error */ + + retstr->strlength = 0; /* return a null string result*/ + + entries = sizeof(RxFncTable)/sizeof(PSZ); + + for (j = 0; j < entries; j++) + RexxDeregisterFunction(RxFncTable[j]); + + return VALID_ROUTINE; /* no error on call */ +} + + +/************************************************************************* +* Function: UZFileTree * +* * +* Syntax: call UZFileTree zipfile, stem[, include-filespec] * +* [, exclude-filespec][, options] * +* * +* Params: zipfile - Name of zip file to search. * +* stem - Name of stem var to store results in. * +* include - Filespec to search for (may include * and ?). * +* exclude - Filespec to exclude (may include * and ?). * +* options - Either of the following: * +* 'F' - Give file statistics. * +* Length Date Time Name * +* 'Z' - Give zip statistics, too. * +* Length Method Size Ratio Date Time CRC-32 Name* +* Default is to return only filenames * +* * +* Return: NO_UTIL_ERROR - Successful. * +* ERROR_NOMEM - Out of memory. * +*************************************************************************/ + +ULONG UZFileTree(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + /* validate arguments */ + char *incname[2]; + char *excname[2]; + CONSTRUCTGLOBALS(); + + if (numargs < 2 || numargs > 5 || + !RXVALIDSTRING(args[0]) || + !RXVALIDSTRING(args[1]) || + args[0].strlength > 255) { + DESTROYGLOBALS(); + return INVALID_ROUTINE; /* Invalid call to routine */ + } + /* initialize data area */ + SetOutputVarStem(__G__ args[1].strptr); + G.wildzipfn = args[0].strptr; + G.process_all_files = TRUE; + + uO.lflag = 1; + uO.zipinfo_mode = TRUE; + uO.C_flag = 1; + G.extract_flag = FALSE; + uO.qflag = 2; + + if (numargs >= 3 && /* check third option */ + !RXNULLSTRING(args[2]) && + args[2].strlength > 0) { /* a zero length string isn't */ + if (!(G.filespecs = CompoundToStringArray(__G__ &G.pfnames,args[2].strptr))) { + G.pfnames = incname; + incname[0] = args[2].strptr; + incname[1] = NULL; + G.filespecs = 1; + } + G.process_all_files = FALSE; + } + + if (numargs >= 4 && /* check third option */ + !RXNULLSTRING(args[3]) && + args[3].strlength > 0) { /* a zero length string isn't */ + if (!(G.xfilespecs = CompoundToStringArray(__G__ &G.pxnames,args[3].strptr))) { + G.pxnames = excname; + excname[0] = args[3].strptr; + excname[1] = NULL; + G.xfilespecs = 1; + } + G.process_all_files = FALSE; + } + + if (numargs == 5 && /* check third option */ + !RXNULLSTRING(args[4]) && + args[4].strlength > 0) { /* a zero length string isn't */ + int first = *args[4].strptr & 0x5f; + + if (first == 'Z') + uO.vflag = 2, uO.lflag = 0, uO.zipinfo_mode = FALSE; + else if (first == 'F') + uO.vflag = 1, uO.lflag = 0, uO.zipinfo_mode = FALSE; + } + + process_zipfiles(__G); + SetOutputVarLength(__G); + if (G.filespecs > 0 && G.pfnames != incname) + KillStringArray(G.pfnames); + if (G.xfilespecs > 0 && G.pxnames != excname) + KillStringArray(G.pxnames); + return RexxReturn(__G__ 0,retstr); /* no error on call */ +} + + +/************************************************************************* +* Function: UZUnZipToVar * +* * +* Syntax: call UZUnZipToVar zipfile, filespec [, stem] * +* * +* Params: zipfile - Name of zip file to search. * +* filespec - File to extract * +* stem - If you specify a stem variable, the file will be * +* extracted to the variable, one line per index * +* In this case, 0 will be returned * +* * +* Return: Extracted file * +* ERROR_NOMEM - Out of memory. * +*************************************************************************/ + +ULONG UZUnZipToVar(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + CONSTRUCTGLOBALS(); + UzpBuffer *ub = (UzpBuffer *)retstr; + /* validate arguments */ + if (numargs < 2 || numargs > 3 || + !RXVALIDSTRING(args[0]) || + !RXVALIDSTRING(args[1]) || + args[0].strlength == 0 || + args[1].strlength == 0) { + DESTROYGLOBALS(); + return INVALID_ROUTINE; /* Invalid call to routine */ + } + + uO.C_flag = 1; + G.redirect_data=1; + if (numargs == 3) { + if (!RXVALIDSTRING(args[2]) || + RXNULLSTRING(args[1]) || + args[2].strlength == 0) { + DESTROYGLOBALS(); + return INVALID_ROUTINE; /* Invalid call to routine */ + } + SetOutputVarStem(__G__ args[2].strptr); + G.redirect_text = 0; + G.redirect_data++; + } + unzipToMemory(__G__ args[0].strptr, args[1].strptr, + G.redirect_data==1 ? ub : NULL); + return RexxReturn(__G__ G.redirect_data==1,retstr); +} + + +/************************************************************************* +* Function: UZUnZipToStem * +* * +* Syntax: call UZUnZipToStem zipfile, stem[, include-filespec] * +* [, exclude-filespec][, mode] * +* * +* Params: zipfile - Name of zip file to search. * +* stem - Name of stem var to store files in. * +* include - Filespec to search for (may include * and ?). * +* exclude - Filespec to exclude (may include * and ?). * +* mode - Specifies 'F'lat or 'T'ree mode. Umm, this is * +* hard to explain so I'll give an example, too. * +* Assuming a file unzip.zip containing: * +* unzip.c * +* unshrink.c * +* extract.c * +* os2/makefile.os2 * +* os2/os2.c * +* os2/dll/dll.def * +* os2/dll/unzipapi.c * +* * +* -- In flat mode, each file is stored in * +* stem.fullname i.e. stem."os2/dll/unzipapi.c" * +* A list of files is created in stem.<index> * +* * +* Flat mode returns: * +* stem.0 = 7 * +* stem.1 = unzip.c * +* stem.2 = unshrink.c * +* stem.3 = extract.c * +* stem.4 = os2/makefile.os2 * +* stem.5 = os2/os2.c * +* stem.6 = os2/dll/dll.def * +* stem.7 = os2/dll/unzipapi.c * +* * +* And the following contain the contents of the * +* various programs: * +* stem.unzip.c * +* stem.unshrink.c * +* stem.extract.c * +* stem.os2/makefile.os2 * +* stem.os2/os2.c * +* stem.os2/dll/dll.def * +* stem.os2/dll/unzipapi.c * +* * +* -- In tree mode, slashes are converted to periods* +* in the pathname thus the above file would have* +* been stored in stem.os2.dll.unzipapi.c * +* The index would then be stored in stem.OS2. * +* DLL.<index>. * +* * +* NOTE: All path names are converted to uppercase * +* * +* Tree mode returns: * +* stem.0 = 4 * +* stem.1 = unzip.c * +* stem.2 = unshrink.c * +* stem.3 = extract.c * +* stem.4 = OS2/ * +* * +* stem.OS2.0 = 3 * +* stem.OS2.1 = makefile.os2 * +* stem.OS2.2 = os2.c * +* stem.OS2.3 = DLL/ * +* * +* stem.OS2.DLL.0 = 2 * +* stem.OS2.DLL.1 = def * +* stem.OS2.DLL.2 = unzipapi.c * +* * +* And the following contain the contents of the * +* various programs: * +* stem.unzip.c * +* stem.unshrink.c * +* stem.extract.c * +* stem.OS2.makefile.os2 * +* stem.OS2.os2.c * +* stem.OS2.DLL.dll.def * +* stem.OS2.DLL.unzipapi.c * +* * +* * +* Return: NO_UTIL_ERROR - Successful. * +* ERROR_NOMEM - Out of memory. * +*************************************************************************/ + +ULONG UZUnZipToStem(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + char *incname[2]; + char *excname[2]; + CONSTRUCTGLOBALS(); + /* validate arguments */ + if (numargs < 2 || numargs > 5 || + !RXVALIDSTRING(args[0]) || + !RXVALIDSTRING(args[1]) || + args[0].strlength > 255) { + DESTROYGLOBALS(); + return INVALID_ROUTINE; /* Invalid call to routine */ + } + /* initialize data area */ + G.wildzipfn = args[0].strptr; + G.process_all_files = TRUE; + + uO.C_flag = 1; + G.extract_flag = TRUE; + SetOutputVarStem(__G__ args[1].strptr); + G.redirect_data = 3; + G.redirect_text = 0; + + if (numargs >= 3 && /* check third option */ + !RXNULLSTRING(args[2]) && + args[2].strlength > 0) { /* a zero length string isn't */ + if (!(G.filespecs = CompoundToStringArray(__G__ &G.pfnames,args[2].strptr))) { + G.pfnames = incname; + incname[0] = args[2].strptr; + incname[1] = NULL; + G.filespecs = 1; + } + G.process_all_files = FALSE; + } + + if (numargs >= 4 && /* check third option */ + !RXNULLSTRING(args[3]) && + args[3].strlength > 0) { /* a zero length string isn't */ + if (!(G.xfilespecs = CompoundToStringArray(__G__ &G.pxnames,args[3].strptr))) { + G.pxnames = excname; + excname[0] = args[3].strptr; + excname[1] = NULL; + G.xfilespecs = 1; + } + G.process_all_files = FALSE; + } + + if (numargs == 5 && /* check third option */ + !RXNULLSTRING(args[4]) && + (*args[4].strptr & 0x5f) == 'T') { + G.redirect_data++; + G.os2.request.shvnext = NULL; + EZRXSTRING(G.os2.request.shvname, args[4].strptr); + G.os2.request.shvnamelen = G.os2.request.shvname.strlength; + G.os2.request.shvcode = RXSHV_SYDRO; + G.os2.request.shvret = 0; + RexxVariablePool(&G.os2.request); + } + + + uO.qflag = 2; + + process_zipfiles(__G); + if (G.filespecs > 0 && G.pfnames != incname) + KillStringArray(G.pfnames); + if (G.xfilespecs > 0 && G.pxnames != excname) + KillStringArray(G.pxnames); + if (G.redirect_data == 3) + SetOutputVarLength(__G); + return RexxReturn(__G__ 0,retstr); /* no error on call */ +} + + +/************************************************************************* +* Function: UZLoadFuncs * +* * +* Syntax: call UZLoadFuncs [option] * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +ULONG UZLoadFuncs(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + INT entries; /* Num of entries */ + INT j; /* Counter */ + + retstr->strlength = 0; /* set return value */ + /* check arguments */ + if (numargs > 0) + return INVALID_ROUTINE; + + entries = sizeof(RxFncTable)/sizeof(PSZ); + + for (j = 0; j < entries; j++) { + RexxRegisterFunctionDll(RxFncTable[j], + "UNZIP32", RxFncTable[j]); + } + return VALID_ROUTINE; +} + + + +/************************************************************************* +* Function: UZVer * +* * +* Syntax: call UZVer * +* * +* Return: Version of Unzip * +*************************************************************************/ + +ULONG UZVer(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + if (numargs > 1) /* validate arg count */ + return INVALID_ROUTINE; + + if (numargs == 0 || (*args[0].strptr & 0x5f) != 'L') + /* strcpy( retstr->strptr, UZ_VERNUM ); "5.13a BETA" */ + sprintf( retstr->strptr, "%d.%d%d%s", UZ_MAJORVER, UZ_MINORVER, + PATCHLEVEL, BETALEVEL ); + else + /* strcpy( retstr->strptr, UZ_VERSION ); UZ_VERNUM" of 26 Sep 94" */ + sprintf( retstr->strptr, "%d.%d%d%s of %s", UZ_MAJORVER, UZ_MINORVER, + PATCHLEVEL, BETALEVEL, VERSION_DATE ); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; +} + + +/************************************************************************* +* Function: UZUnZip * +* * +* Syntax: call UZUnZip * +* * +* Return: Unzip return code * +*************************************************************************/ + +ULONG UZUnZip(CHAR *name, ULONG numargs, RXSTRING args[], + CHAR *queuename, RXSTRING *retstr) +{ + char *argv[30]; + char *scan; + int argc=0; + int idx; + CONSTRUCTGLOBALS(); + + if (numargs < 1 || numargs > 2 || + args[0].strlength > 255) { + DESTROYGLOBALS(); + return INVALID_ROUTINE; /* Invalid call to routine */ + } + /* initialize data area */ + if (numargs == 2) + SetOutputVarStem(__G__ args[1].strptr); + + scan = args[0].strptr; + argv[argc++] = ""; /* D:\\SOURCECODE\\UNZIP51S\\UNZIP.COM"; */ + while (*scan == ' ') + scan++; + argv[argc++] = scan; + while ( (scan = strchr(scan,' ')) != NULL) { + *scan++ = 0; + while (*scan == ' ') + scan++; + argv[argc++] = scan; + } + if (*argv[argc-1] == 0) + argc--; + argv[argc] = 0; + + /* GRR: should resetMainFlags() be called in here somewhere? */ + + sprintf(retstr->strptr, "%d", unzip(__G__ argc, argv)); /* a.k.a. MAIN() */ + if (numargs == 2) + SetOutputVarLength(__G); + retstr->strlength = strlen(retstr->strptr); + return RexxReturn(__G__ 1,retstr); +} + +int varmessage(__GPRO__ uch *buf, ulg size) +{ + if (size > 0) + memcpy(G.os2.buffer+G.os2.putchar_idx,buf,size); + G.os2.putchar_idx = TextSetNext(__G__ G.os2.buffer, size+G.os2.putchar_idx,0); + return 0; +} + +int varputchar(__GPRO__ int c) +{ + G.os2.buffer[G.os2.putchar_idx++] = c; + if (c == '\n') { + G.os2.buffer[G.os2.putchar_idx] = 0; + if (G.os2.output_var[0]) + G.os2.putchar_idx = TextSetNext(__G__ G.os2.buffer, G.os2.putchar_idx,0); + else { + G.os2.buffer[--G.os2.putchar_idx] = 0; + puts(G.os2.buffer); + G.os2.putchar_idx = 0; + } + } + return 1; +} + + + +int SetOutputVarStem(__GPRO__ const char *name) +{ + int len=strlen(name); + G.redirect_text=1; + G.os2.output_idx = 0; + strcpy(G.os2.output_var, name); + if (len) { + strupr(G.os2.output_var); /* uppercase the name */ + if (*(G.os2.output_var+len-1) != '.') { + *(G.os2.output_var+len) = '.'; + len++; + *(G.os2.output_var+len) = 0; + } + WriteToVariable(__G__ G.os2.output_var,"",0); + } + G.os2.stem_len = len; + return G.os2.stem_len; +} + +int SetOutputVar(__GPRO__ const char *name) +{ + int len=strlen(name); + G.redirect_text=1; + G.os2.output_idx = 0; + strcpy(G.os2.output_var, name); + strupr(G.os2.output_var); /* uppercase the name */ + if (*(name+len-1) == '.') + G.os2.stem_len = len; + else + G.os2.stem_len = 0; + return G.os2.stem_len; +} + +int SetOutputVarLength(__GPRO) +{ + if (G.os2.stem_len > 0) { + if (G.os2.putchar_idx) + TextSetNext(__G__ G.os2.buffer,G.os2.putchar_idx,1); + return PrintToSubVariable(__G__ 0,"%d",G.os2.output_idx); + } + return 0; +} + +int PrintToVariable(__GPRO__ const char *name, const char *format,...) +{ + va_list arg_ptr; + int ret; + + va_start(arg_ptr, format); + ret = _PrintToVariable(__G__ name, format, arg_ptr); + va_end(arg_ptr); + return ret; +} + +int WriteToVariable(__GPRO__ const char *name, char *buffer, int len) +{ + G.os2.request.shvnext = NULL; + EZRXSTRING(G.os2.request.shvname, name); + G.os2.request.shvnamelen = G.os2.request.shvname.strlength; + G.os2.request.shvvalue.strptr = buffer; + G.os2.request.shvvalue.strlength = len; + G.os2.request.shvvaluelen = len; + G.os2.request.shvcode = RXSHV_SET; + G.os2.request.shvret = 0; + switch (RexxVariablePool(&G.os2.request)) { + case RXSHV_BADN: + G.os2.rexx_error = INVALID_ROUTINE; + break; + case RXSHV_MEMFL: + G.os2.rexx_mes = ERROR_NOMEM; + break; + case RXSHV_OK: + return 0; + } + return INVALID_ROUTINE; /* error on non-zero */ +} + +int _PrintToVariable(__GPRO__ const char *name, const char *format, va_list arg_ptr) +{ + int ret = vsprintf(G.os2.buffer, format, arg_ptr); + WriteToVariable(__G__ name, G.os2.buffer, strlen(G.os2.buffer)); + return ret; +} + +int PrintToSubVariable(__GPRO__ int idx, const char *format, ...) +{ + va_list arg_ptr; + int ret; + + if (G.os2.stem_len == 0) + return INVALID_ROUTINE; /* error on non-zero */ + sprintf(G.os2.output_var+G.os2.stem_len,"%d",idx); + + va_start(arg_ptr, format); + ret = _PrintToVariable(__G__ G.os2.output_var, format, arg_ptr); + va_end(arg_ptr); + return ret; +} + + +int WriteToNextVariable(__GPRO__ char *buffer, int len) +{ + if (G.os2.stem_len > 0) { + G.os2.output_idx++; + sprintf(G.os2.output_var+G.os2.stem_len,"%d",G.os2.output_idx); + } + return WriteToVariable(__G__ G.os2.output_var, buffer, len); +} + + +int TextSetNext(__GPRO__ char *buffer, int len, int all) +{ + char *scan = buffer, *next, *base=buffer; + int remaining=len; + int ret; + + while ((next = strchr(scan,'\n')) != NULL && remaining > 0) { + if (next > scan && *(next-1) == 0xd) + *(next-1) = 0; + else + *next = 0; + if (WriteToNextVariable(__G__ scan,strlen(scan))) + return 0; + next++; + remaining -= (next-scan); + scan = next; + } + if (remaining > 0) + if (all) { + *(scan+remaining) = 0; + WriteToNextVariable(__G__ scan,remaining); + } else { + memcpy(buffer,scan,remaining); + return remaining; + } + + return 0; +} + +int finish_REXX_redirect(__GPRO) +{ + char *scan, *ptr; + int idx=0, first=1, offset; + + if (!G.redirect_size) + return 0; + switch(G.redirect_data) { + case 1: + break; + case 2: + TextSetNext(__G__ G.redirect_buffer, G.redirect_size, 1); + SetOutputVarLength(__G); + DosFreeMem(G.redirect_buffer); + G.redirect_buffer = NULL; + G.redirect_size = 0; + break; + case 3: + WriteToNextVariable(__G__ G.filename,strlen(G.filename)); + sprintf(G.os2.output_var+G.os2.stem_len,G.filename); + WriteToVariable(__G__ G.os2.output_var, G.redirect_buffer, G.redirect_size); + DosFreeMem(G.redirect_buffer); + G.redirect_buffer = NULL; + G.redirect_size = 0; + break; + case 4: + if ((scan = strrchr(G.filename,'/')) != NULL) { + idx = *scan; + *scan = 0; + strupr(G.filename); + *scan = idx; + } + scan = G.os2.output_var+G.os2.stem_len; + strcpy(scan,G.filename); + while ((scan = strchr(scan,'/')) != NULL) + *scan = '.'; + WriteToVariable(__G__ G.os2.output_var, G.redirect_buffer, G.redirect_size); + DosFreeMem(G.redirect_buffer); + G.redirect_buffer = NULL; + G.redirect_size = 0; + strcpy(G.os2.getvar_buf, G.os2.output_var); + do { + if ((scan = strrchr(G.filename,'/')) == NULL) + offset = 0; + else + offset = scan-G.filename+1; + if (first || !GetVariable(__G__ G.os2.output_var)) { + ptr = G.os2.getvar_buf+offset+G.os2.stem_len; + *ptr = '0'; + *(ptr+1) = 0; + if (!GetVariable(__G__ G.os2.getvar_buf)) + idx = 1; + else + idx = atoi(G.os2.buffer)+1; + PrintToVariable(__G__ G.os2.getvar_buf,"%d",idx); + sprintf(ptr,"%d",idx); + if (!first) { + PrintToVariable(__G__ G.os2.output_var,"%d",idx); + idx = strlen(G.filename); + *(G.filename+idx) = '/'; + *(G.filename+idx+1) = 0; + } + WriteToVariable(__G__ G.os2.getvar_buf,G.filename+offset,strlen(G.filename+offset)); + first=0; + } + if (offset) { + *(G.os2.output_var+G.os2.stem_len+offset-1) = 0; + *scan = 0; + } + } while (offset); + break; + } + return 0; +} + +#endif /* OS2DLL */ diff --git a/utils/Install/sfxzip/rexxhelp.c b/utils/Install/sfxzip/rexxhelp.c new file mode 100644 index 0000000000..20a72597a8 --- /dev/null +++ b/utils/Install/sfxzip/rexxhelp.c @@ -0,0 +1,178 @@ +/* rexxhelp.c */ + +#if defined(API_DOC) && defined(OS2DLL) + +#define UNZIP_INTERNAL +#include "../unzip.h" +#include "../version.h" + +APIDocStruct REXXDetails[] = { + { "UZDROPFUNCS" , "UZDropFuncs" , + "call UZDropFuncs", + "Use this function to drop all the loaded UnZip functions.\n" +"\t\tOnce this function is processed by a REXX program, the\n" +"\t\tUnZip functions are not accessible in any OS/2 sessions.\n" }, + + { "UZLOADFUNCS" , "UZLoadFuncs" , + "call UZLoadFuncs", + "Use this function to make all of the UnZip functions\n" +" in this package available to all OS/2 sessions.\n\n" +" Example: call RxFuncAdd 'UZLoadFuncs', 'UNZIPAPI', 'UZLoadFuncs'\n" +" call UZLoadFuncs\n" }, + + { "UZFILETREE" , "UZFileTree" , + "rc = UZFileTree(zipfile, stem, [include], [exclude], [options])\n\n" +" zipfile - Name of ZIP file to search\n" +" stem - Name of the stem variable for results\n" +" Note: stem.0 contains the number of files found.\n" +" include - Optional stem variable specifying a list of files (including\n" +" wildcards) to include. stem.0 must indicate number of items.\n" +" exclude - Optional stem variable specifying a list of files (including\n" +" wildcards) to exclude. stem.0 must indicate number of items.\n" +" NOTE: If lists are not needed, filespec strings may be passed.\n" +" options - One of the following:\n" +" 'O' - Give file names only. This is the default.\n" +" 'F' - Give file statistics in the form:\n" +" Length Date Time Name\n" +" 'Z' - Also give ZIP statistics in the form:\n" +" Length Method Size Ratio Date Time CRC-32 Name", + "Finds all files in the specified ZIP with the specified\n" +" filespec and places their descriptions in a stem variable.\n\n" +" rc: Return codes\n" +" 0 Successful\n" +" 2 Error. Not enough memory.\n\n" +" Examples:\n" +" /* Return a list of all .NDX files in pcboard.qwk */\n" +" rc = UZFileTree('pcboard.qwk', 'stem.', '*.ndx')\n\n" +" /* Return a list of all files except *.NDX and *.DAT */\n" +" exc.0 = 2; exc.1 = '*.ndx'; exc.2 = '*.dat'\n" +" rc = UZFileTree('pcboard.qwk', 'stem.',,'exc.')\n" }, + + { "UZUNZIP" , "UZUnZip" , + "rc = UZUnZip('parameters', [stem])\n\n" +" parameters - The entire list of parameters you would use from\n" +" the command-line\n" +" stem - The name of an optional stem variable where any\n" +" output should be redirected.\n" +" NOTE: If a stem is not specified, all output will\n" +" go to the console.", + "Provide a direct entry point to the command line interface.\n\n" +" rc: UnZip return code\n\n" +" Examples: /* Test the archive 'unzip51s.zip' and return output in stem.*/\n" +" rc = UZUnZip('-t unzip51s.zip','stem.')\n" +" /* Extract the archive, display output on screen */\n" +" call UZUnZip 'doom.zip'\n" +" /* Extract all .NDX files from the archive */\n" +" call UZUnZip 'pcboard.qwk *.ndx','stem.'\n" }, + + { "UZUNZIPTOVAR" , "UZUnZipToVar" , + "rc = UZUnZipToVar('zipfile', 'filename', [stem])\n\n" +" zipfile - Name of ZIP file to search\n" +" filename - Name of file to extract from zipfile\n" +" stem - Optional stem variable to extract the file to.\n" +" If you specify a stem variable, the file will be extracted\n" +" to the variable, one line per index, stem.0 containing a\n" +" line count. In this case, 0 will be returned in rc.\n" +" If NO stem variable is specified, the entire file will be\n" +" extracted to rc.", + "Unzip one file to a variable.\n\n" +" rc: If no stem variable is specified, rc contains the contents of\n" +" the extracted file if successful or an error-code if not.\n" +" If a stem variable IS specified, rc contains 0 if successful.\n"}, + + /* GRR: "include" and "exclude" used to be identified as stem variables + * (Daniel H bug report) + */ + { "UZUNZIPTOSTEM", "UZUnZipToStem", + "rc = UZUnZipToStem(zipfile, stem, [include], [exclude], [mode])\n" +" zipfile - Name of ZIP file to search\n" +" stem - Stem variable used to store the extracted files\n" +" include - Optional string variable specifying a list of files (including\n" +" wildcards) to include. stem.0 must indicate number of items.\n" +" exclude - Optional string variable specifying a list of files (including\n" +" wildcards) to exclude. stem.0 must indicate number of items.\n" +" NOTE: If lists are not needed, filespec strings may be passed.\n" +" mode - Optional mode parameter specifies either 'F'lat (the default)\n" +" or 'T'ree mode.\n" +" -- In flat mode, each file is stored in stem.fullname i.e.\n" +" stem.os2/dll/unzipapi.c. A list of files is created in\n" +" stem.<index>\n" +" -- In tree mode, slashes are converted to periods in the\n" +" pathname thus the above file would have been stored in\n" +" stem.OS2.DLL.unzipapi.c and an index stored for each\n" +" directory, i.e. stem.OS2.DLL.<index> = \"unzipapi.c\",\n" +" stem.OS2.<index> = \"DLL/\", stem.<index> = \"OS2/\"", + "Unzip files to a stem variable.\n\n" +" Example: Assuming a file unzip.zip containing:\n" +" unzip.c, unshrink.c, extract.c,\n" +" os2/makefile.os2, os2/os2.c\n" +" os2/dll/dll.def, os2/dll/unzipapi.c\n\n" +" rc = UZUnZipToStem('unzip.zip', 'stem.')\n" +" Returns: stem.0 = 7\n" +" stem.1 = unzip.c\n" +" stem.2 = unshrink.c\n" +" stem.3 = extract.c\n" +" stem.4 = os2/makefile.os2\n" +" stem.5 = os2/os2.c\n" +" stem.6 = os2/dll/dll.def\n" +" stem.7 = os2/dll/unzipapi.c\n" +" And the following contain the contents of the\n" +" various files:\n" +" stem.unzip.c\n" +" stem.unshrink.c\n" +" stem.extract.c\n" +" stem.os2/makefile.os2\n" +" stem.os2/os2.c\n" +" stem.os2/dll/dll.def\n" +" stem.os2/dll/unzipapi.c\n\n" +" rc = UZUnZipToStem('unzip.zip', 'stem.',,,'TREE')\n" +" Returns: stem.0 = 4\n" +" stem.1 = unzip.c\n" +" stem.2 = unshrink.c\n" +" stem.3 = extract.c\n" +" stem.4 = OS2/\n" +" stem.OS2.0 = 3\n" +" stem.OS2.1 = makefile.os2\n" +" stem.OS2.2 = os2.c\n" +" stem.OS2.3 = DLL/\n" +" stem.OS2.DLL.0 = 2\n" +" stem.OS2.DLL.1 = def\n" +" stem.OS2.DLL.2 = unzipapi.c\n" +"\n" +" And the following contain the contents of the\n" +" various programs:\n" +" stem.unzip.c\n" +" stem.unshrink.c\n" +" stem.extract.c\n" +" stem.OS2.makefile.os2\n" +" stem.OS2.os2.c\n" +" stem.OS2.DLL.dll.def\n" +" stem.OS2.DLL.unzipapi.c\n" }, + + { "UZVER" , "UZVer" , + "rc = UZVer([option])\n\n" +" rc String containing UnZip version info in the form 'x.xx'\n" +" If option is 'L' then info is in the form 'x.xx of <date>", + "Returns the version number of UnZip\n" }, + + { "UZAPIVER" , "UZAPIVer" , + "rc = UZAPIVer([option])\n\n" +" rc String containing API version info in the form 'x.xx'\n" +" If option is 'L' then info is in the form 'x.xx of <date>", + "Returns the version number of the API\n" }, + { 0 } +}; + +char *REXXBrief = "\ +REXX functions:\n\ + UZDropFuncs -- Makes all functions in this package unknown to REXX\n\ + UZLoadFuncs -- Makes all functions in this package known to REXX\n\ + UZFileTree -- Searches for files matching a given filespec\n\ + UZUnZip -- UnZip command-line entry point\n\ + UZUnZipToVar -- Unzip one file to a variable\n\ + UZUnZipToStem -- Unzip files to a variable array\n\ + UZVer -- Returns the UnZip version number\n\ + UZAPIVer -- Returns the API version number\n"; + + +#endif /* API_DOC && OS2DLL */ diff --git a/utils/Install/sfxzip/sfx.RES b/utils/Install/sfxzip/sfx.RES new file mode 100644 index 0000000000000000000000000000000000000000..09bcebd7887a75a6a5d6fa5fb08771241e46bbfb GIT binary patch literal 13744 zcmeHNO^jT{5w16H?6>}rXN@9^1z|=U5XVJ9(JBUJY%gA0F}AVS;pgH-kRKEWhM#B_ zZ2VqGBqL=d!_iWN$=}5%q~u`9Nc%)0#fO#5DdGg9L<*eZL5{>YjHmN`)!j31o@Zxm zyvBmiyEU(?yQ;dos;jzQ&xnXr0LEBAb)eh^Yzkn^DtS~Mll}6L9FSe|1fE-Eo9xDO z3iwvk_R4gRcVc`^(Ibg0y6RnWtGprKci04;_XE7_?U1rhW*}{^>=`0;Q0BSBipk2H zlAp`Z@b@y-^t3!9Ps(9=PJRqRuA>I<W9`8h*D@Yh697tfJdr=6WfEXaQT6jEX3x3r z1@<s>vquh+NlSMAY<NTN2Guk2Eav*0G?eCdrMoe&C*?(X3ZGBQ54H8Tr5Vs2237&j zPEfx9{1rT(m6vpthp}dsKMqj-030uX;u)287!oWMtu69<jI|a0FF?Yx&=RHZ0wtxs zi2g+W0E#_mpMwmM`vSjL0<0GZ%6P`k>tvPOgSHBw1_<z{#XT(2|1@?Q{f1$+s3}4y zwM5Eokt(4h5(7*}f{y^FP`~}KgIQ~A8axX?hZW3WbZM20Av7an($JWM5Mbtk=>jmi zLbrytlz{&9lrevS*erZJe3)-xQj-8<*6aS+j{UM99<~>shhXWgx|{6G2lr0_+O0s( z)G{q&KPxJW_9-Y+);=XEt-O8g)L^4jWc@5Rgh*vf<f(a)9e+jen6gjeY-c~|NPiV& zsMcC#=ot1m@lRu_mrOVAm`?k__|nBw)k_yHR4;z?*{O^CTll;W#L>=v(vhBg<X1VA zN4dE|`_ur#?XwNm+Ks;h@bt$4wv4t@A?HV-GG*-qCEYkXxjAMZi9_fv_W`~K_%>ie z0yEV_!nd)z-bceH00sgQYyy-3s{trEwOtc>0@TpH2?6jRlK|2fE?2cCX~X?GAn0B} z0HPL%VM5x;o+ZQlXrD&n?TBu>b+#g-Z4~BgR8+34jn>MV8)%~mjJFf;Ius9oDO5!M zQ<HEkks>^O%)vM!bQXMj5w0Ju2YU;UDbUnamh+%H4xrMh{IW4)Rm8d2w4v{daGQ(2 zG3Mj9V)L)n7FcH+``Vv^g|-4~w$Mh1221$T!-#d$h<3YV2jC&ZKVL@Ms+hCYDrL*s zYDME-)Wo?0PpM!}Z2yPI{6?6lk_45hq)?f!6}H||D{Q-~R+!pWE9`u&R=BrV3+^f= zK@rBAzZX33SzgMZtR+fTZv*vqIdc}lTf!zxl*Zk15_ift86R9<?c9GywKI8twKH+F z+L3m(8?@tY*osY<+Ovyi6wfotTB6WaHNfz=$L#5l`qT{U^tfBYXgjUS*~tcuterNj z)cM4a8YPHNsYtmAX8`UX2n!O1p+sSrV0)$n*4f5BPp41vQU+y_e@MAPec1n|9V0GP zq2sa}0i&R;JNL5b%*~nh+*}OTtTyfJ%B-`EeWX!-of-HjgR&@-vU6p0+_RZFGg6<K zkG9e3oQ)z~an?p6cU)K8OCWI;FbTL5P-;TGU8vWzkV)xFND`brodyRF))3}q0sDZz zkB#^S$SX+vQk#k=Kx=>sU>tA<;8wsoz^X)~kRo`_0>P%gxn;DC_QRK$L-ZrwXd6X2 z8;xO!Oso3uTjO8AkAhYy2~K>PNX)D@PQr!DY1Aq;OXn}P$_tm<w;%cNg9k4!9DU&P zkKQF5=~O>FVoVQyYT~~iF)?rp519B}!go!4xEvpAmls}bm(IV~qRepN)s$oCSQwLI zBZEh*>O&j80l(1gkz#ug5*XBjEK@ukpQ+<-VyjUmWoO4?eYA}p#o082_p+Vh%V-;o z<!rP@*|IiTi<gso&{_f104wsYbP$p}#7(#gfW_C#iOtt=bjeac`X$OJFX~De-ivrO z3KGyXW1F)vZyN^4<(4X=ZL|-!5&MykALv<Ww2ju}Y_wKaowX5T$%@;^>vjVw!CMGh zhY|^^smv{;atyI80<-}Jcok{z36n&hAwX8KYp<d#rMrH6*hZ+GHBFrDgcOhfqz@QP z(9|oa&$cCK>pNFp(9qg)He#IH0blZEw2jv0Y{b|;80*S6(neAjc{!2bzmpPnQVB2L zDPi{*pb01gH#oO=1Mq2A;tNfUDt=)jo<kLvX)NQ!S`9x!xN;EU8DvewdJG8sFvz9? zxOdq!nRt&b%h_l@^6zPQk+;%l8?DRPh%X+4HX?rAeiWs6@u>^~+gLtMMb1?uAiQ3Y zkT6z}>EgKjs4ynSf}+H&*CZ}(9e`uNkN)x(GFK}|y;79f@iD25A(x1nNH=n&T}8Yq z4+7fwdep_c5#wKH+`{BU*^C2Z4mLar8?J`^BG@lXt^~MUkOWB0LlZS4Q^H+Sxm{l7 zefANYNBi-|TSi+(+h~2xM#Ey=3fRca<;!}Qn_Ncw5%0!%d*^Svm%DRVE1%%?qXOmO zr4A6N8nfropbzl?N1O)F@RHado+KK}`H3nZku*)gf)K(ef)iUG_(T;z%#{f7FIyTp zJl9{!;bs7jN&|SK0ld-h;vxD3an}&Z7-o`4!w-2vZQVwLa#$2^MUfJ~30-L^0g?8i z5|JP#-dQ})N2^hfw8P<$5V76UV-j<U`;Vj%+v=iyw0gLTfk5A{^85I_WpMrT=llff zDt~dYy{H69UB?Gv@kn%j=u@1>J_ndT(OEo)XA3wPz^w~Zb&$Xoc7wo94OGrz4cpM} z>zk7}-b29x-8*93?4a{+BmiKrE}#uab&FJyA25Gr9?g6@Y~t)m0SQJXEK#_jNy9uo zN^Ne>9G{s@40+gjyqCzvz72XOz6+T*zY#hlk08I}_fP&iB1l9TjD5_cE0rQXZ&Qy7 za(-nU=H~bnmE0?sd9Th&T_$un_5-Bh*-S|qjV&4U?3ri~KkM-`@@u7w>X!Z;Sx5X# zRJZaR{!T+I?&uTj1<OF{vuEkMTeRlcVL9Sw#`p<#hyO`i$!;0m5%ycx--24g`CxSR zlXQY&mEGdVvO(l_BDxg!k;CDRT^ZQ#*n7BV=L|TWXLn2JvD*>*><;g<TZTTn;u&^j z=#B1{l<3-suxvSFpZ+uaj;~>#hb`+Xc|Xbe2H$n*A5qi#h<@`0zB2gfD^>Uk{RMC8 zg1m!%!<!R80{<bT^i@E!r2b@Z^=I1IJMz3=@%?tc-o5s3ik9=MLe8)31=-E<D?!Nw zFrv=2SY?Tx-?(w(re27PHf}z7^5mNveZ%v>SU^GQV6$SN*rY+xqi7%=xL!UsfngA@ z3&>9?$t7iAw?XyfDT9wqb>OEAtN7-E0<<4h+qkK*8C|SvH%2551ceocgFt0^oCNG% z3eVGn+{vqN1{b>hc$}Zs**0Xpy4?PH#$|B5dHqnG5aSETmBHa}63ysayZamt6>;`b zYRdw9y58Q|l&DW+&!(sep9A>wX}L3sqP;I>&#DMAN`T&Z#apuMc{K?}WAc8*J3VIU zOMRD-KdZu=PZc3`@LlSg9PnClK<;rAp96M~Gco7N<baxj^>RQEI0l;odfexL9``xl zHR2$*@>@0s)Uo*Ca=;$$azHb$DW5^mw>hliZvjVmXNIWqxJhi1*h>*X@RiR2@58FD z^eKLuu>(G3%jn#%nDeJq%5*c&C^v2Q@W+os@hal-AluNWW2g2xB7J4*<BfW^n;~E~ z_qr!wcZR@r_X(6+N?roGK@8kUi0TlAFQDlyDiPgXI8wKJ!4AOvH}-mhPi{vk{kzw% z1iC+wsiFTfWr!gj>EDL#1-m2=tUD_pu-(|e=tk~X@+*!k9@*jWc?9f89eX(PM$q?h zbTaqs^<OWZm#>L!U%Xs_4~*WMhE|w=X&%NOHKb*@Jd6b=?&6(?H;8a?>M?F2za#j1 ziZjRKq#-SN^z6~P{T&j|BM;h_K)-|(<KX*4-c=0uC%#MVL$58P{b`l_1g}rKLCW73 z@%MoI?cV`pkM@^<hwwazx3d}dzP1g$Gx!}Gf7j>aOaFT+f0k9y6^K3S<QnfYc$dLD z4a`XYF|jM|GwQh#<w~x*p6iaj=^xa<S4}@>usbHWL$GJL+qdIRjyv_?-mYZ-;J)My zDZ%eczkkt`D+?m{mxTrUz$dDD$F|(QY}E0R0@eoKUGS{)t;I^WQ5=Z&;}BpJwAA_p zsXiO7UHP)>+^%`&0r=+NN^izGdlR>pbyz1>%=vr3^0e-suHDn2SJ&&`@M_4=Z7eIm zg8bd_3|4s%_0el(47>&4ZTbP~zKo+nu;n^z3M1Kq^-bsNznVHuo3edwy0Me>Db!!W z|8dlJqJw?Yq}ho!^0WTZ6q{`wk9yRvztXQ`!vY~aNKU`qr&-&l(LLwq01DDiPlG`V ze%{CVxO#T})cGWoLm%qvd<tg(@8w4O($_}sS-sGAy&g0A&FVdCk4DB$-hNl3_s53n zoxdyJeN}p=?)`pmx!ujj4cqT4pclLEuESTppns@6-29jFgW>kzZw~l-?dAR8%eP0y z_cMDiyEn6YwvpM(gR$Z|?C}NtM(yF|toF#-)yW(lm!7~W|Nj%0U}5Z9jr-IPK<hXS z>hiYM>!(jg1lvv;+pdww)8pmS%DI}jw3OcMS-iX-d=1WFjTBDT8NE~I4d|Y_9?&~< PPVc(HPCYqSqxb&-^+!7H literal 0 HcmV?d00001 diff --git a/utils/Install/sfxzip/sfx.rc b/utils/Install/sfxzip/sfx.rc new file mode 100644 index 0000000000..82bdf07561 --- /dev/null +++ b/utils/Install/sfxzip/sfx.rc @@ -0,0 +1,2 @@ +#include "wx/msw/wx.rc" + diff --git a/utils/Install/sfxzip/ttyio.c b/utils/Install/sfxzip/ttyio.c new file mode 100644 index 0000000000..c755d1c5a3 --- /dev/null +++ b/utils/Install/sfxzip/ttyio.c @@ -0,0 +1,625 @@ +/*--------------------------------------------------------------------------- + + ttyio.c + + This file contains routines for doing console input/output, including code + for non-echoing input. It is used by the encryption/decryption code but + does not contain any restricted code itself. This file is shared between + Info-ZIP's Zip and UnZip. + + Contains: echo() (VMS only) + Echon() (Unix only) + Echoff() (Unix only) + screenlines() (Unix only) + zgetch() (Unix and non-Unix versions) + getp() ("PC," Unix/Atari/Be, VMS/VMCMS/MVS) + + ---------------------------------------------------------------------------*/ + +#define __TTYIO_C /* identifies this source module */ + +#include "zip.h" +#include "crypt.h" + +#if (CRYPT || (defined(UNZIP) && !defined(FUNZIP))) +/* Non-echo console/keyboard input is needed for (en/de)cryption's password + * entry, and for UnZip(SFX)'s MORE and Pause features. + * (The corresponding #endif is found at the end of this module.) + */ + +#include "ttyio.h" + +#ifndef PUTC +# define PUTC putc +#endif + +#ifdef ZIP +# ifdef GLOBAL /* used in Amiga system headers, maybe others too */ +# undef GLOBAL +# endif +# define GLOBAL(g) g +#else +# define GLOBAL(g) G.g +#endif + +#ifdef __BEOS__ /* why yes, we do */ +# define HAVE_TERMIOS_H +#endif + +#ifdef _POSIX_VERSION +# ifndef USE_POSIX_TERMIOS +# define USE_POSIX_TERMIOS /* use POSIX style termio (termios) */ +# endif +# ifndef HAVE_TERMIOS_H +# define HAVE_TERMIOS_H /* POSIX termios.h */ +# endif +#endif /* _POSIX_VERSION */ + +#ifdef UNZIP /* Zip handles this with the unix/configure script */ +# ifndef _POSIX_VERSION +# if (defined(SYSV) || defined(CRAY)) && !defined(__MINT__) +# ifndef USE_SYSV_TERMIO +# define USE_SYSV_TERMIO +# endif +# ifdef COHERENT +# ifndef HAVE_TERMIO_H +# define HAVE_TERMIO_H +# endif +# ifdef HAVE_SYS_TERMIO_H +# undef HAVE_SYS_TERMIO_H +# endif +# else /* !COHERENT */ +# ifdef HAVE_TERMIO_H +# undef HAVE_TERMIO_H +# endif +# ifndef HAVE_SYS_TERMIO_H +# define HAVE_SYS_TERMIO_H +# endif +# endif /* ?COHERENT */ +# endif /* (SYSV || CRAY) && !__MINT__ */ +# endif /* !_POSIX_VERSION */ +# if !(defined(BSD4_4) || defined(SYSV) || defined(__convexc__)) +# ifndef NO_FCNTL_H +# define NO_FCNTL_H +# endif +# endif /* !(BSD4_4 || SYSV || __convexc__) */ +#endif /* UNZIP */ + +#ifdef HAVE_TERMIOS_H +# ifndef USE_POSIX_TERMIOS +# define USE_POSIX_TERMIOS +# endif +#endif + +#if (defined(HAVE_TERMIO_H) || defined(HAVE_SYS_TERMIO_H)) +# ifndef USE_SYSV_TERMIO +# define USE_SYSV_TERMIO +# endif +#endif + +#if (defined(UNZIP) && !defined(FUNZIP) && defined(UNIX) && defined(MORE)) +# include <sys/ioctl.h> +# define GOT_IOCTL_H + /* int ioctl OF((int, int, zvoid *)); GRR: may need for some systems */ +#endif + +#ifndef HAVE_WORKING_GETCH + /* include system support for switching of console echo */ +# ifdef VMS +# include <descrip.h> +# include <iodef.h> +# include <ttdef.h> +# include <starlet.h> +# include <ssdef.h> +# else /* !VMS */ +# ifdef HAVE_TERMIOS_H +# include <termios.h> +# define sgttyb termios +# define sg_flags c_lflag +# define GTTY(f, s) tcgetattr(f, (zvoid *) s) +# define STTY(f, s) tcsetattr(f, TCSAFLUSH, (zvoid *) s) +# else /* !HAVE_TERMIOS_H */ +# ifdef USE_SYSV_TERMIO /* Amdahl, Cray, all SysV? */ +# ifdef HAVE_TERMIO_H +# include <termio.h> +# endif +# ifdef HAVE_SYS_TERMIO_H +# include <sys/termio.h> +# endif +# ifdef NEED_PTEM +# include <sys/stream.h> +# include <sys/ptem.h> +# endif +# define sgttyb termio +# define sg_flags c_lflag +# define GTTY(f,s) ioctl(f,TCGETA,(zvoid *)s) +# define STTY(f,s) ioctl(f,TCSETAW,(zvoid *)s) +# else /* !USE_SYSV_TERMIO */ +# ifndef CMS_MVS +# if (!defined(MINIX) && !defined(GOT_IOCTL_H)) +# include <sys/ioctl.h> +# endif +# include <sgtty.h> +# define GTTY gtty +# define STTY stty +# ifdef UNZIP + /* + * XXX : Are these declarations needed at all ???? + */ + /* + * GRR: let's find out... Hmmm, appears not... + int gtty OF((int, struct sgttyb *)); + int stty OF((int, struct sgttyb *)); + */ +# endif +# endif /* !CMS_MVS */ +# endif /* ?USE_SYSV_TERMIO */ +# endif /* ?HAVE_TERMIOS_H */ +# ifndef NO_FCNTL_H +# ifndef UNZIP +# include <fcntl.h> +# endif +# else + char *ttyname OF((int)); +# endif +# endif /* ?VMS */ +#endif /* !HAVE_WORKING_GETCH */ + + + +#ifndef HAVE_WORKING_GETCH +#ifdef VMS + +/* + * Turn keyboard echoing on or off (VMS). Loosely based on VMSmunch.c + * and hence on Joe Meadows' file.c code. + */ +int echo(opt) + int opt; +{ + /* + * For VMS v5.x: + * IO$_SENSEMODE/SETMODE info: Programming, Vol. 7A, System Programming, + * I/O User's: Part I, sec. 8.4.1.1, 8.4.3, 8.4.5, 8.6 + * sys$assign(), sys$qio() info: Programming, Vol. 4B, System Services, + * System Services Reference Manual, pp. sys-23, sys-379 + * fixed-length descriptor info: Programming, Vol. 3, System Services, + * Intro to System Routines, sec. 2.9.2 + * Greg Roelofs, 15 Aug 91 + */ + + /* SKM: make global? */ + static struct dsc$descriptor_s DevDesc = + {11, DSC$K_DTYPE_T, DSC$K_CLASS_S, "SYS$COMMAND"}; + /* {dsc$w_length, dsc$b_dtype, dsc$b_class, dsc$a_pointer}; */ + static short DevChan, iosb[4]; + static long status; + static unsigned long oldmode[2], newmode[2]; /* each = 8 bytes */ + + + /* assign a channel to standard input */ + status = sys$assign(&DevDesc, &DevChan, 0, 0); + if (!(status & 1)) + return status; + + /* use sys$qio and the IO$_SENSEMODE function to determine the current + * tty status (for password reading, could use IO$_READVBLK function + * instead, but echo on/off will be more general) + */ + status = sys$qiow(0, DevChan, IO$_SENSEMODE, &iosb, 0, 0, + oldmode, 8, 0, 0, 0, 0); + if (!(status & 1)) + return status; + status = iosb[0]; + if (!(status & 1)) + return status; + + /* copy old mode into new-mode buffer, then modify to be either NOECHO or + * ECHO (depending on function argument opt) + */ + newmode[0] = oldmode[0]; + newmode[1] = oldmode[1]; + if (opt == 0) /* off */ + newmode[1] |= TT$M_NOECHO; /* set NOECHO bit */ + else + newmode[1] &= ~((unsigned long) TT$M_NOECHO); /* clear NOECHO bit */ + + /* use the IO$_SETMODE function to change the tty status */ + status = sys$qiow(0, DevChan, IO$_SETMODE, &iosb, 0, 0, + newmode, 8, 0, 0, 0, 0); + if (!(status & 1)) + return status; + status = iosb[0]; + if (!(status & 1)) + return status; + + /* deassign the sys$input channel by way of clean-up */ + status = sys$dassgn(DevChan); + if (!(status & 1)) + return status; + + return SS$_NORMAL; /* we be happy */ + +} /* end function echo() */ + + +#else /* !VMS: basically Unix */ + + +/* For VM/CMS and MVS, non-echo terminal input is not (yet?) supported. */ +#ifndef CMS_MVS + +#ifdef ZIP /* moved to globals.h for UnZip */ + static int echofd=(-1); /* file descriptor whose echo is off */ +#endif + +/* + * Turn echo off for file descriptor f. Assumes that f is a tty device. + */ +void Echoff(__G__ f) + __GDEF + int f; /* file descriptor for which to turn echo off */ +{ + struct sgttyb sg; /* tty device structure */ + + GLOBAL(echofd) = f; + GTTY(f, &sg); /* get settings */ + sg.sg_flags &= ~ECHO; /* turn echo off */ + STTY(f, &sg); +} + +/* + * Turn echo back on for file descriptor echofd. + */ +void Echon(__G) + __GDEF +{ + struct sgttyb sg; /* tty device structure */ + + if (GLOBAL(echofd) != -1) { + GTTY(GLOBAL(echofd), &sg); /* get settings */ + sg.sg_flags |= ECHO; /* turn echo on */ + STTY(GLOBAL(echofd), &sg); + GLOBAL(echofd) = -1; + } +} + +#endif /* !CMS_MVS */ +#endif /* ?VMS */ + + +#if (defined(UNZIP) && !defined(FUNZIP)) + +#if (defined(UNIX) || defined(__BEOS__)) +#ifdef MORE + +/* + * Get the number of lines on the output terminal. SCO Unix apparently + * defines TIOCGWINSZ but doesn't support it (!M_UNIX). + * + * GRR: will need to know width of terminal someday, too, to account for + * line-wrapping. + */ + +#if (defined(TIOCGWINSZ) && !defined(M_UNIX)) + +int screenlines() +{ + struct winsize wsz; +#ifdef DEBUG_WINSZ + static int firsttime = TRUE; +#endif + + /* see termio(4) under, e.g., SunOS */ + if (ioctl(1, TIOCGWINSZ, &wsz) == 0) { +#ifdef DEBUG_WINSZ + if (firsttime) { + firsttime = FALSE; + fprintf(stderr, "ttyio.c screenlines(): ws_row = %d\n", + wsz.ws_row); + } +#endif + /* number of columns = ws_col */ + return (wsz.ws_row > 0)? wsz.ws_row : 24; /* number of rows */ + + } else { /* this happens when piping to more(1), for example */ +#ifdef DEBUG_WINSZ + if (firsttime) { + firsttime = FALSE; + fprintf(stderr, + "ttyio.c screenlines(): ioctl(TIOCGWINSZ) failed\n")); + } +#endif + return 24; /* VT-100 assumed to be minimal hardware */ + } +} + +#else /* !TIOCGWINSZ: service not available, fall back to semi-bogus method */ + +int screenlines() +{ + char *envptr, *getenv(); + int n; + + /* GRR: this is overly simplistic, but don't have access to stty/gtty + * system anymore + */ + envptr = getenv("LINES"); + if (envptr == (char *)NULL || (n = atoi(envptr)) < 5) + return 24; /* VT-100 assumed to be minimal hardware */ + else + return n; +} + +#endif /* ?(TIOCGWINSZ && !M_UNIX) */ +#endif /* MORE */ + + +/* + * Get a character from the given file descriptor without echo or newline. + */ +int zgetch(__G__ f) + __GDEF + int f; /* file descriptor from which to read */ +{ +#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)) + char oldmin, oldtim; +#endif + char c; + struct sgttyb sg; /* tty device structure */ + + GTTY(f, &sg); /* get settings */ +#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)) + oldmin = sg.c_cc[VMIN]; /* save old values */ + oldtim = sg.c_cc[VTIME]; + sg.c_cc[VMIN] = 1; /* need only one char to return read() */ + sg.c_cc[VTIME] = 0; /* no timeout */ + sg.sg_flags &= ~ICANON; /* canonical mode off */ +#else + sg.sg_flags |= CBREAK; /* cbreak mode on */ +#endif + sg.sg_flags &= ~ECHO; /* turn echo off, too */ + STTY(f, &sg); /* set cbreak mode */ + GLOBAL(echofd) = f; /* in case ^C hit (not perfect: still CBREAK) */ + + read(f, &c, 1); /* read our character */ + +#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)) + sg.c_cc[VMIN] = oldmin; /* restore old values */ + sg.c_cc[VTIME] = oldtim; + sg.sg_flags |= ICANON; /* canonical mode on */ +#else + sg.sg_flags &= ~CBREAK; /* cbreak mode off */ +#endif + sg.sg_flags |= ECHO; /* turn echo on */ + STTY(f, &sg); /* restore canonical mode */ + GLOBAL(echofd) = -1; + + return (int)c; +} + + +#else /* !UNIX && !__BEOS__ */ + + +int zgetch(__G__ f) + __GDEF + int f; /* file descriptor from which to read (must be open already) */ +{ + char c, c2; + +/*--------------------------------------------------------------------------- + Get a character from the given file descriptor without echo; can't fake + CBREAK mode (i.e., newline required), but can get rid of all chars up to + and including newline. + ---------------------------------------------------------------------------*/ + + echoff(f); + read(f, &c, 1); + if (c != '\n') + do { + read(f, &c2, 1); /* throw away all other chars up thru newline */ + } while (c2 != '\n'); + echon(); + return (int)c; +} + +#endif /* ?(UNIX || __BEOS__) */ + +#endif /* UNZIP && !FUNZIP */ +#endif /* !HAVE_WORKING_GETCH */ + + +#if CRYPT /* getp() is only used with full encryption */ + +/* + * Simple compile-time check for source compatibility between + * zcrypt and ttyio: + */ +#if (!defined(CR_MAJORVER) || (CR_MAJORVER < 2) || (CR_MINORVER < 7)) + error: This Info-ZIP tool requires zcrypt 2.7 or later. +#endif + +/* + * Get a password of length n-1 or less into *p using the prompt *m. + * The entered password is not echoed. + */ + +#ifdef HAVE_WORKING_GETCH +/* + * For the AMIGA, getch() is defined as Agetch(), which is in + * amiga/filedate.c; SAS/C 6.x provides a getch(), but since Agetch() + * uses the infrastructure that is already in place in filedate.c, it is + * smaller. With this function, echoff() and echon() are not needed. + * + * For the MAC, a non-echo macgetch() function is defined in the MacOS + * specific sources which uses the event handling mechanism of the + * desktop window manager to get a character from the keyboard. + * + * For the other systems in this section, a non-echo getch() function + * is either contained the C runtime library (conio package), or getch() + * is defined as an alias for a similar system specific RTL function. + */ + +#ifndef WINDLL /* WINDLL does not support a console interface */ +#ifndef QDOS /* QDOS supplies a variant of this function */ + +/* This is the getp() function for all systems (with TTY type user interface) + * that supply a working `non-echo' getch() function for "raw" console input. + */ +char *getp(__G__ m, p, n) + __GDEF + ZCONST char *m; /* prompt for password */ + char *p; /* return value: line input */ + int n; /* bytes available in p[] */ +{ + char c; /* one-byte buffer for read() to use */ + int i; /* number of characters input */ + char *w; /* warning on retry */ + + /* get password */ + w = ""; + do { + fputs(w, stderr); /* warning if back again */ + fputs(m, stderr); /* display prompt and flush */ + fflush(stderr); + i = 0; + do { /* read line, keeping first n characters */ + if ((c = (char)getch()) == '\r') + c = '\n'; /* until user hits CR */ + if (c == 8 || c == 127) { + if (i > 0) i--; /* the `backspace' and `del' keys works */ + } + else if (i < n) + p[i++] = c; /* truncate past n */ + } while (c != '\n'); + PUTC('\n', stderr); fflush(stderr); + w = "(line too long--try again)\n"; + } while (p[i-1] != '\n'); + p[i-1] = 0; /* terminate at newline */ + + return p; /* return pointer to password */ + +} /* end function getp() */ + +#endif /* !QDOS */ +#endif /* !WINDLL */ + + +#else /* !HAVE_WORKING_GETCH */ + + +#if (defined(UNIX) || defined(__MINT__) || defined(__BEOS__)) + +#ifndef _PATH_TTY +# ifdef __MINT__ +# define _PATH_TTY ttyname(2) +# else +# define _PATH_TTY "/dev/tty" +# endif +#endif + +char *getp(__G__ m, p, n) + __GDEF + ZCONST char *m; /* prompt for password */ + char *p; /* return value: line input */ + int n; /* bytes available in p[] */ +{ + char c; /* one-byte buffer for read() to use */ + int i; /* number of characters input */ + char *w; /* warning on retry */ + int f; /* file descriptor for tty device */ + +#ifdef PASSWD_FROM_STDIN + /* Read from stdin. This is unsafe if the password is stored on disk. */ + f = 0; +#else + /* turn off echo on tty */ + + if ((f = open(_PATH_TTY, 0)) == -1) + return NULL; +#endif + /* get password */ + w = ""; + do { + fputs(w, stderr); /* warning if back again */ + fputs(m, stderr); /* prompt */ + fflush(stderr); + i = 0; + echoff(f); + do { /* read line, keeping n */ + read(f, &c, 1); + if (i < n) + p[i++] = c; + } while (c != '\n'); + echon(); + PUTC('\n', stderr); fflush(stderr); + w = "(line too long--try again)\n"; + } while (p[i-1] != '\n'); + p[i-1] = 0; /* terminate at newline */ + +#ifndef PASSWD_FROM_STDIN + close(f); +#endif + + return p; /* return pointer to password */ + +} /* end function getp() */ + +#endif /* UNIX || __MINT__ || __BEOS__ */ + + + +#if (defined(VMS) || defined(CMS_MVS)) + +char *getp(__G__ m, p, n) + __GDEF + ZCONST char *m; /* prompt for password */ + char *p; /* return value: line input */ + int n; /* bytes available in p[] */ +{ + char c; /* one-byte buffer for read() to use */ + int i; /* number of characters input */ + char *w; /* warning on retry */ + FILE *f; /* file structure for SYS$COMMAND device */ + +#ifdef PASSWD_FROM_STDIN + f = stdin; +#else + if ((f = fopen(ctermid(NULL), "r")) == NULL) + return NULL; +#endif + + /* get password */ + fflush(stdout); + w = ""; + do { + if (*w) /* bug: VMS apparently adds \n to NULL fputs */ + fputs(w, stderr); /* warning if back again */ + fputs(m, stderr); /* prompt */ + fflush(stderr); + i = 0; + echoff(f); + do { /* read line, keeping n */ + if ((c = (char)getc(f)) == '\r') + c = '\n'; + if (i < n) + p[i++] = c; + } while (c != '\n'); + echon(); + PUTC('\n', stderr); fflush(stderr); + w = "(line too long--try again)\n"; + } while (p[i-1] != '\n'); + p[i-1] = 0; /* terminate at newline */ +#ifndef PASSWD_FROM_STDIN + fclose(f); +#endif + + return p; /* return pointer to password */ + +} /* end function getp() */ + +#endif /* VMS || CMS_MVS */ +#endif /* ?HAVE_WORKING_GETCH */ +#endif /* CRYPT */ +#endif /* CRYPT || (UNZIP && !FUNZIP) */ diff --git a/utils/Install/sfxzip/unix.c b/utils/Install/sfxzip/unix.c new file mode 100644 index 0000000000..c9eaaabafc --- /dev/null +++ b/utils/Install/sfxzip/unix.c @@ -0,0 +1,1424 @@ +/*--------------------------------------------------------------------------- + + unix.c + + Unix-specific routines for use with Info-ZIP's UnZip 5.3 and later. + + Contains: readdir() + do_wild() <-- generic enough to put in fileio.c? + mapattr() + mapname() + checkdir() + mkdir() + close_outfile() + set_direc_attribs() + stamp_file() + version() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" + +#ifdef SCO_XENIX +# define SYSNDIR +#else /* SCO Unix, AIX, DNIX, TI SysV, Coherent 4.x, ... */ +# if defined(__convexc__) || defined(SYSV) || defined(CRAY) || defined(BSD4_4) +# define DIRENT +# endif +#endif +#if defined(_AIX) +# define DIRENT +#endif +#ifdef COHERENT +# if defined(_I386) || (defined(__COHERENT__) && (__COHERENT__ >= 0x420)) +# define DIRENT +# endif +#endif + +/* GRR: may need to uncomment this: */ +#if 0 +#if defined(_POSIX_VERSION) +# define DIRENT +#endif +#endif + +#ifdef DIRENT +# include <dirent.h> +#else +# ifdef SYSV +# ifdef SYSNDIR +# include <sys/ndir.h> +# else +# include <ndir.h> +# endif +# else /* !SYSV */ +# ifndef NO_SYSDIR +# include <sys/dir.h> +# endif +# endif /* ?SYSV */ +# ifndef dirent +# define dirent direct +# endif +#endif /* ?DIRENT */ + +#ifdef ACORN_FTYPE_NFS +/* Acorn bits for NFS filetyping */ +typedef struct { + uch ID[2]; + uch size[2]; + uch ID_2[4]; + uch loadaddr[4]; + uch execaddr[4]; + uch attr[4]; +} RO_extra_block; + +static int isRISCOSexfield OF((uch *extra_field)); +#endif /* ACORN_FTYPE_NFS */ + +static int created_dir; /* used in mapname(), checkdir() */ +static int renamed_fullpath; /* ditto */ + + +#ifndef SFX +#ifdef NO_DIR /* for AT&T 3B1 */ + +#define opendir(path) fopen(path,"r") +#define closedir(dir) fclose(dir) +typedef FILE DIR; + +/* + * Apparently originally by Rich Salz. + * Cleaned up and modified by James W. Birdsall. + */ +struct dirent *readdir(dirp) + DIR *dirp; +{ + static struct dirent entry; + + if (dirp == NULL) + return NULL; + + for (;;) + if (fread(&entry, sizeof (struct dirent), 1, dirp) == 0) + return (struct dirent *)NULL; + else if (entry.d_ino) + return &entry; + +} /* end function readdir() */ + +#endif /* NO_DIR */ + + +/**********************/ +/* Function do_wild() */ /* for porting: dir separator; match(ignore_case) */ +/**********************/ + +char *do_wild(__G__ wildspec) + __GDEF + char *wildspec; /* only used first time on a given dir */ +{ + static DIR *dir = (DIR *)NULL; + static char *dirname, *wildname, matchname[FILNAMSIZ]; + static int firstcall=TRUE, have_dirname, dirnamelen; + struct dirent *file; + + + /* Even when we're just returning wildspec, we *always* do so in + * matchname[]--calling routine is allowed to append four characters + * to the returned string, and wildspec may be a pointer to argv[]. + */ + if (firstcall) { /* first call: must initialize everything */ + firstcall = FALSE; + + if (!iswild(wildspec)) { + strcpy(matchname, wildspec); + have_dirname = FALSE; + dir = NULL; + return matchname; + } + + /* break the wildspec into a directory part and a wildcard filename */ + if ((wildname = strrchr(wildspec, '/')) == (char *)NULL) { + dirname = "."; + dirnamelen = 1; + have_dirname = FALSE; + wildname = wildspec; + } else { + ++wildname; /* point at character after '/' */ + dirnamelen = wildname - wildspec; + if ((dirname = (char *)malloc(dirnamelen+1)) == (char *)NULL) { + Info(slide, 0x201, ((char *)slide, + "warning: cannot allocate wildcard buffers\n")); + strcpy(matchname, wildspec); + return matchname; /* but maybe filespec was not a wildcard */ + } + strncpy(dirname, wildspec, dirnamelen); + dirname[dirnamelen] = '\0'; /* terminate for strcpy below */ + have_dirname = TRUE; + } + + if ((dir = opendir(dirname)) != (DIR *)NULL) { + while ((file = readdir(dir)) != (struct dirent *)NULL) { + Trace((stderr, "do_wild: readdir returns %s\n", file->d_name)); + if (file->d_name[0] == '.' && wildname[0] != '.') + continue; /* Unix: '*' and '?' do not match leading dot */ + if (match(file->d_name, wildname, 0) && /* 0 == case sens. */ + /* skip "." and ".." directory entries */ + strcmp(file->d_name, ".") && strcmp(file->d_name, "..")) { + Trace((stderr, "do_wild: match() succeeds\n")); + if (have_dirname) { + strcpy(matchname, dirname); + strcpy(matchname+dirnamelen, file->d_name); + } else + strcpy(matchname, file->d_name); + return matchname; + } + } + /* if we get to here directory is exhausted, so close it */ + closedir(dir); + dir = (DIR *)NULL; + } + + /* return the raw wildspec in case that works (e.g., directory not + * searchable, but filespec was not wild and file is readable) */ + strcpy(matchname, wildspec); + return matchname; + } + + /* last time through, might have failed opendir but returned raw wildspec */ + if (dir == (DIR *)NULL) { + firstcall = TRUE; /* nothing left to try--reset for new wildspec */ + if (have_dirname) + free(dirname); + return (char *)NULL; + } + + /* If we've gotten this far, we've read and matched at least one entry + * successfully (in a previous call), so dirname has been copied into + * matchname already. + */ + while ((file = readdir(dir)) != (struct dirent *)NULL) { + Trace((stderr, "do_wild: readdir returns %s\n", file->d_name)); + if (file->d_name[0] == '.' && wildname[0] != '.') + continue; /* Unix: '*' and '?' do not match leading dot */ + if (match(file->d_name, wildname, 0)) { /* 0 == don't ignore case */ + Trace((stderr, "do_wild: match() succeeds\n")); + if (have_dirname) { + /* strcpy(matchname, dirname); */ + strcpy(matchname+dirnamelen, file->d_name); + } else + strcpy(matchname, file->d_name); + return matchname; + } + } + + closedir(dir); /* have read at least one dir entry; nothing left */ + dir = (DIR *)NULL; + firstcall = TRUE; /* reset for new wildspec */ + if (have_dirname) + free(dirname); + return (char *)NULL; + +} /* end function do_wild() */ + +#endif /* !SFX */ + + + + + +/**********************/ +/* Function mapattr() */ +/**********************/ + +int mapattr(__G) + __GDEF +{ + ulg tmp = G.crec.external_file_attributes; + + G.pInfo->file_attr = 0; + /* initialized to 0 for check in "default" branch below... */ + + switch (G.pInfo->hostnum) { + case AMIGA_: + tmp = (unsigned)(tmp>>17 & 7); /* Amiga RWE bits */ + G.pInfo->file_attr = (unsigned)(tmp<<6 | tmp<<3 | tmp); + break; + case UNIX_: + case VMS_: + case ACORN_: + case ATARI_: + case BEOS_: + case QDOS_: + case TANDEM_: + G.pInfo->file_attr = (unsigned)(tmp >> 16); + if (G.pInfo->file_attr != 0 || !G.extra_field) { + return 0; + } else { + /* Some (non-Info-ZIP) implementations of Zip for Unix and + * VMS (and probably others ??) leave 0 in the upper 16-bit + * part of the external_file_attributes field. Instead, they + * store file permission attributes in some extra field. + * As a work-around, we search for the presence of one of + * these extra fields and fall back to the MSDOS compatible + * part of external_file_attributes if one of the known + * e.f. types has been detected. + * Later, we might implement extraction of the permission + * bits from the VMS extra field. But for now, the work-around + * should be sufficient to provide "readable" extracted files. + * (For ASI Unix e.f., an experimental remap from the e.f. + * mode value IS already provided!) + */ + ush ebID; + unsigned ebLen; + uch *ef = G.extra_field; + unsigned ef_len = G.crec.extra_field_length; + int r = FALSE; + + while (!r && ef_len >= EB_HEADSIZE) { + ebID = makeword(ef); + ebLen = (unsigned)makeword(ef+EB_LEN); + if (ebLen > (ef_len - EB_HEADSIZE)) + /* discoverd some e.f. inconsistency! */ + break; + switch (ebID) { + case EF_ASIUNIX: + if (ebLen >= (EB_ASI_MODE+2)) { + G.pInfo->file_attr = + (unsigned)makeword(ef+(EB_HEADSIZE+EB_ASI_MODE)); + /* force stop of loop: */ + ef_len = (ebLen + EB_HEADSIZE); + break; + } + /* else: fall through! */ + case EF_PKVMS: + /* "found nondecypherable e.f. with perm. attr" */ + r = TRUE; + default: + break; + } + ef_len -= (ebLen + EB_HEADSIZE); + ef += (ebLen + EB_HEADSIZE); + } + if (!r) + return 0; + } + /* fall through! */ + /* all remaining cases: expand MSDOS read-only bit into write perms */ + case FS_FAT_: + /* PKWARE's PKZip for Unix marks entries as FS_FAT_, but stores the + * Unix attributes in the upper 16 bits of the external attributes + * field, just like Info-ZIP's Zip for Unix. We try to use that + * value, after a check for consistency with the MSDOS attribute + * bits (see below). + */ + G.pInfo->file_attr = (unsigned)(tmp >> 16); + /* fall through! */ + case FS_HPFS_: + case FS_NTFS_: + case MAC_: + case TOPS20_: + default: + /* read-only bit --> write perms; subdir bit --> dir exec bit */ + tmp = !(tmp & 1) << 1 | (tmp & 0x10) >> 4; + if ((G.pInfo->file_attr & 0700) == (unsigned)(0400 | tmp<<6)) + /* keep previous G.pInfo->file_attr setting, when its "owner" + * part appears to be consistent with DOS attribute flags! + */ + return 0; + G.pInfo->file_attr = (unsigned)(0444 | tmp<<6 | tmp<<3 | tmp); + break; + } /* end switch (host-OS-created-by) */ + + /* for originating systems with no concept of "group," "other," "system": */ + umask( (int)(tmp=umask(0)) ); /* apply mask to expanded r/w(/x) perms */ + G.pInfo->file_attr &= ~tmp; + + return 0; + +} /* end function mapattr() */ + + + + + +/************************/ +/* Function mapname() */ +/************************/ + /* return 0 if no error, 1 if caution (filename */ +int mapname(__G__ renamed) /* truncated), 2 if warning (skip file because */ + __GDEF /* dir doesn't exist), 3 if error (skip file), */ + int renamed; /* or 10 if out of memory (skip file) */ +{ /* [also IZ_VOL_LABEL, IZ_CREATED_DIR] */ + char pathcomp[FILNAMSIZ]; /* path-component buffer */ + char *pp, *cp=(char *)NULL; /* character pointers */ + char *lastsemi=(char *)NULL; /* pointer to last semi-colon in pathcomp */ +#ifdef ACORN_FTYPE_NFS + char *lastcomma=(char *)NULL; /* pointer to last comma in pathcomp */ +#endif + int quote = FALSE; /* flags */ + int error = 0; + register unsigned workch; /* hold the character being tested */ + + +/*--------------------------------------------------------------------------- + Initialize various pointers and counters and stuff. + ---------------------------------------------------------------------------*/ + + if (G.pInfo->vollabel) + return IZ_VOL_LABEL; /* can't set disk volume labels in Unix */ + + /* can create path as long as not just freshening, or if user told us */ + G.create_dirs = (!uO.fflag || renamed); + + created_dir = FALSE; /* not yet */ + + /* user gave full pathname: don't prepend rootpath */ + renamed_fullpath = (renamed && (*G.filename == '/')); + + if (checkdir(__G__ (char *)NULL, INIT) == 10) + return 10; /* initialize path buffer, unless no memory */ + + *pathcomp = '\0'; /* initialize translation buffer */ + pp = pathcomp; /* point to translation buffer */ + if (uO.jflag) /* junking directories */ + cp = (char *)strrchr(G.filename, '/'); + if (cp == (char *)NULL) /* no '/' or not junking dirs */ + cp = G.filename; /* point to internal zipfile-member pathname */ + else + ++cp; /* point to start of last component of path */ + +/*--------------------------------------------------------------------------- + Begin main loop through characters in filename. + ---------------------------------------------------------------------------*/ + + while ((workch = (uch)*cp++) != 0) { + + if (quote) { /* if character quoted, */ + *pp++ = (char)workch; /* include it literally */ + quote = FALSE; + } else + switch (workch) { + case '/': /* can assume -j flag not given */ + *pp = '\0'; + if ((error = checkdir(__G__ pathcomp, APPEND_DIR)) > 1) + return error; + pp = pathcomp; /* reset conversion buffer for next piece */ + lastsemi = (char *)NULL; /* leave directory semi-colons alone */ + break; + + case ';': /* VMS version (or DEC-20 attrib?) */ + lastsemi = pp; + *pp++ = ';'; /* keep for now; remove VMS ";##" */ + break; /* later, if requested */ + +#ifdef ACORN_FTYPE_NFS + case ',': /* NFS filetype extension */ + lastcomma = pp; + *pp++ = ','; /* keep for now; may need to remove */ + break; /* later, if requested */ +#endif + + case '\026': /* control-V quote for special chars */ + quote = TRUE; /* set flag for next character */ + break; + +#ifdef MTS + case ' ': /* change spaces to underscore under */ + *pp++ = '_'; /* MTS; leave as spaces under Unix */ + break; +#endif + + default: + /* allow European characters in filenames: */ + if (isprint(workch) || (128 <= workch && workch <= 254)) + *pp++ = (char)workch; + } /* end switch */ + + } /* end while loop */ + + *pp = '\0'; /* done with pathcomp: terminate it */ + + /* if not saving them, remove VMS version numbers (appended ";###") */ + if (!uO.V_flag && lastsemi) { + pp = lastsemi + 1; + while (isdigit((uch)(*pp))) + ++pp; + if (*pp == '\0') /* only digits between ';' and end: nuke */ + *lastsemi = '\0'; + } + +#ifdef ACORN_FTYPE_NFS + /* translate Acorn filetype information if asked to do so */ + if (uO.acorn_nfs_ext && isRISCOSexfield(G.extra_field)) { + /* file *must* have a RISC OS extra field */ + int ft = (int)makelong(((RO_extra_block *)G.extra_field)->loadaddr); + /*32-bit*/ + if (lastcomma) { + pp = lastcomma + 1; + while (isxdigit((uch)(*pp))) ++pp; + if (pp == lastcomma+4 && *pp == '\0') *lastcomma='\0'; /* nuke */ + } + if ((ft & 1<<31)==0) ft=0x000FFD00; + sprintf(pathcomp+strlen(pathcomp), ",%03x", ft>>8 & 0xFFF); + } +#endif /* ACORN_FTYPE_NFS */ + +/*--------------------------------------------------------------------------- + Report if directory was created (and no file to create: filename ended + in '/'), check name to be sure it exists, and combine path and name be- + fore exiting. + ---------------------------------------------------------------------------*/ + + if (G.filename[strlen(G.filename) - 1] == '/') { + checkdir(__G__ G.filename, GETPATH); + if (created_dir) { + if (QCOND2) { + Info(slide, 0, ((char *)slide, " creating: %s\n", + G.filename)); + } +#ifndef NO_CHMOD + /* set approx. dir perms (make sure can still read/write in dir) */ + if (chmod(G.filename, (0xffff & G.pInfo->file_attr) | 0700)) + perror("chmod (directory attributes) error"); +#endif + return IZ_CREATED_DIR; /* set dir time (note trailing '/') */ + } + return 2; /* dir existed already; don't look for data to extract */ + } + + if (*pathcomp == '\0') { + Info(slide, 1, ((char *)slide, "mapname: conversion of %s failed\n", + G.filename)); + return 3; + } + + checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */ + checkdir(__G__ G.filename, GETPATH); + + return error; + +} /* end function mapname() */ + + + + +#if 0 /*========== NOTES ==========*/ + + extract-to dir: a:path/ + buildpath: path1/path2/ ... (NULL-terminated) + pathcomp: filename + + mapname(): + loop over chars in zipfile member name + checkdir(path component, COMPONENT | CREATEDIR) --> map as required? + (d:/tmp/unzip/) (disk:[tmp.unzip.) + (d:/tmp/unzip/jj/) (disk:[tmp.unzip.jj.) + (d:/tmp/unzip/jj/temp/) (disk:[tmp.unzip.jj.temp.) + finally add filename itself and check for existence? (could use with rename) + (d:/tmp/unzip/jj/temp/msg.outdir) (disk:[tmp.unzip.jj.temp]msg.outdir) + checkdir(name, GETPATH) --> copy path to name and free space + +#endif /* 0 */ + + + + +/***********************/ +/* Function checkdir() */ +/***********************/ + +int checkdir(__G__ pathcomp, flag) + __GDEF + char *pathcomp; + int flag; +/* + * returns: 1 - (on APPEND_NAME) truncated filename + * 2 - path doesn't exist, not allowed to create + * 3 - path doesn't exist, tried to create and failed; or + * path exists and is not a directory, but is supposed to be + * 4 - path is too long + * 10 - can't allocate memory for filename buffers + */ +{ + static int rootlen = 0; /* length of rootpath */ + static char *rootpath; /* user's "extract-to" directory */ + static char *buildpath; /* full path (so far) to extracted file */ + static char *end; /* pointer to end of buildpath ('\0') */ + +# define FN_MASK 7 +# define FUNCTION (flag & FN_MASK) + + + +/*--------------------------------------------------------------------------- + APPEND_DIR: append the path component to the path being built and check + for its existence. If doesn't exist and we are creating directories, do + so for this one; else signal success or error as appropriate. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_DIR) { + int too_long = FALSE; +#ifdef SHORT_NAMES + char *old_end = end; +#endif + + Trace((stderr, "appending dir segment [%s]\n", pathcomp)); + while ((*end = *pathcomp++) != '\0') + ++end; +#ifdef SHORT_NAMES /* path components restricted to 14 chars, typically */ + if ((end-old_end) > FILENAME_MAX) /* GRR: proper constant? */ + *(end = old_end + FILENAME_MAX) = '\0'; +#endif + + /* GRR: could do better check, see if overrunning buffer as we go: + * check end-buildpath after each append, set warning variable if + * within 20 of FILNAMSIZ; then if var set, do careful check when + * appending. Clear variable when begin new path. */ + + if ((end-buildpath) > FILNAMSIZ-3) /* need '/', one-char name, '\0' */ + too_long = TRUE; /* check if extracting directory? */ + if (stat(buildpath, &G.statbuf)) { /* path doesn't exist */ + if (!G.create_dirs) { /* told not to create (freshening) */ + free(buildpath); + return 2; /* path doesn't exist: nothing to do */ + } + if (too_long) { + Info(slide, 1, ((char *)slide, + "checkdir error: path too long: %s\n", buildpath)); + free(buildpath); + return 4; /* no room for filenames: fatal */ + } + if (mkdir(buildpath, 0777) == -1) { /* create the directory */ + Info(slide, 1, ((char *)slide, + "checkdir error: cannot create %s\n\ + unable to process %s.\n", buildpath, G.filename)); + free(buildpath); + return 3; /* path didn't exist, tried to create, failed */ + } + created_dir = TRUE; + } else if (!S_ISDIR(G.statbuf.st_mode)) { + Info(slide, 1, ((char *)slide, + "checkdir error: %s exists but is not directory\n\ + unable to process %s.\n", buildpath, G.filename)); + free(buildpath); + return 3; /* path existed but wasn't dir */ + } + if (too_long) { + Info(slide, 1, ((char *)slide, + "checkdir error: path too long: %s\n", buildpath)); + free(buildpath); + return 4; /* no room for filenames: fatal */ + } + *end++ = '/'; + *end = '\0'; + Trace((stderr, "buildpath now = [%s]\n", buildpath)); + return 0; + + } /* end if (FUNCTION == APPEND_DIR) */ + +/*--------------------------------------------------------------------------- + GETPATH: copy full path to the string pointed at by pathcomp, and free + buildpath. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == GETPATH) { + strcpy(pathcomp, buildpath); + Trace((stderr, "getting and freeing path [%s]\n", pathcomp)); + free(buildpath); + buildpath = end = (char *)NULL; + return 0; + } + +/*--------------------------------------------------------------------------- + APPEND_NAME: assume the path component is the filename; append it and + return without checking for existence. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_NAME) { +#ifdef SHORT_NAMES + char *old_end = end; +#endif + + Trace((stderr, "appending filename [%s]\n", pathcomp)); + while ((*end = *pathcomp++) != '\0') { + ++end; +#ifdef SHORT_NAMES /* truncate name at 14 characters, typically */ + if ((end-old_end) > FILENAME_MAX) /* GRR: proper constant? */ + *(end = old_end + FILENAME_MAX) = '\0'; +#endif + if ((end-buildpath) >= FILNAMSIZ) { + *--end = '\0'; + Info(slide, 0x201, ((char *)slide, + "checkdir warning: path too long; truncating\n\ + %s\n -> %s\n", G.filename, buildpath)); + return 1; /* filename truncated */ + } + } + Trace((stderr, "buildpath now = [%s]\n", buildpath)); + return 0; /* could check for existence here, prompt for new name... */ + } + +/*--------------------------------------------------------------------------- + INIT: allocate and initialize buffer space for the file currently being + extracted. If file was renamed with an absolute path, don't prepend the + extract-to path. + ---------------------------------------------------------------------------*/ + +/* GRR: for VMS and TOPS-20, add up to 13 to strlen */ + + if (FUNCTION == INIT) { + Trace((stderr, "initializing buildpath to ")); +#ifdef ACORN_FTYPE_NFS + if ((buildpath = (char *)malloc(strlen(G.filename)+rootlen+ + (uO.acorn_nfs_ext ? 5 : 1))) +#else + if ((buildpath = (char *)malloc(strlen(G.filename)+rootlen+1)) +#endif + == (char *)NULL) + return 10; + if ((rootlen > 0) && !renamed_fullpath) { + strcpy(buildpath, rootpath); + end = buildpath + rootlen; + } else { + *buildpath = '\0'; + end = buildpath; + } + Trace((stderr, "[%s]\n", buildpath)); + return 0; + } + +/*--------------------------------------------------------------------------- + ROOT: if appropriate, store the path in rootpath and create it if neces- + sary; else assume it's a zipfile member and return. This path segment + gets used in extracting all members from every zipfile specified on the + command line. + ---------------------------------------------------------------------------*/ + +#if (!defined(SFX) || defined(SFX_EXDIR)) + if (FUNCTION == ROOT) { + Trace((stderr, "initializing root path to [%s]\n", pathcomp)); + if (pathcomp == (char *)NULL) { + rootlen = 0; + return 0; + } + if ((rootlen = strlen(pathcomp)) > 0) { + if (pathcomp[rootlen-1] == '/') { + pathcomp[--rootlen] = '\0'; + } + if (rootlen > 0 && (stat(pathcomp, &G.statbuf) || + !S_ISDIR(G.statbuf.st_mode))) /* path does not exist */ + { + if (!G.create_dirs /* || iswild(pathcomp) */ ) { + rootlen = 0; + return 2; /* skip (or treat as stored file) */ + } + /* create the directory (could add loop here to scan pathcomp + * and create more than one level, but why really necessary?) */ + if (mkdir(pathcomp, 0777) == -1) { + Info(slide, 1, ((char *)slide, + "checkdir: cannot create extraction directory: %s\n", + pathcomp)); + rootlen = 0; /* path didn't exist, tried to create, and */ + return 3; /* failed: file exists, or 2+ levels required */ + } + } + if ((rootpath = (char *)malloc(rootlen+2)) == (char *)NULL) { + rootlen = 0; + return 10; + } + strcpy(rootpath, pathcomp); + rootpath[rootlen++] = '/'; + rootpath[rootlen] = '\0'; + Trace((stderr, "rootpath now = [%s]\n", rootpath)); + } + return 0; + } +#endif /* !SFX || SFX_EXDIR */ + +/*--------------------------------------------------------------------------- + END: free rootpath, immediately prior to program exit. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == END) { + Trace((stderr, "freeing rootpath\n")); + if (rootlen > 0) { + free(rootpath); + rootlen = 0; + } + return 0; + } + + return 99; /* should never reach */ + +} /* end function checkdir() */ + + + + + +#ifdef NO_MKDIR + +/********************/ +/* Function mkdir() */ +/********************/ + +int mkdir(path, mode) + char *path; + int mode; /* ignored */ +/* + * returns: 0 - successful + * -1 - failed (errno not set, however) + */ +{ + char command[FILNAMSIZ+40]; /* buffer for system() call */ + + /* GRR 930416: added single quotes around path to avoid bug with + * creating directories with ampersands in name; not yet tested */ + sprintf(command, "IFS=\" \t\n\" /bin/mkdir '%s' 2>/dev/null", path); + if (system(command)) + return -1; + return 0; +} + +#endif /* NO_MKDIR */ + + + + + +#if 0 +#ifdef MORE + +/**************************/ +/* Function screenlines() */ +/**************************/ + +int screenlines() +{ + char *envptr, *getenv(); + int n; + + /* GRR: this is overly simplistic; should use winsize struct and + * appropriate TIOCGWINSZ ioctl(), assuming exists on enough systems + */ + envptr = getenv("LINES"); + if (envptr == (char *)NULL || (n = atoi(envptr)) < 5) + return 24; /* VT-100 assumed to be minimal hardware */ + else + return n; +} + +#endif /* MORE */ +#endif /* 0 */ + + + + + +#ifndef MTS + +/****************************/ +/* Function close_outfile() */ +/****************************/ + +void close_outfile(__G) /* GRR: change to return PK-style warning level */ + __GDEF +{ + iztimes zt; + ush z_uidgid[2]; + unsigned eb_izux_flg; + +/*--------------------------------------------------------------------------- + If symbolic links are supported, allocate a storage area, put the uncom- + pressed "data" in it, and create the link. Since we know it's a symbolic + link to start with, we shouldn't have to worry about overflowing unsigned + ints with unsigned longs. + ---------------------------------------------------------------------------*/ + +#ifdef SYMLINKS + if (G.symlnk) { + unsigned ucsize = (unsigned)G.lrec.ucsize; + char *linktarget = (char *)malloc((unsigned)G.lrec.ucsize+1); + + fclose(G.outfile); /* close "data" file... */ + G.outfile = fopen(G.filename, FOPR); /* ...and reopen for reading */ + if (!linktarget || fread(linktarget, 1, ucsize, G.outfile) != + (int)ucsize) + { + Info(slide, 0x201, ((char *)slide, + "warning: symbolic link (%s) failed\n", G.filename)); + if (linktarget) + free(linktarget); + fclose(G.outfile); + return; + } + fclose(G.outfile); /* close "data" file for good... */ + unlink(G.filename); /* ...and delete it */ + linktarget[ucsize] = '\0'; + if (QCOND2) + Info(slide, 0, ((char *)slide, "-> %s ", linktarget)); + if (symlink(linktarget, G.filename)) /* create the real link */ + perror("symlink error"); + free(linktarget); + return; /* can't set time on symlinks */ + } +#endif /* SYMLINKS */ + + fclose(G.outfile); +#ifdef QLZIP + if (G.extra_field) { + static void qlfix OF((__GPRO__ uch *ef_ptr, unsigned ef_len)); + + qlfix(__G__ G.extra_field, G.lrec.extra_field_length); + } +#endif + +/*--------------------------------------------------------------------------- + Convert from MSDOS-format local time and date to Unix-format 32-bit GMT + time: adjust base year from 1980 to 1970, do usual conversions from + yy/mm/dd hh:mm:ss to elapsed seconds, and account for timezone and day- + light savings time differences. If we have a Unix extra field, however, + we're laughing: both mtime and atime are ours. On the other hand, we + then have to check for restoration of UID/GID. + ---------------------------------------------------------------------------*/ + + eb_izux_flg = (G.extra_field ? ef_scan_for_izux(G.extra_field, + G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime, +#ifdef IZ_CHECK_TZ + (G.tz_is_valid ? &zt : NULL), +#else + &zt, +#endif + z_uidgid) : 0); + if (eb_izux_flg & EB_UT_FL_MTIME) { + TTrace((stderr, "\nclose_outfile: Unix e.f. modif. time = %ld\n", + zt.mtime)); + } else { + zt.mtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime); + } + if (eb_izux_flg & EB_UT_FL_ATIME) { + TTrace((stderr, "close_outfile: Unix e.f. access time = %ld\n", + zt.atime)); + } else { + zt.atime = zt.mtime; + TTrace((stderr, "\nclose_outfile: modification/access times = %ld\n", + zt.mtime)); + } + + /* if -X option was specified and we have UID/GID info, restore it */ + if (uO.X_flag && eb_izux_flg & EB_UX2_VALID) { + TTrace((stderr, "close_outfile: restoring Unix UID/GID info\n")); + if (chown(G.filename, (uid_t)z_uidgid[0], (gid_t)z_uidgid[1])) + { + if (uO.qflag) + Info(slide, 0x201, ((char *)slide, + "warning: cannot set UID %d and/or GID %d for %s\n", + z_uidgid[0], z_uidgid[1], G.filename)); + else + Info(slide, 0x201, ((char *)slide, + " (warning) cannot set UID %d and/or GID %d", + z_uidgid[0], z_uidgid[1])); + } + } + + /* set the file's access and modification times */ + if (utime(G.filename, (ztimbuf *)&zt)) { +#ifdef AOS_VS + if (uO.qflag) + Info(slide, 0x201, ((char *)slide, "... cannot set time for %s\n", + G.filename)); + else + Info(slide, 0x201, ((char *)slide, "... cannot set time")); +#else + if (uO.qflag) + Info(slide, 0x201, ((char *)slide, + "warning: cannot set times for %s\n", G.filename)); + else + Info(slide, 0x201, ((char *)slide, + " (warning) cannot set times")); +#endif /* ?AOS_VS */ + } + +/*--------------------------------------------------------------------------- + Change the file permissions from default ones to those stored in the + zipfile. + ---------------------------------------------------------------------------*/ + +#ifndef NO_CHMOD + if (chmod(G.filename, 0xffff & G.pInfo->file_attr)) + perror("chmod (file attributes) error"); +#endif + +} /* end function close_outfile() */ + +#endif /* !MTS */ + + + + +#ifdef SET_DIR_ATTRIB +/* messages of code for setting directory attributes */ +static char Far DirlistUidGidFailed[] = + "warning: cannot set UID %d and/or GID %d for %s\n"; +static char Far DirlistUtimeFailed[] = + "warning: cannot set modification, access times for %s\n"; +# ifndef NO_CHMOD + static char Far DirlistChmodFailed[] = + "warning: cannot set permissions for %s\n"; +# endif + + +int set_direc_attribs(__G__ d) + __GDEF + dirtime *d; +{ + int errval = PK_OK; + + if (d->have_uidgid && + chown(d->fn, (uid_t)d->uidgid[0], (gid_t)d->uidgid[1])) + { + Info(slide, 0x201, ((char *)slide, + LoadFarString(DirlistUidGidFailed), + d->uidgid[0], d->uidgid[1], d->fn)); + if (!errval) + errval = PK_WARN; + } + if (utime(d->fn, &d->u.t2)) { + Info(slide, 0x201, ((char *)slide, + LoadFarString(DirlistUtimeFailed), d->fn)); + if (!errval) + errval = PK_WARN; + } +#ifndef NO_CHMOD + if (chmod(d->fn, 0xffff & d->perms)) { + Info(slide, 0x201, ((char *)slide, + LoadFarString(DirlistChmodFailed), d->fn)); + /* perror("chmod (file attributes) error"); */ + if (!errval) + errval = PK_WARN; + } +#endif /* !NO_CHMOD */ + return errval; +} /* end function set_directory_attributes() */ + +#endif /* SET_DIR_ATTRIB */ + + + + +#ifdef TIMESTAMP + +/***************************/ +/* Function stamp_file() */ +/***************************/ + +int stamp_file(fname, modtime) + ZCONST char *fname; + time_t modtime; +{ + ztimbuf tp; + + tp.modtime = tp.actime = modtime; + return (utime(fname, &tp)); + +} /* end function stamp_file() */ + +#endif /* TIMESTAMP */ + + + + +#ifndef SFX + +/************************/ +/* Function version() */ +/************************/ + +void version(__G) + __GDEF +{ +#if defined(CRAY) || defined(NX_CURRENT_COMPILER_RELEASE) || defined(NetBSD) + char buf1[40]; +#if defined(CRAY) || defined(NX_CURRENT_COMPILER_RELEASE) + char buf2[40]; +#endif +#endif + + /* Pyramid, NeXT have problems with huge macro expansion, too: no Info() */ + sprintf((char *)slide, LoadFarString(CompiledWith), + +#ifdef __GNUC__ +# ifdef NX_CURRENT_COMPILER_RELEASE + (sprintf(buf1, "NeXT DevKit %d.%02d ", NX_CURRENT_COMPILER_RELEASE/100, + NX_CURRENT_COMPILER_RELEASE%100), buf1), + (strlen(__VERSION__) > 8)? "(gcc)" : + (sprintf(buf2, "(gcc %s)", __VERSION__), buf2), +# else + "gcc ", __VERSION__, +# endif +#else +# if defined(CRAY) && defined(_RELEASE) + "cc ", (sprintf(buf1, "version %d", _RELEASE), buf1), +# else +# ifdef __VERSION__ + "cc ", __VERSION__, +# else + "cc", "", +# endif +# endif +#endif + + "Unix", + +#if defined(sgi) || defined(__sgi) + " (Silicon Graphics IRIX)", +#else +#ifdef sun +# ifdef sparc +# ifdef __SVR4 + " (Sun SPARC/Solaris)", +# else /* may or may not be SunOS */ + " (Sun SPARC)", +# endif +# else +# if defined(sun386) || defined(i386) + " (Sun 386i)", +# else +# if defined(mc68020) || defined(__mc68020__) + " (Sun 3)", +# else /* mc68010 or mc68000: Sun 2 or earlier */ + " (Sun 2)", +# endif +# endif +# endif +#else +#ifdef __hpux + " (HP/UX)", +#else +#ifdef __osf__ + " (DEC OSF/1)", +#else +#ifdef _AIX + " (IBM AIX)", +#else +#ifdef aiws + " (IBM RT/AIX)", +#else +#if defined(CRAY) || defined(cray) +# ifdef _UNICOS + (sprintf(buf2, " (Cray UNICOS release %d)", _UNICOS), buf2), +# else + " (Cray UNICOS)", +# endif +#else +#if defined(uts) || defined(UTS) + " (Amdahl UTS)", +#else +#ifdef NeXT +# ifdef mc68000 + " (NeXTStep/black)", +# else + " (NeXTStep for Intel)", +# endif +#else /* the next dozen or so are somewhat order-dependent */ +#ifdef LINUX +# ifdef __ELF__ + " (Linux ELF)", +# else + " (Linux a.out)", +# endif +#else +#ifdef MINIX + " (Minix)", +#else +#ifdef M_UNIX + " (SCO Unix)", +#else +#ifdef M_XENIX + " (SCO Xenix)", +#else +#ifdef __NetBSD__ +# ifdef NetBSD0_8 + (sprintf(buf1, " (NetBSD 0.8%c)", (char)(NetBSD0_8 - 1 + 'A')), buf1), +# else +# ifdef NetBSD0_9 + (sprintf(buf1, " (NetBSD 0.9%c)", (char)(NetBSD0_9 - 1 + 'A')), buf1), +# else +# ifdef NetBSD1_0 + (sprintf(buf1, " (NetBSD 1.0%c)", (char)(NetBSD1_0 - 1 + 'A')), buf1), +# else + (BSD4_4 == 0.5)? " (NetBSD before 0.9)" : " (NetBSD 1.1 or later)", +# endif +# endif +# endif +#else +#ifdef __FreeBSD__ + (BSD4_4 == 0.5)? " (FreeBSD 1.x)" : " (FreeBSD 2.0 or later)", +#else +#ifdef __bsdi__ + (BSD4_4 == 0.5)? " (BSD/386 1.0)" : " (BSD/386 1.1 or later)", +#else +#ifdef __386BSD__ + (BSD4_4 == 1)? " (386BSD, post-4.4 release)" : " (386BSD)", +#else +#if defined(i486) || defined(__i486) || defined(__i486__) + " (Intel 486)", +#else +#if defined(i386) || defined(__i386) || defined(__i386__) + " (Intel 386)", +#else +#ifdef pyr + " (Pyramid)", +#else +#ifdef ultrix +# ifdef mips + " (DEC/MIPS)", +# else +# ifdef vax + " (DEC/VAX)", +# else /* __alpha? */ + " (DEC/Alpha)", +# endif +# endif +#else +#ifdef gould + " (Gould)", +#else +#ifdef MTS + " (MTS)", +#else +#ifdef __convexc__ + " (Convex)", +#else +#ifdef __QNX__ + " (QNX 4)", +#else +#ifdef __QNXNTO__ + " (QNX Neutrino)", +#else +#ifdef Lynx + " (LynxOS)", +#else + "", +#endif /* Lynx */ +#endif /* QNX Neutrino */ +#endif /* QNX 4 */ +#endif /* Convex */ +#endif /* MTS */ +#endif /* Gould */ +#endif /* DEC */ +#endif /* Pyramid */ +#endif /* 386 */ +#endif /* 486 */ +#endif /* 386BSD */ +#endif /* BSDI BSD/386 */ +#endif /* NetBSD */ +#endif /* FreeBSD */ +#endif /* SCO Xenix */ +#endif /* SCO Unix */ +#endif /* Minix */ +#endif /* Linux */ +#endif /* NeXT */ +#endif /* Amdahl */ +#endif /* Cray */ +#endif /* RT/AIX */ +#endif /* AIX */ +#endif /* OSF/1 */ +#endif /* HP/UX */ +#endif /* Sun */ +#endif /* SGI */ + +#ifdef __DATE__ + " on ", __DATE__ +#else + "", "" +#endif + ); + + (*G.message)((zvoid *)&G, slide, (ulg)strlen((char *)slide), 0); + +} /* end function version() */ + +#endif /* !SFX */ + + + + +#ifdef QLZIP + +struct qdirect { + long d_length __attribute__ ((packed)); /* file length */ + unsigned char d_access __attribute__ ((packed)); /* file access type */ + unsigned char d_type __attribute__ ((packed)); /* file type */ + long d_datalen __attribute__ ((packed)); /* data length */ + long d_reserved __attribute__ ((packed));/* Unused */ + short d_szname __attribute__ ((packed)); /* size of name */ + char d_name[36] __attribute__ ((packed));/* name area */ + long d_update __attribute__ ((packed)); /* last update */ + long d_refdate __attribute__ ((packed)); + long d_backup __attribute__ ((packed)); /* EOD */ +}; + +#define LONGID "QDOS02" +#define EXTRALEN (sizeof(struct qdirect) + 8) +#define JBLONGID "QZHD" +#define JBEXTRALEN (sizeof(jbextra) - 4 * sizeof(char)) + +typedef struct { + char eb_header[4] __attribute__ ((packed)); /* place_holder */ + char longid[8] __attribute__ ((packed)); + struct qdirect header __attribute__ ((packed)); +} qdosextra; + +typedef struct { + char eb_header[4]; /* place_holder */ + char longid[4]; + struct qdirect header; +} jbextra; + + + +/* The following two functions SH() and LG() convert big-endian short + * and long numbers into native byte order. They are some kind of + * counterpart to the generic UnZip's makeword() and makelong() functions. + */ +static ush SH(ush val) +{ + uch swapbuf[2]; + + swapbuf[1] = (uch)(val & 0xff); + swapbuf[0] = (uch)(val >> 8); + return (*(ush *)swapbuf); +} + + + +static ulg LG(ulg val) +{ + /* convert the big-endian unsigned long number `val' to the machine + * dependant representation + */ + ush swapbuf[2]; + + swapbuf[1] = SH((ush)(val & 0xffff)); + swapbuf[0] = SH((ush)(val >> 16)); + return (*(ulg *)swapbuf); +} + + + +static void qlfix(__G__ ef_ptr, ef_len) + __GDEF + uch *ef_ptr; + unsigned ef_len; +{ + while (ef_len >= EB_HEADSIZE) + { + unsigned eb_id = makeword(EB_ID + ef_ptr); + unsigned eb_len = makeword(EB_LEN + ef_ptr); + + if (eb_len > (ef_len - EB_HEADSIZE)) { + /* discovered some extra field inconsistency! */ + Trace((stderr, + "qlfix: block length %u > rest ef_size %u\n", eb_len, + ef_len - EB_HEADSIZE)); + break; + } + + switch (eb_id) { + case EF_QDOS: + { + struct _ntc_ + { + long id; + long dlen; + } ntc; + long dlen = 0; + + qdosextra *extra = (qdosextra *)ef_ptr; + jbextra *jbp = (jbextra *)ef_ptr; + + if (!strncmp(extra->longid, LONGID, strlen(LONGID))) + { + if (eb_len != EXTRALEN) + if (uO.qflag) + Info(slide, 0x201, ((char *)slide, + "warning: invalid length in Qdos field for %s\n", + G.filename)); + else + Info(slide, 0x201, ((char *)slide, + "warning: invalid length in Qdos field")); + + if (extra->header.d_type) + { + dlen = extra->header.d_datalen; + } + } + + if (!strncmp(jbp->longid, JBLONGID, strlen(JBLONGID))) + { + if (eb_len != JBEXTRALEN) + if (uO.qflag) + Info(slide, 0x201, ((char *)slide, + "warning: invalid length in QZ field for %s\n", + G.filename)); + else + Info(slide, 0x201, ((char *)slide, + "warning: invalid length in QZ field")); + if(jbp->header.d_type) + { + dlen = jbp->header.d_datalen; + } + } + + if ((long)LG(dlen) > 0) + { + G.outfile = fopen(G.filename,"r+"); + fseek(G.outfile, -8, SEEK_END); + fread(&ntc, 8, 1, G.outfile); + if(ntc.id != *(long *)"XTcc") + { + ntc.id = *(long *)"XTcc"; + ntc.dlen = dlen; + fwrite (&ntc, 8, 1, G.outfile); + } + Info(slide, 0x201, ((char *)slide, "QData = %d", LG(dlen))); + fclose(G.outfile); + } + return; /* finished, cancel further extra field scanning */ + } + + default: + Trace((stderr,"qlfix: unknown extra field block, ID=%d\n", + eb_id)); + } + + /* Skip this extra field block */ + ef_ptr += (eb_len + EB_HEADSIZE); + ef_len -= (eb_len + EB_HEADSIZE); + } +} +#endif /* QLZIP */ + + + + +#ifdef ACORN_FTYPE_NFS + +/* Acorn bits for NFS filetyping */ + +static int isRISCOSexfield(uch *extra_field) +{ + if (extra_field != NULL) { + RO_extra_block *block = (RO_extra_block *)extra_field; + return ( + makeword(block->ID) == EF_SPARK && + (makeword(block->size) == 24 || makeword(block->size) == 20) && + makelong(block->ID_2) == 0x30435241 /* ARC0 */); + } + return FALSE; +} +#endif /* ACORN_FTYPE_NFS */ diff --git a/utils/Install/sfxzip/unreduce.c b/utils/Install/sfxzip/unreduce.c new file mode 100644 index 0000000000..4cfb3fec6f --- /dev/null +++ b/utils/Install/sfxzip/unreduce.c @@ -0,0 +1,230 @@ +/*--------------------------------------------------------------------------- + + unreduce.c + + The Reducing algorithm is actually a combination of two distinct algorithms. + The first algorithm compresses repeated byte sequences, and the second al- + gorithm takes the compressed stream from the first algorithm and applies a + probabilistic compression method. + + * Copyright 1989 Samuel H. Smith; All rights reserved + * + * Do not distribute modified versions without my permission. + * Do not remove or alter this notice or any other copyright notice. + * If you use this in your own program you must distribute source code. + * Do not use any of this in a commercial product. + + See the accompanying file "COPYING" in UnZip source and binary distributions + for further information. This code is NOT used unless USE_SMITH_CODE is + explicitly defined (==> COPYRIGHT_CLEAN is not defined). + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" /* defines COPYRIGHT_CLEAN by default */ + + +#ifndef COPYRIGHT_CLEAN + +/**************************************/ +/* UnReduce Defines, Typedefs, etc. */ +/**************************************/ + +#define DLE 144 + +typedef uch f_array[64]; /* for followers[256][64] */ + + + +/******************************/ +/* UnReduce Local Functions */ +/******************************/ + +static void LoadFollowers OF((__GPRO__ f_array *followers, uch *Slen)); + + + +/*******************************/ +/* UnReduce Global Constants */ +/*******************************/ + +static ZCONST shrint L_table[] = +{0, 0x7f, 0x3f, 0x1f, 0x0f}; + +static ZCONST shrint D_shift[] = +{0, 0x07, 0x06, 0x05, 0x04}; +static ZCONST shrint D_mask[] = +{0, 0x01, 0x03, 0x07, 0x0f}; + +static ZCONST shrint B_table[] = +{8, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8}; + + + + + +/*************************/ +/* Function unreduce() */ +/*************************/ + +void unreduce(__G) /* expand probabilistically reduced data */ + __GDEF +{ + register int lchar = 0; + shrint nchar; + shrint ExState = 0; + shrint V = 0; + shrint Len = 0; + long s = G.ucsize; /* number of bytes left to decompress */ + unsigned w = 0; /* position in output window slide[] */ + unsigned u = 1; /* true if slide[] unflushed */ + uch Slen[256]; + + f_array *followers = (f_array *)(slide + 0x4000); + int factor = G.lrec.compression_method - 1; + + LoadFollowers(__G__ followers, Slen); + + while (s > 0 /* && (!zipeof) */) { + if (Slen[lchar] == 0) + READBITS(8, nchar) /* ; */ + else { + READBITS(1, nchar) /* ; */ + if (nchar != 0) + READBITS(8, nchar) /* ; */ + else { + shrint follower; + int bitsneeded = B_table[Slen[lchar]]; + + READBITS(bitsneeded, follower) /* ; */ + nchar = followers[lchar][follower]; + } + } + /* expand the resulting byte */ + switch (ExState) { + + case 0: + if (nchar != DLE) { + s--; + slide[w++] = (uch)nchar; + if (w == 0x4000) { + flush(__G__ slide, (ulg)w, 0); + w = u = 0; + } + } + else + ExState = 1; + break; + + case 1: + if (nchar != 0) { + V = nchar; + Len = V & L_table[factor]; + if (Len == L_table[factor]) + ExState = 2; + else + ExState = 3; + } else { + s--; + slide[w++] = DLE; + if (w == 0x4000) + { + flush(__G__ slide, (ulg)w, 0); + w = u = 0; + } + ExState = 0; + } + break; + + case 2:{ + Len += nchar; + ExState = 3; + } + break; + + case 3:{ + register unsigned e; + register unsigned n = Len + 3; + register unsigned d = w - ((((V >> D_shift[factor]) & + D_mask[factor]) << 8) + nchar + 1); + + s -= n; + do { + n -= (e = (e = 0x4000 - ((d &= 0x3fff) > w ? d : w)) > n ? + n : e); + if (u && w <= d) + { + memzero(slide + w, e); + w += e; + d += e; + } + else + if (w - d < e) /* (assume unsigned comparison) */ + do { /* slow to avoid memcpy() overlap */ + slide[w++] = slide[d++]; + } while (--e); + else + { + memcpy(slide + w, slide + d, e); + w += e; + d += e; + } + if (w == 0x4000) + { + flush(__G__ slide, (ulg)w, 0); + w = u = 0; + } + } while (n); + + ExState = 0; + } + break; + } + + /* store character for next iteration */ + lchar = nchar; + } + + /* flush out slide */ + flush(__G__ slide, (ulg)w, 0); +} + + + + + +/******************************/ +/* Function LoadFollowers() */ +/******************************/ + +static void LoadFollowers(__G__ followers, Slen) + __GDEF + f_array *followers; + uch *Slen; +{ + register int x; + register int i; + + for (x = 255; x >= 0; x--) { + READBITS(6, Slen[x]) /* ; */ + for (i = 0; (uch)i < Slen[x]; i++) + READBITS(8, followers[x][i]) /* ; */ + } +} + +#endif /* !COPYRIGHT_CLEAN */ diff --git a/utils/Install/sfxzip/unshrink.c b/utils/Install/sfxzip/unshrink.c new file mode 100644 index 0000000000..287b4baf54 --- /dev/null +++ b/utils/Install/sfxzip/unshrink.c @@ -0,0 +1,301 @@ +/*--------------------------------------------------------------------------- + + unshrink.c version 1.21 23 Nov 95 + + + NOTE: This code may or may not infringe on the so-called "Welch + patent" owned by Unisys. (From reading the patent, it appears + that a pure LZW decompressor is *not* covered, but this claim has + not been tested in court, and Unisys is reported to believe other- + wise.) It is therefore the responsibility of the user to acquire + whatever license(s) may be required for legal use of this code. + + THE INFO-ZIP GROUP DISCLAIMS ALL LIABILITY FOR USE OF THIS CODE + IN VIOLATION OF APPLICABLE PATENT LAW. + + + Shrinking is basically a dynamic LZW algorithm with allowed code sizes of + up to 13 bits; in addition, there is provision for partial clearing of + leaf nodes. PKWARE uses the special code 256 (decimal) to indicate a + change in code size or a partial clear of the code tree: 256,1 for the + former and 256,2 for the latter. [Note that partial clearing can "orphan" + nodes: the parent-to-be can be cleared before its new child is added, + but the child is added anyway (as an orphan, as though the parent still + existed). When the tree fills up to the point where the parent node is + reused, the orphan is effectively "adopted." Versions prior to 1.05 were + affected more due to greater use of pointers (to children and siblings + as well as parents).] + + This replacement version of unshrink.c was written from scratch. It is + based only on the algorithms described in Mark Nelson's _The Data Compres- + sion Book_ and in Terry Welch's original paper in the June 1984 issue of + IEEE _Computer_; no existing source code, including any in Nelson's book, + was used. + + Memory requirements have been reduced in this version and are now no more + than the original Sam Smith code. This is still larger than any of the + other algorithms: at a minimum, 8K+8K+16K (stack+values+parents) assuming + 16-bit short ints, and this does not even include the output buffer (the + other algorithms leave the uncompressed data in the work area, typically + called slide[]). For machines with a 64KB data space this is a problem, + particularly when text conversion is required and line endings have more + than one character. UnZip's solution is to use two roughly equal halves + of outbuf for the ASCII conversion in such a case; the "unshrink" argument + to flush() signals that this is the case. + + For large-memory machines, a second outbuf is allocated for translations, + but only if unshrinking and only if translations are required. + + | binary mode | text mode + --------------------------------------------------- + big mem | big outbuf | big outbuf + big outbuf2 <- malloc'd here + small mem | small outbuf | half + half small outbuf + + Copyright 1994, 1995 Greg Roelofs. See the accompanying file "COPYING" + in UnZip 5.20 (or later) source or binary distributions. + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" /* defines LZW_CLEAN by default */ + + +#ifndef LZW_CLEAN + +static void partial_clear OF((__GPRO)); + +#ifdef DEBUG +# define OUTDBG(c) \ + if ((c)<32 || (c)>=127) pipeit("\\x%02x",(c)); else { } +#else +# define OUTDBG(c) +#endif + +/* HSIZE is defined as 2^13 (8192) in unzip.h */ +#define BOGUSCODE 256 +#define FLAG_BITS parent /* upper bits of parent[] used as flag bits */ +#define CODE_MASK (HSIZE - 1) /* 0x1fff (lower bits are parent's index) */ +#define FREE_CODE HSIZE /* 0x2000 (code is unused or was cleared) */ +#define HAS_CHILD (HSIZE << 1) /* 0x4000 (code has a child--do not clear) */ + +#define parent G.area.shrink.Parent +#define Value G.area.shrink.value /* "value" conflicts with Pyramid ioctl.h */ +#define stack G.area.shrink.Stack + + +/***********************/ +/* Function unshrink() */ +/***********************/ + +int unshrink(__G) + __GDEF +{ + int offset = (HSIZE - 1); + uch *stacktop = stack + offset; + register uch *newstr; + int codesize=9, len, KwKwK, error; + shrint code, oldcode, freecode, curcode; + shrint lastfreecode; + unsigned int outbufsiz; +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + /* Normally realbuf and outbuf will be the same. However, if the data + * are redirected to a large memory buffer, realbuf will point to the + * new location while outbuf will remain pointing to the malloc'd + * memory buffer. */ + uch *realbuf = G.outbuf; +#else +# define realbuf G.outbuf +#endif + + +/*--------------------------------------------------------------------------- + Initialize various variables. + ---------------------------------------------------------------------------*/ + + lastfreecode = BOGUSCODE; + +#ifndef VMS /* VMS uses its own buffer scheme for textmode flush(). */ +#ifndef SMALL_MEM + /* non-memory-limited machines: allocate second (large) buffer for + * textmode conversion in flush(), but only if needed */ + if (G.pInfo->textmode && !G.outbuf2 && + (G.outbuf2 = (uch *)malloc(TRANSBUFSIZ)) == (uch *)NULL) + return PK_MEM3; +#endif +#endif /* !VMS */ + + for (code = 0; code < BOGUSCODE; ++code) { + Value[code] = (uch)code; + parent[code] = BOGUSCODE; + } + for (code = BOGUSCODE+1; code < HSIZE; ++code) + parent[code] = FREE_CODE; + +#if (defined(DLL) && !defined(NO_SLIDE_REDIR)) + if (G.redirect_slide) { /* use normal outbuf unless we're a DLL routine */ + realbuf = G.redirect_buffer; + outbufsiz = G.redirect_size; + } else +#endif +#ifdef DLL + if (G.pInfo->textmode && !G.redirect_data) +#else + if (G.pInfo->textmode) +#endif + outbufsiz = RAWBUFSIZ; + else + outbufsiz = OUTBUFSIZ; + G.outptr = realbuf; + G.outcnt = 0L; + +/*--------------------------------------------------------------------------- + Get and output first code, then loop over remaining ones. + ---------------------------------------------------------------------------*/ + + READBITS(codesize, oldcode) + if (!G.zipeof) { + *G.outptr++ = (uch)oldcode; + OUTDBG((uch)oldcode) + ++G.outcnt; + } + + do { + READBITS(codesize, code) + if (G.zipeof) + break; + if (code == BOGUSCODE) { /* possible to have consecutive escapes? */ + READBITS(codesize, code) + if (code == 1) { + ++codesize; + Trace((stderr, " (codesize now %d bits)\n", codesize)); + } else if (code == 2) { + Trace((stderr, " (partial clear code)\n")); + partial_clear(__G); /* clear leafs (nodes with no children) */ + Trace((stderr, " (done with partial clear)\n")); + lastfreecode = BOGUSCODE; /* reset start of free-node search */ + } + continue; + } + + /*----------------------------------------------------------------------- + Translate code: traverse tree from leaf back to root. + -----------------------------------------------------------------------*/ + + newstr = stacktop; + curcode = code; + + if (parent[curcode] == FREE_CODE) { + /* or (FLAG_BITS[curcode] & FREE_CODE)? */ + KwKwK = TRUE; + Trace((stderr, " (found a KwKwK code %d; oldcode = %d)\n", code, + oldcode)); + --newstr; /* last character will be same as first character */ + curcode = oldcode; + } else + KwKwK = FALSE; + + do { + *newstr-- = Value[curcode]; + curcode = (shrint)(parent[curcode] & CODE_MASK); + } while (curcode != BOGUSCODE); + + len = (int)(stacktop - newstr++); + if (KwKwK) + *stacktop = *newstr; + + /*----------------------------------------------------------------------- + Write expanded string in reverse order to output buffer. + -----------------------------------------------------------------------*/ + + Trace((stderr, "code %4d; oldcode %4d; char %3d (%c); string [", code, + oldcode, (int)(*newstr), (*newstr<32 || *newstr>=127)? ' ':*newstr)); + + { + register uch *p; + + for (p = newstr; p < newstr+len; ++p) { + *G.outptr++ = *p; + OUTDBG(*p) + if (++G.outcnt == outbufsiz) { + Trace((stderr, "doing flush(), outcnt = %lu\n", G.outcnt)); + if ((error = flush(__G__ realbuf, G.outcnt, TRUE)) != 0) + pipeit("unshrink: flush() error (%d)\n", + error); + Trace((stderr, "done with flush()\n")); + G.outptr = realbuf; + G.outcnt = 0L; + } + } + } + + /*----------------------------------------------------------------------- + Add new leaf (first character of newstr) to tree as child of oldcode. + -----------------------------------------------------------------------*/ + + /* search for freecode */ + freecode = (shrint)(lastfreecode + 1); + /* add if-test before loop for speed? */ + while (parent[freecode] != FREE_CODE) + ++freecode; + lastfreecode = freecode; + Trace((stderr, "]; newcode %d\n", freecode)); + + Value[freecode] = *newstr; + parent[freecode] = oldcode; + oldcode = code; + + } while (!G.zipeof); + +/*--------------------------------------------------------------------------- + Flush any remaining data and return to sender... + ---------------------------------------------------------------------------*/ + + if (G.outcnt > 0L) { + Trace((stderr, "doing final flush(), outcnt = %lu\n", G.outcnt)); + if ((error = flush(__G__ realbuf, G.outcnt, TRUE)) != 0) + pipeit("unshrink: flush() error (%d)\n", error); + Trace((stderr, "done with flush()\n")); + } + + return PK_OK; + +} /* end function unshrink() */ + + + + + +/****************************/ +/* Function partial_clear() */ /* no longer recursive... */ +/****************************/ + +static void partial_clear(__G) + __GDEF +{ + register shrint code; + + /* clear all nodes which have no children (i.e., leaf nodes only) */ + + /* first loop: mark each parent as such */ + for (code = BOGUSCODE+1; code < HSIZE; ++code) { + register shrint cparent = (shrint)(parent[code] & CODE_MASK); + + if (cparent > BOGUSCODE && cparent != FREE_CODE) + FLAG_BITS[cparent] |= HAS_CHILD; /* set parent's child-bit */ + } + + /* second loop: clear all nodes *not* marked as parents; reset flag bits */ + for (code = BOGUSCODE+1; code < HSIZE; ++code) { + if (FLAG_BITS[code] & HAS_CHILD) /* just clear child-bit */ + FLAG_BITS[code] &= ~HAS_CHILD; + else { /* leaf: lose it */ + Trace((stderr, "%d\n", code)); + parent[code] = FREE_CODE; + } + } + + return; +} + +#endif /* !LZW_CLEAN */ diff --git a/utils/Install/sfxzip/unzip.c b/utils/Install/sfxzip/unzip.c new file mode 100644 index 0000000000..09968d4190 --- /dev/null +++ b/utils/Install/sfxzip/unzip.c @@ -0,0 +1,1744 @@ +/*--------------------------------------------------------------------------- + + unzip.c + + UnZip - a zipfile extraction utility. See below for make instructions, or + read the comments in Makefile and the various Contents files for more de- + tailed explanations. To report a bug, send a *complete* description to + Zip-Bugs@lists.wku.edu; include machine type, operating system and ver- + sion, compiler and version, and reasonably detailed error messages or prob- + lem report. To join Info-ZIP, see the instructions in README. + + UnZip 5.x is a greatly expanded and partially rewritten successor to 4.x, + which in turn was almost a complete rewrite of version 3.x. For a detailed + revision history, see UnzpHist.zip at quest.jpl.nasa.gov. For a list of + the many (near infinite) contributors, see "CONTRIBS" in the UnZip source + distribution. + + --------------------------------------------------------------------------- + + [from original zipinfo.c] + + This program reads great gobs of totally nifty information, including the + central directory stuff, from ZIP archives ("zipfiles" for short). It + started as just a testbed for fooling with zipfiles, but at this point it + is actually a useful utility. It also became the basis for the rewrite of + UnZip (3.16 -> 4.0), using the central directory for processing rather than + the individual (local) file headers. + + As of ZipInfo v2.0 and UnZip v5.1, the two programs are combined into one. + If the executable is named "unzip" (or "unzip.exe", depending), it behaves + like UnZip by default; if it is named "zipinfo" or "ii", it behaves like + ZipInfo. The ZipInfo behavior may also be triggered by use of unzip's -Z + option; for example, "unzip -Z [zipinfo_options] archive.zip". + + Another dandy product from your buddies at Newtware! + + Author: Greg Roelofs, newt@pobox.com, http://pobox.com/~newt/ + 23 August 1990 -> April 1997 + + --------------------------------------------------------------------------- + + Version: unzip5??.{tar.Z | tar.gz | zip} for Unix, VMS, OS/2, MS-DOS, Amiga, + Atari, Windows 3.x/95/NT/CE, Macintosh, Human68K, Acorn RISC OS, + BeOS, SMS/QDOS, VM/CMS, MVS, AOS/VS and TOPS-20. Decryption + requires sources in zcrypt28.zip. See the accompanying "WHERE" + file in the main source distribution for ftp, uucp, BBS and mail- + server sites, or see http://www.cdrom.com/pub/infozip/UnZip.html . + + Copyrights: see accompanying file "COPYING" in UnZip source distribution. + (This software is free but NOT IN THE PUBLIC DOMAIN. There + are some restrictions on commercial use.) + + ---------------------------------------------------------------------------*/ + + + +#define UNZIP_C +#define UNZIP_INTERNAL +#include "unzip.h" /* includes, typedefs, macros, prototypes, etc. */ +#include "crypt.h" +#include "version.h" + +#ifndef WINDLL /* The WINDLL port uses windll/windll.c instead... */ + +/*******************/ +/* Local Functions */ +/*******************/ + +#ifndef SFX +static void show_version_info OF((__GPRO)); +#endif + + +/*************/ +/* Constants */ +/*************/ + +#include "consts.h" /* all constant global variables are in here */ + /* (non-constant globals were moved to globals.c) */ + +/* constant local variables: */ + +#ifndef SFX + static ZCONST char Far EnvUnZip[] = ENV_UNZIP; + static ZCONST char Far EnvUnZip2[] = ENV_UNZIP2; + static ZCONST char Far EnvZipInfo[] = ENV_ZIPINFO; + static ZCONST char Far EnvZipInfo2[] = ENV_ZIPINFO2; +#ifdef RISCOS + static ZCONST char Far EnvUnZipExts[] = ENV_UNZIPEXTS; +#endif /* RISCOS */ +#endif + +#if (!defined(SFX) || defined(SFX_EXDIR)) + static ZCONST char Far NotExtracting[] = + "caution: not extracting; -d ignored\n"; + static ZCONST char Far MustGiveExdir[] = + "error: must specify directory to which to extract with -d option\n"; + static ZCONST char Far OnlyOneExdir[] = + "error: -d option used more than once (only one exdir allowed)\n"; +#endif + +#if CRYPT + static ZCONST char Far MustGivePasswd[] = + "error: must give decryption password with -P option\n"; +#endif + +#ifndef SFX + static ZCONST char Far Zfirst[] = + "error: -Z must be first option for ZipInfo mode (check UNZIP variable?)\n"; +#endif +static ZCONST char Far InvalidOptionsMsg[] = "error:\ + -fn or any combination of -c, -l, -p, -t, -u and -v options invalid\n"; +static ZCONST char Far IgnoreOOptionMsg[] = + "caution: both -n and -o specified; ignoring -o\n"; + +/* usage() strings */ +#ifndef SFX +#ifdef VMS + static ZCONST char Far Example3[] = "vms.c"; + static ZCONST char Far Example2[] = " unzip\ + \"-V\" foo \"Bar\" => must quote uppercase options and filenames in VMS\n"; +#else /* !VMS */ + static ZCONST char Far Example3[] = "ReadMe"; +#ifdef RISCOS + static ZCONST char Far Example2[] = +" unzip foo -d RAM:$ => extract all files from foo into RAMDisc\n"; +#else /* !RISCOS */ +#if (defined(OS2) || (defined(DOS_FLX_OS2_W32) && defined(MORE))) + static ZCONST char Far Example2[] = + ""; /* no room: too many local3[] items */ +#else /* !OS2 */ +#ifdef MACOS + static ZCONST char Far Example2[] = ""; /* not needed */ +#else /* !MACOS */ + static ZCONST char Far Example2[] = " \ + unzip -p foo | more => send contents of foo.zip via pipe into program more\n"; +#endif /* ?MACOS */ +#endif /* ?OS2 */ +#endif /* ?RISCOS */ +#endif /* ?VMS */ + +/* local1[]: command options */ +#if (defined(DLL) && defined(API_DOC)) + static ZCONST char Far local1[] = + " -A print extended help for API functions"; +#else /* !(DLL && API_DOC) */ + static ZCONST char Far local1[] = ""; +#endif /* ?(DLL && API_DOC) */ + +/* local2[] and local3[]: modifier options */ +#ifdef DOS_FLX_OS2_W32 +#ifdef FLEXOS + static ZCONST char Far local2[] = ""; +#else + static ZCONST char Far local2[] = + " -$ label removables (-$$ => fixed disks)"; +#endif +#ifdef OS2 +#ifdef MORE + static ZCONST char Far local3[] = "\ + -X restore ACLs if supported -s spaces in filenames => '_'\n\ + -M pipe through \"more\" pager\n"; +#else + static ZCONST char Far local3[] = " \ + -X restore ACLs if supported -s spaces in filenames => '_'\n\n"; +#endif /* ?MORE */ +#else /* !OS2 */ +#ifdef WIN32 +#ifdef MORE + static ZCONST char Far local3[] = "\ + -X restore ACLs (-XX => use privileges) -s spaces in filenames => '_'\n\ + -M pipe through \"more\" pager\n"; +#else + static ZCONST char Far local3[] = " \ + -X restore ACLs (-XX => use privileges) -s spaces in filenames => '_'\n\n"; +#endif /* ?MORE */ +#else /* !WIN32 */ +#ifdef MORE + static ZCONST char Far local3[] = " -\ +M pipe through \"more\" pager -s spaces in filenames => '_'\n\n"; +#else + static ZCONST char Far local3[] = "\ + -s spaces in filenames => '_'\n"; +#endif +#endif /* ?WIN32 */ +#endif /* ?OS2 || ?WIN32 */ +#else /* !DOS_FLX_OS2_W32 */ +#ifdef VMS + static ZCONST char Far local2[] = "\"-X\" restore owner/protection info"; +#ifdef MORE + static ZCONST char Far local3[] = " \ + \"-M\" pipe through \"more\" pager\n"; +#else + static ZCONST char Far local3[] = "\n"; +#endif +#else /* !VMS */ +#if (defined(__BEOS__) || defined(TANDEM) || defined(UNIX)) + static ZCONST char Far local2[] = " -X restore UID/GID info"; +#ifdef MORE + static ZCONST char Far local3[] = "\ + -M pipe through \"more\" pager\n"; +#else + static ZCONST char Far local3[] = "\n"; +#endif +#else /* !(__BEOS__ || TANDEM || UNIX) */ +#ifdef AMIGA + static ZCONST char Far local2[] = " -N restore comments as filenotes"; +#ifdef MORE + static ZCONST char Far local3[] = "\ + -M pipe through \"more\" pager\n"; +#else + static ZCONST char Far local3[] = "\n"; +#endif +#else /* !AMIGA */ +#ifdef MACOS + static ZCONST char Far local2[] = " -E show Mac info during extraction"; + static ZCONST char Far local3[] = " \ + -i ignore filenames in mac extra info -J junk (ignore) Mac extra info\n\n"; +#else /* !MACOS */ +#ifdef MORE + static ZCONST char Far local2[] = " -M pipe through \"more\" pager"; + static ZCONST char Far local3[] = "\n"; +#else + static ZCONST char Far local2[] = ""; /* Atari, Mac, CMS/MVS etc. */ + static ZCONST char Far local3[] = ""; +#endif +#endif /* ?MACOS */ +#endif /* ?AMIGA */ +#endif /* ?(__BEOS__ || TANDEM || UNIX) */ +#endif /* ?VMS */ +#endif /* ?DOS_FLX_OS2_W32 */ +#endif /* !SFX */ + +#ifndef NO_ZIPINFO +#ifdef VMS + static ZCONST char Far ZipInfoExample[] = "* or % (e.g., \"*font-%.zip\")"; +#else + static ZCONST char Far ZipInfoExample[] = "*, ?, [] (e.g., \"[a-j]*.zip\")"; +#endif + +static ZCONST char Far ZipInfoUsageLine1[] = "\ +ZipInfo %d.%d%d%s of %s, by Greg Roelofs and the Info-ZIP group.\n\ +\n\ +List name, date/time, attribute, size, compression method, etc., about files\n\ +in list (excluding those in xlist) contained in the specified .zip archive(s).\ +\n\"file[.zip]\" may be a wildcard name containing %s.\n\n\ + usage: zipinfo [-12smlvChMtTz] file[.zip] [list...] [-x xlist...]\n\ + or: unzip %s-Z%s [-12smlvChMtTz] file[.zip] [list...] [-x xlist...]\n"; + +static ZCONST char Far ZipInfoUsageLine2[] = "\nmain\ + listing-format options: -s short Unix \"ls -l\" format (def.)\n\ + -1 filenames ONLY, one per line -m medium Unix \"ls -l\" format\n\ + -2 just filenames but allow -h/-t/-z -l long Unix \"ls -l\" format\n\ + -v verbose, multi-page format\n"; + +static ZCONST char Far ZipInfoUsageLine3[] = "miscellaneous options:\n\ + -h print header line -t print totals for listed files or for all\n\ + -z print zipfile comment %c-T%c print file times in sortable decimal format\ +\n %c-C%c be case-insensitive %s\ + -x exclude filenames that follow from listing\n"; +#ifdef MORE +#ifdef VMS + static ZCONST char Far ZipInfoUsageLine4[] = + " \"-M\" page output through built-in \"more\"\n"; +#else + static ZCONST char Far ZipInfoUsageLine4[] = + " -M page output through built-in \"more\"\n"; +#endif +#else /* !MORE */ + static ZCONST char Far ZipInfoUsageLine4[] = ""; +#endif /* ?MORE */ +#endif /* !NO_ZIPINFO */ + +#ifdef BETA +# ifdef VMSCLI + /* BetaVersion[] is also used in vms/cmdline.c: do not make it static */ + ZCONST char Far BetaVersion[] = "%s\ + THIS IS STILL A BETA VERSION OF UNZIP%s -- DO NOT DISTRIBUTE.\n\n"; +# else + static ZCONST char Far BetaVersion[] = "%s\ + THIS IS STILL A BETA VERSION OF UNZIP%s -- DO NOT DISTRIBUTE.\n\n"; +# endif +#endif + +#ifdef SFX +# ifdef VMSCLI + /* UnzipSFXBanner[] is also used in vms/cmdline.c: do not make it static */ + ZCONST char Far UnzipSFXBanner[] = +# else + static ZCONST char Far UnzipSFXBanner[] = +# endif + "UnZipSFX %d.%d%d%s of %s, by Info-ZIP (Zip-Bugs@lists.wku.edu).\n"; +# ifdef SFX_EXDIR + static ZCONST char Far UnzipSFXOpts[] = + "Valid options are -tfupcz and -d <exdir>; modifiers are -abjnoqCL%sV%s.\n"; +# else + static ZCONST char Far UnzipSFXOpts[] = + "Valid options are -tfupcz; modifiers are -abjnoqCL%sV%s.\n"; +# endif +#else /* !SFX */ + static ZCONST char Far CompileOptions[] = + "UnZip special compilation options:\n"; + static ZCONST char Far CompileOptFormat[] = "\t%s\n"; + static ZCONST char Far EnvOptions[] = + "\nUnZip and ZipInfo environment options:\n"; + static ZCONST char Far EnvOptFormat[] = "%16s: %s\n"; + static ZCONST char Far None[] = "[none]"; +# ifdef ACORN_FTYPE_NFS + static ZCONST char Far AcornFtypeNFS[] = "ACORN_FTYPE_NFS"; +# endif +# ifdef ASM_CRC + static ZCONST char Far AsmCRC[] = "ASM_CRC"; +# endif +# ifdef ASM_INFLATECODES + static ZCONST char Far AsmInflateCodes[] = "ASM_INFLATECODES"; +# endif +# ifdef CHECK_VERSIONS + static ZCONST char Far Check_Versions[] = "CHECK_VERSIONS"; +# endif +# ifdef COPYRIGHT_CLEAN + static ZCONST char Far Copyright_Clean[] = + "COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)"; +# endif +# ifdef DEBUG + static ZCONST char Far UDebug[] = "DEBUG"; +# endif +# ifdef DEBUG_TIME + static ZCONST char Far DebugTime[] = "DEBUG_TIME"; +# endif +# ifdef DLL + static ZCONST char Far Dll[] = "DLL"; +# endif +# ifdef DOSWILD + static ZCONST char Far DosWild[] = "DOSWILD"; +# endif +# ifdef LZW_CLEAN + static ZCONST char Far LZW_Clean[] = + "LZW_CLEAN (PKZIP/Zip 1.x unshrinking method not supported)"; +# endif +# ifndef MORE + static ZCONST char Far No_More[] = "NO_MORE"; +# endif +# ifdef NO_ZIPINFO + static ZCONST char Far No_ZipInfo[] = "NO_ZIPINFO"; +# endif +# ifdef NTSD_EAS + static ZCONST char Far NTSDExtAttrib[] = "NTSD_EAS"; +# endif +# ifdef OS2_EAS + static ZCONST char Far OS2ExtAttrib[] = "OS2_EAS"; +# endif +# ifdef QLZIP + static ZCONST char Far SMSExFldOnUnix[] = "QLZIP"; +# endif +# ifdef REENTRANT + static ZCONST char Far Reentrant[] = "REENTRANT"; +# endif +# ifdef REGARGS + static ZCONST char Far RegArgs[] = "REGARGS"; +# endif +# ifdef RETURN_CODES + static ZCONST char Far Return_Codes[] = "RETURN_CODES"; +# endif +# ifdef SET_DIR_ATTRIB + static ZCONST char Far SetDirAttrib[] = "SET_DIR_ATTRIB"; +# endif +# ifdef TIMESTAMP + static ZCONST char Far TimeStamp[] = "TIMESTAMP"; +# endif +# ifdef UNIXBACKUP + static ZCONST char Far UnixBackup[] = "UNIXBACKUP"; +# endif +# ifdef USE_EF_UT_TIME + static ZCONST char Far Use_EF_UT_time[] = "USE_EF_UT_TIME"; +# endif +# ifndef LZW_CLEAN + static ZCONST char Far Use_Unshrink[] = + "USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)"; +# endif +# ifndef COPYRIGHT_CLEAN + static ZCONST char Far Use_Smith_Code[] = + "USE_SMITH_CODE (PKZIP 0.9x unreducing method supported)"; +# endif +# ifdef USE_VFAT + static ZCONST char Far Use_VFAT_support[] = "USE_VFAT"; +# endif +# ifdef USE_ZLIB + static ZCONST char Far UseZlib[] = + "USE_ZLIB (compiled with version %s; using version %s)"; +# endif +# ifdef VMS_TEXT_CONV + static ZCONST char Far VmsTextConv[] = "VMS_TEXT_CONV"; +# endif +# ifdef VMSCLI + static ZCONST char Far VmsCLI[] = "VMSCLI"; +# endif +# ifdef VMSWILD + static ZCONST char Far VmsWild[] = "VMSWILD"; +# endif +# if CRYPT +# ifdef PASSWD_FROM_STDIN + static ZCONST char Far PasswdStdin[] = "PASSWD_FROM_STDIN"; +# endif + static ZCONST char Far Decryption[] = + "\t[decryption, version %d.%d%s of %s]\n"; + static ZCONST char Far CryptDate[] = CR_VERSION_DATE; +# endif +# ifndef __RSXNT__ +# ifdef __EMX__ + static ZCONST char Far EnvEMX[] = "EMX"; + static ZCONST char Far EnvEMXOPT[] = "EMXOPT"; +# endif +# if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2))) + static ZCONST char Far EnvGO32[] = "GO32"; + static ZCONST char Far EnvGO32TMP[] = "GO32TMP"; +# endif +# endif /* !__RSXNT__ */ + +#ifdef VMS +/* UnzipUsageLine1[] is also used in vms/cmdline.c: do not make it static */ + ZCONST char Far UnzipUsageLine1[] = "\ +UnZip %d.%d%d%s of %s, by Info-ZIP. For more details see: unzip -v.\n\n"; +#ifdef COPYRIGHT_CLEAN + static ZCONST char Far UnzipUsageLine1v[] = "\ +UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\ +bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.\ +\n\n"; +#else + static ZCONST char Far UnzipUsageLine1v[] = "\ +UnZip %d.%d%d%s of %s, by Info-ZIP. UnReduce (c) 1989 by S. H. Smith.\n\ +Send bug reports to authors at Zip-Bugs@lists.wku.edu; see README for details.\ +\n\n"; +#endif /* ?COPYRIGHT_CLEAN */ +#else /* !VMS */ +#ifdef COPYRIGHT_CLEAN + static ZCONST char Far UnzipUsageLine1[] = "\ +UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\ +bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.\ +\n\n"; +#else + static ZCONST char Far UnzipUsageLine1[] = "\ +UnZip %d.%d%d%s of %s, by Info-ZIP. UnReduce (c) 1989 by S. H. Smith.\n\ +Send bug reports to authors at Zip-Bugs@lists.wku.edu; see README for details.\ +\n\n"; +#endif /* ?COPYRIGHT_CLEAN */ +#define UnzipUsageLine1v UnzipUsageLine1 +#endif /* ?VMS */ + +static ZCONST char Far UnzipUsageLine2v[] = "\ +Latest sources and executables are at ftp://ftp.cdrom.com/pub/infozip/ , as of\ +\nabove date; see http://www.cdrom.com/pub/infozip/UnZip.html for other sites.\ +\n\n"; + +#ifdef MACOS +static ZCONST char Far UnzipUsageLine2[] = "\ +Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-d exdir]\n \ + Default action is to extract files in list, to exdir;\n\ + file[.zip] may be a wildcard. %s\n"; +#else /* !MACOS */ +#ifdef VM_CMS +static ZCONST char Far UnzipUsageLine2[] = "\ +Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d fm]\n \ + Default action is to extract files in list, except those in xlist, to disk fm;\n\ + file[.zip] may be a wildcard. %s\n"; +#else /* !VM_CMS */ +static ZCONST char Far UnzipUsageLine2[] = "\ +Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]\n \ + Default action is to extract files in list, except those in xlist, to exdir;\n\ + file[.zip] may be a wildcard. %s\n"; +#endif /* ?VM_CMS */ +#endif /* ?MACOS */ + +#ifdef NO_ZIPINFO +# define ZIPINFO_MODE_OPTION "" + static ZCONST char Far ZipInfoMode[] = + "(ZipInfo mode is disabled in this version.)"; +#else +# define ZIPINFO_MODE_OPTION "[-Z] " +# ifdef VMS + static ZCONST char Far ZipInfoMode[] = + "\"-Z\" => ZipInfo mode (`unzip \"-Z\"' for usage)."; +# else + static ZCONST char Far ZipInfoMode[] = + "-Z => ZipInfo mode (\"unzip -Z\" for usage)."; +# endif +#endif /* ?NO_ZIPINFO */ + +#ifdef VMS + static ZCONST char Far VMSusageLine2b[] = "\ +=> define foreign command symbol in LOGIN.COM: $ unzip :== $dev:[dir]unzip.exe\ +\n"; +#endif + +#ifdef MACOS +static ZCONST char Far UnzipUsageLine3[] = "\n\ + -d extract files into exdir -l list files (short format)\n\ + -f freshen existing files, create none -t test compressed archive data\n\ + -u update files, create if necessary -z display archive comment\n\ +%s\n"; +#else /* !MACOS */ +#ifdef VM_CMS +static ZCONST char Far UnzipUsageLine3[] = "\n\ + -p extract files to pipe, no messages -l list files (short format)\n\ + -f freshen existing files, create none -t test compressed archive data\n\ + -u update files, create if necessary -z display archive comment\n\ + -x exclude files that follow (in xlist) -d extract files onto disk fm\n\ +%s\n"; +#else /* !VM_CMS */ +static ZCONST char Far UnzipUsageLine3[] = "\n\ + -p extract files to pipe, no messages -l list files (short format)\n\ + -f freshen existing files, create none -t test compressed archive data\n\ + -u update files, create if necessary -z display archive comment\n\ + -x exclude files that follow (in xlist) -d extract files into exdir\n\ +%s\n"; +#endif /* ?VM_CMS */ +#endif /* ?MACOS */ + +static ZCONST char Far UnzipUsageLine4[] = "\ +modifiers: -q quiet mode (-qq => quieter)\n\ + -n never overwrite existing files -a auto-convert any text files\n\ + -o overwrite files WITHOUT prompting -aa treat ALL files as text\n \ + -j junk paths (do not make directories) -v be verbose/print version info\n\ + %c-C%c match filenames case-insensitively %c-L%c make (some) names \ +lowercase\n %-42s %c-V%c retain VMS version numbers\n%s"; + +static ZCONST char Far UnzipUsageLine5[] = "\ +Examples (see unzip.doc for more info):\n\ + unzip data1 -x joe => extract all files except joe from zipfile data1.zip\n\ +%s\ + unzip -fo foo %-6s => quietly replace existing %s if archive file newer\n"; +#endif /* ?SFX */ + + + + + +/*****************************/ +/* main() / UzpMain() stub */ +/*****************************/ + +int installer_unpack(char *aname, int depricated) /* return PK-type error code (except under VMS) */ +{ + int r, argc = 3; + char tempfile[256]; + char *argv[4]; + + argv[0] = "install.exe"; + argv[1] = "install.exe"; + argv[2] = tempfile; + argv[3] = NULL; + + if(aname) + strcpy(tempfile, aname); + else + argc = 2; + + CONSTRUCTGLOBALS(); + r = unzip(__G__ argc, argv); + DESTROYGLOBALS() + RETURN(r); +} + +void resetglobals(void) { } + +int pipeit(char *format, ...) +{ + return 0; +} + + +/*******************************/ +/* Primary UnZip entry point */ +/*******************************/ + +int unzip(__G__ argc, argv) + __GDEF + int argc; + char *argv[]; +{ +#ifndef NO_ZIPINFO + char *p; +#endif +#ifdef DOS_FLX_H68_OS2_W32 + int i; +#endif + int retcode, error=FALSE; + +#if (defined(__IBMC__) && defined(__DEBUG_ALLOC__)) + extern void DebugMalloc(void); + + atexit(DebugMalloc); +#endif + +#ifdef MALLOC_WORK + G.area.Slide =(uch *)calloc(8193, sizeof(shrint)+sizeof(uch)+sizeof(uch)); + G.area.shrink.Parent = (shrint *)G.area.Slide; + G.area.shrink.value = G.area.Slide + (sizeof(shrint)*(HSIZE+1)); + G.area.shrink.Stack = G.area.Slide + + (sizeof(shrint) + sizeof(uch))*(HSIZE+1); +#endif + +/*--------------------------------------------------------------------------- + Macintosh initialization code. + ---------------------------------------------------------------------------*/ + +#ifdef MACOS + { + int a; + + for (a = 0; a < 4; ++a) + G.rghCursor[a] = GetCursor(a+128); + G.giCursor = 0; + } +#endif + +/*--------------------------------------------------------------------------- + Human68K initialization code. + ---------------------------------------------------------------------------*/ + +#ifdef __human68k__ + InitTwentyOne(); +#endif + +/*--------------------------------------------------------------------------- + Acorn RISC OS initialization code. + ---------------------------------------------------------------------------*/ + +#ifdef RISCOS + set_prefix(); +#endif + +/*--------------------------------------------------------------------------- + Set signal handler for restoring echo, warn of zipfile corruption, etc. + ---------------------------------------------------------------------------*/ + +#ifdef SIGINT + signal(SIGINT, handler); +#endif +#ifdef SIGTERM /* some systems really have no SIGTERM */ + signal(SIGTERM, handler); +#endif +#ifdef SIGBUS + signal(SIGBUS, handler); +#endif +#ifdef SIGSEGV + signal(SIGSEGV, handler); +#endif + +#if (defined(WIN32) && defined(__RSXNT__)) + for (i = 0 ; i < argc; i++) { + _ISO_INTERN(argv[i]); + } +#endif + +/*--------------------------------------------------------------------------- + First figure out if we're running in UnZip mode or ZipInfo mode, and put + the appropriate environment-variable options into the queue. Then rip + through any command-line options lurking about... + ---------------------------------------------------------------------------*/ + +#ifdef SFX + G.argv0 = argv[0]; +#if (defined(OS2) || defined(WIN32)) + G.zipfn = GetLoadPath(__G);/* non-MSC NT puts path into G.filename[] */ +#else + G.zipfn = G.argv0; +#endif + +#ifdef VMSCLI + { + ulg status = vms_unzip_cmdline(&argc, &argv); + if (!(status & 1)) + return status; + } +#endif /* VMSCLI */ + + uO.zipinfo_mode = FALSE; + error = uz_opts(__G__ &argc, &argv); /* UnZipSFX call only */ + +#else /* !SFX */ + +#ifdef RISCOS + /* get the extensions to swap from environment */ + getRISCOSexts(ENV_UNZIPEXTS); +#endif + +#ifdef MSDOS + /* extract MKS extended argument list from environment (before envargs!) */ + mksargs(&argc, &argv); +#endif + +#ifdef VMSCLI + { + ulg status = vms_unzip_cmdline(&argc, &argv); + if (!(status & 1)) + return status; + } +#endif /* VMSCLI */ + + G.noargs = (argc == 1); /* no options, no zipfile, no anything */ + +#ifndef NO_ZIPINFO + for (p = argv[0] + strlen(argv[0]); p >= argv[0]; --p) { + if (*p == DIR_END +#ifdef DIR_END2 + || *p == DIR_END2 +#endif + ) + break; + } + ++p; + + if (STRNICMP(p, LoadFarStringSmall(Zipnfo), 7) == 0 || + STRNICMP(p, "ii", 2) == 0 || + (argc > 1 && strncmp(argv[1], "-Z", 2) == 0)) + { + uO.zipinfo_mode = TRUE; + envargs(__G__ &argc, &argv, LoadFarStringSmall(EnvZipInfo), + LoadFarStringSmall2(EnvZipInfo2)); + error = zi_opts(__G__ &argc, &argv); + } else +#endif /* NO_ZIPINFO */ + { + uO.zipinfo_mode = FALSE; + envargs(__G__ &argc, &argv, LoadFarStringSmall(EnvUnZip), + LoadFarStringSmall2(EnvUnZip2)); + error = uz_opts(__G__ &argc, &argv); + } + +#endif /* ?SFX */ + + if ((argc < 0) || error) + return error; + +/*--------------------------------------------------------------------------- + Now get the zipfile name from the command line and then process any re- + maining options and file specifications. + ---------------------------------------------------------------------------*/ + +#ifdef DOS_FLX_H68_OS2_W32 + /* convert MSDOS-style directory separators to Unix-style ones for + * user's convenience (include zipfile name itself) + */ +#ifdef SFX + for (G.pfnames = argv, i = argc; i > 0; --i) { +#else + /* argc does not include the zipfile specification */ + for (G.pfnames = argv, i = argc+1; i > 0; --i) { +#endif + char *q; + + for (q = *G.pfnames; *q; ++q) + if (*q == '\\') + *q = '/'; + ++G.pfnames; + } +#endif /* DOS_FLX_H68_OS2_W32 */ + +#ifndef SFX + G.wildzipfn = *argv++; +#endif + +#if (defined(SFX) && !defined(SFX_EXDIR)) /* only check for -x */ + + G.filespecs = argc; + G.xfilespecs = 0; + + if (argc > 0) { + char **pp = argv-1; + + G.pfnames = argv; + while (*++pp) + if (strcmp(*pp, "-x") == 0) { + if (pp > argv) { + *pp = 0; /* terminate G.pfnames */ + G.filespecs = pp - G.pfnames; + } else { + G.pfnames = (char **)fnames; /* defaults */ + G.filespecs = 0; + } + G.pxnames = pp + 1; /* excluded-names ptr: _after_ -x */ + G.xfilespecs = argc - G.filespecs - 1; + break; /* skip rest of args */ + } + G.process_all_files = FALSE; + } else + G.process_all_files = TRUE; /* for speed */ + +#else /* !SFX || SFX_EXDIR */ /* check for -x or -d */ + + G.filespecs = argc; + G.xfilespecs = 0; + + if (argc > 0) { + int in_files=FALSE, in_xfiles=FALSE; + char **pp = argv-1; + + G.process_all_files = FALSE; + G.pfnames = argv; + while (*++pp) { + Trace((stderr, "pp - argv = %d\n", pp-argv)); +#ifdef CMS_MVS + if (!uO.exdir && STRNICMP(*pp, "-d", 2) == 0) { +#else + if (!uO.exdir && strncmp(*pp, "-d", 2) == 0) { +#endif + int firstarg = (pp == argv); + + uO.exdir = (*pp) + 2; + if (in_files) { /* ... zipfile ... -d exdir ... */ + *pp = (char *)NULL; /* terminate G.pfnames */ + G.filespecs = pp - G.pfnames; + in_files = FALSE; + } else if (in_xfiles) { + *pp = (char *)NULL; /* terminate G.pxnames */ + G.xfilespecs = pp - G.pxnames; + /* "... -x xlist -d exdir": nothing left */ + } + /* first check for "-dexdir", then for "-d exdir" */ + if (*uO.exdir == '\0') { + if (*++pp) + uO.exdir = *pp; + else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGiveExdir))); + return(PK_PARAM); /* don't extract here by accident */ + } + } + if (firstarg) { /* ... zipfile -d exdir ... */ + if (pp[1]) { + G.pfnames = pp + 1; /* argv+2 */ + G.filespecs = argc - (G.pfnames-argv); /* for now... */ + } else { + G.process_all_files = TRUE; + G.pfnames = (char **)fnames; /* GRR: necessary? */ + G.filespecs = 0; /* GRR: necessary? */ + break; + } + } + } else if (!in_xfiles) { + if (strcmp(*pp, "-x") == 0) { + in_xfiles = TRUE; + if (pp == G.pfnames) { + G.pfnames = (char **)fnames; /* defaults */ + G.filespecs = 0; + } else if (in_files) { + *pp = 0; /* terminate G.pfnames */ + G.filespecs = pp - G.pfnames; /* adjust count */ + in_files = FALSE; + } + G.pxnames = pp + 1; /* excluded-names ptr starts after -x */ + G.xfilespecs = argc - (G.pxnames-argv); /* anything left */ + } else + in_files = TRUE; + } + } + } else + G.process_all_files = TRUE; /* for speed */ + + if (uO.exdir != (char *)NULL && !G.extract_flag) /* -d ignored */ + Info(slide, 0x401, ((char *)slide, LoadFarString(NotExtracting))); +#endif /* ?(SFX && !SFX_EXDIR) */ + +/*--------------------------------------------------------------------------- + Okey dokey, we have everything we need to get started. Let's roll. + ---------------------------------------------------------------------------*/ + + retcode = process_zipfiles(__G); + return(retcode); + +} /* end main()/unzip() */ + + + + + +/**********************/ +/* Function uz_opts() */ +/**********************/ + +int uz_opts(__G__ pargc, pargv) + __GDEF + int *pargc; + char ***pargv; +{ + char **argv, *s; + int argc, c, error=FALSE, negative=0; + + + argc = *pargc; + argv = *pargv; + + while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) { + s = *argv + 1; + while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */ +#ifdef CMS_MVS + switch (tolower(c)) +#else + switch (c) +#endif + { + case ('-'): + ++negative; + break; + case ('a'): + if (negative) { + uO.aflag = MAX(uO.aflag-negative,0); + negative = 0; + } else + ++uO.aflag; + break; +#if (defined(DLL) && defined(API_DOC)) + case ('A'): /* extended help for API */ + APIhelp(__G__ argc, argv); + *pargc = -1; /* signal to exit successfully */ + return 0; +#endif + case ('b'): + if (negative) { +#ifdef VMS + uO.bflag = MAX(uO.bflag-negative,0); +#endif + negative = 0; /* do nothing: "-b" is default */ + } else { +#ifdef VMS + if (uO.aflag == 0) + ++uO.bflag; +#endif + uO.aflag = 0; + } + break; +#ifdef UNIXBACKUP + case ('B'): /* -B: back up existing files */ + if (negative) + uO.B_flag = FALSE, negative = 0; + else + uO.B_flag = TRUE; + break; +#endif + case ('c'): + if (negative) { + uO.cflag = FALSE, negative = 0; +#ifdef NATIVE + uO.aflag = 0; +#endif + } else { + uO.cflag = TRUE; +#ifdef NATIVE + uO.aflag = 2; /* so you can read it on the screen */ +#endif +#ifdef DLL + if (G.redirect_text) + G.redirect_data = 2; +#endif + } + break; +#ifndef CMS_MVS + case ('C'): /* -C: match filenames case-insensitively */ + if (negative) + uO.C_flag = FALSE, negative = 0; + else + uO.C_flag = TRUE; + break; +#endif /* !CMS_MVS */ +#if (!defined(SFX) || defined(SFX_EXDIR)) + case ('d'): + if (negative) { /* negative not allowed with -d exdir */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGiveExdir))); + return(PK_PARAM); /* don't extract here by accident */ + } + if (uO.exdir != (char *)NULL) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(OnlyOneExdir))); + return(PK_PARAM); /* GRR: stupid restriction? */ + } else { + /* first check for "-dexdir", then for "-d exdir" */ + uO.exdir = s; + if (*uO.exdir == '\0') { + if (argc > 1) { + --argc; + uO.exdir = *++argv; + if (*uO.exdir == '-') { + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGiveExdir))); + return(PK_PARAM); + } + /* else uO.exdir points at extraction dir */ + } else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGiveExdir))); + return(PK_PARAM); + } + } + /* uO.exdir now points at extraction dir (-dexdir or + * -d exdir); point s at end of exdir to avoid mis- + * interpretation of exdir characters as more options + */ + if (*s != 0) + while (*++s != 0) + ; + } + break; +#endif /* !SFX || SFX_EXDIR */ + case ('e'): /* just ignore -e, -x options (extract) */ + break; +#ifdef MACOS + case ('E'): /* -E [MacOS] display Mac e.f. when restoring */ + if( negative ) { + uO.E_flag = FALSE, negative = 0; + } else { + uO.E_flag = TRUE; + } + break; +#endif /* MACOS */ + case ('f'): /* "freshen" (extract only newer files) */ + if (negative) + uO.fflag = uO.uflag = FALSE, negative = 0; + else + uO.fflag = uO.uflag = TRUE; + break; +#if (defined(RISCOS) || defined(ACORN_FTYPE_NFS)) + case ('F'): /* Acorn filetype & NFS extension handling */ + if (negative) + uO.acorn_nfs_ext = FALSE, negative = 0; + else + uO.acorn_nfs_ext = TRUE; + break; +#endif /* RISCOS || ACORN_FTYPE_NFS */ + case ('h'): /* just print help message and quit */ + *pargc = -1; + return USAGE(PK_OK); +#ifdef MACOS + case ('i'): /* -i [MacOS] ignore filenames stored in Mac ef */ + if( negative ) { + uO.i_flag = FALSE, negative = 0; + } else { + uO.i_flag = TRUE; + } + break; +#endif /* MACOS */ + case ('j'): /* junk pathnames/directory structure */ + if (negative) + uO.jflag = FALSE, negative = 0; + else + uO.jflag = TRUE; + break; +#if (defined(__BEOS__) || defined(MACOS)) + case ('J'): /* Junk BeOS or MacOS file attributes */ + if( negative ) { + uO.J_flag = FALSE, negative = 0; + } else { + uO.J_flag = TRUE; + } + break; +#endif /* __BEOS__ || MACOS */ +#ifndef SFX + case ('l'): + if (negative) { + uO.vflag = MAX(uO.vflag-negative,0); + negative = 0; + } else + ++uO.vflag; + break; +#endif /* !SFX */ +#ifndef CMS_MVS + case ('L'): /* convert (some) filenames to lowercase */ + if (negative) + uO.L_flag = FALSE, negative = 0; + else + uO.L_flag = TRUE; + break; +#endif /* !CMS_MVS */ +#ifdef MORE +#ifdef CMS_MVS + case ('m'): +#endif + case ('M'): /* send all screen output through "more" fn. */ +/* GRR: eventually check for numerical argument => height */ + if (negative) + G.M_flag = FALSE, negative = 0; + else + G.M_flag = TRUE; + break; +#endif /* MORE */ + case ('n'): /* don't overwrite any files */ + if (negative) + uO.overwrite_none = FALSE, negative = 0; + else + uO.overwrite_none = TRUE; + break; +#ifdef AMIGA + case ('N'): /* restore comments as filenotes */ + if (negative) + uO.N_flag = FALSE, negative = 0; + else + uO.N_flag = TRUE; + break; +#endif /* AMIGA */ + case ('o'): /* OK to overwrite files without prompting */ + if (negative) { + uO.overwrite_all = MAX(uO.overwrite_all-negative,0); + negative = 0; + } else + ++uO.overwrite_all; + break; + case ('p'): /* pipes: extract to stdout, no messages */ + if (negative) { + uO.cflag = FALSE; + uO.qflag = MAX(uO.qflag-999,0); + negative = 0; + } else { + uO.cflag = TRUE; + uO.qflag += 999; + } + break; +#if CRYPT + /* GRR: yes, this is highly insecure, but dozens of people + * have pestered us for this, so here we go... */ + case ('P'): + if (negative) { /* negative not allowed with -P passwd */ + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGivePasswd))); + return(PK_PARAM); /* don't extract here by accident */ + } + if (uO.pwdarg != (char *)NULL) { +/* + GRR: eventually support multiple passwords? + Info(slide, 0x401, ((char *)slide, + LoadFarString(OnlyOnePasswd))); + return(PK_PARAM); + */ + } else { + /* first check for "-Ppasswd", then for "-P passwd" */ + uO.pwdarg = s; + if (*uO.pwdarg == '\0') { + if (argc > 1) { + --argc; + uO.pwdarg = *++argv; + if (*uO.pwdarg == '-') { + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGivePasswd))); + return(PK_PARAM); + } + /* else pwdarg points at decryption password */ + } else { + Info(slide, 0x401, ((char *)slide, + LoadFarString(MustGivePasswd))); + return(PK_PARAM); + } + } + /* pwdarg now points at decryption password (-Ppasswd or + * -P passwd); point s at end of passwd to avoid mis- + * interpretation of passwd characters as more options + */ + if (*s != 0) + while (*++s != 0) + ; + } + break; +#endif /* CRYPT */ + case ('q'): /* quiet: fewer comments/messages */ + if (negative) { + uO.qflag = MAX(uO.qflag-negative,0); + negative = 0; + } else + ++uO.qflag; + break; +#ifdef QDOS + case ('Q'): /* QDOS flags */ + qlflag ^= strtol(s, &s, 10); + break; /* we XOR this as we can config qlflags */ +#endif +#ifdef DOS_FLX_OS2_W32 + case ('s'): /* spaces in filenames: allow by default */ + if (negative) + uO.sflag = FALSE, negative = 0; + else + uO.sflag = TRUE; + break; +#endif /* DOS_FLX_OS2_W32 */ + case ('t'): + if (negative) + uO.tflag = FALSE, negative = 0; + else + uO.tflag = TRUE; + break; +#ifdef TIMESTAMP + case ('T'): + if (negative) + uO.T_flag = FALSE, negative = 0; + else + uO.T_flag = TRUE; + break; +#endif + case ('u'): /* update (extract only new and newer files) */ + if (negative) + uO.uflag = FALSE, negative = 0; + else + uO.uflag = TRUE; + break; +#ifndef CMS_MVS + case ('U'): /* obsolete; to be removed in version 6.0 */ + if (negative) + uO.L_flag = TRUE, negative = 0; + else + uO.L_flag = FALSE; + break; +#endif /* !CMS_MVS */ +#ifndef SFX + case ('v'): /* verbose */ + if (negative) { + uO.vflag = MAX(uO.vflag-negative,0); + negative = 0; + } else if (uO.vflag) + ++uO.vflag; + else + uO.vflag = 2; + break; +#endif /* !SFX */ +#ifndef CMS_MVS + case ('V'): /* Version (retain VMS/DEC-20 file versions) */ + if (negative) + uO.V_flag = FALSE, negative = 0; + else + uO.V_flag = TRUE; + break; +#endif /* !CMS_MVS */ + case ('x'): /* extract: default */ +#ifdef SFX + /* when 'x' is the only option in this argument, and the + * next arg is not an option, assume this initiates an + * exclusion list (-x xlist): terminate option-scanning + * and leave uz_opts with argv still pointing to "-x"; + * the xlist is processed later + */ + if (s - argv[0] == 2 && *s == '\0' && + argc > 1 && argv[1][0] != '-') { + /* break out of nested loops without "++argv;--argc" */ + goto opts_done; + } +#endif /* SFX */ + break; +#if (defined(RESTORE_UIDGID) || defined(OS2_W32)) + case ('X'): /* restore owner/protection info (need privs?) */ + if (negative) { + uO.X_flag = MAX(uO.X_flag-negative,0); + negative = 0; + } else + ++uO.X_flag; + break; +#endif /* RESTORE_UIDGID || OS2_W32 */ + case ('z'): /* display only the archive comment */ + if (negative) { + uO.zflag = MAX(uO.zflag-negative,0); + negative = 0; + } else + ++uO.zflag; + break; +#ifndef SFX + case ('Z'): /* should have been first option (ZipInfo) */ + Info(slide, 0x401, ((char *)slide, LoadFarString(Zfirst))); + error = TRUE; + break; +#endif /* !SFX */ +#ifdef DOS_OS2_W32 + case ('$'): + if (negative) { + uO.volflag = MAX(uO.volflag-negative,0); + negative = 0; + } else + ++uO.volflag; + break; +#endif /* DOS_OS2_W32 */ + default: + error = TRUE; + break; + + } /* end switch */ + } /* end while (not end of argument string) */ + } /* end while (not done with switches) */ + +/*--------------------------------------------------------------------------- + Check for nonsensical combinations of options. + ---------------------------------------------------------------------------*/ + +#ifdef SFX +opts_done: /* yes, very ugly...but only used by UnZipSFX with -x xlist */ +#endif + + if ((uO.cflag && uO.tflag) || (uO.cflag && uO.uflag) || + (uO.tflag && uO.uflag) || (uO.fflag && uO.overwrite_none)) + { + Info(slide, 0x401, ((char *)slide, LoadFarString(InvalidOptionsMsg))); + error = TRUE; + } + if (uO.aflag > 2) + uO.aflag = 2; +#ifdef VMS + if (uO.bflag > 2) + uO.bflag = 2; +#endif + if (uO.overwrite_all && uO.overwrite_none) { + Info(slide, 0x401, ((char *)slide, LoadFarString(IgnoreOOptionMsg))); + uO.overwrite_all = FALSE; + } +#ifdef MORE + if (G.M_flag && !isatty(1)) /* stdout redirected: "more" func. useless */ + G.M_flag = 0; +#endif + +#ifdef SFX + if (error) +#else + if ((argc-- == 0) || error) +#endif + { + *pargc = argc; + *pargv = argv; +#ifndef SFX + if (uO.vflag >= 2 && argc == -1) { /* "unzip -v" */ + show_version_info(__G); + return PK_OK; + } + if (!G.noargs && !error) + error = PK_PARAM; /* had options (not -h or -v) but no zipfile */ +#endif /* !SFX */ + return USAGE(error); + } + +#ifdef SFX + /* print our banner unless we're being fairly quiet */ + if (uO.qflag < 2) + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner), + UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, + LoadFarStringSmall(VersionDate))); +#ifdef BETA + /* always print the beta warning: no unauthorized distribution!! */ + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(BetaVersion), "\n", + "SFX")); +#endif +#endif /* SFX */ + + if (uO.cflag || uO.tflag || uO.vflag || uO.zflag +#ifdef TIMESTAMP + || uO.T_flag +#endif + ) + G.extract_flag = FALSE; + else + G.extract_flag = TRUE; + + *pargc = argc; + *pargv = argv; + return PK_OK; + +} /* end function uz_opts() */ + + + + +/********************/ +/* Function usage() */ +/********************/ + +#ifdef SFX +# ifdef VMS +# define LOCAL "X. Quote uppercase options" +# endif +# ifdef UNIX +# define LOCAL "X" +# endif +# ifdef DOS_OS2_W32 +# define LOCAL "s$" +# endif +# ifdef FLEXOS +# define LOCAL "s" +# endif +# ifdef AMIGA +# define LOCAL "N" +# endif + /* Default for all other systems: */ +# ifndef LOCAL +# define LOCAL "" +# endif + +# ifdef MORE +# define SFXOPT1 "M" +# else +# define SFXOPT1 "" +# endif + +int usage(__G__ error) /* return PK-type error code */ + __GDEF + int error; +{ + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner), + UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, + LoadFarStringSmall(VersionDate))); + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXOpts), + SFXOPT1, LOCAL)); +#ifdef BETA + Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(BetaVersion), "\n", + "SFX")); +#endif + + if (error) + return PK_PARAM; + else + return PK_COOL; /* just wanted usage screen: no error */ + +} /* end function usage() */ + + + + + +#else /* !SFX */ +# ifdef VMS +# define QUOT '\"' +# define QUOTS "\"" +# else +# define QUOT ' ' +# define QUOTS "" +# endif + +int usage(__G__ error) /* return PK-type error code */ + __GDEF + int error; +{ + int flag = (error? 1 : 0); + + +/*--------------------------------------------------------------------------- + Print either ZipInfo usage or UnZip usage, depending on incantation. + (Strings must be no longer than 512 bytes for Turbo C, apparently.) + ---------------------------------------------------------------------------*/ + + if (uO.zipinfo_mode) { + +#ifndef NO_ZIPINFO + + Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine1), + ZI_MAJORVER, ZI_MINORVER, PATCHLEVEL, BETALEVEL, + LoadFarStringSmall(VersionDate), + LoadFarStringSmall2(ZipInfoExample), QUOTS,QUOTS)); + Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine2))); + Info(slide, flag, ((char *)slide, LoadFarString(ZipInfoUsageLine3), + QUOT,QUOT, QUOT,QUOT, LoadFarStringSmall(ZipInfoUsageLine4))); +#ifdef VMS + Info(slide, flag, ((char *)slide, "\nRemember that non-lowercase\ + filespecs must be quoted in VMS (e.g., \"Makefile\").\n")); +#endif + +#endif /* !NO_ZIPINFO */ + + } else { /* UnZip mode */ + + Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine1), + UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, + LoadFarStringSmall(VersionDate))); +#ifdef BETA + Info(slide, flag, ((char *)slide, LoadFarString(BetaVersion), "", "")); +#endif + + Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine2), + ZIPINFO_MODE_OPTION, LoadFarStringSmall(ZipInfoMode))); +#ifdef VMS + if (!error) /* maybe no command-line tail found; show extra help */ + Info(slide, flag, ((char *)slide, LoadFarString(VMSusageLine2b))); +#endif + + Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine3), + LoadFarStringSmall(local1))); + + Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine4), + QUOT,QUOT, QUOT,QUOT, LoadFarStringSmall(local2), QUOT,QUOT, + LoadFarStringSmall2(local3))); + + /* This is extra work for SMALL_MEM, but it will work since + * LoadFarStringSmall2 uses the same buffer. Remember, this + * is a hack. */ + Info(slide, flag, ((char *)slide, LoadFarString(UnzipUsageLine5), + LoadFarStringSmall(Example2), LoadFarStringSmall2(Example3), + LoadFarStringSmall2(Example3))); + + } /* end if (uO.zipinfo_mode) */ + + if (error) + return PK_PARAM; + else + return PK_COOL; /* just wanted usage screen: no error */ + +} /* end function usage() */ + +#endif /* ?SFX */ + + + + +#ifndef SFX + +/********************************/ +/* Function show_version_info() */ +/********************************/ + +static void show_version_info(__G) + __GDEF +{ + if (uO.qflag > 3) /* "unzip -vqqqq" */ + Info(slide, 0, ((char *)slide, "%d\n", + (UZ_MAJORVER*100 + UZ_MINORVER*10 + PATCHLEVEL))); + else { + char *envptr, *getenv(); + int numopts = 0; + + Info(slide, 0, ((char *)slide, LoadFarString(UnzipUsageLine1v), + UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, BETALEVEL, + LoadFarStringSmall(VersionDate))); + Info(slide, 0, ((char *)slide, + LoadFarString(UnzipUsageLine2v))); + version(__G); + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptions))); +#ifdef ACORN_FTYPE_NFS + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(AcornFtypeNFS))); + ++numopts; +#endif +#ifdef ASM_CRC + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(AsmCRC))); + ++numopts; +#endif +#ifdef ASM_INFLATECODES + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(AsmInflateCodes))); + ++numopts; +#endif +#ifdef CHECK_VERSIONS + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Check_Versions))); + ++numopts; +#endif +#ifdef COPYRIGHT_CLEAN + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Copyright_Clean))); + ++numopts; +#endif +#ifdef DEBUG + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(UDebug))); + ++numopts; +#endif +#ifdef DEBUG_TIME + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(DebugTime))); + ++numopts; +#endif +#ifdef DLL + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Dll))); + ++numopts; +#endif +#ifdef DOSWILD + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(DosWild))); + ++numopts; +#endif +#ifdef LZW_CLEAN + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(LZW_Clean))); + ++numopts; +#endif +#ifndef MORE + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(No_More))); + ++numopts; +#endif +#ifdef NO_ZIPINFO + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(No_ZipInfo))); + ++numopts; +#endif +#ifdef NTSD_EAS + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(NTSDExtAttrib))); + ++numopts; +#endif +#ifdef OS2_EAS + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(OS2ExtAttrib))); + ++numopts; +#endif +#ifdef QLZIP + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(SMSExFldOnUnix))); + ++numopts; +#endif +#ifdef REENTRANT + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Reentrant))); + ++numopts; +#endif +#ifdef REGARGS + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(RegArgs))); + ++numopts; +#endif +#ifdef RETURN_CODES + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Return_Codes))); + ++numopts; +#endif +#ifdef SET_DIR_ATTRIB + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(SetDirAttrib))); + ++numopts; +#endif +#ifdef TIMESTAMP + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(TimeStamp))); + ++numopts; +#endif +#ifdef UNIXBACKUP + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(UnixBackup))); + ++numopts; +#endif +#ifdef USE_EF_UT_TIME + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Use_EF_UT_time))); + ++numopts; +#endif +#ifndef COPYRIGHT_CLEAN + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Use_Smith_Code))); + ++numopts; +#endif +#ifndef LZW_CLEAN + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Use_Unshrink))); + ++numopts; +#endif +#ifdef USE_VFAT + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(Use_VFAT_support))); + ++numopts; +#endif +#ifdef USE_ZLIB + sprintf((char *)(slide+256), LoadFarStringSmall(UseZlib), + ZLIB_VERSION, zlib_version); + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + (char *)(slide+256))); + ++numopts; +#endif +#ifdef VMS_TEXT_CONV + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(VmsTextConv))); + ++numopts; +#endif +#ifdef VMSCLI + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(VmsCLI))); + ++numopts; +#endif +#ifdef VMSWILD + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(VmsWild))); + ++numopts; +#endif +#if CRYPT +# ifdef PASSWD_FROM_STDIN + Info(slide, 0, ((char *)slide, LoadFarString(CompileOptFormat), + LoadFarStringSmall(PasswdStdin))); +# endif + Info(slide, 0, ((char *)slide, LoadFarString(Decryption), + CR_MAJORVER, CR_MINORVER, CR_BETA_VER, + LoadFarStringSmall(CryptDate))); + ++numopts; +#endif /* CRYPT */ + if (numopts == 0) + Info(slide, 0, ((char *)slide, + LoadFarString(CompileOptFormat), + LoadFarStringSmall(None))); + + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptions))); + envptr = getenv(LoadFarStringSmall(EnvUnZip)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvUnZip), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); + envptr = getenv(LoadFarStringSmall(EnvUnZip2)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvUnZip2), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); + envptr = getenv(LoadFarStringSmall(EnvZipInfo)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvZipInfo), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); + envptr = getenv(LoadFarStringSmall(EnvZipInfo2)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvZipInfo2), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); +#ifndef __RSXNT__ +#ifdef __EMX__ + envptr = getenv(LoadFarStringSmall(EnvEMX)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvEMX), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); + envptr = getenv(LoadFarStringSmall(EnvEMXOPT)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvEMXOPT), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); +#endif /* __EMX__ */ +#if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2))) + envptr = getenv(LoadFarStringSmall(EnvGO32)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvGO32), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); + envptr = getenv(LoadFarStringSmall(EnvGO32TMP)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvGO32TMP), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); +#endif /* __GO32__ && !(__DJGPP__ >= 2) */ +#endif /* !__RSXNT__ */ +#ifdef RISCOS + envptr = getenv(LoadFarStringSmall(EnvUnZipExts)); + Info(slide, 0, ((char *)slide, LoadFarString(EnvOptFormat), + LoadFarStringSmall(EnvUnZipExts), + (envptr == (char *)NULL || *envptr == 0)? + LoadFarStringSmall2(None) : envptr)); +#endif /* RISCOS */ + } +} /* end function show_version() */ + +#endif /* !SFX */ +#endif /* !WINDLL */ diff --git a/utils/Install/sfxzip/unzipstb.c b/utils/Install/sfxzip/unzipstb.c new file mode 100644 index 0000000000..6ca238a89f --- /dev/null +++ b/utils/Install/sfxzip/unzipstb.c @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------------- + + unzipstb.c + + Simple stub function for UnZip DLL (or shared library, whatever); does + exactly the same thing as normal UnZip, except for additional printf()s + of various version numbers, solely as a demonstration of what can/should + be checked when using the DLL. (If major version numbers ever differ, + assume program is incompatible with DLL--especially if DLL version is + older. This is not likely to be a problem with *this* simple program, + but most user programs will be much more complex.) + + ---------------------------------------------------------------------------*/ + +#include <stdio.h> +#include "unzip.h" +#include "version.h" + +int main(int argc, char *argv[]) +{ + static UzpVer *pVersion; /* no pervert jokes, please... */ + + pVersion = UzpVersion(); + + printf("UnZip stub: checking version numbers (DLL is dated %s)\n", + pVersion->date); + printf(" UnZip versions: expecting %d.%d%d, using %d.%d%d%s\n", + UZ_MAJORVER, UZ_MINORVER, PATCHLEVEL, pVersion->unzip.major, + pVersion->unzip.minor, pVersion->unzip.patchlevel, pVersion->betalevel); + printf(" ZipInfo versions: expecting %d.%d%d, using %d.%d%d\n", + ZI_MAJORVER, ZI_MINORVER, PATCHLEVEL, pVersion->zipinfo.major, + pVersion->zipinfo.minor, pVersion->zipinfo.patchlevel); + +/* + D2_M*VER and os2dll.* are obsolete, though retained for compatibility: + + printf(" OS2 DLL versions: expecting %d.%d%d, using %d.%d%d\n", + D2_MAJORVER, D2_MINORVER, PATCHLEVEL, pVersion->os2dll.major, + pVersion->os2dll.minor, pVersion->os2dll.patchlevel); + */ + + if (pVersion->flag & 2) + printf(" using zlib version %s\n", pVersion->zlib_version); + printf("\n"); + + /* call the actual UnZip routine (string-arguments version) */ + return UzpMain(argc, argv); +} diff --git a/utils/Install/sfxzip/win32.c b/utils/Install/sfxzip/win32.c new file mode 100644 index 0000000000..f50ee5f9dd --- /dev/null +++ b/utils/Install/sfxzip/win32.c @@ -0,0 +1,2390 @@ +/*--------------------------------------------------------------------------- + + win32.c + + 32-bit Windows-specific (NT/95) routines for use with Info-ZIP's UnZip 5.3 + and later. + + Contains: GetLoadPath() + Opendir() + Readdir() + Closedir() + process_defer_NT() process any deferred items + SetSD() set security descriptor on file + EvalExtraFields() evaluate and process and extra field NOW + IsWinNT() indicate type of WIN32 platform + test_NTSD() test integrity of NT security data + utime2FileTime() + FStampIsLocTime() + FileTime2utime() + VFatFileTime2utime() + UTCtime2Localtime() + NTtzbugWorkaround() + getNTfiletime() + close_outfile() + stamp_file() + isfloppy() + NTQueryVolInfo() + IsVolumeOldFAT() + do_wild() + mapattr() + mapname() + map2fat() + checkdir() + version() + zstat_win32() + getch_win32() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" +#include <windows.h> /* must be AFTER unzip.h to avoid struct G problems */ +#ifdef __RSXNT__ +# include "rsxntwin.h" +#endif +#include "nt.h" + +#ifndef FUNZIP /* most of this file is not used with fUnZip */ + +#if (defined(__GO32__) || defined(__EMX__) || defined(__CYGWIN32__)) +# define MKDIR(path,mode) mkdir(path,mode) +#else +# define MKDIR(path,mode) mkdir(path) +#endif + +#ifdef HAVE_WORKING_DIRENT_H +# undef HAVE_WORKING_DIRENT_H +#endif +/* The emxrtl dirent support of (__GO32__ || __EMX__) converts to lowercase! */ +#if defined(__CYGWIN32__) +# define HAVE_WORKING_DIRENT_H +#endif + +#ifndef SFX +# ifdef HAVE_WORKING_DIRENT_H +# include <dirent.h> /* use readdir() */ +# define zdirent dirent +# define zDIR DIR +# define Opendir opendir +# define Readdir readdir +# define Closedir closedir +# else /* !HAVE_WORKING_DIRENT_H */ + typedef struct zdirent { + char reserved [21]; + char ff_attrib; + short ff_ftime; + short ff_fdate; + long size; + char d_name[MAX_PATH]; + int d_first; + HANDLE d_hFindFile; + } zDIR; + + static zDIR *Opendir (const char *n); + static struct zdirent *Readdir (zDIR *d); + static void Closedir (zDIR *d); +# endif /* ?HAVE_WORKING_DIRENT_H */ +#endif /* !SFX */ + + +/* Function prototypes */ +#ifdef NTSD_EAS + static int SetSD(__GPRO__ char *path, PVOLUMECAPS VolumeCaps, + uch *eb_ptr, unsigned eb_len); + static int EvalExtraFields(__GPRO__ char *path, uch *ef_ptr, + unsigned ef_len); +#endif + +#if (defined(USE_EF_UT_TIME) || defined(NT_TZBUG_WORKAROUND) || \ + defined(TIMESTAMP)) + static void utime2FileTime(time_t ut, FILETIME *pft); + static int FStampIsLocTime(__GPRO__ const char *path); +#endif /* USE_EF_UT_TIME || NT_TZBUG_WORKAROUND || TIMESTAMP */ +#ifdef NT_TZBUG_WORKAROUND + static int FileTime2utime(const FILETIME *pft, time_t *ut); +#ifdef W32_STAT_BANDAID + static int VFatFileTime2utime(const FILETIME *pft, time_t *ut); +#endif + static time_t UTCtime2Localtime(time_t utctime); + static void NTtzbugWorkaround(time_t ut, FILETIME *pft); +#endif /* NT_TZBUG_WORKAROUND */ + +static int getNTfiletime (__GPRO__ FILETIME *pModFT, FILETIME *pAccFT, + FILETIME *pCreFT); +static int isfloppy (int nDrive); +static int NTQueryVolInfo (__GPRO__ const char *name); +static int IsVolumeOldFAT (__GPRO__ const char *name); +static void map2fat (char *pathcomp, char **pEndFAT); + + +#ifdef __MINGW32__ + int _CRT_glob = 0; /* suppress command line globbing by C RTL */ +#endif + +/* static int created_dir; */ /* used by mapname(), checkdir() */ +/* static int renamed_fullpath; */ /* ditto */ +/* static int fnlen; */ /* ditto */ +/* static unsigned nLabelDrive; */ /* ditto */ + +extern char Far TruncNTSD[]; /* in extract.c */ + + + +#ifdef SFX + +/**************************/ +/* Function GetLoadPath() */ +/**************************/ + +char *GetLoadPath(__GPRO) +{ +#ifdef MSC + extern char *_pgmptr; + return _pgmptr; + +#else /* use generic API call */ + + GetModuleFileName(NULL, G.filename, FILNAMSIZ-1); + _ISO_INTERN(G.filename); /* translate to codepage of C rtl's stdio */ + return G.filename; +#endif + +} /* end function GetLoadPath() */ + + + + + +#else /* !SFX */ + +#ifndef HAVE_WORKING_DIRENT_H + +/**********************/ /* Borrowed from ZIP 2.0 sources */ +/* Function Opendir() */ /* Difference: no special handling for */ +/**********************/ /* hidden or system files. */ + +static zDIR *Opendir(n) + const char *n; /* directory to open */ +{ + zDIR *d; /* malloc'd return value */ + char *p; /* malloc'd temporary string */ + WIN32_FIND_DATA fd; + extent len = strlen(n); + + /* Start searching for files in directory n */ + + if ((d = (zDIR *)malloc(sizeof(zDIR))) == NULL || + (p = malloc(strlen(n) + 5)) == NULL) + { + if (d != (zDIR *)NULL) + free((void *)d); + return (zDIR *)NULL; + } + INTERN_TO_ISO(n, p); + if (len > 0) { + if (p[len-1] == ':') + p[len++] = '.'; /* x: => x:. */ + else if (p[len-1] == '/' || p[len-1] == '\\') + --len; /* foo/ => foo */ + } + strcpy(p+len, "/*"); + + if (INVALID_HANDLE_VALUE == (d->d_hFindFile = FindFirstFile(p, &fd))) { + free((zvoid *)d); + free((zvoid *)p); + return NULL; + } + strcpy(d->d_name, fd.cFileName); + + free((zvoid *)p); + d->d_first = 1; + return d; + +} /* end of function Opendir() */ + + + + +/**********************/ /* Borrowed from ZIP 2.0 sources */ +/* Function Readdir() */ /* Difference: no special handling for */ +/**********************/ /* hidden or system files. */ + +static struct zdirent *Readdir(d) + zDIR *d; /* directory stream from which to read */ +{ + /* Return pointer to first or next directory entry, or NULL if end. */ + + if ( d->d_first ) + d->d_first = 0; + else + { + WIN32_FIND_DATA fd; + + if ( !FindNextFile(d->d_hFindFile, &fd) ) + return NULL; + + ISO_TO_INTERN(fd.cFileName, d->d_name); + } + return (struct zdirent *)d; + +} /* end of function Readdir() */ + + + + +/***********************/ +/* Function Closedir() */ /* Borrowed from ZIP 2.0 sources */ +/***********************/ + +static void Closedir(d) + zDIR *d; /* directory stream to close */ +{ + FindClose(d->d_hFindFile); + free(d); +} + +#endif /* !HAVE_WORKING_DIRENT_H */ +#endif /* ?SFX */ + + + + +#ifdef NTSD_EAS + +/*********************************/ +/* Function process_defer_NT() */ +/*********************************/ + +void process_defer_NT(__G) + __GDEF +{ + /* process deferred items */ + + DWORD dir, bytes; + DWORD dirfail, bytesfail; + + ProcessDefer(&dir, &bytes, &dirfail, &bytesfail); + + if (!uO.tflag && (uO.qflag < 2)) { + if (dir) + Info(slide, 0, ((char *)slide, + " updated: %lu directory entries with %lu bytes security", + (ulg)dir, (ulg)bytes)); + if (dirfail) + Info(slide, 0, ((char *)slide, + " failed: %lu directory entries with %lu bytes security", + (ulg)dirfail, (ulg)bytesfail)); + } +} + + + +/**********************/ +/* Function SetSD() */ /* return almost-PK errors */ +/**********************/ + +static int SetSD(__G__ path, VolumeCaps, eb_ptr, eb_len) + __GDEF + char *path; + PVOLUMECAPS VolumeCaps; + uch *eb_ptr; + unsigned eb_len; +{ + ulg ntsd_ucSize; + uch *security_data; + int error; + + if (eb_ptr == NULL || eb_len < EB_NTSD_L_LEN) + return PK_OK; /* not a valid NTSD extra field: assume OK */ + + /* check if we know how to handle this version */ + if (*(eb_ptr + (EB_HEADSIZE+EB_NTSD_VERSION)) > (uch)EB_NTSD_MAX_VER) + return PK_OK; + + ntsd_ucSize = makelong(eb_ptr + (EB_HEADSIZE+EB_UCSIZE_P)); + if (ntsd_ucSize > 0L && eb_len <= (EB_NTSD_L_LEN + EB_CMPRHEADLEN)) + return IZ_EF_TRUNC; /* no compressed data! */ + + /* allocate storage for uncompressed data */ + security_data = (uch *)malloc((extent)ntsd_ucSize); + if (security_data == (uch *)NULL) + return PK_MEM4; + + error = memextract(__G__ security_data, ntsd_ucSize, + (eb_ptr + (EB_HEADSIZE+EB_NTSD_L_LEN)), (ulg)(eb_len - EB_NTSD_L_LEN)); + + if (error == PK_OK) { + if (SecuritySet(path, VolumeCaps, security_data)) { + error = PK_COOL; + if (!uO.tflag && (uO.qflag < 2) && + (!(VolumeCaps->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))) + Info(slide, 0, ((char *)slide, " (%ld bytes security)", + ntsd_ucSize)); + } + } + + free(security_data); + return error; +} + + + + +/********************************/ /* scan extra fields for something */ +/* Function EvalExtraFields() */ /* we happen to know */ +/********************************/ + +static int EvalExtraFields(__G__ path, ef_ptr, ef_len) + __GDEF + char *path; + uch *ef_ptr; + unsigned ef_len; +{ + int rc = PK_OK; + + if (!uO.X_flag) + return PK_OK; /* user said don't process ACLs; for now, no other + extra block types are handled here */ + + while (ef_len >= EB_HEADSIZE) + { + unsigned eb_id = makeword(EB_ID + ef_ptr); + unsigned eb_len = makeword(EB_LEN + ef_ptr); + + if (eb_len > (ef_len - EB_HEADSIZE)) { + /* discovered some extra field inconsistency! */ + Trace((stderr, + "EvalExtraFields: block length %u > rest ef_size %u\n", eb_len, + ef_len - EB_HEADSIZE)); + break; + } + + switch (eb_id) + { + /* process security descriptor extra data if: + Caller is WinNT AND + Target local/remote drive supports acls AND + Target file is not a directory (else we defer processing + until later) + */ + case EF_NTSD: + if (IsWinNT()) { + VOLUMECAPS VolumeCaps; + + /* provide useful input */ + VolumeCaps.dwFileAttributes = G.pInfo->file_attr; + VolumeCaps.bUsePrivileges = (uO.X_flag > 1); + + /* check target volume capabilities - just fall through + * and try if fail */ + if (GetVolumeCaps(G.rootpath, path, &VolumeCaps) && + !(VolumeCaps.dwFileSystemFlags & FS_PERSISTENT_ACLS)) + { + rc = PK_OK; + break; + } + rc = SetSD(__G__ path, &VolumeCaps, ef_ptr, eb_len); + } else + rc = PK_OK; + break; + +#if 0 + /* perhaps later we can add support for unzipping OS/2 EAs to NT */ + case EF_OS2: + rc = SetEAs(__G__ path, ef_ptr); + break; + + case EF_PKUNIX: + case EF_IZUNIX: + case EF_IZUNIX2: + case EF_TIME: + break; /* handled elsewhere */ +#else /* ! 0 */ +#ifdef DEBUG + case EF_AV: + case EF_OS2: + case EF_PKVMS: + case EF_PKW32: + case EF_PKUNIX: + case EF_IZVMS: + case EF_IZUNIX: + case EF_IZUNIX2: + case EF_TIME: + case EF_MAC3: + case EF_JLMAC: + case EF_ZIPIT: + case EF_VMCMS: + case EF_MVS: + case EF_ACL: + case EF_BEOS: + case EF_QDOS: + case EF_AOSVS: + case EF_SPARK: + case EF_MD5: + case EF_ASIUNIX: + break; /* shut up for other known e.f. blocks */ +#endif /* DEBUG */ +#endif /* ? 0 */ + + default: + Trace((stderr, + "EvalExtraFields: unknown extra field block, ID=%u\n", + eb_id)); + break; + } + + ef_ptr += (eb_len + EB_HEADSIZE); + ef_len -= (eb_len + EB_HEADSIZE); + + if (rc != PK_OK) + break; + } + + return rc; +} + + + + +#ifndef SFX + +/**************************/ +/* Function test_NTSD() */ /* returns PK_WARN when NTSD data is invalid */ +/**************************/ + +#ifdef __BORLANDC__ +/* Turn off warning about not using all parameters for this function only */ +#pragma argsused +#endif +int test_NTSD(__G__ eb, eb_size, eb_ucptr, eb_ucsize) + __GDEF + uch *eb; + unsigned eb_size; + uch *eb_ucptr; + ulg eb_ucsize; +{ + int r = PK_OK; + + if (!ValidateSecurity(eb_ucptr)) + r = PK_WARN; + return r; + +} /* end function test_NTSD() */ + +#endif /* !SFX */ +#endif /* NTSD_EAS */ + + + + +/**********************/ +/* Function IsWinNT() */ +/**********************/ + +int IsWinNT(void) /* returns TRUE if real NT, FALSE if Win95 or Win32s */ +{ + static DWORD g_PlatformId = 0xFFFFFFFF; /* saved platform indicator */ + + if (g_PlatformId == 0xFFFFFFFF) { + /* note: GetVersionEx() doesn't exist on WinNT 3.1 */ + if (GetVersion() < 0x80000000) + g_PlatformId = TRUE; + else + g_PlatformId = FALSE; + } + return (int)g_PlatformId; +} + + +/* DEBUG_TIME insertion: */ +#ifdef DEBUG_TIME +static int show_NTFileTime(FILE *hdo, char *TTmsg, int isloc, FILETIME *pft); + +static int show_NTFileTime(FILE *hdo, char *TTmsg, int isloc, FILETIME *pft) +{ + SYSTEMTIME w32tm; + int rval; + + rval = FileTimeToSystemTime(pft, &w32tm); + if (!rval) { + fprintf(hdo, "%s\n %08lX,%08lX (%s) -> Conversion failed !!!\n", + TTmsg, (ulg)(pft->dwHighDateTime), (ulg)(pft->dwLowDateTime), + (isloc ? "local" : "UTC")); + } else { + fprintf(hdo, "%s\n %08lx,%08lx -> %04u-%02u-%02u, %02u:%02u:%02u %s\n", + TTmsg, (ulg)(pft->dwHighDateTime), (ulg)(pft->dwLowDateTime), + w32tm.wYear, w32tm.wMonth, w32tm.wDay, w32tm.wHour, + w32tm.wMinute, w32tm.wSecond, (isloc ? "local" : "UTC")); + } + return rval; +} +#define FTTrace(x) show_NTFileTime x +#else +#define FTTrace(x) +#endif /* DEBUG_TIME */ +/* end of TIME_DEBUG insertion */ + +#if (defined(USE_EF_UT_TIME) || defined(NT_TZBUG_WORKAROUND) || \ + defined(TIMESTAMP)) + +#if ((defined(__GNUC__) || defined(ULONG_LONG_MAX)) && !defined(HAVE_INT64)) + typedef long long LLONG64; + typedef unsigned long long ULLNG64; +# define HAVE_INT64 +#endif +#if (defined(__WATCOMC__) && (__WATCOMC__ >= 1100) && !defined(HAVE_INT64)) + typedef __int64 LLONG64; + typedef unsigned __int64 ULLNG64; +# define HAVE_INT64 +#endif +#if (defined(_MSC_VER) && (_MSC_VER >= 1100) && !defined(HAVE_INT64)) + typedef __int64 LLONG64; + typedef unsigned __int64 ULLNG64; +# define HAVE_INT64 +#endif + +/*****************************/ +/* Function utime2FileTime() */ /* convert Unix time_t format into the */ +/*****************************/ /* form used by SetFileTime() in NT/95 */ + +#define UNIX_TIME_ZERO_HI 0x019DB1DEUL +#define UNIX_TIME_ZERO_LO 0xD53E8000UL +#define NT_QUANTA_PER_UNIX 10000000L + +static void utime2FileTime(time_t ut, FILETIME *pft) +{ +#ifdef HAVE_INT64 + ULLNG64 NTtime; + + /* NT_QUANTA_PER_UNIX is small enough so that "ut * NT_QUANTA_PER_UNIX" + * cannot overflow in 64-bit signed calculation, regardless wether "ut" + * is signed or unsigned. */ + NTtime = ((LLONG64)ut * NT_QUANTA_PER_UNIX) + + ((ULLNG64)UNIX_TIME_ZERO_LO + ((ULLNG64)UNIX_TIME_ZERO_HI << 32)); + pft->dwLowDateTime = (DWORD)NTtime; + pft->dwHighDateTime = (DWORD)(NTtime >> 32); + +#else /* !HAVE_INT64 (64-bit integer arithmetics may not be supported) */ + unsigned int b1, b2, carry = 0; + unsigned long r0, r1, r2, r3; + long r4; /* signed, to catch environments with signed time_t */ + + b1 = ut & 0xFFFF; + b2 = (ut >> 16) & 0xFFFF; /* if ut is over 32 bits, too bad */ + r1 = b1 * (NT_QUANTA_PER_UNIX & 0xFFFF); + r2 = b1 * (NT_QUANTA_PER_UNIX >> 16); + r3 = b2 * (NT_QUANTA_PER_UNIX & 0xFFFF); + r4 = b2 * (NT_QUANTA_PER_UNIX >> 16); + r0 = (r1 + (r2 << 16)) & 0xFFFFFFFFL; + if (r0 < r1) + carry++; + r1 = r0; + r0 = (r0 + (r3 << 16)) & 0xFFFFFFFFL; + if (r0 < r1) + carry++; + pft->dwLowDateTime = r0 + UNIX_TIME_ZERO_LO; + if (pft->dwLowDateTime < r0) + carry++; + pft->dwHighDateTime = r4 + (r2 >> 16) + (r3 >> 16) + + UNIX_TIME_ZERO_HI + carry; +#endif /* ?HAVE_INT64 */ + +} /* end function utime2FileTime() */ + + + +/******************************/ +/* Function FStampIsLocTime() */ +/******************************/ + +static int FStampIsLocTime(__GPRO__ const char *path) +{ + return (NTQueryVolInfo(__G__ path) ? G.lastVolLocTim : FALSE); +} + +#endif /* USE_EF_UT_TIME || NT_TZBUG_WORKAROUND || TIMESTAMP */ + + + +#ifndef NT_TZBUG_WORKAROUND +# define UTIME_BOUNDCHECK_1(utimval) \ + if (fs_uses_loctime) { \ + utime_dosmin = dos_to_unix_time(DOSTIME_MINIMUM); \ + if ((ulg)utimval < (ulg)utime_dosmin) \ + utimval = utime_dosmin; \ + } +# define UTIME_BOUNDCHECK_N(utimval) \ + if (fs_uses_loctime && ((ulg)utimval < (ulg)utime_dosmin)) \ + utimval = utime_dosmin; +# define NT_TZBUG_PRECOMPENSATE(ut, pft) + +#else /* NT_TZBUG_WORKAROUND */ +# define UNIX_TIME_UMAX_HI 0x0236485EUL +# define UNIX_TIME_UMAX_LO 0xD4A5E980UL +# define UNIX_TIME_SMIN_HI 0x0151669EUL +# define UNIX_TIME_SMIN_LO 0xD53E8000UL +# define UNIX_TIME_SMAX_HI 0x01E9FD1EUL +# define UNIX_TIME_SMAX_LO 0xD4A5E980UL +# define UTIME_1980_JAN_01_00_00 315532800L +# define UTIME_BOUNDCHECK_1(utimval) +# define UTIME_BOUNDCHECK_N(utimval) +# define NT_TZBUG_PRECOMPENSATE(ut, pft) \ + if (fs_uses_loctime) NTtzbugWorkaround(ut, pft); + + /* nonzero if `y' is a leap year, else zero */ +# define leap(y) (((y)%4 == 0 && (y)%100 != 0) || (y)%400 == 0) + /* number of leap years from 1970 to `y' (not including `y' itself) */ +# define nleap(y) (((y)-1969)/4 - ((y)-1901)/100 + ((y)-1601)/400) + +extern ZCONST ush ydays[]; /* defined in fileio.c */ + +/*****************************/ +/* Function FileTime2utime() */ +/*****************************/ + +static int FileTime2utime(const FILETIME *pft, time_t *ut) +{ +#ifdef HAVE_INT64 + ULLNG64 NTtime; + + NTtime = ((ULLNG64)pft->dwLowDateTime + + ((ULLNG64)pft->dwHighDateTime << 32)); + + /* underflow and overflow handling */ +#ifdef CHECK_UTIME_SIGNED_UNSIGNED + if ((time_t)0x80000000L < (time_t)0L) + { + if (NTtime < ((ULLNG64)UNIX_TIME_SMIN_LO + + ((ULLNG64)UNIX_TIME_SMIN_HI << 32))) { + *ut = (time_t)LONG_MIN; + return FALSE; + } + if (NTtime > ((ULLNG64)UNIX_TIME_SMAX_LO + + ((ULLNG64)UNIX_TIME_SMAX_HI << 32))) { + *ut = (time_t)LONG_MAX; + return FALSE; + } + } + else +#endif /* CHECK_UTIME_SIGNED_UNSIGNED */ + { + if (NTtime < ((ULLNG64)UNIX_TIME_ZERO_LO + + ((ULLNG64)UNIX_TIME_ZERO_HI << 32))) { + *ut = (time_t)0; + return FALSE; + } + if (NTtime > ((ULLNG64)UNIX_TIME_UMAX_LO + + ((ULLNG64)UNIX_TIME_UMAX_HI << 32))) { + *ut = (time_t)ULONG_MAX; + return FALSE; + } + } + + NTtime -= ((ULLNG64)UNIX_TIME_ZERO_LO + + ((ULLNG64)UNIX_TIME_ZERO_HI << 32)); + *ut = (time_t)(NTtime / (unsigned long)NT_QUANTA_PER_UNIX); + return TRUE; +#else /* !HAVE_INT64 (64-bit integer arithmetics may not be supported) */ + time_t days; + SYSTEMTIME w32tm; + + /* underflow and overflow handling */ +#ifdef CHECK_UTIME_SIGNED_UNSIGNED + if ((time_t)0x80000000L < (time_t)0L) + { + if ((pft->dwHighDateTime < UNIX_TIME_SMIN_HI) || + ((pft->dwHighDateTime == UNIX_TIME_SMIN_HI) && + (pft->dwLowDateTime < UNIX_TIME_SMIN_LO))) { + *ut = (time_t)LONG_MIN; + return FALSE; + if ((pft->dwHighDateTime > UNIX_TIME_SMAX_HI) || + ((pft->dwHighDateTime == UNIX_TIME_SMAX_HI) && + (pft->dwLowDateTime > UNIX_TIME_SMAX_LO))) { + *ut = (time_t)LONG_MAX; + return FALSE; + } + } + else +#endif /* CHECK_UTIME_SIGNED_UNSIGNED */ + { + if ((pft->dwHighDateTime < UNIX_TIME_ZERO_HI) || + ((pft->dwHighDateTime == UNIX_TIME_ZERO_HI) && + (pft->dwLowDateTime < UNIX_TIME_ZERO_LO))) { + *ut = (time_t)0; + return FALSE; + } + if ((pft->dwHighDateTime > UNIX_TIME_UMAX_HI) || + ((pft->dwHighDateTime == UNIX_TIME_UMAX_HI) && + (pft->dwLowDateTime > UNIX_TIME_UMAX_LO))) { + *ut = (time_t)ULONG_MAX; + return FALSE; + } + } + + FileTimeToSystemTime(pft, &w32tm); + + /* set `days' to the number of days into the year */ + days = w32tm.wDay - 1 + ydays[w32tm.wMonth-1] + + (w32tm.wMonth > 2 && leap (w32tm.wYear)); + + /* now set `days' to the number of days since 1 Jan 1970 */ + days += 365 * (time_t)(w32tm.wYear - 1970) + + (time_t)(nleap(w32tm.wYear)); + + *ut = (time_t)(86400L * days + 3600L * (time_t)w32tm.wHour + + (time_t)(60 * w32tm.wMinute + w32tm.wSecond)); + return TRUE; +#endif /* ?HAVE_INT64 */ +} /* end function FileTime2utime() */ + + + +#ifdef W32_STAT_BANDAID +/*********************************/ +/* Function VFatFileTime2utime() */ +/*********************************/ + +static int VFatFileTime2utime(const FILETIME *pft, time_t *ut) +{ + FILETIME lft; +#ifndef HAVE_MKTIME + WORD wDOSDate, wDOSTime; +#else + SYSTEMTIME w32tm; + struct tm ltm; +#endif + + FileTimeToLocalFileTime(pft, &lft); + FTTrace((stdout, "VFatFT2utime, feed for mktime()", 1, &lft)); +#ifndef HAVE_MKTIME + /* This version of the FILETIME-to-UNIXTIME conversion function + * uses DOS-DATE-TIME format as intermediate stage. For modification + * and access times, this is no problem. But, the extra fine resolution + * of the VFAT-stored creation time gets lost. + */ + FileTimeToDosDateTime(&lft, &wDOSDate, &wDOSTime); + TTrace((stdout,"DosDateTime is %04u-%02u-%02u %02u:%02u:%02u\n", + (unsigned)((wDOSDate>>9)&0x7f)+1980,(unsigned)((wDOSDate>>5)&0x0f), + (unsigned)(wDOSDate&0x1f),(unsigned)((wDOSTime>>11)&0x1f), + (unsigned)((wDOSTime>>5)&0x3f),(unsigned)((wDOSTime<<1)&0x3e))); + *ut = dos_to_unix_time(((ulg)wDOSDate << 16) | (ulg)wDOSTime); + + /* a cheap error check: dos_to_unix_time() only returns an odd time + * when clipping at maximum time_t value. DOS_DATE_TIME values have + * a resolution of 2 seconds and are therefore even numbers. + */ + return (((*ut)&1) == (time_t)0); +#else /* HAVE_MKTIME */ + FileTimeToSystemTime(&lft, &w32tm); + /* underflow and overflow handling */ + /* TODO: The range checks are not accurate, the actual limits may + * be off by one daylight-saving-time shift (typically 1 hour), + * depending on the current state of "is_dst". + */ +#ifdef CHECK_UTIME_SIGNED_UNSIGNED + if ((time_t)0x80000000L < (time_t)0L) + { + if ((pft->dwHighDateTime < UNIX_TIME_SMIN_HI) || + ((pft->dwHighDateTime == UNIX_TIME_SMIN_HI) && + (pft->dwLowDateTime < UNIX_TIME_SMIN_LO))) { + *ut = (time_t)LONG_MIN; + return FALSE; + if ((pft->dwHighDateTime > UNIX_TIME_SMAX_HI) || + ((pft->dwHighDateTime == UNIX_TIME_SMAX_HI) && + (pft->dwLowDateTime > UNIX_TIME_SMAX_LO))) { + *ut = (time_t)LONG_MAX; + return FALSE; + } + } + else +#endif /* CHECK_UTIME_SIGNED_UNSIGNED */ + { + if ((pft->dwHighDateTime < UNIX_TIME_ZERO_HI) || + ((pft->dwHighDateTime == UNIX_TIME_ZERO_HI) && + (pft->dwLowDateTime < UNIX_TIME_ZERO_LO))) { + *ut = (time_t)0; + return FALSE; + } + if ((pft->dwHighDateTime > UNIX_TIME_UMAX_HI) || + ((pft->dwHighDateTime == UNIX_TIME_UMAX_HI) && + (pft->dwLowDateTime > UNIX_TIME_UMAX_LO))) { + *ut = (time_t)ULONG_MAX; + return FALSE; + } + } + ltm.tm_year = w32tm.wYear - 1900; + ltm.tm_mon = w32tm.wMonth - 1; + ltm.tm_mday = w32tm.wDay; + ltm.tm_hour = w32tm.wHour; + ltm.tm_min = w32tm.wMinute; + ltm.tm_sec = w32tm.wSecond; + ltm.tm_isdst = -1; /* let mktime determine if DST is in effect */ + *ut = mktime(<m); + + /* a cheap error check: mktime returns "(time_t)-1L" on conversion errors. + * Normally, we would have to apply a consistency check because "-1" + * could also be a valid time. But, it is quite unlikely to read back odd + * time numbers from file systems that store time stamps in DOS format. + * (The only known exception is creation time on VFAT partitions.) + */ + return (*ut != (time_t)-1L); +#endif /* ?HAVE_MKTIME */ + +} /* end function VFatFileTime2utime() */ +#endif /* W32_STAT_BANDAID */ + + + +/********************************/ +/* Function UTCtime2Localtime() */ /* borrowed from Zip's mkgmtime() */ +/********************************/ + +static time_t UTCtime2Localtime(time_t utctime) +{ + time_t utc = utctime; + struct tm *tm; + unsigned years, months, days, hours, minutes, seconds; + + +#ifdef __BORLANDC__ /* Borland C++ 5.x crashes when trying to reference tm */ + if (utc < UTIME_1980_JAN_01_00_00) + utc = UTIME_1980_JAN_01_00_00; +#endif + tm = localtime(&utc); + if (tm == (struct tm *)NULL) + /* localtime() did not accept given utc time value; as an emergency + exit, the unconverted utctime value is returned */ + return utctime; + + years = tm->tm_year + 1900; /* year - 1900 -> year */ + months = tm->tm_mon; /* 0..11 */ + days = tm->tm_mday - 1; /* 1..31 -> 0..30 */ + hours = tm->tm_hour; /* 0..23 */ + minutes = tm->tm_min; /* 0..59 */ + seconds = tm->tm_sec; /* 0..61 in ANSI C */ + + /* set `days' to the number of days into the year */ + days += ydays[months] + (months > 1 && leap(years)); + + /* now set `days' to the number of days since 1 Jan 1970 */ + days += 365 * (years - 1970) + nleap(years); + + return (time_t)(86400L * (ulg)days + 3600L * (ulg)hours + + (ulg)(60 * minutes + seconds)); + +} /* end function UTCtime2Localtime() */ + + + +/********************************/ +/* Function NTtzbugWorkaround() */ +/********************************/ + +static void NTtzbugWorkaround(time_t ut, FILETIME *pft) +{ + FILETIME C_RTL_locft, NTAPI_locft; + time_t ux_loctime = UTCtime2Localtime(ut); + + /* This routine is only used when the target file system stores time- + * stamps as local time in MSDOS format. Thus we make sure that the + * resulting timestamp is within the range of MSDOS date-time values. */ + if (ux_loctime < UTIME_1980_JAN_01_00_00) + ux_loctime = UTIME_1980_JAN_01_00_00; + + utime2FileTime(ux_loctime, &C_RTL_locft); + if (!FileTimeToLocalFileTime(pft, &NTAPI_locft)) + return; + else { + long time_shift_l, time_shift_h; + int carry = 0; + + time_shift_l = C_RTL_locft.dwLowDateTime - NTAPI_locft.dwLowDateTime; + if (C_RTL_locft.dwLowDateTime < NTAPI_locft.dwLowDateTime) + carry--; + time_shift_h = C_RTL_locft.dwHighDateTime - NTAPI_locft.dwHighDateTime; + pft->dwLowDateTime += time_shift_l; + if (pft->dwLowDateTime < (ulg)time_shift_l) + carry++; + pft->dwHighDateTime += time_shift_h + carry; + TTrace((stdout, "FileTime shift: %08lx:%08lx\n", + time_shift_h+carry,time_shift_l)); + } +} /* end function NTtzbugWorkaround() */ + +#endif /* ?NT_TZBUG_WORKAROUND */ + + + +/****************************/ /* Get the file time in a format that */ +/* Function getNTfiletime() */ /* can be used by SetFileTime() in NT */ +/****************************/ + +static int getNTfiletime(__G__ pModFT, pAccFT, pCreFT) + __GDEF + FILETIME *pModFT; + FILETIME *pAccFT; + FILETIME *pCreFT; +{ +#ifdef NT_TZBUG_WORKAROUND + time_t ux_modtime; +#else /* !NT_TZBUG_WORKAROUND */ + FILETIME locft; /* 64-bit value made up of two 32-bit [low & high] */ + WORD wDOSDate; /* for converting from DOS date to Windows NT */ + WORD wDOSTime; +#endif /* ?NT_TZBUG_WORKAROUND */ +#ifdef USE_EF_UT_TIME + unsigned eb_izux_flg; + iztimes z_utime; /* struct for Unix-style actime & modtime, + creatime */ +#endif +#if (defined(USE_EF_UT_TIME) && !defined(NT_TZBUG_WORKAROUND)) + time_t utime_dosmin; +# endif +#if (defined(USE_EF_UT_TIME) || defined(NT_TZBUG_WORKAROUND)) + int fs_uses_loctime = FStampIsLocTime(__G__ G.filename); +#endif + + /* Copy and/or convert time and date variables, if necessary; + * return a flag indicating which time stamps are available. */ +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + ((eb_izux_flg = ef_scan_for_izux(G.extra_field, + G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime, + &z_utime, NULL)) & EB_UT_FL_MTIME)) + { + TTrace((stderr, "getNTfiletime: Unix e.f. modif. time = %lu\n", + z_utime.mtime)); + UTIME_BOUNDCHECK_1(z_utime.mtime) + utime2FileTime(z_utime.mtime, pModFT); + NT_TZBUG_PRECOMPENSATE(z_utime.mtime, pModFT) + if (eb_izux_flg & EB_UT_FL_ATIME) { + UTIME_BOUNDCHECK_N(z_utime.atime) + utime2FileTime(z_utime.atime, pAccFT); + NT_TZBUG_PRECOMPENSATE(z_utime.atime, pAccFT) + } + if (eb_izux_flg & EB_UT_FL_CTIME) { + UTIME_BOUNDCHECK_N(z_utime.ctime) + utime2FileTime(z_utime.ctime, pCreFT); + NT_TZBUG_PRECOMPENSATE(z_utime.ctime, pCreFT) + } + return (int)eb_izux_flg; + } +#endif /* USE_EF_UT_TIME */ +#ifdef NT_TZBUG_WORKAROUND + ux_modtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime); + utime2FileTime(ux_modtime, pModFT); + NT_TZBUG_PRECOMPENSATE(ux_modtime, pModFT) +#else /* !NT_TZBUG_WORKAROUND */ + + wDOSTime = (WORD)(G.lrec.last_mod_dos_datetime); + wDOSDate = (WORD)(G.lrec.last_mod_dos_datetime >> 16); + + /* The DosDateTimeToFileTime() function converts a DOS date/time + * into a 64-bit Windows NT file time */ + if (!DosDateTimeToFileTime(wDOSDate, wDOSTime, &locft)) + { + Info(slide, 0, ((char *)slide, "DosDateTime failed: %d\n", + (int)GetLastError())); + return 0; + } + if (!LocalFileTimeToFileTime(&locft, pModFT)) + { + Info(slide, 0, ((char *)slide, "LocalFileTime failed: %d\n", + (int)GetLastError())); + *pModFT = locft; + } +#endif /* ?NT_TZBUG_WORKAROUND */ + *pAccFT = *pModFT; + return (EB_UT_FL_MTIME | EB_UT_FL_ATIME); + +} /* end function getNTfiletime() */ + + + + +/****************************/ +/* Function close_outfile() */ +/****************************/ + +void close_outfile(__G) + __GDEF +{ + FILETIME Modft; /* File time type defined in NT, `last modified' time */ + FILETIME Accft; /* NT file time type, `last access' time */ + FILETIME Creft; /* NT file time type, `file creation' time */ + HANDLE hFile; /* File handle defined in NT */ + int gotTime; +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_name = (char *)alloca(strlen(G.filename) + 1); + + INTERN_TO_ISO(G.filename, ansi_name); +# define Ansi_Fname ansi_name +#else +# define Ansi_Fname G.filename +#endif + + /* Close the file and then re-open it using the Win32 + * CreateFile call, so that the file can be created + * with GENERIC_WRITE access, otherwise the SetFileTime + * call will fail. */ + fclose(G.outfile); + + /* don't set the time stamp and attributes on standard output */ + if (uO.cflag) + return; + + gotTime = getNTfiletime(__G__ &Modft, &Accft, &Creft); + + /* open a handle to the file before processing extra fields; + we do this in case new security on file prevents us from updating + time stamps */ + hFile = CreateFile(Ansi_Fname, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + /* sfield@microsoft.com: set attributes before time in case we decide to + support other filetime members later. This also allows us to apply + attributes before the security is changed, which may prevent this + from succeeding otherwise. Also, since most files don't have + any interesting attributes, only change them if something other than + FILE_ATTRIBUTE_ARCHIVE appears in the attributes. This works well + as an optimization because FILE_ATTRIBUTE_ARCHIVE gets applied to the + file anyway, when it's created new. */ + if((G.pInfo->file_attr & 0x7F) & ~FILE_ATTRIBUTE_ARCHIVE) { + if (!SetFileAttributes(Ansi_Fname, G.pInfo->file_attr & 0x7F)) + Info(slide, 1, ((char *)slide, + "\nwarning (%d): could not set file attributes\n", + (int)GetLastError())); + } + +#ifdef NTSD_EAS + /* set extra fields, both stored-in-zipfile and .LONGNAME flavors */ + if (G.extra_field) { /* zipfile extra field may have extended attribs */ + int err = EvalExtraFields(__G__ G.filename, G.extra_field, + G.lrec.extra_field_length); + + if (err == IZ_EF_TRUNC) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + Info(slide, 1, ((char *)slide, LoadFarString(TruncNTSD), + makeword(G.extra_field+2)-10, uO.qflag? "\n":"")); + } + } +#endif /* NTSD_EAS */ + + if ( hFile == INVALID_HANDLE_VALUE ) + Info(slide, 1, ((char *)slide, + "\nCreateFile error %d when trying set file time\n", + (int)GetLastError())); + else { + if (gotTime) { + FILETIME *pModft = (gotTime & EB_UT_FL_MTIME) ? &Modft : NULL; + FILETIME *pAccft = (gotTime & EB_UT_FL_ATIME) ? &Accft : NULL; + FILETIME *pCreft = (gotTime & EB_UT_FL_CTIME) ? &Creft : NULL; + + if (!SetFileTime(hFile, pCreft, pAccft, pModft)) + Info(slide, 0, ((char *)slide, "\nSetFileTime failed: %d\n", + (int)GetLastError())); + } + CloseHandle(hFile); + } + + return; + +#undef Ansi_Fname + +} /* end function close_outfile() */ + + + + +#ifdef TIMESTAMP + +/*************************/ +/* Function stamp_file() */ +/*************************/ + +int stamp_file(__GPRO__ ZCONST char *fname, time_t modtime) +{ + FILETIME Modft; /* File time type defined in NT, `last modified' time */ + HANDLE hFile; /* File handle defined in NT */ + int errstat = 0; /* return status: 0 == "OK", -1 == "Failure" */ +#ifndef NT_TZBUG_WORKAROUND + time_t utime_dosmin; /* internal variable for UTIME_BOUNDCHECK_1 */ +#endif + int fs_uses_loctime = FStampIsLocTime(__G__ fname); +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_name = (char *)alloca(strlen(fname) + 1); + + INTERN_TO_ISO(fname, ansi_name); +# define Ansi_Fname ansi_name +#else +# define Ansi_Fname fname +#endif + + /* open a handle to the file to prepare setting the mod-time stamp */ + hFile = CreateFile(Ansi_Fname, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if ( hFile == INVALID_HANDLE_VALUE ) { + errstat = -1; + } else { + /* convert time_t modtime into WIN32 native 64bit format */ + UTIME_BOUNDCHECK_1(modtime) + utime2FileTime(modtime, &Modft); + NT_TZBUG_PRECOMPENSATE(modtime, &Modft) + /* set Access and Modification times of the file to modtime */ + if (!SetFileTime(hFile, NULL, &Modft, &Modft)) { + errstat = -1; + } + CloseHandle(hFile); + } + + return errstat; + +#undef Ansi_Fname +} /* end function stamp_file() */ + +#endif /* TIMESTAMP */ + + + + +/***********************/ +/* Function isfloppy() */ /* more precisely, is it removable? */ +/***********************/ + +static int isfloppy(int nDrive) /* 1 == A:, 2 == B:, etc. */ +{ + char rootPathName[4]; + + rootPathName[0] = (char)('A' + nDrive - 1); /* build the root path */ + rootPathName[1] = ':'; /* name, e.g. "A:/" */ + rootPathName[2] = '/'; + rootPathName[3] = '\0'; + + return (GetDriveType(rootPathName) == DRIVE_REMOVABLE); + +} /* end function isfloppy() */ + + + + +/*****************************/ +/* Function NTQueryVolInfo() */ +/*****************************/ + +/* + * Note: 8.3 limits on filenames apply only to old-style FAT filesystems. + * More recent versions of Windows (Windows NT 3.5 / Windows 4.0) + * can support long filenames (LFN) on FAT filesystems. Check the + * filesystem maximum component length field to detect LFN support. + */ + +static int NTQueryVolInfo(__GPRO__ const char *name) +{ + /* static char lastRootPath[4] = ""; */ + /* static int lastVolOldFAT; */ + /* static int lastVolLocTim; */ + char *tmp0; + char tmp1[MAX_PATH], tmp2[MAX_PATH]; + unsigned volSerNo, maxCompLen, fileSysFlags; +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_name = (char *)alloca(strlen(name) + 1); + + INTERN_TO_ISO(name, ansi_name); + name = ansi_name; +#endif + + if ((!strncmp(name, "//", 2) || !strncmp(name,"\\\\", 2)) && + (name[2] != '\0' && name[2] != '/' && name[2] != '\\')) { + /* GetFullPathname() and GetVolumeInformation() do not work + * on UNC names. For now, we return "error". + * **FIXME**: check if UNC name is mapped to a drive letter + * and use mapped drive for volume info query. + */ + return FALSE; + } + if (isalpha((uch)name[0]) && (name[1] == ':')) + tmp0 = (char *)name; + else + { + if (!GetFullPathName(name, MAX_PATH, tmp1, &tmp0)) + return FALSE; + tmp0 = &tmp1[0]; + } + if (strncmp(G.lastRootPath, tmp0, 2) != 0) { + /* For speed, we skip repeated queries for the same device */ + strncpy(G.lastRootPath, tmp0, 2); /* Build the root path name, */ + G.lastRootPath[2] = '/'; /* e.g. "A:/" */ + G.lastRootPath[3] = '\0'; + + if (!GetVolumeInformation((LPCTSTR)G.lastRootPath, + (LPTSTR)tmp1, (DWORD)MAX_PATH, + (LPDWORD)&volSerNo, (LPDWORD)&maxCompLen, + (LPDWORD)&fileSysFlags, (LPTSTR)tmp2, (DWORD)MAX_PATH)) { + G.lastRootPath[0] = '\0'; + return FALSE; + } + + /* LFNs are available if the component length is > 12 */ + G.lastVolOldFAT = (maxCompLen <= 12); +/* G.lastVolOldFAT = !strncmp(strupr(tmp2), "FAT", 3); old version */ + + /* Volumes in (V)FAT and (OS/2) HPFS format store file timestamps in + * local time! + */ + G.lastVolLocTim = !strncmp(strupr(tmp2), "VFAT", 4) || + !strncmp(tmp2, "HPFS", 4) || + !strncmp(tmp2, "FAT", 3); + } + + return TRUE; + +} /* end function NTQueryVolInfo() */ + + + + +/*****************************/ +/* Function IsVolumeOldFAT() */ +/*****************************/ + +static int IsVolumeOldFAT(__GPRO__ const char *name) +{ + return (NTQueryVolInfo(__G__ name) ? G.lastVolOldFAT : FALSE); +} + + + + +#ifndef SFX + +/************************/ +/* Function do_wild() */ /* identical to OS/2 version */ +/************************/ + +char *do_wild(__G__ wildspec) + __GDEF + char *wildspec; /* only used first time on a given dir */ +{ + /* static zDIR *wild_dir = NULL; */ + /* static char *dirname, *wildname, matchname[FILNAMSIZ]; */ + /* static int firstcall=TRUE, have_dirname, dirnamelen; */ + char *fnamestart; + struct zdirent *file; + + /* Even when we're just returning wildspec, we *always* do so in + * matchname[]--calling routine is allowed to append four characters + * to the returned string, and wildspec may be a pointer to argv[]. + */ + if (!G.notfirstcall) { /* first call: must initialize everything */ + G.notfirstcall = TRUE; + + if (!iswild(wildspec)) { + strcpy(G.matchname, wildspec); + G.have_dirname = FALSE; + G.wild_dir = NULL; + return G.matchname; + } + + /* break the wildspec into a directory part and a wildcard filename */ + if ((G.wildname = strrchr(wildspec, '/')) == NULL && + (G.wildname = strrchr(wildspec, ':')) == NULL) { + G.dirname = "."; + G.dirnamelen = 1; + G.have_dirname = FALSE; + G.wildname = wildspec; + } else { + ++G.wildname; /* point at character after '/' or ':' */ + G.dirnamelen = G.wildname - wildspec; + if ((G.dirname = (char *)malloc(G.dirnamelen+1)) == NULL) { + Info(slide, 1, ((char *)slide, + "warning: cannot allocate wildcard buffers\n")); + strcpy(G.matchname, wildspec); + return G.matchname; /* but maybe filespec was not a wildcard */ + } + strncpy(G.dirname, wildspec, G.dirnamelen); + G.dirname[G.dirnamelen] = '\0'; /* terminate for strcpy below */ + G.have_dirname = TRUE; + } + Trace((stderr, "do_wild: dirname = [%s]\n", G.dirname)); + + if ((G.wild_dir = (zvoid *)Opendir(G.dirname)) != NULL) { + if (G.have_dirname) { + strcpy(G.matchname, G.dirname); + fnamestart = G.matchname + G.dirnamelen; + } else + fnamestart = G.matchname; + while ((file = Readdir((zDIR *)G.wild_dir)) != NULL) { + Trace((stderr, "do_wild: Readdir returns %s\n", file->d_name)); + strcpy(fnamestart, file->d_name); + if (strrchr(fnamestart, '.') == (char *)NULL) + strcat(fnamestart, "."); + if (match(fnamestart, G.wildname, 1) && /* 1 == ignore case */ + /* skip "." and ".." directory entries */ + strcmp(fnamestart, ".") && strcmp(fnamestart, "..")) { + Trace((stderr, "do_wild: match() succeeds\n")); + /* remove trailing dot */ + fnamestart += strlen(fnamestart) - 1; + if (*fnamestart == '.') + *fnamestart = '\0'; + return G.matchname; + } + } + /* if we get to here directory is exhausted, so close it */ + Closedir((zDIR *)G.wild_dir); + G.wild_dir = NULL; + } + Trace((stderr, "do_wild: Opendir(%s) returns NULL\n", G.dirname)); + + /* return the raw wildspec in case that works (e.g., directory not + * searchable, but filespec was not wild and file is readable) */ + strcpy(G.matchname, wildspec); + return G.matchname; + } + + /* last time through, might have failed opendir but returned raw wildspec */ + if (G.wild_dir == NULL) { + G.notfirstcall = FALSE; /* reset for new wildspec */ + if (G.have_dirname) + free(G.dirname); + return (char *)NULL; + } + + /* If we've gotten this far, we've read and matched at least one entry + * successfully (in a previous call), so dirname has been copied into + * matchname already. + */ + if (G.have_dirname) { + /* strcpy(G.matchname, G.dirname); */ + fnamestart = G.matchname + G.dirnamelen; + } else + fnamestart = G.matchname; + while ((file = Readdir((zDIR *)G.wild_dir)) != NULL) { + Trace((stderr, "do_wild: readdir returns %s\n", file->d_name)); + strcpy(fnamestart, file->d_name); + if (strrchr(fnamestart, '.') == (char *)NULL) + strcat(fnamestart, "."); + if (match(fnamestart, G.wildname, 1)) { /* 1 == ignore case */ + Trace((stderr, "do_wild: match() succeeds\n")); + /* remove trailing dot */ + fnamestart += strlen(fnamestart) - 1; + if (*fnamestart == '.') + *fnamestart = '\0'; + return G.matchname; + } + } + + Closedir((zDIR *)G.wild_dir); /* at least one entry read; nothing left */ + G.wild_dir = NULL; + G.notfirstcall = FALSE; /* reset for new wildspec */ + if (G.have_dirname) + free(G.dirname); + return (char *)NULL; + +} /* end function do_wild() */ + +#endif /* !SFX */ + + + +/**********************/ +/* Function mapattr() */ +/**********************/ + +/* Identical to MS-DOS, OS/2 versions. However, NT has a lot of extra + * permission stuff, so this function should probably be extended in the + * future. */ + +int mapattr(__G) + __GDEF +{ + /* set archive bit for file entries (file is not backed up): */ + G.pInfo->file_attr = ((unsigned)G.crec.external_file_attributes | + (G.crec.external_file_attributes & FILE_ATTRIBUTE_DIRECTORY ? + 0 : FILE_ATTRIBUTE_ARCHIVE)) & 0xff; + return 0; + +} /* end function mapattr() */ + + + + +/************************/ +/* Function mapname() */ +/************************/ + /* return 0 if no error, 1 if caution (filename */ +int mapname(__G__ renamed) /* truncated), 2 if warning (skip file because */ + __GDEF /* dir doesn't exist), 3 if error (skip file), */ + int renamed; /* or 10 if out of memory (skip file) */ +{ /* [also IZ_VOL_LABEL, IZ_CREATED_DIR] */ + char pathcomp[FILNAMSIZ]; /* path-component buffer */ + char *pp, *cp=NULL; /* character pointers */ + char *lastsemi = NULL; /* pointer to last semi-colon in pathcomp */ + int error; + register unsigned workch; /* hold the character being tested */ + + +/*--------------------------------------------------------------------------- + Initialize various pointers and counters and stuff. + ---------------------------------------------------------------------------*/ + + /* can create path as long as not just freshening, or if user told us */ + G.create_dirs = (!uO.fflag || renamed); + + G.created_dir = FALSE; /* not yet */ + G.renamed_fullpath = FALSE; + G.fnlen = strlen(G.filename); + + if (renamed) { + cp = G.filename - 1; /* point to beginning of renamed name... */ + while (*++cp) + if (*cp == '\\') /* convert backslashes to forward */ + *cp = '/'; + cp = G.filename; + /* use temporary rootpath if user gave full pathname */ + if (G.filename[0] == '/') { + G.renamed_fullpath = TRUE; + pathcomp[0] = '/'; /* copy the '/' and terminate */ + pathcomp[1] = '\0'; + ++cp; + } else if (isalpha((uch)G.filename[0]) && G.filename[1] == ':') { + G.renamed_fullpath = TRUE; + pp = pathcomp; + *pp++ = *cp++; /* copy the "d:" (+ '/', possibly) */ + *pp++ = *cp++; + if (*cp == '/') + *pp++ = *cp++; /* otherwise add "./"? */ + *pp = '\0'; + } + } + + /* pathcomp is ignored unless renamed_fullpath is TRUE: */ + if ((error = checkdir(__G__ pathcomp, INIT)) != 0) /* init path buffer */ + return error; /* ...unless no mem or vol label on hard disk */ + + *pathcomp = '\0'; /* initialize translation buffer */ + pp = pathcomp; /* point to translation buffer */ + if (!renamed) { /* cp already set if renamed */ + if (uO.jflag) /* junking directories */ + cp = (char *)strrchr(G.filename, '/'); + if (cp == NULL) /* no '/' or not junking dirs */ + cp = G.filename; /* point to internal zipfile-member pathname */ + else + ++cp; /* point to start of last component of path */ + } + +/*--------------------------------------------------------------------------- + Begin main loop through characters in filename. + ---------------------------------------------------------------------------*/ + + while ((workch = (uch)*cp++) != 0) { + + switch (workch) { + case '/': /* can assume -j flag not given */ + *pp = '\0'; + if ((error = checkdir(__G__ pathcomp, APPEND_DIR)) > 1) + return error; + pp = pathcomp; /* reset conversion buffer for next piece */ + lastsemi = NULL; /* leave directory semi-colons alone */ + break; + + case ':': /* drive names not stored in zipfile, */ + case '<': /* so no colons allowed */ + case '>': /* no redirection symbols allowed either */ + case '|': /* no pipe signs allowed */ + case '"': /* no double quotes allowed */ + case '?': /* no wildcards allowed */ + case '*': + *pp++ = '_'; /* these rules apply equally to FAT and NTFS */ + break; + case ';': /* start of VMS version? */ + lastsemi = pp; /* remove VMS version later... */ + *pp++ = ';'; /* but keep semicolon for now */ + break; + + case ' ': /* keep spaces unless specifically */ + /* NT cannot create filenames with spaces on FAT volumes */ + if (uO.sflag || IsVolumeOldFAT(__G__ G.filename)) + *pp++ = '_'; + else + *pp++ = ' '; + break; + + default: + /* allow European characters in filenames: */ + if (isprint(workch) || workch >= 127) + *pp++ = (char)workch; + } /* end switch */ + } /* end while loop */ + + *pp = '\0'; /* done with pathcomp: terminate it */ + + /* if not saving them, remove VMS version numbers (appended "###") */ + if (!uO.V_flag && lastsemi) { + pp = lastsemi + 1; /* semi-colon was kept: expect #'s after */ + while (isdigit((uch)(*pp))) + ++pp; + if (*pp == '\0') /* only digits between ';' and end: nuke */ + *lastsemi = '\0'; + } + +/*--------------------------------------------------------------------------- + Report if directory was created (and no file to create: filename ended + in '/'), check name to be sure it exists, and combine path and name be- + fore exiting. + ---------------------------------------------------------------------------*/ + + if (G.filename[G.fnlen-1] == '/') { + checkdir(__G__ G.filename, GETPATH); + if (G.created_dir) { +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_name = (char *)alloca(strlen(G.filename) + 1); + + INTERN_TO_ISO(G.filename, ansi_name); +# define Ansi_Fname ansi_name +#else +# define Ansi_Fname G.filename +#endif + if (QCOND2) { + Info(slide, 0, ((char *)slide, " creating: %-22s\n", + FnFilter1(G.filename))); + } + + /* set file attributes: + The default for newly created directories is "DIR attribute + flags set", so there is no need to change attributes unless + one of the DOS style attribute flags is set. The readonly + attribute need not be masked, since it does not prevent + modifications in the new directory. */ + if(G.pInfo->file_attr & (0x7F & ~FILE_ATTRIBUTE_DIRECTORY)) { + if (!SetFileAttributes(Ansi_Fname, G.pInfo->file_attr & 0x7F)) + Info(slide, 1, ((char *)slide, + "\nwarning (%d): could not set file attributes for %s\n", + (int)GetLastError(), G.filename)); + } + +#ifdef NTSD_EAS + /* set extra fields, both stored-in-zipfile and .LONGNAME flavors */ + if (G.extra_field) { /* zipfile e.f. may have extended attribs */ + int err = EvalExtraFields(__G__ G.filename, G.extra_field, + G.lrec.extra_field_length); + + if (err == IZ_EF_TRUNC) { + if (uO.qflag) + Info(slide, 1, ((char *)slide, "%-22s ", + FnFilter1(G.filename))); + Info(slide, 1, ((char *)slide, LoadFarString(TruncNTSD), + makeword(G.extra_field+2)-10, uO.qflag? "\n":"")); + } + } +#endif /* NTSD_EAS */ + return IZ_CREATED_DIR; /* set dir time (note trailing '/') */ + } + return 2; /* dir existed already; don't look for data to extract */ + } + + if (*pathcomp == '\0') { + Info(slide, 1, ((char *)slide, "mapname: conversion of %s failed\n", + FnFilter1(G.filename))); + return 3; + } + + checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */ + checkdir(__G__ G.filename, GETPATH); + Trace((stderr, "mapname returns with filename = [%s] (error = %d)\n\n", + FnFilter1(G.filename), error)); + + if (G.pInfo->vollabel) { /* set the volume label now */ + char drive[4]; +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_name = (char *)alloca(strlen(G.filename) + 1); + INTERN_TO_ISO(G.filename, ansi_name); +# define Ansi_Fname ansi_name +#else +# define Ansi_Fname G.filename +#endif + + /* Build a drive string, e.g. "b:" */ + drive[0] = (char)('a' + G.nLabelDrive - 1); + strcpy(drive + 1, ":\\"); + if (QCOND2) + Info(slide, 0, ((char *)slide, "labelling %s %-22s\n", drive, + FnFilter1(G.filename))); + if (!SetVolumeLabel(drive, Ansi_Fname)) { + Info(slide, 1, ((char *)slide, + "mapname: error setting volume label\n")); + return 3; + } + return 2; /* success: skip the "extraction" quietly */ +#undef Ansi_Fname + } + + return error; + +} /* end function mapname() */ + + + + +/**********************/ +/* Function map2fat() */ /* Not quite identical to OS/2 version */ +/**********************/ + +static void map2fat(pathcomp, pEndFAT) + char *pathcomp, **pEndFAT; +{ + char *ppc = pathcomp; /* variable pointer to pathcomp */ + char *pEnd = *pEndFAT; /* variable pointer to buildpathFAT */ + char *pBegin = *pEndFAT; /* constant pointer to start of this comp. */ + char *last_dot = NULL; /* last dot not converted to underscore */ + int dotname = FALSE; /* flag: path component begins with dot */ + /* ("." and ".." don't count) */ + register unsigned workch; /* hold the character being tested */ + + + /* Only need check those characters which are legal in NTFS but not + * in FAT: to get here, must already have passed through mapname. + * Also must truncate path component to ensure 8.3 compliance. + */ + while ((workch = (uch)*ppc++) != 0) { + switch (workch) { + case '[': + case ']': + case '+': + case ',': + case ';': + case '=': + *pEnd++ = '_'; /* convert brackets to underscores */ + break; + + case '.': + if (pEnd == *pEndFAT) { /* nothing appended yet... */ + if (*ppc == '\0') /* don't bother appending a */ + break; /* "./" component to the path */ + else if (*ppc == '.' && ppc[1] == '\0') { /* "../" */ + *pEnd++ = '.'; /* add first dot, unchanged... */ + ++ppc; /* skip second dot, since it will */ + } else { /* be "added" at end of if-block */ + *pEnd++ = '_'; /* FAT doesn't allow null filename */ + dotname = TRUE; /* bodies, so map .exrc -> _.exrc */ + } /* (extra '_' now, "dot" below) */ + } else if (dotname) { /* found a second dot, but still */ + dotname = FALSE; /* have extra leading underscore: */ + *pEnd = '\0'; /* remove it by shifting chars */ + pEnd = *pEndFAT + 1; /* left one space (e.g., .p1.p2: */ + while (pEnd[1]) { /* __p1 -> _p1_p2 -> _p1.p2 when */ + *pEnd = pEnd[1]; /* finished) [opt.: since first */ + ++pEnd; /* two chars are same, can start */ + } /* shifting at second position] */ + } + last_dot = pEnd; /* point at last dot so far... */ + *pEnd++ = '_'; /* convert dot to underscore for now */ + break; + + default: + *pEnd++ = (char)workch; + + } /* end switch */ + } /* end while loop */ + + *pEnd = '\0'; /* terminate buildpathFAT */ + + /* NOTE: keep in mind that pEnd points to the end of the path + * component, and *pEndFAT still points to the *beginning* of it... + * Also note that the algorithm does not try to get too fancy: + * if there are no dots already, the name either gets truncated + * at 8 characters or the last underscore is converted to a dot + * (only if more characters are saved that way). In no case is + * a dot inserted between existing characters. + */ + if (last_dot == NULL) { /* no dots: check for underscores... */ + char *plu = strrchr(pBegin, '_'); /* pointer to last underscore */ + + if (plu == NULL) { /* no dots, no underscores: truncate at 8 chars */ + *pEndFAT += 8; /* (or could insert '.' and keep 11...?) */ + if (*pEndFAT > pEnd) + *pEndFAT = pEnd; /* oops...didn't have 8 chars to truncate */ + else + **pEndFAT = '\0'; + } else if (MIN(plu - pBegin, 8) + MIN(pEnd - plu - 1, 3) > 8) { + last_dot = plu; /* be lazy: drop through to next if-blk */ + } else if ((pEnd - *pEndFAT) > 8) { + *pEndFAT += 8; /* more fits into just basename than if */ + **pEndFAT = '\0'; /* convert last underscore to dot */ + } else + *pEndFAT = pEnd; /* whole thing fits into 8 chars or less */ + } + + if (last_dot != NULL) { /* one dot (or two, in the case of */ + *last_dot = '.'; /* "..") is OK: put it back in */ + + if ((last_dot - pBegin) > 8) { + char *p, *q; + int i; + + p = last_dot; + q = last_dot = pBegin + 8; + for (i = 0; (i < 4) && *p; ++i) /* too many chars in basename: */ + *q++ = *p++; /* shift .ext left and trun- */ + *q = '\0'; /* cate/terminate it */ + *pEndFAT = q; + } else if ((pEnd - last_dot) > 4) { /* too many chars in extension */ + *pEndFAT = last_dot + 4; + **pEndFAT = '\0'; + } else + *pEndFAT = pEnd; /* filename is fine; point at terminating zero */ + + if ((last_dot - pBegin) > 0 && last_dot[-1] == ' ') + last_dot[-1] = '_'; /* NO blank in front of '.'! */ + } +} /* end function map2fat() */ + + + + +/***********************/ /* Borrowed from os2.c for UnZip 5.1. */ +/* Function checkdir() */ /* Difference: no EA stuff */ +/***********************/ /* HPFS stuff works on NTFS too */ + +int checkdir(__G__ pathcomp, flag) + __GDEF + char *pathcomp; + int flag; +/* + * returns: 1 - (on APPEND_NAME) truncated filename + * 2 - path doesn't exist, not allowed to create + * 3 - path doesn't exist, tried to create and failed; or + * path exists and is not a directory, but is supposed to be + * 4 - path is too long + * 10 - can't allocate memory for filename buffers + */ +{ + /* static int rootlen = 0; */ /* length of rootpath */ + /* static char *rootpath; */ /* user's "extract-to" directory */ + /* static char *buildpathHPFS; */ /* full path (so far) to extracted file, */ + /* static char *buildpathFAT; */ /* both HPFS/EA (main) and FAT versions */ + /* static char *endHPFS; */ /* corresponding pointers to end of */ + /* static char *endFAT; */ /* buildpath ('\0') */ + +# define FN_MASK 7 +# define FUNCTION (flag & FN_MASK) + + + +/*--------------------------------------------------------------------------- + APPEND_DIR: append the path component to the path being built and check + for its existence. If doesn't exist and we are creating directories, do + so for this one; else signal success or error as appropriate. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_DIR) { + char *p = pathcomp; + int too_long=FALSE; + + Trace((stderr, "appending dir segment [%s]\n", pathcomp)); + while ((*G.endHPFS = *p++) != '\0') /* copy to HPFS filename */ + ++G.endHPFS; + if (!IsVolumeOldFAT(__G__ G.buildpathHPFS)) { + p = pathcomp; + while ((*G.endFAT = *p++) != '\0') /* copy to FAT filename, too */ + ++G.endFAT; + } else + map2fat(pathcomp, &G.endFAT); /* map into FAT fn, update endFAT */ + + /* GRR: could do better check, see if overrunning buffer as we go: + * check endHPFS-buildpathHPFS after each append, set warning variable + * if within 20 of FILNAMSIZ; then if var set, do careful check when + * appending. Clear variable when begin new path. */ + + /* next check: need to append '/', at least one-char name, '\0' */ + if ((G.endHPFS-G.buildpathHPFS) > FILNAMSIZ-3) + too_long = TRUE; /* check if extracting dir? */ +#ifdef FIX_STAT_BUG + /* Borland C++ 5.0 does not handle a call to stat() well if the + * directory does not exist (it tends to crash in strange places.) + * This is apparently a problem only when compiling for GUI rather + * than console. The code below attempts to work around this problem. + */ + if (access(G.buildpathFAT, 0) != 0) { + if (!G.create_dirs) { /* told not to create (freshening) */ + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 2; /* path doesn't exist: nothing to do */ + } + if (too_long) { /* GRR: should allow FAT extraction w/o EAs */ + Info(slide, 1, ((char *)slide, + "checkdir error: path too long: %s\n", + FnFilter1(G.buildpathHPFS))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 4; /* no room for filenames: fatal */ + } + if (MKDIR(G.buildpathFAT, 0777) == -1) { /* create the directory */ + Info(slide, 1, ((char *)slide, + "checkdir error: cannot create %s\n\ + unable to process %s.\n", + FnFilter2(G.buildpathFAT), FnFilter1(G.filename))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 3; /* path didn't exist, tried to create, failed */ + } + G.created_dir = TRUE; + } +#endif /* FIX_STAT_BUG */ + if (SSTAT(G.buildpathFAT, &G.statbuf)) /* path doesn't exist */ + { + if (!G.create_dirs) { /* told not to create (freshening) */ + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 2; /* path doesn't exist: nothing to do */ + } + if (too_long) { /* GRR: should allow FAT extraction w/o EAs */ + Info(slide, 1, ((char *)slide, + "checkdir error: path too long: %s\n", + FnFilter1(G.buildpathHPFS))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 4; /* no room for filenames: fatal */ + } + if (MKDIR(G.buildpathFAT, 0777) == -1) { /* create the directory */ + Info(slide, 1, ((char *)slide, + "checkdir error: cannot create %s\n\ + unable to process %s.\n", + FnFilter2(G.buildpathFAT), FnFilter1(G.filename))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 3; /* path didn't exist, tried to create, failed */ + } + G.created_dir = TRUE; + } else if (!S_ISDIR(G.statbuf.st_mode)) { + Info(slide, 1, ((char *)slide, + "checkdir error: %s exists but is not directory\n \ + unable to process %s.\n", + FnFilter2(G.buildpathFAT), FnFilter1(G.filename))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 3; /* path existed but wasn't dir */ + } + if (too_long) { + Info(slide, 1, ((char *)slide, + "checkdir error: path too long: %s\n", + FnFilter1(G.buildpathHPFS))); + free(G.buildpathHPFS); + free(G.buildpathFAT); + return 4; /* no room for filenames: fatal */ + } + *G.endHPFS++ = '/'; + *G.endFAT++ = '/'; + *G.endHPFS = *G.endFAT = '\0'; + Trace((stderr, "buildpathHPFS now = [%s]\nbuildpathFAT now = [%s]\n", + FnFilter1(G.buildpathHPFS), FnFilter2(G.buildpathFAT))); + return 0; + + } /* end if (FUNCTION == APPEND_DIR) */ + +/*--------------------------------------------------------------------------- + GETPATH: copy full FAT path to the string pointed at by pathcomp (want + filename to reflect name used on disk, not EAs; if full path is HPFS, + buildpathFAT and buildpathHPFS will be identical). Also free both paths. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == GETPATH) { + Trace((stderr, "getting and freeing FAT path [%s]\n", + FnFilter1(G.buildpathFAT))); + Trace((stderr, "freeing HPFS path [%s]\n", + FnFilter1(G.buildpathHPFS))); + strcpy(pathcomp, G.buildpathFAT); + free(G.buildpathFAT); + free(G.buildpathHPFS); + G.buildpathHPFS = G.buildpathFAT = G.endHPFS = G.endFAT = NULL; + return 0; + } + +/*--------------------------------------------------------------------------- + APPEND_NAME: assume the path component is the filename; append it and + return without checking for existence. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == APPEND_NAME) { + char *p = pathcomp; + int error = 0; + + Trace((stderr, "appending filename [%s]\n", FnFilter1(pathcomp))); + while ((*G.endHPFS = *p++) != '\0') { /* copy to HPFS filename */ + ++G.endHPFS; + if ((G.endHPFS-G.buildpathHPFS) >= FILNAMSIZ) { + *--G.endHPFS = '\0'; + Info(slide, 1, ((char *)slide, + "checkdir warning: path too long; truncating\n \ + %s\n -> %s\n", + FnFilter1(G.filename), FnFilter2(G.buildpathHPFS))); + error = 1; /* filename truncated */ + } + } + + if ( G.pInfo->vollabel || !IsVolumeOldFAT(__G__ G.buildpathHPFS)) { + p = pathcomp; + while ((*G.endFAT = *p++) != '\0') /* copy to FAT filename, too */ + ++G.endFAT; + } else + map2fat(pathcomp, &G.endFAT); /* map into FAT fn, update endFAT */ + Trace((stderr, "buildpathHPFS: %s\nbuildpathFAT: %s\n", + FnFilter1(G.buildpathHPFS), FnFilter2(G.buildpathFAT))); + + return error; /* could check for existence, prompt for new name... */ + + } /* end if (FUNCTION == APPEND_NAME) */ + +/*--------------------------------------------------------------------------- + INIT: allocate and initialize buffer space for the file currently being + extracted. If file was renamed with an absolute path, don't prepend the + extract-to path. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == INIT) { + Trace((stderr, "initializing buildpathHPFS and buildpathFAT to ")); + if ((G.buildpathHPFS = (char *)malloc(G.fnlen+G.rootlen+1)) == NULL) + return 10; + if ((G.buildpathFAT = (char *)malloc(G.fnlen+G.rootlen+1)) == NULL) { + free(G.buildpathHPFS); + return 10; + } + if (G.pInfo->vollabel) { /* use root or renamed path, but don't store */ +/* GRR: for network drives, do strchr() and return IZ_VOL_LABEL if not [1] */ + if (G.renamed_fullpath && pathcomp[1] == ':') + *G.buildpathHPFS = (char)ToLower(*pathcomp); + else if (!G.renamed_fullpath && G.rootlen > 1 && + G.rootpath[1] == ':') + *G.buildpathHPFS = (char)ToLower(*G.rootpath); + else { + char tmpN[MAX_PATH], *tmpP; + if (GetFullPathName(".", MAX_PATH, tmpN, &tmpP) > MAX_PATH) + { /* by definition of MAX_PATH we should never get here */ + Info(slide, 1, ((char *)slide, + "checkdir warning: current dir path too long\n")); + return 1; /* can't get drive letter */ + } + G.nLabelDrive = *tmpN - 'a' + 1; + *G.buildpathHPFS = (char)(G.nLabelDrive - 1 + 'a'); + } + G.nLabelDrive = *G.buildpathHPFS - 'a' + 1; /* save for mapname() */ + if (uO.volflag == 0 || *G.buildpathHPFS < 'a' /* no labels/bogus? */ + || (uO.volflag == 1 && !isfloppy(G.nLabelDrive))) { /* !fixed */ + free(G.buildpathHPFS); + free(G.buildpathFAT); + return IZ_VOL_LABEL; /* skipping with message */ + } + *G.buildpathHPFS = '\0'; + } else if (G.renamed_fullpath) /* pathcomp = valid data */ + strcpy(G.buildpathHPFS, pathcomp); + else if (G.rootlen > 0) + strcpy(G.buildpathHPFS, G.rootpath); + else + *G.buildpathHPFS = '\0'; + G.endHPFS = G.buildpathHPFS; + G.endFAT = G.buildpathFAT; + while ((*G.endFAT = *G.endHPFS) != '\0') { + ++G.endFAT; + ++G.endHPFS; + } + Trace((stderr, "[%s]\n", FnFilter1(G.buildpathHPFS))); + return 0; + } + +/*--------------------------------------------------------------------------- + ROOT: if appropriate, store the path in rootpath and create it if neces- + sary; else assume it's a zipfile member and return. This path segment + gets used in extracting all members from every zipfile specified on the + command line. Note that under OS/2 and MS-DOS, if a candidate extract-to + directory specification includes a drive letter (leading "x:"), it is + treated just as if it had a trailing '/'--that is, one directory level + will be created if the path doesn't exist, unless this is otherwise pro- + hibited (e.g., freshening). + ---------------------------------------------------------------------------*/ + +#if (!defined(SFX) || defined(SFX_EXDIR)) + if (FUNCTION == ROOT) { + Trace((stderr, "initializing root path to [%s]\n", + FnFilter1(pathcomp))); + if (pathcomp == NULL) { + G.rootlen = 0; + return 0; + } + if ((G.rootlen = strlen(pathcomp)) > 0) { + int had_trailing_pathsep=FALSE, has_drive=FALSE, xtra=2; + + if (isalpha((uch)pathcomp[0]) && pathcomp[1] == ':') + has_drive = TRUE; /* drive designator */ + if (pathcomp[G.rootlen-1] == '/' || pathcomp[G.rootlen-1] == '\\') { + pathcomp[--G.rootlen] = '\0'; + had_trailing_pathsep = TRUE; + } + if (has_drive && (G.rootlen == 2)) { + if (!had_trailing_pathsep) /* i.e., original wasn't "x:/" */ + xtra = 3; /* room for '.' + '/' + 0 at end of "x:" */ + } else if (G.rootlen > 0) { /* need not check "x:." and "x:/" */ + if (SSTAT(pathcomp, &G.statbuf) || !S_ISDIR(G.statbuf.st_mode)) + { + /* path does not exist */ + if (!G.create_dirs /* || iswild(pathcomp) */ ) { + G.rootlen = 0; + return 2; /* treat as stored file */ + } + /* create directory (could add loop here to scan pathcomp + * and create more than one level, but really necessary?) */ + if (MKDIR(pathcomp, 0777) == -1) { + Info(slide, 1, ((char *)slide, + "checkdir: cannot create extraction directory: %s\n", + FnFilter1(pathcomp))); + G.rootlen = 0; /* path didn't exist, tried to create, */ + return 3; /* failed: file exists, or need 2+ levels */ + } + } + } + if ((G.rootpath = (char *)malloc(G.rootlen+xtra)) == NULL) { + G.rootlen = 0; + return 10; + } + strcpy(G.rootpath, pathcomp); + if (xtra == 3) /* had just "x:", make "x:." */ + G.rootpath[G.rootlen++] = '.'; + G.rootpath[G.rootlen++] = '/'; + G.rootpath[G.rootlen] = '\0'; + Trace((stderr, "rootpath now = [%s]\n", FnFilter1(G.rootpath))); + } + return 0; + } +#endif /* !SFX || SFX_EXDIR */ + +/*--------------------------------------------------------------------------- + END: free rootpath, immediately prior to program exit. + ---------------------------------------------------------------------------*/ + + if (FUNCTION == END) { + Trace((stderr, "freeing rootpath\n")); + if (G.rootlen > 0) { + free(G.rootpath); + G.rootlen = 0; + } + return 0; + } + + return 99; /* should never reach */ + +} /* end function checkdir() */ + + + + + +#ifndef SFX +#ifndef WINDLL + +/************************/ +/* Function version() */ +/************************/ + +void version(__G) + __GDEF +{ + int len; +#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__DJGPP__)) + char buf[80]; +#if (defined(_MSC_VER) && (_MSC_VER > 900)) + char buf2[80]; +#endif +#endif + + len = sprintf((char *)slide, CompiledWith, + +#if defined(_MSC_VER) /* MSC == VC++, but what about SDK compiler? */ + (sprintf(buf, "Microsoft C %d.%02d ", _MSC_VER/100, _MSC_VER%100), buf), +# if (_MSC_VER == 800) + "(Visual C++ v1.1)", +# elif (_MSC_VER == 850) + "(Windows NT v3.5 SDK)", +# elif (_MSC_VER == 900) + "(Visual C++ v2.x)", +# elif (_MSC_VER > 900) + (sprintf(buf2, "(Visual C++ %d.%d)", _MSC_VER/100 - 6, _MSC_VER%100/10), + buf2), +# else + "(bad version)", +# endif +#elif defined(__WATCOMC__) +# if (__WATCOMC__ % 10 > 0) + (sprintf(buf, "Watcom C/C++ %d.%02d", __WATCOMC__ / 100, + __WATCOMC__ % 100), buf), "", +# else + (sprintf(buf, "Watcom C/C++ %d.%d", __WATCOMC__ / 100, + (__WATCOMC__ % 100) / 10), buf), "", +# endif +#elif defined(__BORLANDC__) + "Borland C++", +# if (__BORLANDC__ < 0x0200) + " 1.0", +# elif (__BORLANDC__ == 0x0200) + " 2.0", +# elif (__BORLANDC__ == 0x0400) + " 3.0", +# elif (__BORLANDC__ == 0x0410) /* __BCPLUSPLUS__ = 0x0310 */ + " 3.1", +# elif (__BORLANDC__ == 0x0452) /* __BCPLUSPLUS__ = 0x0320 */ + " 4.0 or 4.02", +# elif (__BORLANDC__ == 0x0460) /* __BCPLUSPLUS__ = 0x0340 */ + " 4.5", +# elif (__BORLANDC__ == 0x0500) /* __BCPLUSPLUS__ = 0x0340 */ + " 5.0", +# elif (__BORLANDC__ == 0x0520) /* __BCPLUSPLUS__ = 0x0520 */ + " 5.2 (C++ Builder)", /* GRR: assume this will stay sync'd? */ +# else + " later than 5.2", +# endif +#elif defined(__LCC__) + "LCC-Win32", "", +#elif defined(__GNUC__) +# if defined(__RSXNT__) +# if (defined(__DJGPP__) && !defined(__EMX__)) + (sprintf(buf, "rsxnt(djgpp v%d.%02d) / gcc ", + __DJGPP__, __DJGPP_MINOR__), buf), +# elif defined(__DJGPP__) + (sprintf(buf, "rsxnt(emx+djgpp v%d.%02d) / gcc ", + __DJGPP__, __DJGPP_MINOR__), buf), +# elif (defined(__GO32__) && !defined(__EMX__)) + "rsxnt(djgpp v1.x) / gcc ", +# elif defined(__GO32__) + "rsxnt(emx + djgpp v1.x) / gcc ", +# elif defined(__EMX__) + "rsxnt(emx)+gcc ", +# else + "rsxnt(unknown) / gcc ", +# endif +# elif defined(__CYGWIN32__) + "cygnus win32 / gcc ", +# elif defined(__MINGW32__) + "mingw32 / gcc ", +# else + "gcc ", +# endif + __VERSION__, +#else /* !_MSC_VER, !__WATCOMC__, !__BORLANDC__, !__LCC__, !__GNUC__ */ + "unknown compiler (SDK?)", "", +#endif /* ?compilers */ + + "Windows 95 / Windows NT", "\n(32-bit)", + +#ifdef __DATE__ + " on ", __DATE__ +#else + "", "" +#endif + ); + + (*G.message)((zvoid *)&G, slide, (ulg)len, 0); + + return; + +} /* end function version() */ + +#endif /* !WINDLL */ +#endif /* !SFX */ + + + +#ifdef W32_STAT_BANDAID + +/* All currently known variants of WIN32 operating systems (Windows 95/98, + * WinNT 3.x, 4.0, 5.0) have a nasty bug in the OS kernel concerning + * conversions between UTC and local time: In the time conversion functions + * of the Win32 API, the timezone offset (including seasonal daylight saving + * shift) between UTC and local time evaluation is erratically based on the + * current system time. The correct evaluation must determine the offset + * value as it {was/is/will be} for the actual time to be converted. + * + * Some versions of MS C runtime lib's stat() returns utc time-stamps so + * that localtime(timestamp) corresponds to the (potentially false) local + * time shown by the OS' system programs (Explorer, command shell dir, etc.) + * The RSXNT port follows the same strategy, but fails to recognize the + * access-time attribute. + * + * For the NTFS file system (and other filesystems that store time-stamps + * as UTC values), this results in st_mtime (, st_{c|a}time) fields which + * are not stable but vary according to the seasonal change of "daylight + * saving time in effect / not in effect". + * + * Other C runtime libs (CygWin, or the CRT DLLs supplied with Win95/NT + * return the unix-time equivalent of the UTC FILETIME values as got back + * from the Win32 API call. This time, return values from NTFS are correct + * whereas utimes from files on (V)FAT volumes vary according to the DST + * switches. + * + * To achieve timestamp consistency of UTC (UT extra field) values in + * Zip archives, the Info-ZIP programs require work-around code for + * proper time handling in stat() (and other time handling routines). + */ +/* stat() functions under Windows95 tend to fail for root directories. * + * Watcom and Borland, at least, are affected by this bug. Watcom made * + * a partial fix for 11.0 but still missed some cases. This substitute * + * detects the case and fills in reasonable values. Otherwise we get * + * effects like failure to extract to a root dir because it's not found. */ + +int zstat_win32(__W32STAT_GLOBALS__ const char *path, struct stat *buf) +{ + if (!stat(path, buf)) + { +#ifdef NT_TZBUG_WORKAROUND + /* stat was successful, now redo the time-stamp fetches */ + int fs_uses_loctime = FStampIsLocTime(__G__ path); + HANDLE h; + FILETIME Modft, Accft, Creft; +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_path = (char *)alloca(strlen(path) + 1); + + INTERN_TO_ISO(path, ansi_path); +# define Ansi_Path ansi_path +#else +# define Ansi_Path path +#endif + + TTrace((stdout, "stat(%s) finds modtime %08lx\n", path, buf->st_mtime)); + h = CreateFile(Ansi_Path, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (h != INVALID_HANDLE_VALUE) { + BOOL ftOK = GetFileTime(h, &Creft, &Accft, &Modft); + CloseHandle(h); + + if (ftOK) { + FTTrace((stdout, "GetFileTime returned Modft", 0, &Modft)); + FTTrace((stdout, "GetFileTime returned Creft", 0, &Creft)); + if (!fs_uses_loctime) { + /* On a filesystem that stores UTC timestamps, we refill + * the time fields of the struct stat buffer by directly + * using the UTC values as returned by the Win32 + * GetFileTime() API call. + */ + FileTime2utime(&Modft, &(buf->st_mtime)); + if (Accft.dwLowDateTime != 0 || Accft.dwHighDateTime != 0) + FileTime2utime(&Accft, &(buf->st_atime)); + else + buf->st_atime = buf->st_mtime; + if (Creft.dwLowDateTime != 0 || Creft.dwHighDateTime != 0) + FileTime2utime(&Creft, &(buf->st_ctime)); + else + buf->st_ctime = buf->st_mtime; + TTrace((stdout,"NTFS, recalculated modtime %08lx\n", + buf->st_mtime)); + } else { + /* On VFAT and FAT-like filesystems, the FILETIME values + * are converted back to the stable local time before + * converting them to UTC unix time-stamps. + */ + VFatFileTime2utime(&Modft, &(buf->st_mtime)); + if (Accft.dwLowDateTime != 0 || Accft.dwHighDateTime != 0) + VFatFileTime2utime(&Accft, &(buf->st_atime)); + else + buf->st_atime = buf->st_mtime; + if (Creft.dwLowDateTime != 0 || Creft.dwHighDateTime != 0) + VFatFileTime2utime(&Creft, &(buf->st_ctime)); + else + buf->st_ctime = buf->st_mtime; + TTrace((stdout, "VFAT, recalculated modtime %08lx\n", + buf->st_mtime)); + } + } + } +# undef Ansi_Path +#endif /* NT_TZBUG_WORKAROUND */ + return 0; + } +#ifdef W32_STATROOT_FIX + else + { + DWORD flags; +#ifdef __RSXNT__ /* RSXNT/EMX C rtl uses OEM charset */ + char *ansi_path = (char *)alloca(strlen(path) + 1); + + INTERN_TO_ISO(path, ansi_path); +# define Ansi_Path ansi_path +#else +# define Ansi_Path path +#endif + + flags = GetFileAttributes(Ansi_Path); + if (flags != 0xFFFFFFFF && flags & FILE_ATTRIBUTE_DIRECTORY) { + Trace((stderr, "\nstat(\"%s\",...) failed on existing directory\n", + path)); + memset(buf, 0, sizeof(struct stat)); + buf->st_atime = buf->st_ctime = buf->st_mtime = + dos_to_unix_time(DOSTIME_MINIMUM); /* 1-1-80 */ + buf->st_mode = S_IFDIR | S_IREAD | + ((flags & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE); + return 0; + } /* assumes: stat() won't fail on non-dirs without good reason */ +# undef Ansi_Path + } +#endif /* W32_STATROOT_FIX */ + return -1; +} + +#endif /* W32_STAT_BANDAID */ + +#endif /* !FUNZIP */ + + + +#ifndef WINDLL +/* This replacement getch() function was originally created for Watcom C + * and then additionally used with CYGWIN. Since UnZip 5.4, all other Win32 + * ports apply this replacement rather that their supplied getch() (or + * alike) function. There are problems with unabsorbed LF characters left + * over in the keyboard buffer under Win95 (and 98) when ENTER was pressed. + * (Under Win95, ENTER returns two(!!) characters: CR-LF.) This problem + * does not appear when run on a WinNT console prompt! + */ + +/* Watcom 10.6's getch() does not handle Alt+<digit><digit><digit>. */ +/* Note that if PASSWD_FROM_STDIN is defined, the file containing */ +/* the password must have a carriage return after the word, not a */ +/* Unix-style newline (linefeed only). This discards linefeeds. */ + +int getch_win32(void) +{ + HANDLE stin; + DWORD rc; + unsigned char buf[2]; + int ret = -1; + DWORD odemode = ~(DWORD)0; + +# ifdef PASSWD_FROM_STDIN + stin = GetStdHandle(STD_INPUT_HANDLE); +# else + stin = CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + if (stin == INVALID_HANDLE_VALUE) + return -1; +# endif + if (GetConsoleMode(stin, &odemode)) + SetConsoleMode(stin, ENABLE_PROCESSED_INPUT); /* raw except ^C noticed */ + if (ReadFile(stin, &buf, 1, &rc, NULL) && rc == 1) + ret = buf[0]; + /* when the user hits return we get CR LF. We discard the LF, not the CR, + * because when we call this for the first time after a previous input + * such as the one for "replace foo? [y]es, ..." the LF may still be in + * the input stream before whatever the user types at our prompt. */ + if (ret == '\n') + if (ReadFile(stin, &buf, 1, &rc, NULL) && rc == 1) + ret = buf[0]; + if (odemode != ~(DWORD)0) + SetConsoleMode(stin, odemode); +# ifndef PASSWD_FROM_STDIN + CloseHandle(stin); +# endif + return ret; +} +#endif /* !WINDLL */ diff --git a/utils/Install/sfxzip/zipinfo.c b/utils/Install/sfxzip/zipinfo.c new file mode 100644 index 0000000000..c244c1e92f --- /dev/null +++ b/utils/Install/sfxzip/zipinfo.c @@ -0,0 +1,1912 @@ +/*--------------------------------------------------------------------------- + + zipinfo.c Greg Roelofs et al. + + This file contains all of the ZipInfo-specific listing routines for UnZip. + + Contains: zi_opts() + zi_end_central() + zipinfo() + zi_long() + zi_short() + zi_time() + + ---------------------------------------------------------------------------*/ + + +#define UNZIP_INTERNAL +#include "unzip.h" + + +#ifndef NO_ZIPINFO /* strings use up too much space in small-memory systems */ + +/* Define OS-specific attributes for use on ALL platforms--the S_xxxx + * versions of these are defined differently (or not defined) by different + * compilers and operating systems. */ + +#define UNX_IFMT 0170000 /* Unix file type mask */ +#define UNX_IFDIR 0040000 /* Unix directory */ +#define UNX_IFREG 0100000 /* Unix regular file */ +#define UNX_IFSOCK 0140000 /* Unix socket (BSD, not SysV or Amiga) */ +#define UNX_IFLNK 0120000 /* Unix symbolic link (not SysV, Amiga) */ +#define UNX_IFBLK 0060000 /* Unix block special (not Amiga) */ +#define UNX_IFCHR 0020000 /* Unix character special (not Amiga) */ +#define UNX_IFIFO 0010000 /* Unix fifo (BCC, not MSC or Amiga) */ +#define UNX_ISUID 04000 /* Unix set user id on execution */ +#define UNX_ISGID 02000 /* Unix set group id on execution */ +#define UNX_ISVTX 01000 /* Unix directory permissions control */ +#define UNX_ENFMT UNX_ISGID /* Unix record locking enforcement flag */ +#define UNX_IRWXU 00700 /* Unix read, write, execute: owner */ +#define UNX_IRUSR 00400 /* Unix read permission: owner */ +#define UNX_IWUSR 00200 /* Unix write permission: owner */ +#define UNX_IXUSR 00100 /* Unix execute permission: owner */ +#define UNX_IRWXG 00070 /* Unix read, write, execute: group */ +#define UNX_IRGRP 00040 /* Unix read permission: group */ +#define UNX_IWGRP 00020 /* Unix write permission: group */ +#define UNX_IXGRP 00010 /* Unix execute permission: group */ +#define UNX_IRWXO 00007 /* Unix read, write, execute: other */ +#define UNX_IROTH 00004 /* Unix read permission: other */ +#define UNX_IWOTH 00002 /* Unix write permission: other */ +#define UNX_IXOTH 00001 /* Unix execute permission: other */ + +#define VMS_IRUSR UNX_IRUSR /* VMS read/owner */ +#define VMS_IWUSR UNX_IWUSR /* VMS write/owner */ +#define VMS_IXUSR UNX_IXUSR /* VMS execute/owner */ +#define VMS_IRGRP UNX_IRGRP /* VMS read/group */ +#define VMS_IWGRP UNX_IWGRP /* VMS write/group */ +#define VMS_IXGRP UNX_IXGRP /* VMS execute/group */ +#define VMS_IROTH UNX_IROTH /* VMS read/other */ +#define VMS_IWOTH UNX_IWOTH /* VMS write/other */ +#define VMS_IXOTH UNX_IXOTH /* VMS execute/other */ + +#define AMI_IFMT 06000 /* Amiga file type mask */ +#define AMI_IFDIR 04000 /* Amiga directory */ +#define AMI_IFREG 02000 /* Amiga regular file */ +#define AMI_IHIDDEN 00200 /* to be supported in AmigaDOS 3.x */ +#define AMI_ISCRIPT 00100 /* executable script (text command file) */ +#define AMI_IPURE 00040 /* allow loading into resident memory */ +#define AMI_IARCHIVE 00020 /* not modified since bit was last set */ +#define AMI_IREAD 00010 /* can be opened for reading */ +#define AMI_IWRITE 00004 /* can be opened for writing */ +#define AMI_IEXECUTE 00002 /* executable image, a loadable runfile */ +#define AMI_IDELETE 00001 /* can be deleted */ + +#define LFLAG 3 /* short "ls -l" type listing */ + +static int zi_long OF((__GPRO__ ulg *pEndprev)); +static int zi_short OF((__GPRO)); +static void zi_showMacTypeCreator + OF((__GPRO__ uch *ebfield)); +static char *zi_time OF((__GPRO__ ZCONST ulg *datetimez, + ZCONST time_t *modtimez, char *d_t_str)); + + +/**********************************************/ +/* Strings used in zipinfo.c (ZipInfo half) */ +/**********************************************/ + +static char nullStr[] = ""; + +static ZCONST char Far LongHeader[] = "Archive: %s %ld bytes %d file%s\n"; +static ZCONST char Far ShortHeader[] = "Archive: %s %ld %d\n"; +static ZCONST char Far EndCentDirRec[] = "\nEnd-of-central-directory record:\n"; +static ZCONST char Far LineSeparators[] = "-------------------------------\n\n"; +static ZCONST char Far ActOffsetCentDir[] = "\ + Actual offset of end-of-central-dir record: %9ld (%.8lXh)\n\ + Expected offset of end-of-central-dir record: %9ld (%.8lXh)\n\ + (based on the length of the central directory and its expected offset)\n\n"; +static ZCONST char Far SinglePartArchive1[] = "\ + This zipfile constitutes the sole disk of a single-part archive; its\n\ + central directory contains %u %s. The central directory is %lu\n\ + (%.8lXh) bytes long, and its (expected) offset in bytes from the\n"; +static ZCONST char Far SinglePartArchive2[] = "\ + beginning of the zipfile is %lu (%.8lXh).\n\n"; +static ZCONST char Far MultiPartArchive1[] = "\ + This zipfile constitutes disk %u of a multi-part archive. The central\n\ + directory starts on disk %u; %u of its entries %s contained within\n"; +static ZCONST char Far MultiPartArchive2[] = "\ + this zipfile, out of a total of %u %s. The entire central\n\ + directory is %lu (%.8lXh) bytes long, and its offset in bytes from\n"; +static ZCONST char Far MultiPartArchive3[] = "\ + the beginning of the zipfile in which it begins is %lu (%.8lXh).\n\n"; +static ZCONST char Far NoZipfileComment[] = " There is no zipfile comment.\n"; +static ZCONST char Far ZipfileCommentDesc[] = + " The zipfile comment is %u bytes long and contains the following text:\n\n"; +static ZCONST char Far ZipfileCommBegin[] = + "======================== zipfile comment begins ==========================\n"; +static ZCONST char Far ZipfileCommEnd[] = + "========================= zipfile comment ends ===========================\n"; +static ZCONST char Far ZipfileCommTrunc2[] = "\n The zipfile comment is truncated.\n"; +static ZCONST char Far ZipfileCommTruncMsg[] = + "\ncaution: zipfile comment truncated\n"; + +static ZCONST char Far CentralDirEntry[] = + "\nCentral directory entry #%d:\n---------------------------\n\n"; +static ZCONST char Far ZipfileStats[] = + "%d file%s, %lu bytes uncompressed, %lu bytes compressed: %s%d.%d%%\n"; + +/* zi_long() strings */ +static ZCONST char Far OS_FAT[] = "MS-DOS, OS/2 or NT FAT"; +static ZCONST char Far OS_Amiga[] = "Amiga"; +static ZCONST char Far OS_VMS[] = "VMS"; +static ZCONST char Far OS_Unix[] = "Unix"; +static ZCONST char Far OS_VMCMS[] = "VM/CMS"; +static ZCONST char Far OS_AtariST[] = "Atari ST"; +static ZCONST char Far OS_HPFS[] = "OS/2 or NT HPFS"; +static ZCONST char Far OS_Macintosh[] = "Macintosh HFS"; +static ZCONST char Far OS_ZSystem[] = "Z-System"; +static ZCONST char Far OS_CPM[] = "CP/M"; +static ZCONST char Far OS_TOPS20[] = "TOPS-20"; +static ZCONST char Far OS_NTFS[] = "NTFS"; +static ZCONST char Far OS_QDOS[] = "SMS/QDOS"; +static ZCONST char Far OS_Acorn[] = "Acorn RISC OS"; +static ZCONST char Far OS_MVS[] = "MVS"; +static ZCONST char Far OS_VFAT[] = "Win32 VFAT"; +static ZCONST char Far OS_BeOS[] = "BeOS"; +static ZCONST char Far OS_Tandem[] = "Tandem NSK"; + +static ZCONST char Far MthdNone[] = "none (stored)"; +static ZCONST char Far MthdShrunk[] = "shrunk"; +static ZCONST char Far MthdRedF1[] = "reduced (factor 1)"; +static ZCONST char Far MthdRedF2[] = "reduced (factor 2)"; +static ZCONST char Far MthdRedF3[] = "reduced (factor 3)"; +static ZCONST char Far MthdRedF4[] = "reduced (factor 4)"; +static ZCONST char Far MthdImplode[] = "imploded"; +static ZCONST char Far MthdToken[] = "tokenized"; +static ZCONST char Far MthdDeflate[] = "deflated"; +static ZCONST char Far MthdEnDeflate[] = "deflated (enhanced)"; +static ZCONST char Far MthdDCLImplode[] = "imploded (PK DCL)"; + +static ZCONST char Far DeflNorm[] = "normal"; +static ZCONST char Far DeflMax[] = "maximum"; +static ZCONST char Far DeflFast[] = "fast"; +static ZCONST char Far DeflSFast[] = "superfast"; + +static ZCONST char Far ExtraBytesPreceding[] = + " There are an extra %ld bytes preceding this file.\n\n"; + +static ZCONST char Far UnknownNo[] = "unknown (%d)"; + +static ZCONST char Far LocalHeaderOffset[] = + "\n offset of local header from start of archive: %lu (%.8lXh) bytes\n"; +static ZCONST char Far HostOS[] = + " file system or operating system of origin: %s\n"; +static ZCONST char Far EncodeSWVer[] = + " version of encoding software: %d.%d\n"; +static ZCONST char Far MinOSCompReq[] = + " minimum file system compatibility required: %s\n"; +static ZCONST char Far MinSWVerReq[] = + " minimum software version required to extract: %d.%d\n"; +static ZCONST char Far CompressMethod[] = + " compression method: %s\n"; +static ZCONST char Far SlideWindowSizeImplode[] = + " size of sliding dictionary (implosion): %cK\n"; +static ZCONST char Far ShannonFanoTrees[] = + " number of Shannon-Fano trees (implosion): %c\n"; +static ZCONST char Far CompressSubtype[] = + " compression sub-type (deflation): %s\n"; +static ZCONST char Far FileSecurity[] = + " file security status: %sencrypted\n"; +static ZCONST char Far ExtendedLocalHdr[] = + " extended local header: %s\n"; +static ZCONST char Far FileModDate[] = + " file last modified on (DOS date/time): %s\n"; +#ifdef USE_EF_UT_TIME + static ZCONST char Far UT_FileModDate[] = + " file last modified on (UT extra field modtime): %s %s\n"; + static ZCONST char Far LocalTime[] = "local"; +#ifndef NO_GMTIME + static ZCONST char Far GMTime[] = "UTC"; +#endif +#endif /* USE_EF_UT_TIME */ +static ZCONST char Far CRC32Value[] = + " 32-bit CRC value (hex): %.8lx\n"; +static ZCONST char Far CompressedFileSize[] = + " compressed size: %lu bytes\n"; +static ZCONST char Far UncompressedFileSize[] = + " uncompressed size: %lu bytes\n"; +static ZCONST char Far FilenameLength[] = + " length of filename: %u characters\n"; +static ZCONST char Far ExtraFieldLength[] = + " length of extra field: %u bytes\n"; +static ZCONST char Far FileCommentLength[] = + " length of file comment: %u characters\n"; +static ZCONST char Far FileDiskNum[] = + " disk number on which file begins: disk %u\n"; +static ZCONST char Far ApparentFileType[] = + " apparent file type: %s\n"; +static ZCONST char Far VMSFileAttributes[] = + " VMS file attributes (%06o octal): %s\n"; +static ZCONST char Far AmigaFileAttributes[] = + " Amiga file attributes (%06o octal): %s\n"; +static ZCONST char Far UnixFileAttributes[] = + " Unix file attributes (%06o octal): %s\n"; +static ZCONST char Far NonMSDOSFileAttributes[] = + " non-MSDOS external file attributes: %06lX hex\n"; +static ZCONST char Far MSDOSFileAttributes[] = + " MS-DOS file attributes (%02X hex): none\n"; +static ZCONST char Far MSDOSFileAttributesRO[] = + " MS-DOS file attributes (%02X hex): read-only\n"; +static ZCONST char Far MSDOSFileAttributesAlpha[] = + " MS-DOS file attributes (%02X hex): %s%s%s%s%s%s\n"; + + +static ZCONST char Far ExtraFieldTrunc[] = "\n\ + error: EF data block (type 0x%04x) size %u exceeds remaining extra field\n\ + space %u; block length has been truncated.\n"; +static ZCONST char Far ExtraFields[] = "\n\ + The central-directory extra field contains:"; +static ZCONST char Far ExtraFieldType[] = "\n\ + - A subfield with ID 0x%04x (%s) and %u data bytes"; +static ZCONST char Far efAV[] = "PKWARE AV"; +static ZCONST char Far efOS2[] = "OS/2"; +static ZCONST char Far efPKVMS[] = "PKWARE VMS"; +static ZCONST char Far efPKWin32[] = "PKWARE Win32"; +static ZCONST char Far efPKUnix[] = "PKWARE Unix"; +static ZCONST char Far efIZVMS[] = "Info-ZIP VMS"; +static ZCONST char Far efIZUnix[] = "old Info-ZIP Unix/OS2/NT"; +static ZCONST char Far efIZUnix2[] = "Unix UID/GID"; +static ZCONST char Far efTime[] = "universal time"; +static ZCONST char Far efJLMac[] = "old Info-ZIP Macintosh"; +static ZCONST char Far efMac3[] = "new Info-ZIP Macintosh"; +static ZCONST char Far efZipIt[] = "ZipIt Macintosh"; +static ZCONST char Far efZipIt2[] = "ZipIt Macintosh (short)"; +static ZCONST char Far efVMCMS[] = "VM/CMS"; +static ZCONST char Far efMVS[] = "MVS"; +static ZCONST char Far efACL[] = "OS/2 ACL"; +static ZCONST char Far efNTSD[] = "Security Descriptor"; +static ZCONST char Far efBeOS[] = "BeOS"; +static ZCONST char Far efQDOS[] = "SMS/QDOS"; +static ZCONST char Far efAOSVS[] = "AOS/VS"; +static ZCONST char Far efSpark[] = "Acorn SparkFS"; +static ZCONST char Far efMD5[] = "Fred Kantor MD5"; +static ZCONST char Far efASiUnix[] = "ASi Unix"; +static ZCONST char Far efUnknown[] = "unknown"; + +static ZCONST char Far OS2EAs[] = ".\n\ + The local extra field has %lu bytes of OS/2 extended attributes.\n\ + (May not match OS/2 \"dir\" amount due to storage method)"; +static ZCONST char Far izVMSdata[] = ". The extra\n\ + field is %s and has %lu bytes of VMS %s information%s"; +static ZCONST char Far izVMSstored[] = "stored"; +static ZCONST char Far izVMSrleenc[] = "run-length encoded"; +static ZCONST char Far izVMSdeflat[] = "deflated"; +static ZCONST char Far izVMScunknw[] = "compressed(?)"; +static ZCONST char Far *izVMScomp[4] = + {izVMSstored, izVMSrleenc, izVMSdeflat, izVMScunknw}; +static ZCONST char Far ACLdata[] = ".\n\ + The local extra field has %lu bytes of access control list information"; +static ZCONST char Far NTSDData[] = ".\n\ + The local extra field has %lu bytes of NT security descriptor data"; +static ZCONST char Far UTdata[] = ".\n\ + The local extra field has UTC/GMT %s time%s"; +static ZCONST char Far UTmodification[] = "modification"; +static ZCONST char Far UTaccess[] = "access"; +static ZCONST char Far UTcreation[] = "creation"; +static ZCONST char Far ZipItFname[] = ".\n\ + The Mac long filename is %s.\n"; +static ZCONST char Far Mac3data[] = ".\n\ + The local extra field has %lu bytes of %scompressed Macintosh\n\ + finder attributes"; + /* MacOSdata[] is used by EF_MAC3, EF_ZIPIT, EF_ZIPIT2 and EF_JLEE e. f. */ +static ZCONST char Far MacOSdata[] = ".\n\ + The associated file has type code `%c%c%c%c' and creator code `%c%c%c%c'"; +static ZCONST char Far MacOSdata1[] = ".\n\ + The associated file has type code `0x%lx' and creator code `0x%lx'"; +static ZCONST char Far MacOSJLEEflags[] = "\n File is marked as %s"; +static ZCONST char Far MacOS_RF[] = "Resource-fork"; +static ZCONST char Far MacOS_DF[] = "Data-fork"; +static ZCONST char Far MacOSMAC3flags[] = ".\n\ + File is marked as %s, File Dates are in %d Bit"; +static ZCONST char Far BeOSdata[] = ".\n\ + The local extra field has %lu bytes of %scompressed BeOS file attributes"; + /* The associated file has type code `%c%c%c%c' and creator code `%c%c%c%c'" */ +static ZCONST char Far QDOSdata[] = ".\n\ + The QDOS extra field subtype is `%c%c%c%c'"; +static ZCONST char Far AOSVSdata[] = ".\n\ + The AOS/VS extra field revision is %d.%d"; +static ZCONST char Far MD5data[] = ".\n\ + The 128-bit MD5 signature is %s"; +#ifdef CMS_MVS + static ZCONST char Far VmMvsExtraField[] = ".\n\ + The stored file open mode (FLDATA TYPE) is \"%s\""; + static ZCONST char Far VmMvsInvalid[] = "[invalid]"; +#endif /* CMS_MVS */ + +static ZCONST char Far First20[] = ". The first\n 20 are: "; +static ZCONST char Far ColonIndent[] = ":\n "; +static ZCONST char Far efFormat[] = " %02x"; + +static ZCONST char Far lExtraFieldType[] = "\n\ + There %s a local extra field with ID 0x%04x (%s) and\n\ + %u data bytes (%s).\n"; +static ZCONST char Far efIZuid[] = + "GMT modification/access times and Unix UID/GID"; +static ZCONST char Far efIZnouid[] = "GMT modification/access times only"; + + +static ZCONST char Far NoFileComment[] = "\n There is no file comment.\n"; +static ZCONST char Far FileCommBegin[] = "\n\ +------------------------- file comment begins ----------------------------\n"; +static ZCONST char Far FileCommEnd[] = "\ +-------------------------- file comment ends -----------------------------\n"; + +/* zi_time() strings */ +static ZCONST char Far BogusFmt[] = "%03d"; +static ZCONST char Far DMYHMTime[] = "%2u-%s-%02u %02u:%02u"; +static ZCONST char Far YMDHMSTime[] = "%u %s %u %02u:%02u:%02u"; +static ZCONST char Far DecimalTime[] = "%04u%02u%02u.%02u%02u%02u"; +static ZCONST char Far YMDHMSTimeError[] = "???? ??? ?? ??:??:??"; + + + + + +#ifndef WINDLL + +/************************/ +/* Function zi_opts() */ +/************************/ + +int zi_opts(__G__ pargc, pargv) + int *pargc; + char ***pargv; + __GDEF +{ + char **argv, *s; + int argc, c, error=FALSE, negative=0; + int hflag_slmv=TRUE, hflag_2=FALSE; /* diff options => diff defaults */ + int tflag_slm=TRUE, tflag_2v=FALSE; + int explicit_h=FALSE, explicit_t=FALSE; + + +#ifdef MACOS + uO.lflag = LFLAG; /* reset default on each call */ +#endif + G.extract_flag = FALSE; /* zipinfo does not extract to disk */ + argc = *pargc; + argv = *pargv; + + while (--argc > 0 && (*++argv)[0] == '-') { + s = argv[0] + 1; + while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */ + switch (c) { + case '-': + ++negative; + break; + case '1': /* shortest listing: JUST filenames */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 1; + break; + case '2': /* just filenames, plus headers if specified */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 2; + break; +#ifndef CMS_MVS + case ('C'): /* -C: match filenames case-insensitively */ + if (negative) + uO.C_flag = FALSE, negative = 0; + else + uO.C_flag = TRUE; + break; +#endif /* !CMS_MVS */ + case 'h': /* header line */ + if (negative) + hflag_2 = hflag_slmv = FALSE, negative = 0; + else { + hflag_2 = hflag_slmv = explicit_h = TRUE; + if (uO.lflag == -1) + uO.lflag = 0; + } + break; + case 'l': /* longer form of "ls -l" type listing */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 5; + break; + case 'm': /* medium form of "ls -l" type listing */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 4; + break; +#ifdef MORE + case 'M': /* send output through built-in "more" */ + if (negative) + G.M_flag = FALSE, negative = 0; + else + G.M_flag = TRUE; + break; +#endif + case 's': /* default: shorter "ls -l" type listing */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 3; + break; + case 't': /* totals line */ + if (negative) + tflag_2v = tflag_slm = FALSE, negative = 0; + else { + tflag_2v = tflag_slm = explicit_t = TRUE; + if (uO.lflag == -1) + uO.lflag = 0; + } + break; + case ('T'): /* use (sortable) decimal time format */ + if (negative) + uO.T_flag = FALSE, negative = 0; + else + uO.T_flag = TRUE; + break; + case 'v': /* turbo-verbose listing */ + if (negative) + uO.lflag = -2, negative = 0; + else + uO.lflag = 10; + break; + case 'z': /* print zipfile comment */ + if (negative) + uO.zflag = negative = 0; + else + uO.zflag = 1; + break; + case 'Z': /* ZipInfo mode: ignore */ + break; + default: + error = TRUE; + break; + } + } + } + if ((argc-- == 0) || error) { + *pargc = argc; + *pargv = argv; + return USAGE(error); + } + +#ifdef MORE + if (G.M_flag && !isatty(1)) /* stdout redirected: "more" func useless */ + G.M_flag = 0; +#endif + + /* if no listing options given (or all negated), or if only -h/-t given + * with individual files specified, use default listing format */ + if ((uO.lflag < 0) || ((argc > 0) && (uO.lflag == 0))) + uO.lflag = LFLAG; + + /* set header and totals flags to default or specified values */ + switch (uO.lflag) { + case 0: /* 0: can only occur if either -t or -h explicitly given; */ + case 2: /* therefore set both flags equal to normally false value */ + uO.hflag = hflag_2; + uO.tflag = tflag_2v; + break; + case 1: /* only filenames, *always* */ + uO.hflag = FALSE; + uO.tflag = FALSE; + uO.zflag = FALSE; + break; + case 3: + case 4: + case 5: + uO.hflag = ((argc > 0) && !explicit_h)? FALSE : hflag_slmv; + uO.tflag = ((argc > 0) && !explicit_t)? FALSE : tflag_slm; + break; + case 10: + uO.hflag = hflag_slmv; + uO.tflag = tflag_2v; + break; + } + + *pargc = argc; + *pargv = argv; + return 0; + +} /* end function zi_opts() */ + +#endif /* !WINDLL */ + + + + + +/*******************************/ +/* Function zi_end_central() */ +/*******************************/ + +int zi_end_central(__G) /* return PK-type error code */ + __GDEF +{ + int error = PK_COOL; + + +/*--------------------------------------------------------------------------- + Print out various interesting things about the zipfile. + ---------------------------------------------------------------------------*/ + + /* header fits on one line, for anything up to 10GB and 10000 files: */ + if (uO.hflag) + Info(slide, 0, ((char *)slide, ((int)strlen(G.zipfn) < 39)? + LoadFarString(LongHeader) : LoadFarString(ShortHeader), G.zipfn, + (long)G.ziplen, G.ecrec.total_entries_central_dir, + (G.ecrec.total_entries_central_dir==1)? + nullStr : "s")); + + /* verbose format */ + if (uO.lflag > 9) { + Info(slide, 0, ((char *)slide, LoadFarString(EndCentDirRec))); + Info(slide, 0, ((char *)slide, LoadFarString(LineSeparators))); + + Info(slide, 0, ((char *)slide, LoadFarString(ActOffsetCentDir), + (long)G.real_ecrec_offset, (long)G.real_ecrec_offset, + (long)G.expect_ecrec_offset, (long)G.expect_ecrec_offset)); + + if (G.ecrec.number_this_disk == 0) { + Info(slide, 0, ((char *)slide, LoadFarString(SinglePartArchive1), + G.ecrec.total_entries_central_dir, + (G.ecrec.total_entries_central_dir == 1)? "entry" : "entries", + G.ecrec.size_central_directory, + G.ecrec.size_central_directory)); + Info(slide, 0, ((char *)slide, LoadFarString(SinglePartArchive2), + G.ecrec.offset_start_central_directory, + G.ecrec.offset_start_central_directory)); + } else { + Info(slide, 0, ((char *)slide, LoadFarString(MultiPartArchive1), + G.ecrec.number_this_disk + 1, + G.ecrec.num_disk_start_cdir + 1, + G.ecrec.num_entries_centrl_dir_ths_disk, + (G.ecrec.num_entries_centrl_dir_ths_disk == 1)? "is" : "are")); + Info(slide, 0, ((char *)slide, LoadFarString(MultiPartArchive2), + G.ecrec.total_entries_central_dir, + (G.ecrec.total_entries_central_dir == 1) ? "entry" : "entries", + G.ecrec.size_central_directory, + G.ecrec.size_central_directory)); + Info(slide, 0, ((char *)slide, LoadFarString(MultiPartArchive3), + G.ecrec.offset_start_central_directory, + G.ecrec.offset_start_central_directory)); + } + + /*----------------------------------------------------------------------- + Get the zipfile comment, if any, and print it out. (Comment may be + up to 64KB long. May the fleas of a thousand camels infest the arm- + pits of anyone who actually takes advantage of this fact.) + -----------------------------------------------------------------------*/ + + if (!G.ecrec.zipfile_comment_length) + Info(slide, 0, ((char *)slide, LoadFarString(NoZipfileComment))); + else { + Info(slide, 0, ((char *)slide, LoadFarString(ZipfileCommentDesc), + G.ecrec.zipfile_comment_length)); + Info(slide, 0, ((char *)slide, LoadFarString(ZipfileCommBegin))); + if (do_string(__G__ G.ecrec.zipfile_comment_length, DISPLAY)) + error = PK_WARN; + Info(slide, 0, ((char *)slide, LoadFarString(ZipfileCommEnd))); + if (error) + Info(slide, 0, ((char *)slide, + LoadFarString(ZipfileCommTrunc2))); + } /* endif (comment exists) */ + + /* non-verbose mode: print zipfile comment only if requested */ + } else if (uO.zflag && G.ecrec.zipfile_comment_length) { + if (do_string(__G__ G.ecrec.zipfile_comment_length, DISPLAY)) { + Info(slide, 0x401, ((char *)slide, + LoadFarString(ZipfileCommTruncMsg))); + error = PK_WARN; + } + } /* endif (verbose) */ + + return error; + +} /* end function zi_end_central() */ + + + + + +/************************/ +/* Function zipinfo() */ +/************************/ + +int zipinfo(__G) /* return PK-type error code */ + __GDEF +{ + int do_this_file=FALSE, error, error_in_archive=PK_COOL; + int *fn_matched=NULL, *xn_matched=NULL; + unsigned j, members=0; + ulg tot_csize=0L, tot_ucsize=0L; + ulg endprev; /* buffers end of previous entry for zi_long()'s check + * of extra bytes */ + + +/*--------------------------------------------------------------------------- + Malloc space for check on unmatched filespecs (no big deal if one or both + are NULL). + ---------------------------------------------------------------------------*/ + + if (G.filespecs > 0 && + (fn_matched=(int *)malloc(G.filespecs*sizeof(int))) != NULL) + for (j = 0; j < G.filespecs; ++j) + fn_matched[j] = FALSE; + + if (G.xfilespecs > 0 && + (xn_matched=(int *)malloc(G.xfilespecs*sizeof(int))) != NULL) + for (j = 0; j < G.xfilespecs; ++j) + xn_matched[j] = FALSE; + +/*--------------------------------------------------------------------------- + Set file pointer to start of central directory, then loop through cen- + tral directory entries. Check that directory-entry signature bytes are + actually there (just a precaution), then process the entry. We know + the entire central directory is on this disk: we wouldn't have any of + this information unless the end-of-central-directory record was on this + disk, and we wouldn't have gotten to this routine unless this is also + the disk on which the central directory starts. In practice, this had + better be the *only* disk in the archive, but maybe someday we'll add + multi-disk support. + ---------------------------------------------------------------------------*/ + + uO.L_flag = FALSE; /* zipinfo mode: never convert name to lowercase */ + G.pInfo = G.info; /* (re-)initialize, (just to make sure) */ + G.pInfo->textmode = 0; /* so one can read on screen (is this ever used?) */ + + /* reset endprev for new zipfile; account for multi-part archives (?) */ + endprev = (G.crec.relative_offset_local_header == 4L)? 4L : 0L; + + + for (j = 0; j++ < (unsigned)G.ecrec.total_entries_central_dir;) { + if (readbuf(__G__ G.sig, 4) == 0) + return PK_EOF; + if (strncmp(G.sig, central_hdr_sig, 4)) { /* just to make sure */ + Info(slide, 0x401, ((char *)slide, LoadFarString(CentSigMsg), j)); + return PK_BADERR; /* sig not found */ + } + /* process_cdir_file_hdr() sets pInfo->hostnum, pInfo->lcflag, ...: */ + if ((error = process_cdir_file_hdr(__G)) != PK_COOL) + return error; /* only PK_EOF defined */ + + if ((error = do_string(__G__ G.crec.filename_length, DS_FN)) != + PK_COOL) + { + error_in_archive = error; /* might be warning */ + if (error > PK_WARN) /* fatal */ + return error; + } + + if (!G.process_all_files) { /* check if specified on command line */ + unsigned i; + + do_this_file = FALSE; + for (i = 0; i < G.filespecs; i++) + if (match(G.filename, G.pfnames[i], uO.C_flag)) { + do_this_file = TRUE; + if (fn_matched) + fn_matched[i] = TRUE; + break; /* found match, so stop looping */ + } + if (do_this_file) { /* check if this is an excluded file */ + for (i = 0; i < G.xfilespecs; i++) + if (match(G.filename, G.pxnames[i], uO.C_flag)) { + do_this_file = FALSE; /* ^-- ignore case in match */ + if (xn_matched) + xn_matched[i] = TRUE; + break; + } + } + } + + /*----------------------------------------------------------------------- + If current file was specified on command line, or if no names were + specified, do the listing for this file. Otherwise, get rid of the + file comment and go back for the next file. + -----------------------------------------------------------------------*/ + + if (G.process_all_files || do_this_file) { + + switch (uO.lflag) { + case 1: + case 2: + fnprint(__G); + SKIP_(G.crec.extra_field_length) + SKIP_(G.crec.file_comment_length) + break; + + case 3: + case 4: + case 5: + if ((error = zi_short(__G)) != PK_COOL) { + error_in_archive = error; /* might be warning */ + if (error > PK_WARN) /* fatal */ + return error; + } + break; + + case 10: + Info(slide, 0, ((char *)slide, + LoadFarString(CentralDirEntry), j)); + if ((error = zi_long(__G__ &endprev)) != PK_COOL) { + error_in_archive = error; /* might be warning */ + if (error > PK_WARN) /* fatal */ + return error; + } + break; + + default: + SKIP_(G.crec.extra_field_length) + SKIP_(G.crec.file_comment_length) + break; + + } /* end switch (lflag) */ + + tot_csize += G.crec.csize; + tot_ucsize += G.crec.ucsize; + if (G.crec.general_purpose_bit_flag & 1) + tot_csize -= 12; /* don't count encryption header */ + ++members; + +#ifdef DLL + if ((G.statreportcb != NULL) && + (*G.statreportcb)(__G__ UZ_ST_FINISH_MEMBER, G.zipfn, + G.filename, NULL)) { + if (fn_matched) + free((zvoid *)fn_matched); + if (xn_matched) + free((zvoid *)xn_matched); + return IZ_CTRLC; /* cancel operation by user request */ + } +#endif +#ifdef MACOS /* MacOS is no preemptive OS, thus call event-handling by hand */ + UserStop(); +#endif + + } else { /* not listing this file */ + SKIP_(G.crec.extra_field_length) + SKIP_(G.crec.file_comment_length) + + } /* end if (list member?) */ + + } /* end for-loop (j: member files) */ + +/*--------------------------------------------------------------------------- + Check that we actually found requested files; if so, print totals. + ---------------------------------------------------------------------------*/ + + if (uO.tflag) { + char *sgn = ""; + int cfactor = ratio(tot_ucsize, tot_csize); + + if (cfactor < 0) { + sgn = "-"; + cfactor = -cfactor; + } + Info(slide, 0, ((char *)slide, LoadFarString(ZipfileStats), + members, (members==1)? nullStr:"s", tot_ucsize, + tot_csize, sgn, cfactor/10, cfactor%10)); + } + +/*--------------------------------------------------------------------------- + Check for unmatched filespecs on command line and print warning if any + found. + ---------------------------------------------------------------------------*/ + + if (fn_matched) { + for (j = 0; j < G.filespecs; ++j) + if (!fn_matched[j]) + Info(slide, 0x401, ((char *)slide, + LoadFarString(FilenameNotMatched), G.pfnames[j])); + free((zvoid *)fn_matched); + } + if (xn_matched) { + for (j = 0; j < G.xfilespecs; ++j) + if (!xn_matched[j]) + Info(slide, 0x401, ((char *)slide, + LoadFarString(ExclFilenameNotMatched), G.pxnames[j])); + free((zvoid *)xn_matched); + } + +/*--------------------------------------------------------------------------- + Double check that we're back at the end-of-central-directory record. + ---------------------------------------------------------------------------*/ + + if (readbuf(__G__ G.sig, 4) == 0) /* disk error? */ + return PK_EOF; + if (strncmp(G.sig, end_central_sig, 4)) { /* just to make sure again */ + Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg))); + error_in_archive = PK_WARN; /* didn't find sig */ + } + if (members == 0 && error_in_archive <= PK_WARN) + error_in_archive = PK_FIND; + + if (uO.lflag >= 10) + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + + return error_in_archive; + +} /* end function zipinfo() */ + + + + + +/************************/ +/* Function zi_long() */ +/************************/ + +static int zi_long(__G__ pEndprev) /* return PK-type error code */ + __GDEF + ulg *pEndprev; /* for zi_long() check of extra bytes */ +{ +#ifdef USE_EF_UT_TIME + iztimes z_utime; +#endif + int error, error_in_archive=PK_COOL; + ush hostnum, hostver, extnum, extver, methnum, xattr; + char workspace[12], attribs[22]; + ZCONST char *varmsg_str; + char unkn[16]; + static ZCONST char Far *os[NUM_HOSTS] = { + OS_FAT, OS_Amiga, OS_VMS, OS_Unix, OS_VMCMS, OS_AtariST, OS_HPFS, + OS_Macintosh, OS_ZSystem, OS_CPM, OS_TOPS20, OS_NTFS, OS_QDOS, + OS_Acorn, OS_VFAT, OS_MVS, OS_BeOS, OS_Tandem + }; + static ZCONST char Far *method[NUM_METHODS] = { + MthdNone, MthdShrunk, MthdRedF1, MthdRedF2, MthdRedF3, MthdRedF4, + MthdImplode, MthdToken, MthdDeflate, MthdEnDeflate, MthdDCLImplode + }; + static ZCONST char Far *dtypelng[4] = { + DeflNorm, DeflMax, DeflFast, DeflSFast + }; + + +/*--------------------------------------------------------------------------- + Check whether there's any extra space inside the zipfile. If *pEndprev is + zero, it's probably a signal that OS/2 extra fields are involved (with + unknown compressed size). We won't worry about prepended junk here... + ---------------------------------------------------------------------------*/ + + if (G.crec.relative_offset_local_header != *pEndprev && *pEndprev > 0L) { + /* GRR DEBUG + Info(slide, 0, ((char *)slide, + " [crec.relative_offset_local_header = %lu, endprev = %lu]\n", + G.crec.relative_offset_local_header, *pEndprev)); + */ + Info(slide, 0, ((char *)slide, LoadFarString(ExtraBytesPreceding), + (long)G.crec.relative_offset_local_header - (long)(*pEndprev))); + } + + /* calculate endprev for next time around (problem: extra fields may + * differ in length between local and central-directory records) */ + *pEndprev = G.crec.relative_offset_local_header + 4L + LREC_SIZE + + G.crec.filename_length + G.crec.extra_field_length + + G.crec.file_comment_length + G.crec.csize; + +/*--------------------------------------------------------------------------- + Read the extra field, if any. It may be used to get UNIX style modtime. + ---------------------------------------------------------------------------*/ + + if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD)) != 0) + { + if (G.extra_field != NULL) { + free(G.extra_field); + G.extra_field = NULL; + } + error_in_archive = error; + /* The premature return in case of a "fatal" error (PK_EOF) is + * delayed until we analyze the extra field contents. + * This allows us to display all the other info that has been + * successfully read in. + */ + } + +/*--------------------------------------------------------------------------- + Print out various interesting things about the compressed file. + ---------------------------------------------------------------------------*/ + + hostnum = (ush)(G.pInfo->hostnum); + hostver = G.crec.version_made_by[0]; + extnum = (ush)MIN(G.crec.version_needed_to_extract[1], NUM_HOSTS); + extver = G.crec.version_needed_to_extract[0]; + methnum = (ush)MIN(G.crec.compression_method, NUM_METHODS); + + (*G.message)((zvoid *)&G, (uch *)" ", 2L, 0); fnprint(__G); + + Info(slide, 0, ((char *)slide, LoadFarString(LocalHeaderOffset), + G.crec.relative_offset_local_header, + G.crec.relative_offset_local_header)); + + if (hostnum >= NUM_HOSTS) { + sprintf(unkn, LoadFarString(UnknownNo), + (int)G.crec.version_made_by[1]); + varmsg_str = unkn; + } else { + varmsg_str = LoadFarStringSmall(os[hostnum]); + } + Info(slide, 0, ((char *)slide, LoadFarString(HostOS), varmsg_str)); + Info(slide, 0, ((char *)slide, LoadFarString(EncodeSWVer), hostver/10, + hostver%10)); + + if (extnum >= NUM_HOSTS) { + sprintf(unkn, LoadFarString(UnknownNo), + (int)G.crec.version_needed_to_extract[1]); + varmsg_str = unkn; + } else { + varmsg_str = LoadFarStringSmall(os[extnum]); + } + Info(slide, 0, ((char *)slide, LoadFarString(MinOSCompReq), varmsg_str)); + Info(slide, 0, ((char *)slide, LoadFarString(MinSWVerReq), extver/10, + extver%10)); + + if (methnum >= NUM_METHODS) { + sprintf(unkn, LoadFarString(UnknownNo), G.crec.compression_method); + varmsg_str = unkn; + } else { + varmsg_str = LoadFarStringSmall(method[methnum]); + } + Info(slide, 0, ((char *)slide, LoadFarString(CompressMethod), varmsg_str)); + if (methnum == IMPLODED) { + Info(slide, 0, ((char *)slide, LoadFarString(SlideWindowSizeImplode), + (G.crec.general_purpose_bit_flag & 2)? '8' : '4')); + Info(slide, 0, ((char *)slide, LoadFarString(ShannonFanoTrees), + (G.crec.general_purpose_bit_flag & 4)? '3' : '2')); + } else if (methnum == DEFLATED) { + ush dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3); + + Info(slide, 0, ((char *)slide, LoadFarString(CompressSubtype), + LoadFarStringSmall(dtypelng[dnum]))); + } + + Info(slide, 0, ((char *)slide, LoadFarString(FileSecurity), + (G.crec.general_purpose_bit_flag & 1) ? nullStr : "not ")); + Info(slide, 0, ((char *)slide, LoadFarString(ExtendedLocalHdr), + (G.crec.general_purpose_bit_flag & 8) ? "yes" : "no")); + /* print upper 3 bits for amusement? */ + + /* For printing of date & time, a "char d_t_buf[21]" is required. + * To save stack space, we reuse the "char attribs[22]" buffer which + * is not used yet. + */ +# define d_t_buf attribs + + zi_time(__G__ &G.crec.last_mod_dos_datetime, NULL, d_t_buf); + Info(slide, 0, ((char *)slide, LoadFarString(FileModDate), d_t_buf)); +#ifdef USE_EF_UT_TIME + if (G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.crec.extra_field_length, 1, + G.crec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME)) + { + TIMET_TO_NATIVE(z_utime.mtime) /* NOP unless MSC 7.0 or Macintosh */ + d_t_buf[0] = (char)0; /* signal "show local time" */ + zi_time(__G__ &G.crec.last_mod_dos_datetime, &(z_utime.mtime), d_t_buf); + Info(slide, 0, ((char *)slide, LoadFarString(UT_FileModDate), + d_t_buf, LoadFarStringSmall(LocalTime))); +#ifndef NO_GMTIME + d_t_buf[0] = (char)1; /* signal "show UTC (GMT) time" */ + zi_time(__G__ &G.crec.last_mod_dos_datetime, &(z_utime.mtime), d_t_buf); + Info(slide, 0, ((char *)slide, LoadFarString(UT_FileModDate), + d_t_buf, LoadFarStringSmall(GMTime))); +#endif /* !NO_GMTIME */ + } +#endif /* USE_EF_UT_TIME */ + + Info(slide, 0, ((char *)slide, LoadFarString(CRC32Value), G.crec.crc32)); + Info(slide, 0, ((char *)slide, LoadFarString(CompressedFileSize), + G.crec.csize)); + Info(slide, 0, ((char *)slide, LoadFarString(UncompressedFileSize), + G.crec.ucsize)); + Info(slide, 0, ((char *)slide, LoadFarString(FilenameLength), + G.crec.filename_length)); + Info(slide, 0, ((char *)slide, LoadFarString(ExtraFieldLength), + G.crec.extra_field_length)); + Info(slide, 0, ((char *)slide, LoadFarString(FileCommentLength), + G.crec.file_comment_length)); + Info(slide, 0, ((char *)slide, LoadFarString(FileDiskNum), + G.crec.disk_number_start + 1)); + Info(slide, 0, ((char *)slide, LoadFarString(ApparentFileType), + (G.crec.internal_file_attributes & 1)? "text" + : (G.crec.internal_file_attributes & 2)? "ebcdic" + : "binary")); /* changed to accept EBCDIC */ +#ifdef ATARI + printf(" external file attributes (hex): %.8lx\n", + G.crec.external_file_attributes); +#endif + xattr = (ush)((G.crec.external_file_attributes >> 16) & 0xFFFF); + if (hostnum == VMS_) { + char *p=attribs, *q=attribs+1; + int i, j, k; + + for (k = 0; k < 12; ++k) + workspace[k] = 0; + if (xattr & VMS_IRUSR) + workspace[0] = 'R'; + if (xattr & VMS_IWUSR) { + workspace[1] = 'W'; + workspace[3] = 'D'; + } + if (xattr & VMS_IXUSR) + workspace[2] = 'E'; + if (xattr & VMS_IRGRP) + workspace[4] = 'R'; + if (xattr & VMS_IWGRP) { + workspace[5] = 'W'; + workspace[7] = 'D'; + } + if (xattr & VMS_IXGRP) + workspace[6] = 'E'; + if (xattr & VMS_IROTH) + workspace[8] = 'R'; + if (xattr & VMS_IWOTH) { + workspace[9] = 'W'; + workspace[11] = 'D'; + } + if (xattr & VMS_IXOTH) + workspace[10] = 'E'; + + *p++ = '('; + for (k = j = 0; j < 3; ++j) { /* loop over groups of permissions */ + for (i = 0; i < 4; ++i, ++k) /* loop over perms within a group */ + if (workspace[k]) + *p++ = workspace[k]; + *p++ = ','; /* group separator */ + if (j == 0) + while ((*p++ = *q++) != ',') + ; /* system, owner perms are same */ + } + *p-- = 0; + *p = ')'; /* overwrite last comma */ + Info(slide, 0, ((char *)slide, LoadFarString(VMSFileAttributes), xattr, + attribs)); + + } else if (hostnum == AMIGA_) { + switch (xattr & AMI_IFMT) { + case AMI_IFDIR: attribs[0] = 'd'; break; + case AMI_IFREG: attribs[0] = '-'; break; + default: attribs[0] = '?'; break; + } + attribs[1] = (xattr & AMI_IHIDDEN)? 'h' : '-'; + attribs[2] = (xattr & AMI_ISCRIPT)? 's' : '-'; + attribs[3] = (xattr & AMI_IPURE)? 'p' : '-'; + attribs[4] = (xattr & AMI_IARCHIVE)? 'a' : '-'; + attribs[5] = (xattr & AMI_IREAD)? 'r' : '-'; + attribs[6] = (xattr & AMI_IWRITE)? 'w' : '-'; + attribs[7] = (xattr & AMI_IEXECUTE)? 'e' : '-'; + attribs[8] = (xattr & AMI_IDELETE)? 'd' : '-'; + attribs[9] = 0; /* better dlm the string */ + Info(slide, 0, ((char *)slide, LoadFarString(AmigaFileAttributes), + xattr, attribs)); + + } else if ((hostnum != FS_FAT_) && (hostnum != FS_HPFS_) && + (hostnum != FS_NTFS_) && (hostnum != FS_VFAT_) && + (hostnum != ACORN_) && + (hostnum != VM_CMS_) && (hostnum != MVS_)) + { /* assume Unix-like */ + switch ((unsigned)(xattr & UNX_IFMT)) { + case (unsigned)UNX_IFDIR: attribs[0] = 'd'; break; + case (unsigned)UNX_IFREG: attribs[0] = '-'; break; + case (unsigned)UNX_IFLNK: attribs[0] = 'l'; break; + case (unsigned)UNX_IFBLK: attribs[0] = 'b'; break; + case (unsigned)UNX_IFCHR: attribs[0] = 'c'; break; + case (unsigned)UNX_IFIFO: attribs[0] = 'p'; break; + case (unsigned)UNX_IFSOCK: attribs[0] = 's'; break; + default: attribs[0] = '?'; break; + } + attribs[1] = (xattr & UNX_IRUSR)? 'r' : '-'; + attribs[4] = (xattr & UNX_IRGRP)? 'r' : '-'; + attribs[7] = (xattr & UNX_IROTH)? 'r' : '-'; + + attribs[2] = (xattr & UNX_IWUSR)? 'w' : '-'; + attribs[5] = (xattr & UNX_IWGRP)? 'w' : '-'; + attribs[8] = (xattr & UNX_IWOTH)? 'w' : '-'; + + if (xattr & UNX_IXUSR) + attribs[3] = (xattr & UNX_ISUID)? 's' : 'x'; + else + attribs[3] = (xattr & UNX_ISUID)? 'S' : '-'; /* S = undefined */ + if (xattr & UNX_IXGRP) + attribs[6] = (xattr & UNX_ISGID)? 's' : 'x'; /* == UNX_ENFMT */ + else + attribs[6] = (xattr & UNX_ISGID)? 'l' : '-'; + if (xattr & UNX_IXOTH) + attribs[9] = (xattr & UNX_ISVTX)? 't' : 'x'; /* "sticky bit" */ + else + attribs[9] = (xattr & UNX_ISVTX)? 'T' : '-'; /* T = undefined */ + attribs[10] = 0; + + Info(slide, 0, ((char *)slide, LoadFarString(UnixFileAttributes), xattr, + attribs)); + + } else { + Info(slide, 0, ((char *)slide, LoadFarString(NonMSDOSFileAttributes), + G.crec.external_file_attributes >> 8)); + + } /* endif (hostnum: external attributes format) */ + + if ((xattr=(ush)(G.crec.external_file_attributes & 0xFF)) == 0) + Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributes), + xattr)); + else if (xattr == 1) + Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributesRO), + xattr)); + else + Info(slide, 0, ((char *)slide, LoadFarString(MSDOSFileAttributesAlpha), + xattr, (xattr&1)? "rdo " : nullStr, + (xattr&2)? "hid " : nullStr, + (xattr&4)? "sys " : nullStr, + (xattr&8)? "lab " : nullStr, + (xattr&16)? "dir " : nullStr, + (xattr&32)? "arc" : nullStr)); + +/*--------------------------------------------------------------------------- + Analyze the extra field, if any, and print the file comment, if any (the + filename has already been printed, above). That finishes up this file + entry... + ---------------------------------------------------------------------------*/ + + if (G.crec.extra_field_length > 0) { + uch *ef_ptr = G.extra_field; + ush ef_len = G.crec.extra_field_length; + ush eb_id, eb_datalen; + ZCONST char Far *ef_fieldname; + + if (error_in_archive > PK_WARN) /* fatal: can't continue */ + /* delayed "fatal error" return from extra field reading */ + return error; + if (G.extra_field == (uch *)NULL) + return PK_ERR; /* not consistent with crec length */ + + Info(slide, 0, ((char *)slide, LoadFarString(ExtraFields))); + + while (ef_len >= EB_HEADSIZE) { + eb_id = makeword(&ef_ptr[EB_ID]); + eb_datalen = makeword(&ef_ptr[EB_LEN]); + ef_ptr += EB_HEADSIZE; + ef_len -= EB_HEADSIZE; + + if (eb_datalen > (ush)ef_len) { + Info(slide, 0x421, ((char *)slide, + LoadFarString(ExtraFieldTrunc), eb_id, eb_datalen, ef_len)); + eb_datalen = ef_len; + } + + switch (eb_id) { + case EF_AV: + ef_fieldname = efAV; + break; + case EF_OS2: + ef_fieldname = efOS2; + break; + case EF_ACL: + ef_fieldname = efACL; + break; + case EF_NTSD: + ef_fieldname = efNTSD; + break; + case EF_PKVMS: + ef_fieldname = efPKVMS; + break; + case EF_IZVMS: + ef_fieldname = efIZVMS; + break; + case EF_PKW32: + ef_fieldname = efPKWin32; + break; + case EF_PKUNIX: + ef_fieldname = efPKUnix; + break; + case EF_IZUNIX: + ef_fieldname = efIZUnix; + if (G.crec.version_made_by[1] == UNIX_ && *pEndprev > 0L) + *pEndprev += 4L; /* also have UID/GID in local copy */ + break; + case EF_IZUNIX2: + ef_fieldname = efIZUnix2; + if (*pEndprev > 0L) + *pEndprev += 4L; /* 4 byte UID/GID in local copy */ + break; + case EF_TIME: + ef_fieldname = efTime; + break; + case EF_MAC3: + ef_fieldname = efMac3; + break; + case EF_JLMAC: + ef_fieldname = efJLMac; + break; + case EF_ZIPIT: + ef_fieldname = efZipIt; + break; + case EF_ZIPIT2: + ef_fieldname = efZipIt2; + break; + case EF_VMCMS: + ef_fieldname = efVMCMS; + break; + case EF_MVS: + ef_fieldname = efMVS; + break; + case EF_BEOS: + ef_fieldname = efBeOS; + break; + case EF_QDOS: + ef_fieldname = efQDOS; + break; + case EF_AOSVS: + ef_fieldname = efAOSVS; + break; + case EF_SPARK: /* from RISC OS */ + ef_fieldname = efSpark; + break; + case EF_MD5: + ef_fieldname = efMD5; + break; + case EF_ASIUNIX: + ef_fieldname = efASiUnix; + break; + default: + ef_fieldname = efUnknown; + break; + } + Info(slide, 0, ((char *)slide, LoadFarString(ExtraFieldType), + eb_id, LoadFarStringSmall(ef_fieldname), eb_datalen)); + + /* additional, field-specific information: */ + switch (eb_id) { + case EF_OS2: + case EF_ACL: + if (eb_datalen >= EB_OS2_HLEN) { + if (eb_id == EF_OS2) + ef_fieldname = OS2EAs; + else + ef_fieldname = ACLdata; + Info(slide, 0, ((char *)slide, + LoadFarString(ef_fieldname), makelong(ef_ptr))); + *pEndprev = 0L; /* no clue about csize of local */ + } + break; + case EF_NTSD: + if (eb_datalen >= EB_NTSD_C_LEN) { + Info(slide, 0, ((char *)slide, LoadFarString(NTSDData), + makelong(ef_ptr))); + *pEndprev = 0L; /* no clue about csize of local */ + } + break; + case EF_IZVMS: + if (eb_datalen >= 8) { + char *p, q[8]; + int compr = makeword(ef_ptr+4) & 7; + + *q = '\0'; + if (compr > 3) + compr = 3; + if (strncmp((char *)ef_ptr, "VFAB", 4) == 0) + p = "FAB"; + else if (strncmp((char *)ef_ptr, "VALL", 4) == 0) + p = "XABALL"; + else if (strncmp((char *)ef_ptr, "VFHC", 4) == 0) + p = "XABFHC"; + else if (strncmp((char *)ef_ptr, "VDAT", 4) == 0) + p = "XABDAT"; + else if (strncmp((char *)ef_ptr, "VRDT", 4) == 0) + p = "XABRDT"; + else if (strncmp((char *)ef_ptr, "VPRO", 4) == 0) + p = "XABPRO"; + else if (strncmp((char *)ef_ptr, "VKEY", 4) == 0) + p = "XABKEY"; + else if (strncmp((char *)ef_ptr, "VMSV", 4) == 0) { + p = "version"; + if (eb_datalen >= 16) { + q[0] = ' '; + q[1] = '('; + strncpy(q+2, (char *)ef_ptr+12, 4); + q[6] = ')'; + q[7] = '\0'; + } + } else + p = "version"; + Info(slide, 0, ((char *)slide, LoadFarString(izVMSdata), + LoadFarStringSmall(izVMScomp[compr]), + makeword(ef_ptr+6), p, q)); + } + break; + case EF_TIME: + if (eb_datalen >= 1) { + char types[80]; + int num = 0, len; + + *types = '\0'; + if (*ef_ptr & 1) { + strcpy(types, LoadFarString(UTmodification)); + ++num; + } + if (*ef_ptr & 2) { + len = strlen(types); + if (num) + types[len++] = '/'; + strcpy(types+len, LoadFarString(UTaccess)); + ++num; + if (*pEndprev > 0L) + *pEndprev += 4L; + } + if (*ef_ptr & 4) { + len = strlen(types); + if (num) + types[len++] = '/'; + strcpy(types+len, LoadFarString(UTcreation)); + ++num; + if (*pEndprev > 0L) + *pEndprev += 4L; + } + if (num > 0) + Info(slide, 0, ((char *)slide, + LoadFarString(UTdata), types, + num == 1? nullStr : "s")); + } + break; + case EF_MAC3: + if (eb_datalen >= EB_MAC3_HLEN) { + ulg eb_uc = makelong(ef_ptr); + unsigned mac3_flgs = makeword(ef_ptr+EB_FLGS_OFFS); + unsigned eb_is_uc = mac3_flgs & EB_M3_FL_UNCMPR; + + Info(slide, 0, ((char *)slide, LoadFarString(Mac3data), + eb_uc, eb_is_uc ? "un" : nullStr)); + if (eb_is_uc) { + if (*pEndprev > 0L) + *pEndprev += makelong(ef_ptr); + } else { + *pEndprev = 0L; /* no clue about csize of local */ + } + + Info(slide, 0, ((char *)slide, + LoadFarString(MacOSMAC3flags), + LoadFarStringSmall(mac3_flgs & EB_M3_FL_DATFRK ? + MacOS_DF : MacOS_RF), + (mac3_flgs & EB_M3_FL_TIME64 ? 64 : 32))); + zi_showMacTypeCreator(__G__ &ef_ptr[6]); + } + break; + case EF_ZIPIT2: + if (eb_datalen >= 5 && + strncmp((char *)ef_ptr, "ZPIT", 4) == 0) { + + if (eb_datalen >= 12) { + zi_showMacTypeCreator(__G__ &ef_ptr[4]); + } + } + + case EF_ZIPIT: + if (eb_datalen >= 5 && + strncmp((char *)ef_ptr, "ZPIT", 4) == 0) { + unsigned fnlen = ef_ptr[4]; + + if (eb_datalen >= fnlen + (5 + 8)) { + uch nullchar = ef_ptr[fnlen+5]; + + ef_ptr[fnlen+5] = '\0'; /* terminate filename */ + Info(slide, 0, ((char *)slide, + LoadFarString(ZipItFname), (char *)ef_ptr+5)); + ef_ptr[fnlen+5] = nullchar; + zi_showMacTypeCreator(__G__ &ef_ptr[fnlen+5]); + } + } + break; + case EF_JLMAC: + if (eb_datalen >= 40 && + strncmp((char *)ef_ptr, "JLEE", 4) == 0) + { + zi_showMacTypeCreator(__G__ &ef_ptr[4]); + + Info(slide, 0, ((char *)slide, + LoadFarString(MacOSJLEEflags), + LoadFarStringSmall(ef_ptr[31] & 1 ? + MacOS_DF : MacOS_RF))); + } + break; +#ifdef CMS_MVS + case EF_VMCMS: + case EF_MVS: + { + char type[100]; + + Info(slide, 0, ((char *)slide, + LoadFarString(VmMvsExtraField), + (getVMMVSexfield(type, ef_ptr-EB_HEADSIZE, + (unsigned)eb_datalen) > 0)? + type : LoadFarStringSmall(VmMvsInvalid))); + } + break; +#endif /* CMS_MVS */ + case EF_BEOS: + if (eb_datalen >= EB_BEOS_HLEN) { + ulg eb_uc = makelong(ef_ptr); + unsigned eb_is_uc = + *(ef_ptr+EB_FLGS_OFFS) & EB_BE_FL_UNCMPR; + + Info(slide, 0, ((char *)slide, LoadFarString(BeOSdata), + eb_uc, eb_is_uc ? "un" : nullStr)); + if (eb_is_uc) { + if (*pEndprev > 0L) + *pEndprev += makelong(ef_ptr); + } else { + *pEndprev = 0L; /* no clue about csize of local */ + } + } + break; + case EF_QDOS: + if (eb_datalen >= 4) { + Info(slide, 0, ((char *)slide, LoadFarString(QDOSdata), + ef_ptr[0], ef_ptr[1], ef_ptr[2], ef_ptr[3])); + } + break; + case EF_AOSVS: + if (eb_datalen >= 5) { + Info(slide, 0, ((char *)slide, LoadFarString(AOSVSdata), + ((int)(uch)ef_ptr[4])/10, ((int)(uch)ef_ptr[4])%10)); + } + break; + case EF_MD5: + if (eb_datalen >= 19) { + char md5[33]; + int i; + + for (i = 0; i < 16; ++i) + sprintf(&md5[i<<1], "%02x", ef_ptr[15-i]); + md5[32] = '\0'; + Info(slide, 0, ((char *)slide, LoadFarString(MD5data), + md5)); + break; + } /* else: fall through !! */ + default: + if (eb_datalen > 0) { + ush i, n; + + if (eb_datalen <= 24) { + Info(slide, 0, ((char *)slide, + LoadFarString(ColonIndent))); + n = eb_datalen; + } else { + Info(slide, 0, ((char *)slide, + LoadFarString(First20))); + n = 20; + } + for (i = 0; i < n; ++i) + Info(slide, 0, ((char *)slide, + LoadFarString(efFormat), ef_ptr[i])); + } + break; + } + (*G.message)((zvoid *)&G, (uch *)".", 1L, 0); + + ef_ptr += eb_datalen; + ef_len -= eb_datalen; + } + (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0); + } + + /* high bit == Unix/OS2/NT GMT times (mtime, atime); next bit == UID/GID */ + if ((xattr = (ush)((G.crec.external_file_attributes & 0xC000) >> 12)) & 8) + { + if (hostnum == UNIX_ || hostnum == FS_HPFS_ || hostnum == FS_NTFS_) + { + Info(slide, 0, ((char *)slide, LoadFarString(lExtraFieldType), + "is", EF_IZUNIX, LoadFarStringSmall(efIZUnix), + (unsigned)(xattr&12), (xattr&4)? efIZuid : efIZnouid)); + if (*pEndprev > 0L) + *pEndprev += (ulg)(xattr&12); + } + else if (hostnum == FS_FAT_ && !(xattr&4)) + Info(slide, 0, ((char *)slide, LoadFarString(lExtraFieldType), + "may be", EF_IZUNIX, LoadFarStringSmall(efIZUnix), 8, + efIZnouid)); + } + + if (!G.crec.file_comment_length) + Info(slide, 0, ((char *)slide, LoadFarString(NoFileComment))); + else { + Info(slide, 0, ((char *)slide, LoadFarString(FileCommBegin))); + if ((error = do_string(__G__ G.crec.file_comment_length, DISPL_8)) != + PK_COOL) + { + error_in_archive = error; /* might be warning */ + if (error > PK_WARN) /* fatal */ + return error; + } + Info(slide, 0, ((char *)slide, LoadFarString(FileCommEnd))); + } + + return error_in_archive; + +} /* end function zi_long() */ + + + + + +/*************************/ +/* Function zi_short() */ +/*************************/ + +static int zi_short(__G) /* return PK-type error code */ + __GDEF +{ +#ifdef USE_EF_UT_TIME + iztimes z_utime; + time_t *z_modtim; +#endif + int k, error, error_in_archive=PK_COOL; + ush methnum, hostnum, hostver, xattr; + char *p, workspace[12], attribs[16]; + char methbuf[5]; + static ZCONST char dtype[5]="NXFS"; /* normal, maximum, fast, superfast */ + static ZCONST char Far os[NUM_HOSTS+1][4] = { + "fat", "ami", "vms", "unx", "cms", "atr", "hpf", "mac", "zzz", + "cpm", "t20", "ntf", "qds", "aco", "vft", "mvs", "be ", "nsk", + "???" + }; + static ZCONST char Far method[NUM_METHODS+1][5] = { + "stor", "shrk", "re:1", "re:2", "re:3", "re:4", "i#:#", "tokn", + "def#", "edef", "dcli", "u###" + }; + + +/*--------------------------------------------------------------------------- + Print out various interesting things about the compressed file. + ---------------------------------------------------------------------------*/ + + methnum = (ush)MIN(G.crec.compression_method, NUM_METHODS); + hostnum = (ush)(G.pInfo->hostnum); + hostver = G.crec.version_made_by[0]; +/* + extnum = MIN(G.crec.version_needed_to_extract[1], NUM_HOSTS); + extver = G.crec.version_needed_to_extract[0]; + */ + + zfstrcpy(methbuf, method[methnum]); + if (methnum == IMPLODED) { + methbuf[1] = (char)((G.crec.general_purpose_bit_flag & 2)? '8' : '4'); + methbuf[3] = (char)((G.crec.general_purpose_bit_flag & 4)? '3' : '2'); + } else if (methnum == DEFLATED) { + ush dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3); + methbuf[3] = dtype[dnum]; + } else if (methnum >= NUM_METHODS) { /* unknown */ + sprintf(&methbuf[1], "%03u", G.crec.compression_method); + } + + for (k = 0; k < 15; ++k) + attribs[k] = ' '; + attribs[15] = 0; + + xattr = (ush)((G.crec.external_file_attributes >> 16) & 0xFFFF); + switch (hostnum) { + case VMS_: + { int i, j; + + for (k = 0; k < 12; ++k) + workspace[k] = 0; + if (xattr & VMS_IRUSR) + workspace[0] = 'R'; + if (xattr & VMS_IWUSR) { + workspace[1] = 'W'; + workspace[3] = 'D'; + } + if (xattr & VMS_IXUSR) + workspace[2] = 'E'; + if (xattr & VMS_IRGRP) + workspace[4] = 'R'; + if (xattr & VMS_IWGRP) { + workspace[5] = 'W'; + workspace[7] = 'D'; + } + if (xattr & VMS_IXGRP) + workspace[6] = 'E'; + if (xattr & VMS_IROTH) + workspace[8] = 'R'; + if (xattr & VMS_IWOTH) { + workspace[9] = 'W'; + workspace[11] = 'D'; + } + if (xattr & VMS_IXOTH) + workspace[10] = 'E'; + + p = attribs; + for (k = j = 0; j < 3; ++j) { /* groups of permissions */ + for (i = 0; i < 4; ++i, ++k) /* perms within a group */ + if (workspace[k]) + *p++ = workspace[k]; + *p++ = ','; /* group separator */ + } + *--p = ' '; /* overwrite last comma */ + if ((p - attribs) < 12) + sprintf(&attribs[12], "%d.%d", hostver/10, hostver%10); + } + break; + + case FS_FAT_: + case FS_HPFS_: + case FS_NTFS_: + case VM_CMS_: + case FS_VFAT_: + case MVS_: + case ACORN_: + xattr = (ush)(G.crec.external_file_attributes & 0xFF); + sprintf(attribs, ".r.-... %d.%d", hostver/10, hostver%10); + attribs[2] = (xattr & 0x01)? '-' : 'w'; + attribs[5] = (xattr & 0x02)? 'h' : '-'; + attribs[6] = (xattr & 0x04)? 's' : '-'; + attribs[4] = (xattr & 0x20)? 'a' : '-'; + if (xattr & 0x10) { + attribs[0] = 'd'; + attribs[3] = 'x'; + } else + attribs[0] = '-'; + if (IS_VOLID(xattr)) + attribs[0] = 'V'; + else if ((p = strrchr(G.filename, '.')) != (char *)NULL) { + ++p; + if (STRNICMP(p, "com", 3) == 0 || STRNICMP(p, "exe", 3) == 0 || + STRNICMP(p, "btm", 3) == 0 || STRNICMP(p, "cmd", 3) == 0 || + STRNICMP(p, "bat", 3) == 0) + attribs[3] = 'x'; + } + break; + + case AMIGA_: + switch (xattr & AMI_IFMT) { + case AMI_IFDIR: attribs[0] = 'd'; break; + case AMI_IFREG: attribs[0] = '-'; break; + default: attribs[0] = '?'; break; + } + attribs[1] = (xattr & AMI_IHIDDEN)? 'h' : '-'; + attribs[2] = (xattr & AMI_ISCRIPT)? 's' : '-'; + attribs[3] = (xattr & AMI_IPURE)? 'p' : '-'; + attribs[4] = (xattr & AMI_IARCHIVE)? 'a' : '-'; + attribs[5] = (xattr & AMI_IREAD)? 'r' : '-'; + attribs[6] = (xattr & AMI_IWRITE)? 'w' : '-'; + attribs[7] = (xattr & AMI_IEXECUTE)? 'e' : '-'; + attribs[8] = (xattr & AMI_IDELETE)? 'd' : '-'; + sprintf(&attribs[12], "%d.%d", hostver/10, hostver%10); + break; + + default: /* assume Unix-like */ + switch ((unsigned)(xattr & UNX_IFMT)) { + case (unsigned)UNX_IFDIR: attribs[0] = 'd'; break; + case (unsigned)UNX_IFREG: attribs[0] = '-'; break; + case (unsigned)UNX_IFLNK: attribs[0] = 'l'; break; + case (unsigned)UNX_IFBLK: attribs[0] = 'b'; break; + case (unsigned)UNX_IFCHR: attribs[0] = 'c'; break; + case (unsigned)UNX_IFIFO: attribs[0] = 'p'; break; + case (unsigned)UNX_IFSOCK: attribs[0] = 's'; break; + default: attribs[0] = '?'; break; + } + attribs[1] = (xattr & UNX_IRUSR)? 'r' : '-'; + attribs[4] = (xattr & UNX_IRGRP)? 'r' : '-'; + attribs[7] = (xattr & UNX_IROTH)? 'r' : '-'; + attribs[2] = (xattr & UNX_IWUSR)? 'w' : '-'; + attribs[5] = (xattr & UNX_IWGRP)? 'w' : '-'; + attribs[8] = (xattr & UNX_IWOTH)? 'w' : '-'; + + if (xattr & UNX_IXUSR) + attribs[3] = (xattr & UNX_ISUID)? 's' : 'x'; + else + attribs[3] = (xattr & UNX_ISUID)? 'S' : '-'; /* S==undefined */ + if (xattr & UNX_IXGRP) + attribs[6] = (xattr & UNX_ISGID)? 's' : 'x'; /* == UNX_ENFMT */ + else + /* attribs[6] = (xattr & UNX_ISGID)? 'l' : '-'; real 4.3BSD */ + attribs[6] = (xattr & UNX_ISGID)? 'S' : '-'; /* SunOS 4.1.x */ + if (xattr & UNX_IXOTH) + attribs[9] = (xattr & UNX_ISVTX)? 't' : 'x'; /* "sticky bit" */ + else + attribs[9] = (xattr & UNX_ISVTX)? 'T' : '-'; /* T==undefined */ + + sprintf(&attribs[12], "%d.%d", hostver/10, hostver%10); + break; + + } /* end switch (hostnum: external attributes format) */ + + Info(slide, 0, ((char *)slide, "%s %s %8lu ", attribs, + LoadFarStringSmall(os[hostnum]), G.crec.ucsize)); + Info(slide, 0, ((char *)slide, "%c", + (G.crec.general_purpose_bit_flag & 1)? + ((G.crec.internal_file_attributes & 1)? 'T' : 'B') : /* encrypted */ + ((G.crec.internal_file_attributes & 1)? 't' : 'b'))); /* plaintext */ + k = (G.crec.extra_field_length || + /* a local-only "UX" (old Unix/OS2/NT GMT times "IZUNIX") e.f.? */ + ((G.crec.external_file_attributes & 0x8000) && + (hostnum == UNIX_ || hostnum == FS_HPFS_ || hostnum == FS_NTFS_))); + Info(slide, 0, ((char *)slide, "%c", k? + ((G.crec.general_purpose_bit_flag & 8)? 'X' : 'x') : /* extra field */ + ((G.crec.general_purpose_bit_flag & 8)? 'l' : '-'))); /* no extra field */ + /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ extended local header or not */ + + if (uO.lflag == 4) { + ulg csiz = G.crec.csize; + + if (G.crec.general_purpose_bit_flag & 1) + csiz -= 12; /* if encrypted, don't count encryption header */ + Info(slide, 0, ((char *)slide, "%3d%%", + (ratio(G.crec.ucsize,csiz)+5)/10)); + } else if (uO.lflag == 5) + Info(slide, 0, ((char *)slide, " %8lu", G.crec.csize)); + + /* Read the extra field, if any. The extra field info may be used + * in the file modification time section, below. + */ + if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD)) != 0) + { + if (G.extra_field != NULL) { + free(G.extra_field); + G.extra_field = NULL; + } + error_in_archive = error; + /* We do not return prematurely in case of a "fatal" error (PK_EOF). + * This does not hurt here, because we do not need to read from the + * zipfile again before the end of this function. + */ + } + + /* For printing of date & time, a "char d_t_buf[16]" is required. + * To save stack space, we reuse the "char attribs[16]" buffer whose + * content is no longer needed. + */ +# define d_t_buf attribs +#ifdef USE_EF_UT_TIME + z_modtim = G.extra_field && +#ifdef IZ_CHECK_TZ + G.tz_is_valid && +#endif + (ef_scan_for_izux(G.extra_field, G.crec.extra_field_length, 1, + G.crec.last_mod_dos_datetime, &z_utime, NULL) + & EB_UT_FL_MTIME) + ? &z_utime.mtime : NULL; + TIMET_TO_NATIVE(z_utime.mtime) /* NOP unless MSC 7.0 or Macintosh */ + d_t_buf[0] = (char)0; /* signal "show local time" */ +#else +# define z_modtim NULL +#endif + Info(slide, 0, ((char *)slide, " %s %s ", methbuf, + zi_time(__G__ &G.crec.last_mod_dos_datetime, z_modtim, d_t_buf))); + fnprint(__G); + +/*--------------------------------------------------------------------------- + Skip the file comment, if any (the filename has already been printed, + above). That finishes up this file entry... + ---------------------------------------------------------------------------*/ + + SKIP_(G.crec.file_comment_length) + + return error_in_archive; + +} /* end function zi_short() */ + + + + + +/**************************************/ +/* Function zi_showMacTypeCreator() */ +/**************************************/ + +static void zi_showMacTypeCreator(__G__ ebfield) + __GDEF + uch *ebfield; +{ + /* not every Type / Creator character is printable */ + if (isprint(ebfield[0]) && isprint(ebfield[1]) && + isprint(ebfield[2]) && isprint(ebfield[3]) && + isprint(ebfield[4]) && isprint(ebfield[5]) && + isprint(ebfield[6]) && isprint(ebfield[7])) { + Info(slide, 0, ((char *)slide, LoadFarString(MacOSdata), + ebfield[0], ebfield[1], ebfield[2], ebfield[3], + ebfield[4], ebfield[5], ebfield[6], ebfield[7])); + } else { + Info(slide, 0, ((char *)slide, LoadFarString(MacOSdata1), + (((ulg)ebfield[0]) << 24) + + (((ulg)ebfield[1]) << 16) + + (((ulg)ebfield[2]) << 8) + + ((ulg)ebfield[3]), + (((ulg)ebfield[4]) << 24) + + (((ulg)ebfield[5]) << 16) + + (((ulg)ebfield[6]) << 8) + + ((ulg)ebfield[7]))); + } +} /* end function zi_showMacTypeCreator() */ + + + + + +/************************/ +/* Function zi_time() */ +/************************/ + +static char *zi_time(__G__ datetimez, modtimez, d_t_str) + __GDEF + ZCONST ulg *datetimez; + ZCONST time_t *modtimez; + char *d_t_str; +{ + unsigned yr, mo, dy, hh, mm, ss; + char monthbuf[4]; + ZCONST char *monthstr; + static ZCONST char Far month[12][4] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; +#ifdef USE_EF_UT_TIME + struct tm *t; +#endif + + + +/*--------------------------------------------------------------------------- + Convert the file-modification date and time info to a string of the form + "1991 Feb 23 17:15:00", "23-Feb-91 17:15" or "19910223.171500", depending + on values of lflag and T_flag. If using Unix-time extra fields, convert + to local time or not, depending on value of first character in d_t_str[]. + ---------------------------------------------------------------------------*/ + +#ifdef USE_EF_UT_TIME + if (modtimez != NULL) { +#ifndef NO_GMTIME + /* check for our secret message from above... */ + t = (d_t_str[0] == (char)1)? gmtime(modtimez) : localtime(modtimez); +#else + t = localtime(modtimez); +#endif + if (uO.lflag > 9 && t == (struct tm *)NULL) + /* time conversion error in verbose listing format, + * return string with '?' instead of data + */ + return (strcpy(d_t_str, LoadFarString(YMDHMSTimeError))); + } else + t = (struct tm *)NULL; + if (t != (struct tm *)NULL) { + mo = (unsigned)(t->tm_mon + 1); + dy = (unsigned)(t->tm_mday); + yr = (unsigned)(t->tm_year); + + hh = (unsigned)(t->tm_hour); + mm = (unsigned)(t->tm_min); + ss = (unsigned)(t->tm_sec); + } else +#endif /* USE_EF_UT_TIME */ + { + yr = ((unsigned)(*datetimez >> 25) & 0x7f) + 80; + mo = ((unsigned)(*datetimez >> 21) & 0x0f); + dy = ((unsigned)(*datetimez >> 16) & 0x1f); + + hh = (((unsigned)*datetimez >> 11) & 0x1f); + mm = (((unsigned)*datetimez >> 5) & 0x3f); + ss = (((unsigned)*datetimez << 1) & 0x3e); + } + + if (mo == 0 || mo > 12) { + sprintf(monthbuf, LoadFarString(BogusFmt), mo); + monthstr = monthbuf; + } else + monthstr = LoadFarStringSmall(month[mo-1]); + + if (uO.lflag > 9) /* verbose listing format */ + sprintf(d_t_str, LoadFarString(YMDHMSTime), yr+1900, monthstr, dy, hh, + mm, ss); + else if (uO.T_flag) + sprintf(d_t_str, LoadFarString(DecimalTime), yr+1900, mo, dy, hh, mm, + ss); + else /* was: if ((uO.lflag >= 3) && (uO.lflag <= 5)) */ + sprintf(d_t_str, LoadFarString(DMYHMTime), dy, monthstr, yr%100, hh, + mm); + + return d_t_str; + +} /* end function zi_time() */ + +#endif /* !NO_ZIPINFO */ diff --git a/utils/Install/wxmain.cpp b/utils/Install/wxmain.cpp new file mode 100644 index 0000000000..39cbad18ce --- /dev/null +++ b/utils/Install/wxmain.cpp @@ -0,0 +1,316 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include "wx/resource.h" +#include "install.h" +#include "instsup.h" + +#include <ctype.h> + +#if !defined(__EMX__) && !defined(__OS2__) && !defined(WIN32) && !defined(WINNT) +#define stricmp strcasecmp +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern char installdir[]; + +#ifdef __cplusplus +} +#endif + +typedef struct _wxCommands { + int id; + char file[50]; +} wxCommands; + +#define COMMANDMAX 20 + +wxCommands wxcommands[COMMANDMAX]; +char finishedscript[256] = ""; +char percentname[256] = ""; + +class MyApp: public wxApp +{ +public: + MyApp(); + + virtual bool OnInit(); + + virtual ~MyApp(); +}; + +class MyDialog : public wxDialog +{ +public: + void handle_button(wxCommandEvent& event); +}; + +class MyThread : public wxThread +{ +public: + virtual void *Entry(); +}; + +void *MyThread::Entry() +{ + install_thread(NULL); + return NULL; +} + +MyDialog *dialog = NULL; + +IMPLEMENT_APP(MyApp) + +MyApp::MyApp() +{ +} + +wxCondition *InstCond = NULL; + +void updatepercent(void) +{ + wxGauge *tmp = (wxGauge *)wxFindWindowByName(percentname, dialog); + + if(tmp) + { + unsigned long sliderpos; + int pixels = 100; + extern int current_file, files; + + sliderpos = (unsigned long)(((float)(current_file)/(float)files)*pixels); + tmp->SetValue(sliderpos); + } +} + +int parse_ini(char *filename) +{ + FILE *f; + int b; + + for(b=0;b<COMMANDMAX;b++) + { + wxcommands[b].id = 0; + wxcommands[b].file[0] = 0; + } + + grabfile(filename); + if((f=fopen(filename, "r")) != NULL) + { + int bytesread = 1; + char raw[256], entry[256], entrydata[256], entrydata2[256]; + + /* figure out why we are not getting an EOF on windows... + bytesread is a hack to make sure it doesn't loop forever. */ + while(!feof(f) && bytesread) + { + bytesread = getparseline(f, '#', ',', '\"', raw, entry, entrydata, entrydata2); + if(stricmp(entry, "loadwxr") == 0) + { + grabfile(entrydata); + if(!wxResourceParseFile(entrydata)) + { + error("Error loading resources!"); + remove(entrydata); + remove(filename); + return FALSE; + } + remove(entrydata); + + dialog = new MyDialog; + + dialog->LoadFromResource(NULL, "dialog1"); + dialog->Show(TRUE); + + /*MyApp::SetTopWindow(dialog);*/ + } + else if(stricmp(entry, "closeold") == 0) + { + if(dialog) + dialog->Destroy(); + dialog = NULL; + } + else if(stricmp(entry, "getcheck") == 0) + { + wxCheckBox *tmp = (wxCheckBox *)wxFindWindowByName(entrydata, dialog); + + if(tmp) + { + if(!tmp->GetValue()) + { + parse_ini(entrydata2); + bytesread = 0; + } + } + } + else if(stricmp(entry, "gettext") == 0) + { + wxTextCtrl *tmp = (wxTextCtrl *)wxFindWindowByName(entrydata, dialog); + wxString bleah; + + if(tmp) + { + if((bleah = tmp->GetValue())) + strcpy(installdir, bleah); + } + } + else if(stricmp(entry, "settext") == 0) + { + wxTextCtrl *tmp = (wxTextCtrl *)wxFindWindowByName(entrydata, dialog); + + if(tmp) + tmp->SetValue(installdir); + } + else if(stricmp(entry, "message") == 0) + mesg(entrydata); + else if(stricmp(entry, "disable") == 0) + { + wxButton *tmp = (wxButton *)wxFindWindowByName(entrydata, dialog); + if(tmp) + tmp->Disable(); + } + else if(stricmp(entry, "grabfile") == 0) + grabfile(entrydata); + else if(stricmp(entry, "remove") == 0) + remove(entrydata); + else if(stricmp(entry, "system") == 0) + wxExecute(entrydata); + else if(stricmp(entry, "startinst") == 0) + { + strcpy(percentname, entrydata); + strcpy(finishedscript, entrydata2); + + /* I couldn't get it working with threads, even when + using conditions it blocked the message loop making + it unreadable, so I am going with wxYield for the + moment. */ +#if 0 + MyThread *thread = new MyThread(); + + if ( thread->Create() != wxTHREAD_NO_ERROR ) + { + error("Can't create thread!"); + } + strcpy(finishedscript, entrydata); + + InstCond = new wxCondition(); + + thread->Run(); + + wxMutex *test = new wxMutex(); + + InstCond->Wait(*test); +#endif + install_thread(NULL); + create_wps_objects(); + parse_ini(finishedscript); + } + else if(stricmp(entry, "mleview") == 0) + { + FILE *f; + unsigned long bytes; + char buffer[1025]; + wxTextCtrl *tmp = (wxTextCtrl *)wxFindWindowByName(entrydata, dialog); + + if(tmp) + { + grabfile(entrydata2); + + if((f = fopen(entrydata2, "rb"))!= NULL) + { + while(!feof(f)) + { + memset(buffer, 0, 1025); + bytes = fread(buffer, 1, 1024, f); + *tmp << buffer; + } + fclose(f); + } + remove(entrydata2); + tmp->ShowPosition(0); + } + + } + else if(stricmp(entry, "setbutton") == 0) + { + for(b=0;b<COMMANDMAX;b++) + { + if(!wxcommands[b].id) + { + wxcommands[b].id = atoi(entrydata); + strcpy(wxcommands[b].file, entrydata2); + b = COMMANDMAX; + } + } + dialog->Connect( atol(entrydata), -1, wxEVT_COMMAND_BUTTON_CLICKED, + (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) + &MyDialog::handle_button); + + } + } + fclose(f); + remove(filename); + return TRUE; + } + remove(filename); + return FALSE; +} + +void MyDialog::handle_button(wxCommandEvent& event ) +{ + int b; + + for(b=0;b<COMMANDMAX;b++) + { + if(wxcommands[b].id && + wxcommands[b].id == event.GetId()) + { + char tempbuf[50]; + + strcpy(tempbuf, wxcommands[b].file); + if(stricmp(tempbuf, "exit") == 0) + exit(0); + grabfile(tempbuf); + if(!parse_ini(tempbuf)) + { + error("Error loading script \"%s\"", tempbuf); + exit(1); + } + remove(tempbuf); + return; + } + } + +} + +bool MyApp::OnInit(void) +{ +#if 1 + install_init(argv[0]); +#else + install_init("install.exe"); +#endif + + if(!parse_ini("page1.ini")) + { + error("Could not load startup script!"); + return FALSE; + } + + return TRUE; +} + +MyApp::~MyApp() +{ +} + + diff --git a/utils/dialoged/docs/back.gif b/utils/dialoged/docs/back.gif index 8a61076d3ba74bdedc1d24f60c3d1f5a361a6cee..72808755554c36d7f3c86cb253f0f0314947b33f 100644 GIT binary patch literal 877 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0fnz;`IEReKh6M+kIfS)hPHb3s zxLrWmYmUc8MFs{@V=tBk4vcQS3gSg?UKlR%Y*zN1W>fj;(a}CV`%O8V#mmmJDyQBv OnOUrUdY)b7H68$h?f`fI literal 225 zcmV<703QEGNk%v~VLt#E0Pz3-zrVld=jU&4Z(9HWEC2ui06zd20008IjE||y?GK}z zNf>~$-n{z{YJwGn=81mem9{RpmcUHc_KoNIPRH~B4DyD9p%LJl6@Sa4^Epcbno6kk zD5XxT&EQg7><X(t<v2<zGtFvpm%NS3x723V`)<ec-&(({)sqHiQ-=rlS4S8Ibd!~% zh!dt38EIxWIOn%1Dfj2b8T!~6YUzo%W;uEjc(%yY2)pMhb!7`xd#gK?yX%Y7`zwsb bGHgs7FrvK7-0b`e9qpVfU2T0WT>t<(Iwfoo diff --git a/utils/dialoged/docs/body.tex b/utils/dialoged/docs/body.tex index c88202c1ac..db941abadf 100644 --- a/utils/dialoged/docs/body.tex +++ b/utils/dialoged/docs/body.tex @@ -41,12 +41,15 @@ all dialogs in a particular directory. \subsection{File menu} \begin{twocollist}\itemsep=0pt -\twocolitem{New dialog}{Creates a new dialog resource.} -\twocolitem{New project}{Creates a new project (clears index and resets project name).} -\twocolitem{Open}{Opens an existing resource file.} +\twocolitem{New Dialog}{Creates a new dialog resource.} +\twocolitem{New Project}{Creates a new project (clears index and resets project name).} +\twocolitem{Open...}{Opens an existing resource file.} \twocolitem{Save}{Saves the current resources.} \twocolitem{Save As...}{Saves the current resources in a named file.} \twocolitem{Clear}{Clears the current resources.} +\twocolitem{Convert Old Resources...}{Takes a directory of wxWindows 1.68 dialog resources, +and converts them to wxWindows 2 resources, in a separate directory. See +\helpref{Converting old files}{convertingoldfiles}.} \twocolitem{Exit}{Exits the program.} \end{twocollist} @@ -63,7 +66,7 @@ item.} \subsection{Help menu} \begin{twocollist}\itemsep=0pt -\twocolitem{Help topics}{Displays on-line help at the contents page.} +\twocolitem{Help Topics}{Displays on-line help at the contents page.} \twocolitem{About}{Displays an dialog showing the Dialog Editor version and author.} \end{twocollist} @@ -76,15 +79,21 @@ The command toolbar consists of the following tools: \twocolitem{\icon{new.eps}{New}}{Clears the project.} \twocolitem{\icon{open.eps}{Open}}{Opens an existing resource file.} \twocolitem{\icon{save.eps}{Save}}{Saves the current resources.} -\twocolitem{\icon{vert.eps}{Horizontal align}}{Aligns the centre of the selected items horizontally.} -\twocolitem{\icon{alignt.eps}{Horizontal top-align}}{Aligns the top sides of the selected items horizontally.} -\twocolitem{\icon{alignb.eps}{Horizontal bottom-align}}{Aligns the bottom sides of the selected items horizontally.} -\twocolitem{\icon{horiz.eps}{Vertical align}}{Aligns the centre of the selected items vertically.} -\twocolitem{\icon{alignl.eps}{Vertical left-align}}{Aligns the left sides of the selected items vertically.} -\twocolitem{\icon{alignr.eps}{Vertical right-align}}{Aligns the right sides of the selected items vertically.} -\twocolitem{\icon{copysize.eps}{Copy size}}{Copies the size of the first selected item to the subsequently selected item(s).} -\twocolitem{\icon{tofront.eps}{To front}}{Puts the selected item(s) to the front of the display list.} -\twocolitem{\icon{toback.eps}{To back}}{Puts the selected item(s) to the back of the display list.} +\twocolitem{\icon{vert.eps}{Horizontal align}}{Aligns the centre of the selected controls horizontally.} +\twocolitem{\icon{alignt.eps}{Horizontal top-align}}{Aligns the top sides of the selected controls horizontally.} +\twocolitem{\icon{alignb.eps}{Horizontal bottom-align}}{Aligns the bottom sides of the selected controls horizontally.} +\twocolitem{\icon{horiz.eps}{Vertical align}}{Aligns the centre of the selected controls vertically.} +\twocolitem{\icon{alignl.eps}{Vertical left-align}}{Aligns the left sides of the selected controls vertically.} +\twocolitem{\icon{alignr.eps}{Vertical right-align}}{Aligns the right sides of the selected controls vertically.} +\twocolitem{\icon{copysize.eps}{Copy size}}{Copies the size of the first selected control to the subsequently selected control(s).} +\twocolitem{\icon{copywdth.eps}{Copy width}}{Copies the width of the first selected control to the subsequently selected control(s).} +\twocolitem{\icon{copyhght.eps}{Copy height}}{Copies the height of the first selected control to the subsequently selected control(s).} +\twocolitem{\icon{disthor.eps}{Distribute horizontally}}{Evenly distributes the space between the selected controls, horizontally. Note that the controls +should be selected in order from left to right.} +\twocolitem{\icon{distvert.eps}{Distribute vertically}}{Evenly distributes the space between the selected controls, vertically. Note that the controls +should be selected in order from top to bottom.} +\twocolitem{\icon{tofront.eps}{To front}}{Puts the selected control(s) to the front of the display list.} +\twocolitem{\icon{toback.eps}{To back}}{Puts the selected control(s) to the back of the display list.} \twocolitem{\icon{help.eps}{Help}}{Invokes Dialog Editor help.} \end{twocollist} @@ -198,3 +207,28 @@ resource files for different platforms, with spacing modified to suit each environment. The best thing is to try your dialog resource on several platforms and see whether tweaking is required for some platforms. +\section{Converting old files}\label{convertingoldfiles} + +Dialog Editor can make an attempt at converting dialog resources created with Dialog Editor for wxWindows 1.68. +The command is {\bf Convert Old Resources...} on the {\bf File} menu. + +You need to specify two directories, an input and an output directory. Dialog Editor will +do the following conversions: + +\begin{enumerate}\itemsep=0pt +\item wxMultiText becomes a wxTextCtrl with wxTE\_MULTILINE style. +\item wxText becomes a wxTextCtrl. +\item wxMessage becomes either a wxStaticText or wxStaticBitmap. +\item wxButton becomes a wxBitmapButton if necessary. +\item wxGroupBox becomes wxStaticBox. +\item Controls that no longer have labels, such as wxTextCtrl and wxListBox, +have a separate wxStaticText control created for them at approximately the correct +position. The label's window name becomes ControlName_Label where ControlName is +the name of the control that formerly had the label. +\item Identifiers are allocated. +\item Font sizes are reduced to counter the decreased font size now created by wxWindows +for a given point size. +\item The dialog height is reduced slightly to compensate for the fact that the dialog caption +is no longer included in the size. +\end{enumerate} + diff --git a/utils/dialoged/docs/changes.tex b/utils/dialoged/docs/changes.tex index fbe44245ff..b091a6f5a1 100644 --- a/utils/dialoged/docs/changes.tex +++ b/utils/dialoged/docs/changes.tex @@ -2,6 +2,15 @@ \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% \setfooter{\thepage}{}{}{}{}{\thepage}% +April 22nd, 2000 Version 2.1 + +\begin{itemize}\itemsep=0pt +\item Various bug fixes. +\item Added buttons for distributing space horizontally and vertically, and +for copying width and height independently. +\item Added 'Convert old resources' facility. +\end{itemize} + December 31st 1998, Version 2.0 \begin{itemize}\itemsep=0pt diff --git a/utils/dialoged/docs/contents.gif b/utils/dialoged/docs/contents.gif index 3dddfa3dd5f0c652e8b27cd6c29e1fdd49ced5a8..27b90fa28e4eea638b6e3e60fb98268609137a53 100644 GIT binary patch literal 821 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0RsaNgBYV=Gz5lX2>kxA zV8N1xh6Z3tW&ovR5Cx<mX<G3o3nK#qH-ipPlmV0{7&s0xh;ztzY*=uxnL}7B=ER1D IhuZ~|0TP<%=l}o! literal 231 zcmV<D02u#ANk%v~VL<>G0Pz3-zrVld=jU&4Z(9HWEC2ui06_p40008OjE||y?GK}z zO&EZ)-n{z{a)K3v=81;mmA0<AmhVhw@iyc`&3|{61I~6YqK~98Vw5OmQ-xfDbjF=- z8N_A**6fx0#r(KaDON}}o43Sv(iTm3lx}qOEl<})aVL6>S4Fj_r^UyThZDG{h6k9m zHI_(7spd!5_$SH6m{<Auh$$AQ#YFX|N5^T`76u^M6AJ<hP-}aOo2$Fa+xtrD8!SAm hOG|u=TnwDd%p5ZU9W6agU2T1B9e};f-Q8UP06VhvYa0Ln diff --git a/utils/dialoged/docs/copyhght.bmp b/utils/dialoged/docs/copyhght.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9ee3fd18071dfacb139d15f34afd530fdf879332 GIT binary patch literal 238 zcmZ?rea8R+Wk5;;hy{R{ABY(lSb!u0Lj{<`M(k%`03wF{`ymvN1Tq;895}$x(9i&s z_zy-5|NnznKn#Q+As|r>1neLJC=LW*CWs5-7l8QOyEhc<-c33U(+@TbVjj$VkR<?} C_C)aj literal 0 HcmV?d00001 diff --git a/utils/dialoged/docs/copyhght.gif b/utils/dialoged/docs/copyhght.gif new file mode 100644 index 0000000000000000000000000000000000000000..965cd2b42874feb9b24398c8a95d14477f940b2d GIT binary patch literal 125 zcmZ?wbhEHb6ky<I*vtR|`@wiWnA#8I?caakz=4K_hW|kE{|x`Z6p#k8fItVN1EiOM z#puHcO~$<nuh*{s&z{~XykXAij%80*Eed<uwwdSh_S${b)w3;Q_;0K(aB`m@r0G?c JG@XON8UTNdGO+*v literal 0 HcmV?d00001 diff --git a/utils/dialoged/docs/copywdth.bmp b/utils/dialoged/docs/copywdth.bmp new file mode 100644 index 0000000000000000000000000000000000000000..0366fb655cc0614d8327f7b396de9b380838606a GIT binary patch literal 238 zcmZ?rea8R+Wk5;;hy{R{ABY(lSb!u0Lj{<`M(k%`03wF{`ymvN1Tq;895}$x(9i&s w_zy-5|NnznKn#Q+As|r>1MENvhJx~PcJAG~H{hco>I&FF8i6E<`e4=p0Ioenp#T5? literal 0 HcmV?d00001 diff --git a/utils/dialoged/docs/copywdth.gif b/utils/dialoged/docs/copywdth.gif new file mode 100644 index 0000000000000000000000000000000000000000..76642631bea00872fa19eae9ce3750582753ed86 GIT binary patch literal 127 zcmZ?wbhEHb6ky<I*vtR|`@wiWnA#8I?caakz=4K_hW|kE{|x`Z6p#k8fItVN1EiOM z#pJ^Y&(|#MFV-3#J)qS0V0!P8^0_a9)+PS-QrNyyGA(vj`hDB@)2+g%x)wY<(-C#8 L?&w`TCI)K&`$#qB literal 0 HcmV?d00001 diff --git a/utils/dialoged/docs/dialoged.tex b/utils/dialoged/docs/dialoged.tex index 441b3d238c..6107540e8f 100644 --- a/utils/dialoged/docs/dialoged.tex +++ b/utils/dialoged/docs/dialoged.tex @@ -4,9 +4,9 @@ %\special{!/@scaleunit 1 def} \parskip=10pt \parindent=0pt -\title{User Manual for Dialog Editor Version 2.0} +\title{User Manual for Dialog Editor Version 2.1} \winhelpignore{\author{Julian Smart, Anthemion Software} -\date{December 1998} +\date{April 2000} } \makeindex \begin{document} @@ -23,7 +23,7 @@ \setfooter{\thepage}{}{}{}{}{\thepage}% \begin{center} -Copyright (c) 1998 Julian Smart, Anthemion Software +Copyright (c) 2000 Julian Smart, Anthemion Software \end{center} Please see the wxWindows licence for conditions of use. diff --git a/utils/dialoged/docs/disthor.bmp b/utils/dialoged/docs/disthor.bmp new file mode 100644 index 0000000000000000000000000000000000000000..dcd3c8fde862b6e38396ab0241b76321100b18a5 GIT binary patch literal 238 zcmZ?rea8R+Wk5;;hy{R{ABY(lSb!u0Lj{<`M(k%`03wF{`ymvN1Tq;895}$x(9i&s p_zy-5|NnznKn#Q+As|r>1qBS{4D3LnU_&`KJCL9{4K*KT9{^AUNBsZ* literal 0 HcmV?d00001 diff --git a/utils/dialoged/docs/disthor.gif b/utils/dialoged/docs/disthor.gif new file mode 100644 index 0000000000000000000000000000000000000000..70fbbf96b255994ad607cebbb115b63f9f27150e GIT binary patch literal 123 zcmZ?wbhEHb6ky<I*vtR|`@wiWnA#8I?caakz=4K_hW|kE{|x`Z6p#k8fItVN1EiOM z#o)sU&($nHo;4q2=|0{n9@(Xk)tB{q=F6YE-soH}?|HoI+~L)70bdpun#uBBJT%3H Hfx#L8Jkc}- literal 0 HcmV?d00001 diff --git a/utils/dialoged/docs/distvert.bmp b/utils/dialoged/docs/distvert.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9f50a39dd2a9819885333fd17853991c0695c29e GIT binary patch literal 238 zcmZ?rea8R+Wk5;;hy{R{ABY(lSb!u0Lj{<`M(k%`03wF{`ymvN1Tq;895}$x(9i&s p_zy-5|NnznKn#Q+As|r>1qDEHAYd=p4F>EmK1?1)!^A072LP#ZK*#_9 literal 0 HcmV?d00001 diff --git a/utils/dialoged/docs/distvert.gif b/utils/dialoged/docs/distvert.gif new file mode 100644 index 0000000000000000000000000000000000000000..81cdd9486fc30ee8a97e5abc784d9ae5b007e0f9 GIT binary patch literal 113 zcmZ?wbhEHb6ky<I*vtR|`@wiWnA#8I?caakz=4K_hW|kE{|x`Z6p#k8fItVN1EiOM wMeV~0&($mz*|pREFJO;}?u^V>6}0ST>xYUhPqXeDpFLaP^Gf}W3KN4h02DwiiU0rr literal 0 HcmV?d00001 diff --git a/utils/dialoged/docs/forward.gif b/utils/dialoged/docs/forward.gif index 9c8421838a9822c3bcc3d5b9a40732a72647b558..f1379c14d361b2d7f64ca5e592bda4af94f147a8 100644 GIT binary patch literal 877 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0fnyGXIEReKh6M+kIfS)hPHb3s zxLrWmYmUc6#fEMMt*jmnhsLHJY3Haf96?J?Hp|-2i-|Ny^_-?1d#FXTc$r6!p5d)K OGcGBgoU2&9iUk0pF#!Sq literal 109 zcmZ?wbh9u|RArE0_{hMpfB*jH&!6Y#=SMRz=r8~QNSuMGwx@sP>9_k^7`NQ&{w!+r zf<Nhw$h7+}X1=->%KU9zk~i;0ZD#X^N5AuKea*5ueKt+`*Q6<lAAkPQ>=#S#sWkN~ N6xIITmGWvyEC7LnF*yJL diff --git a/utils/dialoged/docs/tex2rtf.ini b/utils/dialoged/docs/tex2rtf.ini index 8d897c9c63..fae9a56f09 100644 --- a/utils/dialoged/docs/tex2rtf.ini +++ b/utils/dialoged/docs/tex2rtf.ini @@ -14,6 +14,11 @@ htmlBrowseButtons = bitmap winHelpVersion = 3 winHelpContents = yes winHelpTitle = "Dialog Editor Manual" +;; +;; These two are for generating MS HTML Help project, contents and index files. +;; +htmlWorkshopFiles = true +htmlIndex = true truncateFilenames = yes \overview [2] { \sethotspotcolour{off}\sethotspotunderline{on}\winhelponly{\image{}{books.bmp}} \htmlonly{\image{}{books.gif}}\helpref{#1}{#2} diff --git a/utils/dialoged/docs/up.gif b/utils/dialoged/docs/up.gif index f9e7031e64cf9bd17eac8190eefce2526d90a052..870c89e80a826e3b225cc8fe9a30edf9c5a66c22 100644 GIT binary patch literal 998 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0f#WcPIEReKh6M+kIfS)hPHb3s zxLrWmYmUc8MFs{@V=tBk4vcQS3gSg?UKlR%Y*zN1W>fj;(a}CV`%O8V#mmmJDyQBv znOUrUdY)b7p%TfE<WsX;wdG=GmL&Ns@?GpT*Q<27-(3EUR##4aSao^5;NGM?9g}np z_6MXcGCdvoByvv1eJ&B}f}Gen<+rt#SZ_}_v)%vqI@ML?it&5Oe?N2Wl*mqONqVei lrfp&P=yaL+vexKtMaie;nK#$Ol;*#@ydrpYnS=m?H2|-sI%)s_ literal 6 NcmZ?wbh9u|1ONrB0jB@} diff --git a/utils/dialoged/src/bitmaps/copyhght.bmp b/utils/dialoged/src/bitmaps/copyhght.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9ee3fd18071dfacb139d15f34afd530fdf879332 GIT binary patch literal 238 zcmZ?rea8R+Wk5;;hy{R{ABY(lSb!u0Lj{<`M(k%`03wF{`ymvN1Tq;895}$x(9i&s z_zy-5|NnznKn#Q+As|r>1neLJC=LW*CWs5-7l8QOyEhc<-c33U(+@TbVjj$VkR<?} C_C)aj literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/copyhght.xpm b/utils/dialoged/src/bitmaps/copyhght.xpm new file mode 100644 index 0000000000..c91cb9dadd --- /dev/null +++ b/utils/dialoged/src/bitmaps/copyhght.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * copyhght_xpm[] = { +"16 15 3 1", +" c #c0c0c0", +". c Black", +"X c Yellow", +" . ", +" ............. ", +" ", +" ...... ...... ", +" .XXXX. .XXXX. ", +" .XXXX. .XXXX. ", +" .XXXX. .XXXX. ", +" .XXXX. .XXXX. ", +" .XXXX. .XXXX. ", +" .XXXX. .XXXX. ", +" .XXXX. .XXXX. ", +" ...... ...... ", +" ", +" ............. ", +" . "}; diff --git a/utils/dialoged/src/bitmaps/copywdth.bmp b/utils/dialoged/src/bitmaps/copywdth.bmp new file mode 100644 index 0000000000000000000000000000000000000000..0366fb655cc0614d8327f7b396de9b380838606a GIT binary patch literal 238 zcmZ?rea8R+Wk5;;hy{R{ABY(lSb!u0Lj{<`M(k%`03wF{`ymvN1Tq;895}$x(9i&s w_zy-5|NnznKn#Q+As|r>1MENvhJx~PcJAG~H{hco>I&FF8i6E<`e4=p0Ioenp#T5? literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/copywdth.xpm b/utils/dialoged/src/bitmaps/copywdth.xpm new file mode 100644 index 0000000000..9e0c0aa73f --- /dev/null +++ b/utils/dialoged/src/bitmaps/copywdth.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * copywdth_xpm[] = { +"16 15 3 1", +" c #c0c0c0", +". c Black", +"X c Yellow", +" ", +" . ........ . ", +" . .XXXXXX. . ", +" . .XXXXXX. . ", +" . .XXXXXX. . ", +" . .XXXXXX. . ", +" . ........ . ", +" .. .. ", +" . ........ . ", +" . .XXXXXX. . ", +" . .XXXXXX. . ", +" . .XXXXXX. . ", +" . .XXXXXX. . ", +" . ........ . ", +" "}; diff --git a/utils/dialoged/src/bitmaps/disthor.bmp b/utils/dialoged/src/bitmaps/disthor.bmp new file mode 100644 index 0000000000000000000000000000000000000000..dcd3c8fde862b6e38396ab0241b76321100b18a5 GIT binary patch literal 238 zcmZ?rea8R+Wk5;;hy{R{ABY(lSb!u0Lj{<`M(k%`03wF{`ymvN1Tq;895}$x(9i&s p_zy-5|NnznKn#Q+As|r>1qBS{4D3LnU_&`KJCL9{4K*KT9{^AUNBsZ* literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/disthor.xpm b/utils/dialoged/src/bitmaps/disthor.xpm new file mode 100644 index 0000000000..befa8fd0dd --- /dev/null +++ b/utils/dialoged/src/bitmaps/disthor.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * disthor_xpm[] = { +"16 15 3 1", +" c #c0c0c0", +". c Black", +"X c Yellow", +" ", +" ... ... ... ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" ... ... ... ", +" "}; diff --git a/utils/dialoged/src/bitmaps/distvert.bmp b/utils/dialoged/src/bitmaps/distvert.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9f50a39dd2a9819885333fd17853991c0695c29e GIT binary patch literal 238 zcmZ?rea8R+Wk5;;hy{R{ABY(lSb!u0Lj{<`M(k%`03wF{`ymvN1Tq;895}$x(9i&s p_zy-5|NnznKn#Q+As|r>1qDEHAYd=p4F>EmK1?1)!^A072LP#ZK*#_9 literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/distvert.xpm b/utils/dialoged/src/bitmaps/distvert.xpm new file mode 100644 index 0000000000..d6c39e40d7 --- /dev/null +++ b/utils/dialoged/src/bitmaps/distvert.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * distvert_xpm[] = { +"16 15 3 1", +" c #c0c0c0", +". c Black", +"X c Yellow", +" ", +" .............. ", +" .XXXXXXXXXXXX. ", +" .............. ", +" ", +" ", +" .............. ", +" .XXXXXXXXXXXX. ", +" .............. ", +" ", +" ", +" .............. ", +" .XXXXXXXXXXXX. ", +" .............. ", +" "}; diff --git a/utils/dialoged/src/dialoged.cpp b/utils/dialoged/src/dialoged.cpp index 776852971d..d59b19d8f1 100644 --- a/utils/dialoged/src/dialoged.cpp +++ b/utils/dialoged/src/dialoged.cpp @@ -28,8 +28,8 @@ IMPLEMENT_APP(MyApp) BEGIN_EVENT_TABLE(MyApp, wxApp) - EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu) - EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu) +EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu) +EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu) END_EVENT_TABLE() MyApp::MyApp(void) @@ -44,14 +44,14 @@ bool MyApp::OnInit(void) { theResourceManager = new wxResourceManager; theResourceManager->Initialize(); - + theResourceManager->ShowResourceEditor(TRUE); - + if (argc > 1) theResourceManager->Load(argv[1]); - + SetTopWindow(theResourceManager->GetEditorFrame()); - + return TRUE; } diff --git a/utils/dialoged/src/dialoged.h b/utils/dialoged/src/dialoged.h index 72abac89c1..458733bc17 100644 --- a/utils/dialoged/src/dialoged.h +++ b/utils/dialoged/src/dialoged.h @@ -26,16 +26,16 @@ class MyChild; // Define a new application class MyApp: public wxApp { - public: +public: MyApp(void); bool OnInit(void); int OnExit(void); - + void OnObjectPopupMenu(wxCommandEvent& event) { ObjectMenuProc((wxMenu *)event.GetEventObject(), event); } - + private: DECLARE_EVENT_TABLE() }; diff --git a/utils/dialoged/src/dialoged.rc b/utils/dialoged/src/dialoged.rc index e931061123..693b33821c 100644 --- a/utils/dialoged/src/dialoged.rc +++ b/utils/dialoged/src/dialoged.rc @@ -57,6 +57,10 @@ HELPTOOL BITMAP "bitmaps/help.bmp" COPYSIZETOOL BITMAP "bitmaps/copysize.bmp" TOFRONTTOOL BITMAP "bitmaps/tofront.bmp" TOBACKTOOL BITMAP "bitmaps/toback.bmp" +COPYWIDTHTOOL BITMAP "bitmaps/copywdth.bmp" +COPYHEIGHTTOOL BITMAP "bitmaps/copyhght.bmp" +DISTHORIZTOOL BITMAP "bitmaps/disthor.bmp" +DISTVERTTOOL BITMAP "bitmaps/distvert.bmp" WXWINBMP BITMAP "bitmaps/wxwin.bmp" diff --git a/utils/dialoged/src/dlghndlr.cpp b/utils/dialoged/src/dlghndlr.cpp index 721af4b4b0..e6760ed49e 100644 --- a/utils/dialoged/src/dlghndlr.cpp +++ b/utils/dialoged/src/dlghndlr.cpp @@ -38,38 +38,38 @@ IMPLEMENT_CLASS(wxResourceEditorDialogHandler, wxEvtHandler) IMPLEMENT_CLASS(wxResourceEditorControlHandler, wxEvtHandler) BEGIN_EVENT_TABLE(wxResourceEditorDialogHandler, wxEvtHandler) - EVT_PAINT(wxResourceEditorDialogHandler::OnPaint) - EVT_MOUSE_EVENTS(wxResourceEditorDialogHandler::OnMouseEvent) - EVT_SIZE(wxResourceEditorDialogHandler::OnSize) +EVT_PAINT(wxResourceEditorDialogHandler::OnPaint) +EVT_MOUSE_EVENTS(wxResourceEditorDialogHandler::OnMouseEvent) +EVT_SIZE(wxResourceEditorDialogHandler::OnSize) END_EVENT_TABLE() BEGIN_EVENT_TABLE(wxResourceEditorControlHandler, wxEvtHandler) - EVT_MOUSE_EVENTS(wxResourceEditorControlHandler::OnMouseEvent) +EVT_MOUSE_EVENTS(wxResourceEditorControlHandler::OnMouseEvent) END_EVENT_TABLE() /* - * Dialog box event handler - */ +* Dialog box event handler +*/ wxResourceEditorDialogHandler::wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, - wxEvtHandler *oldHandler, wxResourceManager *manager) + wxEvtHandler *oldHandler, wxResourceManager *manager) { - handlerDialog = dialog; - handlerResource = resource; - handlerOldHandler = oldHandler; - resourceManager = manager; - - dragMode = wxDRAG_MODE_NONE; - dragType = wxDRAG_TYPE_NONE; - dragItem = NULL; - firstDragX = 0; - firstDragY = 0; - oldDragX = 0; - oldDragY = 0; - dragTolerance = 3; - checkTolerance = TRUE; - m_mouseCaptured = FALSE; -// m_treeItem = 0; + handlerDialog = dialog; + handlerResource = resource; + handlerOldHandler = oldHandler; + resourceManager = manager; + + dragMode = wxDRAG_MODE_NONE; + dragType = wxDRAG_TYPE_NONE; + dragItem = NULL; + firstDragX = 0; + firstDragY = 0; + oldDragX = 0; + oldDragY = 0; + dragTolerance = 3; + checkTolerance = TRUE; + m_mouseCaptured = FALSE; + // m_treeItem = 0; } wxResourceEditorDialogHandler::~wxResourceEditorDialogHandler(void) @@ -78,227 +78,227 @@ wxResourceEditorDialogHandler::~wxResourceEditorDialogHandler(void) void wxResourceEditorDialogHandler::OnItemSelect(wxControl *item, bool select) { - if (select) - resourceManager->AddSelection(item); - else - resourceManager->RemoveSelection(item); + if (select) + resourceManager->AddSelection(item); + else + resourceManager->RemoveSelection(item); } void wxResourceEditorDialogHandler::OnPaint(wxPaintEvent& WXUNUSED(event)) { - wxPaintDC dc(handlerDialog); - - PaintSelectionHandles(dc); + wxPaintDC dc(handlerDialog); + + PaintSelectionHandles(dc); } // Add event handlers for all children void wxResourceEditorDialogHandler::AddChildHandlers(void) { - wxNode *node = handlerDialog->GetChildren().First(); - while ( node ) - { - wxControl *child = (wxControl *)node->Data(); - wxEvtHandler *childHandler = child->GetEventHandler(); - if ( child->IsKindOf(CLASSINFO(wxControl)) && childHandler == child ) - child->PushEventHandler(new wxResourceEditorControlHandler(child, childHandler)); - node = node->Next(); - } + wxNode *node = handlerDialog->GetChildren().First(); + while ( node ) + { + wxControl *child = (wxControl *)node->Data(); + wxEvtHandler *childHandler = child->GetEventHandler(); + if ( child->IsKindOf(CLASSINFO(wxControl)) && childHandler == child ) + child->PushEventHandler(new wxResourceEditorControlHandler(child, childHandler)); + node = node->Next(); + } } void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys) { - if (keys & wxKEY_CTRL) - { - wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog); - return; - } - - // Deselect all items if click on panel - if (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection() == RESED_POINTER) - { - int needsRefresh = 0; - wxNode *node = handlerDialog->GetChildren().First(); - while (node) + if (keys & wxKEY_CTRL) { - wxControl *item = (wxControl *)node->Data(); - wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - if (item->IsKindOf(CLASSINFO(wxControl)) && childHandler->IsSelected()) - { - needsRefresh ++; - OnItemSelect(item, FALSE); - childHandler->SelectItem(FALSE); - } - node = node->Next(); + wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog); + return; } - if (needsRefresh > 0) + + // Deselect all items if click on panel + if (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection() == RESED_POINTER) { - wxClientDC dc(handlerDialog); - dc.Clear(); - handlerDialog->Refresh(); + int needsRefresh = 0; + wxNode *node = handlerDialog->GetChildren().First(); + while (node) + { + wxControl *item = (wxControl *)node->Data(); + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if (item->IsKindOf(CLASSINFO(wxControl)) && childHandler->IsSelected()) + { + needsRefresh ++; + OnItemSelect(item, FALSE); + childHandler->SelectItem(FALSE); + } + node = node->Next(); + } + if (needsRefresh > 0) + { + wxClientDC dc(handlerDialog); + dc.Clear(); + handlerDialog->Refresh(); + } + return; } - return; - } - - // Round down to take account of dialog units - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerDialog); - if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) - { + + // Round down to take account of dialog units + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerDialog); + if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { wxPoint pt = handlerDialog->ConvertPixelsToDialog(wxPoint(x, y)); - + // Convert back so we've rounded down pt = handlerDialog->ConvertDialogToPixels(pt); pt = handlerDialog->ConvertPixelsToDialog(pt); pt = handlerDialog->ConvertDialogToPixels(pt); x = pt.x; y = pt.y; - } - - switch (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection()) - { - case RESED_BUTTON: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y); - break; - case RESED_BMPBUTTON: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxBitmapButton", x, y, TRUE); - break; - case RESED_STATICTEXT: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticText", x, y); - break; - case RESED_STATICBMP: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBitmap", x, y, TRUE); - break; - case RESED_TEXTCTRL_SINGLE: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (single-line)", x, y); - break; - case RESED_TEXTCTRL_MULTIPLE: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (multi-line)", x, y); - break; - case RESED_CHOICE: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y); - break; - case RESED_COMBOBOX: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxComboBox", x, y); - break; - case RESED_CHECKBOX: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxCheckBox", x, y); - break; - case RESED_RADIOBOX: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxRadioBox", x, y); - break; - case RESED_RADIOBUTTON: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxRadioButton", x, y); - break; - case RESED_LISTBOX: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxListBox", x, y); - break; - case RESED_SLIDER: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxSlider", x, y); - break; - case RESED_GAUGE: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxGauge", x, y); - break; - case RESED_STATICBOX: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBox", x, y); - break; - case RESED_SCROLLBAR: - resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxScrollBar", x, y); - break; - default: - break; - } - - // Now switch pointer on. - if (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection() != RESED_POINTER) - { - wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->SetItemState(RESED_POINTER, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); - } + } + + switch (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection()) + { + case RESED_BUTTON: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y); + break; + case RESED_BMPBUTTON: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxBitmapButton", x, y, TRUE); + break; + case RESED_STATICTEXT: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticText", x, y); + break; + case RESED_STATICBMP: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBitmap", x, y, TRUE); + break; + case RESED_TEXTCTRL_SINGLE: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (single-line)", x, y); + break; + case RESED_TEXTCTRL_MULTIPLE: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (multi-line)", x, y); + break; + case RESED_CHOICE: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y); + break; + case RESED_COMBOBOX: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxComboBox", x, y); + break; + case RESED_CHECKBOX: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxCheckBox", x, y); + break; + case RESED_RADIOBOX: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxRadioBox", x, y); + break; + case RESED_RADIOBUTTON: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxRadioButton", x, y); + break; + case RESED_LISTBOX: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxListBox", x, y); + break; + case RESED_SLIDER: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxSlider", x, y); + break; + case RESED_GAUGE: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxGauge", x, y); + break; + case RESED_STATICBOX: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBox", x, y); + break; + case RESED_SCROLLBAR: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxScrollBar", x, y); + break; + default: + break; + } + + // Now switch pointer on. + if (wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->GetSelection() != RESED_POINTER) + { + wxResourceManager::GetCurrentResourceManager()->GetEditorControlList()->SetItemState(RESED_POINTER, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); + } } void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int WXUNUSED(keys)) { - wxMenu *menu = resourceManager->GetPopupMenu(); - menu->SetClientData((char *)handlerDialog); - handlerDialog->PopupMenu(menu, x, y); + wxMenu *menu = resourceManager->GetPopupMenu(); + menu->SetClientData((char *)handlerDialog); + handlerDialog->PopupMenu(menu, x, y); } void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int WXUNUSED(x), int WXUNUSED(y), int keys) { - if (keys & wxKEY_CTRL) - { - wxResourceManager::GetCurrentResourceManager()->EditWindow(item); - return; - } - -/* - // If this is a wxStaticBox and the pointer isn't an arrow, chances - // are that we really meant to place an item on the panel. - // Fake this event. - if ((item->GetClassInfo() == CLASSINFO(wxStaticBox)) && resourceManager->GetEditorPalette()->currentlySelected != PALETTE_ARROW) - { + if (keys & wxKEY_CTRL) + { + wxResourceManager::GetCurrentResourceManager()->EditWindow(item); + return; + } + + /* + // If this is a wxStaticBox and the pointer isn't an arrow, chances + // are that we really meant to place an item on the panel. + // Fake this event. + if ((item->GetClassInfo() == CLASSINFO(wxStaticBox)) && resourceManager->GetEditorPalette()->currentlySelected != PALETTE_ARROW) + { OnLeftClick(x, y, keys); return; - } -*/ - - wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - - if (childHandler->IsSelected()) - { - childHandler->SelectItem(FALSE); - OnItemSelect(item, FALSE); - - wxClientDC dc(handlerDialog); - dc.Clear(); - handlerDialog->Refresh(); - } - else - { - childHandler->SelectItem(TRUE); - OnItemSelect(item, TRUE); + } + */ + + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - // Deselect other items if shift is not pressed - int needsRefresh = 0; - if (!(keys & wxKEY_SHIFT)) + if (childHandler->IsSelected()) { - wxNode *node = item->GetParent()->GetChildren().First(); - while (node) - { - wxControl *child = (wxControl *)node->Data(); - wxResourceEditorControlHandler *childHandler2 = (wxResourceEditorControlHandler *)child->GetEventHandler(); - if (child->IsKindOf(CLASSINFO(wxControl)) && childHandler2->IsSelected() && child != item) - { - childHandler2->SelectItem(FALSE); - OnItemSelect(child, FALSE); - needsRefresh ++; - } - node = node->Next(); - } + childHandler->SelectItem(FALSE); + OnItemSelect(item, FALSE); + + wxClientDC dc(handlerDialog); + dc.Clear(); + handlerDialog->Refresh(); } - - wxClientDC dc(handlerDialog); - childHandler->DrawSelectionHandles(dc); - - if (needsRefresh > 0) + else { - dc.Clear(); - handlerDialog->Refresh(); + childHandler->SelectItem(TRUE); + OnItemSelect(item, TRUE); + + // Deselect other items if shift is not pressed + int needsRefresh = 0; + if (!(keys & wxKEY_SHIFT)) + { + wxNode *node = item->GetParent()->GetChildren().First(); + while (node) + { + wxControl *child = (wxControl *)node->Data(); + wxResourceEditorControlHandler *childHandler2 = (wxResourceEditorControlHandler *)child->GetEventHandler(); + if (child->IsKindOf(CLASSINFO(wxControl)) && childHandler2->IsSelected() && child != item) + { + childHandler2->SelectItem(FALSE); + OnItemSelect(child, FALSE); + needsRefresh ++; + } + node = node->Next(); + } + } + + wxClientDC dc(handlerDialog); + childHandler->DrawSelectionHandles(dc); + + if (needsRefresh > 0) + { + dc.Clear(); + handlerDialog->Refresh(); + } } - } } void wxResourceEditorDialogHandler::OnItemRightClick(wxControl *item, int x, int y, int WXUNUSED(keys)) { /* - if (keys & wxKEY_CTRL) - { - wxDebugMsg("Item %s, selected = %d\n", item->GetName(), item->IsSelected()); - return; - } -*/ - - wxMenu *menu = resourceManager->GetPopupMenu(); - menu->SetClientData((char *)item); - handlerDialog->PopupMenu(menu, x, y); +if (keys & wxKEY_CTRL) +{ +wxDebugMsg("Item %s, selected = %d\n", item->GetName(), item->IsSelected()); +return; +} + */ + + wxMenu *menu = resourceManager->GetPopupMenu(); + menu->SetClientData((char *)item); + handlerDialog->PopupMenu(menu, x, y); } // Under Windows 95, you can resize a panel interactively depending on @@ -308,7 +308,7 @@ void wxResourceEditorDialogHandler::OnSize(wxSizeEvent& event) // Update the associated resource int w, h; handlerDialog->GetClientSize(& w, & h); - + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerDialog); if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) { @@ -321,328 +321,328 @@ void wxResourceEditorDialogHandler::OnSize(wxSizeEvent& event) // An event outside any items: may be a drag event. void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event) { - if (GetEvtHandlerEnabled()) - { - // If we're dragging an item or selection handle, - // continue dragging. - if (dragMode != wxDRAG_MODE_NONE) - { - ProcessItemEvent(dragItem, event, dragType); - return; - } - - wxCoord x, y; - event.GetPosition(&x, &y); - - // Find which selection handle we're on, if any - wxNode *node = handlerDialog->GetChildren().First(); - while (node) + if (GetEvtHandlerEnabled()) { - wxWindow *win = (wxWindow *)node->Data(); - if (win->IsKindOf(CLASSINFO(wxControl))) - { - wxControl *item = (wxControl *)win; - wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - int selHandle = childHandler->SelectionHandleHitTest(x, y); - if (selHandle > 0) + // If we're dragging an item or selection handle, + // continue dragging. + if (dragMode != wxDRAG_MODE_NONE) { - ProcessItemEvent(item, event, selHandle); - return; + ProcessItemEvent(dragItem, event, dragType); + return; } - } - node = node->Next(); - } - - // We're not on an item or selection handle. - // so... check for a left or right click event - // to send to the application. - int keys = 0; - if (event.ShiftDown()) keys = keys | wxKEY_SHIFT; - if (event.ControlDown()) keys = keys | wxKEY_CTRL; - - if (event.LeftUp()) - { - if (m_mouseCaptured) + + wxCoord x, y; + event.GetPosition(&x, &y); + + // Find which selection handle we're on, if any + wxNode *node = handlerDialog->GetChildren().First(); + while (node) { - handlerDialog->ReleaseMouse(); - m_mouseCaptured = FALSE; + wxWindow *win = (wxWindow *)node->Data(); + if (win->IsKindOf(CLASSINFO(wxControl))) + { + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + int selHandle = childHandler->SelectionHandleHitTest(x, y); + if (selHandle > 0) + { + ProcessItemEvent(item, event, selHandle); + return; + } + } + node = node->Next(); } - - OnLeftClick(x, y, keys); - } - else if (event.RightDown()) - { - if (m_mouseCaptured) + + // We're not on an item or selection handle. + // so... check for a left or right click event + // to send to the application. + int keys = 0; + if (event.ShiftDown()) keys = keys | wxKEY_SHIFT; + if (event.ControlDown()) keys = keys | wxKEY_CTRL; + + if (event.LeftUp()) { - handlerDialog->ReleaseMouse(); - m_mouseCaptured = FALSE; + if (m_mouseCaptured) + { + handlerDialog->ReleaseMouse(); + m_mouseCaptured = FALSE; + } + + OnLeftClick(x, y, keys); } - - OnRightClick(x, y, keys); - } - else if (event.LeftDClick()) - { - if (m_mouseCaptured) + else if (event.RightDown()) { - handlerDialog->ReleaseMouse(); - m_mouseCaptured = FALSE; + if (m_mouseCaptured) + { + handlerDialog->ReleaseMouse(); + m_mouseCaptured = FALSE; + } + + OnRightClick(x, y, keys); + } + else if (event.LeftDClick()) + { + if (m_mouseCaptured) + { + handlerDialog->ReleaseMouse(); + m_mouseCaptured = FALSE; + } + wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog); } - wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog); } - } - else - event.Skip(); + else + event.Skip(); } void wxResourceEditorDialogHandler::OnItemEvent(wxControl *item, wxMouseEvent& event) { - if (!GetEvtHandlerEnabled()) - return; - - // Not a selection handle event: just a normal item event. - // Transform to panel coordinates. - wxCoord x, y; - item->GetPosition(&x, &y); - - event.m_x = event.m_x + x; - event.m_y = event.m_y + y; - - ProcessItemEvent(item, event, dragType); + if (!GetEvtHandlerEnabled()) + return; + + // Not a selection handle event: just a normal item event. + // Transform to panel coordinates. + wxCoord x, y; + item->GetPosition(&x, &y); + + event.m_x = event.m_x + x; + event.m_y = event.m_y + y; + + ProcessItemEvent(item, event, dragType); } void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle) { - wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - - wxCoord x, y; - event.GetPosition(&x, &y); - int keys = 0; - if (event.ShiftDown()) keys = keys | wxKEY_SHIFT; - if (event.ControlDown()) keys = keys | wxKEY_CTRL; - bool dragging = event.Dragging(); - if (dragging) - { - int dx = (int)abs((x - firstDragX)); - int dy = (int)abs((y - firstDragY)); - if (checkTolerance && (dx <= dragTolerance) && (dy <= dragTolerance)) + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + + wxCoord x, y; + event.GetPosition(&x, &y); + int keys = 0; + if (event.ShiftDown()) keys = keys | wxKEY_SHIFT; + if (event.ControlDown()) keys = keys | wxKEY_CTRL; + bool dragging = event.Dragging(); + if (dragging) { - return; + int dx = (int)abs((x - firstDragX)); + int dy = (int)abs((y - firstDragY)); + if (checkTolerance && (dx <= dragTolerance) && (dy <= dragTolerance)) + { + return; + } + else + // If we've ignored the tolerance once, then ALWAYS ignore + // tolerance in this drag, even if we come back within + // the tolerance range. + { + checkTolerance = FALSE; + } } - else - // If we've ignored the tolerance once, then ALWAYS ignore - // tolerance in this drag, even if we come back within - // the tolerance range. - { - checkTolerance = FALSE; - } - } - if (event.LeftDClick()) - { - if (m_mouseCaptured) - { - handlerDialog->ReleaseMouse(); - m_mouseCaptured = FALSE; - } - - wxResourceManager::GetCurrentResourceManager()->EditWindow(item); - } - else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_LEFT) - { - dragMode = wxDRAG_MODE_CONTINUE_LEFT; - wxClientDC dc(handlerDialog); - childHandler->OnDragBegin(x, y, keys, dc, selectionHandle); - oldDragX = x; oldDragY = y; - if (!m_mouseCaptured) + if (event.LeftDClick()) { - handlerDialog->CaptureMouse(); - m_mouseCaptured = TRUE; + if (m_mouseCaptured) + { + handlerDialog->ReleaseMouse(); + m_mouseCaptured = FALSE; + } + + wxResourceManager::GetCurrentResourceManager()->EditWindow(item); } - } - else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT) - { - wxClientDC dc(handlerDialog); - childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle); - childHandler->OnDragContinue(TRUE, x, y, keys, dc, selectionHandle); - oldDragX = x; oldDragY = y; - } - else if (event.LeftUp() && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT) - { - wxClientDC dc(handlerDialog); - dragMode = wxDRAG_MODE_NONE; - checkTolerance = TRUE; - - childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle); - childHandler->OnDragEnd(x, y, keys, dc, selectionHandle); - - dragItem = NULL; - dragType = wxDRAG_TYPE_NONE; - - if (m_mouseCaptured) + else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_LEFT) { - handlerDialog->ReleaseMouse(); - m_mouseCaptured = FALSE; + dragMode = wxDRAG_MODE_CONTINUE_LEFT; + wxClientDC dc(handlerDialog); + childHandler->OnDragBegin(x, y, keys, dc, selectionHandle); + oldDragX = x; oldDragY = y; + if (!m_mouseCaptured) + { + handlerDialog->CaptureMouse(); + m_mouseCaptured = TRUE; + } } - } - else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_RIGHT) - { - wxClientDC dc(handlerDialog); - dragMode = wxDRAG_MODE_CONTINUE_RIGHT; - childHandler->OnDragBegin(x, y, keys, dc, selectionHandle); - oldDragX = x; oldDragY = y; - - if (!m_mouseCaptured) - { - handlerDialog->CaptureMouse(); - m_mouseCaptured = TRUE; + else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT) + { + wxClientDC dc(handlerDialog); + childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle); + childHandler->OnDragContinue(TRUE, x, y, keys, dc, selectionHandle); + oldDragX = x; oldDragY = y; } - } - else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT) - { - oldDragX = x; oldDragY = y; - } - // Obsolete; no longer try to right-drag - else if (event.RightUp() && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT) - { - dragMode = wxDRAG_MODE_NONE; - checkTolerance = TRUE; - dragItem = NULL; - dragType = wxDRAG_TYPE_NONE; - - if (m_mouseCaptured) + else if (event.LeftUp() && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT) { - handlerDialog->ReleaseMouse(); - m_mouseCaptured = FALSE; + wxClientDC dc(handlerDialog); + dragMode = wxDRAG_MODE_NONE; + checkTolerance = TRUE; + + childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle); + childHandler->OnDragEnd(x, y, keys, dc, selectionHandle); + + dragItem = NULL; + dragType = wxDRAG_TYPE_NONE; + + if (m_mouseCaptured) + { + handlerDialog->ReleaseMouse(); + m_mouseCaptured = FALSE; + } } - } - else if (event.IsButton()) - { - checkTolerance = TRUE; - - if (event.LeftDown()) + else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_RIGHT) { - dragItem = item; - dragMode = wxDRAG_MODE_START_LEFT; - firstDragX = x; - firstDragY = y; - dragType = selectionHandle; - - if (!m_mouseCaptured) - { - handlerDialog->CaptureMouse(); - m_mouseCaptured = TRUE; - } + wxClientDC dc(handlerDialog); + dragMode = wxDRAG_MODE_CONTINUE_RIGHT; + childHandler->OnDragBegin(x, y, keys, dc, selectionHandle); + oldDragX = x; oldDragY = y; + + if (!m_mouseCaptured) + { + handlerDialog->CaptureMouse(); + m_mouseCaptured = TRUE; + } } - else if (event.RightDown()) - { - if (m_mouseCaptured) - { - handlerDialog->ReleaseMouse(); - m_mouseCaptured = FALSE; - } - - if (item) - childHandler->OnRightClick(x, y, keys); - else - OnRightClick(x, y, keys); - - dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; - - /* - dragItem = item; - dragMode = wxDRAG_MODE_START_RIGHT; - firstDragX = x; - firstDragY = y; - dragType = selectionHandle; - - if (!m_mouseCaptured) - { - handlerDialog->CaptureMouse(); - m_mouseCaptured = TRUE; - } - */ + else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT) + { + oldDragX = x; oldDragY = y; } - else if (event.LeftUp()) + // Obsolete; no longer try to right-drag + else if (event.RightUp() && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT) { - if (dragItem) - childHandler->OnLeftClick(x, y, keys); - else - OnLeftClick(x, y, keys); - - dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; - - if (m_mouseCaptured) - { - handlerDialog->ReleaseMouse(); - m_mouseCaptured = FALSE; - } + dragMode = wxDRAG_MODE_NONE; + checkTolerance = TRUE; + dragItem = NULL; + dragType = wxDRAG_TYPE_NONE; + + if (m_mouseCaptured) + { + handlerDialog->ReleaseMouse(); + m_mouseCaptured = FALSE; + } } - else if (event.RightUp()) + else if (event.IsButton()) { - /* - if (dragItem) + checkTolerance = TRUE; + + if (event.LeftDown()) + { + dragItem = item; + dragMode = wxDRAG_MODE_START_LEFT; + firstDragX = x; + firstDragY = y; + dragType = selectionHandle; + + if (!m_mouseCaptured) + { + handlerDialog->CaptureMouse(); + m_mouseCaptured = TRUE; + } + } + else if (event.RightDown()) + { + if (m_mouseCaptured) + { + handlerDialog->ReleaseMouse(); + m_mouseCaptured = FALSE; + } + + if (item) + childHandler->OnRightClick(x, y, keys); + else + OnRightClick(x, y, keys); + + dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; + + /* + dragItem = item; + dragMode = wxDRAG_MODE_START_RIGHT; + firstDragX = x; + firstDragY = y; + dragType = selectionHandle; + + if (!m_mouseCaptured) + { + handlerDialog->CaptureMouse(); + m_mouseCaptured = TRUE; + } + */ + } + else if (event.LeftUp()) + { + if (dragItem) + childHandler->OnLeftClick(x, y, keys); + else + OnLeftClick(x, y, keys); + + dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; + + if (m_mouseCaptured) + { + handlerDialog->ReleaseMouse(); + m_mouseCaptured = FALSE; + } + } + else if (event.RightUp()) + { + /* + if (dragItem) childHandler->OnRightClick(x, y, keys); - else + else OnRightClick(x, y, keys); - - dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; - - if (m_mouseCaptured) - { - handlerDialog->ReleaseMouse(); - m_mouseCaptured = FALSE; - } - */ + + dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; + + if (m_mouseCaptured) + { + handlerDialog->ReleaseMouse(); + m_mouseCaptured = FALSE; + } + */ + } } - } } // Calls DrawSelectionHandles for all items if // edit mode is on. void wxResourceEditorDialogHandler::PaintSelectionHandles(wxDC& dc) { - if (!GetEvtHandlerEnabled()) - return; - - dc.BeginDrawing(); - - wxNode *node = handlerDialog->GetChildren().First(); - while (node) - { - wxWindow *win = (wxWindow *)node->Data(); - if (win->IsKindOf(CLASSINFO(wxControl))) + if (!GetEvtHandlerEnabled()) + return; + + dc.BeginDrawing(); + + wxNode *node = handlerDialog->GetChildren().First(); + while (node) { - wxControl *item = (wxControl *)win; - wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - - // Don't draw handles for an item that's being moved: it'll - // smear. - if (childHandler->IsSelected() && (item != dragItem)) - childHandler->DrawSelectionHandles(dc); + wxWindow *win = (wxWindow *)node->Data(); + if (win->IsKindOf(CLASSINFO(wxControl))) + { + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + + // Don't draw handles for an item that's being moved: it'll + // smear. + if (childHandler->IsSelected() && (item != dragItem)) + childHandler->DrawSelectionHandles(dc); + } + node = node->Next(); } - node = node->Next(); - } - dc.EndDrawing(); + dc.EndDrawing(); } /* - * Event handler for controls - */ +* Event handler for controls +*/ int wxResourceEditorControlHandler::dragOffsetX = 0; int wxResourceEditorControlHandler::dragOffsetY = 0; wxResourceEditorControlHandler::wxResourceEditorControlHandler(wxControl *control, - wxEvtHandler *oldHandler) + wxEvtHandler *oldHandler) { - handlerControl = control; - handlerOldHandler = oldHandler; - - handleSize = 6; - handleMargin = 1; - isSelected = FALSE; - dragOffsetX = 0; - dragOffsetY = 0; -// m_treeItem = 0; + handlerControl = control; + handlerOldHandler = oldHandler; + + handleSize = 6; + handleMargin = 1; + isSelected = FALSE; + dragOffsetX = 0; + dragOffsetY = 0; + // m_treeItem = 0; } wxResourceEditorControlHandler::~wxResourceEditorControlHandler(void) @@ -650,481 +650,484 @@ wxResourceEditorControlHandler::~wxResourceEditorControlHandler(void) } /* - * Manipulation and drawing of items in Edit Mode - */ - +* Manipulation and drawing of items in Edit Mode +*/ + void wxResourceEditorControlHandler::SelectItem(bool select) { - isSelected = select; + isSelected = select; } // Returns TRUE or FALSE bool wxResourceEditorControlHandler::HitTest(int x, int y) { - int xpos, ypos, width, height; - handlerControl->GetPosition(&xpos, &ypos); - handlerControl->GetSize(&width, &height); - - return ((x >= xpos) && (x <= (xpos + width)) && (y >= ypos) && (y <= (ypos + height))); + int xpos, ypos, width, height; + handlerControl->GetPosition(&xpos, &ypos); + handlerControl->GetSize(&width, &height); + + return ((x >= xpos) && (x <= (xpos + width)) && (y >= ypos) && (y <= (ypos + height))); } // Calculate position of the 8 handles void wxResourceEditorControlHandler::CalcSelectionHandles(int *hx, int *hy) { - int xpos, ypos, width, height; - handlerControl->GetPosition(&xpos, &ypos); - handlerControl->GetSize(&width, &height); - int middleX = (xpos + (width/2)); - int middleY = (ypos + (height/2)); - - // Start from top middle, clockwise. -/* - 7 0 1 - - 6 2 - - 5 4 3 -*/ - - hx[0] = (int)(middleX - (handleSize/2)); - hy[0] = ypos - handleSize - handleMargin; - - hx[1] = xpos + width + handleMargin; - hy[1] = ypos - handleSize - handleMargin; - - hx[2] = xpos + width + handleMargin; - hy[2] = (int)(middleY - (handleSize/2)); - - hx[3] = xpos + width + handleMargin; - hy[3] = ypos + height + handleMargin; - - hx[4] = (int)(middleX - (handleSize/2)); - hy[4] = ypos + height + handleMargin; - - hx[5] = xpos - handleSize - handleMargin; - hy[5] = ypos + height + handleMargin; - - hx[6] = xpos - handleSize - handleMargin; - hy[6] = (int)(middleY - (handleSize/2)); - - hx[7] = xpos - handleSize - handleMargin; - hy[7] = ypos - handleSize - handleMargin; + int xpos, ypos, width, height; + handlerControl->GetPosition(&xpos, &ypos); + handlerControl->GetSize(&width, &height); + int middleX = (xpos + (width/2)); + int middleY = (ypos + (height/2)); + + // Start from top middle, clockwise. + /* + 7 0 1 + + 6 2 + + 5 4 3 + */ + + hx[0] = (int)(middleX - (handleSize/2)); + hy[0] = ypos - handleSize - handleMargin; + + hx[1] = xpos + width + handleMargin; + hy[1] = ypos - handleSize - handleMargin; + + hx[2] = xpos + width + handleMargin; + hy[2] = (int)(middleY - (handleSize/2)); + + hx[3] = xpos + width + handleMargin; + hy[3] = ypos + height + handleMargin; + + hx[4] = (int)(middleX - (handleSize/2)); + hy[4] = ypos + height + handleMargin; + + hx[5] = xpos - handleSize - handleMargin; + hy[5] = ypos + height + handleMargin; + + hx[6] = xpos - handleSize - handleMargin; + hy[6] = (int)(middleY - (handleSize/2)); + + hx[7] = xpos - handleSize - handleMargin; + hy[7] = ypos - handleSize - handleMargin; } // Returns 0 (no hit), 1 - 8 for which selection handle // (clockwise from top middle) int wxResourceEditorControlHandler::SelectionHandleHitTest(int x, int y) { - // Handle positions - int hx[8]; - int hy[8]; - CalcSelectionHandles(hx, hy); - - int i; - for (i = 0; i < 8; i++) - { - if ((x >= hx[i]) && (x <= (hx[i] + handleSize)) && (y >= hy[i]) && (y <= (hy[i] + handleSize))) - return (i + 1); - } - return 0; + // Handle positions + int hx[8]; + int hy[8]; + CalcSelectionHandles(hx, hy); + + int i; + for (i = 0; i < 8; i++) + { + if ((x >= hx[i]) && (x <= (hx[i] + handleSize)) && (y >= hy[i]) && (y <= (hy[i] + handleSize))) + return (i + 1); + } + return 0; } void wxResourceEditorControlHandler::DrawSelectionHandles(wxDC& dc, bool WXUNUSED(erase)) { - dc.SetOptimization(FALSE); - - dc.SetLogicalFunction(wxCOPY); - dc.SetPen(* wxBLACK_PEN); - dc.SetBrush(* wxBLACK_BRUSH); - - dc.SetOptimization(TRUE); - - // Handle positions - int hx[8]; - int hy[8]; - CalcSelectionHandles(hx, hy); - - int i; - for (i = 0; i < 8; i++) - { - dc.DrawRectangle(hx[i], hy[i], handleSize, handleSize); - } + dc.SetOptimization(FALSE); + + dc.SetLogicalFunction(wxCOPY); + dc.SetPen(* wxBLACK_PEN); + dc.SetBrush(* wxBLACK_BRUSH); + + dc.SetOptimization(TRUE); + + // Handle positions + int hx[8]; + int hy[8]; + CalcSelectionHandles(hx, hy); + + int i; + for (i = 0; i < 8; i++) + { + dc.DrawRectangle(hx[i], hy[i], handleSize, handleSize); + } } void wxResourceEditorControlHandler::DrawBoundingBox(wxDC& dc, int x, int y, int w, int h) { - dc.DrawRectangle(x, y, w, h); + dc.DrawRectangle(x, y, w, h); } // If selectionHandle is zero, not dragging the selection handle. void wxResourceEditorControlHandler::OnDragBegin(int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) { - int xpos, ypos, width, height; - handlerControl->GetPosition(&xpos, &ypos); - handlerControl->GetSize(&width, &height); - - dc.BeginDrawing(); - -// dc.DestroyClippingRegion(); - - wxPanel *panel = (wxPanel *)handlerControl->GetParent(); - - // Erase selection handles -// DrawSelectionHandles(dc, TRUE); - - dc.SetOptimization(FALSE); - - dc.SetLogicalFunction(wxINVERT); - - wxPen pen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(pen); - dc.SetBrush(* wxTRANSPARENT_BRUSH); - - dc.SetOptimization(TRUE); - - if (selectionHandle > 0) - { - panel->Refresh(); - - DrawBoundingBox(dc, xpos, ypos, width, height); - } - else - { - panel->Refresh(); - - dragOffsetX = (x - xpos); - dragOffsetY = (y - ypos); - - DrawBoundingBox(dc, xpos, ypos, width, height); - - // Also draw bounding boxes for other selected items - wxNode *node = panel->GetChildren().First(); - while (node) - { - wxWindow *win = (wxWindow *)node->Data(); - if (win->IsKindOf(CLASSINFO(wxControl))) - { - wxControl *item = (wxControl *)win; - wxResourceEditorControlHandler *handler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - if ((item != handlerControl) && handler->IsSelected()) - { - int x1, y1, w1, h1; - item->GetPosition(&x1, &y1); - item->GetSize(&w1, &h1); - handler->DrawBoundingBox(dc, x1, y1, w1, h1); - } - } - node = node->Next(); - } - } - dc.EndDrawing(); -} - -void wxResourceEditorControlHandler::OnDragContinue(bool WXUNUSED(paintIt), int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) -{ - wxPanel *panel = (wxPanel *)handlerControl->GetParent(); - int xpos, ypos, width, height; - handlerControl->GetPosition(&xpos, &ypos); - handlerControl->GetSize(&width, &height); - - if (selectionHandle > 0) - { -/* - 8 1 2 - - 7 3 - - 6 5 4 -*/ - - int x1, y1, width1, height1; - - switch (selectionHandle) - { - case 1: - x1 = xpos; - y1 = y; - width1 = width; - height1 = (ypos + height) - y; - break; - case 5: - x1 = xpos; - y1 = ypos; - width1 = width; - height1 = (y - ypos); - break; - case 3: - x1 = xpos; - y1 = ypos; - width1 = (x - xpos); - height1 = height; - break; - case 7: - x1 = x; - y1 = ypos; - width1 = (xpos + width) - x; - height1 = height; - break; - case 2: - x1 = xpos; - y1 = y; - width1 = (x - xpos); - height1 = (ypos + height) - y; - break; - case 4: - x1 = xpos; - y1 = ypos; - width1 = (x - xpos); - height1 = (y - ypos); - break; - case 6: - x1 = x; - y1 = ypos; - width1 = (xpos + width) - x; - height1 = y - ypos; - break; - case 8: - x1 = x; - y1 = y; - width1 = (xpos + width) - x; - height1 = (ypos + height) - y; - break; - } + int xpos, ypos, width, height; + handlerControl->GetPosition(&xpos, &ypos); + handlerControl->GetSize(&width, &height); + dc.BeginDrawing(); - + + // dc.DestroyClippingRegion(); + + wxPanel *panel = (wxPanel *)handlerControl->GetParent(); + + // Erase selection handles + // DrawSelectionHandles(dc, TRUE); + + dc.SetOptimization(FALSE); + dc.SetLogicalFunction(wxINVERT); + wxPen pen(wxColour(0, 0, 0), 1, wxDOT); dc.SetPen(pen); dc.SetBrush(* wxTRANSPARENT_BRUSH); - - DrawBoundingBox(dc, x1, y1, width1, height1); - - dc.EndDrawing(); - } - else - { - dc.BeginDrawing(); - dc.SetLogicalFunction(wxINVERT); - wxPen pen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(pen); - dc.SetBrush(* wxTRANSPARENT_BRUSH); - - DrawBoundingBox(dc, (int)(x - dragOffsetX), (int)(y - dragOffsetY), width, height); - - // Also draw bounding boxes for other selected items - wxNode *node = panel->GetChildren().First(); - while (node) - { - wxWindow *win = (wxWindow *)node->Data(); - if (win->IsKindOf(CLASSINFO(wxControl))) + + dc.SetOptimization(TRUE); + + if (selectionHandle > 0) + { + panel->Refresh(); + + DrawBoundingBox(dc, xpos, ypos, width, height); + } + else + { + panel->Refresh(); + + dragOffsetX = (x - xpos); + dragOffsetY = (y - ypos); + + DrawBoundingBox(dc, xpos, ypos, width, height); + + // Also draw bounding boxes for other selected items + wxNode *node = panel->GetChildren().First(); + while (node) { - wxControl *item = (wxControl *)win; - wxResourceEditorControlHandler *handler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - if ((item != handlerControl) && handler->IsSelected()) - { - int x1, y1, w1, h1; - item->GetPosition(&x1, &y1); - item->GetSize(&w1, &h1); - int x2 = (int)(x1 + (x - dragOffsetX) - xpos); - int y2 = (int)(y1 + (y - dragOffsetY) - ypos); - handler->DrawBoundingBox(dc, x2, y2, w1, h1); - } + wxWindow *win = (wxWindow *)node->Data(); + if (win->IsKindOf(CLASSINFO(wxControl))) + { + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *handler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if ((item != handlerControl) && handler->IsSelected()) + { + int x1, y1, w1, h1; + item->GetPosition(&x1, &y1); + item->GetSize(&w1, &h1); + handler->DrawBoundingBox(dc, x1, y1, w1, h1); + } + } + node = node->Next(); } - node = node->Next(); - } - dc.EndDrawing(); - } + } + dc.EndDrawing(); } -void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) +void wxResourceEditorControlHandler::OnDragContinue(bool WXUNUSED(paintIt), int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) { - wxPanel *panel = (wxPanel *)handlerControl->GetParent(); - - dc.BeginDrawing(); - - int xpos, ypos, width, height; - handlerControl->GetPosition(&xpos, &ypos); - handlerControl->GetSize(&width, &height); - - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerControl); - wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerControl->GetParent()); - - if (selectionHandle > 0) - { - int x1, y1, width1, height1; - - switch (selectionHandle) + wxPanel *panel = (wxPanel *)handlerControl->GetParent(); + int xpos, ypos, width, height; + handlerControl->GetPosition(&xpos, &ypos); + handlerControl->GetSize(&width, &height); + + if (selectionHandle > 0) { - case 1: - x1 = xpos; - y1 = y; - width1 = width; - height1 = (ypos + height) - y; - break; - case 5: - x1 = xpos; - y1 = ypos; - width1 = width; - height1 = (y - ypos); - break; - case 3: - x1 = xpos; - y1 = ypos; - width1 = (x - xpos); - height1 = height; - break; - case 7: - x1 = x; - y1 = ypos; - width1 = (xpos + width) - x; - height1 = height; - break; - case 2: - x1 = xpos; - y1 = y; - width1 = (x - xpos); - height1 = (ypos + height) - y; - break; - case 4: - x1 = xpos; - y1 = ypos; - width1 = (x - xpos); - height1 = (y - ypos); - break; - case 6: - x1 = x; - y1 = ypos; - width1 = (xpos + width) - x; - height1 = y - ypos; - break; - case 8: - x1 = x; - y1 = y; - width1 = (xpos + width) - x; - height1 = (ypos + height) - y; - break; + /* + 8 1 2 + + 7 3 + + 6 5 4 + */ + + int x1, y1, width1, height1; + + switch (selectionHandle) + { + case 1: + x1 = xpos; + y1 = y; + width1 = width; + height1 = (ypos + height) - y; + break; + case 5: + x1 = xpos; + y1 = ypos; + width1 = width; + height1 = (y - ypos); + break; + case 3: + x1 = xpos; + y1 = ypos; + width1 = (x - xpos); + height1 = height; + break; + case 7: + x1 = x; + y1 = ypos; + width1 = (xpos + width) - x; + height1 = height; + break; + case 2: + x1 = xpos; + y1 = y; + width1 = (x - xpos); + height1 = (ypos + height) - y; + break; + case 4: + x1 = xpos; + y1 = ypos; + width1 = (x - xpos); + height1 = (y - ypos); + break; + case 6: + x1 = x; + y1 = ypos; + width1 = (xpos + width) - x; + height1 = y - ypos; + break; + case 8: + x1 = x; + y1 = y; + width1 = (xpos + width) - x; + height1 = (ypos + height) - y; + break; + } + dc.BeginDrawing(); + + dc.SetLogicalFunction(wxINVERT); + wxPen pen(wxColour(0, 0, 0), 1, wxDOT); + dc.SetPen(pen); + dc.SetBrush(* wxTRANSPARENT_BRUSH); + + DrawBoundingBox(dc, x1, y1, width1, height1); + + dc.EndDrawing(); } - // Update the associated resource - // We need to convert to dialog units if this is not a dialog or panel, but - // the parent resource specifies dialog units. - int resourceX = x1; - int resourceY = y1; - int resourceWidth = width1; - int resourceHeight = height1; - - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + else { - wxPoint pt = handlerControl->GetParent()->ConvertPixelsToDialog(wxPoint(x1, y1)); - wxSize sz = handlerControl->GetParent()->ConvertPixelsToDialog(wxSize(width1, height1)); - - // Convert back so we've rounded down - sz = handlerControl->GetParent()->ConvertDialogToPixels(sz); - sz = handlerControl->GetParent()->ConvertPixelsToDialog(sz); - resourceWidth = sz.x; resourceHeight = sz.y; - - sz = handlerControl->GetParent()->ConvertDialogToPixels(sz); - width1 = sz.x; - height1 = sz.y; - - pt = handlerControl->GetParent()->ConvertDialogToPixels(pt); - pt = handlerControl->GetParent()->ConvertPixelsToDialog(pt); - resourceX = pt.x; resourceY = pt.y; - - pt = handlerControl->GetParent()->ConvertDialogToPixels(pt); - x1 = pt.x; - y1 = pt.y; + dc.BeginDrawing(); + dc.SetLogicalFunction(wxINVERT); + wxPen pen(wxColour(0, 0, 0), 1, wxDOT); + dc.SetPen(pen); + dc.SetBrush(* wxTRANSPARENT_BRUSH); + + DrawBoundingBox(dc, (int)(x - dragOffsetX), (int)(y - dragOffsetY), width, height); + + // Also draw bounding boxes for other selected items + wxNode *node = panel->GetChildren().First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + if (win->IsKindOf(CLASSINFO(wxControl))) + { + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *handler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if ((item != handlerControl) && handler->IsSelected()) + { + int x1, y1, w1, h1; + item->GetPosition(&x1, &y1); + item->GetSize(&w1, &h1); + int x2 = (int)(x1 + (x - dragOffsetX) - xpos); + int y2 = (int)(y1 + (y - dragOffsetY) - ypos); + handler->DrawBoundingBox(dc, x2, y2, w1, h1); + } + } + node = node->Next(); + } + dc.EndDrawing(); } - handlerControl->SetSize(x1, y1, width1, height1); - resource->SetSize(resourceX, resourceY, resourceWidth, resourceHeight); - } - else - { - // Correction 31/12/98. We need to round down the values to take into account - // the fact that several pixels map to the same dialog unit. - - int newX = (int)(x - dragOffsetX); - int newY = (int)(y - dragOffsetY); - int resourceX = newX; - int resourceY = newY; +} - // Update the associated resource - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) +void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) +{ + wxPanel *panel = (wxPanel *)handlerControl->GetParent(); + + dc.BeginDrawing(); + + int xpos, ypos, width, height; + handlerControl->GetPosition(&xpos, &ypos); + handlerControl->GetSize(&width, &height); + + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerControl); + wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(handlerControl->GetParent()); + + if (selectionHandle > 0) { - wxPoint pt = handlerControl->GetParent()->ConvertPixelsToDialog(wxPoint(newX, newY)); - pt = handlerControl->GetParent()->ConvertDialogToPixels(pt); - pt = handlerControl->GetParent()->ConvertPixelsToDialog(pt); - resourceX = pt.x; resourceY = pt.y; - pt = handlerControl->GetParent()->ConvertDialogToPixels(pt); - - // Having converted it several times, we know it'll map to dialog units exactly. - newX = pt.x; - newY = pt.y; + int x1, y1, width1, height1; + + switch (selectionHandle) + { + case 1: + x1 = xpos; + y1 = y; + width1 = width; + height1 = (ypos + height) - y; + break; + case 5: + x1 = xpos; + y1 = ypos; + width1 = width; + height1 = (y - ypos); + break; + case 3: + x1 = xpos; + y1 = ypos; + width1 = (x - xpos); + height1 = height; + break; + case 7: + x1 = x; + y1 = ypos; + width1 = (xpos + width) - x; + height1 = height; + break; + case 2: + x1 = xpos; + y1 = y; + width1 = (x - xpos); + height1 = (ypos + height) - y; + break; + case 4: + x1 = xpos; + y1 = ypos; + width1 = (x - xpos); + height1 = (y - ypos); + break; + case 6: + x1 = x; + y1 = ypos; + width1 = (xpos + width) - x; + height1 = y - ypos; + break; + case 8: + x1 = x; + y1 = y; + width1 = (xpos + width) - x; + height1 = (ypos + height) - y; + break; + } + // Update the associated resource + // We need to convert to dialog units if this is not a dialog or panel, but + // the parent resource specifies dialog units. + int resourceX = x1; + int resourceY = y1; + int resourceWidth = width1; + int resourceHeight = height1; + + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxPoint pt = handlerControl->GetParent()->ConvertPixelsToDialog(wxPoint(x1, y1)); + wxSize sz = handlerControl->GetParent()->ConvertPixelsToDialog(wxSize(width1, height1)); + + // Convert back so we've rounded down + sz = handlerControl->GetParent()->ConvertDialogToPixels(sz); + sz = handlerControl->GetParent()->ConvertPixelsToDialog(sz); + resourceWidth = sz.x; resourceHeight = sz.y; + + sz = handlerControl->GetParent()->ConvertDialogToPixels(sz); + width1 = sz.x; + height1 = sz.y; + + pt = handlerControl->GetParent()->ConvertDialogToPixels(pt); + pt = handlerControl->GetParent()->ConvertPixelsToDialog(pt); + resourceX = pt.x; resourceY = pt.y; + + pt = handlerControl->GetParent()->ConvertDialogToPixels(pt); + x1 = pt.x; + y1 = pt.y; + } + handlerControl->SetSize(x1, y1, width1, height1); + resource->SetSize(resourceX, resourceY, resourceWidth, resourceHeight); } - handlerControl->Move(newX, newY); - OldOnMove(newX, newY); - - resource->SetSize(resourceX, resourceY, resource->GetWidth(), resource->GetHeight()); - - // Also move other selected items - wxNode *node = panel->GetChildren().First(); - while (node) + else { - wxWindow *win = (wxWindow *)node->Data(); - if (win->IsKindOf(CLASSINFO(wxControl))) - { - wxControl *item = (wxControl *)win; - wxResourceEditorControlHandler *handler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - if ((item != handlerControl) && handler->IsSelected()) + // Correction 31/12/98. We need to round down the values to take into account + // the fact that several pixels map to the same dialog unit. + + int newX = (int)(x - dragOffsetX); + int newY = (int)(y - dragOffsetY); + int resourceX = newX; + int resourceY = newY; + + // Update the associated resource + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) { - int x1, y1; - item->GetPosition(&x1, &y1); - int x2 = (int)(x1 + (x - dragOffsetX) - xpos); - int y2 = (int)(y1 + (y - dragOffsetY) - ypos); - - // Update the associated resource - resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item); - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) - { - wxPoint pt = item->GetParent()->ConvertPixelsToDialog(wxPoint(x2, y2)); - pt = item->GetParent()->ConvertDialogToPixels(pt); - pt = item->GetParent()->ConvertPixelsToDialog(pt); - + wxPoint pt = handlerControl->GetParent()->ConvertPixelsToDialog(wxPoint(newX, newY)); + pt = handlerControl->GetParent()->ConvertDialogToPixels(pt); + pt = handlerControl->GetParent()->ConvertPixelsToDialog(pt); resourceX = pt.x; resourceY = pt.y; pt = handlerControl->GetParent()->ConvertDialogToPixels(pt); - - // Having converted it several times, we know it'll map to dialog units exactly - x2 = pt.x; - y2 = pt.y; - } - - item->Move(x2, y2); - ((wxResourceEditorControlHandler *)item->GetEventHandler())->OldOnMove(x2, y2); - ((wxResourceEditorControlHandler *)item->GetEventHandler())->DrawSelectionHandles(dc); - - resource->SetSize(resourceX, resourceY, resource->GetWidth(), resource->GetHeight()); - + + // Having converted it several times, we know it'll map to dialog units exactly. + newX = pt.x; + newY = pt.y; + } + handlerControl->Move(newX, newY); + OldOnMove(newX, newY); + + resource->SetSize(resourceX, resourceY, resource->GetWidth(), resource->GetHeight()); + + // Also move other selected items + wxNode *node = panel->GetChildren().First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + if (win->IsKindOf(CLASSINFO(wxControl))) + { + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *handler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if ((item != handlerControl) && handler->IsSelected()) + { + int x1, y1; + item->GetPosition(&x1, &y1); + int x2 = (int)(x1 + (x - dragOffsetX) - xpos); + int y2 = (int)(y1 + (y - dragOffsetY) - ypos); + + resourceX = x2; + resourceY = y2; + + // Update the associated resource + resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item); + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxPoint pt = item->GetParent()->ConvertPixelsToDialog(wxPoint(x2, y2)); + pt = item->GetParent()->ConvertDialogToPixels(pt); + pt = item->GetParent()->ConvertPixelsToDialog(pt); + + resourceX = pt.x; resourceY = pt.y; + pt = handlerControl->GetParent()->ConvertDialogToPixels(pt); + + // Having converted it several times, we know it'll map to dialog units exactly + x2 = pt.x; + y2 = pt.y; + } + + item->Move(x2, y2); + ((wxResourceEditorControlHandler *)item->GetEventHandler())->OldOnMove(x2, y2); + ((wxResourceEditorControlHandler *)item->GetEventHandler())->DrawSelectionHandles(dc); + + resource->SetSize(resourceX, resourceY, resource->GetWidth(), resource->GetHeight()); + + } + } + node = node->Next(); } - } - node = node->Next(); } - } - dc.SetOptimization(FALSE); - - dc.SetLogicalFunction(wxCOPY); - dc.SetPen(* wxBLACK_PEN); - dc.SetBrush(* wxBLACK_BRUSH); - - dc.SetOptimization(TRUE); - - // Force it to repaint the selection handles (if any) - // since the panel thinks we're still within a drag and - // won't paint the handles. - if (IsSelected()) - DrawSelectionHandles(dc); - - dc.EndDrawing(); - - panel->Refresh(); + dc.SetOptimization(FALSE); + + dc.SetLogicalFunction(wxCOPY); + dc.SetPen(* wxBLACK_PEN); + dc.SetBrush(* wxBLACK_BRUSH); + + dc.SetOptimization(TRUE); + + // Force it to repaint the selection handles (if any) + // since the panel thinks we're still within a drag and + // won't paint the handles. + if (IsSelected()) + DrawSelectionHandles(dc); + + dc.EndDrawing(); + + panel->Refresh(); } // These functions call OnItemEvent, OnItemMove and OnItemSize @@ -1132,71 +1135,71 @@ void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys), void wxResourceEditorControlHandler::OnMouseEvent(wxMouseEvent& event) { /* - if ((event.m_eventType == wxEVENT_TYPE_LEFT_DCLICK) || - (event.m_eventType == wxEVENT_TYPE_RIGHT_DCLICK)) - return; -*/ - wxWindow *panel = handlerControl->GetParent(); - if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) - return; - wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); - if ( !panelHandler->GetEvtHandlerEnabled() ) - { - event.Skip(); - return; - } +if ((event.m_eventType == wxEVENT_TYPE_LEFT_DCLICK) || +(event.m_eventType == wxEVENT_TYPE_RIGHT_DCLICK)) +return; + */ + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + if ( !panelHandler->GetEvtHandlerEnabled() ) + { + event.Skip(); + return; + } - panelHandler->OnItemEvent(handlerControl, event); + panelHandler->OnItemEvent(handlerControl, event); } void wxResourceEditorControlHandler::OldOnMove(int x, int y) { - wxWindow *panel = handlerControl->GetParent(); - if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) - return; - - wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); - panelHandler->OnItemMove(handlerControl, x, y); + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + panelHandler->OnItemMove(handlerControl, x, y); } void wxResourceEditorControlHandler::OldOnSize(int w, int h) { - wxWindow *panel = handlerControl->GetParent(); - if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) - return; - - wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); - panelHandler->OnItemSize(handlerControl, w, h); + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + panelHandler->OnItemSize(handlerControl, w, h); } void wxResourceEditorControlHandler::OnSelect(bool select) { - wxWindow *panel = handlerControl->GetParent(); - if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) - return; - - wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); - panelHandler->OnItemSelect(handlerControl, select); + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + panelHandler->OnItemSelect(handlerControl, select); } void wxResourceEditorControlHandler::OnLeftClick(int x, int y, int keys) { - wxWindow *panel = handlerControl->GetParent(); - if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) - return; - - wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); - panelHandler->OnItemLeftClick(handlerControl, x, y, keys); + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + panelHandler->OnItemLeftClick(handlerControl, x, y, keys); } void wxResourceEditorControlHandler::OnRightClick(int x, int y, int keys) { - wxWindow *panel = handlerControl->GetParent(); - if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) - return; - - wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); - panelHandler->OnItemRightClick(handlerControl, x, y, keys); + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + panelHandler->OnItemRightClick(handlerControl, x, y, keys); } diff --git a/utils/dialoged/src/dlghndlr.h b/utils/dialoged/src/dlghndlr.h index 80a9cf5ac8..e54ba36097 100644 --- a/utils/dialoged/src/dlghndlr.h +++ b/utils/dialoged/src/dlghndlr.h @@ -25,114 +25,125 @@ class wxResourceEditorDialogHandler: public wxEvtHandler { -DECLARE_CLASS(wxResourceEditorDialogHandler) - public: - wxResourceManager *resourceManager; - wxPanel *handlerDialog; - wxItemResource *handlerResource; - wxEvtHandler *handlerOldHandler; - - wxControl *dragItem; - int dragMode; - int dragType; - int dragTolerance; - bool checkTolerance; - int firstDragX; - int firstDragY; - int oldDragX; - int oldDragY; - bool m_mouseCaptured; -// long m_treeItem; - - wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler, - wxResourceManager *manager); - ~wxResourceEditorDialogHandler(void); - - void OnPaint(wxPaintEvent& event); - void OnMouseEvent(wxMouseEvent& event); - void OnSize(wxSizeEvent& event); - - virtual void OnItemEvent(wxControl *win, wxMouseEvent& event); - virtual void OnLeftClick(int x, int y, int keys); - virtual void OnRightClick(int x, int y, int keys); - virtual void OnItemLeftClick(wxControl *item, int x, int y, int keys); - virtual void OnItemRightClick(wxControl *item, int x, int y, int keys); - virtual void OnItemSelect(wxControl *item, bool select); - virtual void OnItemMove( - wxControl *WXUNUSED(item), int WXUNUSED(x), int WXUNUSED(y) ) {}; - virtual void OnItemSize( - wxControl *WXUNUSED(item), int WXUNUSED(w), int WXUNUSED(h) ) {}; - - void AddChildHandlers(void); - void PaintSelectionHandles(wxDC& dc); - void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle); - -// Accessors -/* - inline long GetTreeItem() const { return m_treeItem; } - inline void SetTreeItem(long item) { m_treeItem = item; } -*/ - -DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxResourceEditorDialogHandler) +public: + wxResourceManager *resourceManager; + wxPanel *handlerDialog; + wxItemResource *handlerResource; + wxEvtHandler *handlerOldHandler; + + wxControl *dragItem; + int dragMode; + int dragType; + int dragTolerance; + bool checkTolerance; + int firstDragX; + int firstDragY; + int oldDragX; + int oldDragY; + bool m_mouseCaptured; + // long m_treeItem; + + wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler, + wxResourceManager *manager); + ~wxResourceEditorDialogHandler(void); + + void OnPaint(wxPaintEvent& event); + void OnMouseEvent(wxMouseEvent& event); + void OnSize(wxSizeEvent& event); + + virtual void OnItemEvent(wxControl *win, wxMouseEvent& event); + virtual void OnLeftClick(int x, int y, int keys); + virtual void OnRightClick(int x, int y, int keys); + virtual void OnItemLeftClick(wxControl *item, int x, int y, int keys); + virtual void OnItemRightClick(wxControl *item, int x, int y, int keys); + virtual void OnItemSelect(wxControl *item, bool select); + virtual void OnItemMove( + wxControl *WXUNUSED(item), int WXUNUSED(x), int WXUNUSED(y) ) {}; + virtual void OnItemSize( + wxControl *WXUNUSED(item), int WXUNUSED(w), int WXUNUSED(h) ) {}; + + void AddChildHandlers(void); + void PaintSelectionHandles(wxDC& dc); + void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle); + + // Accessors + /* + inline long GetTreeItem() const { return m_treeItem; } + inline void SetTreeItem(long item) { m_treeItem = item; } + */ + + DECLARE_EVENT_TABLE() }; class wxResourceEditorControlHandler: public wxEvtHandler { -DECLARE_CLASS(wxResourceEditorControlHandler) - public: -// wxResourceManager *resourceManager; - wxControl *handlerControl; -// wxItemResource *handlerResource; - wxEvtHandler *handlerOldHandler; - - bool isSelected; - int handleSize; // selection handle size - int handleMargin; // Distance between item edge and handle edge - long m_treeItem; - static int dragOffsetX; // Distance between pointer at start of drag and - static int dragOffsetY; // top-left of item - - wxResourceEditorControlHandler(wxControl *control, wxEvtHandler *oldHandler); - ~wxResourceEditorControlHandler(void); - - void OnMouseEvent(wxMouseEvent& event); - - // Manipulation and drawing of items in Edit Mode - - // Calculate position of the 8 handles - virtual void CalcSelectionHandles(int *hx, int *hy); - virtual void DrawSelectionHandles(wxDC& dc, bool erase = FALSE); - virtual void DrawBoundingBox(wxDC& dc, int x, int y, int w, int h); - virtual void SelectItem(bool select); - virtual inline bool IsSelected(void) { return isSelected; } - - // Returns TRUE or FALSE - virtual bool HitTest(int x, int y); - - // Returns 0 (no hit), 1 - 8 for which selection handle - // (clockwise from top middle) - virtual int SelectionHandleHitTest(int x, int y); - - // If selectionHandle is zero, not dragging the selection handle. - virtual void OnDragBegin(int x, int y, int keys, wxDC& dc, int selectionHandle); - virtual void OnDragContinue(bool paintIt, int x, int y, int keys, wxDC& dc, int selectionHandle); - virtual void OnDragEnd(int x, int y, int keys, wxDC& dc, int selectionHandle); - - // These functions call panel functions - // by default. - virtual void OldOnMove(int x, int y); - virtual void OldOnSize(int w, int h); - virtual void OnLeftClick(int x, int y, int keys); - virtual void OnRightClick(int x, int y, int keys); - virtual void OnSelect(bool select); - -// Accessors -/* - inline long GetTreeItem() const { return m_treeItem; } - inline void SetTreeItem(long item) { m_treeItem = item; } -*/ + DECLARE_CLASS(wxResourceEditorControlHandler) +public: + // wxResourceManager *resourceManager; + wxControl *handlerControl; + // wxItemResource *handlerResource; + wxEvtHandler *handlerOldHandler; + + bool isSelected; + int handleSize; // selection handle size + int handleMargin; // Distance between item edge and handle edge + long m_treeItem; + static int dragOffsetX; // Distance between pointer at start of drag and + static int dragOffsetY; // top-left of item + + wxResourceEditorControlHandler(wxControl *control, wxEvtHandler *oldHandler); + ~wxResourceEditorControlHandler(void); + + void OnMouseEvent(wxMouseEvent& event); + + // Manipulation and drawing of items in Edit Mode + + // Calculate position of the 8 handles + virtual void CalcSelectionHandles(int *hx, int *hy); + virtual void DrawSelectionHandles(wxDC& dc, bool erase = FALSE); + virtual void DrawBoundingBox(wxDC& dc, int x, int y, int w, int h); + virtual void SelectItem(bool select); + virtual inline bool IsSelected(void) { return isSelected; } + + // Returns TRUE or FALSE + virtual bool HitTest(int x, int y); + + // Returns 0 (no hit), 1 - 8 for which selection handle + // (clockwise from top middle) + virtual int SelectionHandleHitTest(int x, int y); + + // If selectionHandle is zero, not dragging the selection handle. + virtual void OnDragBegin(int x, int y, int keys, wxDC& dc, int selectionHandle); + virtual void OnDragContinue(bool paintIt, int x, int y, int keys, wxDC& dc, int selectionHandle); + virtual void OnDragEnd(int x, int y, int keys, wxDC& dc, int selectionHandle); + + // These functions call panel functions + // by default. + virtual void OldOnMove(int x, int y); + virtual void OldOnSize(int w, int h); + virtual void OnLeftClick(int x, int y, int keys); + virtual void OnRightClick(int x, int y, int keys); + virtual void OnSelect(bool select); + + // Accessors + /* + inline long GetTreeItem() const { return m_treeItem; } + inline void SetTreeItem(long item) { m_treeItem = item; } + */ + + DECLARE_EVENT_TABLE() +}; -DECLARE_EVENT_TABLE() +// This dialog, for testing dialogs, has to intercept commands before +// they go up the hierarchy and accidentally set off arbitrary +// Dialog Editor functionality +class ResourceEditorDialogTester: public wxDialog +{ +public: + ResourceEditorDialogTester() {} + + bool ProcessEvent(wxEvent& event); }; #endif diff --git a/utils/dialoged/src/edlist.cpp b/utils/dialoged/src/edlist.cpp index 087736aaf4..205a6fd153 100644 --- a/utils/dialoged/src/edlist.cpp +++ b/utils/dialoged/src/edlist.cpp @@ -41,8 +41,8 @@ BEGIN_EVENT_TABLE(wxResourceEditorControlList, wxListCtrl) END_EVENT_TABLE() wxResourceEditorControlList::wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style): - wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE) + long style): +wxListCtrl(parent, id, pos, size, style), m_imageList(16, 16, TRUE) { Initialize(); } @@ -74,7 +74,7 @@ void wxResourceEditorControlList::Initialize() wxIcon icon16("RADIOBTN_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); wxIcon icon17("SCROLBAR_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); #else - + #include "bitmaps/arrow.xpm" wxIcon icon1( arrow_xpm ); #include "bitmaps/button.xpm" @@ -110,7 +110,7 @@ void wxResourceEditorControlList::Initialize() #include "bitmaps/scrolbar.xpm" wxIcon icon17( scrolbar_xpm ); #endif - + m_imageList.Add(icon1); m_imageList.Add(icon2); m_imageList.Add(icon3); @@ -130,7 +130,7 @@ void wxResourceEditorControlList::Initialize() m_imageList.Add(icon17); SetImageList(& m_imageList, wxIMAGE_LIST_SMALL); - + long id = InsertItem(0, "Pointer", 0); id = InsertItem(1, "wxButton", 1); id = InsertItem(2, "wxBitmapButton", 2); @@ -148,14 +148,14 @@ void wxResourceEditorControlList::Initialize() id = InsertItem(14, "wxRadioBox", 14); id = InsertItem(15, "wxRadioButton", 15); id = InsertItem(16, "wxScrollBar", 16); - -/* + + /* InsertItem(RESED_TREECTRL, "wxTreeCtrl", 16); InsertItem(RESED_LISTCTRL, "wxListCtrl", 17); InsertItem(RESED_SPINBUTTON, "wxSpinButton", 18); -*/ - -// SetColumnWidth(-1, 80); + */ + + // SetColumnWidth(-1, 80); } // Get selection, or -1 diff --git a/utils/dialoged/src/edlist.h b/utils/dialoged/src/edlist.h index 9777c01355..6ab9369f1f 100644 --- a/utils/dialoged/src/edlist.h +++ b/utils/dialoged/src/edlist.h @@ -21,15 +21,15 @@ public: wxResourceEditorControlList(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style = wxLC_SMALL_ICON|wxLC_AUTOARRANGE|wxLC_SINGLE_SEL); ~wxResourceEditorControlList(); - + // Load icons and add to the list void Initialize(); - + // Get selection, or -1 long GetSelection() const; - -DECLARE_EVENT_TABLE() - + + DECLARE_EVENT_TABLE() + protected: wxImageList m_imageList; }; diff --git a/utils/dialoged/src/edtree.cpp b/utils/dialoged/src/edtree.cpp index 00086583d8..168fa100cd 100644 --- a/utils/dialoged/src/edtree.cpp +++ b/utils/dialoged/src/edtree.cpp @@ -38,13 +38,13 @@ #include "reseditr.h" BEGIN_EVENT_TABLE(wxResourceEditorProjectTree, wxTreeCtrl) - EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick) - EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged) +EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick) +EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged) END_EVENT_TABLE() wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style): - wxTreeCtrl(parent, id, pos, size, style) + long style): +wxTreeCtrl(parent, id, pos, size, style) { } @@ -54,18 +54,18 @@ void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& WXUNUSED(event)) long sel = GetSelection(); if (sel == -1) return; - + if (GetItemData(sel) == 0) return; - + wxItemResource* res = (wxResourceTreeData *)GetItemData(sel)->GetResource(); wxString resType(res->GetType()); if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel") return; - + wxResourceEditorFrame *frame = (wxResourceEditorFrame *)wxWindow::GetParent(); wxResourceManager *manager = frame->manager; - + manager->EditSelectedResource(); #endif } @@ -75,18 +75,18 @@ void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& WXUNUSED(event)) long sel = GetSelection(); if (sel == -1) return; - + if (GetItemData(sel) == 0) return; - + if (m_invalid) return; - + wxItemResource* res = ((wxResourceTreeData *)GetItemData(sel))->GetResource(); wxString resType(res->GetType()); if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel") return; - + wxResourceManager::GetCurrentResourceManager()->Edit(res); } diff --git a/utils/dialoged/src/edtree.h b/utils/dialoged/src/edtree.h index 3928c5aa7d..37b05dcd59 100644 --- a/utils/dialoged/src/edtree.h +++ b/utils/dialoged/src/edtree.h @@ -19,17 +19,17 @@ class wxResourceEditorProjectTree: public wxTreeCtrl public: wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style = wxTR_HAS_BUTTONS); - + void LeftDClick(wxMouseEvent& event); void OnSelChanged(wxTreeEvent& event); - + inline void SetInvalid(bool invalid) { m_invalid = invalid; } - + protected: bool m_invalid; // While TRUE, don't respond to selections etc. - -DECLARE_EVENT_TABLE() - + + DECLARE_EVENT_TABLE() + }; #endif diff --git a/utils/dialoged/src/makefile.vc b/utils/dialoged/src/makefile.vc index fce0a56fd7..83b6066167 100644 --- a/utils/dialoged/src/makefile.vc +++ b/utils/dialoged/src/makefile.vc @@ -84,6 +84,8 @@ DOCSOURCES=$(LOCALDOCDIR)\dialoged.tex $(LOCALDOCDIR)\body.tex\ $(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\tech.tex html: $(DOCDIR)\html\dialoged\dlged.htm +htmlhelp: $(DOCDIR)\htmlhelp\dialoged.chm +htb: $(DOCDIR)\htb\dialoged.htb hlp: $(DOCDIR)\winhelp\dialoged.hlp pdfrtf: $(DOCDIR)\pdf\dialoged.rtf ps: $(DOCDIR)\ps\dialoged.ps @@ -110,11 +112,30 @@ $(DOCDIR)\pdf\dialoged.rtf: $(DOCSOURCES) $(DOCDIR)\html\dialoged\dlged.htm: $(DOCSOURCES) cd $(LOCALDOCDIR) -mkdir $(DOCDIR)\html\dialoged + -copy *.gif $(DOCDIR)\html\dialoged -start /w tex2rtf $(LOCALDOCDIR)\dialoged.tex $(DOCDIR)\html\dialoged\dlged.htm -twice -html -erase $(DOCDIR)\html\dialoged\*.con -erase $(DOCDIR)\html\dialoged\*.ref cd $(THISDIR) +$(DOCDIR)\htmlhelp\dialoged.chm : $(DOCDIR)\html\dialoged\dlged.htm $(DOCDIR)\html\dialoged\dlged.hhp + cd $(DOCDIR)\html\dialoged + -hhc dlged.hhp + move $(DOCDIR)\html\dialoged\dlged.chm $(DOCDIR)\htmlhelp\dialoged.chm + cd $(THISDIR) + +# An htb file is a zip file containing the .htm, .gif, .hhp, .hhc and .hhk +# files, renamed to htb. +# This can then be used with e.g. helpview. +# Optionally, a cached version of the .hhp file can be generated with hhp2cached. +$(DOCDIR)\htb\dialoged.htb: $(DOCDIR)\html\dialoged\dlged.htm + cd $(DOCDIR)\html\dialoged + -erase /Y dialoged.zip dialoged.htb + zip32 dialoged.zip *.htm *.gif *.hhp *.hhc *.hhk + -mkdir $(DOCDIR)\htb + move dialoged.zip $(DOCDIR)\htb\dialoged.htb + cd $(THISDIR) + $(LOCALDOCDIR)\dialoged.dvi: $(DOCSOURCES) cd $(LOCALDOCDIR) -latex dialoged diff --git a/utils/dialoged/src/reseditr.cpp b/utils/dialoged/src/reseditr.cpp index 1e831519df..5f1b105bbb 100644 --- a/utils/dialoged/src/reseditr.cpp +++ b/utils/dialoged/src/reseditr.cpp @@ -38,6 +38,8 @@ #include "wx/scrolbar.h" #include "wx/config.h" +#include "wx/dir.h" +#include "wx/progdlg.h" #include <ctype.h> #include <stdlib.h> @@ -71,6 +73,10 @@ wxResourceManager *wxResourceManager::sm_currentResourceManager = NULL; #include "bitmaps/toback.xpm" #include "bitmaps/help.xpm" #include "bitmaps/wxwin.xpm" +#include "bitmaps/distvert.xpm" +#include "bitmaps/disthor.xpm" +#include "bitmaps/copywdth.xpm" +#include "bitmaps/copyhght.xpm" #include "bitmaps/dialog.xpm" #include "bitmaps/folder1.xpm" @@ -79,529 +85,508 @@ wxResourceManager *wxResourceManager::sm_currentResourceManager = NULL; #endif /* - * Resource manager - */ +* Resource manager +*/ wxResourceManager::wxResourceManager(): - m_imageList(16, 16, TRUE) -{ - sm_currentResourceManager = this; - m_editorFrame = NULL; - m_editorPanel = NULL; - m_popupMenu = NULL; - m_editorResourceTree = NULL; - m_editorControlList = NULL; - m_nameCounter = 1; - m_symbolIdCounter = 99; - m_modified = FALSE; - m_currentFilename = ""; - m_symbolFilename = ""; - m_editorToolBar = NULL; - - // Default window positions - m_resourceEditorWindowSize.width = 500; - m_resourceEditorWindowSize.height = 450; - - m_resourceEditorWindowSize.x = 0; - m_resourceEditorWindowSize.y = 0; - - m_propertyWindowSize.width = 300; - m_propertyWindowSize.height = 300; - +m_imageList(16, 16, TRUE) +{ + sm_currentResourceManager = this; + m_editorFrame = NULL; + m_editorPanel = NULL; + m_popupMenu = NULL; + m_editorResourceTree = NULL; + m_editorControlList = NULL; + m_nameCounter = 1; + m_symbolIdCounter = 99; + m_modified = FALSE; + m_currentFilename = ""; + m_symbolFilename = ""; + m_editorToolBar = NULL; + + // Default window positions + m_resourceEditorWindowSize.width = 500; + m_resourceEditorWindowSize.height = 450; + + m_resourceEditorWindowSize.x = 0; + m_resourceEditorWindowSize.y = 0; + + m_propertyWindowSize.width = 300; + m_propertyWindowSize.height = 300; + #ifdef __WXMSW__ - m_helpController = NULL; + m_helpController = NULL; #endif - - m_bitmapImage = NULL; - m_rootDialogItem = 0; + + m_bitmapImage = NULL; + m_rootDialogItem = 0; } wxResourceManager::~wxResourceManager() { - sm_currentResourceManager = NULL; - SaveOptions(); - + sm_currentResourceManager = NULL; + SaveOptions(); + #ifdef __WXMSW__ - if (m_helpController) - { - m_helpController->Quit(); - delete m_helpController; - m_helpController = NULL; - } + if (m_helpController) + { + m_helpController->Quit(); + delete m_helpController; + m_helpController = NULL; + } #endif - - delete m_bitmapImage; - delete m_popupMenu; + + delete m_bitmapImage; + delete m_popupMenu; } bool wxResourceManager::Initialize() { - // Set up the resource filename for each platform. - // TODO: This shold be replaced by wxConfig usage. + // Set up the resource filename for each platform. + // TODO: This shold be replaced by wxConfig usage. #ifdef __WXMSW__ - // dialoged.ini in the Windows directory - wxString windowsDir = wxGetOSDirectory(); - windowsDir += "\\dialoged.ini" ; - - m_optionsResourceFilename = windowsDir; + // dialoged.ini in the Windows directory + wxString windowsDir = wxGetOSDirectory(); + windowsDir += "\\dialoged.ini" ; + + m_optionsResourceFilename = windowsDir; #elif defined(__WXGTK__) || defined(__WXMOTIF__) - wxGetHomeDir( &m_optionsResourceFilename ); - m_optionsResourceFilename += "/.dialogedrc"; + wxGetHomeDir( &m_optionsResourceFilename ); + m_optionsResourceFilename += "/.dialogedrc"; #else #error "Unsupported platform." #endif - - LoadOptions(); - + + LoadOptions(); + #ifdef __WXMSW__ - m_helpController = new wxHelpController; - m_helpController->Initialize("dialoged"); + m_helpController = new wxHelpController; + m_helpController->Initialize("dialoged"); #endif - - m_popupMenu = new wxMenu; - m_popupMenu->Append(OBJECT_MENU_EDIT, "Edit properties"); - m_popupMenu->Append(OBJECT_MENU_DELETE, "Delete object"); - - if (!m_bitmapImage) - { + + m_popupMenu = new wxMenu; + m_popupMenu->Append(OBJECT_MENU_EDIT, "Edit properties"); + m_popupMenu->Append(OBJECT_MENU_DELETE, "Delete object"); + + if (!m_bitmapImage) + { #ifdef __WXMSW__ - m_bitmapImage = new wxBitmap("WXWINBMP", wxBITMAP_TYPE_BMP_RESOURCE); + m_bitmapImage = new wxBitmap("WXWINBMP", wxBITMAP_TYPE_BMP_RESOURCE); #endif #if defined(__WXGTK__) || defined(__WXMOTIF__) - m_bitmapImage = new wxBitmap( wxwin_xpm ); + m_bitmapImage = new wxBitmap( wxwin_xpm ); #endif - } - - // Initialize the image list icons + } + + // Initialize the image list icons #ifdef __WXMSW__ - wxIcon icon1("DIALOG_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); - wxIcon icon2("FOLDER1_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); - wxIcon icon3("FOLDER2_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); - wxIcon icon4("BUTTONSM_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); + wxIcon icon1("DIALOG_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); + wxIcon icon2("FOLDER1_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); + wxIcon icon3("FOLDER2_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); + wxIcon icon4("BUTTONSM_ICON", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16); #else - wxIcon icon1( dialog_xpm ); - wxIcon icon2( folder1_xpm ); - wxIcon icon3( folder2_xpm ); - wxIcon icon4( buttonsm_xpm ); + wxIcon icon1( dialog_xpm ); + wxIcon icon2( folder1_xpm ); + wxIcon icon3( folder2_xpm ); + wxIcon icon4( buttonsm_xpm ); #endif - m_imageList.Add(icon1); - m_imageList.Add(icon2); - m_imageList.Add(icon3); - m_imageList.Add(icon4); - - m_symbolTable.AddStandardSymbols(); - - return TRUE; + m_imageList.Add(icon1); + m_imageList.Add(icon2); + m_imageList.Add(icon3); + m_imageList.Add(icon4); + + m_symbolTable.AddStandardSymbols(); + + return TRUE; } bool wxResourceManager::LoadOptions() { - wxConfig config("DialogEd", "wxWindows"); - - config.Read("editorWindowX", &m_resourceEditorWindowSize.x); - config.Read("editorWindowY", &m_resourceEditorWindowSize.y); - config.Read("editorWindowWidth", &m_resourceEditorWindowSize.width); - config.Read("editorWindowHeight", &m_resourceEditorWindowSize.height); - config.Read("propertyWindowX", &m_propertyWindowSize.x); - config.Read("propertyWindowY", &m_propertyWindowSize.y); - config.Read("propertyWindowWidth", &m_propertyWindowSize.width); - config.Read("propertyWindowHeight", &m_propertyWindowSize.height); - - /* - wxGetResource("DialogEd", "editorWindowX", &m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData()); - wxGetResource("DialogEd", "editorWindowY", &m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData()); - wxGetResource("DialogEd", "editorWindowWidth", &m_resourceEditorWindowSize.width, m_optionsResourceFilename.GetData()); - wxGetResource("DialogEd", "editorWindowHeight", &m_resourceEditorWindowSize.height, m_optionsResourceFilename.GetData()); - wxGetResource("DialogEd", "propertyWindowX", &m_propertyWindowSize.x, m_optionsResourceFilename.GetData()); - wxGetResource("DialogEd", "propertyWindowY", &m_propertyWindowSize.y, m_optionsResourceFilename.GetData()); - wxGetResource("DialogEd", "propertyWindowWidth", &m_propertyWindowSize.width, m_optionsResourceFilename.GetData()); - wxGetResource("DialogEd", "propertyWindowHeight", &m_propertyWindowSize.height, m_optionsResourceFilename.GetData()); - */ - return TRUE; + wxConfig config("DialogEd", "wxWindows"); + + config.Read("editorWindowX", &m_resourceEditorWindowSize.x); + config.Read("editorWindowY", &m_resourceEditorWindowSize.y); + config.Read("editorWindowWidth", &m_resourceEditorWindowSize.width); + config.Read("editorWindowHeight", &m_resourceEditorWindowSize.height); + config.Read("propertyWindowX", &m_propertyWindowSize.x); + config.Read("propertyWindowY", &m_propertyWindowSize.y); + config.Read("propertyWindowWidth", &m_propertyWindowSize.width); + config.Read("propertyWindowHeight", &m_propertyWindowSize.height); + + return TRUE; } bool wxResourceManager::SaveOptions() { - wxConfig config("DialogEd", "wxWindows"); - - config.Write("editorWindowX", (long) m_resourceEditorWindowSize.x); - config.Write("editorWindowY", (long) m_resourceEditorWindowSize.y); - config.Write("editorWindowWidth", (long) m_resourceEditorWindowSize.width); - config.Write("editorWindowHeight", (long) m_resourceEditorWindowSize.height); - config.Write("propertyWindowX", (long) m_propertyWindowSize.x); - config.Write("propertyWindowY", (long) m_propertyWindowSize.y); - config.Write("propertyWindowWidth", (long) m_propertyWindowSize.width); - config.Write("propertyWindowHeight", (long) m_propertyWindowSize.height); - /* - wxWriteResource("DialogEd", "editorWindowX", m_resourceEditorWindowSize.x, m_optionsResourceFilename.GetData()); - wxWriteResource("DialogEd", "editorWindowY", m_resourceEditorWindowSize.y, m_optionsResourceFilename.GetData()); - wxWriteResource("DialogEd", "editorWindowWidth", m_resourceEditorWindowSize.width, m_optionsResourceFilename.GetData()); - wxWriteResource("DialogEd", "editorWindowHeight", m_resourceEditorWindowSize.height, m_optionsResourceFilename.GetData()); - - wxWriteResource("DialogEd", "propertyWindowX", m_propertyWindowSize.x, m_optionsResourceFilename.GetData()); - wxWriteResource("DialogEd", "propertyWindowY", m_propertyWindowSize.y, m_optionsResourceFilename.GetData()); - wxWriteResource("DialogEd", "propertyWindowWidth", m_propertyWindowSize.width, m_optionsResourceFilename.GetData()); - wxWriteResource("DialogEd", "propertyWindowHeight", m_propertyWindowSize.height, m_optionsResourceFilename.GetData()); - */ - - return TRUE; + wxConfig config("DialogEd", "wxWindows"); + + config.Write("editorWindowX", (long) m_resourceEditorWindowSize.x); + config.Write("editorWindowY", (long) m_resourceEditorWindowSize.y); + config.Write("editorWindowWidth", (long) m_resourceEditorWindowSize.width); + config.Write("editorWindowHeight", (long) m_resourceEditorWindowSize.height); + config.Write("propertyWindowX", (long) m_propertyWindowSize.x); + config.Write("propertyWindowY", (long) m_propertyWindowSize.y); + config.Write("propertyWindowWidth", (long) m_propertyWindowSize.width); + config.Write("propertyWindowHeight", (long) m_propertyWindowSize.height); + + return TRUE; } // Show or hide the resource editor frame, which displays a list // of resources with ability to edit them. bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *WXUNUSED(parent), const char *title) { - if (show) - { - if (m_editorFrame) + if (show) { - m_editorFrame->Iconize(FALSE); - m_editorFrame->Show(TRUE); - return TRUE; - } - m_editorFrame = OnCreateEditorFrame(title); - SetFrameTitle(""); - wxMenuBar *menuBar = OnCreateEditorMenuBar(m_editorFrame); - m_editorFrame->SetMenuBar(menuBar); - - m_editorToolBar = (EditorToolBar *)OnCreateToolBar(m_editorFrame); - m_editorControlList = new wxResourceEditorControlList(m_editorFrame, IDC_LISTCTRL, wxPoint(0, 0), wxSize(-1, -1)); - m_editorResourceTree = new wxResourceEditorProjectTree(m_editorFrame, IDC_TREECTRL, wxPoint(0, 0), wxSize(-1, -1), - wxTR_HAS_BUTTONS); - m_editorPanel = OnCreateEditorPanel(m_editorFrame); - - m_editorResourceTree->SetImageList(& m_imageList); - - // Constraints for toolbar - wxLayoutConstraints *c = new wxLayoutConstraints; - c->left.SameAs (m_editorFrame, wxLeft, 0); - c->top.SameAs (m_editorFrame, wxTop, 0); - c->right.SameAs (m_editorFrame, wxRight, 0); - c->bottom.Unconstrained(); - c->width.Unconstrained(); - c->height.Absolute(28); - m_editorToolBar->SetConstraints(c); - - // Constraints for listbox - c = new wxLayoutConstraints; - c->left.SameAs (m_editorFrame, wxLeft, 0); - c->top.SameAs (m_editorToolBar, wxBottom, 0); - c->right.Absolute (150); - c->bottom.SameAs (m_editorControlList, wxTop, 0); - c->width.Unconstrained(); - c->height.Unconstrained(); - m_editorResourceTree->SetConstraints(c); - - // Constraints for panel - c = new wxLayoutConstraints; - c->left.SameAs (m_editorResourceTree, wxRight, 0); - c->top.SameAs (m_editorToolBar, wxBottom, 0); - c->right.SameAs (m_editorFrame, wxRight, 0); - c->bottom.SameAs (m_editorControlList, wxTop, 0); - c->width.Unconstrained(); - c->height.Unconstrained(); - m_editorPanel->SetConstraints(c); - - // Constraints for control list (bottom window) - c = new wxLayoutConstraints; - c->left.SameAs (m_editorFrame, wxLeft, 0); - c->right.SameAs (m_editorFrame, wxRight, 0); - c->bottom.SameAs (m_editorFrame, wxBottom, 0); - c->width.Unconstrained(); + if (m_editorFrame) + { + m_editorFrame->Iconize(FALSE); + m_editorFrame->Show(TRUE); + return TRUE; + } + m_editorFrame = OnCreateEditorFrame(title); + SetFrameTitle(""); + wxMenuBar *menuBar = OnCreateEditorMenuBar(m_editorFrame); + m_editorFrame->SetMenuBar(menuBar); + + m_editorToolBar = (EditorToolBar *)OnCreateToolBar(m_editorFrame); + m_editorControlList = new wxResourceEditorControlList(m_editorFrame, IDC_LISTCTRL, wxPoint(0, 0), wxSize(-1, -1)); + m_editorResourceTree = new wxResourceEditorProjectTree(m_editorFrame, IDC_TREECTRL, wxPoint(0, 0), wxSize(-1, -1), + wxTR_HAS_BUTTONS); + m_editorPanel = OnCreateEditorPanel(m_editorFrame); + + m_editorResourceTree->SetImageList(& m_imageList); + + // Constraints for toolbar + wxLayoutConstraints *c = new wxLayoutConstraints; + c->left.SameAs (m_editorFrame, wxLeft, 0); + c->top.SameAs (m_editorFrame, wxTop, 0); + c->right.SameAs (m_editorFrame, wxRight, 0); + c->bottom.Unconstrained(); + c->width.Unconstrained(); + c->height.Absolute(28); + m_editorToolBar->SetConstraints(c); + + // Constraints for listbox + c = new wxLayoutConstraints; + c->left.SameAs (m_editorFrame, wxLeft, 0); + c->top.SameAs (m_editorToolBar, wxBottom, 0); + c->right.Absolute (150); + c->bottom.SameAs (m_editorControlList, wxTop, 0); + c->width.Unconstrained(); + c->height.Unconstrained(); + m_editorResourceTree->SetConstraints(c); + + // Constraints for panel + c = new wxLayoutConstraints; + c->left.SameAs (m_editorResourceTree, wxRight, 0); + c->top.SameAs (m_editorToolBar, wxBottom, 0); + c->right.SameAs (m_editorFrame, wxRight, 0); + c->bottom.SameAs (m_editorControlList, wxTop, 0); + c->width.Unconstrained(); + c->height.Unconstrained(); + m_editorPanel->SetConstraints(c); + + // Constraints for control list (bottom window) + c = new wxLayoutConstraints; + c->left.SameAs (m_editorFrame, wxLeft, 0); + c->right.SameAs (m_editorFrame, wxRight, 0); + c->bottom.SameAs (m_editorFrame, wxBottom, 0); + c->width.Unconstrained(); #if defined(__WXGTK__) || defined(__WXMOTIF__) - c->height.Absolute(120); + c->height.Absolute(120); #else - c->height.Absolute(60); + c->height.Absolute(60); #endif - - m_editorControlList->SetConstraints(c); - - m_editorFrame->SetAutoLayout(TRUE); - - UpdateResourceList(); - - m_editorFrame->Show(TRUE); - return TRUE; - } - else - { - if (m_editorFrame->Close()) + + m_editorControlList->SetConstraints(c); + + m_editorFrame->SetAutoLayout(TRUE); + + UpdateResourceList(); + + m_editorFrame->Show(TRUE); + return TRUE; + } + else { - m_editorFrame = NULL; - m_editorPanel = NULL; + if (m_editorFrame->Close()) + { + m_editorFrame = NULL; + m_editorPanel = NULL; + } } - } - return TRUE; + return TRUE; } void wxResourceManager::SetFrameTitle(const wxString& filename) { - if (m_editorFrame) - { - if (filename == wxString("")) - m_editorFrame->SetTitle("wxWindows Dialog Editor - untitled"); - else + if (m_editorFrame) { - wxString str("wxWindows Dialog Editor - "); - wxString str2(wxFileNameFromPath(WXSTRINGCAST filename)); - str += str2; - m_editorFrame->SetTitle(str); + if (filename == wxString("")) + m_editorFrame->SetTitle("wxWindows Dialog Editor - untitled"); + else + { + wxString str("wxWindows Dialog Editor - "); + wxString str2(wxFileNameFromPath(WXSTRINGCAST filename)); + str += str2; + m_editorFrame->SetTitle(str); + } } - } } bool wxResourceManager::Save() { - if (m_currentFilename == wxString("")) - return SaveAs(); - else - return Save(m_currentFilename); + if (m_currentFilename == wxString("")) + return SaveAs(); + else + return Save(m_currentFilename); } bool wxResourceManager::Save(const wxString& filename) { - // Ensure all visible windows are saved to their resources - m_currentFilename = filename; - SetFrameTitle(m_currentFilename); - InstantiateAllResourcesFromWindows(); - if (m_resourceTable.Save(filename)) - { - m_symbolTable.WriteIncludeFile(m_symbolFilename); - Modify(FALSE); - return TRUE; - } - else - return FALSE; + // Ensure all visible windows are saved to their resources + m_currentFilename = filename; + SetFrameTitle(m_currentFilename); + InstantiateAllResourcesFromWindows(); + if (m_resourceTable.Save(filename)) + { + m_symbolTable.WriteIncludeFile(m_symbolFilename); + Modify(FALSE); + return TRUE; + } + else + return FALSE; } bool wxResourceManager::SaveAs() { - wxString s(wxFileSelector("Save resource file", wxPathOnly(WXSTRINGCAST m_currentFilename), wxFileNameFromPath(WXSTRINGCAST m_currentFilename), - "wxr", "*.wxr", wxSAVE | wxOVERWRITE_PROMPT, wxTheApp->GetTopWindow())); + wxString s(wxFileSelector("Save resource file", wxPathOnly(WXSTRINGCAST m_currentFilename), wxFileNameFromPath(WXSTRINGCAST m_currentFilename), + "wxr", "*.wxr", wxSAVE | wxOVERWRITE_PROMPT, wxTheApp->GetTopWindow())); - if (s.IsNull() || s == "") - return FALSE; + if (s.IsNull() || s == "") + return FALSE; - m_currentFilename = s; - wxStripExtension(m_currentFilename); - m_currentFilename += ".wxr"; - - // Construct include filename from this file - m_symbolFilename = m_currentFilename; - - wxStripExtension(m_symbolFilename); - m_symbolFilename += ".h"; - - Save(m_currentFilename); - return TRUE; + m_currentFilename = s; + wxStripExtension(m_currentFilename); + m_currentFilename += ".wxr"; + + // Construct include filename from this file + m_symbolFilename = m_currentFilename; + + wxStripExtension(m_symbolFilename); + m_symbolFilename += ".h"; + + Save(m_currentFilename); + return TRUE; } bool wxResourceManager::SaveIfModified() { - if (Modified()) - return Save(); - else return TRUE; + if (Modified()) + return Save(); + else return TRUE; } bool wxResourceManager::Load(const wxString& filename) { - return New(TRUE, filename); + return New(TRUE, filename); } bool wxResourceManager::New(bool loadFromFile, const wxString& filename) { - if (!Clear(TRUE, FALSE)) - return FALSE; - - m_symbolTable.AddStandardSymbols(); - - if (loadFromFile) - { - wxString str = filename; - if (str == wxString("")) - { - wxString f(wxFileSelector("Open resource file", NULL, NULL, "wxr", "*.wxr", 0, wxTheApp->GetTopWindow())); - if (!f.IsNull() && f != "") - str = f; - else + if (!Clear(TRUE, FALSE)) return FALSE; - } - if (!m_resourceTable.ParseResourceFile(str)) - { - wxMessageBox("Could not read file.", "Resource file load error", wxOK | wxICON_EXCLAMATION); - return FALSE; - } - m_currentFilename = str; - - SetFrameTitle(m_currentFilename); - - UpdateResourceList(); - - // Construct include filename from this file - m_symbolFilename = m_currentFilename; - - wxStripExtension(m_symbolFilename); - m_symbolFilename += ".h"; - - if (!m_symbolTable.ReadIncludeFile(m_symbolFilename)) + m_symbolTable.AddStandardSymbols(); + + if (loadFromFile) { - wxString str("Could not find include file "); - str += m_symbolFilename; - str += ".\nDialog Editor maintains a header file containing id symbols to be used in the application.\n"; - str += "The next time this .wxr file is saved, a header file will be saved also."; - wxMessageBox(str, "Dialog Editor Warning", wxOK ); - - m_symbolIdCounter = 99; + wxString str = filename; + if (str == wxString("")) + { + wxString f(wxFileSelector("Open resource file", wxGetCwd(), wxEmptyString, "wxr", "*.wxr", 0, wxTheApp->GetTopWindow())); + if (!f.IsNull() && f != "") + str = f; + else + return FALSE; + } + + if (!m_resourceTable.ParseResourceFile(str)) + { + wxMessageBox("Could not read file.", "Resource file load error", wxOK | wxICON_EXCLAMATION); + return FALSE; + } + m_currentFilename = str; + + SetFrameTitle(m_currentFilename); + + UpdateResourceList(); + + // Construct include filename from this file + m_symbolFilename = m_currentFilename; + + wxStripExtension(m_symbolFilename); + m_symbolFilename += ".h"; + + if (!m_symbolTable.ReadIncludeFile(m_symbolFilename)) + { + wxString str("Could not find include file "); + str += m_symbolFilename; + str += ".\nDialog Editor maintains a header file containing id symbols to be used in the application.\n"; + str += "The next time this .wxr file is saved, a header file will be saved also."; + wxMessageBox(str, "Dialog Editor Warning", wxOK ); + + m_symbolIdCounter = 99; + } + else + { + // Set the id counter to the last known id + m_symbolIdCounter = m_symbolTable.FindHighestId(); + } + + // Now check in case some (or all) resources don't have resource ids, or they + // don't match the .h file, or something of that nature. + bool altered = RepairResourceIds(); + if (altered) + { + wxMessageBox("Some resources have had new identifiers associated with them, since they were missing.", + "Dialog Editor Warning", wxOK ); + Modify(TRUE); + } + else + Modify(FALSE); + + return TRUE; } else { - // Set the id counter to the last known id - m_symbolIdCounter = m_symbolTable.FindHighestId(); - } - - // Now check in case some (or all) resources don't have resource ids, or they - // don't match the .h file, or something of that nature. - bool altered = RepairResourceIds(); - if (altered) - { - wxMessageBox("Some resources have had new identifiers associated with them, since they were missing.", - "Dialog Editor Warning", wxOK ); - Modify(TRUE); + SetFrameTitle(""); + m_currentFilename = ""; } - else - Modify(FALSE); - + Modify(FALSE); + return TRUE; - } - else - { - SetFrameTitle(""); - m_currentFilename = ""; - } - Modify(FALSE); - - return TRUE; } bool wxResourceManager::Clear(bool WXUNUSED(deleteWindows), bool force) { - wxPropertyInfo::CloseWindow(); - - if (!force && Modified()) - { - int ans = wxMessageBox("Save modified resource file?", "Dialog Editor", wxYES_NO | wxCANCEL); - if (ans == wxCANCEL) - return FALSE; - if (ans == wxYES) - if (!SaveIfModified()) - return FALSE; - if (ans == wxNO) - Modify(FALSE); - } - - ClearCurrentDialog(); - DisassociateWindows(); - - m_symbolTable.Clear(); - m_resourceTable.ClearTable(); - UpdateResourceList(); - - return TRUE; + wxPropertyInfo::CloseWindow(); + + if (!force && Modified()) + { + int ans = wxMessageBox("Save modified resource file?", "Dialog Editor", wxYES_NO | wxCANCEL); + if (ans == wxCANCEL) + return FALSE; + if (ans == wxYES) + if (!SaveIfModified()) + return FALSE; + if (ans == wxNO) + Modify(FALSE); + } + + ClearCurrentDialog(); + DisassociateWindows(); + + m_symbolTable.Clear(); + m_resourceTable.ClearTable(); + UpdateResourceList(); + + return TRUE; } bool wxResourceManager::DisassociateWindows() { - m_resourceTable.BeginFind(); - wxNode *node; - while ((node = m_resourceTable.Next())) - { - wxItemResource *res = (wxItemResource *)node->Data(); - DisassociateResource(res); - } - - return TRUE; + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) + { + wxItemResource *res = (wxItemResource *)node->Data(); + DisassociateResource(res); + } + + return TRUE; } void wxResourceManager::AssociateResource(wxItemResource *resource, wxWindow *win) { - if (!m_resourceAssociations.Get((long)resource)) - m_resourceAssociations.Put((long)resource, win); - - wxNode *node = resource->GetChildren().First(); - wxNode* node2 = win->GetChildren().First(); - while (node && node2) - { - wxItemResource *child = (wxItemResource *)node->Data(); - wxWindow* childWindow = (wxWindow*) node2->Data(); - - if (child->GetId() != childWindow->GetId()) - { - wxString msg; - msg.Printf("AssociateResource: error when associating child window %ld with resource %ld", child->GetId(), childWindow->GetId()); - wxMessageBox(msg, "Dialog Editor problem", wxOK); - } - else if (childWindow->GetName() != child->GetName()) - { - wxString msg; - msg.Printf("AssociateResource: error when associating child window with resource %s", child->GetName() ? (const char*) child->GetName() : "(unnamed)"); - wxMessageBox(msg, "Dialog Editor problem", wxOK); - } - else + if (!m_resourceAssociations.Get((long)resource)) + m_resourceAssociations.Put((long)resource, win); + + wxNode *node = resource->GetChildren().First(); + wxNode* node2 = win->GetChildren().First(); + while (node && node2) { - AssociateResource(child, childWindow); - } - - // New code to avoid the problem of duplicate ids and names. We simply - // traverse the child windows and child resources in parallel, - // checking for any mismatch. + wxItemResource *child = (wxItemResource *)node->Data(); + wxWindow* childWindow = (wxWindow*) node2->Data(); + + if (child->GetId() != childWindow->GetId()) + { + wxString msg; + msg.Printf("AssociateResource: error when associating child window %ld with resource %ld", child->GetId(), childWindow->GetId()); + wxMessageBox(msg, "Dialog Editor problem", wxOK); + } + else if (childWindow->GetName() != child->GetName()) + { + wxString msg; + msg.Printf("AssociateResource: error when associating child window with resource %s", child->GetName() ? (const char*) child->GetName() : "(unnamed)"); + wxMessageBox(msg, "Dialog Editor problem", wxOK); + } + else + { + AssociateResource(child, childWindow); + } + + // New code to avoid the problem of duplicate ids and names. We simply + // traverse the child windows and child resources in parallel, + // checking for any mismatch. #if 0 - wxWindow *childWindow = (wxWindow *)m_resourceAssociations.Get((long)child); - if (!childWindow) - // childWindow = win->FindWindow(child->GetName()); - childWindow = win->FindWindow(child->GetId()); - if (childWindow) - AssociateResource(child, childWindow); - else - { - wxString msg; - msg.Printf("AssociateResource: cannot find child window %s", child->GetName() ? (const char*) child->GetName() : "(unnamed)"); - wxMessageBox(msg, "Dialog Editor problem", wxOK); - } + wxWindow *childWindow = (wxWindow *)m_resourceAssociations.Get((long)child); + if (!childWindow) + // childWindow = win->FindWindow(child->GetName()); + childWindow = win->FindWindow(child->GetId()); + if (childWindow) + AssociateResource(child, childWindow); + else + { + wxString msg; + msg.Printf("AssociateResource: cannot find child window %s", child->GetName() ? (const char*) child->GetName() : "(unnamed)"); + wxMessageBox(msg, "Dialog Editor problem", wxOK); + } #endif - node = node->Next(); - node2 = node2->Next(); - } + node = node->Next(); + node2 = node2->Next(); + } } bool wxResourceManager::DisassociateResource(wxItemResource *resource) { - wxWindow *win = FindWindowForResource(resource); - if (!win) - return FALSE; - - // Disassociate children of window - wxNode *node = win->GetChildren().First(); - while (node) - { - wxWindow *child = (wxWindow *)node->Data(); - if (child->IsKindOf(CLASSINFO(wxControl))) - DisassociateResource(child); - node = node->Next(); - } - - RemoveSelection(win); - m_resourceAssociations.Delete((long)resource); - return TRUE; + wxWindow *win = FindWindowForResource(resource); + if (!win) + return FALSE; + + // Disassociate children of window + wxNode *node = win->GetChildren().First(); + while (node) + { + wxWindow *child = (wxWindow *)node->Data(); + if (child->IsKindOf(CLASSINFO(wxControl))) + DisassociateResource(child); + node = node->Next(); + } + + RemoveSelection(win); + m_resourceAssociations.Delete((long)resource); + return TRUE; } bool wxResourceManager::DisassociateResource(wxWindow *win) { - wxItemResource *res = FindResourceForWindow(win); - if (res) - return DisassociateResource(res); - else - return FALSE; + wxItemResource *res = FindResourceForWindow(win); + if (res) + return DisassociateResource(res); + else + return FALSE; } // Saves the window info into the resource, and deletes the @@ -610,23 +595,23 @@ bool wxResourceManager::DisassociateResource(wxWindow *win) bool wxResourceManager::SaveInfoAndDeleteHandler(wxWindow* win) { wxItemResource *res = FindResourceForWindow(win); - + if (win->IsKindOf(CLASSINFO(wxPanel))) { wxResourceEditorDialogHandler* handler = (wxResourceEditorDialogHandler*) win->GetEventHandler(); win->PopEventHandler(); - + // Now reset all child event handlers wxNode *node = win->GetChildren().First(); while ( node ) { - wxWindow *child = (wxWindow *)node->Data(); - wxEvtHandler *childHandler = child->GetEventHandler(); - if ( child->IsKindOf(CLASSINFO(wxControl)) && childHandler != child ) - { - child->PopEventHandler(TRUE); - } - node = node->Next(); + wxWindow *child = (wxWindow *)node->Data(); + wxEvtHandler *childHandler = child->GetEventHandler(); + if ( child->IsKindOf(CLASSINFO(wxControl)) && childHandler != child ) + { + child->PopEventHandler(TRUE); + } + node = node->Next(); } delete handler; } @@ -634,12 +619,12 @@ bool wxResourceManager::SaveInfoAndDeleteHandler(wxWindow* win) { win->PopEventHandler(TRUE); } - + // Save the information InstantiateResourceFromWindow(res, win, TRUE); - -// DisassociateResource(win); - + + // DisassociateResource(win); + return TRUE; } @@ -653,813 +638,948 @@ bool wxResourceManager::DeleteWindow(wxWindow* win) m_editorPanel->m_childWindow = NULL; clearDisplay = TRUE; } - + win->Destroy(); - + if (clearDisplay) m_editorPanel->Clear(); - + return TRUE; } wxItemResource *wxResourceManager::FindResourceForWindow(wxWindow *win) { - m_resourceAssociations.BeginFind(); - wxNode *node; - while ((node = m_resourceAssociations.Next())) - { - wxWindow *w = (wxWindow *)node->Data(); - if (w == win) + m_resourceAssociations.BeginFind(); + wxNode *node; + while ((node = m_resourceAssociations.Next())) { - return (wxItemResource *)node->GetKeyInteger(); + wxWindow *w = (wxWindow *)node->Data(); + if (w == win) + { + return (wxItemResource *)node->GetKeyInteger(); + } } - } - return NULL; + return NULL; } wxWindow *wxResourceManager::FindWindowForResource(wxItemResource *resource) { - return (wxWindow *)m_resourceAssociations.Get((long)resource); + return (wxWindow *)m_resourceAssociations.Get((long)resource); } void wxResourceManager::MakeUniqueName(char *prefix, char *buf) { - while (TRUE) - { - sprintf(buf, "%s%d", prefix, m_nameCounter); - m_nameCounter ++; - - if (!m_resourceTable.FindResource(buf)) - return; - } + while (TRUE) + { + sprintf(buf, "%s%d", prefix, m_nameCounter); + m_nameCounter ++; + + if (!m_resourceTable.FindResource(buf)) + return; + } } wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title) { - /* - int frameWidth = 420; - int frameHeight = 300; - */ - - wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, title, - wxPoint(m_resourceEditorWindowSize.x, m_resourceEditorWindowSize.y), - wxSize(m_resourceEditorWindowSize.width, m_resourceEditorWindowSize.height), - wxDEFAULT_FRAME_STYLE); - - frame->CreateStatusBar(1); - - frame->SetAutoLayout(TRUE); + wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, title, + wxPoint(m_resourceEditorWindowSize.x, m_resourceEditorWindowSize.y), + wxSize(m_resourceEditorWindowSize.width, m_resourceEditorWindowSize.height), + wxDEFAULT_FRAME_STYLE); + + frame->CreateStatusBar(1); + + frame->SetAutoLayout(TRUE); #ifdef __WXMSW__ - frame->SetIcon(wxIcon("DIALOGEDICON")); + frame->SetIcon(wxIcon("DIALOGEDICON")); #endif - return frame; + return frame; } wxMenuBar *wxResourceManager::OnCreateEditorMenuBar(wxFrame *WXUNUSED(parent)) { - wxMenuBar *menuBar = new wxMenuBar; - - wxMenu *fileMenu = new wxMenu; - fileMenu->Append(RESED_NEW_DIALOG, "New &dialog", "Create a new dialog"); - fileMenu->AppendSeparator(); - fileMenu->Append(wxID_NEW, "&New project", "Clear the current project"); - fileMenu->Append(wxID_OPEN, "&Open...", "Load a resource file"); - fileMenu->Append(wxID_SAVE, "&Save", "Save a resource file"); - fileMenu->Append(wxID_SAVEAS, "Save &As...", "Save a resource file as..."); - fileMenu->Append(RESED_CLEAR, "&Clear", "Clear current resources"); - fileMenu->AppendSeparator(); - fileMenu->Append(wxID_EXIT, "E&xit", "Exit resource editor"); - - wxMenu *editMenu = new wxMenu; - editMenu->Append(RESED_TEST, "&Test Dialog", "Test dialog"); - editMenu->Append(RESED_RECREATE, "&Recreate", "Recreate the selected resource(s)"); - editMenu->Append(RESED_DELETE, "&Delete", "Delete the selected resource(s)"); - - wxMenu *helpMenu = new wxMenu; - helpMenu->Append(RESED_CONTENTS, "&Help topics", "Invokes the on-line help"); - helpMenu->AppendSeparator(); - helpMenu->Append(wxID_ABOUT, "&About", "About wxWindows Dialog Editor"); - - menuBar->Append(fileMenu, "&File"); - menuBar->Append(editMenu, "&Edit"); - menuBar->Append(helpMenu, "&Help"); - - return menuBar; + wxMenuBar *menuBar = new wxMenuBar; + + wxMenu *fileMenu = new wxMenu; + fileMenu->Append(RESED_NEW_DIALOG, "New &Dialog", "Create a new dialog"); + fileMenu->AppendSeparator(); + fileMenu->Append(wxID_NEW, "&New Project", "Clear the current project"); + fileMenu->Append(wxID_OPEN, "&Open...", "Load a resource file"); + fileMenu->Append(wxID_SAVE, "&Save", "Save a resource file"); + fileMenu->Append(wxID_SAVEAS, "Save &As...", "Save a resource file as..."); + fileMenu->Append(RESED_CLEAR, "&Clear", "Clear current resources"); + fileMenu->AppendSeparator(); + fileMenu->Append(RESED_CONVERT_WXRS, "Convert Old &Resources...", "Convert old resources to new"); + fileMenu->AppendSeparator(); + fileMenu->Append(wxID_EXIT, "E&xit", "Exit resource editor"); + + wxMenu *editMenu = new wxMenu; + editMenu->Append(RESED_TEST, "&Test Dialog", "Test dialog"); + editMenu->Append(RESED_RECREATE, "&Recreate", "Recreate the selected resource(s)"); + editMenu->Append(RESED_DELETE, "&Delete", "Delete the selected resource(s)"); + + wxMenu *helpMenu = new wxMenu; + helpMenu->Append(RESED_CONTENTS, "&Help Topics", "Invokes the on-line help"); + helpMenu->AppendSeparator(); + helpMenu->Append(wxID_ABOUT, "&About", "About wxWindows Dialog Editor"); + + menuBar->Append(fileMenu, "&File"); + menuBar->Append(editMenu, "&Edit"); + menuBar->Append(helpMenu, "&Help"); + + return menuBar; } wxResourceEditorScrolledWindow *wxResourceManager::OnCreateEditorPanel(wxFrame *parent) { - wxResourceEditorScrolledWindow *panel = new wxResourceEditorScrolledWindow(parent, wxDefaultPosition, wxDefaultSize, -// wxSUNKEN_BORDER|wxCLIP_CHILDREN); + wxResourceEditorScrolledWindow *panel = new wxResourceEditorScrolledWindow(parent, wxDefaultPosition, wxDefaultSize, + // wxSUNKEN_BORDER|wxCLIP_CHILDREN); #ifdef __WXMOTIF__ - wxBORDER); + wxBORDER); #else wxSUNKEN_BORDER); #endif - - panel->SetScrollbars(10, 10, 100, 100); - - return panel; -} + + panel->SetScrollbars(10, 10, 100, 100); + + return panel; +} wxToolBar *wxResourceManager::OnCreateToolBar(wxFrame *parent) { - // Load palette bitmaps + // Load palette bitmaps #ifdef __WXMSW__ - wxBitmap ToolbarLoadBitmap("LOADTOOL"); - wxBitmap ToolbarSaveBitmap("SAVETOOL"); - wxBitmap ToolbarNewBitmap("NEWTOOL"); - wxBitmap ToolbarVertBitmap("VERTTOOL"); - wxBitmap ToolbarAlignTBitmap("ALIGNTTOOL"); - wxBitmap ToolbarAlignBBitmap("ALIGNBTOOL"); - wxBitmap ToolbarHorizBitmap("HORIZTOOL"); - wxBitmap ToolbarAlignLBitmap("ALIGNLTOOL"); - wxBitmap ToolbarAlignRBitmap("ALIGNRTOOL"); - wxBitmap ToolbarCopySizeBitmap("COPYSIZETOOL"); - wxBitmap ToolbarToBackBitmap("TOBACKTOOL"); - wxBitmap ToolbarToFrontBitmap("TOFRONTTOOL"); - wxBitmap ToolbarHelpBitmap("HELPTOOL"); + wxBitmap ToolbarLoadBitmap("LOADTOOL"); + wxBitmap ToolbarSaveBitmap("SAVETOOL"); + wxBitmap ToolbarNewBitmap("NEWTOOL"); + wxBitmap ToolbarVertBitmap("VERTTOOL"); + wxBitmap ToolbarAlignTBitmap("ALIGNTTOOL"); + wxBitmap ToolbarAlignBBitmap("ALIGNBTOOL"); + wxBitmap ToolbarHorizBitmap("HORIZTOOL"); + wxBitmap ToolbarAlignLBitmap("ALIGNLTOOL"); + wxBitmap ToolbarAlignRBitmap("ALIGNRTOOL"); + wxBitmap ToolbarCopySizeBitmap("COPYSIZETOOL"); + wxBitmap ToolbarToBackBitmap("TOBACKTOOL"); + wxBitmap ToolbarToFrontBitmap("TOFRONTTOOL"); + wxBitmap ToolbarHelpBitmap("HELPTOOL"); + wxBitmap ToolbarCopyWidthBitmap("COPYWIDTHTOOL"); + wxBitmap ToolbarCopyHeightBitmap("COPYHEIGHTTOOL"); + wxBitmap ToolbarDistributeHorizBitmap("DISTHORIZTOOL"); + wxBitmap ToolbarDistributeVertBitmap("DISTVERTTOOL"); #endif #if defined(__WXGTK__) || defined(__WXMOTIF__) - wxBitmap ToolbarLoadBitmap( load_xpm ); - wxBitmap ToolbarSaveBitmap( save_xpm); - wxBitmap ToolbarNewBitmap( new_xpm ); - wxBitmap ToolbarVertBitmap( vert_xpm ); - wxBitmap ToolbarAlignTBitmap( alignt_xpm ); - wxBitmap ToolbarAlignBBitmap( alignb_xpm ); - wxBitmap ToolbarHorizBitmap( horiz_xpm ); - wxBitmap ToolbarAlignLBitmap( alignl_xpm ); - wxBitmap ToolbarAlignRBitmap( alignr_xpm ); - wxBitmap ToolbarCopySizeBitmap( copysize_xpm ); - wxBitmap ToolbarToBackBitmap( toback_xpm ); - wxBitmap ToolbarToFrontBitmap( tofront_xpm ); - wxBitmap ToolbarHelpBitmap( help_xpm ); + wxBitmap ToolbarLoadBitmap( load_xpm ); + wxBitmap ToolbarSaveBitmap( save_xpm); + wxBitmap ToolbarNewBitmap( new_xpm ); + wxBitmap ToolbarVertBitmap( vert_xpm ); + wxBitmap ToolbarAlignTBitmap( alignt_xpm ); + wxBitmap ToolbarAlignBBitmap( alignb_xpm ); + wxBitmap ToolbarHorizBitmap( horiz_xpm ); + wxBitmap ToolbarAlignLBitmap( alignl_xpm ); + wxBitmap ToolbarAlignRBitmap( alignr_xpm ); + wxBitmap ToolbarCopySizeBitmap( copysize_xpm ); + wxBitmap ToolbarToBackBitmap( toback_xpm ); + wxBitmap ToolbarToFrontBitmap( tofront_xpm ); + wxBitmap ToolbarHelpBitmap( help_xpm ); + wxBitmap ToolbarCopyWidthBitmap(copywdth_xpm); + wxBitmap ToolbarCopyHeightBitmap(copyhght_xpm); + wxBitmap ToolbarDistributeHorizBitmap(disthor_xpm); + wxBitmap ToolbarDistributeVertBitmap(distvert_xpm); #endif - - // Create the toolbar - EditorToolBar *toolbar = new EditorToolBar(parent, wxPoint(0, 0), wxSize(-1, -1), wxNO_BORDER|wxTB_HORIZONTAL); - toolbar->SetMargins(2, 2); - + + // Create the toolbar + EditorToolBar *toolbar = new EditorToolBar(parent, wxPoint(0, 0), wxSize(-1, -1), wxNO_BORDER|wxTB_HORIZONTAL|wxTB_FLAT); + toolbar->SetMargins(2, 2); + #ifdef __WXMSW__ - int width = 24; - int dx = 2; - int gap = 6; + int width = 24; + int dx = 2; + int gap = 6; #else - int width = 24; // ToolbarLoadBitmap->GetWidth(); ??? - int dx = 2; - int gap = 6; + int width = 24; // ToolbarLoadBitmap->GetWidth(); ??? + int dx = 2; + int gap = 6; #endif - int currentX = gap; - toolbar->AddSeparator(); - toolbar->AddTool(TOOLBAR_NEW, ToolbarNewBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "New dialog"); - currentX += width + dx; - toolbar->AddTool(TOOLBAR_LOAD_FILE, ToolbarLoadBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "Load"); - currentX += width + dx; - toolbar->AddTool(TOOLBAR_SAVE_FILE, ToolbarSaveBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "Save"); - currentX += width + dx + gap; - toolbar->AddSeparator(); - toolbar->AddTool(TOOLBAR_FORMAT_HORIZ, ToolbarVertBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "Horizontal align"); - currentX += width + dx; - toolbar->AddTool(TOOLBAR_FORMAT_VERT_TOP_ALIGN, ToolbarAlignTBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "Top align"); - currentX += width + dx; - toolbar->AddTool(TOOLBAR_FORMAT_VERT_BOT_ALIGN, ToolbarAlignBBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "Bottom align"); - currentX += width + dx; - toolbar->AddTool(TOOLBAR_FORMAT_VERT, ToolbarHorizBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "Vertical align"); - currentX += width + dx; - toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN, ToolbarAlignLBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "Left align"); - currentX += width + dx; - toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN, ToolbarAlignRBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "Right align"); - currentX += width + dx; - toolbar->AddTool(TOOLBAR_COPY_SIZE, ToolbarCopySizeBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "Copy size"); - currentX += width + dx + gap; - toolbar->AddSeparator(); - toolbar->AddTool(TOOLBAR_TO_FRONT, ToolbarToFrontBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "To front"); - currentX += width + dx; - toolbar->AddTool(TOOLBAR_TO_BACK, ToolbarToBackBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "To back"); - currentX += width + dx + gap; - - toolbar->AddSeparator(); - toolbar->AddTool(TOOLBAR_HELP, ToolbarHelpBitmap, wxNullBitmap, - FALSE, currentX, -1, NULL, "Help"); - currentX += width + dx; - - toolbar->Realize(); - - return toolbar; + int currentX = gap; + //toolbar->AddSeparator(); + toolbar->AddTool(TOOLBAR_NEW, ToolbarNewBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "New dialog"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_LOAD_FILE, ToolbarLoadBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Load"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_SAVE_FILE, ToolbarSaveBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Save"); + currentX += width + dx + gap; + toolbar->AddSeparator(); + toolbar->AddTool(TOOLBAR_FORMAT_HORIZ, ToolbarVertBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Horizontal align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_FORMAT_VERT_TOP_ALIGN, ToolbarAlignTBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Top align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_FORMAT_VERT_BOT_ALIGN, ToolbarAlignBBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Bottom align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_FORMAT_VERT, ToolbarHorizBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Vertical align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN, ToolbarAlignLBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Left align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN, ToolbarAlignRBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Right align"); + currentX += width + dx + gap; + toolbar->AddSeparator(); + toolbar->AddTool(TOOLBAR_COPY_SIZE, ToolbarCopySizeBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Copy size"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_COPY_WIDTH, ToolbarCopyWidthBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Copy width"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_COPY_HEIGHT, ToolbarCopyHeightBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Copy height"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_DISTRIBUTE_HORIZ, ToolbarDistributeHorizBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Distribute horizontally"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_DISTRIBUTE_VERT, ToolbarDistributeVertBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Distribute vertically"); + currentX += width + dx + gap; + toolbar->AddSeparator(); + toolbar->AddTool(TOOLBAR_TO_FRONT, ToolbarToFrontBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "To front"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_TO_BACK, ToolbarToBackBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "To back"); + currentX += width + dx + gap; + + toolbar->AddSeparator(); + toolbar->AddTool(TOOLBAR_HELP, ToolbarHelpBitmap, wxNullBitmap, + FALSE, currentX, -1, NULL, "Help"); + currentX += width + dx; + + toolbar->Realize(); + + return toolbar; } void wxResourceManager::UpdateResourceList() { - if (!m_editorResourceTree) - return; - - m_editorResourceTree->SetInvalid(TRUE); - m_editorResourceTree->DeleteAllItems(); - - long id = m_editorResourceTree->AddRoot("Dialogs", 1, 2); - - m_resourceTable.BeginFind(); - wxNode *node; - while ((node = m_resourceTable.Next())) - { - wxItemResource *res = (wxItemResource *)node->Data(); - wxString resType(res->GetType()); - if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel" || resType == "wxBitmap") + if (!m_editorResourceTree) + return; + + m_editorResourceTree->SetInvalid(TRUE); + m_editorResourceTree->DeleteAllItems(); + + long id = m_editorResourceTree->AddRoot("Dialogs", 1, 2); + + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) { - AddItemsRecursively(id, res); + wxItemResource *res = (wxItemResource *)node->Data(); + wxString resType(res->GetType()); + if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel" || resType == "wxBitmap") + { + AddItemsRecursively(id, res); + } } - } - m_editorResourceTree->Expand(id); - m_editorResourceTree->SetInvalid(FALSE); + m_editorResourceTree->Expand(id); + m_editorResourceTree->SetInvalid(FALSE); } void wxResourceManager::AddItemsRecursively(long parent, wxItemResource *resource) { - wxString theString(""); - theString = resource->GetName(); - - int imageId = 0; - wxString resType(resource->GetType()); - if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel") - imageId = 0; - else - imageId = 3; - - long id = m_editorResourceTree->AppendItem(parent, theString, imageId ); - - m_editorResourceTree->SetItemData(id, new wxResourceTreeData(resource)); - - if (strcmp(resource->GetType(), "wxBitmap") != 0) - { - wxNode *node = resource->GetChildren().First(); - while (node) + wxString theString(""); + theString = resource->GetName(); + + int imageId = 0; + wxString resType(resource->GetType()); + if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel") + imageId = 0; + else + imageId = 3; + + long id = m_editorResourceTree->AppendItem(parent, theString, imageId ); + + m_editorResourceTree->SetItemData(id, new wxResourceTreeData(resource)); + + if (strcmp(resource->GetType(), "wxBitmap") != 0) { - wxItemResource *res = (wxItemResource *)node->Data(); - AddItemsRecursively(id, res); - node = node->Next(); + wxNode *node = resource->GetChildren().First(); + while (node) + { + wxItemResource *res = (wxItemResource *)node->Data(); + AddItemsRecursively(id, res); + node = node->Next(); + } } - } -// m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND); + // m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND); } bool wxResourceManager::EditSelectedResource() { - int sel = m_editorResourceTree->GetSelection(); - if (sel != 0) - { - wxResourceTreeData *data = (wxResourceTreeData *)m_editorResourceTree->GetItemData(sel); - wxItemResource *res = data->GetResource(); - return Edit(res); - } - return FALSE; + int sel = m_editorResourceTree->GetSelection(); + if (sel != 0) + { + wxResourceTreeData *data = (wxResourceTreeData *)m_editorResourceTree->GetItemData(sel); + wxItemResource *res = data->GetResource(); + return Edit(res); + } + return FALSE; } bool wxResourceManager::Edit(wxItemResource *res) { - wxPropertyInfo::CloseWindow(); - - ClearCurrentDialog(); - - wxString resType(res->GetType()); - wxPanel *panel = (wxPanel *)FindWindowForResource(res); - - if (panel) - { - wxMessageBox("Should not find panel in wxResourceManager::Edit"); - return FALSE; - } - else - { -// long style = res->GetStyle(); -// res->SetStyle(style|wxRAISED_BORDER); + wxPropertyInfo::CloseWindow(); + + ClearCurrentDialog(); + + wxString resType(res->GetType()); + wxPanel *panel = (wxPanel *)FindWindowForResource(res); + + if (panel) + { + wxMessageBox("Should not find panel in wxResourceManager::Edit"); + return FALSE; + } + else + { + // long style = res->GetStyle(); + // res->SetStyle(style|wxRAISED_BORDER); panel = new wxPanel; wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, res, panel->GetEventHandler(), - this); - + this); + panel->LoadFromResource(m_editorPanel, res->GetName(), &m_resourceTable); - + panel->PushEventHandler(handler); - -// res->SetStyle(style); - handler->AddChildHandlers(); // Add event handlers for all controls + + // res->SetStyle(style); + handler->AddChildHandlers(); // Add event handlers for all controls AssociateResource(res, panel); - + m_editorPanel->m_childWindow = panel; panel->Move(m_editorPanel->GetMarginX(), m_editorPanel->GetMarginY()); panel->Show(TRUE); panel->Refresh(); - + wxClientDC dc(m_editorPanel); m_editorPanel->DrawTitle(dc); - } - return FALSE; + } + return FALSE; } bool wxResourceManager::CreateNewPanel() { - wxPropertyInfo::CloseWindow(); - - ClearCurrentDialog(); - - char buf[256]; - MakeUniqueName("dialog", buf); - - wxItemResource *resource = new wxItemResource; - resource->SetType("wxDialog"); - resource->SetName(buf); - resource->SetTitle(buf); - resource->SetResourceStyle(wxRESOURCE_USE_DEFAULTS); - resource->SetResourceStyle(wxRESOURCE_DIALOG_UNITS); - - wxString newIdName; - int id = GenerateWindowId("ID_DIALOG", newIdName); - resource->SetId(id); - - // This is now guaranteed to be unique, so just add to symbol table - m_symbolTable.AddSymbol(newIdName, id); - - m_resourceTable.AddResource(resource); - - wxSize size(400, 300); - - wxPanel *panel = new wxPanel(m_editorPanel, -1, - wxPoint(m_editorPanel->GetMarginX(), m_editorPanel->GetMarginY()), - size, wxRAISED_BORDER|wxDEFAULT_DIALOG_STYLE, buf); - m_editorPanel->m_childWindow = panel; - - resource->SetStyle(panel->GetWindowStyleFlag()); - - // Store dialog units in resource - size = panel->ConvertPixelsToDialog(size); - - resource->SetSize(10, 10, size.x, size.y); - - // For editing in situ we will need to use the hash table to ensure - // we don't dereference invalid pointers. -// resourceWindowTable.Put((long)resource, panel); - - wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, resource, panel->GetEventHandler(), - this); - panel->PushEventHandler(handler); - - AssociateResource(resource, panel); - UpdateResourceList(); - - Modify(TRUE); - m_editorPanel->m_childWindow->Refresh(); - -// panel->Refresh(); - - wxClientDC dc(m_editorPanel); - m_editorPanel->DrawTitle(dc); - - return TRUE; + wxPropertyInfo::CloseWindow(); + + ClearCurrentDialog(); + + char buf[256]; + MakeUniqueName("dialog", buf); + + wxItemResource *resource = new wxItemResource; + resource->SetType("wxDialog"); + resource->SetName(buf); + resource->SetTitle(buf); + resource->SetResourceStyle(wxRESOURCE_USE_DEFAULTS); + resource->SetResourceStyle(wxRESOURCE_DIALOG_UNITS); + + wxString newIdName; + int id = GenerateWindowId("ID_DIALOG", newIdName); + resource->SetId(id); + + // This is now guaranteed to be unique, so just add to symbol table + m_symbolTable.AddSymbol(newIdName, id); + + m_resourceTable.AddResource(resource); + + wxSize size(400, 300); + + wxPanel *panel = new wxPanel(m_editorPanel, -1, + wxPoint(m_editorPanel->GetMarginX(), m_editorPanel->GetMarginY()), + size, wxRAISED_BORDER|wxDEFAULT_DIALOG_STYLE, buf); + m_editorPanel->m_childWindow = panel; + + resource->SetStyle(panel->GetWindowStyleFlag()); + + // Store dialog units in resource + size = panel->ConvertPixelsToDialog(size); + + resource->SetSize(10, 10, size.x, size.y); + + // For editing in situ we will need to use the hash table to ensure + // we don't dereference invalid pointers. + // resourceWindowTable.Put((long)resource, panel); + + wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, resource, panel->GetEventHandler(), + this); + panel->PushEventHandler(handler); + + AssociateResource(resource, panel); + UpdateResourceList(); + + Modify(TRUE); + m_editorPanel->m_childWindow->Refresh(); + + // panel->Refresh(); + + wxClientDC dc(m_editorPanel); + m_editorPanel->DrawTitle(dc); + + return TRUE; } bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *iType, int x, int y, bool isBitmap) { - char buf[256]; - if (!panel->IsKindOf(CLASSINFO(wxPanel)) && !panel->IsKindOf(CLASSINFO(wxDialog))) - return FALSE; - - Modify(TRUE); - - wxItemResource *res = new wxItemResource; - wxControl *newItem = NULL; - - if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) - { - wxPoint pt = panel->ConvertPixelsToDialog(wxPoint(x, y)); - res->SetSize(pt.x, pt.y, -1, -1); - } - else res->SetSize(x, y, -1, -1); - - res->SetType(iType); - - wxString prefix; - - wxString itemType(iType); - - if (itemType == "wxButton") + char buf[256]; + if (!panel->IsKindOf(CLASSINFO(wxPanel)) && !panel->IsKindOf(CLASSINFO(wxDialog))) + return FALSE; + + Modify(TRUE); + + wxItemResource *res = new wxItemResource; + wxControl *newItem = NULL; + + if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) + { + wxPoint pt = panel->ConvertPixelsToDialog(wxPoint(x, y)); + res->SetSize(pt.x, pt.y, -1, -1); + } + else res->SetSize(x, y, -1, -1); + + res->SetType(iType); + + wxString prefix; + + wxString itemType(iType); + + if (itemType == "wxButton") + { + prefix = "ID_BUTTON"; + MakeUniqueName("button", buf); + res->SetName(buf); + if (isBitmap) + newItem = new wxBitmapButton(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), wxBU_AUTODRAW, wxDefaultValidator, buf); + else + newItem = new wxButton(panel, -1, "Button", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf); + } + if (itemType == "wxBitmapButton") { - prefix = "ID_BUTTON"; - MakeUniqueName("button", buf); - res->SetName(buf); - if (isBitmap) + prefix = "ID_BITMAPBUTTON"; + MakeUniqueName("button", buf); + res->SetName(buf); newItem = new wxBitmapButton(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), wxBU_AUTODRAW, wxDefaultValidator, buf); - else - newItem = new wxButton(panel, -1, "Button", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf); } - if (itemType == "wxBitmapButton") + else if (itemType == "wxMessage" || itemType == "wxStaticText") { - prefix = "ID_BITMAPBUTTON"; - MakeUniqueName("button", buf); - res->SetName(buf); - newItem = new wxBitmapButton(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), wxBU_AUTODRAW, wxDefaultValidator, buf); + prefix = "ID_STATIC"; + MakeUniqueName("statictext", buf); + res->SetName(buf); + if (isBitmap) + newItem = new wxStaticBitmap(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(0, 0), 0, buf); + else + newItem = new wxStaticText(panel, -1, "Static", wxPoint(x, y), wxSize(-1, -1), 0, buf); } - else if (itemType == "wxMessage" || itemType == "wxStaticText") + else if (itemType == "wxStaticBitmap") { - prefix = "ID_STATIC"; - MakeUniqueName("statictext", buf); - res->SetName(buf); - if (isBitmap) - newItem = new wxStaticBitmap(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(0, 0), 0, buf); - else - newItem = new wxStaticText(panel, -1, "Static", wxPoint(x, y), wxSize(-1, -1), 0, buf); + prefix = "ID_STATICBITMAP"; + MakeUniqueName("static", buf); + res->SetName(buf); + newItem = new wxStaticBitmap(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, buf); } - else if (itemType == "wxStaticBitmap") + else if (itemType == "wxCheckBox") { - prefix = "ID_STATICBITMAP"; - MakeUniqueName("static", buf); - res->SetName(buf); - newItem = new wxStaticBitmap(panel, -1, * m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, buf); + prefix = "ID_CHECKBOX"; + MakeUniqueName("checkbox", buf); + res->SetName(buf); + newItem = new wxCheckBox(panel, -1, "Checkbox", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf); } - else if (itemType == "wxCheckBox") + else if (itemType == "wxListBox") { - prefix = "ID_CHECKBOX"; - MakeUniqueName("checkbox", buf); - res->SetName(buf); - newItem = new wxCheckBox(panel, -1, "Checkbox", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf); + prefix = "ID_LISTBOX"; + MakeUniqueName("listbox", buf); + res->SetName(buf); + newItem = new wxListBox(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf); } - else if (itemType == "wxListBox") + else if (itemType == "wxRadioBox") { - prefix = "ID_LISTBOX"; - MakeUniqueName("listbox", buf); - res->SetName(buf); - newItem = new wxListBox(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf); + prefix = "ID_RADIOBOX"; + MakeUniqueName("radiobox", buf); + res->SetName(buf); + wxString names[] = { "One", "Two" }; + newItem = new wxRadioBox(panel, -1, "Radiobox", wxPoint(x, y), wxSize(-1, -1), 2, names, 2, + wxHORIZONTAL, wxDefaultValidator, buf); + res->SetStringValues(wxStringList("One", "Two", NULL)); } - else if (itemType == "wxRadioBox") + else if (itemType == "wxRadioButton") { - prefix = "ID_RADIOBOX"; - MakeUniqueName("radiobox", buf); - res->SetName(buf); - wxString names[] = { "One", "Two" }; - newItem = new wxRadioBox(panel, -1, "Radiobox", wxPoint(x, y), wxSize(-1, -1), 2, names, 2, - wxHORIZONTAL, wxDefaultValidator, buf); - res->SetStringValues(wxStringList("One", "Two", NULL)); + prefix = "ID_RADIOBUTTON"; + MakeUniqueName("radiobutton", buf); + res->SetName(buf); + wxString names[] = { "One", "Two" }; + newItem = new wxRadioButton(panel, -1, "Radiobutton", wxPoint(x, y), wxSize(-1, -1), + 0, wxDefaultValidator, buf); } - else if (itemType == "wxRadioButton") + else if (itemType == "wxChoice") { - prefix = "ID_RADIOBUTTON"; - MakeUniqueName("radiobutton", buf); - res->SetName(buf); - wxString names[] = { "One", "Two" }; - newItem = new wxRadioButton(panel, -1, "Radiobutton", wxPoint(x, y), wxSize(-1, -1), - 0, wxDefaultValidator, buf); + prefix = "ID_CHOICE"; + MakeUniqueName("choice", buf); + res->SetName(buf); + newItem = new wxChoice(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf); } - else if (itemType == "wxChoice") + else if (itemType == "wxComboBox") { - prefix = "ID_CHOICE"; - MakeUniqueName("choice", buf); - res->SetName(buf); - newItem = new wxChoice(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf); + prefix = "ID_COMBOBOX"; + MakeUniqueName("combobox", buf); + res->SetName(buf); + newItem = new wxComboBox(panel, -1, "", wxPoint(x, y), wxSize(-1, -1), 0, NULL, wxCB_DROPDOWN, wxDefaultValidator, buf); } - else if (itemType == "wxComboBox") + else if (itemType == "wxGroupBox" || itemType == "wxStaticBox") { - prefix = "ID_COMBOBOX"; - MakeUniqueName("combobox", buf); - res->SetName(buf); - newItem = new wxComboBox(panel, -1, "", wxPoint(x, y), wxSize(-1, -1), 0, NULL, wxCB_DROPDOWN, wxDefaultValidator, buf); + prefix = "ID_STATICBOX"; + MakeUniqueName("staticbox", buf); + res->SetName(buf); + newItem = new wxStaticBox(panel, -1, "Static", wxPoint(x, y), wxSize(200, 200), 0, buf); } - else if (itemType == "wxGroupBox" || itemType == "wxStaticBox") + else if (itemType == "wxGauge") { - prefix = "ID_STATICBOX"; - MakeUniqueName("staticbox", buf); - res->SetName(buf); - newItem = new wxStaticBox(panel, -1, "Static", wxPoint(x, y), wxSize(200, 200), 0, buf); + prefix = "ID_GAUGE"; + MakeUniqueName("gauge", buf); + res->SetName(buf); + newItem = new wxGauge(panel, -1, 10, wxPoint(x, y), wxSize(80, 30), wxHORIZONTAL, wxDefaultValidator, buf); } - else if (itemType == "wxGauge") + else if (itemType == "wxSlider") { - prefix = "ID_GAUGE"; - MakeUniqueName("gauge", buf); - res->SetName(buf); - newItem = new wxGauge(panel, -1, 10, wxPoint(x, y), wxSize(80, 30), wxHORIZONTAL, wxDefaultValidator, buf); + prefix = "ID_SLIDER"; + MakeUniqueName("slider", buf); + res->SetName(buf); + newItem = new wxSlider(panel, -1, 1, 1, 10, wxPoint(x, y), wxSize(120, -1), wxHORIZONTAL, wxDefaultValidator, buf); } - else if (itemType == "wxSlider") + else if (itemType == "wxText" || itemType == "wxTextCtrl (single-line)") { - prefix = "ID_SLIDER"; - MakeUniqueName("slider", buf); - res->SetName(buf); - newItem = new wxSlider(panel, -1, 1, 1, 10, wxPoint(x, y), wxSize(120, -1), wxHORIZONTAL, wxDefaultValidator, buf); + prefix = "ID_TEXTCTRL"; + MakeUniqueName("textctrl", buf); + res->SetName(buf); + res->SetType("wxTextCtrl"); + newItem = new wxTextCtrl(panel, -1, "", wxPoint(x, y), wxSize(120, -1), 0, wxDefaultValidator, buf); } - else if (itemType == "wxText" || itemType == "wxTextCtrl (single-line)") + else if (itemType == "wxMultiText" || itemType == "wxTextCtrl (multi-line)") { - prefix = "ID_TEXTCTRL"; - MakeUniqueName("textctrl", buf); - res->SetName(buf); - res->SetType("wxTextCtrl"); - newItem = new wxTextCtrl(panel, -1, "", wxPoint(x, y), wxSize(120, -1), 0, wxDefaultValidator, buf); + prefix = "ID_TEXTCTRL"; + MakeUniqueName("textctrl", buf); + res->SetName(buf); + res->SetType("wxTextCtrl"); + newItem = new wxTextCtrl(panel, -1, "", wxPoint(x, y), wxSize(120, 100), wxTE_MULTILINE, wxDefaultValidator, buf); } - else if (itemType == "wxMultiText" || itemType == "wxTextCtrl (multi-line)") + else if (itemType == "wxScrollBar") { - prefix = "ID_TEXTCTRL"; - MakeUniqueName("textctrl", buf); - res->SetName(buf); - res->SetType("wxTextCtrl"); - newItem = new wxTextCtrl(panel, -1, "", wxPoint(x, y), wxSize(120, 100), wxTE_MULTILINE, wxDefaultValidator, buf); + prefix = "ID_SCROLLBAR"; + MakeUniqueName("scrollbar", buf); + res->SetName(buf); + newItem = new wxScrollBar(panel, -1, wxPoint(x, y), wxSize(140, -1), wxHORIZONTAL, wxDefaultValidator, buf); } - else if (itemType == "wxScrollBar") + if (!newItem) + return FALSE; + + int actualW, actualH; + newItem->GetSize(&actualW, &actualH); + wxSize actualSize(actualW, actualH); + + if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) { - prefix = "ID_SCROLLBAR"; - MakeUniqueName("scrollbar", buf); - res->SetName(buf); - newItem = new wxScrollBar(panel, -1, wxPoint(x, y), wxSize(140, -1), wxHORIZONTAL, wxDefaultValidator, buf); + actualSize = panel->ConvertPixelsToDialog(actualSize); } - if (!newItem) - return FALSE; - - int actualW, actualH; - newItem->GetSize(&actualW, &actualH); - wxSize actualSize(actualW, actualH); - - if ((panelResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) - { - actualSize = panel->ConvertPixelsToDialog(actualSize); - } - res->SetSize(res->GetX(), res->GetY(), actualSize.x, actualSize.y); - - wxString newIdName; - int id = GenerateWindowId(prefix, newIdName); - res->SetId(id); - - // This is now guaranteed to be unique, so just add to symbol table - m_symbolTable.AddSymbol(newIdName, id); - - newItem->PushEventHandler(new wxResourceEditorControlHandler(newItem, newItem)); - - res->SetStyle(newItem->GetWindowStyleFlag()); - AssociateResource(res, newItem); - panelResource->GetChildren().Append(res); - - UpdateResourceList(); - - return TRUE; + res->SetSize(res->GetX(), res->GetY(), actualSize.x, actualSize.y); + + wxString newIdName; + int id = GenerateWindowId(prefix, newIdName); + res->SetId(id); + + // This is now guaranteed to be unique, so just add to symbol table + m_symbolTable.AddSymbol(newIdName, id); + + newItem->PushEventHandler(new wxResourceEditorControlHandler(newItem, newItem)); + + res->SetStyle(newItem->GetWindowStyleFlag()); + AssociateResource(res, newItem); + panelResource->GetChildren().Append(res); + + UpdateResourceList(); + + return TRUE; } void wxResourceManager::ClearCurrentDialog() { - if (m_editorPanel->m_childWindow) - { - SaveInfoAndDeleteHandler(m_editorPanel->m_childWindow); - DisassociateResource(m_editorPanel->m_childWindow); - DeleteWindow(m_editorPanel->m_childWindow); - m_editorPanel->m_childWindow = NULL; - m_editorPanel->Clear(); - } + if (m_editorPanel->m_childWindow) + { + SaveInfoAndDeleteHandler(m_editorPanel->m_childWindow); + DisassociateResource(m_editorPanel->m_childWindow); + DeleteWindow(m_editorPanel->m_childWindow); + m_editorPanel->m_childWindow = NULL; + m_editorPanel->Clear(); + } } bool wxResourceManager::TestCurrentDialog(wxWindow* parent) { - if (m_editorPanel->m_childWindow) - { - wxItemResource* item = FindResourceForWindow(m_editorPanel->m_childWindow); - if (!item) - return FALSE; - - // Make sure the resources are up-to-date w.r.t. the window - InstantiateResourceFromWindow(item, m_editorPanel->m_childWindow, TRUE); - - wxDialog* dialog = new wxDialog; - bool success = FALSE; - if (dialog->LoadFromResource(parent, item->GetName(), & m_resourceTable)) + if (m_editorPanel->m_childWindow) { - dialog->Centre(); - dialog->ShowModal(); - success = TRUE; + wxItemResource* item = FindResourceForWindow(m_editorPanel->m_childWindow); + if (!item) + return FALSE; + + // Make sure the resources are up-to-date w.r.t. the window + InstantiateResourceFromWindow(item, m_editorPanel->m_childWindow, TRUE); + + ResourceEditorDialogTester* dialog = new ResourceEditorDialogTester; + bool success = FALSE; + if (dialog->LoadFromResource(parent, item->GetName(), & m_resourceTable)) + { + dialog->Centre(); + dialog->ShowModal(); + success = TRUE; + } + return success; } - return success; - } - return FALSE; + return FALSE; } // Find the first dialog or panel for which // there is a selected panel item. wxWindow *wxResourceManager::FindParentOfSelection() { - m_resourceTable.BeginFind(); - wxNode *node; - while ((node = m_resourceTable.Next())) - { - wxItemResource *res = (wxItemResource *)node->Data(); - wxWindow *win = FindWindowForResource(res); - if (win) + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) { - wxNode *node1 = win->GetChildren().First(); - while (node1) - { - wxControl *item = (wxControl *)node1->Data(); - wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - if (item->IsKindOf(CLASSINFO(wxControl)) && childHandler->IsSelected()) - return win; - node1 = node1->Next(); - } + wxItemResource *res = (wxItemResource *)node->Data(); + wxWindow *win = FindWindowForResource(res); + if (win) + { + wxNode *node1 = win->GetChildren().First(); + while (node1) + { + wxControl *item = (wxControl *)node1->Data(); + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if (item->IsKindOf(CLASSINFO(wxControl)) && childHandler->IsSelected()) + return win; + node1 = node1->Next(); + } + } } - } - return NULL; + return NULL; } // Format the panel items according to 'flag' void wxResourceManager::AlignItems(int flag) { - wxWindow *win = FindParentOfSelection(); - if (!win) - return; - - wxNode *node = GetSelections().First(); - if (!node) - return; + wxWindow *win = FindParentOfSelection(); + if (!win) + return; - wxControl *firstSelection = (wxControl *)node->Data(); - if (firstSelection->GetParent() != win) - return; + wxNode *node = GetSelections().First(); + if (!node) + return; - int firstX, firstY; - int firstW, firstH; - firstSelection->GetPosition(&firstX, &firstY); - firstSelection->GetSize(&firstW, &firstH); - int centreX = (int)(firstX + (firstW / 2)); - int centreY = (int)(firstY + (firstH / 2)); - - while ((node = node->Next())) - { - wxControl *item = (wxControl *)node->Data(); - if (item->GetParent() == win) + wxControl *firstSelection = (wxControl *)node->Data(); + if (firstSelection->GetParent() != win) + return; + + int firstX, firstY; + int firstW, firstH; + firstSelection->GetPosition(&firstX, &firstY); + firstSelection->GetSize(&firstW, &firstH); + int centreX = (int)(firstX + (firstW / 2)); + int centreY = (int)(firstY + (firstH / 2)); + + while ((node = node->Next())) { - int x, y, w, h; - item->GetPosition(&x, &y); - item->GetSize(&w, &h); - - int newX, newY; - - switch (flag) - { - case TOOLBAR_FORMAT_HORIZ: - { - newX = x; - newY = (int)(centreY - (h/2.0)); - break; - } - case TOOLBAR_FORMAT_VERT: - { - newX = (int)(centreX - (w/2.0)); - newY = y; - break; - } - case TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN: - { - newX = firstX; - newY = y; - break; - } - case TOOLBAR_FORMAT_VERT_TOP_ALIGN: + wxControl *item = (wxControl *)node->Data(); + if (item->GetParent() == win) { - newX = x; - newY = firstY; - break; + int x, y, w, h; + item->GetPosition(&x, &y); + item->GetSize(&w, &h); + + int newX, newY; + + switch (flag) + { + case TOOLBAR_FORMAT_HORIZ: + { + newX = x; + newY = (int)(centreY - (h/2.0)); + break; + } + case TOOLBAR_FORMAT_VERT: + { + newX = (int)(centreX - (w/2.0)); + newY = y; + break; + } + case TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN: + { + newX = firstX; + newY = y; + break; + } + case TOOLBAR_FORMAT_VERT_TOP_ALIGN: + { + newX = x; + newY = firstY; + break; + } + case TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN: + { + newX = firstX + firstW - w; + newY = y; + break; + } + case TOOLBAR_FORMAT_VERT_BOT_ALIGN: + { + newX = x; + newY = firstY + firstH - h; + break; + } + default: + newX = x; newY = y; + break; + } + + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item); + wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent()); + + item->SetSize(newX, newY, w, h); + + // Also update the associated resource + // We need to convert to dialog units if this is not a dialog or panel, but + // the parent resource specifies dialog units. + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxPoint pt = item->GetParent()->ConvertPixelsToDialog(wxPoint(newX, newY)); + newX = pt.x; newY = pt.y; + wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(w, h)); + w = sz.x; h = sz.y; + } + resource->SetSize(newX, newY, w, h); } - case TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN: + } + win->Refresh(); +} + +// Copy the first image's size to subsequent images +void wxResourceManager::CopySize(int command) +{ + bool copyWidth = (command == TOOLBAR_COPY_SIZE || command == TOOLBAR_COPY_WIDTH) ; + bool copyHeight = (command == TOOLBAR_COPY_SIZE || command == TOOLBAR_COPY_HEIGHT) ; + + wxWindow *win = FindParentOfSelection(); + if (!win) + return; + + wxNode *node = GetSelections().First(); + if (!node) + return; + + wxControl *firstSelection = (wxControl *)node->Data(); + if (firstSelection->GetParent() != win) + return; + + int firstX, firstY; + int firstW, firstH; + firstSelection->GetPosition(&firstX, &firstY); + firstSelection->GetSize(&firstW, &firstH); + + while ((node = node->Next())) + { + wxControl *item = (wxControl *)node->Data(); + if (item->GetParent() == win) { - newX = firstX + firstW - w; - newY = y; - break; + wxSize sz = item->GetSize(); + int widthToSet = (copyWidth ? firstW : sz.x); + int heightToSet = (copyHeight ? firstH : sz.y); + + item->SetSize(-1, -1, widthToSet, heightToSet); + + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item); + wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent()); + + widthToSet = resource->GetWidth(); + heightToSet = resource->GetHeight(); + + // Also update the associated resource + // We need to convert to dialog units if this is not a dialog or panel, but + // the parent resource specifies dialog units. + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxSize convertedSize = item->GetParent()->ConvertPixelsToDialog(wxSize(firstW, firstH)); + if (copyWidth) + widthToSet = convertedSize.x; + if (copyHeight) + heightToSet = convertedSize.y; + } + resource->SetSize(resource->GetX(), resource->GetY(), widthToSet, heightToSet); } - case TOOLBAR_FORMAT_VERT_BOT_ALIGN: + } + win->Refresh(); +} + +void wxResourceManager::ToBackOrFront(bool toBack) +{ + wxWindow *win = FindParentOfSelection(); + if (!win) + return; + wxItemResource *winResource = FindResourceForWindow(win); + + wxNode *node = GetSelections().First(); + while (node) + { + wxControl *item = (wxControl *)node->Data(); + wxItemResource *itemResource = FindResourceForWindow(item); + if (item->GetParent() == win) { - newX = x; - newY = firstY + firstH - h; - break; + win->GetChildren().DeleteObject(item); + if (winResource) + winResource->GetChildren().DeleteObject(itemResource); + if (toBack) + { + win->GetChildren().Insert(item); + if (winResource) + winResource->GetChildren().Insert(itemResource); + } + else + { + win->GetChildren().Append(item); + if (winResource) + winResource->GetChildren().Append(itemResource); + } } - default: - newX = x; newY = y; - break; - } - - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item); - wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent()); - - item->SetSize(newX, newY, w, h); - - // Also update the associated resource - // We need to convert to dialog units if this is not a dialog or panel, but - // the parent resource specifies dialog units. - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) - { - wxPoint pt = item->GetParent()->ConvertPixelsToDialog(wxPoint(newX, newY)); - newX = pt.x; newY = pt.y; - wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(w, h)); - w = sz.x; h = sz.y; - } - resource->SetSize(newX, newY, w, h); + node = node->Next(); } - } - win->Refresh(); + // win->Refresh(); } -// Copy the first image's size to subsequent images -void wxResourceManager::CopySize() +// Distribute controls evenly between first and last +void wxResourceManager::DistributePositions(int command) { - wxWindow *win = FindParentOfSelection(); - if (!win) - return; + bool horizontal = (command == TOOLBAR_DISTRIBUTE_HORIZ) ; - wxNode *node = GetSelections().First(); - if (!node) - return; + wxWindow *win = FindParentOfSelection(); + if (!win) + return; - wxControl *firstSelection = (wxControl *)node->Data(); - if (firstSelection->GetParent() != win) - return; + if (GetSelections().Number() < 3) + { + wxMessageBox(wxT("Sorry, distributing less than three controls does not make sense.")); + return; + } - int firstX, firstY; - int firstW, firstH; - firstSelection->GetPosition(&firstX, &firstY); - firstSelection->GetSize(&firstW, &firstH); + wxControl *firstSelection = (wxControl*) GetSelections().First()->Data(); + wxControl *lastSelection = (wxControl*) GetSelections().Last()->Data(); - while ((node = node->Next())) - { - wxControl *item = (wxControl *)node->Data(); - if (item->GetParent() == win) - { - item->SetSize(-1, -1, firstW, firstH); + // For now, assume the ordering is correct (the user selected the controls in order). + // TODO: explicitly order the selections in terms of increading x or y position. - int fw = firstW; - int fh = firstH; + // Find the total amount of space between all controls + int totalControlSpace = 0; // How much space the controls take up - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item); - wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent()); + wxNode* node = GetSelections().First(); + while (node) + { + wxControl* control = (wxControl*) node->Data(); - // Also update the associated resource - // We need to convert to dialog units if this is not a dialog or panel, but - // the parent resource specifies dialog units. - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) - { - wxSize sz = item->GetParent()->ConvertPixelsToDialog(wxSize(firstW, firstH)); - fw = sz.x; fh = sz.y; - } - resource->SetSize(resource->GetX(), resource->GetY(), fw, fh); + int x, y; + int w, h; + control->GetPosition(&x, &y); + control->GetSize(&w, &h); - } - } - win->Refresh(); -} + // Don't include the space taken up by the first and last controls. + if (control != firstSelection && control != lastSelection) + { + if (horizontal) + totalControlSpace += w; + else + totalControlSpace += h; + } -void wxResourceManager::ToBackOrFront(bool toBack) -{ - wxWindow *win = FindParentOfSelection(); - if (!win) - return; - wxItemResource *winResource = FindResourceForWindow(win); - - wxNode *node = GetSelections().First(); - while (node) - { - wxControl *item = (wxControl *)node->Data(); - wxItemResource *itemResource = FindResourceForWindow(item); - if (item->GetParent() == win) - { - win->GetChildren().DeleteObject(item); - if (winResource) - winResource->GetChildren().DeleteObject(itemResource); - if (toBack) - { - win->GetChildren().Insert(item); - if (winResource) - winResource->GetChildren().Insert(itemResource); - } - else - { - win->GetChildren().Append(item); - if (winResource) - winResource->GetChildren().Append(itemResource); - } - } - node = node->Next(); - } -// win->Refresh(); + node = node->Next(); + } + + + int firstX, firstY, lastX, lastY; + int firstW, firstH, lastW, lastH; + firstSelection->GetPosition(&firstX, &firstY); + firstSelection->GetSize(&firstW, &firstH); + + lastSelection->GetPosition(&lastX, &lastY); + lastSelection->GetSize(&lastW, &lastH); + + /* + + firstX lastX + |===| |====| |======| |==| + + */ + + int spacing, currentPos; + if (horizontal) + { + spacing = ((lastX - (firstX + firstW)) - totalControlSpace) / (GetSelections().Number() - 1); + currentPos = firstX + firstW + spacing; + } + else + { + spacing = ((lastY - (firstY + firstH)) - totalControlSpace) / (GetSelections().Number() - 1); + currentPos = firstY + firstH + spacing; + } + + node = GetSelections().First(); + + while ((node = node->Next())) + { + wxControl *item = (wxControl *)node->Data(); + wxSize sz = item->GetSize(); + wxPoint pos = item->GetPosition(); + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item); + wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(item->GetParent()); + + int controlX = (horizontal ? currentPos : pos.x); + int controlY = (horizontal ? pos.y : currentPos); + + item->Move(controlX, controlY); + + int resX = controlX; + int resY = controlY; + + // Also update the associated resource + // We need to convert to dialog units if this is not a dialog or panel, but + // the parent resource specifies dialog units. + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxPoint convertedPos = item->GetParent()->ConvertPixelsToDialog(wxPoint(resX, resY)); + resX = convertedPos.x; + resY = convertedPos.y; + } + resource->SetSize(resX, resY, resource->GetWidth(), resource->GetHeight()); + + currentPos += (horizontal ? (sz.x + spacing) : (sz.y + spacing)); + } + win->Refresh(); } void wxResourceManager::AddSelection(wxWindow *win) { - if (!m_selections.Member(win)) - m_selections.Append(win); + if (!m_selections.Member(win)) + m_selections.Append(win); } void wxResourceManager::RemoveSelection(wxWindow *win) { - m_selections.DeleteObject(win); + m_selections.DeleteObject(win); } void wxResourceManager::DeselectItemIfNecessary(wxWindow *win) @@ -1485,188 +1605,188 @@ void wxResourceManager::DeselectItemIfNecessary(wxWindow *win) // any resource which has this as a parent. bool wxResourceManager::RemoveResourceFromParent(wxItemResource *res) { - m_resourceTable.BeginFind(); - wxNode *node; - while ((node = m_resourceTable.Next())) - { - wxItemResource *thisRes = (wxItemResource *)node->Data(); - if (thisRes->GetChildren().Member(res)) + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) { - thisRes->GetChildren().DeleteObject(res); - return TRUE; + wxItemResource *thisRes = (wxItemResource *)node->Data(); + if (thisRes->GetChildren().Member(res)) + { + thisRes->GetChildren().DeleteObject(res); + return TRUE; + } } - } - return FALSE; + return FALSE; } bool wxResourceManager::DeleteResource(wxItemResource *res) { - if (!res) - return FALSE; - - RemoveResourceFromParent(res); - - wxNode *node = res->GetChildren().First(); - while (node) - { - wxNode *next = node->Next(); - wxItemResource *child = (wxItemResource *)node->Data(); - DeleteResource(child); - node = next; - } - - // If this is a button or message resource, delete the - // associate bitmap resource if not being used. - wxString resType(res->GetType()); - -/* shouldn't have to do this now bitmaps are ref-counted - if ((resType == "wxMessage" || resType == "wxStaticBitmap" || resType == "wxButton" || resType == "wxBitmapButton") && res->GetValue4()) - { + if (!res) + return FALSE; + + RemoveResourceFromParent(res); + + wxNode *node = res->GetChildren().First(); + while (node) + { + wxNode *next = node->Next(); + wxItemResource *child = (wxItemResource *)node->Data(); + DeleteResource(child); + node = next; + } + + // If this is a button or message resource, delete the + // associate bitmap resource if not being used. + wxString resType(res->GetType()); + + /* shouldn't have to do this now bitmaps are ref-counted + if ((resType == "wxMessage" || resType == "wxStaticBitmap" || resType == "wxButton" || resType == "wxBitmapButton") && res->GetValue4()) + { PossiblyDeleteBitmapResource(res->GetValue4()); - } -*/ - - // Remove symbol from table if appropriate - if (!IsSymbolUsed(res, res->GetId())) - { - m_symbolTable.RemoveSymbol(res->GetId()); - } - - m_resourceTable.Delete(res->GetName()); - delete res; - Modify(TRUE); - return TRUE; + } + */ + + // Remove symbol from table if appropriate + if (!IsSymbolUsed(res, res->GetId())) + { + m_symbolTable.RemoveSymbol(res->GetId()); + } + + m_resourceTable.Delete(res->GetName()); + delete res; + Modify(TRUE); + return TRUE; } bool wxResourceManager::DeleteResource(wxWindow *win) { - DeselectItemIfNecessary(win); - - wxItemResource *res = FindResourceForWindow(win); - - DisassociateResource(res); - DeleteResource(res); - UpdateResourceList(); - - return TRUE; + DeselectItemIfNecessary(win); + + wxItemResource *res = FindResourceForWindow(win); + + DisassociateResource(res); + DeleteResource(res); + UpdateResourceList(); + + return TRUE; } // Will eventually have bitmap type information, for different // kinds of bitmap. wxString wxResourceManager::AddBitmapResource(const wxString& filename) { - wxItemResource *resource = FindBitmapResourceByFilename(filename); - if (!resource) - { - char buf[256]; - MakeUniqueName("bitmap", buf); - resource = new wxItemResource; - resource->SetType("wxBitmap"); - resource->SetName(buf); - - // A bitmap resource has one or more children, specifying - // alternative bitmaps. - wxItemResource *child = new wxItemResource; - child->SetType("wxBitmap"); - child->SetName(filename); - child->SetValue1(wxBITMAP_TYPE_BMP); - child->SetValue2(RESOURCE_PLATFORM_ANY); - child->SetValue3(0); // Depth - child->SetSize(0,0,0,0); - resource->GetChildren().Append(child); - - m_resourceTable.AddResource(resource); - - UpdateResourceList(); - } - if (resource) - return resource->GetName(); - else - return wxEmptyString; + wxItemResource *resource = FindBitmapResourceByFilename(filename); + if (!resource) + { + char buf[256]; + MakeUniqueName("bitmap", buf); + resource = new wxItemResource; + resource->SetType("wxBitmap"); + resource->SetName(buf); + + // A bitmap resource has one or more children, specifying + // alternative bitmaps. + wxItemResource *child = new wxItemResource; + child->SetType("wxBitmap"); + child->SetName(filename); + child->SetValue1(wxBITMAP_TYPE_BMP); + child->SetValue2(RESOURCE_PLATFORM_ANY); + child->SetValue3(0); // Depth + child->SetSize(0,0,0,0); + resource->GetChildren().Append(child); + + m_resourceTable.AddResource(resource); + + UpdateResourceList(); + } + if (resource) + return resource->GetName(); + else + return wxEmptyString; } - // Delete the bitmap resource if it isn't being used by another resource. +// Delete the bitmap resource if it isn't being used by another resource. void wxResourceManager::PossiblyDeleteBitmapResource(const wxString& resourceName) { - if (!IsBitmapResourceUsed(resourceName)) - { - wxItemResource *res = m_resourceTable.FindResource(resourceName); - DeleteResource(res); - UpdateResourceList(); - } + if (!IsBitmapResourceUsed(resourceName)) + { + wxItemResource *res = m_resourceTable.FindResource(resourceName); + DeleteResource(res); + UpdateResourceList(); + } } bool wxResourceManager::IsBitmapResourceUsed(const wxString& resourceName) { - m_resourceTable.BeginFind(); - wxNode *node; - while ((node = m_resourceTable.Next())) - { - wxItemResource *res = (wxItemResource *)node->Data(); - wxString resType(res->GetType()); - if (resType == "wxDialog") + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) { - wxNode *node1 = res->GetChildren().First(); - while (node1) - { - wxItemResource *child = (wxItemResource *)node1->Data(); - wxString childResType(child->GetType()); - - if ((childResType == "wxMessage" || childResType == "wxButton") && - child->GetValue4() && - (strcmp(child->GetValue4(), resourceName) == 0)) - return TRUE; - node1 = node1->Next(); - } + wxItemResource *res = (wxItemResource *)node->Data(); + wxString resType(res->GetType()); + if (resType == "wxDialog") + { + wxNode *node1 = res->GetChildren().First(); + while (node1) + { + wxItemResource *child = (wxItemResource *)node1->Data(); + wxString childResType(child->GetType()); + + if ((childResType == "wxMessage" || childResType == "wxButton") && + child->GetValue4() && + (strcmp(child->GetValue4(), resourceName) == 0)) + return TRUE; + node1 = node1->Next(); + } + } } - } - return FALSE; + return FALSE; } // Given a wxButton or wxMessage, find the corresponding bitmap filename. wxString wxResourceManager::FindBitmapFilenameForResource(wxItemResource *resource) { - if (!resource || (resource->GetValue4() == "")) - return wxEmptyString; - wxItemResource *bitmapResource = m_resourceTable.FindResource(resource->GetValue4()); - if (!bitmapResource) - return wxEmptyString; - - wxNode *node = bitmapResource->GetChildren().First(); - while (node) - { - // Eventually augment this to return a bitmap of the right kind or something... - // Maybe the root of the filename remains the same, so it doesn't matter which we - // pick up. Otherwise how do we specify multiple filenames... too boring... - wxItemResource *child = (wxItemResource *)node->Data(); - return child->GetName(); + if (!resource || (resource->GetValue4() == "")) + return wxEmptyString; + wxItemResource *bitmapResource = m_resourceTable.FindResource(resource->GetValue4()); + if (!bitmapResource) + return wxEmptyString; - //node = node->Next(); - } - return wxEmptyString; + wxNode *node = bitmapResource->GetChildren().First(); + while (node) + { + // Eventually augment this to return a bitmap of the right kind or something... + // Maybe the root of the filename remains the same, so it doesn't matter which we + // pick up. Otherwise how do we specify multiple filenames... too boring... + wxItemResource *child = (wxItemResource *)node->Data(); + return child->GetName(); + + //node = node->Next(); + } + return wxEmptyString; } wxItemResource *wxResourceManager::FindBitmapResourceByFilename(const wxString& filename) { - m_resourceTable.BeginFind(); - wxNode *node; - while ((node = m_resourceTable.Next())) - { - wxItemResource *res = (wxItemResource *)node->Data(); - wxString resType(res->GetType()); - if (resType == "wxBitmap") + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) { - wxNode *node1 = res->GetChildren().First(); - while (node1) - { - wxItemResource *child = (wxItemResource *)node1->Data(); - if (child->GetName() && (strcmp(child->GetName(), filename) == 0)) - return res; - node1 = node1->Next(); - } + wxItemResource *res = (wxItemResource *)node->Data(); + wxString resType(res->GetType()); + if (resType == "wxBitmap") + { + wxNode *node1 = res->GetChildren().First(); + while (node1) + { + wxItemResource *child = (wxItemResource *)node1->Data(); + if (child->GetName() && (strcmp(child->GetName(), filename) == 0)) + return res; + node1 = node1->Next(); + } + } } - } - return NULL; + return NULL; } // Is this window identifier symbol in use? @@ -1675,29 +1795,29 @@ wxItemResource *wxResourceManager::FindBitmapResourceByFilename(const wxString& // in use. bool wxResourceManager::IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) { - m_resourceTable.BeginFind(); - wxNode *node; - while ((node = m_resourceTable.Next())) - { - wxItemResource *res = (wxItemResource *)node->Data(); - - wxString resType(res->GetType()); - if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel") + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) { - if ((res != thisResource) && (res->GetId() == id)) - return TRUE; - - wxNode *node1 = res->GetChildren().First(); - while (node1) - { - wxItemResource *child = (wxItemResource *)node1->Data(); - if ((child != thisResource) && (child->GetId() == id)) - return TRUE; - node1 = node1->Next(); - } + wxItemResource *res = (wxItemResource *)node->Data(); + + wxString resType(res->GetType()); + if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel") + { + if ((res != thisResource) && (res->GetId() == id)) + return TRUE; + + wxNode *node1 = res->GetChildren().First(); + while (node1) + { + wxItemResource *child = (wxItemResource *)node1->Data(); + if ((child != thisResource) && (child->GetId() == id)) + return TRUE; + node1 = node1->Next(); + } + } } - } - return FALSE; + return FALSE; } // Is this window identifier compatible with the given name? (i.e. @@ -1718,29 +1838,29 @@ bool wxResourceManager::IsIdentifierOK(const wxString& name, wxWindowID id) // must be changed. void wxResourceManager::ChangeIds(int oldId, int newId) { - m_resourceTable.BeginFind(); - wxNode *node; - while ((node = m_resourceTable.Next())) - { - wxItemResource *res = (wxItemResource *)node->Data(); - - wxString resType(res->GetType()); - if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel") + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) { - if (res->GetId() == oldId) - res->SetId(newId); - - wxNode *node1 = res->GetChildren().First(); - while (node1) - { - wxItemResource *child = (wxItemResource *)node1->Data(); - if (child->GetId() == oldId) - child->SetId(newId); - - node1 = node1->Next(); - } + wxItemResource *res = (wxItemResource *)node->Data(); + + wxString resType(res->GetType()); + if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel") + { + if (res->GetId() == oldId) + res->SetId(newId); + + wxNode *node1 = res->GetChildren().First(); + while (node1) + { + wxItemResource *child = (wxItemResource *)node1->Data(); + if (child->GetId() == oldId) + child->SetId(newId); + + node1 = node1->Next(); + } + } } - } } // If any resource ids were missing (or their symbol was missing), @@ -1748,314 +1868,314 @@ void wxResourceManager::ChangeIds(int oldId, int newId) // needed repairing. bool wxResourceManager::RepairResourceIds() { - bool repaired = FALSE; - - m_resourceTable.BeginFind(); - wxNode *node; - while ((node = m_resourceTable.Next())) - { - wxItemResource *res = (wxItemResource *)node->Data(); - wxString resType(res->GetType()); - if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel") + bool repaired = FALSE; + + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) { - - if ( (res->GetId() == 0) || ((res->GetId() > 0) && !m_symbolTable.IdExists(res->GetId())) ) - { - wxString newSymbolName; - int newId = GenerateWindowId("ID_DIALOG", newSymbolName) ; - - if (res->GetId() == 0) - { - res->SetId(newId); - m_symbolTable.AddSymbol(newSymbolName, newId); - } - else - { - m_symbolTable.AddSymbol(newSymbolName, res->GetId()); - } - - repaired = TRUE; - } - - wxNode *node1 = res->GetChildren().First(); - while (node1) - { - wxItemResource *child = (wxItemResource *)node1->Data(); - - if ( (child->GetId() == 0) || ((child->GetId() > 0) && !m_symbolTable.IdExists(child->GetId())) ) + wxItemResource *res = (wxItemResource *)node->Data(); + wxString resType(res->GetType()); + if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel") { - wxString newSymbolName; - int newId = GenerateWindowId("ID_CONTROL", newSymbolName) ; - - if (child->GetId() == 0) + + if ( (res->GetId() == 0) || ((res->GetId() > 0) && !m_symbolTable.IdExists(res->GetId())) ) { - child->SetId(newId); - m_symbolTable.AddSymbol(newSymbolName, newId); + wxString newSymbolName; + int newId = GenerateWindowId("ID_DIALOG", newSymbolName) ; + + if (res->GetId() == 0) + { + res->SetId(newId); + m_symbolTable.AddSymbol(newSymbolName, newId); + } + else + { + m_symbolTable.AddSymbol(newSymbolName, res->GetId()); + } + + repaired = TRUE; } - else + + wxNode *node1 = res->GetChildren().First(); + while (node1) { - m_symbolTable.AddSymbol(newSymbolName, child->GetId()); + wxItemResource *child = (wxItemResource *)node1->Data(); + + if ( (child->GetId() == 0) || ((child->GetId() > 0) && !m_symbolTable.IdExists(child->GetId())) ) + { + wxString newSymbolName; + int newId = GenerateWindowId("ID_CONTROL", newSymbolName) ; + + if (child->GetId() == 0) + { + child->SetId(newId); + m_symbolTable.AddSymbol(newSymbolName, newId); + } + else + { + m_symbolTable.AddSymbol(newSymbolName, child->GetId()); + } + + repaired = TRUE; + } + + node1 = node1->Next(); } - - repaired = TRUE; } - - node1 = node1->Next(); - } } - } - return repaired; + return repaired; } - // Deletes 'win' and creates a new window from the resource that - // was associated with it. E.g. if you can't change properties on the - // fly, you'll need to delete the window and create it again. +// Deletes 'win' and creates a new window from the resource that +// was associated with it. E.g. if you can't change properties on the +// fly, you'll need to delete the window and create it again. wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info, bool instantiateFirst) { - wxItemResource *resource = FindResourceForWindow(win); - - // Put the current window properties into the wxItemResource object - - wxWindowPropertyInfo *newInfo = NULL; - if (!info) - { - newInfo = CreatePropertyInfoForWindow(win); - info = newInfo; - } - - // May not always want to copy values back from the resource - if (instantiateFirst) - info->InstantiateResource(resource); - - wxWindow *newWin = NULL; - wxWindow *parent = win->GetParent(); - wxItemResource* parentResource = NULL; - if (parent) - parentResource = FindResourceForWindow(parent); - - if (win->IsKindOf(CLASSINFO(wxPanel))) - { - Edit(resource); - newWin = FindWindowForResource(resource); - } - else - { - DisassociateResource(resource); - if (win->GetEventHandler() != win) - win->PopEventHandler(TRUE); - - DeleteWindow(win); - newWin = m_resourceTable.CreateItem((wxPanel *)parent, resource, parentResource); - newWin->PushEventHandler(new wxResourceEditorControlHandler((wxControl*) newWin, (wxControl*) newWin)); - AssociateResource(resource, newWin); - UpdateResourceList(); - } - - if (info) - info->SetPropertyWindow(newWin); + wxItemResource *resource = FindResourceForWindow(win); - if (newInfo) - delete newInfo; - - return newWin; + // Put the current window properties into the wxItemResource object + + wxWindowPropertyInfo *newInfo = NULL; + if (!info) + { + newInfo = CreatePropertyInfoForWindow(win); + info = newInfo; + } + + // May not always want to copy values back from the resource + if (instantiateFirst) + info->InstantiateResource(resource); + + wxWindow *newWin = NULL; + wxWindow *parent = win->GetParent(); + wxItemResource* parentResource = NULL; + if (parent) + parentResource = FindResourceForWindow(parent); + + if (win->IsKindOf(CLASSINFO(wxPanel))) + { + Edit(resource); + newWin = FindWindowForResource(resource); + } + else + { + DisassociateResource(resource); + if (win->GetEventHandler() != win) + win->PopEventHandler(TRUE); + + DeleteWindow(win); + newWin = m_resourceTable.CreateItem((wxPanel *)parent, resource, parentResource); + newWin->PushEventHandler(new wxResourceEditorControlHandler((wxControl*) newWin, (wxControl*) newWin)); + AssociateResource(resource, newWin); + UpdateResourceList(); + } + + if (info) + info->SetPropertyWindow(newWin); + + if (newInfo) + delete newInfo; + + return newWin; } // Delete resource highlighted in the listbox bool wxResourceManager::DeleteSelection() { - int sel = m_editorResourceTree->GetSelection(); - if (sel != 0) - { - wxResourceTreeData *data = (wxResourceTreeData *)m_editorResourceTree->GetItemData(sel); - wxItemResource *res = data->GetResource(); - wxWindow *win = FindWindowForResource(res); - if (win) + int sel = m_editorResourceTree->GetSelection(); + if (sel != 0) { - DeleteResource(win); - DeleteWindow(win); - UpdateResourceList(); - Modify(TRUE); + wxResourceTreeData *data = (wxResourceTreeData *)m_editorResourceTree->GetItemData(sel); + wxItemResource *res = data->GetResource(); + wxWindow *win = FindWindowForResource(res); + if (win) + { + DeleteResource(win); + DeleteWindow(win); + UpdateResourceList(); + Modify(TRUE); + } + return TRUE; } - return TRUE; - } - - return FALSE; + + return FALSE; } // Delete resource highlighted in the listbox bool wxResourceManager::RecreateSelection() { - wxNode *node = GetSelections().First(); - while (node) - { - wxControl *item = (wxControl *)node->Data(); - wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - wxNode *next = node->Next(); - childHandler->SelectItem(FALSE); - - RemoveSelection(item); - - RecreateWindowFromResource(item); - - node = next; - } - return TRUE; + wxNode *node = GetSelections().First(); + while (node) + { + wxControl *item = (wxControl *)node->Data(); + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + wxNode *next = node->Next(); + childHandler->SelectItem(FALSE); + + RemoveSelection(item); + + RecreateWindowFromResource(item); + + node = next; + } + return TRUE; } bool wxResourceManager::EditDialog(wxDialog *WXUNUSED(dialog), wxWindow *WXUNUSED(parent)) { - return FALSE; + return FALSE; } // Ensures that all currently shown windows are saved to resources, // e.g. just before writing to a .wxr file. bool wxResourceManager::InstantiateAllResourcesFromWindows() { - m_resourceTable.BeginFind(); - wxNode *node; - while ((node = m_resourceTable.Next())) - { - wxItemResource *res = (wxItemResource *)node->Data(); - wxString resType(res->GetType()); - - if (resType == "wxDialog") - { - wxWindow *win = (wxWindow *)FindWindowForResource(res); - if (win) - InstantiateResourceFromWindow(res, win, TRUE); - } - else if (resType == "wxPanel") + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) { - wxWindow *win = (wxWindow *)FindWindowForResource(res); - if (win) - InstantiateResourceFromWindow(res, win, TRUE); + wxItemResource *res = (wxItemResource *)node->Data(); + wxString resType(res->GetType()); + + if (resType == "wxDialog") + { + wxWindow *win = (wxWindow *)FindWindowForResource(res); + if (win) + InstantiateResourceFromWindow(res, win, TRUE); + } + else if (resType == "wxPanel") + { + wxWindow *win = (wxWindow *)FindWindowForResource(res); + if (win) + InstantiateResourceFromWindow(res, win, TRUE); + } } - } - return TRUE; + return TRUE; } bool wxResourceManager::InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse) { - wxWindowPropertyInfo *info = CreatePropertyInfoForWindow(window); - info->SetResource(resource); - info->InstantiateResource(resource); - delete info; - - if (recurse) - { - wxNode *node = resource->GetChildren().First(); - while (node) + wxWindowPropertyInfo *info = CreatePropertyInfoForWindow(window); + info->SetResource(resource); + info->InstantiateResource(resource); + delete info; + + if (recurse) { - wxItemResource *child = (wxItemResource *)node->Data(); - wxWindow *childWindow = FindWindowForResource(child); - - if (!childWindow) - { - char buf[200]; - sprintf(buf, "Could not find window %s", (const char*) child->GetName()); - wxMessageBox(buf, "Dialog Editor problem", wxOK); - } - else - InstantiateResourceFromWindow(child, childWindow, recurse); - node = node->Next(); - } - } - - return TRUE; + wxNode *node = resource->GetChildren().First(); + while (node) + { + wxItemResource *child = (wxItemResource *)node->Data(); + wxWindow *childWindow = FindWindowForResource(child); + + if (!childWindow) + { + char buf[200]; + sprintf(buf, "Could not find window %s", (const char*) child->GetName()); + wxMessageBox(buf, "Dialog Editor problem", wxOK); + } + else + InstantiateResourceFromWindow(child, childWindow, recurse); + node = node->Next(); + } + } + + return TRUE; } // Create a window information object for the give window wxWindowPropertyInfo *wxResourceManager::CreatePropertyInfoForWindow(wxWindow *win) { - wxWindowPropertyInfo *info = NULL; - if (win->IsKindOf(CLASSINFO(wxScrollBar))) - { - info = new wxScrollBarPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxStaticBox))) - { - info = new wxGroupBoxPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxCheckBox))) - { - info = new wxCheckBoxPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxSlider))) - { - info = new wxSliderPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxGauge))) - { - info = new wxGaugePropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxListBox))) - { - info = new wxListBoxPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxRadioBox))) - { - info = new wxRadioBoxPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxRadioButton))) - { - info = new wxRadioButtonPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxComboBox))) - { - info = new wxComboBoxPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxChoice))) - { - info = new wxChoicePropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxBitmapButton))) - { - info = new wxBitmapButtonPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxButton))) - { - info = new wxButtonPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxStaticBitmap))) - { - info = new wxStaticBitmapPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxStaticText))) - { - info = new wxStaticTextPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxTextCtrl))) - { - info = new wxTextPropertyInfo(win); - } - else if (win->IsKindOf(CLASSINFO(wxPanel))) - { - info = new wxPanelPropertyInfo(win); - } - else - { - info = new wxWindowPropertyInfo(win); - } - return info; + wxWindowPropertyInfo *info = NULL; + if (win->IsKindOf(CLASSINFO(wxScrollBar))) + { + info = new wxScrollBarPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxStaticBox))) + { + info = new wxGroupBoxPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxCheckBox))) + { + info = new wxCheckBoxPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxSlider))) + { + info = new wxSliderPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxGauge))) + { + info = new wxGaugePropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxListBox))) + { + info = new wxListBoxPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxRadioBox))) + { + info = new wxRadioBoxPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxRadioButton))) + { + info = new wxRadioButtonPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxComboBox))) + { + info = new wxComboBoxPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxChoice))) + { + info = new wxChoicePropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxBitmapButton))) + { + info = new wxBitmapButtonPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxButton))) + { + info = new wxButtonPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxStaticBitmap))) + { + info = new wxStaticBitmapPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxStaticText))) + { + info = new wxStaticTextPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxTextCtrl))) + { + info = new wxTextPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxPanel))) + { + info = new wxPanelPropertyInfo(win); + } + else + { + info = new wxWindowPropertyInfo(win); + } + return info; } // Edit the given window void wxResourceManager::EditWindow(wxWindow *win) { - wxWindowPropertyInfo *info = CreatePropertyInfoForWindow(win); - if (info) - { - info->SetResource(FindResourceForWindow(win)); - wxString str("Editing "); - str += win->GetClassInfo()->GetClassName(); - str += ": "; - if (win->GetName() != "") - str += win->GetName(); - else - str += "properties"; - info->Edit(NULL, str); - } + wxWindowPropertyInfo *info = CreatePropertyInfoForWindow(win); + if (info) + { + info->SetResource(FindResourceForWindow(win)); + wxString str("Editing "); + str += win->GetClassInfo()->GetClassName(); + str += ": "; + if (win->GetName() != "") + str += win->GetName(); + else + str += "properties"; + info->Edit(NULL, str); + } } // Generate a window id and a first stab at a name @@ -2064,98 +2184,104 @@ int wxResourceManager::GenerateWindowId(const wxString& prefix, wxString& idName m_symbolIdCounter ++; while (m_symbolTable.IdExists(m_symbolIdCounter)) m_symbolIdCounter ++; - + int nameId = m_symbolIdCounter; - + wxString str; str.Printf("%d", nameId); idName = prefix + str; - + while (m_symbolTable.SymbolExists(idName)) { nameId ++; str.Printf("%d", nameId); idName = prefix + str; } - + return m_symbolIdCounter; } /* - * Resource editor frame - */ +* Resource editor frame +*/ IMPLEMENT_CLASS(wxResourceEditorFrame, wxFrame) BEGIN_EVENT_TABLE(wxResourceEditorFrame, wxFrame) - EVT_MENU(wxID_NEW, wxResourceEditorFrame::OnNew) - EVT_MENU(RESED_NEW_DIALOG, wxResourceEditorFrame::OnNewDialog) - EVT_MENU(wxID_OPEN, wxResourceEditorFrame::OnOpen) - EVT_MENU(RESED_CLEAR, wxResourceEditorFrame::OnClear) - EVT_MENU(wxID_SAVE, wxResourceEditorFrame::OnSave) - EVT_MENU(wxID_SAVEAS, wxResourceEditorFrame::OnSaveAs) - EVT_MENU(wxID_EXIT, wxResourceEditorFrame::OnExit) - EVT_MENU(wxID_ABOUT, wxResourceEditorFrame::OnAbout) - EVT_MENU(RESED_CONTENTS, wxResourceEditorFrame::OnContents) - EVT_MENU(RESED_DELETE, wxResourceEditorFrame::OnDeleteSelection) - EVT_MENU(RESED_RECREATE, wxResourceEditorFrame::OnRecreateSelection) - EVT_MENU(RESED_TEST, wxResourceEditorFrame::OnTest) - EVT_CLOSE(wxResourceEditorFrame::OnCloseWindow) +EVT_MENU(wxID_NEW, wxResourceEditorFrame::OnNew) +EVT_MENU(RESED_NEW_DIALOG, wxResourceEditorFrame::OnNewDialog) +EVT_MENU(wxID_OPEN, wxResourceEditorFrame::OnOpen) +EVT_MENU(RESED_CLEAR, wxResourceEditorFrame::OnClear) +EVT_MENU(wxID_SAVE, wxResourceEditorFrame::OnSave) +EVT_MENU(wxID_SAVEAS, wxResourceEditorFrame::OnSaveAs) +EVT_MENU(wxID_EXIT, wxResourceEditorFrame::OnExit) +EVT_MENU(wxID_ABOUT, wxResourceEditorFrame::OnAbout) +EVT_MENU(RESED_CONTENTS, wxResourceEditorFrame::OnContents) +EVT_MENU(RESED_DELETE, wxResourceEditorFrame::OnDeleteSelection) +EVT_MENU(RESED_RECREATE, wxResourceEditorFrame::OnRecreateSelection) +EVT_MENU(RESED_TEST, wxResourceEditorFrame::OnTest) +EVT_MENU(RESED_CONVERT_WXRS, wxResourceEditorFrame::OnConvertWXRs) +EVT_CLOSE(wxResourceEditorFrame::OnCloseWindow) END_EVENT_TABLE() wxResourceEditorFrame::wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title, - const wxPoint& pos, const wxSize& size, long style, const wxString& name): - wxFrame(parent, -1, title, pos, size, style, name) + const wxPoint& pos, const wxSize& size, long style, const wxString& name): +wxFrame(parent, -1, title, pos, size, style, name) { - manager = resMan; + manager = resMan; } wxResourceEditorFrame::~wxResourceEditorFrame() { } +void wxResourceEditorFrame::OnConvertWXRs(wxCommandEvent& WXUNUSED(event)) +{ + manager->ConvertWXRs(); +} + void wxResourceEditorFrame::OnNew(wxCommandEvent& WXUNUSED(event)) { - manager->New(FALSE); + manager->New(FALSE); } void wxResourceEditorFrame::OnNewDialog(wxCommandEvent& WXUNUSED(event)) { - manager->CreateNewPanel(); + manager->CreateNewPanel(); } void wxResourceEditorFrame::OnOpen(wxCommandEvent& WXUNUSED(event)) { - manager->New(TRUE); + manager->New(TRUE); } void wxResourceEditorFrame::OnClear(wxCommandEvent& WXUNUSED(event)) { - manager->Clear(TRUE, FALSE); + manager->Clear(TRUE, FALSE); } void wxResourceEditorFrame::OnSave(wxCommandEvent& WXUNUSED(event)) { - manager->Save(); + manager->Save(); } void wxResourceEditorFrame::OnSaveAs(wxCommandEvent& WXUNUSED(event)) { - manager->SaveAs(); + manager->SaveAs(); } void wxResourceEditorFrame::OnExit(wxCommandEvent& WXUNUSED(event)) { - manager->Clear(TRUE, FALSE) ; - this->Destroy(); + manager->Clear(TRUE, FALSE) ; + this->Destroy(); } void wxResourceEditorFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - char buf[300]; - sprintf(buf, "wxWindows Dialog Editor %.1f\nAuthor: Julian Smart <julian.smart@ukonline.co.uk>\nJulian Smart (c) 1996-1999", wxDIALOG_EDITOR_VERSION); - wxMessageBox(buf, "About Dialog Editor", wxOK|wxCENTRE); + char buf[300]; + sprintf(buf, "wxWindows Dialog Editor %.1f\nAuthor: Julian Smart <julian.smart@ukonline.co.uk>\nJulian Smart (c) 1996-1999", wxDIALOG_EDITOR_VERSION); + wxMessageBox(buf, "About Dialog Editor", wxOK|wxCENTRE); } void wxResourceEditorFrame::OnTest(wxCommandEvent& WXUNUSED(event)) @@ -2166,70 +2292,71 @@ void wxResourceEditorFrame::OnTest(wxCommandEvent& WXUNUSED(event)) void wxResourceEditorFrame::OnContents(wxCommandEvent& WXUNUSED(event)) { #ifdef __WXMSW__ - wxBeginBusyCursor(); - manager->GetHelpController()->LoadFile(); - manager->GetHelpController()->DisplayContents(); - wxEndBusyCursor(); + wxBeginBusyCursor(); + manager->GetHelpController()->LoadFile(); + manager->GetHelpController()->DisplayContents(); + wxEndBusyCursor(); #endif } void wxResourceEditorFrame::OnDeleteSelection(wxCommandEvent& WXUNUSED(event)) { - manager->DeleteSelection(); + manager->DeleteSelection(); } void wxResourceEditorFrame::OnRecreateSelection(wxCommandEvent& WXUNUSED(event)) { - manager->RecreateSelection(); + manager->RecreateSelection(); } void wxResourceEditorFrame::OnCloseWindow(wxCloseEvent& event) { - wxPropertyInfo::CloseWindow(); - if (manager->Modified()) - { - if (!manager->Clear(TRUE, FALSE)) - { - event.Veto(); - return; + wxPropertyInfo::CloseWindow(); + manager->ClearCurrentDialog(); + if (manager->Modified()) + { + if (!manager->Clear(TRUE, FALSE)) + { + event.Veto(); + return; + } } - } - if (!IsIconized()) - { - int w, h; - GetSize(&w, &h); - manager->m_resourceEditorWindowSize.width = w; - manager->m_resourceEditorWindowSize.height = h; - - int x, y; - GetPosition(&x, &y); - - manager->m_resourceEditorWindowSize.x = x; - manager->m_resourceEditorWindowSize.y = y; - } - manager->SetEditorFrame(NULL); - manager->SetEditorToolBar(NULL); - - this->Destroy(); + if (!IsIconized()) + { + int w, h; + GetSize(&w, &h); + manager->m_resourceEditorWindowSize.width = w; + manager->m_resourceEditorWindowSize.height = h; + + int x, y; + GetPosition(&x, &y); + + manager->m_resourceEditorWindowSize.x = x; + manager->m_resourceEditorWindowSize.y = y; + } + manager->SetEditorFrame(NULL); + manager->SetEditorToolBar(NULL); + + this->Destroy(); } /* - * Resource editor window that contains the dialog/panel being edited - */ +* Resource editor window that contains the dialog/panel being edited +*/ BEGIN_EVENT_TABLE(wxResourceEditorScrolledWindow, wxScrolledWindow) - EVT_PAINT(wxResourceEditorScrolledWindow::OnPaint) +EVT_PAINT(wxResourceEditorScrolledWindow::OnPaint) END_EVENT_TABLE() wxResourceEditorScrolledWindow::wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size, - long style): - wxScrolledWindow(parent, -1, pos, size, style) + long style): +wxScrolledWindow(parent, -1, pos, size, style) { m_marginX = 10; m_marginY = 40; m_childWindow = NULL; - + SetBackgroundColour(* wxWHITE); } @@ -2240,7 +2367,7 @@ wxResourceEditorScrolledWindow::~wxResourceEditorScrolledWindow() void wxResourceEditorScrolledWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); - + DrawTitle(dc); } @@ -2254,15 +2381,15 @@ void wxResourceEditorScrolledWindow::DrawTitle(wxDC& dc) wxString str(res->GetTitle()); int x, y; ViewStart(& x, & y); - + wxFont font(10, wxSWISS, wxNORMAL, wxBOLD); dc.SetFont(font); dc.SetBackgroundMode(wxTRANSPARENT); dc.SetTextForeground(wxColour(0, 0, 0)); - + long w, h; dc.GetTextExtent(str, & w, & h); - + dc.DrawText(str, m_marginX + (- x * 10), m_marginY + (- y * 10) - h - 5); } } @@ -2271,181 +2398,556 @@ void wxResourceEditorScrolledWindow::DrawTitle(wxDC& dc) // Popup menu callback void ObjectMenuProc(wxMenu *menu, wxCommandEvent& event) { - wxWindow *data = (wxWindow *)menu->GetClientData(); - if (!data) - return; - - switch (event.GetInt()) - { - case OBJECT_MENU_EDIT: + wxWindow *data = (wxWindow *)menu->GetClientData(); + if (!data) + return; + + switch (event.GetInt()) { - wxResourceManager::GetCurrentResourceManager()->EditWindow(data); - break; - } + case OBJECT_MENU_EDIT: + { + wxResourceManager::GetCurrentResourceManager()->EditWindow(data); + break; + } case OBJECT_MENU_DELETE: - { - wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(data); - - wxResourceManager::GetCurrentResourceManager()->SaveInfoAndDeleteHandler(data); - wxResourceManager::GetCurrentResourceManager()->DeleteResource(data); - wxResourceManager::GetCurrentResourceManager()->DeleteWindow(data); - break; - } + { + wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(data); + + wxResourceManager::GetCurrentResourceManager()->SaveInfoAndDeleteHandler(data); + wxResourceManager::GetCurrentResourceManager()->DeleteResource(data); + wxResourceManager::GetCurrentResourceManager()->DeleteWindow(data); + break; + } default: - break; - } + break; + } } /* - * Main toolbar - * - */ +* Main toolbar +* +*/ BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar) // EVT_PAINT(EditorToolBar::OnPaint) END_EVENT_TABLE() EditorToolBar::EditorToolBar(wxFrame *frame, const wxPoint& pos, const wxSize& size, - long style): - wxToolBar(frame, -1, pos, size, style) + long style): +wxToolBar(frame, -1, pos, size, style) { } bool EditorToolBar::OnLeftClick(int toolIndex, bool WXUNUSED(toggled)) { - wxResourceManager *manager = wxResourceManager::GetCurrentResourceManager(); - - switch (toolIndex) - { - case TOOLBAR_LOAD_FILE: + wxResourceManager *manager = wxResourceManager::GetCurrentResourceManager(); + + switch (toolIndex) { - manager->New(TRUE); - break; - } + case TOOLBAR_LOAD_FILE: + { + manager->New(TRUE); + break; + } case TOOLBAR_NEW: - { - manager->CreateNewPanel(); - break; - } + { + manager->CreateNewPanel(); + break; + } case TOOLBAR_SAVE_FILE: - { - manager->Save(); - break; - } + { + manager->Save(); + break; + } case TOOLBAR_HELP: - { + { #ifdef __WXMSW__ - wxBeginBusyCursor(); - manager->GetHelpController()->LoadFile(); - manager->GetHelpController()->DisplayContents(); - wxEndBusyCursor(); + wxBeginBusyCursor(); + manager->GetHelpController()->DisplayContents(); + wxEndBusyCursor(); #endif - break; - } + break; + } case TOOLBAR_FORMAT_HORIZ: - { - manager->AlignItems(TOOLBAR_FORMAT_HORIZ); - break; - } + { + manager->AlignItems(TOOLBAR_FORMAT_HORIZ); + break; + } case TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN: - { - manager->AlignItems(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN); - break; - } + { + manager->AlignItems(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN); + break; + } case TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN: - { - manager->AlignItems(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN); - break; - } + { + manager->AlignItems(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN); + break; + } case TOOLBAR_FORMAT_VERT: - { - manager->AlignItems(TOOLBAR_FORMAT_VERT); - break; - } + { + manager->AlignItems(TOOLBAR_FORMAT_VERT); + break; + } case TOOLBAR_FORMAT_VERT_TOP_ALIGN: - { - manager->AlignItems(TOOLBAR_FORMAT_VERT_TOP_ALIGN); - break; - } + { + manager->AlignItems(TOOLBAR_FORMAT_VERT_TOP_ALIGN); + break; + } case TOOLBAR_FORMAT_VERT_BOT_ALIGN: - { - manager->AlignItems(TOOLBAR_FORMAT_VERT_BOT_ALIGN); - break; - } + { + manager->AlignItems(TOOLBAR_FORMAT_VERT_BOT_ALIGN); + break; + } case TOOLBAR_COPY_SIZE: - { - manager->CopySize(); - break; - } + { + manager->CopySize(TOOLBAR_COPY_SIZE); + break; + } + case TOOLBAR_COPY_WIDTH: + { + manager->CopySize(TOOLBAR_COPY_WIDTH); + break; + } + case TOOLBAR_COPY_HEIGHT: + { + manager->CopySize(TOOLBAR_COPY_HEIGHT); + break; + } + case TOOLBAR_DISTRIBUTE_HORIZ: + { + manager->DistributePositions(TOOLBAR_DISTRIBUTE_HORIZ); + break; + } + case TOOLBAR_DISTRIBUTE_VERT: + { + manager->DistributePositions(TOOLBAR_DISTRIBUTE_VERT); + break; + } case TOOLBAR_TO_BACK: - { - manager->ToBackOrFront(TRUE); - break; - } + { + manager->ToBackOrFront(TRUE); + break; + } case TOOLBAR_TO_FRONT: - { - manager->ToBackOrFront(FALSE); - break; - } + { + manager->ToBackOrFront(FALSE); + break; + } default: - break; - } - return TRUE; + break; + } + return TRUE; } void EditorToolBar::OnMouseEnter(int toolIndex) { - wxFrame *frame = (wxFrame *)GetParent(); - - if (!frame) return; - - if (toolIndex > -1) - { - switch (toolIndex) - { + wxFrame *frame = (wxFrame *)GetParent(); + + if (!frame) return; + + if (toolIndex > -1) + { + switch (toolIndex) + { case TOOLBAR_LOAD_FILE: - frame->SetStatusText("Load project file"); - break; + frame->SetStatusText("Load project file"); + break; case TOOLBAR_SAVE_FILE: - frame->SetStatusText("Save project file"); - break; + frame->SetStatusText("Save project file"); + break; case TOOLBAR_NEW: - frame->SetStatusText("Create a new resource"); - break; + frame->SetStatusText("Create a new resource"); + break; case TOOLBAR_FORMAT_HORIZ: - frame->SetStatusText("Align items horizontally"); - break; + frame->SetStatusText("Align items horizontally"); + break; case TOOLBAR_FORMAT_VERT: - frame->SetStatusText("Align items vertically"); - break; + frame->SetStatusText("Align items vertically"); + break; case TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN: - frame->SetStatusText("Left-align items"); - break; + frame->SetStatusText("Left-align items"); + break; case TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN: - frame->SetStatusText("Right-align items"); - break; + frame->SetStatusText("Right-align items"); + break; case TOOLBAR_FORMAT_VERT_TOP_ALIGN: - frame->SetStatusText("Top-align items"); - break; + frame->SetStatusText("Top-align items"); + break; case TOOLBAR_FORMAT_VERT_BOT_ALIGN: - frame->SetStatusText("Bottom-align items"); - break; + frame->SetStatusText("Bottom-align items"); + break; case TOOLBAR_COPY_SIZE: - frame->SetStatusText("Copy size from first selection"); - break; + frame->SetStatusText("Copy size from first selection"); + break; case TOOLBAR_TO_FRONT: - frame->SetStatusText("Put image to front"); - break; + frame->SetStatusText("Put image to front"); + break; case TOOLBAR_TO_BACK: - frame->SetStatusText("Put image to back"); - break; + frame->SetStatusText("Put image to back"); + break; case TOOLBAR_HELP: - frame->SetStatusText("Display help contents"); - break; + frame->SetStatusText("Display help contents"); + break; default: - break; - } - } - else frame->SetStatusText(""); + break; + } + } + else frame->SetStatusText(""); } +bool ResourceEditorDialogTester::ProcessEvent(wxEvent& event) +{ + if (event.IsCommandEvent() && event.GetId() != wxID_OK && event.GetId() != wxID_CANCEL) + { + // Do nothing + return TRUE; + } + else + return wxDialog::ProcessEvent(event); +} + +static int gs_LabelInsertionCount = 0; + +// Convert old WXRs to new +bool wxResourceManager::ConvertWXRs() +{ + gs_LabelInsertionCount = 0; + m_symbolIdCounter = 20000; + + wxString currentPath = wxGetCwd(); + wxString oldWXRPath, newWXRPath; + + wxDirDialog dialog(NULL, wxT("Choose directory for old WXRs"), currentPath); + + if (dialog.ShowModal() == wxID_OK) + { + oldWXRPath = dialog.GetPath(); + } + else + return FALSE; + + wxDirDialog dialog2(NULL, wxT("Choose directory for new WXRs"), oldWXRPath); + + if (dialog2.ShowModal() == wxID_OK) + { + newWXRPath = dialog2.GetPath(); + } + else + return FALSE; + + if (newWXRPath == oldWXRPath) + { + wxMessageBox(wxT("Sorry, the directories must be different.")); + return FALSE; + } + + wxDir dir(oldWXRPath); + if (!dir.IsOpened()) + return FALSE; + + wxArrayString stringArray; + + wxString filename; + bool ok = dir.GetFirst(& filename, wxT("*.wxr")); + while (ok) + { + stringArray.Add(filename); + + ok = dir.GetNext(& filename); + } + + // Pop up a progress dialog + wxProgressDialog progressDialog(wxT("Converting WXR files"), wxT("Converting files...")); + + size_t i; + for (i = 0; i < stringArray.Count(); i++) + { + progressDialog.Update((int) (100.0 * ((double) i / (double) stringArray.Count()))); + + filename = stringArray[i]; + wxString oldPath = oldWXRPath + wxString(wxFILE_SEP_PATH) + filename; + wxString newPath = newWXRPath + wxString(wxFILE_SEP_PATH) + filename; + + DoConvertWXR(oldPath, newPath); + } + + wxString msg; + msg.Printf(wxT("Dialog Editor inserted %d labels."), gs_LabelInsertionCount); + wxMessageBox(msg); + + return TRUE; +} + +bool wxResourceManager::DoConvertWXR(const wxString& oldPath, const wxString& newPath) +{ + + if (!Clear(TRUE, FALSE)) + return FALSE; + + m_symbolTable.AddStandardSymbols(); + + if (!m_resourceTable.ParseResourceFile(oldPath)) + { + wxString msg; + msg.Printf(wxT("Could not read file %s"), (const char*) oldPath); + wxMessageBox(msg, "Resource file load error", wxOK | wxICON_EXCLAMATION); + return FALSE; + } + m_currentFilename = oldPath; + + //SetFrameTitle(m_currentFilename); + + //UpdateResourceList(); + + // Construct include filename from this file + m_symbolFilename = m_currentFilename; + + wxStripExtension(m_symbolFilename); + m_symbolFilename += wxT(".h"); + + if (!m_symbolTable.ReadIncludeFile(m_symbolFilename)) + { + } + else + { + // Set the id counter to the last known id + m_symbolIdCounter = m_symbolTable.FindHighestId(); + } + + // Now check in case some (or all) resources don't have resource ids, or they + // don't match the .h file, or something of that nature. + bool altered = RepairResourceIds(); + + // Do any necessary changes to the resources + m_resourceTable.BeginFind(); + wxNode *node; + while ((node = m_resourceTable.Next())) + { + wxItemResource *res = (wxItemResource *)node->Data(); + ChangeOldToNewResource(NULL, res); + } + + // Change the filename before saving + + m_currentFilename = newPath; + m_symbolFilename = m_currentFilename; + wxStripExtension(m_symbolFilename); + m_symbolFilename += wxT(".h"); + + Modify(TRUE); + + Save(); + + Clear(TRUE, TRUE); + + return TRUE; + +} + +bool wxResourceManager::ChangeOldToNewResource(wxItemResource* parent, wxItemResource* res) +{ + // Change these according to your needs + + // Change all fonts to use system defaults for fonts, colours etc. + static bool s_useSystemDefaultsAlways = FALSE; // TRUE; + + // Increase dialog height by this amount (wxWin 2 uses dialog client size now) + static int s_increaseDialogSize = -18; + + // How many points to decrease the font sizes by, since + // wxWin 2 fonts are larger in Windows + static int s_decreaseFontSize = 3; + + wxString itemType(res->GetType()); + + wxFont font = res->GetFont(); + + if ((s_decreaseFontSize) > 0 && font.Ok()) + { + wxFont newFont = wxFont(font.GetPointSize() - s_decreaseFontSize, + font.GetFamily(), font.GetStyle(), font.GetWeight(), + font.GetUnderlined(), font.GetFaceName()); + res->SetFont(newFont); + } + + if (itemType == wxT("wxDialogBox") || itemType == wxT("wxDialog") || itemType == wxT("wxPanel")) + { + if (itemType == wxT("wxDialogBox")) + res->SetType(wxT("wxDialog")); + + if (itemType == wxT("wxDialogBox") || itemType == wxT("wxDialog")) + { + // Only change the height if it has a caption, i.e. it's going to be + // used as a proper dialog and not a panel + if (res->GetStyle() & wxCAPTION) + res->SetSize(res->GetX(), res->GetY(), res->GetWidth(), res->GetHeight() + s_increaseDialogSize ); + } + + if (s_useSystemDefaultsAlways) + res->SetResourceStyle(res->GetResourceStyle() | wxRESOURCE_USE_DEFAULTS); + + if (res->GetValue1()) + res->SetStyle(res->GetStyle() | wxDIALOG_MODAL); + + wxNode *node = res->GetChildren().First(); + while (node) + { + wxItemResource *child = (wxItemResource *)node->Data(); + + ChangeOldToNewResource(res, child); + node = node->Next(); + } + } + else if (itemType == wxT("wxMessage")) + { + // Figure out if this is a bitmap or text message + if (res->GetValue4().IsEmpty()) + res->SetType(wxT("wxStaticText")); + else + res->SetType(wxT("wxStaticBitmap")); + } + else if (itemType == wxT("wxButton")) + { + // Figure out if this is a bitmap or text message + if (res->GetValue4().IsEmpty()) + { + } + else + res->SetType(wxT("wxBitmapButton")); + } + else if (itemType == wxT("wxGroupBox")) + { + res->SetType(wxT("wxStaticBox")); + } + else if (itemType == wxT("wxText")) + { + res->SetType(wxT("wxTextCtrl")); + } + else if (itemType == wxT("wxMultiText")) + { + res->SetType(wxT("wxTextCtrl")); + res->SetStyle(res->GetStyle() | wxTE_MULTILINE); + } + + itemType = res->GetType(); + + if (!res->GetTitle().IsEmpty() && + (itemType == wxT("wxTextCtrl") || itemType == wxT("wxChoice") || + itemType == wxT("wxComboBox") || itemType == wxT("wxGauge") || + itemType == wxT("wxListBox"))) + { + // Insert a label control resource, adjusting the size of this + // resource accordingly. + InsertLabelResource(parent, res); + } + + return TRUE; +} + +// Insert a label control resource, adjusting the size of this +// resource accordingly. +bool wxResourceManager::InsertLabelResource(wxItemResource* parent, wxItemResource* res) +{ + gs_LabelInsertionCount ++; + + bool isHorizontal = TRUE; + + // Determine panel orientation + if (parent->GetResourceStyle() & wxRESOURCE_VERTICAL_LABEL) + { + isHorizontal = FALSE; + } + else if (parent->GetResourceStyle() & wxRESOURCE_HORIZONTAL_LABEL) + { + isHorizontal = TRUE; + } + + // Now override + if (res->GetResourceStyle() & wxRESOURCE_VERTICAL_LABEL) + { + isHorizontal = FALSE; + } + else if (res->GetResourceStyle() & wxRESOURCE_HORIZONTAL_LABEL) + { + isHorizontal = TRUE; + } + + int x = res->GetX(); + int y = res->GetY(); + int width = res->GetWidth(); + int height = res->GetHeight(); + + // Find the font specified + wxFont font; + if (res->GetFont().Ok()) + font = res->GetFont(); + else + font = parent->GetFont(); + + if (!font.Ok() || (parent->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS)) + font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT); + + int labelX, labelY; + wxCoord labelWidth, labelHeight; + wxScreenDC dc; + dc.SetFont(font); + dc.GetTextExtent(res->GetTitle(), & labelWidth, & labelHeight); + + // Vert/horizontal margin between controls + int margin = 3; + + labelX = x; + labelY = y; + //labelWidth += 1; + //labelHeight += 1; + + if (isHorizontal) + { + x += labelWidth + margin; + width -= (labelWidth + margin); + } + else + { + y += labelHeight + margin; + height -= (labelHeight + margin); + + // Fudge factors + if (res->GetType() == wxT("wxTextCtrl")) + { + height += 3; + } + else if (res->GetType() == wxT("wxChoice") || res->GetType() == wxT("wxComboBox")) + { + height -= 4; + } + } + + res->SetSize(x, y, width, height); + + wxItemResource* staticItem = new wxItemResource; + staticItem->SetSize(labelX, labelY, labelWidth, labelHeight); + staticItem->SetTitle(res->GetTitle()); + staticItem->SetFont(font); + staticItem->SetStyle(0); + staticItem->SetType(wxT("wxStaticText")); + + wxString newSymbolName; + int newId = GenerateWindowId(wxT("ID_STATICTEXT"), newSymbolName) ; + staticItem->SetId(newId); + + newSymbolName = res->GetName() + wxT("_Label"); + staticItem->SetName(newSymbolName); + m_symbolTable.AddSymbol(newSymbolName, newId); + + wxNode* node = parent->GetChildren().Member(res); + + wxASSERT( (node != NULL) ); + + parent->GetChildren().Insert(node, staticItem); + + // Remove the title from this resource since we've replaced it + // with a static text control + res->SetTitle(wxEmptyString); + + return TRUE; +} diff --git a/utils/dialoged/src/reseditr.h b/utils/dialoged/src/reseditr.h index 021b867195..89d108e1e0 100644 --- a/utils/dialoged/src/reseditr.h +++ b/utils/dialoged/src/reseditr.h @@ -12,7 +12,7 @@ #ifndef _RESEDITR_H_ #define _RESEDITR_H_ -#define wxDIALOG_EDITOR_VERSION 1.7 +#define wxDIALOG_EDITOR_VERSION 2.1 #ifdef __GNUG__ #pragma interface "reseditr.h" @@ -30,17 +30,18 @@ #include "symbtabl.h" #include "winstyle.h" -#define RESED_DELETE 1 -#define RESED_RECREATE 3 -#define RESED_CLEAR 4 -#define RESED_NEW_DIALOG 5 -#define RESED_NEW_PANEL 6 -#define RESED_TEST 10 +#define RESED_DELETE 301 +#define RESED_RECREATE 303 +#define RESED_CLEAR 304 +#define RESED_NEW_DIALOG 305 +#define RESED_NEW_PANEL 306 +#define RESED_TEST 310 +#define RESED_CONVERT_WXRS 311 // Convert old WXRs to new -#define RESED_CONTENTS 20 +#define RESED_CONTENTS 320 -#define IDC_TREECTRL 100 -#define IDC_LISTCTRL 101 +#define IDC_TREECTRL 500 +#define IDC_LISTCTRL 501 // For control list ('palette') #define RESED_POINTER 0 @@ -65,8 +66,8 @@ #define RESED_SPINBUTTON 19 /* - * Controls loading, saving, user interface of resource editor(s). - */ +* Controls loading, saving, user interface of resource editor(s). +*/ class wxResourceEditorFrame; class EditorToolBar; @@ -83,373 +84,365 @@ class wxResourceEditorControlList; class wxHelpController; /* - * The resourceTable contains a list of wxItemResources (which each may - * have further children, defining e.g. a dialog box with controls). - * - * We need to associate actual windows with each wxItemResource, - * instead of the current 'one current window' scheme. - * - * - We create a new dialog, create a wxItemResource, - * associate the dialog with wxItemResource via a hash table. - * Must be a hash table in case dialog is deleted without - * telling the resource manager. - * - When we save the resource after editing/closing the dialog, - * we check the wxItemResource/wxDialog and children for - * consistency (throw away items no longer in the wxDialog, - * create any new wxItemResources). - * - We save the wxItemResources via the wxPropertyInfo classes, - * so devolve the code to the appropriate class. - * This involves creating a new temporary wxPropertyInfo for - * the purpose. - * - * We currently assume we only create one instance of a window for - * each wxItemResource. We will need to relax this when we're editing - * in situ. - * - * - */ - -class wxResourceTableWithSaving: public wxResourceTable -{ - public: - wxResourceTableWithSaving():wxResourceTable() - { - // Add all known window styles - m_styleTable.Init(); - } - virtual bool Save(const wxString& filename); - virtual bool SaveResource(wxTextOutputStream& stream, wxItemResource* item, wxItemResource* parentItem); - - void GeneratePanelStyleString(long windowStyle, char *buf); - void GenerateDialogStyleString(long windowStyle, char *buf); - -/* - void GenerateRadioBoxStyleString(long windowStyle, char *buf); - void GenerateMessageStyleString(long windowStyle, char *buf); - void GenerateTextStyleString(long windowStyle, char *buf); - void GenerateButtonStyleString(long windowStyle, char *buf); - void GenerateCheckBoxStyleString(long windowStyle, char *buf); - void GenerateRadioButtonStyleString(long windowStyle, char *buf); - void GenerateListBoxStyleString(long windowStyle, char *buf); - void GenerateSliderStyleString(long windowStyle, char *buf); - void GenerateGroupBoxStyleString(long windowStyle, char *buf); - void GenerateGaugeStyleString(long windowStyle, char *buf); - void GenerateChoiceStyleString(long windowStyle, char *buf); - void GenerateComboBoxStyleString(long windowStyle, char *buf); - void GenerateScrollBarStyleString(long windowStyle, char *buf); -*/ - - void GenerateControlStyleString(const wxString& windowClass, long windowStyle, char *buf); - -/* - bool GenerateStyle(char *buf, long windowStyle, long flag, char *strStyle); +* The resourceTable contains a list of wxItemResources (which each may +* have further children, defining e.g. a dialog box with controls). +* +* We need to associate actual windows with each wxItemResource, +* instead of the current 'one current window' scheme. +* +* - We create a new dialog, create a wxItemResource, +* associate the dialog with wxItemResource via a hash table. +* Must be a hash table in case dialog is deleted without +* telling the resource manager. +* - When we save the resource after editing/closing the dialog, +* we check the wxItemResource/wxDialog and children for +* consistency (throw away items no longer in the wxDialog, +* create any new wxItemResources). +* - We save the wxItemResources via the wxPropertyInfo classes, +* so devolve the code to the appropriate class. +* This involves creating a new temporary wxPropertyInfo for +* the purpose. +* +* We currently assume we only create one instance of a window for +* each wxItemResource. We will need to relax this when we're editing +* in situ. +* +* */ - void OutputFont(wxTextOutputStream& stream, const wxFont& font); - wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource); - +class wxResourceTableWithSaving: public wxResourceTable +{ +public: + wxResourceTableWithSaving():wxResourceTable() + { + // Add all known window styles + m_styleTable.Init(); + } + virtual bool Save(const wxString& filename); + virtual bool SaveResource(wxTextOutputStream& stream, wxItemResource* item, wxItemResource* parentItem); + + void GeneratePanelStyleString(long windowStyle, char *buf); + void GenerateDialogStyleString(long windowStyle, char *buf); + + void GenerateControlStyleString(const wxString& windowClass, long windowStyle, char *buf); + + void OutputFont(wxTextOutputStream& stream, const wxFont& font); + wxControl *CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource); + protected: - wxWindowStyleTable m_styleTable; + wxWindowStyleTable m_styleTable; }; - + class wxResourceEditorScrolledWindow; class wxResourceManager: public wxObject { - friend class wxResourceEditorFrame; - + friend class wxResourceEditorFrame; + public: - wxResourceManager(); - ~wxResourceManager(); - -// Operations - - // Initializes the resource manager - bool Initialize(); - - // Load/save window size etc. - bool LoadOptions(); - bool SaveOptions(); - - // Show or hide the resource editor frame, which displays a list - // of resources with ability to edit them. - virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor"); - - virtual bool Save(); - virtual bool SaveAs(); - virtual bool Save(const wxString& filename); - virtual bool Load(const wxString& filename); - virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE); - virtual void SetFrameTitle(const wxString& filename); - virtual void ClearCurrentDialog(); - virtual bool New(bool loadFromFile = TRUE, const wxString& filename = ""); - virtual bool SaveIfModified(); - virtual void AlignItems(int flag); - virtual void CopySize(); - virtual void ToBackOrFront(bool toBack); - virtual wxWindow *FindParentOfSelection(); - - virtual wxFrame *OnCreateEditorFrame(const char *title); - virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent); - virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent); - virtual wxToolBar *OnCreateToolBar(wxFrame *parent); - - // Create a window information object for the give window - wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win); - // Edit the given window - void EditWindow(wxWindow *win); - - virtual void UpdateResourceList(); - virtual void AddItemsRecursively(long parent, wxItemResource *resource); - virtual bool EditSelectedResource(); - virtual bool Edit(wxItemResource *res); - virtual bool CreateNewPanel(); - virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE); - virtual bool DeleteSelection(); - virtual bool TestCurrentDialog(wxWindow* parent); - - // Saves the window info into the resource, and deletes the - // handler. Doesn't actually disassociate the window from - // the resources. Replaces OnClose. - virtual bool SaveInfoAndDeleteHandler(wxWindow* win); - - // Destroys the window. If this is the 'current' panel, NULLs the - // variable. - virtual bool DeleteWindow(wxWindow* win); - virtual bool DeleteResource(wxItemResource *res); - virtual bool DeleteResource(wxWindow *win); - - // Add bitmap resource if there isn't already one with this filename. - virtual wxString AddBitmapResource(const wxString& filename); - - // Delete the bitmap resource if it isn't being used by another resource. - virtual void PossiblyDeleteBitmapResource(const wxString& resourceName); - - // Helper function for above - virtual bool IsBitmapResourceUsed(const wxString& resourceName); - - wxItemResource *FindBitmapResourceByFilename(const wxString& filename); - - wxString FindBitmapFilenameForResource(wxItemResource *resource); - - // Is this window identifier in use? - bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ; - - // Is this window identifier compatible with the given name? (i.e. - // does it already exist under a different name) - bool IsIdentifierOK(const wxString& name, wxWindowID id); - - // Change all integer ids that match oldId, to newId. - // This is necessary if an id is changed for one resource - all resources - // must be changed. - void ChangeIds(int oldId, int newId); - - // If any resource ids were missing (or their symbol was missing), - // repair them i.e. give them new ids. Returns TRUE if any resource - // needed repairing. - bool RepairResourceIds(); - - // Deletes 'win' and creates a new window from the resource that - // was associated with it. E.g. if you can't change properties on the - // fly, you'll need to delete the window and create it again. - virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL, bool instantiateFirst = TRUE); - - virtual bool RecreateSelection(); - - // Remove selection handles if this control is selected - void DeselectItemIfNecessary(wxWindow *win); - - // Need to search through resource table removing this from - // any resource which has this as a parent. - virtual bool RemoveResourceFromParent(wxItemResource *res); - - virtual bool EditDialog(wxDialog *dialog, wxWindow *parent); - - void AddSelection(wxWindow *win); - void RemoveSelection(wxWindow *win); - - virtual void MakeUniqueName(char *prefix, char *buf); - - // (Dis)associate resource<->physical window - // Doesn't delete any windows. - virtual void AssociateResource(wxItemResource *resource, wxWindow *win); - virtual bool DisassociateResource(wxItemResource *resource); - virtual bool DisassociateResource(wxWindow *win); - virtual bool DisassociateWindows(); - virtual wxItemResource *FindResourceForWindow(wxWindow *win); - virtual wxWindow *FindWindowForResource(wxItemResource *resource); - - virtual bool InstantiateAllResourcesFromWindows(); - virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE); - -// Accessors - inline void SetEditorFrame(wxFrame *fr) { m_editorFrame = fr; } - inline void SetEditorToolBar(EditorToolBar *tb) { m_editorToolBar = tb; } - inline wxFrame *GetEditorFrame() const { return m_editorFrame; } - inline wxResourceEditorProjectTree *GetEditorResourceTree() const { return m_editorResourceTree; } - inline wxResourceEditorControlList *GetEditorControlList() const { return m_editorControlList; } - inline wxList& GetSelections() { return m_selections; } - inline wxMenu *GetPopupMenu() const { return m_popupMenu; } + wxResourceManager(); + ~wxResourceManager(); + + // Operations + + // Initializes the resource manager + bool Initialize(); + + // Load/save window size etc. + bool LoadOptions(); + bool SaveOptions(); + + // Show or hide the resource editor frame, which displays a list + // of resources with ability to edit them. + virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor"); + + // Convert old WXRs to new + virtual bool ConvertWXRs(); + bool DoConvertWXR(const wxString& oldPath, const wxString& newPath); + bool ChangeOldToNewResource(wxItemResource* parent, wxItemResource* res); + bool InsertLabelResource(wxItemResource* parent, wxItemResource* res); + + virtual bool Save(); + virtual bool SaveAs(); + virtual bool Save(const wxString& filename); + virtual bool Load(const wxString& filename); + virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE); + virtual void SetFrameTitle(const wxString& filename); + virtual void ClearCurrentDialog(); + virtual bool New(bool loadFromFile = TRUE, const wxString& filename = ""); + virtual bool SaveIfModified(); + virtual void AlignItems(int flag); + virtual void CopySize(int command); // Copy width, height or both from first control + virtual void ToBackOrFront(bool toBack); + virtual void DistributePositions(int command); // Distribute controls evenly between first and last + virtual wxWindow *FindParentOfSelection(); + + virtual wxFrame *OnCreateEditorFrame(const char *title); + virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent); + virtual wxResourceEditorScrolledWindow *OnCreateEditorPanel(wxFrame *parent); + virtual wxToolBar *OnCreateToolBar(wxFrame *parent); + + // Create a window information object for the give window + wxWindowPropertyInfo* CreatePropertyInfoForWindow(wxWindow *win); + // Edit the given window + void EditWindow(wxWindow *win); + + virtual void UpdateResourceList(); + virtual void AddItemsRecursively(long parent, wxItemResource *resource); + virtual bool EditSelectedResource(); + virtual bool Edit(wxItemResource *res); + virtual bool CreateNewPanel(); + virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE); + virtual bool DeleteSelection(); + virtual bool TestCurrentDialog(wxWindow* parent); + + // Saves the window info into the resource, and deletes the + // handler. Doesn't actually disassociate the window from + // the resources. Replaces OnClose. + virtual bool SaveInfoAndDeleteHandler(wxWindow* win); + + // Destroys the window. If this is the 'current' panel, NULLs the + // variable. + virtual bool DeleteWindow(wxWindow* win); + virtual bool DeleteResource(wxItemResource *res); + virtual bool DeleteResource(wxWindow *win); + + // Add bitmap resource if there isn't already one with this filename. + virtual wxString AddBitmapResource(const wxString& filename); + + // Delete the bitmap resource if it isn't being used by another resource. + virtual void PossiblyDeleteBitmapResource(const wxString& resourceName); + + // Helper function for above + virtual bool IsBitmapResourceUsed(const wxString& resourceName); + + wxItemResource *FindBitmapResourceByFilename(const wxString& filename); + + wxString FindBitmapFilenameForResource(wxItemResource *resource); + + // Is this window identifier in use? + bool IsSymbolUsed(wxItemResource* thisResource, wxWindowID id) ; + + // Is this window identifier compatible with the given name? (i.e. + // does it already exist under a different name) + bool IsIdentifierOK(const wxString& name, wxWindowID id); + + // Change all integer ids that match oldId, to newId. + // This is necessary if an id is changed for one resource - all resources + // must be changed. + void ChangeIds(int oldId, int newId); + + // If any resource ids were missing (or their symbol was missing), + // repair them i.e. give them new ids. Returns TRUE if any resource + // needed repairing. + bool RepairResourceIds(); + + // Deletes 'win' and creates a new window from the resource that + // was associated with it. E.g. if you can't change properties on the + // fly, you'll need to delete the window and create it again. + virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL, bool instantiateFirst = TRUE); + + virtual bool RecreateSelection(); + + // Remove selection handles if this control is selected + void DeselectItemIfNecessary(wxWindow *win); + + // Need to search through resource table removing this from + // any resource which has this as a parent. + virtual bool RemoveResourceFromParent(wxItemResource *res); + + virtual bool EditDialog(wxDialog *dialog, wxWindow *parent); + + void AddSelection(wxWindow *win); + void RemoveSelection(wxWindow *win); + + virtual void MakeUniqueName(char *prefix, char *buf); + + // (Dis)associate resource<->physical window + // Doesn't delete any windows. + virtual void AssociateResource(wxItemResource *resource, wxWindow *win); + virtual bool DisassociateResource(wxItemResource *resource); + virtual bool DisassociateResource(wxWindow *win); + virtual bool DisassociateWindows(); + virtual wxItemResource *FindResourceForWindow(wxWindow *win); + virtual wxWindow *FindWindowForResource(wxItemResource *resource); + + virtual bool InstantiateAllResourcesFromWindows(); + virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE); + + // Accessors + inline void SetEditorFrame(wxFrame *fr) { m_editorFrame = fr; } + inline void SetEditorToolBar(EditorToolBar *tb) { m_editorToolBar = tb; } + inline wxFrame *GetEditorFrame() const { return m_editorFrame; } + inline wxResourceEditorProjectTree *GetEditorResourceTree() const { return m_editorResourceTree; } + inline wxResourceEditorControlList *GetEditorControlList() const { return m_editorControlList; } + inline wxList& GetSelections() { return m_selections; } + inline wxMenu *GetPopupMenu() const { return m_popupMenu; } #ifdef __WXMSW__ - inline wxHelpController *GetHelpController() const { return m_helpController; } + inline wxHelpController *GetHelpController() const { return m_helpController; } #endif - - inline void Modify(bool mod = TRUE) { m_modified = mod; } - inline bool Modified() const { return m_modified; } - - inline wxResourceTable& GetResourceTable() { return m_resourceTable; } - inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; } - - inline wxString GetCurrentFilename() const { return m_currentFilename; } - static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; } - - inline void SetSymbolFilename(const wxString& s) { m_symbolFilename = s; } - inline wxString GetSymbolFilename() const { return m_symbolFilename; } - - inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; } - inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; } - - wxResourceSymbolTable& GetSymbolTable() { return m_symbolTable; } - - // Generate a window id and a first stab at a name - int GenerateWindowId(const wxString& prefix, wxString& idName) ; - -// Member variables + + inline void Modify(bool mod = TRUE) { m_modified = mod; } + inline bool Modified() const { return m_modified; } + + inline wxResourceTable& GetResourceTable() { return m_resourceTable; } + inline wxHashTable& GetResourceAssociations() { return m_resourceAssociations; } + + inline wxString GetCurrentFilename() const { return m_currentFilename; } + static wxResourceManager* GetCurrentResourceManager() { return sm_currentResourceManager; } + + inline void SetSymbolFilename(const wxString& s) { m_symbolFilename = s; } + inline wxString GetSymbolFilename() const { return m_symbolFilename; } + + inline wxRect& GetPropertyWindowSize() { return m_propertyWindowSize; } + inline wxRect& GetResourceEditorWindowSize() { return m_resourceEditorWindowSize; } + + wxResourceSymbolTable& GetSymbolTable() { return m_symbolTable; } + + // Generate a window id and a first stab at a name + int GenerateWindowId(const wxString& prefix, wxString& idName) ; + + // Member variables protected: #ifdef __WXMSW__ - wxHelpController* m_helpController; + wxHelpController* m_helpController; #endif - wxResourceTableWithSaving m_resourceTable; - wxFrame* m_editorFrame; - wxResourceEditorScrolledWindow* m_editorPanel; - wxMenu* m_popupMenu; - wxResourceEditorProjectTree* m_editorResourceTree; - wxResourceEditorControlList* m_editorControlList; - EditorToolBar* m_editorToolBar; - int m_nameCounter; - int m_symbolIdCounter; // For generating window ids - bool m_modified; - wxHashTable m_resourceAssociations; - wxList m_selections; - wxString m_currentFilename; - wxBitmap* m_bitmapImage; // Default for static bitmaps/buttons - - wxImageList m_imageList; - long m_rootDialogItem; // Root of dialog hierarchy in tree (unused) - - // Options to be saved/restored - wxString m_optionsResourceFilename; // e.g. dialoged.ini, .dialogrc - wxRect m_propertyWindowSize; - wxRect m_resourceEditorWindowSize; - static wxResourceManager* sm_currentResourceManager; - - // Symbol table with identifiers for controls - wxResourceSymbolTable m_symbolTable; - // Filename for include file, e.g. resource.h - wxString m_symbolFilename; + wxResourceTableWithSaving m_resourceTable; + wxFrame* m_editorFrame; + wxResourceEditorScrolledWindow* m_editorPanel; + wxMenu* m_popupMenu; + wxResourceEditorProjectTree* m_editorResourceTree; + wxResourceEditorControlList* m_editorControlList; + EditorToolBar* m_editorToolBar; + int m_nameCounter; + int m_symbolIdCounter; // For generating window ids + bool m_modified; + wxHashTable m_resourceAssociations; + wxList m_selections; + wxString m_currentFilename; + wxBitmap* m_bitmapImage; // Default for static bitmaps/buttons + + wxImageList m_imageList; + long m_rootDialogItem; // Root of dialog hierarchy in tree (unused) + + // Options to be saved/restored + wxString m_optionsResourceFilename; // e.g. dialoged.ini, .dialogrc + wxRect m_propertyWindowSize; + wxRect m_resourceEditorWindowSize; + static wxResourceManager* sm_currentResourceManager; + + // Symbol table with identifiers for controls + wxResourceSymbolTable m_symbolTable; + // Filename for include file, e.g. resource.h + wxString m_symbolFilename; }; class wxResourceEditorFrame: public wxFrame { - public: - DECLARE_CLASS(wxResourceEditorFrame) - - wxResourceManager *manager; - wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600, 400), - long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"); - ~wxResourceEditorFrame(); - - void OnCloseWindow(wxCloseEvent& event); - - void OnNew(wxCommandEvent& event); - void OnOpen(wxCommandEvent& event); - void OnNewDialog(wxCommandEvent& event); - void OnClear(wxCommandEvent& event); - void OnSave(wxCommandEvent& event); - void OnSaveAs(wxCommandEvent& event); - void OnExit(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - void OnContents(wxCommandEvent& event); - void OnDeleteSelection(wxCommandEvent& event); - void OnRecreateSelection(wxCommandEvent& event); - void OnTest(wxCommandEvent& event); - - DECLARE_EVENT_TABLE() +public: + DECLARE_CLASS(wxResourceEditorFrame) + + wxResourceManager *manager; + wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600, 400), + long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"); + ~wxResourceEditorFrame(); + + void OnCloseWindow(wxCloseEvent& event); + + void OnNew(wxCommandEvent& event); + void OnOpen(wxCommandEvent& event); + void OnNewDialog(wxCommandEvent& event); + void OnClear(wxCommandEvent& event); + void OnSave(wxCommandEvent& event); + void OnSaveAs(wxCommandEvent& event); + void OnExit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnContents(wxCommandEvent& event); + void OnDeleteSelection(wxCommandEvent& event); + void OnRecreateSelection(wxCommandEvent& event); + void OnTest(wxCommandEvent& event); + void OnConvertWXRs(wxCommandEvent& event); + + DECLARE_EVENT_TABLE() }; class wxResourceEditorScrolledWindow: public wxScrolledWindow { - public: - wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0); - ~wxResourceEditorScrolledWindow(); - - void OnPaint(wxPaintEvent& event); - - void DrawTitle(wxDC& dc); - -// Accessors - inline int GetMarginX() { return m_marginX; } - inline int GetMarginY() { return m_marginY; } - - public: - wxWindow* m_childWindow; - private: - int m_marginX, m_marginY; - - DECLARE_EVENT_TABLE() +public: + wxResourceEditorScrolledWindow(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0); + ~wxResourceEditorScrolledWindow(); + + void OnPaint(wxPaintEvent& event); + + void DrawTitle(wxDC& dc); + + // Accessors + inline int GetMarginX() { return m_marginX; } + inline int GetMarginY() { return m_marginY; } + +public: + wxWindow* m_childWindow; +private: + int m_marginX, m_marginY; + + DECLARE_EVENT_TABLE() }; #define OBJECT_MENU_EDIT 1 #define OBJECT_MENU_DELETE 2 /* - * Main toolbar - * - */ - +* Main toolbar +* +*/ + class EditorToolBar: public wxToolBar { public: - EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0), - long style = wxTB_HORIZONTAL); - bool OnLeftClick(int toolIndex, bool toggled); - void OnMouseEnter(int toolIndex); - -DECLARE_EVENT_TABLE() + EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0), + long style = wxTB_HORIZONTAL); + bool OnLeftClick(int toolIndex, bool toggled); + void OnMouseEnter(int toolIndex); + + DECLARE_EVENT_TABLE() }; // Toolbar ids -#define TOOLBAR_LOAD_FILE 1 -#define TOOLBAR_SAVE_FILE 2 -#define TOOLBAR_NEW 3 -#define TOOLBAR_TREE 5 -#define TOOLBAR_HELP 6 +#define TOOLBAR_LOAD_FILE 101 +#define TOOLBAR_SAVE_FILE 102 +#define TOOLBAR_NEW 103 +#define TOOLBAR_TREE 105 +#define TOOLBAR_HELP 106 // Formatting tools -#define TOOLBAR_FORMAT_HORIZ 10 -#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 11 -#define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 12 -#define TOOLBAR_FORMAT_VERT 13 -#define TOOLBAR_FORMAT_VERT_TOP_ALIGN 14 -#define TOOLBAR_FORMAT_VERT_BOT_ALIGN 15 - -#define TOOLBAR_TO_FRONT 16 -#define TOOLBAR_TO_BACK 17 -#define TOOLBAR_COPY_SIZE 18 +#define TOOLBAR_FORMAT_HORIZ 110 +#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 111 +#define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 112 +#define TOOLBAR_FORMAT_VERT 113 +#define TOOLBAR_FORMAT_VERT_TOP_ALIGN 114 +#define TOOLBAR_FORMAT_VERT_BOT_ALIGN 115 + +#define TOOLBAR_TO_FRONT 116 +#define TOOLBAR_TO_BACK 117 +#define TOOLBAR_COPY_SIZE 118 +#define TOOLBAR_COPY_WIDTH 119 +#define TOOLBAR_COPY_HEIGHT 120 +#define TOOLBAR_DISTRIBUTE_HORIZ 121 +#define TOOLBAR_DISTRIBUTE_VERT 122 /* - * this class is used to store data associated with a tree item - */ +* this class is used to store data associated with a tree item +*/ class wxResourceTreeData : public wxTreeItemData { public: wxResourceTreeData(wxItemResource *resource) { m_resource = resource; } - + wxItemResource *GetResource() const { return m_resource; } - + private: wxItemResource *m_resource; }; diff --git a/utils/dialoged/src/reswrite.cpp b/utils/dialoged/src/reswrite.cpp index 8ae04f8623..8e5588fe92 100644 --- a/utils/dialoged/src/reswrite.cpp +++ b/utils/dialoged/src/reswrite.cpp @@ -43,480 +43,480 @@ char *SafeWord(const wxString& s); // us not to require unique window names. wxControl *wxResourceTableWithSaving::CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource) { - wxControl *item = wxResourceTable::CreateItem(panel, childResource, parentResource); - if (item) - wxResourceManager::GetCurrentResourceManager()->GetResourceAssociations().Put((long)childResource, item); - return item; + wxControl *item = wxResourceTable::CreateItem(panel, childResource, parentResource); + if (item) + wxResourceManager::GetCurrentResourceManager()->GetResourceAssociations().Put((long)childResource, item); + return item; } void wxResourceTableWithSaving::OutputFont(wxTextOutputStream& stream, const wxFont& font) { - stream << "[" << font.GetPointSize() << ", '"; - stream << font.GetFamilyString() << "', '"; - stream << font.GetStyleString() << "', '"; - stream << font.GetWeightString() << "', "; - stream << (int)font.GetUnderlined(); - if (font.GetFaceName() != "") - stream << ", '" << font.GetFaceName() << "'"; - stream << "]"; + stream << "[" << font.GetPointSize() << ", '"; + stream << font.GetFamilyString() << "', '"; + stream << font.GetStyleString() << "', '"; + stream << font.GetWeightString() << "', "; + stream << (int)font.GetUnderlined(); + if (font.GetFaceName() != "") + stream << ", '" << font.GetFaceName() << "'"; + stream << "]"; } /* - * Resource table with saving (basic one only has loading) - */ - +* Resource table with saving (basic one only has loading) +*/ + bool wxResourceTableWithSaving::Save(const wxString& filename) { - wxFileOutputStream file_output( filename ); - if (file_output.LastError()) - return FALSE; - - wxTextOutputStream stream( file_output ); + wxFileOutputStream file_output( filename ); + if (file_output.LastError()) + return FALSE; - BeginFind(); - wxNode *node = NULL; - while ((node = Next())) - { - wxItemResource *item = (wxItemResource *)node->Data(); - wxString resType(item->GetType()); + wxTextOutputStream stream( file_output ); - if (resType == "wxDialogBox" || resType == "wxDialog" || resType == "wxPanel" || resType == "wxBitmap") + BeginFind(); + wxNode *node = NULL; + while ((node = Next())) { - if (!SaveResource(stream, item, (wxItemResource*) NULL)) - return FALSE; + wxItemResource *item = (wxItemResource *)node->Data(); + wxString resType(item->GetType()); + + if (resType == "wxDialogBox" || resType == "wxDialog" || resType == "wxPanel" || resType == "wxBitmap") + { + if (!SaveResource(stream, item, (wxItemResource*) NULL)) + return FALSE; + } } - } - return TRUE; + return TRUE; } bool wxResourceTableWithSaving::SaveResource(wxTextOutputStream& stream, wxItemResource* item, wxItemResource* parentItem) { - char styleBuf[400]; - wxString itemType(item->GetType()); - - if (itemType == "wxDialogBox" || itemType == "wxDialog" || itemType == "wxPanel") + char styleBuf[400]; + wxString itemType(item->GetType()); + + if (itemType == "wxDialogBox" || itemType == "wxDialog" || itemType == "wxPanel") { - if (itemType == "wxDialogBox" || itemType == "wxDialog") - { - stream << "static char *" << item->GetName() << " = \"dialog(name = '" << item->GetName() << "',\\\n"; - GenerateDialogStyleString(item->GetStyle(), styleBuf); - } - else - { - stream << "static char *" << item->GetName() << " = \"panel(name = '" << item->GetName() << "',\\\n"; - GenerateDialogStyleString(item->GetStyle(), styleBuf); - } - - stream << " style = '" << styleBuf << "',\\\n"; - stream << " title = " << SafeWord(item->GetTitle()) << ",\\\n"; - stream << " id = " << item->GetId() << ",\\\n"; - stream << " x = " << item->GetX() << ", y = " << item->GetY(); - stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight(); - - if (1) // item->GetStyle() & wxNO_3D) - { - if (item->GetBackgroundColour().Ok()) + if (itemType == "wxDialogBox" || itemType == "wxDialog") { - char buf[7]; - wxDecToHex(item->GetBackgroundColour().Red(), buf); - wxDecToHex(item->GetBackgroundColour().Green(), buf+2); - wxDecToHex(item->GetBackgroundColour().Blue(), buf+4); - buf[6] = 0; - - stream << ",\\\n " << "background_colour = '" << buf << "'"; + stream << "static char *" << item->GetName() << " = \"dialog(name = '" << item->GetName() << "',\\\n"; + GenerateDialogStyleString(item->GetStyle(), styleBuf); + } + else + { + stream << "static char *" << item->GetName() << " = \"panel(name = '" << item->GetName() << "',\\\n"; + GenerateDialogStyleString(item->GetStyle(), styleBuf); } - } - - int dialogUnits = 0; - int useDefaults = 0; - if ((item->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) - dialogUnits = 1; - if ((item->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) - useDefaults = 1; - - stream << ",\\\n " << "use_dialog_units = " << dialogUnits; - stream << ",\\\n " << "use_system_defaults = " << useDefaults; - - if (item->GetFont().Ok()) - { - stream << ",\\\n font = "; - OutputFont(stream, item->GetFont()); - } - - if (item->GetChildren().Number() > 0) - stream << ",\\\n"; - else - stream << "\\\n"; - wxNode *node = item->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - stream << " control = ["; + stream << " style = '" << styleBuf << "',\\\n"; + stream << " title = " << SafeWord(item->GetTitle()) << ",\\\n"; + stream << " id = " << item->GetId() << ",\\\n"; + stream << " x = " << item->GetX() << ", y = " << item->GetY(); + stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight(); - SaveResource(stream, child, item); - - stream << "]"; - - if (node->Next()) - stream << ",\\\n"; - node = node->Next(); - } - stream << ").\";\n\n"; + if (1) // item->GetStyle() & wxNO_3D) + { + if (item->GetBackgroundColour().Ok()) + { + char buf[7]; + wxDecToHex(item->GetBackgroundColour().Red(), buf); + wxDecToHex(item->GetBackgroundColour().Green(), buf+2); + wxDecToHex(item->GetBackgroundColour().Blue(), buf+4); + buf[6] = 0; + + stream << ",\\\n " << "background_colour = '" << buf << "'"; + } + } + + int dialogUnits = 0; + int useDefaults = 0; + if ((item->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) + dialogUnits = 1; + if ((item->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) + useDefaults = 1; + + stream << ",\\\n " << "use_dialog_units = " << dialogUnits; + stream << ",\\\n " << "use_system_defaults = " << useDefaults; + + if (item->GetFont().Ok()) + { + stream << ",\\\n font = "; + OutputFont(stream, item->GetFont()); + } + + if (item->GetChildren().Number() > 0) + stream << ",\\\n"; + else + stream << "\\\n"; + wxNode *node = item->GetChildren().First(); + while (node) + { + wxItemResource *child = (wxItemResource *)node->Data(); + + stream << " control = ["; + + SaveResource(stream, child, item); + + stream << "]"; + + if (node->Next()) + stream << ",\\\n"; + node = node->Next(); + } + stream << ").\";\n\n"; } - else if (itemType == "wxButton" || itemType == "wxBitmapButton") + else if (itemType == "wxButton" || itemType == "wxBitmapButton") { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - if (item->GetValue4()) - stream << ", '" << item->GetValue4() << "'"; - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + if (item->GetValue4()) + stream << ", '" << item->GetValue4() << "'"; + if (item->GetFont().Ok()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } } - else if (itemType == "wxStaticText" || itemType == "wxStaticBitmap") + else if (itemType == "wxStaticText" || itemType == "wxStaticBitmap") { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - if (item->GetValue4()) - stream << ", '" << item->GetValue4() << "'"; - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + if (item->GetValue4()) + stream << ", '" << item->GetValue4() << "'"; + if (item->GetFont().Ok()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } } - else if (itemType == "wxCheckBox") + else if (itemType == "wxCheckBox") { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << "wxCheckBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - stream << ", " << item->GetValue1(); - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxCheckBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << item->GetValue1(); + if (item->GetFont().Ok()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } } - else if (itemType == "wxRadioButton") + else if (itemType == "wxRadioButton") { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << "wxRadioButton, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - stream << ", " << item->GetValue1(); - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxRadioButton, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << item->GetValue1(); + if (item->GetFont().Ok()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } } - else if (itemType == "wxStaticBox") + else if (itemType == "wxStaticBox") { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << "wxStaticBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxStaticBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + if (item->GetFont().Ok()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } } - else if (itemType == "wxText" || itemType == "wxMultiText" || itemType == "wxTextCtrl") + else if (itemType == "wxText" || itemType == "wxMultiText" || itemType == "wxTextCtrl") { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << "wxTextCtrl, "; - stream << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - stream << ", " << SafeWord(item->GetValue4()); - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxTextCtrl, "; + stream << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << SafeWord(item->GetValue4()); + if (item->GetFont().Ok()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } } - else if (itemType == "wxGauge") + else if (itemType == "wxGauge") { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << "wxGauge, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - stream << ", " << item->GetValue1() << ", " << item->GetValue2(); - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxGauge, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << item->GetValue1() << ", " << item->GetValue2(); + if (item->GetFont().Ok()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } } - else if (itemType == "wxSlider") + else if (itemType == "wxSlider") { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << "wxSlider, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3(); - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxSlider, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3(); + if (item->GetFont().Ok()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } } - else if (itemType == "wxScrollBar") + else if (itemType == "wxScrollBar") { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << "wxScrollBar, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3() << ", "; - stream << item->GetValue5(); + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxScrollBar, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3() << ", "; + stream << item->GetValue5(); } - else if (itemType == "wxListBox") + else if (itemType == "wxListBox") { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << "wxListBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - - // Default list of values - - stream << ", ["; - if (item->GetStringValues().Number() > 0) - { - wxNode *node = item->GetStringValues().First(); - while (node) + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxListBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + + // Default list of values + + stream << ", ["; + if (item->GetStringValues().Number() > 0) { - char *s = (char *)node->Data(); - stream << SafeWord(s); - if (node->Next()) - stream << ", "; - node = node->Next(); + wxNode *node = item->GetStringValues().First(); + while (node) + { + char *s = (char *)node->Data(); + stream << SafeWord(s); + if (node->Next()) + stream << ", "; + node = node->Next(); + } } - } - stream << "]"; -/* Styles are now in the window style, not in a separate arg - stream << ", "; - switch (item->GetValue1()) - { + stream << "]"; + /* Styles are now in the window style, not in a separate arg + stream << ", "; + switch (item->GetValue1()) + { case wxLB_MULTIPLE: { - stream << "'wxLB_MULTIPLE'"; - break; + stream << "'wxLB_MULTIPLE'"; + break; } case wxLB_EXTENDED: { - stream << "'wxLB_EXTENDED'"; - break; + stream << "'wxLB_EXTENDED'"; + break; } case wxLB_SINGLE: default: { - stream << "'wxLB_SINGLE'"; - break; + stream << "'wxLB_SINGLE'"; + break; } - } - */ - - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } - } - else if (itemType == "wxChoice" || itemType == "wxComboBox") - { - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - - stream << item->GetId() << ", " << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - - if (itemType == "wxComboBox") - stream << ", " << SafeWord(item->GetValue4()); - - // Default list of values - - stream << ", ["; - if (item->GetStringValues().Number() > 0) - { - wxNode *node = item->GetStringValues().First(); - while (node) + } + */ + + if (item->GetFont().Ok()) { - char *s = (char *)node->Data(); - stream << SafeWord(s); - if (node->Next()) - stream << ", "; - node = node->Next(); + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); } - } - stream << "]"; - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } } - else if (itemType == "wxRadioBox") + else if (itemType == "wxChoice" || itemType == "wxComboBox") { - // Must write out the orientation and number of rows/cols!! - GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); - stream << item->GetId() << ", " << "wxRadioBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; - stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; - stream << item->GetWidth() << ", " << item->GetHeight(); - - // Default list of values - - stream << ", ["; - if (item->GetStringValues().Number() > 0) - { - wxNode *node = item->GetStringValues().First(); - while (node) + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + + stream << item->GetId() << ", " << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + + if (itemType == "wxComboBox") + stream << ", " << SafeWord(item->GetValue4()); + + // Default list of values + + stream << ", ["; + if (item->GetStringValues().Number() > 0) { - char *s = (char *)node->Data(); - stream << SafeWord(s); - if (node->Next()) - stream << ", "; - node = node->Next(); + wxNode *node = item->GetStringValues().First(); + while (node) + { + char *s = (char *)node->Data(); + stream << SafeWord(s); + if (node->Next()) + stream << ", "; + node = node->Next(); + } + } + stream << "]"; + if (item->GetFont().Ok()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); } - } - stream << "], " << item->GetValue1(); - if (item->GetFont().Ok()) - { - stream << ",\\\n "; - OutputFont(stream, item->GetFont()); - } } - else if (itemType == "wxBitmap") + else if (itemType == "wxRadioBox") { - stream << "static char *" << item->GetName() << " = \"bitmap(name = '" << item->GetName() << "',\\\n"; - - wxNode *node = item->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - stream << " bitmap = ["; + // Must write out the orientation and number of rows/cols!! + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxRadioBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); - char buf[400]; - strcpy(buf, child->GetName()); -#ifdef __WXMSW__ - wxDos2UnixFilename(buf); -#endif - - stream << "'" << buf << "', "; + // Default list of values - int bitmapType = (int)child->GetValue1(); - switch (bitmapType) + stream << ", ["; + if (item->GetStringValues().Number() > 0) { - case wxBITMAP_TYPE_XBM_DATA: - { - stream << "wxBITMAP_TYPE_XBM_DATA"; - break; - } - case wxBITMAP_TYPE_XPM_DATA: - { - stream << "wxBITMAP_TYPE_XPM_DATA"; - break; - } - case wxBITMAP_TYPE_XBM: - { - stream << "wxBITMAP_TYPE_XBM"; - break; - } - case wxBITMAP_TYPE_XPM: - { - stream << "wxBITMAP_TYPE_XPM"; - break; - } - case wxBITMAP_TYPE_BMP: - { - stream << "wxBITMAP_TYPE_BMP"; - break; - } - case wxBITMAP_TYPE_BMP_RESOURCE: - { - stream << "wxBITMAP_TYPE_BMP_RESOURCE"; - break; - } - case wxBITMAP_TYPE_GIF: - { - stream << "wxBITMAP_TYPE_GIF"; - break; - } - case wxBITMAP_TYPE_TIF: - { - stream << "wxBITMAP_TYPE_TIF"; - break; - } - case wxBITMAP_TYPE_ICO: - { - stream << "wxBITMAP_TYPE_ICO"; - break; - } - case wxBITMAP_TYPE_ICO_RESOURCE: - { - stream << "wxBITMAP_TYPE_ICO_RESOURCE"; - break; - } - case wxBITMAP_TYPE_CUR: - { - stream << "wxBITMAP_TYPE_CUR"; - break; - } - case wxBITMAP_TYPE_CUR_RESOURCE: - { - stream << "wxBITMAP_TYPE_CUR_RESOURCE"; - break; - } - default: - case wxBITMAP_TYPE_ANY: - { - stream << "wxBITMAP_TYPE_ANY"; - break; - } + wxNode *node = item->GetStringValues().First(); + while (node) + { + char *s = (char *)node->Data(); + stream << SafeWord(s); + if (node->Next()) + stream << ", "; + node = node->Next(); + } } - stream << ", "; - int platform = child->GetValue2(); - switch (platform) + stream << "], " << item->GetValue1(); + if (item->GetFont().Ok()) { - case RESOURCE_PLATFORM_WINDOWS: - { - stream << "'WINDOWS'"; - break; - } - case RESOURCE_PLATFORM_X: - { - stream << "'X'"; - break; - } - case RESOURCE_PLATFORM_MAC: - { - stream << "'MAC'"; - break; - } - case RESOURCE_PLATFORM_ANY: - { - stream << "'ANY'"; - break; - } + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); } - int noColours = (int)child->GetValue3(); - if (noColours > 0) - stream << ", " << noColours; - - stream << "]"; - - if (node->Next()) - stream << ",\\\n"; + } + else if (itemType == "wxBitmap") + { + stream << "static char *" << item->GetName() << " = \"bitmap(name = '" << item->GetName() << "',\\\n"; - node = node->Next(); + wxNode *node = item->GetChildren().First(); + while (node) + { + wxItemResource *child = (wxItemResource *)node->Data(); + stream << " bitmap = ["; + + char buf[400]; + strcpy(buf, child->GetName()); +#ifdef __WXMSW__ + wxDos2UnixFilename(buf); +#endif + + stream << "'" << buf << "', "; + + int bitmapType = (int)child->GetValue1(); + switch (bitmapType) + { + case wxBITMAP_TYPE_XBM_DATA: + { + stream << "wxBITMAP_TYPE_XBM_DATA"; + break; + } + case wxBITMAP_TYPE_XPM_DATA: + { + stream << "wxBITMAP_TYPE_XPM_DATA"; + break; + } + case wxBITMAP_TYPE_XBM: + { + stream << "wxBITMAP_TYPE_XBM"; + break; + } + case wxBITMAP_TYPE_XPM: + { + stream << "wxBITMAP_TYPE_XPM"; + break; + } + case wxBITMAP_TYPE_BMP: + { + stream << "wxBITMAP_TYPE_BMP"; + break; + } + case wxBITMAP_TYPE_BMP_RESOURCE: + { + stream << "wxBITMAP_TYPE_BMP_RESOURCE"; + break; + } + case wxBITMAP_TYPE_GIF: + { + stream << "wxBITMAP_TYPE_GIF"; + break; + } + case wxBITMAP_TYPE_TIF: + { + stream << "wxBITMAP_TYPE_TIF"; + break; + } + case wxBITMAP_TYPE_ICO: + { + stream << "wxBITMAP_TYPE_ICO"; + break; + } + case wxBITMAP_TYPE_ICO_RESOURCE: + { + stream << "wxBITMAP_TYPE_ICO_RESOURCE"; + break; + } + case wxBITMAP_TYPE_CUR: + { + stream << "wxBITMAP_TYPE_CUR"; + break; + } + case wxBITMAP_TYPE_CUR_RESOURCE: + { + stream << "wxBITMAP_TYPE_CUR_RESOURCE"; + break; + } + default: + case wxBITMAP_TYPE_ANY: + { + stream << "wxBITMAP_TYPE_ANY"; + break; + } + } + stream << ", "; + int platform = child->GetValue2(); + switch (platform) + { + case RESOURCE_PLATFORM_WINDOWS: + { + stream << "'WINDOWS'"; + break; + } + case RESOURCE_PLATFORM_X: + { + stream << "'X'"; + break; + } + case RESOURCE_PLATFORM_MAC: + { + stream << "'MAC'"; + break; + } + case RESOURCE_PLATFORM_ANY: + { + stream << "'ANY'"; + break; + } + } + int noColours = (int)child->GetValue3(); + if (noColours > 0) + stream << ", " << noColours; + + stream << "]"; + + if (node->Next()) + stream << ",\\\n"; + + node = node->Next(); } stream << ").\";\n\n"; } @@ -526,85 +526,85 @@ bool wxResourceTableWithSaving::SaveResource(wxTextOutputStream& stream, wxItemR str += itemType; wxMessageBox(str); } - return TRUE; + return TRUE; } void wxResourceTableWithSaving::GenerateDialogStyleString(long windowStyle, char *buf) { - buf[0] = 0; - m_styleTable.GenerateStyleStrings("wxWindow", windowStyle, buf); - m_styleTable.GenerateStyleStrings("wxPanel", windowStyle, buf); - m_styleTable.GenerateStyleStrings("wxDialog", windowStyle, buf); - - if (strlen(buf) == 0) - strcat(buf, "0"); + buf[0] = 0; + m_styleTable.GenerateStyleStrings("wxWindow", windowStyle, buf); + m_styleTable.GenerateStyleStrings("wxPanel", windowStyle, buf); + m_styleTable.GenerateStyleStrings("wxDialog", windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); } void wxResourceTableWithSaving::GeneratePanelStyleString(long windowStyle, char *buf) { - buf[0] = 0; - m_styleTable.GenerateStyleStrings("wxWindow", windowStyle, buf); - m_styleTable.GenerateStyleStrings("wxPanel", windowStyle, buf); - - if (strlen(buf) == 0) - strcat(buf, "0"); + buf[0] = 0; + m_styleTable.GenerateStyleStrings("wxWindow", windowStyle, buf); + m_styleTable.GenerateStyleStrings("wxPanel", windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); } void wxResourceTableWithSaving::GenerateControlStyleString(const wxString& windowClass, long windowStyle, char *buf) { - buf[0] = 0; - m_styleTable.GenerateStyleStrings("wxWindow", windowStyle, buf); - m_styleTable.GenerateStyleStrings("wxControl", windowStyle, buf); - m_styleTable.GenerateStyleStrings(windowClass, windowStyle, buf); - - if (strlen(buf) == 0) - strcat(buf, "0"); + buf[0] = 0; + m_styleTable.GenerateStyleStrings("wxWindow", windowStyle, buf); + m_styleTable.GenerateStyleStrings("wxControl", windowStyle, buf); + m_styleTable.GenerateStyleStrings(windowClass, windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); } // Returns quoted string or "NULL" char *SafeString(const wxString& s) { - if (s == "") - return "NULL"; - else - { - strcpy(wxBuffer, "\""); - strcat(wxBuffer, s); - strcat(wxBuffer, "\""); - return wxBuffer; - } + if (s == "") + return "NULL"; + else + { + strcpy(wxBuffer, "\""); + strcat(wxBuffer, s); + strcat(wxBuffer, "\""); + return wxBuffer; + } } // Returns quoted string or '' : convert " to \" char *SafeWord(const wxString& s) { - const char *cp; - char *dp; - - if (s == "") - return "''"; - else - { - dp = wxBuffer; - cp = s.c_str(); - *dp++ = '\''; - while(*cp != 0) { - if(*cp == '"') { - *dp++ = '\\'; - *dp++ = '"'; - } else if(*cp == '\'') { - *dp++ = '\\'; - *dp++ = '\''; - } else - *dp++ = *cp; - - cp++; - } - *dp++ = '\''; - *dp++ = 0; - - return wxBuffer; - } + const char *cp; + char *dp; + + if (s == "") + return "''"; + else + { + dp = wxBuffer; + cp = s.c_str(); + *dp++ = '\''; + while(*cp != 0) { + if(*cp == '"') { + *dp++ = '\\'; + *dp++ = '"'; + } else if(*cp == '\'') { + *dp++ = '\\'; + *dp++ = '\''; + } else + *dp++ = *cp; + + cp++; + } + *dp++ = '\''; + *dp++ = 0; + + return wxBuffer; + } } diff --git a/utils/dialoged/src/symbtabl.cpp b/utils/dialoged/src/symbtabl.cpp index 110764e782..bed48b411d 100644 --- a/utils/dialoged/src/symbtabl.cpp +++ b/utils/dialoged/src/symbtabl.cpp @@ -32,7 +32,7 @@ #include "symbtabl.h" wxResourceSymbolTable::wxResourceSymbolTable(): - m_hashTable(wxKEY_STRING) +m_hashTable(wxKEY_STRING) { } @@ -48,70 +48,70 @@ bool wxResourceSymbolTable::ReadIncludeFile(const wxString& filename) wxFile file; if (!wxFileExists(filename)) return FALSE; - + if (!file.Open(filename, wxFile::read)) return FALSE; - + off_t len = file.Length(); if (len == -1) return FALSE; - + Clear(); AddStandardSymbols(); - + wxString str; char* p = str.GetWriteBuf(len + 1); - + if (file.Read(p, len) == wxFile::fd_invalid) { str.UngetWriteBuf(); return FALSE; } str.UngetWriteBuf(); - + // Look for #define occurrences int pos = str.Find("#define"); while (pos != -1) { size_t len = str.Length(); - + size_t i = pos + 8; - + // Eat whitespace until symbol while ((str[i] == ' ' || str[i] == '\t') && (i < len)) i ++; - + size_t start = i; - + // Eat symbol while (str[i] != ' ' && str[i] != '\t' && (i < len)) i ++; size_t end = i-1; - + wxString symbol(str.Mid(start, (end - start + 1))); - + // Eat whitespace until number while ((str[i] == ' ' || str[i] == '\t') && (i < len)) i ++; - + size_t startNum = i; - + // Eat number while (str[i] != ' ' && str[i] != '\t' && str[i] != '\n' && (i < len)) i ++; - + size_t endNum = i-1; - + wxString numStr(str.Mid(startNum, (endNum - startNum + 1))); - + int id = atol(numStr); - + AddSymbol(symbol, id); - + str = str.Right(len - i); pos = str.Find("#define"); } - + return TRUE; } @@ -120,30 +120,30 @@ bool wxResourceSymbolTable::WriteIncludeFile(const wxString& filename) wxFile file; if (!file.Open(filename, wxFile::write)) return FALSE; - + wxString fileOnly(wxFileNameFromPath(filename)); wxString line; line.Printf("/*\n * %s\n * Window identifiers file written by Dialog Editor\n */\n\n", (const char*) fileOnly); - + file.Write(line, line.Length()); - + m_hashTable.BeginFind(); - + wxNode* node = m_hashTable.Next(); while (node) { const char* str = node->GetKeyString(); int id = (int) node->Data() ; - + if (!IsStandardSymbol(str)) { wxString line; line.Printf("#define %s %ld\n", str, id); - + file.Write(line, line.Length()); } - + node = m_hashTable.Next(); } return TRUE; @@ -177,14 +177,14 @@ bool wxResourceSymbolTable::RemoveSymbol(int id) wxString wxResourceSymbolTable::GetSymbolForId(int id) { m_hashTable.BeginFind(); - + wxNode* node = m_hashTable.Next(); while (node) { const char* str = node->GetKeyString(); if (str && ( ((int) node->Data()) == id) ) return wxString(str); - + node = m_hashTable.Next(); } return wxString(""); @@ -203,13 +203,13 @@ bool wxResourceSymbolTable::SymbolExists(const wxString& symbol) const bool wxResourceSymbolTable::IdExists(int id) { m_hashTable.BeginFind(); - + wxNode* node = m_hashTable.Next(); while (node) { if ( (((int) node->Data()) == id) ) return TRUE; - + node = m_hashTable.Next(); } return FALSE; @@ -218,19 +218,19 @@ bool wxResourceSymbolTable::IdExists(int id) int wxResourceSymbolTable::FindHighestId() { int highest = 0; - + m_hashTable.BeginFind(); - + wxNode* node = m_hashTable.Next(); while (node) { int id = ((int) node->Data()); if (id > highest) highest = id; - + node = m_hashTable.Next(); } - + // Make sure we don't clash with future standard wxWindows ids if (highest <= wxID_HIGHEST) highest = wxID_HIGHEST + 1; @@ -238,8 +238,8 @@ int wxResourceSymbolTable::FindHighestId() } /* - * A table of the standard identifiers - */ +* A table of the standard identifiers +*/ struct wxStandardSymbolStruct { @@ -256,7 +256,7 @@ static wxStandardSymbolStruct sg_StandardSymbols[] = { "wxID_STATIC", wxID_STATIC }, { "wxID_YES", wxID_YES }, { "wxID_NO", wxID_NO }, - + { "wxID_OPEN", wxID_OPEN }, { "wxID_CLOSE", wxID_CLOSE }, { "wxID_NEW", wxID_NEW }, @@ -274,14 +274,14 @@ static wxStandardSymbolStruct sg_StandardSymbols[] = { "wxID_HELP_COMMANDS", wxID_HELP_COMMANDS }, { "wxID_HELP_PROCEDURES", wxID_HELP_PROCEDURES }, { "wxID_HELP_CONTEXT", wxID_HELP_CONTEXT }, - + { "wxID_CUT", wxID_CUT }, { "wxID_COPY", wxID_COPY }, { "wxID_PASTE", wxID_PASTE }, { "wxID_CLEAR", wxID_CLEAR }, { "wxID_FIND", wxID_FIND }, { "wxID_DUPLICATE", wxID_DUPLICATE }, - + { "wxID_FILE1", wxID_FILE1 }, { "wxID_FILE2", wxID_FILE2 }, { "wxID_FILE3", wxID_FILE3 }, @@ -291,7 +291,7 @@ static wxStandardSymbolStruct sg_StandardSymbols[] = { "wxID_FILE7", wxID_FILE7 }, { "wxID_FILE8", wxID_FILE8 }, { "wxID_FILE9", wxID_FILE9 } - + }; static int sg_StandardSymbolSize = (sizeof(sg_StandardSymbols)/sizeof(wxStandardSymbolStruct)); @@ -319,12 +319,12 @@ bool wxResourceSymbolTable::IsStandardSymbol(const wxString& symbol) const bool wxResourceSymbolTable::FillComboBox(wxComboBox* comboBox) { m_hashTable.BeginFind(); - + wxNode* node = m_hashTable.Next(); while (node) { const char* str = node->GetKeyString(); - + comboBox->Append(str); node = m_hashTable.Next(); } diff --git a/utils/dialoged/src/symbtabl.h b/utils/dialoged/src/symbtabl.h index 440b14b222..b95bc9fa9e 100644 --- a/utils/dialoged/src/symbtabl.h +++ b/utils/dialoged/src/symbtabl.h @@ -21,8 +21,8 @@ class wxResourceSymbolTable: public wxObject public: wxResourceSymbolTable(); ~wxResourceSymbolTable(); - -// Operations + + // Operations bool ReadIncludeFile(const wxString& filename); bool WriteIncludeFile(const wxString& filename); void Clear(); @@ -31,22 +31,22 @@ public: bool RemoveSymbol(int id); void AddStandardSymbols(); bool FillComboBox(wxComboBox* comboBox); - -// Accessors + + // Accessors wxString GetSymbolForId(int id); int GetIdForSymbol(const wxString& symbol); bool SymbolExists(const wxString& symbol) const; bool IdExists(int id) ; bool IsStandardSymbol(const wxString& symbol) const; int FindHighestId() ; - -// Implementation - -// Member variables + + // Implementation + + // Member variables protected: wxHashTable m_hashTable; }; #endif - // _SYMBTABL_H_ +// _SYMBTABL_H_ diff --git a/utils/dialoged/src/winprop.cpp b/utils/dialoged/src/winprop.cpp index dde79ec61c..e32b9b2940 100644 --- a/utils/dialoged/src/winprop.cpp +++ b/utils/dialoged/src/winprop.cpp @@ -39,61 +39,61 @@ // Causes immediate feedback. void wxResourcePropertyListView::OnPropertyChanged(wxProperty *property) { - // Sets the value of the property back into the actual object, - // IF the property value was modified. - if (property->GetValue().GetModified()) - { - m_propertyInfo->SetProperty(property->GetName(), property); - property->GetValue().SetModified(FALSE); - wxResourceManager::GetCurrentResourceManager()->Modify(TRUE); - } + // Sets the value of the property back into the actual object, + // IF the property value was modified. + if (property->GetValue().GetModified()) + { + m_propertyInfo->SetProperty(property->GetName(), property); + property->GetValue().SetModified(FALSE); + wxResourceManager::GetCurrentResourceManager()->Modify(TRUE); + } } bool wxResourcePropertyListView::OnClose(void) { - int w, h, x, y; - GetManagedWindow()->GetSize(& w, & h); - GetManagedWindow()->GetPosition(& x, & y); - - wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width = w; - wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height = h; - wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x = x; - wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y = y; - - return wxPropertyListView::OnClose(); + int w, h, x, y; + GetManagedWindow()->GetSize(& w, & h); + GetManagedWindow()->GetPosition(& x, & y); + + wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width = w; + wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height = h; + wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x = x; + wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y = y; + + return wxPropertyListView::OnClose(); } wxWindow *wxPropertyInfo::sm_propertyWindow; /* - * wxDialogEditorPropertyListDialog - */ +* wxDialogEditorPropertyListDialog +*/ - /* +/* wxDialogEditorPropertyListDialog::wxDialogEditorPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name): - wxPropertyListDialog(v, parent, title, pos, size, style, name) +const wxPoint& pos, const wxSize& size, +long style, const wxString& name): +wxPropertyListDialog(v, parent, title, pos, size, style, name) { - m_propSheet = NULL; - m_propInfo = NULL; +m_propSheet = NULL; +m_propInfo = NULL; } -wxDialogEditorPropertyListDialog::~wxDialogEditorPropertyListDialog() -{ - delete m_propSheet; - delete m_propInfo; - wxPropertyInfo::sm_propertyWindow = NULL; -} + wxDialogEditorPropertyListDialog::~wxDialogEditorPropertyListDialog() + { + delete m_propSheet; + delete m_propInfo; + wxPropertyInfo::sm_propertyWindow = NULL; + } */ wxDialogEditorPropertyListFrame::wxDialogEditorPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name): - wxPropertyListFrame(v, parent, title, pos, size, style, name) + const wxPoint& pos, const wxSize& size, + long style, const wxString& name): +wxPropertyListFrame(v, parent, title, pos, size, style, name) { - m_propSheet = NULL; - m_propInfo = NULL; + m_propSheet = NULL; + m_propInfo = NULL; } wxDialogEditorPropertyListFrame::~wxDialogEditorPropertyListFrame() @@ -105,116 +105,116 @@ wxDialogEditorPropertyListFrame::~wxDialogEditorPropertyListFrame() } /* - * wxPropertyInfo - */ +* wxPropertyInfo +*/ // Edit the information represented by this object, whatever that // might be. bool wxPropertyInfo::Edit(wxWindow *WXUNUSED(parent), const wxString& title) { - if (sm_propertyWindow) - { - wxWindowPropertyInfo* thisProp = (wxWindowPropertyInfo*) this; - wxWindowPropertyInfo* oldProp = (wxWindowPropertyInfo*) (((wxDialogEditorPropertyListFrame *) sm_propertyWindow)->GetInfo()); - if (oldProp->GetWindow() == thisProp->GetWindow()) - { - sm_propertyWindow->Raise(); - return TRUE; - } - else - { - CloseWindow(); // Close the window so we can open a new one - } - } - - int width = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width; - int height = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height; - int x = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x; - int y = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y; - - wxPropertySheet *propSheet = new wxPropertySheet; - - wxStringList propNames; - GetPropertyNames(propNames); - - wxNode *node = propNames.First(); - while (node) - { - wxString name((char *)node->Data()); - wxProperty *prop = GetProperty(name); - if (prop) + if (sm_propertyWindow) { - propSheet->AddProperty(prop); + wxWindowPropertyInfo* thisProp = (wxWindowPropertyInfo*) this; + wxWindowPropertyInfo* oldProp = (wxWindowPropertyInfo*) (((wxDialogEditorPropertyListFrame *) sm_propertyWindow)->GetInfo()); + if (oldProp->GetWindow() == thisProp->GetWindow()) + { + sm_propertyWindow->Raise(); + return TRUE; + } + else + { + CloseWindow(); // Close the window so we can open a new one + } } - node = node->Next(); - } - - // Reset 'modified' flags for all property values - propSheet->SetAllModified(FALSE); - - wxResourcePropertyListView *view = new wxResourcePropertyListView(this, NULL, - wxPROP_BUTTON_OK | // wxPROP_BUTTON_CANCEL | - wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES); - - wxDialogEditorPropertyListFrame *propWin = new wxDialogEditorPropertyListFrame(view, - wxResourceManager::GetCurrentResourceManager()->GetEditorFrame(), title, wxPoint(x, y), - wxSize(width, height), wxDEFAULT_FRAME_STYLE); - sm_propertyWindow = propWin; - - propWin->m_registry.RegisterValidator(wxString("real"), new wxRealListValidator); - propWin->m_registry.RegisterValidator(wxString("string"), new wxStringListValidator); - propWin->m_registry.RegisterValidator(wxString("integer"), new wxIntegerListValidator); - propWin->m_registry.RegisterValidator(wxString("bool"), new wxBoolListValidator); - propWin->m_registry.RegisterValidator(wxString("filename"), new wxFilenameListValidator); - propWin->m_registry.RegisterValidator(wxString("stringlist"), new wxListOfStringsListValidator); - propWin->m_registry.RegisterValidator(wxString("window_id"), new wxResourceSymbolValidator); - - propWin->m_propInfo = this; - propWin->m_propSheet = propSheet; - -// view->m_propertyWindow = propWin; - view->AddRegistry(&(propWin->m_registry)); - - propWin->Initialize(); - view->ShowView(propSheet, propWin->GetPropertyPanel()); - - propWin->Show(TRUE); - - // Otherwise doesn't show itself + + int width = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width; + int height = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height; + int x = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x; + int y = wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y; + + wxPropertySheet *propSheet = new wxPropertySheet; + + wxStringList propNames; + GetPropertyNames(propNames); + + wxNode *node = propNames.First(); + while (node) + { + wxString name((char *)node->Data()); + wxProperty *prop = GetProperty(name); + if (prop) + { + propSheet->AddProperty(prop); + } + node = node->Next(); + } + + // Reset 'modified' flags for all property values + propSheet->SetAllModified(FALSE); + + wxResourcePropertyListView *view = new wxResourcePropertyListView(this, NULL, + wxPROP_BUTTON_OK | // wxPROP_BUTTON_CANCEL | + wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES); + + wxDialogEditorPropertyListFrame *propWin = new wxDialogEditorPropertyListFrame(view, + wxResourceManager::GetCurrentResourceManager()->GetEditorFrame(), title, wxPoint(x, y), + wxSize(width, height), wxDEFAULT_FRAME_STYLE); + sm_propertyWindow = propWin; + + propWin->m_registry.RegisterValidator(wxString("real"), new wxRealListValidator); + propWin->m_registry.RegisterValidator(wxString("string"), new wxStringListValidator); + propWin->m_registry.RegisterValidator(wxString("integer"), new wxIntegerListValidator); + propWin->m_registry.RegisterValidator(wxString("bool"), new wxBoolListValidator); + propWin->m_registry.RegisterValidator(wxString("filename"), new wxFilenameListValidator); + propWin->m_registry.RegisterValidator(wxString("stringlist"), new wxListOfStringsListValidator); + propWin->m_registry.RegisterValidator(wxString("window_id"), new wxResourceSymbolValidator); + + propWin->m_propInfo = this; + propWin->m_propSheet = propSheet; + + // view->m_propertyWindow = propWin; + view->AddRegistry(&(propWin->m_registry)); + + propWin->Initialize(); + view->ShowView(propSheet, propWin->GetPropertyPanel()); + + propWin->Show(TRUE); + + // Otherwise doesn't show itself #ifdef __WXMOTIF__ - wxNoOptimize noOptimize; - propWin->SetSize(-1, -1, width, height); + wxNoOptimize noOptimize; + propWin->SetSize(-1, -1, width, height); #endif - - return TRUE; + + return TRUE; } void wxPropertyInfo::CloseWindow() { - if (sm_propertyWindow) - { + if (sm_propertyWindow) + { int w, h, x, y; sm_propertyWindow->GetSize(& w, & h); sm_propertyWindow->GetPosition(& x, & y); - + wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().width = w; wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().height = h; wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().x = x; wxResourceManager::GetCurrentResourceManager()->GetPropertyWindowSize().y = y; - + sm_propertyWindow->Destroy(); sm_propertyWindow = (wxDialogEditorPropertyListFrame *) NULL; - } + } } /* - * wxWindowPropertyInfo - */ +* wxWindowPropertyInfo +*/ wxWindowPropertyInfo::wxWindowPropertyInfo(wxWindow *win, wxItemResource *res) { - m_propertyWindow = win; - m_propertyResource = res; + m_propertyWindow = win; + m_propertyResource = res; } wxWindowPropertyInfo::~wxWindowPropertyInfo(void) @@ -223,524 +223,526 @@ wxWindowPropertyInfo::~wxWindowPropertyInfo(void) wxProperty *wxWindowPropertyInfo::GetFontProperty(wxString& name, wxFont *font) { - if (!font) - return NULL; - - if (name.Contains("Points")) - return new wxProperty(name, (long)font->GetPointSize(), "integer", new wxIntegerListValidator(1, 100)); - else if (name.Contains("Family")) - return new wxProperty(name, font->GetFamilyString(), "string", - new wxStringListValidator(new wxStringList("wxDECORATIVE", "wxROMAN", "wxSCRIPT", "wxSWISS", "wxMODERN", - NULL))); - else if (name.Contains("Style")) - return new wxProperty(name, font->GetStyleString(), "string", - new wxStringListValidator(new wxStringList("wxNORMAL", "wxITALIC", "wxSLANT", NULL))); - else if (name.Contains("Weight")) - return new wxProperty(name, font->GetWeightString(), "string", - new wxStringListValidator(new wxStringList("wxNORMAL", "wxBOLD", "wxLIGHT", NULL))); - else if (name.Contains("Underlined")) - return new wxProperty(name, (bool)font->GetUnderlined(), "bool"); - else - return NULL; + if (!font) + return NULL; + + if (name.Contains("Points")) + return new wxProperty(name, (long)font->GetPointSize(), "integer", new wxIntegerListValidator(1, 100)); + else if (name.Contains("Family")) + return new wxProperty(name, font->GetFamilyString(), "string", + new wxStringListValidator(new wxStringList("wxDECORATIVE", "wxROMAN", "wxSCRIPT", "wxSWISS", "wxMODERN", + NULL))); + else if (name.Contains("Style")) + return new wxProperty(name, font->GetStyleString(), "string", + new wxStringListValidator(new wxStringList("wxNORMAL", "wxITALIC", "wxSLANT", NULL))); + else if (name.Contains("Weight")) + return new wxProperty(name, font->GetWeightString(), "string", + new wxStringListValidator(new wxStringList("wxNORMAL", "wxBOLD", "wxLIGHT", NULL))); + else if (name.Contains("Underlined")) + return new wxProperty(name, (bool)font->GetUnderlined(), "bool"); + else + return NULL; } wxFont *wxWindowPropertyInfo::SetFontProperty(wxString& name, wxProperty *property, wxFont *font) { - int pointSize = 12; - int fontFamily = wxMODERN; - int fontStyle = wxNORMAL; - int fontWeight = wxNORMAL; - bool fontUnderlined = FALSE; - - if (name.Contains("Points")) - { - pointSize = (int)property->GetValue().IntegerValue(); - if (font && (pointSize == font->GetPointSize())) - return NULL; // No change - } - else if (font) pointSize = font->GetPointSize(); - - if (name.Contains("Family")) - { - wxString val = property->GetValue().StringValue(); - fontFamily = wxStringToFontFamily(val); + int pointSize = 12; + int fontFamily = wxMODERN; + int fontStyle = wxNORMAL; + int fontWeight = wxNORMAL; + bool fontUnderlined = FALSE; - if (font && (fontFamily == font->GetFamily())) - return NULL; // No change - } - else if (font) fontFamily = font->GetFamily(); - - if (name.Contains("Style")) - { - wxString val = property->GetValue().StringValue(); - fontStyle = wxStringToFontStyle(val); + if (name.Contains("Points")) + { + pointSize = (int)property->GetValue().IntegerValue(); + if (font && (pointSize == font->GetPointSize())) + return NULL; // No change + } + else if (font) pointSize = font->GetPointSize(); - if (font && (fontStyle == font->GetStyle())) - return NULL; // No change - } - else if (font) fontStyle = font->GetStyle(); - if (name.Contains("Weight")) - { - wxString val = property->GetValue().StringValue(); - fontWeight = wxStringToFontWeight(val); - - if (font && (fontWeight == font->GetWeight())) - return NULL; // No change - } - else if (font) fontWeight = font->GetWeight(); - - if (name.Contains("Underlined")) - { - fontUnderlined = property->GetValue().BoolValue(); - - if (font && (fontUnderlined == font->GetUnderlined())) - return NULL; // No change - } - else if (font) fontUnderlined = font->GetUnderlined(); - - wxFont *newFont = wxTheFontList->FindOrCreateFont(pointSize, fontFamily, fontStyle, fontWeight, fontUnderlined); - if (newFont) - { - return newFont; - } - else - return NULL; -} - -wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name) -{ - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - - wxFont *font = & m_propertyWindow->GetFont(); - if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || - name == "fontUnderlined") - return GetFontProperty(name, font); - else if (name == "name") - return new wxProperty("name", m_propertyWindow->GetName(), "string"); - else if (name == "title") - return new wxProperty("title", m_propertyWindow->GetTitle(), "string"); - else if (name == "x") - { - return new wxProperty("x", (long)resource->GetX(), "integer"); - } - else if (name == "y") - { - return new wxProperty("y", (long)resource->GetY(), "integer"); - } - else if (name == "width") - { - return new wxProperty("width", (long)resource->GetWidth(), "integer"); - } - else if (name == "height") - { - return new wxProperty("height", (long)resource->GetHeight(), "integer"); - } - else if (name == "id") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - if (resource) + if (name.Contains("Family")) + { + wxString val = property->GetValue().StringValue(); + fontFamily = wxStringToFontFamily(val); + + if (font && (fontFamily == font->GetFamily())) + return NULL; // No change + } + else if (font) fontFamily = font->GetFamily(); + + if (name.Contains("Style")) + { + wxString val = property->GetValue().StringValue(); + fontStyle = wxStringToFontStyle(val); + + if (font && (fontStyle == font->GetStyle())) + return NULL; // No change + } + else if (font) fontStyle = font->GetStyle(); + if (name.Contains("Weight")) + { + wxString val = property->GetValue().StringValue(); + fontWeight = wxStringToFontWeight(val); + + if (font && (fontWeight == font->GetWeight())) + return NULL; // No change + } + else if (font) fontWeight = font->GetWeight(); + + if (name.Contains("Underlined")) + { + fontUnderlined = property->GetValue().BoolValue(); + + if (font && (fontUnderlined == font->GetUnderlined())) + return NULL; // No change + } + else if (font) fontUnderlined = font->GetUnderlined(); + + wxFont *newFont = wxTheFontList->FindOrCreateFont(pointSize, fontFamily, fontStyle, fontWeight, fontUnderlined); + if (newFont) { - int id = resource->GetId(); - wxString idStr; - idStr.Printf("%d", id); - wxString symbolName = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetSymbolForId(id); - symbolName += "="; - symbolName += idStr; - // symbolName is now e.g. "ID_PANEL21=105" - return new wxProperty("id", symbolName, "window_id"); + return newFont; } else return NULL; - } - else if (name == "border") - { - wxString border(""); - if (m_propertyWindow->GetWindowStyleFlag() & wxSIMPLE_BORDER) - border = "wxSIMPLE_BORDER"; - else if (m_propertyWindow->GetWindowStyleFlag() & wxRAISED_BORDER) - border = "wxRAISED_BORDER"; - else if (m_propertyWindow->GetWindowStyleFlag() & wxSUNKEN_BORDER) - border = "wxSUNKEN_BORDER"; - else if (m_propertyWindow->GetWindowStyleFlag() & wxDOUBLE_BORDER) - border = "wxDOUBLE_BORDER"; - else if (m_propertyWindow->GetWindowStyleFlag() & wxSTATIC_BORDER) - border = "wxSTATIC_BORDER"; - else - border = "wxNO_BORDER"; - - return new wxProperty("border", border, "string", - new wxStringListValidator(new wxStringList("wxSIMPLE_BORDER", "wxRAISED_BORDER", - "wxSUNKEN_BORDER", "wxDOUBLE_BORDER", "wxSTATIC_BORDER", "wxNO_BORDER", NULL))); - } - else - return NULL; } -bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property) +wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name) { - wxFont *font = & m_propertyWindow->GetFont(); - if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" )) - { - wxFont *newFont = SetFontProperty(name, property, font); - if (newFont) + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + + wxFont *font = & m_propertyWindow->GetFont(); + if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || + name == "fontUnderlined") + return GetFontProperty(name, font); + else if (name == "name") + return new wxProperty("name", m_propertyWindow->GetName(), "string"); + else if (name == "title") + return new wxProperty("title", m_propertyWindow->GetTitle(), "string"); + else if (name == "x") { - m_propertyWindow->SetFont(* newFont); - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - if (resource) - { - resource->SetFont(* newFont); - } + return new wxProperty("x", (long)resource->GetX(), "integer"); } - - return TRUE; - } - else if (name == "name") - { - // Remove old name from resource table, if it's there. - wxItemResource *oldResource = (wxItemResource *)wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Delete(m_propertyWindow->GetName()); - if (oldResource) + else if (name == "y") { - // It's a top-level resource - m_propertyWindow->SetName(property->GetValue().StringValue()); - oldResource->SetName(property->GetValue().StringValue()); - wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(m_propertyWindow->GetName(), oldResource); + return new wxProperty("y", (long)resource->GetY(), "integer"); } - else + else if (name == "width") { - // It's a child of something; just set the name of the resource and the window. - m_propertyWindow->SetName(property->GetValue().StringValue()); - m_propertyResource->SetName(property->GetValue().StringValue()); + return new wxProperty("width", (long)resource->GetWidth(), "integer"); } - // Refresh the resource manager list, because the name changed. - wxResourceManager::GetCurrentResourceManager()->UpdateResourceList(); - return TRUE; - } - else if (name == "title") - { - m_propertyWindow->SetTitle(property->GetValue().StringValue()); - return TRUE; - } - else if (name == "x") - { - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - int x, y; - m_propertyWindow->GetPosition(&x, &y); - int newX = (int)property->GetValue().IntegerValue(); - int pixelX = newX; - - // We need to convert to pixels if this is not a dialog or panel, but - // the parent resource specifies dialog units. - if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) + else if (name == "height") { - wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) - { - wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(newX, y)); - pixelX = pt.x; - } + return new wxProperty("height", (long)resource->GetHeight(), "integer"); } - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) + else if (name == "id") { - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + if (resource) { - wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(newX, y)); - pixelX = pt.x; + int id = resource->GetId(); + wxString idStr; + idStr.Printf("%d", id); + wxString symbolName = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetSymbolForId(id); + symbolName += "="; + symbolName += idStr; + // symbolName is now e.g. "ID_PANEL21=105" + return new wxProperty("id", symbolName, "window_id"); } + else + return NULL; } - - if (x != pixelX) + else if (name == "border") { - m_propertyWindow->Move(pixelX, y); - resource->SetSize(newX, resource->GetY(), resource->GetWidth(), resource->GetHeight()); + wxString border(""); + if (m_propertyWindow->GetWindowStyleFlag() & wxSIMPLE_BORDER) + border = "wxSIMPLE_BORDER"; + else if (m_propertyWindow->GetWindowStyleFlag() & wxRAISED_BORDER) + border = "wxRAISED_BORDER"; + else if (m_propertyWindow->GetWindowStyleFlag() & wxSUNKEN_BORDER) + border = "wxSUNKEN_BORDER"; + else if (m_propertyWindow->GetWindowStyleFlag() & wxDOUBLE_BORDER) + border = "wxDOUBLE_BORDER"; + else if (m_propertyWindow->GetWindowStyleFlag() & wxSTATIC_BORDER) + border = "wxSTATIC_BORDER"; + else if (m_propertyWindow->GetWindowStyleFlag() & wxNO_BORDER) + border = "wxNO_BORDER"; + else + border = "default border"; + + return new wxProperty("border", border, "string", + new wxStringListValidator(new wxStringList("wxSIMPLE_BORDER", "wxRAISED_BORDER", + "wxSUNKEN_BORDER", "wxDOUBLE_BORDER", "wxSTATIC_BORDER", "wxNO_BORDER", "default border", NULL))); } - return TRUE; - } - else if (name == "y") - { - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - int x, y; - m_propertyWindow->GetPosition(&x, &y); - int newY = (int)property->GetValue().IntegerValue(); - int pixelY = newY; + else + return NULL; +} - // We need to convert to pixels if this is not a dialog or panel, but - // the parent resource specifies dialog units. - if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) +bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxFont *font = & m_propertyWindow->GetFont(); + if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" )) { - wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + wxFont *newFont = SetFontProperty(name, property, font); + if (newFont) { - wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(x, newY)); - pixelY = pt.y; + m_propertyWindow->SetFont(* newFont); + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + if (resource) + { + resource->SetFont(* newFont); + } } + + return TRUE; } - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) + else if (name == "name") { - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + // Remove old name from resource table, if it's there. + wxItemResource *oldResource = (wxItemResource *)wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Delete(m_propertyWindow->GetName()); + if (oldResource) + { + // It's a top-level resource + m_propertyWindow->SetName(property->GetValue().StringValue()); + oldResource->SetName(property->GetValue().StringValue()); + wxResourceManager::GetCurrentResourceManager()->GetResourceTable().Put(m_propertyWindow->GetName(), oldResource); + } + else { - wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(x, newY)); - pixelY = pt.y; + // It's a child of something; just set the name of the resource and the window. + m_propertyWindow->SetName(property->GetValue().StringValue()); + m_propertyResource->SetName(property->GetValue().StringValue()); } + // Refresh the resource manager list, because the name changed. + wxResourceManager::GetCurrentResourceManager()->UpdateResourceList(); + return TRUE; } - - if (y != pixelY) + else if (name == "title") { - m_propertyWindow->Move(x, pixelY); - resource->SetSize(resource->GetX(), newY, resource->GetWidth(), resource->GetHeight()); + m_propertyWindow->SetTitle(property->GetValue().StringValue()); + return TRUE; } - return TRUE; - } - else if (name == "width") - { - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - int width, height; - m_propertyWindow->GetSize(&width, &height); - int newWidth = (int)property->GetValue().IntegerValue(); - int pixelWidth = newWidth; - - // We need to convert to pixels if this is not a dialog or panel, but - // the parent resource specifies dialog units. - if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) + else if (name == "x") { - wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + int x, y; + m_propertyWindow->GetPosition(&x, &y); + int newX = (int)property->GetValue().IntegerValue(); + int pixelX = newX; + + // We need to convert to pixels if this is not a dialog or panel, but + // the parent resource specifies dialog units. + if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) { - wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(newWidth, height)); - pixelWidth = sz.x; + wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(newX, y)); + pixelX = pt.x; + } + } + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) + { + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(newX, y)); + pixelX = pt.x; + } + } + + if (x != pixelX) + { + m_propertyWindow->Move(pixelX, y); + resource->SetSize(newX, resource->GetY(), resource->GetWidth(), resource->GetHeight()); } + return TRUE; } - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) + else if (name == "y") { wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + int x, y; + m_propertyWindow->GetPosition(&x, &y); + int newY = (int)property->GetValue().IntegerValue(); + int pixelY = newY; + + // We need to convert to pixels if this is not a dialog or panel, but + // the parent resource specifies dialog units. + if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) { - wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(newWidth, height)); - pixelWidth = sz.x; + wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxPoint pt = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxPoint(x, newY)); + pixelY = pt.y; + } } - } - - if (width != pixelWidth) - { - m_propertyWindow->SetSize(pixelWidth, height); - resource->SetSize(resource->GetX(), resource->GetY(), newWidth, resource->GetHeight()); - } - return TRUE; - } - else if (name == "height") - { - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - int width, height; - m_propertyWindow->GetSize(&width, &height); - int newHeight = (int)property->GetValue().IntegerValue(); - int pixelHeight = newHeight; - - // We need to convert to pixels if this is not a dialog or panel, but - // the parent resource specifies dialog units. - if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) - { - wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) + { + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxPoint pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(x, newY)); + pixelY = pt.y; + } + } + + if (y != pixelY) { - wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(width, newHeight)); - pixelHeight = sz.y; + m_propertyWindow->Move(x, pixelY); + resource->SetSize(resource->GetX(), newY, resource->GetWidth(), resource->GetHeight()); } + return TRUE; } - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) + else if (name == "width") { wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + int width, height; + m_propertyWindow->GetSize(&width, &height); + int newWidth = (int)property->GetValue().IntegerValue(); + int pixelWidth = newWidth; + + // We need to convert to pixels if this is not a dialog or panel, but + // the parent resource specifies dialog units. + if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) { - wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(width, newHeight)); - pixelHeight = sz.y; + wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(newWidth, height)); + pixelWidth = sz.x; + } } + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) + { + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(newWidth, height)); + pixelWidth = sz.x; + } + } + + if (width != pixelWidth) + { + m_propertyWindow->SetSize(pixelWidth, height); + resource->SetSize(resource->GetX(), resource->GetY(), newWidth, resource->GetHeight()); + } + return TRUE; } - - if (height != pixelHeight) - { - m_propertyWindow->SetSize(width, pixelHeight); - resource->SetSize(resource->GetX(), resource->GetY(), resource->GetWidth(), newHeight); - } - return TRUE; - } - else if (name == "id") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - if (resource) + else if (name == "height") { - wxString value = property->GetValue().StringValue(); - - wxString strName = value.Before('='); - wxString strId = value.After('='); - int id = atoi(strId); - - wxString oldSymbolName = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetSymbolForId(resource->GetId()); - int oldSymbolId = resource->GetId(); - - if (strName != "") + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + int width, height; + m_propertyWindow->GetSize(&width, &height); + int newHeight = (int)property->GetValue().IntegerValue(); + int pixelHeight = newHeight; + + // We need to convert to pixels if this is not a dialog or panel, but + // the parent resource specifies dialog units. + if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) { - // If we change the id for an existing symbol, we need to: - // 1) Check if there are any other resources currently using the original id. - // If so, will need to change their id to the new id. - // 2) Remove the old symbol, add the new symbol. - // In this check, we don't have to do this, but we need to do it in SetProperty. - - if (strName == oldSymbolName && id != oldSymbolId) + wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) { - wxASSERT( (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(oldSymbolName)) ); - - // It's OK to change just the id. But we'll need to change all matching ids in all resources, - // because ids are unique and changing one resource's id must change all identical ones. - wxResourceManager::GetCurrentResourceManager()->ChangeIds(oldSymbolId, id); - - wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().RemoveSymbol(oldSymbolName); - wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().AddSymbol(strName, id); + wxSize sz = m_propertyWindow->GetParent()->ConvertDialogToPixels(wxSize(width, newHeight)); + pixelHeight = sz.y; } - - // If we change the name but not the id, we'll just need to remove and - // re-add the symbol/id pair. - if (strName != oldSymbolName && id == oldSymbolId) + } + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) + { + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) { - wxASSERT( (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(oldSymbolName)) ); - - wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().RemoveSymbol(oldSymbolName); - - if (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().SymbolExists(strName)) - { - wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().AddSymbol(strName, id); - } + wxSize sz = m_propertyWindow->ConvertDialogToPixels(wxSize(width, newHeight)); + pixelHeight = sz.y; } - - // What if we're changing both the name and the id? - // - if there's no symbol of that name, just remove the old, add the new (in SetProperty) - // - if there is a symbol of that name, if id matches, do nothing. If not, veto. - - if (strName != oldSymbolName && id != oldSymbolId) + } + + if (height != pixelHeight) + { + m_propertyWindow->SetSize(width, pixelHeight); + resource->SetSize(resource->GetX(), resource->GetY(), resource->GetWidth(), newHeight); + } + return TRUE; + } + else if (name == "id") + { + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + if (resource) + { + wxString value = property->GetValue().StringValue(); + + wxString strName = value.Before('='); + wxString strId = value.After('='); + int id = atoi(strId); + + wxString oldSymbolName = wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().GetSymbolForId(resource->GetId()); + int oldSymbolId = resource->GetId(); + + if (strName != "") { - // Remove old symbol if it's not being used - if (!wxResourceManager::GetCurrentResourceManager()->IsSymbolUsed(resource, oldSymbolId) && - !wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(oldSymbolName)) + // If we change the id for an existing symbol, we need to: + // 1) Check if there are any other resources currently using the original id. + // If so, will need to change their id to the new id. + // 2) Remove the old symbol, add the new symbol. + // In this check, we don't have to do this, but we need to do it in SetProperty. + + if (strName == oldSymbolName && id != oldSymbolId) + { + wxASSERT( (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(oldSymbolName)) ); + + // It's OK to change just the id. But we'll need to change all matching ids in all resources, + // because ids are unique and changing one resource's id must change all identical ones. + wxResourceManager::GetCurrentResourceManager()->ChangeIds(oldSymbolId, id); + + wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().RemoveSymbol(oldSymbolName); + wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().AddSymbol(strName, id); + } + + // If we change the name but not the id, we'll just need to remove and + // re-add the symbol/id pair. + if (strName != oldSymbolName && id == oldSymbolId) { + wxASSERT( (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(oldSymbolName)) ); + wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().RemoveSymbol(oldSymbolName); + + if (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().SymbolExists(strName)) + { + wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().AddSymbol(strName, id); + } } - - if (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().SymbolExists(strName)) + + // What if we're changing both the name and the id? + // - if there's no symbol of that name, just remove the old, add the new (in SetProperty) + // - if there is a symbol of that name, if id matches, do nothing. If not, veto. + + if (strName != oldSymbolName && id != oldSymbolId) { - wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().AddSymbol(strName, id); + // Remove old symbol if it's not being used + if (!wxResourceManager::GetCurrentResourceManager()->IsSymbolUsed(resource, oldSymbolId) && + !wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(oldSymbolName)) + { + wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().RemoveSymbol(oldSymbolName); + } + + if (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().SymbolExists(strName)) + { + wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().AddSymbol(strName, id); + } } + resource->SetId(id); } - resource->SetId(id); + + return TRUE; } - + else + return FALSE; + } + else if (name == "border") + { + long borderStyle = 0; + wxString val = property->GetValue().StringValue(); + + if (val == "wxSIMPLE_BORDER") + borderStyle = wxSIMPLE_BORDER; + else if (val == "wxRAISED_BORDER") + borderStyle = wxRAISED_BORDER; + else if (val == "wxSUNKEN_BORDER") + borderStyle = wxSUNKEN_BORDER; + else if (val == "wxDOUBLE_BORDER") + borderStyle = wxDOUBLE_BORDER; + else if (val == "wxSTATIC_BORDER") + borderStyle = wxSTATIC_BORDER; + else if (val == "wxNO_BORDER") + borderStyle = wxNO_BORDER; + + SetWindowStyle(m_propertyWindow, wxSIMPLE_BORDER, FALSE); + SetWindowStyle(m_propertyWindow, wxRAISED_BORDER, FALSE); + SetWindowStyle(m_propertyWindow, wxSUNKEN_BORDER, FALSE); + SetWindowStyle(m_propertyWindow, wxDOUBLE_BORDER, FALSE); + SetWindowStyle(m_propertyWindow, wxSTATIC_BORDER, FALSE); + SetWindowStyle(m_propertyWindow, wxNO_BORDER, FALSE); + + SetWindowStyle(m_propertyWindow, borderStyle, TRUE); + + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); return TRUE; } else return FALSE; - } - else if (name == "border") - { - long borderStyle = wxNO_BORDER; - wxString val = property->GetValue().StringValue(); - - if (val == "wxSIMPLE_BORDER") - borderStyle = wxSIMPLE_BORDER; - else if (val == "wxRAISED_BORDER") - borderStyle = wxRAISED_BORDER; - else if (val == "wxSUNKEN_BORDER") - borderStyle = wxSUNKEN_BORDER; - else if (val == "wxDOUBLE_BORDER") - borderStyle = wxDOUBLE_BORDER; - else if (val == "wxSTATIC_BORDER") - borderStyle = wxSTATIC_BORDER; - else - borderStyle = wxNO_BORDER; - - SetWindowStyle(m_propertyWindow, wxSIMPLE_BORDER, FALSE); - SetWindowStyle(m_propertyWindow, wxRAISED_BORDER, FALSE); - SetWindowStyle(m_propertyWindow, wxSUNKEN_BORDER, FALSE); - SetWindowStyle(m_propertyWindow, wxDOUBLE_BORDER, FALSE); - SetWindowStyle(m_propertyWindow, wxSTATIC_BORDER, FALSE); - SetWindowStyle(m_propertyWindow, wxNO_BORDER, FALSE); - - SetWindowStyle(m_propertyWindow, borderStyle, TRUE); - - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); - return TRUE; - } - else - return FALSE; } void wxWindowPropertyInfo::GetPropertyNames(wxStringList& names) { - names.Add("id"); - names.Add("name"); - names.Add("x"); - names.Add("y"); - names.Add("width"); - names.Add("height"); - names.Add("border"); - if (!m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) - { - names.Add("fontPoints"); - names.Add("fontFamily"); - names.Add("fontStyle"); - names.Add("fontWeight"); - names.Add("fontUnderlined"); - } + names.Add("id"); + names.Add("name"); + names.Add("x"); + names.Add("y"); + names.Add("width"); + names.Add("height"); + names.Add("border"); + if (!m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) + { + names.Add("fontPoints"); + names.Add("fontFamily"); + names.Add("fontStyle"); + names.Add("fontWeight"); + names.Add("fontUnderlined"); + } } // Fill in the wxItemResource members to mirror the current window settings bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource) { -// resource->SetType(m_propertyWindow->GetClassInfo()->GetClassName()); - -// resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); - wxString str(m_propertyWindow->GetName()); - resource->SetName(str); - + // resource->SetType(m_propertyWindow->GetClassInfo()->GetClassName()); + + // resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); + wxString str(m_propertyWindow->GetName()); + resource->SetName(str); + #if 0 // Why did we comment this out? Possibly because of rounding errors - // that will build up as the conversion is repeatedly done. - // so only do the conversion when a resize happens. - int x, y, w, h; - - if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) - m_propertyWindow->GetClientSize(&w, &h); - else - m_propertyWindow->GetSize(&w, &h); - - m_propertyWindow->GetPosition(&x, &y); - - // We need to convert to dialog units if this is not a dialog or panel, but - // the parent resource specifies dialog units. - if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) - { - wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) - { - wxPoint pt = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxPoint(x, y)); - x = pt.x; y = pt.y; - wxSize sz = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxSize(w, h)); - w = sz.x; h = sz.y; - } - } - else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) - { - if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) - { - wxPoint pt = m_propertyWindow->ConvertPixelsToDialog(wxPoint(x, y)); - x = pt.x; y = pt.y; - wxSize sz = m_propertyWindow->ConvertPixelsToDialog(wxSize(w, h)); - w = sz.x; h = sz.y; - } - } - - resource->SetSize(x, y, w, h); + // that will build up as the conversion is repeatedly done. + // so only do the conversion when a resize happens. + int x, y, w, h; + + if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) + m_propertyWindow->GetClientSize(&w, &h); + else + m_propertyWindow->GetSize(&w, &h); + + m_propertyWindow->GetPosition(&x, &y); + + // We need to convert to dialog units if this is not a dialog or panel, but + // the parent resource specifies dialog units. + if (m_propertyWindow->GetParent() && m_propertyWindow->IsKindOf(CLASSINFO(wxControl))) + { + wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxPoint pt = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxPoint(x, y)); + x = pt.x; y = pt.y; + wxSize sz = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxSize(w, h)); + w = sz.x; h = sz.y; + } + } + else if (m_propertyWindow->IsKindOf(CLASSINFO(wxPanel))) + { + if (resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + wxPoint pt = m_propertyWindow->ConvertPixelsToDialog(wxPoint(x, y)); + x = pt.x; y = pt.y; + wxSize sz = m_propertyWindow->ConvertPixelsToDialog(wxSize(w, h)); + w = sz.x; h = sz.y; + } + } + + resource->SetSize(x, y, w, h); #endif - - return TRUE; + + return TRUE; } // Set the window style @@ -748,7 +750,7 @@ void wxWindowPropertyInfo::SetWindowStyle(wxWindow* win, long style, bool set) { if (style == 0) return; - + if ((win->GetWindowStyleFlag() & style) == style) { if (!set) @@ -766,1482 +768,1496 @@ void wxWindowPropertyInfo::SetWindowStyle(wxWindow* win, long style, bool set) } /* - * Controls - */ +* Controls +*/ wxProperty *wxItemPropertyInfo::GetProperty(wxString& name) { - wxControl *itemWindow = (wxControl *)m_propertyWindow; - wxFont *font = & itemWindow->GetFont(); - - if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || - name == "fontUnderlined") - return GetFontProperty(name, font); - else if (name == "label" && itemWindow->GetLabel()) - return new wxProperty("label", m_propertyWindow->GetLabel(), "string"); - else - return wxWindowPropertyInfo::GetProperty(name); + wxControl *itemWindow = (wxControl *)m_propertyWindow; + wxFont *font = & itemWindow->GetFont(); + + if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || + name == "fontUnderlined") + return GetFontProperty(name, font); + else if (name == "label" && itemWindow->GetLabel()) + return new wxProperty("label", m_propertyWindow->GetLabel(), "string"); + else + return wxWindowPropertyInfo::GetProperty(name); } bool wxItemPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxControl *itemWindow = (wxControl *)m_propertyWindow; + wxControl *itemWindow = (wxControl *)m_propertyWindow; #if 0 - wxFont *font = & itemWindow->GetFont(); - - if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" )) - { - wxFont *newFont = SetFontProperty(name, property, font); - if (newFont) - itemWindow->SetFont(* newFont); - return TRUE; - } - else + wxFont *font = & itemWindow->GetFont(); + + if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" )) + { + wxFont *newFont = SetFontProperty(name, property, font); + if (newFont) + itemWindow->SetFont(* newFont); + return TRUE; + } + else #endif - if (name == "label") - { - itemWindow->SetLabel(property->GetValue().StringValue()); - return TRUE; - } - else - return wxWindowPropertyInfo::SetProperty(name, property); + if (name == "label") + { + itemWindow->SetLabel(property->GetValue().StringValue()); + return TRUE; + } + else + return wxWindowPropertyInfo::SetProperty(name, property); } void wxItemPropertyInfo::GetPropertyNames(wxStringList& names) { - wxWindowPropertyInfo::GetPropertyNames(names); - - names.Add("fontPoints"); - names.Add("fontFamily"); - names.Add("fontStyle"); - names.Add("fontWeight"); - names.Add("fontUnderlined"); + wxWindowPropertyInfo::GetPropertyNames(names); + + names.Add("fontPoints"); + names.Add("fontFamily"); + names.Add("fontStyle"); + names.Add("fontWeight"); + names.Add("fontUnderlined"); } bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxWindowPropertyInfo::InstantiateResource(resource); - - wxControl *item = (wxControl *)m_propertyWindow; - wxString str(item->GetLabel()); - resource->SetTitle(str); - - if (item->GetFont().Ok()) - resource->SetFont(* wxTheFontList->FindOrCreateFont(item->GetFont().GetPointSize(), - item->GetFont().GetFamily(), item->GetFont().GetStyle(), item->GetFont().GetWeight(), - item->GetFont().GetUnderlined(), item->GetFont().GetFaceName())); - return TRUE; + wxWindowPropertyInfo::InstantiateResource(resource); + + wxControl *item = (wxControl *)m_propertyWindow; + wxString str(item->GetLabel()); + resource->SetTitle(str); + + if (item->GetFont().Ok()) + resource->SetFont(* wxTheFontList->FindOrCreateFont(item->GetFont().GetPointSize(), + item->GetFont().GetFamily(), item->GetFont().GetStyle(), item->GetFont().GetWeight(), + item->GetFont().GetUnderlined(), item->GetFont().GetFaceName())); + return TRUE; } /* - * Button - */ +* Button +*/ wxProperty *wxButtonPropertyInfo::GetProperty(wxString& name) { - return wxItemPropertyInfo::GetProperty(name); + return wxItemPropertyInfo::GetProperty(name); } bool wxButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - return wxItemPropertyInfo::SetProperty(name, property); + return wxItemPropertyInfo::SetProperty(name, property); } void wxButtonPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("label"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("label"); } bool wxButtonPropertyInfo::InstantiateResource(wxItemResource *resource) { - return wxItemPropertyInfo::InstantiateResource(resource); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * wxBitmapButton - */ +* wxBitmapButton +*/ wxProperty *wxBitmapButtonPropertyInfo::GetProperty(wxString& name) { - wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow; - if (name == "bitmapFilename") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button); - wxString str("none.bmp"); - - if (resource) + wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow; + if (name == "bitmapFilename") { - str = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource); + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button); + wxString str("none.bmp"); + + if (resource) + { + str = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource); + } + return new wxProperty("bitmapFilename", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")); } - return new wxProperty("bitmapFilename", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")); - } - else - return wxButtonPropertyInfo::GetProperty(name); + else + return wxButtonPropertyInfo::GetProperty(name); } bool wxBitmapButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow; - if (name == "bitmapFilename") - { - char *s = property->GetValue().StringValue(); - if (s && wxFileExists(s)) + wxBitmapButton *button = (wxBitmapButton *)m_propertyWindow; + if (name == "bitmapFilename") { - wxString str(s); - wxBitmap *bitmap = new wxBitmap(str, wxBITMAP_TYPE_BMP); - if (!bitmap->Ok()) - { - delete bitmap; - return FALSE; - } - else - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button); - if (resource) + char *s = property->GetValue().StringValue(); + if (s && wxFileExists(s)) { - wxString oldResource(resource->GetValue4()); - wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(str); - resource->SetValue4(resName); - - if (!oldResource.IsNull()) - wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(oldResource); + wxString str(s); + wxBitmap *bitmap = new wxBitmap(str, wxBITMAP_TYPE_BMP); + if (!bitmap->Ok()) + { + delete bitmap; + return FALSE; + } + else + { + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(button); + if (resource) + { + wxString oldResource(resource->GetValue4()); + wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(str); + resource->SetValue4(resName); + + if (!oldResource.IsNull()) + wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(oldResource); + } + + button->SetLabel(* bitmap); + return TRUE; + } } - - button->SetLabel(* bitmap); - return TRUE; - } + return FALSE; } - return FALSE; - } - else - return wxButtonPropertyInfo::SetProperty(name, property); + else + return wxButtonPropertyInfo::SetProperty(name, property); } void wxBitmapButtonPropertyInfo::GetPropertyNames(wxStringList& names) { - wxButtonPropertyInfo::GetPropertyNames(names); - names.Delete("label"); - names.Add("bitmapFilename"); + wxButtonPropertyInfo::GetPropertyNames(names); + names.Delete("label"); + names.Add("bitmapFilename"); } bool wxBitmapButtonPropertyInfo::InstantiateResource(wxItemResource *resource) { - return wxItemPropertyInfo::InstantiateResource(resource); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * wxStaticText - */ +* wxStaticText +*/ wxProperty *wxStaticTextPropertyInfo::GetProperty(wxString& name) { - return wxItemPropertyInfo::GetProperty(name); + return wxItemPropertyInfo::GetProperty(name); } bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxStaticText* itemWindow = (wxStaticText*) m_propertyWindow; - if (name == "label") - { - // Because setting a wxStaticText control's label may change the - // size, we must get the size and instantiate the resource immediately. - itemWindow->SetLabel(property->GetValue().StringValue()); - int w, h; - - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(itemWindow); - - m_propertyWindow->GetSize(&w, &h); - // m_propertyWindow->GetPosition(&x, &y); - - // We need to convert to dialog units if - // the parent resource specifies dialog units. - if (m_propertyWindow->GetParent()) + wxStaticText* itemWindow = (wxStaticText*) m_propertyWindow; + if (name == "label") { - wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); - if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + // Because setting a wxStaticText control's label may change the + // size, we must get the size and instantiate the resource immediately. + itemWindow->SetLabel(property->GetValue().StringValue()); + int w, h; + + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(itemWindow); + + m_propertyWindow->GetSize(&w, &h); + // m_propertyWindow->GetPosition(&x, &y); + + // We need to convert to dialog units if + // the parent resource specifies dialog units. + if (m_propertyWindow->GetParent()) { - // wxPoint pt = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxPoint(x, y)); - // x = pt.x; y = pt.y; - wxSize sz = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxSize(w, h)); - w = sz.x; h = sz.y; + wxItemResource* parentResource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow->GetParent()); + if (parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) + { + // wxPoint pt = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxPoint(x, y)); + // x = pt.x; y = pt.y; + wxSize sz = m_propertyWindow->GetParent()->ConvertPixelsToDialog(wxSize(w, h)); + w = sz.x; h = sz.y; + } } + resource->SetSize(resource->GetX(), resource->GetY(), w, h); + return TRUE; } - resource->SetSize(resource->GetX(), resource->GetY(), w, h); - return TRUE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + else + return wxItemPropertyInfo::SetProperty(name, property); } void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("label"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("label"); } bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource) { - return wxItemPropertyInfo::InstantiateResource(resource); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * wxStaticBitmap - */ +* wxStaticBitmap +*/ wxProperty *wxStaticBitmapPropertyInfo::GetProperty(wxString& name) { - wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow; - if (name == "bitmapFilename") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message); - wxString str("none.bmp"); - - if (resource) + wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow; + if (name == "bitmapFilename") { - str = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource); + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message); + wxString str("none.bmp"); + + if (resource) + { + str = wxResourceManager::GetCurrentResourceManager()->FindBitmapFilenameForResource(resource); + } + return new wxProperty("bitmapFilename", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")); } - return new wxProperty("bitmapFilename", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")); - } - else - return wxItemPropertyInfo::GetProperty(name); + else + return wxItemPropertyInfo::GetProperty(name); } bool wxStaticBitmapPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow; - if (name == "bitmapFilename") - { - char *s = property->GetValue().StringValue(); - if (s && wxFileExists(s)) + wxStaticBitmap *message = (wxStaticBitmap *)m_propertyWindow; + if (name == "bitmapFilename") { - wxString str(s); - - wxBitmap *bitmap = new wxBitmap(str, wxBITMAP_TYPE_BMP); - if (!bitmap->Ok()) - { - delete bitmap; - return FALSE; - } - else - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message); - if (resource) + char *s = property->GetValue().StringValue(); + if (s && wxFileExists(s)) { - wxString oldResource(resource->GetValue4()); - wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(str); - resource->SetValue4(resName); - - if (!oldResource.IsNull()) - wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(oldResource); + wxString str(s); + + wxBitmap *bitmap = new wxBitmap(str, wxBITMAP_TYPE_BMP); + if (!bitmap->Ok()) + { + delete bitmap; + return FALSE; + } + else + { + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(message); + if (resource) + { + wxString oldResource(resource->GetValue4()); + wxString resName = wxResourceManager::GetCurrentResourceManager()->AddBitmapResource(str); + resource->SetValue4(resName); + + if (!oldResource.IsNull()) + wxResourceManager::GetCurrentResourceManager()->PossiblyDeleteBitmapResource(oldResource); + } + + message->SetBitmap(* bitmap); + return TRUE; + } } - - message->SetBitmap(* bitmap); - return TRUE; - } + return FALSE; } - return FALSE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + else + return wxItemPropertyInfo::SetProperty(name, property); } void wxStaticBitmapPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("bitmapFilename"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("bitmapFilename"); } bool wxStaticBitmapPropertyInfo::InstantiateResource(wxItemResource *resource) { - return wxItemPropertyInfo::InstantiateResource(resource); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Text item - */ +* Text item +*/ wxProperty *wxTextPropertyInfo::GetProperty(wxString& name) { - wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; - if (name == "value") - return new wxProperty("value", text->GetValue(), "string"); - else if (name == "password") - { - bool isPassword = ((text->GetWindowStyleFlag() & wxTE_PASSWORD) == wxTE_PASSWORD); - return new wxProperty("password", isPassword, "bool"); - } - else if (name == "readonly") - { - bool isReadOnly = ((text->GetWindowStyleFlag() & wxTE_READONLY) == wxTE_READONLY); - return new wxProperty("readonly", isReadOnly, "bool"); - } - else - return wxItemPropertyInfo::GetProperty(name); + wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; + if (name == "value") + return new wxProperty("value", text->GetValue(), "string"); + else if (name == "password") + { + bool isPassword = ((text->GetWindowStyleFlag() & wxTE_PASSWORD) == wxTE_PASSWORD); + return new wxProperty("password", isPassword, "bool"); + } + else if (name == "readonly") + { + bool isReadOnly = ((text->GetWindowStyleFlag() & wxTE_READONLY) == wxTE_READONLY); + return new wxProperty("readonly", isReadOnly, "bool"); + } + else + return wxItemPropertyInfo::GetProperty(name); } bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; - if (name == "value") - { - text->SetValue(property->GetValue().StringValue()); - return TRUE; - } - else if (name == "password") - { - long flag = text->GetWindowStyleFlag(); - if (property->GetValue().BoolValue()) + wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; + if (name == "value") { - if ((flag & wxTE_PASSWORD) != wxTE_PASSWORD) - flag |= wxTE_PASSWORD; + text->SetValue(property->GetValue().StringValue()); + return TRUE; } - else + else if (name == "password") { - if ((flag & wxTE_PASSWORD) == wxTE_PASSWORD) - flag -= wxTE_PASSWORD; + long flag = text->GetWindowStyleFlag(); + if (property->GetValue().BoolValue()) + { + if ((flag & wxTE_PASSWORD) != wxTE_PASSWORD) + flag |= wxTE_PASSWORD; + } + else + { + if ((flag & wxTE_PASSWORD) == wxTE_PASSWORD) + flag -= wxTE_PASSWORD; + } + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text); + resource->SetStyle(flag); + + m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this); + return TRUE; } - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text); - resource->SetStyle(flag); - - m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this); - return TRUE; - } - else if (name == "readonly") - { - long flag = text->GetWindowStyleFlag(); - if (property->GetValue().BoolValue()) + else if (name == "readonly") { - if ((flag & wxTE_READONLY) != wxTE_READONLY) - flag |= wxTE_READONLY; + long flag = text->GetWindowStyleFlag(); + if (property->GetValue().BoolValue()) + { + if ((flag & wxTE_READONLY) != wxTE_READONLY) + flag |= wxTE_READONLY; + } + else + { + if ((flag & wxTE_READONLY) == wxTE_READONLY) + flag -= wxTE_READONLY; + } + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text); + resource->SetStyle(flag); + + m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this); + return TRUE; } else - { - if ((flag & wxTE_READONLY) == wxTE_READONLY) - flag -= wxTE_READONLY; - } - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(text); - resource->SetStyle(flag); - - m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(text, this); - return TRUE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + return wxItemPropertyInfo::SetProperty(name, property); } void wxTextPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("value"); - names.Add("readonly"); - names.Add("password"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("value"); + names.Add("readonly"); + names.Add("password"); } bool wxTextPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; - wxString str(text->GetValue()); - resource->SetValue4(str); + wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; + wxString str(text->GetValue()); + resource->SetValue4(str); - return wxItemPropertyInfo::InstantiateResource(resource); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Listbox item - */ +* Listbox item +*/ wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name) { - wxListBox *listBox = (wxListBox *)m_propertyWindow; - if (name == "values") - { - wxStringList *stringList = new wxStringList; - int i; - for (i = 0; i < listBox->Number(); i++) - stringList->Add(listBox->GetString(i)); - - return new wxProperty(name, stringList, "stringlist"); - } - else if (name == "multiple") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox); - if (!resource) - return NULL; - - char *mult = "wxLB_SINGLE"; - - if ((listBox->GetWindowStyleFlag() & wxLB_MULTIPLE) != 0) - mult = "wxLB_MULTIPLE"; - else if ((listBox->GetWindowStyleFlag() & wxLB_EXTENDED) != 0) - mult = "wxLB_EXTENDED"; + wxListBox *listBox = (wxListBox *)m_propertyWindow; + if (name == "values") + { + wxStringList *stringList = new wxStringList; + int i; + for (i = 0; i < listBox->Number(); i++) + stringList->Add(listBox->GetString(i)); + + return new wxProperty(name, stringList, "stringlist"); + } + else if (name == "multiple") + { + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox); + if (!resource) + return NULL; + + char *mult = "wxLB_SINGLE"; + + if ((listBox->GetWindowStyleFlag() & wxLB_MULTIPLE) != 0) + mult = "wxLB_MULTIPLE"; + else if ((listBox->GetWindowStyleFlag() & wxLB_EXTENDED) != 0) + mult = "wxLB_EXTENDED"; + else + mult = "wxLB_SINGLE"; + + return new wxProperty("multiple", mult, "string", + new wxStringListValidator(new wxStringList("wxLB_SINGLE", "wxLB_MULTIPLE", "wxLB_EXTENDED", + NULL))); + } else - mult = "wxLB_SINGLE"; - - return new wxProperty("multiple", mult, "string", - new wxStringListValidator(new wxStringList("wxLB_SINGLE", "wxLB_MULTIPLE", "wxLB_EXTENDED", - NULL))); - } - else - return wxItemPropertyInfo::GetProperty(name); + return wxItemPropertyInfo::GetProperty(name); } bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxListBox *listBox = (wxListBox *)m_propertyWindow; - if (name == "values") - { - listBox->Clear(); - wxPropertyValue *expr = property->GetValue().GetFirst(); - while (expr) + wxListBox *listBox = (wxListBox *)m_propertyWindow; + if (name == "values") { - char *s = expr->StringValue(); - if (s) - listBox->Append(s); - expr = expr->GetNext(); + listBox->Clear(); + wxPropertyValue *expr = property->GetValue().GetFirst(); + while (expr) + { + char *s = expr->StringValue(); + if (s) + listBox->Append(s); + expr = expr->GetNext(); + } + return TRUE; + } + else if (name == "multiple") + { + SetWindowStyle(m_propertyWindow, wxLB_SINGLE, FALSE); + SetWindowStyle(m_propertyWindow, wxLB_MULTIPLE, FALSE); + SetWindowStyle(m_propertyWindow, wxLB_EXTENDED, FALSE); + + wxString str(property->GetValue().StringValue()); + if (str == "wxLB_MULTIPLE") + SetWindowStyle(m_propertyWindow, wxLB_MULTIPLE, TRUE); + else if (str == "wxLB_EXTENDED") + SetWindowStyle(m_propertyWindow, wxLB_EXTENDED, TRUE); + else + SetWindowStyle(m_propertyWindow, wxLB_SINGLE, TRUE); + + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox); + if (resource) + resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); + m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this); + return TRUE; } - return TRUE; - } - else if (name == "multiple") - { - SetWindowStyle(m_propertyWindow, wxLB_SINGLE, FALSE); - SetWindowStyle(m_propertyWindow, wxLB_MULTIPLE, FALSE); - SetWindowStyle(m_propertyWindow, wxLB_EXTENDED, FALSE); - - wxString str(property->GetValue().StringValue()); - if (str == "wxLB_MULTIPLE") - SetWindowStyle(m_propertyWindow, wxLB_MULTIPLE, TRUE); - else if (str == "wxLB_EXTENDED") - SetWindowStyle(m_propertyWindow, wxLB_EXTENDED, TRUE); else - SetWindowStyle(m_propertyWindow, wxLB_SINGLE, TRUE); - - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(listBox); - if (resource) - resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); - m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(listBox, this); - return TRUE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + return wxItemPropertyInfo::SetProperty(name, property); } void wxListBoxPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("values"); - names.Add("multiple"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("values"); + names.Add("multiple"); } bool wxListBoxPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxListBox *lbox = (wxListBox *)m_propertyWindow; - // This will be set for the wxItemResource on reading or in SetProperty -// resource->SetValue1(lbox->GetSelectionMode()); - int i; - if (lbox->Number() == 0) - resource->SetStringValues(NULL); - else - { - wxStringList slist; - - for (i = 0; i < lbox->Number(); i++) - slist.Add(lbox->GetString(i)); - - resource->SetStringValues(slist); - } - return wxItemPropertyInfo::InstantiateResource(resource); + wxListBox *lbox = (wxListBox *)m_propertyWindow; + // This will be set for the wxItemResource on reading or in SetProperty + // resource->SetValue1(lbox->GetSelectionMode()); + int i; + if (lbox->Number() == 0) + resource->SetStringValues(NULL); + else + { + wxStringList slist; + + for (i = 0; i < lbox->Number(); i++) + slist.Add(lbox->GetString(i)); + + resource->SetStringValues(slist); + } + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Choice item - */ +* Choice item +*/ wxProperty *wxChoicePropertyInfo::GetProperty(wxString& name) { - wxChoice *choice = (wxChoice *)m_propertyWindow; - if (name == "values") - { - wxStringList* stringList = new wxStringList; - int i; - for (i = 0; i < choice->Number(); i++) - stringList->Add(choice->GetString(i)); - - return new wxProperty(name, stringList, "stringlist"); - } - else - return wxItemPropertyInfo::GetProperty(name); + wxChoice *choice = (wxChoice *)m_propertyWindow; + if (name == "values") + { + wxStringList* stringList = new wxStringList; + int i; + for (i = 0; i < choice->Number(); i++) + stringList->Add(choice->GetString(i)); + + return new wxProperty(name, stringList, "stringlist"); + } + else + return wxItemPropertyInfo::GetProperty(name); } bool wxChoicePropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxChoice *choice = (wxChoice *)m_propertyWindow; - if (name == "values") - { - choice->Clear(); - wxPropertyValue *expr = property->GetValue().GetFirst(); - while (expr) + wxChoice *choice = (wxChoice *)m_propertyWindow; + if (name == "values") { - char *s = expr->StringValue(); - if (s) - choice->Append(s); - expr = expr->GetNext(); + choice->Clear(); + wxPropertyValue *expr = property->GetValue().GetFirst(); + while (expr) + { + char *s = expr->StringValue(); + if (s) + choice->Append(s); + expr = expr->GetNext(); + } + if (choice->Number() > 0) + choice->SetSelection(0); + return TRUE; } - if (choice->Number() > 0) - choice->SetSelection(0); - return TRUE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + else + return wxItemPropertyInfo::SetProperty(name, property); } void wxChoicePropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("values"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("values"); } bool wxChoicePropertyInfo::InstantiateResource(wxItemResource *resource) { - wxChoice *choice = (wxChoice *)m_propertyWindow; - int i; - if (choice->Number() == 0) - resource->SetStringValues(NULL); - else - { - wxStringList slist; - - for (i = 0; i < choice->Number(); i++) - slist.Add(choice->GetString(i)); - - resource->SetStringValues(slist); - } - return wxItemPropertyInfo::InstantiateResource(resource); + wxChoice *choice = (wxChoice *)m_propertyWindow; + int i; + if (choice->Number() == 0) + resource->SetStringValues(NULL); + else + { + wxStringList slist; + + for (i = 0; i < choice->Number(); i++) + slist.Add(choice->GetString(i)); + + resource->SetStringValues(slist); + } + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Choice item - */ +* Choice item +*/ wxProperty *wxComboBoxPropertyInfo::GetProperty(wxString& name) { - wxComboBox *choice = (wxComboBox *)m_propertyWindow; - if (name == "values") - { - wxStringList *stringList = new wxStringList; - int i; - for (i = 0; i < choice->Number(); i++) - stringList->Add(choice->GetString(i)); - - return new wxProperty(name, stringList, "stringlist"); - } - else if (name == "sort") - { - bool sort = ((m_propertyWindow->GetWindowStyleFlag() & wxCB_SORT) == wxCB_SORT); - return new wxProperty(name, sort, "bool"); - } - else if (name == "style") - { - wxString styleStr("dropdown"); - if (m_propertyWindow->GetWindowStyleFlag() & wxCB_SIMPLE) - styleStr = "simple"; - else if (m_propertyWindow->GetWindowStyleFlag() & wxCB_READONLY) - styleStr = "readonly"; + wxComboBox *choice = (wxComboBox *)m_propertyWindow; + if (name == "values") + { + wxStringList *stringList = new wxStringList; + int i; + for (i = 0; i < choice->Number(); i++) + stringList->Add(choice->GetString(i)); + + return new wxProperty(name, stringList, "stringlist"); + } + else if (name == "sort") + { + bool sort = ((m_propertyWindow->GetWindowStyleFlag() & wxCB_SORT) == wxCB_SORT); + return new wxProperty(name, sort, "bool"); + } + else if (name == "style") + { + wxString styleStr("dropdown"); + if (m_propertyWindow->GetWindowStyleFlag() & wxCB_SIMPLE) + styleStr = "simple"; + else if (m_propertyWindow->GetWindowStyleFlag() & wxCB_READONLY) + styleStr = "readonly"; + else + styleStr = "dropdown"; + + return new wxProperty(name, styleStr, "string", + new wxStringListValidator(new wxStringList("simple", "dropdown", "readonly", + NULL))); + } else - styleStr = "dropdown"; - - return new wxProperty(name, styleStr, "string", - new wxStringListValidator(new wxStringList("simple", "dropdown", "readonly", - NULL))); - } - else - return wxItemPropertyInfo::GetProperty(name); + return wxItemPropertyInfo::GetProperty(name); } bool wxComboBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxComboBox *choice = (wxComboBox *)m_propertyWindow; - if (name == "values") - { - choice->Clear(); - wxPropertyValue *expr = property->GetValue().GetFirst(); - while (expr) + wxComboBox *choice = (wxComboBox *)m_propertyWindow; + if (name == "values") { - char *s = expr->StringValue(); - if (s) - choice->Append(s); - expr = expr->GetNext(); + choice->Clear(); + wxPropertyValue *expr = property->GetValue().GetFirst(); + while (expr) + { + char *s = expr->StringValue(); + if (s) + choice->Append(s); + expr = expr->GetNext(); + } + if (choice->Number() > 0) + choice->SetSelection(0); + return TRUE; } - if (choice->Number() > 0) - choice->SetSelection(0); - return TRUE; - } - else if (name == "sort") - { - SetWindowStyle(m_propertyWindow, wxCB_SORT, property->GetValue().BoolValue()); - - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); - - m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this); - return TRUE; - } - else if (name == "style") - { - SetWindowStyle(m_propertyWindow, wxCB_SIMPLE, FALSE); - SetWindowStyle(m_propertyWindow, wxCB_DROPDOWN, FALSE); - SetWindowStyle(m_propertyWindow, wxCB_READONLY, FALSE); - - wxString styleStr(property->GetValue().StringValue()); - if (styleStr == "simple") - SetWindowStyle(m_propertyWindow, wxCB_SIMPLE, TRUE); - else if (styleStr == "dropdown") - SetWindowStyle(m_propertyWindow, wxCB_DROPDOWN, TRUE); - else if (styleStr == "readonly") - SetWindowStyle(m_propertyWindow, wxCB_READONLY, TRUE); - - // Necesary? - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); - - m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this); - - return TRUE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + else if (name == "sort") + { + SetWindowStyle(m_propertyWindow, wxCB_SORT, property->GetValue().BoolValue()); + + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); + + m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this); + return TRUE; + } + else if (name == "style") + { + SetWindowStyle(m_propertyWindow, wxCB_SIMPLE, FALSE); + SetWindowStyle(m_propertyWindow, wxCB_DROPDOWN, FALSE); + SetWindowStyle(m_propertyWindow, wxCB_READONLY, FALSE); + + wxString styleStr(property->GetValue().StringValue()); + if (styleStr == "simple") + SetWindowStyle(m_propertyWindow, wxCB_SIMPLE, TRUE); + else if (styleStr == "dropdown") + SetWindowStyle(m_propertyWindow, wxCB_DROPDOWN, TRUE); + else if (styleStr == "readonly") + SetWindowStyle(m_propertyWindow, wxCB_READONLY, TRUE); + + // Necesary? + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + resource->SetStyle(m_propertyWindow->GetWindowStyleFlag()); + + m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this); + + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); } void wxComboBoxPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("values"); - names.Add("style"); - names.Add("sort"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("values"); + names.Add("style"); + names.Add("sort"); } bool wxComboBoxPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxComboBox *choice = (wxComboBox *)m_propertyWindow; - int i; - if (choice->Number() == 0) - resource->SetStringValues(NULL); - else - { - wxStringList slist; - - for (i = 0; i < choice->Number(); i++) - slist.Add(choice->GetString(i)); - - resource->SetStringValues(slist); - } - return wxItemPropertyInfo::InstantiateResource(resource); + wxComboBox *choice = (wxComboBox *)m_propertyWindow; + int i; + if (choice->Number() == 0) + resource->SetStringValues(NULL); + else + { + wxStringList slist; + + for (i = 0; i < choice->Number(); i++) + slist.Add(choice->GetString(i)); + + resource->SetStringValues(slist); + } + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Radiobox item - */ +* Radiobox item +*/ wxProperty *wxRadioBoxPropertyInfo::GetProperty(wxString& name) { - wxRadioBox *radioBox = (wxRadioBox *)m_propertyWindow; - if (name == "numberRowsOrCols") - { - return new wxProperty("numberRowsOrCols", (long)radioBox->GetNumberOfRowsOrCols(), "integer"); - } - if (name == "orientation") - { - wxString orient; - if (m_propertyWindow->GetWindowStyleFlag() & wxRA_SPECIFY_COLS) - orient = "wxRA_SPECIFY_COLS"; - else - orient = "wxRA_SPECIFY_ROWS"; - - return new wxProperty("orientation", orient, "string", - new wxStringListValidator(new wxStringList("wxRA_SPECIFY_COLS", "wxRA_SPECIFY_ROWS", - NULL))); - } - else if (name == "values") - { - wxStringList *stringList = new wxStringList; - int i; - for (i = 0; i < radioBox->Number(); i++) - stringList->Add(radioBox->GetString(i)); - - return new wxProperty(name, stringList, "stringlist"); - } - return wxItemPropertyInfo::GetProperty(name); + wxRadioBox *radioBox = (wxRadioBox *)m_propertyWindow; + if (name == "numberRowsOrCols") + { + return new wxProperty("numberRowsOrCols", (long)radioBox->GetNumberOfRowsOrCols(), "integer"); + } + if (name == "orientation") + { + wxString orient; + if (m_propertyWindow->GetWindowStyleFlag() & wxRA_SPECIFY_COLS) + orient = "wxRA_SPECIFY_COLS"; + else + orient = "wxRA_SPECIFY_ROWS"; + + return new wxProperty("orientation", orient, "string", + new wxStringListValidator(new wxStringList("wxRA_SPECIFY_COLS", "wxRA_SPECIFY_ROWS", + NULL))); + } + else if (name == "values") + { + wxStringList *stringList = new wxStringList; + int i; + for (i = 0; i < radioBox->Number(); i++) + stringList->Add(radioBox->GetString(i)); + + return new wxProperty(name, stringList, "stringlist"); + } + return wxItemPropertyInfo::GetProperty(name); } bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxRadioBox *radioBox = (wxRadioBox *)m_propertyWindow; - if (name == "numberRowsOrCols") - { - wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(radioBox); - - radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue()); - m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this); - return TRUE; - } - else if (name == "orientation") - { - long windowStyle = radioBox->GetWindowStyleFlag(); - wxString val(property->GetValue().StringValue()); - if (val == "wxRA_SPECIFY_COLS") + wxRadioBox *radioBox = (wxRadioBox *)m_propertyWindow; + if (name == "numberRowsOrCols") { - if (windowStyle & wxRA_SPECIFY_ROWS) - windowStyle -= wxRA_SPECIFY_ROWS; - windowStyle |= wxRA_SPECIFY_COLS; + wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(radioBox); + + radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue()); + m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this); + return TRUE; } - else + else if (name == "orientation") { - if (windowStyle & wxRA_SPECIFY_COLS) - windowStyle -= wxRA_SPECIFY_COLS; - windowStyle |= wxRA_SPECIFY_ROWS; + long windowStyle = radioBox->GetWindowStyleFlag(); + wxString val(property->GetValue().StringValue()); + if (val == "wxRA_SPECIFY_COLS") + { + if (windowStyle & wxRA_SPECIFY_ROWS) + windowStyle -= wxRA_SPECIFY_ROWS; + windowStyle |= wxRA_SPECIFY_COLS; + } + else + { + if (windowStyle & wxRA_SPECIFY_COLS) + windowStyle -= wxRA_SPECIFY_COLS; + windowStyle |= wxRA_SPECIFY_ROWS; + } + wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(radioBox); + + radioBox->SetWindowStyleFlag(windowStyle); + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(radioBox); + resource->SetStyle(windowStyle); + resource->SetSize(resource->GetX(), resource->GetY(), -1, -1); // Let it calculate it's own size + + m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this, FALSE); + return TRUE; } - wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(radioBox); - - radioBox->SetWindowStyleFlag(windowStyle); - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(radioBox); - resource->SetStyle(windowStyle); - resource->SetSize(resource->GetX(), resource->GetY(), -1, -1); // Let it calculate it's own size - - m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this, FALSE); - return TRUE; - } - else if (name == "values") - { - // Set property into *resource*, not wxRadioBox, and then recreate - // the wxRadioBox. This is because we can't dynamically set the strings - // of a wxRadioBox. - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - if (!resource) - return FALSE; - - wxStringList stringList; - wxPropertyValue *expr = property->GetValue().GetFirst(); - while (expr) - { - char *s = expr->StringValue(); - if (s) - stringList.Add(s); - expr = expr->GetNext(); - } - resource->SetStringValues(stringList); - resource->SetSize(resource->GetX(), resource->GetY(), -1, -1); // Let it calculate it's own size - m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this, FALSE); - return TRUE; - } - else if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" ) - { - wxFont *font = & m_propertyWindow->GetFont(); - if (!font) - return FALSE; - wxFont *newFont = SetFontProperty(name, property, font); - if (newFont) + else if (name == "values") { - wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - if (resource) - { - resource->SetFont(* newFont); - } - - wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(radioBox); - - radioBox->SetFont(* newFont); - radioBox->SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT); - return TRUE; + // Set property into *resource*, not wxRadioBox, and then recreate + // the wxRadioBox. This is because we can't dynamically set the strings + // of a wxRadioBox. + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + if (!resource) + return FALSE; + + wxStringList stringList; + wxPropertyValue *expr = property->GetValue().GetFirst(); + while (expr) + { + char *s = expr->StringValue(); + if (s) + stringList.Add(s); + expr = expr->GetNext(); + } + resource->SetStringValues(stringList); + resource->SetSize(resource->GetX(), resource->GetY(), -1, -1); // Let it calculate it's own size + m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(radioBox, this, FALSE); + return TRUE; } - } - - return wxItemPropertyInfo::SetProperty(name, property); + else if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" ) + { + wxFont *font = & m_propertyWindow->GetFont(); + if (!font) + return FALSE; + wxFont *newFont = SetFontProperty(name, property, font); + if (newFont) + { + wxItemResource* resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); + if (resource) + { + resource->SetFont(* newFont); + } + + wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(radioBox); + + radioBox->SetFont(* newFont); + radioBox->SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT); + return TRUE; + } + } + + return wxItemPropertyInfo::SetProperty(name, property); } void wxRadioBoxPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("label"); - names.Add("values"); - names.Add("orientation"); - names.Add("numberRowsOrCols"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("label"); + names.Add("values"); + names.Add("orientation"); + names.Add("numberRowsOrCols"); } bool wxRadioBoxPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow; - // Take strings from resource instead -/* - int i; - if (rbox->Number() == 0) + wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow; + // Take strings from resource instead + /* + int i; + if (rbox->Number() == 0) resource->SetStringValues(NULL); - else - { + else + { wxStringList *slist = new wxStringList; - for (i = 0; i < rbox->Number(); i++) + for (i = 0; i < rbox->Number(); i++) slist->Add(rbox->GetString(i)); - resource->SetStringValues(slist); - } -*/ - resource->SetValue1(rbox->GetNumberOfRowsOrCols()); - return wxItemPropertyInfo::InstantiateResource(resource); + resource->SetStringValues(slist); + } + */ + resource->SetValue1(rbox->GetNumberOfRowsOrCols()); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Groupbox item - */ +* Groupbox item +*/ wxProperty *wxGroupBoxPropertyInfo::GetProperty(wxString& name) { - return wxItemPropertyInfo::GetProperty(name); + return wxItemPropertyInfo::GetProperty(name); } bool wxGroupBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - return wxItemPropertyInfo::SetProperty(name, property); + return wxItemPropertyInfo::SetProperty(name, property); } void wxGroupBoxPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("label"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("label"); } bool wxGroupBoxPropertyInfo::InstantiateResource(wxItemResource *resource) { - return wxItemPropertyInfo::InstantiateResource(resource); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Checkbox item - */ +* Checkbox item +*/ wxProperty *wxCheckBoxPropertyInfo::GetProperty(wxString& name) { - wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow; - if (name == "value") - return new wxProperty("value", checkBox->GetValue(), "bool"); - else - return wxItemPropertyInfo::GetProperty(name); + wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow; + if (name == "value") + return new wxProperty("value", checkBox->GetValue(), "bool"); + else + return wxItemPropertyInfo::GetProperty(name); } bool wxCheckBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow; - if (name == "value") - { - checkBox->SetValue((bool)property->GetValue().BoolValue()); - return TRUE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow; + if (name == "value") + { + checkBox->SetValue((bool)property->GetValue().BoolValue()); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); } void wxCheckBoxPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("label"); - names.Add("value"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("label"); + names.Add("value"); } bool wxCheckBoxPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxCheckBox *cbox = (wxCheckBox *)m_propertyWindow; - resource->SetValue1(cbox->GetValue()); - return wxItemPropertyInfo::InstantiateResource(resource); + wxCheckBox *cbox = (wxCheckBox *)m_propertyWindow; + resource->SetValue1(cbox->GetValue()); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Radiobutton item - */ +* Radiobutton item +*/ wxProperty *wxRadioButtonPropertyInfo::GetProperty(wxString& name) { - wxRadioButton *checkBox = (wxRadioButton *)m_propertyWindow; - if (name == "value") - return new wxProperty("value", checkBox->GetValue(), "bool"); - else - return wxItemPropertyInfo::GetProperty(name); + wxRadioButton *checkBox = (wxRadioButton *)m_propertyWindow; + if (name == "value") + return new wxProperty("value", checkBox->GetValue(), "bool"); + else + return wxItemPropertyInfo::GetProperty(name); } bool wxRadioButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxRadioButton *checkBox = (wxRadioButton *)m_propertyWindow; - if (name == "value") - { - checkBox->SetValue((bool)property->GetValue().BoolValue()); - return TRUE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + wxRadioButton *checkBox = (wxRadioButton *)m_propertyWindow; + if (name == "value") + { + checkBox->SetValue((bool)property->GetValue().BoolValue()); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); } void wxRadioButtonPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("label"); - names.Add("value"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("label"); + names.Add("value"); } bool wxRadioButtonPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxRadioButton *cbox = (wxRadioButton *)m_propertyWindow; - resource->SetValue1(cbox->GetValue()); - return wxItemPropertyInfo::InstantiateResource(resource); + wxRadioButton *cbox = (wxRadioButton *)m_propertyWindow; + resource->SetValue1(cbox->GetValue()); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Slider item - */ +* Slider item +*/ wxProperty *wxSliderPropertyInfo::GetProperty(wxString& name) { - wxSlider *slider = (wxSlider *)m_propertyWindow; - if (name == "value") - return new wxProperty("value", (long)slider->GetValue(), "integer"); - else if (name == "orientation") - { - char *pos = NULL; - if (m_propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL) - pos = "wxHORIZONTAL"; + wxSlider *slider = (wxSlider *)m_propertyWindow; + if (name == "value") + return new wxProperty("value", (long)slider->GetValue(), "integer"); + else if (name == "orientation") + { + char *pos = NULL; + if (m_propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL) + pos = "wxHORIZONTAL"; + else + pos = "wxVERTICAL"; + + return new wxProperty("orientation", pos, "string", + new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL", + NULL))); + } + else if (name == "minValue") + return new wxProperty("minValue", (long)slider->GetMin(), "integer"); + else if (name == "maxValue") + return new wxProperty("maxValue", (long)slider->GetMax(), "integer"); else - pos = "wxVERTICAL"; - - return new wxProperty("orientation", pos, "string", - new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL", - NULL))); - } - else if (name == "minValue") - return new wxProperty("minValue", (long)slider->GetMin(), "integer"); - else if (name == "maxValue") - return new wxProperty("maxValue", (long)slider->GetMax(), "integer"); - else - return wxItemPropertyInfo::GetProperty(name); + return wxItemPropertyInfo::GetProperty(name); } bool wxSliderPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxSlider *slider = (wxSlider *)m_propertyWindow; - if (name == "value") - { - slider->SetValue((int)property->GetValue().IntegerValue()); - return TRUE; - } - else if (name == "orientation") - { - long windowStyle = slider->GetWindowStyleFlag(); - long oldWindowStyle = windowStyle; - wxString val(property->GetValue().StringValue()); - if (val == "wxHORIZONTAL") + wxSlider *slider = (wxSlider *)m_propertyWindow; + if (name == "value") { - if (windowStyle & wxVERTICAL) - windowStyle -= wxVERTICAL; - windowStyle |= wxHORIZONTAL; + slider->SetValue((int)property->GetValue().IntegerValue()); + return TRUE; } - else + else if (name == "orientation") { - if (windowStyle & wxHORIZONTAL) - windowStyle -= wxHORIZONTAL; - windowStyle |= wxVERTICAL; + long windowStyle = slider->GetWindowStyleFlag(); + long oldWindowStyle = windowStyle; + wxString val(property->GetValue().StringValue()); + if (val == "wxHORIZONTAL") + { + if (windowStyle & wxVERTICAL) + windowStyle -= wxVERTICAL; + windowStyle |= wxHORIZONTAL; + } + else + { + if (windowStyle & wxHORIZONTAL) + windowStyle -= wxHORIZONTAL; + windowStyle |= wxVERTICAL; + } + + if (oldWindowStyle == windowStyle) + return TRUE; + + slider->SetWindowStyleFlag(windowStyle); + + // If the window style has changed, we swap the width and height parameters. + int w, h; + slider->GetSize(&w, &h); + + slider = (wxSlider *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(slider, this); + slider->SetSize(-1, -1, h, w); + m_propertyWindow = slider; + + return TRUE; } - - if (oldWindowStyle == windowStyle) - return TRUE; - - slider->SetWindowStyleFlag(windowStyle); - - // If the window style has changed, we swap the width and height parameters. - int w, h; - slider->GetSize(&w, &h); - - slider = (wxSlider *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(slider, this); - slider->SetSize(-1, -1, h, w); - m_propertyWindow = slider; - - return TRUE; - } - else if (name == "minValue") - { - slider->SetRange((int)property->GetValue().IntegerValue(), slider->GetMax()); - return TRUE; - } - else if (name == "maxValue") - { - slider->SetRange(slider->GetMin(), (int)property->GetValue().IntegerValue()); - return TRUE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + else if (name == "minValue") + { + slider->SetRange((int)property->GetValue().IntegerValue(), slider->GetMax()); + return TRUE; + } + else if (name == "maxValue") + { + slider->SetRange(slider->GetMin(), (int)property->GetValue().IntegerValue()); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); } void wxSliderPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("value"); - names.Add("orientation"); - names.Add("minValue"); - names.Add("maxValue"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("value"); + names.Add("orientation"); + names.Add("minValue"); + names.Add("maxValue"); } bool wxSliderPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxSlider *slider = (wxSlider *)m_propertyWindow; - resource->SetValue1(slider->GetValue()); - resource->SetValue2(slider->GetMin()); - resource->SetValue3(slider->GetMax()); - return wxItemPropertyInfo::InstantiateResource(resource); + wxSlider *slider = (wxSlider *)m_propertyWindow; + resource->SetValue1(slider->GetValue()); + resource->SetValue2(slider->GetMin()); + resource->SetValue3(slider->GetMax()); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Gauge item - */ +* Gauge item +*/ wxProperty *wxGaugePropertyInfo::GetProperty(wxString& name) { - wxGauge *gauge = (wxGauge *)m_propertyWindow; - if (name == "value") - return new wxProperty("value", (long)gauge->GetValue(), "integer"); - else if (name == "maxValue") - return new wxProperty("maxValue", (long)gauge->GetRange(), "integer"); - else - return wxItemPropertyInfo::GetProperty(name); + wxGauge *gauge = (wxGauge *)m_propertyWindow; + if (name == "value") + return new wxProperty("value", (long)gauge->GetValue(), "integer"); + else if (name == "maxValue") + return new wxProperty("maxValue", (long)gauge->GetRange(), "integer"); + else + return wxItemPropertyInfo::GetProperty(name); } bool wxGaugePropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxGauge *gauge = (wxGauge *)m_propertyWindow; - if (name == "value") - { - gauge->SetValue((int)property->GetValue().IntegerValue()); - return TRUE; - } - else if (name == "maxValue") - { - gauge->SetRange((int)property->GetValue().IntegerValue()); - return TRUE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + wxGauge *gauge = (wxGauge *)m_propertyWindow; + if (name == "value") + { + gauge->SetValue((int)property->GetValue().IntegerValue()); + return TRUE; + } + else if (name == "maxValue") + { + gauge->SetRange((int)property->GetValue().IntegerValue()); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); } void wxGaugePropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("value"); - names.Add("maxValue"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("value"); + names.Add("maxValue"); } bool wxGaugePropertyInfo::InstantiateResource(wxItemResource *resource) { - wxGauge *gauge = (wxGauge *)m_propertyWindow; - resource->SetValue1(gauge->GetValue()); - resource->SetValue2(gauge->GetRange()); - return wxItemPropertyInfo::InstantiateResource(resource); + wxGauge *gauge = (wxGauge *)m_propertyWindow; + resource->SetValue1(gauge->GetValue()); + resource->SetValue2(gauge->GetRange()); + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Scrollbar item - */ +* Scrollbar item +*/ wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name) { - wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow; - if (name == "thumbPosition") - return new wxProperty("value", (long)scrollBar->GetThumbPosition(), "integer"); - else if (name == "orientation") - { - char *pos = NULL; - if (m_propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL) - pos = "wxHORIZONTAL"; + wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow; + if (name == "thumbPosition") + return new wxProperty("value", (long)scrollBar->GetThumbPosition(), "integer"); + else if (name == "orientation") + { + char *pos = NULL; + if (m_propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL) + pos = "wxHORIZONTAL"; + else + pos = "wxVERTICAL"; + + return new wxProperty("orientation", pos, "string", + new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL", + NULL))); + } + else if (name == "pageSize") + { + int pageLength = scrollBar->GetPageSize(); + + return new wxProperty("pageSize", (long)pageLength, "integer"); + } + else if (name == "thumbSize") + { + int thumbSize = scrollBar->GetThumbSize(); + + return new wxProperty("thumbSize", (long)thumbSize, "integer"); + } + else if (name == "range") + { + int range = scrollBar->GetRange(); + return new wxProperty("range", (long)range, "integer"); + } else - pos = "wxVERTICAL"; - - return new wxProperty("orientation", pos, "string", - new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL", - NULL))); - } - else if (name == "pageSize") - { - int pageLength = scrollBar->GetPageSize(); - - return new wxProperty("pageSize", (long)pageLength, "integer"); - } - else if (name == "thumbSize") - { - int thumbSize = scrollBar->GetThumbSize(); - - return new wxProperty("thumbSize", (long)thumbSize, "integer"); - } - else if (name == "range") - { - int range = scrollBar->GetRange(); - return new wxProperty("range", (long)range, "integer"); - } - else - return wxItemPropertyInfo::GetProperty(name); + return wxItemPropertyInfo::GetProperty(name); } bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow; - if (name == "thumbPosition") - { - scrollBar->SetThumbPosition((int)property->GetValue().IntegerValue()); - return TRUE; - } - else if (name == "orientation") - { - long windowStyle = scrollBar->GetWindowStyleFlag(); - long oldWindowStyle = windowStyle; - wxString val(property->GetValue().StringValue()); - if (val == "wxHORIZONTAL") + wxScrollBar *scrollBar = (wxScrollBar *)m_propertyWindow; + if (name == "thumbPosition") + { + scrollBar->SetThumbPosition((int)property->GetValue().IntegerValue()); + return TRUE; + } + else if (name == "orientation") { - if (windowStyle & wxVERTICAL) - windowStyle -= wxVERTICAL; - windowStyle |= wxHORIZONTAL; + long windowStyle = scrollBar->GetWindowStyleFlag(); + long oldWindowStyle = windowStyle; + wxString val(property->GetValue().StringValue()); + if (val == "wxHORIZONTAL") + { + if (windowStyle & wxVERTICAL) + windowStyle -= wxVERTICAL; + windowStyle |= wxHORIZONTAL; + } + else + { + if (windowStyle & wxHORIZONTAL) + windowStyle -= wxHORIZONTAL; + windowStyle |= wxVERTICAL; + } + + if (oldWindowStyle == windowStyle) + return TRUE; + + scrollBar->SetWindowStyleFlag(windowStyle); + + // If the window style has changed, we swap the width and height parameters. + // int w, h; + // scrollBar->GetSize(&w, &h); + wxItemResource *item = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(scrollBar); + if ( item ) { + item->SetSize(item->GetX(), item->GetY(), item->GetHeight(), item->GetWidth()); + item->SetStyle(windowStyle); + } /* IF */ + + scrollBar = (wxScrollBar *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(scrollBar, this); + m_propertyWindow = scrollBar; + + return TRUE; } - else + else if (name == "pageSize") { - if (windowStyle & wxHORIZONTAL) - windowStyle -= wxHORIZONTAL; - windowStyle |= wxVERTICAL; + int pos = scrollBar->GetThumbPosition(); + int range = scrollBar->GetRange(); + int thumbSize = scrollBar->GetThumbSize(); + scrollBar->SetScrollbar(pos, thumbSize, range, (int)property->GetValue().IntegerValue()); + return TRUE; } - - if (oldWindowStyle == windowStyle) - return TRUE; - - scrollBar->SetWindowStyleFlag(windowStyle); - - // If the window style has changed, we swap the width and height parameters. -// int w, h; -// scrollBar->GetSize(&w, &h); - wxItemResource *item = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(scrollBar); - if ( item ) { - item->SetSize(item->GetX(), item->GetY(), item->GetHeight(), item->GetWidth()); - item->SetStyle(windowStyle); - } /* IF */ - - scrollBar = (wxScrollBar *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(scrollBar, this); - m_propertyWindow = scrollBar; - - return TRUE; - } - else if (name == "pageSize") - { - int pos = scrollBar->GetThumbPosition(); - int range = scrollBar->GetRange(); - int thumbSize = scrollBar->GetThumbSize(); - scrollBar->SetScrollbar(pos, thumbSize, range, (int)property->GetValue().IntegerValue()); - return TRUE; - } - else if (name == "thumbSize") - { - int pos = scrollBar->GetThumbPosition(); - int range = scrollBar->GetRange(); - int pageSize = scrollBar->GetPageSize(); - scrollBar->SetScrollbar(pos, (int)property->GetValue().IntegerValue(), range, pageSize); - return TRUE; - } - else if (name == "range") - { - int pos = scrollBar->GetThumbPosition(); - int thumbSize = scrollBar->GetThumbSize(); - int pageSize = scrollBar->GetPageSize(); - scrollBar->SetScrollbar(pos, thumbSize, (int)property->GetValue().IntegerValue(), pageSize); - return TRUE; - } - else - return wxItemPropertyInfo::SetProperty(name, property); + else if (name == "thumbSize") + { + int pos = scrollBar->GetThumbPosition(); + int range = scrollBar->GetRange(); + int pageSize = scrollBar->GetPageSize(); + scrollBar->SetScrollbar(pos, (int)property->GetValue().IntegerValue(), range, pageSize); + return TRUE; + } + else if (name == "range") + { + int pos = scrollBar->GetThumbPosition(); + int thumbSize = scrollBar->GetThumbSize(); + int pageSize = scrollBar->GetPageSize(); + scrollBar->SetScrollbar(pos, thumbSize, (int)property->GetValue().IntegerValue(), pageSize); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); } void wxScrollBarPropertyInfo::GetPropertyNames(wxStringList& names) { - wxItemPropertyInfo::GetPropertyNames(names); - names.Add("orientation"); - names.Add("thumbPosition"); - names.Add("thumbSize"); - names.Add("pageSize"); - names.Add("range"); - - // Remove some properties we don't inherit - names.Delete("fontPoints"); - names.Delete("fontFamily"); - names.Delete("fontStyle"); - names.Delete("fontWeight"); - names.Delete("fontUnderlined"); + wxItemPropertyInfo::GetPropertyNames(names); + names.Add("orientation"); + names.Add("thumbPosition"); + names.Add("thumbSize"); + names.Add("pageSize"); + names.Add("range"); + + // Remove some properties we don't inherit + names.Delete("fontPoints"); + names.Delete("fontFamily"); + names.Delete("fontStyle"); + names.Delete("fontWeight"); + names.Delete("fontUnderlined"); } bool wxScrollBarPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxScrollBar *sbar = (wxScrollBar *)m_propertyWindow; - - int thumbPosition = sbar->GetThumbPosition(); - int thumbSize = sbar->GetThumbSize(); - int pageSize = sbar->GetPageSize(); - int range = sbar->GetRange(); - - resource->SetValue1(thumbPosition); - resource->SetValue2(thumbSize); - resource->SetValue3(range); - resource->SetValue5(pageSize); - - return wxItemPropertyInfo::InstantiateResource(resource); + wxScrollBar *sbar = (wxScrollBar *)m_propertyWindow; + + int thumbPosition = sbar->GetThumbPosition(); + int thumbSize = sbar->GetThumbSize(); + int pageSize = sbar->GetPageSize(); + int range = sbar->GetRange(); + + resource->SetValue1(thumbPosition); + resource->SetValue2(thumbSize); + resource->SetValue3(range); + resource->SetValue5(pageSize); + + return wxItemPropertyInfo::InstantiateResource(resource); } /* - * Panels - */ +* Panels +*/ wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name) { - wxPanel *panelWindow = (wxPanel *)m_propertyWindow; - -/* - wxFont *labelFont = panelWindow->GetLabelFont(); - wxFont *buttonFont = panelWindow->GetButtonFont(); - - if (name == "labelFontPoints" || name == "labelFontFamily" || name == "labelFontStyle" || name == "labelFontWeight" || + wxPanel *panelWindow = (wxPanel *)m_propertyWindow; + + /* + wxFont *labelFont = panelWindow->GetLabelFont(); + wxFont *buttonFont = panelWindow->GetButtonFont(); + + if (name == "labelFontPoints" || name == "labelFontFamily" || name == "labelFontStyle" || name == "labelFontWeight" || name == "labelFontUnderlined") - return GetFontProperty(name, labelFont); - else if (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" || + return GetFontProperty(name, labelFont); + else if (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" || name == "buttonFontUnderlined") - return GetFontProperty(name, buttonFont); -*/ - - if (name == "no3D") - { - bool userColours; - if (panelWindow->GetWindowStyleFlag() & wxNO_3D) - userColours = TRUE; - else - userColours = FALSE; - - return new wxProperty(name, (bool)userColours, "bool"); - } - else if (name == "backgroundColour") - { - wxColour col(panelWindow->GetBackgroundColour()); - char buf[7]; - wxDecToHex(col.Red(), buf); - wxDecToHex(col.Green(), buf+2); - wxDecToHex(col.Blue(), buf+4); - - return new wxProperty(name, buf, "string", new wxColourListValidator); - } - else if (name == "title") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); - if (resource) - return new wxProperty(name, resource->GetTitle(), "string"); + return GetFontProperty(name, buttonFont); + */ + + if (name == "no3D") + { + bool userColours; + if (panelWindow->GetWindowStyleFlag() & wxNO_3D) + userColours = TRUE; + else + userColours = FALSE; + + return new wxProperty(name, (bool)userColours, "bool"); + } + else if (name == "backgroundColour") + { + wxColour col(panelWindow->GetBackgroundColour()); + char buf[7]; + wxDecToHex(col.Red(), buf); + wxDecToHex(col.Green(), buf+2); + wxDecToHex(col.Blue(), buf+4); + + return new wxProperty(name, buf, "string", new wxColourListValidator); + } + else if (name == "title") + { + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + if (resource) + return new wxProperty(name, resource->GetTitle(), "string"); + else + return new wxProperty(name, "Could not get title", "string"); + } + else if (name == "caption") + { + return new wxProperty(name, ((panelWindow->GetWindowStyleFlag() & wxCAPTION) == wxCAPTION), + "bool"); + } + else if (name == "systemMenu") + { + return new wxProperty(name, ((panelWindow->GetWindowStyleFlag() & wxSYSTEM_MENU) == wxSYSTEM_MENU), + "bool"); + } + else if (name == "thickFrame") + { + return new wxProperty(name, ((panelWindow->GetWindowStyleFlag() & wxTHICK_FRAME) == wxTHICK_FRAME), + "bool"); + } + else if (name == "modal") + { + return new wxProperty(name, ((panelWindow->GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL), + "bool"); + } + else if (name == "useSystemDefaults") + { + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + return new wxProperty(name, ((resource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) == wxRESOURCE_USE_DEFAULTS), + "bool"); + } + else if (name == "useDialogUnits") + { + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + return new wxProperty(name, ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == wxRESOURCE_DIALOG_UNITS), + "bool"); + } else - return new wxProperty(name, "Could not get title", "string"); - } - else if (name == "caption") - { - return new wxProperty(name, ((panelWindow->GetWindowStyleFlag() & wxCAPTION) == wxCAPTION), - "bool"); - } - else if (name == "systemMenu") - { - return new wxProperty(name, ((panelWindow->GetWindowStyleFlag() & wxSYSTEM_MENU) == wxSYSTEM_MENU), - "bool"); - } - else if (name == "thickFrame") - { - return new wxProperty(name, ((panelWindow->GetWindowStyleFlag() & wxTHICK_FRAME) == wxTHICK_FRAME), - "bool"); - } - else if (name == "useSystemDefaults") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); - return new wxProperty(name, ((resource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) == wxRESOURCE_USE_DEFAULTS), - "bool"); - } - else if (name == "useDialogUnits") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); - return new wxProperty(name, ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == wxRESOURCE_DIALOG_UNITS), - "bool"); - } - else - return wxWindowPropertyInfo::GetProperty(name); + return wxWindowPropertyInfo::GetProperty(name); } bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxPanel *panelWindow = (wxPanel *)m_propertyWindow; -/* - wxFont *labelFont = panelWindow->GetLabelFont(); - wxFont *buttonFont = panelWindow->GetButtonFont(); - - if (labelFont && (name == "labelFontPoints" || name == "labelFontFamily" || name == "labelFontStyle" || name == "labelFontWeight" || name == "labelFontUnderlined" )) - { - wxFont *newFont = SetFontProperty(name, property, labelFont); - if (newFont) + wxPanel *panelWindow = (wxPanel *)m_propertyWindow; + /* + wxFont *labelFont = panelWindow->GetLabelFont(); + wxFont *buttonFont = panelWindow->GetButtonFont(); + + if (labelFont && (name == "labelFontPoints" || name == "labelFontFamily" || name == "labelFontStyle" || name == "labelFontWeight" || name == "labelFontUnderlined" )) + { + wxFont *newFont = SetFontProperty(name, property, labelFont); + if (newFont) panelWindow->SetLabelFont(* newFont); - return TRUE; - } - else if (buttonFont && (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" || name == "buttonFontUnderlined" )) - { - wxFont *newFont = SetFontProperty(name, property, buttonFont); - if (newFont) + return TRUE; + } + else if (buttonFont && (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" || name == "buttonFontUnderlined" )) + { + wxFont *newFont = SetFontProperty(name, property, buttonFont); + if (newFont) panelWindow->SetButtonFont(* newFont); - return TRUE; - } -*/ - - if (name == "no3D") - { - bool userColours = property->GetValue().BoolValue(); + return TRUE; + } + */ - if (userColours) + if (name == "no3D") + { + bool userColours = property->GetValue().BoolValue(); + + if (userColours) + { + if ((panelWindow->GetWindowStyleFlag() & wxNO_3D) != wxNO_3D) + panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() | wxNO_3D); + } + else + { + if ((panelWindow->GetWindowStyleFlag() & wxNO_3D) == wxNO_3D) + panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() - wxNO_3D); + } + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + resource->SetStyle(panelWindow->GetWindowStyleFlag()); + + panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this); + return TRUE; + } + else if (name == "backgroundColour") { - if ((panelWindow->GetWindowStyleFlag() & wxNO_3D) != wxNO_3D) - panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() | wxNO_3D); + char *hex = property->GetValue().StringValue(); + int r = wxHexToDec(hex); + int g = wxHexToDec(hex+2); + int b = wxHexToDec(hex+4); + + wxColour col(r,g,b); + panelWindow->SetBackgroundColour(col); + panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this); + m_propertyWindow = panelWindow; + return TRUE; } - else + else if (name == "title") { - if ((panelWindow->GetWindowStyleFlag() & wxNO_3D) == wxNO_3D) - panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() - wxNO_3D); + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + if (resource) + { + resource->SetTitle(property->GetValue().StringValue()); + return TRUE; + } + else + return FALSE; } - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); - resource->SetStyle(panelWindow->GetWindowStyleFlag()); - - panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this); - return TRUE; - } - else if (name == "backgroundColour") - { - char *hex = property->GetValue().StringValue(); - int r = wxHexToDec(hex); - int g = wxHexToDec(hex+2); - int b = wxHexToDec(hex+4); - - wxColour col(r,g,b); - panelWindow->SetBackgroundColour(col); - panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this); - m_propertyWindow = panelWindow; - return TRUE; - } - else if (name == "title") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); - if (resource) + else if (name == "caption") { - resource->SetTitle(property->GetValue().StringValue()); + SetWindowStyle(panelWindow, wxCAPTION, property->GetValue().BoolValue()); + + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + resource->SetStyle(panelWindow->GetWindowStyleFlag()); return TRUE; } - else - return FALSE; - } - else if (name == "caption") - { - SetWindowStyle(panelWindow, wxCAPTION, property->GetValue().BoolValue()); - - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); - resource->SetStyle(panelWindow->GetWindowStyleFlag()); - return TRUE; - } - else if (name == "thickFrame") - { - SetWindowStyle(panelWindow, wxTHICK_FRAME, property->GetValue().BoolValue()); - - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); - resource->SetStyle(panelWindow->GetWindowStyleFlag()); - return TRUE; - } - else if (name == "systemMenu") - { - SetWindowStyle(panelWindow, wxSYSTEM_MENU, property->GetValue().BoolValue()); - - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); - resource->SetStyle(panelWindow->GetWindowStyleFlag()); - return TRUE; - } - else if (name == "useSystemDefaults") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); - bool useDefaults = property->GetValue().BoolValue(); - long style = resource->GetResourceStyle(); - if (useDefaults) + else if (name == "thickFrame") { - if ((style & wxRESOURCE_USE_DEFAULTS) == 0) - style |= wxRESOURCE_USE_DEFAULTS; + SetWindowStyle(panelWindow, wxTHICK_FRAME, property->GetValue().BoolValue()); + + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + resource->SetStyle(panelWindow->GetWindowStyleFlag()); + return TRUE; } - else + else if (name == "systemMenu") + { + SetWindowStyle(panelWindow, wxSYSTEM_MENU, property->GetValue().BoolValue()); + + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + resource->SetStyle(panelWindow->GetWindowStyleFlag()); + return TRUE; + } + else if (name == "modal") { - if ((style & wxRESOURCE_USE_DEFAULTS) != 0) - style -= wxRESOURCE_USE_DEFAULTS; + SetWindowStyle(panelWindow, wxDIALOG_MODAL, property->GetValue().BoolValue()); + + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + resource->SetStyle(panelWindow->GetWindowStyleFlag()); + return TRUE; } - resource->SetResourceStyle(style); - panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this); - return TRUE; - } - else if (name == "useDialogUnits") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); - bool useDialogUnits = property->GetValue().BoolValue(); - long style = resource->GetResourceStyle(); - if (useDialogUnits) + else if (name == "useSystemDefaults") { - if ((style & wxRESOURCE_DIALOG_UNITS) == 0) + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + bool useDefaults = property->GetValue().BoolValue(); + long style = resource->GetResourceStyle(); + if (useDefaults) + { + if ((style & wxRESOURCE_USE_DEFAULTS) == 0) + style |= wxRESOURCE_USE_DEFAULTS; + } + else { - style |= wxRESOURCE_DIALOG_UNITS; - ConvertDialogUnits(TRUE); // Convert all resources + if ((style & wxRESOURCE_USE_DEFAULTS) != 0) + style -= wxRESOURCE_USE_DEFAULTS; } + resource->SetResourceStyle(style); + panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this); + return TRUE; } - else + else if (name == "useDialogUnits") { - if ((style & wxRESOURCE_DIALOG_UNITS) != 0) + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(panelWindow); + bool useDialogUnits = property->GetValue().BoolValue(); + long style = resource->GetResourceStyle(); + if (useDialogUnits) + { + if ((style & wxRESOURCE_DIALOG_UNITS) == 0) + { + style |= wxRESOURCE_DIALOG_UNITS; + ConvertDialogUnits(TRUE); // Convert all resources + } + } + else { - style -= wxRESOURCE_DIALOG_UNITS; - ConvertDialogUnits(FALSE); // Convert all resources + if ((style & wxRESOURCE_DIALOG_UNITS) != 0) + { + style -= wxRESOURCE_DIALOG_UNITS; + ConvertDialogUnits(FALSE); // Convert all resources + } } + resource->SetResourceStyle(style); + panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this); + m_propertyWindow = panelWindow; + // TODO: need to regenerate the width and height properties else they'll be inconsistent. + return TRUE; } - resource->SetResourceStyle(style); - panelWindow = (wxPanel *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(panelWindow, this); - m_propertyWindow = panelWindow; - // TODO: need to regenerate the width and height properties else they'll be inconsistent. - return TRUE; - } - else - return wxWindowPropertyInfo::SetProperty(name, property); + else + return wxWindowPropertyInfo::SetProperty(name, property); } void wxPanelPropertyInfo::GetPropertyNames(wxStringList& names) { - wxWindowPropertyInfo::GetPropertyNames(names); - - names.Add("title"); - names.Add("no3D"); - names.Add("backgroundColour"); - names.Add("caption"); - names.Add("systemMenu"); - names.Add("thickFrame"); - names.Add("useSystemDefaults"); - names.Add("useDialogUnits"); + wxWindowPropertyInfo::GetPropertyNames(names); + + names.Add("title"); + names.Add("no3D"); + names.Add("backgroundColour"); + names.Add("caption"); + names.Add("systemMenu"); + names.Add("thickFrame"); + names.Add("useSystemDefaults"); + names.Add("useDialogUnits"); + names.Add("modal"); } bool wxPanelPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxPanel *panel = (wxPanel *)m_propertyWindow; - if (panel->GetFont().Ok()) - resource->SetFont(* wxTheFontList->FindOrCreateFont(panel->GetFont().GetPointSize(), - panel->GetFont().GetFamily(), panel->GetFont().GetStyle(), panel->GetFont().GetWeight(), - panel->GetFont().GetUnderlined(), panel->GetFont().GetFaceName())); - - resource->SetBackgroundColour(wxColour(panel->GetBackgroundColour())); - - return wxWindowPropertyInfo::InstantiateResource(resource); + wxPanel *panel = (wxPanel *)m_propertyWindow; + if (panel->GetFont().Ok()) + resource->SetFont(* wxTheFontList->FindOrCreateFont(panel->GetFont().GetPointSize(), + panel->GetFont().GetFamily(), panel->GetFont().GetStyle(), panel->GetFont().GetWeight(), + panel->GetFont().GetUnderlined(), panel->GetFont().GetFaceName())); + + resource->SetBackgroundColour(wxColour(panel->GetBackgroundColour())); + + return wxWindowPropertyInfo::InstantiateResource(resource); } // Convert this dialog, and its children, to or from dialog units void wxPanelPropertyInfo::ConvertDialogUnits(bool toDialogUnits) { wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow); - + wxPoint pt; wxSize sz; if (toDialogUnits) @@ -2255,7 +2271,7 @@ void wxPanelPropertyInfo::ConvertDialogUnits(bool toDialogUnits) pt = m_propertyWindow->ConvertDialogToPixels(wxPoint(resource->GetX(), resource->GetY())); } resource->SetSize(pt.x, pt.y, sz.x, sz.y); - + wxNode* node = m_propertyWindow->GetChildren().First(); while (node) { @@ -2281,85 +2297,85 @@ void wxPanelPropertyInfo::ConvertDialogUnits(bool toDialogUnits) #if 0 /* - * Dialog boxes - */ +* Dialog boxes +*/ wxProperty *wxDialogPropertyInfo::GetProperty(wxString& name) { - wxDialog *dialogWindow = (wxDialog *)m_propertyWindow; - if (name == "modal") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow); - if (!resource) - return NULL; - - bool modal = (resource->GetValue1() != 0); - return new wxProperty(name, modal, "bool"); - } - else - return wxPanelPropertyInfo::GetProperty(name); + wxDialog *dialogWindow = (wxDialog *)m_propertyWindow; + if (name == "modal") + { + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow); + if (!resource) + return NULL; + + bool modal = (resource->GetValue1() != 0); + return new wxProperty(name, modal, "bool"); + } + else + return wxPanelPropertyInfo::GetProperty(name); } bool wxDialogPropertyInfo::SetProperty(wxString& name, wxProperty *property) { - wxDialog *dialogWindow = (wxDialog *)m_propertyWindow; - - if (name == "modal") - { - wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow); - if (!resource) - return FALSE; - - resource->SetValue1(property->GetValue().BoolValue()); - return TRUE; - } - else - return wxPanelPropertyInfo::SetProperty(name, property); + wxDialog *dialogWindow = (wxDialog *)m_propertyWindow; + + if (name == "modal") + { + wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(dialogWindow); + if (!resource) + return FALSE; + + resource->SetValue1(property->GetValue().BoolValue()); + return TRUE; + } + else + return wxPanelPropertyInfo::SetProperty(name, property); } void wxDialogPropertyInfo::GetPropertyNames(wxStringList& names) { - wxPanelPropertyInfo::GetPropertyNames(names); - names.Add("title"); - names.Add("modal"); + wxPanelPropertyInfo::GetPropertyNames(names); + names.Add("title"); + names.Add("modal"); } bool wxDialogPropertyInfo::InstantiateResource(wxItemResource *resource) { - wxDialog *dialog = (wxDialog *)m_propertyWindow; - wxString str(dialog->GetTitle()); - resource->SetTitle(str); + wxDialog *dialog = (wxDialog *)m_propertyWindow; + wxString str(dialog->GetTitle()); + resource->SetTitle(str); - return wxPanelPropertyInfo::InstantiateResource(resource); + return wxPanelPropertyInfo::InstantiateResource(resource); } #endif /* - * Utilities - */ - +* Utilities +*/ + int wxStringToFontWeight(wxString& val) { - if (val == "wxBOLD") return wxBOLD; - else if (val == "wxLIGHT") return wxLIGHT; - else return wxNORMAL; + if (val == "wxBOLD") return wxBOLD; + else if (val == "wxLIGHT") return wxLIGHT; + else return wxNORMAL; } int wxStringToFontStyle(wxString& val) { - if (val == "wxITALIC") return wxITALIC; - else if (val == "wxSLANT") return wxSLANT; - else return wxNORMAL; + if (val == "wxITALIC") return wxITALIC; + else if (val == "wxSLANT") return wxSLANT; + else return wxNORMAL; } int wxStringToFontFamily(wxString& val) { - if (val == "wxDECORATIVE") return wxDECORATIVE; - else if (val == "wxROMAN") return wxROMAN; - else if (val == "wxSCRIPT") return wxSCRIPT; - else if (val == "wxMODERN") return wxMODERN; - else if (val == "wxTELETYPE") return wxTELETYPE; - else return wxSWISS; + if (val == "wxDECORATIVE") return wxDECORATIVE; + else if (val == "wxROMAN") return wxROMAN; + else if (val == "wxSCRIPT") return wxSCRIPT; + else if (val == "wxMODERN") return wxMODERN; + else if (val == "wxTELETYPE") return wxTELETYPE; + else return wxSWISS; } /// @@ -2368,7 +2384,7 @@ int wxStringToFontFamily(wxString& val) IMPLEMENT_DYNAMIC_CLASS(wxResourceSymbolValidator, wxPropertyListValidator) wxResourceSymbolValidator::wxResourceSymbolValidator(long flags): - wxPropertyListValidator(flags) +wxPropertyListValidator(flags) { } @@ -2378,7 +2394,7 @@ wxResourceSymbolValidator::~wxResourceSymbolValidator(void) bool wxResourceSymbolValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow)) { - return TRUE; + return TRUE; } // Called when TICK is pressed or focus is lost or view wants to update @@ -2386,11 +2402,11 @@ bool wxResourceSymbolValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxP // Does the transferance from the property editing area to the property itself bool wxResourceSymbolValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { - if (!view->GetValueText()) - return FALSE; - wxString value(view->GetValueText()->GetValue()); - property->GetValue() = value ; - return TRUE; + if (!view->GetValueText()) + return FALSE; + wxString value(view->GetValueText()->GetValue()); + property->GetValue() = value ; + return TRUE; } // Called when TICK is pressed or focus is lost or view wants to update @@ -2398,108 +2414,108 @@ bool wxResourceSymbolValidator::OnRetrieveValue(wxProperty *property, wxProperty // Does the transferance from the property editing area to the property itself bool wxResourceSymbolValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { - if (!view->GetValueText()) - return FALSE; - wxString str(property->GetValue().GetStringRepresentation()); - view->GetValueText()->SetValue(str); - return TRUE; + if (!view->GetValueText()) + return FALSE; + wxString str(property->GetValue().GetStringRepresentation()); + view->GetValueText()->SetValue(str); + return TRUE; } // Called when the property is double clicked. Extra functionality can be provided, // cycling through possible values. bool wxResourceSymbolValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) { - if (!view->GetValueText()) - return FALSE; - OnEdit(property, view, parentWindow); - return TRUE; + if (!view->GetValueText()) + return FALSE; + OnEdit(property, view, parentWindow); + return TRUE; } bool wxResourceSymbolValidator::OnPrepareControls(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow)) { - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); - if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); - if (view->GetValueText()) - view->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == wxPROP_ALLOW_TEXT_EDITING); - return TRUE; + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(TRUE); + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(TRUE); + if (view->GetEditButton()) + view->GetEditButton()->Enable(TRUE); + if (view->GetValueText()) + view->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == wxPROP_ALLOW_TEXT_EDITING); + return TRUE; } void wxResourceSymbolValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) { - if (!view->GetValueText()) - return; - - wxResourceSymbolDialog* dialog = new wxResourceSymbolDialog(parentWindow, -1, "Edit Symbol"); - - // Split name/id pair e.g. "IDC_TEXT=123" - wxString value(property->GetValue().StringValue()); - - wxString strName = value.Before('='); - wxString strId = value.After('='); - - dialog->SetSymbol(strName); - dialog->SetId(atoi(strId)); - - dialog->Init(); - - if (dialog->ShowModal() == wxID_OK) - { - wxString symbolName(dialog->GetSymbol()); - long id = dialog->GetId(); - - wxString str; - str.Printf("%d", id); - property->GetValue() = symbolName + wxString("=") + str; - - view->DisplayProperty(property); - view->UpdatePropertyDisplayInList(property); - view->OnPropertyChanged(property); - } - // Moved from the 'if' branch on suggestion of Roman Pavlov - dialog->Destroy(); + if (!view->GetValueText()) + return; + + wxResourceSymbolDialog* dialog = new wxResourceSymbolDialog(parentWindow, -1, "Edit Symbol"); + + // Split name/id pair e.g. "IDC_TEXT=123" + wxString value(property->GetValue().StringValue()); + + wxString strName = value.Before('='); + wxString strId = value.After('='); + + dialog->SetSymbol(strName); + dialog->SetId(atoi(strId)); + + dialog->Init(); + + if (dialog->ShowModal() == wxID_OK) + { + wxString symbolName(dialog->GetSymbol()); + long id = dialog->GetId(); + + wxString str; + str.Printf("%d", id); + property->GetValue() = symbolName + wxString("=") + str; + + view->DisplayProperty(property); + view->UpdatePropertyDisplayInList(property); + view->OnPropertyChanged(property); + } + // Moved from the 'if' branch on suggestion of Roman Pavlov + dialog->Destroy(); } BEGIN_EVENT_TABLE(wxResourceSymbolDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxResourceSymbolDialog::OnOK) - EVT_COMBOBOX(ID_SYMBOLNAME_COMBOBOX, wxResourceSymbolDialog::OnComboBoxSelect) - EVT_TEXT(ID_SYMBOLNAME_COMBOBOX, wxResourceSymbolDialog::OnSymbolNameUpdate) +EVT_BUTTON(wxID_OK, wxResourceSymbolDialog::OnOK) +EVT_COMBOBOX(ID_SYMBOLNAME_COMBOBOX, wxResourceSymbolDialog::OnComboBoxSelect) +EVT_TEXT(ID_SYMBOLNAME_COMBOBOX, wxResourceSymbolDialog::OnSymbolNameUpdate) END_EVENT_TABLE() wxResourceSymbolDialog::wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title, const wxPoint& pos, - const wxSize& size, long style): - wxDialog(parent, id, title, pos, size, style) + const wxSize& size, long style): +wxDialog(parent, id, title, pos, size, style) { int x = 5; int y = 5; - + (void) new wxStaticText(this, -1, "Name: ", wxPoint(x, y)); - + x += 80; - + m_nameCtrl = new wxComboBox(this, ID_SYMBOLNAME_COMBOBOX, "", wxPoint(x, y), wxSize(200, -1), 0, NULL, wxCB_DROPDOWN|wxCB_SORT); - + y += 30; x = 5; - + (void) new wxStaticText(this, -1, "Id: ", wxPoint(x, y)); - + x += 80; - + m_idCtrl = new wxTextCtrl(this, ID_SYMBOLID_TEXTCTRL, "", wxPoint(x, y), wxSize(200, -1)); - + y += 30; x = 5; (void) new wxButton(this, wxID_OK, "OK", wxPoint(x, y), wxSize(80, -1)); - + x += 100; (void) new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(x, y), wxSize(80, -1)); - + Fit(); Centre(); } @@ -2508,10 +2524,10 @@ void wxResourceSymbolDialog::Init() { wxString defaultId; defaultId.Printf("%ld", m_symbolId); - + m_nameCtrl->SetValue(m_symbolName); m_idCtrl->SetValue(defaultId); - + wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().FillComboBox(m_nameCtrl); } @@ -2528,7 +2544,7 @@ bool wxResourceSymbolDialog::CheckValues() wxString nameStr(m_nameCtrl->GetValue()); wxString idStr(m_idCtrl->GetValue()); int id = atoi(idStr); - + if (id <= 0 ) { wxMessageBox("Identifier cannot be missing or zero", "Dialog Editor", wxOK|wxICON_EXCLAMATION, this); @@ -2555,7 +2571,7 @@ bool wxResourceSymbolDialog::CheckValues() return FALSE; } // TODO: other checks on the name syntax. - + if (!wxResourceManager::GetCurrentResourceManager()->GetSymbolTable().IsStandardSymbol(nameStr)) { // If we change the id for an existing symbol, we need to: @@ -2563,23 +2579,23 @@ bool wxResourceSymbolDialog::CheckValues() // If so, will need to change their id to the new id, in SetProperty. // 2) Remove the old symbol, add the new symbol. // In this check, we don't have to do this, but we need to do it in SetProperty. - + if (nameStr == GetSymbol() && id != GetId()) { // It's OK to change the id. But we'll need to change all matching ids in all resources, // in SetProperty. } - + // If we change the name but not the id... we'll just need to remove and // re-add the symbol/id pair, in SetProperty. if (nameStr != GetSymbol() && id == GetId()) { } - + // What if we're changing both the name and the id? // - if there's no symbol of that name, just remove the old, add the new (in SetProperty) // - if there is a symbol of that name, if id matches, do nothing. If not, veto. - + if (nameStr != GetSymbol() && id != GetId()) { if (!wxResourceManager::GetCurrentResourceManager()->IsIdentifierOK(nameStr, id)) @@ -2589,12 +2605,12 @@ bool wxResourceSymbolDialog::CheckValues() return FALSE; } } - + } - + SetSymbol(nameStr); SetId(id); - + return TRUE; } diff --git a/utils/dialoged/src/winprop.h b/utils/dialoged/src/winprop.h index 27d1ea5a61..c94458aa79 100644 --- a/utils/dialoged/src/winprop.h +++ b/utils/dialoged/src/winprop.h @@ -28,9 +28,9 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"); ~wxDialogEditorPropertyListFrame(); - + wxPropertyInfo* GetInfo() const { return m_propInfo; } - + private: wxPropertySheet* m_propSheet; wxPropertyValidatorRegistry m_registry; @@ -41,17 +41,17 @@ private: // feedback. class wxResourcePropertyListView: public wxPropertyListView { - public: - wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT): - wxPropertyListView(propPanel, flags) - { - m_propertyInfo = info; - } - void OnPropertyChanged(wxProperty *property); - bool OnClose(void); - - wxPropertyInfo* m_propertyInfo; - +public: + wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT): + wxPropertyListView(propPanel, flags) + { + m_propertyInfo = info; + } + void OnPropertyChanged(wxProperty *property); + bool OnClose(void); + + wxPropertyInfo* m_propertyInfo; + }; // Generic class for relating an object to a collection of properties. @@ -61,294 +61,294 @@ class wxResourcePropertyListView: public wxPropertyListView class wxPropertyInfo: public wxObject { friend class wxDialogEditorPropertyListFrame; - protected: - static wxWindow *sm_propertyWindow; - wxPropertyInfo(void) - { - } - ~wxPropertyInfo(void) - { - } - public: - virtual wxProperty *GetProperty(wxString& propName) = 0; - virtual bool SetProperty(wxString& propName, wxProperty *property) = 0; - virtual void GetPropertyNames(wxStringList& names) = 0; - virtual bool Edit(wxWindow *parent, const wxString& title); - static void CloseWindow(); // Close the current window if open. +protected: + static wxWindow *sm_propertyWindow; + wxPropertyInfo(void) + { + } + ~wxPropertyInfo(void) + { + } +public: + virtual wxProperty *GetProperty(wxString& propName) = 0; + virtual bool SetProperty(wxString& propName, wxProperty *property) = 0; + virtual void GetPropertyNames(wxStringList& names) = 0; + virtual bool Edit(wxWindow *parent, const wxString& title); + static void CloseWindow(); // Close the current window if open. }; // For all windows class wxWindowPropertyInfo: public wxPropertyInfo { - public: - wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL); - ~wxWindowPropertyInfo(void); - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - - inline void SetPropertyWindow(wxWindow *win) { m_propertyWindow = win; } - - inline void SetResource(wxItemResource *res) { m_propertyResource = res; } - - // Helper functions for font properties - - wxProperty *GetFontProperty(wxString& name, wxFont *font); - wxFont *SetFontProperty(wxString& name, wxProperty *property, wxFont *oldFont); - - // Fill in the wxItemResource members to mirror the current window settings - virtual bool InstantiateResource(wxItemResource *resource); - - // Set the window style - void SetWindowStyle(wxWindow* win, long style, bool set); - - wxWindow* GetWindow() const { return m_propertyWindow; } - wxItemResource* GetResource() const { return m_propertyResource; } - - protected: - wxWindow* m_propertyWindow; - wxItemResource* m_propertyResource; +public: + wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL); + ~wxWindowPropertyInfo(void); + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + + inline void SetPropertyWindow(wxWindow *win) { m_propertyWindow = win; } + + inline void SetResource(wxItemResource *res) { m_propertyResource = res; } + + // Helper functions for font properties + + wxProperty *GetFontProperty(wxString& name, wxFont *font); + wxFont *SetFontProperty(wxString& name, wxProperty *property, wxFont *oldFont); + + // Fill in the wxItemResource members to mirror the current window settings + virtual bool InstantiateResource(wxItemResource *resource); + + // Set the window style + void SetWindowStyle(wxWindow* win, long style, bool set); + + wxWindow* GetWindow() const { return m_propertyWindow; } + wxItemResource* GetResource() const { return m_propertyResource; } + +protected: + wxWindow* m_propertyWindow; + wxItemResource* m_propertyResource; }; // For panel items class wxItemPropertyInfo: public wxWindowPropertyInfo { - protected: - public: - wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxWindowPropertyInfo(win, res) {} - ~wxItemPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxWindowPropertyInfo(win, res) {} + ~wxItemPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For buttons class wxButtonPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) { } - ~wxButtonPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) { } + ~wxButtonPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For bitmap buttons class wxBitmapButtonPropertyInfo: public wxButtonPropertyInfo { - protected: - public: - wxBitmapButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxButtonPropertyInfo(win, res) { } - ~wxBitmapButtonPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxBitmapButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxButtonPropertyInfo(win, res) { } + ~wxBitmapButtonPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For static text controls class wxStaticTextPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) { } - ~wxStaticTextPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) { } + ~wxStaticTextPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For static bitmap controls class wxStaticBitmapPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxStaticBitmapPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) { } - ~wxStaticBitmapPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxStaticBitmapPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) { } + ~wxStaticBitmapPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For text/multitext items class wxTextPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxTextPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxTextPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For list boxes class wxListBoxPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxListBoxPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxListBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For choice items class wxChoicePropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxChoicePropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxChoicePropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For choice items class wxComboBoxPropertyInfo: public wxChoicePropertyInfo { - protected: - public: - wxComboBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxChoicePropertyInfo(win, res) {} - ~wxComboBoxPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxComboBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxChoicePropertyInfo(win, res) {} + ~wxComboBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For radiobox items class wxRadioBoxPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxRadioBoxPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxRadioBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For groupbox items class wxGroupBoxPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxGroupBoxPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxGroupBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For checkbox items class wxCheckBoxPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxCheckBoxPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxCheckBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For radiobutton items class wxRadioButtonPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxRadioButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxRadioButtonPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxRadioButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxRadioButtonPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For gauge items class wxGaugePropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxGaugePropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxGaugePropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For scrollbar items class wxScrollBarPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxScrollBarPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxScrollBarPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For slider items class wxSliderPropertyInfo: public wxItemPropertyInfo { - protected: - public: - wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxItemPropertyInfo(win, res) {} - ~wxSliderPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); +protected: +public: + wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxSliderPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); }; // For panels class wxPanelPropertyInfo: public wxWindowPropertyInfo { - protected: - public: - wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL): - wxWindowPropertyInfo(win, res) {} - ~wxPanelPropertyInfo(void) {} - wxProperty *GetProperty(wxString& name); - bool SetProperty(wxString& name, wxProperty *property); - void GetPropertyNames(wxStringList& names); - bool InstantiateResource(wxItemResource *resource); - - // Convert this dialog, and its children, to or from dialog units - void ConvertDialogUnits(bool toDialogUnits); +protected: +public: + wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxWindowPropertyInfo(win, res) {} + ~wxPanelPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); + + // Convert this dialog, and its children, to or from dialog units + void ConvertDialogUnits(bool toDialogUnits); }; int wxStringToFontWeight(wxString& val); @@ -356,39 +356,39 @@ int wxStringToFontStyle(wxString& val); int wxStringToFontFamily(wxString& val); /* - * A validator to allow editing symbol/id pairs - */ +* A validator to allow editing symbol/id pairs +*/ class wxResourceSymbolValidator: public wxPropertyListValidator { - DECLARE_DYNAMIC_CLASS(wxResourceSymbolValidator) - protected: - public: - wxResourceSymbolValidator(long flags = 0); - - ~wxResourceSymbolValidator(void); - - // Called when TICK is pressed or focus is lost. - // Return FALSE if value didn't check out; signal to restore old value. - bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost or view wants to update - // the property list. - // Does the transferance from the property editing area to the property itself - bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when the edit (...) button is pressed. - void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + DECLARE_DYNAMIC_CLASS(wxResourceSymbolValidator) +protected: +public: + wxResourceSymbolValidator(long flags = 0); + + ~wxResourceSymbolValidator(void); + + // Called when TICK is pressed or focus is lost. + // Return FALSE if value didn't check out; signal to restore old value. + bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost or view wants to update + // the property list. + // Does the transferance from the property editing area to the property itself + bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when the edit (...) button is pressed. + void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); }; /* - * A dialog for editing symbol/id pairs - */ +* A dialog for editing symbol/id pairs +*/ class wxResourceSymbolDialog: public wxDialog { @@ -396,31 +396,31 @@ public: wxResourceSymbolDialog(wxWindow* parent, const wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); - + void Init(); - + inline void SetSymbol(const wxString& symbol) { m_symbolName = symbol; } inline void SetId(long id) { m_symbolId = id; } - + inline wxString GetSymbol() const { return m_symbolName; } inline long GetId() const { return m_symbolId; } - + bool CheckValues(); void OnOK(wxCommandEvent& event); void OnComboBoxSelect(wxCommandEvent& event); void OnSymbolNameUpdate(wxCommandEvent& event); - + protected: wxString m_symbolName; long m_symbolId; wxComboBox* m_nameCtrl; wxTextCtrl* m_idCtrl; - -DECLARE_EVENT_TABLE() + + DECLARE_EVENT_TABLE() }; #define ID_SYMBOLNAME_COMBOBOX 100 #define ID_SYMBOLID_TEXTCTRL 101 #endif - // _WINPROP_H_ +// _WINPROP_H_ diff --git a/utils/dialoged/src/winstyle.cpp b/utils/dialoged/src/winstyle.cpp index 47b5e92f93..b0b1dae327 100644 --- a/utils/dialoged/src/winstyle.cpp +++ b/utils/dialoged/src/winstyle.cpp @@ -32,244 +32,245 @@ #include "winstyle.h" /* - * Styles - */ +* Styles +*/ - /* wxListBox */ +/* wxListBox */ static wxWindowStylePair g_WindowStylesListBox[] = { - { "wxLB_SINGLE", wxLB_SINGLE }, - { "wxLB_MULTIPLE", wxLB_MULTIPLE }, - { "wxLB_EXTENDED", wxLB_EXTENDED }, - { "wxLB_NEEDED_SB", wxLB_NEEDED_SB }, - { "wxLB_ALWAYS_SB", wxLB_ALWAYS_SB }, - { "wxLB_SORT", wxLB_SORT }, - { "wxLB_OWNERDRAW", wxLB_OWNERDRAW }, - { "wxLB_HSCROLL", wxLB_HSCROLL } + { "wxLB_SINGLE", wxLB_SINGLE }, + { "wxLB_MULTIPLE", wxLB_MULTIPLE }, + { "wxLB_EXTENDED", wxLB_EXTENDED }, + { "wxLB_NEEDED_SB", wxLB_NEEDED_SB }, + { "wxLB_ALWAYS_SB", wxLB_ALWAYS_SB }, + { "wxLB_SORT", wxLB_SORT }, + { "wxLB_OWNERDRAW", wxLB_OWNERDRAW }, + { "wxLB_HSCROLL", wxLB_HSCROLL } }; int g_WindowStylesListBoxCount = sizeof(g_WindowStylesListBox)/sizeof(wxWindowStylePair) ; - - /* wxComboxBox */ + +/* wxComboxBox */ static wxWindowStylePair g_WindowStylesComboBox[] = { - { "wxCB_SIMPLE", wxCB_SIMPLE }, - { "wxCB_DROPDOWN", wxCB_DROPDOWN }, - { "wxCB_READONLY", wxCB_READONLY }, - { "wxCB_SORT", wxCB_SORT } + { "wxCB_SIMPLE", wxCB_SIMPLE }, + { "wxCB_DROPDOWN", wxCB_DROPDOWN }, + { "wxCB_READONLY", wxCB_READONLY }, + { "wxCB_SORT", wxCB_SORT } }; int g_WindowStylesComboBoxCount = sizeof(g_WindowStylesComboBox)/sizeof(wxWindowStylePair) ; #if 0 - /* wxChoice */ +/* wxChoice */ static wxWindowStylePair g_WindowStylesChoice[] = { }; int g_WindowStylesChoiceCount = sizeof(g_WindowStylesChoice)/sizeof(wxWindowStylePair) ; #endif - - /* wxGauge */ + +/* wxGauge */ static wxWindowStylePair g_WindowStylesGauge[] = { - { "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR }, - { "wxGA_HORIZONTAL", wxGA_HORIZONTAL }, - { "wxGA_VERTICAL", wxGA_VERTICAL } + { "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR }, + { "wxGA_HORIZONTAL", wxGA_HORIZONTAL }, + { "wxGA_VERTICAL", wxGA_VERTICAL } }; int g_WindowStylesGaugeCount = sizeof(g_WindowStylesGauge)/sizeof(wxWindowStylePair) ; - /* wxTextCtrl */ +/* wxTextCtrl */ static wxWindowStylePair g_WindowStylesTextCtrl[] = { -// { "wxPASSWORD", wxPASSWORD}, -// { "wxPROCESS_ENTER", wxPROCESS_ENTER}, - { "wxTE_PASSWORD", wxTE_PASSWORD}, - { "wxTE_READONLY", wxTE_READONLY}, - { "wxTE_PROCESS_ENTER", wxTE_PROCESS_ENTER}, - { "wxTE_MULTILINE", wxTE_MULTILINE} + // { "wxPASSWORD", wxPASSWORD}, + // { "wxPROCESS_ENTER", wxPROCESS_ENTER}, + { "wxTE_PASSWORD", wxTE_PASSWORD}, + { "wxTE_READONLY", wxTE_READONLY}, + { "wxTE_PROCESS_ENTER", wxTE_PROCESS_ENTER}, + { "wxTE_MULTILINE", wxTE_MULTILINE} }; int g_WindowStylesTextCtrlCount = sizeof(g_WindowStylesTextCtrl)/sizeof(wxWindowStylePair) ; - /* wxRadioButton */ +/* wxRadioButton */ static wxWindowStylePair g_WindowStylesRadioButton[] = { - { "wxRB_GROUP", wxRB_GROUP } + { "wxRB_GROUP", wxRB_GROUP } }; int g_WindowStylesRadioButtonCount = sizeof(g_WindowStylesRadioButton)/sizeof(wxWindowStylePair) ; - /* wxRadioBox */ +/* wxRadioBox */ static wxWindowStylePair g_WindowStylesRadioBox[] = { - { "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS }, - { "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS } -/* - , - { "wxRA_HORIZONTAL", wxRA_HORIZONTAL }, - { "wxRA_VERTICAL", wxRA_VERTICAL } -*/ + { "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS }, + { "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS } + /* + , + { "wxRA_HORIZONTAL", wxRA_HORIZONTAL }, + { "wxRA_VERTICAL", wxRA_VERTICAL } + */ }; int g_WindowStylesRadioBoxCount = sizeof(g_WindowStylesRadioBox)/sizeof(wxWindowStylePair) ; - /* wxSlider */ +/* wxSlider */ static wxWindowStylePair g_WindowStylesSlider[] = { - { "wxSL_HORIZONTAL", wxSL_HORIZONTAL }, - { "wxSL_VERTICAL", wxSL_VERTICAL }, - { "wxSL_AUTOTICKS", wxSL_AUTOTICKS }, - { "wxSL_LABELS", wxSL_LABELS }, - { "wxSL_LEFT", wxSL_LEFT }, - { "wxSL_TOP", wxSL_TOP }, - { "wxSL_RIGHT", wxSL_RIGHT }, - { "wxSL_BOTTOM", wxSL_BOTTOM }, - { "wxSL_BOTH", wxSL_BOTH }, - { "wxSL_SELRANGE", wxSL_SELRANGE } + { "wxSL_HORIZONTAL", wxSL_HORIZONTAL }, + { "wxSL_VERTICAL", wxSL_VERTICAL }, + { "wxSL_AUTOTICKS", wxSL_AUTOTICKS }, + { "wxSL_LABELS", wxSL_LABELS }, + { "wxSL_LEFT", wxSL_LEFT }, + { "wxSL_TOP", wxSL_TOP }, + { "wxSL_RIGHT", wxSL_RIGHT }, + { "wxSL_BOTTOM", wxSL_BOTTOM }, + { "wxSL_BOTH", wxSL_BOTH }, + { "wxSL_SELRANGE", wxSL_SELRANGE } }; int g_WindowStylesSliderCount = sizeof(g_WindowStylesSlider)/sizeof(wxWindowStylePair) ; - /* wxScrollBar */ +/* wxScrollBar */ static wxWindowStylePair g_WindowStylesScrollBar[] = { - { "wxSB_HORIZONTAL", wxSB_HORIZONTAL }, - { "wxSB_VERTICAL", wxSB_VERTICAL } + { "wxSB_HORIZONTAL", wxSB_HORIZONTAL }, + { "wxSB_VERTICAL", wxSB_VERTICAL } }; int g_WindowStylesScrollBarCount = sizeof(g_WindowStylesScrollBar)/sizeof(wxWindowStylePair) ; - /* wxButton */ +/* wxButton */ static wxWindowStylePair g_WindowStylesButton[] = { - { "wxBU_AUTODRAW", wxBU_AUTODRAW }, - { "wxBU_NOAUTODRAW", wxBU_NOAUTODRAW } + { "wxBU_AUTODRAW", wxBU_AUTODRAW }, + { "wxBU_NOAUTODRAW", wxBU_NOAUTODRAW } }; int g_WindowStylesButtonCount = sizeof(g_WindowStylesButton)/sizeof(wxWindowStylePair) ; - /* wxTreeCtrl */ +/* wxTreeCtrl */ static wxWindowStylePair g_WindowStylesTreeCtrl[] = { - { "wxTR_HAS_BUTTONS", wxTR_HAS_BUTTONS }, - { "wxTR_EDIT_LABELS", wxTR_EDIT_LABELS }, - { "wxTR_LINES_AT_ROOT", wxTR_LINES_AT_ROOT } + { "wxTR_HAS_BUTTONS", wxTR_HAS_BUTTONS }, + { "wxTR_EDIT_LABELS", wxTR_EDIT_LABELS }, + { "wxTR_LINES_AT_ROOT", wxTR_LINES_AT_ROOT } }; int g_WindowStylesTreeCtrlCount = sizeof(g_WindowStylesTreeCtrl)/sizeof(wxWindowStylePair) ; - /* wxListCtrl */ +/* wxListCtrl */ static wxWindowStylePair g_WindowStylesListCtrl[] = { - { "wxLC_ICON", wxLC_ICON }, - { "wxLC_SMALL_ICON", wxLC_SMALL_ICON }, - { "wxLC_LIST", wxLC_LIST }, - { "wxLC_REPORT", wxLC_REPORT }, - { "wxLC_ALIGN_TOP", wxLC_ALIGN_TOP }, - { "wxLC_ALIGN_LEFT", wxLC_ALIGN_LEFT }, - { "wxLC_AUTOARRANGE", wxLC_AUTOARRANGE }, - { "wxLC_USER_TEXT", wxLC_USER_TEXT }, - { "wxLC_EDIT_LABELS", wxLC_EDIT_LABELS }, - { "wxLC_NO_HEADER", wxLC_NO_HEADER }, - { "wxLC_NO_SORT_HEADER", wxLC_NO_SORT_HEADER }, - { "wxLC_SINGLE_SEL", wxLC_SINGLE_SEL }, - { "wxLC_SORT_ASCENDING", wxLC_SORT_ASCENDING }, - { "wxLC_SORT_DESCENDING", wxLC_SORT_DESCENDING } + { "wxLC_ICON", wxLC_ICON }, + { "wxLC_SMALL_ICON", wxLC_SMALL_ICON }, + { "wxLC_LIST", wxLC_LIST }, + { "wxLC_REPORT", wxLC_REPORT }, + { "wxLC_ALIGN_TOP", wxLC_ALIGN_TOP }, + { "wxLC_ALIGN_LEFT", wxLC_ALIGN_LEFT }, + { "wxLC_AUTOARRANGE", wxLC_AUTOARRANGE }, + { "wxLC_USER_TEXT", wxLC_USER_TEXT }, + { "wxLC_EDIT_LABELS", wxLC_EDIT_LABELS }, + { "wxLC_NO_HEADER", wxLC_NO_HEADER }, + { "wxLC_NO_SORT_HEADER", wxLC_NO_SORT_HEADER }, + { "wxLC_SINGLE_SEL", wxLC_SINGLE_SEL }, + { "wxLC_SORT_ASCENDING", wxLC_SORT_ASCENDING }, + { "wxLC_SORT_DESCENDING", wxLC_SORT_DESCENDING } }; int g_WindowStylesListCtrlCount = sizeof(g_WindowStylesListCtrl)/sizeof(wxWindowStylePair) ; - /* wxSpinButton */ +/* wxSpinButton */ static wxWindowStylePair g_WindowStylesSpinButton[] = { - { "wxSP_VERTICAL", wxSP_VERTICAL}, - { "wxSP_HORIZONTAL", wxSP_HORIZONTAL}, - { "wxSP_ARROW_KEYS", wxSP_ARROW_KEYS}, - { "wxSP_WRAP", wxSP_WRAP} + { "wxSP_VERTICAL", wxSP_VERTICAL}, + { "wxSP_HORIZONTAL", wxSP_HORIZONTAL}, + { "wxSP_ARROW_KEYS", wxSP_ARROW_KEYS}, + { "wxSP_WRAP", wxSP_WRAP} }; int g_WindowStylesSpinButtonCount = sizeof(g_WindowStylesSpinButton)/sizeof(wxWindowStylePair) ; - /* wxSplitterWindow */ +/* wxSplitterWindow */ static wxWindowStylePair g_WindowStylesSplitterWindow[] = { - { "wxSP_NOBORDER", wxSP_NOBORDER}, - { "wxSP_3D", wxSP_3D}, - { "wxSP_BORDER", wxSP_BORDER} + { "wxSP_NOBORDER", wxSP_NOBORDER}, + { "wxSP_3D", wxSP_3D}, + { "wxSP_BORDER", wxSP_BORDER} }; int g_WindowStylesSplitterWindowCount = sizeof(g_WindowStylesSplitterWindow)/sizeof(wxWindowStylePair) ; - /* wxTabCtrl */ +/* wxTabCtrl */ static wxWindowStylePair g_WindowStylesTabCtrl[] = { - { "wxTC_MULTILINE", wxTC_MULTILINE}, - { "wxTC_RIGHTJUSTIFY", wxTC_RIGHTJUSTIFY}, - { "wxTC_FIXEDWIDTH", wxTC_FIXEDWIDTH}, - { "wxTC_OWNERDRAW", wxTC_OWNERDRAW} + { "wxTC_MULTILINE", wxTC_MULTILINE}, + { "wxTC_RIGHTJUSTIFY", wxTC_RIGHTJUSTIFY}, + { "wxTC_FIXEDWIDTH", wxTC_FIXEDWIDTH}, + { "wxTC_OWNERDRAW", wxTC_OWNERDRAW} }; int g_WindowStylesTabCtrlCount = sizeof(g_WindowStylesTabCtrl)/sizeof(wxWindowStylePair) ; - /* wxStatusBar95 */ +/* wxStatusBar95 */ static wxWindowStylePair g_WindowStylesStatusBar[] = { - { "wxST_SIZEGRIP", wxST_SIZEGRIP} + { "wxST_SIZEGRIP", wxST_SIZEGRIP} }; int g_WindowStylesStatusBarCount = sizeof(g_WindowStylesStatusBar)/sizeof(wxWindowStylePair) ; - /* wxControl */ +/* wxControl */ static wxWindowStylePair g_WindowStylesControl[] = { - { "wxFIXED_LENGTH", wxFIXED_LENGTH}, - { "wxALIGN_LEFT", wxALIGN_LEFT}, - { "wxALIGN_CENTRE", wxALIGN_CENTRE}, - { "wxALIGN_RIGHT", wxALIGN_RIGHT}, - { "wxCOLOURED", wxCOLOURED} + { "wxFIXED_LENGTH", wxFIXED_LENGTH}, + { "wxALIGN_LEFT", wxALIGN_LEFT}, + { "wxALIGN_CENTRE", wxALIGN_CENTRE}, + { "wxALIGN_RIGHT", wxALIGN_RIGHT}, + { "wxCOLOURED", wxCOLOURED} }; int g_WindowStylesControlCount = sizeof(g_WindowStylesControl)/sizeof(wxWindowStylePair) ; - - /* wxToolBar */ + +/* wxToolBar */ static wxWindowStylePair g_WindowStylesToolBar[] = { - { "wxTB_3DBUTTONS", wxTB_3DBUTTONS}, - { "wxTB_HORIZONTAL", wxTB_HORIZONTAL}, - { "wxTB_VERTICAL", wxTB_VERTICAL}, - { "wxTB_FLAT", wxTB_FLAT} + { "wxTB_3DBUTTONS", wxTB_3DBUTTONS}, + { "wxTB_HORIZONTAL", wxTB_HORIZONTAL}, + { "wxTB_VERTICAL", wxTB_VERTICAL}, + { "wxTB_FLAT", wxTB_FLAT} }; int g_WindowStylesToolBarCount = sizeof(g_WindowStylesToolBar)/sizeof(wxWindowStylePair) ; - /* Frame/dialog */ +/* Frame/dialog */ static wxWindowStylePair g_WindowStylesDialog[] = { - { "wxSTAY_ON_TOP", wxSTAY_ON_TOP}, - { "wxCAPTION", wxCAPTION}, - { "wxICONIZE", wxICONIZE}, - { "wxMINIMIZE", wxICONIZE}, - { "wxMAXIMIZE", wxMAXIMIZE}, - { "wxTHICK_FRAME", wxTHICK_FRAME}, - { "wxRESIZE_BORDER", wxRESIZE_BORDER}, - { "wxSYSTEM_MENU", wxSYSTEM_MENU}, - { "wxMINIMIZE_BOX", wxMINIMIZE_BOX}, - { "wxMAXIMIZE_BOX", wxMAXIMIZE_BOX}, - { "wxRESIZE_BOX", wxRESIZE_BOX} + { "wxSTAY_ON_TOP", wxSTAY_ON_TOP}, + { "wxCAPTION", wxCAPTION}, + { "wxICONIZE", wxICONIZE}, + { "wxMINIMIZE", wxICONIZE}, + { "wxMAXIMIZE", wxMAXIMIZE}, + { "wxTHICK_FRAME", wxTHICK_FRAME}, + { "wxRESIZE_BORDER", wxRESIZE_BORDER}, + { "wxSYSTEM_MENU", wxSYSTEM_MENU}, + { "wxMINIMIZE_BOX", wxMINIMIZE_BOX}, + { "wxMAXIMIZE_BOX", wxMAXIMIZE_BOX}, + { "wxDIALOG_MODAL", wxDIALOG_MODAL}, + { "wxRESIZE_BOX", wxRESIZE_BOX} }; int g_WindowStylesDialogCount = sizeof(g_WindowStylesDialog)/sizeof(wxWindowStylePair) ; - /* Generic */ +/* Generic */ static wxWindowStylePair g_WindowStylesWindow[] = { - { "wxBORDER", wxBORDER}, - { "wxDOUBLE_BORDER", wxDOUBLE_BORDER}, - { "wxSUNKEN_BORDER", wxSUNKEN_BORDER}, - { "wxRAISED_BORDER", wxRAISED_BORDER}, - { "wxSIMPLE_BORDER", wxSIMPLE_BORDER}, - { "wxSTATIC_BORDER", wxSTATIC_BORDER}, - { "wxTRANSPARENT_WINDOW", wxTRANSPARENT_WINDOW}, - { "wxNO_BORDER", wxNO_BORDER}, - { "wxCLIP_CHILDREN", wxCLIP_CHILDREN} - -/* Would be duplicated with e.g. wxLB_HSCROLL - { "wxVSCROLL", wxVSCROLL }, - { "wxHSCROLL", wxHSCROLL } -*/ + { "wxBORDER", wxBORDER}, + { "wxDOUBLE_BORDER", wxDOUBLE_BORDER}, + { "wxSUNKEN_BORDER", wxSUNKEN_BORDER}, + { "wxRAISED_BORDER", wxRAISED_BORDER}, + { "wxSIMPLE_BORDER", wxSIMPLE_BORDER}, + { "wxSTATIC_BORDER", wxSTATIC_BORDER}, + { "wxTRANSPARENT_WINDOW", wxTRANSPARENT_WINDOW}, + { "wxNO_BORDER", wxNO_BORDER}, + { "wxCLIP_CHILDREN", wxCLIP_CHILDREN} + + /* Would be duplicated with e.g. wxLB_HSCROLL + { "wxVSCROLL", wxVSCROLL }, + { "wxHSCROLL", wxHSCROLL } + */ }; int g_WindowStylesWindowCount = sizeof(g_WindowStylesWindow)/sizeof(wxWindowStylePair) ; /* - * A table holding all class style objects - */ +* A table holding all class style objects +*/ wxWindowStyleTable::wxWindowStyleTable(): - m_classes(wxKEY_STRING) +m_classes(wxKEY_STRING) { } @@ -294,7 +295,7 @@ void wxWindowStyleTable::Init() AddStyles("wxSlider", g_WindowStylesSliderCount, g_WindowStylesSlider); AddStyles("wxGauge", g_WindowStylesGaugeCount, g_WindowStylesGauge); AddStyles("wxComboBox", g_WindowStylesComboBoxCount, g_WindowStylesComboBox); -// AddStyles("wxChoice", g_WindowStylesChoice, g_WindowStylesChoice); + // AddStyles("wxChoice", g_WindowStylesChoice, g_WindowStylesChoice); AddStyles("wxScrollBar", g_WindowStylesScrollBarCount, g_WindowStylesScrollBar); } @@ -334,25 +335,25 @@ bool wxWindowStyleTable::GenerateStyleStrings(const wxString& className, long wi wxWindowStyleClass* styleClass = FindClass(className); if (!styleClass) return FALSE; - + styleClass->GenerateStyleStrings(windowStyle, buf); return TRUE; } /* - * Holds all the styles for a particular class - */ +* Holds all the styles for a particular class +*/ wxWindowStyleClass::wxWindowStyleClass(int n, wxWindowStylePair *styles) { m_styleCount = n; m_styles = styles; -/* + /* m_styles = new wxWindowStylePair[n]; int i; for (i = 0; i < n; i++) - m_styles[i] = styles[i]; -*/ + m_styles[i] = styles[i]; + */ } wxWindowStyleClass::~wxWindowStyleClass() @@ -371,15 +372,15 @@ bool wxWindowStyleClass::GenerateStyle(char *buf, long windowStyle, long flag, c // Ignore zero flags if (flag == 0) return TRUE; - - if ((windowStyle & flag) == flag) - { - if (strlen(buf) > 0) - strcat(buf, " | "); - strcat(buf, (const char*) strStyle); - return TRUE; - } - else - return FALSE; + + if ((windowStyle & flag) == flag) + { + if (strlen(buf) > 0) + strcat(buf, " | "); + strcat(buf, (const char*) strStyle); + return TRUE; + } + else + return FALSE; } diff --git a/utils/dialoged/src/winstyle.h b/utils/dialoged/src/winstyle.h index d7aaf063f4..1f59adf01f 100644 --- a/utils/dialoged/src/winstyle.h +++ b/utils/dialoged/src/winstyle.h @@ -19,8 +19,8 @@ #include "wx/wx.h" /* - * A class for storing/generating window styles. - */ +* A class for storing/generating window styles. +*/ class wxWindowStyleClass; @@ -37,41 +37,41 @@ class wxWindowStyleTable: public wxObject public: wxWindowStyleTable(); ~wxWindowStyleTable(); - -// Operations + + // Operations void ClearTable(); void AddStyles(const wxString& className, int n, wxWindowStylePair *styles); wxWindowStyleClass* FindClass(const wxString& className) ; bool GenerateStyleStrings(const wxString& className, long windowStyle, char *buf); - + // Initialise with all possible styles void Init(); - -// Members + + // Members protected: wxList m_classes; // A list of wxWindowStyleClass objects, indexed by class name - + }; /* - * Classes for storing all the window style identifiers associated with a particular class - */ +* Classes for storing all the window style identifiers associated with a particular class +*/ class wxWindowStyleClass: public wxObject { public: wxWindowStyleClass(int n, wxWindowStylePair *styles); ~wxWindowStyleClass(); - -// Operations + + // Operations void GenerateStyleStrings(long windowStyle, char *buf); bool GenerateStyle(char *buf, long windowStyle, long flag, const wxString& strStyle); - -// Members + + // Members protected: wxWindowStylePair* m_styles; // An array of wxWindowStylePair objects int m_styleCount; }; #endif - // _DE_WINSTYLE_H_ +// _DE_WINSTYLE_H_ diff --git a/utils/makegen/makefile.g95 b/utils/makegen/makefile.g95 index ed4db1b1c3..999082cd24 100644 --- a/utils/makegen/makefile.g95 +++ b/utils/makegen/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=makegen OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/utils/makegen/templates/makefile.g95 b/utils/makegen/templates/makefile.g95 index 41e1be06fd..4783f79139 100644 --- a/utils/makegen/templates/makefile.g95 +++ b/utils/makegen/templates/makefile.g95 @@ -6,5 +6,5 @@ WXDIR = ../.. TARGET=#NAME OBJECTS = $(TARGET).o -include $(WXDIR)\src\makeprog.g95 +include $(WXDIR)/src/makeprog.g95 diff --git a/utils/tex2rtf/docs/back.gif b/utils/tex2rtf/docs/back.gif index 8a61076d3ba74bdedc1d24f60c3d1f5a361a6cee..88a3740f9134d7a569b56a9f76e6aa552672993e 100644 GIT binary patch literal 978 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0fnz;`IEReKh6M+kIfS)hPHb3s zxLrWmYmUc8MFs{@V=tBk4vcQS3gSg?UKlR%Y*zN1W>fj;(a}CV`%O8V#mmmJDyQBv znOUrUdY)b7H6AG;jlf>Rey!M3TUK6P?i!m{q7|$j(iU2nb+j@t;aY#t_B`I%AGL2Z zO6>3Q?Jm>3v>|kImhI|mtHW1|tWDEBQI>amZ`s68xzaas@2+e3%;$D{>W3T0V&ot1 Q_1d}V>FF7|>?{n{02fm-00000 literal 225 zcmV<703QEGNk%v~VLt#E0Pz3-zrVld=jU&4Z(9HWEC2ui06zd20008IjE||y?GK}z zNf>~$-n{z{YJwGn=81mem9{RpmcUHc_KoNIPRH~B4DyD9p%LJl6@Sa4^Epcbno6kk zD5XxT&EQg7><X(t<v2<zGtFvpm%NS3x723V`)<ec-&(({)sqHiQ-=rlS4S8Ibd!~% zh!dt38EIxWIOn%1Dfj2b8T!~6YUzo%W;uEjc(%yY2)pMhb!7`xd#gK?yX%Y7`zwsb bGHgs7FrvK7-0b`e9qpVfU2T0WT>t<(Iwfoo diff --git a/utils/tex2rtf/docs/contents.gif b/utils/tex2rtf/docs/contents.gif index 3dddfa3dd5f0c652e8b27cd6c29e1fdd49ced5a8..723174f81d04d16e94016186ac0322dcddb603c7 100644 GIT binary patch literal 996 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0RsaNgBYV=Gz5lX2>kxA zV8N1xh6Z3tW&ovR5Cx<mX<G3o3nK#qH-ipPlmV0{7&s0xh;ztzY*=uxnL}7B=ER1D zhuZ~|rC1mo6pnTY8GErDXmC8*FXe3Y#N(o}$3zXmNg)dwo-p-jCP#faF-g^PhEd?U zHJO)_&rPwe{C4E0u`<I#r%tiE5uYCg&h~b-%e`5+>e34SwPCqkp^L+21?)C@%eigo zjb6XYK{ltit-ZayK=RQZsqlw)b_u-S7xTMFKYoAy)o)vOlz%vRFz5Xto6e7mgSU6F l8>#t(=cJr!`K{OHv%&EGv6=dhWPNvSd3kw-DjN%fH2`phKPvzL literal 231 zcmV<D02u#ANk%v~VL<>G0Pz3-zrVld=jU&4Z(9HWEC2ui06_p40008OjE||y?GK}z zO&EZ)-n{z{a)K3v=81;mmA0<AmhVhw@iyc`&3|{61I~6YqK~98Vw5OmQ-xfDbjF=- z8N_A**6fx0#r(KaDON}}o43Sv(iTm3lx}qOEl<})aVL6>S4Fj_r^UyThZDG{h6k9m zHI_(7spd!5_$SH6m{<Auh$$AQ#YFX|N5^T`76u^M6AJ<hP-}aOo2$Fa+xtrD8!SAm hOG|u=TnwDd%p5ZU9W6agU2T1B9e};f-Q8UP06VhvYa0Ln diff --git a/utils/tex2rtf/docs/forward.gif b/utils/tex2rtf/docs/forward.gif index 9c81e8c92fed7fe851ce02e7854dc26a58eae9b2..d8862174ed264064e4092accd3b9cef539651ad1 100644 GIT binary patch literal 959 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0fnyGXIEReKh6M+kIfS)hPHb3s zxLrWmYmUc6#fEMMt*jmnhsLHJY3Haf96?J?Hp|-2i-|Ny^_-?1d#FXTc$r6!p5d)K zGcGBgoU2&9ibd*+`o-D${aUf7wyeCo+&Es%)uQy}(Z*2TG}~E%ORlfx_IlKED>NZ; wbH-jL-q~hvBDNIFUuAn+=ylY_lIO=twXW(!Y|OjPCFiqa!^6Y8%uEc{09+_1fB*mh literal 164 zcmV;V09*e@Nk%v~VI=?<0Pz3-zrVld=jU&4Z(9HWEC2ui03`qz0007gjE||y?Z1Qp zwAzdF6*A}#V%!v#-{_g@)>Q-cu3}3Ku`2^Nfa3dZ+VyHW%gtsZ`jV7k@%j8Ij}~W) zc{NUP6)X3OWa^|{8nl?rh|gZ1@{(qofnsWu+nmFHSnaq>lB41zSVC9`a)_v*xHx0L S5h*!IS!o$ynW>ps0028gDN7ju diff --git a/utils/tex2rtf/docs/tex2rtf.hpj b/utils/tex2rtf/docs/tex2rtf.hpj index b00537e2d3..5660611a26 100644 --- a/utils/tex2rtf/docs/tex2rtf.hpj +++ b/utils/tex2rtf/docs/tex2rtf.hpj @@ -1,5 +1,5 @@ [OPTIONS] -BMROOT=d:\wx2\wxWind~1\utils\tex2rtf\docs ; Assume that bitmaps are where the source is +BMROOT=. ; Assume that bitmaps are where the source is TITLE=Tex2RTF Manual CONTENTS=Contents COMPRESS=HIGH diff --git a/utils/tex2rtf/docs/tex2rtf.ini b/utils/tex2rtf/docs/tex2rtf.ini index fae52d1baf..f907369d52 100644 --- a/utils/tex2rtf/docs/tex2rtf.ini +++ b/utils/tex2rtf/docs/tex2rtf.ini @@ -13,6 +13,11 @@ listItemIndent=40 winHelpContents = yes winHelpVersion = 3 ; 3 for Windows 3.x, 4 for Windows 95 generateHPJ = yes +;; +;; These two are for generating MS HTML Help project, contents and index files. +;; +htmlWorkshopFiles = true +htmlIndex = true htmlBrowseButtons = bitmap winHelpTitle = "Tex2RTF Manual" truncateFilenames = yes diff --git a/utils/tex2rtf/docs/tex2rtf.tex b/utils/tex2rtf/docs/tex2rtf.tex index 43b8fe5345..84bdee739e 100644 --- a/utils/tex2rtf/docs/tex2rtf.tex +++ b/utils/tex2rtf/docs/tex2rtf.tex @@ -1,5 +1,5 @@ \documentstyle[a4,makeidx,verbatim,texhelp,fancyhea,mysober,mytitle]{report}% -\input{psbox.tex} +%\input{psbox.tex} \newcommand{\commandref}[2]{\helpref{{\tt $\backslash$#1}}{#2}}% \newcommand{\commandrefn}[2]{\helprefn{{\tt $\backslash$#1}}{#2}\index{#1}}% \newcommand{\commandpageref}[2]{\latexignore{\helprefn{{\tt $\backslash$#1}}{#2}}\latexonly{{\tt $\backslash$#1} {\it page \pageref{#2}}}\index{#1}}% @@ -8,7 +8,7 @@ \parskip=10pt% \parindent=0pt% %\backgroundcolour{255;255;255}\textcolour{0;0;0}% Has an effect in HTML only -\winhelpignore{\title{Manual for Tex2RTF 2.0:\\A \LaTeX\ to RTF and HTML converter}% +\winhelpignore{\title{Manual for Tex2RTF 2.0: A \LaTeX\ to RTF and HTML converter}% \author{Julian Smart}% \date{November 1999}% }% diff --git a/utils/tex2rtf/docs/up.gif b/utils/tex2rtf/docs/up.gif index 316d0d2a14b571bea2eb874efd04bfe509f53b34..870c89e80a826e3b225cc8fe9a30edf9c5a66c22 100644 GIT binary patch literal 998 zcmZ?wbhEHbbYM_m_|5<V4Pe{=rW$~}hK2(`aOc3XQy=~V0Rsbw90j8xFhoP(_lE@w zmNYap08=u<e_&z;Q9v4!tQCK<FfuT3Gw1+C89;f0f#WcPIEReKh6M+kIfS)hPHb3s zxLrWmYmUc8MFs{@V=tBk4vcQS3gSg?UKlR%Y*zN1W>fj;(a}CV`%O8V#mmmJDyQBv znOUrUdY)b7p%TfE<WsX;wdG=GmL&Ns@?GpT*Q<27-(3EUR##4aSao^5;NGM?9g}np z_6MXcGCdvoByvv1eJ&B}f}Gen<+rt#SZ_}_v)%vqI@ML?it&5Oe?N2Wl*mqONqVei lrfp&P=yaL+vexKtMaie;nK#$Ol;*#@ydrpYnS=m?H2|-sI%)s_ literal 137 zcmV;40CxXJNk%v~VHyA!0Pz3-zrVld=jU&4Z(9HWEC2ui02%-o0007FjE||ytzv+j zv|1owxcuhWh0?c)Avq0}dTQw^q7qBdoDA6WKJ*l>%gtCeAWZlgxpoy|ZDMRPr_m>p rx}08pS4?)u<%PW<QBYY9oyjHh?Q62&;&M&qj?e4yfxZ7PPyhfsDH=Ws diff --git a/utils/tex2rtf/src/makefile.vc b/utils/tex2rtf/src/makefile.vc index bf9327aca7..9552bd1bf8 100644 --- a/utils/tex2rtf/src/makefile.vc +++ b/utils/tex2rtf/src/makefile.vc @@ -91,6 +91,8 @@ cleanall: DOCSOURCES=$(LOCALDOCDIR)\tex2rtf.tex html: $(DOCDIR)\html\tex2rtf\t2rtf.htm +htmlhelp: $(DOCDIR)\htmlhelp\tex2rtf.chm +htb: $(DOCDIR)\htb\tex2rtf.htb hlp: $(DOCDIR)\winhelp\tex2rtf.hlp pdfrtf: $(DOCDIR)\pdf\tex2rtf.rtf ps: $(WXDIR)\docs\ps\tex2rtf.ps @@ -118,11 +120,30 @@ $(DOCDIR)\pdf\tex2rtf.rtf: $(DOCSOURCES) $(DOCDIR)\html\tex2rtf\t2rtf.htm: $(DOCSOURCES) cd $(LOCALDOCDIR) -mkdir $(DOCDIR)\html\tex2rtf + -copy *.gif $(DOCDIR)\html\tex2rtf -start /w tex2rtf $(LOCALDOCDIR)\tex2rtf.tex $(DOCDIR)\html\tex2rtf\t2rtf.htm -twice -html -erase $(DOCDIR)\html\tex2rtf\*.con -erase $(DOCDIR)\html\tex2rtf\*.ref cd $(THISDIR) +$(DOCDIR)\htmlhelp\tex2rtf.chm : $(DOCDIR)\html\tex2rtf\t2rtf.htm $(DOCDIR)\html\tex2rtf\t2rtf.hhp + cd $(DOCDIR)\html\tex2rtf + -hhc t2rtf.hhp + move t2rtf.chm $(DOCDIR)\htmlhelp\tex2rtf.chm + cd $(THISDIR) + +# An htb file is a zip file containing the .htm, .gif, .hhp, .hhc and .hhk +# files, renamed to htb. +# This can then be used with e.g. helpview. +# Optionally, a cached version of the .hhp file can be generated with hhp2cached. +$(DOCDIR)\htb\tex2rtf.htb: $(DOCDIR)\html\tex2rtf\t2rtf.htm + cd $(DOCDIR)\html\tex2rtf + -erase /Y tex2rtf.zip tex2rtf.htb + zip32 tex2rtf.zip *.htm *.gif *.hhp *.hhc *.hhk + -mkdir $(DOCDIR)\htb + move tex2rtf.zip $(DOCDIR)\htb\tex2rtf.htb + cd $(THISDIR) + $(LOCALDOCDIR)\tex2rtf.dvi: $(DOCSOURCES) cd $(LOCALDOCDIR) -latex tex2rtf diff --git a/utils/tex2rtf/src/tex2any.cpp b/utils/tex2rtf/src/tex2any.cpp index cefb10037e..5f134ea588 100644 --- a/utils/tex2rtf/src/tex2any.cpp +++ b/utils/tex2rtf/src/tex2any.cpp @@ -363,6 +363,14 @@ bool FindEndEnvironment(char *buffer, int *pos, char *env) bool readingVerbatim = FALSE; bool readInVerbatim = FALSE; // Within a verbatim, but not nec. verbatiminput +// Switched this off because e.g. \verb${$ causes it to fail. There is no +// detection of \verb yet. +#define CHECK_BRACES 0 + +unsigned long leftCurly = 0; +unsigned long rightCurly = 0; +static wxString currentFileName = ""; + bool read_a_line(char *buf) { if (CurrentInputIndex < 0) @@ -374,6 +382,7 @@ bool read_a_line(char *buf) int ch = -2; int i = 0; buf[0] = 0; + while (ch != EOF && ch != 10) { if (((i == 14) && (strncmp(buf, "\\end{verbatim}", 14) == 0)) || @@ -381,6 +390,26 @@ bool read_a_line(char *buf) readInVerbatim = FALSE; ch = getc(Inputs[CurrentInputIndex]); + +#if CHECK_BRACES + if (ch == '{' && !readInVerbatim) + leftCurly++; + if (ch == '}' && !readInVerbatim) + { + rightCurly++; + if (rightCurly > leftCurly) + { + wxString errBuf; + errBuf.Printf("An extra right Curly brace ('}') was detected at line %l inside file %s",LineNumbers[CurrentInputIndex], (const char*) currentFileName.c_str()); + OnError((char *)errBuf.c_str()); + + // Reduce the count of right curly braces, so the mismatched count + // isn't reported on every line that has a '}' after the first mismatch + rightCurly--; + } + } +#endif + if (ch != EOF) { // Check for 2 consecutive newlines and replace with \par @@ -450,8 +479,19 @@ bool read_a_line(char *buf) buf[i] = 0; fclose(Inputs[CurrentInputIndex]); Inputs[CurrentInputIndex] = NULL; - if (CurrentInputIndex > 0) ch = ' '; // No real end of file + if (CurrentInputIndex > 0) + ch = ' '; // No real end of file CurrentInputIndex --; +#if CHECK_BRACES + if (leftCurly != rightCurly) + { + wxString errBuf; + errBuf.Printf("Curly braces do not match inside file %s\n%lu opens, %lu closes", (const char*) currentFileName.c_str(),leftCurly,rightCurly); + OnError((char *)errBuf.c_str()); + } + leftCurly = 0; + rightCurly = 0; +#endif if (readingVerbatim) { readingVerbatim = FALSE; @@ -491,6 +531,7 @@ bool read_a_line(char *buf) if (buf[j-1] == '}') buf[j-1] = 0; // Ignore final brace wxString actualFile = TexPathList.FindValidPath(fileName); + currentFileName = actualFile; if (actualFile == "") { char errBuf[300]; @@ -500,6 +541,9 @@ bool read_a_line(char *buf) } else { + wxString informStr; + informStr.Printf("Processing: %s",actualFile.c_str()); + OnInform((char *)informStr.c_str()); CurrentInputIndex ++; Inputs[CurrentInputIndex] = fopen(actualFile, "r"); LineNumbers[CurrentInputIndex] = 1; @@ -552,6 +596,7 @@ bool read_a_line(char *buf) // Ignore some types of input files (e.g. macro definition files) char *fileOnly = FileNameFromPath(fileName); + currentFileName = fileOnly; if (IgnorableInputFiles.Member(fileOnly)) return read_a_line(buf); @@ -562,6 +607,8 @@ bool read_a_line(char *buf) sprintf(buf2, "%s.tex", fileName); actualFile = TexPathList.FindValidPath(buf2); } + currentFileName = actualFile; + if (actualFile == "") { char errBuf[300]; @@ -575,6 +622,9 @@ bool read_a_line(char *buf) // then we look in the same directory as this one. TexPathList.EnsureFileAccessible(actualFile); + wxString informStr; + informStr.Printf("Processing: %s",actualFile.c_str()); + OnInform((char *)informStr.c_str()); CurrentInputIndex ++; Inputs[CurrentInputIndex] = fopen(actualFile, "r"); LineNumbers[CurrentInputIndex] = 1; @@ -600,6 +650,15 @@ bool read_a_line(char *buf) strncmp(buf, "\\end{toocomplex}", 16) == 0) readInVerbatim = FALSE; +#if CHECK_BRACES + if (ch == EOF && leftCurly != rightCurly) + { + wxString errBuf; + errBuf.Printf("Curly braces do not match inside file %s\n%lu opens, %lu closes", (const char*) currentFileName.c_str(),leftCurly,rightCurly); + OnError((char *)errBuf.c_str()); + } +#endif + return (ch == EOF); } @@ -2024,7 +2083,7 @@ void DefineDefaultMacros(void) AddMacroDef(ltNABLA, "nabla", 0); AddMacroDef(ltNEG, "neg", 0); AddMacroDef(ltNEQ, "neq", 0); - AddMacroDef(ltNEWCOUNTER, "newcounter", 1, FALSE, FORBID_ABSOLUTELY); + AddMacroDef(ltNEWCOUNTER, "newcounter", 1, FALSE, (bool)FORBID_ABSOLUTELY); AddMacroDef(ltNEWLINE, "newline", 0); AddMacroDef(ltNEWPAGE, "newpage", 0); AddMacroDef(ltNI, "ni", 0); @@ -2077,8 +2136,8 @@ void DefineDefaultMacros(void) AddMacroDef(ltPRECEQ, "preceq", 0); AddMacroDef(ltPRINTINDEX, "printindex", 0); AddMacroDef(ltPROPTO, "propto", 0); - AddMacroDef(ltPSBOXTO, "psboxto", 1, FALSE, FORBID_ABSOLUTELY); - AddMacroDef(ltPSBOX, "psbox", 1, FALSE, FORBID_ABSOLUTELY); + AddMacroDef(ltPSBOXTO, "psboxto", 1, FALSE, (bool)FORBID_ABSOLUTELY); + AddMacroDef(ltPSBOX, "psbox", 1, FALSE, (bool)FORBID_ABSOLUTELY); AddMacroDef(ltPSI, "psi", 0); AddMacroDef(ltCAP_PSI, "Psi", 0); diff --git a/utils/tex2rtf/src/tex2rtf.cpp b/utils/tex2rtf/src/tex2rtf.cpp index fd069479dc..88d23ff9c8 100644 --- a/utils/tex2rtf/src/tex2rtf.cpp +++ b/utils/tex2rtf/src/tex2rtf.cpp @@ -105,7 +105,11 @@ void ShowOptions(void); #ifdef NO_GUI -extern char *wxBuffer; // we must init it, otherwise tex2rtf will crash +#if wxUSE_GUI || !defined(__UNIX__) +// wxBase for Unix does not have wxBuffer +extern +#endif +char *wxBuffer; // we must init it, otherwise tex2rtf will crash int main(int argc, char **argv) #else @@ -170,7 +174,8 @@ bool MyApp::OnInit() if (!InputFile || !OutputFile) isInteractive = TRUE; - for (int i = n; i < argc;) + int i; + for (i = n; i < argc;) { if (strcmp(argv[i], "-winhelp") == 0) { @@ -497,6 +502,7 @@ void MyFrame::OnExit(wxCommandEvent& event) void MyFrame::OnGo(wxCommandEvent& event) { + passNumber = 1; menuBar->EnableTop(0, FALSE); menuBar->EnableTop(1, FALSE); menuBar->EnableTop(2, FALSE); @@ -826,7 +832,7 @@ bool Go(void) char buf[100]; #ifndef NO_GUI long tim = wxGetElapsedTime(); - sprintf(buf, "Finished in %ld seconds.", (long)(tim/1000.0)); + sprintf(buf, "Finished PASS #%d in %ld seconds.\n", passNumber, (long)(tim/1000.0)); OnInform(buf); if (isInteractive) { diff --git a/utils/wxPython/.cvsignore b/utils/wxPython/.cvsignore deleted file mode 100644 index 35d9a3fb04..0000000000 --- a/utils/wxPython/.cvsignore +++ /dev/null @@ -1,124 +0,0 @@ -*.py -*.pyc -*.pyc -*.pyd -*.pyd -*.pyo -*.pyo -*.zip -.cvsignore -.emacs.desktop -__init__.py -__init__.py -__init__.pyc -__init__.pyc -__init__.pyo -__init__.pyo -build.local -cmndlgs.py -cmndlgs.py -cmndlgs.pyc -cmndlgs.pyc -cmndlgs.pyo -cmndlgs.pyo -controls.py -controls.py -controls.pyc -controls.pyc -controls.pyo -controls.pyo -controls2.py -controls2.py -controls2.pyc -controls2.pyc -controls2.pyo -controls2.pyo -docs -events.py -events.py -events.pyc -events.pyc -events.pyo -events.pyo -filelist -frames.py -frames.py -frames.pyc -frames.pyc -frames.pyo -frames.pyo -gdi.py -gdi.py -gdi.pyc -gdi.pyc -gdi.pyo -gdi.pyo -glcanvas.py -glcanvas.pyc -glcanvasc.ilk -glcanvasc.pyd -gpl.txt -image.py -image.pyc -lgpl.txt -licence.txt -licendoc.txt -mdi.py -mdi.py -mdi.pyc -mdi.pyc -mdi.pyo -mdi.pyo -misc.py -misc.py -misc.pyc -misc.pyc -misc.pyo -misc.pyo -preamble.txt -printfw.py -stattool.py -stattool.py -stattool.pyc -stattool.pyc -stattool.pyo -stattool.pyo -update.log -utils.py -utils.py -utils.pyc -utils.pyc -utils.pyo -utilsc.ilk -utilsc.pyd -windows.py -windows.py -windows.pyc -windows.pyc -windows.pyo -windows.pyo -windows2.py -windows2.py -windows2.pyc -windows2.pyc -windows2.pyo -windows2.pyo -windows3.py -windows3.pyc -windows3.pyo -writings -wx.py -wx.py -wx.pyc -wx.pyc -wx.pyo -wxPython.doc -wxc.ilk -wxc.pdb -wxc.pyd -wxp.py -wxp.pyc -wxp.pyo -wxpc.ilk -wxpc.pdb -wxpc.pyd diff --git a/utils/wxPython/Makefile b/utils/wxPython/Makefile deleted file mode 100644 index f0c1f754dd..0000000000 --- a/utils/wxPython/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -#---------------------------------------------------------------------- -# Convenience makefile to drive the build script in a more user -# friendly manner. -#---------------------------------------------------------------------- - - -all: - ./buildall -b - - -install: all - ./buildall -i - -clean: - ./buildall -c - -uninstall: - ./buildall -u diff --git a/utils/wxPython/SWIG.patches/Include.patch b/utils/wxPython/SWIG.patches/Include.patch deleted file mode 100644 index 7012b56d59..0000000000 --- a/utils/wxPython/SWIG.patches/Include.patch +++ /dev/null @@ -1,139 +0,0 @@ -*** swig.h.old Wed Feb 04 15:59:40 1998 ---- swig.h Fri Aug 28 15:46:32 1998 -*************** -*** 178,185 **** ---- 178,211 ---- - char *firstkey(); - char *nextkey(); - }; - -+ // ------------------------------------------------------------------- -+ // Simple Vector class -+ // User is responsible for deleting contents before deleteing Vector -+ // ------------------------------------------------------------------- -+ -+ class Vector { -+ public: -+ Vector(size_t allocSize=8); -+ ~Vector(); -+ -+ size_t size() { return m_size; } -+ size_t count() { return m_count; } -+ size_t append(void* object); -+ size_t extend(size_t newSize); -+ -+ void*& operator[] (size_t idx); -+ -+ static void* s_nullPtr; -+ -+ private: -+ size_t m_size; -+ size_t m_count; -+ void** m_data; -+ }; -+ -+ - /************************************************************************ - * class DataType - * - * Defines the basic datatypes supported by the translator. -*************** -*** 684,691 **** ---- 710,761 ---- - extern char *name_get(char *vname, int suppress=0); - extern char *name_set(char *vname, int suppress=0); - extern char *name_construct(char *classname, int suppress=0); - extern char *name_destroy(char *classname, int suppress=0); -+ -+ // ---------------------------------------------------------------------- -+ // class CPP_class -+ // -+ // Class for managing class members (internally) -+ // ---------------------------------------------------------------------- -+ -+ class CPP_member; -+ -+ class CPP_class { -+ public: -+ char *classname; // Real class name -+ char *classrename; // New name of class (if applicable) -+ char *classtype; // class type (struct, union, class) -+ int strip; // Strip off class declarator -+ int wextern; // Value of extern wrapper variable for this class -+ int have_constructor; // Status bit indicating if we've seen a constructor -+ int have_destructor; // Status bit indicating if a destructor has been seen -+ int is_abstract; // Status bit indicating if this is an abstract class -+ int generate_default; // Generate default constructors -+ int objective_c; // Set if this is an objective C class -+ int error; // Set if this class can't be generated -+ int line; // Line number -+ char **baseclass; // Base classes (if any) -+ Hash *local; // Hash table for local types -+ Hash *scope; // Local scope hash table -+ DocEntry *de; // Documentation entry of class -+ CPP_member *members; // Linked list of members -+ CPP_class *next; // Next class -+ static CPP_class *classlist; // List of all classes stored -+ -+ Vector addPragmas; -+ -+ CPP_class(char *name, char *ctype); -+ void add_member(CPP_member *m); -+ CPP_member *search_member(char *name); -+ void inherit_decls(int mode); -+ void emit_decls(); -+ static CPP_class *search(char *name); -+ void create_default(); -+ static void create_all(); -+ }; -+ -+ extern CPP_class *current_class; - - /*********************************************************************** - * -- Revision History - * $Log$ - * Revision 1.2 1999/07/31 07:54:05 RD - * wxPython 2.1b1: - * - * Added the missing wxWindow.GetUpdateRegion() method. - * - * Made a new change in SWIG (update your patches everybody) that - * provides a fix for global shadow objects that get an exception in - * their __del__ when their extension module has already been deleted. - * It was only a 1 line change in .../SWIG/Modules/pycpp.cxx at about - * line 496 if you want to do it by hand. - * - * It is now possible to run through MainLoop more than once in any one - * process. The cleanup that used to happen as MainLoop completed (and - * prevented it from running again) has been delayed until the wxc module - * is being unloaded by Python. - * - * wxWindow.PopupMenu() now takes a wxPoint instead of x,y. Added - * wxWindow.PopupMenuXY to be consistent with some other methods. - * - * Added wxGrid.SetEditInPlace and wxGrid.GetEditInPlace. - * - * You can now provide your own app.MainLoop method. See - * wxPython/demo/demoMainLoop.py for an example and some explaination. - * - * Got the in-place-edit for the wxTreeCtrl fixed and added some demo - * code to show how to use it. - * - * Put the wxIcon constructor back in for GTK as it now has one that - * matches MSW's. - * - * Added wxGrid.GetCells - * - * Added wxSystemSettings static methods as functions with names like - * wxSystemSettings_GetSystemColour. - * - * Removed wxPyMenu since using menu callbacks have been depreciated in - * wxWindows. Use wxMenu and events instead. - * - * Added alternate wxBitmap constructor (for MSW only) as - * wxBitmapFromData(data, type, width, height, depth = 1) - * - * Added a helper function named wxPyTypeCast that can convert shadow - * objects of one type into shadow objects of another type. (Like doing - * a down-cast.) See the implementation in wx.py for some docs. - * diff --git a/utils/wxPython/SWIG.patches/Modules.patch b/utils/wxPython/SWIG.patches/Modules.patch deleted file mode 100644 index 0cbc44f0f2..0000000000 --- a/utils/wxPython/SWIG.patches/Modules.patch +++ /dev/null @@ -1,202 +0,0 @@ -*** python.cxx.old Fri Jan 02 23:17:40 1998 ---- python.cxx Fri Aug 28 15:49:18 1998 -*************** -*** 1678,1685 **** ---- 1678,1702 ---- - fprintf(stderr,"%s : Line %d. Unable to locate file %s\n", input_file, line_number, value); - } - } - } -+ } else if (strcmp(cmd, "addtomethod") == 0) { -+ // parse value, expected to be in the form "methodName:line" -+ char* txtptr = strchr(value, ':'); -+ if (txtptr) { -+ // add name and line to a list in current_class -+ *txtptr = 0; -+ txtptr++; -+ AddPragmaData* apData = new AddPragmaData(value, txtptr); -+ current_class->addPragmas.append(apData); -+ -+ } else { -+ fprintf(stderr,"%s : Line %d. Malformed addtomethod pragma. Should be \"methodName:text\"\n", -+ input_file, line_number); -+ } -+ } else if (strcmp(cmd, "addtoclass") == 0) { -+ AddPragmaData* apData = new AddPragmaData("__class__", value); -+ current_class->addPragmas.append(apData); - } else { - fprintf(stderr,"%s : Line %d. Unrecognized pragma.\n", input_file, line_number); - } - } -*** python.h.old Thu Jul 24 23:18:50 1997 ---- python.h Fri Aug 28 15:46:08 1998 -*************** -*** 184,191 **** ---- 184,203 ---- - void cpp_declare_const(char *name, char *iname, DataType *type, char *value); - void cpp_class_decl(char *, char *,char *); - void pragma(char *, char *, char *); - void add_typedef(DataType *t, char *name); -+ -+ void emitAddPragmas(String& output, char* name, char* spacing); - }; - - #define PYSHADOW_MEMBER 0x2 -+ -+ struct AddPragmaData { -+ String m_method; -+ String m_text; -+ -+ AddPragmaData(char* method, char* text) -+ : m_method(method), -+ m_text(text) -+ {} -+ }; - -*** pycpp.cxx.old Fri Jan 02 21:23:22 1998 ---- pycpp.cxx Tue Jul 20 14:34:36 1999 -*************** -*** 275,282 **** ---- 275,283 ---- - #endif - } - } - // if ((t->type != T_VOID) || (t->is_pointer)) -+ emitAddPragmas(*pyclass, realname, tab8); - *pyclass << tab8 << "return val\n"; - - // Change the usage string to reflect our shadow class - -*************** -*** 393,400 **** ---- 394,402 ---- - } - } - *construct << ")\n"; - *construct << tab8 << "self.thisown = 1\n"; -+ emitAddPragmas(*construct, "__init__", tab8); - have_constructor = 1; - } else { - - // Hmmm. We seem to be creating a different constructor. We're just going to create a -*************** -*** 490,503 **** - if (class_renamed) realname = class_name; - else realname = name; - } - -! *pyclass << tab4 << "def __del__(self):\n" - << tab8 << "if self.thisown == 1 :\n" - << tab8 << tab4 << module << "." << name_destroy(realname) << "(self.this)\n"; -! - have_destructor = 1; -- - if (doc_entry) { - doc_entry->usage = ""; - doc_entry->usage << "del this"; - } ---- 492,504 ---- - if (class_renamed) realname = class_name; - else realname = name; - } - -! *pyclass << tab4 << "def __del__(self, " << module << "=" << module << "):\n" - << tab8 << "if self.thisown == 1 :\n" - << tab8 << tab4 << module << "." << name_destroy(realname) << "(self.this)\n"; -! emitAddPragmas(*pyclass, "__del__", tab8); - have_destructor = 1; - if (doc_entry) { - doc_entry->usage = ""; - doc_entry->usage << "del this"; - } -*************** -*** 551,558 **** ---- 552,561 ---- - repr << tab4 << "def __repr__(self):\n" - << tab8 << "return \"<C " << class_name <<" instance>\"\n"; - - classes << repr; -+ emitAddPragmas(classes, "__class__", tab4); -+ - } - - // Now build the real class with a normal constructor - -*************** -*** 746,753 **** ---- 749,778 ---- - hash.add(name,copy_string((char *) hash.lookup(t->name))); - } - } - -+ // -------------------------------------------------------------------------------- -+ // PYTHON::emitAddPragmas(String& output, char* name, char* spacing); -+ // -+ // Search the current_class->addPragmas vector for any text belonging to name. -+ // Append the text properly spcaed to the output string. -+ // -+ // -------------------------------------------------------------------------------- -+ -+ void PYTHON::emitAddPragmas(String& output, char* name, char* spacing) -+ { -+ AddPragmaData* apData; -+ size_t count; -+ int i; -+ -+ count = current_class->addPragmas.count(); -+ for (i=0; i<count; i++) { -+ apData = (AddPragmaData*)current_class->addPragmas[i]; -+ if (strcmp(apData->m_method, name) == 0) { -+ output << spacing << apData->m_text << "\n"; -+ } -+ } -+ } - - /********************************************************************************* - * - * $Log$ - * Revision 1.2 1999/07/31 07:54:05 RD - * wxPython 2.1b1: - * - * Added the missing wxWindow.GetUpdateRegion() method. - * - * Made a new change in SWIG (update your patches everybody) that - * provides a fix for global shadow objects that get an exception in - * their __del__ when their extension module has already been deleted. - * It was only a 1 line change in .../SWIG/Modules/pycpp.cxx at about - * line 496 if you want to do it by hand. - * - * It is now possible to run through MainLoop more than once in any one - * process. The cleanup that used to happen as MainLoop completed (and - * prevented it from running again) has been delayed until the wxc module - * is being unloaded by Python. - * - * wxWindow.PopupMenu() now takes a wxPoint instead of x,y. Added - * wxWindow.PopupMenuXY to be consistent with some other methods. - * - * Added wxGrid.SetEditInPlace and wxGrid.GetEditInPlace. - * - * You can now provide your own app.MainLoop method. See - * wxPython/demo/demoMainLoop.py for an example and some explaination. - * - * Got the in-place-edit for the wxTreeCtrl fixed and added some demo - * code to show how to use it. - * - * Put the wxIcon constructor back in for GTK as it now has one that - * matches MSW's. - * - * Added wxGrid.GetCells - * - * Added wxSystemSettings static methods as functions with names like - * wxSystemSettings_GetSystemColour. - * - * Removed wxPyMenu since using menu callbacks have been depreciated in - * wxWindows. Use wxMenu and events instead. - * - * Added alternate wxBitmap constructor (for MSW only) as - * wxBitmapFromData(data, type, width, height, depth = 1) - * - * Added a helper function named wxPyTypeCast that can convert shadow - * objects of one type into shadow objects of another type. (Like doing - * a down-cast.) See the implementation in wx.py for some docs. - * diff --git a/utils/wxPython/SWIG.patches/SWIG.patch b/utils/wxPython/SWIG.patches/SWIG.patch deleted file mode 100644 index a50235c64b..0000000000 --- a/utils/wxPython/SWIG.patches/SWIG.patch +++ /dev/null @@ -1,530 +0,0 @@ -*** cplus.cxx.old Mon Feb 02 15:55:42 1998 ---- cplus.cxx Fri Aug 28 13:02:50 1998 -*************** -*** 581,612 **** - // Class for managing class members (internally) - // ---------------------------------------------------------------------- - - static char *inherit_base_class = 0; - -- class CPP_class { -- public: -- char *classname; // Real class name -- char *classrename; // New name of class (if applicable) -- char *classtype; // class type (struct, union, class) -- int strip; // Strip off class declarator -- int wextern; // Value of extern wrapper variable for this class -- int have_constructor; // Status bit indicating if we've seen a constructor -- int have_destructor; // Status bit indicating if a destructor has been seen -- int is_abstract; // Status bit indicating if this is an abstract class -- int generate_default; // Generate default constructors -- int objective_c; // Set if this is an objective C class -- int error; // Set if this class can't be generated -- int line; // Line number -- char **baseclass; // Base classes (if any) -- Hash *local; // Hash table for local types -- Hash *scope; // Local scope hash table -- DocEntry *de; // Documentation entry of class -- CPP_member *members; // Linked list of members -- CPP_class *next; // Next class -- static CPP_class *classlist; // List of all classes stored - -! CPP_class(char *name, char *ctype) { - CPP_class *c; - classname = copy_string(name); - classtype = copy_string(ctype); - classrename = 0; ---- 581,593 ---- - // Class for managing class members (internally) - // ---------------------------------------------------------------------- - - static char *inherit_base_class = 0; -+ CPP_class *CPP_class::classlist = 0; -+ CPP_class *current_class; - - -! CPP_class::CPP_class(char *name, char *ctype) { - CPP_class *c; - classname = copy_string(name); - classtype = copy_string(ctype); - classrename = 0; -*************** -*** 642,650 **** - // ------------------------------------------------------------------------------ - // Add a new C++ member to this class - // ------------------------------------------------------------------------------ - -! void add_member(CPP_member *m) { - CPP_member *cm; - - // Set base class where this was defined - if (inherit_base_class) ---- 623,631 ---- - // ------------------------------------------------------------------------------ - // Add a new C++ member to this class - // ------------------------------------------------------------------------------ - -! void CPP_class::add_member(CPP_member *m) { - CPP_member *cm; - - // Set base class where this was defined - if (inherit_base_class) -*************** -*** 664,672 **** - // ------------------------------------------------------------------------------ - // Search for a member with the given name. Returns the member on success, 0 on failure - // ------------------------------------------------------------------------------ - -! CPP_member *search_member(char *name) { - CPP_member *m; - char *c; - m = members; - while (m) { ---- 645,653 ---- - // ------------------------------------------------------------------------------ - // Search for a member with the given name. Returns the member on success, 0 on failure - // ------------------------------------------------------------------------------ - -! CPP_member *CPP_class::search_member(char *name) { - CPP_member *m; - char *c; - m = members; - while (m) { -*************** -*** 680,688 **** - // ------------------------------------------------------------------------------ - // Inherit. Put all the declarations associated with this class into the current - // ------------------------------------------------------------------------------ - -! void inherit_decls(int mode) { - CPP_member *m; - m = members; - while (m) { - inherit_base_class = m->base; ---- 661,669 ---- - // ------------------------------------------------------------------------------ - // Inherit. Put all the declarations associated with this class into the current - // ------------------------------------------------------------------------------ - -! void CPP_class::inherit_decls(int mode) { - CPP_member *m; - m = members; - while (m) { - inherit_base_class = m->base; -*************** -*** 696,704 **** - // ------------------------------------------------------------------------------ - // Emit all of the declarations associated with this class - // ------------------------------------------------------------------------------ - -! void emit_decls() { - CPP_member *m = members; - int last_scope = name_scope(0); - abstract = is_abstract; - while (m) { ---- 677,685 ---- - // ------------------------------------------------------------------------------ - // Emit all of the declarations associated with this class - // ------------------------------------------------------------------------------ - -! void CPP_class::emit_decls() { - CPP_member *m = members; - int last_scope = name_scope(0); - abstract = is_abstract; - while (m) { -*************** -*** 713,721 **** - // ------------------------------------------------------------------------------ - // Search for a given class in the list - // ------------------------------------------------------------------------------ - -! static CPP_class *search(char *name) { - CPP_class *c; - c = classlist; - if (!name) return 0; - while (c) { ---- 694,702 ---- - // ------------------------------------------------------------------------------ - // Search for a given class in the list - // ------------------------------------------------------------------------------ - -! CPP_class *CPP_class::search(char *name) { - CPP_class *c; - c = classlist; - if (!name) return 0; - while (c) { -*************** -*** 729,737 **** - // Add default constructors and destructors - // - // ------------------------------------------------------------------------------ - -! void create_default() { - if (!generate_default) return; - - // Try to generate a constructor if not available. - ---- 710,718 ---- - // Add default constructors and destructors - // - // ------------------------------------------------------------------------------ - -! void CPP_class::create_default() { - if (!generate_default) return; - - // Try to generate a constructor if not available. - -*************** -*** 751,764 **** - // ------------------------------------------------------------------------------ - // Dump *all* of the classes saved out to the various - // language modules (this does what cplus_close_class used to do) - // ------------------------------------------------------------------------------ -- static void create_all(); -- }; -- -- CPP_class *CPP_class::classlist = 0; -- static CPP_class *current_class; -- - void CPP_class::create_all() { - CPP_class *c; - c = classlist; - while (c) { ---- 732,739 ---- -*** vector.cxx.old Fri Aug 28 15:23:16 1998 ---- vector.cxx Fri Aug 28 15:46:52 1998 -*************** -*** 0 **** ---- 1,182 ---- -+ -+ /******************************************************************************* -+ * Simplified Wrapper and Interface Generator (SWIG) -+ * -+ * Dave Beazley -+ * -+ * Department of Computer Science Theoretical Division (T-11) -+ * University of Utah Los Alamos National Laboratory -+ * Salt Lake City, Utah 84112 Los Alamos, New Mexico 87545 -+ * beazley@cs.utah.edu beazley@lanl.gov -+ * -+ * Copyright (c) 1995-1997 -+ * The University of Utah and the Regents of the University of California -+ * All Rights Reserved -+ * -+ * Permission is hereby granted, without written agreement and without -+ * license or royalty fees, to use, copy, modify, and distribute this -+ * software and its documentation for any purpose, provided that -+ * (1) The above copyright notice and the following two paragraphs -+ * appear in all copies of the source code and (2) redistributions -+ * including binaries reproduces these notices in the supporting -+ * documentation. Substantial modifications to this software may be -+ * copyrighted by their authors and need not follow the licensing terms -+ * described here, provided that the new terms are clearly indicated in -+ * all files where they apply. -+ * -+ * IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, THE -+ * UNIVERSITY OF UTAH OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY -+ * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL -+ * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, -+ * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF -+ * THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, AND THE UNIVERSITY OF UTAH -+ * SPECIFICALLY DISCLAIM ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND -+ * THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, -+ * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -+ * -+ *******************************************************************************/ -+ -+ #include "internal.h" -+ -+ /******************************************************************************* -+ * $Header$ -+ * -+ * File : vector.cxx -+ * -+ * A very simple Vector class. Allways assumes that memory allocations are -+ * successful. Should be made more robust... -+ * -+ *******************************************************************************/ -+ -+ void* Vector::s_nullPtr = NULL; -+ -+ // ----------------------------------------------------------------------------- -+ // Vector::Vector(size_t allocSize = 8) -+ // -+ // Constructor. Creates a new Vector. -+ // -+ // Inputs : initial allocation size (optional) -+ // -+ // Output : New Vector object. -+ // -+ // Side Effects : None -+ // ----------------------------------------------------------------------------- -+ -+ Vector::Vector(size_t allocSize) -+ : m_size(allocSize), -+ m_count(0), -+ m_data(0) -+ { -+ if (m_size) { -+ m_data = new void*[m_size]; -+ int i; -+ for (i=0; i<m_size;i++) -+ m_data[i] = 0; -+ } -+ } -+ -+ -+ // ----------------------------------------------------------------------------- -+ // Vector::~Vector -+ // -+ // Destructor. Only cleans up the vector, not its contents! -+ // -+ // ----------------------------------------------------------------------------- -+ -+ -+ Vector::~Vector() { -+ if (m_data) { -+ delete [] m_data; -+ } -+ -+ m_data = 0; -+ m_size = m_count = 0; -+ } -+ -+ -+ -+ // ----------------------------------------------------------------------------- -+ // size_t Vector::extend(size_t newSize) -+ // -+ // Extends the vector to at least newSize length. Won't do anything if newSize -+ // is smaller than the current size of the vector. -+ // -+ // Returns the new allocated size. -+ // -+ // ----------------------------------------------------------------------------- -+ -+ #define GRANULARITY 16 -+ -+ size_t Vector::extend(size_t newSize) { -+ -+ if (newSize > m_size) { -+ newSize = newSize + (GRANULARITY - (newSize % GRANULARITY)); -+ -+ void** temp = new void*[newSize]; -+ memcpy(temp, m_data, m_size*sizeof(void*)); -+ -+ int i; -+ for (i=m_size; i<newSize; i++) -+ temp[i] = 0; -+ -+ delete [] m_data; -+ m_data = temp; -+ m_size = newSize; -+ } -+ return m_size; -+ } -+ -+ -+ // ----------------------------------------------------------------------------- -+ // Vector::append(void* object) -+ // -+ // Appends the object pointer to vector at index m_count. Increments m_count. -+ // Returns the new count. -+ // ----------------------------------------------------------------------------- -+ -+ size_t Vector::append(void* object) { -+ if (m_count >= m_size) { -+ extend(m_count + 1); -+ } -+ -+ m_data[m_count] = object; -+ m_count += 1; -+ -+ return m_count; -+ } -+ -+ -+ // ----------------------------------------------------------------------------- -+ // Vector::operator[] (size_t idx) -+ // -+ // Returns a reference to the void pointer at idx. If idx is beyond the range -+ // of the vector, returns a reference to s_nullPtr. -+ // -+ // ----------------------------------------------------------------------------- -+ -+ void*& Vector::operator[] (size_t idx) { -+ if (idx >= m_size) { -+ s_nullPtr = 0; -+ return s_nullPtr; -+ } -+ -+ return m_data[idx]; -+ } -+ -+ -+ /*********************************************************************** -+ * -+ * -- Revision History -+ * $Log$ -+ * Revision 1.3 1999/07/31 07:54:05 RD -+ * wxPython 2.1b1: -+ * -+ * Added the missing wxWindow.GetUpdateRegion() method. -+ * -+ * Made a new change in SWIG (update your patches everybody) that -+ * provides a fix for global shadow objects that get an exception in -+ * their __del__ when their extension module has already been deleted. -+ * It was only a 1 line change in .../SWIG/Modules/pycpp.cxx at about -+ * line 496 if you want to do it by hand. -+ * -+ * It is now possible to run through MainLoop more than once in any one -+ * process. The cleanup that used to happen as MainLoop completed (and -+ * prevented it from running again) has been delayed until the wxc module -+ * is being unloaded by Python. -+ * -+ * wxWindow.PopupMenu() now takes a wxPoint instead of x,y. Added -+ * wxWindow.PopupMenuXY to be consistent with some other methods. -+ * -+ * Added wxGrid.SetEditInPlace and wxGrid.GetEditInPlace. -+ * -+ * You can now provide your own app.MainLoop method. See -+ * wxPython/demo/demoMainLoop.py for an example and some explaination. -+ * -+ * Got the in-place-edit for the wxTreeCtrl fixed and added some demo -+ * code to show how to use it. -+ * -+ * Put the wxIcon constructor back in for GTK as it now has one that -+ * matches MSW's. -+ * -+ * Added wxGrid.GetCells -+ * -+ * Added wxSystemSettings static methods as functions with names like -+ * wxSystemSettings_GetSystemColour. -+ * -+ * Removed wxPyMenu since using menu callbacks have been depreciated in -+ * wxWindows. Use wxMenu and events instead. -+ * -+ * Added alternate wxBitmap constructor (for MSW only) as -+ * wxBitmapFromData(data, type, width, height, depth = 1) -+ * -+ * Added a helper function named wxPyTypeCast that can convert shadow -+ * objects of one type into shadow objects of another type. (Like doing -+ * a down-cast.) See the implementation in wx.py for some docs. -+ * -+ * -+ ***********************************************************************/ -+ -+ -+ -+ -+ -+ -*** makefile.msc.old Mon Jun 23 16:15:32 1997 ---- makefile.msc Fri Aug 28 11:21:58 1998 -*************** -*** 33,50 **** - # Normally, you shouldn't have to change anything below this point # - ######################################################################## - - LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj emit.obj newdoc.obj ascii.obj \ -! html.obj latex.obj cplus.obj lang.obj hash.obj sstring.obj wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj - - LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \ -! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \ - sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx - - LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h - LIBNAME = ..\libswig.lib - INCLUDE = -I../Include -I$(STD_INC) -! CFLAGS = -Zi -nologo -DSWIG_LIB="\"$(SWIG_LIB)\"" -DSWIG_CC="\"$(CC)\"" -DMSDOS -DSTDC_HEADERS=1 -DHAVE_LIBDL=1 $(SWIG_OPTS) - LD_FLAGS = -VERBOSE - - - # ---- 33,50 ---- - # Normally, you shouldn't have to change anything below this point # - ######################################################################## - - LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj emit.obj newdoc.obj ascii.obj \ -! html.obj latex.obj cplus.obj lang.obj hash.obj vector.obj sstring.obj wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj - - LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \ -! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx vector.cxx \ - sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx - - LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h - LIBNAME = ..\libswig.lib - INCLUDE = -I../Include -I$(STD_INC) -! CFLAGS = -Zi -nologo -DSWIG_LIB="\"$(SWIG_LIB)\"" -DSWIG_CC="\"$(CC)\"" -DMSDOS -DSTDC_HEADERS=1 -DHAVE_LIBDL=1 $(SWIG_OPTS) $(OTHERFLAGS) - LD_FLAGS = -VERBOSE - - - # -*** makefile.bc.old Sun Jan 04 13:49:24 1998 ---- makefile.bc Fri Aug 28 15:42:58 1998 -*************** -*** 34,47 **** - ######################################################################## - - LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj \ - emit.obj newdoc.obj ascii.obj \ -! html.obj latex.obj cplus.obj lang.obj hash.obj sstring.obj \ - wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj - - LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx \ - emit.cxx newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \ -! sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx - - LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h - LIBNAME = ..\libswig.lib - INCLUDE = -I../Include -I$(STD_INC) ---- 34,47 ---- - ######################################################################## - - LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj \ - emit.obj newdoc.obj ascii.obj \ -! html.obj latex.obj cplus.obj lang.obj hash.obj vector.obj sstring.obj \ - wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj - - LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx \ - emit.cxx newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \ -! vector.cxx sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx - - LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h - LIBNAME = ..\libswig.lib - INCLUDE = -I../Include -I$(STD_INC) -*** Makefile.in.old Wed May 28 23:56:56 1997 ---- Makefile.in Fri Aug 28 15:43:36 1998 -*************** -*** 51,63 **** - # Normally, you shouldn't have to change anything below this point # - ######################################################################## - - LIBOBJS = main.o scanner.o symbol.o include.o types.o parms.o emit.o newdoc.o ascii.o \ -! html.o latex.o cplus.o lang.o hash.o sstring.o wrapfunc.o getopt.o comment.o \ - typemap.o naming.o - - LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \ -! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \ - sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx - - LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h - LIB = ../libswig.a ---- 51,63 ---- - # Normally, you shouldn't have to change anything below this point # - ######################################################################## - - LIBOBJS = main.o scanner.o symbol.o include.o types.o parms.o emit.o newdoc.o ascii.o \ -! html.o latex.o cplus.o lang.o hash.o vector.o sstring.o wrapfunc.o getopt.o comment.o \ - typemap.o naming.o - - LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \ -! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx vector.cxx \ - sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx - - LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h - LIB = ../libswig.a diff --git a/utils/wxPython/demo/FileBrowseButton.py b/utils/wxPython/demo/FileBrowseButton.py deleted file mode 100644 index b970ae7376..0000000000 --- a/utils/wxPython/demo/FileBrowseButton.py +++ /dev/null @@ -1,19 +0,0 @@ - -from wxPython.wx import * -from wxPython.lib.filebrowsebutton import FileBrowseButton - - -#---------------------------------------------------------------------- - -def runTest(frame, nb, log): - win = wxPanel(nb, -1) - fbb = FileBrowseButton(win, -1, wxPoint(20,20), wxSize(350, -1)) - return win - - - -#---------------------------------------------------------------------- - - - -overview = FileBrowseButton.__doc__ diff --git a/utils/wxPython/demo/wxGrid.py b/utils/wxPython/demo/wxGrid.py deleted file mode 100644 index dca12c088f..0000000000 --- a/utils/wxPython/demo/wxGrid.py +++ /dev/null @@ -1,87 +0,0 @@ - -from wxPython.wx import * - -#--------------------------------------------------------------------------- - -class TestGrid(wxGrid): - def __init__(self, parent, log): - wxGrid.__init__(self, parent, -1) - self.log = log - - self.CreateGrid(16, 16) - self.SetColumnWidth(3, 200) - self.SetRowHeight(4, 45) - self.SetCellValue("First cell", 0, 0) - self.SetCellValue("Another cell", 1, 1) - self.SetCellValue("Yet another cell", 2, 2) - self.SetCellTextFont(wxFont(12, wxROMAN, wxITALIC, wxNORMAL), 0, 0) - self.SetCellTextColour(wxRED, 1, 1) - self.SetCellBackgroundColour(wxCYAN, 2, 2) - self.UpdateDimensions() - self.AdjustScrollbars() - - EVT_GRID_SELECT_CELL(self, self.OnSelectCell) - EVT_GRID_CELL_CHANGE(self, self.OnCellChange) - EVT_GRID_CELL_LCLICK(self, self.OnCellClick) - EVT_GRID_LABEL_LCLICK(self, self.OnLabelClick) - - self.SetEditInPlace(true) - #print self.GetCells() - - - def OnSelectCell(self, event): - self.log.WriteText("OnSelectCell: (%d, %d)\n" % (event.m_row, event.m_col)) - - def OnCellChange(self, event): - self.log.WriteText("OnCellChange: (%d, %d)\n" % (event.m_row, event.m_col)) - - def OnCellClick(self, event): - self.log.WriteText("OnCellClick: (%d, %d)\n" % (event.m_row, event.m_col)) - - def OnLabelClick(self, event): - self.log.WriteText("OnLabelClick: (%d, %d)\n" % (event.m_row, event.m_col)) - #if event.m_row >= 10: - # self.SetLabelValue(wxVERTICAL, 'XX', event.m_row) - # self.Refresh() - #else: - # size = self.GetLabelSize(wxVERTICAL) - # print size - # self.SetLabelSize(wxVERTICAL, size+10) - # self.Refresh() - -#--------------------------------------------------------------------------- - -def runTest(frame, nb, log): - win = TestGrid(nb, log) - return win - -#--------------------------------------------------------------------------- - - - - - - - - - - - - - - - - - - - -overview = """\ -wxGrid is a class for displaying and editing tabular information. - -wxGrid() ------------------ - -wxGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style=0, const wxString& name="grid") - -Constructor. Before using a wxGrid object, you must call CreateGrid to set up the required rows and columns. -""" diff --git a/utils/wxPython/distrib/.rpmrc b/utils/wxPython/distrib/.rpmrc deleted file mode 100644 index 1fbb510693..0000000000 --- a/utils/wxPython/distrib/.rpmrc +++ /dev/null @@ -1,5 +0,0 @@ -sourcedir : . -builddir : . -rpmdir : . -srcrpmdir : . - diff --git a/utils/wxPython/distrib/makerpm b/utils/wxPython/distrib/makerpm deleted file mode 100755 index c17bcf73e9..0000000000 --- a/utils/wxPython/distrib/makerpm +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -if [ -z $1 ]; then - echo "Please specify a version number on the command line." - exit 1 -fi - -if [ ! -f wxPython.spec.in ]; then - echo "Please run this script from the directory containing the wxPython.spec.in file." - exit 1 -fi - - - -strip /usr/lib/python1.5/site-packages/wxPython/*.so -strip /usr/lib/libwxPyHelpers.so - -cat wxPython.spec.in | sed s/__VERSION__/$1/g > wxPython.spec - -mkdir /usr/doc/wxPython-$1 -cp ../README.txt /usr/doc/wxPython-$1 -cp ../../../docs/preamble.txt /usr/doc/wxPython-$1 -cp ../../../docs/licence.txt /usr/doc/wxPython-$1 -cp ../../../docs/licendoc.txt /usr/doc/wxPython-$1 -cp ../../../docs/lgpl.txt /usr/doc/wxPython-$1 -cp ../../../docs/gpl.txt /usr/doc/wxPython-$1 - -rpm -bb wxPython.spec - -mv /usr/src/redhat/RPMS/*/wxPython*.rpm . -chown rd:users wxPython*.rpm - -rm -r /usr/doc/wxPython-$1 \ No newline at end of file diff --git a/utils/wxPython/distrib/maketgz b/utils/wxPython/distrib/maketgz deleted file mode 100755 index b5799aea5d..0000000000 --- a/utils/wxPython/distrib/maketgz +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -#---------------------------------------------------------------------- -# Make a source distribution as a tar.gz file. This script should be -# run from the directory that holds the wxPython dir (../..) and be -# given a version number as an parameter. The best way to do this is -# run "make dist" in the wxPython/src/ directory. -#---------------------------------------------------------------------- - -if [ -z $1 ]; then - echo "Please specify a version number on the command line." - exit 1 -fi - -if [ ! -d wxPython ]; then - echo "Please run this script from the directory containing the wxPython directory." - exit 1 -fi - -cp $WXWIN/docs/gpl.txt wxPython -cp $WXWIN/docs/lgpl.txt wxPython -cp $WXWIN/docs/licence.txt wxPython -cp $WXWIN/docs/licendoc.txt wxPython -cp $WXWIN/docs/preamble.txt wxPython - -rm -f wxPython/distrib/filelist -for x in `cat wxPython/distrib/wxPython.rsp`; do - ls $x >> wxPython/distrib/filelist -done - - -tar cf wxPython/distrib/dist-temp.tar -T wxPython/distrib/filelist -cd wxPython/distrib -tar xf dist-temp.tar -rm dist-temp.tar -mv wxPython wxPython-$1 -rm wxPython-$1/src/gtk/helpers.cpp - -tar cvf wxPython-$1.tar wxPython-$1 -gzip wxPython-$1.tar - -rm -rf wxPython-$1 - - - - - - - diff --git a/utils/wxPython/distrib/wxPython.rsp b/utils/wxPython/distrib/wxPython.rsp deleted file mode 100644 index 9f1f3fd005..0000000000 --- a/utils/wxPython/distrib/wxPython.rsp +++ /dev/null @@ -1,104 +0,0 @@ -wxPython/*.txt - -wxPython/demo/*.py -wxPython/demo/bitmaps/*.bmp -wxPython/demo/bitmaps/*.ico -wxPython/demo/bitmaps/*.gif -wxPython/demo/bitmaps/*.png -wxPython/demo/bitmaps/*.jpg -wxPython/demo/README.txt -wxPython/demo/*.xml -wxPython/demo/data/*.png -wxPython/demo/data/*.htm -wxPython/demo/data/*.bmp - -wxPython/distrib/build.py - -wxPython/lib/*.py -wxPython/lib/*.txt -wxPython/lib/sizers/*.py -wxPython/lib/sizers/*.txt -wxPython/lib/editor/*.py -wxPython/lib/editor/*.txt - - -wxPython/src/build.cfg -wxPython/src/*.i -wxPython/src/*.py -wxPython/src/*.cpp -wxPython/src/*.c -wxPython/src/*.h -wxPython/src/*.ico -wxPython/src/*.def -wxPython/src/*.rc - -wxPython/src/msw/*.cpp -wxPython/src/msw/*.h -wxPython/src/msw/*.py - -wxPython/src/gtk/*.cpp -wxPython/src/gtk/*.h -wxPython/src/gtk/*.py - -wxpython/src/motif/*.cpp -wxPython/src/motif/*.h -wxPython/src/motif/*.py - - -wxPython/modules/html/build.cfg -wxPython/modules/html/*.i -wxPython/modules/html/*.py -wxPython/modules/html/*.cpp -wxPython/modules/html/*.c -wxPython/modules/html/*.h -wxPython/modules/html/*.def -wxPython/modules/html/*.rc -wxPython/modules/html/*.cpp -wxPython/modules/html/*.h -wxPython/modules/html/*.py - -wxPython/modules/glcanvas/build.cfg -wxPython/modules/glcanvas/*.i -wxPython/modules/glcanvas/*.py -wxPython/modules/glcanvas/*.cpp -wxPython/modules/glcanvas/*.c -wxPython/modules/glcanvas/*.h -wxPython/modules/glcanvas/*.def -wxPython/modules/glcanvas/*.rc -wxPython/modules/glcanvas/msw/*.cpp -wxPython/modules/glcanvas/msw/*.h -wxPython/modules/glcanvas/msw/*.py -wxPython/modules/glcanvas/gtk/*.cpp -wxPython/modules/glcanvas/gtk/*.h -wxPython/modules/glcanvas/gtk/*.py - -wxPython/modules/utils/build.cfg -wxPython/modules/utils/*.i -wxPython/modules/utils/*.py -wxPython/modules/utils/*.cpp -wxPython/modules/utils/*.c -wxPython/modules/utils/*.h -wxPython/modules/utils/*.def -wxPython/modules/utils/*.rc -wxPython/modules/utils/msw/*.cpp -wxPython/modules/utils/msw/*.h -wxPython/modules/utils/msw/*.py -wxPython/modules/utils/gtk/*.cpp -wxPython/modules/utils/gtk/*.h -wxPython/modules/utils/gtk/*.py - -wxPython/modules/ogl/build.cfg -wxPython/modules/ogl/*.i -wxPython/modules/ogl/*.py -wxPython/modules/ogl/*.cpp -wxPython/modules/ogl/*.c -wxPython/modules/ogl/*.h -wxPython/modules/ogl/*.def -wxPython/modules/ogl/*.rc -wxPython/modules/ogl/*.cpp -wxPython/modules/ogl/*.h -wxPython/modules/ogl/*.py - - - - diff --git a/utils/wxPython/distrib/wxPython.spec.in b/utils/wxPython/distrib/wxPython.spec.in deleted file mode 100644 index e67b7bb249..0000000000 --- a/utils/wxPython/distrib/wxPython.spec.in +++ /dev/null @@ -1,53 +0,0 @@ -Summary: Cross platform GUI toolkit for use with the Python language. -Name: wxPython -Version: __VERSION__ -Release: 1 -Copyright: wxWindows -Group: Development/Languages/Python -Source: http://alldunn.com/wxPython/wxPython-__VERSION__.tar.gz -Packager: Robin Dunn <robin@alldunn.com> -Vendor: Total Control Software -Requires: python >= 1.5.1 -Prefix: /usr/lib/python1.5/site-packages - -%description - -This Python package consists of an extension module that wraps around the -wxWindows C++ class library and provides a cross platform GUI toolkit for -use with Python. Currently supported platforms are Win32 and Unix/GTK/X. - -Python is an interpreted, interactive, object-oriented programming language. -Python combines remarkable power with very clear syntax. It has modules, -classes, exceptions, very high level dynamic data types, and dynamic typing. -There are interfaces to many system calls and libraries, and new built-in -modules are easily written in C or C++. Python is also usable as an -extension language for applications that need a programmable interface. - -#%prep -#%setup -#cd wxPython-__VERSION__ -#make -f Makefile.pre.in boot -# -#%build -#make -# -# -#%install -#make install - -%post -/sbin/ldconfig - -%postun -/sbin/ldconfig - -%files -%doc /usr/doc/wxPython-__VERSION__ -/usr/lib/libwxPyHelpers.so -/usr/lib/python1.5/site-packages/wxPython - - - - - - diff --git a/utils/wxPython/distrib/wxPython.wsm b/utils/wxPython/distrib/wxPython.wsm deleted file mode 100644 index 16ffb01726ff7b40183f537dd966985df430adc4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33 mcmWF!_BGq8#lXPGFh%`*?#FrN3{0|23?RT5TCS4l$^Zb7zXyW= diff --git a/utils/wxPython/distrib/zipit.bat b/utils/wxPython/distrib/zipit.bat deleted file mode 100755 index 6a32acca72..0000000000 --- a/utils/wxPython/distrib/zipit.bat +++ /dev/null @@ -1,28 +0,0 @@ - -@echo off - -copy %WXWIN%\docs\gpl.txt wxPython -copy %WXWIN%\docs\lgpl.txt wxPython -copy %WXWIN%\docs\licence.txt wxPython -copy %WXWIN%\docs\licendoc.txt wxPython -copy %WXWIN%\docs\preamble.txt wxPython - -zip -@ -r wxPython\wxPython-src-%1.zip < wxPython\distrib\wxPython.rsp - -mkdir wxPython\docs -mkdir wxPython\docs\wx -copy %WXWIN%\docs\html\wx\*.gif wxPython\docs\wx -copy %WXWIN%\docs\html\wx\*.htm wxPython\docs\wx -copy wxPython\docs\wx\wx.htm wxPython\docs\wx\index.htm - -mkdir wxPython\docs\ogl -copy %WXWIN%\docs\html\ogl\*.gif wxPython\docs\ogl -copy %WXWIN%\docs\html\ogl\*.htm wxPython\docs\ogl -copy wxPython\docs\ogl\ogl.htm wxPython\docs\ogl\index.htm - - -zip -r wxPython\wxPython-docs-%1.zip wxPython\docs - -del /sxzy wxPython\docs - -move /R wxPython\*.zip wxPython\distrib diff --git a/utils/wxPython/lib/filebrowsebutton.py b/utils/wxPython/lib/filebrowsebutton.py deleted file mode 100644 index 719287c246..0000000000 --- a/utils/wxPython/lib/filebrowsebutton.py +++ /dev/null @@ -1,170 +0,0 @@ -from wxPython.wx import * -import os - -#---------------------------------------------------------------------- - -class FileBrowseButton(wxPanel): - ''' A control to allow the user to type in a filename - or browse with the standard file dialog to select file - - __init__ ( - parent, id, pos, size -- passed directly to wxPanel initialisation - style = wxTAB_TRAVERSAL -- passed directly to wxPanel initialisation - labelText -- Text for label to left of text field - buttonText -- Text for button which launches the file dialog - toolTip -- Help text - dialogTitle -- Title used in file dialog - startDirectory -- Default directory for file dialog startup - fileMask -- File mask (glob pattern, such as *.*) to use in file dialog - fileMode -- wxOPEN or wxSAVE, indicates type of file dialog to use - changeCallback -- callback receives all changes in value of control - ) - GetValue() -- retrieve current value of text control - SetValue(string) -- set current value of text control - label -- pointer to internal label widget - textControl -- pointer to internal text control - browseButton -- pointer to button - ''' - def __init__ (self, parent, id= -1, - pos = wxDefaultPosition, size = wxDefaultSize, - style = wxTAB_TRAVERSAL, - labelText= "File Entry:", - buttonText= "Browse", - toolTip= "Type filename or browse computer to choose file", - # following are the values for a file dialog box - dialogTitle = "Choose a file", - startDirectory = ".", - initialValue = "", - fileMask = "*.*", - fileMode = wxOPEN, - # callback for when value changes (optional) - changeCallback= None - ): - wxPanel.__init__ (self, parent, id, pos, size, style) - # store variables - self.dialogTitle = dialogTitle - self.startDirectory = startDirectory - self.fileMask = fileMask - self.fileMode = fileMode - self.changeCallback = changeCallback - - box = wxBoxSizer(wxHORIZONTAL) - self.label = wxStaticText(self, -1, labelText, style =wxALIGN_RIGHT ) - font = self.label.GetFont() - w, h, d, e = self.GetFullTextExtent(labelText, font) - self.label.SetSize(wxSize(w+5, h)) - box.Add( self.label, 0, wxCENTER ) - - ID = wxNewId() - self.textControl = wxTextCtrl(self, ID) - self.textControl.SetToolTipString( toolTip ) - box.Add( self.textControl, 1, wxLEFT|wxCENTER, 5) - if changeCallback: - EVT_TEXT(self.textControl, ID, changeCallback) - - ID = wxNewId() - self.browseButton = button =wxButton(self, ID, buttonText) - box.Add( button, 0, wxCENTER) - button.SetToolTipString( toolTip ) - EVT_BUTTON(button, ID, self.OnBrowse) - - # add a border around the whole thing and resize the panel to fit - outsidebox = wxBoxSizer(wxVERTICAL) - outsidebox.Add(box, 1, wxEXPAND|wxALL, 3) - outsidebox.Fit(self) - - self.SetAutoLayout(true) - self.SetSizer( outsidebox ) - self.Layout() - if size.width != -1 or size.height != -1: - self.SetSize(size) - - - - def OnBrowse (self, event = None): - ''' Going to browse for file... ''' - current = self.GetValue () - directory = os.path.split(current) - if os.path.isdir( current): - directory =current - elif directory and os.path.isdir( directory[0] ): - directory = directory [0] - else: - directory = self.startDirectory - dlg = wxFileDialog(self, self.dialogTitle, directory, current, self.fileMask, self.fileMode) - if dlg.ShowModal() == wxID_OK: - self.SetValue (dlg.GetPath()) - dlg.Destroy() - self.textControl.SetFocus() - - - def GetValue (self): - ''' Convenient access to text control value ''' - return self.textControl.GetValue () - - - def SetValue (self, value): - ''' Convenient setting of text control value ''' - return self.textControl.SetValue (value) - - def Enable (self, value): - ''' Convenient enabling/disabling of entire control ''' - self.label.Enable (value) - self.textControl.Enable (value) - return self.browseButton.Enable (value) - - def GetLabel( self ): - ''' Retrieve the label's current text ''' - return self.label.GetLabel() - - def SetLabel( self, value ): - ''' Set the label's current text ''' - return self.label.SetLabel( value ) - - - -#---------------------------------------------------------------------- - - -if __name__ == "__main__": - #from skeletonbuilder import rulesfile - class DemoFrame( wxFrame ): - def __init__(self, parent): - wxFrame.__init__(self, parent, 2400, "File entry with browse", size=(500,100) ) - panel = wxPanel (self,-1) - innerbox = wxBoxSizer(wxVERTICAL) - control = FileBrowseButton(panel) - innerbox.Add( control, 0, wxEXPAND ) - control = FileBrowseButton(panel, labelText = "With Callback", style = wxSUNKEN_BORDER ,changeCallback= self.OnFileNameChanged) - innerbox.Add( control, 0, wxEXPAND|wxALIGN_BOTTOM ) - panel.SetAutoLayout(true) - panel.SetSizer( innerbox ) - - def OnFileNameChanged (self, event): - print "Filename changed", event.GetString () - - def OnCloseMe(self, event): - self.Close(true) - - def OnCloseWindow(self, event): - self.Destroy() - - class DemoApp(wxApp): - def OnInit(self): - wxImage_AddHandler(wxJPEGHandler()) - wxImage_AddHandler(wxPNGHandler()) - wxImage_AddHandler(wxGIFHandler()) - frame = DemoFrame(NULL) - #frame = RulesPanel(NULL ) - frame.Show(true) - self.SetTopWindow(frame) - return true - - def test( ): - app = DemoApp(0) - app.MainLoop() - print 'Creating dialogue' - test( ) - - - diff --git a/utils/wxPython/modules/README b/utils/wxPython/modules/README deleted file mode 100644 index 152f6fcc62..0000000000 --- a/utils/wxPython/modules/README +++ /dev/null @@ -1,14 +0,0 @@ -Modules subdir, more info later... - -stubs contains a template for new modules. - -html, lseditor are more or less usuable. - -glcanvas is moved from the main src directory. - -Note, there are no SWIG generated files in CVS yet. I don't expect them to -be useful at this stage, since you can't hack this stuff without a working & -patched up SWIG anyway. Besides, those big files really bog down my phone -line. - -Harm van der Heijden, Aug 11, 1999. diff --git a/utils/wxPython/modules/glcanvas/build.cfg b/utils/wxPython/modules/glcanvas/build.cfg deleted file mode 100644 index d10ce6d56f..0000000000 --- a/utils/wxPython/modules/glcanvas/build.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# -*- python -*- -import sys - -MODULE = 'glcanvasc' -SWIGFILES = ['glcanvas.i', ] - - -if sys.platform == 'win32': -# OTHERLIBS = '$(WXDIR)\lib\glcanvas$(LIBEXT).lib glu32.lib opengl32.lib' -# OTHERCFLAGS = '-DWITH_GLCANVAS -I$(WXDIR)/utils/glcanvas/win' - pass - -else: - - print "Warning: Assuming MesaGL libraries. Override OTHERLIBS in build.local\n"\ - " if you have native GL!" - OTHERLIBS = "-lwx_gtk_gl -lMesaGL -lMesaGLU" - - diff --git a/utils/wxPython/modules/html/.cvsignore b/utils/wxPython/modules/html/.cvsignore deleted file mode 100644 index dc001de65d..0000000000 --- a/utils/wxPython/modules/html/.cvsignore +++ /dev/null @@ -1,13 +0,0 @@ - -*.exp -*.lib -*.obj -*.pch -Makefile -Makefile.pre -Setup -build.local -config.c -htmlc.ilk -htmlc.pyd -sedscript diff --git a/utils/wxPython/modules/html/BUGS b/utils/wxPython/modules/html/BUGS deleted file mode 100644 index bc434f15ff..0000000000 --- a/utils/wxPython/modules/html/BUGS +++ /dev/null @@ -1,23 +0,0 @@ -Known bugs - -html, all: - - keys can move the vertical scrollbar, but the window moveth not. - problem in wxHTML. - - - widgets are not removed when the HTML contents is changed - (this can be fixed by adding ~HtmlWidgetCell { wnd->Destroy(); } ) - - - potential problem with the use of ThreadState in html.i - (mainly because I don't really know what I'm doing there) - -html, msw: - - vertical scrollbar behaves erratically when content smaller than - window - - - page with widgets takes forever to draw when constructed - in frame constructor - - - sometimes the python scripts with html crash on startup, before - the window is displayed (illegal operation). this seems mainly to - happen when the various libs are not yet in the disk cache. race - condition? diff --git a/utils/wxPython/modules/html/README b/utils/wxPython/modules/html/README deleted file mode 100644 index af1c578849..0000000000 --- a/utils/wxPython/modules/html/README +++ /dev/null @@ -1,20 +0,0 @@ -Aug. 2 1999 Harm van der Heijden - -What's in here: - -html - -- minimal wrap of Vaclaf Slavik's wxHTML (now part of - wxWindows); only parts of the wxHtmlWindow class are used. - Testsample htmlview.py. - There's also a python tag handler, see htmlwidget.py for - a demonstration. - -Aug. 31 1999 - Added wxHtmlHelpController and wxHtmlHelpSystem wrappers - wxHtmlHelpSystem is a subclass of the controller, and is still very - rough around the edges. The idea is that it gives the python - programmer more freedom in the look'n'feel of the html help window. - Will be opening up negotiations on the wxwin list to see if - the wxHtmlController code can be reorganised in a base and GUI - part. - diff --git a/utils/wxPython/modules/html/build.cfg b/utils/wxPython/modules/html/build.cfg deleted file mode 100644 index 2ce9a59263..0000000000 --- a/utils/wxPython/modules/html/build.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# -*- python -*- - -MODULE = 'htmlc' -SWIGFILES = ['html.i', 'htmlhelp.i' ] - -#PYFILES = ['htmlhelper.py'] -#SOURCES = ['helpsys.cpp'] - -OTHERSWIGFLAGS = '-I../utils' - -# include path for htmlhelp's xpm bitmaps -#OTHERCFLAGS = "-I%s/src/html" % (WXDIR,) - -# There are no platform differences so we don't need separate code directories -GENCODEDIR='.' -SWIGTOOLKITFLAG='' diff --git a/utils/wxPython/modules/html/helpsys.cpp b/utils/wxPython/modules/html/helpsys.cpp deleted file mode 100644 index 4da8e98219..0000000000 --- a/utils/wxPython/modules/html/helpsys.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/* htmlsys.h : wxHtmlHelpSystem is an extension of the wxHtmlHelpController. - * mainly does two things: - * - extend the interface somewhat so the programmer can dictate most of the - * look and feel of the htmlhelp frame. - * - make some protected functions public (adding _ to the function name) so - * that SWIG can wrap them. - * - * Harm van der Heijden 32aug1999 - */ -#include "helpsys.h" -#include <wx/wx.h> -#include <wx/wfstream.h> -#include <wx/busyinfo.h> - -// Bitmaps: -#ifndef __WXMSW__ -#include "bitmaps/panel.xpm" -#include "bitmaps/back.xpm" -#include "bitmaps/forward.xpm" -#include "bitmaps/book.xpm" -#include "bitmaps/folder.xpm" -#include "bitmaps/page.xpm" -#endif - -IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpSystem, wxHtmlHelpController) - -// The two static funtions below are also defined in htmlhelp.cpp -// maybe they should be protected class functions. -static wxString SafeFileName(const wxString& s) -{ - wxString res = s; - res.Replace(":", "_", TRUE); - res.Replace(" ", "_", TRUE); - res.Replace("/", "_", TRUE); - res.Replace("\\", "_", TRUE); - res.Replace("#", "_", TRUE); - res.Replace(".", "_", TRUE); - return res; -} - -static int IndexCompareFunc(const void *a, const void *b) -{ - return strcmp(((HtmlContentsItem*)a) -> m_Name, ((HtmlContentsItem*)b) -> m_Name); -} - -bool wxHtmlHelpSystem::AddBookParam(const wxString& title, const wxString& contfile, - const wxString& indexfile, const wxString& deftopic, - const wxString& path, bool show_wait_msg) -{ - wxFileSystem fsys; - wxFSFile *fi; - HtmlBookRecord *bookr; - wxString safetitle; - - if (! path.IsEmpty()) - // workaround for bug in ChangePathTo(name, TRUE) - fsys.ChangePathTo(path+"/gaga"); - - bookr = new HtmlBookRecord(path+'/', title, deftopic); - - if (m_ContentsCnt % HTML_REALLOC_STEP == 0) - m_Contents = (HtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + HTML_REALLOC_STEP) * sizeof(HtmlContentsItem)); - m_Contents[m_ContentsCnt].m_Level = 0; - m_Contents[m_ContentsCnt].m_ID = 0; - m_Contents[m_ContentsCnt].m_Page = new char[deftopic.Length() + 1]; - strcpy(m_Contents[m_ContentsCnt].m_Page, deftopic.c_str()); - m_Contents[m_ContentsCnt].m_Name = new char [title.Length() + 1]; - strcpy(m_Contents[m_ContentsCnt].m_Name, title.c_str()); - m_Contents[m_ContentsCnt].m_Book = bookr; - m_ContentsCnt++; - - // Try to find cached binary versions: - safetitle = SafeFileName(title); - fi = fsys.OpenFile(safetitle + ".cached"); - if (fi == NULL) fi = fsys.OpenFile(m_TempPath + safetitle + ".cached"); - if ((fi == NULL) || (m_TempPath == wxEmptyString)) { - LoadMSProject(bookr, fsys, indexfile, contfile, show_wait_msg); - if (m_TempPath != wxEmptyString) { - wxFileOutputStream *outs = new wxFileOutputStream(m_TempPath + safetitle + ".cached"); - SaveCachedBook(bookr, outs); - delete outs; - } - } - else { - LoadCachedBook(bookr, fi -> GetStream()); - delete fi; - } - - m_BookRecords.Add(bookr); - if (m_IndexCnt > 0) - qsort(m_Index, m_IndexCnt, sizeof(HtmlContentsItem), IndexCompareFunc); - - return TRUE; -} - -wxToolBar* wxHtmlHelpSystem::CreateToolBar(wxFrame* frame) -{ - wxToolBar *toolBar; - toolBar = frame -> CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT | wxTB_DOCKABLE); - toolBar -> SetMargins(2, 2); - wxBitmap* toolBarBitmaps[3]; - -#ifdef __WXMSW__ - toolBarBitmaps[0] = new wxBitmap("panel"); - toolBarBitmaps[1] = new wxBitmap("back"); - toolBarBitmaps[2] = new wxBitmap("forward"); - int width = 24; -#else - toolBarBitmaps[0] = new wxBitmap(panel_xpm); - toolBarBitmaps[1] = new wxBitmap(back_xpm); - toolBarBitmaps[2] = new wxBitmap(forward_xpm); - int width = 16; -#endif - - int currentX = 5; - - toolBar -> AddTool(wxID_HTML_PANEL, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Show/hide navigation panel")); - currentX += width + 5; - toolBar -> AddSeparator(); - toolBar -> AddTool(wxID_HTML_BACK, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Go back to the previous HTML page")); - currentX += width + 5; - toolBar -> AddTool(wxID_HTML_FORWARD, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Go forward to the next HTML page")); - currentX += width + 5; - - toolBar -> Realize(); - - // Can delete the bitmaps since they're reference counted - for (int i = 0; i < 3; i++) delete toolBarBitmaps[i]; - return toolBar; -} - -wxTreeCtrl* wxHtmlHelpSystem::CreateContentsTree(wxWindow* parent) -{ - wxTreeCtrl* tree; - tree = new wxTreeCtrl(parent, wxID_HTML_TREECTRL, wxDefaultPosition, - wxDefaultSize, wxTR_HAS_BUTTONS | wxSUNKEN_BORDER); - tree -> SetImageList(m_ContentsImageList); - return tree; -} - -wxListBox* wxHtmlHelpSystem::CreateIndexList(wxWindow* parent) -{ - return new wxListBox(parent, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, 0); -} - -void wxHtmlHelpSystem::SetControls(wxFrame* frame, wxHtmlWindow* htmlwin, - wxTreeCtrl* contents, wxListBox* index, - wxListBox* searchlist) -{ - m_Frame = frame; - m_HtmlWin = htmlwin; - m_ContentsBox = contents; - m_IndexBox = index; - m_SearchList = searchlist; - m_SearchText = NULL; // provide your own input box - /* if you're setting your own controls, you and your event handlers are - * responsible for any splitter and notebook adjustments, not the - * htmlhelp framework */ - m_Splitter = NULL; - m_NavigPan = NULL; - RefreshLists(); -} - -void wxHtmlHelpSystem::CreateHelpWindow() -{ - wxBusyCursor cur; - wxString oldpath; - wxStatusBar *sbar; - - if (m_Frame) { - m_Frame -> Raise(); - m_Frame -> Show(TRUE); - return; - } - -#if wxUSE_BUSYINFO - wxBusyInfo busyinfo(_("Preparing help window...")); -#endif - - if (m_Config) ReadCustomization(m_Config, m_ConfigRoot); - - m_Frame = new wxFrame(NULL, -1, "", wxPoint(m_Cfg.x, m_Cfg.y), wxSize(m_Cfg.w, m_Cfg.h)); - m_Frame -> PushEventHandler(this); - sbar = m_Frame -> CreateStatusBar(); - - CreateToolBar(m_Frame); - - { - m_Splitter = new wxSplitterWindow(m_Frame); - - m_HtmlWin = new wxHtmlWindow(m_Splitter); - m_HtmlWin -> SetRelatedFrame(m_Frame, m_TitleFormat); - m_HtmlWin -> SetRelatedStatusBar(0); - if (m_Config) m_HtmlWin -> ReadCustomization(m_Config, m_ConfigRoot); - - m_NavigPan = new wxNotebook(m_Splitter, wxID_HTML_NOTEBOOK, wxDefaultPosition, wxDefaultSize); - if (m_ContentsCnt) { - m_ContentsBox = CreateContentsTree(m_NavigPan); - m_NavigPan -> AddPage(m_ContentsBox, _("Contents")); - } - - if (m_IndexCnt) { - wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE); - wxLayoutConstraints *b1 = new wxLayoutConstraints; - b1 -> top.SameAs (dummy, wxTop, 0); - b1 -> left.SameAs (dummy, wxLeft, 0); - b1 -> width.PercentOf (dummy, wxWidth, 100); - b1 -> bottom.SameAs (dummy, wxBottom, 0); - m_IndexBox = CreateIndexList(dummy); - m_IndexBox -> SetConstraints(b1); - - dummy -> SetAutoLayout(TRUE); - m_NavigPan -> AddPage(dummy, _("Index")); - } - - { - wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE); - - wxLayoutConstraints *b1 = new wxLayoutConstraints; - m_SearchText = new wxTextCtrl(dummy, wxID_HTML_SEARCHTEXT); - b1 -> top.SameAs (dummy, wxTop, 0); - b1 -> left.SameAs (dummy, wxLeft, 0); - b1 -> right.SameAs (dummy, wxRight, 0); - b1 -> height.AsIs(); - m_SearchText -> SetConstraints(b1); - - wxLayoutConstraints *b2 = new wxLayoutConstraints; - m_SearchButton = new wxButton(dummy, wxID_HTML_SEARCHBUTTON, _("Search!")); - b2 -> top.Below (m_SearchText, 10); - b2 -> right.SameAs (dummy, wxRight, 10); - b2 -> width.AsIs(); - b2 -> height.AsIs(); - m_SearchButton -> SetConstraints(b2); - - wxLayoutConstraints *b3 = new wxLayoutConstraints; - m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0); - b3 -> top.Below (m_SearchButton, 10); - b3 -> left.SameAs (dummy, wxLeft, 0); - b3 -> right.SameAs (dummy, wxRight, 0); - b3 -> bottom.SameAs (dummy, wxBottom, 0); - m_SearchList -> SetConstraints(b3); - - dummy -> SetAutoLayout(TRUE); - dummy -> Layout(); - m_NavigPan -> AddPage(dummy, _("Search")); - } - - RefreshLists(); - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SetMinimumPaneSize(20); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); - if (!m_Cfg.navig_on) m_Splitter -> Unsplit(m_NavigPan); - wxYield(); - } - - m_Frame -> Show(TRUE); - wxYield(); -} - -void wxHtmlHelpSystem::RefreshLists() -{ - if (m_Frame) { - CreateContents(); - CreateIndex(); - if (m_SearchList) - m_SearchList -> Clear(); - } -} - -void wxHtmlHelpSystem::OnToolbar(wxCommandEvent& event) -{ - switch (event.GetId()) { - case wxID_HTML_BACK : - if (m_HtmlWin) m_HtmlWin -> HistoryBack(); - break; - case wxID_HTML_FORWARD : - if (m_HtmlWin) m_HtmlWin -> HistoryForward(); - break; - case wxID_HTML_PANEL : - if (! (m_Splitter && m_NavigPan)) - return; - if (m_Splitter -> IsSplit()) { - m_Cfg.sashpos = m_Splitter -> GetSashPosition(); - m_Splitter -> Unsplit(m_NavigPan); - } - else { - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); - } - break; - } -} - -void wxHtmlHelpSystem::OnCloseWindow(wxCloseEvent& event) -{ - int a, b; - - if (m_Splitter && m_NavigPan) { - m_Cfg.navig_on = m_Splitter -> IsSplit(); - if (m_Cfg.navig_on) - m_Cfg.sashpos = m_Splitter -> GetSashPosition(); - m_Frame -> GetPosition(&a, &b); - m_Cfg.x = a, m_Cfg.y = b; - m_Frame -> GetSize(&a, &b); - m_Cfg.w = a, m_Cfg.h = b; - } - if (m_Config) { - WriteCustomization(m_Config, m_ConfigRoot); - m_HtmlWin -> WriteCustomization(m_Config, m_ConfigRoot); - } - m_Frame = NULL; - - //event.Skip(); -} - -BEGIN_EVENT_TABLE(wxHtmlHelpSystem, wxHtmlHelpController) - EVT_TOOL_RANGE(wxID_HTML_PANEL, wxID_HTML_FORWARD, wxHtmlHelpSystem::OnToolbar) - EVT_CLOSE(wxHtmlHelpSystem::OnCloseWindow) -END_EVENT_TABLE() - diff --git a/utils/wxPython/modules/html/helpsys.h b/utils/wxPython/modules/html/helpsys.h deleted file mode 100644 index e3eb9f645d..0000000000 --- a/utils/wxPython/modules/html/helpsys.h +++ /dev/null @@ -1,76 +0,0 @@ -/* htmlsys.h : wxHtmlHelpSystem is an extension of the wxHtmlHelpController. - * mainly does two things: - * - extend the interface somewhat so the programmer can dictate most of the - * look and feel of the htmlhelp frame. - * - make some protected functions public (adding _ to the function name) so - * that SWIG can wrap them. - * - * Harm van der Heijden 32aug1999 - */ -#ifndef __HELPSYS_H__ -#define __HELPSYS_H__ - -#include <wx/wx.h> - -#if ! wxUSE_HTML -#error "wxHtml needed" -#endif - -#include <wx/toolbar.h> -#include <wx/listbox.h> -#include <wx/html/htmlhelp.h> - -class wxHtmlHelpSystem : public wxHtmlHelpController -{ - DECLARE_DYNAMIC_CLASS(wxHtmlHelpSystem) - - public: - wxHtmlHelpSystem() {}; - ~wxHtmlHelpSystem() {}; - - bool AddBookParam(const wxString& title, const wxString& contfile, - const wxString& indexfile=wxEmptyString, const wxString& deftopic=wxEmptyString, - const wxString& path=wxEmptyString, bool show_wait_msg=FALSE); - // Alternative to AddBook(wxString& hhpfile) - wxToolBar* CreateToolBar(wxFrame* frame); - // creates a dockable toolbar for the frame, containing hide/show, back and forward buttons - wxTreeCtrl* CreateContentsTree(wxWindow* parent); - // creates a treecontrol with imagelist for books, folders etc and id wxID_HTML_TREECTRL - wxListBox* CreateIndexList(wxWindow* parent); - // creates a listbox with the right id - virtual void CreateHelpWindow(); - // Slightly different version than in wxHtmlHelpController; uses helpers above - // Do nothing if the window already exists - void SetControls(wxFrame* frame, wxHtmlWindow* htmlwin, - wxTreeCtrl* contents=NULL, wxListBox* index=NULL, - wxListBox* searchlist=NULL); - // alternative for CreateHelpWindow(), sets frame, htmlwindow, contents tree, index - // listbox and searchlist listbox. If null, their functionality won't be used - - // Some extra accessor functions - wxFrame* GetFrame() { return m_Frame; } - wxHtmlWindow* GetHtmlWindow() { return m_HtmlWin; } - wxTreeCtrl* GetContentsTree() { return m_ContentsBox; } - wxListBox* GetIndexList() { return m_IndexBox; } - wxListBox* GetSearchList() { return m_SearchList; } - wxImageList* GetContentsImageList() { return m_ContentsImageList; } - // public interface for wxHtmlHelpControllers handlers, so wxPython can call them - void OnToolbar(wxCommandEvent& event); - void OnContentsSel(wxTreeEvent& event) {wxHtmlHelpController::OnContentsSel(event);} - void OnIndexSel(wxCommandEvent& event) {wxHtmlHelpController::OnIndexSel(event);} - void OnSearchSel(wxCommandEvent& event) {wxHtmlHelpController::OnSearchSel(event);} - void OnSearch(wxCommandEvent& event) {wxHtmlHelpController::OnSearch(event);} - void OnCloseWindow(wxCloseEvent& event); - - // some more protected functions that should be accessible from wxPython - void RefreshLists(); - void CreateContents() { if (!m_ContentsBox) return; wxHtmlHelpController::CreateContents(); } - // Adds items to m_Contents tree control - void CreateIndex() { if (! m_IndexBox) return; wxHtmlHelpController::CreateIndex(); } - // Adds items to m_IndexList - - DECLARE_EVENT_TABLE() -}; - -#endif - diff --git a/utils/wxPython/modules/html/htmlc.def b/utils/wxPython/modules/html/htmlc.def deleted file mode 100644 index 859311294b..0000000000 --- a/utils/wxPython/modules/html/htmlc.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORTS - inithtmlc diff --git a/utils/wxPython/modules/html/htmlhelper.py b/utils/wxPython/modules/html/htmlhelper.py deleted file mode 100644 index 390afd2b04..0000000000 --- a/utils/wxPython/modules/html/htmlhelper.py +++ /dev/null @@ -1,59 +0,0 @@ -# -# htmlhelper.py -# -# A few helper functions for putting wxPython widgets in html pages -# -# Harm van der Heijden, 11 aug 1999. - -import wx -import string -import htmlc - -# Function to parse a param string (of the form 'item=value item2="value etc"' -# and creates a dictionary -def _param2dict(param): - i = 0; j = 0; s = len(param); d = {} - d['param_str'] = param - while 1: - while i<s and param[i] == " " : i = i+1 - if i>=s: break - j = i - while j<s and param[j] != "=": j=j+1 - if j+1>=s: - break - word = param[i:j] - i=j+1 - if (param[i] == '"'): - j=i+1 - while j<s and param[j] != '"' : j=j+1 - if j == s: break - val = param[i+1:j] - elif (param[i] != " "): - j=i+1 - while j<s and param[j] != " " : j=j+1 - val = param[i:j] - else: - val = "" - i=j+1 - d[string.lower(word)] = val - return d - -# This function gets called by the <python> tag handler. -# Arguments are the parent (wxHtmlWindow) SWIG pointer (in python, a string) -# and a string containing the parameters. -# The return value must be the SWIG pointer of the created widget (the 'this' -# attribute in python). The widget must be derived from a wxWindow or one -# of its descendants. -def _WidgetStarter(parentptr, param): - # create a python instance of the parent - parent = wx.wxWindowPtr(parentptr) - # try to find the widget class in the htmlwinc (=htmlwidget) module - dict = _param2dict(param) - classname = dict['class'] - obj = htmlc.__dict__[classname] - # now create the class with arguments parent, dictionary - cls = apply(obj, (parent, dict)) - # return the class instance's pointer - return cls.this - -htmlc.WidgetStarter = _WidgetStarter diff --git a/utils/wxPython/modules/html/test/helpsys.py b/utils/wxPython/modules/html/test/helpsys.py deleted file mode 100644 index 6acdaae7c0..0000000000 --- a/utils/wxPython/modules/html/test/helpsys.py +++ /dev/null @@ -1,73 +0,0 @@ -from wxPython.wx import * -from wxPython.html import * -import sys,os - -if not os.environ.has_key('WXWIN'): - print "Can't find html samples. Set WXWIN environment variable." - sys.exit(1) - -help = wxHtmlHelpSystem() -# Create the book in a different way, supply title, contents file, index, default topic and basedir -help.AddBookParam('Sample help docs', 'contents.hhc', '', 'main.htm', - os.environ['WXWIN'] + "/samples/html/help/helpfiles") - -class HelpFrame(wxFrame): - def __init__(self): - wxFrame.__init__(self, NULL, -1, "", wxDefaultPosition, wxSize(500,500)) - bar = self.CreateStatusBar(2) - bar.SetStatusWidths([400,100]) - help.CreateToolBar(self) - self.text = wxTextCtrl(bar, 1001, "Hello world", wxPoint(400,0), wxSize(80,30)) - button = wxButton(bar, 1002, "Go", wxPoint(480,0), wxSize(20,30)) - - html = wxHtmlWindow(self,-1) - html.SetRelatedFrame(self, "%s") - html.SetRelatedStatusBar(0) - - self.searchframe = wxMiniFrame(self, -1, "Search result", wxDefaultPosition, wxSize(300,400)) - self.searchbox = wxListBox(self.searchframe, wxID_HTML_SEARCHLIST) - - self.mframe = wxMiniFrame(self, -1, "Contents", wxDefaultPosition, wxSize(300,500)) - tree = help.CreateContentsTree(self.mframe) - help.SetControls(self, html, tree, NULL, self.searchbox) - EVT_TREE_SEL_CHANGED(self, wxID_HTML_TREECTRL, help.OnContentsSel) - EVT_LISTBOX(self, wxID_HTML_SEARCHLIST, help.OnSearchSel) - EVT_TOOL(self, wxID_HTML_PANEL, self.ToggleContents) - EVT_TOOL(self, wxID_HTML_BACK, help.OnToolbar) - EVT_TOOL(self, wxID_HTML_FORWARD, help.OnToolbar) - EVT_TEXT_ENTER(self, 1001, self.OnTextSearch) - EVT_BUTTON(self, 1002, self.OnTextSearch) - EVT_CLOSE(self.mframe, self.OnCloseContents) - EVT_CLOSE(self.searchframe, self.OnCloseSearch) - self.mframe.Show(TRUE) - print help.GetSearchList() - - def ToggleContents(self, event): - self.mframe.Show(not self.mframe.IsShown()) - - def OnCloseContents(self, event): - if event.CanVeto(): - self.mframe.Show(FALSE) - else: - self.mframe.Destroy() - - def OnCloseSearch(self, event): - if event.CanVeto(): - self.searchframe.Show(FALSE) - else: - self.searchframe.Destroy() - - def OnTextSearch(self, event): - self.searchbox.Clear() - self.searchframe.Show(TRUE) - print "searching for %s" % (self.text.GetValue(),) - help.KeywordSearch(self.text.GetValue()) - -class MyApp(wxApp): - def OnInit(self): - frame = HelpFrame() - frame.Show(TRUE) - return TRUE - -theApp = MyApp(0) -theApp.MainLoop() diff --git a/utils/wxPython/modules/html/test/htmlhelp.py b/utils/wxPython/modules/html/test/htmlhelp.py deleted file mode 100644 index 26c61ad4f3..0000000000 --- a/utils/wxPython/modules/html/test/htmlhelp.py +++ /dev/null @@ -1,19 +0,0 @@ -from wxPython.wx import * -from wxPython.html import * -import os,sys - -if not os.environ.has_key('WXWIN'): - print "Can't find html samples. Set WXWIN environment variable." - sys.exit(1) - -# Minimal htmlhelpcontroller sample. Everything is done by the framework -help = wxHtmlHelpController() # Not created in OnInit, otherwise it's deleted before we see it. -help.AddBook(os.environ['WXWIN'] + "/samples/html/help/helpfiles/testing.hhp") - -class MyApp(wxApp): - def OnInit(self): - help.DisplayContents() - return TRUE - -theApp = MyApp(0) -theApp.MainLoop() diff --git a/utils/wxPython/modules/html/test/htmlview.py b/utils/wxPython/modules/html/test/htmlview.py deleted file mode 100644 index 906f3221c1..0000000000 --- a/utils/wxPython/modules/html/test/htmlview.py +++ /dev/null @@ -1,77 +0,0 @@ -from wxPython.wx import * -from wxPython.html import * -import sys - -default_page = """ -<H1>HTML Viewer</H1>Please select <I>File->Open</I> -to open a HTML file, or edit this page in the -text control below and select <I>File->Update</I> -<P> -The python source can be seen -<a href="%s">here</a>. -""" % (sys.argv[0], ) - -class HtmlViewer(wxFrame): - def __init__(self, parent, id, title, pos = wxDefaultPosition, size = wxSize(400,400)): - wxFrame.__init__(self, parent, id, title, pos, size) - self.CreateStatusBar(1) - split = wxSplitterWindow(self, -1) - self.html = wxHtmlWindow(split) - self.html.SetRelatedFrame(self, "HTML Viewer: \%s") - self.html.SetRelatedStatusBar(0) - self.txt = wxTextCtrl(split, -1, default_page, - wxDefaultPosition, wxDefaultSize, - wxTE_MULTILINE) - split.SplitHorizontally(self.html, self.txt, size.y/2) - mbar = wxMenuBar() - menu = wxMenu() - menu.Append(1500, "Open") - menu.Append(1501, "Reset") - menu.Append(1502, "Update HTML") - menu.AppendSeparator() - menu.Append(1503, "Exit") - mbar.Append(menu, "File") - menu = wxMenu() - menu.Append(1510, "Back") - menu.Append(1511, "Forward") - mbar.Append(menu, "Go") - self.SetMenuBar(mbar) - self.filename = "" - EVT_MENU(self, 1500, self.OnFileOpen) - EVT_MENU(self, 1501, self.OnFileReset) - EVT_MENU(self, 1502, self.OnFileUpdate) - EVT_MENU(self, 1503, self.OnClose) - EVT_MENU(self, 1510, self.OnGoBack) - EVT_MENU(self, 1511, self.OnGoForward) - # A default opening text - self.html.SetPage( default_page ) - def OnFileOpen(self, event): - dlg = wxFileDialog(NULL, "Open file") - if dlg.ShowModal() == wxID_OK: - self.filename = dlg.GetPath() - self.html.LoadPage(self.filename) - def OnFileReset(self, event): - self.html.SetPage( default_page ) - self.txt.SetValue( default_page ) - def OnFileUpdate(self, event): - self.html.SetPage( self.txt.GetValue() ) - def OnGoBack(self, event): - self.html.HistoryBack() - def OnGoForward(self, event): - self.html.HistoryForward() - def OnClose(self,event): - self.Destroy() - -class MyApp(wxApp): - def OnInit(self): - frame = HtmlViewer(NULL, -1, "HTML Viewer") - frame.Show(TRUE) - self.SetTopWindow(frame) - return TRUE - -wxImage_AddHandler(wxPNGHandler()) -wxImage_AddHandler(wxGIFHandler()) -wxImage_AddHandler(wxJPEGHandler()) - -theApp = MyApp(0) -theApp.MainLoop() diff --git a/utils/wxPython/modules/html/test/htmlwidget.py b/utils/wxPython/modules/html/test/htmlwidget.py deleted file mode 100644 index ffa0fcb356..0000000000 --- a/utils/wxPython/modules/html/test/htmlwidget.py +++ /dev/null @@ -1,97 +0,0 @@ -from wxPython.wx import * -from wxPython.html import * -import sys,string - -# A bunch of simple widgets, all somehow derived from wxWindow -class Widget1(wxWindow): - def __init__(self, parent, param): - wxWindow.__init__(self, parent, -1) - self.text = wxTextCtrl(self, -1, param['param_str'], wxPoint(5,5), - wxSize(200,150), wxTE_MULTILINE) - but = wxButton(self, 1001, "Click me", wxPoint(50,160), wxSize(100,30)) - EVT_BUTTON(self, 1001, self.OnButton) - self.SetSize(wxSize(210,200)) - def OnButton(self, event): - self.text.AppendText( "Click!\n" ) - -class Widget2(wxButton): - def __init__(self, parent, param): - wxButton.__init__(self, parent, int(param['id']), param['title']) - -class Widget3(wxTextCtrl): - def __init__(self, parent, param): - wxTextCtrl.__init__(self, parent, -1, "No clicks") - self.clicked = 0; - EVT_BUTTON(parent, int(param['button_id']), self.OnButton) - def OnButton(self, event): - self.clicked = self.clicked + 1 - self.SetValue("%d clicks" % (self.clicked,)) - -# make the widgets known in the widget module (aka htmlc) -widget.Widget1 = Widget1 -widget.Widget2 = Widget2 -widget.Widget3 = Widget3 - -# our default page -default_page = """ -<H2>wxPython widgets go HTML</H2> -A bunch of wxPython widgets are scattered on this HTML page. -Here's one: -<center><python class="Widget1" greeting="Hello World"></center> -<hr> -Here's another: -<center><python class="Widget2" float=70 id=1002 title="Button A"></center> -It should always take up 70% of the page width. -<p>And then there's this, listening to button A: -<python class="Widget3" button_id=1002></p> -""" - -# our explanation -apology = """ -For some bizarre reason, it takes forever and a day to display the -widgets if they are constructed in the frame's constructor. This -only happens in MSW, wxGTK works fine. -<p>Select <I>File->Show it</I> to draw the widgets.""" - -default_page = default_page + "The HTML code for this page is\n <pre>" + default_page + "</pre>" - - -class HtmlViewer(wxFrame): - def __init__(self, parent, id, title, pos = wxDefaultPosition, size = wxSize(400,400)): - wxFrame.__init__(self, parent, id, title, pos, size) - self.CreateStatusBar(1) - self.html = wxHtmlWindow(self) - self.html.SetRelatedFrame(self, "HTML Viewer: \%s") - self.html.SetRelatedStatusBar(0) - mbar = wxMenuBar() - menu = wxMenu() - menu.Append(1500, "Show it") - menu.Append(1503, "Exit") - mbar.Append(menu, "File") - EVT_MENU(self, 1500, self.OnShowIt) - EVT_MENU(self, 1503, self.OnClose) - self.SetMenuBar(mbar) - # change apology below to default_page, if you dare! - self.html.SetPage( default_page ) - def OnClose(self,event): - self.Destroy() - def OnShowIt(self,event): - self.html.SetPage( default_page ) - # now quickly remove the menu option, to hide that - # other bug; namely that widgets aren't removed when the - # HTML page is. - self.GetMenuBar().Enable(1500, FALSE) - -class MyApp(wxApp): - def OnInit(self): - frame = HtmlViewer(NULL, -1, "HTML Viewer") - frame.Show(TRUE) - self.SetTopWindow(frame) - return TRUE - -wxImage_AddHandler(wxPNGHandler()) -wxImage_AddHandler(wxGIFHandler()) -wxImage_AddHandler(wxJPEGHandler()) - -theApp = MyApp(0) -theApp.MainLoop() diff --git a/utils/wxPython/modules/lseditor/.cvsignore b/utils/wxPython/modules/lseditor/.cvsignore deleted file mode 100644 index 68623efe14..0000000000 --- a/utils/wxPython/modules/lseditor/.cvsignore +++ /dev/null @@ -1,13 +0,0 @@ - -*.exp -*.lib -*.obj -*.pch -Makefile -Makefile.pre -Setup -build.local -config.c -lseditorc.ilk -lseditorc.pyd -sedscript diff --git a/utils/wxPython/modules/lseditor/BUGS b/utils/wxPython/modules/lseditor/BUGS deleted file mode 100644 index d47d9ac0f6..0000000000 --- a/utils/wxPython/modules/lseditor/BUGS +++ /dev/null @@ -1,6 +0,0 @@ -Known bugs/features - -editor, all: - - (missing feature, really) syntax highlighting data is - compile time. - diff --git a/utils/wxPython/modules/lseditor/COPYING b/utils/wxPython/modules/lseditor/COPYING deleted file mode 100644 index eeb586b392..0000000000 --- a/utils/wxPython/modules/lseditor/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/utils/wxPython/modules/lseditor/README b/utils/wxPython/modules/lseditor/README deleted file mode 100644 index 8ac706c9f5..0000000000 --- a/utils/wxPython/modules/lseditor/README +++ /dev/null @@ -1,13 +0,0 @@ -Aug. 2 1999 Harm van der Heijden - -What's in here: - -lseditorplugin - -- minimal wrap of Alexanders Gluchovas' editor plugin. The code was - ransacked from the wxStudio (http://wxstudio.linuxbox.com) project. - Since the editor is released under the Gnu Public License, this - module, as a derivative work, is also released under this licence - and NOT THE WXWINDOWS LICENSE. See the file COPYING for details. - the file 'editor.py' contains a sample implementation using the - editorplugin object. - diff --git a/utils/wxPython/modules/lseditor/build.cfg b/utils/wxPython/modules/lseditor/build.cfg deleted file mode 100644 index 4499dad9a3..0000000000 --- a/utils/wxPython/modules/lseditor/build.cfg +++ /dev/null @@ -1,9 +0,0 @@ -# -*- python -*- - -MODULE = 'lseditorc' -SWIGFILES = ['lseditor.i'] - -SOURCES = ['finddlg.cpp', 'lseditorpl.cpp', 'markup.cpp', 'plugin.cpp', - 'sourcepainter.cpp', 'tdefs.cpp'] - - diff --git a/utils/wxPython/modules/lseditor/config.h b/utils/wxPython/modules/lseditor/config.h deleted file mode 100644 index b22aa25ec9..0000000000 --- a/utils/wxPython/modules/lseditor/config.h +++ /dev/null @@ -1,82 +0,0 @@ -/* config.h. Generated automatically by configure. */ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if using alloca.c. */ -/* #undef C_ALLOCA */ - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -/* #undef CRAY_STACKSEG_END */ - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ -#define HAVE_ALLOCA_H 1 - -/* Define as __inline if that's what the C compiler calls it. */ -/* #undef inline */ - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -/* #undef size_t */ - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -/* #undef STACK_DIRECTION */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if your <sys/time.h> declares struct tm. */ -/* #undef TM_IN_SYS_TIME */ - -/* Define to use template STL (vs. wxSTL) */ -#define wxUSE_TEMPLATE_STL 1 - -/* Define to use framelayout library */ -/* #undef wxsUSE_FRAME_LAYOUT */ - -/* Define to use class-info plugin */ -#define wxsUSE_CLASS_INFO 1 - -/* Define to use window manager plugin */ -#define wxsUSE_WINDOWMANAGER 1 - -/* Define if you have the strdup function. */ -#define HAVE_STRDUP 1 - -/* Define if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the <limits.h> header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the <malloc.h> header file. */ -#define HAVE_MALLOC_H 1 - -/* Define if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define if you have the <sys/time.h> header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Name of package */ -#define PACKAGE "wxStudio" - -/* Version number of package */ -#define VERSION "0.0.2" - diff --git a/utils/wxPython/modules/lseditor/controlarea.h b/utils/wxPython/modules/lseditor/controlarea.h deleted file mode 100644 index 15cb9386af..0000000000 --- a/utils/wxPython/modules/lseditor/controlarea.h +++ /dev/null @@ -1,262 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 07/09/98 -// RCS-ID: $Id$ -// Copyright: (c) Aleksandras Gluchovas -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifndef __CONTROLAREA_G__ -#define __CONTROLAREA_G__ - -#ifdef __GNUG__ -#pragma interface "controlarea.h" -#endif - -#include "wx/defs.h" -#include "wx/window.h" -#include "wx/string.h" - -#define WXCONTROLAREA_VERSION 1.0 - -// layout types for title bars of the tabs -// (are selected up by evaluating the available free space ) - -class twTabInfo; // forward decl. - -#define wxTITLE_IMG_AND_TEXT 0 -#define wxTITLE_IMG_ONLY 1 -#define wxTITLE_BORDER_ONLY 2 - -/* - * class manages and decorates contained "tab"-windows. - * Draws decorations similar to those in "Project Workplace" - * of Microsoft Developer Studio 4.xx - */ - -class wxTabbedWindow : public wxPanel -{ - DECLARE_DYNAMIC_CLASS( wxTabbedWindow ) - -public: - - friend class wxTabbedWindowSerializer; - - wxList mTabs; - int mActiveTab; - int mTitleHeight; - int mLayoutType; - - void HideInactiveTabs( bool andRepaint ); - - // overrride,to provide different font for tab-labels - - virtual wxFont GetLabelingFont(); - - // FOR NOW:: scrollbars are actually related to wxPaggedWindow - - wxScrollBar* mpTabScroll; - wxScrollBar* mpHorizScroll; - wxScrollBar* mpVertScroll; - -public: - - // public properties (invoke ReclaclLayout(TRUE) to apply changes) - - wxPen mWhitePen; // default: RGB(255,255,255) - wxPen mLightPen; // wxSYS_COLOUR_3DHIGHLIGHT - wxPen mGrayPen; // wxSYS_COLOUR_3DFACE - wxPen mDarkPen; // wxSYS_COLOUR_3DSHADOW - wxPen mBlackPen; // default: RGB( 0, 0, 0) - - int mVertGap; // default: 3 - int mHorizGap; // default: 5 - int mTitleVertGap; // default: 3 - int mTitleHorizGap; // default: 4 - int mImageTextGap; // default: 2 - int mFirstTitleGap; // default: 11 - int mBorderOnlyWidth; // default: 8 - - // notifications (can be handled by derivatives) - - virtual void OnTabAdded( twTabInfo* pInfo ) {} - - virtual void SizeTabs(int x,int y, int width, int height, bool repant); - -public: - wxTabbedWindow(); - virtual ~wxTabbedWindow(); - - // tabs can be also added when the window is - // already displayed - "on the fly" - - virtual void AddTab( wxWindow* pContent, // contained window - wxString tabText, // tab label - wxString imageFileName = "", // if "", only text label is displayed - long imageType = wxBITMAP_TYPE_BMP ); - - // NOTE:: if this AddTab(..) overload is called, the - // image bitmap will not be serialized (if performed), - // use the above method instead, so that images could - // be restored using the given file names - - virtual void AddTab( wxWindow* pContent, - wxString tabText, - wxBitmap* pImage = NULL ); - - - virtual void RemoveTab( int tabNo ); - - /* misc accessors */ - - virtual int GetTabCount(); - virtual wxWindow* GetTab( int tabNo ); - virtual wxWindow* GetActiveTab(); - virtual void SetActiveTab( int tabNo ); - - void DrawShadedRect( int x, int y, int width, int height, - wxPen& upperPen, wxPen& lowerPen, wxDC& dc ); - - virtual void DrawDecorations( wxDC& dc ); - - // return -1, if non of the title bars was hitted, - // otherwise the index of the hitted tab title bar - - virtual int HitTest( const wxPoint& pos ); - - // should be invoked to redisplay window with changed properties - - virtual void RecalcLayout( bool andRepaint = TRUE ); - - // event handlers - - void OnPaint( wxPaintEvent& event ); - void OnSize ( wxSizeEvent& event ); - - void OnBkErase( wxEraseEvent& event ); - void OnLButtonDown( wxMouseEvent& event ); - - DECLARE_EVENT_TABLE() -}; - -/* - * class manages and decorates contained "sheets" (or pages). - * Draws decorations similar to those in "Output window" - * of Microsoft Developer Studio 4.xx - */ - -class wxPaggedWindow : public wxTabbedWindow -{ - DECLARE_DYNAMIC_CLASS( wxPaggedWindow ) -protected: - - bool mScrollEventInProgress; - - // drag&drop state variables - - bool mIsDragged; - int mDagOrigin; - wxCursor mResizeCursor; - wxCursor mNormalCursor; - bool mCursorChanged; - int mOriginalTitleRowLen; - - void DrawPaperBar( twTabInfo& tab, int x, int y, - wxBrush& brush, wxPen& pen, wxDC& dc ); - - int GetWholeTabRowLen(); - - // adjusts scorllbars to fit around tabs - - virtual void OnTabAdded( twTabInfo* pInfo ); - - // sets smaller font for page-labels - - virtual wxFont GetLabelingFont(); - -public: - int mTitleRowStart; - int mResizeNailGap; - int mTabTrianGap; - int mTitleRowLen; // actual title row length - int mAdjustableTitleRowLen; // setup by dragging mini-sash - // with the mosue pointer - int mCurentRowOfs; - - wxBrush mGrayBrush; - wxBrush mWhiteBrush; - -public: - wxPaggedWindow(); - ~wxPaggedWindow(); - - // NOTE:: use public methods of the base class - // to add "pages" to this window - - /* misc accessors */ - - // below two methods should be called after - // the tabs were added (AddTab(..)). Set up - // these scrollbars to match the needs of the - // tabs added into this area - - wxScrollBar& GetVerticalScrollBar(); - wxScrollBar& GetHorizontalScrollBar(); - - virtual void DrawDecorations( wxDC& dc ); - - // return -1, if non of the title bars was hitted, - // otherwise the index of the hitted tab title bar - - virtual int HitTest( const wxPoint& pos ); - - virtual void RecalcLayout( bool andRepaint = TRUE ); - - // event handlers - - void OnPaint( wxPaintEvent& event ); - void OnSize ( wxSizeEvent& event ); - void OnLButtonDown( wxMouseEvent& event ); - void OnLButtonUp ( wxMouseEvent& event ); - void OnMouseMove ( wxMouseEvent& event ); - void OnScroll ( wxScrollEvent& event ); - - DECLARE_EVENT_TABLE() -}; - -// helper structure of wxTabbedWindow - -class twTabInfo : public wxObject -{ - DECLARE_DYNAMIC_CLASS( twTabInfo ) -public: - twTabInfo(); - ~twTabInfo(); - - int ImgWidth(); - int ImgHeight(); - int ImageToTxtGap( int prefGap ); - - bool HasImg(); - wxBitmap& GetImg(); - bool HasText(); - wxString& GetText(); - wxWindow& GetContent(); - -public: - wxWindow* mpContent; - wxBitmap mBitMap; - - wxString mText; - wxSize mDims; - - // used for serialization - wxString mImageFile; - long mImageType; - -}; - -#endif diff --git a/utils/wxPython/modules/lseditor/editorpl.h b/utils/wxPython/modules/lseditor/editorpl.h deleted file mode 100644 index 05563eb259..0000000000 --- a/utils/wxPython/modules/lseditor/editorpl.h +++ /dev/null @@ -1,153 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: editorbase.h -// Purpose: General interfaces for editor plug-ins. -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 11/04/1999 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: GNU General Public License wxWindows licence v2.0 -///////////////////////////////////////////////////////////////////////////// - -#ifndef __EDITORBASE_G__ -#define __EDITORBASE_G__ - -#include "plugin.h" -#include "wx/window.h" - -class wxsSourceEditorPlugin : public wxsComponent -{ -protected: - string mFileName; - -public: - /*** overridables (with default implementations) ***/ - - // user-level commands - - virtual void OnOpen( const string& fname ) = 0; - virtual void OnSave( const string& fname ) = 0; - - virtual void OnCopy() {} - virtual void OnCut() {} - virtual void OnPaste() {} - virtual void OnDelete() {} - - virtual void OnUndo() {} - virtual void OnRedo() {} - - virtual void SelectAll() {} - - // NOTE:: column -1 should result cursor to appear - // at the start of the first word in the line (if any) - - virtual void OnGotoLine( int lineNo, int column = -1 ) {} - - // should invoke editor's own "goto-line" dialog - virtual void OnGotoLine() {} - - virtual void OnProperties() {} - - virtual void OnFind() {} - virtual void OnFindNext() {} - virtual void OnFindPrevious() {} - virtual void OnReplace() {} - - virtual void OnToggleBookmark() {} - virtual void OnNextBookmark() {} - virtual void OnPreviousBookmark() {} - virtual void OnShowBookmarks() {} - - virtual void SetCheckpoint() {} - virtual bool CheckpointModified() { return TRUE; } - - // UI-updates - - virtual bool CanCopy() { return FALSE; } - virtual bool CanCut() { return FALSE; } - virtual bool CanPaste() { return FALSE; } - virtual bool CanUndo() { return FALSE; } - virtual bool CanRedo() { return FALSE; } - - // accesed by framework - - virtual bool IsModified() { return TRUE; } - - // returned buffer is NULL, if operation is not supported - // by this concrete editor - - virtual void GetAllText( char** ppBuf, size_t* length ) - - { *ppBuf = NULL; *length = 0; } - - virtual string FindWordAtCursor() = 0; - - // returned line and column are -1s, if operation - // is not supported this concrete editor - - virtual void GetCursorPos( int* line, int* column ) - - { *line = -1; *column = -1; } - - virtual void GetPagePos( int* line, int* column ) - - { *line = -1; *column = -1; } - - virtual void SetCursorPos( int line, int column ) {} - - // returned buffer is NULL, if operation is not supported - // by this concrete editor, - // (NOTE: range is given from "fromLine", but not - // including tillLine, [fomrLine,tillLine) ) - - virtual void GetText( int fromLine, int fromColumn, - int tillLine, int tillColumn, - char** ppBuf, size_t* length ) - { ppBuf = NULL; } - - virtual void InsertText( int line, int column, - char* text, size_t lenght ) - {} - - virtual void DeleteText( int fromLine, int fromColumn, - int tillLine, int tillColumn ) - {} - - virtual void PositionToXY( int line, int column, int* x, int* y ) - - { *x = -1; *y = -1; } - - virtual void GetSelectionRange( int* fromLine, int* fromColumn, - int* tillLine, int* tillColumn ) - - { *fromLine = -1; // not supported by default - } - - virtual wxSize GetCharacterSize() { return wxSize(-1,-1); } - - virtual bool IsUnixText() - -// default impl., actual implementation should use auto-detection - -#ifdef __WINDOWS__ - { return FALSE; } -#else - { return TRUE; } -#endif - - // requests editor to keep cursor blinking, even when - // the window has lost it's focus - - virtual void HoldCursor( bool hold ) - {} - - virtual string GetFileName() { return mFileName; } - virtual void SetFileName( const string& fname ) { mFileName = fname; } - - // overriden methods of wxStudioPluginBase - virtual WXS_PLUGIN_TYPE GetType() {return WXS_EDITOR_PLUGIN;} - virtual string GetCategory() { return "Editor";} -}; - -#endif - // __EDITORBASE_G__ diff --git a/utils/wxPython/modules/lseditor/finddlg.cpp b/utils/wxPython/modules/lseditor/finddlg.cpp deleted file mode 100644 index 0270cac0ba..0000000000 --- a/utils/wxPython/modules/lseditor/finddlg.cpp +++ /dev/null @@ -1,146 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 08/05/1999 -// RCS-ID: $Id$ -// Copyright: (c) Aleksandars Gluchovas -// Licence: GNU General Public License -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include "finddlg.h" - -/***** Implementation for class wxFindTextDialog *****/ - -//#define wxID_OK 3453453 - -BEGIN_EVENT_TABLE( wxFindTextDialog, wxDialog ) - - // FIXME:: why OnOk() is not called?? - //EVT_BUTTON( wxID_OK, wxFindTextDialog::OnOK ) - - EVT_CHAR_HOOK(wxFindTextDialog::OnKeyHook) - -END_EVENT_TABLE() - -wxString wxFindTextDialog::mLastExpr; -bool wxFindTextDialog::mMatchCase = TRUE; -bool wxFindTextDialog::mMatchWord = FALSE; -StrListT wxFindTextDialog::mExprList; - -// FIXME:: workaround for mystic. crashes wiht MSDev4.0 - -static wxComboBox* __gpCombo = NULL; - -wxFindTextDialog::wxFindTextDialog( wxWindow* parent, const string& expr ) - - : wxDialog( parent, -1, "Find", - wxDefaultPosition, wxSize( 335, 130 ), - wxDIALOG_MODAL | wxCAPTION | wxTAB_TRAVERSAL | - wxDEFAULT_DIALOG_STYLE - ) -{ - mLastExpr = expr; - - int leftMargin = 20; - int inputY = 20; - int inputWidth = 200; - - wxStaticText* pStatic = - new wxStaticText( this, -1, "Fi&nd what:", - wxPoint( leftMargin, inputY ) ); - - int checkY = inputY + 25; - - mpWordCheck = new wxCheckBox( this, -1, "Match &whole word only", - wxPoint( leftMargin, checkY ) ); - - mpCaseCheck = new wxCheckBox( this, -1, "Match &case", - wxPoint( leftMargin, checkY + 20 ) ); - - mpCaseCheck->SetValue( mMatchCase ); - mpWordCheck->SetValue( mMatchWord ); - - int btnX = inputWidth + leftMargin + 23; - int btnY = inputY - 4; - - wxSize btnSize( 70, 25 ); - - wxButton* pOkBtn = new wxButton( this, wxID_OK, "&Find", - wxPoint( btnX, btnY ), btnSize ); - - wxButton* pCancelBtn = new wxButton( this, wxID_CANCEL, "&Cancel", - wxPoint( btnX, btnY + 10 + btnSize.y ), btnSize ); - - __gpCombo = new wxComboBox( this, -1, mLastExpr, - wxPoint( leftMargin + 60, inputY - 2 ), - wxSize( inputWidth - 50, 20 ) ); - - for( size_t i = 0; i != mExprList.size(); ++i ) - - __gpCombo->Append( mExprList[i] ); - - pOkBtn->SetDefault(); - __gpCombo->SetFocus(); - - Center( wxBOTH ); -} - -void wxFindTextDialog::SetExpr( const wxString& expr ) -{ - mLastExpr = expr; - __gpCombo->SetValue( mLastExpr ); - -} - -wxComboBox* wxFindTextDialog::GetCombo() -{ - return __gpCombo; -} - -bool wxFindTextDialog::TransferDataFromWindow() -{ - mLastExpr = GetCombo()->GetValue(); - mMatchCase = mpCaseCheck->GetValue(); - mMatchWord = mpWordCheck->GetValue(); - - if ( mLastExpr != "" ) - { - for( size_t i = 0; i != mExprList.size(); ++i ) - - if ( mExprList[i] == mLastExpr ) - - return TRUE; - } - - if ( mExprList.size() > 20 ) - - mExprList.pop_back(); - - mExprList.push_back( mLastExpr ); - - return TRUE; -} - -void wxFindTextDialog::OnKeyHook( wxKeyEvent& event ) -{ - if ( event.m_keyCode == WXK_RETURN ) - { - TransferDataFromWindow(); - EndModal( wxID_OK ); - } - else - event.Skip(); -} diff --git a/utils/wxPython/modules/lseditor/finddlg.h b/utils/wxPython/modules/lseditor/finddlg.h deleted file mode 100644 index dbceaa2b16..0000000000 --- a/utils/wxPython/modules/lseditor/finddlg.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __FINDDLG_G__ -#define __FINDDLG_G__ - -#include "wx/dialog.h" -#include "wx/checkbox.h" -#include "wx/combobox.h" - -#include "wxstldefs.h" - -class wxFindTextDialog : public wxDialog -{ -public: - static wxString mLastExpr; - static bool mMatchCase; - static bool mMatchWord; - static StrListT mExprList; - - wxCheckBox* mpCaseCheck; - wxCheckBox* mpWordCheck; - -public: - wxFindTextDialog( wxWindow* parent, const string& expr = "" ); - - bool MatchWordOn() { return mMatchWord; } - bool MatchCaseOn() { return mMatchCase; } - wxString GetExpr() { return mLastExpr; } - void SetExpr( const wxString& expr ); - - wxComboBox* GetCombo(); - - virtual bool TransferDataFromWindow(); - - void OnKeyHook( wxKeyEvent& event ); - - DECLARE_EVENT_TABLE() -}; - -#endif diff --git a/utils/wxPython/modules/lseditor/gtk/.cvsignore b/utils/wxPython/modules/lseditor/gtk/.cvsignore deleted file mode 100644 index b25c15b81f..0000000000 --- a/utils/wxPython/modules/lseditor/gtk/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*~ diff --git a/utils/wxPython/modules/lseditor/gtk/lseditor.cpp b/utils/wxPython/modules/lseditor/gtk/lseditor.cpp deleted file mode 100644 index a567818168..0000000000 --- a/utils/wxPython/modules/lseditor/gtk/lseditor.cpp +++ /dev/null @@ -1,1913 +0,0 @@ -/* - * FILE : gtk/lseditor.cpp - * - * This file was automatically generated by : - * Simplified Wrapper and Interface Generator (SWIG) - * Version 1.1 (Patch 6) - * - * Portions Copyright (c) 1995-1998 - * The University of Utah and The Regents of the University of California. - * Permission is granted to distribute this file in any manner provided - * this notice remains intact. - * - * Do not make changes to this file--changes will be lost! - * - */ - - -#define SWIGCODE -/* Implementation : PYTHON */ - -#define SWIGPYTHON -#include <string.h> -#include <stdlib.h> -/* Definitions for Windows/Unix exporting */ -#if defined(__WIN32__) -# if defined(_MSC_VER) -# define SWIGEXPORT(a) __declspec(dllexport) a -# else -# if defined(__BORLANDC__) -# define SWIGEXPORT(a) a _export -# else -# define SWIGEXPORT(a) a -# endif -# endif -#else -# define SWIGEXPORT(a) a -#endif - -#ifdef __cplusplus -extern "C" { -#endif -#include "Python.h" -extern void SWIG_MakePtr(char *, void *, char *); -extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *)); -extern char *SWIG_GetPtr(char *, void **, char *); -extern char *SWIG_GetPtrObj(PyObject *, void **, char *); -extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); -extern PyObject *SWIG_newvarlink(void); -#ifdef __cplusplus -} -#endif -#define SWIG_init initlseditorc - -#define SWIG_name "lseditorc" - -#include "helpers.h" -#include "lseditorpl.h" - -static PyObject* l_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyList_Check(target)) { - o2 = target; - target = PyList_New(0); - PyList_Append(target, o2); - Py_XDECREF(o2); - } - PyList_Append(target,o); - Py_XDECREF(o); - } - return target; -} - -static PyObject* t_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyTuple_Check(target)) { - o2 = target; - target = PyTuple_New(1); - PyTuple_SetItem(target, 0, o2); - } - o3 = PyTuple_New(1); - PyTuple_SetItem(o3, 0, o); - - o2 = target; - target = PySequence_Concat(o2, o3); - Py_DECREF(o2); - Py_DECREF(o3); - } - return target; -} - - -extern byte* byte_LIST_helper(PyObject* source); -extern int* int_LIST_helper(PyObject* source); -extern long* long_LIST_helper(PyObject* source); -extern char** string_LIST_helper(PyObject* source); -extern wxPoint* wxPoint_LIST_helper(PyObject* source); -extern wxBitmap** wxBitmap_LIST_helper(PyObject* source); -extern wxString* wxString_LIST_helper(PyObject* source); -extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source); - - -static char* wxStringErrorMsg = "string type is required for parameter"; - -#ifdef SEPARATE - wxString wxPyEmptyStr(""); -#endif -#ifdef __cplusplus -extern "C" { -#endif -#define new_wxsLSEditorPlugin() (new wxsLSEditorPlugin()) -static PyObject *_wrap_new_wxsLSEditorPlugin(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _result; - char *_kwnames[] = { NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxsLSEditorPlugin",_kwnames)) - return NULL; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxsLSEditorPlugin *)new_wxsLSEditorPlugin(); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxsLSEditorPlugin_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define delete_wxsLSEditorPlugin(_swigobj) (delete _swigobj) -static PyObject *_wrap_delete_wxsLSEditorPlugin(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxsLSEditorPlugin",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxsLSEditorPlugin. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - delete_wxsLSEditorPlugin(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_Create(_swigobj,_swigarg0,_swigarg1) (_swigobj->Create(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxsLSEditorPlugin_Create(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - wxWindow * _arg1; - wxWindowID _arg2; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","parent","id", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi:wxsLSEditorPlugin_Create",_kwnames,&_argo0,&_argo1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_Create. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxsLSEditorPlugin_Create. Expected _wxWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_Create(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnOpen(_swigobj,_swigarg0) (_swigobj->OnOpen(_swigarg0)) -static PyObject *_wrap_wxsLSEditorPlugin_OnOpen(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - char * _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","fname", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxsLSEditorPlugin_OnOpen",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnOpen. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnOpen(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnSave(_swigobj,_swigarg0) (_swigobj->OnSave(_swigarg0)) -static PyObject *_wrap_wxsLSEditorPlugin_OnSave(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - char * _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","fname", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxsLSEditorPlugin_OnSave",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnSave. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnSave(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnCopy(_swigobj) (_swigobj->OnCopy()) -static PyObject *_wrap_wxsLSEditorPlugin_OnCopy(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnCopy",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnCopy. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnCopy(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnCut(_swigobj) (_swigobj->OnCut()) -static PyObject *_wrap_wxsLSEditorPlugin_OnCut(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnCut",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnCut. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnCut(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnPaste(_swigobj) (_swigobj->OnPaste()) -static PyObject *_wrap_wxsLSEditorPlugin_OnPaste(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnPaste",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnPaste. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnPaste(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnDelete(_swigobj) (_swigobj->OnDelete()) -static PyObject *_wrap_wxsLSEditorPlugin_OnDelete(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnDelete",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnDelete. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnDelete(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnUndo(_swigobj) (_swigobj->OnUndo()) -static PyObject *_wrap_wxsLSEditorPlugin_OnUndo(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnUndo",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnUndo. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnUndo(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnRedo(_swigobj) (_swigobj->OnRedo()) -static PyObject *_wrap_wxsLSEditorPlugin_OnRedo(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnRedo",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnRedo. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnRedo(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_SelectAll(_swigobj) (_swigobj->SelectAll()) -static PyObject *_wrap_wxsLSEditorPlugin_SelectAll(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_SelectAll",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_SelectAll. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_SelectAll(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnGotoLine(_swigobj,_swigarg0,_swigarg1) (_swigobj->OnGotoLine(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxsLSEditorPlugin_OnGotoLine(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2 = (int ) 0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","lineNo","column", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxsLSEditorPlugin_OnGotoLine",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnGotoLine. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnGotoLine(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnProperties(_swigobj) (_swigobj->OnProperties()) -static PyObject *_wrap_wxsLSEditorPlugin_OnProperties(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnProperties",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnProperties. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnProperties(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnFind(_swigobj) (_swigobj->OnFind()) -static PyObject *_wrap_wxsLSEditorPlugin_OnFind(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnFind",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnFind. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnFind(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnFindNext(_swigobj) (_swigobj->OnFindNext()) -static PyObject *_wrap_wxsLSEditorPlugin_OnFindNext(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnFindNext",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnFindNext. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnFindNext(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnFindPrevious(_swigobj) (_swigobj->OnFindPrevious()) -static PyObject *_wrap_wxsLSEditorPlugin_OnFindPrevious(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnFindPrevious",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnFindPrevious. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnFindPrevious(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnReplace(_swigobj) (_swigobj->OnReplace()) -static PyObject *_wrap_wxsLSEditorPlugin_OnReplace(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnReplace",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnReplace. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnReplace(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnToggleBookmark(_swigobj) (_swigobj->OnToggleBookmark()) -static PyObject *_wrap_wxsLSEditorPlugin_OnToggleBookmark(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnToggleBookmark",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnToggleBookmark. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnToggleBookmark(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnNextBookmark(_swigobj) (_swigobj->OnNextBookmark()) -static PyObject *_wrap_wxsLSEditorPlugin_OnNextBookmark(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnNextBookmark",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnNextBookmark. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnNextBookmark(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnPreviousBookmark(_swigobj) (_swigobj->OnPreviousBookmark()) -static PyObject *_wrap_wxsLSEditorPlugin_OnPreviousBookmark(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnPreviousBookmark",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnPreviousBookmark. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnPreviousBookmark(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnShowBookmarks(_swigobj) (_swigobj->OnShowBookmarks()) -static PyObject *_wrap_wxsLSEditorPlugin_OnShowBookmarks(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_OnShowBookmarks",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnShowBookmarks. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnShowBookmarks(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_SetCheckpoint(_swigobj) (_swigobj->SetCheckpoint()) -static PyObject *_wrap_wxsLSEditorPlugin_SetCheckpoint(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_SetCheckpoint",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_SetCheckpoint. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_SetCheckpoint(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_CheckpointModified(_swigobj) (_swigobj->CheckpointModified()) -static PyObject *_wrap_wxsLSEditorPlugin_CheckpointModified(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_CheckpointModified",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CheckpointModified. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CheckpointModified(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_CanCopy(_swigobj) (_swigobj->CanCopy()) -static PyObject *_wrap_wxsLSEditorPlugin_CanCopy(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_CanCopy",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CanCopy. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CanCopy(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_CanCut(_swigobj) (_swigobj->CanCut()) -static PyObject *_wrap_wxsLSEditorPlugin_CanCut(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_CanCut",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CanCut. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CanCut(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_CanPaste(_swigobj) (_swigobj->CanPaste()) -static PyObject *_wrap_wxsLSEditorPlugin_CanPaste(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_CanPaste",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CanPaste. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CanPaste(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_CanUndo(_swigobj) (_swigobj->CanUndo()) -static PyObject *_wrap_wxsLSEditorPlugin_CanUndo(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_CanUndo",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CanUndo. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CanUndo(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_CanRedo(_swigobj) (_swigobj->CanRedo()) -static PyObject *_wrap_wxsLSEditorPlugin_CanRedo(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_CanRedo",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CanRedo. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CanRedo(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_GetName(_swigobj) (_swigobj->GetName()) -static PyObject *_wrap_wxsLSEditorPlugin_GetName(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - string * _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_GetName",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetName. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new string (wxsLSEditorPlugin_GetName(_arg0)); - - wxPy_END_ALLOW_THREADS; -} SWIG_MakePtr(_ptemp, (void *) _result,"_string_p"); - _resultobj = Py_BuildValue("s",_ptemp); - return _resultobj; -} - -#define wxsLSEditorPlugin_IsModified(_swigobj) (_swigobj->IsModified()) -static PyObject *_wrap_wxsLSEditorPlugin_IsModified(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_IsModified",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_IsModified. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_IsModified(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_GetWindow(_swigobj) (_swigobj->GetWindow()) -static PyObject *_wrap_wxsLSEditorPlugin_GetWindow(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxWindow * _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_GetWindow",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetWindow. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxWindow *)wxsLSEditorPlugin_GetWindow(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxWindow_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxsLSEditorPlugin_SetFileName(_swigobj,_swigarg0) (_swigobj->SetFileName(_swigarg0)) -static PyObject *_wrap_wxsLSEditorPlugin_SetFileName(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - char * _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","fname", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxsLSEditorPlugin_SetFileName",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_SetFileName. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_SetFileName(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_HoldCursor(_swigobj,_swigarg0) (_swigobj->HoldCursor(_swigarg0)) -static PyObject *_wrap_wxsLSEditorPlugin_HoldCursor(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - bool _arg1; - PyObject * _argo0 = 0; - int tempbool1; - char *_kwnames[] = { "self","hold", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxsLSEditorPlugin_HoldCursor",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_HoldCursor. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_HoldCursor(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_FindWordAtCursor(_swigobj) (_swigobj->FindWordAtCursor()) -static PyObject *_wrap_wxsLSEditorPlugin_FindWordAtCursor(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - string * _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_FindWordAtCursor",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_FindWordAtCursor. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new string (wxsLSEditorPlugin_FindWordAtCursor(_arg0)); - - wxPy_END_ALLOW_THREADS; -} SWIG_MakePtr(_ptemp, (void *) _result,"_string_p"); - _resultobj = Py_BuildValue("s",_ptemp); - return _resultobj; -} - -#define wxsLSEditorPlugin_GetCursorPos(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetCursorPos(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxsLSEditorPlugin_GetCursorPos(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int * _arg1; - int * _arg2; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - char *_kwnames[] = { "self","line","column", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxsLSEditorPlugin_GetCursorPos",_kwnames,&_argo0,&_argo1,&_argo2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetCursorPos. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxsLSEditorPlugin_GetCursorPos. Expected _int_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxsLSEditorPlugin_GetCursorPos. Expected _int_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_GetCursorPos(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_SetCursorPos(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetCursorPos(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxsLSEditorPlugin_SetCursorPos(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","line","column", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxsLSEditorPlugin_SetCursorPos",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_SetCursorPos. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_SetCursorPos(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_GetPagePos(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetPagePos(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxsLSEditorPlugin_GetPagePos(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int * _arg1; - int * _arg2; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - char *_kwnames[] = { "self","line","column", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxsLSEditorPlugin_GetPagePos",_kwnames,&_argo0,&_argo1,&_argo2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetPagePos. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxsLSEditorPlugin_GetPagePos. Expected _int_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxsLSEditorPlugin_GetPagePos. Expected _int_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_GetPagePos(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_GetText(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (_swigobj->GetText(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) -static PyObject *_wrap_wxsLSEditorPlugin_GetText(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2; - int _arg3; - int _arg4; - char ** _arg5; - size_t * _arg6; - PyObject * _argo0 = 0; - PyObject * _argo5 = 0; - PyObject * _argo6 = 0; - char *_kwnames[] = { "self","fromLine","fromColumn","tillLine","tillColumn","ppBuf","length", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiiiOO:wxsLSEditorPlugin_GetText",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3,&_arg4,&_argo5,&_argo6)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetText. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo5) { - if (_argo5 == Py_None) { _arg5 = NULL; } - else if (SWIG_GetPtrObj(_argo5,(void **) &_arg5,"_char_pp")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 6 of wxsLSEditorPlugin_GetText. Expected _char_pp."); - return NULL; - } - } - if (_argo6) { - if (_argo6 == Py_None) { _arg6 = NULL; } - else if (SWIG_GetPtrObj(_argo6,(void **) &_arg6,"_size_t_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 7 of wxsLSEditorPlugin_GetText. Expected _size_t_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_GetText(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_InsertText(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->InsertText(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) -static PyObject *_wrap_wxsLSEditorPlugin_InsertText(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2; - char * _arg3; - size_t _arg4; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","line","column","text","lenght", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oiisi:wxsLSEditorPlugin_InsertText",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3,&_arg4)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_InsertText. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_InsertText(_arg0,_arg1,_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_DeleteText(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->DeleteText(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) -static PyObject *_wrap_wxsLSEditorPlugin_DeleteText(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2; - int _arg3; - int _arg4; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","fromLine","fromColumn","tillLine","tillColumn", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oiiii:wxsLSEditorPlugin_DeleteText",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3,&_arg4)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_DeleteText. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_DeleteText(_arg0,_arg1,_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_PositionToXY(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->PositionToXY(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) -static PyObject *_wrap_wxsLSEditorPlugin_PositionToXY(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2; - int * _arg3; - int * _arg4; - PyObject * _argo0 = 0; - int temp; - PyObject * _obj3 = 0; - int temp0; - PyObject * _obj4 = 0; - char *_kwnames[] = { "self","line","column","x","y", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiOO:wxsLSEditorPlugin_PositionToXY",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&_obj4)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_PositionToXY. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - temp = (int) PyInt_AsLong(_obj3); - _arg3 = &temp; -} -{ - temp0 = (int) PyInt_AsLong(_obj4); - _arg4 = &temp0; -} -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_PositionToXY(_arg0,_arg1,_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; -{ - PyObject *o; - o = PyInt_FromLong((long) (*_arg3)); - _resultobj = t_output_helper(_resultobj, o); -} -{ - PyObject *o; - o = PyInt_FromLong((long) (*_arg4)); - _resultobj = t_output_helper(_resultobj, o); -} - return _resultobj; -} - -#define wxsLSEditorPlugin_GetSelectionRange(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->GetSelectionRange(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) -static PyObject *_wrap_wxsLSEditorPlugin_GetSelectionRange(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int * _arg1; - int * _arg2; - int * _arg3; - int * _arg4; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - PyObject * _argo3 = 0; - PyObject * _argo4 = 0; - char *_kwnames[] = { "self","fromLine","fromColumn","tillLine","tillColumn", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOOO:wxsLSEditorPlugin_GetSelectionRange",_kwnames,&_argo0,&_argo1,&_argo2,&_argo3,&_argo4)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetSelectionRange. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxsLSEditorPlugin_GetSelectionRange. Expected _int_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxsLSEditorPlugin_GetSelectionRange. Expected _int_p."); - return NULL; - } - } - if (_argo3) { - if (_argo3 == Py_None) { _arg3 = NULL; } - else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxsLSEditorPlugin_GetSelectionRange. Expected _int_p."); - return NULL; - } - } - if (_argo4) { - if (_argo4 == Py_None) { _arg4 = NULL; } - else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxsLSEditorPlugin_GetSelectionRange. Expected _int_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_GetSelectionRange(_arg0,_arg1,_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_GetCharacterSize(_swigobj) (_swigobj->GetCharacterSize()) -static PyObject *_wrap_wxsLSEditorPlugin_GetCharacterSize(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxSize * _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_GetCharacterSize",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetCharacterSize. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxSize (wxsLSEditorPlugin_GetCharacterSize(_arg0)); - - wxPy_END_ALLOW_THREADS; -} SWIG_MakePtr(_ptemp, (void *) _result,"_wxSize_p"); - _resultobj = Py_BuildValue("s",_ptemp); - return _resultobj; -} - -#define wxsLSEditorPlugin_IsUnixText(_swigobj) (_swigobj->IsUnixText()) -static PyObject *_wrap_wxsLSEditorPlugin_IsUnixText(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxsLSEditorPlugin_IsUnixText",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_IsUnixText. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_IsUnixText(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -static PyMethodDef lseditorcMethods[] = { - { "wxsLSEditorPlugin_IsUnixText", (PyCFunction) _wrap_wxsLSEditorPlugin_IsUnixText, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_GetCharacterSize", (PyCFunction) _wrap_wxsLSEditorPlugin_GetCharacterSize, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_GetSelectionRange", (PyCFunction) _wrap_wxsLSEditorPlugin_GetSelectionRange, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_PositionToXY", (PyCFunction) _wrap_wxsLSEditorPlugin_PositionToXY, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_DeleteText", (PyCFunction) _wrap_wxsLSEditorPlugin_DeleteText, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_InsertText", (PyCFunction) _wrap_wxsLSEditorPlugin_InsertText, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_GetText", (PyCFunction) _wrap_wxsLSEditorPlugin_GetText, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_GetPagePos", (PyCFunction) _wrap_wxsLSEditorPlugin_GetPagePos, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_SetCursorPos", (PyCFunction) _wrap_wxsLSEditorPlugin_SetCursorPos, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_GetCursorPos", (PyCFunction) _wrap_wxsLSEditorPlugin_GetCursorPos, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_FindWordAtCursor", (PyCFunction) _wrap_wxsLSEditorPlugin_FindWordAtCursor, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_HoldCursor", (PyCFunction) _wrap_wxsLSEditorPlugin_HoldCursor, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_SetFileName", (PyCFunction) _wrap_wxsLSEditorPlugin_SetFileName, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_GetWindow", (PyCFunction) _wrap_wxsLSEditorPlugin_GetWindow, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_IsModified", (PyCFunction) _wrap_wxsLSEditorPlugin_IsModified, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_GetName", (PyCFunction) _wrap_wxsLSEditorPlugin_GetName, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_CanRedo", (PyCFunction) _wrap_wxsLSEditorPlugin_CanRedo, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_CanUndo", (PyCFunction) _wrap_wxsLSEditorPlugin_CanUndo, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_CanPaste", (PyCFunction) _wrap_wxsLSEditorPlugin_CanPaste, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_CanCut", (PyCFunction) _wrap_wxsLSEditorPlugin_CanCut, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_CanCopy", (PyCFunction) _wrap_wxsLSEditorPlugin_CanCopy, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_CheckpointModified", (PyCFunction) _wrap_wxsLSEditorPlugin_CheckpointModified, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_SetCheckpoint", (PyCFunction) _wrap_wxsLSEditorPlugin_SetCheckpoint, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnShowBookmarks", (PyCFunction) _wrap_wxsLSEditorPlugin_OnShowBookmarks, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnPreviousBookmark", (PyCFunction) _wrap_wxsLSEditorPlugin_OnPreviousBookmark, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnNextBookmark", (PyCFunction) _wrap_wxsLSEditorPlugin_OnNextBookmark, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnToggleBookmark", (PyCFunction) _wrap_wxsLSEditorPlugin_OnToggleBookmark, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnReplace", (PyCFunction) _wrap_wxsLSEditorPlugin_OnReplace, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnFindPrevious", (PyCFunction) _wrap_wxsLSEditorPlugin_OnFindPrevious, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnFindNext", (PyCFunction) _wrap_wxsLSEditorPlugin_OnFindNext, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnFind", (PyCFunction) _wrap_wxsLSEditorPlugin_OnFind, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnProperties", (PyCFunction) _wrap_wxsLSEditorPlugin_OnProperties, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnGotoLine", (PyCFunction) _wrap_wxsLSEditorPlugin_OnGotoLine, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_SelectAll", (PyCFunction) _wrap_wxsLSEditorPlugin_SelectAll, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnRedo", (PyCFunction) _wrap_wxsLSEditorPlugin_OnRedo, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnUndo", (PyCFunction) _wrap_wxsLSEditorPlugin_OnUndo, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnDelete", (PyCFunction) _wrap_wxsLSEditorPlugin_OnDelete, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnPaste", (PyCFunction) _wrap_wxsLSEditorPlugin_OnPaste, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnCut", (PyCFunction) _wrap_wxsLSEditorPlugin_OnCut, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnCopy", (PyCFunction) _wrap_wxsLSEditorPlugin_OnCopy, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnSave", (PyCFunction) _wrap_wxsLSEditorPlugin_OnSave, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_OnOpen", (PyCFunction) _wrap_wxsLSEditorPlugin_OnOpen, METH_VARARGS | METH_KEYWORDS }, - { "wxsLSEditorPlugin_Create", (PyCFunction) _wrap_wxsLSEditorPlugin_Create, METH_VARARGS | METH_KEYWORDS }, - { "delete_wxsLSEditorPlugin", (PyCFunction) _wrap_delete_wxsLSEditorPlugin, METH_VARARGS | METH_KEYWORDS }, - { "new_wxsLSEditorPlugin", (PyCFunction) _wrap_new_wxsLSEditorPlugin, METH_VARARGS | METH_KEYWORDS }, - { NULL, NULL } -}; -#ifdef __cplusplus -} -#endif -/* - * This table is used by the pointer type-checker - */ -static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { - { "_wxAcceleratorTable","_class_wxAcceleratorTable",0}, - { "_wxEvent","_class_wxEvent",0}, - { "_class_wxActivateEvent","_wxActivateEvent",0}, - { "_signed_long","_long",0}, - { "_wxMenuEvent","_class_wxMenuEvent",0}, - { "_class_wxJPEGHandler","_wxJPEGHandler",0}, - { "_wxBMPHandler","_class_wxBMPHandler",0}, - { "_wxImage","_class_wxImage",0}, - { "_wxPrintQuality","_int",0}, - { "_wxPrintQuality","_signed_int",0}, - { "_wxPrintQuality","_unsigned_int",0}, - { "_wxPrintQuality","_wxWindowID",0}, - { "_wxPrintQuality","_uint",0}, - { "_wxPrintQuality","_EBool",0}, - { "_wxPrintQuality","_size_t",0}, - { "_wxFontData","_class_wxFontData",0}, - { "___wxPyCleanup","_class___wxPyCleanup",0}, - { "_class_wxRegionIterator","_wxRegionIterator",0}, - { "_class_wxMenuBar","_wxMenuBar",0}, - { "_class_wxPyTreeItemData","_wxPyTreeItemData",0}, - { "_wxsLSEditorPlugin","_class_wxsLSEditorPlugin",0}, - { "_class_wxEvtHandler","_wxEvtHandler",0}, - { "_wxPaintEvent","_class_wxPaintEvent",0}, - { "_wxGIFHandler","_class_wxGIFHandler",0}, - { "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0}, - { "_wxCursor","_class_wxCursor",0}, - { "_wxNotifyEvent","_class_wxNotifyEvent",0}, - { "_wxImageHandler","_class_wxImageHandler",0}, - { "_class_wxTreeCtrl","_wxTreeCtrl",0}, - { "_wxMask","_class_wxMask",0}, - { "_wxToolTip","_class_wxToolTip",0}, - { "_wxGrid","_class_wxGrid",0}, - { "_wxPNGHandler","_class_wxPNGHandler",0}, - { "_class_wxColourData","_wxColourData",0}, - { "_class_wxPageSetupDialogData","_wxPageSetupDialogData",0}, - { "_wxPrinter","_class_wxPrinter",0}, - { "_wxPen","_class_wxPen",0}, - { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, - { "_byte","_unsigned_char",0}, - { "_wxStaticBox","_class_wxStaticBox",0}, - { "_wxChoice","_class_wxChoice",0}, - { "_wxSlider","_class_wxSlider",0}, - { "_wxNotebookEvent","_class_wxNotebookEvent",0}, - { "_wxPyPrintout","_class_wxPyPrintout",0}, - { "_long","_wxDash",0}, - { "_long","_unsigned_long",0}, - { "_long","_signed_long",0}, - { "_wxImageList","_class_wxImageList",0}, - { "_wxDropFilesEvent","_class_wxDropFilesEvent",0}, - { "_wxBitmapButton","_class_wxBitmapButton",0}, - { "_wxSashWindow","_class_wxSashWindow",0}, - { "_class_wxPrintDialogData","_wxPrintDialogData",0}, - { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, - { "_class_wxGauge","_wxGauge",0}, - { "_class_wxSashEvent","_wxSashEvent",0}, - { "_wxDC","_class_wxDC",0}, - { "_wxListEvent","_class_wxListEvent",0}, - { "_class_wxSingleChoiceDialog","_wxSingleChoiceDialog",0}, - { "_wxProgressDialog","_class_wxProgressDialog",0}, - { "_class_wxBMPHandler","_wxBMPHandler",0}, - { "_wxPrintPreview","_class_wxPrintPreview",0}, - { "_wxSpinEvent","_class_wxSpinEvent",0}, - { "_wxSashLayoutWindow","_class_wxSashLayoutWindow",0}, - { "_size_t","_wxPrintQuality",0}, - { "_size_t","_unsigned_int",0}, - { "_size_t","_int",0}, - { "_size_t","_wxWindowID",0}, - { "_size_t","_uint",0}, - { "_class_wxRealPoint","_wxRealPoint",0}, - { "_class_wxMenuItem","_wxMenuItem",0}, - { "_class_wxPaintEvent","_wxPaintEvent",0}, - { "_wxSysColourChangedEvent","_class_wxSysColourChangedEvent",0}, - { "_class_wxStatusBar","_wxStatusBar",0}, - { "_class_wxGIFHandler","_wxGIFHandler",0}, - { "_class_wxPostScriptDC","_wxPostScriptDC",0}, - { "_wxPanel","_class_wxPanel",0}, - { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, - { "_wxCheckBox","_class_wxCheckBox",0}, - { "_wxPyEvent","_class_wxPyEvent",0}, - { "_wxTextCtrl","_class_wxTextCtrl",0}, - { "_class_wxMask","_wxMask",0}, - { "_class_wxToolTip","_wxToolTip",0}, - { "_class_wxKeyEvent","_wxKeyEvent",0}, - { "_class_wxGrid","_wxGrid",0}, - { "_class_wxPNGHandler","_wxPNGHandler",0}, - { "_wxColour","_class_wxColour",0}, - { "_class_wxDialog","_wxDialog",0}, - { "_wxPageSetupDialog","_class_wxPageSetupDialog",0}, - { "_class_wxPrinter","_wxPrinter",0}, - { "_wxIdleEvent","_class_wxIdleEvent",0}, - { "_class_wxUpdateUIEvent","_wxUpdateUIEvent",0}, - { "_wxToolBar","_class_wxToolBar",0}, - { "_wxStaticLine","_class_wxStaticLine",0}, - { "_class_wxLayoutAlgorithm","_wxLayoutAlgorithm",0}, - { "_wxBrush","_class_wxBrush",0}, - { "_wxMiniFrame","_class_wxMiniFrame",0}, - { "_class_wxNotebookEvent","_wxNotebookEvent",0}, - { "_class_wxPyPrintout","_wxPyPrintout",0}, - { "_class_wxSashWindow","_wxSashWindow",0}, - { "_wxShowEvent","_class_wxShowEvent",0}, - { "_uint","_wxPrintQuality",0}, - { "_uint","_size_t",0}, - { "_uint","_unsigned_int",0}, - { "_uint","_int",0}, - { "_uint","_wxWindowID",0}, - { "_class_wxEvent","_wxEvent",0}, - { "_wxCheckListBox","_class_wxCheckListBox",0}, - { "_wxSplitterEvent","_class_wxSplitterEvent",0}, - { "_wxGridEvent","_class_wxGridEvent",0}, - { "_wxRect","_class_wxRect",0}, - { "_wxCommandEvent","_class_wxCommandEvent",0}, - { "_wxSizeEvent","_class_wxSizeEvent",0}, - { "_class_wxImage","_wxImage",0}, - { "_wxPoint","_class_wxPoint",0}, - { "_class_wxSashLayoutWindow","_wxSashLayoutWindow",0}, - { "_class_wxButton","_wxButton",0}, - { "_wxRadioBox","_class_wxRadioBox",0}, - { "_class_wxFontData","_wxFontData",0}, - { "_class___wxPyCleanup","___wxPyCleanup",0}, - { "_wxBitmap","_class_wxBitmap",0}, - { "_wxPrintDialog","_class_wxPrintDialog",0}, - { "_wxPyTimer","_class_wxPyTimer",0}, - { "_wxWindowDC","_class_wxWindowDC",0}, - { "_wxScrollBar","_class_wxScrollBar",0}, - { "_wxSpinButton","_class_wxSpinButton",0}, - { "_wxToolBarTool","_class_wxToolBarTool",0}, - { "_wxColourDialog","_class_wxColourDialog",0}, - { "_wxPrintData","_class_wxPrintData",0}, - { "_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0}, - { "_class_wxNotifyEvent","_wxNotifyEvent",0}, - { "_wxMessageDialog","_class_wxMessageDialog",0}, - { "_class_wxPyEvent","_wxPyEvent",0}, - { "_wxTextEntryDialog","_class_wxTextEntryDialog",0}, - { "_class_wxIconizeEvent","_wxIconizeEvent",0}, - { "_class_wxStaticBitmap","_wxStaticBitmap",0}, - { "_wxMDIChildFrame","_class_wxMDIChildFrame",0}, - { "_wxListItem","_class_wxListItem",0}, - { "_class_wxToolBar","_wxToolBar",0}, - { "_class_wxStaticLine","_wxStaticLine",0}, - { "_wxScrollEvent","_class_wxScrollEvent",0}, - { "_wxCalculateLayoutEvent","_class_wxCalculateLayoutEvent",0}, - { "_EBool","_wxPrintQuality",0}, - { "_EBool","_signed_int",0}, - { "_EBool","_int",0}, - { "_EBool","_wxWindowID",0}, - { "_class_wxRegion","_wxRegion",0}, - { "_class_wxDropFilesEvent","_wxDropFilesEvent",0}, - { "_class_wxPreviewFrame","_wxPreviewFrame",0}, - { "_wxStaticText","_class_wxStaticText",0}, - { "_wxFont","_class_wxFont",0}, - { "_wxCloseEvent","_class_wxCloseEvent",0}, - { "_class_wxSplitterEvent","_wxSplitterEvent",0}, - { "_wxNotebook","_class_wxNotebook",0}, - { "_unsigned_long","_wxDash",0}, - { "_unsigned_long","_long",0}, - { "_class_wxRect","_wxRect",0}, - { "_class_wxDC","_wxDC",0}, - { "_class_wxProgressDialog","_wxProgressDialog",0}, - { "_wxPyApp","_class_wxPyApp",0}, - { "_wxMDIParentFrame","_class_wxMDIParentFrame",0}, - { "_class_wxTreeEvent","_wxTreeEvent",0}, - { "_class_wxDirDialog","_wxDirDialog",0}, - { "_class_wxPyTimer","_wxPyTimer",0}, - { "_wxFocusEvent","_class_wxFocusEvent",0}, - { "_wxMaximizeEvent","_class_wxMaximizeEvent",0}, - { "_class_wxSpinButton","_wxSpinButton",0}, - { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, - { "_class_wxPanel","_wxPanel",0}, - { "_class_wxCheckBox","_wxCheckBox",0}, - { "_wxComboBox","_class_wxComboBox",0}, - { "_wxRadioButton","_class_wxRadioButton",0}, - { "_class_wxMessageDialog","_wxMessageDialog",0}, - { "_signed_int","_wxPrintQuality",0}, - { "_signed_int","_EBool",0}, - { "_signed_int","_wxWindowID",0}, - { "_signed_int","_int",0}, - { "_class_wxTextCtrl","_wxTextCtrl",0}, - { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, - { "_wxMenu","_class_wxMenu",0}, - { "_class_wxMoveEvent","_wxMoveEvent",0}, - { "_wxListBox","_class_wxListBox",0}, - { "_wxScreenDC","_class_wxScreenDC",0}, - { "_class_wxMDIChildFrame","_wxMDIChildFrame",0}, - { "_WXTYPE","_short",0}, - { "_WXTYPE","_signed_short",0}, - { "_WXTYPE","_unsigned_short",0}, - { "_wxFileDialog","_class_wxFileDialog",0}, - { "_class_wxMDIClientWindow","_wxMDIClientWindow",0}, - { "_class_wxBrush","_wxBrush",0}, - { "_unsigned_short","_WXTYPE",0}, - { "_unsigned_short","_short",0}, - { "_class_wxWindow","_wxWindow",0}, - { "_wxSplitterWindow","_class_wxSplitterWindow",0}, - { "_class_wxStaticText","_wxStaticText",0}, - { "_wxPrintDialogData","_class_wxPrintDialogData",0}, - { "_class_wxFont","_wxFont",0}, - { "_class_wxCloseEvent","_wxCloseEvent",0}, - { "_wxSashEvent","_class_wxSashEvent",0}, - { "_class_wxMenuEvent","_wxMenuEvent",0}, - { "_wxClientDC","_class_wxClientDC",0}, - { "_wxMouseEvent","_class_wxMouseEvent",0}, - { "_wxListCtrl","_class_wxListCtrl",0}, - { "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0}, - { "_class_wxPoint","_wxPoint",0}, - { "_wxRealPoint","_class_wxRealPoint",0}, - { "_class_wxRadioBox","_wxRadioBox",0}, - { "_wxGridCell","_class_wxGridCell",0}, - { "_signed_short","_WXTYPE",0}, - { "_signed_short","_short",0}, - { "_wxMemoryDC","_class_wxMemoryDC",0}, - { "_class_wxPrintDialog","_wxPrintDialog",0}, - { "_class_wxsLSEditorPlugin","_wxsLSEditorPlugin",0}, - { "_wxPaintDC","_class_wxPaintDC",0}, - { "_class_wxWindowDC","_wxWindowDC",0}, - { "_class_wxFocusEvent","_wxFocusEvent",0}, - { "_class_wxMaximizeEvent","_wxMaximizeEvent",0}, - { "_wxStatusBar","_class_wxStatusBar",0}, - { "_class_wxToolBarTool","_wxToolBarTool",0}, - { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, - { "_class_wxCursor","_wxCursor",0}, - { "_wxPostScriptDC","_class_wxPostScriptDC",0}, - { "_class_wxImageHandler","_wxImageHandler",0}, - { "_wxScrolledWindow","_class_wxScrolledWindow",0}, - { "_wxTreeItemId","_class_wxTreeItemId",0}, - { "_unsigned_char","_byte",0}, - { "_class_wxMenu","_wxMenu",0}, - { "_wxControl","_class_wxControl",0}, - { "_class_wxListBox","_wxListBox",0}, - { "_unsigned_int","_wxPrintQuality",0}, - { "_unsigned_int","_size_t",0}, - { "_unsigned_int","_uint",0}, - { "_unsigned_int","_wxWindowID",0}, - { "_unsigned_int","_int",0}, - { "_wxIcon","_class_wxIcon",0}, - { "_wxDialog","_class_wxDialog",0}, - { "_class_wxListItem","_wxListItem",0}, - { "_class_wxPen","_wxPen",0}, - { "_class_wxFileDialog","_wxFileDialog",0}, - { "_wxQueryLayoutInfoEvent","_class_wxQueryLayoutInfoEvent",0}, - { "_short","_WXTYPE",0}, - { "_short","_unsigned_short",0}, - { "_short","_signed_short",0}, - { "_class_wxStaticBox","_wxStaticBox",0}, - { "_wxLayoutAlgorithm","_class_wxLayoutAlgorithm",0}, - { "_class_wxScrollEvent","_wxScrollEvent",0}, - { "_wxJoystickEvent","_class_wxJoystickEvent",0}, - { "_class_wxChoice","_wxChoice",0}, - { "_class_wxSlider","_wxSlider",0}, - { "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0}, - { "_class_wxImageList","_wxImageList",0}, - { "_class_wxBitmapButton","_wxBitmapButton",0}, - { "_wxFrame","_class_wxFrame",0}, - { "_class_wxNotebook","_wxNotebook",0}, - { "_wxJPEGHandler","_class_wxJPEGHandler",0}, - { "_wxWindowID","_wxPrintQuality",0}, - { "_wxWindowID","_size_t",0}, - { "_wxWindowID","_EBool",0}, - { "_wxWindowID","_uint",0}, - { "_wxWindowID","_int",0}, - { "_wxWindowID","_signed_int",0}, - { "_wxWindowID","_unsigned_int",0}, - { "_int","_wxPrintQuality",0}, - { "_int","_size_t",0}, - { "_int","_EBool",0}, - { "_int","_uint",0}, - { "_int","_wxWindowID",0}, - { "_int","_unsigned_int",0}, - { "_int","_signed_int",0}, - { "_class_wxMouseEvent","_wxMouseEvent",0}, - { "_class_wxListEvent","_wxListEvent",0}, - { "_class_wxPrintPreview","_wxPrintPreview",0}, - { "_class_wxSpinEvent","_wxSpinEvent",0}, - { "_wxButton","_class_wxButton",0}, - { "_class_wxPyApp","_wxPyApp",0}, - { "_wxSize","_class_wxSize",0}, - { "_wxRegionIterator","_class_wxRegionIterator",0}, - { "_class_wxMDIParentFrame","_wxMDIParentFrame",0}, - { "_wxPyTreeItemData","_class_wxPyTreeItemData",0}, - { "_class_wxPaintDC","_wxPaintDC",0}, - { "_class_wxSysColourChangedEvent","_wxSysColourChangedEvent",0}, - { "_class_wxInitDialogEvent","_wxInitDialogEvent",0}, - { "_class_wxComboBox","_wxComboBox",0}, - { "_class_wxRadioButton","_wxRadioButton",0}, - { "_class_wxTreeItemId","_wxTreeItemId",0}, - { "_wxTreeCtrl","_class_wxTreeCtrl",0}, - { "_class_wxLayoutConstraints","_wxLayoutConstraints",0}, - { "_wxIconizeEvent","_class_wxIconizeEvent",0}, - { "_class_wxControl","_wxControl",0}, - { "_wxStaticBitmap","_class_wxStaticBitmap",0}, - { "_class_wxIcon","_wxIcon",0}, - { "_class_wxColour","_wxColour",0}, - { "_class_wxScreenDC","_wxScreenDC",0}, - { "_class_wxPageSetupDialog","_wxPageSetupDialog",0}, - { "_wxPalette","_class_wxPalette",0}, - { "_class_wxIdleEvent","_wxIdleEvent",0}, - { "_wxEraseEvent","_class_wxEraseEvent",0}, - { "_class_wxJoystickEvent","_wxJoystickEvent",0}, - { "_class_wxMiniFrame","_wxMiniFrame",0}, - { "_wxFontDialog","_class_wxFontDialog",0}, - { "_wxRegion","_class_wxRegion",0}, - { "_class_wxSplitterWindow","_wxSplitterWindow",0}, - { "_wxPreviewFrame","_class_wxPreviewFrame",0}, - { "_class_wxShowEvent","_wxShowEvent",0}, - { "_wxActivateEvent","_class_wxActivateEvent",0}, - { "_wxGauge","_class_wxGauge",0}, - { "_class_wxCheckListBox","_wxCheckListBox",0}, - { "_class_wxGridEvent","_wxGridEvent",0}, - { "_class_wxCommandEvent","_wxCommandEvent",0}, - { "_class_wxClientDC","_wxClientDC",0}, - { "_class_wxSizeEvent","_wxSizeEvent",0}, - { "_class_wxListCtrl","_wxListCtrl",0}, - { "_class_wxGridCell","_wxGridCell",0}, - { "_class_wxSize","_wxSize",0}, - { "_class_wxBitmap","_wxBitmap",0}, - { "_class_wxMemoryDC","_wxMemoryDC",0}, - { "_wxMenuBar","_class_wxMenuBar",0}, - { "_wxTreeEvent","_class_wxTreeEvent",0}, - { "_wxDirDialog","_class_wxDirDialog",0}, - { "_wxEvtHandler","_class_wxEvtHandler",0}, - { "_wxMenuItem","_class_wxMenuItem",0}, - { "_class_wxScrollBar","_wxScrollBar",0}, - { "_class_wxColourDialog","_wxColourDialog",0}, - { "_class_wxPrintData","_wxPrintData",0}, - { "_wxDash","_unsigned_long",0}, - { "_wxDash","_long",0}, - { "_class_wxScrolledWindow","_wxScrolledWindow",0}, - { "_class_wxTextEntryDialog","_wxTextEntryDialog",0}, - { "_wxKeyEvent","_class_wxKeyEvent",0}, - { "_wxMoveEvent","_class_wxMoveEvent",0}, - { "_wxColourData","_class_wxColourData",0}, - { "_wxPageSetupDialogData","_class_wxPageSetupDialogData",0}, - { "_class_wxPalette","_wxPalette",0}, - { "_class_wxQueryLayoutInfoEvent","_wxQueryLayoutInfoEvent",0}, - { "_class_wxEraseEvent","_wxEraseEvent",0}, - { "_wxMDIClientWindow","_class_wxMDIClientWindow",0}, - { "_class_wxFontDialog","_wxFontDialog",0}, - { "_wxWindow","_class_wxWindow",0}, - { "_class_wxFrame","_wxFrame",0}, -{0,0,0}}; - -static PyObject *SWIG_globals; -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT(void) initlseditorc() { - PyObject *m, *d; - SWIG_globals = SWIG_newvarlink(); - m = Py_InitModule("lseditorc", lseditorcMethods); - d = PyModule_GetDict(m); - - - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); - -{ - int i; - for (i = 0; _swig_mapping[i].n1; i++) - SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv); -} -} diff --git a/utils/wxPython/modules/lseditor/gtk/lseditor.py b/utils/wxPython/modules/lseditor/gtk/lseditor.py deleted file mode 100644 index 2d59fbc2f5..0000000000 --- a/utils/wxPython/modules/lseditor/gtk/lseditor.py +++ /dev/null @@ -1,189 +0,0 @@ -# This file was created automatically by SWIG. -import lseditorc - -from misc import * - -from misc2 import * - -from windows import * - -from gdi import * - -from events import * - -from mdi import * - -from frames import * - -from stattool import * - -from controls import * - -from controls2 import * - -from windows2 import * - -from cmndlgs import * - -from windows3 import * - -from image import * - -from printfw import * -import wx -class wxsLSEditorPluginPtr : - def __init__(self,this): - self.this = this - self.thisown = 0 - def __del__(self,lseditorc=lseditorc): - if self.thisown == 1 : - lseditorc.delete_wxsLSEditorPlugin(self) - def Create(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_Create,(self,) + _args, _kwargs) - return val - def OnOpen(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnOpen,(self,) + _args, _kwargs) - return val - def OnSave(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnSave,(self,) + _args, _kwargs) - return val - def OnCopy(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnCopy,(self,) + _args, _kwargs) - return val - def OnCut(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnCut,(self,) + _args, _kwargs) - return val - def OnPaste(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnPaste,(self,) + _args, _kwargs) - return val - def OnDelete(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnDelete,(self,) + _args, _kwargs) - return val - def OnUndo(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnUndo,(self,) + _args, _kwargs) - return val - def OnRedo(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnRedo,(self,) + _args, _kwargs) - return val - def SelectAll(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_SelectAll,(self,) + _args, _kwargs) - return val - def OnGotoLine(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnGotoLine,(self,) + _args, _kwargs) - return val - def OnProperties(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnProperties,(self,) + _args, _kwargs) - return val - def OnFind(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnFind,(self,) + _args, _kwargs) - return val - def OnFindNext(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnFindNext,(self,) + _args, _kwargs) - return val - def OnFindPrevious(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnFindPrevious,(self,) + _args, _kwargs) - return val - def OnReplace(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnReplace,(self,) + _args, _kwargs) - return val - def OnToggleBookmark(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnToggleBookmark,(self,) + _args, _kwargs) - return val - def OnNextBookmark(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnNextBookmark,(self,) + _args, _kwargs) - return val - def OnPreviousBookmark(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnPreviousBookmark,(self,) + _args, _kwargs) - return val - def OnShowBookmarks(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnShowBookmarks,(self,) + _args, _kwargs) - return val - def SetCheckpoint(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_SetCheckpoint,(self,) + _args, _kwargs) - return val - def CheckpointModified(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CheckpointModified,(self,) + _args, _kwargs) - return val - def CanCopy(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CanCopy,(self,) + _args, _kwargs) - return val - def CanCut(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CanCut,(self,) + _args, _kwargs) - return val - def CanPaste(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CanPaste,(self,) + _args, _kwargs) - return val - def CanUndo(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CanUndo,(self,) + _args, _kwargs) - return val - def CanRedo(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CanRedo,(self,) + _args, _kwargs) - return val - def GetName(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetName,(self,) + _args, _kwargs) - return val - def IsModified(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_IsModified,(self,) + _args, _kwargs) - return val - def GetWindow(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetWindow,(self,) + _args, _kwargs) - if val: val = wxWindowPtr(val) - return val - def SetFileName(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_SetFileName,(self,) + _args, _kwargs) - return val - def HoldCursor(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_HoldCursor,(self,) + _args, _kwargs) - return val - def FindWordAtCursor(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_FindWordAtCursor,(self,) + _args, _kwargs) - return val - def GetCursorPos(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetCursorPos,(self,) + _args, _kwargs) - return val - def SetCursorPos(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_SetCursorPos,(self,) + _args, _kwargs) - return val - def GetPagePos(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetPagePos,(self,) + _args, _kwargs) - return val - def GetText(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetText,(self,) + _args, _kwargs) - return val - def InsertText(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_InsertText,(self,) + _args, _kwargs) - return val - def DeleteText(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_DeleteText,(self,) + _args, _kwargs) - return val - def PositionToXY(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_PositionToXY,(self,) + _args, _kwargs) - return val - def GetSelectionRange(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetSelectionRange,(self,) + _args, _kwargs) - return val - def GetCharacterSize(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetCharacterSize,(self,) + _args, _kwargs) - if val: val = wxSizePtr(val) ; val.thisown = 1 - return val - def IsUnixText(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_IsUnixText,(self,) + _args, _kwargs) - return val - def __repr__(self): - return "<C wxsLSEditorPlugin instance at %s>" % (self.this,) -class wxsLSEditorPlugin(wxsLSEditorPluginPtr): - def __init__(self,*_args,**_kwargs): - self.this = apply(lseditorc.new_wxsLSEditorPlugin,_args,_kwargs) - self.thisown = 1 - - - - - - -#-------------- FUNCTION WRAPPERS ------------------ - - - -#-------------- VARIABLE WRAPPERS ------------------ - diff --git a/utils/wxPython/modules/lseditor/lseditor.i b/utils/wxPython/modules/lseditor/lseditor.i deleted file mode 100644 index 19d3641f84..0000000000 --- a/utils/wxPython/modules/lseditor/lseditor.i +++ /dev/null @@ -1,150 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: utils.i -// Purpose: SWIG definitions of various utility classes -// -// Author: Robin Dunn -// -// Created: 25-nov-1998 -// RCS-ID: $Id$ -// Copyright: (c) 1998 by Total Control Software -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - - -%module lseditor - -%{ -#include "helpers.h" -#include "lseditorpl.h" -%} - -//--------------------------------------------------------------------------- - -%include typemaps.i -%include my_typemaps.i - -%extern wx.i -%extern windows.i -%extern windows2.i -%extern windows3.i -%extern frames.i -%extern _defs.i -%extern misc.i -%extern gdi.i -%extern controls.i -%extern events.i - - -%{ -#ifdef SEPARATE - wxString wxPyEmptyStr(""); -#endif -%} - -%pragma(python) code = "import wx" - -//--------------------------------------------------------------------------- - -class wxsLSEditorPlugin -{ -public: - wxsLSEditorPlugin(); - ~wxsLSEditorPlugin(); - - void Create( wxWindow* parent, wxWindowID id ); - - virtual void OnOpen( const char* fname ); - virtual void OnSave( const char* fname ); - - virtual void OnCopy(); - virtual void OnCut(); - virtual void OnPaste(); - virtual void OnDelete(); - - void OnUndo(); - void OnRedo(); - - void SelectAll(); - void OnGotoLine( int lineNo, int column = 0 ); - void OnGotoLine(); - void OnProperties(); - - void OnFind(); - void OnFindNext(); - void OnFindPrevious(); - void OnReplace(); - - virtual void OnToggleBookmark(); - virtual void OnNextBookmark(); - virtual void OnPreviousBookmark(); - virtual void OnShowBookmarks(); - - virtual void SetCheckpoint(); - virtual bool CheckpointModified(); - - // UI-updates - - bool CanCopy(); - bool CanCut(); - bool CanPaste(); - bool CanUndo(); - bool CanRedo(); - - // accesed by framework - - virtual string GetName(){ return "Alex's Language Sensitive Editor"; } - - virtual bool IsModified(); - - virtual wxWindow* GetWindow(); - - //virtual void GetAllText( char** ppBuf, size_t* length ); - - virtual void SetFileName( const char* fname ); - - virtual void HoldCursor( bool hold ); - - //virtual wxsPluginBase* Clone() { return new wxsLSEditorPlugin(); }; - - virtual string FindWordAtCursor(); - - virtual void GetCursorPos( int* line, int* column ); - virtual void SetCursorPos( int line, int column ); - - virtual void GetPagePos( int* line, int* column ); - - virtual void GetText( int fromLine, int fromColumn, - int tillLine, int tillColumn, - char** ppBuf, size_t* length ); - - virtual void InsertText( int line, int column, - char* text, size_t lenght ); - - virtual void DeleteText( int fromLine, int fromColumn, - int tillLine, int tillColumn ); - - virtual void PositionToXY( int line, int column, int* x, int* y ); - - virtual void GetSelectionRange( int* fromLine, int* fromColumn, - int* tillLine, int* tillColumn ); - - virtual wxSize GetCharacterSize(); - - virtual bool IsUnixText(); - - // some extras (just in case..) - - //wxTextEditorModel& GetModel(); - //wxTextEditorView& GetView(); -}; - -//--------------------------------------------------------------------------- - -%init %{ - - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); - -%} - -//--------------------------------------------------------------------------- diff --git a/utils/wxPython/modules/lseditor/lseditorc.def b/utils/wxPython/modules/lseditor/lseditorc.def deleted file mode 100644 index b404f4197d..0000000000 --- a/utils/wxPython/modules/lseditor/lseditorc.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORTS - initlseditorc diff --git a/utils/wxPython/modules/lseditor/lseditorpl.cpp b/utils/wxPython/modules/lseditor/lseditorpl.cpp deleted file mode 100644 index e9fab6a5fb..0000000000 --- a/utils/wxPython/modules/lseditor/lseditorpl.cpp +++ /dev/null @@ -1,344 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: lseditorpl.cpp -// Purpose: Language-sensative editor plugin for wxStudio -// Copyright: (c) Aleksandars Gluchovas -// Modified by: -// Created: 11/04/1999 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: GNU General Public License -///////////////////////////////////////////////////////////////////////////// -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -///////////////////////////////////////////////////////////////////////////// - - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - - -#include "lseditorpl.h" -#include "tdefs.h" - -/***** Impelmentation for class wxsLSEditorPlugin *****/ - -wxsLSEditorPlugin::wxsLSEditorPlugin() - - : mpModel( NULL ), - mpView( NULL ) -{} - -wxsLSEditorPlugin::~wxsLSEditorPlugin() -{ - // view is destroyed by wxWindows along - // with it's owned model -} - -void wxsLSEditorPlugin::Create( wxWindow* parent, wxWindowID id ) -{ - mpModel = new wxTextEditorModel(); - - mpView = new wxTextEditorView( parent, id, mpModel ); - - mpModel->AddView( mpView ); - mpView->Activate(); - - mpView->AddPinPainter( new TBreakpointPainter() ); - - mpView->SyncScrollbars(); -} - -void wxsLSEditorPlugin::OnOpen( const string& fname ) -{ - mpModel->LoadTextFromFile( fname ); - - SetFileName( fname ); -} - -void wxsLSEditorPlugin::OnSave( const string& fname ) -{ - mpModel->SaveTextToFile( fname ); -} - -void wxsLSEditorPlugin::OnCopy() -{ - mpModel->OnCopy(); -} - -void wxsLSEditorPlugin::OnCut() -{ - mpModel->OnCut(); -} - -void wxsLSEditorPlugin::OnPaste() -{ - mpModel->OnPaste(); -} - -void wxsLSEditorPlugin::OnDelete() -{ - mpModel->OnDelete(); -} - -void wxsLSEditorPlugin::OnUndo() -{ - mpModel->OnUndo(); -} - -void wxsLSEditorPlugin::OnRedo() -{ - mpModel->OnRedo(); -} - -void wxsLSEditorPlugin::SelectAll() -{ - mpModel->OnSelectAll(); -} - -void wxsLSEditorPlugin::OnGotoLine() -{ - mpModel->OnGotoLine(); -} - -void wxsLSEditorPlugin::OnGotoLine( int lineNo, int column ) -{ - mpModel->ResetSelection(); - mpModel->OnGotoLine( lineNo, column ); -} - -void wxsLSEditorPlugin::OnProperties() -{ - // not impl. -} - -void wxsLSEditorPlugin::OnFind() -{ - mpModel->OnFind(); -} - -void wxsLSEditorPlugin::OnFindNext() -{ - mpModel->OnFindNext(); -} - -void wxsLSEditorPlugin::OnFindPrevious() -{ - mpModel->OnFindPrevious(); -} - -void wxsLSEditorPlugin::OnReplace() -{ - // not impl. -} - -void wxsLSEditorPlugin::OnToggleBookmark() -{ - mpModel->OnToggleBookmark(); -} - -void wxsLSEditorPlugin::OnNextBookmark() -{ - mpModel->OnNextBookmark(); -} - -void wxsLSEditorPlugin::OnPreviousBookmark() -{ - mpModel->OnPreviousBookmark(); -} - -void wxsLSEditorPlugin::OnShowBookmarks() -{ - // not impl. -} - -void wxsLSEditorPlugin::SetCheckpoint() -{ - mpModel->SetCheckpoint(); -} - -bool wxsLSEditorPlugin::CheckpointModified() -{ - return mpModel->CheckpointModified(); -} - -// UI-updates - -bool wxsLSEditorPlugin::CanCopy() -{ - return mpModel->CanCopy(); -} - -bool wxsLSEditorPlugin::CanCut() -{ - return mpModel->CanCopy(); -} - -bool wxsLSEditorPlugin::CanPaste() -{ - return mpModel->CanPaste(); -} - -bool wxsLSEditorPlugin::CanUndo() -{ - return mpModel->CanUndo(); -} - -bool wxsLSEditorPlugin::CanRedo() -{ - return mpModel->CanRedo(); -} - -// accesed by framework - -bool wxsLSEditorPlugin::IsModified() -{ - return mpModel->IsModified(); -} - -wxWindow* wxsLSEditorPlugin::GetWindow() -{ - return mpView; -} - -void wxsLSEditorPlugin::GetAllText( char** ppBuf, size_t* length ) -{ - mpModel->GetAllText( ppBuf, *length ); -} - -void wxsLSEditorPlugin::SetFileName( const string& fname ) -{ - mFileName = fname; - - if ( mpView ) - - mpView->SetName( fname ); -} - -void wxsLSEditorPlugin::HoldCursor( bool hold ) -{ - mpView->HoldCursor( hold ); -} - -string wxsLSEditorPlugin::FindWordAtCursor() -{ - mpModel->OnSelectWord(); - - char* buf = NULL; size_t len = 0; - - mpModel->GetSelection( &buf, len ); - - if ( buf ) - { - string word = string( buf, 0, len ); - delete [] buf; - return word; - } - else - return ""; -} - -void wxsLSEditorPlugin::GetCursorPos( int* line, int* column ) -{ - TPosition pos = mpModel->GetCursor(); - - *line = (int)pos.mRow; - *column = (int)pos.mCol; -} - -void wxsLSEditorPlugin::SetCursorPos( int line, int column ) -{ - mpModel->OnGotoLine( line, column ); -} - -void wxsLSEditorPlugin::GetPagePos( int* line, int* column ) -{ - TPosition pos = mpView->GetPagePos(); - - *line = pos.mRow; - *column = pos.mCol; -} - -void wxsLSEditorPlugin::GetText( int fromLine, int fromColumn, - int tillLine, int tillColumn, - char** ppBuf, size_t* length ) -{ - mpModel->GetTextFromRange( TPosition( fromLine, fromColumn ), - TPosition( tillLine, tillColumn ), - ppBuf, *length ); -} - -void wxsLSEditorPlugin::InsertText( int line, int column, - char* text, size_t lenght ) -{ - mpModel->InsertText( TPosition( line, column ), - text, lenght ); -} - -void wxsLSEditorPlugin::DeleteText( int fromLine, int fromColumn, - int tillLine, int tillColumn ) -{ - mpModel->DeleteRange( TPosition( fromLine, fromColumn ), - TPosition( tillLine, tillColumn ) ); -} - -void wxsLSEditorPlugin::PositionToXY( int line, int column, int* x, int* y ) -{ - TPosition scrPos; - - mpView->TextPosToScreenPos( TPosition( line, column ), scrPos ); - mpView->ScreenPosToPixels( scrPos, *x, *y ); - - *y += mpView->mCharDim.y; // lower-right corner -} - -void wxsLSEditorPlugin::GetSelectionRange( int* fromLine, int* fromColumn, - int* tillLine, int* tillColumn ) -{ - TPosition start = mpModel->GetStartOfSelection(); - TPosition end = mpModel->GetEndOfSelection(); - - *fromLine = (int)start.mRow; - *fromColumn = (int)start.mCol; - *tillLine = (int)end.mRow; - *tillColumn = (int)end.mCol; -} - -wxSize wxsLSEditorPlugin::GetCharacterSize() -{ - return mpView->GetCharacterSize(); -} - -bool wxsLSEditorPlugin::IsUnixText() -{ - return mpModel->IsUnixText(); -} - -wxTextEditorModel& wxsLSEditorPlugin::GetModel() -{ - return *mpModel; -} - -wxTextEditorView& wxsLSEditorPlugin::GetView() -{ - return *mpView; -} diff --git a/utils/wxPython/modules/lseditor/lseditorpl.h b/utils/wxPython/modules/lseditor/lseditorpl.h deleted file mode 100644 index 6866d0d06d..0000000000 --- a/utils/wxPython/modules/lseditor/lseditorpl.h +++ /dev/null @@ -1,133 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: nativeeditorpl.h -// Purpose: Language-sensative editor plugin for wxStudio -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 11/04/1999 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: GNU General Public License -///////////////////////////////////////////////////////////////////////////// -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -///////////////////////////////////////////////////////////////////////////// - -#ifndef __LSEDITORPL_G__ -#define __LSEDITORPL_G__ - -#include "editorpl.h" - -class wxTextEditorModel; -class wxTextEditorView; - -class wxsLSEditorPlugin : public wxsSourceEditorPlugin -{ -protected: - wxTextEditorModel* mpModel; - wxTextEditorView* mpView; - -public: - wxsLSEditorPlugin(); - ~wxsLSEditorPlugin(); - - void Create( wxWindow* parent, wxWindowID id ); - - virtual void OnOpen( const string& fname ); - virtual void OnSave( const string& fname ); - - virtual void OnCopy(); - virtual void OnCut(); - virtual void OnPaste(); - virtual void OnDelete(); - - void OnUndo(); - void OnRedo(); - - void SelectAll(); - void OnGotoLine( int lineNo, int column = 0 ); - void OnGotoLine(); - void OnProperties(); - - void OnFind(); - void OnFindNext(); - void OnFindPrevious(); - void OnReplace(); - - virtual void OnToggleBookmark(); - virtual void OnNextBookmark(); - virtual void OnPreviousBookmark(); - virtual void OnShowBookmarks(); - - virtual void SetCheckpoint(); - virtual bool CheckpointModified(); - - // UI-updates - - bool CanCopy(); - bool CanCut(); - bool CanPaste(); - bool CanUndo(); - bool CanRedo(); - - // accesed by framework - - virtual string GetName(){ return "Alex's Language Sensitive Editor"; } - - virtual bool IsModified(); - - virtual wxWindow* GetWindow(); - - virtual void GetAllText( char** ppBuf, size_t* length ); - - virtual void SetFileName( const string& fname ); - - virtual void HoldCursor( bool hold ); - - virtual wxsPluginBase* Clone() { return new wxsLSEditorPlugin(); }; - - virtual string FindWordAtCursor(); - - virtual void GetCursorPos( int* line, int* column ); - virtual void SetCursorPos( int line, int column ); - - virtual void GetPagePos( int* line, int* column ); - - virtual void GetText( int fromLine, int fromColumn, - int tillLine, int tillColumn, - char** ppBuf, size_t* length ); - - virtual void InsertText( int line, int column, - char* text, size_t lenght ); - - virtual void DeleteText( int fromLine, int fromColumn, - int tillLine, int tillColumn ); - - virtual void PositionToXY( int line, int column, int* x, int* y ); - - virtual void GetSelectionRange( int* fromLine, int* fromColumn, - int* tillLine, int* tillColumn ); - - virtual wxSize GetCharacterSize(); - - virtual bool IsUnixText(); - - // some extras (just in case..) - - wxTextEditorModel& GetModel(); - wxTextEditorView& GetView(); -}; - -#endif - // __LSEDITORPL_G__ diff --git a/utils/wxPython/modules/lseditor/markup.cpp b/utils/wxPython/modules/lseditor/markup.cpp deleted file mode 100644 index 82306b263b..0000000000 --- a/utils/wxPython/modules/lseditor/markup.cpp +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 22/09/98 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: GNU General Public License -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include "markup.h" - -static TagStructT htmlTags[] = -{ - { "<b>","</b>" }, // 0 - { "<i>","</i>" }, // 1 - { "<pre>","</pre>" }, // 2 - { "<font color=\"#000000\">","</font>" }, // 3 - { "<font color=\"#8F0000\">","</font>" }, // 4 - { "<font color=\"#008F00\">","</font>" }, // 5 - { "<font color=\"#0000CF\">","</font>" }, // 6 - { "<p>","</p>" }, // 7 - { "<br>","" }, // 8 - { "<h1>","</h1>" }, // 9 - { "<h2>","</h2>" }, // 10 - { "<h3>","</h3>" }, // 11 - { "<ul>","</ul>" }, // 12 - { "<li>","</li>" }, // 13 -}; - -MarkupTagsT get_HTML_markup_tags() -{ - return htmlTags; -} diff --git a/utils/wxPython/modules/lseditor/markup.h b/utils/wxPython/modules/lseditor/markup.h deleted file mode 100644 index a9011353ce..0000000000 --- a/utils/wxPython/modules/lseditor/markup.h +++ /dev/null @@ -1,51 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 22/09/98 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: GNU General Public License -///////////////////////////////////////////////////////////////////////////// - -#ifndef __MARKUP_G__ -#define __MARKUP_G__ - -// indicies for the MarkupTagsT array - -#define TAG_BOLD 0 -#define TAG_ITALIC 1 - -#define TAG_FIXED_FONT 2 -#define TAG_BLACK_FONT 3 -#define TAG_RED_FONT 4 -#define TAG_GREEN_FONT 5 -#define TAG_BLUE_FONT 6 - -#define TAG_PARAGRAPH 7 -#define TAG_NEW_LINE 8 -#define TAG_HEADING_1 9 -#define TAG_HEADING_2 10 -#define TAG_HEADING_3 11 - -#define TAG_ITEM_LIST 12 -#define TAG_LIST_ITEM 13 - -struct TagStructT -{ - char* start; // tag that starts style - char* end; // tag that finishes style -}; - -// tag array -typedef TagStructT* MarkupTagsT; - -// returns array of TagStructT with tag strings for HTML - -MarkupTagsT get_HTML_markup_tags(); - -// MarkupTagsT get_PostScript_markup_tags(); -// MarkupTagsT get_Latex_markup_tags(); - -#endif diff --git a/utils/wxPython/modules/lseditor/msw/.cvsignore b/utils/wxPython/modules/lseditor/msw/.cvsignore deleted file mode 100644 index b25c15b81f..0000000000 --- a/utils/wxPython/modules/lseditor/msw/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*~ diff --git a/utils/wxPython/modules/lseditor/msw/lseditor.cpp b/utils/wxPython/modules/lseditor/msw/lseditor.cpp deleted file mode 100644 index 0316145e44..0000000000 --- a/utils/wxPython/modules/lseditor/msw/lseditor.cpp +++ /dev/null @@ -1,1866 +0,0 @@ -/* - * FILE : msw/lseditor.cpp - * - * This file was automatically generated by : - * Simplified Wrapper and Interface Generator (SWIG) - * Version 1.1 (Patch 6) - * - * Portions Copyright (c) 1995-1998 - * The University of Utah and The Regents of the University of California. - * Permission is granted to distribute this file in any manner provided - * this notice remains intact. - * - * Do not make changes to this file--changes will be lost! - * - */ - - -#define SWIGCODE -/* Implementation : PYTHON */ - -#define SWIGPYTHON -#include <string.h> -#include <stdlib.h> -/* Definitions for Windows/Unix exporting */ -#if defined(__WIN32__) -# if defined(_MSC_VER) -# define SWIGEXPORT(a) __declspec(dllexport) a -# else -# if defined(__BORLANDC__) -# define SWIGEXPORT(a) a _export -# else -# define SWIGEXPORT(a) a -# endif -# endif -#else -# define SWIGEXPORT(a) a -#endif - -#ifdef __cplusplus -extern "C" { -#endif -#include "Python.h" -extern void SWIG_MakePtr(char *, void *, char *); -extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *)); -extern char *SWIG_GetPtr(char *, void **, char *); -extern char *SWIG_GetPtrObj(PyObject *, void **, char *); -extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); -extern PyObject *SWIG_newvarlink(void); -#ifdef __cplusplus -} -#endif -#define SWIG_init initlseditorc - -#define SWIG_name "lseditorc" - -#include "helpers.h" -#include "lseditorpl.h" - -static PyObject* l_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyList_Check(target)) { - o2 = target; - target = PyList_New(0); - PyList_Append(target, o2); - Py_XDECREF(o2); - } - PyList_Append(target,o); - Py_XDECREF(o); - } - return target; -} - -static PyObject* t_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyTuple_Check(target)) { - o2 = target; - target = PyTuple_New(1); - PyTuple_SetItem(target, 0, o2); - } - o3 = PyTuple_New(1); - PyTuple_SetItem(o3, 0, o); - - o2 = target; - target = PySequence_Concat(o2, o3); - Py_DECREF(o2); - Py_DECREF(o3); - } - return target; -} - - -extern byte* byte_LIST_helper(PyObject* source); -extern int* int_LIST_helper(PyObject* source); -extern long* long_LIST_helper(PyObject* source); -extern char** string_LIST_helper(PyObject* source); -extern wxPoint* wxPoint_LIST_helper(PyObject* source); -extern wxBitmap** wxBitmap_LIST_helper(PyObject* source); -extern wxString* wxString_LIST_helper(PyObject* source); -extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source); - - -static char* wxStringErrorMsg = "string type is required for parameter"; - -#ifdef SEPARATE - wxString wxPyEmptyStr(""); -#endif -#ifdef __cplusplus -extern "C" { -#endif -#define new_wxsLSEditorPlugin() (new wxsLSEditorPlugin()) -static PyObject *_wrap_new_wxsLSEditorPlugin(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _result; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTuple(args,":new_wxsLSEditorPlugin")) - return NULL; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxsLSEditorPlugin *)new_wxsLSEditorPlugin(); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxsLSEditorPlugin_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define delete_wxsLSEditorPlugin(_swigobj) (delete _swigobj) -static PyObject *_wrap_delete_wxsLSEditorPlugin(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:delete_wxsLSEditorPlugin",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxsLSEditorPlugin. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - delete_wxsLSEditorPlugin(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_Create(_swigobj,_swigarg0,_swigarg1) (_swigobj->Create(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxsLSEditorPlugin_Create(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - wxWindow * _arg1; - wxWindowID _arg2; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"OOi:wxsLSEditorPlugin_Create",&_argo0,&_argo1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_Create. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxsLSEditorPlugin_Create. Expected _wxWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_Create(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnOpen(_swigobj,_swigarg0) (_swigobj->OnOpen(_swigarg0)) -static PyObject *_wrap_wxsLSEditorPlugin_OnOpen(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - char * _arg1; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"Os:wxsLSEditorPlugin_OnOpen",&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnOpen. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnOpen(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnSave(_swigobj,_swigarg0) (_swigobj->OnSave(_swigarg0)) -static PyObject *_wrap_wxsLSEditorPlugin_OnSave(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - char * _arg1; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"Os:wxsLSEditorPlugin_OnSave",&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnSave. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnSave(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnCopy(_swigobj) (_swigobj->OnCopy()) -static PyObject *_wrap_wxsLSEditorPlugin_OnCopy(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnCopy",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnCopy. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnCopy(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnCut(_swigobj) (_swigobj->OnCut()) -static PyObject *_wrap_wxsLSEditorPlugin_OnCut(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnCut",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnCut. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnCut(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnPaste(_swigobj) (_swigobj->OnPaste()) -static PyObject *_wrap_wxsLSEditorPlugin_OnPaste(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnPaste",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnPaste. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnPaste(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnDelete(_swigobj) (_swigobj->OnDelete()) -static PyObject *_wrap_wxsLSEditorPlugin_OnDelete(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnDelete",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnDelete. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnDelete(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnUndo(_swigobj) (_swigobj->OnUndo()) -static PyObject *_wrap_wxsLSEditorPlugin_OnUndo(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnUndo",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnUndo. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnUndo(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnRedo(_swigobj) (_swigobj->OnRedo()) -static PyObject *_wrap_wxsLSEditorPlugin_OnRedo(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnRedo",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnRedo. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnRedo(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_SelectAll(_swigobj) (_swigobj->SelectAll()) -static PyObject *_wrap_wxsLSEditorPlugin_SelectAll(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_SelectAll",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_SelectAll. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_SelectAll(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnGotoLine(_swigobj,_swigarg0,_swigarg1) (_swigobj->OnGotoLine(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxsLSEditorPlugin_OnGotoLine(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2 = (int ) 0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"Oi|i:wxsLSEditorPlugin_OnGotoLine",&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnGotoLine. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnGotoLine(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnProperties(_swigobj) (_swigobj->OnProperties()) -static PyObject *_wrap_wxsLSEditorPlugin_OnProperties(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnProperties",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnProperties. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnProperties(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnFind(_swigobj) (_swigobj->OnFind()) -static PyObject *_wrap_wxsLSEditorPlugin_OnFind(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnFind",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnFind. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnFind(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnFindNext(_swigobj) (_swigobj->OnFindNext()) -static PyObject *_wrap_wxsLSEditorPlugin_OnFindNext(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnFindNext",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnFindNext. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnFindNext(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnFindPrevious(_swigobj) (_swigobj->OnFindPrevious()) -static PyObject *_wrap_wxsLSEditorPlugin_OnFindPrevious(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnFindPrevious",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnFindPrevious. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnFindPrevious(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnReplace(_swigobj) (_swigobj->OnReplace()) -static PyObject *_wrap_wxsLSEditorPlugin_OnReplace(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnReplace",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnReplace. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnReplace(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnToggleBookmark(_swigobj) (_swigobj->OnToggleBookmark()) -static PyObject *_wrap_wxsLSEditorPlugin_OnToggleBookmark(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnToggleBookmark",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnToggleBookmark. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnToggleBookmark(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnNextBookmark(_swigobj) (_swigobj->OnNextBookmark()) -static PyObject *_wrap_wxsLSEditorPlugin_OnNextBookmark(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnNextBookmark",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnNextBookmark. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnNextBookmark(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnPreviousBookmark(_swigobj) (_swigobj->OnPreviousBookmark()) -static PyObject *_wrap_wxsLSEditorPlugin_OnPreviousBookmark(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnPreviousBookmark",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnPreviousBookmark. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnPreviousBookmark(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_OnShowBookmarks(_swigobj) (_swigobj->OnShowBookmarks()) -static PyObject *_wrap_wxsLSEditorPlugin_OnShowBookmarks(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_OnShowBookmarks",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_OnShowBookmarks. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_OnShowBookmarks(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_SetCheckpoint(_swigobj) (_swigobj->SetCheckpoint()) -static PyObject *_wrap_wxsLSEditorPlugin_SetCheckpoint(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_SetCheckpoint",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_SetCheckpoint. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_SetCheckpoint(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_CheckpointModified(_swigobj) (_swigobj->CheckpointModified()) -static PyObject *_wrap_wxsLSEditorPlugin_CheckpointModified(PyObject *self, PyObject *args) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_CheckpointModified",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CheckpointModified. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CheckpointModified(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_CanCopy(_swigobj) (_swigobj->CanCopy()) -static PyObject *_wrap_wxsLSEditorPlugin_CanCopy(PyObject *self, PyObject *args) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_CanCopy",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CanCopy. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CanCopy(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_CanCut(_swigobj) (_swigobj->CanCut()) -static PyObject *_wrap_wxsLSEditorPlugin_CanCut(PyObject *self, PyObject *args) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_CanCut",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CanCut. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CanCut(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_CanPaste(_swigobj) (_swigobj->CanPaste()) -static PyObject *_wrap_wxsLSEditorPlugin_CanPaste(PyObject *self, PyObject *args) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_CanPaste",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CanPaste. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CanPaste(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_CanUndo(_swigobj) (_swigobj->CanUndo()) -static PyObject *_wrap_wxsLSEditorPlugin_CanUndo(PyObject *self, PyObject *args) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_CanUndo",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CanUndo. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CanUndo(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_CanRedo(_swigobj) (_swigobj->CanRedo()) -static PyObject *_wrap_wxsLSEditorPlugin_CanRedo(PyObject *self, PyObject *args) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_CanRedo",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_CanRedo. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_CanRedo(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_GetName(_swigobj) (_swigobj->GetName()) -static PyObject *_wrap_wxsLSEditorPlugin_GetName(PyObject *self, PyObject *args) { - PyObject * _resultobj; - string * _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_GetName",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetName. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new string (wxsLSEditorPlugin_GetName(_arg0)); - - wxPy_END_ALLOW_THREADS; -} SWIG_MakePtr(_ptemp, (void *) _result,"_string_p"); - _resultobj = Py_BuildValue("s",_ptemp); - return _resultobj; -} - -#define wxsLSEditorPlugin_IsModified(_swigobj) (_swigobj->IsModified()) -static PyObject *_wrap_wxsLSEditorPlugin_IsModified(PyObject *self, PyObject *args) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_IsModified",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_IsModified. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_IsModified(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxsLSEditorPlugin_GetWindow(_swigobj) (_swigobj->GetWindow()) -static PyObject *_wrap_wxsLSEditorPlugin_GetWindow(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxWindow * _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_GetWindow",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetWindow. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxWindow *)wxsLSEditorPlugin_GetWindow(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxWindow_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxsLSEditorPlugin_SetFileName(_swigobj,_swigarg0) (_swigobj->SetFileName(_swigarg0)) -static PyObject *_wrap_wxsLSEditorPlugin_SetFileName(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - char * _arg1; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"Os:wxsLSEditorPlugin_SetFileName",&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_SetFileName. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_SetFileName(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_HoldCursor(_swigobj,_swigarg0) (_swigobj->HoldCursor(_swigarg0)) -static PyObject *_wrap_wxsLSEditorPlugin_HoldCursor(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - bool _arg1; - PyObject * _argo0 = 0; - int tempbool1; - - self = self; - if(!PyArg_ParseTuple(args,"Oi:wxsLSEditorPlugin_HoldCursor",&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_HoldCursor. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_HoldCursor(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_FindWordAtCursor(_swigobj) (_swigobj->FindWordAtCursor()) -static PyObject *_wrap_wxsLSEditorPlugin_FindWordAtCursor(PyObject *self, PyObject *args) { - PyObject * _resultobj; - string * _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_FindWordAtCursor",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_FindWordAtCursor. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new string (wxsLSEditorPlugin_FindWordAtCursor(_arg0)); - - wxPy_END_ALLOW_THREADS; -} SWIG_MakePtr(_ptemp, (void *) _result,"_string_p"); - _resultobj = Py_BuildValue("s",_ptemp); - return _resultobj; -} - -#define wxsLSEditorPlugin_GetCursorPos(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetCursorPos(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxsLSEditorPlugin_GetCursorPos(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int * _arg1; - int * _arg2; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"OOO:wxsLSEditorPlugin_GetCursorPos",&_argo0,&_argo1,&_argo2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetCursorPos. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxsLSEditorPlugin_GetCursorPos. Expected _int_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxsLSEditorPlugin_GetCursorPos. Expected _int_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_GetCursorPos(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_SetCursorPos(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetCursorPos(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxsLSEditorPlugin_SetCursorPos(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"Oii:wxsLSEditorPlugin_SetCursorPos",&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_SetCursorPos. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_SetCursorPos(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_GetPagePos(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetPagePos(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxsLSEditorPlugin_GetPagePos(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int * _arg1; - int * _arg2; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"OOO:wxsLSEditorPlugin_GetPagePos",&_argo0,&_argo1,&_argo2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetPagePos. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxsLSEditorPlugin_GetPagePos. Expected _int_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxsLSEditorPlugin_GetPagePos. Expected _int_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_GetPagePos(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_GetText(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (_swigobj->GetText(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) -static PyObject *_wrap_wxsLSEditorPlugin_GetText(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2; - int _arg3; - int _arg4; - char ** _arg5; - size_t * _arg6; - PyObject * _argo0 = 0; - PyObject * _argo5 = 0; - PyObject * _argo6 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"OiiiiOO:wxsLSEditorPlugin_GetText",&_argo0,&_arg1,&_arg2,&_arg3,&_arg4,&_argo5,&_argo6)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetText. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo5) { - if (_argo5 == Py_None) { _arg5 = NULL; } - else if (SWIG_GetPtrObj(_argo5,(void **) &_arg5,"_char_pp")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 6 of wxsLSEditorPlugin_GetText. Expected _char_pp."); - return NULL; - } - } - if (_argo6) { - if (_argo6 == Py_None) { _arg6 = NULL; } - else if (SWIG_GetPtrObj(_argo6,(void **) &_arg6,"_size_t_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 7 of wxsLSEditorPlugin_GetText. Expected _size_t_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_GetText(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_InsertText(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->InsertText(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) -static PyObject *_wrap_wxsLSEditorPlugin_InsertText(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2; - char * _arg3; - size_t _arg4; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"Oiisi:wxsLSEditorPlugin_InsertText",&_argo0,&_arg1,&_arg2,&_arg3,&_arg4)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_InsertText. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_InsertText(_arg0,_arg1,_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_DeleteText(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->DeleteText(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) -static PyObject *_wrap_wxsLSEditorPlugin_DeleteText(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2; - int _arg3; - int _arg4; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"Oiiii:wxsLSEditorPlugin_DeleteText",&_argo0,&_arg1,&_arg2,&_arg3,&_arg4)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_DeleteText. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_DeleteText(_arg0,_arg1,_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_PositionToXY(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->PositionToXY(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) -static PyObject *_wrap_wxsLSEditorPlugin_PositionToXY(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int _arg1; - int _arg2; - int * _arg3; - int * _arg4; - PyObject * _argo0 = 0; - PyObject * _argo3 = 0; - PyObject * _argo4 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"OiiOO:wxsLSEditorPlugin_PositionToXY",&_argo0,&_arg1,&_arg2,&_argo3,&_argo4)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_PositionToXY. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo3) { - if (_argo3 == Py_None) { _arg3 = NULL; } - else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxsLSEditorPlugin_PositionToXY. Expected _int_p."); - return NULL; - } - } - if (_argo4) { - if (_argo4 == Py_None) { _arg4 = NULL; } - else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxsLSEditorPlugin_PositionToXY. Expected _int_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_PositionToXY(_arg0,_arg1,_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_GetSelectionRange(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->GetSelectionRange(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) -static PyObject *_wrap_wxsLSEditorPlugin_GetSelectionRange(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxsLSEditorPlugin * _arg0; - int * _arg1; - int * _arg2; - int * _arg3; - int * _arg4; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - PyObject * _argo3 = 0; - PyObject * _argo4 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"OOOOO:wxsLSEditorPlugin_GetSelectionRange",&_argo0,&_argo1,&_argo2,&_argo3,&_argo4)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetSelectionRange. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxsLSEditorPlugin_GetSelectionRange. Expected _int_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxsLSEditorPlugin_GetSelectionRange. Expected _int_p."); - return NULL; - } - } - if (_argo3) { - if (_argo3 == Py_None) { _arg3 = NULL; } - else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxsLSEditorPlugin_GetSelectionRange. Expected _int_p."); - return NULL; - } - } - if (_argo4) { - if (_argo4 == Py_None) { _arg4 = NULL; } - else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxsLSEditorPlugin_GetSelectionRange. Expected _int_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxsLSEditorPlugin_GetSelectionRange(_arg0,_arg1,_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxsLSEditorPlugin_GetCharacterSize(_swigobj) (_swigobj->GetCharacterSize()) -static PyObject *_wrap_wxsLSEditorPlugin_GetCharacterSize(PyObject *self, PyObject *args) { - PyObject * _resultobj; - wxSize * _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_GetCharacterSize",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_GetCharacterSize. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxSize (wxsLSEditorPlugin_GetCharacterSize(_arg0)); - - wxPy_END_ALLOW_THREADS; -} SWIG_MakePtr(_ptemp, (void *) _result,"_wxSize_p"); - _resultobj = Py_BuildValue("s",_ptemp); - return _resultobj; -} - -#define wxsLSEditorPlugin_IsUnixText(_swigobj) (_swigobj->IsUnixText()) -static PyObject *_wrap_wxsLSEditorPlugin_IsUnixText(PyObject *self, PyObject *args) { - PyObject * _resultobj; - bool _result; - wxsLSEditorPlugin * _arg0; - PyObject * _argo0 = 0; - - self = self; - if(!PyArg_ParseTuple(args,"O:wxsLSEditorPlugin_IsUnixText",&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxsLSEditorPlugin_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxsLSEditorPlugin_IsUnixText. Expected _wxsLSEditorPlugin_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxsLSEditorPlugin_IsUnixText(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -static PyMethodDef lseditorcMethods[] = { - { "wxsLSEditorPlugin_IsUnixText", _wrap_wxsLSEditorPlugin_IsUnixText, METH_VARARGS }, - { "wxsLSEditorPlugin_GetCharacterSize", _wrap_wxsLSEditorPlugin_GetCharacterSize, METH_VARARGS }, - { "wxsLSEditorPlugin_GetSelectionRange", _wrap_wxsLSEditorPlugin_GetSelectionRange, METH_VARARGS }, - { "wxsLSEditorPlugin_PositionToXY", _wrap_wxsLSEditorPlugin_PositionToXY, METH_VARARGS }, - { "wxsLSEditorPlugin_DeleteText", _wrap_wxsLSEditorPlugin_DeleteText, METH_VARARGS }, - { "wxsLSEditorPlugin_InsertText", _wrap_wxsLSEditorPlugin_InsertText, METH_VARARGS }, - { "wxsLSEditorPlugin_GetText", _wrap_wxsLSEditorPlugin_GetText, METH_VARARGS }, - { "wxsLSEditorPlugin_GetPagePos", _wrap_wxsLSEditorPlugin_GetPagePos, METH_VARARGS }, - { "wxsLSEditorPlugin_SetCursorPos", _wrap_wxsLSEditorPlugin_SetCursorPos, METH_VARARGS }, - { "wxsLSEditorPlugin_GetCursorPos", _wrap_wxsLSEditorPlugin_GetCursorPos, METH_VARARGS }, - { "wxsLSEditorPlugin_FindWordAtCursor", _wrap_wxsLSEditorPlugin_FindWordAtCursor, METH_VARARGS }, - { "wxsLSEditorPlugin_HoldCursor", _wrap_wxsLSEditorPlugin_HoldCursor, METH_VARARGS }, - { "wxsLSEditorPlugin_SetFileName", _wrap_wxsLSEditorPlugin_SetFileName, METH_VARARGS }, - { "wxsLSEditorPlugin_GetWindow", _wrap_wxsLSEditorPlugin_GetWindow, METH_VARARGS }, - { "wxsLSEditorPlugin_IsModified", _wrap_wxsLSEditorPlugin_IsModified, METH_VARARGS }, - { "wxsLSEditorPlugin_GetName", _wrap_wxsLSEditorPlugin_GetName, METH_VARARGS }, - { "wxsLSEditorPlugin_CanRedo", _wrap_wxsLSEditorPlugin_CanRedo, METH_VARARGS }, - { "wxsLSEditorPlugin_CanUndo", _wrap_wxsLSEditorPlugin_CanUndo, METH_VARARGS }, - { "wxsLSEditorPlugin_CanPaste", _wrap_wxsLSEditorPlugin_CanPaste, METH_VARARGS }, - { "wxsLSEditorPlugin_CanCut", _wrap_wxsLSEditorPlugin_CanCut, METH_VARARGS }, - { "wxsLSEditorPlugin_CanCopy", _wrap_wxsLSEditorPlugin_CanCopy, METH_VARARGS }, - { "wxsLSEditorPlugin_CheckpointModified", _wrap_wxsLSEditorPlugin_CheckpointModified, METH_VARARGS }, - { "wxsLSEditorPlugin_SetCheckpoint", _wrap_wxsLSEditorPlugin_SetCheckpoint, METH_VARARGS }, - { "wxsLSEditorPlugin_OnShowBookmarks", _wrap_wxsLSEditorPlugin_OnShowBookmarks, METH_VARARGS }, - { "wxsLSEditorPlugin_OnPreviousBookmark", _wrap_wxsLSEditorPlugin_OnPreviousBookmark, METH_VARARGS }, - { "wxsLSEditorPlugin_OnNextBookmark", _wrap_wxsLSEditorPlugin_OnNextBookmark, METH_VARARGS }, - { "wxsLSEditorPlugin_OnToggleBookmark", _wrap_wxsLSEditorPlugin_OnToggleBookmark, METH_VARARGS }, - { "wxsLSEditorPlugin_OnReplace", _wrap_wxsLSEditorPlugin_OnReplace, METH_VARARGS }, - { "wxsLSEditorPlugin_OnFindPrevious", _wrap_wxsLSEditorPlugin_OnFindPrevious, METH_VARARGS }, - { "wxsLSEditorPlugin_OnFindNext", _wrap_wxsLSEditorPlugin_OnFindNext, METH_VARARGS }, - { "wxsLSEditorPlugin_OnFind", _wrap_wxsLSEditorPlugin_OnFind, METH_VARARGS }, - { "wxsLSEditorPlugin_OnProperties", _wrap_wxsLSEditorPlugin_OnProperties, METH_VARARGS }, - { "wxsLSEditorPlugin_OnGotoLine", _wrap_wxsLSEditorPlugin_OnGotoLine, METH_VARARGS }, - { "wxsLSEditorPlugin_SelectAll", _wrap_wxsLSEditorPlugin_SelectAll, METH_VARARGS }, - { "wxsLSEditorPlugin_OnRedo", _wrap_wxsLSEditorPlugin_OnRedo, METH_VARARGS }, - { "wxsLSEditorPlugin_OnUndo", _wrap_wxsLSEditorPlugin_OnUndo, METH_VARARGS }, - { "wxsLSEditorPlugin_OnDelete", _wrap_wxsLSEditorPlugin_OnDelete, METH_VARARGS }, - { "wxsLSEditorPlugin_OnPaste", _wrap_wxsLSEditorPlugin_OnPaste, METH_VARARGS }, - { "wxsLSEditorPlugin_OnCut", _wrap_wxsLSEditorPlugin_OnCut, METH_VARARGS }, - { "wxsLSEditorPlugin_OnCopy", _wrap_wxsLSEditorPlugin_OnCopy, METH_VARARGS }, - { "wxsLSEditorPlugin_OnSave", _wrap_wxsLSEditorPlugin_OnSave, METH_VARARGS }, - { "wxsLSEditorPlugin_OnOpen", _wrap_wxsLSEditorPlugin_OnOpen, METH_VARARGS }, - { "wxsLSEditorPlugin_Create", _wrap_wxsLSEditorPlugin_Create, METH_VARARGS }, - { "delete_wxsLSEditorPlugin", _wrap_delete_wxsLSEditorPlugin, METH_VARARGS }, - { "new_wxsLSEditorPlugin", _wrap_new_wxsLSEditorPlugin, METH_VARARGS }, - { NULL, NULL } -}; -#ifdef __cplusplus -} -#endif -/* - * This table is used by the pointer type-checker - */ -static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { - { "_wxAcceleratorTable","_class_wxAcceleratorTable",0}, - { "_wxEvent","_class_wxEvent",0}, - { "_class_wxActivateEvent","_wxActivateEvent",0}, - { "_signed_long","_long",0}, - { "_wxMenuEvent","_class_wxMenuEvent",0}, - { "_class_wxJPEGHandler","_wxJPEGHandler",0}, - { "_wxBMPHandler","_class_wxBMPHandler",0}, - { "_wxImage","_class_wxImage",0}, - { "_wxPrintQuality","_int",0}, - { "_wxPrintQuality","_signed_int",0}, - { "_wxPrintQuality","_unsigned_int",0}, - { "_wxPrintQuality","_wxWindowID",0}, - { "_wxPrintQuality","_uint",0}, - { "_wxPrintQuality","_EBool",0}, - { "_wxPrintQuality","_size_t",0}, - { "_wxFontData","_class_wxFontData",0}, - { "___wxPyCleanup","_class___wxPyCleanup",0}, - { "_class_wxRegionIterator","_wxRegionIterator",0}, - { "_class_wxMenuBar","_wxMenuBar",0}, - { "_class_wxPyTreeItemData","_wxPyTreeItemData",0}, - { "_wxsLSEditorPlugin","_class_wxsLSEditorPlugin",0}, - { "_class_wxEvtHandler","_wxEvtHandler",0}, - { "_wxPaintEvent","_class_wxPaintEvent",0}, - { "_wxGIFHandler","_class_wxGIFHandler",0}, - { "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0}, - { "_wxCursor","_class_wxCursor",0}, - { "_wxNotifyEvent","_class_wxNotifyEvent",0}, - { "_wxImageHandler","_class_wxImageHandler",0}, - { "_class_wxTreeCtrl","_wxTreeCtrl",0}, - { "_wxMask","_class_wxMask",0}, - { "_wxToolTip","_class_wxToolTip",0}, - { "_wxGrid","_class_wxGrid",0}, - { "_wxPNGHandler","_class_wxPNGHandler",0}, - { "_class_wxColourData","_wxColourData",0}, - { "_class_wxPageSetupDialogData","_wxPageSetupDialogData",0}, - { "_wxPrinter","_class_wxPrinter",0}, - { "_wxPen","_class_wxPen",0}, - { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, - { "_byte","_unsigned_char",0}, - { "_wxStaticBox","_class_wxStaticBox",0}, - { "_wxChoice","_class_wxChoice",0}, - { "_wxSlider","_class_wxSlider",0}, - { "_wxNotebookEvent","_class_wxNotebookEvent",0}, - { "_wxPyPrintout","_class_wxPyPrintout",0}, - { "_long","_wxDash",0}, - { "_long","_unsigned_long",0}, - { "_long","_signed_long",0}, - { "_wxImageList","_class_wxImageList",0}, - { "_wxDropFilesEvent","_class_wxDropFilesEvent",0}, - { "_wxBitmapButton","_class_wxBitmapButton",0}, - { "_wxSashWindow","_class_wxSashWindow",0}, - { "_class_wxPrintDialogData","_wxPrintDialogData",0}, - { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, - { "_class_wxGauge","_wxGauge",0}, - { "_class_wxSashEvent","_wxSashEvent",0}, - { "_wxDC","_class_wxDC",0}, - { "_wxListEvent","_class_wxListEvent",0}, - { "_class_wxSingleChoiceDialog","_wxSingleChoiceDialog",0}, - { "_wxProgressDialog","_class_wxProgressDialog",0}, - { "_class_wxBMPHandler","_wxBMPHandler",0}, - { "_wxPrintPreview","_class_wxPrintPreview",0}, - { "_wxSpinEvent","_class_wxSpinEvent",0}, - { "_wxSashLayoutWindow","_class_wxSashLayoutWindow",0}, - { "_size_t","_wxPrintQuality",0}, - { "_size_t","_unsigned_int",0}, - { "_size_t","_int",0}, - { "_size_t","_wxWindowID",0}, - { "_size_t","_uint",0}, - { "_class_wxRealPoint","_wxRealPoint",0}, - { "_wxPrinterDC","_class_wxPrinterDC",0}, - { "_class_wxMenuItem","_wxMenuItem",0}, - { "_class_wxPaintEvent","_wxPaintEvent",0}, - { "_wxSysColourChangedEvent","_class_wxSysColourChangedEvent",0}, - { "_class_wxStatusBar","_wxStatusBar",0}, - { "_class_wxGIFHandler","_wxGIFHandler",0}, - { "_wxPanel","_class_wxPanel",0}, - { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, - { "_wxCheckBox","_class_wxCheckBox",0}, - { "_wxPyEvent","_class_wxPyEvent",0}, - { "_wxTextCtrl","_class_wxTextCtrl",0}, - { "_class_wxMask","_wxMask",0}, - { "_class_wxToolTip","_wxToolTip",0}, - { "_class_wxKeyEvent","_wxKeyEvent",0}, - { "_class_wxGrid","_wxGrid",0}, - { "_class_wxPNGHandler","_wxPNGHandler",0}, - { "_wxColour","_class_wxColour",0}, - { "_class_wxDialog","_wxDialog",0}, - { "_wxPageSetupDialog","_class_wxPageSetupDialog",0}, - { "_class_wxPrinter","_wxPrinter",0}, - { "_wxIdleEvent","_class_wxIdleEvent",0}, - { "_class_wxUpdateUIEvent","_wxUpdateUIEvent",0}, - { "_wxToolBar","_class_wxToolBar",0}, - { "_wxStaticLine","_class_wxStaticLine",0}, - { "_class_wxLayoutAlgorithm","_wxLayoutAlgorithm",0}, - { "_wxBrush","_class_wxBrush",0}, - { "_wxMiniFrame","_class_wxMiniFrame",0}, - { "_class_wxNotebookEvent","_wxNotebookEvent",0}, - { "_class_wxPyPrintout","_wxPyPrintout",0}, - { "_class_wxSashWindow","_wxSashWindow",0}, - { "_wxShowEvent","_class_wxShowEvent",0}, - { "_uint","_wxPrintQuality",0}, - { "_uint","_size_t",0}, - { "_uint","_unsigned_int",0}, - { "_uint","_int",0}, - { "_uint","_wxWindowID",0}, - { "_class_wxEvent","_wxEvent",0}, - { "_wxCheckListBox","_class_wxCheckListBox",0}, - { "_wxSplitterEvent","_class_wxSplitterEvent",0}, - { "_wxGridEvent","_class_wxGridEvent",0}, - { "_wxRect","_class_wxRect",0}, - { "_wxCommandEvent","_class_wxCommandEvent",0}, - { "_wxSizeEvent","_class_wxSizeEvent",0}, - { "_class_wxImage","_wxImage",0}, - { "_wxPoint","_class_wxPoint",0}, - { "_class_wxSashLayoutWindow","_wxSashLayoutWindow",0}, - { "_class_wxButton","_wxButton",0}, - { "_wxRadioBox","_class_wxRadioBox",0}, - { "_class_wxFontData","_wxFontData",0}, - { "_class___wxPyCleanup","___wxPyCleanup",0}, - { "_wxBitmap","_class_wxBitmap",0}, - { "_wxTaskBarIcon","_class_wxTaskBarIcon",0}, - { "_wxPrintDialog","_class_wxPrintDialog",0}, - { "_wxPyTimer","_class_wxPyTimer",0}, - { "_wxWindowDC","_class_wxWindowDC",0}, - { "_wxScrollBar","_class_wxScrollBar",0}, - { "_wxSpinButton","_class_wxSpinButton",0}, - { "_wxToolBarTool","_class_wxToolBarTool",0}, - { "_wxColourDialog","_class_wxColourDialog",0}, - { "_wxPrintData","_class_wxPrintData",0}, - { "_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0}, - { "_class_wxNotifyEvent","_wxNotifyEvent",0}, - { "_wxMessageDialog","_class_wxMessageDialog",0}, - { "_class_wxPyEvent","_wxPyEvent",0}, - { "_wxTextEntryDialog","_class_wxTextEntryDialog",0}, - { "_class_wxIconizeEvent","_wxIconizeEvent",0}, - { "_class_wxStaticBitmap","_wxStaticBitmap",0}, - { "_wxMDIChildFrame","_class_wxMDIChildFrame",0}, - { "_wxListItem","_class_wxListItem",0}, - { "_class_wxToolBar","_wxToolBar",0}, - { "_class_wxStaticLine","_wxStaticLine",0}, - { "_wxScrollEvent","_class_wxScrollEvent",0}, - { "_wxCalculateLayoutEvent","_class_wxCalculateLayoutEvent",0}, - { "_EBool","_wxPrintQuality",0}, - { "_EBool","_signed_int",0}, - { "_EBool","_int",0}, - { "_EBool","_wxWindowID",0}, - { "_class_wxRegion","_wxRegion",0}, - { "_class_wxDropFilesEvent","_wxDropFilesEvent",0}, - { "_class_wxPreviewFrame","_wxPreviewFrame",0}, - { "_wxStaticText","_class_wxStaticText",0}, - { "_wxFont","_class_wxFont",0}, - { "_wxCloseEvent","_class_wxCloseEvent",0}, - { "_class_wxSplitterEvent","_wxSplitterEvent",0}, - { "_wxNotebook","_class_wxNotebook",0}, - { "_unsigned_long","_wxDash",0}, - { "_unsigned_long","_long",0}, - { "_class_wxRect","_wxRect",0}, - { "_class_wxDC","_wxDC",0}, - { "_class_wxProgressDialog","_wxProgressDialog",0}, - { "_wxPyApp","_class_wxPyApp",0}, - { "_wxMDIParentFrame","_class_wxMDIParentFrame",0}, - { "_class_wxTreeEvent","_wxTreeEvent",0}, - { "_class_wxDirDialog","_wxDirDialog",0}, - { "_class_wxPyTimer","_wxPyTimer",0}, - { "_wxFocusEvent","_class_wxFocusEvent",0}, - { "_wxMaximizeEvent","_class_wxMaximizeEvent",0}, - { "_class_wxSpinButton","_wxSpinButton",0}, - { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, - { "_class_wxPanel","_wxPanel",0}, - { "_class_wxCheckBox","_wxCheckBox",0}, - { "_wxComboBox","_class_wxComboBox",0}, - { "_wxRadioButton","_class_wxRadioButton",0}, - { "_class_wxMessageDialog","_wxMessageDialog",0}, - { "_signed_int","_wxPrintQuality",0}, - { "_signed_int","_EBool",0}, - { "_signed_int","_wxWindowID",0}, - { "_signed_int","_int",0}, - { "_class_wxTextCtrl","_wxTextCtrl",0}, - { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, - { "_wxMetaFileDC","_class_wxMetaFileDC",0}, - { "_wxMenu","_class_wxMenu",0}, - { "_class_wxMoveEvent","_wxMoveEvent",0}, - { "_wxListBox","_class_wxListBox",0}, - { "_wxScreenDC","_class_wxScreenDC",0}, - { "_class_wxMDIChildFrame","_wxMDIChildFrame",0}, - { "_WXTYPE","_short",0}, - { "_WXTYPE","_signed_short",0}, - { "_WXTYPE","_unsigned_short",0}, - { "_wxFileDialog","_class_wxFileDialog",0}, - { "_class_wxMDIClientWindow","_wxMDIClientWindow",0}, - { "_class_wxBrush","_wxBrush",0}, - { "_unsigned_short","_WXTYPE",0}, - { "_unsigned_short","_short",0}, - { "_class_wxWindow","_wxWindow",0}, - { "_wxSplitterWindow","_class_wxSplitterWindow",0}, - { "_class_wxStaticText","_wxStaticText",0}, - { "_wxPrintDialogData","_class_wxPrintDialogData",0}, - { "_class_wxFont","_wxFont",0}, - { "_class_wxCloseEvent","_wxCloseEvent",0}, - { "_wxSashEvent","_class_wxSashEvent",0}, - { "_class_wxMenuEvent","_wxMenuEvent",0}, - { "_wxClientDC","_class_wxClientDC",0}, - { "_wxMouseEvent","_class_wxMouseEvent",0}, - { "_wxListCtrl","_class_wxListCtrl",0}, - { "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0}, - { "_class_wxPoint","_wxPoint",0}, - { "_wxRealPoint","_class_wxRealPoint",0}, - { "_class_wxRadioBox","_wxRadioBox",0}, - { "_wxGridCell","_class_wxGridCell",0}, - { "_signed_short","_WXTYPE",0}, - { "_signed_short","_short",0}, - { "_wxMemoryDC","_class_wxMemoryDC",0}, - { "_class_wxTaskBarIcon","_wxTaskBarIcon",0}, - { "_class_wxPrintDialog","_wxPrintDialog",0}, - { "_class_wxsLSEditorPlugin","_wxsLSEditorPlugin",0}, - { "_wxPaintDC","_class_wxPaintDC",0}, - { "_class_wxWindowDC","_wxWindowDC",0}, - { "_class_wxFocusEvent","_wxFocusEvent",0}, - { "_class_wxMaximizeEvent","_wxMaximizeEvent",0}, - { "_wxStatusBar","_class_wxStatusBar",0}, - { "_class_wxToolBarTool","_wxToolBarTool",0}, - { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, - { "_class_wxCursor","_wxCursor",0}, - { "_class_wxImageHandler","_wxImageHandler",0}, - { "_wxScrolledWindow","_class_wxScrolledWindow",0}, - { "_wxTreeItemId","_class_wxTreeItemId",0}, - { "_unsigned_char","_byte",0}, - { "_class_wxMetaFileDC","_wxMetaFileDC",0}, - { "_class_wxMenu","_wxMenu",0}, - { "_wxControl","_class_wxControl",0}, - { "_class_wxListBox","_wxListBox",0}, - { "_unsigned_int","_wxPrintQuality",0}, - { "_unsigned_int","_size_t",0}, - { "_unsigned_int","_uint",0}, - { "_unsigned_int","_wxWindowID",0}, - { "_unsigned_int","_int",0}, - { "_wxIcon","_class_wxIcon",0}, - { "_wxDialog","_class_wxDialog",0}, - { "_class_wxListItem","_wxListItem",0}, - { "_class_wxPen","_wxPen",0}, - { "_class_wxFileDialog","_wxFileDialog",0}, - { "_wxQueryLayoutInfoEvent","_class_wxQueryLayoutInfoEvent",0}, - { "_short","_WXTYPE",0}, - { "_short","_unsigned_short",0}, - { "_short","_signed_short",0}, - { "_class_wxStaticBox","_wxStaticBox",0}, - { "_wxLayoutAlgorithm","_class_wxLayoutAlgorithm",0}, - { "_class_wxScrollEvent","_wxScrollEvent",0}, - { "_wxJoystickEvent","_class_wxJoystickEvent",0}, - { "_class_wxChoice","_wxChoice",0}, - { "_class_wxSlider","_wxSlider",0}, - { "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0}, - { "_class_wxImageList","_wxImageList",0}, - { "_class_wxBitmapButton","_wxBitmapButton",0}, - { "_wxFrame","_class_wxFrame",0}, - { "_class_wxNotebook","_wxNotebook",0}, - { "_wxJPEGHandler","_class_wxJPEGHandler",0}, - { "_wxWindowID","_wxPrintQuality",0}, - { "_wxWindowID","_size_t",0}, - { "_wxWindowID","_EBool",0}, - { "_wxWindowID","_uint",0}, - { "_wxWindowID","_int",0}, - { "_wxWindowID","_signed_int",0}, - { "_wxWindowID","_unsigned_int",0}, - { "_int","_wxPrintQuality",0}, - { "_int","_size_t",0}, - { "_int","_EBool",0}, - { "_int","_uint",0}, - { "_int","_wxWindowID",0}, - { "_int","_unsigned_int",0}, - { "_int","_signed_int",0}, - { "_class_wxMouseEvent","_wxMouseEvent",0}, - { "_class_wxListEvent","_wxListEvent",0}, - { "_class_wxPrintPreview","_wxPrintPreview",0}, - { "_class_wxSpinEvent","_wxSpinEvent",0}, - { "_wxButton","_class_wxButton",0}, - { "_class_wxPyApp","_wxPyApp",0}, - { "_wxSize","_class_wxSize",0}, - { "_wxRegionIterator","_class_wxRegionIterator",0}, - { "_class_wxPrinterDC","_wxPrinterDC",0}, - { "_class_wxMDIParentFrame","_wxMDIParentFrame",0}, - { "_wxPyTreeItemData","_class_wxPyTreeItemData",0}, - { "_class_wxPaintDC","_wxPaintDC",0}, - { "_class_wxSysColourChangedEvent","_wxSysColourChangedEvent",0}, - { "_class_wxInitDialogEvent","_wxInitDialogEvent",0}, - { "_class_wxComboBox","_wxComboBox",0}, - { "_class_wxRadioButton","_wxRadioButton",0}, - { "_class_wxTreeItemId","_wxTreeItemId",0}, - { "_wxTreeCtrl","_class_wxTreeCtrl",0}, - { "_class_wxLayoutConstraints","_wxLayoutConstraints",0}, - { "_wxIconizeEvent","_class_wxIconizeEvent",0}, - { "_class_wxControl","_wxControl",0}, - { "_wxStaticBitmap","_class_wxStaticBitmap",0}, - { "_class_wxIcon","_wxIcon",0}, - { "_class_wxColour","_wxColour",0}, - { "_class_wxScreenDC","_wxScreenDC",0}, - { "_class_wxPageSetupDialog","_wxPageSetupDialog",0}, - { "_wxPalette","_class_wxPalette",0}, - { "_class_wxIdleEvent","_wxIdleEvent",0}, - { "_wxEraseEvent","_class_wxEraseEvent",0}, - { "_class_wxJoystickEvent","_wxJoystickEvent",0}, - { "_class_wxMiniFrame","_wxMiniFrame",0}, - { "_wxFontDialog","_class_wxFontDialog",0}, - { "_wxRegion","_class_wxRegion",0}, - { "_class_wxSplitterWindow","_wxSplitterWindow",0}, - { "_wxPreviewFrame","_class_wxPreviewFrame",0}, - { "_class_wxShowEvent","_wxShowEvent",0}, - { "_wxActivateEvent","_class_wxActivateEvent",0}, - { "_wxGauge","_class_wxGauge",0}, - { "_class_wxCheckListBox","_wxCheckListBox",0}, - { "_class_wxGridEvent","_wxGridEvent",0}, - { "_class_wxCommandEvent","_wxCommandEvent",0}, - { "_class_wxClientDC","_wxClientDC",0}, - { "_class_wxSizeEvent","_wxSizeEvent",0}, - { "_class_wxListCtrl","_wxListCtrl",0}, - { "_class_wxGridCell","_wxGridCell",0}, - { "_class_wxSize","_wxSize",0}, - { "_class_wxBitmap","_wxBitmap",0}, - { "_class_wxMemoryDC","_wxMemoryDC",0}, - { "_wxMenuBar","_class_wxMenuBar",0}, - { "_wxTreeEvent","_class_wxTreeEvent",0}, - { "_wxDirDialog","_class_wxDirDialog",0}, - { "_wxEvtHandler","_class_wxEvtHandler",0}, - { "_wxMenuItem","_class_wxMenuItem",0}, - { "_class_wxScrollBar","_wxScrollBar",0}, - { "_class_wxColourDialog","_wxColourDialog",0}, - { "_class_wxPrintData","_wxPrintData",0}, - { "_wxDash","_unsigned_long",0}, - { "_wxDash","_long",0}, - { "_class_wxScrolledWindow","_wxScrolledWindow",0}, - { "_class_wxTextEntryDialog","_wxTextEntryDialog",0}, - { "_wxKeyEvent","_class_wxKeyEvent",0}, - { "_wxMoveEvent","_class_wxMoveEvent",0}, - { "_wxColourData","_class_wxColourData",0}, - { "_wxPageSetupDialogData","_class_wxPageSetupDialogData",0}, - { "_class_wxPalette","_wxPalette",0}, - { "_class_wxQueryLayoutInfoEvent","_wxQueryLayoutInfoEvent",0}, - { "_class_wxEraseEvent","_wxEraseEvent",0}, - { "_wxMDIClientWindow","_class_wxMDIClientWindow",0}, - { "_class_wxFontDialog","_wxFontDialog",0}, - { "_wxWindow","_class_wxWindow",0}, - { "_class_wxFrame","_wxFrame",0}, -{0,0,0}}; - -static PyObject *SWIG_globals; -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT(void) initlseditorc() { - PyObject *m, *d; - SWIG_globals = SWIG_newvarlink(); - m = Py_InitModule("lseditorc", lseditorcMethods); - d = PyModule_GetDict(m); - - - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); - -{ - int i; - for (i = 0; _swig_mapping[i].n1; i++) - SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv); -} -} diff --git a/utils/wxPython/modules/lseditor/msw/lseditor.py b/utils/wxPython/modules/lseditor/msw/lseditor.py deleted file mode 100644 index 2d59fbc2f5..0000000000 --- a/utils/wxPython/modules/lseditor/msw/lseditor.py +++ /dev/null @@ -1,189 +0,0 @@ -# This file was created automatically by SWIG. -import lseditorc - -from misc import * - -from misc2 import * - -from windows import * - -from gdi import * - -from events import * - -from mdi import * - -from frames import * - -from stattool import * - -from controls import * - -from controls2 import * - -from windows2 import * - -from cmndlgs import * - -from windows3 import * - -from image import * - -from printfw import * -import wx -class wxsLSEditorPluginPtr : - def __init__(self,this): - self.this = this - self.thisown = 0 - def __del__(self,lseditorc=lseditorc): - if self.thisown == 1 : - lseditorc.delete_wxsLSEditorPlugin(self) - def Create(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_Create,(self,) + _args, _kwargs) - return val - def OnOpen(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnOpen,(self,) + _args, _kwargs) - return val - def OnSave(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnSave,(self,) + _args, _kwargs) - return val - def OnCopy(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnCopy,(self,) + _args, _kwargs) - return val - def OnCut(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnCut,(self,) + _args, _kwargs) - return val - def OnPaste(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnPaste,(self,) + _args, _kwargs) - return val - def OnDelete(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnDelete,(self,) + _args, _kwargs) - return val - def OnUndo(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnUndo,(self,) + _args, _kwargs) - return val - def OnRedo(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnRedo,(self,) + _args, _kwargs) - return val - def SelectAll(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_SelectAll,(self,) + _args, _kwargs) - return val - def OnGotoLine(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnGotoLine,(self,) + _args, _kwargs) - return val - def OnProperties(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnProperties,(self,) + _args, _kwargs) - return val - def OnFind(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnFind,(self,) + _args, _kwargs) - return val - def OnFindNext(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnFindNext,(self,) + _args, _kwargs) - return val - def OnFindPrevious(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnFindPrevious,(self,) + _args, _kwargs) - return val - def OnReplace(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnReplace,(self,) + _args, _kwargs) - return val - def OnToggleBookmark(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnToggleBookmark,(self,) + _args, _kwargs) - return val - def OnNextBookmark(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnNextBookmark,(self,) + _args, _kwargs) - return val - def OnPreviousBookmark(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnPreviousBookmark,(self,) + _args, _kwargs) - return val - def OnShowBookmarks(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_OnShowBookmarks,(self,) + _args, _kwargs) - return val - def SetCheckpoint(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_SetCheckpoint,(self,) + _args, _kwargs) - return val - def CheckpointModified(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CheckpointModified,(self,) + _args, _kwargs) - return val - def CanCopy(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CanCopy,(self,) + _args, _kwargs) - return val - def CanCut(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CanCut,(self,) + _args, _kwargs) - return val - def CanPaste(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CanPaste,(self,) + _args, _kwargs) - return val - def CanUndo(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CanUndo,(self,) + _args, _kwargs) - return val - def CanRedo(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_CanRedo,(self,) + _args, _kwargs) - return val - def GetName(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetName,(self,) + _args, _kwargs) - return val - def IsModified(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_IsModified,(self,) + _args, _kwargs) - return val - def GetWindow(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetWindow,(self,) + _args, _kwargs) - if val: val = wxWindowPtr(val) - return val - def SetFileName(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_SetFileName,(self,) + _args, _kwargs) - return val - def HoldCursor(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_HoldCursor,(self,) + _args, _kwargs) - return val - def FindWordAtCursor(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_FindWordAtCursor,(self,) + _args, _kwargs) - return val - def GetCursorPos(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetCursorPos,(self,) + _args, _kwargs) - return val - def SetCursorPos(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_SetCursorPos,(self,) + _args, _kwargs) - return val - def GetPagePos(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetPagePos,(self,) + _args, _kwargs) - return val - def GetText(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetText,(self,) + _args, _kwargs) - return val - def InsertText(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_InsertText,(self,) + _args, _kwargs) - return val - def DeleteText(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_DeleteText,(self,) + _args, _kwargs) - return val - def PositionToXY(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_PositionToXY,(self,) + _args, _kwargs) - return val - def GetSelectionRange(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetSelectionRange,(self,) + _args, _kwargs) - return val - def GetCharacterSize(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_GetCharacterSize,(self,) + _args, _kwargs) - if val: val = wxSizePtr(val) ; val.thisown = 1 - return val - def IsUnixText(self, *_args, **_kwargs): - val = apply(lseditorc.wxsLSEditorPlugin_IsUnixText,(self,) + _args, _kwargs) - return val - def __repr__(self): - return "<C wxsLSEditorPlugin instance at %s>" % (self.this,) -class wxsLSEditorPlugin(wxsLSEditorPluginPtr): - def __init__(self,*_args,**_kwargs): - self.this = apply(lseditorc.new_wxsLSEditorPlugin,_args,_kwargs) - self.thisown = 1 - - - - - - -#-------------- FUNCTION WRAPPERS ------------------ - - - -#-------------- VARIABLE WRAPPERS ------------------ - diff --git a/utils/wxPython/modules/lseditor/plugin.cpp b/utils/wxPython/modules/lseditor/plugin.cpp deleted file mode 100644 index a6f29627f1..0000000000 --- a/utils/wxPython/modules/lseditor/plugin.cpp +++ /dev/null @@ -1,58 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wxsplbase.cpp -// Purpose: General interfaces for all plug-ins in wxStudio -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 11/04/1999 -// RCS-ID: $Id$ -// Copyright: (c) Aleksandars Gluchovas -// Licence: GNU General Public License wxWindows licence v2.0 -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include "plugin.h" - -/***** Implementation for class wxStudioPluginManager *****/ - -void wxsPluginManager::RegisterMenuCommand( const wxString& itemName, - const wxString& menuName, - int id, - wxsPluginBase* forPlugin ) -{ - // TBD:: -} - -void wxsPluginManager::UnregisterPlugin( wxsPluginBase* plugin ) -{ - // TBD:: -} - -/***** Implementation for class wxStudioPluginBase *****/ - -wxsPluginBase::wxsPluginBase() -{} - -wxsPluginBase::~wxsPluginBase() -{} - - -wxsPluginManager& wxsPluginBase::GetPluginManager() -{ - wxASSERT( mpPluginMgr ); - return *mpPluginMgr; -} - -void wxsPluginBase::SetPluginManager( wxsPluginManager* pMgr ) -{ - mpPluginMgr = pMgr; -} diff --git a/utils/wxPython/modules/lseditor/plugin.h b/utils/wxPython/modules/lseditor/plugin.h deleted file mode 100644 index 98781e4690..0000000000 --- a/utils/wxPython/modules/lseditor/plugin.h +++ /dev/null @@ -1,98 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wxsplbase.h -// Purpose: General interfaces for all plug-ins in wxStudio -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 11/04/1999 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: GNU General Public License wxWindows licence v2.0 -///////////////////////////////////////////////////////////////////////////// - -#ifndef __PLUGIN_G__ -#define __PLUGIN_G__ - -#include "wxstldefs.h" -#include "wxsdefs.h" - -class wxsPluginBase; -typedef wxsPluginBase* wxsPluginBasePtrT; -#ifdef wxUSE_TEMPLATE_STL -typedef vector<wxsPluginBasePtrT> wxsPluginListT; -#else -typedef WXSTL_VECTOR_SHALLOW_COPY(wxsPluginBasePtrT) wxsPluginListT; -#endif - - -class wxsPluginManager : public wxObject -{ -public: - - wxsPluginListT& GetPlugins(); - - // allows to present plugin-specific features - // as items in the menu-bar - - void RegisterMenuCommand( const string& itemName, - const string& menuName, - int id, - wxsPluginBase* forPlugin ); - - // should be called by plugin, when it's being destroyed - - void UnregisterPlugin( wxsPluginBase* plugin ); -}; - - - -// Used by create settings panel: -enum { - WXS_SETTINGS_GLOBAL, - WXS_SETTINGS_PROJECT -}; - - -class wxsPluginBase : public wxObject -{ -protected: - wxsPluginManager* mpPluginMgr; - -public: - - wxsPluginBase(); - virtual ~wxsPluginBase(); - - virtual void InitPlugin() {} - - // utilities - - wxsPluginManager& GetPluginManager(); - void SetPluginManager( wxsPluginManager* mgr ); - - // overridables - - // Current Types = UNKNOWN,EDITOR,CLASSBROWSER,FILEBROWSER,CLASSINFO,TOOL - virtual WXS_PLUGIN_TYPE GetType() = 0; - virtual string GetCategory() = 0; - - virtual string GetName() = 0; - // will return a help panel - virtual wxWindow* CreateSettingsPanel(wxWindow *parent, int type) {return NULL;} - virtual wxsPluginBase* Clone() = 0; - - virtual string Command( const string& name, const string& args ) - - { return "NO_SUPPORTED"; } -}; - -// base clas for all plugins which are presented as windows - -class wxsComponent : public wxsPluginBase -{ -public: - virtual void Create( wxWindow* parent, wxWindowID id ) = 0; - virtual wxWindow* GetWindow() = 0; -}; - -#endif - // __PLUGIN_G__ diff --git a/utils/wxPython/modules/lseditor/sourcepainter.cpp b/utils/wxPython/modules/lseditor/sourcepainter.cpp deleted file mode 100644 index bd54eef49d..0000000000 --- a/utils/wxPython/modules/lseditor/sourcepainter.cpp +++ /dev/null @@ -1,696 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 22/09/98 -// RCS-ID: $Id$ -// Copyright: (c) Aleksandars Gluchovas -// Licence: GNU General Public License -///////////////////////////////////////////////////////////////////////////// -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -///////////////////////////////////////////////////////////////////////////// - - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include "config.h" - -#if defined( wxUSE_TEMPLATE_STL ) - - #include <map> - using namespace std; -#else - - #include <wxstlac.h> - -#endif - -#include "sourcepainter.h" - -const int MAX_KEYWORD_LEN = 16; - -struct KeywordT -{ - char keyWord[MAX_KEYWORD_LEN]; - int rank; -}; - -// source fragment ranks : - -// 0 - nomral text -// 1 - basic types -// 2 - reserved words - -// multil-language keywords map - -static KeywordT __gKeyWords[] = -{ - { "for", 1 }, - { "FOR", 1 }, - { "For", 1 }, - - { "next", 1 }, - { "Next", 1 }, - { "NEXT", 1 }, - - { "if", 1 }, - { "If", 1 }, - { "IF", 1 }, - - { "then", 1 }, - { "Then", 1 }, - { "THEN", 1 }, - - { "else", 1 }, - { "Else", 1 }, - { "ELSE", 1 }, - - { "do", 1 }, - { "Do", 1 }, - { "DO", 1 }, - - - { "break", 1 }, - { "Break", 1 }, - { "BREAK", 1 }, - - { "continue", 1 }, - - { "goto", 1 }, - { "Goto", 1 }, - { "GOTO", 1 }, - - { "switch", 1 }, - { "default", 1 }, - { "case", 1 }, - - { "repeat", 1 }, - { "Repeat", 1 }, - { "REPEAT", 1 }, - - { "until", 1 }, - { "Until", 1 }, - { "UNTIL", 1 }, - - { "return", 1 }, - { "Return", 1 }, - { "RETURN", 1 }, - - { "unit", 1 }, - { "Unit", 1 }, - { "UNIT", 1 }, - - { "procedure", 1 }, - { "Procedure", 1 }, - { "PROCEDURE", 1 }, - - { "function", 1 }, - { "Function", 1 }, - { "FUNCTION", 1 }, - - { "begin", 1 }, - { "Begin", 1 }, - { "BEGIN", 1 }, - - { "End", 1 }, - { "END", 1 }, - - //////////////////////////////////////////////////// - - { "enum", 1 }, - { "static", 1 }, - { "const", 1 }, - { "mutable", 1 }, - { "volatile", 1 }, - { "__asm", 1 }, - { "asm", 1 }, - - { "typeid", 1 }, - { "sizeof", 1 }, - { "typeof", 1 }, - - - { "native", 1 }, - - { "#include", 1 }, - { "#define", 1 }, - { "#def", 1 }, - { "#undef", 1 }, - { "#ifdef", 1 }, - { "#ifndef", 1 }, - { "#if", 1 }, - { "#endif", 1 }, - { "#elif", 1 }, - { "#else", 1 }, - { "#pragma", 1 }, - { "#line", 1 }, - - { "package", 1 }, - { "import", 1 }, - { "export", 1 }, - - //////////////////////////////////////////////////// - - { "dynamic_cast", 1 }, - { "const_cast", 1 }, - - //////// some hacks for VB ///////// - - { "sub", 1 }, - { "Sub", 1 }, - { "SUB", 1 }, - { "as", 1 }, - { "As", 1 }, - { "AS", 1 }, - - /////// data types /////// - - { "int" , 1 }, - { "integer", 1 }, - { "Integer", 1 }, - { "INTEGER", 1 }, - - { "real", 1 }, - { "Real", 1 }, - { "REAL", 1 }, - - { "float", 1 }, - { "Float", 1 }, - { "FLOAT", 1 }, - - { "char", 1 }, - { "Char", 1 }, - { "CHAR", 1 }, - - { "register", 1 }, - - { "string", 1 }, - { "String", 1 }, - { "STRING", 1 }, - - { "array", 1 }, - { "Array", 1 }, - { "ARRAY", 1 }, - - { "packed", 1 }, - { "Packed", 1 }, - { "PACKED", 1 }, - - { "property", 1 }, - { "Property", 1 }, - { "PROPERTY", 1 }, - - { "unsigned", 1 }, - - { "long", 1 }, - { "double", 1 }, - { "short", 1 }, - { "bool", 1 }, - - { "longint", 1 }, - { "Longint", 1 }, - { "LONGINT", 1 }, - - { "extended", 1 }, - { "Extended", 1 }, - { "EXTENTED", 1 }, - - { "pointer", 1 }, - { "Pointer", 1 }, - { "POINTER", 1 }, - - { "and", 1 }, - { "And", 1 }, - { "AND", 1 }, - { "or", 1 }, - { "Or", 1 }, - { "OR", 1 }, - { "xor", 1 }, - { "Xor", 1 }, - { "XOR", 1 }, - - { "void", 1 }, - { "__stdcall", 1 }, - { "__declspec", 1 }, - { "extern", 1 }, - { "stdcall", 1 }, - { "dllimport", 1 }, - { "dllexport", 1 }, - { "__cdecl", 1 }, - { "cdecl", 1 }, - { "template", 1 }, - { "typedef", 1 }, - { "naked", 1 }, - - { "try", 1 }, - { "catch", 1 }, - { "throw", 2 }, // C++ - { "throws", 1 }, // Java - - - { "finalize", 1 }, - - // "STL-suport" - - { "size_t", 1 }, - { "NPOS", 1 }, - { "vector", 1 }, - { "list", 1 }, - { "map", 1 }, - { "multimap", 1 }, - - { "external", 1 }, - { "External", 1 }, - { "EXTERNAL", 1 }, - - //////////// meta-information ////////////// - - { "virtual", 2 }, - { "Virtual", 2 }, - - { "override", 2 }, - { "Override", 2 }, - - { "class", 2 }, - { "Class", 2 }, - { "CLASS", 2 }, - - { "struct", 2 }, - { "union", 2 }, - - { "record", 2 }, - { "Record", 2 }, - { "RECORD", 2 }, - - { "form", 1 }, - { "Form", 1 }, - { "FORM", 1 }, - - { "namespace", 2 }, - - { "interface" , 2 }, - { "abstract", 2 }, - - { "Interface" , 2 }, - { "INTERFACE" , 2 }, - - { "implementation", 2 }, - { "Implementation", 2 }, - { "IMPLEMENTATION", 2 }, - - { "label", 2 }, - { "Label", 2 }, - { "LABEL", 2 }, - - { "implements", 2 }, - { "extends", 2 }, - - { "public", 2 }, - { "private", 2 }, - { "protected", 2 }, - - { "this", 1 }, - { "This", 1 }, - { "THIS", 1 }, - - { "new", 1 }, - { "New", 1 }, - { "NEW", 1 }, - - { "delete", 2 }, - { "inline", 2 }, - - { "operator", 1 }, - - { "Inherited", 2 }, - { "Inherited", 2 }, - - { "final", 2 }, - { "implements", 2 }, - { "super", 2 }, - - // even more... - { "java", 2 }, - { "Java", 2 }, - { "JAVA", 2 }, - { "delphi", 2 }, - { "Delphi", 2 }, - { "SmallTalk", 2 }, - { "Smalltalk", 2 }, - { "smalltalk", 2 }, - { "assembler", 2 }, - { "Assembler", 2 }, - { "Basic", 2 }, - { "BASIC", 2 }, - { "basic", 2 }, - { "CORBA", 2 }, - { "COBOL", 2 }, - { "ADA", 2 }, - { "LISP", 2 }, - - // just for fun... - { "life", 2 }, - { "sucks", 2 }, - { "rules", 2 }, - { "Quake", 2 }, - { "QuakeWorld", 2 }, - { "[ag_slammer]",2 }, - { "Aleksandras", 2 }, - { "Gluchovas" , 2 }, - { "Alex", 2 }, - { "alex", 2 }, - { "aleks", 2 }, - { "aleksas", 3 }, - { "AlexSoft", 2 }, - { "Alexsoft", 2 }, - { "SpringSky", 2 }, - { "SK_Team", 2 }, - { "soften", 2 }, - { "UB40", 2 }, - { "U96", 2 } -}; - -struct less_c_str -{ - inline bool operator()( char* x, char* y) const - { return ( strcmp( x,y ) < 0 ); - } -}; - -#if defined( wxUSE_TEMPLATE_STL ) - - typedef map< char*, char*, less_c_str > KeywordMapT; - -#else - - typedef char* CharPtrT; - typedef WXSTL_MAP( CharPtrT, CharPtrT ,less_c_str) KeywordMapT; - -#endif - -static KeywordMapT __gMultiLangMap; -static int __gMapReady = 0; - -void check_keyword_map( int keywordMapNr ) -{ - if ( !__gMapReady ) - { - __gMapReady = 1; - - // "make sure" the address of the first member of non-polimorphic class - // coinsides with the address of the instance - - KeywordT dummy; - - if ( (char*)& dummy != &dummy.keyWord[0] ) - throw; - - int size = sizeof(__gKeyWords) / sizeof( KeywordT ); - - for( int i = 0; i != size; ++i ) - - __gMultiLangMap.insert( - KeywordMapT::value_type( (char*)&__gKeyWords[i], - (char*)&__gKeyWords[i] - ) - ); - } -} - -int get_rank( char* start, char* end ) -{ - // FIXME:: what if end is no longer leagal adress? - - char tmp = *end; - *end = '\0'; // put temporary terminator - - KeywordMapT::iterator i; - - if ( (i = __gMultiLangMap.find( start ) ) != __gMultiLangMap.end() ) - { - KeywordT* pKey = (KeywordT*)(*i).second; - - *end = tmp; - - return pKey->rank; - } - else - { - *end = tmp; - return 0; - } -} - -static inline void store_range( IntListT& results, int rank, int range_len ) -{ - if ( !range_len ) return; - - results.push_back ( ( rank << 16 ) | ( range_len ) ); -} - - -#define STORE_RANGE store_range( results, cur_rank, cur_range_len );\ - cur_rank = cur_range_len = 0; - -#define NEXT_CHAR cur_range_len++; \ - ++cur; \ - continue; - -static inline int is_alpha( char ch ) -{ - return ( (( ch >= '_' ) && ( ch <= 'z' )) || - (( ch >= 'A' ) && ( ch <= 'Z' )) - ); -} - - // _ . . - // Ziema atEjo netikEtai - -static void heighlight_syntax( char* str, int strLen, - IntListT& results, bool& isComment ) -{ - bool isMultiline = 0; - char* cur = str; - char* end = str + strLen; - - int cur_rank = ( isComment == 1 ) ? RANK_GREEN : RANK_BLACK; - int cur_range_len = 0; - - while ( cur != end ) - { - int has_next = ( cur+1 != end ); - - if ( isComment ) - { - if ( *cur == '*' ) - if ( has_next && *(cur+1) == '/' ) - { - // turn off multiline comment mode - cur += 2; - cur_range_len += 2; - isComment = 0; - isMultiline = 0; - STORE_RANGE; - - continue; - } - - ++cur_range_len; - ++cur; - continue; - } - - /* - if ( *cur == 10 ) - if ( isComment ) - if ( isMultiline ) - { - cur_rank = RANK_GREEN; - cur_range_len = end - cur; - STORE_RANGE; - isComment = 0; - isMultiline = 0; - continue; - }*/ - - if ( *cur == '/' ) - { - if ( has_next ) - { - if ( *(cur+1) == '/' ) - { - STORE_RANGE; - - char* eol = cur; - while ( eol < end && *eol != 10 ) - ++eol; - - cur_rank = RANK_GREEN; - cur_range_len = eol - cur; - cur = eol; - STORE_RANGE; - - continue; - } - - if ( *(cur+1) == '*' ) - { - STORE_RANGE; - cur_rank = RANK_GREEN; - cur_range_len = 2; - isComment = 1; - cur += 2; - isMultiline = 1; - continue; - } - } - - NEXT_CHAR; - } - - if ( ( is_alpha( *cur ) || *(cur) == '#' ) - && has_next - ) - { - if ( is_alpha( *(cur+1) ) ) - { - char* start = cur; - cur += 2; - - while ( cur != end && is_alpha(*cur) ) ++cur; - - int wordRank; - - if ( (wordRank = get_rank( start, cur )) > 0 ) - { - STORE_RANGE; - - store_range( results, wordRank, int(cur-start) ); - cur_rank = cur_range_len = 0; - continue; - } - - cur_range_len += ( cur-start ); - continue; - } - else - NEXT_CHAR; - } - - NEXT_CHAR; - } - - if ( cur_range_len > 0 ) STORE_RANGE; -} - -/***** Implementation for class SourcePainter ******/ - -SourcePainter::SourcePainter( bool assembleResultString ) - : mCollectResultsOn( assembleResultString ), - mIsInComment( FALSE ), - mCommentIsMultiline( FALSE ) -{ - check_keyword_map(0); -} - -void SourcePainter::ProcessSource( char* src, int srcLen ) -{ - // TBD:: multilne state... - - heighlight_syntax( src, srcLen, mBlocks, mIsInComment ); - - if ( mCollectResultsOn ) - - mResultStr += string( src, srcLen ); -} - -void SourcePainter::SetState( bool isInComment, - bool commentIsMultiline ) -{ - mIsInComment = isInComment; - mCommentIsMultiline = commentIsMultiline; -} - -void SourcePainter::Init(bool assembleResultString) -{ - mIsInComment = 0; - mCommentIsMultiline = 0; - mCollectResultsOn = assembleResultString; - - mResultStr = ""; - - mBlocks.erase( mBlocks.begin(), mBlocks.end() ); -} - -static int rank_tags_map[] = -{ - TAG_BLACK_FONT, - TAG_BLUE_FONT, - TAG_RED_FONT, - TAG_GREEN_FONT -}; - -void SourcePainter::GetResultString(string& result, MarkupTagsT tags) -{ - // this method works, only if results of processing - // are collected - ASSERT( mCollectResultsOn ); - result = ""; - - int pos = 0; - - for( size_t i = 0; i != mBlocks.size(); ++i ) - { - int desc = mBlocks[i]; - - int len = desc & 0xFFFF; - int rank = (desc >> 16) & 0xFFFF; - - result += tags[ rank_tags_map[rank] ].start; - - for( int n = 0; n != len; ++n ) - - result += mResultStr[pos+n]; - - pos += len; - - result += tags[ rank_tags_map[rank] ].end; - } -} - -IntListT& SourcePainter::GetBlocks() -{ - return mBlocks; -} - -bool SourcePainter::IsKeyword( char* word, int wordLen ) -{ - check_keyword_map(0); - - int rank = get_rank( word, word + wordLen ); - - return ( rank == RANK_BLUE || rank == RANK_RED ); -} diff --git a/utils/wxPython/modules/lseditor/sourcepainter.h b/utils/wxPython/modules/lseditor/sourcepainter.h deleted file mode 100644 index ac177a9800..0000000000 --- a/utils/wxPython/modules/lseditor/sourcepainter.h +++ /dev/null @@ -1,109 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 22/09/98 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: GNU General Public License -///////////////////////////////////////////////////////////////////////////// -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef __SOURCEPAINTER_G__ -#define __SOURCEPAINTER_G__ - -#ifndef ASSERT -#define ASSERT(x) if (!(x)) throw -#endif - -#include "wxstldefs.h" - -#include "markup.h" // import MarkupTagsT definition - -// "colored" codes for highlighted blocks - -#define RANK_BLACK 0 // common source fragments -#define RANK_BLUE 1 // basic types -#define RANK_RED 2 // reserved words -#define RANK_GREEN 3 // comments - -// colored block description format : -// int( ( rank << 16 ) | ( source_range_len ) ) - -inline int get_src_block_rank( int block ) -{ - return (block >> 16) & 0xFFFF; -} - -inline int get_src_block_len( int block ) -{ - return block & 0xFFFF; -} - -// FOR NOW:: no lagnguage-map selection - -// source code syntax heighlighter (CPP+JAVA+VB+PASCAL) - -class SourcePainter -{ -protected: - string mResultStr; - IntListT mBlocks; - bool mCollectResultsOn; - - // state variables - bool mIsInComment; - bool mCommentIsMultiline; -public: - - // assembleResultString == TRUE - instructs painter - // to collect each chunk of srouce passed to ProcessSource(), - // so that results cann be futher obtained in a single string - // instead of vector of block descriptions - - SourcePainter( bool assembleResultString = TRUE ); - virtual ~SourcePainter() {} - - // can be called multiple times (e.g. on each source line) - virtual void ProcessSource( char* src, int srcLen ); - - // method, for manually adjusting state of source painter - virtual void SetState( bool isInComment, - bool commentIsMultiline ); - - // reinitializes object - clears results of previouse processing - virtual void Init( bool assembleResultString = TRUE ); - - // generates string of highlighted source for the scipting - // language given by "tags" argument - - virtual void GetResultString(string& result, MarkupTagsT tags); - - // returns vector of block descriptors, see IntListT definition - // (block descriptors can be used for fast custom hightlighted text generation) - - virtual IntListT& GetBlocks(); - - // NOTE:: static method - // returns if the given word is a reserved word or basic type identifier - static bool IsKeyword( char* word, int wordLen ); -}; - -#endif diff --git a/utils/wxPython/modules/lseditor/tdefs.cpp b/utils/wxPython/modules/lseditor/tdefs.cpp deleted file mode 100644 index e65b2fe114..0000000000 --- a/utils/wxPython/modules/lseditor/tdefs.cpp +++ /dev/null @@ -1,4233 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 03/04/1999 -// RCS-ID: $Id$ -// Copyright: (c) Aleksandars Gluchovas -// Licence: GNU General Public License -///////////////////////////////////////////////////////////////////////////// -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -///////////////////////////////////////////////////////////////////////////// - - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include "wx/file.h" -#include "wx/textdlg.h" -#include "wx/clipbrd.h" -#include "wx/dataobj.h" - -#include <stdio.h> - -#include "tdefs.h" -#include "finddlg.h" - -#include <memory.h> - -/***** Implementation for class TBlock *****/ - -void TBlock::RecalcBlockProperties() -{ - char* cur = mBuf; - char* end = mBuf + mTextLen; - mRowCount = 0; - - while( cur < end ) - { - if ( is_eol_char( *cur ) ) ++mRowCount; - - ++cur; - } -} - -/***** Implementation for class TTextIterator *****/ - -string TTextIterator::mSeparators = ",.()[]\t\\+-*/|=<>:;\t\n~?!%"; - -bool TTextIterator::IsSeparator( char ch ) -{ - size_t sz = mSeparators.size(); - - for( size_t i = 0; i != sz; ++i ) - - if ( mSeparators[i] == ch ) return TRUE; - - return FALSE; -} - -char* TTextIterator::GetClosestPos() -{ - char* end = GetBlockEnd(); - char* cur = mpCurRowStart; - size_t col = 0; - - while( cur < end && col < mPos.mCol && !is_eol_char(*cur) ) - { - if ( !is_DOS_eol_char( *cur ) ) ++col; - ++cur; - } - - if ( is_DOS_eol_char( *cur ) ) ++cur; - - return cur; -} - -char* TTextIterator::GotoClosestPos() -{ - char* end = GetBlockEnd(); - char* cur = mpCurRowStart; - size_t col = 0; - - while( cur < end && col < mPos.mCol && !is_eol_char(*cur) ) - { - if ( !is_DOS_eol_char( *cur ) ) ++col; - ++cur; - } - - mPos.mCol = col; - - if ( is_DOS_eol_char( *cur ) ) ++cur; - - return cur; -} - -TTextIterator::TTextIterator() - - : mIsEof( FALSE ) -{} - -bool TTextIterator::IsLastLine() -{ - TBlockIteratorT nextBlk = mBlockIter; - ++nextBlk; - - if ( nextBlk != mEndOfListIter ) return FALSE; - - char* cur = mpCurRowStart; - char* end = GetBlockEnd(); - - while( cur < end && !is_eol_char( *cur ) ) ++cur; - - if ( cur == end ) return TRUE; - - ++cur; - - return ( cur == end ); -} - -char TTextIterator::GetChar() -{ - char* cur = GetClosestPos(); - - if ( is_DOS_eol_char( *cur ) ) - - return *(cur+1); - else - return *cur; -} - -bool TTextIterator::IsEol() -{ - return is_eol_char( GetChar() ) || mIsEof; -} - -bool TTextIterator::IsEof() -{ - return mIsEof; -} - -int TTextIterator::GetDistFromEol() -{ - return 0; // TBD:: -} - -void TTextIterator::NextChar() -{ - char* cur = GotoClosestPos(); - - if ( cur + 1 >= GetBlockEnd() ) - { - TBlockIteratorT nextBlk = mBlockIter; - ++nextBlk; - - if ( nextBlk == mEndOfListIter ) - { - if ( cur != GetBlockEnd() ) - ++mPos.mCol; - - mIsEof = TRUE; - return; - } - - ++mPos.mRow ; - mPos.mCol = 0; - - mBlockIter = nextBlk; - - mFirstRowInBlock = mPos.mRow; - mActualRow = mPos.mRow; - mpCurRowStart = (*mBlockIter).mBuf; - - mIsEof = ( (*mBlockIter).mTextLen == 0 ); - } - else - { - if ( is_eol_char( *cur ) ) - { - ++mPos.mRow; - mPos.mCol = 0; - - mActualRow = mPos.mRow; - mpCurRowStart = cur + 1; - } - else - ++mPos.mCol; - } - - mIsEof = (mpCurRowStart + mPos.mCol) == GetBlockEnd(); -} - -void TTextIterator::PreviousChar() -{ - char* cur = GotoClosestPos(); - - if ( cur == (*mBlockIter).mBuf ) - { - TBlockIteratorT prevBlk = mBlockIter; - --prevBlk; - - if ( prevBlk == mEndOfListIter ) - { - mIsEof = TRUE; - return; - } - - --mPos.mRow; - - mBlockIter = prevBlk; - - cur = GetBlockEnd() - 1; - - char* eolPos = cur; - --cur; // skip EOL - char* start = (*mBlockIter).mBuf; - - while( cur != start && !is_eol_char( *cur ) ) --cur; // goto start of line - - if ( is_eol_char( *cur ) ) ++cur; - - mPos.mCol = (size_t)(eolPos - cur); - mpCurRowStart = cur; - - mFirstRowInBlock = mPos.mRow; - mActualRow = mPos.mRow; - } - else - { - do - { - // FIXME FIXME:: this is more then messy .... ! - - if ( is_eol_char( *(cur-1) ) ) - { - --cur; // goto EOL - - --mPos.mRow; - - char* eolPos = cur; - --cur; // skip EOL - char* start = (*mBlockIter).mBuf; - - while( cur != start && !is_eol_char( *cur ) ) --cur; // goto start of line - - if ( is_eol_char( *cur ) ) ++cur; - - mPos.mCol = (size_t)(eolPos - cur); - mpCurRowStart = cur; - - if ( eolPos != cur && is_DOS_eol_char( *(eolPos-1) ) ) --mPos.mCol; - - mActualRow = mPos.mRow; - - break; - } - else - if ( is_DOS_eol_char( *(cur-1) ) ) - { - --cur; - - if ( cur != (*mBlockIter).mBuf && is_eol_char( *(cur-1) ) ) - - continue; - else - { - --mPos.mCol; - --cur; - } - } - else - { - --mPos.mCol; - break; - } - - } while( 1 ); - } - - mIsEof = (mpCurRowStart + mPos.mCol) == GetBlockEnd(); -} - -void TTextIterator::NextWord() -{ - GotoClosestPos(); - - // skip non-white space ahead - - bool wasSeparator = IsSeparator( GetChar() ); - - while( !IsEof() ) - { - char ch = GetChar(); - - if ( ch == ' ' || - ch == '\t' || - is_eol_char(ch) || - wasSeparator != IsSeparator(ch) ) - - break; - - NextChar(); - } - - // skip all white stpace if any - while( !IsEof() ) - { - char ch = GetChar(); - - if ( ch != ' ' && ch != '\t' && !is_eol_char(ch) ) - - break; - - NextChar(); - } -} - -void TTextIterator::PreviousWord() -{ - GotoClosestPos(); - - PreviousChar(); - - // skip all white stpace if any - while( !IsEof() ) - { - char ch = GetChar(); - - if ( ch != ' ' && ch != '\t' && !is_eol_char(ch) ) - - break; - - PreviousChar(); - } - - bool wasSeparator = IsSeparator( GetChar() ); - - // skip word; - while( !IsEof() ) - { - char ch = GetChar(); - - if ( ch == ' ' || - ch == '\t' || - is_eol_char(ch) || - wasSeparator != IsSeparator(ch) - ) - { - NextChar(); - break; - } - - PreviousChar(); - } -} - -void TTextIterator::ToEndOfLine() -{ - GotoClosestPos(); - - while( !IsEof() ) - { - char ch = GetChar(); - - if ( is_eol_char( ch ) ) break; - - NextChar(); - } -} - -void TTextIterator::ToStartOfLine() -{ - GotoClosestPos(); - - mPos.mCol = 0; - mPos.mRow = mActualRow; -} - -size_t TTextIterator::GetLineLen() -{ - char* cur = mpCurRowStart; - char* end = GetBlockEnd(); - - size_t len = 0; - - while( cur < end && !is_eol_char( *cur ) ) - { - if ( !is_DOS_eol_char( *cur ) ) ++len; - ++cur; - } - - return len; -} - -TPosition TTextIterator::GetPosition() -{ - return mPos; -} - -bool TTextIterator::IsInLastBlock() -{ - TBlockIteratorT next = mBlockIter; - ++next; - - return next == mEndOfListIter; -} - -bool TTextIterator::DetectUnixText() -{ - char* cur = GetBlockStart(); - char* end = GetBlockEnd(); - - bool isUnixText = IS_UNIX_TEXT_BY_DEFAULT; - - while( cur < end ) - { - if ( is_DOS_eol_char( *cur ) ) return FALSE; - - if ( is_eol_char( *cur ) ) return TRUE; - - ++cur; - } - - return isUnixText; -} - -/***** Implementation for class TCppJavaHighlightListener *****/ - -void TCppJavaHighlightListener::OnTextChanged( wxTextEditorModel* pModel, - size_t atRow, size_t nRows, - TEXT_CHANGE_TYPE ct ) -{ - mpModel = pModel; - - /* - - int state = GetStateAtRow( atRow ); - - if ( ct == CT_INSERTED ) - { - RemoveCommentTags( atRow, atRow + nRows + 1 ); - GenerateTagsForRange( atRows, atRows + nRows + 1 ); - } - else - if ( ct == CT_DELETED ) - { - RemoveCommentTags( atRow, atRow + 1 ); - GenerateTagsForRange( atRows, atRows + 1 ); - } - */ -} - -/***** Implementation for class wxTextEditorModel *****/ - -/*** protected methods ***/ - -size_t wxTextEditorModel::GetLineCountInRange( char* from, char* till ) -{ - size_t nLines = 0; - - while( from != till ) - { - if ( is_eol_char( *from ) ) ++nLines; - - ++from; - } - - return nLines; -} - -void wxTextEditorModel::DoInsertText( const TPosition& pos, - char* text, size_t len, - TRange& actualRange ) -{ - // FOR NOW:: very dummy imp. - - char* end = text + len; - - TTextIterator iter = CreateIterator( pos ); - - TBlock& blk = (*iter.mBlockIter); - - char* cur = text; - - char* insertPos = iter.GotoClosestPos(); - actualRange.mFrom = iter.GetPosition(); - - if ( is_eol_char( *insertPos ) && - insertPos != iter.GetBlockStart() && - is_DOS_eol_char( *(insertPos-1) ) - ) - --insertPos; - - size_t sizeAfter = (size_t)(iter.GetBlockEnd() - insertPos); - - size_t nLines = GetLineCountInRange( text, text + len ); - - if ( blk.mTextLen + len < FILLED_BLOCK_LEN ) - { - memmove( insertPos + len, insertPos, sizeAfter ); - - memcpy( insertPos, text, len ); - - blk.mTextLen += len; - - - blk.RecalcBlockProperties(); - - if ( iter.IsInLastBlock() ) - - ++blk.mRowCount; // last block have always the-last-row-to-spare - - // the "nature" of most text editors - - char* endPos = insertPos + len; - - bool found = FALSE; - - /* - // OLD STUFF:: slow & buggy - - while( !iter.IsEof() ) - { - if ( iter.GetClosestPos() == endPos ) - { - actualRange.mTill = iter.GetPosition(); - found = TRUE; - break; - } - - iter.NextChar(); - } - - if ( !found ) - { - actualRange.mTill = iter.GetPosition(); - ++actualRange.mTill.mCol; - - //T_ASSERT( found ); // DBG:: - } - */ - - actualRange.mTill = actualRange.mFrom; - actualRange.mTill.mRow += nLines; - - if ( nLines == 0 ) - - actualRange.mTill.mCol = actualRange.mFrom.mCol + (len); - else - { - cur = end; - - while( cur != insertPos && !is_eol_char( *cur ) ) - - --cur; - - if ( is_eol_char( *cur ) ) ++cur; - - actualRange.mTill.mCol = (int)(end - cur); - } - - NotifyTextChanged( pos.mRow, nLines, CT_INSERTED ); - } - else - { - // TBD::: - - char buf[16]; - sprintf( buf, "%d", FILLED_BLOCK_LEN ); - string msg = "Sorry!!! Currently editor is limited to files less then "; - msg += buf; - msg += " bytes\n(the requested text length is " + - sprintf( buf, "%d", blk.mTextLen + len ); - msg += buf; - msg += " bytes)\n Please, close this file without making any changes."; - - wxMessageBox( msg ); - - GetActiveView()->SetFocus(); - - //T_ASSERT(0); // DBG:: for now - } -} - -void wxTextEditorModel::DoDeleteRange( const TPosition& from, const TPosition& till, - TRange& actualRange - ) -{ - // FOR NOW:: very dummy imp. - - TTextIterator iterFrom = CreateIterator( from ); - TTextIterator iterTill = CreateIterator( till ); - - if ( iterFrom.mBlockIter == iterTill.mBlockIter ) - { - char* fromPos = iterFrom.GotoClosestPos(); - char* tillPos = iterTill.GotoClosestPos(); - char* blockStart = (*iterFrom.mBlockIter).mBuf; - - if ( is_eol_char( *fromPos ) && - fromPos != blockStart && - is_DOS_eol_char( *(fromPos-1) ) - ) - --fromPos; - - if ( is_eol_char( *tillPos ) && - tillPos != blockStart && - is_DOS_eol_char( *(tillPos-1) ) - ) - --tillPos; - - size_t len = (size_t)( tillPos -fromPos ); - - size_t nLines = GetLineCountInRange( fromPos, fromPos + len ); - - size_t sizeAfter = (size_t)(iterFrom.GetBlockEnd() - tillPos); - - memmove( fromPos, tillPos, sizeAfter ); - - (*iterFrom.mBlockIter).mTextLen -= len; - - (*iterFrom.mBlockIter).RecalcBlockProperties(); - - if ( iterFrom.IsInLastBlock() ) - - ++(*iterFrom.mBlockIter).mRowCount; // last block have always the-last-row-to-spare - - // the "nature" of most text editors - - actualRange.mFrom = iterFrom.GetPosition(); - actualRange.mTill = iterTill.GetPosition(); - - NotifyTextChanged( from.mRow, nLines, CT_DELETED ); - } - else - T_ASSERT(0); // DBG:: for now -} - -void wxTextEditorModel::GetTextFromRange( const TPosition& from, const TPosition& till, - char** text, size_t& textLen - ) -{ - TTextIterator iterFrom = CreateIterator( from ); - TTextIterator iterTill = CreateIterator( till ); - - if ( iterFrom.mBlockIter == iterTill.mBlockIter ) - { - char* blockStart = (*iterFrom.mBlockIter).mBuf; - - char* fromPos = iterFrom.GetClosestPos(); - char* tillPos = iterTill.GetClosestPos(); - - if ( is_eol_char( *fromPos ) && - fromPos != blockStart && - is_DOS_eol_char( *(fromPos-1) ) - ) - --fromPos; - - if ( is_eol_char( *tillPos ) && - tillPos != blockStart && - is_DOS_eol_char( *(tillPos-1) ) - ) - --tillPos; - - textLen = (size_t)( tillPos -fromPos ); - - *text = AllocCharacters( textLen ); - - memcpy( *text, fromPos, textLen ); - } - else - T_ASSERT(0); // DBG:: for now -} - -void wxTextEditorModel::LoadTextFromFile( const wxString& fname ) -{ - T_ASSERT( wxFile::Exists( fname ) ); - - DeleteAllText(); - - wxFile fl( fname ); - - char* buf = AllocCharacters( fl.Length() ); - - fl.Read( buf, fl.Length() ); - - TRange result; - DoInsertText( TPosition( 0,0 ), buf, fl.Length(), result ); - - FreeCharacters( buf ); - - TTextIterator iter = CreateIterator( TPosition( 0,0 ) ); - - mIsUnixText = iter.DetectUnixText(); - - ClearUndoBuffer(); - - NotifyAllViews(); -} - -void wxTextEditorModel::SaveTextToFile( const wxString& fname ) -{ - wxFile fl( fname, wxFile::write ); - - char* text = 0; - size_t len = 0; - - GetTextFromRange( TPosition(0,0), TPosition( GetTotalRowCount()+1,0 ), &text, len ); - - fl.Write( text, len ); - fl.Close(); - - FreeCharacters( text ); -} - -void wxTextEditorModel::NotifyTextChanged( size_t atRow, size_t nRows, TEXT_CHANGE_TYPE ct ) -{ - if ( nRows > 0 ) - - MergeChange( atRow, mRowsPerPage ); - else - MergeChange( atRow, 1 ); - - // reposition bookmarsk - - if ( nRows > 0 ) - { - if ( ct == CT_INSERTED ) - { - size_t curPin = FindNextPinFrom( atRow + 1 ); - - while( curPin != NPOS ) - { - mPins[curPin]->mRow += nRows; - - ++curPin; - - if ( curPin == mPins.size() ) break; - } - } - else - if ( ct == CT_DELETED ) - { - size_t curPin = FindNextPinFrom( atRow + 1 ); - size_t fromPin = curPin; - size_t tillRow = atRow + nRows; - - while( curPin != NPOS && mPins[curPin]->mRow < tillRow ) - { - ++curPin; - - if ( curPin == mPins.size() ) break; - } - - if ( fromPin != NPOS && nRows != 0 ) - { - mPins.erase( &mPins[fromPin], &mPins[curPin] ); - - while( curPin < mPins.size() ) - { - mPins[curPin]->mRow -= nRows; - ++curPin; - } - } - } - } - - - // send notificaitons - - for( size_t i = 0; i != mChangeListeners.size(); ++i ) - - mChangeListeners[i]->OnTextChanged( this, atRow, nRows, ct ); -} - -void wxTextEditorModel::NotifyTextChanged( TPosition from, TPosition till, TEXT_CHANGE_TYPE ct ) -{ - ArrangePositions( from, till ); - - NotifyTextChanged( from.mRow, till.mRow - from.mRow + 1, ct ); -} - -void wxTextEditorModel::DoExecuteNewCommand( TCommand& cmd ) -{ - if ( cmd.mType == TCMD_INSERT ) - { - cmd.mPrePos = mCursorPos; - DoInsertText( cmd.mRange.mFrom, cmd.mData, cmd.mDataLen, cmd.mRange ); - } - else - if ( cmd.mType == TCMD_DELETE ) - { - cmd.mPrePos = mCursorPos; - DoDeleteRange( cmd.mRange.mFrom, cmd.mRange.mTill, cmd.mRange ); - } -} - -void wxTextEditorModel::DoReexecuteCommand( TCommand& cmd ) -{ - NotifyTextChanged( mCursorPos.mRow, 1, CT_MODIFIED ); // indicate update of current cursor position - - if ( cmd.mType == TCMD_INSERT ) - { - DoInsertText( cmd.mRange.mFrom, cmd.mData, cmd.mDataLen, cmd.mRange ); - mCursorPos = cmd.mPostPos; - } - else - if ( cmd.mType == TCMD_DELETE ) - { - DoDeleteRange( cmd.mRange.mFrom, cmd.mRange.mTill, cmd.mRange ); - mCursorPos = cmd.mPostPos; - } - - NotifyTextChanged( mCursorPos.mRow, 1, CT_MODIFIED ); // indicate update of current cursor position -} - -void wxTextEditorModel::DoUnexecuteCommand( TCommand& cmd ) -{ - NotifyTextChanged( mCursorPos.mRow, 1, CT_MODIFIED ); // indicate update of current cursor position - - if ( cmd.mType == TCMD_INSERT ) - { - DoDeleteRange( cmd.mRange.mFrom, cmd.mRange.mTill, cmd.mRange ); - mCursorPos = cmd.mPrePos; - } - else - if ( cmd.mType == TCMD_DELETE ) - { - DoInsertText( cmd.mRange.mFrom, cmd.mData, cmd.mDataLen, cmd.mRange ); - mCursorPos = cmd.mPrePos; - } - - NotifyTextChanged( mCursorPos.mRow, 1, CT_MODIFIED ); // indicate update of current cursor position -} - -void wxTextEditorModel::UndoImpl() -{ - --mCurCommand; - - DoUnexecuteCommand( *mCommands[mCurCommand] ); -} - -void wxTextEditorModel::RedoImpl() -{ - DoReexecuteCommand( *mCommands[mCurCommand] ); - - ++mCurCommand; -} - -void wxTextEditorModel::ExecuteCommand( TCommand* pCmd ) -{ - if ( mCurCommand < mCheckPointCmdNo ) - - // new command is executed before the checkpoint, - // and every thing is sliced - invalidate it - - mCheckPointDestroyed = TRUE; - - // slice undo-able commands ahead in the queue, - // they wont ever be reexecuted - - while( mCommands.size() > mCurCommand ) - { - delete mCommands.back(); - - mCommands.pop_back(); - } - - mCommands.push_back( pCmd ); - - DoExecuteNewCommand( *pCmd ); - ++mCurCommand; -} - -bool wxTextEditorModel::CanPrependCommand( TCommand* pCmd ) -{ - if ( mCommands.size() != mCurCommand || - mCommands.size() == 0 ) - - return FALSE; - - TCommand& prevCmd = *mCommands.back(); - - if ( !(prevCmd.mRange.mTill == pCmd->mRange.mFrom) ) - - return FALSE; - - char prevCh = prevCmd.mData[ prevCmd.mDataLen - 1]; - char curCh = pCmd->mData[0]; - - if ( prevCh == curCh ) return TRUE; - - if ( prevCh == ' ' || curCh == ' ') return FALSE; - - if ( TTextIterator::IsSeparator(prevCh) != - TTextIterator::IsSeparator(curCh) ) - - return FALSE; - - return TRUE; -} - -void wxTextEditorModel::PrependCommand( TCommand* pCmd ) -{ - if ( mCheckPointCmdNo == mCurCommand ) - - mCheckPointDestroyed = TRUE; - - TCommand& prevCmd = *mCommands.back(); - - DoExecuteNewCommand( *pCmd ); - - TCommand* pComb = new TCommand(); - - pComb->mType = TCMD_INSERT; - pComb->mDataLen = prevCmd.mDataLen + pCmd->mDataLen; - - pComb->mData = AllocCharacters( pComb->mDataLen ); - pComb->mRange.mFrom = prevCmd.mRange.mFrom; - pComb->mRange.mTill = pCmd->mRange.mTill; - pComb->mPrePos = prevCmd.mPrePos; - pComb->mPostPos = pCmd->mPostPos; - - memcpy( pComb->mData, prevCmd.mData, prevCmd.mDataLen ); - memcpy( pComb->mData + prevCmd.mDataLen, pCmd->mData, pCmd->mDataLen ); - - FreeCharacters( prevCmd.mData ); - FreeCharacters( pCmd->mData ); - - delete &prevCmd; - delete pCmd; - - mCommands[ mCommands.size() - 1 ] = pComb; -} - -void wxTextEditorModel::SetPostPos( const TPosition& pos ) -{ - mCommands[mCurCommand-1]->mPostPos = pos; -} - -bool wxTextEditorModel::SelectionIsEmpty() -{ - return mSelectionStart == mSelectionEnd; -} - -void wxTextEditorModel::StartBatch() -{ - // TBD:: -} - -void wxTextEditorModel::FinishBatch() -{ - // TBD:: -} - -void wxTextEditorModel::DeleteRange( const TPosition& from, const TPosition& till ) -{ - TCommand* pCmd = new TCommand(); - - pCmd->mType = TCMD_DELETE; - - pCmd->mRange.mFrom = from; - pCmd->mRange.mTill = till; - pCmd->mPrePos = mCursorPos; - - GetTextFromRange( from, till, &pCmd->mData, pCmd->mDataLen ); - - ExecuteCommand( pCmd ); -} - -void wxTextEditorModel::InsertText( const TPosition& pos, const char* text, size_t len ) -{ - TCommand* pCmd = new TCommand(); - - pCmd->mType = TCMD_INSERT; - - pCmd->mRange.mFrom = pos; - - pCmd->mData = AllocCharacters( len, text ), - pCmd->mDataLen = len; - pCmd->mPrePos = mCursorPos; - - ExecuteCommand( pCmd ); -} - -void wxTextEditorModel::DeleteSelection() -{ - DeleteRange( mSelectionStart, mSelectionEnd ); - - ResetSelection(); -} - -bool wxTextEditorModel::IsLastLine( const TPosition& pos ) -{ - return FALSE; -} - -TTextIterator wxTextEditorModel::CreateIterator( const TPosition& pos ) -{ - size_t curRow = 0; - - TBlockIteratorT bIter = mBlocks.begin(); - - TTextIterator tIter; - - while( bIter != mBlocks.end() ) - { - TBlockIteratorT nextBlk = bIter; - ++nextBlk; - - if ( nextBlk == mBlocks.end() || - ( pos.mRow >= curRow && - pos.mRow <= curRow + (*bIter).mRowCount ) - ) - { - tIter.mFirstRowInBlock = curRow; - - char* cur = (*bIter).mBuf; - char* end = cur + (*bIter).mTextLen; - - // slightly optimized - - if ( curRow < pos.mRow ) - { - while( cur < end ) - { - if ( is_eol_char( *cur ) ) - { - ++curRow; - - if ( !(curRow < pos.mRow) ) - { - ++cur; - break; - } - } - - ++cur; - } - } - - tIter.mActualRow = curRow; - tIter.mpCurRowStart = cur; - tIter.mPos = pos; - - // FOR NOW:: positioning past the end of file is not supported - tIter.mPos.mRow = curRow; - - tIter.mBlockIter = bIter; - tIter.mEndOfListIter = mBlocks.end(); - - break; - } - else - { - curRow += (*bIter).mRowCount; - ++bIter; - } - } - - return tIter; -} - -void wxTextEditorModel::ArrangePositions( TPosition& upper, TPosition& lower ) -{ - if ( upper > lower ) - { - TPosition tmp( lower ); - lower = upper; - upper = tmp; - } -} - -void wxTextEditorModel::ArrangePositions( size_t& upper, size_t& lower ) -{ - if ( upper > lower ) - { - size_t tmp = lower; - lower = upper; - upper = tmp; - } -} - -void wxTextEditorModel::MergeChange( size_t fromRow, size_t nRows ) -{ - if ( mTextChanged == FALSE ) - { - mChangedFromRow = fromRow; - mChangedTillRow = fromRow + nRows; - mTextChanged = TRUE; - } - else - { - if ( mChangedFromRow > fromRow ) - - mChangedFromRow = fromRow; - - if ( mChangedTillRow < fromRow + nRows ) - - mChangedTillRow = fromRow + nRows; - } -} - -void wxTextEditorModel::TrackSelection() -{ - if ( !mIsSelectionEditMode ) return; - - if ( mPrevCursorPos == mSelectionStart ) - - mSelectionStart = mCursorPos; - else - mSelectionEnd = mCursorPos; - - ArrangePositions( mSelectionStart, mSelectionEnd ); - - NotifyTextChanged( mSelectionStart, mPrevSelectionStart, CT_MODIFIED ); - NotifyTextChanged( mSelectionEnd, mPrevSelectionEnd, CT_MODIFIED ); -} - -void wxTextEditorModel::CheckSelection() -{ - ArrangePositions( mSelectionStart, mSelectionEnd ); - - if ( mIsSelectionEditMode && SelectionIsEmpty() ) - { - mSelectionStart = mCursorPos; - mSelectionEnd = mCursorPos; - } - - if ( !mIsSelectionEditMode && !SelectionIsEmpty() ) - { - ResetSelection(); - } - - mPrevSelectionStart = mSelectionStart; - mPrevSelectionEnd = mSelectionEnd; - mPrevCursorPos = mCursorPos; -} - -void wxTextEditorModel::ResetSelection() -{ - if ( SelectionIsEmpty() ) return; - - MergeChange( mSelectionStart.mRow, - mSelectionEnd.mRow - mSelectionStart.mRow + 1 ); - - NotifyTextChanged( mSelectionStart, mSelectionEnd, CT_MODIFIED ); - - mSelectionStart = TPosition(0,0); - mSelectionEnd = TPosition(0,0); - -} - -void wxTextEditorModel::ClearUndoBuffer() -{ - for( size_t i = 0; i != mCommands.size(); ++i ) - { - TCommand& cmd = *mCommands[i]; - - if ( cmd.mData ) delete [] cmd.mData; - - delete &cmd; - } - - mCommands.erase( mCommands.begin(), mCommands.end() ); - - mCurCommand = 0; -} - -void wxTextEditorModel::GetAllText( char** text, size_t& textLen ) -{ - GetTextFromRange( TPosition(0,0), TPosition( GetTotalRowCount()+1, 0 ), - text, textLen - ); -} - -void wxTextEditorModel::DeleteAllText() -{ - ResetSelection(); - - DeleteRange( TPosition(0,0), TPosition( GetTotalRowCount()+1, 0 ) ); -} - -void wxTextEditorModel::SetSelectionEditMode( bool editIsOn ) -{ - mIsSelectionEditMode = editIsOn; -} - -size_t wxTextEditorModel::GetTotalRowCount() -{ - size_t nRows = 0; - - for( TBlockIteratorT i = mBlocks.begin(); i != mBlocks.end(); ++i ) - - nRows += (*i).mRowCount; - - return nRows; -} - -void wxTextEditorModel::GetSelection( char** text, size_t& textLen ) -{ - GetTextFromRange( GetStartOfSelection(), GetEndOfSelection(), text, textLen ); -} - -void wxTextEditorModel::NotifyView() -{ - mpActiveView->OnModelChanged(); -} - -void wxTextEditorModel::NotifyAllViews() -{ - for( size_t i = 0; i != mViews.size(); ++i ) - - mViews[i]->OnModelChanged(); -} - -void wxTextEditorModel::PrepreForCommand() -{ - mTextChanged = 0; - mChangedFromRow = 0; - mChangedTillRow = 0; -} - -size_t wxTextEditorModel::TextToScrColumn( const TPosition& pos ) -{ - TPosition spos; - - mpActiveView->TextPosToScreenPos( pos, spos ); - - return spos.mCol + mpActiveView->GetPagePos().mCol; -} - -size_t wxTextEditorModel::ScrToTextColumn( TPosition pos ) -{ - TPosition tpos; - - pos.mCol -= mpActiveView->GetPagePos().mCol; - pos.mRow -= mpActiveView->GetPagePos().mRow; - - mpActiveView->ScreenPosToTextPos( pos, tpos ); - - return tpos.mCol; -} - -void wxTextEditorModel::DoMoveCursor( int rows, int cols ) -{ - mCursorPos.mCol = TextToScrColumn( mCursorPos ); - - mCursorPos.mRow += rows; - mCursorPos.mCol += cols; - - mCursorPos.mCol = ScrToTextColumn( mCursorPos ); -} - -/*** public interface ***/ - -wxTextEditorModel::wxTextEditorModel() - - : - mpActiveView( NULL ), - mTabSize( 4 ), - mIsSelectionEditMode( FALSE ), - mRowsPerPage( 0 ), - mTextChanged( FALSE ), - mCurCommand( 0 ), - - mInsertMode ( TRUE ), - mAutoIndentMode ( TRUE ), - mSmartIndentMode( TRUE ), - mWasChanged ( FALSE ), - mIsReadOnly ( FALSE ), - mIsUnixText ( IS_UNIX_TEXT_BY_DEFAULT ) -{ - // at least one block should be present - // (otherwise text-iterators wont work) - - mBlocks.push_back( TBlock() ); -} - -wxTextEditorModel::~wxTextEditorModel() -{ - ClearUndoBuffer(); -} - -char* wxTextEditorModel::AllocCharacters( size_t n ) -{ - return new char[n]; -} - -char* wxTextEditorModel::AllocCharacters( size_t n, const char* srcBuf ) -{ - char* destBuf = AllocCharacters( n ); - - memcpy( destBuf, srcBuf, n ); - - return destBuf; -} - -void wxTextEditorModel::FreeCharacters( char* buf ) -{ - delete [] buf; -} - -void wxTextEditorModel::OnInsertChar( char ch ) -{ - if ( ch == 27 ) return; // hack - - if ( is_DOS_eol_char( ch ) ) ch = '\n'; - - PrepreForCommand(); - StartBatch(); - - TCommand* pCmd = new TCommand(); - - pCmd->mType = TCMD_INSERT; - - if ( ch == '\n' && !mIsUnixText ) - { - // DOS text with CR-LF pair - pCmd->mData = AllocCharacters( 2 ); - pCmd->mDataLen = 2; - pCmd->mData[0] = (char)13; - pCmd->mData[1] = (char)10; - } - else - { - pCmd->mData = AllocCharacters( 1 ); - pCmd->mDataLen = 1; - pCmd->mData[0] = ch; - } - - - if ( !SelectionIsEmpty() ) - { - mCursorPos = mSelectionStart; - DeleteSelection(); - } - - pCmd->mRange.mFrom = mCursorPos; - - if ( mInsertMode == FALSE ) - { - TPosition nextPos( mCursorPos.mRow, mCursorPos.mCol + 1 ); - DeleteRange( mCursorPos, nextPos ); - - SetPostPos( mCursorPos ); - } - - TTextIterator iter = CreateIterator( mCursorPos ); - - size_t lineLen = iter.GetLineLen(); - - bool indentAdded = FALSE; - - if ( mCursorPos.mCol > lineLen ) - { - - wxString s( ' ', mCursorPos.mCol - lineLen ); - InsertText( TPosition( mCursorPos.mRow, lineLen ), s.c_str(), s.length() ); - - SetPostPos( mCursorPos ); - - indentAdded = TRUE; - } - - if ( CanPrependCommand( pCmd ) || indentAdded ) - - PrependCommand( pCmd ); - else - ExecuteCommand( pCmd ); - - ++mCursorPos.mCol; - - if ( is_eol_char( ch ) ) - { - mCursorPos.mCol = 0; - ++mCursorPos.mRow; - - SetPostPos( mCursorPos ); - - if ( mAutoIndentMode ) - { - iter.ToStartOfLine(); - wxString indent; - - while( !iter.IsEol() ) - { - char ch = iter.GetChar(); - - if ( ch == '\t' || ch == ' ' ) - - indent += ch; - else - break; - - iter.NextChar(); - } - - if ( indent.length() ) - { - // auto-indent is always prepended to the command which - // caused it - - mCursorPos = TPosition( mCursorPos.mRow, 0 ); - - - TCommand* pICmd = new TCommand(); - pICmd->mType = TCMD_INSERT; - pICmd->mData = AllocCharacters( indent.length() ); - pICmd->mDataLen = indent.length(); - memcpy( pICmd->mData, indent, indent.length() ); - - pICmd->mRange.mFrom = TPosition( mCursorPos.mRow, 0 ); - - PrependCommand( pICmd ); - - SetPostPos( mCursorPos ); - - mCursorPos.mCol = indent.length(); - } - } - } - else - SetPostPos( mCursorPos ); - - FinishBatch(); - - NotifyAllViews(); -} - -void wxTextEditorModel::OnDelete() -{ - PrepreForCommand(); - StartBatch(); - - if ( !SelectionIsEmpty() ) - { - TPosition startPos = mSelectionStart; - DeleteSelection(); - mCursorPos = startPos; - } - else - { - TTextIterator iter = CreateIterator( mCursorPos ); - - if ( iter.GetLineLen() == mCursorPos.mCol && !iter.IsLastLine() ) - { - TPosition nextPos( mCursorPos.mRow+1, 0 ); - DeleteRange( mCursorPos, nextPos ); - NotifyTextChanged( mCursorPos.mRow, 2, CT_DELETED ); - } - else - { - TPosition nextPos( mCursorPos.mRow, mCursorPos.mCol + 1 ); - DeleteRange( mCursorPos, nextPos ); - } - } - - SetPostPos( mCursorPos ); - - FinishBatch(); - - NotifyAllViews(); -} - -void wxTextEditorModel::OnDeleteBack() -{ - PrepreForCommand(); - StartBatch(); - - if ( !SelectionIsEmpty() ) - { - mCursorPos = mSelectionStart; - DeleteSelection(); - } - else - if ( !(mCursorPos == TPosition(0,0)) ) - { - TPosition prevPos; - - if ( mCursorPos.mCol == 0 ) - { - TTextIterator iter = CreateIterator( mCursorPos ); - iter.PreviousChar(); - - prevPos = iter.GetPosition(); - } - else - prevPos = TPosition( mCursorPos.mRow, mCursorPos.mCol - 1 ); - - DeleteRange( prevPos, mCursorPos ); - - mCursorPos = prevPos; - } - - SetPostPos( mCursorPos ); - - FinishBatch(); - - NotifyAllViews(); - -} - -void wxTextEditorModel::OnDeleteLine() -{ - PrepreForCommand(); - StartBatch(); - - DeleteSelection(); - - TTextIterator iter = CreateIterator( mCursorPos ); - - iter.ToStartOfLine(); - - TPosition from = iter.GetPosition(); - - iter.ToEndOfLine(); - - if ( iter.IsLastLine() == FALSE ) - - iter.NextChar(); // delete eol-char also, if it's not the last line - - TPosition till = iter.GetPosition(); - - DeleteRange( from, till ); - SetPostPos( mCursorPos ); - - FinishBatch(); - - NotifyAllViews(); -} - -void wxTextEditorModel::OnShiftSelectionIndent( bool left ) -{ - if ( SelectionIsEmpty() ) return; - - PrepreForCommand(); - StartBatch(); - - for( size_t row = mSelectionStart.mRow; row != mSelectionEnd.mRow; ++row ) - { - TTextIterator iter = CreateIterator( TPosition( row, 0 ) ); - - if ( left ) - { - int n = 0, pos = 0; - - while( !iter.IsEol() && !iter.IsEof() ) - { - char ch = iter.GetChar(); - - if ( pos == mTabSize ) break; - - if ( ch != ' ' && ch != '\t' ) break; - - ++n; - - if ( ch == '\t' ) break; - - ++pos; - - iter.NextChar(); - } - - if ( n ) DeleteRange( TPosition( row,0 ), TPosition( row, n ) ); - } - else - { - char txt = '\t'; - - InsertText( TPosition( row, 0 ), &txt, sizeof(char) ); - } - } - - FinishBatch(); - NotifyAllViews(); -} - -void wxTextEditorModel::OnPaste() -{ - // FIXME:: "wxLogQueryInterface(..)" linking problems with MSDev4.0 - -#ifdef __HACK_MY_MSDEV40__ - - bool alreadyOpen=wxClipboardOpen(); - if (!alreadyOpen) - { - wxOpenClipboard(); - } - - char* data = (char*)::wxGetClipboardData( wxDF_TEXT ); - - wxCloseClipboard(); - - if ( data == NULL ) return; - - PrepreForCommand(); - StartBatch(); - - if ( !SelectionIsEmpty() ) - { - mCursorPos = GetStartOfSelection(); - DeleteSelection(); - } - - InsertText( mCursorPos, data, strlen( data ) ); - - delete [] data; -#else - - if ( !wxTheClipboard->Open() ) return; - - wxTextDataObject data; - if ( !wxTheClipboard->IsSupported(wxDF_TEXT) ) - { - wxTheClipboard->Close(); - return; - } - - wxTheClipboard->GetData(&data); - - string txt = data.GetText(); - - wxTheClipboard->Close(); - - PrepreForCommand(); - StartBatch(); - - DeleteSelection(); - - InsertText( mCursorPos, txt.c_str(), txt.length() ); -#endif - - - mCursorPos = mCommands.back()->mRange.mTill; - SetPostPos( mCursorPos ); - - FinishBatch(); - NotifyAllViews(); -} - -void wxTextEditorModel::OnCut() -{ - OnCopy(); - - PrepreForCommand(); - StartBatch(); - - DeleteSelection(); - SetPostPos( mCursorPos ); - - - FinishBatch(); - NotifyAllViews(); -} - -void wxTextEditorModel::OnCopy() -{ - if ( !SelectionIsEmpty() ) - { - size_t len = 0; - char* text = NULL; - -#ifndef __HACK_MY_MSDEV40__ - - if ( !wxTheClipboard->Open() ) return; - - GetTextFromRange( mSelectionStart, mSelectionEnd, &text, len ); - - wxString s( text, len ); - - wxTheClipboard->AddData( new wxTextDataObject(s) ); - wxTheClipboard->Close(); - - FreeCharacters( text ); -#else - bool alreadyOpen=wxClipboardOpen(); - if (!alreadyOpen) - { - wxOpenClipboard(); - if (!wxEmptyClipboard()) - { - wxCloseClipboard(); - return; - } - } - - GetTextFromRange( mSelectionStart, mSelectionEnd, &text, len ); - - wxString s( text, len ); - - bool success = ::wxEmptyClipboard(); - - success = wxSetClipboardData( wxDF_TEXT, (wxObject*)s.c_str(), 0,0 ); - - FreeCharacters( text ); - - wxCloseClipboard(); - -#endif - } -} - -bool wxTextEditorModel::CanCopy() -{ - return !SelectionIsEmpty(); -} - -bool wxTextEditorModel::CanPaste() -{ - if ( mIsReadOnly ) return FALSE; - -#ifndef __HACK_MY_MSDEV40__ - - if ( !wxTheClipboard->Open() ) return FALSE; - - if ( !wxTheClipboard->IsSupported(wxDF_TEXT) ) - return FALSE; - - wxTheClipboard->Close(); - - return TRUE; - -#else - - bool success = ::wxClipboardOpen(); - - bool alreadyOpen=wxClipboardOpen(); - if (!alreadyOpen) - { - wxOpenClipboard(); - } - - char* data = (char*)::wxGetClipboardData( wxDF_TEXT ); - - wxCloseClipboard(); - - if ( data != NULL && strlen(data) != 0 ) - { - delete [] data; - return TRUE; - } - else - { - delete [] data; - return FALSE; - } - -#endif - -} - -bool wxTextEditorModel::CanUndo() -{ - return !( mCommands.size() == 0 || - mCurCommand == 0 ); -} - -bool wxTextEditorModel::CanRedo() -{ - return mCurCommand != mCommands.size(); -} - -void wxTextEditorModel::OnUndo() -{ - if ( !CanUndo() ) return; - - PrepreForCommand(); - StartBatch(); - - ResetSelection(); - - UndoImpl(); - - FinishBatch(); - NotifyAllViews(); -} - -void wxTextEditorModel::OnRedo() -{ - if ( !CanRedo() ) return; - - PrepreForCommand(); - StartBatch(); - - ResetSelection(); - - RedoImpl(); - - FinishBatch(); - NotifyAllViews(); -} - -void wxTextEditorModel::OnMoveLeft() -{ - PrepreForCommand(); - CheckSelection(); - - if ( mCursorPos.mCol == 0 ) - { - if ( mCursorPos.mRow != 0 ) - { - --mCursorPos.mRow; - - TTextIterator iter = CreateIterator( mCursorPos ); - - iter.ToEndOfLine(); - - mCursorPos.mCol = iter.GetPosition().mCol; - } - } - else - --mCursorPos.mCol; - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnMoveRight() -{ - PrepreForCommand(); - CheckSelection(); - - ++mCursorPos.mCol; - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnMoveUp() -{ - PrepreForCommand(); - CheckSelection(); - - if ( mCursorPos.mRow != 0 ) - - DoMoveCursor( -1,0 ); - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnMoveDown() -{ - PrepreForCommand(); - CheckSelection(); - - if ( mCursorPos.mRow + 1 < GetTotalRowCount() ) - - DoMoveCursor( 1,0 ); - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnWordRight() -{ - PrepreForCommand(); - CheckSelection(); - - TTextIterator iter = CreateIterator( mCursorPos ); - - iter.NextWord(); - - mCursorPos = iter.GetPosition(); - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnWordLeft() -{ - PrepreForCommand(); - CheckSelection(); - - TTextIterator iter = CreateIterator( mCursorPos ); - - iter.PreviousWord(); - - mCursorPos = iter.GetPosition(); - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnMoveToPosition( const TPosition& pos ) -{ - PrepreForCommand(); - CheckSelection(); - - mCursorPos = pos; - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnEndOfLine() -{ - PrepreForCommand(); - CheckSelection(); - - TTextIterator iter = CreateIterator( mCursorPos ); - iter.ToEndOfLine(); - - mCursorPos = iter.GetPosition(); - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnStartOfLine() -{ - PrepreForCommand(); - CheckSelection(); - - int prevCol = mCursorPos.mCol; - - TTextIterator iter = CreateIterator( mCursorPos ); - iter.ToStartOfLine(); - - // bypass leading white-space at the begining of the line - - while( !iter.IsEol() ) - { - char ch = iter.GetChar(); - - if ( ch != ' ' && ch != '\t' ) break; - - ++mCursorPos.mCol; - - iter.NextChar(); - } - - mCursorPos = iter.GetPosition(); - - if ( mCursorPos.mCol == prevCol ) - - mCursorPos.mCol = 0; - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnPageUp() -{ - PrepreForCommand(); - CheckSelection(); - - if ( mCursorPos.mRow < mRowsPerPage ) - - mCursorPos.mRow = 0; - else - DoMoveCursor( -mRowsPerPage,0 ); - - mpActiveView->ScrollView( -(int)mRowsPerPage, 0 ); - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnPageDown() -{ - PrepreForCommand(); - CheckSelection(); - - if ( mCursorPos.mRow + mRowsPerPage >= GetTotalRowCount() ) - { - if ( GetTotalRowCount() != 0 ) - - mCursorPos.mRow = GetTotalRowCount() - 1; - else - mCursorPos.mRow = 0; - } - else - DoMoveCursor( mRowsPerPage,0 ); - - mpActiveView->ScrollView( mRowsPerPage, 0 ); - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnSlideUp() -{ - PrepreForCommand(); - - if ( mpActiveView->GetPagePos().mRow + mRowsPerPage - 1 == mCursorPos.mRow ) - { - if ( mCursorPos.mRow == 0 ) - - return; - - DoMoveCursor( -1,0 ); - } - - mpActiveView->ScrollView( -1, 0 ); - - NotifyView(); -} - -void wxTextEditorModel::OnSlideDown() -{ - PrepreForCommand(); - - if ( mCursorPos.mRow == mpActiveView->GetPagePos().mRow ) - { - if ( mCursorPos.mRow + 1 >= GetTotalRowCount() ) - - return; - - DoMoveCursor( 1,0 ); - } - - mpActiveView->ScrollView( 1, 0 ); - - NotifyView(); -} - -void wxTextEditorModel::OnStartOfText() -{ - PrepreForCommand(); - CheckSelection(); - - mCursorPos.mRow = mCursorPos.mCol = 0; - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnEndOfText() -{ - PrepreForCommand(); - CheckSelection(); - - mCursorPos.mRow = GetTotalRowCount() - 1; - - TTextIterator iter = CreateIterator( mCursorPos ); - - iter.ToEndOfLine(); - - mCursorPos = iter.GetPosition(); - - TrackSelection(); - NotifyView(); -} - -void wxTextEditorModel::OnSelectWord() -{ - PrepreForCommand(); - - TTextIterator iter1 = CreateIterator( mCursorPos ); - iter1.GotoClosestPos(); - - if ( mCursorPos == iter1.GetPosition() ) - { - TTextIterator iter2 = iter1; - - // find the left-edge of the word - - bool wasSeparator = TTextIterator::IsSeparator( iter1.GetChar() ); - - while( !iter1.IsEol() ) - { - char ch = iter1.GetChar(); - - if ( ch == '\t' || - ch == ' ' || - wasSeparator != TTextIterator::IsSeparator( iter1.GetChar() ) - ) - { - iter1.NextChar(); - break; - } - - iter1.PreviousChar(); - } - - // find the left-edge of the word - - while( !iter2.IsEol() ) - { - char ch = iter2.GetChar(); - - if ( ch == '\t' || - ch == ' ' || - wasSeparator != TTextIterator::IsSeparator( iter2.GetChar() ) - ) - break; - - iter2.NextChar(); - } - - if ( !(iter1.GetPosition() == iter2.GetPosition()) ) - { - mSelectionStart = iter1.GetPosition(); - mSelectionEnd = iter2.GetPosition(); - mCursorPos = iter2.GetPosition(); - - NotifyTextChanged( mSelectionStart.mRow, 1, CT_MODIFIED ); - } - } - - NotifyView(); -} - -void wxTextEditorModel::OnSelectAll() -{ - PrepreForCommand(); - - ResetSelection(); - - mSelectionStart = TPosition(0,0); - mSelectionEnd = TPosition( GetTotalRowCount(), 1024 ); // FOR NOW:: hack - - mCursorPos = mSelectionStart; - - NotifyTextChanged( mSelectionStart.mRow, mSelectionEnd.mRow, CT_MODIFIED ); - - NotifyView(); -} - -void wxTextEditorModel::OnToggleBookmark() -{ - size_t curRow = GetCursor().mRow; - - if ( GetPinAt( curRow, TBookmarkPin::GetPinTypeCode() ) != NULL ) - - RemovePinAt( curRow, TBookmarkPin::GetPinTypeCode() ); - else - AddPin( new TBookmarkPin( curRow ) ); - - MergeChange( curRow, 1 ); - - NotifyAllViews(); -} - -void wxTextEditorModel::OnNextBookmark() -{ - size_t pinNo = FindNextPinFrom( mCursorPos.mRow + 1 ); - - while( pinNo != NPOS ) - { - TPinBase& pin = *mPins[pinNo]; - - if ( pin.mTypeCode == BOOKMARK_PIN_TC ) - { - OnGotoLine( pin.mRow, 0 ); - break; - } - - if ( pinNo == mPins.size() ) break; - - ++pinNo; - } -} - -void wxTextEditorModel::OnPreviousBookmark() -{ - if ( mCursorPos.mRow == 0 ) return; - - size_t pinNo = FindPreviousPinFrom( mCursorPos.mRow - 1 ); - - while( pinNo != NPOS ) - { - TPinBase& pin = *mPins[pinNo]; - - if ( pin.mTypeCode == BOOKMARK_PIN_TC ) - { - OnGotoLine( pin.mRow, 0 ); - break; - } - - if ( pinNo == 0 ) break; - - --pinNo; - } -} - -bool wxTextEditorModel::OnFind() -{ - if ( !SelectionIsEmpty() ) - { - if ( GetStartOfSelection().mRow == GetEndOfSelection().mRow ) - { - char* buf = NULL; size_t len = 0; - - GetSelection( &buf, len ); - - mLastFindExpr = string( buf, 0, len ); - - delete [] buf; - } - } - - wxFindTextDialog dlg( GetActiveView(), mLastFindExpr ); - //dlg.SetExpr( mLastFindExpr ); - - if( dlg.ShowModal() == wxID_OK ) - { - mLastFindExpr = dlg.GetExpr(); - - GetActiveView()->SetFocus(); - - return OnFindNext(); - } - - GetActiveView()->SetFocus(); - - return FALSE; -} - -bool wxTextEditorModel::OnFindNext() -{ - PrepreForCommand(); - - string& val = mLastFindExpr; - size_t len = val.length(); - - if ( len == 0 ) - { - NotifyView(); - wxMessageBox( "Secarch string not found!" ); - - GetActiveView()->SetFocus(); - - return FALSE; - } - - char ch1 = val[0]; - - TTextIterator iter = CreateIterator( mCursorPos ); - - while( !iter.IsEof() ) - { - char ch = iter.GetChar(); - - if ( ch == ch1 ) - { - size_t startCol = iter.mPos.mCol; - iter.NextChar(); - ch = iter.GetChar(); - - size_t i = 1; - while( i < len && !iter.IsEof() && ch == val[i] ) - { - ++i; - iter.NextChar(); - ch = iter.GetChar(); - } - - if ( i == len ) - { - if ( !SelectionIsEmpty() ) - - ResetSelection(); - - SetStartOfSelection( TPosition( iter.mPos.mRow, startCol ) ); - SetEndOfSelection( iter.mPos ); - - MergeChange( iter.mPos.mRow, 1 ); - - mCursorPos = iter.mPos; - - OnGotoLine( iter.mPos.mRow, iter.mPos.mCol ); - return TRUE; - } - } - else - iter.NextChar(); - } - - NotifyView(); - MergeChange( mCursorPos.mRow, 2 ); - wxMessageBox( "Secarch string not found!" ); - - GetActiveView()->SetFocus(); - - return FALSE; -} - -bool wxTextEditorModel::OnFindPrevious() -{ - // TBD:: - return FALSE; -} - -void wxTextEditorModel::OnGotoLine( int line, int col ) -{ - if ( mpActiveView == NULL ) return; - - TPosition pagePos = mpActiveView->GetPagePos(); - - if ( line >= pagePos.mRow && - line < pagePos.mRow + mRowsPerPage ) - { - mCursorPos.mRow = (size_t)line; - mCursorPos.mCol = (size_t)col; - - if ( col == - 1) - { - mCursorPos.mCol = 0; - OnStartOfLine(); - } - else - NotifyView(); - - return; - } - - size_t third = mRowsPerPage / 3; - size_t newTop = 0; - - if ( line < third ) - - newTop = 0; - else - newTop = line - third; - - - mpActiveView->ScrollView( (int)newTop - (int)pagePos.mRow, -(int)pagePos.mCol ); - - mCursorPos.mRow = line; - mCursorPos.mCol = col; - - if ( col == - 1) - { - mCursorPos.mCol = 0; - OnStartOfLine(); - } - else - NotifyView(); -} - -void wxTextEditorModel::OnGotoLine() -{ - wxTextEntryDialog* dlg = - new wxTextEntryDialog( mpActiveView, "Line number:", "Goto line", "" ); - - int nTries = 3; - - while( dlg->ShowModal() == wxID_OK && nTries ) - { - ResetSelection(); - - int i = -1; - sscanf( dlg->GetValue(), "%d", &i ); - - if ( i == -1 ) - { - wxMessageBox( "Please enter a number" ); - continue; - } - - - if ( i == 0 ) ++i; - - OnGotoLine( (size_t)(i-1), 0 ); - break; - - --nTries; - } - - GetActiveView()->SetFocus(); -} - - -bool wxTextEditorModel::IsReadOnly() -{ - return mIsReadOnly; -} - -bool wxTextEditorModel::IsModified() -{ - return mCurCommand != 0; -} - -bool wxTextEditorModel::IsInsertMode() -{ - return mInsertMode; -} - -void wxTextEditorModel::SetCheckpoint() -{ - mCheckPointDestroyed = FALSE; - mCheckPointCmdNo = mCurCommand; -} - -bool wxTextEditorModel::CheckpointModified() -{ - if ( mCheckPointDestroyed ) return TRUE; - - return mCheckPointCmdNo != mCurCommand; -} - -TPosition wxTextEditorModel::GetStartOfSelection() -{ - ArrangePositions( mSelectionStart, mSelectionEnd ); - - return mSelectionStart; -} - -TPosition wxTextEditorModel::GetEndOfSelection() -{ - ArrangePositions( mSelectionStart, mSelectionEnd ); - - return mSelectionEnd; -} - -TPosition wxTextEditorModel::GetCursor() -{ - return mCursorPos; -} - -void wxTextEditorModel::SetStartOfSelection( const TPosition& pos ) -{ - mSelectionStart = pos; -} - -void wxTextEditorModel::SetEndOfSelection( const TPosition& pos ) -{ - mSelectionEnd = pos; -} - -void wxTextEditorModel::SetCursor( const TPosition& pos ) -{ - mCursorPos = pos; -} - -void wxTextEditorModel::AddView( wxTextEditorView* pView ) -{ - mViews.push_back( pView ); - pView->SetModel( this ); -} - -void wxTextEditorModel::RemoveView( wxTextEditorView* pView ) -{ - for( size_t i = 0; i != mViews.size(); ++i ) - - if ( mViews[i] == pView ) - { - mViews.erase( & mViews[i] ); - return; - } -} - -void wxTextEditorModel::SetActiveView( wxTextEditorView* pView ) -{ - mpActiveView = pView; -} - -wxTextEditorView* wxTextEditorModel::GetActiveView() -{ - return mpActiveView; -} - -void wxTextEditorModel::SetRowsPerPage( size_t n ) -{ - mRowsPerPage = n; -} - -void wxTextEditorModel::AddPin( TPinBase* pPin ) -{ - // FIXME:: binary search should be used - - size_t beforePin = FindNextPinFrom( pPin->mRow ); - - if ( beforePin != NPOS ) - { - // pins in the same row are ordered in the - // descending order of their type-codes - - while( beforePin < mPins.size() && - mPins[beforePin]->mRow == pPin->mRow && - mPins[beforePin]->mTypeCode < pPin->mTypeCode ) - - ++beforePin; - - if ( beforePin < mPins.size() ) - - mPins.insert( &mPins[beforePin], pPin ); - else - mPins.push_back( pPin ); - } - else - mPins.push_back( pPin ); -} - -PinListT& wxTextEditorModel::GetPins() -{ - return mPins; -} - -size_t wxTextEditorModel::FindFirstPinInRange( size_t fromRow, size_t tillRow ) -{ - // FIXME:: pefrom binary search instead - - for( size_t i = 0; i != mPins.size(); ++i ) - { - TPinBase& pin = *mPins[i]; - - if ( pin.mRow >= tillRow ) return NPOS; - - if ( pin.mRow >= fromRow ) - - return i; - } - - return NPOS; -} - -size_t wxTextEditorModel::FindNextPinFrom( size_t fromRow ) -{ - // FIXME:: pefrom binary search instead - - for( size_t i = 0; i != mPins.size(); ++i ) - { - TPinBase& pin = *mPins[i]; - - if ( pin.mRow >= fromRow ) - - return i; - } - - return NPOS; - -} - -size_t wxTextEditorModel::FindPreviousPinFrom( size_t fromRow ) -{ - // FIXME:: pefrom binary search instead - - if ( mPins.size() == 0 ) return NPOS; - - size_t i = mPins.size() - 1; - - for(;;) - { - TPinBase& pin = *mPins[i]; - - if ( pin.mRow <= fromRow ) - - return i; - - if ( i == 0 ) break; - - --i; - } - - return NPOS; -} - -size_t wxTextEditorModel::GetPinNoAt( size_t row, int pinTypeCode ) -{ - size_t curPin = FindNextPinFrom( row ); - - while( curPin != NPOS ) - { - TPinBase& pin = *mPins[curPin]; - - if ( pin.mRow > row ) return NPOS; - - if ( pin.mTypeCode == pinTypeCode ) return curPin; - - ++curPin; - - if ( curPin == mPins.size() ) return NPOS; - } - - return NPOS; -} - -TPinBase* wxTextEditorModel::GetPinAt( size_t row, int pinTypeCode ) -{ - size_t pinNo = GetPinNoAt( row, pinTypeCode ); - - return ( pinNo == NPOS ) ? NULL : mPins[pinNo]; -} - -void wxTextEditorModel::RemovePinAt( size_t row, int pinTypeCode ) -{ - size_t pinNo = GetPinNoAt( row, pinTypeCode ); - - if ( pinNo != NPOS ) - - mPins.erase( &mPins[pinNo] ); -} - -void wxTextEditorModel::AddChangeListener( TTextChangeListenerBase* pListener ) -{ - mChangeListeners.push_back( pListener ); -} - -/***** Implementation for class wxTextEditorView *****/ - -BEGIN_EVENT_TABLE( wxTextEditorView, wxScrolledWindow ) - - EVT_SIZE ( wxTextEditorView::OnSize ) -#if (( wxVERSION_NUMBER < 2100 ) || (( wxVERSION_NUMBER == 2100 ) && (wxBETA_NUMBER <= 4))) - EVT_SCROLL( wxTextEditorView::OnScroll ) -#else - EVT_SCROLLWIN( wxTextEditorView::OnScroll ) -#endif - EVT_PAINT ( wxTextEditorView::OnPaint ) - - EVT_LEFT_DOWN ( wxTextEditorView::OnLButtonDown ) - EVT_LEFT_UP ( wxTextEditorView::OnLButtonUp ) - EVT_MOTION ( wxTextEditorView::OnMotion ) - EVT_LEFT_DCLICK( wxTextEditorView::OnDblClick ) - - EVT_SET_FOCUS ( wxTextEditorView::OnSetFocus ) - EVT_KILL_FOCUS ( wxTextEditorView::OnKillFocus ) - - EVT_CHAR( wxTextEditorView::OnChar ) - EVT_KEY_DOWN( wxTextEditorView::OnKeyDown ) - - EVT_ERASE_BACKGROUND( wxTextEditorView::OnEraseBackground ) - - -END_EVENT_TABLE() - -TCursorTimer* wxTextEditorView::mpTimer = new TCursorTimer(); - -wxTextEditorView::wxTextEditorView( wxWindow* parent, - wxWindowID id, - wxTextEditorModel* pModel, - int wndStyle, - bool ownsModel ) - - : wxScrolledWindow( parent, id, wxPoint(32768,32768), wxSize(0,0), - wxHSCROLL | wxVSCROLL | wndStyle - ), - mPagePos( 0,0 ), - mDragStarted( FALSE ), - mpDraggedText( NULL ), - mAdjustScrollPending( FALSE ), - mLTMode( FALSE ), - mMaxColumns( 500 ), - - mScrollingOn( TRUE ), - mCursorOn ( TRUE ), - mOwnsModel ( ownsModel ), - - mLastRowsTotal( (size_t)(-1) ) -{ - SetModel( pModel ); - - SetTextDefaults(); - - SetSourcePainter( new SourcePainter() ); - - mCashedIter.mPos = TPosition( (size_t)(-1), 0 ); - - // default - AddPinPainter( new TBookmarkPainter() ); -} - -wxTextEditorView::~wxTextEditorView() -{ - if ( mpTimer->GetView() == this && - mCursorOn && !mLTMode ) - { - mpTimer->SetView( NULL ); - mpTimer->HideCursor( TRUE ); - } - - if ( mOwnsModel && mpModel ) - - delete mpModel; -} - -void wxTextEditorView::SetTextDefaults() -{ - mLeftMargin = 22; - mRightMargin = 0; - mTopMargin = 0; - mBottomMargin = 0; - - mCharDim.x = -1; // not detected yet - mCharDim.y = -1; - - mNormalTextCol = *wxBLACK; - mIndentifierTextCol = *wxBLUE; - mReservedWordTextCol = *wxRED; - mCommentTextCol = wxColour( 0,128,128 ); - - mNormalBkCol = wxColour(255,255,255);//*wxWHITE;//wxColour( 128,220,128 ); - mSelectionFgCol = wxColour(255,255,255);//*wxWHITE; - mSelectionBkCol = wxColour( 0,0,128 ); - - mNormalBkBrush = wxBrush( mNormalBkCol, wxSOLID ); - mSelectedBkBrush = wxBrush( mSelectionBkCol, wxSOLID ); - -#if defined(__WXMSW__) || defined(__WINDOWS__) - mFont.SetFaceName("Fixedsys"); - mFont.SetStyle(40); - mFont.SetWeight(40); - mFont.SetPointSize( 11); -#else - //mFont.SetFamily( wxSWISS ); - mFont = wxSystemSettings::GetSystemFont(wxSYS_OEM_FIXED_FONT); -#endif - - -#if defined(__WXMSW__) || defined(__WINDOWS__) - mFont.RealizeResource(); -#endif - - // reduce flicker un wxGtk - SetBackgroundColour( mNormalBkCol ); -} - -void wxTextEditorView::SetColours( const wxColour& normalBkCol, - const wxColour& selectedBkCol, - const wxColour& selectedTextCol ) -{ - mNormalBkCol = normalBkCol; - mSelectionFgCol = selectedTextCol; - mSelectionBkCol = selectedBkCol; - - mNormalBkBrush = wxBrush( mNormalBkCol, wxSOLID ); - mSelectedBkBrush = wxBrush( mSelectionBkCol, wxSOLID ); -} - -void wxTextEditorView::SetHeighlightingColours( const wxColour& normalTextCol, - const wxColour& identifierTextCol, - const wxColour& reservedWordTextCol, - const wxColour& commentTextCol ) -{ - mNormalTextCol = normalTextCol; - mIndentifierTextCol = identifierTextCol; - mReservedWordTextCol = reservedWordTextCol; - mCommentTextCol = commentTextCol; -} - -void wxTextEditorView::SetMargins( int top, int left, int bottom, int right ) -{ - mLeftMargin = left; - mRightMargin = right; - mTopMargin = top; - mBottomMargin = bottom; -} - -void wxTextEditorView::RecalcPagingInfo() -{ - bool firstRefresh = mCharDim.x == -1; - - if ( firstRefresh ) - - ObtainFontProperties(); - - int w = 0, h = 0; - GetClientSize( &w, &h ); - - w -= mLeftMargin + mRightMargin; - h -= mTopMargin + mBottomMargin; - - mColsPerPage = ( ( w / mCharDim.x ) + - ( ( w % mCharDim.x ) ? 0 : 0 ) ); - - - mRowsPerPage = ( ( h / mCharDim.y ) + - ( ( h % mCharDim.y ) ? 0 : 0 ) ); - - if ( mpModel->GetActiveView() == this ) - - mpModel->SetRowsPerPage( mRowsPerPage ); - - if ( firstRefresh ) - { - // scrolling should not happen at DC-level - EnableScrolling( FALSE, FALSE ); - - if ( mScrollingOn ) - - SetScrollbars( mCharDim.x, mCharDim.y, - mMaxColumns, - mpModel->GetTotalRowCount(), - mPagePos.mCol, - mPagePos.mRow, - TRUE - ); - } - - PositionCursor(); -} - -#if (( wxVERSION_NUMBER < 2100 ) || (( wxVERSION_NUMBER == 2100 ) && (wxBETA_NUMBER <= 4))) - // this changed in ver 2.1 -void wxTextEditorView::OnScroll( wxScrollEvent& event ) -#else -void wxTextEditorView::OnScroll( wxScrollWinEvent& event ) -#endif -{ - if ( !mScrollingOn ) return; - - // overriden implementation of wxScrolledWindow::OnScroll, - // to reduce flicker on wxGtk, by using wxClientDC - // instead of Refresh() - - int orient = event.GetOrientation(); - - int nScrollInc = CalcScrollInc(event); - if (nScrollInc == 0) return; - - if (orient == wxHORIZONTAL) - { - int newPos = m_xScrollPosition + nScrollInc; - SetScrollPos(wxHORIZONTAL, newPos, TRUE ); - } - else - { - int newPos = m_yScrollPosition + nScrollInc; - SetScrollPos(wxVERTICAL, newPos, TRUE ); - } - - if (orient == wxHORIZONTAL) - { - m_xScrollPosition += nScrollInc; - } - else - { - m_yScrollPosition += nScrollInc; - } - - int x,y; - ViewStart( &x, &y ); - - mPagePos.mRow = y; - mPagePos.mCol = x; - - PositionCursor(); - - if ( mAdjustScrollPending ) - { - mLastRowsTotal = mpModel->GetTotalRowCount(); - SetScrollbars( mCharDim.x, mCharDim.y, - mMaxColumns, // FOR NOW:: maximal line-length not calculated - mLastRowsTotal, - mPagePos.mCol, - mPagePos.mRow, - TRUE - ); - - mLastViewStart = mPagePos; - - mAdjustScrollPending = FALSE; - - return; - } - - wxClientDC dc( this ); - - mFullRefreshPending = TRUE; - - PaintRows( mPagePos.mRow, mPagePos.mRow + mRowsPerPage, dc ); -} - -void wxTextEditorView::OnPaint( wxPaintEvent& event ) -{ - //wxScrolledWindow::OnPaint( event ); - if ( mCharDim.x == -1 ) ObtainFontProperties(); - - wxPaintDC dc( this ); - - mFullRefreshPending = TRUE; - - PaintRows( mPagePos.mRow, mPagePos.mRow + mRowsPerPage, dc ); -} - -void wxTextEditorView::OnSize( wxSizeEvent& event ) -{ - RecalcPagingInfo(); - - SyncScrollbars(); - - event.Skip(); -} - -void wxTextEditorView::OnEraseBackground( wxEraseEvent& event ) -{ -#if 0 - int w = 0, h = 0; - - GetClientSize( &w, &h ); - - wxPaintDC dc( this ); - - dc.SetPen( *wxTRANSPARENT_PEN ); - dc.SetBrush( *wxWHITE_BRUSH ); - dc.DrawRectangle( 0,0, w,h ); -#endif -} - -void wxTextEditorView::OnLButtonDown( wxMouseEvent& event ) -{ - if ( mDragStarted ) return; - - mDragStarted = TRUE; - - TPosition textPos; - PixelsToTextPos( event.m_x, event.m_y, textPos ); - - mpModel->SetSelectionEditMode( FALSE ); - - mpModel->OnMoveToPosition( textPos ); - - mpModel->SetSelectionEditMode( TRUE ); - - SetFocus(); - - CaptureMouse(); -} - -void wxTextEditorView::OnLButtonUp( wxMouseEvent& event ) -{ - if ( mDragStarted ) - { - OnMotion( event ); // simulate last motion event - - mpModel->SetSelectionEditMode( FALSE ); - - ReleaseMouse(); - mDragStarted = FALSE; - } -} - -void wxTextEditorView::OnMotion( wxMouseEvent& event ) -{ - if ( mDragStarted ) - { - TPosition textPos; - - if ( event.m_y < 0 && mpModel->GetCursor().mRow == 0 ) - - event.m_y = 0; - - PixelsToTextPos( event.m_x, event.m_y, textPos ); - - mpModel->OnMoveToPosition( textPos ); - } -} - -void wxTextEditorView::OnDblClick( wxMouseEvent& event ) -{ - event.Skip(); - mpModel->OnSelectWord(); -} - -void wxTextEditorView::OnSetFocus( wxFocusEvent& event ) -{ - if ( !mLTMode && mCursorOn ) - { - mpTimer->SetView( this ); - mpTimer->ShowCursor( TRUE ); - } -} - -void wxTextEditorView::OnKillFocus( wxFocusEvent& event ) -{ - if ( !mLTMode && mCursorOn ) - { - mpTimer->HideCursor( TRUE ); - mpTimer->SetView( NULL ); - } -} - -void wxTextEditorView::HoldCursor( bool hold ) -{ - if ( mLTMode || !mCursorOn ) return; - - if ( !hold ) - { - if ( wxWindow::FindFocus() != this ) - { - mpTimer->HideCursor(); - mpTimer->SetView( NULL ); - } - } - else - { - mpTimer->SetView( this ); - mpTimer->ShowCursor(); - } -} - -void wxTextEditorView::OnKeyDown( wxKeyEvent& event ) -{ - // FOR NOW:: hard-coded key-bindings - - mpModel->SetSelectionEditMode( event.ShiftDown() ); - - if ( event.ControlDown() ) - { - if ( event.m_keyCode == WXK_LEFT ) - - mpModel->OnWordLeft(); - else - if ( event.m_keyCode == WXK_RIGHT ) - - mpModel->OnWordRight(); - else - if ( event.m_keyCode == WXK_UP ) - - mpModel->OnSlideUp(); - else - if ( event.m_keyCode == WXK_DOWN ) - - mpModel->OnSlideDown(); - else - if ( event.m_keyCode == WXK_HOME ) - - mpModel->OnStartOfText(); - else - if ( event.m_keyCode == WXK_END ) - - mpModel->OnEndOfText(); - else - if ( event.m_keyCode == WXK_INSERT ) - - mpModel->OnCopy(); - else - event.Skip(); - - /* - else - if ( event.m_keyCode == WXK_NEXT ) - - mpModel->(); - else - if ( event.m_keyCode == WXK_PRIOR ) - - mpModel->(); - */ - } - else - { - if ( event.m_keyCode == WXK_LEFT ) - - mpModel->OnMoveLeft(); - else - if ( event.m_keyCode == WXK_RIGHT ) - - mpModel->OnMoveRight(); - else - if ( event.m_keyCode == WXK_UP ) - - mpModel->OnMoveUp(); - else - if ( event.m_keyCode == WXK_DOWN ) - - mpModel->OnMoveDown(); - else - if ( event.m_keyCode == WXK_HOME ) - - mpModel->OnStartOfLine(); - else - if ( event.m_keyCode == WXK_END ) - - mpModel->OnEndOfLine(); - else - if ( event.m_keyCode == WXK_NEXT ) - - mpModel->OnPageDown(); - else - if ( event.m_keyCode == WXK_PRIOR ) - - mpModel->OnPageUp(); - else - if ( event.m_keyCode == WXK_DELETE ) - - mpModel->OnDelete(); - else - if ( event.m_keyCode == WXK_INSERT && event.ShiftDown() ) - - mpModel->OnPaste(); - else - event.Skip(); - } -} - -void wxTextEditorView::OnChar( wxKeyEvent& event ) -{ - if ( event.ControlDown() ) - { - if ( event.m_keyCode == 'y' ) - - mpModel->OnDeleteLine(); - else - if ( event.m_keyCode == 'v' ) - - mpModel->OnPaste(); - else - if ( event.m_keyCode == 'c' ) - - mpModel->OnCopy(); - else - if ( event.m_keyCode == 'z' ) - - mpModel->OnUndo(); - else - if ( event.m_keyCode == 'a' ) - - mpModel->OnRedo(); - else - event.Skip(); - } - else - if ( event.AltDown() ) - { - if ( event.m_keyCode == WXK_BACK ) - - mpModel->OnUndo(); - else - event.Skip(); - } - else - if ( event.m_keyCode == WXK_BACK ) - - mpModel->OnDeleteBack(); - else - if ( event.m_keyCode == WXK_TAB && event.ShiftDown() ) - - mpModel->OnShiftSelectionIndent( TRUE ); - else - { - if ( !mpModel->SelectionIsEmpty() && event.m_keyCode == WXK_TAB ) - - mpModel->OnShiftSelectionIndent( FALSE ); - else - mpModel->OnInsertChar( event.m_keyCode ); - } -} - -void wxTextEditorView::SetModel( wxTextEditorModel* pModel ) -{ - mpModel = pModel; - mSelectionStart = pModel->GetStartOfSelection(); - mSelectionEnd = pModel->GetEndOfSelection(); - mCursorPos = pModel->GetCursor(); -} - -void wxTextEditorView::SetSourcePainter( SourcePainter* pPainter ) -{ - mpPainter = pPainter; -} - -void wxTextEditorView::AddPinPainter( TPinPainterBase* pPainter ) -{ - mPinPainters.push_back( pPainter ); -} - -void wxTextEditorView::SetDefaultFont( const wxFont& font ) -{ - mFont = font; - -#if defined(__WXMSW__) || defined(__WINDOWS__) - mFont.RealizeResource(); -#endif - - mCharDim.x = -1; - mCharDim.y = -1; - - RecalcPagingInfo(); -} - -void wxTextEditorView::SetRowsPerPage( size_t n ) -{ - mpModel->SetRowsPerPage( n ); - - mRowsPerPage = n; - SyncScrollbars(); - PositionCursor(); -} - -void wxTextEditorView::SetMaxColumns( size_t n ) -{ - mMaxColumns = n; - - SyncScrollbars(); - PositionCursor(); -} - -wxFont& wxTextEditorView::GetDefaultFont() -{ - return mFont; -} - -void wxTextEditorView::SetLineTrackingMode( bool on, const wxColour& col ) -{ - mLTColour = col; - mLTMode = on; - - if ( mpTimer->GetView() == this ) - - mpTimer->HideCursor(); -} - -void wxTextEditorView::EnableCursor( bool enable ) -{ - mCursorOn = enable; -} - -void wxTextEditorView::EnableScrollbars( bool enable ) -{ - mScrollingOn = enable; -} - -bool wxTextEditorView::IsActiveView() -{ - return this == mpModel->GetActiveView(); -} - -void wxTextEditorView::PositionCursor() -{ - if ( !IsActiveView() || - mLTMode || !mCursorOn ) return; - - mpTimer->HideCursor(); - - TextPosToScreenPos( mpModel->GetCursor(), mCursorScrPos ); - - mpTimer->ShowCursor(); -} - -void wxTextEditorView::PixelsToScrPos( int x, int y, int& scrRow, int& scrCol ) -{ - x -= mLeftMargin; - y -= mTopMargin; - - //if ( x < 0 ) x = 0; // FOR NOW:: horizontal auto-scroll disabled - - scrCol = x / mCharDim.x; - scrRow = y / mCharDim.y; -} - -void wxTextEditorView::PixelsToTextPos( int x, int y, TPosition& textPos ) -{ - int scrRow = 0, scrCol = 0; - PixelsToScrPos( x, y, scrRow, scrCol ); - - if ( scrRow + (int)mPagePos.mRow < 0 ) - - scrRow = -(int)mPagePos.mRow; - - if ( scrCol + (int)mPagePos.mCol < 0 ) - - scrCol = -(int)mPagePos.mCol; - - ScreenPosToTextPos( TPosition( scrRow, scrCol ), textPos ); -} - -void wxTextEditorView::ScreenPosToPixels( const TPosition& scrPos, int& x, int& y ) -{ - x = mLeftMargin + scrPos.mCol * mCharDim.x; - y = mTopMargin + scrPos.mRow * mCharDim.y; -} - -void wxTextEditorView::TextPosToScreenPos( const TPosition& txtPos, TPosition& scrPos ) -{ - TTextIterator iter; - - if ( txtPos.mRow != mCashedIter.mPos.mRow ) - { - iter = mpModel->CreateIterator( txtPos ); - mCashedIter = iter; - } - else - { - iter = mCashedIter; - iter.mPos.mCol = txtPos.mCol; - } - - iter.ToStartOfLine(); - - size_t scrCol = 0; - size_t txtCol = 0; - - while( !iter.IsEol() && txtCol < txtPos.mCol ) - { - if ( iter.GetChar() == '\t' ) - { - size_t spacing = ( (scrCol / mpModel->mTabSize) + 1 ) * mpModel->mTabSize - scrCol; - - scrCol += spacing; - } - else - ++scrCol; - - ++txtCol; - iter.NextChar(); - } - - TPosition actualPos = iter.GetPosition(); - - scrCol += txtPos.mCol - txtCol; - - scrPos.mRow = actualPos.mRow - mPagePos.mRow; - scrPos.mCol = scrCol - mPagePos.mCol; -} - -void wxTextEditorView::ScreenPosToTextPos( const TPosition& scrPos, TPosition& txtPos ) -{ - TPosition absScrPos( scrPos.mRow + mPagePos.mRow, scrPos.mCol + mPagePos.mCol ); - - TTextIterator iter = mpModel->CreateIterator( TPosition( absScrPos.mRow, 0 ) ); - - size_t scrCol = 0; - size_t txtCol = 0; - - // iterate over all possible on-screen positions, and find one which matches "absScrPos" - - while( !iter.IsEol() && scrCol < absScrPos.mCol ) - { - if ( iter.GetChar() == '\t' ) - { - size_t spacing = ( (scrCol / mpModel->mTabSize) + 1 ) * mpModel->mTabSize - scrCol; - - scrCol += spacing; - } - else - ++scrCol; - - ++txtCol; - iter.NextChar(); - } - - TPosition actualPos = iter.GetPosition(); - - if ( scrCol == absScrPos.mCol ) - { - txtPos = actualPos; - return; - } - else - if ( scrCol < absScrPos.mCol ) - { - // the absScrPos points past the eol - - txtPos = actualPos; - txtPos.mCol += absScrPos.mCol - scrCol; - } - else - if ( scrCol > absScrPos.mCol ) - { - // there should have been a '\t' char, which made us jump too far forward - - txtPos = actualPos; - --txtPos.mCol; - } -} - -bool wxTextEditorView::IsClipboardCmd( wxKeyEvent& key ) -{ - if ( key.ControlDown() && key.m_keyCode == WXK_CONTROL ) - - return TRUE; - - if ( key.ShiftDown() && key.m_keyCode == WXK_SHIFT ) - - return TRUE; - - if ( key.ControlDown() ) - { - return ( key.m_keyCode == 'C' || - key.m_keyCode == 'c' || - key.m_keyCode == WXK_INSERT ); - } - - return FALSE; -} - -void wxTextEditorView::ObtainFontProperties() -{ - wxClientDC dc(this); - dc.SetFont( mFont ); - - long w,h; - - dc.GetTextExtent( "X", &w, &h ); - - mCharDim.x = w; - mCharDim.y = h; -} - -void wxTextEditorView::SyncViewPortPosition() -{ - - TPosition pos = mpModel->GetCursor(); - - TextPosToScreenPos( pos, pos ); - pos.mRow += mPagePos.mRow; - pos.mCol += mPagePos.mCol; - - if ( pos.mRow < mPagePos.mRow ) - { - mPagePos.mRow = pos.mRow; - mFullRefreshPending = TRUE; - } - else - if ( pos.mRow >= mPagePos.mRow + mRowsPerPage && mRowsPerPage != 0 ) - { - mPagePos.mRow = pos.mRow - mRowsPerPage + 1; - mFullRefreshPending = TRUE; - } - - if ( pos.mCol < mPagePos.mCol ) - { - mPagePos.mCol = pos.mCol; - mFullRefreshPending = TRUE; - } - else - if ( pos.mCol >= mPagePos.mCol + mColsPerPage ) - { - mPagePos.mCol = pos.mCol - mColsPerPage + 1; - mFullRefreshPending = TRUE; - } -} - -void wxTextEditorView::SyncScrollbars() -{ - if ( !mScrollingOn ) return; - - size_t nRows = mpModel->GetTotalRowCount(); - -#if !defined(__WINDOWS__) - - if ( mLastViewStart == mPagePos ) - { - if ( mLastRowsTotal != nRows ) - - mAdjustScrollPending = TRUE; - - return; - } -#else - if ( mLastViewStart == mPagePos && - mLastRowsTotal == nRows ) - - return; -#endif - SetScrollbars( mCharDim.x, mCharDim.y, - mMaxColumns, - nRows, - mPagePos.mCol, - mPagePos.mRow, - TRUE - ); - - mLastViewStart = mPagePos; - mLastRowsTotal = nRows; -} - -void wxTextEditorView::ScrollView( int rows, int cols ) -{ - int pageRow = (int)mPagePos.mRow; - int pageCol = (int)mPagePos.mCol; - - if ( pageRow + rows < 0 ) - pageRow = 0; - else - if ( pageRow + rows > (int)mpModel->GetTotalRowCount() ) - - pageRow = mpModel->GetTotalRowCount(); - else - pageRow = pageRow + rows; - - mPagePos.mRow = (size_t)pageRow; - - if ( pageCol + cols < 0 ) - - pageCol = 0; - else - pageCol = pageCol + cols; - - mPagePos.mCol = pageCol; - - mFullRefreshPending = TRUE; -} - -void wxTextEditorView::OnModelChanged() -{ - // invalidate pre-cached iterator - mCashedIter.mPos = TPosition( (size_t)(-1), 0 ); - - SyncViewPortPosition(); - - if ( mLTMode ) mFullRefreshPending = TRUE; - - if ( mpModel->mTextChanged && !mFullRefreshPending ) - { - wxClientDC dc( this ); - PaintRows( mpModel->mChangedFromRow, mpModel->mChangedTillRow, dc ); - } - else - if ( mFullRefreshPending ) - { - wxClientDC dc( this ); - PaintRows( mPagePos.mRow, mPagePos.mRow + mRowsPerPage, dc ); - } - - if ( IsActiveView() ) - { - PositionCursor(); - SyncScrollbars(); - } -} - -void wxTextEditorView::Activate() -{ - mpModel->SetStartOfSelection( mSelectionStart ); - mpModel->SetEndOfSelection( mSelectionEnd ); - mpModel->SetCursor( mCursorPos ); - - mpModel->SetRowsPerPage( mRowsPerPage ); - - if ( !mLTMode && mCursorOn ) - { - mpTimer->SetView( this ); - mpTimer->ShowCursor(); - } - - mpModel->SetActiveView( this ); -} - -void wxTextEditorView::Deactivate() -{ - mSelectionStart = mpModel->GetStartOfSelection(); - mSelectionEnd = mpModel->GetEndOfSelection(); - mCursorPos = mpModel->GetCursor(); - - if ( mpTimer->GetView() == this && - !mLTMode && mCursorOn ) - - mpTimer->HideCursor( TRUE ); -} - -/*** protected methods ***/ - -char* wxTextEditorView::mpLineBuffer = NULL; -size_t wxTextEditorView::mpLineBufferLen = 0; - -char* wxTextEditorView::GetLineBuffer( size_t len ) -{ - if ( mpLineBuffer == NULL || mpLineBufferLen < len ) - { - if ( !mpLineBuffer ) mpModel->FreeCharacters( mpLineBuffer ); - - mpLineBuffer = mpModel->AllocCharacters( len ); - - mpLineBufferLen = len; - } - - return mpLineBuffer; -} - -TPinPainterBase* wxTextEditorView::FindPainterForPin( TPinBase& pin ) -{ - int pinTc = pin.mTypeCode; - - for( size_t i = 0; i != mPinPainters.size(); ++i ) - - if ( mPinPainters[i]->mPinTypeCode == pinTc ) - - return mPinPainters[i]; - - return NULL; -} - -void wxTextEditorView::PaintDecorations( size_t fromRow, - size_t tillRow, - wxDC& dc, TTextIterator& iter ) -{ - int dcY = ( fromRow - mPagePos.mRow ) * mCharDim.y + mTopMargin; - - size_t curPin = mpModel->FindFirstPinInRange( fromRow, tillRow ); - - PinListT& pins = mpModel->GetPins(); - TPinPainterBase* pPainter = NULL; - - size_t prevRow = fromRow; - int prevY = dcY; - - wxPoint pos; - wxSize dim( mLeftMargin, mCharDim.y ); - - while( curPin != NPOS ) - { - TPinBase& pin = *pins[curPin]; - - if ( pPainter == NULL || - pPainter->mPinTypeCode != pin.mTypeCode ) - - pPainter = FindPainterForPin( pin ); - - - // only pins which have their painters can be "visualized" - - if ( pPainter ) - { - pos.x = 0; - pos.y = ( pin.mRow - mPagePos.mRow )* mCharDim.y + mTopMargin; - - if ( prevRow < pin.mRow ) - { - // fill upper gap - - dc.SetBrush( mNormalBkBrush ); - dc.SetPen( *wxTRANSPARENT_PEN ); - dc.DrawRectangle( 0, prevY, - mLeftMargin + 1, - mCharDim.y * ( pin.mRow - prevRow ) + 1 ); - } - - pPainter->DrawPin( &pin, *this, dc, pos, dim ); - - prevRow = pin.mRow + 1; - prevY = pos.y + mCharDim.y; - } - - ++curPin; - - if ( curPin >= pins.size() || - pins[curPin]->mRow >= tillRow ) - - break; - } - - // fill the reminder - - if ( prevRow < tillRow ) - { - dc.SetBrush( mNormalBkBrush ); - dc.SetPen( *wxTRANSPARENT_PEN ); - dc.DrawRectangle( 0, prevY, - mLeftMargin + 1, - mCharDim.y * ( tillRow - prevRow ) + 1 ); - } - - dc.SetPen( *wxTRANSPARENT_PEN ); -} - -void wxTextEditorView::PaintRows( size_t fromRow, size_t tillRow, wxDC& dc ) -{ - // NOTE:: raws are painted from "fromRow" but not including "tillRow" - [fromRow,tillRow) - - dc.SetPen( *wxTRANSPARENT_PEN ); - - // how much on-screen columns are visable? - - size_t fromScrCol = mPagePos.mCol; - size_t tillScrCol = fromScrCol + mColsPerPage; - - TPosition selStart = mpModel->GetStartOfSelection(); - TPosition selEnd = mpModel->GetEndOfSelection(); - - bool selectionIsEmpty = ( selStart == selEnd ); - - wxColour curFgCol; - wxColour curBkCol; - - wxBrush mLTBrush( mLTColour, wxSOLID ); - - // clip given row-region to the current page - - if ( ( fromRow >= mPagePos.mRow + mRowsPerPage) || - ( tillRow <= mPagePos.mRow ) - ) - - return; - - if ( fromRow < mPagePos.mRow ) fromRow = mPagePos.mRow; - if ( tillRow > mPagePos.mRow + mRowsPerPage ) tillRow = mPagePos.mRow + mRowsPerPage; - - if ( fromRow >= tillRow ) return; - - // now start the renderng - - if ( mpTimer->GetView() == this && mCursorOn && !mLTMode ) - { - mpTimer->Lock(); - mpTimer->SetIsShown( FALSE ); - } - - dc.SetFont( mFont ); - dc.SetBackgroundMode( wxSOLID ); - - TTextIterator iter = mpModel->CreateIterator( TPosition( fromRow, 0 ) ); - - PaintDecorations( fromRow, tillRow, dc, iter ); - - size_t cursorRow = mpModel->GetCursor().mRow; - - size_t curRow = fromRow; - for( ; curRow != tillRow; ++curRow ) - { - // place text into line-buffer - - iter.ToStartOfLine(); - size_t lineLen = iter.GetLineLen(); - - char* lineBuf = GetLineBuffer( lineLen + 1 ); - - size_t i = 0; - - while( !iter.IsEof() && !iter.IsEol() ) - { - lineBuf[i++] = iter.GetChar(); - iter.NextChar(); - } - - iter.NextChar(); // skip eol - - // obtain "highlights" - - mpPainter->SetState( FALSE, FALSE ); - mpPainter->Init( FALSE ); - mpPainter->ProcessSource( lineBuf, lineLen ); - IntListT& blocks = mpPainter->GetBlocks(); - - // setup state vars - - int dcY = ( curRow - mPagePos.mRow ) * mCharDim.y + mTopMargin; - - size_t scrCol = 0; - size_t txtCol = 0; - - size_t curBlk = 0; - size_t curBlkCol = 0; - - int chunkLen = -1; - size_t chunkTxtStart = 0; - size_t chunkScrStart = 0; - - // pre-detect occurance of selection - - bool lineHasSelection = ( selStart.mRow == curRow ) || - ( selEnd.mRow == curRow ); - - bool isInSelection = ( selStart.mRow <= curRow ) && - ( selEnd.mRow >= curRow ); - - if ( isInSelection && selStart.mRow == curRow && - selStart.mCol != 0 ) - - isInSelection = FALSE; - - if ( selStart == selEnd ) - { - lineHasSelection = FALSE; - isInSelection = FALSE; - } - - char ch = '\0'; - - // loop though the text in this row - - do - { - TPosition curPos( curRow, txtCol ); - - // first check if we can finish the current chunk - - bool finishChunk = FALSE; - - if ( curBlk < blocks.size() && - curBlkCol + get_src_block_len( blocks[curBlk] ) == txtCol ) - { - curBlkCol += get_src_block_len( blocks[curBlk] ); - ++curBlk; - finishChunk = TRUE; - } - else - if ( ( !selectionIsEmpty && ( curPos == selStart || curPos == selEnd ) ) - || lineBuf[txtCol] == '\t' - || txtCol == lineLen ) - - finishChunk = TRUE; - - if ( finishChunk && chunkLen != -1 ) - { - // is any part of the chunk visable? - - size_t chunkScrEnd = chunkScrStart + chunkLen; - - if ( ( // if hits from one side or is inside - ( chunkScrStart >= fromScrCol && - chunkScrStart < tillScrCol ) || - ( chunkScrEnd >= fromScrCol && - chunkScrEnd < tillScrCol ) ) || - - // if overlaps the whole range - ( chunkScrStart < fromScrCol && - chunkScrEnd >= tillScrCol ) - - ) - { - // render chunk data to the given DC - - dc.SetTextForeground( curFgCol ); - dc.SetTextBackground( curBkCol ); - - // clip left edge - - if ( chunkScrStart < fromScrCol ) - { - size_t diff = fromScrCol - chunkScrStart; - chunkLen -= diff; - chunkTxtStart += diff; - chunkScrStart += diff; - } - - // clip right edge - - if ( chunkScrEnd > tillScrCol ) - { - size_t diff = chunkScrEnd - tillScrCol; - chunkLen -= diff; - chunkScrEnd -= diff; - } - - // create string - - char tmp = lineBuf[chunkTxtStart + chunkLen]; - - lineBuf[chunkTxtStart + chunkLen] = '\0'; - - // use member-variable, reuse heap-buffer between outputs - mFragment = lineBuf + chunkTxtStart; - - lineBuf[chunkTxtStart + chunkLen] = tmp; - - // draw it - - int dcX = (chunkScrStart - fromScrCol) * mCharDim.x + mLeftMargin; - - dc.DrawText( mFragment, dcX, dcY ); - } - - chunkLen = -1; - - } // end of "if ( finishChunk )" - - if ( txtCol == lineLen ) - break; - - if ( chunkLen == -1 ) - { - // prepare the new chunk - - if ( curBlk < blocks.size() ) - { - switch( get_src_block_rank( blocks[curBlk] ) ) - { - case RANK_BLACK : curFgCol = mNormalTextCol; break; - case RANK_BLUE : curFgCol = mIndentifierTextCol; break; - case RANK_RED : curFgCol = mReservedWordTextCol; break; - case RANK_GREEN : curFgCol = mCommentTextCol; break; - default : break; - } - } - - // track occurence of selection - - if ( lineHasSelection ) - { - isInSelection = TRUE; - - if ( selEnd.mRow == curRow && - selEnd.mCol <= txtCol ) - - isInSelection = FALSE; - - if ( selStart.mRow == curRow && - selStart.mCol > txtCol ) - - isInSelection = FALSE; - } - - if ( isInSelection ) - { - curFgCol = mSelectionFgCol; - curBkCol = mSelectionBkCol; - } - else - { - if ( mLTMode && curRow == cursorRow ) - - curBkCol = mLTColour; - else - curBkCol = mNormalBkCol ; - } - - chunkScrStart = scrCol; - chunkTxtStart = txtCol; - chunkLen = 0; - } - - - ch = lineBuf[txtCol]; - - if ( ch == '\t' ) - { - // tab's are treated specially (for simplicity and speed) - - int dcX = (chunkScrStart - fromScrCol) * mCharDim.x + mLeftMargin; - - if ( !isInSelection ) - { - if ( mLTMode && curRow == cursorRow ) - - dc.SetBrush( mLTBrush ); - else - dc.SetBrush( mNormalBkBrush ); - } - else dc.SetBrush( mSelectedBkBrush ); - - // *** "the rule of TAB..." *** - - size_t spacing = ( (scrCol / mpModel->mTabSize) + 1 ) * mpModel->mTabSize - scrCol; - - int width = spacing * mCharDim.x + 1; - - if ( dcX < mLeftMargin ) - { - width -= mLeftMargin - dcX; - - dcX = mLeftMargin; - } - - if ( width > 0 ) - - dc.DrawRectangle( dcX, dcY, width, mCharDim.y + 1 ); - - scrCol += spacing; - txtCol += 1; - - // move chunk-start forward, after the occurance of '\t' - - chunkLen = -1; - } - else - { - // increase on-screen/in-text positions - - ++scrCol; - ++txtCol; - ++chunkLen; - } - - } while( TRUE ); - - // fill the reminding white-space after eol - - if ( scrCol < tillScrCol && - ( !isInSelection || - ( isInSelection && curRow == selEnd.mRow ) ) - ) - { - if ( scrCol < fromScrCol ) scrCol = fromScrCol; - - int dcX = ( scrCol - fromScrCol ) * mCharDim.x + mLeftMargin; - - if ( mLTMode && curRow == cursorRow ) - - dc.SetBrush ( mLTBrush ); - else - dc.SetBrush( mNormalBkBrush ); - - dc.DrawRectangle( dcX, dcY, - mCharDim.x * ( tillScrCol - scrCol ) + 1, - mCharDim.y + 1 ); - } - - // render selection which is located past the eol - - if ( ( lineHasSelection || isInSelection ) && - !( selEnd.mRow == curRow && selEnd.mCol <= txtCol ) - ) - { - // determine start of selection on-screen - - size_t scrSelStart = scrCol + ( selStart.mCol - txtCol ); - - if ( isInSelection ) - - scrSelStart = scrCol; - - size_t scrSelEnd = tillScrCol; - - if ( selEnd.mRow == curRow ) - - scrSelEnd = scrCol + ( selEnd.mCol - txtCol ); - - // clipping - - if ( scrSelStart < fromScrCol ) scrSelStart = fromScrCol; - if ( scrSelEnd > tillScrCol ) scrSelEnd = tillScrCol; - - // drawing - - if ( scrSelEnd > scrSelStart ) - { - int dcX = ( scrSelStart - fromScrCol ) * mCharDim.x + mLeftMargin; - - dc.SetBrush( mSelectedBkBrush ); - dc.DrawRectangle( dcX, dcY, - mCharDim.x * ( scrSelEnd - scrSelStart ) + 1, - mCharDim.y + 1 ); - } - } - - if ( iter.IsEof() ) - { - ++curRow; - break; - } - - } // end of "for(...)" - - if ( curRow < tillRow ) - { - dc.SetBrush( mNormalBkBrush ); - - int dcY = mTopMargin + (curRow - mPagePos.mRow)*mCharDim.y; - int dcX = mLeftMargin; - - dc.DrawRectangle( dcX, dcY, mColsPerPage*mCharDim.x + 1, - ( tillRow - curRow ) * mCharDim.y + 1 - ); - } - - if ( mFullRefreshPending ) - { - dc.SetBrush( mNormalBkBrush ); - - // fill in "corners" which are never reached by characters - - int w,h; - GetClientSize( &w, &h ); - - dc.SetBrush( mNormalBkBrush ); - - int dcX = tillScrCol*mCharDim.x + mLeftMargin; - - dc.DrawRectangle( dcX, mTopMargin, w - dcX + 1, h ); - - int dcY = mTopMargin + mRowsPerPage*mCharDim.y; - - dc.DrawRectangle( 0, dcY, w, h - dcY + 2 ); - - ++curRow; - - // any past-the-eof lines left at the bottom? - } - - mFullRefreshPending = FALSE; - - if ( mpTimer->GetView() == this && mCursorOn && !mLTMode ) - - mpTimer->Unlock(); - -} // end of PaintRows(..) - -/***** Implementation for class TBookmarkPainter *****/ - -TBookmarkPainter::TBookmarkPainter() - - : TPinPainterBase( BOOKMARK_PIN_TC ), - mBkBrush( wxColour( 0,255,255 ), wxSOLID ) -{ -} - -void TBookmarkPainter::DrawPin( TPinBase* pPin, wxTextEditorView& view, wxDC& dc, - const wxPoint& pos, const wxSize& dim ) -{ - dc.SetPen( *wxBLACK_PEN ); - dc.SetBrush( mBkBrush ); - dc.DrawRoundedRectangle( pos.x+2, pos.y, dim.x-4, dim.y, 4 ); -} - -/***** Implementation for class TBreakpointPainter *****/ - -TBreakpointPainter::TBreakpointPainter() - - : TPinPainterBase( BRKPOINT_PIN_TC ), - mBkBrush( wxColour( 196,0,0 ), wxSOLID ) -{ -} - -void TBreakpointPainter::DrawPin( TPinBase* pPin, wxTextEditorView& view, wxDC& dc, - const wxPoint& pos, const wxSize& dim ) -{ - dc.SetPen( *wxBLACK_PEN ); - dc.SetBrush( mBkBrush ); - dc.DrawRoundedRectangle( pos.x+6, pos.y+2, dim.x-12, dim.y-4, 30 ); -} - -/***** Implementation for class TCursorTimer *****/ - -TCursorTimer::TCursorTimer() - - : mIsLocked( FALSE ), - mIsShown ( FALSE ), - mBlinkInterval( 500 ), - mBrush( wxColour(0,0,0), wxSOLID ), - mMissOneTick( FALSE ) -{ -} - -void TCursorTimer::Notify() -{ - if ( mIsLocked ) return; - - if ( mMissOneTick ) - { - // this trick is used because it's not - // possible to restart the timer under wxGtk - - mMissOneTick = FALSE; - return; - } - - - mIsLocked = TRUE; - - DrawCursor(); - - mIsShown = !mIsShown; - - mIsLocked = FALSE; -} - -void TCursorTimer::SetView( wxTextEditorView* pView ) -{ - mpView = pView; -} - -wxTextEditorView* TCursorTimer::GetView() -{ - return mpView; - -} - -void TCursorTimer::HideCursor( bool forceHide ) -{ - Lock(); - - if ( mIsShown ) - { - DrawCursor(); - mIsShown = FALSE; - } - - Unlock(); -} - -void TCursorTimer::ShowCursor( bool forceShow ) -{ - Lock(); - - if ( !forceShow ) - { - DrawCursor(); - mIsShown = TRUE; - - if ( mStarted ) - mMissOneTick = TRUE; - } - - Unlock(); - - if ( !mStarted ) - { - Start( mBlinkInterval ); - mStarted = TRUE; - } -} - -void TCursorTimer::Lock() -{ -// while( mIsLocked ); - - mIsLocked = TRUE; -} - -void TCursorTimer::Unlock() -{ - mIsLocked = FALSE; -} - -void TCursorTimer::SetIsShown( bool isShown ) -{ - mIsShown = isShown; -} - -/*** protected methods ***/ - -void TCursorTimer::DrawCursor() -{ - if ( mpView == NULL ) return; - - wxClientDC dc( mpView ); - - int x = 0, y = 0; - - mpView->ScreenPosToPixels( mpView->mCursorScrPos, x, y ); - - dc.SetLogicalFunction( wxINVERT ); - dc.SetBrush( mBrush ); - - dc.SetPen( *wxTRANSPARENT_PEN ); - dc.DrawRectangle( x,y, 3, mpView->mCharDim.y + 1 ); - dc.SetBackgroundMode( wxSOLID ); -} diff --git a/utils/wxPython/modules/lseditor/tdefs.h b/utils/wxPython/modules/lseditor/tdefs.h deleted file mode 100644 index 7538980d1e..0000000000 --- a/utils/wxPython/modules/lseditor/tdefs.h +++ /dev/null @@ -1,903 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 03/04/1999 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: GNU General Public License -///////////////////////////////////////////////////////////////////////////// -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef __TDEFS_G__ -#define __TDEFS_G__ - -// should be compiled with wxSTL-v.1.2 (or higher) - -#include "wxstldefs.h" - -#if defined( wxUSE_TEMPLATE_STL ) - #include <vector> - #include <list> -#else - #include "wxstlvec.h" - #include "wxstllst.h" -#endif - -#include "wx/window.h" -#include "wx/scrolbar.h" - -#include "sourcepainter.h" - -#define NPOS ((size_t)(-1)) - -class wxTextEditorModel; -class wxTextEditorView; - -/* - * class represents column-row position in the source text, - * may refere to the column past the end-of-line, - * but should not point past the last-line in the text - */ - -class TPosition -{ -public: - size_t mRow; - size_t mCol; - - inline TPosition() : mRow(0), mCol(0) {} - - inline TPosition( size_t row, size_t col ) - - : mRow( row ), mCol( col ) {} - - inline bool operator>( const TPosition& rhs ) const - { - if ( mRow == rhs.mRow ) return mCol > rhs.mCol; - else - return mRow > rhs.mRow; - } - - inline bool operator<( const TPosition& rhs ) const - { - if ( mRow == rhs.mRow ) return mCol < rhs.mCol; - else - return mRow < rhs.mRow; - } -}; - -class TRange -{ -public: - TPosition mFrom; - TPosition mTill; - - TRange() {} - TRange( const TPosition& from, const TPosition& till ) - : mFrom( from ), mTill( till ) - {} -}; - -inline bool operator==( const TPosition& lhs, const TPosition& rhs ) -{ - return lhs.mRow == rhs.mRow && lhs.mCol == rhs.mCol; -} - -// FOR NOW:: bigger ones... - -#define MAX_BLOCK_LEN (1024*164) -#define BALANCED_BLOCK_LEN (1024*152) -#define FILLED_BLOCK_LEN (1024*148) - -// FOR NOW:: -#define T_ASSERT( x ) if ( !(x) ) throw; - -// to speed up debug v. : - -#define is_eol_char( ch ) ( ch == (char)10 ) -#define is_DOS_eol_char( ch ) ( ch == (char)13 ) - -// the target-platfrom eol-marking is selected when -// new text document is created or auto-detection -// failed to determine the text-format (e.g. no EOLs found at all) - -#if defined(__WINDOWS__) || defined(__WXMSW__) - - #define IS_UNIX_TEXT_BY_DEFAULT FALSE -#else - #define IS_UNIX_TEXT_BY_DEFAULT TRUE -#endif - -//inline bool is_eol_char( char ch ) { return ch == 10 && ch == 13 ; } - -/* - * Class contains single fragment of the source text, which - * may grow or shrink in the process of editing. Blocks always - * start at the begining of the line and end at eol, i.e. lines - * are not broken among blocks - */ - -class TBlock -{ -public: - char mBuf[MAX_BLOCK_LEN]; - size_t mTextLen; - size_t mRowCount; - - TBlock() : mTextLen(0), mRowCount(0) { mBuf[0] = '\0'; } - - void RecalcBlockProperties(); - - bool operator==( const TBlock& blk ) const { return this == &blk; } - - bool operator!=( const TBlock& blk ) const { return this != &blk; } - - bool operator<( const TBlock& blk ) const { return TRUE; } - - bool operator>( const TBlock& blk ) const { return FALSE; } -}; - -/* - * captures info about mutable command - */ - -class TCommand -{ -public: - - TCommand() : mType(-1) {} - TCommand( int type ) : mType( type ) {} - ~TCommand() {} - - int mType; - char* mData; - size_t mDataLen; - - TRange mRange; - - // positions of cursor before and after executions of this command - TPosition mPrePos; - TPosition mPostPos; - -}; - -enum TEXT_EDITOR_COMMAND -{ - TCMD_INSERT, - TCMD_DELETE -}; - -enum TEXT_CHANGE_TYPE -{ - CT_MODIFIED, - CT_DELETED, - CT_INSERTED -}; - -class wxTextEditorView; - -// STL-list is used for managing blocks, since it's alg. collects -// removed elements into a free-list, from which they -// can be reclaimed later, that way heap-fragmentation may be reduced - -#if defined( wxUSE_TEMPLATE_STL ) - typedef list<TBlock> TBlockListT; - typedef vector<TCommand*> TCommandListT; - typedef vector<wxTextEditorView*> TextViewListT; -#else - typedef WXSTL_LIST( TBlock ) TBlockListT; - - typedef TCommand* TCommandPtrT; - typedef WXSTL_VECTOR_SHALLOW_COPY( TCommandPtrT ) TCommandListT; - - typedef wxTextEditorView* TextViewPtrT; - typedef WXSTL_VECTOR_SHALLOW_COPY( TextViewPtrT ) TextViewListT; -#endif - -typedef TBlockListT::iterator TBlockIteratorT; - - -/* - * class shields the higher-level operations from direct access - * to blocks of fragmented in-memory buffers - */ - -class TTextIterator -{ -public: - TBlockIteratorT mBlockIter; - TBlockIteratorT mEndOfListIter; - TPosition mPos; - - size_t mActualRow; - size_t mFirstRowInBlock; - - char* mpCurRowStart; - bool mIsEof; - -public: - TTextIterator(); - - char GetChar(); - bool IsEol(); - bool IsEof(); - bool IsLastLine(); - int GetDistFromEol(); - - void NextChar(); - void PreviousChar(); - void NextWord(); - void PreviousWord(); - void ToEndOfLine(); - void ToStartOfLine(); - - bool IsInLastBlock(); - - // accesors - - size_t GetLineLen(); - TPosition GetPosition(); - - char* GetClosestPos(); - char* GotoClosestPos(); - - inline char* GetBlockStart() { return (*mBlockIter).mBuf; } - inline char* GetBlockEnd() { return (*mBlockIter).mBuf + (*mBlockIter).mTextLen; } - - bool DetectUnixText(); - - // adjust this member to add specific separators, - // the default value is : ",.()[]\t\\+-*/|=<>:;\t\n~?!%" - - static string mSeparators; - - static bool IsSeparator( char ch ); -}; - -class wxTextEditorModel; - -class TTextChangeListenerBase -{ -public: - virtual void OnTextChanged( wxTextEditorModel* pModel, size_t atRow, size_t nRows, TEXT_CHANGE_TYPE ct ) = 0; -}; - -class TCppJavaHighlightListener : public TTextChangeListenerBase -{ -protected: - wxTextEditorModel* mpModel; // is set up temporarely - - enum { IN_COMMENT_STATE, OUT_OF_COMMENT_STATE }; - -public: - virtual void OnTextChanged( wxTextEditorModel* pModel, size_t atRow, size_t nRows, TEXT_CHANGE_TYPE ct ); -}; - - -/* - * Base class for user-defined "bookmarks" within the source-text, bookmarks - * are automatically repositioned or deleted as the text is edited. Class - * can be subclassed to add pin-specific data (e.g. breakpoint information) - */ - -class TPinBase -{ -public: - int mTypeCode; - size_t mRow; - -public: - TPinBase() - : mTypeCode(-1), mRow(NPOS) {} - - TPinBase( int typeCode, size_t row ) - : mTypeCode( typeCode ), mRow( row ) {} - - size_t GetRow() { return mRow; } - int GetTypeCode() { return mTypeCode; } - - virtual ~TPinBase() {} -}; - -// "recommened" type-code ranges for custom pins - -#define HIHGLIGHTING_PINS_TC_STARRT 50 -#define OTHER_PINS_TC_START 100 - -inline bool operator<( const TPinBase& lhs, TPinBase& rhs ) - - { return lhs.mRow < rhs.mRow; } - -#if defined( wxUSE_TEMPLATE_STL ) - - typedef vector<TPinBase*> PinListT; - typedef vector<TTextChangeListenerBase*> ChangeListenerListT; -#else - typedef TPinBase* TPinBasePtrT; - typedef WXSTL_VECTOR_SHALLOW_COPY( TPinBasePtrT ) PinListT; - - typedef TTextChangeListenerBase* TTextChangeListenerBasePtrT; - typedef WXSTL_VECTOR_SHALLOW_COPY( TTextChangeListenerBasePtrT ) ChangeListenerListT; -#endif - -/* OLD STUFF:: - -struct TPinBaseCompareFunctor -{ - inline int operator()(const TPinBasePtrT* x, const TPinBasePtrT*& y ) const - { - return x->mLine < y->mLine; - } -}; - -typedef WXSTL_MULTIMAP( TPinBasePtrT, TPinBasePtrT, TPinBaseCompareFunctor ) PinMapT; -typedef PinMapT::iterator PinIteratorT; -*/ - -/* - * Class manages access and manpulation of in-memory text. Can - * be accessed by multiple views, only one of which can be active - * at a time. - */ - -class wxTextEditorModel -{ -protected: - TBlockListT mBlocks; - - TCommandListT mCommands; - size_t mCurCommand; - - TextViewListT mViews; - wxTextEditorView* mpActiveView; - - PinListT mPins; - bool mIsUnixText; - - ChangeListenerListT mChangeListeners; - -public: - /*** public properties ***/ - - bool mTextChanged; - size_t mChangedFromRow; - size_t mChangedTillRow; - - bool mWasChanged; // TRUE, if any content has been changed - - TPosition mCursorPos; - - TPosition mPrevSelectionStart; - TPosition mPrevSelectionEnd; - TPosition mPrevCursorPos; - - TPosition mSelectionStart; - TPosition mSelectionEnd; - size_t mRowsPerPage; - - bool mIsReadOnly; // default: FALSE - bool mIsModified; - bool mInsertMode; // default: TRUE - bool mAutoIndentMode; // default: TRUE - bool mSmartIndentMode; // default: TRUE - - bool mIsSelectionEditMode; // default: TRUE - size_t mTabSize; // default: 4 - - StrListT mSearchExprList; - string mLastFindExpr; - - bool mCheckPointDestroyed; - size_t mCheckPointCmdNo; - -protected: - - size_t GetLineCountInRange( char* from, char* till ); - - // two lowest-level operations - void DoInsertText ( const TPosition& pos, char* text, size_t len, TRange& actualRange ); - void DoDeleteRange( const TPosition& from, const TPosition& till, TRange& actualRange ); - - void DoExecuteNewCommand( TCommand& cmd ); - - void DoReexecuteCommand( TCommand& cmd ); - void DoUnexecuteCommand( TCommand& cmd ); - - - void ExecuteCommand( TCommand* pCmd ); - - // to methods enabling grouping of undo-able commands - bool CanPrependCommand( TCommand* pCmd ); - void PrependCommand( TCommand* pCmd ); - - void SetPostPos( const TPosition& pos ); - - void UndoImpl(); - void RedoImpl(); - - void StartBatch(); - void FinishBatch(); - - void CheckSelection(); - void TrackSelection(); - - void NotifyView(); - void NotifyAllViews(); - - void NotifyTextChanged( size_t atRow, size_t nRows, TEXT_CHANGE_TYPE ct ); - void NotifyTextChanged( TPosition from, TPosition till, TEXT_CHANGE_TYPE ct ); - - void ArrangePositions( TPosition& upper, TPosition& lower ); - void ArrangePositions( size_t& upper, size_t& lower ); - - void MergeChange( size_t fromRow, size_t nRows ); - - void PrepreForCommand(); - - size_t TextToScrColumn( const TPosition& pos ); - size_t ScrToTextColumn( TPosition pos ); - - void DoMoveCursor( int rows, int cols ); - -public: - wxTextEditorModel(); - virtual ~wxTextEditorModel(); - - // utilities - - char* AllocCharacters( size_t n ); - char* AllocCharacters( size_t n, const char* srcBuf ); - void FreeCharacters( char* buf ); - - void DeleteSelection(); - TTextIterator CreateIterator( const TPosition& pos ); - - void DeleteRange( const TPosition& from, const TPosition& till ); - void InsertText( const TPosition& pos, const char* text, size_t len ); - void GetTextFromRange( const TPosition& from, const TPosition& till, char** text, size_t& textLen ); - void LoadTextFromFile( const wxString& fname ); - void SaveTextToFile( const wxString& fname ); - void ResetSelection(); - void ClearUndoBuffer(); - - - void DeleteAllText(); - void GetAllText( char** text, size_t& textLen ); - - void SetSelectionEditMode( bool editIsOn ); - - /*** user-level commands ***/ - - // mutable (undoable) commands - - void OnInsertChar( char ch ); - void OnDelete(); - void OnDeleteBack(); - void OnDeleteLine(); - - void OnShiftSelectionIndent( bool left ); - - // clipboard functions - - void OnCopy(); - void OnPaste(); - void OnCut(); - bool CanCopy(); - bool CanPaste(); - - // undo-redo - - bool CanUndo(); - bool CanRedo(); - void OnUndo(); - void OnRedo(); - - // imutable commands - - void OnMoveLeft(); - void OnMoveRight(); - void OnMoveUp(); - void OnMoveDown(); - - void OnWordLeft(); - void OnWordRight(); - - void OnMoveToPosition( const TPosition& pos ); - - void OnEndOfLine(); - void OnStartOfLine(); - void OnPageUp(); - void OnPageDown(); - void OnSlideUp(); - void OnSlideDown(); - void OnStartOfText(); - void OnEndOfText(); - - void OnSelectWord(); - void OnSelectAll(); - - // bookmarks - - void OnToggleBookmark(); - void OnNextBookmark(); - void OnPreviousBookmark(); - - // search - - bool OnFind(); - bool OnFindNext(); - bool OnFindPrevious(); - void OnGotoLine( int line, int col ); - void OnGotoLine(); - - // status - - bool IsReadOnly(); - bool IsModified(); - bool IsInsertMode(); - - // check-pointin - - void SetCheckpoint(); - bool CheckpointModified(); - - // accessors - - TPosition GetStartOfSelection(); - TPosition GetEndOfSelection(); - TPosition GetCursor(); - - size_t GetTotalRowCount(); - bool SelectionIsEmpty(); - bool IsLastLine( const TPosition& pos ); - - bool IsUnixText() { return mIsUnixText; } - - void GetSelection( char** text, size_t& textLen ); - - void SetStartOfSelection( const TPosition& pos ); - void SetEndOfSelection( const TPosition& pos ); - void SetCursor( const TPosition& pos ); - - void AddView( wxTextEditorView* pView ); - void RemoveView( wxTextEditorView* pView ); - void SetActiveView( wxTextEditorView* pView ); - wxTextEditorView* GetActiveView(); - - void SetRowsPerPage( size_t n ); - - void AddPin( TPinBase* pPin ); - PinListT& GetPins(); - - // returns NPOS, if non - size_t FindFirstPinInRange( size_t fromRow, size_t tillRow ); - size_t FindNextPinFrom( size_t fromRow ); - size_t FindPreviousPinFrom( size_t fromRow ); - - size_t GetPinNoAt( size_t row, int pinTypeCode ); - TPinBase* GetPinAt( size_t row, int pinTypeCode ); - void RemovePinAt( size_t row, int pinTypeCode ); - - void AddChangeListener( TTextChangeListenerBase* pListener ); -}; - -class TCursorTimer; -class wxTextEditorView; - -class TPinPainterBase : public wxObject -{ -public: - int mPinTypeCode; - -public: - TPinPainterBase( int pinTc ) : mPinTypeCode( pinTc ) {} - TPinPainterBase() : mPinTypeCode( -1 ) {} - - inline int GetPinTypeCode() { return mPinTypeCode; } - - virtual void DrawPin( TPinBase* pPin, wxTextEditorView& view, wxDC& dc, - const wxPoint& pos, const wxSize& dim ) = 0; -}; - -/* - * a couple very common ping objects/painters - */ - -#define BOOKMARK_PIN_TC (OTHER_PINS_TC_START) -#define BRKPOINT_PIN_TC (BOOKMARK_PIN_TC + 1) - -class TBookmarkPainter : public TPinPainterBase -{ -protected: - wxBrush mBkBrush; - -public: - TBookmarkPainter(); - - virtual void DrawPin( TPinBase* pPin, wxTextEditorView& view, wxDC& dc, - const wxPoint& pos, const wxSize& dim ); -}; - -class TBookmarkPin : public TPinBase -{ -public: - TBookmarkPin( size_t row ) - : TPinBase( BOOKMARK_PIN_TC, row ) - {} - - static int GetPinTypeCode() { return BOOKMARK_PIN_TC; } -}; - -class TBreakpointPainter : public TPinPainterBase -{ -protected: - wxBrush mBkBrush; - -public: - TBreakpointPainter(); - - virtual void DrawPin( TPinBase* pPin, wxTextEditorView& view, wxDC& dc, - const wxPoint& pos, const wxSize& dim ); -}; - -class TBreakpointPin : public TPinBase -{ -public: - TBreakpointPin( size_t row ) - : TPinBase( BRKPOINT_PIN_TC, row ) - {} - - static int GetPinTypeCode() { return BRKPOINT_PIN_TC; } -}; - - -#if defined( wxUSE_TEMPLATE_STL ) - typedef vector<TPinPainterBase*> PinPainterListT; -#else - typedef TPinPainterBase* TPinPainterBasePtrT; - typedef WXSTL_VECTOR_SHALLOW_COPY( TPinPainterBasePtrT ) PinPainterListT; -#endif - -/* - * Class displays graphical view of data contained in wxTextModel - */ - -class wxTextEditorView : public wxScrolledWindow -{ -protected: - - wxTextEditorModel* mpModel; - TPosition mSelectionStart; - TPosition mSelectionEnd; - TPosition mCursorPos; - - TPosition mLastViewStart; - size_t mLastRowsTotal; - - size_t mRowsPerPage; - size_t mColsPerPage; - - static char* mpLineBuffer; - static size_t mpLineBufferLen; - - bool mFullRefreshPending; - bool mAdjustScrollPending; - - wxFont mFont; - - bool mScrollingOn; // default: TRUE - bool mCursorOn; // default: TRUE; - - bool mLTMode; // line-tracking mode - // (when the whole line is coloured, - // instead of showing blinking cursor position) - - wxColour mLTColour; // fill-colour for LT-mode - - bool mDragStarted; - char* mpDraggedText; - - bool mOwnsModel; - - wxString mFragment; // reused heap-buffer - // for coloured fragments - SourcePainter* mpPainter; - PinPainterListT mPinPainters; - TTextIterator mCashedIter; - - static TCursorTimer* mpTimer; - -public: /*** public properties ***/ - - int mLeftMargin; // default: 20 - int mRightMargin; // default: 0 - int mTopMargin; // default: 0 - int mBottomMargin; // default: 0 - int mMaxColumns; // default: 500 - - TPosition mPagePos; - - // color-scheme properties - - wxColour mNormalTextCol; - wxColour mIndentifierTextCol; - wxColour mReservedWordTextCol; - wxColour mCommentTextCol; - - wxColour mNormalBkCol; - wxColour mSelectionFgCol; - wxColour mSelectionBkCol; - - wxBrush mNormalBkBrush; - wxBrush mSelectedBkBrush; - - // accessed by timer - - TPosition mCursorScrPos; - wxSize mCharDim; - -protected: - - char* GetLineBuffer( size_t len ); - - virtual void PaintDecorations( size_t fromRow, size_t tillRow, wxDC& dc, TTextIterator& iter ); - virtual void PaintRows( size_t fromRow, size_t tillRow, wxDC& dc ); - - void ObtainFontProperties(); - - bool IsActiveView(); - void SetTextDefaults(); - void RecalcPagingInfo(); - - TPinPainterBase* FindPainterForPin( TPinBase& pin ); - -public: - wxTextEditorView( wxWindow* parent, wxWindowID id = -1, - wxTextEditorModel* pModel = NULL, - int wndStyle = wxSUNKEN_BORDER, - bool ownsModel = TRUE ); - ~wxTextEditorView(); - - /*** setup methods ***/ - - void SetModel( wxTextEditorModel* pModel ); - - // sets custom syntax-higlighting implementation - void SetSourcePainter( SourcePainter* pPainter ); - void AddPinPainter( TPinPainterBase* pPainter ); - - void SetDefaultFont( const wxFont& font ); - wxFont& GetDefaultFont(); - - wxSize GetCharacterSize() { return mCharDim; } - - size_t GetRowsPerPage() { return mRowsPerPage; } - void SetRowsPerPage( size_t n ); - void SetMaxColumns( size_t n ); - - void SetLineTrackingMode( bool on, const wxColour& col = wxColour(255,255,0) ); - - void EnableCursor( bool enable ); - void EnableScrollbars( bool enable ); - - void SetColours( const wxColour& normalBkCol, - const wxColour& selectedBkCol, - const wxColour& selectedTextCol ); - - void SetHeighlightingColours( const wxColour& normalTextCol, - const wxColour& identifierTextCol, - const wxColour& reservedWordTextCol, - const wxColour& commentTextCol ); - - void SetMargins( int top, int left, int bottom, int right ); - - // notifications from editor-model: - - void OnModelChanged(); - void ScrollView( int rows, int cols ); - - // accessors - - void Activate(); - void Deactivate(); - - // event handlers - -#if (( wxVERSION_NUMBER < 2100 ) || (( wxVERSION_NUMBER == 2100 ) && (wxBETA_NUMBER <= 4))) - void OnScroll( wxScrollEvent& event ); -#else - void OnScroll( wxScrollWinEvent& event ); -#endif - void OnPaint ( wxPaintEvent& event ); - void OnSize ( wxSizeEvent& event ); - void OnEraseBackground( wxEraseEvent& event ); - - void OnLButtonDown( wxMouseEvent& event ); - void OnLButtonUp ( wxMouseEvent& event ); - void OnMotion ( wxMouseEvent& event ); - void OnDblClick ( wxMouseEvent& event ); - - void OnSetFocus( wxFocusEvent& event ); - void OnKillFocus( wxFocusEvent& event ); - - // requests editor to keep cursor blinking, even when - // the window has lost it's focus - - void HoldCursor( bool hold ); - - // FOR NOW:: hard-coded key-bindings - - void OnChar( wxKeyEvent& event ); - void OnKeyDown( wxKeyEvent& event ); - - // utilities - - virtual void SyncViewPortPosition(); - virtual void SyncScrollbars(); - virtual void PositionCursor(); - - void TextPosToScreenPos( const TPosition& txtPos, TPosition& scrPos ); - void ScreenPosToTextPos( const TPosition& scrPos, TPosition& txtPos ); - void ScreenPosToPixels ( const TPosition& scrPos, int& x, int& y ); - void PixelsToScrPos ( int x, int y, int& scrRow, int& scrCol ); - void PixelsToTextPos ( int x, int y, TPosition& textPos ); - - bool IsClipboardCmd( wxKeyEvent& key ); - - TPosition GetPagePos() { return mPagePos; } - - DECLARE_EVENT_TABLE() -}; - -// TODO:: mutex class should be used to avoid race on updates - -class TCursorTimer : public wxTimer -{ -protected: - wxTextEditorView* mpView; - volatile bool mIsLocked; - volatile bool mIsShown; - volatile bool mStarted; - wxBrush mBrush; - bool mMissOneTick; - - int mBlinkInterval; // default: 500mills -protected: - - void DrawCursor(); - -public: - - TCursorTimer(); - - virtual void Notify(); - - void SetView( wxTextEditorView* pView ); - wxTextEditorView* GetView(); - void HideCursor( bool forceHide = FALSE ); - void ShowCursor( bool forceShow = FALSE ); - - void SetIsShown( bool isShown ); - void Lock(); - void Unlock(); -}; - -#endif // __TDEFS_G__ diff --git a/utils/wxPython/modules/lseditor/test/editor.py b/utils/wxPython/modules/lseditor/test/editor.py deleted file mode 100644 index 715b1e53fa..0000000000 --- a/utils/wxPython/modules/lseditor/test/editor.py +++ /dev/null @@ -1,118 +0,0 @@ -from wxPython.wx import * -from wxPython.lseditor import * - -class LSEditorFrame(wxFrame): - def __init__(self, parent, id, title, pos = wxDefaultPosition, size = wxSize(400,400)): - wxFrame.__init__(self, parent, id, title, pos, size) - self.editor = wxsLSEditorPlugin() - self.editor.Create(self, -1) - self.SetMenuBar(self.GetDefaultMenuBar()) - self.CreateStatusBar() - self.SetDefaultEvents() - self.filename = "" - def GetDefaultMenuBar(self): - mbar = wxMenuBar() - menu = wxMenu() - menu.Append(1500, "Open") - menu.Append(1501, "Save") - menu.Append(1502, "SaveAs") - menu.AppendSeparator() - menu.Append(1503, "Exit") - mbar.Append(menu, "File") - menu = wxMenu() - menu.Append(1510, "Copy") - menu.Append(1511, "Cut") - menu.Append(1512, "Paste") - menu.AppendSeparator() - menu.Append(1513, "Delete") - menu.AppendSeparator() - menu.Append(1514, "Undo") - menu.Append(1515, "Redo") - menu.AppendSeparator() - menu.Append(1516, "Find...") - menu.Append(1517, "Find Next") - menu.Append(1518, "Find Previous") - menu.Append(1519, "Replace...") - mbar.Append(menu, "Edit") - menu = wxMenu() - menu.Append(1520, "Toggle") - menu.Append(1521, "Next") - menu.Append(1522, "Prev") - mbar.Append(menu, "Bookmarks") - return mbar - def SetDefaultEvents(self): - EVT_MENU(self, 1500, self.evt_OnOpen) - EVT_MENU(self, 1501, self.evt_OnSave) - EVT_MENU(self, 1502, self.evt_OnSaveAs) - EVT_MENU(self, 1503, self.OnClose) - EVT_MENU(self, 1510, self.evt_OnCopy) - EVT_MENU(self, 1511, self.evt_OnCut) - EVT_MENU(self, 1512, self.evt_OnPaste) - EVT_MENU(self, 1513, self.evt_OnDelete) - EVT_MENU(self, 1514, self.evt_OnUndo) - EVT_MENU(self, 1515, self.evt_OnRedo) - EVT_MENU(self, 1516, self.evt_OnFind) - EVT_MENU(self, 1517, self.evt_OnFindNext) - EVT_MENU(self, 1518, self.evt_OnFindPrevious) - EVT_MENU(self, 1519, self.evt_OnReplace) - EVT_MENU(self, 1520, self.evt_OnToggle) - EVT_MENU(self, 1521, self.evt_OnNext) - EVT_MENU(self, 1522, self.evt_OnPrev) - #EVT_MENU(self, 15, self.evt_) - #EVT_MENU(self, 15, self.evt_) - def evt_OnOpen(self, event): - dlg = wxFileDialog(NULL, "Open file") - if dlg.ShowModal() == wxID_OK: - self.filename = dlg.GetPath() - self.editor.OnOpen(self.filename) - def evt_OnSaveAs(self, event): - dlg = wxFileDialog(NULL, "Save As", self.filename) - if dlg.ShowModal() == wxID_OK: - self.filename = dlg.GetPath() - self.editor.OnSave(self.filename) - def evt_OnSave(self, event): - if self.filename: - self.editor.OnSave(self.filename) - else: - self.evt_OnSaveAs(None) - def OnClose(self,event): - self.Destroy() - def evt_OnCopy(self,event): - self.editor.OnCopy() - def evt_OnCut(self,event): - self.editor.OnCut() - def evt_OnPaste(self,event): - self.editor.OnPaste() - def evt_OnDelete(self,event): - self.editor.OnDelete() - def evt_OnUndo(self,event): - self.editor.OnUndo() - def evt_OnRedo(self,event): - self.editor.OnRedo() - def evt_OnToggle(self,event): - self.editor.OnToggleBookmark() - def evt_OnNext(self,event): - self.editor.OnNextBookmark() - def evt_OnPrev(self,event): - self.editor.OnPreviousBookmark() - def evt_OnFind(self,event): - self.editor.OnFind() - def evt_OnFind(self,event): - self.editor.OnFind() - def evt_OnFindNext(self,event): - self.editor.OnFindNext() - def evt_OnFindPrevious(self,event): - self.editor.OnFindPrevious() - self.SetStatusText("OnFindPrevious: Not implemented") - def evt_OnReplace(self,event): - self.editor.OnReplace() - self.SetStatusText("OnReplace: Not implemented") - -class MyApp(wxApp): - def OnInit(self): - frame = LSEditorFrame(NULL, -1, "Editor") - frame.Show(TRUE) - return TRUE - -App = MyApp(0) -App.MainLoop() diff --git a/utils/wxPython/modules/lseditor/wxsdefs.h b/utils/wxPython/modules/lseditor/wxsdefs.h deleted file mode 100644 index 0014d7f6f4..0000000000 --- a/utils/wxPython/modules/lseditor/wxsdefs.h +++ /dev/null @@ -1,374 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 24/04/1999 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: GNU General Public License -///////////////////////////////////////////////////////////////////////////// -#ifndef __WXSDEFS_G__ -#define __WXSDEFS_G__ - -#include <config.h> - - -#include "controlarea.h" - -#ifdef wxUSE_TEMPLATE_STL -#include <vector> -#include <map> -//using std::map; -//using std::vector; -using namespace std; -#else -#include "wxstldefs.h" // imports predefine StrListT, IntListT containers -#include "wxstlac.h" -#endif -class wxsProject; -class wxsComponent; -class wxsWorkplace; -class wxsOpenedFileInfo; -class wxsWorkplaceListener; -class wxsSourceEditorPlugin; -class wxsSourceInfoPlugin; -class wxsAppListener; -class wxsAppInterface; - -class wxFrame; - -typedef wxsWorkplaceListener* wxsWorkplaceListenerPtrT; - -#ifdef wxUSE_TEMPLATE_STL -typedef vector<wxsWorkplaceListenerPtrT> wxsWorkplaceListenerListT; -#else -typedef WXSTL_VECTOR_SHALLOW_COPY( wxsWorkplaceListenerPtrT ) wxsWorkplaceListenerListT; -#endif - -// IDs for the controls and the menu commands -enum -{ - // menu items - WXS_Quit = 3300, // FIXEM:: ids.. - WXS_About, - WXS_Open, - WXS_Close, - WXS_OpenWorkplace, - WXS_Save, - WXS_SaveAs, - WXS_SaveAll, - WXS_CloseWorkplace, - WXS_SaveWorkplace, - WXS_NewProject, - - WXS_ShowTips, - - WXS_Undo = 9000, - WXS_NextWindow, - WXS_PreviousWindow, - WXS_CloseWindow, - WXS_ListWindows, - WXS_UpdateBrowser, - WXS_ToggleWorkplaceWindow, - - WXS_InsertFiles, - WXS_Test, - WXS_Settings, - - WXS_ClassView, - WXS_FileView, - WXS_GotoEditor, - - WXS_Test1, - WXS_Test2, - - // controls start here (the numbers are, of course, arbitrary) - WXS_Text = 1000, - - ID_EDIT_UNDO, - ID_EDIT_REDO, - ID_EDIT_CUT, - ID_EDIT_COPY, - ID_EDIT_PASTE, - ID_EDIT_DELETE, - ID_EDIT_SELECT_ALL, - ID_EDIT_FIND, - ID_EDIT_FIND_NEXT, - ID_EDIT_REPLACE, - ID_EDIT_GOTO, - ID_EDIT_TOGGLE_BM, - ID_EDIT_NEXT_BM, - ID_EDIT_PREV_BM, - ID_EDIT_TOGGLE_BRKPNT, - ID_EDIT_BOOKMARKS, - ID_EDIT_SETFONT, - ID_LEFT_SASH, - ID_BOTTOM_SASH -}; - -// bitmaps/icons -enum WXS_ICON_ENUM{ - WXS_ICON_class = 1, - WXS_ICON_priv_mtd, - WXS_ICON_prot_mtd, - WXS_ICON_pub_mtd, - WXS_ICON_priv_mtd_def, - WXS_ICON_prot_mtd_def, - WXS_ICON_pub_mtd_def, - WXS_ICON_priv_var, - WXS_ICON_prot_var, - WXS_ICON_pub_var, - WXS_ICON_pub_pure_mtd, - WXS_ICON_file, - WXS_ICON_folder, - WXS_ICON_mru_folder, - WXS_ICON_class_gray, - WXS_ICON_file_gray, -}; - - -typedef char* CharPtrT; - -struct UU_cmp -{ - inline int operator()(const CharPtrT x, const CharPtrT y ) const { return 0; } -}; - -typedef wxBitmap* wxBitmapPtrT; -#ifdef wxUSE_TEMPLATE_STL -typedef map<WXS_ICON_ENUM, wxBitmapPtrT> WXS_BitmapsMapT; -#else -typedef WXSTL_MAP( WXS_ICON_ENUM, wxBitmapPtrT, - LESS_THEN_FUNCTOR(WXS_ICON_ENUM) ) WXS_BitmapsMapT; -#endif - -extern WXS_BitmapsMapT WXS_Bitmaps; -#define WXS_ICON(name) (*WXS_Bitmaps[WXS_ICON_##name]) - - -// very general file categories - -enum WXS_FILE_CATEGORY -{ - WXS_UNKNOWN_FILE, - WXS_SOURCE_FILE, - WXS_RESOURCE_FILE, - WXS_DOCUMENTATION_FILE, - WXS_CONFIGURAITON_FILE -}; - -enum WXS_PLUGIN_TYPE -{ - WXS_UNKNOWN_PLUGIN, - WXS_EDITOR_PLUGIN, - WXS_CLASSINFO_PLUGIN, - WXS_CLASSBROWSER_PLUGIN, - WXS_FILEBROWSER_PLUGIN, - WXS_TOOL_PLUGIN, - WXS_OUTPUTTOOL_PLUGIN -}; - - - -class wxsAppListener -{ -public: - virtual void OnWindowSwitched( wxWindow* fromWnd, wxWindow* toWnd ) {}; - virtual bool OnCloseWindow( wxWindow* wnd ) { return TRUE; } - virtual void OnTabSwitched() {}; - virtual void OnPageSwitched() {}; -}; - -class wxsAppInterface -{ -public: - virtual void SetAppListener(wxsAppListener* pLsn) = 0; - - virtual void AddEditor(wxsSourceEditorPlugin* editor,wxString title,wxBitmap* pImage = NULL) = 0; - virtual void ActivateEditor( wxsSourceEditorPlugin* editor ) = 0; - virtual void CloseEditor( wxsSourceEditorPlugin* editor ) = 0; - - virtual void ShowNextWindow() = 0; - virtual void ShowPreviousWindow() = 0; - virtual void CloseActiveWindow() = 0; - virtual void CloseWindow( wxWindow* wnd ) = 0; - virtual void ShowWindowList() = 0; - virtual wxWindow* GetActiveWindow() = 0; - virtual wxTabbedWindow* GetTabbedWindow() = 0; - virtual void AddTab(wxsComponent* pContent, wxString tabText, wxBitmap* pImage = NULL) = 0; - virtual void ShowNextTab() = 0; - virtual wxPaggedWindow* GetPaggedWindow() = 0; - virtual void AddPage(wxsComponent* pContent, wxString tabText, wxBitmap* pImage = NULL) = 0; - virtual void ShowNextPage() = 0; - virtual wxFrame* GetMainFrame() = 0; - virtual void SetStatusText( const string& text ) = 0; - - static wxsAppInterface& GetInstance(); - -protected: - static wxsAppInterface* mpInstance; - friend wxsAppInterface& wxsGetApp(); -}; - -// short-cut for wxsAppInterface::GetInstance() - -wxsAppInterface& wxsGetApp(); - -class wxsWorkplaceListener : public wxObject -{ -public: - virtual void OnSubprojectAdded( wxsProject& subPrj, wxsProject& toPrj ) {} - virtual void OnSubprojectRemoved( wxsProject& subPrj, wxsProject& fromPrj ) {} - virtual void OnProjectCreated( wxsProject& prj ) {} - virtual void OnRootProjectLoaded() {} - virtual void OnRootProjectClosed() {} - virtual void OnFilesAddedToProject( wxsProject& prj, StrListT& files, WXS_FILE_CATEGORY cat ) {} - virtual void OnFilesRemovedFromProject( wxsProject& prj, StrListT& files, WXS_FILE_CATEGORY cat ) {} - - virtual void OnFileContentChanged( wxsProject& prj, const string& file, WXS_FILE_CATEGORY cat, - char* newContent, size_t len ) {} - - virtual void OnFileOpened( wxsOpenedFileInfo& file ) {} -}; - -typedef wxsProject* wxsProjectPtrT; -#ifdef wxUSE_TEMPLATE_STL -typedef vector<wxsProjectPtrT> wxsProjectListT; -#else -typedef WXSTL_VECTOR_SHALLOW_COPY( wxsProjectPtrT ) wxsProjectListT; -#endif - -class wxsProject : public wxObject -{ -public: - // Basic project info - virtual void SetName(const string& name) = 0; - virtual void SetFileName(const string& fname) = 0; - virtual void SetDescription(const string& desc) = 0; - virtual void SetLanguage(const string& lang) = 0; - virtual string GetName() = 0; - virtual string GetFileName() = 0; - virtual string GetDescription() = 0; - virtual string GetLanguage() = 0; - // File manipulation - virtual bool AddFile( const string& file) = 0; - virtual bool RemoveFile ( const string& file ) = 0; - virtual StrListT GetFiles() = 0; - // Sub-Project manipulation - virtual void AddSubproject( wxsProject* subPrj) = 0; - virtual void RemoveSubproject( wxsProject* subPrj) = 0; - virtual wxsProjectListT& GetSubprojects() = 0; - // Transient information (parent only exists when loaded - virtual void SetParent( wxsProject* parentPrj) = 0; - virtual wxsProject* GetParent() = 0; - // configuration info storage - virtual string CreateConfig ( const string& file = "" ) = 0; - virtual bool SetCurrentConfig ( const string& configkey ) = 0; - virtual bool AddConfigValue( const string& key, string& value) = 0; - virtual bool SetConfigValue( const string& key, string& value) = 0; - virtual bool RemoveConfigValue( const string& key ) = 0; - virtual string GetConfigValue ( const string& key ) = 0; - - -}; - -class wxsOpenedFileInfo : public wxObject -{ -public: - string mFullName; - wxsProject* mpProject; // NULL, if file does not belong to any project - wxsSourceEditorPlugin* mpEditor; - WXS_FILE_CATEGORY mCategory; - bool mIsSaved; - -public: - wxsOpenedFileInfo() : mIsSaved( TRUE ), mpProject( NULL ) {} - - wxsProject* GetProject() { return mpProject; } - const string& GetFullName() { return mFullName; } - wxsSourceEditorPlugin& GetEditor() { return *mpEditor; } - WXS_FILE_CATEGORY GetCategory() { return mCategory; } -}; - -typedef wxsOpenedFileInfo* wxsOpenedFileInfoPtrT; -#ifdef wxUSE_TEMPLATE_STL -typedef vector<wxsOpenedFileInfoPtrT> wxsOpenedFileInfoListT; -#else -typedef WXSTL_VECTOR_SHALLOW_COPY( wxsOpenedFileInfoPtrT ) wxsOpenedFileInfoListT; -#endif - -// abstract interface - -class wxsWorkplace : public wxObject -{ -public: - virtual void CreateProject( const string& name, const string& projectFile, const wxsProject* parent=NULL) = 0; - - virtual void LoadRootProject( const string& projectFile ) = 0; - virtual void SaveProject( wxsProject& prj ) = 0; - virtual void CloseRootProject() = 0; - - virtual wxsProject& GetRootProject() = 0; - virtual wxsProject* FindProjectByName( const string& name ) = 0; - virtual wxsOpenedFileInfo* FindFileByEditor( wxsSourceEditorPlugin& editor ) = 0; - - virtual void AddWorkpalceListener( wxsWorkplaceListener* pListener ) = 0; - - virtual void AddSubproject( wxsProject& intoPrj,const string& projectFile ) = 0; - virtual void RemoveSubproject( wxsProject& prj ) = 0; - - virtual void AddFilesToProject( wxsProject& prj, StrListT& files ) = 0; - virtual void RemoveFilesFromProject( wxsProject& prj, StrListT& files ) = 0; - - virtual void NotifyFileContentChanged( wxsProject& prj, const string& file, - char* newContent, size_t len ) = 0; - - virtual void NotifyFileContentChanged( wxsOpenedFileInfo& info ) = 0; - virtual void NotifyEditorDeactivated( wxsSourceEditorPlugin& editor ) = 0; - - // if pPrj is NULL, the specified file does not belong to any projects, - // i.e. it blongs to the workplace - - virtual wxsOpenedFileInfo* - OpenFileInEditor( const string& file, wxsProject* pPrj = NULL, - int line = -1, int column = -1) = 0; - - virtual void GetCurrentFileContent( wxsProject& prj, const string& file, - char** buf, size_t& len - ) = 0; - - // returns FALSE, if source was already up-to-date - virtual bool SyncSourceInfo() = 0; - - virtual wxsProject* FindSubproject( wxsProject& parentPrj, const string& prjName ) = 0; - virtual wxsOpenedFileInfo* FindOpenedFile( const string& name ) = 0; - virtual bool FileIsOpened( wxsProject& prj, const string& file ) = 0; - virtual wxsSourceEditorPlugin* GetSourceEditor( wxsProject& prj, const string& file ) = 0; - virtual wxsSourceInfoPlugin* GetSourceInfoPlugin() = 0; - - static wxsWorkplace& GetInstance() { return *wxsWorkplace::mpInstance; } - - virtual wxsOpenedFileInfoListT& GetOpenedFiles() = 0; - virtual wxsOpenedFileInfo* GetActiveFile() = 0; - - virtual void SaveFile( wxsOpenedFileInfo& info ) = 0; - virtual void SaveAllFiles() = 0; - - virtual bool CloseFile( wxsOpenedFileInfo& info, bool closeWindow = TRUE ) = 0; - virtual bool CloseAllFiles() = 0; - - virtual bool CloseInProgress() = 0; - - virtual WXS_FILE_CATEGORY GetFileCategory( const string& file ) = 0; - -protected: - static wxsWorkplace* mpInstance; - friend wxsWorkplace& wxsGetWorkplace(); -}; - -// short-cut for wxsWorkplace::GetInstance() - -wxsWorkplace& wxsGetWorkplace(); - -#endif diff --git a/utils/wxPython/modules/lseditor/wxstlac.h b/utils/wxPython/modules/lseditor/wxstlac.h deleted file mode 100644 index 447bc1b01c..0000000000 --- a/utils/wxPython/modules/lseditor/wxstlac.h +++ /dev/null @@ -1,659 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 27/09/98 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WXSTLAC_G__ -#define __WXSTLAC_G__ - -#include <stddef.h> -#include <sys/types.h> -#include <memory.h> -#include <limits.h> -#include <new> - - -// the below macro used internally (see actual interface after this macro) - -// arguments: -// -// ARG_IS_UNIQUE -// ASSOC_CONT_CLASS_NAME -// -// ARG_VALUE_TYPE -// ARG_KEY_TYPE -// ARG_ACTUAL_VALUE_TYPE -// -// _KEY_NAME -// _VALUE_NAME -// -// _X_KEY_NAME -// _X_VALUE_NAME -// -// _INSERT_METHOD_DEFINITION - -#define __DEFINE_ASOC_CLASS( ARG_IS_UNIQUE, \ -FUNCTOR,\ -ASSOC_CONT_CLASS_NAME, \ -ARG_VALUE_TYPE, \ -ARG_KEY_TYPE, \ -ARG_ACTUAL_VALUE_TYPE, \ -_KEY_NAME, \ -_VALUE_NAME, \ -_X_KEY_NAME, \ -_X_VALUE_NAME, \ -_INSERT_METHOD_DEFINITION \ -) class \ -ASSOC_CONT_CLASS_NAME\ -{\ -protected:\ -\ -public:\ - typedef ARG_VALUE_TYPE value_type;\ - typedef ARG_KEY_TYPE key_type;\ - typedef ARG_ACTUAL_VALUE_TYPE actual_value_type;\ -\ - typedef value_type* pointer;\ - typedef value_type& reference;\ -\ - typedef const value_type& const_reference;\ -\ - typedef FUNCTOR key_compare;\ - typedef key_compare Compare;\ -\ -protected:\ -\ - struct tree_node \ - {\ - tree_node* mpParent;\ - tree_node* mpLeft;\ - tree_node* mpRight;\ -\ - value_type mData;\ - };\ -\ - typedef tree_node* node_ref_type;\ -\ - node_ref_type mpRoot;\ - node_ref_type mpLeftMost;\ - node_ref_type mpRightMost;\ -\ - node_ref_type mpFreeListHead;\ - int mKeyIsUnique;\ -\ - key_compare mCmpFunctorObj;\ -\ -public:\ -\ - static inline node_ref_type next( node_ref_type pNode )\ - {\ - if ( pNode->mpRight ) \ - {\ - pNode = pNode->mpRight;\ -\ - while ( pNode->mpLeft ) pNode = pNode->mpLeft;\ -\ - return pNode;\ - }\ - else\ - if ( pNode->mpParent )\ - {\ - if ( pNode == pNode->mpParent->mpLeft )\ -\ - return pNode->mpParent;\ -\ - pNode = pNode->mpParent;\ -\ - node_ref_type prevNode = pNode;\ - pNode = pNode->mpParent;\ -\ - while(pNode)\ - {\ - if ( pNode->mpRight &&\ - pNode->mpRight != prevNode\ - ) return pNode;\ -\ - prevNode = pNode;\ - pNode= pNode->mpParent;\ - }\ -\ - return 0;\ - }\ - else\ - return 0;\ - }\ -\ - static inline node_ref_type prev( node_ref_type pNode )\ - {\ - if ( pNode->mpLeft ) \ - {\ - pNode = pNode->mpLeft;\ -\ - while ( pNode->mpRight ) pNode = pNode->mpRight;\ -\ - return pNode;\ - }\ - else\ - if ( pNode->mpParent )\ - {\ - if ( pNode == pNode->mpParent->mpRight )\ - return pNode->mpParent;\ -\ - pNode = pNode->mpParent;\ -\ - node_ref_type prevNode = pNode;\ - pNode = pNode->mpParent;\ -\ - while(pNode)\ - {\ - if ( pNode->mpLeft &&\ - pNode->mpLeft != prevNode\ - ) return pNode;\ -\ - prevNode = pNode;\ - pNode= pNode->mpParent;\ - }\ -\ - return 0;\ - }\ - else \ - return 0;\ - }\ -\ -protected:\ -\ - inline int are_equel( const key_type& x, const key_type& y ) const\ - {\ - mCmpFunctorObj(x,y);\ - return ( !mCmpFunctorObj(x,y) && !mCmpFunctorObj(y,x) );\ - }\ -\ - inline int is_less( const key_type& x, const key_type& y ) const\ - {\ - return mCmpFunctorObj(x,y);\ - }\ -\ - static inline const actual_value_type& value( node_ref_type pNode )\ - {\ - return pNode->_VALUE_NAME;\ - }\ -\ - static inline const key_type& key( node_ref_type pNode )\ - {\ - return pNode->_KEY_NAME;\ - }\ -\ - inline node_ref_type AllocNode() \ - { \ - if ( mpFreeListHead ) \ - {\ - node_ref_type pFreeNode = mpFreeListHead;\ - mpFreeListHead = mpFreeListHead->mpLeft;\ -\ - return pFreeNode;\ - }\ - else\ - {\ - char* pHeapBlock = new char[sizeof(tree_node)];\ -\ - return (node_ref_type)pHeapBlock;\ - }\ - }\ -\ - inline void DestroyFreeList()\ - {\ - while ( mpFreeListHead )\ - {\ - node_ref_type tmp = mpFreeListHead;\ - mpFreeListHead = mpFreeListHead->mpLeft;\ -\ - delete [](char*)tmp;\ - }\ - }\ -\ - inline void RecycleNode( node_ref_type pNode ) \ - {\ - pNode->mpLeft = mpFreeListHead;\ - mpFreeListHead = pNode;\ - }\ -\ - inline node_ref_type do_insert(const value_type& x = value_type() )\ - {\ - node_ref_type pNewNode = AllocNode();\ -\ - pNewNode->mpParent = \ - pNewNode->mpLeft =\ - pNewNode->mpRight = 0;\ -\ - node_ref_type pCurrent = mpRoot;\ - node_ref_type pParent = 0;\ - \ - while (pCurrent) \ - {\ - if ( mKeyIsUnique && are_equel( _X_KEY_NAME, key(pCurrent) ) )\ - {\ - RecycleNode(pNewNode);\ - return 0;\ - }\ -\ - pParent = pCurrent;\ -\ - pCurrent = is_less( _X_KEY_NAME, key(pCurrent) ) \ - ? pCurrent->mpLeft \ - : pCurrent->mpRight;\ - }\ - \ - pNewNode->mpParent = pParent;\ -\ - if(pParent)\ -\ - if( is_less(_X_KEY_NAME, key(pParent) ) )\ - \ - pParent->mpLeft = pNewNode;\ - else\ - pParent->mpRight = pNewNode;\ - else\ - mpRoot = pNewNode;\ -\ - new ( &pNewNode->_KEY_NAME ) key_type(_X_KEY_NAME);\ - new ( &pNewNode->_VALUE_NAME ) actual_value_type(_X_VALUE_NAME);\ -\ - if ( prev(pNewNode) == 0 ) mpLeftMost = pNewNode;\ - if ( next(pNewNode) == 0 ) mpRightMost = pNewNode;\ -\ - return pNewNode;\ - }\ -\ - friend class iterator;\ -\ -public:\ -\ - class iterator;\ - class const_iterator;\ -\ - class iterator \ - {\ - public:\ - node_ref_type mpNode;\ - friend class CONT_CLASS_NAME;\ - friend class const_iterator;\ - friend class const_reverse_iterator;\ -\ - inline iterator( node_ref_type pNode )\ - {\ - mpNode = pNode;\ - }\ - \ - public:\ - inline iterator() {}\ - inline int operator==( const iterator& rhs ) const { return (mpNode == rhs.mpNode); }\ - inline int operator!=( const iterator& rhs ) const { return (mpNode != rhs.mpNode); }\ -\ - inline iterator( const iterator& other )\ - {\ - mpNode = other.mpNode;\ - }\ -\ - inline const iterator& operator=( const iterator& other )\ - {\ - mpNode = other.mpNode;\ - return *this;\ - }\ -\ - inline const iterator& operator--() \ - {\ - mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\ - return *this;\ - }\ -\ - inline iterator operator--(int)\ - {\ - iterator tmp = *this;\ - mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\ - return tmp;\ - }\ -\ - inline const iterator& operator++() \ - {\ - mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\ - return *this;\ - }\ -\ - inline iterator operator++(int)\ - {\ - iterator tmp = *this;\ - mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\ - return tmp;\ - }\ -\ - inline reference operator*() const { return mpNode->mData; }\ - };\ -\ -\ - class const_iterator \ - {\ - public:\ - node_ref_type mpNode;\ - friend class CONT_CLASS_NAME;\ - friend class const_reverse_iterator;\ -\ - inline const_iterator( node_ref_type pNode )\ - {\ - mpNode = pNode;\ - }\ - \ - public:\ - inline const_iterator() {}\ -\ - inline int operator==( const const_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\ - inline int operator!=( const const_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\ -\ - inline const_iterator( const iterator& other )\ - {\ - mpNode = other.mpNode;\ - }\ -\ - inline const_iterator( const const_iterator& other )\ - {\ - mpNode = other.mpNode;\ - }\ -\ - inline const const_iterator& operator=( const const_iterator& other )\ - {\ - mpNode = other.mpNode;\ - return *this;\ - }\ -\ - inline const const_iterator& operator--() \ - {\ - mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\ - return *this;\ - }\ -\ - inline const_iterator operator--(int)\ - {\ - const_iterator tmp = *this;\ - mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\ - return tmp;\ - }\ -\ - inline const const_iterator& operator++() \ - {\ - mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\ - return *this;\ - }\ -\ - inline const_iterator operator++(int)\ - {\ - const_iterator tmp = *this;\ - mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\ - return tmp;\ - }\ -\ - inline const_reference operator*() const { return mpNode->mData; }\ - };\ -\ -public:\ -\ - inline ASSOC_CONT_CLASS_NAME( key_compare cmpFunctorObj = key_compare(),\ - int keyIsUnique = ARG_IS_UNIQUE )\ - : mpFreeListHead( 0 ),\ - mKeyIsUnique( keyIsUnique ),\ - mCmpFunctorObj( cmpFunctorObj )\ - {\ - mpLeftMost = 0;\ - mpRightMost = 0;\ - mpRoot = 0;\ - }\ -\ - inline ~ASSOC_CONT_CLASS_NAME() \ - { \ - erase( begin(), end() ); \ -\ - DestroyFreeList();\ - }\ -\ - inline iterator begin() { return mpLeftMost; }\ - inline iterator end() { return 0; }\ -\ - inline const_iterator begin() const { return mpLeftMost; }\ - inline const_iterator end() const { return 0; }\ -\ - inline iterator lower_bound( const key_type& x )\ - { \ - node_ref_type pCurrent = mpRoot;\ - \ - while( pCurrent )\ - {\ - node_ref_type pParent = pCurrent;\ -\ - if( are_equel( x, key(pCurrent) ) )\ - \ - return (pCurrent);\ - else\ - pCurrent = is_less( x, key(pCurrent) ) \ - ? pCurrent->mpLeft \ - : pCurrent->mpRight;\ -\ - if ( !pCurrent ) return (pParent);\ - }\ -\ - return begin();\ - }\ -\ - inline const_iterator lower_bound( const key_type& x ) const\ -\ - { return const_iterator( lower_bound(x).mpNode ); }\ -\ - inline iterator upper_bound( const key_type& x )\ - {\ - node_ref_type pCurrent = mpRoot;\ - \ - while( pCurrent )\ - {\ - node_ref_type pParent = pCurrent;\ -\ - if( are_equel( x, key(pCurrent) ) )\ - \ - return (pCurrent);\ - else\ - pCurrent = is_less( x, key(pCurrent) ) \ - ? pCurrent->mpLeft \ - : pCurrent->mpRight;\ -\ - if ( !pCurrent ) return next(pParent);\ - }\ -\ - return end();\ - }\ -\ - inline iterator find( const key_type& x ) const\ - {\ - node_ref_type pCurrent = mpRoot;\ - \ - while( pCurrent )\ - {\ - if( are_equel( x, key(pCurrent) ) )\ - \ - return (pCurrent);\ - else\ - pCurrent = is_less( x, key(pCurrent) ) \ - ? pCurrent->mpLeft \ - : pCurrent->mpRight;\ - }\ -\ - return iterator(0);\ - }\ -\ - inline actual_value_type& operator[]( const key_type x ) const\ -\ - { return find(x).mpNode->_VALUE_NAME; }\ -\ - inline void erase(iterator first, iterator last)\ - {\ - if ( first.mpNode == 0 ) return;\ -\ - while( first != last ) \ - {\ - iterator next = first;\ - ++next;\ - erase( first );\ - first = next;\ - }\ - }\ -\ - inline void erase(iterator position)\ - {\ - if ( position.mpNode == 0 ) return;\ -\ - node_ref_type pZ = position.mpNode;\ - node_ref_type pX, pY;\ -\ - if ( pZ == mpLeftMost ) mpLeftMost = next(pZ);\ - if ( pZ == mpRightMost ) mpRightMost = prev( pZ );\ -\ - if ( !pZ->mpLeft || !pZ->mpRight )\ - \ - pY = pZ;\ - else \ - {\ - pY = pZ->mpRight;\ - \ - while (pY->mpLeft) \ - \ - pY = pY->mpLeft;\ - }\ - \ - if ( pY->mpLeft)\ - \ - pX = pY->mpLeft;\ - else\ - pX = pY->mpRight;\ - \ - if ( pX ) pX->mpParent = pY->mpParent;\ - \ - if (pY->mpParent)\ - \ - if (pY == pY->mpParent->mpLeft )\ - \ - pY->mpParent->mpLeft = pX;\ - else\ - pY->mpParent->mpRight = pX;\ - else\ - mpRoot = pX;\ - \ - node_ref_type toRemove = 0;\ - \ - if (pY != pZ) {\ - \ - pY->mpLeft = pZ->mpLeft;\ - \ - if (pY->mpLeft) pY->mpLeft->mpParent = pY;\ - \ - pY->mpRight = pZ->mpRight;\ - \ - if ( pY->mpRight ) \ - \ - pY->mpRight->mpParent = pY;\ - \ - pY->mpParent = pZ->mpParent;\ - \ - if (pZ->mpParent)\ - \ - if (pZ == pZ->mpParent->mpLeft)\ - \ - pZ->mpParent->mpLeft = pY;\ - else\ - pZ->mpParent->mpRight = pY;\ - else\ - mpRoot = pY;\ - \ - toRemove = pZ;\ - } \ - else \ - toRemove = pY;\ - \ -\ - RecycleNode( toRemove );\ - }\ -\ - _INSERT_METHOD_DEFINITION\ -} - -// do not undefine ___WXSTL_COMMA, where associated containers are defined! -// (it is used as workaround for constraints of C-Preprocessor's nested macros) - -#define ___WXSTL_COMMA , - -#define __DEFINE_MAP(ARG_IS_UNIQUE, KEY_TYPE, VAL_TYPE, FUNCTOR ) __DEFINE_ASOC_CLASS( ARG_IS_UNIQUE,\ -FUNCTOR,\ -__WXSTLMAP_##KEY_TYPE##VAL_TYPE##ARG_IS_UNIQUE, \ -struct key_value_pair { KEY_TYPE first ; \ - VAL_TYPE second;\ - key_value_pair() {}\ - key_value_pair( const KEY_TYPE& key ___WXSTL_COMMA const VAL_TYPE& value ) \ - : first(key) ___WXSTL_COMMA second( value ) {} \ - } , \ -KEY_TYPE,\ -VAL_TYPE,\ -mData.first, mData.second, x.first, x.second, \ -struct insert_result_iterator\ -{\ - iterator first;\ - int second;\ -};\ -inline insert_result_iterator insert( const value_type& x )\ -{\ - insert_result_iterator result;\ -\ - result.first = do_insert(x);\ - result.second = ( result.first == end() ) ? 0 : 1;\ -\ - return result;\ -} ) - -#define __DEFINE_SET(ARG_IS_UNIQUE, KEY_TYPE, FUNCTOR ) __DEFINE_ASOC_CLASS( ARG_IS_UNIQUE,\ -FUNCTOR,\ -__WXSTLSET_##TYPE##ARG_IS_UNIQUE, \ -KEY_TYPE,\ -KEY_TYPE,\ -KEY_TYPE,\ -mData, mData, x, x, \ -struct insert_result_iterator\ -{\ - iterator first;\ - int second;\ -};\ -inline insert_result_iterator insert( const value_type& x )\ -{\ - insert_result_iterator result;\ -\ - result.first = do_insert(x);\ - result.second = ( result.first == end() ) ? 0 : 1;\ -\ - return result;\ -} ) - -// helper macros to create functor objects for associative containers of the given type - -#define LESS_THEN_FUNCTOR(TYPE) struct \ -{ inline int operator()(const TYPE& x, const TYPE& y ) const { return x < y; } } - -#define GREATER_THEN_FUNCTOR(TYPE) struct \ -{ inline int operator()(const TYPE& x, const TYPE& y ) const { return x > y; } } - -// functor argument should be created using the two above macros -// or passing own class with method "operator()(const TYPE&,cosnt TYPE&)" defined in it - -#define WXSTL_MAP( KEY_TYPE, VALUE_TYPE, FUNCTOR ) __DEFINE_MAP( 1 ,KEY_TYPE, VALUE_TYPE, FUNCTOR) -#define WXSTL_MULTIMAP( KEY_TYPE, VALUE_TYPE, FUNCTOR ) __DEFINE_MAP( 0 ,KEY_TYPE, VALUE_TYPE, FUNCTOR) -#define WXSTL_SET( KEY_TYPE, FUNCTOR ) __DEFINE_SET( 1 ,KEY_TYPE, FUNCTOR ) -#define WXSTL_MULTISET( KEY_TYPE, FUNCTOR ) __DEFINE_SET( 0 ,KEY_TYPE, FUNCTOR ) - -#endif diff --git a/utils/wxPython/modules/lseditor/wxstldefs.h b/utils/wxPython/modules/lseditor/wxstldefs.h deleted file mode 100644 index 51e680f0d0..0000000000 --- a/utils/wxPython/modules/lseditor/wxstldefs.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef __WXSTLDEFS_G__ -#define __WXSTLDEFS_G__ - - -#include "config.h" - -// defines some very commonly used container types -// for both template and macro-based configurations - -#if defined( wxUSE_TEMPLATE_STL ) - - #include <vector> - using namespace std; - #ifdef WIN32xxx - #include <bstring.h> - #else - - //#include <strclass.h> - //#include <string.h> - // For now - #include "wx/string.h" - #define string wxString - - #endif - -#else - - #include "wx/string.h" - #include "wxstlvec.h" - - // FOR NOW:: quick n' dirty: - - #define string wxString - -#endif - -#if defined( wxUSE_TEMPLATE_STL ) - - typedef vector<string> StrListT; - typedef vector<int> IntListT; - -#else - - typedef WXSTL_VECTOR(string) StrListT; - typedef WXSTL_VECTOR_SHALLOW_COPY(int) IntListT; - -#endif - -#endif diff --git a/utils/wxPython/modules/lseditor/wxstllst.h b/utils/wxPython/modules/lseditor/wxstllst.h deleted file mode 100644 index 9bcf331f44..0000000000 --- a/utils/wxPython/modules/lseditor/wxstllst.h +++ /dev/null @@ -1,555 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 27/09/98 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WXSTLLST_G__ -#define __WXSTLLST_G__ - -#include <stddef.h> -#include <sys/types.h> -#include <memory.h> -#include <limits.h> -#include <new> - -// VERSION:: 0.2 (copy-constructor/adign-op added) - -// FOR NOW:: class-member operators "new" and "delete" -// are ignored by list class, memory allocated -// and freed using global operators - -typedef int Type; - - -// the below macro used internally (see actual interface after this macro) - -#define __DEFINE_STL_LIST(listClass,Type) class \ - listClass \ -{\ -public:\ -\ - typedef Type value_type;\ - typedef value_type* pointer;\ - typedef const value_type* const_pointer;\ - typedef value_type& reference;\ - typedef const value_type& const_reference;\ - typedef size_t size_type;\ - typedef ptrdiff_t difference_type;\ -\ -protected:\ - struct list_node\ - {\ - list_node* mpNext;\ - list_node* mpPrev;\ - value_type mData;\ - };\ -\ - typedef list_node* node_ref_type;\ -\ - node_ref_type mpFreeListHead;\ - node_ref_type mpTerminator;\ - size_type mSize;\ -\ - inline node_ref_type AllocNode() \ - { \ - if ( mpFreeListHead ) \ - {\ - node_ref_type pFreeNode = mpFreeListHead;\ - mpFreeListHead = mpFreeListHead->mpPrev;\ -\ - return pFreeNode;\ - }\ - else\ - {\ - char* pHeapBlock = new char[sizeof(list_node)];\ -\ - return (node_ref_type)pHeapBlock;\ - }\ - }\ -\ - inline void DestroyFreeList()\ - {\ - while ( mpFreeListHead )\ - {\ - node_ref_type tmp = mpFreeListHead;\ - mpFreeListHead = mpFreeListHead->mpPrev;\ -\ - delete [](char*)tmp;\ - }\ - }\ -\ - inline void RecycleNode( node_ref_type pNode ) \ - {\ - pNode->mpPrev = mpFreeListHead;\ - mpFreeListHead = pNode;\ - }\ -\ -public:\ -\ - class iterator \ - {\ - public:\ - node_ref_type mpNode;\ - friend class listClass;\ - friend class const_iterator;\ - friend class const_reverse_iterator;\ -\ - protected:\ - iterator( node_ref_type pNode )\ - {\ - mpNode = pNode;\ - }\ - \ - public:\ - iterator() {}\ - int operator==( const iterator& rhs ) const { return (mpNode == rhs.mpNode); }\ - int operator!=( const iterator& rhs ) const { return (mpNode != rhs.mpNode); }\ -\ - inline iterator( const iterator& other )\ - {\ - mpNode = other.mpNode;\ - }\ -\ - inline const iterator& operator--() \ - {\ - mpNode = mpNode->mpPrev;\ - return *this;\ - }\ -\ - inline iterator operator--(int)\ - {\ - iterator tmp = *this;\ - mpNode = mpNode->mpPrev;\ - return tmp;\ - }\ -\ - inline const iterator& operator++() \ - {\ - mpNode = mpNode->mpNext;\ - return *this;\ - }\ -\ - inline iterator operator++(int)\ - {\ - iterator tmp = *this;\ - mpNode = mpNode->mpNext;\ - return tmp;\ - }\ -\ - inline reference operator*() const { return mpNode->mData; }\ - };\ -\ -\ - class const_iterator \ - {\ - protected:\ - node_ref_type mpNode;\ - friend class listClass;\ -\ - protected:\ - const_iterator( node_ref_type pNode )\ - {\ - mpNode = pNode;\ - }\ - \ - public:\ - \ - const_iterator() {}\ - int operator==( const const_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\ - int operator!=( const const_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\ -\ -\ - inline const_iterator( const iterator& other )\ - {\ - mpNode = other.mpNode;\ - }\ -\ - inline const const_iterator& operator--() \ - {\ - mpNode = mpNode->mpPrev;\ - return *this;\ - }\ -\ - inline const_iterator operator--(int)\ - {\ - const_iterator tmp = *this;\ - mpNode = mpNode->mpPrev;\ - return tmp;\ - }\ -\ - inline const const_iterator& operator++() \ - {\ - mpNode = mpNode->mpNext;\ - return *this;\ - }\ -\ - inline const_iterator operator++(int)\ - {\ - const_iterator tmp = *this;\ - mpNode = mpNode->mpNext;\ - return tmp;\ - }\ -\ - inline const_reference operator*() const { return mpNode->mData; }\ - };\ -\ - typedef iterator OutputIterator;\ - typedef const_iterator InputIterator;\ -\ - class reverse_iterator \ - {\ - public:\ - node_ref_type mpNode;\ - friend class listClass;\ - friend class const_reverse_iterator;\ -\ - protected:\ - reverse_iterator ( node_ref_type pNode )\ - {\ - mpNode = pNode;\ - }\ - \ - public:\ -\ - reverse_iterator() {}\ - int operator==( const reverse_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\ - int operator!=( const reverse_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\ -\ - inline reverse_iterator( const reverse_iterator& other )\ - {\ - mpNode = other.mpNode;\ - }\ -\ - inline const reverse_iterator& operator--() \ - {\ - mpNode = mpNode->mpNext;\ - return *this;\ - }\ -\ - inline reverse_iterator operator--(int)\ - {\ - reverse_iterator tmp = *this;\ - mpNode = mpNode->mpPrev;\ - return tmp;\ - }\ -\ - inline const reverse_iterator & operator++() \ - {\ - mpNode = mpNode->mpNext;\ - return *this;\ - }\ -\ - inline reverse_iterator operator++(int)\ - {\ - reverse_iterator tmp = *this;\ - mpNode = mpNode->mpPrev;\ - return tmp;\ - }\ -\ - inline const_reference operator*() const { return mpNode->mData; }\ - };\ -\ -\ - class const_reverse_iterator \ - {\ - protected:\ - node_ref_type mpNode;\ - friend class listClass;\ -\ - protected:\ - const_reverse_iterator( node_ref_type pNode )\ - {\ - mpNode = pNode;\ - }\ - \ - public:\ -\ - const_reverse_iterator() {}\ - int operator==( const const_reverse_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\ - int operator!=( const const_reverse_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\ -\ - inline const_reverse_iterator( const reverse_iterator& other )\ - {\ - mpNode = other.mpNode;\ - }\ -\ - inline const const_reverse_iterator& operator--() \ - {\ - mpNode = mpNode->mpNext;\ - return *this;\ - }\ -\ - inline const_reverse_iterator operator--(int)\ - {\ - const_reverse_iterator tmp = *this;\ - mpNode = mpNode->mpNext;\ - return tmp;\ - }\ -\ - inline const const_reverse_iterator& operator++() \ - {\ - mpNode = mpNode->mpPrev;\ - return *this;\ - }\ -\ - inline const_reverse_iterator operator++(int)\ - {\ - const_reverse_iterator tmp = *this;\ - mpNode = mpNode->mpPrev;\ - return tmp;\ - }\ -\ - inline const_reference operator*() const { return mpNode->mData; }\ - };\ -\ -public:\ -\ - inline listClass()\ - : mpFreeListHead( 0 ),\ - mSize(0)\ - {\ - mpTerminator = AllocNode();\ - mpTerminator->mpPrev = mpTerminator->mpNext = mpTerminator;\ - }\ -\ - listClass( const listClass& other )\ - {\ - mpTerminator = AllocNode();\ - mpTerminator->mpPrev = mpTerminator->mpNext = mpTerminator;\ -\ - for( listClass::const_iterator i = other.begin(); i != other.end(); ++i )\ -\ - push_back( (*i) );\ - }\ -\ - inline const listClass& operator=( const listClass& rhs ) \ - {\ - erase( begin(), end() );\ -\ - for( listClass::const_iterator i = rhs.begin(); i != rhs.end(); ++i )\ -\ - push_back( (*i) );\ -\ - return *this;\ - }\ -\ - inline listClass(const_iterator first, const_iterator last)\ - : mpFreeListHead( 0 ),\ - mSize(0)\ - \ - { while( first != last ) push_back( *first++ ); }\ -\ - inline listClass( size_type n, const value_type& value = value_type() )\ - \ - { for( size_t i = 0; i != n; ++n ) push_back( value ); }\ -\ - inline ~listClass() \ - { \ - erase( begin(), end() ); \ -\ - RecycleNode( mpTerminator );\ - DestroyFreeList();\ - }\ -\ - inline iterator begin() { return iterator(mpTerminator->mpNext); }\ - \ - inline const_iterator begin() const \ - { return const_iterator(mpTerminator->mpNext); }\ - \ - inline iterator end() { return iterator(mpTerminator); }\ -\ - inline const_iterator end() const { return const_iterator(mpTerminator); }\ -\ - inline reverse_iterator rbegin() \ - { return reverse_iterator(mpTerminator->mpPrev); }\ -\ - inline reverse_iterator rend() \ - { return reverse_iterator(mpTerminator); }\ -\ - inline const_reverse_iterator rbegin() const\ - { return const_reverse_iterator(mpTerminator->mpPrev); }\ -\ - inline const_reverse_iterator rend() const\ - { return const_reverse_iterator(mpTerminator); }\ -\ - inline int empty() const { return (mSize == 0); }\ -\ - inline size_type size() const { return mSize; }\ -\ - inline size_type max_size() const { return UINT_MAX/sizeof(list_node); }\ -\ - inline reference front() { return mpTerminator->mData; }\ -\ - inline const_reference front() const { return mpTerminator->mData; }\ -\ - inline reference back() { return mpTerminator->mpPrev->mData; }\ -\ - inline const_reference back() const { return mpTerminator->mpPrev->mData; }\ -\ - inline void push_front(const value_type& x) { insert( begin(), x ); }\ -\ - inline void push_back(const value_type& x) { insert( end(), x ); }\ -\ - iterator insert(iterator position, const value_type& x = value_type())\ - {\ - node_ref_type pNew = AllocNode();\ -\ - node_ref_type pos = *((node_ref_type*)&position);\ -\ - pNew->mpNext = pos;\ - pNew->mpPrev = pos->mpPrev;\ - pos->mpPrev->mpNext = pNew;\ - pos->mpPrev = pNew;\ -\ - new (&pNew->mData) value_type(x);\ -\ - ++mSize;\ -\ - return iterator(pNew);\ - }\ -\ - inline void insert(iterator position, const_iterator first, const_iterator last )\ - {\ - while( first != last ) insert( position, *first++ );\ - }\ -\ - inline void splice( iterator position, listClass& other )\ - {\ - if ( other.begin() == other.end() ) return;\ -\ - node_ref_type pTill = other.mpTerminator->mpPrev;\ - node_ref_type pFrom = other.begin().mpNode;\ -\ - mpTerminator->mpPrev->mpNext = pFrom;\ - pFrom->mpPrev = mpTerminator->mpPrev->mpNext;\ -\ - pTill->mpNext = mpTerminator;\ - mpTerminator->mpPrev = pTill;\ -\ - other.mpTerminator->mpNext = \ - other.mpTerminator->mpPrev = other.mpTerminator;\ -\ - mSize += other.mSize;\ - other.mSize = 0;\ - }\ -\ - inline void splice( iterator position, listClass& other, iterator first, iterator last )\ - {\ - if ( first == last ) return;\ -\ - size_type sz = 0;\ - iterator tmp = first;\ - while( tmp != last ) \ - {\ - ++tmp;\ - ++sz;\ - }\ -\ - mSize += sz;\ - other.mSize -= sz;\ -\ - node_ref_type pPos = position.mpNode;\ - node_ref_type pFirst = first.mpNode;\ - node_ref_type pLast = last.mpNode;\ - node_ref_type pTill = last.mpNode->mpPrev;\ -\ - pPos->mpPrev->mpNext = pFirst;\ - pPos->mpPrev = pTill;\ -\ - pFirst->mpPrev->mpNext = last.mpNode;\ - pLast->mpPrev = pTill;\ -\ - pFirst->mpPrev = pPos->mpPrev;\ - pTill->mpNext = pPos;\ - }\ -\ - inline void pop_front() { erase( begin() ); }\ - inline void pop_back() { erase( --end() ); }\ - \ - inline void erase(iterator position)\ - {\ - erase( position, ++position );\ - }\ - \ - inline void erase(iterator first, iterator last)\ - {\ - node_ref_type firstNode = *((node_ref_type*)&first);\ - node_ref_type lastNode = *((node_ref_type*)&last);\ -\ - firstNode->mpPrev->mpNext = lastNode;\ - lastNode->mpPrev = firstNode->mpPrev;\ -\ - while( firstNode != lastNode )\ - {\ - node_ref_type next = firstNode->mpNext;\ -\ - typedef value_type value_type_local;\ - firstNode->mData.value_type_local::~value_type_local();\ -\ - RecycleNode( firstNode );\ -\ - firstNode = next;\ -\ - --mSize;\ - }\ - }\ -\ - inline void remove(const value_type& value)\ - {\ - for( iterator i = begin(); i != end(); ++i )\ - \ - if ( (*i) == value ) \ - {\ - erase( i ); break;\ - }\ - }\ -\ - void sort()\ - {\ - if ( mSize < 2 ) return;\ -\ - iterator from = begin();\ - iterator other_end = end();\ - --other_end;\ -\ - for( size_type i = 0; i != mSize; ++i )\ - {\ - size_type nSwaps = 0;\ -\ - iterator next = begin();\ - ++next;\ -\ - for( iterator j = begin(); j != other_end; ++j )\ - {\ -\ - if ( (*next) < (*j) )\ - {\ - value_type tmp = (*j);\ - (*j) = (*next);\ - (*next) = tmp;\ -\ - ++nSwaps;\ - }\ -\ - ++next;\ - }\ -\ - if ( !nSwaps) break;\ -\ - --other_end;\ - }\ - }\ -} - -// defines list class with the given element type -#define WXSTL_LIST(ELEMENT_CLASS) __DEFINE_STL_LIST(\ -\ -_WXSTL_LIST_##ELEMENT_CLASS, ELEMENT_CLASS ) - -#endif \ No newline at end of file diff --git a/utils/wxPython/modules/lseditor/wxstlvec.h b/utils/wxPython/modules/lseditor/wxstlvec.h deleted file mode 100644 index bc6fe504e0..0000000000 --- a/utils/wxPython/modules/lseditor/wxstlvec.h +++ /dev/null @@ -1,857 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 27/09/98 -// RCS-ID: $Id$ -// Copyright: (c) Aleskandars Gluchovas -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WXSTLVEC_G__ -#define __WXSTLVEC_G__ - -#include <memory.h> -#include <string.h> // imports memmove() -#include <stddef.h> -#include <sys/types.h> -#include <limits.h> -#include <new> - -// the below macro used internally (see actual interface after this macro) - -#define __DEFINE_STL_VECTOR_DEEP( vectorClass, Type ) class vectorClass {\ -\ -public:\ - typedef Type value_type;\ - typedef value_type* iterator;\ - typedef const value_type* const_iterator;\ - typedef iterator pointer;\ - typedef const iterator const_pointer;\ - typedef value_type& reference;\ - typedef const value_type& const_reference;\ - typedef size_t size_type;\ - typedef ptrdiff_t difference_type;\ -\ - typedef iterator OutputIterator;\ - typedef const_iterator InputIterator;\ -\ -protected:\ -\ - inline void PlacementCopy( const_iterator first, const_iterator last, iterator result )\ - {\ - while ( first != last ) \ - new (result++) value_type(*first++);\ - }\ -\ - inline void ConstructObjects( iterator first, iterator last, const value_type& pattern )\ - {\ - while( first != last ) \ - new (first++) value_type(pattern);\ - }\ -\ - inline void CopyObjects( iterator first, iterator last, iterator result )\ - {\ - while( first != last ) \ - *result++ = *first++;\ - }\ -\ - inline void CopyObjectsBack( iterator first, iterator last, iterator result )\ - {\ - result += difference_type(last,first);\ -\ - while( first != last ) \ - *(--result) = *(--last);\ - }\ -\ -public:\ -\ - class reverse_iterator \ - {\ - friend class vectorClass;\ - friend class const_reverse_iterator;\ -\ - public:\ - iterator mpPos;\ -\ - public:\ -\ - reverse_iterator() {}\ -\ - reverse_iterator ( iterator pPos )\ - {\ - mpPos = pPos;\ - }\ - \ - int operator==( const reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\ - int operator!=( const reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\ -\ - inline reverse_iterator( const reverse_iterator& other )\ - {\ - mpPos = other.mpPos;\ - }\ -\ - inline const reverse_iterator& operator--() \ - {\ - --mpPos;\ - return *this;\ - }\ -\ - inline reverse_iterator operator--(int)\ - {\ - reverse_iterator tmp = *this;\ - --mpPos;\ - return tmp;\ - }\ -\ - inline const reverse_iterator & operator++() \ - {\ - ++mpPos;\ - return *this;\ - }\ -\ - inline reverse_iterator operator++(int)\ - {\ - reverse_iterator tmp = *this;\ - ++mpPos;\ - return tmp;\ - }\ -\ - inline const_reference operator*() const { return *mpPos; }\ - };\ -\ -\ - class const_reverse_iterator \ - {\ - protected:\ - iterator mpPos;\ - public:\ -\ - const_reverse_iterator() {}\ -\ - const_reverse_iterator( const iterator pPos )\ - {\ - mpPos = pPos;\ - }\ - \ - int operator==( const const_reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\ - int operator!=( const const_reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\ -\ - inline const_reverse_iterator( const reverse_iterator& other )\ - {\ - mpPos = other.mpPos;\ - }\ -\ - inline const const_reverse_iterator& operator--() \ - {\ - --mpPos;\ - return *this;\ - }\ -\ - inline const_reverse_iterator operator--(int)\ - {\ - const_reverse_iterator tmp = *this;\ - --mpPos;\ - return tmp;\ - }\ -\ - inline const const_reverse_iterator & operator++() \ - {\ - ++mpPos;\ - return *this;\ - }\ -\ - inline const_reverse_iterator operator++(int)\ - {\ - const_reverse_iterator tmp = *this;\ - ++mpPos;\ - return tmp;\ - }\ -\ - inline const_reference operator*() const { return *mpPos; }\ - };\ -\ -protected:\ - \ - pointer mpStart;\ - pointer mpEnd;\ - pointer mpEndOfBuf;\ -\ -protected:\ -\ - inline void quick_sort(int low, int hi) \ - {\ - int pivot_index;\ - int left, right;\ -\ - pivot_index = ( !(mpStart[low] < mpStart[low+1])) ? low : (low+1);\ - value_type pivot_value = mpStart[pivot_index];\ -\ - left = low; right = hi;\ - do \ - {\ - while ((left <= hi) && (mpStart[left] < pivot_value)) left++;\ -\ - while ((right >= low) && (pivot_value < mpStart[right])) right--;\ -\ - if (left <= right) \ - {\ - value_type tmp = mpStart[left];\ - mpStart[left] = mpStart[right];\ - mpStart[right] = tmp;\ -\ - left++;\ - right--;\ - }\ - \ - } while (left <= right);\ - if (low < right) quick_sort(low, right);\ - if (left < hi) quick_sort(left, hi);\ - }\ -\ - inline void DestructRange( iterator first, iterator last )\ - {\ - typedef value_type value_type_local;\ -\ - while ( first != last ) \ - {\ - first->value_type_local::~value_type_local();\ - ++first;\ - }\ - }\ -\ - inline iterator DoInsert(iterator position, const value_type& x)\ - {\ - if ( mpEnd < mpEndOfBuf )\ - {\ - new (mpEnd) value_type(*(mpEnd-1) );\ - \ - CopyObjectsBack( position, mpEnd, position + 1 );\ - \ - *position = x;\ - \ - ++mpEnd;\ - \ - return position;\ - }\ - \ - size_type minBufLen = WXSTL_VECTOR_MIN_BUF_SIZE/sizeof(value_type);\ - \ - size_type doubledSize = size()*2;\ - \ - size_type newLen = ( doubledSize < minBufLen ) ? minBufLen : doubledSize;\ - \ - iterator pNewStart = (iterator)( new char[newLen*sizeof(value_type)] );\ - \ - PlacementCopy( mpStart, position, pNewStart );\ - \ - iterator atPosition = pNewStart + difference_type( position - mpStart );\ - \ - new (atPosition) value_type(x);\ - \ - iterator newPos = atPosition;\ - \ - ++atPosition;\ - \ - if ( mpStart ) \ - {\ - PlacementCopy( position, mpEnd, atPosition );\ - DestructRange( mpStart, mpEnd );\ - delete [](char*)mpStart;\ - }\ - \ - mpEnd = atPosition + difference_type( mpEnd - position );\ - \ - mpStart = pNewStart;\ - mpEndOfBuf = pNewStart + newLen;\ - \ - return newPos;\ - }\ -\ -public:\ -\ - inline vectorClass() : mpStart(0), \ - mpEnd(0),\ - mpEndOfBuf(0)\ - {}\ -\ - inline vectorClass( const_iterator first, const_iterator last )\ - : mpStart(0),\ - mpEnd(0),\ - mpEndOfBuf(0)\ - \ - { while( first != last ) push_back( *first++ ); }\ -\ - inline vectorClass( size_type n, const value_type& value = value_type() )\ - : mpStart(0),\ - mpEnd(0),\ - mpEndOfBuf(0)\ - \ - { for( size_type i = 0; i != n; ++i ) push_back( value ); }\ -\ - inline int operator==( const vectorClass& other )\ - {\ - size_type sz = size();\ -\ - if ( sz != other.size() ) return 0;\ -\ - for( size_type i = 0; i != sz; ++i )\ -\ - if ( !( (*this)[i] == other[i] ) ) return 0;\ -\ - return 1;\ -\ - }\ -\ - inline const vectorClass& operator=( const vectorClass& other )\ - {\ - if (mpStart) \ - {\ - DestructRange( begin(), end() );\ - delete [](char*)mpStart; \ - }\ -\ - size_t newLen = difference_type( other.mpEndOfBuf - other.mpStart );\ -\ - mpStart = (iterator)( new char[newLen*sizeof(value_type)] );\ -\ - PlacementCopy( other.begin(), other.end(), mpStart );\ -\ - mpEnd = mpStart + other.size();\ -\ - mpEndOfBuf = mpStart + newLen;\ -\ - return *this;\ - }\ -\ - inline vectorClass( const vectorClass& other )\ - : mpStart(0),\ - mpEnd(0),\ - mpEndOfBuf(0)\ - {\ - this->operator=( other );\ - }\ -\ - inline ~vectorClass() \ - { \ - if (mpStart) \ - {\ - DestructRange( begin(), end() );\ - delete [](char*)mpStart; \ - }\ - }\ -\ - inline iterator begin() { return mpStart; }\ -\ - inline const_iterator begin() const { return mpStart; }\ -\ - inline iterator end() { return mpEnd; }\ -\ - inline const_iterator end() const { return mpEnd; }\ -\ - inline size_type size() const { return (size_type)difference_type(mpEnd-mpStart); }\ -\ - inline size_type max_size() const { return UINT_MAX/sizeof(value_type); }\ -\ - inline size_type capacity() const \ - { return difference_type(mpEndOfBuf-mpStart)/sizeof(value_type); }\ -\ - inline int empty() const { return mpStart == mpEnd; }\ -\ - inline reference operator[](size_type n) { return *(mpStart+n); }\ -\ - inline const_reference operator[](size_type n) const { return *(mpStart+n); }\ -\ - inline reference front() { return (*mpStart); }\ - \ - inline const_reference front() const { return (*mpStart); }\ -\ - inline reference back() { return (*(mpEnd-1)); }\ -\ - inline const_reference back() const { return (*(mpEnd-1)); }\ -\ - inline void reserve(size_type n) {}\ -\ - inline void push_back(const value_type& x)\ - {\ - if ( mpEnd != mpEndOfBuf ) \ - {\ - new (mpEnd) value_type(x);\ - ++mpEnd;\ - }\ - else\ - DoInsert( mpEnd, x );\ - }\ -\ - inline iterator insert(iterator position, const value_type& x = value_type())\ - {\ - if ( position == mpEnd && mpEnd != mpEndOfBuf )\ - {\ - new (mpEnd) value_type(x);\ - ++mpEnd;\ - return (mpEnd-1);\ - }\ - else return DoInsert( position, x );\ - }\ -\ - inline void pop_back()\ - {\ - DestructRange( mpEnd-1, mpEnd );\ -\ - --mpEnd;\ - }\ -\ - inline void erase(iterator first, iterator last)\ - {\ - if ( last == mpEnd )\ - {\ - DestructRange( first, last );\ - mpEnd = first;\ - return;\ - }\ - \ - CopyObjects( last, last + difference_type( mpEnd - last ), first );\ - \ - iterator newEnd = mpEnd - difference_type( last - first );\ - DestructRange( newEnd, mpEnd );\ - \ - mpEnd = newEnd;\ - }\ -\ - inline void erase( iterator position )\ - {\ - erase( position, position + 1 );\ - }\ -\ - inline void sort()\ - {\ - if ( size() < 2 ) return;\ - quick_sort( 0, size()-1 );\ - }\ -} - -/////////////////////////////// shallow-copy container /////////////////////// - -#define __DEFINE_STL_VECTOR_SHALLOW( vectorClass, Type ) class vectorClass {\ -\ -public:\ - typedef Type value_type;\ - typedef value_type* iterator;\ - typedef const value_type* const_iterator;\ - typedef iterator pointer;\ - typedef const iterator const_pointer;\ - typedef value_type& reference;\ - typedef const value_type& const_reference;\ - typedef size_t size_type;\ - typedef ptrdiff_t difference_type;\ -\ - typedef iterator OutputIterator;\ - typedef const_iterator InputIterator;\ -\ -protected:\ -\ - inline void PlacementCopy( const_iterator first, const_iterator last, iterator result )\ - {\ - memcpy(result, first, int(difference_type(last-first)*sizeof(value_type)) );\ - }\ -\ - inline void ConstructObjects( iterator first, iterator last, const value_type& pattern )\ - {\ - if ( sizeof(pattern) == 1 )\ - \ - memset( first, int(difference_type(last-first)/sizeof(value_type)), \ - int(*((char*)&pattern)) );\ - else\ - while( first != last ) \ - *first++ = pattern;\ - }\ -\ - inline void CopyObjects( iterator first, iterator last, iterator result )\ - {\ - memcpy(result, first, int(difference_type(last-first)*sizeof(value_type)) );\ - }\ -\ - inline void CopyObjectsBack( iterator first, iterator last, iterator result )\ - {\ - memmove(result, first, int(difference_type(last-first)*sizeof(value_type)) );\ - }\ -\ -public:\ -\ - class reverse_iterator \ - {\ - friend class vectorClass;\ - friend class const_reverse_iterator;\ -\ - public:\ - iterator mpPos;\ -\ - public:\ -\ - reverse_iterator() {}\ -\ - reverse_iterator ( iterator pPos )\ - {\ - mpPos = pPos;\ - }\ - \ - int operator==( const reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\ - int operator!=( const reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\ -\ - inline reverse_iterator( const reverse_iterator& other )\ - {\ - mpPos = other.mpPos;\ - }\ -\ - inline const reverse_iterator& operator--() \ - {\ - --mpPos;\ - return *this;\ - }\ -\ - inline reverse_iterator operator--(int)\ - {\ - reverse_iterator tmp = *this;\ - --mpPos;\ - return tmp;\ - }\ -\ - inline const reverse_iterator & operator++() \ - {\ - ++mpPos;\ - return *this;\ - }\ -\ - inline reverse_iterator operator++(int)\ - {\ - reverse_iterator tmp = *this;\ - ++mpPos;\ - return tmp;\ - }\ -\ - inline const_reference operator*() const { return *mpPos; }\ - };\ -\ -\ - class const_reverse_iterator \ - {\ - protected:\ - iterator mpPos;\ - public:\ -\ - const_reverse_iterator() {}\ -\ - const_reverse_iterator( const iterator pPos )\ - {\ - mpPos = pPos;\ - }\ - \ - int operator==( const const_reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\ - int operator!=( const const_reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\ -\ - inline const_reverse_iterator( const reverse_iterator& other )\ - {\ - mpPos = other.mpPos;\ - }\ -\ - inline const const_reverse_iterator& operator--() \ - {\ - --mpPos;\ - return *this;\ - }\ -\ - inline const_reverse_iterator operator--(int)\ - {\ - const_reverse_iterator tmp = *this;\ - --mpPos;\ - return tmp;\ - }\ -\ - inline const const_reverse_iterator & operator++() \ - {\ - ++mpPos;\ - return *this;\ - }\ -\ - inline const_reverse_iterator operator++(int)\ - {\ - const_reverse_iterator tmp = *this;\ - ++mpPos;\ - return tmp;\ - }\ -\ - inline const_reference operator*() const { return *mpPos; }\ - };\ -\ -protected:\ - \ - pointer mpStart;\ - pointer mpEnd;\ - pointer mpEndOfBuf;\ -\ -protected:\ -\ - inline void quick_sort(int low, int hi) \ - {\ - int pivot_index;\ - int left, right;\ -\ - pivot_index = ( !(mpStart[low] < mpStart[low+1])) ? low : (low+1);\ - value_type pivot_value = mpStart[pivot_index];\ -\ - left = low; right = hi;\ - do \ - {\ - while ((left <= hi) && (mpStart[left] < pivot_value)) left++;\ -\ - while ((right >= low) && (pivot_value < mpStart[right])) right--;\ -\ - if (left <= right) \ - {\ - value_type tmp = mpStart[left];\ - mpStart[left] = mpStart[right];\ - mpStart[right] = tmp;\ -\ - left++;\ - right--;\ - }\ - \ - } while (left <= right);\ - if (low < right) quick_sort(low, right);\ - if (left < hi) quick_sort(left, hi);\ - }\ -\ - inline void DestructRange( iterator first, iterator last )\ - {\ - }\ -\ - inline iterator DoInsert(iterator position, const value_type& x)\ - {\ - if ( mpEnd < mpEndOfBuf )\ - {\ - new (mpEnd) value_type(*(mpEnd-1) );\ - \ - CopyObjectsBack( position, mpEnd, position + 1 );\ - \ - *position = x;\ - \ - ++mpEnd;\ - \ - return position;\ - }\ - \ - size_type minBufLen = WXSTL_VECTOR_MIN_BUF_SIZE/sizeof(value_type);\ - \ - size_type doubledSize = size()*2;\ - \ - size_type newLen = ( doubledSize < minBufLen ) ? minBufLen : doubledSize;\ - \ - iterator pNewStart = (iterator)( new char[newLen*sizeof(value_type)] );\ - \ - PlacementCopy( mpStart, position, pNewStart );\ - \ - iterator atPosition = pNewStart + difference_type( position - mpStart );\ - \ - new (atPosition) value_type(x);\ - \ - iterator newPos = atPosition;\ - \ - ++atPosition;\ - \ - if ( mpStart ) \ - {\ - PlacementCopy( position, mpEnd, atPosition );\ - DestructRange( mpStart, mpEnd );\ - delete [](char*)mpStart;\ - }\ - \ - mpEnd = atPosition + difference_type( mpEnd - position );\ - \ - mpStart = pNewStart;\ - mpEndOfBuf = pNewStart + newLen;\ - \ - return newPos;\ - }\ -\ -public:\ -\ - inline vectorClass() : mpStart(0), \ - mpEnd(0),\ - mpEndOfBuf(0)\ - {}\ -\ - inline vectorClass( const_iterator first, const_iterator last )\ - : mpStart(0),\ - mpEnd(0),\ - mpEndOfBuf(0)\ - \ - { while( first != last ) push_back( *first++ ); }\ -\ - inline vectorClass( size_type n, const value_type& value = value_type() )\ - : mpStart(0),\ - mpEnd(0),\ - mpEndOfBuf(0)\ - \ - { for( size_type i = 0; i != n; ++i ) push_back( value ); }\ -\ - inline int operator==( const vectorClass& other )\ - {\ - size_type sz = size();\ -\ - if ( sz != other.size() ) return 0;\ -\ - for( size_type i = 0; i != sz; ++i )\ -\ - if ( !( (*this)[i] == other[i] ) ) return 0;\ -\ - return 1;\ -\ - }\ -\ - inline const vectorClass& operator=( const vectorClass& other )\ - {\ - if (mpStart) \ - {\ - DestructRange( begin(), end() );\ - delete [](char*)mpStart; \ - }\ -\ - size_t newLen = difference_type( other.mpEndOfBuf - other.mpStart );\ -\ - mpStart = (iterator)( new char[newLen*sizeof(value_type)] );\ -\ - PlacementCopy( other.begin(), other.end(), mpStart );\ -\ - mpEnd = mpStart + other.size();\ -\ - mpEndOfBuf = mpStart + newLen;\ -\ - return *this;\ - }\ -\ - inline vectorClass( const vectorClass& other )\ - : mpStart(0),\ - mpEnd(0),\ - mpEndOfBuf(0)\ - {\ - this->operator=( other );\ - }\ -\ - inline ~vectorClass() \ - { \ - if (mpStart) \ - {\ - DestructRange( begin(), end() );\ - delete [](char*)mpStart; \ - }\ - }\ -\ - inline iterator begin() { return mpStart; }\ -\ - inline const_iterator begin() const { return mpStart; }\ -\ - inline iterator end() { return mpEnd; }\ -\ - inline const_iterator end() const { return mpEnd; }\ -\ - inline size_type size() const { return (size_type)difference_type(mpEnd-mpStart); }\ -\ - inline size_type max_size() const { return UINT_MAX/sizeof(value_type); }\ -\ - inline size_type capacity() const \ - { return difference_type(mpEndOfBuf-mpStart)/sizeof(value_type); }\ -\ - inline int empty() const { return mpStart == mpEnd; }\ -\ - inline reference operator[](size_type n) { return *(mpStart+n); }\ -\ - inline const_reference operator[](size_type n) const { return *(mpStart+n); }\ -\ - inline reference front() { return (*mpStart); }\ - \ - inline const_reference front() const { return (*mpStart); }\ -\ - inline reference back() { return (*(mpEnd-1)); }\ -\ - inline const_reference back() const { return (*(mpEnd-1)); }\ -\ - inline void reserve(size_type n) {}\ -\ - inline void push_back(const value_type& x)\ - {\ - if ( mpEnd != mpEndOfBuf ) \ - {\ - new (mpEnd) value_type(x);\ - ++mpEnd;\ - }\ - else\ - DoInsert( mpEnd, x );\ - }\ -\ - inline iterator insert(iterator position, const value_type& x = value_type())\ - {\ - if ( position == mpEnd && mpEnd != mpEndOfBuf )\ - {\ - new (mpEnd) value_type(x);\ - ++mpEnd;\ - return (mpEnd-1);\ - }\ - else return DoInsert( position, x );\ - }\ -\ - inline void pop_back()\ - {\ - DestructRange( mpEnd-1, mpEnd );\ -\ - --mpEnd;\ - }\ -\ - inline void erase(iterator first, iterator last)\ - {\ - if ( last == mpEnd )\ - {\ - DestructRange( first, last );\ - mpEnd = first;\ - return;\ - }\ - \ - CopyObjects( last, last + difference_type( mpEnd - last ), first );\ - \ - iterator newEnd = mpEnd - difference_type( last - first );\ - DestructRange( newEnd, mpEnd );\ - \ - mpEnd = newEnd;\ - }\ -\ - inline void erase( iterator position )\ - {\ - erase( position, position + 1 );\ - }\ -\ - inline void sort()\ - {\ - if ( size() < 2 ) return;\ - quick_sort( 0, size()-1 );\ - }\ -} - - - -// redefine below symbol to change the default allocation unit of vector content buffer -#define WXSTL_VECTOR_MIN_BUF_SIZE 64 - -// defines vector class, where objects are copied -// using "deep-copy" sematics (i.e. by calling their copy constructors) - -#define WXSTL_VECTOR(ELEMENT_CLASS) \ -__DEFINE_STL_VECTOR_DEEP(_WXSTL_VECTOR_##ELEMENT_CLASS, ELEMENT_CLASS) - -// defines vector class, where objects are copied -// using "shallow-copy" sematics (i.e. instead of calling -// their constructors, memcpy() and memmove() are used to copy their raw data) - - -#define WXSTL_VECTOR_SHALLOW_COPY(ELEMENT_CLASS) __DEFINE_STL_VECTOR_SHALLOW(_WXSTL_VECTORSC_##ELEMENT_CLASS, ELEMENT_CLASS) - -#endif diff --git a/utils/wxPython/modules/ogl/build.cfg b/utils/wxPython/modules/ogl/build.cfg deleted file mode 100644 index 9f13a069d5..0000000000 --- a/utils/wxPython/modules/ogl/build.cfg +++ /dev/null @@ -1,23 +0,0 @@ -# -*- python -*- -import sys - -MODULE = 'oglc' -SWIGFILES = ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i', 'oglcanvas.i'] -SOURCES = ['oglhelpers.cpp'] - - -OTHERCFLAGS = '-I$(WXWIN)/contrib/include' - -if sys.platform == 'win32': - OTHERLIBS = '$(WXWIN)/contrib/lib/ogl$(LIBEXT).lib' -else: - OTHERLIBS = '-L$(WXWIN)/build/contrib/lib -logl' - -#OTHERSWIGFLAGS = '-stat' -SWIGDEPS = '_ogldefs.i' -OTHERDEPS = 'oglhelpers.h $(WXPSRCDIR)/helpers.h' - - -# There are no platform differences so we don't need separate code directories -GENCODEDIR='.' -SWIGTOOLKITFLAG='' diff --git a/utils/wxPython/modules/stubs/.cvsignore b/utils/wxPython/modules/stubs/.cvsignore deleted file mode 100644 index 61bf050b91..0000000000 --- a/utils/wxPython/modules/stubs/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -sedscript -Makefile.pre -Setup -config.c -Makefile -*.obj -*.pch -*.lib -*.exp - diff --git a/utils/wxPython/modules/stubs/README b/utils/wxPython/modules/stubs/README deleted file mode 100644 index f9448c9a03..0000000000 --- a/utils/wxPython/modules/stubs/README +++ /dev/null @@ -1,21 +0,0 @@ -Aug. 2 1999 Harm van der Heijden - -What's in here: - -Makefile.pre.in - A custom Makefile.pre.in, originally by Robin Dunn as part of the - wxPython source distribution. Intented for separate wxPython - modules, it should require little or no modification for other - module projects. In these modules they are all identical, except - the one for glcanvas (copies gtk/glcanvas from elsewhere) - -Setup.in - A custom Setup.in for building the modules below. It expects to find - the wxPython source dir in the directory specified by WXP_SRCDIR. - All modules are linked agains libwx_pymodule.so, which should - contain the SWIG runtime code and wxPython's helpers.cpp code. - -makefile.vc - Very small makefile (list of variable's really). It has a big - brother, makeinc.vc, in the modules dir which is shared by all - modules and does the real work. diff --git a/utils/wxPython/modules/stubs/gtk/.cvsignore b/utils/wxPython/modules/stubs/gtk/.cvsignore deleted file mode 100644 index b25c15b81f..0000000000 --- a/utils/wxPython/modules/stubs/gtk/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*~ diff --git a/utils/wxPython/modules/stubs/msw/.cvsignore b/utils/wxPython/modules/stubs/msw/.cvsignore deleted file mode 100644 index b25c15b81f..0000000000 --- a/utils/wxPython/modules/stubs/msw/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*~ diff --git a/utils/wxPython/modules/utils/.cvsignore b/utils/wxPython/modules/utils/.cvsignore deleted file mode 100644 index 6a5a263c16..0000000000 --- a/utils/wxPython/modules/utils/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile -build.local -utilsc.exp -utilsc.ilk -utilsc.pch -utilsc.pyd -wxp.pch diff --git a/utils/wxPython/modules/utils/build.cfg b/utils/wxPython/modules/utils/build.cfg deleted file mode 100644 index 7e1c3509f1..0000000000 --- a/utils/wxPython/modules/utils/build.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# -*- python -*- - -MODULE = 'utilsc' -SWIGFILES = ['utils.i', ] - diff --git a/utils/wxPython/modules/utils/gtk/utils.cpp b/utils/wxPython/modules/utils/gtk/utils.cpp deleted file mode 100644 index af297e19b7..0000000000 --- a/utils/wxPython/modules/utils/gtk/utils.cpp +++ /dev/null @@ -1,1336 +0,0 @@ -/* - * FILE : gtk/utils.cpp - * - * This file was automatically generated by : - * Simplified Wrapper and Interface Generator (SWIG) - * Version 1.1 (Patch 6) - * - * Portions Copyright (c) 1995-1998 - * The University of Utah and The Regents of the University of California. - * Permission is granted to distribute this file in any manner provided - * this notice remains intact. - * - * Do not make changes to this file--changes will be lost! - * - */ - - -#define SWIGCODE -/* Implementation : PYTHON */ - -#define SWIGPYTHON -#include <string.h> -#include <stdlib.h> -/* Definitions for Windows/Unix exporting */ -#if defined(__WIN32__) -# if defined(_MSC_VER) -# define SWIGEXPORT(a) __declspec(dllexport) a -# else -# if defined(__BORLANDC__) -# define SWIGEXPORT(a) a _export -# else -# define SWIGEXPORT(a) a -# endif -# endif -#else -# define SWIGEXPORT(a) a -#endif - -#ifdef __cplusplus -extern "C" { -#endif -#include "Python.h" -extern void SWIG_MakePtr(char *, void *, char *); -extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *)); -extern char *SWIG_GetPtr(char *, void **, char *); -extern char *SWIG_GetPtrObj(PyObject *, void **, char *); -extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); -extern PyObject *SWIG_newvarlink(void); -#ifdef __cplusplus -} -#endif -#define SWIG_init initutilsc - -#define SWIG_name "utilsc" - -#include "helpers.h" -#include <wx/config.h> - -static PyObject* l_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyList_Check(target)) { - o2 = target; - target = PyList_New(0); - PyList_Append(target, o2); - Py_XDECREF(o2); - } - PyList_Append(target,o); - Py_XDECREF(o); - } - return target; -} - -static PyObject* t_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyTuple_Check(target)) { - o2 = target; - target = PyTuple_New(1); - PyTuple_SetItem(target, 0, o2); - } - o3 = PyTuple_New(1); - PyTuple_SetItem(o3, 0, o); - - o2 = target; - target = PySequence_Concat(o2, o3); - Py_DECREF(o2); - Py_DECREF(o3); - } - return target; -} - - -extern byte* byte_LIST_helper(PyObject* source); -extern int* int_LIST_helper(PyObject* source); -extern long* long_LIST_helper(PyObject* source); -extern char** string_LIST_helper(PyObject* source); -extern wxPoint* wxPoint_LIST_helper(PyObject* source); -extern wxBitmap** wxBitmap_LIST_helper(PyObject* source); -extern wxString* wxString_LIST_helper(PyObject* source); -extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source); - - -static char* wxStringErrorMsg = "string type is required for parameter"; - -#if defined(__WXMSW__) - static wxString wxPyEmptyStr(""); -#endif - - static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) { - PyObject* ret = PyTuple_New(3); - if (ret) { - PyTuple_SET_ITEM(ret, 0, PyInt_FromLong(flag)); - PyTuple_SET_ITEM(ret, 1, PyString_FromString(str)); - PyTuple_SET_ITEM(ret, 2, PyInt_FromLong(index)); - } - return ret; - } -#ifdef __cplusplus -extern "C" { -#endif -#define new_wxConfig(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4) (new wxConfig(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4)) -static PyObject *_wrap_new_wxConfig(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _result; - wxString * _arg0 = (wxString *) &wxPyEmptyStr; - wxString * _arg1 = (wxString *) &wxPyEmptyStr; - wxString * _arg2 = (wxString *) &wxPyEmptyStr; - wxString * _arg3 = (wxString *) &wxPyEmptyStr; - long _arg4 = (long ) 0; - PyObject * _obj0 = 0; - PyObject * _obj1 = 0; - PyObject * _obj2 = 0; - PyObject * _obj3 = 0; - char *_kwnames[] = { "appName","vendorName","localFilename","globalFilename","style", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|OOOOl:new_wxConfig",_kwnames,&_obj0,&_obj1,&_obj2,&_obj3,&_arg4)) - return NULL; - if (_obj0) -{ - if (!PyString_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg0 = new wxString(PyString_AsString(_obj0), PyString_Size(_obj0)); -} - if (_obj1) -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} - if (_obj2) -{ - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); -} - if (_obj3) -{ - if (!PyString_Check(_obj3)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg3 = new wxString(PyString_AsString(_obj3), PyString_Size(_obj3)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxConfig *)new_wxConfig(*_arg0,*_arg1,*_arg2,*_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxConfig_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } -{ - if (_obj0) - delete _arg0; -} -{ - if (_obj1) - delete _arg1; -} -{ - if (_obj2) - delete _arg2; -} -{ - if (_obj3) - delete _arg3; -} - return _resultobj; -} - -#define delete_wxConfig(_swigobj) (delete _swigobj) -static PyObject *_wrap_delete_wxConfig(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxConfig",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxConfig. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - delete_wxConfig(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxConfig_DontCreateOnDemand(_swigobj) (_swigobj->DontCreateOnDemand()) -static PyObject *_wrap_wxConfig_DontCreateOnDemand(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_DontCreateOnDemand",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_DontCreateOnDemand. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxConfig_DontCreateOnDemand(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxConfig_DeleteAll(_swigobj) (_swigobj->DeleteAll()) -static PyObject *_wrap_wxConfig_DeleteAll(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_DeleteAll",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_DeleteAll. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_DeleteAll(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_DeleteEntry(_swigobj,_swigarg0,_swigarg1) (_swigobj->DeleteEntry(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_DeleteEntry(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - bool _arg2 = (bool ) TRUE; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - int tempbool2 = (int) TRUE; - char *_kwnames[] = { "self","key","bDeleteGroupIfEmpty", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxConfig_DeleteEntry",_kwnames,&_argo0,&_obj1,&tempbool2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_DeleteEntry. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} - _arg2 = (bool ) tempbool2; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_DeleteEntry(_arg0,*_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_DeleteGroup(_swigobj,_swigarg0) (_swigobj->DeleteGroup(_swigarg0)) -static PyObject *_wrap_wxConfig_DeleteGroup(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","key", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxConfig_DeleteGroup",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_DeleteGroup. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_DeleteGroup(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_Exists(_swigobj,_swigarg0) (_swigobj->Exists(_swigarg0)) -static PyObject *_wrap_wxConfig_Exists(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","strName", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxConfig_Exists",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_Exists. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_Exists(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_Flush(_swigobj,_swigarg0) (_swigobj->Flush(_swigarg0)) -static PyObject *_wrap_wxConfig_Flush(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - bool _arg1 = (bool ) FALSE; - PyObject * _argo0 = 0; - int tempbool1 = (int) FALSE; - char *_kwnames[] = { "self","bCurrentOnly", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxConfig_Flush",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_Flush. Expected _wxConfig_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_Flush(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_GetAppName(_swigobj) (_swigobj->GetAppName()) -static PyObject *_wrap_wxConfig_GetAppName(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_GetAppName",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetAppName. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxString (wxConfig_GetAppName(_arg0)); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); -} -{ - delete _result; -} - return _resultobj; -} - -static PyObject * wxConfig_GetFirstGroup(wxConfig *self) { - bool cont; - long index = 0; - wxString value; - - cont = self->GetFirstGroup(value, index); - return __EnumerationHelper(cont, value, index); - } -static PyObject *_wrap_wxConfig_GetFirstGroup(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - PyObject * _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_GetFirstGroup",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetFirstGroup. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (PyObject *)wxConfig_GetFirstGroup(_arg0); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = _result; -} - return _resultobj; -} - -static PyObject * wxConfig_GetFirstEntry(wxConfig *self) { - bool cont; - long index = 0; - wxString value; - - cont = self->GetFirstEntry(value, index); - return __EnumerationHelper(cont, value, index); - } -static PyObject *_wrap_wxConfig_GetFirstEntry(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - PyObject * _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_GetFirstEntry",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetFirstEntry. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (PyObject *)wxConfig_GetFirstEntry(_arg0); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = _result; -} - return _resultobj; -} - -static PyObject * wxConfig_GetNextGroup(wxConfig *self,long index) { - bool cont; - wxString value; - - cont = self->GetNextGroup(value, index); - return __EnumerationHelper(cont, value, index); - } -static PyObject *_wrap_wxConfig_GetNextGroup(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - PyObject * _result; - wxConfig * _arg0; - long _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","index", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxConfig_GetNextGroup",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetNextGroup. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (PyObject *)wxConfig_GetNextGroup(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = _result; -} - return _resultobj; -} - -static PyObject * wxConfig_GetNextEntry(wxConfig *self,long index) { - bool cont; - wxString value; - - cont = self->GetNextEntry(value, index); - return __EnumerationHelper(cont, value, index); - } -static PyObject *_wrap_wxConfig_GetNextEntry(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - PyObject * _result; - wxConfig * _arg0; - long _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","index", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxConfig_GetNextEntry",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetNextEntry. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (PyObject *)wxConfig_GetNextEntry(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = _result; -} - return _resultobj; -} - -#define wxConfig_GetNumberOfEntries(_swigobj,_swigarg0) (_swigobj->GetNumberOfEntries(_swigarg0)) -static PyObject *_wrap_wxConfig_GetNumberOfEntries(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxConfig * _arg0; - bool _arg1 = (bool ) FALSE; - PyObject * _argo0 = 0; - int tempbool1 = (int) FALSE; - char *_kwnames[] = { "self","bRecursive", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxConfig_GetNumberOfEntries",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetNumberOfEntries. Expected _wxConfig_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxConfig_GetNumberOfEntries(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_GetNumberOfGroups(_swigobj,_swigarg0) (_swigobj->GetNumberOfGroups(_swigarg0)) -static PyObject *_wrap_wxConfig_GetNumberOfGroups(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxConfig * _arg0; - bool _arg1 = (bool ) FALSE; - PyObject * _argo0 = 0; - int tempbool1 = (int) FALSE; - char *_kwnames[] = { "self","bRecursive", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxConfig_GetNumberOfGroups",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetNumberOfGroups. Expected _wxConfig_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxConfig_GetNumberOfGroups(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_GetPath(_swigobj) (_swigobj->GetPath()) -static PyObject *_wrap_wxConfig_GetPath(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_GetPath",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetPath. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxString (wxConfig_GetPath(_arg0)); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); -} -{ - delete _result; -} - return _resultobj; -} - -#define wxConfig_GetVendorName(_swigobj) (_swigobj->GetVendorName()) -static PyObject *_wrap_wxConfig_GetVendorName(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_GetVendorName",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetVendorName. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxString (wxConfig_GetVendorName(_arg0)); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); -} -{ - delete _result; -} - return _resultobj; -} - -#define wxConfig_HasEntry(_swigobj,_swigarg0) (_swigobj->HasEntry(_swigarg0)) -static PyObject *_wrap_wxConfig_HasEntry(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","strName", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxConfig_HasEntry",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_HasEntry. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_HasEntry(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_HasGroup(_swigobj,_swigarg0) (_swigobj->HasGroup(_swigarg0)) -static PyObject *_wrap_wxConfig_HasGroup(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","strName", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxConfig_HasGroup",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_HasGroup. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_HasGroup(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_IsExpandingEnvVars(_swigobj) (_swigobj->IsExpandingEnvVars()) -static PyObject *_wrap_wxConfig_IsExpandingEnvVars(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_IsExpandingEnvVars",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_IsExpandingEnvVars. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_IsExpandingEnvVars(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_IsRecordingDefaults(_swigobj) (_swigobj->IsRecordingDefaults()) -static PyObject *_wrap_wxConfig_IsRecordingDefaults(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_IsRecordingDefaults",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_IsRecordingDefaults. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_IsRecordingDefaults(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_Read(_swigobj,_swigarg0,_swigarg1) (_swigobj->Read(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_Read(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxConfig * _arg0; - wxString * _arg1; - wxString * _arg2 = (wxString *) &wxPyEmptyStr; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - PyObject * _obj2 = 0; - char *_kwnames[] = { "self","key","defaultVal", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|O:wxConfig_Read",_kwnames,&_argo0,&_obj1,&_obj2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_Read. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} - if (_obj2) -{ - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxString (wxConfig_Read(_arg0,*_arg1,*_arg2)); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); -} -{ - if (_obj1) - delete _arg1; -} -{ - if (_obj2) - delete _arg2; -} -{ - delete _result; -} - return _resultobj; -} - -#define wxConfig_ReadInt(_swigobj,_swigarg0,_swigarg1) (_swigobj->Read(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_ReadInt(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - long _result; - wxConfig * _arg0; - wxString * _arg1; - long _arg2 = (long ) 0; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","key","defaultVal", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|l:wxConfig_ReadInt",_kwnames,&_argo0,&_obj1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_ReadInt. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxConfig_ReadInt(_arg0,*_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("l",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_ReadFloat(_swigobj,_swigarg0,_swigarg1) (_swigobj->Read(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_ReadFloat(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - double _result; - wxConfig * _arg0; - wxString * _arg1; - double _arg2 = (double ) 0.0; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","key","defaultVal", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|d:wxConfig_ReadFloat",_kwnames,&_argo0,&_obj1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_ReadFloat. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (double )wxConfig_ReadFloat(_arg0,*_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("d",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_SetExpandEnvVars(_swigobj,_swigarg0) (_swigobj->SetExpandEnvVars(_swigarg0)) -static PyObject *_wrap_wxConfig_SetExpandEnvVars(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _arg0; - bool _arg1 = (bool ) TRUE; - PyObject * _argo0 = 0; - int tempbool1 = (int) TRUE; - char *_kwnames[] = { "self","bDoIt", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxConfig_SetExpandEnvVars",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_SetExpandEnvVars. Expected _wxConfig_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - wxConfig_SetExpandEnvVars(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxConfig_SetPath(_swigobj,_swigarg0) (_swigobj->SetPath(_swigarg0)) -static PyObject *_wrap_wxConfig_SetPath(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","strPath", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxConfig_SetPath",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_SetPath. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - wxConfig_SetPath(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_SetRecordDefaults(_swigobj,_swigarg0) (_swigobj->SetRecordDefaults(_swigarg0)) -static PyObject *_wrap_wxConfig_SetRecordDefaults(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _arg0; - bool _arg1 = (bool ) TRUE; - PyObject * _argo0 = 0; - int tempbool1 = (int) TRUE; - char *_kwnames[] = { "self","bDoIt", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxConfig_SetRecordDefaults",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_SetRecordDefaults. Expected _wxConfig_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - wxConfig_SetRecordDefaults(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxConfig_Write(_swigobj,_swigarg0,_swigarg1) (_swigobj->Write(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_Write(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - wxString * _arg2; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - PyObject * _obj2 = 0; - char *_kwnames[] = { "self","key","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxConfig_Write",_kwnames,&_argo0,&_obj1,&_obj2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_Write. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_Write(_arg0,*_arg1,*_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} -{ - if (_obj2) - delete _arg2; -} - return _resultobj; -} - -#define wxConfig_WriteInt(_swigobj,_swigarg0,_swigarg1) (_swigobj->Write(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_WriteInt(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - long _arg2; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","key","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOl:wxConfig_WriteInt",_kwnames,&_argo0,&_obj1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_WriteInt. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_WriteInt(_arg0,*_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_WriteFloat(_swigobj,_swigarg0,_swigarg1) (_swigobj->Write(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_WriteFloat(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - double _arg2; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","key","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOd:wxConfig_WriteFloat",_kwnames,&_argo0,&_obj1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_WriteFloat. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_WriteFloat(_arg0,*_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -static PyMethodDef utilscMethods[] = { - { "wxConfig_WriteFloat", (PyCFunction) _wrap_wxConfig_WriteFloat, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_WriteInt", (PyCFunction) _wrap_wxConfig_WriteInt, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_Write", (PyCFunction) _wrap_wxConfig_Write, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_SetRecordDefaults", (PyCFunction) _wrap_wxConfig_SetRecordDefaults, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_SetPath", (PyCFunction) _wrap_wxConfig_SetPath, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_SetExpandEnvVars", (PyCFunction) _wrap_wxConfig_SetExpandEnvVars, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_ReadFloat", (PyCFunction) _wrap_wxConfig_ReadFloat, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_ReadInt", (PyCFunction) _wrap_wxConfig_ReadInt, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_Read", (PyCFunction) _wrap_wxConfig_Read, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_IsRecordingDefaults", (PyCFunction) _wrap_wxConfig_IsRecordingDefaults, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_IsExpandingEnvVars", (PyCFunction) _wrap_wxConfig_IsExpandingEnvVars, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_HasGroup", (PyCFunction) _wrap_wxConfig_HasGroup, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_HasEntry", (PyCFunction) _wrap_wxConfig_HasEntry, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetVendorName", (PyCFunction) _wrap_wxConfig_GetVendorName, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetPath", (PyCFunction) _wrap_wxConfig_GetPath, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetNumberOfGroups", (PyCFunction) _wrap_wxConfig_GetNumberOfGroups, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetNumberOfEntries", (PyCFunction) _wrap_wxConfig_GetNumberOfEntries, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetNextEntry", (PyCFunction) _wrap_wxConfig_GetNextEntry, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetNextGroup", (PyCFunction) _wrap_wxConfig_GetNextGroup, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetFirstEntry", (PyCFunction) _wrap_wxConfig_GetFirstEntry, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetFirstGroup", (PyCFunction) _wrap_wxConfig_GetFirstGroup, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetAppName", (PyCFunction) _wrap_wxConfig_GetAppName, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_Flush", (PyCFunction) _wrap_wxConfig_Flush, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_Exists", (PyCFunction) _wrap_wxConfig_Exists, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_DeleteGroup", (PyCFunction) _wrap_wxConfig_DeleteGroup, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_DeleteEntry", (PyCFunction) _wrap_wxConfig_DeleteEntry, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_DeleteAll", (PyCFunction) _wrap_wxConfig_DeleteAll, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_DontCreateOnDemand", (PyCFunction) _wrap_wxConfig_DontCreateOnDemand, METH_VARARGS | METH_KEYWORDS }, - { "delete_wxConfig", (PyCFunction) _wrap_delete_wxConfig, METH_VARARGS | METH_KEYWORDS }, - { "new_wxConfig", (PyCFunction) _wrap_new_wxConfig, METH_VARARGS | METH_KEYWORDS }, - { NULL, NULL } -}; -#ifdef __cplusplus -} -#endif -/* - * This table is used by the pointer type-checker - */ -static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { - { "_signed_long","_long",0}, - { "_long","_unsigned_long",0}, - { "_long","_signed_long",0}, - { "_wxConfig","_class_wxConfig",0}, - { "_unsigned_long","_long",0}, - { "_signed_int","_int",0}, - { "_unsigned_short","_short",0}, - { "_signed_short","_short",0}, - { "_unsigned_int","_int",0}, - { "_short","_unsigned_short",0}, - { "_short","_signed_short",0}, - { "_int","_unsigned_int",0}, - { "_int","_signed_int",0}, - { "_class_wxConfig","_wxConfig",0}, -{0,0,0}}; - -static PyObject *SWIG_globals; -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT(void) initutilsc() { - PyObject *m, *d; - SWIG_globals = SWIG_newvarlink(); - m = Py_InitModule("utilsc", utilscMethods); - d = PyModule_GetDict(m); - - - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); - -{ - int i; - for (i = 0; _swig_mapping[i].n1; i++) - SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv); -} -} diff --git a/utils/wxPython/modules/utils/gtk/utils.py b/utils/wxPython/modules/utils/gtk/utils.py deleted file mode 100644 index 86f4d662d1..0000000000 --- a/utils/wxPython/modules/utils/gtk/utils.py +++ /dev/null @@ -1,111 +0,0 @@ -# This file was created automatically by SWIG. -import utilsc -class wxConfigPtr : - def __init__(self,this): - self.this = this - self.thisown = 0 - def __del__(self,utilsc=utilsc): - if self.thisown == 1 : - utilsc.delete_wxConfig(self) - def DontCreateOnDemand(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_DontCreateOnDemand,(self,) + _args, _kwargs) - return val - def DeleteAll(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_DeleteAll,(self,) + _args, _kwargs) - return val - def DeleteEntry(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_DeleteEntry,(self,) + _args, _kwargs) - return val - def DeleteGroup(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_DeleteGroup,(self,) + _args, _kwargs) - return val - def Exists(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_Exists,(self,) + _args, _kwargs) - return val - def Flush(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_Flush,(self,) + _args, _kwargs) - return val - def GetAppName(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetAppName,(self,) + _args, _kwargs) - return val - def GetFirstGroup(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetFirstGroup,(self,) + _args, _kwargs) - return val - def GetFirstEntry(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetFirstEntry,(self,) + _args, _kwargs) - return val - def GetNextGroup(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetNextGroup,(self,) + _args, _kwargs) - return val - def GetNextEntry(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetNextEntry,(self,) + _args, _kwargs) - return val - def GetNumberOfEntries(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetNumberOfEntries,(self,) + _args, _kwargs) - return val - def GetNumberOfGroups(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetNumberOfGroups,(self,) + _args, _kwargs) - return val - def GetPath(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetPath,(self,) + _args, _kwargs) - return val - def GetVendorName(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetVendorName,(self,) + _args, _kwargs) - return val - def HasEntry(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_HasEntry,(self,) + _args, _kwargs) - return val - def HasGroup(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_HasGroup,(self,) + _args, _kwargs) - return val - def IsExpandingEnvVars(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_IsExpandingEnvVars,(self,) + _args, _kwargs) - return val - def IsRecordingDefaults(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_IsRecordingDefaults,(self,) + _args, _kwargs) - return val - def Read(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_Read,(self,) + _args, _kwargs) - return val - def ReadInt(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_ReadInt,(self,) + _args, _kwargs) - return val - def ReadFloat(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_ReadFloat,(self,) + _args, _kwargs) - return val - def SetExpandEnvVars(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_SetExpandEnvVars,(self,) + _args, _kwargs) - return val - def SetPath(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_SetPath,(self,) + _args, _kwargs) - return val - def SetRecordDefaults(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_SetRecordDefaults,(self,) + _args, _kwargs) - return val - def Write(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_Write,(self,) + _args, _kwargs) - return val - def WriteInt(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_WriteInt,(self,) + _args, _kwargs) - return val - def WriteFloat(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_WriteFloat,(self,) + _args, _kwargs) - return val - def __repr__(self): - return "<C wxConfig instance at %s>" % (self.this,) -class wxConfig(wxConfigPtr): - def __init__(self,*_args,**_kwargs): - self.this = apply(utilsc.new_wxConfig,_args,_kwargs) - self.thisown = 1 - - - - - - -#-------------- FUNCTION WRAPPERS ------------------ - - - -#-------------- VARIABLE WRAPPERS ------------------ - diff --git a/utils/wxPython/modules/utils/msw/utils.cpp b/utils/wxPython/modules/utils/msw/utils.cpp deleted file mode 100644 index e593772604..0000000000 --- a/utils/wxPython/modules/utils/msw/utils.cpp +++ /dev/null @@ -1,1336 +0,0 @@ -/* - * FILE : msw/utils.cpp - * - * This file was automatically generated by : - * Simplified Wrapper and Interface Generator (SWIG) - * Version 1.1 (Build 802) - * - * Portions Copyright (c) 1995-1998 - * The University of Utah and The Regents of the University of California. - * Permission is granted to distribute this file in any manner provided - * this notice remains intact. - * - * Do not make changes to this file--changes will be lost! - * - */ - - -#define SWIGCODE -/* Implementation : PYTHON */ - -#define SWIGPYTHON -#include <string.h> -#include <stdlib.h> -/* Definitions for Windows/Unix exporting */ -#if defined(__WIN32__) -# if defined(_MSC_VER) -# define SWIGEXPORT(a) __declspec(dllexport) a -# else -# if defined(__BORLANDC__) -# define SWIGEXPORT(a) a _export -# else -# define SWIGEXPORT(a) a -# endif -# endif -#else -# define SWIGEXPORT(a) a -#endif - -#ifdef __cplusplus -extern "C" { -#endif -#include "Python.h" -extern void SWIG_MakePtr(char *, void *, char *); -extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *)); -extern char *SWIG_GetPtr(char *, void **, char *); -extern char *SWIG_GetPtrObj(PyObject *, void **, char *); -extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); -extern PyObject *SWIG_newvarlink(void); -#ifdef __cplusplus -} -#endif -#define SWIG_init initutilsc - -#define SWIG_name "utilsc" - -#include "helpers.h" -#include <wx/config.h> - -static PyObject* l_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyList_Check(target)) { - o2 = target; - target = PyList_New(0); - PyList_Append(target, o2); - Py_XDECREF(o2); - } - PyList_Append(target,o); - Py_XDECREF(o); - } - return target; -} - -static PyObject* t_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyTuple_Check(target)) { - o2 = target; - target = PyTuple_New(1); - PyTuple_SetItem(target, 0, o2); - } - o3 = PyTuple_New(1); - PyTuple_SetItem(o3, 0, o); - - o2 = target; - target = PySequence_Concat(o2, o3); - Py_DECREF(o2); - Py_DECREF(o3); - } - return target; -} - - -extern byte* byte_LIST_helper(PyObject* source); -extern int* int_LIST_helper(PyObject* source); -extern long* long_LIST_helper(PyObject* source); -extern char** string_LIST_helper(PyObject* source); -extern wxPoint* wxPoint_LIST_helper(PyObject* source); -extern wxBitmap** wxBitmap_LIST_helper(PyObject* source); -extern wxString* wxString_LIST_helper(PyObject* source); -extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source); - - -static char* wxStringErrorMsg = "string type is required for parameter"; - -#if defined(__WXMSW__) - static wxString wxPyEmptyStr(""); -#endif - - static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) { - PyObject* ret = PyTuple_New(3); - if (ret) { - PyTuple_SET_ITEM(ret, 0, PyInt_FromLong(flag)); - PyTuple_SET_ITEM(ret, 1, PyString_FromString(str)); - PyTuple_SET_ITEM(ret, 2, PyInt_FromLong(index)); - } - return ret; - } -#ifdef __cplusplus -extern "C" { -#endif -#define new_wxConfig(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4) (new wxConfig(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4)) -static PyObject *_wrap_new_wxConfig(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _result; - wxString * _arg0 = (wxString *) &wxPyEmptyStr; - wxString * _arg1 = (wxString *) &wxPyEmptyStr; - wxString * _arg2 = (wxString *) &wxPyEmptyStr; - wxString * _arg3 = (wxString *) &wxPyEmptyStr; - long _arg4 = (long ) 0; - PyObject * _obj0 = 0; - PyObject * _obj1 = 0; - PyObject * _obj2 = 0; - PyObject * _obj3 = 0; - char *_kwnames[] = { "appName","vendorName","localFilename","globalFilename","style", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|OOOOl:new_wxConfig",_kwnames,&_obj0,&_obj1,&_obj2,&_obj3,&_arg4)) - return NULL; - if (_obj0) -{ - if (!PyString_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg0 = new wxString(PyString_AsString(_obj0), PyString_Size(_obj0)); -} - if (_obj1) -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} - if (_obj2) -{ - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); -} - if (_obj3) -{ - if (!PyString_Check(_obj3)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg3 = new wxString(PyString_AsString(_obj3), PyString_Size(_obj3)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxConfig *)new_wxConfig(*_arg0,*_arg1,*_arg2,*_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxConfig_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } -{ - if (_obj0) - delete _arg0; -} -{ - if (_obj1) - delete _arg1; -} -{ - if (_obj2) - delete _arg2; -} -{ - if (_obj3) - delete _arg3; -} - return _resultobj; -} - -#define delete_wxConfig(_swigobj) (delete _swigobj) -static PyObject *_wrap_delete_wxConfig(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxConfig",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxConfig. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - delete_wxConfig(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxConfig_DontCreateOnDemand(_swigobj) (_swigobj->DontCreateOnDemand()) -static PyObject *_wrap_wxConfig_DontCreateOnDemand(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_DontCreateOnDemand",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_DontCreateOnDemand. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxConfig_DontCreateOnDemand(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxConfig_DeleteAll(_swigobj) (_swigobj->DeleteAll()) -static PyObject *_wrap_wxConfig_DeleteAll(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_DeleteAll",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_DeleteAll. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_DeleteAll(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_DeleteEntry(_swigobj,_swigarg0,_swigarg1) (_swigobj->DeleteEntry(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_DeleteEntry(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - bool _arg2 = (bool ) TRUE; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - int tempbool2 = (int) TRUE; - char *_kwnames[] = { "self","key","bDeleteGroupIfEmpty", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxConfig_DeleteEntry",_kwnames,&_argo0,&_obj1,&tempbool2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_DeleteEntry. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} - _arg2 = (bool ) tempbool2; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_DeleteEntry(_arg0,*_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_DeleteGroup(_swigobj,_swigarg0) (_swigobj->DeleteGroup(_swigarg0)) -static PyObject *_wrap_wxConfig_DeleteGroup(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","key", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxConfig_DeleteGroup",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_DeleteGroup. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_DeleteGroup(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_Exists(_swigobj,_swigarg0) (_swigobj->Exists(_swigarg0)) -static PyObject *_wrap_wxConfig_Exists(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","strName", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxConfig_Exists",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_Exists. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_Exists(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_Flush(_swigobj,_swigarg0) (_swigobj->Flush(_swigarg0)) -static PyObject *_wrap_wxConfig_Flush(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - bool _arg1 = (bool ) FALSE; - PyObject * _argo0 = 0; - int tempbool1 = (int) FALSE; - char *_kwnames[] = { "self","bCurrentOnly", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxConfig_Flush",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_Flush. Expected _wxConfig_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_Flush(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_GetAppName(_swigobj) (_swigobj->GetAppName()) -static PyObject *_wrap_wxConfig_GetAppName(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_GetAppName",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetAppName. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxString (wxConfig_GetAppName(_arg0)); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); -} -{ - delete _result; -} - return _resultobj; -} - -static PyObject * wxConfig_GetFirstGroup(wxConfig *self) { - bool cont; - long index = 0; - wxString value; - - cont = self->GetFirstGroup(value, index); - return __EnumerationHelper(cont, value, index); - } -static PyObject *_wrap_wxConfig_GetFirstGroup(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - PyObject * _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_GetFirstGroup",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetFirstGroup. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (PyObject *)wxConfig_GetFirstGroup(_arg0); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = _result; -} - return _resultobj; -} - -static PyObject * wxConfig_GetFirstEntry(wxConfig *self) { - bool cont; - long index = 0; - wxString value; - - cont = self->GetFirstEntry(value, index); - return __EnumerationHelper(cont, value, index); - } -static PyObject *_wrap_wxConfig_GetFirstEntry(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - PyObject * _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_GetFirstEntry",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetFirstEntry. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (PyObject *)wxConfig_GetFirstEntry(_arg0); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = _result; -} - return _resultobj; -} - -static PyObject * wxConfig_GetNextGroup(wxConfig *self,long index) { - bool cont; - wxString value; - - cont = self->GetNextGroup(value, index); - return __EnumerationHelper(cont, value, index); - } -static PyObject *_wrap_wxConfig_GetNextGroup(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - PyObject * _result; - wxConfig * _arg0; - long _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","index", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxConfig_GetNextGroup",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetNextGroup. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (PyObject *)wxConfig_GetNextGroup(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = _result; -} - return _resultobj; -} - -static PyObject * wxConfig_GetNextEntry(wxConfig *self,long index) { - bool cont; - wxString value; - - cont = self->GetNextEntry(value, index); - return __EnumerationHelper(cont, value, index); - } -static PyObject *_wrap_wxConfig_GetNextEntry(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - PyObject * _result; - wxConfig * _arg0; - long _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","index", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxConfig_GetNextEntry",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetNextEntry. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (PyObject *)wxConfig_GetNextEntry(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = _result; -} - return _resultobj; -} - -#define wxConfig_GetNumberOfEntries(_swigobj,_swigarg0) (_swigobj->GetNumberOfEntries(_swigarg0)) -static PyObject *_wrap_wxConfig_GetNumberOfEntries(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxConfig * _arg0; - bool _arg1 = (bool ) FALSE; - PyObject * _argo0 = 0; - int tempbool1 = (int) FALSE; - char *_kwnames[] = { "self","bRecursive", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxConfig_GetNumberOfEntries",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetNumberOfEntries. Expected _wxConfig_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxConfig_GetNumberOfEntries(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_GetNumberOfGroups(_swigobj,_swigarg0) (_swigobj->GetNumberOfGroups(_swigarg0)) -static PyObject *_wrap_wxConfig_GetNumberOfGroups(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxConfig * _arg0; - bool _arg1 = (bool ) FALSE; - PyObject * _argo0 = 0; - int tempbool1 = (int) FALSE; - char *_kwnames[] = { "self","bRecursive", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxConfig_GetNumberOfGroups",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetNumberOfGroups. Expected _wxConfig_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxConfig_GetNumberOfGroups(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_GetPath(_swigobj) (_swigobj->GetPath()) -static PyObject *_wrap_wxConfig_GetPath(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_GetPath",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetPath. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxString (wxConfig_GetPath(_arg0)); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); -} -{ - delete _result; -} - return _resultobj; -} - -#define wxConfig_GetVendorName(_swigobj) (_swigobj->GetVendorName()) -static PyObject *_wrap_wxConfig_GetVendorName(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_GetVendorName",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_GetVendorName. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxString (wxConfig_GetVendorName(_arg0)); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); -} -{ - delete _result; -} - return _resultobj; -} - -#define wxConfig_HasEntry(_swigobj,_swigarg0) (_swigobj->HasEntry(_swigarg0)) -static PyObject *_wrap_wxConfig_HasEntry(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","strName", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxConfig_HasEntry",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_HasEntry. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_HasEntry(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_HasGroup(_swigobj,_swigarg0) (_swigobj->HasGroup(_swigarg0)) -static PyObject *_wrap_wxConfig_HasGroup(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","strName", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxConfig_HasGroup",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_HasGroup. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_HasGroup(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_IsExpandingEnvVars(_swigobj) (_swigobj->IsExpandingEnvVars()) -static PyObject *_wrap_wxConfig_IsExpandingEnvVars(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_IsExpandingEnvVars",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_IsExpandingEnvVars. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_IsExpandingEnvVars(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_IsRecordingDefaults(_swigobj) (_swigobj->IsRecordingDefaults()) -static PyObject *_wrap_wxConfig_IsRecordingDefaults(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxConfig_IsRecordingDefaults",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_IsRecordingDefaults. Expected _wxConfig_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_IsRecordingDefaults(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxConfig_Read(_swigobj,_swigarg0,_swigarg1) (_swigobj->Read(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_Read(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxConfig * _arg0; - wxString * _arg1; - wxString * _arg2 = (wxString *) &wxPyEmptyStr; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - PyObject * _obj2 = 0; - char *_kwnames[] = { "self","key","defaultVal", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|O:wxConfig_Read",_kwnames,&_argo0,&_obj1,&_obj2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_Read. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} - if (_obj2) -{ - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxString (wxConfig_Read(_arg0,*_arg1,*_arg2)); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); -} -{ - if (_obj1) - delete _arg1; -} -{ - if (_obj2) - delete _arg2; -} -{ - delete _result; -} - return _resultobj; -} - -#define wxConfig_ReadInt(_swigobj,_swigarg0,_swigarg1) (_swigobj->Read(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_ReadInt(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - long _result; - wxConfig * _arg0; - wxString * _arg1; - long _arg2 = (long ) 0; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","key","defaultVal", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|l:wxConfig_ReadInt",_kwnames,&_argo0,&_obj1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_ReadInt. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxConfig_ReadInt(_arg0,*_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("l",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_ReadFloat(_swigobj,_swigarg0,_swigarg1) (_swigobj->Read(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_ReadFloat(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - double _result; - wxConfig * _arg0; - wxString * _arg1; - double _arg2 = (double ) 0.0; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","key","defaultVal", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|d:wxConfig_ReadFloat",_kwnames,&_argo0,&_obj1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_ReadFloat. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (double )wxConfig_ReadFloat(_arg0,*_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("d",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_SetExpandEnvVars(_swigobj,_swigarg0) (_swigobj->SetExpandEnvVars(_swigarg0)) -static PyObject *_wrap_wxConfig_SetExpandEnvVars(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _arg0; - bool _arg1 = (bool ) TRUE; - PyObject * _argo0 = 0; - int tempbool1 = (int) TRUE; - char *_kwnames[] = { "self","bDoIt", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxConfig_SetExpandEnvVars",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_SetExpandEnvVars. Expected _wxConfig_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - wxConfig_SetExpandEnvVars(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxConfig_SetPath(_swigobj,_swigarg0) (_swigobj->SetPath(_swigarg0)) -static PyObject *_wrap_wxConfig_SetPath(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","strPath", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxConfig_SetPath",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_SetPath. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - wxConfig_SetPath(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_SetRecordDefaults(_swigobj,_swigarg0) (_swigobj->SetRecordDefaults(_swigarg0)) -static PyObject *_wrap_wxConfig_SetRecordDefaults(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxConfig * _arg0; - bool _arg1 = (bool ) TRUE; - PyObject * _argo0 = 0; - int tempbool1 = (int) TRUE; - char *_kwnames[] = { "self","bDoIt", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxConfig_SetRecordDefaults",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_SetRecordDefaults. Expected _wxConfig_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - wxConfig_SetRecordDefaults(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxConfig_Write(_swigobj,_swigarg0,_swigarg1) (_swigobj->Write(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_Write(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - wxString * _arg2; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - PyObject * _obj2 = 0; - char *_kwnames[] = { "self","key","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxConfig_Write",_kwnames,&_argo0,&_obj1,&_obj2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_Write. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_Write(_arg0,*_arg1,*_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} -{ - if (_obj2) - delete _arg2; -} - return _resultobj; -} - -#define wxConfig_WriteInt(_swigobj,_swigarg0,_swigarg1) (_swigobj->Write(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_WriteInt(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - long _arg2; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","key","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOl:wxConfig_WriteInt",_kwnames,&_argo0,&_obj1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_WriteInt. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_WriteInt(_arg0,*_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxConfig_WriteFloat(_swigobj,_swigarg0,_swigarg1) (_swigobj->Write(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxConfig_WriteFloat(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxConfig * _arg0; - wxString * _arg1; - double _arg2; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","key","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOd:wxConfig_WriteFloat",_kwnames,&_argo0,&_obj1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxConfig_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxConfig_WriteFloat. Expected _wxConfig_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxConfig_WriteFloat(_arg0,*_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -static PyMethodDef utilscMethods[] = { - { "wxConfig_WriteFloat", (PyCFunction) _wrap_wxConfig_WriteFloat, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_WriteInt", (PyCFunction) _wrap_wxConfig_WriteInt, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_Write", (PyCFunction) _wrap_wxConfig_Write, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_SetRecordDefaults", (PyCFunction) _wrap_wxConfig_SetRecordDefaults, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_SetPath", (PyCFunction) _wrap_wxConfig_SetPath, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_SetExpandEnvVars", (PyCFunction) _wrap_wxConfig_SetExpandEnvVars, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_ReadFloat", (PyCFunction) _wrap_wxConfig_ReadFloat, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_ReadInt", (PyCFunction) _wrap_wxConfig_ReadInt, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_Read", (PyCFunction) _wrap_wxConfig_Read, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_IsRecordingDefaults", (PyCFunction) _wrap_wxConfig_IsRecordingDefaults, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_IsExpandingEnvVars", (PyCFunction) _wrap_wxConfig_IsExpandingEnvVars, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_HasGroup", (PyCFunction) _wrap_wxConfig_HasGroup, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_HasEntry", (PyCFunction) _wrap_wxConfig_HasEntry, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetVendorName", (PyCFunction) _wrap_wxConfig_GetVendorName, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetPath", (PyCFunction) _wrap_wxConfig_GetPath, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetNumberOfGroups", (PyCFunction) _wrap_wxConfig_GetNumberOfGroups, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetNumberOfEntries", (PyCFunction) _wrap_wxConfig_GetNumberOfEntries, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetNextEntry", (PyCFunction) _wrap_wxConfig_GetNextEntry, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetNextGroup", (PyCFunction) _wrap_wxConfig_GetNextGroup, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetFirstEntry", (PyCFunction) _wrap_wxConfig_GetFirstEntry, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetFirstGroup", (PyCFunction) _wrap_wxConfig_GetFirstGroup, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_GetAppName", (PyCFunction) _wrap_wxConfig_GetAppName, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_Flush", (PyCFunction) _wrap_wxConfig_Flush, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_Exists", (PyCFunction) _wrap_wxConfig_Exists, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_DeleteGroup", (PyCFunction) _wrap_wxConfig_DeleteGroup, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_DeleteEntry", (PyCFunction) _wrap_wxConfig_DeleteEntry, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_DeleteAll", (PyCFunction) _wrap_wxConfig_DeleteAll, METH_VARARGS | METH_KEYWORDS }, - { "wxConfig_DontCreateOnDemand", (PyCFunction) _wrap_wxConfig_DontCreateOnDemand, METH_VARARGS | METH_KEYWORDS }, - { "delete_wxConfig", (PyCFunction) _wrap_delete_wxConfig, METH_VARARGS | METH_KEYWORDS }, - { "new_wxConfig", (PyCFunction) _wrap_new_wxConfig, METH_VARARGS | METH_KEYWORDS }, - { NULL, NULL } -}; -#ifdef __cplusplus -} -#endif -/* - * This table is used by the pointer type-checker - */ -static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { - { "_signed_long","_long",0}, - { "_long","_unsigned_long",0}, - { "_long","_signed_long",0}, - { "_wxConfig","_class_wxConfig",0}, - { "_unsigned_long","_long",0}, - { "_signed_int","_int",0}, - { "_unsigned_short","_short",0}, - { "_signed_short","_short",0}, - { "_unsigned_int","_int",0}, - { "_short","_unsigned_short",0}, - { "_short","_signed_short",0}, - { "_int","_unsigned_int",0}, - { "_int","_signed_int",0}, - { "_class_wxConfig","_wxConfig",0}, -{0,0,0}}; - -static PyObject *SWIG_globals; -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT(void) initutilsc() { - PyObject *m, *d; - SWIG_globals = SWIG_newvarlink(); - m = Py_InitModule("utilsc", utilscMethods); - d = PyModule_GetDict(m); - - - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); - -{ - int i; - for (i = 0; _swig_mapping[i].n1; i++) - SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv); -} -} diff --git a/utils/wxPython/modules/utils/msw/utils.py b/utils/wxPython/modules/utils/msw/utils.py deleted file mode 100644 index 86f4d662d1..0000000000 --- a/utils/wxPython/modules/utils/msw/utils.py +++ /dev/null @@ -1,111 +0,0 @@ -# This file was created automatically by SWIG. -import utilsc -class wxConfigPtr : - def __init__(self,this): - self.this = this - self.thisown = 0 - def __del__(self,utilsc=utilsc): - if self.thisown == 1 : - utilsc.delete_wxConfig(self) - def DontCreateOnDemand(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_DontCreateOnDemand,(self,) + _args, _kwargs) - return val - def DeleteAll(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_DeleteAll,(self,) + _args, _kwargs) - return val - def DeleteEntry(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_DeleteEntry,(self,) + _args, _kwargs) - return val - def DeleteGroup(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_DeleteGroup,(self,) + _args, _kwargs) - return val - def Exists(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_Exists,(self,) + _args, _kwargs) - return val - def Flush(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_Flush,(self,) + _args, _kwargs) - return val - def GetAppName(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetAppName,(self,) + _args, _kwargs) - return val - def GetFirstGroup(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetFirstGroup,(self,) + _args, _kwargs) - return val - def GetFirstEntry(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetFirstEntry,(self,) + _args, _kwargs) - return val - def GetNextGroup(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetNextGroup,(self,) + _args, _kwargs) - return val - def GetNextEntry(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetNextEntry,(self,) + _args, _kwargs) - return val - def GetNumberOfEntries(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetNumberOfEntries,(self,) + _args, _kwargs) - return val - def GetNumberOfGroups(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetNumberOfGroups,(self,) + _args, _kwargs) - return val - def GetPath(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetPath,(self,) + _args, _kwargs) - return val - def GetVendorName(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_GetVendorName,(self,) + _args, _kwargs) - return val - def HasEntry(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_HasEntry,(self,) + _args, _kwargs) - return val - def HasGroup(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_HasGroup,(self,) + _args, _kwargs) - return val - def IsExpandingEnvVars(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_IsExpandingEnvVars,(self,) + _args, _kwargs) - return val - def IsRecordingDefaults(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_IsRecordingDefaults,(self,) + _args, _kwargs) - return val - def Read(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_Read,(self,) + _args, _kwargs) - return val - def ReadInt(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_ReadInt,(self,) + _args, _kwargs) - return val - def ReadFloat(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_ReadFloat,(self,) + _args, _kwargs) - return val - def SetExpandEnvVars(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_SetExpandEnvVars,(self,) + _args, _kwargs) - return val - def SetPath(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_SetPath,(self,) + _args, _kwargs) - return val - def SetRecordDefaults(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_SetRecordDefaults,(self,) + _args, _kwargs) - return val - def Write(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_Write,(self,) + _args, _kwargs) - return val - def WriteInt(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_WriteInt,(self,) + _args, _kwargs) - return val - def WriteFloat(self, *_args, **_kwargs): - val = apply(utilsc.wxConfig_WriteFloat,(self,) + _args, _kwargs) - return val - def __repr__(self): - return "<C wxConfig instance at %s>" % (self.this,) -class wxConfig(wxConfigPtr): - def __init__(self,*_args,**_kwargs): - self.this = apply(utilsc.new_wxConfig,_args,_kwargs) - self.thisown = 1 - - - - - - -#-------------- FUNCTION WRAPPERS ------------------ - - - -#-------------- VARIABLE WRAPPERS ------------------ - diff --git a/utils/wxPython/modules/utils/utils.i b/utils/wxPython/modules/utils/utils.i deleted file mode 100644 index b97de6e256..0000000000 --- a/utils/wxPython/modules/utils/utils.i +++ /dev/null @@ -1,139 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: utils.i -// Purpose: SWIG definitions of various utility classes -// -// Author: Robin Dunn -// -// Created: 25-nov-1998 -// RCS-ID: $Id$ -// Copyright: (c) 1998 by Total Control Software -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - - -%module utils - -%{ -#include "helpers.h" -#include <wx/config.h> -%} - -//--------------------------------------------------------------------------- - -%include typemaps.i -%include my_typemaps.i - - -%{ -#if defined(__WXMSW__) - static wxString wxPyEmptyStr(""); -#endif -%} - - -%{ - static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) { - PyObject* ret = PyTuple_New(3); - if (ret) { - PyTuple_SET_ITEM(ret, 0, PyInt_FromLong(flag)); - PyTuple_SET_ITEM(ret, 1, PyString_FromString(str)); - PyTuple_SET_ITEM(ret, 2, PyInt_FromLong(index)); - } - return ret; - } -%} - -//--------------------------------------------------------------------------- - -class wxConfig { -public: - wxConfig(const wxString& appName = wxPyEmptyStr, - const wxString& vendorName = wxPyEmptyStr, - const wxString& localFilename = wxPyEmptyStr, - const wxString& globalFilename = wxPyEmptyStr, - long style = 0); - ~wxConfig(); - - - void DontCreateOnDemand(); - bool DeleteAll(); // This is supposed to have been fixed... - bool DeleteEntry(const wxString& key, bool bDeleteGroupIfEmpty = TRUE); - bool DeleteGroup(const wxString& key); - bool Exists(wxString& strName); - bool Flush(bool bCurrentOnly = FALSE); - wxString GetAppName(); - - - // Each of these enumeration methods return a 3-tuple consisting of - // the continue flag, the value string, and the index for the next call. - %addmethods { - PyObject* GetFirstGroup() { - bool cont; - long index = 0; - wxString value; - - cont = self->GetFirstGroup(value, index); - return __EnumerationHelper(cont, value, index); - } - - PyObject* GetFirstEntry() { - bool cont; - long index = 0; - wxString value; - - cont = self->GetFirstEntry(value, index); - return __EnumerationHelper(cont, value, index); - } - - PyObject* GetNextGroup(long index) { - bool cont; - wxString value; - - cont = self->GetNextGroup(value, index); - return __EnumerationHelper(cont, value, index); - } - - PyObject* GetNextEntry(long index) { - bool cont; - wxString value; - - cont = self->GetNextEntry(value, index); - return __EnumerationHelper(cont, value, index); - } - } - - - int GetNumberOfEntries(bool bRecursive = FALSE); - int GetNumberOfGroups(bool bRecursive = FALSE); - wxString GetPath(); - wxString GetVendorName(); - bool HasEntry(wxString& strName); - bool HasGroup(const wxString& strName); - bool IsExpandingEnvVars(); - bool IsRecordingDefaults(); - - wxString Read(const wxString& key, const wxString& defaultVal = wxPyEmptyStr); - %name(ReadInt)long Read(const wxString& key, long defaultVal = 0); - %name(ReadFloat)double Read(const wxString& key, double defaultVal = 0.0); - - void SetExpandEnvVars (bool bDoIt = TRUE); - void SetPath(const wxString& strPath); - void SetRecordDefaults(bool bDoIt = TRUE); - - bool Write(const wxString& key, const wxString& value); - %name(WriteInt)bool Write(const wxString& key, long value); - %name(WriteFloat)bool Write(const wxString& key, double value); - -}; - - -//--------------------------------------------------------------------------- - -%init %{ - - wxClassInfo::CleanUpClasses(); - wxClassInfo::InitializeClasses(); - -%} - -//--------------------------------------------------------------------------- diff --git a/utils/wxPython/modules/utils/utilsc.def b/utils/wxPython/modules/utils/utilsc.def deleted file mode 100644 index ddb56a1c38..0000000000 --- a/utils/wxPython/modules/utils/utilsc.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORTS - initutilsc diff --git a/utils/wxPython/src/__version__.py b/utils/wxPython/src/__version__.py deleted file mode 100644 index 6006150309..0000000000 --- a/utils/wxPython/src/__version__.py +++ /dev/null @@ -1 +0,0 @@ -ver = '2.1.14' diff --git a/utils/wxPython/src/build.cfg b/utils/wxPython/src/build.cfg deleted file mode 100644 index 27710ddeb3..0000000000 --- a/utils/wxPython/src/build.cfg +++ /dev/null @@ -1,123 +0,0 @@ -# -*- python -*- -import sys - -MODULE = 'wxc' -SWIGFILES = ['wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i', - 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i', - 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', - 'image.i', 'printfw.i', 'sizers.i', 'clip_dnd.i' - ] - -PYFILES = ['__init__.py', '__version__.py'] - -SWIGDEPS = '_defs.i my_typemaps.i' -OTHERDEPS = 'helpers.h' - -if sys.platform == 'win32': - RESFILE = 1 - SOURCES = ['helpers.cpp', 'libpy.c'] - LIBS = '$(PYTHONLIB)' - OTHERRULES = """ -dist: - cd ..\.. - wxPython\distrib\zipit.bat $(VERSION) - -dbg: - cd ..\distrib - makedbg.bat $(VERSION) - -dev: - cd ..\distrib - makedev.bat $(VERSION) - -__version__.py: ../distrib/build.py build.cfg - echo ver = '$(VERSION)' > __version__.py - -""" - -else: - DEFAULTRULE = 'default: $(GENCODEDIR) lib$(HELPERLIB)$(SO) $(TARGET)' - OTHERINSTALLTARGETS = 'installLibDemo installHelpers ' - OTHERUNINSTALLTARGETS = 'uninstallLibDemo uninstallHelpers ' - - - OTHERRULES = """ -lib$(HELPERLIB)$(SO) : helpers.o libpy.o - $(LDSHARED) helpers.o libpy.o $(LFLAGS) -o $@ - - -installHelpers: $(HELPERLIBDIR)/lib$(HELPERLIB)$(SO) - - -$(HELPERLIBDIR)/lib$(HELPERLIB)$(SO) : lib$(HELPERLIB)$(SO) - cp $< $@ - @echo --------------------------------------------------------- - @echo You may have to run ldconfig, or set an environment - @echo variable in order for $(HELPERLIBDIR)/lib$(HELPERLIB)$(SO) - @echo to be found at runtime. See your man pages for ld.so or - @echo equivalent. - @echo --------------------------------------------------------- - - -installLibDemo: - @if [ "$(TARGETDIR)" != ".." -a "$(TARGETDIR)" != "$(WXWIN)/utils/wxPython" ]; then \\ - mkdir $(TARGETDIR)/lib; \\ - mkdir $(TARGETDIR)/lib/sizers; \\ - mkdir $(TARGETDIR)/lib/editor; \\ - mkdir $(TARGETDIR)/demo; \\ - mkdir $(TARGETDIR)/demo/bitmaps; \\ - mkdir $(TARGETDIR)/demo/data; \\ - cp ../lib/*.py $(TARGETDIR)/lib; \\ - cp ../lib/sizers/*.py $(TARGETDIR)/lib/sizers; \\ - cp ../lib/editor/*.py $(TARGETDIR)/lib/editor; \\ - cp ../demo/*.py $(TARGETDIR)/demo; \\ - cp ../lib/*.txt $(TARGETDIR)/lib; \\ - cp ../lib/sizers/*.txt $(TARGETDIR)/lib/sizers; \\ - cp ../lib/editor/*.txt $(TARGETDIR)/lib/editor; \\ - cp ../demo/*.txt $(TARGETDIR)/demo; \\ - cp ../demo/bitmaps/* $(TARGETDIR)/demo/bitmaps; \\ - cp ../demo/data/* $(TARGETDIR)/demo/data; \\ - $(EXECPREFIX)/bin/python $(PYLIB)/compileall.py $(TARGETDIR); \\ - $(EXECPREFIX)/bin/python -O $(PYLIB)/compileall.py $(TARGETDIR); \\ - fi - - - -uninstallLibDemo: - @if [ "$(TARGETDIR)" != ".." -a "$(TARGETDIR)" != "$(WXWIN)/utils/wxPython" ]; then \\ - rm -rf $(TARGETDIR)/lib; \\ - rm -rf $(TARGETDIR)/demo; \\ - fi - - -uninstallHelpers: - rm -f $(HELPERLIBDIR)/lib$(HELPERLIB)$(SO) - - -__version__.py: ../distrib/build.py build.cfg - echo ver = \\'$(VERSION)\\' > __version__.py - - -#---------------------------------------------------------------------- - -dist: tgz rpm - -tgz: - cd ../..; wxPython/distrib/maketgz $(VERSION) - -rpm: - cd ../distrib; ./makerpm $(VERSION) - - - -""" - - - - - -OTHERRULES = OTHERRULES + """ - -$(GENCODEDIR)/wx.py : _extras.py - -""" diff --git a/utils/wxPython/src/gtk/dummy b/utils/wxPython/src/gtk/dummy deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/utils/wxPython/src/gtk/windows2.cpp b/utils/wxPython/src/gtk/windows2.cpp deleted file mode 100644 index 60f52feb47..0000000000 --- a/utils/wxPython/src/gtk/windows2.cpp +++ /dev/null @@ -1,5544 +0,0 @@ -/* - * FILE : gtk/windows2.cpp - * - * This file was automatically generated by : - * Simplified Wrapper and Interface Generator (SWIG) - * Version 1.1 (Build 810) - * - * Portions Copyright (c) 1995-1998 - * The University of Utah and The Regents of the University of California. - * Permission is granted to distribute this file in any manner provided - * this notice remains intact. - * - * Do not make changes to this file--changes will be lost! - * - */ - - -#define SWIGCODE -/* Implementation : PYTHON */ - -#define SWIGPYTHON -#include <string.h> -#include <stdlib.h> -/* Definitions for Windows/Unix exporting */ -#if defined(__WIN32__) -# if defined(_MSC_VER) -# define SWIGEXPORT(a) __declspec(dllexport) a -# else -# if defined(__BORLANDC__) -# define SWIGEXPORT(a) a _export -# else -# define SWIGEXPORT(a) a -# endif -# endif -#else -# define SWIGEXPORT(a) a -#endif - -#ifdef __cplusplus -extern "C" { -#endif -#include "Python.h" -extern void SWIG_MakePtr(char *, void *, char *); -extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *)); -extern char *SWIG_GetPtr(char *, void **, char *); -extern char *SWIG_GetPtrObj(PyObject *, void **, char *); -extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); -extern PyObject *SWIG_newvarlink(void); -#ifdef __cplusplus -} -#endif -#define SWIG_init initwindows2c - -#define SWIG_name "windows2c" - -#include "helpers.h" -#include <wx/grid.h> -#include <wx/notebook.h> -#include <wx/splitter.h> -#ifdef __WXMSW__ -#include <wx/msw/taskbar.h> -#endif - -static PyObject* l_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyList_Check(target)) { - o2 = target; - target = PyList_New(0); - PyList_Append(target, o2); - Py_XDECREF(o2); - } - PyList_Append(target,o); - Py_XDECREF(o); - } - return target; -} - -static PyObject* t_output_helper(PyObject* target, PyObject* o) { - PyObject* o2; - PyObject* o3; - - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(Py_None); - target = o; - } else { - if (!PyTuple_Check(target)) { - o2 = target; - target = PyTuple_New(1); - PyTuple_SetItem(target, 0, o2); - } - o3 = PyTuple_New(1); - PyTuple_SetItem(o3, 0, o); - - o2 = target; - target = PySequence_Concat(o2, o3); - Py_DECREF(o2); - Py_DECREF(o3); - } - return target; -} - -static char* wxStringErrorMsg = "string type is required for parameter"; -#ifdef __cplusplus -extern "C" { -#endif -#define new_wxGridCell() (new wxGridCell()) -static PyObject *_wrap_new_wxGridCell(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _result; - char *_kwnames[] = { NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxGridCell",_kwnames)) - return NULL; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxGridCell *)new_wxGridCell(); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxGridCell_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define delete_wxGridCell(_swigobj) (delete _swigobj) -static PyObject *_wrap_delete_wxGridCell(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxGridCell",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxGridCell. Expected _wxGridCell_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - delete_wxGridCell(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGridCell_GetTextValue(_swigobj) (_swigobj->GetTextValue()) -static PyObject *_wrap_wxGridCell_GetTextValue(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxGridCell * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridCell_GetTextValue",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_GetTextValue. Expected _wxGridCell_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxString & _result_ref = wxGridCell_GetTextValue(_arg0); - _result = (wxString *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); -} - return _resultobj; -} - -#define wxGridCell_SetTextValue(_swigobj,_swigarg0) (_swigobj->SetTextValue(_swigarg0)) -static PyObject *_wrap_wxGridCell_SetTextValue(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _arg0; - wxString * _arg1; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","str", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGridCell_SetTextValue",_kwnames,&_argo0,&_obj1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_SetTextValue. Expected _wxGridCell_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGridCell_SetTextValue(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxGridCell_GetFont(_swigobj) (_swigobj->GetFont()) -static PyObject *_wrap_wxGridCell_GetFont(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxFont * _result; - wxGridCell * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridCell_GetFont",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_GetFont. Expected _wxGridCell_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxFont & _result_ref = wxGridCell_GetFont(_arg0); - _result = (wxFont *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxFont_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGridCell_SetFont(_swigobj,_swigarg0) (_swigobj->SetFont(_swigarg0)) -static PyObject *_wrap_wxGridCell_SetFont(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _arg0; - wxFont * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","f", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGridCell_SetFont",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_SetFont. Expected _wxGridCell_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxFont_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGridCell_SetFont. Expected _wxFont_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGridCell_SetFont(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGridCell_GetTextColour(_swigobj) (_swigobj->GetTextColour()) -static PyObject *_wrap_wxGridCell_GetTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxColour * _result; - wxGridCell * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridCell_GetTextColour",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_GetTextColour. Expected _wxGridCell_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxColour & _result_ref = wxGridCell_GetTextColour(_arg0); - _result = (wxColour *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGridCell_SetTextColour(_swigobj,_swigarg0) (_swigobj->SetTextColour(_swigarg0)) -static PyObject *_wrap_wxGridCell_SetTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _arg0; - wxColour * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","colour", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGridCell_SetTextColour",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_SetTextColour. Expected _wxGridCell_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGridCell_SetTextColour. Expected _wxColour_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGridCell_SetTextColour(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGridCell_GetBackgroundColour(_swigobj) (_swigobj->GetBackgroundColour()) -static PyObject *_wrap_wxGridCell_GetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxColour * _result; - wxGridCell * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridCell_GetBackgroundColour",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_GetBackgroundColour. Expected _wxGridCell_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxColour & _result_ref = wxGridCell_GetBackgroundColour(_arg0); - _result = (wxColour *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGridCell_SetBackgroundColour(_swigobj,_swigarg0) (_swigobj->SetBackgroundColour(_swigarg0)) -static PyObject *_wrap_wxGridCell_SetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _arg0; - wxColour * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","colour", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGridCell_SetBackgroundColour",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_SetBackgroundColour. Expected _wxGridCell_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGridCell_SetBackgroundColour. Expected _wxColour_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGridCell_SetBackgroundColour(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGridCell_GetBackgroundBrush(_swigobj) (_swigobj->GetBackgroundBrush()) -static PyObject *_wrap_wxGridCell_GetBackgroundBrush(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxBrush * _result; - wxGridCell * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridCell_GetBackgroundBrush",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_GetBackgroundBrush. Expected _wxGridCell_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxBrush & _result_ref = wxGridCell_GetBackgroundBrush(_arg0); - _result = (wxBrush *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxBrush_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGridCell_GetAlignment(_swigobj) (_swigobj->GetAlignment()) -static PyObject *_wrap_wxGridCell_GetAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridCell * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridCell_GetAlignment",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_GetAlignment. Expected _wxGridCell_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridCell_GetAlignment(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridCell_SetAlignment(_swigobj,_swigarg0) (_swigobj->SetAlignment(_swigarg0)) -static PyObject *_wrap_wxGridCell_SetAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","align", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGridCell_SetAlignment",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_SetAlignment. Expected _wxGridCell_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGridCell_SetAlignment(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGridCell_GetCellBitmap(_swigobj) (_swigobj->GetCellBitmap()) -static PyObject *_wrap_wxGridCell_GetCellBitmap(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxBitmap * _result; - wxGridCell * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridCell_GetCellBitmap",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_GetCellBitmap. Expected _wxGridCell_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxBitmap *)wxGridCell_GetCellBitmap(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxBitmap_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGridCell_SetCellBitmap(_swigobj,_swigarg0) (_swigobj->SetCellBitmap(_swigarg0)) -static PyObject *_wrap_wxGridCell_SetCellBitmap(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _arg0; - wxBitmap * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","bitmap", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGridCell_SetCellBitmap",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridCell_SetCellBitmap. Expected _wxGridCell_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxBitmap_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGridCell_SetCellBitmap. Expected _wxBitmap_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGridCell_SetCellBitmap(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -static void *SwigwxGridTowxPanel(void *ptr) { - wxGrid *src; - wxPanel *dest; - src = (wxGrid *) ptr; - dest = (wxPanel *) src; - return (void *) dest; -} - -static void *SwigwxGridTowxWindow(void *ptr) { - wxGrid *src; - wxWindow *dest; - src = (wxGrid *) ptr; - dest = (wxWindow *) src; - return (void *) dest; -} - -static void *SwigwxGridTowxEvtHandler(void *ptr) { - wxGrid *src; - wxEvtHandler *dest; - src = (wxGrid *) ptr; - dest = (wxEvtHandler *) src; - return (void *) dest; -} - -#define new_wxGrid(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (new wxGrid(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) -static PyObject *_wrap_new_wxGrid(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _result; - wxWindow * _arg0; - wxWindowID _arg1; - wxPoint * _arg2 = (wxPoint *) &wxPyDefaultPosition; - wxSize * _arg3 = (wxSize *) &wxPyDefaultSize; - long _arg4 = (long ) 0; - char * _arg5 = (char *) "grid"; - PyObject * _argo0 = 0; - wxPoint temp; - PyObject * _obj2 = 0; - wxSize temp0; - PyObject * _obj3 = 0; - char *_kwnames[] = { "parent","id","pos","size","style","name", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|OOls:new_wxGrid",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_arg4,&_arg5)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxGrid. Expected _wxWindow_p."); - return NULL; - } - } - if (_obj2) -{ - _arg2 = &temp; - if (! wxPoint_helper(_obj2, &_arg2)) - return NULL; -} - if (_obj3) -{ - _arg3 = &temp0; - if (! wxSize_helper(_obj3, &_arg3)) - return NULL; -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxGrid *)new_wxGrid(_arg0,_arg1,*_arg2,*_arg3,_arg4,_arg5); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxGrid_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_AdjustScrollbars(_swigobj) (_swigobj->AdjustScrollbars()) -static PyObject *_wrap_wxGrid_AdjustScrollbars(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_AdjustScrollbars",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_AdjustScrollbars. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_AdjustScrollbars(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_AppendCols(_swigobj,_swigarg0,_swigarg1) (_swigobj->AppendCols(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_AppendCols(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - int _arg1 = (int ) 1; - int _arg2 = (int ) TRUE; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","n","updateLabels", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|ii:wxGrid_AppendCols",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_AppendCols. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_AppendCols(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_AppendRows(_swigobj,_swigarg0,_swigarg1) (_swigobj->AppendRows(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_AppendRows(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - int _arg1 = (int ) 1; - int _arg2 = (int ) TRUE; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","n","updateLabels", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|ii:wxGrid_AppendRows",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_AppendRows. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_AppendRows(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_BeginBatch(_swigobj) (_swigobj->BeginBatch()) -static PyObject *_wrap_wxGrid_BeginBatch(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_BeginBatch",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_BeginBatch. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_BeginBatch(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_CellHitTest(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->CellHitTest(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) -static PyObject *_wrap_wxGrid_CellHitTest(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - int _arg1; - int _arg2; - int * _arg3; - int temp; - int * _arg4; - int temp0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","x","y", NULL }; - - self = self; -{ - _arg3 = &temp; -} -{ - _arg4 = &temp0; -} - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_CellHitTest",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_CellHitTest. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_CellHitTest(_arg0,_arg1,_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - PyObject *o; - o = PyInt_FromLong((long) (*_arg3)); - _resultobj = t_output_helper(_resultobj, o); -} -{ - PyObject *o; - o = PyInt_FromLong((long) (*_arg4)); - _resultobj = t_output_helper(_resultobj, o); -} - return _resultobj; -} - -static bool wxGrid_CreateGrid(wxGrid *self,int rows,int cols,short defaultWidth,short defaultHeight) { - return self->CreateGrid(rows, cols, NULL, NULL, - defaultWidth, defaultHeight); - } -static PyObject *_wrap_wxGrid_CreateGrid(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - int _arg1; - int _arg2; - short _arg3 = (short ) wxGRID_DEFAULT_CELL_WIDTH; - short _arg4 = (short ) wxGRID_DEFAULT_CELL_HEIGHT; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","rows","cols","defaultWidth","defaultHeight", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii|hh:wxGrid_CreateGrid",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3,&_arg4)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_CreateGrid. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_CreateGrid(_arg0,_arg1,_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_CurrentCellVisible(_swigobj) (_swigobj->CurrentCellVisible()) -static PyObject *_wrap_wxGrid_CurrentCellVisible(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_CurrentCellVisible",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_CurrentCellVisible. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_CurrentCellVisible(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_DeleteCols(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->DeleteCols(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxGrid_DeleteCols(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - int _arg1 = (int ) 0; - int _arg2 = (int ) 1; - bool _arg3 = (bool ) TRUE; - PyObject * _argo0 = 0; - int tempbool3 = (int) TRUE; - char *_kwnames[] = { "self","pos","n","updateLabels", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iii:wxGrid_DeleteCols",_kwnames,&_argo0,&_arg1,&_arg2,&tempbool3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_DeleteCols. Expected _wxGrid_p."); - return NULL; - } - } - _arg3 = (bool ) tempbool3; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_DeleteCols(_arg0,_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_DeleteRows(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->DeleteRows(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxGrid_DeleteRows(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - int _arg1 = (int ) 0; - int _arg2 = (int ) 1; - bool _arg3 = (bool ) TRUE; - PyObject * _argo0 = 0; - int tempbool3 = (int) TRUE; - char *_kwnames[] = { "self","pos","n","updateLabels", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iii:wxGrid_DeleteRows",_kwnames,&_argo0,&_arg1,&_arg2,&tempbool3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_DeleteRows. Expected _wxGrid_p."); - return NULL; - } - } - _arg3 = (bool ) tempbool3; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_DeleteRows(_arg0,_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_EndBatch(_swigobj) (_swigobj->EndBatch()) -static PyObject *_wrap_wxGrid_EndBatch(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_EndBatch",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_EndBatch. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_EndBatch(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_GetBatchCount(_swigobj) (_swigobj->GetBatchCount()) -static PyObject *_wrap_wxGrid_GetBatchCount(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetBatchCount",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetBatchCount. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetBatchCount(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetCell(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetCell(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_GetCell(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _result; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_GetCell",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCell. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxGridCell *)wxGrid_GetCell(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxGridCell_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetCellAlignment(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetCellAlignment(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_GetCellAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_GetCellAlignment",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCellAlignment. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetCellAlignment(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetDefCellAlignment(_swigobj) (_swigobj->GetCellAlignment()) -static PyObject *_wrap_wxGrid_GetDefCellAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetDefCellAlignment",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetDefCellAlignment. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetDefCellAlignment(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetCellBackgroundColour(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetCellBackgroundColour(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_GetCellBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxColour * _result; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_GetCellBackgroundColour",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCellBackgroundColour. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxColour & _result_ref = wxGrid_GetCellBackgroundColour(_arg0,_arg1,_arg2); - _result = (wxColour *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetDefCellBackgroundColour(_swigobj) (_swigobj->GetCellBackgroundColour()) -static PyObject *_wrap_wxGrid_GetDefCellBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxColour * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetDefCellBackgroundColour",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetDefCellBackgroundColour. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxColour & _result_ref = wxGrid_GetDefCellBackgroundColour(_arg0); - _result = (wxColour *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -static PyObject * wxGrid_GetCells(wxGrid *self) { - int row, col; - PyObject* rows = PyList_New(0); - for (row=0; row < self->GetRows(); row++) { - PyObject* rowList = PyList_New(0); - for (col=0; col < self->GetCols(); col++) { - wxGridCell* cell = self->GetCell(row, col); - - bool doSave = wxPyRestoreThread(); - PyObject* pyCell = wxPyConstructObject(cell, "wxGridCell"); - wxPySaveThread(doSave); - - if (PyList_Append(rowList, pyCell) == -1) - return NULL; - } - if (PyList_Append(rows, rowList) == -1) - return NULL; - } - return rows; - } -static PyObject *_wrap_wxGrid_GetCells(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - PyObject * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetCells",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCells. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (PyObject *)wxGrid_GetCells(_arg0); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = _result; -} - return _resultobj; -} - -#define wxGrid_GetCellTextColour(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetCellTextColour(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_GetCellTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxColour * _result; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_GetCellTextColour",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCellTextColour. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxColour & _result_ref = wxGrid_GetCellTextColour(_arg0,_arg1,_arg2); - _result = (wxColour *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetDefCellTextColour(_swigobj) (_swigobj->GetCellTextColour()) -static PyObject *_wrap_wxGrid_GetDefCellTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxColour * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetDefCellTextColour",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetDefCellTextColour. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxColour & _result_ref = wxGrid_GetDefCellTextColour(_arg0); - _result = (wxColour *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetCellTextFont(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetCellTextFont(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_GetCellTextFont(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxFont * _result; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_GetCellTextFont",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCellTextFont. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxFont & _result_ref = wxGrid_GetCellTextFont(_arg0,_arg1,_arg2); - _result = (wxFont *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxFont_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetDefCellTextFont(_swigobj) (_swigobj->GetCellTextFont()) -static PyObject *_wrap_wxGrid_GetDefCellTextFont(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxFont * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetDefCellTextFont",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetDefCellTextFont. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxFont & _result_ref = wxGrid_GetDefCellTextFont(_arg0); - _result = (wxFont *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxFont_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetCellValue(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetCellValue(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_GetCellValue(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_GetCellValue",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCellValue. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxString & _result_ref = wxGrid_GetCellValue(_arg0,_arg1,_arg2); - _result = (wxString *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); -} - return _resultobj; -} - -#define wxGrid_GetCols(_swigobj) (_swigobj->GetCols()) -static PyObject *_wrap_wxGrid_GetCols(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetCols",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCols. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetCols(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetColumnWidth(_swigobj,_swigarg0) (_swigobj->GetColumnWidth(_swigarg0)) -static PyObject *_wrap_wxGrid_GetColumnWidth(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGrid_GetColumnWidth",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetColumnWidth. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetColumnWidth(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetCurrentRect(_swigobj) (_swigobj->GetCurrentRect()) -static PyObject *_wrap_wxGrid_GetCurrentRect(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxRect * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetCurrentRect",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCurrentRect. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxRect (wxGrid_GetCurrentRect(_arg0)); - - wxPy_END_ALLOW_THREADS; -} SWIG_MakePtr(_ptemp, (void *) _result,"_wxRect_p"); - _resultobj = Py_BuildValue("s",_ptemp); - return _resultobj; -} - -#define wxGrid_GetCursorColumn(_swigobj) (_swigobj->GetCursorColumn()) -static PyObject *_wrap_wxGrid_GetCursorColumn(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetCursorColumn",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCursorColumn. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetCursorColumn(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetCursorRow(_swigobj) (_swigobj->GetCursorRow()) -static PyObject *_wrap_wxGrid_GetCursorRow(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetCursorRow",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetCursorRow. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetCursorRow(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetEditable(_swigobj) (_swigobj->GetEditable()) -static PyObject *_wrap_wxGrid_GetEditable(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetEditable",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetEditable. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_GetEditable(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetHorizScrollBar(_swigobj) (_swigobj->GetHorizScrollBar()) -static PyObject *_wrap_wxGrid_GetHorizScrollBar(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxScrollBar * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetHorizScrollBar",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetHorizScrollBar. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxScrollBar *)wxGrid_GetHorizScrollBar(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxScrollBar_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetLabelAlignment(_swigobj,_swigarg0) (_swigobj->GetLabelAlignment(_swigarg0)) -static PyObject *_wrap_wxGrid_GetLabelAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","orientation", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGrid_GetLabelAlignment",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetLabelAlignment. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetLabelAlignment(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetLabelBackgroundColour(_swigobj) (_swigobj->GetLabelBackgroundColour()) -static PyObject *_wrap_wxGrid_GetLabelBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxColour * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetLabelBackgroundColour",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetLabelBackgroundColour. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxColour & _result_ref = wxGrid_GetLabelBackgroundColour(_arg0); - _result = (wxColour *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetLabelSize(_swigobj,_swigarg0) (_swigobj->GetLabelSize(_swigarg0)) -static PyObject *_wrap_wxGrid_GetLabelSize(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","orientation", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGrid_GetLabelSize",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetLabelSize. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetLabelSize(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetLabelTextColour(_swigobj) (_swigobj->GetLabelTextColour()) -static PyObject *_wrap_wxGrid_GetLabelTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxColour * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetLabelTextColour",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetLabelTextColour. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxColour & _result_ref = wxGrid_GetLabelTextColour(_arg0); - _result = (wxColour *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetLabelTextFont(_swigobj) (_swigobj->GetLabelTextFont()) -static PyObject *_wrap_wxGrid_GetLabelTextFont(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxFont * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetLabelTextFont",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetLabelTextFont. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxFont & _result_ref = wxGrid_GetLabelTextFont(_arg0); - _result = (wxFont *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxFont_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetLabelValue(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetLabelValue(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_GetLabelValue(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","orientation","pos", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_GetLabelValue",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetLabelValue. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxString & _result_ref = wxGrid_GetLabelValue(_arg0,_arg1,_arg2); - _result = (wxString *) &_result_ref; - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); -} - return _resultobj; -} - -#define wxGrid_GetRowHeight(_swigobj,_swigarg0) (_swigobj->GetRowHeight(_swigarg0)) -static PyObject *_wrap_wxGrid_GetRowHeight(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGrid_GetRowHeight",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetRowHeight. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetRowHeight(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetRows(_swigobj) (_swigobj->GetRows()) -static PyObject *_wrap_wxGrid_GetRows(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetRows",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetRows. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetRows(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetScrollPosX(_swigobj) (_swigobj->GetScrollPosX()) -static PyObject *_wrap_wxGrid_GetScrollPosX(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetScrollPosX",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetScrollPosX. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetScrollPosX(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetScrollPosY(_swigobj) (_swigobj->GetScrollPosY()) -static PyObject *_wrap_wxGrid_GetScrollPosY(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetScrollPosY",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetScrollPosY. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGrid_GetScrollPosY(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_GetTextItem(_swigobj) (_swigobj->GetTextItem()) -static PyObject *_wrap_wxGrid_GetTextItem(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxTextCtrl * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetTextItem",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetTextItem. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxTextCtrl *)wxGrid_GetTextItem(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxTextCtrl_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_GetVertScrollBar(_swigobj) (_swigobj->GetVertScrollBar()) -static PyObject *_wrap_wxGrid_GetVertScrollBar(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxScrollBar * _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetVertScrollBar",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetVertScrollBar. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxScrollBar *)wxGrid_GetVertScrollBar(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxScrollBar_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGrid_InsertCols(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->InsertCols(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxGrid_InsertCols(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - int _arg1 = (int ) 0; - int _arg2 = (int ) 1; - bool _arg3 = (bool ) TRUE; - PyObject * _argo0 = 0; - int tempbool3 = (int) TRUE; - char *_kwnames[] = { "self","pos","n","updateLabels", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iii:wxGrid_InsertCols",_kwnames,&_argo0,&_arg1,&_arg2,&tempbool3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_InsertCols. Expected _wxGrid_p."); - return NULL; - } - } - _arg3 = (bool ) tempbool3; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_InsertCols(_arg0,_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_InsertRows(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->InsertRows(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxGrid_InsertRows(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - int _arg1 = (int ) 0; - int _arg2 = (int ) 1; - bool _arg3 = (bool ) TRUE; - PyObject * _argo0 = 0; - int tempbool3 = (int) TRUE; - char *_kwnames[] = { "self","pos","n","updateLabels", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iii:wxGrid_InsertRows",_kwnames,&_argo0,&_arg1,&_arg2,&tempbool3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_InsertRows. Expected _wxGrid_p."); - return NULL; - } - } - _arg3 = (bool ) tempbool3; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_InsertRows(_arg0,_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_OnActivate(_swigobj,_swigarg0) (_swigobj->OnActivate(_swigarg0)) -static PyObject *_wrap_wxGrid_OnActivate(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - bool _arg1; - PyObject * _argo0 = 0; - int tempbool1; - char *_kwnames[] = { "self","active", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGrid_OnActivate",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_OnActivate. Expected _wxGrid_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_OnActivate(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetCellAlignment(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetCellAlignment(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxGrid_SetCellAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - int _arg1; - int _arg2; - int _arg3; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","alignment","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oiii:wxGrid_SetCellAlignment",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetCellAlignment. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetCellAlignment(_arg0,_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetDefCellAlignment(_swigobj,_swigarg0) (_swigobj->SetCellAlignment(_swigarg0)) -static PyObject *_wrap_wxGrid_SetDefCellAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","alignment", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGrid_SetDefCellAlignment",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetDefCellAlignment. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetDefCellAlignment(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetCellBackgroundColour(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetCellBackgroundColour(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxGrid_SetCellBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxColour * _arg1; - int _arg2; - int _arg3; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","colour","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOii:wxGrid_SetCellBackgroundColour",_kwnames,&_argo0,&_argo1,&_arg2,&_arg3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetCellBackgroundColour. Expected _wxGrid_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGrid_SetCellBackgroundColour. Expected _wxColour_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetCellBackgroundColour(_arg0,*_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetDefCellBackgroundColour(_swigobj,_swigarg0) (_swigobj->SetCellBackgroundColour(_swigarg0)) -static PyObject *_wrap_wxGrid_SetDefCellBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxColour * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","colour", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGrid_SetDefCellBackgroundColour",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetDefCellBackgroundColour. Expected _wxGrid_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGrid_SetDefCellBackgroundColour. Expected _wxColour_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetDefCellBackgroundColour(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetCellTextColour(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetCellTextColour(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxGrid_SetCellTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxColour * _arg1; - int _arg2; - int _arg3; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","colour","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOii:wxGrid_SetCellTextColour",_kwnames,&_argo0,&_argo1,&_arg2,&_arg3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetCellTextColour. Expected _wxGrid_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGrid_SetCellTextColour. Expected _wxColour_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetCellTextColour(_arg0,*_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetDefCellTextColour(_swigobj,_swigarg0) (_swigobj->SetCellTextColour(_swigarg0)) -static PyObject *_wrap_wxGrid_SetDefCellTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxColour * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","colour", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGrid_SetDefCellTextColour",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetDefCellTextColour. Expected _wxGrid_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGrid_SetDefCellTextColour. Expected _wxColour_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetDefCellTextColour(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetCellTextFont(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetCellTextFont(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxGrid_SetCellTextFont(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxFont * _arg1; - int _arg2; - int _arg3; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","font","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOii:wxGrid_SetCellTextFont",_kwnames,&_argo0,&_argo1,&_arg2,&_arg3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetCellTextFont. Expected _wxGrid_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxFont_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGrid_SetCellTextFont. Expected _wxFont_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetCellTextFont(_arg0,*_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetDefCellTextFont(_swigobj,_swigarg0) (_swigobj->SetCellTextFont(_swigarg0)) -static PyObject *_wrap_wxGrid_SetDefCellTextFont(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxFont * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","font", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGrid_SetDefCellTextFont",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetDefCellTextFont. Expected _wxGrid_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxFont_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGrid_SetDefCellTextFont. Expected _wxFont_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetDefCellTextFont(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetCellValue(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetCellValue(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxGrid_SetCellValue(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxString * _arg1; - int _arg2; - int _arg3; - PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","val","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOii:wxGrid_SetCellValue",_kwnames,&_argo0,&_obj1,&_arg2,&_arg3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetCellValue. Expected _wxGrid_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetCellValue(_arg0,*_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; -{ - if (_obj1) - delete _arg1; -} - return _resultobj; -} - -#define wxGrid_SetColumnWidth(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetColumnWidth(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_SetColumnWidth(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","col","width", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_SetColumnWidth",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetColumnWidth. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetColumnWidth(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetDividerPen(_swigobj,_swigarg0) (_swigobj->SetDividerPen(_swigarg0)) -static PyObject *_wrap_wxGrid_SetDividerPen(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxPen * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","pen", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGrid_SetDividerPen",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetDividerPen. Expected _wxGrid_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxPen_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGrid_SetDividerPen. Expected _wxPen_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetDividerPen(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetEditable(_swigobj,_swigarg0) (_swigobj->SetEditable(_swigarg0)) -static PyObject *_wrap_wxGrid_SetEditable(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - bool _arg1; - PyObject * _argo0 = 0; - int tempbool1; - char *_kwnames[] = { "self","editable", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGrid_SetEditable",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetEditable. Expected _wxGrid_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetEditable(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetGridCursor(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetGridCursor(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_SetGridCursor(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_SetGridCursor",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetGridCursor. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetGridCursor(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetLabelAlignment(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetLabelAlignment(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_SetLabelAlignment(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","orientation","alignment", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_SetLabelAlignment",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetLabelAlignment. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetLabelAlignment(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetLabelBackgroundColour(_swigobj,_swigarg0) (_swigobj->SetLabelBackgroundColour(_swigarg0)) -static PyObject *_wrap_wxGrid_SetLabelBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxColour * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGrid_SetLabelBackgroundColour",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetLabelBackgroundColour. Expected _wxGrid_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGrid_SetLabelBackgroundColour. Expected _wxColour_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetLabelBackgroundColour(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetLabelSize(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetLabelSize(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_SetLabelSize(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","orientation","size", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_SetLabelSize",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetLabelSize. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetLabelSize(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetLabelTextColour(_swigobj,_swigarg0) (_swigobj->SetLabelTextColour(_swigarg0)) -static PyObject *_wrap_wxGrid_SetLabelTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxColour * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","value", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGrid_SetLabelTextColour",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetLabelTextColour. Expected _wxGrid_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGrid_SetLabelTextColour. Expected _wxColour_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetLabelTextColour(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetLabelTextFont(_swigobj,_swigarg0) (_swigobj->SetLabelTextFont(_swigarg0)) -static PyObject *_wrap_wxGrid_SetLabelTextFont(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - wxFont * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","font", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGrid_SetLabelTextFont",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetLabelTextFont. Expected _wxGrid_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxFont_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGrid_SetLabelTextFont. Expected _wxFont_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetLabelTextFont(_arg0,*_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_SetLabelValue(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetLabelValue(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxGrid_SetLabelValue(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - int _arg1; - wxString * _arg2; - int _arg3; - PyObject * _argo0 = 0; - PyObject * _obj2 = 0; - char *_kwnames[] = { "self","orientation","value","pos", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiOi:wxGrid_SetLabelValue",_kwnames,&_argo0,&_arg1,&_obj2,&_arg3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetLabelValue. Expected _wxGrid_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetLabelValue(_arg0,_arg1,*_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; -{ - if (_obj2) - delete _arg2; -} - return _resultobj; -} - -#define wxGrid_SetRowHeight(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetRowHeight(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxGrid_SetRowHeight(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","row","height", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxGrid_SetRowHeight",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetRowHeight. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetRowHeight(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_UpdateDimensions(_swigobj) (_swigobj->UpdateDimensions()) -static PyObject *_wrap_wxGrid_UpdateDimensions(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_UpdateDimensions",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_UpdateDimensions. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_UpdateDimensions(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxGrid_GetEditInPlace(_swigobj) (_swigobj->GetEditInPlace()) -static PyObject *_wrap_wxGrid_GetEditInPlace(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGrid * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGrid_GetEditInPlace",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_GetEditInPlace. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGrid_GetEditInPlace(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGrid_SetEditInPlace(_swigobj,_swigarg0) (_swigobj->SetEditInPlace(_swigarg0)) -static PyObject *_wrap_wxGrid_SetEditInPlace(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGrid * _arg0; - int _arg1 = (int ) TRUE; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","edit", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxGrid_SetEditInPlace",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_SetEditInPlace. Expected _wxGrid_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxGrid_SetEditInPlace(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -static void *SwigwxGridEventTowxEvent(void *ptr) { - wxGridEvent *src; - wxEvent *dest; - src = (wxGridEvent *) ptr; - dest = (wxEvent *) src; - return (void *) dest; -} - -#define wxGridEvent_m_row_set(_swigobj,_swigval) (_swigobj->m_row = _swigval,_swigval) -static PyObject *_wrap_wxGridEvent_m_row_set(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridEvent * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_row", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGridEvent_m_row_set",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_row_set. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridEvent_m_row_set(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_row_get(_swigobj) ((int ) _swigobj->m_row) -static PyObject *_wrap_wxGridEvent_m_row_get(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_m_row_get",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_row_get. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridEvent_m_row_get(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_col_set(_swigobj,_swigval) (_swigobj->m_col = _swigval,_swigval) -static PyObject *_wrap_wxGridEvent_m_col_set(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridEvent * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_col", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGridEvent_m_col_set",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_col_set. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridEvent_m_col_set(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_col_get(_swigobj) ((int ) _swigobj->m_col) -static PyObject *_wrap_wxGridEvent_m_col_get(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_m_col_get",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_col_get. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridEvent_m_col_get(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_x_set(_swigobj,_swigval) (_swigobj->m_x = _swigval,_swigval) -static PyObject *_wrap_wxGridEvent_m_x_set(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridEvent * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_x", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGridEvent_m_x_set",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_x_set. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridEvent_m_x_set(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_x_get(_swigobj) ((int ) _swigobj->m_x) -static PyObject *_wrap_wxGridEvent_m_x_get(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_m_x_get",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_x_get. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridEvent_m_x_get(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_y_set(_swigobj,_swigval) (_swigobj->m_y = _swigval,_swigval) -static PyObject *_wrap_wxGridEvent_m_y_set(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridEvent * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_y", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGridEvent_m_y_set",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_y_set. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridEvent_m_y_set(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_y_get(_swigobj) ((int ) _swigobj->m_y) -static PyObject *_wrap_wxGridEvent_m_y_get(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_m_y_get",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_y_get. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridEvent_m_y_get(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_control_set(_swigobj,_swigval) (_swigobj->m_control = _swigval,_swigval) -static PyObject *_wrap_wxGridEvent_m_control_set(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGridEvent * _arg0; - bool _arg1; - PyObject * _argo0 = 0; - int tempbool1; - char *_kwnames[] = { "self","m_control", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGridEvent_m_control_set",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_control_set. Expected _wxGridEvent_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGridEvent_m_control_set(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_control_get(_swigobj) ((bool ) _swigobj->m_control) -static PyObject *_wrap_wxGridEvent_m_control_get(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_m_control_get",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_control_get. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGridEvent_m_control_get(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_shift_set(_swigobj,_swigval) (_swigobj->m_shift = _swigval,_swigval) -static PyObject *_wrap_wxGridEvent_m_shift_set(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGridEvent * _arg0; - bool _arg1; - PyObject * _argo0 = 0; - int tempbool1; - char *_kwnames[] = { "self","m_shift", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxGridEvent_m_shift_set",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_shift_set. Expected _wxGridEvent_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGridEvent_m_shift_set(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_shift_get(_swigobj) ((bool ) _swigobj->m_shift) -static PyObject *_wrap_wxGridEvent_m_shift_get(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_m_shift_get",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_shift_get. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGridEvent_m_shift_get(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_m_cell_set(_swigobj,_swigval) (_swigobj->m_cell = _swigval,_swigval) -static PyObject *_wrap_wxGridEvent_m_cell_set(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _result; - wxGridEvent * _arg0; - wxGridCell * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","m_cell", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGridEvent_m_cell_set",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_cell_set. Expected _wxGridEvent_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxGridCell_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGridEvent_m_cell_set. Expected _wxGridCell_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxGridCell *)wxGridEvent_m_cell_set(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxGridCell_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGridEvent_m_cell_get(_swigobj) ((wxGridCell *) _swigobj->m_cell) -static PyObject *_wrap_wxGridEvent_m_cell_get(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_m_cell_get",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_m_cell_get. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxGridCell *)wxGridEvent_m_cell_get(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxGridCell_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxGridEvent_GetRow(_swigobj) (_swigobj->GetRow()) -static PyObject *_wrap_wxGridEvent_GetRow(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_GetRow",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_GetRow. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridEvent_GetRow(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_GetCol(_swigobj) (_swigobj->GetCol()) -static PyObject *_wrap_wxGridEvent_GetCol(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_GetCol",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_GetCol. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxGridEvent_GetCol(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_GetPosition(_swigobj) (_swigobj->GetPosition()) -static PyObject *_wrap_wxGridEvent_GetPosition(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxPoint * _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_GetPosition",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_GetPosition. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxPoint (wxGridEvent_GetPosition(_arg0)); - - wxPy_END_ALLOW_THREADS; -} SWIG_MakePtr(_ptemp, (void *) _result,"_wxPoint_p"); - _resultobj = Py_BuildValue("s",_ptemp); - return _resultobj; -} - -#define wxGridEvent_ControlDown(_swigobj) (_swigobj->ControlDown()) -static PyObject *_wrap_wxGridEvent_ControlDown(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_ControlDown",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_ControlDown. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGridEvent_ControlDown(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_ShiftDown(_swigobj) (_swigobj->ShiftDown()) -static PyObject *_wrap_wxGridEvent_ShiftDown(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_ShiftDown",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_ShiftDown. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxGridEvent_ShiftDown(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxGridEvent_GetCell(_swigobj) (_swigobj->GetCell()) -static PyObject *_wrap_wxGridEvent_GetCell(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxGridCell * _result; - wxGridEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxGridEvent_GetCell",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGridEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGridEvent_GetCell. Expected _wxGridEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxGridCell *)wxGridEvent_GetCell(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxGridCell_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -static void *SwigwxNotebookEventTowxNotifyEvent(void *ptr) { - wxNotebookEvent *src; - wxNotifyEvent *dest; - src = (wxNotebookEvent *) ptr; - dest = (wxNotifyEvent *) src; - return (void *) dest; -} - -static void *SwigwxNotebookEventTowxCommandEvent(void *ptr) { - wxNotebookEvent *src; - wxCommandEvent *dest; - src = (wxNotebookEvent *) ptr; - dest = (wxCommandEvent *) src; - return (void *) dest; -} - -static void *SwigwxNotebookEventTowxEvent(void *ptr) { - wxNotebookEvent *src; - wxEvent *dest; - src = (wxNotebookEvent *) ptr; - dest = (wxEvent *) src; - return (void *) dest; -} - -#define wxNotebookEvent_GetSelection(_swigobj) (_swigobj->GetSelection()) -static PyObject *_wrap_wxNotebookEvent_GetSelection(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxNotebookEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxNotebookEvent_GetSelection",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebookEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebookEvent_GetSelection. Expected _wxNotebookEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxNotebookEvent_GetSelection(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebookEvent_GetOldSelection(_swigobj) (_swigobj->GetOldSelection()) -static PyObject *_wrap_wxNotebookEvent_GetOldSelection(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxNotebookEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxNotebookEvent_GetOldSelection",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebookEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebookEvent_GetOldSelection. Expected _wxNotebookEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxNotebookEvent_GetOldSelection(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebookEvent_SetOldSelection(_swigobj,_swigarg0) (_swigobj->SetOldSelection(_swigarg0)) -static PyObject *_wrap_wxNotebookEvent_SetOldSelection(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxNotebookEvent * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","page", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxNotebookEvent_SetOldSelection",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebookEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebookEvent_SetOldSelection. Expected _wxNotebookEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxNotebookEvent_SetOldSelection(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxNotebookEvent_SetSelection(_swigobj,_swigarg0) (_swigobj->SetSelection(_swigarg0)) -static PyObject *_wrap_wxNotebookEvent_SetSelection(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxNotebookEvent * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","page", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxNotebookEvent_SetSelection",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebookEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebookEvent_SetSelection. Expected _wxNotebookEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxNotebookEvent_SetSelection(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -static void *SwigwxNotebookTowxControl(void *ptr) { - wxNotebook *src; - wxControl *dest; - src = (wxNotebook *) ptr; - dest = (wxControl *) src; - return (void *) dest; -} - -static void *SwigwxNotebookTowxWindow(void *ptr) { - wxNotebook *src; - wxWindow *dest; - src = (wxNotebook *) ptr; - dest = (wxWindow *) src; - return (void *) dest; -} - -static void *SwigwxNotebookTowxEvtHandler(void *ptr) { - wxNotebook *src; - wxEvtHandler *dest; - src = (wxNotebook *) ptr; - dest = (wxEvtHandler *) src; - return (void *) dest; -} - -#define new_wxNotebook(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (new wxNotebook(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) -static PyObject *_wrap_new_wxNotebook(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxNotebook * _result; - wxWindow * _arg0; - wxWindowID _arg1; - wxPoint * _arg2 = (wxPoint *) &wxPyDefaultPosition; - wxSize * _arg3 = (wxSize *) &wxPyDefaultSize; - long _arg4 = (long ) 0; - char * _arg5 = (char *) "notebook"; - PyObject * _argo0 = 0; - wxPoint temp; - PyObject * _obj2 = 0; - wxSize temp0; - PyObject * _obj3 = 0; - char *_kwnames[] = { "parent","id","pos","size","style","name", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|OOls:new_wxNotebook",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_arg4,&_arg5)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxNotebook. Expected _wxWindow_p."); - return NULL; - } - } - if (_obj2) -{ - _arg2 = &temp; - if (! wxPoint_helper(_obj2, &_arg2)) - return NULL; -} - if (_obj3) -{ - _arg3 = &temp0; - if (! wxSize_helper(_obj3, &_arg3)) - return NULL; -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxNotebook *)new_wxNotebook(_arg0,_arg1,*_arg2,*_arg3,_arg4,_arg5); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxNotebook_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxNotebook_GetPageCount(_swigobj) (_swigobj->GetPageCount()) -static PyObject *_wrap_wxNotebook_GetPageCount(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxNotebook * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxNotebook_GetPageCount",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_GetPageCount. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxNotebook_GetPageCount(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebook_SetSelection(_swigobj,_swigarg0) (_swigobj->SetSelection(_swigarg0)) -static PyObject *_wrap_wxNotebook_SetSelection(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxNotebook * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","nPage", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxNotebook_SetSelection",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_SetSelection. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxNotebook_SetSelection(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebook_AdvanceSelection(_swigobj,_swigarg0) (_swigobj->AdvanceSelection(_swigarg0)) -static PyObject *_wrap_wxNotebook_AdvanceSelection(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxNotebook * _arg0; - bool _arg1 = (bool ) TRUE; - PyObject * _argo0 = 0; - int tempbool1 = (int) TRUE; - char *_kwnames[] = { "self","bForward", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxNotebook_AdvanceSelection",_kwnames,&_argo0,&tempbool1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_AdvanceSelection. Expected _wxNotebook_p."); - return NULL; - } - } - _arg1 = (bool ) tempbool1; -{ - wxPy_BEGIN_ALLOW_THREADS; - wxNotebook_AdvanceSelection(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxNotebook_GetSelection(_swigobj) (_swigobj->GetSelection()) -static PyObject *_wrap_wxNotebook_GetSelection(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxNotebook * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxNotebook_GetSelection",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_GetSelection. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxNotebook_GetSelection(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebook_SetPageText(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetPageText(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxNotebook_SetPageText(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxNotebook * _arg0; - int _arg1; - wxString * _arg2; - PyObject * _argo0 = 0; - PyObject * _obj2 = 0; - char *_kwnames[] = { "self","nPage","strText", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxNotebook_SetPageText",_kwnames,&_argo0,&_arg1,&_obj2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_SetPageText. Expected _wxNotebook_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxNotebook_SetPageText(_arg0,_arg1,*_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj2) - delete _arg2; -} - return _resultobj; -} - -#define wxNotebook_GetPageText(_swigobj,_swigarg0) (_swigobj->GetPageText(_swigarg0)) -static PyObject *_wrap_wxNotebook_GetPageText(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxString * _result; - wxNotebook * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","nPage", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxNotebook_GetPageText",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_GetPageText. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxString (wxNotebook_GetPageText(_arg0,_arg1)); - - wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); -} -{ - delete _result; -} - return _resultobj; -} - -#define wxNotebook_SetImageList(_swigobj,_swigarg0) (_swigobj->SetImageList(_swigarg0)) -static PyObject *_wrap_wxNotebook_SetImageList(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxNotebook * _arg0; - wxImageList * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","imageList", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxNotebook_SetImageList",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_SetImageList. Expected _wxNotebook_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageList_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxNotebook_SetImageList. Expected _wxImageList_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxNotebook_SetImageList(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxNotebook_GetImageList(_swigobj) (_swigobj->GetImageList()) -static PyObject *_wrap_wxNotebook_GetImageList(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxImageList * _result; - wxNotebook * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxNotebook_GetImageList",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_GetImageList. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxImageList *)wxNotebook_GetImageList(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxImageList_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxNotebook_GetPageImage(_swigobj,_swigarg0) (_swigobj->GetPageImage(_swigarg0)) -static PyObject *_wrap_wxNotebook_GetPageImage(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxNotebook * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","nPage", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxNotebook_GetPageImage",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_GetPageImage. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxNotebook_GetPageImage(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebook_SetPageImage(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetPageImage(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxNotebook_SetPageImage(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxNotebook * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","nPage","nImage", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxNotebook_SetPageImage",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_SetPageImage. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxNotebook_SetPageImage(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebook_GetRowCount(_swigobj) (_swigobj->GetRowCount()) -static PyObject *_wrap_wxNotebook_GetRowCount(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxNotebook * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxNotebook_GetRowCount",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_GetRowCount. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxNotebook_GetRowCount(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebook_DeletePage(_swigobj,_swigarg0) (_swigobj->DeletePage(_swigarg0)) -static PyObject *_wrap_wxNotebook_DeletePage(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxNotebook * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","nPage", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxNotebook_DeletePage",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_DeletePage. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxNotebook_DeletePage(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebook_RemovePage(_swigobj,_swigarg0) (_swigobj->RemovePage(_swigarg0)) -static PyObject *_wrap_wxNotebook_RemovePage(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxNotebook * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","nPage", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxNotebook_RemovePage",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_RemovePage. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxNotebook_RemovePage(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebook_DeleteAllPages(_swigobj) (_swigobj->DeleteAllPages()) -static PyObject *_wrap_wxNotebook_DeleteAllPages(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxNotebook * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxNotebook_DeleteAllPages",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_DeleteAllPages. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxNotebook_DeleteAllPages(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxNotebook_AddPage(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->AddPage(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) -static PyObject *_wrap_wxNotebook_AddPage(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxNotebook * _arg0; - wxWindow * _arg1; - wxString * _arg2; - int _arg3 = (int ) FALSE; - int _arg4 = (int ) -1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _obj2 = 0; - char *_kwnames[] = { "self","pPage","strText","bSelect","imageId", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO|ii:wxNotebook_AddPage",_kwnames,&_argo0,&_argo1,&_obj2,&_arg3,&_arg4)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_AddPage. Expected _wxNotebook_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxNotebook_AddPage. Expected _wxWindow_p."); - return NULL; - } - } -{ - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxNotebook_AddPage(_arg0,_arg1,*_arg2,_arg3,_arg4); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); -{ - if (_obj2) - delete _arg2; -} - return _resultobj; -} - -#define wxNotebook_GetPage(_swigobj,_swigarg0) (_swigobj->GetPage(_swigarg0)) -static PyObject *_wrap_wxNotebook_GetPage(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxWindow * _result; - wxNotebook * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","nPage", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxNotebook_GetPage",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_GetPage. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxWindow *)wxNotebook_GetPage(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxWindow_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -static void wxNotebook_ResizeChildren(wxNotebook *self) { - wxSizeEvent evt(self->GetClientSize()); - self->GetEventHandler()->ProcessEvent(evt); - } -static PyObject *_wrap_wxNotebook_ResizeChildren(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxNotebook * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxNotebook_ResizeChildren",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxNotebook_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxNotebook_ResizeChildren. Expected _wxNotebook_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxNotebook_ResizeChildren(_arg0); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -static void *SwigwxSplitterEventTowxCommandEvent(void *ptr) { - wxSplitterEvent *src; - wxCommandEvent *dest; - src = (wxSplitterEvent *) ptr; - dest = (wxCommandEvent *) src; - return (void *) dest; -} - -static void *SwigwxSplitterEventTowxEvent(void *ptr) { - wxSplitterEvent *src; - wxEvent *dest; - src = (wxSplitterEvent *) ptr; - dest = (wxEvent *) src; - return (void *) dest; -} - -#define wxSplitterEvent_GetSashPosition(_swigobj) (_swigobj->GetSashPosition()) -static PyObject *_wrap_wxSplitterEvent_GetSashPosition(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxSplitterEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterEvent_GetSashPosition",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterEvent_GetSashPosition. Expected _wxSplitterEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxSplitterEvent_GetSashPosition(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterEvent_GetX(_swigobj) (_swigobj->GetX()) -static PyObject *_wrap_wxSplitterEvent_GetX(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxSplitterEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterEvent_GetX",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterEvent_GetX. Expected _wxSplitterEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxSplitterEvent_GetX(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterEvent_GetY(_swigobj) (_swigobj->GetY()) -static PyObject *_wrap_wxSplitterEvent_GetY(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxSplitterEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterEvent_GetY",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterEvent_GetY. Expected _wxSplitterEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxSplitterEvent_GetY(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterEvent_GetWindowBeingRemoved(_swigobj) (_swigobj->GetWindowBeingRemoved()) -static PyObject *_wrap_wxSplitterEvent_GetWindowBeingRemoved(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxWindow * _result; - wxSplitterEvent * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterEvent_GetWindowBeingRemoved",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterEvent_GetWindowBeingRemoved. Expected _wxSplitterEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxWindow *)wxSplitterEvent_GetWindowBeingRemoved(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxWindow_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxSplitterEvent_SetSashPosition(_swigobj,_swigarg0) (_swigobj->SetSashPosition(_swigarg0)) -static PyObject *_wrap_wxSplitterEvent_SetSashPosition(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxSplitterEvent * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","pos", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxSplitterEvent_SetSashPosition",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterEvent_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterEvent_SetSashPosition. Expected _wxSplitterEvent_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxSplitterEvent_SetSashPosition(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -static void *SwigwxSplitterWindowTowxWindow(void *ptr) { - wxSplitterWindow *src; - wxWindow *dest; - src = (wxSplitterWindow *) ptr; - dest = (wxWindow *) src; - return (void *) dest; -} - -static void *SwigwxSplitterWindowTowxEvtHandler(void *ptr) { - wxSplitterWindow *src; - wxEvtHandler *dest; - src = (wxSplitterWindow *) ptr; - dest = (wxEvtHandler *) src; - return (void *) dest; -} - -#define new_wxSplitterWindow(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (new wxSplitterWindow(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) -static PyObject *_wrap_new_wxSplitterWindow(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxSplitterWindow * _result; - wxWindow * _arg0; - wxWindowID _arg1; - wxPoint * _arg2 = (wxPoint *) &wxPyDefaultPosition; - wxSize * _arg3 = (wxSize *) &wxPyDefaultSize; - long _arg4 = (long ) wxSP_3D|wxCLIP_CHILDREN; - char * _arg5 = (char *) "splitterWindow"; - PyObject * _argo0 = 0; - wxPoint temp; - PyObject * _obj2 = 0; - wxSize temp0; - PyObject * _obj3 = 0; - char *_kwnames[] = { "parent","id","point","size","style","name", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|OOls:new_wxSplitterWindow",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_arg4,&_arg5)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxSplitterWindow. Expected _wxWindow_p."); - return NULL; - } - } - if (_obj2) -{ - _arg2 = &temp; - if (! wxPoint_helper(_obj2, &_arg2)) - return NULL; -} - if (_obj3) -{ - _arg3 = &temp0; - if (! wxSize_helper(_obj3, &_arg3)) - return NULL; -} -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxSplitterWindow *)new_wxSplitterWindow(_arg0,_arg1,*_arg2,*_arg3,_arg4,_arg5); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxSplitterWindow_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxSplitterWindow_GetBorderSize(_swigobj) (_swigobj->GetBorderSize()) -static PyObject *_wrap_wxSplitterWindow_GetBorderSize(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxSplitterWindow * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterWindow_GetBorderSize",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_GetBorderSize. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxSplitterWindow_GetBorderSize(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterWindow_GetMinimumPaneSize(_swigobj) (_swigobj->GetMinimumPaneSize()) -static PyObject *_wrap_wxSplitterWindow_GetMinimumPaneSize(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxSplitterWindow * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterWindow_GetMinimumPaneSize",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_GetMinimumPaneSize. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxSplitterWindow_GetMinimumPaneSize(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterWindow_GetSashPosition(_swigobj) (_swigobj->GetSashPosition()) -static PyObject *_wrap_wxSplitterWindow_GetSashPosition(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxSplitterWindow * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterWindow_GetSashPosition",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_GetSashPosition. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxSplitterWindow_GetSashPosition(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterWindow_GetSashSize(_swigobj) (_swigobj->GetSashSize()) -static PyObject *_wrap_wxSplitterWindow_GetSashSize(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxSplitterWindow * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterWindow_GetSashSize",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_GetSashSize. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxSplitterWindow_GetSashSize(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterWindow_GetSplitMode(_swigobj) (_swigobj->GetSplitMode()) -static PyObject *_wrap_wxSplitterWindow_GetSplitMode(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - int _result; - wxSplitterWindow * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterWindow_GetSplitMode",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_GetSplitMode. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxSplitterWindow_GetSplitMode(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterWindow_GetWindow1(_swigobj) (_swigobj->GetWindow1()) -static PyObject *_wrap_wxSplitterWindow_GetWindow1(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxWindow * _result; - wxSplitterWindow * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterWindow_GetWindow1",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_GetWindow1. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxWindow *)wxSplitterWindow_GetWindow1(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxWindow_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxSplitterWindow_GetWindow2(_swigobj) (_swigobj->GetWindow2()) -static PyObject *_wrap_wxSplitterWindow_GetWindow2(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxWindow * _result; - wxSplitterWindow * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - char _ptemp[128]; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterWindow_GetWindow2",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_GetWindow2. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxWindow *)wxSplitterWindow_GetWindow2(_arg0); - - wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxWindow_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } - return _resultobj; -} - -#define wxSplitterWindow_Initialize(_swigobj,_swigarg0) (_swigobj->Initialize(_swigarg0)) -static PyObject *_wrap_wxSplitterWindow_Initialize(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxSplitterWindow * _arg0; - wxWindow * _arg1; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","window", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxSplitterWindow_Initialize",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_Initialize. Expected _wxSplitterWindow_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxSplitterWindow_Initialize. Expected _wxWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxSplitterWindow_Initialize(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxSplitterWindow_IsSplit(_swigobj) (_swigobj->IsSplit()) -static PyObject *_wrap_wxSplitterWindow_IsSplit(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxSplitterWindow * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSplitterWindow_IsSplit",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_IsSplit. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxSplitterWindow_IsSplit(_arg0); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterWindow_ReplaceWindow(_swigobj,_swigarg0,_swigarg1) (_swigobj->ReplaceWindow(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxSplitterWindow_ReplaceWindow(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxSplitterWindow * _arg0; - wxWindow * _arg1; - wxWindow * _arg2; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - char *_kwnames[] = { "self","winOld","winNew", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxSplitterWindow_ReplaceWindow",_kwnames,&_argo0,&_argo1,&_argo2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_ReplaceWindow. Expected _wxSplitterWindow_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxSplitterWindow_ReplaceWindow. Expected _wxWindow_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxSplitterWindow_ReplaceWindow. Expected _wxWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxSplitterWindow_ReplaceWindow(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterWindow_SetBorderSize(_swigobj,_swigarg0) (_swigobj->SetBorderSize(_swigarg0)) -static PyObject *_wrap_wxSplitterWindow_SetBorderSize(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxSplitterWindow * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","width", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxSplitterWindow_SetBorderSize",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_SetBorderSize. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxSplitterWindow_SetBorderSize(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxSplitterWindow_SetSashPosition(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetSashPosition(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxSplitterWindow_SetSashPosition(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxSplitterWindow * _arg0; - int _arg1; - int _arg2 = (int ) TRUE; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","position","redraw", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxSplitterWindow_SetSashPosition",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_SetSashPosition. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxSplitterWindow_SetSashPosition(_arg0,_arg1,_arg2); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxSplitterWindow_SetSashSize(_swigobj,_swigarg0) (_swigobj->SetSashSize(_swigarg0)) -static PyObject *_wrap_wxSplitterWindow_SetSashSize(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxSplitterWindow * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","width", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxSplitterWindow_SetSashSize",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_SetSashSize. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxSplitterWindow_SetSashSize(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxSplitterWindow_SetMinimumPaneSize(_swigobj,_swigarg0) (_swigobj->SetMinimumPaneSize(_swigarg0)) -static PyObject *_wrap_wxSplitterWindow_SetMinimumPaneSize(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxSplitterWindow * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","paneSize", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxSplitterWindow_SetMinimumPaneSize",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_SetMinimumPaneSize. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxSplitterWindow_SetMinimumPaneSize(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxSplitterWindow_SetSplitMode(_swigobj,_swigarg0) (_swigobj->SetSplitMode(_swigarg0)) -static PyObject *_wrap_wxSplitterWindow_SetSplitMode(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxSplitterWindow * _arg0; - int _arg1; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","mode", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxSplitterWindow_SetSplitMode",_kwnames,&_argo0,&_arg1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_SetSplitMode. Expected _wxSplitterWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - wxSplitterWindow_SetSplitMode(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - -#define wxSplitterWindow_SplitHorizontally(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SplitHorizontally(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxSplitterWindow_SplitHorizontally(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxSplitterWindow * _arg0; - wxWindow * _arg1; - wxWindow * _arg2; - int _arg3 = (int ) 0; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - char *_kwnames[] = { "self","window1","window2","sashPosition", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO|i:wxSplitterWindow_SplitHorizontally",_kwnames,&_argo0,&_argo1,&_argo2,&_arg3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_SplitHorizontally. Expected _wxSplitterWindow_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxSplitterWindow_SplitHorizontally. Expected _wxWindow_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxSplitterWindow_SplitHorizontally. Expected _wxWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxSplitterWindow_SplitHorizontally(_arg0,_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterWindow_SplitVertically(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SplitVertically(_swigarg0,_swigarg1,_swigarg2)) -static PyObject *_wrap_wxSplitterWindow_SplitVertically(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxSplitterWindow * _arg0; - wxWindow * _arg1; - wxWindow * _arg2; - int _arg3 = (int ) 0; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - char *_kwnames[] = { "self","window1","window2","sashPosition", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO|i:wxSplitterWindow_SplitVertically",_kwnames,&_argo0,&_argo1,&_argo2,&_arg3)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_SplitVertically. Expected _wxSplitterWindow_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxSplitterWindow_SplitVertically. Expected _wxWindow_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxSplitterWindow_SplitVertically. Expected _wxWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxSplitterWindow_SplitVertically(_arg0,_arg1,_arg2,_arg3); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -#define wxSplitterWindow_Unsplit(_swigobj,_swigarg0) (_swigobj->Unsplit(_swigarg0)) -static PyObject *_wrap_wxSplitterWindow_Unsplit(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - bool _result; - wxSplitterWindow * _arg0; - wxWindow * _arg1 = (wxWindow *) NULL; - PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - char *_kwnames[] = { "self","toRemove", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|O:wxSplitterWindow_Unsplit",_kwnames,&_argo0,&_argo1)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSplitterWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSplitterWindow_Unsplit. Expected _wxSplitterWindow_p."); - return NULL; - } - } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxSplitterWindow_Unsplit. Expected _wxWindow_p."); - return NULL; - } - } -{ - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxSplitterWindow_Unsplit(_arg0,_arg1); - - wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); - return _resultobj; -} - -static PyMethodDef windows2cMethods[] = { - { "wxSplitterWindow_Unsplit", (PyCFunction) _wrap_wxSplitterWindow_Unsplit, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_SplitVertically", (PyCFunction) _wrap_wxSplitterWindow_SplitVertically, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_SplitHorizontally", (PyCFunction) _wrap_wxSplitterWindow_SplitHorizontally, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_SetSplitMode", (PyCFunction) _wrap_wxSplitterWindow_SetSplitMode, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_SetMinimumPaneSize", (PyCFunction) _wrap_wxSplitterWindow_SetMinimumPaneSize, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_SetSashSize", (PyCFunction) _wrap_wxSplitterWindow_SetSashSize, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_SetSashPosition", (PyCFunction) _wrap_wxSplitterWindow_SetSashPosition, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_SetBorderSize", (PyCFunction) _wrap_wxSplitterWindow_SetBorderSize, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_ReplaceWindow", (PyCFunction) _wrap_wxSplitterWindow_ReplaceWindow, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_IsSplit", (PyCFunction) _wrap_wxSplitterWindow_IsSplit, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_Initialize", (PyCFunction) _wrap_wxSplitterWindow_Initialize, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_GetWindow2", (PyCFunction) _wrap_wxSplitterWindow_GetWindow2, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_GetWindow1", (PyCFunction) _wrap_wxSplitterWindow_GetWindow1, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_GetSplitMode", (PyCFunction) _wrap_wxSplitterWindow_GetSplitMode, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_GetSashSize", (PyCFunction) _wrap_wxSplitterWindow_GetSashSize, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_GetSashPosition", (PyCFunction) _wrap_wxSplitterWindow_GetSashPosition, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_GetMinimumPaneSize", (PyCFunction) _wrap_wxSplitterWindow_GetMinimumPaneSize, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterWindow_GetBorderSize", (PyCFunction) _wrap_wxSplitterWindow_GetBorderSize, METH_VARARGS | METH_KEYWORDS }, - { "new_wxSplitterWindow", (PyCFunction) _wrap_new_wxSplitterWindow, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterEvent_SetSashPosition", (PyCFunction) _wrap_wxSplitterEvent_SetSashPosition, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterEvent_GetWindowBeingRemoved", (PyCFunction) _wrap_wxSplitterEvent_GetWindowBeingRemoved, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterEvent_GetY", (PyCFunction) _wrap_wxSplitterEvent_GetY, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterEvent_GetX", (PyCFunction) _wrap_wxSplitterEvent_GetX, METH_VARARGS | METH_KEYWORDS }, - { "wxSplitterEvent_GetSashPosition", (PyCFunction) _wrap_wxSplitterEvent_GetSashPosition, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_ResizeChildren", (PyCFunction) _wrap_wxNotebook_ResizeChildren, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_GetPage", (PyCFunction) _wrap_wxNotebook_GetPage, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_AddPage", (PyCFunction) _wrap_wxNotebook_AddPage, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_DeleteAllPages", (PyCFunction) _wrap_wxNotebook_DeleteAllPages, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_RemovePage", (PyCFunction) _wrap_wxNotebook_RemovePage, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_DeletePage", (PyCFunction) _wrap_wxNotebook_DeletePage, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_GetRowCount", (PyCFunction) _wrap_wxNotebook_GetRowCount, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_SetPageImage", (PyCFunction) _wrap_wxNotebook_SetPageImage, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_GetPageImage", (PyCFunction) _wrap_wxNotebook_GetPageImage, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_GetImageList", (PyCFunction) _wrap_wxNotebook_GetImageList, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_SetImageList", (PyCFunction) _wrap_wxNotebook_SetImageList, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_GetPageText", (PyCFunction) _wrap_wxNotebook_GetPageText, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_SetPageText", (PyCFunction) _wrap_wxNotebook_SetPageText, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_GetSelection", (PyCFunction) _wrap_wxNotebook_GetSelection, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_AdvanceSelection", (PyCFunction) _wrap_wxNotebook_AdvanceSelection, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_SetSelection", (PyCFunction) _wrap_wxNotebook_SetSelection, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebook_GetPageCount", (PyCFunction) _wrap_wxNotebook_GetPageCount, METH_VARARGS | METH_KEYWORDS }, - { "new_wxNotebook", (PyCFunction) _wrap_new_wxNotebook, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebookEvent_SetSelection", (PyCFunction) _wrap_wxNotebookEvent_SetSelection, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebookEvent_SetOldSelection", (PyCFunction) _wrap_wxNotebookEvent_SetOldSelection, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebookEvent_GetOldSelection", (PyCFunction) _wrap_wxNotebookEvent_GetOldSelection, METH_VARARGS | METH_KEYWORDS }, - { "wxNotebookEvent_GetSelection", (PyCFunction) _wrap_wxNotebookEvent_GetSelection, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_GetCell", (PyCFunction) _wrap_wxGridEvent_GetCell, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_ShiftDown", (PyCFunction) _wrap_wxGridEvent_ShiftDown, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_ControlDown", (PyCFunction) _wrap_wxGridEvent_ControlDown, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_GetPosition", (PyCFunction) _wrap_wxGridEvent_GetPosition, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_GetCol", (PyCFunction) _wrap_wxGridEvent_GetCol, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_GetRow", (PyCFunction) _wrap_wxGridEvent_GetRow, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_cell_get", (PyCFunction) _wrap_wxGridEvent_m_cell_get, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_cell_set", (PyCFunction) _wrap_wxGridEvent_m_cell_set, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_shift_get", (PyCFunction) _wrap_wxGridEvent_m_shift_get, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_shift_set", (PyCFunction) _wrap_wxGridEvent_m_shift_set, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_control_get", (PyCFunction) _wrap_wxGridEvent_m_control_get, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_control_set", (PyCFunction) _wrap_wxGridEvent_m_control_set, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_y_get", (PyCFunction) _wrap_wxGridEvent_m_y_get, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_y_set", (PyCFunction) _wrap_wxGridEvent_m_y_set, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_x_get", (PyCFunction) _wrap_wxGridEvent_m_x_get, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_x_set", (PyCFunction) _wrap_wxGridEvent_m_x_set, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_col_get", (PyCFunction) _wrap_wxGridEvent_m_col_get, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_col_set", (PyCFunction) _wrap_wxGridEvent_m_col_set, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_row_get", (PyCFunction) _wrap_wxGridEvent_m_row_get, METH_VARARGS | METH_KEYWORDS }, - { "wxGridEvent_m_row_set", (PyCFunction) _wrap_wxGridEvent_m_row_set, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetEditInPlace", (PyCFunction) _wrap_wxGrid_SetEditInPlace, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetEditInPlace", (PyCFunction) _wrap_wxGrid_GetEditInPlace, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_UpdateDimensions", (PyCFunction) _wrap_wxGrid_UpdateDimensions, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetRowHeight", (PyCFunction) _wrap_wxGrid_SetRowHeight, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetLabelValue", (PyCFunction) _wrap_wxGrid_SetLabelValue, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetLabelTextFont", (PyCFunction) _wrap_wxGrid_SetLabelTextFont, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetLabelTextColour", (PyCFunction) _wrap_wxGrid_SetLabelTextColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetLabelSize", (PyCFunction) _wrap_wxGrid_SetLabelSize, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetLabelBackgroundColour", (PyCFunction) _wrap_wxGrid_SetLabelBackgroundColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetLabelAlignment", (PyCFunction) _wrap_wxGrid_SetLabelAlignment, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetGridCursor", (PyCFunction) _wrap_wxGrid_SetGridCursor, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetEditable", (PyCFunction) _wrap_wxGrid_SetEditable, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetDividerPen", (PyCFunction) _wrap_wxGrid_SetDividerPen, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetColumnWidth", (PyCFunction) _wrap_wxGrid_SetColumnWidth, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetCellValue", (PyCFunction) _wrap_wxGrid_SetCellValue, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetDefCellTextFont", (PyCFunction) _wrap_wxGrid_SetDefCellTextFont, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetCellTextFont", (PyCFunction) _wrap_wxGrid_SetCellTextFont, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetDefCellTextColour", (PyCFunction) _wrap_wxGrid_SetDefCellTextColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetCellTextColour", (PyCFunction) _wrap_wxGrid_SetCellTextColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetDefCellBackgroundColour", (PyCFunction) _wrap_wxGrid_SetDefCellBackgroundColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetCellBackgroundColour", (PyCFunction) _wrap_wxGrid_SetCellBackgroundColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetDefCellAlignment", (PyCFunction) _wrap_wxGrid_SetDefCellAlignment, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_SetCellAlignment", (PyCFunction) _wrap_wxGrid_SetCellAlignment, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_OnActivate", (PyCFunction) _wrap_wxGrid_OnActivate, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_InsertRows", (PyCFunction) _wrap_wxGrid_InsertRows, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_InsertCols", (PyCFunction) _wrap_wxGrid_InsertCols, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetVertScrollBar", (PyCFunction) _wrap_wxGrid_GetVertScrollBar, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetTextItem", (PyCFunction) _wrap_wxGrid_GetTextItem, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetScrollPosY", (PyCFunction) _wrap_wxGrid_GetScrollPosY, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetScrollPosX", (PyCFunction) _wrap_wxGrid_GetScrollPosX, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetRows", (PyCFunction) _wrap_wxGrid_GetRows, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetRowHeight", (PyCFunction) _wrap_wxGrid_GetRowHeight, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetLabelValue", (PyCFunction) _wrap_wxGrid_GetLabelValue, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetLabelTextFont", (PyCFunction) _wrap_wxGrid_GetLabelTextFont, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetLabelTextColour", (PyCFunction) _wrap_wxGrid_GetLabelTextColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetLabelSize", (PyCFunction) _wrap_wxGrid_GetLabelSize, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetLabelBackgroundColour", (PyCFunction) _wrap_wxGrid_GetLabelBackgroundColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetLabelAlignment", (PyCFunction) _wrap_wxGrid_GetLabelAlignment, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetHorizScrollBar", (PyCFunction) _wrap_wxGrid_GetHorizScrollBar, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetEditable", (PyCFunction) _wrap_wxGrid_GetEditable, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCursorRow", (PyCFunction) _wrap_wxGrid_GetCursorRow, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCursorColumn", (PyCFunction) _wrap_wxGrid_GetCursorColumn, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCurrentRect", (PyCFunction) _wrap_wxGrid_GetCurrentRect, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetColumnWidth", (PyCFunction) _wrap_wxGrid_GetColumnWidth, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCols", (PyCFunction) _wrap_wxGrid_GetCols, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCellValue", (PyCFunction) _wrap_wxGrid_GetCellValue, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetDefCellTextFont", (PyCFunction) _wrap_wxGrid_GetDefCellTextFont, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCellTextFont", (PyCFunction) _wrap_wxGrid_GetCellTextFont, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetDefCellTextColour", (PyCFunction) _wrap_wxGrid_GetDefCellTextColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCellTextColour", (PyCFunction) _wrap_wxGrid_GetCellTextColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCells", (PyCFunction) _wrap_wxGrid_GetCells, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetDefCellBackgroundColour", (PyCFunction) _wrap_wxGrid_GetDefCellBackgroundColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCellBackgroundColour", (PyCFunction) _wrap_wxGrid_GetCellBackgroundColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetDefCellAlignment", (PyCFunction) _wrap_wxGrid_GetDefCellAlignment, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCellAlignment", (PyCFunction) _wrap_wxGrid_GetCellAlignment, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetCell", (PyCFunction) _wrap_wxGrid_GetCell, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_GetBatchCount", (PyCFunction) _wrap_wxGrid_GetBatchCount, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_EndBatch", (PyCFunction) _wrap_wxGrid_EndBatch, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_DeleteRows", (PyCFunction) _wrap_wxGrid_DeleteRows, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_DeleteCols", (PyCFunction) _wrap_wxGrid_DeleteCols, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_CurrentCellVisible", (PyCFunction) _wrap_wxGrid_CurrentCellVisible, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_CreateGrid", (PyCFunction) _wrap_wxGrid_CreateGrid, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_CellHitTest", (PyCFunction) _wrap_wxGrid_CellHitTest, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_BeginBatch", (PyCFunction) _wrap_wxGrid_BeginBatch, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_AppendRows", (PyCFunction) _wrap_wxGrid_AppendRows, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_AppendCols", (PyCFunction) _wrap_wxGrid_AppendCols, METH_VARARGS | METH_KEYWORDS }, - { "wxGrid_AdjustScrollbars", (PyCFunction) _wrap_wxGrid_AdjustScrollbars, METH_VARARGS | METH_KEYWORDS }, - { "new_wxGrid", (PyCFunction) _wrap_new_wxGrid, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_SetCellBitmap", (PyCFunction) _wrap_wxGridCell_SetCellBitmap, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_GetCellBitmap", (PyCFunction) _wrap_wxGridCell_GetCellBitmap, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_SetAlignment", (PyCFunction) _wrap_wxGridCell_SetAlignment, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_GetAlignment", (PyCFunction) _wrap_wxGridCell_GetAlignment, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_GetBackgroundBrush", (PyCFunction) _wrap_wxGridCell_GetBackgroundBrush, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_SetBackgroundColour", (PyCFunction) _wrap_wxGridCell_SetBackgroundColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_GetBackgroundColour", (PyCFunction) _wrap_wxGridCell_GetBackgroundColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_SetTextColour", (PyCFunction) _wrap_wxGridCell_SetTextColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_GetTextColour", (PyCFunction) _wrap_wxGridCell_GetTextColour, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_SetFont", (PyCFunction) _wrap_wxGridCell_SetFont, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_GetFont", (PyCFunction) _wrap_wxGridCell_GetFont, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_SetTextValue", (PyCFunction) _wrap_wxGridCell_SetTextValue, METH_VARARGS | METH_KEYWORDS }, - { "wxGridCell_GetTextValue", (PyCFunction) _wrap_wxGridCell_GetTextValue, METH_VARARGS | METH_KEYWORDS }, - { "delete_wxGridCell", (PyCFunction) _wrap_delete_wxGridCell, METH_VARARGS | METH_KEYWORDS }, - { "new_wxGridCell", (PyCFunction) _wrap_new_wxGridCell, METH_VARARGS | METH_KEYWORDS }, - { NULL, NULL } -}; -#ifdef __cplusplus -} -#endif -/* - * This table is used by the pointer type-checker - */ -static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { - { "_wxAcceleratorTable","_class_wxAcceleratorTable",0}, - { "_wxEvent","_class_wxSplitterEvent",SwigwxSplitterEventTowxEvent}, - { "_wxEvent","_wxSplitterEvent",SwigwxSplitterEventTowxEvent}, - { "_wxEvent","_class_wxNotebookEvent",SwigwxNotebookEventTowxEvent}, - { "_wxEvent","_wxNotebookEvent",SwigwxNotebookEventTowxEvent}, - { "_wxEvent","_class_wxGridEvent",SwigwxGridEventTowxEvent}, - { "_wxEvent","_wxGridEvent",SwigwxGridEventTowxEvent}, - { "_wxEvent","_class_wxEvent",0}, - { "_class_wxActivateEvent","_wxActivateEvent",0}, - { "_signed_long","_long",0}, - { "_wxMenuEvent","_class_wxMenuEvent",0}, - { "_wxPyBitmapDataObject","_class_wxPyBitmapDataObject",0}, - { "_wxBitmapDataObject","_class_wxBitmapDataObject",0}, - { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, - { "_wxPrintQuality","_wxCoord",0}, - { "_wxPrintQuality","_int",0}, - { "_wxPrintQuality","_signed_int",0}, - { "_wxPrintQuality","_unsigned_int",0}, - { "_wxPrintQuality","_wxWindowID",0}, - { "_wxPrintQuality","_uint",0}, - { "_wxPrintQuality","_EBool",0}, - { "_wxPrintQuality","_size_t",0}, - { "_class_wxCustomDataObject","_wxCustomDataObject",0}, - { "_class_wxRegionIterator","_wxRegionIterator",0}, - { "_class_wxPyTextDropTarget","_wxPyTextDropTarget",0}, - { "_class_wxMenuBar","_wxMenuBar",0}, - { "_class_wxEvtHandler","_class_wxSplitterWindow",SwigwxSplitterWindowTowxEvtHandler}, - { "_class_wxEvtHandler","_wxSplitterWindow",SwigwxSplitterWindowTowxEvtHandler}, - { "_class_wxEvtHandler","_class_wxNotebook",SwigwxNotebookTowxEvtHandler}, - { "_class_wxEvtHandler","_wxNotebook",SwigwxNotebookTowxEvtHandler}, - { "_class_wxEvtHandler","_class_wxGrid",SwigwxGridTowxEvtHandler}, - { "_class_wxEvtHandler","_wxGrid",SwigwxGridTowxEvtHandler}, - { "_class_wxEvtHandler","_wxEvtHandler",0}, - { "_wxPaintEvent","_class_wxPaintEvent",0}, - { "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0}, - { "_wxCursor","_class_wxCursor",0}, - { "_wxNotifyEvent","_class_wxNotebookEvent",SwigwxNotebookEventTowxNotifyEvent}, - { "_wxNotifyEvent","_wxNotebookEvent",SwigwxNotebookEventTowxNotifyEvent}, - { "_wxNotifyEvent","_class_wxNotifyEvent",0}, - { "_wxMask","_class_wxMask",0}, - { "_wxGrid","_class_wxGrid",0}, - { "_wxPen","_class_wxPen",0}, - { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, - { "_byte","_unsigned_char",0}, - { "_wxDataObject","_class_wxDataObject",0}, - { "_wxStaticBox","_class_wxStaticBox",0}, - { "_wxPyDataObjectSimple","_class_wxPyDataObjectSimple",0}, - { "_wxPyDropSource","_class_wxPyDropSource",0}, - { "_wxChoice","_class_wxChoice",0}, - { "_wxSlider","_class_wxSlider",0}, - { "_wxNotebookEvent","_class_wxNotebookEvent",0}, - { "_long","_unsigned_long",0}, - { "_long","_signed_long",0}, - { "_wxImageList","_class_wxImageList",0}, - { "_wxDataObjectSimple","_class_wxDataObjectSimple",0}, - { "_wxDropFilesEvent","_class_wxDropFilesEvent",0}, - { "_wxBitmapButton","_class_wxBitmapButton",0}, - { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, - { "_class_wxClipboard","_wxClipboard",0}, - { "_class_wxGauge","_wxGauge",0}, - { "_wxDC","_class_wxDC",0}, - { "_class_wxBitmapDataObject","_wxBitmapDataObject",0}, - { "_wxSpinEvent","_class_wxSpinEvent",0}, - { "_size_t","_wxCoord",0}, - { "_size_t","_wxPrintQuality",0}, - { "_size_t","_unsigned_int",0}, - { "_size_t","_int",0}, - { "_size_t","_wxWindowID",0}, - { "_size_t","_uint",0}, - { "_class_wxRealPoint","_wxRealPoint",0}, - { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, - { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, - { "_class_wxMenuItem","_wxMenuItem",0}, - { "_class_wxPaintEvent","_wxPaintEvent",0}, - { "_wxSysColourChangedEvent","_class_wxSysColourChangedEvent",0}, - { "_class_wxPostScriptDC","_wxPostScriptDC",0}, - { "_wxPanel","_class_wxGrid",SwigwxGridTowxPanel}, - { "_wxPanel","_wxGrid",SwigwxGridTowxPanel}, - { "_wxPanel","_class_wxPanel",0}, - { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, - { "_wxCheckBox","_class_wxCheckBox",0}, - { "_wxPyEvent","_class_wxPyEvent",0}, - { "_wxTextCtrl","_class_wxTextCtrl",0}, - { "_class_wxMask","_wxMask",0}, - { "_wxTextDataObject","_class_wxTextDataObject",0}, - { "_class_wxKeyEvent","_wxKeyEvent",0}, - { "_class_wxGrid","_wxGrid",0}, - { "_wxColour","_class_wxColour",0}, - { "_class_wxDialog","_wxDialog",0}, - { "_class_wxFileDataObject","_wxFileDataObject",0}, - { "_wxIdleEvent","_class_wxIdleEvent",0}, - { "_class_wxUpdateUIEvent","_wxUpdateUIEvent",0}, - { "_class_wxDataObject","_wxDataObject",0}, - { "_wxStaticLine","_class_wxStaticLine",0}, - { "_wxBrush","_class_wxBrush",0}, - { "_class_wxNotebookEvent","_wxNotebookEvent",0}, - { "_wxDataFormat","_class_wxDataFormat",0}, - { "_class_wxDataObjectSimple","_wxDataObjectSimple",0}, - { "_wxShowEvent","_class_wxShowEvent",0}, - { "_uint","_wxCoord",0}, - { "_uint","_wxPrintQuality",0}, - { "_uint","_size_t",0}, - { "_uint","_unsigned_int",0}, - { "_uint","_int",0}, - { "_uint","_wxWindowID",0}, - { "_wxPyValidator","_class_wxPyValidator",0}, - { "_class_wxEvent","_class_wxSplitterEvent",SwigwxSplitterEventTowxEvent}, - { "_class_wxEvent","_wxSplitterEvent",SwigwxSplitterEventTowxEvent}, - { "_class_wxEvent","_class_wxNotebookEvent",SwigwxNotebookEventTowxEvent}, - { "_class_wxEvent","_wxNotebookEvent",SwigwxNotebookEventTowxEvent}, - { "_class_wxEvent","_class_wxGridEvent",SwigwxGridEventTowxEvent}, - { "_class_wxEvent","_wxGridEvent",SwigwxGridEventTowxEvent}, - { "_class_wxEvent","_wxEvent",0}, - { "_wxCheckListBox","_class_wxCheckListBox",0}, - { "_wxSplitterEvent","_class_wxSplitterEvent",0}, - { "_wxGridEvent","_class_wxGridEvent",0}, - { "_wxRect","_class_wxRect",0}, - { "_wxCommandEvent","_class_wxSplitterEvent",SwigwxSplitterEventTowxCommandEvent}, - { "_wxCommandEvent","_wxSplitterEvent",SwigwxSplitterEventTowxCommandEvent}, - { "_wxCommandEvent","_class_wxNotebookEvent",SwigwxNotebookEventTowxCommandEvent}, - { "_wxCommandEvent","_wxNotebookEvent",SwigwxNotebookEventTowxCommandEvent}, - { "_wxCommandEvent","_class_wxCommandEvent",0}, - { "_wxSizeEvent","_class_wxSizeEvent",0}, - { "_wxPoint","_class_wxPoint",0}, - { "_class_wxButton","_wxButton",0}, - { "_wxRadioBox","_class_wxRadioBox",0}, - { "_wxBitmap","_class_wxBitmap",0}, - { "_wxPyTimer","_class_wxPyTimer",0}, - { "_wxWindowDC","_class_wxWindowDC",0}, - { "_wxScrollBar","_class_wxScrollBar",0}, - { "_wxSpinButton","_class_wxSpinButton",0}, - { "_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0}, - { "_class_wxNotifyEvent","_class_wxNotebookEvent",SwigwxNotebookEventTowxNotifyEvent}, - { "_class_wxNotifyEvent","_wxNotebookEvent",SwigwxNotebookEventTowxNotifyEvent}, - { "_class_wxNotifyEvent","_wxNotifyEvent",0}, - { "_class_wxValidator","_wxValidator",0}, - { "_class_wxPyEvent","_wxPyEvent",0}, - { "_class_wxIconizeEvent","_wxIconizeEvent",0}, - { "_class_wxStaticBitmap","_wxStaticBitmap",0}, - { "_wxDropTarget","_class_wxDropTarget",0}, - { "_class_wxStaticLine","_wxStaticLine",0}, - { "_wxScrollEvent","_class_wxScrollEvent",0}, - { "_EBool","_wxCoord",0}, - { "_EBool","_wxPrintQuality",0}, - { "_EBool","_signed_int",0}, - { "_EBool","_int",0}, - { "_EBool","_wxWindowID",0}, - { "_class_wxRegion","_wxRegion",0}, - { "_class_wxDataFormat","_wxDataFormat",0}, - { "_class_wxDropFilesEvent","_wxDropFilesEvent",0}, - { "_wxWindowDestroyEvent","_class_wxWindowDestroyEvent",0}, - { "_wxStaticText","_class_wxStaticText",0}, - { "_wxFont","_class_wxFont",0}, - { "_class_wxPyDropTarget","_wxPyDropTarget",0}, - { "_wxCloseEvent","_class_wxCloseEvent",0}, - { "_class_wxSplitterEvent","_wxSplitterEvent",0}, - { "_wxNotebook","_class_wxNotebook",0}, - { "_unsigned_long","_long",0}, - { "_class_wxRect","_wxRect",0}, - { "_class_wxDC","_wxDC",0}, - { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, - { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, - { "_class_wxWindowCreateEvent","_wxWindowCreateEvent",0}, - { "_class_wxPyTimer","_wxPyTimer",0}, - { "_wxFocusEvent","_class_wxFocusEvent",0}, - { "_wxMaximizeEvent","_class_wxMaximizeEvent",0}, - { "_class_wxSpinButton","_wxSpinButton",0}, - { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, - { "_class_wxPanel","_class_wxGrid",SwigwxGridTowxPanel}, - { "_class_wxPanel","_wxGrid",SwigwxGridTowxPanel}, - { "_class_wxPanel","_wxPanel",0}, - { "_class_wxCheckBox","_wxCheckBox",0}, - { "_wxComboBox","_class_wxComboBox",0}, - { "_wxRadioButton","_class_wxRadioButton",0}, - { "_signed_int","_wxCoord",0}, - { "_signed_int","_wxPrintQuality",0}, - { "_signed_int","_EBool",0}, - { "_signed_int","_wxWindowID",0}, - { "_signed_int","_int",0}, - { "_class_wxTextCtrl","_wxTextCtrl",0}, - { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, - { "_class_wxTextDataObject","_wxTextDataObject",0}, - { "_wxMenu","_class_wxMenu",0}, - { "_class_wxMoveEvent","_wxMoveEvent",0}, - { "_wxListBox","_class_wxListBox",0}, - { "_wxScreenDC","_class_wxScreenDC",0}, - { "_WXTYPE","_short",0}, - { "_WXTYPE","_signed_short",0}, - { "_WXTYPE","_unsigned_short",0}, - { "_class_wxDropTarget","_wxDropTarget",0}, - { "_class_wxBrush","_wxBrush",0}, - { "_unsigned_short","_WXTYPE",0}, - { "_unsigned_short","_short",0}, - { "_class_wxWindow","_class_wxSplitterWindow",SwigwxSplitterWindowTowxWindow}, - { "_class_wxWindow","_wxSplitterWindow",SwigwxSplitterWindowTowxWindow}, - { "_class_wxWindow","_class_wxNotebook",SwigwxNotebookTowxWindow}, - { "_class_wxWindow","_wxNotebook",SwigwxNotebookTowxWindow}, - { "_class_wxWindow","_class_wxGrid",SwigwxGridTowxWindow}, - { "_class_wxWindow","_wxGrid",SwigwxGridTowxWindow}, - { "_class_wxWindow","_wxWindow",0}, - { "_wxSplitterWindow","_class_wxSplitterWindow",0}, - { "_class_wxStaticText","_wxStaticText",0}, - { "_class_wxFont","_wxFont",0}, - { "_wxClipboard","_class_wxClipboard",0}, - { "_class_wxPyValidator","_wxPyValidator",0}, - { "_class_wxCloseEvent","_wxCloseEvent",0}, - { "_wxBusyInfo","_class_wxBusyInfo",0}, - { "_class_wxMenuEvent","_wxMenuEvent",0}, - { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0}, - { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0}, - { "_wxClientDC","_class_wxClientDC",0}, - { "_wxMouseEvent","_class_wxMouseEvent",0}, - { "_class_wxPoint","_wxPoint",0}, - { "_wxRealPoint","_class_wxRealPoint",0}, - { "_class_wxRadioBox","_wxRadioBox",0}, - { "_wxGridCell","_class_wxGridCell",0}, - { "_signed_short","_WXTYPE",0}, - { "_signed_short","_short",0}, - { "_wxMemoryDC","_class_wxMemoryDC",0}, - { "_wxPyTextDataObject","_class_wxPyTextDataObject",0}, - { "_wxPaintDC","_class_wxPaintDC",0}, - { "_class_wxWindowDC","_wxWindowDC",0}, - { "_class_wxFocusEvent","_wxFocusEvent",0}, - { "_class_wxMaximizeEvent","_wxMaximizeEvent",0}, - { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, - { "_class_wxCursor","_wxCursor",0}, - { "_wxPostScriptDC","_class_wxPostScriptDC",0}, - { "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0}, - { "_wxScrolledWindow","_class_wxScrolledWindow",0}, - { "_unsigned_char","_byte",0}, - { "_class_wxMenu","_wxMenu",0}, - { "_wxControl","_class_wxNotebook",SwigwxNotebookTowxControl}, - { "_wxControl","_wxNotebook",SwigwxNotebookTowxControl}, - { "_wxControl","_class_wxControl",0}, - { "_class_wxListBox","_wxListBox",0}, - { "_unsigned_int","_wxCoord",0}, - { "_unsigned_int","_wxPrintQuality",0}, - { "_unsigned_int","_size_t",0}, - { "_unsigned_int","_uint",0}, - { "_unsigned_int","_wxWindowID",0}, - { "_unsigned_int","_int",0}, - { "_wxIcon","_class_wxIcon",0}, - { "_wxDialog","_class_wxDialog",0}, - { "_class_wxPen","_wxPen",0}, - { "_short","_WXTYPE",0}, - { "_short","_unsigned_short",0}, - { "_short","_signed_short",0}, - { "_class_wxStaticBox","_wxStaticBox",0}, - { "_class_wxPyDataObjectSimple","_wxPyDataObjectSimple",0}, - { "_class_wxPyDropSource","_wxPyDropSource",0}, - { "_class_wxScrollEvent","_wxScrollEvent",0}, - { "_wxJoystickEvent","_class_wxJoystickEvent",0}, - { "_class_wxChoice","_wxChoice",0}, - { "_class_wxSlider","_wxSlider",0}, - { "_class_wxImageList","_wxImageList",0}, - { "_class_wxBitmapButton","_wxBitmapButton",0}, - { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, - { "_class_wxNotebook","_wxNotebook",0}, - { "_wxWindowID","_wxCoord",0}, - { "_wxWindowID","_wxPrintQuality",0}, - { "_wxWindowID","_size_t",0}, - { "_wxWindowID","_EBool",0}, - { "_wxWindowID","_uint",0}, - { "_wxWindowID","_int",0}, - { "_wxWindowID","_signed_int",0}, - { "_wxWindowID","_unsigned_int",0}, - { "_class_wxScrollWinEvent","_wxScrollWinEvent",0}, - { "_int","_wxCoord",0}, - { "_int","_wxPrintQuality",0}, - { "_int","_size_t",0}, - { "_int","_EBool",0}, - { "_int","_uint",0}, - { "_int","_wxWindowID",0}, - { "_int","_unsigned_int",0}, - { "_int","_signed_int",0}, - { "_class_wxMouseEvent","_wxMouseEvent",0}, - { "_wxPyCommandEvent","_class_wxPyCommandEvent",0}, - { "_class_wxSpinEvent","_wxSpinEvent",0}, - { "_class_wxQueryNewPaletteEvent","_wxQueryNewPaletteEvent",0}, - { "_class_wxNavigationKeyEvent","_wxNavigationKeyEvent",0}, - { "_wxButton","_class_wxButton",0}, - { "_wxSize","_class_wxSize",0}, - { "_wxRegionIterator","_class_wxRegionIterator",0}, - { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, - { "_class_wxPaintDC","_wxPaintDC",0}, - { "_class_wxSysColourChangedEvent","_wxSysColourChangedEvent",0}, - { "_class_wxPyFileDropTarget","_wxPyFileDropTarget",0}, - { "_class_wxInitDialogEvent","_wxInitDialogEvent",0}, - { "_class_wxComboBox","_wxComboBox",0}, - { "_class_wxRadioButton","_wxRadioButton",0}, - { "_wxValidator","_class_wxValidator",0}, - { "_class_wxLayoutConstraints","_wxLayoutConstraints",0}, - { "_wxIconizeEvent","_class_wxIconizeEvent",0}, - { "_class_wxControl","_class_wxNotebook",SwigwxNotebookTowxControl}, - { "_class_wxControl","_wxNotebook",SwigwxNotebookTowxControl}, - { "_class_wxControl","_wxControl",0}, - { "_wxStaticBitmap","_class_wxStaticBitmap",0}, - { "_class_wxIcon","_wxIcon",0}, - { "_class_wxColour","_wxColour",0}, - { "_class_wxScreenDC","_wxScreenDC",0}, - { "_wxPalette","_class_wxPalette",0}, - { "_class_wxIdleEvent","_wxIdleEvent",0}, - { "_wxCoord","_int",0}, - { "_wxCoord","_signed_int",0}, - { "_wxCoord","_unsigned_int",0}, - { "_wxCoord","_wxWindowID",0}, - { "_wxCoord","_uint",0}, - { "_wxCoord","_EBool",0}, - { "_wxCoord","_size_t",0}, - { "_wxCoord","_wxPrintQuality",0}, - { "_wxEraseEvent","_class_wxEraseEvent",0}, - { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, - { "_class_wxJoystickEvent","_wxJoystickEvent",0}, - { "_wxRegion","_class_wxRegion",0}, - { "_class_wxSplitterWindow","_wxSplitterWindow",0}, - { "_class_wxShowEvent","_wxShowEvent",0}, - { "_wxPyDropTarget","_class_wxPyDropTarget",0}, - { "_wxActivateEvent","_class_wxActivateEvent",0}, - { "_wxGauge","_class_wxGauge",0}, - { "_class_wxCheckListBox","_wxCheckListBox",0}, - { "_class_wxBusyInfo","_wxBusyInfo",0}, - { "_class_wxGridEvent","_wxGridEvent",0}, - { "_class_wxCommandEvent","_class_wxSplitterEvent",SwigwxSplitterEventTowxCommandEvent}, - { "_class_wxCommandEvent","_wxSplitterEvent",SwigwxSplitterEventTowxCommandEvent}, - { "_class_wxCommandEvent","_class_wxNotebookEvent",SwigwxNotebookEventTowxCommandEvent}, - { "_class_wxCommandEvent","_wxNotebookEvent",SwigwxNotebookEventTowxCommandEvent}, - { "_class_wxCommandEvent","_wxCommandEvent",0}, - { "_class_wxClientDC","_wxClientDC",0}, - { "_class_wxSizeEvent","_wxSizeEvent",0}, - { "_wxCustomDataObject","_class_wxCustomDataObject",0}, - { "_class_wxGridCell","_wxGridCell",0}, - { "_class_wxSize","_wxSize",0}, - { "_class_wxBitmap","_wxBitmap",0}, - { "_class_wxMemoryDC","_wxMemoryDC",0}, - { "_wxPyTextDropTarget","_class_wxPyTextDropTarget",0}, - { "_wxMenuBar","_class_wxMenuBar",0}, - { "_wxEvtHandler","_class_wxSplitterWindow",SwigwxSplitterWindowTowxEvtHandler}, - { "_wxEvtHandler","_wxSplitterWindow",SwigwxSplitterWindowTowxEvtHandler}, - { "_wxEvtHandler","_class_wxNotebook",SwigwxNotebookTowxEvtHandler}, - { "_wxEvtHandler","_wxNotebook",SwigwxNotebookTowxEvtHandler}, - { "_wxEvtHandler","_class_wxGrid",SwigwxGridTowxEvtHandler}, - { "_wxEvtHandler","_wxGrid",SwigwxGridTowxEvtHandler}, - { "_wxEvtHandler","_class_wxEvtHandler",0}, - { "_wxMenuItem","_class_wxMenuItem",0}, - { "_class_wxScrollBar","_wxScrollBar",0}, - { "_class_wxScrolledWindow","_wxScrolledWindow",0}, - { "_wxKeyEvent","_class_wxKeyEvent",0}, - { "_wxMoveEvent","_class_wxMoveEvent",0}, - { "_class_wxPalette","_wxPalette",0}, - { "_wxFileDataObject","_class_wxFileDataObject",0}, - { "_class_wxEraseEvent","_wxEraseEvent",0}, - { "_class_wxDataObjectComposite","_wxDataObjectComposite",0}, - { "_wxWindow","_class_wxSplitterWindow",SwigwxSplitterWindowTowxWindow}, - { "_wxWindow","_wxSplitterWindow",SwigwxSplitterWindowTowxWindow}, - { "_wxWindow","_class_wxNotebook",SwigwxNotebookTowxWindow}, - { "_wxWindow","_wxNotebook",SwigwxNotebookTowxWindow}, - { "_wxWindow","_class_wxGrid",SwigwxGridTowxWindow}, - { "_wxWindow","_wxGrid",SwigwxGridTowxWindow}, - { "_wxWindow","_class_wxWindow",0}, - { "_class_wxWindowDestroyEvent","_wxWindowDestroyEvent",0}, -{0,0,0}}; - -static PyObject *SWIG_globals; -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT(void) initwindows2c() { - PyObject *m, *d; - SWIG_globals = SWIG_newvarlink(); - m = Py_InitModule("windows2c", windows2cMethods); - d = PyModule_GetDict(m); - PyDict_SetItemString(d,"wxGRID_TEXT_CTRL", PyInt_FromLong((long) wxGRID_TEXT_CTRL)); - PyDict_SetItemString(d,"wxGRID_HSCROLL", PyInt_FromLong((long) wxGRID_HSCROLL)); - PyDict_SetItemString(d,"wxGRID_VSCROLL", PyInt_FromLong((long) wxGRID_VSCROLL)); - PyDict_SetItemString(d,"wxEVT_GRID_SELECT_CELL", PyInt_FromLong((long) wxEVT_GRID_SELECT_CELL)); - PyDict_SetItemString(d,"wxEVT_GRID_CREATE_CELL", PyInt_FromLong((long) wxEVT_GRID_CREATE_CELL)); - PyDict_SetItemString(d,"wxEVT_GRID_CHANGE_LABELS", PyInt_FromLong((long) wxEVT_GRID_CHANGE_LABELS)); - PyDict_SetItemString(d,"wxEVT_GRID_CHANGE_SEL_LABEL", PyInt_FromLong((long) wxEVT_GRID_CHANGE_SEL_LABEL)); - PyDict_SetItemString(d,"wxEVT_GRID_CELL_CHANGE", PyInt_FromLong((long) wxEVT_GRID_CELL_CHANGE)); - PyDict_SetItemString(d,"wxEVT_GRID_CELL_LCLICK", PyInt_FromLong((long) wxEVT_GRID_CELL_LCLICK)); - PyDict_SetItemString(d,"wxEVT_GRID_CELL_RCLICK", PyInt_FromLong((long) wxEVT_GRID_CELL_RCLICK)); - PyDict_SetItemString(d,"wxEVT_GRID_LABEL_LCLICK", PyInt_FromLong((long) wxEVT_GRID_LABEL_LCLICK)); - PyDict_SetItemString(d,"wxEVT_GRID_LABEL_RCLICK", PyInt_FromLong((long) wxEVT_GRID_LABEL_RCLICK)); -{ - int i; - for (i = 0; _swig_mapping[i].n1; i++) - SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv); -} -} diff --git a/utils/wxPython/src/gtk/windows2.py b/utils/wxPython/src/gtk/windows2.py deleted file mode 100644 index fba23472ae..0000000000 --- a/utils/wxPython/src/gtk/windows2.py +++ /dev/null @@ -1,600 +0,0 @@ -# This file was created automatically by SWIG. -import windows2c - -from misc import * - -from gdi import * - -from windows import * - -from clip_dnd import * - -from controls import * - -from events import * -import wx -class wxGridCellPtr : - def __init__(self,this): - self.this = this - self.thisown = 0 - def __del__(self,windows2c=windows2c): - if self.thisown == 1 : - windows2c.delete_wxGridCell(self) - def GetTextValue(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_GetTextValue,(self,) + _args, _kwargs) - return val - def SetTextValue(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_SetTextValue,(self,) + _args, _kwargs) - return val - def GetFont(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_GetFont,(self,) + _args, _kwargs) - if val: val = wxFontPtr(val) - return val - def SetFont(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_SetFont,(self,) + _args, _kwargs) - return val - def GetTextColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_GetTextColour,(self,) + _args, _kwargs) - if val: val = wxColourPtr(val) - return val - def SetTextColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_SetTextColour,(self,) + _args, _kwargs) - return val - def GetBackgroundColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_GetBackgroundColour,(self,) + _args, _kwargs) - if val: val = wxColourPtr(val) - return val - def SetBackgroundColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_SetBackgroundColour,(self,) + _args, _kwargs) - return val - def GetBackgroundBrush(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_GetBackgroundBrush,(self,) + _args, _kwargs) - if val: val = wxBrushPtr(val) - return val - def GetAlignment(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_GetAlignment,(self,) + _args, _kwargs) - return val - def SetAlignment(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_SetAlignment,(self,) + _args, _kwargs) - return val - def GetCellBitmap(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_GetCellBitmap,(self,) + _args, _kwargs) - if val: val = wxBitmapPtr(val) - return val - def SetCellBitmap(self, *_args, **_kwargs): - val = apply(windows2c.wxGridCell_SetCellBitmap,(self,) + _args, _kwargs) - return val - def __repr__(self): - return "<C wxGridCell instance at %s>" % (self.this,) -class wxGridCell(wxGridCellPtr): - def __init__(self,*_args,**_kwargs): - self.this = apply(windows2c.new_wxGridCell,_args,_kwargs) - self.thisown = 1 - - - - -class wxGridPtr(wxPanelPtr): - def __init__(self,this): - self.this = this - self.thisown = 0 - def AdjustScrollbars(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_AdjustScrollbars,(self,) + _args, _kwargs) - return val - def AppendCols(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_AppendCols,(self,) + _args, _kwargs) - return val - def AppendRows(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_AppendRows,(self,) + _args, _kwargs) - return val - def BeginBatch(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_BeginBatch,(self,) + _args, _kwargs) - return val - def CellHitTest(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_CellHitTest,(self,) + _args, _kwargs) - return val - def CreateGrid(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_CreateGrid,(self,) + _args, _kwargs) - return val - def CurrentCellVisible(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_CurrentCellVisible,(self,) + _args, _kwargs) - return val - def DeleteCols(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_DeleteCols,(self,) + _args, _kwargs) - return val - def DeleteRows(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_DeleteRows,(self,) + _args, _kwargs) - return val - def EndBatch(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_EndBatch,(self,) + _args, _kwargs) - return val - def GetBatchCount(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetBatchCount,(self,) + _args, _kwargs) - return val - def GetCell(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCell,(self,) + _args, _kwargs) - if val: val = wxGridCellPtr(val) - return val - def GetCellAlignment(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCellAlignment,(self,) + _args, _kwargs) - return val - def GetDefCellAlignment(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetDefCellAlignment,(self,) + _args, _kwargs) - return val - def GetCellBackgroundColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCellBackgroundColour,(self,) + _args, _kwargs) - if val: val = wxColourPtr(val) - return val - def GetDefCellBackgroundColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetDefCellBackgroundColour,(self,) + _args, _kwargs) - if val: val = wxColourPtr(val) - return val - def GetCells(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCells,(self,) + _args, _kwargs) - return val - def GetCellTextColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCellTextColour,(self,) + _args, _kwargs) - if val: val = wxColourPtr(val) - return val - def GetDefCellTextColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetDefCellTextColour,(self,) + _args, _kwargs) - if val: val = wxColourPtr(val) - return val - def GetCellTextFont(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCellTextFont,(self,) + _args, _kwargs) - if val: val = wxFontPtr(val) - return val - def GetDefCellTextFont(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetDefCellTextFont,(self,) + _args, _kwargs) - if val: val = wxFontPtr(val) - return val - def GetCellValue(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCellValue,(self,) + _args, _kwargs) - return val - def GetCols(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCols,(self,) + _args, _kwargs) - return val - def GetColumnWidth(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetColumnWidth,(self,) + _args, _kwargs) - return val - def GetCurrentRect(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCurrentRect,(self,) + _args, _kwargs) - if val: val = wxRectPtr(val) ; val.thisown = 1 - return val - def GetCursorColumn(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCursorColumn,(self,) + _args, _kwargs) - return val - def GetCursorRow(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetCursorRow,(self,) + _args, _kwargs) - return val - def GetEditable(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetEditable,(self,) + _args, _kwargs) - return val - def GetHorizScrollBar(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetHorizScrollBar,(self,) + _args, _kwargs) - if val: val = wxScrollBarPtr(val) - return val - def GetLabelAlignment(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetLabelAlignment,(self,) + _args, _kwargs) - return val - def GetLabelBackgroundColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetLabelBackgroundColour,(self,) + _args, _kwargs) - if val: val = wxColourPtr(val) - return val - def GetLabelSize(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetLabelSize,(self,) + _args, _kwargs) - return val - def GetLabelTextColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetLabelTextColour,(self,) + _args, _kwargs) - if val: val = wxColourPtr(val) - return val - def GetLabelTextFont(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetLabelTextFont,(self,) + _args, _kwargs) - if val: val = wxFontPtr(val) - return val - def GetLabelValue(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetLabelValue,(self,) + _args, _kwargs) - return val - def GetRowHeight(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetRowHeight,(self,) + _args, _kwargs) - return val - def GetRows(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetRows,(self,) + _args, _kwargs) - return val - def GetScrollPosX(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetScrollPosX,(self,) + _args, _kwargs) - return val - def GetScrollPosY(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetScrollPosY,(self,) + _args, _kwargs) - return val - def GetTextItem(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetTextItem,(self,) + _args, _kwargs) - if val: val = wxTextCtrlPtr(val) - return val - def GetVertScrollBar(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetVertScrollBar,(self,) + _args, _kwargs) - if val: val = wxScrollBarPtr(val) - return val - def InsertCols(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_InsertCols,(self,) + _args, _kwargs) - return val - def InsertRows(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_InsertRows,(self,) + _args, _kwargs) - return val - def OnActivate(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_OnActivate,(self,) + _args, _kwargs) - return val - def SetCellAlignment(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetCellAlignment,(self,) + _args, _kwargs) - return val - def SetDefCellAlignment(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetDefCellAlignment,(self,) + _args, _kwargs) - return val - def SetCellBackgroundColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetCellBackgroundColour,(self,) + _args, _kwargs) - return val - def SetDefCellBackgroundColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetDefCellBackgroundColour,(self,) + _args, _kwargs) - return val - def SetCellTextColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetCellTextColour,(self,) + _args, _kwargs) - return val - def SetDefCellTextColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetDefCellTextColour,(self,) + _args, _kwargs) - return val - def SetCellTextFont(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetCellTextFont,(self,) + _args, _kwargs) - return val - def SetDefCellTextFont(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetDefCellTextFont,(self,) + _args, _kwargs) - return val - def SetCellValue(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetCellValue,(self,) + _args, _kwargs) - return val - def SetColumnWidth(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetColumnWidth,(self,) + _args, _kwargs) - return val - def SetDividerPen(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetDividerPen,(self,) + _args, _kwargs) - return val - def SetEditable(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetEditable,(self,) + _args, _kwargs) - return val - def SetGridCursor(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetGridCursor,(self,) + _args, _kwargs) - return val - def SetLabelAlignment(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetLabelAlignment,(self,) + _args, _kwargs) - return val - def SetLabelBackgroundColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetLabelBackgroundColour,(self,) + _args, _kwargs) - return val - def SetLabelSize(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetLabelSize,(self,) + _args, _kwargs) - return val - def SetLabelTextColour(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetLabelTextColour,(self,) + _args, _kwargs) - return val - def SetLabelTextFont(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetLabelTextFont,(self,) + _args, _kwargs) - return val - def SetLabelValue(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetLabelValue,(self,) + _args, _kwargs) - return val - def SetRowHeight(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetRowHeight,(self,) + _args, _kwargs) - return val - def UpdateDimensions(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_UpdateDimensions,(self,) + _args, _kwargs) - return val - def GetEditInPlace(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_GetEditInPlace,(self,) + _args, _kwargs) - return val - def SetEditInPlace(self, *_args, **_kwargs): - val = apply(windows2c.wxGrid_SetEditInPlace,(self,) + _args, _kwargs) - return val - def __repr__(self): - return "<C wxGrid instance at %s>" % (self.this,) -class wxGrid(wxGridPtr): - def __init__(self,*_args,**_kwargs): - self.this = apply(windows2c.new_wxGrid,_args,_kwargs) - self.thisown = 1 - wx._StdWindowCallbacks(self) - wx._checkForCallback(self, 'OnSelectCell', wxEVT_GRID_SELECT_CELL) - wx._checkForCallback(self, 'OnCreateCell', wxEVT_GRID_CREATE_CELL) - wx._checkForCallback(self, 'OnChangeLabels', wxEVT_GRID_CHANGE_LABELS) - wx._checkForCallback(self, 'OnChangeSelectionLabel', wxEVT_GRID_CHANGE_SEL_LABEL) - wx._checkForCallback(self, 'OnCellChange', wxEVT_GRID_CELL_CHANGE) - wx._checkForCallback(self, 'OnCellLeftClick', wxEVT_GRID_CELL_LCLICK) - wx._checkForCallback(self, 'OnCellRightClick', wxEVT_GRID_CELL_RCLICK) - wx._checkForCallback(self, 'OnLabelLeftClick', wxEVT_GRID_LABEL_LCLICK) - wx._checkForCallback(self, 'OnLabelRightClick', wxEVT_GRID_LABEL_RCLICK) - - - - -class wxGridEventPtr(wxEventPtr): - def __init__(self,this): - self.this = this - self.thisown = 0 - def GetRow(self, *_args, **_kwargs): - val = apply(windows2c.wxGridEvent_GetRow,(self,) + _args, _kwargs) - return val - def GetCol(self, *_args, **_kwargs): - val = apply(windows2c.wxGridEvent_GetCol,(self,) + _args, _kwargs) - return val - def GetPosition(self, *_args, **_kwargs): - val = apply(windows2c.wxGridEvent_GetPosition,(self,) + _args, _kwargs) - if val: val = wxPointPtr(val) ; val.thisown = 1 - return val - def ControlDown(self, *_args, **_kwargs): - val = apply(windows2c.wxGridEvent_ControlDown,(self,) + _args, _kwargs) - return val - def ShiftDown(self, *_args, **_kwargs): - val = apply(windows2c.wxGridEvent_ShiftDown,(self,) + _args, _kwargs) - return val - def GetCell(self, *_args, **_kwargs): - val = apply(windows2c.wxGridEvent_GetCell,(self,) + _args, _kwargs) - if val: val = wxGridCellPtr(val) - return val - def __setattr__(self,name,value): - if name == "m_row" : - windows2c.wxGridEvent_m_row_set(self,value) - return - if name == "m_col" : - windows2c.wxGridEvent_m_col_set(self,value) - return - if name == "m_x" : - windows2c.wxGridEvent_m_x_set(self,value) - return - if name == "m_y" : - windows2c.wxGridEvent_m_y_set(self,value) - return - if name == "m_control" : - windows2c.wxGridEvent_m_control_set(self,value) - return - if name == "m_shift" : - windows2c.wxGridEvent_m_shift_set(self,value) - return - if name == "m_cell" : - windows2c.wxGridEvent_m_cell_set(self,value.this) - return - self.__dict__[name] = value - def __getattr__(self,name): - if name == "m_row" : - return windows2c.wxGridEvent_m_row_get(self) - if name == "m_col" : - return windows2c.wxGridEvent_m_col_get(self) - if name == "m_x" : - return windows2c.wxGridEvent_m_x_get(self) - if name == "m_y" : - return windows2c.wxGridEvent_m_y_get(self) - if name == "m_control" : - return windows2c.wxGridEvent_m_control_get(self) - if name == "m_shift" : - return windows2c.wxGridEvent_m_shift_get(self) - if name == "m_cell" : - return wxGridCellPtr(windows2c.wxGridEvent_m_cell_get(self)) - raise AttributeError,name - def __repr__(self): - return "<C wxGridEvent instance at %s>" % (self.this,) -class wxGridEvent(wxGridEventPtr): - def __init__(self,this): - self.this = this - - - - -class wxNotebookEventPtr(wxNotifyEventPtr): - def __init__(self,this): - self.this = this - self.thisown = 0 - def GetSelection(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebookEvent_GetSelection,(self,) + _args, _kwargs) - return val - def GetOldSelection(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebookEvent_GetOldSelection,(self,) + _args, _kwargs) - return val - def SetOldSelection(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebookEvent_SetOldSelection,(self,) + _args, _kwargs) - return val - def SetSelection(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebookEvent_SetSelection,(self,) + _args, _kwargs) - return val - def __repr__(self): - return "<C wxNotebookEvent instance at %s>" % (self.this,) -class wxNotebookEvent(wxNotebookEventPtr): - def __init__(self,this): - self.this = this - - - - -class wxNotebookPtr(wxControlPtr): - def __init__(self,this): - self.this = this - self.thisown = 0 - def GetPageCount(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_GetPageCount,(self,) + _args, _kwargs) - return val - def SetSelection(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_SetSelection,(self,) + _args, _kwargs) - return val - def AdvanceSelection(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_AdvanceSelection,(self,) + _args, _kwargs) - return val - def GetSelection(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_GetSelection,(self,) + _args, _kwargs) - return val - def SetPageText(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_SetPageText,(self,) + _args, _kwargs) - return val - def GetPageText(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_GetPageText,(self,) + _args, _kwargs) - return val - def SetImageList(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_SetImageList,(self,) + _args, _kwargs) - return val - def GetImageList(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_GetImageList,(self,) + _args, _kwargs) - if val: val = wxImageListPtr(val) - return val - def GetPageImage(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_GetPageImage,(self,) + _args, _kwargs) - return val - def SetPageImage(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_SetPageImage,(self,) + _args, _kwargs) - return val - def GetRowCount(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_GetRowCount,(self,) + _args, _kwargs) - return val - def DeletePage(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_DeletePage,(self,) + _args, _kwargs) - return val - def RemovePage(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_RemovePage,(self,) + _args, _kwargs) - return val - def DeleteAllPages(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_DeleteAllPages,(self,) + _args, _kwargs) - return val - def AddPage(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_AddPage,(self,) + _args, _kwargs) - return val - def GetPage(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_GetPage,(self,) + _args, _kwargs) - if val: val = wxWindowPtr(val) - return val - def ResizeChildren(self, *_args, **_kwargs): - val = apply(windows2c.wxNotebook_ResizeChildren,(self,) + _args, _kwargs) - return val - def __repr__(self): - return "<C wxNotebook instance at %s>" % (self.this,) -class wxNotebook(wxNotebookPtr): - def __init__(self,*_args,**_kwargs): - self.this = apply(windows2c.new_wxNotebook,_args,_kwargs) - self.thisown = 1 - wx._StdWindowCallbacks(self) - - - - -class wxSplitterEventPtr(wxCommandEventPtr): - def __init__(self,this): - self.this = this - self.thisown = 0 - def GetSashPosition(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterEvent_GetSashPosition,(self,) + _args, _kwargs) - return val - def GetX(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterEvent_GetX,(self,) + _args, _kwargs) - return val - def GetY(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterEvent_GetY,(self,) + _args, _kwargs) - return val - def GetWindowBeingRemoved(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterEvent_GetWindowBeingRemoved,(self,) + _args, _kwargs) - if val: val = wxWindowPtr(val) - return val - def SetSashPosition(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterEvent_SetSashPosition,(self,) + _args, _kwargs) - return val - def __repr__(self): - return "<C wxSplitterEvent instance at %s>" % (self.this,) -class wxSplitterEvent(wxSplitterEventPtr): - def __init__(self,this): - self.this = this - - - - -class wxSplitterWindowPtr(wxWindowPtr): - def __init__(self,this): - self.this = this - self.thisown = 0 - def GetBorderSize(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_GetBorderSize,(self,) + _args, _kwargs) - return val - def GetMinimumPaneSize(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_GetMinimumPaneSize,(self,) + _args, _kwargs) - return val - def GetSashPosition(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_GetSashPosition,(self,) + _args, _kwargs) - return val - def GetSashSize(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_GetSashSize,(self,) + _args, _kwargs) - return val - def GetSplitMode(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_GetSplitMode,(self,) + _args, _kwargs) - return val - def GetWindow1(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_GetWindow1,(self,) + _args, _kwargs) - if val: val = wxWindowPtr(val) - return val - def GetWindow2(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_GetWindow2,(self,) + _args, _kwargs) - if val: val = wxWindowPtr(val) - return val - def Initialize(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_Initialize,(self,) + _args, _kwargs) - return val - def IsSplit(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_IsSplit,(self,) + _args, _kwargs) - return val - def ReplaceWindow(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_ReplaceWindow,(self,) + _args, _kwargs) - return val - def SetBorderSize(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_SetBorderSize,(self,) + _args, _kwargs) - return val - def SetSashPosition(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_SetSashPosition,(self,) + _args, _kwargs) - return val - def SetSashSize(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_SetSashSize,(self,) + _args, _kwargs) - return val - def SetMinimumPaneSize(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_SetMinimumPaneSize,(self,) + _args, _kwargs) - return val - def SetSplitMode(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_SetSplitMode,(self,) + _args, _kwargs) - return val - def SplitHorizontally(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_SplitHorizontally,(self,) + _args, _kwargs) - return val - def SplitVertically(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_SplitVertically,(self,) + _args, _kwargs) - return val - def Unsplit(self, *_args, **_kwargs): - val = apply(windows2c.wxSplitterWindow_Unsplit,(self,) + _args, _kwargs) - return val - def __repr__(self): - return "<C wxSplitterWindow instance at %s>" % (self.this,) -class wxSplitterWindow(wxSplitterWindowPtr): - def __init__(self,*_args,**_kwargs): - self.this = apply(windows2c.new_wxSplitterWindow,_args,_kwargs) - self.thisown = 1 - wx._StdWindowCallbacks(self) - - - - - - -#-------------- FUNCTION WRAPPERS ------------------ - - - -#-------------- VARIABLE WRAPPERS ------------------ - -wxGRID_TEXT_CTRL = windows2c.wxGRID_TEXT_CTRL -wxGRID_HSCROLL = windows2c.wxGRID_HSCROLL -wxGRID_VSCROLL = windows2c.wxGRID_VSCROLL -wxEVT_GRID_SELECT_CELL = windows2c.wxEVT_GRID_SELECT_CELL -wxEVT_GRID_CREATE_CELL = windows2c.wxEVT_GRID_CREATE_CELL -wxEVT_GRID_CHANGE_LABELS = windows2c.wxEVT_GRID_CHANGE_LABELS -wxEVT_GRID_CHANGE_SEL_LABEL = windows2c.wxEVT_GRID_CHANGE_SEL_LABEL -wxEVT_GRID_CELL_CHANGE = windows2c.wxEVT_GRID_CELL_CHANGE -wxEVT_GRID_CELL_LCLICK = windows2c.wxEVT_GRID_CELL_LCLICK -wxEVT_GRID_CELL_RCLICK = windows2c.wxEVT_GRID_CELL_RCLICK -wxEVT_GRID_LABEL_LCLICK = windows2c.wxEVT_GRID_LABEL_LCLICK -wxEVT_GRID_LABEL_RCLICK = windows2c.wxEVT_GRID_LABEL_RCLICK diff --git a/utils/wxPython/src/motif/dummy b/utils/wxPython/src/motif/dummy deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/utils/wxPython/src/msw/dummy b/utils/wxPython/src/msw/dummy deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/utils/wxPython/src/qt/dummy b/utils/wxPython/src/qt/dummy deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/utils/wxPython/tests/paul.pyc b/utils/wxPython/tests/paul.pyc deleted file mode 100644 index d5b68375dcab2113638b87afc62ed1b3c09e4e15..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1091 zcma)5O>fgc5PfSqNfW9THBjIH3OB2V9^k+kHGq0(8j%y}A+qdEvZ}G8>{dxo&>qr1 z!B5~{GBZ}21aTm-NBc1|`}V!(U%l4voA)15&@ZCbUQqD#DBJ?Mg7OhEKnEBrWD57d z2KY7%;ZKkS(2;C}j~g{)5e9LMn>8q0tv=6_?^;d>5Wsf$gb1Dz1L>$Rq?INzX);v! zI*1udFO3LO6Cvz7uBpM-;Q*ts2G$e<tO-X0j@BF8i=It@O&y9b58{Bk7%q+vC<va# zQt((_7>!I}+-PL^IIHuqt<zwZ%yr=`7n{uTMVxWDwrv_Mmi<*%kCVIH^-F7<DGRAt zEC=R?7TEvSjH#JXoAcRf4@wPEAFAidwkYRgXI24zn<`?j!EBH+%$IL58$<<PoTv<$ zc_-KZso<Y5MJ8gols}Y7jVDwvs&g@KH>&L;UNr}BO>9{6W0}`65E_|+o}jsymZjC5 zq%$@|h@$m#O93{daCUwcGh};6foP_bu1WH8vd_q3dENiilZq^#*d`?prsd+Q%#vIb z`l4MwaZ{<1bC|2Hwr*aoB;hhG3u0Rm-26_9&f7y63wPe7m?2HH8*#sa?AWYOhU$%K zsS|pis;bMLE&i^GsY~Ue2kCYk9z7^`90^x^|Gr6Y^*rS=R?ohs0ev^VEyjl!|CGhM zr?D8H!S_gN{*%;4T+oJp#!^>mFzdaT<CcKOnV5L@;%w;a;*xCMhFCgOTO-|Y_fz;6 V+}+9N^A97v+%?jxeIqsC{{W{i&1(Pv diff --git a/wx-config.in b/wx-config.in index b1e5374d87..a89e5cf8b1 100755 --- a/wx-config.in +++ b/wx-config.in @@ -48,7 +48,7 @@ while test $# -gt 0; do fi fi includes="$includes -I@libdir@/wx/include" - echo $includes @CODE_GEN_FLAGS@ @WXDEBUG_DEFINE@ @TOOLKIT_DEF@ @TOOLKIT_INCLUDE@ + echo $includes -D__USE_WXCONFIG__ @CODE_GEN_FLAGS@ @WXDEBUG_DEFINE@ @TOOLKIT_DEF@ @WXCONFIG_INCLUDE@ ;; --libs) if test @libdir@ != /usr/lib ; then diff --git a/wxBase.dsp b/wxBase.dsp index 4ef0f85a84..9cea60da62 100644 --- a/wxBase.dsp +++ b/wxBase.dsp @@ -40,8 +40,8 @@ RSC=rc.exe # PROP Output_Dir "BaseRelease" # PROP Intermediate_Dir "BaseRelease" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MT" /YX /FD /c -# ADD CPP /nologo /MT /W3 /Zi /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D WIN95=1 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN32__" /D "_MT" /Yu"wx/wxprec.h" /FD /c +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MT" /YX /FD /c +# ADD CPP /nologo /MD /W4 /Zi /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D WIN95=1 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN32__" /D "_MT" /Yu"wx/wxprec.h" /FD /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 BSC32=bscmake.exe @@ -63,8 +63,8 @@ LIB32=link.exe -lib # PROP Output_Dir "BaseDebug" # PROP Intermediate_Dir "BaseDebug" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MT" /YX /FD /c -# ADD CPP /nologo /MTd /W4 /Zi /Od /I "$(wx)\include" /I "$(wx)\src\zlib" /D "_DEBUG" /D DEBUG=1 /D WXDEBUG=1 /D "__WXDEBUG__" /D wxUSE_GUI=0 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WIN32__" /D "__WXMSW__" /D "_MT" /Fr /Yu"wx/wxprec.h" /FD /c +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MT" /YX /FD /c +# ADD CPP /nologo /MDd /W4 /Zi /Od /I "$(wx)\include" /I "$(wx)\src\zlib" /D "_DEBUG" /D DEBUG=1 /D WXDEBUG=1 /D "__WXDEBUG__" /D wxUSE_GUI=0 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WIN32__" /D "__WXMSW__" /D "_MT" /Fr /Yu"wx/wxprec.h" /FD /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 BSC32=bscmake.exe @@ -117,6 +117,10 @@ SOURCE=.\src\common\dynlib.cpp # End Source File # Begin Source File +SOURCE=.\src\common\encconv.cpp +# End Source File +# Begin Source File + SOURCE=.\src\common\event.cpp # End Source File # Begin Source File @@ -141,6 +145,10 @@ SOURCE=.\src\common\filesys.cpp # End Source File # Begin Source File +SOURCE=.\src\common\fontmap.cpp +# End Source File +# Begin Source File + SOURCE=.\src\common\fs_inet.cpp # End Source File # Begin Source File diff --git a/wxBase.spec b/wxBase.spec index 898787cc03..2e22008618 100644 --- a/wxBase.spec +++ b/wxBase.spec @@ -1,6 +1,6 @@ # Note that this is NOT a relocatable package %define pref /usr -%define ver 2.1.14 +%define ver 2.1.16 %define rel 0 Summary: wxBase library - non-GUI support classes of wxWindows toolkit diff --git a/wxGTK.spec b/wxGTK.spec index c84a1b6120..bc8734c2ae 100644 --- a/wxGTK.spec +++ b/wxGTK.spec @@ -1,6 +1,6 @@ # Note that this is NOT a relocatable package %define pref /usr -%define ver 2.1.14 +%define ver 2.2.1 %define rel 0 Summary: The GTK+ 1.2 port of the wxWindows library @@ -10,9 +10,8 @@ Release: %{rel} Copyright: wxWindows Licence Group: X11/Libraries Source: wxGTK-%{ver}.tgz -URL: http://wesley.informatik.uni-freiburg.de/~wxxt/docs.html -Packager: Robert Roebling <roebling@ruf.uni-freiburg.de> -BuildRoot: /tmp/wxgtk_root +URL: http://wxwindows.org +Packager: Robert Roebling <robert@roebling.de> # all packages providing an implementation of wxWindows library (regardless of # the toolkit used) should provide the (virtual) wxwin package, this makes it @@ -53,11 +52,7 @@ fi $MAKE %install -rm -rf $RPM_BUILD_ROOT -make prefix=$RPM_BUILD_ROOT%{pref} install - -%clean -rm -rf $RPM_BUILD_ROOT +make install %post /sbin/ldconfig @@ -71,6 +66,7 @@ rm -rf $RPM_BUILD_ROOT %dir %{pref}/share/wx %{pref}/share/wx/* %attr(755, -, -) %{pref}/lib/libwx_gtk.* +%attr(755, -, -) %{pref}/lib/libwx_gtk-2.2.* %files devel %defattr (644, root, root, 755) diff --git a/wxMotif.spec b/wxMotif.spec index 9e9e874dcd..4f6d8c4e5d 100644 --- a/wxMotif.spec +++ b/wxMotif.spec @@ -1,17 +1,20 @@ +# RPM .spec file for wxMotif. Based on the .spec file for wxGTK +# (c) by Robert Roebling. Modifications (c) 2000/03 by Robert Fendt. + # Note that this is NOT a relocatable package %define pref /usr -%define ver 2.1.14 +%define ver 2.1.16 %define rel 0 -Summary: The Motif port of the wxWindows library +Summary: The Motif/Lesstif port of the wxWindows library Name: wxMotif Version: %{ver} Release: %{rel} Copyright: wxWindows Licence Group: X11/Libraries -Source: ftp://wesley.informatik.uni-freiburg.de/pub/linux/wxxt/source/wxMotif-2.1.0-b8.tgz -URL: http://wesley.informatik.uni-freiburg.de/~wxxt/docs.html -Packager: Robert Roebling <roebling@ruf.uni-freiburg.de> +Source: wxMotif-%{ver}.tgz +URL: http://www.wxwindows.org +Packager: Robert Fendt <rfendt@myokay.net> BuildRoot: /tmp/wxmotif_root # all packages providing an implementation of wxWindows library (regardless of @@ -24,12 +27,33 @@ wxWindows is a free C++ library for cross-platform GUI development. With wxWindows, you can create applications for different GUIs (GTK+, Motif/LessTif, MS Windows, Mac) from the same source code. +%package devel +Summary: The Motif/Lesstif port of the wxWindows library +Group: X11/Libraries +Requires: wxMotif + +%description devel +Header files for wxMotif, the Motif/Lesstif port of the wxWindows library. + +%package gl +Summary: The Motif/Lesstif port of the wxWindows library, OpenGl add-on. +Group: X11/Libraries +Requires: wxMotif + +%description gl +OpenGl add-on library for wxMotif, the Motif/Lesstif port of the wxWindows library. + %prep %setup -n wxMotif -./configure --prefix=%{pref} --disable-threads --disable-std_iostreams +./configure --prefix=%{pref} --enable-burnt_name --with-odbc --with-opengl --with-motif %build -make +if [ "$SMP" != "" ]; then + export MAKE="make -j$SMP" +else + export MAKE="make" +fi +$MAKE %install rm -rf $RPM_BUILD_ROOT @@ -47,12 +71,19 @@ rm -rf $RPM_BUILD_ROOT %files %defattr (644, root, root, 755) %doc COPYING.LIB INSTALL.txt LICENCE.txt README.txt SYMBOLS.txt TODO.txt +%dir %{pref}/share/wx +%{pref}/share/wx/* +%attr(755, -, -) %{pref}/lib/libwx_motif.* +%attr(755, -, -) %{pref}/lib/libwx_motif-2.1.* + +%files devel +%defattr (644, root, root, 755) %dir %{pref}/include/wx %{pref}/include/wx/* %dir %{pref}/lib/wx %{pref}/lib/wx/* -%dir %{pref}/share/wx -%{pref}/share/wx/* -%attr(755, -, -) %{pref}/lib/libwx_motif* +%attr(755, -, -) %{pref}/bin/wxmotif-config %attr(755, -, -) %{pref}/bin/wx-config +%files gl +%attr(755, -, -) %{pref}/lib/libwx_motif_gl* diff --git a/wxPython/.cvsignore b/wxPython/.cvsignore new file mode 100644 index 0000000000..75e75a190a --- /dev/null +++ b/wxPython/.cvsignore @@ -0,0 +1,2 @@ +.emacs.desktop +build.local diff --git a/utils/wxPython/BUILD.txt b/wxPython/BUILD.txt similarity index 67% rename from utils/wxPython/BUILD.txt rename to wxPython/BUILD.txt index df6a119675..36366ccfeb 100644 --- a/utils/wxPython/BUILD.txt +++ b/wxPython/BUILD.txt @@ -20,15 +20,17 @@ wxPython by setting the TARGETDIR variable for the build utility, (see below.) + 1. Build and install wxWindows as described in its BuildCVS.txt or INSTALL.txt file. -1a. Building wxWindows on Unix/Linux. +1a. Building wxWindows on Unix/Linux/Etc. For *nix systems I run configure with these flags: --with-gtk --with-libjpeg + --with-opengl --without-odbc --enable-unicode=no --enable-threads=yes @@ -36,12 +38,20 @@ below.) --enable-static=no --enable-shared=yes --disable-std_iostreams + --enable-newgrid + + You can use whatever flags you want, but these work for me. If you + want debug libraries, then you should add the "--enable-debug + --enable-mem_tracing" flags. I reccommend creating an empty build + directory, and then running make and configure from there. This + makes it easy to experiment with different configure options + without losing old builds. - You can use whatever flags you want, but these work for me. Be - sure to run "make install" to install the wxWindows headers and + Be sure to run "make install" to install the wxWindows headers and shared library. You can check where the wxPython build will expect to find them by running "wx-config --cflags" and "wx-config --libs" + 1b. Building wxWindows on Win32. For Win32 systems I use Visual C++ 6.0, but 5.0 should work. The @@ -50,15 +60,20 @@ below.) include/wx/msw/setup.h and edit it for the options you want. At a minimum you should set the following: - wxUSE_NEW_GRID 0 + wxUSE_NEW_GRID 1 wxUSE_GLOBAL_MEMORY_OPERATORS 0 wxUSE_LIBTIFF 1 + wxUSE_GLCANVAS 1 I also change these: wxUSE_DIALUP_MANAGER 0 - wxUSE_SOCKETS 0 - wxUSE_FS_INET 0 + wxUSE_DYNLIB_CLASS 0 + wxUSE_DOC_VIEW_ARCHITECTURE 0 + wxUSE_MDI_ARCHITECTURE 0 + wxUSE_PLOT 0 + wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 + There are probably other flags that can be disabled to remove things not being used in wxPython, but I havn't investigated all @@ -81,36 +96,38 @@ below.) 3. If you are working from a copy of the code retrieved from CVS, then - you will find wxPython in $WXWIN/utils/wxPython. If you are - working from the tar.gz or .zip files then you will probably want - to unpack wxPython in the $WXWIN/utils directory and rename the new - directory to wxPython (or use a symlink.) If you want to keep it - in a separate directory then you can change where the build.py tool - expects to find it by creating a file named build.local (see step 7 - for more examples about build.local,) containing something like - this: + you will find wxPython in $WXWIN/wxPython. If you are working from + the tar.gz or .zip files then you will probably want to unpack + wxPython in the $WXWIN directory and rename the new directory to + wxPython (or use a symlink.) If you want to keep it in a separate + directory then you can change where the build.py tool expects to + find it by creating a file named build.local (see step 7 for more + examples about build.local,) containing something like this: - WXPSRCDIR = "~/MyStuff/wxPython-2.1.11/src" + WXPSRCDIR = "~/MyStuff/wxPython-2.1.15/src" -4. At this point you may want to make an alias or symlink, script, +4. At this point you may want to make an alias, symlink, script, batch file, or whatever on the PATH that invokes - $WXWIN/utils/wxPython/distrib/build.py to help simplify matters - somewhat. For example, on my win32 system I have a file named - build.bat in a directory on the PATH that contains: + $WXWIN/wxPython/distrib/build.py to help simplify matters somewhat. + For example, on my win32 system I have a file named build.bat in a + directory on the PATH that contains: - python %WXWIN%/utils/wxPython/distrib/build.py %1 %2 %3 %4 %5 %6 + python %WXWIN%/wxPython/distrib/build.py %1 %2 %3 %4 %5 %6 5. Change into the $(WXWIN)/utils/wxPython/src directory. -6. If you don't use SWIG, or have a new enough version installed, you - may have to update the timestamps of the files it generates so the - make utility won't think they are out of date and try to run SWIG - to update them. The standard touch utility can do this for you: +6. If you don't use SWIG, or don't have a new enough version + installed, you may have to update the timestamps of the files it + generates so the make utility won't think they are out of date and + try to run SWIG to update them. The standard touch utility can do + this for you: - touch gtk/*.cpp gtk/*.py + touch gtk/*.cpp gtk/*.py + or + touch msw\*.cpp msw\*.py 7. Type "build -b" to build wxPython and "build -i" to install it. @@ -118,7 +135,7 @@ below.) The build.py script actually generates a Makefile based on what it finds on your system and information found in the build.cfg file. If you have troubles building or you want it built or installed in - a different way, take a look at the docstring in build.py. You may + a different way, take a look at the doc-string in build.py. You may be able to override configuration options in a file named build.local. For example, you can set a new TARGETDIR (the installation directory) just by creating a file named build.local @@ -132,8 +149,8 @@ below.) 8. To build and install the add-on modules, change to the appropriate - directory under $WXWIN/utils/wxPython/modules and run the build - utility again. + directory under $WXWIN/wxPython/contrib and run the build utility + again. 9. Change to the $WXWIN/utils/wxPython/demo directory. @@ -146,3 +163,4 @@ below.) To run it without requiring a console on win32, you can use the pythonw.exe version of Python either from the command line or from a shortcut. + diff --git a/utils/wxPython/CHANGES.txt b/wxPython/CHANGES.txt similarity index 86% rename from utils/wxPython/CHANGES.txt rename to wxPython/CHANGES.txt index c249a26efe..83608f35c0 100644 --- a/utils/wxPython/CHANGES.txt +++ b/wxPython/CHANGES.txt @@ -2,7 +2,63 @@ CHANGES.txt for wxPython ---------------------------------------------------------------------- -New in 2.1.14 +New in 2.2.0 +------------ + +Added wxLog and friends. + +Added wxFrame.ShowFullScreen for MSW. + +Added PyShellWindow to the wxPython.lib package. + + + +New in 2.1.16 +------------- + +Added an attribute named labelDelta to the generic buttons that +specifies how far to offset the label when the button is in the +depressed state. + +Added wxTipProvider and friends. See the demo for an example. + +wxGrid can now change the cell highlight colour. + +Added wxDragImage. + +Fixed printing on wxGTK. + +Added wxDateTime, wxTimeSpan, and wxDateSpan to wxPython.utils. + +Added wxCalendarCtrl. + +WARNING: A while back I asked what should be done about the Magic +Method Names. (Methods that are automatically turned into event +handlers by virtue of their name.) The consensus was that it is more +confusing to have them than to try and expand them to have greater +coverage. I am finally getting around to removing the code that +generates the event binding. This means that if you are using any of +the following method names without a EVT_* call that you need to +modify your code to add the EVT_* to hook the event to the method. + + OnChar + OnSize + OnEraseBackground + OnSysColourChanged + OnInitDialog + OnPaint + OnIdle + OnActivate + OnMenuHighlight + OnCloseWindow + OnScroll + +Added wxSpinCtrl. + + + + +New in 2.1.15 ------------- Fixed wxTreeCtrl.HitTest to return both the tree item as well as the @@ -16,6 +72,43 @@ Fixed some problems in OGL. Also wxShape.SetClientData and Added wxListCtrl.SortItems and changed the demo to show how to use it. +Plugged a memory leak. + +Wrapped the new wxGrid and friends. The old wxGrid class is no longer +available. There are some incompatibilities, and unfortunately the +new classes are not documented yet, (however the methods are more +consistent with each other now so you may be able to guess pretty +good...) + +Updated filebrowsebutton.py and calendar.py with changes from their +authors. There is now a FileBrowseButtonWithHistory class (what a +mouthful!) and wxCalendar has printing support. + +Added ActiveXWrapper to the library, and some good demos of it too. +It works great for embedding a COM (a.k.a OCX, a.k.a ActiveX) control +in a window and calling its methods. It actually creates a new class +on the fly that derives from wxWindow, the COM CoClass and others +needed to make it all work. The resulting class can be instantiated +just like wxWindow, used in sizers, etc. It also responds to all COM +method calls, properties, etc., and if the class or a mix-in has +matching method names, then the COM events will be propogated back to +them. + +Created a typemap that allows a string to be used for parameters +expecting a wxColour type. The string is either a colour name as +defined in the wxColourDatabase, or a colour spec of the form +"#RRGGBB". See the wxStyledTextCtrl demo for an example. + +I almost forgot to mention the wxStyledTextCtrl! Yes, the +wxStyledTextCtrl is finally in wxPython!! (And the crowd goes +wild...) There's no documentaTion yet (the crowd boos and hisses...) +but I've included a very readable source file in the +wxPython/demo/data directory, a couple fairly good examples, and you +can also refer to the Scintilla documentaion at +http://www.scintilla.org/ScintillaDoc.html to help fill in the gaps +until the docs are done. (The croud murmers contentedly as the tool +provider smiles convincingly and removes his flame-proof suit.) + diff --git a/utils/wxPython/README.txt b/wxPython/README.txt similarity index 74% rename from utils/wxPython/README.txt rename to wxPython/README.txt index 6222375387..0f9c572cdb 100644 --- a/utils/wxPython/README.txt +++ b/wxPython/README.txt @@ -26,6 +26,20 @@ Service Pack 4+, or the HTML Workshop at http://msdn.microsoft.com/workshop/author/htmlhelp/download.asp. +For some features, the latest common controls library from microsoft +is required. You can get this by installing IE 5.0 or Office 2000. +You can also get it independently from here: + +http://download.microsoft.com/download/platformsdk/Comctl32/5.80.2614.3600/W9XNT4/EN-US/50comupd.exe + +Windows 95 users may also need the WinSock 2.0 and OpenGL libraries. +These can be found at these sites: + + +http://www.microsoft.com/windows95/downloads/contents/wuadmintools/s_wunetworkingtools/w95sockets2/default.asp + +http://www.opengl.org/Downloads/Downloads.html + Getting Help @@ -37,11 +51,11 @@ various sources of help, but probably the best source is the wxPython-users mail list. You can view the archive or subscribe by going to - http://starship.python.net/mailman/listinfo/wxpython-users + http://wxwindows.org/mailman/listinfo/wxpython-users Or you can send mail directly to the list using this address: - wxpython-users@starship.python.net + wxpython-users@wxwindows.org Other Info diff --git a/utils/wxPython/buildall b/wxPython/buildall similarity index 89% rename from utils/wxPython/buildall rename to wxPython/buildall index 26870e3f48..8dc24f4aa3 100755 --- a/utils/wxPython/buildall +++ b/wxPython/buildall @@ -5,7 +5,7 @@ if [ "$?" != "0" ]; then exit 1 fi -cd ../modules +cd ../contrib python buildall.py $* cd .. diff --git a/utils/wxPython/buildall.bat b/wxPython/buildall.bat similarity index 89% rename from utils/wxPython/buildall.bat rename to wxPython/buildall.bat index 0747662fa4..353b28901b 100755 --- a/utils/wxPython/buildall.bat +++ b/wxPython/buildall.bat @@ -2,7 +2,7 @@ cd src python ..\distrib\build.py %1 %2 %3 %4 %5 %6 %7 %8 %9 -cd ..\modules +cd ..\contrib python .\buildall.py %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/utils/wxPython/modules/.cvsignore b/wxPython/contrib/.cvsignore similarity index 100% rename from utils/wxPython/modules/.cvsignore rename to wxPython/contrib/.cvsignore diff --git a/wxPython/contrib/README b/wxPython/contrib/README new file mode 100644 index 0000000000..53c6b62a39 --- /dev/null +++ b/wxPython/contrib/README @@ -0,0 +1,3 @@ +These sub directories contain add-on modules that are not part of the +core wxPython, either because of licensing issues, optional code in +wxWindows, contrib code in wxWindows, or whatever. diff --git a/utils/wxPython/modules/buildall.py b/wxPython/contrib/buildall.py similarity index 90% rename from utils/wxPython/modules/buildall.py rename to wxPython/contrib/buildall.py index 79ef843b1f..561f3bbac1 100755 --- a/utils/wxPython/modules/buildall.py +++ b/wxPython/contrib/buildall.py @@ -16,8 +16,8 @@ import sys, os sys.path.insert(0, '../distrib') import build -MODULELIST = ['html', 'glcanvas', 'utils', 'ogl', ] #'lseditor'] - +MODULELIST = ['glcanvas', 'ogl', 'stc', ] +sys.argv[0] = '../../distrib/build.py' for module in MODULELIST: diff --git a/utils/wxPython/modules/glcanvas/.cvsignore b/wxPython/contrib/glcanvas/.cvsignore similarity index 100% rename from utils/wxPython/modules/glcanvas/.cvsignore rename to wxPython/contrib/glcanvas/.cvsignore diff --git a/wxPython/contrib/glcanvas/build.cfg b/wxPython/contrib/glcanvas/build.cfg new file mode 100644 index 0000000000..650d8f5735 --- /dev/null +++ b/wxPython/contrib/glcanvas/build.cfg @@ -0,0 +1,25 @@ +# -*- python -*- +import sys + +MODULE = 'glcanvasc' +SWIGFILES = ['glcanvas.i', ] + + +if sys.platform == 'win32': +# SOURCES = ['_glcanvas.cpp'] +# OTHERLIBS = 'glu32.lib opengl32.lib' +# OTHERCFLAGS = '-DwxUSE_GLCANVAS=1' +# OTHERRULES = ''' +#_glcanvas.cpp : $(WXDIR)\src\msw\glcanvas.cpp +# copy $(WXDIR)\src\msw\glcanvas.cpp _glcanvas.cpp +#''' + pass + +else: + + #print "Warning: Assuming MesaGL libraries. Override OTHERLIBS in build.local\n"\ + # " if you have native GL!" + #OTHERLIBS = "-lwx_gtk_gl -lMesaGL -lMesaGLU" + OTHERLIBS = "-lwx_gtk_gl -lGL -lGLU" + + diff --git a/utils/wxPython/modules/glcanvas/glcanvas.i b/wxPython/contrib/glcanvas/glcanvas.i similarity index 97% rename from utils/wxPython/modules/glcanvas/glcanvas.i rename to wxPython/contrib/glcanvas/glcanvas.i index c1c3c0665d..b4d789ab94 100644 --- a/utils/wxPython/modules/glcanvas/glcanvas.i +++ b/wxPython/contrib/glcanvas/glcanvas.i @@ -85,7 +85,7 @@ public: int *attribList = 0, const wxPalette& palette = wxNullPalette); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" void SetCurrent(); void SetColour(const char *colour); diff --git a/utils/wxPython/modules/glcanvas/glcanvasc.def b/wxPython/contrib/glcanvas/glcanvasc.def similarity index 100% rename from utils/wxPython/modules/glcanvas/glcanvasc.def rename to wxPython/contrib/glcanvas/glcanvasc.def diff --git a/utils/wxPython/modules/glcanvas/gtk/.cvsignore b/wxPython/contrib/glcanvas/gtk/.cvsignore similarity index 100% rename from utils/wxPython/modules/glcanvas/gtk/.cvsignore rename to wxPython/contrib/glcanvas/gtk/.cvsignore diff --git a/utils/wxPython/modules/glcanvas/gtk/glcanvas.cpp b/wxPython/contrib/glcanvas/gtk/glcanvas.cpp similarity index 97% rename from utils/wxPython/modules/glcanvas/gtk/glcanvas.cpp rename to wxPython/contrib/glcanvas/gtk/glcanvas.cpp index 0d9364428d..6ef7517dd6 100644 --- a/utils/wxPython/modules/glcanvas/gtk/glcanvas.cpp +++ b/wxPython/contrib/glcanvas/gtk/glcanvas.cpp @@ -685,6 +685,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, { "_wxBMPHandler","_class_wxBMPHandler",0}, { "_wxImage","_class_wxImage",0}, + { "_wxFlexGridSizer","_class_wxFlexGridSizer",0}, { "_wxPrintQuality","_wxCoord",0}, { "_wxPrintQuality","_int",0}, { "_wxPrintQuality","_signed_int",0}, @@ -709,9 +710,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0}, { "_wxCursor","_class_wxCursor",0}, { "_wxNotifyEvent","_class_wxNotifyEvent",0}, + { "_wxPyTreeCtrl","_class_wxPyTreeCtrl",0}, { "_wxImageHandler","_class_wxImageHandler",0}, { "_class_wxToolBarBase","_wxToolBarBase",0}, - { "_class_wxTreeCtrl","_wxTreeCtrl",0}, { "_wxMask","_class_wxMask",0}, { "_wxToolTip","_class_wxToolTip",0}, { "_wxPNGHandler","_class_wxPNGHandler",0}, @@ -720,6 +721,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPrinter","_class_wxPrinter",0}, { "_wxPen","_class_wxPen",0}, { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, + { "_class_wxNotebookSizer","_wxNotebookSizer",0}, { "_byte","_unsigned_char",0}, { "_wxDataObject","_class_wxDataObject",0}, { "_class_wxPyFontEnumerator","_wxPyFontEnumerator",0}, @@ -740,6 +742,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxSizer","_wxSizer",0}, { "_class_wxTIFFHandler","_wxTIFFHandler",0}, { "_class_wxPrintDialogData","_wxPrintDialogData",0}, + { "_wxGridSizer","_class_wxGridSizer",0}, { "_wxGLContext","_class_wxGLContext",0}, { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, { "_class_wxClipboard","_wxClipboard",0}, @@ -753,6 +756,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxProgressDialog","_class_wxProgressDialog",0}, { "_class_wxBMPHandler","_wxBMPHandler",0}, { "_wxPrintPreview","_class_wxPrintPreview",0}, + { "_class_wxFlexGridSizer","_wxFlexGridSizer",0}, { "_wxSpinEvent","_class_wxSpinEvent",0}, { "_wxSashLayoutWindow","_class_wxSashLayoutWindow",0}, { "_size_t","_wxCoord",0}, @@ -777,6 +781,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPanel","_class_wxPanel",0}, { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, { "_wxCheckBox","_class_wxCheckBox",0}, + { "_class_wxPyTreeCtrl","_wxPyTreeCtrl",0}, { "_wxPyEvent","_class_wxPyEvent",0}, { "_wxTextCtrl","_class_wxTextCtrl",0}, { "_class_wxMask","_wxMask",0}, @@ -811,6 +816,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_uint","_unsigned_int",0}, { "_uint","_int",0}, { "_uint","_wxWindowID",0}, + { "_wxChar","_char",0}, { "_wxPyValidator","_class_wxPyValidator",0}, { "_class_wxEvent","_wxEvent",0}, { "_wxCheckListBox","_class_wxCheckListBox",0}, @@ -826,11 +832,12 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxFontData","_wxFontData",0}, { "_class_wxPNMHandler","_wxPNMHandler",0}, { "_wxBoxSizer","_class_wxBoxSizer",0}, + { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, - { "_char","_wxDash",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, - { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxWindowDC","_class_wxWindowDC",0}, + { "_wxTimerEvent","_class_wxTimerEvent",0}, + { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxScrollBar","_class_wxScrollBar",0}, { "_wxSpinButton","_class_wxSpinButton",0}, { "_wxColourDialog","_class_wxColourDialog",0}, @@ -873,6 +880,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxRect","_wxRect",0}, { "_class_wxDC","_wxDC",0}, { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, + { "_wxGenericDragImage","_class_wxGenericDragImage",0}, { "_class_wxProgressDialog","_wxProgressDialog",0}, { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, { "_wxPyApp","_class_wxPyApp",0}, @@ -880,9 +888,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxMDIParentFrame","_class_wxMDIParentFrame",0}, { "_class_wxTreeEvent","_wxTreeEvent",0}, { "_class_wxDirDialog","_wxDirDialog",0}, - { "_class_wxPyTimer","_wxPyTimer",0}, { "_wxFocusEvent","_class_wxFocusEvent",0}, { "_wxMaximizeEvent","_class_wxMaximizeEvent",0}, + { "_class_wxTimerEvent","_wxTimerEvent",0}, + { "_class_wxPyTimer","_wxPyTimer",0}, { "_class_wxSpinButton","_wxSpinButton",0}, { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, { "_class_wxPanel","_class_wxGLCanvas",SwigwxGLCanvasTowxPanel}, @@ -898,6 +907,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_int","_wxWindowID",0}, { "_signed_int","_int",0}, { "_class_wxTextCtrl","_wxTextCtrl",0}, + { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, @@ -914,6 +924,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCaret","_wxCaret",0}, { "_class_wxMDIClientWindow","_wxMDIClientWindow",0}, { "_class_wxBrush","_wxBrush",0}, + { "_wxTipProvider","_class_wxTipProvider",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, { "_class_wxWindow","_class_wxGLCanvas",SwigwxGLCanvasTowxWindow}, @@ -933,6 +944,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0}, { "_wxClientDC","_class_wxClientDC",0}, { "_wxMouseEvent","_class_wxMouseEvent",0}, + { "_class_wxGenericDragImage","_wxGenericDragImage",0}, { "_wxListCtrl","_class_wxListCtrl",0}, { "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0}, { "_wxGLCanvas","_class_wxGLCanvas",0}, @@ -989,8 +1001,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0}, { "_class_wxImageList","_wxImageList",0}, { "_class_wxBitmapButton","_wxBitmapButton",0}, + { "_wxPyTipProvider","_class_wxPyTipProvider",0}, { "_wxFrame","_class_wxFrame",0}, { "_wxPCXHandler","_class_wxPCXHandler",0}, + { "_class_wxGridSizer","_wxGridSizer",0}, { "_class_wxGLContext","_wxGLContext",0}, { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, { "_class_wxNotebook","_wxNotebook",0}, @@ -1037,7 +1051,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxValidator","_class_wxValidator",0}, { "_wxToolBarBase","_class_wxToolBarBase",0}, { "_class_wxTreeItemId","_wxTreeItemId",0}, - { "_wxTreeCtrl","_class_wxTreeCtrl",0}, { "_class_wxLayoutConstraints","_wxLayoutConstraints",0}, { "_wxIconizeEvent","_class_wxIconizeEvent",0}, { "_class_wxControl","_wxControl",0}, @@ -1059,6 +1072,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxEraseEvent","_class_wxEraseEvent",0}, { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, { "_class_wxJoystickEvent","_wxJoystickEvent",0}, + { "_class_wxTipProvider","_wxTipProvider",0}, { "_class_wxMiniFrame","_wxMiniFrame",0}, { "_wxFontDialog","_class_wxFontDialog",0}, { "_wxRegion","_class_wxRegion",0}, @@ -1066,6 +1080,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPreviewFrame","_class_wxPreviewFrame",0}, { "_wxSizer","_class_wxSizer",0}, { "_class_wxShowEvent","_wxShowEvent",0}, + { "_class_wxPyTipProvider","_wxPyTipProvider",0}, { "_class_wxPCXHandler","_wxPCXHandler",0}, { "_wxTIFFHandler","_class_wxTIFFHandler",0}, { "_wxPyDropTarget","_class_wxPyDropTarget",0}, @@ -1093,10 +1108,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxScrollBar","_wxScrollBar",0}, { "_class_wxColourDialog","_wxColourDialog",0}, { "_class_wxPrintData","_wxPrintData",0}, - { "_wxDash","_char",0}, { "_class_wxScrolledWindow","_class_wxGLCanvas",SwigwxGLCanvasTowxScrolledWindow}, { "_class_wxScrolledWindow","_wxGLCanvas",SwigwxGLCanvasTowxScrolledWindow}, { "_class_wxScrolledWindow","_wxScrolledWindow",0}, + { "_wxListItemAttr","_class_wxListItemAttr",0}, { "_class_wxTextEntryDialog","_wxTextEntryDialog",0}, { "_wxKeyEvent","_class_wxKeyEvent",0}, { "_wxMoveEvent","_class_wxMoveEvent",0}, @@ -1105,6 +1120,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPalette","_wxPalette",0}, { "_wxFileDataObject","_class_wxFileDataObject",0}, { "_class_wxQueryLayoutInfoEvent","_wxQueryLayoutInfoEvent",0}, + { "_wxNotebookSizer","_class_wxNotebookSizer",0}, { "_class_wxEraseEvent","_wxEraseEvent",0}, { "_wxPyFontEnumerator","_class_wxPyFontEnumerator",0}, { "_wxMDIClientWindow","_class_wxMDIClientWindow",0}, diff --git a/utils/wxPython/modules/glcanvas/gtk/glcanvas.py b/wxPython/contrib/glcanvas/gtk/glcanvas.py similarity index 98% rename from utils/wxPython/modules/glcanvas/gtk/glcanvas.py rename to wxPython/contrib/glcanvas/gtk/glcanvas.py index 1857262df2..10bbaa5c70 100644 --- a/utils/wxPython/modules/glcanvas/gtk/glcanvas.py +++ b/wxPython/contrib/glcanvas/gtk/glcanvas.py @@ -102,7 +102,7 @@ class wxGLCanvas(wxGLCanvasPtr): def __init__(self,*_args,**_kwargs): self.this = apply(glcanvasc.new_wxGLCanvas,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) diff --git a/utils/wxPython/modules/glcanvas/msw/.cvsignore b/wxPython/contrib/glcanvas/msw/.cvsignore similarity index 100% rename from utils/wxPython/modules/glcanvas/msw/.cvsignore rename to wxPython/contrib/glcanvas/msw/.cvsignore diff --git a/utils/wxPython/modules/glcanvas/msw/glcanvas.cpp b/wxPython/contrib/glcanvas/msw/glcanvas.cpp similarity index 97% rename from utils/wxPython/modules/glcanvas/msw/glcanvas.cpp rename to wxPython/contrib/glcanvas/msw/glcanvas.cpp index 16307d6174..ded3a3bb19 100644 --- a/utils/wxPython/modules/glcanvas/msw/glcanvas.cpp +++ b/wxPython/contrib/glcanvas/msw/glcanvas.cpp @@ -555,6 +555,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, { "_wxBMPHandler","_class_wxBMPHandler",0}, { "_wxImage","_class_wxImage",0}, + { "_wxFlexGridSizer","_class_wxFlexGridSizer",0}, { "_wxPrintQuality","_wxCoord",0}, { "_wxPrintQuality","_int",0}, { "_wxPrintQuality","_signed_int",0}, @@ -579,9 +580,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0}, { "_wxCursor","_class_wxCursor",0}, { "_wxNotifyEvent","_class_wxNotifyEvent",0}, + { "_wxPyTreeCtrl","_class_wxPyTreeCtrl",0}, { "_wxImageHandler","_class_wxImageHandler",0}, { "_class_wxToolBarBase","_wxToolBarBase",0}, - { "_class_wxTreeCtrl","_wxTreeCtrl",0}, { "_wxMask","_class_wxMask",0}, { "_wxToolTip","_class_wxToolTip",0}, { "_wxPNGHandler","_class_wxPNGHandler",0}, @@ -590,6 +591,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPrinter","_class_wxPrinter",0}, { "_wxPen","_class_wxPen",0}, { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, + { "_class_wxNotebookSizer","_wxNotebookSizer",0}, { "_byte","_unsigned_char",0}, { "_wxDataObject","_class_wxDataObject",0}, { "_class_wxPyFontEnumerator","_wxPyFontEnumerator",0}, @@ -600,7 +602,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxSlider","_class_wxSlider",0}, { "_wxNotebookEvent","_class_wxNotebookEvent",0}, { "_wxPyPrintout","_class_wxPyPrintout",0}, - { "_long","_wxDash",0}, { "_long","_unsigned_long",0}, { "_long","_signed_long",0}, { "_wxImageList","_class_wxImageList",0}, @@ -611,6 +612,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxSizer","_wxSizer",0}, { "_class_wxTIFFHandler","_wxTIFFHandler",0}, { "_class_wxPrintDialogData","_wxPrintDialogData",0}, + { "_wxGridSizer","_class_wxGridSizer",0}, { "_wxGLContext","_class_wxGLContext",0}, { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, { "_class_wxClipboard","_wxClipboard",0}, @@ -624,6 +626,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxProgressDialog","_class_wxProgressDialog",0}, { "_class_wxBMPHandler","_wxBMPHandler",0}, { "_wxPrintPreview","_class_wxPrintPreview",0}, + { "_class_wxFlexGridSizer","_wxFlexGridSizer",0}, { "_wxSpinEvent","_class_wxSpinEvent",0}, { "_wxSashLayoutWindow","_class_wxSashLayoutWindow",0}, { "_size_t","_wxCoord",0}, @@ -648,6 +651,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPanel","_class_wxPanel",0}, { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, { "_wxCheckBox","_class_wxCheckBox",0}, + { "_class_wxPyTreeCtrl","_wxPyTreeCtrl",0}, { "_wxPyEvent","_class_wxPyEvent",0}, { "_wxTextCtrl","_class_wxTextCtrl",0}, { "_class_wxMask","_wxMask",0}, @@ -682,6 +686,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_uint","_unsigned_int",0}, { "_uint","_int",0}, { "_uint","_wxWindowID",0}, + { "_wxChar","_char",0}, { "_wxPyValidator","_class_wxPyValidator",0}, { "_class_wxEvent","_wxEvent",0}, { "_wxCheckListBox","_class_wxCheckListBox",0}, @@ -697,11 +702,13 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxFontData","_wxFontData",0}, { "_class_wxPNMHandler","_wxPNMHandler",0}, { "_wxBoxSizer","_class_wxBoxSizer",0}, + { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, { "_wxTaskBarIcon","_class_wxTaskBarIcon",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, - { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxWindowDC","_class_wxWindowDC",0}, + { "_wxTimerEvent","_class_wxTimerEvent",0}, + { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxScrollBar","_class_wxScrollBar",0}, { "_wxSpinButton","_class_wxSpinButton",0}, { "_wxColourDialog","_class_wxColourDialog",0}, @@ -740,11 +747,11 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxCloseEvent","_class_wxCloseEvent",0}, { "_class_wxSplitterEvent","_wxSplitterEvent",0}, { "_wxNotebook","_class_wxNotebook",0}, - { "_unsigned_long","_wxDash",0}, { "_unsigned_long","_long",0}, { "_class_wxRect","_wxRect",0}, { "_class_wxDC","_wxDC",0}, { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, + { "_wxGenericDragImage","_class_wxGenericDragImage",0}, { "_class_wxProgressDialog","_wxProgressDialog",0}, { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, { "_wxPyApp","_class_wxPyApp",0}, @@ -752,9 +759,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxMDIParentFrame","_class_wxMDIParentFrame",0}, { "_class_wxTreeEvent","_wxTreeEvent",0}, { "_class_wxDirDialog","_wxDirDialog",0}, - { "_class_wxPyTimer","_wxPyTimer",0}, { "_wxFocusEvent","_class_wxFocusEvent",0}, { "_wxMaximizeEvent","_class_wxMaximizeEvent",0}, + { "_class_wxTimerEvent","_wxTimerEvent",0}, + { "_class_wxPyTimer","_wxPyTimer",0}, { "_class_wxSpinButton","_wxSpinButton",0}, { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, { "_class_wxPanel","_class_wxGLCanvas",SwigwxGLCanvasTowxPanel}, @@ -770,6 +778,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_int","_wxWindowID",0}, { "_signed_int","_int",0}, { "_class_wxTextCtrl","_wxTextCtrl",0}, + { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, { "_wxMetaFileDC","_class_wxMetaFileDC",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, @@ -787,6 +796,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCaret","_wxCaret",0}, { "_class_wxMDIClientWindow","_wxMDIClientWindow",0}, { "_class_wxBrush","_wxBrush",0}, + { "_wxTipProvider","_class_wxTipProvider",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, { "_class_wxWindow","_class_wxGLCanvas",SwigwxGLCanvasTowxWindow}, @@ -806,6 +816,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0}, { "_wxClientDC","_class_wxClientDC",0}, { "_wxMouseEvent","_class_wxMouseEvent",0}, + { "_class_wxGenericDragImage","_wxGenericDragImage",0}, { "_wxListCtrl","_class_wxListCtrl",0}, { "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0}, { "_wxGLCanvas","_class_wxGLCanvas",0}, @@ -863,8 +874,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0}, { "_class_wxImageList","_wxImageList",0}, { "_class_wxBitmapButton","_wxBitmapButton",0}, + { "_wxPyTipProvider","_class_wxPyTipProvider",0}, { "_wxFrame","_class_wxFrame",0}, { "_wxPCXHandler","_class_wxPCXHandler",0}, + { "_class_wxGridSizer","_wxGridSizer",0}, { "_class_wxGLContext","_wxGLContext",0}, { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, { "_class_wxNotebook","_wxNotebook",0}, @@ -912,7 +925,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxValidator","_class_wxValidator",0}, { "_wxToolBarBase","_class_wxToolBarBase",0}, { "_class_wxTreeItemId","_wxTreeItemId",0}, - { "_wxTreeCtrl","_class_wxTreeCtrl",0}, { "_class_wxLayoutConstraints","_wxLayoutConstraints",0}, { "_wxIconizeEvent","_class_wxIconizeEvent",0}, { "_class_wxControl","_wxControl",0}, @@ -934,6 +946,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxEraseEvent","_class_wxEraseEvent",0}, { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, { "_class_wxJoystickEvent","_wxJoystickEvent",0}, + { "_class_wxTipProvider","_wxTipProvider",0}, { "_class_wxMiniFrame","_wxMiniFrame",0}, { "_wxFontDialog","_class_wxFontDialog",0}, { "_wxRegion","_class_wxRegion",0}, @@ -941,6 +954,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPreviewFrame","_class_wxPreviewFrame",0}, { "_wxSizer","_class_wxSizer",0}, { "_class_wxShowEvent","_wxShowEvent",0}, + { "_class_wxPyTipProvider","_wxPyTipProvider",0}, { "_class_wxPCXHandler","_wxPCXHandler",0}, { "_wxTIFFHandler","_class_wxTIFFHandler",0}, { "_wxPyDropTarget","_class_wxPyDropTarget",0}, @@ -968,11 +982,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxScrollBar","_wxScrollBar",0}, { "_class_wxColourDialog","_wxColourDialog",0}, { "_class_wxPrintData","_wxPrintData",0}, - { "_wxDash","_unsigned_long",0}, - { "_wxDash","_long",0}, { "_class_wxScrolledWindow","_class_wxGLCanvas",SwigwxGLCanvasTowxScrolledWindow}, { "_class_wxScrolledWindow","_wxGLCanvas",SwigwxGLCanvasTowxScrolledWindow}, { "_class_wxScrolledWindow","_wxScrolledWindow",0}, + { "_wxListItemAttr","_class_wxListItemAttr",0}, { "_class_wxTextEntryDialog","_wxTextEntryDialog",0}, { "_wxKeyEvent","_class_wxKeyEvent",0}, { "_wxMoveEvent","_class_wxMoveEvent",0}, @@ -981,6 +994,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPalette","_wxPalette",0}, { "_wxFileDataObject","_class_wxFileDataObject",0}, { "_class_wxQueryLayoutInfoEvent","_wxQueryLayoutInfoEvent",0}, + { "_wxNotebookSizer","_class_wxNotebookSizer",0}, { "_class_wxEraseEvent","_wxEraseEvent",0}, { "_wxPyFontEnumerator","_class_wxPyFontEnumerator",0}, { "_wxMDIClientWindow","_class_wxMDIClientWindow",0}, diff --git a/utils/wxPython/modules/glcanvas/msw/glcanvas.py b/wxPython/contrib/glcanvas/msw/glcanvas.py similarity index 98% rename from utils/wxPython/modules/glcanvas/msw/glcanvas.py rename to wxPython/contrib/glcanvas/msw/glcanvas.py index 49cf2b0415..11d46f9612 100644 --- a/utils/wxPython/modules/glcanvas/msw/glcanvas.py +++ b/wxPython/contrib/glcanvas/msw/glcanvas.py @@ -88,7 +88,7 @@ class wxGLCanvas(wxGLCanvasPtr): def __init__(self,*_args,**_kwargs): self.this = apply(glcanvasc.new_wxGLCanvas,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) diff --git a/utils/wxPython/modules/ogl/.cvsignore b/wxPython/contrib/ogl/.cvsignore similarity index 100% rename from utils/wxPython/modules/ogl/.cvsignore rename to wxPython/contrib/ogl/.cvsignore diff --git a/wxPython/contrib/ogl/README.txt b/wxPython/contrib/ogl/README.txt new file mode 100644 index 0000000000..7f97e87d0f --- /dev/null +++ b/wxPython/contrib/ogl/README.txt @@ -0,0 +1,7 @@ +Since OGL is not always bundled with distributions of wxWindows, in +order for it to be a standard part of wxPython I need to bundle it +here. The contents of the contrib directory are copies of the +relevant parts of the main contrib directory in wxWindows. The +build.py script in this directory will also build the needed files +from there, so you no longer have to worry about aquiring and building +additional libraries beyond wxWindows itself. diff --git a/utils/wxPython/modules/ogl/_extras.py b/wxPython/contrib/ogl/_extras.py similarity index 100% rename from utils/wxPython/modules/ogl/_extras.py rename to wxPython/contrib/ogl/_extras.py diff --git a/utils/wxPython/modules/ogl/_ogldefs.i b/wxPython/contrib/ogl/_ogldefs.i similarity index 100% rename from utils/wxPython/modules/ogl/_ogldefs.i rename to wxPython/contrib/ogl/_ogldefs.i diff --git a/wxPython/contrib/ogl/build.cfg b/wxPython/contrib/ogl/build.cfg new file mode 100644 index 0000000000..16b05ded66 --- /dev/null +++ b/wxPython/contrib/ogl/build.cfg @@ -0,0 +1,52 @@ +# -*- python -*- +import sys + +MODULE = 'oglc' +SWIGFILES = ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i', 'oglcanvas.i'] +SOURCES = ['oglhelpers.cpp'] + + +OTHERCFLAGS = '-I$(STCLOC)/contrib/include' +SOURCES = SOURCES + [ + '$(STCLOC)/contrib/src/ogl/basic.cpp', + '$(STCLOC)/contrib/src/ogl/bmpshape.cpp', + '$(STCLOC)/contrib/src/ogl/composit.cpp', + '$(STCLOC)/contrib/src/ogl/divided.cpp', + '$(STCLOC)/contrib/src/ogl/lines.cpp', + '$(STCLOC)/contrib/src/ogl/misc.cpp', + '$(STCLOC)/contrib/src/ogl/basic2.cpp', + '$(STCLOC)/contrib/src/ogl/canvas.cpp', + '$(STCLOC)/contrib/src/ogl/constrnt.cpp', + '$(STCLOC)/contrib/src/ogl/drawn.cpp', + '$(STCLOC)/contrib/src/ogl/mfutils.cpp', + '$(STCLOC)/contrib/src/ogl/ogldiag.cpp', + ] + +if sys.platform == 'win32': + OTHERDEFS = 'STCLOC = $(WXWIN)' + OTHERRULES = ''' +{$(WXWIN)/contrib/src/ogl}.cpp{}.obj: + $(cc) @<< +$(CPPFLAGS) /c /Tp $< +<< +''' +else: + OTHERCFLAGS = '-Icontrib/include' + DEFAULTRULE = 'default: contrib $(GENCODEDIR) $(TARGET) $(BUILDDIR)/$(TARGET) bldpycfiles' + OTHERRULES = """ +%.o : contrib/src/ogl/%.cpp + $(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $< + +contrib : + ln -s $(WXWIN)/contrib contrib + +""" + + +SWIGDEPS = '_ogldefs.i' +OTHERDEPS = 'oglhelpers.h $(WXPSRCDIR)/helpers.h' + + +# There are no platform differences so we don't need separate code directories +GENCODEDIR='.' +SWIGTOOLKITFLAG='' diff --git a/utils/wxPython/modules/ogl/ogl.cpp b/wxPython/contrib/ogl/ogl.cpp similarity index 97% rename from utils/wxPython/modules/ogl/ogl.cpp rename to wxPython/contrib/ogl/ogl.cpp index 3751d4ab16..2553a84e2f 100644 --- a/utils/wxPython/modules/ogl/ogl.cpp +++ b/wxPython/contrib/ogl/ogl.cpp @@ -175,6 +175,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, { "_wxBMPHandler","_class_wxBMPHandler",0}, { "_wxImage","_class_wxImage",0}, + { "_wxFlexGridSizer","_class_wxFlexGridSizer",0}, { "_wxPrintQuality","_wxCoord",0}, { "_wxPrintQuality","_int",0}, { "_wxPrintQuality","_signed_int",0}, @@ -213,6 +214,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxArrowHead","_wxArrowHead",0}, { "_wxPen","_class_wxPen",0}, { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, + { "_class_wxNotebookSizer","_wxNotebookSizer",0}, { "_byte","_unsigned_char",0}, { "_wxDataObject","_class_wxDataObject",0}, { "_class_wxPyFontEnumerator","_wxPyFontEnumerator",0}, @@ -234,6 +236,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxSizer","_wxSizer",0}, { "_class_wxTIFFHandler","_wxTIFFHandler",0}, { "_class_wxPrintDialogData","_wxPrintDialogData",0}, + { "_wxGridSizer","_class_wxGridSizer",0}, { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, { "_class_wxClipboard","_wxClipboard",0}, { "_class_wxGauge","_wxGauge",0}, @@ -246,6 +249,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxProgressDialog","_class_wxProgressDialog",0}, { "_class_wxBMPHandler","_wxBMPHandler",0}, { "_wxPrintPreview","_class_wxPrintPreview",0}, + { "_class_wxFlexGridSizer","_wxFlexGridSizer",0}, { "_wxSpinEvent","_class_wxSpinEvent",0}, { "_wxSashLayoutWindow","_class_wxSashLayoutWindow",0}, { "_wxPyBitmapShape","_class_wxPyBitmapShape",0}, @@ -326,7 +330,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPNMHandler","_wxPNMHandler",0}, { "_wxBoxSizer","_class_wxBoxSizer",0}, { "_wxBitmap","_class_wxBitmap",0}, - { "_char","_wxDash",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, { "_wxPyControlPoint","_class_wxPyControlPoint",0}, { "_wxPyTimer","_class_wxPyTimer",0}, @@ -378,6 +381,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, { "_wxPyCircleShape","_class_wxPyCircleShape",0}, { "_class_wxPyShapeCanvas","_wxPyShapeCanvas",0}, + { "_wxGenericDragImage","_class_wxGenericDragImage",0}, { "_class_wxProgressDialog","_wxProgressDialog",0}, { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, { "_wxPyApp","_class_wxPyApp",0}, @@ -403,6 +407,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_int","_wxWindowID",0}, { "_signed_int","_int",0}, { "_class_wxTextCtrl","_wxTextCtrl",0}, + { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, @@ -420,6 +425,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCaret","_wxCaret",0}, { "_class_wxMDIClientWindow","_wxMDIClientWindow",0}, { "_class_wxBrush","_wxBrush",0}, + { "_wxTipProvider","_class_wxTipProvider",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, { "_class_wxWindow","_wxWindow",0}, @@ -438,6 +444,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyCircleShape","_wxPyCircleShape",0}, { "_wxClientDC","_class_wxClientDC",0}, { "_wxMouseEvent","_class_wxMouseEvent",0}, + { "_class_wxGenericDragImage","_wxGenericDragImage",0}, { "_wxListCtrl","_class_wxListCtrl",0}, { "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0}, { "_wxPyDividedShape","_class_wxPyDividedShape",0}, @@ -495,8 +502,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0}, { "_class_wxImageList","_wxImageList",0}, { "_class_wxBitmapButton","_wxBitmapButton",0}, + { "_wxPyTipProvider","_class_wxPyTipProvider",0}, { "_wxFrame","_class_wxFrame",0}, { "_wxPCXHandler","_class_wxPCXHandler",0}, + { "_class_wxGridSizer","_wxGridSizer",0}, { "_wxPyDivisionShape","_class_wxPyDivisionShape",0}, { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, { "_class_wxNotebook","_wxNotebook",0}, @@ -568,6 +577,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxEraseEvent","_class_wxEraseEvent",0}, { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, { "_class_wxJoystickEvent","_wxJoystickEvent",0}, + { "_class_wxTipProvider","_wxTipProvider",0}, { "_class_wxMiniFrame","_wxMiniFrame",0}, { "_wxFontDialog","_class_wxFontDialog",0}, { "_wxRegion","_class_wxRegion",0}, @@ -575,6 +585,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPreviewFrame","_class_wxPreviewFrame",0}, { "_wxSizer","_class_wxSizer",0}, { "_class_wxShowEvent","_wxShowEvent",0}, + { "_class_wxPyTipProvider","_wxPyTipProvider",0}, { "_class_wxPCXHandler","_wxPCXHandler",0}, { "_wxTIFFHandler","_class_wxTIFFHandler",0}, { "_wxDiagram","_class_wxDiagram",0}, @@ -603,9 +614,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxScrollBar","_wxScrollBar",0}, { "_class_wxColourDialog","_wxColourDialog",0}, { "_class_wxPrintData","_wxPrintData",0}, - { "_wxDash","_char",0}, { "_wxPyRectangleShape","_class_wxPyRectangleShape",0}, { "_class_wxScrolledWindow","_wxScrolledWindow",0}, + { "_wxListItemAttr","_class_wxListItemAttr",0}, { "_class_wxTextEntryDialog","_wxTextEntryDialog",0}, { "_wxKeyEvent","_class_wxKeyEvent",0}, { "_wxMoveEvent","_class_wxMoveEvent",0}, @@ -615,6 +626,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPalette","_wxPalette",0}, { "_wxFileDataObject","_class_wxFileDataObject",0}, { "_class_wxQueryLayoutInfoEvent","_wxQueryLayoutInfoEvent",0}, + { "_wxNotebookSizer","_class_wxNotebookSizer",0}, { "_class_wxEraseEvent","_wxEraseEvent",0}, { "_wxPyFontEnumerator","_class_wxPyFontEnumerator",0}, { "_wxMDIClientWindow","_class_wxMDIClientWindow",0}, diff --git a/utils/wxPython/modules/ogl/ogl.i b/wxPython/contrib/ogl/ogl.i similarity index 100% rename from utils/wxPython/modules/ogl/ogl.i rename to wxPython/contrib/ogl/ogl.i diff --git a/utils/wxPython/modules/ogl/ogl.py b/wxPython/contrib/ogl/ogl.py similarity index 100% rename from utils/wxPython/modules/ogl/ogl.py rename to wxPython/contrib/ogl/ogl.py diff --git a/utils/wxPython/modules/ogl/oglbasic.cpp b/wxPython/contrib/ogl/oglbasic.cpp similarity index 98% rename from utils/wxPython/modules/ogl/oglbasic.cpp rename to wxPython/contrib/ogl/oglbasic.cpp index b5e499fd0e..d01617cb0d 100644 --- a/utils/wxPython/modules/ogl/oglbasic.cpp +++ b/wxPython/contrib/ogl/oglbasic.cpp @@ -1,5 +1,5 @@ /* - * FILE : oglbasic.cpp + * FILE : ./oglbasic.cpp * * This file was automatically generated by : * Simplified Wrapper and Interface Generator (SWIG) @@ -507,14 +507,20 @@ static PyObject *_wrap_wxShapeRegion_GetMinSize(PyObject *self, PyObject *args, PyObject * _resultobj; wxShapeRegion * _arg0; double * _arg1; + double temp; double * _arg2; + double temp0; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - char *_kwnames[] = { "self","x","y", NULL }; + char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxShapeRegion_GetMinSize",_kwnames,&_argo0,&_argo1,&_argo2)) +{ + _arg1 = &temp; +} +{ + _arg2 = &temp0; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxShapeRegion_GetMinSize",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -523,20 +529,6 @@ static PyObject *_wrap_wxShapeRegion_GetMinSize(PyObject *self, PyObject *args, return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_double_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxShapeRegion_GetMinSize. Expected _double_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_double_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxShapeRegion_GetMinSize. Expected _double_p."); - return NULL; - } - } { wxPy_BEGIN_ALLOW_THREADS; wxShapeRegion_GetMinSize(_arg0,_arg1,_arg2); @@ -544,6 +536,16 @@ static PyObject *_wrap_wxShapeRegion_GetMinSize(PyObject *self, PyObject *args, wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); _resultobj = Py_None; +{ + PyObject *o; + o = PyFloat_FromDouble((double) (*_arg1)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyFloat_FromDouble((double) (*_arg2)); + _resultobj = t_output_helper(_resultobj, o); +} return _resultobj; } @@ -552,14 +554,20 @@ static PyObject *_wrap_wxShapeRegion_GetProportion(PyObject *self, PyObject *arg PyObject * _resultobj; wxShapeRegion * _arg0; double * _arg1; + double temp; double * _arg2; + double temp0; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - char *_kwnames[] = { "self","x","y", NULL }; + char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxShapeRegion_GetProportion",_kwnames,&_argo0,&_argo1,&_argo2)) +{ + _arg1 = &temp; +} +{ + _arg2 = &temp0; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxShapeRegion_GetProportion",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -568,20 +576,6 @@ static PyObject *_wrap_wxShapeRegion_GetProportion(PyObject *self, PyObject *arg return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_double_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxShapeRegion_GetProportion. Expected _double_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_double_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxShapeRegion_GetProportion. Expected _double_p."); - return NULL; - } - } { wxPy_BEGIN_ALLOW_THREADS; wxShapeRegion_GetProportion(_arg0,_arg1,_arg2); @@ -589,6 +583,16 @@ static PyObject *_wrap_wxShapeRegion_GetProportion(PyObject *self, PyObject *arg wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); _resultobj = Py_None; +{ + PyObject *o; + o = PyFloat_FromDouble((double) (*_arg1)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyFloat_FromDouble((double) (*_arg2)); + _resultobj = t_output_helper(_resultobj, o); +} return _resultobj; } @@ -597,14 +601,20 @@ static PyObject *_wrap_wxShapeRegion_GetSize(PyObject *self, PyObject *args, PyO PyObject * _resultobj; wxShapeRegion * _arg0; double * _arg1; + double temp; double * _arg2; + double temp0; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - char *_kwnames[] = { "self","x","y", NULL }; + char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxShapeRegion_GetSize",_kwnames,&_argo0,&_argo1,&_argo2)) +{ + _arg1 = &temp; +} +{ + _arg2 = &temp0; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxShapeRegion_GetSize",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -613,20 +623,6 @@ static PyObject *_wrap_wxShapeRegion_GetSize(PyObject *self, PyObject *args, PyO return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_double_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxShapeRegion_GetSize. Expected _double_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_double_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxShapeRegion_GetSize. Expected _double_p."); - return NULL; - } - } { wxPy_BEGIN_ALLOW_THREADS; wxShapeRegion_GetSize(_arg0,_arg1,_arg2); @@ -634,6 +630,16 @@ static PyObject *_wrap_wxShapeRegion_GetSize(PyObject *self, PyObject *args, PyO wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); _resultobj = Py_None; +{ + PyObject *o; + o = PyFloat_FromDouble((double) (*_arg1)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyFloat_FromDouble((double) (*_arg2)); + _resultobj = t_output_helper(_resultobj, o); +} return _resultobj; } @@ -642,14 +648,20 @@ static PyObject *_wrap_wxShapeRegion_GetPosition(PyObject *self, PyObject *args, PyObject * _resultobj; wxShapeRegion * _arg0; double * _arg1; + double temp; double * _arg2; + double temp0; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; - PyObject * _argo2 = 0; - char *_kwnames[] = { "self","xp","yp", NULL }; + char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxShapeRegion_GetPosition",_kwnames,&_argo0,&_argo1,&_argo2)) +{ + _arg1 = &temp; +} +{ + _arg2 = &temp0; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxShapeRegion_GetPosition",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -658,20 +670,6 @@ static PyObject *_wrap_wxShapeRegion_GetPosition(PyObject *self, PyObject *args, return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_double_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxShapeRegion_GetPosition. Expected _double_p."); - return NULL; - } - } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_double_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxShapeRegion_GetPosition. Expected _double_p."); - return NULL; - } - } { wxPy_BEGIN_ALLOW_THREADS; wxShapeRegion_GetPosition(_arg0,_arg1,_arg2); @@ -679,6 +677,16 @@ static PyObject *_wrap_wxShapeRegion_GetPosition(PyObject *self, PyObject *args, wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); _resultobj = Py_None; +{ + PyObject *o; + o = PyFloat_FromDouble((double) (*_arg1)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyFloat_FromDouble((double) (*_arg2)); + _resultobj = t_output_helper(_resultobj, o); +} return _resultobj; } @@ -1127,17 +1135,19 @@ static PyObject *_wrap_new_wxPyShapeEvtHandler(PyObject *self, PyObject *args, P return _resultobj; } -#define wxPyShapeEvtHandler__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyShapeEvtHandler__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyShapeEvtHandler__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyShapeEvtHandler * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyShapeEvtHandler__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyShapeEvtHandler__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1149,9 +1159,12 @@ static PyObject *_wrap_wxPyShapeEvtHandler__setSelf(PyObject *self, PyObject *ar { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyShapeEvtHandler__setSelf(_arg0,_arg1); + wxPyShapeEvtHandler__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -2382,17 +2395,19 @@ static void *SwigwxPyShapeTowxPyShapeEvtHandler(void *ptr) { return (void *) dest; } -#define wxPyShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2404,9 +2419,12 @@ static PyObject *_wrap_wxPyShape__setSelf(PyObject *self, PyObject *args, PyObje { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyShape__setSelf(_arg0,_arg1); + wxPyShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -5611,14 +5629,17 @@ static PyObject *_wrap_wxPyShape_FindRegion(PyObject *self, PyObject *args, PyOb wxPyShape * _arg0; wxString * _arg1; int * _arg2; + int temp; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - PyObject * _argo2 = 0; - char *_kwnames[] = { "self","regionName","regionId", NULL }; + char *_kwnames[] = { "self","regionName", NULL }; char _ptemp[128]; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyShape_FindRegion",_kwnames,&_argo0,&_obj1,&_argo2)) +{ + _arg2 = &temp; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyShape_FindRegion",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5634,13 +5655,6 @@ static PyObject *_wrap_wxPyShape_FindRegion(PyObject *self, PyObject *args, PyOb } _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_int_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxPyShape_FindRegion. Expected _int_p."); - return NULL; - } - } { wxPy_BEGIN_ALLOW_THREADS; _result = (wxPyShape *)wxPyShape_FindRegion(_arg0,*_arg1,_arg2); @@ -5653,6 +5667,11 @@ static PyObject *_wrap_wxPyShape_FindRegion(PyObject *self, PyObject *args, PyOb Py_INCREF(Py_None); _resultobj = Py_None; } +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg2)); + _resultobj = t_output_helper(_resultobj, o); +} { if (_obj1) delete _arg1; @@ -8232,6 +8251,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, { "_wxBMPHandler","_class_wxBMPHandler",0}, { "_wxImage","_class_wxImage",0}, + { "_wxFlexGridSizer","_class_wxFlexGridSizer",0}, { "_wxPrintQuality","_wxCoord",0}, { "_wxPrintQuality","_int",0}, { "_wxPrintQuality","_signed_int",0}, @@ -8265,6 +8285,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPrinter","_class_wxPrinter",0}, { "_wxPen","_class_wxPen",0}, { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, + { "_class_wxNotebookSizer","_wxNotebookSizer",0}, { "_byte","_unsigned_char",0}, { "_wxDataObject","_class_wxDataObject",0}, { "_class_wxPyFontEnumerator","_wxPyFontEnumerator",0}, @@ -8286,6 +8307,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxSizer","_wxSizer",0}, { "_class_wxTIFFHandler","_wxTIFFHandler",0}, { "_class_wxPrintDialogData","_wxPrintDialogData",0}, + { "_wxGridSizer","_class_wxGridSizer",0}, { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, { "_class_wxClipboard","_wxClipboard",0}, { "_class_wxGauge","_wxGauge",0}, @@ -8298,6 +8320,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxProgressDialog","_class_wxProgressDialog",0}, { "_class_wxBMPHandler","_wxBMPHandler",0}, { "_wxPrintPreview","_class_wxPrintPreview",0}, + { "_class_wxFlexGridSizer","_wxFlexGridSizer",0}, { "_wxSpinEvent","_class_wxSpinEvent",0}, { "_wxSashLayoutWindow","_class_wxSashLayoutWindow",0}, { "_size_t","_wxCoord",0}, @@ -8373,7 +8396,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPNMHandler","_wxPNMHandler",0}, { "_wxBoxSizer","_class_wxBoxSizer",0}, { "_wxBitmap","_class_wxBitmap",0}, - { "_char","_wxDash",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxWindowDC","_class_wxWindowDC",0}, @@ -8420,6 +8442,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxRect","_wxRect",0}, { "_class_wxDC","_wxDC",0}, { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, + { "_wxGenericDragImage","_class_wxGenericDragImage",0}, { "_class_wxProgressDialog","_wxProgressDialog",0}, { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, { "_wxPyApp","_class_wxPyApp",0}, @@ -8443,6 +8466,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_int","_wxWindowID",0}, { "_signed_int","_int",0}, { "_class_wxTextCtrl","_wxTextCtrl",0}, + { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, @@ -8459,6 +8483,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCaret","_wxCaret",0}, { "_class_wxMDIClientWindow","_wxMDIClientWindow",0}, { "_class_wxBrush","_wxBrush",0}, + { "_wxTipProvider","_class_wxTipProvider",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, { "_class_wxWindow","_wxWindow",0}, @@ -8476,6 +8501,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0}, { "_wxClientDC","_class_wxClientDC",0}, { "_wxMouseEvent","_class_wxMouseEvent",0}, + { "_class_wxGenericDragImage","_wxGenericDragImage",0}, { "_wxListCtrl","_class_wxListCtrl",0}, { "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0}, { "_class_wxPoint","_wxPoint",0}, @@ -8530,8 +8556,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0}, { "_class_wxImageList","_wxImageList",0}, { "_class_wxBitmapButton","_wxBitmapButton",0}, + { "_wxPyTipProvider","_class_wxPyTipProvider",0}, { "_wxFrame","_class_wxFrame",0}, { "_wxPCXHandler","_class_wxPCXHandler",0}, + { "_class_wxGridSizer","_wxGridSizer",0}, { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, { "_class_wxNotebook","_wxNotebook",0}, { "_wxJPEGHandler","_class_wxJPEGHandler",0}, @@ -8600,6 +8628,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxEraseEvent","_class_wxEraseEvent",0}, { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, { "_class_wxJoystickEvent","_wxJoystickEvent",0}, + { "_class_wxTipProvider","_wxTipProvider",0}, { "_class_wxMiniFrame","_wxMiniFrame",0}, { "_wxFontDialog","_class_wxFontDialog",0}, { "_wxRegion","_class_wxRegion",0}, @@ -8607,6 +8636,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPreviewFrame","_class_wxPreviewFrame",0}, { "_wxSizer","_class_wxSizer",0}, { "_class_wxShowEvent","_wxShowEvent",0}, + { "_class_wxPyTipProvider","_wxPyTipProvider",0}, { "_class_wxPCXHandler","_wxPCXHandler",0}, { "_wxTIFFHandler","_class_wxTIFFHandler",0}, { "_wxPyDropTarget","_class_wxPyDropTarget",0}, @@ -8634,8 +8664,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxScrollBar","_wxScrollBar",0}, { "_class_wxColourDialog","_wxColourDialog",0}, { "_class_wxPrintData","_wxPrintData",0}, - { "_wxDash","_char",0}, { "_class_wxScrolledWindow","_wxScrolledWindow",0}, + { "_wxListItemAttr","_class_wxListItemAttr",0}, { "_class_wxTextEntryDialog","_wxTextEntryDialog",0}, { "_wxKeyEvent","_class_wxKeyEvent",0}, { "_wxMoveEvent","_class_wxMoveEvent",0}, @@ -8644,6 +8674,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPalette","_wxPalette",0}, { "_wxFileDataObject","_class_wxFileDataObject",0}, { "_class_wxQueryLayoutInfoEvent","_wxQueryLayoutInfoEvent",0}, + { "_wxNotebookSizer","_class_wxNotebookSizer",0}, { "_class_wxEraseEvent","_wxEraseEvent",0}, { "_wxPyFontEnumerator","_class_wxPyFontEnumerator",0}, { "_wxMDIClientWindow","_class_wxMDIClientWindow",0}, diff --git a/utils/wxPython/modules/ogl/oglbasic.i b/wxPython/contrib/ogl/oglbasic.i similarity index 96% rename from utils/wxPython/modules/ogl/oglbasic.i rename to wxPython/contrib/ogl/oglbasic.i index 89ac277403..1df3cc74ee 100644 --- a/utils/wxPython/modules/ogl/oglbasic.i +++ b/wxPython/contrib/ogl/oglbasic.i @@ -59,10 +59,10 @@ public: wxString GetText(); wxFont *GetFont(); - void GetMinSize(double *x, double *y); - void GetProportion(double *x, double *y); - void GetSize(double *x, double *y); - void GetPosition(double *xp, double *yp); + void GetMinSize(double *OUTPUT, double *OUTPUT); + void GetProportion(double *OUTPUT, double *OUTPUT); + void GetSize(double *OUTPUT, double *OUTPUT); + void GetPosition(double *OUTPUT, double *OUTPUT); int GetFormatMode(); wxString GetName(); wxString GetColour(); @@ -92,8 +92,8 @@ public: wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL, wxPyShape *shape = NULL); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyShapeEvtHandler)" %addmethods { void Destroy() { delete self; } @@ -147,8 +147,8 @@ class wxPyShape : public wxPyShapeEvtHandler { public: // wxPyShape(wxPyShapeCanvas *can = NULL); abstract base class... - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyShape)" %addmethods { void Destroy() { delete self; } @@ -302,7 +302,7 @@ public: void AddRegion(wxShapeRegion *region); void ClearRegions(); void AssignNewIds(); - wxPyShape *FindRegion(const wxString& regionName, int *regionId); + wxPyShape *FindRegion(const wxString& regionName, int *OUTPUT); void FindRegionNames(wxStringList& list); void ClearText(int regionId = 0); void RemoveLine(wxPyLineShape *line); diff --git a/utils/wxPython/modules/ogl/oglbasic.py b/wxPython/contrib/ogl/oglbasic.py similarity index 99% rename from utils/wxPython/modules/ogl/oglbasic.py rename to wxPython/contrib/ogl/oglbasic.py index a4d59d9af9..6f61e69c83 100644 --- a/utils/wxPython/modules/ogl/oglbasic.py +++ b/wxPython/contrib/ogl/oglbasic.py @@ -258,7 +258,7 @@ class wxPyShapeEvtHandler(wxPyShapeEvtHandlerPtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglbasicc.new_wxPyShapeEvtHandler,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyShapeEvtHandler) @@ -570,7 +570,6 @@ class wxPyShapePtr(wxPyShapeEvtHandlerPtr): return val def FindRegion(self, *_args, **_kwargs): val = apply(oglbasicc.wxPyShape_FindRegion,(self,) + _args, _kwargs) - if val: val = wxPyShapePtr(val) return val def FindRegionNames(self, *_args, **_kwargs): val = apply(oglbasicc.wxPyShape_FindRegionNames,(self,) + _args, _kwargs) diff --git a/utils/wxPython/modules/ogl/oglc.def b/wxPython/contrib/ogl/oglc.def similarity index 100% rename from utils/wxPython/modules/ogl/oglc.def rename to wxPython/contrib/ogl/oglc.def diff --git a/utils/wxPython/modules/ogl/oglcanvas.cpp b/wxPython/contrib/ogl/oglcanvas.cpp similarity index 98% rename from utils/wxPython/modules/ogl/oglcanvas.cpp rename to wxPython/contrib/ogl/oglcanvas.cpp index a1f3641750..22bfb6bffd 100644 --- a/utils/wxPython/modules/ogl/oglcanvas.cpp +++ b/wxPython/contrib/ogl/oglcanvas.cpp @@ -1226,17 +1226,19 @@ static PyObject *_wrap_new_wxPyShapeCanvas(PyObject *self, PyObject *args, PyObj return _resultobj; } -#define wxPyShapeCanvas__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyShapeCanvas__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyShapeCanvas__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyShapeCanvas * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyShapeCanvas__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyShapeCanvas__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1248,9 +1250,12 @@ static PyObject *_wrap_wxPyShapeCanvas__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyShapeCanvas__setSelf(_arg0,_arg1); + wxPyShapeCanvas__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -1984,6 +1989,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, { "_wxBMPHandler","_class_wxBMPHandler",0}, { "_wxImage","_class_wxImage",0}, + { "_wxFlexGridSizer","_class_wxFlexGridSizer",0}, { "_wxPrintQuality","_wxCoord",0}, { "_wxPrintQuality","_int",0}, { "_wxPrintQuality","_signed_int",0}, @@ -2008,9 +2014,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0}, { "_wxCursor","_class_wxCursor",0}, { "_wxNotifyEvent","_class_wxNotifyEvent",0}, + { "_wxPyTreeCtrl","_class_wxPyTreeCtrl",0}, { "_wxImageHandler","_class_wxImageHandler",0}, { "_class_wxToolBarBase","_wxToolBarBase",0}, - { "_class_wxTreeCtrl","_wxTreeCtrl",0}, { "_wxMask","_class_wxMask",0}, { "_wxToolTip","_class_wxToolTip",0}, { "_wxPNGHandler","_class_wxPNGHandler",0}, @@ -2019,6 +2025,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPrinter","_class_wxPrinter",0}, { "_wxPen","_class_wxPen",0}, { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, + { "_class_wxNotebookSizer","_wxNotebookSizer",0}, { "_byte","_unsigned_char",0}, { "_wxDataObject","_class_wxDataObject",0}, { "_class_wxPyFontEnumerator","_wxPyFontEnumerator",0}, @@ -2040,6 +2047,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxSizer","_wxSizer",0}, { "_class_wxTIFFHandler","_wxTIFFHandler",0}, { "_class_wxPrintDialogData","_wxPrintDialogData",0}, + { "_wxGridSizer","_class_wxGridSizer",0}, { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, { "_class_wxClipboard","_wxClipboard",0}, { "_class_wxGauge","_wxGauge",0}, @@ -2052,6 +2060,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxProgressDialog","_class_wxProgressDialog",0}, { "_class_wxBMPHandler","_wxBMPHandler",0}, { "_wxPrintPreview","_class_wxPrintPreview",0}, + { "_class_wxFlexGridSizer","_wxFlexGridSizer",0}, { "_wxSpinEvent","_class_wxSpinEvent",0}, { "_wxSashLayoutWindow","_class_wxSashLayoutWindow",0}, { "_size_t","_wxCoord",0}, @@ -2077,6 +2086,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPanel","_class_wxPanel",0}, { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, { "_wxCheckBox","_class_wxCheckBox",0}, + { "_class_wxPyTreeCtrl","_wxPyTreeCtrl",0}, { "_wxPyEvent","_class_wxPyEvent",0}, { "_wxTextCtrl","_class_wxTextCtrl",0}, { "_class_wxMask","_wxMask",0}, @@ -2111,6 +2121,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_uint","_unsigned_int",0}, { "_uint","_int",0}, { "_uint","_wxWindowID",0}, + { "_wxChar","_char",0}, { "_wxPyValidator","_class_wxPyValidator",0}, { "_class_wxEvent","_wxEvent",0}, { "_wxCheckListBox","_class_wxCheckListBox",0}, @@ -2127,11 +2138,12 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxFontData","_wxFontData",0}, { "_class_wxPNMHandler","_wxPNMHandler",0}, { "_wxBoxSizer","_class_wxBoxSizer",0}, + { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, - { "_char","_wxDash",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, - { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxWindowDC","_class_wxWindowDC",0}, + { "_wxTimerEvent","_class_wxTimerEvent",0}, + { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxScrollBar","_class_wxScrollBar",0}, { "_wxSpinButton","_class_wxSpinButton",0}, { "_wxColourDialog","_class_wxColourDialog",0}, @@ -2176,6 +2188,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxDC","_wxDC",0}, { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, { "_class_wxPyShapeCanvas","_wxPyShapeCanvas",0}, + { "_wxGenericDragImage","_class_wxGenericDragImage",0}, { "_class_wxProgressDialog","_wxProgressDialog",0}, { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, { "_wxPyApp","_class_wxPyApp",0}, @@ -2183,9 +2196,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxMDIParentFrame","_class_wxMDIParentFrame",0}, { "_class_wxTreeEvent","_wxTreeEvent",0}, { "_class_wxDirDialog","_wxDirDialog",0}, - { "_class_wxPyTimer","_wxPyTimer",0}, { "_wxFocusEvent","_class_wxFocusEvent",0}, { "_wxMaximizeEvent","_class_wxMaximizeEvent",0}, + { "_class_wxTimerEvent","_wxTimerEvent",0}, + { "_class_wxPyTimer","_wxPyTimer",0}, { "_class_wxSpinButton","_wxSpinButton",0}, { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, { "_class_wxPanel","_class_wxPyShapeCanvas",SwigwxPyShapeCanvasTowxPanel}, @@ -2201,6 +2215,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_int","_wxWindowID",0}, { "_signed_int","_int",0}, { "_class_wxTextCtrl","_wxTextCtrl",0}, + { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, @@ -2217,6 +2232,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCaret","_wxCaret",0}, { "_class_wxMDIClientWindow","_wxMDIClientWindow",0}, { "_class_wxBrush","_wxBrush",0}, + { "_wxTipProvider","_class_wxTipProvider",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, { "_class_wxWindow","_class_wxPyShapeCanvas",SwigwxPyShapeCanvasTowxWindow}, @@ -2236,6 +2252,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0}, { "_wxClientDC","_class_wxClientDC",0}, { "_wxMouseEvent","_class_wxMouseEvent",0}, + { "_class_wxGenericDragImage","_wxGenericDragImage",0}, { "_wxListCtrl","_class_wxListCtrl",0}, { "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0}, { "_class_wxPoint","_wxPoint",0}, @@ -2292,8 +2309,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0}, { "_class_wxImageList","_wxImageList",0}, { "_class_wxBitmapButton","_wxBitmapButton",0}, + { "_wxPyTipProvider","_class_wxPyTipProvider",0}, { "_wxFrame","_class_wxFrame",0}, { "_wxPCXHandler","_class_wxPCXHandler",0}, + { "_class_wxGridSizer","_wxGridSizer",0}, { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, { "_class_wxNotebook","_wxNotebook",0}, { "_wxJPEGHandler","_class_wxJPEGHandler",0}, @@ -2340,7 +2359,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxValidator","_class_wxValidator",0}, { "_wxToolBarBase","_class_wxToolBarBase",0}, { "_class_wxTreeItemId","_wxTreeItemId",0}, - { "_wxTreeCtrl","_class_wxTreeCtrl",0}, { "_class_wxLayoutConstraints","_wxLayoutConstraints",0}, { "_wxIconizeEvent","_class_wxIconizeEvent",0}, { "_class_wxControl","_wxControl",0}, @@ -2362,6 +2380,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxEraseEvent","_class_wxEraseEvent",0}, { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, { "_class_wxJoystickEvent","_wxJoystickEvent",0}, + { "_class_wxTipProvider","_wxTipProvider",0}, { "_class_wxMiniFrame","_wxMiniFrame",0}, { "_wxFontDialog","_class_wxFontDialog",0}, { "_wxRegion","_class_wxRegion",0}, @@ -2369,6 +2388,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPreviewFrame","_class_wxPreviewFrame",0}, { "_wxSizer","_class_wxSizer",0}, { "_class_wxShowEvent","_wxShowEvent",0}, + { "_class_wxPyTipProvider","_wxPyTipProvider",0}, { "_class_wxPCXHandler","_wxPCXHandler",0}, { "_wxTIFFHandler","_class_wxTIFFHandler",0}, { "_wxDiagram","_class_wxDiagram",0}, @@ -2397,10 +2417,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxScrollBar","_wxScrollBar",0}, { "_class_wxColourDialog","_wxColourDialog",0}, { "_class_wxPrintData","_wxPrintData",0}, - { "_wxDash","_char",0}, { "_class_wxScrolledWindow","_class_wxPyShapeCanvas",SwigwxPyShapeCanvasTowxScrolledWindow}, { "_class_wxScrolledWindow","_wxPyShapeCanvas",SwigwxPyShapeCanvasTowxScrolledWindow}, { "_class_wxScrolledWindow","_wxScrolledWindow",0}, + { "_wxListItemAttr","_class_wxListItemAttr",0}, { "_class_wxTextEntryDialog","_wxTextEntryDialog",0}, { "_wxKeyEvent","_class_wxKeyEvent",0}, { "_wxMoveEvent","_class_wxMoveEvent",0}, @@ -2409,6 +2429,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPalette","_wxPalette",0}, { "_wxFileDataObject","_class_wxFileDataObject",0}, { "_class_wxQueryLayoutInfoEvent","_wxQueryLayoutInfoEvent",0}, + { "_wxNotebookSizer","_class_wxNotebookSizer",0}, { "_class_wxEraseEvent","_wxEraseEvent",0}, { "_wxPyFontEnumerator","_class_wxPyFontEnumerator",0}, { "_wxMDIClientWindow","_class_wxMDIClientWindow",0}, diff --git a/utils/wxPython/modules/ogl/oglcanvas.i b/wxPython/contrib/ogl/oglcanvas.i similarity index 94% rename from utils/wxPython/modules/ogl/oglcanvas.i rename to wxPython/contrib/ogl/oglcanvas.i index a4474ff181..bf96d849c0 100644 --- a/utils/wxPython/modules/ogl/oglcanvas.i +++ b/wxPython/contrib/ogl/oglcanvas.i @@ -116,11 +116,11 @@ public: const wxSize& size = wxPyDefaultSize, long style = wxBORDER); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyShapeCanvas)" - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" - %pragma(python) addtomethod = "__init__:wx._StdOnScrollCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdOnScrollCallbacks(self)" void AddShape(wxPyShape *shape, wxPyShape *addAfter = NULL); diff --git a/utils/wxPython/modules/ogl/oglcanvas.py b/wxPython/contrib/ogl/oglcanvas.py similarity index 98% rename from utils/wxPython/modules/ogl/oglcanvas.py rename to wxPython/contrib/ogl/oglcanvas.py index cfeb03d41b..60c19d8980 100644 --- a/utils/wxPython/modules/ogl/oglcanvas.py +++ b/wxPython/contrib/ogl/oglcanvas.py @@ -209,9 +209,9 @@ class wxPyShapeCanvas(wxPyShapeCanvasPtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglcanvasc.new_wxPyShapeCanvas,_args,_kwargs) self.thisown = 1 - self._setSelf(self) - wx._StdWindowCallbacks(self) - wx._StdOnScrollCallbacks(self) + self._setSelf(self, wxPyShapeCanvas) + #wx._StdWindowCallbacks(self) + #wx._StdOnScrollCallbacks(self) diff --git a/utils/wxPython/modules/ogl/oglhelpers.cpp b/wxPython/contrib/ogl/oglhelpers.cpp similarity index 100% rename from utils/wxPython/modules/ogl/oglhelpers.cpp rename to wxPython/contrib/ogl/oglhelpers.cpp diff --git a/utils/wxPython/modules/ogl/oglhelpers.h b/wxPython/contrib/ogl/oglhelpers.h similarity index 100% rename from utils/wxPython/modules/ogl/oglhelpers.h rename to wxPython/contrib/ogl/oglhelpers.h diff --git a/utils/wxPython/modules/ogl/oglshapes.cpp b/wxPython/contrib/ogl/oglshapes.cpp similarity index 99% rename from utils/wxPython/modules/ogl/oglshapes.cpp rename to wxPython/contrib/ogl/oglshapes.cpp index ce49440d3d..87b53489a0 100644 --- a/utils/wxPython/modules/ogl/oglshapes.cpp +++ b/wxPython/contrib/ogl/oglshapes.cpp @@ -1,5 +1,5 @@ /* - * FILE : ./oglshapes.cpp + * FILE : oglshapes.cpp * * This file was automatically generated by : * Simplified Wrapper and Interface Generator (SWIG) @@ -1565,11 +1565,12 @@ static PyObject *_wrap_wxPseudoMetaFile_SetTextColour(PyObject *self, PyObject * wxPseudoMetaFile * _arg0; wxColour * _arg1; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; + wxColour temp; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","colour", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPseudoMetaFile_SetTextColour",_kwnames,&_argo0,&_argo1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPseudoMetaFile_SetTextColour",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1578,13 +1579,11 @@ static PyObject *_wrap_wxPseudoMetaFile_SetTextColour(PyObject *self, PyObject * return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPseudoMetaFile_SetTextColour. Expected _wxColour_p."); +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) return NULL; - } - } +} { wxPy_BEGIN_ALLOW_THREADS; wxPseudoMetaFile_SetTextColour(_arg0,*_arg1); @@ -1601,11 +1600,12 @@ static PyObject *_wrap_wxPseudoMetaFile_SetBackgroundColour(PyObject *self, PyOb wxPseudoMetaFile * _arg0; wxColour * _arg1; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; + wxColour temp; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","colour", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPseudoMetaFile_SetBackgroundColour",_kwnames,&_argo0,&_argo1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPseudoMetaFile_SetBackgroundColour",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1614,13 +1614,11 @@ static PyObject *_wrap_wxPseudoMetaFile_SetBackgroundColour(PyObject *self, PyOb return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPseudoMetaFile_SetBackgroundColour. Expected _wxColour_p."); +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) return NULL; - } - } +} { wxPy_BEGIN_ALLOW_THREADS; wxPseudoMetaFile_SetBackgroundColour(_arg0,*_arg1); @@ -1702,17 +1700,19 @@ static PyObject *_wrap_new_wxPyRectangleShape(PyObject *self, PyObject *args, Py return _resultobj; } -#define wxPyRectangleShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyRectangleShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyRectangleShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyRectangleShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyRectangleShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyRectangleShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1724,9 +1724,12 @@ static PyObject *_wrap_wxPyRectangleShape__setSelf(PyObject *self, PyObject *arg { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyRectangleShape__setSelf(_arg0,_arg1); + wxPyRectangleShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -2847,17 +2850,19 @@ static PyObject *_wrap_new_wxPyControlPoint(PyObject *self, PyObject *args, PyOb return _resultobj; } -#define wxPyControlPoint__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyControlPoint__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyControlPoint__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyControlPoint * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyControlPoint__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyControlPoint__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2869,9 +2874,12 @@ static PyObject *_wrap_wxPyControlPoint__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyControlPoint__setSelf(_arg0,_arg1); + wxPyControlPoint__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -3970,17 +3978,19 @@ static PyObject *_wrap_new_wxPyBitmapShape(PyObject *self, PyObject *args, PyObj return _resultobj; } -#define wxPyBitmapShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyBitmapShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyBitmapShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyBitmapShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyBitmapShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyBitmapShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -3992,9 +4002,12 @@ static PyObject *_wrap_wxPyBitmapShape__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyBitmapShape__setSelf(_arg0,_arg1); + wxPyBitmapShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -5208,17 +5221,19 @@ static PyObject *_wrap_new_wxPyDrawnShape(PyObject *self, PyObject *args, PyObje return _resultobj; } -#define wxPyDrawnShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyDrawnShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyDrawnShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyDrawnShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDrawnShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyDrawnShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5230,9 +5245,12 @@ static PyObject *_wrap_wxPyDrawnShape__setSelf(PyObject *self, PyObject *args, P { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyDrawnShape__setSelf(_arg0,_arg1); + wxPyDrawnShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -5940,11 +5958,12 @@ static PyObject *_wrap_wxPyDrawnShape_SetDrawnBackgroundColour(PyObject *self, P wxPyDrawnShape * _arg0; wxColour * _arg1; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; + wxColour temp; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","colour", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDrawnShape_SetDrawnBackgroundColour",_kwnames,&_argo0,&_argo1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDrawnShape_SetDrawnBackgroundColour",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5953,13 +5972,11 @@ static PyObject *_wrap_wxPyDrawnShape_SetDrawnBackgroundColour(PyObject *self, P return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyDrawnShape_SetDrawnBackgroundColour. Expected _wxColour_p."); +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) return NULL; - } - } +} { wxPy_BEGIN_ALLOW_THREADS; wxPyDrawnShape_SetDrawnBackgroundColour(_arg0,*_arg1); @@ -6118,11 +6135,12 @@ static PyObject *_wrap_wxPyDrawnShape_SetDrawnTextColour(PyObject *self, PyObjec wxPyDrawnShape * _arg0; wxColour * _arg1; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; + wxColour temp; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","colour", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDrawnShape_SetDrawnTextColour",_kwnames,&_argo0,&_argo1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDrawnShape_SetDrawnTextColour",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -6131,13 +6149,11 @@ static PyObject *_wrap_wxPyDrawnShape_SetDrawnTextColour(PyObject *self, PyObjec return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxPyDrawnShape_SetDrawnTextColour. Expected _wxColour_p."); +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) return NULL; - } - } +} { wxPy_BEGIN_ALLOW_THREADS; wxPyDrawnShape_SetDrawnTextColour(_arg0,*_arg1); @@ -7457,17 +7473,19 @@ static PyObject *_wrap_new_wxPyCompositeShape(PyObject *self, PyObject *args, Py return _resultobj; } -#define wxPyCompositeShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyCompositeShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyCompositeShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyCompositeShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyCompositeShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyCompositeShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -7479,9 +7497,12 @@ static PyObject *_wrap_wxPyCompositeShape__setSelf(PyObject *self, PyObject *arg { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyCompositeShape__setSelf(_arg0,_arg1); + wxPyCompositeShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -9072,17 +9093,19 @@ static PyObject *_wrap_new_wxPyDividedShape(PyObject *self, PyObject *args, PyOb return _resultobj; } -#define wxPyDividedShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyDividedShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyDividedShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyDividedShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDividedShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyDividedShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -9094,9 +9117,12 @@ static PyObject *_wrap_wxPyDividedShape__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyDividedShape__setSelf(_arg0,_arg1); + wxPyDividedShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -10229,17 +10255,19 @@ static PyObject *_wrap_new_wxPyDivisionShape(PyObject *self, PyObject *args, PyO return _resultobj; } -#define wxPyDivisionShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyDivisionShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyDivisionShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyDivisionShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDivisionShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyDivisionShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -10251,9 +10279,12 @@ static PyObject *_wrap_wxPyDivisionShape__setSelf(PyObject *self, PyObject *args { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyDivisionShape__setSelf(_arg0,_arg1); + wxPyDivisionShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -12464,6 +12495,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, { "_wxBMPHandler","_class_wxBMPHandler",0}, { "_wxImage","_class_wxImage",0}, + { "_wxFlexGridSizer","_class_wxFlexGridSizer",0}, { "_wxPrintQuality","_wxCoord",0}, { "_wxPrintQuality","_int",0}, { "_wxPrintQuality","_signed_int",0}, @@ -12515,6 +12547,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPseudoMetaFile","_class_wxPseudoMetaFile",0}, { "_wxPen","_class_wxPen",0}, { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, + { "_class_wxNotebookSizer","_wxNotebookSizer",0}, { "_byte","_unsigned_char",0}, { "_wxDataObject","_class_wxDataObject",0}, { "_class_wxPyFontEnumerator","_wxPyFontEnumerator",0}, @@ -12536,6 +12569,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxSizer","_wxSizer",0}, { "_class_wxTIFFHandler","_wxTIFFHandler",0}, { "_class_wxPrintDialogData","_wxPrintDialogData",0}, + { "_wxGridSizer","_class_wxGridSizer",0}, { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, { "_class_wxClipboard","_wxClipboard",0}, { "_class_wxGauge","_wxGauge",0}, @@ -12548,6 +12582,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxProgressDialog","_class_wxProgressDialog",0}, { "_class_wxBMPHandler","_wxBMPHandler",0}, { "_wxPrintPreview","_class_wxPrintPreview",0}, + { "_class_wxFlexGridSizer","_wxFlexGridSizer",0}, { "_wxSpinEvent","_class_wxSpinEvent",0}, { "_wxSashLayoutWindow","_class_wxSashLayoutWindow",0}, { "_wxPyBitmapShape","_class_wxPyBitmapShape",0}, @@ -12641,7 +12676,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPNMHandler","_wxPNMHandler",0}, { "_wxBoxSizer","_class_wxBoxSizer",0}, { "_wxBitmap","_class_wxBitmap",0}, - { "_char","_wxDash",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, { "_wxPyControlPoint","_class_wxPyControlPoint",0}, { "_wxPyTimer","_class_wxPyTimer",0}, @@ -12714,6 +12748,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_int","_wxWindowID",0}, { "_signed_int","_int",0}, { "_class_wxTextCtrl","_wxTextCtrl",0}, + { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, @@ -12730,6 +12765,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCaret","_wxCaret",0}, { "_class_wxMDIClientWindow","_wxMDIClientWindow",0}, { "_class_wxBrush","_wxBrush",0}, + { "_wxTipProvider","_class_wxTipProvider",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, { "_class_wxWindow","_wxWindow",0}, @@ -12817,8 +12853,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0}, { "_class_wxImageList","_wxImageList",0}, { "_class_wxBitmapButton","_wxBitmapButton",0}, + { "_wxPyTipProvider","_class_wxPyTipProvider",0}, { "_wxFrame","_class_wxFrame",0}, { "_wxPCXHandler","_class_wxPCXHandler",0}, + { "_class_wxGridSizer","_wxGridSizer",0}, { "_wxPyDivisionShape","_class_wxPyDivisionShape",0}, { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, { "_class_wxNotebook","_wxNotebook",0}, @@ -12903,6 +12941,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxEraseEvent","_class_wxEraseEvent",0}, { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, { "_class_wxJoystickEvent","_wxJoystickEvent",0}, + { "_class_wxTipProvider","_wxTipProvider",0}, { "_class_wxMiniFrame","_wxMiniFrame",0}, { "_wxFontDialog","_class_wxFontDialog",0}, { "_wxRegion","_class_wxRegion",0}, @@ -12910,6 +12949,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPreviewFrame","_class_wxPreviewFrame",0}, { "_wxSizer","_class_wxSizer",0}, { "_class_wxShowEvent","_wxShowEvent",0}, + { "_class_wxPyTipProvider","_wxPyTipProvider",0}, { "_class_wxPCXHandler","_wxPCXHandler",0}, { "_wxTIFFHandler","_class_wxTIFFHandler",0}, { "_wxPyDropTarget","_class_wxPyDropTarget",0}, @@ -12950,7 +12990,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxScrollBar","_wxScrollBar",0}, { "_class_wxColourDialog","_wxColourDialog",0}, { "_class_wxPrintData","_wxPrintData",0}, - { "_wxDash","_char",0}, { "_wxPyRectangleShape","_class_wxPyDivisionShape",SwigwxPyDivisionShapeTowxPyRectangleShape}, { "_wxPyRectangleShape","_wxPyDivisionShape",SwigwxPyDivisionShapeTowxPyRectangleShape}, { "_wxPyRectangleShape","_class_wxPyDividedShape",SwigwxPyDividedShapeTowxPyRectangleShape}, @@ -12965,6 +13004,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPyRectangleShape","_wxPyControlPoint",SwigwxPyControlPointTowxPyRectangleShape}, { "_wxPyRectangleShape","_class_wxPyRectangleShape",0}, { "_class_wxScrolledWindow","_wxScrolledWindow",0}, + { "_wxListItemAttr","_class_wxListItemAttr",0}, { "_class_wxTextEntryDialog","_wxTextEntryDialog",0}, { "_wxKeyEvent","_class_wxKeyEvent",0}, { "_wxMoveEvent","_class_wxMoveEvent",0}, @@ -12974,6 +13014,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPalette","_wxPalette",0}, { "_wxFileDataObject","_class_wxFileDataObject",0}, { "_class_wxQueryLayoutInfoEvent","_wxQueryLayoutInfoEvent",0}, + { "_wxNotebookSizer","_class_wxNotebookSizer",0}, { "_class_wxEraseEvent","_wxEraseEvent",0}, { "_wxPyFontEnumerator","_class_wxPyFontEnumerator",0}, { "_wxMDIClientWindow","_class_wxMDIClientWindow",0}, diff --git a/utils/wxPython/modules/ogl/oglshapes.i b/wxPython/contrib/ogl/oglshapes.i similarity index 96% rename from utils/wxPython/modules/ogl/oglshapes.i rename to wxPython/contrib/ogl/oglshapes.i index 6ccecfb1de..2b2f94e40f 100644 --- a/utils/wxPython/modules/ogl/oglshapes.i +++ b/wxPython/contrib/ogl/oglshapes.i @@ -108,8 +108,8 @@ class wxPyRectangleShape : public wxPyShape { public: wxPyRectangleShape(double width = 0.0, double height = 0.0); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyRectangleShape)" void SetCornerRadius(double radius); @@ -158,8 +158,8 @@ public: double size = 0.0, double the_xoffset = 0.0, double the_yoffset = 0.0, int the_type = 0); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyControlPoint)" void SetCornerRadius(double radius); @@ -205,8 +205,8 @@ class wxPyBitmapShape : public wxPyRectangleShape { public: wxPyBitmapShape(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyBitmapShape)" wxBitmap& GetBitmap(); wxString GetFilename(); @@ -254,8 +254,8 @@ class wxPyDrawnShape : public wxPyRectangleShape { public: wxPyDrawnShape(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDrawnShape)" void CalculateSize(); void DestroyClippingRect(); @@ -357,8 +357,8 @@ class wxPyCompositeShape : public wxPyRectangleShape { public: wxPyCompositeShape(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyCompositeShape)" void AddChild(wxPyShape *child, wxPyShape *addAfter = NULL); @@ -455,8 +455,8 @@ class wxPyDividedShape : public wxPyRectangleShape { public: wxPyDividedShape(double width = 0.0, double height = 0.0); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDividedShape)" void EditRegions(); void SetRegionSizes(); @@ -504,8 +504,8 @@ class wxPyDivisionShape : public wxPyCompositeShape { public: wxPyDivisionShape(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDivisionShape)" void AdjustBottom(double bottom, bool test); void AdjustLeft(double left, bool test); diff --git a/utils/wxPython/modules/ogl/oglshapes.py b/wxPython/contrib/ogl/oglshapes.py similarity index 99% rename from utils/wxPython/modules/ogl/oglshapes.py rename to wxPython/contrib/ogl/oglshapes.py index 35813bb1f7..d43293b595 100644 --- a/utils/wxPython/modules/ogl/oglshapes.py +++ b/wxPython/contrib/ogl/oglshapes.py @@ -282,7 +282,7 @@ class wxPyRectangleShape(wxPyRectangleShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapesc.new_wxPyRectangleShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyRectangleShape) @@ -390,7 +390,7 @@ class wxPyControlPoint(wxPyControlPointPtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapesc.new_wxPyControlPoint,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyControlPoint) @@ -508,7 +508,7 @@ class wxPyBitmapShape(wxPyBitmapShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapesc.new_wxPyBitmapShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyBitmapShape) @@ -698,7 +698,7 @@ class wxPyDrawnShape(wxPyDrawnShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapesc.new_wxPyDrawnShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyDrawnShape) @@ -875,7 +875,7 @@ class wxPyCompositeShape(wxPyCompositeShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapesc.new_wxPyCompositeShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyCompositeShape) @@ -986,7 +986,7 @@ class wxPyDividedShape(wxPyDividedShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapesc.new_wxPyDividedShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyDividedShape) @@ -1172,7 +1172,7 @@ class wxPyDivisionShape(wxPyDivisionShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapesc.new_wxPyDivisionShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyDivisionShape) diff --git a/utils/wxPython/modules/ogl/oglshapes2.cpp b/wxPython/contrib/ogl/oglshapes2.cpp similarity index 99% rename from utils/wxPython/modules/ogl/oglshapes2.cpp rename to wxPython/contrib/ogl/oglshapes2.cpp index bee2a9ebe0..9b24e1be61 100644 --- a/utils/wxPython/modules/ogl/oglshapes2.cpp +++ b/wxPython/contrib/ogl/oglshapes2.cpp @@ -160,17 +160,19 @@ static PyObject *_wrap_new_wxPyEllipseShape(PyObject *self, PyObject *args, PyOb return _resultobj; } -#define wxPyEllipseShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyEllipseShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyEllipseShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyEllipseShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyEllipseShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyEllipseShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -182,9 +184,12 @@ static PyObject *_wrap_wxPyEllipseShape__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyEllipseShape__setSelf(_arg0,_arg1); + wxPyEllipseShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -1229,17 +1234,19 @@ static PyObject *_wrap_new_wxPyCircleShape(PyObject *self, PyObject *args, PyObj return _resultobj; } -#define wxPyCircleShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyCircleShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyCircleShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyCircleShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyCircleShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyCircleShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1251,9 +1258,12 @@ static PyObject *_wrap_wxPyCircleShape__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyCircleShape__setSelf(_arg0,_arg1); + wxPyCircleShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -2805,17 +2815,19 @@ static PyObject *_wrap_new_wxPyLineShape(PyObject *self, PyObject *args, PyObjec return _resultobj; } -#define wxPyLineShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyLineShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyLineShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyLineShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyLineShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyLineShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2827,9 +2839,12 @@ static PyObject *_wrap_wxPyLineShape__setSelf(PyObject *self, PyObject *args, Py { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyLineShape__setSelf(_arg0,_arg1); + wxPyLineShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -5306,17 +5321,19 @@ static PyObject *_wrap_new_wxPyPolygonShape(PyObject *self, PyObject *args, PyOb return _resultobj; } -#define wxPyPolygonShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyPolygonShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyPolygonShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyPolygonShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyPolygonShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyPolygonShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5328,9 +5345,12 @@ static PyObject *_wrap_wxPyPolygonShape__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyPolygonShape__setSelf(_arg0,_arg1); + wxPyPolygonShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -6560,17 +6580,19 @@ static PyObject *_wrap_new_wxPyTextShape(PyObject *self, PyObject *args, PyObjec return _resultobj; } -#define wxPyTextShape__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyTextShape__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyTextShape__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyTextShape * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyTextShape__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyTextShape__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -6582,9 +6604,12 @@ static PyObject *_wrap_wxPyTextShape__setSelf(PyObject *self, PyObject *args, Py { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyTextShape__setSelf(_arg0,_arg1); + wxPyTextShape__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -7841,6 +7866,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, { "_wxBMPHandler","_class_wxBMPHandler",0}, { "_wxImage","_class_wxImage",0}, + { "_wxFlexGridSizer","_class_wxFlexGridSizer",0}, { "_wxPrintQuality","_wxCoord",0}, { "_wxPrintQuality","_int",0}, { "_wxPrintQuality","_signed_int",0}, @@ -7881,6 +7907,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxArrowHead","_wxArrowHead",0}, { "_wxPen","_class_wxPen",0}, { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, + { "_class_wxNotebookSizer","_wxNotebookSizer",0}, { "_byte","_unsigned_char",0}, { "_wxDataObject","_class_wxDataObject",0}, { "_class_wxPyFontEnumerator","_wxPyFontEnumerator",0}, @@ -7902,6 +7929,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxSizer","_wxSizer",0}, { "_class_wxTIFFHandler","_wxTIFFHandler",0}, { "_class_wxPrintDialogData","_wxPrintDialogData",0}, + { "_wxGridSizer","_class_wxGridSizer",0}, { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, { "_class_wxClipboard","_wxClipboard",0}, { "_class_wxGauge","_wxGauge",0}, @@ -7914,6 +7942,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxProgressDialog","_class_wxProgressDialog",0}, { "_class_wxBMPHandler","_wxBMPHandler",0}, { "_wxPrintPreview","_class_wxPrintPreview",0}, + { "_class_wxFlexGridSizer","_wxFlexGridSizer",0}, { "_wxSpinEvent","_class_wxSpinEvent",0}, { "_wxSashLayoutWindow","_class_wxSashLayoutWindow",0}, { "_wxPyBitmapShape","_class_wxPyBitmapShape",0}, @@ -8005,7 +8034,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPNMHandler","_wxPNMHandler",0}, { "_wxBoxSizer","_class_wxBoxSizer",0}, { "_wxBitmap","_class_wxBitmap",0}, - { "_char","_wxDash",0}, { "_wxPrintDialog","_class_wxPrintDialog",0}, { "_wxPyControlPoint","_class_wxPyControlPoint",0}, { "_wxPyTimer","_class_wxPyTimer",0}, @@ -8056,6 +8084,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxDC","_wxDC",0}, { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, { "_wxPyCircleShape","_class_wxPyCircleShape",0}, + { "_wxGenericDragImage","_class_wxGenericDragImage",0}, { "_class_wxProgressDialog","_wxProgressDialog",0}, { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, { "_wxPyApp","_class_wxPyApp",0}, @@ -8081,6 +8110,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_int","_wxWindowID",0}, { "_signed_int","_int",0}, { "_class_wxTextCtrl","_wxTextCtrl",0}, + { "_class_wxListItemAttr","_wxListItemAttr",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, @@ -8098,6 +8128,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCaret","_wxCaret",0}, { "_class_wxMDIClientWindow","_wxMDIClientWindow",0}, { "_class_wxBrush","_wxBrush",0}, + { "_wxTipProvider","_class_wxTipProvider",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, { "_class_wxWindow","_wxWindow",0}, @@ -8116,6 +8147,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyCircleShape","_wxPyCircleShape",0}, { "_wxClientDC","_class_wxClientDC",0}, { "_wxMouseEvent","_class_wxMouseEvent",0}, + { "_class_wxGenericDragImage","_wxGenericDragImage",0}, { "_wxListCtrl","_class_wxListCtrl",0}, { "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0}, { "_wxPyDividedShape","_class_wxPyDividedShape",0}, @@ -8183,8 +8215,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0}, { "_class_wxImageList","_wxImageList",0}, { "_class_wxBitmapButton","_wxBitmapButton",0}, + { "_wxPyTipProvider","_class_wxPyTipProvider",0}, { "_wxFrame","_class_wxFrame",0}, { "_wxPCXHandler","_class_wxPCXHandler",0}, + { "_class_wxGridSizer","_wxGridSizer",0}, { "_wxPyDivisionShape","_class_wxPyDivisionShape",0}, { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, { "_class_wxNotebook","_wxNotebook",0}, @@ -8266,6 +8300,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxEraseEvent","_class_wxEraseEvent",0}, { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, { "_class_wxJoystickEvent","_wxJoystickEvent",0}, + { "_class_wxTipProvider","_wxTipProvider",0}, { "_class_wxMiniFrame","_wxMiniFrame",0}, { "_wxFontDialog","_class_wxFontDialog",0}, { "_wxRegion","_class_wxRegion",0}, @@ -8273,6 +8308,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPreviewFrame","_class_wxPreviewFrame",0}, { "_wxSizer","_class_wxSizer",0}, { "_class_wxShowEvent","_wxShowEvent",0}, + { "_class_wxPyTipProvider","_wxPyTipProvider",0}, { "_class_wxPCXHandler","_wxPCXHandler",0}, { "_wxTIFFHandler","_class_wxTIFFHandler",0}, { "_wxPyDropTarget","_class_wxPyDropTarget",0}, @@ -8312,11 +8348,11 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxScrollBar","_wxScrollBar",0}, { "_class_wxColourDialog","_wxColourDialog",0}, { "_class_wxPrintData","_wxPrintData",0}, - { "_wxDash","_char",0}, { "_wxPyRectangleShape","_class_wxPyTextShape",SwigwxPyTextShapeTowxPyRectangleShape}, { "_wxPyRectangleShape","_wxPyTextShape",SwigwxPyTextShapeTowxPyRectangleShape}, { "_wxPyRectangleShape","_class_wxPyRectangleShape",0}, { "_class_wxScrolledWindow","_wxScrolledWindow",0}, + { "_wxListItemAttr","_class_wxListItemAttr",0}, { "_class_wxTextEntryDialog","_wxTextEntryDialog",0}, { "_wxKeyEvent","_class_wxKeyEvent",0}, { "_wxMoveEvent","_class_wxMoveEvent",0}, @@ -8326,6 +8362,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPalette","_wxPalette",0}, { "_wxFileDataObject","_class_wxFileDataObject",0}, { "_class_wxQueryLayoutInfoEvent","_wxQueryLayoutInfoEvent",0}, + { "_wxNotebookSizer","_class_wxNotebookSizer",0}, { "_class_wxEraseEvent","_wxEraseEvent",0}, { "_wxPyFontEnumerator","_class_wxPyFontEnumerator",0}, { "_wxMDIClientWindow","_class_wxMDIClientWindow",0}, diff --git a/utils/wxPython/modules/ogl/oglshapes2.i b/wxPython/contrib/ogl/oglshapes2.i similarity index 96% rename from utils/wxPython/modules/ogl/oglshapes2.i rename to wxPython/contrib/ogl/oglshapes2.i index e2ff20bb3f..ef2a718958 100644 --- a/utils/wxPython/modules/ogl/oglshapes2.i +++ b/wxPython/contrib/ogl/oglshapes2.i @@ -47,8 +47,8 @@ class wxPyEllipseShape : public wxPyShape { public: wxPyEllipseShape(double width = 0.0, double height = 0.0); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyEllipseShape)" void base_OnDraw(wxDC& dc); void base_OnDrawContents(wxDC& dc); @@ -90,8 +90,8 @@ class wxPyCircleShape : public wxPyEllipseShape { public: wxPyCircleShape(double width = 0.0); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyCircleShape)" void base_OnDraw(wxDC& dc); void base_OnDrawContents(wxDC& dc); @@ -162,8 +162,8 @@ class wxPyLineShape : public wxPyShape { public: wxPyLineShape(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyLineShape)" void AddArrow(int type, int end = ARROW_POSITION_END, double arrowSize = 10.0, double xOffset = 0.0, @@ -259,8 +259,8 @@ class wxPyPolygonShape : public wxPyShape { public: wxPyPolygonShape(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyPolygonShape)" // void Create(wxList* points); @@ -330,8 +330,8 @@ class wxPyTextShape : public wxPyRectangleShape { public: wxPyTextShape(double width = 0.0, double height = 0.0); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyTextShape)" void base_OnDelete(); diff --git a/utils/wxPython/modules/ogl/oglshapes2.py b/wxPython/contrib/ogl/oglshapes2.py similarity index 99% rename from utils/wxPython/modules/ogl/oglshapes2.py rename to wxPython/contrib/ogl/oglshapes2.py index 8398f7cb07..c7770b514a 100644 --- a/utils/wxPython/modules/ogl/oglshapes2.py +++ b/wxPython/contrib/ogl/oglshapes2.py @@ -136,7 +136,7 @@ class wxPyEllipseShape(wxPyEllipseShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapes2c.new_wxPyEllipseShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyEllipseShape) @@ -238,7 +238,7 @@ class wxPyCircleShape(wxPyCircleShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapes2c.new_wxPyCircleShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyCircleShape) @@ -528,7 +528,7 @@ class wxPyLineShape(wxPyLineShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapes2c.new_wxPyLineShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyLineShape) @@ -648,7 +648,7 @@ class wxPyPolygonShape(wxPyPolygonShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapes2c.new_wxPyPolygonShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyPolygonShape) @@ -753,7 +753,7 @@ class wxPyTextShape(wxPyTextShapePtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglshapes2c.new_wxPyTextShape,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyTextShape) diff --git a/wxPython/contrib/stc/.cvsignore b/wxPython/contrib/stc/.cvsignore new file mode 100644 index 0000000000..cfb938e6d3 --- /dev/null +++ b/wxPython/contrib/stc/.cvsignore @@ -0,0 +1,5 @@ +Makefile +Makefile +stc_c.exp +stc_c.ilk +stc_c.pch diff --git a/wxPython/contrib/stc/README.txt b/wxPython/contrib/stc/README.txt new file mode 100644 index 0000000000..3b772c9cfe --- /dev/null +++ b/wxPython/contrib/stc/README.txt @@ -0,0 +1,7 @@ +Since STC is not always bundled with distributions of wxWindows, in +order for it to be a standard part of wxPython I need to bundle it +here. The contents of the contrib directory are copies of the +relevant parts of the main contrib directory in wxWindows. The +build.py script in this directory will also build the needed files +from there, so you no longer have to worry about aquiring and building +additional libraries beyond wxWindows itself. diff --git a/wxPython/contrib/stc/_stcextras.py b/wxPython/contrib/stc/_stcextras.py new file mode 100644 index 0000000000..77c6a83cc0 --- /dev/null +++ b/wxPython/contrib/stc/_stcextras.py @@ -0,0 +1,3 @@ +# Stuff these names into the wx namespace so wxPyConstructObject can find them + +wx.wxStyledTextEventPtr = wxStyledTextEventPtr diff --git a/wxPython/contrib/stc/build.cfg b/wxPython/contrib/stc/build.cfg new file mode 100644 index 0000000000..21c0d9d811 --- /dev/null +++ b/wxPython/contrib/stc/build.cfg @@ -0,0 +1,83 @@ +# -*- python -*- +import sys + +MODULE = 'stc_c' +SWIGFILES = ['stc_.i'] +SOURCES = [] +PYFILES = ['stc.py'] + + +OTHERSWIGFLAGS = '-I$(STCLOC)/contrib/include/wx/stc' +SWIGDEPS = '$(STCLOC)/contrib/include/wx/stc/stc.h' + +SOURCES = SOURCES + [ + '$(STCLOC)/contrib/src/stc/scintilla/src/AutoComplete.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/CallTip.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/CellBuffer.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/ContractionState.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/Document.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/Editor.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/Indicator.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/KeyMap.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/KeyWords.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/LineMarker.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/PropSet.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/ScintillaBase.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/Style.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/ViewStyle.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/LexCPP.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/LexHTML.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/LexOthers.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/LexPerl.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/LexPython.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/LexSQL.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/LexVB.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/DocumentAccessor.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/UniConversion.cxx', + '$(STCLOC)/contrib/src/stc/scintilla/src/WindowAccessor.cxx', + + '$(STCLOC)/contrib/src/stc/PlatWX.cpp', + '$(STCLOC)/contrib/src/stc/ScintillaWX.cpp', + '$(STCLOC)/contrib/src/stc/stc.cpp', + ] + +OTHERCFLAGS = '-D__WX__ -DSCI_LEXER ' + \ + '-I$(STCLOC)/contrib/src/stc/scintilla/include ' + \ + '-I$(STCLOC)/contrib/include ' + \ + '-I$(STCLOC)/contrib/src/stc/scintilla/src' + + +if sys.platform == 'win32': + OTHERDEFS = 'STCLOC = $(WXWIN)' + OTHERRULES = ''' +{$(WXWIN)/contrib/src/stc}.cpp{}.obj: + $(cc) @<< +$(CPPFLAGS) /c /Tp $< +<< + +{$(WXWIN)/contrib/src/stc/scintilla/src}.cxx{}.obj: + $(cc) @<< +$(CPPFLAGS) /c /Tp $< +<< +''' + +else: + DEFAULTRULE = 'default: contrib $(GENCODEDIR) $(TARGET) $(BUILDDIR)/$(TARGET) bldpycfiles' + OTHERDEFS = 'STCLOC = .' + OTHERRULES = ''' +%.o : contrib/src/stc/%.cpp + $(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $< + +%.o : contrib/src/stc/scintilla/src/%.cxx + $(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $< + +contrib : + ln -s $(WXWIN)/contrib contrib + +''' + + +# There are no platform differences so we don't need separate code directories +GENCODEDIR='.' +SWIGTOOLKITFLAG='' + diff --git a/wxPython/contrib/stc/stc.py b/wxPython/contrib/stc/stc.py new file mode 100644 index 0000000000..dc5b89dbfa --- /dev/null +++ b/wxPython/contrib/stc/stc.py @@ -0,0 +1,7 @@ + +# The name "stc.cpp" was cuasing the debugger to get confused with the +# same module name in the stc library, so I changed the name of this +# one to stc_.cpp and this little stub to make the "stc" Python module +# name still usesable for everything that matters. + +from stc_ import * diff --git a/wxPython/contrib/stc/stc_.cpp b/wxPython/contrib/stc/stc_.cpp new file mode 100644 index 0000000000..308b831137 --- /dev/null +++ b/wxPython/contrib/stc/stc_.cpp @@ -0,0 +1,8083 @@ +/* + * FILE : ./stc_.cpp + * + * This file was automatically generated by : + * Simplified Wrapper and Interface Generator (SWIG) + * Version 1.1 (Build 810) + * + * Portions Copyright (c) 1995-1998 + * The University of Utah and The Regents of the University of California. + * Permission is granted to distribute this file in any manner provided + * this notice remains intact. + * + * Do not make changes to this file--changes will be lost! + * + */ + + +#define SWIGCODE +/* Implementation : PYTHON */ + +#define SWIGPYTHON +#include <string.h> +#include <stdlib.h> +/* Definitions for Windows/Unix exporting */ +#if defined(__WIN32__) +# if defined(_MSC_VER) +# define SWIGEXPORT(a) __declspec(dllexport) a +# else +# if defined(__BORLANDC__) +# define SWIGEXPORT(a) a _export +# else +# define SWIGEXPORT(a) a +# endif +# endif +#else +# define SWIGEXPORT(a) a +#endif + +#ifdef __cplusplus +extern "C" { +#endif +#include "Python.h" +extern void SWIG_MakePtr(char *, void *, char *); +extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *)); +extern char *SWIG_GetPtr(char *, void **, char *); +extern char *SWIG_GetPtrObj(PyObject *, void **, char *); +extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); +extern PyObject *SWIG_newvarlink(void); +#ifdef __cplusplus +} +#endif +#define SWIG_init initstc_c + +#define SWIG_name "stc_c" + +#include "helpers.h" +#include "wx/stc/stc.h" + +static PyObject* l_output_helper(PyObject* target, PyObject* o) { + PyObject* o2; + PyObject* o3; + if (!target) { + target = o; + } else if (target == Py_None) { + Py_DECREF(Py_None); + target = o; + } else { + if (!PyList_Check(target)) { + o2 = target; + target = PyList_New(0); + PyList_Append(target, o2); + Py_XDECREF(o2); + } + PyList_Append(target,o); + Py_XDECREF(o); + } + return target; +} + +static PyObject* t_output_helper(PyObject* target, PyObject* o) { + PyObject* o2; + PyObject* o3; + + if (!target) { + target = o; + } else if (target == Py_None) { + Py_DECREF(Py_None); + target = o; + } else { + if (!PyTuple_Check(target)) { + o2 = target; + target = PyTuple_New(1); + PyTuple_SetItem(target, 0, o2); + } + o3 = PyTuple_New(1); + PyTuple_SetItem(o3, 0, o); + + o2 = target; + target = PySequence_Concat(o2, o3); + Py_DECREF(o2); + Py_DECREF(o3); + } + return target; +} + +static char* wxStringErrorMsg = "string type is required for parameter"; +#ifdef __cplusplus +extern "C" { +#endif +static void *SwigwxStyledTextCtrlTowxControl(void *ptr) { + wxStyledTextCtrl *src; + wxControl *dest; + src = (wxStyledTextCtrl *) ptr; + dest = (wxControl *) src; + return (void *) dest; +} + +static void *SwigwxStyledTextCtrlTowxWindow(void *ptr) { + wxStyledTextCtrl *src; + wxWindow *dest; + src = (wxStyledTextCtrl *) ptr; + dest = (wxWindow *) src; + return (void *) dest; +} + +static void *SwigwxStyledTextCtrlTowxEvtHandler(void *ptr) { + wxStyledTextCtrl *src; + wxEvtHandler *dest; + src = (wxStyledTextCtrl *) ptr; + dest = (wxEvtHandler *) src; + return (void *) dest; +} + +#define new_wxStyledTextCtrl(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (new wxStyledTextCtrl(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) +static PyObject *_wrap_new_wxStyledTextCtrl(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _result; + wxWindow * _arg0; + wxWindowID _arg1; + wxPoint * _arg2 = (wxPoint *) &wxDefaultPosition; + wxSize * _arg3 = (wxSize *) &wxDefaultSize; + long _arg4 = (long ) 0; + char * _arg5 = (char *) "styledtext"; + PyObject * _argo0 = 0; + wxPoint temp; + PyObject * _obj2 = 0; + wxSize temp0; + PyObject * _obj3 = 0; + char *_kwnames[] = { "parent","id","pos","size","style","name", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|OOls:new_wxStyledTextCtrl",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_arg4,&_arg5)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxStyledTextCtrl. Expected _wxWindow_p."); + return NULL; + } + } + if (_obj2) +{ + _arg2 = &temp; + if (! wxPoint_helper(_obj2, &_arg2)) + return NULL; +} + if (_obj3) +{ + _arg3 = &temp0; + if (! wxSize_helper(_obj3, &_arg3)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxStyledTextCtrl *)new_wxStyledTextCtrl(_arg0,_arg1,*_arg2,*_arg3,_arg4,_arg5); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxStyledTextCtrl_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxStyledTextCtrl_GetText(_swigobj) (_swigobj->GetText()) +static PyObject *_wrap_wxStyledTextCtrl_GetText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetText",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetText. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxString (wxStyledTextCtrl_GetText(_arg0)); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxStyledTextCtrl_SetText(_swigobj,_swigarg0) (_swigobj->SetText(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetText",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetText. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_SetText(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxStyledTextCtrl_GetLine(_swigobj,_swigarg0) (_swigobj->GetLine(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetLine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLine",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLine. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxString (wxStyledTextCtrl_GetLine(_arg0,_arg1)); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxStyledTextCtrl_ReplaceSelection(_swigobj,_swigarg0) (_swigobj->ReplaceSelection(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_ReplaceSelection(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_ReplaceSelection",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ReplaceSelection. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ReplaceSelection(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxStyledTextCtrl_SetReadOnly(_swigobj,_swigarg0) (_swigobj->SetReadOnly(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetReadOnly(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + bool _arg1; + PyObject * _argo0 = 0; + int tempbool1; + char *_kwnames[] = { "self","readOnly", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetReadOnly",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetReadOnly. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetReadOnly(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetReadOnly(_swigobj) (_swigobj->GetReadOnly()) +static PyObject *_wrap_wxStyledTextCtrl_GetReadOnly(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetReadOnly",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetReadOnly. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_GetReadOnly(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetTextRange(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetTextRange(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_GetTextRange(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","startPos","endPos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_GetTextRange",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetTextRange. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxString (wxStyledTextCtrl_GetTextRange(_arg0,_arg1,_arg2)); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxStyledTextCtrl_GetStyledTextRange(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetStyledTextRange(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_GetStyledTextRange(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","startPos","endPos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_GetStyledTextRange",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetStyledTextRange. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxString (wxStyledTextCtrl_GetStyledTextRange(_arg0,_arg1,_arg2)); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxStyledTextCtrl_AddText(_swigobj,_swigarg0) (_swigobj->AddText(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_AddText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_AddText",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AddText. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_AddText(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxStyledTextCtrl_AddStyledText(_swigobj,_swigarg0) (_swigobj->AddStyledText(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_AddStyledText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_AddStyledText",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AddStyledText. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_AddStyledText(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxStyledTextCtrl_InsertText(_swigobj,_swigarg0,_swigarg1) (_swigobj->InsertText(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_InsertText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxString * _arg2; + PyObject * _argo0 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","pos","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_InsertText",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_InsertText. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj2)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_InsertText(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxStyledTextCtrl_ClearAll(_swigobj) (_swigobj->ClearAll()) +static PyObject *_wrap_wxStyledTextCtrl_ClearAll(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_ClearAll",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ClearAll. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ClearAll(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetCharAt(_swigobj,_swigarg0) (_swigobj->GetCharAt(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetCharAt(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + char _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetCharAt",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetCharAt. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (char )wxStyledTextCtrl_GetCharAt(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("c",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetStyleAt(_swigobj,_swigarg0) (_swigobj->GetStyleAt(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetStyleAt(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + char _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetStyleAt",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetStyleAt. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (char )wxStyledTextCtrl_GetStyleAt(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("c",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetStyleBits(_swigobj,_swigarg0) (_swigobj->SetStyleBits(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetStyleBits(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","bits", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetStyleBits",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetStyleBits. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetStyleBits(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetStyleBits(_swigobj) (_swigobj->GetStyleBits()) +static PyObject *_wrap_wxStyledTextCtrl_GetStyleBits(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetStyleBits",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetStyleBits. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetStyleBits(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_Cut(_swigobj) (_swigobj->Cut()) +static PyObject *_wrap_wxStyledTextCtrl_Cut(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_Cut",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_Cut. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_Cut(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_Copy(_swigobj) (_swigobj->Copy()) +static PyObject *_wrap_wxStyledTextCtrl_Copy(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_Copy",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_Copy. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_Copy(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_Paste(_swigobj) (_swigobj->Paste()) +static PyObject *_wrap_wxStyledTextCtrl_Paste(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_Paste",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_Paste. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_Paste(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_CanPaste(_swigobj) (_swigobj->CanPaste()) +static PyObject *_wrap_wxStyledTextCtrl_CanPaste(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CanPaste",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CanPaste. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_CanPaste(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_ClearClipbrd(_swigobj) (_swigobj->ClearClipbrd()) +static PyObject *_wrap_wxStyledTextCtrl_ClearClipbrd(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_ClearClipbrd",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ClearClipbrd. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ClearClipbrd(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_Undo(_swigobj) (_swigobj->Undo()) +static PyObject *_wrap_wxStyledTextCtrl_Undo(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_Undo",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_Undo. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_Undo(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_CanUndo(_swigobj) (_swigobj->CanUndo()) +static PyObject *_wrap_wxStyledTextCtrl_CanUndo(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CanUndo",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CanUndo. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_CanUndo(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_EmptyUndoBuffer(_swigobj) (_swigobj->EmptyUndoBuffer()) +static PyObject *_wrap_wxStyledTextCtrl_EmptyUndoBuffer(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_EmptyUndoBuffer",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_EmptyUndoBuffer. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_EmptyUndoBuffer(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_Redo(_swigobj) (_swigobj->Redo()) +static PyObject *_wrap_wxStyledTextCtrl_Redo(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_Redo",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_Redo. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_Redo(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_CanRedo(_swigobj) (_swigobj->CanRedo()) +static PyObject *_wrap_wxStyledTextCtrl_CanRedo(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CanRedo",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CanRedo. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_CanRedo(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetUndoCollection(_swigobj,_swigarg0) (_swigobj->SetUndoCollection(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetUndoCollection(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxSTC_UndoType _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","type", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetUndoCollection",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetUndoCollection. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetUndoCollection(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetUndoCollection(_swigobj) (_swigobj->GetUndoCollection()) +static PyObject *_wrap_wxStyledTextCtrl_GetUndoCollection(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSTC_UndoType _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetUndoCollection",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetUndoCollection. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxSTC_UndoType )wxStyledTextCtrl_GetUndoCollection(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_BeginUndoAction(_swigobj) (_swigobj->BeginUndoAction()) +static PyObject *_wrap_wxStyledTextCtrl_BeginUndoAction(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_BeginUndoAction",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_BeginUndoAction. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_BeginUndoAction(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_EndUndoAction(_swigobj) (_swigobj->EndUndoAction()) +static PyObject *_wrap_wxStyledTextCtrl_EndUndoAction(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_EndUndoAction",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_EndUndoAction. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_EndUndoAction(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetSelection(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetSelection(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_GetSelection(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int * _arg1; + int temp; + int * _arg2; + int temp0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; +{ + _arg1 = &temp; +} +{ + _arg2 = &temp0; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetSelection",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetSelection. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_GetSelection(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg1)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg2)); + _resultobj = t_output_helper(_resultobj, o); +} + return _resultobj; +} + +#define wxStyledTextCtrl_SetSelection(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetSelection(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetSelection(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","startPos","endPos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetSelection",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetSelection. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetSelection(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetSelectedText(_swigobj) (_swigobj->GetSelectedText()) +static PyObject *_wrap_wxStyledTextCtrl_GetSelectedText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetSelectedText",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetSelectedText. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxString (wxStyledTextCtrl_GetSelectedText(_arg0)); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxStyledTextCtrl_HideSelection(_swigobj,_swigarg0) (_swigobj->HideSelection(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_HideSelection(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + bool _arg1; + PyObject * _argo0 = 0; + int tempbool1; + char *_kwnames[] = { "self","hide", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_HideSelection",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_HideSelection. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_HideSelection(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetHideSelection(_swigobj) (_swigobj->GetHideSelection()) +static PyObject *_wrap_wxStyledTextCtrl_GetHideSelection(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetHideSelection",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetHideSelection. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_GetHideSelection(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetTextLength(_swigobj) (_swigobj->GetTextLength()) +static PyObject *_wrap_wxStyledTextCtrl_GetTextLength(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetTextLength",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetTextLength. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetTextLength(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetFirstVisibleLine(_swigobj) (_swigobj->GetFirstVisibleLine()) +static PyObject *_wrap_wxStyledTextCtrl_GetFirstVisibleLine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetFirstVisibleLine",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFirstVisibleLine. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetFirstVisibleLine(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetModified(_swigobj) (_swigobj->GetModified()) +static PyObject *_wrap_wxStyledTextCtrl_GetModified(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetModified",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetModified. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_GetModified(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetLineCount(_swigobj) (_swigobj->GetLineCount()) +static PyObject *_wrap_wxStyledTextCtrl_GetLineCount(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetLineCount",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineCount. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLineCount(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetRect(_swigobj) (_swigobj->GetRect()) +static PyObject *_wrap_wxStyledTextCtrl_GetRect(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxRect * _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetRect",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetRect. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxRect (wxStyledTextCtrl_GetRect(_arg0)); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxRect_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxStyledTextCtrl_GetLineFromPos(_swigobj,_swigarg0) (_swigobj->GetLineFromPos(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetLineFromPos(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLineFromPos",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineFromPos. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLineFromPos(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetLineStartPos(_swigobj,_swigarg0) (_swigobj->GetLineStartPos(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetLineStartPos(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLineStartPos",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineStartPos. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLineStartPos(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetLineLengthAtPos(_swigobj,_swigarg0) (_swigobj->GetLineLengthAtPos(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetLineLengthAtPos(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLineLengthAtPos",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineLengthAtPos. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLineLengthAtPos(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetLineLength(_swigobj,_swigarg0) (_swigobj->GetLineLength(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetLineLength(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLineLength",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineLength. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLineLength(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetCurrentLineText(_swigobj,_swigarg0) (_swigobj->GetCurrentLineText(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetCurrentLineText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxStyledTextCtrl * _arg0; + int * _arg1; + int temp; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; +{ + _arg1 = &temp; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetCurrentLineText",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetCurrentLineText. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxString (wxStyledTextCtrl_GetCurrentLineText(_arg0,_arg1)); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg1)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxStyledTextCtrl_GetCurrentLine(_swigobj) (_swigobj->GetCurrentLine()) +static PyObject *_wrap_wxStyledTextCtrl_GetCurrentLine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetCurrentLine",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetCurrentLine. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetCurrentLine(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_PositionFromPoint(_swigobj,_swigarg0) (_swigobj->PositionFromPoint(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_PositionFromPoint(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + wxPoint * _arg1; + PyObject * _argo0 = 0; + wxPoint temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","pt", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_PositionFromPoint",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_PositionFromPoint. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxPoint_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_PositionFromPoint(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_LineFromPoint(_swigobj,_swigarg0) (_swigobj->LineFromPoint(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_LineFromPoint(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + wxPoint * _arg1; + PyObject * _argo0 = 0; + wxPoint temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","pt", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_LineFromPoint",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_LineFromPoint. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxPoint_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_LineFromPoint(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_PointFromPosition(_swigobj,_swigarg0) (_swigobj->PointFromPosition(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_PointFromPosition(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPoint * _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_PointFromPosition",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_PointFromPosition. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxPoint (wxStyledTextCtrl_PointFromPosition(_arg0,_arg1)); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxPoint_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxStyledTextCtrl_GetCurrentPos(_swigobj) (_swigobj->GetCurrentPos()) +static PyObject *_wrap_wxStyledTextCtrl_GetCurrentPos(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetCurrentPos",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetCurrentPos. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetCurrentPos(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetAnchor(_swigobj) (_swigobj->GetAnchor()) +static PyObject *_wrap_wxStyledTextCtrl_GetAnchor(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetAnchor",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetAnchor. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetAnchor(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SelectAll(_swigobj) (_swigobj->SelectAll()) +static PyObject *_wrap_wxStyledTextCtrl_SelectAll(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_SelectAll",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SelectAll. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SelectAll(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetCurrentPosition(_swigobj,_swigarg0) (_swigobj->SetCurrentPosition(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetCurrentPosition(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetCurrentPosition",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCurrentPosition. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetCurrentPosition(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetAnchor(_swigobj,_swigarg0) (_swigobj->SetAnchor(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetAnchor(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetAnchor",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetAnchor. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetAnchor(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GotoPos(_swigobj,_swigarg0) (_swigobj->GotoPos(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GotoPos(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GotoPos",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GotoPos. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_GotoPos(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GotoLine(_swigobj,_swigarg0) (_swigobj->GotoLine(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GotoLine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GotoLine",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GotoLine. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_GotoLine(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_ChangePosition(_swigobj,_swigarg0,_swigarg1) (_swigobj->ChangePosition(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_ChangePosition(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + bool _arg2; + PyObject * _argo0 = 0; + int tempbool2; + char *_kwnames[] = { "self","delta","extendSelection", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_ChangePosition",_kwnames,&_argo0,&_arg1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ChangePosition. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ChangePosition(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_PageMove(_swigobj,_swigarg0,_swigarg1) (_swigobj->PageMove(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_PageMove(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + bool _arg2; + PyObject * _argo0 = 0; + int tempbool2; + char *_kwnames[] = { "self","cmdKey","extendSelection", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_PageMove",_kwnames,&_argo0,&_arg1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_PageMove. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_PageMove(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_ScrollBy(_swigobj,_swigarg0,_swigarg1) (_swigobj->ScrollBy(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_ScrollBy(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","columnDelta","lineDelta", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_ScrollBy",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ScrollBy. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ScrollBy(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_ScrollToLine(_swigobj,_swigarg0) (_swigobj->ScrollToLine(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_ScrollToLine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_ScrollToLine",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ScrollToLine. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ScrollToLine(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_ScrollToColumn(_swigobj,_swigarg0) (_swigobj->ScrollToColumn(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_ScrollToColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","column", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_ScrollToColumn",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ScrollToColumn. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ScrollToColumn(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_EnsureCaretVisible(_swigobj) (_swigobj->EnsureCaretVisible()) +static PyObject *_wrap_wxStyledTextCtrl_EnsureCaretVisible(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_EnsureCaretVisible",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_EnsureCaretVisible. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_EnsureCaretVisible(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetCaretPolicy(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetCaretPolicy(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetCaretPolicy(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2 = (int ) 0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","policy","slop", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxStyledTextCtrl_SetCaretPolicy",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCaretPolicy. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetCaretPolicy(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetSelectionType(_swigobj) (_swigobj->GetSelectionType()) +static PyObject *_wrap_wxStyledTextCtrl_GetSelectionType(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetSelectionType",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetSelectionType. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetSelectionType(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetLinesOnScreen(_swigobj) (_swigobj->GetLinesOnScreen()) +static PyObject *_wrap_wxStyledTextCtrl_GetLinesOnScreen(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetLinesOnScreen",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLinesOnScreen. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLinesOnScreen(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_IsSelectionRectangle(_swigobj) (_swigobj->IsSelectionRectangle()) +static PyObject *_wrap_wxStyledTextCtrl_IsSelectionRectangle(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_IsSelectionRectangle",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_IsSelectionRectangle. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_IsSelectionRectangle(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetUseHorizontalScrollBar(_swigobj,_swigarg0) (_swigobj->SetUseHorizontalScrollBar(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetUseHorizontalScrollBar(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + bool _arg1; + PyObject * _argo0 = 0; + int tempbool1; + char *_kwnames[] = { "self","use", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetUseHorizontalScrollBar",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetUseHorizontalScrollBar. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetUseHorizontalScrollBar(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetUseHorizontalScrollBar(_swigobj) (_swigobj->GetUseHorizontalScrollBar()) +static PyObject *_wrap_wxStyledTextCtrl_GetUseHorizontalScrollBar(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetUseHorizontalScrollBar",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetUseHorizontalScrollBar. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_GetUseHorizontalScrollBar(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_FindText(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4) (_swigobj->FindText(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4)) +static PyObject *_wrap_wxStyledTextCtrl_FindText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + wxString * _arg3; + bool _arg4; + bool _arg5; + PyObject * _argo0 = 0; + PyObject * _obj3 = 0; + int tempbool4; + int tempbool5; + char *_kwnames[] = { "self","minPos","maxPos","text","caseSensitive","wholeWord", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiOii:wxStyledTextCtrl_FindText",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&tempbool4,&tempbool5)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_FindText. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj3)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg3 = new wxString(PyString_AsString(_obj3), PyString_Size(_obj3)); +} + _arg4 = (bool ) tempbool4; + _arg5 = (bool ) tempbool5; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_FindText(_arg0,_arg1,_arg2,*_arg3,_arg4,_arg5); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj3) + delete _arg3; +} + return _resultobj; +} + +#define wxStyledTextCtrl_SearchAnchor(_swigobj) (_swigobj->SearchAnchor()) +static PyObject *_wrap_wxStyledTextCtrl_SearchAnchor(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_SearchAnchor",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SearchAnchor. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SearchAnchor(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SearchNext(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SearchNext(_swigarg0,_swigarg1,_swigarg2)) +static PyObject *_wrap_wxStyledTextCtrl_SearchNext(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + bool _arg2; + bool _arg3; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + int tempbool2; + int tempbool3; + char *_kwnames[] = { "self","text","caseSensitive","wholeWord", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOii:wxStyledTextCtrl_SearchNext",_kwnames,&_argo0,&_obj1,&tempbool2,&tempbool3)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SearchNext. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} + _arg2 = (bool ) tempbool2; + _arg3 = (bool ) tempbool3; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_SearchNext(_arg0,*_arg1,_arg2,_arg3); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxStyledTextCtrl_SearchPrev(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SearchPrev(_swigarg0,_swigarg1,_swigarg2)) +static PyObject *_wrap_wxStyledTextCtrl_SearchPrev(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + bool _arg2; + bool _arg3; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + int tempbool2; + int tempbool3; + char *_kwnames[] = { "self","text","caseSensitive","wholeWord", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOii:wxStyledTextCtrl_SearchPrev",_kwnames,&_argo0,&_obj1,&tempbool2,&tempbool3)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SearchPrev. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} + _arg2 = (bool ) tempbool2; + _arg3 = (bool ) tempbool3; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_SearchPrev(_arg0,*_arg1,_arg2,_arg3); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxStyledTextCtrl_GetViewWhitespace(_swigobj) (_swigobj->GetViewWhitespace()) +static PyObject *_wrap_wxStyledTextCtrl_GetViewWhitespace(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetViewWhitespace",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetViewWhitespace. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_GetViewWhitespace(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetViewWhitespace(_swigobj,_swigarg0) (_swigobj->SetViewWhitespace(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetViewWhitespace(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + bool _arg1; + PyObject * _argo0 = 0; + int tempbool1; + char *_kwnames[] = { "self","visible", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetViewWhitespace",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetViewWhitespace. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetViewWhitespace(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetEOLMode(_swigobj) (_swigobj->GetEOLMode()) +static PyObject *_wrap_wxStyledTextCtrl_GetEOLMode(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSTC_EOL _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEOLMode",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEOLMode. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxSTC_EOL )wxStyledTextCtrl_GetEOLMode(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetEOLMode(_swigobj,_swigarg0) (_swigobj->SetEOLMode(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetEOLMode(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxSTC_EOL _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","mode", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetEOLMode",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEOLMode. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetEOLMode(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetViewEOL(_swigobj) (_swigobj->GetViewEOL()) +static PyObject *_wrap_wxStyledTextCtrl_GetViewEOL(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetViewEOL",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetViewEOL. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_GetViewEOL(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetViewEOL(_swigobj,_swigarg0) (_swigobj->SetViewEOL(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetViewEOL(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + bool _arg1; + PyObject * _argo0 = 0; + int tempbool1; + char *_kwnames[] = { "self","visible", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetViewEOL",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetViewEOL. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetViewEOL(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_ConvertEOL(_swigobj,_swigarg0) (_swigobj->ConvertEOL(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_ConvertEOL(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxSTC_EOL _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","mode", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_ConvertEOL",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ConvertEOL. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ConvertEOL(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetEndStyled(_swigobj) (_swigobj->GetEndStyled()) +static PyObject *_wrap_wxStyledTextCtrl_GetEndStyled(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEndStyled",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEndStyled. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetEndStyled(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_StartStyling(_swigobj,_swigarg0,_swigarg1) (_swigobj->StartStyling(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StartStyling(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos","mask", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_StartStyling",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StartStyling. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StartStyling(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetStyleFor(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetStyleFor(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetStyleFor(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","length","style", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetStyleFor",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetStyleFor. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetStyleFor(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetStyleBytes(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetStyleBytes(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetStyleBytes(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + char * _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","length","styleBytes", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ois:wxStyledTextCtrl_SetStyleBytes",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetStyleBytes. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetStyleBytes(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetLineState(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetLineState(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetLineState(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line","value", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetLineState",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetLineState. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetLineState(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetLineState(_swigobj,_swigarg0) (_swigobj->GetLineState(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetLineState(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLineState",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineState. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLineState(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_StyleClearAll(_swigobj) (_swigobj->StyleClearAll()) +static PyObject *_wrap_wxStyledTextCtrl_StyleClearAll(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_StyleClearAll",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleClearAll. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleClearAll(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_StyleResetDefault(_swigobj) (_swigobj->StyleResetDefault()) +static PyObject *_wrap_wxStyledTextCtrl_StyleResetDefault(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_StyleResetDefault",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleResetDefault. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleResetDefault(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetSpec(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetSpec(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetSpec(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxString * _arg2; + PyObject * _argo0 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","styleNum","spec", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_StyleSetSpec",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetSpec. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj2)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetSpec(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetForeground(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetForeground(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetForeground(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxColour * _arg2; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","styleNum","colour", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_StyleSetForeground",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetForeground. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg2 = &temp; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetForeground(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetBackground(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetBackground(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetBackground(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxColour * _arg2; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","styleNum","colour", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_StyleSetBackground",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetBackground. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg2 = &temp; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetBackground(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetFont(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetFont(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetFont(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxFont * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo2 = 0; + char *_kwnames[] = { "self","styleNum","font", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_StyleSetFont",_kwnames,&_argo0,&_arg1,&_argo2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetFont. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + if (_argo2) { + if (_argo2 == Py_None) { _arg2 = NULL; } + else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxFont_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxStyledTextCtrl_StyleSetFont. Expected _wxFont_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetFont(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetFontAttr(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (_swigobj->StyleSetFontAttr(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetFontAttr(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + wxString * _arg3; + bool _arg4 = (bool ) FALSE; + bool _arg5 = (bool ) FALSE; + bool _arg6 = (bool ) FALSE; + PyObject * _argo0 = 0; + PyObject * _obj3 = 0; + int tempbool4 = (int) FALSE; + int tempbool5 = (int) FALSE; + int tempbool6 = (int) FALSE; + char *_kwnames[] = { "self","styleNum","size","faceName","bold","italic","underline", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiO|iii:wxStyledTextCtrl_StyleSetFontAttr",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&tempbool4,&tempbool5,&tempbool6)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetFontAttr. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj3)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg3 = new wxString(PyString_AsString(_obj3), PyString_Size(_obj3)); +} + _arg4 = (bool ) tempbool4; + _arg5 = (bool ) tempbool5; + _arg6 = (bool ) tempbool6; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetFontAttr(_arg0,_arg1,_arg2,*_arg3,_arg4,_arg5,_arg6); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj3) + delete _arg3; +} + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetBold(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetBold(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetBold(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + bool _arg2; + PyObject * _argo0 = 0; + int tempbool2; + char *_kwnames[] = { "self","styleNum","bold", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_StyleSetBold",_kwnames,&_argo0,&_arg1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetBold. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetBold(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetItalic(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetItalic(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetItalic(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + bool _arg2; + PyObject * _argo0 = 0; + int tempbool2; + char *_kwnames[] = { "self","styleNum","italic", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_StyleSetItalic",_kwnames,&_argo0,&_arg1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetItalic. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetItalic(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetFaceName(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetFaceName(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetFaceName(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxString * _arg2; + PyObject * _argo0 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","styleNum","faceName", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_StyleSetFaceName",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetFaceName. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj2)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetFaceName(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetSize(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetSize(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetSize(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","styleNum","pointSize", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_StyleSetSize",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetSize. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetSize(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetEOLFilled(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetEOLFilled(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetEOLFilled(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + bool _arg2; + PyObject * _argo0 = 0; + int tempbool2; + char *_kwnames[] = { "self","styleNum","fillEOL", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_StyleSetEOLFilled",_kwnames,&_argo0,&_arg1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetEOLFilled. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetEOLFilled(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_StyleSetUnderline(_swigobj,_swigarg0,_swigarg1) (_swigobj->StyleSetUnderline(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_StyleSetUnderline(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + bool _arg2; + PyObject * _argo0 = 0; + int tempbool2; + char *_kwnames[] = { "self","styleNum","underline", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_StyleSetUnderline",_kwnames,&_argo0,&_arg1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetUnderline. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_StyleSetUnderline(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetLeftMargin(_swigobj) (_swigobj->GetLeftMargin()) +static PyObject *_wrap_wxStyledTextCtrl_GetLeftMargin(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetLeftMargin",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLeftMargin. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLeftMargin(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetRightMargin(_swigobj) (_swigobj->GetRightMargin()) +static PyObject *_wrap_wxStyledTextCtrl_GetRightMargin(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetRightMargin",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetRightMargin. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetRightMargin(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetMargins(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetMargins(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetMargins(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","left","right", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetMargins",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetMargins. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetMargins(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetMarginType(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetMarginType(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetMarginType(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","margin","type", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetMarginType",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetMarginType. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetMarginType(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetMarginType(_swigobj,_swigarg0) (_swigobj->GetMarginType(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetMarginType(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","margin", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetMarginType",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetMarginType. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetMarginType(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetMarginWidth(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetMarginWidth(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetMarginWidth(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","margin","pixelWidth", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetMarginWidth",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetMarginWidth. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetMarginWidth(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetMarginWidth(_swigobj,_swigarg0) (_swigobj->GetMarginWidth(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetMarginWidth(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","margin", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetMarginWidth",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetMarginWidth. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetMarginWidth(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetMarginMask(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetMarginMask(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetMarginMask(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","margin","mask", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetMarginMask",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetMarginMask. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetMarginMask(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetMarginMask(_swigobj,_swigarg0) (_swigobj->GetMarginMask(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetMarginMask(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","margin", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetMarginMask",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetMarginMask. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetMarginMask(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetMarginSensitive(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetMarginSensitive(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetMarginSensitive(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + bool _arg2; + PyObject * _argo0 = 0; + int tempbool2; + char *_kwnames[] = { "self","margin","sensitive", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetMarginSensitive",_kwnames,&_argo0,&_arg1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetMarginSensitive. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetMarginSensitive(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetMarginSensitive(_swigobj,_swigarg0) (_swigobj->GetMarginSensitive(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetMarginSensitive(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","margin", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetMarginSensitive",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetMarginSensitive. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_GetMarginSensitive(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetSelectionForeground(_swigobj,_swigarg0) (_swigobj->SetSelectionForeground(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetSelectionForeground(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colour", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetSelectionForeground",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetSelectionForeground. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetSelectionForeground(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetSelectionBackground(_swigobj,_swigarg0) (_swigobj->SetSelectionBackground(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetSelectionBackground(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colour", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetSelectionBackground",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetSelectionBackground. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetSelectionBackground(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetCaretForeground(_swigobj,_swigarg0) (_swigobj->SetCaretForeground(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetCaretForeground(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colour", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetCaretForeground",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCaretForeground. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetCaretForeground(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetCaretPeriod(_swigobj) (_swigobj->GetCaretPeriod()) +static PyObject *_wrap_wxStyledTextCtrl_GetCaretPeriod(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetCaretPeriod",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetCaretPeriod. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetCaretPeriod(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetCaretPeriod(_swigobj,_swigarg0) (_swigobj->SetCaretPeriod(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetCaretPeriod(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","milliseconds", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetCaretPeriod",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCaretPeriod. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetCaretPeriod(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetBufferedDraw(_swigobj,_swigarg0) (_swigobj->SetBufferedDraw(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetBufferedDraw(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + bool _arg1; + PyObject * _argo0 = 0; + int tempbool1; + char *_kwnames[] = { "self","isBuffered", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetBufferedDraw",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetBufferedDraw. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetBufferedDraw(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetTabWidth(_swigobj,_swigarg0) (_swigobj->SetTabWidth(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetTabWidth(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","numChars", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetTabWidth",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetTabWidth. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetTabWidth(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetIndent(_swigobj,_swigarg0) (_swigobj->SetIndent(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetIndent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","numChars", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetIndent",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetIndent. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetIndent(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetUseTabs(_swigobj,_swigarg0) (_swigobj->SetUseTabs(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetUseTabs(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + bool _arg1; + PyObject * _argo0 = 0; + int tempbool1; + char *_kwnames[] = { "self","usetabs", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetUseTabs",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetUseTabs. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetUseTabs(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetLineIndentation(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetLineIndentation(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetLineIndentation(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line","indentation", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetLineIndentation",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetLineIndentation. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetLineIndentation(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetLineIndentation(_swigobj,_swigarg0) (_swigobj->GetLineIndentation(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetLineIndentation(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLineIndentation",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineIndentation. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLineIndentation(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetLineIndentationPos(_swigobj,_swigarg0) (_swigobj->GetLineIndentationPos(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetLineIndentationPos(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLineIndentationPos",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineIndentationPos. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLineIndentationPos(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetWordChars(_swigobj,_swigarg0) (_swigobj->SetWordChars(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetWordChars(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","wordChars", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetWordChars",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetWordChars. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetWordChars(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxStyledTextCtrl_SetUsePop(_swigobj,_swigarg0) (_swigobj->SetUsePop(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetUsePop(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + bool _arg1; + PyObject * _argo0 = 0; + int tempbool1; + char *_kwnames[] = { "self","usepopup", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetUsePop",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetUsePop. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetUsePop(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_BraceHighlight(_swigobj,_swigarg0,_swigarg1) (_swigobj->BraceHighlight(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_BraceHighlight(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos1","pos2", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_BraceHighlight",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_BraceHighlight. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_BraceHighlight(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_BraceBadlight(_swigobj,_swigarg0) (_swigobj->BraceBadlight(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_BraceBadlight(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_BraceBadlight",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_BraceBadlight. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_BraceBadlight(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_BraceMatch(_swigobj,_swigarg0,_swigarg1) (_swigobj->BraceMatch(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_BraceMatch(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2 = (int ) 0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos","maxReStyle", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxStyledTextCtrl_BraceMatch",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_BraceMatch. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_BraceMatch(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerDefine(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->MarkerDefine(_swigarg0,_swigarg1,_swigarg2,_swigarg3)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerDefine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + wxColour * _arg3; + wxColour * _arg4; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj3 = 0; + wxColour temp0; + PyObject * _obj4 = 0; + char *_kwnames[] = { "self","markerNumber","markerSymbol","foreground","background", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiOO:wxStyledTextCtrl_MarkerDefine",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&_obj4)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerDefine. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg3 = &temp; + if (! wxColour_helper(_obj3, &_arg3)) + return NULL; +} +{ + _arg4 = &temp0; + if (! wxColour_helper(_obj4, &_arg4)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_MarkerDefine(_arg0,_arg1,_arg2,*_arg3,*_arg4); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerSetType(_swigobj,_swigarg0,_swigarg1) (_swigobj->MarkerSetType(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerSetType(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","markerNumber","markerSymbol", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_MarkerSetType",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerSetType. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_MarkerSetType(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerSetForeground(_swigobj,_swigarg0,_swigarg1) (_swigobj->MarkerSetForeground(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerSetForeground(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxColour * _arg2; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","markerNumber","colour", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_MarkerSetForeground",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerSetForeground. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg2 = &temp; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_MarkerSetForeground(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerSetBackground(_swigobj,_swigarg0,_swigarg1) (_swigobj->MarkerSetBackground(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerSetBackground(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxColour * _arg2; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","markerNumber","colour", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_MarkerSetBackground",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerSetBackground. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg2 = &temp; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_MarkerSetBackground(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerAdd(_swigobj,_swigarg0,_swigarg1) (_swigobj->MarkerAdd(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerAdd(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line","markerNumber", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_MarkerAdd",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerAdd. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_MarkerAdd(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerDelete(_swigobj,_swigarg0,_swigarg1) (_swigobj->MarkerDelete(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerDelete(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line","markerNumber", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_MarkerDelete",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerDelete. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_MarkerDelete(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerDeleteAll(_swigobj,_swigarg0) (_swigobj->MarkerDeleteAll(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerDeleteAll(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","markerNumber", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_MarkerDeleteAll",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerDeleteAll. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_MarkerDeleteAll(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerGet(_swigobj,_swigarg0) (_swigobj->MarkerGet(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerGet(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_MarkerGet",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerGet. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_MarkerGet(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerGetNextLine(_swigobj,_swigarg0,_swigarg1) (_swigobj->MarkerGetNextLine(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerGetNextLine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","lineStart","markerMask", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_MarkerGetNextLine",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerGetNextLine. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_MarkerGetNextLine(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerGetPrevLine(_swigobj,_swigarg0,_swigarg1) (_swigobj->MarkerGetPrevLine(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerGetPrevLine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","lineStart","markerMask", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_MarkerGetPrevLine",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerGetPrevLine. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_MarkerGetPrevLine(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerLineFromHandle(_swigobj,_swigarg0) (_swigobj->MarkerLineFromHandle(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerLineFromHandle(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","handle", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_MarkerLineFromHandle",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerLineFromHandle. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_MarkerLineFromHandle(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_MarkerDeleteHandle(_swigobj,_swigarg0) (_swigobj->MarkerDeleteHandle(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_MarkerDeleteHandle(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","handle", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_MarkerDeleteHandle",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MarkerDeleteHandle. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_MarkerDeleteHandle(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_IndicatorSetStyle(_swigobj,_swigarg0,_swigarg1) (_swigobj->IndicatorSetStyle(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_IndicatorSetStyle(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","indicNum","indicStyle", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_IndicatorSetStyle",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_IndicatorSetStyle. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_IndicatorSetStyle(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_IndicatorGetStyle(_swigobj,_swigarg0) (_swigobj->IndicatorGetStyle(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_IndicatorGetStyle(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","indicNum", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_IndicatorGetStyle",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_IndicatorGetStyle. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_IndicatorGetStyle(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_IndicatorSetColour(_swigobj,_swigarg0,_swigarg1) (_swigobj->IndicatorSetColour(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_IndicatorSetColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxColour * _arg2; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","indicNum","colour", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_IndicatorSetColour",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_IndicatorSetColour. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg2 = &temp; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_IndicatorSetColour(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_AutoCompShow(_swigobj,_swigarg0) (_swigobj->AutoCompShow(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_AutoCompShow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","listOfWords", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_AutoCompShow",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompShow. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_AutoCompShow(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxStyledTextCtrl_AutoCompCancel(_swigobj) (_swigobj->AutoCompCancel()) +static PyObject *_wrap_wxStyledTextCtrl_AutoCompCancel(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_AutoCompCancel",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompCancel. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_AutoCompCancel(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_AutoCompActive(_swigobj) (_swigobj->AutoCompActive()) +static PyObject *_wrap_wxStyledTextCtrl_AutoCompActive(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_AutoCompActive",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompActive. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_AutoCompActive(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_AutoCompPosAtStart(_swigobj) (_swigobj->AutoCompPosAtStart()) +static PyObject *_wrap_wxStyledTextCtrl_AutoCompPosAtStart(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_AutoCompPosAtStart",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompPosAtStart. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_AutoCompPosAtStart(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_AutoCompComplete(_swigobj) (_swigobj->AutoCompComplete()) +static PyObject *_wrap_wxStyledTextCtrl_AutoCompComplete(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_AutoCompComplete",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompComplete. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_AutoCompComplete(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_AutoCompStopChars(_swigobj,_swigarg0) (_swigobj->AutoCompStopChars(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_AutoCompStopChars(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","stopChars", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_AutoCompStopChars",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompStopChars. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_AutoCompStopChars(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxStyledTextCtrl_AutoCompSetSeparator(_swigobj,_swigarg0) (_swigobj->AutoCompSetSeparator(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_AutoCompSetSeparator(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + char _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","separator", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oc:wxStyledTextCtrl_AutoCompSetSeparator",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompSetSeparator. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_AutoCompSetSeparator(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_AutoCompGetSeparator(_swigobj) (_swigobj->AutoCompGetSeparator()) +static PyObject *_wrap_wxStyledTextCtrl_AutoCompGetSeparator(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + char _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_AutoCompGetSeparator",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompGetSeparator. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (char )wxStyledTextCtrl_AutoCompGetSeparator(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("c",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_AutoCompSelect(_swigobj,_swigarg0) (_swigobj->AutoCompSelect(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_AutoCompSelect(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","stringtoselect", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_AutoCompSelect",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompSelect. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_AutoCompSelect(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxStyledTextCtrl_CallTipShow(_swigobj,_swigarg0,_swigarg1) (_swigobj->CallTipShow(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_CallTipShow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxString * _arg2; + PyObject * _argo0 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","pos","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_CallTipShow",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipShow. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj2)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_CallTipShow(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxStyledTextCtrl_CallTipCancel(_swigobj) (_swigobj->CallTipCancel()) +static PyObject *_wrap_wxStyledTextCtrl_CallTipCancel(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CallTipCancel",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipCancel. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_CallTipCancel(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_CallTipActive(_swigobj) (_swigobj->CallTipActive()) +static PyObject *_wrap_wxStyledTextCtrl_CallTipActive(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CallTipActive",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipActive. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_CallTipActive(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_CallTipPosAtStart(_swigobj) (_swigobj->CallTipPosAtStart()) +static PyObject *_wrap_wxStyledTextCtrl_CallTipPosAtStart(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CallTipPosAtStart",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipPosAtStart. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_CallTipPosAtStart(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_CallTipSetHighlight(_swigobj,_swigarg0,_swigarg1) (_swigobj->CallTipSetHighlight(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_CallTipSetHighlight(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","start","end", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_CallTipSetHighlight",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipSetHighlight. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_CallTipSetHighlight(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_CallTipSetBackground(_swigobj,_swigarg0) (_swigobj->CallTipSetBackground(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_CallTipSetBackground(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colour", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_CallTipSetBackground",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipSetBackground. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_CallTipSetBackground(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_CmdKeyAssign(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->CmdKeyAssign(_swigarg0,_swigarg1,_swigarg2)) +static PyObject *_wrap_wxStyledTextCtrl_CmdKeyAssign(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + int _arg3; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","key","modifiers","cmd", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oiii:wxStyledTextCtrl_CmdKeyAssign",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CmdKeyAssign. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_CmdKeyAssign(_arg0,_arg1,_arg2,_arg3); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_CmdKeyClear(_swigobj,_swigarg0,_swigarg1) (_swigobj->CmdKeyClear(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_CmdKeyClear(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","key","modifiers", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_CmdKeyClear",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CmdKeyClear. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_CmdKeyClear(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_CmdKeyClearAll(_swigobj) (_swigobj->CmdKeyClearAll()) +static PyObject *_wrap_wxStyledTextCtrl_CmdKeyClearAll(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CmdKeyClearAll",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CmdKeyClearAll. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_CmdKeyClearAll(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_CmdKeyExecute(_swigobj,_swigarg0) (_swigobj->CmdKeyExecute(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_CmdKeyExecute(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","cmd", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_CmdKeyExecute",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CmdKeyExecute. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_CmdKeyExecute(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_FormatRange(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6) (_swigobj->FormatRange(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6)) +static PyObject *_wrap_wxStyledTextCtrl_FormatRange(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + bool _arg1; + int _arg2; + int _arg3; + wxDC * _arg4; + wxDC * _arg5; + wxRect * _arg6; + wxRect * _arg7; + PyObject * _argo0 = 0; + int tempbool1; + PyObject * _argo4 = 0; + PyObject * _argo5 = 0; + wxRect temp; + PyObject * _obj6 = 0; + wxRect temp0; + PyObject * _obj7 = 0; + char *_kwnames[] = { "self","doDraw","startPos","endPos","draw","target","renderRect","pageRect", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiiOOOO:wxStyledTextCtrl_FormatRange",_kwnames,&_argo0,&tempbool1,&_arg2,&_arg3,&_argo4,&_argo5,&_obj6,&_obj7)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_FormatRange. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; + if (_argo4) { + if (_argo4 == Py_None) { _arg4 = NULL; } + else if (SWIG_GetPtrObj(_argo4,(void **) &_arg4,"_wxDC_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 5 of wxStyledTextCtrl_FormatRange. Expected _wxDC_p."); + return NULL; + } + } + if (_argo5) { + if (_argo5 == Py_None) { _arg5 = NULL; } + else if (SWIG_GetPtrObj(_argo5,(void **) &_arg5,"_wxDC_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 6 of wxStyledTextCtrl_FormatRange. Expected _wxDC_p."); + return NULL; + } + } +{ + _arg6 = &temp; + if (! wxRect_helper(_obj6, &_arg6)) + return NULL; +} +{ + _arg7 = &temp0; + if (! wxRect_helper(_obj7, &_arg7)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_FormatRange(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,*_arg6,*_arg7); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetDocument(_swigobj) (_swigobj->GetDocument()) +static PyObject *_wrap_wxStyledTextCtrl_GetDocument(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + void * _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetDocument",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetDocument. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (void *)wxStyledTextCtrl_GetDocument(_arg0); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_void_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxStyledTextCtrl_SetDocument(_swigobj,_swigarg0) (_swigobj->SetDocument(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetDocument(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + void * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","document", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetDocument",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetDocument. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxStyledTextCtrl_SetDocument. Expected _void_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetDocument(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_VisibleFromDocLine(_swigobj,_swigarg0) (_swigobj->VisibleFromDocLine(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_VisibleFromDocLine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","docLine", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_VisibleFromDocLine",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_VisibleFromDocLine. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_VisibleFromDocLine(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_DocLineFromVisible(_swigobj,_swigarg0) (_swigobj->DocLineFromVisible(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_DocLineFromVisible(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","displayLine", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_DocLineFromVisible",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_DocLineFromVisible. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_DocLineFromVisible(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetFoldLevel(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetFoldLevel(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetFoldLevel(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line","level", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetFoldLevel",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetFoldLevel. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_SetFoldLevel(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetFoldLevel(_swigobj,_swigarg0) (_swigobj->GetFoldLevel(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetFoldLevel(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetFoldLevel",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFoldLevel. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetFoldLevel(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetLastChild(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetLastChild(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_GetLastChild(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line","level", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_GetLastChild",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLastChild. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetLastChild(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetFoldParent(_swigobj,_swigarg0) (_swigobj->GetFoldParent(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetFoldParent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetFoldParent",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFoldParent. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetFoldParent(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_ShowLines(_swigobj,_swigarg0,_swigarg1) (_swigobj->ShowLines(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_ShowLines(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","lineStart","lineEnd", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_ShowLines",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ShowLines. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ShowLines(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_HideLines(_swigobj,_swigarg0,_swigarg1) (_swigobj->HideLines(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_HideLines(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","lineStart","lineEnd", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_HideLines",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_HideLines. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_HideLines(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetLineVisible(_swigobj,_swigarg0) (_swigobj->GetLineVisible(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetLineVisible(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLineVisible",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineVisible. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_GetLineVisible(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetFoldExpanded(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetFoldExpanded(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetFoldExpanded(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + bool _arg2; + PyObject * _argo0 = 0; + int tempbool2; + char *_kwnames[] = { "self","line","expanded", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetFoldExpanded",_kwnames,&_argo0,&_arg1,&tempbool2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetFoldExpanded. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } + _arg2 = (bool ) tempbool2; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetFoldExpanded(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetFoldExpanded(_swigobj,_swigarg0) (_swigobj->GetFoldExpanded(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_GetFoldExpanded(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetFoldExpanded",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFoldExpanded. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextCtrl_GetFoldExpanded(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_ToggleFold(_swigobj,_swigarg0) (_swigobj->ToggleFold(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_ToggleFold(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_ToggleFold",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ToggleFold. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ToggleFold(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_EnsureVisible(_swigobj,_swigarg0) (_swigobj->EnsureVisible(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_EnsureVisible(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","line", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_EnsureVisible",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_EnsureVisible. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_EnsureVisible(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetFoldFlags(_swigobj,_swigarg0) (_swigobj->SetFoldFlags(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetFoldFlags(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","flags", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetFoldFlags",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetFoldFlags. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetFoldFlags(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_ZoomIn(_swigobj) (_swigobj->ZoomIn()) +static PyObject *_wrap_wxStyledTextCtrl_ZoomIn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_ZoomIn",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ZoomIn. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ZoomIn(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_ZoomOut(_swigobj) (_swigobj->ZoomOut()) +static PyObject *_wrap_wxStyledTextCtrl_ZoomOut(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_ZoomOut",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ZoomOut. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_ZoomOut(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetZoom(_swigobj,_swigarg0) (_swigobj->SetZoom(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetZoom(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","zoom", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetZoom",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetZoom. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetZoom(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetZoom(_swigobj) (_swigobj->GetZoom()) +static PyObject *_wrap_wxStyledTextCtrl_GetZoom(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetZoom",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetZoom. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetZoom(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_GetEdgeColumn(_swigobj) (_swigobj->GetEdgeColumn()) +static PyObject *_wrap_wxStyledTextCtrl_GetEdgeColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEdgeColumn",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEdgeColumn. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextCtrl_GetEdgeColumn(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetEdgeColumn(_swigobj,_swigarg0) (_swigobj->SetEdgeColumn(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetEdgeColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","column", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetEdgeColumn",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEdgeColumn. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetEdgeColumn(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetEdgeMode(_swigobj) (_swigobj->GetEdgeMode()) +static PyObject *_wrap_wxStyledTextCtrl_GetEdgeMode(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSTC_EDGE _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEdgeMode",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEdgeMode. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxSTC_EDGE )wxStyledTextCtrl_GetEdgeMode(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_SetEdgeMode(_swigobj,_swigarg0) (_swigobj->SetEdgeMode(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetEdgeMode(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxSTC_EDGE _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","mode", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetEdgeMode",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEdgeMode. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetEdgeMode(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetEdgeColour(_swigobj) (_swigobj->GetEdgeColour()) +static PyObject *_wrap_wxStyledTextCtrl_GetEdgeColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEdgeColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEdgeColour. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxColour (wxStyledTextCtrl_GetEdgeColour(_arg0)); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxStyledTextCtrl_SetEdgeColour(_swigobj,_swigarg0) (_swigobj->SetEdgeColour(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetEdgeColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colour", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetEdgeColour",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEdgeColour. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetEdgeColour(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetLexer(_swigobj,_swigarg0) (_swigobj->SetLexer(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetLexer(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxSTC_LEX _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","lexer", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetLexer",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetLexer. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetLexer(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_GetLexer(_swigobj) (_swigobj->GetLexer()) +static PyObject *_wrap_wxStyledTextCtrl_GetLexer(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSTC_LEX _result; + wxStyledTextCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetLexer",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLexer. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxSTC_LEX )wxStyledTextCtrl_GetLexer(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextCtrl_Colourise(_swigobj,_swigarg0,_swigarg1) (_swigobj->Colourise(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_Colourise(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","start","end", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_Colourise",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_Colourise. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_Colourise(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextCtrl_SetProperty(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetProperty(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetProperty(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + wxString * _arg1; + wxString * _arg2; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","key","value", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxStyledTextCtrl_SetProperty",_kwnames,&_argo0,&_obj1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetProperty. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + if (!PyString_Check(_obj2)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetProperty(_arg0,*_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxStyledTextCtrl_SetKeywords(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetKeywords(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxStyledTextCtrl_SetKeywords(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + wxString * _arg2; + PyObject * _argo0 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","keywordSet","keywordList", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_SetKeywords",_kwnames,&_argo0,&_arg1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetKeywords. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj2)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg2 = new wxString(PyString_AsString(_obj2), PyString_Size(_obj2)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetKeywords(_arg0,_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxStyledTextCtrl_SetModEventMask(_swigobj,_swigarg0) (_swigobj->SetModEventMask(_swigarg0)) +static PyObject *_wrap_wxStyledTextCtrl_SetModEventMask(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextCtrl * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","mask", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetModEventMask",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetModEventMask. Expected _wxStyledTextCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextCtrl_SetModEventMask(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +static void *SwigwxStyledTextEventTowxCommandEvent(void *ptr) { + wxStyledTextEvent *src; + wxCommandEvent *dest; + src = (wxStyledTextEvent *) ptr; + dest = (wxCommandEvent *) src; + return (void *) dest; +} + +static void *SwigwxStyledTextEventTowxEvent(void *ptr) { + wxStyledTextEvent *src; + wxEvent *dest; + src = (wxStyledTextEvent *) ptr; + dest = (wxEvent *) src; + return (void *) dest; +} + +#define new_wxStyledTextEvent(_swigarg0,_swigarg1) (new wxStyledTextEvent(_swigarg0,_swigarg1)) +static PyObject *_wrap_new_wxStyledTextEvent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _result; + wxEventType _arg0 = (wxEventType ) 0; + int _arg1 = (int ) 0; + char *_kwnames[] = { "commandType","id", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|ii:new_wxStyledTextEvent",_kwnames,&_arg0,&_arg1)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxStyledTextEvent *)new_wxStyledTextEvent(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxStyledTextEvent_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define delete_wxStyledTextEvent(_swigobj) (delete _swigobj) +static PyObject *_wrap_delete_wxStyledTextEvent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxStyledTextEvent",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxStyledTextEvent. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + delete_wxStyledTextEvent(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetPosition(_swigobj,_swigarg0) (_swigobj->SetPosition(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetPosition(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetPosition",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetPosition. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetPosition(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetKey(_swigobj,_swigarg0) (_swigobj->SetKey(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetKey(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","k", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetKey",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetKey. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetKey(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetModifiers(_swigobj,_swigarg0) (_swigobj->SetModifiers(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetModifiers(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","m", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetModifiers",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetModifiers. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetModifiers(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetModificationType(_swigobj,_swigarg0) (_swigobj->SetModificationType(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetModificationType(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","t", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetModificationType",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetModificationType. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetModificationType(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetText(_swigobj,_swigarg0) (_swigobj->SetText(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + char * _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","t", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxStyledTextEvent_SetText",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetText. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetText(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetLength(_swigobj,_swigarg0) (_swigobj->SetLength(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetLength(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","len", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetLength",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetLength. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetLength(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetLinesAdded(_swigobj,_swigarg0) (_swigobj->SetLinesAdded(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetLinesAdded(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","num", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetLinesAdded",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetLinesAdded. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetLinesAdded(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetLine(_swigobj,_swigarg0) (_swigobj->SetLine(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetLine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","val", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetLine",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetLine. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetLine(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetFoldLevelNow(_swigobj,_swigarg0) (_swigobj->SetFoldLevelNow(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetFoldLevelNow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","val", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetFoldLevelNow",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetFoldLevelNow. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetFoldLevelNow(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetFoldLevelPrev(_swigobj,_swigarg0) (_swigobj->SetFoldLevelPrev(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetFoldLevelPrev(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","val", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetFoldLevelPrev",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetFoldLevelPrev. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetFoldLevelPrev(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetMargin(_swigobj,_swigarg0) (_swigobj->SetMargin(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetMargin(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","val", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetMargin",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetMargin. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetMargin(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetMessage(_swigobj,_swigarg0) (_swigobj->SetMessage(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetMessage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","val", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetMessage",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetMessage. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetMessage(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetWParam(_swigobj,_swigarg0) (_swigobj->SetWParam(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetWParam(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","val", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetWParam",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetWParam. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetWParam(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_SetLParam(_swigobj,_swigarg0) (_swigobj->SetLParam(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_SetLParam(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","val", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetLParam",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetLParam. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_SetLParam(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxStyledTextEvent_GetPosition(_swigobj) (_swigobj->GetPosition()) +static PyObject *_wrap_wxStyledTextEvent_GetPosition(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetPosition",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetPosition. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetPosition(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetKey(_swigobj) (_swigobj->GetKey()) +static PyObject *_wrap_wxStyledTextEvent_GetKey(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetKey",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetKey. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetKey(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetModifiers(_swigobj) (_swigobj->GetModifiers()) +static PyObject *_wrap_wxStyledTextEvent_GetModifiers(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetModifiers",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetModifiers. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetModifiers(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetModificationType(_swigobj) (_swigobj->GetModificationType()) +static PyObject *_wrap_wxStyledTextEvent_GetModificationType(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetModificationType",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetModificationType. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetModificationType(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetText(_swigobj) (_swigobj->GetText()) +static PyObject *_wrap_wxStyledTextEvent_GetText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetText",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetText. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxString (wxStyledTextEvent_GetText(_arg0)); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxStyledTextEvent_GetLength(_swigobj) (_swigobj->GetLength()) +static PyObject *_wrap_wxStyledTextEvent_GetLength(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetLength",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetLength. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetLength(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetLinesAdded(_swigobj) (_swigobj->GetLinesAdded()) +static PyObject *_wrap_wxStyledTextEvent_GetLinesAdded(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetLinesAdded",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetLinesAdded. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetLinesAdded(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetLine(_swigobj) (_swigobj->GetLine()) +static PyObject *_wrap_wxStyledTextEvent_GetLine(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetLine",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetLine. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetLine(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetFoldLevelNow(_swigobj) (_swigobj->GetFoldLevelNow()) +static PyObject *_wrap_wxStyledTextEvent_GetFoldLevelNow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetFoldLevelNow",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetFoldLevelNow. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetFoldLevelNow(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetFoldLevelPrev(_swigobj) (_swigobj->GetFoldLevelPrev()) +static PyObject *_wrap_wxStyledTextEvent_GetFoldLevelPrev(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetFoldLevelPrev",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetFoldLevelPrev. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetFoldLevelPrev(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetMargin(_swigobj) (_swigobj->GetMargin()) +static PyObject *_wrap_wxStyledTextEvent_GetMargin(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetMargin",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetMargin. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetMargin(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetMessage(_swigobj) (_swigobj->GetMessage()) +static PyObject *_wrap_wxStyledTextEvent_GetMessage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetMessage",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetMessage. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetMessage(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetWParam(_swigobj) (_swigobj->GetWParam()) +static PyObject *_wrap_wxStyledTextEvent_GetWParam(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetWParam",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetWParam. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetWParam(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetLParam(_swigobj) (_swigobj->GetLParam()) +static PyObject *_wrap_wxStyledTextEvent_GetLParam(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetLParam",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetLParam. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxStyledTextEvent_GetLParam(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetShift(_swigobj) (_swigobj->GetShift()) +static PyObject *_wrap_wxStyledTextEvent_GetShift(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetShift",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetShift. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextEvent_GetShift(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetControl(_swigobj) (_swigobj->GetControl()) +static PyObject *_wrap_wxStyledTextEvent_GetControl(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetControl",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetControl. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextEvent_GetControl(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_GetAlt(_swigobj) (_swigobj->GetAlt()) +static PyObject *_wrap_wxStyledTextEvent_GetAlt(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxStyledTextEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetAlt",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetAlt. Expected _wxStyledTextEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxStyledTextEvent_GetAlt(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxStyledTextEvent_CopyObject(_swigobj,_swigarg0) (_swigobj->CopyObject(_swigarg0)) +static PyObject *_wrap_wxStyledTextEvent_CopyObject(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxStyledTextEvent * _arg0; + wxObject * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","obj", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextEvent_CopyObject",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_CopyObject. Expected _wxStyledTextEvent_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxObject_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxStyledTextEvent_CopyObject. Expected _wxObject_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxStyledTextEvent_CopyObject(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +static PyMethodDef stc_cMethods[] = { + { "wxStyledTextEvent_CopyObject", (PyCFunction) _wrap_wxStyledTextEvent_CopyObject, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetAlt", (PyCFunction) _wrap_wxStyledTextEvent_GetAlt, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetControl", (PyCFunction) _wrap_wxStyledTextEvent_GetControl, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetShift", (PyCFunction) _wrap_wxStyledTextEvent_GetShift, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetLParam", (PyCFunction) _wrap_wxStyledTextEvent_GetLParam, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetWParam", (PyCFunction) _wrap_wxStyledTextEvent_GetWParam, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetMessage", (PyCFunction) _wrap_wxStyledTextEvent_GetMessage, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetMargin", (PyCFunction) _wrap_wxStyledTextEvent_GetMargin, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetFoldLevelPrev", (PyCFunction) _wrap_wxStyledTextEvent_GetFoldLevelPrev, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetFoldLevelNow", (PyCFunction) _wrap_wxStyledTextEvent_GetFoldLevelNow, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetLine", (PyCFunction) _wrap_wxStyledTextEvent_GetLine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetLinesAdded", (PyCFunction) _wrap_wxStyledTextEvent_GetLinesAdded, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetLength", (PyCFunction) _wrap_wxStyledTextEvent_GetLength, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetText", (PyCFunction) _wrap_wxStyledTextEvent_GetText, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetModificationType", (PyCFunction) _wrap_wxStyledTextEvent_GetModificationType, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetModifiers", (PyCFunction) _wrap_wxStyledTextEvent_GetModifiers, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetKey", (PyCFunction) _wrap_wxStyledTextEvent_GetKey, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_GetPosition", (PyCFunction) _wrap_wxStyledTextEvent_GetPosition, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetLParam", (PyCFunction) _wrap_wxStyledTextEvent_SetLParam, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetWParam", (PyCFunction) _wrap_wxStyledTextEvent_SetWParam, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetMessage", (PyCFunction) _wrap_wxStyledTextEvent_SetMessage, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetMargin", (PyCFunction) _wrap_wxStyledTextEvent_SetMargin, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetFoldLevelPrev", (PyCFunction) _wrap_wxStyledTextEvent_SetFoldLevelPrev, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetFoldLevelNow", (PyCFunction) _wrap_wxStyledTextEvent_SetFoldLevelNow, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetLine", (PyCFunction) _wrap_wxStyledTextEvent_SetLine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetLinesAdded", (PyCFunction) _wrap_wxStyledTextEvent_SetLinesAdded, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetLength", (PyCFunction) _wrap_wxStyledTextEvent_SetLength, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetText", (PyCFunction) _wrap_wxStyledTextEvent_SetText, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetModificationType", (PyCFunction) _wrap_wxStyledTextEvent_SetModificationType, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetModifiers", (PyCFunction) _wrap_wxStyledTextEvent_SetModifiers, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetKey", (PyCFunction) _wrap_wxStyledTextEvent_SetKey, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextEvent_SetPosition", (PyCFunction) _wrap_wxStyledTextEvent_SetPosition, METH_VARARGS | METH_KEYWORDS }, + { "delete_wxStyledTextEvent", (PyCFunction) _wrap_delete_wxStyledTextEvent, METH_VARARGS | METH_KEYWORDS }, + { "new_wxStyledTextEvent", (PyCFunction) _wrap_new_wxStyledTextEvent, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetModEventMask", (PyCFunction) _wrap_wxStyledTextCtrl_SetModEventMask, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetKeywords", (PyCFunction) _wrap_wxStyledTextCtrl_SetKeywords, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetProperty", (PyCFunction) _wrap_wxStyledTextCtrl_SetProperty, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_Colourise", (PyCFunction) _wrap_wxStyledTextCtrl_Colourise, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLexer", (PyCFunction) _wrap_wxStyledTextCtrl_GetLexer, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetLexer", (PyCFunction) _wrap_wxStyledTextCtrl_SetLexer, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetEdgeColour", (PyCFunction) _wrap_wxStyledTextCtrl_SetEdgeColour, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetEdgeColour", (PyCFunction) _wrap_wxStyledTextCtrl_GetEdgeColour, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetEdgeMode", (PyCFunction) _wrap_wxStyledTextCtrl_SetEdgeMode, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetEdgeMode", (PyCFunction) _wrap_wxStyledTextCtrl_GetEdgeMode, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetEdgeColumn", (PyCFunction) _wrap_wxStyledTextCtrl_SetEdgeColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetEdgeColumn", (PyCFunction) _wrap_wxStyledTextCtrl_GetEdgeColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetZoom", (PyCFunction) _wrap_wxStyledTextCtrl_GetZoom, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetZoom", (PyCFunction) _wrap_wxStyledTextCtrl_SetZoom, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ZoomOut", (PyCFunction) _wrap_wxStyledTextCtrl_ZoomOut, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ZoomIn", (PyCFunction) _wrap_wxStyledTextCtrl_ZoomIn, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetFoldFlags", (PyCFunction) _wrap_wxStyledTextCtrl_SetFoldFlags, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_EnsureVisible", (PyCFunction) _wrap_wxStyledTextCtrl_EnsureVisible, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ToggleFold", (PyCFunction) _wrap_wxStyledTextCtrl_ToggleFold, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetFoldExpanded", (PyCFunction) _wrap_wxStyledTextCtrl_GetFoldExpanded, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetFoldExpanded", (PyCFunction) _wrap_wxStyledTextCtrl_SetFoldExpanded, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLineVisible", (PyCFunction) _wrap_wxStyledTextCtrl_GetLineVisible, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_HideLines", (PyCFunction) _wrap_wxStyledTextCtrl_HideLines, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ShowLines", (PyCFunction) _wrap_wxStyledTextCtrl_ShowLines, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetFoldParent", (PyCFunction) _wrap_wxStyledTextCtrl_GetFoldParent, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLastChild", (PyCFunction) _wrap_wxStyledTextCtrl_GetLastChild, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetFoldLevel", (PyCFunction) _wrap_wxStyledTextCtrl_GetFoldLevel, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetFoldLevel", (PyCFunction) _wrap_wxStyledTextCtrl_SetFoldLevel, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_DocLineFromVisible", (PyCFunction) _wrap_wxStyledTextCtrl_DocLineFromVisible, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_VisibleFromDocLine", (PyCFunction) _wrap_wxStyledTextCtrl_VisibleFromDocLine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetDocument", (PyCFunction) _wrap_wxStyledTextCtrl_SetDocument, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetDocument", (PyCFunction) _wrap_wxStyledTextCtrl_GetDocument, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_FormatRange", (PyCFunction) _wrap_wxStyledTextCtrl_FormatRange, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CmdKeyExecute", (PyCFunction) _wrap_wxStyledTextCtrl_CmdKeyExecute, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CmdKeyClearAll", (PyCFunction) _wrap_wxStyledTextCtrl_CmdKeyClearAll, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CmdKeyClear", (PyCFunction) _wrap_wxStyledTextCtrl_CmdKeyClear, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CmdKeyAssign", (PyCFunction) _wrap_wxStyledTextCtrl_CmdKeyAssign, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CallTipSetBackground", (PyCFunction) _wrap_wxStyledTextCtrl_CallTipSetBackground, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CallTipSetHighlight", (PyCFunction) _wrap_wxStyledTextCtrl_CallTipSetHighlight, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CallTipPosAtStart", (PyCFunction) _wrap_wxStyledTextCtrl_CallTipPosAtStart, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CallTipActive", (PyCFunction) _wrap_wxStyledTextCtrl_CallTipActive, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CallTipCancel", (PyCFunction) _wrap_wxStyledTextCtrl_CallTipCancel, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CallTipShow", (PyCFunction) _wrap_wxStyledTextCtrl_CallTipShow, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AutoCompSelect", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompSelect, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AutoCompGetSeparator", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompGetSeparator, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AutoCompSetSeparator", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompSetSeparator, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AutoCompStopChars", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompStopChars, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AutoCompComplete", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompComplete, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AutoCompPosAtStart", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompPosAtStart, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AutoCompActive", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompActive, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AutoCompCancel", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompCancel, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AutoCompShow", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompShow, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_IndicatorSetColour", (PyCFunction) _wrap_wxStyledTextCtrl_IndicatorSetColour, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_IndicatorGetStyle", (PyCFunction) _wrap_wxStyledTextCtrl_IndicatorGetStyle, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_IndicatorSetStyle", (PyCFunction) _wrap_wxStyledTextCtrl_IndicatorSetStyle, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerDeleteHandle", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerDeleteHandle, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerLineFromHandle", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerLineFromHandle, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerGetPrevLine", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerGetPrevLine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerGetNextLine", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerGetNextLine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerGet", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerGet, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerDeleteAll", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerDeleteAll, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerDelete", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerDelete, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerAdd", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerAdd, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerSetBackground", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerSetBackground, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerSetForeground", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerSetForeground, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerSetType", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerSetType, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_MarkerDefine", (PyCFunction) _wrap_wxStyledTextCtrl_MarkerDefine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_BraceMatch", (PyCFunction) _wrap_wxStyledTextCtrl_BraceMatch, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_BraceBadlight", (PyCFunction) _wrap_wxStyledTextCtrl_BraceBadlight, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_BraceHighlight", (PyCFunction) _wrap_wxStyledTextCtrl_BraceHighlight, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetUsePop", (PyCFunction) _wrap_wxStyledTextCtrl_SetUsePop, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetWordChars", (PyCFunction) _wrap_wxStyledTextCtrl_SetWordChars, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLineIndentationPos", (PyCFunction) _wrap_wxStyledTextCtrl_GetLineIndentationPos, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLineIndentation", (PyCFunction) _wrap_wxStyledTextCtrl_GetLineIndentation, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetLineIndentation", (PyCFunction) _wrap_wxStyledTextCtrl_SetLineIndentation, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetUseTabs", (PyCFunction) _wrap_wxStyledTextCtrl_SetUseTabs, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetIndent", (PyCFunction) _wrap_wxStyledTextCtrl_SetIndent, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetTabWidth", (PyCFunction) _wrap_wxStyledTextCtrl_SetTabWidth, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetBufferedDraw", (PyCFunction) _wrap_wxStyledTextCtrl_SetBufferedDraw, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetCaretPeriod", (PyCFunction) _wrap_wxStyledTextCtrl_SetCaretPeriod, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetCaretPeriod", (PyCFunction) _wrap_wxStyledTextCtrl_GetCaretPeriod, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetCaretForeground", (PyCFunction) _wrap_wxStyledTextCtrl_SetCaretForeground, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetSelectionBackground", (PyCFunction) _wrap_wxStyledTextCtrl_SetSelectionBackground, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetSelectionForeground", (PyCFunction) _wrap_wxStyledTextCtrl_SetSelectionForeground, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetMarginSensitive", (PyCFunction) _wrap_wxStyledTextCtrl_GetMarginSensitive, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetMarginSensitive", (PyCFunction) _wrap_wxStyledTextCtrl_SetMarginSensitive, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetMarginMask", (PyCFunction) _wrap_wxStyledTextCtrl_GetMarginMask, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetMarginMask", (PyCFunction) _wrap_wxStyledTextCtrl_SetMarginMask, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetMarginWidth", (PyCFunction) _wrap_wxStyledTextCtrl_GetMarginWidth, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetMarginWidth", (PyCFunction) _wrap_wxStyledTextCtrl_SetMarginWidth, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetMarginType", (PyCFunction) _wrap_wxStyledTextCtrl_GetMarginType, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetMarginType", (PyCFunction) _wrap_wxStyledTextCtrl_SetMarginType, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetMargins", (PyCFunction) _wrap_wxStyledTextCtrl_SetMargins, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetRightMargin", (PyCFunction) _wrap_wxStyledTextCtrl_GetRightMargin, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLeftMargin", (PyCFunction) _wrap_wxStyledTextCtrl_GetLeftMargin, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetUnderline", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetUnderline, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetEOLFilled", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetEOLFilled, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetSize", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetSize, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetFaceName", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetFaceName, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetItalic", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetItalic, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetBold", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetBold, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetFontAttr", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetFontAttr, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetFont", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetFont, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetBackground", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetBackground, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetForeground", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetForeground, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleSetSpec", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetSpec, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleResetDefault", (PyCFunction) _wrap_wxStyledTextCtrl_StyleResetDefault, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StyleClearAll", (PyCFunction) _wrap_wxStyledTextCtrl_StyleClearAll, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLineState", (PyCFunction) _wrap_wxStyledTextCtrl_GetLineState, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetLineState", (PyCFunction) _wrap_wxStyledTextCtrl_SetLineState, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetStyleBytes", (PyCFunction) _wrap_wxStyledTextCtrl_SetStyleBytes, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetStyleFor", (PyCFunction) _wrap_wxStyledTextCtrl_SetStyleFor, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_StartStyling", (PyCFunction) _wrap_wxStyledTextCtrl_StartStyling, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetEndStyled", (PyCFunction) _wrap_wxStyledTextCtrl_GetEndStyled, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ConvertEOL", (PyCFunction) _wrap_wxStyledTextCtrl_ConvertEOL, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetViewEOL", (PyCFunction) _wrap_wxStyledTextCtrl_SetViewEOL, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetViewEOL", (PyCFunction) _wrap_wxStyledTextCtrl_GetViewEOL, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetEOLMode", (PyCFunction) _wrap_wxStyledTextCtrl_SetEOLMode, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetEOLMode", (PyCFunction) _wrap_wxStyledTextCtrl_GetEOLMode, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetViewWhitespace", (PyCFunction) _wrap_wxStyledTextCtrl_SetViewWhitespace, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetViewWhitespace", (PyCFunction) _wrap_wxStyledTextCtrl_GetViewWhitespace, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SearchPrev", (PyCFunction) _wrap_wxStyledTextCtrl_SearchPrev, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SearchNext", (PyCFunction) _wrap_wxStyledTextCtrl_SearchNext, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SearchAnchor", (PyCFunction) _wrap_wxStyledTextCtrl_SearchAnchor, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_FindText", (PyCFunction) _wrap_wxStyledTextCtrl_FindText, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetUseHorizontalScrollBar", (PyCFunction) _wrap_wxStyledTextCtrl_GetUseHorizontalScrollBar, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetUseHorizontalScrollBar", (PyCFunction) _wrap_wxStyledTextCtrl_SetUseHorizontalScrollBar, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_IsSelectionRectangle", (PyCFunction) _wrap_wxStyledTextCtrl_IsSelectionRectangle, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLinesOnScreen", (PyCFunction) _wrap_wxStyledTextCtrl_GetLinesOnScreen, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetSelectionType", (PyCFunction) _wrap_wxStyledTextCtrl_GetSelectionType, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetCaretPolicy", (PyCFunction) _wrap_wxStyledTextCtrl_SetCaretPolicy, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_EnsureCaretVisible", (PyCFunction) _wrap_wxStyledTextCtrl_EnsureCaretVisible, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ScrollToColumn", (PyCFunction) _wrap_wxStyledTextCtrl_ScrollToColumn, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ScrollToLine", (PyCFunction) _wrap_wxStyledTextCtrl_ScrollToLine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ScrollBy", (PyCFunction) _wrap_wxStyledTextCtrl_ScrollBy, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_PageMove", (PyCFunction) _wrap_wxStyledTextCtrl_PageMove, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ChangePosition", (PyCFunction) _wrap_wxStyledTextCtrl_ChangePosition, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GotoLine", (PyCFunction) _wrap_wxStyledTextCtrl_GotoLine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GotoPos", (PyCFunction) _wrap_wxStyledTextCtrl_GotoPos, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetAnchor", (PyCFunction) _wrap_wxStyledTextCtrl_SetAnchor, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetCurrentPosition", (PyCFunction) _wrap_wxStyledTextCtrl_SetCurrentPosition, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SelectAll", (PyCFunction) _wrap_wxStyledTextCtrl_SelectAll, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetAnchor", (PyCFunction) _wrap_wxStyledTextCtrl_GetAnchor, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetCurrentPos", (PyCFunction) _wrap_wxStyledTextCtrl_GetCurrentPos, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_PointFromPosition", (PyCFunction) _wrap_wxStyledTextCtrl_PointFromPosition, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_LineFromPoint", (PyCFunction) _wrap_wxStyledTextCtrl_LineFromPoint, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_PositionFromPoint", (PyCFunction) _wrap_wxStyledTextCtrl_PositionFromPoint, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetCurrentLine", (PyCFunction) _wrap_wxStyledTextCtrl_GetCurrentLine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetCurrentLineText", (PyCFunction) _wrap_wxStyledTextCtrl_GetCurrentLineText, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLineLength", (PyCFunction) _wrap_wxStyledTextCtrl_GetLineLength, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLineLengthAtPos", (PyCFunction) _wrap_wxStyledTextCtrl_GetLineLengthAtPos, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLineStartPos", (PyCFunction) _wrap_wxStyledTextCtrl_GetLineStartPos, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLineFromPos", (PyCFunction) _wrap_wxStyledTextCtrl_GetLineFromPos, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetRect", (PyCFunction) _wrap_wxStyledTextCtrl_GetRect, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLineCount", (PyCFunction) _wrap_wxStyledTextCtrl_GetLineCount, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetModified", (PyCFunction) _wrap_wxStyledTextCtrl_GetModified, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetFirstVisibleLine", (PyCFunction) _wrap_wxStyledTextCtrl_GetFirstVisibleLine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetTextLength", (PyCFunction) _wrap_wxStyledTextCtrl_GetTextLength, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetHideSelection", (PyCFunction) _wrap_wxStyledTextCtrl_GetHideSelection, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_HideSelection", (PyCFunction) _wrap_wxStyledTextCtrl_HideSelection, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetSelectedText", (PyCFunction) _wrap_wxStyledTextCtrl_GetSelectedText, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetSelection", (PyCFunction) _wrap_wxStyledTextCtrl_SetSelection, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetSelection", (PyCFunction) _wrap_wxStyledTextCtrl_GetSelection, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_EndUndoAction", (PyCFunction) _wrap_wxStyledTextCtrl_EndUndoAction, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_BeginUndoAction", (PyCFunction) _wrap_wxStyledTextCtrl_BeginUndoAction, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetUndoCollection", (PyCFunction) _wrap_wxStyledTextCtrl_GetUndoCollection, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetUndoCollection", (PyCFunction) _wrap_wxStyledTextCtrl_SetUndoCollection, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CanRedo", (PyCFunction) _wrap_wxStyledTextCtrl_CanRedo, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_Redo", (PyCFunction) _wrap_wxStyledTextCtrl_Redo, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_EmptyUndoBuffer", (PyCFunction) _wrap_wxStyledTextCtrl_EmptyUndoBuffer, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CanUndo", (PyCFunction) _wrap_wxStyledTextCtrl_CanUndo, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_Undo", (PyCFunction) _wrap_wxStyledTextCtrl_Undo, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ClearClipbrd", (PyCFunction) _wrap_wxStyledTextCtrl_ClearClipbrd, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_CanPaste", (PyCFunction) _wrap_wxStyledTextCtrl_CanPaste, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_Paste", (PyCFunction) _wrap_wxStyledTextCtrl_Paste, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_Copy", (PyCFunction) _wrap_wxStyledTextCtrl_Copy, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_Cut", (PyCFunction) _wrap_wxStyledTextCtrl_Cut, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetStyleBits", (PyCFunction) _wrap_wxStyledTextCtrl_GetStyleBits, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetStyleBits", (PyCFunction) _wrap_wxStyledTextCtrl_SetStyleBits, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetStyleAt", (PyCFunction) _wrap_wxStyledTextCtrl_GetStyleAt, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetCharAt", (PyCFunction) _wrap_wxStyledTextCtrl_GetCharAt, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ClearAll", (PyCFunction) _wrap_wxStyledTextCtrl_ClearAll, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_InsertText", (PyCFunction) _wrap_wxStyledTextCtrl_InsertText, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AddStyledText", (PyCFunction) _wrap_wxStyledTextCtrl_AddStyledText, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_AddText", (PyCFunction) _wrap_wxStyledTextCtrl_AddText, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetStyledTextRange", (PyCFunction) _wrap_wxStyledTextCtrl_GetStyledTextRange, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetTextRange", (PyCFunction) _wrap_wxStyledTextCtrl_GetTextRange, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetReadOnly", (PyCFunction) _wrap_wxStyledTextCtrl_GetReadOnly, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetReadOnly", (PyCFunction) _wrap_wxStyledTextCtrl_SetReadOnly, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_ReplaceSelection", (PyCFunction) _wrap_wxStyledTextCtrl_ReplaceSelection, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetLine", (PyCFunction) _wrap_wxStyledTextCtrl_GetLine, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_SetText", (PyCFunction) _wrap_wxStyledTextCtrl_SetText, METH_VARARGS | METH_KEYWORDS }, + { "wxStyledTextCtrl_GetText", (PyCFunction) _wrap_wxStyledTextCtrl_GetText, METH_VARARGS | METH_KEYWORDS }, + { "new_wxStyledTextCtrl", (PyCFunction) _wrap_new_wxStyledTextCtrl, METH_VARARGS | METH_KEYWORDS }, + { NULL, NULL } +}; +#ifdef __cplusplus +} +#endif +/* + * This table is used by the pointer type-checker + */ +static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { + { "_wxAcceleratorTable","_class_wxAcceleratorTable",0}, + { "_wxEvent","_class_wxStyledTextEvent",SwigwxStyledTextEventTowxEvent}, + { "_wxEvent","_wxStyledTextEvent",SwigwxStyledTextEventTowxEvent}, + { "_wxEvent","_class_wxEvent",0}, + { "_class_wxActivateEvent","_wxActivateEvent",0}, + { "_signed_long","_long",0}, + { "_wxMenuEvent","_class_wxMenuEvent",0}, + { "_class_wxJPEGHandler","_wxJPEGHandler",0}, + { "_wxPyBitmapDataObject","_class_wxPyBitmapDataObject",0}, + { "_wxBitmapDataObject","_class_wxBitmapDataObject",0}, + { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, + { "_wxBMPHandler","_class_wxBMPHandler",0}, + { "_wxImage","_class_wxImage",0}, + { "_wxFlexGridSizer","_class_wxFlexGridSizer",0}, + { "_wxPrintQuality","_wxCoord",0}, + { "_wxPrintQuality","_int",0}, + { "_wxPrintQuality","_signed_int",0}, + { "_wxPrintQuality","_unsigned_int",0}, + { "_wxPrintQuality","_wxWindowID",0}, + { "_wxPrintQuality","_uint",0}, + { "_wxPrintQuality","_EBool",0}, + { "_wxPrintQuality","_size_t",0}, + { "_class_wxCustomDataObject","_wxCustomDataObject",0}, + { "_wxSpinCtrl","_class_wxSpinCtrl",0}, + { "_wxFontData","_class_wxFontData",0}, + { "_class_wxRegionIterator","_wxRegionIterator",0}, + { "_class_wxPyTextDropTarget","_wxPyTextDropTarget",0}, + { "_class_wxMenuBar","_wxMenuBar",0}, + { "_class_wxPyTreeItemData","_wxPyTreeItemData",0}, + { "_class_wxStaticBoxSizer","_wxStaticBoxSizer",0}, + { "_class_wxEvtHandler","_class_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxEvtHandler}, + { "_class_wxEvtHandler","_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxEvtHandler}, + { "_class_wxEvtHandler","_wxEvtHandler",0}, + { "_wxPaintEvent","_class_wxPaintEvent",0}, + { "_wxGIFHandler","_class_wxGIFHandler",0}, + { "_wxPySizer","_class_wxPySizer",0}, + { "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0}, + { "_wxCursor","_class_wxCursor",0}, + { "_wxNotifyEvent","_class_wxNotifyEvent",0}, + { "_wxPyTreeCtrl","_class_wxPyTreeCtrl",0}, + { "_wxImageHandler","_class_wxImageHandler",0}, + { "_wxLog","_class_wxLog",0}, + { "_class_wxToolBarBase","_wxToolBarBase",0}, + { "_wxMask","_class_wxMask",0}, + { "_wxToolTip","_class_wxToolTip",0}, + { "_wxPNGHandler","_class_wxPNGHandler",0}, + { "_class_wxStyledTextCtrl","_wxStyledTextCtrl",0}, + { "_class_wxColourData","_wxColourData",0}, + { "_class_wxPageSetupDialogData","_wxPageSetupDialogData",0}, + { "_wxPrinter","_class_wxPrinter",0}, + { "_wxPen","_class_wxPen",0}, + { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, + { "_class_wxNotebookSizer","_wxNotebookSizer",0}, + { "_byte","_unsigned_char",0}, + { "_wxDataObject","_class_wxDataObject",0}, + { "_class_wxPyFontEnumerator","_wxPyFontEnumerator",0}, + { "_wxStaticBox","_class_wxStaticBox",0}, + { "_wxPyDataObjectSimple","_class_wxPyDataObjectSimple",0}, + { "_wxPyDropSource","_class_wxPyDropSource",0}, + { "_wxChoice","_class_wxChoice",0}, + { "_wxSlider","_class_wxSlider",0}, + { "_wxNotebookEvent","_class_wxNotebookEvent",0}, + { "_wxPyPrintout","_class_wxPyPrintout",0}, + { "_long","_unsigned_long",0}, + { "_long","_signed_long",0}, + { "_wxImageList","_class_wxImageList",0}, + { "_wxDataObjectSimple","_class_wxDataObjectSimple",0}, + { "_wxDropFilesEvent","_class_wxDropFilesEvent",0}, + { "_wxBitmapButton","_class_wxBitmapButton",0}, + { "_wxSashWindow","_class_wxSashWindow",0}, + { "_class_wxSizer","_wxSizer",0}, + { "_class_wxTIFFHandler","_wxTIFFHandler",0}, + { "_class_wxPrintDialogData","_wxPrintDialogData",0}, + { "_wxGridSizer","_class_wxGridSizer",0}, + { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, + { "_class_wxClipboard","_wxClipboard",0}, + { "_class_wxGauge","_wxGauge",0}, + { "_class_wxSashEvent","_wxSashEvent",0}, + { "_wxDC","_class_wxDC",0}, + { "_wxSizerItem","_class_wxSizerItem",0}, + { "_class_wxBitmapDataObject","_wxBitmapDataObject",0}, + { "_wxListEvent","_class_wxListEvent",0}, + { "_class_wxSingleChoiceDialog","_wxSingleChoiceDialog",0}, + { "_wxProgressDialog","_class_wxProgressDialog",0}, + { "_class_wxBMPHandler","_wxBMPHandler",0}, + { "_wxPrintPreview","_class_wxPrintPreview",0}, + { "_class_wxFlexGridSizer","_wxFlexGridSizer",0}, + { "_wxSpinEvent","_class_wxSpinEvent",0}, + { "_wxSashLayoutWindow","_class_wxSashLayoutWindow",0}, + { "_size_t","_wxCoord",0}, + { "_size_t","_wxPrintQuality",0}, + { "_size_t","_unsigned_int",0}, + { "_size_t","_int",0}, + { "_size_t","_wxWindowID",0}, + { "_size_t","_uint",0}, + { "_class_wxRealPoint","_wxRealPoint",0}, + { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, + { "_wxPNMHandler","_class_wxPNMHandler",0}, + { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, + { "_wxLogGui","_class_wxLogGui",0}, + { "_class_wxMenuItem","_wxMenuItem",0}, + { "_class_wxPaintEvent","_wxPaintEvent",0}, + { "_wxSysColourChangedEvent","_class_wxSysColourChangedEvent",0}, + { "_class_wxStatusBar","_wxStatusBar",0}, + { "_class_wxGIFHandler","_wxGIFHandler",0}, + { "_class_wxPySizer","_wxPySizer",0}, + { "_class_wxPostScriptDC","_wxPostScriptDC",0}, + { "_wxPanel","_class_wxPanel",0}, + { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, + { "_wxCheckBox","_class_wxCheckBox",0}, + { "_class_wxPyTreeCtrl","_wxPyTreeCtrl",0}, + { "_wxPyEvent","_class_wxPyEvent",0}, + { "_wxTextCtrl","_class_wxTextCtrl",0}, + { "_class_wxMask","_wxMask",0}, + { "_wxTextDataObject","_class_wxTextDataObject",0}, + { "_class_wxKeyEvent","_wxKeyEvent",0}, + { "_class_wxToolTip","_wxToolTip",0}, + { "_class_wxPNGHandler","_wxPNGHandler",0}, + { "_wxColour","_class_wxColour",0}, + { "_class_wxDialog","_wxDialog",0}, + { "_wxBusyCursor","_class_wxBusyCursor",0}, + { "_wxPageSetupDialog","_class_wxPageSetupDialog",0}, + { "_class_wxPrinter","_wxPrinter",0}, + { "_class_wxFileDataObject","_wxFileDataObject",0}, + { "_wxIdleEvent","_class_wxIdleEvent",0}, + { "_class_wxUpdateUIEvent","_wxUpdateUIEvent",0}, + { "_wxToolBar","_class_wxToolBar",0}, + { "_class_wxDataObject","_wxDataObject",0}, + { "_wxCaret","_class_wxCaret",0}, + { "_wxStaticLine","_class_wxStaticLine",0}, + { "_class_wxLayoutAlgorithm","_wxLayoutAlgorithm",0}, + { "_wxBrush","_class_wxBrush",0}, + { "_wxMiniFrame","_class_wxMiniFrame",0}, + { "_class_wxNotebookEvent","_wxNotebookEvent",0}, + { "_class_wxPyPrintout","_wxPyPrintout",0}, + { "_wxDataFormat","_class_wxDataFormat",0}, + { "_class_wxDataObjectSimple","_wxDataObjectSimple",0}, + { "_class_wxSashWindow","_wxSashWindow",0}, + { "_wxShowEvent","_class_wxShowEvent",0}, + { "_uint","_wxCoord",0}, + { "_uint","_wxPrintQuality",0}, + { "_uint","_size_t",0}, + { "_uint","_unsigned_int",0}, + { "_uint","_int",0}, + { "_uint","_wxWindowID",0}, + { "_wxChar","_char",0}, + { "_wxPyValidator","_class_wxPyValidator",0}, + { "_class_wxEvent","_class_wxStyledTextEvent",SwigwxStyledTextEventTowxEvent}, + { "_class_wxEvent","_wxStyledTextEvent",SwigwxStyledTextEventTowxEvent}, + { "_class_wxEvent","_wxEvent",0}, + { "_wxCheckListBox","_class_wxCheckListBox",0}, + { "_wxSplitterEvent","_class_wxSplitterEvent",0}, + { "_wxRect","_class_wxRect",0}, + { "_wxCommandEvent","_class_wxStyledTextEvent",SwigwxStyledTextEventTowxCommandEvent}, + { "_wxCommandEvent","_wxStyledTextEvent",SwigwxStyledTextEventTowxCommandEvent}, + { "_wxCommandEvent","_class_wxCommandEvent",0}, + { "_wxSizeEvent","_class_wxSizeEvent",0}, + { "_class_wxLogWindow","_wxLogWindow",0}, + { "_class_wxImage","_wxImage",0}, + { "_wxPoint","_class_wxPoint",0}, + { "_class_wxSashLayoutWindow","_wxSashLayoutWindow",0}, + { "_class_wxButton","_wxButton",0}, + { "_wxRadioBox","_class_wxRadioBox",0}, + { "_class_wxSpinCtrl","_wxSpinCtrl",0}, + { "_class_wxFontData","_wxFontData",0}, + { "_class_wxPNMHandler","_wxPNMHandler",0}, + { "_wxBoxSizer","_class_wxBoxSizer",0}, + { "_char","_wxChar",0}, + { "_wxBitmap","_class_wxBitmap",0}, + { "_wxPrintDialog","_class_wxPrintDialog",0}, + { "_wxWindowDC","_class_wxWindowDC",0}, + { "_wxTimerEvent","_class_wxTimerEvent",0}, + { "_wxPyTimer","_class_wxPyTimer",0}, + { "_wxScrollBar","_class_wxScrollBar",0}, + { "_wxSpinButton","_class_wxSpinButton",0}, + { "_wxColourDialog","_class_wxColourDialog",0}, + { "_wxPrintData","_class_wxPrintData",0}, + { "_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0}, + { "_class_wxNotifyEvent","_wxNotifyEvent",0}, + { "_wxMessageDialog","_class_wxMessageDialog",0}, + { "_class_wxValidator","_wxValidator",0}, + { "_class_wxPyEvent","_wxPyEvent",0}, + { "_wxTextEntryDialog","_class_wxTextEntryDialog",0}, + { "_class_wxIconizeEvent","_wxIconizeEvent",0}, + { "_class_wxStaticBitmap","_wxStaticBitmap",0}, + { "_class_wxBusyCursor","_wxBusyCursor",0}, + { "_wxToolBarSimple","_class_wxToolBarSimple",0}, + { "_wxMDIChildFrame","_class_wxMDIChildFrame",0}, + { "_wxListItem","_class_wxListItem",0}, + { "_class_wxToolBar","_wxToolBar",0}, + { "_wxDropTarget","_class_wxDropTarget",0}, + { "_class_wxStaticLine","_wxStaticLine",0}, + { "_wxScrollEvent","_class_wxScrollEvent",0}, + { "_wxToolBarToolBase","_class_wxToolBarToolBase",0}, + { "_wxCalculateLayoutEvent","_class_wxCalculateLayoutEvent",0}, + { "_EBool","_wxCoord",0}, + { "_EBool","_wxPrintQuality",0}, + { "_EBool","_signed_int",0}, + { "_EBool","_int",0}, + { "_EBool","_wxWindowID",0}, + { "_class_wxRegion","_wxRegion",0}, + { "_class_wxDataFormat","_wxDataFormat",0}, + { "_class_wxDropFilesEvent","_wxDropFilesEvent",0}, + { "_wxWindowDestroyEvent","_class_wxWindowDestroyEvent",0}, + { "_class_wxPreviewFrame","_wxPreviewFrame",0}, + { "_wxStaticText","_class_wxStaticText",0}, + { "_wxFont","_class_wxFont",0}, + { "_class_wxPyDropTarget","_wxPyDropTarget",0}, + { "_wxCloseEvent","_class_wxCloseEvent",0}, + { "_class_wxSplitterEvent","_wxSplitterEvent",0}, + { "_wxNotebook","_class_wxNotebook",0}, + { "_unsigned_long","_long",0}, + { "_class_wxRect","_wxRect",0}, + { "_class_wxDC","_wxDC",0}, + { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, + { "_wxGenericDragImage","_class_wxGenericDragImage",0}, + { "_class_wxProgressDialog","_wxProgressDialog",0}, + { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, + { "_wxPyApp","_class_wxPyApp",0}, + { "_class_wxWindowCreateEvent","_wxWindowCreateEvent",0}, + { "_wxLogTextCtrl","_class_wxLogTextCtrl",0}, + { "_wxMDIParentFrame","_class_wxMDIParentFrame",0}, + { "_class_wxTreeEvent","_wxTreeEvent",0}, + { "_class_wxDirDialog","_wxDirDialog",0}, + { "_wxFocusEvent","_class_wxFocusEvent",0}, + { "_wxMaximizeEvent","_class_wxMaximizeEvent",0}, + { "_class_wxTimerEvent","_wxTimerEvent",0}, + { "_class_wxPyTimer","_wxPyTimer",0}, + { "_class_wxSpinButton","_wxSpinButton",0}, + { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, + { "_class_wxPanel","_wxPanel",0}, + { "_class_wxCheckBox","_wxCheckBox",0}, + { "_wxComboBox","_class_wxComboBox",0}, + { "_wxRadioButton","_class_wxRadioButton",0}, + { "_class_wxMessageDialog","_wxMessageDialog",0}, + { "_signed_int","_wxCoord",0}, + { "_signed_int","_wxPrintQuality",0}, + { "_signed_int","_EBool",0}, + { "_signed_int","_wxWindowID",0}, + { "_signed_int","_int",0}, + { "_class_wxTextCtrl","_wxTextCtrl",0}, + { "_class_wxListItemAttr","_wxListItemAttr",0}, + { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, + { "_class_wxTextDataObject","_wxTextDataObject",0}, + { "_wxMenu","_class_wxMenu",0}, + { "_class_wxMoveEvent","_wxMoveEvent",0}, + { "_wxListBox","_class_wxListBox",0}, + { "_wxScreenDC","_class_wxScreenDC",0}, + { "_class_wxToolBarSimple","_wxToolBarSimple",0}, + { "_class_wxMDIChildFrame","_wxMDIChildFrame",0}, + { "_WXTYPE","_short",0}, + { "_WXTYPE","_signed_short",0}, + { "_WXTYPE","_unsigned_short",0}, + { "_wxFileDialog","_class_wxFileDialog",0}, + { "_class_wxDropTarget","_wxDropTarget",0}, + { "_class_wxCaret","_wxCaret",0}, + { "_class_wxMDIClientWindow","_wxMDIClientWindow",0}, + { "_class_wxBrush","_wxBrush",0}, + { "_wxTipProvider","_class_wxTipProvider",0}, + { "_unsigned_short","_WXTYPE",0}, + { "_unsigned_short","_short",0}, + { "_class_wxWindow","_class_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxWindow}, + { "_class_wxWindow","_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxWindow}, + { "_class_wxWindow","_wxWindow",0}, + { "_class_wxLogStderr","_wxLogStderr",0}, + { "_wxSplitterWindow","_class_wxSplitterWindow",0}, + { "_class_wxStyledTextEvent","_wxStyledTextEvent",0}, + { "_class_wxStaticText","_wxStaticText",0}, + { "_wxPrintDialogData","_class_wxPrintDialogData",0}, + { "_class_wxFont","_wxFont",0}, + { "_wxClipboard","_class_wxClipboard",0}, + { "_class_wxPyValidator","_wxPyValidator",0}, + { "_class_wxCloseEvent","_wxCloseEvent",0}, + { "_wxSashEvent","_class_wxSashEvent",0}, + { "_wxBusyInfo","_class_wxBusyInfo",0}, + { "_class_wxMenuEvent","_wxMenuEvent",0}, + { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0}, + { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0}, + { "_wxClientDC","_class_wxClientDC",0}, + { "_wxMouseEvent","_class_wxMouseEvent",0}, + { "_class_wxGenericDragImage","_wxGenericDragImage",0}, + { "_wxListCtrl","_class_wxListCtrl",0}, + { "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0}, + { "_class_wxPoint","_wxPoint",0}, + { "_wxRealPoint","_class_wxRealPoint",0}, + { "_class_wxRadioBox","_wxRadioBox",0}, + { "_class_wxBoxSizer","_wxBoxSizer",0}, + { "_signed_short","_WXTYPE",0}, + { "_signed_short","_short",0}, + { "_wxMemoryDC","_class_wxMemoryDC",0}, + { "_wxPyTextDataObject","_class_wxPyTextDataObject",0}, + { "_class_wxPrintDialog","_wxPrintDialog",0}, + { "_wxPaintDC","_class_wxPaintDC",0}, + { "_class_wxWindowDC","_wxWindowDC",0}, + { "_class_wxFocusEvent","_wxFocusEvent",0}, + { "_class_wxMaximizeEvent","_wxMaximizeEvent",0}, + { "_wxStatusBar","_class_wxStatusBar",0}, + { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, + { "_class_wxCursor","_wxCursor",0}, + { "_wxPostScriptDC","_class_wxPostScriptDC",0}, + { "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0}, + { "_class_wxImageHandler","_wxImageHandler",0}, + { "_wxScrolledWindow","_class_wxScrolledWindow",0}, + { "_class_wxLog","_wxLog",0}, + { "_wxTreeItemId","_class_wxTreeItemId",0}, + { "_unsigned_char","_byte",0}, + { "_class_wxMenu","_wxMenu",0}, + { "_wxControl","_class_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxControl}, + { "_wxControl","_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxControl}, + { "_wxControl","_class_wxControl",0}, + { "_class_wxListBox","_wxListBox",0}, + { "_unsigned_int","_wxCoord",0}, + { "_unsigned_int","_wxPrintQuality",0}, + { "_unsigned_int","_size_t",0}, + { "_unsigned_int","_uint",0}, + { "_unsigned_int","_wxWindowID",0}, + { "_unsigned_int","_int",0}, + { "_wxIcon","_class_wxIcon",0}, + { "_wxDialog","_class_wxDialog",0}, + { "_class_wxListItem","_wxListItem",0}, + { "_class_wxPen","_wxPen",0}, + { "_class_wxFileDialog","_wxFileDialog",0}, + { "_wxQueryLayoutInfoEvent","_class_wxQueryLayoutInfoEvent",0}, + { "_short","_WXTYPE",0}, + { "_short","_unsigned_short",0}, + { "_short","_signed_short",0}, + { "_class_wxStaticBox","_wxStaticBox",0}, + { "_wxLayoutAlgorithm","_class_wxLayoutAlgorithm",0}, + { "_class_wxPyDataObjectSimple","_wxPyDataObjectSimple",0}, + { "_class_wxPyDropSource","_wxPyDropSource",0}, + { "_class_wxScrollEvent","_wxScrollEvent",0}, + { "_wxJoystickEvent","_class_wxJoystickEvent",0}, + { "_class_wxChoice","_wxChoice",0}, + { "_class_wxSlider","_wxSlider",0}, + { "_class_wxCalculateLayoutEvent","_wxCalculateLayoutEvent",0}, + { "_class_wxImageList","_wxImageList",0}, + { "_class_wxBitmapButton","_wxBitmapButton",0}, + { "_wxPyTipProvider","_class_wxPyTipProvider",0}, + { "_wxFrame","_class_wxFrame",0}, + { "_wxPCXHandler","_class_wxPCXHandler",0}, + { "_class_wxGridSizer","_wxGridSizer",0}, + { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, + { "_class_wxNotebook","_wxNotebook",0}, + { "_wxJPEGHandler","_class_wxJPEGHandler",0}, + { "_wxWindowID","_wxCoord",0}, + { "_wxWindowID","_wxPrintQuality",0}, + { "_wxWindowID","_size_t",0}, + { "_wxWindowID","_EBool",0}, + { "_wxWindowID","_uint",0}, + { "_wxWindowID","_int",0}, + { "_wxWindowID","_signed_int",0}, + { "_wxWindowID","_unsigned_int",0}, + { "_class_wxScrollWinEvent","_wxScrollWinEvent",0}, + { "_class_wxSizerItem","_wxSizerItem",0}, + { "_int","_wxCoord",0}, + { "_int","_wxPrintQuality",0}, + { "_int","_size_t",0}, + { "_int","_EBool",0}, + { "_int","_uint",0}, + { "_int","_wxWindowID",0}, + { "_int","_unsigned_int",0}, + { "_int","_signed_int",0}, + { "_class_wxMouseEvent","_wxMouseEvent",0}, + { "_wxPyCommandEvent","_class_wxPyCommandEvent",0}, + { "_wxLogWindow","_class_wxLogWindow",0}, + { "_class_wxListEvent","_wxListEvent",0}, + { "_class_wxPrintPreview","_wxPrintPreview",0}, + { "_class_wxSpinEvent","_wxSpinEvent",0}, + { "_class_wxQueryNewPaletteEvent","_wxQueryNewPaletteEvent",0}, + { "_class_wxNavigationKeyEvent","_wxNavigationKeyEvent",0}, + { "_wxLogNull","_class_wxLogNull",0}, + { "_wxButton","_class_wxButton",0}, + { "_class_wxPyApp","_wxPyApp",0}, + { "_wxSize","_class_wxSize",0}, + { "_wxRegionIterator","_class_wxRegionIterator",0}, + { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, + { "_class_wxLogTextCtrl","_wxLogTextCtrl",0}, + { "_class_wxLogGui","_wxLogGui",0}, + { "_class_wxMDIParentFrame","_wxMDIParentFrame",0}, + { "_wxPyTreeItemData","_class_wxPyTreeItemData",0}, + { "_wxStaticBoxSizer","_class_wxStaticBoxSizer",0}, + { "_class_wxPaintDC","_wxPaintDC",0}, + { "_class_wxSysColourChangedEvent","_wxSysColourChangedEvent",0}, + { "_class_wxPyFileDropTarget","_wxPyFileDropTarget",0}, + { "_class_wxInitDialogEvent","_wxInitDialogEvent",0}, + { "_class_wxComboBox","_wxComboBox",0}, + { "_class_wxRadioButton","_wxRadioButton",0}, + { "_wxValidator","_class_wxValidator",0}, + { "_wxToolBarBase","_class_wxToolBarBase",0}, + { "_class_wxTreeItemId","_wxTreeItemId",0}, + { "_class_wxLayoutConstraints","_wxLayoutConstraints",0}, + { "_wxIconizeEvent","_class_wxIconizeEvent",0}, + { "_class_wxControl","_class_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxControl}, + { "_class_wxControl","_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxControl}, + { "_class_wxControl","_wxControl",0}, + { "_wxStaticBitmap","_class_wxStaticBitmap",0}, + { "_wxStyledTextCtrl","_class_wxStyledTextCtrl",0}, + { "_class_wxIcon","_wxIcon",0}, + { "_class_wxColour","_wxColour",0}, + { "_class_wxScreenDC","_wxScreenDC",0}, + { "_class_wxPageSetupDialog","_wxPageSetupDialog",0}, + { "_wxPalette","_class_wxPalette",0}, + { "_class_wxIdleEvent","_wxIdleEvent",0}, + { "_wxCoord","_int",0}, + { "_wxCoord","_signed_int",0}, + { "_wxCoord","_unsigned_int",0}, + { "_wxCoord","_wxWindowID",0}, + { "_wxCoord","_uint",0}, + { "_wxCoord","_EBool",0}, + { "_wxCoord","_size_t",0}, + { "_wxCoord","_wxPrintQuality",0}, + { "_wxEraseEvent","_class_wxEraseEvent",0}, + { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, + { "_class_wxJoystickEvent","_wxJoystickEvent",0}, + { "_class_wxTipProvider","_wxTipProvider",0}, + { "_class_wxMiniFrame","_wxMiniFrame",0}, + { "_wxFontDialog","_class_wxFontDialog",0}, + { "_wxRegion","_class_wxRegion",0}, + { "_class_wxSplitterWindow","_wxSplitterWindow",0}, + { "_wxPreviewFrame","_class_wxPreviewFrame",0}, + { "_wxSizer","_class_wxSizer",0}, + { "_class_wxShowEvent","_wxShowEvent",0}, + { "_class_wxPyTipProvider","_wxPyTipProvider",0}, + { "_class_wxPCXHandler","_wxPCXHandler",0}, + { "_wxTIFFHandler","_class_wxTIFFHandler",0}, + { "_wxPyDropTarget","_class_wxPyDropTarget",0}, + { "_wxActivateEvent","_class_wxActivateEvent",0}, + { "_wxGauge","_class_wxGauge",0}, + { "_class_wxCheckListBox","_wxCheckListBox",0}, + { "_class_wxBusyInfo","_wxBusyInfo",0}, + { "_class_wxCommandEvent","_class_wxStyledTextEvent",SwigwxStyledTextEventTowxCommandEvent}, + { "_class_wxCommandEvent","_wxStyledTextEvent",SwigwxStyledTextEventTowxCommandEvent}, + { "_class_wxCommandEvent","_wxCommandEvent",0}, + { "_class_wxClientDC","_wxClientDC",0}, + { "_class_wxSizeEvent","_wxSizeEvent",0}, + { "_class_wxListCtrl","_wxListCtrl",0}, + { "_wxCustomDataObject","_class_wxCustomDataObject",0}, + { "_class_wxLogNull","_wxLogNull",0}, + { "_class_wxSize","_wxSize",0}, + { "_class_wxBitmap","_wxBitmap",0}, + { "_class_wxMemoryDC","_wxMemoryDC",0}, + { "_wxPyTextDropTarget","_class_wxPyTextDropTarget",0}, + { "_wxMenuBar","_class_wxMenuBar",0}, + { "_wxTreeEvent","_class_wxTreeEvent",0}, + { "_wxDirDialog","_class_wxDirDialog",0}, + { "_wxEvtHandler","_class_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxEvtHandler}, + { "_wxEvtHandler","_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxEvtHandler}, + { "_wxEvtHandler","_class_wxEvtHandler",0}, + { "_wxMenuItem","_class_wxMenuItem",0}, + { "_class_wxScrollBar","_wxScrollBar",0}, + { "_class_wxColourDialog","_wxColourDialog",0}, + { "_class_wxPrintData","_wxPrintData",0}, + { "_class_wxScrolledWindow","_wxScrolledWindow",0}, + { "_wxListItemAttr","_class_wxListItemAttr",0}, + { "_class_wxTextEntryDialog","_wxTextEntryDialog",0}, + { "_wxKeyEvent","_class_wxKeyEvent",0}, + { "_wxMoveEvent","_class_wxMoveEvent",0}, + { "_wxColourData","_class_wxColourData",0}, + { "_wxPageSetupDialogData","_class_wxPageSetupDialogData",0}, + { "_class_wxPalette","_wxPalette",0}, + { "_wxFileDataObject","_class_wxFileDataObject",0}, + { "_class_wxQueryLayoutInfoEvent","_wxQueryLayoutInfoEvent",0}, + { "_wxNotebookSizer","_class_wxNotebookSizer",0}, + { "_class_wxEraseEvent","_wxEraseEvent",0}, + { "_wxPyFontEnumerator","_class_wxPyFontEnumerator",0}, + { "_wxMDIClientWindow","_class_wxMDIClientWindow",0}, + { "_class_wxDataObjectComposite","_wxDataObjectComposite",0}, + { "_class_wxToolBarToolBase","_wxToolBarToolBase",0}, + { "_class_wxFontDialog","_wxFontDialog",0}, + { "_wxWindow","_class_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxWindow}, + { "_wxWindow","_wxStyledTextCtrl",SwigwxStyledTextCtrlTowxWindow}, + { "_wxWindow","_class_wxWindow",0}, + { "_class_wxWindowDestroyEvent","_wxWindowDestroyEvent",0}, + { "_wxLogStderr","_class_wxLogStderr",0}, + { "_wxStyledTextEvent","_class_wxStyledTextEvent",0}, + { "_class_wxFrame","_wxFrame",0}, +{0,0,0}}; + +static PyObject *SWIG_globals; +#ifdef __cplusplus +extern "C" +#endif +SWIGEXPORT(void) initstc_c() { + PyObject *m, *d; + SWIG_globals = SWIG_newvarlink(); + m = Py_InitModule("stc_c", stc_cMethods); + d = PyModule_GetDict(m); + PyDict_SetItemString(d,"wxSTC_UndoCollectNone", PyInt_FromLong((long) wxSTC_UndoCollectNone)); + PyDict_SetItemString(d,"wxSTC_UndoCollectAutoStart", PyInt_FromLong((long) wxSTC_UndoCollectAutoStart)); + PyDict_SetItemString(d,"wxSTC_EOL_CRLF", PyInt_FromLong((long) wxSTC_EOL_CRLF)); + PyDict_SetItemString(d,"wxSTC_EOL_CR", PyInt_FromLong((long) wxSTC_EOL_CR)); + PyDict_SetItemString(d,"wxSTC_EOL_LF", PyInt_FromLong((long) wxSTC_EOL_LF)); + PyDict_SetItemString(d,"wxSTC_EDGE_NONE", PyInt_FromLong((long) wxSTC_EDGE_NONE)); + PyDict_SetItemString(d,"wxSTC_EDGE_LINE", PyInt_FromLong((long) wxSTC_EDGE_LINE)); + PyDict_SetItemString(d,"wxSTC_EDGE_BACKGROUND", PyInt_FromLong((long) wxSTC_EDGE_BACKGROUND)); + PyDict_SetItemString(d,"wxSTC_LEX_STYLE_MAX", PyInt_FromLong((long) 31)); + PyDict_SetItemString(d,"wxSTC_STYLE_DEFAULT", PyInt_FromLong((long) 32)); + PyDict_SetItemString(d,"wxSTC_STYLE_LINENUMBER", PyInt_FromLong((long) 33)); + PyDict_SetItemString(d,"wxSTC_STYLE_BRACELIGHT", PyInt_FromLong((long) 34)); + PyDict_SetItemString(d,"wxSTC_STYLE_BRACEBAD", PyInt_FromLong((long) 35)); + PyDict_SetItemString(d,"wxSTC_STYLE_CONTROLCHAR", PyInt_FromLong((long) 36)); + PyDict_SetItemString(d,"wxSTC_STYLE_MAX", PyInt_FromLong((long) 127)); + PyDict_SetItemString(d,"wxSTC_STYLE_MASK", PyInt_FromLong((long) 31)); + PyDict_SetItemString(d,"wxSTC_MARKER_MAX", PyInt_FromLong((long) 31)); + PyDict_SetItemString(d,"wxSTC_MARK_CIRCLE", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"wxSTC_MARK_ROUNDRECT", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"wxSTC_MARK_ARROW", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"wxSTC_MARK_SMALLRECT", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"wxSTC_MARK_SHORTARROW", PyInt_FromLong((long) 4)); + PyDict_SetItemString(d,"wxSTC_MARK_EMPTY", PyInt_FromLong((long) 5)); + PyDict_SetItemString(d,"wxSTC_MARK_ARROWDOWN", PyInt_FromLong((long) 6)); + PyDict_SetItemString(d,"wxSTC_MARK_MINUS", PyInt_FromLong((long) 7)); + PyDict_SetItemString(d,"wxSTC_MARK_PLUS", PyInt_FromLong((long) 8)); + PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDER", PyInt_FromLong((long) 30)); + PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDEROPEN", PyInt_FromLong((long) 31)); + PyDict_SetItemString(d,"wxSTC_MASK_FOLDERS", PyInt_FromLong((long) ((1<<(30))|(1<<(31))))); + PyDict_SetItemString(d,"wxSTC_INDIC_MAX", PyInt_FromLong((long) 7)); + PyDict_SetItemString(d,"wxSTC_INDIC_PLAIN", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"wxSTC_INDIC_SQUIGGLE", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"wxSTC_INDIC_TT", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"wxSTC_INDIC_DIAGONAL", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"wxSTC_INDIC_STRIKE", PyInt_FromLong((long) 4)); + PyDict_SetItemString(d,"wxSTC_INDIC0_MASK", PyInt_FromLong((long) 32)); + PyDict_SetItemString(d,"wxSTC_INDIC1_MASK", PyInt_FromLong((long) 64)); + PyDict_SetItemString(d,"wxSTC_INDIC2_MASK", PyInt_FromLong((long) 128)); + PyDict_SetItemString(d,"wxSTC_INDICS_MASK", PyInt_FromLong((long) ((32)|(64)|(128)))); + PyDict_SetItemString(d,"wxSTC_FOLDLEVELBASE", PyInt_FromLong((long) 0x0400)); + PyDict_SetItemString(d,"wxSTC_FOLDLEVELWHITEFLAG", PyInt_FromLong((long) 0x1000)); + PyDict_SetItemString(d,"wxSTC_FOLDLEVELHEADERFLAG", PyInt_FromLong((long) 0x2000)); + PyDict_SetItemString(d,"wxSTC_FOLDLEVELNUMBERMASK", PyInt_FromLong((long) 0x0FFF)); + PyDict_SetItemString(d,"wxSTC_CMD_LINEDOWN", PyInt_FromLong((long) wxSTC_CMD_LINEDOWN)); + PyDict_SetItemString(d,"wxSTC_CMD_LINEDOWNEXTEND", PyInt_FromLong((long) wxSTC_CMD_LINEDOWNEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_LINEUP", PyInt_FromLong((long) wxSTC_CMD_LINEUP)); + PyDict_SetItemString(d,"wxSTC_CMD_LINEUPEXTEND", PyInt_FromLong((long) wxSTC_CMD_LINEUPEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_CHARLEFT", PyInt_FromLong((long) wxSTC_CMD_CHARLEFT)); + PyDict_SetItemString(d,"wxSTC_CMD_CHARLEFTEXTEND", PyInt_FromLong((long) wxSTC_CMD_CHARLEFTEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_CHARRIGHT", PyInt_FromLong((long) wxSTC_CMD_CHARRIGHT)); + PyDict_SetItemString(d,"wxSTC_CMD_CHARRIGHTEXTEND", PyInt_FromLong((long) wxSTC_CMD_CHARRIGHTEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_WORDLEFT", PyInt_FromLong((long) wxSTC_CMD_WORDLEFT)); + PyDict_SetItemString(d,"wxSTC_CMD_WORDLEFTEXTEND", PyInt_FromLong((long) wxSTC_CMD_WORDLEFTEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_WORDRIGHT", PyInt_FromLong((long) wxSTC_CMD_WORDRIGHT)); + PyDict_SetItemString(d,"wxSTC_CMD_WORDRIGHTEXTEND", PyInt_FromLong((long) wxSTC_CMD_WORDRIGHTEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_HOME", PyInt_FromLong((long) wxSTC_CMD_HOME)); + PyDict_SetItemString(d,"wxSTC_CMD_HOMEEXTEND", PyInt_FromLong((long) wxSTC_CMD_HOMEEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_LINEEND", PyInt_FromLong((long) wxSTC_CMD_LINEEND)); + PyDict_SetItemString(d,"wxSTC_CMD_LINEENDEXTEND", PyInt_FromLong((long) wxSTC_CMD_LINEENDEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_DOCUMENTSTART", PyInt_FromLong((long) wxSTC_CMD_DOCUMENTSTART)); + PyDict_SetItemString(d,"wxSTC_CMD_DOCUMENTSTARTEXTEND", PyInt_FromLong((long) wxSTC_CMD_DOCUMENTSTARTEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_DOCUMENTEND", PyInt_FromLong((long) wxSTC_CMD_DOCUMENTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_DOCUMENTENDEXTEND", PyInt_FromLong((long) wxSTC_CMD_DOCUMENTENDEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_PAGEUP", PyInt_FromLong((long) wxSTC_CMD_PAGEUP)); + PyDict_SetItemString(d,"wxSTC_CMD_PAGEUPEXTEND", PyInt_FromLong((long) wxSTC_CMD_PAGEUPEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_PAGEDOWN", PyInt_FromLong((long) wxSTC_CMD_PAGEDOWN)); + PyDict_SetItemString(d,"wxSTC_CMD_PAGEDOWNEXTEND", PyInt_FromLong((long) wxSTC_CMD_PAGEDOWNEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_EDITTOGGLEOVERTYPE", PyInt_FromLong((long) wxSTC_CMD_EDITTOGGLEOVERTYPE)); + PyDict_SetItemString(d,"wxSTC_CMD_CANCEL", PyInt_FromLong((long) wxSTC_CMD_CANCEL)); + PyDict_SetItemString(d,"wxSTC_CMD_DELETEBACK", PyInt_FromLong((long) wxSTC_CMD_DELETEBACK)); + PyDict_SetItemString(d,"wxSTC_CMD_TAB", PyInt_FromLong((long) wxSTC_CMD_TAB)); + PyDict_SetItemString(d,"wxSTC_CMD_BACKTAB", PyInt_FromLong((long) wxSTC_CMD_BACKTAB)); + PyDict_SetItemString(d,"wxSTC_CMD_NEWLINE", PyInt_FromLong((long) wxSTC_CMD_NEWLINE)); + PyDict_SetItemString(d,"wxSTC_CMD_FORMFEED", PyInt_FromLong((long) wxSTC_CMD_FORMFEED)); + PyDict_SetItemString(d,"wxSTC_CMD_VCHOME", PyInt_FromLong((long) wxSTC_CMD_VCHOME)); + PyDict_SetItemString(d,"wxSTC_CMD_VCHOMEEXTEND", PyInt_FromLong((long) wxSTC_CMD_VCHOMEEXTEND)); + PyDict_SetItemString(d,"wxSTC_CMD_ZOOMIN", PyInt_FromLong((long) wxSTC_CMD_ZOOMIN)); + PyDict_SetItemString(d,"wxSTC_CMD_ZOOMOUT", PyInt_FromLong((long) wxSTC_CMD_ZOOMOUT)); + PyDict_SetItemString(d,"wxSTC_CMD_DELWORDLEFT", PyInt_FromLong((long) wxSTC_CMD_DELWORDLEFT)); + PyDict_SetItemString(d,"wxSTC_CMD_DELWORDRIGHT", PyInt_FromLong((long) wxSTC_CMD_DELWORDRIGHT)); + PyDict_SetItemString(d,"wxSTC_CMD_LINECUT", PyInt_FromLong((long) wxSTC_CMD_LINECUT)); + PyDict_SetItemString(d,"wxSTC_CMD_LINEDELETE", PyInt_FromLong((long) wxSTC_CMD_LINEDELETE)); + PyDict_SetItemString(d,"wxSTC_CMD_LINETRANSPOSE", PyInt_FromLong((long) wxSTC_CMD_LINETRANSPOSE)); + PyDict_SetItemString(d,"wxSTC_CMD_LOWERCASE", PyInt_FromLong((long) wxSTC_CMD_LOWERCASE)); + PyDict_SetItemString(d,"wxSTC_CMD_UPPERCASE", PyInt_FromLong((long) wxSTC_CMD_UPPERCASE)); + PyDict_SetItemString(d,"wxSTC_CMD_LINESCROLLDOWN", PyInt_FromLong((long) wxSTC_CMD_LINESCROLLDOWN)); + PyDict_SetItemString(d,"wxSTC_CMD_LINESCROLLUP", PyInt_FromLong((long) wxSTC_CMD_LINESCROLLUP)); + PyDict_SetItemString(d,"wxSTC_LEX_CONTAINER", PyInt_FromLong((long) wxSTC_LEX_CONTAINER)); + PyDict_SetItemString(d,"wxSTC_LEX_NULL", PyInt_FromLong((long) wxSTC_LEX_NULL)); + PyDict_SetItemString(d,"wxSTC_LEX_PYTHON", PyInt_FromLong((long) wxSTC_LEX_PYTHON)); + PyDict_SetItemString(d,"wxSTC_LEX_CPP", PyInt_FromLong((long) wxSTC_LEX_CPP)); + PyDict_SetItemString(d,"wxSTC_LEX_HTML", PyInt_FromLong((long) wxSTC_LEX_HTML)); + PyDict_SetItemString(d,"wxSTC_LEX_XML", PyInt_FromLong((long) wxSTC_LEX_XML)); + PyDict_SetItemString(d,"wxSTC_LEX_PERL", PyInt_FromLong((long) wxSTC_LEX_PERL)); + PyDict_SetItemString(d,"wxSTC_LEX_SQL", PyInt_FromLong((long) wxSTC_LEX_SQL)); + PyDict_SetItemString(d,"wxSTC_LEX_VB", PyInt_FromLong((long) wxSTC_LEX_VB)); + PyDict_SetItemString(d,"wxSTC_LEX_PROPERTIES", PyInt_FromLong((long) wxSTC_LEX_PROPERTIES)); + PyDict_SetItemString(d,"wxSTC_LEX_ERRORLIST", PyInt_FromLong((long) wxSTC_LEX_ERRORLIST)); + PyDict_SetItemString(d,"wxSTC_LEX_MAKEFILE", PyInt_FromLong((long) wxSTC_LEX_MAKEFILE)); + PyDict_SetItemString(d,"wxSTC_LEX_BATCH", PyInt_FromLong((long) wxSTC_LEX_BATCH)); + PyDict_SetItemString(d,"wxSTC_LEX_XCODE", PyInt_FromLong((long) wxSTC_LEX_XCODE)); + PyDict_SetItemString(d,"wxSTC_LEX_LATEX", PyInt_FromLong((long) wxSTC_LEX_LATEX)); + PyDict_SetItemString(d,"wxSTC_CARET_SLOP", PyInt_FromLong((long) 0x01)); + PyDict_SetItemString(d,"WXSTC_CARET_CENTER", PyInt_FromLong((long) 0x02)); + PyDict_SetItemString(d,"wxSTC_CARET_STRICT", PyInt_FromLong((long) 0x04)); + PyDict_SetItemString(d,"wxSTC_MARGIN_SYMBOL", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"wxSTC_MARGIN_NUMBER", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"wxSTCNameStr", PyString_FromString("wxSTCNameStr")); + PyDict_SetItemString(d,"wxEVT_STC_CHANGE", PyInt_FromLong((long) wxEVT_STC_CHANGE)); + PyDict_SetItemString(d,"wxEVT_STC_STYLENEEDED", PyInt_FromLong((long) wxEVT_STC_STYLENEEDED)); + PyDict_SetItemString(d,"wxEVT_STC_CHARADDED", PyInt_FromLong((long) wxEVT_STC_CHARADDED)); + PyDict_SetItemString(d,"wxEVT_STC_UPDATEUI", PyInt_FromLong((long) wxEVT_STC_UPDATEUI)); + PyDict_SetItemString(d,"wxEVT_STC_SAVEPOINTREACHED", PyInt_FromLong((long) wxEVT_STC_SAVEPOINTREACHED)); + PyDict_SetItemString(d,"wxEVT_STC_SAVEPOINTLEFT", PyInt_FromLong((long) wxEVT_STC_SAVEPOINTLEFT)); + PyDict_SetItemString(d,"wxEVT_STC_ROMODIFYATTEMPT", PyInt_FromLong((long) wxEVT_STC_ROMODIFYATTEMPT)); + PyDict_SetItemString(d,"wxEVT_STC_DOUBLECLICK", PyInt_FromLong((long) wxEVT_STC_DOUBLECLICK)); + PyDict_SetItemString(d,"wxEVT_STC_MODIFIED", PyInt_FromLong((long) wxEVT_STC_MODIFIED)); + PyDict_SetItemString(d,"wxEVT_STC_KEY", PyInt_FromLong((long) wxEVT_STC_KEY)); + PyDict_SetItemString(d,"wxEVT_STC_MACRORECORD", PyInt_FromLong((long) wxEVT_STC_MACRORECORD)); + PyDict_SetItemString(d,"wxEVT_STC_MARGINCLICK", PyInt_FromLong((long) wxEVT_STC_MARGINCLICK)); + PyDict_SetItemString(d,"wxEVT_STC_NEEDSHOWN", PyInt_FromLong((long) wxEVT_STC_NEEDSHOWN)); + PyDict_SetItemString(d,"wxSTC_MOD_INSERTTEXT", PyInt_FromLong((long) 0x1)); + PyDict_SetItemString(d,"wxSTC_MOD_DELETETEXT", PyInt_FromLong((long) 0x2)); + PyDict_SetItemString(d,"wxSTC_MOD_CHANGESTYLE", PyInt_FromLong((long) 0x4)); + PyDict_SetItemString(d,"wxSTC_MOD_CHANGEFOLD", PyInt_FromLong((long) 0x8)); + PyDict_SetItemString(d,"wxSTC_PERFORMED_USER", PyInt_FromLong((long) 0x10)); + PyDict_SetItemString(d,"wxSTC_PERFORMED_UNDO", PyInt_FromLong((long) 0x20)); + PyDict_SetItemString(d,"wxSTC_PERFORMED_REDO", PyInt_FromLong((long) 0x40)); + PyDict_SetItemString(d,"wxSTC_LASTSTEPINUNDOREDO", PyInt_FromLong((long) 0x100)); + PyDict_SetItemString(d,"wxSTC_MOD_CHANGEMARKER", PyInt_FromLong((long) 0x200)); + PyDict_SetItemString(d,"wxSTC_MOD_BEFOREINSERT", PyInt_FromLong((long) 0x400)); + PyDict_SetItemString(d,"wxSTC_MOD_BEFOREDELETE", PyInt_FromLong((long) 0x800)); + PyDict_SetItemString(d,"SCLEX_CONTAINER", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"SCLEX_NULL", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"SCLEX_PYTHON", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"SCLEX_CPP", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"SCLEX_HTML", PyInt_FromLong((long) 4)); + PyDict_SetItemString(d,"SCLEX_XML", PyInt_FromLong((long) 5)); + PyDict_SetItemString(d,"SCLEX_PERL", PyInt_FromLong((long) 6)); + PyDict_SetItemString(d,"SCLEX_SQL", PyInt_FromLong((long) 7)); + PyDict_SetItemString(d,"SCLEX_VB", PyInt_FromLong((long) 8)); + PyDict_SetItemString(d,"SCLEX_PROPERTIES", PyInt_FromLong((long) 9)); + PyDict_SetItemString(d,"SCLEX_ERRORLIST", PyInt_FromLong((long) 10)); + PyDict_SetItemString(d,"SCLEX_MAKEFILE", PyInt_FromLong((long) 11)); + PyDict_SetItemString(d,"SCLEX_BATCH", PyInt_FromLong((long) 12)); + PyDict_SetItemString(d,"SCLEX_XCODE", PyInt_FromLong((long) 13)); + PyDict_SetItemString(d,"SCLEX_LATEX", PyInt_FromLong((long) 14)); + PyDict_SetItemString(d,"SCE_P_DEFAULT", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"SCE_P_COMMENTLINE", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"SCE_P_NUMBER", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"SCE_P_STRING", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"SCE_P_CHARACTER", PyInt_FromLong((long) 4)); + PyDict_SetItemString(d,"SCE_P_WORD", PyInt_FromLong((long) 5)); + PyDict_SetItemString(d,"SCE_P_TRIPLE", PyInt_FromLong((long) 6)); + PyDict_SetItemString(d,"SCE_P_TRIPLEDOUBLE", PyInt_FromLong((long) 7)); + PyDict_SetItemString(d,"SCE_P_CLASSNAME", PyInt_FromLong((long) 8)); + PyDict_SetItemString(d,"SCE_P_DEFNAME", PyInt_FromLong((long) 9)); + PyDict_SetItemString(d,"SCE_P_OPERATOR", PyInt_FromLong((long) 10)); + PyDict_SetItemString(d,"SCE_P_IDENTIFIER", PyInt_FromLong((long) 11)); + PyDict_SetItemString(d,"SCE_P_COMMENTBLOCK", PyInt_FromLong((long) 12)); + PyDict_SetItemString(d,"SCE_P_STRINGEOL", PyInt_FromLong((long) 13)); + PyDict_SetItemString(d,"SCE_C_DEFAULT", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"SCE_C_COMMENT", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"SCE_C_COMMENTLINE", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"SCE_C_COMMENTDOC", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"SCE_C_NUMBER", PyInt_FromLong((long) 4)); + PyDict_SetItemString(d,"SCE_C_WORD", PyInt_FromLong((long) 5)); + PyDict_SetItemString(d,"SCE_C_STRING", PyInt_FromLong((long) 6)); + PyDict_SetItemString(d,"SCE_C_CHARACTER", PyInt_FromLong((long) 7)); + PyDict_SetItemString(d,"SCE_C_UUID", PyInt_FromLong((long) 8)); + PyDict_SetItemString(d,"SCE_C_PREPROCESSOR", PyInt_FromLong((long) 9)); + PyDict_SetItemString(d,"SCE_C_OPERATOR", PyInt_FromLong((long) 10)); + PyDict_SetItemString(d,"SCE_C_IDENTIFIER", PyInt_FromLong((long) 11)); + PyDict_SetItemString(d,"SCE_C_STRINGEOL", PyInt_FromLong((long) 12)); + PyDict_SetItemString(d,"SCE_H_DEFAULT", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"SCE_H_TAG", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"SCE_H_TAGUNKNOWN", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"SCE_H_ATTRIBUTE", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"SCE_H_ATTRIBUTEUNKNOWN", PyInt_FromLong((long) 4)); + PyDict_SetItemString(d,"SCE_H_NUMBER", PyInt_FromLong((long) 5)); + PyDict_SetItemString(d,"SCE_H_DOUBLESTRING", PyInt_FromLong((long) 6)); + PyDict_SetItemString(d,"SCE_H_SINGLESTRING", PyInt_FromLong((long) 7)); + PyDict_SetItemString(d,"SCE_H_OTHER", PyInt_FromLong((long) 8)); + PyDict_SetItemString(d,"SCE_H_COMMENT", PyInt_FromLong((long) 9)); + PyDict_SetItemString(d,"SCE_H_ENTITY", PyInt_FromLong((long) 10)); + PyDict_SetItemString(d,"SCE_H_TAGEND", PyInt_FromLong((long) 11)); + PyDict_SetItemString(d,"SCE_H_XMLSTART", PyInt_FromLong((long) 12)); + PyDict_SetItemString(d,"SCE_H_XMLEND", PyInt_FromLong((long) 13)); + PyDict_SetItemString(d,"SCE_H_SCRIPT", PyInt_FromLong((long) 14)); + PyDict_SetItemString(d,"SCE_H_ASP", PyInt_FromLong((long) 15)); + PyDict_SetItemString(d,"SCE_H_ASPAT", PyInt_FromLong((long) 16)); + PyDict_SetItemString(d,"SCE_HJ_START", PyInt_FromLong((long) 40)); + PyDict_SetItemString(d,"SCE_HJ_DEFAULT", PyInt_FromLong((long) 41)); + PyDict_SetItemString(d,"SCE_HJ_COMMENT", PyInt_FromLong((long) 42)); + PyDict_SetItemString(d,"SCE_HJ_COMMENTLINE", PyInt_FromLong((long) 43)); + PyDict_SetItemString(d,"SCE_HJ_COMMENTDOC", PyInt_FromLong((long) 44)); + PyDict_SetItemString(d,"SCE_HJ_NUMBER", PyInt_FromLong((long) 45)); + PyDict_SetItemString(d,"SCE_HJ_WORD", PyInt_FromLong((long) 46)); + PyDict_SetItemString(d,"SCE_HJ_KEYWORD", PyInt_FromLong((long) 47)); + PyDict_SetItemString(d,"SCE_HJ_DOUBLESTRING", PyInt_FromLong((long) 48)); + PyDict_SetItemString(d,"SCE_HJ_SINGLESTRING", PyInt_FromLong((long) 49)); + PyDict_SetItemString(d,"SCE_HJ_SYMBOLS", PyInt_FromLong((long) 50)); + PyDict_SetItemString(d,"SCE_HJ_STRINGEOL", PyInt_FromLong((long) 51)); + PyDict_SetItemString(d,"SCE_HJA_START", PyInt_FromLong((long) 55)); + PyDict_SetItemString(d,"SCE_HJA_DEFAULT", PyInt_FromLong((long) 56)); + PyDict_SetItemString(d,"SCE_HJA_COMMENT", PyInt_FromLong((long) 57)); + PyDict_SetItemString(d,"SCE_HJA_COMMENTLINE", PyInt_FromLong((long) 58)); + PyDict_SetItemString(d,"SCE_HJA_COMMENTDOC", PyInt_FromLong((long) 59)); + PyDict_SetItemString(d,"SCE_HJA_NUMBER", PyInt_FromLong((long) 60)); + PyDict_SetItemString(d,"SCE_HJA_WORD", PyInt_FromLong((long) 61)); + PyDict_SetItemString(d,"SCE_HJA_KEYWORD", PyInt_FromLong((long) 62)); + PyDict_SetItemString(d,"SCE_HJA_DOUBLESTRING", PyInt_FromLong((long) 63)); + PyDict_SetItemString(d,"SCE_HJA_SINGLESTRING", PyInt_FromLong((long) 64)); + PyDict_SetItemString(d,"SCE_HJA_SYMBOLS", PyInt_FromLong((long) 65)); + PyDict_SetItemString(d,"SCE_HJA_STRINGEOL", PyInt_FromLong((long) 66)); + PyDict_SetItemString(d,"SCE_HB_START", PyInt_FromLong((long) 70)); + PyDict_SetItemString(d,"SCE_HB_DEFAULT", PyInt_FromLong((long) 71)); + PyDict_SetItemString(d,"SCE_HB_COMMENTLINE", PyInt_FromLong((long) 72)); + PyDict_SetItemString(d,"SCE_HB_NUMBER", PyInt_FromLong((long) 73)); + PyDict_SetItemString(d,"SCE_HB_WORD", PyInt_FromLong((long) 74)); + PyDict_SetItemString(d,"SCE_HB_STRING", PyInt_FromLong((long) 75)); + PyDict_SetItemString(d,"SCE_HB_IDENTIFIER", PyInt_FromLong((long) 76)); + PyDict_SetItemString(d,"SCE_HB_STRINGEOL", PyInt_FromLong((long) 77)); + PyDict_SetItemString(d,"SCE_HBA_START", PyInt_FromLong((long) 80)); + PyDict_SetItemString(d,"SCE_HBA_DEFAULT", PyInt_FromLong((long) 81)); + PyDict_SetItemString(d,"SCE_HBA_COMMENTLINE", PyInt_FromLong((long) 82)); + PyDict_SetItemString(d,"SCE_HBA_NUMBER", PyInt_FromLong((long) 83)); + PyDict_SetItemString(d,"SCE_HBA_WORD", PyInt_FromLong((long) 84)); + PyDict_SetItemString(d,"SCE_HBA_STRING", PyInt_FromLong((long) 85)); + PyDict_SetItemString(d,"SCE_HBA_IDENTIFIER", PyInt_FromLong((long) 86)); + PyDict_SetItemString(d,"SCE_HBA_STRINGEOL", PyInt_FromLong((long) 87)); + PyDict_SetItemString(d,"SCE_HP_START", PyInt_FromLong((long) 90)); + PyDict_SetItemString(d,"SCE_HP_DEFAULT", PyInt_FromLong((long) 91)); + PyDict_SetItemString(d,"SCE_HP_COMMENTLINE", PyInt_FromLong((long) 92)); + PyDict_SetItemString(d,"SCE_HP_NUMBER", PyInt_FromLong((long) 93)); + PyDict_SetItemString(d,"SCE_HP_STRING", PyInt_FromLong((long) 94)); + PyDict_SetItemString(d,"SCE_HP_CHARACTER", PyInt_FromLong((long) 95)); + PyDict_SetItemString(d,"SCE_HP_WORD", PyInt_FromLong((long) 96)); + PyDict_SetItemString(d,"SCE_HP_TRIPLE", PyInt_FromLong((long) 97)); + PyDict_SetItemString(d,"SCE_HP_TRIPLEDOUBLE", PyInt_FromLong((long) 98)); + PyDict_SetItemString(d,"SCE_HP_CLASSNAME", PyInt_FromLong((long) 99)); + PyDict_SetItemString(d,"SCE_HP_DEFNAME", PyInt_FromLong((long) 100)); + PyDict_SetItemString(d,"SCE_HP_OPERATOR", PyInt_FromLong((long) 101)); + PyDict_SetItemString(d,"SCE_HP_IDENTIFIER", PyInt_FromLong((long) 102)); + PyDict_SetItemString(d,"SCE_HPA_START", PyInt_FromLong((long) 105)); + PyDict_SetItemString(d,"SCE_HPA_DEFAULT", PyInt_FromLong((long) 106)); + PyDict_SetItemString(d,"SCE_HPA_COMMENTLINE", PyInt_FromLong((long) 107)); + PyDict_SetItemString(d,"SCE_HPA_NUMBER", PyInt_FromLong((long) 108)); + PyDict_SetItemString(d,"SCE_HPA_STRING", PyInt_FromLong((long) 109)); + PyDict_SetItemString(d,"SCE_HPA_CHARACTER", PyInt_FromLong((long) 110)); + PyDict_SetItemString(d,"SCE_HPA_WORD", PyInt_FromLong((long) 111)); + PyDict_SetItemString(d,"SCE_HPA_TRIPLE", PyInt_FromLong((long) 112)); + PyDict_SetItemString(d,"SCE_HPA_TRIPLEDOUBLE", PyInt_FromLong((long) 113)); + PyDict_SetItemString(d,"SCE_HPA_CLASSNAME", PyInt_FromLong((long) 114)); + PyDict_SetItemString(d,"SCE_HPA_DEFNAME", PyInt_FromLong((long) 115)); + PyDict_SetItemString(d,"SCE_HPA_OPERATOR", PyInt_FromLong((long) 116)); + PyDict_SetItemString(d,"SCE_HPA_IDENTIFIER", PyInt_FromLong((long) 117)); + PyDict_SetItemString(d,"SCE_PL_DEFAULT", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"SCE_PL_HERE", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"SCE_PL_COMMENTLINE", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"SCE_PL_POD", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"SCE_PL_NUMBER", PyInt_FromLong((long) 4)); + PyDict_SetItemString(d,"SCE_PL_WORD", PyInt_FromLong((long) 5)); + PyDict_SetItemString(d,"SCE_PL_STRING", PyInt_FromLong((long) 6)); + PyDict_SetItemString(d,"SCE_PL_CHARACTER", PyInt_FromLong((long) 7)); + PyDict_SetItemString(d,"SCE_PL_PUNCTUATION", PyInt_FromLong((long) 8)); + PyDict_SetItemString(d,"SCE_PL_PREPROCESSOR", PyInt_FromLong((long) 9)); + PyDict_SetItemString(d,"SCE_PL_OPERATOR", PyInt_FromLong((long) 10)); + PyDict_SetItemString(d,"SCE_PL_IDENTIFIER", PyInt_FromLong((long) 11)); + PyDict_SetItemString(d,"SCE_PL_SCALAR", PyInt_FromLong((long) 12)); + PyDict_SetItemString(d,"SCE_PL_ARRAY", PyInt_FromLong((long) 13)); + PyDict_SetItemString(d,"SCE_PL_HASH", PyInt_FromLong((long) 14)); + PyDict_SetItemString(d,"SCE_PL_SYMBOLTABLE", PyInt_FromLong((long) 15)); + PyDict_SetItemString(d,"SCE_PL_REF", PyInt_FromLong((long) 16)); + PyDict_SetItemString(d,"SCE_PL_REGEX", PyInt_FromLong((long) 17)); + PyDict_SetItemString(d,"SCE_PL_REGSUBST", PyInt_FromLong((long) 18)); + PyDict_SetItemString(d,"SCE_PL_LONGQUOTE", PyInt_FromLong((long) 19)); + PyDict_SetItemString(d,"SCE_PL_BACKTICKS", PyInt_FromLong((long) 20)); + PyDict_SetItemString(d,"SCE_PL_DATASECTION", PyInt_FromLong((long) 21)); + PyDict_SetItemString(d,"SCE_L_DEFAULT", PyInt_FromLong((long) 0)); + PyDict_SetItemString(d,"SCE_L_COMMAND", PyInt_FromLong((long) 1)); + PyDict_SetItemString(d,"SCE_L_TAG", PyInt_FromLong((long) 2)); + PyDict_SetItemString(d,"SCE_L_MATH", PyInt_FromLong((long) 3)); + PyDict_SetItemString(d,"SCE_L_COMMENT", PyInt_FromLong((long) 4)); + + + wxClassInfo::CleanUpClasses(); + wxClassInfo::InitializeClasses(); + +{ + int i; + for (i = 0; _swig_mapping[i].n1; i++) + SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv); +} +} diff --git a/wxPython/contrib/stc/stc_.i b/wxPython/contrib/stc/stc_.i new file mode 100644 index 0000000000..f1e3ae5c69 --- /dev/null +++ b/wxPython/contrib/stc/stc_.i @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: stc.i +// Purpose: Wrappers for the wxStyledTextCtrl. +// +// Author: Robin Dunn +// +// Created: 12-Oct-1999 +// RCS-ID: $Id$ +// Copyright: (c) 2000 by Total Control Software +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +%module stc_ + + +%{ +#include "helpers.h" +#include "wx/stc/stc.h" +%} + +//--------------------------------------------------------------------------- + +%include typemaps.i +%include my_typemaps.i + +%extern wx.i +%extern windows.i +%extern _defs.i +%extern events.i +%extern controls.i + + +//---------------------------------------------------------------------- +// Get all our defs from the REAL header file. + +%include stc.h +%include SciLexer.h + +//---------------------------------------------------------------------- +// Python functions to act like the event macros + +%pragma(python) code = " +def EVT_STC_CHANGE(win, id, fn): + win.Connect(id, -1, wxEVT_STC_CHANGE, fn) + +def EVT_STC_STYLENEEDED(win, id, fn): + win.Connect(id, -1, wxEVT_STC_STYLENEEDED, fn) + +def EVT_STC_CHARADDED(win, id, fn): + win.Connect(id, -1, wxEVT_STC_CHARADDED, fn) + +def EVT_STC_UPDATEUI(win, id, fn): + win.Connect(id, -1, wxEVT_STC_UPDATEUI, fn) + +def EVT_STC_SAVEPOINTREACHED(win, id, fn): + win.Connect(id, -1, wxEVT_STC_SAVEPOINTREACHED, fn) + +def EVT_STC_SAVEPOINTLEFT(win, id, fn): + win.Connect(id, -1, wxEVT_STC_SAVEPOINTLEFT, fn) + +def EVT_STC_ROMODIFYATTEMPT(win, id, fn): + win.Connect(id, -1, wxEVT_STC_ROMODIFYATTEMPT, fn) + +def EVT_STC_DOUBLECLICK(win, id, fn): + win.Connect(id, -1, wxEVT_STC_DOUBLECLICK, fn) + +def EVT_STC_MODIFIED(win, id, fn): + win.Connect(id, -1, wxEVT_STC_MODIFIED, fn) + +def EVT_STC_KEY(win, id, fn): + win.Connect(id, -1, wxEVT_STC_KEY, fn) + +def EVT_STC_MACRORECORD(win, id, fn): + win.Connect(id, -1, wxEVT_STC_MACRORECORD, fn) + +def EVT_STC_MARGINCLICK(win, id, fn): + win.Connect(id, -1, wxEVT_STC_MARGINCLICK, fn) + +def EVT_STC_NEEDSHOWN(win, id, fn): + win.Connect(id, -1, wxEVT_STC_NEEDSHOWN, fn) + + +" + +//---------------------------------------------------------------------- + +%init %{ + + wxClassInfo::CleanUpClasses(); + wxClassInfo::InitializeClasses(); + +%} + + +//---------------------------------------------------------------------- + +%pragma(python) include="_stcextras.py"; + +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- + + diff --git a/wxPython/contrib/stc/stc_.py b/wxPython/contrib/stc/stc_.py new file mode 100644 index 0000000000..914062d24d --- /dev/null +++ b/wxPython/contrib/stc/stc_.py @@ -0,0 +1,1086 @@ +# This file was created automatically by SWIG. +import stc_c + +from misc import * + +from misc2 import * + +from windows import * + +from gdi import * + +from clip_dnd import * + +from events import * + +from mdi import * + +from frames import * + +from stattool import * + +from controls import * + +from controls2 import * + +from windows2 import * + +from cmndlgs import * + +from windows3 import * + +from image import * + +from printfw import * + +from sizers import * + +def EVT_STC_CHANGE(win, id, fn): + win.Connect(id, -1, wxEVT_STC_CHANGE, fn) + +def EVT_STC_STYLENEEDED(win, id, fn): + win.Connect(id, -1, wxEVT_STC_STYLENEEDED, fn) + +def EVT_STC_CHARADDED(win, id, fn): + win.Connect(id, -1, wxEVT_STC_CHARADDED, fn) + +def EVT_STC_UPDATEUI(win, id, fn): + win.Connect(id, -1, wxEVT_STC_UPDATEUI, fn) + +def EVT_STC_SAVEPOINTREACHED(win, id, fn): + win.Connect(id, -1, wxEVT_STC_SAVEPOINTREACHED, fn) + +def EVT_STC_SAVEPOINTLEFT(win, id, fn): + win.Connect(id, -1, wxEVT_STC_SAVEPOINTLEFT, fn) + +def EVT_STC_ROMODIFYATTEMPT(win, id, fn): + win.Connect(id, -1, wxEVT_STC_ROMODIFYATTEMPT, fn) + +def EVT_STC_DOUBLECLICK(win, id, fn): + win.Connect(id, -1, wxEVT_STC_DOUBLECLICK, fn) + +def EVT_STC_MODIFIED(win, id, fn): + win.Connect(id, -1, wxEVT_STC_MODIFIED, fn) + +def EVT_STC_KEY(win, id, fn): + win.Connect(id, -1, wxEVT_STC_KEY, fn) + +def EVT_STC_MACRORECORD(win, id, fn): + win.Connect(id, -1, wxEVT_STC_MACRORECORD, fn) + +def EVT_STC_MARGINCLICK(win, id, fn): + win.Connect(id, -1, wxEVT_STC_MARGINCLICK, fn) + +def EVT_STC_NEEDSHOWN(win, id, fn): + win.Connect(id, -1, wxEVT_STC_NEEDSHOWN, fn) + + + +class wxStyledTextCtrlPtr(wxControlPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def GetText(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetText,(self,) + _args, _kwargs) + return val + def SetText(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetText,(self,) + _args, _kwargs) + return val + def GetLine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLine,(self,) + _args, _kwargs) + return val + def ReplaceSelection(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ReplaceSelection,(self,) + _args, _kwargs) + return val + def SetReadOnly(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetReadOnly,(self,) + _args, _kwargs) + return val + def GetReadOnly(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetReadOnly,(self,) + _args, _kwargs) + return val + def GetTextRange(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetTextRange,(self,) + _args, _kwargs) + return val + def GetStyledTextRange(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetStyledTextRange,(self,) + _args, _kwargs) + return val + def AddText(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AddText,(self,) + _args, _kwargs) + return val + def AddStyledText(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AddStyledText,(self,) + _args, _kwargs) + return val + def InsertText(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_InsertText,(self,) + _args, _kwargs) + return val + def ClearAll(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ClearAll,(self,) + _args, _kwargs) + return val + def GetCharAt(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetCharAt,(self,) + _args, _kwargs) + return val + def GetStyleAt(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetStyleAt,(self,) + _args, _kwargs) + return val + def SetStyleBits(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetStyleBits,(self,) + _args, _kwargs) + return val + def GetStyleBits(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetStyleBits,(self,) + _args, _kwargs) + return val + def Cut(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_Cut,(self,) + _args, _kwargs) + return val + def Copy(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_Copy,(self,) + _args, _kwargs) + return val + def Paste(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_Paste,(self,) + _args, _kwargs) + return val + def CanPaste(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CanPaste,(self,) + _args, _kwargs) + return val + def ClearClipbrd(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ClearClipbrd,(self,) + _args, _kwargs) + return val + def Undo(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_Undo,(self,) + _args, _kwargs) + return val + def CanUndo(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CanUndo,(self,) + _args, _kwargs) + return val + def EmptyUndoBuffer(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_EmptyUndoBuffer,(self,) + _args, _kwargs) + return val + def Redo(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_Redo,(self,) + _args, _kwargs) + return val + def CanRedo(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CanRedo,(self,) + _args, _kwargs) + return val + def SetUndoCollection(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetUndoCollection,(self,) + _args, _kwargs) + return val + def GetUndoCollection(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetUndoCollection,(self,) + _args, _kwargs) + return val + def BeginUndoAction(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_BeginUndoAction,(self,) + _args, _kwargs) + return val + def EndUndoAction(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_EndUndoAction,(self,) + _args, _kwargs) + return val + def GetSelection(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetSelection,(self,) + _args, _kwargs) + return val + def SetSelection(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetSelection,(self,) + _args, _kwargs) + return val + def GetSelectedText(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetSelectedText,(self,) + _args, _kwargs) + return val + def HideSelection(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_HideSelection,(self,) + _args, _kwargs) + return val + def GetHideSelection(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetHideSelection,(self,) + _args, _kwargs) + return val + def GetTextLength(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetTextLength,(self,) + _args, _kwargs) + return val + def GetFirstVisibleLine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetFirstVisibleLine,(self,) + _args, _kwargs) + return val + def GetModified(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetModified,(self,) + _args, _kwargs) + return val + def GetLineCount(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLineCount,(self,) + _args, _kwargs) + return val + def GetRect(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetRect,(self,) + _args, _kwargs) + if val: val = wxRectPtr(val) ; val.thisown = 1 + return val + def GetLineFromPos(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLineFromPos,(self,) + _args, _kwargs) + return val + def GetLineStartPos(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLineStartPos,(self,) + _args, _kwargs) + return val + def GetLineLengthAtPos(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLineLengthAtPos,(self,) + _args, _kwargs) + return val + def GetLineLength(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLineLength,(self,) + _args, _kwargs) + return val + def GetCurrentLineText(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetCurrentLineText,(self,) + _args, _kwargs) + return val + def GetCurrentLine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetCurrentLine,(self,) + _args, _kwargs) + return val + def PositionFromPoint(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_PositionFromPoint,(self,) + _args, _kwargs) + return val + def LineFromPoint(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_LineFromPoint,(self,) + _args, _kwargs) + return val + def PointFromPosition(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_PointFromPosition,(self,) + _args, _kwargs) + if val: val = wxPointPtr(val) ; val.thisown = 1 + return val + def GetCurrentPos(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetCurrentPos,(self,) + _args, _kwargs) + return val + def GetAnchor(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetAnchor,(self,) + _args, _kwargs) + return val + def SelectAll(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SelectAll,(self,) + _args, _kwargs) + return val + def SetCurrentPosition(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetCurrentPosition,(self,) + _args, _kwargs) + return val + def SetAnchor(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetAnchor,(self,) + _args, _kwargs) + return val + def GotoPos(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GotoPos,(self,) + _args, _kwargs) + return val + def GotoLine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GotoLine,(self,) + _args, _kwargs) + return val + def ChangePosition(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ChangePosition,(self,) + _args, _kwargs) + return val + def PageMove(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_PageMove,(self,) + _args, _kwargs) + return val + def ScrollBy(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ScrollBy,(self,) + _args, _kwargs) + return val + def ScrollToLine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ScrollToLine,(self,) + _args, _kwargs) + return val + def ScrollToColumn(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ScrollToColumn,(self,) + _args, _kwargs) + return val + def EnsureCaretVisible(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_EnsureCaretVisible,(self,) + _args, _kwargs) + return val + def SetCaretPolicy(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetCaretPolicy,(self,) + _args, _kwargs) + return val + def GetSelectionType(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetSelectionType,(self,) + _args, _kwargs) + return val + def GetLinesOnScreen(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLinesOnScreen,(self,) + _args, _kwargs) + return val + def IsSelectionRectangle(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_IsSelectionRectangle,(self,) + _args, _kwargs) + return val + def SetUseHorizontalScrollBar(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetUseHorizontalScrollBar,(self,) + _args, _kwargs) + return val + def GetUseHorizontalScrollBar(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetUseHorizontalScrollBar,(self,) + _args, _kwargs) + return val + def FindText(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_FindText,(self,) + _args, _kwargs) + return val + def SearchAnchor(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SearchAnchor,(self,) + _args, _kwargs) + return val + def SearchNext(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SearchNext,(self,) + _args, _kwargs) + return val + def SearchPrev(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SearchPrev,(self,) + _args, _kwargs) + return val + def GetViewWhitespace(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetViewWhitespace,(self,) + _args, _kwargs) + return val + def SetViewWhitespace(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetViewWhitespace,(self,) + _args, _kwargs) + return val + def GetEOLMode(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetEOLMode,(self,) + _args, _kwargs) + return val + def SetEOLMode(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetEOLMode,(self,) + _args, _kwargs) + return val + def GetViewEOL(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetViewEOL,(self,) + _args, _kwargs) + return val + def SetViewEOL(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetViewEOL,(self,) + _args, _kwargs) + return val + def ConvertEOL(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ConvertEOL,(self,) + _args, _kwargs) + return val + def GetEndStyled(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetEndStyled,(self,) + _args, _kwargs) + return val + def StartStyling(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StartStyling,(self,) + _args, _kwargs) + return val + def SetStyleFor(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetStyleFor,(self,) + _args, _kwargs) + return val + def SetStyleBytes(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetStyleBytes,(self,) + _args, _kwargs) + return val + def SetLineState(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetLineState,(self,) + _args, _kwargs) + return val + def GetLineState(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLineState,(self,) + _args, _kwargs) + return val + def StyleClearAll(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleClearAll,(self,) + _args, _kwargs) + return val + def StyleResetDefault(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleResetDefault,(self,) + _args, _kwargs) + return val + def StyleSetSpec(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetSpec,(self,) + _args, _kwargs) + return val + def StyleSetForeground(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetForeground,(self,) + _args, _kwargs) + return val + def StyleSetBackground(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetBackground,(self,) + _args, _kwargs) + return val + def StyleSetFont(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetFont,(self,) + _args, _kwargs) + return val + def StyleSetFontAttr(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetFontAttr,(self,) + _args, _kwargs) + return val + def StyleSetBold(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetBold,(self,) + _args, _kwargs) + return val + def StyleSetItalic(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetItalic,(self,) + _args, _kwargs) + return val + def StyleSetFaceName(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetFaceName,(self,) + _args, _kwargs) + return val + def StyleSetSize(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetSize,(self,) + _args, _kwargs) + return val + def StyleSetEOLFilled(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetEOLFilled,(self,) + _args, _kwargs) + return val + def StyleSetUnderline(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_StyleSetUnderline,(self,) + _args, _kwargs) + return val + def GetLeftMargin(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLeftMargin,(self,) + _args, _kwargs) + return val + def GetRightMargin(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetRightMargin,(self,) + _args, _kwargs) + return val + def SetMargins(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetMargins,(self,) + _args, _kwargs) + return val + def SetMarginType(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetMarginType,(self,) + _args, _kwargs) + return val + def GetMarginType(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetMarginType,(self,) + _args, _kwargs) + return val + def SetMarginWidth(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetMarginWidth,(self,) + _args, _kwargs) + return val + def GetMarginWidth(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetMarginWidth,(self,) + _args, _kwargs) + return val + def SetMarginMask(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetMarginMask,(self,) + _args, _kwargs) + return val + def GetMarginMask(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetMarginMask,(self,) + _args, _kwargs) + return val + def SetMarginSensitive(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetMarginSensitive,(self,) + _args, _kwargs) + return val + def GetMarginSensitive(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetMarginSensitive,(self,) + _args, _kwargs) + return val + def SetSelectionForeground(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetSelectionForeground,(self,) + _args, _kwargs) + return val + def SetSelectionBackground(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetSelectionBackground,(self,) + _args, _kwargs) + return val + def SetCaretForeground(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetCaretForeground,(self,) + _args, _kwargs) + return val + def GetCaretPeriod(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetCaretPeriod,(self,) + _args, _kwargs) + return val + def SetCaretPeriod(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetCaretPeriod,(self,) + _args, _kwargs) + return val + def SetBufferedDraw(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetBufferedDraw,(self,) + _args, _kwargs) + return val + def SetTabWidth(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetTabWidth,(self,) + _args, _kwargs) + return val + def SetIndent(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetIndent,(self,) + _args, _kwargs) + return val + def SetUseTabs(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetUseTabs,(self,) + _args, _kwargs) + return val + def SetLineIndentation(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetLineIndentation,(self,) + _args, _kwargs) + return val + def GetLineIndentation(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLineIndentation,(self,) + _args, _kwargs) + return val + def GetLineIndentationPos(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLineIndentationPos,(self,) + _args, _kwargs) + return val + def SetWordChars(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetWordChars,(self,) + _args, _kwargs) + return val + def SetUsePop(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetUsePop,(self,) + _args, _kwargs) + return val + def BraceHighlight(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_BraceHighlight,(self,) + _args, _kwargs) + return val + def BraceBadlight(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_BraceBadlight,(self,) + _args, _kwargs) + return val + def BraceMatch(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_BraceMatch,(self,) + _args, _kwargs) + return val + def MarkerDefine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerDefine,(self,) + _args, _kwargs) + return val + def MarkerSetType(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerSetType,(self,) + _args, _kwargs) + return val + def MarkerSetForeground(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerSetForeground,(self,) + _args, _kwargs) + return val + def MarkerSetBackground(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerSetBackground,(self,) + _args, _kwargs) + return val + def MarkerAdd(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerAdd,(self,) + _args, _kwargs) + return val + def MarkerDelete(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerDelete,(self,) + _args, _kwargs) + return val + def MarkerDeleteAll(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerDeleteAll,(self,) + _args, _kwargs) + return val + def MarkerGet(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerGet,(self,) + _args, _kwargs) + return val + def MarkerGetNextLine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerGetNextLine,(self,) + _args, _kwargs) + return val + def MarkerGetPrevLine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerGetPrevLine,(self,) + _args, _kwargs) + return val + def MarkerLineFromHandle(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerLineFromHandle,(self,) + _args, _kwargs) + return val + def MarkerDeleteHandle(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_MarkerDeleteHandle,(self,) + _args, _kwargs) + return val + def IndicatorSetStyle(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_IndicatorSetStyle,(self,) + _args, _kwargs) + return val + def IndicatorGetStyle(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_IndicatorGetStyle,(self,) + _args, _kwargs) + return val + def IndicatorSetColour(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_IndicatorSetColour,(self,) + _args, _kwargs) + return val + def AutoCompShow(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AutoCompShow,(self,) + _args, _kwargs) + return val + def AutoCompCancel(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AutoCompCancel,(self,) + _args, _kwargs) + return val + def AutoCompActive(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AutoCompActive,(self,) + _args, _kwargs) + return val + def AutoCompPosAtStart(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AutoCompPosAtStart,(self,) + _args, _kwargs) + return val + def AutoCompComplete(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AutoCompComplete,(self,) + _args, _kwargs) + return val + def AutoCompStopChars(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AutoCompStopChars,(self,) + _args, _kwargs) + return val + def AutoCompSetSeparator(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AutoCompSetSeparator,(self,) + _args, _kwargs) + return val + def AutoCompGetSeparator(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AutoCompGetSeparator,(self,) + _args, _kwargs) + return val + def AutoCompSelect(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_AutoCompSelect,(self,) + _args, _kwargs) + return val + def CallTipShow(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CallTipShow,(self,) + _args, _kwargs) + return val + def CallTipCancel(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CallTipCancel,(self,) + _args, _kwargs) + return val + def CallTipActive(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CallTipActive,(self,) + _args, _kwargs) + return val + def CallTipPosAtStart(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CallTipPosAtStart,(self,) + _args, _kwargs) + return val + def CallTipSetHighlight(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CallTipSetHighlight,(self,) + _args, _kwargs) + return val + def CallTipSetBackground(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CallTipSetBackground,(self,) + _args, _kwargs) + return val + def CmdKeyAssign(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CmdKeyAssign,(self,) + _args, _kwargs) + return val + def CmdKeyClear(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CmdKeyClear,(self,) + _args, _kwargs) + return val + def CmdKeyClearAll(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CmdKeyClearAll,(self,) + _args, _kwargs) + return val + def CmdKeyExecute(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_CmdKeyExecute,(self,) + _args, _kwargs) + return val + def FormatRange(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_FormatRange,(self,) + _args, _kwargs) + return val + def GetDocument(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetDocument,(self,) + _args, _kwargs) + return val + def SetDocument(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetDocument,(self,) + _args, _kwargs) + return val + def VisibleFromDocLine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_VisibleFromDocLine,(self,) + _args, _kwargs) + return val + def DocLineFromVisible(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_DocLineFromVisible,(self,) + _args, _kwargs) + return val + def SetFoldLevel(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetFoldLevel,(self,) + _args, _kwargs) + return val + def GetFoldLevel(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetFoldLevel,(self,) + _args, _kwargs) + return val + def GetLastChild(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLastChild,(self,) + _args, _kwargs) + return val + def GetFoldParent(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetFoldParent,(self,) + _args, _kwargs) + return val + def ShowLines(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ShowLines,(self,) + _args, _kwargs) + return val + def HideLines(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_HideLines,(self,) + _args, _kwargs) + return val + def GetLineVisible(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLineVisible,(self,) + _args, _kwargs) + return val + def SetFoldExpanded(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetFoldExpanded,(self,) + _args, _kwargs) + return val + def GetFoldExpanded(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetFoldExpanded,(self,) + _args, _kwargs) + return val + def ToggleFold(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ToggleFold,(self,) + _args, _kwargs) + return val + def EnsureVisible(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_EnsureVisible,(self,) + _args, _kwargs) + return val + def SetFoldFlags(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetFoldFlags,(self,) + _args, _kwargs) + return val + def ZoomIn(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ZoomIn,(self,) + _args, _kwargs) + return val + def ZoomOut(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_ZoomOut,(self,) + _args, _kwargs) + return val + def SetZoom(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetZoom,(self,) + _args, _kwargs) + return val + def GetZoom(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetZoom,(self,) + _args, _kwargs) + return val + def GetEdgeColumn(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetEdgeColumn,(self,) + _args, _kwargs) + return val + def SetEdgeColumn(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetEdgeColumn,(self,) + _args, _kwargs) + return val + def GetEdgeMode(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetEdgeMode,(self,) + _args, _kwargs) + return val + def SetEdgeMode(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetEdgeMode,(self,) + _args, _kwargs) + return val + def GetEdgeColour(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetEdgeColour,(self,) + _args, _kwargs) + if val: val = wxColourPtr(val) ; val.thisown = 1 + return val + def SetEdgeColour(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetEdgeColour,(self,) + _args, _kwargs) + return val + def SetLexer(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetLexer,(self,) + _args, _kwargs) + return val + def GetLexer(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_GetLexer,(self,) + _args, _kwargs) + return val + def Colourise(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_Colourise,(self,) + _args, _kwargs) + return val + def SetProperty(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetProperty,(self,) + _args, _kwargs) + return val + def SetKeywords(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetKeywords,(self,) + _args, _kwargs) + return val + def SetModEventMask(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextCtrl_SetModEventMask,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "<C wxStyledTextCtrl instance at %s>" % (self.this,) +class wxStyledTextCtrl(wxStyledTextCtrlPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(stc_c.new_wxStyledTextCtrl,_args,_kwargs) + self.thisown = 1 + + + + +class wxStyledTextEventPtr(wxCommandEventPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def __del__(self,stc_c=stc_c): + if self.thisown == 1 : + stc_c.delete_wxStyledTextEvent(self) + def SetPosition(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetPosition,(self,) + _args, _kwargs) + return val + def SetKey(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetKey,(self,) + _args, _kwargs) + return val + def SetModifiers(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetModifiers,(self,) + _args, _kwargs) + return val + def SetModificationType(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetModificationType,(self,) + _args, _kwargs) + return val + def SetText(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetText,(self,) + _args, _kwargs) + return val + def SetLength(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetLength,(self,) + _args, _kwargs) + return val + def SetLinesAdded(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetLinesAdded,(self,) + _args, _kwargs) + return val + def SetLine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetLine,(self,) + _args, _kwargs) + return val + def SetFoldLevelNow(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetFoldLevelNow,(self,) + _args, _kwargs) + return val + def SetFoldLevelPrev(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetFoldLevelPrev,(self,) + _args, _kwargs) + return val + def SetMargin(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetMargin,(self,) + _args, _kwargs) + return val + def SetMessage(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetMessage,(self,) + _args, _kwargs) + return val + def SetWParam(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetWParam,(self,) + _args, _kwargs) + return val + def SetLParam(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_SetLParam,(self,) + _args, _kwargs) + return val + def GetPosition(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetPosition,(self,) + _args, _kwargs) + return val + def GetKey(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetKey,(self,) + _args, _kwargs) + return val + def GetModifiers(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetModifiers,(self,) + _args, _kwargs) + return val + def GetModificationType(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetModificationType,(self,) + _args, _kwargs) + return val + def GetText(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetText,(self,) + _args, _kwargs) + return val + def GetLength(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetLength,(self,) + _args, _kwargs) + return val + def GetLinesAdded(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetLinesAdded,(self,) + _args, _kwargs) + return val + def GetLine(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetLine,(self,) + _args, _kwargs) + return val + def GetFoldLevelNow(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetFoldLevelNow,(self,) + _args, _kwargs) + return val + def GetFoldLevelPrev(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetFoldLevelPrev,(self,) + _args, _kwargs) + return val + def GetMargin(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetMargin,(self,) + _args, _kwargs) + return val + def GetMessage(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetMessage,(self,) + _args, _kwargs) + return val + def GetWParam(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetWParam,(self,) + _args, _kwargs) + return val + def GetLParam(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetLParam,(self,) + _args, _kwargs) + return val + def GetShift(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetShift,(self,) + _args, _kwargs) + return val + def GetControl(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetControl,(self,) + _args, _kwargs) + return val + def GetAlt(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_GetAlt,(self,) + _args, _kwargs) + return val + def CopyObject(self, *_args, **_kwargs): + val = apply(stc_c.wxStyledTextEvent_CopyObject,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "<C wxStyledTextEvent instance at %s>" % (self.this,) +class wxStyledTextEvent(wxStyledTextEventPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(stc_c.new_wxStyledTextEvent,_args,_kwargs) + self.thisown = 1 + + + + + + +#-------------- FUNCTION WRAPPERS ------------------ + + + +#-------------- VARIABLE WRAPPERS ------------------ + +wxSTC_UndoCollectNone = stc_c.wxSTC_UndoCollectNone +wxSTC_UndoCollectAutoStart = stc_c.wxSTC_UndoCollectAutoStart +wxSTC_EOL_CRLF = stc_c.wxSTC_EOL_CRLF +wxSTC_EOL_CR = stc_c.wxSTC_EOL_CR +wxSTC_EOL_LF = stc_c.wxSTC_EOL_LF +wxSTC_EDGE_NONE = stc_c.wxSTC_EDGE_NONE +wxSTC_EDGE_LINE = stc_c.wxSTC_EDGE_LINE +wxSTC_EDGE_BACKGROUND = stc_c.wxSTC_EDGE_BACKGROUND +wxSTC_LEX_STYLE_MAX = stc_c.wxSTC_LEX_STYLE_MAX +wxSTC_STYLE_DEFAULT = stc_c.wxSTC_STYLE_DEFAULT +wxSTC_STYLE_LINENUMBER = stc_c.wxSTC_STYLE_LINENUMBER +wxSTC_STYLE_BRACELIGHT = stc_c.wxSTC_STYLE_BRACELIGHT +wxSTC_STYLE_BRACEBAD = stc_c.wxSTC_STYLE_BRACEBAD +wxSTC_STYLE_CONTROLCHAR = stc_c.wxSTC_STYLE_CONTROLCHAR +wxSTC_STYLE_MAX = stc_c.wxSTC_STYLE_MAX +wxSTC_STYLE_MASK = stc_c.wxSTC_STYLE_MASK +wxSTC_MARKER_MAX = stc_c.wxSTC_MARKER_MAX +wxSTC_MARK_CIRCLE = stc_c.wxSTC_MARK_CIRCLE +wxSTC_MARK_ROUNDRECT = stc_c.wxSTC_MARK_ROUNDRECT +wxSTC_MARK_ARROW = stc_c.wxSTC_MARK_ARROW +wxSTC_MARK_SMALLRECT = stc_c.wxSTC_MARK_SMALLRECT +wxSTC_MARK_SHORTARROW = stc_c.wxSTC_MARK_SHORTARROW +wxSTC_MARK_EMPTY = stc_c.wxSTC_MARK_EMPTY +wxSTC_MARK_ARROWDOWN = stc_c.wxSTC_MARK_ARROWDOWN +wxSTC_MARK_MINUS = stc_c.wxSTC_MARK_MINUS +wxSTC_MARK_PLUS = stc_c.wxSTC_MARK_PLUS +wxSTC_MARKNUM_FOLDER = stc_c.wxSTC_MARKNUM_FOLDER +wxSTC_MARKNUM_FOLDEROPEN = stc_c.wxSTC_MARKNUM_FOLDEROPEN +wxSTC_MASK_FOLDERS = stc_c.wxSTC_MASK_FOLDERS +wxSTC_INDIC_MAX = stc_c.wxSTC_INDIC_MAX +wxSTC_INDIC_PLAIN = stc_c.wxSTC_INDIC_PLAIN +wxSTC_INDIC_SQUIGGLE = stc_c.wxSTC_INDIC_SQUIGGLE +wxSTC_INDIC_TT = stc_c.wxSTC_INDIC_TT +wxSTC_INDIC_DIAGONAL = stc_c.wxSTC_INDIC_DIAGONAL +wxSTC_INDIC_STRIKE = stc_c.wxSTC_INDIC_STRIKE +wxSTC_INDIC0_MASK = stc_c.wxSTC_INDIC0_MASK +wxSTC_INDIC1_MASK = stc_c.wxSTC_INDIC1_MASK +wxSTC_INDIC2_MASK = stc_c.wxSTC_INDIC2_MASK +wxSTC_INDICS_MASK = stc_c.wxSTC_INDICS_MASK +wxSTC_FOLDLEVELBASE = stc_c.wxSTC_FOLDLEVELBASE +wxSTC_FOLDLEVELWHITEFLAG = stc_c.wxSTC_FOLDLEVELWHITEFLAG +wxSTC_FOLDLEVELHEADERFLAG = stc_c.wxSTC_FOLDLEVELHEADERFLAG +wxSTC_FOLDLEVELNUMBERMASK = stc_c.wxSTC_FOLDLEVELNUMBERMASK +wxSTC_CMD_LINEDOWN = stc_c.wxSTC_CMD_LINEDOWN +wxSTC_CMD_LINEDOWNEXTEND = stc_c.wxSTC_CMD_LINEDOWNEXTEND +wxSTC_CMD_LINEUP = stc_c.wxSTC_CMD_LINEUP +wxSTC_CMD_LINEUPEXTEND = stc_c.wxSTC_CMD_LINEUPEXTEND +wxSTC_CMD_CHARLEFT = stc_c.wxSTC_CMD_CHARLEFT +wxSTC_CMD_CHARLEFTEXTEND = stc_c.wxSTC_CMD_CHARLEFTEXTEND +wxSTC_CMD_CHARRIGHT = stc_c.wxSTC_CMD_CHARRIGHT +wxSTC_CMD_CHARRIGHTEXTEND = stc_c.wxSTC_CMD_CHARRIGHTEXTEND +wxSTC_CMD_WORDLEFT = stc_c.wxSTC_CMD_WORDLEFT +wxSTC_CMD_WORDLEFTEXTEND = stc_c.wxSTC_CMD_WORDLEFTEXTEND +wxSTC_CMD_WORDRIGHT = stc_c.wxSTC_CMD_WORDRIGHT +wxSTC_CMD_WORDRIGHTEXTEND = stc_c.wxSTC_CMD_WORDRIGHTEXTEND +wxSTC_CMD_HOME = stc_c.wxSTC_CMD_HOME +wxSTC_CMD_HOMEEXTEND = stc_c.wxSTC_CMD_HOMEEXTEND +wxSTC_CMD_LINEEND = stc_c.wxSTC_CMD_LINEEND +wxSTC_CMD_LINEENDEXTEND = stc_c.wxSTC_CMD_LINEENDEXTEND +wxSTC_CMD_DOCUMENTSTART = stc_c.wxSTC_CMD_DOCUMENTSTART +wxSTC_CMD_DOCUMENTSTARTEXTEND = stc_c.wxSTC_CMD_DOCUMENTSTARTEXTEND +wxSTC_CMD_DOCUMENTEND = stc_c.wxSTC_CMD_DOCUMENTEND +wxSTC_CMD_DOCUMENTENDEXTEND = stc_c.wxSTC_CMD_DOCUMENTENDEXTEND +wxSTC_CMD_PAGEUP = stc_c.wxSTC_CMD_PAGEUP +wxSTC_CMD_PAGEUPEXTEND = stc_c.wxSTC_CMD_PAGEUPEXTEND +wxSTC_CMD_PAGEDOWN = stc_c.wxSTC_CMD_PAGEDOWN +wxSTC_CMD_PAGEDOWNEXTEND = stc_c.wxSTC_CMD_PAGEDOWNEXTEND +wxSTC_CMD_EDITTOGGLEOVERTYPE = stc_c.wxSTC_CMD_EDITTOGGLEOVERTYPE +wxSTC_CMD_CANCEL = stc_c.wxSTC_CMD_CANCEL +wxSTC_CMD_DELETEBACK = stc_c.wxSTC_CMD_DELETEBACK +wxSTC_CMD_TAB = stc_c.wxSTC_CMD_TAB +wxSTC_CMD_BACKTAB = stc_c.wxSTC_CMD_BACKTAB +wxSTC_CMD_NEWLINE = stc_c.wxSTC_CMD_NEWLINE +wxSTC_CMD_FORMFEED = stc_c.wxSTC_CMD_FORMFEED +wxSTC_CMD_VCHOME = stc_c.wxSTC_CMD_VCHOME +wxSTC_CMD_VCHOMEEXTEND = stc_c.wxSTC_CMD_VCHOMEEXTEND +wxSTC_CMD_ZOOMIN = stc_c.wxSTC_CMD_ZOOMIN +wxSTC_CMD_ZOOMOUT = stc_c.wxSTC_CMD_ZOOMOUT +wxSTC_CMD_DELWORDLEFT = stc_c.wxSTC_CMD_DELWORDLEFT +wxSTC_CMD_DELWORDRIGHT = stc_c.wxSTC_CMD_DELWORDRIGHT +wxSTC_CMD_LINECUT = stc_c.wxSTC_CMD_LINECUT +wxSTC_CMD_LINEDELETE = stc_c.wxSTC_CMD_LINEDELETE +wxSTC_CMD_LINETRANSPOSE = stc_c.wxSTC_CMD_LINETRANSPOSE +wxSTC_CMD_LOWERCASE = stc_c.wxSTC_CMD_LOWERCASE +wxSTC_CMD_UPPERCASE = stc_c.wxSTC_CMD_UPPERCASE +wxSTC_CMD_LINESCROLLDOWN = stc_c.wxSTC_CMD_LINESCROLLDOWN +wxSTC_CMD_LINESCROLLUP = stc_c.wxSTC_CMD_LINESCROLLUP +wxSTC_LEX_CONTAINER = stc_c.wxSTC_LEX_CONTAINER +wxSTC_LEX_NULL = stc_c.wxSTC_LEX_NULL +wxSTC_LEX_PYTHON = stc_c.wxSTC_LEX_PYTHON +wxSTC_LEX_CPP = stc_c.wxSTC_LEX_CPP +wxSTC_LEX_HTML = stc_c.wxSTC_LEX_HTML +wxSTC_LEX_XML = stc_c.wxSTC_LEX_XML +wxSTC_LEX_PERL = stc_c.wxSTC_LEX_PERL +wxSTC_LEX_SQL = stc_c.wxSTC_LEX_SQL +wxSTC_LEX_VB = stc_c.wxSTC_LEX_VB +wxSTC_LEX_PROPERTIES = stc_c.wxSTC_LEX_PROPERTIES +wxSTC_LEX_ERRORLIST = stc_c.wxSTC_LEX_ERRORLIST +wxSTC_LEX_MAKEFILE = stc_c.wxSTC_LEX_MAKEFILE +wxSTC_LEX_BATCH = stc_c.wxSTC_LEX_BATCH +wxSTC_LEX_XCODE = stc_c.wxSTC_LEX_XCODE +wxSTC_LEX_LATEX = stc_c.wxSTC_LEX_LATEX +wxSTC_CARET_SLOP = stc_c.wxSTC_CARET_SLOP +WXSTC_CARET_CENTER = stc_c.WXSTC_CARET_CENTER +wxSTC_CARET_STRICT = stc_c.wxSTC_CARET_STRICT +wxSTC_MARGIN_SYMBOL = stc_c.wxSTC_MARGIN_SYMBOL +wxSTC_MARGIN_NUMBER = stc_c.wxSTC_MARGIN_NUMBER +wxSTCNameStr = stc_c.wxSTCNameStr +wxEVT_STC_CHANGE = stc_c.wxEVT_STC_CHANGE +wxEVT_STC_STYLENEEDED = stc_c.wxEVT_STC_STYLENEEDED +wxEVT_STC_CHARADDED = stc_c.wxEVT_STC_CHARADDED +wxEVT_STC_UPDATEUI = stc_c.wxEVT_STC_UPDATEUI +wxEVT_STC_SAVEPOINTREACHED = stc_c.wxEVT_STC_SAVEPOINTREACHED +wxEVT_STC_SAVEPOINTLEFT = stc_c.wxEVT_STC_SAVEPOINTLEFT +wxEVT_STC_ROMODIFYATTEMPT = stc_c.wxEVT_STC_ROMODIFYATTEMPT +wxEVT_STC_DOUBLECLICK = stc_c.wxEVT_STC_DOUBLECLICK +wxEVT_STC_MODIFIED = stc_c.wxEVT_STC_MODIFIED +wxEVT_STC_KEY = stc_c.wxEVT_STC_KEY +wxEVT_STC_MACRORECORD = stc_c.wxEVT_STC_MACRORECORD +wxEVT_STC_MARGINCLICK = stc_c.wxEVT_STC_MARGINCLICK +wxEVT_STC_NEEDSHOWN = stc_c.wxEVT_STC_NEEDSHOWN +wxSTC_MOD_INSERTTEXT = stc_c.wxSTC_MOD_INSERTTEXT +wxSTC_MOD_DELETETEXT = stc_c.wxSTC_MOD_DELETETEXT +wxSTC_MOD_CHANGESTYLE = stc_c.wxSTC_MOD_CHANGESTYLE +wxSTC_MOD_CHANGEFOLD = stc_c.wxSTC_MOD_CHANGEFOLD +wxSTC_PERFORMED_USER = stc_c.wxSTC_PERFORMED_USER +wxSTC_PERFORMED_UNDO = stc_c.wxSTC_PERFORMED_UNDO +wxSTC_PERFORMED_REDO = stc_c.wxSTC_PERFORMED_REDO +wxSTC_LASTSTEPINUNDOREDO = stc_c.wxSTC_LASTSTEPINUNDOREDO +wxSTC_MOD_CHANGEMARKER = stc_c.wxSTC_MOD_CHANGEMARKER +wxSTC_MOD_BEFOREINSERT = stc_c.wxSTC_MOD_BEFOREINSERT +wxSTC_MOD_BEFOREDELETE = stc_c.wxSTC_MOD_BEFOREDELETE +SCLEX_CONTAINER = stc_c.SCLEX_CONTAINER +SCLEX_NULL = stc_c.SCLEX_NULL +SCLEX_PYTHON = stc_c.SCLEX_PYTHON +SCLEX_CPP = stc_c.SCLEX_CPP +SCLEX_HTML = stc_c.SCLEX_HTML +SCLEX_XML = stc_c.SCLEX_XML +SCLEX_PERL = stc_c.SCLEX_PERL +SCLEX_SQL = stc_c.SCLEX_SQL +SCLEX_VB = stc_c.SCLEX_VB +SCLEX_PROPERTIES = stc_c.SCLEX_PROPERTIES +SCLEX_ERRORLIST = stc_c.SCLEX_ERRORLIST +SCLEX_MAKEFILE = stc_c.SCLEX_MAKEFILE +SCLEX_BATCH = stc_c.SCLEX_BATCH +SCLEX_XCODE = stc_c.SCLEX_XCODE +SCLEX_LATEX = stc_c.SCLEX_LATEX +SCE_P_DEFAULT = stc_c.SCE_P_DEFAULT +SCE_P_COMMENTLINE = stc_c.SCE_P_COMMENTLINE +SCE_P_NUMBER = stc_c.SCE_P_NUMBER +SCE_P_STRING = stc_c.SCE_P_STRING +SCE_P_CHARACTER = stc_c.SCE_P_CHARACTER +SCE_P_WORD = stc_c.SCE_P_WORD +SCE_P_TRIPLE = stc_c.SCE_P_TRIPLE +SCE_P_TRIPLEDOUBLE = stc_c.SCE_P_TRIPLEDOUBLE +SCE_P_CLASSNAME = stc_c.SCE_P_CLASSNAME +SCE_P_DEFNAME = stc_c.SCE_P_DEFNAME +SCE_P_OPERATOR = stc_c.SCE_P_OPERATOR +SCE_P_IDENTIFIER = stc_c.SCE_P_IDENTIFIER +SCE_P_COMMENTBLOCK = stc_c.SCE_P_COMMENTBLOCK +SCE_P_STRINGEOL = stc_c.SCE_P_STRINGEOL +SCE_C_DEFAULT = stc_c.SCE_C_DEFAULT +SCE_C_COMMENT = stc_c.SCE_C_COMMENT +SCE_C_COMMENTLINE = stc_c.SCE_C_COMMENTLINE +SCE_C_COMMENTDOC = stc_c.SCE_C_COMMENTDOC +SCE_C_NUMBER = stc_c.SCE_C_NUMBER +SCE_C_WORD = stc_c.SCE_C_WORD +SCE_C_STRING = stc_c.SCE_C_STRING +SCE_C_CHARACTER = stc_c.SCE_C_CHARACTER +SCE_C_UUID = stc_c.SCE_C_UUID +SCE_C_PREPROCESSOR = stc_c.SCE_C_PREPROCESSOR +SCE_C_OPERATOR = stc_c.SCE_C_OPERATOR +SCE_C_IDENTIFIER = stc_c.SCE_C_IDENTIFIER +SCE_C_STRINGEOL = stc_c.SCE_C_STRINGEOL +SCE_H_DEFAULT = stc_c.SCE_H_DEFAULT +SCE_H_TAG = stc_c.SCE_H_TAG +SCE_H_TAGUNKNOWN = stc_c.SCE_H_TAGUNKNOWN +SCE_H_ATTRIBUTE = stc_c.SCE_H_ATTRIBUTE +SCE_H_ATTRIBUTEUNKNOWN = stc_c.SCE_H_ATTRIBUTEUNKNOWN +SCE_H_NUMBER = stc_c.SCE_H_NUMBER +SCE_H_DOUBLESTRING = stc_c.SCE_H_DOUBLESTRING +SCE_H_SINGLESTRING = stc_c.SCE_H_SINGLESTRING +SCE_H_OTHER = stc_c.SCE_H_OTHER +SCE_H_COMMENT = stc_c.SCE_H_COMMENT +SCE_H_ENTITY = stc_c.SCE_H_ENTITY +SCE_H_TAGEND = stc_c.SCE_H_TAGEND +SCE_H_XMLSTART = stc_c.SCE_H_XMLSTART +SCE_H_XMLEND = stc_c.SCE_H_XMLEND +SCE_H_SCRIPT = stc_c.SCE_H_SCRIPT +SCE_H_ASP = stc_c.SCE_H_ASP +SCE_H_ASPAT = stc_c.SCE_H_ASPAT +SCE_HJ_START = stc_c.SCE_HJ_START +SCE_HJ_DEFAULT = stc_c.SCE_HJ_DEFAULT +SCE_HJ_COMMENT = stc_c.SCE_HJ_COMMENT +SCE_HJ_COMMENTLINE = stc_c.SCE_HJ_COMMENTLINE +SCE_HJ_COMMENTDOC = stc_c.SCE_HJ_COMMENTDOC +SCE_HJ_NUMBER = stc_c.SCE_HJ_NUMBER +SCE_HJ_WORD = stc_c.SCE_HJ_WORD +SCE_HJ_KEYWORD = stc_c.SCE_HJ_KEYWORD +SCE_HJ_DOUBLESTRING = stc_c.SCE_HJ_DOUBLESTRING +SCE_HJ_SINGLESTRING = stc_c.SCE_HJ_SINGLESTRING +SCE_HJ_SYMBOLS = stc_c.SCE_HJ_SYMBOLS +SCE_HJ_STRINGEOL = stc_c.SCE_HJ_STRINGEOL +SCE_HJA_START = stc_c.SCE_HJA_START +SCE_HJA_DEFAULT = stc_c.SCE_HJA_DEFAULT +SCE_HJA_COMMENT = stc_c.SCE_HJA_COMMENT +SCE_HJA_COMMENTLINE = stc_c.SCE_HJA_COMMENTLINE +SCE_HJA_COMMENTDOC = stc_c.SCE_HJA_COMMENTDOC +SCE_HJA_NUMBER = stc_c.SCE_HJA_NUMBER +SCE_HJA_WORD = stc_c.SCE_HJA_WORD +SCE_HJA_KEYWORD = stc_c.SCE_HJA_KEYWORD +SCE_HJA_DOUBLESTRING = stc_c.SCE_HJA_DOUBLESTRING +SCE_HJA_SINGLESTRING = stc_c.SCE_HJA_SINGLESTRING +SCE_HJA_SYMBOLS = stc_c.SCE_HJA_SYMBOLS +SCE_HJA_STRINGEOL = stc_c.SCE_HJA_STRINGEOL +SCE_HB_START = stc_c.SCE_HB_START +SCE_HB_DEFAULT = stc_c.SCE_HB_DEFAULT +SCE_HB_COMMENTLINE = stc_c.SCE_HB_COMMENTLINE +SCE_HB_NUMBER = stc_c.SCE_HB_NUMBER +SCE_HB_WORD = stc_c.SCE_HB_WORD +SCE_HB_STRING = stc_c.SCE_HB_STRING +SCE_HB_IDENTIFIER = stc_c.SCE_HB_IDENTIFIER +SCE_HB_STRINGEOL = stc_c.SCE_HB_STRINGEOL +SCE_HBA_START = stc_c.SCE_HBA_START +SCE_HBA_DEFAULT = stc_c.SCE_HBA_DEFAULT +SCE_HBA_COMMENTLINE = stc_c.SCE_HBA_COMMENTLINE +SCE_HBA_NUMBER = stc_c.SCE_HBA_NUMBER +SCE_HBA_WORD = stc_c.SCE_HBA_WORD +SCE_HBA_STRING = stc_c.SCE_HBA_STRING +SCE_HBA_IDENTIFIER = stc_c.SCE_HBA_IDENTIFIER +SCE_HBA_STRINGEOL = stc_c.SCE_HBA_STRINGEOL +SCE_HP_START = stc_c.SCE_HP_START +SCE_HP_DEFAULT = stc_c.SCE_HP_DEFAULT +SCE_HP_COMMENTLINE = stc_c.SCE_HP_COMMENTLINE +SCE_HP_NUMBER = stc_c.SCE_HP_NUMBER +SCE_HP_STRING = stc_c.SCE_HP_STRING +SCE_HP_CHARACTER = stc_c.SCE_HP_CHARACTER +SCE_HP_WORD = stc_c.SCE_HP_WORD +SCE_HP_TRIPLE = stc_c.SCE_HP_TRIPLE +SCE_HP_TRIPLEDOUBLE = stc_c.SCE_HP_TRIPLEDOUBLE +SCE_HP_CLASSNAME = stc_c.SCE_HP_CLASSNAME +SCE_HP_DEFNAME = stc_c.SCE_HP_DEFNAME +SCE_HP_OPERATOR = stc_c.SCE_HP_OPERATOR +SCE_HP_IDENTIFIER = stc_c.SCE_HP_IDENTIFIER +SCE_HPA_START = stc_c.SCE_HPA_START +SCE_HPA_DEFAULT = stc_c.SCE_HPA_DEFAULT +SCE_HPA_COMMENTLINE = stc_c.SCE_HPA_COMMENTLINE +SCE_HPA_NUMBER = stc_c.SCE_HPA_NUMBER +SCE_HPA_STRING = stc_c.SCE_HPA_STRING +SCE_HPA_CHARACTER = stc_c.SCE_HPA_CHARACTER +SCE_HPA_WORD = stc_c.SCE_HPA_WORD +SCE_HPA_TRIPLE = stc_c.SCE_HPA_TRIPLE +SCE_HPA_TRIPLEDOUBLE = stc_c.SCE_HPA_TRIPLEDOUBLE +SCE_HPA_CLASSNAME = stc_c.SCE_HPA_CLASSNAME +SCE_HPA_DEFNAME = stc_c.SCE_HPA_DEFNAME +SCE_HPA_OPERATOR = stc_c.SCE_HPA_OPERATOR +SCE_HPA_IDENTIFIER = stc_c.SCE_HPA_IDENTIFIER +SCE_PL_DEFAULT = stc_c.SCE_PL_DEFAULT +SCE_PL_HERE = stc_c.SCE_PL_HERE +SCE_PL_COMMENTLINE = stc_c.SCE_PL_COMMENTLINE +SCE_PL_POD = stc_c.SCE_PL_POD +SCE_PL_NUMBER = stc_c.SCE_PL_NUMBER +SCE_PL_WORD = stc_c.SCE_PL_WORD +SCE_PL_STRING = stc_c.SCE_PL_STRING +SCE_PL_CHARACTER = stc_c.SCE_PL_CHARACTER +SCE_PL_PUNCTUATION = stc_c.SCE_PL_PUNCTUATION +SCE_PL_PREPROCESSOR = stc_c.SCE_PL_PREPROCESSOR +SCE_PL_OPERATOR = stc_c.SCE_PL_OPERATOR +SCE_PL_IDENTIFIER = stc_c.SCE_PL_IDENTIFIER +SCE_PL_SCALAR = stc_c.SCE_PL_SCALAR +SCE_PL_ARRAY = stc_c.SCE_PL_ARRAY +SCE_PL_HASH = stc_c.SCE_PL_HASH +SCE_PL_SYMBOLTABLE = stc_c.SCE_PL_SYMBOLTABLE +SCE_PL_REF = stc_c.SCE_PL_REF +SCE_PL_REGEX = stc_c.SCE_PL_REGEX +SCE_PL_REGSUBST = stc_c.SCE_PL_REGSUBST +SCE_PL_LONGQUOTE = stc_c.SCE_PL_LONGQUOTE +SCE_PL_BACKTICKS = stc_c.SCE_PL_BACKTICKS +SCE_PL_DATASECTION = stc_c.SCE_PL_DATASECTION +SCE_L_DEFAULT = stc_c.SCE_L_DEFAULT +SCE_L_COMMAND = stc_c.SCE_L_COMMAND +SCE_L_TAG = stc_c.SCE_L_TAG +SCE_L_MATH = stc_c.SCE_L_MATH +SCE_L_COMMENT = stc_c.SCE_L_COMMENT + + +#-------------- USER INCLUDE ----------------------- + +# Stuff these names into the wx namespace so wxPyConstructObject can find them + +wx.wxStyledTextEventPtr = wxStyledTextEventPtr diff --git a/utils/wxPython/demo/.cvsignore b/wxPython/demo/.cvsignore similarity index 100% rename from utils/wxPython/demo/.cvsignore rename to wxPython/demo/.cvsignore diff --git a/utils/wxPython/demo/About.py b/wxPython/demo/About.py similarity index 100% rename from utils/wxPython/demo/About.py rename to wxPython/demo/About.py diff --git a/wxPython/demo/ActiveXWrapper_Acrobat.py b/wxPython/demo/ActiveXWrapper_Acrobat.py new file mode 100644 index 0000000000..349429acc3 --- /dev/null +++ b/wxPython/demo/ActiveXWrapper_Acrobat.py @@ -0,0 +1,130 @@ +""" +<html><body> +This demo shows how to embed an ActiveX control in a wxPython application, (Win32 only.) +<p> +The MakeActiveXClass function dynamically builds a new Class on the fly, that has the +same signature and semantics as wxWindow. This means that when you call the function +you get back a new class that you can use just like wxWindow, (set the size and position, +use in a sizer, etc.) except its contents will be the COM control. +<p> +This demo embeds the Adobe Acrobat Reader, and gives you some buttons for opening a PDF +file, changing pages, etc. that show how to call methods on the COM object. If you don't +have Acrobat Reader 4.0 installed it won't work. +</body></html> +""" + +from wxPython.wx import * + +if wxPlatform == '__WXMSW__': + from wxPython.lib.activexwrapper import MakeActiveXClass + import win32com.client.gencache + + try: + acrobat = win32com.client.gencache.EnsureModule('{CA8A9783-280D-11CF-A24D-444553540000}', 0x0, 1, 3) + except: + raise ImportError("Can't load PDF.OCX, install Acrobat 4.0") + + + +#---------------------------------------------------------------------- + +class TestPanel(wxPanel): + def __init__(self, parent): + wxPanel.__init__(self, parent, -1) + self.pdf = None + + sizer = wxBoxSizer(wxVERTICAL) + btnSizer = wxBoxSizer(wxHORIZONTAL) + + # this function creates a new class that can be used as + # a wxWindow, but contains the given ActiveX control. + ActiveXWrapper = MakeActiveXClass(acrobat.Pdf) + + # create an instance of the new class + self.pdf = ActiveXWrapper( self, -1, style=wxSUNKEN_BORDER) + + sizer.Add(self.pdf, 1, wxEXPAND) + + btn = wxButton(self, wxNewId(), "Open PDF File") + EVT_BUTTON(self, btn.GetId(), self.OnOpenButton) + btnSizer.Add(btn, 1, wxEXPAND|wxALL, 5) + + btn = wxButton(self, wxNewId(), "<-- Previous Page") + EVT_BUTTON(self, btn.GetId(), self.OnPrevPageButton) + btnSizer.Add(btn, 1, wxEXPAND|wxALL, 5) + + btn = wxButton(self, wxNewId(), "Next Page -->") + EVT_BUTTON(self, btn.GetId(), self.OnNextPageButton) + btnSizer.Add(btn, 1, wxEXPAND|wxALL, 5) + + + btnSizer.Add(50, -1, 2, wxEXPAND) + sizer.Add(btnSizer, 0, wxEXPAND) + + self.SetSizer(sizer) + self.SetAutoLayout(true) + + def __del__(self): + if self.pdf: + self.pdf.Cleanup() + self.pdf = None + + + + def OnOpenButton(self, event): + dlg = wxFileDialog(self, wildcard="*.pdf") + if dlg.ShowModal() == wxID_OK: + wxBeginBusyCursor() + self.pdf.LoadFile(dlg.GetPath()) + wxEndBusyCursor() + + dlg.Destroy() + + + def OnPrevPageButton(self, event): + self.pdf.gotoPreviousPage() + + + def OnNextPageButton(self, event): + self.pdf.gotoNextPage() + + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + if wxPlatform == '__WXMSW__': + win = TestPanel(nb) + return win + else: + dlg = wxMessageDialog(frame, 'This demo only works on MSW.', + 'Sorry', wxOK | wxICON_INFORMATION) + dlg.ShowModal() + dlg.Destroy() + + +overview = __doc__ + +#---------------------------------------------------------------------- + + +if __name__ == '__main__': + class TestFrame(wxFrame): + def __init__(self): + wxFrame.__init__(self, None, -1, "ActiveX test -- Acrobat", size=(640, 480), + style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) + self.tp = TestPanel(self, sys.stdout) + EVT_CLOSE(self, self.OnCloseWindow) + + def OnCloseWindow(self, event): + self.tp.pdf.Cleanup() + self.Destroy() + + + app = wxPySimpleApp() + frame = TestFrame() + frame.Show(true) + app.MainLoop() + + + diff --git a/wxPython/demo/ActiveXWrapper_IE.py b/wxPython/demo/ActiveXWrapper_IE.py new file mode 100644 index 0000000000..3cfd0ac559 --- /dev/null +++ b/wxPython/demo/ActiveXWrapper_IE.py @@ -0,0 +1,205 @@ +""" +<html><body> +This demo shows how to embed an ActiveX control in a wxPython +application, (Win32 only.) + +<p> +The MakeActiveXClass function dynamically builds a new Class on the +fly, that has the same signature and semantics as wxWindow. This +means that when you call the function you get back a new class that +you can use just like wxWindow, (set the size and position, use in a +sizer, etc.) except its contents will be the COM control. + +<p> +This demo embeds the Internet Exploer WebBrowser control, and shows +how to receive events from the COM control. (The title bar and status +bar are updated as pages change, in addition to the log messages being +shown.) +</body></html> +""" + +from wxPython.wx import * + +if wxPlatform == '__WXMSW__': + from wxPython.lib.activexwrapper import MakeActiveXClass + import win32com.client.gencache + + try: + browserModule = win32com.client.gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1) + except: + raise ImportError("IE4 or greater does not appear to be installed.") + + +#---------------------------------------------------------------------- + +class TestPanel(wxWindow): + def __init__(self, parent, log, frame=None): + wxWindow.__init__(self, parent, -1)#, style=wxCLIP_CHILDREN) + self.ie = None + self.log = log + self.current = "http://alldunn.com/" + self.frame = frame + if frame: + self.titleBase = frame.GetTitle() + + + sizer = wxBoxSizer(wxVERTICAL) + btnSizer = wxBoxSizer(wxHORIZONTAL) + + # Make a new class that derives from the WebBrowser class in the + # COM module imported above. This class also derives from wxWindow and + # implements the machinery needed to integrate the two worlds. + theClass = MakeActiveXClass(browserModule.WebBrowser, + eventObj = self) + + # Create an instance of that class + self.ie = theClass(self, -1, style=wxSUNKEN_BORDER) + + + #btn = wxButton(self, wxNewId(), " Open ") + #EVT_BUTTON(self, btn.GetId(), self.OnOpenButton) + #btnSizer.Add(btn, 0, wxEXPAND|wxALL, 5) + + btn = wxButton(self, wxNewId(), " Home ") + EVT_BUTTON(self, btn.GetId(), self.OnHomeButton) + btnSizer.Add(btn, 0, wxEXPAND|wxALL, 5) + + btn = wxButton(self, wxNewId(), " <-- ") + EVT_BUTTON(self, btn.GetId(), self.OnPrevPageButton) + btnSizer.Add(btn, 0, wxEXPAND|wxALL, 5) + + btn = wxButton(self, wxNewId(), " --> ") + EVT_BUTTON(self, btn.GetId(), self.OnNextPageButton) + btnSizer.Add(btn, 0, wxEXPAND|wxALL, 5) + + txt = wxStaticText(self, -1, "Location:") + btnSizer.Add(txt, 0, wxCENTER|wxALL, 5) + + self.location = wxComboBox(self, wxNewId(), "", style=wxCB_DROPDOWN) + EVT_COMBOBOX(self, self.location.GetId(), self.OnLocationSelect) + EVT_KEY_UP(self.location, self.OnLocationKey) + #EVT_CHAR(self.location, self.IgnoreReturn) + btnSizer.Add(self.location, 1, wxEXPAND|wxALL, 5) + + sizer.Add(btnSizer, 0, wxEXPAND) + sizer.Add(self.ie, 1, wxEXPAND) + + self.ie.Navigate(self.current) + self.location.Append(self.current) + + self.SetSizer(sizer) + self.SetAutoLayout(true) + EVT_SIZE(self, self.OnSize) + + + def OnSize(self, evt): + self.Layout() + + def __del__(self): + if self.ie: + self.ie.Cleanup() + self.ie = None + + def OnLocationSelect(self, evt): + url = self.location.GetStringSelection() + self.log.write('OnLocationSelect: %s\n' % url) + self.ie.Navigate(url) + + def OnLocationKey(self, evt): + if evt.KeyCode() == WXK_RETURN: + URL = self.location.GetValue() + self.location.Append(URL) + self.ie.Navigate(URL) + else: + evt.Skip() + + def IgnoreReturn(self, evt): + print 'IgnoreReturn' + if evt.KeyCode() != WXK_RETURN: + evt.Skip() + + def OnOpenButton(self, event): + dlg = wxTextEntryDialog(self, "Open Location", + "Enter a full URL or local path", + self.current, wxOK|wxCANCEL) + dlg.CentreOnParent() + if dlg.ShowModal() == wxID_OK: + self.current = dlg.GetValue() + self.ie.Navigate(self.current) + dlg.Destroy() + + def OnHomeButton(self, event): + self.ie.GoHome() ## ET Phone Home! + + def OnPrevPageButton(self, event): + self.ie.GoBack() + + + def OnNextPageButton(self, event): + self.ie.GoForward() + + + # The following event handlers are called by the web browser COM + # control since we passed self to MakeActiveXClass. It will look + # here for matching attributes and call them if they exist. See the + # module generated by makepy for details of method names, etc. + def OnBeforeNavigate2(self, pDisp, URL, *args): + self.log.write('OnBeforeNavigate2: %s\n' % URL) + + def OnNavigateComplete2(self, pDisp, URL): + self.log.write('OnNavigateComplete2: %s\n' % URL) + self.current = URL + self.location.SetValue(URL) + + def OnTitleChange(self, text): + self.log.write('OnTitleChange: %s\n' % text) + if self.frame: + self.frame.SetTitle(self.titleBase + ' -- ' + text) + + def OnStatusTextChange(self, text): + self.log.write('OnStatusTextChange: %s\n' % text) + if self.frame: + self.frame.SetStatusText(text) + + +#---------------------------------------------------------------------- +# for the demo framework... + +def runTest(frame, nb, log): + if wxPlatform == '__WXMSW__': + win = TestPanel(nb, log, frame) + return win + else: + dlg = wxMessageDialog(frame, 'This demo only works on MSW.', + 'Sorry', wxOK | wxICON_INFORMATION) + dlg.ShowModal() + dlg.Destroy() + + +overview = __doc__ + +#---------------------------------------------------------------------- + + +if __name__ == '__main__': + class TestFrame(wxFrame): + def __init__(self): + wxFrame.__init__(self, None, -1, "ActiveX test -- Internet Explorer", + size=(640, 480), + style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) + self.CreateStatusBar() + self.tp = TestPanel(self, sys.stdout, self) + EVT_CLOSE(self, self.OnCloseWindow) + + def OnCloseWindow(self, event): + self.tp.ie.Cleanup() + self.Destroy() + + + app = wxPySimpleApp() + frame = TestFrame() + frame.Show(true) + app.MainLoop() + + + diff --git a/utils/wxPython/demo/ColorPanel.py b/wxPython/demo/ColorPanel.py similarity index 100% rename from utils/wxPython/demo/ColorPanel.py rename to wxPython/demo/ColorPanel.py diff --git a/utils/wxPython/demo/CustomDragAndDrop.py b/wxPython/demo/CustomDragAndDrop.py similarity index 94% rename from utils/wxPython/demo/CustomDragAndDrop.py rename to wxPython/demo/CustomDragAndDrop.py index 560eada75c..eb33d57f3d 100644 --- a/utils/wxPython/demo/CustomDragAndDrop.py +++ b/wxPython/demo/CustomDragAndDrop.py @@ -19,6 +19,7 @@ class DoodlePad(wxWindow): EVT_LEFT_UP(self, self.OnLeftUp) EVT_RIGHT_UP(self, self.OnRightUp) EVT_MOTION(self, self.OnMotion) + EVT_PAINT(self, self.OnPaint) def OnPaint(self, event): @@ -98,6 +99,8 @@ class DoodlePad(wxWindow): result = dropSource.DoDragDrop() self.log.WriteText("DragDrop completed: %d\n" % result) + + #---------------------------------------------------------------------- @@ -106,31 +109,39 @@ class DoodleDropTarget(wxPyDropTarget): wxPyDropTarget.__init__(self) self.log = log self.dv = window + + # specify the type of data we will accept self.data = wxCustomDataObject(wxCustomDataFormat("DoodleLines")) self.SetDataObject(self.data) + + # some virtual methods that track the progress of the drag def OnEnter(self, x, y, d): self.log.WriteText("OnEnter: %d, %d, %d\n" % (x, y, d)) return wxDragCopy - def OnLeave(self): self.log.WriteText("OnLeave\n") - def OnDrop(self, x, y): self.log.WriteText("OnDrop: %d %d\n" % (x, y)) return true + #def OnDragOver(self, x, y, d): + # self.log.WriteText("OnDragOver: %d, %d, %d\n" % (x, y, d)) + # return wxDragCopy + + # Called when OnDrop returns true. We need to get the data and + # do something with it. def OnData(self, x, y, d): self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d)) + + # copy the data from the drag source to out data object if self.GetData(): + # convert it back to a list of lines and give it to the viewer linesdata = self.data.GetData() lines = cPickle.loads(linesdata) self.dv.SetLines(lines) return d - #def OnDragOver(self, x, y, d): - # self.log.WriteText("OnDragOver: %d, %d, %d\n" % (x, y, d)) - # return wxDragCopy @@ -143,6 +154,7 @@ class DoodleViewer(wxWindow): self.x = self.y = 0 dt = DoodleDropTarget(self, log) self.SetDropTarget(dt) + EVT_PAINT(self, self.OnPaint) def SetLines(self, lines): self.lines = lines diff --git a/utils/wxPython/demo/DialogUnits.py b/wxPython/demo/DialogUnits.py similarity index 98% rename from utils/wxPython/demo/DialogUnits.py rename to wxPython/demo/DialogUnits.py index aba492715f..7f369dd40f 100644 --- a/utils/wxPython/demo/DialogUnits.py +++ b/wxPython/demo/DialogUnits.py @@ -29,6 +29,7 @@ class MyFrame(wxFrame): # Associate some events with methods of this class EVT_SIZE(self, self.OnSize) EVT_MOVE(self, self.OnMove) + EVT_CLOSE(self, self.OnCloseWindow) # Add a panel and some controls to display the size and position panel = wxPanel(self, -1) diff --git a/utils/wxPython/demo/DragAndDrop.py b/wxPython/demo/DragAndDrop.py similarity index 100% rename from utils/wxPython/demo/DragAndDrop.py rename to wxPython/demo/DragAndDrop.py diff --git a/wxPython/demo/FileBrowseButton.py b/wxPython/demo/FileBrowseButton.py new file mode 100644 index 0000000000..c926dfa13a --- /dev/null +++ b/wxPython/demo/FileBrowseButton.py @@ -0,0 +1,47 @@ + +from wxPython.wx import * +from wxPython.lib.filebrowsebutton import FileBrowseButton, FileBrowseButtonWithHistory + + +#---------------------------------------------------------------------- + +class TestPanel(wxPanel): + def __init__(self, parent, ID, log): + wxPanel.__init__(self, parent, ID) + self.log = log + self.fbb = FileBrowseButton(self, -1, wxPoint(20,20), wxSize(450, -1), + changeCallback = self.fbbCallback) + self.fbbh = FileBrowseButtonWithHistory(self, -1, wxPoint(20, 50), + wxSize(450, -1), + #changeCallback = self.fbbhCallback + ) + + self.fbbh.SetHistory(['You', 'can', 'put', 'some', 'file', 'names', 'here']) + + + def fbbCallback(self, evt): + self.log.write('FileBrowseButton: %s\n' % evt.GetString()) + + + def fbbhCallback(self, evt): + if hasattr(self, 'fbbh'): + value = evt.GetString() + self.log.write('FileBrowseButtonWithHistory: %s\n' % value) + history = self.fbbh.GetHistory() + history.append(value) + self.fbbh.SetHistory(history) + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = TestPanel(nb, -1, log) + return win + + + +#---------------------------------------------------------------------- + + + +overview = FileBrowseButton.__doc__ diff --git a/utils/wxPython/demo/FontEnumerator.py b/wxPython/demo/FontEnumerator.py similarity index 100% rename from utils/wxPython/demo/FontEnumerator.py rename to wxPython/demo/FontEnumerator.py diff --git a/utils/wxPython/demo/GenericButtons.py b/wxPython/demo/GenericButtons.py similarity index 100% rename from utils/wxPython/demo/GenericButtons.py rename to wxPython/demo/GenericButtons.py diff --git a/wxPython/demo/GridCustTable.py b/wxPython/demo/GridCustTable.py new file mode 100644 index 0000000000..58fb015cd3 --- /dev/null +++ b/wxPython/demo/GridCustTable.py @@ -0,0 +1,153 @@ +from wxPython.wx import * +from wxPython.grid import * + +import string + +#--------------------------------------------------------------------------- + +class CustomDataTable(wxPyGridTableBase): + """ + """ + + def __init__(self, log): + wxPyGridTableBase.__init__(self) + self.log = log + + self.colLabels = ['ID', 'Description', 'Severity', 'Priority', 'Platform', + 'Opened?', 'Fixed?', 'Tested?'] + + self.dataTypes = [wxGRID_VALUE_NUMBER, + wxGRID_VALUE_STRING, + wxGRID_VALUE_CHOICE + ':only in a million years!,wish list,minor,normal,major,critical', + wxGRID_VALUE_NUMBER + ':1,5', + wxGRID_VALUE_CHOICE + ':all,MSW,GTK,other', + wxGRID_VALUE_BOOL, + wxGRID_VALUE_BOOL, + wxGRID_VALUE_BOOL] + + self.data = [ + [1010, "The foo doesn't bar", "major", 1, 'MSW', 1, 1, 1], + [1011, "I've got a wicket in my wocket", "wish list", 2, 'other', 0, 0, 0], + [1012, "Rectangle() returns a triangle", "critical", 5, 'all', 0, 0, 0] + + ] + + + #-------------------------------------------------- + # required methods for the wxPyGridTableBase interface + + def GetNumberRows(self): + return len(self.data) + 1 + + def GetNumberCols(self): + return len(self.data[0]) + + def IsEmptyCell(self, row, col): + return not self.data[row][col] + + # Get/Set values in the table. The Python version of these + # methods can handle any data-type, (as long as the Editor and + # Renderer understands the type too,) not just strings as in the + # C++ version. + def GetValue(self, row, col): + try: + return self.data[row][col] + except IndexError: + return '' + + def SetValue(self, row, col, value): + try: + self.data[row][col] = value + except IndexError: + # add a new row + self.data.append([''] * self.GetNumberCols()) + self.SetValue(row, col, value) + + # tell the grid we've added a row + msg = wxGridTableMessage(self, # The table + wxGRIDTABLE_NOTIFY_ROWS_APPENDED, # what we did to it + 1) # how many + + self.GetView().ProcessTableMessage(msg) + + + #-------------------------------------------------- + # Some optional methods + + # Called when the grid needs to display labels + def GetColLabelValue(self, col): + return self.colLabels[col] + + # Called to determine the kind of editor/renderer to use by + # default, doesn't necessarily have to be the same type used + # nativly by the editor/renderer if they know how to convert. + def GetTypeName(self, row, col): + return self.dataTypes[col] + + # Called to determine how the data can be fetched and stored by the + # editor and renderer. This allows you to enforce some type-safety + # in the grid. + def CanGetValueAs(self, row, col, typeName): + colType = string.split(self.dataTypes[col], ':')[0] + if typeName == colType: + return true + else: + return false + + def CanSetValueAs(self, row, col, typeName): + return self.CanGetValueAs(row, col, typeName) + + + + + +#--------------------------------------------------------------------------- + + + +class CustTableGrid(wxGrid): + def __init__(self, parent, log): + wxGrid.__init__(self, parent, -1) + + table = CustomDataTable(log) + + # The second parameter means that the grid is to take ownership of the + # table and will destroy it when done. Otherwise you would need to keep + # a reference to it and call it's Destroy method later. + self.SetTable(table, true) + + self.SetRowLabelSize(0) + self.SetMargins(0,0) + self.AutoSizeColumns(false) + + EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick) + + + + # I do this because I don't like the default behaviour of not starting the + # cell editor on double clicks, but only a second click. + def OnLeftDClick(self, evt): + if self.CanEnableCellControl(): + self.EnableCellEditControl() + + +#--------------------------------------------------------------------------- + +class TestFrame(wxFrame): + def __init__(self, parent, log): + wxFrame.__init__(self, parent, -1, "Custom Table, data driven Grid Demo", size=(640,480)) + grid = CustTableGrid(self, log) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + import sys + app = wxPySimpleApp() + frame = TestFrame(None, sys.stdout) + frame.Show(true) + app.MainLoop() + + +#--------------------------------------------------------------------------- diff --git a/wxPython/demo/GridEnterHandler.py b/wxPython/demo/GridEnterHandler.py new file mode 100644 index 0000000000..719c622ef0 --- /dev/null +++ b/wxPython/demo/GridEnterHandler.py @@ -0,0 +1,62 @@ +from wxPython.wx import * +from wxPython.grid import * + +#--------------------------------------------------------------------------- + +class NewEnterHandlingGrid(wxGrid): + def __init__(self, parent, log): + wxGrid.__init__(self, parent, -1) + self.log = log + + self.CreateGrid(20, 6) + + self.SetCellValue(0, 0, "Enter moves to the right") + self.SetCellValue(0, 5, "Enter wraps to next row") + self.SetColSize(0, 150) + self.SetColSize(5, 150) + + EVT_KEY_DOWN(self, self.OnKeyDown) + + + def OnKeyDown(self, evt): + if evt.KeyCode() != WXK_RETURN: + evt.Skip() + return + + if evt.ControlDown(): # the edit control needs this key + evt.Skip() + return + + self.DisableCellEditControl() + success = self.MoveCursorRight(evt.ShiftDown()) + if not success: + newRow = self.GetGridCursorRow() + 1 + if newRow < self.GetTable().GetNumberRows(): + self.SetGridCursor(newRow, 0) + self.MakeCellVisible(newRow, 0) + else: + # this would be a good place to add a new row if your app + # needs to do that + pass + + +#--------------------------------------------------------------------------- + +class TestFrame(wxFrame): + def __init__(self, parent, log): + wxFrame.__init__(self, parent, -1, "Simple Grid Demo", size=(640,480)) + grid = NewEnterHandlingGrid(self, log) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + import sys + app = wxPySimpleApp() + frame = TestFrame(None, sys.stdout) + frame.Show(true) + app.MainLoop() + + +#--------------------------------------------------------------------------- diff --git a/wxPython/demo/GridHugeTable.py b/wxPython/demo/GridHugeTable.py new file mode 100644 index 0000000000..69e3aed48b --- /dev/null +++ b/wxPython/demo/GridHugeTable.py @@ -0,0 +1,71 @@ +from wxPython.wx import * +from wxPython.grid import * + +#--------------------------------------------------------------------------- + +class HugeTable(wxPyGridTableBase): + + """ + This is all it takes to make a custom data table to plug into a + wxGrid. There are many more methods that can be overridden, but + the ones shown below are the required ones. This table simply + provides strings containing the row and column values. + """ + + def __init__(self, log): + wxPyGridTableBase.__init__(self) + self.log = log + + def GetNumberRows(self): + return 10000 + + def GetNumberCols(self): + return 10000 + + def IsEmptyCell(self, row, col): + return false + + def GetValue(self, row, col): + return str( (row, col) ) + + def SetValue(self, row, col, value): + self.log.write('SetValue(%d, %d, "%s") ignored.\n' % (row, col, value)) + + +#--------------------------------------------------------------------------- + + + +class HugeTableGrid(wxGrid): + def __init__(self, parent, log): + wxGrid.__init__(self, parent, -1) + + table = HugeTable(log) + + # The second parameter means that the grid is to take ownership of the + # table and will destroy it when done. Otherwise you would need to keep + # a reference to it and call it's Destroy method later. + self.SetTable(table, true) + + + +#--------------------------------------------------------------------------- + +class TestFrame(wxFrame): + def __init__(self, parent, log): + wxFrame.__init__(self, parent, -1, "Huge (virtual) Table Demo", size=(640,480)) + grid = HugeTableGrid(self, log) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + import sys + app = wxPySimpleApp() + frame = TestFrame(None, sys.stdout) + frame.Show(true) + app.MainLoop() + + +#--------------------------------------------------------------------------- diff --git a/wxPython/demo/GridSimple.py b/wxPython/demo/GridSimple.py new file mode 100644 index 0000000000..5f23c26dc8 --- /dev/null +++ b/wxPython/demo/GridSimple.py @@ -0,0 +1,153 @@ +from wxPython.wx import * +from wxPython.grid import * + +#--------------------------------------------------------------------------- + +class SimpleGrid(wxGrid): + def __init__(self, parent, log): + wxGrid.__init__(self, parent, -1) + self.log = log + + self.CreateGrid(25, 25) + + # simple cell formatting + self.SetColSize(3, 200) + self.SetRowSize(4, 45) + self.SetCellValue(0, 0, "First cell") + self.SetCellValue(1, 1, "Another cell") + self.SetCellValue(2, 2, "Yet another cell") + self.SetCellFont(0, 0, wxFont(12, wxROMAN, wxITALIC, wxNORMAL)) + self.SetCellTextColour(1, 1, wxRED) + self.SetCellBackgroundColour(2, 2, wxCYAN) + + # attribute objects let you keep a set of formatting values + # in one spot, and reuse them if needed + attr = wxGridCellAttr() + attr.SetTextColour(wxBLACK) + attr.SetBackgroundColour(wxRED) + attr.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD)) + + # you can set cell attributes for the whole row (or column) + self.SetRowAttr(5, attr) + + + # test all the events + EVT_GRID_CELL_LEFT_CLICK(self, self.OnCellLeftClick) + EVT_GRID_CELL_RIGHT_CLICK(self, self.OnCellRightClick) + EVT_GRID_CELL_LEFT_DCLICK(self, self.OnCellLeftDClick) + EVT_GRID_CELL_RIGHT_DCLICK(self, self.OnCellRightDClick) + + EVT_GRID_LABEL_LEFT_CLICK(self, self.OnLabelLeftClick) + EVT_GRID_LABEL_RIGHT_CLICK(self, self.OnLabelRightClick) + EVT_GRID_LABEL_LEFT_DCLICK(self, self.OnLabelLeftDClick) + EVT_GRID_LABEL_RIGHT_DCLICK(self, self.OnLabelRightDClick) + + EVT_GRID_ROW_SIZE(self, self.OnRowSize) + EVT_GRID_COL_SIZE(self, self.OnColSize) + + EVT_GRID_RANGE_SELECT(self, self.OnRangeSelect) + EVT_GRID_CELL_CHANGE(self, self.OnCellChange) + EVT_GRID_SELECT_CELL(self, self.OnSelectCell) + + EVT_GRID_EDITOR_SHOWN(self, self.OnEditorShown) + EVT_GRID_EDITOR_HIDDEN(self, self.OnEditorHidden) + + + def OnCellLeftClick(self, evt): + self.log.write("OnCellLeftClick: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + def OnCellRightClick(self, evt): + self.log.write("OnCellRightClick: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + def OnCellLeftDClick(self, evt): + self.log.write("OnCellLeftDClick: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + def OnCellRightDClick(self, evt): + self.log.write("OnCellRightDClick: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + def OnLabelLeftClick(self, evt): + self.log.write("OnLabelLeftClick: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + def OnLabelRightClick(self, evt): + self.log.write("OnLabelRightClick: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + def OnLabelLeftDClick(self, evt): + self.log.write("OnLabelLeftDClick: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + def OnLabelRightDClick(self, evt): + self.log.write("OnLabelRightDClick: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + + def OnRowSize(self, evt): + self.log.write("OnRowSize: row %d, %s\n" % + (evt.GetRowOrCol(), evt.GetPosition())) + evt.Skip() + + def OnColSize(self, evt): + self.log.write("OnColSize: col %d, %s\n" % + (evt.GetRowOrCol(), evt.GetPosition())) + evt.Skip() + + def OnRangeSelect(self, evt): + if evt.Selecting(): + self.log.write("OnRangeSelect: top-left %s, bottom-right %s\n" % + (evt.GetTopLeftCoords(), evt.GetBottomRightCoords())) + evt.Skip() + + def OnCellChange(self, evt): + self.log.write("OnCellChange: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + def OnSelectCell(self, evt): + self.log.write("OnSelectCell: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + def OnEditorShown(self, evt): + self.log.write("OnEditorShown: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + def OnEditorHidden(self, evt): + self.log.write("OnEditorHidden: (%d,%d) %s\n" % + (evt.GetRow(), evt.GetCol(), evt.GetPosition())) + evt.Skip() + + +#--------------------------------------------------------------------------- + +class TestFrame(wxFrame): + def __init__(self, parent, log): + wxFrame.__init__(self, parent, -1, "Simple Grid Demo", size=(640,480)) + grid = SimpleGrid(self, log) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + import sys + app = wxPySimpleApp() + frame = TestFrame(None, sys.stdout) + frame.Show(true) + app.MainLoop() + + +#--------------------------------------------------------------------------- diff --git a/wxPython/demo/GridStdEdRend.py b/wxPython/demo/GridStdEdRend.py new file mode 100644 index 0000000000..5835a8227e --- /dev/null +++ b/wxPython/demo/GridStdEdRend.py @@ -0,0 +1,181 @@ +from wxPython.wx import * +from wxPython.grid import * + +import string, random + +#--------------------------------------------------------------------------- + +class MyCustomRenderer(wxPyGridCellRenderer): + def __init__(self): + wxPyGridCellRenderer.__init__(self) + + def Draw(self, grid, attr, dc, rect, row, col, isSelected): + dc.SetBackgroundMode(wxSOLID) + dc.SetBrush(wxBrush(wxBLACK, wxSOLID)) + dc.SetPen(wxTRANSPARENT_PEN) + dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height) + + dc.SetBackgroundMode(wxTRANSPARENT) + dc.SetFont(attr.GetFont()) + + text = grid.GetCellValue(row, col) + colors = [wxRED, wxWHITE, wxCYAN] + x = rect.x + 1 + y = rect.y + 1 + for ch in text: + dc.SetTextForeground(random.choice(colors)) + dc.DrawText(ch, x, y) + w, h = dc.GetTextExtent(ch) + x = x + w + if x > rect.right - 5: + break + + + def GetBestSize(self, grid, attr, dc, row, col): + text = grid.GetCellValue(row, col) + dc.SetFont(attr.GetFont()) + w, h = dc.GetTextExtent(text) + return wxSize(w, h) + + + def Clone(self): + return MyCustomRenderer() + + +#--------------------------------------------------------------------------- + +rendererDemoData = [ + ('wxGridCellStringRenderer\n(the default)', 'this is a text value', wxGridCellStringRenderer, ()), + ('wxGridCellNumberRenderer', '12345', wxGridCellNumberRenderer, ()), + ('wxGridCellFloatRenderer', '1234.5678', wxGridCellFloatRenderer, (6,2)), + ('wxGridCellBoolRenderer', '1', wxGridCellBoolRenderer, ()), + ('MyCustomRenderer', 'This is my renderer', MyCustomRenderer, ()), + ] + +editorDemoData = [ + ('wxGridCellTextEditor\n(the default)', 'Here is some more text', wxGridCellTextEditor, ()), + ('wxGridCellNumberEditor\nwith min,max', '101', wxGridCellNumberEditor, (5, 10005)), + ('wxGridCellNumberEditor\nwithout bounds', '101', wxGridCellNumberEditor, ()), + ('wxGridCellFloatEditor', '1234.5678', wxGridCellFloatEditor, ()), + ('wxGridCellBoolEditor', '1', wxGridCellBoolEditor, ()), + ('wxGridCellChoiceEditor', 'one', wxGridCellChoiceEditor, (['one', 'two', 'three', 'four', + 'kick', 'Microsoft', 'out the', + 'door'], false)), + ] + + +comboDemoData = [ + ('wxGridCellNumberRenderer\nwxGridCellNumberEditor', '20792', wxGridCellNumberRenderer, wxGridCellNumberEditor), + ('wxGridCellBoolRenderer\nwxGridCellBoolEditor', '1', wxGridCellBoolRenderer, wxGridCellBoolEditor), + ] + + +class EditorsAndRenderersGrid(wxGrid): + def __init__(self, parent, log): + wxGrid.__init__(self, parent, -1) + self.log = log + + self.CreateGrid(25, 8) + renCol = 1 + edCol = 4 + + + self.SetCellValue(0, renCol, '''\ +Cell Renderers are used to draw +the contents of the cell when they +need to be refreshed. Different +types of Renderers can be plugged in +to different cells in the grid, it can +even be automatically determined based +on the type of data in the cell. +''') + + self.SetCellValue(0, edCol, '''\ +Cell Editors are used when the +value of the cell is edited by +the user. An editor class is +wrapped around a an object +derived from wxControl and it +implements some methods required +to integrate with the grid. +''') + + self.SetCellValue(16, renCol, '''\ +Here are some combinations of Editors and +Renderers used together. +''') + + row = 2 + for label, value, renderClass, args in rendererDemoData: + renderer = apply(renderClass, args) + self.SetCellValue(row, renCol, label) + self.SetCellValue(row, renCol+1, value) + self.SetCellRenderer(row, renCol+1, renderer) + row = row + 2 + + + row = 2 + for label, value, editorClass, args in editorDemoData: + editor = apply(editorClass, args) + self.SetCellValue(row, edCol, label) + self.SetCellValue(row, edCol+1, value) + self.SetCellEditor(row, edCol+1, editor) + row = row + 2 + + + row = 18 + for label, value, renClass, edClass in comboDemoData: + self.SetCellValue(row, renCol, label) + self.SetCellValue(row, renCol+1, value) + editor = apply(edClass, ()) #args) + renderer = apply(renClass, ()) #args) + self.SetCellEditor(row, renCol+1, editor) + self.SetCellRenderer(row, renCol+1, renderer) + row = row + 2 + + + font = self.GetFont() + font.SetWeight(wxBOLD) + attr = wxGridCellAttr() + attr.SetFont(font) + attr.SetBackgroundColour(wxLIGHT_GREY) + attr.SetReadOnly(true) + attr.SetAlignment(wxRIGHT, -1) + self.SetColAttr(renCol, attr) + self.SetColAttr(edCol, attr) + + # There is a bug in wxGTK for this method... + if wxPlatform != '__WXGTK__': + self.AutoSizeColumns(true) + self.AutoSizeRows(true) + + EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick) + + + # I do this because I don't like the default behaviour of not starting the + # cell editor on double clicks, but only a second click. + def OnLeftDClick(self, evt): + if self.CanEnableCellControl(): + self.EnableCellEditControl() + + +#--------------------------------------------------------------------------- + +class TestFrame(wxFrame): + def __init__(self, parent, log): + wxFrame.__init__(self, parent, -1, "Editors and Renderers Demo", size=(640,480)) + grid = EditorsAndRenderersGrid(self, log) + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + import sys + app = wxPySimpleApp() + frame = TestFrame(None, sys.stdout) + frame.Show(true) + app.MainLoop() + + +#--------------------------------------------------------------------------- diff --git a/utils/wxPython/demo/Layoutf.py b/wxPython/demo/Layoutf.py similarity index 100% rename from utils/wxPython/demo/Layoutf.py rename to wxPython/demo/Layoutf.py diff --git a/utils/wxPython/demo/MDIDemo.py b/wxPython/demo/MDIDemo.py similarity index 94% rename from utils/wxPython/demo/MDIDemo.py rename to wxPython/demo/MDIDemo.py index 007102cbc8..0e3b0ecad5 100644 --- a/utils/wxPython/demo/MDIDemo.py +++ b/wxPython/demo/MDIDemo.py @@ -32,8 +32,7 @@ class MyParentFrame(wxMDIParentFrame): def OnNewWindow(self, evt): self.winCount = self.winCount + 1 win = wxMDIChildFrame(self, -1, "Child Window: %d" % self.winCount) - cs = win.GetClientSize() - canvas = MyCanvas(win, size=cs) + canvas = MyCanvas(win) win.Show(true) diff --git a/utils/wxPython/demo/Main.py b/wxPython/demo/Main.py similarity index 52% rename from utils/wxPython/demo/Main.py rename to wxPython/demo/Main.py index b94fd77952..10ed61edd0 100644 --- a/utils/wxPython/demo/Main.py +++ b/wxPython/demo/Main.py @@ -3,9 +3,9 @@ # Name: Main.py # Purpose: Testing lots of stuff, controls, window types, etc. # -# Author: Robin Dunn & Gary Dumer +# Author: Robin Dunn # -# Created: +# Created: A long time ago, in a galaxy far, far away... # RCS-ID: $Id$ # Copyright: (c) 1999 by Total Control Software # Licence: wxWindows license @@ -14,21 +14,22 @@ import sys, os from wxPython.wx import * from wxPython.lib.splashscreen import SplashScreen +from wxPython.html import wxHtmlWindow #--------------------------------------------------------------------------- -_useSplitter = true -_useNestedSplitter = true _treeList = [ - ('New since last release', []), + ('New since last release', ['PyShellWindow', + ]), ('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']), ('Non-Managed Windows', ['wxGrid', 'wxSashWindow', - 'wxScrolledWindow', 'wxSplitterWindow', - 'wxStatusBar', 'wxNotebook', - 'wxHtmlWindow']), + 'wxScrolledWindow', 'wxSplitterWindow', + 'wxStatusBar', 'wxNotebook', + 'wxHtmlWindow', + 'wxStyledTextCtrl_1', 'wxStyledTextCtrl_2',]), ('Common Dialogs', ['wxColourDialog', 'wxDirDialog', 'wxFileDialog', 'wxSingleChoiceDialog', 'wxTextEntryDialog', @@ -37,8 +38,9 @@ _treeList = [ ('Controls', ['wxButton', 'wxCheckBox', 'wxCheckListBox', 'wxChoice', 'wxComboBox', 'wxGauge', 'wxListBox', 'wxListCtrl', 'wxTextCtrl', - 'wxTreeCtrl', 'wxSpinButton', 'wxStaticText', 'wxStaticBitmap', - 'wxRadioBox', 'wxSlider', 'wxToolBar', #'wxToggleButton' + 'wxTreeCtrl', 'wxSpinButton', 'wxSpinCtrl', 'wxStaticText', + 'wxStaticBitmap', 'wxRadioBox', 'wxSlider', 'wxToolBar', + 'wxCalendarCtrl', ]), ('Window Layout', ['wxLayoutConstraints', 'Sizers', 'OldSizers']), @@ -46,7 +48,10 @@ _treeList = [ ('Miscellaneous', [ 'DragAndDrop', 'CustomDragAndDrop', 'FontEnumerator', 'wxTimer', 'wxValidator', 'wxGLCanvas', 'DialogUnits', 'wxImage', 'wxMask', 'PrintFramework', 'wxOGL', - 'PythonEvents', 'Threads']), + 'PythonEvents', 'Threads', + 'ActiveXWrapper_Acrobat', 'ActiveXWrapper_IE', + 'wxDragImage', 'PyShellWindow', + ]), ('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog', 'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar', @@ -61,7 +66,8 @@ _treeList = [ class wxPythonDemo(wxFrame): def __init__(self, parent, id, title): - wxFrame.__init__(self, parent, -1, title, size = (725, 550)) + wxFrame.__init__(self, parent, -1, title, size = (800, 600), + style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) self.cwd = os.getcwd() @@ -71,26 +77,13 @@ class wxPythonDemo(wxFrame): self.otherWin = None EVT_IDLE(self, self.OnIdle) + EVT_CLOSE(self, self.OnCloseWindow) self.Centre(wxBOTH) self.CreateStatusBar(1, wxST_SIZEGRIP) - if _useSplitter: - splitter = wxSplitterWindow(self, -1) - if _useNestedSplitter: - splitter2 = wxSplitterWindow(splitter, -1) - logParent = nbParent = splitter2 - else: - nbParent = splitter - logParent = wxFrame(self, -1, "wxPython Demo: log window", - (0,0), (500, 150)) - logParent.Show(true) - else: - nbParent = self - logParent = wxFrame(self, -1, "wxPython Demo: log window", - (0,0), (500, 150)) - logParent.Show(true) - + splitter = wxSplitterWindow(self, -1, style=wxNO_3D|wxSP_3D) + splitter2 = wxSplitterWindow(splitter, -1, style=wxNO_3D|wxSP_3D) # Prevent TreeCtrl from displaying all items after destruction @@ -131,31 +124,35 @@ class wxPythonDemo(wxFrame): # Create a TreeCtrl - if _useSplitter: - tID = wxNewId() - self.treeMap = {} - self.tree = wxTreeCtrl(splitter, tID) - #self.tree.SetBackgroundColour(wxNamedColour("Pink")) - root = self.tree.AddRoot("Overview") - firstChild = None - for item in _treeList: - child = self.tree.AppendItem(root, item[0]) - if not firstChild: firstChild = child - for childItem in item[1]: - theDemo = self.tree.AppendItem(child, childItem) - self.treeMap[childItem] = theDemo - - self.tree.Expand(root) - self.tree.Expand(firstChild) - EVT_TREE_ITEM_EXPANDED (self.tree, tID, self.OnItemExpanded) - EVT_TREE_ITEM_COLLAPSED (self.tree, tID, self.OnItemCollapsed) - EVT_TREE_SEL_CHANGED (self.tree, tID, self.OnSelChanged) + tID = wxNewId() + self.treeMap = {} + self.tree = wxTreeCtrl(splitter, tID, + style=wxTR_HAS_BUTTONS | + wxTR_EDIT_LABELS | + wxTR_HAS_VARIABLE_ROW_HEIGHT | + wxSUNKEN_BORDER) + #self.tree.SetBackgroundColour(wxNamedColour("Pink")) + root = self.tree.AddRoot("Overview") + firstChild = None + for item in _treeList: + child = self.tree.AppendItem(root, item[0]) + if not firstChild: firstChild = child + for childItem in item[1]: + theDemo = self.tree.AppendItem(child, childItem) + self.treeMap[childItem] = theDemo + + self.tree.Expand(root) + self.tree.Expand(firstChild) + EVT_TREE_ITEM_EXPANDED (self.tree, tID, self.OnItemExpanded) + EVT_TREE_ITEM_COLLAPSED (self.tree, tID, self.OnItemCollapsed) + EVT_TREE_SEL_CHANGED (self.tree, tID, self.OnSelChanged) + EVT_LEFT_DOWN (self.tree, self.OnTreeLeftDown) # Create a Notebook - self.nb = wxNotebook(nbParent, -1) + self.nb = wxNotebook(splitter2, -1) # Set up a TextCtrl on the Overview Notebook page - self.ovr = wxTextCtrl(self.nb, -1, style = wxTE_MULTILINE|wxTE_READONLY) + self.ovr = wxHtmlWindow(self.nb, -1) self.nb.AddPage(self.ovr, "Overview") @@ -167,59 +164,48 @@ class wxPythonDemo(wxFrame): # Set up a log on the View Log Notebook page - self.log = wxTextCtrl(logParent, -1, + self.log = wxTextCtrl(splitter2, -1, style = wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL) - (w, self.charHeight) = self.log.GetTextExtent('X') - self.WriteText('wxPython Demo Log:\n') + # Set the wxWindows log target to be this textctrl + wxLog_SetActiveTarget(wxLogTextCtrl(self.log)) - self.Show(true) - # add the windows to the splitter and split it. - if _useSplitter: - if _useNestedSplitter: - splitter2.SplitHorizontally(self.nb, self.log) - splitter2.SetSashPosition(360, true) - splitter2.SetMinimumPaneSize(20) - splitter.SplitVertically(self.tree, splitter2) - else: - splitter.SplitVertically(self.tree, self.nb) + self.Show(true) - splitter.SetSashPosition(180, true) - splitter.SetMinimumPaneSize(20) + # add the windows to the splitter and split it. + splitter2.SplitHorizontally(self.nb, self.log) + splitter2.SetSashPosition(450, true) + splitter2.SetMinimumPaneSize(20) + splitter.SplitVertically(self.tree, splitter2) + splitter.SetSashPosition(180, true) + splitter.SetMinimumPaneSize(20) - # make our log window be stdout - #sys.stdout = self # select initial items self.nb.SetSelection(0) - if _useSplitter: - self.tree.SelectItem(root) + self.tree.SelectItem(root) if len(sys.argv) == 2: try: selectedDemo = self.treeMap[sys.argv[1]] except: selectedDemo = None - if selectedDemo and _useSplitter: + if selectedDemo: self.tree.SelectItem(selectedDemo) self.tree.EnsureVisible(selectedDemo) - self.WriteText('window handle: %s\n' % self.GetHandle()) + wxLogMessage('window handle: %s' % self.GetHandle()) #--------------------------------------------- def WriteText(self, text): - self.log.WriteText(text) - w, h = self.log.GetClientSizeTuple() - numLines = h/self.charHeight - x, y = self.log.PositionToXY(self.log.GetLastPosition()) - if y > numLines: - self.log.ShowPosition(self.log.XYToPosition(x, y-numLines)) - ##self.log.ShowPosition(self.log.GetLastPosition()) - self.log.SetInsertionPointEnd() + if text[-1:] == '\n': + text = text[:-1] + wxLogMessage(text) + def write(self, txt): self.WriteText(txt) @@ -227,12 +213,22 @@ class wxPythonDemo(wxFrame): #--------------------------------------------- def OnItemExpanded(self, event): item = event.GetItem() - self.log.WriteText("OnItemExpanded: %s\n" % self.tree.GetItemText(item)) + wxLogMessage("OnItemExpanded: %s" % self.tree.GetItemText(item)) #--------------------------------------------- def OnItemCollapsed(self, event): item = event.GetItem() - self.log.WriteText("OnItemCollapsed: %s\n" % self.tree.GetItemText(item)) + wxLogMessage("OnItemCollapsed: %s" % self.tree.GetItemText(item)) + + + #--------------------------------------------- + def OnTreeLeftDown(self, event): + pt = event.GetPosition(); + item, flags = self.tree.HitTest(pt) + if item == self.tree.GetSelection(): + self.SetOverview(self.tree.GetItemText(item), self.curOverview) + else: + event.Skip() #--------------------------------------------- def OnSelChanged(self, event): @@ -261,23 +257,26 @@ class wxPythonDemo(wxFrame): else: if os.path.exists(itemText + '.py'): wxBeginBusyCursor() - self.GetDemoFile(itemText + '.py') - module = __import__(itemText, globals()) - self.SetOverview(itemText, module.overview) - wxEndBusyCursor() + wxLogMessage("Running demo %s.py..." % itemText) + try: + self.GetDemoFile(itemText + '.py') + module = __import__(itemText, globals()) + self.SetOverview(itemText, module.overview) + finally: + wxEndBusyCursor() # in case runTest is modal, make sure things look right... self.nb.Refresh(); wxYield() - self.window = module.runTest(self, self.nb, self) + self.window = module.runTest(self, self.nb, self) ### if self.window: self.nb.AddPage(self.window, 'Demo') wxYield() self.nb.SetSelection(2) else: - self.ovr.Clear() + self.ovr.SetPage("") self.txt.Clear() self.window = None @@ -287,24 +286,23 @@ class wxPythonDemo(wxFrame): # Get the Demo files def GetDemoFile(self, filename): self.txt.Clear() - #if not self.txt.LoadFile(filename): - # self.txt.WriteText("Cannot open %s file." % filename) try: self.txt.SetValue(open(filename).read()) except IOError: self.txt.WriteText("Cannot open %s file." % filename) - self.txt.SetInsertionPoint(0) self.txt.ShowPosition(0) #--------------------------------------------- def SetOverview(self, name, text): - self.ovr.Clear() - self.ovr.WriteText(text) + self.curOverview = text + lead = text[:6] + if lead != '<html>' and lead != '<HTML>': + text = string.join(string.split(text, '\n'), '<br>') + #text = '<font size="-1"><pre>' + text + '</pre></font>' + self.ovr.SetPage(text) self.nb.SetPageText(0, name) - self.ovr.SetInsertionPoint(0) - self.ovr.ShowPosition(0) #--------------------------------------------- # Menu methods @@ -313,13 +311,6 @@ class wxPythonDemo(wxFrame): def OnHelpAbout(self, event): - #about = wxMessageDialog(self, - # "wxPython is a Python extension module that\n" - # "encapsulates the wxWindows GUI classes.\n\n" - # "This demo shows off some of the capabilities\n" - # "of wxPython.\n\n" - # " Developed by Robin Dunn", - # "About wxPython", wxOK) from About import MyAboutBox about = MyAboutBox(self) about.ShowModal() @@ -342,25 +333,20 @@ class wxPythonDemo(wxFrame): #--------------------------------------------- def OnDemoMenu(self, event): - if _useSplitter: - try: - selectedDemo = self.treeMap[self.mainmenu.GetLabel(event.GetId())] - except: - selectedDemo = None - if selectedDemo: - self.tree.SelectItem(selectedDemo) - self.tree.EnsureVisible(selectedDemo) - else: - self.RunDemo(self.mainmenu.GetLabel(event.GetId())) + try: + selectedDemo = self.treeMap[self.mainmenu.GetLabel(event.GetId())] + except: + selectedDemo = None + if selectedDemo: + self.tree.SelectItem(selectedDemo) + self.tree.EnsureVisible(selectedDemo) #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- class MyApp(wxApp): def OnInit(self): - wxImage_AddHandler(wxJPEGHandler()) - wxImage_AddHandler(wxPNGHandler()) - wxImage_AddHandler(wxGIFHandler()) + wxInitAllImageHandlers() self.splash = SplashScreen(None, bitmapfile='bitmaps/splash.gif', duration=4000, callback=self.AfterSplash) @@ -368,12 +354,28 @@ class MyApp(wxApp): wxYield() return true + def AfterSplash(self): self.splash.Close(true) frame = wxPythonDemo(None, -1, "wxPython: (A Demonstration)") frame.Show(true) self.SetTopWindow(frame) - return true + self.ShowTip(frame) + + + def ShowTip(self, frame): + try: + showTipText = open("data/showTips").read() + showTip, index = eval(showTipText) + except IOError: + showTip, index = (1, 0) + print showTip, index + if showTip: + tp = wxCreateFileTipProvider("data/tips.txt", index) + showTip = wxShowTip(frame, tp) + index = tp.GetCurrentTip() + open("data/showTips", "w").write(str( (showTip, index) )) + #--------------------------------------------------------------------------- @@ -391,37 +393,77 @@ def main(): -overview = """\ -Python ------------- - -Python is an interpreted, interactive, object-oriented programming language often compared to Tcl, Perl, Scheme, or Java. - -Python combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. There are interfaces to many system calls and libraries, and new built-in modules are easily written in C or C++. Python is also usable as an extension language for applications that need a programmable interface. - -wxWindows --------------------- - -wxWindows is a free C++ framework designed to make cross-platform programming child's play. Well, almost. wxWindows 2 supports Windows 3.1/95/98/NT, Unix with GTK/Motif/Lesstif, with a Mac version underway. Other ports are under consideration. - -wxWindows is a set of libraries that allows C++ applications to compile and run on several different types of computers, with minimal source code changes. There is one library per supported GUI (such as Motif, or Windows). As well as providing a common API (Application Programming Interface) for GUI functionality, it provides functionality for accessing some commonly-used operating system facilities, such as copying or deleting files. wxWindows is a 'framework' in the sense that it provides a lot of built-in functionality, which the application can use or replace as required, thus saving a great deal of coding effort. Basic data structures such as strings, linked lists and hash tables are also supported. - -wxPython ----------------- - -wxPython is a Python extension module that encapsulates the wxWindows GUI classes. Currently it is only available for the Win32 and GTK ports of wxWindows, but as soon as the other ports are brought up to the same level as Win32 and GTK, it should be fairly trivial to enable wxPython to be used with the new GUI. - -The wxPython extension module attempts to mirror the class heiarchy of wxWindows as closely as possible. This means that there is a wxFrame class in wxPython that looks, smells, tastes and acts almost the same as the wxFrame class in the C++ version. Unfortunately, because of differences in the languages, wxPython doesn't match wxWindows exactly, but the differences should be easy to absorb because they are natural to Python. For example, some methods that return multiple values via argument pointers in C++ will return a tuple of values in Python. - -There is still much to be done for wxPython, many classes still need to be mirrored. Also, wxWindows is still somewhat of a moving target so it is a bit of an effort just keeping wxPython up to date. On the other hand, there are enough of the core classes completed that useful applications can be written. - -wxPython is close enough to the C++ version that the majority of the wxPython documentation is actually just notes attached to the C++ documents that describe the places where wxPython is different. There is also a series of sample programs included, and a series of documentation pages that assist the programmer in getting started with wxPython. -""" - - - - - +overview = """<html><body> + <h2>Python</h2> + + Python is an interpreted, interactive, object-oriented programming + language often compared to Tcl, Perl, Scheme, or Java. + + <p> Python combines remarkable power with very clear syntax. It has + modules, classes, exceptions, very high level dynamic data types, and + dynamic typing. There are interfaces to many system calls and + libraries, and new built-in modules are easily written in C or + C++. Python is also usable as an extension language for applications + that need a programmable interface. <p> + + <h2>wxWindows</h2> + + wxWindows is a free C++ framework designed to make cross-platform + programming child's play. Well, almost. wxWindows 2 supports Windows + 3.1/95/98/NT, Unix with GTK/Motif/Lesstif, with a Mac version + underway. Other ports are under consideration. <p> + + wxWindows is a set of libraries that allows C++ applications to + compile and run on several different types of computers, with minimal + source code changes. There is one library per supported GUI (such as + Motif, or Windows). As well as providing a common API (Application + Programming Interface) for GUI functionality, it provides + functionality for accessing some commonly-used operating system + facilities, such as copying or deleting files. wxWindows is a + 'framework' in the sense that it provides a lot of built-in + functionality, which the application can use or replace as required, + thus saving a great deal of coding effort. Basic data structures such + as strings, linked lists and hash tables are also supported. + + <p> + <h2>wxPython</h2> + + wxPython is a Python extension module that encapsulates the wxWindows + GUI classes. Currently it is only available for the Win32 and GTK + ports of wxWindows, but as soon as the other ports are brought up to + the same level as Win32 and GTK, it should be fairly trivial to + enable wxPython to be used with the new GUI. + + <p> + + The wxPython extension module attempts to mirror the class heiarchy + of wxWindows as closely as possible. This means that there is a + wxFrame class in wxPython that looks, smells, tastes and acts almost + the same as the wxFrame class in the C++ version. Unfortunately, + because of differences in the languages, wxPython doesn't match + wxWindows exactly, but the differences should be easy to absorb + because they are natural to Python. For example, some methods that + return multiple values via argument pointers in C++ will return a + tuple of values in Python. + + <p> + + There is still much to be done for wxPython, many classes still need + to be mirrored. Also, wxWindows is still somewhat of a moving target + so it is a bit of an effort just keeping wxPython up to date. On the + other hand, there are enough of the core classes completed that + useful applications can be written. + + <p> + + wxPython is close enough to the C++ version that the majority of + the wxPython documentation is actually just notes attached to the C++ + documents that describe the places where wxPython is different. There + is also a series of sample programs included, and a series of + documentation pages that assist the programmer in getting started + with wxPython. + + """ #---------------------------------------------------------------------------- diff --git a/utils/wxPython/demo/OldSizers.py b/wxPython/demo/OldSizers.py similarity index 98% rename from utils/wxPython/demo/OldSizers.py rename to wxPython/demo/OldSizers.py index 308bcec7c4..cf24093eb7 100644 --- a/utils/wxPython/demo/OldSizers.py +++ b/wxPython/demo/OldSizers.py @@ -292,6 +292,8 @@ class TestFrame(wxFrame): self.CreateStatusBar() self.SetStatusText("Resize this frame to see how the sizers respond...") self.sizer.FitWindow(self) + EVT_CLOSE(self, self.OnCloseWindow) + EVT_SIZE(self, self.OnSize) def OnSize(self, event): @@ -378,6 +380,7 @@ if __name__ == '__main__': EVT_MENU(self, 200, self.OnExit) self.panel = TestSelectionPanel(self, self) self.SetSize(wxSize(400, 380)) + EVT_CLOSE(self, self.OnCloseWindow) def OnCloseWindow(self, event): self.Destroy() diff --git a/utils/wxPython/demo/PrintFramework.py b/wxPython/demo/PrintFramework.py similarity index 100% rename from utils/wxPython/demo/PrintFramework.py rename to wxPython/demo/PrintFramework.py diff --git a/utils/wxPython/demo/PyShell.py b/wxPython/demo/PyShell.py similarity index 100% rename from utils/wxPython/demo/PyShell.py rename to wxPython/demo/PyShell.py diff --git a/wxPython/demo/PyShellWindow.py b/wxPython/demo/PyShellWindow.py new file mode 100644 index 0000000000..1f68ed8be6 --- /dev/null +++ b/wxPython/demo/PyShellWindow.py @@ -0,0 +1,15 @@ + + +from wxPython.lib.pyshell import PyShellWindow + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = PyShellWindow(nb, -1) + return win + +#---------------------------------------------------------------------- + +import wxPython.lib.pyshell + +overview = wxPython.lib.pyshell.__doc__ diff --git a/utils/wxPython/demo/PythonEvents.py b/wxPython/demo/PythonEvents.py similarity index 100% rename from utils/wxPython/demo/PythonEvents.py rename to wxPython/demo/PythonEvents.py diff --git a/utils/wxPython/demo/README.txt b/wxPython/demo/README.txt similarity index 100% rename from utils/wxPython/demo/README.txt rename to wxPython/demo/README.txt diff --git a/utils/wxPython/demo/Sizers.py b/wxPython/demo/Sizers.py similarity index 99% rename from utils/wxPython/demo/Sizers.py rename to wxPython/demo/Sizers.py index 24545c108d..c200aa1fbf 100644 --- a/utils/wxPython/demo/Sizers.py +++ b/wxPython/demo/Sizers.py @@ -481,6 +481,7 @@ class TestFrame(wxFrame): self.SetAutoLayout(true) self.SetSizer(self.sizer) + EVT_CLOSE(self, self.OnCloseWindow) def OnCloseWindow(self, event): self.MakeModal(false) @@ -563,6 +564,7 @@ if __name__ == '__main__': EVT_MENU(self, 200, self.OnExit) self.panel = TestSelectionPanel(self, self) self.SetSize(wxSize(400, 380)) + EVT_CLOSE(self, self.OnCloseWindow) def OnCloseWindow(self, event): self.Destroy() diff --git a/utils/wxPython/demo/SlashDot.py b/wxPython/demo/SlashDot.py similarity index 99% rename from utils/wxPython/demo/SlashDot.py rename to wxPython/demo/SlashDot.py index bacf005620..cebe1438c5 100644 --- a/utils/wxPython/demo/SlashDot.py +++ b/wxPython/demo/SlashDot.py @@ -43,6 +43,7 @@ class HTMLTextView(wxFrame): wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition, wxSize(600,400)) + EVT_CLOSE(self, self.OnCloseWindow) self.mainmenu = wxMenuBar() menu = wxMenu() @@ -155,6 +156,7 @@ class AppStatusBar(wxStatusBar): self.SetStatusWidths([-1, 100]) self.but = wxButton(self, 1001, "Refresh") EVT_BUTTON(self, 1001, parent.OnViewRefresh) + EVT_SIZE(self, self.OnSize) self.OnSize(None) def logprint(self,x): diff --git a/utils/wxPython/demo/Threads.py b/wxPython/demo/Threads.py similarity index 98% rename from utils/wxPython/demo/Threads.py rename to wxPython/demo/Threads.py index 2dabc263b8..19b759aece 100644 --- a/utils/wxPython/demo/Threads.py +++ b/wxPython/demo/Threads.py @@ -77,6 +77,9 @@ class GraphWindow(wxWindow): self.colors = [ wxRED, wxGREEN, wxBLUE, wxCYAN, wxNamedColour("Yellow"), wxNamedColor("Navy") ] + EVT_ERASE_BACKGROUND(self, self.OnEraseBackground) + EVT_PAINT(self, self.OnPaint) + def SetValue(self, index, value): assert index < len(self.values) @@ -185,6 +188,7 @@ class TestFrame(wxFrame): for t in self.threads: t.Start() + EVT_CLOSE(self, self.OnCloseWindow) def OnUpdate(self, evt): diff --git a/utils/wxPython/demo/XMLtreeview.py b/wxPython/demo/XMLtreeview.py similarity index 100% rename from utils/wxPython/demo/XMLtreeview.py rename to wxPython/demo/XMLtreeview.py diff --git a/utils/wxPython/demo/bitmaps/.cvsignore b/wxPython/demo/bitmaps/.cvsignore similarity index 100% rename from utils/wxPython/demo/bitmaps/.cvsignore rename to wxPython/demo/bitmaps/.cvsignore diff --git a/wxPython/demo/bitmaps/01c.gif b/wxPython/demo/bitmaps/01c.gif new file mode 100644 index 0000000000000000000000000000000000000000..37ac5af437443356ebba9b15c4817d22fe1bbd53 GIT binary patch literal 545 zcmZ?wbhEHbbZ1Cl_{abT4Gawp4gdfDSNta)P#K(`qfnfmlUb6OS(K`foLH1noLa)5 z_>+Z^fq{`h2c!X{m4WHMPs7U7Z~2uC7&{s_-`n$>zllkJ!Kq`}t1eCs?&F4+7(ey$ zd$2#T>wch8cSN9RvWAv*2X9hCgqI<Rn&BlV<-)cwRLP{bKyYH^jQS3qq~?g<0urun zipLcVx_XrAn;9h93|6!rn3&MfykX-84IsfF2_ynIn<q3HOfYCzu(GK^(69?gG)e)9 zi(E|;CK@mpOi<u%IxulVH;`bEX$sJ3Zjfo-z|;KTOq0OgCWp061#_Dg^fq0PZDQbS zGWge+@UC&gG=a8+Z3|ijt{K2_!Zru)CQVK@6^RK6oJ^WR3>uCbmMAtUaZK}I31B%m zsr$OCfJdYO!+{1?F99FV21bT97H@$yo&s!*Gg+eqmb`9wpvKN(Wv=jIB_rbn9*(vo zhlCP_rX?Jclsvi=G@A-JEfgfCH!w5ha<VZ<Oi*BM$`&+G*dfLUVO(fSaA;!WFj8RH zp1{mhz-<O*fOUbjXLA{89B6njtBHrpKmn+jxrv8ki|vVq1<}mB9J>@xG&lftaj+@e yXaI%*BZnE-F0gh3_65vL#SB&o9$gLx0vH*X7z8c^Gca(8ua4f&cff&>!5RR&a=1<a literal 0 HcmV?d00001 diff --git a/wxPython/demo/bitmaps/10s.gif b/wxPython/demo/bitmaps/10s.gif new file mode 100644 index 0000000000000000000000000000000000000000..e83bfa8f2c798df8c3b1b2ab442f29ff728fc1dd GIT binary patch literal 990 zcmZuwPiPcZ9R9sGv*Va7@nw}b&2Hk`KL@ir#h2iryXLSnYGXlYpdd><I7v(~8W2qm zN_%)SDRfD5n26GVmkC8t*p`XXUMe!v1R78<LGUPRDFj3zL3$_!w{LcnT<SY~@B6*? z{l4%04sYnQPd_P+41on(&|Dli=Z!`q{r=$a^)D_@(y7an6VoFTSI6nt$kp>x<I|A- zM@9e$^r#_f1>88z?>~9FFUwHXe)#gyzxy0az^vYVJ-b(J|D)eYFJv}~PFni0{b!=B zfNiKhq-CYQY>}rI_t-|9Xy5*Q+pvfvD@e(*D#9~>7N7^uXp~hyHy7L)ZZpp9`jYpM zZu7Nu`kX{O2)5uI2*wwK&ZR`?_!;CTeslc9ZGm3md-7+y=LBf2GnJ@0{(R8+2>G2g z$6NA41}yOAz1Hry>;57~e9>F-n!E4tt<CxRdOdA)$Xf5UO7IGO7aJhfHIl`e{1J%* z17ohzI7cQ=x!D&7<z!-2{VHbPvd)moUO_q_sR<De6)2IvPWc8>KszABl06qYl=!AX zC1XzM>6*SkBs8~&^#<i2^ZTr-lUnsw=0%%a7`;>d1>3V$+PPo$GL@>8C->B@%tD)- zZ#o;QB0=2paM%{pz#4YVW<;&*W^Gq4lGTbgX2<1;FTXC=OTQ}egG<?aA16h6scUsd zQyb<8lvv*Z3%C*f&-sJtt%rrPmA=uR8s)&03nv1M*&r-SjFRJ0kG^I|{gf`_L%Gcm z4^a0wP97FH+F{?oMe0eAWDG!JK7tapPO>w*Fp%>RKDTm1bkNO{dOwYH)J51jL6#*g zGEEHzA?_XI2p4m8L+TY7;=*^Z2HeKox@Wgo@~CLbw}LzacW+0AxSM(=OM-8(RFsyN z_nWK-f^C+kzNz=EJixfHa>LXMv^AhGr6RI9WlC6yQj9uq^XM89v{{R{mGt^<DW*1a zo4ci$`n32kJ7Rv8s1^@EK>2YgvX&yi8yplh9)Ye)JL2+{c)WQwothD6LYF&hb0{21 XN8gbKPf994EPV5H>KSOm0LT6Vj4T~S literal 0 HcmV?d00001 diff --git a/wxPython/demo/bitmaps/12h.gif b/wxPython/demo/bitmaps/12h.gif new file mode 100644 index 0000000000000000000000000000000000000000..8e368f3fcba0f023981404cff6d9f60941c97bc1 GIT binary patch literal 2770 zcmaJ?U1%KF89jII?958OJNjX124zMW$x_*3(@bhXw<}Rbwi7EVg$*Upmzc3zHwqQa zl5B(uez>lc)Y}&0f+&3`Wt_a0)Ot*7!c7`z$U|8AQa{A7bsxHrv=J$7-Ir|7ot2?2 zv<BhX`+fKO&N<)tX3jnNMDt4*&LPJqDF10_tw+EJqtW;eSorjz_IJPb{C4u<^V`pL zFFg0crQ{nIUijvVm%3Q^rz-$~llHPL133!C2cM?zJ$a%ns=xX5C~sU}`W!^Ezy0Bx zKQpHL%&EJ@hdUoXtlt05{S$A7(KF|s-TsOF?@zyYrTq2ho$}Y;zR>*D_18bR)al0Y zZ%_a7E1T;2>#zM0o63WSs3t4D9#Sl;s1>&&ES1L$F@PT8RX285V;erR8sT{0skkP8 zP(gIydhS8QKztD6I4ZUnV#QlF*z)d5kHLhO7F9*fD^In0hz5VRrweSfh)IR%x8Krd z(Yzy{MK<9rV=r&#TFRPQ>HoMo(pO%-tI&8$Ukx0uIvgNzwbPmlxAMW2>kia3-ngm- zmcuZ-m|qh}!g^m65>rqsAqpve?lyVdn9~v&8pUhS0oITX%>N1v7}{`R?B}^g)A69u z&dv!$bGu;E@4r0HkP(rOM^Gn3Q$;kti+>2Bk1xK2Ly?KNLWF%j*wD3#!_fTB?l`0- zF(5E<Ze_z;$6Y<EzO3$JAhjb=&)d*GdUM@t=7O$bw4AmbHfjT2y`PC->31yJ#rg#H zO*VncCKDd<$=gkvg8mgbpXQJ;+KybtKyVgq!@KFakRkJ8o^hr(2zs2-7r2c!C0x3v z7ZJ9#JI@;ddt?)8AMk5+_CP&l%Auo$T)Jm`>>}fn1Ah!71RlMO;$0$0^`Z(510l3f z;UHsCK9zY>q_7wq-pd%UG>6cOEPoV5^4>8Str27;CGZvs@{iJzmu1szYqH^1cp1+s zqzNxAq#Ii{6rm*iZFV2PS9JnZ9gs+apr`62QbH&LwR)e}Iu>BronQjgZ%GT^7NsVo z?tlG^MIORHbtr<p!Mx&(kXGXdd8e($kd+kzstj$T`uJK|^bB`^fe7ZP=wqjNw@2!t z_FwgE%6KZNrD}VOD!B13rpAe>3vb1&%cIGqj}n4ytPE8h+KJTZ{IXqK5-ByYDLrCi z9<oKbQdFhnz=K+7Mfiv=vSWS~ia$B#l7ltcCpu7JKl>sYLT(PUgUq)@6||EkGu$S@ z0eSSmYQvsFqIg)@T;Or!zDgk{q0cf>VeU>_d&6v|#tN?(7AsulV$$dZs#|OC1#@j3 zb4nHdoE2<A&F=_|>O#+^OdfhiJ+Mj^A+5n=x#6-0I~#yAn;ew67(OADLA;jC1ccUY z6J7zN87G0WqU<bp4CD$s_tynkd5u>Ei@|Hd3k%W9GZD5OkGgnAwdrua34+PA6e3__ zn_Jhy%MJIZ%#F6-&vDl3W(lWxs0HPz<eJ6cGj}=X%5umZ7PF@;HY74aZ}!O|^LzGm z`V{t=YmH<^)_(A|OhBHo#X<r37%;g)3(Z*&RBbDpAYgPYp8qUNu~RL%Z)5$EZ<X^T z6)J3NbDmcB7K_oRB_nnYbM4g&VJCMaM8wB=l523_Hi4>=QPlZ2z^uSc?80dgLs^W- zboq$75tYsuB%4-plH&}Anl&@B&^`-2b^_QmdX_X*Ba?N3cmyL!SxydczM0I_8b%&v zSRrQr0BLFPvB`O+8Er`gSoj^qagEz`fL@ph``){3L@y*Ba|~f#+LG@(j|t^qIEIf3 z;844hmgn1|$70m_Jm1!1(I|T|1Nvl*`mGf7N+v$b^|JPAK=Rajm9I7Hzo{m#5t)U~ zT>4LhhkOrejy9V}*o^}BI+i_W&xHF&>@!ymGPl*|7s8C#x!fbc89f5ydxyf>a^cRp zZ%fc$u{8>9V4cJgYq#W-1%dUGYlj5P(_tpL+@;l+(3<{XU=!}6StjHzHuh*QJq0ZX z1K0(gI{6N(uvovW(Bc|p+_Py!E{Cy6_S0CJ@31jd?Q))Wjo?t#1#j$e=Wq}6oaz5f zu!gn^vunN0<uaJ&$(htltFaB-(V!PpnNiRDDK4<;!<u!0l)D-6WPW7Z<+%B=fu%7= z--bp=igx;F8ma#MONL5aL{JrW!*PwT<NkWpE=-vJMGk1Bo6@5(tQW(?K_~Z<aotXc z$U5JCAy>5Im)kCk1By1xPPQycEe{ecs?)~;=!fK1#@&JcBm2hpxh34m+;@i%JL73p zLb9Ng<Y|4q!Brj>vNe`H1fG(7iP#SY;qVo3+3)s6OdXeV-)ZQmkZ~a+gYCT1>Wh{U z>Xv@`!Qt$Xt|<?1T>0vQ!({8hVdr~~BjDZ7f89Ok3zc3yZ{X;wPbZ-4NU*l$I_#V3 Nji2sy3rqm3{{q%1M-Ko1 literal 0 HcmV?d00001 diff --git a/wxPython/demo/bitmaps/13d.gif b/wxPython/demo/bitmaps/13d.gif new file mode 100644 index 0000000000000000000000000000000000000000..af411147321592de4e336fd82eb5aa42216d1c7d GIT binary patch literal 2800 zcmZ`*PiP$19sb_D*_o9Yji!oYPtB}$WV}Un-F8ZKSg*t~sgqhsOWC%8#?Zow+TavJ zmSibz(c!I>N`|(<6rFOK)(~<i#pqfHqm<I5g|g|%ha3jn!_t}}0tL4RZ@=H{t|bc5 zN;B`h-}k=X_xtnS>gtPMZ(iQKiY`9E<Yx>6W6T&BV>~YZmY<yM{N%f@-HP9M?bfUP z%~xN)5&v-W_3Llk=wtamwgN0%lFdQ`JzlXsev<t8#V>TMU;N?s<L=5^7cRp}_HX_3 zy^r&}|AVi(zkcRV-+GY74~w<O+Z*A|y@#V;b<XbGTO0l6!Q#%tzx?zC@2~&*#*?J^ z-oe|4AJzIxKi~S&=fBcyz4beNQ+dY00E68<2j|i7qE@XHVcCvh=AC(iI|jA+$ZL3R zn;*n$G1_f03{ZoE2sSrOZ1scsGc-9~#E2(`29_!ZmHL?jf{)i~m4jAg39;uc3e;a; zIV|*G0j<;TUd@aPH|(Q_d{B)L@-@zt<zl~EZ0@;;!vBtj1>p13L;<5YDDq4XwC!W% zFuO9SRa$6f-#N2~m@-JDz<qof#h0w4b53;XgNromz0+!<s-`?bNIIzIQD$r3yNprC zY$_kmANy(|(?~gwA(+bbXA5Lk)NZAjR0C`3t8^N%j+`qr!v4zrd#Q^hIz2i(oXMDi zhZA7|I@^Q2+7h<zRxIo}wVC*_OUbCM@?oQ6>3VRa5I>47y)1^(T0UaxLL=!|SPo(f z@oMQ{206Ayt7KWiQ1UXfy3%wdePg<o>Uu(Jol`AIn}JW_^prrT5?H!+0vF8qMEDd( zK^GXVi-0xo_H)iz7}sN&-9=bwslxrtexA;WLE-k1QR8Q$TuM3QgH%#f*<6wy8Q%+s z#`h!P!r$b<q<eV3gru$)<VImM<RgIb-)WJ-nGz89fn}5zl@ONQ+xp}~TN0=bk}h#c zc15=&2`BSJ7tRJD4HR1M$_Z_uo9Zu@qa;_ltUxR2-qFq~t+khB$HdB1mR1|xs_jTL z^3dnCG)kC5ImmWOh#sudAOw1BHb~<NgF(tbM#D*PvEOH0epr|V9uy+T5F-#p5<>&1 zqP03yLX+x$3jtY-p33LcX6x!Gq1E{&rxCijwn;@D>7<pkk+jV>Q|;x@Fw02FBchu* z5K~MltH6rVFXe2FZD9DE_K8h$EE3xUhpFq3^nAy1Shg02c+Q-npE``Xm?8~iHJuCD zx{s*prcwRUn-*{5HYrwfEU?R}s9H03fwGXJ)uo7>*^4cQ`@)`aMiQ8<$R_S=`lynD zKAax0Jvi^$aJcQ<Q!KTcMd3{-tqW_N!4+x68&bQ`^QB|Pnc3dT!1f9b3&G+aAC=0y zQL6i3Dg>ZpDBjFW8PKNVsB4^lt_EeC+al75A*q;<85@TavSzNWL$jD<wok`iI)+nL zH!Z|76A>gf6Hy|(CQ5fqga~G81>h$(S0?~&5j`j>^AubT^T0b&kdQZIo7B^kB3LUK zvRn*Vd)$_!XC$JRlEE*}Z7ZhIXL_8-utChFum|iL)nNKPZoBYXRhE`<N^o7MkopDC zMJ!mhhkKJ9$_hleYDu-S9hYQs9;NoYF^%*n?(m2*f4REYHSYL!rrb%^s$?-piKxzP ziI2QInWSiRd1a))?fm5nLO~!YTuM7PYlF0UVwJa_V~p@V#nK(G*GbDTzsC$D5j}Oj z!=r%=h4)ji+{Pp?QO-GH%Je`krI{Sz?PV&4sq*{cQvh_a+%?r7bK4gGbEr>)i!xOc z&nKh}2M%ZP-9Nf02DRH#4Z0(SE%X0at}^fS6?5rSq0rB;wvxJ%_n=HxEZb(mO<XKj zp_?7-p3c}Gsk;7cwpM1dgmSD?`6isUjC2u)&$EF}o8=1Y-^>HSE^rl!Z8ZVRI<2Y* zKWm8>k;4S<PqRu5p~&HTqQM=@m={Yg`#Zm^(dw8Q^{_4Br$z@Hl6yu>0KdS+-TWy1 z@G`LQC_l!s%@axs24%aCpov|W3T~%n;e_Cg0v?60PotMZAXOv-Y`Ma&y;A7P-51pQ z<eWXtiP2t?Qqs=cR(eKSW~+y~H0a5?q_OmPm~!#ZPf7Z?K$}OISE#?rtOlP2<Z6-1 zsJGSE7||%xEuJ%0E4I-6o&o;@!!Gbe);ZG=e{(dBUI{nUQl{N<`lF81=9Xal#(lAV z?r}w?_qVUj07+OOr_lCxHVW<XH%B|P+dbY`@H%f^&!O`-uQ6v7oS;*!F#PcD;QJ4L K=4Y4#*8T^g;UfM3 literal 0 HcmV?d00001 diff --git a/utils/wxPython/demo/bitmaps/Calend.bmp b/wxPython/demo/bitmaps/Calend.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/Calend.bmp rename to wxPython/demo/bitmaps/Calend.bmp diff --git a/utils/wxPython/demo/bitmaps/DbDec.bmp b/wxPython/demo/bitmaps/DbDec.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/DbDec.bmp rename to wxPython/demo/bitmaps/DbDec.bmp diff --git a/utils/wxPython/demo/bitmaps/DbInc.bmp b/wxPython/demo/bitmaps/DbInc.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/DbInc.bmp rename to wxPython/demo/bitmaps/DbInc.bmp diff --git a/utils/wxPython/demo/bitmaps/Dec.bmp b/wxPython/demo/bitmaps/Dec.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/Dec.bmp rename to wxPython/demo/bitmaps/Dec.bmp diff --git a/utils/wxPython/demo/bitmaps/Inc.bmp b/wxPython/demo/bitmaps/Inc.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/Inc.bmp rename to wxPython/demo/bitmaps/Inc.bmp diff --git a/utils/wxPython/demo/bitmaps/Pt.bmp b/wxPython/demo/bitmaps/Pt.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/Pt.bmp rename to wxPython/demo/bitmaps/Pt.bmp diff --git a/wxPython/demo/bitmaps/backgrnd.png b/wxPython/demo/bitmaps/backgrnd.png new file mode 100644 index 0000000000000000000000000000000000000000..59349aa8d1d1c2a0bd49f44a58d3875043ef49d4 GIT binary patch literal 16672 zcmeI3Ra;z5w5=O&+@W!ICm#;M12pdL?(Wt&A-KD{ySqCCcP9kb009D<z5l|wJ@Xm! zomDl*&8nxaR;~42NkIw~i4X|@0HDf9OQ?L-)c;K&%qNj|gXTXAf}4!IB*Hv22|5cs zD04ULa|zK&TH6%>V5R!sgz_p8_5c8207`OdlAle;|0U%A3gmMJf%JdIR)6W_4Uho< zzyJV1000F5@HyrH0Qf!y1cCrS3czO<$N&U#0Dv4oARhquxi0o83?LW?1Y=-O05BLn z1;pS0U~qgA1A`BU!H0n%2E-8iBnacv0|sHJfItjD5XYx5Kzu+D-zPyJF$|Cx2n5Ce zfj>zBQo#Uy+Ege&Iv|h^1qB}l1s{k)41+@KlN1zS3<@xa0!%@n0-{j)Bm;#Gh~m?x z!$4t5L1D_kAO>O(qhJ7o7{C+^DxYFt(4k<^`6LH}DFwr)!IXo+_EUTeu6!IS6dWoH z96A&nI-lg=FlFE{{UjfUEdz%w2Zt>mhbsrir_EQ4Pltog^izC%wj6x6e0;7Pe6F7q z<MZX?`|O5-#Z39cY(FI?=E^7LDkkR3C+7P}uvn;=SST25%LjH91N(jo4E~&ks(_<a zR6<o$J{hf}lB}Z>t)r8y^YQ=V|8WOiZ}RhtArQ#N=Q;lXeEeVete>OLD0_?w0sw@X zWF$n@yf#?6Up)`UQ)tKYj=>YlUuAKNw_9bA86{TMO5j2K{W1dD*hW^+MXk6Z;}D-5 z7)rBzE=f+j-&-n3@;Q2GjT=In_nOz9r!tl$_Y|17?N7d2?LnAv)Rr##mK&^cDdv>G z`%ofN!V^N(Vo96i%!)>PJDPt@<X-qTMPM%59~vd2YfG&q*%JunF?vKSF~fo1ewEIo zuppoFGEH{2v~qkgaGE`j;n0Z$Z-DuR2-42KwsFoC3C^jLBKy74XSxK;RvOoQ!MkI} znZ}Q{?)Yyqx%Im_wW(_Ia}t&ctKY}n%CD`h@>cpZl?k=f(c)*7d!t786zA_Jf&!{( zWL*LD#daI^KPXyeaRqBrn6pvSmr55}8S|o28b<j|(_Cin3$Kdz5?G~Z8{xuDzMk1( zhWcT_2BD<yEflYC!LjMp$r-2ERTraUBNzPrZr3%YqQ74;oy_rVMNgIwd4zhe*K$RR z*EV8xRa8c9TY6F5V~vpE7Ck(ircy$>i_{~e<%*RpI^&MMP4b`JExoDKx65plSU(S9 z*c~zW?+U5L@h13Y-%llFF6;Grn5y@K@T(d3zr^8Q{VZ1%KFLnez~g2ii<UcM#zD-| zWy)xF7x*vgejV$Jo<NA?AOMv#CJ-&yY@#Znrm2L5o2E5JR(;K0b*)h4doz_})d+zH z9ZKw=nP5UGr!2#{icHD|bklJuK{&iJgiI{-BzmOP&SXR|*UFTvUi5kJ2UY5K#38Cg z8t4lG0ZVi0^anpvdjstnM&|4ky#q^J&Nr6U{ep&5X3lPp7)f4F5dWaRnv=GbpH|^t z6G~1G>gbAixRJ5Z<Su+w-H3Wd6v|9C%o#aaSv=!aGX{dHY*&`A!rV0vUMZna$Z1<@ zS_B08n}x~Uh0-Y+vaDDc$f1q@iSgr6w{X<Dq9@LoRvWjqY(pm2bj;zi=!rs{GGQYq zRy|TKT*V0-WJ67ej1jCnwp1;=OBginlJ5uGK@1lsAgtc{<O&vS30pjNVQ$696slkH znA9p7%RVe&d;5V3q2s@_s6*J6#@7j7A$AAK%-glwI-7h{Obl=)wmLU@cP;S;O4Kri zhlIMiiw3eflstlbW{t*?lzzZpF&V0B{=NKZ-dbVVqt`k=0_FUAWm4ByYVBF#>PIX6 zSeXdS1_hq9$yaqWrkPkyMjeV#Cg0rnhB(W@P7MqNsJpW7_-_UCVlZrG*WKx3cb_AZ zVH+f5A^mCq_{9|v`B!*8mimszi97S}10L43X5ssFOOrb-Aw7HAxo`+TmI(%*_Lho< zOU|hw^AvSTV6=x$)1V1z8!qkXv4ur(R71J=c|0e+R)VdLIIC2`2AT+34!bbNIWD@l zP<!+5yu&;xf0$-7JMWZ5mmd<=C$0S(m&m_p|Nh6I@t5Rr0F`#slE#EH*GQ-ZM+Nb% zg~^pwGTypWKgCD@`vTn_>QUJSCAT8DX|dCN1ZjVoli*+|0mq~`*_#wVBU;`f&8f<| z=ukgX^#e*_#ZALlX&joWTO^$hnp9O_(nBJ9#Icf~37vs7Azg0QLJPSK9t8EE7a@W6 zgIR=ADOAV%C}R|$BwtV?KAhD!z%J~ura4Q?j7Xa_X@3V>B^gQC0*s~Gk+2{na4TUR zjT>VOxqvg9^f!V9F4_f5$G@-X_jVu1hR}DzD?maX2TJg<OA}<7`bpUl4e8>kr(k)j zz11COk4v5Nznr@n)4$$udE3||$s_<ppp3AI>5hR3-~V81vqKSSoXhJu$eNwSGk%rV zA5!0?n1bnlU9UmIGv3RC2a;3+NXr4Jf(gXqmz-44nAsc>i!Dg8ykCdcgF`4)qcp5r z0W*_E^kMn}W)FnC%gGiWMLKkpa(L1m%NxP6?A2D^qf;D5;k5{rx=Ws4YWKb@x_NNh zc2VY<MufmzyIjD)MP{ap<U`MHKxNsqTqd9)c1>4aGpIs2+gW$^y|*wVG~1%+8ZV*< zq_||_(Zt7k0Sh#n`$H!;_9_>W4yT+j4Qz@9!rh_gdG5_}f=c@rWf-W`x&Otx{4qjS z#f!5KQG|Nwe&v4K2t>#pdjUoKtkPOXTa*+``Ne;7csOF8VjO2H&TH~wnFOxJZ_G$3 z)%apoc90)CN{&m<Z#gbI>OLZtqfcr;YG{z_9bGDPfH|*frl{DTJTxR;JIOh6=z|UQ z?V!^RY(>O}pL9J!Ly7U1+S{RtCfEKZH1+T)(a;EIq5+-IP&rjyg52AB$`7p=fK7j4 zGE-mx64%QViu-0gi%I6nph?I<@_Fu)t{(^vDZ;s!ir<so9(|kOQ?n5YWR~TLOB`}B z-o{%QI7BxB27;DS6!g#b$-v%W#(gb9p>ooJQ15^KeSaq{XRBxAD(8Y8%~Aqs3+p?^ zP@TzyPR7fLoV6NPw>Rlps=c?VrR_iSCP$huG$m9DCiwX}l_$AcaC4Ej*>8-E1`jkF zC7kOM-115#hj3u@x5o5<4y=cIGMH6kMd5&KgFo22YXaE+%Ru^`c8t{ruM^tqO(Rdk zJJ<ZkK3#ITEgO-HdH#(eGI?FBK*pKo`6#<rJGPzp6~U1BnOZZtYWn=-o%V9$0FgmW zX88mtl(EaA?V!nreX3MX)$7c35lTU8w)0#V0GS-#po4}Yq6~@D;7Bs^hU3PO8X){( zj2eCvH{?f?z}f(#i4l@j=z#KFGqdf;7pmy5w9T%tfY#QF?|;w$)UH-*mC)@PA{(r- z&4?|XUj!m_hw4mh7Cv4i?CJqwT%D=k2}#2dtgqsu#hUIz^AJLjkt8Y;2sZ={1P>Z@ zzswBuXgxDDi|CjJ{l~_BZSjn`hA2H_r;hnGJt0!FZD1Xgjc^MCd{pc6Wu`*cK@eQ% z1|&d|;ogPVA_{};5T-y`%4Sqq3f9Xa@aU;V##m>NA4Nk-6Go|mm?&0I4O3;&-qQU2 zjno@K!6ENS-i^$9Ja4<8RaZVT-=K!7NwBkijNdK(zpD!j7u3H&6l|E$@P$iRb;4q@ z3FQ*phfvlH0oE^;mJOy@M`1w}49{VcCZwh%b*9|!ob97dyWRT>;xB+o*cB1LvaESZ zQw}YEc>y*K1qbTwpZhox08rp-PPQU%!G+Dl-*GGd(hurh{7Z*b%4dM9bT987HdK>| zqjdjChDyK1YUTb&DWPZz?A{*)!C7)TbG>A1MpHtl@(>adV_M48DJ)VeBsZ3=+7Q{s zIu`mR3@@TgVW%&F9y}e4NLDl<j>j2Lp8K*Gx&v8zF2?RpjUgue^!e5sIxkYj`nZ== zBA|{gITq?>?@jcsl%*AF(4Xy0c5EM+QG320MW7dNd1TV*$I5An#{%okSuwXX4|?QP zx7bi)XH?K1X?E-JPGKFn4P%mRq_{!F&{d!r=T}f39I>1d<Mf<{f`aJI2~@Pky4VM# zhXN{Lyo3?ni>;~gI!Rp7f-VBv^e{Ql^rcxYrN?3*hu|yv`LBv<)MR0gjs}7Amx8vr z$Wk01<3l~vRjT+(K?cA(B$5V#(!ijZt^hJ(k{TF(3KV+$)#!)p@yn1S;cbTZFR;J$ z9LGwmm@`;7#4<)MI)X;9VpK|mS@DrvlAGz{vTp4g772cs?-@CEJ`n)xhLN1Ed`ZYr z+=8mfx<@W$I*G=4O;y{j4Q9Lx;|h^?5)Ro2_)Qcrict`|T#+fmO&WLWoPc9Y&bav) zcPH^ceaVqSd;G;+DsffA^8h*|1rNS}dFnuPgaJZkHSc#34jl~CK*53Eu2J#AfCZTl z7pbGnegj>?&|!Rg97A({La}PR7hs}*6&wWcft$H^>zEE-4t{D~#i8#TQcQw~;~B25 zO-rSZ*x7|s`M3aI#p**F;+e-`roZA0pfX>43%j=krep1}z_C%0QrxLnX*zMuiI3lR z0h0#5%}kKmB4%xNluj&4@71~XP7H;@DM6b^RN^g2rJ^1*YTtwmL6R`2ep+sf;Wd#& zrOQwCsnZ~}f5(BDWp}dP7(gvyxXO%Zg>unnlQF*=O;8fqiD$9_t0X_0T;(_!h)q*> zpe2DLLsvDD>tU7AVq)gyvk?(jAZ=9PG1!W>u;ZIp@CtEr&jNBC3pz|sr^n*!gI~ls zL<fv^Zelt9Dv(!F8?Uq>UYdC#;KJ4e8$zej;geVXp%oJBksDJ^P*0MxTsTC)F0{z) z+(Pmbr5M@b3v@*|fy@)v4?B7>{e53ShC3p{K}ru|%)jthB{c~W&lW!x*Rwdm*9pJk zIc8ap8N};vRJ{^F-TEefjK}i@u7Jld&<41-iPfqb$q?vz1a25SOog?6lgX0mn`ziX zxz<RX*E*#v4{HD&b25NrZ36a8tr5<`l#00z@46}qAvNKqNpe-V*H3!ULIY)nbn!e| zHgYN%M=?yKiF@dZx*<iaNjr`6!EE>zo&Bm+y0srVEpbm=M>ZxW`&NPmU|PP7v2xO~ zJLuF8y1`!4xB5}kgB|9-%%_6Yv9B1s=fc@5M-SicOp-3O{bVoxpE91lwiBAH+^yQM z^Li_|mbu}SWs3%S?V)xX)f#6OY<W%nJCgY_i6u>yp5D28*6pC-=)Z|!YLQ%7TA5co z@Ze>GEBb#91&QqCC~N$Q9lxg06D9nfB5p2X9LtT=Q2ZC0<$ZRy1?JNVFQDBfl&m^P zjIb7#GO8pZ5Db}nKYAyzWQg>*=UX_3{5D#hk8>9EU>@z8It@<cTMk4F#eIY(u*&(2 zzIn&ZBu)Xm9Z975)2V2&v<>21B)(R+_toyyIgSiS@N3flFiyEF^1ryAK|#(J@ky{= z?bm=w{w6VEZr%7aQHLIje*;*{jhHP}8%n@>f39u53^7TK;2Mak)q?{dl$+7Y3}W0P zLY3J6)Ec+Um?kKnOoRbEA(R!!NyQiRn?e<_O;Zwydtg?e)!M%5zpmj<XU&zyqa%G7 zRR_Xy2hHb=<WuD^v(EMM>e9R)QHMB5iR1x(XmWG~S9&}mG1{o7#ScFsP&uOFEmK$F z_MyPN<3p!n5Ze|5+BY4_TdiHEXyc2H$7lDUv8ZazFv8Vr;-QWLSO08J$*S&%J4%SG zf`~%ZJWr$&k+2yQ%QPv?(lA=bi2N_~*Kqp7MS>&NMS#W9Gb+7kBx{67^c8ZA@1pQb z<s&J)j~IW(hniV26F4U(DmEc=Enz`FgEc*<F|SpDQ7v$b?w+(}bVh$#9XGZS%3q*g zwk4t~S|exXnHVwIxwA45TybId4=&jCh^`Ak7ri%TwC~g~lN5gyEE`J-m4|I%wrb6I z3$RG%upEQkS5)XmZr)zZQdc2pUNjgy4=(D~+M5Y$tD30`+Y|J*RjEIaQL365S?ix_ zW|9bNttS^LHT+FqHSztu-H`6M2F!w=ahXmUmmywMuay6WLiQ4AXfJ6Lvx0w14HT&t z<P!f~ePNVSNmpihW6JOTXN7P;nSRxn>V1p(j2Qf@F?dJi54<=FR(_HEwv^_88qO`x zMV6XqtyB2`;YPu8g{{Dv4iLi7<v{*k3(bv~n6gQJ3UMp$If5R_l%sv_q3XA>uOfG* zHre7?Z;-<9h=HqmUVr`_-PcFx8h0zL^wq?>|Jncp))3BRY24c$7bk+HARMq(u+<qZ zR+OKYSn1gzvzWCHbF_9sdI#9gHlU)@ZcnEkwJ-LCppCAWFRK{l{%!l7?r)bRASvpj zPaU~-Bq&$kN880cRqr<$JdeJ&Pd5fiag)~24V68&IrVSx8mqc2A7zDVHRf7epy;D^ z;pkKNaaDq_HbIaGD>jA0z6ntljF=P#W~gn#;>Fk8(9^GW`IB^TUUO7aH@!f;tB745 zVcZh+A35iX=UbOrHONtV6(*TQ)5G)-!7_6b<=PfKuQFrU@^FSxXCZI+jU3i0iWwGb zE%_R0C^z49j|=zT#`GwoE&;wt!kL=Ic6`w+xX!o%Z=4^P%D{QmgiIV?+JAdf7JF=n z>~0G~7eG6DB_9aBbE*g`nW$NrXqa2IXE+}mj(<l2LqyQ%rG_R4e%`9h!Ve=WrlWIT zyw=*28uJ=~ks=|lS2gEk`pEE+G@<FtUl`#iJiTeZc-v3Q<sQ5i6X(Ua7uNmPJDf>y zSlRwH4pYz6j%OfvzkpljvFv*vu)q<ktD(4<PZI>Y&<d}NO}Bt4DH@PP&#;e0b{-!1 z!PITCI7$r6B;;ZeSnj>hp&#ggMTD|EdSMJYqijmZrmk;$lSPpr`glhE;9T@<aYm12 z3c7wWvKqm}rkDw)n_^zwwL~x#hV8ZhEfYI$KS&SqYC6L;PEzt^j!ynTg)L2%vNKP* z)vD9q9df{tCp;ak0Lp3Z@Mu*FvOY@Dz%xkz-6Dc$f;^?odAyNEsyQ2YyJ5SG7|7&o z>x<z;|AT<(uqD1qAl<kaKRiDtS{i!^@s3a~{s}zQIj9&6KcZSt9xiGPQD{TiL$=Au z7M&HNpc*}up4w=;l_#ut6yM#)ZqGNtw{M*mvE}?RuxQ{C=DhzSft_EMS_x?YF3o1S zI!2nJK;DSQ);~z-aH4w>nyhdZ9bbFAw){#>DaV~hB&zJ_IjBRE>NS-|o|?yohR#K~ z#?il^0HmX}KzS@%<sj#bT{bhNDEx1kV!q9q<rHUHM+r}ZrTPjwsg;ebr#my4hcPnM zG{^5atj4>S`{!iFF^S=N3cR0*mVtQ)mGIJ7Qa|;+*(mO?w6!PNnmjb2wej`zcxh;@ zD>V;#@ELChD(Cc8DjBe9QbmjrK(v!8?Ei93w|Yqk{OiVd_!@;GmVrR*{C6$jxeZ-u z!WctDLB8?GNpOGuyHl&0Qn)@|2g(U~S!4opab>fdAloPk71;6bM#=Z6p1j4M$N@@F z*+y3Nw!^m2o}-ubLGHULAY7x5yv)}-+ORtt&o20UDA$@B!C1>9iew$$KG(Q7o{!ZC z^!d~ALNk{u%giK1xPDQoHKcGDQl^77mVP%R3?uAl7Uja^iPJ5VF7DkwTyZB&<r}^M zUkf=qzD&1$XY;q~z&G(_>tCKPLND$leXn5HugxmG-j79!oeou2*VL`Fo}nm4SPcy5 z{#$CLI*O-<K(YMu5960#XsV^Eg~xFD95=iY>bFV{du!OHUwS!UNRS9#k1o#lT=+xX z=GWcy=7){IU;cD_ghLtcj|~F2ms0d~J9|T;8Nu3LDfzm-jgI7w6cjPsVIs_v522Y9 zA>`|N4{{JccZ*y%AlstKC8|!pBVt2!dF;)>n`PXb)efQ!%xP15HaN#y5YrAiY3kql zeW7f#y>mK4WV;zNz2?<6*mDK{U278xbwb9UTik~OB`VBO0kjhaVN4F9%6I>bofxk{ zS)o3Vl9=c>$-1V7iXn{ywb6vUg62F@?{Zbuk3&=usk61)hE^VJQ{v_HYV40m{z{Gx zWVi;aO43mWjd7Av53G?TH5S19ZXH5`+R_27EGV~@(`%R!E|%_Qn&cBw#Xo(iK+@H> z#mdkUXVVf5iQuMEHZt%K(7dzy{X37h8s$1mjrB{q$Lm8rgq%4+wjMh*JYyzRA^3)m ziUt&NHgU@Wz0Mopnjt2tZDt6jWlFj-2kE@#qud5v_U}ych058MRRge|++GTeRVuR? z#}{CxqT^t0cu!x_;HPT9{M3mSs9mJ%iDr$V!rPR!r}W?1B-jf=^pQstM;2(vlqDfx z{OLM36*@x_mot2TWp)7KPblr!%RzKHQ!|wiUa4;--ccjWgBhm=dg$O~9}c{9zT@A# zUpxd8-p%r&fbzJTBzsv0?7SwA@a@RDNb+5@-$&7)l4&32pkQ!wg)ELBQv9hHg0{c< z3UunRl?FvvEc>!KbrjKey`_eZj?QuB1zWboMMpA6%h&vR*<=?wl^jjX^LGh=fYEPq zqtRg;JVNI8C-}OiK`3w8)`iv%^%*9yIOYpaaEmI>gV^ag6`(_Pif{em1{E_pD(?RJ zK`M>@@)mem9_9x;Zw{zuQea;<9JPMO(#-%X6*vyOp<=G5m?r6NS-$}5glY_|3}6ci zE9giPip53vZPQj3VFpm*zR0SWW+M|pF%_&3%lK?hzsHqRNKh$aB|*WRfTnS|SSkjs z86BlCtEcK2JTU!5aV^fN2j9?}PAjiK!&8Lif+?8nNUhoYp|w~8)@;YQzV5e-*q@#P zy1)IZ5dDuuOU-_SQ9{;Y<uBS<G|*M>Y{&IEgy+vNSkm*>JdH$DMA|d?24SLRdoV)$ z*3#IFR^t8xF{JY8+Qu+-Wz6t5J1_?n8^s3=HeDXiO9S8C@SyCf_l|lmTiQ$2>7J{2 z5}_<~H~&k;q1nnE4Bp&WQOj%7&8n*2F$(P*pUsF1G|W`*VPvjJO@2nc=oF^~8<Z$P zm%s)M!oQA1NHGiYQ);H-Y2{PSQXre+-ZzWm1q65x$BGS#J&VO*tdSRTosuvz8k0a# zmLzacei^}%UBs7<;LSpq^4ZoZ{I}5|A5#aLxxcv@R-tJDyXR^mR{ZAyKV(hz0!-?y zQW|0=1A>T&$Y-A+YvsTbsw6OTvRlQ;uXp>spd`jvI7?h0=$cz`<3k~9fyhZUZn0>4 z=ojd@XT(_@JKyKrJF?jtm^bYcPC{{CW3g^P+$D^w#aYAB%uRG}1c%<OE($pm6wq6b z!zD|~2|?xQcGqV_PiumddkL~NEQO5>Q?ISQf6r|ZjC``Vx2ZI021Ci@u=HS)$gB7M z@FoAC=4)e{8*bfomnUVBuSxr(A$7sTKp{1$R~iPhyRzb7!`PMJCZ@3Pfr$2(R&Z|3 zmLIz9W$=W8yr!%XgI#&sjU``{LW8}Wa@+B6o?Bn`5fv>uL3bFRTJ?k83|ra;`MdoO zUT_fcm*upNE&ul?{Q*pa^!~U_nm<kw9A&u#uO<~+oyC&@3V1`)O<Q^d-q9s@gYLBd zJ>ja~j2grrU*`V9ST|q%vt8>~)qh}g@?fvboh~R+tIPokJJZI1{W-r9J~EXKBW5I2 z3RHzVWN6rm`xlY-weLTzJ{H5lU4*qx7aRR2oobc_)71OU@~%rOTVA)Ot*=JDbq#44 zvWbyMZpQdaCi8f1pwN;0p^z~TPs4{i_I9mpBd4L*Gv0b$8!LX^!Tr<!2;ntnQ=O4e z#icIfrSy4KX^8;m5sJb>(1A~A#8x6R%;@8b=PdBYBygj!Ek(6?%JOAfv}JhM2`<v# z_T2kt`JSz_zW0kbL;iL~=>J$F$MsP4sFyUyp?LHRDH)>qVs5QV=mVZnMS$|-V$mRJ zDf{mc&IYXg0jrq6Bb2kZH7>1v_M@sE^*=ZK`+Pl43BmsA;O~ZUyxpiRThe$7--+L9 zrRmvFp*Xsus71f41xLyEi2^C2H)?nNIXMtk|IpmTMO}Ms>}cq~kXwP7JoBGhSuW~R z9L8535?nPXv4s6woBOHJnxg?yB@KMUC1Y~_`oh}va=+rz?Y*EP%?t-$yg1D)0sp)Z zpCYJ*p&Mk}ITUNai=#Wqm-0W%hIa<e6OlZ)iycr^J>V*sn2;f>?@GT|q0N6e>)5{E zvZ?1lG<b=vem=0V<m0x>TM9HPaHNfov-thnxY;tF@Wq(5Vug})8#n!ZVP&4kcgiV( zh&vCXfR!|Zq-pY-XI$7@+~&<0B9L`U08LE0z9d<y!wC0Zqgv{4k-cpSD?xplLap&4 zV{BXvS*zKf4f_n3B$u<ciGISf!OD~ovao3td!Anc+)<B|h|K1faJ}3~Zf8jHVvJyu zflU5fm7@ID`OK_V-{NP-&V6%Th^^{`bZWJ+&{U(Zo4j88W6KavS!D6=2MLui>4SaQ z;rIX2qE=|!j&}o&+{C2+aQUSc6w#_qeg8+X=@~<heTiPdvk>p1d)X7hm^`2+Nl&FC z2dln2tx$BARCLI*s+5O9@?EEvi64hLw%7&YzVvijzJoVJR+2b~3cW2_SfBL6XZ5LT z+fZ1*fw2v0mHum7flKtZ$`E``mGU)cubEuxhaI8Sf8T0FatK~050{SHxS6G<%S*ZD z?|2}&=(X`n4TsD*T4Gb;bmj`*BJXoUt$qsr$J#go=YsKWi#Os}!9~s)lDw$pAykZM zy<9>8jFH}D%AvF;MKK&r(QA#W+AzXCe;*UdGgspEfZ-Ce+`$?Kl1x!(Ky+tuuQ0&` ziuU^7m&L4%(ek6{Jb>&$WYGOPo=Sd8maw@ALO3wT_TW$@6MuQ@tIagpRuKa$S{LHK z(frm%;V`ELwrDE#Gp&DJx8J-Us>`h#Jp?8GGsj<R+4N4=t%eSn$(`4x6RT(w!kp8U z+$MqpaFjeMMb9qFNYa558LNaY-_^f70QfbpG->R=Dw%@<-MU8o*Gh!*1^}zyei3jD zU;fAitURnUSeFqGKeKg}{!PO)+F1C0k%q$1AJ=oV6|oHQh@f8zj@n0anqQZ)u~lZ^ zuC&fdmxL=v)8N)wCNqXI$1MB2<6WzW-kMLM&R>)OdW#Sjumu|dwuDMgFG92Q42hz` z-!pn$VrGKl4$h!K{Qpev$AsU#)$SQer3a-mQTl!(y2vi<4<sSNfRq;p&s&bBAoow? zqCnyW4*wsK1=R4#^!!^F$jFLAhhk!fS^BaAVb?H*EyWT2`tFE(G4<5w7`L{}iYF!m z4LpR>!O9ZSK^=_mS~yg=IUid|$x&+ZyJjznKA6nyd&{ac!LkGGVq$G`kjGl<AdG)k z;=5bo$Hnng|FP;mrSnP96~m}(m#cECpH_v?U*wThaK7=N;e&*TTbZ|SZ04{D`W-tp z*yAt-?m9wu*fvVk!X~6}w3kK_7k(!9ShVRdr;|m(4*B%mINr(wjl^xuAa^Cu%BFht zXfyts*Y%IB-XxHw(l0E6!&4^_$JVfO@a<t|<x}4>-v-renW7bbS^O3mSqWE4+_Rz% z!PLXgd>MmcQw#C(3Gkqj(->yQQ{zT;2kFI*z0+LK4f+edk7PME03=;pDj|Cx2we;X zHeWA_3|r#z&(cz*#$~g5!@y;ShBiML)X%?y>aoiU+}(Bv%ZEX`5u4op{%~}oeMtB5 zv&08IBSGH_6h+C~_^RW77QHd<tz$u@SOq3NTaN9<qOVhY(RRA|HN%D$;42p+OE)HB zV&uPGc{gfe3g%*(+NLuj$j%7LRVuajBq1Nz>b|=0hv5q!krWIF&s9=Qt;%Hk`?G`8 z$C;5Dy`Ux`l(rSgiq0||?fnR4ElHJU8@K_UoG9o6;!hmRh&GB$(+#%Ad<}5DIp2LR zDreM%>P4{@J?j~5!l-Ut7wSZhBlA%?gA_LU*%^40yp*1QjL{7n?N$&y-AyDYNj%`k zS;O4qu<?2gbculN%PZ#5Bwv&kjDHTriD&k=kDa6Vb`lzgRYkv2;siXO^Q65*T%)6> z>)Q`6w~eJ;2i&)i4UPj?$aA6WcH`&Tp}aQk%%6hEyBwpEhaC4#OS=`Pn!Ww3Z+~=& ziUh8?|Lg1F78pm16vaSMKfn5oVsxp2azKovD@IsSnj(`?<|!hj;^fX3{5|Ctx6JUt z9&fvz-uvNYiB`?i*ngJqCbwCRCrjG4(kNm9qsLbbkty~uzLH;Cw}tlboRP!ft+<c< z#ZS7GeGDsoZ%}~sOiM!A=YiLg7CpsQ2!*2k7VpI_1pnz0?&2b%3o#m-qEAK6nDIf^ zyk@ez9qrv*JU(h7IL_kv!11F{3*WP`u~m4XbMAQRi@)I|M`H||KXHmorSSk&Wm67Z z42A7HVOTO$Zg}-|+%SUc@w?LIp4doIyv?>%SR9;uu*8fv?9ik#!I1)pRkEndZVMxa z35dbY2a3T{A%`JTPnL#c#74`p*q33^`i)=mXgZEQ?Ye86*OPa76j{c=itvYdLO@A2 z#r+=G*J|W$alUvS|5h!i5RA>U_LFEHOTylf()K)pD81+p3DJ<c^{GGN&(UC8FQ+PT zqrQ|ThUhzb>|U~7WJk<<M>M>Bwz=6}18On3>IYiN1SSc*Q|Z}wXRNLJNT)LaW*#xr z=HmsynN6rbX$sV=w&J=0l@k6K+0Al>$by)ugWEjHWl>5oT>Y|Py4*nGy`eZ-%GqOg znjz;@L~oA$_^SS&3FEzY=nrD7oX%amyl)3-Y1a;PL8(Lmf-Rn}kN<H<y2+Qw7vV&H zK((8joLz<-Q?F;cz$h!><agt%pdjV1@L*N7obO|Jk{P-E7~|~q?5{Y0wo0X+Ue9{w zJcO?t^)K!O<Eq?do4a_^%#7=ilD-Djt?t$ZPYv-H5;OPK1>jS=G}aM;(l+f0{5p8- z^FcR6&;n6GoOCj#Syk{R@mJO&nq3~N_#8}j{6@*nqN~Es)dcz5`+a1uq(RmN<B>{c z8Wa-r=^jd5tQbj3#KdG|;aKlDGQ2vPDsp($U^!gYSoGaDLSxd%`3N*K&u6o>ee%?L z+8sph+Q8F|R~JK@QY+WekA@OXIVpEUNUuM#dpbWK9I^^Kt7U26zlVh+5oXixitU*) zuS$lt9sLMIuX}_?eCQ#PKnY>ABwQ}V{`i5!XOzHNk;U)ndIq`v{seL$MT>4XBfm&+ zd0?2mZP1s%tDsx!>52xjNs0Aluq#@8zBru(_H-YdUpcfj@;-tmtUMed$B)Hd1;sG1 z<5HGxr4<4=Um9Yda?dX`Lfa-hm%qUVl>ZsO7stFaWvyM688p_yAE18t7i!1W5>!u6 zEX-8^vy%nPf=;tPpm~2&nj^=eJfkX!I>za28mmkhLdyqYX-X%i*T!#gd7how^L6uf z`i0KTK%&fGHO^*n(>>wlnkF6kvO)<O?Sr6VVBLMJXt4nZebCXYv$GOFHtXx?&sV6C zFVv?Bkj#u<J^@JSoQ!1_i=!^Q+A<E97La>ra+$HhSy8Af>`)*2f+JQ)((}vC1ahlm zvcg{c-?NHh1v4Act7^}VpE53f&wV5c&>!RYRKK?-xBu=Ldqtne$OMOQWJSl-Yy)@> z-PrcxZ{Vb%MZ<F3N|O1!HOxx<W!r_`c*n6%rSUy5EaQtw{PSpx9kD|ziWl?VjZeKr zNEj#f153L@W;J<UbG<FNjp^U_pS1#-2RhuSZ1WG8Kkpj5l8l(`u5P^s$KA$xV+#@* z;D?1Gquc-5BD9Yo!Li%?yJ0(3TaaYpS5UifLt~6^7raHPntVZvtmUMli)P&S9Ac_g zZx<#)hQ3&oTjPWudDraMr63N+HK3WeN#itfi>NLyN2D;vM`!J^xgb10mdEP2p6R1F z7gHz{Hv<e8s9jE^B;BXqpW6Ax*(K5G@prx@a<UELseHkcwY9mSSuBRW{>{5ycWG2N z6aHdMfm(ay4K%NLNehfUjVI~ln_HvonygM2MUS19$|@5+X%sim4(0I@xse1>W7u-S zj~?OhJ<IWvF=$PesX058Z!U;!wYezvt(8F!mP|K{pC;DJc!L)U;deOJyAJj%sKs|o z-fkkzBi^zmew7T|EmUB8lG%@&xohV5ScEJWx}uMoK#CKi&;Gf|D^pV-A4gXu+RD~u z%tG%oQE$^1P>GIbRILA`!Ql5UVv^jW<Ij(tR%NQN!VD6V?|&L`c39zR=z(5=GGy1L z9<i&vP<$i^-~bo<oL%(l{|u!V-Wk6_zfpKh0r-gz(An*JgeVhG`j+cdwhl@Xtp7WD zG!}dq9|YC57OYo6B-KpEToMd5(Hb-zD%iTYnYENvg`<r|<o+4WRsfAfU_GqL8mvEx zn18>YWM3=ta0CeRK6dmH{Vd65NG2ejy=j!M5LHz%gHtoNT5c)C`{@<HF#_#Ycf(u3 zER2q17lNClgzQF?aN_CqHhQnN>J|~tkNM<JFm@uMkiP8HD@?;dJmJ)07g72VmuFM? zPfk4Dl~=n*IXZV5rt>^0CLir?SmkmY1t#Y}dV@1V#Lo3-Iof0#H+v3p^va0ga(6E> zCd{Ea&YoXgqVZp~4vbe3sYg>-8iL&~rhT|7G2}Bfyu?l$Mn+~PcD!vb<wmF(usjlt zA>EDcn#4>nHR3lZ12N4zj5;oT?!trKpwYCQcdPdHC~}L;6~7`R$-cgda)fq??6p%F z4f;Lv5F_2uS60;u-pxFL>4uVciQtRtuV(ccy(b8YiIS}!w{Qh8p2%Wl9@q28u%mcN zAvOO7%ru%XYqH}tRGLU7Yg^DIvCLnavJMKO)6`@j2>$Kg)fWTLCZ<GZD5_vvf^^o@ zq`l7`&gJ=YoJq$sk9Z*%1gL?rl10ehuieS<Oll~SvV<^FeeZ2gU5xu#VI*)+4l`L} z%@K*9q=NYZ-GeWpYfQZlN$EQbg!zfaoWM5@lFZkykEI`Piyu#!@0W#??U~NHvYl~U zEwMW0KRjfe$<k+3_{S=2NPa^en+t!PO#~YJWAMhGB@oD%SX(*P#PBnh{7x7>mQ?2; z??QT27m{qjRaoU#P{BgVjnFmWR%Z@!Dv|`}sBkO|DrHEuM=E|C1_rctWPj;+c*IXR z{ROz|EGQ+Hl&o7~WrFpvhtvTH3p7s#rFWBpgjdulca*RHF&wn4?@CAgi1MbyEG}l0 zU)7&9A={z~F`h}7a#KOZQ%#KW%GO6ex3#%sUBKb4ZvnVH|07+PxO%k%jg3xJI52fe ztYZgK6(BPz*HCEMKjAaY#l01q08j&?af4KD=g4);1f>e0I}4K?tW><&idMX!78u&t zSYr;dumA~4sE99F{BJ~^t2tn^KT=c+DJ-?NXOhF;N_o)mFnz)pZ`~v(0dc?9Sac8R zl+m6{tkWVJ^)i6#pVxLnb%JC}gkBppE<swl;cm4GnAxVX<?<vJ`c#$Bfd_EbhekoB z>fA+^Qh(ge*y6|~>m&3GZc%<k(q%f78kt&GV<p-8#tZ3}&+zF-XQ;+0m3WCM(a9@} zh+lO1FzRCGtf1@mBN6#-sck9d+2PF>m;!zmL!V^Y6z+6vU9tTFV#-MmiY8QPhx!wA zyi3somxYBhRg~|q8A3)aA`TCSMaZsvfvG?R0>uVNRQr5sP*pSqQqnULjX2{wG}1A# z63P1SOxEVoaHA~w-?6K=#BY(x%S5$U>uY5zZ$RGLd{t?O!SQM)qi+bO0y%dZ?o`N_ z7A8P`%^mt`O+u%B4JSW#G`Ch@#<rmqyh4gAxp5`*kr4f$8ZA1xh4-KO*<&AZ%S))7 zI*Q+3#XF-jUrCWjlvGpD_lqy<`wAtPgzc=!?s)6?r11{yxvG=QUyYx35e;2+<8WZD zP@Fz){(e!a@cmEo07)7P-f}Dm@4``kUU#DA@RirnEquECxvx;bu+v~l#;Cb`#X~Ul z9K7CJ^6l?fs$K*Vq5-B?rsO$ZrIfKVro-e17C&?|rFsVRMoX1Kck|`@D;2c-nawcu z?`}5rr_-{rpi0to`4l+*4#DhkIN5HFFGJXS6S?EsI}6(Jf>Jmc)hjCOew0tQKe#(h z)ZD_79Vtv54LaWmeo|<|EgVlJUps~{Xa~nG_TQs1>2{-Sjfd}`$1kN;i?8lZRW7)4 zU>V2bi?0sF2Rga+hO0LZmaQB>CK}Ot>cqtTY6r2uW*rof^uUSbZldZtE^GmJ1#657 z0m6Rr3)RZuRMsTZTm?Y=_dVHCKyM)I0ww$(dnaNW)s8`28V=s!cStpZYR7-C@x<G+ zAt;%54J;K-viLE)b9~V>&CY7vZfBNfxcVWm;mXK(f>w)masVHZ|5R0xurpT98MDRn zRoRw$2OCP}2|Yq##~+UEavk*TD~%FD+X@1|!ND<<&58<9AN@4gQ19YG1lEiueQQSG z4A}hoHNc19BJmo%l-gYmg?qbI$tv?j4spu25-LG^yK`T?GSr({vEBsPX`^dss0dOm zHPS=n0c$0S;ViI3tLU=MlxRDD6HFo(@DClq5iQ{QHDji|rj~xy^ptcjChw};G=<(( zg6FHb&tl;3a%vyRx_c#;KW}dKt!~VzD(9wRPxF*_1WuFvPAv>pHKLC2eW9|_Je5Bd z;1UFpXC+;RgVrY&@bT)A)s?5xJLkUirg#6{t_!>$S!bIK@Giy9s{xe0Jy3G~3pq!S zb)Cp^_+iZDu<8+)_wxEobYy4$BL#EPg6pmsRz~T0-kv?5h4VbT5Gi+X`uY*A@YjVE ziVSp$zPg(@ydbDH#-J|PxgW+}oW9i6kB6k^^kP9+;Q8P6`|Wk$pOJyOIS2dzE$9As z%`Fc$z*+bXZUIhDuyOI$)JbpPMOGF8NpWrU_J&zTHnrbw0mhth;cO7Lk;Yy9X?Ez2 zM+kGl5IvYHZh-2ejeJw%waQXZI@I^zVFOvXVi$jEt8B+5OMW)C@A=?I-|KSV%fG;v z1Is?`w>xfaCx5QFf``}bd0frOV7{|LhfE){^7}&ii<pEzQET57_*w?1UF)eyqsTz} zIH$HMHy$Rr>^My%fLQzWAgToHTCs7>36~U@Uj+@hD=2C(_BMHTy@A`2y6e}26ZpbI zaec2dyMebqHlIGoXS*j-c098(Vm<2DjP~^waU?lhEGEk|EA<y<LM8W*dxc%3{!4Jk zBjt<)Ya4!XxrX?FEtmybvUOK^?62Xewv<G%n?y7ks`<G3YMy$!7X(p<Rvd0gEX+Ul zFP>-cKcDY9;P$ESWyEo(&+wlJn`ER0EJi)7xpI3@lO?R*t)cPwbow#Hv)=iXFl^cn z$aU6FH5EZ6sT<70poo+tWjlu>R6&OMjH#E{BQ$F5HrwCOxkf-1{+h5bTLT2ph!;bK zuEn@c`Vr0HI^*A~uIqrOs=R*(Jbi!v9b5?bs7m?aelc@Ig#<$w+Va~k@l0OgfZl$@ zPx&6h2j?S>fwF0p<&p-eb1++>f{5;5v=;K|-T?>IKXiQ>*<}y4&`!NYKkSlRfehm= zmD_1ZT>u)A{RA@`0{x+bEP1btw}9I!L;d$F&W@b=Lu4OZV2kob_wNlpu22@5Et6H; zUvWxhz;bde*tUa<%_c{-ip%Uy|KBX^d>P?Aai7~hI{~&ro5bTC2ilO5nQsPIcAStP zBwHI%{h9IK@cZ4hSZH@Z`RzX=1O~s0W9nDdx9#=g0~Jf@%k(+&=a=nF2l_Pd$gAxx zt0TuIp;M(hJ-OGz>t357nICEx;CM_?1kY{c$~(|0XWo3abh9OnEpGs}zSg_?x4HzQ zjeZjAfT}iJ(D!t?qO8{ItBCfNW6T3LhD%cLzDeWt2&L|p4XCz=$_ajX;fJN_ylzlu za4`!ej#`AA6bfyB$R#i=fR6TkpBHFrYKqmLe^Rz8bhjw)q?1-#a3EmE)Kg})*giY0 z2KEO$d`oc!q$vH$i^}VNj?}Z9wH$VKK%}dh-q?^Y?dy}Tl=Irb#YN2>us@k9^nHKm zuq`ZCl1)eSnTsJF7?fT}(V@oR9N5<q$@19jN*n}kYC|2G$mDqLxd8JTVG((*?$1x~ z-^hM@1%_J7VY~!OKmIEDXSZ*|!gXjpw7s!l4zA@ClsN}8?^seQ2~*mYk;8Eboy^p~ zuC_k!{*|w_Df^3CXp!8R>=jg>l-a3BJD*_kJJbKCIP~c0C1C>dm4n>+mBCk(CCO|& zA*UbBQOZ2#viO@}DDIMy2f=5?)@TzRq_ZugEAhIE);PC+6X7r(0?Un-il^=ej{>Vx z|4evqbIlY*y~}E^ZocT8*_wX)a)C5lZ;ol!Svq8VQCZ{~h4T|U_O1AEayH02YQGHq zs6m!sz(?hLZ!09$wMH-^74^4WGq)049lNPaFEkfha})7i&Dqit*DE;c(9!W9hjpOp z$v_w5s%*z)xPvTt<;9n6!>|Ve83XPwl5H<ZC1|@nJU39bHtgn7Uew8n4}y3f#|3bb zR1)%ps?KT#$E(i~@rwj?zKs*dXLoxsfu+0Ru3wYPbroh$vF?!mnqvlrOno_44LN;1 zvgNeF!}}F!5EZ{T1$S{rs1s6Kw~~RxXJVUKnbGJ-km!rqjor8tZy3*?JH#!3?b0cH zGL6`G@L#0L=))wObsc6qww+W*unzi7R}+sT+B;@#ae&oE57vSYrds`@un@tXUBBZT z{slA2pah#(hI-Ylc_S}mMH`}BzMRhJfA&lasQNZ}VT%HAsP=Zk6R}iwB`qdzX;9h^ zQ%Z11AN_(jlrzd{QRYTVdT>98V&d*Mj8(MDw)1vji4YM_q{b4=v5d8u64^}o6}??s zm?o%i{4H$yzYr&24@xdK1{8y_eL0_PpyW@Hwip|)KD6J`E9E{?PuQp2bj#r=4|sp2 zfTHv_h@mWUEBf}jK0O*AY23y#F05dtxZYwb#o*iL8FQm@Avq}KD)+*W5M3jJ=qSIs zRbj!?y0PoZuw}}Sw=icxg*RCd2&|{5^m5Af?wV&~Fn`NYJUbGieSQU1%3K|}Kja{+ zKo?8hy3vJ2J6iOo{WaE57shkegy#3<jLsrbXro;?VpS`i*oQ6?6ld31Cu{&B3A{+S za9Ciw(5sIh6Sua>$c||&cC}|N#3REfJF4VwNFZyNcHA9q%WufZ!d`afc5q~}mv~!o z8S`l7Hi4IwQ!&aZDkr)_Als53vE1)4f>N11FtSV-=~Z~p3TZq(MQZa$>ExZfe4Pw* z58|!+Gs}_jIA%lDqEjwnwM)r>-m9jY{h5Tx%$=*_*UF0xzK9QIvM&%$Q4iy(J6B&S z%cjDx#PwY(n&k1)CVzqU?s!`STXGGHI=n-zR<=5!UMw<mUn1>!mQ;FQ&&LSz=C!>R z(ulx?cYG63$-q4alZ&XjO6qC(5d|!50o|XMnt=+IN=g{e(pp`{@+^hy9Ia7)soeJa zMx?U9jH+YYGDe}qC#c?ylukXUKm=#~1etD;$@b=d=O2Ej`T|`loE|gF9wJvJhXM0J za~B(#Ehv>Ox4YEHiqyXXdoYIonR6M)hzfw~XrWba_-O4uHnrkl(bEW8q8*I~6u4gt zA<}$~j+wL?OKzD2qnykqFy&n=S8}{F@2fdoPJ@m#eZKzgms3-<*ZNWQ#hlEz*9rQ| zuN;kFAsi#0j!=HH4#DEIW{&hix~})gfkcVqa041ZkVc8vYW)bt3<Wbxj+Qn*ou}Hj zh;Xi^u~Nq}x<=yqGDPGIy`MSJJ%VATYbb7uXhysl&v&NRTU5-wiTKe9E#*{Ncdq@% zKQk0W&q|mVenX?A;#s#;G-Z#I>4v)(`pTuklF-$=1+)C&OrJ^!szHt)fDn9>3N;nJ zq3Q8f;;P|4zMO|v@%NZ$dSQ)7oztKt9@?&DObS(^k1&NeoKL12ppCE{{mi=gjmnT+ z<b&<yrQwVoWoMLipyCcPQcuB9NMN>yQat8Rh|$r*Aw%Z<2AN9CnM<RBeb5W`q=sRH zZ@T9(4fMki!&j1`J6Sp(juXl?^VSeF>iO+7A%J!(G_jRe-*jkdBN~V4t|=(UFZh6d z?3b7n?-qN-Jzs^dQc}pPZoXx_U;lM75s=@87shUjA-d<YDWoq7cbuX#DM<EnIS?ZO zg&xy<a_5a-Bt6q#%F_BS;vcSPjyj@yZyS&EVDN}R-e2}p3Ow!5{hye!6$d2Grt`zl z_41`;u+F`GNMQSQIExHc-Rb}KIvl(TC`&*iiZ(e^ST#AtNF;I1gZ017Q_=c~ls;0M z-k-M*dhp=2rOU=~ITLh=C<Bdh7XHh;C128fmmuHKPz#mD(uZm~wQvBv<sF6`eJr<; z<yA^Q&Do3l`)D^ftjY`jC(cYX{@wvmGr}Z??bTSxDZ$PRW}Somns%6E4wc41s3*|> z*IJ@;$@bL0>-kY1G><%<|FeWw<!qLZTVdKq{3{1n)yyLQgZNAmxbb@+!PWvUR!4y^ zWm{UG-;)8ei_chSNN0%Z`{x%)10f4PY9H&0m-^2cG+z&cODcRXWGv-jqm5i|a6ayD z>V_O7#<rIrQ1kN(GOn*>vKZ>}jb1*~3sfG?&{=oCoPw7b+t9x`<Z?s6B9kvcu{oEO ziOBp^NzB!~fq}lrykx#8x^$-{u^!$96;!J`$7CG5q?LNy!i@8($tU5p>*Mz45Rbuk zD-_N>iDk*#lZ3=qo|GdR2}7i=?$ReM%B23C3$>^ro@k>T@mdRu5<X%YeIE|mpkd%| zmohaXAM1$dD>DaZ|MS<(9j^Ng(2>^J*8NawnTm&luau)|KGVmNMUNvR?J#Goj>Z)5 zPIOKi@H_I(=b_Cvq}FrZrZRHehg|DTe7xt|MCIL3=nno9CN-i-7Wt(JKecGIG!*1U z`DzS76DH{_E8@ke`$j0g)wjemsTnW!61PBCuI{@x$2Q=veBEIZ+RvF`9OmXAkW}Xh z_v&3AsI6s+xRx+{ao*Qkx@*x_`gbx?MX}oEkd3fEEN_Ti`4vmjEpM?e4`qJUq1tu+ zRs72FgGbGvdmT)KRM1J?)?zP_;V%p^5dykH!IoFw9Gj0qX#uSnzw0Oj9SdtjkF-tq zuX%Gt?hGe?JtQJxr9+`7AyuOoYtdu54ivkpaX>r!!N0irl%gO+V3mY!=j{ojk9=`6 z<mZX48S!!vVfnlx3~#wVnPc~G6FXOiZ-OoEGVDzfVOn~kkx8Y(<&=jLjWu<JLxTA4 z+rMfKQV(eI#b5oTG4%!f*dWVfKR6M_^WxQ8nNpPF;QS0y$X`Q4sp~gUY2);V%P-E~ zbLy7NAoiFq|FR8`&EXlvc|p~MCb#n|$DOc~(u;T;Jxk$Nd)Fm@#7fPRz9mew1l@}! zv!?w4#_E4_HdxR-`dt&Pwp=IHAwQ*${M{NmN5dTJXHTKiphP0_0Yf!TG~DCQ3ZgxW zmSR&Qek8*PMA*^_^QCkG-9#5;#ov$Go7Ict5W)i8ORekt9lKN365wgLLggM(nm1Zi fw?ysAhp>JSlTg-p*74_W-2fR$1&LZQqu~Dm(wyWE literal 0 HcmV?d00001 diff --git a/utils/wxPython/tests/bitmaps/copy.bmp b/wxPython/demo/bitmaps/copy.bmp similarity index 100% rename from utils/wxPython/tests/bitmaps/copy.bmp rename to wxPython/demo/bitmaps/copy.bmp diff --git a/utils/wxPython/demo/bitmaps/image.bmp b/wxPython/demo/bitmaps/image.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/image.bmp rename to wxPython/demo/bitmaps/image.bmp diff --git a/utils/wxPython/demo/bitmaps/image.gif b/wxPython/demo/bitmaps/image.gif similarity index 100% rename from utils/wxPython/demo/bitmaps/image.gif rename to wxPython/demo/bitmaps/image.gif diff --git a/utils/wxPython/demo/bitmaps/image.jpg b/wxPython/demo/bitmaps/image.jpg similarity index 100% rename from utils/wxPython/demo/bitmaps/image.jpg rename to wxPython/demo/bitmaps/image.jpg diff --git a/utils/wxPython/demo/bitmaps/image.png b/wxPython/demo/bitmaps/image.png similarity index 100% rename from utils/wxPython/demo/bitmaps/image.png rename to wxPython/demo/bitmaps/image.png diff --git a/utils/wxPython/demo/bitmaps/lb1.bmp b/wxPython/demo/bitmaps/lb1.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/lb1.bmp rename to wxPython/demo/bitmaps/lb1.bmp diff --git a/utils/wxPython/demo/bitmaps/lb2.bmp b/wxPython/demo/bitmaps/lb2.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/lb2.bmp rename to wxPython/demo/bitmaps/lb2.bmp diff --git a/utils/wxPython/tests/bitmaps/mondrian.ico b/wxPython/demo/bitmaps/mondrian.ico similarity index 100% rename from utils/wxPython/tests/bitmaps/mondrian.ico rename to wxPython/demo/bitmaps/mondrian.ico diff --git a/utils/wxPython/tests/bitmaps/new.bmp b/wxPython/demo/bitmaps/new.bmp similarity index 100% rename from utils/wxPython/tests/bitmaps/new.bmp rename to wxPython/demo/bitmaps/new.bmp diff --git a/utils/wxPython/demo/bitmaps/open.bmp b/wxPython/demo/bitmaps/open.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/open.bmp rename to wxPython/demo/bitmaps/open.bmp diff --git a/utils/wxPython/tests/bitmaps/paste.bmp b/wxPython/demo/bitmaps/paste.bmp similarity index 100% rename from utils/wxPython/tests/bitmaps/paste.bmp rename to wxPython/demo/bitmaps/paste.bmp diff --git a/utils/wxPython/demo/bitmaps/smiles.bmp b/wxPython/demo/bitmaps/smiles.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/smiles.bmp rename to wxPython/demo/bitmaps/smiles.bmp diff --git a/utils/wxPython/demo/bitmaps/smiles.ico b/wxPython/demo/bitmaps/smiles.ico similarity index 100% rename from utils/wxPython/demo/bitmaps/smiles.ico rename to wxPython/demo/bitmaps/smiles.ico diff --git a/utils/wxPython/demo/bitmaps/splash.gif b/wxPython/demo/bitmaps/splash.gif similarity index 100% rename from utils/wxPython/demo/bitmaps/splash.gif rename to wxPython/demo/bitmaps/splash.gif diff --git a/utils/wxPython/demo/bitmaps/test2.bmp b/wxPython/demo/bitmaps/test2.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/test2.bmp rename to wxPython/demo/bitmaps/test2.bmp diff --git a/utils/wxPython/demo/bitmaps/test_image.png b/wxPython/demo/bitmaps/test_image.png similarity index 100% rename from utils/wxPython/demo/bitmaps/test_image.png rename to wxPython/demo/bitmaps/test_image.png diff --git a/utils/wxPython/demo/bitmaps/test_mask.bmp b/wxPython/demo/bitmaps/test_mask.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/test_mask.bmp rename to wxPython/demo/bitmaps/test_mask.bmp diff --git a/utils/wxPython/demo/bitmaps/tog1.bmp b/wxPython/demo/bitmaps/tog1.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/tog1.bmp rename to wxPython/demo/bitmaps/tog1.bmp diff --git a/utils/wxPython/demo/bitmaps/tog2.bmp b/wxPython/demo/bitmaps/tog2.bmp similarity index 100% rename from utils/wxPython/demo/bitmaps/tog2.bmp rename to wxPython/demo/bitmaps/tog2.bmp diff --git a/wxPython/demo/data/.cvsignore b/wxPython/demo/data/.cvsignore new file mode 100644 index 0000000000..bf39d8ec3b --- /dev/null +++ b/wxPython/demo/data/.cvsignore @@ -0,0 +1,2 @@ +golf.pdf +showTips diff --git a/wxPython/demo/data/grid.i b/wxPython/demo/data/grid.i new file mode 100644 index 0000000000..0d874ba22b --- /dev/null +++ b/wxPython/demo/data/grid.i @@ -0,0 +1,1749 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: grid.i +// Purpose: SWIG definitions for the new wxGrid and related classes +// +// Author: Robin Dunn +// +// Created: 17-March-2000 +// RCS-ID: $Id$ +// Copyright: (c) 1998 by Total Control Software +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +%module grid + +#ifndef OLD_GRID + +%{ +#include "helpers.h" +#include <wx/grid.h> +%} + +//---------------------------------------------------------------------- + +%include typemaps.i +%include my_typemaps.i + +// Import some definitions of other classes, etc. +%import _defs.i +%import misc.i +%import gdi.i +%import windows.i +%import controls.i +%import events.i + +%pragma(python) code = "import wx" + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +// Macros, similar to what's in helpers.h, to aid in the creation of +// virtual methods that are able to make callbacks to Python. Many of these +// are specific to wxGrid and so are kept here to reduce the mess in helpers.h +// a bit. + + +%{ +#define PYCALLBACK_GCA_INTINT(PCLASS, CBNAME) \ + wxGridCellAttr* CBNAME(int a, int b) { \ + wxGridCellAttr* rval = NULL; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) { \ + PyObject* ro; \ + wxGridCellAttr* ptr; \ + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", a, b)); \ + if (ro) { \ + if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellAttr_p")) \ + rval = ptr; \ + Py_DECREF(ro); \ + } \ + } \ + else \ + rval = PCLASS::CBNAME(a, b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + wxGridCellAttr *base_##CBNAME(int a, int b) { \ + return PCLASS::CBNAME(a, b); \ + } + + + +#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \ + void CBNAME(wxGridCellAttr *attr, int a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback( \ + Py_BuildValue("(Oii)", \ + wxPyConstructObject((void*)attr, "_wxGridCellAttr_p"), \ + a, b)); \ + else \ + PCLASS::CBNAME(attr, a, b); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(wxGridCellAttr *attr, int a, int b) { \ + PCLASS::CBNAME(attr, a, b); \ + } + + + +#define PYCALLBACK__GCAINT(PCLASS, CBNAME) \ + void CBNAME(wxGridCellAttr *attr, int val) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback( \ + Py_BuildValue("(Oi)", \ + wxPyConstructObject((void*)attr, "_wxGridCellAttr_p"), \ + val)); \ + else \ + PCLASS::CBNAME(attr, val); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(wxGridCellAttr *attr, int val) { \ + PCLASS::CBNAME(attr, val); \ + } + + + +#define PYCALLBACK_INT__pure(CBNAME) \ + int CBNAME() { \ + bool doSave = wxPyRestoreThread(); \ + int rval = 0; \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("()")); \ + wxPySaveThread(doSave); \ + return rval; \ + } + + + +#define PYCALLBACK_BOOL_INTINT_pure(CBNAME) \ + bool CBNAME(int a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + bool rval = 0; \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(ii)",a,b)); \ + wxPySaveThread(doSave); \ + return rval; \ + } + + + +#define PYCALLBACK_STRING_INTINT_pure(CBNAME) \ + wxString CBNAME(int a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + wxString rval; \ + if (m_myInst.findCallback(#CBNAME)) { \ + PyObject* ro; \ + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + if (ro) { \ + rval = PyString_AsString(PyObject_Str(ro)); \ + Py_DECREF(ro); \ + } \ + } \ + wxPySaveThread(doSave); \ + return rval; \ + } + + + +#define PYCALLBACK__INTINTSTRING_pure(CBNAME) \ + void CBNAME(int a, int b, const wxString& c) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(iis)",a,b,c.c_str())); \ + wxPySaveThread(doSave); \ + } + + +#define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \ + wxString CBNAME(int a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + wxString rval; \ + if (m_myInst.findCallback(#CBNAME)) { \ + PyObject* ro; \ + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + if (ro) { \ + rval = PyString_AsString(PyObject_Str(ro)); \ + Py_DECREF(ro); \ + } \ + } else \ + rval = PCLASS::CBNAME(a, b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + wxString base_##CBNAME(int a, int b) { \ + return PCLASS::CBNAME(a, b); \ + } + + + +#define PYCALLBACK_BOOL_INTINTSTRING(PCLASS, CBNAME) \ + bool CBNAME(int a, int b, const wxString& c) { \ + bool rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(iis)", a,b,c.c_str())); \ + else \ + rval = PCLASS::CBNAME(a,b,c); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + bool base_##CBNAME(int a, int b, const wxString& c) { \ + return PCLASS::CBNAME(a,b,c); \ + } + + + + +#define PYCALLBACK_LONG_INTINT(PCLASS, CBNAME) \ + long CBNAME(int a, int b) { \ + long rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + else \ + rval = PCLASS::CBNAME(a,b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + long base_##CBNAME(int a, int b) { \ + return PCLASS::CBNAME(a,b); \ + } + + + +#define PYCALLBACK_BOOL_INTINT(PCLASS, CBNAME) \ + bool CBNAME(int a, int b) { \ + bool rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + else \ + rval = PCLASS::CBNAME(a,b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + bool base_##CBNAME(int a, int b) { \ + return PCLASS::CBNAME(a,b); \ + } + + + +#define PYCALLBACK_DOUBLE_INTINT(PCLASS, CBNAME) \ + double CBNAME(int a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + double rval; \ + if (m_myInst.findCallback(#CBNAME)) { \ + PyObject* ro; \ + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + if (ro) { \ + rval = PyFloat_AsDouble(PyObject_Str(ro)); \ + Py_DECREF(ro); \ + } \ + } else \ + rval = PCLASS::CBNAME(a, b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + double base_##CBNAME(int a, int b) { \ + return PCLASS::CBNAME(a, b); \ + } + + + +#define PYCALLBACK__(PCLASS, CBNAME) \ + void CBNAME() { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("()")); \ + else \ + PCLASS::CBNAME(); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME() { \ + PCLASS::CBNAME(); \ + } + + + + +#define PYCALLBACK_BOOL_SIZETSIZET(PCLASS, CBNAME) \ + bool CBNAME(size_t a, size_t b) { \ + bool rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + else \ + rval = PCLASS::CBNAME(a,b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + bool base_##CBNAME(size_t a, size_t b) { \ + return PCLASS::CBNAME(a,b); \ + } + + + +#define PYCALLBACK_BOOL_SIZET(PCLASS, CBNAME) \ + bool CBNAME(size_t a) { \ + bool rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(i)", a)); \ + else \ + rval = PCLASS::CBNAME(a); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + bool base_##CBNAME(size_t a) { \ + return PCLASS::CBNAME(a); \ + } + + + +#define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \ + wxString CBNAME(int a) { \ + bool doSave = wxPyRestoreThread(); \ + wxString rval; \ + if (m_myInst.findCallback(#CBNAME)) { \ + PyObject* ro; \ + ro = m_myInst.callCallbackObj(Py_BuildValue("(i)",a)); \ + if (ro) { \ + rval = PyString_AsString(PyObject_Str(ro)); \ + Py_DECREF(ro); \ + } \ + } else \ + rval = PCLASS::CBNAME(a); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + wxString base_##CBNAME(int a) { \ + return PCLASS::CBNAME(a); \ + } + + + +#define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \ + void CBNAME(int a, const wxString& c) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(is)", a,c.c_str())); \ + else \ + PCLASS::CBNAME(a,c); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(int a, const wxString& c) { \ + PCLASS::CBNAME(a,c); \ + } + + + + +#define PYCALLBACK_BOOL_(PCLASS, CBNAME) \ + bool CBNAME() { \ + bool rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("()")); \ + else \ + rval = PCLASS::CBNAME(); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + bool base_##CBNAME() { \ + return PCLASS::CBNAME(); \ + } + + + +#define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \ + void CBNAME(size_t a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + else \ + PCLASS::CBNAME(a,b); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(size_t a, int b) { \ + PCLASS::CBNAME(a,b); \ + } + + + + +#define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \ + void CBNAME(int a, int b, long c) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(iii)", a,b,c)); \ + else \ + PCLASS::CBNAME(a,b,c); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(int a, int b, long c) { \ + PCLASS::CBNAME(a,b,c); \ + } + + + + +#define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \ + void CBNAME(int a, int b, double c) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(iif)", a,b,c)); \ + else \ + PCLASS::CBNAME(a,b,c); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(int a, int b, double c) { \ + PCLASS::CBNAME(a,b,c); \ + } + + + +#define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \ + void CBNAME(int a, int b, bool c) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(iii)", a,b,c)); \ + else \ + PCLASS::CBNAME(a,b,c); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(int a, int b, bool c) { \ + PCLASS::CBNAME(a,b,c); \ + } + + + + +%} + +//--------------------------------------------------------------------------- + +class wxGridCellCoords; +class wxGridCellAttr; + + + +#define wxGRID_VALUE_STRING "string" +#define wxGRID_VALUE_BOOL "bool" +#define wxGRID_VALUE_NUMBER "long" +#define wxGRID_VALUE_FLOAT "double" +#define wxGRID_VALUE_CHOICE "choice" +#define wxGRID_VALUE_TEXT "string" +#define wxGRID_VALUE_LONG "long" + +%readonly +wxGridCellCoords wxGridNoCellCoords; +wxRect wxGridNoCellRect; +%readwrite + + +//--------------------------------------------------------------------------- +// wxGridCellRenderer is an ABC, and several derived classes are available. +// Classes implemented in Python should be derived from wxPyGridCellRenderer. + + +class wxGridCellRenderer +{ +public: + void SetParameters(const wxString& params); + + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) = 0; + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) = 0; + virtual wxGridCellRenderer *Clone() const = 0; +}; + + +// The C++ version of wxPyGridCellRenderer +%{ +class wxPyGridCellRenderer : public wxGridCellRenderer +{ +public: + wxPyGridCellRenderer() : wxGridCellRenderer() {}; + + // Implement Python callback aware virtual methods + void Draw(wxGrid& grid, wxGridCellAttr& attr, + wxDC& dc, const wxRect& rect, + int row, int col, bool isSelected) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("Draw")) { + m_myInst.callCallback( + Py_BuildValue("(OOOOiii)", + wxPyConstructObject((void*)&grid, "wxGrid"), + wxPyConstructObject((void*)&attr, "wxGridCellAttr"), + wxPyConstructObject((void*)&dc, "wxDC"), + wxPyConstructObject((void*)&rect, "wxRect"), + row, col, isSelected)); + } + wxPySaveThread(doSave); + } + + wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, + int row, int col) { + wxSize rval; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetBestSize")) { + PyObject* ro; + wxSize* ptr; + ro = m_myInst.callCallbackObj( + Py_BuildValue("(OOOii)", + wxPyConstructObject((void*)&grid, "wxGrid"), + wxPyConstructObject((void*)&attr, "wxGridCellAttr"), + wxPyConstructObject((void*)&dc, "wxDC"), + row, col)); + if (ro) { + if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) + rval = *ptr; + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + + wxGridCellRenderer *Clone() const { + wxGridCellRenderer* rval = NULL; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("Clone")) { + PyObject* ro; + wxGridCellRenderer* ptr; + ro = m_myInst.callCallbackObj(Py_BuildValue("()")); + if (ro) { + if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellRenderer_p")) + rval = ptr; + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + DEC_PYCALLBACK__STRING(SetParameters); + + PYPRIVATE; +}; + +IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters); + +%} + + +// Let SWIG know about it so it can create the Python version +class wxPyGridCellRenderer : public wxGridCellRenderer { +public: + wxPyGridCellRenderer(); + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellRenderer)" + + void base_SetParameters(const wxString& params); +}; + +//--------------------------------------------------------------------------- +// Predefined Renderers + +class wxGridCellStringRenderer : public wxGridCellRenderer +{ +public: + wxGridCellStringRenderer(); +}; + + +class wxGridCellNumberRenderer : public wxGridCellStringRenderer +{ +public: + wxGridCellNumberRenderer(); +}; + + +class wxGridCellFloatRenderer : public wxGridCellStringRenderer +{ +public: + wxGridCellFloatRenderer(int width = -1, int precision = -1); + + int GetWidth() const; + void SetWidth(int width); + int GetPrecision() const; + void SetPrecision(int precision); +}; + + +class wxGridCellBoolRenderer : public wxGridCellRenderer +{ +public: + wxGridCellBoolRenderer(); +}; + + + +//--------------------------------------------------------------------------- +// wxGridCellEditor is an ABC, and several derived classes are available. +// Classes implemented in Python should be derived from wxPyGridCellEditor. + +class wxGridCellEditor +{ +public: + bool IsCreated(); + wxControl* GetControl(); + void SetControl(wxControl* control); + + void SetParameters(const wxString& params); + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) = 0; + virtual void BeginEdit(int row, int col, wxGrid* grid) = 0; + virtual bool EndEdit(int row, int col, wxGrid* grid) = 0; + virtual void Reset() = 0; + virtual wxGridCellEditor *Clone() const = 0; + + virtual void SetSize(const wxRect& rect); + virtual void Show(bool show, wxGridCellAttr *attr = NULL); + virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + virtual void StartingKey(wxKeyEvent& event); + virtual void StartingClick(); + virtual void HandleReturn(wxKeyEvent& event); + virtual void Destroy(); + +}; + + +// The C++ version of wxPyGridCellEditor +%{ +class wxPyGridCellEditor : public wxGridCellEditor +{ +public: + wxPyGridCellEditor() : wxGridCellEditor() {} + + void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("Create")) { + m_myInst.callCallback( + Py_BuildValue("(OiO)", + wxPyConstructObject((void*)parent, "wxWindow"), + id, + wxPyConstructObject((void*)evtHandler, "wxEvtHandler"))); + } + wxPySaveThread(doSave); + } + + + void BeginEdit(int row, int col, wxGrid* grid) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("BeginEdit")) { + m_myInst.callCallback( + Py_BuildValue("(iiO)", row, col, + wxPyConstructObject((void*)grid, "wxGrid"))); + } + wxPySaveThread(doSave); + } + + + bool EndEdit(int row, int col, wxGrid* grid) { + bool rv = FALSE; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("EndEdit")) { + rv = m_myInst.callCallback( + Py_BuildValue("(iiO)", row, col, + wxPyConstructObject((void*)grid, "wxGrid"))); + } + wxPySaveThread(doSave); + return rv; + } + + + wxGridCellEditor *Clone() const { + wxGridCellEditor* rval = NULL; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("Clone")) { + PyObject* ro; + wxGridCellEditor* ptr; + ro = m_myInst.callCallbackObj(Py_BuildValue("()")); + if (ro) { + if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellEditor_p")) + rval = ptr; + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + + void Show(bool show, wxGridCellAttr *attr) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("Show")) + m_myInst.callCallback( + Py_BuildValue("(iO)", show, + wxPyConstructObject((void*)attr, "_wxGridCellAttr_p"))); + else + wxGridCellEditor::Show(show, attr); + wxPySaveThread(doSave); + } + void base_Show(bool show, wxGridCellAttr *attr) { + wxGridCellEditor::Show(show, attr); + } + + + void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("PaintBackground")) + m_myInst.callCallback( + Py_BuildValue("(OO)", + wxPyConstructObject((void*)&rectCell, "_wxRect_p"), + wxPyConstructObject((void*)attr, "_wxGridCellAttr_p"))); + else + wxGridCellEditor::PaintBackground(rectCell, attr); + wxPySaveThread(doSave); + } + void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { + wxGridCellEditor::PaintBackground(rectCell, attr); + } + + + DEC_PYCALLBACK___pure(Reset); + DEC_PYCALLBACK__constany(SetSize, wxRect); + DEC_PYCALLBACK__any(StartingKey, wxKeyEvent); + DEC_PYCALLBACK__any(HandleReturn, wxKeyEvent); + DEC_PYCALLBACK__(StartingClick); + DEC_PYCALLBACK__(Destroy); + DEC_PYCALLBACK__STRING(SetParameters); + + PYPRIVATE; +}; + + +IMP_PYCALLBACK__STRING( wxPyGridCellEditor, wxGridCellEditor, SetParameters); +IMP_PYCALLBACK___pure(wxPyGridCellEditor, wxGridCellEditor, Reset); +IMP_PYCALLBACK__constany(wxPyGridCellEditor, wxGridCellEditor, SetSize, wxRect); +IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, StartingKey, wxKeyEvent); +IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, HandleReturn, wxKeyEvent); +IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, StartingClick); +IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, Destroy); + +%} + + +// Let SWIG know about it so it can create the Python version +class wxPyGridCellEditor : public wxGridCellEditor { +public: + wxPyGridCellEditor(); + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellEditor)" + + void base_SetSize(const wxRect& rect); + void base_Show(bool show, wxGridCellAttr *attr = NULL); + void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + void base_StartingKey(wxKeyEvent& event); + void base_StartingClick(); + void base_HandleReturn(wxKeyEvent& event); + void base_Destroy(); + void base_SetParameters(const wxString& params); +}; + +//--------------------------------------------------------------------------- +// Predefined Editors + +class wxGridCellTextEditor : public wxGridCellEditor +{ +public: + wxGridCellTextEditor(); +}; + + +class wxGridCellNumberEditor : public wxGridCellTextEditor +{ +public: + wxGridCellNumberEditor(int min = -1, int max = -1); +}; + + +class wxGridCellFloatEditor : public wxGridCellTextEditor +{ +public: + wxGridCellFloatEditor(); +}; + + +class wxGridCellBoolEditor : public wxGridCellEditor +{ +public: + wxGridCellBoolEditor(); +}; + +class wxGridCellChoiceEditor : public wxGridCellEditor +{ +public: + wxGridCellChoiceEditor(int LCOUNT = 0, + const wxString* choices = NULL, + bool allowOthers = FALSE); +#ifdef PRE2115 + %addmethods { + wxGridCellChoiceEditor(PyObject* choices, + bool allowOthers = FALSE) { + + const char** temp = string_LIST_helper(choices); + if (temp) { + int count = PyList_Size(choices); + wxGridCellChoiceEditor* ret; + ret = new wxGridCellChoiceEditor(count, temp, allowOthers); + delete [] temp; + return ret; + } + return NULL; + } + } +#endif +}; + +//--------------------------------------------------------------------------- + + +class wxGridCellAttr +{ +public: + wxGridCellAttr(); + + wxGridCellAttr *Clone() const; + void IncRef(); + void DecRef(); + void SetTextColour(const wxColour& colText); + void SetBackgroundColour(const wxColour& colBack); + void SetFont(const wxFont& font); + void SetAlignment(int hAlign, int vAlign); + void SetReadOnly(bool isReadOnly = TRUE); + + void SetRenderer(wxGridCellRenderer *renderer); + void SetEditor(wxGridCellEditor* editor); + + bool HasTextColour() const; + bool HasBackgroundColour() const; + bool HasFont() const; + bool HasAlignment() const; + bool HasRenderer() const; + bool HasEditor() const; + + const wxColour& GetTextColour() const; + const wxColour& GetBackgroundColour() const; + const wxFont& GetFont() const; + void GetAlignment(int *OUTPUT, int *OUTPUT) const; + wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const; + wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const; + + bool IsReadOnly() const; + void SetDefAttr(wxGridCellAttr* defAttr); +}; + +//--------------------------------------------------------------------------- + +class wxGridCellAttrProvider +{ +public: + wxGridCellAttrProvider(); + // ???? virtual ~wxGridCellAttrProvider(); + + wxGridCellAttr *GetAttr(int row, int col) const; + void SetAttr(wxGridCellAttr *attr, int row, int col); + void SetRowAttr(wxGridCellAttr *attr, int row); + void SetColAttr(wxGridCellAttr *attr, int col); + + void UpdateAttrRows( size_t pos, int numRows ); + void UpdateAttrCols( size_t pos, int numCols ); + +}; + + +// A Python-aware version +%{ +class wxPyGridCellAttrProvider : public wxGridCellAttrProvider +{ +public: + wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {}; + + PYCALLBACK_GCA_INTINT(wxGridCellAttrProvider, GetAttr); + PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr); + PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr); + PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr); + + PYPRIVATE; +}; +%} + + +// The python-aware version get's SWIGified +class wxPyGridCellAttrProvider : public wxGridCellAttrProvider +{ +public: + wxPyGridCellAttrProvider(); + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellAttrProvider)" + + wxGridCellAttr *base_GetAttr(int row, int col); + void base_SetAttr(wxGridCellAttr *attr, int row, int col); + void base_SetRowAttr(wxGridCellAttr *attr, int row); + void base_SetColAttr(wxGridCellAttr *attr, int col); +}; + + +//--------------------------------------------------------------------------- +// Grid Table Base class and Python aware version + + + +class wxGridTableBase +{ +public: + // wxGridTableBase(); This is an ABC + //~wxGridTableBase(); + + void SetAttrProvider(wxGridCellAttrProvider *attrProvider); + wxGridCellAttrProvider *GetAttrProvider() const; + void SetView( wxGrid *grid ); + wxGrid * GetView() const; + + + // pure virtuals + virtual int GetNumberRows() = 0; + virtual int GetNumberCols() = 0; + virtual bool IsEmptyCell( int row, int col ) = 0; + virtual wxString GetValue( int row, int col ) = 0; + virtual void SetValue( int row, int col, const wxString& value ) = 0; + + // virtuals overridable in wxPyGridTableBase + virtual wxString GetTypeName( int row, int col ); + virtual bool CanGetValueAs( int row, int col, const wxString& typeName ); + virtual bool CanSetValueAs( int row, int col, const wxString& typeName ); + virtual long GetValueAsLong( int row, int col ); + virtual double GetValueAsDouble( int row, int col ); + virtual bool GetValueAsBool( int row, int col ); + virtual void SetValueAsLong( int row, int col, long value ); + virtual void SetValueAsDouble( int row, int col, double value ); + virtual void SetValueAsBool( int row, int col, bool value ); + + //virtual void* GetValueAsCustom( int row, int col, const wxString& typeName ); + //virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value ); + + + virtual void Clear(); + virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 ); + virtual bool AppendRows( size_t numRows = 1 ); + virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); + virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 ); + virtual bool AppendCols( size_t numCols = 1 ); + virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); + + virtual wxString GetRowLabelValue( int row ); + virtual wxString GetColLabelValue( int col ); + virtual void SetRowLabelValue( int row, const wxString& value ); + virtual void SetColLabelValue( int col, const wxString& value ); + + virtual bool CanHaveAttributes(); + + virtual wxGridCellAttr *GetAttr( int row, int col ); + virtual void SetAttr(wxGridCellAttr* attr, int row, int col); + virtual void SetRowAttr(wxGridCellAttr *attr, int row); + virtual void SetColAttr(wxGridCellAttr *attr, int col); + +}; + + + +// Python-aware version +%{ +class wxPyGridTableBase : public wxGridTableBase +{ +public: + wxPyGridTableBase() : wxGridTableBase() {} + + PYCALLBACK_INT__pure(GetNumberRows); + PYCALLBACK_INT__pure(GetNumberCols); + PYCALLBACK_BOOL_INTINT_pure(IsEmptyCell); + PYCALLBACK_STRING_INTINT(wxGridTableBase, GetTypeName); + PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanGetValueAs); + PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanSetValueAs); + PYCALLBACK__(wxGridTableBase, Clear); + PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertRows); + PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteRows); + PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertCols); + PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteCols); + PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendRows); + PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendCols); + PYCALLBACK_STRING_INT(wxGridTableBase, GetRowLabelValue); + PYCALLBACK_STRING_INT(wxGridTableBase, GetColLabelValue); + PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue); + PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue); + PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes); + PYCALLBACK_GCA_INTINT(wxGridTableBase, GetAttr); + PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr); + PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr); + PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr); + + + + wxString GetValue(int row, int col) { + bool doSave = wxPyRestoreThread(); + wxString rval; + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",row,col)); + if (ro) { + rval = PyString_AsString(PyObject_Str(ro)); + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + void SetValue(int row, int col, const wxString& val) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) + m_myInst.callCallback(Py_BuildValue("(iis)",row,col,val.c_str())); + wxPySaveThread(doSave); + } + + + // Map the Get/Set methods for the standard non-string types to + // the GetValue and SetValue python methods. + long GetValueAsLong( int row, int col ) { + long rval = 0; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + PyObject* num; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + if (ro && PyNumber_Check(ro)) { + num = PyNumber_Int(ro); + if (num) { + rval = PyInt_AsLong(num); + Py_DECREF(num); + } + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + double GetValueAsDouble( int row, int col ) { + double rval = 0.0; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + PyObject* num; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + if (ro && PyNumber_Check(ro)) { + num = PyNumber_Float(ro); + if (num) { + rval = PyFloat_AsDouble(num); + Py_DECREF(num); + } + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + bool GetValueAsBool( int row, int col ) { + return (bool)GetValueAsLong(row, col); + } + + void SetValueAsLong( int row, int col, long value ) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) { + m_myInst.callCallback(Py_BuildValue("(iii)", row, col, value)); + } + wxPySaveThread(doSave); + } + + void SetValueAsDouble( int row, int col, double value ) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) { + m_myInst.callCallback(Py_BuildValue("(iid)", row, col, value)); + } + wxPySaveThread(doSave); + } + + void SetValueAsBool( int row, int col, bool value ) { + SetValueAsLong( row, col, (long)value ); + } + + + PYPRIVATE; +}; +%} + + +// The python-aware version get's SWIGified +class wxPyGridTableBase : public wxGridTableBase +{ +public: + wxPyGridTableBase(); + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridTableBase)" + + %addmethods { void Destroy() { delete self; } } + + wxString base_GetTypeName( int row, int col ); + bool base_CanGetValueAs( int row, int col, const wxString& typeName ); + bool base_CanSetValueAs( int row, int col, const wxString& typeName ); + void base_Clear(); + bool base_InsertRows( size_t pos = 0, size_t numRows = 1 ); + bool base_AppendRows( size_t numRows = 1 ); + bool base_DeleteRows( size_t pos = 0, size_t numRows = 1 ); + bool base_InsertCols( size_t pos = 0, size_t numCols = 1 ); + bool base_AppendCols( size_t numCols = 1 ); + bool base_DeleteCols( size_t pos = 0, size_t numCols = 1 ); + wxString base_GetRowLabelValue( int row ); + wxString base_GetColLabelValue( int col ); + void base_SetRowLabelValue( int row, const wxString& value ); + void base_SetColLabelValue( int col, const wxString& value ); + bool base_CanHaveAttributes(); + wxGridCellAttr *base_GetAttr( int row, int col ); + void base_SetAttr(wxGridCellAttr* attr, int row, int col); + void base_SetRowAttr(wxGridCellAttr *attr, int row); + void base_SetColAttr(wxGridCellAttr *attr, int col); +}; + + +//--------------------------------------------------------------------------- +// Predefined Tables + +class wxGridStringTable : public wxGridTableBase +{ +public: + wxGridStringTable( int numRows=0, int numCols=0 ); +}; + +//--------------------------------------------------------------------------- +// The Table can pass messages to the grid to tell it to update itself if +// something has changed. + +enum wxGridTableRequest +{ + wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000, + wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES, + wxGRIDTABLE_NOTIFY_ROWS_INSERTED, + wxGRIDTABLE_NOTIFY_ROWS_APPENDED, + wxGRIDTABLE_NOTIFY_ROWS_DELETED, + wxGRIDTABLE_NOTIFY_COLS_INSERTED, + wxGRIDTABLE_NOTIFY_COLS_APPENDED, + wxGRIDTABLE_NOTIFY_COLS_DELETED +}; + + +class wxGridTableMessage +{ +public: + wxGridTableMessage( wxGridTableBase *table, int id, + int comInt1 = -1, + int comInt2 = -1 ); + ~wxGridTableMessage(); + + void SetTableObject( wxGridTableBase *table ); + wxGridTableBase * GetTableObject() const; + void SetId( int id ); + int GetId(); + void SetCommandInt( int comInt1 ); + int GetCommandInt(); + void SetCommandInt2( int comInt2 ); + int GetCommandInt2(); +}; + + +//--------------------------------------------------------------------------- + +class wxGridCellCoords +{ +public: + wxGridCellCoords( int r=-1, int c=-1 ); + ~wxGridCellCoords(); + + int GetRow() const { return m_row; } + void SetRow( int n ) { m_row = n; } + int GetCol() const { return m_col; } + void SetCol( int n ) { m_col = n; } + void Set( int row, int col ) { m_row = row; m_col = col; } + + %addmethods { + PyObject* asTuple() { + PyObject* tup = PyTuple_New(2); + PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow())); + PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol())); + return tup; + } + + int __cmp__( const wxGridCellCoords& other ) { + return *self != other; + } + } + %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())" + %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())" +}; + +// Typemap to allow conversion of sequence objects to wxGridCellCoords... +%typemap(python,in) wxGridCellCoords& (wxGridCellCoords temp) { + $target = &temp; + if (! wxGridCellCoords_helper($source, &$target)) + return NULL; +} + +// ...and here is the associated helper. +%{ +bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) { + + // If source is an object instance then it may already be the right type + if (PyInstance_Check(source)) { + wxGridCellCoords* ptr; + if (SWIG_GetPtrObj(source, (void **)&ptr, "_wxGridCellCoords_p")) + goto error; + *obj = ptr; + return TRUE; + } + // otherwise a 2-tuple of integers is expected + else if (PySequence_Check(source) && PyObject_Length(source) == 2) { + PyObject* o1 = PySequence_GetItem(source, 0); + PyObject* o2 = PySequence_GetItem(source, 1); + **obj = wxGridCellCoords(PyInt_AsLong(o1), PyInt_AsLong(o2)); + return TRUE; + } + + error: + PyErr_SetString(PyExc_TypeError, "Expected a 2-tuple of integers or a wxGridCellCoords object."); + return FALSE; +} +%} + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +// The grid itself + + +// Fool SWIG into treating this enum as an int +typedef int WXGRIDSELECTIONMODES; + +// but let the C++ code know what it really is. +%{ +typedef wxGrid::wxGridSelectionModes WXGRIDSELECTIONMODES; +%} + + + +class wxGrid : public wxScrolledWindow +{ +public: + wxGrid( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxWANTS_CHARS, + const char* name = wxPanelNameStr ); + + //~wxGrid(); + + enum wxGridSelectionModes {wxGridSelectCells, + wxGridSelectRows, + wxGridSelectColumns}; + + bool CreateGrid( int numRows, int numCols, + WXGRIDSELECTIONMODES selmode = wxGrid::wxGridSelectCells ); + void SetSelectionMode(WXGRIDSELECTIONMODES selmode); + + + // ------ grid dimensions + // + int GetNumberRows(); + int GetNumberCols(); + + + // ------ display update functions + // + void CalcRowLabelsExposed( wxRegion& reg ); + + void CalcColLabelsExposed( wxRegion& reg ); + void CalcCellsExposed( wxRegion& reg ); + + +#ifdef NOTNEEDED // ???? + // ------ event handlers + // + void ProcessRowLabelMouseEvent( wxMouseEvent& event ); + void ProcessColLabelMouseEvent( wxMouseEvent& event ); + void ProcessCornerLabelMouseEvent( wxMouseEvent& event ); + void ProcessGridCellMouseEvent( wxMouseEvent& event ); + void DoEndDragResizeRow(); + void DoEndDragResizeCol(); +#endif + + bool ProcessTableMessage( wxGridTableMessage& ); + + + wxGridTableBase * GetTable() const; + bool SetTable( wxGridTableBase *table, bool takeOwnership=FALSE, + WXGRIDSELECTIONMODES selmode = + wxGrid::wxGridSelectCells ); + + void ClearGrid(); + bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=TRUE ); + bool AppendRows( int numRows = 1, bool updateLabels=TRUE ); + bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels=TRUE ); + bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels=TRUE ); + bool AppendCols( int numCols = 1, bool updateLabels=TRUE ); + bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=TRUE ); + +#ifdef NOTNEEDED // ???? + void DrawGridCellArea( wxDC& dc ); + void DrawGridSpace( wxDC& dc ); + void DrawCellBorder( wxDC& dc, const wxGridCellCoords& ); + void DrawAllGridLines( wxDC& dc, const wxRegion & reg ); + void DrawCell( wxDC& dc, const wxGridCellCoords& ); + void DrawHighlight(wxDC& dc); +#endif + + // this function is called when the current cell highlight must be redrawn + // and may be overridden by the user + virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr ); + +#ifdef NOTNEEDED // ???? + void DrawRowLabels( wxDC& dc ); + void DrawRowLabel( wxDC& dc, int row ); + + void DrawColLabels( wxDC& dc ); + void DrawColLabel( wxDC& dc, int col ); +#endif + + // ------ Cell text drawing functions + // + void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&, + int horizontalAlignment = wxLEFT, + int verticalAlignment = wxTOP ); + + // Split a string containing newline chararcters into an array of + // strings and return the number of lines + // + void StringToLines( const wxString& value, wxArrayString& lines ); + + void GetTextBoxSize( wxDC& dc, + wxArrayString& lines, + long *width, long *height ); + + + // ------ + // Code that does a lot of grid modification can be enclosed + // between BeginBatch() and EndBatch() calls to avoid screen + // flicker + // + void BeginBatch(); + void EndBatch(); + int GetBatchCount(); + + + // ------ edit control functions + // + bool IsEditable() { return m_editable; } + void EnableEditing( bool edit ); + + void EnableCellEditControl( bool enable = TRUE ); + void DisableCellEditControl(); + bool CanEnableCellControl() const; + bool IsCellEditControlEnabled() const; + bool IsCellEditControlShown() const; + + bool IsCurrentCellReadOnly() const; + + void ShowCellEditControl(); + void HideCellEditControl(); + void SaveEditControlValue(); + + + // ------ grid location functions + // Note that all of these functions work with the logical coordinates of + // grid cells and labels so you will need to convert from device + // coordinates for mouse events etc. + // + + //void XYToCell( int x, int y, wxGridCellCoords& ); + %addmethods { + %new wxGridCellCoords* XYToCell(int x, int y) { + wxGridCellCoords rv; + self->XYToCell(x, y, rv); + return new wxGridCellCoords(rv); + } + } + + int YToRow( int y ); + int XToCol( int x ); + + int YToEdgeOfRow( int y ); + int XToEdgeOfCol( int x ); + + wxRect CellToRect( int row, int col ); + // TODO: ??? wxRect CellToRect( const wxGridCellCoords& coords ); + + + int GetGridCursorRow(); + int GetGridCursorCol(); + + // check to see if a cell is either wholly visible (the default arg) or + // at least partially visible in the grid window + // + bool IsVisible( int row, int col, bool wholeCellVisible = TRUE ); + // TODO: ??? bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = TRUE ); + void MakeCellVisible( int row, int col ); + // TODO: ??? void MakeCellVisible( const wxGridCellCoords& coords ); + + + // ------ grid cursor movement functions + // + void SetGridCursor( int row, int col ); + bool MoveCursorUp( bool expandSelection ); + bool MoveCursorDown( bool expandSelection ); + bool MoveCursorLeft( bool expandSelection ); + bool MoveCursorRight( bool expandSelection ); + bool MovePageDown(); + bool MovePageUp(); + bool MoveCursorUpBlock( bool expandSelection ); + bool MoveCursorDownBlock( bool expandSelection ); + bool MoveCursorLeftBlock( bool expandSelection ); + bool MoveCursorRightBlock( bool expandSelection ); + + + // ------ label and gridline formatting + // + int GetDefaultRowLabelSize(); + int GetRowLabelSize(); + int GetDefaultColLabelSize(); + int GetColLabelSize(); + wxColour GetLabelBackgroundColour(); + wxColour GetLabelTextColour(); + wxFont GetLabelFont(); + void GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ); + void GetColLabelAlignment( int *OUTPUT, int *OUTPUT ); + wxString GetRowLabelValue( int row ); + wxString GetColLabelValue( int col ); + wxColour GetGridLineColour(); + wxColour GetCellHighlightColour(); + + void SetRowLabelSize( int width ); + void SetColLabelSize( int height ); + void SetLabelBackgroundColour( const wxColour& ); + void SetLabelTextColour( const wxColour& ); + void SetLabelFont( const wxFont& ); + void SetRowLabelAlignment( int horiz, int vert ); + void SetColLabelAlignment( int horiz, int vert ); + void SetRowLabelValue( int row, const wxString& ); + void SetColLabelValue( int col, const wxString& ); + void SetGridLineColour( const wxColour& ); + void SetCellHighlightColour( const wxColour& ); + + void EnableDragRowSize( bool enable = TRUE ); + void DisableDragRowSize(); + bool CanDragRowSize(); + void EnableDragColSize( bool enable = TRUE ); + void DisableDragColSize(); + bool CanDragColSize(); + void EnableDragGridSize(bool enable = TRUE); + void DisableDragGridSize(); + bool CanDragGridSize(); + + // this sets the specified attribute for all cells in this row/col + void SetRowAttr(int row, wxGridCellAttr *attr); + void SetColAttr(int col, wxGridCellAttr *attr); + + // shortcuts for setting the column parameters + + // set the format for the data in the column: default is string + void SetColFormatBool(int col); + void SetColFormatNumber(int col); + void SetColFormatFloat(int col, int width = -1, int precision = -1); + void SetColFormatCustom(int col, const wxString& typeName); + + void EnableGridLines( bool enable = TRUE ); + bool GridLinesEnabled(); + + // ------ row and col formatting + // + int GetDefaultRowSize(); + int GetRowSize( int row ); + int GetDefaultColSize(); + int GetColSize( int col ); + wxColour GetDefaultCellBackgroundColour(); + wxColour GetCellBackgroundColour( int row, int col ); + wxColour GetDefaultCellTextColour(); + wxColour GetCellTextColour( int row, int col ); + wxFont GetDefaultCellFont(); + wxFont GetCellFont( int row, int col ); + void GetDefaultCellAlignment( int *horiz, int *vert ); + void GetCellAlignment( int row, int col, int *horiz, int *vert ); + + void SetDefaultRowSize( int height, bool resizeExistingRows = FALSE ); + void SetRowSize( int row, int height ); + void SetDefaultColSize( int width, bool resizeExistingCols = FALSE ); + + void SetColSize( int col, int width ); + + // automatically size the column or row to fit to its contents, if + // setAsMin is TRUE, this optimal width will also be set as minimal width + // for this column + void AutoSizeColumn( int col, bool setAsMin = TRUE ); + void AutoSizeRow( int row, bool setAsMin = TRUE ); + + + // auto size all columns (very ineffective for big grids!) + void AutoSizeColumns( bool setAsMin = TRUE ); + void AutoSizeRows( bool setAsMin = TRUE ); + + // auto size the grid, that is make the columns/rows of the "right" size + // and also set the grid size to just fit its contents + void AutoSize(); + + // column won't be resized to be lesser width - this must be called during + // the grid creation because it won't resize the column if it's already + // narrower than the minimal width + void SetColMinimalWidth( int col, int width ); + void SetRowMinimalHeight( int row, int width ); + + void SetDefaultCellBackgroundColour( const wxColour& ); + void SetCellBackgroundColour( int row, int col, const wxColour& ); + void SetDefaultCellTextColour( const wxColour& ); + + void SetCellTextColour( int row, int col, const wxColour& ); + void SetDefaultCellFont( const wxFont& ); + void SetCellFont( int row, int col, const wxFont& ); + void SetDefaultCellAlignment( int horiz, int vert ); + void SetCellAlignment( int row, int col, int horiz, int vert ); + + // takes ownership of the pointer + void SetDefaultRenderer(wxGridCellRenderer *renderer); + void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer); + wxGridCellRenderer *GetDefaultRenderer() const; + wxGridCellRenderer* GetCellRenderer(int row, int col); + + // takes ownership of the pointer + void SetDefaultEditor(wxGridCellEditor *editor); + void SetCellEditor(int row, int col, wxGridCellEditor *editor); + wxGridCellEditor *GetDefaultEditor() const; + wxGridCellEditor* GetCellEditor(int row, int col); + + + + // ------ cell value accessors + // + wxString GetCellValue( int row, int col ); + // TODO: ??? wxString GetCellValue( const wxGridCellCoords& coords ) + + void SetCellValue( int row, int col, const wxString& s ); + // TODO: ??? void SetCellValue( const wxGridCellCoords& coords, const wxString& s ) + + // returns TRUE if the cell can't be edited + bool IsReadOnly(int row, int col) const; + + // make the cell editable/readonly + void SetReadOnly(int row, int col, bool isReadOnly = TRUE); + + // ------ selections of blocks of cells + // + void SelectRow( int row, bool addToSelected = FALSE ); + void SelectCol( int col, bool addToSelected = FALSE ); + + void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol ); + // TODO: ??? void SelectBlock( const wxGridCellCoords& topLeft, + // TODO: ??? const wxGridCellCoords& bottomRight ) + + void SelectAll(); + bool IsSelection(); + void ClearSelection(); + bool IsInSelection( int row, int col ); + // TODO: ??? bool IsInSelection( const wxGridCellCoords& coords ) + + + // This function returns the rectangle that encloses the block of cells + // limited by TopLeft and BottomRight cell in device coords and clipped + // to the client size of the grid window. + // + wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft, + const wxGridCellCoords & bottomRight ); + + // This function returns the rectangle that encloses the selected cells + // in device coords and clipped to the client size of the grid window. + // + wxRect SelectionToDeviceRect(); + + // Access or update the selection fore/back colours + wxColour GetSelectionBackground() const; + wxColour GetSelectionForeground() const; + + void SetSelectionBackground(const wxColour& c); + void SetSelectionForeground(const wxColour& c); + + + // Methods for a registry for mapping data types to Renderers/Editors + void RegisterDataType(const wxString& typeName, + wxGridCellRenderer* renderer, + wxGridCellEditor* editor); + wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const; + // TODO: ??? wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const + wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const; + wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const; + wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const; + + // grid may occupy more space than needed for its rows/columns, this + // function allows to set how big this extra space is + void SetMargins(int extraWidth, int extraHeight); +}; + + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +// Grid events and stuff + + + +class wxGridEvent : public wxNotifyEvent +{ +public: + wxGridEvent(int id, wxEventType type, wxGrid* obj, + int row=-1, int col=-1, int x=-1, int y=-1, bool sel = TRUE, + bool control=FALSE, bool shift=FALSE, bool alt=FALSE, bool meta=FALSE); + + virtual int GetRow(); + virtual int GetCol(); + wxPoint GetPosition(); + bool Selecting(); + bool ControlDown(); + bool MetaDown(); + bool ShiftDown(); + bool AltDown(); + +}; + + +class wxGridSizeEvent : public wxNotifyEvent +{ +public: + wxGridSizeEvent(int id, wxEventType type, wxGrid* obj, + int rowOrCol=-1, int x=-1, int y=-1, + bool control=FALSE, bool shift=FALSE, bool alt=FALSE, bool meta=FALSE); + + int GetRowOrCol(); + wxPoint GetPosition(); + bool ControlDown(); + bool MetaDown(); + bool ShiftDown(); + bool AltDown(); + +}; + + +class wxGridRangeSelectEvent : public wxNotifyEvent +{ +public: + wxGridRangeSelectEvent(int id, wxEventType type, wxGrid* obj, + const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + bool sel = TRUE, + bool control=FALSE, bool shift=FALSE, + bool alt=FALSE, bool meta=FALSE); + + wxGridCellCoords GetTopLeftCoords(); + wxGridCellCoords GetBottomRightCoords(); + int GetTopRow(); + int GetBottomRow(); + int GetLeftCol(); + int GetRightCol(); + bool Selecting(); + bool ControlDown(); + bool MetaDown(); + bool ShiftDown(); + bool AltDown(); +}; + +enum { + wxEVT_GRID_CELL_LEFT_CLICK, + wxEVT_GRID_CELL_RIGHT_CLICK, + wxEVT_GRID_CELL_LEFT_DCLICK, + wxEVT_GRID_CELL_RIGHT_DCLICK, + wxEVT_GRID_LABEL_LEFT_CLICK, + wxEVT_GRID_LABEL_RIGHT_CLICK, + wxEVT_GRID_LABEL_LEFT_DCLICK, + wxEVT_GRID_LABEL_RIGHT_DCLICK, + wxEVT_GRID_ROW_SIZE, + wxEVT_GRID_COL_SIZE, + wxEVT_GRID_RANGE_SELECT, + wxEVT_GRID_CELL_CHANGE, + wxEVT_GRID_SELECT_CELL, + wxEVT_GRID_EDITOR_SHOWN, + wxEVT_GRID_EDITOR_HIDDEN, +}; + + + +%pragma(python) code = " +def EVT_GRID_CELL_LEFT_CLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_CELL_LEFT_CLICK, fn) + +def EVT_GRID_CELL_RIGHT_CLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_CELL_RIGHT_CLICK, fn) + +def EVT_GRID_CELL_LEFT_DCLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_CELL_LEFT_DCLICK, fn) + +def EVT_GRID_CELL_RIGHT_DCLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_CELL_RIGHT_DCLICK, fn) + +def EVT_GRID_LABEL_LEFT_CLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_LABEL_LEFT_CLICK, fn) + +def EVT_GRID_LABEL_RIGHT_CLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_LABEL_RIGHT_CLICK, fn) + +def EVT_GRID_LABEL_LEFT_DCLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_LABEL_LEFT_DCLICK, fn) + +def EVT_GRID_LABEL_RIGHT_DCLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_LABEL_RIGHT_DCLICK, fn) + +def EVT_GRID_ROW_SIZE(win, fn): + win.Connect(-1, -1, wxEVT_GRID_ROW_SIZE, fn) + +def EVT_GRID_COL_SIZE(win, fn): + win.Connect(-1, -1, wxEVT_GRID_COL_SIZE, fn) + +def EVT_GRID_RANGE_SELECT(win, fn): + win.Connect(-1, -1, wxEVT_GRID_RANGE_SELECT, fn) + +def EVT_GRID_CELL_CHANGE(win, fn): + win.Connect(-1, -1, wxEVT_GRID_CELL_CHANGE, fn) + +def EVT_GRID_SELECT_CELL(win, fn): + win.Connect(-1, -1, wxEVT_GRID_SELECT_CELL, fn) + +def EVT_GRID_EDITOR_SHOWN(win, fn): + win.Connect(-1, -1, wxEVT_GRID_EDITOR_SHOWN, fn) + +def EVT_GRID_EDITOR_HIDDEN(win, fn): + win.Connect(-1, -1, wxEVT_GRID_EDITOR_HIDDEN, fn) + +" + +//--------------------------------------------------------------------------- + +%pragma(python) include="_gridextras.py"; + +//--------------------------------------------------------------------------- + + +#endif diff --git a/utils/wxPython/demo/data/imagemap.htm b/wxPython/demo/data/imagemap.htm similarity index 100% rename from utils/wxPython/demo/data/imagemap.htm rename to wxPython/demo/data/imagemap.htm diff --git a/utils/wxPython/demo/data/imagemap.png b/wxPython/demo/data/imagemap.png similarity index 100% rename from utils/wxPython/demo/data/imagemap.png rename to wxPython/demo/data/imagemap.png diff --git a/utils/wxPython/demo/data/pic.png b/wxPython/demo/data/pic.png similarity index 100% rename from utils/wxPython/demo/data/pic.png rename to wxPython/demo/data/pic.png diff --git a/utils/wxPython/demo/data/pic2.bmp b/wxPython/demo/data/pic2.bmp similarity index 100% rename from utils/wxPython/demo/data/pic2.bmp rename to wxPython/demo/data/pic2.bmp diff --git a/wxPython/demo/data/stc.h b/wxPython/demo/data/stc.h new file mode 100644 index 0000000000..f2a514524e --- /dev/null +++ b/wxPython/demo/data/stc.h @@ -0,0 +1,627 @@ +//////////////////////////////////////////////////////////////////////////// +// Name: stc.h +// Purpose: A wxWindows implementation of Scintilla. This class is the +// one meant to be used directly by wx applications. It does not +// derive directly from the Scintilla classes, and in fact there +// is no mention of Scintilla classes at all in this header. +// This class delegates all method calls and events to the +// Scintilla objects and so forth. This allows the use of +// Scintilla without polluting the namespace with all the +// classes and itentifiers from Scintilla. +// +// Author: Robin Dunn +// +// Created: 13-Jan-2000 +// RCS-ID: $Id$ +// Copyright: (c) 2000 by Total Control Software +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef __stc_h__ +#define __stc_h__ + + +#include <wx/wx.h> + + +//---------------------------------------------------------------------- +// constants and stuff + +enum wxSTC_UndoType { + wxSTC_UndoCollectNone, + wxSTC_UndoCollectAutoStart +}; + + +enum wxSTC_EOL { + wxSTC_EOL_CRLF, + wxSTC_EOL_CR, + wxSTC_EOL_LF +}; + +enum wxSTC_EDGE { + wxSTC_EDGE_NONE, + wxSTC_EDGE_LINE, + wxSTC_EDGE_BACKGROUND +}; + + + +const int wxSTC_LEX_STYLE_MAX = 31; +const int wxSTC_STYLE_DEFAULT = 32; +const int wxSTC_STYLE_LINENUMBER = 33; +const int wxSTC_STYLE_BRACELIGHT = 34; +const int wxSTC_STYLE_BRACEBAD = 35; +const int wxSTC_STYLE_CONTROLCHAR = 36; +const int wxSTC_STYLE_MAX = 127; +const int wxSTC_STYLE_MASK = 31; + +const int wxSTC_MARKER_MAX = 31; +const int wxSTC_MARK_CIRCLE = 0; +const int wxSTC_MARK_ROUNDRECT = 1; +const int wxSTC_MARK_ARROW = 2; +const int wxSTC_MARK_SMALLRECT = 3; +const int wxSTC_MARK_SHORTARROW = 4; +const int wxSTC_MARK_EMPTY = 5; +const int wxSTC_MARK_ARROWDOWN = 6; +const int wxSTC_MARK_MINUS = 7; +const int wxSTC_MARK_PLUS = 8; + +const int wxSTC_MARKNUM_FOLDER = 30; +const int wxSTC_MARKNUM_FOLDEROPEN= 31; +const int wxSTC_MASK_FOLDERS = ((1 << wxSTC_MARKNUM_FOLDER) | (1 << wxSTC_MARKNUM_FOLDEROPEN)); + +const int wxSTC_INDIC_MAX = 7; +const int wxSTC_INDIC_PLAIN = 0; +const int wxSTC_INDIC_SQUIGGLE = 1; +const int wxSTC_INDIC_TT = 2; +const int wxSTC_INDIC0_MASK = 32; +const int wxSTC_INDIC1_MASK = 64; +const int wxSTC_INDIC2_MASK = 128; +const int wxSTC_INDICS_MASK = (wxSTC_INDIC0_MASK | wxSTC_INDIC1_MASK | wxSTC_INDIC2_MASK); + + +const int wxSTC_FOLDLEVELBASE = 0x0400; +const int wxSTC_FOLDLEVELWHITEFLAG = 0x1000; +const int wxSTC_FOLDLEVELHEADERFLAG = 0x2000; +const int wxSTC_FOLDLEVELNUMBERMASK = 0x0FFF; + + +// key commands +enum { + wxSTC_CMD_LINEDOWN = 2300, + wxSTC_CMD_LINEDOWNEXTEND, + wxSTC_CMD_LINEUP, + wxSTC_CMD_LINEUPEXTEND, + wxSTC_CMD_CHARLEFT, + wxSTC_CMD_CHARLEFTEXTEND, + wxSTC_CMD_CHARRIGHT, + wxSTC_CMD_CHARRIGHTEXTEND, + wxSTC_CMD_WORDLEFT, + wxSTC_CMD_WORDLEFTEXTEND, + wxSTC_CMD_WORDRIGHT, + wxSTC_CMD_WORDRIGHTEXTEND, + wxSTC_CMD_HOME, + wxSTC_CMD_HOMEEXTEND, + wxSTC_CMD_LINEEND, + wxSTC_CMD_LINEENDEXTEND, + wxSTC_CMD_DOCUMENTSTART, + wxSTC_CMD_DOCUMENTSTARTEXTEND, + wxSTC_CMD_DOCUMENTEND, + wxSTC_CMD_DOCUMENTENDEXTEND, + wxSTC_CMD_PAGEUP, + wxSTC_CMD_PAGEUPEXTEND, + wxSTC_CMD_PAGEDOWN, + wxSTC_CMD_PAGEDOWNEXTEND, + wxSTC_CMD_EDITTOGGLEOVERTYPE, + wxSTC_CMD_CANCEL, + wxSTC_CMD_DELETEBACK, + wxSTC_CMD_TAB, + wxSTC_CMD_BACKTAB, + wxSTC_CMD_NEWLINE, + wxSTC_CMD_FORMFEED, + wxSTC_CMD_VCHOME, + wxSTC_CMD_VCHOMEEXTEND, + wxSTC_CMD_ZOOMIN, + wxSTC_CMD_ZOOMOUT, + wxSTC_CMD_DELWORDLEFT, + wxSTC_CMD_DELWORDRIGHT, + wxSTC_CMD_LINECUT, + wxSTC_CMD_LINEDELETE, + wxSTC_CMD_LINETRANSPOSE, + wxSTC_CMD_LOWERCASE, + wxSTC_CMD_UPPERCASE, + wxSTC_CMD_LINESCROLLDOWN, + wxSTC_CMD_LINESCROLLUP +}; + + +enum wxSTC_LEX { + wxSTC_LEX_CONTAINER=0, + wxSTC_LEX_NULL, + wxSTC_LEX_PYTHON, + wxSTC_LEX_CPP, + wxSTC_LEX_HTML, + wxSTC_LEX_XML, + wxSTC_LEX_PERL, + wxSTC_LEX_SQL, + wxSTC_LEX_VB, + wxSTC_LEX_PROPERTIES, + wxSTC_LEX_ERRORLIST, + wxSTC_LEX_MAKEFILE, + wxSTC_LEX_BATCH, +}; + + + +const int wxSTC_CARET_SLOP = 0x01; +const int WXSTC_CARET_CENTER = 0x02; +const int wxSTC_CARET_STRICT = 0x04; + +const int wxSTC_MARGIN_SYMBOL = 0; +const int wxSTC_MARGIN_NUMBER = 1; + + +class ScintillaWX; // forward declare +class WordList; +struct SCNotification; + + +extern const wxChar* wxSTCNameStr; + +//---------------------------------------------------------------------- + +class wxStyledTextCtrl : public wxControl { +public: + +#ifdef SWIG + wxStyledTextCtrl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const char* name = wxSTCNameStr); +#else + wxStyledTextCtrl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxSTCNameStr); +#endif + + +#ifndef SWIG + ~wxStyledTextCtrl(); +#endif + + + // Text retrieval and modification + wxString GetText(); + bool SetText(const wxString& text); + wxString GetLine(int line); + void ReplaceSelection(const wxString& text); + void SetReadOnly(bool readOnly); + bool GetReadOnly(); + wxString GetTextRange(int startPos, int endPos); + wxString GetStyledTextRange(int startPos, int endPos); +#ifndef SWIG + void GetTextRange(int startPos, int endPos, char* buff); + void GetStyledTextRange(int startPos, int endPos, char* buff); +#endif + void AddText(const wxString& text); + void AddStyledText(const wxString& text); + void InsertText(int pos, const wxString& text); + void ClearAll(); + char GetCharAt(int pos); + char GetStyleAt(int pos); + void SetStyleBits(int bits); + int GetStyleBits(); + + + // Clipboard + void Cut(); + void Copy(); + void Paste(); + bool CanPaste(); + void ClearClipbrd(); // avoiding name conflict with virtual in wxWindow + + + // Undo and Redo + void Undo(); + bool CanUndo(); + void EmptyUndoBuffer(); + void Redo(); + bool CanRedo(); + void SetUndoCollection(wxSTC_UndoType type); + wxSTC_UndoType GetUndoCollection(); + void BeginUndoAction(); + void EndUndoAction(); + + + // Selection and information +#ifdef SWIG + void GetSelection(int* OUTPUT, int* OUTPUT); +#else + void GetSelection(int* startPos, int* endPos); +#endif + void SetSelection(int startPos, int endPos); + wxString GetSelectedText(); + void HideSelection(bool hide); + bool GetHideSelection(); + + int GetTextLength(); + int GetFirstVisibleLine(); + bool GetModified(); + int GetLineCount(); + wxRect GetRect(); + int GetLineFromPos(int pos); + int GetLineStartPos(int line); + int GetLineLengthAtPos(int pos); + int GetLineLength(int line); +#ifdef SWIG + wxString GetCurrentLineText(int* OUTPUT); +#else + wxString GetCurrentLineText(int* linePos); +#endif + int GetCurrentLine(); + int PositionFromPoint(wxPoint pt); + int LineFromPoint(wxPoint pt); + wxPoint PointFromPosition(int pos); + int GetCurrentPos(); + int GetAnchor(); + void SelectAll(); + void SetCurrentPosition(int pos); + void SetAnchor(int pos); + void GotoPos(int pos); + void GotoLine(int line); + void ChangePosition(int delta, bool extendSelection); + void PageMove(int cmdKey, bool extendSelection); + + void ScrollBy(int columnDelta, int lineDelta); + void ScrollToLine(int line); + void ScrollToColumn(int column); + void EnsureCaretVisible(); + void SetCaretPolicy(int policy, int slop=0); + int GetSelectionType(); + int GetLinesOnScreen(); + bool IsSelectionRectangle(); + void SetUseHorizontalScrollBar(bool use); + bool GetUseHorizontalScrollBar(); + + + // Searching + int FindText(int minPos, int maxPos, const wxString& text, + bool caseSensitive, bool wholeWord); + void SearchAnchor(); + int SearchNext(const wxString& text, bool caseSensitive, bool wholeWord); + int SearchPrev(const wxString& text, bool caseSensitive, bool wholeWord); + + + // Visible whitespace + bool GetViewWhitespace(); + void SetViewWhitespace(bool visible); + + + // Line endings + wxSTC_EOL GetEOLMode(); + void SetEOLMode(wxSTC_EOL mode); + bool GetViewEOL(); + void SetViewEOL(bool visible); + void ConvertEOL(wxSTC_EOL mode); + + + // Styling + int GetEndStyled(); + void StartStyling(int pos, int mask); + void SetStyleFor(int length, int style); + void SetStyleBytes(int length, char* styleBytes); + void SetLineState(int line, int value); + int GetLineState(int line); + + + // Style Definition + void StyleClearAll(); + void StyleResetDefault(); + void StyleSetSpec(int styleNum, const wxString& spec); + void StyleSetForeground(int styleNum, const wxColour& colour); + void StyleSetBackground(int styleNum, const wxColour& colour); + void StyleSetFont(int styleNum, wxFont& font); + void StyleSetFontAttr(int styleNum, int size, const wxString& faceName, bool bold, bool italic); + void StyleSetBold(int styleNum, bool bold); + void StyleSetItalic(int styleNum, bool italic); + void StyleSetFaceName(int styleNum, const wxString& faceName); + void StyleSetSize(int styleNum, int pointSize); + void StyleSetEOLFilled(int styleNum, bool fillEOL); + + + // Margins in the edit area + int GetLeftMargin(); + int GetRightMargin(); + void SetMargins(int left, int right); + + + // Margins for selection, markers, etc. + void SetMarginType(int margin, int type); + int GetMarginType(int margin); + void SetMarginWidth(int margin, int pixelWidth); + int GetMarginWidth(int margin); + void SetMarginMask(int margin, int mask); + int GetMarginMask(int margin); + void SetMarginSensitive(int margin, bool sensitive); + bool GetMarginSensitive(int margin); + + + // Selection and Caret styles + void SetSelectionForeground(const wxColour& colour); + void SetSelectionBackground(const wxColour& colour); + void SetCaretForeground(const wxColour& colour); + int GetCaretPeriod(); + void SetCaretPeriod(int milliseconds); + + + // Other settings + void SetBufferedDraw(bool isBuffered); + void SetTabWidth(int numChars); + void SetIndent(int numChars); + void SetUseTabs(bool usetabs); + void SetLineIndentation(int line, int indentation); + int GetLineIndentation(int line); + int GetLineIndentationPos(int line); + void SetWordChars(const wxString& wordChars); + + void SetUsePop(bool usepopup); + + + // Brace highlighting + void BraceHighlight(int pos1, int pos2); + void BraceBadlight(int pos); + int BraceMatch(int pos, int maxReStyle=0); + + + // Markers + void MarkerDefine(int markerNumber, int markerSymbol, + const wxColour& foreground, + const wxColour& background); + void MarkerSetType(int markerNumber, int markerSymbol); + void MarkerSetForeground(int markerNumber, const wxColour& colour); + void MarkerSetBackground(int markerNumber, const wxColour& colour); + int MarkerAdd(int line, int markerNumber); + void MarkerDelete(int line, int markerNumber); + void MarkerDeleteAll(int markerNumber); + int MarkerGet(int line); + int MarkerGetNextLine(int lineStart, int markerMask); + int MarkerGetPrevLine(int lineStart, int markerMask); + int MarkerLineFromHandle(int handle); + void MarkerDeleteHandle(int handle); + + + // Indicators + void IndicatorSetStyle(int indicNum, int indicStyle); + int IndicatorGetStyle(int indicNum); + void IndicatorSetColour(int indicNum, const wxColour& colour); + + + // Auto completion + void AutoCompShow(const wxString& listOfWords); + void AutoCompCancel(); + bool AutoCompActive(); + int AutoCompPosAtStart(); + void AutoCompComplete(); + void AutoCompStopChars(const wxString& stopChars); + void AutoCompSetSeparator(char separator); + char AutoCompGetSeparator(); + void AutoCompSelect(const wxString& stringtoselect); + + // Call tips + void CallTipShow(int pos, const wxString& text); + void CallTipCancel(); + bool CallTipActive(); + int CallTipPosAtStart(); + void CallTipSetHighlight(int start, int end); + void CallTipSetBackground(const wxColour& colour); + + + // Key bindings + void CmdKeyAssign(int key, int modifiers, int cmd); + void CmdKeyClear(int key, int modifiers); + void CmdKeyClearAll(); + void CmdKeyExecute(int cmd); + + + // Print formatting + int FormatRange(bool doDraw, + int startPos, + int endPos, + wxDC* draw, + wxDC* target, // Why does it use two? Can they be the same? + wxRect renderRect, + wxRect pageRect); + + + // Document Sharing (multiple views) + void* GetDocument(); + void SetDocument(void* document); + // TODO: create a wx wrapper for Scintilla's document class + + + // Folding + int VisibleFromDocLine(int docLine); + int DocLineFromVisible(int displayLine); + int SetFoldLevel(int line, int level); + int GetFoldLevel(int line); + int GetLastChild(int line, int level); + int GetFoldParent(int line); + void ShowLines(int lineStart, int lineEnd); + void HideLines(int lineStart, int lineEnd); + bool GetLineVisible(int line); + void SetFoldExpanded(int line, bool expanded); + bool GetFoldExpanded(int line); + void ToggleFold(int line); + void EnsureVisible(int line); + void SetFoldFlags(int flags); + + + // Long Lines + int GetEdgeColumn(); + void SetEdgeColumn(int column); + wxSTC_EDGE GetEdgeMode(); + void SetEdgeMode(wxSTC_EDGE mode); + wxColour GetEdgeColour(); + void SetEdgeColour(const wxColour& colour); + + + // Lexer + void SetLexer(wxSTC_LEX lexer); + wxSTC_LEX GetLexer(); + void Colourise(int start, int end); + void SetProperty(const wxString& key, const wxString& value); + void SetKeywords(int keywordSet, const wxString& keywordList); + + +#ifndef SWIG +private: + // Event handlers + void OnPaint(wxPaintEvent& evt); + void OnScrollWin(wxScrollWinEvent& evt); + void OnSize(wxSizeEvent& evt); + void OnMouseLeftDown(wxMouseEvent& evt); + void OnMouseMove(wxMouseEvent& evt); + void OnMouseLeftUp(wxMouseEvent& evt); + void OnMouseRightUp(wxMouseEvent& evt); + void OnChar(wxKeyEvent& evt); + void OnKeyDown(wxKeyEvent& evt); + void OnLoseFocus(wxFocusEvent& evt); + void OnGainFocus(wxFocusEvent& evt); + void OnSysColourChanged(wxSysColourChangedEvent& evt); + void OnEraseBackground(wxEraseEvent& evt); + void OnMenu(wxCommandEvent& evt); + void OnListBox(wxCommandEvent& evt); + + + // Turn notifications from Scintilla into events + void NotifyChange(); + void NotifyParent(SCNotification* scn); + + long SendMsg(int msg, long wp=0, long lp=0); + +private: + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxStyledTextCtrl) + + ScintillaWX* m_swx; + wxStopWatch m_stopWatch; + bool m_readOnly; + wxSTC_UndoType m_undoType; + + + friend class ScintillaWX; + friend class Platform; +#endif +}; + +//---------------------------------------------------------------------- + +class wxStyledTextEvent : public wxCommandEvent { +public: + wxStyledTextEvent(wxEventType commandType=0, int id=0); + ~wxStyledTextEvent() {} + + void SetPosition(int pos) { m_position = pos; } + void SetKey(int k) { m_key = k; } + void SetModifiers(int m) { m_modifiers = m; } + void SetModificationType(int t) { m_modificationType = t; } + void SetText(const char* t) { m_text = t; } + void SetLength(int len) { m_length = len; } + void SetLinesAdded(int num) { m_linesAdded = num; } + void SetLine(int val) { m_line = val; } + void SetFoldLevelNow(int val) { m_foldLevelNow = val; } + void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; } + void SetMargin(int val) { m_margin = val; } + void SetMessage(int val) { m_message = val; } + void SetWParam(int val) { m_wParam = val; } + void SetLParam(int val) { m_lParam = val; } + + int GetPosition() const { return m_position; } + int GetKey() const { return m_key; } + int GetModifiers() const { return m_modifiers; } + int GetModificationType() const { return m_modificationType; } + wxString GetText() const { return m_text; } + int GetLength() const { return m_length; } + int GetLinesAdded() const { return m_linesAdded; } + int GetLine() const { return m_line; } + int GetFoldLevelNow() const { return m_foldLevelNow; } + int GetFoldLevelPrev() const { return m_foldLevelPrev; } + int GetMargin() const { return m_margin; } + int GetMessage() const { return m_message; } + int GetWParam() const { return m_wParam; } + int GetLParam() const { return m_lParam; } + + bool GetShift() const; + bool GetControl() const; + bool GetAlt() const; + + void CopyObject(wxObject& obj) const; + +#ifndef SWIG +private: + DECLARE_DYNAMIC_CLASS(wxStyledTextEvent) + + int m_position; + int m_key; + int m_modifiers; + + int m_modificationType; // wxEVT_STC_MODIFIED + wxString m_text; + int m_length; + int m_linesAdded; + int m_line; + int m_foldLevelNow; + int m_foldLevelPrev; + + int m_margin; // wxEVT_STC_MARGINCLICK + + int m_message; // wxEVT_STC_MACRORECORD + int m_wParam; + int m_lParam; +#endif +}; + + + +enum { + wxEVT_STC_CHANGE = 1650, + wxEVT_STC_STYLENEEDED, + wxEVT_STC_CHARADDED, + wxEVT_STC_UPDATEUI, + wxEVT_STC_SAVEPOINTREACHED, + wxEVT_STC_SAVEPOINTLEFT, + wxEVT_STC_ROMODIFYATTEMPT, + wxEVT_STC_DOUBLECLICK, + wxEVT_STC_MODIFIED, + wxEVT_STC_KEY, + wxEVT_STC_MACRORECORD, + wxEVT_STC_MARGINCLICK, + wxEVT_STC_NEEDSHOWN +}; + +#ifndef SWIG +typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); + +#define EVT_STC_CHANGE(id, fn) { wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_STYLENEEDED(id, fn) { wxEVT_STC_STYLENEEDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_CHARADDED(id, fn) { wxEVT_STC_CHARADDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_UPDATEUI(id, fn) { wxEVT_STC_UPDATEUI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_SAVEPOINTREACHED(id, fn) { wxEVT_STC_SAVEPOINTREACHED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_SAVEPOINTLEFT(id, fn) { wxEVT_STC_SAVEPOINTLEFT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_ROMODIFYATTEMPT(id, fn) { wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_DOUBLECLICK(id, fn) { wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MODIFIED(id, fn) { wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_KEY(id, fn) { wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MACRORECORD(id, fn) { wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MARGINCLICK(id, fn) { wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_NEEDSHOWN(id, fn) { wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, + +#endif + +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- +#endif + + diff --git a/utils/wxPython/demo/data/tables.htm b/wxPython/demo/data/tables.htm similarity index 100% rename from utils/wxPython/demo/data/tables.htm rename to wxPython/demo/data/tables.htm diff --git a/utils/wxPython/demo/data/test.htm b/wxPython/demo/data/test.htm similarity index 100% rename from utils/wxPython/demo/data/test.htm rename to wxPython/demo/data/test.htm diff --git a/wxPython/demo/data/tips.txt b/wxPython/demo/data/tips.txt new file mode 100644 index 0000000000..b56d78fb01 --- /dev/null +++ b/wxPython/demo/data/tips.txt @@ -0,0 +1,7 @@ +Each of the leaf items in the tree is a separate demo. Click and learn! +Use the source Luke! +Many of the demos have some helpful overview text associated with them. Simply click on the first tab in the notebook control after selecting the demo. You can switch back and forth to the demo page as often as you like. +You can also view the source code for each demo by clicking on the second notebook tab. +wxPython now has a company providing commercial support, consulting and training. Go to http://wxpros.com for details. +You shouldn't pee on an electric fence! +Be sure to subscribe to the mail list. Go to http://wxwindows.org/mailman/listinfo/wxpython-users today! diff --git a/utils/wxPython/demo/data/widgetTest.htm b/wxPython/demo/data/widgetTest.htm similarity index 100% rename from utils/wxPython/demo/data/widgetTest.htm rename to wxPython/demo/data/widgetTest.htm diff --git a/utils/wxPython/demo/demo.py b/wxPython/demo/demo.py similarity index 100% rename from utils/wxPython/demo/demo.py rename to wxPython/demo/demo.py diff --git a/utils/wxPython/demo/demoMainLoop.py b/wxPython/demo/demoMainLoop.py similarity index 100% rename from utils/wxPython/demo/demoMainLoop.py rename to wxPython/demo/demoMainLoop.py diff --git a/utils/wxPython/demo/hangman.py b/wxPython/demo/hangman.py similarity index 99% rename from utils/wxPython/demo/hangman.py rename to wxPython/demo/hangman.py index 3f2c6da5c6..31c7c72fb3 100644 --- a/utils/wxPython/demo/hangman.py +++ b/wxPython/demo/hangman.py @@ -124,6 +124,8 @@ class HangmanWnd(wxWindow): else: self.font = wxFont(10, wxMODERN, wxNORMAL, wxNORMAL) self.SetFocus() + EVT_PAINT(self, self.OnPaint) + def StartGame(self, word): self.word = word @@ -252,6 +254,7 @@ class HangmanDemoFrame(wxFrame): def __init__(self, wf, parent, id, pos, size): wxFrame.__init__(self, parent, id, "Hangman demo", pos, size) self.demo = HangmanDemo(wf, self, -1, wxDefaultPosition, wxDefaultSize) + EVT_CLOSE(self, self.OnCloseWindow) def OnCloseWindow(self, event): self.demo.timer.Stop() diff --git a/utils/wxPython/demo/paper.xml b/wxPython/demo/paper.xml similarity index 100% rename from utils/wxPython/demo/paper.xml rename to wxPython/demo/paper.xml diff --git a/utils/wxPython/demo/pyTree.py b/wxPython/demo/pyTree.py similarity index 100% rename from utils/wxPython/demo/pyTree.py rename to wxPython/demo/pyTree.py diff --git a/utils/wxPython/demo/quotes.xml b/wxPython/demo/quotes.xml similarity index 100% rename from utils/wxPython/demo/quotes.xml rename to wxPython/demo/quotes.xml diff --git a/wxPython/demo/redemo.py b/wxPython/demo/redemo.py new file mode 100644 index 0000000000..9215ad529a --- /dev/null +++ b/wxPython/demo/redemo.py @@ -0,0 +1,25 @@ +"""Basic regular expression demostration facility (Perl style syntax).""" + +from wxPython.wx import * +import re + +#---------------------------------------------------------------------- + +class ReDemoPanel(wxPanel): + def __init__(self, parent): + wxPanel.__init__(self, parent, -1) + + rePrompt = wxStaticText(self, -1, "Enter a Perl-style regular expression") + reText = wxTextCtrl(self, 101, "") + + options = self.AddOptions() + + sPrompt = wxStaticText(self, -1, "Enter a string to search") + sText = wxTextCtrl(self, 102, "", style=wxTE_MULTILINE) + + dispPrompt = wxStaticText(self, -1, "Groups:") + dispText = wxTextCtrl(self, 103, "", style=wxTE_MULTILINE|wxTE_READONLY) + + +#---------------------------------------------------------------------- +#---------------------------------------------------------------------- diff --git a/utils/wxPython/demo/run.py b/wxPython/demo/run.py old mode 100644 new mode 100755 similarity index 91% rename from utils/wxPython/demo/run.py rename to wxPython/demo/run.py index 7a2a5f4102..c58a9a86f0 --- a/utils/wxPython/demo/run.py +++ b/wxPython/demo/run.py @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/env python #---------------------------------------------------------------------------- # Name: run.py # Purpose: Simple framework for running individual demos @@ -37,7 +37,8 @@ class RunDemoApp(wxApp): def OnInit(self): wxInitAllImageHandlers() - frame = wxFrame(None, -1, "RunDemo: " + self.name, size=(0,0)) + frame = wxFrame(None, -1, "RunDemo: " + self.name, size=(0,0), + style=wxNO_FULL_REPAINT_ON_RESIZE|wxDEFAULT_FRAME_STYLE) frame.CreateStatusBar() frame.Show(true) win = self.demoModule.runTest(frame, frame, Log()) @@ -46,7 +47,8 @@ class RunDemoApp(wxApp): # its own top-level window if win: # so set the frame to a good size for showing stuff - frame.SetSize((600, 450)) + frame.SetSize((640, 480)) + win.SetFocus() else: # otherwise the demo made its own frame, so just put a @@ -78,6 +80,8 @@ def main(argv): raise SystemExit name = argv[1] + if name[-3:] == '.py': + name = name[:-3] module = __import__(name) diff --git a/wxPython/demo/viewer.py b/wxPython/demo/viewer.py new file mode 100644 index 0000000000..ad438e10a0 --- /dev/null +++ b/wxPython/demo/viewer.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python +""" + Run wxPython in a second thread. + + Overview: + Importing this module creates a second thread and starts + wxPython in that thread. Its single method, + add_cone(), sends an event to the second thread + telling it to create a VTK viewer window with a cone in + it. + + This module is meant to be imported into the standard + Python interpreter. It also works with Pythonwin. + It doesn't seem to work with IDLE (on NT anyways). + It should also work in a wxPython application. + + Applications already running a wxPython app do not + need to start a second thread. In these cases, + viewer creates the cone windows in the current + thread. You can test this by running shell.py + that comes with wxPython, importing viewer and + calling add_cone. + + Usage: + [user]$ python + Python 1.5.2 (#1, Sep 17 1999, 20:15:36) ... + Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam + >>> import viewer + >>> viewer.add_cone() # pop up a cone window + >>> a = 1 + 1 + >>> viewer.add_cone() # create another cone window + + Why would anyone do this?: + When using wxPython, the call to app.Mainloop() takes over + the thread from which it is called. This presents a + problem for applications that want to use the standard + Python command line user interface, while occasionaly + creating a GUI window for viewing an image, plot, etc. + One soultion is to mangage the GUI in a second thread. + + wxPython does not behave well if windows are created in + a thread other than the one where wxPython was originally + imported. ( I assume importing wxPython initializes some + info in the thread). The current solution is to make the + original import of wxPython in the second thread and then + create all windows in that second thread. + + Methods in the main thread can create a new window by issuing + events to a "catcher" window in the second thread. This + catcher window has event handlers that actually create the + new window. +""" + +class viewer_thread: + def start(self): + """ start the GUI thread + """ + import thread,time + thread.start_new_thread(self.run, ()) + + def run(self): + """ + Note that viewer_basices is first imported ***here***. + This is the second thread. viewer_basics imports + wxPython. if we imported it at + the module level instead of in this function, + the import would occur in the main thread and + wxPython wouldn't run correctly in the second thread. + """ + from viewer_basics import * + try: + self.app = SecondThreadApp(0) + self.app.MainLoop() + except TypeError: + self.app = None + + def add_cone(self): + """ + send an event to the catcher window in the + other thread and tell it to create a cone window. + """ + import viewer_basics + if self.app: + evt = viewer_basics.AddCone() + viewer_basics.wxPostEvent(self.app.catcher, evt) + else: + viewer_basics.add_cone() + +viewer = viewer_thread() +viewer.start() + +def add_cone(): + viewer.add_cone() + + diff --git a/wxPython/demo/viewer_basics.py b/wxPython/demo/viewer_basics.py new file mode 100644 index 0000000000..fe71140ec3 --- /dev/null +++ b/wxPython/demo/viewer_basics.py @@ -0,0 +1,61 @@ +from wxPython.wx import * +from wxPython.lib import vtk + +#--------------------------------------------------------------------------- +class VtkFrame(wxFrame): + """ + Simple example VTK window that contains a cone. + """ + def __init__(self, parent, id, title): + wxFrame.__init__(self, parent,id,title, size=(450, 300)) + win = vtk.wxVTKRenderWindow(self, -1) + + renWin = win.GetRenderWindow() + + ren = vtk.vtkRenderer() + renWin.AddRenderer(ren) + cone = vtk.vtkConeSource() + coneMapper = vtk.vtkPolyDataMapper() + coneMapper.SetInput(cone.GetOutput()) + coneActor = vtk.vtkActor() + coneActor.SetMapper(coneMapper) + ren.AddActor(coneActor) +#--------------------------------------------------------------------------- +wxEVT_ADD_CONE = 25015 + +def EVT_ADD_CONE(win, func): + win.Connect(-1, -1, wxEVT_ADD_CONE, func) + +class AddCone(wxPyEvent): + def __init__(self): + wxPyEvent.__init__(self) + self.SetEventType(wxEVT_ADD_CONE) + +class HiddenCatcher(wxFrame): + """ + The "catcher" frame in the second thread. + It is invisible. It's only job is to receive + Events from the main thread, and create + the appropriate windows. + """ + def __init__(self): + wxFrame.__init__(self, NULL,-1,'') + EVT_ADD_CONE(self, self.AddCone) + + def AddCone(self,evt): + add_cone() +#--------------------------------------------------------------------------- +class SecondThreadApp(wxApp): + """ + wxApp that lives in the second thread. + """ + def OnInit(self): + catcher = HiddenCatcher() + #self.SetTopWindow(catcher) + self.catcher =catcher + return true +#--------------------------------------------------------------------------- + +def add_cone(): + frame = VtkFrame(NULL, -1, "Cone") + frame.Show(true) diff --git a/utils/wxPython/demo/widgetTest.py b/wxPython/demo/widgetTest.py similarity index 100% rename from utils/wxPython/demo/widgetTest.py rename to wxPython/demo/widgetTest.py diff --git a/utils/wxPython/demo/wxButton.py b/wxPython/demo/wxButton.py similarity index 100% rename from utils/wxPython/demo/wxButton.py rename to wxPython/demo/wxButton.py diff --git a/utils/wxPython/demo/wxCalendar.py b/wxPython/demo/wxCalendar.py similarity index 57% rename from utils/wxPython/demo/wxCalendar.py rename to wxPython/demo/wxCalendar.py index eda9cd341a..ca61fa2091 100644 --- a/utils/wxPython/demo/wxCalendar.py +++ b/wxPython/demo/wxCalendar.py @@ -1,18 +1,16 @@ -#! /usr/local/bin/python #---------------------------------------------------------------------------- -# Name: CalendPanel.py -# Purpose: Calendar control display testing on panel +# Name: wxCalendar.py +# Purpose: Calendar control display testing on panel for wxPython demo # # Author: Lorne White (email: lwhite1@planet.eon.net) # # Created: -# Version 0.5 1999/11/03 +# Version 0.8 2000/04/16 # Licence: wxWindows license #---------------------------------------------------------------------------- from wxPython.wx import * -from wxPython.lib.calendar import wxCalendar, Month - +from wxPython.lib.calendar import wxCalendar, Month, PrtCalDraw import os dir_path = os.getcwd() @@ -45,10 +43,11 @@ def GetMonthList(): return monthlist class TestPanel(wxPanel): - def __init__(self, parent, log): + def __init__(self, parent, log, frame): wxPanel.__init__(self, parent, -1) self.log = log + self.frame = frame self.calend = wxCalendar(self, -1, wxPoint(100, 50), wxSize(200, 180)) @@ -69,8 +68,9 @@ class TestPanel(wxPanel): # set attributes of calendar - self.calend.HideTitle() + self.calend.hide_title = TRUE self.calend.HideGrid() + self.calend.SetWeekColor('WHITE', 'BLACK') # display routine @@ -98,7 +98,7 @@ class TestPanel(wxPanel): # button for calendar dialog test - wxStaticText(self, -1, "Test Calendar Dialog", wxPoint(350, 50)).SetBackgroundColour(wxNamedColour('Red')) + wxStaticText(self, -1, "Test Calendar Dialog", wxPoint(350, 50), wxSize(150, -1)) bmp = wxBitmap('bitmaps/Calend.bmp', wxBITMAP_TYPE_BMP) self.but = wxBitmapButton(self, 60, bmp, wxPoint(380, 80))#, wxSize(30, 30)) @@ -106,12 +106,18 @@ class TestPanel(wxPanel): # button for calendar window test - wxStaticText(self, -1, "Test Calendar Window", wxPoint(350, 150)).SetBackgroundColour(wxNamedColour('Blue')) + wxStaticText(self, -1, "Test Calendar Window", wxPoint(350, 150), wxSize(150, -1)) bmp = wxBitmap('bitmaps/Calend.bmp', wxBITMAP_TYPE_BMP) self.but = wxBitmapButton(self, 160, bmp, wxPoint(380, 180))#, wxSize(30, 30)) EVT_BUTTON(self, 160, self.TestFrame) + wxStaticText(self, -1, "Test Calendar Print", wxPoint(350, 250), wxSize(150, -1)) + + bmp = wxBitmap('bitmaps/Calend.bmp', wxBITMAP_TYPE_BMP) + self.but = wxBitmapButton(self, 170, bmp, wxPoint(380, 280))#, wxSize(30, 30)) + EVT_BUTTON(self, 170, self.OnPreview) + # calendar dialog def TestDlg(self, event): @@ -127,6 +133,15 @@ class TestPanel(wxPanel): frame.Show(true) return true +# calendar print preview + + def OnPreview(self, event): + month = self.calend.GetMonth() + year = self.calend.GetYear() + + prt = PrintCalend(self.frame, month, year) + prt.Preview() + # month and year control events def OnSpin(self, event): @@ -160,8 +175,6 @@ class TestPanel(wxPanel): text = '%s CLICK %02d/%02d/%d' % (evt.click, evt.day, evt.month, evt.year) # format date self.log.WriteText('Date Selected: ' + text + '\n') - def OnCloseWindow(self, event): - self.Destroy() # set the highlighted days for the calendar @@ -172,6 +185,7 @@ class TestPanel(wxPanel): except: set_days = [1, 5, 12] + self.calend.AddSelect([4, 11], 'BLUE', 'WHITE') self.calend.SetSelDay(set_days) self.calend.Refresh() @@ -219,7 +233,7 @@ class CalenDlg(wxDialog): # alternate spin button to control the month h = self.date.GetSize().height - self.m_spin = wxSpinButton(self, 120, wxPoint(130, 20), wxSize(h*2, h), wxSP_VERTICAL) + self.m_spin = wxSpinButton(self, 120, wxPoint(120, 20), wxSize(h*2, h), wxSP_VERTICAL) self.m_spin.SetRange(1, 12) self.m_spin.SetValue(start_month) @@ -243,6 +257,8 @@ class CalenDlg(wxDialog): self.calend.SetYear(start_year) self.calend.HideTitle() + self.calend.ShowWeekEnd() + self.ResetDisplay() self.Connect(self.calend.GetId(), -1, 2100, self.MouseClick) @@ -260,9 +276,10 @@ class CalenDlg(wxDialog): def OnMonthSpin(self, event): month = event.GetPosition() - self.date.SetValue(Month[month]) - self.calend.SetMonth(month) - self.calend.Refresh() + if month >= 0 and month <= 12: + self.date.SetValue(Month[month]) + self.calend.SetMonth(month) + self.calend.Refresh() def OnYrSpin(self, event): year = event.GetPosition() @@ -288,6 +305,8 @@ class CalenDlg(wxDialog): except: set_days = [1, 5, 12] + self.calend.AddSelect([4, 11], 'BLUE', 'WHITE') + self.calend.SetSelDay(set_days) self.calend.Refresh() @@ -296,6 +315,7 @@ class CalenDlg(wxDialog): class CalendFrame(wxFrame): def __init__(self, parent, id, title, log): wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition, wxSize(400, 400)) + EVT_CLOSE(self, self.OnCloseWindow) self.log = log self.CreateStatusBar() @@ -311,6 +331,9 @@ class CalendFrame(wxFrame): self.calend = wxCalendar(self, -1) self.calend.SetCurrentDay() self.calend.grid_color = 'BLUE' + self.calend.SetBusType() +# self.calend.ShowWeekEnd() + self.ResetDisplay() self.Connect(self.calend.GetId(), -1, 2100, self.MouseClick) @@ -329,6 +352,8 @@ class CalendFrame(wxFrame): except: set_days = [1, 5, 12] + self.calend.AddSelect([2, 16], 'GREEN', 'WHITE') + self.calend.SetSelDay(set_days) self.calend.Refresh() @@ -392,11 +417,263 @@ class CalendFrame(wxFrame): tb.Realize() +#--------------------------------------------------------------------------- + +# example class for printing/previewing calendars + +class PrintCalend: + def __init__(self, parent, month, year): + self.frame = parent + self.month = month + self.year = year + + self.SetParms() + self.SetCal() + self.printData = wxPrintData() + + def SetCal(self): + self.grid_color = 'BLUE' + self.back_color = 'WHITE' + self.sel_color = 'RED' + self.high_color = 'LIGHT BLUE' + self.font = wxSWISS + self.bold = wxNORMAL + + self.sel_key = None # last used by + self.sel_lst = [] # highlighted selected days + + self.size = None + self.hide_title = FALSE + self.hide_grid = FALSE + self.set_day = None + + def SetParms(self): + self.ymax = 1 + self.xmax = 1 + self.page = 1 + self.total_pg = 1 + + self.preview = None + self.scale = 1.0 + + self.pagew = 8.5 + self.pageh = 11.0 + + self.txt_marg = 0.1 + self.lf_marg = 0 + self.top_marg = 0 + + self.page = 0 + + def SetDates(self, month, year): + self.month = month + self.year = year + + def SetStyleDef(self, desc): + self.style = desc + + def SetCopies(self, copies): # number of copies of label + self.copies = copies + + def SetStart(self, start): # start position of label + self.start = start + + def Preview(self): + printout = SetPrintout(self) + printout2 = SetPrintout(self) + self.preview = wxPrintPreview(printout, printout2, self.printData) + if not self.preview.Ok(): + wxMessageBox("There was a problem printing!", "Printing", wxOK) + return + + self.preview.SetZoom(60) # initial zoom value + + frame = wxPreviewFrame(self.preview, self.frame, "Print preview") + + frame.Initialize() + frame.SetPosition(self.frame.GetPosition()) + frame.SetSize(self.frame.GetSize()) + frame.Show(true) + + def Print(self): + pdd = wxPrintDialogData() + pdd.SetPrintData(self.printData) + printer = wxPrinter(pdd) + printout = SetPrintout(self) + frame = wxFrame(NULL, -1, "Test") + if not printer.Print(frame, printout): + wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK) + else: + self.printData = printer.GetPrintDialogData().GetPrintData() + printout.Destroy() + + def DoDrawing(self, DC): + size = DC.GetSizeTuple() + DC.BeginDrawing() + + cal = PrtCalDraw(self) + + if self.preview is None: + cal.SetPSize(size[0]/self.pagew, size[1]/self.pageh) + cal.SetPreview(FALSE) + + else: + if self.preview == 1: + cal.SetPSize(size[0]/self.pagew, size[1]/self.pageh) + else: + cal.SetPSize(self.pwidth, self.pheight) + + cal.SetPreview(self.preview) + + cal.hide_title = self.hide_title # set the calendar parameters + cal.hide_grid = self.hide_grid + + cal.grid_color = self.grid_color + cal.high_color = self.high_color + cal.back_color = self.back_color + cal.outer_border = FALSE + cal.font = self.font + cal.bold = self.bold + + cal_size = wxSize(3.0, 3.0) + cal.SetSize(cal_size) + + year, month = self.year, self.month + + x = 1.0 + for i in range(2): + y = 0.5 + for j in range(3): + cal.SetCal(year, month) # current month + cal.SetPos(x, y) + + try: + set_days = test_days[month] + except: + set_days = [1, 5, 12] + + cal.AddSelect([2, 16], 'GREEN', 'WHITE') + + cal.DrawCal(DC, set_days) + + year, month = self.IncMonth(year, month) + y = y + 3.5 + x = x + 4.0 # next colum + + DC.EndDrawing() + + self.ymax = DC.MaxY() + self.xmax = DC.MaxX() + + def IncMonth(self, year, month): # next month + month = month + 1 + if month > 12: + month = 1 + year = year + 1 + + return year, month + + def GetTotalPages(self): + self.pg_cnt = 1 + return self.pg_cnt + + def SetPage(self, page): + self.page = page + + def SetPageSize(self, width, height): + self.pwidth, self.pheight = width, height + + def SetTotalSize(self, width, height): + self.ptwidth, self.ptheight = width, height + + def SetPreview(self, preview, scale): + self.preview = preview + self.scale = scale + + def SetTotalSize(self, width, height): + self.ptwidth = width + self.ptheight = height + def SetToolPath(self, tb, id, bmp, title): global dir_path tb.AddSimpleTool(id, wxBitmap(os.path.join(dir_path, bmp), wxBITMAP_TYPE_BMP), title, title) +class SetPrintout(wxPrintout): + def __init__(self, canvas): + wxPrintout.__init__(self) + self.canvas = canvas + self.end_pg = 1 + + def OnBeginDocument(self, start, end): + return self.base_OnBeginDocument(start, end) + + def OnEndDocument(self): + self.base_OnEndDocument() + + def HasPage(self, page): + if page <= self.end_pg: + return true + else: + return false + + def GetPageInfo(self): + self.end_pg = self.canvas.GetTotalPages() + str_pg = 1 + try: + end_pg = self.end_pg + except: + end_pg = 1 + return (str_pg, end_pg, str_pg, end_pg) + + def OnPreparePrinting(self): + self.base_OnPreparePrinting() + + def OnBeginPrinting(self): + dc = self.GetDC() + + self.preview = self.IsPreview() + if (self.preview): + self.pixelsPerInch = self.GetPPIScreen() + else: + self.pixelsPerInch = self.GetPPIPrinter() + + (w, h) = dc.GetSizeTuple() + scaleX = float(w) / 1000 + scaleY = float(h) / 1000 + self.printUserScale = min(scaleX, scaleY) + + self.base_OnBeginPrinting() + + def GetSize(self): + self.psizew, self.psizeh = self.GetPPIPrinter() + return self.psizew, self.psizeh + + def GetTotalSize(self): + self.ptsizew, self.ptsizeh = self.GetPageSizePixels() + return self.ptsizew, self.ptsizeh + + def OnPrintPage(self, page): + dc = self.GetDC() + (w, h) = dc.GetSizeTuple() + scaleX = float(w) / 1000 + scaleY = float(h) / 1000 + self.printUserScale = min(scaleX, scaleY) + dc.SetUserScale(self.printUserScale, self.printUserScale) + + self.preview = self.IsPreview() + + self.canvas.SetPreview(self.preview, self.printUserScale) + self.canvas.SetPage(page) + + self.ptsizew, self.ptsizeh = self.GetPageSizePixels() + self.canvas.SetTotalSize(self.ptsizew, self.ptsizeh) + + self.psizew, self.psizeh = self.GetPPIPrinter() + self.canvas.SetPageSize(self.psizew, self.psizeh) + + self.canvas.DoDrawing(dc) + return true class MyApp(wxApp): def OnInit(self): @@ -426,16 +703,18 @@ if __name__ == '__main__': #--------------------------------------------------------------------------- def runTest(frame, nb, log): - win = TestPanel(nb, log) + win = TestPanel(nb, log, frame) return win #--------------------------------------------------------------------------- overview = """\ -This control provides a calendar control class for displaying and selecting dates. +This control provides a calendar control class for displaying and selecting dates. In addition, the class is extended and can now be used for printing/previewing. + +Additional features include weekend highlighting and business type Monday-Sunday format. -See example for various methods used to set display month, year, and highlighted dates (different colour). +See example for various methods used to set display month, year, and highlighted dates (different font and background colours). by Lorne White diff --git a/wxPython/demo/wxCalendarCtrl.py b/wxPython/demo/wxCalendarCtrl.py new file mode 100644 index 0000000000..b38be582b4 --- /dev/null +++ b/wxPython/demo/wxCalendarCtrl.py @@ -0,0 +1,40 @@ + +from wxPython.wx import * +from wxPython.calendar import * +from wxPython.utils import * + +#---------------------------------------------------------------------- + +class TestPanel(wxPanel): + def __init__(self, parent, ID, log): + wxPanel.__init__(self, parent, ID) + self.log = log + + cal = wxCalendarCtrl(self, 101, wxDateTime_Now(), pos = (25,50), + style = wxCAL_SHOW_HOLIDAYS | wxCAL_SUNDAY_FIRST) + + EVT_CALENDAR(self, 101, self.OnCalSelected) + + + def OnCalSelected(self, evt): + self.log.write('OnCalSelected: %s\n' % evt.GetDate()) + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = TestPanel(nb, -1, log) + return win + +#---------------------------------------------------------------------- + + +overview = """\ +<html><body> +<h2>wxCalendarCtrl</h2> + +Yet <i>another</i> calendar control. This one is a wrapper around the C++ +version described in the docs. This one will probably be a bit more efficient +than the one in wxPython.lib.calendar, but I like a few things about it better, +so I think both will stay in wxPython. +""" diff --git a/utils/wxPython/demo/wxCheckBox.py b/wxPython/demo/wxCheckBox.py similarity index 100% rename from utils/wxPython/demo/wxCheckBox.py rename to wxPython/demo/wxCheckBox.py diff --git a/utils/wxPython/demo/wxCheckListBox.py b/wxPython/demo/wxCheckListBox.py similarity index 100% rename from utils/wxPython/demo/wxCheckListBox.py rename to wxPython/demo/wxCheckListBox.py diff --git a/utils/wxPython/demo/wxChoice.py b/wxPython/demo/wxChoice.py similarity index 100% rename from utils/wxPython/demo/wxChoice.py rename to wxPython/demo/wxChoice.py diff --git a/utils/wxPython/demo/wxColourDialog.py b/wxPython/demo/wxColourDialog.py similarity index 100% rename from utils/wxPython/demo/wxColourDialog.py rename to wxPython/demo/wxColourDialog.py diff --git a/utils/wxPython/demo/wxComboBox.py b/wxPython/demo/wxComboBox.py similarity index 94% rename from utils/wxPython/demo/wxComboBox.py rename to wxPython/demo/wxComboBox.py index b4b3112f05..f3f8de8176 100644 --- a/utils/wxPython/demo/wxComboBox.py +++ b/wxPython/demo/wxComboBox.py @@ -18,11 +18,15 @@ class TestComboBox(wxPanel): wxComboBox(self, 500, "default value", wxPoint(80, 50), wxSize(95, -1), sampleList, wxCB_DROPDOWN) EVT_COMBOBOX(self, 500, self.EvtComboBox) + EVT_TEXT(self, 500, self.EvtText) def EvtComboBox(self, event): self.log.WriteText('EvtComboBox: %s\n' % event.GetString()) + def EvtText(self, event): + self.log.WriteText('EvtText: %s\n' % event.GetString()) + #--------------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/utils/wxPython/demo/wxDialog.py b/wxPython/demo/wxDialog.py similarity index 100% rename from utils/wxPython/demo/wxDialog.py rename to wxPython/demo/wxDialog.py diff --git a/utils/wxPython/demo/wxDirDialog.py b/wxPython/demo/wxDirDialog.py similarity index 100% rename from utils/wxPython/demo/wxDirDialog.py rename to wxPython/demo/wxDirDialog.py diff --git a/wxPython/demo/wxDragImage.py b/wxPython/demo/wxDragImage.py new file mode 100644 index 0000000000..19985b7dd3 --- /dev/null +++ b/wxPython/demo/wxDragImage.py @@ -0,0 +1,249 @@ + +from wxPython.wx import * + +#---------------------------------------------------------------------- + +class DragShape: + def __init__(self, bmp): + self.bmp = bmp + self.pos = wxPoint(0,0) + self.shown = true + self.text = None + self.fullscreen = false + + + def HitTest(self, pt): + rect = self.GetRect() + return rect.Inside(pt.x, pt.y) + + + def GetRect(self): + return wxRect(self.pos.x, self.pos.y, + self.bmp.GetWidth(), self.bmp.GetHeight()) + + + def Draw(self, dc, op = wxCOPY): + if self.bmp.Ok(): + memDC = wxMemoryDC() + memDC.SelectObject(self.bmp) + + dc.Blit(self.pos.x, self.pos.y, + self.bmp.GetWidth(), self.bmp.GetHeight(), + memDC, 0, 0, op, true) + + return true + else: + return false + + + +#---------------------------------------------------------------------- + +class DragCanvas(wxScrolledWindow): + def __init__(self, parent, ID): + wxScrolledWindow.__init__(self, parent, ID) + self.shapes = [] + self.dragImage = None + self.dragShape = None + + self.SetCursor(wxStockCursor(wxCURSOR_ARROW)) + self.bg_bmp = wxBitmap('bitmaps/backgrnd.png', wxBITMAP_TYPE_PNG) + + + # Make a shape from an image and mask. This one will demo + # dragging outside the window + bmp = wxBitmap('bitmaps/test_image.png', wxBITMAP_TYPE_PNG) + mask = wxMaskColour(bmp, wxWHITE) + bmp.SetMask(mask) + shape = DragShape(bmp) + shape.pos = wxPoint(5, 5) + shape.fullscreen = true + self.shapes.append(shape) + + + # Make a shape from some text + text = "Some Text" + font = wxFont(15, wxROMAN, wxNORMAL, wxBOLD) + textExtent = self.GetFullTextExtent(text, font) + bmp = wxEmptyBitmap(textExtent[0], textExtent[1]) + dc = wxMemoryDC() + dc.SelectObject(bmp) + dc.Clear() + dc.SetTextForeground(wxRED) + dc.SetFont(font) + dc.DrawText(text, 0, 0) + dc.SelectObject(wxNullBitmap) + del dc + mask = wxMaskColour(bmp, wxWHITE) + bmp.SetMask(mask) + shape = DragShape(bmp) + shape.pos = wxPoint(5, 100) + shape.text = "Some dragging text" + self.shapes.append(shape) + + + # Make some shapes from some playing card images. + x = 200 + for card in ['01c.gif', '10s.gif', '12h.gif', '13d.gif']: + bmp = wxBitmap('bitmaps/'+card, wxBITMAP_TYPE_GIF) + shape = DragShape(bmp) + shape.pos = wxPoint(x, 5) + self.shapes.append(shape) + x = x + 80 + + + EVT_ERASE_BACKGROUND(self, self.OnEraseBackground) + EVT_PAINT(self, self.OnPaint) + EVT_LEFT_DOWN(self, self.OnLeftDown) + EVT_LEFT_UP(self, self.OnLeftUp) + EVT_MOTION(self, self.OnMotion) + + + + def TileBackground(self, dc): + # tile the background bitmap + sz = self.GetClientSize() + w = self.bg_bmp.GetWidth() + h = self.bg_bmp.GetHeight() + + x = 0 + while x < sz.width: + y = 0 + while y < sz.height: + dc.DrawBitmap(self.bg_bmp, x, y) + y = y + h + x = x + w + + + def DrawShapes(self, dc): + for shape in self.shapes: + if shape.shown: + shape.Draw(dc) + + + def FindShape(self, pt): + for shape in self.shapes: + if shape.HitTest(pt): + return shape + return None + + + def EraseShape(self, shape, dc): + r = shape.GetRect() + dc.SetClippingRegion(r.x, r.y, r.width, r.height) + self.TileBackground(dc) + self.DrawShapes(dc) + dc.DestroyClippingRegion() + + + + + def OnEraseBackground(self, evt): + dc = evt.GetDC() + if not dc: + dc = wxClientDC(self) + self.TileBackground(dc) + + + def OnPaint(self, evt): + dc = wxPaintDC(self) + self.PrepareDC(dc) + self.DrawShapes(dc) + + + def OnLeftDown(self, evt): + shape = self.FindShape(evt.GetPosition()) + if shape: + # get ready to start dragging, but wait for the user to + # move it a bit first + self.dragShape = shape + self.dragStartPos = evt.GetPosition() + + + def OnLeftUp(self, evt): + if not self.dragImage or not self.dragShape: + self.dragImage = None + self.dragShape = None + return + + # end the dragging + self.dragImage.Hide() + self.dragImage.EndDrag() + self.dragImage = None + + # reposition and draw the shape + pt = evt.GetPosition() + newPos = wxPoint(self.dragShape.pos.x + (pt.x - self.dragStartPos.x), + self.dragShape.pos.y + (pt.y - self.dragStartPos.y)) + + dc = wxClientDC(self) + self.dragShape.pos = newPos + self.dragShape.shown = true + self.dragShape.Draw(dc) + self.dragShape = None + + + def OnMotion(self, evt): + if not self.dragShape or not evt.Dragging() or not evt.LeftIsDown(): + return + + # if we have a shape, but havn't started dragging yet + if self.dragShape and not self.dragImage: + + # only start the drag after having moved a couple pixels + tolerance = 4 + pt = evt.GetPosition() + dx = abs(pt.x - self.dragStartPos.x) + dy = abs(pt.y - self.dragStartPos.y) + if dx <= tolerance and dy <= tolerance: + return + + if self.dragShape.text: + self.dragImage = wxDragString(self.dragShape.text, + wxStockCursor(wxCURSOR_HAND)) + else: + self.dragImage = wxDragImage(self.dragShape.bmp, + wxStockCursor(wxCURSOR_HAND)) + + newPos = wxPoint(self.dragShape.pos.x + (pt.x - self.dragStartPos.x), + self.dragShape.pos.y + (pt.y - self.dragStartPos.y)) + + if self.dragShape.fullscreen: + newPos = self.ClientToScreen(newPos) + self.dragImage.BeginDrag((0,0), self, true) + else: + self.dragImage.BeginDrag((0,0), self) + + + # erase the shape since it will be drawn independently now + dc = wxClientDC(self) + self.dragShape.shown = false + self.EraseShape(self.dragShape, dc) + + self.dragImage.Move(newPos) + self.dragImage.Show() + + + # if we have shape and image then move it. + elif self.dragShape and self.dragImage: + pt = evt.GetPosition() + newPos = wxPoint(self.dragShape.pos.x + (pt.x - self.dragStartPos.x), + self.dragShape.pos.y + (pt.y - self.dragStartPos.y)) + if self.dragShape.fullscreen: + newPos = self.ClientToScreen(newPos) + + self.dragImage.Move(newPos) + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = DragCanvas(nb, -1) + return win + +#---------------------------------------------------------------------- + + + +overview = """\ +""" diff --git a/utils/wxPython/demo/wxEditor.py b/wxPython/demo/wxEditor.py similarity index 100% rename from utils/wxPython/demo/wxEditor.py rename to wxPython/demo/wxEditor.py diff --git a/utils/wxPython/demo/wxFileDialog.py b/wxPython/demo/wxFileDialog.py similarity index 92% rename from utils/wxPython/demo/wxFileDialog.py rename to wxPython/demo/wxFileDialog.py index 0287f4ccd5..476efcf8bd 100644 --- a/utils/wxPython/demo/wxFileDialog.py +++ b/wxPython/demo/wxFileDialog.py @@ -4,9 +4,10 @@ from wxPython.wx import * #--------------------------------------------------------------------------- def runTest(frame, nb, log): - dlg = wxFileDialog(frame, "Choose a file", ".", "", "*.*", wxOPEN) + dlg = wxFileDialog(frame, "Choose a file", ".", "", "*.*", wxOPEN|wxMULTIPLE) if dlg.ShowModal() == wxID_OK: - log.WriteText('You selected: %s\n' % dlg.GetPath()) + for path in dlg.GetPaths(): + log.WriteText('You selected: %s\n' % path) dlg.Destroy() #--------------------------------------------------------------------------- diff --git a/utils/wxPython/demo/wxFloatBar.py b/wxPython/demo/wxFloatBar.py similarity index 98% rename from utils/wxPython/demo/wxFloatBar.py rename to wxPython/demo/wxFloatBar.py index 0936ac224d..4d0547bd51 100644 --- a/utils/wxPython/demo/wxFloatBar.py +++ b/wxPython/demo/wxFloatBar.py @@ -49,6 +49,7 @@ class TestFloatBar(wxFrame): tb.Realize() self.tb = tb + EVT_CLOSE(self, self.OnCloseWindow) def OnCloseWindow(self, event): diff --git a/utils/wxPython/demo/wxFontDialog.py b/wxPython/demo/wxFontDialog.py similarity index 100% rename from utils/wxPython/demo/wxFontDialog.py rename to wxPython/demo/wxFontDialog.py diff --git a/utils/wxPython/demo/wxFrame.py b/wxPython/demo/wxFrame.py similarity index 95% rename from utils/wxPython/demo/wxFrame.py rename to wxPython/demo/wxFrame.py index e0fc080954..9b96b2b7ba 100644 --- a/utils/wxPython/demo/wxFrame.py +++ b/wxPython/demo/wxFrame.py @@ -11,6 +11,8 @@ class MyFrame(wxFrame): button = wxButton(panel, 1003, "Close Me") button.SetPosition(wxPoint(15, 15)) EVT_BUTTON(self, 1003, self.OnCloseMe) + EVT_CLOSE(self, self.OnCloseWindow) + def OnCloseMe(self, event): self.Close(true) diff --git a/utils/wxPython/demo/wxGLCanvas.py b/wxPython/demo/wxGLCanvas.py similarity index 97% rename from utils/wxPython/demo/wxGLCanvas.py rename to wxPython/demo/wxGLCanvas.py index 2da77bfa2a..d6266f5814 100644 --- a/utils/wxPython/demo/wxGLCanvas.py +++ b/wxPython/demo/wxGLCanvas.py @@ -59,6 +59,8 @@ else: def __init__(self, parent): wxGLCanvas.__init__(self, parent, -1) EVT_ERASE_BACKGROUND(self, self.OnEraseBackground) + EVT_SIZE(self, self.OnSize) + EVT_PAINT(self, self.OnPaint) self.init = false def OnEraseBackground(self, event): @@ -148,6 +150,8 @@ else: def __init__(self, parent): wxGLCanvas.__init__(self, parent, -1) EVT_ERASE_BACKGROUND(self, self.OnEraseBackground) + EVT_SIZE(self, self.OnSize) + EVT_PAINT(self, self.OnPaint) self.init = false def OnEraseBackground(self, event): diff --git a/utils/wxPython/demo/wxGauge.py b/wxPython/demo/wxGauge.py similarity index 100% rename from utils/wxPython/demo/wxGauge.py rename to wxPython/demo/wxGauge.py diff --git a/wxPython/demo/wxGrid.py b/wxPython/demo/wxGrid.py new file mode 100644 index 0000000000..1e3b81606d --- /dev/null +++ b/wxPython/demo/wxGrid.py @@ -0,0 +1,100 @@ + +from wxPython.wx import * + +#--------------------------------------------------------------------------- + +buttonDefs = { + 814 : ('GridSimple', 'Simple wxGrid, catching all events'), + 815 : ('GridStdEdRend', 'wxGrid showing Editors and Renderers'), + 818 : ('GridHugeTable', 'A wxGrid with a HUGE table (100 MILLION cells!)'), + 817 : ('GridCustTable', 'wxGrid using a custom Table, with non-string data'), + 819 : ('GridEnterHandler', 'Remapping keys to behave differently'), + } + + +class ButtonPanel(wxPanel): + def __init__(self, parent, log): + wxPanel.__init__(self, parent, -1) + self.log = log + + box = wxBoxSizer(wxVERTICAL) + box.Add(20, 30) + keys = buttonDefs.keys() + keys.sort() + for k in keys: + text = buttonDefs[k][1] + btn = wxButton(self, k, text) + box.Add(btn, 0, wxALIGN_CENTER|wxALL, 15) + EVT_BUTTON(self, k, self.OnButton) + + self.SetAutoLayout(true) + self.SetSizer(box) + + + def OnButton(self, evt): + modName = buttonDefs[evt.GetId()][0] + module = __import__(modName) + frame = module.TestFrame(self, self.log) + frame.Show(true) + + +#--------------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = ButtonPanel(nb, log) + return win + +#--------------------------------------------------------------------------- + + + + + + + + + + +overview = """\ +<html><body> +<h2>wxGrid</h2> + +This demo shows various ways of using the <b><i>new and +improved</i></b> wxGrid class. Unfortunatly it has not been +documented yet, and while it is somewhat backwards compatible, if you +try to go by the current wxGrid documentation you will probably just +confuse yourself. +<p> +You can look at the sources for these samples to learn a lot about how +the new classes work. +<p><ol> +<li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows +how to catch all the various events. + +<p> +<li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that +uses non-default Cell Editors and Cell Renderers. + +<p> +<li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that +uses a non-default Grid Table. This table is read-only and simply +generates on the fly a unique string for each cell. + +<p> +<li><a href="GridCustTable.py">GridCustTable.py</a> This grid +shows how to deal with tables that have non-string data, and how Cell +Editors and Cell Renderers are automatically chosen based on the data +type. + +<p> +<li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one +changes how the ENTER key works, moving the current cell left to right +and wrapping around to the next row when needed. +</ol> +<p> +You can also look at the <a href="data/grid.i">SWIG interface +file</a> used to generate the grid module for a lot more clues as to +how things work. + +""" + diff --git a/utils/wxPython/demo/wxHtmlWindow.py b/wxPython/demo/wxHtmlWindow.py similarity index 100% rename from utils/wxPython/demo/wxHtmlWindow.py rename to wxPython/demo/wxHtmlWindow.py diff --git a/utils/wxPython/demo/wxImage.py b/wxPython/demo/wxImage.py similarity index 100% rename from utils/wxPython/demo/wxImage.py rename to wxPython/demo/wxImage.py diff --git a/utils/wxPython/demo/wxLayoutConstraints.py b/wxPython/demo/wxLayoutConstraints.py similarity index 100% rename from utils/wxPython/demo/wxLayoutConstraints.py rename to wxPython/demo/wxLayoutConstraints.py diff --git a/utils/wxPython/demo/wxListBox.py b/wxPython/demo/wxListBox.py similarity index 100% rename from utils/wxPython/demo/wxListBox.py rename to wxPython/demo/wxListBox.py diff --git a/utils/wxPython/demo/wxListCtrl.py b/wxPython/demo/wxListCtrl.py similarity index 99% rename from utils/wxPython/demo/wxListCtrl.py rename to wxPython/demo/wxListCtrl.py index fd521a8bb5..4374d82d33 100644 --- a/utils/wxPython/demo/wxListCtrl.py +++ b/wxPython/demo/wxListCtrl.py @@ -63,7 +63,7 @@ class TestListCtrlPanel(wxPanel): wxPanel.__init__(self, parent, -1) self.log = log - tID = NewId() + tID = wxNewId() self.il = wxImageList(16, 16) idx1 = self.il.Add(wxBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP)) @@ -93,6 +93,7 @@ class TestListCtrlPanel(wxPanel): self.list.SetItemState(5, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED) self.currentItem = 0 + EVT_SIZE(self, self.OnSize) EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected) EVT_LIST_DELETE_ITEM(self, tID, self.OnItemDelete) EVT_LIST_COL_CLICK(self, tID, self.OnColClick) diff --git a/utils/wxPython/demo/wxMVCTree.py b/wxPython/demo/wxMVCTree.py similarity index 100% rename from utils/wxPython/demo/wxMVCTree.py rename to wxPython/demo/wxMVCTree.py diff --git a/utils/wxPython/demo/wxMask.py b/wxPython/demo/wxMask.py similarity index 97% rename from utils/wxPython/demo/wxMask.py rename to wxPython/demo/wxMask.py index 168aec2bc7..7f93f01901 100644 --- a/utils/wxPython/demo/wxMask.py +++ b/wxPython/demo/wxMask.py @@ -51,8 +51,9 @@ class TestMaskWindow(wxScrolledWindow): mask = wxMaskColour(self.bmp_withcolourmask, wxWHITE) self.bmp_withcolourmask.SetMask(mask) - self.SetScrollbars(20, 20, 600/20, 460/20) + self.SetScrollbars(20, 20, 700/20, 460/20) + EVT_PAINT(self, self.OnPaint) def OnPaint (self, e): diff --git a/utils/wxPython/demo/wxMessageDialog.py b/wxPython/demo/wxMessageDialog.py similarity index 100% rename from utils/wxPython/demo/wxMessageDialog.py rename to wxPython/demo/wxMessageDialog.py diff --git a/utils/wxPython/demo/wxMiniFrame.py b/wxPython/demo/wxMiniFrame.py similarity index 95% rename from utils/wxPython/demo/wxMiniFrame.py rename to wxPython/demo/wxMiniFrame.py index ba9d7e527b..f3cd53a40a 100644 --- a/utils/wxPython/demo/wxMiniFrame.py +++ b/wxPython/demo/wxMiniFrame.py @@ -10,6 +10,7 @@ class MyMiniFrame(wxMiniFrame): button = wxButton(panel, 1003, "Close Me") button.SetPosition(wxPoint(15, 15)) EVT_BUTTON(self, 1003, self.OnCloseMe) + EVT_CLOSE(self, self.OnCloseWindow) def OnCloseMe(self, event): self.Close(true) diff --git a/utils/wxPython/demo/wxMultipleChoiceDialog.py b/wxPython/demo/wxMultipleChoiceDialog.py similarity index 100% rename from utils/wxPython/demo/wxMultipleChoiceDialog.py rename to wxPython/demo/wxMultipleChoiceDialog.py diff --git a/utils/wxPython/demo/wxNotebook.py b/wxPython/demo/wxNotebook.py similarity index 97% rename from utils/wxPython/demo/wxNotebook.py rename to wxPython/demo/wxNotebook.py index fb18f41b9a..00d2f5b9d0 100644 --- a/utils/wxPython/demo/wxNotebook.py +++ b/wxPython/demo/wxNotebook.py @@ -2,7 +2,7 @@ from wxPython.wx import * import ColorPanel -import wxGrid +import GridSimple import wxListCtrl import wxScrolledWindow @@ -31,7 +31,7 @@ class TestNB(wxNotebook): win = ColorPanel.ColoredPanel(self, wxGREEN) self.AddPage(win, "Green") - win = wxGrid.TestGrid(self, log) + win = GridSimple.SimpleGrid(self, log) self.AddPage(win, "Grid") win = wxListCtrl.TestListCtrlPanel(self, log) diff --git a/utils/wxPython/demo/wxOGL.py b/wxPython/demo/wxOGL.py similarity index 98% rename from utils/wxPython/demo/wxOGL.py rename to wxPython/demo/wxOGL.py index 8012b4873b..c963fdd847 100644 --- a/utils/wxPython/demo/wxOGL.py +++ b/wxPython/demo/wxOGL.py @@ -115,6 +115,10 @@ class TestWindow(wxShapeCanvas): def __init__(self, parent, log, frame): wxShapeCanvas.__init__(self, parent) + maxWidth = 1000 + maxHeight = 1000 + self.SetScrollbars(20, 20, maxWidth/20, maxHeight/20) + self.log = log self.frame = frame self.SetBackgroundColour(wxWHITE) diff --git a/utils/wxPython/demo/wxPageSetupDialog.py b/wxPython/demo/wxPageSetupDialog.py similarity index 100% rename from utils/wxPython/demo/wxPageSetupDialog.py rename to wxPython/demo/wxPageSetupDialog.py diff --git a/utils/wxPython/demo/wxPlotCanvas.py b/wxPython/demo/wxPlotCanvas.py similarity index 100% rename from utils/wxPython/demo/wxPlotCanvas.py rename to wxPython/demo/wxPlotCanvas.py diff --git a/utils/wxPython/demo/wxPrintDialog.py b/wxPython/demo/wxPrintDialog.py similarity index 100% rename from utils/wxPython/demo/wxPrintDialog.py rename to wxPython/demo/wxPrintDialog.py diff --git a/utils/wxPython/demo/wxProgressDialog.py b/wxPython/demo/wxProgressDialog.py similarity index 100% rename from utils/wxPython/demo/wxProgressDialog.py rename to wxPython/demo/wxProgressDialog.py diff --git a/utils/wxPython/demo/wxRadioBox.py b/wxPython/demo/wxRadioBox.py similarity index 100% rename from utils/wxPython/demo/wxRadioBox.py rename to wxPython/demo/wxRadioBox.py diff --git a/utils/wxPython/demo/wxSashWindow.py b/wxPython/demo/wxSashWindow.py similarity index 99% rename from utils/wxPython/demo/wxSashWindow.py rename to wxPython/demo/wxSashWindow.py index 446ffce9e4..93b8b98417 100644 --- a/utils/wxPython/demo/wxSashWindow.py +++ b/wxPython/demo/wxSashWindow.py @@ -17,6 +17,7 @@ class TestSashWindow(wxPanel): EVT_SASH_DRAGGED_RANGE(self, self.ID_WINDOW_TOP, self.ID_WINDOW_BOTTOM, self.OnSashDrag) + EVT_SIZE(self, self.OnSize) # Create some layout windows diff --git a/utils/wxPython/demo/wxScrolledMessageDialog.py b/wxPython/demo/wxScrolledMessageDialog.py similarity index 100% rename from utils/wxPython/demo/wxScrolledMessageDialog.py rename to wxPython/demo/wxScrolledMessageDialog.py diff --git a/utils/wxPython/demo/wxScrolledWindow.py b/wxPython/demo/wxScrolledWindow.py similarity index 94% rename from utils/wxPython/demo/wxScrolledWindow.py rename to wxPython/demo/wxScrolledWindow.py index 44b5f9fd93..8c9d2713ed 100644 --- a/utils/wxPython/demo/wxScrolledWindow.py +++ b/wxPython/demo/wxScrolledWindow.py @@ -12,9 +12,12 @@ class MyCanvas(wxScrolledWindow): self.maxHeight = 1000 self.SetBackgroundColour(wxNamedColor("WHITE")) - self.Connect(-1, -1, wxEVT_LEFT_DOWN, self.OnLeftButtonEvent) - self.Connect(-1, -1, wxEVT_LEFT_UP, self.OnLeftButtonEvent) - self.Connect(-1, -1, wxEVT_MOTION, self.OnLeftButtonEvent) + EVT_LEFT_DOWN(self, self.OnLeftButtonEvent) + EVT_LEFT_UP(self, self.OnLeftButtonEvent) + EVT_MOTION(self, self.OnLeftButtonEvent) + + EVT_PAINT(self, self.OnPaint) + self.SetCursor(wxStockCursor(wxCURSOR_PENCIL)) bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP) @@ -109,7 +112,6 @@ class MyCanvas(wxScrolledWindow): self.CaptureMouse() elif event.Dragging(): - print event.GetPosition() dc = wxClientDC(self) self.PrepareDC(dc) dc.BeginDrawing() diff --git a/utils/wxPython/demo/wxSingleChoiceDialog.py b/wxPython/demo/wxSingleChoiceDialog.py similarity index 100% rename from utils/wxPython/demo/wxSingleChoiceDialog.py rename to wxPython/demo/wxSingleChoiceDialog.py diff --git a/utils/wxPython/demo/wxSlider.py b/wxPython/demo/wxSlider.py similarity index 100% rename from utils/wxPython/demo/wxSlider.py rename to wxPython/demo/wxSlider.py diff --git a/utils/wxPython/demo/wxSpinButton.py b/wxPython/demo/wxSpinButton.py similarity index 100% rename from utils/wxPython/demo/wxSpinButton.py rename to wxPython/demo/wxSpinButton.py diff --git a/wxPython/demo/wxSpinCtrl.py b/wxPython/demo/wxSpinCtrl.py new file mode 100644 index 0000000000..7729b88b5d --- /dev/null +++ b/wxPython/demo/wxSpinCtrl.py @@ -0,0 +1,37 @@ + +from wxPython.wx import * + +import string + +#---------------------------------------------------------------------- + +class TestPanel(wxPanel): + def __init__(self, parent, log): + wxPanel.__init__(self, parent, -1) + self.log = log + self.count = 0 + + wxStaticText(self, -1, "This example uses the wxSpinCtrl control.", + wxPoint(45, 15)) + + sc = wxSpinCtrl(self, -1, "", wxPoint(30, 50), wxSize(80, -1)) + sc.SetRange(1,100) + sc.SetValue(5) + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = TestPanel(nb, log) + return win + +#---------------------------------------------------------------------- + + + + + + + +overview = """\ +""" diff --git a/utils/wxPython/demo/wxSplitterWindow.py b/wxPython/demo/wxSplitterWindow.py similarity index 100% rename from utils/wxPython/demo/wxSplitterWindow.py rename to wxPython/demo/wxSplitterWindow.py diff --git a/utils/wxPython/demo/wxStaticBitmap.py b/wxPython/demo/wxStaticBitmap.py similarity index 100% rename from utils/wxPython/demo/wxStaticBitmap.py rename to wxPython/demo/wxStaticBitmap.py diff --git a/utils/wxPython/demo/wxStaticText.py b/wxPython/demo/wxStaticText.py similarity index 100% rename from utils/wxPython/demo/wxStaticText.py rename to wxPython/demo/wxStaticText.py diff --git a/utils/wxPython/demo/wxStatusBar.py b/wxPython/demo/wxStatusBar.py similarity index 97% rename from utils/wxPython/demo/wxStatusBar.py rename to wxPython/demo/wxStatusBar.py index 97c32980eb..bdb016a1fa 100644 --- a/utils/wxPython/demo/wxStatusBar.py +++ b/wxPython/demo/wxStatusBar.py @@ -10,6 +10,7 @@ class CustomStatusBar(wxStatusBar): wxStatusBar.__init__(self, parent, -1) self.SetFieldsCount(3) self.log = log + EVT_SIZE(self, self.OnSize) self.SetStatusText("A Custom StatusBar...", 0) @@ -62,6 +63,7 @@ class TestCustomStatusBar(wxFrame): self.sb = CustomStatusBar(self, log) self.SetStatusBar(self.sb) + EVT_CLOSE(self, self.OnCloseWindow) def OnCloseWindow(self, event): self.sb.timer.Stop() diff --git a/wxPython/demo/wxStyledTextCtrl_1.py b/wxPython/demo/wxStyledTextCtrl_1.py new file mode 100644 index 0000000000..7fab856c7c --- /dev/null +++ b/wxPython/demo/wxStyledTextCtrl_1.py @@ -0,0 +1,186 @@ + +from wxPython.wx import * +from wxPython.stc import * + +#---------------------------------------------------------------------- + +demoText = """\ + +This editor is provided by a class named wxStyledTextCtrl. As +the name suggests, you can define styles that can be applied to +sections of text. This will typically be used for things like +syntax highlighting code editors, but I'm sure that there are other +applications as well. A style is a combination of font, point size, +forground and background colours. The editor can handle +proportional fonts just as easily as monospaced fonts, and various +styles can use different sized fonts. + +There are a few canned language lexers and colourizers included, +(see the next demo) or you can handle the colourization yourself. +If you do you can simply register an event handler and the editor +will let you know when the visible portion of the text needs +styling. + +wxStyledTextEditor also supports setting markers in the margin... + + + + +...and indicators within the text. You can use these for whatever +you want in your application. Cut, Copy, Paste, Drag and Drop of +text works, as well as virtually unlimited Undo and Redo +capabilities, (right click to try it out.) + +""" + +if wxPlatform == '__WXMSW__': + face1 = 'Arial' + face2 = 'Times New Roman' + face3 = 'Courier New' + pb = 6 +else: + face1 = 'Helvetica' + face2 = 'Times' + face3 = 'Courier' + pb = 10 + + +#---------------------------------------------------------------------- +# This shows how to catch the Modified event from the wxStyledTextCtrl + +class MySTC(wxStyledTextCtrl): + def __init__(self, parent, ID, log): + wxStyledTextCtrl.__init__(self, parent, ID) + self.log = log + + EVT_STC_MODIFIED(self, ID, self.OnModified) + + + def OnModified(self, evt): + self.log.write("""OnModified + Mod type: %s + At position: %d + Lines added: %d + Text Length: %d + Text: %s\n""" % ( self.transModType(evt.GetModificationType()), + evt.GetPosition(), + evt.GetLinesAdded(), + evt.GetLength(), + evt.GetText() )) + + def transModType(self, modType): + st = "" + table = [(wxSTC_MOD_INSERTTEXT, "InsertText"), + (wxSTC_MOD_DELETETEXT, "DeleteText"), + (wxSTC_MOD_CHANGESTYLE, "ChangeStyle"), + (wxSTC_MOD_CHANGEFOLD, "ChangeFold"), + (wxSTC_PERFORMED_USER, "UserFlag"), + (wxSTC_PERFORMED_UNDO, "Undo"), + (wxSTC_PERFORMED_REDO, "Redo"), + (wxSTC_LASTSTEPINUNDOREDO, "Last-Undo/Redo"), + (wxSTC_MOD_CHANGEMARKER, "ChangeMarker"), + (wxSTC_MOD_BEFOREINSERT, "B4-Insert"), + (wxSTC_MOD_BEFOREDELETE, "B4-Delete") + ] + + for flag,text in table: + if flag & modType: + st = st + text + " " + + if not st: + st = 'UNKNOWN' + + return st + + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + ed = MySTC(nb, -1, log) + + ed.SetText(demoText) + ed.EmptyUndoBuffer() + + # make some styles + ed.StyleSetSpec(wxSTC_STYLE_DEFAULT, "size:%d,face:%s" % (pb+2, face3)) + ed.StyleSetSpec(1, "size:%d,bold,face:%s,fore:#0000FF" % (pb+3, face1)) + ed.StyleSetSpec(2, "face:%s,italic,fore:#FF0000,size:%d" % (face2, pb+2)) + ed.StyleSetSpec(3, "face:%s,bold,size:%d" % (face2, pb+3)) + ed.StyleSetSpec(4, "face:%s,size:%d" % (face1, pb)) + + + # now set some text to those styles... Normally this would be + # done in an event handler that happens when text needs displayed. + ed.StartStyling(98, 0xff) + ed.SetStyleFor(6, 1) # set style for 6 characters using style 1 + + ed.StartStyling(190, 0xff) + ed.SetStyleFor(20, 2) + + ed.StartStyling(310, 0xff) + ed.SetStyleFor(4, 3) + ed.SetStyleFor(2, 0) + ed.SetStyleFor(10, 4) + + + # line numbers in the margin + ed.SetMarginType(0, wxSTC_MARGIN_NUMBER) + ed.SetMarginWidth(0, 22) + ed.StyleSetSpec(wxSTC_STYLE_LINENUMBER, "size:%d,face:%s" % (pb, face1)) + + # setup some markers + ed.SetMarginType(1, wxSTC_MARGIN_SYMBOL) + ed.MarkerDefine(0, wxSTC_MARK_ROUNDRECT, "#CCFF00", "RED") + ed.MarkerDefine(1, wxSTC_MARK_CIRCLE, "FOREST GREEN", "SIENNA") + ed.MarkerDefine(2, wxSTC_MARK_SHORTARROW, "blue", "blue") + ed.MarkerDefine(3, wxSTC_MARK_ARROW, "#00FF00", "#00FF00") + + # put some markers on some lines + ed.MarkerAdd(17, 0) + ed.MarkerAdd(18, 1) + ed.MarkerAdd(19, 2) + ed.MarkerAdd(20, 3) + ed.MarkerAdd(20, 0) + + + # and finally, an indicator or two + ed.IndicatorSetStyle(0, wxSTC_INDIC_SQUIGGLE) + ed.IndicatorSetColour(0, wxRED) + ed.IndicatorSetStyle(1, wxSTC_INDIC_DIAGONAL) + ed.IndicatorSetColour(1, wxBLUE) + ed.IndicatorSetStyle(2, wxSTC_INDIC_STRIKE) + ed.IndicatorSetColour(2, wxRED) + + ed.StartStyling(836, wxSTC_INDICS_MASK) + ed.SetStyleFor(10, wxSTC_INDIC0_MASK) + ed.SetStyleFor(10, wxSTC_INDIC1_MASK) + ed.SetStyleFor(10, wxSTC_INDIC2_MASK | wxSTC_INDIC1_MASK) + + + return ed + + + +#---------------------------------------------------------------------- + + +overview = """\ +<html><body> +Once again, no docs yet. <b>Sorry.</b> But <a href="data/stc.h">this</a> +and <a href="http://www.scintilla.org/ScintillaDoc.html">this</a> should +be helpful. +</body><html> +""" + + + +if __name__ == '__main__': + import sys + app = wxPySimpleApp() + frame = wxFrame(None, -1, "Tester...", size=(640, 480)) + win = runTest(frame, frame, sys.stdout) + frame.Show(true) + app.MainLoop() + + diff --git a/wxPython/demo/wxStyledTextCtrl_2.py b/wxPython/demo/wxStyledTextCtrl_2.py new file mode 100644 index 0000000000..c2c7ae4855 --- /dev/null +++ b/wxPython/demo/wxStyledTextCtrl_2.py @@ -0,0 +1,298 @@ + +from wxPython.wx import * +from wxPython.stc import * + +import keyword + +#---------------------------------------------------------------------- + +demoText = """\ +## This version of the editor has been set up to edit Python source +## code. Here is a copy of wxPython/demo/Main.py to play with. + + +""" + +#---------------------------------------------------------------------- + + +if wxPlatform == '__WXMSW__': + faces = { 'times': 'Times New Roman', + 'mono' : 'Courier New', + 'helv' : 'Arial', + 'other': 'Comic Sans MS', + 'size' : 8, + 'size2': 6, + } +else: + faces = { 'times': 'Times', + 'mono' : 'Courier', + 'helv' : 'Helvetica', + 'other': 'new century schoolbook', + 'size' : 11, + 'size2': 9, + } + + +#---------------------------------------------------------------------- + +class PythonSTC(wxStyledTextCtrl): + def __init__(self, parent, ID): + wxStyledTextCtrl.__init__(self, parent, ID) + + self.SetLexer(wxSTC_LEX_PYTHON) + self.SetKeywords(0, string.join(keyword.kwlist)) + + self.SetProperty("fold", "1") + self.SetProperty("tab.timmy.whinge.level", "1") + self.SetMargins(0,0) + + self.SetViewWhitespace(false) + #self.SetBufferedDraw(false) + + self.SetEdgeMode(wxSTC_EDGE_BACKGROUND) + self.SetEdgeColumn(78) + + # Setup a margin to hold fold markers + #self.SetFoldFlags(16) ### WHAT IS THIS VALUE? WHAT ARE THE OTHER FLAGS? DOES IT MATTER? + self.SetMarginType(2, wxSTC_MARGIN_SYMBOL) + self.SetMarginMask(2, wxSTC_MASK_FOLDERS) + self.SetMarginSensitive(2, true) + self.SetMarginWidth(2, 15) + self.MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_ARROW, "navy", "navy") + self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, "navy", "navy") + + + EVT_STC_UPDATEUI(self, ID, self.OnUpdateUI) + EVT_STC_MARGINCLICK(self, ID, self.OnMarginClick) + + + # Make some styles, The lexer defines what each style is used for, we + # just have to define what each style looks like. This set is adapted from + # Scintilla sample property files. + + self.StyleClearAll() + + # Global default styles for all languages + self.StyleSetSpec(wxSTC_STYLE_DEFAULT, "face:%(helv)s,size:%(size)d" % faces) + self.StyleSetSpec(wxSTC_STYLE_LINENUMBER, "back:#C0C0C0,face:%(helv)s,size:%(size2)d" % faces) + self.StyleSetSpec(wxSTC_STYLE_CONTROLCHAR, "face:%(other)s" % faces) + self.StyleSetSpec(wxSTC_STYLE_BRACELIGHT, "fore:#FFFFFF,back:#0000FF,bold") + self.StyleSetSpec(wxSTC_STYLE_BRACEBAD, "fore:#000000,back:#FF0000,bold") + + # Python styles + # White space + self.StyleSetSpec(SCE_P_DEFAULT, "fore:#808080") + # Comment + self.StyleSetSpec(SCE_P_COMMENTLINE, "fore:#007F00,face:%(other)s" % faces) + # Number + self.StyleSetSpec(SCE_P_NUMBER, "fore:#007F7F") + # String + self.StyleSetSpec(SCE_P_STRING, "fore:#7F007F,italic,face:%(times)s" % faces) + # Single quoted string + self.StyleSetSpec(SCE_P_CHARACTER, "fore:#7F007F,italic,face:%(times)s" % faces) + # Keyword + self.StyleSetSpec(SCE_P_WORD, "fore:#00007F,bold") + # Triple quotes + self.StyleSetSpec(SCE_P_TRIPLE, "fore:#7F0000") + # Triple double quotes + self.StyleSetSpec(SCE_P_TRIPLEDOUBLE, "fore:#7F0000") + # Class name definition + self.StyleSetSpec(SCE_P_CLASSNAME, "fore:#0000FF,bold,underline") + # Function or method name definition + self.StyleSetSpec(SCE_P_DEFNAME, "fore:#007F7F,bold") + # Operators + self.StyleSetSpec(SCE_P_OPERATOR, "bold") + # Identifiers + #self.StyleSetSpec(SCE_P_IDENTIFIER, "bold")#,fore:#FF00FF") + # Comment-blocks + self.StyleSetSpec(SCE_P_COMMENTBLOCK, "fore:#7F7F7F") + # End of line where string is not closed + self.StyleSetSpec(SCE_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eolfilled" % faces) + + + self.SetCaretForeground("BLUE") + + EVT_KEY_UP(self, self.OnKeyPressed) + + + def OnKeyPressed(self, event): + key = event.KeyCode() + if key == 32 and event.ControlDown(): + pos = self.GetCurrentPos() + # Tips + if event.ShiftDown(): + self.CallTipSetBackground("yellow") + self.CallTipShow(pos, 'param1, param2') + # Code completion + else: + self.AutoCompShow('I love wxPython a b c') + + + + def OnUpdateUI(self, evt): + # check for matching braces + braceAtCaret = -1 + braceOpposite = -1 + charBefore = None + caretPos = self.GetCurrentPos() + if caretPos > 0: + charBefore = self.GetCharAt(caretPos - 1) + styleBefore = self.GetStyleAt(caretPos - 1) + + # check before + if charBefore and charBefore in "[]{}()" and ord(styleBefore) == SCE_P_OPERATOR: + braceAtCaret = caretPos - 1 + + # check after + if braceAtCaret < 0: + charAfter = self.GetCharAt(caretPos) + styleAfter = self.GetStyleAt(caretPos) + if charAfter and charAfter in "[]{}()" and ord(styleAfter) == SCE_P_OPERATOR: + braceAtCaret = caretPos + + if braceAtCaret >= 0: + braceOpposite = self.BraceMatch(braceAtCaret) + + if braceAtCaret != -1 and braceOpposite == -1: + self.BraceBadlight(braceAtCaret) + else: + self.BraceHighlight(braceAtCaret, braceOpposite) + #pt = self.PointFromPosition(braceOpposite) + #self.Refresh(true, wxRect(pt.x, pt.y, 5,5)) + #print pt + #self.Refresh(false) + + + def OnMarginClick(self, evt): + # fold and unfold as needed + if evt.GetMargin() == 2: + if evt.GetShift() and evt.GetControl(): + self.FoldAll() + else: + lineClicked = self.GetLineFromPos(evt.GetPosition()) + if self.GetFoldLevel(lineClicked) & wxSTC_FOLDLEVELHEADERFLAG: + if evt.GetShift(): + self.SetFoldExpanded(lineClicked, true) + self.Expand(lineClicked, true, true, 1) + elif evt.GetControl(): + if self.GetFoldExpanded(lineClicked): + self.SetFoldExpanded(lineClicked, false) + self.Expand(lineClicked, false, true, 0) + else: + self.SetFoldExpanded(lineClicked, true) + self.Expand(lineClicked, true, true, 100) + else: + self.ToggleFold(lineClicked) + + + def FoldAll(self): + lineCount = self.GetLineCount() + expanding = true + + # find out if we are folding or unfolding + for lineNum in range(lineCount): + if self.GetFoldLevel(lineNum) & wxSTC_FOLDLEVELHEADERFLAG: + expanding = not self.GetFoldExpanded(lineNum) + break; + + lineNum = 0 + while lineNum < lineCount: + level = self.GetFoldLevel(lineNum) + if level & wxSTC_FOLDLEVELHEADERFLAG and \ + (level & wxSTC_FOLDLEVELNUMBERMASK) == wxSTC_FOLDLEVELBASE: + + if expanding: + self.SetFoldExpanded(lineNum, true) + lineNum = self.Expand(lineNum, true) + lineNum = lineNum - 1 + else: + lastChild = self.GetLastChild(lineNum, -1) + self.SetFoldExpanded(lineNum, false) + if lastChild > lineNum: + self.HideLines(lineNum+1, lastChild) + + lineNum = lineNum + 1 + + + + def Expand(self, line, doExpand, force=false, visLevels=0, level=-1): + lastChild = self.GetLastChild(line, level) + line = line + 1 + while line <= lastChild: + if force: + if visLevels > 0: + self.ShowLines(line, line) + else: + self.HideLines(line, line) + else: + if doExpand: + self.ShowLines(line, line) + + if level == -1: + level = self.GetFoldLevel(line) + + if level & wxSTC_FOLDLEVELHEADERFLAG: + if force: + if visLevels > 1: + self.SetFoldExpanded(line, true) + else: + self.SetFoldExpanded(line, false) + line = self.Expand(line, doExpand, force, visLevels-1) + + else: + if doExpand and self.GetFoldExpanded(line): + line = self.Expand(line, true, force, visLevels-1) + else: + line = self.Expand(line, false, force, visLevels-1) + else: + line = line + 1; + + return line + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + ed = PythonSTC(nb, -1) + + ed.SetText(demoText + open('Main.py').read()) + ed.EmptyUndoBuffer() + + + # line numbers in the margin + ed.SetMarginType(1, wxSTC_MARGIN_NUMBER) + ed.SetMarginWidth(1, 25) + + return ed + + + +#---------------------------------------------------------------------- + + +overview = """\ +<html><body> +Once again, no docs yet. <b>Sorry.</b> But <a href="data/stc.h">this</a> +and <a href="http://www.scintilla.org/ScintillaDoc.html">this</a> should +be helpful. +</body><html> +""" + + +if __name__ == '__main__': + import sys + app = wxPySimpleApp() + frame = wxFrame(None, -1, "Tester...", size=(640, 480)) + win = runTest(frame, frame, sys.stdout) + frame.Show(true) + app.MainLoop() + + + + + + +#---------------------------------------------------------------------- +#---------------------------------------------------------------------- + diff --git a/utils/wxPython/demo/wxTextCtrl.py b/wxPython/demo/wxTextCtrl.py similarity index 78% rename from utils/wxPython/demo/wxTextCtrl.py rename to wxPython/demo/wxTextCtrl.py index 49eaa00e75..98f0a25a66 100644 --- a/utils/wxPython/demo/wxTextCtrl.py +++ b/wxPython/demo/wxTextCtrl.py @@ -9,7 +9,8 @@ class TestPanel(wxPanel): self.log = log wxStaticText(self, -1, "wxTextCtrl", wxPoint(5, 25), wxSize(75, 20)) - wxTextCtrl(self, 10, "", wxPoint(80, 25), wxSize(150, 20)) + t = wxTextCtrl(self, 10, "Test it out and see", wxPoint(80, 25), wxSize(150, 20)) + t.SetInsertionPoint(0) EVT_TEXT(self, 10, self.EvtText) wxStaticText(self, -1, "Passsword", wxPoint(5, 50), wxSize(75, 20)) @@ -17,7 +18,8 @@ class TestPanel(wxPanel): EVT_TEXT(self, 20, self.EvtText) wxStaticText(self, -1, "Multi-line", wxPoint(5, 75), wxSize(75, 20)) - wxTextCtrl(self, 30, "", wxPoint(80, 75), wxSize(200, 150), wxTE_MULTILINE) + t = wxTextCtrl(self, 30, "How does it work with a long line of text set in the control", wxPoint(80, 75), wxSize(200, 150), wxTE_MULTILINE) + t.SetInsertionPoint(0) EVT_TEXT(self, 30, self.EvtText) def EvtText(self, event): diff --git a/utils/wxPython/demo/wxTextEntryDialog.py b/wxPython/demo/wxTextEntryDialog.py similarity index 100% rename from utils/wxPython/demo/wxTextEntryDialog.py rename to wxPython/demo/wxTextEntryDialog.py diff --git a/utils/wxPython/demo/wxTimer.py b/wxPython/demo/wxTimer.py similarity index 100% rename from utils/wxPython/demo/wxTimer.py rename to wxPython/demo/wxTimer.py diff --git a/utils/wxPython/demo/wxToolBar.py b/wxPython/demo/wxToolBar.py similarity index 98% rename from utils/wxPython/demo/wxToolBar.py rename to wxPython/demo/wxToolBar.py index e4926741b8..19a806d94f 100644 --- a/utils/wxPython/demo/wxToolBar.py +++ b/wxPython/demo/wxToolBar.py @@ -55,6 +55,7 @@ class TestToolBar(wxFrame): size=(150,-1), style=wxCB_DROPDOWN)) tb.Realize() + EVT_CLOSE(self, self.OnCloseWindow) def OnCloseWindow(self, event): diff --git a/utils/wxPython/demo/wxTreeCtrl.py b/wxPython/demo/wxTreeCtrl.py similarity index 77% rename from utils/wxPython/demo/wxTreeCtrl.py rename to wxPython/demo/wxTreeCtrl.py index 41741c08fb..9f1c20183a 100644 --- a/utils/wxPython/demo/wxTreeCtrl.py +++ b/wxPython/demo/wxTreeCtrl.py @@ -5,14 +5,29 @@ import string #--------------------------------------------------------------------------- +class MyTreeCtrl(wxTreeCtrl): + def __init__(self, parent, id, pos, size, style): + wxTreeCtrl.__init__(self, parent, id, pos, size, style) + + + def OnCompareItems(self, item1, item2): + t1 = self.GetItemText(item1) + t2 = self.GetItemText(item2) + if t1 < t2: return -1 + if t1 == t2: return 0 + return 1 + +#--------------------------------------------------------------------------- + class TestTreeCtrlPanel(wxPanel): def __init__(self, parent, log): wxPanel.__init__(self, parent, -1) + EVT_SIZE(self, self.OnSize) self.log = log tID = NewId() - self.tree = wxTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize, + self.tree = MyTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS)# | wxTR_MULTIPLE) #il = wxImageList(16, 16) @@ -25,19 +40,27 @@ class TestTreeCtrlPanel(wxPanel): #self.tree.SetImageList(il) #self.il = il + # NOTE: For some reason tree items have to have a data object in + # order to be sorted. Since our compare just uses the labels + # we don't need any real data, so we'll just use None. + self.root = self.tree.AddRoot("The Root Item") + self.tree.SetPyData(self.root, None) #self.tree.SetItemImage(self.root, idx1) for x in range(15): child = self.tree.AppendItem(self.root, "Item %d" % x) + self.tree.SetPyData(child, None) #self.tree.SetItemImage(child, idx2) #self.tree.SetItemSelectedImage(child, idx3) for y in range(5): last = self.tree.AppendItem(child, "item %d-%s" % (x, chr(ord("a")+y))) + self.tree.SetPyData(last, None) #self.tree.SetItemImage(last, idx4) #self.tree.SetItemSelectedImage(last, idx5) for z in range(5): - self.tree.AppendItem(last, "item %d-%s-%d" % (x, chr(ord("a")+y), z)) + item = self.tree.AppendItem(last, "item %d-%s-%d" % (x, chr(ord("a")+y), z)) + self.tree.SetPyData(item, None) self.tree.Expand(self.root) EVT_TREE_ITEM_EXPANDED (self, tID, self.OnItemExpanded) @@ -50,15 +73,19 @@ class TestTreeCtrlPanel(wxPanel): EVT_RIGHT_DOWN(self.tree, self.OnRightClick) EVT_RIGHT_UP(self.tree, self.OnRightUp) + def OnRightClick(self, event): pt = event.GetPosition(); - item = self.tree.HitTest(pt) - self.log.WriteText("OnRightClick: %s\n" % self.tree.GetItemText(item)) + item, flags = self.tree.HitTest(pt) + self.log.WriteText("OnRightClick: %s, %s\n" % (self.tree.GetItemText(item), + type(item))) self.tree.SelectItem(item) + + def OnRightUp(self, event): pt = event.GetPosition(); - item = self.tree.HitTest(pt) + item, flags = self.tree.HitTest(pt) self.log.WriteText("OnRightUp: %s (manually starting label edit)\n" % self.tree.GetItemText(item)) self.tree.EditLabel(item) @@ -83,11 +110,13 @@ class TestTreeCtrlPanel(wxPanel): return - def OnLeftDClick(self, event): pt = event.GetPosition(); - item = self.tree.HitTest(pt) + item, flags = self.tree.HitTest(pt) self.log.WriteText("OnLeftDClick: %s\n" % self.tree.GetItemText(item)) + parent = self.tree.GetItemParent(item) + self.tree.SortChildren(parent) + event.Skip() def OnSize(self, event): @@ -110,6 +139,7 @@ class TestTreeCtrlPanel(wxPanel): self.tree.GetBoundingRect(self.item, true)) + #--------------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/utils/wxPython/demo/wxVTKRenderWindow.py b/wxPython/demo/wxVTKRenderWindow.py similarity index 100% rename from utils/wxPython/demo/wxVTKRenderWindow.py rename to wxPython/demo/wxVTKRenderWindow.py diff --git a/utils/wxPython/demo/wxValidator.py b/wxPython/demo/wxValidator.py similarity index 100% rename from utils/wxPython/demo/wxValidator.py rename to wxPython/demo/wxValidator.py diff --git a/utils/wxPython/distrib/.cvsignore b/wxPython/distrib/.cvsignore similarity index 76% rename from utils/wxPython/distrib/.cvsignore rename to wxPython/distrib/.cvsignore index ac95d78017..3f2a47b337 100644 --- a/utils/wxPython/distrib/.cvsignore +++ b/wxPython/distrib/.cvsignore @@ -3,5 +3,4 @@ *.zip build.pyc filelist -wxPython.spec wxp2.wse diff --git a/wxPython/distrib/.rpmrc b/wxPython/distrib/.rpmrc new file mode 100644 index 0000000000..46a92a2043 --- /dev/null +++ b/wxPython/distrib/.rpmrc @@ -0,0 +1,5 @@ +sourcedir: . +builddir: . +rpmdir: . +srcrpmdir: . + diff --git a/wxPython/distrib/README.dbg.txt b/wxPython/distrib/README.dbg.txt new file mode 100644 index 0000000000..b2289512b3 --- /dev/null +++ b/wxPython/distrib/README.dbg.txt @@ -0,0 +1,20 @@ +This zip file contains versions of the wxWindows and wxPython binaries +that have been compiled with __WXDEBUG__ defined. This adds code to +wxWindows that is a bit more agressive about checking parameter +values, return values, and etc. When the debugging library senses +something is wrong it will popup a message dialog telling you so. +Unfortunately the message is specific to the C++ code but it might +give you a hint about what went wrong and how to fix it. + +Another debugging feature is when the wxPython program exits, it will +print to stdout information about any wxWindows C++ objects that +havn't been properly cleaned up. + +This archive contains a new wxWindows DLL named wx[version]d.dll that +should be copied to the windows system directory or some other +directory on the PATH.You will also find replacements for all of +wxPython's *.pyd files that are linked to use this DLL. Until I put +together a new installer, you'll need to copy things manually. + + +Robin diff --git a/utils/wxPython/distrib/autobuild.py b/wxPython/distrib/autobuild.py old mode 100644 new mode 100755 similarity index 52% rename from utils/wxPython/distrib/autobuild.py rename to wxPython/distrib/autobuild.py index 7b0769eba4..e6a303fbab --- a/utils/wxPython/distrib/autobuild.py +++ b/wxPython/distrib/autobuild.py @@ -3,13 +3,18 @@ import sys, os, string, time from ftplib import FTP +cwd = os.getcwd() -logfile = 'e:\\temp\\autobuild.log' +logfile = 'c:\\temp\\autobuild.log' WXDIR = os.environ['WXWIN'] -dllVer = '21_14' -wxpVer = '2.1.14' +dllVer = '21_16' +wxpVer = '2.1.16' dateSt = time.strftime("%Y%m%d", time.localtime(time.time())) +base = os.path.split(sys.argv[0])[0] +base = os.path.join(base, '..') +WXPYDIR = os.path.abspath(base) + #---------------------------------------------------------------------- def do(cmd): @@ -60,94 +65,77 @@ def main(): logSeparator("Cleanup") os.chdir(WXDIR + '/src/msw') do('make cleandll FINAL=1') - os.chdir(WXDIR + '/utils/ogl/src') - do('wxm clean FINAL=1') - os.chdir(WXDIR + '/utils/glcanvas/win') - do('wxm clean FINAL=1') logSeparator("Building Documentation...") os.chdir(WXDIR + '/src/msw') do('make touchmanual htmlhelp') - validateFile(WXDIR + '/docs/html/wx/wx.chm') + validateFile(WXDIR + '/docs/htmlhelp/wx.chm') - logSeparator("Building wxWindows and libraries...") + logSeparator("Building wxWindows and other libraries...") os.chdir(WXDIR + '/src/msw') do('make dll pch FINAL=1') validateFile(WXDIR + '/lib/wx'+dllVer+'.dll') - os.chdir(WXDIR + '/utils/ogl/src') - do('wxm FINAL=1') - os.chdir(WXDIR + '/utils/glcanvas/win') - do('wxm FINAL=1') - validateFile(WXDIR + '/lib/ogl.lib') - validateFile(WXDIR + '/lib/glcanvas.lib') - logSeparator("Cleaning wxPython build directory...") - os.chdir(WXDIR + '/utils/wxPython') - do("del /sxy *.*") - logSeparator("Copying wxPython workspace to build directory...") - do("copy /s %s %s" % ('e:\\projects\\wxPython\*.*', WXDIR+'\\utils\\wxPython')) - os.chdir(WXDIR + '/utils/wxPython') + logSeparator("Cleaning wxPython build directory...") + os.chdir(WXPYDIR) + do('buildall.bat -c') + os.rename('build.local', 'build.local.save') f = open("build.local", "w") f.write(""" -TARGETDIR = 'e:\\projects\\wx\\utils\\wxPython' -WXPSRCDIR = 'e:\\projects\\wx\\utils\\wxPython\\src' CRTFLAG='/MD' FINAL=1 """) f.close() - logSeparator("Cleaning wxPython...") - os.chdir(WXDIR+'\\utils\\wxPython') - do("buildall -cu") - do("ll") - - logSeparator("Building core wxPython...") - os.chdir(WXDIR+'\\utils\\wxPython\\src') - do("build -bi") - validateFile(WXDIR+'\\utils\\wxPython\\wxc.pyd') - + os.chdir(WXPYDIR + '\\src') + do("build -b") + validateFile(WXPYDIR+'\\wxPython\\wxc.pyd') logSeparator("Building wxPython addon modules...") - os.chdir(WXDIR+'\\utils\\wxPython\\modules') - do("buildall -bi") - validateFile(WXDIR+'\\utils\\wxPython\\utilsc.pyd') - validateFile(WXDIR+'\\utils\\wxPython\\htmlc.pyd') - validateFile(WXDIR+'\\utils\\wxPython\\glcanvasc.pyd') - validateFile(WXDIR+'\\utils\\wxPython\\oglc.pyd') + os.chdir(WXPYDIR+'\\contrib') + do("buildall -b") + validateFile(WXPYDIR+'\\wxPython\\glcanvasc.pyd') + validateFile(WXPYDIR+'\\wxPython\\oglc.pyd') + validateFile(WXPYDIR+'\\wxPython\\stc_c.pyd') + + + os.chdir(WXPYDIR) + os.unlink('build.local') + os.rename('build.local.save', 'build.local') logSeparator("Building installer executable...") - os.chdir(WXDIR+'\\utils\\wxPython\\distrib') + os.chdir(WXPYDIR+'\\distrib') do("autoit2 wise.aut") - srcName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-'+wxpVer+'.EXE' - destName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-'+wxpVer+'-'+dateSt+'.EXE' + srcName = WXPYDIR+'\\distrib\\wxPython-'+wxpVer+'.EXE' + destName = WXPYDIR+'\\distrib\\wxPython-'+wxpVer+'-'+dateSt+'.EXE' validateFile(srcName) try: time.sleep(5) os.rename(srcName, destName) validateFile(destName) except: - pass + logSeparator("****** UNABLE TO RENAME FILE ******") logSeparator("Building source and docs zip files...") - os.chdir(WXDIR+'\\utils') - do("wxPython\\distrib\\zipit.bat %s" % wxpVer) - srcZName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-src-'+wxpVer+'.zip' - destZName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-src-'+wxpVer+'-'+dateSt+'.zip' + os.chdir(WXPYDIR) + do("distrib\\zipit.bat %s" % wxpVer) + srcZName = WXPYDIR+'\\distrib\\wxPython-src-'+wxpVer+'.zip' + destZName = WXPYDIR+'\\distrib\\wxPython-src-'+wxpVer+'-'+dateSt+'.zip' validateFile(srcZName) try: os.rename(srcZName, destZName) except: pass - srcDName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-docs-'+wxpVer+'.zip' - destDName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-docs-'+wxpVer+'-'+dateSt+'.zip' + srcDName = WXPYDIR+'\\distrib\\wxPython-docs-'+wxpVer+'.zip' + destDName = WXPYDIR+'\\distrib\\wxPython-docs-'+wxpVer+'-'+dateSt+'.zip' validateFile(srcDName) try: os.rename(srcDName, destDName) @@ -155,15 +143,14 @@ FINAL=1 pass + # #*#*#*#*#* Comment this out to allow upload... return logSeparator("Uploading to website...") - do('python d:\util32\sendwxp.py %s' % destName) - do('python d:\util32\sendwxp.py %s' % destZName) - do('python d:\util32\sendwxp.py %s' % destDName) - os.unlink(destName) - os.unlink(destZName) + do('python c:\\utils\\sendwxp.py %s' % destName) + do('python c:\\utils\\sendwxp.py %s' % destZName) + do('python c:\\utils\\sendwxp.py %s' % destDName) logSeparator("Finished!!!") diff --git a/utils/wxPython/distrib/build.py b/wxPython/distrib/build.py similarity index 89% rename from utils/wxPython/distrib/build.py rename to wxPython/distrib/build.py index 7d8a913511..d23a664a1a 100755 --- a/utils/wxPython/distrib/build.py +++ b/wxPython/distrib/build.py @@ -92,6 +92,7 @@ Configuration Options OTHERTARGETS Other targets to be placed on the default rule line OTHERINSTALLTARGETS Other targets to be placed on the install rule line + OTHERDEFS Text to place near the begining of the Makefile OTHERRULES This text is placed at the end of the makefile and will typically be used for adding rules and such DEFAULTRULE Text to be used for the default rule in the makefile @@ -119,7 +120,10 @@ import sys, os, string, getopt # This is really the wxPython version number, and will be placed in the # Makefiles for use with the distribution related targets. -__version__ = '2.1.14' +major_version = '2.1' +build_version = '16' + +__version__ = major_version + '.' + build_version #---------------------------------------------------------------------------- @@ -218,7 +222,12 @@ class BuildConfig: #------------------------------------------------------------ def setDefaults(self): + base = os.path.split(sys.argv[0])[0] + base = os.path.join(base, '..') + self.WXPYDIR = os.path.abspath(base) self.VERSION = __version__ + self.MAJVER = major_version + self.BLDVER = build_version self.MODULE = '' self.SWIGFILES = [] self.SWIGFLAGS = '-c++ -shadow -python -keyword -dnone -I$(WXPSRCDIR)' @@ -233,7 +242,7 @@ class BuildConfig: self.OTHERINSTALLTARGETS = '' self.OTHERUNINSTALLTARGETS = '' self.OTHERRULES = '' - self.DEFAULTRULE = 'default: $(GENCODEDIR) $(TARGET)' + self.DEFAULTRULE = 'default: $(GENCODEDIR) $(TARGET) $(BUILDDIR)/$(TARGET) bldpycfiles' self.PYVERSION = sys.version[:3] self.PYPREFIX = sys.prefix self.EXECPREFIX = sys.exec_prefix @@ -242,9 +251,10 @@ class BuildConfig: self.WXP_USE_THREAD = '1' self.WXUSINGDLL = '1' self.OTHERDEP = '' - self.WXPSRCDIR = '$(WXDIR)/utils/wxPython/src' + self.WXPSRCDIR = '$(WXPYDIR)/src' self.SWIGDEPS = '' self.OTHERDEPS = '' + self.OTHERDEFS = '' if sys.platform == 'win32': @@ -275,15 +285,14 @@ class BuildConfig: self.TARGET = '$(MODULE)module$(SO)' self.OBJEXT = '.o' self.HELPERLIB = 'wxPyHelpers' - self.HELPERLIBDIR = '/usr/local/lib' + self.HELPERLIBDIR = '$(EXECPREFIX)/lib' self.CFLAGS = '-DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) -I. '\ '`$(WXCONFIG) --cflags` -I$(PYINCLUDE) -I$(EXECINCLUDE) '\ '-I$(WXPSRCDIR)' self.LFLAGS = '-L$(WXPSRCDIR) `$(WXCONFIG) --libs`' - self.LIBS = '-l$(HELPERLIB)' self.RMCMD = '-rm -f ' self.WXCONFIG = 'wx-config' - + self.USE_SONAME = '1' # **** What to do when I start supporting Motif, etc.??? self.GENCODEDIR = 'gtk' @@ -363,8 +372,10 @@ class BuildConfig: for name in self.SWIGFILES: rootname = os.path.splitext(name)[0] text = '$(GENCODEDIR)/%s.cpp $(GENCODEDIR)/%s.py : %s.i %s\n' \ - '$(TARGETDIR)\\%s.py : $(GENCODEDIR)\\%s.py\n' % \ - (rootname, rootname, rootname, self.SWIGDEPS, rootname, rootname) + '$(TARGETDIR)\\%s.py : $(GENCODEDIR)\\%s.py\n' \ + '$(BUILDDIR)\\%s.py : $(GENCODEDIR)\\%s.py\n' % \ + (rootname, rootname, rootname, self.SWIGDEPS, + rootname, rootname, rootname, rootname) depends = depends + text if self.OTHERDEPS: text = '%s%s : %s\n' % \ @@ -386,14 +397,18 @@ class BuildConfig: # and the list of .py files pymodules = "" + bldpymodules = "" for name in self.SWIGFILES: pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0] + bldpymodules = bldpymodules + '$(BUILDDIR)\\%s.py ' % os.path.splitext(name)[0] for name in self.PYFILES: pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0] + bldpymodules = bldpymodules + '$(BUILDDIR)\\%s.py ' % os.path.splitext(name)[0] self.PYMODULES = splitlines(swapslash(pymodules)) + self.BLDPYMODULES = splitlines(swapslash(bldpymodules)) - # now make a list of the python files that would need uninstalled + # now make a list of the python files that would need cleaned up pycleanup = "" for name in self.SWIGFILES: pycleanup = pycleanup + self.makeCleanupList(name) @@ -402,6 +417,15 @@ class BuildConfig: self.PYCLEANUP = swapslash(pycleanup) + # now make a list of the python files that would need uninstalled + pyUninstall = "" + for name in self.SWIGFILES: + pyUninstall = pyUninstall + self.makeUninstallList(name) + for name in self.PYFILES: + pyUninstall = pyUninstall + self.makeUninstallList(name) + self.PYUNINSTALL = swapslash(pyUninstall) + + # finally, build the makefile if sys.platform == 'win32': if self.RESFILE: @@ -420,7 +444,7 @@ class BuildConfig: #------------------------------------------------------------ - def makeCleanupList(self, name): + def makeUninstallList(self, name): st = "" st = st + '\t%s$(TARGETDIR)\\%s.py\n' % (self.RMCMD, os.path.splitext(name)[0]) st = st + '\t%s$(TARGETDIR)\\%s.pyc\n' % (self.RMCMD, os.path.splitext(name)[0]) @@ -428,6 +452,15 @@ class BuildConfig: return st + #------------------------------------------------------------ + def makeCleanupList(self, name): + st = "" + st = st + '\t%s$(BUILDDIR)\\%s.py\n' % (self.RMCMD, os.path.splitext(name)[0]) + st = st + '\t%s$(BUILDDIR)\\%s.pyc\n' % (self.RMCMD, os.path.splitext(name)[0]) + st = st + '\t%s$(BUILDDIR)\\%s.pyo\n' % (self.RMCMD, os.path.splitext(name)[0]) + return st + + #------------------------------------------------------------ def readConfigFiles(self, args): return self.processFile(self.bldCfg, 1) and \ @@ -490,6 +523,8 @@ win32Template = ''' WXDIR = %(WXDIR)s VERSION = %(VERSION)s +MAJVER = %(MAJVER)s +BLDVER = %(BLDVER)s MODULE = %(MODULE)s SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s CFLAGS = %(CFLAGS)s @@ -504,12 +539,15 @@ WXUSINGDLL = %(WXUSINGDLL)s GENCODEDIR = %(GENCODEDIR)s RESFILE = %(RESFILE)s WXPSRCDIR = %(WXPSRCDIR)s +%(OTHERDEFS)s - +WXPYDIR = %(WXPYDIR)s +BUILDDIR = $(WXPYDIR)\\wxPython TARGETDIR = %(TARGETDIR)s OBJECTS = %(OBJECTS)s PYMODULES = %(PYMODULES)s +BLDPYMODULES = %(BLDPYMODULES)s TARGET = %(TARGET)s @@ -546,7 +584,7 @@ CRTFLAG=%(CRTFLAG)s -install: $(TARGETDIR) $(TARGETDIR)\\$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s +install: default $(TARGETDIR) $(TARGETDIR)\\$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s clean: -erase *.obj @@ -560,11 +598,13 @@ clean: -erase $(MODULE).lib -erase $(MODULE).ilk -erase $(TARGET) + -erase $(BUILDDIR)\$(TARGET) +%(PYCLEANUP)s uninstall: %(OTHERUNINSTALLTARGETS)s -erase $(TARGETDIR)\\$(TARGET) -%(PYCLEANUP)s +%(PYUNINSTALL)s #---------------------------------------------------------------------- @@ -601,6 +641,13 @@ $(CPPFLAGS) /c $< {}.py{$(TARGETDIR)}.py: copy $< $@ + +{$(GENCODEDIR)}.py{$(BUILDDIR)}.py: + copy $< $@ + +{}.py{$(BUILDDIR)}.py: + copy $< $@ + #---------------------------------------------------------------------- $(TARGET) : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(RESFILE) @@ -618,11 +665,16 @@ $(LIBS) $(TARGETDIR)\\$(TARGET) : $(TARGET) copy $(TARGET) $@ +$(BUILDDIR)\\$(TARGET) : $(TARGET) + copy $(TARGET) $@ + pycfiles : $(PYMODULES) $(EXECPREFIX)\\python $(PYPREFIX)\\Lib\\compileall.py -l $(TARGETDIR) $(EXECPREFIX)\\python -O $(PYPREFIX)\Lib\\compileall.py -l $(TARGETDIR) +bldpycfiles : $(BLDPYMODULES) + $(TARGETDIR) : mkdir $(TARGETDIR) @@ -641,7 +693,8 @@ showflags: @echo $(CPPFLAGS) @echo LFLAGS: @echo $(LFLAGS) - + @echo BUILDDIR: + @echo $(BUILDDIR) %(OTHERRULES)s @@ -657,15 +710,15 @@ unixTemplate = ''' # lost if the generator is run again. You have been warned. #---------------------------------------------------------------------- - - WXDIR = %(WXDIR)s VERSION = %(VERSION)s +MAJVER = %(MAJVER)s +BLDVER = %(BLDVER)s MODULE = %(MODULE)s SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s CFLAGS = %(CFLAGS)s $(OPT) %(OTHERCFLAGS)s LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s -LIBS = %(LIBS)s %(OTHERLIBS)s + PYVERSION = %(PYVERSION)s PYPREFIX = %(PYPREFIX)s EXECPREFIX = %(EXECPREFIX)s @@ -681,7 +734,11 @@ WXPSRCDIR = %(WXPSRCDIR)s HELPERLIB = %(HELPERLIB)s HELPERLIBDIR = %(HELPERLIBDIR)s WXCONFIG=%(WXCONFIG)s + +WXPYDIR = %(WXPYDIR)s +BUILDDIR = $(WXPYDIR)/wxPython TARGETDIR = %(TARGETDIR)s +%(OTHERDEFS)s CCC = %(CCC)s @@ -694,6 +751,7 @@ CCSHARED = %(CCSHARED)s OBJECTS = %(OBJECTS)s PYMODULES = %(PYMODULES)s +BLDPYMODULES = %(BLDPYMODULES)s TARGET = %(TARGET)s @@ -701,19 +759,28 @@ ifeq ($(WXP_USE_THREAD), 1) THREAD=-DWXP_USE_THREAD endif +USE_SONAME = %(USE_SONAME)s +ifeq ($(USE_SONAME), 1) +LIBS = -l$(HELPERLIB) %(OTHERLIBS)s +else +LIBS = $(WXPSRCDIR)/lib$(HELPERLIB)$(SO) %(OTHERLIBS)s +endif + #---------------------------------------------------------------------- %(DEFAULTRULE)s %(OTHERTARGETS)s -install: $(TARGETDIR) $(TARGETDIR)/$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s +install: default $(TARGETDIR) $(TARGETDIR)/$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s clean: - -rm -f *.o *$(SO) *~ + -rm -f *.o *$(SO) *$(SO).* *~ -rm -f $(TARGET) + -rm -f $(BUILDDIR)/$(TARGET) +%(PYCLEANUP)s uninstall: %(OTHERUNINSTALLTARGETS)s -rm -f $(TARGETDIR)/$(TARGET) -%(PYCLEANUP)s +%(PYUNINSTALL)s #---------------------------------------------------------------------- @@ -746,6 +813,12 @@ $(TARGETDIR)/%% : %% $(TARGETDIR)/%% : $(GENCODEDIR)/%% cp -f $< $@ +$(BUILDDIR)/%% : %% + cp -f $< $@ + +$(BUILDDIR)/%% : $(GENCODEDIR)/%% + cp -f $< $@ + #---------------------------------------------------------------------- %(DEPENDS)s @@ -756,11 +829,12 @@ $(TARGET) : $(OBJECTS) $(LDSHARED) $(OBJECTS) $(LFLAGS) $(LIBS) $(OTHERLIBS) -o $(TARGET) - pycfiles : $(PYMODULES) $(EXECPREFIX)/bin/python $(PYLIB)/compileall.py -l $(TARGETDIR) $(EXECPREFIX)/bin/python -O $(PYLIB)/compileall.py -l $(TARGETDIR) +bldpycfiles : $(BLDPYMODULES) + $(TARGETDIR) : mkdir -p $(TARGETDIR) @@ -774,7 +848,6 @@ $(GENCODEDIR): %(OTHERRULES)s - ''' @@ -785,11 +858,3 @@ if __name__ == '__main__': sys.exit(err) #---------------------------------------------------------------------------- - - - - - - - - diff --git a/wxPython/distrib/makedbg.bat b/wxPython/distrib/makedbg.bat new file mode 100755 index 0000000000..f4618328df --- /dev/null +++ b/wxPython/distrib/makedbg.bat @@ -0,0 +1,14 @@ +@echo off +rem Builds a zip containing debugging versions of wxWindows and wxPython +rem that could be unziped over a wxPython installation. + + +mkdir wxPython-dbg +copy README.dbg.txt wxPython-dbg +copy %WXWIN%\lib\wx*d.dll wxPython-dbg +copy %WXWIN%\wxPython\wxPython\*.pyd wxPython-dbg + +zip -r wxPython-dbg-%1.zip wxPython-dbg + +del /sx wxPython-dbg + diff --git a/wxPython/distrib/makedev.bat b/wxPython/distrib/makedev.bat new file mode 100755 index 0000000000..15735fc6e0 --- /dev/null +++ b/wxPython/distrib/makedev.bat @@ -0,0 +1,41 @@ +@echo off +rem Builds a zip containing stuff needed to link with the wxWindows DLL +rem shipped with wxPython. This allows other developers to create apps +rem or extensions that can share the same DLL. + +mkdir wxWin +mkdir wxWin\lib +copy %WXWIN%\lib\*.lib wxWin\lib +del wxWin\lib\*_d.lib + +mkdir wxWin\src +copy %WXWIN%\src\makevc.env wxWin\src +copy %WXWIN%\src\*.vc wxWin\src + +mkdir wxWin\src\msw +mkdir wxWin\src\msw\ReleaseDLL +copy %WXWIN%\src\msw\*.pch wxWin\src\msw +del wxWin\src\msw\*_d.pch +copy %WXWIN%\src\msw\ReleaseDLL\dummy*.obj wxWin\src\msw\ReleaseDLL + +mkdir wxWin\include +mkdir wxWin\include\wx +mkdir wxWin\include\wx\msw +mkdir wxWin\include\wx\generic +mkdir wxWin\include\wx\html +mkdir wxWin\include\wx\protocol + +copy %WXWIN%\include\wx\*.* wxWin\include\wx +copy /s %WXWIN%\include\wx\msw\* wxWin\include\wx\msw +copy /s %WXWIN%\include\wx\generic\* wxWin\include\wx\generic +copy /s %WXWIN%\include\wx\html\* wxWin\include\wx\html +copy /s %WXWIN%\include\wx\protocol\* wxWin\include\wx\protocol + + +zip -r wxPython-dev-%1.zip wxWin + + +del /sx wxWin + + + diff --git a/wxPython/distrib/makerpm b/wxPython/distrib/makerpm new file mode 100755 index 0000000000..8134d14553 --- /dev/null +++ b/wxPython/distrib/makerpm @@ -0,0 +1,47 @@ +#!/bin/bash + +if [ -z $1 ]; then + echo "Please specify a version number on the command line." + exit 1 +fi + +if [ ! -f wxPython.spec ]; then + echo "Please run this script from the directory containing the wxPython.spec file." + exit 1 +fi + + + +#strip /usr/lib/python1.5/site-packages/wxPython/*.so +#strip /usr/lib/libwxPyHelpers.so +# +#cat wxPython.spec.in | sed s/__VERSION__/$1/g > wxPython.spec +# +#mkdir /usr/doc/wxPython-$1 +#cp ../README.txt /usr/doc/wxPython-$1 +#cp ../../../docs/preamble.txt /usr/doc/wxPython-$1 +#cp ../../../docs/licence.txt /usr/doc/wxPython-$1 +#cp ../../../docs/licendoc.txt /usr/doc/wxPython-$1 +#cp ../../../docs/lgpl.txt /usr/doc/wxPython-$1 +#cp ../../../docs/gpl.txt /usr/doc/wxPython-$1 +# +#rpm -bb wxPython.spec +# +#mv /usr/src/redhat/RPMS/*/wxPython*.rpm . +#chown rd:users wxPython*.rpm +# +#rm -r /usr/doc/wxPython-$1 + +cp -f wxPython-$1.tar.gz /usr/src/redhat/SOURCES +rpm -ba wxPython.spec + +mv /usr/src/redhat/RPMS/*/wxPython*.rpm . +mv /usr/src/redhat/SRPMS/wxPython*.rpm . +chown rd:users wxPython*.rpm +rm -rf /usr/lib/python1.5/site-packages/wxPython/ +rm -f /usr/lib/libwxPyHelpers* +rm -rf /usr/doc/wxPython-$1 + + + + diff --git a/wxPython/distrib/maketgz b/wxPython/distrib/maketgz new file mode 100755 index 0000000000..bb34859cd8 --- /dev/null +++ b/wxPython/distrib/maketgz @@ -0,0 +1,62 @@ +#!/bin/bash +#---------------------------------------------------------------------- +# Make a source distribution as a tar.gz file. This script should be +# run from the directory that holds the wxPython dir (../..) and be +# given a version number as an parameter. The best way to do this is +# run "make dist" in the wxPython/src/ directory. +#---------------------------------------------------------------------- + +if [ -z $1 ]; then + echo "Please specify a version number on the command line." + exit 1 +fi + +if [ ! -d wxPython ]; then + echo "Please run this script from the root wxPython directory." + exit 1 +fi + +mkdir _distrib_tgz +mkdir _distrib_tgz/wxPython-$1 + +# Copy license files +cp $WXWIN/docs/gpl.txt _distrib_tgz/wxPython-$1 +cp $WXWIN/docs/lgpl.txt _distrib_tgz/wxPython-$1 +cp $WXWIN/docs/licence.txt _distrib_tgz/wxPython-$1 +cp $WXWIN/docs/licendoc.txt _distrib_tgz/wxPython-$1 +cp $WXWIN/docs/preamble.txt _distrib_tgz/wxPython-$1 + +# Copy files from the live dirs +# first, get a list of files +for x in `cat distrib/wxPython.rsp`; do + ls $x >> _distrib_tgz/filelist +done + +# and make a tar file containing those files +tar cf _distrib_tgz/dist-temp.tar -T _distrib_tgz/filelist + +# now untar it in the right place +cd _distrib_tgz/wxPython-$1 +tar xf ../dist-temp.tar +cd .. + +# update a few things +rm wxPython-$1/src/gtk/helpers.cpp +touch `find wxPython-$1 -name "*.cpp"` +touch `find wxPython-$1 -name "*.py"` + +# Finally, make the finished tar file +tar cvf ../distrib/wxPython-$1.tar wxPython-$1 +gzip ../distrib/wxPython-$1.tar + +cd .. +rm -rf _distrib_tgz + + + + + + + + + diff --git a/utils/wxPython/distrib/makexferzip b/wxPython/distrib/makexferzip similarity index 100% rename from utils/wxPython/distrib/makexferzip rename to wxPython/distrib/makexferzip diff --git a/utils/wxPython/distrib/makexferzip.bat b/wxPython/distrib/makexferzip.bat similarity index 100% rename from utils/wxPython/distrib/makexferzip.bat rename to wxPython/distrib/makexferzip.bat diff --git a/utils/wxPython/distrib/wise.aut b/wxPython/distrib/wise.aut similarity index 75% rename from utils/wxPython/distrib/wise.aut rename to wxPython/distrib/wise.aut index 6abb399e38..8f97040c2d 100644 --- a/utils/wxPython/distrib/wise.aut +++ b/wxPython/distrib/wise.aut @@ -1,5 +1,5 @@ -run, e:\\Tools\\Wise\\WISE32.EXE wxPython.wse +run, c:\\Tools\\Wise\\WISE32.EXE wxPython.wse winwaitactive, wxPython.wse - Wise Installation System send, !ic sleep, 1000 diff --git a/wxPython/distrib/wxPython.WSM b/wxPython/distrib/wxPython.WSM new file mode 100644 index 0000000000000000000000000000000000000000..26e9687feac63bb918b3eabe0b7e9071e4649fc6 GIT binary patch literal 33 mcmWF!_BFFNVqjooIHNIPW9AlDhCj+o3?RT5TCS4l%K!k8@CWw* literal 0 HcmV?d00001 diff --git a/utils/wxPython/distrib/wxPython.bmp b/wxPython/distrib/wxPython.bmp similarity index 100% rename from utils/wxPython/distrib/wxPython.bmp rename to wxPython/distrib/wxPython.bmp diff --git a/wxPython/distrib/wxPython.rsp b/wxPython/distrib/wxPython.rsp new file mode 100644 index 0000000000..fa67623606 --- /dev/null +++ b/wxPython/distrib/wxPython.rsp @@ -0,0 +1,102 @@ +*.txt + +demo/*.py +demo/bitmaps/*.bmp +demo/bitmaps/*.ico +demo/bitmaps/*.gif +demo/bitmaps/*.png +demo/bitmaps/*.jpg +demo/README.txt +demo/*.xml +demo/data/*.png +demo/data/*.htm +demo/data/*.bmp +demo/data/*.txt +demo/data/*.i +demo/data/*.h + +distrib/build.py +distrib/wxPython.spec + +wxPython/lib/*.py +wxPython/lib/*.txt +wxPython/lib/sizers/*.py +wxPython/lib/sizers/*.txt +wxPython/lib/editor/*.py +wxPython/lib/editor/*.txt + + +src/build.cfg +src/*.i +src/*.py +src/*.cpp +src/*.c +src/*.h +src/*.ico +src/*.def +src/*.rc + +src/msw/*.cpp +src/msw/*.h +src/msw/*.py + +src/gtk/*.cpp +src/gtk/*.h +src/gtk/*.py + +src/motif/*.cpp +src/motif/*.h +src/motif/*.py + + +contrib/glcanvas/build.cfg +contrib/glcanvas/*.i +contrib/glcanvas/*.py +contrib/glcanvas/*.cpp +contrib/glcanvas/*.c +contrib/glcanvas/*.h +contrib/glcanvas/*.def +contrib/glcanvas/*.rc +contrib/glcanvas/msw/*.cpp +contrib/glcanvas/msw/*.h +contrib/glcanvas/msw/*.py +contrib/glcanvas/gtk/*.cpp +contrib/glcanvas/gtk/*.h +contrib/glcanvas/gtk/*.py + +contrib/ogl/build.cfg +contrib/ogl/*.txt +contrib/ogl/*.i +contrib/ogl/*.py +contrib/ogl/*.cpp +contrib/ogl/*.c +contrib/ogl/*.h +contrib/ogl/*.def +contrib/ogl/*.rc +contrib/ogl/contrib/include/wx/ogl/*.h +contrib/ogl/contrib/src/ogl/*.cpp + +contrib/stc/build.cfg +contrib/stc/*.txt +contrib/stc/*.i +contrib/stc/*.py +contrib/stc/*.cpp +contrib/stc/*.c +contrib/stc/*.h +contrib/stc/*.def +contrib/stc/*.rc +contrib/stc/*.cpp +contrib/stc/*.h +contrib/stc/*.py +contrib/stc/contrib/include/wx/stc/*.h +contrib/stc/contrib/src/stc/*.h +contrib/stc/contrib/src/stc/*.cpp +contrib/stc/contrib/src/stc/scintilla/include/*.h +contrib/stc/contrib/src/stc/scintilla/src/*.h +contrib/stc/contrib/src/stc/scintilla/src/*.cxx + + + + + + diff --git a/wxPython/distrib/wxPython.spec b/wxPython/distrib/wxPython.spec new file mode 100644 index 0000000000..7cdbfa9766 --- /dev/null +++ b/wxPython/distrib/wxPython.spec @@ -0,0 +1,101 @@ +%define pref /usr +%define ver 2.1.16 +%define rpmver 1 + +Summary: Cross platform GUI toolkit for use with the Python language. +Name: wxPython +Version: %{ver} +Release: %{rpmver} +Copyright: wxWindows License +Group: Development/Languages/Python +Source: wxPython-%{ver}.tar.gz +Packager: Robin Dunn <robin@alldunn.com> +URL:http://alldunn.com/wxPython/index.html +Vendor: Total Control Software +Requires: python >= 1.5.2 +##BuildRoot: /tmp/wxPython-build +##Prefix: /usr/lib/python1.5/site-packages + +Prefix: %{pref} + +%description +wxPython is a GUI toolkit for Python that is a wrapper around the +wxWindows C++ GUI library. wxPython provides a large variety of +window types and controls, all imlemented with a native look and +feel (and runtime speed) on the platforms it is supported on. + + +%package gl +Summary: Cross platform GUI toolkit for use with the Python language, OpenGL addon. +Group: Development/Languages/Python +Requires: wxPython + +%description gl +OpenGL add on for wxPython. + +#---------------------------------------------------------------------- + +%prep + +%setup + +%build +NOSWIG=1 +export NOSWIG +cd src +python ../distrib/build.py -b WXPSRCDIR=$PWD USE_SONAME=1 +cd ../contrib/ogl +python ../../distrib/build.py -b WXPSRCDIR=../../src USE_SONAME=1 +cd ../stc +python ../../distrib/build.py -b WXPSRCDIR=../../src USE_SONAME=1 +if [ -z $NOGLCANVAS ]; then + cd ../glcanvas + python ../../distrib/build.py -b WXPSRCDIR=../../src USE_SONAME=1 +fi + +#---------------------------------------------------------------------- + +%install +NOSWIG=1 +export NOSWIG +cd src +python ../distrib/build.py -i +cd ../contrib/ogl +python ../../distrib/build.py -i +cd ../stc +python ../../distrib/build.py -i +if [ -z $NOGLCANVAS ]; then + cd ../glcanvas + python ../../distrib/build.py -i +fi + +#---------------------------------------------------------------------- + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +#---------------------------------------------------------------------- + +%files +%doc BUILD.txt CHANGES.txt README.txt gpl.txt lgpl.txt licence.txt licendoc.txt preamble.txt +%{pref}/lib/libwxPyHelpers* +%{pref}/lib/python1.5/site-packages/wxPython/*.py +%{pref}/lib/python1.5/site-packages/wxPython/*.py? +%{pref}/lib/python1.5/site-packages/wxPython/lib +%{pref}/lib/python1.5/site-packages/wxPython/demo +%{pref}/lib/python1.5/site-packages/wxPython/wxcmodule.so +%{pref}/lib/python1.5/site-packages/wxPython/oglcmodule.so +%{pref}/lib/python1.5/site-packages/wxPython/stc_cmodule.so + +%files gl +%{pref}/lib/python1.5/site-packages/wxPython/glcanvascmodule.so + + + + + + + diff --git a/utils/wxPython/distrib/wxPython.wse b/wxPython/distrib/wxPython.wse similarity index 95% rename from utils/wxPython/distrib/wxPython.wse rename to wxPython/distrib/wxPython.wse index a30d010828..d12d329375 100644 --- a/utils/wxPython/distrib/wxPython.wse +++ b/wxPython/distrib/wxPython.wse @@ -17,7 +17,7 @@ item: Global Patch Flags=0000000000001001 Patch Threshold=85 Patch Memory=4000 - EXE Filename=wxPython-2.1.14.exe + EXE Filename=wxPython-2.1.16.exe FTP Cluster Size=20 Per-User Version ID=1 Dialogs Version=6 @@ -25,7 +25,7 @@ item: Global Variable Default1=C:\WINNT\System32 Variable Flags1=00001000 Variable Name2=_WISE_ - Variable Default2=E:\Tools\Wise + Variable Default2=C:\Tools\Wise Variable Flags2=00001000 Variable Name3=_ODBC16_ Variable Default3=C:\WINNT\System32 @@ -72,6 +72,10 @@ item: Set Variable Value=wxPython Flags=10000000 end +item: Set Variable + Variable=DLLVER + Value=wx21_16 +end item: Check Configuration Flags=10111011 end @@ -191,7 +195,7 @@ end item: End Block end item: Display Graphic - Pathname=e:\Projects\wx\utils\wxPython\distrib\wxPython.BMP + Pathname=C:\PROJECTS\wx\wxPython\distrib\wxPython.bmp X Position=32784 Y Position=16 Flags=0000001010000000 @@ -805,156 +809,184 @@ end item: Remark end item: Install File - Source=d:\WINNT\System32\Msvcirt.dll + Source=c:\WINNT\System32\Msvcirt.dll Destination=%SYS%\Msvcirt.dll Flags=0000001010000011 end item: Install File - Source=d:\WINNT\System32\Msvcrt.dll + Source=c:\WINNT\System32\Msvcrt.dll Destination=%SYS%\Msvcrt.dll Flags=0000001010000011 end item: Install File - Source=e:\projects\wx\lib\wx21_14.dll - Destination=%SYS%\wx21_14.dll + Source=c:\projects\wx\lib\wx21_16.dll + Destination=%SYS%\wx21_16.dll Flags=0000001010010010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\*.py + Source=c:\Projects\wx\wxPython\wxPython\*.py Destination=%MAINDIR%\wxPython Description=wxPython shadow class modules Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\*.pyd + Source=c:\Projects\wx\wxPython\wxPython\*.pyd Destination=%MAINDIR%\wxPython Description=wxPython extension modules Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\*.txt + Source=c:\Projects\wx\wxPython\wxPython\*.txt Destination=%MAINDIR%\wxPython Description=README file Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\lib\*.py + Source=c:\Projects\wx\wxPython\wxPython\lib\*.py Destination=%MAINDIR%\wxPython\lib Description=wxPython Standard Library Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\lib\sizers\*.py + Source=c:\Projects\wx\wxPython\wxPython\lib\sizers\*.py Destination=%MAINDIR%\wxPython\lib\sizers Description=wxPython Standard Library Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\lib\editor\*.py + Source=c:\Projects\wx\wxPython\wxPython\lib\editor\*.py Destination=%MAINDIR%\wxPython\lib\editor Description=wxPython Standard Library Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\demo\*.py + Source=c:\Projects\wx\wxPython\demo\*.py Destination=%MAINDIR%\wxPython\demo Description=Demos Flags=0000000010000010 end item: Install File - Source=E:\Projects\wx\utils\wxPython\demo\README.txt + Source=c:\Projects\wx\wxPython\demo\README.txt Destination=%MAINDIR%\wxPython\demo\README.txt Description=Demos Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\demo\*.xml + Source=c:\Projects\wx\wxPython\demo\*.xml Destination=%MAINDIR%\wxPython\demo Description=Demos Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.bmp + Source=c:\Projects\wx\wxPython\demo\bitmaps\*.bmp Destination=%MAINDIR%\wxPython\demo\bitmaps Description=Demos Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.gif + Source=c:\Projects\wx\wxPython\demo\bitmaps\*.gif Destination=%MAINDIR%\wxPython\demo\bitmaps Description=Demos Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.jpg + Source=c:\Projects\wx\wxPython\demo\bitmaps\*.jpg Destination=%MAINDIR%\wxPython\demo\bitmaps Description=Demos Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.png + Source=c:\Projects\wx\wxPython\demo\bitmaps\*.png Destination=%MAINDIR%\wxPython\demo\bitmaps Description=Demos Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.ico + Source=c:\Projects\wx\wxPython\demo\bitmaps\*.ico Destination=%MAINDIR%\wxPython\demo\bitmaps Description=Demos Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\demo\data\*.htm + Source=c:\Projects\wx\wxPython\demo\data\*.htm Destination=%MAINDIR%\wxPython\demo\data Description=Demos Flags=0000000010000010 end item: Install File - Source=e:\Projects\wx\utils\wxPython\demo\data\*.png + Source=c:\Projects\wx\wxPython\demo\data\*.png Destination=%MAINDIR%\wxPython\demo\data Description=Demos Flags=0000000010000010 end +item: Install File + Source=c:\Projects\wx\wxPython\demo\data\grid.i + Destination=%MAINDIR%\wxPython\demo\data\grid.i + Description=Demos + Flags=0000000010000010 +end +item: Install File + Source=c:\Projects\wx\wxPython\demo\data\stc.h + Destination=%MAINDIR%\wxPython\demo\data\stc.h + Description=Demos + Flags=0000000010000010 +end +item: Install File + Source=c:\Projects\wx\wxPython\demo\data\tips.txt + Destination=%MAINDIR%\wxPython\demo\data\tips.txt + Description=Demos + Flags=0000000010000010 +end +item: Install File + Source=C:\PROJECTS\wx\wxPython\README.txt + Destination=%MAINDIR%\wxPython\README.txt + Flags=0000000010000010 +end +item: Install File + Source=C:\PROJECTS\wx\wxPython\CHANGES.txt + Destination=%MAINDIR%\wxPython\CHANGES.txt + Flags=0000000010000010 +end item: Remark end item: Install File - Source=E:\PROJECTS\wx\docs\html\wx\wx.chm + Source=C:\PROJECTS\wx\docs\htmlhelp\wx.chm Destination=%MAINDIR%\wxPython\docs\wx.chm Description=wxPython documentation Flags=0000000010000010 end item: Install File - Source=E:\PROJECTS\wx\docs\html\ogl\ogl.chm + Source=c:\PROJECTS\wx\docs\html\ogl\ogl.chm Destination=%MAINDIR%\wxPython\docs\ogl.chm Description=wxPython documentation Flags=0000000010000010 end item: Install File - Source=E:\PROJECTS\wx\docs\preamble.txt + Source=c:\PROJECTS\wx\docs\preamble.txt Destination=%MAINDIR%\wxPython\docs\preamble.txt Description=wxPython documentation Flags=0000000010000010 end item: Install File - Source=E:\PROJECTS\wx\docs\licence.txt + Source=c:\PROJECTS\wx\docs\licence.txt Destination=%MAINDIR%\wxPython\docs\licence.txt Description=wxPython documentation Flags=0000000010000010 end item: Install File - Source=E:\PROJECTS\wx\docs\licendoc.txt + Source=c:\PROJECTS\wx\docs\licendoc.txt Destination=%MAINDIR%\wxPython\docs\licendoc.txt Description=wxPython documentation Flags=0000000010000010 end item: Install File - Source=E:\PROJECTS\wx\docs\lgpl.txt + Source=c:\PROJECTS\wx\docs\lgpl.txt Destination=%MAINDIR%\wxPython\docs\lgpl.txt Description=wxPython documentation Flags=0000000010000010 end item: Install File - Source=E:\PROJECTS\wx\docs\gpl.txt + Source=c:\PROJECTS\wx\docs\gpl.txt Destination=%MAINDIR%\wxPython\docs\gpl.txt Description=wxPython documentation Flags=0000000010000010 diff --git a/wxPython/distrib/zipit.bat b/wxPython/distrib/zipit.bat new file mode 100755 index 0000000000..ee24243f01 --- /dev/null +++ b/wxPython/distrib/zipit.bat @@ -0,0 +1,43 @@ +@echo off + +rem **** Make a directory to build up a distribution tree +md _distrib_zip +md _distrib_zip\wxPython-%1 + +rem **** Copy the license files +copy %WXWIN%\docs\gpl.txt _distrib_zip\wxPython-%1 +copy %WXWIN%\docs\lgpl.txt _distrib_zip\wxPython-%1 +copy %WXWIN%\docs\licence.txt _distrib_zip\wxPython-%1 +copy %WXWIN%\docs\licendoc.txt _distrib_zip\wxPython-%1 +copy %WXWIN%\docs\preamble.txt _distrib_zip\wxPython-%1 + +rem **** Make a zip fron the live files +zip -@ -r _distrib_zip\temp.zip < distrib\wxPython.rsp + +rem **** Unzip it in our build dir +cd _distrib_zip\wxPython-%1 +unzip ..\temp.zip + +rem **** zip up the build dir +cd .. +zip -r ..\distrib\wxPython-src-%1.zip wxPython-%1 + + +rem **** copy the docs into the tree +md wxPython-%1\docs +md wxPython-%1\docs\wx +md wxPython-%1\docs\ogl +copy %WXWIN%\docs\html\wx\*.gif wxPython-%1\docs\wx +copy %WXWIN%\docs\html\wx\*.htm wxPython-%1\docs\wx +copy wxPython-%1\docs\wx\wx.htm wxPython-%1\docs\wx\index.htm +copy %WXWIN%\docs\html\ogl\*.gif wxPython-%1\docs\ogl +copy %WXWIN%\docs\html\ogl\*.htm wxPython-%1\docs\ogl +copy wxPython-%1\docs\ogl\ogl.htm wxPython-%1\docs\ogl\index.htm + +rem **** zip up the docs +zip -r ..\distrib\wxPython-docs-%1.zip wxPython-%1\docs + + +rem **** Cleanup +cd .. +del /sxzy _distrib_zip diff --git a/utils/wxPython/src/.cvsignore b/wxPython/src/.cvsignore similarity index 93% rename from utils/wxPython/src/.cvsignore rename to wxPython/src/.cvsignore index 6fd3ec59f8..40e8dd7480 100644 --- a/utils/wxPython/src/.cvsignore +++ b/wxPython/src/.cvsignore @@ -12,6 +12,7 @@ compile.py config.c glcanvas.h glcanvasc.exp +libwxPyHelpers.2.1.so.16.0.0 make.bat makefile.test sedscript diff --git a/utils/wxPython/src/__init__.py b/wxPython/src/__init__.py similarity index 100% rename from utils/wxPython/src/__init__.py rename to wxPython/src/__init__.py diff --git a/wxPython/src/__version__.py b/wxPython/src/__version__.py new file mode 100644 index 0000000000..d1f4e8a4f6 --- /dev/null +++ b/wxPython/src/__version__.py @@ -0,0 +1 @@ +ver = '2.1.16' diff --git a/wxPython/src/_calextras.py b/wxPython/src/_calextras.py new file mode 100644 index 0000000000..f2f8bde23c --- /dev/null +++ b/wxPython/src/_calextras.py @@ -0,0 +1,4 @@ + +# Stuff these names into the wx namespace so wxPyConstructObject can find them + +wx.wxCalendarEventPtr = wxCalendarEventPtr diff --git a/utils/wxPython/src/_defs.i b/wxPython/src/_defs.i similarity index 99% rename from utils/wxPython/src/_defs.i rename to wxPython/src/_defs.i index af2027b9c8..81fc5fc610 100644 --- a/utils/wxPython/src/_defs.i +++ b/wxPython/src/_defs.i @@ -159,6 +159,7 @@ typedef signed int EBool; typedef unsigned int size_t typedef int wxPrintQuality; typedef int wxCoord; +typedef char wxChar; //--------------------------------------------------------------------------- @@ -255,6 +256,7 @@ enum { wxPROCESS_ENTER, wxPASSWORD, wxTE_PROCESS_ENTER, + wxTE_PROCESS_TAB, wxTE_PASSWORD, wxTE_READONLY, wxTE_RICH, @@ -433,10 +435,12 @@ enum { wxHIDE_READONLY, wxOVERWRITE_PROMPT, wxFILE_MUST_EXIST, + wxMULTIPLE, wxACCEL_ALT, wxACCEL_CTRL, wxACCEL_SHIFT, + wxACCEL_NORMAL, wxPD_AUTO_HIDE, wxPD_APP_MODAL, @@ -949,6 +953,8 @@ enum wxEventType { wxEVT_NAVIGATION_KEY, + wxEVT_TIMER, + }; diff --git a/utils/wxPython/src/_extras.py b/wxPython/src/_extras.py similarity index 89% rename from utils/wxPython/src/_extras.py rename to wxPython/src/_extras.py index a3d76e54f5..a3cd475a6c 100644 --- a/utils/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -29,36 +29,36 @@ def _checkForCallback(obj, name, event, theID=-1): except: pass else: obj.Connect(theID, -1, event, cb) -def _StdWindowCallbacks(win): - _checkForCallback(win, "OnChar", wxEVT_CHAR) - _checkForCallback(win, "OnSize", wxEVT_SIZE) - _checkForCallback(win, "OnEraseBackground", wxEVT_ERASE_BACKGROUND) - _checkForCallback(win, "OnSysColourChanged", wxEVT_SYS_COLOUR_CHANGED) - _checkForCallback(win, "OnInitDialog", wxEVT_INIT_DIALOG) - _checkForCallback(win, "OnPaint", wxEVT_PAINT) - _checkForCallback(win, "OnIdle", wxEVT_IDLE) - - -def _StdFrameCallbacks(win): - _StdWindowCallbacks(win) - _checkForCallback(win, "OnActivate", wxEVT_ACTIVATE) - _checkForCallback(win, "OnMenuHighlight", wxEVT_MENU_HIGHLIGHT) - _checkForCallback(win, "OnCloseWindow", wxEVT_CLOSE_WINDOW) - - -def _StdDialogCallbacks(win): - _StdWindowCallbacks(win) - _checkForCallback(win, "OnOk", wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK) - _checkForCallback(win, "OnApply", wxEVT_COMMAND_BUTTON_CLICKED, wxID_APPLY) - _checkForCallback(win, "OnCancel", wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL) - _checkForCallback(win, "OnCloseWindow", wxEVT_CLOSE_WINDOW) - _checkForCallback(win, "OnCharHook", wxEVT_CHAR_HOOK) - - -def _StdOnScrollCallbacks(win): - try: cb = getattr(win, "OnScroll") - except: pass - else: EVT_SCROLL(win, cb) +## def _StdWindowCallbacks(win): +## _checkForCallback(win, "OnChar", wxEVT_CHAR) +## _checkForCallback(win, "OnSize", wxEVT_SIZE) +## _checkForCallback(win, "OnEraseBackground", wxEVT_ERASE_BACKGROUND) +## _checkForCallback(win, "OnSysColourChanged", wxEVT_SYS_COLOUR_CHANGED) +## _checkForCallback(win, "OnInitDialog", wxEVT_INIT_DIALOG) +## _checkForCallback(win, "OnPaint", wxEVT_PAINT) +## _checkForCallback(win, "OnIdle", wxEVT_IDLE) + + +## def _StdFrameCallbacks(win): +## _StdWindowCallbacks(win) +## _checkForCallback(win, "OnActivate", wxEVT_ACTIVATE) +## _checkForCallback(win, "OnMenuHighlight", wxEVT_MENU_HIGHLIGHT) +## _checkForCallback(win, "OnCloseWindow", wxEVT_CLOSE_WINDOW) + + +## def _StdDialogCallbacks(win): +## _StdWindowCallbacks(win) +## _checkForCallback(win, "OnOk", wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK) +## _checkForCallback(win, "OnApply", wxEVT_COMMAND_BUTTON_CLICKED, wxID_APPLY) +## _checkForCallback(win, "OnCancel", wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL) +## _checkForCallback(win, "OnCloseWindow", wxEVT_CLOSE_WINDOW) +## _checkForCallback(win, "OnCharHook", wxEVT_CHAR_HOOK) + + +## def _StdOnScrollCallbacks(win): +## try: cb = getattr(win, "OnScroll") +## except: pass +## else: EVT_SCROLL(win, cb) @@ -526,15 +526,9 @@ def EVT_SPIN_UP(win, id, func): win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func) def EVT_SPIN_DOWN(win, id, func): - win.Connect(id, -1,wxEVT_SCROLL_LINEDOWN, func) + win.Connect(id, -1, wxEVT_SCROLL_LINEDOWN, func) def EVT_SPIN(win, id, func): - win.Connect(id, -1, wxEVT_SCROLL_TOP, func) - win.Connect(id, -1, wxEVT_SCROLL_BOTTOM, func) - win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func) - win.Connect(id, -1, wxEVT_SCROLL_LINEDOWN, func) - win.Connect(id, -1, wxEVT_SCROLL_PAGEUP, func) - win.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN, func) win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK,func) @@ -563,33 +557,33 @@ def EVT_TASKBAR_RIGHT_DCLICK(win, func): win.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DCLICK, func) -# wxGrid -def EVT_GRID_SELECT_CELL(win, fn): - win.Connect(-1, -1, wxEVT_GRID_SELECT_CELL, fn) +## # wxGrid *** THE OLD ONE *** +## def EVT_GRID_SELECT_CELL(win, fn): +## win.Connect(-1, -1, wxEVT_GRID_SELECT_CELL, fn) -def EVT_GRID_CREATE_CELL(win, fn): - win.Connect(-1, -1, wxEVT_GRID_CREATE_CELL, fn) +## def EVT_GRID_CREATE_CELL(win, fn): +## win.Connect(-1, -1, wxEVT_GRID_CREATE_CELL, fn) -def EVT_GRID_CHANGE_LABELS(win, fn): - win.Connect(-1, -1, wxEVT_GRID_CHANGE_LABELS, fn) +## def EVT_GRID_CHANGE_LABELS(win, fn): +## win.Connect(-1, -1, wxEVT_GRID_CHANGE_LABELS, fn) -def EVT_GRID_CHANGE_SEL_LABEL(win, fn): - win.Connect(-1, -1, wxEVT_GRID_CHANGE_SEL_LABEL, fn) +## def EVT_GRID_CHANGE_SEL_LABEL(win, fn): +## win.Connect(-1, -1, wxEVT_GRID_CHANGE_SEL_LABEL, fn) -def EVT_GRID_CELL_CHANGE(win, fn): - win.Connect(-1, -1, wxEVT_GRID_CELL_CHANGE, fn) +## def EVT_GRID_CELL_CHANGE(win, fn): +## win.Connect(-1, -1, wxEVT_GRID_CELL_CHANGE, fn) -def EVT_GRID_CELL_LCLICK(win, fn): - win.Connect(-1, -1, wxEVT_GRID_CELL_LCLICK, fn) +## def EVT_GRID_CELL_LCLICK(win, fn): +## win.Connect(-1, -1, wxEVT_GRID_CELL_LCLICK, fn) -def EVT_GRID_CELL_RCLICK(win, fn): - win.Connect(-1, -1, wxEVT_GRID_CELL_RCLICK, fn) +## def EVT_GRID_CELL_RCLICK(win, fn): +## win.Connect(-1, -1, wxEVT_GRID_CELL_RCLICK, fn) -def EVT_GRID_LABEL_LCLICK(win, fn): - win.Connect(-1, -1, wxEVT_GRID_LABEL_LCLICK, fn) +## def EVT_GRID_LABEL_LCLICK(win, fn): +## win.Connect(-1, -1, wxEVT_GRID_LABEL_LCLICK, fn) -def EVT_GRID_LABEL_RCLICK(win, fn): - win.Connect(-1, -1, wxEVT_GRID_LABEL_RCLICK, fn) +## def EVT_GRID_LABEL_RCLICK(win, fn): +## win.Connect(-1, -1, wxEVT_GRID_LABEL_RCLICK, fn) # wxSashWindow @@ -671,6 +665,12 @@ def EVT_SPLITTER_DOUBLECLICKED(win, id, func): win.Connect(id, -1, wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, func) +# wxTimer +def EVT_TIMER(win, id, func): + win.Connect(id, -1, wxEVT_TIMER, func) + + + #---------------------------------------------------------------------- class wxTimer(wxPyTimer): @@ -837,6 +837,20 @@ class wxPySimpleApp(wxApp): return true +class wxPyWidgetTester(wxApp): + def __init__(self, size = (250, 100)): + self.size = size + wxApp.__init__(self, 0) + + def OnInit(self): + self.frame = wxFrame(None, -1, "Widget Tester", pos=(0,0), size=self.size) + self.SetTopWindow(self.frame) + return true + + def SetWidget(self, widgetClass, *args): + w = apply(widgetClass, (self.frame,) + args) + self.frame.Show(true) + #---------------------------------------------------------------------------- # DO NOT hold any other references to this object. This is how we know when # to cleanup system resources that wxWin is holding. When this module is diff --git a/wxPython/src/_gridextras.py b/wxPython/src/_gridextras.py new file mode 100644 index 0000000000..198ed644ff --- /dev/null +++ b/wxPython/src/_gridextras.py @@ -0,0 +1,19 @@ + + +# Stuff these names into the wx namespace so wxPyConstructObject can find them + +wx.wxGridEventPtr = wxGridEventPtr +wx.wxGridSizeEventPtr = wxGridSizeEventPtr +wx.wxGridRangeSelectEventPtr = wxGridRangeSelectEventPtr +wx.wxGridCellRendererPtr = wxGridCellRendererPtr +wx.wxPyGridCellRendererPtr = wxPyGridCellRendererPtr +wx.wxGridCellEditorPtr = wxGridCellEditorPtr +wx.wxPyGridCellEditorPtr = wxPyGridCellEditorPtr +wx.wxGridCellAttrPtr = wxGridCellAttrPtr +wx.wxGridCellAttrProviderPtr = wxGridCellAttrProviderPtr +wx.wxPyGridCellAttrProviderPtr = wxPyGridCellAttrProviderPtr +wx.wxGridTableBasePtr = wxGridTableBasePtr +wx.wxPyGridTableBasePtr = wxPyGridTableBasePtr +wx.wxGridTableMessagePtr = wxGridTableMessagePtr +wx.wxGridCellCoordsPtr = wxGridCellCoordsPtr +wx.wxGridPtr = wxGridPtr diff --git a/utils/wxPython/modules/html/_extras.py b/wxPython/src/_htmlextras.py similarity index 100% rename from utils/wxPython/modules/html/_extras.py rename to wxPython/src/_htmlextras.py diff --git a/wxPython/src/build.cfg b/wxPython/src/build.cfg new file mode 100644 index 0000000000..edca6547f0 --- /dev/null +++ b/wxPython/src/build.cfg @@ -0,0 +1,153 @@ +# -*- python -*- +import sys + +MODULE = 'wxc' +SWIGFILES = ['wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i', + 'misc.i', 'misc2.i', 'utils.i', 'gdi.i', 'mdi.i', 'controls.i', + 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', + 'image.i', 'printfw.i', 'sizers.i', 'clip_dnd.i', 'grid.i', + 'html.i', 'htmlhelp.i', 'calendar.i' + ] + +PYFILES = ['__init__.py', '__version__.py'] + +SWIGDEPS = '_defs.i my_typemaps.i' +OTHERDEPS = 'helpers.h' + +if sys.platform == 'win32': + RESFILE = 1 + SOURCES = ['helpers.cpp', 'libpy.c'] + LIBS = '$(PYTHONLIB)' + OTHERRULES = """ +dist: + cd .. + distrib\zipit.bat $(VERSION) + +dbg: + cd ..\distrib + makedbg.bat $(VERSION) + +dev: + cd ..\distrib + makedev.bat $(VERSION) + +__version__.py: ../distrib/build.py build.cfg + echo ver = '$(VERSION)' > __version__.py + +""" + +else: + DEFAULTRULE = 'default: $(GENCODEDIR) helperlib $(TARGET) $(BUILDDIR)/$(TARGET) bldpycfiles' + OTHERINSTALLTARGETS = 'installLib installDemo installHelpers ' + OTHERUNINSTALLTARGETS = 'uninstallLib uninstallDemo uninstallHelpers ' + + OTHERCFLAGS = '`gtk-config --cflags`' + OTHERRULES = """ +HELPERLIBNAME = lib$(HELPERLIB).$(MAJVER)$(SO).$(BLDVER).0.0 +helperlib: $(HELPERLIBNAME) + +$(HELPERLIBNAME) : helpers.o libpy.o + $(LDSHARED) helpers.o libpy.o $(LFLAGS) -o $@ + ln -s $(HELPERLIBNAME) lib$(HELPERLIB).$(MAJVER)$(SO).$(BLDVER) + ln -s $(HELPERLIBNAME) lib$(HELPERLIB).$(MAJVER)$(SO) + ln -s $(HELPERLIBNAME) lib$(HELPERLIB)$(SO) + + +installHelpers: $(HELPERLIBDIR)/$(HELPERLIBNAME) + + +$(HELPERLIBDIR)/$(HELPERLIBNAME) : $(HELPERLIBNAME) + cp $(HELPERLIBNAME) $(HELPERLIBDIR) + cd $(HELPERLIBDIR); \ + ln -sf $(HELPERLIBNAME) lib$(HELPERLIB).$(MAJVER)$(SO).$(BLDVER); \ + ln -sf $(HELPERLIBNAME) lib$(HELPERLIB).$(MAJVER)$(SO); \ + ln -sf $(HELPERLIBNAME) lib$(HELPERLIB)$(SO) + @echo --------------------------------------------------------- + @echo You may have to run ldconfig, or set an environment + @echo variable in order for $(HELPERLIBDIR)/lib$(HELPERLIB)$(SO) + @echo to be found at runtime. See your man pages for ld.so or + @echo equivalent. + @echo --------------------------------------------------------- + + +installLib: + mkdir $(TARGETDIR)/lib; \\ + mkdir $(TARGETDIR)/lib/sizers; \\ + mkdir $(TARGETDIR)/lib/editor; \\ + cp ../wxPython/lib/*.py $(TARGETDIR)/lib; \\ + cp ../wxPython/lib/sizers/*.py $(TARGETDIR)/lib/sizers; \\ + cp ../wxPython/lib/editor/*.py $(TARGETDIR)/lib/editor; \\ + cp ../wxPython/lib/*.txt $(TARGETDIR)/lib; \\ + cp ../wxPython/lib/sizers/*.txt $(TARGETDIR)/lib/sizers;\\ + cp ../wxPython/lib/editor/*.txt $(TARGETDIR)/lib/editor;\\ + $(EXECPREFIX)/bin/python $(PYLIB)/compileall.py $(TARGETDIR); \\ + $(EXECPREFIX)/bin/python -O $(PYLIB)/compileall.py $(TARGETDIR); + +installDemo: + mkdir $(TARGETDIR)/demo; \\ + mkdir $(TARGETDIR)/demo/bitmaps; \\ + mkdir $(TARGETDIR)/demo/data; \\ + cp ../demo/*.py $(TARGETDIR)/demo; \\ + cp ../demo/*.xml $(TARGETDIR)/demo; \\ + cp ../demo/*.txt $(TARGETDIR)/demo; \\ + cp ../demo/bitmaps/*.bmp $(TARGETDIR)/demo/bitmaps; \\ + cp ../demo/bitmaps/*.ico $(TARGETDIR)/demo/bitmaps; \\ + cp ../demo/bitmaps/*.gif $(TARGETDIR)/demo/bitmaps; \\ + cp ../demo/bitmaps/*.png $(TARGETDIR)/demo/bitmaps; \\ + cp ../demo/bitmaps/*.jpg $(TARGETDIR)/demo/bitmaps; \\ + cp ../demo/data/*.png $(TARGETDIR)/demo/data; \\ + cp ../demo/data/*.htm $(TARGETDIR)/demo/data; \\ + cp ../demo/data/*.bmp $(TARGETDIR)/demo/data; \\ + cp ../demo/data/*.txt $(TARGETDIR)/demo/data; \\ + cp ../demo/data/*.i $(TARGETDIR)/demo/data; \\ + cp ../demo/data/*.h $(TARGETDIR)/demo/data; \\ + echo "(1,0)" > $(TARGETDIR)/demo/data/showTips; \\ + chmod 666 $(TARGETDIR)/demo/data/showTips; \\ + $(EXECPREFIX)/bin/python $(PYLIB)/compileall.py $(TARGETDIR)/demo;\\ + $(EXECPREFIX)/bin/python -O $(PYLIB)/compileall.py $(TARGETDIR)/demo; + + +uninstallLib: + rm -rf $(TARGETDIR)/lib; + +uninstallDemo: + rm -rf $(TARGETDIR)/demo; + + +uninstallHelpers: + rm -f $(HELPERLIBDIR)/lib$(HELPERLIB)$(SO) + rm -f $(HELPERLIBDIR)/$(HELPERLIBNAME) + rm -f $(HELPERLIBDIR)/lib$(HELPERLIB).$(MAJVER)$(SO).$(BLDVER) + rm -f $(HELPERLIBDIR)/lib$(HELPERLIB).$(MAJVER)$(SO) + rm -f $(HELPERLIBDIR)/lib$(HELPERLIB)$(SO) + + +__version__.py: ../distrib/build.py build.cfg + echo ver = \\'$(VERSION)\\' > __version__.py + + +#---------------------------------------------------------------------- + +dist: tgz rpm + +tgz: + cd ..; distrib/maketgz $(VERSION) + +rpm: + cd ../distrib; ./makerpm $(VERSION) + + +""" + + + + + +OTHERRULES = OTHERRULES + """ + +$(GENCODEDIR)/wx.py : _extras.py +$(GENCODEDIR)/grid.py : _gridextras.py +$(GENCODEDIR)/html.py : _htmlextras.py +$(GENCODEDIR)/calendar.py : _calextras.py + +""" diff --git a/wxPython/src/calendar.i b/wxPython/src/calendar.i new file mode 100644 index 0000000000..73fc6bd66a --- /dev/null +++ b/wxPython/src/calendar.i @@ -0,0 +1,231 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: calendar.i +// Purpose: SWIG definitions for the wxCalendarCtrl +// +// Author: Robin Dunn +// +// Created: 23-May-2000 +// RCS-ID: $Id$ +// Copyright: (c) 2000 by Total Control Software +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +%module calendar + + +%{ +#include "helpers.h" +#include <wx/calctrl.h> +%} + +//---------------------------------------------------------------------- + +%include typemaps.i +%include my_typemaps.i + +// Import some definitions of other classes, etc. +%import _defs.i +%import misc.i +%import windows.i +%import controls.i +%import events.i +%import utils.i + +%pragma(python) code = "import wx" + +//--------------------------------------------------------------------------- + +enum { + wxCAL_SUNDAY_FIRST, + wxCAL_MONDAY_FIRST, + wxCAL_SHOW_HOLIDAYS, + wxCAL_NO_YEAR_CHANGE, + wxCAL_NO_MONTH_CHANGE, +}; + + +enum wxCalendarHitTestResult +{ + wxCAL_HITTEST_NOWHERE, // outside of anything + wxCAL_HITTEST_HEADER, // on the header (weekdays) + wxCAL_HITTEST_DAY // on a day in the calendar +}; + +// border types for a date +enum wxCalendarDateBorder +{ + wxCAL_BORDER_NONE, // no border (default) + wxCAL_BORDER_SQUARE, // a rectangular border + wxCAL_BORDER_ROUND // a round border +}; + +//--------------------------------------------------------------------------- + + +class wxCalendarDateAttr +{ +public: + // ctors + wxCalendarDateAttr(const wxColour& colText, + const wxColour& colBack = wxNullColour, + const wxColour& colBorder = wxNullColour, + const wxFont& font = wxNullFont, + wxCalendarDateBorder border = wxCAL_BORDER_NONE); + + %name(wxCalendarDateAttrBorder) + wxCalendarDateAttr(wxCalendarDateBorder border, + const wxColour& colBorder = wxNullColour); + + // setters + void SetTextColour(const wxColour& colText); + void SetBackgroundColour(const wxColour& colBack); + void SetBorderColour(const wxColour& col); + void SetFont(const wxFont& font); + void SetBorder(wxCalendarDateBorder border); + void SetHoliday(bool holiday); + + // accessors + bool HasTextColour() const; + bool HasBackgroundColour() const; + bool HasBorderColour() const; + bool HasFont() const; + bool HasBorder() const; + + bool IsHoliday() const; + + const wxColour& GetTextColour() const; + const wxColour& GetBackgroundColour() const; + const wxColour& GetBorderColour() const; + const wxFont& GetFont() const; + wxCalendarDateBorder GetBorder() const; +}; + +//--------------------------------------------------------------------------- + +class wxCalendarCtrl; + +class wxCalendarEvent : public wxCommandEvent +{ +public: + wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type); + + const wxDateTime& GetDate() const; + wxDateTime::WeekDay GetWeekDay() const; + +}; + +enum { + wxEVT_CALENDAR_DOUBLECLICKED, + wxEVT_CALENDAR_SEL_CHANGED, + wxEVT_CALENDAR_DAY_CHANGED, + wxEVT_CALENDAR_MONTH_CHANGED, + wxEVT_CALENDAR_YEAR_CHANGED, + wxEVT_CALENDAR_WEEKDAY_CLICKED, +}; + +%pragma(python) code = " +def EVT_CALENDAR(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_DOUBLECLICKED, fn) + +def EVT_CALENDAR_SEL_CHANGED(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_SEL_CHANGED, fn) + +def EVT_CALENDAR_DAY(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_DAY_CHANGED, fn) + +def EVT_CALENDAR_MONTH(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_MONTH_CHANGED, fn) + +def EVT_CALENDAR_YEAR(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_YEAR_CHANGED, fn) + +def EVT_CALENDAR_WEEKDAY_CLICKED(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_WEEKDAY_CLICKED, fn) + +" + +//--------------------------------------------------------------------------- + +class wxCalendarCtrl : public wxControl +{ +public: + // construction + wxCalendarCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& date = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAL_SHOW_HOLIDAYS, + const char* name = "calendar"); + + // set/get the current date + // ------------------------ + + void SetDate(const wxDateTime& date); + const wxDateTime& GetDate() const; + + // calendar mode + // ------------- + + // some calendar styles can't be changed after the control creation by + // just using SetWindowStyle() and Refresh() and the functions below + // should be used instead for them + + // corresponds to wxCAL_NO_YEAR_CHANGE bit + void EnableYearChange(bool enable = TRUE); + + // corresponds to wxCAL_NO_MONTH_CHANGE bit + void EnableMonthChange(bool enable = TRUE); + + // corresponds to wxCAL_SHOW_HOLIDAYS bit + void EnableHolidayDisplay(bool display = TRUE); + + // customization + // ------------- + + // header colours are used for painting the weekdays at the top + void SetHeaderColours(const wxColour& colFg, const wxColour& colBg); + const wxColour& GetHeaderColourFg() const; + const wxColour& GetHeaderColourBg() const; + + // highlight colour is used for the currently selected date + void SetHighlightColours(const wxColour& colFg, const wxColour& colBg); + const wxColour& GetHighlightColourFg() const; + const wxColour& GetHighlightColourBg() const; + + // holiday colour is used for the holidays (if style & wxCAL_SHOW_HOLIDAYS) + void SetHolidayColours(const wxColour& colFg, const wxColour& colBg); + const wxColour& GetHolidayColourFg() const; + const wxColour& GetHolidayColourBg() const; + + // an item without custom attributes is drawn with the default colours and + // font and without border, setting custom attributes allows to modify this + // + // the day parameter should be in 1..31 range, for days 29, 30, 31 the + // corresponding attribute is just unused if there is no such day in the + // current month + + wxCalendarDateAttr *GetAttr(size_t day) const; + void SetAttr(size_t day, wxCalendarDateAttr *attr); + + void SetHoliday(size_t day); + + void ResetAttr(size_t day); + + // returns one of wxCAL_HITTEST_XXX constants and fills either date or wd + // with the corresponding value (none for NOWHERE, the date for DAY and wd + // for HEADER) + wxCalendarHitTestResult HitTest(const wxPoint& pos, + wxDateTime *date = NULL, + wxDateTime::WeekDay *wd = NULL); + +}; + + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- + +%pragma(python) include="_calextras.py"; + +//--------------------------------------------------------------------------- + diff --git a/utils/wxPython/src/clip_dnd.i b/wxPython/src/clip_dnd.i similarity index 93% rename from utils/wxPython/src/clip_dnd.i rename to wxPython/src/clip_dnd.i index e054bedf24..a9ff1f6f94 100644 --- a/utils/wxPython/src/clip_dnd.i +++ b/wxPython/src/clip_dnd.i @@ -151,9 +151,12 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) { if (m_myInst.findCallback("GetDataHere")) { PyObject* ro; ro = m_myInst.callCallbackObj(Py_BuildValue("()")); - rval = (ro != Py_None && PyString_Check(ro)); - if (rval) - memcpy(buf, PyString_AsString(ro), PyString_Size(ro)); + if (ro) { + rval = (ro != Py_None && PyString_Check(ro)); + if (rval) + memcpy(buf, PyString_AsString(ro), PyString_Size(ro)); + Py_DECREF(ro); + } } wxPySaveThread(doSave); return rval; @@ -180,8 +183,8 @@ bool wxPyDataObjectSimple::SetData(size_t len, const void *buf) { class wxPyDataObjectSimple : public wxDataObjectSimple { public: wxPyDataObjectSimple(const wxDataFormat& format = wxPyFormatInvalid); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDataObjectSimple)" }; //---------------------------------------------------------------------- @@ -232,8 +235,8 @@ IMP_PYCALLBACK__STRING(wxPyTextDataObject, wxTextDataObject, SetText); class wxPyTextDataObject : public wxTextDataObject { public: wxPyTextDataObject(const wxString& text = wxEmptyString); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyTextDataObject)" }; //---------------------------------------------------------------------- @@ -266,8 +269,11 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() { PyObject* ro; wxBitmap* ptr; ro = m_myInst.callCallbackObj(Py_BuildValue("()")); - if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) - rval = ptr; + if (ro) { + if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) + rval = ptr; + Py_DECREF(ro); + } } wxPySaveThread(doSave); return *rval; @@ -289,8 +295,8 @@ void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { class wxPyBitmapDataObject : public wxBitmapDataObject { public: wxPyBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyBitmapDataObject)" }; @@ -435,8 +441,8 @@ public: const wxIcon &go = wxNullIcon); #endif - void _setSelf(PyObject* self, int incref); - %pragma(python) addtomethod = "__init__:self._setSelf(self, 0)" + void _setSelf(PyObject* self, PyObject* _class, int incref); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxDropSource, 0)" ~wxPyDropSource(); void SetData(wxDataObject& data); @@ -490,8 +496,8 @@ class wxPyDropTarget : public wxDropTarget { public: wxPyDropTarget(wxDataObject *dataObject = NULL); %pragma(python) addtomethod = "__init__:if _args:_args[0].thisown = 0" - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDropTarget)" ~wxPyDropTarget(); @@ -544,8 +550,8 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyTextDropTarget, wxTextDropTarget, OnDrop); %name(wxTextDropTarget) class wxPyTextDropTarget : public wxPyDropTarget { public: wxPyTextDropTarget(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxTextDropTarget)" //bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0; wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def); @@ -603,8 +609,8 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyFileDropTarget, wxFileDropTarget, OnDrop); { public: wxPyFileDropTarget(); - void _setSelf(PyObject* self); - %pragma(python) addtomethod = "__init__:self._setSelf(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxFileDropTarget)" // bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) = 0; wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def); diff --git a/utils/wxPython/src/cmndlgs.i b/wxPython/src/cmndlgs.i similarity index 82% rename from utils/wxPython/src/cmndlgs.i rename to wxPython/src/cmndlgs.i index 158e235017..088e509085 100644 --- a/utils/wxPython/src/cmndlgs.i +++ b/wxPython/src/cmndlgs.i @@ -54,7 +54,7 @@ class wxColourDialog : public wxDialog { public: wxColourDialog(wxWindow* parent, wxColourData* data = NULL); - %pragma(python) addtomethod = "__init__:wx._StdDialogCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" wxColourData& GetColourData(); int ShowModal(); @@ -71,7 +71,7 @@ public: long style = 0, const wxPoint& pos = wxPyDefaultPosition); - %pragma(python) addtomethod = "__init__:wx._StdDialogCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" wxString GetPath(); wxString GetMessage(); @@ -93,7 +93,7 @@ public: long style = 0, const wxPoint& pos = wxPyDefaultPosition); - %pragma(python) addtomethod = "__init__:wx._StdDialogCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" wxString GetDirectory(); wxString GetFilename(); @@ -110,6 +110,32 @@ public: void SetStyle(long style); void SetWildcard(const wxString& wildCard); int ShowModal(); + + %addmethods { + PyObject* GetFilenames() { + wxArrayString arr; + self->GetFilenames(arr); + size_t count = arr.GetCount(); + PyObject* listObj = PyList_New(0); + for(size_t x=0; x<count; x++) { + PyObject* name = PyString_FromString(arr[x]); + PyList_Append(listObj, name); + } + return listObj; + } + + PyObject* GetPaths() { + wxArrayString arr; + self->GetPaths(arr); + size_t count = arr.GetCount(); + PyObject* listObj = PyList_New(0); + for(size_t x=0; x<count; x++) { + PyObject* name = PyString_FromString(arr[x]); + PyList_Append(listObj, name); + } + return listObj; + } + } }; @@ -136,7 +162,7 @@ public: } } - %pragma(python) addtomethod = "__init__:wx._StdDialogCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" int GetSelection(); wxString GetStringSelection(); @@ -156,7 +182,7 @@ public: long style = wxOK | wxCANCEL | wxCENTRE, const wxPoint& pos = wxPyDefaultPosition); - %pragma(python) addtomethod = "__init__:wx._StdDialogCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" wxString GetValue(); void SetValue(const wxString& value); @@ -190,7 +216,7 @@ class wxFontDialog : public wxDialog { public: wxFontDialog(wxWindow* parent, wxFontData* data); - %pragma(python) addtomethod = "__init__:wx._StdDialogCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" wxFontData& GetFontData(); int ShowModal(); @@ -207,7 +233,7 @@ public: long style = wxOK | wxCANCEL | wxCENTRE, const wxPoint& pos = wxPyDefaultPosition); - %pragma(python) addtomethod = "__init__:wx._StdDialogCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" int ShowModal(); }; diff --git a/utils/wxPython/src/controls.i b/wxPython/src/controls.i similarity index 90% rename from utils/wxPython/src/controls.i rename to wxPython/src/controls.i index 129a23b1d3..35fbfd1b81 100644 --- a/utils/wxPython/src/controls.i +++ b/wxPython/src/controls.i @@ -16,6 +16,7 @@ #include "helpers.h" #include <wx/slider.h> #include <wx/spinbutt.h> +#include <wx/spinctrl.h> #include <wx/dynarray.h> #include <wx/statline.h> //#include <wx/toggbutt.h> @@ -68,7 +69,7 @@ public: const wxValidator& validator=wxPyDefaultValidator, const char* name="control"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" void Command(wxCommandEvent& event); wxString GetLabel(); @@ -87,7 +88,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "button"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" void SetDefault(); void SetBackgroundColour(const wxColour& colour); @@ -112,7 +113,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "button"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" wxBitmap& GetBitmapLabel(); wxBitmap& GetBitmapDisabled(); @@ -123,6 +124,9 @@ public: void SetBitmapSelected(const wxBitmap& bitmap); void SetBitmapLabel(const wxBitmap& bitmap); + void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; } + int GetMarginX() const { return m_marginX; } + int GetMarginY() const { return m_marginY; } }; //---------------------------------------------------------------------- @@ -161,7 +165,7 @@ public: const wxValidator& val = wxPyDefaultValidator, char* name = "checkBox"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" bool GetValue(); void SetValue(const bool state); @@ -179,7 +183,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "choice"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" void Append(const wxString& item); void Clear(); @@ -206,7 +210,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "comboBox"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" void Append(const wxString& item); // TODO: void Append(const wxString& item, char* clientData); @@ -246,7 +250,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "gauge"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" int GetBezelFace(); int GetRange(); @@ -293,7 +297,7 @@ public: long style = 0, char* name = "staticText"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" wxString GetLabel(); void SetLabel(const wxString& label); @@ -311,7 +315,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "listBox"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" void Append(const wxString& item); // TODO: void Append(const wxString& item, char* clientData); @@ -328,7 +332,7 @@ public: wxArrayInt lst; self->GetSelections(lst); PyObject *tup = PyTuple_New(lst.GetCount()); - for(int i=0; i<lst.GetCount(); i++) { + for(size_t i=0; i<lst.GetCount(); i++) { PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i])); } return tup; @@ -364,7 +368,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "listBox"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" bool IsChecked(int uiIndex); void Check(int uiIndex, int bCheck = TRUE); @@ -384,7 +388,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "text"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" void Clear(); void Copy(); @@ -441,7 +445,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "scrollBar"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" int GetRange(); int GetPageSize(); @@ -482,7 +486,7 @@ public: long style = 0, char* name = "staticBitmap"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" const wxBitmap& GetBitmap(); void SetBitmap(const wxBitmap& bitmap); @@ -503,7 +507,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "radioBox"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" void Enable(bool enable); %name(EnableItem)void Enable(int n, bool enable); @@ -536,7 +540,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "radioButton"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" bool GetValue(); void SetValue(bool value); @@ -554,7 +558,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "slider"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" void ClearSel(); void ClearTicks(); @@ -580,3 +584,20 @@ public: //---------------------------------------------------------------------- +class wxSpinCtrl : public wxSpinButton { +public: + wxSpinCtrl(wxWindow *parent, + wxWindowID id = -1, + const char* value = "", + const wxPoint& pos = wxPyDefaultPosition, + const wxSize& size = wxPyDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const char* name = "wxSpinCtrl"); + + +}; + + +//---------------------------------------------------------------------- + diff --git a/utils/wxPython/src/controls2.i b/wxPython/src/controls2.i similarity index 78% rename from utils/wxPython/src/controls2.i rename to wxPython/src/controls2.i index f2cfc6430f..d24b8ebb28 100644 --- a/utils/wxPython/src/controls2.i +++ b/wxPython/src/controls2.i @@ -75,10 +75,6 @@ enum { wxLIST_ALIGN_LEFT, wxLIST_ALIGN_TOP, wxLIST_ALIGN_SNAP_TO_GRID, - wxLIST_FORMAT_LEFT, - wxLIST_FORMAT_RIGHT, - wxLIST_FORMAT_CENTRE, - wxLIST_FORMAT_CENTER, wxLIST_AUTOSIZE, wxLIST_AUTOSIZE_USEHEADER, wxLIST_RECT_BOUNDS, @@ -91,26 +87,103 @@ enum { }; +enum wxListColumnFormat +{ + wxLIST_FORMAT_LEFT, + wxLIST_FORMAT_RIGHT, + wxLIST_FORMAT_CENTRE, + wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE +}; + + +class wxListItemAttr +{ +public: + // ctors + wxListItemAttr(); + //wxListItemAttr(const wxColour& colText, + // const wxColour& colBack, + // const wxFont& font) + // : m_colText(colText), m_colBack(colBack), m_font(font) { } + + // setters + void SetTextColour(const wxColour& colText); + void SetBackgroundColour(const wxColour& colBack); + void SetFont(const wxFont& font); + + // accessors + bool HasTextColour(); + bool HasBackgroundColour(); + bool HasFont(); + + const wxColour& GetTextColour(); + const wxColour& GetBackgroundColour(); + const wxFont& GetFont(); +}; + + class wxListItem { public: + wxListItem(); + ~wxListItem(); + + // resetting + void Clear(); + void ClearAttributes(); + + // setters + void SetMask(long mask); + void SetId(long id); + void SetColumn(int col); + void SetState(long state); + void SetStateMask(long stateMask); + void SetText(const wxString& text); + void SetImage(int image); + void SetData(long data); + + void SetWidth(int width); + void SetAlign(wxListColumnFormat align); + + void SetTextColour(const wxColour& colText); + void SetBackgroundColour(const wxColour& colBack); + void SetFont(const wxFont& font); + + // accessors + long GetMask(); + long GetId(); + int GetColumn(); + long GetState(); + const wxString& GetText(); + int GetImage(); + long GetData(); + + int GetWidth(); + wxListColumnFormat GetAlign(); + + wxListItemAttr *GetAttributes(); + bool HasAttributes(); + + wxColour GetTextColour() const; + wxColour GetBackgroundColour() const; + wxFont GetFont() const; + + // these members are public for compatibility long m_mask; // Indicates what fields are valid long m_itemId; // The zero-based item position int m_col; // Zero-based column, if in report mode long m_state; // The state of the item - long m_stateMask; // Which flags of m_state are valid (uses same flags) + long m_stateMask;// Which flags of m_state are valid (uses same flags) wxString m_text; // The label/header text int m_image; // The zero-based index into an image list long m_data; // App-defined data -// wxColour *m_colour; // only wxGLC, not supported by Windows ;-> // For columns only int m_format; // left, right, centre int m_width; // width of column - wxListItem(); - ~wxListItem(); }; + class wxListEvent: public wxCommandEvent { public: int m_code; @@ -120,8 +193,21 @@ public: bool m_cancelled; wxPoint m_pointDrag; wxListItem m_item; -}; + int GetCode(); + long GetIndex(); + long GetOldIndex(); + long GetOldItem(); + int GetColumn(); + bool Cancelled(); + wxPoint GetPoint(); + const wxString& GetLabel(); + const wxString& GetText(); + int GetImage(); + long GetData(); + long GetMask(); + const wxListItem& GetItem(); +}; @@ -134,7 +220,7 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "listCtrl"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); bool DeleteItem(long item); @@ -230,13 +316,13 @@ public: if (!PyCallable_Check(func)) return FALSE; - return self->SortItems(wxPyTreeCtrl_SortItems, (long)func); + return self->SortItems(wxPyListCtrl_SortItems, (long)func); } } }; %{ - int wxCALLBACK wxPyTreeCtrl_SortItems(long item1, long item2, long funcPtr) { + int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) { int retval = 0; PyObject* func = (PyObject*)funcPtr; bool doSave = wxPyRestoreThread(); @@ -292,6 +378,12 @@ public: ~wxTreeItemId(); bool IsOk(); + %addmethods { + int __cmp__(wxTreeItemId* other) { + if (! other) return 0; + return *self != *other; + } + } }; @@ -352,21 +444,55 @@ public: }; + +%{ +class wxPyTreeCtrl : public wxTreeCtrl { +public: + wxPyTreeCtrl(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + char* name) : + wxTreeCtrl(parent, id, pos, size, style, validator, name) {} + + + int OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2) { + int rval = 0; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("OnCompareItems")) + rval = m_myInst.callCallback(Py_BuildValue( + "(OO)", + wxPyConstructObject((void*)&item1, "wxTreeItemId"), + wxPyConstructObject((void*)&item2, "wxTreeItemId"))); + else + rval = wxTreeCtrl::OnCompareItems(item1, item2); + wxPySaveThread(doSave); + return rval; + } + PYPRIVATE; +}; + +%} + // These are for the GetFirstChild/GetNextChild methods below %typemap(python, in) long& INOUT = long* INOUT; %typemap(python, argout) long& INOUT = long* INOUT; -class wxTreeCtrl : public wxControl { +%name(wxTreeCtrl)class wxPyTreeCtrl : public wxControl { public: - wxTreeCtrl(wxWindow *parent, wxWindowID id = -1, + wxPyTreeCtrl(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxPyDefaultPosition, const wxSize& size = wxPyDefaultSize, long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, const wxValidator& validator = wxPyDefaultValidator, char* name = "wxTreeCtrl"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxTreeCtrl)" size_t GetCount(); unsigned int GetIndent(); @@ -397,13 +523,15 @@ public: wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); if (data == NULL) { data = new wxPyTreeItemData(); + data->SetId(item); // set the id self->SetItemData(item, data); } return data; } void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) { - self->SetItemData(item, data); + data->SetId(item); // set the id + self->SetItemData(item, data); } // [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by @@ -412,6 +540,7 @@ public: wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); if (data == NULL) { data = new wxPyTreeItemData(); + data->SetId(item); // set the id self->SetItemData(item, data); } return data->GetData(); @@ -421,6 +550,7 @@ public: wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); if (data == NULL) { data = new wxPyTreeItemData(obj); + data->SetId(item); // set the id self->SetItemData(item, data); } else data->SetData(obj); @@ -481,6 +611,12 @@ public: const wxString& text, int image = -1, int selectedImage = -1, wxPyTreeItemData *data = NULL); + %name(InsertItemBefore) + wxTreeItemId InsertItem(const wxTreeItemId& parent, + size_t before, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); wxTreeItemId AppendItem(const wxTreeItemId& parent, const wxString& text, int image = -1, int selectedImage = -1, @@ -514,6 +650,8 @@ public: bool IsBold(const wxTreeItemId& item) const; wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT); + + void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col); void SetItemFont(const wxTreeItemId& item, const wxFont& font); @@ -541,14 +679,19 @@ public: #endif %pragma(python) addtoclass = " - # Redefine a couple methods that SWIG gets a bit confused on... - def GetFirstChild(self,arg0,arg1): - val1, val2 = controls2c.wxTreeCtrl_GetFirstChild(self.this,arg0.this,arg1) + # Redefine some methods that SWIG gets a bit confused on... + def GetFirstChild(self, *_args, **_kwargs): + val1,val2 = apply(controls2c.wxTreeCtrl_GetFirstChild,(self,) + _args, _kwargs) + val1 = wxTreeItemIdPtr(val1) + val1.thisown = 1 + return (val1,val2) + def GetNextChild(self, *_args, **_kwargs): + val1,val2 = apply(controls2c.wxTreeCtrl_GetNextChild,(self,) + _args, _kwargs) val1 = wxTreeItemIdPtr(val1) val1.thisown = 1 return (val1,val2) - def GetNextChild(self,arg0,arg1): - val1, val2 = controls2c.wxTreeCtrl_GetNextChild(self.this,arg0.this,arg1) + def HitTest(self, *_args, **_kwargs): + val1, val2 = apply(controls2c.wxTreeCtrl_HitTest,(self,) + _args, _kwargs) val1 = wxTreeItemIdPtr(val1) val1.thisown = 1 return (val1,val2) @@ -574,7 +717,7 @@ public: long style = 0, char* name = "tabCtrl"); - %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)" bool DeleteAllItems(); bool DeleteItem(int item); diff --git a/utils/wxPython/src/events.i b/wxPython/src/events.i similarity index 96% rename from utils/wxPython/src/events.i rename to wxPython/src/events.i index 1464154828..6ca6f66c18 100644 --- a/utils/wxPython/src/events.i +++ b/wxPython/src/events.i @@ -26,6 +26,7 @@ // Import some definitions of other classes, etc. %import _defs.i %import misc.i +%import gdi.i //--------------------------------------------------------------------------- @@ -168,6 +169,9 @@ public: bool ShiftDown(); long KeyCode(); + long GetKeyCode(); + bool HasModifiers(); + long GetX(); long GetY(); wxPoint GetPosition(); @@ -388,20 +392,29 @@ public: //--------------------------------------------------------------------------- -class wxWindowCreateEvent : public wxEvent { +class wxWindowCreateEvent : public wxCommandEvent { public: wxWindowCreateEvent(wxWindow *win = NULL); wxWindow *GetWindow(); }; -class wxWindowDestroyEvent : public wxEvent { +class wxWindowDestroyEvent : public wxCommandEvent { public: wxWindowDestroyEvent(wxWindow *win = NULL); wxWindow *GetWindow(); }; +//--------------------------------------------------------------------------- + +class wxTimerEvent : public wxEvent +{ +public: + wxTimerEvent(int id = 0, int interval = 0); + int GetInterval(); +}; + //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- diff --git a/utils/wxPython/src/frames.i b/wxPython/src/frames.i similarity index 81% rename from utils/wxPython/src/frames.i rename to wxPython/src/frames.i index 7cea8d68a1..cf4ee91b1b 100644 --- a/utils/wxPython/src/frames.i +++ b/wxPython/src/frames.i @@ -34,6 +34,16 @@ //---------------------------------------------------------------------- +enum { + wxFULLSCREEN_NOMENUBAR, + wxFULLSCREEN_NOTOOLBAR, + wxFULLSCREEN_NOSTATUSBAR, + wxFULLSCREEN_NOBORDER, + wxFULLSCREEN_NOCAPTION, + wxFULLSCREEN_ALL +}; + + class wxFrame : public wxWindow { public: wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title, @@ -42,12 +52,9 @@ public: long style = wxDEFAULT_FRAME_STYLE, char* name = "frame"); - %pragma(python) addtomethod = "__init__:wx._StdFrameCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdFrameCallbacks(self)" void Centre(int direction = wxBOTH); -#ifdef __WXMSW__ - void Command(int id); -#endif wxStatusBar* CreateStatusBar(int number = 1, long style = wxST_SIZEGRIP, wxWindowID id = -1, @@ -56,6 +63,7 @@ public: wxWindowID id = -1, char* name = "toolBar"); + const wxIcon& GetIcon(); wxMenuBar* GetMenuBar(); wxStatusBar* GetStatusBar(); wxString GetTitle(); @@ -63,6 +71,8 @@ public: void Iconize(bool iconize); bool IsIconized(); void Maximize(bool maximize); + bool IsMaximized(); + void Restore(); void SetAcceleratorTable(const wxAcceleratorTable& accel); void SetIcon(const wxIcon& icon); void SetMenuBar(wxMenuBar* menuBar); @@ -71,7 +81,13 @@ public: void SetStatusWidths(int LCOUNT, int* choices); // uses typemap void SetTitle(const wxString& title); void SetToolBar(wxToolBar* toolbar); - + void MakeModal(bool modal = TRUE); + wxPoint GetClientAreaOrigin() const; + bool Command(int id); + bool ProcessCommand(int id); +#ifdef __WXMSW__ + bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); +#endif }; //--------------------------------------------------------------------------- @@ -84,7 +100,7 @@ public: long style = wxDEFAULT_FRAME_STYLE, char* name = "frame"); - %pragma(python) addtomethod = "__init__:wx._StdFrameCallbacks(self)" + %pragma(python) addtomethod = "__init__:#wx._StdFrameCallbacks(self)" }; diff --git a/utils/wxPython/src/gdi.i b/wxPython/src/gdi.i similarity index 95% rename from utils/wxPython/src/gdi.i rename to wxPython/src/gdi.i index 5e91e0cdd4..319d1000de 100644 --- a/utils/wxPython/src/gdi.i +++ b/wxPython/src/gdi.i @@ -80,6 +80,23 @@ public: #ifdef __WXMSW__ void SetSize(const wxSize& size); #endif + + wxBitmap GetSubBitmap( const wxRect& rect ); +#ifdef __WXMSW__ + bool CopyFromIcon(const wxIcon& icon); + bool CopyFromCursor(const wxCursor& cursor); + int GetQuality(); + void SetQuality(int q); +#endif + + %pragma(python) addtoclass = " + def __del__(self,gdic=gdic): + try: + if self.thisown == 1 : + gdic.delete_wxBitmap(self) + except: + pass +" }; @@ -152,6 +169,15 @@ public: #ifdef __WXMSW__ void SetSize(const wxSize& size); #endif + %pragma(python) addtoclass = " + def __del__(self,gdic=gdic): + try: + if self.thisown == 1 : + gdic.delete_wxIcon(self) + except: + pass +" + }; @@ -497,6 +523,8 @@ public: void GetDeviceOrigin(int *OUTPUT, int *OUTPUT); void SetAxisOrientation(bool xLeftRight, bool yBottomUp); + void CalcBoundingBox(int x, int y); + void ResetBoundingBox(); }; @@ -668,14 +696,14 @@ public: wxImageList(int width, int height, int mask=TRUE, int initialCount=1); ~wxImageList(); -#ifdef __WXMSW__ int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour); %name(AddIcon)int Add(const wxIcon& icon); +#ifdef __WXMSW__ bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); - %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon); #else - int Add(const wxBitmap& bitmap); +// %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon); +// int Add(const wxBitmap& bitmap); bool Replace(int index, const wxBitmap& bitmap); #endif @@ -685,6 +713,7 @@ public: int GetImageCount(); bool Remove(int index); bool RemoveAll(); + void GetSize(int index, int& OUTPUT, int& OUTPUT); }; diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i new file mode 100644 index 0000000000..957de4beb5 --- /dev/null +++ b/wxPython/src/grid.i @@ -0,0 +1,1751 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: grid.i +// Purpose: SWIG definitions for the new wxGrid and related classes +// +// Author: Robin Dunn +// +// Created: 17-March-2000 +// RCS-ID: $Id$ +// Copyright: (c) 2000 by Total Control Software +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +%module grid + +#ifndef OLD_GRID + +%{ +#include "helpers.h" +#include <wx/grid.h> +%} + +//---------------------------------------------------------------------- + +%include typemaps.i +%include my_typemaps.i + +// Import some definitions of other classes, etc. +%import _defs.i +%import misc.i +%import gdi.i +%import windows.i +%import controls.i +%import events.i + +%pragma(python) code = "import wx" + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +// Macros, similar to what's in helpers.h, to aid in the creation of +// virtual methods that are able to make callbacks to Python. Many of these +// are specific to wxGrid and so are kept here to reduce the mess in helpers.h +// a bit. + + +%{ +#define PYCALLBACK_GCA_INTINT(PCLASS, CBNAME) \ + wxGridCellAttr* CBNAME(int a, int b) { \ + wxGridCellAttr* rval = NULL; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) { \ + PyObject* ro; \ + wxGridCellAttr* ptr; \ + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", a, b)); \ + if (ro) { \ + if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellAttr_p")) \ + rval = ptr; \ + Py_DECREF(ro); \ + } \ + } \ + else \ + rval = PCLASS::CBNAME(a, b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + wxGridCellAttr *base_##CBNAME(int a, int b) { \ + return PCLASS::CBNAME(a, b); \ + } + + + +#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \ + void CBNAME(wxGridCellAttr *attr, int a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback( \ + Py_BuildValue("(Oii)", \ + wxPyConstructObject((void*)attr, "wxGridCellAttr"), \ + a, b)); \ + else \ + PCLASS::CBNAME(attr, a, b); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(wxGridCellAttr *attr, int a, int b) { \ + PCLASS::CBNAME(attr, a, b); \ + } + + + +#define PYCALLBACK__GCAINT(PCLASS, CBNAME) \ + void CBNAME(wxGridCellAttr *attr, int val) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback( \ + Py_BuildValue("(Oi)", \ + wxPyConstructObject((void*)attr, "wxGridCellAttr"), \ + val)); \ + else \ + PCLASS::CBNAME(attr, val); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(wxGridCellAttr *attr, int val) { \ + PCLASS::CBNAME(attr, val); \ + } + + + +#define PYCALLBACK_INT__pure(CBNAME) \ + int CBNAME() { \ + bool doSave = wxPyRestoreThread(); \ + int rval = 0; \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("()")); \ + wxPySaveThread(doSave); \ + return rval; \ + } + + + +#define PYCALLBACK_BOOL_INTINT_pure(CBNAME) \ + bool CBNAME(int a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + bool rval = 0; \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(ii)",a,b)); \ + wxPySaveThread(doSave); \ + return rval; \ + } + + + +#define PYCALLBACK_STRING_INTINT_pure(CBNAME) \ + wxString CBNAME(int a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + wxString rval; \ + if (m_myInst.findCallback(#CBNAME)) { \ + PyObject* ro; \ + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + if (ro) { \ + rval = PyString_AsString(PyObject_Str(ro)); \ + Py_DECREF(ro); \ + } \ + } \ + wxPySaveThread(doSave); \ + return rval; \ + } + + + +#define PYCALLBACK__INTINTSTRING_pure(CBNAME) \ + void CBNAME(int a, int b, const wxString& c) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(iis)",a,b,c.c_str())); \ + wxPySaveThread(doSave); \ + } + + +#define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \ + wxString CBNAME(int a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + wxString rval; \ + if (m_myInst.findCallback(#CBNAME)) { \ + PyObject* ro; \ + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + if (ro) { \ + rval = PyString_AsString(PyObject_Str(ro)); \ + Py_DECREF(ro); \ + } \ + } else \ + rval = PCLASS::CBNAME(a, b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + wxString base_##CBNAME(int a, int b) { \ + return PCLASS::CBNAME(a, b); \ + } + + + +#define PYCALLBACK_BOOL_INTINTSTRING(PCLASS, CBNAME) \ + bool CBNAME(int a, int b, const wxString& c) { \ + bool rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(iis)", a,b,c.c_str())); \ + else \ + rval = PCLASS::CBNAME(a,b,c); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + bool base_##CBNAME(int a, int b, const wxString& c) { \ + return PCLASS::CBNAME(a,b,c); \ + } + + + + +#define PYCALLBACK_LONG_INTINT(PCLASS, CBNAME) \ + long CBNAME(int a, int b) { \ + long rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + else \ + rval = PCLASS::CBNAME(a,b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + long base_##CBNAME(int a, int b) { \ + return PCLASS::CBNAME(a,b); \ + } + + + +#define PYCALLBACK_BOOL_INTINT(PCLASS, CBNAME) \ + bool CBNAME(int a, int b) { \ + bool rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + else \ + rval = PCLASS::CBNAME(a,b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + bool base_##CBNAME(int a, int b) { \ + return PCLASS::CBNAME(a,b); \ + } + + + +#define PYCALLBACK_DOUBLE_INTINT(PCLASS, CBNAME) \ + double CBNAME(int a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + double rval; \ + if (m_myInst.findCallback(#CBNAME)) { \ + PyObject* ro; \ + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \ + if (ro) { \ + rval = PyFloat_AsDouble(PyObject_Str(ro)); \ + Py_DECREF(ro); \ + } \ + } else \ + rval = PCLASS::CBNAME(a, b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + double base_##CBNAME(int a, int b) { \ + return PCLASS::CBNAME(a, b); \ + } + + + +#define PYCALLBACK__(PCLASS, CBNAME) \ + void CBNAME() { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("()")); \ + else \ + PCLASS::CBNAME(); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME() { \ + PCLASS::CBNAME(); \ + } + + + + +#define PYCALLBACK_BOOL_SIZETSIZET(PCLASS, CBNAME) \ + bool CBNAME(size_t a, size_t b) { \ + bool rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + else \ + rval = PCLASS::CBNAME(a,b); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + bool base_##CBNAME(size_t a, size_t b) { \ + return PCLASS::CBNAME(a,b); \ + } + + + +#define PYCALLBACK_BOOL_SIZET(PCLASS, CBNAME) \ + bool CBNAME(size_t a) { \ + bool rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("(i)", a)); \ + else \ + rval = PCLASS::CBNAME(a); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + bool base_##CBNAME(size_t a) { \ + return PCLASS::CBNAME(a); \ + } + + + +#define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \ + wxString CBNAME(int a) { \ + bool doSave = wxPyRestoreThread(); \ + wxString rval; \ + if (m_myInst.findCallback(#CBNAME)) { \ + PyObject* ro; \ + ro = m_myInst.callCallbackObj(Py_BuildValue("(i)",a)); \ + if (ro) { \ + rval = PyString_AsString(PyObject_Str(ro)); \ + Py_DECREF(ro); \ + } \ + } else \ + rval = PCLASS::CBNAME(a); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + wxString base_##CBNAME(int a) { \ + return PCLASS::CBNAME(a); \ + } + + + +#define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \ + void CBNAME(int a, const wxString& c) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(is)", a,c.c_str())); \ + else \ + PCLASS::CBNAME(a,c); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(int a, const wxString& c) { \ + PCLASS::CBNAME(a,c); \ + } + + + + +#define PYCALLBACK_BOOL_(PCLASS, CBNAME) \ + bool CBNAME() { \ + bool rval; \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + rval = m_myInst.callCallback(Py_BuildValue("()")); \ + else \ + rval = PCLASS::CBNAME(); \ + wxPySaveThread(doSave); \ + return rval; \ + } \ + bool base_##CBNAME() { \ + return PCLASS::CBNAME(); \ + } + + + +#define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \ + void CBNAME(size_t a, int b) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(ii)", a,b)); \ + else \ + PCLASS::CBNAME(a,b); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(size_t a, int b) { \ + PCLASS::CBNAME(a,b); \ + } + + + + +#define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \ + void CBNAME(int a, int b, long c) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(iii)", a,b,c)); \ + else \ + PCLASS::CBNAME(a,b,c); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(int a, int b, long c) { \ + PCLASS::CBNAME(a,b,c); \ + } + + + + +#define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \ + void CBNAME(int a, int b, double c) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(iif)", a,b,c)); \ + else \ + PCLASS::CBNAME(a,b,c); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(int a, int b, double c) { \ + PCLASS::CBNAME(a,b,c); \ + } + + + +#define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \ + void CBNAME(int a, int b, bool c) { \ + bool doSave = wxPyRestoreThread(); \ + if (m_myInst.findCallback(#CBNAME)) \ + m_myInst.callCallback(Py_BuildValue("(iii)", a,b,c)); \ + else \ + PCLASS::CBNAME(a,b,c); \ + wxPySaveThread(doSave); \ + } \ + void base_##CBNAME(int a, int b, bool c) { \ + PCLASS::CBNAME(a,b,c); \ + } + + + + +%} + +//--------------------------------------------------------------------------- + +class wxGridCellCoords; +class wxGridCellAttr; + + + +#define wxGRID_VALUE_STRING "string" +#define wxGRID_VALUE_BOOL "bool" +#define wxGRID_VALUE_NUMBER "long" +#define wxGRID_VALUE_FLOAT "double" +#define wxGRID_VALUE_CHOICE "choice" +#define wxGRID_VALUE_TEXT "string" +#define wxGRID_VALUE_LONG "long" + +%readonly +wxGridCellCoords wxGridNoCellCoords; +wxRect wxGridNoCellRect; +%readwrite + + +//--------------------------------------------------------------------------- +// wxGridCellRenderer is an ABC, and several derived classes are available. +// Classes implemented in Python should be derived from wxPyGridCellRenderer. + + +class wxGridCellRenderer +{ +public: + void SetParameters(const wxString& params); + void IncRef(); + void DecRef(); + + virtual void Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int row, int col, + bool isSelected) = 0; + virtual wxSize GetBestSize(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col) = 0; + virtual wxGridCellRenderer *Clone() const = 0; +}; + + +// The C++ version of wxPyGridCellRenderer +%{ +class wxPyGridCellRenderer : public wxGridCellRenderer +{ +public: + wxPyGridCellRenderer() : wxGridCellRenderer() {}; + + // Implement Python callback aware virtual methods + void Draw(wxGrid& grid, wxGridCellAttr& attr, + wxDC& dc, const wxRect& rect, + int row, int col, bool isSelected) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("Draw")) { + m_myInst.callCallback( + Py_BuildValue("(OOOOiii)", + wxPyConstructObject((void*)&grid, "wxGrid"), + wxPyConstructObject((void*)&attr, "wxGridCellAttr"), + wxPyConstructObject((void*)&dc, "wxDC"), + wxPyConstructObject((void*)&rect, "wxRect"), + row, col, isSelected)); + } + wxPySaveThread(doSave); + } + + wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, + int row, int col) { + wxSize rval; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetBestSize")) { + PyObject* ro; + wxSize* ptr; + ro = m_myInst.callCallbackObj( + Py_BuildValue("(OOOii)", + wxPyConstructObject((void*)&grid, "wxGrid"), + wxPyConstructObject((void*)&attr, "wxGridCellAttr"), + wxPyConstructObject((void*)&dc, "wxDC"), + row, col)); + if (ro) { + if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) + rval = *ptr; + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + + wxGridCellRenderer *Clone() const { + wxGridCellRenderer* rval = NULL; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("Clone")) { + PyObject* ro; + wxGridCellRenderer* ptr; + ro = m_myInst.callCallbackObj(Py_BuildValue("()")); + if (ro) { + if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellRenderer_p")) + rval = ptr; + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + DEC_PYCALLBACK__STRING(SetParameters); + + PYPRIVATE; +}; + +IMP_PYCALLBACK__STRING( wxPyGridCellRenderer, wxGridCellRenderer, SetParameters); + +%} + + +// Let SWIG know about it so it can create the Python version +class wxPyGridCellRenderer : public wxGridCellRenderer { +public: + wxPyGridCellRenderer(); + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellRenderer)" + + void base_SetParameters(const wxString& params); +}; + +//--------------------------------------------------------------------------- +// Predefined Renderers + +class wxGridCellStringRenderer : public wxGridCellRenderer +{ +public: + wxGridCellStringRenderer(); +}; + + +class wxGridCellNumberRenderer : public wxGridCellStringRenderer +{ +public: + wxGridCellNumberRenderer(); +}; + + +class wxGridCellFloatRenderer : public wxGridCellStringRenderer +{ +public: + wxGridCellFloatRenderer(int width = -1, int precision = -1); + + int GetWidth() const; + void SetWidth(int width); + int GetPrecision() const; + void SetPrecision(int precision); +}; + + +class wxGridCellBoolRenderer : public wxGridCellRenderer +{ +public: + wxGridCellBoolRenderer(); +}; + + + +//--------------------------------------------------------------------------- +// wxGridCellEditor is an ABC, and several derived classes are available. +// Classes implemented in Python should be derived from wxPyGridCellEditor. + +class wxGridCellEditor +{ +public: + bool IsCreated(); + wxControl* GetControl(); + void SetControl(wxControl* control); + + void SetParameters(const wxString& params); + void IncRef(); + void DecRef(); + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler) = 0; + virtual void BeginEdit(int row, int col, wxGrid* grid) = 0; + virtual bool EndEdit(int row, int col, wxGrid* grid) = 0; + virtual void Reset() = 0; + virtual wxGridCellEditor *Clone() const = 0; + + virtual void SetSize(const wxRect& rect); + virtual void Show(bool show, wxGridCellAttr *attr = NULL); + virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + virtual bool IsAcceptedKey(wxKeyEvent& event); + virtual void StartingKey(wxKeyEvent& event); + virtual void StartingClick(); + virtual void HandleReturn(wxKeyEvent& event); + virtual void Destroy(); + +}; + + +// The C++ version of wxPyGridCellEditor +%{ +class wxPyGridCellEditor : public wxGridCellEditor +{ +public: + wxPyGridCellEditor() : wxGridCellEditor() {} + + void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("Create")) { + m_myInst.callCallback( + Py_BuildValue("(OiO)", + wxPyConstructObject((void*)parent, "wxWindow"), + id, + wxPyConstructObject((void*)evtHandler, "wxEvtHandler"))); + } + wxPySaveThread(doSave); + } + + + void BeginEdit(int row, int col, wxGrid* grid) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("BeginEdit")) { + m_myInst.callCallback( + Py_BuildValue("(iiO)", row, col, + wxPyConstructObject((void*)grid, "wxGrid"))); + } + wxPySaveThread(doSave); + } + + + bool EndEdit(int row, int col, wxGrid* grid) { + bool rv = FALSE; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("EndEdit")) { + rv = m_myInst.callCallback( + Py_BuildValue("(iiO)", row, col, + wxPyConstructObject((void*)grid, "wxGrid"))); + } + wxPySaveThread(doSave); + return rv; + } + + + wxGridCellEditor *Clone() const { + wxGridCellEditor* rval = NULL; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("Clone")) { + PyObject* ro; + wxGridCellEditor* ptr; + ro = m_myInst.callCallbackObj(Py_BuildValue("()")); + if (ro) { + if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxGridCellEditor_p")) + rval = ptr; + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + + void Show(bool show, wxGridCellAttr *attr) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("Show")) + m_myInst.callCallback( + Py_BuildValue("(iO)", show, + wxPyConstructObject((void*)attr, "wxGridCellAttr"))); + else + wxGridCellEditor::Show(show, attr); + wxPySaveThread(doSave); + } + void base_Show(bool show, wxGridCellAttr *attr) { + wxGridCellEditor::Show(show, attr); + } + + + void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("PaintBackground")) + m_myInst.callCallback( + Py_BuildValue("(OO)", + wxPyConstructObject((void*)&rectCell, "wxRect"), + wxPyConstructObject((void*)attr, "wxGridCellAttr"))); + else + wxGridCellEditor::PaintBackground(rectCell, attr); + wxPySaveThread(doSave); + } + void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr) { + wxGridCellEditor::PaintBackground(rectCell, attr); + } + + + DEC_PYCALLBACK___pure(Reset); + DEC_PYCALLBACK__constany(SetSize, wxRect); + DEC_PYCALLBACK_bool_any(IsAcceptedKey, wxKeyEvent); + DEC_PYCALLBACK__any(StartingKey, wxKeyEvent); + DEC_PYCALLBACK__any(HandleReturn, wxKeyEvent); + DEC_PYCALLBACK__(StartingClick); + DEC_PYCALLBACK__(Destroy); + DEC_PYCALLBACK__STRING(SetParameters); + + PYPRIVATE; +}; + + +IMP_PYCALLBACK__STRING( wxPyGridCellEditor, wxGridCellEditor, SetParameters); +IMP_PYCALLBACK___pure(wxPyGridCellEditor, wxGridCellEditor, Reset); +IMP_PYCALLBACK__constany(wxPyGridCellEditor, wxGridCellEditor, SetSize, wxRect); +IMP_PYCALLBACK_bool_any(wxPyGridCellEditor, wxGridCellEditor, IsAcceptedKey, wxKeyEvent); +IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, StartingKey, wxKeyEvent); +IMP_PYCALLBACK__any(wxPyGridCellEditor, wxGridCellEditor, HandleReturn, wxKeyEvent); +IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, StartingClick); +IMP_PYCALLBACK__(wxPyGridCellEditor, wxGridCellEditor, Destroy); + +%} + + +// Let SWIG know about it so it can create the Python version +class wxPyGridCellEditor : public wxGridCellEditor { +public: + wxPyGridCellEditor(); + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellEditor)" + + void base_SetSize(const wxRect& rect); + void base_Show(bool show, wxGridCellAttr *attr = NULL); + void base_PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + void base_StartingKey(wxKeyEvent& event); + void base_StartingClick(); + void base_HandleReturn(wxKeyEvent& event); + void base_Destroy(); + void base_SetParameters(const wxString& params); +}; + +//--------------------------------------------------------------------------- +// Predefined Editors + +class wxGridCellTextEditor : public wxGridCellEditor +{ +public: + wxGridCellTextEditor(); +}; + + +class wxGridCellNumberEditor : public wxGridCellTextEditor +{ +public: + wxGridCellNumberEditor(int min = -1, int max = -1); +}; + + +class wxGridCellFloatEditor : public wxGridCellTextEditor +{ +public: + wxGridCellFloatEditor(); +}; + + +class wxGridCellBoolEditor : public wxGridCellEditor +{ +public: + wxGridCellBoolEditor(); +}; + +class wxGridCellChoiceEditor : public wxGridCellEditor +{ +public: + wxGridCellChoiceEditor(int LCOUNT = 0, + const wxString* choices = NULL, + bool allowOthers = FALSE); +#ifdef PRE2115 + %addmethods { + wxGridCellChoiceEditor(PyObject* choices, + bool allowOthers = FALSE) { + + const char** temp = string_LIST_helper(choices); + if (temp) { + int count = PyList_Size(choices); + wxGridCellChoiceEditor* ret; + ret = new wxGridCellChoiceEditor(count, temp, allowOthers); + delete [] temp; + return ret; + } + return NULL; + } + } +#endif +}; + +//--------------------------------------------------------------------------- + + +class wxGridCellAttr +{ +public: + wxGridCellAttr(); + + wxGridCellAttr *Clone() const; + void IncRef(); + void DecRef(); + void SetTextColour(const wxColour& colText); + void SetBackgroundColour(const wxColour& colBack); + void SetFont(const wxFont& font); + void SetAlignment(int hAlign, int vAlign); + void SetReadOnly(bool isReadOnly = TRUE); + + void SetRenderer(wxGridCellRenderer *renderer); + void SetEditor(wxGridCellEditor* editor); + + bool HasTextColour() const; + bool HasBackgroundColour() const; + bool HasFont() const; + bool HasAlignment() const; + bool HasRenderer() const; + bool HasEditor() const; + + const wxColour& GetTextColour() const; + const wxColour& GetBackgroundColour() const; + const wxFont& GetFont() const; + void GetAlignment(int *OUTPUT, int *OUTPUT) const; + wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const; + wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const; + + bool IsReadOnly() const; + void SetDefAttr(wxGridCellAttr* defAttr); +}; + +//--------------------------------------------------------------------------- + +class wxGridCellAttrProvider +{ +public: + wxGridCellAttrProvider(); + // ???? virtual ~wxGridCellAttrProvider(); + + wxGridCellAttr *GetAttr(int row, int col) const; + void SetAttr(wxGridCellAttr *attr, int row, int col); + void SetRowAttr(wxGridCellAttr *attr, int row); + void SetColAttr(wxGridCellAttr *attr, int col); + + void UpdateAttrRows( size_t pos, int numRows ); + void UpdateAttrCols( size_t pos, int numCols ); + +}; + + +// A Python-aware version +%{ +class wxPyGridCellAttrProvider : public wxGridCellAttrProvider +{ +public: + wxPyGridCellAttrProvider() : wxGridCellAttrProvider() {}; + + PYCALLBACK_GCA_INTINT(wxGridCellAttrProvider, GetAttr); + PYCALLBACK__GCAINTINT(wxGridCellAttrProvider, SetAttr); + PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetRowAttr); + PYCALLBACK__GCAINT(wxGridCellAttrProvider, SetColAttr); + + PYPRIVATE; +}; +%} + + +// The python-aware version get's SWIGified +class wxPyGridCellAttrProvider : public wxGridCellAttrProvider +{ +public: + wxPyGridCellAttrProvider(); + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridCellAttrProvider)" + + wxGridCellAttr *base_GetAttr(int row, int col); + void base_SetAttr(wxGridCellAttr *attr, int row, int col); + void base_SetRowAttr(wxGridCellAttr *attr, int row); + void base_SetColAttr(wxGridCellAttr *attr, int col); +}; + + +//--------------------------------------------------------------------------- +// Grid Table Base class and Python aware version + + + +class wxGridTableBase +{ +public: + // wxGridTableBase(); This is an ABC + //~wxGridTableBase(); + + void SetAttrProvider(wxGridCellAttrProvider *attrProvider); + wxGridCellAttrProvider *GetAttrProvider() const; + void SetView( wxGrid *grid ); + wxGrid * GetView() const; + + + // pure virtuals + virtual int GetNumberRows() = 0; + virtual int GetNumberCols() = 0; + virtual bool IsEmptyCell( int row, int col ) = 0; + virtual wxString GetValue( int row, int col ) = 0; + virtual void SetValue( int row, int col, const wxString& value ) = 0; + + // virtuals overridable in wxPyGridTableBase + virtual wxString GetTypeName( int row, int col ); + virtual bool CanGetValueAs( int row, int col, const wxString& typeName ); + virtual bool CanSetValueAs( int row, int col, const wxString& typeName ); + virtual long GetValueAsLong( int row, int col ); + virtual double GetValueAsDouble( int row, int col ); + virtual bool GetValueAsBool( int row, int col ); + virtual void SetValueAsLong( int row, int col, long value ); + virtual void SetValueAsDouble( int row, int col, double value ); + virtual void SetValueAsBool( int row, int col, bool value ); + + //virtual void* GetValueAsCustom( int row, int col, const wxString& typeName ); + //virtual void SetValueAsCustom( int row, int col, const wxString& typeName, void* value ); + + + virtual void Clear(); + virtual bool InsertRows( size_t pos = 0, size_t numRows = 1 ); + virtual bool AppendRows( size_t numRows = 1 ); + virtual bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); + virtual bool InsertCols( size_t pos = 0, size_t numCols = 1 ); + virtual bool AppendCols( size_t numCols = 1 ); + virtual bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); + + virtual wxString GetRowLabelValue( int row ); + virtual wxString GetColLabelValue( int col ); + virtual void SetRowLabelValue( int row, const wxString& value ); + virtual void SetColLabelValue( int col, const wxString& value ); + + virtual bool CanHaveAttributes(); + + virtual wxGridCellAttr *GetAttr( int row, int col ); + virtual void SetAttr(wxGridCellAttr* attr, int row, int col); + virtual void SetRowAttr(wxGridCellAttr *attr, int row); + virtual void SetColAttr(wxGridCellAttr *attr, int col); + +}; + + + +// Python-aware version +%{ +class wxPyGridTableBase : public wxGridTableBase +{ +public: + wxPyGridTableBase() : wxGridTableBase() {} + + PYCALLBACK_INT__pure(GetNumberRows); + PYCALLBACK_INT__pure(GetNumberCols); + PYCALLBACK_BOOL_INTINT_pure(IsEmptyCell); + PYCALLBACK_STRING_INTINT(wxGridTableBase, GetTypeName); + PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanGetValueAs); + PYCALLBACK_BOOL_INTINTSTRING(wxGridTableBase, CanSetValueAs); + PYCALLBACK__(wxGridTableBase, Clear); + PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertRows); + PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteRows); + PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, InsertCols); + PYCALLBACK_BOOL_SIZETSIZET(wxGridTableBase, DeleteCols); + PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendRows); + PYCALLBACK_BOOL_SIZET(wxGridTableBase, AppendCols); + PYCALLBACK_STRING_INT(wxGridTableBase, GetRowLabelValue); + PYCALLBACK_STRING_INT(wxGridTableBase, GetColLabelValue); + PYCALLBACK__INTSTRING(wxGridTableBase, SetRowLabelValue); + PYCALLBACK__INTSTRING(wxGridTableBase, SetColLabelValue); + PYCALLBACK_BOOL_(wxGridTableBase, CanHaveAttributes); + PYCALLBACK_GCA_INTINT(wxGridTableBase, GetAttr); + PYCALLBACK__GCAINTINT(wxGridTableBase, SetAttr); + PYCALLBACK__GCAINT(wxGridTableBase, SetRowAttr); + PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr); + + + + wxString GetValue(int row, int col) { + bool doSave = wxPyRestoreThread(); + wxString rval; + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",row,col)); + if (ro) { + rval = PyString_AsString(PyObject_Str(ro)); + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + void SetValue(int row, int col, const wxString& val) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) + m_myInst.callCallback(Py_BuildValue("(iis)",row,col,val.c_str())); + wxPySaveThread(doSave); + } + + + // Map the Get/Set methods for the standard non-string types to + // the GetValue and SetValue python methods. + long GetValueAsLong( int row, int col ) { + long rval = 0; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + PyObject* num; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + if (ro && PyNumber_Check(ro)) { + num = PyNumber_Int(ro); + if (num) { + rval = PyInt_AsLong(num); + Py_DECREF(num); + } + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + double GetValueAsDouble( int row, int col ) { + double rval = 0.0; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetValue")) { + PyObject* ro; + PyObject* num; + ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)", row, col)); + if (ro && PyNumber_Check(ro)) { + num = PyNumber_Float(ro); + if (num) { + rval = PyFloat_AsDouble(num); + Py_DECREF(num); + } + Py_DECREF(ro); + } + } + wxPySaveThread(doSave); + return rval; + } + + bool GetValueAsBool( int row, int col ) { + return (bool)GetValueAsLong(row, col); + } + + void SetValueAsLong( int row, int col, long value ) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) { + m_myInst.callCallback(Py_BuildValue("(iii)", row, col, value)); + } + wxPySaveThread(doSave); + } + + void SetValueAsDouble( int row, int col, double value ) { + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("SetValue")) { + m_myInst.callCallback(Py_BuildValue("(iid)", row, col, value)); + } + wxPySaveThread(doSave); + } + + void SetValueAsBool( int row, int col, bool value ) { + SetValueAsLong( row, col, (long)value ); + } + + + PYPRIVATE; +}; +%} + + +// The python-aware version get's SWIGified +class wxPyGridTableBase : public wxGridTableBase +{ +public: + wxPyGridTableBase(); + void _setSelf(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyGridTableBase)" + + %addmethods { void Destroy() { delete self; } } + + wxString base_GetTypeName( int row, int col ); + bool base_CanGetValueAs( int row, int col, const wxString& typeName ); + bool base_CanSetValueAs( int row, int col, const wxString& typeName ); + void base_Clear(); + bool base_InsertRows( size_t pos = 0, size_t numRows = 1 ); + bool base_AppendRows( size_t numRows = 1 ); + bool base_DeleteRows( size_t pos = 0, size_t numRows = 1 ); + bool base_InsertCols( size_t pos = 0, size_t numCols = 1 ); + bool base_AppendCols( size_t numCols = 1 ); + bool base_DeleteCols( size_t pos = 0, size_t numCols = 1 ); + wxString base_GetRowLabelValue( int row ); + wxString base_GetColLabelValue( int col ); + void base_SetRowLabelValue( int row, const wxString& value ); + void base_SetColLabelValue( int col, const wxString& value ); + bool base_CanHaveAttributes(); + wxGridCellAttr *base_GetAttr( int row, int col ); + void base_SetAttr(wxGridCellAttr* attr, int row, int col); + void base_SetRowAttr(wxGridCellAttr *attr, int row); + void base_SetColAttr(wxGridCellAttr *attr, int col); +}; + + +//--------------------------------------------------------------------------- +// Predefined Tables + +class wxGridStringTable : public wxGridTableBase +{ +public: + wxGridStringTable( int numRows=0, int numCols=0 ); +}; + +//--------------------------------------------------------------------------- +// The Table can pass messages to the grid to tell it to update itself if +// something has changed. + +enum wxGridTableRequest +{ + wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000, + wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES, + wxGRIDTABLE_NOTIFY_ROWS_INSERTED, + wxGRIDTABLE_NOTIFY_ROWS_APPENDED, + wxGRIDTABLE_NOTIFY_ROWS_DELETED, + wxGRIDTABLE_NOTIFY_COLS_INSERTED, + wxGRIDTABLE_NOTIFY_COLS_APPENDED, + wxGRIDTABLE_NOTIFY_COLS_DELETED +}; + + +class wxGridTableMessage +{ +public: + wxGridTableMessage( wxGridTableBase *table, int id, + int comInt1 = -1, + int comInt2 = -1 ); + ~wxGridTableMessage(); + + void SetTableObject( wxGridTableBase *table ); + wxGridTableBase * GetTableObject() const; + void SetId( int id ); + int GetId(); + void SetCommandInt( int comInt1 ); + int GetCommandInt(); + void SetCommandInt2( int comInt2 ); + int GetCommandInt2(); +}; + + +//--------------------------------------------------------------------------- + +class wxGridCellCoords +{ +public: + wxGridCellCoords( int r=-1, int c=-1 ); + ~wxGridCellCoords(); + + int GetRow() const { return m_row; } + void SetRow( int n ) { m_row = n; } + int GetCol() const { return m_col; } + void SetCol( int n ) { m_col = n; } + void Set( int row, int col ) { m_row = row; m_col = col; } + + %addmethods { + PyObject* asTuple() { + PyObject* tup = PyTuple_New(2); + PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow())); + PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol())); + return tup; + } + + int __cmp__( const wxGridCellCoords& other ) { + return *self != other; + } + } + %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())" + %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())" +}; + +// Typemap to allow conversion of sequence objects to wxGridCellCoords... +%typemap(python,in) wxGridCellCoords& (wxGridCellCoords temp) { + $target = &temp; + if (! wxGridCellCoords_helper($source, &$target)) + return NULL; +} + +// ...and here is the associated helper. +%{ +bool wxGridCellCoords_helper(PyObject* source, wxGridCellCoords** obj) { + + // If source is an object instance then it may already be the right type + if (PyInstance_Check(source)) { + wxGridCellCoords* ptr; + if (SWIG_GetPtrObj(source, (void **)&ptr, "_wxGridCellCoords_p")) + goto error; + *obj = ptr; + return TRUE; + } + // otherwise a 2-tuple of integers is expected + else if (PySequence_Check(source) && PyObject_Length(source) == 2) { + PyObject* o1 = PySequence_GetItem(source, 0); + PyObject* o2 = PySequence_GetItem(source, 1); + **obj = wxGridCellCoords(PyInt_AsLong(o1), PyInt_AsLong(o2)); + return TRUE; + } + + error: + PyErr_SetString(PyExc_TypeError, "Expected a 2-tuple of integers or a wxGridCellCoords object."); + return FALSE; +} +%} + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +// The grid itself + + +// Fool SWIG into treating this enum as an int +typedef int WXGRIDSELECTIONMODES; + +// but let the C++ code know what it really is. +%{ +typedef wxGrid::wxGridSelectionModes WXGRIDSELECTIONMODES; +%} + + + +class wxGrid : public wxScrolledWindow +{ +public: + wxGrid( wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxWANTS_CHARS, + const char* name = wxPanelNameStr ); + + //~wxGrid(); + + enum wxGridSelectionModes {wxGridSelectCells, + wxGridSelectRows, + wxGridSelectColumns}; + + bool CreateGrid( int numRows, int numCols, + WXGRIDSELECTIONMODES selmode = wxGrid::wxGridSelectCells ); + void SetSelectionMode(WXGRIDSELECTIONMODES selmode); + + + // ------ grid dimensions + // + int GetNumberRows(); + int GetNumberCols(); + + + +#ifdef NOTNEEDED // ???? + // ------ display update functions + // + void CalcRowLabelsExposed( wxRegion& reg ); + void CalcColLabelsExposed( wxRegion& reg ); + void CalcCellsExposed( wxRegion& reg ); + + // ------ event handlers + // + void ProcessRowLabelMouseEvent( wxMouseEvent& event ); + void ProcessColLabelMouseEvent( wxMouseEvent& event ); + void ProcessCornerLabelMouseEvent( wxMouseEvent& event ); + void ProcessGridCellMouseEvent( wxMouseEvent& event ); + void DoEndDragResizeRow(); + void DoEndDragResizeCol(); +#endif + + bool ProcessTableMessage( wxGridTableMessage& ); + + + wxGridTableBase * GetTable() const; + bool SetTable( wxGridTableBase *table, bool takeOwnership=FALSE, + WXGRIDSELECTIONMODES selmode = + wxGrid::wxGridSelectCells ); + + void ClearGrid(); + bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=TRUE ); + bool AppendRows( int numRows = 1, bool updateLabels=TRUE ); + bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels=TRUE ); + bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels=TRUE ); + bool AppendCols( int numCols = 1, bool updateLabels=TRUE ); + bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=TRUE ); + +#ifdef NOTNEEDED // ???? + void DrawGridCellArea( wxDC& dc ); + void DrawGridSpace( wxDC& dc ); + void DrawCellBorder( wxDC& dc, const wxGridCellCoords& ); + void DrawAllGridLines( wxDC& dc, const wxRegion & reg ); + void DrawCell( wxDC& dc, const wxGridCellCoords& ); + void DrawHighlight(wxDC& dc); +#endif + + // this function is called when the current cell highlight must be redrawn + // and may be overridden by the user + virtual void DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr ); + +#ifdef NOTNEEDED // ???? + void DrawRowLabels( wxDC& dc ); + void DrawRowLabel( wxDC& dc, int row ); + + void DrawColLabels( wxDC& dc ); + void DrawColLabel( wxDC& dc, int col ); +#endif + + // ------ Cell text drawing functions + // + void DrawTextRectangle( wxDC& dc, const wxString&, const wxRect&, + int horizontalAlignment = wxLEFT, + int verticalAlignment = wxTOP ); + + // Split a string containing newline chararcters into an array of + // strings and return the number of lines + // + void StringToLines( const wxString& value, wxArrayString& lines ); + + void GetTextBoxSize( wxDC& dc, + wxArrayString& lines, + long *OUTPUT, long *OUTPUT ); + + + // ------ + // Code that does a lot of grid modification can be enclosed + // between BeginBatch() and EndBatch() calls to avoid screen + // flicker + // + void BeginBatch(); + void EndBatch(); + int GetBatchCount(); + + + // ------ edit control functions + // + bool IsEditable() { return m_editable; } + void EnableEditing( bool edit ); + + void EnableCellEditControl( bool enable = TRUE ); + void DisableCellEditControl(); + bool CanEnableCellControl() const; + bool IsCellEditControlEnabled() const; + bool IsCellEditControlShown() const; + + bool IsCurrentCellReadOnly() const; + + void ShowCellEditControl(); + void HideCellEditControl(); + void SaveEditControlValue(); + + + // ------ grid location functions + // Note that all of these functions work with the logical coordinates of + // grid cells and labels so you will need to convert from device + // coordinates for mouse events etc. + // + + //void XYToCell( int x, int y, wxGridCellCoords& ); + %addmethods { + %new wxGridCellCoords* XYToCell(int x, int y) { + wxGridCellCoords rv; + self->XYToCell(x, y, rv); + return new wxGridCellCoords(rv); + } + } + + int YToRow( int y ); + int XToCol( int x ); + + int YToEdgeOfRow( int y ); + int XToEdgeOfCol( int x ); + + wxRect CellToRect( int row, int col ); + // TODO: ??? wxRect CellToRect( const wxGridCellCoords& coords ); + + + int GetGridCursorRow(); + int GetGridCursorCol(); + + // check to see if a cell is either wholly visible (the default arg) or + // at least partially visible in the grid window + // + bool IsVisible( int row, int col, bool wholeCellVisible = TRUE ); + // TODO: ??? bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = TRUE ); + void MakeCellVisible( int row, int col ); + // TODO: ??? void MakeCellVisible( const wxGridCellCoords& coords ); + + + // ------ grid cursor movement functions + // + void SetGridCursor( int row, int col ); + bool MoveCursorUp( bool expandSelection ); + bool MoveCursorDown( bool expandSelection ); + bool MoveCursorLeft( bool expandSelection ); + bool MoveCursorRight( bool expandSelection ); + bool MovePageDown(); + bool MovePageUp(); + bool MoveCursorUpBlock( bool expandSelection ); + bool MoveCursorDownBlock( bool expandSelection ); + bool MoveCursorLeftBlock( bool expandSelection ); + bool MoveCursorRightBlock( bool expandSelection ); + + + // ------ label and gridline formatting + // + int GetDefaultRowLabelSize(); + int GetRowLabelSize(); + int GetDefaultColLabelSize(); + int GetColLabelSize(); + wxColour GetLabelBackgroundColour(); + wxColour GetLabelTextColour(); + wxFont GetLabelFont(); + void GetRowLabelAlignment( int *OUTPUT, int *OUTPUT ); + void GetColLabelAlignment( int *OUTPUT, int *OUTPUT ); + wxString GetRowLabelValue( int row ); + wxString GetColLabelValue( int col ); + wxColour GetGridLineColour(); + wxColour GetCellHighlightColour(); + + void SetRowLabelSize( int width ); + void SetColLabelSize( int height ); + void SetLabelBackgroundColour( const wxColour& ); + void SetLabelTextColour( const wxColour& ); + void SetLabelFont( const wxFont& ); + void SetRowLabelAlignment( int horiz, int vert ); + void SetColLabelAlignment( int horiz, int vert ); + void SetRowLabelValue( int row, const wxString& ); + void SetColLabelValue( int col, const wxString& ); + void SetGridLineColour( const wxColour& ); + void SetCellHighlightColour( const wxColour& ); + + void EnableDragRowSize( bool enable = TRUE ); + void DisableDragRowSize(); + bool CanDragRowSize(); + void EnableDragColSize( bool enable = TRUE ); + void DisableDragColSize(); + bool CanDragColSize(); + void EnableDragGridSize(bool enable = TRUE); + void DisableDragGridSize(); + bool CanDragGridSize(); + + // this sets the specified attribute for all cells in this row/col + void SetRowAttr(int row, wxGridCellAttr *attr); + void SetColAttr(int col, wxGridCellAttr *attr); + + // shortcuts for setting the column parameters + + // set the format for the data in the column: default is string + void SetColFormatBool(int col); + void SetColFormatNumber(int col); + void SetColFormatFloat(int col, int width = -1, int precision = -1); + void SetColFormatCustom(int col, const wxString& typeName); + + void EnableGridLines( bool enable = TRUE ); + bool GridLinesEnabled(); + + // ------ row and col formatting + // + int GetDefaultRowSize(); + int GetRowSize( int row ); + int GetDefaultColSize(); + int GetColSize( int col ); + wxColour GetDefaultCellBackgroundColour(); + wxColour GetCellBackgroundColour( int row, int col ); + wxColour GetDefaultCellTextColour(); + wxColour GetCellTextColour( int row, int col ); + wxFont GetDefaultCellFont(); + wxFont GetCellFont( int row, int col ); + void GetDefaultCellAlignment( int *horiz, int *vert ); + void GetCellAlignment( int row, int col, int *horiz, int *vert ); + + void SetDefaultRowSize( int height, bool resizeExistingRows = FALSE ); + void SetRowSize( int row, int height ); + void SetDefaultColSize( int width, bool resizeExistingCols = FALSE ); + + void SetColSize( int col, int width ); + + // automatically size the column or row to fit to its contents, if + // setAsMin is TRUE, this optimal width will also be set as minimal width + // for this column + void AutoSizeColumn( int col, bool setAsMin = TRUE ); + void AutoSizeRow( int row, bool setAsMin = TRUE ); + + + // auto size all columns (very ineffective for big grids!) + void AutoSizeColumns( bool setAsMin = TRUE ); + void AutoSizeRows( bool setAsMin = TRUE ); + + // auto size the grid, that is make the columns/rows of the "right" size + // and also set the grid size to just fit its contents + void AutoSize(); + + // column won't be resized to be lesser width - this must be called during + // the grid creation because it won't resize the column if it's already + // narrower than the minimal width + void SetColMinimalWidth( int col, int width ); + void SetRowMinimalHeight( int row, int width ); + + void SetDefaultCellBackgroundColour( const wxColour& ); + void SetCellBackgroundColour( int row, int col, const wxColour& ); + void SetDefaultCellTextColour( const wxColour& ); + + void SetCellTextColour( int row, int col, const wxColour& ); + void SetDefaultCellFont( const wxFont& ); + void SetCellFont( int row, int col, const wxFont& ); + void SetDefaultCellAlignment( int horiz, int vert ); + void SetCellAlignment( int row, int col, int horiz, int vert ); + + // takes ownership of the pointer + void SetDefaultRenderer(wxGridCellRenderer *renderer); + void SetCellRenderer(int row, int col, wxGridCellRenderer *renderer); + wxGridCellRenderer *GetDefaultRenderer() const; + wxGridCellRenderer* GetCellRenderer(int row, int col); + + // takes ownership of the pointer + void SetDefaultEditor(wxGridCellEditor *editor); + void SetCellEditor(int row, int col, wxGridCellEditor *editor); + wxGridCellEditor *GetDefaultEditor() const; + wxGridCellEditor* GetCellEditor(int row, int col); + + + + // ------ cell value accessors + // + wxString GetCellValue( int row, int col ); + // TODO: ??? wxString GetCellValue( const wxGridCellCoords& coords ) + + void SetCellValue( int row, int col, const wxString& s ); + // TODO: ??? void SetCellValue( const wxGridCellCoords& coords, const wxString& s ) + + // returns TRUE if the cell can't be edited + bool IsReadOnly(int row, int col) const; + + // make the cell editable/readonly + void SetReadOnly(int row, int col, bool isReadOnly = TRUE); + + // ------ selections of blocks of cells + // + void SelectRow( int row, bool addToSelected = FALSE ); + void SelectCol( int col, bool addToSelected = FALSE ); + + void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol ); + // TODO: ??? void SelectBlock( const wxGridCellCoords& topLeft, + // TODO: ??? const wxGridCellCoords& bottomRight ) + + void SelectAll(); + bool IsSelection(); + void ClearSelection(); + bool IsInSelection( int row, int col ); + // TODO: ??? bool IsInSelection( const wxGridCellCoords& coords ) + + + // This function returns the rectangle that encloses the block of cells + // limited by TopLeft and BottomRight cell in device coords and clipped + // to the client size of the grid window. + // + wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft, + const wxGridCellCoords & bottomRight ); + + + // Access or update the selection fore/back colours + wxColour GetSelectionBackground() const; + wxColour GetSelectionForeground() const; + + void SetSelectionBackground(const wxColour& c); + void SetSelectionForeground(const wxColour& c); + + + // Methods for a registry for mapping data types to Renderers/Editors + void RegisterDataType(const wxString& typeName, + wxGridCellRenderer* renderer, + wxGridCellEditor* editor); + wxGridCellEditor* GetDefaultEditorForCell(int row, int col) const; + // TODO: ??? wxGridCellEditor* GetDefaultEditorForCell(const wxGridCellCoords& c) const + wxGridCellRenderer* GetDefaultRendererForCell(int row, int col) const; + wxGridCellEditor* GetDefaultEditorForType(const wxString& typeName) const; + wxGridCellRenderer* GetDefaultRendererForType(const wxString& typeName) const; + + // grid may occupy more space than needed for its rows/columns, this + // function allows to set how big this extra space is + void SetMargins(int extraWidth, int extraHeight); +}; + + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +// Grid events and stuff + + + +class wxGridEvent : public wxNotifyEvent +{ +public: + wxGridEvent(int id, wxEventType type, wxGrid* obj, + int row=-1, int col=-1, int x=-1, int y=-1, bool sel = TRUE, + bool control=FALSE, bool shift=FALSE, bool alt=FALSE, bool meta=FALSE); + + virtual int GetRow(); + virtual int GetCol(); + wxPoint GetPosition(); + bool Selecting(); + bool ControlDown(); + bool MetaDown(); + bool ShiftDown(); + bool AltDown(); + +}; + + +class wxGridSizeEvent : public wxNotifyEvent +{ +public: + wxGridSizeEvent(int id, wxEventType type, wxGrid* obj, + int rowOrCol=-1, int x=-1, int y=-1, + bool control=FALSE, bool shift=FALSE, bool alt=FALSE, bool meta=FALSE); + + int GetRowOrCol(); + wxPoint GetPosition(); + bool ControlDown(); + bool MetaDown(); + bool ShiftDown(); + bool AltDown(); + +}; + + +class wxGridRangeSelectEvent : public wxNotifyEvent +{ +public: + wxGridRangeSelectEvent(int id, wxEventType type, wxGrid* obj, + const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + bool sel = TRUE, + bool control=FALSE, bool shift=FALSE, + bool alt=FALSE, bool meta=FALSE); + + wxGridCellCoords GetTopLeftCoords(); + wxGridCellCoords GetBottomRightCoords(); + int GetTopRow(); + int GetBottomRow(); + int GetLeftCol(); + int GetRightCol(); + bool Selecting(); + bool ControlDown(); + bool MetaDown(); + bool ShiftDown(); + bool AltDown(); +}; + +enum { + wxEVT_GRID_CELL_LEFT_CLICK, + wxEVT_GRID_CELL_RIGHT_CLICK, + wxEVT_GRID_CELL_LEFT_DCLICK, + wxEVT_GRID_CELL_RIGHT_DCLICK, + wxEVT_GRID_LABEL_LEFT_CLICK, + wxEVT_GRID_LABEL_RIGHT_CLICK, + wxEVT_GRID_LABEL_LEFT_DCLICK, + wxEVT_GRID_LABEL_RIGHT_DCLICK, + wxEVT_GRID_ROW_SIZE, + wxEVT_GRID_COL_SIZE, + wxEVT_GRID_RANGE_SELECT, + wxEVT_GRID_CELL_CHANGE, + wxEVT_GRID_SELECT_CELL, + wxEVT_GRID_EDITOR_SHOWN, + wxEVT_GRID_EDITOR_HIDDEN, +}; + + + +%pragma(python) code = " +def EVT_GRID_CELL_LEFT_CLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_CELL_LEFT_CLICK, fn) + +def EVT_GRID_CELL_RIGHT_CLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_CELL_RIGHT_CLICK, fn) + +def EVT_GRID_CELL_LEFT_DCLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_CELL_LEFT_DCLICK, fn) + +def EVT_GRID_CELL_RIGHT_DCLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_CELL_RIGHT_DCLICK, fn) + +def EVT_GRID_LABEL_LEFT_CLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_LABEL_LEFT_CLICK, fn) + +def EVT_GRID_LABEL_RIGHT_CLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_LABEL_RIGHT_CLICK, fn) + +def EVT_GRID_LABEL_LEFT_DCLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_LABEL_LEFT_DCLICK, fn) + +def EVT_GRID_LABEL_RIGHT_DCLICK(win, fn): + win.Connect(-1, -1, wxEVT_GRID_LABEL_RIGHT_DCLICK, fn) + +def EVT_GRID_ROW_SIZE(win, fn): + win.Connect(-1, -1, wxEVT_GRID_ROW_SIZE, fn) + +def EVT_GRID_COL_SIZE(win, fn): + win.Connect(-1, -1, wxEVT_GRID_COL_SIZE, fn) + +def EVT_GRID_RANGE_SELECT(win, fn): + win.Connect(-1, -1, wxEVT_GRID_RANGE_SELECT, fn) + +def EVT_GRID_CELL_CHANGE(win, fn): + win.Connect(-1, -1, wxEVT_GRID_CELL_CHANGE, fn) + +def EVT_GRID_SELECT_CELL(win, fn): + win.Connect(-1, -1, wxEVT_GRID_SELECT_CELL, fn) + +def EVT_GRID_EDITOR_SHOWN(win, fn): + win.Connect(-1, -1, wxEVT_GRID_EDITOR_SHOWN, fn) + +def EVT_GRID_EDITOR_HIDDEN(win, fn): + win.Connect(-1, -1, wxEVT_GRID_EDITOR_HIDDEN, fn) + +" + +//--------------------------------------------------------------------------- + +%pragma(python) include="_gridextras.py"; + +//--------------------------------------------------------------------------- + + +#endif diff --git a/utils/wxPython/src/gtk/.cvsignore b/wxPython/src/gtk/.cvsignore similarity index 100% rename from utils/wxPython/src/gtk/.cvsignore rename to wxPython/src/gtk/.cvsignore diff --git a/wxPython/src/gtk/calendar.cpp b/wxPython/src/gtk/calendar.cpp new file mode 100644 index 0000000000..0da0125dce --- /dev/null +++ b/wxPython/src/gtk/calendar.cpp @@ -0,0 +1,2037 @@ +/* + * FILE : gtk/calendar.cpp + * + * This file was automatically generated by : + * Simplified Wrapper and Interface Generator (SWIG) + * Version 1.1 (Build 810) + * + * Portions Copyright (c) 1995-1998 + * The University of Utah and The Regents of the University of California. + * Permission is granted to distribute this file in any manner provided + * this notice remains intact. + * + * Do not make changes to this file--changes will be lost! + * + */ + + +#define SWIGCODE +/* Implementation : PYTHON */ + +#define SWIGPYTHON +#include <string.h> +#include <stdlib.h> +/* Definitions for Windows/Unix exporting */ +#if defined(__WIN32__) +# if defined(_MSC_VER) +# define SWIGEXPORT(a) __declspec(dllexport) a +# else +# if defined(__BORLANDC__) +# define SWIGEXPORT(a) a _export +# else +# define SWIGEXPORT(a) a +# endif +# endif +#else +# define SWIGEXPORT(a) a +#endif + +#ifdef __cplusplus +extern "C" { +#endif +#include "Python.h" +extern void SWIG_MakePtr(char *, void *, char *); +extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *)); +extern char *SWIG_GetPtr(char *, void **, char *); +extern char *SWIG_GetPtrObj(PyObject *, void **, char *); +extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); +extern PyObject *SWIG_newvarlink(void); +#ifdef __cplusplus +} +#endif +#define SWIG_init initcalendarc + +#define SWIG_name "calendarc" + +#include "helpers.h" +#include <wx/calctrl.h> + +static PyObject* l_output_helper(PyObject* target, PyObject* o) { + PyObject* o2; + PyObject* o3; + if (!target) { + target = o; + } else if (target == Py_None) { + Py_DECREF(Py_None); + target = o; + } else { + if (!PyList_Check(target)) { + o2 = target; + target = PyList_New(0); + PyList_Append(target, o2); + Py_XDECREF(o2); + } + PyList_Append(target,o); + Py_XDECREF(o); + } + return target; +} + +static PyObject* t_output_helper(PyObject* target, PyObject* o) { + PyObject* o2; + PyObject* o3; + + if (!target) { + target = o; + } else if (target == Py_None) { + Py_DECREF(Py_None); + target = o; + } else { + if (!PyTuple_Check(target)) { + o2 = target; + target = PyTuple_New(1); + PyTuple_SetItem(target, 0, o2); + } + o3 = PyTuple_New(1); + PyTuple_SetItem(o3, 0, o); + + o2 = target; + target = PySequence_Concat(o2, o3); + Py_DECREF(o2); + Py_DECREF(o3); + } + return target; +} + +static char* wxStringErrorMsg = "string type is required for parameter"; +#ifdef __cplusplus +extern "C" { +#endif +#define new_wxCalendarDateAttr(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4) (new wxCalendarDateAttr(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4)) +static PyObject *_wrap_new_wxCalendarDateAttr(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarDateAttr * _result; + wxColour * _arg0; + wxColour * _arg1 = (wxColour *) &wxNullColour; + wxColour * _arg2 = (wxColour *) &wxNullColour; + wxFont * _arg3 = (wxFont *) &wxNullFont; + wxCalendarDateBorder _arg4 = (wxCalendarDateBorder ) (wxCAL_BORDER_NONE); + wxColour temp; + PyObject * _obj0 = 0; + wxColour temp0; + PyObject * _obj1 = 0; + wxColour temp1; + PyObject * _obj2 = 0; + PyObject * _argo3 = 0; + char *_kwnames[] = { "colText","colBack","colBorder","font","border", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|OOOi:new_wxCalendarDateAttr",_kwnames,&_obj0,&_obj1,&_obj2,&_argo3,&_arg4)) + return NULL; +{ + _arg0 = &temp; + if (! wxColour_helper(_obj0, &_arg0)) + return NULL; +} + if (_obj1) +{ + _arg1 = &temp0; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} + if (_obj2) +{ + _arg2 = &temp1; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} + if (_argo3) { + if (_argo3 == Py_None) { _arg3 = NULL; } + else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxFont_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of new_wxCalendarDateAttr. Expected _wxFont_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxCalendarDateAttr *)new_wxCalendarDateAttr(*_arg0,*_arg1,*_arg2,*_arg3,_arg4); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxCalendarDateAttr_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define new_wxCalendarDateAttrBorder(_swigarg0,_swigarg1) (new wxCalendarDateAttr(_swigarg0,_swigarg1)) +static PyObject *_wrap_new_wxCalendarDateAttrBorder(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarDateAttr * _result; + wxCalendarDateBorder _arg0; + wxColour * _arg1 = (wxColour *) &wxNullColour; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "border","colBorder", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"i|O:new_wxCalendarDateAttrBorder",_kwnames,&_arg0,&_obj1)) + return NULL; + if (_obj1) +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxCalendarDateAttr *)new_wxCalendarDateAttrBorder(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxCalendarDateAttr_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarDateAttr_SetTextColour(_swigobj,_swigarg0) (_swigobj->SetTextColour(_swigarg0)) +static PyObject *_wrap_wxCalendarDateAttr_SetTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarDateAttr * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colText", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxCalendarDateAttr_SetTextColour",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_SetTextColour. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarDateAttr_SetTextColour(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarDateAttr_SetBackgroundColour(_swigobj,_swigarg0) (_swigobj->SetBackgroundColour(_swigarg0)) +static PyObject *_wrap_wxCalendarDateAttr_SetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarDateAttr * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colBack", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxCalendarDateAttr_SetBackgroundColour",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_SetBackgroundColour. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarDateAttr_SetBackgroundColour(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarDateAttr_SetBorderColour(_swigobj,_swigarg0) (_swigobj->SetBorderColour(_swigarg0)) +static PyObject *_wrap_wxCalendarDateAttr_SetBorderColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarDateAttr * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","col", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxCalendarDateAttr_SetBorderColour",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_SetBorderColour. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarDateAttr_SetBorderColour(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarDateAttr_SetFont(_swigobj,_swigarg0) (_swigobj->SetFont(_swigarg0)) +static PyObject *_wrap_wxCalendarDateAttr_SetFont(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarDateAttr * _arg0; + wxFont * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","font", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxCalendarDateAttr_SetFont",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_SetFont. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxFont_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxCalendarDateAttr_SetFont. Expected _wxFont_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarDateAttr_SetFont(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarDateAttr_SetBorder(_swigobj,_swigarg0) (_swigobj->SetBorder(_swigarg0)) +static PyObject *_wrap_wxCalendarDateAttr_SetBorder(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarDateAttr * _arg0; + wxCalendarDateBorder _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","border", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxCalendarDateAttr_SetBorder",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_SetBorder. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarDateAttr_SetBorder(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarDateAttr_SetHoliday(_swigobj,_swigarg0) (_swigobj->SetHoliday(_swigarg0)) +static PyObject *_wrap_wxCalendarDateAttr_SetHoliday(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarDateAttr * _arg0; + bool _arg1; + PyObject * _argo0 = 0; + int tempbool1; + char *_kwnames[] = { "self","holiday", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxCalendarDateAttr_SetHoliday",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_SetHoliday. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarDateAttr_SetHoliday(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarDateAttr_HasTextColour(_swigobj) (_swigobj->HasTextColour()) +static PyObject *_wrap_wxCalendarDateAttr_HasTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_HasTextColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_HasTextColour. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxCalendarDateAttr_HasTextColour(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxCalendarDateAttr_HasBackgroundColour(_swigobj) (_swigobj->HasBackgroundColour()) +static PyObject *_wrap_wxCalendarDateAttr_HasBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_HasBackgroundColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_HasBackgroundColour. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxCalendarDateAttr_HasBackgroundColour(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxCalendarDateAttr_HasBorderColour(_swigobj) (_swigobj->HasBorderColour()) +static PyObject *_wrap_wxCalendarDateAttr_HasBorderColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_HasBorderColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_HasBorderColour. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxCalendarDateAttr_HasBorderColour(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxCalendarDateAttr_HasFont(_swigobj) (_swigobj->HasFont()) +static PyObject *_wrap_wxCalendarDateAttr_HasFont(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_HasFont",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_HasFont. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxCalendarDateAttr_HasFont(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxCalendarDateAttr_HasBorder(_swigobj) (_swigobj->HasBorder()) +static PyObject *_wrap_wxCalendarDateAttr_HasBorder(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_HasBorder",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_HasBorder. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxCalendarDateAttr_HasBorder(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxCalendarDateAttr_IsHoliday(_swigobj) (_swigobj->IsHoliday()) +static PyObject *_wrap_wxCalendarDateAttr_IsHoliday(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_IsHoliday",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_IsHoliday. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxCalendarDateAttr_IsHoliday(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxCalendarDateAttr_GetTextColour(_swigobj) (_swigobj->GetTextColour()) +static PyObject *_wrap_wxCalendarDateAttr_GetTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_GetTextColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_GetTextColour. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxCalendarDateAttr_GetTextColour(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarDateAttr_GetBackgroundColour(_swigobj) (_swigobj->GetBackgroundColour()) +static PyObject *_wrap_wxCalendarDateAttr_GetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_GetBackgroundColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_GetBackgroundColour. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxCalendarDateAttr_GetBackgroundColour(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarDateAttr_GetBorderColour(_swigobj) (_swigobj->GetBorderColour()) +static PyObject *_wrap_wxCalendarDateAttr_GetBorderColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_GetBorderColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_GetBorderColour. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxCalendarDateAttr_GetBorderColour(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarDateAttr_GetFont(_swigobj) (_swigobj->GetFont()) +static PyObject *_wrap_wxCalendarDateAttr_GetFont(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxFont * _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_GetFont",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_GetFont. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxFont & _result_ref = wxCalendarDateAttr_GetFont(_arg0); + _result = (wxFont *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxFont_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarDateAttr_GetBorder(_swigobj) (_swigobj->GetBorder()) +static PyObject *_wrap_wxCalendarDateAttr_GetBorder(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarDateBorder _result; + wxCalendarDateAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarDateAttr_GetBorder",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarDateAttr_GetBorder. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxCalendarDateBorder )wxCalendarDateAttr_GetBorder(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +static void *SwigwxCalendarEventTowxCommandEvent(void *ptr) { + wxCalendarEvent *src; + wxCommandEvent *dest; + src = (wxCalendarEvent *) ptr; + dest = (wxCommandEvent *) src; + return (void *) dest; +} + +static void *SwigwxCalendarEventTowxEvent(void *ptr) { + wxCalendarEvent *src; + wxEvent *dest; + src = (wxCalendarEvent *) ptr; + dest = (wxEvent *) src; + return (void *) dest; +} + +#define new_wxCalendarEvent(_swigarg0,_swigarg1) (new wxCalendarEvent(_swigarg0,_swigarg1)) +static PyObject *_wrap_new_wxCalendarEvent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarEvent * _result; + wxCalendarCtrl * _arg0; + wxEventType _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "cal","type", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:new_wxCalendarEvent",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxCalendarEvent. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxCalendarEvent *)new_wxCalendarEvent(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxCalendarEvent_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarEvent_GetDate(_swigobj) (_swigobj->GetDate()) +static PyObject *_wrap_wxCalendarEvent_GetDate(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxDateTime * _result; + wxCalendarEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarEvent_GetDate",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarEvent_GetDate. Expected _wxCalendarEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxDateTime & _result_ref = wxCalendarEvent_GetDate(_arg0); + _result = (wxDateTime *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxDateTime_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarEvent_GetWeekDay(_swigobj) (_swigobj->GetWeekDay()) +static PyObject *_wrap_wxCalendarEvent_GetWeekDay(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxDateTime::WeekDay _result; + wxCalendarEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarEvent_GetWeekDay",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarEvent_GetWeekDay. Expected _wxCalendarEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxDateTime::WeekDay )wxCalendarEvent_GetWeekDay(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +static void *SwigwxCalendarCtrlTowxControl(void *ptr) { + wxCalendarCtrl *src; + wxControl *dest; + src = (wxCalendarCtrl *) ptr; + dest = (wxControl *) src; + return (void *) dest; +} + +static void *SwigwxCalendarCtrlTowxWindow(void *ptr) { + wxCalendarCtrl *src; + wxWindow *dest; + src = (wxCalendarCtrl *) ptr; + dest = (wxWindow *) src; + return (void *) dest; +} + +static void *SwigwxCalendarCtrlTowxEvtHandler(void *ptr) { + wxCalendarCtrl *src; + wxEvtHandler *dest; + src = (wxCalendarCtrl *) ptr; + dest = (wxEvtHandler *) src; + return (void *) dest; +} + +#define new_wxCalendarCtrl(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6) (new wxCalendarCtrl(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6)) +static PyObject *_wrap_new_wxCalendarCtrl(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _result; + wxWindow * _arg0; + wxWindowID _arg1; + wxDateTime * _arg2 = (wxDateTime *) &wxDefaultDateTime; + wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition; + wxSize * _arg4 = (wxSize *) &wxDefaultSize; + long _arg5 = (long ) (wxCAL_SHOW_HOLIDAYS); + char * _arg6 = (char *) "calendar"; + PyObject * _argo0 = 0; + PyObject * _argo2 = 0; + wxPoint temp; + PyObject * _obj3 = 0; + wxSize temp0; + PyObject * _obj4 = 0; + char *_kwnames[] = { "parent","id","date","pos","size","style","name", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|OOOls:new_wxCalendarCtrl",_kwnames,&_argo0,&_arg1,&_argo2,&_obj3,&_obj4,&_arg5,&_arg6)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxCalendarCtrl. Expected _wxWindow_p."); + return NULL; + } + } + if (_argo2) { + if (_argo2 == Py_None) { _arg2 = NULL; } + else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxDateTime_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of new_wxCalendarCtrl. Expected _wxDateTime_p."); + return NULL; + } + } + if (_obj3) +{ + _arg3 = &temp; + if (! wxPoint_helper(_obj3, &_arg3)) + return NULL; +} + if (_obj4) +{ + _arg4 = &temp0; + if (! wxSize_helper(_obj4, &_arg4)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxCalendarCtrl *)new_wxCalendarCtrl(_arg0,_arg1,*_arg2,*_arg3,*_arg4,_arg5,_arg6); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxCalendarCtrl_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarCtrl_SetDate(_swigobj,_swigarg0) (_swigobj->SetDate(_swigarg0)) +static PyObject *_wrap_wxCalendarCtrl_SetDate(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _arg0; + wxDateTime * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","date", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxCalendarCtrl_SetDate",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_SetDate. Expected _wxCalendarCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxDateTime_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxCalendarCtrl_SetDate. Expected _wxDateTime_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarCtrl_SetDate(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarCtrl_GetDate(_swigobj) (_swigobj->GetDate()) +static PyObject *_wrap_wxCalendarCtrl_GetDate(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxDateTime * _result; + wxCalendarCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarCtrl_GetDate",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_GetDate. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxDateTime & _result_ref = wxCalendarCtrl_GetDate(_arg0); + _result = (wxDateTime *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxDateTime_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarCtrl_EnableYearChange(_swigobj,_swigarg0) (_swigobj->EnableYearChange(_swigarg0)) +static PyObject *_wrap_wxCalendarCtrl_EnableYearChange(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _arg0; + bool _arg1 = (bool ) TRUE; + PyObject * _argo0 = 0; + int tempbool1 = (int) TRUE; + char *_kwnames[] = { "self","enable", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxCalendarCtrl_EnableYearChange",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_EnableYearChange. Expected _wxCalendarCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarCtrl_EnableYearChange(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarCtrl_EnableMonthChange(_swigobj,_swigarg0) (_swigobj->EnableMonthChange(_swigarg0)) +static PyObject *_wrap_wxCalendarCtrl_EnableMonthChange(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _arg0; + bool _arg1 = (bool ) TRUE; + PyObject * _argo0 = 0; + int tempbool1 = (int) TRUE; + char *_kwnames[] = { "self","enable", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxCalendarCtrl_EnableMonthChange",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_EnableMonthChange. Expected _wxCalendarCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarCtrl_EnableMonthChange(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarCtrl_EnableHolidayDisplay(_swigobj,_swigarg0) (_swigobj->EnableHolidayDisplay(_swigarg0)) +static PyObject *_wrap_wxCalendarCtrl_EnableHolidayDisplay(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _arg0; + bool _arg1 = (bool ) TRUE; + PyObject * _argo0 = 0; + int tempbool1 = (int) TRUE; + char *_kwnames[] = { "self","display", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxCalendarCtrl_EnableHolidayDisplay",_kwnames,&_argo0,&tempbool1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_EnableHolidayDisplay. Expected _wxCalendarCtrl_p."); + return NULL; + } + } + _arg1 = (bool ) tempbool1; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarCtrl_EnableHolidayDisplay(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarCtrl_SetHeaderColours(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetHeaderColours(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxCalendarCtrl_SetHeaderColours(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _arg0; + wxColour * _arg1; + wxColour * _arg2; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + wxColour temp0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","colFg","colBg", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxCalendarCtrl_SetHeaderColours",_kwnames,&_argo0,&_obj1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_SetHeaderColours. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + _arg2 = &temp0; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarCtrl_SetHeaderColours(_arg0,*_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarCtrl_GetHeaderColourFg(_swigobj) (_swigobj->GetHeaderColourFg()) +static PyObject *_wrap_wxCalendarCtrl_GetHeaderColourFg(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxCalendarCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarCtrl_GetHeaderColourFg",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_GetHeaderColourFg. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxCalendarCtrl_GetHeaderColourFg(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarCtrl_GetHeaderColourBg(_swigobj) (_swigobj->GetHeaderColourBg()) +static PyObject *_wrap_wxCalendarCtrl_GetHeaderColourBg(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxCalendarCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarCtrl_GetHeaderColourBg",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_GetHeaderColourBg. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxCalendarCtrl_GetHeaderColourBg(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarCtrl_SetHighlightColours(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetHighlightColours(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxCalendarCtrl_SetHighlightColours(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _arg0; + wxColour * _arg1; + wxColour * _arg2; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + wxColour temp0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","colFg","colBg", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxCalendarCtrl_SetHighlightColours",_kwnames,&_argo0,&_obj1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_SetHighlightColours. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + _arg2 = &temp0; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarCtrl_SetHighlightColours(_arg0,*_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarCtrl_GetHighlightColourFg(_swigobj) (_swigobj->GetHighlightColourFg()) +static PyObject *_wrap_wxCalendarCtrl_GetHighlightColourFg(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxCalendarCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarCtrl_GetHighlightColourFg",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_GetHighlightColourFg. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxCalendarCtrl_GetHighlightColourFg(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarCtrl_GetHighlightColourBg(_swigobj) (_swigobj->GetHighlightColourBg()) +static PyObject *_wrap_wxCalendarCtrl_GetHighlightColourBg(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxCalendarCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarCtrl_GetHighlightColourBg",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_GetHighlightColourBg. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxCalendarCtrl_GetHighlightColourBg(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarCtrl_SetHolidayColours(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetHolidayColours(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxCalendarCtrl_SetHolidayColours(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _arg0; + wxColour * _arg1; + wxColour * _arg2; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + wxColour temp0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","colFg","colBg", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxCalendarCtrl_SetHolidayColours",_kwnames,&_argo0,&_obj1,&_obj2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_SetHolidayColours. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + _arg2 = &temp0; + if (! wxColour_helper(_obj2, &_arg2)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarCtrl_SetHolidayColours(_arg0,*_arg1,*_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarCtrl_GetHolidayColourFg(_swigobj) (_swigobj->GetHolidayColourFg()) +static PyObject *_wrap_wxCalendarCtrl_GetHolidayColourFg(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxCalendarCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarCtrl_GetHolidayColourFg",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_GetHolidayColourFg. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxCalendarCtrl_GetHolidayColourFg(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarCtrl_GetHolidayColourBg(_swigobj) (_swigobj->GetHolidayColourBg()) +static PyObject *_wrap_wxCalendarCtrl_GetHolidayColourBg(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxCalendarCtrl * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxCalendarCtrl_GetHolidayColourBg",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_GetHolidayColourBg. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxCalendarCtrl_GetHolidayColourBg(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarCtrl_GetAttr(_swigobj,_swigarg0) (_swigobj->GetAttr(_swigarg0)) +static PyObject *_wrap_wxCalendarCtrl_GetAttr(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarDateAttr * _result; + wxCalendarCtrl * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","day", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxCalendarCtrl_GetAttr",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_GetAttr. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxCalendarDateAttr *)wxCalendarCtrl_GetAttr(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxCalendarDateAttr_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxCalendarCtrl_SetAttr(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetAttr(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxCalendarCtrl_SetAttr(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _arg0; + size_t _arg1; + wxCalendarDateAttr * _arg2; + PyObject * _argo0 = 0; + PyObject * _argo2 = 0; + char *_kwnames[] = { "self","day","attr", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxCalendarCtrl_SetAttr",_kwnames,&_argo0,&_arg1,&_argo2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_SetAttr. Expected _wxCalendarCtrl_p."); + return NULL; + } + } + if (_argo2) { + if (_argo2 == Py_None) { _arg2 = NULL; } + else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxCalendarDateAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxCalendarCtrl_SetAttr. Expected _wxCalendarDateAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarCtrl_SetAttr(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarCtrl_SetHoliday(_swigobj,_swigarg0) (_swigobj->SetHoliday(_swigarg0)) +static PyObject *_wrap_wxCalendarCtrl_SetHoliday(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","day", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxCalendarCtrl_SetHoliday",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_SetHoliday. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarCtrl_SetHoliday(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarCtrl_ResetAttr(_swigobj,_swigarg0) (_swigobj->ResetAttr(_swigarg0)) +static PyObject *_wrap_wxCalendarCtrl_ResetAttr(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarCtrl * _arg0; + size_t _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","day", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxCalendarCtrl_ResetAttr",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_ResetAttr. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCalendarCtrl_ResetAttr(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxCalendarCtrl_HitTest(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->HitTest(_swigarg0,_swigarg1,_swigarg2)) +static PyObject *_wrap_wxCalendarCtrl_HitTest(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCalendarHitTestResult _result; + wxCalendarCtrl * _arg0; + wxPoint * _arg1; + wxDateTime * _arg2 = (wxDateTime *) NULL; + wxDateTime::WeekDay * _arg3 = (wxDateTime::WeekDay *) NULL; + PyObject * _argo0 = 0; + wxPoint temp; + PyObject * _obj1 = 0; + PyObject * _argo2 = 0; + PyObject * _argo3 = 0; + char *_kwnames[] = { "self","pos","date","wd", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|OO:wxCalendarCtrl_HitTest",_kwnames,&_argo0,&_obj1,&_argo2,&_argo3)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCalendarCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCalendarCtrl_HitTest. Expected _wxCalendarCtrl_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxPoint_helper(_obj1, &_arg1)) + return NULL; +} + if (_argo2) { + if (_argo2 == Py_None) { _arg2 = NULL; } + else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxDateTime_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxCalendarCtrl_HitTest. Expected _wxDateTime_p."); + return NULL; + } + } + if (_argo3) { + if (_argo3 == Py_None) { _arg3 = NULL; } + else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxDateTime::WeekDay_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxCalendarCtrl_HitTest. Expected _wxDateTime::WeekDay_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxCalendarHitTestResult )wxCalendarCtrl_HitTest(_arg0,*_arg1,_arg2,_arg3); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +static PyMethodDef calendarcMethods[] = { + { "wxCalendarCtrl_HitTest", (PyCFunction) _wrap_wxCalendarCtrl_HitTest, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_ResetAttr", (PyCFunction) _wrap_wxCalendarCtrl_ResetAttr, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_SetHoliday", (PyCFunction) _wrap_wxCalendarCtrl_SetHoliday, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_SetAttr", (PyCFunction) _wrap_wxCalendarCtrl_SetAttr, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_GetAttr", (PyCFunction) _wrap_wxCalendarCtrl_GetAttr, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_GetHolidayColourBg", (PyCFunction) _wrap_wxCalendarCtrl_GetHolidayColourBg, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_GetHolidayColourFg", (PyCFunction) _wrap_wxCalendarCtrl_GetHolidayColourFg, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_SetHolidayColours", (PyCFunction) _wrap_wxCalendarCtrl_SetHolidayColours, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_GetHighlightColourBg", (PyCFunction) _wrap_wxCalendarCtrl_GetHighlightColourBg, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_GetHighlightColourFg", (PyCFunction) _wrap_wxCalendarCtrl_GetHighlightColourFg, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_SetHighlightColours", (PyCFunction) _wrap_wxCalendarCtrl_SetHighlightColours, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_GetHeaderColourBg", (PyCFunction) _wrap_wxCalendarCtrl_GetHeaderColourBg, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_GetHeaderColourFg", (PyCFunction) _wrap_wxCalendarCtrl_GetHeaderColourFg, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_SetHeaderColours", (PyCFunction) _wrap_wxCalendarCtrl_SetHeaderColours, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_EnableHolidayDisplay", (PyCFunction) _wrap_wxCalendarCtrl_EnableHolidayDisplay, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_EnableMonthChange", (PyCFunction) _wrap_wxCalendarCtrl_EnableMonthChange, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_EnableYearChange", (PyCFunction) _wrap_wxCalendarCtrl_EnableYearChange, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_GetDate", (PyCFunction) _wrap_wxCalendarCtrl_GetDate, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarCtrl_SetDate", (PyCFunction) _wrap_wxCalendarCtrl_SetDate, METH_VARARGS | METH_KEYWORDS }, + { "new_wxCalendarCtrl", (PyCFunction) _wrap_new_wxCalendarCtrl, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarEvent_GetWeekDay", (PyCFunction) _wrap_wxCalendarEvent_GetWeekDay, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarEvent_GetDate", (PyCFunction) _wrap_wxCalendarEvent_GetDate, METH_VARARGS | METH_KEYWORDS }, + { "new_wxCalendarEvent", (PyCFunction) _wrap_new_wxCalendarEvent, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_GetBorder", (PyCFunction) _wrap_wxCalendarDateAttr_GetBorder, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_GetFont", (PyCFunction) _wrap_wxCalendarDateAttr_GetFont, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_GetBorderColour", (PyCFunction) _wrap_wxCalendarDateAttr_GetBorderColour, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_GetBackgroundColour", (PyCFunction) _wrap_wxCalendarDateAttr_GetBackgroundColour, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_GetTextColour", (PyCFunction) _wrap_wxCalendarDateAttr_GetTextColour, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_IsHoliday", (PyCFunction) _wrap_wxCalendarDateAttr_IsHoliday, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_HasBorder", (PyCFunction) _wrap_wxCalendarDateAttr_HasBorder, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_HasFont", (PyCFunction) _wrap_wxCalendarDateAttr_HasFont, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_HasBorderColour", (PyCFunction) _wrap_wxCalendarDateAttr_HasBorderColour, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_HasBackgroundColour", (PyCFunction) _wrap_wxCalendarDateAttr_HasBackgroundColour, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_HasTextColour", (PyCFunction) _wrap_wxCalendarDateAttr_HasTextColour, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_SetHoliday", (PyCFunction) _wrap_wxCalendarDateAttr_SetHoliday, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_SetBorder", (PyCFunction) _wrap_wxCalendarDateAttr_SetBorder, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_SetFont", (PyCFunction) _wrap_wxCalendarDateAttr_SetFont, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_SetBorderColour", (PyCFunction) _wrap_wxCalendarDateAttr_SetBorderColour, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_SetBackgroundColour", (PyCFunction) _wrap_wxCalendarDateAttr_SetBackgroundColour, METH_VARARGS | METH_KEYWORDS }, + { "wxCalendarDateAttr_SetTextColour", (PyCFunction) _wrap_wxCalendarDateAttr_SetTextColour, METH_VARARGS | METH_KEYWORDS }, + { "new_wxCalendarDateAttrBorder", (PyCFunction) _wrap_new_wxCalendarDateAttrBorder, METH_VARARGS | METH_KEYWORDS }, + { "new_wxCalendarDateAttr", (PyCFunction) _wrap_new_wxCalendarDateAttr, METH_VARARGS | METH_KEYWORDS }, + { NULL, NULL } +}; +#ifdef __cplusplus +} +#endif +/* + * This table is used by the pointer type-checker + */ +static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { + { "_wxAcceleratorTable","_class_wxAcceleratorTable",0}, + { "_wxEvent","_class_wxCalendarEvent",SwigwxCalendarEventTowxEvent}, + { "_wxEvent","_wxCalendarEvent",SwigwxCalendarEventTowxEvent}, + { "_wxEvent","_class_wxEvent",0}, + { "_class_wxActivateEvent","_wxActivateEvent",0}, + { "_signed_long","_long",0}, + { "_wxMenuEvent","_class_wxMenuEvent",0}, + { "_wxPyBitmapDataObject","_class_wxPyBitmapDataObject",0}, + { "_wxBitmapDataObject","_class_wxBitmapDataObject",0}, + { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, + { "_class_wxDateTime","_wxDateTime",0}, + { "_wxPrintQuality","_wxCoord",0}, + { "_wxPrintQuality","_int",0}, + { "_wxPrintQuality","_signed_int",0}, + { "_wxPrintQuality","_unsigned_int",0}, + { "_wxPrintQuality","_wxWindowID",0}, + { "_wxPrintQuality","_uint",0}, + { "_wxPrintQuality","_EBool",0}, + { "_wxPrintQuality","_size_t",0}, + { "_class_wxCustomDataObject","_wxCustomDataObject",0}, + { "_class_wxRegionIterator","_wxRegionIterator",0}, + { "_class_wxPyTextDropTarget","_wxPyTextDropTarget",0}, + { "_class_wxMenuBar","_wxMenuBar",0}, + { "_class_wxEvtHandler","_class_wxCalendarCtrl",SwigwxCalendarCtrlTowxEvtHandler}, + { "_class_wxEvtHandler","_wxCalendarCtrl",SwigwxCalendarCtrlTowxEvtHandler}, + { "_class_wxEvtHandler","_wxEvtHandler",0}, + { "_wxPaintEvent","_class_wxPaintEvent",0}, + { "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0}, + { "_wxCursor","_class_wxCursor",0}, + { "_wxNotifyEvent","_class_wxNotifyEvent",0}, + { "_wxMask","_class_wxMask",0}, + { "_wxPen","_class_wxPen",0}, + { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, + { "_byte","_unsigned_char",0}, + { "_wxDataObject","_class_wxDataObject",0}, + { "_wxStaticBox","_class_wxStaticBox",0}, + { "_wxPyDataObjectSimple","_class_wxPyDataObjectSimple",0}, + { "_wxPyDropSource","_class_wxPyDropSource",0}, + { "_wxChoice","_class_wxChoice",0}, + { "_wxSlider","_class_wxSlider",0}, + { "_long","_unsigned_long",0}, + { "_long","_signed_long",0}, + { "_wxImageList","_class_wxImageList",0}, + { "_wxDataObjectSimple","_class_wxDataObjectSimple",0}, + { "_wxDropFilesEvent","_class_wxDropFilesEvent",0}, + { "_wxBitmapButton","_class_wxBitmapButton",0}, + { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, + { "_class_wxClipboard","_wxClipboard",0}, + { "_class_wxGauge","_wxGauge",0}, + { "_wxDC","_class_wxDC",0}, + { "_class_wxBitmapDataObject","_wxBitmapDataObject",0}, + { "_wxSpinEvent","_class_wxSpinEvent",0}, + { "_size_t","_wxCoord",0}, + { "_size_t","_wxPrintQuality",0}, + { "_size_t","_unsigned_int",0}, + { "_size_t","_int",0}, + { "_size_t","_wxWindowID",0}, + { "_size_t","_uint",0}, + { "_class_wxRealPoint","_wxRealPoint",0}, + { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, + { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, + { "_class_wxMenuItem","_wxMenuItem",0}, + { "_class_wxPaintEvent","_wxPaintEvent",0}, + { "_wxSysColourChangedEvent","_class_wxSysColourChangedEvent",0}, + { "_class_wxPostScriptDC","_wxPostScriptDC",0}, + { "_wxPanel","_class_wxPanel",0}, + { "_wxInitDialogEvent","_class_wxInitDialogEvent",0}, + { "_wxCheckBox","_class_wxCheckBox",0}, + { "_wxPyEvent","_class_wxPyEvent",0}, + { "_wxTextCtrl","_class_wxTextCtrl",0}, + { "_class_wxMask","_wxMask",0}, + { "_wxTextDataObject","_class_wxTextDataObject",0}, + { "_class_wxKeyEvent","_wxKeyEvent",0}, + { "_wxFileConfig","_class_wxFileConfig",0}, + { "_wxColour","_class_wxColour",0}, + { "_class_wxDialog","_wxDialog",0}, + { "_class_wxFileDataObject","_wxFileDataObject",0}, + { "_wxIdleEvent","_class_wxIdleEvent",0}, + { "_class_wxUpdateUIEvent","_wxUpdateUIEvent",0}, + { "_class_wxDataObject","_wxDataObject",0}, + { "_wxStaticLine","_class_wxStaticLine",0}, + { "_wxBrush","_class_wxBrush",0}, + { "_wxDataFormat","_class_wxDataFormat",0}, + { "_class_wxDataObjectSimple","_wxDataObjectSimple",0}, + { "_wxShowEvent","_class_wxShowEvent",0}, + { "_uint","_wxCoord",0}, + { "_uint","_wxPrintQuality",0}, + { "_uint","_size_t",0}, + { "_uint","_unsigned_int",0}, + { "_uint","_int",0}, + { "_uint","_wxWindowID",0}, + { "_wxChar","_char",0}, + { "_wxPyValidator","_class_wxPyValidator",0}, + { "_class_wxEvent","_class_wxCalendarEvent",SwigwxCalendarEventTowxEvent}, + { "_class_wxEvent","_wxCalendarEvent",SwigwxCalendarEventTowxEvent}, + { "_class_wxEvent","_wxEvent",0}, + { "_wxCheckListBox","_class_wxCheckListBox",0}, + { "_wxRect","_class_wxRect",0}, + { "_wxCommandEvent","_class_wxCalendarEvent",SwigwxCalendarEventTowxCommandEvent}, + { "_wxCommandEvent","_wxCalendarEvent",SwigwxCalendarEventTowxCommandEvent}, + { "_wxCommandEvent","_class_wxCommandEvent",0}, + { "_wxSizeEvent","_class_wxSizeEvent",0}, + { "_wxPoint","_class_wxPoint",0}, + { "_class_wxButton","_wxButton",0}, + { "_wxRadioBox","_class_wxRadioBox",0}, + { "_char","_wxChar",0}, + { "_wxBitmap","_class_wxBitmap",0}, + { "_wxWindowDC","_class_wxWindowDC",0}, + { "_wxTimerEvent","_class_wxTimerEvent",0}, + { "_wxScrollBar","_class_wxScrollBar",0}, + { "_wxSpinButton","_class_wxSpinButton",0}, + { "_wxCalendarEvent","_class_wxCalendarEvent",0}, + { "_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0}, + { "_class_wxNotifyEvent","_wxNotifyEvent",0}, + { "_class_wxValidator","_wxValidator",0}, + { "_class_wxPyEvent","_wxPyEvent",0}, + { "_wxConfig","_class_wxConfig",0}, + { "_class_wxIconizeEvent","_wxIconizeEvent",0}, + { "_class_wxStaticBitmap","_wxStaticBitmap",0}, + { "_class_wxFileConfig","_wxFileConfig",0}, + { "_wxDropTarget","_class_wxDropTarget",0}, + { "_class_wxStaticLine","_wxStaticLine",0}, + { "_wxScrollEvent","_class_wxScrollEvent",0}, + { "_EBool","_wxCoord",0}, + { "_EBool","_wxPrintQuality",0}, + { "_EBool","_signed_int",0}, + { "_EBool","_int",0}, + { "_EBool","_wxWindowID",0}, + { "_class_wxRegion","_wxRegion",0}, + { "_class_wxDataFormat","_wxDataFormat",0}, + { "_class_wxDropFilesEvent","_wxDropFilesEvent",0}, + { "_wxWindowDestroyEvent","_class_wxWindowDestroyEvent",0}, + { "_wxStaticText","_class_wxStaticText",0}, + { "_wxFont","_class_wxFont",0}, + { "_class_wxPyDropTarget","_wxPyDropTarget",0}, + { "_wxCloseEvent","_class_wxCloseEvent",0}, + { "_unsigned_long","_long",0}, + { "_class_wxRect","_wxRect",0}, + { "_class_wxDC","_wxDC",0}, + { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, + { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, + { "_class_wxWindowCreateEvent","_wxWindowCreateEvent",0}, + { "_wxTimeSpan","_class_wxTimeSpan",0}, + { "_wxFocusEvent","_class_wxFocusEvent",0}, + { "_wxMaximizeEvent","_class_wxMaximizeEvent",0}, + { "_class_wxTimerEvent","_wxTimerEvent",0}, + { "_class_wxSpinButton","_wxSpinButton",0}, + { "_class_wxCalendarEvent","_wxCalendarEvent",0}, + { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, + { "_class_wxPanel","_wxPanel",0}, + { "_class_wxCheckBox","_wxCheckBox",0}, + { "_wxComboBox","_class_wxComboBox",0}, + { "_wxRadioButton","_class_wxRadioButton",0}, + { "_signed_int","_wxCoord",0}, + { "_signed_int","_wxPrintQuality",0}, + { "_signed_int","_EBool",0}, + { "_signed_int","_wxWindowID",0}, + { "_signed_int","_int",0}, + { "_class_wxTextCtrl","_wxTextCtrl",0}, + { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, + { "_class_wxTextDataObject","_wxTextDataObject",0}, + { "_wxMenu","_class_wxMenu",0}, + { "_class_wxMoveEvent","_wxMoveEvent",0}, + { "_wxListBox","_class_wxListBox",0}, + { "_wxScreenDC","_class_wxScreenDC",0}, + { "_class_wxCalendarCtrl","_wxCalendarCtrl",0}, + { "_WXTYPE","_wxDateTime_t",0}, + { "_WXTYPE","_short",0}, + { "_WXTYPE","_signed_short",0}, + { "_WXTYPE","_unsigned_short",0}, + { "_class_wxDropTarget","_wxDropTarget",0}, + { "_class_wxBrush","_wxBrush",0}, + { "_unsigned_short","_wxDateTime_t",0}, + { "_unsigned_short","_WXTYPE",0}, + { "_unsigned_short","_short",0}, + { "_class_wxWindow","_class_wxCalendarCtrl",SwigwxCalendarCtrlTowxWindow}, + { "_class_wxWindow","_wxCalendarCtrl",SwigwxCalendarCtrlTowxWindow}, + { "_class_wxWindow","_wxWindow",0}, + { "_wxDateSpan","_class_wxDateSpan",0}, + { "_class_wxStaticText","_wxStaticText",0}, + { "_class_wxFont","_wxFont",0}, + { "_wxClipboard","_class_wxClipboard",0}, + { "_class_wxPyValidator","_wxPyValidator",0}, + { "_class_wxCloseEvent","_wxCloseEvent",0}, + { "_wxBusyInfo","_class_wxBusyInfo",0}, + { "_class_wxMenuEvent","_wxMenuEvent",0}, + { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0}, + { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0}, + { "_wxClientDC","_class_wxClientDC",0}, + { "_wxMouseEvent","_class_wxMouseEvent",0}, + { "_class_wxPoint","_wxPoint",0}, + { "_wxRealPoint","_class_wxRealPoint",0}, + { "_class_wxRadioBox","_wxRadioBox",0}, + { "_signed_short","_WXTYPE",0}, + { "_signed_short","_short",0}, + { "_wxMemoryDC","_class_wxMemoryDC",0}, + { "_wxPyTextDataObject","_class_wxPyTextDataObject",0}, + { "_wxPaintDC","_class_wxPaintDC",0}, + { "_class_wxWindowDC","_wxWindowDC",0}, + { "_class_wxFocusEvent","_wxFocusEvent",0}, + { "_class_wxMaximizeEvent","_wxMaximizeEvent",0}, + { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, + { "_class_wxCursor","_wxCursor",0}, + { "_wxPostScriptDC","_class_wxPostScriptDC",0}, + { "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0}, + { "_wxScrolledWindow","_class_wxScrolledWindow",0}, + { "_wxCalendarDateAttr","_class_wxCalendarDateAttr",0}, + { "_unsigned_char","_byte",0}, + { "_class_wxMenu","_wxMenu",0}, + { "_wxControl","_class_wxCalendarCtrl",SwigwxCalendarCtrlTowxControl}, + { "_wxControl","_wxCalendarCtrl",SwigwxCalendarCtrlTowxControl}, + { "_wxControl","_class_wxControl",0}, + { "_class_wxListBox","_wxListBox",0}, + { "_unsigned_int","_wxCoord",0}, + { "_unsigned_int","_wxPrintQuality",0}, + { "_unsigned_int","_size_t",0}, + { "_unsigned_int","_uint",0}, + { "_unsigned_int","_wxWindowID",0}, + { "_unsigned_int","_int",0}, + { "_wxIcon","_class_wxIcon",0}, + { "_wxDialog","_class_wxDialog",0}, + { "_class_wxPen","_wxPen",0}, + { "_wxConfigBase","_class_wxConfigBase",0}, + { "_short","_wxDateTime_t",0}, + { "_short","_WXTYPE",0}, + { "_short","_unsigned_short",0}, + { "_short","_signed_short",0}, + { "_class_wxStaticBox","_wxStaticBox",0}, + { "_class_wxPyDataObjectSimple","_wxPyDataObjectSimple",0}, + { "_class_wxPyDropSource","_wxPyDropSource",0}, + { "_class_wxScrollEvent","_wxScrollEvent",0}, + { "_wxJoystickEvent","_class_wxJoystickEvent",0}, + { "_class_wxChoice","_wxChoice",0}, + { "_class_wxSlider","_wxSlider",0}, + { "_class_wxImageList","_wxImageList",0}, + { "_class_wxBitmapButton","_wxBitmapButton",0}, + { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, + { "_wxWindowID","_wxCoord",0}, + { "_wxWindowID","_wxPrintQuality",0}, + { "_wxWindowID","_size_t",0}, + { "_wxWindowID","_EBool",0}, + { "_wxWindowID","_uint",0}, + { "_wxWindowID","_int",0}, + { "_wxWindowID","_signed_int",0}, + { "_wxWindowID","_unsigned_int",0}, + { "_class_wxScrollWinEvent","_wxScrollWinEvent",0}, + { "_int","_wxCoord",0}, + { "_int","_wxPrintQuality",0}, + { "_int","_size_t",0}, + { "_int","_EBool",0}, + { "_int","_uint",0}, + { "_int","_wxWindowID",0}, + { "_int","_unsigned_int",0}, + { "_int","_signed_int",0}, + { "_class_wxMouseEvent","_wxMouseEvent",0}, + { "_wxPyCommandEvent","_class_wxPyCommandEvent",0}, + { "_wxDateTime_t","_unsigned_short",0}, + { "_wxDateTime_t","_short",0}, + { "_wxDateTime_t","_WXTYPE",0}, + { "_class_wxSpinEvent","_wxSpinEvent",0}, + { "_class_wxQueryNewPaletteEvent","_wxQueryNewPaletteEvent",0}, + { "_wxDateTime","_class_wxDateTime",0}, + { "_class_wxNavigationKeyEvent","_wxNavigationKeyEvent",0}, + { "_wxButton","_class_wxButton",0}, + { "_wxSize","_class_wxSize",0}, + { "_wxRegionIterator","_class_wxRegionIterator",0}, + { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, + { "_class_wxTimeSpan","_wxTimeSpan",0}, + { "_class_wxPaintDC","_wxPaintDC",0}, + { "_class_wxSysColourChangedEvent","_wxSysColourChangedEvent",0}, + { "_class_wxPyFileDropTarget","_wxPyFileDropTarget",0}, + { "_class_wxInitDialogEvent","_wxInitDialogEvent",0}, + { "_class_wxComboBox","_wxComboBox",0}, + { "_class_wxRadioButton","_wxRadioButton",0}, + { "_wxValidator","_class_wxValidator",0}, + { "_class_wxCalendarDateAttr","_wxCalendarDateAttr",0}, + { "_class_wxLayoutConstraints","_wxLayoutConstraints",0}, + { "_wxIconizeEvent","_class_wxIconizeEvent",0}, + { "_class_wxControl","_class_wxCalendarCtrl",SwigwxCalendarCtrlTowxControl}, + { "_class_wxControl","_wxCalendarCtrl",SwigwxCalendarCtrlTowxControl}, + { "_class_wxControl","_wxControl",0}, + { "_wxStaticBitmap","_class_wxStaticBitmap",0}, + { "_class_wxIcon","_wxIcon",0}, + { "_class_wxColour","_wxColour",0}, + { "_class_wxScreenDC","_wxScreenDC",0}, + { "_wxPalette","_class_wxPalette",0}, + { "_class_wxIdleEvent","_wxIdleEvent",0}, + { "_class_wxConfigBase","_wxConfigBase",0}, + { "_wxCoord","_int",0}, + { "_wxCoord","_signed_int",0}, + { "_wxCoord","_unsigned_int",0}, + { "_wxCoord","_wxWindowID",0}, + { "_wxCoord","_uint",0}, + { "_wxCoord","_EBool",0}, + { "_wxCoord","_size_t",0}, + { "_wxCoord","_wxPrintQuality",0}, + { "_wxEraseEvent","_class_wxEraseEvent",0}, + { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, + { "_class_wxJoystickEvent","_wxJoystickEvent",0}, + { "_wxRegion","_class_wxRegion",0}, + { "_class_wxDateSpan","_wxDateSpan",0}, + { "_class_wxShowEvent","_wxShowEvent",0}, + { "_wxPyDropTarget","_class_wxPyDropTarget",0}, + { "_wxActivateEvent","_class_wxActivateEvent",0}, + { "_wxGauge","_class_wxGauge",0}, + { "_class_wxCheckListBox","_wxCheckListBox",0}, + { "_class_wxBusyInfo","_wxBusyInfo",0}, + { "_class_wxCommandEvent","_class_wxCalendarEvent",SwigwxCalendarEventTowxCommandEvent}, + { "_class_wxCommandEvent","_wxCalendarEvent",SwigwxCalendarEventTowxCommandEvent}, + { "_class_wxCommandEvent","_wxCommandEvent",0}, + { "_class_wxClientDC","_wxClientDC",0}, + { "_class_wxSizeEvent","_wxSizeEvent",0}, + { "_wxCustomDataObject","_class_wxCustomDataObject",0}, + { "_class_wxSize","_wxSize",0}, + { "_class_wxBitmap","_wxBitmap",0}, + { "_class_wxMemoryDC","_wxMemoryDC",0}, + { "_wxPyTextDropTarget","_class_wxPyTextDropTarget",0}, + { "_wxMenuBar","_class_wxMenuBar",0}, + { "_wxEvtHandler","_class_wxCalendarCtrl",SwigwxCalendarCtrlTowxEvtHandler}, + { "_wxEvtHandler","_wxCalendarCtrl",SwigwxCalendarCtrlTowxEvtHandler}, + { "_wxEvtHandler","_class_wxEvtHandler",0}, + { "_wxMenuItem","_class_wxMenuItem",0}, + { "_class_wxScrollBar","_wxScrollBar",0}, + { "_class_wxScrolledWindow","_wxScrolledWindow",0}, + { "_class_wxConfig","_wxConfig",0}, + { "_wxKeyEvent","_class_wxKeyEvent",0}, + { "_wxMoveEvent","_class_wxMoveEvent",0}, + { "_wxCalendarCtrl","_class_wxCalendarCtrl",0}, + { "_class_wxPalette","_wxPalette",0}, + { "_wxFileDataObject","_class_wxFileDataObject",0}, + { "_class_wxEraseEvent","_wxEraseEvent",0}, + { "_class_wxDataObjectComposite","_wxDataObjectComposite",0}, + { "_wxWindow","_class_wxCalendarCtrl",SwigwxCalendarCtrlTowxWindow}, + { "_wxWindow","_wxCalendarCtrl",SwigwxCalendarCtrlTowxWindow}, + { "_wxWindow","_class_wxWindow",0}, + { "_class_wxWindowDestroyEvent","_wxWindowDestroyEvent",0}, +{0,0,0}}; + +static PyObject *SWIG_globals; +#ifdef __cplusplus +extern "C" +#endif +SWIGEXPORT(void) initcalendarc() { + PyObject *m, *d; + SWIG_globals = SWIG_newvarlink(); + m = Py_InitModule("calendarc", calendarcMethods); + d = PyModule_GetDict(m); + PyDict_SetItemString(d,"wxCAL_SUNDAY_FIRST", PyInt_FromLong((long) wxCAL_SUNDAY_FIRST)); + PyDict_SetItemString(d,"wxCAL_MONDAY_FIRST", PyInt_FromLong((long) wxCAL_MONDAY_FIRST)); + PyDict_SetItemString(d,"wxCAL_SHOW_HOLIDAYS", PyInt_FromLong((long) wxCAL_SHOW_HOLIDAYS)); + PyDict_SetItemString(d,"wxCAL_NO_YEAR_CHANGE", PyInt_FromLong((long) wxCAL_NO_YEAR_CHANGE)); + PyDict_SetItemString(d,"wxCAL_NO_MONTH_CHANGE", PyInt_FromLong((long) wxCAL_NO_MONTH_CHANGE)); + PyDict_SetItemString(d,"wxCAL_HITTEST_NOWHERE", PyInt_FromLong((long) wxCAL_HITTEST_NOWHERE)); + PyDict_SetItemString(d,"wxCAL_HITTEST_HEADER", PyInt_FromLong((long) wxCAL_HITTEST_HEADER)); + PyDict_SetItemString(d,"wxCAL_HITTEST_DAY", PyInt_FromLong((long) wxCAL_HITTEST_DAY)); + PyDict_SetItemString(d,"wxCAL_BORDER_NONE", PyInt_FromLong((long) wxCAL_BORDER_NONE)); + PyDict_SetItemString(d,"wxCAL_BORDER_SQUARE", PyInt_FromLong((long) wxCAL_BORDER_SQUARE)); + PyDict_SetItemString(d,"wxCAL_BORDER_ROUND", PyInt_FromLong((long) wxCAL_BORDER_ROUND)); + PyDict_SetItemString(d,"wxEVT_CALENDAR_DOUBLECLICKED", PyInt_FromLong((long) wxEVT_CALENDAR_DOUBLECLICKED)); + PyDict_SetItemString(d,"wxEVT_CALENDAR_SEL_CHANGED", PyInt_FromLong((long) wxEVT_CALENDAR_SEL_CHANGED)); + PyDict_SetItemString(d,"wxEVT_CALENDAR_DAY_CHANGED", PyInt_FromLong((long) wxEVT_CALENDAR_DAY_CHANGED)); + PyDict_SetItemString(d,"wxEVT_CALENDAR_MONTH_CHANGED", PyInt_FromLong((long) wxEVT_CALENDAR_MONTH_CHANGED)); + PyDict_SetItemString(d,"wxEVT_CALENDAR_YEAR_CHANGED", PyInt_FromLong((long) wxEVT_CALENDAR_YEAR_CHANGED)); + PyDict_SetItemString(d,"wxEVT_CALENDAR_WEEKDAY_CLICKED", PyInt_FromLong((long) wxEVT_CALENDAR_WEEKDAY_CLICKED)); +{ + int i; + for (i = 0; _swig_mapping[i].n1; i++) + SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv); +} +} diff --git a/wxPython/src/gtk/calendar.py b/wxPython/src/gtk/calendar.py new file mode 100644 index 0000000000..68f6bf2c7b --- /dev/null +++ b/wxPython/src/gtk/calendar.py @@ -0,0 +1,244 @@ +# This file was created automatically by SWIG. +import calendarc + +from misc import * + +from windows import * + +from gdi import * + +from clip_dnd import * + +from controls import * + +from events import * + +from utils import * +import wx + +def EVT_CALENDAR(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_DOUBLECLICKED, fn) + +def EVT_CALENDAR_SEL_CHANGED(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_SEL_CHANGED, fn) + +def EVT_CALENDAR_DAY(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_DAY_CHANGED, fn) + +def EVT_CALENDAR_MONTH(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_MONTH_CHANGED, fn) + +def EVT_CALENDAR_YEAR(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_YEAR_CHANGED, fn) + +def EVT_CALENDAR_WEEKDAY_CLICKED(win, id, fn): + win.Connect(id, -1, wxEVT_CALENDAR_WEEKDAY_CLICKED, fn) + + +class wxCalendarDateAttrPtr : + def __init__(self,this): + self.this = this + self.thisown = 0 + def SetTextColour(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_SetTextColour,(self,) + _args, _kwargs) + return val + def SetBackgroundColour(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_SetBackgroundColour,(self,) + _args, _kwargs) + return val + def SetBorderColour(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_SetBorderColour,(self,) + _args, _kwargs) + return val + def SetFont(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_SetFont,(self,) + _args, _kwargs) + return val + def SetBorder(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_SetBorder,(self,) + _args, _kwargs) + return val + def SetHoliday(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_SetHoliday,(self,) + _args, _kwargs) + return val + def HasTextColour(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_HasTextColour,(self,) + _args, _kwargs) + return val + def HasBackgroundColour(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_HasBackgroundColour,(self,) + _args, _kwargs) + return val + def HasBorderColour(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_HasBorderColour,(self,) + _args, _kwargs) + return val + def HasFont(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_HasFont,(self,) + _args, _kwargs) + return val + def HasBorder(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_HasBorder,(self,) + _args, _kwargs) + return val + def IsHoliday(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_IsHoliday,(self,) + _args, _kwargs) + return val + def GetTextColour(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_GetTextColour,(self,) + _args, _kwargs) + if val: val = wxColourPtr(val) + return val + def GetBackgroundColour(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_GetBackgroundColour,(self,) + _args, _kwargs) + if val: val = wxColourPtr(val) + return val + def GetBorderColour(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_GetBorderColour,(self,) + _args, _kwargs) + if val: val = wxColourPtr(val) + return val + def GetFont(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_GetFont,(self,) + _args, _kwargs) + if val: val = wxFontPtr(val) + return val + def GetBorder(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarDateAttr_GetBorder,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "<C wxCalendarDateAttr instance at %s>" % (self.this,) +class wxCalendarDateAttr(wxCalendarDateAttrPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(calendarc.new_wxCalendarDateAttr,_args,_kwargs) + self.thisown = 1 + + + +def wxCalendarDateAttrBorder(*_args,**_kwargs): + val = wxCalendarDateAttrPtr(apply(calendarc.new_wxCalendarDateAttrBorder,_args,_kwargs)) + val.thisown = 1 + return val + + +class wxCalendarEventPtr(wxCommandEventPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def GetDate(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarEvent_GetDate,(self,) + _args, _kwargs) + if val: val = wxDateTimePtr(val) + return val + def GetWeekDay(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarEvent_GetWeekDay,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "<C wxCalendarEvent instance at %s>" % (self.this,) +class wxCalendarEvent(wxCalendarEventPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(calendarc.new_wxCalendarEvent,_args,_kwargs) + self.thisown = 1 + + + + +class wxCalendarCtrlPtr(wxControlPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def SetDate(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_SetDate,(self,) + _args, _kwargs) + return val + def GetDate(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_GetDate,(self,) + _args, _kwargs) + if val: val = wxDateTimePtr(val) + return val + def EnableYearChange(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_EnableYearChange,(self,) + _args, _kwargs) + return val + def EnableMonthChange(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_EnableMonthChange,(self,) + _args, _kwargs) + return val + def EnableHolidayDisplay(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_EnableHolidayDisplay,(self,) + _args, _kwargs) + return val + def SetHeaderColours(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_SetHeaderColours,(self,) + _args, _kwargs) + return val + def GetHeaderColourFg(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_GetHeaderColourFg,(self,) + _args, _kwargs) + if val: val = wxColourPtr(val) + return val + def GetHeaderColourBg(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_GetHeaderColourBg,(self,) + _args, _kwargs) + if val: val = wxColourPtr(val) + return val + def SetHighlightColours(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_SetHighlightColours,(self,) + _args, _kwargs) + return val + def GetHighlightColourFg(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_GetHighlightColourFg,(self,) + _args, _kwargs) + if val: val = wxColourPtr(val) + return val + def GetHighlightColourBg(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_GetHighlightColourBg,(self,) + _args, _kwargs) + if val: val = wxColourPtr(val) + return val + def SetHolidayColours(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_SetHolidayColours,(self,) + _args, _kwargs) + return val + def GetHolidayColourFg(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_GetHolidayColourFg,(self,) + _args, _kwargs) + if val: val = wxColourPtr(val) + return val + def GetHolidayColourBg(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_GetHolidayColourBg,(self,) + _args, _kwargs) + if val: val = wxColourPtr(val) + return val + def GetAttr(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_GetAttr,(self,) + _args, _kwargs) + if val: val = wxCalendarDateAttrPtr(val) + return val + def SetAttr(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_SetAttr,(self,) + _args, _kwargs) + return val + def SetHoliday(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_SetHoliday,(self,) + _args, _kwargs) + return val + def ResetAttr(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_ResetAttr,(self,) + _args, _kwargs) + return val + def HitTest(self, *_args, **_kwargs): + val = apply(calendarc.wxCalendarCtrl_HitTest,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "<C wxCalendarCtrl instance at %s>" % (self.this,) +class wxCalendarCtrl(wxCalendarCtrlPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(calendarc.new_wxCalendarCtrl,_args,_kwargs) + self.thisown = 1 + + + + + + +#-------------- FUNCTION WRAPPERS ------------------ + + + +#-------------- VARIABLE WRAPPERS ------------------ + +wxCAL_SUNDAY_FIRST = calendarc.wxCAL_SUNDAY_FIRST +wxCAL_MONDAY_FIRST = calendarc.wxCAL_MONDAY_FIRST +wxCAL_SHOW_HOLIDAYS = calendarc.wxCAL_SHOW_HOLIDAYS +wxCAL_NO_YEAR_CHANGE = calendarc.wxCAL_NO_YEAR_CHANGE +wxCAL_NO_MONTH_CHANGE = calendarc.wxCAL_NO_MONTH_CHANGE +wxCAL_HITTEST_NOWHERE = calendarc.wxCAL_HITTEST_NOWHERE +wxCAL_HITTEST_HEADER = calendarc.wxCAL_HITTEST_HEADER +wxCAL_HITTEST_DAY = calendarc.wxCAL_HITTEST_DAY +wxCAL_BORDER_NONE = calendarc.wxCAL_BORDER_NONE +wxCAL_BORDER_SQUARE = calendarc.wxCAL_BORDER_SQUARE +wxCAL_BORDER_ROUND = calendarc.wxCAL_BORDER_ROUND +wxEVT_CALENDAR_DOUBLECLICKED = calendarc.wxEVT_CALENDAR_DOUBLECLICKED +wxEVT_CALENDAR_SEL_CHANGED = calendarc.wxEVT_CALENDAR_SEL_CHANGED +wxEVT_CALENDAR_DAY_CHANGED = calendarc.wxEVT_CALENDAR_DAY_CHANGED +wxEVT_CALENDAR_MONTH_CHANGED = calendarc.wxEVT_CALENDAR_MONTH_CHANGED +wxEVT_CALENDAR_YEAR_CHANGED = calendarc.wxEVT_CALENDAR_YEAR_CHANGED +wxEVT_CALENDAR_WEEKDAY_CLICKED = calendarc.wxEVT_CALENDAR_WEEKDAY_CLICKED + + +#-------------- USER INCLUDE ----------------------- + + +# Stuff these names into the wx namespace so wxPyConstructObject can find them + +wx.wxCalendarEventPtr = wxCalendarEventPtr diff --git a/utils/wxPython/src/gtk/clip_dnd.cpp b/wxPython/src/gtk/clip_dnd.cpp similarity index 97% rename from utils/wxPython/src/gtk/clip_dnd.cpp rename to wxPython/src/gtk/clip_dnd.cpp index 3e66153b4c..280cf5646c 100644 --- a/utils/wxPython/src/gtk/clip_dnd.cpp +++ b/wxPython/src/gtk/clip_dnd.cpp @@ -137,9 +137,12 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) { if (m_myInst.findCallback("GetDataHere")) { PyObject* ro; ro = m_myInst.callCallbackObj(Py_BuildValue("()")); - rval = (ro != Py_None && PyString_Check(ro)); - if (rval) - memcpy(buf, PyString_AsString(ro), PyString_Size(ro)); + if (ro) { + rval = (ro != Py_None && PyString_Check(ro)); + if (rval) + memcpy(buf, PyString_AsString(ro), PyString_Size(ro)); + Py_DECREF(ro); + } } wxPySaveThread(doSave); return rval; @@ -192,8 +195,11 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() { PyObject* ro; wxBitmap* ptr; ro = m_myInst.callCallbackObj(Py_BuildValue("()")); - if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) - rval = ptr; + if (ro) { + if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) + rval = ptr; + Py_DECREF(ro); + } } wxPySaveThread(doSave); return *rval; @@ -1026,17 +1032,19 @@ static PyObject *_wrap_new_wxPyDataObjectSimple(PyObject *self, PyObject *args, return _resultobj; } -#define wxPyDataObjectSimple__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyDataObjectSimple__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyDataObjectSimple__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyDataObjectSimple * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDataObjectSimple__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyDataObjectSimple__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1048,9 +1056,12 @@ static PyObject *_wrap_wxPyDataObjectSimple__setSelf(PyObject *self, PyObject *a { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyDataObjectSimple__setSelf(_arg0,_arg1); + wxPyDataObjectSimple__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -1345,17 +1356,19 @@ static PyObject *_wrap_new_wxPyTextDataObject(PyObject *self, PyObject *args, Py return _resultobj; } -#define wxPyTextDataObject__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyTextDataObject__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyTextDataObject__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyTextDataObject * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyTextDataObject__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyTextDataObject__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1367,9 +1380,12 @@ static PyObject *_wrap_wxPyTextDataObject__setSelf(PyObject *self, PyObject *arg { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyTextDataObject__setSelf(_arg0,_arg1); + wxPyTextDataObject__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -1550,17 +1566,19 @@ static PyObject *_wrap_new_wxPyBitmapDataObject(PyObject *self, PyObject *args, return _resultobj; } -#define wxPyBitmapDataObject__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyBitmapDataObject__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyBitmapDataObject__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyBitmapDataObject * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyBitmapDataObject__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyBitmapDataObject__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -1572,9 +1590,12 @@ static PyObject *_wrap_wxPyBitmapDataObject__setSelf(PyObject *self, PyObject *a { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyBitmapDataObject__setSelf(_arg0,_arg1); + wxPyBitmapDataObject__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -2214,18 +2235,20 @@ static PyObject *_wrap_new_wxDropSource(PyObject *self, PyObject *args, PyObject return _resultobj; } -#define wxDropSource__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) +#define wxDropSource__setSelf(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->_setSelf(_swigarg0,_swigarg1,_swigarg2)) static PyObject *_wrap_wxDropSource__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyDropSource * _arg0; PyObject * _arg1; - int _arg2; + PyObject * _arg2; + int _arg3; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self","incref", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class","incref", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi:wxDropSource__setSelf",_kwnames,&_argo0,&_obj1,&_arg2)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOi:wxDropSource__setSelf",_kwnames,&_argo0,&_obj1,&_obj2,&_arg3)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2237,9 +2260,12 @@ static PyObject *_wrap_wxDropSource__setSelf(PyObject *self, PyObject *args, PyO { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxDropSource__setSelf(_arg0,_arg1,_arg2); + wxDropSource__setSelf(_arg0,_arg1,_arg2,_arg3); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -2479,17 +2505,19 @@ static PyObject *_wrap_new_wxPyDropTarget(PyObject *self, PyObject *args, PyObje return _resultobj; } -#define wxPyDropTarget__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxPyDropTarget__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxPyDropTarget__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyDropTarget * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDropTarget__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxPyDropTarget__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2501,9 +2529,12 @@ static PyObject *_wrap_wxPyDropTarget__setSelf(PyObject *self, PyObject *args, P { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxPyDropTarget__setSelf(_arg0,_arg1); + wxPyDropTarget__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -2792,17 +2823,19 @@ static PyObject *_wrap_new_wxTextDropTarget(PyObject *self, PyObject *args, PyOb return _resultobj; } -#define wxTextDropTarget__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxTextDropTarget__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxTextDropTarget__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyTextDropTarget * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTextDropTarget__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxTextDropTarget__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2814,9 +2847,12 @@ static PyObject *_wrap_wxTextDropTarget__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxTextDropTarget__setSelf(_arg0,_arg1); + wxTextDropTarget__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -3011,17 +3047,19 @@ static PyObject *_wrap_new_wxFileDropTarget(PyObject *self, PyObject *args, PyOb return _resultobj; } -#define wxFileDropTarget__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxFileDropTarget__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxFileDropTarget__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyFileDropTarget * _arg0; PyObject * _arg1; + PyObject * _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","self","_class", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxFileDropTarget__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxFileDropTarget__setSelf",_kwnames,&_argo0,&_obj1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -3033,9 +3071,12 @@ static PyObject *_wrap_wxFileDropTarget__setSelf(PyObject *self, PyObject *args, { _arg1 = _obj1; } +{ + _arg2 = _obj2; +} { wxPy_BEGIN_ALLOW_THREADS; - wxFileDropTarget__setSelf(_arg0,_arg1); + wxFileDropTarget__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -3406,10 +3447,11 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_uint","_unsigned_int",0}, { "_uint","_int",0}, { "_uint","_wxWindowID",0}, + { "_wxChar","_char",0}, { "_wxRect","_class_wxRect",0}, { "_wxPoint","_class_wxPoint",0}, + { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, - { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxWindowDC","_class_wxWindowDC",0}, { "_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0}, { "_wxDropTarget","_class_wxPyFileDropTarget",SwigwxPyFileDropTargetTowxDropTarget}, @@ -3435,7 +3477,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_unsigned_long","_long",0}, { "_class_wxRect","_wxRect",0}, { "_class_wxDC","_wxDC",0}, - { "_class_wxPyTimer","_wxPyTimer",0}, { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, { "_signed_int","_wxCoord",0}, { "_signed_int","_wxPrintQuality",0}, diff --git a/utils/wxPython/src/gtk/clip_dnd.py b/wxPython/src/gtk/clip_dnd.py similarity index 98% rename from utils/wxPython/src/gtk/clip_dnd.py rename to wxPython/src/gtk/clip_dnd.py index 471aecf292..3e9416a13d 100644 --- a/utils/wxPython/src/gtk/clip_dnd.py +++ b/wxPython/src/gtk/clip_dnd.py @@ -109,7 +109,7 @@ class wxPyDataObjectSimple(wxPyDataObjectSimplePtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxPyDataObjectSimple,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyDataObjectSimple) @@ -168,7 +168,7 @@ class wxPyTextDataObject(wxPyTextDataObjectPtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxPyTextDataObject,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyTextDataObject) @@ -207,7 +207,7 @@ class wxPyBitmapDataObject(wxPyBitmapDataObjectPtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxPyBitmapDataObject,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxPyBitmapDataObject) @@ -333,7 +333,7 @@ class wxDropSource(wxDropSourcePtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxDropSource,_args,_kwargs) self.thisown = 1 - self._setSelf(self, 0) + self._setSelf(self, wxDropSource, 0) @@ -391,7 +391,7 @@ class wxPyDropTarget(wxPyDropTargetPtr): self.this = apply(clip_dndc.new_wxPyDropTarget,_args,_kwargs) self.thisown = 1 if _args:_args[0].thisown = 0 - self._setSelf(self) + self._setSelf(self, wxPyDropTarget) @@ -424,7 +424,7 @@ class wxTextDropTarget(wxTextDropTargetPtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxTextDropTarget,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxTextDropTarget) @@ -457,7 +457,7 @@ class wxFileDropTarget(wxFileDropTargetPtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxFileDropTarget,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, wxFileDropTarget) diff --git a/utils/wxPython/src/gtk/cmndlgs.cpp b/wxPython/src/gtk/cmndlgs.cpp similarity index 97% rename from utils/wxPython/src/gtk/cmndlgs.cpp rename to wxPython/src/gtk/cmndlgs.cpp index 032cfc54dc..0469cd89db 100644 --- a/utils/wxPython/src/gtk/cmndlgs.cpp +++ b/wxPython/src/gtk/cmndlgs.cpp @@ -288,11 +288,12 @@ static PyObject *_wrap_wxColourData_SetColour(PyObject *self, PyObject *args, Py wxColourData * _arg0; wxColour * _arg1; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; + wxColour temp; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","colour", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxColourData_SetColour",_kwnames,&_argo0,&_argo1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxColourData_SetColour",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -301,13 +302,11 @@ static PyObject *_wrap_wxColourData_SetColour(PyObject *self, PyObject *args, Py return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxColourData_SetColour. Expected _wxColour_p."); +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) return NULL; - } - } +} { wxPy_BEGIN_ALLOW_THREADS; wxColourData_SetColour(_arg0,*_arg1); @@ -325,11 +324,12 @@ static PyObject *_wrap_wxColourData_SetCustomColour(PyObject *self, PyObject *ar int _arg1; wxColour * _arg2; PyObject * _argo0 = 0; - PyObject * _argo2 = 0; + wxColour temp; + PyObject * _obj2 = 0; char *_kwnames[] = { "self","i","colour", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxColourData_SetCustomColour",_kwnames,&_argo0,&_arg1,&_argo2)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxColourData_SetCustomColour",_kwnames,&_argo0,&_arg1,&_obj2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -338,13 +338,11 @@ static PyObject *_wrap_wxColourData_SetCustomColour(PyObject *self, PyObject *ar return NULL; } } - if (_argo2) { - if (_argo2 == Py_None) { _arg2 = NULL; } - else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxColourData_SetCustomColour. Expected _wxColour_p."); +{ + _arg2 = &temp; + if (! wxColour_helper(_obj2, &_arg2)) return NULL; - } - } +} { wxPy_BEGIN_ALLOW_THREADS; wxColourData_SetCustomColour(_arg0,_arg1,*_arg2); @@ -1345,6 +1343,84 @@ static PyObject *_wrap_wxFileDialog_ShowModal(PyObject *self, PyObject *args, Py return _resultobj; } +static PyObject * wxFileDialog_GetFilenames(wxFileDialog *self) { + wxArrayString arr; + self->GetFilenames(arr); + size_t count = arr.GetCount(); + PyObject* listObj = PyList_New(0); + for(size_t x=0; x<count; x++) { + PyObject* name = PyString_FromString(arr[x]); + PyList_Append(listObj, name); + } + return listObj; + } +static PyObject *_wrap_wxFileDialog_GetFilenames(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + PyObject * _result; + wxFileDialog * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxFileDialog_GetFilenames",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxFileDialog_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxFileDialog_GetFilenames. Expected _wxFileDialog_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (PyObject *)wxFileDialog_GetFilenames(_arg0); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = _result; +} + return _resultobj; +} + +static PyObject * wxFileDialog_GetPaths(wxFileDialog *self) { + wxArrayString arr; + self->GetPaths(arr); + size_t count = arr.GetCount(); + PyObject* listObj = PyList_New(0); + for(size_t x=0; x<count; x++) { + PyObject* name = PyString_FromString(arr[x]); + PyList_Append(listObj, name); + } + return listObj; + } +static PyObject *_wrap_wxFileDialog_GetPaths(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + PyObject * _result; + wxFileDialog * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxFileDialog_GetPaths",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxFileDialog_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxFileDialog_GetPaths. Expected _wxFileDialog_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (PyObject *)wxFileDialog_GetPaths(_arg0); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = _result; +} + return _resultobj; +} + static void *SwigwxSingleChoiceDialogTowxDialog(void *ptr) { wxSingleChoiceDialog *src; wxDialog *dest; @@ -2092,11 +2168,12 @@ static PyObject *_wrap_wxFontData_SetColour(PyObject *self, PyObject *args, PyOb wxFontData * _arg0; wxColour * _arg1; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; + wxColour temp; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","colour", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxFontData_SetColour",_kwnames,&_argo0,&_argo1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxFontData_SetColour",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2105,13 +2182,11 @@ static PyObject *_wrap_wxFontData_SetColour(PyObject *self, PyObject *args, PyOb return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxFontData_SetColour. Expected _wxColour_p."); +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) return NULL; - } - } +} { wxPy_BEGIN_ALLOW_THREADS; wxFontData_SetColour(_arg0,*_arg1); @@ -2634,6 +2709,8 @@ static PyMethodDef cmndlgscMethods[] = { { "wxSingleChoiceDialog_GetStringSelection", (PyCFunction) _wrap_wxSingleChoiceDialog_GetStringSelection, METH_VARARGS | METH_KEYWORDS }, { "wxSingleChoiceDialog_GetSelection", (PyCFunction) _wrap_wxSingleChoiceDialog_GetSelection, METH_VARARGS | METH_KEYWORDS }, { "new_wxSingleChoiceDialog", (PyCFunction) _wrap_new_wxSingleChoiceDialog, METH_VARARGS | METH_KEYWORDS }, + { "wxFileDialog_GetPaths", (PyCFunction) _wrap_wxFileDialog_GetPaths, METH_VARARGS | METH_KEYWORDS }, + { "wxFileDialog_GetFilenames", (PyCFunction) _wrap_wxFileDialog_GetFilenames, METH_VARARGS | METH_KEYWORDS }, { "wxFileDialog_ShowModal", (PyCFunction) _wrap_wxFileDialog_ShowModal, METH_VARARGS | METH_KEYWORDS }, { "wxFileDialog_SetWildcard", (PyCFunction) _wrap_wxFileDialog_SetWildcard, METH_VARARGS | METH_KEYWORDS }, { "wxFileDialog_SetStyle", (PyCFunction) _wrap_wxFileDialog_SetStyle, METH_VARARGS | METH_KEYWORDS }, @@ -2814,6 +2891,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_uint","_unsigned_int",0}, { "_uint","_int",0}, { "_uint","_wxWindowID",0}, + { "_wxChar","_char",0}, { "_wxPyValidator","_class_wxPyValidator",0}, { "_class_wxEvent","_wxEvent",0}, { "_wxCheckListBox","_class_wxCheckListBox",0}, @@ -2824,9 +2902,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxButton","_wxButton",0}, { "_wxRadioBox","_class_wxRadioBox",0}, { "_class_wxFontData","_wxFontData",0}, + { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, - { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxWindowDC","_class_wxWindowDC",0}, + { "_wxTimerEvent","_class_wxTimerEvent",0}, { "_wxScrollBar","_class_wxScrollBar",0}, { "_wxSpinButton","_class_wxSpinButton",0}, { "_wxColourDialog","_class_wxColourDialog",0}, @@ -2865,9 +2944,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, { "_class_wxWindowCreateEvent","_wxWindowCreateEvent",0}, { "_class_wxDirDialog","_wxDirDialog",0}, - { "_class_wxPyTimer","_wxPyTimer",0}, { "_wxFocusEvent","_class_wxFocusEvent",0}, { "_wxMaximizeEvent","_class_wxMaximizeEvent",0}, + { "_class_wxTimerEvent","_wxTimerEvent",0}, { "_class_wxSpinButton","_wxSpinButton",0}, { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, { "_class_wxPanel","_class_wxMessageDialog",SwigwxMessageDialogTowxPanel}, diff --git a/utils/wxPython/src/gtk/cmndlgs.py b/wxPython/src/gtk/cmndlgs.py similarity index 95% rename from utils/wxPython/src/gtk/cmndlgs.py rename to wxPython/src/gtk/cmndlgs.py index 1935f27a3e..0947274149 100644 --- a/utils/wxPython/src/gtk/cmndlgs.py +++ b/wxPython/src/gtk/cmndlgs.py @@ -71,7 +71,7 @@ class wxColourDialog(wxColourDialogPtr): def __init__(self,*_args,**_kwargs): self.this = apply(cmndlgsc.new_wxColourDialog,_args,_kwargs) self.thisown = 1 - wx._StdDialogCallbacks(self) + #wx._StdDialogCallbacks(self) @@ -104,7 +104,7 @@ class wxDirDialog(wxDirDialogPtr): def __init__(self,*_args,**_kwargs): self.this = apply(cmndlgsc.new_wxDirDialog,_args,_kwargs) self.thisown = 1 - wx._StdDialogCallbacks(self) + #wx._StdDialogCallbacks(self) @@ -158,13 +158,19 @@ class wxFileDialogPtr(wxDialogPtr): def ShowModal(self, *_args, **_kwargs): val = apply(cmndlgsc.wxFileDialog_ShowModal,(self,) + _args, _kwargs) return val + def GetFilenames(self, *_args, **_kwargs): + val = apply(cmndlgsc.wxFileDialog_GetFilenames,(self,) + _args, _kwargs) + return val + def GetPaths(self, *_args, **_kwargs): + val = apply(cmndlgsc.wxFileDialog_GetPaths,(self,) + _args, _kwargs) + return val def __repr__(self): return "<C wxFileDialog instance at %s>" % (self.this,) class wxFileDialog(wxFileDialogPtr): def __init__(self,*_args,**_kwargs): self.this = apply(cmndlgsc.new_wxFileDialog,_args,_kwargs) self.thisown = 1 - wx._StdDialogCallbacks(self) + #wx._StdDialogCallbacks(self) @@ -191,7 +197,7 @@ class wxSingleChoiceDialog(wxSingleChoiceDialogPtr): def __init__(self,*_args,**_kwargs): self.this = apply(cmndlgsc.new_wxSingleChoiceDialog,_args,_kwargs) self.thisown = 1 - wx._StdDialogCallbacks(self) + #wx._StdDialogCallbacks(self) @@ -215,7 +221,7 @@ class wxTextEntryDialog(wxTextEntryDialogPtr): def __init__(self,*_args,**_kwargs): self.this = apply(cmndlgsc.new_wxTextEntryDialog,_args,_kwargs) self.thisown = 1 - wx._StdDialogCallbacks(self) + #wx._StdDialogCallbacks(self) @@ -296,7 +302,7 @@ class wxFontDialog(wxFontDialogPtr): def __init__(self,*_args,**_kwargs): self.this = apply(cmndlgsc.new_wxFontDialog,_args,_kwargs) self.thisown = 1 - wx._StdDialogCallbacks(self) + #wx._StdDialogCallbacks(self) @@ -314,7 +320,7 @@ class wxMessageDialog(wxMessageDialogPtr): def __init__(self,*_args,**_kwargs): self.this = apply(cmndlgsc.new_wxMessageDialog,_args,_kwargs) self.thisown = 1 - wx._StdDialogCallbacks(self) + #wx._StdDialogCallbacks(self) diff --git a/utils/wxPython/src/gtk/controls.cpp b/wxPython/src/gtk/controls.cpp similarity index 97% rename from utils/wxPython/src/gtk/controls.cpp rename to wxPython/src/gtk/controls.cpp index c2945fa8d8..e79ba95900 100644 --- a/utils/wxPython/src/gtk/controls.cpp +++ b/wxPython/src/gtk/controls.cpp @@ -56,6 +56,7 @@ extern PyObject *SWIG_newvarlink(void); #include "helpers.h" #include <wx/slider.h> #include <wx/spinbutt.h> +#include <wx/spinctrl.h> #include <wx/dynarray.h> #include <wx/statline.h> //#include <wx/toggbutt.h> @@ -484,11 +485,12 @@ static PyObject *_wrap_wxButton_SetBackgroundColour(PyObject *self, PyObject *ar wxButton * _arg0; wxColour * _arg1; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; + wxColour temp; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","colour", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxButton_SetBackgroundColour",_kwnames,&_argo0,&_argo1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxButton_SetBackgroundColour",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -497,13 +499,11 @@ static PyObject *_wrap_wxButton_SetBackgroundColour(PyObject *self, PyObject *ar return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxButton_SetBackgroundColour. Expected _wxColour_p."); +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) return NULL; - } - } +} { wxPy_BEGIN_ALLOW_THREADS; wxButton_SetBackgroundColour(_arg0,*_arg1); @@ -520,11 +520,12 @@ static PyObject *_wrap_wxButton_SetForegroundColour(PyObject *self, PyObject *ar wxButton * _arg0; wxColour * _arg1; PyObject * _argo0 = 0; - PyObject * _argo1 = 0; + wxColour temp; + PyObject * _obj1 = 0; char *_kwnames[] = { "self","colour", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxButton_SetForegroundColour",_kwnames,&_argo0,&_argo1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxButton_SetForegroundColour",_kwnames,&_argo0,&_obj1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -533,13 +534,11 @@ static PyObject *_wrap_wxButton_SetForegroundColour(PyObject *self, PyObject *ar return NULL; } } - if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxColour_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxButton_SetForegroundColour. Expected _wxColour_p."); +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) return NULL; - } - } +} { wxPy_BEGIN_ALLOW_THREADS; wxButton_SetForegroundColour(_arg0,*_arg1); @@ -939,6 +938,89 @@ static PyObject *_wrap_wxBitmapButton_SetBitmapLabel(PyObject *self, PyObject *a return _resultobj; } +#define wxBitmapButton_SetMargins(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetMargins(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxBitmapButton_SetMargins(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxBitmapButton * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","x","y", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxBitmapButton_SetMargins",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxBitmapButton_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxBitmapButton_SetMargins. Expected _wxBitmapButton_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxBitmapButton_SetMargins(_arg0,_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxBitmapButton_GetMarginX(_swigobj) (_swigobj->GetMarginX()) +static PyObject *_wrap_wxBitmapButton_GetMarginX(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxBitmapButton * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxBitmapButton_GetMarginX",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxBitmapButton_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxBitmapButton_GetMarginX. Expected _wxBitmapButton_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxBitmapButton_GetMarginX(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxBitmapButton_GetMarginY(_swigobj) (_swigobj->GetMarginY()) +static PyObject *_wrap_wxBitmapButton_GetMarginY(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxBitmapButton * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxBitmapButton_GetMarginY",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxBitmapButton_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxBitmapButton_GetMarginY. Expected _wxBitmapButton_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxBitmapButton_GetMarginY(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + static void *SwigwxCheckBoxTowxControl(void *ptr) { wxCheckBox *src; wxControl *dest; @@ -3264,7 +3346,7 @@ static PyObject * wxListBox_GetSelections(wxListBox *self) { wxArrayInt lst; self->GetSelections(lst); PyObject *tup = PyTuple_New(lst.GetCount()); - for(int i=0; i<lst.GetCount(); i++) { + for(size_t i=0; i<lst.GetCount(); i++) { PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i])); } return tup; @@ -7154,7 +7236,99 @@ static PyObject *_wrap_wxSlider_SetValue(PyObject *self, PyObject *args, PyObjec return _resultobj; } +static void *SwigwxSpinCtrlTowxSpinButton(void *ptr) { + wxSpinCtrl *src; + wxSpinButton *dest; + src = (wxSpinCtrl *) ptr; + dest = (wxSpinButton *) src; + return (void *) dest; +} + +static void *SwigwxSpinCtrlTowxControl(void *ptr) { + wxSpinCtrl *src; + wxControl *dest; + src = (wxSpinCtrl *) ptr; + dest = (wxControl *) src; + return (void *) dest; +} + +static void *SwigwxSpinCtrlTowxWindow(void *ptr) { + wxSpinCtrl *src; + wxWindow *dest; + src = (wxSpinCtrl *) ptr; + dest = (wxWindow *) src; + return (void *) dest; +} + +static void *SwigwxSpinCtrlTowxEvtHandler(void *ptr) { + wxSpinCtrl *src; + wxEvtHandler *dest; + src = (wxSpinCtrl *) ptr; + dest = (wxEvtHandler *) src; + return (void *) dest; +} + +#define new_wxSpinCtrl(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7,_swigarg8,_swigarg9) (new wxSpinCtrl(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6,_swigarg7,_swigarg8,_swigarg9)) +static PyObject *_wrap_new_wxSpinCtrl(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSpinCtrl * _result; + wxWindow * _arg0; + wxWindowID _arg1 = (wxWindowID ) -1; + char * _arg2 = (char *) ""; + wxPoint * _arg3 = (wxPoint *) &wxPyDefaultPosition; + wxSize * _arg4 = (wxSize *) &wxPyDefaultSize; + long _arg5 = (long ) wxSP_ARROW_KEYS; + int _arg6 = (int ) 0; + int _arg7 = (int ) 100; + int _arg8 = (int ) 0; + char * _arg9 = (char *) "wxSpinCtrl"; + PyObject * _argo0 = 0; + wxPoint temp; + PyObject * _obj3 = 0; + wxSize temp0; + PyObject * _obj4 = 0; + char *_kwnames[] = { "parent","id","value","pos","size","style","min","max","initial","name", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|isOOliiis:new_wxSpinCtrl",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&_obj4,&_arg5,&_arg6,&_arg7,&_arg8,&_arg9)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxSpinCtrl. Expected _wxWindow_p."); + return NULL; + } + } + if (_obj3) +{ + _arg3 = &temp; + if (! wxPoint_helper(_obj3, &_arg3)) + return NULL; +} + if (_obj4) +{ + _arg4 = &temp0; + if (! wxSize_helper(_obj4, &_arg4)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxSpinCtrl *)new_wxSpinCtrl(_arg0,_arg1,_arg2,*_arg3,*_arg4,_arg5,_arg6,_arg7,_arg8,_arg9); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxSpinCtrl_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + static PyMethodDef controlscMethods[] = { + { "new_wxSpinCtrl", (PyCFunction) _wrap_new_wxSpinCtrl, METH_VARARGS | METH_KEYWORDS }, { "wxSlider_SetValue", (PyCFunction) _wrap_wxSlider_SetValue, METH_VARARGS | METH_KEYWORDS }, { "wxSlider_SetTick", (PyCFunction) _wrap_wxSlider_SetTick, METH_VARARGS | METH_KEYWORDS }, { "wxSlider_SetThumbLength", (PyCFunction) _wrap_wxSlider_SetThumbLength, METH_VARARGS | METH_KEYWORDS }, @@ -7322,6 +7496,9 @@ static PyMethodDef controlscMethods[] = { { "wxCheckBox_SetValue", (PyCFunction) _wrap_wxCheckBox_SetValue, METH_VARARGS | METH_KEYWORDS }, { "wxCheckBox_GetValue", (PyCFunction) _wrap_wxCheckBox_GetValue, METH_VARARGS | METH_KEYWORDS }, { "new_wxCheckBox", (PyCFunction) _wrap_new_wxCheckBox, METH_VARARGS | METH_KEYWORDS }, + { "wxBitmapButton_GetMarginY", (PyCFunction) _wrap_wxBitmapButton_GetMarginY, METH_VARARGS | METH_KEYWORDS }, + { "wxBitmapButton_GetMarginX", (PyCFunction) _wrap_wxBitmapButton_GetMarginX, METH_VARARGS | METH_KEYWORDS }, + { "wxBitmapButton_SetMargins", (PyCFunction) _wrap_wxBitmapButton_SetMargins, METH_VARARGS | METH_KEYWORDS }, { "wxBitmapButton_SetBitmapLabel", (PyCFunction) _wrap_wxBitmapButton_SetBitmapLabel, METH_VARARGS | METH_KEYWORDS }, { "wxBitmapButton_SetBitmapSelected", (PyCFunction) _wrap_wxBitmapButton_SetBitmapSelected, METH_VARARGS | METH_KEYWORDS }, { "wxBitmapButton_SetBitmapFocus", (PyCFunction) _wrap_wxBitmapButton_SetBitmapFocus, METH_VARARGS | METH_KEYWORDS }, @@ -7366,9 +7543,12 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPrintQuality","_EBool",0}, { "_wxPrintQuality","_size_t",0}, { "_class_wxCustomDataObject","_wxCustomDataObject",0}, + { "_wxSpinCtrl","_class_wxSpinCtrl",0}, { "_class_wxRegionIterator","_wxRegionIterator",0}, { "_class_wxPyTextDropTarget","_wxPyTextDropTarget",0}, { "_class_wxMenuBar","_wxMenuBar",0}, + { "_class_wxEvtHandler","_class_wxSpinCtrl",SwigwxSpinCtrlTowxEvtHandler}, + { "_class_wxEvtHandler","_wxSpinCtrl",SwigwxSpinCtrlTowxEvtHandler}, { "_class_wxEvtHandler","_class_wxSlider",SwigwxSliderTowxEvtHandler}, { "_class_wxEvtHandler","_wxSlider",SwigwxSliderTowxEvtHandler}, { "_class_wxEvtHandler","_class_wxRadioButton",SwigwxRadioButtonTowxEvtHandler}, @@ -7474,6 +7654,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_uint","_unsigned_int",0}, { "_uint","_int",0}, { "_uint","_wxWindowID",0}, + { "_wxChar","_char",0}, { "_wxPyValidator","_class_wxPyValidator",0}, { "_class_wxEvent","_wxEvent",0}, { "_wxCheckListBox","_class_wxCheckListBox",0}, @@ -7485,10 +7666,14 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxButton","_wxBitmapButton",SwigwxBitmapButtonTowxButton}, { "_class_wxButton","_wxButton",0}, { "_wxRadioBox","_class_wxRadioBox",0}, + { "_class_wxSpinCtrl","_wxSpinCtrl",0}, + { "_char","_wxChar",0}, { "_wxBitmap","_class_wxBitmap",0}, - { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxWindowDC","_class_wxWindowDC",0}, + { "_wxTimerEvent","_class_wxTimerEvent",0}, { "_wxScrollBar","_class_wxScrollBar",0}, + { "_wxSpinButton","_class_wxSpinCtrl",SwigwxSpinCtrlTowxSpinButton}, + { "_wxSpinButton","_wxSpinCtrl",SwigwxSpinCtrlTowxSpinButton}, { "_wxSpinButton","_class_wxSpinButton",0}, { "_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0}, { "_class_wxNotifyEvent","_wxNotifyEvent",0}, @@ -7518,9 +7703,11 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxScrollWinEvent","_class_wxScrollWinEvent",0}, { "_wxQueryNewPaletteEvent","_class_wxQueryNewPaletteEvent",0}, { "_class_wxWindowCreateEvent","_wxWindowCreateEvent",0}, - { "_class_wxPyTimer","_wxPyTimer",0}, { "_wxFocusEvent","_class_wxFocusEvent",0}, { "_wxMaximizeEvent","_class_wxMaximizeEvent",0}, + { "_class_wxTimerEvent","_wxTimerEvent",0}, + { "_class_wxSpinButton","_class_wxSpinCtrl",SwigwxSpinCtrlTowxSpinButton}, + { "_class_wxSpinButton","_wxSpinCtrl",SwigwxSpinCtrlTowxSpinButton}, { "_class_wxSpinButton","_wxSpinButton",0}, { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, { "_class_wxPanel","_wxPanel",0}, @@ -7548,6 +7735,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxBrush","_wxBrush",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, + { "_class_wxWindow","_class_wxSpinCtrl",SwigwxSpinCtrlTowxWindow}, + { "_class_wxWindow","_wxSpinCtrl",SwigwxSpinCtrlTowxWindow}, { "_class_wxWindow","_class_wxSlider",SwigwxSliderTowxWindow}, { "_class_wxWindow","_wxSlider",SwigwxSliderTowxWindow}, { "_class_wxWindow","_class_wxRadioButton",SwigwxRadioButtonTowxWindow}, @@ -7616,6 +7805,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxScrolledWindow","_class_wxScrolledWindow",0}, { "_unsigned_char","_byte",0}, { "_class_wxMenu","_wxMenu",0}, + { "_wxControl","_class_wxSpinCtrl",SwigwxSpinCtrlTowxControl}, + { "_wxControl","_wxSpinCtrl",SwigwxSpinCtrlTowxControl}, { "_wxControl","_class_wxSlider",SwigwxSliderTowxControl}, { "_wxControl","_wxSlider",SwigwxSliderTowxControl}, { "_wxControl","_class_wxRadioButton",SwigwxRadioButtonTowxControl}, @@ -7717,6 +7908,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxValidator","_class_wxValidator",0}, { "_class_wxLayoutConstraints","_wxLayoutConstraints",0}, { "_wxIconizeEvent","_class_wxIconizeEvent",0}, + { "_class_wxControl","_class_wxSpinCtrl",SwigwxSpinCtrlTowxControl}, + { "_class_wxControl","_wxSpinCtrl",SwigwxSpinCtrlTowxControl}, { "_class_wxControl","_class_wxSlider",SwigwxSliderTowxControl}, { "_class_wxControl","_wxSlider",SwigwxSliderTowxControl}, { "_class_wxControl","_class_wxRadioButton",SwigwxRadioButtonTowxControl}, @@ -7787,6 +7980,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxMemoryDC","_wxMemoryDC",0}, { "_wxPyTextDropTarget","_class_wxPyTextDropTarget",0}, { "_wxMenuBar","_class_wxMenuBar",0}, + { "_wxEvtHandler","_class_wxSpinCtrl",SwigwxSpinCtrlTowxEvtHandler}, + { "_wxEvtHandler","_wxSpinCtrl",SwigwxSpinCtrlTowxEvtHandler}, { "_wxEvtHandler","_class_wxSlider",SwigwxSliderTowxEvtHandler}, { "_wxEvtHandler","_wxSlider",SwigwxSliderTowxEvtHandler}, { "_wxEvtHandler","_class_wxRadioButton",SwigwxRadioButtonTowxEvtHandler}, @@ -7835,6 +8030,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxFileDataObject","_class_wxFileDataObject",0}, { "_class_wxEraseEvent","_wxEraseEvent",0}, { "_class_wxDataObjectComposite","_wxDataObjectComposite",0}, + { "_wxWindow","_class_wxSpinCtrl",SwigwxSpinCtrlTowxWindow}, + { "_wxWindow","_wxSpinCtrl",SwigwxSpinCtrlTowxWindow}, { "_wxWindow","_class_wxSlider",SwigwxSliderTowxWindow}, { "_wxWindow","_wxSlider",SwigwxSliderTowxWindow}, { "_wxWindow","_class_wxRadioButton",SwigwxRadioButtonTowxWindow}, diff --git a/utils/wxPython/src/msw/controls.py b/wxPython/src/gtk/controls.py similarity index 95% rename from utils/wxPython/src/msw/controls.py rename to wxPython/src/gtk/controls.py index f0c8a8c0de..3e6a270097 100644 --- a/utils/wxPython/src/msw/controls.py +++ b/wxPython/src/gtk/controls.py @@ -30,7 +30,7 @@ class wxControl(wxControlPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxControl,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -54,7 +54,7 @@ class wxButton(wxButtonPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxButton,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -91,13 +91,22 @@ class wxBitmapButtonPtr(wxButtonPtr): def SetBitmapLabel(self, *_args, **_kwargs): val = apply(controlsc.wxBitmapButton_SetBitmapLabel,(self,) + _args, _kwargs) return val + def SetMargins(self, *_args, **_kwargs): + val = apply(controlsc.wxBitmapButton_SetMargins,(self,) + _args, _kwargs) + return val + def GetMarginX(self, *_args, **_kwargs): + val = apply(controlsc.wxBitmapButton_GetMarginX,(self,) + _args, _kwargs) + return val + def GetMarginY(self, *_args, **_kwargs): + val = apply(controlsc.wxBitmapButton_GetMarginY,(self,) + _args, _kwargs) + return val def __repr__(self): return "<C wxBitmapButton instance at %s>" % (self.this,) class wxBitmapButton(wxBitmapButtonPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxBitmapButton,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -118,7 +127,7 @@ class wxCheckBox(wxCheckBoxPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxCheckBox,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -166,7 +175,7 @@ class wxChoice(wxChoicePtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxChoice,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -244,7 +253,7 @@ class wxComboBox(wxComboBoxPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxComboBox,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -283,7 +292,7 @@ class wxGauge(wxGaugePtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxGauge,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -332,7 +341,7 @@ class wxStaticText(wxStaticTextPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxStaticText,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -401,7 +410,7 @@ class wxListBox(wxListBoxPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxListBox,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -428,7 +437,7 @@ class wxCheckListBox(wxCheckListBoxPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxCheckListBox,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -551,7 +560,7 @@ class wxTextCtrl(wxTextCtrlPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxTextCtrl,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -587,7 +596,7 @@ class wxScrollBar(wxScrollBarPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxScrollBar,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -641,7 +650,7 @@ class wxStaticBitmap(wxStaticBitmapPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxStaticBitmap,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -695,7 +704,7 @@ class wxRadioBox(wxRadioBoxPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxRadioBox,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -716,7 +725,7 @@ class wxRadioButton(wxRadioButtonPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxRadioButton,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) @@ -788,7 +797,21 @@ class wxSlider(wxSliderPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controlsc.new_wxSlider,_args,_kwargs) self.thisown = 1 - wx._StdWindowCallbacks(self) + #wx._StdWindowCallbacks(self) + + + + +class wxSpinCtrlPtr(wxSpinButtonPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def __repr__(self): + return "<C wxSpinCtrl instance at %s>" % (self.this,) +class wxSpinCtrl(wxSpinCtrlPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(controlsc.new_wxSpinCtrl,_args,_kwargs) + self.thisown = 1 diff --git a/utils/wxPython/src/msw/controls2.cpp b/wxPython/src/gtk/controls2.cpp similarity index 76% rename from utils/wxPython/src/msw/controls2.cpp rename to wxPython/src/gtk/controls2.cpp index 6eaa46dc17..4389888fa7 100644 --- a/utils/wxPython/src/msw/controls2.cpp +++ b/wxPython/src/gtk/controls2.cpp @@ -1,5 +1,5 @@ /* - * FILE : msw/controls2.cpp + * FILE : gtk/controls2.cpp * * This file was automatically generated by : * Simplified Wrapper and Interface Generator (SWIG) @@ -111,7 +111,7 @@ static char* wxStringErrorMsg = "string type is required for parameter"; extern wxValidator wxPyDefaultValidator; - int wxCALLBACK wxPyTreeCtrl_SortItems(long item1, long item2, long funcPtr) { + int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) { int retval = 0; PyObject* func = (PyObject*)funcPtr; bool doSave = wxPyRestoreThread(); @@ -157,592 +157,2146 @@ public: PyObject* m_obj; }; + +class wxPyTreeCtrl : public wxTreeCtrl { +public: + wxPyTreeCtrl(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + char* name) : + wxTreeCtrl(parent, id, pos, size, style, validator, name) {} + + + int OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2) { + int rval = 0; + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("OnCompareItems")) + rval = m_myInst.callCallback(Py_BuildValue( + "(OO)", + wxPyConstructObject((void*)&item1, "wxTreeItemId"), + wxPyConstructObject((void*)&item2, "wxTreeItemId"))); + else + rval = wxTreeCtrl::OnCompareItems(item1, item2); + wxPySaveThread(doSave); + return rval; + } + PYPRIVATE; +}; + #ifdef __cplusplus extern "C" { #endif -#define wxListItem_m_mask_set(_swigobj,_swigval) (_swigobj->m_mask = _swigval,_swigval) -static PyObject *_wrap_wxListItem_m_mask_set(PyObject *self, PyObject *args, PyObject *kwargs) { +#define new_wxListItemAttr() (new wxListItemAttr()) +static PyObject *_wrap_new_wxListItemAttr(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItemAttr * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxListItemAttr",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxListItemAttr *)new_wxListItemAttr(); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxListItemAttr_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxListItemAttr_SetTextColour(_swigobj,_swigarg0) (_swigobj->SetTextColour(_swigarg0)) +static PyObject *_wrap_wxListItemAttr_SetTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItemAttr * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colText", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxListItemAttr_SetTextColour",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItemAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItemAttr_SetTextColour. Expected _wxListItemAttr_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItemAttr_SetTextColour(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItemAttr_SetBackgroundColour(_swigobj,_swigarg0) (_swigobj->SetBackgroundColour(_swigarg0)) +static PyObject *_wrap_wxListItemAttr_SetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItemAttr * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colBack", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxListItemAttr_SetBackgroundColour",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItemAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItemAttr_SetBackgroundColour. Expected _wxListItemAttr_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItemAttr_SetBackgroundColour(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItemAttr_SetFont(_swigobj,_swigarg0) (_swigobj->SetFont(_swigarg0)) +static PyObject *_wrap_wxListItemAttr_SetFont(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItemAttr * _arg0; + wxFont * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","font", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxListItemAttr_SetFont",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItemAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItemAttr_SetFont. Expected _wxListItemAttr_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxFont_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxListItemAttr_SetFont. Expected _wxFont_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItemAttr_SetFont(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItemAttr_HasTextColour(_swigobj) (_swigobj->HasTextColour()) +static PyObject *_wrap_wxListItemAttr_HasTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxListItemAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItemAttr_HasTextColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItemAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItemAttr_HasTextColour. Expected _wxListItemAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxListItemAttr_HasTextColour(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxListItemAttr_HasBackgroundColour(_swigobj) (_swigobj->HasBackgroundColour()) +static PyObject *_wrap_wxListItemAttr_HasBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxListItemAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItemAttr_HasBackgroundColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItemAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItemAttr_HasBackgroundColour. Expected _wxListItemAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxListItemAttr_HasBackgroundColour(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxListItemAttr_HasFont(_swigobj) (_swigobj->HasFont()) +static PyObject *_wrap_wxListItemAttr_HasFont(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxListItemAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItemAttr_HasFont",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItemAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItemAttr_HasFont. Expected _wxListItemAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxListItemAttr_HasFont(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxListItemAttr_GetTextColour(_swigobj) (_swigobj->GetTextColour()) +static PyObject *_wrap_wxListItemAttr_GetTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxListItemAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItemAttr_GetTextColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItemAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItemAttr_GetTextColour. Expected _wxListItemAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxListItemAttr_GetTextColour(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxListItemAttr_GetBackgroundColour(_swigobj) (_swigobj->GetBackgroundColour()) +static PyObject *_wrap_wxListItemAttr_GetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxListItemAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItemAttr_GetBackgroundColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItemAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItemAttr_GetBackgroundColour. Expected _wxListItemAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxColour & _result_ref = wxListItemAttr_GetBackgroundColour(_arg0); + _result = (wxColour *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxListItemAttr_GetFont(_swigobj) (_swigobj->GetFont()) +static PyObject *_wrap_wxListItemAttr_GetFont(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxFont * _result; + wxListItemAttr * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItemAttr_GetFont",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItemAttr_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItemAttr_GetFont. Expected _wxListItemAttr_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxFont & _result_ref = wxListItemAttr_GetFont(_arg0); + _result = (wxFont *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxFont_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define new_wxListItem() (new wxListItem()) +static PyObject *_wrap_new_wxListItem(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxListItem",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxListItem *)new_wxListItem(); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxListItem_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define delete_wxListItem(_swigobj) (delete _swigobj) +static PyObject *_wrap_delete_wxListItem(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:delete_wxListItem",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of delete_wxListItem. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + delete_wxListItem(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_Clear(_swigobj) (_swigobj->Clear()) +static PyObject *_wrap_wxListItem_Clear(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_Clear",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_Clear. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_Clear(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_ClearAttributes(_swigobj) (_swigobj->ClearAttributes()) +static PyObject *_wrap_wxListItem_ClearAttributes(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_ClearAttributes",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_ClearAttributes. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_ClearAttributes(_arg0); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetMask(_swigobj,_swigarg0) (_swigobj->SetMask(_swigarg0)) +static PyObject *_wrap_wxListItem_SetMask(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + long _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","mask", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_SetMask",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetMask. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetMask(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetId(_swigobj,_swigarg0) (_swigobj->SetId(_swigarg0)) +static PyObject *_wrap_wxListItem_SetId(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + long _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","id", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_SetId",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetId. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetId(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetColumn(_swigobj,_swigarg0) (_swigobj->SetColumn(_swigarg0)) +static PyObject *_wrap_wxListItem_SetColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","col", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListItem_SetColumn",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetColumn. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetColumn(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetState(_swigobj,_swigarg0) (_swigobj->SetState(_swigarg0)) +static PyObject *_wrap_wxListItem_SetState(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + long _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","state", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_SetState",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetState. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetState(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetStateMask(_swigobj,_swigarg0) (_swigobj->SetStateMask(_swigarg0)) +static PyObject *_wrap_wxListItem_SetStateMask(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + long _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","stateMask", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_SetStateMask",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetStateMask. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetStateMask(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetText(_swigobj,_swigarg0) (_swigobj->SetText(_swigarg0)) +static PyObject *_wrap_wxListItem_SetText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxListItem_SetText",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetText. Expected _wxListItem_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetText(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxListItem_SetImage(_swigobj,_swigarg0) (_swigobj->SetImage(_swigarg0)) +static PyObject *_wrap_wxListItem_SetImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","image", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListItem_SetImage",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetImage. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetImage(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetData(_swigobj,_swigarg0) (_swigobj->SetData(_swigarg0)) +static PyObject *_wrap_wxListItem_SetData(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + long _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","data", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_SetData",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetData. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetData(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetWidth(_swigobj,_swigarg0) (_swigobj->SetWidth(_swigarg0)) +static PyObject *_wrap_wxListItem_SetWidth(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","width", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListItem_SetWidth",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetWidth. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetWidth(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetAlign(_swigobj,_swigarg0) (_swigobj->SetAlign(_swigarg0)) +static PyObject *_wrap_wxListItem_SetAlign(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + wxListColumnFormat _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","align", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListItem_SetAlign",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetAlign. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetAlign(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetTextColour(_swigobj,_swigarg0) (_swigobj->SetTextColour(_swigarg0)) +static PyObject *_wrap_wxListItem_SetTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colText", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxListItem_SetTextColour",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetTextColour. Expected _wxListItem_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetTextColour(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetBackgroundColour(_swigobj,_swigarg0) (_swigobj->SetBackgroundColour(_swigarg0)) +static PyObject *_wrap_wxListItem_SetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + wxColour * _arg1; + PyObject * _argo0 = 0; + wxColour temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","colBack", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxListItem_SetBackgroundColour",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetBackgroundColour. Expected _wxListItem_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxColour_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetBackgroundColour(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_SetFont(_swigobj,_swigarg0) (_swigobj->SetFont(_swigarg0)) +static PyObject *_wrap_wxListItem_SetFont(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItem * _arg0; + wxFont * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","font", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxListItem_SetFont",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_SetFont. Expected _wxListItem_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxFont_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxListItem_SetFont. Expected _wxFont_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxListItem_SetFont(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxListItem_GetMask(_swigobj) (_swigobj->GetMask()) +static PyObject *_wrap_wxListItem_GetMask(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetMask",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetMask. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_GetMask(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_GetId(_swigobj) (_swigobj->GetId()) +static PyObject *_wrap_wxListItem_GetId(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetId",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetId. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_GetId(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_GetColumn(_swigobj) (_swigobj->GetColumn()) +static PyObject *_wrap_wxListItem_GetColumn(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetColumn",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetColumn. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxListItem_GetColumn(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxListItem_GetState(_swigobj) (_swigobj->GetState()) +static PyObject *_wrap_wxListItem_GetState(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetState",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetState. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_GetState(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_GetText(_swigobj) (_swigobj->GetText()) +static PyObject *_wrap_wxListItem_GetText(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetText",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetText. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + const wxString & _result_ref = wxListItem_GetText(_arg0); + _result = (wxString *) &_result_ref; + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} + return _resultobj; +} + +#define wxListItem_GetImage(_swigobj) (_swigobj->GetImage()) +static PyObject *_wrap_wxListItem_GetImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetImage",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetImage. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxListItem_GetImage(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxListItem_GetData(_swigobj) (_swigobj->GetData()) +static PyObject *_wrap_wxListItem_GetData(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetData",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetData. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_GetData(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_GetWidth(_swigobj) (_swigobj->GetWidth()) +static PyObject *_wrap_wxListItem_GetWidth(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetWidth",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetWidth. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxListItem_GetWidth(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxListItem_GetAlign(_swigobj) (_swigobj->GetAlign()) +static PyObject *_wrap_wxListItem_GetAlign(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListColumnFormat _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetAlign",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetAlign. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxListColumnFormat )wxListItem_GetAlign(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxListItem_GetAttributes(_swigobj) (_swigobj->GetAttributes()) +static PyObject *_wrap_wxListItem_GetAttributes(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxListItemAttr * _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetAttributes",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetAttributes. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxListItemAttr *)wxListItem_GetAttributes(_arg0); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxListItemAttr_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxListItem_HasAttributes(_swigobj) (_swigobj->HasAttributes()) +static PyObject *_wrap_wxListItem_HasAttributes(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_HasAttributes",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_HasAttributes. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxListItem_HasAttributes(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxListItem_GetTextColour(_swigobj) (_swigobj->GetTextColour()) +static PyObject *_wrap_wxListItem_GetTextColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetTextColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetTextColour. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxColour (wxListItem_GetTextColour(_arg0)); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxListItem_GetBackgroundColour(_swigobj) (_swigobj->GetBackgroundColour()) +static PyObject *_wrap_wxListItem_GetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxColour * _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetBackgroundColour",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetBackgroundColour. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxColour (wxListItem_GetBackgroundColour(_arg0)); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxColour_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxListItem_GetFont(_swigobj) (_swigobj->GetFont()) +static PyObject *_wrap_wxListItem_GetFont(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxFont * _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_GetFont",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_GetFont. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxFont (wxListItem_GetFont(_arg0)); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxFont_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + +#define wxListItem_m_mask_set(_swigobj,_swigval) (_swigobj->m_mask = _swigval,_swigval) +static PyObject *_wrap_wxListItem_m_mask_set(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + long _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","m_mask", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_m_mask_set",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_mask_set. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_m_mask_set(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_m_mask_get(_swigobj) ((long ) _swigobj->m_mask) +static PyObject *_wrap_wxListItem_m_mask_get(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_mask_get",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_mask_get. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_m_mask_get(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_m_itemId_set(_swigobj,_swigval) (_swigobj->m_itemId = _swigval,_swigval) +static PyObject *_wrap_wxListItem_m_itemId_set(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; long _result; wxListItem * _arg0; long _arg1; PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_mask", NULL }; + char *_kwnames[] = { "self","m_itemId", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_m_mask_set",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_m_itemId_set",_kwnames,&_argo0,&_arg1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_mask_set. Expected _wxListItem_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_itemId_set. Expected _wxListItem_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxListItem_m_mask_set(_arg0,_arg1); + _result = (long )wxListItem_m_itemId_set(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_m_itemId_get(_swigobj) ((long ) _swigobj->m_itemId) +static PyObject *_wrap_wxListItem_m_itemId_get(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_itemId_get",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_itemId_get. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_m_itemId_get(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_m_col_set(_swigobj,_swigval) (_swigobj->m_col = _swigval,_swigval) +static PyObject *_wrap_wxListItem_m_col_set(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxListItem * _arg0; + int _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","m_col", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListItem_m_col_set",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_col_set. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxListItem_m_col_set(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxListItem_m_col_get(_swigobj) ((int ) _swigobj->m_col) +static PyObject *_wrap_wxListItem_m_col_get(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + int _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_col_get",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_col_get. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxListItem_m_col_get(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxListItem_m_state_set(_swigobj,_swigval) (_swigobj->m_state = _swigval,_swigval) +static PyObject *_wrap_wxListItem_m_state_set(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + long _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","m_state", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_m_state_set",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_state_set. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_m_state_set(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_m_state_get(_swigobj) ((long ) _swigobj->m_state) +static PyObject *_wrap_wxListItem_m_state_get(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_state_get",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_state_get. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_m_state_get(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_m_stateMask_set(_swigobj,_swigval) (_swigobj->m_stateMask = _swigval,_swigval) +static PyObject *_wrap_wxListItem_m_stateMask_set(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + long _arg1; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","m_stateMask", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_m_stateMask_set",_kwnames,&_argo0,&_arg1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_stateMask_set. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_m_stateMask_set(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxListItem_m_stateMask_get(_swigobj) ((long ) _swigobj->m_stateMask) +static PyObject *_wrap_wxListItem_m_stateMask_get(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + long _result; + wxListItem * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_stateMask_get",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_stateMask_get. Expected _wxListItem_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (long )wxListItem_m_stateMask_get(_arg0); wxPy_END_ALLOW_THREADS; } _resultobj = Py_BuildValue("l",_result); return _resultobj; } -#define wxListItem_m_mask_get(_swigobj) ((long ) _swigobj->m_mask) -static PyObject *_wrap_wxListItem_m_mask_get(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListItem_m_text_set(_swigobj,_swigval) (_swigobj->m_text = *(_swigval),_swigval) +static PyObject *_wrap_wxListItem_m_text_set(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxListItem * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","m_text", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxListItem_m_text_set",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_text_set. Expected _wxListItem_p."); + return NULL; + } + } +{ + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxString *)wxListItem_m_text_set(_arg0,_arg1); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +#define wxListItem_m_text_get(_swigobj) (&_swigobj->m_text) +static PyObject *_wrap_wxListItem_m_text_get(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - long _result; + wxString * _result; wxListItem * _arg0; PyObject * _argo0 = 0; char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_mask_get",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_text_get",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_mask_get. Expected _wxListItem_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_text_get. Expected _wxListItem_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxListItem_m_mask_get(_arg0); + _result = (wxString *)wxListItem_m_text_get(_arg0); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("l",_result); +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} return _resultobj; } -#define wxListItem_m_itemId_set(_swigobj,_swigval) (_swigobj->m_itemId = _swigval,_swigval) -static PyObject *_wrap_wxListItem_m_itemId_set(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListItem_m_image_set(_swigobj,_swigval) (_swigobj->m_image = _swigval,_swigval) +static PyObject *_wrap_wxListItem_m_image_set(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - long _result; + int _result; wxListItem * _arg0; - long _arg1; + int _arg1; PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_itemId", NULL }; + char *_kwnames[] = { "self","m_image", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_m_itemId_set",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListItem_m_image_set",_kwnames,&_argo0,&_arg1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_itemId_set. Expected _wxListItem_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_image_set. Expected _wxListItem_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxListItem_m_itemId_set(_arg0,_arg1); + _result = (int )wxListItem_m_image_set(_arg0,_arg1); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("l",_result); +} _resultobj = Py_BuildValue("i",_result); return _resultobj; } -#define wxListItem_m_itemId_get(_swigobj) ((long ) _swigobj->m_itemId) -static PyObject *_wrap_wxListItem_m_itemId_get(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListItem_m_image_get(_swigobj) ((int ) _swigobj->m_image) +static PyObject *_wrap_wxListItem_m_image_get(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - long _result; + int _result; wxListItem * _arg0; PyObject * _argo0 = 0; char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_itemId_get",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_image_get",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_itemId_get. Expected _wxListItem_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_image_get. Expected _wxListItem_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxListItem_m_itemId_get(_arg0); + _result = (int )wxListItem_m_image_get(_arg0); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("l",_result); +} _resultobj = Py_BuildValue("i",_result); return _resultobj; } -#define wxListItem_m_col_set(_swigobj,_swigval) (_swigobj->m_col = _swigval,_swigval) -static PyObject *_wrap_wxListItem_m_col_set(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListItem_m_data_set(_swigobj,_swigval) (_swigobj->m_data = _swigval,_swigval) +static PyObject *_wrap_wxListItem_m_data_set(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - int _result; + long _result; wxListItem * _arg0; - int _arg1; + long _arg1; PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_col", NULL }; + char *_kwnames[] = { "self","m_data", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListItem_m_col_set",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_m_data_set",_kwnames,&_argo0,&_arg1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_col_set. Expected _wxListItem_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_data_set. Expected _wxListItem_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxListItem_m_col_set(_arg0,_arg1); + _result = (long )wxListItem_m_data_set(_arg0,_arg1); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); +} _resultobj = Py_BuildValue("l",_result); return _resultobj; } -#define wxListItem_m_col_get(_swigobj) ((int ) _swigobj->m_col) -static PyObject *_wrap_wxListItem_m_col_get(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListItem_m_data_get(_swigobj) ((long ) _swigobj->m_data) +static PyObject *_wrap_wxListItem_m_data_get(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - int _result; + long _result; wxListItem * _arg0; PyObject * _argo0 = 0; char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_col_get",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_data_get",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_col_get. Expected _wxListItem_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_data_get. Expected _wxListItem_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxListItem_m_col_get(_arg0); + _result = (long )wxListItem_m_data_get(_arg0); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); +} _resultobj = Py_BuildValue("l",_result); return _resultobj; } -#define wxListItem_m_state_set(_swigobj,_swigval) (_swigobj->m_state = _swigval,_swigval) -static PyObject *_wrap_wxListItem_m_state_set(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListItem_m_format_set(_swigobj,_swigval) (_swigobj->m_format = _swigval,_swigval) +static PyObject *_wrap_wxListItem_m_format_set(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - long _result; + int _result; wxListItem * _arg0; - long _arg1; + int _arg1; PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_state", NULL }; + char *_kwnames[] = { "self","m_format", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_m_state_set",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListItem_m_format_set",_kwnames,&_argo0,&_arg1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_state_set. Expected _wxListItem_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_format_set. Expected _wxListItem_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxListItem_m_state_set(_arg0,_arg1); + _result = (int )wxListItem_m_format_set(_arg0,_arg1); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("l",_result); +} _resultobj = Py_BuildValue("i",_result); return _resultobj; } -#define wxListItem_m_state_get(_swigobj) ((long ) _swigobj->m_state) -static PyObject *_wrap_wxListItem_m_state_get(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListItem_m_format_get(_swigobj) ((int ) _swigobj->m_format) +static PyObject *_wrap_wxListItem_m_format_get(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - long _result; + int _result; wxListItem * _arg0; PyObject * _argo0 = 0; char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_state_get",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_format_get",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_state_get. Expected _wxListItem_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_format_get. Expected _wxListItem_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxListItem_m_state_get(_arg0); + _result = (int )wxListItem_m_format_get(_arg0); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("l",_result); +} _resultobj = Py_BuildValue("i",_result); return _resultobj; } -#define wxListItem_m_stateMask_set(_swigobj,_swigval) (_swigobj->m_stateMask = _swigval,_swigval) -static PyObject *_wrap_wxListItem_m_stateMask_set(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListItem_m_width_set(_swigobj,_swigval) (_swigobj->m_width = _swigval,_swigval) +static PyObject *_wrap_wxListItem_m_width_set(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - long _result; + int _result; wxListItem * _arg0; - long _arg1; + int _arg1; PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_stateMask", NULL }; + char *_kwnames[] = { "self","m_width", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_m_stateMask_set",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListItem_m_width_set",_kwnames,&_argo0,&_arg1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_stateMask_set. Expected _wxListItem_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_width_set. Expected _wxListItem_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxListItem_m_stateMask_set(_arg0,_arg1); + _result = (int )wxListItem_m_width_set(_arg0,_arg1); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("l",_result); +} _resultobj = Py_BuildValue("i",_result); return _resultobj; } -#define wxListItem_m_stateMask_get(_swigobj) ((long ) _swigobj->m_stateMask) -static PyObject *_wrap_wxListItem_m_stateMask_get(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListItem_m_width_get(_swigobj) ((int ) _swigobj->m_width) +static PyObject *_wrap_wxListItem_m_width_get(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - long _result; + int _result; wxListItem * _arg0; PyObject * _argo0 = 0; char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_stateMask_get",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_width_get",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_stateMask_get. Expected _wxListItem_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_width_get. Expected _wxListItem_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxListItem_m_stateMask_get(_arg0); + _result = (int )wxListItem_m_width_get(_arg0); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("l",_result); +} _resultobj = Py_BuildValue("i",_result); return _resultobj; } -#define wxListItem_m_text_set(_swigobj,_swigval) (_swigobj->m_text = *(_swigval),_swigval) -static PyObject *_wrap_wxListItem_m_text_set(PyObject *self, PyObject *args, PyObject *kwargs) { +static void *SwigwxListEventTowxCommandEvent(void *ptr) { + wxListEvent *src; + wxCommandEvent *dest; + src = (wxListEvent *) ptr; + dest = (wxCommandEvent *) src; + return (void *) dest; +} + +static void *SwigwxListEventTowxEvent(void *ptr) { + wxListEvent *src; + wxEvent *dest; + src = (wxListEvent *) ptr; + dest = (wxEvent *) src; + return (void *) dest; +} + +#define wxListEvent_m_code_set(_swigobj,_swigval) (_swigobj->m_code = _swigval,_swigval) +static PyObject *_wrap_wxListEvent_m_code_set(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - wxString * _result; - wxListItem * _arg0; - wxString * _arg1; + int _result; + wxListEvent * _arg0; + int _arg1; PyObject * _argo0 = 0; - PyObject * _obj1 = 0; - char *_kwnames[] = { "self","m_text", NULL }; + char *_kwnames[] = { "self","m_code", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxListItem_m_text_set",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListEvent_m_code_set",_kwnames,&_argo0,&_arg1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_text_set. Expected _wxListItem_p."); + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListEvent_m_code_set. Expected _wxListEvent_p."); return NULL; } } -{ - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AsString(_obj1), PyString_Size(_obj1)); -} { wxPy_BEGIN_ALLOW_THREADS; - _result = (wxString *)wxListItem_m_text_set(_arg0,_arg1); + _result = (int )wxListEvent_m_code_set(_arg0,_arg1); wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); -} -{ - if (_obj1) - delete _arg1; -} +} _resultobj = Py_BuildValue("i",_result); return _resultobj; } -#define wxListItem_m_text_get(_swigobj) (&_swigobj->m_text) -static PyObject *_wrap_wxListItem_m_text_get(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListEvent_m_code_get(_swigobj) ((int ) _swigobj->m_code) +static PyObject *_wrap_wxListEvent_m_code_get(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - wxString * _result; - wxListItem * _arg0; + int _result; + wxListEvent * _arg0; PyObject * _argo0 = 0; char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_text_get",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListEvent_m_code_get",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_text_get. Expected _wxListItem_p."); + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListEvent_m_code_get. Expected _wxListEvent_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (wxString *)wxListItem_m_text_get(_arg0); + _result = (int )wxListEvent_m_code_get(_arg0); wxPy_END_ALLOW_THREADS; -}{ - _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); -} +} _resultobj = Py_BuildValue("i",_result); return _resultobj; } -#define wxListItem_m_image_set(_swigobj,_swigval) (_swigobj->m_image = _swigval,_swigval) -static PyObject *_wrap_wxListItem_m_image_set(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListEvent_m_itemIndex_set(_swigobj,_swigval) (_swigobj->m_itemIndex = _swigval,_swigval) +static PyObject *_wrap_wxListEvent_m_itemIndex_set(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - int _result; - wxListItem * _arg0; - int _arg1; + long _result; + wxListEvent * _arg0; + long _arg1; PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_image", NULL }; + char *_kwnames[] = { "self","m_itemIndex", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxListItem_m_image_set",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListEvent_m_itemIndex_set",_kwnames,&_argo0,&_arg1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_image_set. Expected _wxListItem_p."); + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListEvent_m_itemIndex_set. Expected _wxListEvent_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxListItem_m_image_set(_arg0,_arg1); + _result = (long )wxListEvent_m_itemIndex_set(_arg0,_arg1); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); +} _resultobj = Py_BuildValue("l",_result); return _resultobj; } -#define wxListItem_m_image_get(_swigobj) ((int ) _swigobj->m_image) -static PyObject *_wrap_wxListItem_m_image_get(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListEvent_m_itemIndex_get(_swigobj) ((long ) _swigobj->m_itemIndex) +static PyObject *_wrap_wxListEvent_m_itemIndex_get(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - int _result; - wxListItem * _arg0; + long _result; + wxListEvent * _arg0; PyObject * _argo0 = 0; char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_image_get",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListEvent_m_itemIndex_get",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_image_get. Expected _wxListItem_p."); + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListEvent_m_itemIndex_get. Expected _wxListEvent_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxListItem_m_image_get(_arg0); + _result = (long )wxListEvent_m_itemIndex_get(_arg0); wxPy_END_ALLOW_THREADS; -} _resultobj = Py_BuildValue("i",_result); +} _resultobj = Py_BuildValue("l",_result); return _resultobj; } -#define wxListItem_m_data_set(_swigobj,_swigval) (_swigobj->m_data = _swigval,_swigval) -static PyObject *_wrap_wxListItem_m_data_set(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListEvent_m_oldItemIndex_set(_swigobj,_swigval) (_swigobj->m_oldItemIndex = _swigval,_swigval) +static PyObject *_wrap_wxListEvent_m_oldItemIndex_set(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; long _result; - wxListItem * _arg0; + wxListEvent * _arg0; long _arg1; PyObject * _argo0 = 0; - char *_kwnames[] = { "self","m_data", NULL }; + char *_kwnames[] = { "self","m_oldItemIndex", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListItem_m_data_set",_kwnames,&_argo0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxListEvent_m_oldItemIndex_set",_kwnames,&_argo0,&_arg1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_data_set. Expected _wxListItem_p."); + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListEvent_m_oldItemIndex_set. Expected _wxListEvent_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxListItem_m_data_set(_arg0,_arg1); + _result = (long )wxListEvent_m_oldItemIndex_set(_arg0,_arg1); wxPy_END_ALLOW_THREADS; } _resultobj = Py_BuildValue("l",_result); return _resultobj; } -#define wxListItem_m_data_get(_swigobj) ((long ) _swigobj->m_data) -static PyObject *_wrap_wxListItem_m_data_get(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListEvent_m_oldItemIndex_get(_swigobj) ((long ) _swigobj->m_oldItemIndex) +static PyObject *_wrap_wxListEvent_m_oldItemIndex_get(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; long _result; - wxListItem * _arg0; + wxListEvent * _arg0; PyObject * _argo0 = 0; char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListItem_m_data_get",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxListEvent_m_oldItemIndex_get",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListItem_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListItem_m_data_get. Expected _wxListItem_p."); + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxListEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxListEvent_m_oldItemIndex_get. Expected _wxListEvent_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxListItem_m_data_get(_arg0); + _result = (long )wxListEvent_m_oldItemIndex_get(_arg0); wxPy_END_ALLOW_THREADS; } _resultobj = Py_BuildValue("l",_result); return _resultobj; } -#define wxListItem_m_format_set(_swigobj,_swigval) (_swigobj->m_format = _swigval,_swigval) -static PyObject *_wrap_wxListItem_m_format_set(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxListEvent_m_col_set(_swigobj,_swigval) (_swigobj->